diff options
author | snowleo <schneeleo@gmail.com> | 2011-12-08 05:41:00 +0100 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-12-08 05:41:00 +0100 |
commit | 8d0230d6a8f323749dc0a0fadfcbc226dc4c2ab8 (patch) | |
tree | d40ed60cafcaccce7fc2e27adf3a6cc74a15d7fa | |
parent | 37e5260cda3fa1cbd07f8bbd15506190445e48db (diff) | |
parent | e379ac5d777cff442dcf8eb64ac391565cf1ecb6 (diff) | |
download | Essentials-8d0230d6a8f323749dc0a0fadfcbc226dc4c2ab8.tar Essentials-8d0230d6a8f323749dc0a0fadfcbc226dc4c2ab8.tar.gz Essentials-8d0230d6a8f323749dc0a0fadfcbc226dc4c2ab8.tar.lz Essentials-8d0230d6a8f323749dc0a0fadfcbc226dc4c2ab8.tar.xz Essentials-8d0230d6a8f323749dc0a0fadfcbc226dc4c2ab8.zip |
Merge branch 'refs/heads/master' into release
217 files changed, 4813 insertions, 4142 deletions
diff --git a/BuildAll/nbproject/project.properties b/BuildAll/nbproject/project.properties index dd9ceab91..246ea1240 100644 --- a/BuildAll/nbproject/project.properties +++ b/BuildAll/nbproject/project.properties @@ -81,9 +81,7 @@ javac.source=1.6 javac.target=1.6 javac.test.classpath=\ ${javac.classpath}:\ - ${build.classes.dir}:\ - ${libs.junit.classpath}:\ - ${libs.junit_4.classpath} + ${build.classes.dir} javac.test.processorpath=\ ${javac.test.classpath} javadoc.additionalparam= diff --git a/Essentials/nbproject/project.properties b/Essentials/nbproject/project.properties index 0d7673bbd..59540b809 100644 --- a/Essentials/nbproject/project.properties +++ b/Essentials/nbproject/project.properties @@ -70,7 +70,6 @@ file.reference.craftbukkit-1.0.0-SNAPSHOT.jar=../lib/craftbukkit-1.0.0-SNAPSHOT. file.reference.iCo4.jar=../lib/iCo4.jar file.reference.iCo5.jar=../lib/iCo5.jar file.reference.iCo6.jar=../lib/iCo6.jar -file.reference.junit-4.5.jar=../lib/junit_4/junit-4.5.jar file.reference.lombok-0.10.1.jar=../lib/lombok-0.10.1.jar file.reference.MultiCurrency.jar=../lib/MultiCurrency.jar file.reference.Permissions3.jar=../lib/Permissions3.jar @@ -103,7 +102,7 @@ javac.target=1.6 javac.test.classpath=\ ${javac.classpath}:\ ${build.classes.dir}:\ - ${file.reference.junit-4.5.jar} + ${libs.junit_4.10.classpath} javac.test.processorpath=\ ${javac.test.classpath} javadoc.additionalparam= diff --git a/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java b/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java index 366c86cc6..e75644ad5 100644 --- a/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java +++ b/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java @@ -1,6 +1,8 @@ package com.earth2me.essentials; import java.util.*; +import java.util.logging.Level; +import java.util.logging.Logger; import org.bukkit.command.Command; import org.bukkit.command.PluginCommand; import org.bukkit.command.PluginCommandYamlParser; @@ -9,8 +11,9 @@ import org.bukkit.plugin.Plugin; public class AlternativeCommandsHandler { + private static final Logger LOGGER = Logger.getLogger("Minecraft"); private final transient Map<String, List<PluginCommand>> altcommands = new HashMap<String, List<PluginCommand>>(); - private final transient Map<String, String> executed = new HashMap<String, String>(); + private final transient Map<String, String> disabledList = new HashMap<String, String>(); private final transient IEssentials ess; public AlternativeCommandsHandler(final IEssentials ess) @@ -118,13 +121,17 @@ public class AlternativeCommandsHandler return commands.get(0); } - public void executed(final String label, final String otherlabel) + public void executed(final String label, final String otherLabel) { - executed.put(label, otherlabel); + if (ess.getSettings().isDebug()) + { + LOGGER.log(Level.INFO, "Essentials: Alternative command " + label + " found, using " + otherLabel); + } + disabledList.put(label, otherLabel); } public Map<String, String> disabledCommands() { - return executed; + return disabledList; } } diff --git a/Essentials/src/com/earth2me/essentials/Enchantments.java b/Essentials/src/com/earth2me/essentials/Enchantments.java new file mode 100644 index 000000000..dac789353 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/Enchantments.java @@ -0,0 +1,77 @@ +package com.earth2me.essentials; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.regex.Pattern; +import org.bukkit.enchantments.Enchantment; + + +public class Enchantments +{ + private static final transient Pattern NUMPATTERN = Pattern.compile("\\d+"); + private static final Map<String, Enchantment> ENCHANTMENTS = new HashMap<String, Enchantment>(); + + 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 static Enchantment getByName(String name) { + 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)); + } + return enchantment; + } + + public static Set<Entry<String, Enchantment>> entrySet() + { + return ENCHANTMENTS.entrySet(); + } +} diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index 19073b1aa..10e6f9a4c 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -19,6 +19,7 @@ package com.earth2me.essentials; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.api.Economy; +import com.earth2me.essentials.api.IJails; import com.earth2me.essentials.commands.EssentialsCommand; import com.earth2me.essentials.commands.IEssentialsCommand; import com.earth2me.essentials.commands.NoChargeException; @@ -47,22 +48,24 @@ import org.bukkit.command.PluginCommand; import org.bukkit.entity.Player; import org.bukkit.event.Event.Priority; import org.bukkit.event.Event.Type; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerListener; import org.bukkit.plugin.InvalidDescriptionException; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitScheduler; +import org.yaml.snakeyaml.error.YAMLException; public class Essentials extends JavaPlugin implements IEssentials { - public static final int BUKKIT_VERSION = 1522; + public static final int BUKKIT_VERSION = 1566; private static final Logger LOGGER = Logger.getLogger("Minecraft"); private transient ISettings settings; private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this); - private transient Spawn spawn; - private transient Jail jail; + private transient Jails jails; private transient Warps warps; private transient Worth worth; private transient List<IConf> confList; @@ -112,32 +115,6 @@ public class Essentials extends JavaPlugin implements IEssentials i18n = new I18n(this); i18n.onEnable(); execTimer.mark("I18n1"); - final EssentialsUpgrade upgrade = new EssentialsUpgrade(this); - upgrade.beforeSettings(); - execTimer.mark("Upgrade"); - confList = new ArrayList<IConf>(); - settings = new Settings(this); - confList.add(settings); - execTimer.mark("Settings"); - upgrade.afterSettings(); - execTimer.mark("Upgrade2"); - i18n.updateLocale(settings.getLocale()); - userMap = new UserMap(this); - confList.add(userMap); - execTimer.mark("Init(Usermap)"); - spawn = new Spawn(getServer(), this.getDataFolder()); - confList.add(spawn); - warps = new Warps(getServer(), this.getDataFolder()); - confList.add(warps); - execTimer.mark("Init(Spawn/Warp)"); - worth = new Worth(this.getDataFolder()); - confList.add(worth); - itemDb = new ItemDb(this); - confList.add(itemDb); - execTimer.mark("Init(Worth/ItemDB)"); - reload(); - backup = new Backup(this); - final PluginManager pm = getServer().getPluginManager(); for (Plugin plugin : pm.getPlugins()) { @@ -153,7 +130,10 @@ public class Essentials extends JavaPlugin implements IEssentials final int versionNumber = Integer.parseInt(versionMatch.group(4)); if (versionNumber < BUKKIT_VERSION) { - LOGGER.log(Level.WARNING, _("notRecommendedBukkit")); + LOGGER.log(Level.SEVERE, _("notRecommendedBukkit")); + LOGGER.log(Level.SEVERE, _("requiredBukkit", Integer.toString(BUKKIT_VERSION))); + this.setEnabled(false); + return; } } else @@ -162,7 +142,59 @@ public class Essentials extends JavaPlugin implements IEssentials LOGGER.log(Level.INFO, getServer().getVersion()); LOGGER.log(Level.INFO, getServer().getBukkitVersion()); } - + execTimer.mark("BukkitCheck"); + try + { + final EssentialsUpgrade upgrade = new EssentialsUpgrade(this); + upgrade.beforeSettings(); + execTimer.mark("Upgrade"); + confList = new ArrayList<IConf>(); + settings = new Settings(this); + confList.add(settings); + execTimer.mark("Settings"); + upgrade.afterSettings(); + execTimer.mark("Upgrade2"); + i18n.updateLocale(settings.getLocale()); + userMap = new UserMap(this); + confList.add(userMap); + execTimer.mark("Init(Usermap)"); + warps = new Warps(getServer(), this.getDataFolder()); + confList.add(warps); + execTimer.mark("Init(Spawn/Warp)"); + worth = new Worth(this.getDataFolder()); + confList.add(worth); + itemDb = new ItemDb(this); + confList.add(itemDb); + execTimer.mark("Init(Worth/ItemDB)"); + reload(); + } + catch (YAMLException exception) + { + if (pm.getPlugin("EssentialsUpdate") != null) + { + LOGGER.log(Level.SEVERE, _("essentialsHelp2")); + } + else + { + LOGGER.log(Level.SEVERE, _("essentialsHelp1")); + } + LOGGER.log(Level.SEVERE, exception.toString()); + pm.registerEvent(Type.PLAYER_JOIN, new PlayerListener() + { + @Override + public void onPlayerJoin(PlayerJoinEvent event) + { + event.getPlayer().sendMessage("Essentials failed to load, read the log file."); + } + }, Priority.Low, this); + for (Player player : getServer().getOnlinePlayers()) + { + player.sendMessage("Essentials failed to load, read the log file."); + } + this.setEnabled(false); + return; + } + backup = new Backup(this); permissionsHandler = new PermissionsHandler(this, settings.useBukkitPermissions()); alternativeCommandsHandler = new AlternativeCommandsHandler(this); final EssentialsPluginListener serverListener = new EssentialsPluginListener(this); @@ -182,6 +214,8 @@ public class Essentials extends JavaPlugin implements IEssentials 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_INTERACT, playerListener, Priority.Monitor, this); + pm.registerEvent(Type.PLAYER_PICKUP_ITEM, playerListener, Priority.Low, this); pm.registerEvent(Type.PLAYER_TELEPORT, new ItemDupeFix(), Priority.Monitor, this); final EssentialsBlockListener blockListener = new EssentialsBlockListener(this); @@ -211,16 +245,8 @@ public class Essentials extends JavaPlugin implements IEssentials pm.registerEvent(Type.FOOD_LEVEL_CHANGE, entityListener, Priority.Lowest, this); //TODO: Check if this should be here, and not above before reload() - jail = new Jail(this); - final JailPlayerListener jailPlayerListener = new JailPlayerListener(this); - confList.add(jail); - pm.registerEvent(Type.BLOCK_BREAK, jail, Priority.Low, this); - pm.registerEvent(Type.BLOCK_DAMAGE, jail, Priority.Low, this); - pm.registerEvent(Type.BLOCK_PLACE, jail, Priority.Low, this); - pm.registerEvent(Type.PLAYER_INTERACT, jailPlayerListener, Priority.Low, this); - pm.registerEvent(Type.PLAYER_RESPAWN, jailPlayerListener, Priority.High, this); - pm.registerEvent(Type.PLAYER_TELEPORT, jailPlayerListener, Priority.High, this); - pm.registerEvent(Type.PLAYER_JOIN, jailPlayerListener, Priority.High, this); + jails = new Jails(this); + confList.add(jails); pm.registerEvent(Type.ENTITY_EXPLODE, tntListener, Priority.High, this); @@ -261,11 +287,11 @@ public class Essentials extends JavaPlugin implements IEssentials @Override public boolean onCommand(final CommandSender sender, final Command command, final String commandLabel, final String[] args) { - return onCommandEssentials(sender, command, commandLabel, args, Essentials.class.getClassLoader(), "com.earth2me.essentials.commands.Command", "essentials."); + return onCommandEssentials(sender, command, commandLabel, args, Essentials.class.getClassLoader(), "com.earth2me.essentials.commands.Command", "essentials.", null); } @Override - public boolean onCommandEssentials(final CommandSender sender, final Command command, final String commandLabel, final String[] args, final ClassLoader classLoader, final String commandPath, final String permissionPrefix) + public boolean onCommandEssentials(final CommandSender sender, final Command command, final String commandLabel, final String[] args, final ClassLoader classLoader, final String commandPath, final String permissionPrefix, final IEssentialsModule module) { // Allow plugins to override the command via onCommand if (!getSettings().isCommandOverridden(command.getName()) && !commandLabel.startsWith("e")) @@ -274,7 +300,6 @@ public class Essentials extends JavaPlugin implements IEssentials if (pc != null) { alternativeCommandsHandler.executed(commandLabel, pc.getLabel()); - LOGGER.log(Level.FINE,"Essentials: Alternative command " + commandLabel + " found, using " + pc.getLabel()); return pc.execute(sender, commandLabel, args); } } @@ -309,6 +334,7 @@ public class Essentials extends JavaPlugin implements IEssentials { cmd = (IEssentialsCommand)classLoader.loadClass(commandPath + command.getName()).newInstance(); cmd.setEssentials(this); + cmd.setEssentialsModule(module); } catch (Exception ex) { @@ -369,11 +395,9 @@ public class Essentials extends JavaPlugin implements IEssentials public void showError(final CommandSender sender, final Throwable exception, final String commandLabel) { sender.sendMessage(_("errorWithMessage", exception.getMessage())); - final LogRecord logRecord = new LogRecord(Level.WARNING, _("errorCallingCommand", commandLabel)); - logRecord.setThrown(exception); if (getSettings().isDebug()) { - LOGGER.log(logRecord); + LOGGER.log(Level.WARNING, _("errorCallingCommand", commandLabel), exception); } } @@ -384,9 +408,9 @@ public class Essentials extends JavaPlugin implements IEssentials } @Override - public Jail getJail() + public IJails getJails() { - return jail; + return jails; } @Override @@ -408,12 +432,6 @@ public class Essentials extends JavaPlugin implements IEssentials } @Override - public Spawn getSpawn() - { - return spawn; - } - - @Override public User getUser(final Object base) { if (base instanceof Player) @@ -443,7 +461,9 @@ public class Essentials extends JavaPlugin implements IEssentials if (user == null) { user = new User(base, this); - } else { + } + else + { user.update(base); } return user; @@ -559,4 +579,10 @@ public class Essentials extends JavaPlugin implements IEssentials { return userMap; } + + @Override + public I18n getI18n() + { + return i18n; + } } diff --git a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java index 88e536015..ceda6a60c 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java @@ -28,69 +28,9 @@ public class EssentialsBlockListener extends BlockListener final User user = ess.getUser(event.getPlayer()); // Do not rely on getItemInHand(); // http://leaky.bukkit.org/issues/663 - final ItemStack is = new ItemStack(event.getBlockPlaced().getType(), 1, (short)0, event.getBlockPlaced().getData()); - switch (is.getType()) + final ItemStack is = Util.convertBlockToItem(event.getBlockPlaced()); + if (is == null) { - case WOODEN_DOOR: - is.setType(Material.WOOD_DOOR); - is.setDurability((short)0); - break; - case IRON_DOOR_BLOCK: - is.setType(Material.IRON_DOOR); - is.setDurability((short)0); - break; - case SIGN_POST: - case WALL_SIGN: - is.setType(Material.SIGN); - is.setDurability((short)0); - break; - case CROPS: - is.setType(Material.SEEDS); - is.setDurability((short)0); - break; - case CAKE_BLOCK: - is.setType(Material.CAKE); - is.setDurability((short)0); - break; - case BED_BLOCK: - is.setType(Material.BED); - is.setDurability((short)0); - break; - case REDSTONE_WIRE: - is.setType(Material.REDSTONE); - is.setDurability((short)0); - break; - case REDSTONE_TORCH_OFF: - case REDSTONE_TORCH_ON: - is.setType(Material.REDSTONE_TORCH_ON); - is.setDurability((short)0); - break; - case DIODE_BLOCK_OFF: - case DIODE_BLOCK_ON: - is.setType(Material.DIODE); - is.setDurability((short)0); - break; - case DOUBLE_STEP: - is.setType(Material.STEP); - break; - case TORCH: - case RAILS: - case LADDER: - case WOOD_STAIRS: - case COBBLESTONE_STAIRS: - case LEVER: - case STONE_BUTTON: - case FURNACE: - case DISPENSER: - case PUMPKIN: - case JACK_O_LANTERN: - case WOOD_PLATE: - case STONE_PLATE: - case PISTON_STICKY_BASE: - case PISTON_BASE: - is.setDurability((short)0); - break; - case FIRE: return; } boolean unlimitedForUser = user.hasUnlimited(is); @@ -99,7 +39,7 @@ public class EssentialsBlockListener extends BlockListener ess.scheduleSyncDelayedTask( new Runnable() { - @Override + @Override public void run() { user.getInventory().addItem(is); diff --git a/Essentials/src/com/earth2me/essentials/EssentialsConf.java b/Essentials/src/com/earth2me/essentials/EssentialsConf.java index 8b8b79279..35252532f 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsConf.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsConf.java @@ -2,7 +2,6 @@ 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; @@ -112,7 +111,7 @@ public class EssentialsConf extends Configuration } catch (RuntimeException e) { - LOGGER.log(Level.INFO, "File: " + configFile.toString()); + LOGGER.log(Level.SEVERE, "File broken: " + configFile.toString()); throw e; } diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 537a2de06..a90e98013 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -1,7 +1,7 @@ package com.earth2me.essentials; -import com.earth2me.essentials.craftbukkit.EnchantmentFix; import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.craftbukkit.SetBed; import com.earth2me.essentials.textreader.IText; import com.earth2me.essentials.textreader.KeywordReplacer; import com.earth2me.essentials.textreader.TextInput; @@ -17,8 +17,11 @@ 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.event.player.PlayerTeleportEvent; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.inventory.ItemStack; @@ -115,7 +118,7 @@ public class EssentialsPlayerListener extends PlayerListener } if (user.getSavedInventory() != null) { - EnchantmentFix.setContents(user.getInventory(), user.getSavedInventory()); + user.getInventory().setContents(user.getSavedInventory()); user.setSavedInventory(null); } user.updateActivity(false); @@ -229,7 +232,14 @@ public class EssentialsPlayerListener extends PlayerListener { return; } + final User user = ess.getUser(event.getPlayer()); + //There is TeleportCause.COMMMAND but plugins have to actively pass the cause in on their teleports. + if ((event.getCause() == TeleportCause.PLUGIN || event.getCause() == TeleportCause.COMMAND) && ess.getSettings().registerBackInListener()) + { + user.setLastLocation(); + } + if (ess.getSettings().changeDisplayName()) { user.setDisplayNick(); @@ -354,4 +364,36 @@ 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().getUpdateBedAtDaytime() && event.getClickedBlock().getType() == Material.BED_BLOCK) + { + SetBed.setBed(event.getPlayer(), event.getClickedBlock()); + } + } + + @Override + public void onPlayerPickupItem(PlayerPickupItemEvent event) + { + if (event.isCancelled() || !ess.getSettings().getDisableItemPickupWhileAfk()) + { + return; + } + final User user = ess.getUser(event.getPlayer()); + if (user.isAfk()) + { + event.setCancelled(true); + } + } } diff --git a/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java b/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java index 9070e25ac..ae444af2e 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java @@ -1,5 +1,8 @@ package com.earth2me.essentials; +import com.earth2me.essentials.craftbukkit.FakeWorld; +import com.earth2me.essentials.settings.Spawns; +import com.earth2me.essentials.storage.YamlStorageWriter; import static com.earth2me.essentials.I18n._; import java.io.*; import java.math.BigInteger; @@ -681,6 +684,100 @@ public class EssentialsUpgrade } } + private void updateSpawnsToNewSpawnsConfig() + { + if (doneFile.getBoolean("updateSpawnsToNewSpawnsConfig", false)) + { + return; + } + final File configFile = new File(ess.getDataFolder(), "spawn.yml"); + if (configFile.exists()) + { + + final EssentialsConf config = new EssentialsConf(configFile); + try + { + config.load(); + if (!config.hasProperty("spawns")) + { + final Spawns spawns = new Spawns(); + List<String> keys = config.getKeys(); + for (String group : keys) + { + Location loc = getFakeLocation(config, group); + spawns.getSpawns().put(group.toLowerCase(Locale.ENGLISH), loc); + } + if (!configFile.renameTo(new File(ess.getDataFolder(), "spawn.yml.old"))) + { + throw new Exception(_("fileRenameError", "spawn.yml")); + } + PrintWriter writer = new PrintWriter(configFile); + try + { + new YamlStorageWriter(writer).save(spawns); + } + finally + { + writer.close(); + } + } + } + catch (Exception ex) + { + Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex); + } + } + doneFile.setProperty("updateSpawnsToNewSpawnsConfig", true); + doneFile.save(); + } + + private void updateJailsToNewJailsConfig() + { + if (doneFile.getBoolean("updateJailsToNewJailsConfig", false)) + { + return; + } + final File configFile = new File(ess.getDataFolder(), "jail.yml"); + if (configFile.exists()) + { + + final EssentialsConf config = new EssentialsConf(configFile); + try + { + config.load(); + if (!config.hasProperty("jails")) + { + final com.earth2me.essentials.settings.Jails jails = new com.earth2me.essentials.settings.Jails(); + List<String> keys = config.getKeys(); + for (String jailName : keys) + { + Location loc = getFakeLocation(config, jailName); + jails.getJails().put(jailName.toLowerCase(Locale.ENGLISH), loc); + } + if (!configFile.renameTo(new File(ess.getDataFolder(), "jail.yml.old"))) + { + throw new Exception(_("fileRenameError", "jail.yml")); + } + PrintWriter writer = new PrintWriter(configFile); + try + { + new YamlStorageWriter(writer).save(jails); + } + finally + { + writer.close(); + } + } + } + catch (Exception ex) + { + Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex); + } + } + doneFile.setProperty("updateJailsToNewJailsConfig", true); + doneFile.save(); + } + public void beforeSettings() { if (!ess.getDataFolder().exists()) @@ -701,5 +798,7 @@ public class EssentialsUpgrade updateUsersPowerToolsFormat(); updateUsersHomesFormat(); deleteOldItemsCsv(); + updateSpawnsToNewSpawnsConfig(); + updateJailsToNewJailsConfig(); } } diff --git a/Essentials/src/com/earth2me/essentials/I18n.java b/Essentials/src/com/earth2me/essentials/I18n.java index 4e2b033e6..63fdcc065 100644 --- a/Essentials/src/com/earth2me/essentials/I18n.java +++ b/Essentials/src/com/earth2me/essentials/I18n.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import com.earth2me.essentials.api.II18n; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -12,7 +13,7 @@ import java.util.logging.Level; import java.util.logging.Logger; -public class I18n +public class I18n implements II18n { private static I18n instance; private static final String MESSAGES = "messages"; @@ -27,7 +28,7 @@ public class I18n public I18n(final IEssentials ess) { this.ess = ess; - customBundle = ResourceBundle.getBundle(MESSAGES, defaultLocale); + customBundle = ResourceBundle.getBundle(MESSAGES, defaultLocale, new FileResClassLoader(I18n.class.getClassLoader(), ess)); localeBundle = ResourceBundle.getBundle(MESSAGES, defaultLocale); defaultBundle = ResourceBundle.getBundle(MESSAGES, Locale.ENGLISH); } diff --git a/Essentials/src/com/earth2me/essentials/IConf.java b/Essentials/src/com/earth2me/essentials/IConf.java index a523f8638..580e6232f 100644 --- a/Essentials/src/com/earth2me/essentials/IConf.java +++ b/Essentials/src/com/earth2me/essentials/IConf.java @@ -1,5 +1,9 @@ package com.earth2me.essentials; +/** + * @deprecated New interface will be IReload in api package + */ +@Deprecated public interface IConf { public void reloadConfig(); } diff --git a/Essentials/src/com/earth2me/essentials/IEssentials.java b/Essentials/src/com/earth2me/essentials/IEssentials.java index ef54b0776..20c6c300e 100644 --- a/Essentials/src/com/earth2me/essentials/IEssentials.java +++ b/Essentials/src/com/earth2me/essentials/IEssentials.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import com.earth2me.essentials.api.IJails; import com.earth2me.essentials.perm.PermissionsHandler; import com.earth2me.essentials.register.payment.Methods; import org.bukkit.World; @@ -8,17 +9,22 @@ import org.bukkit.command.CommandSender; import org.bukkit.plugin.Plugin; import org.bukkit.scheduler.BukkitScheduler; - +/** + * @deprecated This will be moved to the api package soon + */ +@Deprecated public interface IEssentials extends Plugin { void addReloadListener(IConf listener); void reload(); - boolean onCommandEssentials(CommandSender sender, Command command, String commandLabel, String[] args, ClassLoader classLoader, String commandPath, String permissionPrefix); + boolean onCommandEssentials(CommandSender sender, Command command, String commandLabel, String[] args, ClassLoader classLoader, String commandPath, String permissionPrefix, IEssentialsModule module); User getUser(Object base); + I18n getI18n(); + User getOfflineUser(String name); World getWorld(String name); @@ -29,7 +35,7 @@ public interface IEssentials extends Plugin BukkitScheduler getScheduler(); - Jail getJail(); + IJails getJails(); Warps getWarps(); @@ -37,8 +43,6 @@ public interface IEssentials extends Plugin Backup getBackup(); - Spawn getSpawn(); - Methods getPaymentMethod(); int scheduleAsyncDelayedTask(Runnable run); @@ -52,7 +56,7 @@ public interface IEssentials extends Plugin TNTExplodeListener getTNTListener(); PermissionsHandler getPermissionsHandler(); - + AlternativeCommandsHandler getAlternativeCommandsHandler(); void showError(final CommandSender sender, final Throwable exception, final String commandLabel); diff --git a/Essentials/src/com/earth2me/essentials/IEssentialsModule.java b/Essentials/src/com/earth2me/essentials/IEssentialsModule.java new file mode 100644 index 000000000..69a1a494c --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/IEssentialsModule.java @@ -0,0 +1,6 @@ +package com.earth2me.essentials; + + +public interface IEssentialsModule +{ +} diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index 1b71f30e4..97c5070b5 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.Map; import java.util.Set; import org.bukkit.ChatColor; +import org.bukkit.event.Event.Priority; public interface ISettings extends IConf @@ -32,6 +33,8 @@ public interface ISettings extends IConf String getCurrencySymbol(); int getOversizedStackSize(); + + int getDefaultStackSize(); double getHealCooldown(); @@ -136,4 +139,16 @@ public interface ISettings extends IConf public void setDebug(boolean debug); Set<String> getNoGodWorlds(); + + boolean getUpdateBedAtDaytime(); + + boolean getRepairEnchanted(); + + boolean getIsWorldTeleportPermissions(); + + boolean registerBackInListener(); + + public boolean getDisableItemPickupWhileAfk(); + + public Priority getRespawnPriority(); } diff --git a/Essentials/src/com/earth2me/essentials/IUser.java b/Essentials/src/com/earth2me/essentials/IUser.java index 27f95430c..09d3c294d 100644 --- a/Essentials/src/com/earth2me/essentials/IUser.java +++ b/Essentials/src/com/earth2me/essentials/IUser.java @@ -7,6 +7,10 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.PlayerInventory; +/** + * @deprecated This will be moved to the api package soon + */ +@Deprecated public interface IUser { int getHealth(); @@ -56,4 +60,12 @@ public interface IUser String getDisplayName(); boolean isHidden(); + + Teleport getTeleport(); + + void setJail(String jail); + + public int getTotalExperience(); + + public void setTotalExperience(int l); } diff --git a/Essentials/src/com/earth2me/essentials/ItemDb.java b/Essentials/src/com/earth2me/essentials/ItemDb.java index 021e316a8..e3df50bab 100644 --- a/Essentials/src/com/earth2me/essentials/ItemDb.java +++ b/Essentials/src/com/earth2me/essentials/ItemDb.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import com.earth2me.essentials.api.IItemDb; import static com.earth2me.essentials.I18n._; import java.util.HashMap; import java.util.List; @@ -9,7 +10,7 @@ import org.bukkit.Material; import org.bukkit.inventory.ItemStack; -public class ItemDb implements IConf +public class ItemDb implements IConf, IItemDb { private final transient IEssentials ess; diff --git a/Essentials/src/com/earth2me/essentials/Jail.java b/Essentials/src/com/earth2me/essentials/Jail.java deleted file mode 100644 index fbbb4376e..000000000 --- a/Essentials/src/com/earth2me/essentials/Jail.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.earth2me.essentials; - -import static com.earth2me.essentials.I18n._; -import java.io.File; -import java.util.List; -import java.util.Locale; -import java.util.logging.Logger; -import org.bukkit.Location; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockDamageEvent; -import org.bukkit.event.block.BlockListener; -import org.bukkit.event.block.BlockPlaceEvent; - - -public class Jail extends BlockListener implements IConf -{ - private static final Logger logger = Logger.getLogger("Minecraft"); - private final EssentialsConf config; - private final IEssentials ess; - - public Jail(IEssentials ess) - { - this.ess = ess; - config = new EssentialsConf(new File(ess.getDataFolder(), "jail.yml")); - config.load(); - } - - public void setJail(Location loc, String jailName) throws Exception - { - config.setProperty(jailName.toLowerCase(Locale.ENGLISH), loc); - config.save(); - } - - public Location getJail(String jailName) throws Exception - { - if (jailName == null || config.getProperty(jailName.toLowerCase(Locale.ENGLISH)) == null) - { - throw new Exception(_("jailNotExist")); - } - - Location loc = config.getLocation(jailName.toLowerCase(Locale.ENGLISH), ess.getServer()); - return loc; - } - - public void sendToJail(User user, String jail) throws Exception - { - if (!(user.getBase() instanceof OfflinePlayer)) - { - user.getTeleport().now(getJail(jail)); - } - user.setJail(jail); - } - - public void delJail(String jail) throws Exception - { - config.removeProperty(jail.toLowerCase(Locale.ENGLISH)); - config.save(); - } - - public List<String> getJails() throws Exception - { - return config.getKeys(null); - } - - @Override - public void reloadConfig() - { - config.load(); - } - - @Override - public void onBlockBreak(BlockBreakEvent event) - { - User user = ess.getUser(event.getPlayer()); - if (user.isJailed()) - { - event.setCancelled(true); - } - } - - @Override - public void onBlockPlace(BlockPlaceEvent event) - { - User user = ess.getUser(event.getPlayer()); - if (user.isJailed()) - { - event.setCancelled(true); - } - } - - @Override - public void onBlockDamage(BlockDamageEvent event) - { - User user = ess.getUser(event.getPlayer()); - if (user.isJailed()) - { - event.setCancelled(true); - } - } -} diff --git a/Essentials/src/com/earth2me/essentials/JailPlayerListener.java b/Essentials/src/com/earth2me/essentials/JailPlayerListener.java deleted file mode 100644 index ed632b1ad..000000000 --- a/Essentials/src/com/earth2me/essentials/JailPlayerListener.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.earth2me.essentials; - -import static com.earth2me.essentials.I18n._; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.bukkit.event.player.*; - - -public class JailPlayerListener extends PlayerListener -{ - private static final Logger LOGGER = Logger.getLogger("Minecraft"); - private final IEssentials ess; - - public JailPlayerListener(IEssentials parent) - { - this.ess = parent; - } - - @Override - public void onPlayerInteract(PlayerInteractEvent event) - { - final User user = ess.getUser(event.getPlayer()); - if (user.isJailed()) - { - event.setCancelled(true); - } - } - - @Override - public void onPlayerRespawn(PlayerRespawnEvent event) - { - final User user = ess.getUser(event.getPlayer()); - if (user.isJailed() && user.getJail() != null && !user.getJail().isEmpty()) - { - try - { - event.setRespawnLocation(ess.getJail().getJail(user.getJail())); - } - catch (Exception ex) - { - } - } - } - - @Override - public void onPlayerTeleport(PlayerTeleportEvent event) - { - final User user = ess.getUser(event.getPlayer()); - if (!user.isJailed() || user.getJail() == null || user.getJail().isEmpty()) - { - return; - } - try - { - event.setTo(ess.getJail().getJail(user.getJail())); - } - catch (Exception ex) - { - LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex); - } - user.sendMessage(_("jailMessage")); - } - - @Override - public void onPlayerJoin(final PlayerJoinEvent event) - { - User u = ess.getUser(event.getPlayer()); - if (u.isJailed()) - { - try - { - ess.getJail().sendToJail(u, u.getJail()); - } - catch (Exception ex) - { - LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex); - } - u.sendMessage(_("jailMessage")); - } - } -} diff --git a/Essentials/src/com/earth2me/essentials/Jails.java b/Essentials/src/com/earth2me/essentials/Jails.java new file mode 100644 index 000000000..4c1090c5c --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/Jails.java @@ -0,0 +1,248 @@ +package com.earth2me.essentials; + +import com.earth2me.essentials.api.IJails; +import com.earth2me.essentials.storage.AsyncStorageObjectHolder; +import static com.earth2me.essentials.I18n._; +import java.io.File; +import java.util.*; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.event.Event.Priority; +import org.bukkit.event.Event.Type; +import org.bukkit.event.block.*; +import org.bukkit.event.player.*; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; +import org.bukkit.plugin.PluginManager; + + +public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.settings.Jails> implements IJails +{ + private static final transient Logger LOGGER = Bukkit.getLogger(); + + public Jails(final IEssentials ess) + { + super(ess, com.earth2me.essentials.settings.Jails.class); + reloadConfig(); + registerListeners(); + } + + private void registerListeners() + { + final PluginManager pluginManager = ess.getServer().getPluginManager(); + final JailBlockListener blockListener = new JailBlockListener(); + final JailPlayerListener playerListener = new JailPlayerListener(); + pluginManager.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Low, ess); + pluginManager.registerEvent(Type.BLOCK_DAMAGE, blockListener, Priority.Low, ess); + pluginManager.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Low, ess); + pluginManager.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.Low, ess); + pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, Priority.High, ess); + pluginManager.registerEvent(Type.PLAYER_TELEPORT, playerListener, Priority.High, ess); + pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.High, ess); + } + + @Override + public File getStorageFile() + { + return new File(ess.getDataFolder(), "jail.yml"); + } + + @Override + public Location getJail(final String jailName) throws Exception + { + acquireReadLock(); + try + { + if (getData().getJails() == null || jailName == null + || !getData().getJails().containsKey(jailName.toLowerCase(Locale.ENGLISH))) + { + throw new Exception(_("jailNotExist")); + } + return getData().getJails().get(jailName.toLowerCase(Locale.ENGLISH)); + } + finally + { + unlock(); + } + } + + @Override + public Collection<String> getList() throws Exception + { + acquireReadLock(); + try + { + if (getData().getJails() == null) + { + return Collections.emptyList(); + } + return new ArrayList<String>(getData().getJails().keySet()); + } + finally + { + unlock(); + } + } + + @Override + public void removeJail(final String jail) throws Exception + { + acquireWriteLock(); + try + { + if (getData().getJails() == null) + { + return; + } + getData().getJails().remove(jail.toLowerCase(Locale.ENGLISH)); + } + finally + { + unlock(); + } + } + + @Override + public void sendToJail(final IUser user, final String jail) throws Exception + { + acquireReadLock(); + try + { + if (!(user.getBase() instanceof OfflinePlayer)) + { + user.getTeleport().now(getJail(jail), false, TeleportCause.COMMAND); + } + user.setJail(jail); + } + finally + { + unlock(); + } + } + + @Override + public void setJail(final String jailName, final Location loc) throws Exception + { + acquireWriteLock(); + try + { + if (getData().getJails() == null) + { + getData().setJails(new HashMap<String, Location>()); + } + getData().getJails().put(jailName.toLowerCase(Locale.ENGLISH), loc); + } + finally + { + unlock(); + } + } + + + private class JailBlockListener extends BlockListener + { + @Override + public void onBlockBreak(final BlockBreakEvent event) + { + final User user = ess.getUser(event.getPlayer()); + if (user.isJailed()) + { + event.setCancelled(true); + } + } + + @Override + public void onBlockPlace(final BlockPlaceEvent event) + { + final User user = ess.getUser(event.getPlayer()); + if (user.isJailed()) + { + event.setCancelled(true); + } + } + + @Override + public void onBlockDamage(final BlockDamageEvent event) + { + final User user = ess.getUser(event.getPlayer()); + if (user.isJailed()) + { + event.setCancelled(true); + } + } + } + + + private class JailPlayerListener extends PlayerListener + { + @Override + public void onPlayerInteract(final PlayerInteractEvent event) + { + final User user = ess.getUser(event.getPlayer()); + if (user.isJailed()) + { + event.setCancelled(true); + } + } + + @Override + public void onPlayerRespawn(final PlayerRespawnEvent event) + { + final User user = ess.getUser(event.getPlayer()); + if (!user.isJailed() || user.getJail() == null || user.getJail().isEmpty()) + { + return; + } + + try + { + event.setRespawnLocation(getJail(user.getJail())); + } + catch (Exception ex) + { + LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex); + } + } + + @Override + public void onPlayerTeleport(final PlayerTeleportEvent event) + { + final User user = ess.getUser(event.getPlayer()); + if (!user.isJailed() || user.getJail() == null || user.getJail().isEmpty()) + { + return; + } + + try + { + event.setTo(getJail(user.getJail())); + } + catch (Exception ex) + { + LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex); + } + user.sendMessage(_("jailMessage")); + } + + @Override + public void onPlayerJoin(final PlayerJoinEvent event) + { + final User user = ess.getUser(event.getPlayer()); + if (!user.isJailed() || user.getJail() == null || user.getJail().isEmpty()) + { + return; + } + + try + { + sendToJail(user, user.getJail()); + } + catch (Exception ex) + { + LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex); + } + user.sendMessage(_("jailMessage")); + } + } +} diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java index deccf6516..45359a837 100644 --- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java +++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java @@ -1,10 +1,10 @@ package com.earth2me.essentials; +import com.earth2me.essentials.craftbukkit.OfflineBedLocation; 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; @@ -12,6 +12,7 @@ import org.bukkit.*; import org.bukkit.block.Block; import org.bukkit.entity.*; import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import org.bukkit.map.MapView; @@ -741,7 +742,7 @@ public class OfflinePlayer implements Player @Override public Location getBedSpawnLocation() { - throw new UnsupportedOperationException("Not supported yet."); + return OfflineBedLocation.getBedLocation(base.getName(), ess); } @Override @@ -785,4 +786,34 @@ public class OfflinePlayer implements Player { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public void giveExp(int i) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public float getExp() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setExp(float f) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean teleport(Location lctn, TeleportCause tc) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean teleport(Entity entity, TeleportCause tc) + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index 961b0b9b6..d374e5130 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -3,16 +3,11 @@ package com.earth2me.essentials; 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.*; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.ChatColor; +import org.bukkit.event.Event.Priority; import org.bukkit.inventory.ItemStack; @@ -37,6 +32,12 @@ public class Settings implements ISettings } @Override + public boolean getUpdateBedAtDaytime() + { + return config.getBoolean("update-bed-at-daytime", true); + } + + @Override public List<String> getMultipleHomes() { return config.getKeys("sethome-multiple"); @@ -88,6 +89,12 @@ public class Settings implements ISettings } @Override + public int getDefaultStackSize() + { + return config.getInt("default-stack-size", -1); + } + + @Override public int getStartingBalance() { return config.getInt("starting-balance", 0); @@ -332,7 +339,7 @@ public class Settings implements ISettings public void reloadConfig() { config.load(); - noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds",Collections.<String>emptyList())); + noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds", Collections.<String>emptyList())); } @Override @@ -535,13 +542,12 @@ public class Settings implements ISettings { return config.getBoolean("death-messages", true); } - - Set <String> noGodWorlds = new HashSet<String>(); + Set<String> noGodWorlds = new HashSet<String>(); + @Override public Set<String> getNoGodWorlds() { return noGodWorlds; - } @Override @@ -549,4 +555,55 @@ public class Settings implements ISettings { this.debug = debug; } + + @Override + public boolean getRepairEnchanted() + { + return config.getBoolean("repair-enchanted", true); + } + + @Override + public boolean getIsWorldTeleportPermissions() + { + return config.getBoolean("world-teleport-permissions", false); + } + + @Override + public boolean registerBackInListener() + { + return config.getBoolean("register-back-in-listener", false); + } + + @Override + public boolean getDisableItemPickupWhileAfk() + { + return config.getBoolean("disable-item-pickup-while-afk", true); + } + + @Override + public Priority getRespawnPriority() + { + String priority = config.getString("respawn-listener-priority", "normal").toLowerCase(Locale.ENGLISH); + if ("lowest".equals(priority)) + { + return Priority.Lowest; + } + if ("low".equals(priority)) + { + return Priority.Low; + } + if ("normal".equals(priority)) + { + return Priority.Normal; + } + if ("high".equals(priority)) + { + return Priority.High; + } + if ("highest".equals(priority)) + { + return Priority.Highest; + } + return Priority.Normal; + } } diff --git a/Essentials/src/com/earth2me/essentials/Spawn.java b/Essentials/src/com/earth2me/essentials/Spawn.java deleted file mode 100644 index ab2d21c03..000000000 --- a/Essentials/src/com/earth2me/essentials/Spawn.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.earth2me.essentials; - -import java.io.File; -import java.util.HashMap; -import java.util.Map; -import java.util.logging.Logger; -import org.bukkit.Location; -import org.bukkit.Server; -import org.bukkit.World; -import org.bukkit.World.Environment; - - -public class Spawn implements IConf -{ - private static final Logger logger = Logger.getLogger("Minecraft"); - private final EssentialsConf config; - private final Server server; - - public Spawn(Server server, File dataFolder) - { - File configFile = new File(dataFolder, "spawn.yml"); - this.server = server; - config = new EssentialsConf(configFile); - config.load(); - } - - public void setSpawn(Location loc, String group) - { - Map<String, Object> map = new HashMap<String, Object>(); - map.put("world", loc.getWorld().getName()); - map.put("x", loc.getX()); - map.put("y", loc.getY()); - map.put("z", loc.getZ()); - map.put("yaw", loc.getYaw()); - map.put("pitch", loc.getPitch()); - config.setProperty(group, map); - config.save(); - - if ("default".equals(group)) - { - loc.getWorld().setSpawnLocation(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); - } - } - - public Location getSpawn(String group) - { - if (config.getProperty(group) == null) - { - group = "default"; - } - if (config.getProperty(group) == null) - { - for (World w : server.getWorlds()) - { - if (w.getEnvironment() != Environment.NORMAL) - { - continue; - } - return w.getSpawnLocation(); - } - } - String worldId = config.getString(group + ".world", ""); - World world = server.getWorlds().get(server.getWorlds().size() > 1 ? 1 : 0); - for (World w : server.getWorlds()) - { - if (w.getEnvironment() != Environment.NORMAL) - { - continue; - } - world = w; - break; - } - for (World w : server.getWorlds()) - { - if (!w.getName().equals(worldId)) - { - continue; - } - world = w; - break; - } - - double x = config.getDouble(group + ".x", config.getDouble("default.x", 0)); - double y = config.getDouble(group + ".y", config.getDouble("default.y", 0)); - double z = config.getDouble(group + ".z", config.getDouble("default.z", 0)); - float yaw = (float)config.getDouble(group + ".yaw", config.getDouble("default.yaw", 0)); - float pitch = (float)config.getDouble(group + ".pitch", config.getDouble("default.pitch", 0)); - Location retval = new Location(world, x, y, z, yaw, pitch); - - if (y < 1) - { - retval.setY(world.getHighestBlockYAt(retval)); - } - - return retval; - } - - @Override - public void reloadConfig() - { - config.load(); - } -} diff --git a/Essentials/src/com/earth2me/essentials/TargetBlock.java b/Essentials/src/com/earth2me/essentials/TargetBlock.java deleted file mode 100644 index fb6bfabb6..000000000 --- a/Essentials/src/com/earth2me/essentials/TargetBlock.java +++ /dev/null @@ -1,527 +0,0 @@ -package com.earth2me.essentials; - -import java.util.List; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; - - -/** - * Original authors: toi & Raphfrk - */ -@Deprecated -public class TargetBlock -{ - private transient final Location location; - private transient final double viewHeight; - private transient final int maxDistance; - private transient final int[] blockToIgnore; - private transient final double checkDistance; - private transient double curDistance; - private transient double targetPositionX; - private transient double targetPositionY; - private transient double targetPositionZ; - private transient int itargetPositionX; - private transient int itargetPositionY; - private transient int itargetPositionZ; - private transient int prevPositionX; - private transient int prevPositionY; - private transient int prevPositionZ; - private transient final double offsetX; - private transient final double offsetY; - private transient final double offsetZ; - - /** - * Constructor requiring a player, uses default values - * - * @param player Player to work with - */ - public TargetBlock(final Player player) - { - this(player.getLocation(), 300, 1.65, 0.2, null); - } - - /** - * Constructor requiring a location, uses default values - * - * @param loc Location to work with - */ - public TargetBlock(final Location loc) - { - this(loc, 300, 0, 0.2, null); - } - - /** - * Constructor requiring a player, max distance and a checking distance - * - * @param player Player to work with - * @param maxDistance How far it checks for blocks - * @param checkDistance How often to check for blocks, the smaller the more precise - */ - public TargetBlock(final Player player, final int maxDistance, final double checkDistance) - { - this(player.getLocation(), maxDistance, 1.65, checkDistance, null); - } - - /** - * Constructor requiring a location, max distance and a checking distance - * - * @param loc What location to work with - * @param maxDistance How far it checks for blocks - * @param checkDistance How often to check for blocks, the smaller the more precise - */ - public TargetBlock(final Location loc, final int maxDistance, final double checkDistance) - { - this(loc, maxDistance, 0, checkDistance, null); - } - - /** - * Constructor requiring a player, max distance, checking distance and an array of blocks to ignore - * - * @param player What player to work with - * @param maxDistance How far it checks for blocks - * @param checkDistance How often to check for blocks, the smaller the more precise - * @param blocksToIgnore Integer array of what block ids to ignore while checking for viable targets - */ - public TargetBlock(final Player player, final int maxDistance, final double checkDistance, final int[] blocksToIgnore) - { - this(player.getLocation(), maxDistance, 1.65, checkDistance, blocksToIgnore); - } - - /** - * Constructor requiring a location, max distance, checking distance and an array of blocks to ignore - * - * @param loc What location to work with - * @param maxDistance How far it checks for blocks - * @param checkDistance How often to check for blocks, the smaller the more precise - * @param blocksToIgnore Array of what block ids to ignore while checking for viable targets - */ - public TargetBlock(final Location loc, final int maxDistance, final double checkDistance, final int[] blocksToIgnore) - { - this(loc, maxDistance, 0, checkDistance, blocksToIgnore); - } - - /** - * Constructor requiring a player, max distance, checking distance and an array of blocks to ignore - * - * @param player What player to work with - * @param maxDistance How far it checks for blocks - * @param checkDistance How often to check for blocks, the smaller the more precise - * @param blocksToIgnore String ArrayList of what block ids to ignore while checking for viable targets - */ - public TargetBlock(final Player player, final int maxDistance, final double checkDistance, final List<String> blocksToIgnore) - { - this(player.getLocation(), maxDistance, 1.65, checkDistance, TargetBlock.convertStringArraytoIntArray(blocksToIgnore)); - } - - /** - * Constructor requiring a location, max distance, checking distance and an array of blocks to ignore - * - * @param loc What location to work with - * @param maxDistance How far it checks for blocks - * @param checkDistance How often to check for blocks, the smaller the more precise - * @param blocksToIgnore String ArrayList of what block ids to ignore while checking for viable targets - */ - public TargetBlock(final Location loc, final int maxDistance, final double checkDistance, final List<String> blocksToIgnore) - { - this(loc, maxDistance, 0, checkDistance, TargetBlock.convertStringArraytoIntArray(blocksToIgnore)); - } - - /** - * Set the values, all constructors uses this function - * - * @param loc Location of the view - * @param maxDistance How far it checks for blocks - * @param viewPos Where the view is positioned in y-axis - * @param checkDistance How often to check for blocks, the smaller the more precise - * @param blocksToIgnore Ids of blocks to ignore while checking for viable targets - */ - private TargetBlock(final Location loc, final int maxDistance, final double viewHeight, final double checkDistance, final int[] blocksToIgnore) - { - this.location = loc; - this.maxDistance = maxDistance; - this.viewHeight = viewHeight; - this.checkDistance = checkDistance; - if (blocksToIgnore == null || blocksToIgnore.length == 0) - { - this.blockToIgnore = new int[0]; - } - else - { - this.blockToIgnore = new int[blocksToIgnore.length]; - System.arraycopy(blocksToIgnore, 0, this.blockToIgnore, 0, this.blockToIgnore.length); - } - - final double xRotation = (loc.getYaw() + 90) % 360; - final double yRotation = loc.getPitch() * -1; - - final double hypotenuse = (checkDistance * Math.cos(Math.toRadians(yRotation))); - offsetX = hypotenuse * Math.cos(Math.toRadians(xRotation)); - offsetY = checkDistance * Math.sin(Math.toRadians(yRotation)); - offsetZ = hypotenuse * Math.sin(Math.toRadians(xRotation)); - - reset(); - } - - /** - * Call this to reset checking position to allow you to check for a new target with the same TargetBlock instance. - */ - public final void reset() - { - targetPositionX = location.getX(); - targetPositionY = location.getY() + viewHeight; - targetPositionZ = location.getZ(); - itargetPositionX = (int)Math.floor(targetPositionX); - itargetPositionY = (int)Math.floor(targetPositionY); - itargetPositionZ = (int)Math.floor(targetPositionZ); - prevPositionX = itargetPositionX; - prevPositionY = itargetPositionY; - prevPositionZ = itargetPositionZ; - this.curDistance = 0; - } - - /** - * Gets the distance to a block. Measures from the block underneath the player to the targetblock - * Should only be used when passing player as an constructor parameter - * - * @return double - */ - public double getDistanceToBlock() - { - final double blockUnderPlayerX = Math.floor(location.getX() + 0.5); - final double blockUnderPlayerY = Math.floor(location.getY() - 0.5); - final double blockUnderPlayerZ = Math.floor(location.getZ() + 0.5); - - final Block block = getTargetBlock(); - final double distX = block.getX() - blockUnderPlayerX; - final double distY = block.getY() - blockUnderPlayerY; - final double distZ = block.getZ() - blockUnderPlayerZ; - - return Math.sqrt(distX*distX + distY*distY + distZ*distZ); - } - - /** - * Gets the rounded distance to a block. Measures from the block underneath the player to the targetblock - * Should only be used when passing player as an constructor parameter - * - * @return int - */ - public int getDistanceToBlockRounded() - { - return (int)Math.round(getDistanceToBlock()); - } - - /** - * Gets the floored x distance to a block. - * - * @return int - */ - public int getXDistanceToBlock() - { - return (int)Math.floor(getTargetBlock().getX() - location.getBlockX() + 0.5); - } - - /** - * Gets the floored y distance to a block - * - * @return int - */ - public int getYDistanceToBlock() - { - return (int)Math.floor(getTargetBlock().getY() - location.getBlockY() + viewHeight); - } - - /** - * Gets the floored z distance to a block - * - * @return int - */ - public int getZDistanceToBlock() - { - return (int)Math.floor(getTargetBlock().getZ() - location.getBlockZ() + 0.5); - } - - /** - * Returns the block at the sight. Returns null if out of range or if no viable target was found - * - * @return Block - */ - public Block getTargetBlock() - { - this.reset(); - Block block; - do - { - block = getNextBlock(); - } - while (block != null && ((block.getTypeId() == 0) || this.blockIsIgnored(block.getTypeId()))); - - return block; - } - - /** - * Sets the type of the block at the sight. Returns false if the block wasn't set. - * - * @param typeID ID of type to set the block to - * @return boolean - */ - public boolean setTargetBlock(final int typeID) - { - return setTargetBlock(Material.getMaterial(typeID)); - } - - /** - * Sets the type of the block at the sight. Returns false if the block wasn't set. - * - * @param type Material to set the block to - * @return boolean - */ - @SuppressWarnings("empty-statement") - public boolean setTargetBlock(final Material type) - { - if (type == null) - { - return false; - } - final Block block = getTargetBlock(); - if (block != null) - { - block.setType(type); - return true; - } - return false; - } - - /** - * Sets the type of the block at the sight. Returns false if the block wasn't set. - * Observe! At the moment this function is using the built-in enumerator function .valueOf(String) but would preferably be changed to smarter function, when implemented - * - * @param type Name of type to set the block to - * @return boolean - */ - public boolean setTargetBlock(final String type) - { - return setTargetBlock(Material.valueOf(type)); - } - - /** - * Returns the block attached to the face at the sight. Returns null if out of range or if no viable target was found - * - * @return Block - */ - public Block getFaceBlock() - { - final Block block = getTargetBlock(); - if (block == null) - { - return null; - } - return getPreviousBlock(); - } - - /** - * Sets the type of the block attached to the face at the sight. Returns false if the block wasn't set. - * - * @param typeID - * @return boolean - */ - public boolean setFaceBlock(final int typeID) - { - return setFaceBlock(Material.getMaterial(typeID)); - } - - /** - * Sets the type of the block attached to the face at the sight. Returns false if the block wasn't set. - * - * @param type - * @return boolean - */ - public boolean setFaceBlock(final Material type) - { - if (type == null) - { - return false; - } - if (getCurrentBlock() != null) - { - final Block blk = location.getWorld().getBlockAt(prevPositionX, prevPositionY, prevPositionZ); - blk.setType(type); - return true; - } - return false; - } - - /** - * Sets the type of the block attached to the face at the sight. Returns false if the block wasn't set. - * Observe! At the moment this function is using the built-in enumerator function .valueOf(String) but would preferably be changed to smarter function, when implemented - * - * @param type - * @return boolean - */ - public boolean setFaceBlock(final String type) - { - return setFaceBlock(Material.valueOf(type)); - } - - /** - * Get next block - * - * @return Block - */ - public Block getNextBlock() - { - prevPositionX = itargetPositionX; - prevPositionY = itargetPositionY; - prevPositionZ = itargetPositionZ; - do - { - curDistance += checkDistance; - - targetPositionX += offsetX; - targetPositionY += offsetY; - targetPositionZ += offsetZ; - itargetPositionX = (int)Math.floor(targetPositionX); - itargetPositionY = (int)Math.floor(targetPositionY); - itargetPositionZ = (int)Math.floor(targetPositionZ); - } - while (curDistance <= maxDistance && itargetPositionX == prevPositionX && itargetPositionY == prevPositionY && itargetPositionZ == prevPositionZ); - if (curDistance > maxDistance) - { - return null; - } - - return this.location.getWorld().getBlockAt(itargetPositionX, itargetPositionY, itargetPositionZ); - } - - /** - * Returns the current block along the line of vision - * - * @return Block - */ - public Block getCurrentBlock() - { - Block block; - if (curDistance <= maxDistance) - { - block = this.location.getWorld().getBlockAt(itargetPositionX, itargetPositionY, itargetPositionZ); - } - else - { - block = null; - } - return block; - } - - /** - * Sets current block type. Returns false if the block wasn't set. - * - * @param typeID - */ - public boolean setCurrentBlock(final int typeID) - { - return setCurrentBlock(Material.getMaterial(typeID)); - } - - /** - * Sets current block type. Returns false if the block wasn't set. - * - * @param type - */ - public boolean setCurrentBlock(final Material type) - { - final Block blk = getCurrentBlock(); - if (blk != null && type != null) - { - blk.setType(type); - return true; - } - return false; - } - - /** - * Sets current block type. Returns false if the block wasn't set. - * Observe! At the moment this function is using the built-in enumerator function .valueOf(String) but would preferably be changed to smarter function, when implemented - * - * @param type - */ - public boolean setCurrentBlock(final String type) - { - return setCurrentBlock(Material.valueOf(type)); - } - - /** - * Returns the previous block in the aimed path - * - * @return Block - */ - public Block getPreviousBlock() - { - return this.location.getWorld().getBlockAt(prevPositionX, prevPositionY, prevPositionZ); - } - - /** - * Sets previous block type id. Returns false if the block wasn't set. - * - * @param typeID - */ - public boolean setPreviousBlock(final int typeID) - { - return setPreviousBlock(Material.getMaterial(typeID)); - } - - /** - * Sets previous block type id. Returns false if the block wasn't set. - * - * @param type - */ - public boolean setPreviousBlock(final Material type) - { - final Block blk = getPreviousBlock(); - if (blk != null && type != null) - { - blk.setType(type); - return true; - } - return false; - } - - /** - * Sets previous block type id. Returns false if the block wasn't set. - * Observe! At the moment this function is using the built-in enumerator function .valueOf(String) but would preferably be changed to smarter function, when implemented - * - * @param type - */ - public boolean setPreviousBlock(final String type) - { - return setPreviousBlock(Material.valueOf(type)); - } - - private static int[] convertStringArraytoIntArray(final List<String> array) - { - final int intarray[] = new int[array == null ? 0 : array.size()]; - for (int i = 0; i < intarray.length; i++) - { - try - { - intarray[i] = Integer.parseInt(array.get(i)); - } - catch (NumberFormatException nfe) - { - } - } - return intarray; - } - - private boolean blockIsIgnored(final int value) - { - for (int i : this.blockToIgnore) - { - if (i == value) - { - return true; - } - } - return false; - } -}
\ No newline at end of file diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java index 94371fdde..9c21ffc6d 100644 --- a/Essentials/src/com/earth2me/essentials/Teleport.java +++ b/Essentials/src/com/earth2me/essentials/Teleport.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import com.earth2me.essentials.api.ITeleport; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.commands.NotEnoughArgumentsException; import java.util.Calendar; @@ -7,9 +8,12 @@ import java.util.GregorianCalendar; import java.util.logging.Logger; import org.bukkit.Location; import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; -public class Teleport implements Runnable +public class Teleport implements Runnable, ITeleport { private static final double MOVE_CONSTANT = 0.3; @@ -55,8 +59,9 @@ public class Teleport implements Runnable private Trade chargeFor; private final IEssentials ess; private static final Logger logger = Logger.getLogger("Minecraft"); + private TeleportCause cause; - private void initTimer(long delay, Target target, Trade chargeFor) + private void initTimer(long delay, Target target, Trade chargeFor, TeleportCause cause) { this.started = System.currentTimeMillis(); this.delay = delay; @@ -66,6 +71,7 @@ public class Teleport implements Runnable this.initZ = Math.round(user.getLocation().getZ() * MOVE_CONSTANT); this.teleportTarget = target; this.chargeFor = chargeFor; + this.cause = cause; } @Override @@ -98,7 +104,7 @@ public class Teleport implements Runnable try { - now(teleportTarget); + now(teleportTarget, cause); if (chargeFor != null) { chargeFor.charge(user); @@ -122,15 +128,19 @@ public class Teleport implements Runnable this.ess = ess; } - public void respawn(Spawn spawn, Trade chargeFor) throws Exception + public void respawn(final Trade chargeFor, TeleportCause cause) throws Exception { - teleport(new Target(spawn.getSpawn(user.getGroup())), chargeFor); + final Player player = user.getBase(); + final Location bed = player.getBedSpawnLocation(); + final PlayerRespawnEvent pre = new PlayerRespawnEvent(player, bed == null ? player.getWorld().getSpawnLocation() : bed, bed != null); + ess.getServer().getPluginManager().callEvent(pre); + teleport(new Target(pre.getRespawnLocation()), chargeFor, cause); } - public void warp(String warp, Trade chargeFor) throws Exception + public void warp(String warp, Trade chargeFor, TeleportCause cause) throws Exception { Location loc = ess.getWarps().getWarp(warp); - teleport(new Target(loc), chargeFor); + teleport(new Target(loc), chargeFor, cause); user.sendMessage(_("warpingTo", warp)); } @@ -180,18 +190,23 @@ public class Teleport implements Runnable { cancel(false); } - + public void teleport(Location loc, Trade chargeFor) throws Exception { - teleport(new Target(loc), chargeFor); + teleport(new Target(loc), chargeFor, TeleportCause.PLUGIN); } - public void teleport(Entity entity, Trade chargeFor) throws Exception + public void teleport(Location loc, Trade chargeFor, TeleportCause cause) throws Exception { - teleport(new Target(entity), chargeFor); + teleport(new Target(loc), chargeFor, cause); } - private void teleport(Target target, Trade chargeFor) throws Exception + public void teleport(Entity entity, Trade chargeFor, TeleportCause cause) throws Exception + { + teleport(new Target(entity), chargeFor, cause); + } + + private void teleport(Target target, Trade chargeFor, TeleportCause cause) throws Exception { double delay = ess.getSettings().getTeleportDelay(); @@ -203,7 +218,7 @@ public class Teleport implements Runnable if (delay <= 0 || user.isAuthorized("essentials.teleport.timer.bypass")) { cooldown(false); - now(target); + now(target, cause); if (chargeFor != null) { chargeFor.charge(user); @@ -216,48 +231,51 @@ public class Teleport implements Runnable c.add(Calendar.SECOND, (int)delay); c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0)); user.sendMessage(_("dontMoveMessage", Util.formatDateDiff(c.getTimeInMillis()))); - initTimer((long)(delay * 1000.0), target, chargeFor); + initTimer((long)(delay * 1000.0), target, chargeFor, cause); teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10); } - private void now(Target target) throws Exception + private void now(Target target, TeleportCause cause) throws Exception { cancel(); user.setLastLocation(); - user.getBase().teleport(Util.getSafeDestination(target.getLocation())); + user.getBase().teleport(Util.getSafeDestination(target.getLocation()), cause); } - public void now(Location loc) throws Exception + public void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception { - cooldown(false); - now(new Target(loc)); + if (cooldown) + { + cooldown(false); + } + now(new Target(loc), cause); } - public void now(Location loc, Trade chargeFor) throws Exception + public void now(Location loc, Trade chargeFor, TeleportCause cause) throws Exception { cooldown(false); chargeFor.charge(user); - now(new Target(loc)); + now(new Target(loc), cause); } - public void now(Entity entity, boolean cooldown) throws Exception + public void now(Entity entity, boolean cooldown, TeleportCause cause) throws Exception { if (cooldown) { cooldown(false); } - now(new Target(entity)); + now(new Target(entity), cause); } public void back(Trade chargeFor) throws Exception { - teleport(new Target(user.getLastLocation()), chargeFor); + teleport(new Target(user.getLastLocation()), chargeFor, TeleportCause.COMMAND); } public void back() throws Exception { - now(new Target(user.getLastLocation())); + now(new Target(user.getLastLocation()), TeleportCause.COMMAND); } public void home(IUser user, String home, Trade chargeFor) throws Exception @@ -267,6 +285,6 @@ public class Teleport implements Runnable { throw new NotEnoughArgumentsException(); } - teleport(new Target(loc), chargeFor); + teleport(new Target(loc), chargeFor, TeleportCause.COMMAND); } } diff --git a/Essentials/src/com/earth2me/essentials/Trade.java b/Essentials/src/com/earth2me/essentials/Trade.java index 7d2480660..1c8e20db9 100644 --- a/Essentials/src/com/earth2me/essentials/Trade.java +++ b/Essentials/src/com/earth2me/essentials/Trade.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import com.earth2me.essentials.craftbukkit.InventoryWorkaround; import static com.earth2me.essentials.I18n._; import java.io.File; import java.io.FileWriter; @@ -19,28 +20,35 @@ public class Trade private final transient String command; private final transient Double money; private final transient ItemStack itemStack; + private final transient Integer exp; private final transient IEssentials ess; public Trade(final String command, final IEssentials ess) { - this(command, null, null, ess); + this(command, null, null, null, ess); } public Trade(final double money, final IEssentials ess) { - this(null, money, null, ess); + this(null, money, null, null, ess); } public Trade(final ItemStack items, final IEssentials ess) { - this(null, null, items, ess); + this(null, null, items, null, ess); + } + + public Trade(final int exp, final IEssentials ess) + { + this(null, null, null, exp, ess); } - private Trade(final String command, final Double money, final ItemStack item, final IEssentials ess) + private Trade(final String command, final Double money, final ItemStack item, final Integer exp, final IEssentials ess) { this.command = command; this.money = money; this.itemStack = item; + this.exp = exp; this.ess = ess; } @@ -56,7 +64,7 @@ public class Trade } if (getItemStack() != null - && !InventoryWorkaround.containsItem(user.getInventory(), true, itemStack)) + && !InventoryWorkaround.containsItem(user.getInventory(), true, true, itemStack)) { throw new ChargeException(_("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " "))); } @@ -70,6 +78,11 @@ public class Trade { throw new ChargeException(_("notEnoughMoney")); } + + if (exp != null && exp > 0 + && user.getTotalExperience() < exp) { + throw new ChargeException(_("notEnoughExperience")); + } } public void pay(final IUser user) @@ -100,6 +113,10 @@ public class Trade } user.updateInventory(); } + if (getExperience() != null) + { + user.setTotalExperience(user.getTotalExperience() + getExperience()); + } return success; } @@ -116,11 +133,11 @@ public class Trade } if (getItemStack() != null) { - if (!InventoryWorkaround.containsItem(user.getInventory(), true, itemStack)) + if (!InventoryWorkaround.containsItem(user.getInventory(), true, true, itemStack)) { throw new ChargeException(_("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " "))); } - InventoryWorkaround.removeItem(user.getInventory(), true, getItemStack()); + InventoryWorkaround.removeItem(user.getInventory(), true, true, getItemStack()); user.updateInventory(); } if (command != null && !command.isEmpty() @@ -135,6 +152,15 @@ public class Trade } user.takeMoney(cost); } + if (getExperience() != null) + { + final int experience = user.getTotalExperience(); + if (experience < getExperience() && getExperience() > 0) + { + throw new ChargeException(_("notEnoughExperience")); + } + user.setTotalExperience(experience - getExperience()); + } } public Double getMoney() @@ -146,6 +172,11 @@ public class Trade { return itemStack; } + + public Integer getExperience() + { + return exp; + } private static FileWriter fw = null; public static void log(String type, String subtype, String event, String sender, Trade charge, String receiver, Trade pay, Location loc, IEssentials ess) @@ -192,6 +223,12 @@ public class Trade sb.append("money").append(","); sb.append(ess.getSettings().getCurrencySymbol()); } + if (charge.getExperience() != null) + { + sb.append(charge.getExperience()).append(","); + sb.append("exp").append(","); + sb.append("\"\""); + } } sb.append(",\""); if (receiver != null) @@ -217,6 +254,12 @@ public class Trade sb.append("money").append(","); sb.append(ess.getSettings().getCurrencySymbol()); } + if (pay.getExperience() != null) + { + sb.append(pay.getExperience()).append(","); + sb.append("exp").append(","); + sb.append("\"\""); + } } if (loc == null) { diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 3c1166240..2ef59eb88 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -468,10 +468,11 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser public void checkActivity() { final long autoafkkick = ess.getSettings().getAutoAfkKick(); - if (autoafkkick > 0 && lastActivity + autoafkkick * 1000 < System.currentTimeMillis() + if (autoafkkick > 0 && lastActivity > 0 && (lastActivity + (autoafkkick * 1000)) < System.currentTimeMillis() && !isHidden() && !isAuthorized("essentials.kick.exempt") && !isAuthorized("essentials.afk.kickexempt")) { final String kickReason = _("autoAfkKickReason", autoafkkick / 60.0); + lastActivity = 0; kickPlayer(kickReason); diff --git a/Essentials/src/com/earth2me/essentials/UserMap.java b/Essentials/src/com/earth2me/essentials/UserMap.java index 708494296..467c2693b 100644 --- a/Essentials/src/com/earth2me/essentials/UserMap.java +++ b/Essentials/src/com/earth2me/essentials/UserMap.java @@ -3,15 +3,13 @@ package com.earth2me.essentials; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; -import com.google.common.collect.ConcurrentHashMultiset; import com.google.common.util.concurrent.UncheckedExecutionException; import java.io.File; import java.util.Collections; import java.util.Locale; import java.util.Set; +import java.util.concurrent.ConcurrentSkipListSet; import java.util.concurrent.ExecutionException; -import java.util.logging.Level; -import java.util.logging.Logger; import org.bukkit.entity.Player; @@ -19,7 +17,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf { private final transient IEssentials ess; private final transient Cache<String, User> users = CacheBuilder.newBuilder().softValues().build(this); - private final transient ConcurrentHashMultiset<String> keys = ConcurrentHashMultiset.create(); + private final transient ConcurrentSkipListSet<String> keys = new ConcurrentSkipListSet<String>(); public UserMap(final IEssentials ess) { @@ -87,8 +85,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf return new User(player, ess); } } - final File userFolder = new File(ess.getDataFolder(), "userdata"); - final File userFile = new File(userFolder, Util.sanitizeFileName(name) + ".yml"); + final File userFile = getUserFile(name); if (userFile.exists()) { keys.add(name.toLowerCase(Locale.ENGLISH)); @@ -111,11 +108,17 @@ public class UserMap extends CacheLoader<String, User> implements IConf public Set<String> getAllUniqueUsers() { - return Collections.unmodifiableSet(keys.elementSet()); + return Collections.unmodifiableSet(keys); } public int getUniqueUsers() { return keys.size(); } + + public File getUserFile(final String name) + { + final File userFolder = new File(ess.getDataFolder(), "userdata"); + return new File(userFolder, Util.sanitizeFileName(name) + ".yml"); + } } diff --git a/Essentials/src/com/earth2me/essentials/Util.java b/Essentials/src/com/earth2me/essentials/Util.java index 5ee3e3123..fe86fd167 100644 --- a/Essentials/src/com/earth2me/essentials/Util.java +++ b/Essentials/src/com/earth2me/essentials/Util.java @@ -12,6 +12,7 @@ import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.entity.LivingEntity; +import org.bukkit.inventory.ItemStack; public class Util @@ -331,6 +332,88 @@ public class Util } return isBlockAboveAir(world, x, y, z); } + + public static ItemStack convertBlockToItem(final Block block) + { + final ItemStack is = new ItemStack(block.getType(), 1, (short)0, block.getData()); + switch (is.getType()) + { + case WOODEN_DOOR: + is.setType(Material.WOOD_DOOR); + is.setDurability((short)0); + break; + case IRON_DOOR_BLOCK: + is.setType(Material.IRON_DOOR); + is.setDurability((short)0); + break; + case SIGN_POST: + case WALL_SIGN: + is.setType(Material.SIGN); + is.setDurability((short)0); + break; + case CROPS: + is.setType(Material.SEEDS); + is.setDurability((short)0); + break; + case CAKE_BLOCK: + is.setType(Material.CAKE); + is.setDurability((short)0); + break; + case BED_BLOCK: + is.setType(Material.BED); + is.setDurability((short)0); + break; + case REDSTONE_WIRE: + is.setType(Material.REDSTONE); + is.setDurability((short)0); + break; + case REDSTONE_TORCH_OFF: + case REDSTONE_TORCH_ON: + is.setType(Material.REDSTONE_TORCH_ON); + is.setDurability((short)0); + break; + case DIODE_BLOCK_OFF: + case DIODE_BLOCK_ON: + is.setType(Material.DIODE); + is.setDurability((short)0); + break; + case DOUBLE_STEP: + is.setType(Material.STEP); + break; + case TORCH: + case RAILS: + case LADDER: + case WOOD_STAIRS: + case COBBLESTONE_STAIRS: + case LEVER: + case STONE_BUTTON: + case FURNACE: + case DISPENSER: + case PUMPKIN: + case JACK_O_LANTERN: + case WOOD_PLATE: + case STONE_PLATE: + case PISTON_STICKY_BASE: + case PISTON_BASE: + case IRON_FENCE: + case THIN_GLASS: + case TRAP_DOOR: + case FENCE: + case FENCE_GATE: + case NETHER_FENCE: + is.setDurability((short)0); + break; + case FIRE: + return null; + case PUMPKIN_STEM: + is.setType(Material.PUMPKIN_SEEDS); + break; + case MELON_STEM: + is.setType(Material.MELON_SEEDS); + break; + } + return is; + } private static DecimalFormat df = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US)); public static String formatCurrency(final double value, final IEssentials ess) diff --git a/Essentials/src/com/earth2me/essentials/api/IAlternativeCommandsHandler.java b/Essentials/src/com/earth2me/essentials/api/IAlternativeCommandsHandler.java new file mode 100644 index 000000000..11619bca4 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/IAlternativeCommandsHandler.java @@ -0,0 +1,10 @@ +package com.earth2me.essentials.api; + +import java.util.Map; +import org.bukkit.command.PluginCommand; + + +public interface IAlternativeCommandsHandler +{ + Map<String, String> disabledCommands(); +} diff --git a/Essentials/src/com/earth2me/essentials/api/IEssentials.java b/Essentials/src/com/earth2me/essentials/api/IEssentials.java new file mode 100644 index 000000000..c04bed0bd --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/IEssentials.java @@ -0,0 +1,51 @@ +package com.earth2me.essentials.api; + +import com.earth2me.essentials.perm.IPermissionsHandler; +import com.earth2me.essentials.register.payment.Methods; +import org.bukkit.World; +import org.bukkit.command.CommandSender; +import org.bukkit.plugin.Plugin; + + +public interface IEssentials extends Plugin, IReload +{ + void addReloadListener(IReload listener); + + IUser getUser(Object base); + + int broadcastMessage(IUser sender, String message); + + II18n getI18n(); + + ISettings getSettings(); + + IJails getJail(); + + IWarps getWarps(); + + IWorth getWorth(); + + IItemDb getItemDb(); + + IUserMap getUserMap(); + + IEssentialsEconomy getEconomy(); + + World getWorld(String name); + + Methods getPaymentMethod(); + + int scheduleAsyncDelayedTask(Runnable run); + + int scheduleSyncDelayedTask(Runnable run); + + int scheduleSyncDelayedTask(Runnable run, long delay); + + int scheduleSyncRepeatingTask(Runnable run, long delay, long period); + + IPermissionsHandler getPermissionsHandler(); + + IAlternativeCommandsHandler getAlternativeCommandsHandler(); + + void showCommandError(CommandSender sender, String commandLabel, Throwable exception); +} diff --git a/Essentials/src/com/earth2me/essentials/api/IEssentialsEconomy.java b/Essentials/src/com/earth2me/essentials/api/IEssentialsEconomy.java new file mode 100644 index 000000000..72fb89d26 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/IEssentialsEconomy.java @@ -0,0 +1,37 @@ +package com.earth2me.essentials.api; + + +public interface IEssentialsEconomy +{ + double getMoney(String name) throws UserDoesNotExistException; + + void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException; + + void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException; + + void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException; + + void divide(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException; + + void multiply(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException; + + void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException; + + boolean hasEnough(String name, double amount) throws UserDoesNotExistException; + + boolean hasMore(String name, double amount) throws UserDoesNotExistException; + + boolean hasLess(String name, double amount) throws UserDoesNotExistException; + + boolean isNegative(String name) throws UserDoesNotExistException; + + String format(double amount); + + boolean playerExists(String name); + + boolean isNPC(String name) throws UserDoesNotExistException; + + boolean createNPC(String name); + + void removeNPC(String name) throws UserDoesNotExistException; +} diff --git a/Essentials/src/com/earth2me/essentials/api/II18n.java b/Essentials/src/com/earth2me/essentials/api/II18n.java new file mode 100644 index 000000000..567d4e59e --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/II18n.java @@ -0,0 +1,9 @@ +package com.earth2me.essentials.api; + +import java.util.Locale; + + +public interface II18n +{ + Locale getCurrentLocale(); +} diff --git a/Essentials/src/com/earth2me/essentials/api/IItemDb.java b/Essentials/src/com/earth2me/essentials/api/IItemDb.java new file mode 100644 index 000000000..ee4819215 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/IItemDb.java @@ -0,0 +1,11 @@ +package com.earth2me.essentials.api; + +import org.bukkit.inventory.ItemStack; + + +public interface IItemDb +{ + ItemStack get(final String name, final int quantity) throws Exception; + + ItemStack get(final String name) throws Exception; +} diff --git a/Essentials/src/com/earth2me/essentials/api/IJails.java b/Essentials/src/com/earth2me/essentials/api/IJails.java new file mode 100644 index 000000000..18866d8e5 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/IJails.java @@ -0,0 +1,18 @@ +package com.earth2me.essentials.api; + +import java.util.Collection; +import org.bukkit.Location; + + +public interface IJails extends IReload +{ + Location getJail(String jailName) throws Exception; + + Collection<String> getList() throws Exception; + + void removeJail(String jail) throws Exception; + + void sendToJail(com.earth2me.essentials.IUser user, String jail) throws Exception; + + void setJail(String jailName, Location loc) throws Exception; +} diff --git a/Essentials/src/com/earth2me/essentials/api/IReload.java b/Essentials/src/com/earth2me/essentials/api/IReload.java new file mode 100644 index 000000000..75403b55c --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/IReload.java @@ -0,0 +1,7 @@ +package com.earth2me.essentials.api; + + +public interface IReload +{ + void onReload(); +} diff --git a/Essentials/src/com/earth2me/essentials/api/ISettings.java b/Essentials/src/com/earth2me/essentials/api/ISettings.java new file mode 100644 index 000000000..eff65ad87 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/ISettings.java @@ -0,0 +1,10 @@ +package com.earth2me.essentials.api; + +import com.earth2me.essentials.settings.Settings; +import com.earth2me.essentials.storage.IStorageObjectHolder; + + +public interface ISettings extends IStorageObjectHolder<Settings> +{ + +} diff --git a/Essentials/src/com/earth2me/essentials/api/ITeleport.java b/Essentials/src/com/earth2me/essentials/api/ITeleport.java new file mode 100644 index 000000000..5b9a19757 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/ITeleport.java @@ -0,0 +1,10 @@ +package com.earth2me.essentials.api; + +import org.bukkit.Location; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; + + +public interface ITeleport +{ + void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception; +} diff --git a/Essentials/src/com/earth2me/essentials/api/IUser.java b/Essentials/src/com/earth2me/essentials/api/IUser.java new file mode 100644 index 000000000..5d2f9d4b8 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/IUser.java @@ -0,0 +1,43 @@ +package com.earth2me.essentials.api; + +import com.earth2me.essentials.commands.IEssentialsCommand; +import org.bukkit.Location; +import org.bukkit.entity.Player; + + +public interface IUser extends Player, IReload +{ + long getLastTeleportTimestamp(); + + boolean isAuthorized(String node); + + boolean isAuthorized(IEssentialsCommand cmd); + + boolean isAuthorized(IEssentialsCommand cmd, String permissionPrefix); + + void setLastTeleportTimestamp(long time); + + Location getLastLocation(); + + Player getBase(); + + double getMoney(); + + void takeMoney(double value); + + void giveMoney(double value); + + String getGroup(); + + void setLastLocation(); + + Location getHome(String name) throws Exception; + + Location getHome(Location loc) throws Exception; + + boolean isHidden(); + + ITeleport getTeleport(); + + void setJail(String jail); +} diff --git a/Essentials/src/com/earth2me/essentials/api/IUserMap.java b/Essentials/src/com/earth2me/essentials/api/IUserMap.java new file mode 100644 index 000000000..9e609ab37 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/IUserMap.java @@ -0,0 +1,20 @@ +package com.earth2me.essentials.api; + +import java.io.File; +import java.util.Set; + + +public interface IUserMap +{ + boolean userExists(final String name); + + IUser getUser(final String name); + + void removeUser(final String name); + + Set<String> getAllUniqueUsers(); + + int getUniqueUsers(); + + File getUserFile(final String name); +} diff --git a/Essentials/src/com/earth2me/essentials/api/IWarps.java b/Essentials/src/com/earth2me/essentials/api/IWarps.java new file mode 100644 index 000000000..14779e327 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/IWarps.java @@ -0,0 +1,16 @@ +package com.earth2me.essentials.api; + +import java.util.Collection; +import org.bukkit.Location; + + +public interface IWarps extends IReload +{ + Location getWarp(String warp) throws Exception; + + Collection<String> getWarps(); + + void removeWarp(String name) throws Exception; + + void setWarp(String name, Location loc) throws Exception; +} diff --git a/Essentials/src/com/earth2me/essentials/api/IWorth.java b/Essentials/src/com/earth2me/essentials/api/IWorth.java new file mode 100644 index 000000000..4add98771 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/IWorth.java @@ -0,0 +1,11 @@ +package com.earth2me.essentials.api; + +import org.bukkit.inventory.ItemStack; + + +public interface IWorth extends IReload +{ + double getPrice(ItemStack itemStack); + + void setPrice(ItemStack itemStack, double price); +} diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java b/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java index 2212f4664..5f73f84c2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java @@ -3,6 +3,9 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.User; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Util; +import com.earth2me.essentials.textreader.ArrayListInput; +import com.earth2me.essentials.textreader.TextPager; +import java.text.DateFormat; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.locks.ReentrantReadWriteLock; @@ -16,38 +19,39 @@ public class Commandbalancetop extends EssentialsCommand { super("balancetop"); } - private static final int CACHETIME = 5 * 60 * 1000; + private static final int CACHETIME = 2 * 60 * 1000; public static final int MINUSERS = 50; - private static List<String> cache = new ArrayList<String>(); + private static ArrayListInput cache = new ArrayListInput(); private static long cacheage = 0; private static ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); @Override protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception { - int max = 10; + int page = 0; + boolean force = false; if (args.length > 0) { try { - if (Integer.parseInt(args[0]) < 19) - { - max = Integer.parseInt(args[0]); - } + page = Integer.parseInt(args[0]); } catch (NumberFormatException ex) { - //catch it because they tried to enter a string not number. + if (args[0].equalsIgnoreCase("force") && sender.isOp()) + { + force = true; + } } } - if (lock.readLock().tryLock()) + if (!force && lock.readLock().tryLock()) { try { if (cacheage > System.currentTimeMillis() - CACHETIME) { - outputCache(sender, max); + outputCache(sender, page); return; } if (ess.getUserMap().getUniqueUsers() > MINUSERS) @@ -59,7 +63,7 @@ public class Commandbalancetop extends EssentialsCommand { lock.readLock().unlock(); } - ess.scheduleAsyncDelayedTask(new Viewer(sender, max)); + ess.scheduleAsyncDelayedTask(new Viewer(sender, page, force)); } else { @@ -67,33 +71,30 @@ public class Commandbalancetop extends EssentialsCommand { sender.sendMessage(_("orderBalances", ess.getUserMap().getUniqueUsers())); } - ess.scheduleAsyncDelayedTask(new Viewer(sender, max)); + ess.scheduleAsyncDelayedTask(new Viewer(sender, page, force)); } } - private static void outputCache(final CommandSender sender, int max) + private static void outputCache(final CommandSender sender, int page) { - sender.sendMessage(_("balanceTop", max)); - for (String line : cache) - { - if (max == 0) - { - break; - } - max--; - sender.sendMessage(line); - } + final Calendar cal = Calendar.getInstance(); + cal.setTimeInMillis(cacheage); + final DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); + sender.sendMessage(_("balanceTop", format.format(cal.getTime()))); + new TextPager(cache).showPage(Integer.toString(page), "", "balancetop", sender); } private class Calculator implements Runnable { private final transient Viewer viewer; + private final boolean force; - public Calculator(final Viewer viewer) + public Calculator(final Viewer viewer, final boolean force) { this.viewer = viewer; + this.force = force; } @Override @@ -102,8 +103,9 @@ public class Commandbalancetop extends EssentialsCommand lock.writeLock().lock(); try { - if (cacheage < System.currentTimeMillis() - 5 * 60 * 1000) + if (force || cacheage <= System.currentTimeMillis() - CACHETIME) { + cache.getLines().clear(); final Map<String, Double> balances = new HashMap<String, Double>(); for (String u : ess.getUserMap().getAllUniqueUsers()) { @@ -123,15 +125,11 @@ public class Commandbalancetop extends EssentialsCommand return -entry1.getValue().compareTo(entry2.getValue()); } }); - int count = 0; + int pos = 1; for (Map.Entry<String, Double> entry : sortedEntries) { - if (count == 20) - { - break; - } - cache.add(entry.getKey() + ", " + Util.formatCurrency(entry.getValue(), ess)); - count++; + cache.getLines().add(pos + ". " + entry.getKey() + ", " + Util.formatCurrency(entry.getValue(), ess)); + pos++; } cacheage = System.currentTimeMillis(); } @@ -148,12 +146,14 @@ public class Commandbalancetop extends EssentialsCommand private class Viewer implements Runnable { private final transient CommandSender sender; - private final transient int max; + private final transient int page; + private final transient boolean force; - public Viewer(final CommandSender sender, final int max) + public Viewer(final CommandSender sender, final int page, final boolean force) { this.sender = sender; - this.max = max; + this.page = page; + this.force = force; } @Override @@ -162,9 +162,9 @@ public class Commandbalancetop extends EssentialsCommand lock.readLock().lock(); try { - if (cacheage > System.currentTimeMillis() - 5 * 60 * 1000) + if (!force && cacheage > System.currentTimeMillis() - CACHETIME) { - outputCache(sender, max); + outputCache(sender, page); return; } } @@ -172,7 +172,7 @@ public class Commandbalancetop extends EssentialsCommand { lock.readLock().unlock(); } - ess.scheduleAsyncDelayedTask(new Calculator(new Viewer(sender, max))); + ess.scheduleAsyncDelayedTask(new Calculator(new Viewer(sender, page, force), force)); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java b/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java new file mode 100644 index 000000000..9c0a34698 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java @@ -0,0 +1,44 @@ +package com.earth2me.essentials.commands; + +import com.earth2me.essentials.User; +import org.bukkit.Material; +import org.bukkit.Server; +import org.bukkit.block.Block; +import org.bukkit.event.block.BlockBreakEvent; + + +public class Commandbreak extends EssentialsCommand +{ + public Commandbreak() + { + super("break"); + } + + @Override + public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception + { + final Block block = user.getTargetBlock(null, 20); + if (block == null) + { + throw new NoChargeException(); + } + if (block.getType() == Material.AIR) + { + throw new NoChargeException(); + } + if (block.getType() == Material.BEDROCK && !user.isAuthorized("essentials.break.bedrock")) + { + throw new Exception("You are not allowed to destroy bedrock."); //TODO: Translation + } + final BlockBreakEvent event = new BlockBreakEvent(block, user); + server.getPluginManager().callEvent(event); + if (event.isCancelled()) + { + throw new NoChargeException(); + } + else + { + block.setType(Material.AIR); + } + } +}
\ No newline at end of file diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbutcher.java b/Essentials/src/com/earth2me/essentials/commands/Commandbutcher.java new file mode 100644 index 000000000..b5f43e2d9 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbutcher.java @@ -0,0 +1,149 @@ +package com.earth2me.essentials.commands; + +import com.earth2me.essentials.Mob; +import static com.earth2me.essentials.I18n._; +import java.util.Collections; +import org.bukkit.Chunk; +import org.bukkit.Server; +import org.bukkit.World; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Animals; +import org.bukkit.entity.ComplexLivingEntity; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Flying; +import org.bukkit.entity.HumanEntity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Monster; +import org.bukkit.entity.NPC; +import org.bukkit.entity.Player; +import org.bukkit.entity.Slime; +import org.bukkit.entity.Snowman; +import org.bukkit.entity.WaterMob; +import org.bukkit.entity.Wolf; +import org.bukkit.event.entity.EntityDeathEvent; + +public class Commandbutcher extends EssentialsCommand +{ + public Commandbutcher() + { + super("butcher"); + } + + @Override + public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + { + String type = "all"; + int radius = -1; + World world; + if (sender instanceof Player) + { + world = ((Player)sender).getWorld(); + if (args.length == 1) + { + try + { + radius = Integer.parseInt(args[0]); + } + catch (NumberFormatException e1) + { + type = args[0]; + } + } + else if (args.length > 1) + { + type = args[0]; + try + { + radius = Integer.parseInt(args[1]); + } + catch (NumberFormatException e) + { + throw new Exception(_("numberRequired")); + } + } + } + else + { + if (args.length == 0) + { + throw new NotEnoughArgumentsException(); + } + else if (args.length == 1) + { + world = ess.getWorld(args[0]); + } + else + { + type = args[0]; + world = ess.getWorld(args[1]); + } + } + if (radius >=0) { + radius *= radius; + } + String killType = type.toLowerCase(); + int numKills = 0; + for (Chunk chunk : world.getLoadedChunks()) + { + for (Entity entity : chunk.getEntities()) + { + if (sender instanceof Player) + { + if (((Player)sender).getLocation().distanceSquared(entity.getLocation()) > radius && radius >= 0) + { + continue; + } + } + if (entity instanceof LivingEntity == false || entity instanceof HumanEntity) + { + continue; + } + if (entity instanceof Wolf) + { + if (((Wolf)entity).isTamed()) + { + continue; + } + } + if (killType.contains("animal")) + { + if (entity instanceof Animals || entity instanceof NPC || entity instanceof Snowman || entity instanceof WaterMob) + { + EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST); + ess.getServer().getPluginManager().callEvent(event); + entity.remove(); + numKills++; + } + } + else if (killType.contains("monster")) + { + if (entity instanceof Monster || entity instanceof ComplexLivingEntity || entity instanceof Flying || entity instanceof Slime) + { + EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST); + ess.getServer().getPluginManager().callEvent(event); + entity.remove(); + numKills++; + } + } + else if (killType.contains("all")) + { + EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST); + ess.getServer().getPluginManager().callEvent(event); + entity.remove(); + numKills++; + } + else + { + if (Mob.fromName(killType).getType().getEntityClass().isAssignableFrom(entity.getClass())) + { + EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST); + ess.getServer().getPluginManager().callEvent(event); + entity.remove(); + numKills++; + } + } + } + } + sender.sendMessage(_("kill", numKills)); + } +}
\ No newline at end of file diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java b/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java index 5b8e5d720..5c2c957e4 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java @@ -19,7 +19,7 @@ public class Commanddeljail extends EssentialsCommand { throw new NotEnoughArgumentsException(); } - ess.getJail().delJail(args[0]); + ess.getJails().removeJail(args[0]); sender.sendMessage(_("deleteJail", args[0])); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java index 3ef886347..51a909d29 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java @@ -1,73 +1,22 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.Enchantments; +import static com.earth2me.essentials.I18n._; 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 java.util.*; 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"); } - //TODO: Implement charge costs: final Trade charge = new Trade("enchant-" + enchantmentName, ess); @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception @@ -80,7 +29,7 @@ public class Commandenchant extends EssentialsCommand if (args.length == 0) { final Set<String> enchantmentslist = new TreeSet<String>(); - for (Map.Entry<String, Enchantment> entry : ENCHANTMENTS.entrySet()) + 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)) @@ -103,39 +52,36 @@ public class Commandenchant extends EssentialsCommand level = -1; } } - Enchantment enchantment = getEnchantment(args[0], user); + final Enchantment enchantment = getEnchantment(args[0], user); if (level < 0 || level > enchantment.getMaxLevel()) { level = enchantment.getMaxLevel(); } - if (level == 0) { + if (level == 0) + { stack.removeEnchantment(enchantment); - } else { + } + else + { stack.addEnchantment(enchantment, level); } - EnchantmentFix.setItemInHand(user.getInventory(), stack); + user.getInventory().setItemInHand(stack); user.updateInventory(); final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH); - if (level == 0) { + if (level == 0) + { user.sendMessage(_("enchantmentRemoved", enchantmentName.replace('_', ' '))); - } else { + } + 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)); - } + + final Enchantment enchantment = Enchantments.getByName(name); if (enchantment == null) { throw new Exception(_("enchantmentNotFound")); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java index 507298a0b..14bbf5e02 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java @@ -44,7 +44,7 @@ public class Commandessentials extends EssentialsCommand { sender.sendMessage("Essentials " + ess.getDescription().getVersion()); sender.sendMessage("/<command> <reload/debug>"); - sender.sendMessage("Essentials blocked the following commands, due to command conflicts:"); + sender.sendMessage(_("blockList")); final StringBuilder disabledCommands = new StringBuilder(); for (Map.Entry<String, String> entry : ess.getAlternativeCommandsHandler().disabledCommands().entrySet()) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java b/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java new file mode 100644 index 000000000..0c1579835 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java @@ -0,0 +1,52 @@ +package com.earth2me.essentials.commands; + +import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.User; +import java.util.List; +import org.bukkit.Server; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + + +public class Commandfeed extends EssentialsCommand +{ + public Commandfeed() + { + super("feed"); + } + + @Override + protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception + { + if (args.length > 0 && user.isAuthorized("essentials.feed.others")) + { + feedOtherPlayers(server,user,args[0]); + } + else + { + user.setFoodLevel(20); + user.setSaturation(10); + user.sendMessage(_("feed")); + } + } + + private void feedOtherPlayers(final Server server, final CommandSender sender, final String name) + { + final List<Player> players = server.matchPlayer(name); + if (players.isEmpty()) + { + sender.sendMessage(_("playerNotFound")); + return; + } + for (Player player : players) + { + if (ess.getUser(player).isHidden()) + { + continue; + } + player.setFoodLevel(20); + player.setSaturation(10); + sender.sendMessage(_("feedOther", player.getDisplayName())); + } + } +} diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java index 821692464..62ace9357 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java @@ -30,7 +30,7 @@ public class Commandgamemode extends EssentialsCommand @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - if (args.length > 0 && user.isAuthorized("essentials.gamemode.others")) + if (args.length > 0 && !args[0].trim().isEmpty() && user.isAuthorized("essentials.gamemode.others")) { gamemodeOtherPlayers(server, user, args[0]); return; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java index b79df021c..c61702e59 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java @@ -3,6 +3,7 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.User; import org.bukkit.Location; import org.bukkit.Server; +import org.bukkit.command.CommandSender; public class Commandgetpos extends EssentialsCommand @@ -11,15 +12,44 @@ public class Commandgetpos extends EssentialsCommand { super("getpos"); } - + @Override public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - final Location coords = user.getLocation(); - user.sendMessage("§7X: " + coords.getBlockX() + " (+East <-> -West)"); - user.sendMessage("§7Y: " + coords.getBlockY() + " (+Up <-> -Down)"); - user.sendMessage("§7Z: " + coords.getBlockZ() + " (+South <-> -North)"); - user.sendMessage("§7Yaw: " + (coords.getYaw() + 180 + 360) % 360 + " (Rotation)"); - user.sendMessage("§7Pitch: " + coords.getPitch() + " (Head angle)"); + if (args.length > 0 && user.isAuthorized("essentials.getpos.others")) + { + final User otherUser = getPlayer(server, args, 0); + outputPosition(user, otherUser.getLocation(), user.getLocation()); + } + else + { + outputPosition(user, user.getLocation(), null); + } + } + + @Override + protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception + { + if (args.length < 1) + { + throw new NotEnoughArgumentsException(); + } + final User user = getPlayer(server, args, 0); + outputPosition(sender, user.getLocation(), null); + } + + //TODO: Translate + private void outputPosition(final CommandSender sender, final Location coords, final Location distance) + { + sender.sendMessage("§7World: " + coords.getWorld().getName()); + sender.sendMessage("§7X: " + coords.getBlockX() + " (+East <-> -West)"); + sender.sendMessage("§7Y: " + coords.getBlockY() + " (+Up <-> -Down)"); + sender.sendMessage("§7Z: " + coords.getBlockZ() + " (+South <-> -North)"); + sender.sendMessage("§7Yaw: " + (coords.getYaw() + 180 + 360) % 360 + " (Rotation)"); + sender.sendMessage("§7Pitch: " + coords.getPitch() + " (Head angle)"); + if (distance != null && coords.getWorld().equals(distance.getWorld())) + { + sender.sendMessage("§7Distance: " + coords.distance(distance)); + } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java index 52e3375cd..d6e3d8f98 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.commands; -import com.earth2me.essentials.InventoryWorkaround; +import com.earth2me.essentials.craftbukkit.InventoryWorkaround; import com.earth2me.essentials.User; import java.util.Locale; import org.bukkit.ChatColor; @@ -41,10 +41,21 @@ public class Commandgive extends EssentialsCommand { throw new Exception(ChatColor.RED + "You are not allowed to spawn the item " + itemname); } + + final User giveTo = getPlayer(server, args, 0); + if (args.length > 2 && Integer.parseInt(args[2]) > 0) { stack.setAmount(Integer.parseInt(args[2])); } + else if (ess.getSettings().getDefaultStackSize() > 0) + { + stack.setAmount(ess.getSettings().getDefaultStackSize()); + } + else if (ess.getSettings().getOversizedStackSize() > 0 && giveTo.isAuthorized("essentials.oversizedstacks")) + { + stack.setAmount(ess.getSettings().getOversizedStackSize()); + } if (args.length > 3) { @@ -74,12 +85,14 @@ public class Commandgive extends EssentialsCommand throw new Exception(ChatColor.RED + "You can't give air."); } - 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() + "."); - if (giveTo.isAuthorized("essentials.oversizedstacks")) { + if (giveTo.isAuthorized("essentials.oversizedstacks")) + { InventoryWorkaround.addItem(giveTo.getInventory(), true, ess.getSettings().getOversizedStackSize(), stack); - } else { + } + else + { InventoryWorkaround.addItem(giveTo.getInventory(), true, stack); } giveTo.updateInventory(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgod.java b/Essentials/src/com/earth2me/essentials/commands/Commandgod.java index 9506e48b5..4d5bd424b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgod.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgod.java @@ -28,7 +28,7 @@ public class Commandgod extends EssentialsCommand @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - if (args.length > 0 && user.isAuthorized("essentials.god.others")) + if (args.length > 0 && !args[0].trim().isEmpty() && user.isAuthorized("essentials.god.others")) { godOtherPlayers(server, user, args[0]); return; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java index 090cebd4c..d1db6c523 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.Locale; import org.bukkit.Location; import org.bukkit.Server; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class Commandhome extends EssentialsCommand @@ -43,11 +44,13 @@ public class Commandhome extends EssentialsCommand } try { - if ("bed".equalsIgnoreCase(homeName)) { + if ("bed".equalsIgnoreCase(homeName)) + { final Location bed = player.getBedSpawnLocation(); if (bed != null) { - user.getTeleport().teleport(bed, charge); + user.getTeleport().teleport(bed, charge, TeleportCause.COMMAND); + return; } } user.getTeleport().home(player, homeName.toLowerCase(Locale.ENGLISH), charge); @@ -57,18 +60,14 @@ public class Commandhome extends EssentialsCommand final List<String> homes = player.getHomes(); if (homes.isEmpty() && player.equals(user)) { - final Location loc = player.getBedSpawnLocation(); - if (loc == null) - { - if (ess.getSettings().spawnIfNoHome()) - { - user.getTeleport().respawn(ess.getSpawn(), charge); - } - } - else + final Location bed = player.getBedSpawnLocation(); + if (bed != null) { - user.getTeleport().teleport(loc, charge); + user.getTeleport().teleport(bed, charge, TeleportCause.COMMAND); + return; } + user.getTeleport().respawn(charge, TeleportCause.COMMAND); + return; } else if (homes.isEmpty()) { @@ -77,6 +76,7 @@ public class Commandhome extends EssentialsCommand else if (homes.size() == 1 && player.equals(user)) { user.getTeleport().home(player, homes.get(0), charge); + return; } else { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java index d53fe8a77..1f5c32faa 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java @@ -2,7 +2,6 @@ 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; @@ -30,7 +29,7 @@ public class Commandinvsee extends EssentialsCommand } if (invUser == user && user.getSavedInventory() != null) { - EnchantmentFix.setContents(invUser.getInventory(), user.getSavedInventory()); + invUser.getInventory().setContents(user.getSavedInventory()); user.setSavedInventory(null); user.sendMessage(_("invRestored")); throw new NoChargeException(); @@ -50,7 +49,7 @@ public class Commandinvsee extends EssentialsCommand { throw new Exception(_("invBigger")); } - EnchantmentFix.setContents(user.getInventory(), invUserStack); + user.getInventory().setContents(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 a749bb0a8..405b8b799 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.commands; -import com.earth2me.essentials.InventoryWorkaround; +import com.earth2me.essentials.craftbukkit.InventoryWorkaround; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import java.util.Locale; @@ -41,6 +41,14 @@ public class Commanditem extends EssentialsCommand { stack.setAmount(Integer.parseInt(args[1])); } + else if (ess.getSettings().getDefaultStackSize() > 0) + { + stack.setAmount(ess.getSettings().getDefaultStackSize()); + } + else if (ess.getSettings().getOversizedStackSize() > 0 && user.isAuthorized("essentials.oversizedstacks")) + { + stack.setAmount(ess.getSettings().getOversizedStackSize()); + } if (args.length > 2) { @@ -72,9 +80,12 @@ public class Commanditem extends EssentialsCommand final String displayName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' '); user.sendMessage(_("itemSpawn", stack.getAmount(), displayName)); - if (user.isAuthorized("essentials.oversizedstacks")) { + if (user.isAuthorized("essentials.oversizedstacks")) + { InventoryWorkaround.addItem(user.getInventory(), true, ess.getSettings().getOversizedStackSize(), stack); - } else { + } + else + { InventoryWorkaround.addItem(user.getInventory(), true, stack); } user.updateInventory(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java new file mode 100644 index 000000000..2fff20e8c --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java @@ -0,0 +1,37 @@ +package com.earth2me.essentials.commands; + +import org.bukkit.Server; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + + +public class Commanditemdb extends EssentialsCommand +{ + public Commanditemdb() + { + super("find"); + } + + @Override + protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + { + ItemStack itemStack = null; + if (args.length < 1) + { + if (sender instanceof Player) + { + itemStack = ((Player)sender).getItemInHand(); + } + if (itemStack == null) + { + throw new NotEnoughArgumentsException(); + } + } + else + { + itemStack = ess.getItemDb().get(args[0]); + } + sender.sendMessage(itemStack.getType().toString() + "- " + itemStack.getTypeId() + ":" + Integer.toString(itemStack.getData().getData())); + } +} diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandjails.java b/Essentials/src/com/earth2me/essentials/commands/Commandjails.java index c5473e08d..051bcf710 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandjails.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandjails.java @@ -15,6 +15,6 @@ public class Commandjails extends EssentialsCommand @Override protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception { - sender.sendMessage("§7" + Util.joinList(" ", ess.getJail().getJails())); + sender.sendMessage("§7" + Util.joinList(" ", ess.getJails().getList())); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandjump.java b/Essentials/src/com/earth2me/essentials/commands/Commandjump.java index 93ce45fd4..39ca305e3 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandjump.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandjump.java @@ -1,11 +1,12 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.TargetBlock; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; import org.bukkit.Location; import org.bukkit.Server; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class Commandjump extends EssentialsCommand @@ -15,7 +16,6 @@ public class Commandjump extends EssentialsCommand super("jump"); } - //TODO: Update to use new target methods @Override public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { @@ -24,10 +24,7 @@ public class Commandjump extends EssentialsCommand try { - loc = new TargetBlock(user, 100, 2.65).getTargetBlock().getLocation(); - loc.setYaw(cloc.getYaw()); - loc.setPitch(cloc.getPitch()); - loc = new TargetBlock(loc).getPreviousBlock().getLocation(); + loc = Util.getTarget(user); loc.setYaw(cloc.getYaw()); loc.setPitch(cloc.getPitch()); loc.setY(loc.getY() + 1); @@ -39,6 +36,6 @@ public class Commandjump extends EssentialsCommand final Trade charge = new Trade(this.getName(), ess); charge.isAffordableFor(user); - user.getTeleport().teleport(loc, charge); + user.getTeleport().teleport(loc, charge, TeleportCause.COMMAND); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java index 2e09f28ba..8392d4759 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.commands; -import com.earth2me.essentials.InventoryWorkaround; +import com.earth2me.essentials.craftbukkit.InventoryWorkaround; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; @@ -114,7 +114,15 @@ 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 Map<Integer, ItemStack> overfilled = InventoryWorkaround.addItem(user.getInventory(), true, new ItemStack(id, amount, data)); + final Map<Integer, ItemStack> overfilled; + if (user.isAuthorized("essentials.oversizedstacks")) + { + overfilled = InventoryWorkaround.addItem(user.getInventory(), true, ess.getSettings().getOversizedStackSize(), new ItemStack(id, amount, data)); + } + else + { + 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/Commandlightning.java b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java index 582f048a1..be9ac61f5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java @@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; import org.bukkit.command.CommandSender; +import org.bukkit.entity.LightningStrike; import org.bukkit.entity.Player; @@ -34,10 +35,30 @@ public class Commandlightning extends EssentialsCommand throw new Exception(_("playerNotFound")); } + int power = 1; + if (args.length > 1) + { + try + { + power = Integer.parseInt(args[1]); + } + catch (NumberFormatException ex) + { + } + } + for (Player matchPlayer : server.matchPlayer(args[0])) { sender.sendMessage(_("lightningUse", matchPlayer.getDisplayName())); - matchPlayer.getWorld().strikeLightning(matchPlayer.getLocation()); + if (power <= 0) + { + matchPlayer.getWorld().strikeLightningEffect(matchPlayer.getLocation()); + } + else + { + LightningStrike strike = matchPlayer.getWorld().strikeLightning(matchPlayer.getLocation()); + matchPlayer.damage(power - 1, strike); + } if (!ess.getUser(matchPlayer).isGodModeEnabled()) { matchPlayer.setHealth(matchPlayer.getHealth() < 5 ? 0 : matchPlayer.getHealth() - 5); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java index d02e5a13a..884238393 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java @@ -39,7 +39,7 @@ public class Commandmail extends EssentialsCommand { if (!user.isAuthorized("essentials.mail.send")) { - throw new Exception(_("noMailSendPerm")); + throw new Exception(_("noPerm","essentials.mail.send")); } Player player = server.getPlayer(args[1]); @@ -63,6 +63,16 @@ public class Commandmail extends EssentialsCommand user.sendMessage(_("mailSent")); return; } + if (args.length > 1 && "sendall".equalsIgnoreCase(args[0])) + { + if (!user.isAuthorized("essentials.mail.sendall")) + { + throw new Exception(_("noPerm","essentials.mail.sendall")); + } + ess.scheduleAsyncDelayedTask(new SendAll(ChatColor.stripColor(user.getDisplayName()) + ": " + getFinalArg(args, 1))); + user.sendMessage(_("mailSent")); + return; + } if (args.length >= 1 && "clear".equalsIgnoreCase(args[0])) { user.setMails(null); @@ -103,6 +113,10 @@ public class Commandmail extends EssentialsCommand sender.sendMessage(_("mailSent")); return; } + else if (args.length >= 1 && "sendall".equalsIgnoreCase(args[0])) + { + ess.scheduleAsyncDelayedTask(new SendAll("Server: " + getFinalArg(args, 2))); + } else if (args.length >= 2) { //allow sending from console without "send" argument, since it's the only thing the console can do @@ -126,4 +140,28 @@ public class Commandmail extends EssentialsCommand } throw new NotEnoughArgumentsException(); } + + + private class SendAll implements Runnable + { + String message; + + public SendAll(String message) + { + this.message = message; + } + + @Override + public void run() + { + for (String username : ess.getUserMap().getAllUniqueUsers()) + { + User user = ess.getUserMap().getUser(username); + if (user != null) + { + user.addMail(message); + } + } + } + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmore.java b/Essentials/src/com/earth2me/essentials/commands/Commandmore.java new file mode 100644 index 000000000..3fce3110c --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmore.java @@ -0,0 +1,50 @@ +package com.earth2me.essentials.commands; + +import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.User; +import java.util.Locale; +import org.bukkit.Server; +import org.bukkit.inventory.ItemStack; + + +public class Commandmore extends EssentialsCommand +{ + public Commandmore() + { + super("more"); + } + + @Override + public 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(_("cantSpawnItem", "Air")); + } + if (stack.getAmount() >= ((user.isAuthorized("essentials.oversizedstacks")) + ? ess.getSettings().getOversizedStackSize() : stack.getMaxStackSize())) + { + throw new NoChargeException(); + } + final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""); + if (ess.getSettings().permissionBasedItemSpawn() + ? (!user.isAuthorized("essentials.itemspawn.item-all") + && !user.isAuthorized("essentials.itemspawn.item-" + itemname) + && !user.isAuthorized("essentials.itemspawn.item-" + stack.getTypeId())) + : (!user.isAuthorized("essentials.itemspawn.exempt") + && !user.canSpawnItem(stack.getTypeId()))) + { + throw new Exception(_("cantSpawnItem", itemname)); + } + if (user.isAuthorized("essentials.oversizedstacks")) + { + stack.setAmount(ess.getSettings().getOversizedStackSize()); + } + else + { + stack.setAmount(stack.getMaxStackSize()); + } + user.updateInventory(); + } +}
\ No newline at end of file diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnear.java b/Essentials/src/com/earth2me/essentials/commands/Commandnear.java new file mode 100644 index 000000000..18fb798af --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandnear.java @@ -0,0 +1,120 @@ +package com.earth2me.essentials.commands; + +import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.User; +import org.bukkit.Location; +import org.bukkit.Server; +import org.bukkit.World; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + + +public class Commandnear extends EssentialsCommand +{ + public Commandnear() + { + super("near"); + } + + @Override + protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception + { + long radius = 100; + User otherUser = null; + + if (args.length > 0) + { + try + { + otherUser = getPlayer(server, args, 0); + } + catch (Exception ex) + { + try + { + radius = Long.parseLong(args[0]); + } + catch (NumberFormatException e) + { + } + } + } + if (args.length > 1 && otherUser != null) + { + try + { + radius = Long.parseLong(args[1]); + } + catch (NumberFormatException e) + { + } + } + if (otherUser == null || user.isAuthorized("essentials.near.others")) + { + user.sendMessage(_("nearbyPlayers", getLocal(server, otherUser == null ? user : otherUser, radius))); + } + else + { + user.sendMessage(_("noAccessCommand")); + } + } + + @Override + protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception + { + + User otherUser = null; + if (args.length > 0) + { + otherUser = getPlayer(server, args, 0); + } + else + { + throw new NotEnoughArgumentsException(); + } + long radius = 100; + if (args.length > 1) + { + try + { + radius = Long.parseLong(args[1]); + } + catch (NumberFormatException e) + { + } + } + sender.sendMessage(_("nearbyPlayers", getLocal(server, otherUser, radius))); + } + + private String getLocal(final Server server, final User user, final long radius) + { + final Location loc = user.getLocation(); + final World world = loc.getWorld(); + final StringBuilder output = new StringBuilder(); + final long radiusSquared = radius * radius; + + for (Player onlinePlayer : server.getOnlinePlayers()) + { + final User player = ess.getUser(onlinePlayer); + if (!player.equals(user) && !player.isHidden()) + { + final Location playerLoc = player.getLocation(); + if (playerLoc.getWorld() != world) + { + continue; + } + + final long delta = (long)playerLoc.distanceSquared(loc); + if (delta < radiusSquared) + { + if (output.length() > 0) + { + output.append(", "); + } + output.append(player.getDisplayName()).append("§f(§4").append(Math.sqrt(delta)).append("m§f)"); + } + } + } + return output.length() > 1 ? output.toString() : _("none"); + } +} diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java index a1f1c77ca..95ad5ea84 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java @@ -50,7 +50,14 @@ public class Commandnick extends EssentialsCommand { throw new Exception(_("nickDisplayName")); } - setNickname(server, getPlayer(server, args, 0), formatNickname(null, args[1])); + if ((args[0].equalsIgnoreCase("*") || args[0].equalsIgnoreCase("all")) && args[1].equalsIgnoreCase("off")) + { + resetAllNicknames(server); + } + else + { + setNickname(server, getPlayer(server, args, 0), formatNickname(null, args[1])); + } sender.sendMessage(_("nickChanged")); } @@ -63,6 +70,20 @@ public class Commandnick extends EssentialsCommand return nick; } + private void resetAllNicknames(final Server server) + { + for (Player player : server.getOnlinePlayers()) + { + try + { + setNickname(server, ess.getUser(player), "off"); + } + catch (Exception ex) + { + } + } + } + private void setNickname(final Server server, final User target, final String nick) throws Exception { if (nick.matches("[^a-zA-Z_0-9]")) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java index 23ca5c465..53927e012 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java @@ -1,6 +1,7 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import org.bukkit.Server; import org.bukkit.entity.Player; @@ -32,6 +33,7 @@ public class Commandpay extends EssentialsCommand continue; } user.payUser(u, amount); + Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), u.getName(), new Trade(amount, ess), user.getLocation(), ess); foundUser = true; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandr.java b/Essentials/src/com/earth2me/essentials/commands/Commandr.java index c53ef1bf0..1da198444 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandr.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandr.java @@ -17,18 +17,18 @@ public class Commandr extends EssentialsCommand } @Override - public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception { if (args.length < 1) { throw new NotEnoughArgumentsException(); } - String message = getFinalArg(args, 0); - IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo(); - String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; - CommandSender target = replyTo.getReplyTo(); - String targetName = target instanceof Player ? ((Player)target).getDisplayName() : Console.NAME; + final String message = getFinalArg(args, 0); + final IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo(); + final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; + final CommandSender target = replyTo.getReplyTo(); + final String targetName = target instanceof Player ? ((Player)target).getDisplayName() : Console.NAME; if (target == null) { @@ -38,8 +38,8 @@ public class Commandr extends EssentialsCommand sender.sendMessage(_("msgFormat", _("me"), targetName, message)); if (target instanceof Player) { - User u = ess.getUser(target); - if (u.isIgnoredPlayer(sender instanceof Player ? ((Player)sender).getName() : Console.NAME)) + User player = ess.getUser(target); + if (player.isIgnoredPlayer(sender instanceof Player ? ((Player)sender).getName() : Console.NAME)) { return; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java index d3d82860d..6266b5178 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java @@ -17,16 +17,16 @@ public class Commandrealname extends EssentialsCommand } @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception { if (args.length < 1) { throw new NotEnoughArgumentsException(); } final String whois = args[0].toLowerCase(Locale.ENGLISH); - for (Player p : server.getOnlinePlayers()) + for (Player onlinePlayer : server.getOnlinePlayers()) { - final User u = ess.getUser(p); + final User u = ess.getUser(onlinePlayer); if (u.isHidden()) { continue; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandremove.java b/Essentials/src/com/earth2me/essentials/commands/Commandremove.java new file mode 100644 index 000000000..d245d1239 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandremove.java @@ -0,0 +1,161 @@ +package com.earth2me.essentials.commands; + +import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.User; +import java.util.Locale; +import org.bukkit.Chunk; +import org.bukkit.Server; +import org.bukkit.World; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.*; + + +public class Commandremove extends EssentialsCommand +{ + public Commandremove() + { + super("remove"); + } + + + private enum ToRemove + { + DROPS, + ARROWS, + BOATS, + MINECARTS, + XP, + PAINTINGS + } + + @Override + protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception + { + if (args.length < 1) + { + throw new NotEnoughArgumentsException(); + } + ToRemove toRemove; + final World world = user.getWorld(); + int radius = 0; + + if (args.length < 2) + { + try + { + radius = Integer.parseInt(args[1]); + } + catch (NumberFormatException e) + { + throw new Exception(_("numberRequired")); + } + } + + try + { + toRemove = ToRemove.valueOf(args[0].toUpperCase(Locale.ENGLISH)); + } + catch (IllegalArgumentException e) + { + throw new NotEnoughArgumentsException(); //TODO: translate and list types + } + + removeEntities(user, world, toRemove, radius); + } + + @Override + protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception + { + if (args.length < 2) + { + throw new NotEnoughArgumentsException(); + } + World world; + world = ess.getWorld(args[1]); + + if (world == null) + { + throw new Exception(_("invalidWorld")); + } + ToRemove toRemove; + try + { + toRemove = ToRemove.valueOf(args[0].toUpperCase(Locale.ENGLISH)); + } + catch (IllegalArgumentException e) + { + throw new NotEnoughArgumentsException(); //TODO: translate and list types + } + removeEntities(sender, world, toRemove, 0); + } + + protected void removeEntities(final CommandSender sender, final World world, final ToRemove toRemove, int radius) throws Exception + { + int removed = 0; + if (radius > 0) { + radius*=radius; + } + for (Chunk chunk : world.getLoadedChunks()) + { + for (Entity e : chunk.getEntities()) + { + if (radius > 0) + { + if (((Player)sender).getLocation().distanceSquared(e.getLocation()) > radius) + { + continue; + } + } + if (toRemove == ToRemove.DROPS) + { + if (e instanceof Item) + { + e.remove(); + removed++; + } + } + else if (toRemove == ToRemove.ARROWS) + { + if (e instanceof Projectile) + { + e.remove(); + removed++; + } + } + else if (toRemove == ToRemove.BOATS) + { + if (e instanceof Boat) + { + e.remove(); + removed++; + } + } + else if (toRemove == ToRemove.DROPS) + { + if (e instanceof Minecart) + { + e.remove(); + removed++; + } + } + else if (toRemove == ToRemove.XP) + { + if (e instanceof ExperienceOrb) + { + e.remove(); + removed++; + } + } + else if (toRemove == ToRemove.PAINTINGS) + { + if (e instanceof Painting) + { + e.remove(); + removed++; + } + } + } + } + sender.sendMessage(_("removed", removed)); + } +} diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java index 50c6ac7af..cf9e43f9f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java @@ -32,6 +32,14 @@ public class Commandrepair extends EssentialsCommand { throw new Exception(_("repairInvalidType")); } + + if (!item.getEnchantments().isEmpty() + && !ess.getSettings().getRepairEnchanted() + && !user.isAuthorized("essentials.repair.enchanted")) + { + throw new Exception(_("repairEnchanted")); + } + final String itemName = item.getType().toString().toLowerCase(Locale.ENGLISH); final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess); @@ -104,6 +112,12 @@ public class Commandrepair extends EssentialsCommand user.sendMessage(ex.getMessage()); continue; } + if (!item.getEnchantments().isEmpty() + && !ess.getSettings().getRepairEnchanted() + && !user.isAuthorized("essentials.repair.enchanted")) + { + continue; + } try { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrules.java b/Essentials/src/com/earth2me/essentials/commands/Commandrules.java index a981fb2f1..d87c4f41b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrules.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrules.java @@ -16,7 +16,7 @@ public class Commandrules extends EssentialsCommand } @Override - public void run(final Server server, final CommandSender sender, final String commandLabel, String[] args) throws Exception + public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception { final IText input = new TextInput(sender, "rules", true, ess); final IText output = new KeywordReplacer(input, sender, ess); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java index 391ed36b3..cf500e094 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java @@ -15,7 +15,7 @@ public class Commandseen extends EssentialsCommand } @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception { if (args.length < 1) { @@ -34,6 +34,10 @@ public class Commandseen extends EssentialsCommand throw new Exception(_("playerNotFound")); } sender.sendMessage(_("seenOffline", u.getDisplayName(), Util.formatDateDiff(u.getLastLogout()))); + if (u.isBanned()) + { + sender.sendMessage(_("whoisBanned", _("true"))); + } } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java index 554bb4a2e..d59c09b1e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java @@ -1,7 +1,7 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.InventoryWorkaround; +import com.earth2me.essentials.craftbukkit.InventoryWorkaround; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; @@ -20,7 +20,7 @@ public class Commandsell extends EssentialsCommand } @Override - public void run(Server server, User user, String commandLabel, String[] args) throws Exception + public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length < 1) { @@ -156,7 +156,7 @@ public class Commandsell extends EssentialsCommand //TODO: Prices for Enchantments final ItemStack ris = is.clone(); ris.setAmount(amount); - InventoryWorkaround.removeItem(user.getInventory(), true, ris); + InventoryWorkaround.removeItem(user.getInventory(), true, true, ris); user.updateInventory(); Trade.log("Command", "Sell", "Item", user.getName(), new Trade(ris, ess), user.getName(), new Trade(worth * amount, ess), user.getLocation(), ess); user.giveMoney(worth * amount); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java index 6d05e4e3e..e7687fcfd 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java @@ -14,7 +14,7 @@ public class Commandsethome extends EssentialsCommand } @Override - public void run(Server server, User user, String commandLabel, String[] args) throws Exception + public void run(final Server server, final User user, final String commandLabel, String[] args) throws Exception { if (args.length > 0) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetjail.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetjail.java index 506829ad9..8ed298303 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsetjail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetjail.java @@ -13,13 +13,13 @@ public class Commandsetjail extends EssentialsCommand } @Override - public void run(Server server, User user, String commandLabel, String[] args) throws Exception + public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length < 1) { throw new NotEnoughArgumentsException(); } - ess.getJail().setJail(user.getLocation(), args[0]); + ess.getJails().setJail(args[0], user.getLocation()); user.sendMessage(_("jailSet", args[0])); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java index 77bbee7c0..bf5c11abe 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java @@ -14,14 +14,14 @@ public class Commandsetwarp extends EssentialsCommand } @Override - public void run(Server server, User user, String commandLabel, String[] args) throws Exception + public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length < 1) { throw new NotEnoughArgumentsException(); } - Location loc = user.getLocation(); + final Location loc = user.getLocation(); ess.getWarps().setWarp(args[0], loc); user.sendMessage(_("warpSet", args[0])); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java index 3f80fddf1..1d236b70a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java @@ -14,7 +14,7 @@ public class Commandsetworth extends EssentialsCommand } @Override - public void run(Server server, User user, String commandLabel, String[] args) throws Exception + public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length < 2) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java b/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java index b7ce4edcb..6080642a1 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java @@ -13,7 +13,7 @@ public class Commandsocialspy extends EssentialsCommand } @Override - public void run(Server server, User user, String commandLabel, String[] args) throws Exception + public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { user.sendMessage("§7SocialSpy " + (user.toggleSocialSpy() ? _("enabled") : _("disabled"))); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java index e3b1ef366..73c86eba4 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java @@ -8,7 +8,6 @@ import java.util.Locale; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Server; -import org.bukkit.block.Block; import org.bukkit.block.CreatureSpawner; @@ -20,7 +19,7 @@ public class Commandspawner extends EssentialsCommand } @Override - protected void run(Server server, User user, String commandLabel, String[] args) throws Exception + protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length < 1 || args[0].length() < 2) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java index c9970c068..f867a1503 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java @@ -22,7 +22,7 @@ public class Commandspawnmob extends EssentialsCommand } @Override - public void run(Server server, User user, String commandLabel, String[] args) throws Exception + public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length < 1) { @@ -30,7 +30,7 @@ public class Commandspawnmob extends EssentialsCommand } - String[] mountparts = args[0].split(","); + final String[] mountparts = args[0].split(","); String[] parts = mountparts[0].split(":"); String mobType = parts[0]; String mobData = null; @@ -64,11 +64,11 @@ public class Commandspawnmob extends EssentialsCommand if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase(Locale.ENGLISH))) { - throw new Exception(_("unableToSpawnMob")); + throw new Exception(_("disabledToSpawnMob")); } if (!user.isAuthorized("essentials.spawnmob." + mob.name.toLowerCase())) { - throw new Exception(_("unableToSpawnMob")); + throw new Exception(_("noPermToSpawnMob")); } final Block block = Util.getTarget(user).getBlock(); @@ -76,8 +76,13 @@ public class Commandspawnmob extends EssentialsCommand { throw new Exception(_("unableToSpawnMob")); } - Location loc = block.getLocation(); - Location sloc = Util.getSafeDestination(loc); + User otherUser = null; + if (args.length >= 3) + { + otherUser = getPlayer(ess.getServer(), args, 2); + } + final Location loc = (otherUser == null) ? block.getLocation() : otherUser.getLocation(); + final Location sloc = Util.getSafeDestination(loc); try { spawnedMob = mob.spawn(user, server, sloc); @@ -98,11 +103,11 @@ public class Commandspawnmob extends EssentialsCommand if (ess.getSettings().getProtectPreventSpawn(mobMount.getType().toString().toLowerCase(Locale.ENGLISH))) { - throw new Exception(_("unableToSpawnMob")); + throw new Exception(_("disabledToSpawnMob")); } if (!user.isAuthorized("essentials.spawnmob." + mobMount.name.toLowerCase())) { - throw new Exception(_("unableToSpawnMob")); + throw new Exception(_("noPermToSpawnMob")); } try { @@ -122,7 +127,7 @@ public class Commandspawnmob extends EssentialsCommand { changeMobData(mobMount.getType(), spawnedMount, mountData, user); } - if (args.length == 2) + if (args.length >= 2) { int mobCount = Integer.parseInt(args[1]); int serverLimit = ess.getSettings().getSpawnMobLimit(); @@ -179,7 +184,7 @@ public class Commandspawnmob extends EssentialsCommand } } - private void changeMobData(CreatureType type, Entity spawned, String data, User user) throws Exception + private void changeMobData(final CreatureType type, final Entity spawned, final String data, final User user) throws Exception { if (type == CreatureType.SLIME || type == CreatureType.MAGMA_CUBE) { @@ -194,6 +199,7 @@ public class Commandspawnmob extends EssentialsCommand } if ((type == CreatureType.SHEEP || type == CreatureType.COW + || type == CreatureType.MUSHROOM_COW || type == CreatureType.CHICKEN || type == CreatureType.PIG || type == CreatureType.WOLF) @@ -204,16 +210,22 @@ public class Commandspawnmob extends EssentialsCommand } if (type == CreatureType.SHEEP) { + if (data.toLowerCase(Locale.ENGLISH).contains("baby")) + { + ((Sheep)spawned).setAge(-24000); + } + final String color = data.toUpperCase(Locale.ENGLISH).replace("BABY", ""); try { - if (data.equalsIgnoreCase("random")) + + if (color.equalsIgnoreCase("random")) { Random rand = new Random(); ((Sheep)spawned).setColor(DyeColor.values()[rand.nextInt(DyeColor.values().length)]); } else { - ((Sheep)spawned).setColor(DyeColor.valueOf(data.toUpperCase(Locale.ENGLISH))); + ((Sheep)spawned).setColor(DyeColor.valueOf(color)); } } catch (Exception e) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java index 323836ffb..f98343311 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java @@ -47,12 +47,12 @@ public class Commandtogglejail extends EssentialsCommand } if (!(player.getBase() instanceof OfflinePlayer)) { - ess.getJail().sendToJail(player, args[1]); + ess.getJails().sendToJail(player, args[1]); } else { // Check if jail exists - ess.getJail().getJail(args[1]); + ess.getJails().getJail(args[1]); } player.setJailed(true); player.sendMessage(_("userJailed")); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtop.java b/Essentials/src/com/earth2me/essentials/commands/Commandtop.java index 5cd9376cd..e91d0984a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtop.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtop.java @@ -5,6 +5,7 @@ import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import org.bukkit.Location; import org.bukkit.Server; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class Commandtop extends EssentialsCommand @@ -20,7 +21,7 @@ public class Commandtop extends EssentialsCommand final int topX = user.getLocation().getBlockX(); final int topZ = user.getLocation().getBlockZ(); final int topY = user.getWorld().getHighestBlockYAt(topX, topZ); - user.getTeleport().teleport(new Location(user.getWorld(), user.getLocation().getX(), topY + 1, user.getLocation().getZ()), new Trade(this.getName(), ess)); + user.getTeleport().teleport(new Location(user.getWorld(), user.getLocation().getX(), topY + 1, user.getLocation().getZ()), new Trade(this.getName(), ess), TeleportCause.COMMAND); user.sendMessage(_("teleportTop")); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java index 10c381b2e..7ea3f0541 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java @@ -6,6 +6,7 @@ import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import org.bukkit.Server; import org.bukkit.command.CommandSender; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class Commandtp extends EssentialsCommand @@ -32,7 +33,7 @@ public class Commandtp extends EssentialsCommand user.sendMessage(_("teleporting")); final Trade charge = new Trade(this.getName(), ess); charge.isAffordableFor(user); - user.getTeleport().teleport(player, charge); + user.getTeleport().teleport(player, charge, TeleportCause.COMMAND); throw new NoChargeException(); default: @@ -44,7 +45,7 @@ public class Commandtp extends EssentialsCommand user.sendMessage(_("teleporting")); final User target = getPlayer(server, args, 0); final User toPlayer = getPlayer(server, args, 1); - target.getTeleport().now(toPlayer, false); + target.getTeleport().now(toPlayer, false, TeleportCause.COMMAND); target.sendMessage(_("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName())); break; } @@ -61,7 +62,7 @@ public class Commandtp extends EssentialsCommand sender.sendMessage(_("teleporting")); final User target = getPlayer(server, args, 0); final User toPlayer = getPlayer(server, args, 1); - target.getTeleport().now(toPlayer, false); + target.getTeleport().now(toPlayer, false, TeleportCause.COMMAND); target.sendMessage(_("teleportAtoB", Console.NAME, toPlayer.getDisplayName())); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java index 164a1afad..954f3f038 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java @@ -5,6 +5,7 @@ import com.earth2me.essentials.OfflinePlayer; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import org.bukkit.Server; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class Commandtpaccept extends EssentialsCommand @@ -40,11 +41,11 @@ public class Commandtpaccept extends EssentialsCommand if (user.isTeleportRequestHere()) { - user.getTeleport().teleport(target, charge); + user.getTeleport().teleport(target, charge, TeleportCause.COMMAND); } else { - target.getTeleport().teleport(user, charge); + target.getTeleport().teleport(user, charge, TeleportCause.COMMAND); } user.requestTeleport(null, false); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java index d3b8917aa..f21f1a6bc 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java @@ -5,6 +5,7 @@ import com.earth2me.essentials.User; import org.bukkit.Server; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class Commandtpall extends EssentialsCommand @@ -43,7 +44,7 @@ public class Commandtpall extends EssentialsCommand } try { - player.getTeleport().now(user, false); + player.getTeleport().now(user, false, TeleportCause.COMMAND); } catch (Exception ex) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java index ecfb6b6a6..733091d1a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java @@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import org.bukkit.Server; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class Commandtphere extends EssentialsCommand @@ -21,7 +22,7 @@ public class Commandtphere extends EssentialsCommand { throw new Exception(_("teleportDisabled", player.getDisplayName())); } - player.getTeleport().teleport(user, new Trade(this.getName(), ess)); + player.getTeleport().teleport(user, new Trade(this.getName(), ess), TeleportCause.COMMAND); user.sendMessage(_("teleporting")); player.sendMessage(_("teleporting")); throw new NoChargeException(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java index d225725be..7c13b80d4 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java @@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.OfflinePlayer; import com.earth2me.essentials.User; import org.bukkit.Server; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class Commandtpo extends EssentialsCommand @@ -32,7 +33,7 @@ public class Commandtpo extends EssentialsCommand // Verify permission if (!player.isHidden() || user.isAuthorized("essentials.teleport.hidden")) { - user.getTeleport().now(player, false); + user.getTeleport().now(player, false, TeleportCause.COMMAND); user.sendMessage(_("teleporting")); } else diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java index 0a6bc5180..e226f0702 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java @@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.OfflinePlayer; import com.earth2me.essentials.User; import org.bukkit.Server; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class Commandtpohere extends EssentialsCommand @@ -33,7 +34,7 @@ public class Commandtpohere extends EssentialsCommand // Verify permission if (!player.isHidden() || user.isAuthorized("essentials.teleport.hidden")) { - player.getTeleport().now(user, false); + player.getTeleport().now(user, false, TeleportCause.COMMAND); user.sendMessage(_("teleporting")); } else diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java index 203628753..226fa44e3 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java @@ -5,6 +5,7 @@ import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import org.bukkit.Location; import org.bukkit.Server; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class Commandtppos extends EssentialsCommand @@ -37,7 +38,7 @@ public class Commandtppos extends EssentialsCommand final Trade charge = new Trade(this.getName(), ess); charge.isAffordableFor(user); user.sendMessage(_("teleporting")); - user.getTeleport().teleport(location, charge); + user.getTeleport().teleport(location, charge, TeleportCause.COMMAND); throw new NoChargeException(); } }
\ No newline at end of file diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java b/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java index 8891036c6..beff6a77b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java @@ -1,7 +1,7 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.InventoryWorkaround; +import com.earth2me.essentials.craftbukkit.InventoryWorkaround; import com.earth2me.essentials.User; import java.util.List; import java.util.Locale; @@ -103,7 +103,7 @@ public class Commandunlimited extends EssentialsCommand { message = "enableUnlimited"; enableUnlimited = true; - if (!InventoryWorkaround.containsItem(target.getInventory(), true, stack)) + if (!InventoryWorkaround.containsItem(target.getInventory(), true, true, stack)) { target.getInventory().addItem(stack); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java index b15af349d..8fe84ba16 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java @@ -10,6 +10,7 @@ import java.util.Iterator; import java.util.List; import org.bukkit.Server; import org.bukkit.command.CommandSender; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class Commandwarp extends EssentialsCommand @@ -118,11 +119,11 @@ public class Commandwarp extends EssentialsCommand { if (user.isAuthorized("essentials.warp." + name)) { - user.getTeleport().warp(name, charge); + user.getTeleport().warp(name, charge, TeleportCause.COMMAND); return; } throw new Exception(_("warpUsePermission")); } - user.getTeleport().warp(name, charge); + user.getTeleport().warp(name, charge, TeleportCause.COMMAND); } }
\ No newline at end of file diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandworld.java b/Essentials/src/com/earth2me/essentials/commands/Commandworld.java index 7380b23ae..41554c8ce 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandworld.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandworld.java @@ -7,6 +7,7 @@ import java.util.List; import org.bukkit.Location; import org.bukkit.Server; import org.bukkit.World; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class Commandworld extends EssentialsCommand @@ -53,6 +54,15 @@ public class Commandworld extends EssentialsCommand } } + if (ess.getSettings().getIsWorldTeleportPermissions()) + { + if (!user.isAuthorized("essentials.world." + world.getName())) + { + user.sendMessage(_("invalidWorld")); //TODO: Make a "world teleport denied" translation + throw new NoChargeException(); + } + } + double factor; if (user.getWorld().getEnvironment() == World.Environment.NETHER && world.getEnvironment() == World.Environment.NORMAL) { @@ -72,7 +82,7 @@ public class Commandworld extends EssentialsCommand final Trade charge = new Trade(this.getName(), ess); charge.isAffordableFor(user); - user.getTeleport().teleport(target, charge); + user.getTeleport().teleport(target, charge, TeleportCause.COMMAND); throw new NoChargeException(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java index 6b9d17b26..13328e1b5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java +++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java @@ -2,6 +2,7 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.IEssentialsModule; import com.earth2me.essentials.OfflinePlayer; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; @@ -17,6 +18,7 @@ public abstract class EssentialsCommand implements IEssentialsCommand { private final transient String name; protected transient IEssentials ess; + protected transient IEssentialsModule module; protected final static Logger logger = Logger.getLogger("Minecraft"); protected EssentialsCommand(final String name) @@ -29,6 +31,12 @@ public abstract class EssentialsCommand implements IEssentialsCommand { this.ess = ess; } + + @Override + public void setEssentialsModule(final IEssentialsModule module) + { + this.module = module; + } @Override public String getName() diff --git a/Essentials/src/com/earth2me/essentials/commands/IEssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/IEssentialsCommand.java index f16d3059c..439c14d70 100644 --- a/Essentials/src/com/earth2me/essentials/commands/IEssentialsCommand.java +++ b/Essentials/src/com/earth2me/essentials/commands/IEssentialsCommand.java @@ -1,6 +1,7 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.IEssentialsModule; import com.earth2me.essentials.User; import org.bukkit.Server; import org.bukkit.command.Command; @@ -18,4 +19,6 @@ public interface IEssentialsCommand throws Exception; void setEssentials(IEssentials ess); + + void setEssentialsModule(IEssentialsModule module); } diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/EnchantmentFix.java b/Essentials/src/com/earth2me/essentials/craftbukkit/EnchantmentFix.java deleted file mode 100644 index b6e18cb3f..000000000 --- a/Essentials/src/com/earth2me/essentials/craftbukkit/EnchantmentFix.java +++ /dev/null @@ -1,66 +0,0 @@ -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/FakeInventory.java b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeInventory.java index 6496fb75b..992791710 100644 --- a/Essentials/src/com/earth2me/essentials/FakeInventory.java +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeInventory.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials; +package com.earth2me.essentials.craftbukkit; import java.util.HashMap; import org.bukkit.Material; diff --git a/Essentials/src/com/earth2me/essentials/FakeWorld.java b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java index 0032b6845..bd4d09111 100644 --- a/Essentials/src/com/earth2me/essentials/FakeWorld.java +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials; +package com.earth2me.essentials.craftbukkit; import java.io.File; import java.util.List; @@ -15,10 +15,10 @@ import org.bukkit.util.Vector; public class FakeWorld implements World { - private final String name; private final Environment env; - FakeWorld(String string, Environment environment) + + public FakeWorld(String string, Environment environment) { this.name = string; this.env = environment; @@ -444,7 +444,6 @@ public class FakeWorld implements World throw new UnsupportedOperationException("Not supported yet."); } - @Override public Biome getBiome(int i, int i1) { @@ -498,19 +497,19 @@ public class FakeWorld implements World { throw new UnsupportedOperationException("Not supported yet."); } - + @Override public Difficulty getDifficulty() { throw new UnsupportedOperationException("Not supported yet."); } - + @Override public void setDifficulty(Difficulty difficulty) { throw new UnsupportedOperationException("Not supported yet."); } - + @Override public int getSeaLevel() { diff --git a/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java b/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java index 19edce8d0..308568452 100644 --- a/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java @@ -1,6 +1,6 @@ -package com.earth2me.essentials; +package com.earth2me.essentials.craftbukkit; -import com.earth2me.essentials.craftbukkit.EnchantmentFix; +import com.earth2me.essentials.craftbukkit.FakeInventory; import java.util.HashMap; import java.util.Map; import org.bukkit.Location; @@ -20,12 +20,12 @@ public final class InventoryWorkaround { } - public static int first(final Inventory inventory, final ItemStack item, final boolean forceDurability, final boolean forceAmount) + public static int first(final Inventory inventory, final ItemStack item, final boolean forceDurability, final boolean forceAmount, final boolean forceEnchantments) { - return next(inventory, item, 0, forceDurability, forceAmount); + return next(inventory, item, 0, forceDurability, forceAmount, forceEnchantments); } - public static int next(final Inventory cinventory, final ItemStack item, final int start, final boolean forceDurability, final boolean forceAmount) + public static int next(final Inventory cinventory, final ItemStack item, final int start, final boolean forceDurability, final boolean forceAmount, final boolean forceEnchantments) { final ItemStack[] inventory = cinventory.getContents(); for (int i = start; i < inventory.length; i++) @@ -35,7 +35,7 @@ public final class InventoryWorkaround { continue; } - if (item.getTypeId() == cItem.getTypeId() && (!forceAmount || item.getAmount() == cItem.getAmount()) && (!forceDurability || cItem.getDurability() == item.getDurability()) && cItem.getEnchantments().equals(item.getEnchantments())) + if (item.getTypeId() == cItem.getTypeId() && (!forceAmount || item.getAmount() == cItem.getAmount()) && (!forceDurability || cItem.getDurability() == item.getDurability()) && (!forceEnchantments || cItem.getEnchantments().equals(item.getEnchantments()))) { return i; } @@ -45,6 +45,11 @@ public final class InventoryWorkaround public static int firstPartial(final Inventory cinventory, final ItemStack item, final boolean forceDurability) { + return firstPartial(cinventory, item, forceDurability, item.getType().getMaxStackSize()); + } + + public static int firstPartial(final Inventory cinventory, final ItemStack item, final boolean forceDurability, final int maxAmount) + { if (item == null) { return -1; @@ -57,7 +62,7 @@ public final class InventoryWorkaround { continue; } - if (item.getTypeId() == cItem.getTypeId() && cItem.getAmount() < cItem.getType().getMaxStackSize() && (!forceDurability || cItem.getDurability() == item.getDurability()) && cItem.getEnchantments().equals(item.getEnchantments())) + if (item.getTypeId() == cItem.getTypeId() && cItem.getAmount() < maxAmount && (!forceDurability || cItem.getDurability() == item.getDurability()) && cItem.getEnchantments().equals(item.getEnchantments())) { return i; } @@ -130,7 +135,8 @@ public final class InventoryWorkaround while (true) { // Do we already have a stack of it? - final int firstPartial = firstPartial(cinventory, item, forceDurability); + final int maxAmount = oversizedStacks > item.getType().getMaxStackSize() ? oversizedStacks : item.getType().getMaxStackSize(); + final int firstPartial = firstPartial(cinventory, item, forceDurability, maxAmount); // Drat! no partial stack if (firstPartial == -1) @@ -146,33 +152,18 @@ public final class InventoryWorkaround } else { - final int maxAmount = oversizedStacks > 0 ? oversizedStacks : item.getType().getMaxStackSize(); // More than a single stack! if (item.getAmount() > maxAmount) { final ItemStack stack = item.clone(); stack.setAmount(maxAmount); - if (cinventory instanceof FakeInventory) - { - cinventory.setItem(firstFree, stack); - } - else - { - EnchantmentFix.setItem(cinventory, firstFree, stack); - } + cinventory.setItem(firstFree, stack); item.setAmount(item.getAmount() - maxAmount); } else { // Just store it - if (cinventory instanceof FakeInventory) - { - cinventory.setItem(firstFree, item); - } - else - { - EnchantmentFix.setItem(cinventory, firstFree, item); - } + cinventory.setItem(firstFree, item); break; } } @@ -184,8 +175,7 @@ public final class InventoryWorkaround final int amount = item.getAmount(); final int partialAmount = partialItem.getAmount(); - final int maxAmount = oversizedStacks > 0 ? oversizedStacks : partialItem.getType().getMaxStackSize(); - + // Check if it fully fits if (amount + partialAmount <= maxAmount) { @@ -202,7 +192,7 @@ public final class InventoryWorkaround return leftover; } - public static Map<Integer, ItemStack> removeItem(final Inventory cinventory, final boolean forceDurability, final ItemStack... items) + public static Map<Integer, ItemStack> removeItem(final Inventory cinventory, final boolean forceDurability, final boolean forceEnchantments, final ItemStack... items) { final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>(); @@ -227,7 +217,7 @@ public final class InventoryWorkaround } // get first Item, ignore the amount - final int first = first(cinventory, item, forceDurability, false); + final int first = first(cinventory, item, forceDurability, false, forceEnchantments); // Drat! we don't have this type in the inventory if (first == -1) @@ -251,7 +241,7 @@ public final class InventoryWorkaround { // split the stack and store itemStack.setAmount(amount - toDelete); - EnchantmentFix.setItem(cinventory, first, itemStack); + cinventory.setItem(first, itemStack); toDelete = 0; } } @@ -260,7 +250,7 @@ public final class InventoryWorkaround return leftover; } - public static boolean containsItem(final Inventory cinventory, final boolean forceDurability, final ItemStack... items) + public static boolean containsItem(final Inventory cinventory, final boolean forceDurability, final boolean forceEnchantments, final ItemStack... items) { final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>(); @@ -282,7 +272,7 @@ public final class InventoryWorkaround combined[j] = items[i].clone(); break; } - if (combined[j].getTypeId() == items[i].getTypeId() && (!forceDurability || combined[j].getDurability() == items[i].getDurability()) && combined[j].getEnchantments().equals(items[i].getEnchantments())) + if (combined[j].getTypeId() == items[i].getTypeId() && (!forceDurability || combined[j].getDurability() == items[i].getDurability()) && (!forceEnchantments || combined[j].getEnchantments().equals(items[i].getEnchantments()))) { combined[j].setAmount(combined[j].getAmount() + items[i].getAmount()); break; @@ -308,7 +298,7 @@ public final class InventoryWorkaround break; } - final int slot = next(cinventory, item, position, forceDurability, false); + final int slot = next(cinventory, item, position, forceDurability, false, forceEnchantments); // Drat! we don't have this type in the inventory if (slot == -1) diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/OfflineBedLocation.java b/Essentials/src/com/earth2me/essentials/craftbukkit/OfflineBedLocation.java new file mode 100644 index 000000000..3ddfd20b5 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/OfflineBedLocation.java @@ -0,0 +1,52 @@ +package com.earth2me.essentials.craftbukkit; + +import com.earth2me.essentials.IEssentials; +import java.util.logging.Level; +import java.util.logging.Logger; +import net.minecraft.server.NBTTagCompound; +import net.minecraft.server.WorldNBTStorage; +import org.bukkit.Location; +import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.craftbukkit.CraftWorld; + + +public class OfflineBedLocation +{ + public static Location getBedLocation(final String playername, final IEssentials ess) + { + try + { + final CraftServer cserver = (CraftServer)ess.getServer(); + if (cserver == null) + { + return null; + } + final WorldNBTStorage wnbtStorage = (WorldNBTStorage)cserver.getHandle().playerFileData; + if (wnbtStorage == null) + { + return null; + } + final NBTTagCompound playerStorage = wnbtStorage.getPlayerData(playername); + if (playerStorage == null) + { + return null; + } + + if (playerStorage.hasKey("SpawnX") && playerStorage.hasKey("SpawnY") && playerStorage.hasKey("SpawnZ")) + { + String spawnWorld = playerStorage.getString("SpawnWorld"); + if ("".equals(spawnWorld)) + { + spawnWorld = cserver.getWorlds().get(0).getName(); + } + return new Location(cserver.getWorld(spawnWorld), playerStorage.getInt("SpawnX"), playerStorage.getInt("SpawnY"), playerStorage.getInt("SpawnZ")); + } + return null; + } + catch (Throwable ex) + { + Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex); + return null; + } + } +} diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/SetBed.java b/Essentials/src/com/earth2me/essentials/craftbukkit/SetBed.java new file mode 100644 index 000000000..331d14139 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/SetBed.java @@ -0,0 +1,25 @@ +package com.earth2me.essentials.craftbukkit; + +import java.util.logging.Level; +import java.util.logging.Logger; +import net.minecraft.server.ChunkCoordinates; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.entity.CraftPlayer; +import org.bukkit.entity.Player; + + +public class SetBed +{ + public static void setBed(final Player player, final Block block) + { + try + { + final CraftPlayer cplayer = (CraftPlayer)player; + cplayer.getHandle().a(new ChunkCoordinates(block.getX(), block.getY(), block.getZ())); + } + catch (Throwable ex) + { + Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex); + } + } +} diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/ShowInventory.java b/Essentials/src/com/earth2me/essentials/craftbukkit/ShowInventory.java index f77b20208..fb2050ce4 100644 --- a/Essentials/src/com/earth2me/essentials/craftbukkit/ShowInventory.java +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/ShowInventory.java @@ -1,11 +1,10 @@ package com.earth2me.essentials.craftbukkit; -import com.earth2me.essentials.InventoryWorkaround; import java.util.logging.Level; import java.util.logging.Logger; import net.minecraft.server.EntityPlayer; import net.minecraft.server.IInventory; -import net.minecraft.server.InventoryPlayer; +import net.minecraft.server.PlayerInventory; import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer; import org.bukkit.entity.Player; @@ -19,7 +18,7 @@ public class ShowInventory try { final EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle(); - final CraftInventoryPlayer inv = new CraftInventoryPlayer(new InventoryPlayer(((CraftPlayer)player).getHandle())); + final CraftInventoryPlayer inv = new CraftInventoryPlayer(new PlayerInventory(((CraftPlayer)player).getHandle())); inv.clear(); entityPlayer.a((IInventory)inv.getInventory()); } @@ -34,7 +33,7 @@ public class ShowInventory try { final EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle(); - final CraftInventoryPlayer inv = new CraftInventoryPlayer(new InventoryPlayer(((CraftPlayer)player).getHandle())); + final CraftInventoryPlayer inv = new CraftInventoryPlayer(new PlayerInventory(((CraftPlayer)player).getHandle())); inv.clear(); InventoryWorkaround.addItem(inv, true, stack); entityPlayer.a((IInventory)inv.getInventory()); diff --git a/Essentials/src/com/earth2me/essentials/settings/Jails.java b/Essentials/src/com/earth2me/essentials/settings/Jails.java new file mode 100644 index 000000000..4f9b79197 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/settings/Jails.java @@ -0,0 +1,18 @@ +package com.earth2me.essentials.settings; + +import com.earth2me.essentials.storage.MapValueType; +import com.earth2me.essentials.storage.StorageObject; +import java.util.HashMap; +import java.util.Map; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.bukkit.Location; + + +@Data +@EqualsAndHashCode(callSuper = false) +public class Jails implements StorageObject +{ + @MapValueType(Location.class) + private Map<String, Location> jails = new HashMap<String, Location>(); +} diff --git a/Essentials/src/com/earth2me/essentials/settings/Spawns.java b/Essentials/src/com/earth2me/essentials/settings/Spawns.java new file mode 100644 index 000000000..a0afa450c --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/settings/Spawns.java @@ -0,0 +1,18 @@ +package com.earth2me.essentials.settings; + +import com.earth2me.essentials.storage.MapValueType; +import com.earth2me.essentials.storage.StorageObject; +import java.util.HashMap; +import java.util.Map; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.bukkit.Location; + + +@Data +@EqualsAndHashCode(callSuper = false) +public class Spawns implements StorageObject +{ + @MapValueType(Location.class) + private Map<String, Location> spawns = new HashMap<String, Location>(); +} diff --git a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java index aaf040c02..1e62a6097 100644 --- a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java +++ b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java @@ -399,6 +399,11 @@ public class EssentialsSign sign.setLine(index, (quantity - decrement) + " times"); return new Trade(signName.toLowerCase(Locale.ENGLISH) + "sign", ess); } + else if (item.equalsIgnoreCase("exp") || item.equalsIgnoreCase("xp")) + { + sign.setLine(index, quantity + " exp"); + return new Trade(quantity, ess); + } else { final ItemStack stack = getItemStack(item, quantity, ess); diff --git a/Essentials/src/com/earth2me/essentials/signs/SignEnchant.java b/Essentials/src/com/earth2me/essentials/signs/SignEnchant.java new file mode 100644 index 000000000..5907442d9 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/signs/SignEnchant.java @@ -0,0 +1,121 @@ +package com.earth2me.essentials.signs; + +import com.earth2me.essentials.ChargeException; +import com.earth2me.essentials.Enchantments; +import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.User; +import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.Trade; +import com.earth2me.essentials.craftbukkit.InventoryWorkaround; +import java.util.Locale; +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.inventory.ItemStack; + + +public class SignEnchant extends EssentialsSign +{ + public SignEnchant() + { + super("Enchant"); + } + + @Override + protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException + { + final ItemStack stack = sign.getLine(1).equals("*") || sign.getLine(1).equalsIgnoreCase("any") ? null : getItemStack(sign.getLine(1), 1, ess); + final String[] enchantLevel = sign.getLine(2).split(":"); + if (enchantLevel.length != 2) + { + throw new SignException(_("invalidSignLine", 3)); + } + final Enchantment enchantment = Enchantments.getByName(enchantLevel[0]); + if (enchantment == null) + { + throw new SignException(_("enchantmentNotFound")); + } + int level; + try + { + level = Integer.parseInt(enchantLevel[1]); + } + catch (NumberFormatException ex) + { + throw new SignException(ex.getMessage()); + } + if (level < 1 || level > enchantment.getMaxLevel()) + { + level = enchantment.getMaxLevel(); + sign.setLine(2, enchantLevel[0] + ":" + level); + } + try + { + if (stack != null) + { + stack.addEnchantment(enchantment, level); + } + } + catch (Throwable ex) + { + throw new SignException(ex.getMessage()); + } + getTrade(sign, 3, ess); + return true; + } + + @Override + protected boolean onSignInteract(ISign sign, User player, String username, IEssentials ess) throws SignException, ChargeException + { + final ItemStack search = sign.getLine(1).equals("*") || sign.getLine(1).equalsIgnoreCase("any") ? null : getItemStack(sign.getLine(1), 1, ess); + int slot = -1; + final Trade charge = getTrade(sign, 3, ess); + charge.isAffordableFor(player); + final String[] enchantLevel = sign.getLine(2).split(":"); + if (enchantLevel.length != 2) + { + throw new SignException(_("invalidSignLine", 3)); + } + final Enchantment enchantment = Enchantments.getByName(enchantLevel[0]); + if (enchantment == null) + { + throw new SignException(_("enchantmentNotFound")); + } + int level; + try + { + level = Integer.parseInt(enchantLevel[1]); + } + catch (NumberFormatException ex) + { + level = enchantment.getMaxLevel(); + } + + final ItemStack playerHand = player.getItemInHand(); + if (playerHand == null + || playerHand.getAmount() != 1 + || (playerHand.containsEnchantment(enchantment) + && playerHand.getEnchantmentLevel(enchantment) == level)) + { + throw new SignException(_("missingItems", 1, sign.getLine(1))); + } + if (search != null && playerHand.getType() != search.getType()) + { + throw new SignException(_("missingItems", 1, search.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' '))); + } + + final ItemStack toEnchant = playerHand; + try + { + toEnchant.addEnchantment(enchantment, level); + } + catch (Exception ex) + { + throw new SignException(ex.getMessage(), ex); + } + + charge.charge(player); + Trade.log("Sign", "Enchant", "Interact", username, charge, username, charge, sign.getBlock().getLocation(), ess); + player.updateInventory(); + return true; + } +} diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java index 4b6e4395c..9296eb6f4 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java @@ -160,8 +160,13 @@ public class SignTrade extends EssentialsSign if (split.length == 2 && !amountNeeded) { final int amount = getIntegerPositive(split[0]); - final ItemStack item = getItemStack(split[1], amount, ess); - if (amount < 1 || item.getTypeId() == 0) + + if (amount < 1) + { + throw new SignException(_("moreThanZero")); + } + if (!(split[1].equalsIgnoreCase("exp") || split[1].equalsIgnoreCase("xp")) + && getItemStack(split[1], amount, ess).getTypeId() == 0) { throw new SignException(_("moreThanZero")); } @@ -177,10 +182,14 @@ public class SignTrade extends EssentialsSign if (split.length == 3 && amountNeeded) { final int stackamount = getIntegerPositive(split[0]); - final ItemStack item = getItemStack(split[1], stackamount, ess); int amount = getIntegerPositive(split[2]); amount -= amount % stackamount; - if (amount < 1 || stackamount < 1 || item.getTypeId() == 0) + if (amount < 1 || stackamount < 1) + { + throw new SignException(_("moreThanZero")); + } + if (!(split[1].equalsIgnoreCase("exp") || split[1].equalsIgnoreCase("xp")) + && getItemStack(split[1], stackamount, ess).getTypeId() == 0) { throw new SignException(_("moreThanZero")); } @@ -218,16 +227,30 @@ public class SignTrade extends EssentialsSign if (split.length == 3) { - final int stackamount = getIntegerPositive(split[0]); - final ItemStack item = getItemStack(split[1], stackamount, ess); - int amount = getInteger(split[2]); - amount -= amount % stackamount; - if (notEmpty && (amount < 1 || stackamount < 1 || item.getTypeId() == 0)) + if (split[1].equalsIgnoreCase("exp") || split[1].equalsIgnoreCase("xp")) { - throw new SignException(_("tradeSignEmpty")); + final int stackamount = getIntegerPositive(split[0]); + int amount = getInteger(split[2]); + amount -= amount % stackamount; + if (notEmpty && (amount < 1 || stackamount < 1)) + { + throw new SignException(_("tradeSignEmpty")); + } + return new Trade(fullAmount ? amount : stackamount, ess); + } + else + { + final int stackamount = getIntegerPositive(split[0]); + final ItemStack item = getItemStack(split[1], stackamount, ess); + int amount = getInteger(split[2]); + amount -= amount % stackamount; + if (notEmpty && (amount < 1 || stackamount < 1 || item.getTypeId() == 0)) + { + throw new SignException(_("tradeSignEmpty")); + } + item.setAmount(fullAmount ? amount : stackamount); + return new Trade(item, ess); } - item.setAmount(fullAmount ? amount : stackamount); - return new Trade(item, ess); } throw new SignException(_("invalidSignLine", index + 1)); } @@ -287,17 +310,32 @@ public class SignTrade extends EssentialsSign if (split.length == 3) { - final int stackamount = getIntegerPositive(split[0]); - //TODO: Unused local variable - final ItemStack item = getItemStack(split[1], stackamount, ess); - final int amount = getInteger(split[2]); - final String newline = stackamount + " " + split[1] + ":" + (amount + Math.round(value)); - if (newline.length() > 15) + if (split[1].equalsIgnoreCase("exp") || split[1].equalsIgnoreCase("xp")) { - throw new SignException("Line too long!"); + final int stackamount = getIntegerPositive(split[0]); + final int amount = getInteger(split[2]); + final String newline = stackamount + " " + split[1] + ":" + (amount + Math.round(value)); + if (newline.length() > 15) + { + throw new SignException("Line too long!"); + } + sign.setLine(index, newline); + return; + } + else + { + final int stackamount = getIntegerPositive(split[0]); + //TODO: Unused local variable + final ItemStack item = getItemStack(split[1], stackamount, ess); + final int amount = getInteger(split[2]); + final String newline = stackamount + " " + split[1] + ":" + (amount + Math.round(value)); + if (newline.length() > 15) + { + throw new SignException("Line too long!"); + } + sign.setLine(index, newline); + return; } - sign.setLine(index, newline); - return; } throw new SignException(_("invalidSignLine", index + 1)); } diff --git a/Essentials/src/com/earth2me/essentials/signs/SignWarp.java b/Essentials/src/com/earth2me/essentials/signs/SignWarp.java index bd56be46e..76e8e730b 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignWarp.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignWarp.java @@ -4,6 +4,7 @@ import com.earth2me.essentials.ChargeException; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class SignWarp extends EssentialsSign @@ -56,7 +57,7 @@ public class SignWarp extends EssentialsSign final Trade charge = getTrade(sign, 3, ess); try { - player.getTeleport().warp(warpName, charge); + player.getTeleport().warp(warpName, charge, TeleportCause.PLUGIN); } catch (Exception ex) { diff --git a/Essentials/src/com/earth2me/essentials/signs/Signs.java b/Essentials/src/com/earth2me/essentials/signs/Signs.java index d7c0d2086..83a0ee828 100644 --- a/Essentials/src/com/earth2me/essentials/signs/Signs.java +++ b/Essentials/src/com/earth2me/essentials/signs/Signs.java @@ -6,6 +6,7 @@ public enum Signs BALANCE(new SignBalance()), BUY(new SignBuy()), DISPOSAL(new SignDisposal()), + ENCHANT(new SignEnchant()), FREE(new SignFree()), GAMEMODE(new SignGameMode()), HEAL(new SignHeal()), diff --git a/Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileReader.java b/Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileReader.java new file mode 100644 index 000000000..43bfc358d --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileReader.java @@ -0,0 +1,71 @@ +package com.earth2me.essentials.storage; + +import com.earth2me.essentials.IEssentials; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.bukkit.Bukkit; +import org.bukkit.plugin.Plugin; +import org.yaml.snakeyaml.error.YAMLException; + + +public abstract class AbstractDelayedYamlFileReader<T extends StorageObject> implements Runnable +{ + private final transient File file; + private final transient Class<T> clazz; + private final transient Plugin plugin; + + public AbstractDelayedYamlFileReader(final IEssentials ess, final File file, final Class<T> clazz) + { + this.file = file; + this.clazz = clazz; + this.plugin = ess; + ess.scheduleAsyncDelayedTask(this); + } + + public abstract void onStart(); + + @Override + public void run() + { + onStart(); + try + { + final FileReader reader = new FileReader(file); + try + { + final T object = new YamlStorageReader(reader, plugin).load(clazz); + onSuccess(object); + } + finally + { + try + { + reader.close(); + } + catch (IOException ex) + { + Bukkit.getLogger().log(Level.SEVERE, "File can't be closed: " + file.toString(), ex); + } + } + + } + catch (FileNotFoundException ex) + { + onException(); + Bukkit.getLogger().log(Level.WARNING, "File not found: " + file.toString()); + } + catch (ObjectLoadException ex) + { + onException(); + Bukkit.getLogger().log(Level.SEVERE, "File broken: " + file.toString(), ex.getCause()); + } + } + + public abstract void onSuccess(T object); + + public abstract void onException(); +} diff --git a/Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileWriter.java b/Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileWriter.java new file mode 100644 index 000000000..697ef7730 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileWriter.java @@ -0,0 +1,55 @@ +package com.earth2me.essentials.storage; + +import com.earth2me.essentials.IEssentials; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.PrintWriter; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.bukkit.Bukkit; + + +public abstract class AbstractDelayedYamlFileWriter implements Runnable +{ + private final transient File file; + + public AbstractDelayedYamlFileWriter(IEssentials ess, File file) + { + this.file = file; + ess.scheduleAsyncDelayedTask(this); + } + + public abstract StorageObject getObject(); + + @Override + public void run() + { + PrintWriter pw = null; + try + { + final StorageObject object = getObject(); + final File folder = file.getParentFile(); + if (!folder.exists()) + { + folder.mkdirs(); + } + pw = new PrintWriter(file); + new YamlStorageWriter(pw).save(object); + } + catch (FileNotFoundException ex) + { + Bukkit.getLogger().log(Level.SEVERE, file.toString(), ex); + } + finally + { + onFinish(); + if (pw != null) + { + pw.close(); + } + } + + } + + public abstract void onFinish(); +} diff --git a/Essentials/src/com/earth2me/essentials/storage/AsyncStorageObjectHolder.java b/Essentials/src/com/earth2me/essentials/storage/AsyncStorageObjectHolder.java new file mode 100644 index 000000000..31c61a63f --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/storage/AsyncStorageObjectHolder.java @@ -0,0 +1,148 @@ +package com.earth2me.essentials.storage; + +import com.earth2me.essentials.IConf; +import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.api.IReload; +import java.io.File; +import java.util.concurrent.locks.ReentrantReadWriteLock; +import java.util.logging.Level; +import org.bukkit.Bukkit; + + +public abstract class AsyncStorageObjectHolder<T extends StorageObject> implements IConf, IStorageObjectHolder<T>, IReload +{ + private transient T data; + private final transient ReentrantReadWriteLock rwl = new ReentrantReadWriteLock(); + private final transient Class<T> clazz; + protected final transient IEssentials ess; + + public AsyncStorageObjectHolder(final IEssentials ess, final Class<T> clazz) + { + this.ess = ess; + this.clazz = clazz; + try + { + this.data = clazz.newInstance(); + } + catch (Exception ex) + { + Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex); + } + } + + public T getData() + { + return data; + } + + public void acquireReadLock() + { + rwl.readLock().lock(); + } + + public void acquireWriteLock() + { + while (rwl.getReadHoldCount() > 0) + { + rwl.readLock().unlock(); + } + rwl.writeLock().lock(); + rwl.readLock().lock(); + } + + public void close() + { + unlock(); + } + + public void unlock() + { + if (rwl.isWriteLockedByCurrentThread()) + { + rwl.writeLock().unlock(); + new StorageObjectDataWriter(); + } + while (rwl.getReadHoldCount() > 0) + { + rwl.readLock().unlock(); + } + } + + @Override + public void reloadConfig() + { + new StorageObjectDataReader(); + } + + @Override + public void onReload() + { + new StorageObjectDataReader(); + } + + public abstract File getStorageFile(); + + + private class StorageObjectDataWriter extends AbstractDelayedYamlFileWriter + { + public StorageObjectDataWriter() + { + super(ess, getStorageFile()); + } + + @Override + public StorageObject getObject() + { + acquireReadLock(); + return getData(); + } + + @Override + public void onFinish() + { + unlock(); + } + } + + + private class StorageObjectDataReader extends AbstractDelayedYamlFileReader<T> + { + public StorageObjectDataReader() + { + super(ess, getStorageFile(), clazz); + } + + @Override + public void onStart() + { + rwl.writeLock().lock(); + } + + @Override + public void onSuccess(final T object) + { + if (object != null) + { + data = object; + } + rwl.writeLock().unlock(); + } + + @Override + public void onException() + { + if (data == null) + { + try + { + data = clazz.newInstance(); + } + catch (Exception ex) + { + Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex); + } + } + rwl.writeLock().unlock(); + } + } +} diff --git a/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java b/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java index 7ed12b6d5..5070be552 100644 --- a/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java +++ b/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java @@ -1,6 +1,12 @@ package com.earth2me.essentials.storage; +import java.beans.IntrospectionException; +import java.lang.reflect.Field; +import java.util.List; import java.util.Locale; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; import java.util.regex.Pattern; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -9,21 +15,24 @@ import org.bukkit.World; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; import org.bukkit.material.MaterialData; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.java.JavaPluginLoader; +import org.yaml.snakeyaml.TypeDescription; import org.yaml.snakeyaml.constructor.Constructor; -import org.yaml.snakeyaml.nodes.MappingNode; -import org.yaml.snakeyaml.nodes.Node; -import org.yaml.snakeyaml.nodes.NodeId; -import org.yaml.snakeyaml.nodes.NodeTuple; -import org.yaml.snakeyaml.nodes.ScalarNode; +import org.yaml.snakeyaml.error.YAMLException; +import org.yaml.snakeyaml.introspector.Property; +import org.yaml.snakeyaml.nodes.*; public class BukkitConstructor extends Constructor { private final transient Pattern NUMPATTERN = Pattern.compile("\\d+"); + private final transient Plugin plugin; - public BukkitConstructor(Class clazz) + public BukkitConstructor(final Class clazz, final Plugin plugin) { super(clazz); + this.plugin = plugin; yamlClassConstructors.put(NodeId.scalar, new ConstructBukkitScalar()); yamlClassConstructors.put(NodeId.mapping, new ConstructBukkitMapping()); } @@ -269,5 +278,156 @@ public class BukkitConstructor extends Constructor } return super.construct(node); } + + protected Object constructJavaBean2ndStep(final MappingNode node, final Object object) + { + Map<Class<? extends Object>, TypeDescription> typeDefinitions; + try + { + final Field typeDefField = Constructor.class.getDeclaredField("typeDefinitions"); + typeDefField.setAccessible(true); + typeDefinitions = (Map<Class<? extends Object>, TypeDescription>)typeDefField.get((Constructor)BukkitConstructor.this); + if (typeDefinitions == null) { + throw new NullPointerException(); + } + } + catch (Exception ex) + { + throw new YAMLException(ex); + } + flattenMapping(node); + final Class<? extends Object> beanType = node.getType(); + final List<NodeTuple> nodeValue = node.getValue(); + for (NodeTuple tuple : nodeValue) + { + ScalarNode keyNode; + if (tuple.getKeyNode() instanceof ScalarNode) + { + // key must be scalar + keyNode = (ScalarNode)tuple.getKeyNode(); + } + else + { + throw new YAMLException("Keys must be scalars but found: " + tuple.getKeyNode()); + } + final Node valueNode = tuple.getValueNode(); + // keys can only be Strings + keyNode.setType(String.class); + final String key = (String)constructObject(keyNode); + try + { + Property property; + try + { + property = getProperty(beanType, key); + } + catch (YAMLException e) + { + continue; + } + valueNode.setType(property.getType()); + final TypeDescription memberDescription = typeDefinitions.get(beanType); + boolean typeDetected = false; + if (memberDescription != null) + { + switch (valueNode.getNodeId()) + { + case sequence: + final SequenceNode snode = (SequenceNode)valueNode; + final Class<? extends Object> memberType = memberDescription.getListPropertyType(key); + if (memberType != null) + { + snode.setListType(memberType); + typeDetected = true; + } + else if (property.getType().isArray()) + { + snode.setListType(property.getType().getComponentType()); + typeDetected = true; + } + break; + case mapping: + final MappingNode mnode = (MappingNode)valueNode; + final Class<? extends Object> keyType = memberDescription.getMapKeyType(key); + if (keyType != null) + { + mnode.setTypes(keyType, memberDescription.getMapValueType(key)); + typeDetected = true; + } + break; + } + } + if (!typeDetected && valueNode.getNodeId() != NodeId.scalar) + { + // only if there is no explicit TypeDescription + final Class<?>[] arguments = property.getActualTypeArguments(); + if (arguments != null) + { + // type safe (generic) collection may contain the + // proper class + if (valueNode.getNodeId() == NodeId.sequence) + { + final Class<?> t = arguments[0]; + final SequenceNode snode = (SequenceNode)valueNode; + snode.setListType(t); + } + else if (valueNode.getTag().equals(Tag.SET)) + { + final Class<?> t = arguments[0]; + final MappingNode mnode = (MappingNode)valueNode; + mnode.setOnlyKeyType(t); + mnode.setUseClassConstructor(true); + } + else if (property.getType().isAssignableFrom(Map.class)) + { + final Class<?> ketType = arguments[0]; + final Class<?> valueType = arguments[1]; + final MappingNode mnode = (MappingNode)valueNode; + mnode.setTypes(ketType, valueType); + mnode.setUseClassConstructor(true); + } + else + { + // the type for collection entries cannot be + // detected + } + } + } + final Object value = constructObject(valueNode); + property.set(object, value); + } + catch (Exception e) + { + throw new YAMLException("Cannot create property=" + key + " for JavaBean=" + + object + "; " + e.getMessage(), e); + } + } + return object; + } + } + + @Override + protected Class<?> getClassForNode(final Node node) + { + Class<?> clazz; + final String name = node.getTag().getClassName(); + if (plugin == null) + { + clazz = super.getClassForNode(node); + } + else + { + final JavaPluginLoader jpl = (JavaPluginLoader)plugin.getPluginLoader(); + clazz = jpl.getClassByName(name); + } + + if (clazz == null) + { + throw new YAMLException("Class not found: " + name); + } + else + { + return clazz; + } } } diff --git a/Essentials/src/com/earth2me/essentials/storage/IStorageObjectHolder.java b/Essentials/src/com/earth2me/essentials/storage/IStorageObjectHolder.java new file mode 100644 index 000000000..f48e54002 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/storage/IStorageObjectHolder.java @@ -0,0 +1,17 @@ +package com.earth2me.essentials.storage; + +import com.earth2me.essentials.user.UserData; + + +public interface IStorageObjectHolder<T extends StorageObject> +{ + T getData(); + + void acquireReadLock(); + + void acquireWriteLock(); + + void close(); + + void unlock(); +} diff --git a/Essentials/src/com/earth2me/essentials/storage/IStorageReader.java b/Essentials/src/com/earth2me/essentials/storage/IStorageReader.java index 5e259a322..d59adafe0 100644 --- a/Essentials/src/com/earth2me/essentials/storage/IStorageReader.java +++ b/Essentials/src/com/earth2me/essentials/storage/IStorageReader.java @@ -3,5 +3,5 @@ package com.earth2me.essentials.storage; public interface IStorageReader { - <T extends StorageObject> T load(final Class<? extends T> clazz); + <T extends StorageObject> T load(final Class<? extends T> clazz) throws ObjectLoadException; } diff --git a/Essentials/src/com/earth2me/essentials/storage/ObjectLoadException.java b/Essentials/src/com/earth2me/essentials/storage/ObjectLoadException.java new file mode 100644 index 000000000..8b804abc3 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/storage/ObjectLoadException.java @@ -0,0 +1,10 @@ +package com.earth2me.essentials.storage; + + +public class ObjectLoadException extends Exception +{ + public ObjectLoadException(Throwable thrwbl) + { + super(thrwbl); + } +} diff --git a/Essentials/src/com/earth2me/essentials/storage/YamlStorageReader.java b/Essentials/src/com/earth2me/essentials/storage/YamlStorageReader.java index 2881c1f18..5d1ff668a 100644 --- a/Essentials/src/com/earth2me/essentials/storage/YamlStorageReader.java +++ b/Essentials/src/com/earth2me/essentials/storage/YamlStorageReader.java @@ -4,8 +4,7 @@ import java.io.Reader; import java.lang.reflect.Field; import java.util.*; import java.util.concurrent.locks.ReentrantLock; -import java.util.logging.Level; -import java.util.logging.Logger; +import org.bukkit.plugin.Plugin; import org.yaml.snakeyaml.TypeDescription; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.Constructor; @@ -13,70 +12,64 @@ import org.yaml.snakeyaml.constructor.Constructor; public class YamlStorageReader implements IStorageReader { - private transient static Map<Class, Yaml> preparedYamls = Collections.synchronizedMap(new HashMap<Class, Yaml>()); - private transient static Map<Class, ReentrantLock> locks = new HashMap<Class, ReentrantLock>(); + private transient static final Map<Class, Yaml> PREPARED_YAMLS = Collections.synchronizedMap(new HashMap<Class, Yaml>()); + private transient static final Map<Class, ReentrantLock> LOCKS = new HashMap<Class, ReentrantLock>(); private transient final Reader reader; + private transient final Plugin plugin; - public YamlStorageReader(final Reader reader) + public YamlStorageReader(final Reader reader, final Plugin plugin) { this.reader = reader; + this.plugin = plugin; } - public <T extends StorageObject> T load(final Class<? extends T> clazz) + @Override + public <T extends StorageObject> T load(final Class<? extends T> clazz) throws ObjectLoadException { - Yaml yaml = preparedYamls.get(clazz); + Yaml yaml = PREPARED_YAMLS.get(clazz); if (yaml == null) { yaml = new Yaml(prepareConstructor(clazz)); - preparedYamls.put(clazz, yaml); + PREPARED_YAMLS.put(clazz, yaml); } ReentrantLock lock; - synchronized (locks) + synchronized (LOCKS) { - lock = locks.get(clazz); + lock = LOCKS.get(clazz); if (lock == null) { lock = new ReentrantLock(); } } - T ret; lock.lock(); try { - ret = (T)yaml.load(reader); + T object = (T)yaml.load(reader); + if (object == null) { + object = clazz.newInstance(); + } + return object; } - finally + catch (Exception ex) { - lock.unlock(); + throw new ObjectLoadException(ex); } - if (ret == null) + finally { - try - { - ret = (T)clazz.newInstance(); - } - catch (InstantiationException ex) - { - Logger.getLogger(StorageObject.class.getName()).log(Level.SEVERE, null, ex); - } - catch (IllegalAccessException ex) - { - Logger.getLogger(StorageObject.class.getName()).log(Level.SEVERE, null, ex); - } + lock.unlock(); } - return ret; } - private static Constructor prepareConstructor(final Class<?> clazz) + private Constructor prepareConstructor(final Class<?> clazz) { - final Constructor constructor = new BukkitConstructor(clazz); + final Constructor constructor = new BukkitConstructor(clazz, plugin); final Set<Class> classes = new HashSet<Class>(); prepareConstructor(constructor, classes, clazz); return constructor; } - private static void prepareConstructor(final Constructor constructor, final Set<Class> classes, final Class clazz) + private void prepareConstructor(final Constructor constructor, final Set<Class> classes, final Class clazz) { classes.add(clazz); final TypeDescription description = new TypeDescription(clazz); @@ -93,7 +86,7 @@ public class YamlStorageReader implements IStorageReader constructor.addTypeDescription(description); } - private static void prepareList(final Field field, final TypeDescription description, final Set<Class> classes, final Constructor constructor) + private void prepareList(final Field field, final TypeDescription description, final Set<Class> classes, final Constructor constructor) { final ListType listType = field.getAnnotation(ListType.class); if (listType != null) @@ -107,7 +100,7 @@ public class YamlStorageReader implements IStorageReader } } - private static void prepareMap(final Field field, final TypeDescription description, final Set<Class> classes, final Constructor constructor) + private void prepareMap(final Field field, final TypeDescription description, final Set<Class> classes, final Constructor constructor) { final MapValueType mapType = field.getAnnotation(MapValueType.class); if (mapType != null) diff --git a/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java b/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java index 48540483d..fd1f0f863 100644 --- a/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java +++ b/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java @@ -30,6 +30,7 @@ public class YamlStorageWriter implements IStorageWriter this.writer = writer; } + @Override public void save(final StorageObject object) { try diff --git a/Essentials/src/com/earth2me/essentials/textreader/ArrayListInput.java b/Essentials/src/com/earth2me/essentials/textreader/ArrayListInput.java new file mode 100644 index 000000000..0da83f3b4 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/textreader/ArrayListInput.java @@ -0,0 +1,31 @@ +package com.earth2me.essentials.textreader; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + + +public class ArrayListInput implements IText +{ + private final transient List<String> lines = new ArrayList<String>(); + + @Override + public List<String> getLines() + { + return lines; + } + + @Override + public List<String> getChapters() + { + return Collections.emptyList(); + } + + @Override + public Map<String, Integer> getBookmarks() + { + return Collections.emptyMap(); + } + +} diff --git a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java index 29e44a682..182dba9d3 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java +++ b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java @@ -1,12 +1,16 @@ package com.earth2me.essentials.textreader; +import com.earth2me.essentials.DescParseTickFormat; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; +import java.text.DateFormat; +import java.util.Date; import java.util.List; import java.util.Map; import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; public class KeywordReplacer implements IText @@ -24,7 +28,9 @@ public class KeywordReplacer implements IText private void replaceKeywords(final CommandSender sender) { String displayName, ipAddress, balance, mails, world; - String worlds, online, unique, playerlist; + String worlds, online, unique, playerlist, date, time; + String worldTime12, worldTime24, worldDate, plugins; + String version; if (sender instanceof Player) { final User user = ess.getUser(sender); @@ -33,10 +39,13 @@ public class KeywordReplacer implements IText balance = Double.toString(user.getMoney()); mails = Integer.toString(user.getMails().size()); world = user.getLocation().getWorld().getName(); + worldTime12 = DescParseTickFormat.format12(user.getWorld().getTime()); + worldTime24 = DescParseTickFormat.format24(user.getWorld().getTime()); + worldDate = DateFormat.getDateInstance(DateFormat.MEDIUM, ess.getI18n().getCurrentLocale()).format(DescParseTickFormat.ticksToDate(user.getWorld().getTime())); } else { - displayName = ipAddress = balance = mails = world = ""; + displayName = ipAddress = balance = mails = world = worldTime12 = worldTime24 = worldDate = ""; } int playerHidden = 0; @@ -76,6 +85,22 @@ public class KeywordReplacer implements IText } playerlist = playerlistBuilder.toString(); + final StringBuilder pluginlistBuilder = new StringBuilder(); + for (Plugin p : ess.getServer().getPluginManager().getPlugins()) + { + if (pluginlistBuilder.length() > 0) + { + pluginlistBuilder.append(", "); + } + pluginlistBuilder.append(p.getDescription().getName()); + } + plugins = pluginlistBuilder.toString(); + + date = DateFormat.getDateInstance(DateFormat.MEDIUM, ess.getI18n().getCurrentLocale()).format(new Date()); + time = DateFormat.getTimeInstance(DateFormat.MEDIUM, ess.getI18n().getCurrentLocale()).format(new Date()); + + version = ess.getServer().getVersion(); + for (int i = 0; i < input.getLines().size(); i++) { String line = input.getLines().get(i); @@ -88,6 +113,13 @@ public class KeywordReplacer implements IText line = line.replace("{UNIQUE}", unique); line = line.replace("{WORLDS}", worlds); line = line.replace("{PLAYERLIST}", playerlist); + line = line.replace("{TIME}", time); + line = line.replace("{DATE}", date); + line = line.replace("{WORLDTIME12}", worldTime12); + line = line.replace("{WORLDTIME24}", worldTime24); + line = line.replace("{WORLDDATE}", worldDate); + line = line.replace("{PLUGINS}", plugins); + line = line.replace("{VERSION}", version); input.getLines().set(i, line); } } diff --git a/Essentials/src/com/earth2me/essentials/userdata/Ban.java b/Essentials/src/com/earth2me/essentials/user/Ban.java index 6e86780cf..ba1c22333 100644 --- a/Essentials/src/com/earth2me/essentials/userdata/Ban.java +++ b/Essentials/src/com/earth2me/essentials/user/Ban.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.userdata; +package com.earth2me.essentials.user; import com.earth2me.essentials.storage.StorageObject; import lombok.Data; diff --git a/Essentials/src/com/earth2me/essentials/user/IOfflinePlayer.java b/Essentials/src/com/earth2me/essentials/user/IOfflinePlayer.java new file mode 100644 index 000000000..4cdee715b --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/user/IOfflinePlayer.java @@ -0,0 +1,15 @@ +package com.earth2me.essentials.user; + +import org.bukkit.Location; + + +public interface IOfflinePlayer +{ + String getName(); + + String getDisplayName(); + + Location getBedSpawnLocation(); + + void setBanned(boolean bln); +}
\ No newline at end of file diff --git a/Essentials/src/com/earth2me/essentials/user/IOfflineUser.java b/Essentials/src/com/earth2me/essentials/user/IOfflineUser.java new file mode 100644 index 000000000..d6266df49 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/user/IOfflineUser.java @@ -0,0 +1,9 @@ +package com.earth2me.essentials.user; + +import com.earth2me.essentials.storage.IStorageObjectHolder; + + +public interface IOfflineUser extends IStorageObjectHolder<UserData>, IOfflinePlayer +{ + +} diff --git a/Essentials/src/com/earth2me/essentials/userdata/Inventory.java b/Essentials/src/com/earth2me/essentials/user/Inventory.java index 91a19e2d1..0812f54a0 100644 --- a/Essentials/src/com/earth2me/essentials/userdata/Inventory.java +++ b/Essentials/src/com/earth2me/essentials/user/Inventory.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.userdata; +package com.earth2me.essentials.user; import com.earth2me.essentials.storage.MapKeyType; import com.earth2me.essentials.storage.MapValueType; diff --git a/Essentials/src/com/earth2me/essentials/user/User.java b/Essentials/src/com/earth2me/essentials/user/User.java new file mode 100644 index 000000000..0e544ae06 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/user/User.java @@ -0,0 +1,199 @@ +package com.earth2me.essentials.user; + +import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.IUser; +import com.earth2me.essentials.Teleport; +import com.earth2me.essentials.commands.IEssentialsCommand; +import lombok.Cleanup; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.entity.Player; + + +public class User extends UserBase implements IUser +{ + public User(final Player base, final IEssentials ess) + { + super(base, ess); + } + + public User(final OfflinePlayer offlinePlayer, final IEssentials ess) + { + super(offlinePlayer, ess); + } + + public void example() + { + // Cleanup will call close at the end of the function + @Cleanup + final User user = this; + + // read lock allows to read data from the user + user.acquireReadLock(); + final double money = user.getData().getMoney(); + + // write lock allows only one thread to modify the data + user.acquireWriteLock(); + user.getData().setMoney(10 + money); + } + + @Override + public long getLastTeleportTimestamp() + { + acquireReadLock(); + try + { + return getData().getTimestamps().get("lastteleport"); + } + finally + { + unlock(); + } + } + + @Override + public boolean isAuthorized(String node) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isAuthorized(IEssentialsCommand cmd) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isAuthorized(IEssentialsCommand cmd, String permissionPrefix) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setLastTeleportTimestamp(long time) + { + acquireWriteLock(); + try + { + getData().getTimestamps().put("lastteleport", time); + } + finally + { + unlock(); + } + } + + @Override + public Location getLastLocation() + { + acquireReadLock(); + try + { + return getData().getLastLocation(); + } + finally + { + unlock(); + } + } + + @Override + public double getMoney() + { + acquireReadLock(); + try + { + return getData().getMoney(); + } + finally + { + unlock(); + } + } + + @Override + public void takeMoney(double value) + { + acquireWriteLock(); + try + { + getData().setMoney(getData().getMoney() - value); + } + finally + { + unlock(); + } + } + + @Override + public void giveMoney(double value) + { + acquireWriteLock(); + try + { + getData().setMoney(getData().getMoney() + value); + } + finally + { + unlock(); + } + } + + @Override + public String getGroup() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setLastLocation() + { + acquireWriteLock(); + try + { + getData().setLastLocation(base.getLocation()); + } + finally + { + unlock(); + } + } + + @Override + public Location getHome(String name) throws Exception + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Location getHome(Location loc) throws Exception + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isHidden() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Teleport getTeleport() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setJail(final String jail) + { + acquireWriteLock(); + try + { + getData().setJail(jail); + } + finally + { + unlock(); + } + } +} diff --git a/Essentials/src/com/earth2me/essentials/user/UserBase.java b/Essentials/src/com/earth2me/essentials/user/UserBase.java new file mode 100644 index 000000000..9dda2f950 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/user/UserBase.java @@ -0,0 +1,122 @@ +package com.earth2me.essentials.user; + +import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.craftbukkit.OfflineBedLocation; +import com.earth2me.essentials.storage.AsyncStorageObjectHolder; +import java.io.File; +import lombok.Delegate; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.command.CommandSender; +import org.bukkit.configuration.serialization.ConfigurationSerializable; +import org.bukkit.entity.Entity; +import org.bukkit.entity.HumanEntity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.permissions.Permissible; +import org.bukkit.permissions.ServerOperator; +import org.bukkit.OfflinePlayer; + + +public abstract class UserBase extends AsyncStorageObjectHolder<UserData> implements Player, IOfflineUser +{ + + @Delegate(types = + { + Player.class, Entity.class, CommandSender.class, ServerOperator.class, + HumanEntity.class, ConfigurationSerializable.class, LivingEntity.class, + Permissible.class + },excludes=IOfflinePlayer.class) + protected Player base; + protected transient OfflinePlayer offlinePlayer; + + public UserBase(final Player base, final IEssentials ess) + { + super(ess, UserData.class); + this.base = base; + reloadConfig(); + } + + public UserBase(final OfflinePlayer offlinePlayer, final IEssentials ess) + { + super(ess, UserData.class); + this.offlinePlayer = offlinePlayer; + reloadConfig(); + } + + public final Player getBase() + { + return base; + } + + public final Player setBase(final Player base) + { + return this.base = base; + } + + public void update(final Player base) + { + setBase(base); + } + + public void update(final OfflinePlayer offlinePlayer) + { + this.offlinePlayer = offlinePlayer; + } + + public void dispose() + { + this.offlinePlayer = Bukkit.getOfflinePlayer(base.getName()); + this.base = null; + } + + public boolean isOnlineUser() { + return base != null; + } + + @Override + public String getName() + { + if (isOnlineUser()) { + return base.getName(); + } else { + return offlinePlayer.getName(); + } + } + + @Override + public String getDisplayName() + { + if (isOnlineUser()) { + return base.getDisplayName(); + } else { + return offlinePlayer.getName(); + } + } + + @Override + public Location getBedSpawnLocation() + { + if (isOnlineUser()) { + return base.getBedSpawnLocation(); + } else { + return OfflineBedLocation.getBedLocation(base.getName(), ess); + } + } + + @Override + public void setBanned(boolean bln) + { + if (isOnlineUser()) { + base.setBanned(bln); + } else { + offlinePlayer.setBanned(bln); + } + } + + @Override + public File getStorageFile() + { + return ess.getUserMap().getUserFile(getName()); + } +} diff --git a/Essentials/src/com/earth2me/essentials/userdata/UserData.java b/Essentials/src/com/earth2me/essentials/user/UserData.java index bce62f5fa..4586d0627 100644 --- a/Essentials/src/com/earth2me/essentials/userdata/UserData.java +++ b/Essentials/src/com/earth2me/essentials/user/UserData.java @@ -1,15 +1,10 @@ -package com.earth2me.essentials.userdata; +package com.earth2me.essentials.user; import com.earth2me.essentials.storage.ListType; import com.earth2me.essentials.storage.MapKeyType; import com.earth2me.essentials.storage.MapValueType; import com.earth2me.essentials.storage.StorageObject; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import lombok.Data; import lombok.EqualsAndHashCode; import org.bukkit.Location; diff --git a/Essentials/src/com/earth2me/essentials/user/UserMap.java b/Essentials/src/com/earth2me/essentials/user/UserMap.java new file mode 100644 index 000000000..821ee4c8f --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/user/UserMap.java @@ -0,0 +1,128 @@ +package com.earth2me.essentials.user; + +import com.earth2me.essentials.IConf; +import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.Util; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.util.concurrent.UncheckedExecutionException; +import java.io.File; +import java.util.Collections; +import java.util.Locale; +import java.util.Set; +import java.util.concurrent.ConcurrentSkipListSet; +import java.util.concurrent.ExecutionException; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + + +public class UserMap extends CacheLoader<String, User> implements IConf +{ + private final transient IEssentials ess; + private final transient Cache<String, User> users = CacheBuilder.newBuilder().softValues().build(this); + private final transient ConcurrentSkipListSet<String> keys = new ConcurrentSkipListSet<String>(); + + public UserMap(final IEssentials ess) + { + super(); + this.ess = ess; + loadAllUsersAsync(ess); + } + + private void loadAllUsersAsync(final IEssentials ess) + { + ess.scheduleAsyncDelayedTask(new Runnable() + { + @Override + public void run() + { + final File userdir = new File(ess.getDataFolder(), "userdata"); + if (!userdir.exists()) + { + return; + } + keys.clear(); + users.invalidateAll(); + for (String string : userdir.list()) + { + if (!string.endsWith(".yml")) + { + continue; + } + final String name = string.substring(0, string.length() - 4); + keys.add(name.toLowerCase(Locale.ENGLISH)); + } + } + }); + } + + public boolean userExists(final String name) + { + return keys.contains(name.toLowerCase(Locale.ENGLISH)); + } + + public User getUser(final String name) + { + try + { + return users.get(name.toLowerCase(Locale.ENGLISH)); + } + catch (ExecutionException ex) + { + return null; + } + catch (UncheckedExecutionException ex) + { + return null; + } + } + + @Override + public User load(final String name) throws Exception + { + for (Player player : ess.getServer().getOnlinePlayers()) + { + if (player.getName().equalsIgnoreCase(name)) + { + keys.add(name.toLowerCase(Locale.ENGLISH)); + return new User(player, ess); + } + } + final File userFile = getUserFile(name); + if (userFile.exists()) + { + keys.add(name.toLowerCase(Locale.ENGLISH)); + return new User(Bukkit.getOfflinePlayer(name), ess); + } + throw new Exception("User not found!"); + } + + @Override + public void reloadConfig() + { + loadAllUsersAsync(ess); + } + + public void removeUser(final String name) + { + keys.remove(name.toLowerCase(Locale.ENGLISH)); + users.invalidate(name.toLowerCase(Locale.ENGLISH)); + } + + public Set<String> getAllUniqueUsers() + { + return Collections.unmodifiableSet(keys); + } + + public int getUniqueUsers() + { + return keys.size(); + } + + public File getUserFile(final String name) + { + final File userFolder = new File(ess.getDataFolder(), "userdata"); + return new File(userFolder, Util.sanitizeFileName(name) + ".yml"); + } +} diff --git a/Essentials/src/com/earth2me/essentials/userdata/User.java b/Essentials/src/com/earth2me/essentials/userdata/User.java deleted file mode 100644 index 232e0b95e..000000000 --- a/Essentials/src/com/earth2me/essentials/userdata/User.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.earth2me.essentials.userdata; - -import com.earth2me.essentials.storage.YamlStorageReader; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import lombok.Cleanup; - -// this is a prototype for locking userdata -public class User -{ - UserData data = new UserData(); - ReentrantReadWriteLock rwl = new ReentrantReadWriteLock(); - - public void loadUserData() - { - data = new YamlStorageReader(null).load(UserData.class); - } - - public void aquireReadLock() - { - rwl.readLock().lock(); - } - - public void aquireWriteLock() - { - while (rwl.getReadHoldCount() > 0) - { - rwl.readLock().unlock(); - } - rwl.writeLock().lock(); - rwl.readLock().lock(); - } - - public void close() - { - if (rwl.isWriteLockedByCurrentThread()) - { - scheduleSaving(); - rwl.writeLock().unlock(); - } - while (rwl.getReadHoldCount() > 0) - { - rwl.readLock().unlock(); - } - } - - public void example() - { - // Cleanup will call close at the end of the function - @Cleanup - final User user = this; - - // read lock allows to read data from the user - user.aquireReadLock(); - double i = user.data.getMoney(); - - // write lock allows only one thread to modify the data - user.aquireWriteLock(); - user.data.setMoney(10 + user.data.getMoney()); - } - - private void scheduleSaving() - { - System.out.println("Schedule saving..."); - } -} diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index 22cac25a9..019c0ef7a 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -20,8 +20,6 @@ - - ############################################################ # +------------------------------------------------------+ # # | Essentials (Global) | # @@ -215,6 +213,10 @@ auto-afk-kick: -1 # The player has to use the command /afk to leave the afk mode. freeze-afk-players: false +# When the player is afk, should he be able to pickup items? +# Enable this, when you don't want people idling in mob traps. +disable-item-pickup-while-afk: true + # You can disable the death messages of minecraft here death-messages: true @@ -222,11 +224,29 @@ death-messages: true no-god-in-worlds: # - world_nether +# Set to true to enable per-world permissions for teleporting with /world +# Give someone permission to teleport to a world with essentials.world.<worldname> +world-teleport-permissions: false + +# The number of items given if the quantity parameter is left out in /item or /give. +# If this number is below 1, the maximum stack size size is given. If oversized stacks +# is not enabled, any number higher then the maximum stack size results in more than one stack. +default-stack-size: -1 + # Oversized stacks are stacks that ignore the normal max stacksize. # They can be obtained using /give and /item, if the player has essentials.oversizedstacks permission. # How many items should be in a oversized stack? oversized-stacksize: 64 +# Do you allow to repair enchanted weapons and armor? +# If you set this to false, you can still allow it for certain players using the permission +# essentials.repair.enchanted +repair-enchanted: true + +#Do you want essentials to keep track of previous location for /back in the teleport listener? +#If you set this to true any plugin that uses teleport will have the previous location registered. +register-back-in-listener: false + ############################################################ # +------------------------------------------------------+ # # | EssentialsHome | # @@ -239,6 +259,9 @@ respawn-at-home: false # If no home is set send you to bed or spawn when /home is used spawn-if-no-home: true +# Allows people to set their bed at daytime +update-bed-at-daytime: true + # Allow players to have multiple homes. # Define different amounts of multiple homes for different permissions, e.g. essentials.sethome.multiple.vip # People with essentials.sethome.multiple.unlimited are not limited by these numbers. @@ -300,24 +323,28 @@ hide-permissionless-help: true # +------------------------------------------------------+ # ############################################################ -# If EssentialsChat is installed, this will define how far a player's voice travels, in blocks. Set to 0 to make all chat global. -# Note that users with the "essentials.chat.spy" permission will hear everything, regardless of this setting. -# Users with essentials.chat.shout can override this by prefixing text with an exclamation mark (!) -# Or with essentials.chat.question can override this by prefixing text with a question mark (?) -# You can add command costs for shout/question by adding chat-shout and chat-question to the command costs section." chat: + + # If EssentialsChat is installed, this will define how far a player's voice travels, in blocks. Set to 0 to make all chat global. + # Note that users with the "essentials.chat.spy" permission will hear everything, regardless of this setting. + # Users with essentials.chat.shout can override this by prefixing text with an exclamation mark (!) + # Or with essentials.chat.question can override this by prefixing text with a question mark (?) + # You can add command costs for shout/question by adding chat-shout and chat-question to the command costs section." radius: 0 + # Chat formatting can be done in two ways, you can either define a standard format for all chat + # Or you can give a group specific chat format, to give some extra variation. # If set to the default chat format which "should" be compatible with ichat. + # For more information of chat formatting, check out the wiki: http://ess.khhq.net/wiki/Chat_Formatting + format: '<{DISPLAYNAME}> {MESSAGE}' #format: '&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}' - - # You can also have group-specific formats, uncomment to enable: + group-formats: # Default: '{WORLDNAME} {DISPLAYNAME}&7:&f {MESSAGE}' # Admins: '{WORLDNAME} &c[{GROUP}]&f {DISPLAYNAME}&7:&c {MESSAGE}' - + # If your using group formats make sure to remove the '#' to allow the setting to be read. @@ -329,10 +356,8 @@ chat: protect: # Database settings for sign/rail protection - # get mysql.jar and sqlite and place it in your serverroot/lib directory from here: - # https://github.com/essentials/Essentials/blob/master/lib/mysql.jar - # mysql, sqlite or none + # mysql or sqlite datatype: 'sqlite' # If you specified MySQL above, you MUST enter the appropriate details here. @@ -384,6 +409,7 @@ protect: creeper-explosion: false creeper-playerdamage: false creeper-blockdamage: false + enderdragon-blockdamage: true enderman-pickup: false villager-death: false # Monsters won't follow players @@ -489,7 +515,7 @@ protect: ############################################################ # +------------------------------------------------------+ # -# | New Players | # +# | Essentials Spawn / New Players | # # +------------------------------------------------------+ # ############################################################ @@ -498,10 +524,15 @@ newbies: # If so, use this format, replacing {DISPLAYNAME} with the player name. # If not, set to '' #announce-format: '' - announce-format: '&dWelcome {DISPLAYNAME} to the server!' + announce-format: '&dWelcome {DISPLAYNAME}&d to the server!' # When we spawn for the first time, which spawnpoint do we use? # Set to "none" if you want to use the spawn point of the world. spawnpoint: newbies +# Set this to lowest, if you want Multiverse to handle the respawning +# Set this to normal, if you want EssentialsSpawn to handle the respawning +# Set this to highest, if you want to force EssentialsSpawn to handle the respawning +respawn-listener-priority: normal + # End of File <-- No seriously, you're done with configuration. diff --git a/Essentials/src/examples/permissionsbukkit.yml b/Essentials/src/examples/permissionsbukkit.yml index 2251985e7..515256ef1 100644 --- a/Essentials/src/examples/permissionsbukkit.yml +++ b/Essentials/src/examples/permissionsbukkit.yml @@ -5,8 +5,7 @@ users: groups: Default: permissions: - permissions.build: true - essentials.build: false + permissions.build: false essentials.spawn: true essentials.rules: true essentials.motd: true @@ -16,7 +15,6 @@ groups: Builder: permissions: permissions.build: true - essentials.build: true essentials.afk: true essentials.back: true essentials.back.ondeath: true diff --git a/Essentials/src/info.txt b/Essentials/src/info.txt index 4435364fe..e05843dcb 100644 --- a/Essentials/src/info.txt +++ b/Essentials/src/info.txt @@ -32,4 +32,10 @@ WORLD: {WORLD} WORLDS: {WORLDS} ONLINE: {ONLINE} UNIQUE: {UNIQUE} -PLAYERLIST: {PLAYERLIST}
\ No newline at end of file +PLAYERLIST: {PLAYERLIST} +TIME: {TIME} +DATE: {DATE} +WORLDTIME12: {WORLDTIME12} +WORLDTIME24: {WORLDTIME24} +WORLDDATE: {WORLDDATE} +PLUGINS: {PLUGINS} diff --git a/Essentials/src/items.csv b/Essentials/src/items.csv index 3803cb6fe..44a4de473 100644 --- a/Essentials/src/items.csv +++ b/Essentials/src/items.csv @@ -862,6 +862,18 @@ doublecstoneslab,43,3 dcstoneslab,43,3 doublecsslab,43,3 dcsslab,43,3 +brickdoublestep,43,4 +brickdstep,43,4 +bdstep,43,4 +brickdoubleslab,43,4 +brickdslab,43,4 +bdslab,43,4 +stonebrickdoublestep,43,5 +stonebdstep,43,5 +sbdstep,43,5 +stonebrickdoubleslab,43,5 +stonebdslab,43,5 +sbdslab,43,5 smoothstonestep,44,0 stonestep,44,0 sstep,44,0 @@ -894,6 +906,16 @@ cobblestoneslab,44,3 cobbleslab,44,3 cstoneslab,44,3 csslab,44,3 +brickstep,44,4 +brickblockstep,44,4 +bstep,44,4 +brickslab,44,4 +brickblockslab,44,4 +bslab,44,4 +stonebrickstep,44,5 +sbstep,44,5 +stonebrickslab,44,5 +sbslab,44,5 brickblock,45,0 blockbrick,45,0 bblock,45,0 @@ -1269,10 +1291,10 @@ mossystonebrick,98,1 mossystonebricks,98,1 mossystonebrickblock,98,1 mossystonebb,98,1 -crackedstonebrick,98,1 -crackedstonebricks,98,1 -crackedstonebrickblock,98,1 -crackedstonebb,98,1 +crackedstonebrick,98,2 +crackedstonebricks,98,2 +crackedstonebrickblock,98,2 +crackedstonebb,98,2 hugeredmushroom,99,0 bigredmushroom,99,0 brmushroom,99,0 @@ -1341,18 +1363,104 @@ cementbstairs,109,0 greybrickstairs,109,0 greybstairs,109,0 mycel,110,0 +mycelium,110,0 +swampgrass,110,0 +sgrass,110,0 waterlily,111,0 +lilypad,111,0 +lily,111,0 +swamppad,111,0 +lpad,111,0 +wlily,111,0 netherbrick,112,0 +nbrick,112,0 +hellbrick,112,0 +deathbrick,112,0 +dbrick,112,0 +hbrick,112,0 netherfence,113,0 +nfence,113,0 +hellfence,113,0 +deathfence,113,0 +dfence,113,0 +hfence,113,0 netherbrickstairs,114,0 +nbrickstairs,114,0 +hellbrickstairs,114,0 +deathbrickstairs,114,0 +dbrickstairs,114,0 +hbrickstais,114,0 netherwarts,115,0 +netherwart,115,0 +netherplant,115,0 +nethercrop,115,0 +hellwarts,115,0 +hellwart,115,0 +hellplant,115,0 +hellcrop,115,0 +deathwarts,115,0 +deathwart,115,0 +deathplant,115,0 +deathcrop,115,0 +nwarts,115,0 +nwart,115,0 +ncrop,115,0 +nplant,115,0 +hwarts,115,0 +hwart,115,0 +hplant,115,0 +hcrop,115,0 +dwarts,115,0 +dwart,115,0 +dplant,115,0 +dcrop,115,0 enchantmenttable,116,0 +magictable,116,0 +etable,116,0 +booktable,116,0 +magicdesk,116,0 +enchantmentdesk,116,0 +edesk,116,0 +btable,116,0 +bdesk,116,0 +mtable,116,0 +mdesk,116,0 brewingstand,117,0 +brewer,117,0 +potionstand,117,0 +potionbrewer,117,0 +pstand,117,0 +bstand,117,0 +pbrewer,117,0 cauldron,118,0 +steelcauldron,118,0 +ironcauldron,118,0 +icauldron,118,0 +scauldron,118,0 +potioncauldron,118,0 +pcauldron,118,0 enderportal,119,0 +endergoo,119,0 +endgoo,119,0 +endportal,119,0 +egoo,119,0 +eportal,119,0 enderportalframe,120,0 +endportalframe,120,0 +endgooframe,120,0 +endergooframe,120,0 +egooframe,120,0 +eportalframe,120,0 enderstone,121,0 +endstone,121,0 +endrock,121,0 +enderrock,121,0 +erock,121,0 +estone,121,0 dragonegg,122,0 +degg,122,0 +bossegg,122,0 +begg,122,0 ironshovel,256,0 ironspade,256,0 ishovel,256,0 @@ -2224,19 +2332,101 @@ epearl,368,0 bluepearl,368,0 endergem,368,0 blazerod,369,0 +goldenrod,369,0 +goldrod,369,0 +blazestick,369,0 +goldstick,369,0 +brod,369,0 +grod,369,0 +bstick,369,0 +gstick,369,0 ghasttear,370,0 +ghastdrop,370,0 +ghosttear,370,0 +ghostdrop,370,0 +gtear,370,0 +gdrop,370,0 goldnugget,371,0 +gnugget,371,0 +goldball,371,0 +goldpebble,371,0 +gball,371,0 +gpebble,371,0 +pigzombienugget,371,0 +pigzombieball,371,0 +pigzombiepebble,371,0 netherstalk,372,0 +deathstalk,372,0 +hellstalk,372,0 +nstalk,372,0 +dstalk,372,0 +hstalk,372,0 potion,373,0 +mixture,373,0 +potions,373,0 glassbottle,374,0 +bottle,374,0 +gbottle,374,0 +gvase,374,0 +vase,374,0 +glassvase,374,0 +emptypotion,374,0 spidereye,375,0 +eyeofspider,375,0 +spiderseye,375,0 +spiderball,375,0 +spidernugget,375,0 +spidersball,375,0 +spidersnugget,375,0 +seye,375,0 +sball,375,0 +snugget,375,0 fermentedspidereye,376,0 +craftedspidereye,376,0 +fermentedeyeofspider,376,0 +craftedeyeofspider,376,0 +fspidereye,376,0 +feyeofspider,376,0 +ceyeofspider,376,0 +cspidereye,376,0 blazepowder,377,0 +blazedust,377,0 +goldpowder,377,0 +golddust,377,0 +gdust,377,0 +gpowder,377,0 +bpowder,377,0 +bdust,377,0 magmacream,378,0 -brewingsstanditem,379,0 +goldcream,378,0 +blazecream,378,0 +mcream,378,0 +gcream,378,0 +bcream,378,0 +combinedcream,378,0 +ccream,378,0 +brewingstanditem,379,0 +potionstanditem,379,0 cauldronitem,380,0 +ironcauldronitem,380,0 +steelcauldronitem,380,0 +icauldronitem,380,0 +scauldronitem,380,0 eyeofender,381,0 +endereye,381,0 +evilendereye,381,0 +evileyeofender,381,0 +evilenderpearl,381,0 +eeye,381,0 +eofender,381,0 speckledmelon,382,0 +goldmelon,382,0 +sparklymelon,382,0 +glisteningmelon,382,0 +glisteringmelon,382,0 +shiningmelon,382,0 +gmelon,382,0 +smelon,382,0 goldmusicrecord,2256,0 goldmusicdisk,2256,0 goldmusiccd,2256,0 @@ -2255,6 +2445,7 @@ goldcd,2256,0 gorecord,2256,0 godisk,2256,0 gocd,2256,0 +record1,2256,0 greenmusicrecord,2257,0 greenmusicdisk,2257,0 greenmusiccd,2257,0 @@ -2273,6 +2464,7 @@ greencd,2257,0 grrecord,2257,0 grdisk,2257,0 grcd,2257,0 +record2,2257,0 record3,2258,0 record4,2259,0 record5,2260,0 diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 5a4c67173..b9e27b959 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -15,7 +15,7 @@ backUsageMsg=\u00a77Returning to previous location. backupFinished=Backup finished backupStarted=Backup started balance=\u00a77Balance: {0} -balanceTop=\u00a77Top {0} balances +balanceTop=\u00a77Top balances ({0}) banExempt=\u00a7cYou can not ban that player. banIpAddress=\u00a77Banned IP address bannedIpsFileError=Error reading banned-ips.txt @@ -24,6 +24,7 @@ bannedPlayersFileError=Error reading banned-players.txt bannedPlayersFileNotFound=banned-players.txt not found bigTreeFailure=\u00a7cBig tree generation failure. Try again on grass or dirt. bigTreeSuccess= \u00a77Big tree spawned. +blockList=Essentials blocked the following commands, due to command conflicts: broadcast=[\u00a7cBroadcast\u00a7f]\u00a7a {0} buildAlert=\u00a7cYou are not permitted to build bukkitFormatChanged=Bukkit version format changed. Version not checked. @@ -63,6 +64,7 @@ depthBelowSea=\u00a77You are {0} block(s) below sea level. destinationNotSet=Destination not set disableUnlimited=\u00a77Disabled unlimited placing of {0} for {1}. disabled=disabled +disabledToSpawnMob=Spawning this mob was disabled in the config file. dontMoveMessage=\u00a77Teleportation will commence in {0}. Don''t move. downloadingGeoIp=Downloading GeoIP database ... this might take a while (country: 0.6 MB, city: 20MB) duplicatedUserdata=Duplicated userdata: {0} and {1} @@ -75,6 +77,8 @@ enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item enchantments = \u00a77Enchantments: {0} errorCallingCommand=Error calling command /{0} errorWithMessage=\u00a7cError: {0} +essentialsHelp1=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, go to http://tiny.cc/EssentialsChat +essentialsHelp2=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, either type /essentialshelp in game or go to http://tiny.cc/EssentialsChat essentialsReload=\u00a77Essentials Reloaded {0} extinguish=\u00a77You extinguished yourself. extinguishOthers=\u00a77You extinguished {0}. @@ -82,6 +86,8 @@ failedToCloseConfig=Failed to close config {0} failedToCreateConfig=Failed to create config {0} failedToWriteConfig=Failed to write config {0} false=false +feed=\u00a77Your appetite was sated. +feedOther=\u00a77Satisfied {0}. fileRenameError=Renaming file {0} failed foreverAlone=\u00a7cYou have nobody to whom you can reply. freedMemory=Freed {0} MB. @@ -149,8 +155,8 @@ jumpError=That would hurt your computer''s brain. kickDefault=Kicked from server kickExempt=\u00a7cYou can not kick that person. kill=\u00a77Killed {0}. -kitError=\u00a7cThere are no valid kits. kitError2=\u00a7cThat kit does not exist or is improperly defined. +kitError=\u00a7cThere are no valid kits. kitErrorHelp=\u00a7cPerhaps an item is missing a quantity in the configuration? kitGive=\u00a77Giving kit {0}. kitInvFull=\u00a7cYour inventory was full, placing kit on the floor @@ -193,6 +199,7 @@ muteExempt=\u00a7cYou may not mute that player. mutedPlayer=Player {0} muted. mutedPlayerFor=Player {0} muted for {1}. mutedUserSpeaks={0} tried to speak, but is muted. +nearbyPlayers=Players nearby: {0} needTpohere=You need access to /tpohere to teleport other players. negativeBalanceError=User is not allowed to have a negative balance. nickChanged=Nickname changed. @@ -212,10 +219,11 @@ noHomeSetPlayer=Player has not set a home. noKitPermission=\u00a7cYou need the \u00a7c{0}\u00a7c permission to use that kit. noKits=\u00a77There are no kits available yet noMail=You do not have any mail -noMailSendPerm=\u00a7cYou do not have the \u00a7fessentials.mail.send\u00a7c permission. noMotd=\u00a7cThere is no message of the day. noNewMail=\u00a77You have no new mail. noPendingRequest=You do not have a pending request. +noPerm=\u00a7cYou do not have the \u00a7f{0}\u00a7c permission. +noPermToSpawnMob=\u00a7cYou don''t have permission to spawn this mob. noPlacePermission=\u00a7cYou do not have permission to place a block near that sign. noPowerTools=You have no power tools assigned. noRules=\u00a7cThere are no rules specified yet. @@ -223,6 +231,7 @@ noWarpsDefined=No warps defined none=none notAllowedToQuestion=\u00a7cYou are not authorized to use question. notAllowedToShout=\u00a7cYou are not authorized to shout. +notEnoughExperience=You do not have enough experience. notEnoughMoney=You do not have sufficient funds. notRecommendedBukkit=Bukkit version is not the recommended build for Essentials. notSupportedYet=Not supported yet. @@ -271,8 +280,10 @@ protectionOwner=\u00a76[EssentialsProtect] Protection owner: {0} questionFormat=\u00a77[Question]\u00a7f {0} readNextPage=Type /{0} {1} to read the next page reloadAllPlugins=\u00a77Reloaded all plugins. +removed=\u00a77Removed {0} entities. repair=You have successfully repaired your: \u00a7e{0}. repairAlreadyFixed=\u00a77This item does not need repairing. +repairEnchanted=\u00a77You are not allowed to repair enchanted items. repairInvalidType=\u00a7cThis item cannot be repaired. repairNone=There were no items that needing repairing. requestAccepted=\u00a77Teleport request accepted. @@ -280,6 +291,7 @@ requestAcceptedFrom=\u00a77{0} accepted your teleport request. requestDenied=\u00a77Teleport request denied. requestDeniedFrom=\u00a77{0} denied your teleport request. requestSent=\u00a77Request sent to {0}\u00a77. +requiredBukkit=You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. returnPlayerToJailError=Error occurred when trying to return player to jail. second=second seconds=seconds @@ -360,7 +372,7 @@ versionMismatch=Version mismatch! Please update {0} to the same version. versionMismatchAll=Version mismatch! Please update all Essentials jars to the same version. voiceSilenced=\u00a77Your voice has been silenced warpDeleteError=Problem deleting the warp file. -warpListPermission=\u00a7cYou do not have Permission to list that warps. +warpListPermission=\u00a7cYou do not have Permission to list warps. warpNotExist=That warp does not exist. warpSet=\u00a77Warp {0} set. warpUsePermission=\u00a7cYou do not have Permission to use that warp. @@ -371,6 +383,7 @@ weatherStorm=\u00a77You set the weather to storm in {0} weatherStormFor=\u00a77You set the weather to storm in {0} for {1} seconds weatherSun=\u00a77You set the weather to sun in {0} weatherSunFor=\u00a77You set the weather to sun in {0} for {1} seconds +whoisBanned=\u00a79 - Banned: {0} whoisGamemode=\u00a79 - Gamemode: {0} whoisGeoLocation=\u00a79 - Location: {0} whoisGod=\u00a79 - God mode: {0} diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index 4dcd2f24a..d44f66c72 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -1,391 +1,404 @@ #version: TeamCity # Single quotes have to be doubled: '' # Translations start here -# by: papand13, papand13@gmail.com +# by: Dysp, dysperen@gmail.com action=* {0} {1} -addedToAccount=\u00a7a{0} er tilf\u00f8jet til din konto. +addedToAccount=\u00a7a{0} er blevet tilf\u00f8jet til din konto. addedToOthersAccount=\u00a7a{0} er blevet tilf\u00f8jet til {1} konto. alertBroke=\u00f8delagde: alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} ved: {3} alertPlaced=placerede: alertUsed=brugte: -autoAfkKickReason=You have been kicked for idling more than {0} minutes. -backAfterDeath=\u00a77Brug /back kommandoen for at retunere til dit d\u00f8ds punkt. -backUsageMsg=\u00a77Returnere til tidligere placering. -backupFinished=Backup sluttede -backupStarted=Backup startede -balance=\u00a77Balance: {0} -balanceTop=\u00a77 Top {0} saldi -banExempt=\u00a7cDu kan ikke forbyde den p\u00e5g\u00e6ldende spiller. +autoAfkKickReason=Du er blevet kicked for at idle mere end {0} minutter. +backAfterDeath=\u00a77Brug /back kommandoen for at teleportere til dit d\u00f8dspunkt. +backUsageMsg=\u00a77Teleporterer til tidligere placering. +backupFinished=Backup sluttet +backupStarted=Backup startet +balance=\u00a77Saldo: {0} +balanceTop=\u00a77 Top saldoer ({0}) +banExempt=\u00a7cDu kan ikke banne den p\u00e5g\u00e6ldende spiller. banIpAddress=\u00a77Bannede IP addresse -bannedIpsFileError=Fejl i l\u00e6sning af banned-ips.txt +bannedIpsFileError=Fejl i afl\u00e6sning af banned-ips.txt bannedIpsFileNotFound=banned-ips.txt ikke fundet -bannedPlayersFileError=Fejl i l\u00e6sning af banned-players.txt +bannedPlayersFileError=Fejl i afl\u00e6sning af banned-players.txt bannedPlayersFileNotFound=banned-players.txt ikke fundet -bigTreeFailure=\u00a7cStort tr\u00e6 genererings fejl. Pr\u00f8v igen p\u00e5 gr\u00e6s eller jord. -bigTreeSuccess= \u00a77Stort tr\u00e6 fremkaldt. +bigTreeFailure=\u00a7cFejl i generering af stort tr\u00e6. Pr\u00f8v igen p\u00e5 gr\u00e6s eller jord. +bigTreeSuccess= \u00a77Stort tr\u00e6 bygget. +blockList=Essentials blokerede f\u00c3\u00b8lgende kommandoer som f\u00c3\u00b8lge af kommando-konflikter: broadcast=[\u00a7cMeddelelse\u00a7f]\u00a7a {0} -buildAlert=\u00a7cDu er ikke tilladt at bygge! -bukkitFormatChanged=Bukkit version format \u00e6ndret. Version er ikke checket. -burnMsg=\u00a77Du satte ild til {0} for {1} sekunder. -canTalkAgain=\u00a77Du kan snakke igen +buildAlert=\u00a7cDu har ikke tilladelse til at bygge +bukkitFormatChanged=Bukkit versionsformat er \u00e6ndret. Versionen er ikke checket. +burnMsg=\u00a77Du satte ild til {0} i {1} sekunder. +canTalkAgain=\u00a77Du kan nu snakke igen. cantFindGeoIpDB=Kan ikke finde GeoIP database! -cantReadGeoIpDB=Fejl ved l\u00e6sning af GeoIP database! -cantSpawnItem=\u00a7cDu er ikke tilladt at spawne elementet {0} -commandFailed=Kommando {0} fejlede: -commandHelpFailedForPlugin=Fejl ved at f\u00e5 hj\u00e6lp til: {0} -commandNotLoaded=\u00a7cCommand {0} er ikke indl\u00e6st korrekt. -compassBearing=\u00a77B\u00e6rer: {0} ({1} grader). +cantReadGeoIpDB=Fejl ved afl\u00e6sning af GeoIP database! +cantSpawnItem=\u00a7cDu har ikke tilladelse til at skabe tingen.{0} +commandFailed=Kommandoen {0} fejlede: +commandHelpFailedForPlugin=Fejl ved hentning af hj\u00e6lp til: {0} +commandNotLoaded=\u00a7cKommando {0} er ikke indl\u00e6st korrekt. +compassBearing=\u00a77B\u00e6rer: {0} ({1} grader). (Oversat korrekt?) configFileMoveError=Kunne ikke flytte config.yml til backup placering. configFileRenameError=Kunne ikke omd\u00f8be temp fil til config.yml connectedPlayers=Tilsluttede spillere: -connectionFailed=Failed ved \u00e5bning af forbindelse. -cooldownWithMessage=\u00a7cNedk\u00f8lning: {0} -corruptNodeInConfig=\u00a74Notice: Din konfigurations fil har en korrupt {0} node. +connectionFailed=Kunne ikke \u00e5bne forbindelse. +cooldownWithMessage=\u00a7cCooldown: {0} +corruptNodeInConfig=\u00a74Notits: Din konfigurationsfil har en korrupt {0} linje. couldNotFindTemplate=Kunne ikke finde skabelon {0} creatingConfigFromTemplate=Opretter config fra skabelon: {0} creatingEmptyConfig=Opretter tom config: {0} creative=creative day=dag days=dage -defaultBanReason=Ban hammeren har talt! +defaultBanReason=Banhammeren har talt! deleteFileError=Kunne ikke slette fil: {0} -deleteHome=\u00a77Home {0} has been removed. +deleteHome=\u00a77Home {0} er blevet fjernet. deleteJail=\u00a77F\u00e6ngsel {0} er fjernet. deleteWarp=\u00a77Warp {0} er fjernet. -deniedAccessCommand={0} var n\u00e6gtet adgang til kommando. +deniedAccessCommand={0} blev n\u00e6gtet adgang til kommandoen. dependancyDownloaded=[Essentials] Dependancy {0} downloaded successfully. -dependancyException=[Essentials] An error occured when trying to download a dependacy -dependancyNotFound=[Essentials] A required dependancy was not found, downloading now. +dependancyException=[Essentials] En fejl opstod ved fors\u00c3\u00b8g p\u00c3\u00a5 at downloade en N\u00c3\u0098DVENDIGHED?! +dependancyNotFound=[Essentials] En p\u00c3\u00a5kr\u00c3\u00a6vet N\u00c3\u0098DVENDIGHED!? blev ikke fundet; downloader nu. depth=\u00a77Du er ved havoverfladen. -depthAboveSea=\u00a77Du er {0} blok(ke) over havoverfladen. -depthBelowSea=\u00a77Du er {0} blok(ke) under havoverfladen. -destinationNotSet=Destination er ikke sat +depthAboveSea=\u00a77Du er {0} blok(ke) over havets overflade. +depthBelowSea=\u00a77Du er {0} blok(ke) under havets overflade. +destinationNotSet=Destination ikke sat disableUnlimited=\u00a77Deaktiverede ubergr\u00e6nset placering af {0} for {1}. disabled=deaktiveret +disabledToSpawnMob=Skabelse af denne mob er deaktiveret i configfilen. dontMoveMessage=\u00a77Teleportering vil begynde om {0}. Bev\u00e6g dig ikke. -downloadingGeoIp=Downloader GeoIP database ... det her kan tage et stykke tid (land: 0.6 MB, by: 20MB) +downloadingGeoIp=Downloader GeoIP database... det her kan tage et stykke tid (land: 0.6 MB, by: 27MB) 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. +enchantmentApplied = \u00a77Enchantment {0} er blevet tilf\u00c3\u00b8jet til tingen i din h\u00c3\u00a5nd. +enchantmentNotFound = \u00a7cEnchantment ikke fundet. +enchantmentPerm = \u00a7cDu har ikke tilladelse til at {0} +enchantmentRemoved = \u00a77Cnchantment {0} er blevet fjernet fra tingen i din h\u00c3\u00a5nd. enchantments = \u00a77Enchantments: {0} -errorCallingCommand=Fejl ved opkald af kommando /{0} +errorCallingCommand=Fejl ved kald af kommando /{0} errorWithMessage=\u00a7cFejl: {0} -essentialsReload=\u00a77Essentials Genindl\u00e6st {0} -extinguish=\u00a77Du slukkede dig selv. -extinguishOthers=\u00a77Du slukkede {0}. +essentialsHelp1=Denne fil er \u00c3\u00b8delagt og Essentials kan ikke \u00c3\u00a5bne den. Essentials er nu deaktiveret. Kan du ikke ordne denne fil selv, kan du f\u00c3\u00a5 hj\u00c3\u00a6lp p\u00c3\u00a5 http://tiny.cc/EssentialsChat +essentialsHelp2=Filen er \u00c3\u00b8delagt og Essentials kan ikke \u00c3\u00a5bne den. Essentials er nu deaktiveret. Kan du ikke ordne denne fil selv, skriv enten /essentialshelp ingame eller f\u00c3\u00a5 hj\u00c3\u00a6lp p\u00c3\u00a5 http://tiny.cc/EssentialsChat +essentialsReload=\u00a77Essentials Genindl\u00e6st {0}. +extinguish=\u00a77Du slukkede ilden i dig selv. +extinguishOthers=\u00a77Du slukkede ilden i {0}. failedToCloseConfig=Fejlede i at lukke config {0} -failedToCreateConfig=Fejl i oprettelse af config {0} -failedToWriteConfig=Fejlede i at skrive config {0} +failedToCreateConfig=Fejlede i oprettelse af config {0} +failedToWriteConfig=Fejlede i at skrive til config {0} false=false -fileRenameError=Resterende fil {0} fejlede -foreverAlone=\u00a7cDu har ingen du kan svare. -freedMemory=Befriede {0} MB. -gameMode=\u00a77Set game mode {0} for {1}. -gcchunks= stykker, -gcentities= enheder +feed=\u00a77Your appetite was sated. +feedOther=\u00a77Satisfied {0}. +fileRenameError=Omd\u00c3\u00b8bning af fil {0} fejlede. +foreverAlone=\u00a7cDu har ingen til hvem du kan svare. +freedMemory=Frigjorde {0} MB. +gameMode=\u00a77Satte game mode {0} for {1}. +gcchunks= chunks, +gcentities= entities gcfree=Free memory: {0} MB gcmax=Maximum memory: {0} MB gctotal=Allocated memory: {0} MB geoIpUrlEmpty=GeoIP download url er tom. geoIpUrlInvalid=GeoIP download url er ugyldig. -geoipJoinFormat=Spiller {0} kommer fra {1} +geoipJoinFormat=Spilleren {0} kommer fra {1} godDisabledFor=deaktiveret for {0} godEnabledFor=aktiveret for {0} -godMode=\u00a77Gud tilstand {0}. +godMode=\u00a77Gud mode {0}. haveBeenReleased=\u00a77Du er blevet l\u00f8sladt -heal=\u00a77Du er blevet helbredt. -healOther=\u00a77Helbredt {0}. +heal=\u00a77Du er blevet healed. +healOther=\u00a77Healed {0}. helpConsole=For at se hj\u00e6lp fra konsolen, skriv ?. helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} helpPages=Side \u00a7c{0}\u00a7f af \u00a7c{1}\u00a7f: holeInFloor=Hul i gulv homeSet=\u00a77Hjem sat. homeSetToBed=\u00a77Dit hjem er nu sat til denne seng. -homes=Homes: {0} +homes=Hjem: {0} hour=time hours=timer -ignorePlayer=Du ignorere spiller {0} fra nu af. -illegalDate=Ilegal dato format. +ignorePlayer=Du ignorerer spiller {0} fra nu af. +illegalDate=Forkert datoformat. infoChapter=V\u00e6lg kapitel: infoChapterPages=Kapitel {0}, side \u00a7c{1}\u00a7f af \u00a7c{2}\u00a7f: -infoFileDoesNotExist=Fil info.txt eksisterer ikke. Laver en for dig. +infoFileDoesNotExist=Fil info.txt eksisterer ikke. Fixer liiige en for dig. infoPages=Side \u00a7c{0}\u00a7f af \u00a7c{1}\u00a7f: infoUnknownChapter=Ukendt kapitel. invBigger=Den anden brugers inventory er st\u00f8rre end din. invRestored=Din inventory er blevet genoprettet. -invSee=Du ser inventoryen af {0}. +invSee=Du ser {0}''s inventory. invSeeHelp=Brug /invsee for at genoprette din inventory. -invalidCharge=\u00a7cUgyldig opladning. +invalidCharge=\u00a7cUgyldig opladning (korrekt oversat?). invalidMob=Ugyldig mob type. invalidServer=Ugyldig server! invalidSignLine=Linje {0} p\u00e5 skilt er ugyldig. invalidWorld=\u00a7cUgyldig verden. inventoryCleared=\u00a77Inventory ryddet. -inventoryClearedOthers=\u00a77Inventory af \u00a7c{0}\u00a77 ryddet. +inventoryClearedOthers=\u00a7c{0}\u00a77''s inventory ryddet. is=er -itemCannotBeSold=Det element kan ikke s\u00e6lges til serveren. -itemMustBeStacked=Element skal handles i stakke. En m\u00e6ngde af 2s ville v\u00e6re to stakke, osv. -itemNotEnough1=\u00a7cDu har ikke nok af det element til at s\u00e6lge. -itemNotEnough2=\u00a77Hvis du ville have solgt alle dine elementer af den type, brug /sell elementnavn -itemNotEnough3=\u00a77/sell elementnavn -1 vil s\u00e6lge alle p\u00e5 n\u00e6r et element, osv. -itemSellAir=Fors\u00f8gte du virkelig at s\u00e6lge luft? Kom et element i din h\u00e5nd. -itemSold=\u00a77Solgte for \u00a7c{0} \u00a77({1} {2} elementer for {3} hver) -itemSoldConsole={0} solgte {1} for \u00a77{2} \u00a77({3} elementer for {4} hver) +itemCannotBeSold=Denne ting kan ikke s\u00e6lges til serveren. +itemMustBeStacked=Tingen skal handles i stakke. En m\u00e6ngde af 2s ville v\u00e6re to stakke, osv. +itemNotEnough1=\u00a7cDu har ikke nok af denne ting til at kunne s\u00e6lge. +itemNotEnough2=\u00a77Hvis du mente, at du ville s\u00c3\u00a6lge alle ting af den type, brug da /sell tingens-navn +itemNotEnough3=\u00a77/sell ting-navn -1 vil s\u00e6lge alle enheder, undtagen \u00c3\u00a9n, osv. +itemSellAir=Fors\u00f8gte du virkelig at s\u00e6lge luft? Kom en ting i h\u00e5nden, hattemand. +itemSold=\u00a77Solgte til \u00a7c{0} \u00a77({1} {2} ting for {3} pr. stk.) +itemSoldConsole={0} solgte {1} til \u00a77{2} \u00a77({3} ting for {4} pr. stk.) itemSpawn=\u00a77Giver {0} af {1} -itemsCsvNotLoaded=Kunne ikke indl\u00e6se items.csv. -jailAlreadyIncarcerated=\u00a7cPerson is already in jail: {0} -jailMessage=\u00a7cBryd reglerne, og tag din straf. +itemsCsvNotLoaded=Kunne ikke loade items.csv. +jailAlreadyIncarcerated=\u00a7cSpilleren er allerede i f\u00c3\u00a6ngsel: {0} +jailMessage=\u00a7cDu bryder reglerne, du tager straffen. jailNotExist=Det f\u00e6ngsel eksisterer ikke. -jailReleased=\u00a77Player \u00a7e{0}\u00a77 unjailed. -jailReleasedPlayerNotify=\u00a77You have been released! -jailSentenceExtended=Jail time extend to: {0) -jailSet=\u00a77F\u00e6ngsel {0} er blevet sat -jumpError=Det ville skade din computer''s hjerne. -kickDefault=Kicket fra serveren -kickExempt=\u00a77Du kan ikke sparke denne spiller. -kill=\u00a77Dr\u00e6bte {0}. -kitError=\u00a7cDer er ikke nogen gyldige pakker. -kitError2=\u00a7cDen pakke eksisterer ikke eller er forkert defineret. -kitErrorHelp=\u00a7cM\u00e5ske mangler et element en m\u00e6ngde i konfigurationen? -kitGive=\u00a77Giver pakke {0}. -kitInvFull=\u00a7cDin inventory var fuld, placere pakken p\u00e5 gulvet -kitTimed=\u00a7cDu kan ikke den pakke igen f\u00f8r om {0}. -kits=\u00a77Pakker: {0} -lightningSmited=\u00a77Du er blevet sl\u00e5et -lightningUse=\u00a77Sl\u00e5r {0} +jailReleased=\u00a77Player \u00a7e{0}\u00a77 befriet fra f\u00c3\u00a6ngslet. +jailReleasedPlayerNotify=\u00a77Du er blevet befriet fra f\u00c3\u00a6nglset! +jailSentenceExtended=F\u00c3\u00a6ngselsdom forl\u00c3\u00a6nget til: {0) +jailSet=\u00a77F\u00e6ngsel {0} er blevet sat. +jumpError=Dette vil skade din computer''s hjerne. +kickDefault=Kicked fra serveren. +kickExempt=\u00a77Du kan ikke kicke denne spiller. +kill=\u00a77dr\u00e6bte {0}. +kitError2=\u00a7cDette kit eksisterer ikke eller er forkert defineret. +kitError=\u00a7cDer er ikke nogen gyldige kits. +kitErrorHelp=\u00a7cM\u00e5ske mangler en ting en m\u00e6ngde i konfigurationen? Eller m\u00c3\u00a5ske er der nisser p\u00c3\u00a5 spil? +kitGive=\u00a77Giver kit til {0} (oversat korrekt?). +kitInvFull=\u00a7cDin inventory er fuld, placerer kit p\u00e5 gulvet. +kitTimed=\u00a7cDu kan ikke benytte dette kit igen i {0}. +kits=\u00a77Kits: {0} +lightningSmited=\u00a77Du er blevet ramt af Guds vrede (din admin) +lightningUse=\u00a77Kaster lyn efter {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. +listAmount = \u00a79Der er \u00a7c{0}\u00a79 ud af maksimum\u00a7c{1}\u00a79 spillere online. +listAmountHidden = \u00a79Der er \u00a7c{0}\u00a77/{1}\u00a79 ud af maksimum \u00a7c{2}\u00a79 spillere online. listHiddenTag = \u00a77[HIDDEN]\u00a7f -loadWarpError=Kunne ikke indl\u00e6se warp {0} -loadinfo=Indl\u00e6ste {0} byg {1} af {2} -localFormat=Lokal: <{0}> {1} -mailClear=\u00a7cFor at markere din post som l\u00e6st, skriv /mail clear -mailCleared=\u00a77Post ryddet! -mailSent=\u00a77Post sendt! -markMailAsRead=\u00a7cTo marker din post som l\u00e6st, skriv /post ryd -markedAsAway=\u00a77Du er nu markeret som v\u00e6k. -markedAsNotAway=\u00a77Du er ikke l\u00e6ngere markeret som v\u00e6k. -maxHomes=You cannot set more than {0} homes. -mayNotJail=\u00a7cDu m\u00e5 ikke f\u00e6ngsle den person +loadWarpError=Kunne ikke l\u00c3\u00a6se warp {0} +loadinfo=Loadede {0} build {1} af {2} +localFormat=Local: <{0}> {1} +mailClear=\u00a7cFor at markere din flaskepost som l\u00e6st, skriv /mail clear +mailCleared=\u00a77Flaskepot ryddet! +mailSent=\u00a77Flaskepot sendt! +markMailAsRead=\u00a7cFor at markere din flaskepost som l\u00e6st, skriv /mail clear +markedAsAway=\u00a77Du er nu markeret som v\u00c3\u00a6rende ikke tilstede. +markedAsNotAway=\u00a77Du er ikke l\u00e6ngere markeret som v\u00c3\u00a6rende ikke tilstede. +maxHomes=Du kan ikke have mere end {0} hjem. +mayNotJail=\u00a7cDu kan ikke smide denne person i f\u00c3\u00a6ngsel. me=mig minute=minut minutes=minutter missingItems=Du har ikke {0}x {1}. missingPrefixSuffix=Mangler et pr\u00e6fiks eller suffiks for {0} -mobSpawnError=Fejl ved \u00e6ndring af mob fremkalder. -mobSpawnLimit=Mob m\u00e6ngde begr\u00e6nset til server gr\u00e6nse -mobSpawnTarget=M\u00e5l blok skal v\u00e6re en mob fremkalder. +mobSpawnError=Fejl ved \u00e6ndring af mob spawner. +mobSpawnLimit=Mob m\u00e6ngde begr\u00e6nset til serverens fastsatte gr\u00e6nse. +mobSpawnTarget=M\u00e5l blok skal v\u00e6re en mob spawner. mobsAvailable=\u00a77Mobs: {0} moneyRecievedFrom=\u00a7a{0} er modtaget fra {1} moneySentTo=\u00a7a{0} er sendt til {1} -moneyTaken={0} taget fra din bank konto. -month=m\u00e5ned +moneyTaken={0} blev taget fra din bankkonto. +month=m\u00e5nede months=m\u00e5neder moreThanZero=M\u00e6ngder skal v\u00e6re st\u00f8rre end 0. msgFormat=\u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} -muteExempt=\u00a7cYou may not mute that player. -mutedPlayer=Spiller {0} d\u00e6mpet. -mutedPlayerFor=Spiller {0} d\u00e6mpet for {1}. +muteExempt=\u00a7cDu kan ikke mute denne spiller. +mutedPlayer=Spiller {0} muted. +mutedPlayerFor=Spiller {0} muted i {1}. mutedUserSpeaks={0} pr\u00f8vede at snakke, men er muted. -needTpohere=Du skal have adgang til /tpohere for at teleporter andre spillere. -negativeBalanceError=Brugeren er ikke tilladt at have en negativ saldo. -nickChanged=Kaldenavn \u00e6ndret. -nickDisplayName=\u00a77You have to enable change-displayname in Essentials config. -nickInUse=\u00a7cDet navn er allerede i brug. -nickNamesAlpha=\u00a7cKaldenavne skal v\u00e6re alfanumeriske. -nickNoMore=\u00a7Du har ikke l\u00e6ngere et kaldenavn. -nickOthersPermission=\u00a7cDu har ikke tilladelse til at \u00e6ndre andres kaldenavn -nickSet=\u00a77Dit kaldenavn er nu \u00a7c{0} -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. +nearbyPlayers=Spillere i n\u00c3\u00a6rheden: {0} +needTpohere=Du skal have adgang til /tpohere for at teleportere andre spillere. +negativeBalanceError=Brugeren har ikke tilladelse til at have en negativ saldo. +nickChanged=Nickname \u00e6ndret. +nickDisplayName=\u00a77Du bliver n\u00c3\u00b8dt til at aktivere change-displayname i Essentials config. +nickInUse=\u00a7cDet nickname er allerede i brug. Pr\u00c3\u00b8v Jens eller Harald. Det er gode navne. +nickNamesAlpha=\u00a7cNicknames skal v\u00e6re alfanumeriske. +nickNoMore=\u00a7Du har ikke l\u00e6ngere et nickname. +nickOthersPermission=\u00a7cDu har ikke tilladelse til at \u00e6ndre en andens nickname. +nickSet=\u00a77Dit nickname er nu \u00a7c{0} +noAccessCommand=\u00a7cDu har ikke adgang til denne kommando. +noAccessPermission=\u00a7cDu har ikke tilladelse til at f\u00e5 adgang til {0}. +noDestroyPermission=\u00a7cDu har ikke tilladelse til at \u00f8del\u00e6gge {0}. +noGodWorldWarning=\u00a7cAdvarsel! God mode er sl\u00c3\u00a5et fra i denne verden. +noHelpFound=\u00a7cIngen matchende kommandoer. 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. -noKits=\u00a77Der er ikke nogen pakker tilg\u00e6ngelig endnu -noMail=Du har ikke noget post -noMailSendPerm=\u00a7cDu har ikke \u00a7fessentials.mail.send\u00a7c tilladelsen. -noMotd=\u00a7cDer er ikke nogen besked for dagen. -noNewMail=\u00a77Du har ingen ny post. +noHomeSetPlayer=Spilleren har ikke sat et hjem. +noKitPermission=\u00a7cDu har brug for \u00a7c{0}\u00a7c permission for at bruge dette kit. +noKits=\u00a77Der er ikke nogen kits tilg\u00e6ngelige endnu +noMail=Du har ikke noget flaskepost. +noMotd=\u00a7cDer er ingen Message of the day. +noNewMail=\u00a77Du har ingen ny flaskepost. noPendingRequest=Du har ikke en ventende anmodning. -noPlacePermission=\u00a7cYou do not have permission to place a block near that sign. -noPowerTools= You have no power tools assigned. -noRules=\u00a7cDer er ingen regler fastsat endnu. -noWarpsDefined=Ingen warps defineret +noPerm=\u00a7cDu har ikke \u00a7f{0}\u00a7c permission. +noPermToSpawnMob=\u00a7cDu har ikke tilladelse til at spawne denne mob. +noPlacePermission=\u00a7cDu har ikke tiladelse til at placere en block n\u00c3\u00a6r det skilt. +noPowerTools= Du har ingen power tools tilf\u00c3\u00b8jet. +noRules=\u00a7cDer er ingen regler endnu. ANARKI! +noWarpsDefined=Ingen warps er defineret none=ingen -notAllowedToQuestion=\u00a7cDu er ikke autoriseret til at bruge et sp\u00f8rgsm\u00e5l. -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. +notAllowedToQuestion=\u00a7cDu har ikke tilladelse til at bruge sp\u00f8rgsm\u00e5l. +notAllowedToShout=\u00a7cDu har ikke tilladelse til at r\u00e5be. +notEnoughExperience=You do not have enough experience. +notEnoughMoney=Du har ikke tilstr\u00e6kkeligt med penge. +notRecommendedBukkit=Bukkit version er ikke den anbefalede build til Essentials. notSupportedYet=Ikke underst\u00f8ttet endnu. -nothingInHand = \u00a7cYou have nothing in your hand. +nothingInHand = \u00a7cDu har intet i din h\u00c3\u00a5nd. now=nu -numberRequired=Der skal v\u00e6re et nummer, fjolle. +numberRequired=Et nummer skal v\u00e6re, din tardo. onlyDayNight=/time underst\u00f8tter kun day/night. onlyPlayers=Kun in-game spillere kan bruge {0}. -onlySunStorm=/weather only supports sun/storm. -orderBalances=Ordering balances of {0} users, please wait ... -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} -parseError=Fejl ved parsing {0} p\u00e5 linje {1} -pendingTeleportCancelled=\u00a7cVentende teleportations anmodning aflyst. -permissionsError=Mangler Permissions/GroupManager; chat pr\u00e6fikser/suffikser vil v\u00e6re sl\u00e5et fra. -playerBanned=\u00a7cPlayer {0} banned {1} for {2} -playerInJail=\u00a7cSpiller er allerede i f\u00e6ngsel {0}. -playerJailed=\u00a77Spiller {0} f\u00e6ngslet. -playerJailedFor= \u00a77Spiller {0} f\u00e6ngslet for {1}. -playerKicked=\u00a7cPlayer {0} kicked {1} for {2} -playerMuted=\u00a77You have been muted -playerMutedFor=\u00a77You have been muted for {0} -playerNeverOnServer=\u00a7cSpiller {0} var aldrig p\u00e5 denne server. -playerNotFound=\u00a7cSpiller ikke fundet. -playerUnmuted=\u00a77You have been unmuted +onlySunStorm=/weather underst\u00c3\u00b8tter kun sun/storm. +orderBalances=Tjekker saldoer af {0} spillere, vent venligst... +pTimeCurrent=\u00a7e{0}''s\u00a7f Tiden er {1}. +pTimeCurrentFixed=\u00a7e{0}''s\u00a7f Tiden er fastsat til {1}. +pTimeNormal=\u00a7e{0}''s\u00a7f Tiden er normal og matcher serveren. +pTimeOthersPermission=\u00a7cDu har ikke tilladelse til at \u00c3\u00a6ndre andre spilleres tid. +pTimePlayers=Disse spillere har deres egen tid: +pTimeReset=Spiler-tid er blevet nulstillet for: \u00a7e{0} (oversat korrekt?) +pTimeSet=Spiller-tid er blevet sat til \u00a73{0}\u00a7f for: \u00a7e{1} (oversat korrekt?) +pTimeSetFixed=Spiller-tid er fastsat til \u00a73{0}\u00a7f for: \u00a7e{1} +parseError=Fejl ved parsing af {0} p\u00e5 linje {1} +pendingTeleportCancelled=\u00a7cAnmodning om teleport er blevet afvist. +permissionsError=Mangler Permissions/GroupManager; chat pr\u00e6fikser/suffikser vil v\u00e6re deaktiveret. +playerBanned=\u00a7cSpilleren {0} banned i {1} for {2} +playerInJail=\u00a7cSpilleren er allerede i f\u00e6ngsel {0}. +playerJailed=\u00a77Spilleren {0} f\u00e6ngslet. +playerJailedFor= \u00a77Spilleren {0} f\u00e6ngslet i {1}. +playerKicked=\u00a7cSpiller {0} kicked {1} for {2}. +playerMuted=\u00a77Du er blevet muted! +playerMutedFor=\u00a77Du er blevet muted som f\u00c3\u00b8lge af: {0} +playerNeverOnServer=\u00a7cSpilleren {0} har aldrig v\u00c3\u00a6ret p\u00e5 denne server. +playerNotFound=\u00a7cSpilleren ikke fundet. +playerUnmuted=\u00a77Du er blevet unmuted. pong=Pong! -possibleWorlds=\u00a77Mulige verdener er numrene 0 igennem {0}. -powerToolAir=Kommando kan ikke blive tildelt luft. -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. -protectionOwner=\u00a76[EssentialsProtect] Beskyttelses ejer: {0} +possibleWorlds=\u00a77Mulige verdener er numrene fra 0 til {0}. +powerToolAir=Kommando kan ikke blive p\u00c3\u00a5lagt luft. +powerToolAlreadySet=Kommandoen \u00a7c{0}\u00a7f er allerede p\u00c3\u00a5lagt {1}. +powerToolAttach=\u00a7c{0}\u00a7f kommando p\u00c3\u00a5lagt {1}. +powerToolClearAll=Alle powertool kommandoer er blevet nulstillet. +powerToolList={1} har f\u00c3\u00b8lgende kommandoer: \u00a7c{0}\u00a7f. +powerToolListEmpty={0} har ingen kommandoer p\u00c3\u00a5lagt. +powerToolNoSuchCommandAssigned=Kommando \u00a7c{0}\u00a7f blev ikke p\u00c3\u00a5lagt {1}. +powerToolRemove=Kommando \u00a7c{0}\u00a7f fjernet fra {1}. +powerToolRemoveAll=Alle kommandoer fjernet fra {0}. +powerToolsDisabled= Alle dine power tools er blevet deaktiveret. +powerToolsEnabled= Alle dine power tools er blevet aktiveret. +protectionOwner=\u00a76[EssentialsProtect] Protection owner: {0} questionFormat=\u00a77[Sp\u00f8rgsm\u00e5l]\u00a7f {0} -readNextPage=Type /{0} {1} to read the next page -reloadAllPlugins=\u00a77Genindl\u00e6ste alle tilf\u00f8jelser. -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. -requestAccepted=\u00a77Teleporterings anmodning n\u00e6gtet. -requestAcceptedFrom=\u00a77{0} accepted your teleport request. -requestDenied=\u00a77Teleporterings anmodning n\u00e6gtet. -requestDeniedFrom=\u00a77{0} denied your teleport request. +readNextPage=Skriv /{0} {1} for at l\u00c3\u00a6se n\u00c3\u00a6ste side. +reloadAllPlugins=\u00a77Reload alle plugins. +removed=\u00a77Removed {0} entities. +repair=Du reparerede \u00a7e{0}. Du s\u00c3\u00a5'' dygtig! +repairAlreadyFixed=\u00a77Denne ting har ikke brug for reparation. +repairEnchanted=\u00a77Du har ikke tilladelse til at reparere enchantede ting. +repairInvalidType=\u00a7cDenne ting kan ikke repareres. +repairNone=Der var ingen ting der beh\u00c3\u00b8vede reparation. +requestAccepted=\u00a77Anmodning om teleport accepteret! Sikke en guttermand. +requestAcceptedFrom=\u00a77{0} accepterede din anmodning om teleport. +requestDenied=\u00a77Anmodning om teleport afvist. +requestDeniedFrom=\u00a77{0} afviste din anmodning om teleport. requestSent=\u00a77Anmodning sendt til {0}\u00a77. -returnPlayerToJailError=En fejl opstod ved fors\u00f8g p\u00e5 at returnere spiller til f\u00e6ngsel. -second=sekunde +requiredBukkit=You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. +returnPlayerToJailError=En fejl opstod ved fors\u00f8g p\u00e5 at returnere spilleren til f\u00e6ngsel. +second=sekund seconds=sekunder -seenOffline=Spiller {0} er offline siden {1} -seenOnline=Spiller {0} er online siden {1} -serverFull=Server er fuld -setSpawner=Changed spawner type to {0} -sheepMalformedColor=Misdannet farve. -shoutFormat=\u00a77[R\u00e5b]\u00a7f {0} +seenOffline=Spilleren {0} har v\u00c3\u00a6ret offline i {1} +seenOnline=Spilleren {0} har v\u00c3\u00a6ret online i {1} +serverFull=Serveren er sgu fuld. Den b\u00c3\u00b8r melde sig til AA. +setSpawner=\u00c3\u0086ndrede spawner type til {0} +sheepMalformedColor=Forkert farve. (Korrekt oversat?) +shoutFormat=\u00a77[Shout]\u00a7f {0} signFormatFail=\u00a74[{0}] signFormatSuccess=\u00a71[{0}] signFormatTemplate=[{0}] -signProtectInvalidLocation=\u00a74You are not allowed to create sign here. -similarWarpExist=En warp med lignende tekst eksisterer allerede. -slimeMalformedSize=Misdannet st\u00f8rrelse. -soloMob=Den mob kan godt lide at v\u00e6re alene -spawnSet=\u00a77Spawn placering sat for gruppe {0}. +signProtectInvalidLocation=\u00a74Du har ikke tilladelse til at lave et skilt her. +similarWarpExist=En warp med dette navn eksisterer allerede. +slimeMalformedSize=Forkert st\u00f8rrelse. (Korrekt oversat?) +soloMob=Denne mob kan godt lide at v\u00e6re alene. Den hygger sig. +spawnSet=\u00a77Spawnplacering fastsat for gruppe: {0}. spawned=spawnet suicideMessage=\u00a77Farvel grusomme verden... suicideSuccess= \u00a77{0} tog sit eget liv survival=survival -takenFromAccount=\u00a7c{0} er taget fra din konto. -takenFromOthersAccount=\u00a7c{0} er blevet taget fra {1} konto. -teleportAAll=\u00a77Teleporting request sent to all players... -teleportAll=\u00a77Teleportere alle spillere... +takenFromAccount=\u00a7c{0} er blevet taget fra din konto. +takenFromOthersAccount=\u00a7c{0} er blevet taget fra {1}''s konto. +teleportAAll=\u00a77Anmodning om teleport er sendt til alle spillere. +teleportAll=\u00a77Teleporterer alle spillere... teleportAtoB=\u00a77{0}\u00a77 teleporterede dig til {1}\u00a77. -teleportDisabled={0} har teleportation deaktiveret. -teleportHereRequest=\u00a7c{0}\u00a7c har anmodet at du teleportere dig til ham/hende. -teleportNewPlayerError=Failed ved teleportering af ny spiller +teleportDisabled={0} har ikke teleportation aktiveret. +teleportHereRequest=\u00a7c{0}\u00a7c har anmodet om, at du teleporterer dig til ham/hende. +teleportNewPlayerError=Fejlede ved teleportering af ny spiller teleportRequest=\u00a7c{0}\u00a7c har anmodet om at teleportere til dig. -teleportTop=\u00a77Teleportere til toppen. -teleportationCommencing=\u00a77Teleportering begynder... -teleportationDisabled=\u00a77Teleportering deaktiveret. -teleportationEnabled=\u00a77Teleportering aktiveret. -teleporting=\u00a77Teleportere... +teleportTop=\u00a77Teleporterer til toppen. +teleportationCommencing=\u00a77Teleport begynder... +teleportationDisabled=\u00a77Teleport deaktiveret. +teleportationEnabled=\u00a77Teleport aktiveret. +teleporting=\u00a77Teleporterer... teleportingPortal=\u00a77Teleporterede via portal. tempBanned=Midlertidigt bannet fra serveren for {0} -tempbanExempt=\u00a77You may not tempban that player -thunder= Du {0} torden i din verden -thunderDuration=Du {0} torden i din verden i {1} sekunder. -timeBeforeHeal=Tid inden n\u00e6ste helbredelse: {0} -timeBeforeTeleport=Tid f\u00f8r n\u00e6ste teleportering: {0} +tempbanExempt=\u00a77Du m\u00c3\u00a5 ikke tempbanne denne spiller! Slemme, slemme du! +thunder= Du har nu {0} torden i din verden +thunderDuration=Du har nu {0} torden i din verden i {1} sekunder. +timeBeforeHeal=Tid f\u00c3\u00b8r du kan heale igen: {0} +timeBeforeTeleport=Tid f\u00f8r du kan teleportere igen: {0} timeFormat=\u00a73{0}\u00a7f or \u00a73{1}\u00a7f or \u00a73{2}\u00a7f timePattern=(?:([0-9]+)\\s*[a\u00e5y][a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*[wu][a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*[ht][a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? -timeSet=Tid er sat i alle verdener. -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} -tradeCompleted=\u00a77Forhandling fuldf\u00f8rt. -tradeSignEmpty=Forhandlings skiltet har ikke nok forsyning tilbage. -tradeSignEmptyOwner=There is nothing to collect from this trade sign. -treeFailure=\u00a7cTr\u00e6 genererings fejl. Pr\u00f8v igen p\u00e5 gr\u00e6s eller jord. -treeSpawned=\u00a77Tr\u00e6 fremkaldt. +timeSet=Tid \u00c3\u00a6ndret i alle verdener. +timeSetPermission=\u00a7cDu har ikke tilladelse til at \u00c3\u00a6ndre tiden. +timeWorldCurrent=Tiden p\u00c3\u00a5 nuv\u00c3\u00a6rende tidspunkt i {0} er \u00a73{1} +timeWorldSet=Tiden blev \u00c3\u00a6ndret til {0} i: \u00a7c{1} +tradeCompleted=\u00a77Handel gennemf\u00f8rt. +tradeSignEmpty=Handelsskiltet har udsolgt! +tradeSignEmptyOwner=Der er intet at hente ved dette handelsskilt. +treeFailure=\u00a7cTr\u00e6 genereringsfejl. Pr\u00f8v igen p\u00e5 gr\u00e6s eller jord. +treeSpawned=\u00a77Tr\u00e6 spawned. true=true typeTpaccept=\u00a77For at teleportere, skriv \u00a7c/tpaccept\u00a77. -typeTpdeny=\u00a77For at n\u00e6gte denne anmodning, skriv \u00a7c/tpdeny\u00a77. -typeWorldName=\u00a77Du kan ogs\u00e5 skrive nanvet p\u00e5 en specifik verden. -unableToSpawnMob=Kunne ikke fremkalde mob. -unbannedIP=Tilgav IP addresse, ikke l\u00e6ngere bannet. -unbannedPlayer=Tilgav spiller, ikke l\u00e6ngere bannet. -unignorePlayer=Du ignorere ikke spiller {0} mere. -unknownItemId=Ukendt element id: {0} -unknownItemInList=Ukendt element {0} i {1} liste. -unknownItemName=Ukendt element navn: {0} -unlimitedItemPermission=\u00a7cIngen tilladelse til ubegr\u00e6nset element {0}. -unlimitedItems=Uendelige elementer: -unmutedPlayer=Spiller {0} ikke-d\u00e6mpet. -upgradingFilesError=Fejl under opgradering af filer +typeTpdeny=\u00a77For at n\u00e6gte denne anmodning om teleport, skriv \u00a7c/tpdeny\u00a77. +typeWorldName=\u00a77Du kan ogs\u00e5 skrive navnet p\u00e5 en specifik verden. +unableToSpawnMob=Kunne ikke spawne mob. +unbannedIP=Tilgav IP addressen; er ikke l\u00e6ngere bannet. +unbannedPlayer=Tilgav spilleren; er ikke l\u00e6ngere bannet. +unignorePlayer=Du ignorerer ikke spiller {0} mere. +unknownItemId=Ukendt ting id: {0} +unknownItemInList=Ukendt ting {0} i {1} listen. +unknownItemName=Ukendt ting navn: {0} +unlimitedItemPermission=\u00a7cIngen tilladelse til ubegr\u00e6nset ting {0}. +unlimitedItems=Ubegr\u00c3\u00a6nsede ting: +unmutedPlayer=Spilleren {0} unmuted. +upgradingFilesError=Fejl under opgradering af filerne. userDoesNotExist=Brugeren {0} eksisterer ikke. -userIsAway={0} er nu AFK -userIsNotAway={0} er ikke l\u00e6ngere AFK -userJailed=\u00a77Du er blevet f\u00e6ngslet -userUsedPortal={0} brugte en eksisterende udgangs portal. +userIsAway={0} er nu AFK. Skub ham i havet eller bur ham inde! +userIsNotAway={0} er ikke l\u00e6ngere AFK. +userJailed=\u00a77Du er blevet f\u00e6ngslet. +userUsedPortal={0} brugte en eksisterende udgangsportal. userdataMoveBackError=Kunne ikke flytte userdata/{0}.tmp til userdata/{1} userdataMoveError=Kunne ikke flytte userdata/{0} til userdata/{1}.tmp -usingTempFolderForTesting=Bruger temp mappe for testing: -versionMismatch=Version matcher ikke! Venligst opdater {0} til den nyeste version. -versionMismatchAll=Version matcher ikke! Venligst opdater alle Essentials jar''er til samme version. -voiceSilenced=\u00a77Din stemme er blevet d\u00e6mpet -warpDeleteError=Problem ved sletning af warp filen. -warpListPermission=\u00a7cDu har ikke tilladelse til at liste de warps. +usingTempFolderForTesting=Bruger temp-mappe til testing: +versionMismatch=Versioner matcher ikke! Opdater venligst {0} til den nyeste version. +versionMismatchAll=Versioner matcher ikke! Opdater venligst alle Essentials jar-filer til samme version. +voiceSilenced=\u00a77Din stemme er blevet gjort stille. +warpDeleteError=Ah, shit; kunne sgu ikke fjerne warp-filen. Jeg giver en \u00c3\u00b8l i lufthavnen. +warpListPermission=\u00a7cDu har ikke tilladelse til at vise listen over warps. warpNotExist=Den warp eksisterer ikke. warpSet=\u00a77Warp {0} sat. warpUsePermission=\u00a7cDu har ikke tilladelse til at benytte den warp. warpingTo=\u00a77Warper til {0}. warps=Warps: {0} -warpsCount=\u00a77There are {0} warps. Showing page {1} of {2}. -weatherStorm=\u00a77Du har sat vejret til storm i {0} -weatherStormFor=\u00a77Du har sat vejret til storm i {0} i {1} sekunder -weatherSun=\u00a77Du har sat vejret til sol i {0} -weatherSunFor=\u00a77Du har sat vejret til sol i {0} i {1} sekunder +warpsCount=\u00a77Der er {0} warps. Viser side {1} af {2}. +weatherStorm=\u00a77Du har sat vejret til ''storm'' i {0} +weatherStormFor=\u00a77Du har sat vejret til ''storm'' i {0} i {1} sekunder +weatherSun=\u00a77Du har sat vejret til ''sol'' i {0} +weatherSunFor=\u00a77Du har sat vejret til ''sol'' i {0} i {1} sekunder +whoisBanned=\u00a79 - Banned: {0} whoisGamemode=\u00a79 - Gamemode: {0} whoisGeoLocation=\u00a79 - Placering: {0} whoisGod=\u00a79 - God mode: {0} -whoisHealth=\u00a79 - Helbred: {0}/20 -whoisIPAddress=\u00a79 - IP Addresse: {0} +whoisHealth=\u00a79 - Health: {0}/20 +whoisIPAddress=\u00a79 - IP-Adresse: {0} whoisIs={0} er {1} whoisLocation=\u00a79 - Placering: ({0}, {1}, {2}, {3}) -whoisMoney=\u00a79 - Penge: {0} +whoisMoney=\u00a79 - Saldo: {0} whoisOP=\u00a79 - OP: {0} whoisStatusAvailable=\u00a79 - Status: Tilg\u00e6ngelig -whoisStatusAway=\u00a79 - Status: \u00a7cV\u00e6k\u00a7f -worth=\u00a77Stak af {0} v\u00e6rd \u00a7c{1}\u00a77 ({2} element(er) for {3} hver) -worthMeta=\u00a77Stak af {0} med metadata af {1} v\u00e6rd \u00a7c{2}\u00a77 ({3} element(er) for {4} hver) -worthSet=V\u00e6rd v\u00e6rdi sat +whoisStatusAway=\u00a79 - Status: \u00a7cAFK\u00a7f +worth=\u00a77Stack af {0} er v\u00e6rd \u00a7c{1}\u00a77 ({2} ting for {3} pr. stk.) +worthMeta=\u00a77Stack af {0} med metadata af {1} er v\u00e6rd \u00a7c{2}\u00a77 ({3} ting for {4} pr. stk.) +worthSet=V\u00e6rdi \u00c3\u00a6ndret. year=\u00e5r years=\u00e5r -youAreHealed=\u00a77Du er blevet helbredt. -youHaveNewMail=\u00a7cDu har {0} beskeder!\u00a7f Type \u00a77/post l\u00e6s\u00a7f for at se din post. +youAreHealed=\u00a77Du er blevet healed. Halleluja! +youHaveNewMail=\u00a7cDu har {0} flaskeposter!\u00a7f Type \u00a77/mail read for at se din flaskepost. diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 9cc72bff2..5de616099 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -15,7 +15,7 @@ backUsageMsg=\u00a77Kehre zur letzten Position zur\u00fcck. backupFinished=Backup beendet backupStarted=Backup gestartet balance=\u00a77Geldb\u00f6rse: {0} -balanceTop=\u00a77 Top {0} Guthaben +balanceTop=\u00a77 Top Guthaben ({0}) banExempt=\u00a7cDu kannst diesen Spieler nicht sperren. banIpAddress=\u00a77IP-Adresse gesperrt. bannedIpsFileError=Fehler beim Lesen von banned-ips.txt @@ -24,6 +24,7 @@ bannedPlayersFileError=Fehler beim Lesen von banned-players.txt bannedPlayersFileNotFound=banned-players.txt nicht gefunden bigTreeFailure=\u00a7cFehler beim Pflanzen eines grossen Baums. Versuch es auf Gras oder Dreck. bigTreeSuccess= \u00a77Grosser Baum gepflanzt. +blockList=Essentials blocked the following commands, due to command conflicts: broadcast=[\u00a7cRundruf\u00a7f]\u00a7a {0} buildAlert=\u00a7cDu hast keine Rechte zum Bauen. bukkitFormatChanged=Bukkit-Versionsformat hat sich ge\u00e4ndert. Version nicht kontrolliert. @@ -63,6 +64,7 @@ depthBelowSea=\u00a77Du bist {0} Bl\u00f6cke unter Meeresh\u00f6he. destinationNotSet=Ziel nicht gesetzt disableUnlimited=\u00a77Deaktiviere unendliches Platzieren von {0} f\u00fcr {1}. disabled=deaktiviert +disabledToSpawnMob=Spawning this mob was disabled in the config file. dontMoveMessage=\u00a77Teleportvorgang startet in {0}. Beweg dich nicht. downloadingGeoIp=Lade GeoIP-Datenbank ... dies kann etwas dauern (country: 0.6 MB, city: 20MB) duplicatedUserdata=Doppelte Datei in userdata: {0} und {1} @@ -75,6 +77,8 @@ enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item enchantments = \u00a77Enchantments: {0} errorCallingCommand=Fehler beim Aufrufen des Befehls /{0} errorWithMessage=\u00a7cFehler: {0} +essentialsHelp1=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, go to http://tiny.cc/EssentialsChat +essentialsHelp2=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, either type /essentialshelp in game or go to http://tiny.cc/EssentialsChat essentialsReload=\u00a77Essentials neu geladen {0} extinguish=\u00a77Du hast dich selbst gel\u00f6scht. extinguishOthers=\u00a77Du hast {0} gel\u00f6scht. @@ -82,6 +86,8 @@ failedToCloseConfig=Fehler beim Schliessen der Konfiguration {0} failedToCreateConfig=Fehler beim Erstellen der Konfiguration {0} failedToWriteConfig=Fehler beim Schreiben der Konfiguration {0} false=false +feed=\u00a77Your appetite was sated. +feedOther=\u00a77Satisfied {0}. fileRenameError=Umbenennen von {0} gescheitert. foreverAlone=\u00a7cDu hast niemanden, dem du antworten kannst. freedMemory={0} MB frei gemacht. @@ -149,8 +155,8 @@ jumpError=Das w\u00fcrde deinen Computer \u00fcberlasten. kickDefault=Vom Server geworfen kickExempt=\u00a7cDu kannst diesen Spieler nicht rauswerfen. kill=\u00a77{0} get\u00f6tet. -kitError=\u00a7cEs gibt keine g\u00fcltigen Ausr\u00fcstungen. kitError2=\u00a7cDiese Ausr\u00fcstung existiert nicht oder ist ung\u00fcltig. +kitError=\u00a7cEs gibt keine g\u00fcltigen Ausr\u00fcstungen. kitErrorHelp=\u00a7cEventuell fehlt bei einem Gegenstand die Menge? kitGive=\u00a77Gebe Ausr\u00fcstung {0}. kitInvFull=\u00a7cDein Inventar ist voll, lege Ausr\u00fcstung auf den Boden @@ -193,6 +199,7 @@ muteExempt=\u00a7cDu darfst diesen Spieler nicht stumm machen. mutedPlayer=Player {0} ist nun stumm. mutedPlayerFor=Player {0} ist nun stumm f\u00fcr {1}. mutedUserSpeaks={0} versuchte zu sprechen, aber ist stumm geschaltet. +nearbyPlayers=Players nearby: {0} needTpohere=Du brauchst Zugriff auf /tpohere um andere Spieler teleportieren zu k\u00f6nnen. negativeBalanceError=Spieler darf keine Schulden machen. nickChanged=Nickname ge\u00e4ndert. @@ -212,10 +219,11 @@ noHomeSetPlayer=Spieler hat kein Zuhause gesetzt. noKitPermission=\u00a7cDu brauchst die Berechtigung \u00a7c{0}\u00a7c um diese Ausr\u00fcstung anzufordern. noKits=\u00a77Es sind keine Ausr\u00fcstungen verf\u00fcgbar. noMail=Du hast keine Nachrichten -noMailSendPerm=\u00a7cDu hast die Rechte \u00a7fessentials.mail.send\u00a7c nicht. noMotd=\u00a7cEs existiert keine Willkommensnachricht. noNewMail=\u00a77Du hast keine Nachrichten. noPendingRequest=Du hast keine Teleportierungsanfragen. +noPerm=\u00a7cDu hast die Rechte \u00a7f{0}\u00a7c nicht. +noPermToSpawnMob=\u00a7cYou don''t have permission to spawn this mob. noPlacePermission=\u00a7cDu hast keine Rechte, einen Block in der N\u00e4he des Schildes zu platzieren. noPowerTools=Du hast keine Powertools zugewiesen. noRules=\u00a7cEs wurden keine Regeln definiert. @@ -223,6 +231,7 @@ noWarpsDefined=Keine Warp-Punkte erstellt. none=keine notAllowedToQuestion=\u00a7cDu bist nicht berechtigt zu fragen. notAllowedToShout=\u00a7cDu bist nicht berechtigt zu schreien. +notEnoughExperience=You do not have enough experience. notEnoughMoney=Du hast nicht genug Geld. notRecommendedBukkit=Die verwendete Bukkit-Version ist nicht f\u00fcr Essentials empfohlen. notSupportedYet=Noch nicht verf\u00fcgbar. @@ -271,8 +280,10 @@ protectionOwner=\u00a76[EssentialsProtect] Besitzer dieses Blocks: {0} questionFormat=\u00a77[Frage]\u00a7f {0} readNextPage=Type /{0} {1} to read the next page reloadAllPlugins=\u00a77Alle plugins neu geladen. +removed=\u00a77Removed {0} entities. repair=Du hast erfolgreich deine {0} repariert. repairAlreadyFixed=\u00a77Dieser Gegenstand ben\u00f6tigt keine Reparatur. +repairEnchanted=\u00a77You are not allowed to repair enchanted items. repairInvalidType=\u00a7cDieser Gegenstand kann nicht repariert werden. repairNone=Es sind keine Gegenst\u00e4nde vorhanden, die repariert werden k\u00f6nnen. requestAccepted=\u00a77Teleportierungsanfrage akzeptiert. @@ -280,6 +291,7 @@ requestAcceptedFrom=\u00a77{0} hat deine Teleportierungsanfrage angenommen. requestDenied=\u00a77Teleportierungsanfrage verweigert. requestDeniedFrom=\u00a77{0} hat deine Teleportierungsanfrage abgelehnt. requestSent=\u00a77Anfrage gesendet an {0}\u00a77. +requiredBukkit=You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. returnPlayerToJailError=Fehler beim Versuch, den Spieler ins Gef\u00e4ngnis zu teleportieren. second=Sekunde seconds=Sekunden @@ -371,6 +383,7 @@ weatherStorm=\u00a77In {0} st\u00fcrmt es nun. weatherStormFor=\u00a77In {0} st\u00fcrmt es nun f\u00fcr {1} Sekunden. weatherSun=\u00a77In {0} scheint nun die Sonne. weatherSunFor=\u00a77In {0} scheint nun f\u00fcr {1} Sekunden die Sonne. +whoisBanned=\u00a79 - Banned: {0} whoisGamemode=\u00a79 - Gamemode: {0} whoisGeoLocation=\u00a79 - Herkunft: {0} whoisGod=\u00a79 - God mode: {0} diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 704cdfb68..72d095524 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -15,7 +15,7 @@ backUsageMsg=\u00a77Returning to previous location. backupFinished=Backup finished backupStarted=Backup started balance=\u00a77Balance: {0} -balanceTop=\u00a77 Top {0} balances +balanceTop=\u00a77 Top balances ({0}) banExempt=\u00a7cYou can not ban that player. banIpAddress=\u00a77Banned IP address bannedIpsFileError=Error reading banned-ips.txt @@ -24,6 +24,7 @@ bannedPlayersFileError=Error reading banned-players.txt bannedPlayersFileNotFound=banned-players.txt not found bigTreeFailure=\u00a7cBig tree generation failure. Try again on grass or dirt. bigTreeSuccess= \u00a77Big tree spawned. +blockList=Essentials blocked the following commands, due to command conflicts: broadcast=[\u00a7cBroadcast\u00a7f]\u00a7a {0} buildAlert=\u00a7cYou are not permitted to build bukkitFormatChanged=Bukkit version format changed. Version not checked. @@ -63,6 +64,7 @@ depthBelowSea=\u00a77You are {0} block(s) below sea level. destinationNotSet=Destination not set disableUnlimited=\u00a77Disabled unlimited placing of {0} for {1}. disabled=disabled +disabledToSpawnMob=Spawning this mob was disabled in the config file. dontMoveMessage=\u00a77Teleportation will commence in {0}. Don''t move. downloadingGeoIp=Downloading GeoIP database ... this might take a while (country: 0.6 MB, city: 20MB) duplicatedUserdata=Duplicated userdata: {0} and {1} @@ -75,6 +77,8 @@ enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item enchantments = \u00a77Enchantments: {0} errorCallingCommand=Error calling command /{0} errorWithMessage=\u00a7cError: {0} +essentialsHelp1=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, go to http://tiny.cc/EssentialsChat +essentialsHelp2=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, either type /essentialshelp in game or go to http://tiny.cc/EssentialsChat essentialsReload=\u00a77Essentials Reloaded {0} extinguish=\u00a77You extinguished yourself. extinguishOthers=\u00a77You extinguished {0}. @@ -82,6 +86,8 @@ failedToCloseConfig=Failed to close config {0} failedToCreateConfig=Failed to create config {0} failedToWriteConfig=Failed to write config {0} false=false +feed=\u00a77Your appetite was sated. +feedOther=\u00a77Satisfied {0}. fileRenameError=Renaming file {0} failed foreverAlone=\u00a7cYou have nobody to whom you can reply. freedMemory=Freed {0} MB. @@ -149,8 +155,8 @@ jumpError=That would hurt your computer''s brain. kickDefault=Kicked from server kickExempt=\u00a7cYou can not kick that person. kill=\u00a77Killed {0}. -kitError=\u00a7cThere are no valid kits. kitError2=\u00a7cThat kit does not exist or is improperly defined. +kitError=\u00a7cThere are no valid kits. kitErrorHelp=\u00a7cPerhaps an item is missing a quantity in the configuration? kitGive=\u00a77Giving kit {0}. kitInvFull=\u00a7cYour inventory was full, placing kit on the floor @@ -193,6 +199,7 @@ muteExempt=\u00a7cYou may not mute that player. mutedPlayer=Player {0} muted. mutedPlayerFor=Player {0} muted for {1}. mutedUserSpeaks={0} tried to speak, but is muted. +nearbyPlayers=Players nearby: {0} needTpohere=You need access to /tpohere to teleport other players. negativeBalanceError=User is not allowed to have a negative balance. nickChanged=Nickname changed. @@ -212,10 +219,11 @@ noHomeSetPlayer=Player has not set a home. noKitPermission=\u00a7cYou need the \u00a7c{0}\u00a7c permission to use that kit. noKits=\u00a77There are no kits available yet noMail=You do not have any mail -noMailSendPerm=\u00a7cYou do not have the \u00a7fessentials.mail.send\u00a7c permission. noMotd=\u00a7cThere is no message of the day. noNewMail=\u00a77You have no new mail. noPendingRequest=You do not have a pending request. +noPerm=\u00a7cYou do not have the \u00a7f{0}\u00a7c permission. +noPermToSpawnMob=\u00a7cYou don''t have permission to spawn this mob. noPlacePermission=\u00a7cYou do not have permission to place a block near that sign. noPowerTools=You have no power tools assigned. noRules=\u00a7cThere are no rules specified yet. @@ -223,6 +231,7 @@ noWarpsDefined=No warps defined none=none notAllowedToQuestion=\u00a7cYou are not authorized to use question. notAllowedToShout=\u00a7cYou are not authorized to shout. +notEnoughExperience=You do not have enough experience. notEnoughMoney=You do not have sufficient funds. notRecommendedBukkit=Bukkit version is not the recommended build for Essentials. notSupportedYet=Not supported yet. @@ -271,8 +280,10 @@ protectionOwner=\u00a76[EssentialsProtect] Protection owner: {0} questionFormat=\u00a77[Question]\u00a7f {0} readNextPage=Type /{0} {1} to read the next page reloadAllPlugins=\u00a77Reloaded all plugins. +removed=\u00a77Removed {0} entities. repair=You have successfully repaired your: \u00a7e{0}. repairAlreadyFixed=\u00a77This item does not need repairing. +repairEnchanted=\u00a77You are not allowed to repair enchanted items. repairInvalidType=\u00a7cThis item cannot be repaired. repairNone=There were no items that needing repairing. requestAccepted=\u00a77Teleport request accepted. @@ -280,6 +291,7 @@ requestAcceptedFrom=\u00a77{0} accepted your teleport request. requestDenied=\u00a77Teleport request denied. requestDeniedFrom=\u00a77{0} denied your teleport request requestSent=\u00a77Request sent to {0}\u00a77. +requiredBukkit=You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. returnPlayerToJailError=Error occurred when trying to return player to jail. second=second seconds=seconds @@ -371,6 +383,7 @@ weatherStorm=\u00a77You set the weather to storm in {0} weatherStormFor=\u00a77You set the weather to storm in {0} for {1} seconds weatherSun=\u00a77You set the weather to sun in {0} weatherSunFor=\u00a77You set the weather to sun in {0} for {1} seconds +whoisBanned=\u00a79 - Banned: {0} whoisGamemode=\u00a79 - Gamemode: {0} whoisGeoLocation=\u00a79 - Location: {0} whoisGod=\u00a79 - God mode: {0} diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index c2d6b6ec3..fc6b13eb1 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -15,7 +15,7 @@ backUsageMsg=\u00a77Volviendo a la localizacion anterior. backupFinished=Copia de seguridad completada backupStarted=Comenzando copia de seguridad balance=\u00a77Cantidad: {0} -balanceTop=\u00a77Top {0} cantidades +balanceTop=\u00a77Top cantidades ({0}) banExempt=\u00a7cNo puedes banear a ese jugador banIpAddress=\u00a77Direccion IP baneada bannedIpsFileError=Error leyendo banned-ips.txt @@ -24,6 +24,7 @@ bannedPlayersFileError=Error leyendo banned-players.txt bannedPlayersFileNotFound=banned-players.txt no encontrado bigTreeFailure=\u00a7cBig Generacion de arbol fallida. Prueba de nuevo en hierba o arena. bigTreeSuccess= \u00a77Big Arbol generado. +blockList=Essentials blocked the following commands, due to command conflicts: broadcast=[\u00a7cBroadcast\u00a7f]\u00a7a {0} buildAlert=\u00a7cNo tienes permisos para construir bukkitFormatChanged=Version de formato de Bukkit cambiado. Version no comprobada. @@ -63,6 +64,7 @@ depthBelowSea=\u00a77Estas {0} bloque(s) por debajo del mar. destinationNotSet=Destino no establecido. disableUnlimited=\u00a77Desactivando colocacion ilimitada de {0} para {1}. disabled=desactivado +disabledToSpawnMob=Spawning this mob was disabled in the config file. dontMoveMessage=\u00a77Teletransporte comenzara en {0}. No te muevas. downloadingGeoIp=Descargando base de datos de GeoIP ... puede llevar un tiempo (pais: 0.6 MB, ciudad: 20MB) duplicatedUserdata=Datos de usuario duplicados: {0} y {1} @@ -75,6 +77,8 @@ enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item enchantments = \u00a77Enchantments: {0} errorCallingCommand=Error al ejecutar el comando /{0} errorWithMessage=\u00a7cError: {0} +essentialsHelp1=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, go to http://tiny.cc/EssentialsChat +essentialsHelp2=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, either type /essentialshelp in game or go to http://tiny.cc/EssentialsChat essentialsReload=\u00a77Essentials Recargado {0} extinguish=\u00a77Te has suicidado. extinguishOthers=\u00a77Has matado a {0}. @@ -82,6 +86,8 @@ failedToCloseConfig=Error al cerrar configuracion {0} failedToCreateConfig=Error al crear configuracion {0} failedToWriteConfig=Error al escribir configuracion {0} false=false +feed=\u00a77Your appetite was sated. +feedOther=\u00a77Satisfied {0}. fileRenameError=Error al renombrar el archivo {0} foreverAlone=\u00a7cNo tienes nadie a quien puedas responder. freedMemory= {0} MB libres. @@ -149,8 +155,8 @@ jumpError=Eso es demasiado para tu ordenador! kickDefault=Echado del servidor. kickExempt=\u00a7cNo puedes echar a esa persona. kill=\u00a77ha matado a {0}. -kitError=\u00a7cNo hay ningun kit valido. kitError2=\u00a7cEse kit no existe o esta mal escrito. +kitError=\u00a7cNo hay ningun kit valido. kitErrorHelp=\u00a7cPerhaps an item is missing a quantity in the configuration? kitGive=\u00a77Dando kit a {0}. kitInvFull=\u00a7cTu inventario esta lleno, su kit se pondra en el suelo @@ -193,6 +199,7 @@ muteExempt=\u00a7cNo puedes silenciar a ese jugador. mutedPlayer=Player {0} silenciado. mutedPlayerFor=Player {0} silenciado durante {1}. mutedUserSpeaks={0} intento hablar, pero esta silenciado. +nearbyPlayers=Players nearby: {0} needTpohere=Necesitas acceso a /tpohere para teletransportar a otros jugadores. negativeBalanceError=El usuario no tiene permitido tener un saldo negativo. nickChanged=Nombre de jugador cambiado. @@ -212,10 +219,11 @@ noHomeSetPlayer=El jugador no ha establecido un hogar. noKitPermission=\u00a7cNecesitas los \u00a7c{0}\u00a7c permisos para usar ese kit. noKits=\u00a77No hay kits disponibles todavia noMail=No tienes ningun email recivido -noMailSendPerm=\u00a7cNo tienes el permiso de \u00a7fessentials.mail.send\u00a7c. noMotd=\u00a7cNo hay ningun mensaje del dia. noNewMail=\u00a77No tienes ningun correo nuevo. noPendingRequest=No tienes ninguna peticion pendiente. +noPerm=\u00a7cNo tienes el permiso de \u00a7f{0}\u00a7c. +noPermToSpawnMob=\u00a7cYou don''t have permission to spawn this mob. noPlacePermission=\u00a7cNo tienes permiso para situar ese bloque en ese lugar. noPowerTools=You have no power tools assigned. noRules=\u00a7cNo hay reglas especificadas todavia. @@ -223,6 +231,7 @@ noWarpsDefined=No hay teletransportes definidos aun none=ninguno notAllowedToQuestion=\u00a7cYou estas autorizado para usar las preguntas. notAllowedToShout=\u00a7cNo estas autorizado para gritar. +notEnoughExperience=You do not have enough experience. 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. @@ -271,8 +280,10 @@ protectionOwner=\u00a76[EssentialsProtect] Dueño de la proteccion: {0} questionFormat=\u00a77[Pregunta]\u00a7f {0} readNextPage=Type /{0} {1} to read the next page reloadAllPlugins=\u00a77Todos los plugins recargados. +removed=\u00a77Removed {0} entities. repair=Has reparado satisfactoriamente tu: \u00a7e{0}. repairAlreadyFixed=\u00a77Este objeto no necesita de reparado. +repairEnchanted=\u00a77You are not allowed to repair enchanted items. repairInvalidType=\u00a7cEste objeto no puede ser reparado. repairNone=No habia objetos que necesitasen ser reparados. requestAccepted=\u00a77Peticion de teletransporte aceptada. @@ -280,6 +291,7 @@ requestAcceptedFrom=\u00a77{0} acepto tu peticion de teletransporte. requestDenied=\u00a77Peticion de teletransporte denegada. requestDeniedFrom=\u00a77{0} ha denegado tu peticion de teletransporte. requestSent=\u00a77Peticion enviada a {0}\u00a77. +requiredBukkit=You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. returnPlayerToJailError=Error al intentar quitar al jugador de la carcel. second=segundo seconds=segundos @@ -371,6 +383,7 @@ weatherStorm=\u00a77Has establecido el tiempo a tormenta en este mundo. weatherStormFor=\u00a77Has establecido el tiempo a tormenta en este {1} durante {0} segundos. weatherSun=\u00a77Has establecido el tiempo a sol en este mundo. weatherSunFor=\u00a77Has establecido el tiempo a sol en este {1} durante {0} segundos. +whoisBanned=\u00a79 - Banned: {0} whoisGamemode=\u00a79 - Gamemode: {0} whoisGeoLocation=\u00a79 - Localizacion: {0} whoisGod=\u00a79 - God mode: {0} diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index ae8845bc6..97e87b14b 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -15,7 +15,7 @@ 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 +balanceTop=\u00a77 Meilleurs soldes ({0}) banExempt=\u00a77Vous ne pouvez pas bannir ce joueur. banIpAddress=\u00a77Adresse IP bannie bannedIpsFileError=Erreur de lecture de banned-ips.txt @@ -24,6 +24,7 @@ bannedPlayersFileError=Erreur lors de la lecture de banned-players.txt bannedPlayersFileNotFound=banned-players.txt introuvable. bigTreeFailure=\u00a7c\u00c9chec de la g\u00e9n\u00e9ration du gros arbre. Essayez de nouveau sur de la terre ou de l''herbe. bigTreeSuccess=\u00a77Gros arbre cr\u00e9e. +blockList=Essentials blocked the following commands, due to command conflicts: broadcast=[\u00a7cMessage\u00a7f]\u00a7a {0} buildAlert=\u00a7cVous n''avez pas la permission de construire. bukkitFormatChanged=Le format de la version de Bukkit a \u00e9t\u00e9 chang\u00e9. La version n''a pas \u00e9t\u00e9 v\u00e9rifi\u00e9e. @@ -63,6 +64,7 @@ depthBelowSea=\u00a77Vous \u00eates \u00e0 {0} bloc(s) en-dessous du niveau de l destinationNotSet=Destination non d\u00e9finie disableUnlimited=\u00a77D\u00e9sactivation du placement illimit\u00e9 de {0} pour {1}. disabled=d\u00e9sactiv\u00e9 +disabledToSpawnMob=Spawning this mob was disabled in the config file. 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} @@ -75,6 +77,8 @@ enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item enchantments = \u00a77Enchantments : {0} errorCallingCommand=Erreur en appelant la commande /{0} errorWithMessage=\u00a7cErreur : {0} +essentialsHelp1=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, go to http://tiny.cc/EssentialsChat +essentialsHelp2=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, either type /essentialshelp in game or go to http://tiny.cc/EssentialsChat essentialsReload=\u00a77Essentials Recharg\u00e9 {0} extinguish=\u00a77Vous cessez de br\u00fbler. extinguishOthers=\u00a77Vous avez \u00e9teint la combustion de {0}. @@ -82,6 +86,8 @@ 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=faux +feed=\u00a77Your appetite was sated. +feedOther=\u00a77Satisfied {0}. fileRenameError=Echec du changement de nom de {0} foreverAlone=\u00a7cVous n''avez personne \u00e0 qui r\u00e9pondre freedMemory=A lib\u00e9r\u00e9 {0} Mo. @@ -149,8 +155,8 @@ jumpError=\u00c7a aurait pu faire mal au cerveau de votre ordinateur. kickDefault=Kick\u00e9 du serveur 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. +kitError=\u00a7cIl n''y a pas de kits valides. 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. @@ -193,6 +199,7 @@ muteExempt=\u00a7cVous ne pouvez pas r\u00e9duire ce joueur au silence. mutedPlayer=Le joueur {0} est d\u00e9sormais muet. mutedPlayerFor={0} a \u00e9t\u00e9 muet pour {1}. mutedUserSpeaks={0} a essay\u00e9 de parler mais est muet. +nearbyPlayers=Players nearby: {0} 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=surnom modifi\u00e9. @@ -212,10 +219,11 @@ 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 -noMailSendPerm=\u00a7cVous n''avez pas la permission \u00a7fessentials.mail.send\u00a7c. 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. +noPerm=\u00a7cVous n''avez pas la permission \u00a7f{0}\u00a7c. +noPermToSpawnMob=\u00a7cYou don''t have permission to spawn this mob. 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. @@ -223,6 +231,7 @@ 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. +notEnoughExperience=You do not have enough experience. 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. @@ -271,8 +280,10 @@ protectionOwner=\u00a76[EssentialsProtect] Propri\u00e9taire de la protection : questionFormat=\u00a77[Question]\u00a7f {0} readNextPage=Type /{0} {1} to read the next page reloadAllPlugins=\u00a77Toutes les extensions ont \u00e9t\u00e9 recharg\u00e9es. +removed=\u00a77Removed {0} entities. repair=Vous avez r\u00e9par\u00e9 votre : \u00a7e{0}. repairAlreadyFixed=\u00a77Cet objet n''a pas besoin de r\u00e9paration. +repairEnchanted=\u00a77You are not allowed to repair enchanted items. 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. @@ -280,6 +291,7 @@ requestAcceptedFrom=\u00a77{0} a accept\u00e9 votre demande de t\u00e9l\u00e9por requestDenied=\u00a77Demande de t\u00e9l\u00e9portation refus\u00e9e. requestDeniedFrom=\u00a77{0} a refus\u00e9 votre demande de t\u00e9l\u00e9portation. requestSent=\u00a77Requ\u00eate envoy\u00e9e \u00e0 {0}\u00a77. +requiredBukkit=You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. returnPlayerToJailError=Erreur survenue lors de la tentative d''emprisonner de nouveau un joueur. second=seconde seconds=secondes @@ -371,6 +383,7 @@ 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. +whoisBanned=\u00a79 - Banned: {0} whoisGamemode=\u00a79 - Mode de jeu : {0} whoisGeoLocation=\u00a79 - Emplacement : {0} whoisGod=\u00a79 - Mode Dieu : {0} @@ -388,4 +401,4 @@ 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.
\ No newline at end of file +youHaveNewMail=\u00a7cVous avez {0} messages ! \u00a7fEntrez \u00a77/mail read\u00a7f pour voir votre courrier. diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 73a88cbb5..c92952adb 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -15,7 +15,7 @@ backUsageMsg=\u00a77Naar de vorige locatie aan het gaan. backupFinished=Backup voltooid backupStarted=Backup gestart balance=\u00a77Saldo: {0} -balanceTop=\u00a77 Top {0} saldi +balanceTop=\u00a77 Top saldi ({0}) banExempt=\u00a77Je kunt deze speler niet verbannen. banIpAddress=\u00a77Verbannen IP-adres bannedIpsFileError=Fout bij het lezen van banned-ips.txt @@ -24,6 +24,7 @@ bannedPlayersFileError=Fout bij het lezen van banned-players.txt bannedPlayersFileNotFound=banned-players.txt werd niet gevonden bigTreeFailure=\u00a7cMaken van een grote boom is mislukt. Probeer het opnieuw op gras of dirt. bigTreeSuccess= \u00a77Grote boom gemaakt. +blockList=Essentials blocked the following commands, due to command conflicts: broadcast=[\u00a7cBroadcast\u00a7f]\u00a7a {0} buildAlert=\u00a7cJe bent niet bevoegd om te bouwen bukkitFormatChanged=Bukkit versie formaat veranderd. Versie niet nagekeken. @@ -63,6 +64,7 @@ depthBelowSea=\u00a77Je zit {0} blok(ken) onder zeeniveau. destinationNotSet=Bestemming niet ingesteld disableUnlimited=\u00a77Oneindig plaatsen van {0} uitgeschakeld voor {1}. disabled=uitgeschakeld +disabledToSpawnMob=Spawning this mob was disabled in the config file. dontMoveMessage=\u00a77Beginnen met teleporteren in {0}. Niet bewegen. downloadingGeoIp=Bezig met downloaden van GeoIP database ... Dit kan een tijdje duren (country: 0.6 MB, city: 20MB) duplicatedUserdata=Dubbele userdata: {0} en {1}. @@ -75,6 +77,8 @@ enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item enchantments = \u00a77Enchantments: {0} errorCallingCommand=Fout bij het aanroepen van de opdracht /{0} errorWithMessage=\u00a7cFout: {0} +essentialsHelp1=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, go to http://tiny.cc/EssentialsChat +essentialsHelp2=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, either type /essentialshelp in game or go to http://tiny.cc/EssentialsChat essentialsReload=\u00a77Essentials is herladen {0} extinguish=\u00a77Je hebt jezelf geblust. extinguishOthers=\u00a77Je hebt {0} geblust. @@ -82,6 +86,8 @@ failedToCloseConfig=Fout bij het sluiten van config {0} failedToCreateConfig=Fout tijdens het aanmaken van config {0} failedToWriteConfig=Fout bij het cre\u00ebren van config {0} false=false +feed=\u00a77Your appetite was sated. +feedOther=\u00a77Satisfied {0}. fileRenameError=Hernoemen van {0} mislukt foreverAlone=\u00a7cJe hebt niemand waarnaar je kan reageren. freedMemory={0} MB gelost. @@ -149,8 +155,8 @@ jumpError=Dat zou je computers hersenen beschadigen. kickDefault=Gekicked van de server kickExempt=\u00a77Je kunt die speler niet schoppen. kill=\u00a77Jij doodde {0}. -kitError=\u00a7cEr zijn geen geldige kits. kitError2=\u00a7cDie kit bestaat niet of is verkeerde beschreven. +kitError=\u00a7cEr zijn geen geldige kits. kitErrorHelp=\u00a7cMisschien mist er een hoeveelheid van het item in de configuratie? kitGive=\u00a77Kit {0} wordt gegeven. kitInvFull=\u00a7cJe inventory was vol, de kit wordt op de grond geplaatst @@ -193,6 +199,7 @@ muteExempt=\u00a7cJe kan deze speler niet muten. mutedPlayer=Speler {0} gemute. mutedPlayerFor=Speler {0} is gemute voor {1}. mutedUserSpeaks={0} probeerde te praten, maar is gemute. +nearbyPlayers=Players nearby: {0} needTpohere=Je moet toegang krijgen tot /tpohere om naar andere spelers te teleporteren. negativeBalanceError=Speler is niet toegestaan om een negatief saldo te hebben. nickChanged=Nickname veranderd. @@ -212,10 +219,11 @@ noHomeSetPlayer=Speler heeft geen home. noKitPermission=\u00a7cJe hebt de \u00a7c{0}\u00a7c toestemming nodig om die kit te gebruiken. noKits=\u00a77Er zijn nog geen kits beschikbaar noMail=Je hebt geen berichten -noMailSendPerm=\u00a7cJe hebt de \u00a7fessentials.mail.send\u00a7c toestemming niet. noMotd=\u00a7cEr is geen bericht van de dag. noNewMail=\u00a77Je hebt geen nieuwe berichten. noPendingRequest=Je hebt geen aanvragen. +noPerm=\u00a7cJe hebt de \u00a7f{0}\u00a7c toestemming niet. +noPermToSpawnMob=\u00a7cYou don''t have permission to spawn this mob. noPlacePermission=\u00a7cJe hebt geen toestemming om een blok naast die sign te plaatsen. noPowerTools=You have no power tools assigned. noRules=\u00a7cEr zijn nog geen regels gegeven. @@ -223,6 +231,7 @@ noWarpsDefined=Geen warps gedefinieerd none=geen notAllowedToQuestion=\u00a7cJe bent niet bevoegd om de vraag functie te gebruiken. notAllowedToShout=\u00a7cJe bent niet bevoegd om de roep functie te gebruiken. +notEnoughExperience=You do not have enough experience. notEnoughMoney=Je hebt niet voldoende middelen. notRecommendedBukkit=De Bukkit versie is niet de aangeraden build voor Essentials. notSupportedYet=Nog niet ondersteund. @@ -271,8 +280,10 @@ protectionOwner=\u00a76[EssentialsProtect] Beschermingeigenaar: {0} questionFormat=\u00a77[Vraag]\u00a7f {0} readNextPage=Type /{0} {1} to read the next page reloadAllPlugins=\u00a77Alle plugins zijn herladen. +removed=\u00a77Removed {0} entities. repair=You have successfully repaired your: \u00a7e{0}. repairAlreadyFixed=\u00a77This item does not need repairing. +repairEnchanted=\u00a77You are not allowed to repair enchanted items. repairInvalidType=\u00a7cThis item cannot be repaired. repairNone=There were no items that needing repairing. requestAccepted=\u00a77Teleporteer aanvraag geaccepteerd. @@ -280,6 +291,7 @@ requestAcceptedFrom=\u00a77{0} accepted your teleport request. requestDenied=\u00a77Teleporteer aanvraag geweigerd. requestDeniedFrom=\u00a77{0} denied your teleport request. requestSent=\u00a77Aanvraag verstuurd naar {0}\u00a77. +requiredBukkit=You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. returnPlayerToJailError=Fout opgetreden bij terugzetten van speler in gevangenis. second=seconde seconds=seconde @@ -371,6 +383,7 @@ weatherStorm=\u00a77Je hebt het weer naar storm gezet in de {0} weatherStormFor=\u00a77Je hebt het weer in de {0} naar storm gezet voor {1} seconde weatherSun=\u00a77Je hebt het weer naar zon gezet in de {0} weatherSunFor=\u00a77Je hebt het weer in de {0} naar zon gezet voor {1} seconde +whoisBanned=\u00a79 - Banned: {0} whoisGamemode=\u00a79 - Gamemode: {0} whoisGeoLocation=\u00a79 - Locatie: {0} whoisGod=\u00a79 - God mode: {0} diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index 55b7a1c1b..275501ab5 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -28,8 +28,8 @@ commands: usage: /<command> [player] aliases: [bal,emoney,ebalance,ebal] balancetop: - description: Gets the top x balance values. (max 10) - usage: /<command> <max> + description: Gets the top balance values. + usage: /<command> <page> aliases: [baltop,ebaltop,ebalancetop] ban: description: Bans a player. @@ -39,6 +39,10 @@ commands: description: Bans an IP address. usage: /<command> <address> aliases: [ebanip] + break: + description: Breaks the block you are looking at. + usage: /<command> + aliases: [ebreak] broadcast: description: Broadcasts a message to the entire server. usage: /<command> <msg> @@ -51,6 +55,10 @@ commands: description: Set a player on fire. usage: /<command> <player> <seconds> aliases: [eburn] + butcher: + description: Kill all mobs in a world. + usage: /<command> <mobType> <radius> + aliases: [ebutcher] clearinventory: description: Clear all items in your inventory. usage: /<command> @@ -82,7 +90,7 @@ commands: enchant: description: Enchants the item the user is holding. usage: /<command> <enchantmentname> [level] - aliases: [enchantment] + aliases: [enchantment,eenchant,eenchantment] essentials: description: Reloads essentials. usage: /<command> @@ -90,6 +98,14 @@ commands: description: Extinguish players. usage: /<command> [player] aliases: [extinguish,eext,eextinguish] + feed: + description: Satisfy the hunger. + usage: /<command> [player] + aliases: [efeed] + itemdb: + description: Searches for an item. + usage: /<command> <item> + aliases: [eitemdb] fireball: description: Throw a fireball. usage: /<command> [small] @@ -99,8 +115,8 @@ commands: usage: /<command> [player] aliases: [gm,creative,creativemode,egamemode,ecreative,ecreativemode,egm] getpos: - description: Get your current coordinates. - usage: /<command> + description: Get your current coordinates or those of a player. + usage: /<command> [player] aliases: [coords,egetpos,whereami,ewhereami] gc: description: Reports garbage collection info; useful to developers. @@ -176,7 +192,7 @@ commands: aliases: [playerlist,who,online,elist,ewho,eplayerlist,eonline] lightning: description: The power of Thor. Strike at cursor or player. - usage: /<command> [player] + usage: /<command> [player] [power] aliases: [strike,smite,thor,shock,elightning,estrike,esmite,ethor,eshock] mail: description: Manages inter-player, intra-server mail. @@ -186,6 +202,10 @@ commands: description: Describes an action in the context of the player. usage: /<command> <description> aliases: [action,describe,eme,eaction,edescribe] + more: + description: Fills the item stack in hand to maximum size. + usage: /<command> + aliases: [emore] motd: description: Views the Message Of The Day. usage: /<command> @@ -198,6 +218,10 @@ commands: description: Mutes or unmutes a player. usage: /<command> <player> [datediff] aliases: [emute] + near: + description: Lists the players near by or around a player + usage: /<command> [playername] [radius] + aliases: [nearby,enear,enearby] nick: description: Change your nickname or that of another player. usage: /<command> [player] <nickname|off> @@ -234,6 +258,10 @@ commands: description: Displays the username of a user based on nickname. usage: /<command> <nickname> aliases: [erealname] + remove: + description: Removes entities in your world + usage: /<command> <drops|arrows|boats|minecarts|xp|paintings> [radius] + aliases: [eremove] repair: description: Repairs the durability of all or one item. usage: /<command> <hand|all> @@ -276,7 +304,7 @@ commands: aliases: [espawner] spawnmob: description: Spawns a mob. - usage: /<command> <mob>[:data][,<mount>[:data]] [amount] + usage: /<command> <mob>[:data][,<mount>[:data]] [amount] [player] aliases: [espawnmob] sudo: description: Make another user perform a command. @@ -299,9 +327,9 @@ commands: usage: /<command> [day|night|dawn|17:30|4pm|4000ticks] [worldname|all] aliases: [etime, day, night] togglejail: - description: Prevents a player from interacting with the world and teleports him/her to the the jail specified + description: Prevents a player from interacting with the world and teleports him/her to the jail specified usage: /<command> <player> <jailname> [datediff] - aliases: [tjail,unjail,eunjail,etogglejail] + aliases: [tjail,jail,ejail,unjail,eunjail,etogglejail] top: description: Teleport to the highest block at your current position. usage: /<command> @@ -309,7 +337,7 @@ commands: tp: description: Teleport to a player. usage: /<command> <player> [otherplayer] - aliases: [etp] + aliases: [tele,etele,etp,tp2p,etp2p] tpa: description: Request to teleport to the specified player. usage: /<command> <player> @@ -389,4 +417,4 @@ commands: worth: description: Calculates the worth of items in hand or as specified. usage: /<command> [item] [amount] - aliases: [eworth]
\ No newline at end of file + aliases: [eworth] diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java index 22a8f0224..d0fe51c9a 100644 --- a/Essentials/test/com/earth2me/essentials/FakeServer.java +++ b/Essentials/test/com/earth2me/essentials/FakeServer.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import com.earth2me.essentials.craftbukkit.FakeWorld; import com.avaje.ebean.config.ServerConfig; import java.io.File; import java.util.*; @@ -592,4 +593,10 @@ public class FakeServer implements Server { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public OfflinePlayer[] getOfflinePlayers() + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/test/com/earth2me/essentials/StorageTest.java b/Essentials/test/com/earth2me/essentials/StorageTest.java index e6850ce91..b7fe23433 100644 --- a/Essentials/test/com/earth2me/essentials/StorageTest.java +++ b/Essentials/test/com/earth2me/essentials/StorageTest.java @@ -1,6 +1,7 @@ package com.earth2me.essentials; import com.earth2me.essentials.settings.Settings; +import com.earth2me.essentials.storage.ObjectLoadException; import com.earth2me.essentials.storage.StorageObject; import com.earth2me.essentials.storage.YamlStorageReader; import com.earth2me.essentials.storage.YamlStorageWriter; @@ -11,7 +12,6 @@ import org.bukkit.World; import org.bukkit.World.Environment; import org.bukkit.plugin.InvalidDescriptionException; import org.junit.Test; -import org.yaml.snakeyaml.Yaml; public class StorageTest extends TestCase @@ -42,82 +42,94 @@ public class StorageTest extends TestCase @Test public void testSettings() { - assertTrue(StorageObject.class.isAssignableFrom(Settings.class)); - ExecuteTimer ext = new ExecuteTimer(); - ext.start(); - final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]); - final Reader reader = new InputStreamReader(bais); - final Settings settings = new YamlStorageReader(reader).load(Settings.class); - ext.mark("load empty settings"); - final ByteArrayInputStream bais3 = new ByteArrayInputStream(new byte[0]); - final Reader reader3 = new InputStreamReader(bais3); - final Settings settings3 = new YamlStorageReader(reader3).load(Settings.class); - ext.mark("load empty settings (class cached)"); - final ByteArrayOutputStream baos = new ByteArrayOutputStream(); - final PrintWriter writer = new PrintWriter(baos); - new YamlStorageWriter(writer).save(settings); - writer.close(); - ext.mark("write settings"); - byte[] written = baos.toByteArray(); - System.out.println(new String(written)); - final ByteArrayInputStream bais2 = new ByteArrayInputStream(written); - final Reader reader2 = new InputStreamReader(bais2); - final Settings settings2 = new YamlStorageReader(reader2).load(Settings.class); - System.out.println(settings.toString()); - System.out.println(settings2.toString()); - ext.mark("reload settings"); - System.out.println(ext.end()); - //assertEquals("Default and rewritten config should be equal", settings, settings2); - //that assertion fails, because empty list and maps return as null + try + { + assertTrue(StorageObject.class.isAssignableFrom(Settings.class)); + ExecuteTimer ext = new ExecuteTimer(); + ext.start(); + final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]); + final Reader reader = new InputStreamReader(bais); + final Settings settings = new YamlStorageReader(reader, null).load(Settings.class); + ext.mark("load empty settings"); + final ByteArrayInputStream bais3 = new ByteArrayInputStream(new byte[0]); + final Reader reader3 = new InputStreamReader(bais3); + final Settings settings3 = new YamlStorageReader(reader3, null).load(Settings.class); + ext.mark("load empty settings (class cached)"); + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final PrintWriter writer = new PrintWriter(baos); + new YamlStorageWriter(writer).save(settings); + writer.close(); + ext.mark("write settings"); + byte[] written = baos.toByteArray(); + System.out.println(new String(written)); + final ByteArrayInputStream bais2 = new ByteArrayInputStream(written); + final Reader reader2 = new InputStreamReader(bais2); + final Settings settings2 = new YamlStorageReader(reader2, null).load(Settings.class); + System.out.println(settings.toString()); + System.out.println(settings2.toString()); + ext.mark("reload settings"); + System.out.println(ext.end()); + //assertEquals("Default and rewritten config should be equal", settings, settings2); + //that assertion fails, because empty list and maps return as null + } + catch (ObjectLoadException ex) + { + fail(ex.getMessage()); + } } @Test public void testUserdata() { - FakeServer server = new FakeServer(); - World world = server.createWorld("testWorld", Environment.NORMAL); - ExecuteTimer ext = new ExecuteTimer(); - ext.start(); - final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]); - final Reader reader = new InputStreamReader(bais); - final com.earth2me.essentials.userdata.UserData userdata = new YamlStorageReader(reader).load(com.earth2me.essentials.userdata.UserData.class); - ext.mark("load empty user"); - final ByteArrayInputStream bais3 = new ByteArrayInputStream(new byte[0]); - final Reader reader3 = new InputStreamReader(bais3); - final com.earth2me.essentials.userdata.UserData userdata3 = new YamlStorageReader(reader3).load(com.earth2me.essentials.userdata.UserData.class); - ext.mark("load empty user (class cached)"); + try + { + FakeServer server = new FakeServer(); + World world = server.createWorld("testWorld", Environment.NORMAL); + ExecuteTimer ext = new ExecuteTimer(); + ext.start(); + final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]); + final Reader reader = new InputStreamReader(bais); + final com.earth2me.essentials.user.UserData userdata = new YamlStorageReader(reader, null).load(com.earth2me.essentials.user.UserData.class); + ext.mark("load empty user"); + final ByteArrayInputStream bais3 = new ByteArrayInputStream(new byte[0]); + final Reader reader3 = new InputStreamReader(bais3); + final com.earth2me.essentials.user.UserData userdata3 = new YamlStorageReader(reader3, null).load(com.earth2me.essentials.user.UserData.class); + ext.mark("load empty user (class cached)"); - for (int j = 0; j < 10000; j++) + for (int j = 0; j < 10000; j++) + { + userdata.getHomes().put("home", new Location(world, j, j, j)); + } + ext.mark("change home 10000 times"); + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final PrintWriter writer = new PrintWriter(baos); + new YamlStorageWriter(writer).save(userdata); + writer.close(); + ext.mark("write user"); + final ByteArrayOutputStream baos2 = new ByteArrayOutputStream(); + final PrintWriter writer2 = new PrintWriter(baos2); + new YamlStorageWriter(writer2).save(userdata); + writer2.close(); + ext.mark("write user (cached)"); + byte[] written = baos.toByteArray(); + System.out.println(new String(written)); + ext.mark("debug output"); + final ByteArrayInputStream bais2 = new ByteArrayInputStream(written); + final Reader reader2 = new InputStreamReader(bais2); + final com.earth2me.essentials.user.UserData userdata2 = new YamlStorageReader(reader2, null).load(com.earth2me.essentials.user.UserData.class); + ext.mark("reload file"); + final ByteArrayInputStream bais4 = new ByteArrayInputStream(written); + final Reader reader4 = new InputStreamReader(bais4); + final com.earth2me.essentials.user.UserData userdata4 = new YamlStorageReader(reader4, null).load(com.earth2me.essentials.user.UserData.class); + ext.mark("reload file (cached)"); + System.out.println(userdata.toString()); + System.out.println(userdata2.toString()); + System.out.println(ext.end()); + } + catch (ObjectLoadException ex) { - userdata.getHomes().put("home", new Location(world, j, j, j)); + fail(ex.getMessage()); } - ext.mark("change home 10000 times"); - final ByteArrayOutputStream baos = new ByteArrayOutputStream(); - final PrintWriter writer = new PrintWriter(baos); - new YamlStorageWriter(writer).save(userdata); - writer.close(); - ext.mark("write user"); - final ByteArrayOutputStream baos2 = new ByteArrayOutputStream(); - final PrintWriter writer2 = new PrintWriter(baos2); - new YamlStorageWriter(writer2).save(userdata); - writer2.close(); - ext.mark("write user (cached)"); - byte[] written = baos.toByteArray(); - System.out.println(new String(written)); - ext.mark("debug output"); - final ByteArrayInputStream bais2 = new ByteArrayInputStream(written); - final Reader reader2 = new InputStreamReader(bais2); - final com.earth2me.essentials.userdata.UserData userdata2 = new YamlStorageReader(reader2).load(com.earth2me.essentials.userdata.UserData.class); - ext.mark("reload file"); - final ByteArrayInputStream bais4 = new ByteArrayInputStream(written); - final Reader reader4 = new InputStreamReader(bais4); - final com.earth2me.essentials.userdata.UserData userdata4 = new YamlStorageReader(reader4).load(com.earth2me.essentials.userdata.UserData.class); - ext.mark("reload file (cached)"); - System.out.println(userdata.toString()); - System.out.println(userdata2.toString()); - System.out.println(ext.end()); - com.earth2me.essentials.userdata.User test = new com.earth2me.essentials.userdata.User(); - test.example(); } diff --git a/EssentialsChat/nbproject/project.properties b/EssentialsChat/nbproject/project.properties index 0ce40b48b..e59815e40 100644 --- a/EssentialsChat/nbproject/project.properties +++ b/EssentialsChat/nbproject/project.properties @@ -79,8 +79,7 @@ javac.target=1.6 javac.test.classpath=\ ${javac.classpath}:\ ${build.classes.dir}:\ - ${libs.junit.classpath}:\ - ${libs.junit_4.classpath} + ${libs.junit_4.10.classpath} javac.test.processorpath=\ ${javac.test.classpath} javadoc.additionalparam= diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java index f547f0da0..6600ff91d 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java @@ -21,6 +21,15 @@ public class EssentialsChat extends JavaPlugin { final PluginManager pluginManager = getServer().getPluginManager(); final IEssentials ess = (IEssentials)pluginManager.getPlugin("Essentials"); + if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) + { + LOGGER.log(Level.WARNING, _("versionMismatchAll")); + } + if (!ess.isEnabled()) + { + this.setEnabled(false); + return; + } chatListener = new HashMap<String, IEssentialsChatListener>(); @@ -30,16 +39,16 @@ public class EssentialsChat extends JavaPlugin pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerLowest, Priority.Lowest, this); pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerNormal, Priority.Normal, this); pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerHighest, Priority.Highest, this); - if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) - { - LOGGER.log(Level.WARNING, _("versionMismatchAll")); - } + LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team")); } public void onDisable() { - chatListener.clear(); + if (chatListener != null) + { + chatListener.clear(); + } } public void addEssentialsChatListener(final String plugin, final IEssentialsChatListener listener) diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java index 305e13e8a..2d6e1ae4e 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java @@ -15,7 +15,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerListener; - +//TODO: Translate the local/spy tags public abstract class EssentialsChatPlayer extends PlayerListener { protected transient IEssentials ess; @@ -112,34 +112,31 @@ public abstract class EssentialsChatPlayer extends PlayerListener logger.info(_("localFormat", sender.getName(), event.getMessage())); final Location loc = sender.getLocation(); final World world = loc.getWorld(); - final int x = loc.getBlockX(); - final int y = loc.getBlockY(); - final int z = loc.getBlockZ(); - for (Player p : server.getOnlinePlayers()) + + for (Player onlinePlayer : server.getOnlinePlayers()) { String type = "[L]"; - final User u = ess.getUser(p); + final User user = ess.getUser(onlinePlayer); //TODO: remove reference to op - if (u.isIgnoredPlayer(sender.getName()) && !sender.isOp()) + if (user.isIgnoredPlayer(sender.getName()) && !sender.isOp()) { continue; } - if (!u.equals(sender)) - { - final Location l = u.getLocation(); - final int dx = x - l.getBlockX(); - final int dy = y - l.getBlockY(); - final int dz = z - l.getBlockZ(); - final long delta = dx * dx + dy * dy + dz * dz; - if (delta > radius || world != l.getWorld()) + if (!user.equals(sender)) + { + final Location playerLoc = user.getLocation(); + if (playerLoc.getWorld() != world) { continue; } + final double delta = playerLoc.distanceSquared(loc); + + if (delta > radius) { - if (!u.isAuthorized("essentials.chat.spy")) + if (user.isAuthorized("essentials.chat.spy")) { - continue; + type = type.concat("[Spy]"); } else { - type = type.concat("[Spy]"); + continue; } } } @@ -147,9 +144,9 @@ public abstract class EssentialsChatPlayer extends PlayerListener String message = String.format(event.getFormat(), type.concat(sender.getDisplayName()), event.getMessage()); for (IEssentialsChatListener listener : listeners.values()) { - message = listener.modifyMessage(event, p, message); + message = listener.modifyMessage(event, onlinePlayer, message); } - u.sendMessage(message); + user.sendMessage(message); } } } diff --git a/EssentialsGeoIP/nbproject/project.properties b/EssentialsGeoIP/nbproject/project.properties index 1b6ef450d..d20b3418f 100644 --- a/EssentialsGeoIP/nbproject/project.properties +++ b/EssentialsGeoIP/nbproject/project.properties @@ -79,8 +79,7 @@ javac.target=1.6 javac.test.classpath=\ ${javac.classpath}:\ ${build.classes.dir}:\ - ${libs.junit.classpath}:\ - ${libs.junit_4.classpath} + ${libs.junit_4.10.classpath} javac.test.processorpath=\ ${javac.test.classpath} javadoc.additionalparam= diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java index 6bc0c2022..e0ca6cd7c 100644 --- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java +++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java @@ -28,13 +28,17 @@ public class EssentialsGeoIP extends JavaPlugin { final PluginManager pm = getServer().getPluginManager(); final IEssentials ess = (IEssentials)pm.getPlugin("Essentials"); - final EssentialsGeoIPPlayerListener playerListener = new EssentialsGeoIPPlayerListener(getDataFolder(), ess); - pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this); - if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) { logger.log(Level.WARNING, _("versionMismatchAll")); } + if (!ess.isEnabled()) { + this.setEnabled(false); + return; + } + final EssentialsGeoIPPlayerListener playerListener = new EssentialsGeoIPPlayerListener(getDataFolder(), ess); + pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this); + logger.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team")); logger.log(Level.INFO, "This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/."); diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java index eea488ab2..10757475d 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java @@ -76,7 +76,7 @@ public class User extends DataUnit implements Cloneable { for (String perm : this.getPermissionList()) { clone.addPermission(perm); } - // clone.variables = this.variables.clone(); + clone.variables = this.variables.clone(this); clone.flagAsChanged(); return clone; } @@ -213,10 +213,11 @@ public class User extends DataUnit implements Cloneable { * @param varList */ public void setVariables(Map<String, Object> varList) { - UserVariables temp = new UserVariables(this, varList); + //UserVariables temp = new UserVariables(this, varList); variables.clearVars(); - for (String key : temp.getVarKeyList()) { - variables.addVar(key, temp.getVarObject(key)); + for (String key : varList.keySet()) { + System.out.print("Adding variable - " + key); + variables.addVar(key, varList.get(key)); } flagAsChanged(); if (GroupManager.isLoaded()) diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java index e97b01a48..140d6626a 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java @@ -108,8 +108,6 @@ public abstract class Variables implements Cloneable { return o == null ? -1.0D : Double.parseDouble(o.toString()); } catch (Exception e) { return -1.0D; - - } } @@ -119,8 +117,6 @@ public abstract class Variables implements Cloneable { */ public Set<String> getVarKeyList() { return variables.keySet(); - - } /** @@ -130,8 +126,6 @@ public abstract class Variables implements Cloneable { */ public boolean hasVar(String name) { return variables.containsKey(name); - - } /** @@ -140,8 +134,6 @@ public abstract class Variables implements Cloneable { */ public int getSize() { return variables.size(); - - } /** diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java index 2b6a80da6..4ef77687a 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java @@ -631,7 +631,6 @@ public class WorldDataHolder { } else throw new IllegalArgumentException("Unknown entry found in Info section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); - //END INFO NODE if (thisGroupNode.get("inheritance") == null || thisGroupNode.get("inheritance") instanceof List) { @@ -753,14 +752,19 @@ public class WorldDataHolder { } - //USER INFO NODE - BETA - + //USER INFO NODE + //INFO NODE - Map<String, Object> infoNode = (Map<String, Object>) thisUserNode.get("info"); - if (infoNode != null) { - thisUser.setVariables(infoNode); - } - //END INFO NODE - BETA + if (thisUserNode.get("info") instanceof Map) { + Map<String, Object> infoNode = (Map<String, Object>) thisUserNode.get("info"); + if (infoNode != null) { + thisUser.setVariables(infoNode); + } + } else if (thisUserNode.get("info") != null) + throw new IllegalArgumentException("Unknown entry found in Info section for user: " + thisUser.getName() + " in file: " + usersFile.getPath()); + + //END INFO NODE + if (thisUserNode.get("group") != null) { Group hisGroup = ph.getGroup(thisUserNode.get("group").toString()); diff --git a/EssentialsPermissionsCommands/build.xml b/EssentialsPermissionsCommands/build.xml deleted file mode 100644 index 507230993..000000000 --- a/EssentialsPermissionsCommands/build.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- You may freely edit this file. See commented blocks below for --> -<!-- some examples of how to customize the build. --> -<!-- (If you delete it and reopen the project it will be recreated.) --> -<!-- By default, only the Clean and Build commands use this build script. --> -<!-- Commands such as Run, Debug, and Test only use this build script if --> -<!-- the Compile on Save feature is turned off for the project. --> -<!-- You can turn off the Compile on Save (or Deploy on Save) setting --> -<!-- in the project's Project Properties dialog box.--> -<project name="EssentialsPermissionsCommands" default="default" basedir="."> - <description>Builds, tests, and runs the project EssentialsPermissionsCommands.</description> - <import file="nbproject/build-impl.xml"/> - <!-- - - There exist several targets which are by default empty and which can be - used for execution of your tasks. These targets are usually executed - before and after some main targets. They are: - - -pre-init: called before initialization of project properties - -post-init: called after initialization of project properties - -pre-compile: called before javac compilation - -post-compile: called after javac compilation - -pre-compile-single: called before javac compilation of single file - -post-compile-single: called after javac compilation of single file - -pre-compile-test: called before javac compilation of JUnit tests - -post-compile-test: called after javac compilation of JUnit tests - -pre-compile-test-single: called before javac compilation of single JUnit test - -post-compile-test-single: called after javac compilation of single JUunit test - -pre-jar: called before JAR building - -post-jar: called after JAR building - -post-clean: called after cleaning build products - - (Targets beginning with '-' are not intended to be called on their own.) - - Example of inserting an obfuscator after compilation could look like this: - - <target name="-post-compile"> - <obfuscate> - <fileset dir="${build.classes.dir}"/> - </obfuscate> - </target> - - For list of available properties check the imported - nbproject/build-impl.xml file. - - - Another way to customize the build is by overriding existing main targets. - The targets of interest are: - - -init-macrodef-javac: defines macro for javac compilation - -init-macrodef-junit: defines macro for junit execution - -init-macrodef-debug: defines macro for class debugging - -init-macrodef-java: defines macro for class execution - -do-jar-with-manifest: JAR building (if you are using a manifest) - -do-jar-without-manifest: JAR building (if you are not using a manifest) - run: execution of project - -javadoc-build: Javadoc generation - test-report: JUnit report generation - - An example of overriding the target for project execution could look like this: - - <target name="run" depends="EssentialsPermissionsCommands-impl.jar"> - <exec dir="bin" executable="launcher.exe"> - <arg file="${dist.jar}"/> - </exec> - </target> - - Notice that the overridden target depends on the jar target and not only on - the compile target as the regular run target does. Again, for a list of available - properties which you can use, check the target you are overriding in the - nbproject/build-impl.xml file. - - --> -</project> diff --git a/EssentialsPermissionsCommands/manifest.mf b/EssentialsPermissionsCommands/manifest.mf deleted file mode 100644 index 328e8e5bc..000000000 --- a/EssentialsPermissionsCommands/manifest.mf +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -X-COMMENT: Main-Class will be added automatically by build - diff --git a/EssentialsPermissionsCommands/nbproject/build-impl.xml b/EssentialsPermissionsCommands/nbproject/build-impl.xml deleted file mode 100644 index be53b45fd..000000000 --- a/EssentialsPermissionsCommands/nbproject/build-impl.xml +++ /dev/null @@ -1,1081 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -*** GENERATED FROM project.xml - DO NOT EDIT *** -*** EDIT ../build.xml INSTEAD *** - -For the purpose of easier reading the script -is divided into following sections: - - - initialization - - compilation - - jar - - execution - - debugging - - javadoc - - junit compilation - - junit execution - - junit debugging - - applet - - cleanup - - --> -<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="EssentialsPermissionsCommands-impl"> - <fail message="Please build using Ant 1.7.1 or higher."> - <condition> - <not> - <antversion atleast="1.7.1"/> - </not> - </condition> - </fail> - <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/> - <!-- - ====================== - INITIALIZATION SECTION - ====================== - --> - <target name="-pre-init"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="-pre-init" name="-init-private"> - <property file="nbproject/private/config.properties"/> - <property file="nbproject/private/configs/${config}.properties"/> - <property file="nbproject/private/private.properties"/> - </target> - <target name="-pre-init-libraries"> - <property location="../lib/nblibraries.properties" name="libraries.path"/> - <dirname file="${libraries.path}" property="libraries.dir.nativedirsep"/> - <pathconvert dirsep="/" property="libraries.dir"> - <path path="${libraries.dir.nativedirsep}"/> - </pathconvert> - <basename file="${libraries.path}" property="libraries.basename" suffix=".properties"/> - <available file="${libraries.dir}/${libraries.basename}-private.properties" property="private.properties.available"/> - </target> - <target depends="-pre-init-libraries" if="private.properties.available" name="-init-private-libraries"> - <loadproperties encoding="ISO-8859-1" srcfile="${libraries.dir}/${libraries.basename}-private.properties"> - <filterchain> - <replacestring from="$${base}" to="${libraries.dir}"/> - <escapeunicode/> - </filterchain> - </loadproperties> - </target> - <target depends="-pre-init,-init-private,-init-private-libraries" name="-init-libraries"> - <loadproperties encoding="ISO-8859-1" srcfile="${libraries.path}"> - <filterchain> - <replacestring from="$${base}" to="${libraries.dir}"/> - <escapeunicode/> - </filterchain> - </loadproperties> - </target> - <target depends="-pre-init,-init-private,-init-libraries" name="-init-user"> - <property file="${user.properties.file}"/> - <!-- The two properties below are usually overridden --> - <!-- by the active platform. Just a fallback. --> - <property name="default.javac.source" value="1.4"/> - <property name="default.javac.target" value="1.4"/> - </target> - <target depends="-pre-init,-init-private,-init-libraries,-init-user" name="-init-project"> - <property file="nbproject/configs/${config}.properties"/> - <property file="nbproject/project.properties"/> - </target> - <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-init-macrodef-property" name="-do-init"> - <available file="${manifest.file}" property="manifest.available"/> - <condition property="splashscreen.available"> - <and> - <not> - <equals arg1="${application.splash}" arg2="" trim="true"/> - </not> - <available file="${application.splash}"/> - </and> - </condition> - <condition property="main.class.available"> - <and> - <isset property="main.class"/> - <not> - <equals arg1="${main.class}" arg2="" trim="true"/> - </not> - </and> - </condition> - <condition property="manifest.available+main.class"> - <and> - <isset property="manifest.available"/> - <isset property="main.class.available"/> - </and> - </condition> - <condition property="do.archive"> - <not> - <istrue value="${jar.archive.disabled}"/> - </not> - </condition> - <condition property="do.mkdist"> - <and> - <isset property="do.archive"/> - <isset property="libs.CopyLibs.classpath"/> - <not> - <istrue value="${mkdist.disabled}"/> - </not> - </and> - </condition> - <condition property="manifest.available+main.class+mkdist.available"> - <and> - <istrue value="${manifest.available+main.class}"/> - <isset property="do.mkdist"/> - </and> - </condition> - <condition property="do.archive+manifest.available"> - <and> - <isset property="manifest.available"/> - <istrue value="${do.archive}"/> - </and> - </condition> - <condition property="do.archive+main.class.available"> - <and> - <isset property="main.class.available"/> - <istrue value="${do.archive}"/> - </and> - </condition> - <condition property="do.archive+splashscreen.available"> - <and> - <isset property="splashscreen.available"/> - <istrue value="${do.archive}"/> - </and> - </condition> - <condition property="do.archive+manifest.available+main.class"> - <and> - <istrue value="${manifest.available+main.class}"/> - <istrue value="${do.archive}"/> - </and> - </condition> - <condition property="manifest.available-mkdist.available"> - <or> - <istrue value="${manifest.available}"/> - <isset property="do.mkdist"/> - </or> - </condition> - <condition property="manifest.available+main.class-mkdist.available"> - <or> - <istrue value="${manifest.available+main.class}"/> - <isset property="do.mkdist"/> - </or> - </condition> - <condition property="have.tests"> - <or> - <available file="${test.src.dir}"/> - </or> - </condition> - <condition property="have.sources"> - <or> - <available file="${src.dir}"/> - </or> - </condition> - <condition property="netbeans.home+have.tests"> - <and> - <isset property="netbeans.home"/> - <isset property="have.tests"/> - </and> - </condition> - <condition property="no.javadoc.preview"> - <and> - <isset property="javadoc.preview"/> - <isfalse value="${javadoc.preview}"/> - </and> - </condition> - <property name="run.jvmargs" value=""/> - <property name="javac.compilerargs" value=""/> - <property name="work.dir" value="${basedir}"/> - <condition property="no.deps"> - <and> - <istrue value="${no.dependencies}"/> - </and> - </condition> - <property name="javac.debug" value="true"/> - <property name="javadoc.preview" value="true"/> - <property name="application.args" value=""/> - <property name="source.encoding" value="${file.encoding}"/> - <property name="runtime.encoding" value="${source.encoding}"/> - <condition property="javadoc.encoding.used" value="${javadoc.encoding}"> - <and> - <isset property="javadoc.encoding"/> - <not> - <equals arg1="${javadoc.encoding}" arg2=""/> - </not> - </and> - </condition> - <property name="javadoc.encoding.used" value="${source.encoding}"/> - <property name="includes" value="**"/> - <property name="excludes" value=""/> - <property name="do.depend" value="false"/> - <condition property="do.depend.true"> - <istrue value="${do.depend}"/> - </condition> - <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> - <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'"> - <length length="0" string="${endorsed.classpath}" when="greater"/> - </condition> - <condition else="false" property="jdkBug6558476"> - <and> - <matches pattern="1\.[56]" string="${java.specification.version}"/> - <not> - <os family="unix"/> - </not> - </and> - </condition> - <property name="javac.fork" value="${jdkBug6558476}"/> - <property name="jar.index" value="false"/> - <property name="jar.index.metainf" value="${jar.index}"/> - <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/> - </target> - <target name="-post-init"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init" name="-init-check"> - <fail unless="src.dir">Must set src.dir</fail> - <fail unless="test.src.dir">Must set test.src.dir</fail> - <fail unless="build.dir">Must set build.dir</fail> - <fail unless="dist.dir">Must set dist.dir</fail> - <fail unless="build.classes.dir">Must set build.classes.dir</fail> - <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail> - <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail> - <fail unless="build.test.results.dir">Must set build.test.results.dir</fail> - <fail unless="build.classes.excludes">Must set build.classes.excludes</fail> - <fail unless="dist.jar">Must set dist.jar</fail> - </target> - <target name="-init-macrodef-property"> - <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1"> - <attribute name="name"/> - <attribute name="value"/> - <sequential> - <property name="@{name}" value="${@{value}}"/> - </sequential> - </macrodef> - </target> - <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors"> - <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${src.dir}" name="srcdir"/> - <attribute default="${build.classes.dir}" name="destdir"/> - <attribute default="${javac.classpath}" name="classpath"/> - <attribute default="${javac.processorpath}" name="processorpath"/> - <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="${javac.debug}" name="debug"/> - <attribute default="${empty.dir}" name="sourcepath"/> - <attribute default="${empty.dir}" name="gensrcdir"/> - <element name="customize" optional="true"/> - <sequential> - <property location="${build.dir}/empty" name="empty.dir"/> - <mkdir dir="${empty.dir}"/> - <mkdir dir="@{apgeneratedsrcdir}"/> - <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> - <src> - <dirset dir="@{gensrcdir}" erroronmissingdir="false"> - <include name="*"/> - </dirset> - </src> - <classpath> - <path path="@{classpath}"/> - </classpath> - <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> - <compilerarg line="${javac.compilerargs}"/> - <compilerarg value="-processorpath"/> - <compilerarg path="@{processorpath}:${empty.dir}"/> - <compilerarg line="${ap.processors.internal}"/> - <compilerarg line="${annotation.processing.processor.options}"/> - <compilerarg value="-s"/> - <compilerarg path="@{apgeneratedsrcdir}"/> - <compilerarg line="${ap.proc.none.internal}"/> - <customize/> - </javac> - </sequential> - </macrodef> - </target> - <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal"> - <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${src.dir}" name="srcdir"/> - <attribute default="${build.classes.dir}" name="destdir"/> - <attribute default="${javac.classpath}" name="classpath"/> - <attribute default="${javac.processorpath}" name="processorpath"/> - <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="${javac.debug}" name="debug"/> - <attribute default="${empty.dir}" name="sourcepath"/> - <attribute default="${empty.dir}" name="gensrcdir"/> - <element name="customize" optional="true"/> - <sequential> - <property location="${build.dir}/empty" name="empty.dir"/> - <mkdir dir="${empty.dir}"/> - <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> - <src> - <dirset dir="@{gensrcdir}" erroronmissingdir="false"> - <include name="*"/> - </dirset> - </src> - <classpath> - <path path="@{classpath}"/> - </classpath> - <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> - <compilerarg line="${javac.compilerargs}"/> - <customize/> - </javac> - </sequential> - </macrodef> - </target> - <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac"> - <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${src.dir}" name="srcdir"/> - <attribute default="${build.classes.dir}" name="destdir"/> - <attribute default="${javac.classpath}" name="classpath"/> - <sequential> - <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}"> - <classpath> - <path path="@{classpath}"/> - </classpath> - </depend> - </sequential> - </macrodef> - <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${build.classes.dir}" name="destdir"/> - <sequential> - <fail unless="javac.includes">Must set javac.includes</fail> - <pathconvert pathsep="${line.separator}" property="javac.includes.binary"> - <path> - <filelist dir="@{destdir}" files="${javac.includes}"/> - </path> - <globmapper from="*.java" to="*.class"/> - </pathconvert> - <tempfile deleteonexit="true" property="javac.includesfile.binary"/> - <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/> - <delete> - <files includesfile="${javac.includesfile.binary}"/> - </delete> - <delete> - <fileset file="${javac.includesfile.binary}"/> - </delete> - </sequential> - </macrodef> - </target> - <target name="-init-macrodef-junit"> - <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <sequential> - <property name="junit.forkmode" value="perTest"/> - <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> - <batchtest todir="${build.test.results.dir}"> - <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> - <filename name="@{testincludes}"/> - </fileset> - </batchtest> - <classpath> - <path path="${run.test.classpath}"/> - </classpath> - <syspropertyset> - <propertyref prefix="test-sys-prop."/> - <mapper from="test-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - <formatter type="brief" usefile="false"/> - <formatter type="xml"/> - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> - <jvmarg value="-ea"/> - <jvmarg line="${run.jvmargs}"/> - </junit> - </sequential> - </macrodef> - </target> - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/> - <target name="-profile-pre-init"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target name="-profile-post-init"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target name="-profile-init-macrodef-profile"> - <macrodef name="resolve"> - <attribute name="name"/> - <attribute name="value"/> - <sequential> - <property name="@{name}" value="${env.@{value}}"/> - </sequential> - </macrodef> - <macrodef name="profile"> - <attribute default="${main.class}" name="classname"/> - <element name="customize" optional="true"/> - <sequential> - <property environment="env"/> - <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/> - <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}"> - <jvmarg value="${profiler.info.jvmargs.agent}"/> - <jvmarg line="${profiler.info.jvmargs}"/> - <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> - <arg line="${application.args}"/> - <classpath> - <path path="${run.classpath}"/> - </classpath> - <syspropertyset> - <propertyref prefix="run-sys-prop."/> - <mapper from="run-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - <customize/> - </java> - </sequential> - </macrodef> - </target> - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check"> - <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail> - <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail> - </target> - <target depends="-init-debug-args" name="-init-macrodef-nbjpda"> - <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1"> - <attribute default="${main.class}" name="name"/> - <attribute default="${debug.classpath}" name="classpath"/> - <attribute default="" name="stopclassname"/> - <sequential> - <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}"> - <classpath> - <path path="@{classpath}"/> - </classpath> - </nbjpdastart> - </sequential> - </macrodef> - <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1"> - <attribute default="${build.classes.dir}" name="dir"/> - <sequential> - <nbjpdareload> - <fileset dir="@{dir}" includes="${fix.classes}"> - <include name="${fix.includes}*.class"/> - </fileset> - </nbjpdareload> - </sequential> - </macrodef> - </target> - <target name="-init-debug-args"> - <property name="version-output" value="java version "${ant.java.version}"/> - <condition property="have-jdk-older-than-1.4"> - <or> - <contains string="${version-output}" substring="java version "1.0"/> - <contains string="${version-output}" substring="java version "1.1"/> - <contains string="${version-output}" substring="java version "1.2"/> - <contains string="${version-output}" substring="java version "1.3"/> - </or> - </condition> - <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none"> - <istrue value="${have-jdk-older-than-1.4}"/> - </condition> - <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem"> - <os family="windows"/> - </condition> - <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}"> - <isset property="debug.transport"/> - </condition> - </target> - <target depends="-init-debug-args" name="-init-macrodef-debug"> - <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${main.class}" name="classname"/> - <attribute default="${debug.classpath}" name="classpath"/> - <element name="customize" optional="true"/> - <sequential> - <java classname="@{classname}" dir="${work.dir}" fork="true"> - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> - <jvmarg line="${debug-args-line}"/> - <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> - <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> - <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> - <jvmarg line="${run.jvmargs}"/> - <classpath> - <path path="@{classpath}"/> - </classpath> - <syspropertyset> - <propertyref prefix="run-sys-prop."/> - <mapper from="run-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - <customize/> - </java> - </sequential> - </macrodef> - </target> - <target name="-init-macrodef-java"> - <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1"> - <attribute default="${main.class}" name="classname"/> - <attribute default="${run.classpath}" name="classpath"/> - <element name="customize" optional="true"/> - <sequential> - <java classname="@{classname}" dir="${work.dir}" fork="true"> - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> - <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> - <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> - <jvmarg line="${run.jvmargs}"/> - <classpath> - <path path="@{classpath}"/> - </classpath> - <syspropertyset> - <propertyref prefix="run-sys-prop."/> - <mapper from="run-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - <customize/> - </java> - </sequential> - </macrodef> - </target> - <target name="-init-macrodef-copylibs"> - <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${manifest.file}" name="manifest"/> - <element name="customize" optional="true"/> - <sequential> - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> - <pathconvert property="run.classpath.without.build.classes.dir"> - <path path="${run.classpath}"/> - <map from="${build.classes.dir.resolved}" to=""/> - </pathconvert> - <pathconvert pathsep=" " property="jar.classpath"> - <path path="${run.classpath.without.build.classes.dir}"/> - <chainedmapper> - <flattenmapper/> - <globmapper from="*" to="lib/*"/> - </chainedmapper> - </pathconvert> - <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> - <copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> - <fileset dir="${build.classes.dir}"/> - <manifest> - <attribute name="Class-Path" value="${jar.classpath}"/> - <customize/> - </manifest> - </copylibs> - </sequential> - </macrodef> - </target> - <target name="-init-presetdef-jar"> - <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1"> - <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}"> - <j2seproject1:fileset dir="${build.classes.dir}"/> - </jar> - </presetdef> - </target> - <target name="-init-ap-cmdline-properties"> - <property name="annotation.processing.enabled" value="true"/> - <property name="annotation.processing.processors.list" value=""/> - <property name="annotation.processing.processor.options" value=""/> - <property name="annotation.processing.run.all.processors" value="true"/> - <property name="javac.processorpath" value="${javac.classpath}"/> - <property name="javac.test.processorpath" value="${javac.test.classpath}"/> - <condition property="ap.supported.internal" value="true"> - <not> - <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/> - </not> - </condition> - </target> - <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported"> - <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}"> - <isfalse value="${annotation.processing.run.all.processors}"/> - </condition> - <condition else="" property="ap.proc.none.internal" value="-proc:none"> - <isfalse value="${annotation.processing.enabled}"/> - </condition> - </target> - <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline"> - <property name="ap.cmd.line.internal" value=""/> - </target> - <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/> - <!-- - =================== - COMPILATION SECTION - =================== - --> - <target name="-deps-jar-init" unless="built-jar.properties"> - <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/> - <delete file="${built-jar.properties}" quiet="true"/> - </target> - <target if="already.built.jar.${basedir}" name="-warn-already-built-jar"> - <echo level="warn" message="Cycle detected: EssentialsPermissionsCommands was already built"/> - </target> - <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps"> - <mkdir dir="${build.dir}"/> - <touch file="${built-jar.properties}" verbose="false"/> - <property file="${built-jar.properties}" prefix="already.built.jar."/> - <antcall target="-warn-already-built-jar"/> - <propertyfile file="${built-jar.properties}"> - <entry key="${basedir}" value=""/> - </propertyfile> - <antcall target="-maybe-call-dep"> - <param name="call.built.properties" value="${built-jar.properties}"/> - <param location="${project.Essentials}" name="call.subproject"/> - <param location="${project.Essentials}/build.xml" name="call.script"/> - <param name="call.target" value="jar"/> - <param name="transfer.built-jar.properties" value="${built-jar.properties}"/> - </antcall> - </target> - <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/> - <target depends="init" name="-check-automatic-build"> - <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/> - </target> - <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build"> - <antcall target="clean"/> - </target> - <target depends="init,deps-jar" name="-pre-pre-compile"> - <mkdir dir="${build.classes.dir}"/> - </target> - <target name="-pre-compile"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target if="do.depend.true" name="-compile-depend"> - <pathconvert property="build.generated.subdirs"> - <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false"> - <include name="*"/> - </dirset> - </pathconvert> - <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/> - </target> - <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile"> - <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/> - <copy todir="${build.classes.dir}"> - <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> - </copy> - </target> - <target if="has.persistence.xml" name="-copy-persistence-xml"> - <mkdir dir="${build.classes.dir}/META-INF"/> - <copy todir="${build.classes.dir}/META-INF"> - <fileset dir="${meta.inf.dir}" includes="persistence.xml"/> - </copy> - </target> - <target name="-post-compile"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/> - <target name="-pre-compile-single"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single"> - <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> - <j2seproject3:force-recompile/> - <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/> - </target> - <target name="-post-compile-single"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/> - <!-- - ==================== - JAR BUILDING SECTION - ==================== - --> - <target depends="init" name="-pre-pre-jar"> - <dirname file="${dist.jar}" property="dist.jar.dir"/> - <mkdir dir="${dist.jar.dir}"/> - </target> - <target name="-pre-jar"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available"> - <j2seproject1:jar/> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available"> - <j2seproject1:jar manifest="${manifest.file}"/> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available"> - <j2seproject1:jar manifest="${manifest.file}"> - <j2seproject1:manifest> - <j2seproject1:attribute name="Main-Class" value="${main.class}"/> - </j2seproject1:manifest> - </j2seproject1:jar> - <echo level="info">To run this application from the command line without Ant, try:</echo> - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> - <property location="${dist.jar}" name="dist.jar.resolved"/> - <pathconvert property="run.classpath.with.dist.jar"> - <path path="${run.classpath}"/> - <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> - </pathconvert> - <echo level="info">java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo> - </target> - <target depends="init" if="do.archive" name="-do-jar-with-libraries-create-manifest" unless="manifest.available"> - <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> - <touch file="${tmp.manifest.file}" verbose="false"/> - </target> - <target depends="init" if="do.archive+manifest.available" name="-do-jar-with-libraries-copy-manifest"> - <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> - <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/> - </target> - <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+main.class.available" name="-do-jar-with-libraries-set-main"> - <manifest file="${tmp.manifest.file}" mode="update"> - <attribute name="Main-Class" value="${main.class}"/> - </manifest> - </target> - <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-with-libraries-set-splashscreen"> - <basename file="${application.splash}" property="splashscreen.basename"/> - <mkdir dir="${build.classes.dir}/META-INF"/> - <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/> - <manifest file="${tmp.manifest.file}" mode="update"> - <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/> - </manifest> - </target> - <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen" if="do.mkdist" name="-do-jar-with-libraries-pack"> - <j2seproject3:copylibs manifest="${tmp.manifest.file}"/> - <echo level="info">To run this application from the command line without Ant, try:</echo> - <property location="${dist.jar}" name="dist.jar.resolved"/> - <echo level="info">java -jar "${dist.jar.resolved}"</echo> - </target> - <target depends="-do-jar-with-libraries-pack" if="do.archive" name="-do-jar-with-libraries-delete-manifest"> - <delete> - <fileset file="${tmp.manifest.file}"/> - </delete> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen,-do-jar-with-libraries-pack,-do-jar-with-libraries-delete-manifest" name="-do-jar-with-libraries"/> - <target name="-post-jar"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/> - <!-- - ================= - EXECUTION SECTION - ================= - --> - <target depends="init,compile" description="Run a main class." name="run"> - <j2seproject1:java> - <customize> - <arg line="${application.args}"/> - </customize> - </j2seproject1:java> - </target> - <target name="-do-not-recompile"> - <property name="javac.includes.binary" value=""/> - </target> - <target depends="init,compile-single" name="run-single"> - <fail unless="run.class">Must select one file in the IDE or set run.class</fail> - <j2seproject1:java classname="${run.class}"/> - </target> - <target depends="init,compile-test-single" name="run-test-with-main"> - <fail unless="run.class">Must select one file in the IDE or set run.class</fail> - <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/> - </target> - <!-- - ================= - DEBUGGING SECTION - ================= - --> - <target depends="init" if="netbeans.home" name="-debug-start-debugger"> - <j2seproject1:nbjpdastart name="${debug.class}"/> - </target> - <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test"> - <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/> - </target> - <target depends="init,compile" name="-debug-start-debuggee"> - <j2seproject3:debug> - <customize> - <arg line="${application.args}"/> - </customize> - </j2seproject3:debug> - </target> - <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/> - <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto"> - <j2seproject1:nbjpdastart stopclassname="${main.class}"/> - </target> - <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/> - <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single"> - <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> - <j2seproject3:debug classname="${debug.class}"/> - </target> - <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/> - <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test"> - <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> - <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/> - </target> - <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/> - <target depends="init" name="-pre-debug-fix"> - <fail unless="fix.includes">Must set fix.includes</fail> - <property name="javac.includes" value="${fix.includes}.java"/> - </target> - <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix"> - <j2seproject1:nbjpdareload/> - </target> - <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/> - <!-- - ================= - PROFILING SECTION - ================= - --> - <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile"> - <nbprofiledirect> - <classpath> - <path path="${run.classpath}"/> - </classpath> - </nbprofiledirect> - <profile/> - </target> - <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single"> - <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail> - <nbprofiledirect> - <classpath> - <path path="${run.classpath}"/> - </classpath> - </nbprofiledirect> - <profile classname="${profile.class}"/> - </target> - <!-- - ========================= - APPLET PROFILING SECTION - ========================= - --> - <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet"> - <nbprofiledirect> - <classpath> - <path path="${run.classpath}"/> - </classpath> - </nbprofiledirect> - <profile classname="sun.applet.AppletViewer"> - <customize> - <arg value="${applet.url}"/> - </customize> - </profile> - </target> - <!-- - ========================= - TESTS PROFILING SECTION - ========================= - --> - <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single"> - <nbprofiledirect> - <classpath> - <path path="${run.test.classpath}"/> - </classpath> - </nbprofiledirect> - <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true"> - <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> - <jvmarg value="${profiler.info.jvmargs.agent}"/> - <jvmarg line="${profiler.info.jvmargs}"/> - <test name="${profile.class}"/> - <classpath> - <path path="${run.test.classpath}"/> - </classpath> - <syspropertyset> - <propertyref prefix="test-sys-prop."/> - <mapper from="test-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - <formatter type="brief" usefile="false"/> - <formatter type="xml"/> - </junit> - </target> - <!-- - =============== - JAVADOC SECTION - =============== - --> - <target depends="init" if="have.sources" name="-javadoc-build"> - <mkdir dir="${dist.javadoc.dir}"/> - <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"> - <classpath> - <path path="${javac.classpath}"/> - </classpath> - <fileset dir="${src.dir}" excludes="*.java,${excludes}" includes="${includes}"> - <filename name="**/*.java"/> - </fileset> - <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> - <include name="**/*.java"/> - <exclude name="*.java"/> - </fileset> - </javadoc> - <copy todir="${dist.javadoc.dir}"> - <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> - <filename name="**/doc-files/**"/> - </fileset> - <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> - <include name="**/doc-files/**"/> - </fileset> - </copy> - </target> - <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview"> - <nbbrowse file="${dist.javadoc.dir}/index.html"/> - </target> - <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/> - <!-- - ========================= - JUNIT COMPILATION SECTION - ========================= - --> - <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test"> - <mkdir dir="${build.test.classes.dir}"/> - </target> - <target name="-pre-compile-test"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target if="do.depend.true" name="-compile-test-depend"> - <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/> - </target> - <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test"> - <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/> - <copy todir="${build.test.classes.dir}"> - <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> - </copy> - </target> - <target name="-post-compile-test"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/> - <target name="-pre-compile-test-single"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single"> - <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> - <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/> - <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/> - <copy todir="${build.test.classes.dir}"> - <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> - </copy> - </target> - <target name="-post-compile-test-single"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/> - <!-- - ======================= - JUNIT EXECUTION SECTION - ======================= - --> - <target depends="init" if="have.tests" name="-pre-test-run"> - <mkdir dir="${build.test.results.dir}"/> - </target> - <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run"> - <j2seproject3:junit testincludes="**/*Test.java"/> - </target> - <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run"> - <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> - </target> - <target depends="init" if="have.tests" name="test-report"/> - <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/> - <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/> - <target depends="init" if="have.tests" name="-pre-test-run-single"> - <mkdir dir="${build.test.results.dir}"/> - </target> - <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single"> - <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> - <j2seproject3:junit excludes="" includes="${test.includes}"/> - </target> - <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single"> - <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> - </target> - <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/> - <!-- - ======================= - JUNIT DEBUGGING SECTION - ======================= - --> - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test"> - <fail unless="test.class">Must select one file in the IDE or set test.class</fail> - <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/> - <delete file="${test.report.file}"/> - <mkdir dir="${build.test.results.dir}"/> - <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}"> - <customize> - <syspropertyset> - <propertyref prefix="test-sys-prop."/> - <mapper from="test-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - <arg value="${test.class}"/> - <arg value="showoutput=true"/> - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/> - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/> - </customize> - </j2seproject3:debug> - </target> - <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test"> - <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/> - </target> - <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/> - <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test"> - <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/> - </target> - <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/> - <!-- - ========================= - APPLET EXECUTION SECTION - ========================= - --> - <target depends="init,compile-single" name="run-applet"> - <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> - <j2seproject1:java classname="sun.applet.AppletViewer"> - <customize> - <arg value="${applet.url}"/> - </customize> - </j2seproject1:java> - </target> - <!-- - ========================= - APPLET DEBUGGING SECTION - ========================= - --> - <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet"> - <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> - <j2seproject3:debug classname="sun.applet.AppletViewer"> - <customize> - <arg value="${applet.url}"/> - </customize> - </j2seproject3:debug> - </target> - <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/> - <!-- - =============== - CLEANUP SECTION - =============== - --> - <target name="-deps-clean-init" unless="built-clean.properties"> - <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/> - <delete file="${built-clean.properties}" quiet="true"/> - </target> - <target if="already.built.clean.${basedir}" name="-warn-already-built-clean"> - <echo level="warn" message="Cycle detected: EssentialsPermissionsCommands was already built"/> - </target> - <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps"> - <mkdir dir="${build.dir}"/> - <touch file="${built-clean.properties}" verbose="false"/> - <property file="${built-clean.properties}" prefix="already.built.clean."/> - <antcall target="-warn-already-built-clean"/> - <propertyfile file="${built-clean.properties}"> - <entry key="${basedir}" value=""/> - </propertyfile> - <antcall target="-maybe-call-dep"> - <param name="call.built.properties" value="${built-clean.properties}"/> - <param location="${project.Essentials}" name="call.subproject"/> - <param location="${project.Essentials}/build.xml" name="call.script"/> - <param name="call.target" value="clean"/> - <param name="transfer.built-clean.properties" value="${built-clean.properties}"/> - </antcall> - </target> - <target depends="init" name="-do-clean"> - <delete dir="${build.dir}"/> - <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/> - </target> - <target name="-post-clean"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/> - <target name="-check-call-dep"> - <property file="${call.built.properties}" prefix="already.built."/> - <condition property="should.call.dep"> - <not> - <isset property="already.built.${call.subproject}"/> - </not> - </condition> - </target> - <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep"> - <ant antfile="${call.script}" inheritall="false" target="${call.target}"> - <propertyset> - <propertyref prefix="transfer."/> - <mapper from="transfer.*" to="*" type="glob"/> - </propertyset> - </ant> - </target> -</project> diff --git a/EssentialsPermissionsCommands/nbproject/genfiles.properties b/EssentialsPermissionsCommands/nbproject/genfiles.properties deleted file mode 100644 index f8c79511e..000000000 --- a/EssentialsPermissionsCommands/nbproject/genfiles.properties +++ /dev/null @@ -1,8 +0,0 @@ -build.xml.data.CRC32=9c3a069f -build.xml.script.CRC32=0a912bb3 -build.xml.stylesheet.CRC32=28e38971@1.43.1.45 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=9c3a069f -nbproject/build-impl.xml.script.CRC32=2a10b0d4 -nbproject/build-impl.xml.stylesheet.CRC32=0ae3a408@1.44.1.45 diff --git a/EssentialsPermissionsCommands/nbproject/project.properties b/EssentialsPermissionsCommands/nbproject/project.properties deleted file mode 100644 index 9ce9cd6ae..000000000 --- a/EssentialsPermissionsCommands/nbproject/project.properties +++ /dev/null @@ -1,125 +0,0 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -application.title=EssentialsPermissionsCommands -application.vendor= -auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true -auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=2 -auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=2 -auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=2 -auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=120 -auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none -auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineAnnotationArgs=true -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineArrayInit=true -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineAssignment=true -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineBinaryOp=true -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineCallArgs=true -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineDisjunctiveCatchTypes=true -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineFor=true -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineImplements=true -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineMethodParams=true -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineParenthesized=true -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineTernaryOp=true -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineThrows=true -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineTryResources=true -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesAfterClassHeader=0 -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesBeforeClass=2 -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=false -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width=4 -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indentCasesFromSwitch=false -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement=NEW_LINE -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement=NEW_LINE -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeCatchOnNewLine=true -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeElseOnNewLine=true -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeFinallyOnNewLine=true -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeWhileOnNewLine=true -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceAfterTypeCast=false -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab=4 -auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size=4 -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.test.classpath=\ - ${run.test.classpath} -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/EssentialsPermissionsCommands.jar -dist.javadoc.dir=${dist.dir}/javadoc -endorsed.classpath= -excludes= -file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar=../lib/bukkit-1.0.0-R1-SNAPSHOT.jar -file.reference.Permissions3.jar=../lib/Permissions3.jar -includes=** -jar.archive.disabled=${jnlp.enabled} -jar.compress=true -jar.index=${jnlp.enabled} -javac.classpath=\ - ${reference.Essentials.jar}:\ - ${file.reference.Permissions3.jar}:\ - ${file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar} -# Space-separated list of extra javac options -javac.compilerargs= -javac.deprecation=false -javac.processorpath=\ - ${javac.classpath} -javac.source=1.6 -javac.target=1.6 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -jnlp.codebase.type=no.codebase -jnlp.descriptor=application -jnlp.enabled=false -jnlp.mixed.code=default -jnlp.offline-allowed=false -jnlp.signed=false -jnlp.signing= -jnlp.signing.alias= -jnlp.signing.keystore= -main.class= -manifest.file=manifest.mf -meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=true -platform.active=default_platform -project.Essentials=../Essentials -reference.Essentials.jar=${project.Essentials}/dist/Essentials.jar -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -# Space-separated list of JVM arguments used when running the project -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value -# or test-sys-prop.name=value to set system properties for unit tests): -run.jvmargs= -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -source.encoding=UTF-8 -src.dir=src -test.src.dir=test diff --git a/EssentialsPermissionsCommands/nbproject/project.xml b/EssentialsPermissionsCommands/nbproject/project.xml deleted file mode 100644 index 89e773c31..000000000 --- a/EssentialsPermissionsCommands/nbproject/project.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://www.netbeans.org/ns/project/1"> - <type>org.netbeans.modules.java.j2seproject</type> - <configuration> - <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> - <name>EssentialsPermissionsCommands</name> - <source-roots> - <root id="src.dir"/> - </source-roots> - <test-roots> - <root id="test.src.dir"/> - </test-roots> - </data> - <libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1"> - <definitions>../lib/nblibraries.properties</definitions> - </libraries> - <references xmlns="http://www.netbeans.org/ns/ant-project-references/1"> - <reference> - <foreign-project>Essentials</foreign-project> - <artifact-type>jar</artifact-type> - <script>build.xml</script> - <target>jar</target> - <clean-target>clean</clean-target> - <id>jar</id> - </reference> - </references> - </configuration> -</project> diff --git a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangadd.java b/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangadd.java deleted file mode 100644 index 8c22dabdc..000000000 --- a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangadd.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.earth2me.essentials.permissions; - -import com.earth2me.essentials.commands.EssentialsCommand; -import com.earth2me.essentials.commands.NotEnoughArgumentsException; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; - - -public class Commandmangadd extends EssentialsCommand -{ - public Commandmangadd() - { - super("mangadd"); - } - - @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - if (args.length < 1) - { - throw new NotEnoughArgumentsException(); - } - final String group = args[0]; - String command = "permissions g:" + group + " create"; - sender.sendMessage(commandLabel + " is deprecated. Use " + command + " instead."); - ess.getServer().dispatchCommand(sender, command); - } - - -} diff --git a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangaddi.java b/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangaddi.java deleted file mode 100644 index 760b5c81f..000000000 --- a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangaddi.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.earth2me.essentials.permissions; - -import com.earth2me.essentials.commands.EssentialsCommand; -import com.earth2me.essentials.commands.NotEnoughArgumentsException; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; - - -public class Commandmangaddi extends EssentialsCommand -{ - public Commandmangaddi() - { - super("mangaddi"); - } - - @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - if (args.length < 2) - { - throw new NotEnoughArgumentsException(); - } - final String target = args[0]; - final String group = args[1]; - String command = "permissions g:"+target+" parents add "+group; - sender.sendMessage(commandLabel + " is deprecated. Use " + command + " instead."); - ess.getServer().dispatchCommand(sender, command); - } - - -} diff --git a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangaddp.java b/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangaddp.java deleted file mode 100644 index e83de4e50..000000000 --- a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangaddp.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.earth2me.essentials.permissions; - -import com.earth2me.essentials.commands.EssentialsCommand; -import com.earth2me.essentials.commands.NotEnoughArgumentsException; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; - - -public class Commandmangaddp extends EssentialsCommand -{ - public Commandmangaddp() - { - super("mangaddp"); - } - - @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - if (args.length < 2) - { - throw new NotEnoughArgumentsException(); - } - final String target = args[0]; - final String perm = args[1]; - String command = "permissions g:"+target+" perms add "+perm; - sender.sendMessage(commandLabel + " is deprecated. Use " + command + " instead."); - ess.getServer().dispatchCommand(sender, command); - } - - -} diff --git a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangcheckp.java b/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangcheckp.java deleted file mode 100644 index 1152d1a0b..000000000 --- a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangcheckp.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.earth2me.essentials.permissions; - -import com.earth2me.essentials.commands.EssentialsCommand; -import com.earth2me.essentials.commands.NotEnoughArgumentsException; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; - - -public class Commandmangcheckp extends EssentialsCommand -{ - public Commandmangcheckp() - { - super("mangcheckp"); - } - - @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - if (args.length < 2) - { - throw new NotEnoughArgumentsException(); - } - final String target = args[0]; - final String perm = args[1]; - String command = "permissions g:"+target+" has "+perm; - sender.sendMessage(commandLabel + " is deprecated. Use " + command + " instead."); - ess.getServer().dispatchCommand(sender, command); - } - - -} diff --git a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangdel.java b/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangdel.java deleted file mode 100644 index 24ffe2307..000000000 --- a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangdel.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.earth2me.essentials.permissions; - -import com.earth2me.essentials.commands.EssentialsCommand; -import com.earth2me.essentials.commands.NotEnoughArgumentsException; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; - - -public class Commandmangdel extends EssentialsCommand -{ - public Commandmangdel() - { - super("mangdel"); - } - - @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - if (args.length < 1) - { - throw new NotEnoughArgumentsException(); - } - final String group = args[0]; - String command = "permissions g:"+group+" delete"; - sender.sendMessage(commandLabel + " is deprecated. Use " + command + " instead."); - ess.getServer().dispatchCommand(sender, command); - } - - -} diff --git a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangdeli.java b/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangdeli.java deleted file mode 100644 index aea296735..000000000 --- a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangdeli.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.earth2me.essentials.permissions; - -import com.earth2me.essentials.commands.EssentialsCommand; -import com.earth2me.essentials.commands.NotEnoughArgumentsException; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; - - -public class Commandmangdeli extends EssentialsCommand -{ - public Commandmangdeli() - { - super("mangdeli"); - } - - @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - if (args.length < 2) - { - throw new NotEnoughArgumentsException(); - } - final String target = args[0]; - final String group = args[1]; - String command = "permissions g:"+target+" parents remove "+group; - sender.sendMessage(commandLabel + " is deprecated. Use " + command + " instead."); - ess.getServer().dispatchCommand(sender, command); - } - - -} diff --git a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangdelp.java b/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangdelp.java deleted file mode 100644 index ef1dd4207..000000000 --- a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmangdelp.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.earth2me.essentials.permissions; - -import com.earth2me.essentials.commands.EssentialsCommand; -import com.earth2me.essentials.commands.NotEnoughArgumentsException; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; - - -public class Commandmangdelp extends EssentialsCommand -{ - public Commandmangdelp() - { - super("mangdelp"); - } - - @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - if (args.length < 2) - { - throw new NotEnoughArgumentsException(); - } - final String target = args[0]; - final String perm = args[1]; - String command = "permissions g:"+target+" perms remove "+perm; - sender.sendMessage(commandLabel + " is deprecated. Use " + command + " instead."); - ess.getServer().dispatchCommand(sender, command); - } - - -} diff --git a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanglistp.java b/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanglistp.java deleted file mode 100644 index 715f42774..000000000 --- a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanglistp.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.earth2me.essentials.permissions; - -import com.earth2me.essentials.commands.EssentialsCommand; -import com.earth2me.essentials.commands.NotEnoughArgumentsException; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; - - -public class Commandmanglistp extends EssentialsCommand -{ - public Commandmanglistp() - { - super("manglistp"); - } - - @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - if (args.length < 1) - { - throw new NotEnoughArgumentsException(); - } - final String target = args[0]; - String command = "permissions g:"+target+" perms list"; - sender.sendMessage(commandLabel + " is deprecated. Use " + command + " instead."); - ess.getServer().dispatchCommand(sender, command); - } - - -} diff --git a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanload.java b/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanload.java deleted file mode 100644 index 390cb78eb..000000000 --- a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanload.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.earth2me.essentials.permissions; - -import com.earth2me.essentials.commands.EssentialsCommand; -import com.earth2me.essentials.commands.NotEnoughArgumentsException; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; - - -public class Commandmanload extends EssentialsCommand -{ - public Commandmanload() - { - super("manload"); - } - - @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - String world = "all"; - if (args.length > 1) - { - world = args[0]; - } - String command = "permissions -reload "+world; - sender.sendMessage(commandLabel + " is deprecated. Use " + command + " instead."); - ess.getServer().dispatchCommand(sender, command); - } - - -} diff --git a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanuadd.java b/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanuadd.java deleted file mode 100644 index a63a1a36b..000000000 --- a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanuadd.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.earth2me.essentials.permissions; - -import com.earth2me.essentials.commands.EssentialsCommand; -import com.earth2me.essentials.commands.NotEnoughArgumentsException; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; - - -public class Commandmanuadd extends EssentialsCommand -{ - public Commandmanuadd() - { - super("manuadd"); - } - - @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - if (args.length < 2) - { - throw new NotEnoughArgumentsException(); - } - final String player = args[0]; - final String group = args[1]; - //TODO: Make this command add a player if it doesnt exist /permissions +player+ create - String command = "permissions "+player+" parents add "+group; - sender.sendMessage(commandLabel + " is deprecated. Use " + command + " instead."); - ess.getServer().dispatchCommand(sender, command); - } - - -} diff --git a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanuaddp.java b/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanuaddp.java deleted file mode 100644 index 3d3d67c72..000000000 --- a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanuaddp.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.earth2me.essentials.permissions; - -import com.earth2me.essentials.commands.EssentialsCommand; -import com.earth2me.essentials.commands.NotEnoughArgumentsException; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; - - -public class Commandmanuaddp extends EssentialsCommand -{ - public Commandmanuaddp() - { - super("manuaddp"); - } - - @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - if (args.length < 2) - { - throw new NotEnoughArgumentsException(); - } - final String player = args[0]; - final String perm = args[1]; - String command = "permissions "+player+" perms add "+perm; - sender.sendMessage(commandLabel + " is deprecated. Use " + command + " instead."); - ess.getServer().dispatchCommand(sender, command); - } - - -} diff --git a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanuaddsub.java b/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanuaddsub.java deleted file mode 100644 index 60d1980af..000000000 --- a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanuaddsub.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.earth2me.essentials.permissions; - -import com.earth2me.essentials.commands.EssentialsCommand; -import com.earth2me.essentials.commands.NotEnoughArgumentsException; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; - - -public class Commandmanuaddsub extends EssentialsCommand -{ - public Commandmanuaddsub() - { - super("manuaddsub"); - } - - @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - if (args.length < 2) - { - throw new NotEnoughArgumentsException(); - } - final String player = args[0]; - final String group = args[1]; - String command = "permissions "+player+" parents add "+group; - sender.sendMessage(commandLabel + " is deprecated. Use " + command + " instead."); - ess.getServer().dispatchCommand(sender, command); - } - - -} diff --git a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanucheckp.java b/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanucheckp.java deleted file mode 100644 index 634b447c7..000000000 --- a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanucheckp.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.earth2me.essentials.permissions; - -import com.earth2me.essentials.commands.EssentialsCommand; -import com.earth2me.essentials.commands.NotEnoughArgumentsException; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; - - -public class Commandmanucheckp extends EssentialsCommand -{ - public Commandmanucheckp() - { - super("manucheckp"); - } - - @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - if (args.length < 2) - { - throw new NotEnoughArgumentsException(); - } - final String player = args[0]; - final String perm = args[1]; - String command = "permissions "+player+" has "+perm; - sender.sendMessage(commandLabel + " is deprecated. Use " + command + " instead."); - ess.getServer().dispatchCommand(sender, command); - } - - -} diff --git a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanudel.java b/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanudel.java deleted file mode 100644 index 72c8fc2af..000000000 --- a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanudel.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.earth2me.essentials.permissions; - -import com.earth2me.essentials.commands.EssentialsCommand; -import com.earth2me.essentials.commands.NotEnoughArgumentsException; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; - - -public class Commandmanudel extends EssentialsCommand -{ - public Commandmanudel() - { - super("manudel"); - } - - @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - if (args.length < 1) - { - throw new NotEnoughArgumentsException(); - } - final String player = args[0]; - String command = "permissions "+player+" delete"; - sender.sendMessage(commandLabel + " is deprecated. Use " + command + " instead."); - ess.getServer().dispatchCommand(sender, command); - } - - -} diff --git a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanudelp.java b/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanudelp.java deleted file mode 100644 index 01adf97b2..000000000 --- a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanudelp.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.earth2me.essentials.permissions; - -import com.earth2me.essentials.commands.EssentialsCommand; -import com.earth2me.essentials.commands.NotEnoughArgumentsException; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; - - -public class Commandmanudelp extends EssentialsCommand -{ - public Commandmanudelp() - { - super("manudelp"); - } - - @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - if (args.length < 2) - { - throw new NotEnoughArgumentsException(); - } - final String player = args[0]; - final String perm = args[1]; - String command = "permissions "+player+" perms remove "+perm; - sender.sendMessage(commandLabel + " is deprecated. Use " + command + " instead."); - ess.getServer().dispatchCommand(sender, command); - } - - -} diff --git a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanudelsub.java b/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanudelsub.java deleted file mode 100644 index 1a1ae2a6d..000000000 --- a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanudelsub.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.earth2me.essentials.permissions; - -import com.earth2me.essentials.commands.EssentialsCommand; -import com.earth2me.essentials.commands.NotEnoughArgumentsException; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; - - -public class Commandmanudelsub extends EssentialsCommand -{ - public Commandmanudelsub() - { - super("manudelsub"); - } - - @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - if (args.length < 2) - { - throw new NotEnoughArgumentsException(); - } - final String player = args[0]; - final String group = args[1]; - String command = "permissions "+player+" parents remove "+group; - sender.sendMessage(commandLabel + " is deprecated. Use " + command + " instead."); - ess.getServer().dispatchCommand(sender, command); - } - - -} diff --git a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanulistp.java b/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanulistp.java deleted file mode 100644 index f809f3c61..000000000 --- a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/Commandmanulistp.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.earth2me.essentials.permissions; - -import com.earth2me.essentials.commands.EssentialsCommand; -import com.earth2me.essentials.commands.NotEnoughArgumentsException; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; - - -public class Commandmanulistp extends EssentialsCommand -{ - public Commandmanulistp() - { - super("manulistp"); - } - - @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - if (args.length < 1) - { - throw new NotEnoughArgumentsException(); - } - final String player = args[0]; - String command = "permissions "+player+" perms list"; - sender.sendMessage(commandLabel + " is deprecated. Use " + command + " instead."); - ess.getServer().dispatchCommand(sender, command); - } - - -} diff --git a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/EssentialsPermissionsCommands.java b/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/EssentialsPermissionsCommands.java deleted file mode 100644 index 14e9a117c..000000000 --- a/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/EssentialsPermissionsCommands.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.earth2me.essentials.permissions; - -import com.earth2me.essentials.IEssentials; -import com.earth2me.essentials.Util; -import com.nijiko.permissions.PermissionHandler; -import com.nijikokun.bukkit.Permissions.Permissions; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.PluginManager; -import org.bukkit.plugin.java.JavaPlugin; - - -public class EssentialsPermissionsCommands extends JavaPlugin -{ - private static PermissionHandler permissionHandler = null; - private static final Logger LOGGER = Logger.getLogger("Minecraft"); - private IEssentials ess; - - public static PermissionHandler getPermissionHandler() - { - return permissionHandler; - } - - @Override - public void onEnable() - { - final PluginManager pluginManager = getServer().getPluginManager(); - final Plugin permissionsPlugin = pluginManager.getPlugin("Permissions"); - - if (permissionsPlugin != null - && permissionsPlugin.getDescription().getVersion().charAt(0) == '3') - { - permissionHandler = ((Permissions)permissionsPlugin).getHandler(); - } - ess = (IEssentials)pluginManager.getPlugin("Essentials"); - - if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) { - LOGGER.log(Level.WARNING, Util.i18n("versionMismatchAll")); - } - LOGGER.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team")); - - } - - @Override - public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) - { - return ess.onCommandEssentials(sender, command, label, args, EssentialsPermissionsCommands.class.getClassLoader(), "com.earth2me.essentials.permissions.Command", "groupmanager."); - } - - @Override - public void onDisable() - { - } -} diff --git a/EssentialsPermissionsCommands/src/plugin.yml b/EssentialsPermissionsCommands/src/plugin.yml deleted file mode 100644 index a13023a5c..000000000 --- a/EssentialsPermissionsCommands/src/plugin.yml +++ /dev/null @@ -1,166 +0,0 @@ -# This determines the command prefix when there are conflicts (/name:home, /name:help, etc.) -name: EssentialsPermissionsCommands -main: com.earth2me.essentials.permissions.EssentialsPermissionsCommands -# Note to developers: This next line cannot change, or the automatic versioning system will break. -version: TeamCity -website: http://www.earth2me.net:8001/ -description: Adds commands aliases to Permissions 3 -authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology] -depend: [Permissions, Essentials] -commands: - manuadd: - description: Move a player to desired group.(Adds to the file if not exists) - usage: /<command> <player> <group> - permission: groupmanager.manuadd - manudel: - description: Remove any user specific configuration. Make him default group. - usage: /<command> <player> - permission: groupmanager.manudel - manuaddsub: - description: Add a group to a player's subgroup list. - usage: /<command> <player> <group> - permission: groupmanager.manuaddsub - manudelsub: - description: Remove a group to a player's subgroup list. - usage: /<command> <player> <group> - permission: groupmanager.manudelsub - mangadd: - description: Add group to the system. - usage: /<command> <group> - permission: groupmanager.mangadd - mangdel: - description: Removes group from the system(all it's users become default) - usage: /<command> <group> - permission: groupmanager.mangdel - manuaddp: - description: Add permission diretly to the player. - usage: /<command> <player> <permission> - permission: groupmanager.manuaddp - manudelp: - description: Removes permission diretly from the player. - usage: /<command> <player> <permission> - permission: groupmanager.manudelp - manulistp: - description: List all permissions from a player. - usage: /<command> <player> - permission: groupmanager.manulistp - manucheckp: - description: Verify if user has a permission, and where it comes from. - usage: /<command> <player> <permission> - permission: groupmanager.manucheckp - mangaddp: - description: Add permission to a group. - usage: /<command> <group> <permission> - permission: groupmanager.mangaddp - mangdelp: - description: Removes permission from a group. - usage: /<command> <group> <permission> - permission: groupmanager.mangdelp - manglistp: - description: Lists all permissions from a group. - usage: /<command> <group> - permission: groupmanager.manglistp - mangcheckp: - description: Check if group has a permission, and where it comes from. - usage: /<command> <group> <permission> - permission: groupmanager.mangcheckp - mangaddi: - description: Add a group to another group inheritance list. - usage: /<command> <group1> <group2> - permission: groupmanager.mangaddi - mangdeli: - description: Remove a group from another group inheritance list. - usage: /<command> <group1> <group2> - permission: groupmanager.mangdeli - manuaddv: - description: Add, or replaces, a variable to a user (like prefix or suffix). - usage: /<command> <user> <variable> <value> - permission: groupmanager.manuaddv - manudelv: - description: Remove a variable from a user. - usage: /<command> <user> <variable> - permission: groupmanager.manudelv - manulistv: - description: List variables a user has (like prefix or suffix). - usage: /<command> <user> - permission: groupmanager.manulistv - manucheckv: - description: Verify a value of a variable of user, and where it comes from. - usage: /<command> <user> <variable> - permission: groupmanager.manucheckv - mangaddv: - description: Add, or replaces, a variable to a group (like prefix or suffix). - usage: /<command> <group> <variable> <value> - permission: groupmanager.mangaddv - mangdelv: - description: Remove a variable from a group. - usage: /<command> <group> <variable> - permission: groupmanager.mangdelv - manglistv: - description: List variables a group has (like prefix or suffix). - usage: /<command> <group> - permission: groupmanager.manglistv - mangcheckv: - description: Verify a value of a variable of group, and where it comes from. - usage: /<command> <group> <variable> - permission: groupmanager.mangcheckv - manwhois: - description: Tell the group that user belongs. - usage: /<command> <player> - permission: groupmanager.manwhois - tempadd: - description: Creates a temporary permission copy for that user. - usage: /<command> <player> - permission: groupmanager.tempadd - tempdel: - description: Remove the temporary permission copy for player. - usage: /<command> <player> - permission: groupmanager.tempdel - templist: - description: List players in overload-permissions mode made by /tempadd. - usage: /<command> - permission: groupmanager.templist - tempdelall: - description: Remove all overrides made by command /tempadd. - usage: /<command> - permission: groupmanager.tempdelall - mansave: - description: Save all permissions on file. - usage: /<command> - permission: groupmanager.mansave - manload: - description: Reload current world and config.yml. Or load given world. - usage: /<command> [world] - permission: groupmanager.manload - listgroups: - description: List the groups available. - usage: /<command> - permission: groupmanager.listgroups - manpromote: - description: Promote a player in the same heritage line to a higher rank. - usage: /<command> <player> <group> - permission: groupmanager.manpromote - mandemote: - description: Demote a player in the same heritage line to a lower rank. - usage: /<command> <player> <group> - permission: groupmanager.mandemote - mantogglevalidate: - description: Toggle on/off the validating if player is online. - usage: /<command> - permission: groupmanager.mantogglevalidate - mantogglesave: - description: Toggle on/ff the autosave. - usage: /<command> - permission: groupmanager.mantogglesave - manworld: - description: Prints the selected world name - usage: /<command> - permission: groupmanager.manworld - manselect: - description: Select a world to work with next commands. - usage: /<command> <world> - permission: groupmanager.manselect - manclear: - description: Clear world selection. Next commands will work on your world. - usage: /<command> - permission: groupmanager.manclear diff --git a/EssentialsProtect/MANIFEST.MF b/EssentialsProtect/MANIFEST.MF index db70a3fda..9d885be53 100644 --- a/EssentialsProtect/MANIFEST.MF +++ b/EssentialsProtect/MANIFEST.MF @@ -1,2 +1 @@ Manifest-Version: 1.0 -Class-Path: ../lib/mysql.jar ../lib/sqlite.jar diff --git a/EssentialsProtect/nbproject/project.properties b/EssentialsProtect/nbproject/project.properties index 5e8639402..5224b3af6 100644 --- a/EssentialsProtect/nbproject/project.properties +++ b/EssentialsProtect/nbproject/project.properties @@ -83,8 +83,7 @@ javac.target=1.6 javac.test.classpath=\ ${javac.classpath}:\ ${build.classes.dir}:\ - ${libs.junit.classpath}:\ - ${libs.junit_4.classpath} + ${libs.junit_4.10.classpath} javac.test.processorpath=\ ${javac.test.classpath} javadoc.additionalparam= diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyBlockListener.java new file mode 100644 index 000000000..479d2eda6 --- /dev/null +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyBlockListener.java @@ -0,0 +1,36 @@ +package com.earth2me.essentials.protect; + +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.event.block.BlockIgniteEvent; +import org.bukkit.event.block.BlockListener; + + +public class EmergencyBlockListener extends BlockListener +{ + + @Override + public void onBlockBurn(final BlockBurnEvent event) + { + event.setCancelled(true); + } + + @Override + public void onBlockIgnite(final BlockIgniteEvent event) + { + event.setCancelled(true); + } + + @Override + public void onBlockFromTo(final BlockFromToEvent event) + { + event.setCancelled(true); + } + + @Override + public void onBlockBreak(final BlockBreakEvent event) + { + event.setCancelled(true); + } +} diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyEntityListener.java new file mode 100644 index 000000000..a220f07d5 --- /dev/null +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyEntityListener.java @@ -0,0 +1,22 @@ +package com.earth2me.essentials.protect; + +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.EntityListener; + + +public class EmergencyEntityListener extends EntityListener +{ + + @Override + public void onEntityExplode(final EntityExplodeEvent event) + { + event.setCancelled(true); + } + + @Override + public void onEntityDamage(final EntityDamageEvent event) + { + event.setCancelled(true); + } +} diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyPlayerListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyPlayerListener.java new file mode 100644 index 000000000..e92325946 --- /dev/null +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyPlayerListener.java @@ -0,0 +1,16 @@ +package com.earth2me.essentials.protect; + +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerListener; + + +public class EmergencyPlayerListener extends PlayerListener +{ + + @Override + public void onPlayerJoin(PlayerJoinEvent event) + { + event.getPlayer().sendMessage("Essentials Protect is in emergency mode. Check your log for errors."); + } + +} diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java new file mode 100644 index 000000000..569123cd5 --- /dev/null +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java @@ -0,0 +1,124 @@ +package com.earth2me.essentials.protect; + +import com.earth2me.essentials.IConf; +import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.User; +import com.earth2me.essentials.protect.data.ProtectedBlockMemory; +import com.earth2me.essentials.protect.data.ProtectedBlockMySQL; +import com.earth2me.essentials.protect.data.ProtectedBlockSQLite; +import java.beans.PropertyVetoException; +import static com.earth2me.essentials.I18n._; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; + + +public class EssentialsConnect +{ + private static final Logger LOGGER = Logger.getLogger("Minecraft"); + private final transient IEssentials ess; + private final transient IProtect protect; + + public EssentialsConnect(Plugin essPlugin, Plugin essProtect) + { + if (!essProtect.getDescription().getVersion().equals(essPlugin.getDescription().getVersion())) + { + LOGGER.log(Level.WARNING, _("versionMismatchAll")); + } + ess = (IEssentials)essPlugin; + protect = (IProtect)essProtect; + ProtectReloader pr = new ProtectReloader(); + pr.reloadConfig(); + ess.addReloadListener(pr); + LOGGER.info(_("loadinfo", essProtect.getDescription().getName(), essProtect.getDescription().getVersion(), "essentials team")); + + } + + public void onDisable() + { + } + + public IEssentials getEssentials() + { + return ess; + } + + public void alert(final User user, final String item, final String type) + { + final Location loc = user.getLocation(); + final String warnMessage = _("alertFormat", user.getName(), type, item, + loc.getWorld().getName() + "," + loc.getBlockX() + "," + + loc.getBlockY() + "," + loc.getBlockZ()); + LOGGER.log(Level.WARNING, warnMessage); + for (Player p : ess.getServer().getOnlinePlayers()) + { + final User alertUser = ess.getUser(p); + if (alertUser.isAuthorized("essentials.protect.alerts")) + { + alertUser.sendMessage(warnMessage); + } + } + } + + + private class ProtectReloader implements IConf + { + @Override + public void reloadConfig() + { + if (protect.getStorage() != null) + { + protect.getStorage().onPluginDeactivation(); + } + for (ProtectConfig protectConfig : ProtectConfig.values()) + { + if (protectConfig.isList()) + { + protect.getSettingsList().put(protectConfig, ess.getSettings().getProtectList(protectConfig.getConfigName())); + } + else if (protectConfig.isString()) + { + protect.getSettingsString().put(protectConfig, ess.getSettings().getProtectString(protectConfig.getConfigName())); + } + else + { + protect.getSettingsBoolean().put(protectConfig, ess.getSettings().getProtectBoolean(protectConfig.getConfigName(), protectConfig.getDefaultValueBoolean())); + } + + } + + if (protect.getSettingString(ProtectConfig.datatype).equalsIgnoreCase("mysql")) + { + try + { + protect.setStorage(new ProtectedBlockMySQL( + protect.getSettingString(ProtectConfig.mysqlDB), + protect.getSettingString(ProtectConfig.dbUsername), + protect.getSettingString(ProtectConfig.dbPassword))); + } + catch (PropertyVetoException ex) + { + LOGGER.log(Level.SEVERE, null, ex); + } + } + else + { + try + { + protect.setStorage(new ProtectedBlockSQLite("jdbc:sqlite:plugins/Essentials/EssentialsProtect.db")); + } + catch (PropertyVetoException ex) + { + LOGGER.log(Level.SEVERE, null, ex); + } + } + if (protect.getSettingBool(ProtectConfig.memstore)) + { + protect.setStorage(new ProtectedBlockMemory(protect.getStorage(), protect)); + } + + } + } +} diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java index 897112cb6..e313298cd 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java @@ -1,14 +1,6 @@ package com.earth2me.essentials.protect; -import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.IConf; -import com.earth2me.essentials.IEssentials; -import com.earth2me.essentials.User; import com.earth2me.essentials.protect.data.IProtectedBlock; -import com.earth2me.essentials.protect.data.ProtectedBlockMemory; -import com.earth2me.essentials.protect.data.ProtectedBlockMySQL; -import com.earth2me.essentials.protect.data.ProtectedBlockSQLite; -import java.beans.PropertyVetoException; import java.util.EnumMap; import java.util.List; import java.util.Map; @@ -16,15 +8,15 @@ import java.util.logging.Filter; import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.Logger; -import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.Event.Priority; import org.bukkit.event.Event.Type; +import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; -public class EssentialsProtect extends JavaPlugin implements IConf, IProtect +public class EssentialsProtect extends JavaPlugin implements IProtect { private static final Logger LOGGER = Logger.getLogger("Minecraft"); private static com.mchange.v2.log.MLogger C3P0logger; @@ -32,7 +24,7 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect private final transient Map<ProtectConfig, String> settingsString = new EnumMap<ProtectConfig, String>(ProtectConfig.class); private final transient Map<ProtectConfig, List<Integer>> settingsList = new EnumMap<ProtectConfig, List<Integer>>(ProtectConfig.class); private transient IProtectedBlock storage = null; - public transient IEssentials ess = null; + private transient EssentialsConnect ess = null; @Override public void onLoad() @@ -50,7 +42,13 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect public void onEnable() { final PluginManager pm = this.getServer().getPluginManager(); - ess = (IEssentials)pm.getPlugin("Essentials"); + final Plugin essPlugin = pm.getPlugin("Essentials"); + if (essPlugin == null || !essPlugin.isEnabled()) + { + enableEmergencyMode(pm); + return; + } + ess = new EssentialsConnect(essPlugin, this); final EssentialsProtectPlayerListener playerListener = new EssentialsProtectPlayerListener(this); pm.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.Low, this); @@ -76,14 +74,25 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect pm.registerEvent(Type.LIGHTNING_STRIKE, weatherListener, Priority.Highest, this); pm.registerEvent(Type.THUNDER_CHANGE, weatherListener, Priority.Highest, this); pm.registerEvent(Type.WEATHER_CHANGE, weatherListener, Priority.Highest, this); + } - reloadConfig(); - ess.addReloadListener(this); - if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) + private void enableEmergencyMode(final PluginManager pm) + { + final EmergencyBlockListener emBlockListener = new EmergencyBlockListener(); + final EmergencyEntityListener emEntityListener = new EmergencyEntityListener(); + final EmergencyPlayerListener emPlayerListener = new EmergencyPlayerListener(); + pm.registerEvent(Type.PLAYER_JOIN, emPlayerListener, Priority.Low, this); + pm.registerEvent(Type.BLOCK_BURN, emBlockListener, Priority.Low, this); + pm.registerEvent(Type.BLOCK_IGNITE, emBlockListener, Priority.Low, this); + pm.registerEvent(Type.BLOCK_FROMTO, emBlockListener, Priority.Low, this); + pm.registerEvent(Type.BLOCK_BREAK, emBlockListener, Priority.Low, this); + pm.registerEvent(Type.ENTITY_DAMAGE, emEntityListener, Priority.Low, this); + pm.registerEvent(Type.ENTITY_EXPLODE, emEntityListener, Priority.Low, this); + for (Player player : getServer().getOnlinePlayers()) { - LOGGER.log(Level.WARNING, _("versionMismatchAll")); + player.sendMessage("Essentials Protect is in emergency mode. Check your log for errors."); } - LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team")); + LOGGER.log(Level.SEVERE, "Essentials not installed or failed to load. Essenials Protect is in emergency mode now."); } @Override @@ -94,81 +103,35 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect } @Override - public void alert(final User user, final String item, final String type) + public IProtectedBlock getStorage() { - final Location loc = user.getLocation(); - final String warnMessage = _("alertFormat", user.getName(), type, item, - loc.getWorld().getName() + "," + loc.getBlockX() + "," - + loc.getBlockY() + "," + loc.getBlockZ()); - LOGGER.log(Level.WARNING, warnMessage); - for (Player p : this.getServer().getOnlinePlayers()) - { - final User alertUser = ess.getUser(p); - if (alertUser.isAuthorized("essentials.protect.alerts")) - { - alertUser.sendMessage(warnMessage); - } - } + return storage; } - public void reloadConfig() + @Override + public void setStorage(IProtectedBlock pb) { - if (storage != null) - { - storage.onPluginDeactivation(); - } - for (ProtectConfig protectConfig : ProtectConfig.values()) - { - if (protectConfig.isList()) - { - settingsList.put(protectConfig, ess.getSettings().getProtectList(protectConfig.getConfigName())); - } - else if (protectConfig.isString()) - { - settingsString.put(protectConfig, ess.getSettings().getProtectString(protectConfig.getConfigName())); - } - else - { - settingsBoolean.put(protectConfig, ess.getSettings().getProtectBoolean(protectConfig.getConfigName(), protectConfig.getDefaultValueBoolean())); - } + storage = pb; + } - } + public EssentialsConnect getEssentialsConnect() + { + return ess; + } + + public Map<ProtectConfig, Boolean> getSettingsBoolean() + { + return settingsBoolean; + } - if (getSettingString(ProtectConfig.datatype).equalsIgnoreCase("mysql")) - { - try - { - storage = new ProtectedBlockMySQL( - getSettingString(ProtectConfig.mysqlDB), - getSettingString(ProtectConfig.dbUsername), - getSettingString(ProtectConfig.dbPassword)); - } - catch (PropertyVetoException ex) - { - LOGGER.log(Level.SEVERE, null, ex); - } - } - else - { - try - { - storage = new ProtectedBlockSQLite("jdbc:sqlite:plugins/Essentials/EssentialsProtect.db"); - } - catch (PropertyVetoException ex) - { - LOGGER.log(Level.SEVERE, null, ex); - } - } - if (getSettingBool(ProtectConfig.memstore)) - { - storage = new ProtectedBlockMemory(storage, this); - } + public Map<ProtectConfig, String> getSettingsString() + { + return settingsString; } - @Override - public IProtectedBlock getStorage() + public Map<ProtectConfig, List<Integer>> getSettingsList() { - return storage; + return settingsList; } @Override @@ -200,9 +163,4 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect { } } - - public IEssentials getEssentials() - { - return ess; - } } diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java index a14925ccd..03ad19cb4 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java @@ -20,7 +20,7 @@ public class EssentialsProtectBlockListener extends BlockListener public EssentialsProtectBlockListener(final IProtect parent) { this.prot = parent; - this.ess = prot.getEssentials(); + this.ess = prot.getEssentialsConnect().getEssentials(); } @Override @@ -50,7 +50,7 @@ public class EssentialsProtectBlockListener extends BlockListener if (prot.checkProtectionItems(ProtectConfig.alert_on_placement, id)) { - prot.alert(user, blockPlaced.getType().toString(), _("alertPlaced")); + prot.getEssentialsConnect().alert(user, blockPlaced.getType().toString(), _("alertPlaced")); } final Block below = blockPlaced.getRelative(BlockFace.DOWN); @@ -248,7 +248,7 @@ public class EssentialsProtectBlockListener extends BlockListener if (prot.checkProtectionItems(ProtectConfig.alert_on_break, typeId)) { - prot.alert(user, type.toString(), _("alertBroke")); + prot.getEssentialsConnect().alert(user, type.toString(), _("alertBroke")); } final IProtectedBlock storage = prot.getStorage(); diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java index cd054d732..89167b2b9 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java @@ -21,7 +21,7 @@ public class EssentialsProtectEntityListener extends EntityListener public EssentialsProtectEntityListener(final IProtect prot) { this.prot = prot; - this.ess = prot.getEssentials(); + this.ess = prot.getEssentialsConnect().getEssentials(); } @Override @@ -32,13 +32,13 @@ public class EssentialsProtectEntityListener extends EntityListener return; } final Entity target = event.getEntity(); - + if (target instanceof Villager && prot.getSettingBool(ProtectConfig.prevent_villager_death)) { event.setCancelled(true); return; } - + final User user = ess.getUser(target); if (event instanceof EntityDamageByBlockEvent) { @@ -197,12 +197,23 @@ public class EssentialsProtectEntityListener extends EntityListener return; } final int maxHeight = ess.getSettings().getProtectCreeperMaxHeight(); - //Nicccccccccce plaaacccccccccce.. - if (event.getEntity() instanceof LivingEntity - && (prot.getSettingBool(ProtectConfig.prevent_creeper_explosion) - || prot.getSettingBool(ProtectConfig.prevent_creeper_blockdmg) - || (maxHeight >= 0 && event.getLocation().getBlockY() > maxHeight))) + + if (event.getEntity() instanceof EnderDragon + && prot.getSettingBool(ProtectConfig.prevent_enderdragon_blockdmg)) + { + if (prot.getSettingBool(ProtectConfig.enderdragon_fakeexplosions)) + { + FakeExplosion.createExplosion(event, ess.getServer(), ess.getServer().getOnlinePlayers()); + } + event.setCancelled(true); + return; + } + else if (event.getEntity() instanceof Creeper + && (prot.getSettingBool(ProtectConfig.prevent_creeper_explosion) + || prot.getSettingBool(ProtectConfig.prevent_creeper_blockdmg) + || (maxHeight >= 0 && event.getLocation().getBlockY() > maxHeight))) { + //Nicccccccccce plaaacccccccccce.. FakeExplosion.createExplosion(event, ess.getServer(), ess.getServer().getOnlinePlayers()); event.setCancelled(true); return; diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java index 98daecb97..ad7831a53 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java @@ -19,7 +19,7 @@ public class EssentialsProtectPlayerListener extends PlayerListener public EssentialsProtectPlayerListener(final IProtect prot) { this.prot = prot; - this.ess = prot.getEssentials(); + this.ess = prot.getEssentialsConnect().getEssentials(); } @Override @@ -83,7 +83,7 @@ public class EssentialsProtectPlayerListener extends PlayerListener if (item != null && prot.checkProtectionItems(ProtectConfig.alert_on_use, item.getTypeId())) { - prot.alert(user, item.getType().toString(), _("alertUsed")); + prot.getEssentialsConnect().alert(user, item.getType().toString(), _("alertUsed")); } } } diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java index ac095e33d..afcb6e8ce 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java @@ -1,14 +1,13 @@ package com.earth2me.essentials.protect; -import com.earth2me.essentials.IEssentials; -import com.earth2me.essentials.User; import com.earth2me.essentials.protect.data.IProtectedBlock; +import java.util.List; +import java.util.Map; +import org.bukkit.plugin.Plugin; -public interface IProtect +public interface IProtect extends Plugin { - void alert(final User user, final String item, final String type); - boolean checkProtectionItems(final ProtectConfig list, final int id); boolean getSettingBool(final ProtectConfig protectConfig); @@ -17,5 +16,13 @@ public interface IProtect IProtectedBlock getStorage(); - IEssentials getEssentials(); + void setStorage(IProtectedBlock pb); + + EssentialsConnect getEssentialsConnect(); + + Map<ProtectConfig, Boolean> getSettingsBoolean(); + + Map<ProtectConfig, String> getSettingsString(); + + Map<ProtectConfig, List<Integer>> getSettingsList(); } diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java index 817ad66af..bee8d0f4d 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java @@ -41,11 +41,13 @@ public enum ProtectConfig prevent_creeper_blockdmg("protect.prevent.creeper-blockdamage", false), prevent_enderman_pickup("protect.prevent.enderman-pickup", false), prevent_villager_death("protect.prevent.villager-death", false), + prevent_enderdragon_blockdmg("protect.prevent.enderdragon-blockdamage", true), prevent_entitytarget("protect.prevent.entitytarget", false), protect_rails("protect.protect.rails", true), protect_below_rails("protect.protect.block-below", true), protect_signs("protect.protect.signs", true), protect_against_signs("protect.protect.block-below", true), + enderdragon_fakeexplosions("protect.enderdragon-fakeexplosions", false), alert_on_placement("protect.alert.on-placement"), alert_on_use("protect.alert.on-use"), alert_on_break("protect.alert.on-break"), diff --git a/EssentialsProtect/src/plugin.yml b/EssentialsProtect/src/plugin.yml index 31fc1ae99..770d51e64 100644 --- a/EssentialsProtect/src/plugin.yml +++ b/EssentialsProtect/src/plugin.yml @@ -6,4 +6,4 @@ version: TeamCity website: http://www.earth2me.net:8001/ description: Provides protection for various parts of the world. authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology] -depend: [Essentials]
\ No newline at end of file +softdepend: [Essentials]
\ No newline at end of file diff --git a/EssentialsSpawn/nbproject/pmd.settings b/EssentialsSpawn/nbproject/pmd.settings new file mode 100644 index 000000000..6a34e356c --- /dev/null +++ b/EssentialsSpawn/nbproject/pmd.settings @@ -0,0 +1 @@ +DoNotUseThreads diff --git a/EssentialsSpawn/nbproject/project.properties b/EssentialsSpawn/nbproject/project.properties index 16c272f09..96f4448ec 100644 --- a/EssentialsSpawn/nbproject/project.properties +++ b/EssentialsSpawn/nbproject/project.properties @@ -79,8 +79,7 @@ javac.target=1.6 javac.test.classpath=\ ${javac.classpath}:\ ${build.classes.dir}:\ - ${libs.junit.classpath}:\ - ${libs.junit_4.classpath} + ${libs.junit_4.10.classpath} javac.test.processorpath=\ ${javac.test.classpath} javadoc.additionalparam= diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java index 33dff8241..c6c89a20d 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java @@ -14,10 +14,10 @@ public class Commandsetspawn extends EssentialsCommand } @Override - public void run(Server server, User user, String commandLabel, String[] args) throws Exception + public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { final String group = args.length > 0 ? getFinalArg(args, 0) : "default"; - ess.getSpawn().setSpawn(user.getLocation(), group); + ((SpawnStorage)module).setSpawn(user.getLocation(), group); user.sendMessage(_("spawnSet", group)); } } diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java index f9ea9fa36..6335d6c69 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java @@ -1,9 +1,14 @@ package com.earth2me.essentials.spawn; +import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import com.earth2me.essentials.commands.EssentialsCommand; +import com.earth2me.essentials.commands.NotEnoughArgumentsException; +import org.bukkit.Location; import org.bukkit.Server; +import org.bukkit.command.CommandSender; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class Commandspawn extends EssentialsCommand @@ -14,10 +19,42 @@ public class Commandspawn extends EssentialsCommand } @Override - public void run(Server server, User user, String commandLabel, String[] args) throws Exception - { + public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception + { final Trade charge = new Trade(this.getName(), ess); charge.isAffordableFor(user); - user.getTeleport().respawn(ess.getSpawn(), charge); + if (args.length > 0 && user.isAuthorized("essentials.spawn.others")) + { + final User otherUser = getPlayer(server, args, 0); + respawn(otherUser, null); + if (!otherUser.equals(user)) + { + otherUser.sendMessage(_("teleportAtoB", user.getDisplayName(), "spawn")); + user.sendMessage(_("teleporting")); + } + } + else + { + respawn(user, null); + } + } + + @Override + protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception + { + if (args.length < 1) + { + throw new NotEnoughArgumentsException(); + } + final User user = getPlayer(server, args, 0); + respawn(user, null); + user.sendMessage(_("teleportAtoB", user.getDisplayName(), "spawn")); + sender.sendMessage(_("teleporting")); + } + + private void respawn (final User user, final Trade charge) throws Exception { + final SpawnStorage spawns = (SpawnStorage)this.module; + final Location spawn = spawns.getSpawn(user.getGroup()); + user.getTeleport().teleport(spawn, charge, TeleportCause.COMMAND); } } diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java index 8ffdb5c97..c4cd7c727 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java @@ -2,8 +2,10 @@ package com.earth2me.essentials.spawn; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.IEssentialsModule; import java.util.logging.Level; import java.util.logging.Logger; +import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.event.Event.Priority; @@ -14,22 +16,31 @@ import org.bukkit.plugin.java.JavaPlugin; public class EssentialsSpawn extends JavaPlugin { - private static final Logger LOGGER = Logger.getLogger("Minecraft"); + private static final Logger LOGGER = Bukkit.getLogger(); private transient IEssentials ess; + private transient SpawnStorage spawns; public void onEnable() { final PluginManager pluginManager = getServer().getPluginManager(); ess = (IEssentials)pluginManager.getPlugin("Essentials"); - final EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener(ess); - pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, Priority.Low, this); - pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Low, this); - - if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) { LOGGER.log(Level.WARNING, _("versionMismatchAll")); } + if (!ess.isEnabled()) + { + this.setEnabled(false); + return; + } + + spawns = new SpawnStorage(ess); + ess.addReloadListener(spawns); + + final EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener(ess, spawns); + pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, ess.getSettings().getRespawnPriority(), this); + pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Low, this); + LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team")); } @@ -38,8 +49,9 @@ public class EssentialsSpawn extends JavaPlugin } @Override - public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) + public boolean onCommand(final CommandSender sender, final Command command, + final String commandLabel, final String[] args) { - return ess.onCommandEssentials(sender, command, commandLabel, args, EssentialsSpawn.class.getClassLoader(), "com.earth2me.essentials.spawn.Command", "essentials."); + return ess.onCommandEssentials(sender, command, commandLabel, args, EssentialsSpawn.class.getClassLoader(), "com.earth2me.essentials.spawn.Command", "essentials.", spawns); } } diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index 57b842c82..530a00faa 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -4,21 +4,24 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; import java.util.logging.Level; -import java.util.logging.Logger; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerListener; import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class EssentialsSpawnPlayerListener extends PlayerListener { private final transient IEssentials ess; + private final transient SpawnStorage spawns; - public EssentialsSpawnPlayerListener(final IEssentials ess) + public EssentialsSpawnPlayerListener(final IEssentials ess, final SpawnStorage spawns) { super(); this.ess = ess; + this.spawns = spawns; } @Override @@ -39,7 +42,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener return; } } - final Location spawn = ess.getSpawn().getSpawn(user.getGroup()); + final Location spawn = spawns.getSpawn(user.getGroup()); if (spawn != null) { event.setRespawnLocation(spawn); @@ -58,20 +61,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener user.setNew(false); if (!"none".equalsIgnoreCase(ess.getSettings().getNewbieSpawn())) { - ess.scheduleSyncDelayedTask(new Runnable() - { - public void run() - { - try - { - user.getTeleport().now(ess.getSpawn().getSpawn(ess.getSettings().getNewbieSpawn())); - } - catch (Exception ex) - { - Logger.getLogger("Minecraft").log(Level.WARNING, _("teleportNewPlayerError"), ex); - } - } - }); + ess.scheduleSyncDelayedTask(new NewPlayerTeleport(user)); } if (ess.getSettings().getAnnounceNewPlayers()) @@ -79,4 +69,32 @@ public class EssentialsSpawnPlayerListener extends PlayerListener ess.broadcastMessage(user, ess.getSettings().getAnnounceNewPlayerFormat(user)); } } + + + private class NewPlayerTeleport implements Runnable + { + private final transient User user; + + public NewPlayerTeleport(final User user) + { + this.user = user; + } + + @Override + public void run() + { + try + { + Location spawn = spawns.getSpawn(ess.getSettings().getNewbieSpawn()); + if (spawn != null) + { + user.getTeleport().now(spawn, false, TeleportCause.PLUGIN); + } + } + catch (Exception ex) + { + Bukkit.getLogger().log(Level.WARNING, _("teleportNewPlayerError"), ex); + } + } + } } diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/SpawnStorage.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/SpawnStorage.java new file mode 100644 index 000000000..088ee9052 --- /dev/null +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/SpawnStorage.java @@ -0,0 +1,90 @@ +package com.earth2me.essentials.spawn; + +import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.IEssentialsModule; +import com.earth2me.essentials.settings.Spawns; +import com.earth2me.essentials.storage.AsyncStorageObjectHolder; +import java.io.File; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import org.bukkit.Location; +import org.bukkit.World; + + +public class SpawnStorage extends AsyncStorageObjectHolder<Spawns> implements IEssentialsModule +{ + public SpawnStorage(final IEssentials ess) + { + super(ess, Spawns.class); + reloadConfig(); + } + + @Override + public File getStorageFile() + { + return new File(ess.getDataFolder(), "spawn.yml"); + } + + public void setSpawn(final Location loc, final String group) + { + acquireWriteLock(); + try + { + if (getData().getSpawns() == null) + { + getData().setSpawns(new HashMap<String, Location>()); + } + getData().getSpawns().put(group.toLowerCase(Locale.ENGLISH), loc); + } + finally + { + unlock(); + } + + if ("default".equalsIgnoreCase(group)) + { + loc.getWorld().setSpawnLocation(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); + } + } + + public Location getSpawn(final String group) + { + acquireReadLock(); + try + { + if (getData().getSpawns() == null || group == null) + { + return getWorldSpawn(); + } + final Map<String, Location> spawnMap = getData().getSpawns(); + String groupName = group.toLowerCase(Locale.ENGLISH); + if (!spawnMap.containsKey(groupName)) + { + groupName = "default"; + } + if (!spawnMap.containsKey(groupName)) + { + return getWorldSpawn(); + } + return spawnMap.get(groupName); + } + finally + { + unlock(); + } + } + + private Location getWorldSpawn() + { + for (World world : ess.getServer().getWorlds()) + { + if (world.getEnvironment() != World.Environment.NORMAL) + { + continue; + } + return world.getSpawnLocation(); + } + return ess.getServer().getWorlds().get(0).getSpawnLocation(); + } +} diff --git a/EssentialsSpawn/src/plugin.yml b/EssentialsSpawn/src/plugin.yml index 1e01eebd9..9a5261e56 100644 --- a/EssentialsSpawn/src/plugin.yml +++ b/EssentialsSpawn/src/plugin.yml @@ -13,4 +13,4 @@ commands: usage: /<command> <group> spawn: description: Teleport to the spawnpoint. - usage: /<command>
\ No newline at end of file + usage: /<command> [player]
\ No newline at end of file diff --git a/EssentialsUpdate/nbproject/project.properties b/EssentialsUpdate/nbproject/project.properties index 14a032421..b73c58ae9 100644 --- a/EssentialsUpdate/nbproject/project.properties +++ b/EssentialsUpdate/nbproject/project.properties @@ -67,8 +67,7 @@ file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar=../lib/bukkit-1.0.0-R1-SNAPSHOT.jar includes=** jar.compress=true javac.classpath=\ - ${file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar}:\ - ${libs.junit_4.classpath} + ${file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false @@ -78,7 +77,8 @@ javac.source=1.6 javac.target=1.6 javac.test.classpath=\ ${javac.classpath}:\ - ${build.classes.dir} + ${build.classes.dir}:\ + ${libs.junit_4.10.classpath} javac.test.processorpath=\ ${javac.test.classpath} javadoc.additionalparam= diff --git a/EssentialsXMPP/build.xml b/EssentialsXMPP/build.xml index 1edb37153..2e92ef710 100644 --- a/EssentialsXMPP/build.xml +++ b/EssentialsXMPP/build.xml @@ -74,7 +74,7 @@ <target name="-post-jar"> <jar jarfile="${dist.dir}/EssentialsXMPP.jar"> <zipfileset src="${dist.jar}" excludes="META-INF/*" /> - <zipfileset src="../lib/smack-3.2.0.jar" excludes="META-INF/*" /> + <zipfileset src="../lib/smack-3.2.1.jar" excludes="META-INF/*" /> <manifest> <attribute name="Classpath" value="Essentials.jar"/> </manifest> diff --git a/EssentialsXMPP/nbproject/project.properties b/EssentialsXMPP/nbproject/project.properties index 802c76227..90aba36fa 100644 --- a/EssentialsXMPP/nbproject/project.properties +++ b/EssentialsXMPP/nbproject/project.properties @@ -64,7 +64,7 @@ dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar=../lib/bukkit-1.0.0-R1-SNAPSHOT.jar -file.reference.smack-3.2.0.jar=../lib/smack-3.2.0.jar +file.reference.smack-3.2.1.jar=../lib/smack-3.2.1.jar includes=** jar.archive.disabled=${jnlp.enabled} jar.compress=true @@ -72,7 +72,7 @@ jar.index=${jnlp.enabled} javac.classpath=\ ${reference.Essentials.jar}:\ ${file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar}:\ - ${file.reference.smack-3.2.0.jar} + ${file.reference.smack-3.2.1.jar} # Space-separated list of extra javac options javac.compilerargs=-Xlint:unchecked javac.deprecation=false @@ -83,8 +83,7 @@ javac.target=1.6 javac.test.classpath=\ ${javac.classpath}:\ ${build.classes.dir}:\ - ${libs.junit.classpath}:\ - ${libs.junit_4.classpath} + ${libs.junit_4.10.classpath} javac.test.processorpath=\ ${javac.test.classpath} javadoc.additionalparam= diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java index 06575851d..bcbbfa17d 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java @@ -36,9 +36,14 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP final PluginManager pluginManager = getServer().getPluginManager(); ess = (IEssentials)pluginManager.getPlugin("Essentials"); - if (ess == null) + if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) { - LOGGER.log(Level.SEVERE, "Failed to load Essentials before EssentialsXMPP"); + LOGGER.log(Level.WARNING, _("versionMismatchAll")); + } + if (!ess.isEnabled()) + { + this.setEnabled(false); + return; } final EssentialsXMPPPlayerListener playerListener = new EssentialsXMPPPlayerListener(ess); @@ -52,23 +57,23 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP ess.addReloadListener(users); ess.addReloadListener(xmpp); - if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) - { - LOGGER.log(Level.WARNING, _("versionMismatchAll")); - } LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team")); } @Override public void onDisable() { - xmpp.disconnect(); + if (xmpp != null) + { + xmpp.disconnect(); + } + instance = null; } @Override public boolean onCommand(final CommandSender sender, final Command command, final String commandLabel, final String[] args) { - return ess.onCommandEssentials(sender, command, commandLabel, args, EssentialsXMPP.class.getClassLoader(), "com.earth2me.essentials.xmpp.Command", "essentials."); + return ess.onCommandEssentials(sender, command, commandLabel, args, EssentialsXMPP.class.getClassLoader(), "com.earth2me.essentials.xmpp.Command", "essentials.", null); } @Override diff --git a/README.markdown b/README.markdown index 616a76185..1913e1ba1 100644 --- a/README.markdown +++ b/README.markdown @@ -11,7 +11,7 @@ Recommended NetBeans plugins: * Git * PMD & FindBugs ( http://kenai.com/projects/sqe/pages/Home ) -You don't need to import settings.zip anymore, since the format guidelines have been added to the project properties. +Please follow the format guidelines that are saved in the project properties. Windows users, please read this: http://help.github.com/line-endings/ The default line ending is LF. diff --git a/lib/EssentialsiConomyBridge.jar b/lib/EssentialsiConomyBridge.jar Binary files differdeleted file mode 100644 index e847bdf81..000000000 --- a/lib/EssentialsiConomyBridge.jar +++ /dev/null diff --git a/lib/VanishNoPickup.jar b/lib/VanishNoPickup.jar Binary files differdeleted file mode 100644 index 4acf777ec..000000000 --- a/lib/VanishNoPickup.jar +++ /dev/null diff --git a/lib/bukkit-1.0.0-R1-SNAPSHOT.jar b/lib/bukkit-1.0.0-R1-SNAPSHOT.jar Binary files differindex 259ebadfd..ddaaa3368 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 0bd508b04..ab3f075ac 100644 --- a/lib/craftbukkit-1.0.0-SNAPSHOT.jar +++ b/lib/craftbukkit-1.0.0-SNAPSHOT.jar diff --git a/lib/gson.jar b/lib/gson.jar Binary files differdeleted file mode 100644 index 4f7970541..000000000 --- a/lib/gson.jar +++ /dev/null diff --git a/lib/junit/junit-3.8.2-api.zip b/lib/junit/junit-3.8.2-api.zip Binary files differdeleted file mode 100644 index 6d792fdaa..000000000 --- a/lib/junit/junit-3.8.2-api.zip +++ /dev/null diff --git a/lib/junit/junit-3.8.2.jar b/lib/junit/junit-3.8.2.jar Binary files differdeleted file mode 100644 index d83587261..000000000 --- a/lib/junit/junit-3.8.2.jar +++ /dev/null diff --git a/lib/junit_4.10/junit-4.10-src.jar b/lib/junit_4.10/junit-4.10-src.jar Binary files differnew file mode 100644 index 000000000..458b63c7e --- /dev/null +++ b/lib/junit_4.10/junit-4.10-src.jar diff --git a/lib/junit_4.10/junit-4.10.jar b/lib/junit_4.10/junit-4.10.jar Binary files differnew file mode 100644 index 000000000..bf5c0b9c6 --- /dev/null +++ b/lib/junit_4.10/junit-4.10.jar diff --git a/lib/junit_4/junit-4.5-api.zip b/lib/junit_4/junit-4.5-api.zip Binary files differdeleted file mode 100644 index 5748c444d..000000000 --- a/lib/junit_4/junit-4.5-api.zip +++ /dev/null diff --git a/lib/junit_4/junit-4.5-src.jar b/lib/junit_4/junit-4.5-src.jar Binary files differdeleted file mode 100644 index 18774a573..000000000 --- a/lib/junit_4/junit-4.5-src.jar +++ /dev/null diff --git a/lib/junit_4/junit-4.5.jar b/lib/junit_4/junit-4.5.jar Binary files differdeleted file mode 100644 index 83f8bc793..000000000 --- a/lib/junit_4/junit-4.5.jar +++ /dev/null diff --git a/lib/mysql.jar b/lib/mysql.jar Binary files differdeleted file mode 100644 index 0539039f7..000000000 --- a/lib/mysql.jar +++ /dev/null diff --git a/lib/nblibraries.properties b/lib/nblibraries.properties index 6c4ff50b3..0380a6c75 100644 --- a/lib/nblibraries.properties +++ b/lib/nblibraries.properties @@ -1,13 +1,7 @@ libs.CopyLibs.classpath=\ ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar -libs.junit.classpath=\ - ${base}/junit/junit-3.8.2.jar -libs.junit.javadoc=\ - ${base}/junit/junit-3.8.2-api.zip -libs.junit_4.classpath=\ - ${base}/junit_4/junit-4.5.jar -libs.junit_4.javadoc=\ - ${base}/junit_4/junit-4.5-api.zip -libs.junit_4.src=\ - ${base}/junit_4/junit-4.5-src.jar +libs.junit_4.10.classpath=\ + ${base}/junit_4.10/junit-4.10.jar +libs.junit_4.10.src=\ + ${base}/junit_4.10/junit-4.10-src.jar project.EssentialsGroupManager=../EssentialsGroupManager diff --git a/lib/smack-3.2.0.jar b/lib/smack-3.2.1.jar Binary files differindex 22b9780dd..3c09c9f6c 100644 --- a/lib/smack-3.2.0.jar +++ b/lib/smack-3.2.1.jar diff --git a/lib/sqlite.jar b/lib/sqlite.jar Binary files differdeleted file mode 100644 index 0b47e2cf9..000000000 --- a/lib/sqlite.jar +++ /dev/null diff --git a/settings.zip b/settings.zip Binary files differdeleted file mode 100644 index 33660fcdc..000000000 --- a/settings.zip +++ /dev/null |