diff options
17 files changed, 92 insertions, 19 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index 518e853bb..c98671d94 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -188,6 +188,7 @@ public class Essentials extends JavaPlugin implements IEssentials pm.registerEvent(Type.ENTITY_DAMAGE, entityListener, Priority.Lowest, this); pm.registerEvent(Type.ENTITY_COMBUST, entityListener, Priority.Lowest, this); pm.registerEvent(Type.ENTITY_DEATH, entityListener, Priority.Lowest, this); + pm.registerEvent(Type.FOOD_LEVEL_CHANGE, entityListener, Priority.Lowest, this); jail = new Jail(this); final JailPlayerListener jailPlayerListener = new JailPlayerListener(this); diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java index ce97726dc..2eda73540 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java @@ -8,6 +8,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityListener; +import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.inventory.ItemStack; @@ -80,4 +81,13 @@ public class EssentialsEntityListener extends EntityListener } } } + + @Override + public void onFoodLevelChange(FoodLevelChangeEvent event) + { + if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled()) + { + event.setFoodLevel(20); + } + } } diff --git a/Essentials/src/com/earth2me/essentials/EssentialsTimer.java b/Essentials/src/com/earth2me/essentials/EssentialsTimer.java index ab19450f8..f3b447dae 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsTimer.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsTimer.java @@ -26,10 +26,6 @@ public class EssentialsTimer implements Runnable onlineUsers.add(user); user.setLastOnlineActivity(currentTime); user.checkActivity(); - // Food for god mode - if (user.isGodModeEnabled() && user.getFoodLevel() < 20) { - user.setFoodLevel(20); - } } final Iterator<User> iterator = onlineUsers.iterator(); diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java index 199526648..07092d0bb 100644 --- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java +++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java @@ -701,5 +701,17 @@ public class OfflinePlayer implements Player { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public boolean isSprinting() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSprinting(boolean bln) + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/src/com/earth2me/essentials/PlayerWrapper.java b/Essentials/src/com/earth2me/essentials/PlayerWrapper.java index 8876e804a..2b6dd92ad 100644 --- a/Essentials/src/com/earth2me/essentials/PlayerWrapper.java +++ b/Essentials/src/com/earth2me/essentials/PlayerWrapper.java @@ -731,5 +731,17 @@ public class PlayerWrapper implements Player { return base.getBedSpawnLocation(); } + + @Override + public boolean isSprinting() + { + return base.isSprinting(); + } + + @Override + public void setSprinting(boolean bln) + { + base.setSprinting(bln); + } } diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 2f4fc2951..736274de0 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -464,4 +464,13 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser { return afkPosition; } + + @Override + public boolean toggleGodModeEnabled() + { + if (!isGodModeEnabled()) { + setFoodLevel(20); + } + return super.toggleGodModeEnabled(); + } } diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java index 75d126c3e..39cebbd2a 100644 --- a/Essentials/src/com/earth2me/essentials/UserData.java +++ b/Essentials/src/com/earth2me/essentials/UserData.java @@ -154,6 +154,8 @@ public abstract class UserData extends PlayerExtension implements IConf public void setHome(String name, Location loc) { + //Invalid names will corrupt the yaml + name = Util.sanitizeFileName(name); homes.put(name, loc); config.setProperty("homes." + name, loc); config.save(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java index 2ee2661e6..16b9fca2a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java @@ -45,17 +45,17 @@ public class Commandhome extends EssentialsCommand catch (NotEnoughArgumentsException e) { List<String> homes = u.getHomes(); - if (homes.isEmpty()) + if (homes.isEmpty() && u.equals(user) && ess.getSettings().spawnIfNoHome()) { - throw new Exception(u == user ? Util.i18n("noHomeSet") : Util.i18n("noHomeSetPlayer")); + user.getTeleport().respawn(ess.getSpawn(), charge); } - else if ((homes.size() == 1) && u == user) + else if (homes.isEmpty()) { - user.getTeleport().home(u, homes.get(0), charge); + throw new Exception(u == user ? Util.i18n("noHomeSet") : Util.i18n("noHomeSetPlayer")); } - else if (ess.getSettings().spawnIfNoHome()) + else if (homes.size() == 1 && u.equals(user)) { - user.getTeleport().respawn(ess.getSpawn(), charge); + user.getTeleport().home(u, homes.get(0), charge); } else { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java index 8b6dc8182..07710d40a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java @@ -49,5 +49,6 @@ public class Commandinvsee extends EssentialsCommand user.getInventory().setContents(invUserStack); user.sendMessage(Util.format("invSee", invUser.getDisplayName())); user.sendMessage(Util.i18n("invSeeHelp")); + throw new NoChargeException(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java index a98fabbd2..e08a6c8e5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java @@ -64,6 +64,6 @@ public class Commandmail extends EssentialsCommand user.setMails(null); throw new Exception(Util.i18n("mailCleared")); } - throw new NotEnoughArgumentsException(); + throw new NoChargeException(); } } diff --git a/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java index 90b905113..6914c2816 100644 --- a/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java @@ -3,17 +3,20 @@ package com.earth2me.essentials.perm; import de.bananaco.permissions.Permissions; import de.bananaco.permissions.interfaces.PermissionSet; import de.bananaco.permissions.worlds.WorldPermissionsManager; +import de.bananaco.permissions.info.InfoReader; import java.util.List; import org.bukkit.entity.Player; -public class BPermissionsHandler extends SuperpermsHandler +public class BPermissionsHandler implements IPermissionsHandler { private final transient WorldPermissionsManager wpm; - + private final transient InfoReader info; public BPermissionsHandler() { wpm = Permissions.getWorldPermissionsManager(); + info = new InfoReader(); + info.instantiate(); } @Override @@ -48,4 +51,28 @@ public class BPermissionsHandler extends SuperpermsHandler } return groups.contains(group); } + + @Override + public boolean canBuild(final Player base, final String group) + { + return hasPermission(base, "bPermissions.build"); + } + + @Override + public String getPrefix(final Player base) + { + return info.getPrefix(base); + } + + @Override + public String getSuffix(final Player base) + { + return info.getSuffix(base); + } + + @Override + public boolean hasPermission(final Player base, final String node) + { + return base.hasPermission(node); + } } diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index 6edf0244d..13b7def41 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -422,6 +422,9 @@ protect: squid: false zombie: false wolf: false + cave_spider: false + enderman: false + silverfish: false # Maximum height the creeper should explode. -1 allows them to explode everywhere. # Set prevent.creeper-explosion to true, if you want to disable creeper explosions. diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index d90d788eb..c756d4384 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -54,7 +54,7 @@ deleteJail = \u00a77Jail {0} has been removed. deleteWarp = \u00a77Warp {0} has been removed. deniedAccessCommand = {0} was denied access to command. dependancyDownloaded = [Essentials] Dependancy {0} downloaded successfully. -dependancyException = [Essentials] An error occured when trying to download a dependacy +dependancyException = [Essentials] An error occurred when trying to download a dependacy dependancyNotFound = [Essentials] A required dependancy was not found, downloading now. depth = \u00a77You are at sea level. depthAboveSea = \u00a77You are {0} block(s) above sea level. @@ -171,7 +171,7 @@ mobsAvailable = \u00a77Mobs: {0} mobSpawnError = Error while changing mob spawner. mobSpawnLimit = Mob quantity limited to server limit mobSpawnTarget = Target block must be a mob spawner. -moneyRecievedFrom = \u00a7a{0} has been recieved from {1} +moneyRecievedFrom = \u00a7a{0} has been received from {1} moneySentTo = \u00a7a{0} has been sent to {1} moneyTaken = {0} taken from your bank account. month = month @@ -265,7 +265,7 @@ requestAcceptedFrom = \u00a77{0} accepted your teleport request. requestDenied = \u00a77Teleport request denied. requestDeniedFrom = \u00a77{0} denied your teleport request. requestSent = \u00a77Request sent to {0}\u00a77. -returnPlayerToJailError = Error occured when trying to return player to jail. +returnPlayerToJailError = Error occurred when trying to return player to jail. second = second seconds = seconds seenOffline = Player {0} is offline since {1} diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index a9dc9c9a8..ea73ccc56 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -54,7 +54,7 @@ deleteJail = \u00a77Jail {0} has been removed. deleteWarp = \u00a77Warp {0} has been removed. deniedAccessCommand = {0} was denied access to command. dependancyDownloaded = [Essentials] Dependancy {0} downloaded successfully. -dependancyException = [Essentials] An error occured when trying to download a dependacy +dependancyException = [Essentials] An error occurred when trying to download a dependacy dependancyNotFound = [Essentials] A required dependancy was not found, downloading now. depth = \u00a77You are at sea level. depthAboveSea = \u00a77You are {0} block(s) above sea level. @@ -170,7 +170,7 @@ missingPrefixSuffix = Missing a prefix or suffix for {0} mobSpawnError = Error while changing mob spawner. mobSpawnLimit = Mob quantity limited to server limit mobSpawnTarget = Target block must be a mob spawner. -moneyRecievedFrom = \u00a7a{0} has been recieved from {1} +moneyRecievedFrom = \u00a7a{0} has been received from {1} moneySentTo = \u00a7a{0} has been sent to {1} moneyTaken = {0} taken from your bank account. month = month @@ -264,7 +264,7 @@ requestAcceptedFrom = \u00a77{0} accepted your teleport request. requestDenied = \u00a77Teleport request denied. requestDeniedFrom = \u00a77{0} denied your teleport request requestSent = \u00a77Request sent to {0}\u00a77. -returnPlayerToJailError = Error occured when trying to return player to jail. +returnPlayerToJailError = Error occurred when trying to return player to jail. second = second seconds = seconds seenOffline = Player {0} is offline since {1} diff --git a/lib/bPermissions.jar b/lib/bPermissions.jar Binary files differindex b3b38e425..26ddcb970 100644 --- a/lib/bPermissions.jar +++ b/lib/bPermissions.jar diff --git a/lib/bukkit-0.0.1-SNAPSHOT.jar b/lib/bukkit-0.0.1-SNAPSHOT.jar Binary files differindex dd8ae3d53..63232deae 100644 --- a/lib/bukkit-0.0.1-SNAPSHOT.jar +++ b/lib/bukkit-0.0.1-SNAPSHOT.jar diff --git a/lib/craftbukkit-0.0.1-SNAPSHOT.jar b/lib/craftbukkit-0.0.1-SNAPSHOT.jar Binary files differindex b9bd66771..154265890 100644 --- a/lib/craftbukkit-0.0.1-SNAPSHOT.jar +++ b/lib/craftbukkit-0.0.1-SNAPSHOT.jar |