diff options
author | ementalo <ementalodev@gmx.co.uk> | 2012-10-11 13:40:26 +0100 |
---|---|---|
committer | ementalo <ementalodev@gmx.co.uk> | 2012-10-11 13:40:26 +0100 |
commit | 5e663508ce29dbcb327804a4b75351783d6e74f0 (patch) | |
tree | 2c85bace527a4a6d00ca7a4c7d5e2ca30efe04cd | |
parent | 3d2870cc4e6f771a37304ce9e6267663e10d01e6 (diff) | |
download | Essentials-5e663508ce29dbcb327804a4b75351783d6e74f0.tar Essentials-5e663508ce29dbcb327804a4b75351783d6e74f0.tar.gz Essentials-5e663508ce29dbcb327804a4b75351783d6e74f0.tar.lz Essentials-5e663508ce29dbcb327804a4b75351783d6e74f0.tar.xz Essentials-5e663508ce29dbcb327804a4b75351783d6e74f0.zip |
Anti Build 3.0 update
10 files changed, 177 insertions, 215 deletions
diff --git a/Essentials/src/net/ess3/settings/antibuild/Alert.java b/Essentials/src/net/ess3/settings/antibuild/Alert.java index 80294d294..ec4aac252 100644 --- a/Essentials/src/net/ess3/settings/antibuild/Alert.java +++ b/Essentials/src/net/ess3/settings/antibuild/Alert.java @@ -1,5 +1,6 @@ package net.ess3.settings.antibuild; +import java.util.Arrays; import java.util.HashSet; import java.util.Set; import lombok.AccessLevel; @@ -17,28 +18,57 @@ import org.bukkit.Material; @EqualsAndHashCode(callSuper = false) public class Alert implements StorageObject { - @Comment("For which block types would you like to be alerted?") + @Comment("For which block types would you like to be alerted when placed?") @ListType(Material.class) @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) - private Set<Material> alertOnPlacement; + private Set<Material> alertOnPlacement = null; + @Comment("For which block types would you like to be alerted when used?") @ListType(Material.class) @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) - private Set<Material> alertOnUse; + private Set<Material> alertOnUse = null; + @Comment("For which block types would you like to be alerted when broken?") @ListType(Material.class) @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) - private Set<Material> alertOnBreak; - + private Set<Material> alertOnBreak = null; public Alert() { - //todo full default list - alertOnPlacement = new HashSet<Material>(); - alertOnPlacement.add(Material.GLASS); - alertOnUse = new HashSet<Material>(); - alertOnUse.add(Material.LAVA); - alertOnBreak = new HashSet<Material>(); - alertOnBreak.add(Material.OBSIDIAN); + if (alertOnPlacement == null) + { + Material[] mat = + { + Material.LAVA, Material.STATIONARY_LAVA, Material.TNT, Material.LAVA_BUCKET + }; + alertOnPlacement = new HashSet<Material>(); + alertOnPlacement.addAll(Arrays.asList(mat)); + } + + if (alertOnUse == null) + { + alertOnUse = new HashSet<Material>(); + alertOnUse.add(Material.LAVA_BUCKET); + } + + if (alertOnBreak == null) + { + alertOnBreak = new HashSet<Material>(); + } + } + + public Set<Material> getAlertOnPlacement() + { + return alertOnPlacement; + } + + public Set<Material> getAlertOnUse() + { + return alertOnUse; + } + + public Set<Material> getAlertOnBreak() + { + return alertOnBreak; } }
\ No newline at end of file diff --git a/Essentials/src/net/ess3/settings/antibuild/AntiBuild.java b/Essentials/src/net/ess3/settings/antibuild/AntiBuild.java index 59f90466c..94a8aac2d 100644 --- a/Essentials/src/net/ess3/settings/antibuild/AntiBuild.java +++ b/Essentials/src/net/ess3/settings/antibuild/AntiBuild.java @@ -15,19 +15,21 @@ public class AntiBuild implements StorageObject "Set true to disable building for those people", "Setting to false means EssentialsAntiBuild will never prevent you from building" }) - private boolean build = true; + private boolean disableBuild = true; @Comment( { "Should people with build: false in permissions be allowed to use items", "Set true to disable using for those people", "Setting to false means EssentialsAntiBuild will never prevent you from using" }) - private boolean use = true; + private boolean disableUse = true; @Comment( { "Should we tell people they are not allowed to build" }) private boolean warnOnBuildDisallow = true; - Alert alert = new Alert(); - BlackList blacklist = new BlackList(); + + private Alert alert = new Alert(); + private BlackList blacklist = new BlackList(); + } diff --git a/Essentials/src/net/ess3/settings/antibuild/BlackList.java b/Essentials/src/net/ess3/settings/antibuild/BlackList.java index 109f1ec0d..39305859c 100644 --- a/Essentials/src/net/ess3/settings/antibuild/BlackList.java +++ b/Essentials/src/net/ess3/settings/antibuild/BlackList.java @@ -1,11 +1,15 @@ package net.ess3.settings.antibuild; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; import java.util.Set; import lombok.AccessLevel; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; +import net.ess3.settings.WorldOptions; import net.ess3.storage.Comment; import net.ess3.storage.ListType; import net.ess3.storage.StorageObject; @@ -48,9 +52,55 @@ public class BlackList implements StorageObject @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) private Set<Material> piston; - + public BlackList() { - //todo defaults + if (placement == null) + { + Material[] mat = + { + Material.LAVA, Material.STATIONARY_LAVA, Material.TNT, Material.LAVA_BUCKET + }; + placement = new HashSet<Material>(); + placement.addAll(Arrays.asList(mat)); + } + + if (usage == null) + { + usage = new HashSet<Material>(); + usage.add(Material.LAVA_BUCKET); + } + + if (breaking == null) + { + breaking = new HashSet<Material>(); + } + + if (piston == null) + { + piston = new HashSet<Material>(); + } + + + } + + public Set<Material> getPlacement() + { + return placement; + } + + public Set<Material> getUsage() + { + return usage; + } + + public Set<Material> getBreaking() + { + return breaking; + } + + public Set<Material> getPiston() + { + return piston; } } diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/AntiBuildHolder.java b/EssentialsAntiBuild/src/net/ess3/antibuild/AntiBuildHolder.java index 981fb0577..d8bf3623b 100644 --- a/EssentialsAntiBuild/src/net/ess3/antibuild/AntiBuildHolder.java +++ b/EssentialsAntiBuild/src/net/ess3/antibuild/AntiBuildHolder.java @@ -9,7 +9,8 @@ public class AntiBuildHolder extends AsyncStorageObjectHolder<AntiBuild> { public AntiBuildHolder(final IEssentials ess) { - super(ess, AntiBuild.class, new File(ess.getPlugin().getDataFolder(), "protect.yml")); + super(ess, AntiBuild.class, new File(ess.getPlugin().getDataFolder(), "antibuild.yml")); + onReload(); } @Override diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuild.java b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuild.java index 85353b202..0869d706e 100644 --- a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuild.java +++ b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuild.java @@ -1,8 +1,5 @@ package net.ess3.antibuild; -import java.util.EnumMap; -import java.util.List; -import java.util.Map; import java.util.logging.Logger; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; @@ -19,7 +16,7 @@ public class EssentialsAntiBuild extends JavaPlugin implements IAntiBuild public void onEnable() { final PluginManager pm = this.getServer().getPluginManager(); - final Plugin essPlugin = pm.getPlugin("Essentials"); + final Plugin essPlugin = pm.getPlugin("Essentials-3"); if (essPlugin == null || !essPlugin.isEnabled()) { return; @@ -31,14 +28,6 @@ public class EssentialsAntiBuild extends JavaPlugin implements IAntiBuild } @Override - public boolean checkProtectionItems(final int id) - { - //final List<Integer> itemList = settingsList.get(list); - //return itemList != null && !itemList.isEmpty() && itemList.contains(id); - return false; - } - - @Override public EssentialsConnect getEssentialsConnect() { return ess; diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuildListener.java b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuildListener.java index 2de39ffb5..d57b05ce4 100644 --- a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuildListener.java +++ b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuildListener.java @@ -4,6 +4,7 @@ import java.util.logging.Level; import static net.ess3.I18n._; import net.ess3.api.IEssentials; import net.ess3.api.IUser; +import net.ess3.permissions.MaterialDotStarPermission; import net.ess3.user.User; import org.bukkit.Material; import org.bukkit.block.Block; @@ -33,7 +34,7 @@ public class EssentialsAntiBuildListener implements Listener this.ess = antib.getEssentialsConnect().getEssentials(); } -/* private boolean metaPermCheck(final User user, final String action, final Block block) + /*private boolean metaPermCheck(final User user, final String action, final Block block) { if (block == null) { @@ -66,27 +67,23 @@ public class EssentialsAntiBuildListener implements Listener } return user.isAuthorized(blockPerm); - } + }*/ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockPlace(final BlockPlaceEvent event) - { - final AntiBuildHolder ab = antib.getSettings(); - ab.acquireReadLock(); + { final IUser user = ess.getUserMap().getUser(event.getPlayer()); final Block block = event.getBlockPlaced(); final int typeId = block.getTypeId(); final Material type = block.getType(); - try - { - - if (ab.getData().isBuild() - && !user.canBuild() && !user.hasPermission("essentials.build") - && !Permissions.getPlacePermission(type).isAuthorized(user)) + if (antib.getSettings().getData().isDisableBuild() + //&& !user.canBuild() + && !Permissions.BUILD.isAuthorized(user) + && !Permissions.PLACEMENT.isAuthorized(user, block)) //metaPermCheck(user, "place", block)) todo - double check metadata { - if (ab.getData().isWarnOnBuildDisallow()) + if (antib.getSettings().getData().isWarnOnBuildDisallow()) { user.sendMessage(_("antiBuildPlace", type.toString())); } @@ -94,10 +91,9 @@ public class EssentialsAntiBuildListener implements Listener return; } - if (ab.getData().getBlacklist().getPlacement().contains(type) && !Permissions.BLACKLIST_ALLOWPLACEMENT.isAuthorized(user)) - //antib.checkProtectionItems(AntiBuildConfig.blacklist_placement, typeId) && !user.isAuthorized("essentials.protect.exemptplacement")) + if (antib.getSettings().getData().getBlacklist().getPlacement().contains(type) && !Permissions.BLACKLIST_ALLOWPLACEMENT.isAuthorized(user)) { - if (ab.getData().isWarnOnBuildDisallow()) + if (antib.getSettings().getData().isWarnOnBuildDisallow()) { user.sendMessage(_("antiBuildPlace", type.toString())); } @@ -105,35 +101,27 @@ public class EssentialsAntiBuildListener implements Listener return; } - if (ab.getData().getAlert().getAlertOnPlacement().contains(type) + if (antib.getSettings().getData().getAlert().getAlertOnPlacement().contains(type) && !Permissions.ALERTS_NOTRIGGER.isAuthorized(user)) { antib.getEssentialsConnect().alert(user, type.toString(), _("alertPlaced")); - } - } - finally - { - ab.unlock(); - } + } } @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockBreak(final BlockBreakEvent event) { - final AntiBuildHolder ab = antib.getSettings(); - ab.acquireReadLock(); final IUser user = ess.getUserMap().getUser(event.getPlayer()); final Block block = event.getBlock(); final int typeId = block.getTypeId(); final Material type = block.getType(); - - try - { - if (ab.getData().isBuild() && !user.canBuild() && !user.isAuthorized("essentials.build") - && !Permissions.getBreakPermission(type).isAuthorized(user)) - //!metaPermCheck(user, "break", block)) + + if (antib.getSettings().getData().isDisableBuild() + //&& !user.canBuild() + && !Permissions.BUILD.isAuthorized(user) + && !Permissions.BREAK.isAuthorized(user, block)) { - if (ab.getData().isWarnOnBuildDisallow()) + if (antib.getSettings().getData().isWarnOnBuildDisallow()) { user.sendMessage(_("antiBuildBreak", type.toString())); } @@ -141,9 +129,9 @@ public class EssentialsAntiBuildListener implements Listener return; } - if (ab.getData().getBlacklist().getBreaking().contains(type) && !Permissions.BLACKLIST_ALLOWBREAK.isAuthorized(user)) + if (antib.getSettings().getData().getBlacklist().getBreaking().contains(type) && !Permissions.BLACKLIST_ALLOWBREAK.isAuthorized(user)) { - if (ab.getData().isWarnOnBuildDisallow()) + if (antib.getSettings().getData().isWarnOnBuildDisallow()) { user.sendMessage(_("antiBuildBreak", type.toString())); } @@ -151,29 +139,26 @@ public class EssentialsAntiBuildListener implements Listener return; } - if (antib.checkProtectionItems(AntiBuildConfig.alert_on_break, typeId) - && !user.isAuthorized("essentials.protect.alerts.notrigger")) + if (antib.getSettings().getData().getAlert().getAlertOnBreak().contains(type) + && !Permissions.ALERTS_NOTRIGGER.isAuthorized(user)) { antib.getEssentialsConnect().alert(user, type.toString(), _("alertBroke")); } - } - finally - { - ab.unlock(); - } } - + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onPaintingBreak(final PaintingBreakByEntityEvent event) { final Entity entity = event.getRemover(); if (entity instanceof Player) { - final User user = ess.getUser(entity); - if (antib.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build") - && !metaPermCheck(user, "break", Material.PAINTING.getId())) + final IUser user = ess.getUserMap().getUser((Player)entity); + if (antib.getSettings().getData().isDisableBuild() + //&& !user.canBuild() + && !Permissions.BUILD.isAuthorized(user) + && !Permissions.BREAK.isAuthorized(user, Material.PAINTING, null)) { - if (ess.getSettings().warnOnBuildDisallow()) + if (antib.getSettings().getData().isWarnOnBuildDisallow()) { user.sendMessage(_("antiBuildBreak", Material.PAINTING.toString())); } @@ -187,7 +172,7 @@ public class EssentialsAntiBuildListener implements Listener { for (Block block : event.getBlocks()) { - if (antib.checkProtectionItems(AntiBuildConfig.blacklist_piston, block.getTypeId())) + if (antib.getSettings().getData().getBlacklist().getPiston().contains(block.getType())) { event.setCancelled(true); return; @@ -203,10 +188,9 @@ public class EssentialsAntiBuildListener implements Listener return; } final Block block = event.getRetractLocation().getBlock(); - if (antib.checkProtectionItems(AntiBuildConfig.blacklist_piston, block.getTypeId())) + if (antib.getSettings().getData().getBlacklist().getPiston().contains(block.getType())) { event.setCancelled(true); - return; } } @@ -214,14 +198,14 @@ public class EssentialsAntiBuildListener implements Listener public void onPlayerInteract(final PlayerInteractEvent event) { // Do not return if cancelled, because the interact event has 2 cancelled states. - final User user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); final ItemStack item = event.getItem(); if (item != null - && antib.checkProtectionItems(AntiBuildConfig.blacklist_usage, item.getTypeId()) - && !user.isAuthorized("essentials.protect.exemptusage")) + && antib.getSettings().getData().getBlacklist().getUsage().contains(item.getType()) + && !Permissions.BLACKLIST_ALLOWUSAGE.isAuthorized(user)) { - if (ess.getSettings().warnOnBuildDisallow()) + if (antib.getSettings().getData().isWarnOnBuildDisallow()) { user.sendMessage(_("antiBuildUse", item.getType().toString())); } @@ -230,27 +214,29 @@ public class EssentialsAntiBuildListener implements Listener } if (item != null - && antib.checkProtectionItems(AntiBuildConfig.alert_on_use, item.getTypeId()) - && !user.isAuthorized("essentials.protect.alerts.notrigger")) + && antib.getSettings().getData().getAlert().getAlertOnUse().contains(item.getType()) + && !Permissions.ALERTS_NOTRIGGER.isAuthorized(user)) { antib.getEssentialsConnect().alert(user, item.getType().toString(), _("alertUsed")); } - if (antib.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) + if (antib.getSettings().getData().isDisableUse() + //&& !user.canBuild() + && !Permissions.BUILD.isAuthorized(user)) { - if (event.hasItem() && !metaPermCheck(user, "interact", item.getTypeId(), item.getData().getData())) + if (event.hasItem() && !Permissions.INTERACT.isAuthorized(user, item.getType(), item.getData())) { event.setCancelled(true); - if (ess.getSettings().warnOnBuildDisallow()) + if (antib.getSettings().getData().isWarnOnBuildDisallow()) { user.sendMessage(_("antiBuildUse", item.getType().toString())); } return; } - if (event.hasBlock() && !metaPermCheck(user, "interact", event.getClickedBlock())) + if (event.hasBlock() && !Permissions.INTERACT.isAuthorized(user, event.getClickedBlock())) { event.setCancelled(true); - if (ess.getSettings().warnOnBuildDisallow()) + if (antib.getSettings().getData().isWarnOnBuildDisallow()) { user.sendMessage(_("antiBuildInteract", event.getClickedBlock().getType().toString())); } @@ -265,15 +251,17 @@ public class EssentialsAntiBuildListener implements Listener if (entity instanceof Player) { - final User user = ess.getUser(entity); + final IUser user = ess.getUserMap().getUser((Player)entity); final ItemStack item = event.getRecipe().getResult(); - if (antib.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) + if (antib.getSettings().getData().isDisableUse() + //&& !user.canBuild() + && !Permissions.BUILD.isAuthorized(user)) { - if (!metaPermCheck(user, "craft", item.getTypeId(), item.getData().getData())) + if (!Permissions.CRAFT.isAuthorized(user, item.getType(), item.getData())) { event.setCancelled(true); - if (ess.getSettings().warnOnBuildDisallow()) + if (antib.getSettings().getData().isWarnOnBuildDisallow()) { user.sendMessage(_("antiBuildCraft", item.getType().toString())); } @@ -286,12 +274,14 @@ public class EssentialsAntiBuildListener implements Listener public void onPlayerPickupItem(PlayerPickupItemEvent event) { - final User user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); final ItemStack item = event.getItem().getItemStack(); - if (antib.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) + if (antib.getSettings().getData().isDisableUse() + //&& !user.canBuild() + && !Permissions.BUILD.isAuthorized(user)) { - if (!metaPermCheck(user, "pickup", item.getTypeId(), item.getData().getData())) + if (!Permissions.PICKUP.isAuthorized(user, item.getType(), item.getData())) { event.setCancelled(true); event.getItem().setPickupDelay(50); @@ -306,18 +296,19 @@ public class EssentialsAntiBuildListener implements Listener final IUser user = ess.getUserMap().getUser(event.getPlayer()); final ItemStack item = event.getItemDrop().getItemStack(); - if (antib.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) + if (antib.getSettings().getData().isDisableUse() + //&& !user.canBuild() + && !Permissions.BUILD.isAuthorized(user)); { - if (!metaPermCheck(user, "drop", item.getTypeId(), item.getData().getData())) + if (!Permissions.DROP.isAuthorized(user, item.getType(), item.getData())) { event.setCancelled(true); user.getPlayer().updateInventory(); - if (ess.getSettings().warnOnBuildDisallow()) + if (antib.getSettings().getData().isWarnOnBuildDisallow()) { user.sendMessage(_("antiBuildDrop", item.getType().toString())); } } } - } - */ + } } diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsConnect.java b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsConnect.java index b9a669348..042c9a727 100644 --- a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsConnect.java +++ b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsConnect.java @@ -5,6 +5,7 @@ import java.util.logging.Logger; import static net.ess3.I18n._; import net.ess3.api.IEssentials; import net.ess3.api.IUser; +import net.ess3.bukkit.BukkitPlugin; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -22,7 +23,7 @@ public class EssentialsConnect { LOGGER.log(Level.WARNING, _("versionMismatchAll")); } - ess = (IEssentials)essPlugin; + ess = ((BukkitPlugin)essPlugin).getEssentials(); antib = (IAntiBuild)essProtect; antib.setSettings(new AntiBuildHolder(ess)); } diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/IAntiBuild.java b/EssentialsAntiBuild/src/net/ess3/antibuild/IAntiBuild.java index e65773bd7..599b63a01 100644 --- a/EssentialsAntiBuild/src/net/ess3/antibuild/IAntiBuild.java +++ b/EssentialsAntiBuild/src/net/ess3/antibuild/IAntiBuild.java @@ -5,8 +5,6 @@ import org.bukkit.plugin.Plugin; public interface IAntiBuild extends Plugin { - boolean checkProtectionItems(final int id); - EssentialsConnect getEssentialsConnect(); AntiBuildHolder getSettings(); diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/Permissions.java b/EssentialsAntiBuild/src/net/ess3/antibuild/Permissions.java index cae97667c..588eebf24 100644 --- a/EssentialsAntiBuild/src/net/ess3/antibuild/Permissions.java +++ b/EssentialsAntiBuild/src/net/ess3/antibuild/Permissions.java @@ -5,6 +5,7 @@ import java.util.Locale; import net.ess3.api.IPermission; import net.ess3.bukkit.PermissionFactory; import net.ess3.permissions.BasePermission; +import net.ess3.permissions.MaterialDotStarPermission; import org.bukkit.Material; import org.bukkit.command.CommandSender; import org.bukkit.permissions.PermissionDefault; @@ -69,113 +70,12 @@ public enum Permissions implements IPermission { return PermissionFactory.checkPermission(sender, this); } - private static EnumMap<Material, IPermission> permissions = new EnumMap<Material, IPermission>(Material.class); - - public static IPermission getPlacePermission(final Material mat) - { - IPermission perm = permissions.get(mat); - if (perm == null) - { - perm = new BasePermission("essentials.place.", mat.toString().toLowerCase(Locale.ENGLISH).replace("_", "")) - { - @Override - public PermissionDefault getPermissionDefault() - { - return PermissionDefault.TRUE; - } - }; - permissions.put(mat, perm); - } - return perm; - } - - public static IPermission getBreakPermission(final Material mat) - { - IPermission perm = permissions.get(mat); - if (perm == null) - { - perm = new BasePermission("essentials.break.", mat.toString().toLowerCase(Locale.ENGLISH).replace("_", "")) - { - @Override - public PermissionDefault getPermissionDefault() - { - return PermissionDefault.TRUE; - } - }; - permissions.put(mat, perm); - } - return perm; - } - - public static IPermission getInteractPermission(final Material mat) - { - IPermission perm = permissions.get(mat); - if (perm == null) - { - perm = new BasePermission("essentials.interact.", mat.toString().toLowerCase(Locale.ENGLISH).replace("_", "")) - { - @Override - public PermissionDefault getPermissionDefault() - { - return PermissionDefault.TRUE; - } - }; - permissions.put(mat, perm); - } - return perm; - } - - public static IPermission getCraftPermission(final Material mat) - { - IPermission perm = permissions.get(mat); - if (perm == null) - { - perm = new BasePermission("essentials.craft.", mat.toString().toLowerCase(Locale.ENGLISH).replace("_", "")) - { - @Override - public PermissionDefault getPermissionDefault() - { - return PermissionDefault.TRUE; - } - }; - permissions.put(mat, perm); - } - return perm; - } - - public static IPermission getPickupPermission(final Material mat) - { - IPermission perm = permissions.get(mat); - if (perm == null) - { - perm = new BasePermission("essentials.pickup.", mat.toString().toLowerCase(Locale.ENGLISH).replace("_", "")) - { - @Override - public PermissionDefault getPermissionDefault() - { - return PermissionDefault.TRUE; - } - }; - permissions.put(mat, perm); - } - return perm; - } - - public static IPermission getDropPermission(final Material mat) - { - IPermission perm = permissions.get(mat); - if (perm == null) - { - perm = new BasePermission("essentials.drop.", mat.toString().toLowerCase(Locale.ENGLISH).replace("_", "")) - { - @Override - public PermissionDefault getPermissionDefault() - { - return PermissionDefault.TRUE; - } - }; - permissions.put(mat, perm); - } - return perm; - } + + public static MaterialDotStarPermission PLACEMENT = new MaterialDotStarPermission("essentials.build.place"); + public static MaterialDotStarPermission BREAK = new MaterialDotStarPermission("essentials.build.break"); + public static MaterialDotStarPermission INTERACT = new MaterialDotStarPermission("essentials.build.interact"); + public static MaterialDotStarPermission CRAFT = new MaterialDotStarPermission("essentials.build.craft"); + public static MaterialDotStarPermission PICKUP = new MaterialDotStarPermission("essentials.build.pickup"); + public static MaterialDotStarPermission DROP = new MaterialDotStarPermission("essentials.build.drop"); + } diff --git a/EssentialsAntiBuild/src/plugin.yml b/EssentialsAntiBuild/src/plugin.yml index c838528c5..36f5c48f5 100644 --- a/EssentialsAntiBuild/src/plugin.yml +++ b/EssentialsAntiBuild/src/plugin.yml @@ -1,6 +1,6 @@ # This determines the command prefix when there are conflicts (/name:home, /name:help, etc.) name: EssentialsAntiBuild -main: net.ess3.antibuild.EssentialsAnitBuild +main: net.ess3.antibuild.EssentialsAntiBuild # Note to developers: This next line cannot change, or the automatic versioning system will break. version: ${build.number} website: http://tiny.cc/EssentialsWiki |