diff options
66 files changed, 1777 insertions, 917 deletions
diff --git a/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java b/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java index 257d9a165..a9291e629 100644 --- a/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java +++ b/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java @@ -42,7 +42,11 @@ public class AlternativeCommandsHandler PluginCommand reg = ess.getServer().getPluginCommand(pluginName + ":" + pc.getName().toLowerCase(Locale.ENGLISH)); if (reg == null) { - reg = Bukkit.getServer().getPluginCommand(pc.getName().toLowerCase(Locale.ENGLISH)); + reg = ess.getServer().getPluginCommand(pc.getName().toLowerCase(Locale.ENGLISH)); + } + if (reg == null || !reg.getPlugin().equals(plugin)) + { + continue; } for (String label : labels) { @@ -78,7 +82,7 @@ public class AlternativeCommandsHandler while (pcIterator.hasNext()) { final PluginCommand pc = pcIterator.next(); - if (pc.getPlugin().equals(plugin)) + if (pc.getPlugin() == null || pc.getPlugin().equals(plugin)) { pcIterator.remove(); } diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index ebdf84af4..62f7ad04e 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -23,6 +23,7 @@ import com.earth2me.essentials.commands.EssentialsCommand; import com.earth2me.essentials.commands.IEssentialsCommand; import com.earth2me.essentials.commands.NoChargeException; import com.earth2me.essentials.commands.NotEnoughArgumentsException; +import com.earth2me.essentials.craftbukkit.ItemDupeFix; import com.earth2me.essentials.perm.PermissionsHandler; import com.earth2me.essentials.register.payment.Methods; import com.earth2me.essentials.signs.SignBlockListener; @@ -56,7 +57,7 @@ import org.bukkit.scheduler.BukkitScheduler; public class Essentials extends JavaPlugin implements IEssentials { - public static final int BUKKIT_VERSION = 1467; + public static final int BUKKIT_VERSION = 1518; private static final Logger LOGGER = Logger.getLogger("Minecraft"); private transient ISettings settings; private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this); @@ -177,10 +178,11 @@ public class Essentials extends JavaPlugin implements IEssentials pm.registerEvent(Type.PLAYER_MOVE, playerListener, Priority.High, this); pm.registerEvent(Type.PLAYER_LOGIN, playerListener, Priority.High, this); pm.registerEvent(Type.PLAYER_TELEPORT, playerListener, Priority.High, this); - pm.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.High, this); pm.registerEvent(Type.PLAYER_EGG_THROW, playerListener, Priority.High, this); pm.registerEvent(Type.PLAYER_BUCKET_EMPTY, playerListener, Priority.High, this); pm.registerEvent(Type.PLAYER_ANIMATION, playerListener, Priority.High, this); + pm.registerEvent(Type.PLAYER_CHANGED_WORLD, playerListener, Priority.Normal, this); + pm.registerEvent(Type.PLAYER_TELEPORT, new ItemDupeFix(), Priority.Monitor, this); final EssentialsBlockListener blockListener = new EssentialsBlockListener(this); pm.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Lowest, this); @@ -343,6 +345,9 @@ public class Essentials extends JavaPlugin implements IEssentials { sender.sendMessage(command.getDescription()); sender.sendMessage(command.getUsage().replaceAll("<command>", commandLabel)); + if (!ex.getMessage().isEmpty()) { + sender.sendMessage(ex.getMessage()); + } return true; } catch (Throwable ex) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsConf.java b/Essentials/src/com/earth2me/essentials/EssentialsConf.java index 512b9c60a..b07c9710f 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsConf.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsConf.java @@ -2,7 +2,10 @@ package com.earth2me.essentials; import static com.earth2me.essentials.I18n._; import java.io.*; +import java.util.Collections; import java.util.HashMap; +import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; @@ -10,6 +13,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.World; +import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; import org.bukkit.util.config.Configuration; @@ -224,13 +228,25 @@ public class EssentialsConf extends Configuration public ItemStack getItemStack(final String path) { - return new ItemStack( + final ItemStack stack = new ItemStack( Material.valueOf(getString(path + ".type", "AIR")), getInt(path + ".amount", 1), - (short)getInt(path + ".damage", 0)/* + (short)getInt(path + ".damage", 0)); + List<String> enchants = getKeys(path + ".enchant"); + for (String enchant : enchants) + { + Enchantment enchantment = Enchantment.getByName(enchant.toUpperCase(Locale.ENGLISH)); + if (enchantment == null) { + continue; + } + int level = getInt(path+ ".enchant."+enchant, enchantment.getStartLevel()); + stack.addUnsafeEnchantment(enchantment, level); + } + return stack; + /* * , * (byte)getInt(path + ".data", 0) - */); + */ } public void setProperty(final String path, final ItemStack stack) @@ -239,6 +255,16 @@ public class EssentialsConf extends Configuration map.put("type", stack.getType().toString()); map.put("amount", stack.getAmount()); map.put("damage", stack.getDurability()); + Map<Enchantment, Integer> enchantments = stack.getEnchantments(); + if (!enchantments.isEmpty()) + { + Map<String, Integer> enchant = new HashMap<String, Integer>(); + for (Map.Entry<Enchantment, Integer> entry : enchantments.entrySet()) + { + enchant.put(entry.getKey().getName().toLowerCase(Locale.ENGLISH), entry.getValue()); + } + map.put("enchant", enchant); + } // getData().getData() is broken //map.put("data", stack.getDurability()); setProperty(path, map); diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java index 37c66d2ef..214fc8c01 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java @@ -3,6 +3,8 @@ package com.earth2me.essentials; import static com.earth2me.essentials.I18n._; import java.util.List; import java.util.logging.Logger; +import org.bukkit.Material; +import org.bukkit.entity.Animals; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; @@ -49,6 +51,18 @@ public class EssentialsEntityListener extends EntityListener } } } + if (eDefend instanceof Animals && eAttack instanceof Player) + { + User player = ess.getUser(eAttack); + ItemStack hand = player.getItemInHand(); + if (hand != null && hand.getType() == Material.MILK_BUCKET) { + ((Animals)eDefend).setAge(-24000); + hand.setType(Material.BUCKET); + player.setItemInHand(hand); + player.updateInventory(); + event.setCancelled(true); + } + } } if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled()) { diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index a4961ac20..671f1a479 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import com.earth2me.essentials.craftbukkit.EnchantmentFix; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.textreader.IText; import com.earth2me.essentials.textreader.KeywordReplacer; @@ -16,7 +17,6 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.entity.Player; -import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerLoginEvent.Result; import org.bukkit.event.player.*; import org.bukkit.inventory.ItemStack; @@ -115,7 +115,7 @@ public class EssentialsPlayerListener extends PlayerListener } if (user.getSavedInventory() != null) { - user.getInventory().setContents(user.getSavedInventory()); + EnchantmentFix.setContents(user.getInventory(), user.getSavedInventory()); user.setSavedInventory(null); } user.updateActivity(false); @@ -172,12 +172,19 @@ public class EssentialsPlayerListener extends PlayerListener { final IText input = new TextInput(user, "motd", true, ess); final IText output = new KeywordReplacer(input, user, ess); - final TextPager pager = new TextPager(output, false); + final TextPager pager = new TextPager(output, true); pager.showPage("1", null, user); } catch (IOException ex) { - LOGGER.log(Level.WARNING, ex.getMessage(), ex); + if (ess.getSettings().isDebug()) + { + LOGGER.log(Level.WARNING, ex.getMessage(), ex); + } + else + { + LOGGER.log(Level.WARNING, ex.getMessage()); + } } } @@ -231,12 +238,14 @@ public class EssentialsPlayerListener extends PlayerListener private void updateCompass(final User user) { - try + Location loc = user.getHome(user.getLocation()); + if (loc == null) { - user.setCompassTarget(user.getHome(user.getLocation())); + loc = user.getBedSpawnLocation(); } - catch (Exception ex) + if (loc != null) { + user.setCompassTarget(loc); } } @@ -256,32 +265,6 @@ public class EssentialsPlayerListener extends PlayerListener } @Override - public void onPlayerInteract(final PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - if (event.getAction() != Action.RIGHT_CLICK_BLOCK) - { - return; - } - - if (ess.getSettings().getBedSetsHome() && event.getClickedBlock().getType() == Material.BED_BLOCK) - { - try - { - final User user = ess.getUser(event.getPlayer()); - user.setHome(); - user.sendMessage(_("homeSetToBed")); - } - catch (Throwable ex) - { - } - } - } - - @Override public void onPlayerEggThrow(final PlayerEggThrowEvent event) { final User user = ess.getUser(event.getPlayer()); @@ -385,4 +368,17 @@ public class EssentialsPlayerListener extends PlayerListener user.updateActivity(true); } } + + @Override + public void onPlayerChangedWorld(final PlayerChangedWorldEvent event) + { + if (ess.getSettings().getNoGodWorlds().contains(event.getPlayer().getLocation().getWorld().getName())) + { + User user = ess.getUser(event.getPlayer()); + if (user.isGodModeEnabledRaw()) + { + user.sendMessage(_("noGodWorldWarning")); + } + } + } } diff --git a/Essentials/src/com/earth2me/essentials/FakeInventory.java b/Essentials/src/com/earth2me/essentials/FakeInventory.java index fef6db7d0..6496fb75b 100644 --- a/Essentials/src/com/earth2me/essentials/FakeInventory.java +++ b/Essentials/src/com/earth2me/essentials/FakeInventory.java @@ -19,7 +19,7 @@ public class FakeInventory implements Inventory { continue; } - this.items[i] = new ItemStack(items[i].getTypeId(), items[i].getAmount(), items[i].getDurability()); + this.items[i] = items[i].clone(); } } diff --git a/Essentials/src/com/earth2me/essentials/FakeWorld.java b/Essentials/src/com/earth2me/essentials/FakeWorld.java index c22a04c5a..0032b6845 100644 --- a/Essentials/src/com/earth2me/essentials/FakeWorld.java +++ b/Essentials/src/com/earth2me/essentials/FakeWorld.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import java.io.File; import java.util.List; import java.util.UUID; import org.bukkit.*; @@ -514,5 +515,11 @@ public class FakeWorld implements World public int getSeaLevel() { throw new UnsupportedOperationException("Not supported yet."); - } + } + + @Override + public File getWorldFolder() + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index 49a6ebf23..e7ce92a55 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -3,12 +3,12 @@ package com.earth2me.essentials; import com.earth2me.essentials.commands.IEssentialsCommand; import java.util.List; import java.util.Map; +import java.util.Set; import org.bukkit.ChatColor; public interface ISettings extends IConf { - boolean areSignsDisabled(); String format(String format, IUser user); @@ -21,8 +21,6 @@ public interface ISettings extends IConf long getBackupInterval(); - boolean getBedSetsHome(); - String getChatFormat(String group); int getChatRadius(); @@ -64,11 +62,11 @@ public interface ISettings extends IConf boolean getReclaimSetting(); boolean getRespawnAtHome(); - + List getMultipleHomes(); - + int getHomeLimit(String set); - + int getHomeLimit(User user); boolean getSortListByGroups(); @@ -110,11 +108,11 @@ public interface ISettings extends IConf boolean warnOnBuildDisallow(); boolean warnOnSmite(); - + double getMaxMoney(); boolean isEcoLogEnabled(); - + boolean removeGodOnDisconnect(); boolean changeDisplayName(); @@ -124,9 +122,9 @@ public interface ISettings extends IConf boolean useBukkitPermissions(); boolean addPrefixSuffix(); - + boolean disablePrefix(); - + boolean disableSuffix(); long getAutoAfk(); @@ -134,8 +132,10 @@ public interface ISettings extends IConf long getAutoAfkKick(); boolean getFreezeAfkPlayers(); - + boolean areDeathMessagesEnabled(); public void setDebug(boolean debug); + + Set<String> getNoGodWorlds(); } diff --git a/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java b/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java index 0470488b8..4ce5cb52e 100644 --- a/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java +++ b/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import com.earth2me.essentials.craftbukkit.EnchantmentFix; import java.util.HashMap; import java.util.Map; import org.bukkit.Location; @@ -34,7 +35,7 @@ public final class InventoryWorkaround { continue; } - if (item.getTypeId() == cItem.getTypeId() && (!forceAmount || item.getAmount() == cItem.getAmount()) && (!forceDurability || cItem.getDurability() == item.getDurability())) + if (item.getTypeId() == cItem.getTypeId() && (!forceAmount || item.getAmount() == cItem.getAmount()) && (!forceDurability || cItem.getDurability() == item.getDurability()) && cItem.getEnchantments().equals(item.getEnchantments())) { return i; } @@ -56,7 +57,7 @@ public final class InventoryWorkaround { continue; } - if (item.getTypeId() == cItem.getTypeId() && cItem.getAmount() < cItem.getType().getMaxStackSize() && (!forceDurability || cItem.getDurability() == item.getDurability())) + if (item.getTypeId() == cItem.getTypeId() && cItem.getAmount() < cItem.getType().getMaxStackSize() && (!forceDurability || cItem.getDurability() == item.getDurability()) && cItem.getEnchantments().equals(item.getEnchantments())) { return i; } @@ -80,6 +81,11 @@ public final class InventoryWorkaround public static Map<Integer, ItemStack> addItem(final Inventory cinventory, final boolean forceDurability, final ItemStack... items) { + return addItem(cinventory, forceDurability, false, null, items); + } + + public static Map<Integer, ItemStack> addItem(final Inventory cinventory, final boolean forceDurability, final boolean dontBreakStacks, final IEssentials ess, final ItemStack... items) + { final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>(); /* TODO: some optimization @@ -101,10 +107,10 @@ public final class InventoryWorkaround { if (combined[j] == null) { - combined[j] = new ItemStack(items[i].getType(), items[i].getAmount(), items[i].getDurability()); + combined[j] = items[i].clone(); break; } - if (combined[j].getTypeId() == items[i].getTypeId() && (!forceDurability || combined[j].getDurability() == items[i].getDurability())) + if (combined[j].getTypeId() == items[i].getTypeId() && (!forceDurability || combined[j].getDurability() == items[i].getDurability()) && combined[j].getEnchantments().equals(items[i].getEnchantments())) { combined[j].setAmount(combined[j].getAmount() + items[i].getAmount()); break; @@ -141,15 +147,17 @@ public final class InventoryWorkaround else { // More than a single stack! - if (item.getAmount() > item.getType().getMaxStackSize()) + if (item.getAmount() > (dontBreakStacks ? ess.getSettings().getDefaultStackSize() : item.getType().getMaxStackSize())) { - cinventory.setItem(firstFree, new ItemStack(item.getTypeId(), item.getType().getMaxStackSize(), item.getDurability())); + ItemStack stack = item.clone(); + stack.setAmount(dontBreakStacks ? ess.getSettings().getDefaultStackSize() : item.getType().getMaxStackSize()); + EnchantmentFix.setItem(cinventory, firstFree, stack); item.setAmount(item.getAmount() - item.getType().getMaxStackSize()); } else { // Just store it - cinventory.setItem(firstFree, item); + EnchantmentFix.setItem(cinventory, firstFree, item); break; } } @@ -161,7 +169,7 @@ public final class InventoryWorkaround final int amount = item.getAmount(); final int partialAmount = partialItem.getAmount(); - final int maxAmount = partialItem.getType().getMaxStackSize(); + final int maxAmount = dontBreakStacks ? ess.getSettings().getDefaultStackSize() : partialItem.getType().getMaxStackSize(); // Check if it fully fits if (amount + partialAmount <= maxAmount) @@ -228,7 +236,7 @@ public final class InventoryWorkaround { // split the stack and store itemStack.setAmount(amount - toDelete); - cinventory.setItem(first, itemStack); + EnchantmentFix.setItem(cinventory, first, itemStack); toDelete = 0; } } @@ -256,10 +264,10 @@ public final class InventoryWorkaround { if (combined[j] == null) { - combined[j] = new ItemStack(items[i].getType(), items[i].getAmount(), items[i].getDurability()); + combined[j] = items[i].clone(); break; } - if (combined[j].getTypeId() == items[i].getTypeId() && (!forceDurability || combined[j].getDurability() == items[i].getDurability())) + if (combined[j].getTypeId() == items[i].getTypeId() && (!forceDurability || combined[j].getDurability() == items[i].getDurability()) && combined[j].getEnchantments().equals(items[i].getEnchantments())) { combined[j].setAmount(combined[j].getAmount() + items[i].getAmount()); break; @@ -318,14 +326,18 @@ public final class InventoryWorkaround final int maxStackSize = itm.getType().getMaxStackSize(); final int stacks = itm.getAmount() / maxStackSize; final int leftover = itm.getAmount() % maxStackSize; - Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)]; + final Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)]; for (int i = 0; i < stacks; i++) { - itemStacks[i] = loc.getWorld().dropItem(loc, new ItemStack(itm.getType(), maxStackSize, itm.getDurability())); + final ItemStack stack = itm.clone(); + stack.setAmount(maxStackSize); + itemStacks[i] = loc.getWorld().dropItem(loc, stack); } if (leftover > 0) { - itemStacks[stacks] = loc.getWorld().dropItem(loc, new ItemStack(itm.getType(), leftover, itm.getDurability())); + final ItemStack stack = itm.clone(); + stack.setAmount(leftover); + itemStacks[stacks] = loc.getWorld().dropItem(loc, stack); } return itemStacks; } diff --git a/Essentials/src/com/earth2me/essentials/Mob.java b/Essentials/src/com/earth2me/essentials/Mob.java index e9b269218..394bbaf23 100644 --- a/Essentials/src/com/earth2me/essentials/Mob.java +++ b/Essentials/src/com/earth2me/essentials/Mob.java @@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._; import java.util.HashMap; import java.util.Locale; import java.util.Map; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Location; @@ -66,6 +67,10 @@ public enum Mob hashMap.put(mob.name.toLowerCase(Locale.ENGLISH), mob); } } + + public static Set<String> getMobList() { + return hashMap.keySet(); + } public LivingEntity spawn(final Player player, final Server server, final Location loc) throws MobException { diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java index d8c871b5b..deccf6516 100644 --- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java +++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java @@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._; import java.net.InetSocketAddress; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.UUID; import lombok.Delegate; diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index b004925e6..4fa67a72a 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -4,9 +4,12 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.commands.IEssentialsCommand; import java.io.File; import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.ChatColor; @@ -34,12 +37,6 @@ public class Settings implements ISettings } @Override - public boolean getBedSetsHome() - { - return config.getBoolean("bed-sethome", false); - } - - @Override public List<String> getMultipleHomes() { return config.getKeys("sethome-multiple"); @@ -237,7 +234,7 @@ public class Settings implements ISettings try { - return ChatColor.valueOf(colorName.toUpperCase()); + return ChatColor.valueOf(colorName.toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException ex) { @@ -341,6 +338,7 @@ public class Settings implements ISettings public void reloadConfig() { config.load(); + noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds",Collections.<String>emptyList())); } @Override @@ -543,6 +541,14 @@ public class Settings implements ISettings { return config.getBoolean("death-messages", true); } + + Set <String> noGodWorlds = new HashSet<String>(); + @Override + public Set<String> getNoGodWorlds() + { + return noGodWorlds; + + } @Override public void setDebug(final boolean debug) diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index e58cbfb50..3c1166240 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -513,14 +513,20 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser @Override public boolean isGodModeEnabled() { - return super.isGodModeEnabled() || (isAfk() && ess.getSettings().getFreezeAfkPlayers()); + return (super.isGodModeEnabled() && !ess.getSettings().getNoGodWorlds().contains(getLocation().getWorld().getName())) + || (isAfk() && ess.getSettings().getFreezeAfkPlayers()); } + public boolean isGodModeEnabledRaw() + { + return super.isGodModeEnabled(); + } + public String getGroup() { return ess.getPermissionsHandler().getGroup(base); } - + public boolean inGroup(final String group) { return ess.getPermissionsHandler().inGroup(base, group); diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java index d9dad769d..9df1b0342 100644 --- a/Essentials/src/com/earth2me/essentials/UserData.java +++ b/Essentials/src/com/earth2me/essentials/UserData.java @@ -130,27 +130,32 @@ public abstract class UserData extends PlayerExtension implements IConf return loc; } - public Location getHome(Location world) throws Exception + public Location getHome(final Location world) { - Location loc; - for (String home : getHomes()) + try { - loc = config.getLocation("homes." + home, getServer()); - if (world.getWorld() == loc.getWorld()) + Location loc; + for (String home : getHomes()) { - return loc; - } + loc = config.getLocation("homes." + home, getServer()); + if (world.getWorld() == loc.getWorld()) + { + return loc; + } + } + loc = config.getLocation("homes." + getHomes().get(0), getServer()); + return loc; + } + catch (Exception ex) + { + return null; } - loc = config.getLocation("homes." + getHomes().get(0), getServer()); - return loc; } public List<String> getHomes() { - List<String> list = new ArrayList(homes.keySet()); - return list; - + return new ArrayList(homes.keySet()); } public void setHome(String name, Location loc) diff --git a/Essentials/src/com/earth2me/essentials/Util.java b/Essentials/src/com/earth2me/essentials/Util.java index f73c4daa8..8fc7da3af 100644 --- a/Essentials/src/com/earth2me/essentials/Util.java +++ b/Essentials/src/com/earth2me/essentials/Util.java @@ -240,7 +240,8 @@ public class Util AIR_MATERIALS.add(Material.PUMPKIN_STEM.getId()); AIR_MATERIALS.add(Material.MELON_STEM.getId()); AIR_MATERIALS.add(Material.VINE.getId()); - //TODO: Add 1.9 materials + AIR_MATERIALS.add(Material.NETHER_WARTS.getId()); + AIR_MATERIALS.add(Material.WATER_LILY.getId()); for (Integer integer : AIR_MATERIALS) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java index f4a653ce3..8f432ca6e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java @@ -1,6 +1,7 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.User; +import java.util.Locale; import org.bukkit.Server; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -24,7 +25,7 @@ public class Commandeco extends EssentialsCommand double amount; try { - cmd = EcoCommands.valueOf(args[0].toUpperCase()); + cmd = EcoCommands.valueOf(args[0].toUpperCase(Locale.ENGLISH)); amount = Double.parseDouble(args[2].replaceAll("[^0-9\\.]", "")); } catch (Exception ex) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java new file mode 100644 index 000000000..6b028a634 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java @@ -0,0 +1,148 @@ +package com.earth2me.essentials.commands; + +import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; +import com.earth2me.essentials.craftbukkit.EnchantmentFix; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; +import java.util.regex.Pattern; +import org.bukkit.Server; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.inventory.ItemStack; +import static com.earth2me.essentials.I18n._; + + +public class Commandenchant extends EssentialsCommand +{ + private static final Map<String, Enchantment> ENCHANTMENTS = new HashMap<String, Enchantment>(); + private static final transient Pattern NUMPATTERN = Pattern.compile("\\d+"); + + static + { + ENCHANTMENTS.put("alldamage", Enchantment.DAMAGE_ALL); + ENCHANTMENTS.put("alldmg", Enchantment.DAMAGE_ALL); + ENCHANTMENTS.put("sharpness", Enchantment.DAMAGE_ALL); + ENCHANTMENTS.put("arthropodsdamage", Enchantment.DAMAGE_ARTHROPODS); + ENCHANTMENTS.put("ardmg", Enchantment.DAMAGE_ARTHROPODS); + ENCHANTMENTS.put("baneofarthropods", Enchantment.DAMAGE_ARTHROPODS); + ENCHANTMENTS.put("undeaddamage", Enchantment.DAMAGE_UNDEAD); + ENCHANTMENTS.put("smite", Enchantment.DAMAGE_UNDEAD); + ENCHANTMENTS.put("digspeed", Enchantment.DIG_SPEED); + ENCHANTMENTS.put("efficiency", Enchantment.DIG_SPEED); + ENCHANTMENTS.put("durability", Enchantment.DURABILITY); + ENCHANTMENTS.put("dura", Enchantment.DURABILITY); + ENCHANTMENTS.put("unbreaking", Enchantment.DURABILITY); + ENCHANTMENTS.put("fireaspect", Enchantment.FIRE_ASPECT); + ENCHANTMENTS.put("fire", Enchantment.FIRE_ASPECT); + ENCHANTMENTS.put("knockback", Enchantment.KNOCKBACK); + ENCHANTMENTS.put("blockslootbonus", Enchantment.LOOT_BONUS_BLOCKS); + ENCHANTMENTS.put("fortune", Enchantment.LOOT_BONUS_BLOCKS); + ENCHANTMENTS.put("mobslootbonus", Enchantment.LOOT_BONUS_MOBS); + ENCHANTMENTS.put("mobloot", Enchantment.LOOT_BONUS_MOBS); + ENCHANTMENTS.put("looting", Enchantment.LOOT_BONUS_MOBS); + ENCHANTMENTS.put("oxygen", Enchantment.OXYGEN); + ENCHANTMENTS.put("respiration", Enchantment.OXYGEN); + ENCHANTMENTS.put("protection", Enchantment.PROTECTION_ENVIRONMENTAL); + ENCHANTMENTS.put("prot", Enchantment.PROTECTION_ENVIRONMENTAL); + ENCHANTMENTS.put("explosionsprotection", Enchantment.PROTECTION_EXPLOSIONS); + ENCHANTMENTS.put("expprot", Enchantment.PROTECTION_EXPLOSIONS); + ENCHANTMENTS.put("blastprotection", Enchantment.PROTECTION_EXPLOSIONS); + ENCHANTMENTS.put("fallprotection", Enchantment.PROTECTION_FALL); + ENCHANTMENTS.put("fallprot", Enchantment.PROTECTION_FALL); + ENCHANTMENTS.put("featherfalling", Enchantment.PROTECTION_FALL); + ENCHANTMENTS.put("fireprotection", Enchantment.PROTECTION_FIRE); + ENCHANTMENTS.put("fireprot", Enchantment.PROTECTION_FIRE); + ENCHANTMENTS.put("projectileprotection", Enchantment.PROTECTION_PROJECTILE); + ENCHANTMENTS.put("projprot", Enchantment.PROTECTION_PROJECTILE); + ENCHANTMENTS.put("silktouch", Enchantment.SILK_TOUCH); + ENCHANTMENTS.put("waterworker", Enchantment.WATER_WORKER); + ENCHANTMENTS.put("aquaaffinity", Enchantment.WATER_WORKER); + } + + public Commandenchant() + { + super("enchant"); + } + + @Override + protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception + { + final ItemStack stack = user.getItemInHand(); + if (stack == null) + { + throw new Exception(_("nothingInHand")); + } + if (args.length == 0) + { + final Set<String> enchantmentslist = new TreeSet<String>(); + for (Map.Entry<String, Enchantment> entry : ENCHANTMENTS.entrySet()) + { + final String enchantmentName = entry.getValue().getName().toLowerCase(Locale.ENGLISH); + if (enchantmentslist.contains(enchantmentName) || user.isAuthorized("essentials.enchant." + enchantmentName)) + { + enchantmentslist.add(entry.getKey()); + //enchantmentslist.add(enchantmentName); + } + } + throw new NotEnoughArgumentsException(_("enchantments", Util.joinList(enchantmentslist.toArray()))); + } + int level = -1; + if (args.length > 1) + { + try + { + level = Integer.parseInt(args[1]); + } + catch (NumberFormatException ex) + { + level = -1; + } + } + Enchantment enchantment = getEnchantment(args[0], user); + if (level < 0 || level > enchantment.getMaxLevel()) + { + level = enchantment.getMaxLevel(); + } + if (level == 0) { + stack.removeEnchantment(enchantment); + } else { + stack.addEnchantment(enchantment, level); + } + EnchantmentFix.setItemInHand(user.getInventory(), stack); + user.updateInventory(); + final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH); + if (level == 0) { + user.sendMessage(_("enchantmentRemoved", enchantmentName.replace('_', ' '))); + } else { + user.sendMessage(_("enchantmentApplied", enchantmentName.replace('_', ' '))); + } + } + + public static Enchantment getEnchantment(final String name, final User user) throws Exception + { + + Enchantment enchantment; + if (NUMPATTERN.matcher(name).matches()) { + enchantment = Enchantment.getById(Integer.parseInt(name)); + } else { + enchantment = Enchantment.getByName(name.toUpperCase(Locale.ENGLISH)); + } + if (enchantment == null) + { + enchantment = ENCHANTMENTS.get(name.toLowerCase(Locale.ENGLISH)); + } + if (enchantment == null) + { + throw new Exception(_("enchantmentNotFound")); + } + final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH); + if (user != null && !user.isAuthorized("essentials.enchant." + enchantmentName)) + { + throw new Exception(_("enchantmentPerm", enchantmentName)); + } + return enchantment; + } +} diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java index ebda30dd5..32b0564b7 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java @@ -1,11 +1,13 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.InventoryWorkaround; import com.earth2me.essentials.User; import java.util.Locale; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.command.CommandSender; +import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -44,6 +46,29 @@ public class Commandgive extends EssentialsCommand stack.setAmount(Integer.parseInt(args[2])); } + if (args.length > 3) + { + for (int i = 3; i < args.length; i++) + { + final String[] split = args[i].split("[:+',;.]", 2); + if (split.length < 1) + { + continue; + } + final Enchantment enchantment = Commandenchant.getEnchantment(split[0], sender instanceof Player ? ess.getUser(sender) : null); + int level; + if (split.length > 1) + { + level = Integer.parseInt(split[1]); + } + else + { + level = enchantment.getMaxLevel(); + } + stack.addEnchantment(enchantment, level); + } + } + if (stack.getType() == Material.AIR) { throw new Exception(ChatColor.RED + "You can't give air."); @@ -52,7 +77,7 @@ public class Commandgive extends EssentialsCommand final User giveTo = getPlayer(server, args, 0); final String itemName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' '); sender.sendMessage(ChatColor.BLUE + "Giving " + stack.getAmount() + " of " + itemName + " to " + giveTo.getDisplayName() + "."); - giveTo.getInventory().addItem(stack); + InventoryWorkaround.addItem(giveTo.getInventory(), true, true, ess, stack); giveTo.updateInventory(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java index 1c0591bee..090cebd4c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java @@ -6,6 +6,7 @@ import com.earth2me.essentials.User; import com.earth2me.essentials.Util; import java.util.List; import java.util.Locale; +import org.bukkit.Location; import org.bukkit.Server; @@ -33,7 +34,7 @@ public class Commandhome extends EssentialsCommand } else { - player = getPlayer(server, nameParts[0].split(" "), 0, true); + player = getPlayer(server, nameParts, 0, true); if (nameParts.length > 1) { homeName = nameParts[1]; @@ -42,14 +43,32 @@ public class Commandhome extends EssentialsCommand } try { + if ("bed".equalsIgnoreCase(homeName)) { + final Location bed = player.getBedSpawnLocation(); + if (bed != null) + { + user.getTeleport().teleport(bed, charge); + } + } user.getTeleport().home(player, homeName.toLowerCase(Locale.ENGLISH), charge); } catch (NotEnoughArgumentsException e) { final List<String> homes = player.getHomes(); - if (homes.isEmpty() && player.equals(user) && ess.getSettings().spawnIfNoHome()) + if (homes.isEmpty() && player.equals(user)) { - user.getTeleport().respawn(ess.getSpawn(), charge); + final Location loc = player.getBedSpawnLocation(); + if (loc == null) + { + if (ess.getSettings().spawnIfNoHome()) + { + user.getTeleport().respawn(ess.getSpawn(), charge); + } + } + else + { + user.getTeleport().teleport(loc, charge); + } } else if (homes.isEmpty()) { @@ -61,6 +80,7 @@ public class Commandhome extends EssentialsCommand } else { + homes.add("bed"); user.sendMessage(_("homes", Util.joinList(homes))); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java index 1f5c32faa..d53fe8a77 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java @@ -2,6 +2,7 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; +import com.earth2me.essentials.craftbukkit.EnchantmentFix; import java.util.Arrays; import org.bukkit.Server; import org.bukkit.inventory.ItemStack; @@ -29,7 +30,7 @@ public class Commandinvsee extends EssentialsCommand } if (invUser == user && user.getSavedInventory() != null) { - invUser.getInventory().setContents(user.getSavedInventory()); + EnchantmentFix.setContents(invUser.getInventory(), user.getSavedInventory()); user.setSavedInventory(null); user.sendMessage(_("invRestored")); throw new NoChargeException(); @@ -49,7 +50,7 @@ public class Commandinvsee extends EssentialsCommand { throw new Exception(_("invBigger")); } - user.getInventory().setContents(invUserStack); + EnchantmentFix.setContents(user.getInventory(), invUserStack); user.sendMessage(_("invSee", invUser.getDisplayName())); user.sendMessage(_("invSeeHelp")); throw new NoChargeException(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java index 3bd35353a..0d30b4e77 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java @@ -1,10 +1,12 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.InventoryWorkaround; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import java.util.Locale; import org.bukkit.Material; import org.bukkit.Server; +import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; @@ -40,6 +42,29 @@ public class Commanditem extends EssentialsCommand stack.setAmount(Integer.parseInt(args[1])); } + if (args.length > 2) + { + for (int i = 2; i < args.length; i++) + { + final String[] split = args[i].split("[:+',;.]", 2); + if (split.length < 1) + { + continue; + } + final Enchantment enchantment = Commandenchant.getEnchantment(split[0], user); + int level; + if (split.length > 1) + { + level = Integer.parseInt(split[1]); + } + else + { + level = enchantment.getMaxLevel(); + } + stack.addEnchantment(enchantment, level); + } + } + if (stack.getType() == Material.AIR) { throw new Exception(_("cantSpawnItem", "Air")); @@ -47,7 +72,7 @@ public class Commanditem extends EssentialsCommand final String displayName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' '); user.sendMessage(_("itemSpawn", stack.getAmount(), displayName)); - user.getInventory().addItem(stack); + InventoryWorkaround.addItem(user.getInventory(), true, true, ess, stack); user.updateInventory(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java index f1aad4394..2e09f28ba 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.InventoryWorkaround; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; @@ -113,7 +114,7 @@ public class Commandkit extends EssentialsCommand final int id = Material.getMaterial(Integer.parseInt(parts[0])).getId(); final int amount = parts.length > 1 ? Integer.parseInt(parts[parts.length > 2 ? 2 : 1]) : 1; final short data = parts.length > 2 ? Short.parseShort(parts[1]) : 0; - final HashMap<Integer, ItemStack> overfilled = user.getInventory().addItem(new ItemStack(id, amount, data)); + final Map<Integer, ItemStack> overfilled = InventoryWorkaround.addItem(user.getInventory(), true, new ItemStack(id, amount, data)); for (ItemStack itemStack : overfilled.values()) { user.getWorld().dropItemNaturally(user.getLocation(), itemStack); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java index 549f6efac..92833a66c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import java.util.*; -import org.bukkit.ChatColor; import org.bukkit.Server; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -39,16 +38,15 @@ public class Commandlist extends EssentialsCommand playerHidden++; } } - //TODO: move these to messages file - final StringBuilder online = new StringBuilder(); - online.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().length - playerHidden); + + String online; if (showhidden && playerHidden > 0) { - online.append(ChatColor.GRAY).append("/").append(playerHidden); + online = _("listAmountHidden", server.getOnlinePlayers().length - playerHidden, playerHidden, server.getMaxPlayers()); + } else { + online = _("listAmount",server.getOnlinePlayers().length - playerHidden, server.getMaxPlayers()); } - online.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(server.getMaxPlayers()); - online.append(ChatColor.BLUE).append(" players online."); - sender.sendMessage(online.toString()); + sender.sendMessage(online); if (ess.getSettings().getSortListByGroups()) { @@ -90,11 +88,11 @@ public class Commandlist extends EssentialsCommand } if (user.isAfk()) { - groupString.append("§7[AFK]§f"); + groupString.append(_("listAfkTag")); } if (user.isHidden()) { - groupString.append("§7[HIDDEN]§f"); + groupString.append(_("listHiddenTag")); } groupString.append(user.getDisplayName()); groupString.append("§f"); @@ -131,11 +129,11 @@ public class Commandlist extends EssentialsCommand } if (user.isAfk()) { - onlineUsers.append("§7[AFK]§f"); + onlineUsers.append(_("listAfkTag")); } if (user.isHidden()) { - onlineUsers.append("§7[HIDDEN]§f"); + onlineUsers.append(_("listHiddenTag")); } onlineUsers.append(user.getDisplayName()); onlineUsers.append("§f"); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java index 9ca622aef..1639f5360 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java @@ -149,6 +149,7 @@ public class Commandsell extends EssentialsCommand } } + //TODO: Prices for Enchantments final ItemStack ris = new ItemStack(is.getType(), amount, is.getDurability()); InventoryWorkaround.removeItem(user.getInventory(), true, ris); user.updateInventory(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java index e92b29a93..e3b1ef366 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java @@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Mob; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; +import java.util.Locale; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Server; @@ -23,8 +24,7 @@ public class Commandspawner extends EssentialsCommand { if (args.length < 1 || args[0].length() < 2) { - throw new NotEnoughArgumentsException(); - //TODO: user.sendMessage("§7Mobs: Zombie PigZombie Skeleton Slime Chicken Pig Monster Spider Creeper Ghast Squid Giant Cow Sheep Wolf"); + throw new NotEnoughArgumentsException(_("mobsAvailable", Util.joinList(Mob.getMobList()))); } final Location target = Util.getTarget(user); @@ -44,6 +44,14 @@ public class Commandspawner extends EssentialsCommand user.sendMessage(_("invalidMob")); return; } + if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase(Locale.ENGLISH))) + { + throw new Exception(_("unableToSpawnMob")); + } + if (!user.isAuthorized("essentials.spawner." + mob.name.toLowerCase())) + { + throw new Exception(_("unableToSpawnMob")); + } ((CreatureSpawner)target.getBlock().getState()).setCreatureType(mob.getType()); user.sendMessage(_("setSpawner", mob.name)); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java index f3f5ce2ef..863821973 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java @@ -26,8 +26,7 @@ public class Commandspawnmob extends EssentialsCommand { if (args.length < 1) { - throw new NotEnoughArgumentsException(); - //TODO: user.sendMessage("§7Mobs: Zombie PigZombie Skeleton Slime Chicken Pig Monster Spider Creeper Ghast Squid Giant Cow Sheep Wolf"); + throw new NotEnoughArgumentsException(_("mobsAvailable", Util.joinList(Mob.getMobList()))); } @@ -67,6 +66,10 @@ public class Commandspawnmob extends EssentialsCommand { throw new Exception(_("unableToSpawnMob")); } + if (!user.isAuthorized("essentials.spawnmob." + mob.name.toLowerCase())) + { + throw new Exception(_("unableToSpawnMob")); + } final Block block = Util.getTarget(user).getBlock(); if (block == null) @@ -97,6 +100,10 @@ public class Commandspawnmob extends EssentialsCommand { throw new Exception(_("unableToSpawnMob")); } + if (!user.isAuthorized("essentials.spawnmob." + mobMount.name.toLowerCase())) + { + throw new Exception(_("unableToSpawnMob")); + } try { spawnedMount = mobMount.spawn(user, server, loc); @@ -185,6 +192,16 @@ public class Commandspawnmob extends EssentialsCommand throw new Exception(_("slimeMalformedSize"), e); } } + if (("Sheep".equalsIgnoreCase(type) + || "Cow".equalsIgnoreCase(type) + || "Chicken".equalsIgnoreCase(type) + || "Pig".equalsIgnoreCase(type) + || "Wolf".equalsIgnoreCase(type)) + && data.equalsIgnoreCase("baby")) + { + ((Animals)spawned).setAge(-24000); + return; + } if ("Sheep".equalsIgnoreCase(type)) { try @@ -196,7 +213,7 @@ public class Commandspawnmob extends EssentialsCommand } else { - ((Sheep)spawned).setColor(DyeColor.valueOf(data.toUpperCase())); + ((Sheep)spawned).setColor(DyeColor.valueOf(data.toUpperCase(Locale.ENGLISH))); } } catch (Exception e) @@ -204,16 +221,26 @@ public class Commandspawnmob extends EssentialsCommand throw new Exception(_("sheepMalformedColor"), e); } } - if ("Wolf".equalsIgnoreCase(type) && data.equalsIgnoreCase("tamed")) + if ("Wolf".equalsIgnoreCase(type) + && data.toLowerCase(Locale.ENGLISH).startsWith("tamed")) { final Wolf wolf = ((Wolf)spawned); wolf.setTamed(true); wolf.setOwner(user); wolf.setSitting(true); + if (data.equalsIgnoreCase("tamedbaby")) + { + ((Animals)spawned).setAge(-24000); + } } - if ("Wolf".equalsIgnoreCase(type) && data.equalsIgnoreCase("angry")) + if ("Wolf".equalsIgnoreCase(type) + && data.toLowerCase(Locale.ENGLISH).startsWith("angry")) { ((Wolf)spawned).setAngry(true); + if (data.equalsIgnoreCase("angrybaby")) + { + ((Animals)spawned).setAge(-24000); + } } if ("Creeper".equalsIgnoreCase(type) && data.equalsIgnoreCase("powered")) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java index 7aa0e66f8..203628753 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java @@ -28,7 +28,7 @@ public class Commandtppos extends EssentialsCommand final Location location = new Location(user.getWorld(), x, y, z); if (args.length > 3) { - location.setYaw(Float.parseFloat(args[3])); + location.setYaw((Float.parseFloat(args[3]) + 180 + 360) % 360); } if (args.length > 4) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java index 2c1d06f39..c539a596c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java @@ -1,6 +1,7 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.User; import org.bukkit.Server; import org.bukkit.command.CommandSender; @@ -19,7 +20,14 @@ public class Commandunbanip extends EssentialsCommand { throw new NotEnoughArgumentsException(); } - + try + { + final User user = getPlayer(server, args, 0, true); + ess.getServer().unbanIP(user.getLastLoginAddress()); + } + catch (Exception ex) + { + } ess.getServer().unbanIP(args[0]); sender.sendMessage(_("unbannedIP")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java index 63717fcae..6b9d17b26 100644 --- a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java +++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java @@ -47,6 +47,10 @@ public abstract class EssentialsCommand implements IEssentialsCommand { throw new NotEnoughArgumentsException(); } + if (args[pos].isEmpty()) + { + throw new NoSuchFieldException(_("playerNotFound")); + } final User user = ess.getUser(args[pos]); if (user != null) { diff --git a/Essentials/src/com/earth2me/essentials/commands/NotEnoughArgumentsException.java b/Essentials/src/com/earth2me/essentials/commands/NotEnoughArgumentsException.java index 9513fc934..0c47b9893 100644 --- a/Essentials/src/com/earth2me/essentials/commands/NotEnoughArgumentsException.java +++ b/Essentials/src/com/earth2me/essentials/commands/NotEnoughArgumentsException.java @@ -5,11 +5,16 @@ public class NotEnoughArgumentsException extends Exception { public NotEnoughArgumentsException() { - super(); + super(""); + } + + public NotEnoughArgumentsException(final String string) + { + super(string); } public NotEnoughArgumentsException(final Throwable ex) { - super(ex); + super("", ex); } } diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/EnchantmentFix.java b/Essentials/src/com/earth2me/essentials/craftbukkit/EnchantmentFix.java new file mode 100644 index 000000000..b6e18cb3f --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/EnchantmentFix.java @@ -0,0 +1,66 @@ +package com.earth2me.essentials.craftbukkit; + +import org.bukkit.craftbukkit.inventory.CraftInventory; +import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer; +import org.bukkit.craftbukkit.inventory.CraftItemStack; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + + +public class EnchantmentFix +{ + public static void setContents(Inventory inventory, ItemStack[] items) + { + CraftInventory cInventory = (CraftInventory)inventory; + if (cInventory.getContents().length != items.length) + { + throw new IllegalArgumentException("Invalid inventory size; expected " + cInventory.getContents().length); + } + + net.minecraft.server.ItemStack[] mcItems = cInventory.getInventory().getContents(); + + for (int i = 0; i < items.length; i++) + { + ItemStack item = items[i]; + if (item == null || item.getTypeId() <= 0) + { + mcItems[i] = null; + } + else + { + mcItems[i] = new net.minecraft.server.ItemStack(item.getTypeId(), item.getAmount(), item.getDurability()); + new CraftItemStack(mcItems[i]).addUnsafeEnchantments(item.getEnchantments()); + } + } + } + + public static void setItem(Inventory inventory, int index, ItemStack item) + { + CraftInventory cInventory = (CraftInventory)inventory; + if (item == null) + { + cInventory.getInventory().setItem(index, null); + } + else + { + net.minecraft.server.ItemStack stack = new net.minecraft.server.ItemStack(item.getTypeId(), item.getAmount(), item.getDurability()); + new CraftItemStack(stack).addUnsafeEnchantments(item.getEnchantments()); + cInventory.getInventory().setItem(index, stack); + } + } + + public static void setItemInHand(Inventory inventory, ItemStack item) + { + CraftInventoryPlayer cInventory = (CraftInventoryPlayer)inventory; + if (item == null) + { + cInventory.getInventory().setItem(cInventory.getInventory().itemInHandIndex, null); + } + else + { + net.minecraft.server.ItemStack stack = new net.minecraft.server.ItemStack(item.getTypeId(), item.getAmount(), item.getDurability()); + new CraftItemStack(stack).addUnsafeEnchantments(item.getEnchantments()); + cInventory.getInventory().setItem(cInventory.getInventory().itemInHandIndex, stack); + } + } +} diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/ItemDupeFix.java b/Essentials/src/com/earth2me/essentials/craftbukkit/ItemDupeFix.java new file mode 100644 index 000000000..243049e0a --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/ItemDupeFix.java @@ -0,0 +1,25 @@ +package com.earth2me.essentials.craftbukkit; + +import net.minecraft.server.EntityPlayer; +import org.bukkit.craftbukkit.entity.CraftPlayer; +import org.bukkit.event.player.PlayerListener; +import org.bukkit.event.player.PlayerTeleportEvent; + + +public class ItemDupeFix extends PlayerListener +{ + @Override + public void onPlayerTeleport(final PlayerTeleportEvent event) + { + if (event.isCancelled()) + { + return; + } + final CraftPlayer player = (CraftPlayer)event.getPlayer(); + final EntityPlayer entity = player.getHandle(); + if (entity.activeContainer != entity.defaultContainer) + { + entity.closeInventory(); + } + } +} diff --git a/Essentials/src/com/earth2me/essentials/settings/Worth.java b/Essentials/src/com/earth2me/essentials/settings/Worth.java index 939cdd883..707f907cf 100644 --- a/Essentials/src/com/earth2me/essentials/settings/Worth.java +++ b/Essentials/src/com/earth2me/essentials/settings/Worth.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.settings; +import com.earth2me.essentials.storage.EnchantmentLevel; import com.earth2me.essentials.storage.MapKeyType; import com.earth2me.essentials.storage.MapValueType; import com.earth2me.essentials.storage.StorageObject; @@ -8,6 +9,7 @@ import java.util.Map; import lombok.Data; import lombok.EqualsAndHashCode; import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; import org.bukkit.material.MaterialData; @@ -21,6 +23,9 @@ public class Worth implements StorageObject @MapKeyType(MaterialData.class) @MapValueType(Double.class) private Map<MaterialData, Double> buy = new HashMap<MaterialData, Double>(); + @MapKeyType(EnchantmentLevel.class) + @MapValueType(Double.class) + private Map<EnchantmentLevel, Double> enchantmentMultiplier = new HashMap<EnchantmentLevel, Double>(); public Worth() { diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java index c2f3eb8e4..4b6e4395c 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java @@ -4,7 +4,7 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.*; import org.bukkit.inventory.ItemStack; - +//TODO: Sell Enchantment on Trade signs? public class SignTrade extends EssentialsSign { public SignTrade() @@ -70,13 +70,16 @@ public class SignTrade extends EssentialsSign final Trade trade = getTrade(sign, 2, false, false, ess); if (trade.getItemStack() != null && player.getItemInHand() != null && trade.getItemStack().getTypeId() == player.getItemInHand().getTypeId() - && trade.getItemStack().getDurability() == player.getItemInHand().getDurability()) + && trade.getItemStack().getDurability() == player.getItemInHand().getDurability() + && trade.getItemStack().getEnchantments().equals(player.getItemInHand().getEnchantments())) { int amount = player.getItemInHand().getAmount(); amount -= amount % trade.getItemStack().getAmount(); if (amount > 0) { - final Trade store = new Trade(new ItemStack(player.getItemInHand().getTypeId(), amount, player.getItemInHand().getDurability()), ess); + final ItemStack stack = player.getItemInHand().clone(); + stack.setAmount(amount); + final Trade store = new Trade(stack, ess); addAmount(sign, 2, store, ess); store.charge(player); return store; diff --git a/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java b/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java index 2656d183d..7ed12b6d5 100644 --- a/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java +++ b/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java @@ -1,10 +1,12 @@ package com.earth2me.essentials.storage; +import java.util.Locale; import java.util.regex.Pattern; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; +import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; import org.bukkit.material.MaterialData; import org.yaml.snakeyaml.constructor.Constructor; @@ -69,6 +71,10 @@ public class BukkitConstructor extends Constructor { mat = Material.matchMaterial(split[0]); } + if (mat == null) + { + return null; + } byte data = 0; if (split.length == 2 && NUMPATTERN.matcher(split[1]).matches()) { @@ -83,7 +89,7 @@ public class BukkitConstructor extends Constructor { return null; } - final String[] split1 = val.split("\\W", 2); + final String[] split1 = val.split("\\W"); if (split1.length == 0) { return null; @@ -103,17 +109,102 @@ public class BukkitConstructor extends Constructor { mat = Material.matchMaterial(split2[0]); } + if (mat == null) + { + return null; + } short data = 0; if (split2.length == 2 && NUMPATTERN.matcher(split2[1]).matches()) { data = Short.parseShort(split2[1]); } int size = mat.getMaxStackSize(); - if (split1.length == 2 && NUMPATTERN.matcher(split1[1]).matches()) + if (split1.length > 1 && NUMPATTERN.matcher(split1[1]).matches()) { size = Integer.parseInt(split1[1]); } - return new ItemStack(mat, size, data); + final ItemStack stack = new ItemStack(mat, size, data); + if (split1.length > 2) + { + for (int i = 2; i < split1.length; i++) + { + final String[] split3 = split1[0].split("[:+',;.]", 2); + if (split3.length < 1) + { + continue; + } + Enchantment enchantment; + if (NUMPATTERN.matcher(split3[0]).matches()) + { + final int enchantId = Integer.parseInt(split3[0]); + enchantment = Enchantment.getById(enchantId); + } + else + { + enchantment = Enchantment.getByName(split3[0].toUpperCase(Locale.ENGLISH)); + } + if (enchantment == null) + { + continue; + } + int level = enchantment.getStartLevel(); + if (split3.length == 2 && NUMPATTERN.matcher(split3[1]).matches()) + { + level = Integer.parseInt(split3[1]); + } + if (level < enchantment.getStartLevel()) + { + level = enchantment.getStartLevel(); + } + if (level > enchantment.getMaxLevel()) + { + level = enchantment.getMaxLevel(); + } + stack.addUnsafeEnchantment(enchantment, level); + } + } + return stack; + } + if (node.getType().equals(EnchantmentLevel.class)) + { + final String val = (String)constructScalar((ScalarNode)node); + if (val.isEmpty()) + { + return null; + } + final String[] split = val.split("[:+',;.]", 2); + if (split.length == 0) + { + return null; + } + Enchantment enchant; + if (NUMPATTERN.matcher(split[0]).matches()) + { + final int typeId = Integer.parseInt(split[0]); + enchant = Enchantment.getById(typeId); + } + else + { + enchant = Enchantment.getByName(split[0].toUpperCase(Locale.ENGLISH)); + } + if (enchant == null) + { + return null; + } + int level = enchant.getStartLevel(); + if (split.length == 2 && NUMPATTERN.matcher(split[1]).matches()) + { + level = Integer.parseInt(split[1]); + } + if (level < enchant.getStartLevel()) + { + level = enchant.getStartLevel(); + } + if (level > enchant.getMaxLevel()) + { + level = enchant.getMaxLevel(); + } + return new EnchantmentLevel(enchant, level); } return super.construct(node); } diff --git a/Essentials/src/com/earth2me/essentials/storage/EnchantmentLevel.java b/Essentials/src/com/earth2me/essentials/storage/EnchantmentLevel.java new file mode 100644 index 000000000..a664929f3 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/storage/EnchantmentLevel.java @@ -0,0 +1,80 @@ +package com.earth2me.essentials.storage; + +import java.util.Map.Entry; +import org.bukkit.enchantments.Enchantment; + + +public class EnchantmentLevel implements Entry<Enchantment, Integer> +{ + private Enchantment enchantment; + private int level; + + public EnchantmentLevel(final Enchantment enchantment, final int level) + { + this.enchantment = enchantment; + this.level = level; + } + + public Enchantment getEnchantment() + { + return enchantment; + } + + public void setEnchantment(final Enchantment enchantment) + { + this.enchantment = enchantment; + } + + public int getLevel() + { + return level; + } + + public void setLevel(final int level) + { + this.level = level; + } + + @Override + public Enchantment getKey() + { + return enchantment; + } + + @Override + public Integer getValue() + { + return level; + } + + @Override + public Integer setValue(final Integer v) + { + int t = level; + level = v; + return t; + } + + @Override + public int hashCode() + { + return enchantment.hashCode() ^ level; + } + + @Override + public boolean equals(final Object obj) + { + if (obj instanceof Entry) + { + final Entry entry = (Entry)obj; + if (entry.getKey() instanceof Enchantment + && entry.getValue() instanceof Integer) + { + final Enchantment enchantment = (Enchantment)entry.getKey(); + final Integer level = (Integer)entry.getValue(); + return this.enchantment.equals(enchantment) && this.level == level.intValue(); + } + } + return false; + } +} diff --git a/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java b/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java index 048abe737..48540483d 100644 --- a/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java +++ b/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java @@ -5,6 +5,7 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.Collection; import java.util.Collections; +import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import java.util.logging.Level; @@ -12,6 +13,7 @@ import java.util.logging.Logger; import java.util.regex.Pattern; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; import org.bukkit.material.MaterialData; import org.yaml.snakeyaml.Yaml; @@ -217,20 +219,23 @@ public class YamlStorageWriter implements IStorageWriter } else if (data instanceof Material) { - writer.println(data.toString().toLowerCase()); + writeMaterial(data); + writer.println(); } else if (data instanceof MaterialData) { - final MaterialData matData = (MaterialData)data; - writer.println(matData.getItemType().toString().toLowerCase() - + (matData.getData() > 0 ? ":" + matData.getData() : "")); + writeMaterialData(data); + writer.println(); } else if (data instanceof ItemStack) { - final ItemStack itemStack = (ItemStack)data; - writer.println(itemStack.getType().toString().toLowerCase() - + (itemStack.getDurability() > 0 ? ":" + itemStack.getDurability() : "") - + " " + itemStack.getAmount()); + writeItemStack(data); + writer.println(); + } + else if (data instanceof EnchantmentLevel) + { + writeEnchantmentLevel(data); + writer.println(); } else { @@ -256,13 +261,15 @@ public class YamlStorageWriter implements IStorageWriter } else if (data instanceof Material) { - writer.print(data.toString().toLowerCase()); + writeMaterial(data); } else if (data instanceof MaterialData) { - final MaterialData matData = (MaterialData)data; - writer.print(matData.getItemType().toString().toLowerCase() - + (matData.getData() > 0 ? ":" + matData.getData() : "")); + writeMaterialData(data); + } + else if (data instanceof EnchantmentLevel) + { + writeEnchantmentLevel(data); } else { @@ -270,6 +277,43 @@ public class YamlStorageWriter implements IStorageWriter } } + private void writeMaterial(final Object data) + { + writer.print(data.toString().toLowerCase(Locale.ENGLISH)); + } + + private void writeMaterialData(final Object data) + { + final MaterialData matData = (MaterialData)data; + writeMaterial(matData.getItemType()); + if (matData.getData() > 0) + { + writer.print(':'); + writer.print(matData.getData()); + } + } + + private void writeItemStack(final Object data) + { + final ItemStack itemStack = (ItemStack)data; + writeMaterialData(itemStack.getData()); + writer.print(' '); + writer.print(itemStack.getAmount()); + for (Entry<Enchantment, Integer> entry : itemStack.getEnchantments().entrySet()) + { + writer.print(' '); + writeEnchantmentLevel(entry); + } + } + + private void writeEnchantmentLevel(Object data) + { + final Entry<Enchantment, Integer> enchLevel = (Entry<Enchantment, Integer>)data; + writer.print(enchLevel.getKey().getName().toLowerCase(Locale.ENGLISH)); + writer.print(':'); + writer.print(enchLevel.getValue()); + } + private void writeLocation(final Location entry, final int depth) { writer.println(); diff --git a/Essentials/src/com/earth2me/essentials/textreader/TextPager.java b/Essentials/src/com/earth2me/essentials/textreader/TextPager.java index 06fd8763f..dd8422580 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/TextPager.java +++ b/Essentials/src/com/earth2me/essentials/textreader/TextPager.java @@ -10,17 +10,17 @@ import org.bukkit.command.CommandSender; public class TextPager { private final transient IText text; - private final transient boolean showHeader; + private final transient boolean onePage; public TextPager(final IText text) { - this(text, true); + this(text, false); } - public TextPager(final IText text, final boolean showHeader) + public TextPager(final IText text, final boolean onePage) { this.text = text; - this.showHeader = showHeader; + this.onePage = onePage; } public void showPage(final String pageStr, final String chapterPageStr, final CommandSender sender) @@ -40,17 +40,18 @@ public class TextPager { page = 1; } - if (page < 1) { + if (page < 1) + { page = 1; } - int start = (page - 1) * 9; - if (showHeader) + int start = onePage ? 0 : (page - 1) * 9; + if (!onePage) { int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0); sender.sendMessage(_("infoPages", page, pages)); } - for (int i = start; i < lines.size() && i < start + 9; i++) + for (int i = start; i < lines.size() && i < start + (onePage ? 20 : 9); i++) { sender.sendMessage(lines.get(i)); } @@ -61,7 +62,7 @@ public class TextPager { if (lines.get(0).startsWith("#")) { - if (!showHeader) + if (onePage) { return; } @@ -91,8 +92,12 @@ public class TextPager { page = 1; } + if (page < 1) + { + page = 1; + } - int start = (page - 1) * 9; + int start = onePage ? 0 : (page - 1) * 9; int end; for (end = 0; end < lines.size(); end++) { @@ -103,12 +108,12 @@ public class TextPager } } - if (showHeader) + if (!onePage) { int pages = end / 9 + (end % 9 > 0 ? 1 : 0); sender.sendMessage(_("infoPages", page, pages)); } - for (int i = start; i < end && i < start + 9; i++) + for (int i = start; i < end && i < start + (onePage ? 20 : 9); i++) { sender.sendMessage(lines.get(i)); } @@ -127,6 +132,10 @@ public class TextPager { chapterpage = 0; } + if (chapterpage < 0) + { + chapterpage = 0; + } } if (!bookmarks.containsKey(pageStr.toLowerCase(Locale.ENGLISH))) @@ -144,15 +153,15 @@ public class TextPager break; } } - final int start = chapterstart + chapterpage * 9; + final int start = chapterstart + (onePage ? 0 : chapterpage * 9); - if (showHeader) + if (!onePage) { final int page = chapterpage + 1; final int pages = (chapterend - chapterstart) / 9 + ((chapterend - chapterstart) % 9 > 0 ? 1 : 0); sender.sendMessage(_("infoChapterPages", pageStr, page, pages)); } - for (int i = start; i < chapterend && i < start + 9; i++) + for (int i = start; i < chapterend && i < start + (onePage ? 20 : 9); i++) { sender.sendMessage(lines.get(i)); } diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index b063d1e41..52c87bb4b 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -76,9 +76,6 @@ permission-based-item-spawn: false # HOWEVER, it is known to cause lag upon users logging OUT, so beware! reclaim-onlogout: false -# Should primitive spawn protection be enabled? For most servers, this should be flase; it is better to use a third-party plugin to protect it. -spawn-protection: false - # Mob limit on spawnmob spawnmob-limit: 10 @@ -229,21 +226,21 @@ freeze-afk-players: false # You can disable the death messages of minecraft here death-messages: true +# Add worlds to this list, if you want to automatically disable god mode there +no-god-in-worlds: +# - world_nether + ############################################################ # +------------------------------------------------------+ # # | EssentialsHome | # # +------------------------------------------------------+ # ############################################################ -# When users die, should they respawn at their homes, instead of the spawnpoint? +# When users die, should they respawn at their first home, instead of the spawnpoint or bed? respawn-at-home: false -# When a user interacts with a bed, should their home be set to that location? -# If you enable this and remove default user access to the /sethome command, you can make beds the only way for players to set their home location. -bed-sethome: false - -# If no home is set send you to spawn when /home is used -spawn-if-no-home: false +# If no home is set send you to bed or spawn when /home is used +spawn-if-no-home: true # Allow players to have multiple homes. # Define different amounts of multiple homes for different permissions, e.g. essentials.sethome.multiple.vip @@ -336,7 +333,7 @@ chat: protect: # Database settings for sign/rail protection # get mysql.jar and sqlite and place it in your serverroot/lib directory from here: - # http://java.net/projects/essentials/sources/svn/show/lib?rev=435 + # https://github.com/essentials/Essentials/blob/master/lib/mysql.jar # mysql, sqlite or none datatype: 'sqlite' diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index cfbf33f5b..6df02c655 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -68,6 +68,11 @@ downloadingGeoIp=Downloading GeoIP database ... this might take a while (country duplicatedUserdata=Duplicated userdata: {0} and {1} enableUnlimited=\u00a77Giving unlimited amount of {0} to {1}. enabled=enabled +enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. +enchantmentNotFound = \u00a7cEnchantment not found +enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item in hand. +enchantments = \u00a77Enchantments: {0} errorCallingCommand=Error calling command /{0} errorWithMessage=\u00a7cError: {0} essentialsReload=\u00a77Essentials Reloaded {0} @@ -153,6 +158,10 @@ kitTimed=\u00a7cYou can''t use that kit again for another {0}. kits=\u00a77Kits: {0} lightningSmited=\u00a77You have just been smited lightningUse=\u00a77Smiting {0} +listAfkTag = \u00a77[AFK]\u00a7f +listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online. +listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online. +listHiddenTag = \u00a77[HIDDEN]\u00a7f loadWarpError=Failed to load warp {0} loadinfo=Loaded {0} build {1} by: {2} localFormat=Local: <{0}> {1} @@ -196,6 +205,7 @@ nickSet=\u00a77Your nickname is now \u00a7c{0} noAccessCommand=\u00a7cYou do not have access to that command. noAccessPermission=\u00a7cYou do not have permission to access that {0}. noDestroyPermission=\u00a7cYou do not have permission to destroy that {0}. +noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. noHelpFound=\u00a7cNo matching commands. noHomeSet=You have not set a home. noHomeSetPlayer=Player has not set a home. @@ -216,6 +226,7 @@ notAllowedToShout=\u00a7cYou are not authorized to shout. notEnoughMoney=You do not have sufficient funds. notRecommendedBukkit=Bukkit version is not the recommended build for Essentials. notSupportedYet=Not supported yet. +nothingInHand = \u00a7cYou have nothing in your hand. now=now numberRequired=A number goes there, silly. onlyDayNight=/time only supports day/night. diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index 0650019ce..b3730d1d6 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -68,6 +68,11 @@ downloadingGeoIp=Downloader GeoIP database ... det her kan tage et stykke tid (l duplicatedUserdata=Duplikerede userdata: {0} og {1} enableUnlimited=\u00a77Giver ubegr\u00e6nset m\u00e6ngde af {0} til {1}. enabled=aktiveret +enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. +enchantmentNotFound = \u00a7cEnchantment not found +enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item in hand. +enchantments = \u00a77Enchantments: {0} errorCallingCommand=Fejl ved opkald af kommando /{0} errorWithMessage=\u00a7cFejl: {0} essentialsReload=\u00a77Essentials Genindl\u00e6st {0} @@ -153,6 +158,10 @@ kitTimed=\u00a7cDu kan ikke den pakke igen f\u00f8r om {0}. kits=\u00a77Pakker: {0} lightningSmited=\u00a77Du er blevet sl\u00e5et lightningUse=\u00a77Sl\u00e5r {0} +listAfkTag = \u00a77[AFK]\u00a7f +listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online. +listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online. +listHiddenTag = \u00a77[HIDDEN]\u00a7f loadWarpError=Kunne ikke indl\u00e6se warp {0} loadinfo=Indl\u00e6ste {0} byg {1} af {2} localFormat=Lokal: <{0}> {1} @@ -197,6 +206,7 @@ noAccessCommand=\u00a7cDu har ikke adgang til den kommando. noAccessPermission=\u00a7cDu har ikke tilladelse til at f\u00e5 adgang til det {0}. noDestroyPermission=\u00a7cDu har ikke tilladelse til at \u00f8del\u00e6gge det {0}. noHelpFound=\u00a7cNo matching commands. +noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. noHomeSet=Du har sat et nyt hjem. noHomeSetPlayer=Spiller har ikke sat et hjem. noKitPermission=\u00a7cDu har brug for \u00a7c{0}\u00a7c tilladelsen for at bruge den pakke. @@ -216,6 +226,7 @@ notAllowedToShout=\u00a7cDu er ikke autoriseret til at r\u00e5be. notEnoughMoney=Du har ikke tilstr\u00e6kkelig penge. notRecommendedBukkit=Bukkit version er ikke den anbefalede byg for Essentials. notSupportedYet=Ikke underst\u00f8ttet endnu. +nothingInHand = \u00a7cYou have nothing in your hand. now=nu numberRequired=Der skal v\u00e6re et nummer, fjolle. onlyDayNight=/time underst\u00f8tter kun day/night. diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 609618a68..bc3123d6c 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -68,6 +68,11 @@ downloadingGeoIp=Lade GeoIP-Datenbank ... dies kann etwas dauern (country: 0.6 M duplicatedUserdata=Doppelte Datei in userdata: {0} und {1} enableUnlimited=\u00a77Gebe {1} unendliche Mengen von {0}. enabled=aktiviert +enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. +enchantmentNotFound = \u00a7cEnchantment not found +enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item in hand. +enchantments = \u00a77Enchantments: {0} errorCallingCommand=Fehler beim Aufrufen des Befehls /{0} errorWithMessage=\u00a7cFehler: {0} essentialsReload=\u00a77Essentials neu geladen {0} @@ -153,6 +158,10 @@ kitTimed=\u00a7cDu kannst diese Ausr\u00fcstung nicht innerhalb von {0} anforder kits=\u00a77Ausr\u00fcstungen: {0} lightningSmited=\u00a77Du wurdest gepeinigt. lightningUse=\u00a77Peinige {0} +listAfkTag = \u00a77[Inaktiv]\u00a7f +listAmount = \u00a79Es sind \u00a7c{0}\u00a79 von maximal \u00a7c{1}\u00a79 Spielern online. +listAmountHidden = \u00a79Es sind \u00a7c{0}\u00a77/{1}\u00a79 von maximal \u00a7c{2}\u00a79 Spielern online. +listHiddenTag = \u00a77[Versteckt]\u00a7f loadWarpError=Fehler beim Laden von Warp-Punkt {0} loadinfo=Plugin {0} Version {1} geladen, erstellt von {2}, \u00fcbersetzt von snowleo localFormat=Lokal: <{0}> {1} @@ -196,6 +205,7 @@ nickSet=\u00a77Dein Nickname ist nun \u00a7c{0} noAccessCommand=\u00a7cDu hast keinen Zugriff auf diesen Befehl. noAccessPermission=\u00a7cDu hast keine Rechte, den Block {0} zu \u00f6ffnen. noDestroyPermission=\u00a7cDu hast keine Rechte, den Block {0} zu zerst\u00f6ren. +noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. noHelpFound=\u00a7cKeine \u00fcbereinstimmenden Kommandos. noHomeSet=Du hast kein Zuhause gesetzt. noHomeSetPlayer=Spieler hat kein Zuhause gesetzt. @@ -216,6 +226,7 @@ notAllowedToShout=\u00a7cDu bist nicht berechtigt zu schreien. notEnoughMoney=Du hast nicht genug Geld. notRecommendedBukkit=Die verwendete Bukkit-Version ist nicht f\u00fcr Essentials empfohlen. notSupportedYet=Noch nicht verf\u00fcgbar. +nothingInHand = \u00a7cYou have nothing in your hand. now=jetzt numberRequired=Ein Zahl wird ben\u00f6tigt. onlyDayNight=/time unterst\u00fctzt nur day und night. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index a78dfe94f..41c32506c 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -68,6 +68,11 @@ downloadingGeoIp=Downloading GeoIP database ... this might take a while (country duplicatedUserdata=Duplicated userdata: {0} and {1} enableUnlimited=\u00a77Giving unlimited amount of {0} to {1}. enabled=enabled +enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. +enchantmentNotFound = \u00a7cEnchantment not found +enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item in hand. +enchantments = \u00a77Enchantments: {0} errorCallingCommand=Error calling command /{0} errorWithMessage=\u00a7cError: {0} essentialsReload=\u00a77Essentials Reloaded {0} @@ -153,6 +158,10 @@ kitTimed=\u00a7cYou can''t use that kit again for another {0}. kits=\u00a77Kits: {0} lightningSmited=\u00a77You have just been smited lightningUse=\u00a77Smiting {0} +listAfkTag = \u00a77[AFK]\u00a7f +listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online. +listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online. +listHiddenTag = \u00a77[HIDDEN]\u00a7f loadWarpError=Failed to load warp {0} loadinfo=Loaded {0} build {1} by: {2} localFormat=Local: <{0}> {1} @@ -196,6 +205,7 @@ nickSet=\u00a77Your nickname is now \u00a7c{0} noAccessCommand=\u00a7cYou do not have access to that command. noAccessPermission=\u00a7cYou do not have permission to access that {0}. noDestroyPermission=\u00a7cYou do not have permission to destroy that {0}. +noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. noHelpFound=\u00a7cNo matching commands. noHomeSet=You have not set a home. noHomeSetPlayer=Player has not set a home. @@ -216,6 +226,7 @@ notAllowedToShout=\u00a7cYou are not authorized to shout. notEnoughMoney=You do not have sufficient funds. notRecommendedBukkit=Bukkit version is not the recommended build for Essentials. notSupportedYet=Not supported yet. +nothingInHand = \u00a7cYou have nothing in your hand. now=now numberRequired=A number goes there, silly. onlyDayNight=/time only supports day/night. diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index ae3156d86..eae6cf89b 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -68,6 +68,11 @@ downloadingGeoIp=Descargando base de datos de GeoIP ... puede llevar un tiempo ( duplicatedUserdata=Datos de usuario duplicados: {0} y {1} enableUnlimited=\u00a77Dando cantidad ilimitada de {0} a {1}. enabled=activado +enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. +enchantmentNotFound = \u00a7cEnchantment not found +enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item in hand. +enchantments = \u00a77Enchantments: {0} errorCallingCommand=Error al ejecutar el comando /{0} errorWithMessage=\u00a7cError: {0} essentialsReload=\u00a77Essentials Recargado {0} @@ -153,6 +158,10 @@ kitTimed=\u00a7c No puedes usar ese kit de nuevo para otro{0}. kits=\u00a77Kits: {0} lightningSmited=\u00a77Acabas de ser golpeado lightningUse=\u00a77Golpeando a {0} +listAfkTag = \u00a77[AFK]\u00a7f +listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online. +listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online. +listHiddenTag = \u00a77[HIDDEN]\u00a7f loadWarpError=Error al cargar el tenetransporte {0} loadinfo=Cargado {0}, construido {1} por: {2} localFormat=Local: <{0}> {1} @@ -196,6 +205,7 @@ nickSet=\u00a77Tu nombre es ahora \u00a7c{0} noAccessCommand=\u00a7cNo tienes acceso a ese comando. noAccessPermission=\u00a7cNo tienes permisos para hacer eso {0}. noDestroyPermission=\u00a7cNo tienes permisos para destrozar eso {0}. +noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. noHelpFound=\u00a7cNo hay comandos relacionados. noHomeSet=No has establecido un hogar. noHomeSetPlayer=El jugador no ha establecido un hogar. @@ -216,6 +226,7 @@ notAllowedToShout=\u00a7cNo estas autorizado para gritar. notEnoughMoney=No tienes el dinero suficiente. notRecommendedBukkit=La version de bukkit no es la recomendada para esta version de Essentials. notSupportedYet=No esta soportado aun. +nothingInHand = \u00a7cYou have nothing in your hand. now=ahora numberRequired=Un numero es necesario, amigo. onlyDayNight=/time solo soporta day/night. (dia/noche) diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index df51d80d3..207b84541 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -3,21 +3,21 @@ # Translations start here # by: action=* {0} {1} -addedToAccount=\u00a7a{0} a \u00e9t\u00e9 rajout\u00e9 a votre compte. +addedToAccount=\u00a7a{0} a \u00e9t\u00e9 rajout\u00e9 \u00e0 votre compte. addedToOthersAccount=\u00a7a{0} a \u00e9t\u00e9 ajout\u00e9 \u00e0 {1} compte. -alertBroke=a cass\u00e9: +alertBroke=a cass\u00e9 : alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} \u00e0:{3} -alertPlaced=a plac\u00e9: -alertUsed=a utilis\u00e9: -autoAfkKickReason=You have been kicked for idling more than {0} minutes. +alertPlaced=a plac\u00e9 : +alertUsed=a utilis\u00e9 : +autoAfkKickReason=Vous avez \u00e9t\u00e9 \u00e9ject\u00e9 pour inactivit\u00e9e sup\u00e9rieure \u00e0 {0} minutes. backAfterDeath=\u00a77Utilisez la commande /back pour retourner \u00e0 l''endroit ou vous \u00eates mort. -backUsageMsg=\u00a77Retour a votre emplacement pr\u00e9c\u00e8dent. -backupFinished=Backup termin\u00e9 -backupStarted=D\u00e9but du backup -balance=\u00a77Solde: {0} -balanceTop=\u00a77 Top {0} soldes -banExempt=\u00a77Vous ne pouvez pas interdire ce joueur. -banIpAddress=\u00a77Adresse IP banni +backUsageMsg=\u00a77Retour \u00e0 votre emplacement pr\u00e9c\u00c3\u00a8dent. +backupFinished=Sauvegarde termin\u00e9 +backupStarted=D\u00e9but de la sauvegarde +balance=\u00a77Solde : {0} +balanceTop=\u00a77 Meilleurs {0} soldes +banExempt=\u00a77Vous ne pouvez pas bannir ce joueur. +banIpAddress=\u00a77Adresse IP bannie bannedIpsFileError=Erreur de lecture de banned-ips.txt bannedIpsFileNotFound=Fichier banned-ips.txt introuvable bannedPlayersFileError=Erreur lors de la lecture de banned-players.txt @@ -30,32 +30,32 @@ bukkitFormatChanged=Le format de la version de Bukkit a \u00e9t\u00e9 chang\u00e burnMsg=\u00a77Vous avez enflamm\u00e9 {0} pour {1} seconde(s). canTalkAgain=\u00a77Vous pouvez de nouveau parler. cantFindGeoIpDB=N''arrive pas \u00e0 trouver la base de donn\u00e9es GeoIP! -cantReadGeoIpDB=Echec de la lecture de la base de donn\u00e9s GeoIP! -cantSpawnItem=\u00a7cVous n''avez pas le droit de faire apparaitre {0} -commandFailed=\u00c9chec de la commande {0}: -commandHelpFailedForPlugin=Erreur d'obtention d'aider \u00e0: {0} +cantReadGeoIpDB=Echec de la lecture de la base de donn\u00e9es GeoIP! +cantSpawnItem=\u00a7cVous n''avez pas le droit de faire appara\u00c3\u00aetre {0} +commandFailed=\u00c9chec de la commande {0} : +commandHelpFailedForPlugin=Erreur d''obtention d''aide pour : {0} commandNotLoaded=\u00a7cLa commande {0} a \u00e9t\u00e9 mal charg\u00e9e. -compassBearing=\u00a77Orientation: {0} ({1} degr\u00e9s). -configFileMoveError=\u00c9chec du d\u00e9placement de config.yml vers l''emplacement de backup. -configFileRenameError=\u00c9chec du changement de nom du fichier temp de config.yml -connectedPlayers=Joueurs connect\u00e9s: +compassBearing=\u00a77Orientation : {0} ({1} degr\u00e9s). +configFileMoveError=\u00c9chec du d\u00e9placement de config.yml vers l''emplacement de sauvegarde. +configFileRenameError=\u00c9chec du changement de nom du fichier temporaire de config.yml +connectedPlayers=Joueurs connect\u00e9s : connectionFailed=\u00c9chec de l''ouverture de la connexion. -cooldownWithMessage=\u00a7cRefroidissement: {0} -corruptNodeInConfig=\u00a74Annonce: Votre fichier de configuration a un {0} n\u0153ud corrompu. -couldNotFindTemplate=Le mod\u00e8le {0} est introuvable -creatingConfigFromTemplate=Cr\u00e9ation de la configuration \u00e0 partir du mod\u00e8le : {0} +cooldownWithMessage=\u00a7cR\u00e9utilisation : {0} +corruptNodeInConfig=\u00a74Annonce : Votre fichier de configuration a un {0} n\u0153ud corrompu. +couldNotFindTemplate=Le mod\u00c3\u00a8le {0} est introuvable +creatingConfigFromTemplate=Cr\u00e9ation de la configuration \u00e0 partir du mod\u00c3\u00a8le : {0} creatingEmptyConfig=Cr\u00e9ation d''une configuration vierge : {0} -creative=creative +creative=cr\u00e9atif day=jour days=jours -defaultBanReason=Le marteau du ban a frapp\u00e9! -deleteFileError=Le fichier n''a pas pu \u00eatre supprim\u00e9: {0} -deleteHome=\u00a77Home {0} has been removed. +defaultBanReason=Le marteau du bannissement a frapp\u00e9 ! +deleteFileError=Le fichier {0} n''a pas pu \u00eatre supprim\u00e9 +deleteHome=\u00a77La r\u00e9sidence {0} a \u00e9t\u00e9 supprim\u00e9e. deleteJail=\u00a77La prison {0} a \u00e9t\u00e9 supprim\u00e9e. deleteWarp=\u00a77Warp {0} supprim\u00e9. -deniedAccessCommand=L''acc\u00e8s \u00e0 la commande a \u00e9t\u00e9 refus\u00e9 pour {0}. +deniedAccessCommand=L''acc\u00c3\u00a8s \u00e0 la commande a \u00e9t\u00e9 refus\u00e9 pour {0}. dependancyDownloaded=[Essentials] Fichier {0} correctement t\u00e9l\u00e9charg\u00e9. -dependancyException=[Essentials] Une erreur est survenue lors de la tentative de t\u00e9l\u00e9chargement +dependancyException=[Essentials] Une erreur est survenue lors de la tentative de t\u00e9l\u00e9chargement. dependancyNotFound=[Essentials] Une d\u00e9pendance requise n''a pas \u00e9t\u00e9 trouv\u00e9e, t\u00e9l\u00e9chargement en cours. depth=\u00a77Vous \u00eates au niveau de la mer. depthAboveSea=\u00a77Vous \u00eates \u00e0 {0} bloc(s) au-dessus du niveau de la mer. @@ -64,49 +64,54 @@ destinationNotSet=Destination non d\u00e9finie disableUnlimited=\u00a77D\u00e9sactivation du placement illimit\u00e9 de {0} pour {1}. disabled=d\u00e9sactiv\u00e9 dontMoveMessage=\u00a77La t\u00e9l\u00e9portation commence dans {0}. Ne bougez pas. -downloadingGeoIp=T\u00e9l\u00e9chargement de la base de donn\u00e9es GeoIP ... cela peut prendre un moment (campagne : 0.6 Mo, ville : 20Mo) -duplicatedUserdata=Donn\u00e9e utilisateur dupliqu\u00e9e: {0} et {1} -enableUnlimited=\u00a77Donner un nombre illimit\u00e9 de {0} \u00e0 {1}. +downloadingGeoIp=T\u00e9l\u00e9chargement de la base de donn\u00e9es GeoIP ... Cela peut prendre un moment (campagne : 0.6 Mo, ville : 20Mo) +duplicatedUserdata=Donn\u00e9e utilisateur dupliqu\u00e9e : {0} et {1} +enableUnlimited=\u00a77Quantit\u00e9 illimit\u00e9e de {0} \u00e0 {1}. enabled=activ\u00e9 +enchantmentApplied = \u00a77L''enchantement {0} a \u00e9t\u00e9 appliqu\u00e9 \u00e0 l''objet dans votre main. +enchantmentNotFound = \u00a7cEnchantement non-trouv\u00e9 +enchantmentPerm = \u00a7cVous n''avez pas les droits pour {0}. +enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item in hand. +enchantments = \u00a77Enchantments : {0} errorCallingCommand=Erreur en appelant la commande /{0} -errorWithMessage=\u00a7cErreur: {0} +errorWithMessage=\u00a7cErreur : {0} essentialsReload=\u00a77Essentials Recharg\u00e9 {0} -extinguish=\u00a77Vous vous \u00eates \u00e9teint. -extinguishOthers=\u00a77Vous avez \u00e9teint {0}. +extinguish=\u00a77Vous cessez de br\u00fbler. +extinguishOthers=\u00a77Vous avez \u00e9teint la combustion de {0}. failedToCloseConfig=Echec de la fermeture de la configuration {0} failedToCreateConfig=Echec de la cr\u00e9ation de la configuration {0} failedToWriteConfig=\u00c9chec de l''\u00e9criture de la configuration {0} -false=false -fileRenameError=Echec du changement de nom de {0}. -foreverAlone=\u00a7cVous n''avez personne \u00e0 qui r\u00e9pondre. +false=faux +fileRenameError=Echec du changement de nom de {0} +foreverAlone=\u00a7cVous n''avez personne \u00e0 qui r\u00e9pondre freedMemory=A lib\u00e9r\u00e9 {0} Mo. -gameMode=\u00a77Set game mode {0} for {1}. -gcchunks=chunks, +gameMode=\u00a77Mode de jeu {0} pour {1}. +gcchunks=portions, gcentities=entit\u00e9s -gcfree=Free memory: {0} Mo -gcmax=M\u00e9moire maximale: {0} Mo -gctotal=Allocated memory: {0} Mo -geoIpUrlEmpty=L''url de t\u00e9l\u00e9chargement de GeoIP est vide. -geoIpUrlInvalid=L''url de t\u00e9l\u00e9chargement de GeoIP est invalide. +gcfree=M\u00e9moire libre : {0} Mo +gcmax=M\u00e9moire maximale : {0} Mo +gctotal=M\u00e9moire utilis\u00e9e : {0} Mo +geoIpUrlEmpty=L''URL de t\u00e9l\u00e9chargement de GeoIP est vide. +geoIpUrlInvalid=L''URL de t\u00e9l\u00e9chargement de GeoIP est invalide. geoipJoinFormat=Joueur {0} vient de {1} -godDisabledFor=d\u00e9sactive pour {0} +godDisabledFor=d\u00e9sactiv\u00e9 pour {0} godEnabledFor=activ\u00e9 pour {0} godMode=\u00a77Mode Dieu {0}. -haveBeenReleased=\u00a77Vous avez \u00e9t\u00e9 lib\u00e9r\u00e9 +haveBeenReleased=\u00a77Vous avez \u00e9t\u00e9 lib\u00e9r\u00e9. heal=\u00a77Vous avez \u00e9t\u00e9 soign\u00e9. healOther=\u00a77{0} a \u00e9t\u00e9 soign\u00e9. helpConsole=Pour voir l''aide tapez ? helpOp=\u00a7c[Aide Admin]\u00a7f \u00a77{0}:\u00a7f {1} helpPages=Page \u00a7c{0}\u00a7f sur \u00a7c{1}\u00a7f. holeInFloor=Trou dans le Sol. -homeSet=\u00a77Home d\u00e9fini. -homeSetToBed=\u00a77Votre home est d\u00e9sormais d\u00e9fini sur ce lit. -homes=Homes: {0} +homeSet=\u00a77R\u00e9sidence d\u00e9finie. +homeSetToBed=\u00a77Votre r\u00e9sidence est d\u00e9sormais li\u00e9e \u00e0 ce lit. +homes=R\u00e9sidences : {0} hour=heure hours=heures ignorePlayer=Vous ignorez d\u00e9sormais {0}. illegalDate=Format de date ill\u00e9gal. -infoChapter=S\u00e9lectionner le chapitre : +infoChapter=S\u00e9lectionnez le chapitre : infoChapterPages=Chapitre {0}, page \u00a7c{1}\u00a7f sur \u00a7c{2}\u00a7f: infoFileDoesNotExist=Le fichier info.txt n''existe pas. Le fichier est en cours de cr\u00e9ation pour vous. infoPages=Page \u00a7c{0}\u00a7f de \u00a7c{1}\u00a7f. @@ -115,7 +120,7 @@ invBigger=Les inventaires des autres joueurs sont plus gros que le v\u00f4tre. invRestored=Votre inventaire vous a \u00e9t\u00e9 rendu. invSee=Vous voyez l''inventaire de {0}. invSeeHelp=Utilisez /invsee pour voir l''inventaire de quelqu''un. -invalidCharge=\u00a7cInvalide charge. +invalidCharge=\u00a7cCharge invalide. invalidMob=Mauvias type de monstre. invalidServer=Serveur non valide. invalidSignLine=La ligne {0} du panneau est invalide. @@ -128,17 +133,17 @@ itemMustBeStacked=Cet objet doit \u00eatre vendu par 64. Une quantit\u00e9 de 2 itemNotEnough1=\u00a7cVous n''avez pas assez de cet objet pour le vendre. itemNotEnough2=\u00a77Si vous voulez vendre l''int\u00e9gralit\u00e9 de vos objets de ce type l\u00e0, utilisez /sell nomObjet itemNotEnough3=\u00a77/sell nomObjet -1 vendra tout sauf un objet, etc. -itemSellAir=Vous vouliez vraiment vendre de l''air? Mettez un objet dans votre main. +itemSellAir=Vouliez-vous vraiment vendre de l''air ? Mettez un objet dans votre main. itemSold=\u00a77Vendu pour \u00a7c{0} \u00a77({1} {2} \u00e0 {3} chacun) itemSoldConsole={0} vendu {1} pour \u00a77{2} \u00a77({3} objet(s) \u00e0 {4} chacun) itemSpawn=\u00a77Donne {0} de {1} itemsCsvNotLoaded=N''a pas pu charger items.csv. -jailAlreadyIncarcerated=\u00a7cPerson is already in jail: {0} +jailAlreadyIncarcerated=\u00a7cJoueur d\u00e9j\u00e0 emprisonn\u00e9 : {0} jailMessage=\u00a7cVous avez commis un crime, vous en payez le prix. jailNotExist=Cette prison n''existe pas. -jailReleased=\u00a77Player \u00a7e{0}\u00a77 unjailed. -jailReleasedPlayerNotify=\u00a77You have been released! -jailSentenceExtended=Jail time extend to: {0) +jailReleased=\u00a77Joueur \u00a7e{0}\u00a77 lib\u00e9r\u00e9. +jailReleasedPlayerNotify=\u00a77Vous avez \u00e9t\u00e9 lib\u00e9r\u00e9 ! +jailSentenceExtended=Dur\u00e9e d''emprisonnement rallong\u00e9e de : {0) jailSet=\u00a77La prison {0} a \u00e9t\u00e9 cr\u00e9\u00e9. jumpError=\u00c7a aurait pu faire mal au cerveau de votre ordinateur. kickDefault=Kick\u00e9 du serveur @@ -146,33 +151,37 @@ kickExempt=\u00a77Vous ne pouvez pas lancer ce joueur. kill=\u00a77Tu\u00e9 {0}. kitError=\u00a7cIl n''y a pas de kits valides. kitError2=\u00a7cCe kit n''existe pas ou a \u00e9t\u00e9 mal d\u00e9fini. -kitErrorHelp=\u00a7cPeut-\u00eatre qu''un objet manque d''une quantit\u00e9 dans la configuration? +kitErrorHelp=\u00a7cPeut-\u00eatre qu''un objet manque d''une quantit\u00e9 dans la configuration ? kitGive=\u00a77Donner le kit {0}. -kitInvFull=\u00a7cVotre inventaire \u00e9tait plein, le kit est Parre-terre. +kitInvFull=\u00a7cVotre inventaire \u00e9tait plein, le kit est parre-terre. kitTimed=\u00a7cVous ne pouvez pas utiliser ce kit pendant encore {0}. -kits=\u00a77Kits:{0} -lightningSmited=\u00a77Vous venez d''\u00eatre foudroy\u00e9 -lightningUse=\u00a77{0} a \u00e9t\u00e9 foudroy\u00e9 -loadWarpError=\u00c9chec du chargement du warp {0} +kits=\u00a77Kits :{0} +lightningSmited=\u00a77Vous venez d''\u00eatre foudroy\u00e9. +lightningUse=\u00a77{0} a \u00e9t\u00e9 foudroy\u00e9. +listAfkTag = \u00a77[AFK]\u00a7f +listAmount = \u00a79Il y a \u00a7c{0}\u00a79 joueurs en ligne sur \u00a7c{1}\u00a79 au total. +listAmountHidden = \u00a79Il y a \u00a7c{0}\u00a77/{1}\u00a79 sur un maximum de \u00a7c{2}\u00a79 joueurs en ligne. +listHiddenTag = \u00a77[MASQU\u00c9]\u00a7f +loadWarpError=\u00c9chec du chargement du raccourci {0} loadinfo={0} version {1} par {2} a \u00e9t\u00e9 charg\u00e9 -localFormat=Local:<{0}> {1} +localFormat=Locale :<{0}> {1} mailClear=\u00a7cPour marquer votre courrier en tant que lu, entrez /mail clear -mailCleared=\u00a77Mail supprim\u00e9 ! +mailCleared=\u00a77Courrier supprim\u00e9 ! mailSent=\u00a77Courrier envoy\u00e9 ! markMailAsRead=\u00a7cPour marquer votre courrier en tant que lu, entrez /mail clear markedAsAway=\u00a77Vous \u00eates d\u00e9sormais AFK. markedAsNotAway=\u00a77Vous n''\u00eates d\u00e9sormais plus AFK. -maxHomes=You cannot set more than {0} homes. +maxHomes=Vous ne pouvez pas cr\u00e9er plus de {0} r\u00e9sidences. mayNotJail=\u00a7cVous ne pouvez pas emprisonner cette personne. me=moi minute=minute minutes=minutes missingItems=Vous n''avez pas {0} x {1}. missingPrefixSuffix=Pr\u00e9fixe ou Suffixe manquant pour {0} -mobSpawnError=Erreur lors du changement du spawner de monstres. -mobSpawnLimit=Quantit\u00e9 de monstres limit\u00e9 \u00e0 la limite du serveur. -mobSpawnTarget=Le bloc cible doit \u00eatre un spawner de monstres. -mobsAvailable=\u00a77Mobs: {0} +mobSpawnError=Erreur lors du changement du g\u00e9n\u00e9rateur de monstres. +mobSpawnLimit=Quantit\u00e9 de monstres limit\u00e9 \u00e0 au maximum du serveur. +mobSpawnTarget=Le bloc cible doit \u00eatre un g\u00e9n\u00e9rateur de monstres. +mobsAvailable=\u00a77Monstres : {0} moneyRecievedFrom=\u00a7a{0} a \u00e9t\u00e9 re\u00e7u de {1} moneySentTo=\u00a7a{0} a \u00e9t\u00e9 envoy\u00e9 \u00e0 {1} moneyTaken={0} pr\u00e9lev\u00e9(s) de votre compte bancaire. @@ -180,25 +189,26 @@ month=mois months=mois moreThanZero=Les Quantit\u00e9s doivent \u00eatre sup\u00e9rieures \u00e0 z\u00e9ro. msgFormat=\u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} -muteExempt=\u00a7cYou may not mute that player. +muteExempt=\u00a7cVous ne pouvez pas r\u00e9duire ce joueur au silence. mutedPlayer=Le joueur {0} est d\u00e9sormais muet. -mutedPlayerFor={0} a \u00e9t\u00e9 mute pour {1}. +mutedPlayerFor={0} a \u00e9t\u00e9 muet pour {1}. mutedUserSpeaks={0} a essay\u00e9 de parler mais est muet. -needTpohere=Vous avez besoin de l''acc\u00e8s \u00e0 /tpohere pour t\u00e9l\u00e9porter d''autres joueurs. +needTpohere=Vous avez besoin de l''acc\u00c3\u00a8s \u00e0 /tpohere pour t\u00e9l\u00e9porter d''autres joueurs. negativeBalanceError=L''utilisateur n''est pas autoris\u00e9 \u00e0 avoir un solde n\u00e9gatif. -nickChanged=Pseudo modifi\u00e9. -nickDisplayName=\u00a77You have to enable change-displayname in Essentials config. +nickChanged=surnom modifi\u00e9. +nickDisplayName=\u00a77Vous devez activer change-displayname dans la configuration Essentials. nickInUse=\u00a7cCe nom est d\u00e9j\u00e0 utilis\u00e9. -nickNamesAlpha=\u00a7cLes pseudos doivent \u00eatre alphanum\u00e9riques. +nickNamesAlpha=\u00a7cLes surnoms doivent \u00eatre alphanum\u00e9riques. nickNoMore=\u00a7Vous n''avez plus de surnom. -nickOthersPermission=\u00a7cVous n''avez pas la permission de changer le pseudo des autres. -nickSet=\u00a77Votre pseudo est maintenant \u00a7c{0} -noAccessCommand=\u00a7cVous n''avez pas acc\u00e8s \u00e0 cette commande. +nickOthersPermission=\u00a7cVous n''avez pas la permission de changer le surnom des autres. +nickSet=\u00a77Votre surnom est maintenant \u00a7c{0} +noAccessCommand=\u00a7cVous n''avez pas acc\u00c3\u00a8s \u00e0 cette commande. noAccessPermission=\u00a7cVous n''avez pas la permissions d''acc\u00e9der \u00e0 cette {0} noDestroyPermission=\u00a7cVous n''avez pas la permission de d\u00e9truire ce {0}. -noHelpFound=\u00a7cNo matching commands. -noHomeSet=Vous n''avez pas d\u00e9fini de home. -noHomeSetPlayer=Le joueur n''a pas d\u00e9fini son home. +noGodWorldWarning=\u00a7cWarning! Le mode Dieu est d\u00e9sactiv\u00e9 dans ce monde. +noHelpFound=\u00a7cAucune commande correspondante. +noHomeSet=Vous n''avez pas d\u00e9fini de r\u00e9sidence. +noHomeSetPlayer=Le joueur n''a pas d\u00e9fini sa r\u00e9sidence. noKitPermission=\u00a7cVous avez besoin de la permission \u00a7c{0}\u00a7c pour utiliser ce kit. noKits=\u00a77Il n''y a pas encore de kits disponibles. noMail=Vous n''avez pas de courrier @@ -206,66 +216,67 @@ noMailSendPerm=\u00a7cVous n''avez pas la permission \u00a7fessentials.mail.send noMotd=\u00a7cIl n''y a pas de message su jour. noNewMail=\u00a77Vous n''avez pas de courrier. noPendingRequest=Vous n''avez pas de requ\u00eate non lue. -noPlacePermission=\u00a7cYou do not have permission to place a block near that sign. -noPowerTools=You have no power tools assigned. -noRules=\u00a7cIl n''y a pas encore de r\u00e8gles d\u00e9finies. -noWarpsDefined=Aucun warps d\u00e9finis. +noPlacePermission=\u00a7cVous n''avez pas la permission de placer un bloc pr\u00c3\u00a8 de cette pancarte. +noPowerTools=Vous n''avez pas d''outil automatique associ\u00e9. +noRules=\u00a7cIl n''y a pas encore de r\u00c3\u00a8gles d\u00e9finies. +noWarpsDefined=Aucun raccourci d\u00e9fini. none=aucun notAllowedToQuestion=\u00a7cVous n''\u00eates pas autoris\u00e9 \u00e0 poser des questions. notAllowedToShout=\u00a7cVous n''\u00eates pas autoris\u00e9 \u00e0 crier. notEnoughMoney=Vous n''avez pas les fonds n\u00e9cessaires. notRecommendedBukkit=La version de Bukkit n''est pas celle qui est recommand\u00e9 pour cette version de Essentials. notSupportedYet=Pas encore pris en charge. +nothingInHand = \u00a7cVous n''avez rien en main. now=maintenant -numberRequired=On a besoin d''un nombre ici, idiot. +numberRequired=Il faut fournir un nombre ici. onlyDayNight=/time ne supporte que (jour) day/night (nuit). onlyPlayers=Seulement les joueurs en jeu peuvent utiliser {0}. -onlySunStorm=/weather only supports sun/storm. -pTimeCurrent=\u00a7e{0}''s\u00a7f time is {1}. -pTimeCurrentFixed=\u00a7e{0}''s\u00a7f time is fixed to {1}. -pTimeNormal=\u00a7e{0}''s\u00a7f time is normal and matches the server. -pTimeOthersPermission=\u00a7cYou are not authorized to set other players'' time. -pTimePlayers=These players have their own time: -pTimeReset=Player time has been reset for: \u00a7e{0} -pTimeSet=Player time is set to \u00a73{0}\u00a7f for: \u00a7e{1} -pTimeSetFixed=Player time is fixed to \u00a73{0}\u00a7f for: \u00a7e{1} +onlySunStorm=/weather ne supporte que (soleil) sun/storm (temp\u00eate). +pTimeCurrent=\u00a7e{0}''s\u00a7f l''heure est {1}. +pTimeCurrentFixed=\u00a7e{0}''s\u00a7f l''heure est fix\u00e9e \u00e0 {1}. +pTimeNormal=\u00a7e{0}''s\u00a7f l''heure est normale et correspond au server. +pTimeOthersPermission=\u00a7cVous n''etes pas autoris\u00e9 \u00e0 changer l''heure des autres joueurs. +pTimePlayers=Ces joueurs ont leur propre horraire : +pTimeReset=l''heure a \u00e9t\u00e9 r\u00e9initialis\u00e9e \u00e0 : \u00a7e{0} +pTimeSet=l''heure du joueur a \u00e9t\u00e9 r\u00e9egl\u00e9ee \u00e0 \u00a73{0}\u00a7f pour : \u00a7e{1} +pTimeSetFixed=l''heure du joueur a \u00e9t\u00e9 fix\u00e9e \u00e0 : \u00a7e{1} parseError=Erreur de conversion {0} \u00e0 la ligne {1} pendingTeleportCancelled=\u00a7cRequete de t\u00e9l\u00e9portation annul\u00e9e. permissionsError=Permissions/GroupManager manquant, les pr\u00e9fixes et suffixes ne seront pas affich\u00e9s. -playerBanned=\u00a7cPlayer {0} banned {1} for {2} +playerBanned=\u00a7cJoueur {0} banni {1} pour {2} playerInJail=\u00a7cLe joueur est d\u00e9j\u00e0 dans la prison {0}. playerJailed=\u00a77Le joueur {0} a \u00e9t\u00e9 emprisonn\u00e9. playerJailedFor=\u00a77{0} a \u00e9t\u00e9 emprisonn\u00e9 pour {1}. playerKicked=\u00a7cPlayer {0} kicked {1} for {2} -playerMuted=\u00a77You have been muted -playerMutedFor=\u00a77You have been muted for {0} +playerMuted=\u00a77Vous avez \u00e9t\u00e9 r\u00e9duis au silence. +playerMutedFor=\u00a77Vous avez \u00e9t\u00e9 r\u00e9duis au silence pour {0} playerNeverOnServer=\u00a7cLe joueur {0} n''a jamais \u00e9t\u00e9 sur le serveur. playerNotFound=\u00a7cLe joueur est introuvable. -playerUnmuted=\u00a77You have been unmuted -pong=Pong! -possibleWorlds=\u00a77Les mondes possibles sont les nombres 0 par {0}. -powerToolAir=La commande ne peut pas \u00eatre attach\u00e9e \u00e0 l''air. -powerToolAlreadySet=Command \u00a7c{0}\u00a7f is already assigned to {1}. -powerToolAttach=\u00a7c{0}\u00a7f command assigned to {1}. -powerToolClearAll=All powertool commands have been cleared. -powerToolList={1} has the following commands: \u00a7c{0}\u00a7f. -powerToolListEmpty={0} has no commands assigned. -powerToolNoSuchCommandAssigned=Command \u00a7c{0}\u00a7f has not been assigned to {1}. -powerToolRemove=Command \u00a7c{0}\u00a7f removed from {1}. -powerToolRemoveAll=All commands removed from {0}. -powerToolsDisabled=All of your power tools have been disabled. -powerToolsEnabled=All of your power tools have been enabled. +playerUnmuted=\u00a77Vous avez de nouveau la parole. +pong=Pong ! +possibleWorlds=\u00a77Les mondes possibles sont les nombres de 0 \u00e0 {0}. +powerToolAir=La commande ne peut pas \u00eatre assign\u00e9e \u00e0 l''air. +powerToolAlreadySet=La commande \u00a7c{0}\u00a7f est d\u00e9j\u00e0 assign\u00e9e \u00e0 {1}. +powerToolAttach=Commande \u00a7c{0}\u00a7f assign\u00e9e \u00e0 {1}. +powerToolClearAll=Toutes les commandes assign\u00e9es ont \u00e9et\u00e9e retir\u00e9ees. +powerToolList={1} assign\u00e9s aux commandes : \u00a7c{0}\u00a7f. +powerToolListEmpty={0} n''a pas de commande assign\u00e9e. +powerToolNoSuchCommandAssigned=La commande \u00a7c{0}\u00a7f n''a pas \u00e9t\u00e9 assign\u00e9e \u00e0 {1}. +powerToolRemove=Command \u00a7c{0}\u00a7f retir\u00e9e de {1}. +powerToolRemoveAll=Toutes les commandes retir\u00e9es de {0}. +powerToolsDisabled=Toutes vos commandes assign\u00e9es ont \u00e9t\u00e9 retir\u00e9es. +powerToolsEnabled=Toutes vos commandes assign\u00e9es ont \u00e9t\u00e9 activ\u00e9es. protectionOwner=\u00a76[EssentialsProtect] Propri\u00e9taire de la protection : {0} questionFormat=\u00a77[Question]\u00a7f {0} -reloadAllPlugins=\u00a77Tous les plugins ont \u00e9t\u00e9 recharg\u00e9s. -repair=You have successfully repaired your: \u00a7e{0}. -repairAlreadyFixed=\u00a77This item does not need repairing. -repairInvalidType=\u00a7cThis item cannot be repaired. -repairNone=There were no items that needing repairing. +reloadAllPlugins=\u00a77Toutes les extensions ont \u00e9t\u00e9 recharg\u00e9es. +repair=Vous avez r\u00e9par\u00e9 votre : \u00a7e{0}. +repairAlreadyFixed=\u00a77Cet objet n''a pas besoin de r\u00e9paration. +repairInvalidType=\u00a7cCet objet ne peut \u00eatre r\u00e9par\u00e9. +repairNone=Aucun objet n''a besoin d''\u00eatre r\u00e9par\u00e9. requestAccepted=\u00a77Demande de t\u00e9l\u00e9portation accept\u00e9e. -requestAcceptedFrom=\u00a77{0} accepted your teleport request. +requestAcceptedFrom=\u00a77{0} a accept\u00e9 votre demande de t\u00e9l\u00e9portation. requestDenied=\u00a77Demande de t\u00e9l\u00e9portation refus\u00e9e. -requestDeniedFrom=\u00a77{0} denied your teleport request. +requestDeniedFrom=\u00a77{0} a refus\u00e9 votre demande de t\u00e9l\u00e9portation. requestSent=\u00a77Requ\u00eate envoy\u00e9e \u00e0 {0}\u00a77. returnPlayerToJailError=Erreur survenue lors de la tentative d''emprisonner de nouveau un joueur. second=seconde @@ -273,59 +284,59 @@ seconds=secondes seenOffline=Le joueur {0} est hors ligne depuis {1} seenOnline=Le joueur {0} est en ligne depuis {1} serverFull=Le serveur est plein. -setSpawner=Changed spawner type to {0} +setSpawner=Type de g\u00e9n\u00e9rateur chang\u00e9 en {0} sheepMalformedColor=Couleur mal form\u00e9e. shoutFormat=\u00a77[Crie]\u00a7f {0} signFormatFail=\u00a74[{0}] signFormatSuccess=\u00a71[{0}] signFormatTemplate=[{0}] -signProtectInvalidLocation=\u00a74You are not allowed to create sign here. -similarWarpExist=Un warp avec un nom similaire existe d\u00e9j\u00e0. +signProtectInvalidLocation=\u00a74Vous n''avez pas l''autorisation de cr\u00e9er une pancarte ici. +similarWarpExist=Un raccourci avec un nom similaire existe d\u00e9j\u00e0. slimeMalformedSize=Taille mal form\u00e9e. soloMob=Ce monstre aime \u00eatre seul. spawnSet=\u00a77Le point de spawn a \u00e9t\u00e9 d\u00e9fini pour le groupe {0}. -spawned=spawn\u00e9 +spawned=invoqu\u00e9(s) suicideMessage=\u00a77Au revoir monde cruel... -suicideSuccess=\u00a77{0} a pris sa propre vie. -survival=survival -takenFromAccount=\u00a7c{0} ont \u00e9t\u00e9 pris de votre compte. -takenFromOthersAccount=\u00a7c{0} a \u00e9t\u00e9 prise de {1} compte. -teleportAAll=\u00a77Teleporting request sent to all players... +suicideSuccess=\u00a77{0} s''est suiscid\u00e9. +survival=survie +takenFromAccount=\u00a7c{0} ont \u00e9t\u00e9 retir\u00e9 de votre compte. +takenFromOthersAccount=\u00a7c{0} a \u00e9t\u00e9 r\u00e9tir\u00e9 du compte de {1}. +teleportAAll=\u00a77Demande de t\u00e9l\u00e9portation envoy\u00e9e \u00e0 tous les joueurs... teleportAll=\u00a77T\u00e9l\u00e9poration de tous les joueurs. teleportAtoB=\u00a77{0}\u00a77 vous a t\u00e9l\u00e9port\u00e9 \u00e0 {1}\u00a77. teleportDisabled={0} a la t\u00e9l\u00e9portation d\u00e9sactiv\u00e9. teleportHereRequest=\u00a7c{0}\u00a7c Vous a demand\u00e9 de vous t\u00e9l\u00e9porter \u00e0 lui/elle. teleportNewPlayerError=\u00c9chec de la t\u00e9l\u00e9portation du nouveau joueur. -teleportRequest=\u00a7c{0}\u00a7c vous demande s''il peut se t\u00e9l\u00e9porter sur vous. +teleportRequest=\u00a7c{0}\u00a7c vous demande s''il peut se t\u00e9l\u00e9porter vers vous. teleportTop=\u00a77T\u00e9l\u00e9portation vers le haut. -teleportationCommencing=\u00a77D\u00e9but de la t\u00e9l\u00e9portation.... +teleportationCommencing=\u00a77D\u00e9but de la t\u00e9l\u00e9portation... teleportationDisabled=\u00a77T\u00e9l\u00e9poration d\u00e9sactiv\u00e9. teleportationEnabled=\u00a77T\u00e9l\u00e9portation activ\u00e9e. teleporting=\u00a77T\u00e9l\u00e9poration en cours... teleportingPortal=\u00a77T\u00e9l\u00e9portation via portail. tempBanned=Banni temporairement du serveur pour {0} -tempbanExempt=\u00a77You may not tempban that player +tempbanExempt=\u00a77Vous ne pouvez pas bannir temporairement ce joueur. thunder=Vous avez {0} la foudre dans votre monde. -thunderDuration=Vous avez {0} la foudre dans le serveur {1} secondes. +thunderDuration=Vous avez {0} la foudre dans le serveur pendant {1} secondes. timeBeforeHeal=Temps avant le prochain soin : {0} timeBeforeTeleport=Temps avant prochaine t\u00e9l\u00e9portation {0} -timeFormat=\u00a73{0}\u00a7f or \u00a73{1}\u00a7f or \u00a73{2}\u00a7f +timeFormat=\u00a73{0}\u00a7f ou \u00a73{1}\u00a7f ou \u00a73{2}\u00a7f timePattern=(?:([0-9]+)\\\\s*[ya][a-z]*[,\\\\s]*)?(?:([0-9]+)\\\\s*mo[a-z]*[,\\\\s]*)?(?:([0-9]+)\\\\s*(?:sem|w)[a-z]*[,\\\\s]*)?(?:([0-9]+)\\\\s*[dj][a-z]*[,\\\\s]*)?(?:([0-9]+)\\\\s*h[a-z]*[,\\\\s]*)?(?:([0-9]+)\\\\s*m[a-z]*[,\\\\s]*)?(?:([0-9]+)\\\\s*(?:s[a-z]*)?)? -timeSet=Heure modifi\u00e9e dans tous les mondes. -timeSetPermission=\u00a7cYou are not authorized to set the time. -timeWorldCurrent=The current time in {0} is \u00a73{1} -timeWorldSet=The time was set to {0} in: \u00a7c{1} +timeSet=Heure r\u00e9gl\u00e9e dans tous les mondes. +timeSetPermission=\u00a7cVous n''\u00eates pas autoris\u00e9 \u00e0 r\u00e9gler l''heure. +timeWorldCurrent=Il est \u00a73{1}\u00a77 dans \u00a7c{0}. +timeWorldSet=L''heure a \u00e9t\u00e9 r\u00e9gl\u00e9e \u00e0 {0} dans : \u00a7c{1} tradeCompleted=\u00a77\u00c9change termin\u00e9. tradeSignEmpty=Le panneau de vente n''as pas encore assez de stock. -tradeSignEmptyOwner=There is nothing to collect from this trade sign. +tradeSignEmptyOwner=Il n''y a rien \u00e0 collecter de cette pancarte d''\u00e9change commercial. treeFailure=\u00a7cEchec de la g\u00e9n\u00e9ration de l''arbre. Essayez de nouveau sur de l''herbe ou de la terre. treeSpawned=\u00a77Arbre cr\u00e9\u00e9. -true=true +true=vrai typeTpaccept=\u00a77Pour le t\u00e9l\u00e9porter, tapez \u00a7c/tpaccept\u00a77. typeTpdeny=\u00a77Pour d\u00e9cliner cette demande, entrez \u00a7c/tpdeny\u00a77. typeWorldName=\u00a77Vous pouvez aussi taper le nom d''un monde sp\u00e9cifique. -unableToSpawnMob=Incapable de spawner un monstre. -unbannedIP=Adresse IP d\u00e9banni. +unableToSpawnMob=Incapable d''invoquer un monstre. +unbannedIP=Adresse IP d\u00e9bannie. unbannedPlayer=Joueur d\u00e9banni. unignorePlayer=Vous n''ignorez plus {0}. unknownItemId=Num\u00e9ro d''objet inconnu : {0} @@ -340,39 +351,39 @@ userIsAway={0} s''est mis en AFK userIsNotAway={0} n''est plus inactif userJailed=\u00a77Vous avez \u00e9t\u00e9 emprisonn\u00e9 userUsedPortal={0} a utilis\u00e9 un portail existant. -userdataMoveBackError=Echec du d\u00e9placement de userdata/{0}.tmp \u00e0 userdata/{1} -userdataMoveError=Echec du d\u00e9placement de userdata/{0} \u00e0 userdata/{1}.tmp +userdataMoveBackError=Echec du d\u00e9placement de userdata/{0}.tmp vers userdata/{1} +userdataMoveError=Echec du d\u00e9placement de userdata/{0} vers userdata/{1}.tmp usingTempFolderForTesting=Utilise un fichier temporaire pour un test. -versionMismatch=Versions diff\u00e9rentes! Mettez s''il vous pla\u00eet {0} \u00e0 la m\u00eame version. -versionMismatchAll=Mauvaise version! S''il vous plait mettez des jars Essentiels de version identique. -voiceSilenced=\u00a77Votre voix a \u00e9t\u00e9 r\u00e9duite au silence -warpDeleteError=Probl\u00e8me concernant la suppression du fichier warp. +versionMismatch=Versions diff\u00e9rentes ! Mettez s''il vous plait {0} \u00e0 la m\u00eame version. +versionMismatchAll=Mauvaise version ! S''il vous plait mettez des jars Essentials de version identique. +voiceSilenced=\u00a77Vous avez \u00e9t\u00e9 r\u00e9duit au silence. +warpDeleteError=Probl\u00c3\u00a8me concernant la suppression du fichier warp. warpListPermission=\u00a7cVous n''avez pas la permission d''afficher la liste des warps. -warpNotExist=Ce warp n''existe pas. -warpSet=\u00a77Le warp {0} a \u00e9t\u00e9 cr\u00e9\u00e9. +warpNotExist=Ce raccourci n''existe pas. +warpSet=\u00a77Le raccourci {0} a \u00e9t\u00e9 cr\u00e9\u00e9. warpUsePermission=\u00a7cVous n''avez pas la permission d''utiliser ce warp. warpingTo=\u00a77T\u00e9l\u00e9portation au warp {0}. -warps=Warps: {0} -warpsCount=\u00a77There are {0} warps. Showing page {1} of {2}. -weatherStorm=\u00a77Vous avez d\u00e9fini l''orage dans {0} -weatherStormFor=\u00a77Vous avez d\u00e9fini l''orage dans {0} pour {1} secondes. -weatherSun=\u00a77Vous avez mis le beau temps dans {0} -weatherSunFor=\u00a77Vous avez mis le beau temps dans {0} pour {1} secondes. -whoisGamemode=\u00a79 - Gamemode: {0} -whoisGeoLocation=\u00a79 - Emplacement: {0} -whoisGod=\u00a79 - God mode: {0} -whoisHealth=\u00a79 - Vie: {0} / 20 -whoisIPAddress=\u00a79 - Adresse IP: {0} +warps=Raccourcis : {0} +warpsCount=\u00a77Il y a {0} raccourcis. Page {1} sur {2}. +weatherStorm=\u00a77Vous avez programm\u00e9 l''orage dans {0} +weatherStormFor=\u00a77Vous avez programm\u00e9 l''orage dans {0} pour {1} secondes. +weatherSun=\u00a77Vous avez programm\u00e9 le beau temps dans {0} +weatherSunFor=\u00a77Vous avez programm\u00e9 le beau temps dans {0} pour {1} secondes. +whoisGamemode=\u00a79 - Mode de jeu : {0} +whoisGeoLocation=\u00a79 - Emplacement : {0} +whoisGod=\u00a79 - Mode Dieu : {0} +whoisHealth=\u00a79 - Vie : {0} / 20 +whoisIPAddress=\u00a79 - Adresse IP : {0} whoisIs={0} est {1} -whoisLocation=\u00a79 - Emplacement: ({0}, {1}, {2}, {3}) -whoisMoney=\u00a79 - Argent: {0} -whoisOP=\u00a79 - OP: {0} -whoisStatusAvailable=\u00a79 - Statut: Disponible -whoisStatusAway=\u00a79 - Statut: \u00a7cAilleurs\u00a7f -worth=\u00a77Un stack de {0} vaut \u00a7c{1}\u00a77 ({2} objet(s) \u00e0 {3} chacun) -worthMeta=\u00a77Un stack de {0} avec la m\u00e9tadonn\u00e9e de {1} vaut \u00a7c{2}\u00a77 ({3} objet(s) \u00e0 {4} chacun) +whoisLocation=\u00a79 - Emplacement : ({0}, {1}, {2}, {3}) +whoisMoney=\u00a79 - Argent : {0} +whoisOP=\u00a79 - OP : {0} +whoisStatusAvailable=\u00a79 - Statut : Disponible +whoisStatusAway=\u00a79 - Statut : \u00a7cAilleurs\u00a7f +worth=\u00a77Une pile de {0} vaut \u00a7c{1}\u00a77 ({2} objet(s) \u00e0 {3} chacun) +worthMeta=\u00a77Une pile de {0} avec la m\u00e9tadonn\u00e9e de {1} vaut \u00a7c{2}\u00a77 ({3} objet(s) \u00e0 {4} chacun) worthSet=Valeur cr\u00e9e year=ann\u00e9e years=ann\u00e9es youAreHealed=\u00a77Vous avez \u00e9t\u00e9 soign\u00e9. -youHaveNewMail=\u00a7cVous avez {0} messages! \u00a7fEntrez \u00a77/mail read\u00a7f pour voir votre courrier. +youHaveNewMail=\u00a7cVous avez {0} messages ! \u00a7fEntrez \u00a77/mail read\u00a7f pour voir votre courrier.
\ No newline at end of file diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 1fe0ab01f..caac0b039 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -68,6 +68,11 @@ downloadingGeoIp=Bezig met downloaden van GeoIP database ... Dit kan een tijdje duplicatedUserdata=Dubbele userdata: {0} en {1}. enableUnlimited=\u00a77Oneindig aantal {0} aan {1} gegeven. enabled=ingeschakeld +enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. +enchantmentNotFound = \u00a7cEnchantment not found +enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item in hand. +enchantments = \u00a77Enchantments: {0} errorCallingCommand=Fout bij het aanroepen van de opdracht /{0} errorWithMessage=\u00a7cFout: {0} essentialsReload=\u00a77Essentials is herladen {0} @@ -153,6 +158,10 @@ kitTimed=\u00a7cJe kan die kit pas weer gebruiken over {0}. kits=\u00a77Kits: {0} lightningSmited=\u00a77Je bent zojuist verbrand lightningUse=\u00a77Brand {0} +listAfkTag = \u00a77[AFK]\u00a7f +listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online. +listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online. +listHiddenTag = \u00a77[HIDDEN]\u00a7f loadWarpError=Fout bij het laden van warp {0} loadinfo=Build {1} geladen {0} van {2} localFormat=Local: <{0}> {1} @@ -196,6 +205,7 @@ nickSet=\u00a77Je nickname is nu \u00a7c{0} noAccessCommand=\u00a7cJe hebt geen toegang tot die opdracht. noAccessPermission=\u00a7cJe hebt hier geen toegang voor {0}. noDestroyPermission=\u00a7cJe hebt geen toegang om dat te vernietigen {0}. +noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. noHelpFound=\u00a7cNo matching commands. noHomeSet=Je hebt geen home gemaakt. noHomeSetPlayer=Speler heeft geen home. @@ -216,6 +226,7 @@ notAllowedToShout=\u00a7cJe bent niet bevoegd om de roep functie te gebruiken. notEnoughMoney=Je hebt niet voldoende middelen. notRecommendedBukkit=De Bukkit versie is niet de aangeraden build voor Essentials. notSupportedYet=Nog niet ondersteund. +nothingInHand = \u00a7cYou have nothing in your hand. now=nu numberRequired=Er moet daar een nummer, grapjas. onlyDayNight=/time ondersteund alleen day/night. diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index e3f500b9e..55b7a1c1b 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -79,6 +79,10 @@ commands: description: Manages the server economy. usage: /<command> <give|take|reset> <player> <amount> aliases: [economy,eeco,eeconomy] + enchant: + description: Enchants the item the user is holding. + usage: /<command> <enchantmentname> [level] + aliases: [enchantment] essentials: description: Reloads essentials. usage: /<command> @@ -104,7 +108,7 @@ commands: aliases: [mem,memory,egc,emem,ememory] give: description: Give a player an item. - usage: /<command> <player> <item|numeric> [amount] + usage: /<command> <player> <item|numeric> [amount <enchantmentname[:level]> ...] aliases: [egive] god: description: Enables your godly powers. @@ -140,7 +144,7 @@ commands: aliases: [einvsee] item: description: Spawn an item. - usage: /<command> <item|numeric> [amount] + usage: /<command> <item|numeric> [amount <enchantmentname[:level]> ...] aliases: [i,eitem] jails: description: List all jails. diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java index 78b5380a6..22a8f0224 100644 --- a/Essentials/test/com/earth2me/essentials/FakeServer.java +++ b/Essentials/test/com/earth2me/essentials/FakeServer.java @@ -586,4 +586,10 @@ public class FakeServer implements Server { return "Essentials Fake-Server"; } + + @Override + public File getWorldContainer() + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/test/com/earth2me/essentials/UserTest.java b/Essentials/test/com/earth2me/essentials/UserTest.java index 35244ac90..ef9ab515d 100644 --- a/Essentials/test/com/earth2me/essentials/UserTest.java +++ b/Essentials/test/com/earth2me/essentials/UserTest.java @@ -54,21 +54,15 @@ public class UserTest extends TestCase user.setHome(); OfflinePlayer base2 = server.createPlayer(base1.getName(), ess); User user2 = ess.getUser(base2); - try - { - Location home = user2.getHome(loc); - assertEquals(loc.getWorld().getName(), home.getWorld().getName()); - assertEquals(loc.getX(), home.getX()); - assertEquals(loc.getY(), home.getY()); - assertEquals(loc.getZ(), home.getZ()); - assertEquals(loc.getYaw(), home.getYaw()); - assertEquals(loc.getPitch(), home.getPitch()); - } - catch (Exception ex) - { - fail("Exception"); - } + Location home = user2.getHome(loc); + assertNotNull(home); + assertEquals(loc.getWorld().getName(), home.getWorld().getName()); + assertEquals(loc.getX(), home.getX()); + assertEquals(loc.getY(), home.getY()); + assertEquals(loc.getZ(), home.getZ()); + assertEquals(loc.getYaw(), home.getYaw()); + assertEquals(loc.getPitch(), home.getPitch()); } public void testMoney() diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java index 0945fcd93..0a599e88b 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java @@ -2,6 +2,7 @@ package com.earth2me.essentials.chat; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; +import java.util.Locale; import java.util.Map; import org.bukkit.Server; import org.bukkit.event.player.PlayerChatEvent; @@ -30,6 +31,6 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer { event.setMessage(event.getMessage().replaceAll("&([0-9a-f])", "\u00a7$1")); } - event.setFormat(ess.getSettings().getChatFormat(user.getGroup()).replace('&', '\u00a7').replace("\u00a7\u00a7", "&").replace("{DISPLAYNAME}", "%1$s").replace("{GROUP}", user.getGroup()).replace("{MESSAGE}", "%2$s").replace("{WORLDNAME}", user.getWorld().getName()).replace("{SHORTWORLDNAME}", user.getWorld().getName().substring(0, 1).toUpperCase())); + event.setFormat(ess.getSettings().getChatFormat(user.getGroup()).replace('&', '\u00a7').replace("\u00a7\u00a7", "&").replace("{DISPLAYNAME}", "%1$s").replace("{GROUP}", user.getGroup()).replace("{MESSAGE}", "%2$s").replace("{WORLDNAME}", user.getWorld().getName()).replace("{SHORTWORLDNAME}", user.getWorld().getName().substring(0, 1).toUpperCase(Locale.ENGLISH))); } } diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java index 363e4ca6e..7789009e1 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java @@ -4,6 +4,7 @@ import com.earth2me.essentials.ChargeException; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; +import java.util.Locale; import java.util.Map; import org.bukkit.Server; import org.bukkit.event.player.PlayerChatEvent; @@ -50,7 +51,7 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer format.append(chatType).append("Format"); StringBuilder errorMsg = new StringBuilder(); - errorMsg.append("notAllowedTo").append(chatType.substring(0, 1).toUpperCase()).append(chatType.substring(1)); + errorMsg.append("notAllowedTo").append(chatType.substring(0, 1).toUpperCase(Locale.ENGLISH)).append(chatType.substring(1)); if (user.isAuthorized(permission.toString())) { diff --git a/EssentialsGroupBridge/src/org/anjocaido/groupmanager/permissions/NijikoPermissionsProxy.java b/EssentialsGroupBridge/src/org/anjocaido/groupmanager/permissions/NijikoPermissionsProxy.java index e72666cf7..da40fc172 100644 --- a/EssentialsGroupBridge/src/org/anjocaido/groupmanager/permissions/NijikoPermissionsProxy.java +++ b/EssentialsGroupBridge/src/org/anjocaido/groupmanager/permissions/NijikoPermissionsProxy.java @@ -521,10 +521,10 @@ public class NijikoPermissionsProxy extends PermissionHandler { @Override public boolean has(String world, String playerName, String permission) { - if (permission == null || permission.equals("")) { + if (permission == null || permission.isEmpty()) { return false; } - if (playerName == null || playerName == "") { + if (playerName == null || playerName.isEmpty()) { GroupManager.logger.severe("A plugin is asking permission '" + permission + "' for a null player... Which plugin does that? Bastards!"); return false; } diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 580d8bc88..71e9f4225 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -75,4 +75,8 @@ v 1.5: - Fixed a crash on reload due to bukkit not unloading plugins before reloading.
v 1.6:
- Prevent Group.equals tests throwing a NullPointerException for GlobalGroups.
- - Stop throwing errors on an empty users file.
\ No newline at end of file + - Stop throwing errors on an empty users file.
+ - Optimize sorting to speedup permission tests.
+ - Fix superperms to pass all tests http://dev.bukkit.org/server-mods/superpermstest/
+ - Optimizations include changing the return of comparePermissionString.
+ - Added file details in error messages for loading groups/users.
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java index 924da3616..a35b5aeee 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java @@ -6,6 +6,8 @@ package org.anjocaido.groupmanager.data; import java.util.ArrayList; import java.util.Collections; +import java.util.List; + import org.anjocaido.groupmanager.GroupManager; import org.anjocaido.groupmanager.dataholder.WorldDataHolder; import org.anjocaido.groupmanager.utils.StringPermissionComparator; @@ -18,7 +20,7 @@ public abstract class DataUnit { private WorldDataHolder dataSource; private String name; - private boolean changed; + private boolean changed, sorted = false; private ArrayList<String> permissions = new ArrayList<String>(); public DataUnit(WorldDataHolder dataSource, String name) { @@ -91,6 +93,7 @@ public abstract class DataUnit { // for(StackTraceElement st: Thread.currentThread().getStackTrace()){ // GroupManager.logger.finest(st.toString()); // } + sorted = false; changed = true; } @@ -132,11 +135,18 @@ public abstract class DataUnit { * You can't edit the permissions using the returned ArrayList instance * @return a copy of the permission list */ - public ArrayList<String> getPermissionList() { - return new ArrayList<String>(permissions); + public List<String> getPermissionList() { + return Collections.unmodifiableList(permissions); + } + + public boolean isSorted() { + return this.sorted; } public void sortPermissions() { - Collections.sort(permissions, StringPermissionComparator.getInstance()); + if (!isSorted()) { + Collections.sort(permissions, StringPermissionComparator.getInstance()); + sorted = true; + } } }
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java index c05065f5e..ba8915a18 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java @@ -7,6 +7,8 @@ package org.anjocaido.groupmanager.data; import org.anjocaido.groupmanager.GroupManager; import org.anjocaido.groupmanager.dataholder.WorldDataHolder; import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import java.util.Map; /** @@ -92,13 +94,13 @@ public class Group extends DataUnit implements Cloneable { } /** - * a COPY of inherits list + * an unmodifiable list of inherits list * You can't manage the list by here * Lol... version 0.6 had a problem because this. * @return the inherits */ - public ArrayList<String> getInherits() { - return new ArrayList<String>(inherits); + public List<String> getInherits() { + return Collections.unmodifiableList(inherits); } /** diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java index 6c4cdbcf2..eea488ab2 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java @@ -10,209 +10,232 @@ import java.util.ArrayList; import org.anjocaido.groupmanager.GroupManager; import org.anjocaido.groupmanager.dataholder.WorldDataHolder; import java.util.Map; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + /** - * + * * @author gabrielcouto */ public class User extends DataUnit implements Cloneable { - /** - * - */ - private String group = null; - private ArrayList<String> subGroups = new ArrayList<String>(); - /** - *This one holds the fields in INFO node. - * like prefix = 'c' - * or build = false - */ - private UserVariables variables = new UserVariables(this); - - /** + /** * - * @param name */ - public User(WorldDataHolder source, String name) { - super(source, name); - this.group = source.getDefaultGroup().getName(); - } + private String group = null; + private ArrayList<String> subGroups = new ArrayList<String>(); + /** + * This one holds the fields in INFO node. like prefix = 'c' or build = + * false + */ + private UserVariables variables = new UserVariables(this); + private transient Player bukkitPlayer = null; + + /** + * + * @param name + */ + public User(WorldDataHolder source, String name) { + super(source, name); + this.group = source.getDefaultGroup().getName(); + } + + /** + * + * @return User clone + */ + @Override + public User clone() { + User clone = new User(getDataSource(), this.getName()); + clone.group = this.group; + for (String perm : this.getPermissionList()) { + clone.addPermission(perm); + } + // clone.variables = this.variables.clone(); + // clone.flagAsChanged(); + return clone; + } + + /** + * Use this to deliver a user from one WorldDataHolder to another + * + * @param dataSource + * @return null if given dataSource already contains the same user + */ + public User clone(WorldDataHolder dataSource) { + if (dataSource.isUserDeclared(this.getName())) { + return null; + } + User clone = dataSource.createUser(this.getName()); + if (dataSource.getGroup(group) == null) { + clone.setGroup(dataSource.getDefaultGroup()); + } else { + clone.setGroup(dataSource.getGroup(this.getGroupName())); + } + for (String perm : this.getPermissionList()) { + clone.addPermission(perm); + } + // clone.variables = this.variables.clone(); + clone.flagAsChanged(); + return clone; + } + + public Group getGroup() { + Group result = getDataSource().getGroup(group); + if (result == null) { + this.setGroup(getDataSource().getDefaultGroup()); + result = getDataSource().getDefaultGroup(); + } + return result; + } + + /** + * @return the group + */ + public String getGroupName() { + Group result = getDataSource().getGroup(group); + if (result == null) { + group = getDataSource().getDefaultGroup().getName(); + } + return group; + } + + /** + * @param group + * the group to set + */ + @Deprecated + public void setGroup(String group) { + this.group = group; + flagAsChanged(); + if (GroupManager.isLoaded()) + if (GroupManager.BukkitPermissions.player_join = false) + GroupManager.BukkitPermissions.updateAllPlayers(); + } + + /** + * @param group + * the group to set + */ + public void setGroup(Group group) { + if (!this.getDataSource().groupExists(group.getName())) { + getDataSource().addGroup(group); + } + group = getDataSource().getGroup(group.getName()); + String oldGroup = this.group; + this.group = group.getName(); + flagAsChanged(); + if (GroupManager.isLoaded()) { + if (GroupManager.BukkitPermissions.player_join = false) + GroupManager.BukkitPermissions.updateAllPlayers(); + + // Do we notify of the group change? + String defaultGroupName = getDataSource().getDefaultGroup().getName(); + // if we were not in the default group + // or we were in the default group and the move is to a different + // group. + boolean notify = (!oldGroup.equalsIgnoreCase(defaultGroupName)) || ((oldGroup.equalsIgnoreCase(defaultGroupName)) && (!this.group.equalsIgnoreCase(defaultGroupName))); + + if (notify) + GroupManager.notify(this.getName(), String.format(" moved to the group %s.", group.getName())); + } + } + + public void addSubGroup(Group subGroup) { + if (this.group.equalsIgnoreCase(subGroup.getName())) { + return; + } + if (!this.getDataSource().groupExists(subGroup.getName())) { + getDataSource().addGroup(subGroup); + } + subGroup = getDataSource().getGroup(subGroup.getName()); + removeSubGroup(subGroup); + subGroups.add(subGroup.getName()); + flagAsChanged(); + if (GroupManager.isLoaded()) + if (GroupManager.BukkitPermissions.player_join = false) + GroupManager.BukkitPermissions.updateAllPlayers(); + } + + public int subGroupsSize() { + return subGroups.size(); + } + + public boolean isSubGroupsEmpty() { + return subGroups.isEmpty(); + } + + public boolean containsSubGroup(Group subGroup) { + return subGroups.contains(subGroup.getName()); + } + + public boolean removeSubGroup(Group subGroup) { + try { + if (subGroups.remove(subGroup.getName())) { + flagAsChanged(); + if (GroupManager.isLoaded()) + if (GroupManager.BukkitPermissions.player_join = false) + GroupManager.BukkitPermissions.updateAllPlayers(); + return true; + } + } catch (Exception e) { + } + return false; + } + + public ArrayList<Group> subGroupListCopy() { + ArrayList<Group> val = new ArrayList<Group>(); + for (String gstr : subGroups) { + Group g = getDataSource().getGroup(gstr); + if (g == null) { + removeSubGroup(g); + continue; + } + val.add(g); + } + return val; + } + + public ArrayList<String> subGroupListStringCopy() { + return new ArrayList<String>(subGroups); + } + + /** + * @return the variables + */ + public UserVariables getVariables() { + return variables; + } + + /** + * + * @param varList + */ + public void setVariables(Map<String, Object> varList) { + UserVariables temp = new UserVariables(this, varList); + variables.clearVars(); + for (String key : temp.getVarKeyList()) { + variables.addVar(key, temp.getVarObject(key)); + } + flagAsChanged(); + if (GroupManager.isLoaded()) + if (GroupManager.BukkitPermissions.player_join = false) + GroupManager.BukkitPermissions.updateAllPlayers(); + } + + public User updatePlayer(Player player) { + if (player != null) { + bukkitPlayer = player; + } + return this; + } + + public Player getBukkitPlayer() { + if (bukkitPlayer == null) { + bukkitPlayer = Bukkit.getPlayer(this.getName()); + } + return bukkitPlayer; + } - /** - * - * @return User clone - */ - @Override - public User clone() { - User clone = new User(getDataSource(), this.getName()); - clone.group = this.group; - for (String perm : this.getPermissionList()) { - clone.addPermission(perm); - } - //clone.variables = this.variables.clone(); - //clone.flagAsChanged(); - return clone; - } - - /** - * Use this to deliver a user from one WorldDataHolder to another - * @param dataSource - * @return null if given dataSource already contains the same user - */ - public User clone(WorldDataHolder dataSource) { - if (dataSource.isUserDeclared(this.getName())) { - return null; - } - User clone = dataSource.createUser(this.getName()); - if (dataSource.getGroup(group) == null) { - clone.setGroup(dataSource.getDefaultGroup()); - } else { - clone.setGroup(dataSource.getGroup(this.getGroupName())); - } - for (String perm : this.getPermissionList()) { - clone.addPermission(perm); - } - //clone.variables = this.variables.clone(); - clone.flagAsChanged(); - return clone; - } - - public Group getGroup() { - Group result = getDataSource().getGroup(group); - if (result == null) { - this.setGroup(getDataSource().getDefaultGroup()); - result = getDataSource().getDefaultGroup(); - } - return result; - } - - /** - * @return the group - */ - public String getGroupName() { - Group result = getDataSource().getGroup(group); - if (result == null) { - group = getDataSource().getDefaultGroup().getName(); - } - return group; - } - - /** - * @param group the group to set - */ - @Deprecated - public void setGroup(String group) { - this.group = group; - flagAsChanged(); - if (GroupManager.isLoaded()) - if(GroupManager.BukkitPermissions.player_join = false) - GroupManager.BukkitPermissions.updateAllPlayers(); - } - - /** - * @param group the group to set - */ - public void setGroup(Group group) { - if (!this.getDataSource().groupExists(group.getName())) { - getDataSource().addGroup(group); - } - group = getDataSource().getGroup(group.getName()); - String oldGroup = this.group; - this.group = group.getName(); - flagAsChanged(); - if (GroupManager.isLoaded()) { - if (GroupManager.BukkitPermissions.player_join = false) - GroupManager.BukkitPermissions.updateAllPlayers(); - - // Do we notify of the group change? - String defaultGroupName = getDataSource().getDefaultGroup().getName(); - // if we were not in the default group - // or we were in the default group and the move is to a different group. - boolean notify = (!oldGroup.equalsIgnoreCase(defaultGroupName)) || ((oldGroup.equalsIgnoreCase(defaultGroupName)) && (!this.group.equalsIgnoreCase(defaultGroupName))) ; - - if (notify) GroupManager.notify(this.getName(), String.format(" moved to the group %s.", group.getName())); - } - } - - public void addSubGroup(Group subGroup) { - if (this.group.equalsIgnoreCase(subGroup.getName())) { - return; - } - if (!this.getDataSource().groupExists(subGroup.getName())) { - getDataSource().addGroup(subGroup); - } - subGroup = getDataSource().getGroup(subGroup.getName()); - removeSubGroup(subGroup); - subGroups.add(subGroup.getName()); - flagAsChanged(); - if (GroupManager.isLoaded()) - if (GroupManager.BukkitPermissions.player_join = false) - GroupManager.BukkitPermissions.updateAllPlayers(); - } - - public int subGroupsSize() { - return subGroups.size(); - } - - public boolean isSubGroupsEmpty() { - return subGroups.isEmpty(); - } - - public boolean containsSubGroup(Group subGroup) { - return subGroups.contains(subGroup.getName()); - } - - public boolean removeSubGroup(Group subGroup) { - try { - if (subGroups.remove(subGroup.getName())) { - flagAsChanged(); - if (GroupManager.isLoaded()) - if (GroupManager.BukkitPermissions.player_join = false) - GroupManager.BukkitPermissions.updateAllPlayers(); - return true; - } - } catch (Exception e) { - } - return false; - } - - public ArrayList<Group> subGroupListCopy() { - ArrayList<Group> val = new ArrayList<Group>(); - for (String gstr : subGroups) { - Group g = getDataSource().getGroup(gstr); - if (g == null) { - removeSubGroup(g); - continue; - } - val.add(g); - } - return val; - } - - public ArrayList<String> subGroupListStringCopy() { - return new ArrayList<String>(subGroups); - } - - /** - * @return the variables - */ - public UserVariables getVariables() { - return variables; - } - - /** - * - * @param varList - */ - public void setVariables(Map<String, Object> varList) { - UserVariables temp = new UserVariables(this, varList); - variables.clearVars(); - for (String key : temp.getVarKeyList()) { - variables.addVar(key, temp.getVarObject(key)); - } - flagAsChanged(); - if (GroupManager.isLoaded()) - if (GroupManager.BukkitPermissions.player_join = false) - GroupManager.BukkitPermissions.updateAllPlayers(); - } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java index e7fa81627..8e2df5d10 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java @@ -44,12 +44,13 @@ public class OverloadedWorldHolder extends WorldDataHolder { @Override public User getUser(String userName) { //OVERLOADED CODE - if (overloadedUsers.containsKey(userName.toLowerCase())) { - return overloadedUsers.get(userName.toLowerCase()); + String userNameLowered = userName.toLowerCase(); + if (overloadedUsers.containsKey(userNameLowered)) { + return overloadedUsers.get(userNameLowered); } //END CODE - if (users.containsKey(userName.toLowerCase())) { - return users.get(userName.toLowerCase()); + if (users.containsKey(userNameLowered)) { + return users.get(userNameLowered); } User newUser = createUser(userName); haveUsersChanged = true; diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java index 683ba24a9..59c5949f4 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java @@ -595,7 +595,7 @@ public class WorldDataHolder { Map<String, Object> thisGroupNode = (Map<String, Object>) allGroupsNode.get(groupKey); Group thisGrp = ph.createGroup(groupKey); if (thisGrp == null) { - throw new IllegalArgumentException("I think this user was declared more than once: " + groupKey); + throw new IllegalArgumentException("I think this user was declared more than once: " + groupKey + " in file: " + groupsFile.getPath()); } if (thisGroupNode.get("default") == null) { thisGroupNode.put("default", false); @@ -603,7 +603,7 @@ public class WorldDataHolder { if ((Boolean.parseBoolean(thisGroupNode.get("default").toString()))) { if (ph.getDefaultGroup() != null) { GroupManager.logger.warning("The group " + thisGrp.getName() + " is claiming to be default where" + ph.getDefaultGroup().getName() + " already was."); - GroupManager.logger.warning("Overriding first request."); + GroupManager.logger.warning("Overriding first request for file: " + groupsFile.getPath()); } ph.setDefaultGroup(thisGrp); } @@ -619,7 +619,7 @@ public class WorldDataHolder { } else if (thisGroupNode.get("permissions") instanceof String) { thisGrp.addPermission((String) thisGroupNode.get("permissions")); } else { - throw new IllegalArgumentException("Unknown type of permissions node(Should be String or List<String>) for group: " + thisGrp.getName()); + throw new IllegalArgumentException("Unknown type of permissions node(Should be String or List<String>) for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); } //INFO NODE @@ -629,7 +629,7 @@ public class WorldDataHolder { thisGrp.setVariables(infoNode); } } else - throw new IllegalArgumentException("Unknown entry found in Info section for group: " + thisGrp.getName()); + throw new IllegalArgumentException("Unknown entry found in Info section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); //END INFO NODE @@ -650,14 +650,14 @@ public class WorldDataHolder { } } }else - throw new IllegalArgumentException("Unknown entry found in inheritance section for group: " + thisGrp.getName()); + throw new IllegalArgumentException("Unknown entry found in inheritance section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); } //} catch (Exception ex) { // ex.printStackTrace(); // throw new IllegalArgumentException("Your Permissions config file is invalid. See console for details."); //} if (ph.defaultGroup == null) { - throw new IllegalArgumentException("There was no Default Group declared."); + throw new IllegalArgumentException("There was no Default Group declared in file: " + groupsFile.getPath()); } for (String groupKey : inheritance.keySet()) { List<String> inheritedList = inheritance.get(groupKey); @@ -717,7 +717,7 @@ public class WorldDataHolder { Map<String, Object> thisUserNode = (Map<String, Object>) allUsersNode.get(usersKey); User thisUser = ph.createUser(usersKey); if (thisUser == null) { - throw new IllegalArgumentException("I think this user was declared more than once: " + usersKey); + throw new IllegalArgumentException("I think this user was declared more than once: " + usersKey + " in file: " + usersFile.getPath()); } if (thisUserNode.get("permissions") == null) { thisUserNode.put("permissions", new ArrayList<String>()); @@ -740,7 +740,7 @@ public class WorldDataHolder { if (subGrp != null) { thisUser.addSubGroup(subGrp); } else { - GroupManager.logger.warning("Subgroup " + o.toString() + " not found for user " + thisUser.getName() + ". Ignoring entry."); + GroupManager.logger.warning("Subgroup " + o.toString() + " not found for user " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath()); } } } else if (thisUserNode.get("subgroups") instanceof String) { @@ -748,7 +748,7 @@ public class WorldDataHolder { if (subGrp != null) { thisUser.addSubGroup(subGrp); } else { - GroupManager.logger.warning("Subgroup " + thisUserNode.get("subgroups").toString() + " not found for user " + thisUser.getName() + ". Ignoring entry."); + GroupManager.logger.warning("Subgroup " + thisUserNode.get("subgroups").toString() + " not found for user " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath()); } } @@ -765,7 +765,7 @@ public class WorldDataHolder { if (thisUserNode.get("group") != null) { Group hisGroup = ph.getGroup(thisUserNode.get("group").toString()); if (hisGroup == null) { - GroupManager.logger.warning("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName() + ": Set to '" + ph.getDefaultGroup().getName() + "'."); + GroupManager.logger.warning("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName() + ": Set to '" + ph.getDefaultGroup().getName() + "' for file: " + usersFile.getPath()); hisGroup = ph.defaultGroup; //throw new IllegalArgumentException("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName()); } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java index 6544bb1cc..25eaf8526 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java @@ -268,9 +268,10 @@ public class WorldsHolder { * @return OverloadedWorldHolder */ public OverloadedWorldHolder getWorldData(String worldName) { - OverloadedWorldHolder data = worldsData.get(worldName.toLowerCase()); - if (mirrors.containsKey(worldName.toLowerCase())) { - String realOne = mirrors.get(worldName.toLowerCase()); + String worldNameLowered = worldName.toLowerCase(); + OverloadedWorldHolder data = worldsData.get(worldNameLowered); + if (mirrors.containsKey(worldNameLowered)) { + String realOne = mirrors.get(worldNameLowered); data = worldsData.get(realOne.toLowerCase()); } if (data == null) { diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index b858c2a6c..6e18bf3f8 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -8,7 +8,7 @@ import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.StringTokenizer; + import org.anjocaido.groupmanager.GroupManager; import org.anjocaido.groupmanager.data.Group; import org.anjocaido.groupmanager.dataholder.WorldDataHolder; @@ -17,6 +17,7 @@ import org.anjocaido.groupmanager.utils.PermissionCheckResult; import org.anjocaido.groupmanager.utils.PermissionCheckResult.Type; import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import org.bukkit.permissions.Permission; /** * Everything here maintains the model created by Nijikokun @@ -62,7 +63,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public boolean permission(Player player, String permission) { - return checkUserPermission(ph.getUser(player.getName()), permission); + return checkUserPermission(ph.getUser(player.getName()).updatePlayer(player), permission); } /** @@ -97,43 +98,60 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { @Override public List<String> getAllPlayersPermissions(String userName) { - List<String> playerPermArray = new ArrayList<String>(ph.getUser(userName).getPermissionList()); + List<String> playerPermArray = new ArrayList<String>(); + + for (String perm : ph.getUser(userName).getPermissionList()) { + if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-" + perm))) { + playerPermArray.add(perm); + + Map<String, Boolean> children = GroupManager.BukkitPermissions.getAllChildren(perm, playerPermArray); + if (children != null) { + for (String child : children.keySet()) { + if (children.get(child)) + if ((!playerPermArray.contains(child)) && (!playerPermArray.contains("-" + child))) { + playerPermArray.add(child); + } + } + } + } + } for (String group : getGroups(userName)) { if (group.startsWith("g:") && GroupManager.getGlobalGroups().hasGroup(group)) { for (String perm : GroupManager.getGlobalGroups().getGroupsPermissions(group)) { if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-" + perm))) { playerPermArray.add(perm); - Map<String, Boolean> children = GroupManager.BukkitPermissions.getChildren(perm); + Map<String, Boolean> children = GroupManager.BukkitPermissions.getAllChildren(perm, playerPermArray); if (children != null) { for (String child : children.keySet()) { if (children.get(child)) - if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-" + perm))) + if ((!playerPermArray.contains(child)) && (!playerPermArray.contains("-" + child))) playerPermArray.add(child); } } } } - } else { for (String perm : ph.getGroup(group).getPermissionList()) { if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-" + perm))) { playerPermArray.add(perm); - Map<String, Boolean> children = GroupManager.BukkitPermissions.getChildren(perm); + Map<String, Boolean> children = GroupManager.BukkitPermissions.getAllChildren(perm, playerPermArray); if (children != null) { for (String child : children.keySet()) { if (children.get(child)) - if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-" + perm))) + if ((!playerPermArray.contains(child)) && (!playerPermArray.contains("-" + child))) { playerPermArray.add(child); + } } } - } } } } + // Collections.sort(playerPermArray, + // StringPermissionComparator.getInstance()); return playerPermArray; } @@ -227,7 +245,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { /** * Check if user can build. Checks inheritance and subgroups. * - * @param userName Player's name + * @param userName + * Player's name * @return true if the user can build */ public boolean canUserBuild(String userName) { @@ -267,8 +286,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } /** - * Checks the specified group for the Info Build node. - * Does NOT check inheritance + * Checks the specified group for the Info Build node. Does NOT check + * inheritance * * @param groupName * @return true if can build @@ -599,15 +618,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { result.askedPermission = permission; result.owner = user; for (String access : user.getPermissionList()) { - if (comparePermissionString(access, permission)) { - result.accessLevel = access; - if (access.startsWith("-")) { - result.resultType = PermissionCheckResult.Type.NEGATION; - } else if (access.startsWith("+")) { - result.resultType = PermissionCheckResult.Type.EXCEPTION; - } else { - result.resultType = PermissionCheckResult.Type.FOUND; - } + result.resultType = comparePermissionString(access, permission); + if (result.resultType != PermissionCheckResult.Type.NOTFOUND) { return result; } } @@ -629,15 +641,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { result.owner = group; result.askedPermission = permission; for (String access : group.getPermissionList()) { - if (comparePermissionString(access, permission)) { - result.accessLevel = access; - if (access.startsWith("-")) { - result.resultType = PermissionCheckResult.Type.NEGATION; - } else if (access.startsWith("+")) { - result.resultType = PermissionCheckResult.Type.EXCEPTION; - } else { - result.resultType = PermissionCheckResult.Type.FOUND; - } + result.resultType = comparePermissionString(access, permission); + if (result.resultType != PermissionCheckResult.Type.NOTFOUND) { return result; } } @@ -653,12 +658,10 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return true if permission was found. false if not, or was negated. */ public boolean checkUserPermission(User user, String permission) { - PermissionCheckResult result = checkFullUserPermission(user, permission); - if (result.resultType.equals(PermissionCheckResult.Type.EXCEPTION) || result.resultType.equals(PermissionCheckResult.Type.FOUND)) { + PermissionCheckResult result = checkFullGMPermission(user, permission, true); + if (result.resultType == PermissionCheckResult.Type.EXCEPTION || result.resultType == PermissionCheckResult.Type.FOUND) { return true; } - if ((Bukkit.getPlayer(user.getName()) != null) && (Bukkit.getPlayer(user.getName()).hasPermission(permission))) - return true; return false; } @@ -672,39 +675,59 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return PermissionCheckResult */ public PermissionCheckResult checkFullUserPermission(User user, String targetPermission) { + + return checkFullGMPermission(user, targetPermission, true); + } + + /** + * Check user and groups with inheritance and Bukkit if bukkit = true return + * a PermissionCheckResult. + * + * @param user + * @param targetPermission + * @param checkBukkit + * @return PermissionCheckResult + */ + public PermissionCheckResult checkFullGMPermission(User user, String targetPermission, Boolean checkBukkit) { PermissionCheckResult result = new PermissionCheckResult(); - result.askedPermission = targetPermission; + result.accessLevel = targetPermission; result.resultType = PermissionCheckResult.Type.NOTFOUND; if (user == null || targetPermission == null || targetPermission.isEmpty()) { return result; } + if (checkBukkit) { + // Check Bukkit perms to support plugins which add perms via code + // (Heroes). + final Player player = user.getBukkitPlayer(); + final Permission bukkitPerm = Bukkit.getPluginManager().getPermission(targetPermission); + if (player != null && bukkitPerm != null) { + result.resultType = player.hasPermission(bukkitPerm) ? PermissionCheckResult.Type.FOUND : PermissionCheckResult.Type.NEGATION; + result.owner = user; + return result; + } + } + PermissionCheckResult resultUser = checkUserOnlyPermission(user, targetPermission); - if (!resultUser.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { + if (resultUser.resultType != PermissionCheckResult.Type.NOTFOUND) { return resultUser; } // IT ONLY CHECKS GROUPS PERMISSIONS IF RESULT FOR USER IS NOT FOUND PermissionCheckResult resultGroup = checkGroupPermissionWithInheritance(user.getGroup(), targetPermission); - if (!resultGroup.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { + if (resultGroup.resultType != PermissionCheckResult.Type.NOTFOUND) { return resultGroup; } // SUBGROUPS CHECK for (Group subGroup : user.subGroupListCopy()) { PermissionCheckResult resultSubGroup = checkGroupPermissionWithInheritance(subGroup, targetPermission); - if (!resultSubGroup.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { + if (resultSubGroup.resultType != PermissionCheckResult.Type.NOTFOUND) { return resultSubGroup; } } - if ((Bukkit.getPlayer(user.getName()) != null) && (Bukkit.getPlayer(user.getName()).hasPermission(targetPermission))) { - result.resultType = PermissionCheckResult.Type.FOUND; - result.owner = user; - return result; - } - // THEN IT RETURNS A NOT FOUND return result; } @@ -960,53 +983,43 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * Every '-' or '+' in the beginning is ignored. It will match only node * names. * - * @param userAcessLevel + * @param userAccessLevel * @param fullPermissionName - * @return true if found a matching token. false if not. + * @return PermissionCheckResult.Type */ - public boolean comparePermissionString(String userAcessLevel, String fullPermissionName) { - if (userAcessLevel == null || fullPermissionName == null) { - return false; - } - GroupManager.logger.finest("COMPARING " + userAcessLevel + " WITH " + fullPermissionName); - - if (userAcessLevel.startsWith("+")) { - userAcessLevel = userAcessLevel.substring(1); - } else if (userAcessLevel.startsWith("-")) { - userAcessLevel = userAcessLevel.substring(1); + public PermissionCheckResult.Type comparePermissionString(String userAccessLevel, String fullPermissionName) { + int userAccessLevelLength; + if (userAccessLevel == null || fullPermissionName == null || fullPermissionName.length() == 0 || (userAccessLevelLength = userAccessLevel.length()) == 0) { + return PermissionCheckResult.Type.NOTFOUND; + } + + PermissionCheckResult.Type result = PermissionCheckResult.Type.FOUND; + int userAccessLevelOffset = 0; + if (userAccessLevel.charAt(0) == '+') { + userAccessLevelOffset = 1; + result = PermissionCheckResult.Type.EXCEPTION; + } else if (userAccessLevel.charAt(0) == '-') { + userAccessLevelOffset = 1; + result = PermissionCheckResult.Type.NEGATION; + } + if ("*".regionMatches(0, userAccessLevel, userAccessLevelOffset, userAccessLevelLength - userAccessLevelOffset)) { + return result; } - - if (fullPermissionName.startsWith("+")) { - fullPermissionName = fullPermissionName.substring(1); - } else if (fullPermissionName.startsWith("-")) { - fullPermissionName = fullPermissionName.substring(1); + int fullPermissionNameOffset; + if (fullPermissionName.charAt(0) == '+' || fullPermissionName.charAt(0) == '-') { + fullPermissionNameOffset = 1; + } else { + fullPermissionNameOffset = 0; } - StringTokenizer levelATokenizer = new StringTokenizer(userAcessLevel, "."); - StringTokenizer levelBTokenizer = new StringTokenizer(fullPermissionName, "."); - while (levelATokenizer.hasMoreTokens() && levelBTokenizer.hasMoreTokens()) { - String levelA = levelATokenizer.nextToken(); - String levelB = levelBTokenizer.nextToken(); - GroupManager.logger.finest("ROUND " + levelA + " AGAINST " + levelB); - if (levelA.contains("*")) { - GroupManager.logger.finest("WIN"); - return true; - } - if (levelA.equalsIgnoreCase(levelB)) { - if (!levelATokenizer.hasMoreTokens() && !levelBTokenizer.hasMoreTokens()) { - GroupManager.logger.finest("WIN"); - return true; - } - GroupManager.logger.finest("NEXT"); - continue; - } else { - GroupManager.logger.finest("FAIL"); - return false; - } - + if (userAccessLevel.charAt(userAccessLevel.length() - 1) == '*') { + return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, userAccessLevelLength - userAccessLevelOffset - 1) ? + result : PermissionCheckResult.Type.NOTFOUND; + } else { + return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, + Math.max(userAccessLevelLength - userAccessLevelOffset, fullPermissionName.length() - fullPermissionNameOffset)) ? + result : PermissionCheckResult.Type.NOTFOUND; } - GroupManager.logger.finest("FAIL"); - return false; } /** diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java index abfb73bfd..202e27e3a 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java @@ -18,14 +18,14 @@ package org.anjocaido.groupmanager.permissions; import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.data.User;
import org.anjocaido.groupmanager.dataholder.OverloadedWorldHolder;
+import org.anjocaido.groupmanager.utils.PermissionCheckResult;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@@ -49,246 +49,292 @@ import org.bukkit.plugin.PluginManager; /**
- *
+ *
* BukkitPermissions overrides to force GM reponses to Superperms
- *
+ *
* @author ElgarL, based upon PermissionsEX implementation
*/
public class BukkitPermissions {
- protected Map<Player, PermissionAttachment> attachments = new HashMap<Player, PermissionAttachment>();
- protected Set<Permission> registeredPermissions = new HashSet<Permission>();
- protected GroupManager plugin;
- protected boolean dumpAllPermissions = true;
- protected boolean dumpMatchedPermissions = true;
- public boolean player_join = false;
-
- public BukkitPermissions(GroupManager plugin) {
- this.plugin = plugin;
-
- this.collectPermissions();
- this.registerEvents();
-
- this.updateAllPlayers();
-
- GroupManager.logger.info("Superperms support enabled.");
- }
-
- private void registerEvents() {
- PluginManager manager = plugin.getServer().getPluginManager();
-
- PlayerEvents playerEventListener = new PlayerEvents();
-
- manager.registerEvent(Event.Type.PLAYER_JOIN, playerEventListener, Event.Priority.Lowest, plugin);
- manager.registerEvent(Event.Type.PLAYER_KICK, playerEventListener, Event.Priority.Lowest, plugin);
- manager.registerEvent(Event.Type.PLAYER_QUIT, playerEventListener, Event.Priority.Lowest, plugin);
-
- manager.registerEvent(Event.Type.PLAYER_RESPAWN, playerEventListener, Event.Priority.Lowest, plugin);
- manager.registerEvent(Event.Type.PLAYER_TELEPORT, playerEventListener, Event.Priority.Lowest, plugin);
- manager.registerEvent(Event.Type.PLAYER_PORTAL, playerEventListener, Event.Priority.Lowest, plugin);
-
- ServerListener serverListener = new BukkitEvents();
-
- manager.registerEvent(Event.Type.PLUGIN_ENABLE, serverListener, Event.Priority.Normal, plugin);
- manager.registerEvent(Event.Type.PLUGIN_DISABLE, serverListener, Event.Priority.Normal, plugin);
- }
-
- public void collectPermissions() {
- registeredPermissions.clear();
- for (Plugin bukkitPlugin : Bukkit.getServer().getPluginManager().getPlugins()) {
- for(Permission permission : bukkitPlugin.getDescription().getPermissions())
- registeredPermissions.add(permission);
- }
- }
-
- public void updatePermissions(Player player){
- this.updatePermissions(player, null);
- }
-
- public void updatePermissions(Player player, String world) {
- if (player == null || !GroupManager.isLoaded()) {
- return;
- }
-
- if (!this.attachments.containsKey(player)) {
- this.attachments.put(player, player.addAttachment(plugin));
- }
-
- if(world == null){
- world = player.getWorld().getName();
- }
-
- // All permissions registered with Bukkit for this player
- PermissionAttachment attachment = this.attachments.get(player);
-
- OverloadedWorldHolder worldData = plugin.getWorldsHolder().getWorldData(world);
-
- User user = worldData.getUser(player.getName());
-
- // clear permissions
- for (String permission : attachment.getPermissions().keySet())
- attachment.unsetPermission(permission);
-
- /*
- * find matching permissions
- *
- * and base bukkit perms if we are set to allow bukkit permissions to override.
- */
- Boolean value;
- for (Permission permission : registeredPermissions) {
-
- value = worldData.getPermissionsHandler().checkUserPermission(user, permission.getName());
-
- // Only check bukkit override IF we don't have the permission directly.
- if (value = false) {
- PermissionDefault permDefault = permission.getDefault();
-
- if ((plugin.getGMConfig().isBukkitPermsOverride())
- && ((permDefault == PermissionDefault.TRUE)
- || ((permDefault == PermissionDefault.NOT_OP) && !player.isOp())
- || ((permDefault == PermissionDefault.OP) && player.isOp())))
- value = true;
- }
-
- if (value == true){
- // Set the root permission
- attachment.setPermission(permission, value);
- // fetch and set all children of this permission node
- Map<String, Boolean> children = permission.getChildren();
- if (children != null) {
- for (String child : children.keySet()) {
- if (children.get(child))
- attachment.setPermission(child, true);
- }
- }
-
- }
- }
-
- // Add any missing permissions for this player (non bukkit plugins)
- List<String> playerPermArray = new ArrayList<String>(worldData.getPermissionsHandler().getAllPlayersPermissions(player.getName()));
-
- for (String permission : playerPermArray) {
- value = true;
- if (permission.startsWith("-")) {
- permission = permission.substring(1); // cut off -
- value = false;
- }
-
- if (!attachment.getPermissions().containsKey(permission)) {
- attachment.setPermission(permission, value);
- }
- }
- player.recalculatePermissions();
- }
-
- /**
- * Returns a map of the child permissions as defined by the supplying plugin
- * null is empty
- *
- * @param node
- * @return Map of child permissions
- */
- public Map<String, Boolean> getChildren(String node) {
- for (Permission permission : registeredPermissions) {
- if (permission.getName() == node) {
- return permission.getChildren();
- }
- }
- return null;
- }
-
- public List<String> listPerms(Player player) {
- List<String> perms = new ArrayList<String>();
-
- /*
- // All permissions registered with Bukkit for this player
- PermissionAttachment attachment = this.attachments.get(player);
-
- // List perms for this player
- perms.add("Attachment Permissions:");
- for(Map.Entry<String, Boolean> entry : attachment.getPermissions().entrySet()){
- perms.add(" " + entry.getKey() + " = " + entry.getValue());
- }
- */
-
- perms.add("Effective Permissions:");
- for(PermissionAttachmentInfo info : player.getEffectivePermissions()){
- if (info.getValue() == true)
- perms.add(" " + info.getPermission() + " = " + info.getValue());
- }
- return perms;
- }
-
- public void updateAllPlayers() {
- for (Player player : Bukkit.getServer().getOnlinePlayers()) {
- updatePermissions(player);
- }
- }
-
- protected class PlayerEvents extends PlayerListener {
-
- @Override
- public void onPlayerJoin(PlayerJoinEvent event) {
- player_join = true;
- Player player = event.getPlayer();
- //force GM to create the player if they are not already listed.
- if (plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getName()) != null) {
- player_join = false;
- updatePermissions(event.getPlayer());
- } else
- player_join = false;
- }
-
- @Override
- public void onPlayerPortal(PlayerPortalEvent event) { // will portal into another world
- if(event.getTo() != null && !event.getFrom().getWorld().equals(event.getTo().getWorld())){ // only if world actually changed
- updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
- }
- }
-
- @Override
- public void onPlayerRespawn(PlayerRespawnEvent event) { // can be respawned in another world
- updatePermissions(event.getPlayer(), event.getRespawnLocation().getWorld().getName());
- }
-
- @Override
- public void onPlayerTeleport(PlayerTeleportEvent event) { // can be teleported into another world
- if (event.getTo() != null && !event.getFrom().getWorld().equals(event.getTo().getWorld())) { // only if world actually changed
- updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
- }
- }
-
- @Override
- public void onPlayerQuit(PlayerQuitEvent event) {
- if (!GroupManager.isLoaded())
- return;
-
- attachments.remove(event.getPlayer());
- }
-
- @Override
- public void onPlayerKick(PlayerKickEvent event) {
- attachments.remove(event.getPlayer());
- }
- }
-
- protected class BukkitEvents extends ServerListener {
-
- @Override
- public void onPluginEnable(PluginEnableEvent event) {
- if (!GroupManager.isLoaded())
- return;
-
- collectPermissions();
- updateAllPlayers();
- }
-
- @Override
- public void onPluginDisable(PluginDisableEvent event) {
- //collectPermissions();
- //updateAllPlayers();
- }
- }
+ protected Map<Player, PermissionAttachment> attachments = new HashMap<Player, PermissionAttachment>();
+ protected LinkedList<Permission> registeredPermissions = new LinkedList<Permission>();
+ protected GroupManager plugin;
+ protected boolean dumpAllPermissions = true;
+ protected boolean dumpMatchedPermissions = true;
+ public boolean player_join = false;
+
+ public BukkitPermissions(GroupManager plugin) {
+ this.plugin = plugin;
+
+ this.collectPermissions();
+ this.registerEvents();
+
+ this.updateAllPlayers();
+
+ GroupManager.logger.info("Superperms support enabled.");
+ }
+
+ private void registerEvents() {
+ PluginManager manager = plugin.getServer().getPluginManager();
+
+ PlayerEvents playerEventListener = new PlayerEvents();
+
+ manager.registerEvent(Event.Type.PLAYER_JOIN, playerEventListener, Event.Priority.Lowest, plugin);
+ manager.registerEvent(Event.Type.PLAYER_KICK, playerEventListener, Event.Priority.Lowest, plugin);
+ manager.registerEvent(Event.Type.PLAYER_QUIT, playerEventListener, Event.Priority.Lowest, plugin);
+
+ manager.registerEvent(Event.Type.PLAYER_RESPAWN, playerEventListener, Event.Priority.Lowest, plugin);
+ manager.registerEvent(Event.Type.PLAYER_TELEPORT, playerEventListener, Event.Priority.Lowest, plugin);
+ manager.registerEvent(Event.Type.PLAYER_PORTAL, playerEventListener, Event.Priority.Lowest, plugin);
+
+ ServerListener serverListener = new BukkitEvents();
+
+ manager.registerEvent(Event.Type.PLUGIN_ENABLE, serverListener, Event.Priority.Normal, plugin);
+ manager.registerEvent(Event.Type.PLUGIN_DISABLE, serverListener, Event.Priority.Normal, plugin);
+ }
+
+ public void collectPermissions() {
+ registeredPermissions.clear();
+ for (Plugin bukkitPlugin : Bukkit.getServer().getPluginManager().getPlugins()) {
+ for (Permission permission : bukkitPlugin.getDescription().getPermissions())
+ registeredPermissions.push(permission);
+ }
+ }
+
+ public void updatePermissions(Player player) {
+ this.updatePermissions(player, null);
+ }
+
+ public void updatePermissions(Player player, String world) {
+ if (player == null || !GroupManager.isLoaded()) {
+ return;
+ }
+
+ if (!this.attachments.containsKey(player)) {
+ this.attachments.put(player, player.addAttachment(plugin));
+ }
+
+ if (world == null) {
+ world = player.getWorld().getName();
+ }
+
+ // All permissions registered with Bukkit for this player
+ PermissionAttachment attachment = this.attachments.get(player);
+
+ OverloadedWorldHolder worldData = plugin.getWorldsHolder().getWorldData(world);
+
+ User user = worldData.getUser(player.getName());
+
+ // clear permissions
+ for (String permission : attachment.getPermissions().keySet())
+ attachment.unsetPermission(permission);
+
+ /*
+ * find matching permissions
+ *
+ * and base bukkit perms if we are set to allow bukkit permissions to
+ * override.
+ */
+ Boolean value = false;
+
+ for (Permission permission : registeredPermissions) {
+
+ PermissionCheckResult result = worldData.getPermissionsHandler().checkFullGMPermission(user, permission.getName(), false);
+
+ // Only check bukkit override IF we don't have the permission
+ // directly.
+ if (result.resultType == PermissionCheckResult.Type.NOTFOUND) {
+ PermissionDefault permDefault = permission.getDefault();
+
+ if ((plugin.getGMConfig().isBukkitPermsOverride()) && ((permDefault == PermissionDefault.TRUE)
+ || ((permDefault == PermissionDefault.NOT_OP) && !player.isOp())
+ || ((permDefault == PermissionDefault.OP) && player.isOp()))) {
+ value = true;
+ } else {
+ value = false;
+ }
+ } else if (result.resultType == PermissionCheckResult.Type.NEGATION) {
+ value = false;
+ } else {
+ value = true;
+ }
+
+ // Set the root permission
+ if ((value == true) || (result.resultType == PermissionCheckResult.Type.NEGATION)) {
+ attachment.setPermission(permission, value);
+ }
+ /*
+ if ((value == true) || (result.resultType == PermissionCheckResult.Type.NOTFOUND)) {
+ // fetch and set all children of this permission node
+ Map<String, Boolean> children = permission.getChildren();
+ if (children != null) {
+ for (String child : children.keySet()) {
+ if (children.get(child))
+ attachment.setPermission(child, value);
+ }
+ }
+ }*/
+
+ }
+
+ // Add any missing permissions for this player (non bukkit plugins and child nodes)
+ List<String> playerPermArray = worldData.getPermissionsHandler().getAllPlayersPermissions(player.getName());
+
+ for (String permission : playerPermArray) {
+ value = true;
+ if (permission.startsWith("-")) {
+ permission = permission.substring(1); // cut off -
+ value = false;
+ }
+
+ if (!attachment.getPermissions().containsKey(permission)) {
+ attachment.setPermission(permission, value);
+ }
+ }
+ player.recalculatePermissions();
+ }
+
+ /**
+ * Returns a map of the ALL child permissions as defined by the supplying plugin
+ * null is empty
+ *
+ * @param node
+ * @return Map of child permissions
+ */
+ public Map<String, Boolean> getAllChildren(String node, List<String> playerPermArray) {
+
+ LinkedList<String> stack = new LinkedList<String>();
+ Map<String, Boolean> alreadyVisited = new HashMap<String, Boolean>();
+ stack.push(node);
+ alreadyVisited.put(node, true);
+
+ while (!stack.isEmpty()) {
+ String now = stack.pop();
+
+ Map<String, Boolean> children = getChildren(now);
+
+ if ((children != null) && (!playerPermArray.contains("-"+now))) {
+ for (String childName : children.keySet()) {
+ if (!alreadyVisited.containsKey(childName)) {
+ stack.push(childName);
+ alreadyVisited.put(childName, children.get(childName));
+ }
+ }
+ }
+ }
+ alreadyVisited.remove(node);
+ if (!alreadyVisited.isEmpty()) return alreadyVisited;
+
+ return null;
+ }
+
+ /**
+ * Returns a map of the child permissions (1 node deep) as defined by the supplying plugin
+ * null is empty
+ *
+ * @param node
+ * @return Map of child permissions
+ */
+ public Map<String, Boolean> getChildren(String node) {
+ for (Permission permission : registeredPermissions) {
+ if (permission.getName().equalsIgnoreCase(node)) {
+ return permission.getChildren();
+ }
+ }
+
+ return null;
+ }
+
+ public List<String> listPerms(Player player) {
+ List<String> perms = new ArrayList<String>();
+
+ /*
+ * // All permissions registered with Bukkit for this player
+ * PermissionAttachment attachment = this.attachments.get(player);
+ *
+ * // List perms for this player perms.add("Attachment Permissions:");
+ * for(Map.Entry<String, Boolean> entry :
+ * attachment.getPermissions().entrySet()){ perms.add(" " +
+ * entry.getKey() + " = " + entry.getValue()); }
+ */
+
+ perms.add("Effective Permissions:");
+ for (PermissionAttachmentInfo info : player.getEffectivePermissions()) {
+ if (info.getValue() == true)
+ perms.add(" " + info.getPermission() + " = " + info.getValue());
+ }
+ return perms;
+ }
+
+ public void updateAllPlayers() {
+ for (Player player : Bukkit.getServer().getOnlinePlayers()) {
+ updatePermissions(player);
+ }
+ }
+
+ protected class PlayerEvents extends PlayerListener {
+
+ @Override
+ public void onPlayerJoin(PlayerJoinEvent event) {
+ player_join = true;
+ Player player = event.getPlayer();
+ // force GM to create the player if they are not already listed.
+ if (plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getName()) != null) {
+ player_join = false;
+ updatePermissions(event.getPlayer());
+ } else
+ player_join = false;
+ }
+
+ @Override
+ public void onPlayerPortal(PlayerPortalEvent event) { // will portal into another world
+ if (event.getTo() != null && !event.getFrom().getWorld().equals(event.getTo().getWorld())) { // only if world actually changed
+ updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
+ }
+ }
+
+ @Override
+ public void onPlayerRespawn(PlayerRespawnEvent event) { // can be respawned in another world
+ updatePermissions(event.getPlayer(), event.getRespawnLocation().getWorld().getName());
+ }
+
+ @Override
+ public void onPlayerTeleport(PlayerTeleportEvent event) { // can be teleported into another world
+ if (event.getTo() != null && !event.getFrom().getWorld().equals(event.getTo().getWorld())) { // only if world actually changed
+ updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
+ }
+ }
+
+ @Override
+ public void onPlayerQuit(PlayerQuitEvent event) {
+ if (!GroupManager.isLoaded())
+ return;
+
+ attachments.remove(event.getPlayer());
+ }
+
+ @Override
+ public void onPlayerKick(PlayerKickEvent event) {
+ attachments.remove(event.getPlayer());
+ }
+ }
+
+ protected class BukkitEvents extends ServerListener {
+
+ @Override
+ public void onPluginEnable(PluginEnableEvent event) {
+ if (!GroupManager.isLoaded())
+ return;
+
+ collectPermissions();
+ updateAllPlayers();
+ }
+
+ @Override
+ public void onPluginDisable(PluginDisableEvent event) {
+ // collectPermissions();
+ // updateAllPlayers();
+ }
+ }
}
\ No newline at end of file diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index a5d1efba9..57b842c82 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -15,8 +15,9 @@ public class EssentialsSpawnPlayerListener extends PlayerListener { private final transient IEssentials ess; - public EssentialsSpawnPlayerListener(IEssentials ess) + public EssentialsSpawnPlayerListener(final IEssentials ess) { + super(); this.ess = ess; } @@ -25,28 +26,24 @@ public class EssentialsSpawnPlayerListener extends PlayerListener { final User user = ess.getUser(event.getPlayer()); - try + if (ess.getSettings().getRespawnAtHome()) { - if (ess.getSettings().getRespawnAtHome()) + Location home = user.getHome(user.getLocation()); + if (home == null) + { + home = user.getBedSpawnLocation(); + } + if (home != null) { - Location home = user.getHome(user.getLocation()); - if (home == null) - { - throw new Exception(); - } event.setRespawnLocation(home); return; } } - catch (Throwable ex) + final Location spawn = ess.getSpawn().getSpawn(user.getGroup()); + if (spawn != null) { + event.setRespawnLocation(spawn); } - Location spawn = ess.getSpawn().getSpawn(user.getGroup()); - if (spawn == null) - { - return; - } - event.setRespawnLocation(spawn); } @Override @@ -54,7 +51,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener { final User user = ess.getUser(event.getPlayer()); - if (!user.isNew()) + if (!user.isNew() || user.getBedSpawnLocation() != null) { return; } diff --git a/EssentialsUpdate/src/org/jibble/pircbot/PircBot.java b/EssentialsUpdate/src/org/jibble/pircbot/PircBot.java index acdf01b46..28148075f 100755 --- a/EssentialsUpdate/src/org/jibble/pircbot/PircBot.java +++ b/EssentialsUpdate/src/org/jibble/pircbot/PircBot.java @@ -774,7 +774,7 @@ public abstract class PircBot implements ReplyConstants { } } - command = command.toUpperCase(); + command = command.toUpperCase(Locale.ENGLISH); if (sourceNick.startsWith(":")) { sourceNick = sourceNick.substring(1); } diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java index 695969378..72bdb113d 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java @@ -187,7 +187,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager final String level = config.getString("log-level", "info"); try { - logLevel = Level.parse(level.toUpperCase()); + logLevel = Level.parse(level.toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException e) { diff --git a/lib/bukkit-1.0.0-R1-SNAPSHOT.jar b/lib/bukkit-1.0.0-R1-SNAPSHOT.jar Binary files differindex 94831e77b..60939e166 100644 --- a/lib/bukkit-1.0.0-R1-SNAPSHOT.jar +++ b/lib/bukkit-1.0.0-R1-SNAPSHOT.jar diff --git a/lib/craftbukkit-1.0.0-SNAPSHOT.jar b/lib/craftbukkit-1.0.0-SNAPSHOT.jar Binary files differindex 208cc9bb3..9285ca484 100644 --- a/lib/craftbukkit-1.0.0-SNAPSHOT.jar +++ b/lib/craftbukkit-1.0.0-SNAPSHOT.jar |