diff --git a/pom.xml b/pom.xml index a1c06d0..dcde083 100644 --- a/pom.xml +++ b/pom.xml @@ -3,13 +3,19 @@ de.jaschastarke LimitedCreative LimitedCreative - 1.4.0a + 1.4.1a-SNAPSHOT https://github.com/possi/LimitedCreative + + + UTF-8 + + scm:git:git://github.com/possi/LimitedCreative.git scm:git:git@github.com:possi/LimitedCreative.git https://github.com/possi/LimitedCreative/tree/master + @@ -36,6 +42,40 @@ http://ci.herocraftonline.com/plugin/repository/everything + + + + org.bukkit + bukkit + 1.4.2-R0.2 + + + com.sk89q + worldguard + 5.6.3 + + + uk.org.whoami + authme + 2.6.7b5 + + + com.onarandombox.multiversecore + Multiverse-Core + 2.4 + + + com.cypherx + xauth + 2.0.20 + + + de.jaschastarke + plib + 0.1-SNAPSHOT + + + ${basedir}/src ${project.artifactId} @@ -65,37 +105,91 @@ 1.6 1.6 + + + de.jaschastarke + plib + 0.1-SNAPSHOT + + + compile + + pluginyaml + + + + + WorldGuard + WorldEdit + MultiInv + + + http://dev.bukkit.org/server-mods/limited-creative/ + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 2.0 + + + package + + shade + + + + + de.jaschastarke:plib + + + + + de.jaschastarke:plib + + de/jaschastarke/bukkit/lib/maven/** + + + + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + de.jaschastarke + plib + + [0.1-SNAPSHOT,) + + + pluginyaml + + + + + + + + + + + + - - - org.bukkit - bukkit - 1.4.2-R0.2 - - - com.sk89q - worldguard - 5.6.3 - - - uk.org.whoami - authme - 2.6.7b5 - - - com.onarandombox.multiversecore - Multiverse-Core - 2.4 - - - com.cypherx - xauth - 2.0.20 - - - - UTF-8 - \ No newline at end of file diff --git a/src/de/jaschastarke/minecraft/limitedcreative/Commands.java b/src/de/jaschastarke/minecraft/limitedcreative/Commands.java index 9236c1f..b2058fb 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/Commands.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/Commands.java @@ -18,6 +18,7 @@ package de.jaschastarke.minecraft.limitedcreative; import static de.jaschastarke.minecraft.utils.Locale.L; +import static de.jaschastarke.bukkit.lib.permissions.PermissionManager.hasPermission; import java.util.Arrays; import java.util.List; @@ -29,7 +30,6 @@ import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import de.jaschastarke.minecraft.utils.IPermission; import de.jaschastarke.minecraft.utils.Util; public class Commands { @@ -202,9 +202,6 @@ public class Commands { plugin.getCommand("/region").setExecutor(new NotAvailableCommandExecutor()); } } - private static boolean hasPermission(CommandSender sender, IPermission permission) { - return plugin.perm.hasPermission(sender, permission); - } abstract static public class CommandException extends Exception { private static final long serialVersionUID = 1L; diff --git a/src/de/jaschastarke/minecraft/limitedcreative/Core.java b/src/de/jaschastarke/minecraft/limitedcreative/Core.java index f221a4e..dbe0767 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/Core.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/Core.java @@ -18,23 +18,21 @@ package de.jaschastarke.minecraft.limitedcreative; import static de.jaschastarke.minecraft.utils.Locale.L; -import java.util.logging.Logger; - import org.bukkit.event.HandlerList; import org.bukkit.plugin.PluginDescriptionFile; -import org.bukkit.plugin.java.JavaPlugin; import de.jaschastarke.minecraft.integration.Communicator; +import de.jaschastarke.minecraft.lib.annotations.PermissionGroup; import de.jaschastarke.minecraft.limitedcreative.cmdblock.CommandBlocker; -import de.jaschastarke.minecraft.limitedcreative.listeners.LimitListener; +import de.jaschastarke.minecraft.limitedcreative.limits.LimitListener; import de.jaschastarke.minecraft.limitedcreative.listeners.MainListener; import de.jaschastarke.minecraft.limitedcreative.regions.WorldGuardIntegration; import de.jaschastarke.minecraft.utils.Locale; import de.jaschastarke.minecraft.utils.Permissions; -public class Core extends JavaPlugin { - public final Logger logger = Logger.getLogger("Minecraft"); +@PermissionGroup("limitedcreative") +public class Core extends de.jaschastarke.bukkit.lib.Core { public Configuration config; public Permissions perm; public WorldGuardIntegration worldguard; @@ -109,9 +107,9 @@ public class Core extends JavaPlugin { PluginDescriptionFile df = this.getDescription(); if (worldguard != null) - logger.info("["+df.getName() + " v" + df.getVersion() + "] "+L("basic.loaded.worldguard")); + getLog().info("["+df.getName() + " v" + df.getVersion() + "] "+L("basic.loaded.worldguard")); else - logger.info("["+df.getName() + " v" + df.getVersion() + "] "+L("basic.loaded.no_worldguard")); + getLog().info("["+df.getName() + " v" + df.getVersion() + "] "+L("basic.loaded.no_worldguard")); } public void reload() { @@ -122,13 +120,13 @@ public class Core extends JavaPlugin { setEnabled(true); } public void info(String s) { - logger.info("["+this.getDescription().getName()+"] " + s); + getLog().info("["+this.getDescription().getName()+"] " + s); } public void warn(String s) { - logger.warning("["+this.getDescription().getName()+"] " + s); + getLog().warning("["+this.getDescription().getName()+"] " + s); } public void error(String s) { - logger.severe("["+this.getDescription().getName()+"] " + s); + getLog().severe("["+this.getDescription().getName()+"] " + s); } public static void debug(String s) { if (isDebug()) diff --git a/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java b/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java index 8b45d9e..cf5270e 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java @@ -44,7 +44,8 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.material.Lever; import org.bukkit.material.MaterialData; -import de.jaschastarke.minecraft.utils.IPermission; +import de.jaschastarke.minecraft.lib.permissions.IPermission; +import de.jaschastarke.minecraft.limitedcreative.limits.NoLimitPerms; import de.jaschastarke.minecraft.worldguard.events.PlayerAreaEvent; import de.jaschastarke.minecraft.worldguard.events.PlayerChangedAreaEvent; @@ -252,7 +253,7 @@ public class LCPlayer { public void onDropItem(PlayerDropItemEvent event) { Core.debug(getName() + " ("+getPlayer().getGameMode()+") drops items " + event.getItemDrop().getItemStack().getType()); if (getPlayer().getGameMode() == GameMode.CREATIVE) { - if (hasPermission(Perms.NoLimit.DROP)) + if (hasPermission(NoLimitPerms.DROP)) return; Core.debug("removed"); if (plugin.config.getRemoveDrop()) @@ -263,7 +264,7 @@ public class LCPlayer { } public void onPickupItem(PlayerPickupItemEvent event) { if (getPlayer().getGameMode() == GameMode.CREATIVE) { - if (hasPermission(Perms.NoLimit.PICKUP)) + if (hasPermission(NoLimitPerms.PICKUP)) return; if (plugin.config.getBlockPickupInCreative()) { event.setCancelled(true); @@ -276,7 +277,7 @@ public class LCPlayer { public void onDie(EntityDeathEvent event) { if (getPlayer().getGameMode() == GameMode.CREATIVE) { - if (!hasPermission(Perms.NoLimit.DROP)) { + if (!hasPermission(NoLimitPerms.DROP)) { event.getDrops().clear(); //getInv().storeTemp(); } @@ -285,7 +286,7 @@ public class LCPlayer { /* removed, because much to insecure. also we can save memory with out this public void onRespawn(PlayerRespawnEvent event) { if (getPlayer().getGameMode() == GameMode.CREATIVE) { - if (!plugin.config.getPermissionsEnabled() || !hasPermission(Perms.NoLimit.DROP)) { + if (!plugin.config.getPermissionsEnabled() || !hasPermission(NoLimitPerms.DROP)) { getInv().restoreTemp(); } } @@ -297,13 +298,13 @@ public class LCPlayer { // its PVP Player attacker = (Player) from; if (attacker.getGameMode() == GameMode.CREATIVE) { - if (!Players.get(attacker).hasPermission(Perms.NoLimit.PVP)) { + if (!Players.get(attacker).hasPermission(NoLimitPerms.PVP)) { event.setCancelled(true); return; // skip next check } } if (getPlayer().getGameMode() == GameMode.CREATIVE) { - if (!hasPermission(Perms.NoLimit.PVP)) { + if (!hasPermission(NoLimitPerms.PVP)) { event.setCancelled(true); } } @@ -312,7 +313,7 @@ public class LCPlayer { public void onDealDamage(EntityDamageByEntityEvent event) { // deals damage if (event.getEntity() instanceof Creature) { if (getPlayer().getGameMode() == GameMode.CREATIVE && plugin.config.getMobDamageBlock()) { - if (!hasPermission(Perms.NoLimit.MOB_DAMAGE)) { + if (!hasPermission(NoLimitPerms.MOB_DAMAGE)) { event.setCancelled(true); } } @@ -325,7 +326,7 @@ public class LCPlayer { public void onTarget(EntityTargetEvent event) { if (event.getEntity() instanceof Creature) { if (((Player) event.getTarget()).getGameMode() == GameMode.CREATIVE && plugin.config.getMobDamageBlock()) { - if (!hasPermission(Perms.NoLimit.MOB_DAMAGE)) { + if (!hasPermission(NoLimitPerms.MOB_DAMAGE)) { event.setCancelled(true); } } @@ -335,7 +336,7 @@ public class LCPlayer { public void onChestAccess(PlayerInteractEvent event) { if (event.getPlayer().getGameMode() != GameMode.CREATIVE) return; - if (hasPermission(Perms.NoLimit.CHEST)) + if (hasPermission(NoLimitPerms.CHEST)) return; event.getPlayer().sendMessage(L("blocked.chest")); event.setCancelled(true); @@ -343,7 +344,7 @@ public class LCPlayer { public void onChestAccess(PlayerInteractEntityEvent event) { // chest-minecarts are different events if (getPlayer().getGameMode() != GameMode.CREATIVE) return; - if (hasPermission(Perms.NoLimit.CHEST)) + if (hasPermission(NoLimitPerms.CHEST)) return; event.getPlayer().sendMessage(L("blocked.chest")); event.setCancelled(true); @@ -351,7 +352,7 @@ public class LCPlayer { public void onBenchAccess(PlayerInteractEvent event) { if (!plugin.config.getBenchBlock() || event.getPlayer().getGameMode() != GameMode.CREATIVE) return; - if (hasPermission(Perms.NoLimit.CHEST)) + if (hasPermission(NoLimitPerms.CHEST)) return; event.getPlayer().sendMessage(L("blocked.chest")); event.setCancelled(true); @@ -359,7 +360,7 @@ public class LCPlayer { public void onSignAccess(PlayerInteractEvent event) { if (!plugin.config.getSignBlock() || event.getPlayer().getGameMode() != GameMode.CREATIVE) return; - if (hasPermission(Perms.NoLimit.SIGN)) + if (hasPermission(NoLimitPerms.SIGN)) return; event.getPlayer().sendMessage(L("blocked.sign")); event.setCancelled(true); @@ -368,12 +369,12 @@ public class LCPlayer { if (!plugin.config.getButtonBlock() || event.getPlayer().getGameMode() != GameMode.CREATIVE) return; if (event.getClickedBlock().getState() instanceof Lever) { - if (hasPermission(Perms.NoLimit.LEVER)) + if (hasPermission(NoLimitPerms.LEVER)) return; event.getPlayer().sendMessage(L("blocked.lever")); event.setCancelled(true); } else { - if (hasPermission(Perms.NoLimit.BUTTON)) + if (hasPermission(NoLimitPerms.BUTTON)) return; event.getPlayer().sendMessage(L("blocked.button")); event.setCancelled(true); @@ -511,7 +512,7 @@ public class LCPlayer { } public boolean hasPermission(IPermission permission) { - return plugin.perm.hasPermission(this.getPlayer(), permission); + return de.jaschastarke.bukkit.lib.permissions.PermissionManager.hasPermission(getPlayer(), permission); } public boolean isGameModeAllowed(GameMode gm) { diff --git a/src/de/jaschastarke/minecraft/limitedcreative/Perms.java b/src/de/jaschastarke/minecraft/limitedcreative/Perms.java index 892200c..91c1eb0 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/Perms.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/Perms.java @@ -17,62 +17,56 @@ */ package de.jaschastarke.minecraft.limitedcreative; -import de.jaschastarke.minecraft.utils.IPermission; +import org.bukkit.permissions.PermissionDefault; + +import de.jaschastarke.minecraft.lib.permissions.IAbstractPermission; +import de.jaschastarke.minecraft.lib.permissions.IPermissionContainer; +import de.jaschastarke.minecraft.lib.permissions.IPermission; public enum Perms implements IPermission { - CONFIG("config"), - REGIONS("regions"), - REGIONS_BYPASS("regions_bypass"), - GM("switch_gamemode"), - GM_BACKONLY("switch_gamemode.backonly"), - GM_SURVIVAL("switch_gamemode.survival"), - GM_CREATIVE("switch_gamemode.creative"), - GM_ADVENTURE("switch_gamemode.adventure"), - GM_OTHER("switch_gamemode.other"), - KEEPINVENTORY("keepinventory"); + CONFIG("config", PermissionDefault.OP), + REGIONS("regions", PermissionDefault.OP), + REGIONS_BYPASS("regions_bypass", PermissionDefault.FALSE), + GM("switch_gamemode", PermissionDefault.OP), + GM_BACKONLY("switch_gamemode.backonly", PermissionDefault.FALSE), + GM_SURVIVAL("switch_gamemode.survival", PermissionDefault.FALSE), + GM_CREATIVE("switch_gamemode.creative", PermissionDefault.FALSE), + GM_ADVENTURE("switch_gamemode.adventure", PermissionDefault.FALSE), + GM_OTHER("switch_gamemode.other", PermissionDefault.OP), + KEEPINVENTORY("keepinventory", PermissionDefault.FALSE); - private static final String NS = "limitedcreative"; - - private String perm; - private Perms(String permission) { - perm = permission; - } - @Override - public String toString() { - return NS + SEP + perm; - } - - public enum NoLimit implements IPermission { - DROP("drop"), - PICKUP("pickup"), - CHEST("chest"), - SIGN("sign"), - BUTTON("button"), - LEVER("lever"), - PVP("pvp"), - MOB_DAMAGE("mob_damage"), - USE("use"), - BREAK("break"); - - private static final String NS = "nolimit"; - - private String perm; - private NoLimit(String permission) { - perm = permission; + public static final IPermissionContainer Root = new IPermissionContainer() { + @Override + public IPermission[] getPermissions() { + return Perms.values(); } @Override - public String toString() { - return Perms.NS + SEP + NoLimit.NS + SEP + perm; + public String getFullString() { + return "limitedcreative"; } + @Override + public IAbstractPermission getParent() { + return null; + } + }; + + private String perm; + private PermissionDefault def; + private Perms(String permission, PermissionDefault pdefault) { + perm = permission; + def = pdefault; } - public static final class CmdBlock { // not the best way, but this matches to everything in this plugin ;) - public static final String NS = "cmdblock"; - - public static IPermission ALL = new IPermission() { - public String toString() { - return Perms.NS + SEP + CmdBlock.NS + SEP + "all"; - } - }; + @Override + public IAbstractPermission getParent() { + return Root; + } + @Override + public String getFullString() { + return getParent().getFullString() + SEP + perm; + } + @Override + public PermissionDefault getDefault() { + return def; } } diff --git a/src/de/jaschastarke/minecraft/limitedcreative/cmdblock/CmdBlockPerms.java b/src/de/jaschastarke/minecraft/limitedcreative/cmdblock/CmdBlockPerms.java new file mode 100644 index 0000000..c6b3c84 --- /dev/null +++ b/src/de/jaschastarke/minecraft/limitedcreative/cmdblock/CmdBlockPerms.java @@ -0,0 +1,48 @@ +package de.jaschastarke.minecraft.limitedcreative.cmdblock; + +import org.bukkit.permissions.PermissionDefault; + +import de.jaschastarke.minecraft.lib.permissions.IAbstractPermission; +import de.jaschastarke.minecraft.lib.permissions.IPermissionContainer; +import de.jaschastarke.minecraft.lib.permissions.IPermission; +import de.jaschastarke.minecraft.limitedcreative.Perms; + +public enum CmdBlockPerms implements IPermission { + ALL("all", PermissionDefault.FALSE),; + + public static final IPermissionContainer Parent = new IPermissionContainer() { + @Override + public IAbstractPermission getParent() { + return Perms.Root; + } + + @Override + public IPermission[] getPermissions() { + return CmdBlockPerms.values(); + } + + @Override + public String getFullString() { + return "cmdblock"; + } + }; + + private String perm; + private PermissionDefault def; + private CmdBlockPerms(String permission, PermissionDefault pdefault) { + perm = permission; + def = pdefault; + } + @Override + public IAbstractPermission getParent() { + return Parent; + } + @Override + public PermissionDefault getDefault() { + return def; + } + @Override + public String getFullString() { + return getParent().getFullString() + SEP + perm; + } +} diff --git a/src/de/jaschastarke/minecraft/limitedcreative/cmdblock/CommandBlocker.java b/src/de/jaschastarke/minecraft/limitedcreative/cmdblock/CommandBlocker.java index 3c90e3b..4d6a45e 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/cmdblock/CommandBlocker.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/cmdblock/CommandBlocker.java @@ -7,7 +7,6 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import de.jaschastarke.minecraft.limitedcreative.Core; import de.jaschastarke.minecraft.limitedcreative.LCPlayer; -import de.jaschastarke.minecraft.limitedcreative.Perms; import de.jaschastarke.minecraft.limitedcreative.Players; public class CommandBlocker { @@ -28,7 +27,7 @@ public class CommandBlocker { for (ICmdBlockEntry blockentry : plugin.config.getCommandBlockList()) { if (blockentry.test(cmd)) { LCPlayer player = Players.get(event.getPlayer()); - if (!player.hasPermission(Perms.CmdBlock.ALL)) { + if (!player.hasPermission(CmdBlockPerms.ALL)) { Core.debug("CmdBlock: "+event.getPlayer().getName()+": '/"+cmd+"' blocked by rule '"+blockentry.toString()+"'"); event.setCancelled(true); event.getPlayer().sendMessage(L("cmdblock.blocked")); diff --git a/src/de/jaschastarke/minecraft/limitedcreative/listeners/LimitListener.java b/src/de/jaschastarke/minecraft/limitedcreative/limits/LimitListener.java similarity index 93% rename from src/de/jaschastarke/minecraft/limitedcreative/listeners/LimitListener.java rename to src/de/jaschastarke/minecraft/limitedcreative/limits/LimitListener.java index 61b347b..2fa8bbe 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/listeners/LimitListener.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/limits/LimitListener.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package de.jaschastarke.minecraft.limitedcreative.listeners; +package de.jaschastarke.minecraft.limitedcreative.limits; import static de.jaschastarke.minecraft.utils.Locale.L; @@ -52,8 +52,8 @@ import org.bukkit.material.Lever; import de.jaschastarke.minecraft.limitedcreative.BlackList; import de.jaschastarke.minecraft.limitedcreative.Core; import de.jaschastarke.minecraft.limitedcreative.LCPlayer; -import de.jaschastarke.minecraft.limitedcreative.Perms; import de.jaschastarke.minecraft.limitedcreative.Players; +import de.jaschastarke.minecraft.limitedcreative.listeners.MainListener; public class LimitListener implements Listener { private Core plugin; @@ -78,7 +78,7 @@ public class LimitListener implements Listener { return; LCPlayer player = Players.get(event.getPlayer()); - if (!player.hasPermission(Perms.NoLimit.USE)) { + if (!player.hasPermission(NoLimitPerms.USE)) { if (event.getItem() != null && BlackList.isBlackListed(plugin.config.getBlockedUse(), event.getItem())) { event.setCancelled(true); event.setUseItemInHand(Event.Result.DENY); @@ -109,7 +109,7 @@ public class LimitListener implements Listener { return; LCPlayer player = Players.get(event.getPlayer()); - if (!player.hasPermission(Perms.NoLimit.USE)) { + if (!player.hasPermission(NoLimitPerms.USE)) { if (event.getPlayer().getItemInHand() != null && BlackList.isBlackListed(plugin.config.getBlockedUse(), event.getPlayer().getItemInHand())) { event.setCancelled(true); event.getPlayer().sendMessage(L("blocked.use")); @@ -120,7 +120,7 @@ public class LimitListener implements Listener { // Temporary Solution: While dropping of Items is prevented we don't allow Interaction with ItemFrames, so no // Items can be "placed" anywhere. - if (!player.hasPermission(Perms.NoLimit.DROP)) { + if (!player.hasPermission(NoLimitPerms.DROP)) { if (entity instanceof ItemFrame && plugin.config.getRemoveDrop()) { event.setCancelled(true); event.getPlayer().sendMessage(L("blocked.use")); @@ -183,14 +183,14 @@ public class LimitListener implements Listener { private void whenBlockBreak(Cancellable event, Block block, Player eventPlayer) { if (eventPlayer.getGameMode() == GameMode.CREATIVE) { LCPlayer player = Players.get(eventPlayer); - if (!player.hasPermission(Perms.NoLimit.BREAK)) { + if (!player.hasPermission(NoLimitPerms.BREAK)) { if (BlackList.isBlackListed(plugin.config.getBlockedBreaks(), block)) { event.setCancelled(true); eventPlayer.sendMessage(L("blocked.break")); } } - if (player.hasPermission(Perms.NoLimit.DROP)) + if (player.hasPermission(NoLimitPerms.DROP)) return; // Prevent dropping of doors and beds when destroying the wrong part @@ -240,7 +240,7 @@ public class LimitListener implements Listener { return; if (event.getPlayer().getGameMode() == GameMode.CREATIVE) { LCPlayer player = Players.get(event.getPlayer()); - if (!player.hasPermission(Perms.NoLimit.USE)) { + if (!player.hasPermission(NoLimitPerms.USE)) { if (BlackList.isBlackListed(plugin.config.getBlockedUse(), event.getBlock())) { event.setCancelled(true); event.getPlayer().sendMessage(L("blocked.place")); diff --git a/src/de/jaschastarke/minecraft/limitedcreative/limits/NoLimitPerms.java b/src/de/jaschastarke/minecraft/limitedcreative/limits/NoLimitPerms.java new file mode 100644 index 0000000..dbbeb71 --- /dev/null +++ b/src/de/jaschastarke/minecraft/limitedcreative/limits/NoLimitPerms.java @@ -0,0 +1,57 @@ +package de.jaschastarke.minecraft.limitedcreative.limits; + +import org.bukkit.permissions.PermissionDefault; + +import de.jaschastarke.minecraft.lib.permissions.IAbstractPermission; +import de.jaschastarke.minecraft.lib.permissions.IPermissionContainer; +import de.jaschastarke.minecraft.lib.permissions.IPermission; +import de.jaschastarke.minecraft.limitedcreative.Perms; + +public enum NoLimitPerms implements IPermission { + DROP("drop", PermissionDefault.FALSE), + PICKUP("pickup", PermissionDefault.FALSE), + CHEST("chest", PermissionDefault.FALSE), + SIGN("sign", PermissionDefault.FALSE), + BUTTON("button", PermissionDefault.FALSE), + LEVER("lever", PermissionDefault.FALSE), + PVP("pvp", PermissionDefault.FALSE), + MOB_DAMAGE("mob_damage", PermissionDefault.FALSE), + USE("use", PermissionDefault.FALSE), + BREAK("break", PermissionDefault.FALSE); + + public static final IPermissionContainer Parent = new IPermissionContainer() { + @Override + public IAbstractPermission getParent() { + return Perms.Root; + } + + @Override + public IPermission[] getPermissions() { + return NoLimitPerms.values(); + } + + @Override + public String getFullString() { + return "nolimit"; + } + }; + + private String perm; + private PermissionDefault def; + private NoLimitPerms(String permission, PermissionDefault pdefault) { + perm = permission; + def = pdefault; + } + @Override + public IAbstractPermission getParent() { + return Parent; + } + @Override + public PermissionDefault getDefault() { + return def; + } + @Override + public String getFullString() { + return getParent().getFullString() + SEP + perm; + } +} diff --git a/src/de/jaschastarke/minecraft/limitedcreative/regions/RegionListener.java b/src/de/jaschastarke/minecraft/limitedcreative/regions/RegionListener.java index 6144a66..1e80984 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/regions/RegionListener.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/regions/RegionListener.java @@ -133,7 +133,7 @@ public class RegionListener implements Listener { Block dest = source.getRelative(event.getDirection(), i); Core.debug("dest "+i+": "+dest.getType()); if (regionSet(dest).getFlag(Flags.GAMEMODE) != GameMode.CREATIVE) { - plugin.logger.warning(L("blocked.piston", source.getRelative(event.getDirection(), i - 1).getType().toString(), Util.toString(source.getLocation()))); + plugin.getLog().warning(L("blocked.piston", source.getRelative(event.getDirection(), i - 1).getType().toString(), Util.toString(source.getLocation()))); event.setCancelled(true); break; } else if (dest.getType() == Material.AIR) { @@ -155,12 +155,12 @@ public class RegionListener implements Listener { Core.debug("dest "+dest.getType()); if (regionSet(source).getFlag(Flags.GAMEMODE) == GameMode.CREATIVE) { if (regionSet(dest).getFlag(Flags.GAMEMODE) != GameMode.CREATIVE) { - plugin.logger.warning(L("blocked.piston", source.getType().toString(), Util.toString(source.getLocation()))); + plugin.getLog().warning(L("blocked.piston", source.getType().toString(), Util.toString(source.getLocation()))); event.setCancelled(true); } } else if (regionSet(dest).getFlag(Flags.GAMEMODE) == GameMode.CREATIVE) { // source isn't creative - plugin.logger.warning(L("blocked.piston_in", source.getType().toString(), Util.toString(source.getLocation()))); + plugin.getLog().warning(L("blocked.piston_in", source.getType().toString(), Util.toString(source.getLocation()))); event.setCancelled(true); } } diff --git a/src/de/jaschastarke/minecraft/limitedcreative/store/PlayerOptions.java b/src/de/jaschastarke/minecraft/limitedcreative/store/PlayerOptions.java index 401c11e..48ed41e 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/store/PlayerOptions.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/store/PlayerOptions.java @@ -82,7 +82,7 @@ public class PlayerOptions { try { store.save(_store_file); } catch (IOException e) { - Core.plugin.logger.severe("Failed to save players.yml"); + Core.plugin.getLog().severe("Failed to save players.yml"); e.printStackTrace(); } }