diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/autodust/AutoDustCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/autodust/AutoDustCommand.java index b66892dc..854ee495 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/autodust/AutoDustCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/autodust/AutoDustCommand.java @@ -30,7 +30,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; -import java.util.regex.Matcher; import java.util.regex.Pattern; @Linked @@ -46,7 +45,7 @@ public class AutoDustCommand extends SWCommand implements Listener { } @Register() - public void genericCommand(@Validator Player p) { + public void genericCommand(Player p) { boolean autoDust = Config.getInstance().get(p).getPlainValueOrDefault("autodust", false); Config.getInstance().get(p).put("autodust", !autoDust); } @@ -61,13 +60,9 @@ public class AutoDustCommand extends SWCommand implements Listener { Location dustLocation = placedOn.getLocation().add(0,1,0); Material materialOnDustLocation = dustLocation.getBlock().getType(); - if(materialOnDustLocation.equals(Material.AIR) || !isColoredBlock(placedOn)) return; + if(materialOnDustLocation.equals(Material.AIR) || + COLORED_BLOCK_REGEX.matcher(placedOn.getTranslationKey()).matches()) return; p.getWorld().setBlockData(dustLocation,Material.REDSTONE_WIRE.createBlockData()); } - - public boolean isColoredBlock(Block block) { - Matcher matcher = COLORED_BLOCK_REGEX.matcher(block.getTranslationKey()); - return matcher.matches(); - } }