diff --git a/build.gradle b/build.gradle index 7e9d78f..0bc7fee 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ plugins { } group = 'com.carrot' -version = '2.10-S5.1-MC1.10.2-SNAPSHOT' +version = '2.9-S5.1-MC1.10.2-SNAPSHOT' description = 'A towny-like worldguard-like zone managment plugin' dependencies { diff --git a/src/main/java/com/arckenver/nations/listener/BuildPermListener.java b/src/main/java/com/arckenver/nations/listener/BuildPermListener.java index c4c9fbf..6b2ec71 100644 --- a/src/main/java/com/arckenver/nations/listener/BuildPermListener.java +++ b/src/main/java/com/arckenver/nations/listener/BuildPermListener.java @@ -34,15 +34,14 @@ public void onPlayerChangeBlock(ChangeBlockEvent.Pre event, @First Player player return; } for (Location loc : event.getLocations()) { - if (!ConfigHandler.isWhitelisted("break", loc.getBlock().getId())) { - if(!DataHandler.getPerm("build", player.getUniqueId(), loc)) - { - event.setCancelled(true); - try { - player.sendMessage(Text.of(TextColors.RED, LanguageHandler.ERROR_PERM_BUILD)); - } catch (Exception e) {} - return; - } + if (!ConfigHandler.isWhitelisted("break", loc.getBlock().getId()) + && !DataHandler.getPerm("build", player.getUniqueId(), loc)) + { + event.setCancelled(true); + try { + player.sendMessage(Text.of(TextColors.RED, LanguageHandler.ERROR_PERM_BUILD)); + } catch (Exception e) {} + return; } } } @@ -62,14 +61,13 @@ public void onPlayerPlacesBlock(ChangeBlockEvent.Place event, @First Player play .getTransactions() .stream() .forEach(trans -> trans.getOriginal().getLocation().ifPresent(loc -> { - if (!ConfigHandler.isWhitelisted("build", trans.getFinal().getState().getType().getId())) { - if(!DataHandler.getPerm("build", player.getUniqueId(), loc)) - { - trans.setValid(false); - try { - player.sendMessage(Text.of(TextColors.RED, LanguageHandler.ERROR_PERM_BUILD)); - } catch (Exception e) {} - } + if (!ConfigHandler.isWhitelisted("build", trans.getFinal().getState().getType().getId()) + && !DataHandler.getPerm("build", player.getUniqueId(), loc)) + { + trans.setValid(false); + try { + player.sendMessage(Text.of(TextColors.RED, LanguageHandler.ERROR_PERM_BUILD)); + } catch (Exception e) {} } })); } @@ -89,14 +87,13 @@ public void onPlayerBreaksBlock(ChangeBlockEvent.Break event, @First Player play .getTransactions() .stream() .forEach(trans -> trans.getOriginal().getLocation().ifPresent(loc -> { - if (!ConfigHandler.isWhitelisted("break", trans.getFinal().getState().getType().getId())) { - if(!DataHandler.getPerm("build", player.getUniqueId(), loc)) - { - trans.setValid(false); - try { - player.sendMessage(Text.of(TextColors.RED, LanguageHandler.ERROR_PERM_BUILD)); - } catch (Exception e) {} - } + if (!ConfigHandler.isWhitelisted("break", trans.getFinal().getState().getType().getId()) + && !DataHandler.getPerm("build", player.getUniqueId(), loc)) + { + trans.setValid(false); + try { + player.sendMessage(Text.of(TextColors.RED, LanguageHandler.ERROR_PERM_BUILD)); + } catch (Exception e) {} } })); }