diff options
158 files changed, 8870 insertions, 3642 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index ccea1ba15..dc63d3020 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -31,6 +31,20 @@ import com.earth2me.essentials.ranks.RanksStorage; import com.earth2me.essentials.settings.SettingsHolder; import com.earth2me.essentials.settings.SpawnsHolder; import com.earth2me.essentials.user.UserMap; +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; +import com.earth2me.essentials.commands.NotEnoughArgumentsException; +import com.earth2me.essentials.metrics.Metrics; +import com.earth2me.essentials.metrics.MetricsListener; +import com.earth2me.essentials.metrics.MetricsStarter; +import com.earth2me.essentials.perm.PermissionsHandler; +import com.earth2me.essentials.register.payment.Methods; +import com.earth2me.essentials.signs.SignBlockListener; +import com.earth2me.essentials.signs.SignEntityListener; +import com.earth2me.essentials.signs.SignPlayerListener; import java.io.File; import java.io.FileReader; import java.io.IOException; @@ -59,7 +73,7 @@ import org.yaml.snakeyaml.error.YAMLException; public class Essentials extends JavaPlugin implements IEssentials { - public static final int BUKKIT_VERSION = 2015; + public static final int BUKKIT_VERSION = 2149; private static final Logger LOGGER = Logger.getLogger("Minecraft"); private transient ISettings settings; private final transient TntExplodeListener tntListener = new TntExplodeListener(this); @@ -80,6 +94,9 @@ public class Essentials extends JavaPlugin implements IEssentials private transient ICommandHandler commandHandler; private transient Economy economy; public transient boolean testing; + private transient Metrics metrics; + private transient EssentialsTimer timer; + private transient List<String> vanishedPlayers = new ArrayList<String>(); @Override public ISettings getSettings() @@ -123,7 +140,8 @@ public class Essentials extends JavaPlugin implements IEssentials for (Plugin plugin : pm.getPlugins()) { if (plugin.getDescription().getName().startsWith("Essentials") - && !plugin.getDescription().getVersion().equals(this.getDescription().getVersion())) + && !plugin.getDescription().getVersion().equals(this.getDescription().getVersion()) + && !plugin.getDescription().getName().equals("EssentialsAntiCheat")) { LOGGER.log(Level.WARNING, _("versionMismatch", plugin.getDescription().getName())); } @@ -134,8 +152,10 @@ public class Essentials extends JavaPlugin implements IEssentials final int versionNumber = Integer.parseInt(versionMatch.group(1)); if (versionNumber < BUKKIT_VERSION && versionNumber > 100) { + LOGGER.log(Level.SEVERE, " * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! *"); LOGGER.log(Level.SEVERE, _("notRecommendedBukkit")); LOGGER.log(Level.SEVERE, _("requiredBukkit", Integer.toString(BUKKIT_VERSION))); + LOGGER.log(Level.SEVERE, " * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! *"); this.setEnabled(false); return; } @@ -232,6 +252,18 @@ public class Essentials extends JavaPlugin implements IEssentials final EssentialsTimer timer = new EssentialsTimer(this); getServer().getScheduler().scheduleSyncRepeatingTask(this, timer, 1, 100); execTimer.mark("RegListeners"); + + final MetricsStarter metricsStarter = new MetricsStarter(this); + if (metricsStarter.getStart() != null && metricsStarter.getStart() == true) + { + getScheduler().scheduleAsyncDelayedTask(this, metricsStarter, 1); + } + else if (metricsStarter.getStart() != null && metricsStarter.getStart() == false) + { + final MetricsListener metricsListener = new MetricsListener(this, metricsStarter); + pm.registerEvents(metricsListener, this); + } + final String timeroutput = execTimer.end(); if (getSettings().isDebug()) { @@ -242,6 +274,13 @@ public class Essentials extends JavaPlugin implements IEssentials @Override public void onDisable() { + for (Player p : getServer().getOnlinePlayers()) + { + if (getUser(p).isVanished()) + { + p.sendMessage(_("unvanishedReload")); + } + } i18n.onDisable(); Trade.closeLog(); } @@ -297,6 +336,16 @@ public class Essentials extends JavaPlugin implements IEssentials return backup; } + public Metrics getMetrics() + { + return metrics; + } + + public void setMetrics(Metrics metrics) + { + this.metrics = metrics; + } + @Override public IUser getUser(final Player player) { diff --git a/Essentials/src/com/earth2me/essentials/EssentialsTimer.java b/Essentials/src/com/earth2me/essentials/EssentialsTimer.java index d773b3d43..34aecddc0 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsTimer.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsTimer.java @@ -8,7 +8,7 @@ import com.earth2me.essentials.permissions.Permissions; import com.earth2me.essentials.user.UserData.TimestampType; import java.util.HashSet; import java.util.Iterator; -import java.util.List; +import java.util.LinkedList; import java.util.Set; import java.util.logging.Level; import org.bukkit.entity.Player; @@ -18,6 +18,8 @@ public class EssentialsTimer implements Runnable { private final transient IEssentials ess; private final transient Set<IUser> onlineUsers = new HashSet<IUser>(); + private transient long lastPoll = System.currentTimeMillis(); + private final transient LinkedList<Float> history = new LinkedList<Float>(); EssentialsTimer(final IEssentials ess) { @@ -28,6 +30,21 @@ public class EssentialsTimer implements Runnable public void run() { final long currentTime = System.currentTimeMillis(); + long timeSpent = (currentTime - lastPoll) / 1000; + if (timeSpent == 0) + { + timeSpent = 1; + } + if (history.size() > 10) + { + history.remove(); + } + float tps = 100f / timeSpent; + if (tps <= 20) + { + history.add(tps); + } + lastPoll = currentTime; for (Player player : ess.getServer().getOnlinePlayers()) { @@ -77,6 +94,20 @@ public class EssentialsTimer implements Runnable } user.checkMuteTimeout(currentTime); user.checkJailTimeout(currentTime); + user.resetInvulnerabilityAfterTeleport(); + } + } + + public float getAverageTPS() + { + float avg = 0; + for (Float f : history) + { + if (f != null) + { + avg += f; + } } + return avg / history.size(); } } diff --git a/Essentials/src/com/earth2me/essentials/I18n.java b/Essentials/src/com/earth2me/essentials/I18n.java index 7108254ff..de4afec94 100644 --- a/Essentials/src/com/earth2me/essentials/I18n.java +++ b/Essentials/src/com/earth2me/essentials/I18n.java @@ -116,6 +116,7 @@ public class I18n implements II18n { currentLocale = new Locale(parts[0], parts[1], parts[2]); } + ResourceBundle.clearCache(); Logger.getLogger("Minecraft").log(Level.INFO, String.format("Using locale %s", currentLocale.toString())); customBundle = ResourceBundle.getBundle(MESSAGES, currentLocale, new FileResClassLoader(I18n.class.getClassLoader(), ess)); localeBundle = ResourceBundle.getBundle(MESSAGES, currentLocale); diff --git a/Essentials/src/com/earth2me/essentials/Jails.java b/Essentials/src/com/earth2me/essentials/Jails.java index 171611a6a..53bef54c4 100644 --- a/Essentials/src/com/earth2me/essentials/Jails.java +++ b/Essentials/src/com/earth2me/essentials/Jails.java @@ -12,12 +12,16 @@ import java.util.logging.Logger; import lombok.Cleanup; import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerRespawnEvent; @@ -29,21 +33,20 @@ 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(); + private static transient boolean enabled = false; public Jails(final IEssentials ess) { super(ess, com.earth2me.essentials.settings.Jails.class); onReload(); - registerListeners(); } private void registerListeners() { + enabled = true; final PluginManager pluginManager = ess.getServer().getPluginManager(); - final JailBlockListener blockListener = new JailBlockListener(); - final JailPlayerListener playerListener = new JailPlayerListener(); + final JailListener blockListener = new JailListener(); pluginManager.registerEvents(blockListener, ess); - pluginManager.registerEvents(playerListener, ess); } @Override @@ -53,6 +56,24 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett } @Override + public void finishRead() + { + if (enabled == false && getCount() > 0) + { + registerListeners(); + } + } + + @Override + public void finishWrite() + { + if (enabled == false) + { + registerListeners(); + } + } + + @Override public Location getJail(final String jailName) throws Exception { acquireReadLock(); @@ -157,8 +178,21 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett } } + @Override + public int getCount() + { + try + { + return getList().size(); + } + catch (Exception ex) + { + return 0; + } + } + - private class JailBlockListener implements Listener + private class JailListener implements Listener { @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockBreak(final BlockBreakEvent event) @@ -195,8 +229,24 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett event.setCancelled(true); } } - } + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) + public void onEntityDamageByEntity(final EntityDamageByEntityEvent event) + { + if (event.getCause() != DamageCause.ENTITY_ATTACK || event.getEntity().getType() != EntityType.PLAYER) + { + return; + } + final Entity damager = event.getDamager(); + if (damager.getType() == EntityType.PLAYER) + { + final User user = ess.getUser(damager); + if (user != null && user.isJailed()) + { + event.setCancelled(true); + } + } + } private class JailPlayerListener implements Listener { diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java index 0ae38725b..7118ed1bb 100644 --- a/Essentials/src/com/earth2me/essentials/Teleport.java +++ b/Essentials/src/com/earth2me/essentials/Teleport.java @@ -6,7 +6,6 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.api.IEssentials; import com.earth2me.essentials.api.ITeleport; import com.earth2me.essentials.api.IUser; -import com.earth2me.essentials.commands.NotEnoughArgumentsException; import com.earth2me.essentials.permissions.Permissions; import com.earth2me.essentials.user.CooldownException; import com.earth2me.essentials.user.UserData.TimestampType; @@ -294,13 +293,8 @@ public class Teleport implements Runnable, ITeleport } } - public void home(IUser user, String home, Trade chargeFor) throws Exception + public void home(Location loc, Trade chargeFor) throws Exception { - final Location loc = user.getHome(home); - if (loc == null) - { - throw new NotEnoughArgumentsException(); - } teleport(new Target(loc), chargeFor, TeleportCause.COMMAND); } } diff --git a/Essentials/src/com/earth2me/essentials/api/IJails.java b/Essentials/src/com/earth2me/essentials/api/IJails.java index caa1ee0a8..fb8d2f090 100644 --- a/Essentials/src/com/earth2me/essentials/api/IJails.java +++ b/Essentials/src/com/earth2me/essentials/api/IJails.java @@ -10,6 +10,8 @@ public interface IJails extends IReload Collection<String> getList() throws Exception; + int getCount(); + void removeJail(String jail) throws Exception; void sendToJail(IUser user, String jail) throws Exception; diff --git a/Essentials/src/com/earth2me/essentials/bukkit/Enchantments.java b/Essentials/src/com/earth2me/essentials/bukkit/Enchantments.java index 21c763a30..f8e22ccb3 100644 --- a/Essentials/src/com/earth2me/essentials/bukkit/Enchantments.java +++ b/Essentials/src/com/earth2me/essentials/bukkit/Enchantments.java @@ -24,47 +24,72 @@ public final class Enchantments 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("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("featherfall", 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); + ENCHANTMENTS.put("firearrow", Enchantment.ARROW_FIRE); + ENCHANTMENTS.put("flame", Enchantment.ARROW_FIRE); + ENCHANTMENTS.put("arrowdamage", Enchantment.ARROW_DAMAGE); + ENCHANTMENTS.put("power", Enchantment.ARROW_DAMAGE); + ENCHANTMENTS.put("arrowknockback", Enchantment.ARROW_KNOCKBACK); ENCHANTMENTS.put("arrowkb", Enchantment.ARROW_KNOCKBACK); + ENCHANTMENTS.put("punch", Enchantment.ARROW_KNOCKBACK); + ENCHANTMENTS.put("infinitearrows", Enchantment.ARROW_INFINITE); ENCHANTMENTS.put("infarrows", Enchantment.ARROW_INFINITE); + ENCHANTMENTS.put("infinity", Enchantment.ARROW_INFINITE); } public static Enchantment getByName(final String name) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandafk.java b/Essentials/src/com/earth2me/essentials/commands/Commandafk.java index 1bda185b3..a571ec652 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandafk.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandafk.java @@ -28,6 +28,7 @@ public class Commandafk extends EssentialsCommand private void toggleAfk(IUser user) { + user.setDisplayNick(); if (!user.toggleAfk()) { //user.sendMessage(_("markedAsNotAway")); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandback.java b/Essentials/src/com/earth2me/essentials/commands/Commandback.java index a23b5409c..e2c1b266a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandback.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandback.java @@ -10,7 +10,12 @@ public class Commandback extends EssentialsCommand @Override protected void run(final IUser user, final String commandLabel, final String[] args) throws Exception { - final Trade charge = new Trade(commandName, ess); + if (user.getWorld() != user.getLastLocation().getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + user.getLastLocation().getWorld().getName())) + { + throw new Exception(_("noPerm", "essentials.world." + user.getLastLocation().getWorld().getName())); + } + final Trade charge = new Trade(this.getName(), ess); charge.isAffordableFor(user); user.sendMessage(_("backUsageMsg")); user.getTeleport().back(charge); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbackup.java b/Essentials/src/com/earth2me/essentials/commands/Commandbackup.java index 867135a93..c00a0d435 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbackup.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbackup.java @@ -10,7 +10,16 @@ public class Commandbackup extends EssentialsCommand @Override protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { - final IBackup backup = ess.getBackup(); + final Backup backup = ess.getBackup(); + if (backup == null) + { + throw new Exception(_("backupDisabled")); + } + final String command = ess.getSettings().getBackupCommand(); + if (command == null || "".equals(command) || "save-all".equalsIgnoreCase(command)) + { + throw new Exception(_("backupDisabled")); + } backup.run(); sender.sendMessage(_("backupStarted")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java b/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java index 9e8587be8..4e8b8f8af 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java @@ -16,7 +16,7 @@ public class Commandbalance extends EssentialsCommand { throw new NotEnoughArgumentsException(); } - sender.sendMessage(_("balance", Util.displayCurrency(getPlayer(args, 0, true).getMoney(), ess))); + sender.sendMessage(_("balance", Util.displayCurrency(getPlayer(server, args, 0, true).getMoney(), ess))); } @Override @@ -25,7 +25,7 @@ public class Commandbalance extends EssentialsCommand final double bal = (args.length < 1 || !Permissions.BALANCE_OTHERS.isAuthorized(user) ? user - : getPlayer(args, 0, true)).getMoney(); + : getPlayer(server, args, 0, true)).getMoney(); user.sendMessage(_("balance", Util.displayCurrency(bal, ess))); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java index 1feffd135..88c605f4e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java @@ -3,6 +3,7 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.api.IUser; +import org.bukkit.Server; import com.earth2me.essentials.permissions.Permissions; import com.earth2me.essentials.user.Ban; import lombok.Cleanup; @@ -49,7 +50,9 @@ public class Commandban extends EssentialsCommand else { banReason = _("defaultBanReason"); + user.setBanReason(""); } + user.setBanned(true); user.kickPlayer(banReason); final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java b/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java index 7c31c87c1..aa5645c85 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java @@ -21,6 +21,10 @@ public class Commandbigtree extends EssentialsCommand { tree = TreeType.BIG_TREE; } + else if (args.length > 0 && args[0].equalsIgnoreCase("jungle")) + { + tree = TreeType.JUNGLE; + } else { throw new NotEnoughArgumentsException(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java b/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java index 6f6139b59..6d2d7bb04 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java @@ -3,9 +3,12 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.api.IUser; import com.earth2me.essentials.permissions.Permissions; import static com.earth2me.essentials.I18n._; +import java.util.ArrayList; +import java.util.List; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.inventory.ItemStack; public class Commandbreak extends EssentialsCommand @@ -27,6 +30,8 @@ public class Commandbreak extends EssentialsCommand { throw new Exception(_("noBreakBedrock")); } + //final List<ItemStack> list = (List<ItemStack>)block.getDrops(); + //final BlockBreakEvent event = new BlockBreakEvent(block, user.getBase(), list); final BlockBreakEvent event = new BlockBreakEvent(block, user.getBase()); server.getPluginManager().callEvent(event); if (event.isCancelled()) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java index 095690374..e2668e562 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java @@ -1,8 +1,12 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.metrics.Metrics; +import java.io.IOException; import java.util.HashMap; import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -33,7 +37,14 @@ public class Commandessentials extends EssentialsCommand } else if (args[0].equalsIgnoreCase("moo")) { - run_moo(sender, args); + run_moo(server, sender, commandLabel, args); + } + else if (args[0].equalsIgnoreCase("opt-out")) + { + run_optout(server, sender, commandLabel, args); + } + else { + run_reload(server, sender, commandLabel, args); } else { @@ -161,11 +172,30 @@ public class Commandessentials extends EssentialsCommand noteBlocks.clear(); } - private void run_moo(final CommandSender sender, final String args[]) + private void run_moo(final Server server, final CommandSender sender, final String command, final String args[]) { if(sender instanceof ConsoleCommandSender) sender.sendMessage(new String[]{" (__)", " (oo)", " /------\\/", " / | ||", " * /\\---/\\", " ~~ ~~", "....\"Have you mooed today?\"..." } ); else sender.sendMessage(new String[]{" (__)", " (oo)", " /------\\/", " / | | |", " * /\\---/\\", " ~~ ~~", "....\"Have you mooed today?\"..." } ); } + + private void run_optout(final Server server, final CommandSender sender, final String command, final String args[]) + { + final Metrics metrics = ess.getMetrics(); + try + { + sender.sendMessage("Essentials collects simple metrics to highlight which features to concentrate work on in the future."); + if (metrics.isOptOut()) { + metrics.enable(); + } else { + metrics.disable(); + } + sender.sendMessage("Anonymous Metrics are now: " + (metrics.isOptOut() ? "disabled" : "enabled")); + } + catch (IOException ex) + { + sender.sendMessage("Unable to modify 'plugins/PluginMetrics/config.yml': " + ex.getMessage()); + } + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java new file mode 100644 index 000000000..22976ff92 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java @@ -0,0 +1,104 @@ +package com.earth2me.essentials.commands;
+
+import static com.earth2me.essentials.I18n._;
+import com.earth2me.essentials.User;
+import com.earth2me.essentials.Util;
+import com.earth2me.essentials.craftbukkit.SetExpFix;
+import org.bukkit.Server;
+import org.bukkit.entity.Player;
+
+
+public class Commandexp extends EssentialsCommand
+{
+ public Commandexp()
+ {
+ super("exp");
+ }
+
+ @Override
+ public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
+ {
+ if (args.length == 0)
+ {
+ showExp(user, user);
+ }
+ else if (args[0].equalsIgnoreCase("set") && user.isAuthorized("essentials.exp.set"))
+ {
+ if (args.length == 3 && user.isAuthorized("essentials.exp.set.others"))
+ {
+ Boolean foundUser = false;
+ for (Player matchPlayer : server.matchPlayer(args[1]))
+ {
+ User target = ess.getUser(matchPlayer);
+ setExp(user, target, args[2], false);
+ foundUser = true;
+ }
+ if (foundUser == false)
+ {
+ throw new NoSuchFieldException(_("playerNotFound"));
+ }
+ return;
+ }
+ setExp(user, user, args[1], false);
+ }
+ else if (args[0].equalsIgnoreCase("give") && user.isAuthorized("essentials.exp.give"))
+ {
+ if (args.length == 3 && user.isAuthorized("essentials.exp.give.others"))
+ {
+ Boolean foundUser = false;
+ for (Player matchPlayer : server.matchPlayer(args[1]))
+ {
+ User target = ess.getUser(matchPlayer);
+ setExp(user, target, args[2], true);
+ foundUser = true;
+ }
+ if (foundUser == false)
+ {
+ throw new NoSuchFieldException(_("playerNotFound"));
+ }
+ return;
+ }
+ setExp(user, user, args[1], true);
+ }
+ else
+ {
+ String search = args[0].trim();
+ if (args.length == 2)
+ {
+ search = args[1].trim();
+ }
+ if (search.equalsIgnoreCase("show") || !user.isAuthorized("essentials.exp.others"))
+ {
+ showExp(user, user);
+ return;
+ }
+ for (Player matchPlayer : server.matchPlayer(search))
+ {
+ User target = ess.getUser(matchPlayer);
+ showExp(user, target);
+ }
+ }
+ }
+
+ private void showExp(final User user, final User target)
+ {
+ final int totalExp = SetExpFix.getTotalExperience(target);
+ final int expLeft = (int)Util.roundDouble(((((3.5 * target.getLevel()) + 6.7) - (totalExp - ((1.75 * (target.getLevel() * target.getLevel())) + (5.00 * target.getLevel())))) + 1));
+ user.sendMessage(_("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target), target.getLevel(), expLeft));
+ }
+
+ private void setExp(final User user, final User target, final String strAmount, final boolean give)
+ {
+ Long amount = Long.parseLong(strAmount);
+ if (give)
+ {
+ amount += SetExpFix.getTotalExperience(target);
+ }
+ if (amount > Integer.MAX_VALUE)
+ {
+ amount = (long)Integer.MAX_VALUE;
+ }
+ SetExpFix.setTotalExperience(target, amount.intValue());
+ user.sendMessage(_("expSet", target.getDisplayName(), amount));
+ }
+}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfly.java b/Essentials/src/com/earth2me/essentials/commands/Commandfly.java new file mode 100644 index 000000000..22e3c4eea --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfly.java @@ -0,0 +1,63 @@ +package com.earth2me.essentials.commands; + +import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.User; +import java.util.Locale; +import org.bukkit.GameMode; +import org.bukkit.Server; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + + +public class Commandfly extends EssentialsCommand +{ + public Commandfly() + { + super("fly"); + } + + @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(); + } + + flyOtherPlayers(server, sender, args[0]); + } + + @Override + protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception + { + if (args.length > 0 && args[0].trim().length() > 2 && user.isAuthorized("essentials.fly.others")) + { + flyOtherPlayers(server, user, args[0]); + return; + } + user.setAllowFlight(!user.getAllowFlight()); + if (!user.getAllowFlight()) + { + user.setFlying(false); + } + user.sendMessage(_("flyMode", _(user.getAllowFlight() ? "enabled" : "disabled"), user.getDisplayName())); + } + + private void flyOtherPlayers(final Server server, final CommandSender sender, final String name) + { + for (Player matchPlayer : server.matchPlayer(name)) + { + final User player = ess.getUser(matchPlayer); + if (player.isHidden()) + { + continue; + } + player.setAllowFlight(!player.getAllowFlight()); + if (!player.getAllowFlight()) + { + player.setFlying(false); + } + sender.sendMessage(_("flyMode", _(player.getAllowFlight() ? "enabled" : "disabled"), player.getDisplayName())); + } + } +} diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java index 7bccf6df3..72153265e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java @@ -37,7 +37,7 @@ public class Commandgamemode extends EssentialsCommand private void gamemodeOtherPlayers(final CommandSender sender, final String name) { - for (Player matchPlayer : server.matchPlayer(name)) + for (Player matchPlayer : server.matchPlayer(args[0])) { final IUser player = ess.getUser(matchPlayer); if (player.isHidden()) @@ -45,7 +45,21 @@ public class Commandgamemode extends EssentialsCommand continue; } - player.setGameMode(player.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL); + if (args.length > 1) + { + if (args[1].contains("creat") || args[1].equalsIgnoreCase("1")) + { + player.setGameMode(GameMode.CREATIVE); + } + else + { + player.setGameMode(GameMode.SURVIVAL); + } + } + else + { + player.setGameMode(player.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL); + } sender.sendMessage(_("gameMode", _(player.getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName())); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgc.java b/Essentials/src/com/earth2me/essentials/commands/Commandgc.java index 8c7d2b485..4097c5e83 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgc.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgc.java @@ -1,6 +1,8 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; +import org.bukkit.ChatColor; +import org.bukkit.Server; import org.bukkit.World; import org.bukkit.command.CommandSender; @@ -10,6 +12,21 @@ public class Commandgc extends EssentialsCommand @Override protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { + float tps = ess.getTimer().getAverageTPS(); + ChatColor color; + if (tps >= 18) + { + color = ChatColor.GREEN; + } + else if (tps >= 15) + { + color = ChatColor.YELLOW; + } + else + { + color = ChatColor.RED; + } + sender.sendMessage(_("tps", "" + color + tps)); sender.sendMessage(_("gcmax", (Runtime.getRuntime().maxMemory() / 1024 / 1024))); sender.sendMessage(_("gctotal", (Runtime.getRuntime().totalMemory() / 1024 / 1024))); sender.sendMessage(_("gcfree", (Runtime.getRuntime().freeMemory() / 1024 / 1024))); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java index 88a817bd3..dfccdd31c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java @@ -14,12 +14,14 @@ public class Commandgetpos extends EssentialsCommand if (args.length > 0 && Permissions.GETPOS_OTHERS.isAuthorized(user)) { final IUser otherUser = getPlayer(args, 0); - outputPosition(user, otherUser.getLocation(), user.getLocation()); - } - else - { - outputPosition(user, user.getLocation(), null); + if (!otherUser.isHidden() || user.isAuthorized("essentials.list.hidden")) + { + outputPosition(user, otherUser.getLocation(), user.getLocation()); + return; + } + } + outputPosition(user, user.getLocation(), null); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java index 75dce1b3c..aea29cbf3 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java @@ -3,6 +3,7 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.api.IUser; import com.earth2me.essentials.permissions.GivePermissions; import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.Util; import java.util.Locale; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -14,7 +15,6 @@ import org.bukkit.inventory.ItemStack; public class Commandgive extends EssentialsCommand { - //TODO: move these messages to message file @Override public void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { @@ -33,14 +33,19 @@ public class Commandgive extends EssentialsCommand throw new Exception(_("cantSpawnItem", itemname)); } - if (args.length > 2 && Integer.parseInt(args[2]) > 0) + if (args.length > 3 && Util.isInt(args[2]) && Util.isInt(args[3])) + { + stack.setAmount(Integer.parseInt(args[2])); + stack.setDurability(Short.parseShort(args[3])); + } + else if (args.length > 2 && Integer.parseInt(args[2]) > 0) { stack.setAmount(Integer.parseInt(args[2])); } if (args.length > 3) { - for (int i = 3; i < args.length; i++) + for (int i = Util.isInt(args[3]) ? 4 : 3; i < args.length; i++) { final String[] split = args[i].split("[:+',;.]", 2); if (split.length < 1) @@ -68,6 +73,7 @@ public class Commandgive extends EssentialsCommand giveTo.giveItems(stack, false); + //TODO: TL this. final String itemName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' '); sender.sendMessage(ChatColor.BLUE + "Giving " + stack.getAmount() + " of " + itemName + " to " + giveTo.getDisplayName() + "."); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhat.java b/Essentials/src/com/earth2me/essentials/commands/Commandhat.java new file mode 100644 index 000000000..ed82fd16d --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhat.java @@ -0,0 +1,41 @@ +package com.earth2me.essentials.commands; + +import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.User; +import org.bukkit.Material; +import org.bukkit.Server; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; + + +public class Commandhat extends EssentialsCommand +{ + public Commandhat() + { + super("hat"); + } + + @Override + protected void run(Server server, User user, String commandLabel, String[] args) throws Exception + { + if (user.getItemInHand().getType() != Material.AIR) + { + final ItemStack hand = user.getItemInHand(); + if (hand.getType().getMaxDurability() == 0) + { + final PlayerInventory inv = user.getInventory(); + final ItemStack head = inv.getHelmet(); + inv.removeItem(hand); + inv.setHelmet(hand); + inv.setItemInHand(head); + user.sendMessage(_("hatPlaced")); + } else { + user.sendMessage(_("hatArmor")); + } + } + else + { + user.sendMessage(_("hatFail")); + } + } +} diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java index 40b99f06f..e6fb2e2eb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java @@ -8,6 +8,9 @@ import com.earth2me.essentials.utils.textreader.KeywordReplacer; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.utils.Util; import com.earth2me.essentials.api.IUser; +import com.earth2me.essentials.textreader.*; +import java.util.Locale; +import org.bukkit.Server; import org.bukkit.command.CommandSender; @@ -19,6 +22,7 @@ public class Commandhelp extends EssentialsCommand IText output; String pageStr = args.length > 0 ? args[0] : null; String chapterPageStr = args.length > 1 ? args[1] : null; + String command = commandLabel; final IText input = new TextInput(user, "help", false, ess); if (input.getLines().isEmpty()) @@ -29,7 +33,12 @@ public class Commandhelp extends EssentialsCommand } else { - output = new HelpInput(user, pageStr, ess); + if (pageStr.length() > 26) + { + pageStr = pageStr.substring(0, 25); + } + output = new HelpInput(user, pageStr.toLowerCase(Locale.ENGLISH), ess); + command = command.concat(" ").concat(pageStr); pageStr = chapterPageStr; } chapterPageStr = null; @@ -39,7 +48,7 @@ public class Commandhelp extends EssentialsCommand output = new KeywordReplacer(input, user, ess); } final TextPager pager = new TextPager(output); - pager.showPage(pageStr, chapterPageStr, commandLabel, user); + pager.showPage(pageStr, chapterPageStr, command, user); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java index ece3ef183..42a69b4b1 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java @@ -17,8 +17,8 @@ public class Commandhelpop extends EssentialsCommand { throw new NotEnoughArgumentsException(); } - - final String message = _("helpOp", user.getDisplayName(), Util.stripColor(getFinalArg(args, 0))); + user.setDisplayNick(); + final String message = _("helpOp", user.getDisplayName(), Util.stripFormat(getFinalArg(args, 0))); logger.log(Level.INFO, message); for (Player onlinePlayer : server.getOnlinePlayers()) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java index f2403b92a..27e93d39e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java @@ -49,7 +49,7 @@ public class Commandhome extends EssentialsCommand throw new NoChargeException(); } } - user.getTeleport().home(player, homeName.toLowerCase(Locale.ENGLISH), charge); + goHome(user, player, homeName.toLowerCase(Locale.ENGLISH), charge); } catch (NotEnoughArgumentsException e) { @@ -75,7 +75,7 @@ public class Commandhome extends EssentialsCommand } else if (homes.size() == 1 && player.equals(user)) { - user.getTeleport().home(player, homes.get(0), charge); + goHome(user, player, homes.get(0), charge); } else { @@ -88,4 +88,19 @@ public class Commandhome extends EssentialsCommand } throw new NoChargeException(); } + + private void goHome(final User user, final User player, final String home, final Trade charge) throws Exception + { + final Location loc = player.getHome(home); + if (loc == null) + { + throw new NotEnoughArgumentsException(); + } + if (user.getWorld() != loc.getWorld() && ess.getSettings().isWorldHomePermissions() + && !user.isAuthorized("essentials.world." + loc.getWorld().getName())) + { + throw new Exception(_("noPerm", "essentials.world." + loc.getWorld().getName())); + } + user.getTeleport().home(loc, charge); + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java index 4b772e0ec..fd6a6a167 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java @@ -12,41 +12,12 @@ public class Commandinvsee extends EssentialsCommand @Override protected void run(final IUser user, final String commandLabel, final String[] args) throws Exception { - - if (args.length < 1 && user.getData().getInventory() == null) + if (args.length < 1) { throw new NotEnoughArgumentsException(); } - IUser invUser = user; - if (args.length == 1) - { - invUser = getPlayer(args, 0); - } - user.acquireWriteLock(); - if (invUser == user && user.getData().getInventory() != null) - { - invUser.getInventory().setContents(user.getData().getInventory().getBukkitInventory()); - user.getData().setInventory(null); - user.sendMessage(_("invRestored")); - throw new NoChargeException(); - } - if (user.getData().getInventory() == null) - { - user.getData().setInventory(new Inventory(user.getInventory().getContents())); - } - ItemStack[] invUserStack = invUser.getInventory().getContents(); - final int userStackLength = user.getInventory().getContents().length; - if (invUserStack.length < userStackLength) - { - invUserStack = Arrays.copyOf(invUserStack, userStackLength); - } - if (invUserStack.length > userStackLength) - { - throw new Exception(_("invBigger")); - } - user.getInventory().setContents(invUserStack); - user.sendMessage(_("invSee", invUser.getDisplayName())); - user.sendMessage(_("invSeeHelp")); - throw new NoChargeException(); + final User invUser = getPlayer(server, args, 0); + user.setInvSee(true); + user.openInventory(invUser.getInventory()); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java index 18af6cb78..1ea96ff60 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java @@ -25,8 +25,7 @@ public class Commanditem extends EssentialsCommand { throw new Exception(_("cantSpawnItem", itemname)); } - - if (args.length > 1 && Integer.parseInt(args[1]) > 0) + try { stack.setAmount(Integer.parseInt(args[1])); } @@ -35,24 +34,43 @@ public class Commanditem extends EssentialsCommand { for (int i = 2; i < args.length; i++) { - final String[] split = args[i].split("[:+',;.]", 2); - if (split.length < 1) - { - continue; - } - final Enchantment enchantment = Commandenchant.getEnchantment(split[0], user); - int level; - if (split.length > 1) - { - level = Integer.parseInt(split[1]); - } - else + 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) + { + for (int i = 2; i < args.length; i++) { - level = enchantment.getMaxLevel(); + final String[] split = args[i].split("[:+',;.]", 2); + if (split.length < 1) + { + continue; + } + final Enchantment enchantment = Commandenchant.getEnchantment(split[0], user); + int level; + if (split.length > 1) + { + level = Integer.parseInt(split[1]); + } + else + { + level = enchantment.getMaxLevel(); + } + stack.addEnchantment(enchantment, level); } - stack.addEnchantment(enchantment, level); } } + catch (NumberFormatException e) + { + throw new NotEnoughArgumentsException(); + } if (stack.getType() == Material.AIR) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandjump.java b/Essentials/src/com/earth2me/essentials/commands/Commandjump.java index 8a1fa91d4..4d4388b84 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandjump.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandjump.java @@ -31,5 +31,6 @@ public class Commandjump extends EssentialsCommand final Trade charge = new Trade(commandName, ess); charge.isAffordableFor(user); user.getTeleport().teleport(loc, charge, TeleportCause.COMMAND); + throw new NoChargeException(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java index e460f5cbd..bd22d30c9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java @@ -21,5 +21,6 @@ public class Commandkickall extends EssentialsCommand onlinePlayer.kickPlayer(args.length > 0 ? getFinalArg(args, 0) : _("kickDefault")); } } + sender.sendMessage(_("kickedAll")); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java index e4db6eb1a..81e998b34 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java @@ -18,15 +18,14 @@ public class Commandkill extends EssentialsCommand for (Player matchPlayer : server.matchPlayer(args[0])) { - final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer, sender instanceof Player && ((Player)sender).getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, 1000); + final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer, sender instanceof Player && ((Player)sender).getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, Short.MAX_VALUE); server.getPluginManager().callEvent(ede); if (ede.isCancelled() && !sender.hasPermission("essentials.kill.force")) { continue; } - matchPlayer.damage(1000); - matchPlayer.setHealth(0); + matchPlayer.damage(Short.MAX_VALUE); sender.sendMessage(_("kill", matchPlayer.getDisplayName())); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkillall.java b/Essentials/src/com/earth2me/essentials/commands/Commandkillall.java index 238dffb58..d8868e2c4 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkillall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkillall.java @@ -43,7 +43,7 @@ public class Commandkillall extends EssentialsCommand } catch (NumberFormatException e) { - throw new Exception(_("numberRequired")); + throw new Exception(_("numberRequired"), e); } } } @@ -103,6 +103,13 @@ public class Commandkillall extends EssentialsCommand continue; } } + if(entity instanceof Ocelot) + { + if (((Ocelot)entity).isTamed()) + { + continue; + } + } if (animals) { if (entity instanceof Animals || entity instanceof NPC || entity instanceof Snowman || entity instanceof WaterMob) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java index 1bd9e770d..bab73b196 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java @@ -8,6 +8,7 @@ import com.earth2me.essentials.permissions.KitPermissions; import com.earth2me.essentials.settings.Kit; import java.util.Collection; import java.util.Locale; +import org.bukkit.command.CommandSender; public class Commandkit extends EssentialsCommand @@ -35,8 +36,30 @@ public class Commandkit extends EssentialsCommand } throw new NoChargeException(); } + else if (args.length > 1 && user.isAuthorized("essentials.kit.others")) + { + final User userTo = getPlayer(server, args, 1, true); + final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH)); + giveKit(userTo, user, kitName); + } else { + final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH)); + giveKit(user, user, kitName); + } + } + + @Override + public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception + { + if (args.length < 2) + { + listKits(sender); + throw new NoChargeException(); + } + else + { + final User userTo = getPlayer(server, args, 1, true); final String kitName = args[0].toLowerCase(Locale.ENGLISH); final Kit kit = ess.getKits().getKit(kitName); @@ -46,17 +69,42 @@ public class Commandkit extends EssentialsCommand } //TODO: Check kit delay + sender.sendMessage(_("kitGive", kitName)); + } + } - final Trade charge = new Trade("kit-" + kitName, ess); - charge.isAffordableFor(user); - - ess.getKits().sendKit(user, kit); - - //TODO: Merge kit changes from 2.9 + private void listKits(CommandSender sender) throws Exception + { + final String kitList = Kit.listKits(ess, null); + if (kitList.length() > 0) + { + sender.sendMessage(_("kits", kitList)); + } + else + { + sender.sendMessage(_("noKits")); + } + } - charge.charge(user); - user.sendMessage(_("kitGive", kitName)); + private void giveKit(User userTo, User userFrom, String kitName) throws Exception + { + final Map<String, Object> kit = ess.getSettings().getKit(kitName); + if (!userFrom.isAuthorized("essentials.kit." + kitName)) + { + throw new Exception(_("noKitPermission", "essentials.kit." + kitName)); } + + final List<String> items = Kit.getItems(userTo, kit); + + Kit.checkTime(userFrom, kitName, kit); + + final Trade charge = new Trade("kit-" + kitName, ess); + charge.isAffordableFor(userFrom); + + Kit.expandItems(ess, userTo, items); + + charge.charge(userFrom); + userTo.sendMessage(_("kitGive", kitName)); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkittycannon.java b/Essentials/src/com/earth2me/essentials/commands/Commandkittycannon.java index 67a3c9a8b..602f324ad 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkittycannon.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkittycannon.java @@ -1,9 +1,17 @@ package com.earth2me.essentials.commands; +<<<<<<< HEAD +import com.earth2me.essentials.Mob; +import com.earth2me.essentials.User; +import java.util.Random; +import org.bukkit.Location; +import org.bukkit.Server; +======= import com.earth2me.essentials.bukkit.Mob; import com.earth2me.essentials.api.IUser; import java.util.Random; import org.bukkit.Location; +>>>>>>> 3.0 import org.bukkit.entity.Ocelot; @@ -11,8 +19,18 @@ public class Commandkittycannon extends EssentialsCommand { private static Random random = new Random(); +<<<<<<< HEAD + public Commandkittycannon() + { + super("kittycannon"); + } + + @Override + protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception +======= @Override protected void run(final IUser user, final String commandLabel, final String[] args) throws Exception +>>>>>>> 3.0 { final Mob cat = Mob.OCELOT; final Ocelot ocelot = (Ocelot)cat.spawn(user, server, user.getEyeLocation()); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java index 5ad079aea..0a433ad7e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java @@ -5,6 +5,7 @@ import com.earth2me.essentials.utils.Util; import com.earth2me.essentials.api.ISettings; import com.earth2me.essentials.api.IUser; import com.earth2me.essentials.permissions.Permissions; +import com.earth2me.essentials.Util; import java.util.*; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -106,6 +107,7 @@ public class Commandlist extends EssentialsCommand { groupString.append(_("listHiddenTag")); } + user.setDisplayNick(); groupString.append(user.getDisplayName()); groupString.append("ยงf"); } @@ -155,6 +157,7 @@ public class Commandlist extends EssentialsCommand { onlineUsers.append(_("listHiddenTag")); } + user.setDisplayNick(); onlineUsers.append(user.getDisplayName()); onlineUsers.append("ยงf"); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java index 2973acefe..db39d1c01 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java @@ -5,6 +5,7 @@ import com.earth2me.essentials.utils.Util; import com.earth2me.essentials.api.IUser; import com.earth2me.essentials.permissions.Permissions; import java.util.List; +import org.bukkit.Server; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -53,7 +54,7 @@ public class Commandmail extends EssentialsCommand } if (!u.isIgnoringPlayer(user.getName())) { - final String mail = Util.sanitizeString(Util.stripColor(getFinalArg(args, 2))); + final String mail = Util.sanitizeString(Util.stripFormat(getFinalArg(args, 2))); u.addMail(user.getName() + ": " + mail); } user.sendMessage(_("mailSent")); @@ -65,7 +66,7 @@ public class Commandmail extends EssentialsCommand { throw new Exception(_("noPerm", "essentials.mail.sendall")); } - ess.scheduleAsyncDelayedTask(new SendAll(user.getName() + ": " + Util.stripColor(getFinalArg(args, 1)))); + ess.scheduleAsyncDelayedTask(new SendAll(user.getName() + ": " + Util.stripFormat(getFinalArg(args, 1)))); user.sendMessage(_("mailSent")); return; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandme.java b/Essentials/src/com/earth2me/essentials/commands/Commandme.java index ad70231fd..8477c98bc 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandme.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandme.java @@ -31,6 +31,7 @@ public class Commandme extends EssentialsCommand } + user.setDisplayNick(); ess.broadcastMessage(user, _("action", user.getDisplayName(), message)); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java index 16879b258..8cc683e55 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java @@ -43,7 +43,7 @@ public class Commandmsg extends EssentialsCommand } else { - message = Util.replaceColor(message); + message = Util.replaceFormat(message); } final String translatedMe = _("me"); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java index d514ea2e4..edbefafaf 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java @@ -70,9 +70,11 @@ public class Commandnick extends EssentialsCommand { if (user == null || Permissions.NICK_COLOR.isAuthorized(user)) { - return nick.replace('&', '\u00a7').replaceAll("\u00a7+k", ""); - } else { - return Util.stripColor(nick); + return Util.replaceFormat(nick); + } + else + { + return Util.formatString(user, "essentials.nick", nick); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandping.java b/Essentials/src/com/earth2me/essentials/commands/Commandping.java index 9594c3228..5da879907 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandping.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandping.java @@ -16,7 +16,7 @@ public class Commandping extends EssentialsCommand } else { - user.sendMessage(Util.replaceColor(getFinalArg(args, 0))); + sender.sendMessage(Util.replaceFormat(getFinalArg(args, 0))); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java index 5fab91383..9f0cf006a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java @@ -47,26 +47,18 @@ public class Commandpowertool extends EssentialsCommand { user.sendMessage(_("powerToolList", Util.joinList(powertools), itemName)); } - return; + throw new NoChargeException(); } if (command.startsWith("r:")) { - try + command = command.substring(2); + if (!powertools.contains(command)) { - command = command.substring(2); - if (!powertools.contains(command)) - { - throw new Exception(_("powerToolNoSuchCommandAssigned", command, itemName)); - } - - powertools.remove(command); - user.sendMessage(_("powerToolRemove", command, itemName)); - } - catch (Exception e) - { - user.sendMessage(e.getMessage()); - return; + throw new Exception(_("powerToolNoSuchCommandAssigned", command, itemName)); } + + powertools.remove(command); + user.sendMessage(_("powerToolRemove", command, itemName)); } else { @@ -81,7 +73,6 @@ public class Commandpowertool extends EssentialsCommand { throw new Exception(_("powerToolAlreadySet", command, itemName)); } - } else if (powertools != null && !powertools.isEmpty()) { @@ -106,6 +97,11 @@ public class Commandpowertool extends EssentialsCommand user.sendMessage(_("powerToolRemoveAll", itemName)); } + if (!user.arePowerToolsEnabled()) + { + user.setPowerToolsEnabled(true); + user.sendMessage(_("powerToolsEnabled")); + } user.acquireWriteLock(); user.getData().setPowertool(itemStack.getType(), powertools); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandptime.java b/Essentials/src/com/earth2me/essentials/commands/Commandptime.java index efc95f6ba..c4c6e21a3 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandptime.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandptime.java @@ -74,7 +74,7 @@ public class Commandptime extends EssentialsCommand } catch (NumberFormatException e) { - throw new NotEnoughArgumentsException(); + throw new NotEnoughArgumentsException(e); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandr.java b/Essentials/src/com/earth2me/essentials/commands/Commandr.java index e7350ab31..feb183b23 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandr.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandr.java @@ -29,18 +29,18 @@ public class Commandr extends EssentialsCommand IUser user = ess.getUser((Player)sender); if (Permissions.MSG_COLOR.isAuthorized(user)) { - message = Util.replaceColor(message); + message = Util.replaceFormat(message); } else { - message = Util.stripColor(message); + message = Util.replaceFormat(message); } replyTo = user; senderName = user.getDisplayName(); } else { - message = Util.replaceColor(message); + message = Util.replaceFormat(message); replyTo = Console.getConsoleReplyTo(); senderName = Console.NAME; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java index c4ff19dec..9d69d2ad6 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java @@ -29,10 +29,11 @@ public class Commandrealname extends EssentialsCommand { continue; } - final String displayName = Util.stripColor(u.getDisplayName()).toLowerCase(Locale.ENGLISH); + u.setDisplayNick(); + final String displayName = Util.stripFormat(u.getDisplayName()).toLowerCase(Locale.ENGLISH); settings.acquireReadLock(); if (!whois.equals(displayName) - && !displayName.equals(Util.stripColor(settings.getData().getChat().getNicknamePrefix()) + whois) + && !displayName.equals(Util.stripFormat(settings.getData().getChat().getNicknamePrefix()) + whois) && !whois.equalsIgnoreCase(u.getName())) { continue; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandremove.java b/Essentials/src/com/earth2me/essentials/commands/Commandremove.java index 66cdf625d..05d27a3bc 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandremove.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandremove.java @@ -40,7 +40,7 @@ public class Commandremove extends EssentialsCommand } catch (NumberFormatException e) { - throw new Exception(_("numberRequired")); + throw new Exception(_("numberRequired"), e); } } @@ -50,7 +50,7 @@ public class Commandremove extends EssentialsCommand } catch (IllegalArgumentException e) { - throw new NotEnoughArgumentsException(); //TODO: translate and list types + throw new NotEnoughArgumentsException(e); //TODO: translate and list types } removeEntities(user, world, toRemove, radius); @@ -77,7 +77,7 @@ public class Commandremove extends EssentialsCommand } catch (IllegalArgumentException e) { - throw new NotEnoughArgumentsException(); //TODO: translate and list types + throw new NotEnoughArgumentsException(e); //TODO: translate and list types } removeEntities(sender, world, toRemove, 0); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java index 4503e2416..05715b515 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java @@ -50,6 +50,8 @@ public class Commandrepair extends EssentialsCommand } else if (args[0].equalsIgnoreCase("all")) { + final Trade charge = new Trade("repair-all", ess); + charge.isAffordableFor(user); final List<String> repaired = new ArrayList<String>(); repairItems(user.getInventory().getContents(), user, repaired); @@ -66,6 +68,7 @@ public class Commandrepair extends EssentialsCommand { user.sendMessage(_("repair", Util.joinList(repaired))); } + charge.charge(user); } else @@ -99,7 +102,7 @@ public class Commandrepair extends EssentialsCommand continue; } final String itemName = item.getType().toString().toLowerCase(Locale.ENGLISH); - final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess); + final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), "repair-item", ess); try { charge.isAffordableFor(user); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java index 322bde642..5dcaa0f2a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java @@ -33,6 +33,7 @@ public class Commandseen extends EssentialsCommand try { IUser u = getPlayer(args, 0); + player.setDisplayNick(); sender.sendMessage(_("seenOnline", u.getDisplayName(), DateUtil.formatDateDiff(u.getTimestamp(TimestampType.LOGIN)))); } catch (NoSuchFieldException e) @@ -44,11 +45,20 @@ public class Commandseen extends EssentialsCommand { throw new Exception(_("playerNotFound")); } + player.setDisplayNick(); sender.sendMessage(_("seenOffline", u.getDisplayName(), DateUtil.formatDateDiff(u.getTimestamp(TimestampType.LOGOUT)))); if (u.isBanned()) { sender.sendMessage(_("whoisBanned", show ? u.getData().getBan().getReason() : _("true"))); } + if (extra) + { + sender.sendMessage(_("whoisIPAddress", player.getLastLoginAddress())); + final Location loc = player.getLastLocation(); + if (loc != null) { + sender.sendMessage(_("whoisLocation", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); + } + } } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java index bc2ed632d..5ef850264 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java @@ -26,7 +26,8 @@ public class Commandsethome extends EssentialsCommand { if (Permissions.SETHOME_MULTIPLE.isAuthorized(user)) { - if ("bed".equals(args[0].toLowerCase(Locale.ENGLISH))) { + if ("bed".equals(args[0].toLowerCase(Locale.ENGLISH))) + { throw new NotEnoughArgumentsException(); } if ((user.getHomes().size() < ess.getRanks().getHomeLimit(user)) @@ -65,7 +66,8 @@ public class Commandsethome extends EssentialsCommand { name = "home"; } - if ("bed".equals(name.toLowerCase(Locale.ENGLISH))) { + if ("bed".equals(name.toLowerCase(Locale.ENGLISH))) + { throw new NotEnoughArgumentsException(); } @@ -87,7 +89,7 @@ public class Commandsethome extends EssentialsCommand } user.getData().getHomes().put("home", new com.earth2me.essentials.storage.Location(user.getLocation())); } - user.sendMessage(_("homeSet")); + user.sendMessage(_("homeSet", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ())); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetjail.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetjail.java index 2fcad7bd2..fea08f7a0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsetjail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetjail.java @@ -14,7 +14,7 @@ public class Commandsetjail extends EssentialsCommand throw new NotEnoughArgumentsException(); } ess.getJails().setJail(args[0], user.getLocation()); - user.sendMessage(_("jailSet", args[0])); + user.sendMessage(_("jailSet", Util.sanitizeString(args[0]))); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java index 5a0599789..72b42fe7c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java @@ -3,6 +3,8 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.api.IUser; import com.earth2me.essentials.api.IWarps; +import com.earth2me.essentials.Util; +import com.earth2me.essentials.Warps; import org.bukkit.Location; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java index e6acb1fbe..e42c11651 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java @@ -3,6 +3,7 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.api.IUser; import org.bukkit.command.CommandSender; +import org.bukkit.command.CommandSender; import org.bukkit.inventory.ItemStack; @@ -37,6 +38,32 @@ public class Commandsetworth extends EssentialsCommand @Override public void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { + if (args.length < 1) + { + throw new NotEnoughArgumentsException(); + } + + ItemStack stack; + String price; + + if (args.length == 1) + { + stack = user.getInventory().getItemInHand(); + price = args[0]; + } + else + { + stack = ess.getItemDb().get(args[0]); + price = args[1]; + } + + ess.getWorth().setPrice(stack, Double.parseDouble(price)); + user.sendMessage(_("worthSet")); + } + + @Override + public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception + { if (args.length < 2) { throw new NotEnoughArgumentsException(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java index 1a3b52e1f..c68290c65 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.*; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.bukkit.Mob; import com.earth2me.essentials.economy.Trade; @@ -11,6 +12,7 @@ import java.util.Locale; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.CreatureSpawner; +import org.bukkit.entity.EntityType; public class Commandspawner extends EssentialsCommand @@ -29,6 +31,24 @@ public class Commandspawner extends EssentialsCommand throw new Exception(_("mobSpawnTarget")); } + String name = args[0]; + + Mob mob = null; + mob = Mob.fromName(name); + if (mob == null) + { + throw new Exception(_("invalidMob")); + } + if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase(Locale.ENGLISH))) + { + throw new Exception(_("disabledToSpawnMob")); + } + if (!user.isAuthorized("essentials.spawner." + mob.name.toLowerCase(Locale.ENGLISH))) + { + throw new Exception(_("noPermToSpawnMob")); + } + final Trade charge = new Trade("spawner-" + mob.name.toLowerCase(Locale.ENGLISH), ess); + charge.isAffordableFor(user); try { String name = args[0]; @@ -54,5 +74,8 @@ public class Commandspawner extends EssentialsCommand { throw new Exception(_("mobSpawnError"), ex); } + charge.charge(user); + user.sendMessage(_("setSpawner", mob.name)); + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java index 717a578e2..c9c8a2a4b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java @@ -9,13 +9,13 @@ import com.earth2me.essentials.permissions.SpawnmobPermissions; import com.earth2me.essentials.utils.LocationUtil; import com.earth2me.essentials.utils.Util; import java.util.HashSet; -import java.util.Locale; -import java.util.Random; -import java.util.Set; +import java.util.*; import org.bukkit.DyeColor; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.entity.*; +import org.bukkit.entity.Villager.Profession; +import org.bukkit.material.Colorable; public class Commandspawnmob extends EssentialsCommand @@ -97,7 +97,7 @@ public class Commandspawnmob extends EssentialsCommand } catch (MobException e) { - throw new Exception(_("unableToSpawnMob")); + throw new Exception(_("unableToSpawnMob"), e); } if (mountType != null) @@ -119,7 +119,7 @@ public class Commandspawnmob extends EssentialsCommand } catch (MobException e) { - throw new Exception(_("unableToSpawnMob")); + throw new Exception(_("unableToSpawnMob"), e); } spawnedMob.setPassenger(spawnedMount); } @@ -164,7 +164,7 @@ public class Commandspawnmob extends EssentialsCommand } catch (MobException e) { - throw new Exception(_("unableToSpawnMob")); + throw new Exception(_("unableToSpawnMob"), e); } spawnedMob.setPassenger(spawnedMount); } @@ -201,7 +201,8 @@ public class Commandspawnmob extends EssentialsCommand private void changeMobData(final EntityType type, final Entity spawned, String data, final IUser user) throws Exception { data = data.toLowerCase(Locale.ENGLISH); - if (type == EntityType.SLIME || type == EntityType.MAGMA_CUBE) + + if (spawned instanceof Slime) { try { @@ -212,32 +213,24 @@ public class Commandspawnmob extends EssentialsCommand throw new Exception(_("slimeMalformedSize"), e); } } - if ((type == EntityType.SHEEP - || type == EntityType.COW - || type == EntityType.MUSHROOM_COW - || type == EntityType.CHICKEN - || type == EntityType.PIG - || type == EntityType.VILLAGER - || type == EntityType.OCELOT - || type == EntityType.WOLF) - && data.contains("baby")) + if (spawned instanceof Ageable && data.contains("baby")) { - ((Animals)spawned).setBaby(); + ((Ageable)spawned).setBaby(); return; } - if (type == EntityType.SHEEP) + if (spawned instanceof Colorable) { final String color = data.toUpperCase(Locale.ENGLISH).replace("BABY", ""); try { if (color.equals("RANDOM")) { - Random rand = new Random(); - ((Sheep)spawned).setColor(DyeColor.values()[rand.nextInt(DyeColor.values().length)]); + final Random rand = new Random(); + ((Colorable)spawned).setColor(DyeColor.values()[rand.nextInt(DyeColor.values().length)]); } else { - ((Sheep)spawned).setColor(DyeColor.valueOf(color)); + ((Colorable)spawned).setColor(DyeColor.valueOf(color)); } } catch (Exception e) @@ -245,9 +238,7 @@ public class Commandspawnmob extends EssentialsCommand throw new Exception(_("sheepMalformedColor"), e); } } - if ((type == EntityType.WOLF - || type == EntityType.OCELOT) - && data.contains("tamed")) + if (spawned instanceof Tameable && data.contains("tamed")) { final Tameable tameable = ((Tameable)spawned); tameable.setTamed(true); @@ -268,6 +259,31 @@ public class Commandspawnmob extends EssentialsCommand { ((Ocelot)spawned).setCatType(Ocelot.Type.SIAMESE_CAT); } + else if (data.contains("red")) + { + ((Ocelot)spawned).setCatType(Ocelot.Type.RED_CAT); + } + else if (data.contains("black")) + { + ((Ocelot)spawned).setCatType(Ocelot.Type.BLACK_CAT); + } + } + if (type == EntityType.VILLAGER) + { + for (Profession prof : Villager.Profession.values()) + { + if (data.contains(prof.toString().toLowerCase(Locale.ENGLISH))) + { + ((Villager)spawned).setProfession(prof); + } + } + } + if (type == EntityType.OCELOT) + { + if (data.contains("siamese")) + { + ((Ocelot)spawned).setCatType(Ocelot.Type.SIAMESE_CAT); + } if (data.contains("red")) { ((Ocelot)spawned).setCatType(Ocelot.Type.RED_CAT); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java b/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java index 147207d39..1c6b99c32 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java @@ -12,9 +12,9 @@ public class Commandsuicide extends EssentialsCommand { EntityDamageEvent ede = new EntityDamageEvent(user.getBase(), EntityDamageEvent.DamageCause.SUICIDE, 1000); server.getPluginManager().callEvent(ede); - user.damage(1000); - user.setHealth(0); + user.damage(Short.MAX_VALUE); user.sendMessage(_("suicideMessage")); + user.setDisplayNick(); ess.broadcastMessage(user,_("suicideSuccess", user.getDisplayName())); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtime.java b/Essentials/src/com/earth2me/essentials/commands/Commandtime.java index addd6654d..9b28f5d6c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtime.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtime.java @@ -4,6 +4,7 @@ import com.earth2me.essentials.utils.DescParseTickFormat; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.api.IUser; import com.earth2me.essentials.permissions.Permissions; +import com.earth2me.essentials.Util; import java.util.*; import org.bukkit.World; import org.bukkit.command.CommandSender; @@ -15,16 +16,23 @@ public class Commandtime extends EssentialsCommand @Override public void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { + final List<String> argList = new ArrayList<String>(Arrays.asList(args)); + if ((argList.remove("set") || argList.remove("add")) && Util.isInt(argList.get(0))) + { + ess.getLogger().info("debug edited 0" + argList.get(0).toString()); + } + final String[] validArgs = argList.toArray(new String[0]); + // Which World(s) are we interested in? String worldSelector = null; - if (args.length == 2) + if (validArgs.length == 2) { - worldSelector = args[1]; + worldSelector = validArgs[1]; } final Set<World> worlds = getWorlds(sender, worldSelector); // If no arguments we are reading the time - if (args.length == 0) + if (validArgs.length == 0) { getWorldsTime(sender, worlds); return; @@ -40,11 +48,11 @@ public class Commandtime extends EssentialsCommand long ticks; try { - ticks = DescParseTickFormat.parse(args[0]); + ticks = DescParseTickFormat.parse(validArgs[0]); } catch (NumberFormatException e) { - throw new NotEnoughArgumentsException(); + throw new NotEnoughArgumentsException(e); } setWorldsTime(sender, worlds, ticks); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java index 0fbc4a056..f508c872c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java @@ -28,6 +28,11 @@ public class Commandtp extends EssentialsCommand { throw new Exception(_("teleportDisabled", player.getDisplayName())); } + if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + player.getWorld().getName())) + { + throw new Exception(_("noPerm", "essentials.world." + player.getWorld().getName())); + } user.sendMessage(_("teleporting")); final Trade charge = new Trade(commandName, ess); charge.isAffordableFor(user); @@ -42,6 +47,19 @@ public class Commandtp extends EssentialsCommand user.sendMessage(_("teleporting")); final IUser target = getPlayer(args, 0); final IUser toPlayer = getPlayer(args, 1); + if (!target.isTeleportEnabled()) + { + throw new Exception(_("teleportDisabled", target.getDisplayName())); + } + if (!toPlayer.isTeleportEnabled()) + { + throw new Exception(_("teleportDisabled", toPlayer.getDisplayName())); + } + if (target.getWorld() != toPlayer.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + toPlayer.getWorld().getName())) + { + throw new Exception(_("noPerm", "essentials.world." + toPlayer.getWorld().getName())); + } target.getTeleport().now(toPlayer, false, TeleportCause.COMMAND); target.sendMessage(_("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName())); break; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java index 6790883c6..6ce71b3ba 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java @@ -23,7 +23,12 @@ public class Commandtpa extends EssentialsCommand { throw new Exception(_("teleportDisabled", player.getDisplayName())); } - if (!player.isIgnoringPlayer(user.getName())) + if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + player.getWorld().getName())) + { + throw new Exception(_("noPerm", "essentials.world." + player.getWorld().getName())); + } + if (!player.isIgnoredPlayer(user.getName())) { player.requestTeleport(user, false); player.sendMessage(_("teleportRequest", user.getDisplayName())); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java index ad3bb0aa5..7f7d36413 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java @@ -43,6 +43,11 @@ public class Commandtpaall extends EssentialsCommand { continue; } + if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + user.getWorld().getName())) + { + continue; + } try { player.requestTeleport(user, true); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java index 2953b9c93..8b7cb7b1b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java @@ -27,7 +27,21 @@ public class Commandtpaccept extends EssentialsCommand { throw new Exception(_("noPendingRequest")); } - + + if (user.isTpRequestHere() && ((!target.isAuthorized("essentials.tpahere") && !target.isAuthorized("essentials.tpaall")) + || (user.getWorld() != target.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + user.getWorld().getName())))) + { + throw new Exception(_("noPendingRequest")); + } + + if (!user.isTpRequestHere() && (!target.isAuthorized("essentials.tpa") + || (user.getWorld() != target.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + target.getWorld().getName())))) + { + throw new Exception(_("noPendingRequest")); + } + if (args.length > 0 && !target.getName().contains(args[0])) { throw new Exception(_("noPendingRequest")); @@ -52,7 +66,7 @@ public class Commandtpaccept extends EssentialsCommand } final Trade charge = new Trade(commandName, ess); - if (user.isTeleportRequestHere()) + if (user.isTpRequestHere()) { charge.isAffordableFor(user); } @@ -63,7 +77,7 @@ public class Commandtpaccept extends EssentialsCommand user.sendMessage(_("requestAccepted")); target.sendMessage(_("requestAcceptedFrom", user.getDisplayName())); - if (user.isTeleportRequestHere()) + if (user.isTpRequestHere()) { user.getTeleport().teleport(target, charge, TeleportCause.COMMAND); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java index b28898cd6..c32a14470 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java @@ -23,6 +23,11 @@ public class Commandtpahere extends EssentialsCommand { throw new Exception(_("teleportDisabled", player.getDisplayName())); } + if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + user.getWorld().getName())) + { + throw new Exception(_("noPerm", "essentials.world." + user.getWorld().getName())); + } player.requestTeleport(user, true); player.sendMessage(_("teleportHereRequest", user.getDisplayName())); player.sendMessage(_("typeTpaccept")); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java index ee1cd230f..fb7efcdcb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java @@ -36,6 +36,11 @@ public class Commandtpall extends EssentialsCommand { continue; } + if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + user.getWorld().getName())) + { + continue; + } try { player.getTeleport().now(user, false, TeleportCause.COMMAND); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java index ee137fb38..a995e31f4 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java @@ -19,7 +19,12 @@ public class Commandtphere extends EssentialsCommand { throw new Exception(_("teleportDisabled", player.getDisplayName())); } - player.getTeleport().teleport(user, new Trade(commandName, ess), TeleportCause.COMMAND); + if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + user.getWorld().getName())) + { + throw new Exception(_("noPerm", "essentials.world." + user.getWorld().getName())); + } + 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 5c6cfb195..56041fc3e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java @@ -11,28 +11,50 @@ public class Commandtpo extends EssentialsCommand @Override public void run(final IUser user, final String commandLabel, final String[] args) throws Exception { - if (args.length < 1) + switch (args.length) { + case 0: throw new NotEnoughArgumentsException(); - } - - //Just basically the old tp command - final IUser player = getPlayer(args, 0, true); - // Check if user is offline - if (!player.isOnline()) - { - throw new NoSuchFieldException(_("playerNotFound")); - } - // Verify permission - if (!player.isHidden() || Permissions.TELEPORT_HIDDEN.isAuthorized(user)) - { + case 1: + final User player = getPlayer(server, args, 0, true); + if (!player.isOnline() || (player.isHidden() && !user.isAuthorized("essentials.teleport.hidden"))) + { + throw new NoSuchFieldException(_("playerNotFound")); + } + if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + player.getWorld().getName())) + { + throw new Exception(_("noPerm", "essentials.world." + player.getWorld().getName())); + } + user.sendMessage(_("teleporting")); user.getTeleport().now(player, false, TeleportCause.COMMAND); + break; + + default: + if (!user.isAuthorized("essentials.tp.others")) + { + throw new Exception(_("noPerm", "essentials.tp.others")); + } user.sendMessage(_("teleporting")); - } - else - { - throw new NoSuchFieldException(_("playerNotFound")); + final User target = getPlayer(server, args, 0, true); + final User toPlayer = getPlayer(server, args, 1, true); + + if (!target.isOnline() || !toPlayer.isOnline() + || ((target.isHidden() || toPlayer.isHidden()) && !user.isAuthorized("essentials.teleport.hidden"))) + { + throw new NoSuchFieldException(_("playerNotFound")); + } + + if (target.getWorld() != toPlayer.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + toPlayer.getWorld().getName())) + { + throw new Exception(_("noPerm", "essentials.world." + toPlayer.getWorld().getName())); + } + + target.getTeleport().now(toPlayer, false, TeleportCause.COMMAND); + target.sendMessage(_("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName())); + break; } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java index 009d0f191..e27613b20 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java @@ -25,6 +25,12 @@ public class Commandtpohere extends EssentialsCommand throw new NoSuchFieldException(_("playerNotFound")); } + if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + user.getWorld().getName())) + { + throw new Exception(_("noPerm", "essentials.world." + user.getWorld().getName())); + } + // Verify permission if (!player.isHidden() || Permissions.TELEPORT_HIDDEN.isAuthorized(user)) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java index 79d803cd1..ca50a068d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java @@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.economy.Trade; import com.earth2me.essentials.api.IUser; import org.bukkit.Location; +import org.bukkit.command.CommandSender; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -35,4 +36,30 @@ public class Commandtppos extends EssentialsCommand user.getTeleport().teleport(location, charge, TeleportCause.COMMAND); throw new NoChargeException(); } + + @Override + public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception + { + if (args.length < 4) + { + throw new NotEnoughArgumentsException(); + } + + User user = ess.getUser(server.getPlayer(args[0])); + final int x = Integer.parseInt(args[1]); + final int y = Integer.parseInt(args[2]); + final int z = Integer.parseInt(args[3]); + final Location location = new Location(user.getWorld(), x, y, z); + if (args.length > 4) + { + location.setYaw((Float.parseFloat(args[4]) + 180 + 360) % 360); + } + if (args.length > 5) + { + location.setPitch(Float.parseFloat(args[5])); + } + sender.sendMessage(_("teleporting")); + user.sendMessage(_("teleporting")); + user.getTeleport().teleport(location, null, TeleportCause.COMMAND); + } }
\ No newline at end of file diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtree.java b/Essentials/src/com/earth2me/essentials/commands/Commandtree.java index b4e47fbb6..79bbecd29 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtree.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtree.java @@ -37,6 +37,18 @@ public class Commandtree extends EssentialsCommand { tree = TreeType.BROWN_MUSHROOM; } + else if (args[0].equalsIgnoreCase("jungle")) + { + tree = TreeType.SMALL_JUNGLE; + } + else if (args[0].equalsIgnoreCase("junglebush")) + { + tree = TreeType.JUNGLE_BUSH; + } + else if (args[0].equalsIgnoreCase("swamp")) + { + tree = TreeType.SWAMP; + } else { throw new NotEnoughArgumentsException(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java index a18856d66..101e09691 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java @@ -27,7 +27,7 @@ public class Commandunban extends EssentialsCommand } catch (NoSuchFieldException e) { - throw new Exception(_("playerNotFound")); + throw new Exception(_("playerNotFound"), e); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java b/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java new file mode 100644 index 000000000..b55bd76a4 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java @@ -0,0 +1,41 @@ +package com.earth2me.essentials.commands; + +import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.User; +import org.bukkit.ChatColor; +import org.bukkit.Server; +import org.bukkit.entity.Player; + + +public class Commandvanish extends EssentialsCommand +{ + public Commandvanish() + { + super("vanish"); + } + + @Override + protected void run(Server server, User user, String commandLabel, String[] args) throws Exception + { + if (user.isVanished()) + { + for (Player p : server.getOnlinePlayers()) + { + p.showPlayer(user); + } + user.sendMessage(_("vanished")); + } + else + { + for (Player p : server.getOnlinePlayers()) + { + if (!ess.getUser(p).isAuthorized("essentials.vanish.see")) + { + p.hidePlayer(user); + } + user.sendMessage(_("unvanished")); + } + } + user.toggleVanished(); + } +} diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java index d6c3eae72..a809c3c8d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java @@ -111,7 +111,10 @@ public class Commandwarp extends EssentialsCommand private void warpUser(final IUser user, final String name) throws Exception { - final Trade charge = new Trade("warp-" + name.toLowerCase(Locale.ENGLISH).replace('_', '-'), ess); + final Trade chargeWarp = new Trade("warp-" + name.toLowerCase(Locale.ENGLISH).replace('_', '-'), ess); + final Trade chargeCmd = new Trade(this.getName(), ess); + final double fullCharge = chargeWarp.getCommandCost(user) + chargeCmd.getCommandCost(user); + final Trade charge = new Trade(fullCharge, ess); charge.isAffordableFor(user); if (WarpPermissions.getPermission(name).isAuthorized(user)) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java index 8f11b05d7..cc3a876ec 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java @@ -7,6 +7,7 @@ import com.earth2me.essentials.api.IUser; import com.earth2me.essentials.permissions.Permissions; import com.earth2me.essentials.user.UserData; import com.earth2me.essentials.utils.DateUtil; +import com.earth2me.essentials.craftbukkit.SetExpFix; import java.util.Locale; import lombok.Cleanup; import org.bukkit.command.CommandSender; @@ -49,7 +50,7 @@ public class Commandwhois extends EssentialsCommand continue; } user.acquireReadLock(); - final String nickName = Util.stripColor(user.getData().getNickname()); + final String nickName = Util.stripFormat(user.getData().getNickname()); if (!whois.equalsIgnoreCase(nickName) && !whois.substring(prefixLength).equalsIgnoreCase(nickName) && !whois.equalsIgnoreCase(user.getName())) @@ -57,8 +58,10 @@ public class Commandwhois extends EssentialsCommand continue; } sender.sendMessage(""); + user.setDisplayNick(); sender.sendMessage(_("whoisIs", user.getDisplayName(), user.getName())); sender.sendMessage(_("whoisHealth", user.getHealth())); + sender.sendMessage(_("whoisExp", SetExpFix.getTotalExperience(user), user.getLevel())); sender.sendMessage(_("whoisOP", (user.isOp() ? _("true") : _("false")))); sender.sendMessage(_("whoisGod", (user.isGodModeEnabled() ? _("true") : _("false")))); sender.sendMessage(_("whoisGamemode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)))); diff --git a/Essentials/src/com/earth2me/essentials/commands/WarpNotFoundException.java b/Essentials/src/com/earth2me/essentials/commands/WarpNotFoundException.java index 6caea6dd2..c5b592c2a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/WarpNotFoundException.java +++ b/Essentials/src/com/earth2me/essentials/commands/WarpNotFoundException.java @@ -5,7 +5,7 @@ public class WarpNotFoundException extends Exception { public WarpNotFoundException() { - super(""); + super(_("warpNotExist")); } public WarpNotFoundException(String message) diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/FakeExplosion.java b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeExplosion.java deleted file mode 100644 index 934d94fa2..000000000 --- a/Essentials/src/com/earth2me/essentials/craftbukkit/FakeExplosion.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.earth2me.essentials.craftbukkit; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; -import net.minecraft.server.ChunkPosition; -import net.minecraft.server.Packet60Explosion; -import org.bukkit.Location; -import org.bukkit.Server; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.CraftWorld; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityExplodeEvent; - - -public class FakeExplosion -{ - public static void createExplosion(final EntityExplodeEvent event, final Server server, final Player[] players) - { - try - { - final Set<ChunkPosition> set = new HashSet<ChunkPosition>(event.blockList().size()); - final List<ChunkPosition> blocksUnderPlayers = new ArrayList<ChunkPosition>(players.length); - final Location loc = event.getLocation(); - for (Player player : players) - { - if (player.getWorld().equals(loc.getWorld())) - { - blocksUnderPlayers.add(new ChunkPosition(player.getLocation().getBlockX(), player.getLocation().getBlockY() - 1, player.getLocation().getBlockZ())); - } - } - for (Block block : event.blockList()) - { - final ChunkPosition cp = new ChunkPosition(block.getX(), block.getY(), block.getZ()); - if (!blocksUnderPlayers.contains(cp)) - { - set.add(cp); - } - } - ((CraftServer)server).getHandle().sendPacketNearby(loc.getX(), loc.getY(), loc.getZ(), 64.0, ((CraftWorld)loc.getWorld()).getHandle().worldProvider.dimension, new Packet60Explosion(loc.getX(), loc.getY(), loc.getZ(), 3.0F, set)); - } - catch (Throwable ex) - { - Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex); - } - } -} diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java b/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java index a6d5d4fbc..fc9cbb74b 100644 --- a/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java @@ -15,12 +15,12 @@ public final class InventoryWorkaround { } - public static int first(final Inventory inventory, final ItemStack item, final boolean forceDurability, final boolean forceAmount, final boolean forceEnchantments) + public static int first(final Inventory inventory, final ItemStack item, final boolean enforceDurability, final boolean enforceAmount, final boolean enforceEnchantments) { - return next(inventory, item, 0, forceDurability, forceAmount, forceEnchantments); + return next(inventory, item, 0, enforceDurability, enforceAmount, enforceEnchantments); } - public static int next(final Inventory cinventory, final ItemStack item, final int start, final boolean forceDurability, final boolean forceAmount, final boolean forceEnchantments) + public static int next(final Inventory cinventory, final ItemStack item, final int start, final boolean enforceDurability, final boolean enforceAmount, final boolean enforceEnchantments) { final ItemStack[] inventory = cinventory.getContents(); for (int i = start; i < inventory.length; i++) @@ -30,7 +30,7 @@ public final class InventoryWorkaround { continue; } - if (item.getTypeId() == cItem.getTypeId() && (!forceAmount || item.getAmount() == cItem.getAmount()) && (!forceDurability || cItem.getDurability() == item.getDurability()) && (!forceEnchantments || cItem.getEnchantments().equals(item.getEnchantments()))) + if (item.getTypeId() == cItem.getTypeId() && (!enforceAmount || item.getAmount() == cItem.getAmount()) && (!enforceDurability || cItem.getDurability() == item.getDurability()) && (!enforceEnchantments || cItem.getEnchantments().equals(item.getEnchantments()))) { return i; } @@ -38,12 +38,12 @@ public final class InventoryWorkaround return -1; } - public static int firstPartial(final Inventory cinventory, final ItemStack item, final boolean forceDurability) + public static int firstPartial(final Inventory cinventory, final ItemStack item, final boolean enforceDurability) { - return firstPartial(cinventory, item, forceDurability, item.getType().getMaxStackSize()); + return firstPartial(cinventory, item, enforceDurability, item.getType().getMaxStackSize()); } - public static int firstPartial(final Inventory cinventory, final ItemStack item, final boolean forceDurability, final int maxAmount) + public static int firstPartial(final Inventory cinventory, final ItemStack item, final boolean enforceDurability, final int maxAmount) { if (item == null) { @@ -57,7 +57,7 @@ public final class InventoryWorkaround { continue; } - if (item.getTypeId() == cItem.getTypeId() && cItem.getAmount() < maxAmount && (!forceDurability || cItem.getDurability() == item.getDurability()) && cItem.getEnchantments().equals(item.getEnchantments())) + if (item.getTypeId() == cItem.getTypeId() && cItem.getAmount() < maxAmount && (!enforceDurability || cItem.getDurability() == item.getDurability()) && cItem.getEnchantments().equals(item.getEnchantments())) { return i; } @@ -65,12 +65,12 @@ public final class InventoryWorkaround return -1; } - public static boolean addAllItems(final Inventory cinventory, final boolean forceDurability, final ItemStack... items) + public static boolean addAllItems(final Inventory cinventory, final boolean enforceDurability, final ItemStack... items) { final Inventory fake = new FakeInventory(cinventory.getContents()); - if (addItem(fake, forceDurability, items).isEmpty()) + if (addItem(fake, enforceDurability, items).isEmpty()) { - addItem(cinventory, forceDurability, items); + addItem(cinventory, enforceDurability, items); return true; } else @@ -84,7 +84,7 @@ public final class InventoryWorkaround return addItem(cinventory, forceDurability, 0, items); } - public static Map<Integer, ItemStack> addItem(final Inventory cinventory, final boolean forceDurability, final int oversizedStacks, final ItemStack... items) + public static Map<Integer, ItemStack> addItem(final Inventory cinventory, final boolean enforceDurability, final int oversizedStacks, final ItemStack... items) { final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>(); @@ -109,7 +109,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() && (!enforceDurability || combined[j].getDurability() == items[i].getDurability()) && combined[j].getEnchantments().equals(items[i].getEnchantments())) { combined[j].setAmount(combined[j].getAmount() + items[i].getAmount()); break; @@ -130,7 +130,7 @@ public final class InventoryWorkaround { // Do we already have a stack of it? final int maxAmount = oversizedStacks > item.getType().getMaxStackSize() ? oversizedStacks : item.getType().getMaxStackSize(); - final int firstPartial = firstPartial(cinventory, item, forceDurability, maxAmount); + final int firstPartial = firstPartial(cinventory, item, enforceDurability, maxAmount); // Drat! no partial stack if (firstPartial == -1) @@ -186,7 +186,7 @@ public final class InventoryWorkaround return leftover; } - public static Map<Integer, ItemStack> removeItem(final Inventory cinventory, final boolean forceDurability, final boolean forceEnchantments, final ItemStack... items) + public static Map<Integer, ItemStack> removeItem(final Inventory cinventory, final boolean enforceDurability, final boolean enforceEnchantments, final ItemStack... items) { final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>(); @@ -211,7 +211,7 @@ public final class InventoryWorkaround } // get first Item, ignore the amount - final int first = first(cinventory, item, forceDurability, false, forceEnchantments); + final int first = first(cinventory, item, enforceDurability, false, enforceEnchantments); // Drat! we don't have this type in the inventory if (first == -1) @@ -244,7 +244,7 @@ public final class InventoryWorkaround return leftover; } - public static boolean containsItem(final Inventory cinventory, final boolean forceDurability, final boolean forceEnchantments, final ItemStack... items) + public static boolean containsItem(final Inventory cinventory, final boolean enforceDurability, final boolean enforceEnchantments, final ItemStack... items) { final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>(); @@ -266,7 +266,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()) && (!forceEnchantments || combined[j].getEnchantments().equals(items[i].getEnchantments()))) + if (combined[j].getTypeId() == items[i].getTypeId() && (!enforceDurability || combined[j].getDurability() == items[i].getDurability()) && (!enforceEnchantments || combined[j].getEnchantments().equals(items[i].getEnchantments()))) { combined[j].setAmount(combined[j].getAmount() + items[i].getAmount()); break; @@ -292,7 +292,7 @@ public final class InventoryWorkaround break; } - final int slot = next(cinventory, item, position, forceDurability, false, forceEnchantments); + final int slot = next(cinventory, item, position, enforceDurability, false, enforceEnchantments); // Drat! we don't have this type in the inventory if (slot == -1) diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/SetExpFix.java b/Essentials/src/com/earth2me/essentials/craftbukkit/SetExpFix.java index 5b1161851..b788fa7ee 100644 --- a/Essentials/src/com/earth2me/essentials/craftbukkit/SetExpFix.java +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/SetExpFix.java @@ -5,6 +5,8 @@ import org.bukkit.entity.Player; public class SetExpFix { + //This method is used to update both the recorded total experience and displayed total experience. + //We reset both types to prevent issues. public static void setTotalExperience(final Player player, final int exp) { if (exp < 0) @@ -14,6 +16,9 @@ public class SetExpFix player.setExp(0); player.setLevel(0); player.setTotalExperience(0); + + //This following code is technically redundant now, as bukkit now calulcates levels more or less correctly + //At larger numbers however... player.getExp(3000), only seems to give 2999, putting the below calculations off. int amount = exp; while (amount > 0) { @@ -44,9 +49,11 @@ public class SetExpFix return 7 + (level * 7 >> 1); } + //This method is required because the bukkit player.getTotalExperience() method, shows exp that has been 'spent'. + //Without this people would be able to use exp and then still sell it. public static int getTotalExperience(final Player player) { - int exp = (int) (getExpToLevel(player) * player.getExp()); + int exp = (int)Math.round(getExpToLevel(player) * player.getExp()); int currentLevel = player.getLevel(); while (currentLevel > 0) { diff --git a/Essentials/src/com/earth2me/essentials/economy/Trade.java b/Essentials/src/com/earth2me/essentials/economy/Trade.java index f2b11ee51..f9812a2f9 100644 --- a/Essentials/src/com/earth2me/essentials/economy/Trade.java +++ b/Essentials/src/com/earth2me/essentials/economy/Trade.java @@ -27,6 +27,7 @@ import org.bukkit.inventory.ItemStack; public class Trade { private final transient String command; + private final transient String fallbackCommand; private final transient Double money; private final transient ItemStack itemStack; private final transient Integer exp; @@ -34,27 +35,33 @@ public class Trade public Trade(final String command, final IEssentials ess) { - this(command, null, null, null, ess); + this(command, null, null, null, null, ess); + } + + public Trade(final String command, final String fallback, final IEssentials ess) + { + this(command, fallback, null, null, null, ess); } public Trade(final double money, final IEssentials ess) { - this(null, money, null, null, ess); + this(null, null, money, null, null, ess); } public Trade(final ItemStack items, final IEssentials ess) { - this(null, null, items, null, ess); + this(null, null, null, items, null, ess); } public Trade(final int exp, final IEssentials ess) { - this(null, null, null, exp, ess); + this(null, null, null, null, exp, ess); } - private Trade(final String command, final Double money, final ItemStack item, final Integer exp, final IEssentials ess) + private Trade(final String command, final String fallback, final Double money, final ItemStack item, final Integer exp, final IEssentials ess) { this.command = command; + this.fallbackCommand = fallback; this.money = money; this.itemStack = item; this.exp = exp; @@ -63,11 +70,10 @@ public class Trade public void isAffordableFor(final IUser user) throws ChargeException { - final double mon = user.getMoney(); if (getMoney() != null - && mon < getMoney() && getMoney() > 0 && !Permissions.ECO_LOAN.isAuthorized(user)) + && !user.canAfford(getMoney())) { throw new ChargeException(_("notEnoughMoney")); } @@ -206,6 +212,22 @@ public class Trade { return exp; } + + public Double getCommandCost(final IUser user) + { + double cost = 0d; + if (command != null && !command.isEmpty() + && !user.isAuthorized("essentials.nocommandcost.all") + && !user.isAuthorized("essentials.nocommandcost." + command)) + { + cost = ess.getSettings().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command); + if (cost == 0.0 && fallbackCommand != null && !fallbackCommand.isEmpty()) + { + cost = ess.getSettings().getCommandCost(fallbackCommand.charAt(0) == '/' ? fallbackCommand.substring(1) : fallbackCommand); + } + } + return cost; + } 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) diff --git a/Essentials/src/com/earth2me/essentials/economy/register/Method.java b/Essentials/src/com/earth2me/essentials/economy/register/Method.java index 2b22bfd3f..5866066eb 100644 --- a/Essentials/src/com/earth2me/essentials/economy/register/Method.java +++ b/Essentials/src/com/earth2me/essentials/economy/register/Method.java @@ -33,6 +33,13 @@ public interface Method * @return <code>String</code> Plugin name. */ public String getName(); + + /** + * Returns the reported name of this method. + * + * @return <code>String</code> Plugin name. + */ + public String getLongName(); /** * Returns the actual version of this method. diff --git a/Essentials/src/com/earth2me/essentials/economy/register/methods/BOSE6.java b/Essentials/src/com/earth2me/essentials/economy/register/methods/BOSE6.java index 0fd7bb167..688e68332 100644 --- a/Essentials/src/com/earth2me/essentials/economy/register/methods/BOSE6.java +++ b/Essentials/src/com/earth2me/essentials/economy/register/methods/BOSE6.java @@ -8,9 +8,8 @@ import org.bukkit.plugin.Plugin; /** * BOSEconomy 6 Implementation of Method * - * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) - * @copyright (c) 2011 - * @license AOL license <http://aol.nexua.org> + * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license + * <http://aol.nexua.org> */ @SuppressWarnings("deprecation") public class BOSE6 implements Method @@ -30,6 +29,12 @@ public class BOSE6 implements Method } @Override + public String getLongName() + { + return getName(); + } + + @Override public String getVersion() { return "0.6.2"; diff --git a/Essentials/src/com/earth2me/essentials/economy/register/methods/BOSE7.java b/Essentials/src/com/earth2me/essentials/economy/register/methods/BOSE7.java index aa06589d3..53dd43d87 100644 --- a/Essentials/src/com/earth2me/essentials/economy/register/methods/BOSE7.java +++ b/Essentials/src/com/earth2me/essentials/economy/register/methods/BOSE7.java @@ -9,9 +9,8 @@ import org.bukkit.plugin.Plugin; * BOSEconomy 7 Implementation of Method * * @author Acrobot - * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) - * @copyright (c) 2011 - * @license AOL license <http://aol.nexua.org> + * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license + * <http://aol.nexua.org> */ public class BOSE7 implements Method { @@ -30,6 +29,12 @@ public class BOSE7 implements Method } @Override + public String getLongName() + { + return getName(); + } + + @Override public String getVersion() { return "0.7.0"; diff --git a/Essentials/src/com/earth2me/essentials/economy/register/methods/MCUR.java b/Essentials/src/com/earth2me/essentials/economy/register/methods/MCUR.java index 2c49c3233..d2cb57a8d 100644 --- a/Essentials/src/com/earth2me/essentials/economy/register/methods/MCUR.java +++ b/Essentials/src/com/earth2me/essentials/economy/register/methods/MCUR.java @@ -9,9 +9,7 @@ import org.bukkit.plugin.Plugin; /** * MultiCurrency Method implementation. * - * @author Acrobot - * @copyright (c) 2011 - * @license AOL license <http://aol.nexua.org> + * @author Acrobot @copyright (c) 2011 @license AOL license <http://aol.nexua.org> */ public class MCUR implements Method { @@ -30,6 +28,12 @@ public class MCUR implements Method } @Override + public String getLongName() + { + return getName(); + } + + @Override public String getVersion() { return "0.09"; diff --git a/Essentials/src/com/earth2me/essentials/economy/register/methods/VaultEco.java b/Essentials/src/com/earth2me/essentials/economy/register/methods/VaultEco.java index fe4c2f513..43beb84f4 100644 --- a/Essentials/src/com/earth2me/essentials/economy/register/methods/VaultEco.java +++ b/Essentials/src/com/earth2me/essentials/economy/register/methods/VaultEco.java @@ -32,8 +32,18 @@ public class VaultEco implements Method @Override public String getName() { - - return this.vault.getDescription().getName().concat(" - Economy: ").concat(economy == null ? "NoEco" : economy.getName()); + return this.vault.getDescription().getName(); + } + + public String getEconomy() + { + return economy == null ? "NoEco" : economy.getName(); + } + + @Override + public String getLongName() + { + return getName().concat(" - Economy: ").concat(getEconomy()); } @Override diff --git a/Essentials/src/com/earth2me/essentials/economy/register/methods/iCo4.java b/Essentials/src/com/earth2me/essentials/economy/register/methods/iCo4.java index 1d2aa111b..b033ba9cc 100644 --- a/Essentials/src/com/earth2me/essentials/economy/register/methods/iCo4.java +++ b/Essentials/src/com/earth2me/essentials/economy/register/methods/iCo4.java @@ -9,9 +9,8 @@ import org.bukkit.plugin.Plugin; /** * iConomy 4 Implementation of Method * - * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) - * @copyright (c) 2011 - * @license AOL license <http://aol.nexua.org> + * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license + * <http://aol.nexua.org> */ public class iCo4 implements Method { @@ -30,6 +29,12 @@ public class iCo4 implements Method } @Override + public String getLongName() + { + return getName(); + } + + @Override public String getVersion() { return "4"; diff --git a/Essentials/src/com/earth2me/essentials/economy/register/methods/iCo5.java b/Essentials/src/com/earth2me/essentials/economy/register/methods/iCo5.java index 2b1c02dfe..137772ebc 100644 --- a/Essentials/src/com/earth2me/essentials/economy/register/methods/iCo5.java +++ b/Essentials/src/com/earth2me/essentials/economy/register/methods/iCo5.java @@ -12,9 +12,8 @@ import org.bukkit.plugin.Plugin; /** * iConomy 5 Implementation of Method * - * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) - * @copyright (c) 2011 - * @license AOL license <http://aol.nexua.org> + * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license + * <http://aol.nexua.org> */ public class iCo5 implements Method { @@ -33,6 +32,12 @@ public class iCo5 implements Method } @Override + public String getLongName() + { + return getName(); + } + + @Override public String getVersion() { return "5"; diff --git a/Essentials/src/com/earth2me/essentials/economy/register/methods/iCo6.java b/Essentials/src/com/earth2me/essentials/economy/register/methods/iCo6.java index d615a4888..ead4ebeb3 100644 --- a/Essentials/src/com/earth2me/essentials/economy/register/methods/iCo6.java +++ b/Essentials/src/com/earth2me/essentials/economy/register/methods/iCo6.java @@ -11,9 +11,8 @@ import org.bukkit.plugin.Plugin; /** * iConomy 6 Implementation of Method * - * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) - * @copyright (c) 2011 - * @license AOL license <http://aol.nexua.org> + * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license + * <http://aol.nexua.org> */ public class iCo6 implements Method { @@ -32,6 +31,12 @@ public class iCo6 implements Method } @Override + public String getLongName() + { + return getName(); + } + + @Override public String getVersion() { return "6"; diff --git a/Essentials/src/com/earth2me/essentials/listener/EssentialsBlockListener.java b/Essentials/src/com/earth2me/essentials/listener/EssentialsBlockListener.java index d3b91b396..3f2f78477 100644 --- a/Essentials/src/com/earth2me/essentials/listener/EssentialsBlockListener.java +++ b/Essentials/src/com/earth2me/essentials/listener/EssentialsBlockListener.java @@ -25,7 +25,7 @@ public class EssentialsBlockListener implements Listener public void onBlockPlace(final BlockPlaceEvent event) { // Do not rely on getItemInHand(); - // http://leaky.bukkit.org/issues/663 + // http://leaky.bukkit.org/issues/663 final ItemStack itemstack = Util.convertBlockToItem(event.getBlockPlaced()); if (itemstack == null) { diff --git a/Essentials/src/com/earth2me/essentials/listener/TntExplodeListener.java b/Essentials/src/com/earth2me/essentials/listener/TntExplodeListener.java index 2bcabb2d4..4710187f1 100644 --- a/Essentials/src/com/earth2me/essentials/listener/TntExplodeListener.java +++ b/Essentials/src/com/earth2me/essentials/listener/TntExplodeListener.java @@ -47,8 +47,12 @@ public class TntExplodeListener implements Listener, Runnable { return; } - FakeExplosion.createExplosion(event, ess.getServer(), ess.getServer().getOnlinePlayers()); + if (event.blockList().size() < 1) + { + return; + } event.setCancelled(true); + event.getLocation().getWorld().createExplosion(event.getLocation(), 0F); } @Override diff --git a/Essentials/src/com/earth2me/essentials/metrics/Metrics.java b/Essentials/src/com/earth2me/essentials/metrics/Metrics.java new file mode 100644 index 000000000..f361e4f50 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/metrics/Metrics.java @@ -0,0 +1,625 @@ +package com.earth2me.essentials.metrics; + +/* + * Copyright 2011 Tyler Blair. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the authors and contributors and + * should not be interpreted as representing official policies, either expressed or implied, of anybody else. + */ +import java.io.*; +import java.net.Proxy; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.util.*; +import java.util.logging.Level; +import org.bukkit.Bukkit; +import org.bukkit.configuration.InvalidConfigurationException; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginDescriptionFile; + + +/** + * <p> The metrics class obtains data about a plugin and submits statistics about it to the metrics backend. </p> <p> + * Public methods provided by this class: </p> + * <code> + * Graph createGraph(String name); <br/> + * void addCustomData(Metrics.Plotter plotter); <br/> + * void start(); <br/> + * </code> + */ +public class Metrics +{ + /** + * The current revision number + */ + private final static int REVISION = 5; + /** + * The base url of the metrics domain + */ + private static final String BASE_URL = "http://metrics.essentials3.net"; + /** + * The url used to report a server's status + */ + private static final String REPORT_URL = "/report/%s"; + /** + * The file where guid and opt out is stored in + */ + private static final String CONFIG_FILE = "plugins/PluginMetrics/config.yml"; + /** + * The separator to use for custom data. This MUST NOT change unless you are hosting your own version of metrics and + * want to change it. + */ + private static final String CUSTOM_DATA_SEPARATOR = "~~"; + /** + * Interval of time to ping (in minutes) + */ + private static final int PING_INTERVAL = 10; + /** + * The plugin this metrics submits for + */ + private final Plugin plugin; + /** + * All of the custom graphs to submit to metrics + */ + private final Set<Graph> graphs = Collections.synchronizedSet(new HashSet<Graph>()); + /** + * The default graph, used for addCustomData when you don't want a specific graph + */ + private final Graph defaultGraph = new Graph("Default"); + /** + * The plugin configuration file + */ + private final YamlConfiguration configuration; + /** + * The plugin configuration file + */ + private final File configurationFile; + /** + * Unique server id + */ + private final String guid; + /** + * Lock for synchronization + */ + private final Object optOutLock = new Object(); + /** + * Id of the scheduled task + */ + private volatile int taskId = -1; + + public Metrics(final Plugin plugin) throws IOException + { + if (plugin == null) + { + throw new IllegalArgumentException("Plugin cannot be null"); + } + + this.plugin = plugin; + + // load the config + configurationFile = new File(CONFIG_FILE); + configuration = YamlConfiguration.loadConfiguration(configurationFile); + + // add some defaults + configuration.addDefault("opt-out", false); + configuration.addDefault("guid", UUID.randomUUID().toString()); + + // Do we need to create the file? + if (configuration.get("guid", null) == null) + { + configuration.options().header("http://metrics.griefcraft.com").copyDefaults(true); + configuration.save(configurationFile); + } + + // Load the guid then + guid = configuration.getString("guid"); + } + + /** + * Construct and create a Graph that can be used to separate specific plotters to their own graphs on the metrics + * website. Plotters can be added to the graph object returned. + * + * @param name + * @return Graph object created. Will never return NULL under normal circumstances unless bad parameters are given + */ + public Graph createGraph(final String name) + { + if (name == null) + { + throw new IllegalArgumentException("Graph name cannot be null"); + } + + // Construct the graph object + final Graph graph = new Graph(name); + + // Now we can add our graph + graphs.add(graph); + + // and return back + return graph; + } + + /** + * Adds a custom data plotter to the default graph + * + * @param plotter + */ + public void addCustomData(final Plotter plotter) + { + if (plotter == null) + { + throw new IllegalArgumentException("Plotter cannot be null"); + } + + // Add the plotter to the graph o/ + defaultGraph.addPlotter(plotter); + + // Ensure the default graph is included in the submitted graphs + graphs.add(defaultGraph); + } + + /** + * Start measuring statistics. This will immediately create an async repeating task as the plugin and send the + * initial data to the metrics backend, and then after that it will post in increments of PING_INTERVAL * 1200 + * ticks. + */ + public void start() + { + synchronized (optOutLock) + { + // Did we opt out? + if (isOptOut()) + { + return; + } + + // Begin hitting the server with glorious data + taskId = plugin.getServer().getScheduler().scheduleAsyncRepeatingTask(plugin, new Runnable() + { + private boolean firstPost = true; + + public void run() + { + try + { + // This has to be synchronized or it can collide with the disable method. + synchronized (optOutLock) + { + // Disable Task, if it is running and the server owner decided to opt-out + if (isOptOut() && taskId > 0) + { + plugin.getServer().getScheduler().cancelTask(taskId); + taskId = -1; + } + } + + // We use the inverse of firstPost because if it is the first time we are posting, + // it is not a interval ping, so it evaluates to FALSE + // Each time thereafter it will evaluate to TRUE, i.e PING! + postPlugin(!firstPost); + + // After the first post we set firstPost to false + // Each post thereafter will be a ping + firstPost = false; + } + catch (IOException e) + { + Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage()); + } + } + }, 0, PING_INTERVAL * 1200); + } + } + + /** + * Has the server owner denied plugin metrics? + * + * @return + */ + public boolean isOptOut() + { + synchronized (optOutLock) + { + try + { + // Reload the metrics file + configuration.load(CONFIG_FILE); + } + catch (IOException ex) + { + Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); + return true; + } + catch (InvalidConfigurationException ex) + { + Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); + return true; + } + return configuration.getBoolean("opt-out", false); + } + } + + /** + * Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task. + * + * @throws IOException + */ + public void enable() throws IOException + { + // This has to be synchronized or it can collide with the check in the task. + synchronized (optOutLock) + { + // Check if the server owner has already set opt-out, if not, set it. + if (isOptOut()) + { + configuration.set("opt-out", false); + configuration.save(configurationFile); + } + + // Enable Task, if it is not running + if (taskId < 0) + { + start(); + } + } + } + + /** + * Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task. + * + * @throws IOException + */ + public void disable() throws IOException + { + // This has to be synchronized or it can collide with the check in the task. + synchronized (optOutLock) + { + // Check if the server owner has already set opt-out, if not, set it. + if (!isOptOut()) + { + configuration.set("opt-out", true); + final File file = new File(CONFIG_FILE); + configuration.save(file); + } + + // Disable Task, if it is running + if (taskId >= 0) + { + this.plugin.getServer().getScheduler().cancelTask(taskId); + taskId = -1; + } + } + } + + /** + * Generic method that posts a plugin to the metrics website + */ + private void postPlugin(final boolean isPing) throws IOException + { + // The plugin's description file containg all of the plugin data such as name, version, author, etc + final PluginDescriptionFile description = plugin.getDescription(); + + // Construct the post data + final StringBuilder data = new StringBuilder(); + data.append(encode("guid")).append('=').append(encode(guid)); + encodeDataPair(data, "version", description.getVersion()); + encodeDataPair(data, "server", Bukkit.getVersion()); + encodeDataPair(data, "players", Integer.toString(Bukkit.getServer().getOnlinePlayers().length)); + encodeDataPair(data, "revision", String.valueOf(REVISION)); + + // If we're pinging, append it + if (isPing) + { + encodeDataPair(data, "ping", "true"); + } + + // Acquire a lock on the graphs, which lets us make the assumption we also lock everything + // inside of the graph (e.g plotters) + synchronized (graphs) + { + final Iterator<Graph> iter = graphs.iterator(); + + while (iter.hasNext()) + { + final Graph graph = iter.next(); + + // Because we have a lock on the graphs set already, it is reasonable to assume + // that our lock transcends down to the individual plotters in the graphs also. + // Because our methods are private, no one but us can reasonably access this list + // without reflection so this is a safe assumption without adding more code. + for (Plotter plotter : graph.getPlotters()) + { + // The key name to send to the metrics server + // The format is C-GRAPHNAME-PLOTTERNAME where separator - is defined at the top + // Legacy (R4) submitters use the format Custom%s, or CustomPLOTTERNAME + final String key = String.format("C%s%s%s%s", CUSTOM_DATA_SEPARATOR, graph.getName(), CUSTOM_DATA_SEPARATOR, plotter.getColumnName()); + + // The value to send, which for the foreseeable future is just the string + // value of plotter.getValue() + final String value = Integer.toString(plotter.getValue()); + + // Add it to the http post data :) + encodeDataPair(data, key, value); + } + } + } + + // Create the url + final URL url = new URL(BASE_URL + String.format(REPORT_URL, description.getName())); + + // Connect to the website + URLConnection connection; + + // Mineshafter creates a socks proxy, so we can safely bypass it + // It does not reroute POST requests so we need to go around it + if (isMineshafterPresent()) + { + connection = url.openConnection(Proxy.NO_PROXY); + } + else + { + connection = url.openConnection(); + } + + connection.setDoOutput(true); + + // Write the data + final OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream()); + writer.write(data.toString()); + writer.flush(); + + // Now read the response + final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + final String response = reader.readLine(); + + // close resources + writer.close(); + reader.close(); + + if (response == null || response.startsWith("ERR")) + { + throw new IOException(response); //Throw the exception + } + else + { + // Is this the first update this hour? + if (response.contains("OK This is your first update this hour")) + { + synchronized (graphs) + { + final Iterator<Graph> iter = graphs.iterator(); + + while (iter.hasNext()) + { + final Graph graph = iter.next(); + + for (Plotter plotter : graph.getPlotters()) + { + plotter.reset(); + } + } + } + } + } + //if (response.startsWith("OK")) - We should get "OK" followed by an optional description if everything goes right + } + + /** + * Check if mineshafter is present. If it is, we need to bypass it to send POST requests + * + * @return + */ + private boolean isMineshafterPresent() + { + try + { + Class.forName("mineshafter.MineServer"); + return true; + } + catch (Exception e) + { + return false; + } + } + + /** + * <p>Encode a key/value data pair to be used in a HTTP post request. This INCLUDES a & so the first key/value pair + * MUST be included manually, e.g:</p> + * <code> + * StringBuffer data = new StringBuffer(); + * data.append(encode("guid")).append('=').append(encode(guid)); + * encodeDataPair(data, "version", description.getVersion()); + * </code> + * + * @param buffer + * @param key + * @param value + * @return + */ + private static void encodeDataPair(final StringBuilder buffer, final String key, final String value) throws UnsupportedEncodingException + { + buffer.append('&').append(encode(key)).append('=').append(encode(value)); + } + + /** + * Encode text as UTF-8 + * + * @param text + * @return + */ + private static String encode(final String text) throws UnsupportedEncodingException + { + return URLEncoder.encode(text, "UTF-8"); + } + + + /** + * Represents a custom graph on the website + */ + public static class Graph + { + /** + * The graph's name, alphanumeric and spaces only :) If it does not comply to the above when submitted, it is + * rejected + */ + private final String name; + /** + * The set of plotters that are contained within this graph + */ + private final Set<Plotter> plotters = new LinkedHashSet<Plotter>(); + + private Graph(final String name) + { + this.name = name; + } + + /** + * Gets the graph's name + * + * @return + */ + public String getName() + { + return name; + } + + /** + * Add a plotter to the graph, which will be used to plot entries + * + * @param plotter + */ + public void addPlotter(final Plotter plotter) + { + plotters.add(plotter); + } + + /** + * Remove a plotter from the graph + * + * @param plotter + */ + public void removePlotter(final Plotter plotter) + { + plotters.remove(plotter); + } + + /** + * Gets an <b>unmodifiable</b> set of the plotter objects in the graph + * + * @return + */ + public Set<Plotter> getPlotters() + { + return Collections.unmodifiableSet(plotters); + } + + @Override + public int hashCode() + { + return name.hashCode(); + } + + @Override + public boolean equals(final Object object) + { + if (!(object instanceof Graph)) + { + return false; + } + + final Graph graph = (Graph)object; + return graph.name.equals(name); + } + } + + + /** + * Interface used to collect custom data for a plugin + */ + public static abstract class Plotter + { + /** + * The plot's name + */ + private final String name; + + /** + * Construct a plotter with the default plot name + */ + public Plotter() + { + this("Default"); + } + + /** + * Construct a plotter with a specific plot name + * + * @param name + */ + public Plotter(final String name) + { + this.name = name; + } + + /** + * Get the current value for the plotted point + * + * @return + */ + public abstract int getValue(); + + /** + * Get the column name for the plotted point + * + * @return the plotted point's column name + */ + public String getColumnName() + { + return name; + } + + /** + * Called after the website graphs have been updated + */ + public void reset() + { + } + + @Override + public int hashCode() + { + return getColumnName().hashCode() + getValue(); + } + + @Override + public boolean equals(final Object object) + { + if (!(object instanceof Plotter)) + { + return false; + } + + final Plotter plotter = (Plotter)object; + return plotter.name.equals(name) && plotter.getValue() == getValue(); + } + } +}
\ No newline at end of file diff --git a/Essentials/src/com/earth2me/essentials/metrics/MetricsListener.java b/Essentials/src/com/earth2me/essentials/metrics/MetricsListener.java new file mode 100644 index 000000000..4af8f9173 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/metrics/MetricsListener.java @@ -0,0 +1,40 @@ +package com.earth2me.essentials.metrics; + +import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.User; +import java.util.logging.Level; +import org.bukkit.Server; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; + + +public class MetricsListener implements Listener +{ + private final transient Server server; + private final transient IEssentials ess; + private final transient MetricsStarter starter; + + public MetricsListener(final IEssentials parent, final MetricsStarter starter) + { + this.ess = parent; + this.server = parent.getServer(); + this.starter = starter; + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onPlayerJoin(final PlayerJoinEvent event) + { + final User player = ess.getUser(event.getPlayer()); + if (ess.getSettings().isMetricsEnabled() == false && (player.isAuthorized("essentials.essentials") || player.isAuthorized("bukkit.broadcast.admin"))) + { + player.sendMessage("PluginMetrics collects minimal statistic data, starting in about 5 minutes."); + player.sendMessage("To opt out, run /essentials opt-out"); + ess.getLogger().log(Level.INFO, "[Metrics] Admin join - Starting 5 minute opt-out period."); + ess.getSettings().setMetricsEnabled(true); + ess.getScheduler().scheduleAsyncDelayedTask(ess, starter, 5 * 1200); + } + } +} diff --git a/Essentials/src/com/earth2me/essentials/metrics/MetricsStarter.java b/Essentials/src/com/earth2me/essentials/metrics/MetricsStarter.java new file mode 100644 index 000000000..0ea692cc9 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/metrics/MetricsStarter.java @@ -0,0 +1,212 @@ +package com.earth2me.essentials.metrics; + +import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.metrics.Metrics.Graph; +import com.earth2me.essentials.metrics.Metrics.Plotter; +import com.earth2me.essentials.register.payment.Method; +import com.earth2me.essentials.register.payment.methods.VaultEco; +import java.util.Locale; +import java.util.logging.Level; + + +public class MetricsStarter implements Runnable +{ + private final IEssentials ess; + private transient Boolean start; + + + private enum Modules + { + Essentials, + EssentialsAntiCheat, + EssentialsChat, + EssentialsSpawn, + EssentialsProtect, + EssentialsGeoIP, + EssentialsXMPP + }; + + public MetricsStarter(final IEssentials plugin) + { + ess = plugin; + try + { + + final Metrics metrics = new Metrics(ess); + ess.setMetrics(metrics); + + if (!metrics.isOptOut()) + { + if (ess.getSettings().isMetricsEnabled()) + { + start = true; + } + else + { + ess.getLogger().info("This plugin collects minimal statistic data and sends it to http://metrics.essentials3.net."); + ess.getLogger().info("You can opt out by running /essentials opt-out"); + ess.getLogger().info("This will start 5 minutes after the first admin/op joins."); + start = false; + } + return; + } + } + catch (Exception ex) + { + metricsError(ex); + } + } + + @Override + public void run() + { + try + { + final Metrics metrics = ess.getMetrics(); + + final Graph moduleGraph = metrics.createGraph("Modules Used"); + for (Modules module : Modules.values()) + { + final String moduleName = module.toString(); + if (ess.getServer().getPluginManager().isPluginEnabled(moduleName)) + { + moduleGraph.addPlotter(new SimplePlotter(moduleName)); + } + } + + final Graph localeGraph = metrics.createGraph("Locale"); + localeGraph.addPlotter(new SimplePlotter(ess.getI18n().getCurrentLocale().getDisplayLanguage(Locale.ENGLISH))); + + final Graph featureGraph = metrics.createGraph("Features"); + featureGraph.addPlotter(new Plotter("Unique Accounts") + { + @Override + public int getValue() + { + return ess.getUserMap().getUniqueUsers(); + } + }); + featureGraph.addPlotter(new Plotter("Jails") + { + @Override + public int getValue() + { + return ess.getJails().getCount(); + } + }); + featureGraph.addPlotter(new Plotter("Kits") + { + @Override + public int getValue() + { + return ess.getSettings().getKits().getKeys(false).size(); + } + }); + featureGraph.addPlotter(new Plotter("Warps") + { + @Override + public int getValue() + { + return ess.getWarps().getWarpNames().size(); + } + }); + + final Graph enabledGraph = metrics.createGraph("EnabledFeatures"); + enabledGraph.addPlotter(new SimplePlotter("Total")); + final String BKcommand = ess.getSettings().getBackupCommand(); + if (BKcommand != null && !"".equals(BKcommand)) + { + enabledGraph.addPlotter(new SimplePlotter("Backup")); + } + if (ess.getJails().getCount() > 0) + { + enabledGraph.addPlotter(new SimplePlotter("Jails")); + } + if (ess.getSettings().getKits().getKeys(false).size() > 0) + { + enabledGraph.addPlotter(new SimplePlotter("Kits")); + } + if (ess.getWarps().getWarpNames().size() > 0) + { + enabledGraph.addPlotter(new SimplePlotter("Warps")); + } + if (!ess.getSettings().areSignsDisabled()) + { + enabledGraph.addPlotter(new SimplePlotter("Signs")); + } + if (ess.getSettings().getAutoAfk() > 0) + { + enabledGraph.addPlotter(new SimplePlotter("AutoAFK")); + } + if (ess.getSettings().changeDisplayName()) + { + enabledGraph.addPlotter(new SimplePlotter("DisplayName")); + } + if (ess.getSettings().getChatRadius() >= 1) + { + enabledGraph.addPlotter(new SimplePlotter("LocalChat")); + } + + final Graph depGraph = metrics.createGraph("Dependencies"); + final Method method = ess.getPaymentMethod().getMethod(); + if (method != null) + { + String version; + if (method instanceof VaultEco) + { + version = ((VaultEco)method).getEconomy(); + } + else + { + version = method.getVersion(); + final int dashPosition = version.indexOf('-'); + if (dashPosition > 0) + { + version = version.substring(0, dashPosition); + } + } + depGraph.addPlotter(new SimplePlotter(method.getName() + " " + version)); + } + depGraph.addPlotter(new SimplePlotter(ess.getPermissionsHandler().getName())); + + metrics.start(); + + } + catch (Exception ex) + { + metricsError(ex); + } + } + + public void metricsError(final Exception ex) + { + if (ess.getSettings().isDebug()) + { + ess.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage(), ex); + } + else + { + ess.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); + } + } + + public Boolean getStart() + { + return start; + } + + + private class SimplePlotter extends Plotter + { + public SimplePlotter(final String name) + { + super(name); + } + + @Override + public int getValue() + { + return 1; + } + } +}
\ No newline at end of file diff --git a/Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileReader.java b/Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileReader.java index cad08b8c1..e7a93e7fe 100644 --- a/Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileReader.java +++ b/Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileReader.java @@ -15,7 +15,7 @@ import org.bukkit.plugin.Plugin; public abstract class AbstractDelayedYamlFileReader<T extends StorageObject> implements Runnable { private final transient Class<T> clazz; - private final transient Plugin plugin; + protected final transient IEssentials plugin; private final transient ReentrantLock lock = new ReentrantLock(); public AbstractDelayedYamlFileReader(final IEssentials ess, final Class<T> clazz) @@ -81,7 +81,11 @@ public abstract class AbstractDelayedYamlFileReader<T extends StorageObject> imp } catch (IOException ex) { - Bukkit.getLogger().log(Level.SEVERE, "File could not be opened: " + ex.getMessage(), ex); + onException(); + if (plugin.getSettings() == null || plugin.getSettings().isDebug()) + { + Bukkit.getLogger().log(Level.INFO, "File not found: " + file.toString()); + } } finally { diff --git a/Essentials/src/com/earth2me/essentials/storage/AsyncStorageObjectHolder.java b/Essentials/src/com/earth2me/essentials/storage/AsyncStorageObjectHolder.java index 8259dbd79..ea48dc269 100644 --- a/Essentials/src/com/earth2me/essentials/storage/AsyncStorageObjectHolder.java +++ b/Essentials/src/com/earth2me/essentials/storage/AsyncStorageObjectHolder.java @@ -99,7 +99,11 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen { reader.schedule(instant); } - + + public abstract void finishRead(); + + public abstract void finishWrite(); + public abstract File getStorageFile() throws IOException; @@ -127,6 +131,7 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen public void onFinish() { unlock(); + finishWrite(); } } diff --git a/Essentials/src/com/earth2me/essentials/user/User.java b/Essentials/src/com/earth2me/essentials/user/User.java index 770f1c071..59319fb20 100644 --- a/Essentials/src/com/earth2me/essentials/user/User.java +++ b/Essentials/src/com/earth2me/essentials/user/User.java @@ -76,6 +76,16 @@ public class User extends UserBase implements IUser user.acquireWriteLock(); user.getData().setMoney(10 + money); } + + @Override + public void finishRead() + { + } + + @Override + public void finishWrite() + { + } @Override public void checkCooldown(final UserData.TimestampType cooldownType, final double cooldown, final boolean set, final IPermission bypassPermission) throws CooldownException @@ -686,4 +696,15 @@ public class User extends UserBase implements IUser public boolean canAfford(double amount, boolean b) { return true; } + + @Override + public boolean canAfford(final double cost) + { + final double mon = getMoney(); + if (isAuthorized("essentials.eco.loan")) + { + return (mon - cost) >= ess.getSettings().getMinMoney(); + } + return cost <= mon; + } } diff --git a/Essentials/src/com/earth2me/essentials/utils/DescParseTickFormat.java b/Essentials/src/com/earth2me/essentials/utils/DescParseTickFormat.java index 987c59e7c..e553bc80c 100644 --- a/Essentials/src/com/earth2me/essentials/utils/DescParseTickFormat.java +++ b/Essentials/src/com/earth2me/essentials/utils/DescParseTickFormat.java @@ -6,12 +6,11 @@ import java.util.*; /** - * This utility class is used for converting between the ingame - * time in ticks to ingame time as a friendly string. - * Note that the time is INGAME. - * + * This utility class is used for converting between the ingame time in ticks to ingame time as a friendly string. Note + * that the time is INGAME. + * * http://www.minecraftwiki.net/wiki/Day/night_cycle - * + * * @author Olof Larsson */ public final class DescParseTickFormat @@ -153,30 +152,31 @@ public final class DescParseTickFormat int hours = 0; int minutes = 0; - desc = desc.toLowerCase(Locale.ENGLISH).replaceAll("[^0-9]", ""); + desc = desc.toLowerCase(Locale.ENGLISH); + String parsetime = desc.replaceAll("[^0-9]", ""); - if (desc.length() > 4) + if (parsetime.length() > 4) { throw new NumberFormatException(); } - if (desc.length() == 4) + if (parsetime.length() == 4) { - hours += Integer.parseInt(desc.substring(0, 2)); - minutes += Integer.parseInt(desc.substring(2, 4)); + hours += Integer.parseInt(parsetime.substring(0, 2)); + minutes += Integer.parseInt(parsetime.substring(2, 4)); } - else if (desc.length() == 3) + else if (parsetime.length() == 3) { - hours += Integer.parseInt(desc.substring(0, 1)); - minutes += Integer.parseInt(desc.substring(1, 3)); + hours += Integer.parseInt(parsetime.substring(0, 1)); + minutes += Integer.parseInt(parsetime.substring(1, 3)); } - else if (desc.length() == 2) + else if (parsetime.length() == 2) { - hours += Integer.parseInt(desc.substring(0, 2)); + hours += Integer.parseInt(parsetime.substring(0, 2)); } - else if (desc.length() == 1) + else if (parsetime.length() == 1) { - hours += Integer.parseInt(desc.substring(0, 1)); + hours += Integer.parseInt(parsetime.substring(0, 1)); } else { diff --git a/Essentials/src/com/earth2me/essentials/utils/textreader/HelpInput.java b/Essentials/src/com/earth2me/essentials/utils/textreader/HelpInput.java index 67b946469..cb3be1be4 100644 --- a/Essentials/src/com/earth2me/essentials/utils/textreader/HelpInput.java +++ b/Essentials/src/com/earth2me/essentials/utils/textreader/HelpInput.java @@ -30,33 +30,47 @@ public class HelpInput implements IText final ISettings settings = ess.getSettings(); settings.acquireReadLock(); boolean reported = false; + final List<String> newLines = new ArrayList<String>(); String pluginName = ""; + String pluginNameLow = ""; + if (!match.equalsIgnoreCase("")) + { + lines.add(_("helpMatching", match)); + } + for (Plugin p : ess.getServer().getPluginManager().getPlugins()) { try { + final List<String> pluginLines = new ArrayList<String>(); final PluginDescriptionFile desc = p.getDescription(); final Map<String, Map<String, Object>> cmds = desc.getCommands(); - pluginName = p.getDescription().getName().toLowerCase(Locale.ENGLISH); + pluginName = p.getDescription().getName(); + pluginNameLow = pluginName.toLowerCase(Locale.ENGLISH); + if (pluginNameLow.equals(match)) + { + lines.clear(); + newLines.clear(); + lines.add(_("helpFrom", p.getDescription().getName())); + } + for (Map.Entry<String, Map<String, Object>> k : cmds.entrySet()) { try { - if ((!match.equalsIgnoreCase("")) - && (!k.getKey().toLowerCase(Locale.ENGLISH).contains(match)) + if (!match.equalsIgnoreCase("") && (!pluginNameLow.contains(match)) && (!k.getKey().toLowerCase(Locale.ENGLISH).contains(match)) && (!(k.getValue().get(DESCRIPTION) instanceof String - && ((String)k.getValue().get(DESCRIPTION)).toLowerCase(Locale.ENGLISH).contains(match))) - && (!pluginName.contains(match))) + && ((String)k.getValue().get(DESCRIPTION)).toLowerCase(Locale.ENGLISH).contains(match)))) { continue; } - if (pluginName.contains("essentials")) + if (pluginNameLow.contains("essentials")) { final String node = "essentials." + k.getKey(); if (!settings.getData().getCommands().isDisabled(k.getKey()) && user.hasPermission(node)) { - lines.add(_("helpLine", k.getKey(), k.getValue().get(DESCRIPTION))); + pluginLines.add(_("helpLine", k.getKey(), k.getValue().get(DESCRIPTION))); } } else @@ -73,9 +87,9 @@ public class HelpInput implements IText { permissions = value.get(PERMISSIONS); } - if (HelpPermissions.getPermission(pluginName).isAuthorized(user)) + if (HelpPermissions.getPermission(pluginNameLow).isAuthorized(user)) { - lines.add(_("helpLine", k.getKey(), value.get(DESCRIPTION))); + pluginLines.add(_("helpLine", k.getKey(), value.get(DESCRIPTION))); } else if (permissions instanceof List && !((List<Object>)permissions).isEmpty()) { @@ -90,21 +104,21 @@ public class HelpInput implements IText } if (enabled) { - lines.add(_("helpLine", k.getKey(), value.get(DESCRIPTION))); + pluginLines.add(_("helpLine", k.getKey(), value.get(DESCRIPTION))); } } else if (permissions instanceof String && !"".equals(permissions)) { if (user.hasPermission(permissions.toString())) { - lines.add(_("helpLine", k.getKey(), value.get(DESCRIPTION))); + pluginLines.add(_("helpLine", k.getKey(), value.get(DESCRIPTION))); } } else { if (!settings.getData().getCommands().getHelp().isHidePermissionlessCommands()) { - lines.add(_("helpLine", k.getKey(), value.get(DESCRIPTION))); + pluginLines.add(_("helpLine", k.getKey(), value.get(DESCRIPTION))); } } } @@ -115,6 +129,18 @@ public class HelpInput implements IText continue; } } + if (!pluginLines.isEmpty()) + { + newLines.addAll(pluginLines); + if (pluginNameLow.equals(match)) + { + break; + } + if (match.equalsIgnoreCase("")) + { + lines.add(_("helpPlugin", pluginName, pluginNameLow)); + } + } } catch (NullPointerException ex) { @@ -124,12 +150,13 @@ public class HelpInput implements IText { if (!reported) { - logger.log(Level.WARNING, _("commandHelpFailedForPlugin", pluginName), ex); + logger.log(Level.WARNING, _("commandHelpFailedForPlugin", pluginNameLow), ex); } reported = true; continue; } } + lines.addAll(newLines); } @Override diff --git a/Essentials/src/com/earth2me/essentials/utils/textreader/KeywordReplacer.java b/Essentials/src/com/earth2me/essentials/utils/textreader/KeywordReplacer.java index 92c7c8a0b..c38c39167 100644 --- a/Essentials/src/com/earth2me/essentials/utils/textreader/KeywordReplacer.java +++ b/Essentials/src/com/earth2me/essentials/utils/textreader/KeywordReplacer.java @@ -40,6 +40,7 @@ public class KeywordReplacer implements IText @Cleanup final IUser user = ess.getUser((Player)sender); user.acquireReadLock(); + user.setDisplayNick(); displayName = user.getDisplayName(); userName = user.getName(); ipAddress = user.getAddress().getAddress().toString(); diff --git a/Essentials/src/com/earth2me/essentials/utils/textreader/TextInput.java b/Essentials/src/com/earth2me/essentials/utils/textreader/TextInput.java index 369c0e0e1..8c8b7faca 100644 --- a/Essentials/src/com/earth2me/essentials/utils/textreader/TextInput.java +++ b/Essentials/src/com/earth2me/essentials/utils/textreader/TextInput.java @@ -84,7 +84,7 @@ public class TextInput implements IText } if (line.length() > 0 && line.charAt(0) == '#') { - bookmarks.put(line.substring(1).toLowerCase(Locale.ENGLISH).replaceAll("&[0-9a-f]", ""), lineNumber); + bookmarks.put(line.substring(1).toLowerCase(Locale.ENGLISH).replaceAll("&[0-9a-fk]", ""), lineNumber); chapters.add(line.substring(1).replace('&', '๏ฟฝ').replace("๏ฟฝ", "&")); } lines.add(line.replace('&', '๏ฟฝ').replace("๏ฟฝ", "&")); diff --git a/Essentials/src/com/earth2me/essentials/utils/textreader/TextPager.java b/Essentials/src/com/earth2me/essentials/utils/textreader/TextPager.java index 70f68222b..cac760441 100644 --- a/Essentials/src/com/earth2me/essentials/utils/textreader/TextPager.java +++ b/Essentials/src/com/earth2me/essentials/utils/textreader/TextPager.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.utils.textreader; +import com.earth2me.essentials.I18n; import static com.earth2me.essentials.I18n._; import java.util.List; import java.util.Locale; @@ -49,7 +50,23 @@ public class TextPager final int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0); if (!onePage) { - sender.sendMessage(_("infoPages", page, pages)); + StringBuilder content = new StringBuilder(); + final String[] title = commandName.split(" ", 2); + if (title.length > 1) + { + content.append(I18n.capitalCase(title[0])).append(": "); + content.append(title[1]); + } + else if (chapterPageStr != null) + { + content.append(I18n.capitalCase(commandName)).append(": "); + content.append(chapterPageStr); + } + else + { + content.append(I18n.capitalCase(commandName)); + } + sender.sendMessage(_("infoPages", page, pages, content)); } for (int i = start; i < lines.size() && i < start + (onePage ? 20 : 9); i++) { @@ -116,7 +133,7 @@ public class TextPager if (!onePage) { - sender.sendMessage(_("infoPages", page, pages)); + sender.sendMessage(_("infoPages", page, pages, I18n.capitalCase(commandName))); } for (int i = start; i < end && i < start + (onePage ? 20 : 9); i++) { diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index c1ed63046..d24dbe348 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -33,6 +33,10 @@ nickname-prefix: '~' # Disable this if you have any other plugin, that modifies the displayname of a user. change-displayname: true +# When this option is enabled, the (tab) player list will be updated with the displayname. +# The value of change-displayname (above) has to be true. +#change-playerlist: true + # Adds the prefix and suffix to the displayname of the player, so it will be displayed in messages and lists. # The prefix/suffix can be set using Permissions, Group Manager or PermissionsEx. # The value of change-displayname (above) has to be true. @@ -46,6 +50,10 @@ teleport-cooldown: 0 # The delay, in seconds, before a user actually teleports. If the user moves or gets attacked in this timeframe, the teleport never occurs. teleport-delay: 0 +# The delay, in seconds, a player can't be attacked by other players after he has been teleported by a command +# This will also prevent that the player can attack other players +teleport-invulnerability: 0 + # The delay, in seconds, required between /heal attempts heal-cooldown: 60 @@ -97,9 +105,16 @@ player-commands: - back - back.ondeath - balance + - balance.others + - balancetop + - chat.color + - chat.format + - chat.shout + - chat.question - clearinventory - compass - depth + - delhome - getpos - geoip.show - help @@ -108,20 +123,26 @@ player-commands: - home.others - ignore - info + - itemdb - kit + - kit.tools - list - mail - mail.send - me - motd - msg + - msg.color - nick + - near - pay - ping - powertool + - powertooltoggle - protect - r - rules + - realname - seen - sell - sethome @@ -133,8 +154,11 @@ player-commands: - signs.use.balance - signs.use.buy - signs.use.disposal + - signs.use.enchant - signs.use.free + - signs.use.gamemode - signs.use.heal + - signs.use.kit - signs.use.mail - signs.use.protection - signs.use.sell @@ -144,6 +168,7 @@ player-commands: - signs.use.weather - spawn - suicide + - time - tpa - tpaccept - tpahere @@ -156,14 +181,22 @@ player-commands: # Note: All items MUST be followed by a quantity! # All kit names should be lower case, and will be treated as lower in permissions/costs. +# Syntax: - itemID[:DataValue] Amount [Enchantment:Level].. # Times are measured in seconds. kits: dtools: delay: 10 items: - - 277 1 + - 277 1 efficiency:1 - 278 1 - - 279 1 + - 279:780 1 + tools: + delay: 10 + items: + - 272 1 + - 273 1 + - 274 1 + - 275 1 tools: delay: 10 items: @@ -175,9 +208,11 @@ kits: # Essentials Sign Control # See http://ess.khhq.net/wiki/Sign_Tutorial for instructions on how to use these. # To enable signs, remove # symbol. To disable all signs, comment/remove each sign. +# Essentials Colored sign support will be enabled when any sign types are enabled. # We recommend not enabling chest protection signs if you don't intend to use them, (or are using LWC/Lockette). enabledSigns: + #- color #- balance #- buy #- sell @@ -198,8 +233,9 @@ enabledSigns: # Backup runs a command while saving is disabled backup: # Interval in minutes - interval: 60 - # Add a command that backups your data, e.g. + interval: 30 + # Unless you add a valid backup command or script here, this feature will be useless. + # Use 'save-all' to simply force regular world saving without backup. #command: 'rdiff-backup World1 backups/World1' # Set this true to enable permission per warp. @@ -241,7 +277,12 @@ 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 +disable-item-pickup-while-afk: false + +# Should we automatically remove afk status when the player moves? +# Player will be removed from afk on chat/command reguardless of this setting. +# Disable this to reduce server lag. +cancel-afk-on-move: true # You can disable the death messages of minecraft here death-messages: true @@ -250,7 +291,8 @@ death-messages: true no-god-in-worlds: # - world_nether -# Set to true to enable per-world permissions for teleporting with /world +# Set to true to enable per-world permissions for teleporting between worlds with essentials commands +# This applies to /world, /back, /tp[a|o][here|all], but not warps. # Give someone permission to teleport to a world with essentials.world.<worldname> world-teleport-permissions: false @@ -280,6 +322,9 @@ tpa-accept-cancellation: 0 #Cancels a request made by tpa / tpc on world change to prevent cross world tp cancel-tp-requests-on-world-change: false +#Delay to wait before people can cause attack damage after logging in +login-attack-delay: 0 + ############################################################ # +------------------------------------------------------+ # # | EssentialsHome | # @@ -292,6 +337,11 @@ spawn-if-no-home: true # Allows people to set their bed at daytime update-bed-at-daytime: true +# Set to true to enable per-world permissions for using homes to teleport between worlds +# This applies to the /home only. +# Give someone permission to teleport to a world with essentials.world.<worldname> +world-home-permissions: false + # Allow players to have multiple homes. # Players need essentials.sethome.multiple before they can have more than 1 home, default to 'default' below. # Define different amounts of multiple homes for different permissions, e.g. essentials.sethome.multiple.vip @@ -394,6 +444,8 @@ protect: # Database settings for sign/rail protection # mysql or sqlite + # We strongly recommend against using mysql here, unless you have a good reason. + # Sqlite seems to be faster in almost all cases, and in some cases mysql can be much slower. datatype: 'sqlite' # If you specified MySQL above, you MUST enter the appropriate details here. @@ -450,30 +502,31 @@ protect: entitytarget: false # Prevent the spawning of creatures spawn: - chicken: false - cow: false creeper: false - ghast: false - giant: false - monster: false - pig: false - pig_zombie: false - sheep: false skeleton: false - slime: false spider: false - squid: false + giant: false zombie: false - wolf: false - cave_spider: false + slime: false + ghast: false + pig_zombie: false enderman: false + cave_spider: false silverfish: false - ender_dragon: false - villager: false blaze: false - mushroom_cow: false magma_cube: false + ender_dragon: false + pig: false + sheep: false + cow: false + chicken: false + squid: false + wolf: false + mushroom_cow: false snowman: false + ocelot: false + iron_golem: false + villager: false # Maximum height the creeper should explode. -1 allows them to explode everywhere. # Set prevent.creeper-explosion to true, if you want to disable creeper explosions. diff --git a/Essentials/src/info.txt b/Essentials/src/info.txt index 0b4fb3c42..cfc037040 100644 --- a/Essentials/src/info.txt +++ b/Essentials/src/info.txt @@ -8,7 +8,7 @@ Name it info_username.txt or info_groupname.txt This also works with motd and rules. Extra pages: -Type /info Colours +Type /info Colors Type /info Tags If you have problem viewing this file ingame, try using /einfo. @@ -29,6 +29,7 @@ Minecraft colors: &4 &&4 &5 &&5 &6 &&6 &7 &&7 &8 &&8 &9 &&9 &a &&a &b &&b &c &&c &d &&d &e &&e &f &&f +&&k &k Magic! #Tags PLAYER: {PLAYER} diff --git a/Essentials/src/items.csv b/Essentials/src/items.csv index 33ed4af66..8b462ab66 100644 --- a/Essentials/src/items.csv +++ b/Essentials/src/items.csv @@ -1,5 +1,5 @@ #version: ${build.number} -# If you change this file, it will not be automatically updated after the next release. +#If you change this file, it will not be automatically updated after the next release, #item,id,metadata stone,1,0 sstone,1,0 @@ -17,6 +17,76 @@ wplank,5,0 plankwooden,5,0 plankwood,5,0 plankw,5,0 +darkplank,5,1 +darkwoodenplank,5,1 +darkwoodplank,5,1 +darkwplank,5,1 +darkplankwooden,5,1 +darkplankwood,5,1 +darkplankw,5,1 +dplank,5,1 +dwoodenplank,5,1 +dwoodplank,5,1 +dwplank,5,1 +dplankwooden,5,1 +dplankwood,5,1 +dplankw,5,1 +pineplank,5,1 +pinewoodenplank,5,1 +pinewoodplank,5,1 +pinewplank,5,1 +pineplankwooden,5,1 +pineplankwood,5,1 +pineplankw,5,1 +pplank,5,1 +pwoodenplank,5,1 +pwoodplank,5,1 +pwplank,5,1 +pplankwooden,5,1 +pplankwood,5,1 +pplankw,5,1 +lightplank,5,2 +lightwoodenplank,5,2 +lightwoodplank,5,2 +lightwplank,5,2 +lightplankwooden,5,2 +lightplankwood,5,2 +lightplankw,5,2 +liteplank,5,2 +litewoodenplank,5,2 +litewoodplank,5,2 +litewplank,5,2 +liteplankwooden,5,2 +liteplankwood,5,2 +liteplankw,5,2 +birchplank,5,2 +birchwoodenplank,5,2 +birchwoodplank,5,2 +birchwplank,5,2 +birchplankwooden,5,2 +birchplankwood,5,2 +birchplankw,5,2 +bplank,5,2 +bwoodenplank,5,2 +bwoodplank,5,2 +bwplank,5,2 +bplankwooden,5,2 +bplankwood,5,2 +bplankw,5,2 +jungleplank,5,3 +junglewoodenplank,5,3 +junglewoodplank,5,3 +junglewplank,5,3 +jungleplankwooden,5,3 +jungleplankwood,5,3 +jungleplankw,5,3 +jplank,5,3 +jwoodenplank,5,3 +jwoodplank,5,3 +jwplank,5,3 +jplankwooden,5,3 +jplankwood,5,3 +jplankw,5,3 sapling,6,0 treesapling,6,0 logsapling,6,0 @@ -232,6 +302,10 @@ wtreesap,6,2 wlogsap,6,2 wtrunksap,6,2 wwoodsap,6,2 +junglesapling,6,3 +jsapling,6,3 +junglesap,6,3 +jsap,6,3 bedrock,7,0 oprock,7,0 opblock,7,0 @@ -360,6 +434,12 @@ wtree,17,2 wlog,17,2 wtrunk,17,2 wwood,17,2 +junglewood,17,3 +jwood,17,3 +junglelog,17,3 +jlog,17,3 +monkeytree,17,3 +monkeylog,17,3 leaves,18,4 leaf,18,4 treeleaves,18,4 @@ -454,6 +534,12 @@ bitreeleaf,18,6 bilogleaf,18,6 bitrunkleaf,18,6 biwoodleaf,18,6 +jungleleaves,18,7 +jleaves,18,7 +jleaf,18,7 +jungleleaf,18,7 +monkeyleaf,18,7 +monkeyleaves,18,7 sponge,19,0 glass,20,0 lapislazuliore,21,0 @@ -476,6 +562,27 @@ dispenser,23,0 dispense,23,0 sandstone,24,0 sastone,24,0 +csandstone,24,1 +csastone,24,1 +creepsandstone,24,1 +creepsastone,24,1 +creepersandstone,24,1 +creepersastone,24,1 +hieroglyphicsandstone,24,1 +hieroglyphicsastone,24,1 +hieroglyphsandstone,24,1 +hieroglyphsastone,24,1 +hsandstone,24,1 +hsastone,24,1 +pyramidsandstone,24,1 +pyramidsastone,24,1 +psandstone,24,1 +psastone,24,1 +smoothsandstone,24,2 +smoothsastone,24,2 +ssandstone,24,2 +smsastone,24,2 +ssastone,24,2 noteblock,25,0 musicblock,25,0 nblock,25,0 @@ -515,6 +622,7 @@ pistonstick,29,7 pistonsbase,29,7 pistons,29,7 psticky,29,7 +pstick,29,7 spiderweb,30,0 sweb,30,0 web,30,0 @@ -704,6 +812,7 @@ blawool,35,15 blacotton,35,15 pistonmovingpiece,36,0 pistonmp,36,0 +pistontop,36,0 yellowflower,37,0 yflower,37,0 flower,37,0 @@ -874,6 +983,9 @@ sbdstep,43,5 stonebrickdoubleslab,43,5 stonebdslab,43,5 sbdslab,43,5 +adminslab,43,6 +magicslab,43,6 +adslab,43,6 smoothstonestep,44,0 stonestep,44,0 sstep,44,0 @@ -949,9 +1061,13 @@ fire,51,0 flame,51,0 flames,51,0 mobspawner,52,0 +mobcage,52,0 monsterspawner,52,0 +monstercage,52,0 mspawner,52,0 +mcage,52,0 spawner,52,0 +cage,52,0 woodenstairs,53,0 woodstairs,53,0 wstairs,53,0 @@ -1295,6 +1411,10 @@ crackedstonebrick,98,2 crackedstonebricks,98,2 crackedstonebrickblock,98,2 crackedstonebb,98,2 +circlestonebrick,98,3 +circlestonebb,98,3 +circlestone,98,3 +circlesbb,98,3 hugeredmushroom,99,0 bigredmushroom,99,0 brmushroom,99,0 @@ -1315,9 +1435,17 @@ jailbarsblock,101,0 jailbarsb,101,0 jailbars,101,0 glasspane,102,0 +glassp,102,0 +paneglass,102,0 +pglass,102,0 flatglass,102,0 +fglass,102,0 skinnyglass,102,0 +sglass,102,0 glassflat,102,0 +glassf,102,0 +glassskinny,102,0 +glasss,102,0 melon,103,0 watermelon,103,0 greenmelon,103,0 @@ -1338,8 +1466,13 @@ stemgreenmelon,105,0 vines,106,0 vine,106,0 greenvines,106,0 +greenvine,106,0 gardenvines,106,0 +gardenvine,106,0 vinesgreen,106,0 +vinegreen,106,0 +vinesgarden,106,0 +vinegarden,106,0 fencegate,107,0 woodenfence,107,0 woodenfencegate,107,0 @@ -1362,6 +1495,8 @@ cementstairs,109,0 cementbstairs,109,0 greybrickstairs,109,0 greybstairs,109,0 +purplegrass,110,0 +pinkgrass,110,0 mycel,110,0 mycelium,110,0 swampgrass,110,0 @@ -1462,8 +1597,14 @@ degg,122,0 bossegg,122,0 begg,122,0 redstonelamp,123,0 +redstonelampoff,123,0 redlamp,123,0 +redlampoff,123,0 rslamp,123,0 +rslampoff,123,0 +redstonelampon,124,0 +redlampon,124,0 +rslampon,124,0 ironshovel,256,0 ironspade,256,0 ishovel,256,0 @@ -2322,12 +2463,16 @@ chickenraw,365,0 cookedchicken,366,0 grilledchicken,366,0 toastedchicken,366,0 +gchicken,366,0 +bbqchicken,366,0 +friedchicken,366,0 +cchicken,366,0 rottenflesh,367,0 zombieflesh,367,0 rottenmeat,367,0 zombiemeat,367,0 badflesh,367,0 -poisenflesh,367,0 +poisonflesh,367,0 zombieremains,367,0 enderpearl,368,0 pearl,368,0 @@ -2349,6 +2494,7 @@ ghosttear,370,0 ghostdrop,370,0 gtear,370,0 gdrop,370,0 +tear,370,0 goldnugget,371,0 gnugget,371,0 goldball,371,0 @@ -2356,8 +2502,17 @@ goldpebble,371,0 gball,371,0 gpebble,371,0 pigzombienugget,371,0 +pigznugget,371,0 +pzombienugget,371,0 +pznugget,371,0 pigzombieball,371,0 +pigzball,371,0 +pzombieball,371,0 +pzball,371,0 pigzombiepebble,371,0 +pigzpebble,371,0 +pzombiepebble,371,0 +pzpebble,371,0 netherstalk,372,0 deathstalk,372,0 hellstalk,372,0 @@ -2373,7 +2528,18 @@ gbottle,374,0 gvase,374,0 vase,374,0 glassvase,374,0 -emptypotion,374,0 +emptyglassbottle,374,0 +emptybottle,374,0 +emptygbottle,374,0 +emptygvase,374,0 +emptyvase,374,0 +emptyglassvase,374,0 +eglassbottle,374,0 +ebottle,374,0 +egbottle,374,0 +egvase,374,0 +evase,374,0 +eglassvase,374,0 spidereye,375,0 eyeofspider,375,0 spiderseye,375,0 @@ -2419,11 +2585,13 @@ icauldronitem,380,0 scauldronitem,380,0 eyeofender,381,0 endereye,381,0 +enderpearl,381,0 evilendereye,381,0 evileyeofender,381,0 evilenderpearl,381,0 eeye,381,0 eofender,381,0 +epearl,381,0 speckledmelon,382,0 goldmelon,382,0 sparklymelon,382,0 @@ -2433,80 +2601,629 @@ shiningmelon,382,0 gmelon,382,0 smelon,382,0 creeperegg,383,50 +eggcreeper,383,50 skeletonegg,383,51 +eggskeleton,383,51 spideregg,383,52 +eggspider,383,52 giantegg,383,53 +egggiant,383,53 zombieegg,383,54 +eggzombie,383,54 slimeegg,383,55 +eggslime,383,55 ghastegg,383,56 +eggghast,383,56 zombiepigmanegg,383,57 +zpigmanegg,383,57 pigmanegg,383,57 +zombiepmanegg,383,57 +zpmanegg,383,57 +zombiepigmegg,383,57 +zpigmegg,383,57 +zombiepigegg,383,57 +zpigegg,383,57 +zombiepmegg,383,57 +zombiepegg,383,57 +eggzombiepigman,383,57 +eggzpigman,383,57 +eggpigman,383,57 +eggzombiepman,383,57 +eggzpman,383,57 +eggzombiepigm,383,57 +eggzpigm,383,57 +eggzombiepig,383,57 +eggzpig,383,57 +eggzombiepm,383,57 +eggzombiep,383,57 endermanegg,383,58 +eggenderman,383,58 +eggcavespider,383,59 cavespideregg,383,59 silverfishegg,383,60 +eggsilverfish,383,60 blazeegg,383,61 +eggblaze,383,61 lavaslimeegg,383,62 -magmacubeegg,383,63 +lavacubeegg,383,62 +magmacubeegg,383,62 +magmaslimeegg,383,62 +egglavaslime,383,62 +egglavacube,383,62 +eggmagmacube,383,62 +eggmagmaslime,383,62 pigegg,383,90 +eggpig,383,90 sheepegg,383,91 +eggsheep,383,91 cowegg,383,92 +eggcow,383,92 chickenegg,383,93 +eggchicken,383,93 squidegg,383,94 +eggsquid,383,94 wolfegg,383,95 +eggwolf,383,95 mooshroomegg,383,96 mushroomcowegg,383,96 +eggmooshroom,383,96 +eggmushroomcow,383,96 snowgolemegg,383,97 +sgolemegg,383,97 +eggsnowgolem,383,97 +eggsgolem,383,97 ocelotegg,383,98 +eggocelot,383,98 irongolemegg,383,99 +igolemegg,383,99 +eggirongolem,383,99 +eggigolem,383,99 villageregg,383,120 +eggvillager,383,120 bottleofenchanting,384,0 enchantingbottle,384,0 expbottle,384,0 xpbottle,384,0 +firecharge,385,0 +fireball,385,0 +grenade,385,0 goldmusicrecord,2256,0 goldmusicdisk,2256,0 +goldmusicdisc,2256,0 goldmusiccd,2256,0 +13musicrecord,2256,0 +13musicdisk,2256,0 +13musicdisc,2256,0 +13musiccd,2256,0 gomusicrecord,2256,0 gomusicdisk,2256,0 +gomusicdisc,2256,0 gomusiccd,2256,0 goldmrecord,2256,0 goldmdisk,2256,0 +goldmdisc,2256,0 goldmcd,2256,0 +13mrecord,2256,0 +13mdisk,2256,0 +13mdisc,2256,0 +13mcd,2256,0 gomrecord,2256,0 gomdisk,2256,0 +gomdisc,2256,0 gomcd,2256,0 goldrecord,2256,0 golddisk,2256,0 +golddisc,2256,0 goldcd,2256,0 +13record,2256,0 +13disk,2256,0 +13disc,2256,0 +13cd,2256,0 gorecord,2256,0 godisk,2256,0 +godisc,2256,0 gocd,2256,0 record1,2256,0 +disk1,2256,0 +disc1,2256,0 +cd1,2256,0 +1record,2256,0 +1disk,2256,0 +1disc,2256,0 +1cd,2256,0 greenmusicrecord,2257,0 greenmusicdisk,2257,0 +greenmusicdisc,2257,0 greenmusiccd,2257,0 +catmusicrecord,2257,0 +catmusicdisk,2257,0 +catmusicdisc,2257,0 +catmusiccd,2257,0 grmusicrecord,2257,0 grmusicdisk,2257,0 +grmusicdisc,2257,0 grmusiccd,2257,0 greenmrecord,2257,0 greenmdisk,2257,0 +greenmdisc,2257,0 greenmcd,2257,0 +catmrecord,2257,0 +catmdisk,2257,0 +catmdisc,2257,0 +catmcd,2257,0 grmrecord,2257,0 grmdisk,2257,0 +grmdisc,2257,0 grmcd,2257,0 greenrecord,2257,0 greendisk,2257,0 +greendisc,2257,0 greencd,2257,0 +catrecord,2257,0 +catdisk,2257,0 +catdisc,2257,0 +catcd,2257,0 grrecord,2257,0 grdisk,2257,0 +grdisc,2257,0 grcd,2257,0 record2,2257,0 +disk2,2257,0 +disc2,2257,0 +cd2,2257,0 +2record,2257,0 +2disk,2257,0 +2disc,2257,0 +2cd,2257,0 +orangemusicrecord,2258,0 +orangemusicdisk,2258,0 +orangemusicdisc,2258,0 +orangemusiccd,2258,0 +blocksmusicrecord,2258,0 +blocksmusicdisk,2258,0 +blocksmusicdisc,2258,0 +blocksmusiccd,2258,0 +ormusicrecord,2258,0 +ormusicdisk,2258,0 +ormusicdisc,2258,0 +ormusiccd,2258,0 +orangemrecord,2258,0 +orangemdisk,2258,0 +orangemdisc,2258,0 +orangemcd,2258,0 +blocksmrecord,2258,0 +blocksmdisk,2258,0 +blocksmdisc,2258,0 +blocksmcd,2258,0 +ormrecord,2258,0 +ormdisk,2258,0 +ormdisc,2258,0 +ormcd,2258,0 +orangerecord,2258,0 +orangedisk,2258,0 +orangedisc,2258,0 +orangecd,2258,0 +blocksrecord,2258,0 +blocksdisk,2258,0 +blocksdisc,2258,0 +blockscd,2258,0 +orrecord,2258,0 +ordisk,2258,0 +ordisc,2258,0 +orcd,2258,0 record3,2258,0 +disk3,2258,0 +disc3,2258,0 +cd3,2258,0 +3record,2258,0 +3disk,2258,0 +3disc,2258,0 +3cd,2258,0 +redmusicrecord,2259,0 +redmusicdisk,2259,0 +redmusicdisc,2259,0 +redmusiccd,2259,0 +chripmusicrecord,2259,0 +chripmusicdisk,2259,0 +chripmusicdisc,2259,0 +chripmusiccd,2259,0 +remusicrecord,2259,0 +remusicdisk,2259,0 +remusicdisc,2259,0 +remusiccd,2259,0 +redmrecord,2259,0 +redmdisk,2259,0 +redmdisc,2259,0 +redmcd,2259,0 +chripmrecord,2259,0 +chripmdisk,2259,0 +chripmdisc,2259,0 +chripmcd,2259,0 +remrecord,2259,0 +remdisk,2259,0 +remdisc,2259,0 +remcd,2259,0 +redrecord,2259,0 +reddisk,2259,0 +reddisc,2259,0 +redcd,2259,0 +chriprecord,2259,0 +chripdisk,2259,0 +chripdisc,2259,0 +chripcd,2259,0 +rerecord,2259,0 +redisk,2259,0 +redisc,2259,0 +recd,2259,0 record4,2259,0 +disk4,2259,0 +disc4,2259,0 +cd4,2259,0 +4record,2259,0 +4disk,2259,0 +4disc,2259,0 +4cd,2259,0 +lightgreenmusicrecord,2260,0 +lightgreenmusicdisk,2260,0 +lightgreenmusicdisc,2260,0 +lightgreenmusiccd,2260,0 +lgreenmusicrecord,2260,0 +lgreenmusicdisk,2260,0 +lgreenmusicdisc,2260,0 +lgreenmusiccd,2260,0 +lightgrmusicrecord,2260,0 +lightgrmusicdisk,2260,0 +lightgrmusicdisc,2260,0 +lightgrmusiccd,2260,0 +farmusicrecord,2260,0 +farmusicdisk,2260,0 +farmusicdisc,2260,0 +farmusiccd,2260,0 +lgrmusicrecord,2260,0 +lgrmusicdisk,2260,0 +lgrmusicdisc,2260,0 +lgrmusiccd,2260,0 +lightgreenmrecord,2260,0 +lightgreenmdisk,2260,0 +lightgreenmdisc,2260,0 +lightgreenmcd,2260,0 +lgreenmrecord,2260,0 +lgreenmdisk,2260,0 +lgreenmdisc,2260,0 +lgreenmcd,2260,0 +lightgrmrecord,2260,0 +lightgrmdisk,2260,0 +lightgrmdisc,2260,0 +lightgrmcd,2260,0 +farmrecord,2260,0 +farmdisk,2260,0 +farmdisc,2260,0 +farmcd,2260,0 +lgrmrecord,2260,0 +lgrmdisk,2260,0 +lgrmdisc,2260,0 +lgrmcd,2260,0 +lightgreenrecord,2260,0 +lightgreendisk,2260,0 +lightgreendisc,2260,0 +lightgreencd,2260,0 +lgreenrecord,2260,0 +lgreendisk,2260,0 +lgreendisc,2260,0 +lgreencd,2260,0 +lightgrrecord,2260,0 +lightgrdisk,2260,0 +lightgrdisc,2260,0 +lightgrcd,2260,0 +farrecord,2260,0 +fardisk,2260,0 +fardisc,2260,0 +farcd,2260,0 +lgrrecord,2260,0 +lgrdisk,2260,0 +lgrdisc,2260,0 +lgrcd,2260,0 record5,2260,0 +disk5,2260,0 +disc5,2260,0 +cd5,2260,0 +5record,2260,0 +5disk,2260,0 +5disc,2260,0 +5cs,2260,0 +purplemusicrecord,2261,0 +purplemusicdisk,2261,0 +purplemusicdisc,2261,0 +purplemusiccd,2261,0 +mallmusicrecord,2261,0 +mallmusicdisk,2261,0 +mallmusicdisc,2261,0 +mallmusiccd,2261,0 +pumusicrecord,2261,0 +pumusicdisk,2261,0 +pumusicdisc,2261,0 +pumusiccd,2261,0 +purplemrecord,2261,0 +purplemdisk,2261,0 +purplemdisc,2261,0 +purplemcd,2261,0 +mallmrecord,2261,0 +mallmdisk,2261,0 +mallmdisc,2261,0 +mallmcd,2261,0 +pumrecord,2261,0 +pumdisk,2261,0 +pumdisc,2261,0 +pumcd,2261,0 +purplerecord,2261,0 +purpledisk,2261,0 +purpledisc,2261,0 +purplecd,2261,0 +mallrecord,2261,0 +malldisk,2261,0 +malldisc,2261,0 +mallcd,2261,0 +purecord,2261,0 +pudisk,2261,0 +pudisc,2261,0 +pucd,2261,0 record6,2261,0 +disk6,2261,0 +disc6,2261,0 +cd6,2261,0 +6record,2261,0 +6disk,2261,0 +6disc,2261,0 +6cd,2261,0 +pinkmusicrecord,2262,0 +pinkmusicdisk,2262,0 +pinkmusicdisc,2262,0 +pinkmusiccd,2262,0 +mellohimusicrecord,2262,0 +mellohimusicdisk,2262,0 +mellohimusicdisc,2262,0 +mellohimusiccd,2262,0 +pimusicrecord,2262,0 +pimusicdisk,2262,0 +pimusicdisc,2262,0 +pimusiccd,2262,0 +pinkmrecord,2262,0 +pinkmdisk,2262,0 +pinkmdisc,2262,0 +pinkmcd,2262,0 +mellohimrecord,2262,0 +mellohimdisk,2262,0 +mellohimdisc,2262,0 +mellohimcd,2262,0 +pimrecord,2262,0 +pimdisk,2262,0 +pimdisc,2262,0 +pimcd,2262,0 +pinkrecord,2262,0 +pinkdisk,2262,0 +pinkdisc,2262,0 +pinkcd,2262,0 +mellohirecord,2262,0 +mellohidisk,2262,0 +mellohidisc,2262,0 +mellohicd,2262,0 +pirecord,2262,0 +pidisk,2262,0 +pidisc,2262,0 +picd,2262,0 record7,2262,0 +disk7,2262,0 +disc7,2262,0 +cd7,2262,0 +7record,2262,0 +7disk,2262,0 +7disc,2262,0 +7cd,2262,0 +blackmusicrecord,2263,0 +blackmusicdisk,2263,0 +blackmusicdisc,2263,0 +blackmusiccd,2263,0 +stalmusicrecord,2263,0 +stalmusicdisk,2263,0 +stalmusicdisc,2263,0 +stalmusiccd,2263,0 +blmusicrecord,2263,0 +blmusicdisk,2263,0 +blmusicdisc,2263,0 +blmusiccd,2263,0 +blackmrecord,2263,0 +blackmdisk,2263,0 +blackmdisc,2263,0 +blackmcd,2263,0 +stalmrecord,2263,0 +stalmdisk,2263,0 +stalmdisc,2263,0 +stalmcd,2263,0 +blmrecord,2263,0 +blmdisk,2263,0 +blmdisc,2263,0 +blmcd,2263,0 +blackrecord,2263,0 +blackdisk,2263,0 +blackdisc,2263,0 +blackcd,2263,0 +stalrecord,2263,0 +staldisk,2263,0 +staldisc,2263,0 +stalcd,2263,0 +blrecord,2263,0 +bldisk,2263,0 +bldisc,2263,0 +blcd,2263,0 record8,2263,0 +disk8,2263,0 +disc8,2263,0 +cd8,2263,0 +8record,2263,0 +8disk,2263,0 +8disc,2263,0 +8cd,2263,0 +whitemusicrecord,2264,0 +whitemusicdisk,2264,0 +whitemusicdisc,2264,0 +whitemusiccd,2264,0 +stradmusicrecord,2264,0 +stradmusicdisk,2264,0 +stradmusicdisc,2264,0 +stradmusiccd,2264,0 +whmusicrecord,2264,0 +whmusicdisk,2264,0 +whmusicdisc,2264,0 +whmusiccd,2264,0 +whitemrecord,2264,0 +whitemdisk,2264,0 +whitemdisc,2264,0 +whitemcd,2264,0 +stradmrecord,2264,0 +stradmdisk,2264,0 +stradmdisc,2264,0 +stradmcd,2264,0 +whmrecord,2264,0 +whmdisk,2264,0 +whmdisc,2264,0 +whmcd,2264,0 +whiterecord,2264,0 +whitedisk,2264,0 +whitedisc,2264,0 +whitecd,2264,0 +stradrecord,2264,0 +straddisk,2264,0 +straddisc,2264,0 +stradcd,2264,0 +whrecord,2264,0 +whdisk,2264,0 +whdisc,2264,0 +whcd,2264,0 record9,2264,0 +disk9,2264,0 +disc9,2264,0 +cd9,2264,0 +9record,2264,0 +9disk,2264,0 +9disc,2264,0 +9cd,2264,0 +darkgreenmusicrecord,2265,0 +darkgreenmusicdisk,2265,0 +darkgreenmusicdisc,2265,0 +darkgreenmusiccd,2265,0 +dgreenmusicrecord,2265,0 +dgreenmusicdisk,2265,0 +dgreenmusicdisc,2265,0 +dgreenmusiccd,2265,0 +darkgrmusicrecord,2265,0 +darkgrmusicdisk,2265,0 +darkgrmusicdisc,2265,0 +darkgrmusiccd,2265,0 +wardmusicrecord,2265,0 +wardmusicdisk,2265,0 +wardmusicdisc,2265,0 +wardmusiccd,2265,0 +dgrmusicrecord,2265,0 +dgrmusicdisk,2265,0 +dgrmusicdisc,2265,0 +dgrmusiccd,2265,0 +darkgreenmrecord,2265,0 +darkgreenmdisk,2265,0 +darkgreenmdisc,2265,0 +darkgreenmcd,2265,0 +dgreenmrecord,2265,0 +dgreenmdisk,2265,0 +dgreenmdisc,2265,0 +dgreenmcd,2265,0 +darkgrmrecord,2265,0 +darkgrmdisk,2265,0 +darkgrmdisc,2265,0 +darkgrmcd,2265,0 +wardmrecord,2265,0 +wardmdisk,2265,0 +wardmdisc,2265,0 +wardmcd,2265,0 +dgrmrecord,2265,0 +dgrmdisk,2265,0 +dgrmdisc,2265,0 +dgrmcd,2265,0 +darkgreenrecord,2265,0 +darkgreendisk,2265,0 +darkgreendisc,2265,0 +darkgreencd,2265,0 +dgreenrecord,2265,0 +dgreendisk,2265,0 +dgreendisc,2265,0 +dgreencd,2265,0 +darkgrrecord,2265,0 +darkgrdisk,2265,0 +darkgrdisc,2265,0 +darkgrcd,2265,0 +wardrecord,2265,0 +warddisk,2265,0 +warddisc,2265,0 +wardcd,2265,0 +dgrrecord,2265,0 +dgrdisk,2265,0 +dgrdisc,2265,0 +dgrcd,2265,0 record10,2265,0 +disk10,2265,0 +disc10,2265,0 +cd10,2265,0 +10record,2265,0 +10disk,2265,0 +10disc,2265,0 +10cs,2265,0 +crackedmusicrecord,2266,0 +crackedmusicdisk,2266,0 +crackedmusicdisc,2266,0 +crackedmusiccd,2266,0 +crackmusicrecord,2266,0 +crackmusicdisk,2266,0 +crackmusicdisc,2266,0 +crackmusiccd,2266,0 +11musicrecord,2266,0 +11musicdisk,2266,0 +11musicdisc,2266,0 +11musiccd,2266,0 +cmusicrecord,2266,0 +cmusicdisk,2266,0 +cmusicdisc,2266,0 +cmusiccd,2266,0 +crackedmrecord,2266,0 +crackedmdisk,2266,0 +crackedmdisc,2266,0 +crackedmcd,2266,0 +crackmrecord,2266,0 +crackmdisk,2266,0 +crackmdisc,2266,0 +crackmcd,2266,0 +11mrecord,2266,0 +11mdisk,2266,0 +11mdisc,2266,0 +11mcd,2266,0 +cmrecord,2266,0 +cmdisk,2266,0 +cmdisc,2266,0 +cmcd,2266,0 +crackedrecord,2266,0 +crackeddisk,2266,0 +crackeddisc,2266,0 +crackedcd,2266,0 +crackrecord,2266,0 +crackdisk,2266,0 +crackdisc,2266,0 +crackcd,2266,0 +crecord,2266,0 +cdisk,2266,0 +cdisc,2266,0 +ccd,2266,0 record11,2266,0 +disk11,2266,0 +disc11,2266,0 +cd11,2266,0 +11record,2266,0 +11disk,2266,0 +11disc,2266,0 +11cd,2266,0
\ No newline at end of file diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index c059c3e48..5be1c7067 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -12,6 +12,7 @@ alertUsed=used: autoAfkKickReason=You have been kicked for idling more than {0} minutes. backAfterDeath=\u00a77Use the /back command to return to your death point. backUsageMsg=\u00a77Returning to previous location. +backupDisabled=An external backup script has not been configured. backupFinished=Backup finished backupStarted=Backup started balance=\u00a77Balance: {0} @@ -30,7 +31,7 @@ buildAlert=\u00a7cYou are not permitted to build bukkitFormatChanged=Bukkit version format changed. Version not checked. burnMsg=\u00a77You set {0} on fire for {1} seconds. canTalkAgain=\u00a77You can talk again -cantFindGeoIpDB=Can''t find GeoIP database! +cantFindGeoIpDB=Can't find GeoIP database! cantReadGeoIpDB=Failed to read GeoIP database! cantSpawnItem=\u00a7cYou are not allowed to spawn the item {0} chatTypeLocal=[L] @@ -50,6 +51,7 @@ creatingConfigFromTemplate=Creating config from template: {0} creatingEmptyConfig=Creating empty config: {0} creative=creative currency={0}{1} +currentWorld=Current World: {0} day=day days=days defaultBanReason=The Ban Hammer has spoken! @@ -83,6 +85,8 @@ 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} +exp=\u00a7c{0} \u00a77has\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) and needs\u00a7c {3} \u00a77more exp to level up. +expSet=\u00a7c{0} \u00a77now has\u00a7c {1} \u00a77exp. extinguish=\u00a77You extinguished yourself. extinguishOthers=\u00a77You extinguished {0}. failedToCloseConfig=Failed to close config {0} @@ -92,6 +96,7 @@ false=false feed=\u00a77Your appetite was sated. feedOther=\u00a77Satisfied {0}. fileRenameError=Renaming file {0} failed +flyMode=\u00a77Set fly mode {0} for {1}. foreverAlone=\u00a7cYou have nobody to whom you can reply. freedMemory=Freed {0} MB. gameMode=\u00a77Set game mode {0} for {1}. @@ -106,13 +111,18 @@ geoipJoinFormat=Player {0} comes from {1} godDisabledFor=disabled for {0} godEnabledFor=enabled for {0} godMode=\u00a77God mode {0}. +hatPlaced=\u00a7eEnjoy your new hat! +hatFail=\u00a7cYou must have something to wear in your hand. haveBeenReleased=\u00a77You have been released heal=\u00a77You have been healed. healOther=\u00a77Healed {0}. helpConsole=To view help from the console, type ?. +helpFrom=\u00a77Commands from {0}: helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Commands matching "{0}": helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} helpPages=Page \u00a7c{0}\u00a7f of \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Plugin Help: /help {1} holeInFloor=Hole in floor homeSet=\u00a77Home set. homeSetToBed=\u00a77Your home is now set to this bed. @@ -124,14 +134,14 @@ illegalDate=Illegal date format. infoChapter=Select chapter: infoChapterPages=Chapter {0}, page \u00a7c{1}\u00a7f of \u00a7c{2}\u00a7f: infoFileDoesNotExist=File info.txt does not exist. Creating one for you. -infoPages=Page \u00a7c{0}\u00a7f of \u00a7c{1}\u00a7f: +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Page \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- infoUnknownChapter=Unknown chapter. invBigger=The other users inventory is bigger than yours. invRestored=Your inventory has been restored. invSee=You see the inventory of {0}. invSeeHelp=Use /invsee to restore your inventory. invalidCharge=\u00a7cInvalid charge. -invalidHome=Home {0} doesn't exist +invalidHome=Home {0} doesn''t exist invalidMob=Invalid mob type. invalidServer=Invalid server! invalidSignLine=Line {0} on sign is invalid. @@ -156,7 +166,8 @@ jailReleased=\u00a77Player \u00a7e{0}\u00a77 unjailed. jailReleasedPlayerNotify=\u00a77You have been released! jailSentenceExtended=Jail time extend to: {0) jailSet=\u00a77Jail {0} has been set -jumpError=That would hurt your computer''s brain. +jumpError=That would hurt your computer's brain. +kickedAll=\u00a7cKicked all players from server kickDefault=Kicked from server kickExempt=\u00a7cYou can not kick that person. kill=\u00a77Killed {0}. @@ -167,7 +178,7 @@ kitGive=\u00a77Giving kit {0}. InvFull=\u00a7cYour inventory was full, dropping items on the floor kitTimed=\u00a7cYou can''t use that kit again for another {0}. kits=\u00a77Kits: {0} -lightningSmited=\u00a77You have just been smited +lightningSmited=\u00a77Thou hast been smitten lightningUse=\u00a77Smiting {0} listAfkTag = \u00a77[AFK]\u00a7f listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online. @@ -205,7 +216,6 @@ 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. nickDisplayName=\u00a77You have to enable change-displayname in Essentials config. @@ -229,7 +239,7 @@ 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. +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. @@ -252,7 +262,7 @@ 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. +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} @@ -272,7 +282,7 @@ playerNotFound=\u00a7cPlayer not found. playerUnmuted=\u00a77You have been unmuted pong=Pong! possibleWorlds=\u00a77Possible worlds are the numbers 0 through {0}. -powerToolAir=Command can''t be attached to air. +powerToolAir=Command can't be attached to air. powerToolAlreadySet=Command \u00a7c{0}\u00a7f is already assigned to {1}. powerToolAttach=\u00a7c{0}\u00a7f command assigned to {1}. powerToolClearAll=All powertool commands have been cleared. @@ -360,6 +370,7 @@ tradeSignEmptyOwner=There is nothing to collect from this trade sign. treeFailure=\u00a7cTree generation failure. Try again on grass or dirt. treeSpawned=\u00a77Tree spawned. true=true +tps=Current TPS = {0} typeTpaccept=\u00a77To teleport, type \u00a7c/tpaccept\u00a77. typeTpdeny=\u00a77To deny this request, type \u00a7c/tpdeny\u00a77. typeWorldName=\u00a77You can also type the name of a specific world. @@ -373,6 +384,8 @@ unknownItemName=Unknown item name: {0} unlimitedItemPermission=\u00a7cNo permission for unlimited item {0}. unlimitedItems=Unlimited items: unmutedPlayer=Player {0} unmuted. +unvanished=\u00a7aYou are once again visible. +unvanishedReload=\u00a7cA reload has forced you to become visible. upgradingFilesError=Error while upgrading the files userDoesNotExist=The user {0} does not exist. userIsAway={0} is now AFK @@ -382,12 +395,14 @@ userUsedPortal={0} used an existing exit portal. userdataMoveBackError=Failed to move userdata/{0}.tmp to userdata/{1} userdataMoveError=Failed to move userdata/{0} to userdata/{1}.tmp usingTempFolderForTesting=Using temp folder for testing: +vanished=\u00a7aYou have now been vanished. 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 warps. warpNotExist=That warp does not exist. +warpOverwrite=\u00a7cYou cannot overwrite that warp. warpSet=\u00a77Warp {0} set. warpUsePermission=\u00a7cYou do not have Permission to use that warp. warpingTo=\u00a77Warping to {0}. @@ -399,6 +414,7 @@ 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} +whoisExp=\u00a79 - Exp: {0} (Level {1}) whoisGamemode=\u00a79 - Gamemode: {0} whoisGeoLocation=\u00a79 - Location: {0} whoisGod=\u00a79 - God mode: {0} @@ -418,4 +434,4 @@ year=year years=years youAreHealed=\u00a77You have been healed. youHaveNewMail=\u00a7cYou have {0} messages!\u00a7f Type \u00a77/mail read\u00a7f to view your mail. - +hatArmor=\u00a7cError, you cannot use armor as a hat! diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties new file mode 100644 index 000000000..0265dab23 --- /dev/null +++ b/Essentials/src/messages_cs.properties @@ -0,0 +1,437 @@ +#version: TeamCity +# Single quotes have to be doubled: '' +# Translations start here +# 0.1 version: tomasara413 - Tento preklad neni 100% presny to se opravi v dalsich verzich prekladu +# 0.2 version: optimized by mdojcar (modojcar@seznam.cz) - mirne fixy a trochu jsem preklad vylepsil +# nektere vyrazy jako "Kicknut" jsou v anglickem zneni (zni to mnohem prirozeneji) +# 0.3 tommymortago - Pro upravy kontaktujte na skype: tomasperzl/ Korektura: Sejsel +action=* {0} {1} +addedToAccount=\u00a7a{0} bylo pripsano na tvuj ucet. +addedToOthersAccount=\u00a7a{0} bylo pripsano na {1}\u00a7a ucet. Nova hodnota: {2} +alertBroke=zniceno: +alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} v: {3} +alertPlaced=polozeno: +alertUsed=pouzito: +autoAfkKickReason=Byl jsi vyhozen za neaktivitu delsi nez {0} minut. +backAfterDeath=\u00a77Pouzij /back, aby ses vratil na misto sve smrti. +backUsageMsg=\u00a77Vracis se na svou minulou pozici. +backupDisabled=Externi zalohovaci script neni nastaven. +backupFinished=Zaloha dokoncena +backupStarted=Probiha zaloha +balance=\u00a77Ucet: {0} +balanceTop=\u00a77Nejbohatsi hraci ({0}) +banExempt=\u00a7cNemuzes zabanovat tohoto hrace. +banIpAddress=\u00a77IP Adresa byla zabanovana +bannedIpsFileError=Chyba pri nacitani banned-ips.txt +bannedIpsFileNotFound=Soubor banned-ips.txt nebyl nazen. +bannedPlayersFileError=Chyba pri nacitani banned-players.txt +bannedPlayersFileNotFound=Soubor banned-players.txt nebyl nalezen +bigTreeFailure=\u00a7cProblem pri vytvareni velkeho stromu. Zkuste znovu na trave nebo hline. +bigTreeSuccess= \u00a77Velky strom vytvoren. +blockList=Essentials prenechal nasledujici prikazy jinemu pluginu: +broadcast=[\u00a7cSdeleni\u00a7f]\u00a7a {0} +buildAlert=\u00a7cNemas dovoleno stavet. +bukkitFormatChanged=Format kontroly verze Bukkitu zmenen. Verze nebyla zkontrolovana. +burnMsg=\u00a77Zapalil jsi {0} na dobu {1} sekund. +canTalkAgain=\u00a77Muzes opet mluvit. +cantFindGeoIpDB=Nemohu najit GeoIP databazi! +cantReadGeoIpDB=Nemohu precist GeoIP databazi! +cantSpawnItem=\u00a7cNejsi dovoleny spawnout item: {0} +chatTypeLocal=[L] +chatTypeSpy=[Spy] +commandFailed=Prikaz {0} selhal. +commandHelpFailedForPlugin=Chyba pri ziskavani pomoci: {0} +commandNotLoaded=\u00a7cPrikaz {0} je nespravne nacteny. +compassBearing=\u00a77Zmena orientace: {0} ({1} stupnu). +configFileMoveError=Chyba pri presouvani config.yml do slozky se zalohou. +configFileRenameError=Chyba pri pokusu o prejmenovani docasneho souboru na config.yml +connectedPlayers=Pripojeni hraci: +connectionFailed=Pokus o otevreni spojeni selhal. +cooldownWithMessage=\u00a7cOdpocet: {0} +corruptNodeInConfig=\u00a74Pozor: Vas konfiguracni soubor ma chybnou {0} poznamku. +couldNotFindTemplate=Nemohu naleznout sablonu: {0} +creatingConfigFromTemplate=Vytvarim config ze sablony: {0} +creatingEmptyConfig=Vytvarim prazdny config: {0} +creative=creative +currency={0}{1} +day=den +days=dny +defaultBanReason=Banovaci kladivo promluvilo! +deleteFileError=Nemohu smazat soubor: {0} +deleteHome=\u00a77Domov {0} byl uspesne odstranen. +deleteJail=\u00a77Jail {0} byl uspesne odstranen. +deleteWarp=\u00a77Warp {0} byl uspesne odstranen. +deniedAccessCommand=Hraci {0} byl zablokovan prikaz. +dependancyDownloaded=[Essentials] Zavislost {0} uspesne stazena. +dependancyException=[Essentials] Nastala chyba pri pokusu o stazeni zavilosti. +dependancyNotFound=[Essentials] Pozadovana zavilost nenalezena, stahuji nyni. +depth=\u00a77Jsi na urovni more. +depthAboveSea=\u00a77Jsi {0} kostek nad urovni more. +depthBelowSea=\u00a77Jsi {0} kostek pod urovni more. +destinationNotSet=Destinace neni nastavena. +disableUnlimited=\u00a77Zablokovano neomezene pokladani {0} hraci {1}. +disabled=zablokovano +disabledToSpawnMob=Spawnuti tohoto moba je zakazno v configuracnim souboru. +dontMoveMessage=\u00a77Teleport bude zahajen za {0}. Nehybej se. +downloadingGeoIp=Stahuji GeoIP databazi ... muze to chvilku trvat (staty: 0.6 MB, mesta: 20MB) +duplicatedUserdata=Duplikovane data hrace: {0} and {1} +enableUnlimited=\u00a77Davam neomezene mnozstvi {0} hraci {1}. +enabled=povoleno +enchantmentApplied = \u00a77Enchant {0} byl aplikovan na tvuj nastroj v ruce. +enchantmentNotFound = \u00a7cTento enchant neexistuje +enchantmentPerm = \u00a7cNemas opravneni na enchant: {0} +enchantmentRemoved = \u00a77Enchant {0} byl odstranen z tveho nastroje v ruce. +enchantments = \u00a77Enchantmenty: {0} +errorCallingCommand=Chyba pri volani prikazu /{0} +errorWithMessage=\u00a7cChyba: {0} +essentialsHelp1=Soubor je poskozen a Essentials jej nemuze otevrit. Essentials jsou zablokovany. Pokud nemuzete soubor opravit sami, navstivte http://tiny.cc/EssentialsChat +essentialsHelp2=Soubor je poskozen a Essentials jej nemuze otevrit. Essentials jsou zablokovany. Pokud nemuzete soubor opravit sami, pak napiste /essentialshelp ve hre nebo navstivte http://tiny.cc/EssentialsChat +essentialsReload=\u00a77Essentials znovu nacteny. {0} +extinguish=\u00a77Uhasil ses. +extinguishOthers=\u00a77Uhasil jsi hrace {0}. +failedToCloseConfig=Chyba pri uzavreni configu {0} +failedToCreateConfig=Chyba pri vytvoreni configu {0} +failedToWriteConfig=Chyba pri zapisovani do configu {0} +false=nepravda +feed=\u00a77Nasytil jsi se. +feedOther=\u00a77Nasytil jsi hrace {0}. +fileRenameError=Prejmenovani souboru {0} selhalo. +flyMode=\u00a77Povolil jsi letani hraci {0} na {1}. +foreverAlone=\u00a7cNemas komu odepsat. +freedMemory=Uvolneno {0} MB. +gameMode=\u00a77Nastavil jsi herni mod z {0} na {1}. +gcchunks= chunky, +gcentities= entity +gcfree=Volna pamet: {0} MB +gcmax=Dostupna pamet: {0} MB +gctotal=Vyuzita pamet: {0} MB +geoIpUrlEmpty=Odkaz na stazeni GeoIP je prazdny. +geoIpUrlInvalid=Odkaz na stazeni GeoIP je chybny. +geoipJoinFormat=Hrac {0} prichazi z {1} +godDisabledFor=zakazan pro {0} +godEnabledFor=povolen pro {0} +godMode=\u00a77God mode {0}. +haveBeenReleased=\u00a77Byl jsi uvolnen +heal=\u00a77Byl jsi uzdraven. +healOther=\u00a77Uzdravil jsi hrace {0}. +helpConsole=Pokud chces videt napovedu z konzole, napis ?. +helpFrom=\u00a77Prikazy od{0}: +helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Prikazy odpovidajici "{0}": +helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} +helpPages=Strana \u00a7c{0}\u00a7f z \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Napoveda pluginu: /help {1} +holeInFloor=Dira v podlaze +homeSet=\u00a77Domov nastaven. +homeSetToBed=\u00a77Tvuj domov je nastaven na tuto postel. +homes=Domovy: {0} +hour=hodina +hours=hodiny +ignorePlayer=Odted jsi zacal ignorovat hrace {0}. +illegalDate=Nespravny format data. +infoChapter=Vyberte kapitolu: +infoChapterPages=Kapitola {0}, strana \u00a7c{1}\u00a7f z \u00a7c{2}\u00a7f: +infoFileDoesNotExist=Soubor info.txt neexistuje. Vytvarim novy. +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Strana \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- +infoUnknownChapter=Neznama kapitola. +invBigger=Inventar druheho hrace je vetsi nez tvuj. +invRestored=Tvuj inventar byl obnoven. +invSee=Nyni mas inventar hrace {0}. +invSeeHelp=Pouzij znovu /invsee aby jsi mel zpatky svuj inventar. +invalidCharge=\u00a7cNeplatny poplatek. +invalidHome=Domov {0} neexistuje. +invalidMob=Nespravny typ moba. +invalidServer=Nespravny server! +invalidSignLine=Radek {0} je chybne vyplnen. +invalidWorld=\u00a7cNespravny svet! +inventoryCleared=\u00a77Inventar smazan. +inventoryClearedOthers=\u00a77Inventar hrace \u00a7c{0}\u00a77 vymazan. +is=je +itemCannotBeSold=Tento item nelze prodat serveru. +itemMustBeStacked=Itemy musi byt vymeneny ve stacku. +itemNotEnough1=\u00a7cNemas dostatek tohoto itemu, aby jsi jej mohl prodat. +itemNotEnough2=\u00a77Pokud jsi chtel prodat vsechny itemy tohoto typu, pouzij /sell nazevitemu +itemNotEnough3=\u00a77/sell nazevnitemu -1 proda vse ale pouze jeden item atd. +itemSellAir=Vazne jsi se pokusil prodat Vzduch? Vezmi si neco do ruky. +itemSold=\u00a77Prodal za \u00a7c{0} \u00a77({1} {2} za cenu {3} kus) +itemSoldConsole={0} Prodal {1} za \u00a77{2} \u00a77({3} za cenu {4} kus) +itemSpawn=\u00a77Davam {0} {1} +itemsCsvNotLoaded=Nelze nacist soubor items.csv. +jailAlreadyIncarcerated=\u00a7cTento hrace ja jiz uveznen: {0} +jailMessage=\u00a7cPorusil jsi pravidla, ted si to odsedis! +jailNotExist=Toto vezeni neexistuje. +jailReleased=\u00a77Hrac \u00a7e{0}\u00a77 byl propusten na svobodu. +jailReleasedPlayerNotify=\u00a77Byl jsi propusten na svobodu! +jailSentenceExtended=Cas ve vezeni prodlouzen na: {0) +jailSet=\u00a77Vezeni {0} bylo vytvoreno. +jumpError=Tohle by tvuj procesor nemusel rozdychat. +kickDefault=Vyhozen ze serveru +kickExempt=\u00a7cNemuzes vyhodit tuhle osobu. +kill=\u00a77Zabit {0}. +kitError2=\u00a7cTento kit neexistuje, nebo je chybne definovan. +kitError=\u00a7cNejsou zadne validni kity. +kitErrorHelp=\u00a7cPravdepodobne item nema vyplnene mnozstvi v configu? +kitGive=\u00a77Davam kit {0}. +kitInvFull=\u00a7cMel jsi plny inventar, obsah kitu je na zemi. +kitTimed=\u00a7cNemuzes pouzit tento kit po dalsich {0}. +kits=\u00a77Kity: {0} +lightningSmited=\u00a77Byl jsi zasazen bleskem. +lightningUse=\u00a77Zasadil jsi bleskem hrace {0} +listAfkTag = \u00a77[AFK]\u00a7f +listAmount = \u00a79Je tu \u00a7c{0}\u00a79 z maxima \u00a7c{1}\u00a79 hracu online. +listAmountHidden = \u00a79Je tu \u00a7c{0}\u00a77/{1}\u00a79 z maxima \u00a7c{2}\u00a79 hracu online. +listGroupTag={0}\u00a7f: +listHiddenTag = \u00a77[HIDDEN]\u00a7f +loadWarpError=Chyba pri nacitani warpu: {0} +localFormat=Jazyk: <{0}> {1} +mailClear=\u00a7cPokud chces vymazat mail, napis /mail clear. +mailCleared=\u00a77Mail vymazan! +mailSent=\u00a77Mail odeslan! +markMailAsRead=\u00a7cPokud chces mail oznacit jako precteny, napis /mail clear +markedAsAway=\u00a77Jsi oznacen jako "Pryc". +markedAsNotAway=\u00a77Jiz nejsi oznacen jako "Pryc". +maxHomes=Nemuzes si nastavit vice nez {0} domovu. +mayNotJail=\u00a7cNesmis uveznit tuto postavu +me=ja +minute=minuta +minutes=minuty +missingItems=Nemas {0}x {1}. +missingPrefixSuffix=Chybi prefix nebo suffix pro {0} +mobSpawnError=Chyba pri pokusu o zmenu mob spawneru. +mobSpawnLimit=Pocet mobu limitovan serverem. +mobSpawnTarget=Musis se divat na spawner. +mobsAvailable=\u00a77Mobove: {0} +moneyRecievedFrom=\u00a7a{0} jsi obdrzel od hrace {1} +moneySentTo=\u00a7a{0} bylo odeslano hraci: {1} +moneyTaken={0} bylo odebrano z tveho uctu. +month=mesic +months=mesice +moreThanZero=Mnozstvi musi byt vetsi nez 0. +msgFormat=\u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} +muteExempt=\u00a7cTohoto hrace nemuzes umlcet. +mutedPlayer=Hrac {0} byl umlcen. +mutedPlayerFor=Hrac {0} umlcen za {1}. +mutedUserSpeaks={0} se pokusil promluvit, ale je umlcen. +nearbyPlayers=Hraci v okoli: {0} +negativeBalanceError=Hrac nemuze mit zapornou hodnotu uctu. +nickChanged=Nickname zmenen. +nickDisplayName=\u00a77Musis nejdrive povolit change-displayname v Essentials configu. +nickInUse=\u00a7cTento nick jiz nekdo ma. +nickNamesAlpha=\u00a7cNick musi byt alfanumericky. +nickNoMore=\u00a77Uz nemas zadny nick. +nickOthersPermission=\u00a7cNemas opravneni menit ostatnim nick. +nickSet=\u00a77Nyni mas nickname: \u00a7c{0} +noAccessCommand=\u00a7cNemas povoleni na tento prikaz. +noAccessPermission=\u00a7cNemas povoleni k tomuto {0}. +noBreakBedrock=Nemas opravneni nicit bedrock. +noDestroyPermission=\u00a7cNemas povoleni nicit ten {0}. +noGodWorldWarning=\u00a7cVarovani! God-mode je v tomto svete zakazan. +noHelpFound=\u00a7cZadne shodujici prikazy. +noHomeSet=Nemas nastaveny zadny domov. +noHomeSetPlayer=Hrac nema nastaveny zadny domov. +noKitPermission=\u00a7cPotrebujes \u00a7c{0}\u00a7c permission, aby jsi mohl pouzit tento kit. +noKits=\u00a77Nejsou zadne dostupne kity. +noMail=Nemas zadny mail. +noMotd=\u00a7cNeni zadna zprava dne. +noNewMail=\u00a77Nemas zadny novy mail. +noPendingRequest=Nemas zadne neuzavrene zadosti. +noPerm=\u00a7cNemas \u00a7f{0}\u00a7c permici. +noPermToSpawnMob=\u00a7cNemas povoleni k spawnovani mobu. +noPlacePermission=\u00a7cNemas povoleni pokladat nebo nicit cokoliv blizko teto cedule. +noPowerTools=Nemas zadny mocny nastroj. +noRules=\u00a7cNejsou nastaveny zadne pravidla. +noWarpsDefined=Nejsou nastaveny zadne warpy. +none=zadny +notAllowedToQuestion=\u00a7cNejsi opravnen pouzit otazku. +notAllowedToShout=\u00a7cNejsi opravnen pouzit kriceni. +notEnoughExperience=Nemas dostatek zkusenosti. +notEnoughMoney=Nemas dostatecny financni obnos. +notRecommendedBukkit=* ! * Verze bukkitu neni doporucena pro Essentials. +notSupportedYet=Jeste neni podporovano. +nothingInHand = \u00a7cNedrzis nic v ruce. +now=nyni +nuke=Prsi na tebe smrt :) +numberRequired=Hlupaku, musis vyplnit cislo. +onlyDayNight=/time podporuje pouze day/night. +onlyPlayers=Pouze hraci ve hre mohou pouzit: {0}. +onlySunStorm=/weather podporuje pouze sun/storm. +orderBalances=Usporadavam bohatstvi {0} hracu, prosim vydrz ... +pTimeCurrent=\u00a7eCas hrace u00a7f je {1}. //??? +pTimeCurrentFixed=\u00a7eCas hrace {0} u00a7f je nastaven na {1}. +pTimeNormal=\u00a7eCas hrace {0}\u00a7f je normalni a souhlasi s casem serveru. +pTimeOthersPermission=\u00a7cNejsi opravnen menit cizim hracum cas. +pTimePlayers=Tihle hraci maji nastaveny svuj cas: +pTimeReset=Cas hrace byl obnoven za: \u00a7e{0} +pTimeSet=Cas hrace je nastaven na \u00a73{0}\u00a7f za: \u00a7e{1} +pTimeSetFixed=Cas hrace je fixne nastaven na \u00a73{0}\u00a7f za: \u00a7e{1} +parseError=Chyba pri parsovani {0} na radku {1} +pendingTeleportCancelled=\u00a7cNevyresena zadost o teleportaci byla zrusena. +permissionsError=Chybi Permissions/GroupManager; prefixy/suffixy v chatu budou zablokovany. +playerBanned=\u00a7cAdmin {0} zabanoval {1} za {2} +playerInJail=\u00a7cHrac je jiz uveznen {0}. +playerJailed=\u00a77Hrac {0} byl uveznen. +playerJailedFor= \u00a77Hrac {0} uveznen za {1}. +playerKicked=\u00a7cAdmin {0} vyhodil {1} za {2} +playerMuted=\u00a77Byl jsi umlcen. +playerMutedFor=\u00a77Byl jsi umlcen za {0} +playerNeverOnServer=\u00a7cHrac {0} nebyl nikdy na serveru. +playerNotFound=\u00a7cHrac nenalezen. +playerUnmuted=\u00a77Byl jsi odmlcen. +pong=Pong! +possibleWorlds=\u00a77Mozne svety jsou cisla 0 az {0}. +powerToolAir=Prikaz nemuze byt spojen se vzduchem. +powerToolAlreadySet=Prikaz \u00a7c{0}\u00a7f je jiz spojen s {1}. +powerToolAttach=\u00a7c{0}\u00a7f prikaz pripsan k {1}. +powerToolClearAll=Vsechny mocne nastroje byli smazany. +powerToolList=Hrac {1} ma tyto prikazy: \u00a7c{0}\u00a7f. +powerToolListEmpty={0} nema pripsany zadne prikazy. +powerToolNoSuchCommandAssigned=Prikaz \u00a7c{0}\u00a7f nebyl pripsan k {1}. +powerToolRemove=Prikaz \u00a7c{0}\u00a7f odstranen z {1}. +powerToolRemoveAll=Vsechny prikazy zruseny od {0}. +powerToolsDisabled=Vsechny tve mocne nastroje byli zablokovany. +powerToolsEnabled=Vsechny tve mocne nastroje byli povoleny. +protectionOwner=\u00a76[EssentialsProtect] Majitel ochrany: {0} +questionFormat=\u00a77[Otazka]\u00a7f {0} +readNextPage=Napis /{0} {1} pro precteni dalsi stranky. +reloadAllPlugins=\u00a77Znovu nacteny vsechny pluginy. +removed=\u00a77Odstraneno {0} entitit. +repair=Uspesne jsi opravil svuj nastroj: \u00a7e{0}. +repairAlreadyFixed=\u00a77Tento item nepotrebuje opravu. +repairEnchanted=\u00a77Nemas opravneni opravovat enchantovane itemy. +repairInvalidType=\u00a7cTento item nemuze byt opraven. +repairNone=Nemas zadne itemy, ktere potrebuji opravit. +requestAccepted=\u00a77Zadost o teleport prijata. +requestAcceptedFrom=\u00a77{0} prijal tvou zadost o teleport. +requestDenied=\u00a77Zadost o teleport zamitnuta. +requestDeniedFrom=\u00a77{0} odmitl tvou zadost o teleport. +requestSent=\u00a77Zadost odeslana hraci {0}\u00a77. +requestTimedOut=\u00a7cZadost o teleportaci vyprsela. +requiredBukkit= * ! * Potrebujete minimalne verzi {0} Bukkitu, stahnete si ji z http://dl.bukkit.org/downloads/craftbukkit/ +returnPlayerToJailError=Nastala chyba pri pokusu navraceni hrace {0} do vezeni: {1} +second=sekunda +seconds=sekundy +seenOffline=Hrac {0} je offline od {1} +seenOnline=Hrac {0} je online od {1} +serverFull=Server je plny +serverTotal=Maximum serveru: {0} +setSpawner=Zmenil jsi spawner na: {0} +sheepMalformedColor=Deformovana barva. +shoutFormat=\u00a77[Shout]\u00a7f {0} +signFormatFail=\u00a74[{0}] +signFormatSuccess=\u00a71[{0}] +signFormatTemplate=[{0}] +signProtectInvalidLocation=\u00a74Nemas opravneni vytvaret zde cedule. +similarWarpExist=Warp s podobnym nebo stejnym jmenem jiz existuje. +slimeMalformedSize=Zdeformovana velikost. +soloMob=Tento mob ma rad, kdyz je sam. +spawnSet=\u00a77Spawn-lokace nastavena pro skupinu: {0}. +spawned=spawnut +sudoExempt=Nemuzes ovladat tohoto hrace +sudoRun=Nutis hrace {0} k behu: /{1} {2} +suicideMessage=\u00a77Sbohem kruty svete... +suicideSuccess= \u00a77{0} si vzal svuj zivot +survival=survival +takenFromAccount=\u00a7c{0} bylo odecteno z tveho uctu. +takenFromOthersAccount=\u00a7c{0} bylo odebrano z {1}\u00a7c uctu. Nova hodnota: {2} +teleportAAll=\u00a77Zadost o teleportaci odeslana vsem hracum... +teleportAll=\u00a77Teleportuji v\u00c5\u00a1echny hrace... +teleportAtoB=\u00a77{0}\u00a77 vas teleportoval k {1}\u00a77. +teleportDisabled={0} mas teleportaci zablokovanou. +teleportHereRequest=\u00a7c{0}\u00a7c vas pozadal aby jste se warpnul k nemu. +teleportNewPlayerError=Teleportace noveho hrace selhala +teleportRequest=\u00a7c{0}\u00a7c se chce teleportovat k tobe. +teleportRequestTimeoutInfo=\u00a77Tato zadost vyprsi za {0} sekund. +teleportTop=\u00a77Teleportuji na vrch. +teleportationCommencing=\u00a77Teleportace zahajena... +teleportationDisabled=\u00a77Teleportace zakazana. +teleportationEnabled=\u00a77Teleportace povolena. +teleporting=\u00a77Teleportuji... +teleportingPortal=\u00a77Teleportuji pres portal. +tempBanned=Docasne zabanovany na dobu {0} +tempbanExempt=\u00a77Nemel by jsi docasne zabanovat tohoto hrace. +thunder= Nastavil jsi {0} bouri ve tvem svete. +thunderDuration=Nastavil jsi {0} bouri ve svete po {1} sekund. +timeBeforeHeal=Potrebny cas pro dalsi uzdraveni: {0} +timeBeforeTeleport=Potrebny cas pro dalsi teleport: {0} +timeFormat=\u00a73{0}\u00a7f nebo \u00a73{1}\u00a7f nebo \u00a73{2}\u00a7f +timePattern=(?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? +timeSet=Cas nastaven ve vsech svetech. +timeSetPermission=\u00a7cNejsi autorizovany ke zmene casu. +timeWorldCurrent=Ve svete {0} je prave \u00a73{1} +timeWorldSet=Cas byl nastaven na {0} ve: \u00a7c{1} +tradeCompleted=\u00a77Vymena kompletni. +tradeSignEmpty=Tato cedule jiz nema dostupny material na vymenu. +tradeSignEmptyOwner=Na teto ceduli dosel material. +treeFailure=\u00a7cNepodarilo se vytvorit strom. Zkus to znovu na trave nebo hline. +treeSpawned=\u00a77Strom vytvoren. +true=pravda +typeTpaccept=\u00a77Pro prijmuti zadosti napis \u00a7c/tpaccept\u00a77. +typeTpdeny=\u00a77Pokud chces odmitnout zadost napis \u00a7c/tpdeny\u00a77. +typeWorldName=\u00a77Muzes take napsat specificky nazev sveta. +unableToSpawnMob=Nemozne spawnout moba. +unbannedIP=Unbanovana IP adresa. +unbannedPlayer=Hrac odbanovan. +unignorePlayer=Prestal jsi ignorovat hrace {0}. +unknownItemId=Nezname ID itemu: {0} +unknownItemInList=Neznamy item {0} v {1} seznamu. +unknownItemName=Neznamy nazev itemu: {0} +unlimitedItemPermission=\u00a7cNemas opravneni pro neomezeny item: {0}. +unlimitedItems=Neomezene itemy: +unmutedPlayer=Hrac {0} byl umlcen. +upgradingFilesError=Chyba pri updatovani souboru. +userDoesNotExist=Uzivatel {0} neexistuje. +userIsAway={0} je AFK. +userIsNotAway={0} se vratil. +userJailed=\u00a77Byl jsi uveznen. +userUsedPortal={0} pouzil portal pro vychod. +userdataMoveBackError=Chyba pri pokusu o presun userdata/{0}.tmp do userdata/{1} +userdataMoveError=Chyba pri pokusu o presun userdata/{0} do userdata/{1}.tmp +usingTempFolderForTesting=Pouzivam docasnou slozku pro testovani: +versionMismatch=Chyba verzi! Prosim updatuj {0} na stejnou verzi. +versionMismatchAll=Chyba verzi! Prosim, updatuj vsechny Essentials .jar na stejnou verzi. +voiceSilenced=\u00a77Byl jsi ztisen. +warpDeleteError=Vyskytl se problem pri mazani warpu. +warpListPermission=\u00a7cNemas opravneni listovat warpami. +warpNotExist=Tento warp neexistuje. +warpOverwrite=\u00a7cNemuzes prepsat tento warp. +warpSet=\u00a77Warp {0} vytvoren. +warpUsePermission=\u00a7cNemas opravneni pouzit tento warp. +warpingTo=\u00a77Warpuji te do {0}. +warps=Warpy: {0} +warpsCount=\u00a77Mame zde {0} warpu. Strana {1} z {2}. +weatherStorm=\u00a77Nastavil jsi bourku v {0} +weatherStormFor=\u00a77Nastavil jsi bourku v {0} na {1} sekund. +weatherSun=\u00a77Nastavil jsi slunecne pocasi v {0} +weatherSunFor=\u00a77Nastavil jsi slunecne pocasi v {0} na {1} sekund +whoisBanned=\u00a79 - Zabanovan: {0} +whoisExp=\u00a79 - Exp: {0} (Uroven {1}) +whoisGamemode=\u00a79 - Herni mod: {0} +whoisGeoLocation=\u00a79 - Puvod: {0} +whoisGod=\u00a79 - God mode: {0} +whoisHealth=\u00a79 - Zdravi: {0}/20 +whoisIPAddress=\u00a79 - IP Adresa: {0} +whoisIs={0} je {1} +whoisJail=\u00a79 - Jail: {0} +whoisLocation=\u00a79 - Pozice: ({0}, {1}, {2}, {3}) +whoisMoney=\u00a79 - Penize: {0} +whoisOP=\u00a79 - OP: {0} +whoisStatusAvailable=\u00a79 - Status: Pritomny +whoisStatusAway=\u00a79 - Status: \u00a7cPryc\u00a7f +worth=\u00a77Stack {0} ceny \u00a7c{1}\u00a77 ({2} kus(u) za {3} kus) +worthMeta=\u00a77Stack {0} s metadaty {1} ceny \u00a7c{2}\u00a77 ({3} kus(u) za {4} kus) +worthSet=Hodnota ceny nastavena +year=rok +years=roky +youAreHealed=\u00a77Byl jsi uzdraven. +youHaveNewMail=\u00a7cMas {0} zprav!\u00a7f Napis \u00a77/mail read\u00a7f aby jsi si precetl sve zpravy. +currentWorld=Current World: {0} +kickedAll=\u00a7cKicked all players from server +exp=\u00a7c{0} \u00a77has\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) and needs\u00a7c {3} \u00a77more exp to level up. +expSet=\u00a7c{0} \u00a77now has\u00a7c {1} \u00a77exp. +unvanished=\u00a7aYou are once again visible. +unvanishedReload=\u00a7cA reload has forced you to become visible. +vanished=\u00a7aYou have now been vanished. +tps=Current TPS = {0} +hatPlaced=\u00a7eEnjoy your new hat! +hatFail=\u00a7cYou must have something to wear in your hand. +hatArmor=\u00a7cError, you cannot use armor as a hat! diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index 698388590..380f04ced 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -1,4 +1,4 @@ -#version: ${build.number} +#version: TeamCity # Single quotes have to be doubled: '' # Translations start here # by: Dysp, dysperen@gmail.com @@ -12,6 +12,7 @@ alertUsed=brugte: 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. +backupDisabled=An external backup script has not been configured. backupFinished=Backup sluttet backupStarted=Backup startet balance=\u00a77Saldo: {0} @@ -50,6 +51,7 @@ creatingConfigFromTemplate=Opretter config fra skabelon: {0} creatingEmptyConfig=Opretter tom config: {0} creative=creative currency={0}{1} +currentWorld=Current World: {0} day=dag days=dage defaultBanReason=Banhammeren har talt! @@ -92,6 +94,7 @@ false=false feed=\u00a77Your appetite was sated. feedOther=\u00a77Satisfied {0}. fileRenameError=Omd\u00c3\u00b8bning af fil {0} fejlede. +flyMode=\u00a77Set fly mode {0} for {1}. foreverAlone=\u00a7cDu har ingen til hvem du kan svare. freedMemory=Frigjorde {0} MB. gameMode=\u00a77Satte game mode {0} for {1}. @@ -110,9 +113,12 @@ haveBeenReleased=\u00a77Du er blevet l\u00f8sladt heal=\u00a77Du er blevet healed. healOther=\u00a77Healed {0}. helpConsole=For at se hj\u00e6lp fra konsolen, skriv ?. +helpFrom=\u00a77Commands from {0}: helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Commands matching "{0}": helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} helpPages=Side \u00a7c{0}\u00a7f af \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Plugin Help: /help {1} holeInFloor=Hul i gulv homeSet=\u00a77Hjem sat. homeSetToBed=\u00a77Dit hjem er nu sat til denne seng. @@ -124,7 +130,7 @@ illegalDate=Forkert datoformat. infoChapter=V\u00e6lg kapitel: infoChapterPages=Kapitel {0}, side \u00a7c{1}\u00a7f af \u00a7c{2}\u00a7f: infoFileDoesNotExist=Fil info.txt eksisterer ikke. Fixer liiige en for dig. -infoPages=Side \u00a7c{0}\u00a7f af \u00a7c{1}\u00a7f: +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Side \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- infoUnknownChapter=Ukendt kapitel. invBigger=Den anden brugers inventory er st\u00f8rre end din. invRestored=Din inventory er blevet genoprettet. @@ -157,6 +163,7 @@ 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. +kickedAll=\u00a7cKicked all players from server kickDefault=Kicked fra serveren. kickExempt=\u00a77Du kan ikke kicke denne spiller. kill=\u00a77dr\u00e6bte {0}. @@ -164,7 +171,7 @@ 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?). -InvFull=\u00a7cYour inventory was full, dropping items on the floor +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) @@ -205,7 +212,6 @@ mutedPlayer=Spiller {0} muted. mutedPlayerFor=Spiller {0} muted i {1}. mutedUserSpeaks={0} pr\u00f8vede at snakke, men er muted. 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. @@ -299,11 +305,10 @@ requestDenied=\u00a77Anmodning om teleport afvist. requestDeniedFrom=\u00a77{0} afviste din anmodning om teleport. requestSent=\u00a77Anmodning sendt til {0}\u00a77. requestTimedOut=\u00a7cTeleport request has timed out -requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. +requiredBukkit= * ! * You need atleast build {0} of CraftBukkit, download it from http://dl.bukkit.org/downloads/craftbukkit/ returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1} second=sekund seconds=sekunder -seenBanReason=Reason: {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. @@ -334,7 +339,6 @@ 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. -teleportRequestsCancelledWorldChange=\u00a77Pending teleport requests have been cancelled on world change. teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds. teleportTop=\u00a77Teleporterer til toppen. teleportationCommencing=\u00a77Teleport begynder... @@ -388,17 +392,18 @@ 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. +warpOverwrite=\u00a7cYou cannot overwrite that warp. warpSet=\u00a77Warp {0} sat. warpUsePermission=\u00a7cDu har ikke tilladelse til at benytte den warp. warpingTo=\u00a77Warper til {0}. warps=Warps: {0} warpsCount=\u00a77Der er {0} warps. Viser side {1} af {2}. -warpOverwrite=\u00a7cYou cannot overwrite that warp. 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} +whoisExp=\u00a79 - Exp: {0} (Level {1}) whoisGamemode=\u00a79 - Gamemode: {0} whoisGeoLocation=\u00a79 - Placering: {0} whoisGod=\u00a79 - God mode: {0} @@ -418,4 +423,12 @@ year=\u00e5r years=\u00e5r youAreHealed=\u00a77Du er blevet healed. Halleluja! youHaveNewMail=\u00a7cDu har {0} flaskeposter!\u00a7f Type \u00a77/mail read for at se din flaskepost. - +exp=\u00a7c{0} \u00a77has\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) and needs\u00a7c {3} \u00a77more exp to level up. +expSet=\u00a7c{0} \u00a77now has\u00a7c {1} \u00a77exp. +unvanished=\u00a7aYou are once again visible. +unvanishedReload=\u00a7cA reload has forced you to become visible. +vanished=\u00a7aYou have now been vanished. +tps=Current TPS = {0} +hatPlaced=\u00a7eEnjoy your new hat! +hatFail=\u00a7cYou must have something to wear in your hand. +hatArmor=\u00a7cError, you cannot use armor as a hat! diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 18df0260b..5558ab978 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -1,4 +1,4 @@ -#version: ${build.number} +#version: TeamCity # Single quotes have to be doubled: '' # Translations start here # by: @@ -12,6 +12,7 @@ alertUsed=benutzt: autoAfkKickReason=Du wurdest gekickt, weil du f\u00fcr {0} Minuten inaktiv warst. backAfterDeath=\u00a77Benutze den Befehl /back um zu deinem Todespunkt zur\u00fcck zu kehren. backUsageMsg=\u00a77Kehre zur letzten Position zur\u00fcck. +backupDisabled=An external backup script has not been configured. backupFinished=Backup beendet backupStarted=Backup gestartet balance=\u00a77Geldb\u00f6rse: {0} @@ -50,6 +51,7 @@ creatingConfigFromTemplate=Erstelle Konfiguration aus Vorlage: {0} creatingEmptyConfig=Erstelle leere Konfiguration: {0} creative=creative currency={0}{1} +currentWorld=Current World: {0} day=Tag days=Tage defaultBanReason=Der Bann-Hammer hat gesprochen! @@ -92,6 +94,7 @@ false=false feed=\u00a77Your appetite was sated. feedOther=\u00a77Satisfied {0}. fileRenameError=Umbenennen von {0} gescheitert. +flyMode=\u00a77Set fly mode {0} for {1}. foreverAlone=\u00a7cDu hast niemanden, dem du antworten kannst. freedMemory={0} MB frei gemacht. gameMode=\u00a77Set game mode {0} for {1}. @@ -110,9 +113,12 @@ haveBeenReleased=\u00a77Du wurdest frei gelassen. heal=\u00a77Du wurdest geheilt. healOther=\u00a77{0} geheilt. helpConsole=Um die Hilfe der Konsole zu sehen, schreibe ?. +helpFrom=\u00a77Commands from {0}: helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Commands matching "{0}": helpOp=\u00a7c[Hilfe]\u00a7f \u00a77{0}:\u00a7f {1} helpPages=Seite \u00a7c{0}\u00a7f von \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Plugin Help: /help {1} holeInFloor=Loch im Boden homeSet=\u00a77Zuhause gesetzt. homeSetToBed=\u00a77Dein Zuhause ist nun an diesem Bett. @@ -124,10 +130,9 @@ illegalDate=Ung\u00fcltiges Datumsformat. infoChapter=W\u00e4hle Kapitel: infoChapterPages=Kapitel {0}, Seite \u00a7c{1}\u00a7f von \u00a7c{2}\u00a7f: infoFileDoesNotExist=Datei info.txt existiert nicht. Erzeuge eine neue Datei. -infoPages=Seite \u00a7c{0}\u00a7f von \u00a7c{1}\u00a7f: +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Seite \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- infoUnknownChapter=Unbekanntes Kapitel: invBigger=Das andere Inventar ist gr\u00f6sser als deins. -InvFull=\u00a7cYour inventory was full, dropping items on the floor invRestored=Dein Inventar wurde wieder hergestellt. invSee=Du siehst das Inventar von {0}. invSeeHelp=Benutze /invsee um dein Inventar wiederherzustellen. @@ -158,6 +163,7 @@ jailReleasedPlayerNotify=\u00a77Du wurdest freigelassen! jailSentenceExtended=Gef\u00e4ngnisszeit erweitert auf: {0) jailSet=\u00a77Gef\u00e4ngnis {0} wurde erstellt. jumpError=Das w\u00fcrde deinen Computer \u00fcberlasten. +kickedAll=\u00a7cKicked all players from server kickDefault=Vom Server geworfen kickExempt=\u00a7cDu kannst diesen Spieler nicht rauswerfen. kill=\u00a77{0} get\u00f6tet. @@ -165,6 +171,7 @@ 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 kitTimed=\u00a7cDu kannst diese Ausr\u00fcstung nicht innerhalb von {0} anfordern. kits=\u00a77Ausr\u00fcstungen: {0} lightningSmited=\u00a77Du wurdest gepeinigt. @@ -205,7 +212,6 @@ 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. nickDisplayName=\u00a77Du musst \u00a7fchange-displayname\u00a7c in der Essentials-Config aktivieren. @@ -299,11 +305,10 @@ requestDenied=\u00a77Teleportierungsanfrage verweigert. requestDeniedFrom=\u00a77{0} hat deine Teleportierungsanfrage abgelehnt. requestSent=\u00a77Anfrage gesendet an {0}\u00a77. requestTimedOut=\u00a7cTeleport request has timed out -requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. +requiredBukkit= * ! * You need atleast build {0} of CraftBukkit, download it from http://dl.bukkit.org/downloads/craftbukkit/ returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1} second=Sekunde seconds=Sekunden -seenBanReason=Reason: {0} seenOffline=Spieler {0} ist offline seit {1} seenOnline=Spieler {0} ist online seit {1} serverFull=Server ist voll @@ -334,7 +339,6 @@ teleportDisabled={0} verweigert die Teleportierung. teleportHereRequest=\u00a7c{0}\u00a7c fragt, ob du dich zu ihm teleportierst. teleportNewPlayerError=Fehler beim Teleportieren eines neuen Spielers teleportRequest=\u00a7c{0}\u00a7c fragt, ob er sich zu dir teleportieren darf. -teleportRequestsCancelledWorldChange=\u00a77Pending teleport requests have been cancelled on world change. teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds. teleportTop=\u00a77Teleportiere nach oben. teleportationCommencing=\u00a77Teleportierung gestartet... @@ -388,17 +392,18 @@ voiceSilenced=\u00a77Du bist stumm warpDeleteError=Fehler beim L\u00f6schen der Warp-Datei. warpListPermission=\u00a7cDu hast keine Berechtigung, die Warp-Punkte anzuzeigen. warpNotExist=Warp-Punkt existiert nicht. +warpOverwrite=\u00a7cYou cannot overwrite that warp. warpSet=\u00a77Warp-Punkt {0} wurde erstellt. warpUsePermission=\u00a7cDu hast keinen Zugriff f\u00fcr diesen Warp-Punkt. warpingTo=\u00a77Teleportiere zu Warp-Punkt {0}. warps=Warps: {0} warpsCount=\u00a77Es gibt {0} Warp-Punkte. Zeige Seite {1} von {2}. -warpOverwrite=\u00a7cYou cannot overwrite that warp. 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} +whoisExp=\u00a79 - Exp: {0} (Level {1}) whoisGamemode=\u00a79 - Gamemode: {0} whoisGeoLocation=\u00a79 - Herkunft: {0} whoisGod=\u00a79 - God mode: {0} @@ -418,3 +423,12 @@ year=Jahr years=Jahre youAreHealed=\u00a77Du wurdest geheilt. youHaveNewMail=\u00a7cDu hast {0} Nachrichten!\u00a7f Schreibe \u00a77/mail read\u00a7f um deine Nachrichten anzuzeigen. +exp=\u00a7c{0} \u00a77has\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) and needs\u00a7c {3} \u00a77more exp to level up. +expSet=\u00a7c{0} \u00a77now has\u00a7c {1} \u00a77exp. +unvanished=\u00a7aYou are once again visible. +unvanishedReload=\u00a7cA reload has forced you to become visible. +vanished=\u00a7aYou have now been vanished. +tps=Current TPS = {0} +hatPlaced=\u00a7eEnjoy your new hat! +hatFail=\u00a7cYou must have something to wear in your hand. +hatArmor=\u00a7cError, you cannot use armor as a hat! diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 478bc9713..ea765213f 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -1,4 +1,4 @@ -#version: ${build.number} +#version: TeamCity # Single quotes have to be doubled: '' # Translations start here # by: @@ -12,6 +12,7 @@ alertUsed=used: autoAfkKickReason=You have been kicked for idling more than {0} minutes. backAfterDeath=\u00a77Use the /back command to return to your death point. backUsageMsg=\u00a77Returning to previous location. +backupDisabled=An external backup script has not been configured. backupFinished=Backup finished backupStarted=Backup started balance=\u00a77Balance: {0} @@ -30,7 +31,7 @@ buildAlert=\u00a7cYou are not permitted to build bukkitFormatChanged=Bukkit version format changed. Version not checked. burnMsg=\u00a77You set {0} on fire for {1} seconds. canTalkAgain=\u00a77You can talk again -cantFindGeoIpDB=Can''t find GeoIP database! +cantFindGeoIpDB=Can't find GeoIP database! cantReadGeoIpDB=Failed to read GeoIP database! cantSpawnItem=\u00a7cYou are not allowed to spawn the item {0} chatTypeLocal=[L] @@ -50,6 +51,7 @@ creatingConfigFromTemplate=Creating config from template: {0} creatingEmptyConfig=Creating empty config: {0} creative=creative currency={0}{1} +currentWorld=Current World: {0} day=day days=days defaultBanReason=The Ban Hammer has spoken! @@ -83,6 +85,8 @@ 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} +exp=\u00a7c{0} \u00a77has\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) and needs\u00a7c {3} \u00a77more exp to level up. +expSet=\u00a7c{0} \u00a77now has\u00a7c {1} \u00a77exp. extinguish=\u00a77You extinguished yourself. extinguishOthers=\u00a77You extinguished {0}. failedToCloseConfig=Failed to close config {0} @@ -92,6 +96,7 @@ false=false feed=\u00a77Your appetite was sated. feedOther=\u00a77Satisfied {0}. fileRenameError=Renaming file {0} failed +flyMode=\u00a77Set fly mode {0} for {1}. foreverAlone=\u00a7cYou have nobody to whom you can reply. freedMemory=Freed {0} MB. gameMode=\u00a77Set game mode {0} for {1}. @@ -106,13 +111,18 @@ geoipJoinFormat=Player {0} comes from {1} godDisabledFor=disabled for {0} godEnabledFor=enabled for {0} godMode=\u00a77God mode {0}. +hatPlaced=\u00a7eEnjoy your new hat! +hatFail=\u00a7cYou must have something to wear in your hand. haveBeenReleased=\u00a77You have been released heal=\u00a77You have been healed. healOther=\u00a77Healed {0}. helpConsole=To view help from the console, type ?. +helpFrom=\u00a77Commands from {0}: helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Commands matching "{0}": helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} helpPages=Page \u00a7c{0}\u00a7f of \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Plugin Help: /help {1} holeInFloor=Hole in floor homeSet=\u00a77Home set. homeSetToBed=\u00a77Your home is now set to this bed. @@ -124,14 +134,14 @@ illegalDate=Illegal date format. infoChapter=Select chapter: infoChapterPages=Chapter {0}, page \u00a7c{1}\u00a7f of \u00a7c{2}\u00a7f: infoFileDoesNotExist=File info.txt does not exist. Creating one for you. -infoPages=Page \u00a7c{0}\u00a7f of \u00a7c{1}\u00a7f: +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Page \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- infoUnknownChapter=Unknown chapter. invBigger=The other users inventory is bigger than yours. invRestored=Your inventory has been restored. invSee=You see the inventory of {0}. invSeeHelp=Use /invsee to restore your inventory. invalidCharge=\u00a7cInvalid charge. -invalidHome=Home {0} doesn't exist +invalidHome=Home {0} doesn''t exist invalidMob=Invalid mob type. invalidServer=Invalid server! invalidSignLine=Line {0} on sign is invalid. @@ -156,7 +166,8 @@ jailReleased=\u00a77Player \u00a7e{0}\u00a77 unjailed. jailReleasedPlayerNotify=\u00a77You have been released! jailSentenceExtended=Jail time extend to: {0) jailSet=\u00a77Jail {0} has been set -jumpError=That would hurt your computer''s brain. +jumpError=That would hurt your computer's brain. +kickedAll=\u00a7cKicked all players from server kickDefault=Kicked from server kickExempt=\u00a7cYou can not kick that person. kill=\u00a77Killed {0}. @@ -164,10 +175,10 @@ 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}. -InvFull=\u00a7cYour inventory was full, dropping items on the floor +kitInvFull=\u00a7cYour inventory was full, placing kit on the floor kitTimed=\u00a7cYou can''t use that kit again for another {0}. kits=\u00a77Kits: {0} -lightningSmited=\u00a77You have just been smited +lightningSmited=\u00a77Thou hast been smitten lightningUse=\u00a77Smiting {0} listAfkTag = \u00a77[AFK]\u00a7f listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online. @@ -205,7 +216,6 @@ 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. nickDisplayName=\u00a77You have to enable change-displayname in Essentials config. @@ -229,7 +239,7 @@ 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. +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. @@ -252,7 +262,7 @@ 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. +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} @@ -272,7 +282,7 @@ playerNotFound=\u00a7cPlayer not found. playerUnmuted=\u00a77You have been unmuted pong=Pong! possibleWorlds=\u00a77Possible worlds are the numbers 0 through {0}. -powerToolAir=Command can''t be attached to air. +powerToolAir=Command can't be attached to air. powerToolAlreadySet=Command \u00a7c{0}\u00a7f is already assigned to {1}. powerToolAttach=\u00a7c{0}\u00a7f command assigned to {1}. powerToolClearAll=All powertool commands have been cleared. @@ -299,11 +309,10 @@ requestDenied=\u00a77Teleport request denied. requestDeniedFrom=\u00a77{0} denied your teleport request. requestSent=\u00a77Request sent to {0}\u00a77. requestTimedOut=\u00a7cTeleport request has timed out -requiredBukkit= * ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. +requiredBukkit= * ! * You need atleast build {0} of CraftBukkit, download it from http://dl.bukkit.org/downloads/craftbukkit/ returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1} second=second seconds=seconds -seenBanReason=Reason: {0} seenOffline=Player {0} is offline since {1} seenOnline=Player {0} is online since {1} serverFull=Server is full @@ -334,7 +343,6 @@ teleportDisabled={0} has teleportation disabled. teleportHereRequest=\u00a7c{0}\u00a7c has requested that you teleport to them. teleportNewPlayerError=Failed to teleport new player teleportRequest=\u00a7c{0}\u00a7c has requested to teleport to you. -teleportRequestsCancelledWorldChange=\u00a77Pending teleport requests have been cancelled on world change. teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds. teleportTop=\u00a77Teleporting to top. teleportationCommencing=\u00a77Teleportation commencing... @@ -360,6 +368,7 @@ tradeSignEmptyOwner=There is nothing to collect from this trade sign. treeFailure=\u00a7cTree generation failure. Try again on grass or dirt. treeSpawned=\u00a77Tree spawned. true=true +tps=Current TPS = {0} typeTpaccept=\u00a77To teleport, type \u00a7c/tpaccept\u00a77. typeTpdeny=\u00a77To deny this request, type \u00a7c/tpdeny\u00a77. typeWorldName=\u00a77You can also type the name of a specific world. @@ -373,6 +382,8 @@ unknownItemName=Unknown item name: {0} unlimitedItemPermission=\u00a7cNo permission for unlimited item {0}. unlimitedItems=Unlimited items: unmutedPlayer=Player {0} unmuted. +unvanished=\u00a7aYou are once again visible. +unvanishedReload=\u00a7cA reload has forced you to become visible. upgradingFilesError=Error while upgrading the files userDoesNotExist=The user {0} does not exist. userIsAway={0} is now AFK @@ -382,23 +393,25 @@ userUsedPortal={0} used an existing exit portal. userdataMoveBackError=Failed to move userdata/{0}.tmp to userdata/{1} userdataMoveError=Failed to move userdata/{0} to userdata/{1}.tmp usingTempFolderForTesting=Using temp folder for testing: +vanished=\u00a7aYou have now been vanished. 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 warps. warpNotExist=That warp does not exist. +warpOverwrite=\u00a7cYou cannot overwrite that warp. warpSet=\u00a77Warp {0} set. warpUsePermission=\u00a7cYou do not have Permission to use that warp. warpingTo=\u00a77Warping to {0}. warps=Warps: {0} warpsCount=\u00a77There are {0} warps. Showing page {1} of {2}. -warpOverwrite=\u00a7cYou cannot overwrite that warp. 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} +whoisExp=\u00a79 - Exp: {0} (Level {1}) whoisGamemode=\u00a79 - Gamemode: {0} whoisGeoLocation=\u00a79 - Location: {0} whoisGod=\u00a79 - God mode: {0} @@ -418,3 +431,4 @@ year=year years=years youAreHealed=\u00a77You have been healed. youHaveNewMail=\u00a7cYou have {0} messages!\u00a7f Type \u00a77/mail read\u00a7f to view your mail. +hatArmor=\u00a7cError, you cannot use armor as a hat! diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index d334f7330..56016f96e 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -1,4 +1,4 @@ -#version: ${build.number} +#version: TeamCity # Single quotes have to be doubled: '' # Translations start here # by: @@ -12,6 +12,7 @@ alertUsed=usado: autoAfkKickReason=Has sido echado por ausentarte mas de {0} minutos. backAfterDeath=\u00a77Usa el comando /back para volver al punto en el que moriste. backUsageMsg=\u00a77Volviendo a la localizacion anterior. +backupDisabled=An external backup script has not been configured. backupFinished=Copia de seguridad completada backupStarted=Comenzando copia de seguridad balance=\u00a77Cantidad: {0} @@ -50,6 +51,7 @@ creatingConfigFromTemplate=Creando configuracion desde el template: {0} creatingEmptyConfig=Creando configuracion vacia: {0} creative=creative currency={0}{1} +currentWorld=Current World: {0} day=dia days=dias defaultBanReason=Baneado por incumplir las normas! @@ -92,6 +94,7 @@ false=false feed=\u00a77Your appetite was sated. feedOther=\u00a77Satisfied {0}. fileRenameError=Error al renombrar el archivo {0} +flyMode=\u00a77Set fly mode {0} for {1}. foreverAlone=\u00a7cNo tienes nadie a quien puedas responder. freedMemory= {0} MB libres. gameMode=\u00a77Set game mode {0} for {1}. @@ -110,9 +113,12 @@ haveBeenReleased=\u00a77Has sido liberado heal=\u00a77Has sido curado. healOther=\u00a77Has curado a {0}. helpConsole=Para obtener ayuda de la consola, escribe ?. +helpFrom=\u00a77Commands from {0}: helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Commands matching "{0}": helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} helpPages=Pagina \u00a7c{0}\u00a7f de \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Plugin Help: /help {1} holeInFloor=Agujero en el suelo homeSet=\u00a77Hogar establecido. homeSetToBed=\u00a77Tu hogar esta ahora establecido a esta cama. @@ -124,7 +130,7 @@ illegalDate=Forma de fecha ilegal. infoChapter=Selecciona una seccion: infoChapterPages=Seccion {0}, pagina \u00a7c{1}\u00a7f of \u00a7c{2}\u00a7f: infoFileDoesNotExist=El archivo info.txt no existe. Creando uno para ti. -infoPages=Pagina \u00a7c{0}\u00a7f de \u00a7c{1}\u00a7f: +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Pagina \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- infoUnknownChapter=Seccion desconocida. invBigger=El inventario del otro usuario es mas grande que el tuyo invRestored=Tu inventario ha sido recuperado. @@ -157,6 +163,7 @@ jailReleasedPlayerNotify=\u00a77 Has sido liberado!! jailSentenceExtended=El tiempo en la carcel se alarga hasta: {0) jailSet=\u00a77Carcel {0} ha sido puesta jumpError=Eso es demasiado para tu ordenador! +kickedAll=\u00a7cKicked all players from server kickDefault=Echado del servidor. kickExempt=\u00a7cNo puedes echar a esa persona. kill=\u00a77ha matado a {0}. @@ -164,7 +171,7 @@ 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}. -InvFull=\u00a7cYour inventory was full, dropping items on the floor +kitInvFull=\u00a7cTu inventario esta lleno, su kit se pondra en el suelo kitTimed=\u00a7c No puedes usar ese kit de nuevo para otro{0}. kits=\u00a77Kits: {0} lightningSmited=\u00a77Acabas de ser golpeado @@ -205,7 +212,6 @@ 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. nickDisplayName=\u00a77Tienes que habilitar cambio de nombre de usuario en la configuracion de Essentials. @@ -299,11 +305,10 @@ requestDenied=\u00a77Peticion de teletransporte denegada. requestDeniedFrom=\u00a77{0} ha denegado tu peticion de teletransporte. requestSent=\u00a77Peticion enviada a {0}\u00a77. requestTimedOut=\u00a7cTeleport request has timed out -requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. +requiredBukkit= * ! * You need atleast build {0} of CraftBukkit, download it from http://dl.bukkit.org/downloads/craftbukkit/ returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1} second=segundo seconds=segundos -seenBanReason=Reason: {0} seenOffline=El jugador {0} esta desconectado desde {1} seenOnline=El jugador {0} lleva conectado desde {1} serverFull=Servidor lleno @@ -334,7 +339,6 @@ teleportDisabled={0} tiene desactivado los teletransportes. teleportHereRequest=\u00a7c{0}\u00a7c ha pedido que te teletransportes con el. teleportNewPlayerError=Error al teletransportar al nuevo jugador teleportRequest=\u00a7c{0}\u00a7c te ha pedido teletransportarse contigo. -teleportRequestsCancelledWorldChange=\u00a77Pending teleport requests have been cancelled on world change. teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds. teleportTop=\u00a77Teletransportandote a la cima. teleportationCommencing=\u00a77Comenzando teletransporte... @@ -388,17 +392,18 @@ voiceSilenced=\u00a77Tu voz ha sido silenciada warpDeleteError=Problema al borrar el archivo de teletransporte. warpListPermission=\u00a7cNo tienes permiso para listar esos teletransportes. warpNotExist=Ese teletransporte no existe. +warpOverwrite=\u00a7cYou cannot overwrite that warp. warpSet=\u00a77Teletransporte {0} establecido. warpUsePermission=\u00a7cNo tienes permisos para usar ese teletransporte. warpingTo=\u00a77Teletransportandote a {0}. warps=Warps: {0} warpsCount=\u00a77Hay {0} teletransportes. Mostrando pagina {1} de {2}. -warpOverwrite=\u00a7cYou cannot overwrite that warp. 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} +whoisExp=\u00a79 - Exp: {0} (Level {1}) whoisGamemode=\u00a79 - Gamemode: {0} whoisGeoLocation=\u00a79 - Localizacion: {0} whoisGod=\u00a79 - God mode: {0} @@ -418,3 +423,12 @@ year=año years=años youAreHealed=\u00a77Has sido curado. youHaveNewMail=\u00a7cTienes {0} mensajes!\u00a7f Pon \u00a77/mail read\u00a7f para ver tus emails no leidos!. +exp=\u00a7c{0} \u00a77has\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) and needs\u00a7c {3} \u00a77more exp to level up. +expSet=\u00a7c{0} \u00a77now has\u00a7c {1} \u00a77exp. +unvanished=\u00a7aYou are once again visible. +unvanishedReload=\u00a7cA reload has forced you to become visible. +vanished=\u00a7aYou have now been vanished. +tps=Current TPS = {0} +hatPlaced=\u00a7eEnjoy your new hat! +hatFail=\u00a7cYou must have something to wear in your hand. +hatArmor=\u00a7cError, you cannot use armor as a hat! diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties new file mode 100644 index 000000000..19659a76a --- /dev/null +++ b/Essentials/src/messages_it.properties @@ -0,0 +1,434 @@ +#version: TeamCity +# Single quotes have to be doubled: '' +# Translations start here +# by: +action=* {0} {1} +addedToAccount=\u00a7a{0} e'' stato aggiunto al tuo account. +addedToOthersAccount=\u00a7a{0} e'' stato aggiunto all''account {1}\u00a7a. Nuovo bilancio: {2} +alertBroke=fallito: +alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} a: {3} +alertPlaced=collocato: +alertUsed=usato: +autoAfkKickReason=Sei stato kickato per inattivita'' oltre i {0} minuti. +backAfterDeath=\u00a77Digita il comando /back per tornare al punto dove sei morto. +backUsageMsg=\u00a77Ritorna alla posizione precedente. +backupDisabled=Un script di backup esterno non e'' stato configurato. +backupFinished=Backup terminato +backupStarted=Backup iniziato +balance=\u00a77Bilancio: {0} +balanceTop=\u00a77Top bilanci ({0}) +banExempt=\u00a7cNon puoi bannare questo player. +banIpAddress=\u00a77IP address bannato +bannedIpsFileError=Errore di lettura banned-ips.txt +bannedIpsFileNotFound=banned-ips.txt non trovato +bannedPlayersFileError=Errore di lettura banned-players.txt +bannedPlayersFileNotFound=banned-players.txt non trovato +bigTreeFailure=\u00a7cCreazione del grande albero fallita. Riprova sull''erba o sul terreno. +bigTreeSuccess= \u00a77Grande albero creato. +blockList=Essentials ha trasmesso i seguenti comandi ad un altro plugin: +broadcast=[\u00a7cBroadcast\u00a7f]\u00a7a {0} +buildAlert=\u00a7cNon hai i permessi per costruire +bukkitFormatChanged=Il formato della versione Bukkit e'' cambiato. Versione non controllata. +burnMsg=\u00a77Hai impostato{0} infuocato per {1} secondi. +canTalkAgain=\u00a77Ora puoi parlare di nuovo +cantFindGeoIpDB=Non trovo il database GeoIP! +cantReadGeoIpDB=Lettura fallita del database GeoIP! +cantSpawnItem=\u00a7cNon sei abilitato a generare l''oggetto {0} +chatTypeLocal=[L] +chatTypeSpy=[Spy] +commandFailed=Comando {0} fallito: +commandHelpFailedForPlugin=Errore nella guida di: {0} +commandNotLoaded=\u00a7cIl comando {0} non e'' stato caricato correttamente. +compassBearing=\u00a77Bussola: {0} ({1} gradi). +configFileMoveError=Impossibile spostare config.yml nel backup. +configFileRenameError=Impossibile rinominare il file temporale in config.yml +connectedPlayers=Players connessi: +connectionFailed=Connessione fallita. +cooldownWithMessage=\u00a7cIn esaurimento: {0} +corruptNodeInConfig=\u00a74Avviso: errore nel tuo file di configurazione, nodo {0}. +couldNotFindTemplate=Non trovo il template {0} +creatingConfigFromTemplate=Configurazione dal template: {0} +creatingEmptyConfig=Configurazione vuota creata: {0} +creative=creativo +currency={0}{1} +currentWorld=Current World: {0} +day=giorno +days=giorni +defaultBanReason=Sei stato bannato! +deleteFileError=Impossibile eliminare il file: {0} +deleteHome=\u00a77La home {0} e'' stata rimossa. +deleteJail=\u00a77La prigione {0} e'' stata rimossa. +deleteWarp=\u00a77Il Warp {0} e'' stato rimosso. +deniedAccessCommand={0} Accesso negato al comando. +dependancyDownloaded=[Essentials] Dependancy {0} download effettuato con successo. +dependancyException=[Essentials] Errore durante il download di una dependacy +dependancyNotFound=[Essentials] Una dependancy necessaria non e'' stata trovata, sto effettuando il download.. +depth=\u00a77Sei al livello del mare. +depthAboveSea=\u00a77Sei {0} blocco(i) sopra il livello del mare. +depthBelowSea=\u00a77Sei {0} blocco(i) sotto il livello del mare. +destinationNotSet=Destinazione non impostata +disableUnlimited=\u00a77Collocazione illimitata di {0} per {1} disabilitata. +disabled=disabilitato +disabledToSpawnMob=La creazione di questo mob e'' stata disabilitata nel file config. +dontMoveMessage=\u00a77Il teletrasporto iniziera'' tra {0}. Attendi. +downloadingGeoIp=Download del database GeoIP... potrebbe richiedere del tempo (nazione: 0.6 MB, citta'': 20MB) +duplicatedUserdata=Dati dell''utente duplicati: {0} e {1} +enableUnlimited=\u00a77Sto inviando una quantita'' illimitata di {0} a {1}. +enabled=abilitato +enchantmentApplied = \u00a77L''incantesimo {0} e'' stato applicato all''oggetto nelle tue mani. +enchantmentNotFound = \u00a7cIncantesimo non trovato +enchantmentPerm = \u00a7cNon hai il permesso per {0} +enchantmentRemoved = \u00a77L''incantesimo {0} e'' stato rimosso dall''oggetto nelle tue mani. +enchantments = \u00a77Incantesimi: {0} +errorCallingCommand=Errore di chiamata del comando /{0} +errorWithMessage=\u00a7cErrore: {0} +essentialsHelp1=File corrotto.. Essentials non riesce ad aprirlo. Essentials ora e'' disabilitato. Se non riesci a riparare il file, vai su http://tiny.cc/EssentialsChat +essentialsHelp2=File corrotto.. Essentials non riesce ad aprirlo. Essentials ora e'' disabilitato. Se non riesci a riparare il file, digita il comando /essentialshelp o vai su http://tiny.cc/EssentialsChat +essentialsReload=\u00a77Essentials Ricaricato {0} +extinguish=\u00a77Hai spento le fiamme. +extinguishOthers=\u00a77Hai spento le fiamme di {0}. +failedToCloseConfig=Chiusura fallita del config {0} +failedToCreateConfig=Creazione fallita del config {0} +failedToWriteConfig=Scrittura fallita del config {0} +false=falso +feed=\u00a77Ora sei sazio. +feedOther=\u00a77{0} e''stato nutrito. +fileRenameError=Rinomina del file {0} fallita +flyMode=\u00a77Modalita'' volo impostata {0} per {1}. +foreverAlone=\u00a7cNon c''e'' nessuno a cui rispondere. +freedMemory=Liberati {0} MB. +gameMode=\u00a77Modalita''di gioco {0} impostata per {1}. +gcchunks= blocchi, +gcentities= entita'' +gcfree=Memoria libera: {0} MB +gcmax=Memoria massima: {0} MB +gctotal=Memoria allocata: {0} MB +geoIpUrlEmpty=L''url del download di GeoIP e'' vuoto. +geoIpUrlInvalid=L''url del download di GeoIP non e'' valido. +geoipJoinFormat=Il Player {0} proviene da {1} +godDisabledFor=God disabilitato per {0} +godEnabledFor=God abilitato per {0} +godMode=\u00a77Modalita'' God {0}. +haveBeenReleased=\u00a77Sei stato scarcerato. +heal=\u00a77Sei stato curato. +healOther=\u00a77{0} e'' stato curato. +helpConsole=Digitare ? per la guida. +helpFrom=\u00a77Comandi da {0}: +helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Corrispondenza comandi "{0}": +helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} +helpPages=Pagina \u00a7c{0}\u00a7f di \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Plugin Help: /help {1} +holeInFloor=Buco nel terreno +homeSet=\u00a77Home impostata. +homeSetToBed=\u00a77La tua home e'' ora assegnata a questo letto. +homes=Homes: {0} +hour=ora +hours=ore +ignorePlayer=Da ora in poi ignorerai {0}. +illegalDate=Formato data/ora non riconosciuto. +infoChapter=Seleziona capitolo: +infoChapterPages=Capitolo {0}, pagina \u00a7c{1}\u00a7f di \u00a7c{2}\u00a7f: +infoFileDoesNotExist=Il file info.txt non esiste. Creane uno per te. +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Pagina \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- +infoUnknownChapter=Capitolo sconosciuto. +invBigger=L''inventario degli altri utenti e'' piu'' grande del tuo. +invRestored=l tuo inventario e'' stato ripristinato. +invSee=Stai guardando l''inventario di {0}. +invSeeHelp=Digita /invsee per ripristinare il tuo inventario. +invalidCharge=\u00a7cIIstruzione non corretta. +invalidHome=La home {0} non esiste +invalidMob=Tipo mob non valido. +invalidServer=Server non valido! +invalidSignLine=Riga {0} non corretta. +invalidWorld=\u00a7cMondo incorretto. +inventoryCleared=\u00a77Inventario cancellato. +inventoryClearedOthers=\u00a77Inventario di \u00a7c{0}\u00a77 cancellato. +is=e'' +itemCannotBeSold=L''oggetto non puo'' essere venduto. +itemMustBeStacked=L''oggetto deve essere commerciato in pile. 2 quantita'' equivalgono a 2 pile, etc. +itemNotEnough1=\u00a7cNon hai abbastanza quantita'' di questo oggetto per venderlo. +itemNotEnough2=\u00a77Se vuoi vendere tutti gli oggetti di quel tipo, digita /sell nomeoggetto +itemNotEnough3=\u00a77/sell nomeoggetto -1 vende tutto tranne quell''oggetto, etc. +itemSellAir=Stai cercando di vendere l''aria? Metti un oggetto nella tua mano. +itemSold=\u00a77Venduto per \u00a7c{0} \u00a77({1} {2} a {3} l''uno) +itemSoldConsole={0} venduto {1} per \u00a77{2} \u00a77({3} oggetti a {4} l''uno) +itemSpawn=\u00a77Inviati {0} di {1} +itemsCsvNotLoaded=Impossibile caricare items.csv. +jailAlreadyIncarcerated=\u00a7cPlayer gia'' in prigione: {0} +jailMessage=\u00a7cAvrai tempo per riflettere..in prigione. +jailNotExist=La prigione dichiarata non esiste. +jailReleased=\u00a77Player \u00a7e{0}\u00a77 scarcerato. +jailReleasedPlayerNotify=\u00a77Sei stato scarcerato! +jailSentenceExtended=Tempo di incarcerazione aumentato di: {0) +jailSet=\u00a77{0} e'' ora una prigione. +jumpError=Cosi'' facendo danneggerai la cpu. +kickedAll=\u00a7cKicked all players from server +kickDefault=Kickato dal server +kickExempt=\u00a7cNon puoi kickare questo player. +kill=\u00a77Ucciso {0}. +kitError2=\u00a7cQuesto kit non esiste o non e'' definito. +kitError=\u00a7cNon ci sono kit validi. +kitErrorHelp=\u00a7cForse una quantita'' manca in un oggetto della configurazione? +kitGive=\u00a77Kit inviato {0}. +kitInvFull=\u00a7cIl tuo inventario e'' pieno, il kit e'' ora per terra. +kitTimed=\u00a7cNon puoi usare il kit per altri {0}. +kits=\u00a77Kits: {0} +lightningSmited=\u00a77Sei stato folgorato! +lightningUse=\u00a77{0} e'' stato folgorato! +listAfkTag = \u00a77[AFK]\u00a7f +listAmount = \u00a79Ci sono \u00a7c{0}\u00a79 players online su un massimo di \u00a7c{1}. +listAmountHidden = \u00a79Ci sono \u00a7c{0}\u00a77/{1}\u00a79 players online su un massimo di \u00a7c{2}. +listGroupTag={0}\u00a7f: +listHiddenTag = \u00a77[HIDDEN]\u00a7f +loadWarpError=Impossibile caricare il warp {0} +localFormat=Formato locale: <{0}> {1} +mailClear=\u00a7cPer cancellare la tua mail, digita /mail clear +mailCleared=\u00a77Mail cancellata! +mailSent=\u00a77Mail inviata! +markMailAsRead=\u00a7cPer contrassegnare la mail come gia'' letta, digita /mail read +markedAsAway=\u00a77Il tuo stato ora e'' "Non al computer". +markedAsNotAway=\u00a77Bentornato! +maxHomes=Non puoi assegnare piu'' di {0} home. +mayNotJail=\u00a7cNon puoi imprigionare questo player. +me=mi +minute=minuto +minutes=minuti +missingItems=Non hai {0}x {1}. +missingPrefixSuffix=Manca un prefisso o un suffisso per {0} +mobSpawnError=Errore durante il cambiamento del generatore di mob. +mobSpawnLimit=Quantita'' Mob limitata dal server +mobSpawnTarget=Il blocco designato deve essere un generatore di mob. +mobsAvailable=\u00a77Mobs: {0} +moneyRecievedFrom=\u00a7a{0} sono stati ricevuti da {1} +moneySentTo=\u00a7a{0} sono stati inviati a {1} +moneyTaken={0} prelevati dal tuo conto in banca. +month=mese +months=mesi +moreThanZero=La quantita'' deve essere maggiore di 0. +msgFormat=\u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} +muteExempt=\u00a7cNon puoi mutare questo player. +mutedPlayer=Player {0} mutato. +mutedPlayerFor=Player {0} mutato per {1}. +mutedUserSpeaks={0} ha provato a parlare, ma e'' mutato. +nearbyPlayers=Players nelle vicinanze: {0} +negativeBalanceError=User is not allowed to have a negative balance. +nickChanged=Nickname modificato. +nickDisplayName=\u00a77Devi abilitare change-displayname nel config di Essentials. +nickInUse=\u00a7cNickname gia'' in uso. +nickNamesAlpha=\u00a7cI Nickname devono essere alfanumerici. +nickNoMore=\u00a77Non disponi piu'' di un nickname. +nickOthersPermission=\u00a7cNon hai il permesso di cambiare il nickname degli altri +nickSet=\u00a77Il tuo nickname e'' ora \u00a7c{0} +noAccessCommand=\u00a7cNon hai accesso a questo comando. +noAccessPermission=\u00a7cNon hai i permessi di accesso per {0}. +noBreakBedrock=Non sei abilitato a distruggere la bedrock. +noDestroyPermission=\u00a7cNon hai i permessi per distruggere {0}. +noGodWorldWarning=\u00a7cAttenzione! Modalita'' God disabilitata in questo mondo. +noHelpFound=\u00a7cComandi non trovati. +noHomeSet=Non hai stabilito una home. +noHomeSetPlayer=Il Player non ha stabilito una home. +noKitPermission=\u00a7cHai bisogno del permesso \u00a7c{0}\u00a7c per usare questo kit. +noKits=\u00a77Non ci sono ancora kit disponibili +noMail=Non hai ricevuto nessuna mail +noMotd=\u00a7cNon c''e'' nessun messaggio del giorno. +noNewMail=\u00a77Non hai ricevuto nuove mail. +noPendingRequest=Non hai richieste in sospeso. +noPerm=\u00a7cNon hai questo permesso: \u00a7f{0} +noPermToSpawnMob=\u00a7cNon hai i permessi per generare questo mob. +noPlacePermission=\u00a7cNon hai il permesso di collocare un blocco accanto a quest''insegna. +noPowerTools=Non hai attrezzi assegnati. +noRules=\u00a7cNon ci sono regole specifiche al momento. +noWarpsDefined=Nessun warp definito +none=nessun +notAllowedToQuestion=\u00a7cNon sei autorizzato a fare domande. +notAllowedToShout=\u00a7cNon sei autorizzato a gridare. +notEnoughExperience=Non hai abbastanza esperienza. +notEnoughMoney=Non hai abbastanza denaro. +notRecommendedBukkit=* ! * La versione Bukkit in uso non e'' compatibile con Essentials. +notSupportedYet=Non ancora supportato. +nothingInHand = \u00a7cNon hai niente in mano. +now=adesso +nuke=Un regalino.. radioattivo +numberRequired=Che ne dici di metterci un numero?! +onlyDayNight=/time supporta solo day/night. +onlyPlayers=Solo i players durante il gioco possono usare {0}. +onlySunStorm=/weather supporta solo sun/storm. +orderBalances=Sto ordinando i bilanci di {0} utenti, attendere grazie... +pTimeCurrent=L''orario di \u00a7e{0}\u00a7f e'' {1}. +pTimeCurrentFixed=L''orario di \u00a7e{0}\u00a7f e'' fissato alle {1}. +pTimeNormal=L''orario di \u00a7e{0}\u00a7f e'' normale e corrisponde a quello del server. +pTimeOthersPermission=\u00a7cNon sei autorizzato a definre l''orario degli altri player. +pTimePlayers=Questi player hanno il loro orario: +pTimeReset=L''orario del Player e'' stato resettato alle: \u00a7e{0} +pTimeSet=L''orario del Player e'' stato regolato alle \u00a73{0}\u00a7f per le: \u00a7e{1} +pTimeSetFixed=L''orario del Player e'' stato fissato alle \u00a73{0}\u00a7f per le: \u00a7e{1} +parseError=Errore parsing {0} riga {1} +pendingTeleportCancelled=\u00a7cRichiesta in sospeso di teletrasporto cancellata. +permissionsError=Mancano i permessi per Permissions/GroupManager; i suffissi e prefissi in chat verrano disabilitati. +playerBanned=\u00a7cIl Player {0} e'' bannato {1} motivo: {2} +playerInJail=\u00a7cIl Player e'' gia'' nella prigione ({0}). +playerJailed=\u00a77Il Player {0} e'' stato messo in prigione. +playerJailedFor= \u00a77Il Player {0} e'' in prigione. motivo: {1}. +playerKicked=\u00a7cIl Player {0} e'' stato kickato {1} motivo: {2} +playerMuted=\u00a77Sei stato mutato +playerMutedFor=\u00a77Sei stato mutato per {0} +playerNeverOnServer=\u00a7cIl Player {0} non e'' mai stato su questo server. +playerNotFound=\u00a7cPlayer non trovato. +playerUnmuted=\u00a77Sei stato smutato +pong=Pong! +possibleWorlds=\u00a77I mondi sono numerati da 0 a {0}. +powerToolAir=Il comando non puo'' essere collegato all''aria. +powerToolAlreadySet=Il comando \u00a7c{0}\u00a7f e'' gia'' stato assegnato a {1}. +powerToolAttach=Il comando \u00a7c{0}\u00a7f e'' stato assegnato a {1}. +powerToolClearAll=Tutti i comandi per gli attrezzi sono stati cancellati. +powerToolList=L''attrezzo {1} ha i seguenti comandi: \u00a7c{0}\u00a7f. +powerToolListEmpty=L''attrezzo {0} non dispone di comandi assegnati. +powerToolNoSuchCommandAssigned=Il comando \u00a7c{0}\u00a7f non e'' stato assegnato a {1}. +powerToolRemove=Il comando \u00a7c{0}\u00a7f e'' stato rimosso da {1}. +powerToolRemoveAll=Tutti i comandi sono stati rimossi da {0}. +powerToolsDisabled=Tutti i tuoi attrezzi sono stati disabilitati. +powerToolsEnabled=Tutti i tuoi attrezzi sono stati abilitati. +protectionOwner=\u00a76[EssentialsProtect] Protetto dal proprietario: {0} +questionFormat=\u00a77[Domanda]\u00a7f {0} +readNextPage=Digita /{0} {1} per la pagina successiva +reloadAllPlugins=\u00a77Tutti i plugins ricaricati. +removed=\u00a77Rimosse {0} entitita''. +repair=Hai riparato con successo il tuo: \u00a7e{0}. +repairAlreadyFixed=\u00a77Questo oggetto non richiede riparazioni. +repairEnchanted=\u00a77Non sei abilitato a riparare oggetti magici. +repairInvalidType=\u00a7cQuesto oggetto non puo'' essere riparato. +repairNone=Non ci sono oggetti da riparare. +requestAccepted=\u00a77Richiesta di teletrasporto accettata. +requestAcceptedFrom=\u00a77{0} ha accettato la tua richiesta di teletrasporto. +requestDenied=\u00a77Richiesta di teletrasporto rifiutata. +requestDeniedFrom=\u00a77{0} ha rifiutato la tua richiesta di teletrasporto. +requestSent=\u00a77Richiesta inviata a {0}\u00a77. +requestTimedOut=\u00a7cRichiesta di teletrasporto scaduta. +requiredBukkit=* ! * e'' necessaria la versione {0} o superiore di CraftBukkit, scaricabile da http://dl.bukkit.org/downloads/craftbukkit/ +returnPlayerToJailError=Riscontrato errore nell''invio del player {0} alla prigione: {1} +second=secondo +seconds=secondi +seenOffline=Il Player {0} e'' offline da {1} +seenOnline=Il Player {0} e'' online da {1} +serverFull=Il Server e'' pieno +serverTotal=Totale Server: {0} +setSpawner=Tipo generatore modificato in {0} +sheepMalformedColor=Colore non valido. +shoutFormat=\u00a77[Grido!]\u00a7f {0} +signFormatFail=\u00a74[{0}] +signFormatSuccess=\u00a71[{0}] +signFormatTemplate=[{0}] +signProtectInvalidLocation=\u00a74Non hai il permesso per creare segnaposti qui. +similarWarpExist=Il nome del warp e'' stato gia'' utilizzato. +slimeMalformedSize=Dimensione non valida. +soloMob=Quel mob sembra essere solo +spawnSet=\u00a77Punto di rigenerazione creato per il gruppo {0}. +spawned=creato +sudoExempt=Impossibile applicare il sudo a questo utente +sudoRun=Sto obbligando {0} ad eseguire: /{1} {2} +suicideMessage=\u00a77Addio mondo crudele... +suicideSuccess= \u00a77{0} si e'' suicidato.. +survival=sopravvivenza +takenFromAccount=\u00a7c{0} sono stati prelevati dal tuo conto. +takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2} +teleportAAll=\u00a77Richiesta di teletrasporto inviata a tutti i players... +teleportAll=\u00a77Sto teletrasportando tutti i players... +teleportAtoB=\u00a77{0}\u00a77 ti ha teletrasportato a {1}\u00a77. +teleportDisabled={0} ha il teletrasporto disabilitato. +teleportHereRequest=\u00a7c{0}\u00a7c ha richiesto di teletrasportati da loro. +teleportNewPlayerError=Teletrasporto del nuovo player fallito +teleportRequest=\u00a7c{0}\u00a7c ha richiesto di teletrasportati da te. +teleportRequestTimeoutInfo=\u00a77Questa richiesta scadra'' tra {0} secondi. +teleportTop=\u00a77Teletrasporto in cima. +teleportationCommencing=\u00a77Inizio teletrasporto... +teleportationDisabled=\u00a77Teletrasporto disabilitato. +teleportationEnabled=\u00a77Teletrasporto abilitato. +teleporting=\u00a77Teletrasporto in corso... +teleportingPortal=\u00a77Teletrasporto tramite portale. +tempBanned=Bannato temporaneamente dal server per {0} +tempbanExempt=\u00a77Non puoi bannare questo player +thunder=Abilita i filmini dal cielo: {0} +thunderDuration=Abilita i filmini dal cielo: {0} per {1} secondi. +timeBeforeHeal=Tempo rimanente alla prossima cura: {0} +timeBeforeTeleport=Tempo rimanente al prossimo teletrasporto: {0} +timeFormat=\u00a73{0}\u00a7f oppure \u00a73{1}\u00a7f oppure \u00a73{2}\u00a7f +timePattern=(?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? +timeSet=Orario definito in tutti i mondi. +timeSetPermission=\u00a7cNon sei autorizzato a regolare l''orario. +timeWorldCurrent=L''orario attuale in {0} e'' \u00a73{1} +timeWorldSet=L''orario e'' stato regolato alle {0} in: \u00a7c{1} +tradeCompleted=\u00a77Affare concluso. +tradeSignEmpty=L''insegna non dispone di forniture sufficienti. +tradeSignEmptyOwner=Non c''e'' niente da raccogliare da quest''insegna. +treeFailure=\u00a7cCreazione dell''albero fallita. Riprova sull''erba o sul terreno. +treeSpawned=\u00a77Albero generato. +true=vero +typeTpaccept=\u00a77Per accetare il teletrasprto, digita \u00a7c/tpaccept\u00a77. +typeTpdeny=\u00a77Per rifiutare il teletrasporto, digita \u00a7c/tpdeny\u00a77. +typeWorldName=\u00a77Puoi digitare anche il nome di un mondo. +unableToSpawnMob=Impossibile generare il mob. +unbannedIP=IP address abilitato. +unbannedPlayer=Player abilitato. +unignorePlayer=Non stai piu'' ignorando il player {0}. +unknownItemId=ID oggetto sconosciuto: {0} +unknownItemInList=Oggetto {0} sconosciuto nella lista {1}. +unknownItemName=Nome oggetto sconosciuto: {0} +unlimitedItemPermission=\u00a7cNessun permesso per l''oggetto {0} illimitato. +unlimitedItems=Oggetti illimitati: +unmutedPlayer=Player {0} smutato. +upgradingFilesError=Errore durante l''aggiornamento dei file +userDoesNotExist=L''utente {0} non esiste. +userIsAway={0} e'' AFK +userIsNotAway={0} non e'' piu'' AFK +userJailed=\u00a77Sei stato messo in prigione +userUsedPortal={0} ha usato un portale. +userdataMoveBackError=Errore durante lo spostamento di userdata/{0}.tmp a userdata/{1} +userdataMoveError=Errore durante lo spostamento di userdata/{0} a userdata/{1}.tmp +usingTempFolderForTesting=Sto usando la cartella temporale per il test: +versionMismatch=Versione incorretta! Aggiornare {0} alla stessa versione. +versionMismatchAll=Versione incorretta! Aggiornare tutti i jar Essentials alla stessa versione. +voiceSilenced=\u00a77La tua voce e'' stata silenziata +warpDeleteError=Problema nell''eliminazione del file warp. +warpListPermission=\u00a7cNon hai i permessi per consultare la lista warps. +warpNotExist=Questo warp non esiste. +warpOverwrite=\u00a7cNon puoi sovrascrivere il warp. +warpSet=\u00a77Warp {0} definito. +warpUsePermission=\u00a7cNon hai i permessi per usare questo warp. +warpingTo=\u00a77Warping a {0}. +warps=Warps: {0} +warpsCount=\u00a77Ci sono {0} warps. Pagina {1} of {2}. +weatherStorm=\u00a77Hai regolato il tempo in tempesta in {0} +weatherStormFor=\u00a77Hai cambiato il tempo in tempesta in {0} per {1} secondi +weatherSun=\u00a77Hai cambiato il tempo in soleggiato in {0} +weatherSunFor=\u00a77Hai cambiato il tempo in soleggiato in {0} per {1} secondi +whoisBanned=\u00a79 - Bannati: {0} +whoisExp=\u00a79 - Exp: {0} (Livello {1}) +whoisGamemode=\u00a79 - Gamemode: {0} +whoisGeoLocation=\u00a79 - Posizione: {0} +whoisGod=\u00a79 - God mode: {0} +whoisHealth=\u00a79 - Health: {0}/20 +whoisIPAddress=\u00a79 - IP Address: {0} +whoisIs={0} e'' {1} +whoisJail=\u00a79 - Imprigionati: {0} +whoisLocation=\u00a79 - Posizione: ({0}, {1}, {2}, {3}) +whoisMoney=\u00a79 - Denaro: {0} +whoisOP=\u00a79 - OP: {0} +whoisStatusAvailable=\u00a79 - Status: Disponibile +whoisStatusAway=\u00a79 - Status: \u00a7cNon al computer\u00a7f +worth=\u00a77Pila di {0} valore \u00a7c{1}\u00a77 ({2} oggetto(i) a {3} l''uno) +worthMeta=\u00a77Pila di {0} con metadati di {1} valore \u00a7c{2}\u00a77 ({3} oggetto(i) a {4} l''uno) +worthSet=Valore definito +year=anno +years=anni +youAreHealed=\u00a77Sei stato curato. +youHaveNewMail=\u00a7cHai {0} messaggi!\u00a7f digita \u00a77/mail read\u00a7f per consultare la tua mail. +exp=\u00a7c{0} \u00a77has\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) and needs\u00a7c {3} \u00a77more exp to level up. +expSet=\u00a7c{0} \u00a77now has\u00a7c {1} \u00a77exp. +unvanished=\u00a7aYou are once again visible. +unvanishedReload=\u00a7cA reload has forced you to become visible. +vanished=\u00a7aYou have now been vanished. +tps=Current TPS = {0} +hatPlaced=\u00a7eEnjoy your new hat! +hatFail=\u00a7cYou must have something to wear in your hand. +hatArmor=\u00a7cError, you cannot use armor as a hat! diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index c29947b8c..342d5ca95 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -12,6 +12,7 @@ alertUsed=gebruikt: autoAfkKickReason=You have been kicked for idling more than {0} minutes. backAfterDeath=\u00a77Gebruik het /back command om terug te keren naar je sterfplaats. backUsageMsg=\u00a77Naar de vorige locatie aan het gaan. +backupDisabled=An external backup script has not been configured. backupFinished=Backup voltooid backupStarted=Backup gestart balance=\u00a77Saldo: {0} @@ -50,6 +51,7 @@ creatingConfigFromTemplate=Bezig met aanmaken van een config vanaf sjabloon: {0} creatingEmptyConfig=Bezig met een lege config aanmaken: {0} creative=creative currency={0}{1} +currentWorld=Current World: {0} day=dag days=dagen defaultBanReason=De Ban Hamer heeft gesproken! @@ -92,6 +94,7 @@ false=false feed=\u00a77Your appetite was sated. feedOther=\u00a77Satisfied {0}. fileRenameError=Hernoemen van {0} mislukt +flyMode=\u00a77Set fly mode {0} for {1}. foreverAlone=\u00a7cJe hebt niemand waarnaar je kan reageren. freedMemory={0} MB gelost. gameMode=\u00a77Set game mode {0} for {1}. @@ -110,9 +113,12 @@ haveBeenReleased=\u00a77Je bent bevrijdt heal=\u00a77Je bent genezen. healOther=\u00a77Je geneezde {0}. helpConsole=type ? om de consolehelp weer te geven. +helpFrom=\u00a77Commands from {0}: helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Commands matching "{0}": helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} helpPages=Pagina \u00a7c{0}\u00a7f van de \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Plugin Help: /help {1} holeInFloor=Gat in de vloer homeSet=\u00a77Home ingesteld. homeSetToBed=\u00a77Je home is is nu verplaatst naar dit bed. @@ -124,7 +130,7 @@ illegalDate=Illegaal data formaat. infoChapter=Selecteer hoofdstuk: infoChapterPages=Hoofdstuk {0}, Pagina \u00a7c{1}\u00a7f van de \u00a7c{2}\u00a7f: infoFileDoesNotExist=Bestand info.txt bestaat niet. Bezig met aanmaken. -infoPages=Pagina \u00a7c{0}\u00a7f van de \u00a7c{1}\u00a7f: +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Pagina \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- infoUnknownChapter=Onbekend hoofdstuk. invBigger=De inventory van de andere speler is groter dan die van jou. invRestored=Je inventory is hersteld. @@ -157,6 +163,7 @@ jailReleasedPlayerNotify=\u00a77You have been released! jailSentenceExtended=Jail time extend to: {0) jailSet=\u00a77Gevangenis {0} is ingesteld jumpError=Dat zou je computers hersenen beschadigen. +kickedAll=\u00a7cKicked all players from server kickDefault=Gekicked van de server kickExempt=\u00a77Je kunt die speler niet schoppen. kill=\u00a77Jij doodde {0}. @@ -205,7 +212,6 @@ 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. nickDisplayName=\u00a77You have to enable change-displayname in Essentials config. @@ -299,7 +305,7 @@ requestDenied=\u00a77Teleporteer aanvraag geweigerd. requestDeniedFrom=\u00a77{0} denied your teleport request. requestSent=\u00a77Aanvraag verstuurd naar {0}\u00a77. requestTimedOut=\u00a7cTeleport request has timed out -requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. +requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://dl.bukkit.org/downloads/craftbukkit/ returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1} second=seconde seconds=seconde @@ -388,6 +394,7 @@ voiceSilenced=\u00a77Je kan niet meer praten warpDeleteError=Fout bij het verwijderen van het warp bestand. warpListPermission=\u00a7cJe hebt geen toegang om die warp te maken. warpNotExist=Die warp bestaat niet. +warpOverwrite=\u00a7cYou cannot overwrite that warp. warpSet=\u00a77Warp {0} ingesteld. warpUsePermission=\u00a7cOnbevoegd om die warp te gebruiken. warpingTo=\u00a77Aan het warpen naar {0}. @@ -399,6 +406,7 @@ weatherStormFor=\u00a77Je hebt het weer in de {0} naar storm gezet voor {1} seco 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} +whoisExp=\u00a79 - Exp: {0} (Level {1}) whoisGamemode=\u00a79 - Gamemode: {0} whoisGeoLocation=\u00a79 - Locatie: {0} whoisGod=\u00a79 - God mode: {0} @@ -418,4 +426,12 @@ year=jaar years=jaren youAreHealed=\u00a77Je bent genezen. youHaveNewMail=\u00a7cJe hebt {0} berichten!\u00a7f Type \u00a77/mail read\u00a7f om je berichten te bekijken. - +expSet=\u00a7c{0} \u00a77now has\u00a7c {1} \u00a77exp. +exp=\u00a7c{0} \u00a77has\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) and needs\u00a7c {3} \u00a77more exp to level up. +unvanished=\u00a7aYou are once again visible. +unvanishedReload=\u00a7cA reload has forced you to become visible. +vanished=\u00a7aYou have now been vanished. +tps=Current TPS = {0} +hatPlaced=\u00a7eEnjoy your new hat! +hatFail=\u00a7cYou must have something to wear in your hand. +hatArmor=\u00a7cError, you cannot use armor as a hat! diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties new file mode 100644 index 000000000..1ca936863 --- /dev/null +++ b/Essentials/src/messages_pl.properties @@ -0,0 +1,434 @@ +#version: TeamCity +# Single quotes have to be doubled: '' +# Translations start here +# by: losdamianos +action=* {0} {1} +addedToAccount=\u00a7a{0} zostalo dodane do twojego konta. +addedToOthersAccount=\u00a7a{0} dodane do konta {1}\u00a7. Nowy stan konta: {2}. +alertBroke=broke: +alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} at: {3} +alertPlaced=postawil: +alertUsed=uzyl: +autoAfkKickReason=Zostales wyrzucony z serwera za pozostawanie bez ruchu przez wiecej niz {0} minut. +backAfterDeath=\u00a77Uzyj komendy /back aby powrocic na miejsce swojej smierci. +backUsageMsg=\u00a77Transportowanie do poprzedniej lokacji. +backupDisabled=Zewnetrzny skrypt backupu nie zostal skonfigurowany. +backupFinished=Backup zakonczony. +backupStarted=Backup rozpoczety. +balance=\u00a77Stan konta: {0} +balanceTop=\u00a77Najbogatsi gracze ({0}) +banExempt=\u00a7cNie mozesz zbanowac tego gracza. +banIpAddress=\u00a77Zbanowano adress IP +bannedIpsFileError=Blad odczytu banned-ips.txt +bannedIpsFileNotFound=banned-ips.txt nie znaleziony +bannedPlayersFileError=Blad odczytu banned-players.txt +bannedPlayersFileNotFound=banned-players.txt nie znaleziony +bigTreeFailure=\u00a7cGenerator duzych drzew zaliczyl blad. Sprobuj ponownie na ziemi lub trawie. +bigTreeSuccess= \u00a77Utworzono duze drzewo. +blockList=Essentials relayed the following commands to another plugin: +broadcast=[\u00a7cBroadcast\u00a7f]\u00a7a {0} +buildAlert=\u00a7cNie mozesz tu budowac +bukkitFormatChanged=Format wersji Bukkita jest zmieniony. Wersja nie jest sprawdzana. +burnMsg=\u00a77Podpaliles {0} na {1} sekund. +canTalkAgain=\u00a77Znow mozesz mowic. +cantFindGeoIpDB=Nie mozna znalezc bazy danych GeoIP! +cantReadGeoIpDB=Odczytywanie bazy danych GeoIP zawiodlo! +cantSpawnItem=\u00a7cNie mozesz stworzyc przedmiotu {0}. +chatTypeLocal=[L] +chatTypeSpy=[Spy] +commandFailed=Komenda {0} zawiodla. +commandHelpFailedForPlugin=Blad podczas uzyskiwania pomocy dla: {0} +commandNotLoaded=\u00a7cKomenda {0} jest zaladowana nieprawidlowo.. +compassBearing=\u00a77Bearing: {0} ({1} degrees). +configFileMoveError=Failed to move config.yml to backup location. +configFileRenameError=Failed to rename temp file to config.yml +connectedPlayers=Obecni gracze: +connectionFailed=Blad podczas otwierania polaczenia. +cooldownWithMessage=\u00a7cCooldown: {0} +corruptNodeInConfig=\u00a74Notice: Your configuration file has a corrupt {0} node. +couldNotFindTemplate=Could not find template {0} +creatingConfigFromTemplate=Creating config from template: {0} +creatingEmptyConfig=Stworzono pusty config: {0} +creative=Tworczy +currency={0}{1} +currentWorld=Current World: {0} +day=dzien +days=dnie +defaultBanReason=Admin ma zawsze racje! +deleteFileError=Nie mozna usunac pliku: {0} +deleteHome=\u00a77Posterunek {0} zostal usuniety +deleteJail=\u00a77Wiezienie {0} zostalo usuniete +deleteWarp=\u00a77Warp {0} zostal usuniety +deniedAccessCommand={0} nie ma dostepu do tego polecenia +dependancyDownloaded=[Essentials] Zaleznosci {0} pobrane prawidlowo. +dependancyException=[Essentials] Wystapil blad w trakcie pobierania zaleznosci. +dependancyNotFound=[Essentials] Wymagana zaleznosc nie zostala znaleziona, pobieranie. +depth=\u00a77Jestes na poziomie morza. +depthAboveSea=\u00a77Jestes {0} blok(ow) nad poziomem morza. +depthBelowSea=\u00a77Jestes {0} blok(ow) pod poziomem morza. +destinationNotSet=Cel nieokreslony. +disableUnlimited=\u00a77Wylaczone nieograniczone tworzenia {0} dla {1}. +disabled=wylaczone +disabledToSpawnMob=Tworzenie tego moba zostalo wylaczone w pliku config. +dontMoveMessage=\u00a77Teleportacja nastapi za {0}. Prosze sie nie ruszac. +downloadingGeoIp=Pobieranie bazy danych GeoIP... To moze zajac chwile (wioska: 0.6 MB, miasto: 20MB) +duplicatedUserdata=Kopiowanie danych uzytkownika: {0} i {1} +enableUnlimited=\u00a77Przyznano nielimitowane zasoby {0} dla {1}. +enabled=wlaczone +enchantmentApplied = \u00a77Ulepszenie {0} zostalo przyznane przedmiotowi w twoim reku. +enchantmentNotFound = \u00a7cUlepszenie nie odnalezione +enchantmentPerm = \u00a7cNie masz zezwolenia na {0}. +enchantmentRemoved = \u00a77Ulepszenie {0} zostalo usuniete z przedmiotu w twoim reku.. +enchantments = \u00a77Ulepszenia: {0} +errorCallingCommand=Blad wywolywania komendy /{0} +errorWithMessage=\u00a7cBlad: {0} +essentialsHelp1=Plik jest uszkodzony i Essentials nie moze go otworzyc. Essentials jest teraz wylaczone. Jesli nie mozesz samemu naprawic pliku, idz do adresu http://tiny.cc/EssentialsChat +essentialsHelp2=Plik jest uszkodzony i Essentials nie moze go otworzyc. Essentials jest teraz wylaczone. Jesli nie mozesz samemu naprawic pliku, wpisz /essentialshelp w grze lub idz do adresu http://tiny.cc/EssentialsChat +essentialsReload=\u00a77Essentials przeladowalo {0}. +extinguish=\u00a77Zostales ugaszony. +extinguishOthers=\u00a77Ugasiles {0}. +failedToCloseConfig=Blad podczas zamykania configu {0} +failedToCreateConfig=Blad podczas tworzenia configu {0} +failedToWriteConfig=Blad podczas pisania configu {0} +false=falsz +feed=\u00a77Twoj glod zostal zaspokojony. +feedOther=\u00a77Nakarmiono {0}. +fileRenameError=Blad podczas zmiany nazwy pliku \u0093{0}\u0094. +flyMode=\u00a77Latanie {0} dla {1}. +foreverAlone=\u00a7cNie masz komu odpisac. +freedMemory=Zwolniono {0} MB. +gameMode=\u00a77Ustawiono tryb gry {0} dla {1}. +gcchunks= chunki +gcentities= jednostki +gcfree=Wolna pamiec: {0} MB +gcmax=Maksymalna pamiec: {0} MB +gctotal=Alokowana pamiec: {0} MB +geoIpUrlEmpty=Url pobierania GeoIP jest puste. +geoIpUrlInvalid=Url pobierania GeoIP jest nieprawidlowe. +geoipJoinFormat=Gracz {0} przybyl z {1} +godDisabledFor=Godmode wylaczony dla {0}. +godEnabledFor=Godmode wlaczony dla {0}. +godMode=\u00a77Godmode {0}. +haveBeenReleased=\u00a77Zostales wypuszczony. +heal=\u00a77Uleczony +healOther=\u00a77Uleczono {0}. +helpConsole=Aby uzyskac pomoc z konsoli, wpisz \u0093????. +helpFrom=\u00a77Komendy od {0}: +helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Komendy odpowiadajace "{0}": +helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} +helpPages=Strona \u00a7c{0}\u00a7f z \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Plugin Help: /help {1} +holeInFloor=Czarna dziura +homeSet=\u00a77Posterunek ustawiono +homeSetToBed=\u00a77Twoj posterunek znajduje sie teraz w tym lozku. +homes=Posterunki: {0} +hour=godzina +hours=godziny +ignorePlayer=Od tej chwili ignorujesz gracza {0}. +illegalDate=Illegal date format. +infoChapter=Wybierz rozdzial: +infoChapterPages=Rozdzial {0}, strona \u00a7c{1}\u00a7f z \u00a7c{2}\u00a7f: +infoFileDoesNotExist=Plik \u0093info.txt\u0094 nie istnieje. Tworzenie tego pliku. +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Page \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- +infoUnknownChapter=Nieznany rozdzial. +invBigger=Ekwipunek innego gracza jest wiekszy niz Twoj. +invRestored=Twoj ekwipunek zostal przywrocony. +invSee=Widzisz ekwipunek {0}. +invSeeHelp=Wpisz /invsee aby przywrocic swoj ekwipunek. +invalidCharge=\u00a7cInvalid charge. +invalidHome=Posterunek {0} nie istnieje. +invalidMob=Niepoprawny typ moba.. +invalidServer=Niepoprawny serwer! +invalidSignLine=Linijka {0} na znaku jest bledna. +invalidWorld=\u00a7cNieprawidlowy swiat. +inventoryCleared=\u00a77Ekwipunek oprozniony. +inventoryClearedOthers=\u00a77Ekwipunek \u00a7c{0}\u00a77 oprozniony. +is=jest +itemCannotBeSold=Nie mozesz sprzedac tego przedmiotu do serwera. +itemMustBeStacked=Przedmiotem handluje sie w stackach. Wielkosc 2s to dwa stacki itd. +itemNotEnough1=\u00a7cMasz za malo tego przedmiotu, aby go sprzedac. +itemNotEnough2=\u00a77Jesli chcesz sprzedac wszystkie przedmioty tego typu, wpisz /sell nazwaprzedmiotu +itemNotEnough3=\u00a77/sell nazwaprzedmiotu -1 sprzeda cala ilosc przedmiotu poza 1 sztuka itd. +itemSellAir=Serio probujesz sprzedac powietrze? Miej w reku przedmiot.. +itemSold=\u00a77Sprzedamo za \u00a7c{0} \u00a77({1} {2} po {3} kazdy) +itemSoldConsole={0} Sprzedano {1} za \u00a77{2} \u00a77({3} sztuki po {4} kazda) +itemSpawn=\u00a77Otrzymywanie {0} {1} +itemsCsvNotLoaded=Nie mozna wczytac items.csv. +jailAlreadyIncarcerated=\u00a7cTen gracz jest juz w wiezieniu \u0093{0}\u0094. +jailMessage=\u00a7cZa kazde przewinienie czeka kara. +jailNotExist=Nie ma takiego wiezienia.. +jailReleased=\u00a77Gracz \u00a7e{0}\u00a77 wypuszczony z wiezienia. +jailReleasedPlayerNotify=\u00a77Zostales zwolniony! +jailSentenceExtended=Czas pobyty w wiezieniu zwiekszony do: {0) +jailSet=\u00a77Zostalo stworzone wiezienie \u0093{0}\u0094. +jumpError=That would hurt your computer''s brain. +kickedAll=\u00a7cKicked all players from server +kickDefault=Zostales wyproszony z serwera. +kickExempt=\u00a7cNie mozesz wyprosic tej osoby. +kill=\u00a77Zabito {0}. +kitError2=\u00a7cTen zestaw nie istnieje lub zostal zle zdefininowany. +kitError=\u00a7cNie ma prawidlowych zestawow. +kitErrorHelp=\u00a7cByc moze przedmiotowi brakuje ilosci w konfiguracji? +kitGive=\u00a77Przydzielanie zestawu {0}. +kitInvFull=\u00a7cTwoj ekwipuek jest pelen, wykladanie zestawu na podloge. +kitTimed=\u00a7cNie mozesz uzyc tego zestawu przez kolejne {0}. +kits=\u00a77Zestawy: {0} +lightningSmited=\u00a77Zostales zdzielony piorunem. +lightningUse=\u00a77Uderzanie piorunem {0}. +listAfkTag = \u00a77[AFK]\u00a7f +listAmount = \u00a79Na serwerze jest \u00a7c{0}\u00a79 graczy z maksimum \u00a7c{1}\u00a79 online. +listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online. +listGroupTag={0}\u00a7f: +listHiddenTag = \u00a77[HIDDEN]\u00a7f +loadWarpError=Blad przy wczytywaniu Warpu {0} +localFormat=Local: <{0}> {1} +mailClear=\u00a7cAby oczyscic skrzynke, wpisz /mail clear +mailCleared=\u00a77Skrzynka oprozniona!! +mailSent=\u00a77Wiadomosc wyslana! +markMailAsRead=\u00a7cAby oczyscic skrzynke, wpisz /mail clear +markedAsAway=\u00a77Zostales oznaczony jako nieobecny. +markedAsNotAway=\u00a77Juz nie jestes nieobecny. +maxHomes=Nie mozesz ustawic wiecej niz {0} posterunkow. +mayNotJail=\u00a7cNie mozesz wtracic do wiezienia tej osoby. +me=ja +minute=minuta +minutes=minuty +missingItems=Nie masz {0}x{1}. +missingPrefixSuffix=Missing a prefix or suffix for {0} +mobSpawnError=Blad podczas zmiany spawnera. +mobSpawnLimit=Ilosc mobow ograniczona do limitu serwera. +mobSpawnTarget=Blok musi byc spawnerem. +mobsAvailable=\u00a77Moby: {0} +moneyRecievedFrom=\u00a7a{0} otrzymane od {1} +moneySentTo=\u00a7a{0} zostalo wyslane do {1} +moneyTaken={0} zostalo zabrane z Twoich funduszy.. +month=miesiac +months=miesiecy +moreThanZero=Ilosc musi byc wieksza od 0. +msgFormat=\u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} +muteExempt=\u00a7cNie mozesz wyciszyc tego gracza.. +mutedPlayer=Player {0} wyciszony. +mutedPlayerFor=Player {0} wyciszony na {1}. +mutedUserSpeaks={0} probowal sie odezwac, ale jest wyciszony. +nearbyPlayers=Gracze w poblizu: {0} +negativeBalanceError=Gracz nie moze miec ujemnego stanu konta. +nickChanged=Nick zmieniony. +nickDisplayName=\u00a77Musisz wlaczyc \u0093change-displayname\u0094 w configu Essential. +nickInUse=\u00a7cTen nick jest juz w uzyciu. +nickNamesAlpha=\u00a7cNicki musza byc alfanumeryczne. +nickNoMore=\u00a77Nie masz juz nicku. +nickOthersPermission=\u00a7cNie masz uprawnienia do zmiany nicku innym. +nickSet=\u00a77Twoj nick od teraz to \u00a7c{0} +noAccessCommand=\u00a7cNie masz dostepu do tej komendy. +noAccessPermission=\u00a7cNie masz uprawnien do dostepu do {0}. +noBreakBedrock=Nie masz uprawnien do niszczenia bedrocka. +noDestroyPermission=\u00a7cNie masz uprawnien do niszczenia {0}. +noGodWorldWarning=\u00a7cUwaga! Godmode wylaczony w tym swiecie!. +noHelpFound=\u00a7cNie ma odpowiadajacych komend. +noHomeSet=Nie masz ustawionego posterunku. +noHomeSetPlayer=Gracz nie ma ustawionego posterunku. +noKitPermission=\u00a7cMusisz posiadac uprawnienia \u00a7c{0}\u00a7c aby uzywac tego zestawu. +noKits=\u00a77Nie ma jeszcze dostepnych zestawow. +noMail=Nie masz zadnych wiadomosci. +noMotd=\u00a7cNie ma wiadomosci dnia.. +noNewMail=\u00a77Nie masz zadnych nowych wiadomosci. +noPendingRequest=You do not have a pending request. +noPerm=\u00a7cNie masz uprawnien \u00a7f{0}. +noPermToSpawnMob=\u00a7cNie masz uprawnien do tworzenia tego moba.. +noPlacePermission=\u00a7cNie masz uprawnien do stawiania bloku kolo tego znaku.. +noPowerTools=Nie masz przypisanego zadnego power tool. +noRules=\u00a7cNie ustalono jeszcze zadnych zasad. +noWarpsDefined=Nie ma zadnych warpow. +none=zaden +notAllowedToQuestion=\u00a7cNie mozesz zadac tego pytania. +notAllowedToShout=\u00a7cNie mozesz krzyczec.. +notEnoughExperience=Nie masz wystarczajaco duzo doswiadczenia. +notEnoughMoney=Nie masz tyle pieniedzy. +notRecommendedBukkit= * ! * Wersja Bukkita nie jest rekomendowana wersja dla Essentials. +notSupportedYet=Jeszcze nie wspierane. +nothingInHand = \u00a7cNie masz nic w reku.. +now=teraz +nuke=Niech smierc pochlonie caly swiat! +numberRequired=Tutaj powinna byc liczba, gluptasie. +onlyDayNight=/time obsluguje tylko day/night. +onlyPlayers=Tylko gracze w grze moga uzywac {0}. +onlySunStorm=/weather obsluguje tylko sun/storm. +orderBalances=Ordering balances of {0} users, please wait ... +pTimeCurrent=Czas \u00a7e{0} u00a7f to {1}. +pTimeCurrentFixed=Czas \u00a7e{0}\u00a7f przywrocony do {1}. +pTimeNormal=Czas \u00a7e{0}'s\u00a7f jest normalny i odpowiada serwerowemu. +pTimeOthersPermission=\u00a7cNie masz uprawnien do zmiany czasu innym. +pTimePlayers=Ci gracze beda miec wlasny czas: +pTimeReset=Czas gracza zostal zresetowany dla \u00a7e{0} +pTimeSet=Czas gracza ustawiony na \u00a73{0}\u00a7f dla \u00a7e{1} +pTimeSetFixed=Czas gracza przywrocony do \u00a73{0}\u00a7f dla \u00a7e{1} +parseError=Blad skladniowy {0} w linii {1}. +pendingTeleportCancelled=\u00a7cOczekujace zapytanie teleportacji odrzucone. +permissionsError=Brakuje Permissions/GroupManager; prefixy/suffixy czatu zostana wylaczone. +playerBanned=\u00a7c{0} zbanowal {1} za {2}. +playerInJail=\u00a7cGracz jest juz w wiezieniu \u0093{0}\u0094. +playerJailed=\u00a77Gracz {0} wtracony do wiezienia. +playerJailedFor= \u00a77Gracz {0} wtracony do wiezienia na {1}. +playerKicked=\u00a7c{0} wywalil {1} za {2}. +playerMuted=\u00a77Zostales wyciszony. +playerMutedFor=\u00a77Zostales wyciszony na {0}. +playerNeverOnServer=\u00a7cGracz {0} nigdy nie byl na tym serwerze. +playerNotFound=\u00a7cNie odnaleziono gracza. +playerUnmuted=\u00a77Zostales przywrocony do glosu. +pong=Pong! +possibleWorlds=\u00a77Mozliwe swiaty maja numery od 0 do {0}. +powerToolAir=Nie zartuj, chcesz przypisac polecenie do powietrza? +powerToolAlreadySet=Polecenie \u00a7c{0}\u00a7f jest juz przypisane do {1}. +powerToolAttach=\u00a7c{0}\u00a7f polecenie przypisane do {1}. +powerToolClearAll=Wszystkie przypisane polecenia zostaly usuniete! +powerToolList={1} zawiera nastepujace polecenia: \u00a7c{0}\u00a7f. +powerToolListEmpty={0} nie ma przypisanych polecen. +powerToolNoSuchCommandAssigned=Polecenie \u00a7c{0}\u00a7f nie moze byc przypisane do {1}. +powerToolRemove=Polecenie \u00a7c{0}\u00a7f usuniete z {1}. +powerToolRemoveAll=Wszystkie polecenia zostaly usuniete z {0}. +powerToolsDisabled=Wszystkie twoje podpiecia zostaly zdezaktywowane. +powerToolsEnabled=Wszystkie twoje podpiecia zostaly aktywowane. +protectionOwner=\u00a76[EssentialsProtect] Wlasciciel zabezpieczen: {0} +questionFormat=\u00a77[Question]\u00a7f {0} +readNextPage=Wpisz /{0} {1} aby przeczytac nastepna strone +reloadAllPlugins=\u00a77Przeladowano wszystkie wtyczki +removed=\u00a77Usunieto {0} byty. +repair=Udalo sie naprawic twoj: \u00a7e{0}. +repairAlreadyFixed=\u00a77Ten przedmiot nie potrzebuje naprawy +repairEnchanted=\u00a77Nie masz zezwolenia do naprawiania ulepszonych przedmiotow. +repairInvalidType=\u00a7cTen przedmiot nie moze byc naprawiony. +repairNone=Zaden przedmiot nie wymagal naprawy. +requestAccepted=\u00a77Zadanie teleportacji - zaakceptowano. +requestAcceptedFrom=\u00a77{0} zaakceptowal Twoje zadanie teleportacji. +requestDenied=\u00a77Zadanie teleportacji - odrzucone. +requestDeniedFrom=\u00a77{0} odrzucil Twoje zadanie teleportacji. +requestSent=\u00a77zZadanie wyslania do {0}\u00a77. +requestTimedOut=\u00a7cZadanie teleportacji - przedawnione. +requiredBukkit= * ! * Potrzebujesz ostatniego {0} CraftBukkit-a, pobierz go z http://dl.bukkit.org/downloads/craftbukkit/ +returnPlayerToJailError=Wystapil blad podczas powrotu gracza {0} do wiezienia: {1} +second=sekunda +seconds=sekund +seenOffline=Gracz {0} jest offline od {1} +seenOnline=Gracz {0} jest online od {1} +serverFull=Serwer jest pelen graczy, sprobuj pozniej. +serverTotal=Podsumowanie serwera: {0} +setSpawner=Ustawiono spawn na {0}. +sheepMalformedColor=Niewlasciwa barwa. +shoutFormat=\u00a77[Shout]\u00a7f {0} +signFormatFail=\u00a74[{0}] +signFormatSuccess=\u00a71[{0}] +signFormatTemplate=[{0}] +signProtectInvalidLocation=\u00a74Nie masz zezwolenia do tworzenia tutaj znakow. +similarWarpExist=Warp o identycznej nazwie juz istnieje. +slimeMalformedSize=Niewlasciwy rozmiar. +soloMob=Ten mob lubi byc sam. +spawnSet=\u00a77Ustawiono punkt spawnu dla grupy {0}. +spawned=stworzono +sudoExempt=Nie mozesz podniesc uprawnien tego uzytkownika. +sudoRun=Probuje {0} uruchomic: /{1} {2} +suicideMessage=\u00a77Zegnaj okrutny swiecie. +suicideSuccess= \u00a77{0} dokonal zamachu na swoje zycie +survival=survival +takenFromAccount=\u00a7c{0} zostalo pobrane z konta. +takenFromOthersAccount=\u00a7c{0} zostalo pobrane z {1}\u00a7c konta. Nowy stan konta: {2} +teleportAAll=\u00a77Zadanie teleportacji - wyslano do wszystkich graczy. +teleportAll=\u00a77Teleportowanie wszystkich graczy. +teleportAtoB=\u00a77{0}\u00a77 przeteleportowal Ciebie do {1}\u00a77. +teleportDisabled={0} ma zdezaktywowana teleportacje. +teleportHereRequest=\u00a7c{0}\u00a7c ma zadanie przeteleportowac cie do nich. +teleportNewPlayerError=Blad przy teleportowniu nowego gracza. +teleportRequest=\u00a7c{0}\u00a7c zazadal teleportacji do Ciebie. +teleportRequestTimeoutInfo=\u00a77 Zadanie teleportacji przedawni sie za {0} sekund. +teleportTop=\u00a77Teleportacja na wierzch. +teleportationCommencing=\u00a77Teleport rozgrzewa sie... +teleportationDisabled=\u00a77Teleportacja - zdezaktywowana. +teleportationEnabled=\u00a77Teleportacja - aktywowana. +teleporting=\u00a77Teleportacja... +teleportingPortal=\u00a77Teleportacja przez portal. +tempBanned=Tymczasowo zbanowany na serwerze przez {0}. +tempbanExempt=\u00a77Nie mozesz tymczasowo zbanowac tego gracza. +thunder= {0} przywowlal burze. +thunderDuration={0} przywolal burze na {1} sekund. +timeBeforeHeal=Czas przed nastepnym uzdrowieniem: {0}. +timeBeforeTeleport=Czas przed nastepnym teleportem:{0}. +timeFormat=\u00a73{0}\u00a7f or \u00a73{1}\u00a7f or \u00a73{2}\u00a7f +timePattern=(?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? +timeSet=Czas ustawiono we wszystkich swiatach. +timeSetPermission=\u00a7cNie masz uprawnien do ustawiania czasu. +timeWorldCurrent=Obecny czas {0} to \u00a73{1}. +timeWorldSet=Czas ustawiono {0} w: \u00a7c{1}. +tradeCompleted=\u00a77Handel zakonczono. +tradeSignEmpty=Tabliczka handlowa nie jest dostepna dla Ciebie. +tradeSignEmptyOwner=Nie ma nic do pobrania z tej tabliczki. +treeFailure=\u00a7cUtworzenie drzewa nie powiodlo sie, sprobuj na trawie lub ziemi. +treeSpawned=\u00a77Drzewo utworzono. +true=prawda +typeTpaccept=\u00a77Aby zaakceptowac teleport, wpisz \u00a7c/tpaccept\u00a77. +typeTpdeny=\u00a77Aby odmowic teleportacji, wpisz \u00a7c/tpdeny\u00a77. +typeWorldName=\u00a77Mozesz rowniez wpisac nazwe danego swiata. +unableToSpawnMob=Nie udalo sie stworzyc potwora. +unbannedIP=Odbanowana gracza o danym adresie IP. +unbannedPlayer=Odbanowano gracza. +unignorePlayer=Nie ignorujesz juz gracza {0}. +unknownItemId=Nieznane id przedmiotu: {0}. +unknownItemInList=Nieznany przedmiot {0} w liscie {1} . +unknownItemName=Nieznana nazwa przedmiotu: {0}. +unlimitedItemPermission=\u00a7cBrak uprawnien dla nielimitowanego przedmiotu {0}. +unlimitedItems=Nielimitowane przedmioty: +unmutedPlayer=Gracz {0} moze znowu mowic. +upgradingFilesError=Wystapil blad podczas upgradu plikow. +userDoesNotExist=Uzytkownik {0} nie istnieje w bazie danych. +userIsAway={0} jest teraz AFK. +userIsNotAway={0} nie jest juz AFK. +userJailed=\u00a77Zostales skazany. +userUsedPortal={0} uzyl istniejacego portalu wyjscia. +userdataMoveBackError=Nie udalo sie przeniesc userdata/{0}.tmp do userdata/{1} +userdataMoveError=Nie udalo sie przeniesc userdata/{0} do userdata/{1}.tmp +usingTempFolderForTesting=Uzywam tymczasowego folderu dla testu: +versionMismatch=Niepoprawna wersja! Prosze ulepszyc {0} do tej samej wersji co inne pliki. +versionMismatchAll=Niepoprawna wersja! Prosze ulepszyc wszystkie pliki Essentials do tej samej wersji. +voiceSilenced=\u00a77Twe usta zostaly zaszyte. +warpDeleteError=Wystapil problem podczas usuwania pliku z Warpami. +warpListPermission=\u00a7cNie masz pozwolenia na sprawdzenie listy Warpow.. +warpNotExist=Ten Warp nie istnieje. +warpOverwrite=\u00a7cNie mozesz nadpisac tego Warpa. +warpSet=\u00a77Warp {0} stworzony. +warpUsePermission=\u00a7cNie masz pozwolenie na korzystanie z tego Warpa. +warpingTo=\u00a77Teleportuje do {0}. +warps=Warpy: {0} +warpsCount=\u00a77Istnieje {0} warpow. Pokazuje strone {1} z {2}. +weatherStorm=\u00a77Ustawiles burzowa pogode w {0}. +weatherStormFor=\u00a77Ustawiles burzowa pogode w {0} na {1} sekund. +weatherSun=\u00a77Ustawiles bezchmurna pogode w {0}. +weatherSunFor=\u00a77Ustawiles bezchmurna pogode w {0} na {1} sekund. +whoisBanned=\u00a79 - Zbanowany: {0}. +whoisExp=\u00a79 - Punkty Doswiadczenia: {0} (Poziom {1}). +whoisGamemode=\u00a79 - Tryb Gry: {0}. +whoisGeoLocation=\u00a79 - Lokacja: {0}. +whoisGod=\u00a79 - Godmode: {0}. +whoisHealth=\u00a79 - Zycie: {0}/20. +whoisIPAddress=\u00a79 - Adres IP: {0}. +whoisIs={0} jest {1}. +whoisJail=\u00a79 - W wiezieniu: {0}. +whoisLocation=\u00a79 - Lokacja: ({0}, {1}, {2}, {3}) +whoisMoney=\u00a79 - Pieniadze: {0}. +whoisOP=\u00a79 - OP: {0} +whoisStatusAvailable=\u00a79 - Status: Dostepny +whoisStatusAway=\u00a79 - Status: \u00a7cNieobecny\u00a7f +worth=\u00a77Stack {0} jest warty \u00a7c{1}\u00a77 ({2}rzedmiot(y) po {3} kazdy) +worthMeta=\u00a77Stack {0} z metadata {1} jest warty \u00a7c{2}\u00a77 ({3} przedmiot(y) po {4} kazdy) +worthSet=Cena przedmiotu ustawiona. +year=rok +years=lat +youAreHealed=\u00a77Zostales/las uleczony/na. +youHaveNewMail=\u00a7cMasz {0} wiadomosci!\u00a7f napisz \u00a77/mail read\u00a7f aby je przeczytac. +exp=\u00a7c{0} \u00a77has\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) and needs\u00a7c {3} \u00a77more exp to level up. +expSet=\u00a7c{0} \u00a77now has\u00a7c {1} \u00a77exp. +unvanished=\u00a7aYou are once again visible. +unvanishedReload=\u00a7cA reload has forced you to become visible. +vanished=\u00a7aYou have now been vanished. +tps=Current TPS = {0} +hatPlaced=\u00a7eEnjoy your new hat! +hatFail=\u00a7cYou must have something to wear in your hand. +hatArmor=\u00a7cError, you cannot use armor as a hat! diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties new file mode 100644 index 000000000..2a6260f1c --- /dev/null +++ b/Essentials/src/messages_pt.properties @@ -0,0 +1,434 @@ +#version: TeamCity +# Single quotes have to be doubled: '' +# Translations start here +# by: FurmigaHumana, completed by Iaccidentally +action=* {0} {1} +addedToAccount=\u00a7a{0} foi adicionado a sua conta. +addedToOthersAccount=\u00a7a{0} adicionado a {1}\u00a7a saldo. Novo saldo: {2} +alertBroke=Quebrou: +alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} em: {3} +alertPlaced=Colocou: +alertUsed=Usou: +autoAfkKickReason=Voc\u00ea foi kickado por estar inativo a mais de {0} minutos. +backAfterDeath=\u00a77Use o comando /back para voltar onde morreu. +backUsageMsg=\u00a77Retornando a posi\u00e7ao anterior... +backupDisabled=Um script de backup externo nao foi configurado. +backupFinished=Backup conclu\u00eddo +backupStarted=Backup iniciado +balance=\u00a77Saldo: {0} +balanceTop=\u00a77 Saldos superiores ({0}) +banExempt=\u00a7cVoc\u00ea nao pode banir este jogador. +banIpAddress=\u00a77Endere\u00e7o de IP banido +bannedIpsFileError=Erro ao ler o arquivo banned-ips.txt +bannedIpsFileNotFound=banned-ips.txt nao encontrado +bannedPlayersFileError=Erro ao ler o arquivo banned-players.txt +bannedPlayersFileNotFound=banned-players.txt nao encontrado +bigTreeFailure=\u00a7cFalha na gera\u00e7ao da \u00e1rvore grande. Tente de novo na terra ou grama. +bigTreeSuccess= \u00a77\u00c1rvore grande gerada. +blockList=Essentials passou o seguinte comando a outro plugin: +broadcast=[\u00a7cBroadcast\u00a7f]\u00a7a {0} +buildAlert=\u00a7cVoc\u00ea nao tem permissao de construir. +bukkitFormatChanged=Bukkit: formato da versao alterada. Versao nao verificada. +burnMsg=\u00a77Voc\u00ea {0} foi incendiado por {1} segundos. +canTalkAgain=\u00a77Voc\u00ea pode falar de novo +cantFindGeoIpDB=Nao foi poss\u00edvel encontrar o GeoIP database! +cantReadGeoIpDB=Falhou em ler a GeoIP database! +cantSpawnItem=\u00a7cVoc\u00ea nao tem permissao de pegar este item {0} +chatTypeLocal=[L] +chatTypeSpy=[Spy] +commandFailed=Comando {0} falhou: +commandHelpFailedForPlugin=Erro ao obter ajuda para: {0} +commandNotLoaded=\u00a7cCommando {0} provavelmente esta carregado. +compassBearing=\u00a77Inclina\u00e7ao: {0} ({1} graus). +configFileMoveError=Falha ao mover arquivo config.yml ao local de backup. +configFileRenameError=Falha em renomear arquivo temporario em config.yml +connectedPlayers=Jogadores conectados: +connectionFailed=Falha ao abrir conexao. +cooldownWithMessage=\u00a7cTempo de espera: {0} +corruptNodeInConfig=\u00a74Aviso: Seu arquivo de configura\u00e7ao tem uma parte {0} corrompida. +couldNotFindTemplate=Nao foi poss\u00edvel encontrar o modelo {0} +creatingConfigFromTemplate=Criando arquivo de configura\u00e7ao com o modelo: {0} +creatingEmptyConfig=Criando arquivo de configura\u00e7ao vazio: {0} +creative=creative +currency={0}{1} +currentWorld=Current World: {0} +day=dia +days=dias +defaultBanReason=O martelo proibicao falou! +deleteFileError=Nao \u00e9 poss\u00edvel deletar arquivo: {0} +deleteHome=\u00a77Casa {0} foi removida. +deleteJail=\u00a77prisao {0} foi removida. +deleteWarp=\u00a77Warp {0} foi removido. +deniedAccessCommand={0} Acesso negado ao comando. +dependancyDownloaded=[Essentials] Dependencia {0} baixada com sucesso. +dependancyException=[Essentials] Ocorreu um erro ao tentar baixar uma dependencia +dependancyNotFound=[Essentials] Uma dependencia necess\u00e1ria nao foi encontrada. Baixando agora. +depth=\u00a77Voc\u00ea esta no nivel do mar. +depthAboveSea=\u00a77Voc\u00ea esta a {0} bloco(s) acima do nivel do mar. +depthBelowSea=\u00a77Voc\u00ea esta a {0} bloco(s) abaixo do nivel do mar. +destinationNotSet=Destino nao definido. +disableUnlimited=\u00a77Desativada itens ilimitados de {0} para {1}. +disabled=desativado +disabledToSpawnMob=Desovar este mob esta desativado nas configura\u00e7\u00f5es. +dontMoveMessage=\u00a77Teleporte vai come\u00e7ar em {0}. Nao se mova. +downloadingGeoIp=Baixando GeoIP database ... pode demorar um pouco (Pais: 0.6 MB, Cidade: 20MB) +duplicatedUserdata=Dado de usu\u00e1rio duplicado: {0} e {1} +enableUnlimited=\u00a77Colocando quantidade ilimitada de {0} para {1}. +enabled=ativado +enchantmentApplied = \u00a77O encantamento {0} foi aplicado ao item na sua mao. +enchantmentNotFound = \u00a7cEncantamento nao encontrado. +enchantmentPerm = \u00a7cVoc\u00ea nao tem permissao para {0} +enchantmentRemoved = \u00a77O encantamento {0} foi removido do item na sua mao. +enchantments = \u00a77Encantamentos: {0} +errorCallingCommand=Erro no comando /{0} +errorWithMessage=\u00a7cErro: {0} +essentialsHelp1=O arquivo esta quebrado e o essentials nao consegue abrilo. Essentials esta desativado agora. Se voc\u00ea nao consegue arrumar o arquivo, va para http://tiny.cc/EssentialsChat +essentialsHelp2=O arquivo esta quebrado e o essentials nao consegue abrilo. Essentials esta desativado agora. Se voc\u00ea nao consegue arrumar o arquivo, tente digitar /essentialshelp no jogo ou va para http://tiny.cc/EssentialsChat +essentialsReload=\u00a77Essentials recarregado {0} +extinguish=\u00a77Voce se extinguiu. +extinguishOthers=\u00a77Voce foi extinguido {0}. +failedToCloseConfig=Falha em fechar o arquivo de configura\u00e7ao {0} +failedToCreateConfig=Falha em criar o arquivo de configura\u00e7ao {0} +failedToWriteConfig=Falha em escrever no arquivo de configura\u00e7ao {0} +false=falso +feed=\u00a77Seu apetite foi saciado. +feedOther=\u00a77Satisfeito {0}. +fileRenameError=Falha ao renomear o arquivo {0}. +flyMode=\u00a77Definir o modo de voar {0} para {1}. +foreverAlone=\u00a7cVoc\u00ea nao tem ninguem a quem responder. +freedMemory=Livre {0} MB. +gameMode=\u00a77Gamemode {0} definido para {1}. +gcchunks= chunks, +gcentities= entidades +gcfree=Memoria livre: {0} MB +gcmax=Mem\u00f3ria Maxima: {0} MB +gctotal=Mem\u00f3ria alocada: {0} MB +geoIpUrlEmpty=GeoIP url de download esta vazia. +geoIpUrlInvalid=GeoIP url de download e invalida. +geoipJoinFormat=Jogador {0} veio do {1} +godDisabledFor=desativado para {0} +godEnabledFor=ativado para {0} +godMode=\u00a77Modo Deus {0}. +haveBeenReleased=\u00a77Voc\u00ea foi liberado. +heal=\u00a77Voc\u00ea foi curado. +healOther=\u00a77Curado {0}. +helpConsole=Para ver ajuda do console, digite ?. +helpFrom=\u00a77Comandos a partir de {0}: +helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Comandos correspondentes "{0}": +helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} +helpPages=P\u00e1gina \u00a7c{0}\u00a7f of \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Plugin Help: /help {1} +holeInFloor=Buraco no chao +homeSet=\u00a77Casa definida. +homeSetToBed=\u00a77Sua casa agora esta definida a esta cama. +homes=Casa: {0} +hour=hora +hours=horas +ignorePlayer=Voc\u00ea esta ignorando o jogador {0} agora. +illegalDate=Formato de data \u00edlegal. +infoChapter=Selecione o cap\u00edtulo: +infoChapterPages=Cap\u00edtulo {0}, pagina \u00a7c{1}\u00a7f de \u00a7c{2}\u00a7f: +infoFileDoesNotExist=Arquivo info.txt nao existe. Criando um para voc\u00ea. +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Page \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- +infoUnknownChapter=Cap\u00edtulo desconhecido. +invBigger=O invent\u00e1rio do outro usu\u00e1rio e maior que o seu. +invRestored=Seu invent\u00e1rio foi restaurado. +invSee=Voc\u00ea v\u00ea o invent\u00e1rio de {0}. +invSeeHelp=Use /invsee para voltar ao seu invent\u00e1rio. +invalidCharge=\u00a7cCarga invalida. +invalidHome=Home {0} nao existe +invalidMob=Tipo de mob inv\u00e1lido. +invalidServer=Servidor inv\u00e1lido! +invalidSignLine=Linha {0} da placa e inv\u00e1lida. +invalidWorld=\u00a7cMundo inv\u00e1lido. +inventoryCleared=\u00a77Invent\u00e1rio limpo. +inventoryClearedOthers=\u00a77Invent\u00e1rio de \u00a7c{0}\u00a77 limpo. +is=\u00e9 +itemCannotBeSold=Este item nao pode ser vendido para o servidor. +itemMustBeStacked=O item deve ser negociado em pacotes. A qantidade de 2s seria dois pacotes, etc. +itemNotEnough1=\u00a7cVoc\u00ea nao tem esta quantidade de itens para vender. +itemNotEnough2=\u00a77Se voc\u00ea quer vender todos os itens deste tipo, use /sell NomeDoItem +itemNotEnough3=\u00a77/sell NomeDoItem -1 vai vender tudo mais um item, etc. +itemSellAir=Voc\u00ea realmente tentou vender ar? Coloque um item na sua mao. +itemSold=\u00a77Vendido para \u00a7c{0} \u00a77({1} {2} a {3} cada) +itemSoldConsole={0} vendido {1} para \u00a77{2} \u00a77({3} itens a {4} cada) +itemSpawn=\u00a77Dando {0} de {1} +itemsCsvNotLoaded=nao foi poss\u00edvel carregar items.csv. +jailAlreadyIncarcerated=\u00a7cEsta pessoa j\u00e1 esta na cadeia: {0} +jailMessage=\u00a7cVoc\u00ea faz o crime, voc\u00ea cumpre a pena. +jailNotExist=esta cadeia nao existe. +jailReleased=\u00a77Player \u00a7e{0}\u00a77 libertado. +jailReleasedPlayerNotify=\u00a77Voc\u00ea foi solto! +jailSentenceExtended=Tempo de prisao estendido para: {0) +jailSet=\u00a77Cela {0} foi definida +jumpError=Isso prejudica o c\u00e9rebro do seu computador. +kickedAll=\u00a7cKicked all players from server +kickDefault=Kickado do servidor. +kickExempt=\u00a7cVoc\u00ea nao pode kickar esta pessoa. +kill=\u00a77Assassinado {0}. +kitError2=\u00a7cEsse kit nao existe ou foi definido impropiamente. +kitError=\u00a7cNao existe kits v\u00e1lidos. +kitErrorHelp=\u00a7cTalvez um item esta faltando a quantidade nas configura\u00e7\u00f5es? +kitGive=\u00a77Dando kit {0}. +kitInvFull=\u00a7cSeu invent\u00e1rio esta cheio, colocando kit no chao +kitTimed=\u00a7cVoc\u00ea nao pode usar este kit denovo por {0}. +kits=\u00a77Kits: {0} +lightningSmited=\u00a77YVoc\u00ea acaba de ser castigado +lightningUse=\u00a77Castigando {0} +listAfkTag = \u00a77[Ausente]\u00a7f +listAmount = \u00a79Aqui tem \u00a7c{0}\u00a79 do m\u00e1ximo de \u00a7c{1}\u00a79 jogadores online. +listAmountHidden = \u00a79Aqui tem \u00a7c{0}\u00a77/{1}\u00a79 do maximo de \u00a7c{2}\u00a79 jogadores online. +listGroupTag={0}\u00a7f: +listHiddenTag = \u00a77[ESCONDIDO]\u00a7f +loadWarpError=Falha ao carregar warp {0} +localFormat=Local: <{0}> {1} +mailClear=\u00a7cPara marcar seu email como lido, use /mail clear +mailCleared=\u00a77eMail limpo! +mailSent=\u00a77eMail enviado! +markMailAsRead=\u00a7cPara marcar seu email como lido, use /mail clear +markedAsAway=\u00a77[AFK] Agora voc\u00ea esta marcado como aus\u00eante. +markedAsNotAway=\u00a77[AFK] Voc\u00ea nao esta mais marcado como aus\u00eante. +maxHomes=Voc\u00ea nao pode definir mais de {0} casas. +mayNotJail=\u00a7cVoc\u00ea nao pode prender esta pessoa +me=eu +minute=minuto +minutes=minutos +missingItems=Voc\u00ea nao tem {0}x {1}. +missingPrefixSuffix=Faltando um prefixo ou sufixo para {0} +mobSpawnError=Erro ao mudar o mob spawner. +mobSpawnLimit=Quantidade de mob limitada pelo servidor +mobSpawnTarget=Bloco de destino deve ser um mob spawner. +mobsAvailable=\u00a77Mobs: {0} +moneyRecievedFrom=\u00a7a{0} foi recebido de {1} +moneySentTo=\u00a7a{0} foi enviado para {1} +moneyTaken={0} tirado da sua conta. +month=m\u00eas +months=meses +moreThanZero=Quantidade deve ser maior que 0. +msgFormat=\u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} +muteExempt=\u00a7cVoc\u00ea nao pode mutar este jogador. +mutedPlayer=Player {0} mutado. +mutedPlayerFor=Player {0} mutado por {1}. +mutedUserSpeaks={0} tentou falar, mas esta mutado. +nearbyPlayers=Jogadores por perto: {0} +negativeBalanceError=Nao \u00e9 permitido ter um saldo negativo. +nickChanged=Apelido modificado. +nickDisplayName=\u00a77Voc\u00ea deve ativar change-displayname nas configura\u00e7\u00f5es do Essentials. +nickInUse=\u00a7cEste nome j\u00e1 esta em uso. +nickNamesAlpha=\u00a7cApelidos devem ser alfanumericos. +nickNoMore=\u00a77Voc\u00ea nao tem mais um apelido. +nickOthersPermission=\u00a7cVoc\u00ea nao tem permissao para mudar o apelido dos outros. +nickSet=\u00a77Agora seu apelido \u00e9 \u00a7c{0} +noAccessCommand=\u00a7cVoc\u00ea nao tem acesso a este comando. +noAccessPermission=\u00a7cVoc\u00ea nao tem permissao para acessar isso {0}. +noBreakBedrock=Voce nao tem permissao para destruir bedrock. +noDestroyPermission=\u00a7cVoc\u00ea nao tem permissao para destruir isso {0}. +noGodWorldWarning=\u00a7cAviso! Modo Deus neste mundo esta desativado. +noHelpFound=\u00a7cNenhum comando correspondente. +noHomeSet=Voc\u00ea nao definiu nenhuma casa. +noHomeSetPlayer=Jogador nao definiu nenhuma casa. +noKitPermission=\u00a7cVoc\u00ea precisa da permissao \u00a7c{0}\u00a7c para usar este kit. +noKits=\u00a77Ainda nao tem nenhum item disponivel +noMail=Voc\u00ea nao tem nenhum email +noMotd=\u00a7cNao h\u00e1 nenhuma mensagem do dia. +noNewMail=\u00a77Voc\u00ea nao tem nenhum novo email. +noPendingRequest=Voc\u00ea nao tem um pedido pendente. +noPerm=\u00a7cVoc\u00ea nao tem a permissao \u00a7f{0}\u00a7c. +noPermToSpawnMob=\u00a7cVoc\u00ea nao tem permissao para desovar este mob. +noPlacePermission=\u00a7cVoc\u00ea nao tem permissao de por um bloco perto daquela placa. +noPowerTools=Voc\u00ea nao tem nenhuma super ferramenta definida. +noRules=\u00a7cAinda nao foi definida as regras. +noWarpsDefined=Nenhum warp definido +none=nenhum +notAllowedToQuestion=\u00a7cVoc\u00ea nao esta autorizado a usar pergunta. +notAllowedToShout=\u00a7cVoc\u00ea nao esta autorizado a gritar. +notEnoughExperience=Voc\u00ea nao tem experiencia suficiente. +notEnoughMoney=Voc\u00ea nao tem dinheiro suficiente. +notRecommendedBukkit=* ! * Versao do bukkit nao \u00e9 a recomendada para o essentials. +notSupportedYet=Ainda nao suportado. +nothingInHand = \u00a7cVoc\u00ea nao tem nada em sua mao. +now=agora +nuke=Pode chover a morte sobre eles +numberRequired=Um numero vai aqui, bobinho. +onlyDayNight=/time apenas suporta day/night. +onlyPlayers=Apenas jogadores no jogo pode usar {0}. +onlySunStorm=/weather apenas suporta sun/storm. +orderBalances=Ordenando saldos de {0} usuarios, aguarde ... +pTimeCurrent=\u00a7e{0}''s\u00a7f horario e {1}. +pTimeCurrentFixed=\u00a7e{0}''s\u00a7f hor\u00e1rio foi fixado para {1}. +pTimeNormal=\u00a7e{0}''s\u00a7f o tempo esta normal e sincronisado com o servidor. +pTimeOthersPermission=\u00a7cVoc\u00ea nao esta autorisado para definir o tempo dos outros jogadores. +pTimePlayers=Estes jogadores tem seus propios hor\u00e1rios: +pTimeReset=Hor\u00e1rio do jogador foi recetado para: \u00a7e{0} +pTimeSet=Hor\u00e1rio do jogador foi definido para \u00a73{0}\u00a7f por: \u00a7e{1} +pTimeSetFixed=Hor\u00e1rio do jogador foi fixado para \u00a73{0}\u00a7f por: \u00a7e{1} +parseError=Analise de erro {0} na linha {1} +pendingTeleportCancelled=\u00a7cPedido de teleporte pendente cancelado. +permissionsError=Faltando Permissions/GroupManager; chat prefixos/sufixos serao desativados. +playerBanned=\u00a7cJogador {0} banido {1} por {2} +playerInJail=\u00a7cJogador j\u00e1 esta na cadeia {0}. +playerJailed=\u00a77Jogador {0} preso. +playerJailedFor= \u00a77Player {0} condenado por {1}. +playerKicked=\u00a7cPlayer {0} kickado {1} por {2} +playerMuted=\u00a77Voce foi desmutado +playerMutedFor=\u00a77Voce foi mutado por {0} +playerNeverOnServer=\u00a7cJogador {0} nunca esteve no servidor. +playerNotFound=\u00a7cJogador nao encontrado. +playerUnmuted=\u00a77Foi desmutado +pong=Pong! +possibleWorlds=\u00a77Mundos poss\u00edveis sao 0 at\u00e9 {0}. +powerToolAir=Comando nao pode ser definido para o ar. +powerToolAlreadySet=Comando \u00a7c{0}\u00a7f j\u00e1 esta definido para {1}. +powerToolAttach=\u00a7c{0}\u00a7f comando definido para {1}. +powerToolClearAll=Todas superferramentas foram limpas. +powerToolList={1} tem os seguintes comandos: \u00a7c{0}\u00a7f. +powerToolListEmpty={0} nenhum comando definido. +powerToolNoSuchCommandAssigned=Comando \u00a7c{0}\u00a7f nao foi definido para {1}. +powerToolRemove=Comando \u00a7c{0}\u00a7f removido do {1}. +powerToolRemoveAll=Todos comandos removidos do {0}. +powerToolsDisabled=Todas suas super ferramentas foram habilitadas. +powerToolsEnabled=Todas suas super ferramentas foram desabilitadas. +protectionOwner=\u00a76[EssentialsProtect] Dono da prote\u00e7ao: {0} +questionFormat=\u00a77[Pergunta]\u00a7f {0} +readNextPage=Digite /{0} {1} para ler a pr\u00f3xima p\u00e1gina +reloadAllPlugins=\u00a77Todos plugins recarregados. +removed=\u00a77Removido {0} entidades. +repair=Voc\u00ea reparou com sucesso sua: \u00a7e{0}. +repairAlreadyFixed=\u00a77Esse item nao precisa ser reparado. +repairEnchanted=\u00a77Voc\u00ea nao pode reparar itens encantados. +repairInvalidType=\u00a7cEsse item nao pode ser reparado. +repairNone=Nao ha itens que precisam ser reparados. +requestAccepted=\u00a77Pedido de teleporte aceito. +requestAcceptedFrom=\u00a77{0} aceitou seu pedido de teleporte. +requestDenied=\u00a77Pedido de teleporte recusado. +requestDeniedFrom=\u00a77{0} recusou seu pedido de teleporte +requestSent=\u00a77Pedindo enviado para {0}\u00a77. +requestTimedOut=\u00a7cPedido de teleporte passou o limite de tempo +requiredBukkit=* ! * Voc\u00ea precisa da ultima build {0} do CraftBukkit, baixa ela em http://dl.bukkit.org/downloads/craftbukkit/ +returnPlayerToJailError=Erro ocorreu ao tentar retornar jogador {0} para a cadeia: {1} +second=segundo +seconds=segundos +seenOffline=Jogador {0} esta offline desde {1} +seenOnline=Jogador {0} esta online desde {1} +serverFull=O servidor esta cheio +serverTotal=Server Total: {0} +setSpawner=Spawner modificado para {0} +sheepMalformedColor=Cor malformada. +shoutFormat=\u00a77[GRITAR]\u00a7f {0} +signFormatFail=\u00a74[{0}] +signFormatSuccess=\u00a71[{0}] +signFormatTemplate=[{0}] +signProtectInvalidLocation=\u00a74Voc\u00ea nao pode criar placas aqui. +similarWarpExist=Um warp com um nome parecido j\u00e1 existe. +slimeMalformedSize=Tamanho malformado. +soloMob=Este mob gosta de ficar sozinho +spawnSet=\u00a77Ponto de spawn definido para o grupo {0}. +spawned=desovado +sudoExempt=voce nao pode sudo este usuario +sudoRun=Forcing {0} to run: /{1} {2} +suicideMessage=\u00a77Adeus mundo cruel... +suicideSuccess= \u00a77{0} tirou sua propia vida +survival=survival +takenFromAccount=\u00a7c{0} foi tirado da sua conta. +takenFromOthersAccount=\u00a7c{0} tirado de {1}\u00a7c conta. Novo saldo: {2} +teleportAAll=\u00a77Pedido de teleporte enviado a todos os jogadores... +teleportAll=\u00a77Teleportando todos os jogadores... +teleportAtoB=\u00a77{0}\u00a77 teleportou voc\u00ea para {1}\u00a77. +teleportDisabled={0} tem o teleporte desativado. +teleportHereRequest=\u00a7c{0}\u00a7c solicitou que voc\u00ea se teleporte para ele. +teleportNewPlayerError=Falha para teleportar novo jogador +teleportRequest=\u00a7c{0}\u00a7c solicitou para se teleportar at\u00e9 voc\u00ea. +teleportRequestTimeoutInfo=\u00a77Este pedido vai acabar em {0} segundos. +teleportTop=\u00a77Teleportando para o alto. +teleportationCommencing=\u00a77Iniciando teleporte... +teleportationDisabled=\u00a77Teleporte desativado. +teleportationEnabled=\u00a77Teleporte ativado. +teleporting=\u00a77Teleportando... +teleportingPortal=\u00a77Teleportando via portal. +tempBanned=Banido temporariamente do servidor por {0} +tempbanExempt=\u00a77Voc\u00ea nao pode banir este jogador temporariamente +thunder= Voc\u00ea {0} trovejou no seu mundo +thunderDuration=Voc\u00ea {0} trovejou no seu mundo por {1} segundos. +timeBeforeHeal=Tempo at\u00e9 a proxima cura: {0} +timeBeforeTeleport=Tempo antes do proximo teleporte: {0} +timeFormat=\u00a73{0}\u00a7f or \u00a73{1}\u00a7f or \u00a73{2}\u00a7f +timePattern=(?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? +timeSet=Horario definido em todos os mundos. +timeSetPermission=\u00a7cVoc\u00ea nao tem autoriza\u00e7ao para modificar o hor\u00e1rio. +timeWorldCurrent=O hor\u00e1rio atual no mundo {0} e \u00a73{1} +timeWorldSet=O hor\u00e1rio foi definido para {0} no: \u00a7c{1} +tradeCompleted=\u00a77Compra concluida. +tradeSignEmpty=A placa de troca nao tem abastecimento suficiente. +tradeSignEmptyOwner=Nao a nada para recolher desta placa de compra. +treeFailure=\u00a7cFalha ao gerar \u00e1rvore. Tente denovo na terra ou grama. +treeSpawned=\u00a77\u00c1rvore gerada. +true=verdadeiro +typeTpaccept=\u00a77Para aceitar o teleporte, digite \u00a7c/tpaccept\u00a77. +typeTpdeny=\u00a77Para recusar o teleporte, digite \u00a7c/tpdeny\u00a77. +typeWorldName=\u00a77Voc\u00ea tambem pode digitar o nome do mundo. +unableToSpawnMob=Incapaz de gerar o mob. +unbannedIP=Endereco de IP desbanido. +unbannedPlayer=Jogador desbanido. +unignorePlayer=Agora voc\u00ea nao esta mais ignorando o {0}. +unknownItemId=ID do item desconhecido: {0} +unknownItemInList=Item desconhecido {0} em {1} lista. +unknownItemName=Nome do item desconhecido: {0} +unlimitedItemPermission=\u00a7cSem permissao para item ilimitado {0}. +unlimitedItems=Item ilimitado: +unmutedPlayer=Jogador {0} desmutado. +upgradingFilesError=Erro ao aprimorar os arquivos +userDoesNotExist=O usu\u00e1rio {0} nao existe. +userIsAway=[AFK]: {0} esta aus\u00eante. +userIsNotAway=[AFK]: {0} nao esta mais aus\u00eante. +userJailed=\u00a77Voc\u00ea foi preso, muaha! +userUsedPortal={0} usou um portal de saida existente. +userdataMoveBackError=Falha ao mover userdata/{0}.tmp para userdata/{1} +userdataMoveError=Falha ao mover userdata/{0} para userdata/{1}.tmp +usingTempFolderForTesting=Usando pasta temporaria para teste: +versionMismatch=Versao incompativel! Atualise o {0} para mesma versao. +versionMismatchAll=Versao imcompativel! Atualise todos os essentials jars para mesma versao. +voiceSilenced=\u00a77Sua voz foi silenciada +warpDeleteError=Problema ao deletar o arquivo warp. +warpListPermission=\u00a7cVoc\u00ea nao tem permissao para listar os warps. +warpNotExist=Este warp nao existe. +warpOverwrite=\u00a7cVoce nao pode substituir essa warp. +warpSet=\u00a77Warp {0} definido. +warpUsePermission=\u00a7cVoc\u00ea nao tem permissao para usar este warp. +warpingTo=\u00a77Warping para {0}. +warps=Warps: {0} +warpsCount=\u00a77Aqui tem {0} warps. Exibindo p\u00e1gina {1} de {2}. +weatherStorm=\u00a77Voc\u00ea modificou o tempo para chuva em {0} +weatherStormFor=\u00a77Voc\u00ea modificou o tempo para chuva em {0} por {1} segundos +weatherSun=\u00a77Voc\u00ea modificou o tempo para sol em {0} +weatherSunFor=\u00a77Voc\u00ea modificou o tempo para sol em {0} por {1} segundos +whoisBanned=\u00a79 - Banido: {0} +whoisExp=\u00a79 - Exp: {0} (Level {1}) +whoisGamemode=\u00a79 - Gamemode: {0} +whoisGeoLocation=\u00a79 - Localiza\u00e7ao: {0} +whoisGod=\u00a79 - Modo Deus: {0} +whoisHealth=\u00a79 - Sa\u00fade: {0}/20 +whoisIPAddress=\u00a79 - IP: {0} +whoisIs={0} e {1} +whoisJail=\u00a79 - Jail: {0} +whoisLocation=\u00a79 - Localiza\u00e7ao: ({0}, {1}, {2}, {3}) +whoisMoney=\u00a79 - Dinheiro: {0} +whoisOP=\u00a79 - OP: {0} +whoisStatusAvailable=\u00a79 - Estado: Dispon\u00edvel +whoisStatusAway=\u00a79 - Estado: \u00a7cAway\u00a7f +worth=\u00a77Pilha de {0} vale \u00a7c{1}\u00a77 ({2} item(s) a {3} cada) +worthMeta=\u00a77Pilha de {0} com metadados de {1} vale \u00a7c{2}\u00a77 ({3} item(s) a {4} cada) +worthSet=Definir quanto vale +year=ano +years=anos +youAreHealed=\u00a77Voc\u00ea foi curado. +youHaveNewMail=\u00a7cVoc\u00ea tem {0} mensagens!\u00a7f Digite \u00a77/mail read\u00a7f para ver seu email. +exp=\u00a7c{0} \u00a77has\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) and needs\u00a7c {3} \u00a77more exp to level up. +expSet=\u00a7c{0} \u00a77now has\u00a7c {1} \u00a77exp. +unvanished=\u00a7aYou are once again visible. +unvanishedReload=\u00a7cA reload has forced you to become visible. +vanished=\u00a7aYou have now been vanished. +tps=Current TPS = {0} +hatPlaced=\u00a7eEnjoy your new hat! +hatFail=\u00a7cYou must have something to wear in your hand. +hatArmor=\u00a7cError, you cannot use armor as a hat! diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index 488abb02d..76e65e61f 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -49,7 +49,7 @@ commands: aliases: [ebroadcast,bcast,ebcast] bigtree: description: Spawn a big tree where you are looking. - usage: /<command> <tree|redwood> + usage: /<command> <tree|redwood|jungle> aliases: [ebigtree] burn: description: Set a player on fire. @@ -90,6 +90,11 @@ commands: essentials: description: Reloads essentials. usage: /<command> + aliases: [ess] + exp: + description: Give, set or look at a players exp. + usage: /<command> [show|set|give] [playername [amount]] + aliases: [eexp,xp] ext: description: Extinguish players. usage: /<command> [player] @@ -98,6 +103,10 @@ commands: description: Satisfy the hunger. usage: /<command> [player] aliases: [efeed,eat,eeat] + fly: + description: Take off, and soar! + usage: /<command> [player] + aliases: [efly] itemdb: description: Searches for an item. usage: /<command> <item> @@ -115,9 +124,9 @@ commands: usage: /<command> [player] aliases: [coords,egetpos,position,eposition,whereami,ewhereami] gc: - description: Reports garbage collection info; useful to developers. + description: Reports garbage collection and tick info; useful to developers. usage: /<command> - aliases: [mem,memory,egc,emem,ememory] + aliases: [elag,lag,mem,memory,egc,emem,ememory] give: description: Give a player an item. usage: /<command> <player> <item|numeric> [amount <enchantmentname[:level]> ...] @@ -126,6 +135,10 @@ commands: description: Enables your godly powers. usage: /<command> [player] aliases: [tgm,godmode,egod,etgm,egodmode] + hat: + description: Get some cool new headgear + usage: /<command> + aliases: [ehat] heal: description: Heals you or the given player. usage: /<command> [player] @@ -176,7 +189,7 @@ commands: aliases: [ekickall] kit: description: Obtains the specified kit or views all available kits. - usage: /<command> [kit] + usage: /<command> [kit] [player] aliases: [ekit,kits,ekits] kill: description: Kills specified player. @@ -185,7 +198,10 @@ commands: killall: description: Kill all mobs in a world. usage: /<command> [mobType] [radius] - aliases: [ekillall,butcher,ebutcher] + aliases: [ekillall,butcher,ebutcher,mobkill,emobkill] + kittycannon: + description: Throw an exploding kitten at your opponent + usage: /<command> kittycannon: description: Throw an exploding kitten at your opponent usage: /<command> @@ -199,7 +215,7 @@ commands: aliases: [strike,smite,thor,shock,elightning,estrike,esmite,ethor,eshock] mail: description: Manages inter-player, intra-server mail. - usage: /<command> [read|clear|send [to] [message]] + usage: /<command> [read|clear|send [to] [message]|sendall [message]] aliases: [email] me: description: Describes an action in the context of the player. @@ -242,8 +258,8 @@ commands: usage: /<command> aliases: [pong,echo,echo,eping,epong] powertool: - description: Assigns a command to the item in hand, {player} will be replaced by the name of the player that you click. - usage: /<command> [l:|a:|r:|c:|d:][command] [arguments] + description: Assigns a command to the item in hand. + usage: /<command> [l:|a:|r:|c:|d:][command] [arguments] - {player} can be replaced by name of a clicked player. aliases: [pt,epowertool,ept] powertooltoggle: description: Enables or disables all current powertools @@ -258,7 +274,7 @@ commands: usage: /<command> <message> aliases: [er,reply,ereply] realname: - description: Displays the username of a user based on nickname. + description: Displays the username of a user based on nick. usage: /<command> <nickname> aliases: [erealname] remove: @@ -312,11 +328,11 @@ commands: spawner: description: Change the mob type of a spawner usage: /<command> <mob> - aliases: [espawner] + aliases: [espawner,changems,echangems] spawnmob: description: Spawns a mob. usage: /<command> <mob>[:data][,<mount>[:data]] [amount] [player] - aliases: [espawnmob] + aliases: [espawnmob,mob,emob] sudo: description: Make another user perform a command. usage: /<command> <player> <command [args]> @@ -338,7 +354,7 @@ 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 jail specified + description: Jails/Unjails a player and tp them to the jail specified. usage: /<command> <player> <jailname> [datediff] aliases: [tjail,jail,ejail,unjail,eunjail,etogglejail] top: @@ -379,7 +395,7 @@ commands: aliases: [s,etphere] tpo: description: Teleport override for tptoggle. - usage: /<command> <player> + usage: /<command> <player> [otherplayer] aliases: [etpo] tpohere: description: Teleport here override for tptoggle. @@ -395,7 +411,7 @@ commands: aliases: [etptoggle] tree: description: Spawn a tree where you are looking. - usage: /<command> <tree|birch|redwood> + usage: /<command> <tree|birch|redwood|redmushroom|brownmushroom|jungle|junglebush|swamp> aliases: [etree] unban: description: Unbans the specified player. @@ -409,6 +425,10 @@ commands: description: Allows the unlimited placing of items. usage: /<command> <list|item|clear> [player] aliases: [eunlimited,ul,unl,eul,eunl] + vanish: + description: Hide yourself from other players. + usage: /<command> + aliases: [evanish] warp: description: List all warps or warp to the specified location. usage: /<command> <pagenumber|warp> [player] diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java index d673963c5..d8ce82439 100644 --- a/Essentials/test/com/earth2me/essentials/FakeServer.java +++ b/Essentials/test/com/earth2me/essentials/FakeServer.java @@ -19,6 +19,9 @@ import org.bukkit.event.inventory.InventoryType; import org.bukkit.help.HelpMap; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryHolder; +import org.bukkit.help.HelpMap; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.Recipe; import org.bukkit.map.MapView; @@ -901,4 +904,22 @@ public class FakeServer implements Server { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public int getMonsterSpawnLimit() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getAnimalSpawnLimit() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getWaterAnimalSpawnLimit() + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/test/com/earth2me/essentials/FakeWorld.java b/Essentials/test/com/earth2me/essentials/FakeWorld.java index faf0c21e8..1af6fd3cf 100644 --- a/Essentials/test/com/earth2me/essentials/FakeWorld.java +++ b/Essentials/test/com/earth2me/essentials/FakeWorld.java @@ -629,7 +629,43 @@ public class FakeWorld implements World } @Override - public void setBiome(int x, int z, Biome bio) + public void setBiome(int arg0, int arg1, Biome arg2) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMonsterSpawnLimit() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMonsterSpawnLimit(int arg0) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getAnimalSpawnLimit() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAnimalSpawnLimit(int arg0) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getWaterAnimalSpawnLimit() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setWaterAnimalSpawnLimit(int arg0) { throw new UnsupportedOperationException("Not supported yet."); } diff --git a/Essentials/test/com/earth2me/essentials/UtilTest.java b/Essentials/test/com/earth2me/essentials/UtilTest.java index 94cd2877d..fb75d19b0 100644 --- a/Essentials/test/com/earth2me/essentials/UtilTest.java +++ b/Essentials/test/com/earth2me/essentials/UtilTest.java @@ -189,7 +189,7 @@ public class UtilTest extends TestCase assertEquals("_-", Util.sanitizeFileName("../")); assertEquals("_-", Util.sanitizeFileName("\"")); assertEquals("_-", Util.sanitizeFileName("<>?:*.")); - assertEquals("a-0fa", Util.sanitizeFileName("aรค")); + assertEquals("a-0fa", Util.sanitizeFileName("aไ")); } catch (InvalidNameException ex) diff --git a/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java b/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java index 0e8004895..0dc36e262 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java +++ b/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java @@ -1,7 +1,14 @@ package com.earth2me.essentials; import static com.earth2me.essentials.I18n._; +import com.google.common.io.Files; import java.io.*; +import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.channels.FileChannel; +import java.nio.charset.Charset; +import java.nio.charset.CharsetDecoder; +import java.nio.charset.CoderResult; import java.util.HashMap; import java.util.Locale; import java.util.Map; @@ -25,6 +32,7 @@ public class EssentialsConf extends YamlConfiguration private transient File configFile; private transient String templateName = null; private transient Class<?> resourceClass = EssentialsConf.class; + private static final Charset UTF8 = Charset.forName("UTF-8"); public EssentialsConf(final File configFile) { @@ -32,7 +40,7 @@ public class EssentialsConf extends YamlConfiguration this.configFile = configFile; } - public void load() + public synchronized void load() { configFile = configFile.getAbsoluteFile(); if (!configFile.getParentFile().exists()) @@ -105,15 +113,48 @@ public class EssentialsConf extends YamlConfiguration try { - super.load(configFile); - } - catch (FileNotFoundException ex) - { - LOGGER.log(Level.SEVERE, null, ex); + final FileInputStream inputStream = new FileInputStream(configFile); + try + { + final FileChannel channel = inputStream.getChannel(); + final ByteBuffer buffer = ByteBuffer.allocate((int)configFile.length()); + channel.read(buffer); + buffer.rewind(); + final CharBuffer data = CharBuffer.allocate((int)configFile.length()); + CharsetDecoder decoder = UTF8.newDecoder(); + CoderResult result = decoder.decode(buffer, data, true); + if (result.isError()) + { + buffer.rewind(); + data.clear(); + LOGGER.log(Level.INFO, "File " + configFile.getAbsolutePath().toString() + " is not utf-8 encoded, trying " + Charset.defaultCharset().displayName()); + decoder = Charset.defaultCharset().newDecoder(); + result = decoder.decode(buffer, data, true); + if (result.isError()) + { + throw new InvalidConfigurationException("Invalid Characters in file " + configFile.getAbsolutePath().toString()); + } + else + { + decoder.flush(data); + } + } + else + { + decoder.flush(data); + } + final int end = data.position(); + data.rewind(); + super.loadFromString(data.subSequence(0, end).toString()); + } + finally + { + inputStream.close(); + } } catch (IOException ex) { - LOGGER.log(Level.SEVERE, null, ex); + LOGGER.log(Level.SEVERE, ex.getMessage(), ex); } catch (InvalidConfigurationException ex) { @@ -302,27 +343,55 @@ public class EssentialsConf extends YamlConfiguration return def; } } - - public void save() { + + public void save() + { try { save(configFile); } catch (IOException ex) { - LOGGER.log(Level.SEVERE, null, ex); + LOGGER.log(Level.SEVERE, ex.getMessage(), ex); } } - - public Object getProperty(String path) { + + @Override + public synchronized void save(final File file) throws IOException + { + if (file == null) + { + throw new IllegalArgumentException("File cannot be null"); + } + + Files.createParentDirs(file); + + final String data = saveToString(); + + final OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file), UTF8); + + try + { + writer.write(data); + } + finally + { + writer.close(); + } + } + + public Object getProperty(String path) + { return get(path); } - - public void setProperty(String path, Object object) { + + public void setProperty(String path, Object object) + { set(path, object); } - - public void removeProperty(String path) { + + public void removeProperty(String path) + { set(path, null); } } diff --git a/Essentials2Compat/src/com/earth2me/essentials/EssentialsUpgrade.java b/Essentials2Compat/src/com/earth2me/essentials/EssentialsUpgrade.java index ccaa6e4a4..97338579d 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/EssentialsUpgrade.java +++ b/Essentials2Compat/src/com/earth2me/essentials/EssentialsUpgrade.java @@ -690,6 +690,17 @@ public class EssentialsUpgrade doneFile.save(); } + private void warnMetrics() + { + if (doneFile.getBoolean("warnMetrics", false)) + { + return; + } + ess.getSettings().setMetricsEnabled(false); + doneFile.setProperty("warnMetrics", true); + doneFile.save(); + } + public void beforeSettings() { if (!ess.getDataFolder().exists()) @@ -713,5 +724,6 @@ public class EssentialsUpgrade deleteOldItemsCsv(); updateSpawnsToNewSpawnsConfig(); updateJailsToNewJailsConfig(); + warnMetrics(); } } diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java index 8037234fd..6a86de1f1 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java @@ -142,6 +142,26 @@ public abstract class EssentialsChatPlayer implements Listener event.setFormat(_(format.toString(), event.getFormat())); return; } + if (!onlineUser.equals(sender)) + { + if (onlineUser.isAuthorized("essentials.chat.spy")) + { + type = type.concat(_("chatTypeSpy")); + } + else + { + final Location playerLoc = onlineUser.getLocation(); + if (playerLoc.getWorld() != world) + { + continue; + } + final double delta = playerLoc.distanceSquared(loc); + if (delta > chatStore.getRadius()) + { + continue; + } + } + } final StringBuilder errorMsg = new StringBuilder(); errorMsg.append("notAllowedTo").append(chatStore.getType().substring(0, 1).toUpperCase(Locale.ENGLISH)).append(chatStore.getType().substring(1)); diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 9d7187690..6f1b2e3b4 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -34,10 +34,10 @@ v 1.3: (for all worlds named in config.yml)
- Attempt to stop GM wiping groups/users yml's on a bad shut down.
- Added event handling to manage new world creation at runtime.
- - Added the ability to handle unknown worlds at server start. - (GM will create the data files for any worlds it finds which are not in the config.yml) + - Added the ability to handle unknown worlds at server start.
+ (GM will create the data files for any worlds it finds which are not in the config.yml)
- Fix for Bukkit passing a null To location on a player Portaling
- - Fixed manudelsub not correctly selecting the group to remove. + - Fixed manudelsub not correctly selecting the group to remove.
- Added two new permission nodes - groupmanager.notify.self & groupmanager.notify.other
These allow players/admins to be notified when players are moved between groups.
v 1.4:
diff --git a/EssentialsGroupManager/src/globalgroups.yml b/EssentialsGroupManager/src/globalgroups.yml index f21034237..04b670ae7 100644 --- a/EssentialsGroupManager/src/globalgroups.yml +++ b/EssentialsGroupManager/src/globalgroups.yml @@ -1,5 +1,101 @@ +# These groups only contain permission nodes.
+#
+# **** You can NOT add anything other than permission nodes ****
+#
+# These collections are to be inherited in your different worlds groups.yml's
+# They can also be added as one of a users subgroups, but NOT as a primary group.
+# These collections are available to ALL group and user yml's.
+#
+# Add to and customize these groups to fit yoru needs.
+
groups:
+# Permission nodes for GroupManager
+# by ElgarL, snowleo, continued from gabrielcouto's original
+# http://dev.bukkit.org/server-mods/essentials/
+
+ g:groupmanager_default:
+ permissions:
+ - groupmanager.notify.self
+
+ g:groupmanager_moderator:
+ permissions:
+ - groupmanager.listgroups
+ - groupmanager.mandemote
+ - groupmanager.manpromote
+ - groupmanager.manselect
+ - groupmanager.manuadd
+ - groupmanager.manudel
+ - groupmanager.manwhois
+ - groupmanager.notify.other
+
+ g:groupmanager_admin:
+ permissions:
+ - groupmanager.mantogglevalidate
+ - groupmanager.mansave
+ - groupmanager.mangcheckp
+ - groupmanager.manglistp
+ - groupmanager.manucheckp
+ - groupmanager.manulistp
+
+# Permission nodes for CraftBukkit
+# by many devs and contributors
+# http://dl.bukkit.org/
+
+ g:bukkit_default:
+ permissions:
+ - bukkit.broadcast.user
+ - -bukkit.command.plugins
+
+ g:bukkit_moderator:
+ permissions:
+ - bukkit.command.ban
+ - bukkit.command.ban.ip
+ - bukkit.command.ban.player
+ - bukkit.command.gamemode
+ - bukkit.command.kick
+ - bukkit.command.unban
+ - bukkit.command.unban.ip
+ - bukkit.command.unban.player
+
+ g:bukkit_admin:
+ permissions:
+ - bukkit.broadcast
+ - bukkit.broadcast.admin
+ - bukkit.command.give
+ - bukkit.command.help
+ - bukkit.command.kill
+ - bukkit.command.list
+ - bukkit.command.me
+ - -bukkit.command.op
+ - -bukkit.command.op.give
+ - -bukkit.command.op.take
+ - bukkit.command.plugins
+ - bukkit.command.reload
+ - bukkit.command.save
+ - bukkit.command.save.disable
+ - bukkit.command.save.enable
+ - bukkit.command.save.perform
+ - bukkit.command.say
+ - bukkit.command.stop
+ - bukkit.command.teleport
+ - bukkit.command.tell
+ - bukkit.command.time
+ - bukkit.command.time.add
+ - bukkit.command.time.set
+ - bukkit.command.version
+ - bukkit.command.whitelist
+ - bukkit.command.whitelist.add
+ - bukkit.command.whitelist.disable
+ - bukkit.command.whitelist.enable
+ - bukkit.command.whitelist.list
+ - bukkit.command.whitelist.reload
+ - bukkit.command.whitelist.remove
+
+# Permission nodes for Essentials
+# by ementalo, snowleo, and KHobbits
+# http://dev.bukkit.org/server-mods/essentials/
+
g:essentials_default:
permissions:
- essentials.help
@@ -8,7 +104,6 @@ groups: - essentials.motd
- essentials.rules
- essentials.spawn
- - groupmanager.notify.self
g:essentials_builder:
permissions:
@@ -19,24 +114,33 @@ groups: - essentials.balance.others
- essentials.balancetop
- essentials.chat.color
+ - essentials.chat.format
- essentials.chat.shout
- essentials.chat.question
- essentials.compass
+ - essentials.delhome
- essentials.depth
+ - essentials.getpos
- essentials.home
- essentials.ignore
+ - essentials.itemdb
- essentials.kit
- essentials.kit.tools
- essentials.mail
- essentials.mail.send
- essentials.me
- essentials.msg
+ - essentials.msg.color
+ - essentials.msg.format
- essentials.nick
- essentials.pay
- essentials.ping
- essentials.powertool
+ - essentials.powertooltoggle
- essentials.protect
+ - essentials.seen
- essentials.sethome
+ - essentials.sethome.multiple
- essentials.signs.use.*
- essentials.signs.create.disposal
- essentials.signs.create.mail
@@ -58,15 +162,21 @@ groups: g:essentials_moderator:
permissions:
+ - -essentials.spawner.enderdragon
+ - essentials.afk.kickexempt
- essentials.ban
- essentials.ban.notify
- essentials.banip
- essentials.broadcast
+ - essentials.chat.url
+ - essentials.chat.magic
- essentials.clearinventory
- essentials.delwarp
- essentials.eco.loan
- essentials.ext
+ - essentials.fly
- essentials.getpos
+ - essentials.getpos.others
- essentials.helpop.recieve
- essentials.home.others
- essentials.invsee
@@ -75,13 +185,19 @@ groups: - essentials.kick
- essentials.kick.notify
- essentials.kill
+ - essentials.kit.*
+ - essentials.msg.magic
- essentials.mute
+ - essentials.nick.color
- essentials.nick.others
- essentials.realname
+ - essentials.seen.banreason
+ - essentials.seen.extra
- essentials.setwarp
- essentials.signs.create.*
- essentials.signs.break.*
- essentials.spawner
+ - essentials.spawner.*
- essentials.thunder
- essentials.time
- essentials.time.set
@@ -93,6 +209,7 @@ groups: - essentials.togglejail
- essentials.top
- essentials.tp
+ - essentials.tp.others
- essentials.tphere
- essentials.tppos
- essentials.tptoggle
@@ -101,14 +218,7 @@ groups: - essentials.weather
- essentials.whois
- essentials.world
- - groupmanager.listgroups
- - groupmanager.mandemote
- - groupmanager.manpromote
- - groupmanager.manselect
- - groupmanager.manuadd
- - groupmanager.manudel
- - groupmanager.manwhois
- - groupmanager.notify.other
+ - essentials.world.*
g:essentials_admin:
permissions:
@@ -118,108 +228,82 @@ groups: - -essentials.reloadall
- -essentials.plugin
- essentials.*
- - groupmanager.mantogglevalidate
- - groupmanager.mansave
- - groupmanager.mangcheckp
- - groupmanager.manglistp
- - groupmanager.manucheckp
- - groupmanager.manulistp
-
- g:bukkit_default:
- permissions:
- - bukkit.broadcast.user
- - -bukkit.command.plugins
-
- g:bukkit_moderator:
- permissions:
- - bukkit.command.ban
- - bukkit.command.ban.ip
- - bukkit.command.ban.player
- - bukkit.command.gamemode
- - bukkit.command.kick
- - bukkit.command.unban
- - bukkit.command.unban.ip
- - bukkit.command.unban.player
- g:bukkit_admin:
+# Permission nodes for Towny by ElgarL
+# http://dev.bukkit.org/server-mods/towny-advanced/
+
+ g:towny_default:
permissions:
- - bukkit.broadcast
- - bukkit.broadcast.admin
- - bukkit.command.give
- - bukkit.command.help
- - bukkit.command.kill
- - bukkit.command.list
- - bukkit.command.me
- - -bukkit.command.op
- - -bukkit.command.op.give
- - -bukkit.command.op.take
- - bukkit.command.plugins
- - bukkit.command.reload
- - bukkit.command.save
- - bukkit.command.save.disable
- - bukkit.command.save.enable
- - bukkit.command.save.perform
- - bukkit.command.say
- - bukkit.command.stop
- - bukkit.command.teleport
- - bukkit.command.tell
- - bukkit.command.time
- - bukkit.command.time.add
- - bukkit.command.time.set
- - bukkit.command.version
- - bukkit.command.whitelist
- - bukkit.command.whitelist.add
- - bukkit.command.whitelist.disable
- - bukkit.command.whitelist.enable
- - bukkit.command.whitelist.list
- - bukkit.command.whitelist.reload
- - bukkit.command.whitelist.remove
+ - towny.chat.general
+ - towny.chat.local
g:towny_builder:
permissions:
- towny.town.*
- towny.nation.*
- - towny.chat.tc
- - towny.chat.nc
- - towny.wild.block.6.*
- - towny.wild.block.14.destroy
- - towny.wild.block.15.destroy
- - towny.wild.block.16.destroy
- - towny.wild.block.17.*
- - towny.wild.block.18.destroy
- - towny.wild.block.21.destroy
- - towny.wild.block.31.destroy
- - towny.wild.block.37.destroy
- - towny.wild.block.38.destroy
- - towny.wild.block.39.destroy
- - towny.wild.block.40.destroy
- - towny.wild.block.50.destroy
- - towny.wild.block.56.destroy
- - towny.wild.block.73.destroy
- - towny.wild.block.74.destroy
- - towny.wild.block.78.destroy
- - towny.wild.block.81.destroy
- - towny.wild.block.82.destroy
- - towny.wild.block.83.destroy
- - towny.wild.block.86.destroy
- - towny.wild.block.103.destroy
- - towny.wild.block.106.destroy
- - towny.wild.block.111.destroy
- - towny.wild.block.115.destroy
+ - towny.chat.town
+ - towny.chat.nation
+ - towny.wild.build.6
+ - towny.wild.destroy.6
+ - towny.wild.destroy.14
+ - towny.wild.destroy.15
+ - towny.wild.destroy.16
+ - towny.wild.build.17
+ - towny.wild.destroy.17
+ - towny.wild.destroy.18
+ - towny.wild.destroy.21
+ - towny.wild.destroy.31
+ - towny.wild.destroy.37
+ - towny.wild.destroy.38
+ - towny.wild.destroy.39
+ - towny.wild.destroy.40
+ - towny.wild.destroy.50
+ - towny.wild.destroy.56
+ - towny.wild.destroy.73
+ - towny.wild.destroy.74
+ - towny.wild.destroy.78
+ - towny.wild.destroy.81
+ - towny.wild.destroy.82
+ - towny.wild.destroy.83
+ - towny.wild.destroy.86
+ - towny.wild.destroy.103
+ - towny.wild.destroy.106
+ - towny.wild.destroy.111
+ - towny.wild.destroy.115
g:towny_moderator:
permissions:
- towny.chat.mod
- - towny.wild.block.64.switch
- - towny.wild.block.83.build
- - towny.wild.block.86.build
- - towny.wild.block.103.build
- - towny.wild.block.111.build
- - towny.wild.block.115.build
+ - towny.wild.switch.64
+ - towny.wild.build.83
+ - towny.wild.build.86
+ - towny.wild.build.103
+ - towny.wild.build.111
+ - towny.wild.build.115
g:towny_admin:
permissions:
- towny.admin
- - -towny.wild.block.119.destroy
- - -towny.wild.block.120.destroy
- - towny.chat.admin
\ No newline at end of file + - -towny.wild.destroy.119
+ - -towny.wild.destroy.120
+ - towny.chat.admin
+
+# Permission nodes for VanishNoPacket by mbaxter
+# http://dev.bukkit.org/server-mods/vanish/
+
+ g:vanish_moderator:
+ permissions:
+ - -vanish.*
+ - vanish.vanish
+ - vanish.smokin
+ - vanish.nofollow
+ - vanish.nopickup
+ - vanish.preventincomingdamage
+ - vanish.hooks.dynmap.alwayshidden
+ - vanish.hooks.essentials.hide
+
+ g:vanish_admin:
+ permissions:
+ - vanish.silentjoin
+ - vanish.silentquit
+ - vanish.silentchests
diff --git a/EssentialsGroupManager/src/groups.yml b/EssentialsGroupManager/src/groups.yml index e50054c9f..9c63ffd94 100644 --- a/EssentialsGroupManager/src/groups.yml +++ b/EssentialsGroupManager/src/groups.yml @@ -1,10 +1,12 @@ # Group inheritance -# any inherited groups prefixed with a g: are global groups -# These groups are defined in the globalgroups.yml -# and can be inherited in any worlds groups/users.yml. +# +# Any inherited groups prefixed with a g: are global groups +# and are inherited from the GlobalGroups.yml. # # Groups without the g: prefix are groups local to this world -# and defined in the this groups.yml file. +# and are defined in the this groups.yml file. +# +# Local group inheritances define your promotion tree when using 'manpromote/mandemote' groups: Default: @@ -12,8 +14,10 @@ groups: permissions: - -bukkit.command.kill inheritance: - - g:essentials_default + - g:groupmanager_default - g:bukkit_default + - g:essentials_default + - g:towny_default info: prefix: '&e' build: false @@ -24,7 +28,7 @@ groups: inheritance: - default - g:essentials_builder - - g:towny_moderator + - g:towny_builder info: prefix: '&2' build: true @@ -34,9 +38,11 @@ groups: permissions: [] inheritance: - builder - - g:essentials_moderator + - g:groupmanager_moderator - g:bukkit_moderator + - g:essentials_moderator - g:towny_moderator + - g:vanish_moderator info: prefix: '&5' build: true @@ -46,9 +52,11 @@ groups: permissions: [] inheritance: - moderator - - g:essentials_admin + - g:groupmanager_admin - g:bukkit_admin + - g:essentials_admin - g:towny_admin + - g:vanish_admin info: prefix: '&c' build: true @@ -57,6 +65,7 @@ groups: default: false permissions: - '*' + - -vanish.* inheritance: - admin info: diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java index d9715d4be..04d9e86be 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java @@ -8,6 +8,7 @@ import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException;
import java.util.Collection;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -23,8 +24,6 @@ import org.bukkit.configuration.file.YamlConfiguration; import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
-
-
/**
* @author ElgarL
*
@@ -41,6 +40,7 @@ public class GlobalGroups { protected File GlobalGroupsFile = null;
public GlobalGroups(GroupManager plugin) {
+
this.plugin = plugin;
load();
}
@@ -49,6 +49,7 @@ public class GlobalGroups { * @return the haveGroupsChanged
*/
public boolean haveGroupsChanged() {
+
if (this.haveGroupsChanged) {
return true;
}
@@ -64,20 +65,24 @@ public class GlobalGroups { * @return the timeStampGroups
*/
public long getTimeStampGroups() {
+
return timeStampGroups;
}
+
/**
* @param timeStampGroups the timeStampGroups to set
*/
protected void setTimeStampGroups(long timeStampGroups) {
+
this.timeStampGroups = timeStampGroups;
}
-
+
/**
* @param haveGroupsChanged
* the haveGroupsChanged to set
*/
public void setGroupsChanged(boolean haveGroupsChanged) {
+
this.haveGroupsChanged = haveGroupsChanged;
}
@@ -85,7 +90,7 @@ public class GlobalGroups { public void load() {
GGroups = new YamlConfiguration();
-
+
GroupManager.setLoaded(false);
// READ globalGroups FILE
@@ -109,58 +114,87 @@ public class GlobalGroups { // Clear out old groups
resetGlobalGroups();
-
+
if (!GGroups.getKeys(false).isEmpty()) {
// Read all global groups
- Map<String, Object> allGroups = (Map<String, Object>) GGroups.getConfigurationSection("groups").getValues(false);
-
+ Map<String, Object> allGroups = new HashMap<String, Object>();
+
+ try {
+ allGroups = (Map<String, Object>) GGroups.getConfigurationSection("groups").getValues(false);
+ } catch (Exception ex) {
+ // ex.printStackTrace();
+ throw new IllegalArgumentException("Your " + GlobalGroupsFile.getPath() + " file is invalid. See console for details.", ex);
+ }
+
// Load each groups permissions list.
if (allGroups != null) {
- for (String groupName : allGroups.keySet()) {
+
+ Iterator<String> groupItr = allGroups.keySet().iterator();
+ String groupName;
+ Integer groupCount = 0;
+
+ /*
+ * loop each group entry
+ * and read it's data.
+ */
+ while (groupItr.hasNext()) {
+ try {
+ groupCount++;
+ // Attempt to fetch the next group name.
+ groupName = groupItr.next();
+ } catch (Exception ex) {
+ throw new IllegalArgumentException("Invalid group name for GlobalGroup entry (" + groupCount + ") in file: " + GlobalGroupsFile.getPath(), ex);
+ }
+
+ /*
+ * Create a new group with this name.
+ */
Group newGroup = new Group(groupName.toLowerCase());
Object element;
-
+
// Permission nodes
element = GGroups.get("groups." + groupName + ".permissions");
-
+
if (element != null)
if (element instanceof List) {
try {
for (String node : (List<String>) element) {
- newGroup.addPermission(node);
+ if ((node != null) && !node.isEmpty())
+ newGroup.addPermission(node);
}
- } catch (ClassCastException e) {
- throw new IllegalArgumentException("Invalid permission node for global group: " + groupName);
+ } catch (ClassCastException ex) {
+ throw new IllegalArgumentException("Invalid permission node for global group: " + groupName, ex);
}
} else if (element instanceof String) {
+ if ((element != null) && !((String)element).isEmpty())
newGroup.addPermission((String) element);
} else
throw new IllegalArgumentException("Unknown type of permission node for global group: " + groupName);
-
+
// Info nodes
element = GGroups.get("groups." + groupName + ".info");
-
+
if (element != null)
if (element instanceof MemorySection) {
Map<String, Object> vars = new HashMap<String, Object>();
for (String key : ((MemorySection) element).getKeys(false)) {
- vars.put(key, ((MemorySection) element).get(key));
- }
+ vars.put(key, ((MemorySection) element).get(key));
+ }
newGroup.setVariables(vars);
} else
throw new IllegalArgumentException("Unknown type of info node for global group: " + groupName);
-
+
// Push a new group
addGroup(newGroup);
}
}
-
+
removeGroupsChangedFlag();
}
-
+
setTimeStampGroups(GlobalGroupsFile.lastModified());
GroupManager.setLoaded(true);
- //GlobalGroupsFile = null;
+ // GlobalGroupsFile = null;
}
/**
@@ -169,33 +203,33 @@ public class GlobalGroups { public void writeGroups(boolean overwrite) {
- //File GlobalGroupsFile = new File(plugin.getDataFolder(), "globalgroups.yml");
+ // File GlobalGroupsFile = new File(plugin.getDataFolder(), "globalgroups.yml");
if (haveGroupsChanged()) {
if (overwrite || (!overwrite && (getTimeStampGroups() >= GlobalGroupsFile.lastModified()))) {
Map<String, Object> root = new HashMap<String, Object>();
-
+
Map<String, Object> groupsMap = new HashMap<String, Object>();
root.put("groups", groupsMap);
for (String groupKey : groups.keySet()) {
Group group = groups.get(groupKey);
-
+
// Group header
Map<String, Object> aGroupMap = new HashMap<String, Object>();
groupsMap.put(group.getName(), aGroupMap);
-
+
// Info nodes
Map<String, Object> infoMap = new HashMap<String, Object>();
- aGroupMap.put("info", infoMap);
-
- for (String infoKey : group.getVariables().getVarKeyList()) {
- infoMap.put(infoKey, group.getVariables().getVarObject(infoKey));
- }
-
- // Permission nodes
+ aGroupMap.put("info", infoMap);
+
+ for (String infoKey : group.getVariables().getVarKeyList()) {
+ infoMap.put(infoKey, group.getVariables().getVarObject(infoKey));
+ }
+
+ // Permission nodes
aGroupMap.put("permissions", group.getPermissionList());
}
-
+
if (!root.isEmpty()) {
DumperOptions opt = new DumperOptions();
opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
@@ -208,53 +242,55 @@ public class GlobalGroups { }
setTimeStampGroups(GlobalGroupsFile.lastModified());
} else {
- // Newer file found.
- GroupManager.logger.log(Level.WARNING, "Newer GlobalGroups file found, but we have local changes!");
- throw new IllegalStateException("Unable to save unless you issue a '/mansave force'");
- }
+ // Newer file found.
+ GroupManager.logger.log(Level.WARNING, "Newer GlobalGroups file found, but we have local changes!");
+ throw new IllegalStateException("Unable to save unless you issue a '/mansave force'");
+ }
removeGroupsChangedFlag();
} else {
- //Check for newer file as no local changes.
- if (getTimeStampGroups() < GlobalGroupsFile.lastModified()) {
- System.out.print("Newer GlobalGroups file found (Loading changes)!");
- // Backup GlobalGroups file
- backupFile();
- load();
- }
- }
+ // Check for newer file as no local changes.
+ if (getTimeStampGroups() < GlobalGroupsFile.lastModified()) {
+ System.out.print("Newer GlobalGroups file found (Loading changes)!");
+ // Backup GlobalGroups file
+ backupFile();
+ load();
+ }
+ }
}
-
+
/**
- * Backup the BlobalGroups file
- * @param w
- */
- private void backupFile() {
-
- File backupFile = new File(plugin.getBackupFolder(), "bkp_ggroups_" + Tasks.getDateString() + ".yml");
- try {
- Tasks.copy(GlobalGroupsFile, backupFile);
- } catch (IOException ex) {
- GroupManager.logger.log(Level.SEVERE, null, ex);
- }
- }
-
+ * Backup the BlobalGroups file
+ *
+ * @param w
+ */
+ private void backupFile() {
+
+ File backupFile = new File(plugin.getBackupFolder(), "bkp_ggroups_" + Tasks.getDateString() + ".yml");
+ try {
+ Tasks.copy(GlobalGroupsFile, backupFile);
+ } catch (IOException ex) {
+ GroupManager.logger.log(Level.SEVERE, null, ex);
+ }
+ }
+
/**
* Adds a group, or replaces an existing one.
*
* @param groupToAdd
*/
public void addGroup(Group groupToAdd) {
+
// Create a new group if it already exists
if (hasGroup(groupToAdd.getName())) {
groupToAdd = groupToAdd.clone();
removeGroup(groupToAdd.getName());
}
-
+
newGroup(groupToAdd);
- haveGroupsChanged = true;
- if (GroupManager.isLoaded())
- GroupManagerEventHandler.callEvent(groupToAdd, GMGroupEvent.Action.GROUP_ADDED);
+ haveGroupsChanged = true;
+ if (GroupManager.isLoaded())
+ GroupManagerEventHandler.callEvent(groupToAdd, GMGroupEvent.Action.GROUP_ADDED);
}
/**
@@ -263,6 +299,7 @@ public class GlobalGroups { * @param newGroup
*/
public Group newGroup(Group newGroup) {
+
// Push a new group
if (!groups.containsKey(newGroup.getName().toLowerCase())) {
groups.put(newGroup.getName().toLowerCase(), newGroup);
@@ -278,6 +315,7 @@ public class GlobalGroups { * @param groupName
*/
public boolean removeGroup(String groupName) {
+
// Push a new group
if (groups.containsKey(groupName.toLowerCase())) {
groups.remove(groupName.toLowerCase());
@@ -296,6 +334,7 @@ public class GlobalGroups { * @return true if the group exists
*/
public boolean hasGroup(String groupName) {
+
return groups.containsKey(groupName.toLowerCase());
}
@@ -351,6 +390,7 @@ public class GlobalGroups { * @return List of all group names
*/
public List<String> getGroupsPermissions(String groupName) {
+
if (!hasGroup(groupName))
return null;
@@ -363,6 +403,7 @@ public class GlobalGroups { * @return Set containing all group names.
*/
public Set<String> getGlobalGroups() {
+
return groups.keySet();
}
@@ -370,14 +411,16 @@ public class GlobalGroups { * Resets GlobalGroups.
*/
public void resetGlobalGroups() {
+
this.groups = new HashMap<String, Group>();
}
-
+
/**
*
* @return a collection of the groups
*/
public Collection<Group> getGroupList() {
+
return groups.values();
}
@@ -388,6 +431,7 @@ public class GlobalGroups { * @return Group object
*/
public Group getGroup(String groupName) {
+
if (!hasGroup(groupName))
return null;
@@ -399,17 +443,19 @@ public class GlobalGroups { * @return the globalGroupsFile
*/
public File getGlobalGroupsFile() {
+
return GlobalGroupsFile;
}
-
+
/**
*
*/
- public void removeGroupsChangedFlag() {
- setGroupsChanged(false);
- for (Group g : groups.values()) {
- g.flagAsSaved();
- }
- }
+ public void removeGroupsChangedFlag() {
+
+ setGroupsChanged(false);
+ for (Group g : groups.values()) {
+ g.flagAsSaved();
+ }
+ }
}
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/Tasks/BukkitPermsUpdateTask.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/Tasks/BukkitPermsUpdateTask.java index f4b805c35..1a0fc2369 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/Tasks/BukkitPermsUpdateTask.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/Tasks/BukkitPermsUpdateTask.java @@ -5,24 +5,25 @@ import org.anjocaido.groupmanager.GroupManager; /*
*
* Created by ElgarL
- *
*/
public class BukkitPermsUpdateTask implements Runnable {
-
+
public BukkitPermsUpdateTask() {
- super();
+
+ super();
}
-
+
@Override
public void run() {
+
// Signal loaded and update BukkitPermissions.
GroupManager.setLoaded(true);
GroupManager.BukkitPermissions.collectPermissions();
GroupManager.BukkitPermissions.updateAllPlayers();
-
+
GroupManager.logger.info("Bukkit Permissions Updated!");
-
+
}
-
+
}
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java index e3250a1c1..bb04fa3d7 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java @@ -13,151 +13,169 @@ import org.anjocaido.groupmanager.dataholder.WorldDataHolder; import org.anjocaido.groupmanager.utils.StringPermissionComparator; /** - * + * * @author gabrielcouto */ public abstract class DataUnit { - private WorldDataHolder dataSource; - private String name; - private boolean changed, sorted = false; - private ArrayList<String> permissions = new ArrayList<String>(); + private WorldDataHolder dataSource; + private String name; + private boolean changed, sorted = false; + private ArrayList<String> permissions = new ArrayList<String>(); - public DataUnit(WorldDataHolder dataSource, String name) { - this.dataSource = dataSource; - this.name = name; - } + public DataUnit(WorldDataHolder dataSource, String name) { - public DataUnit(String name) { - this.name = name; + this.dataSource = dataSource; + this.name = name; + } + + public DataUnit(String name) { + + this.name = name; + } + + /** + * Every group is matched only by their names and DataSources names. + * + * @param o + * @return true if they are equal. false if not. + */ + @Override + public boolean equals(Object o) { + + if (o instanceof DataUnit) { + DataUnit go = (DataUnit) o; + if (this.getName().equalsIgnoreCase(go.getName())) { + // Global Group match. + if (this.dataSource == null && go.getDataSource() == null) + return true; + // This is a global group, the object to test isn't. + if (this.dataSource == null && go.getDataSource() != null) + return false; + // This is not a global group, but the object to test is. + if (this.dataSource != null && go.getDataSource() == null) + return false; + // Match on group name and world name. + if (this.dataSource.getName().equalsIgnoreCase(go.getDataSource().getName())) + return true; + } + } + return false; + } + + @Override + public int hashCode() { + + int hash = 5; + hash = 71 * hash + (this.name != null ? this.name.toLowerCase().hashCode() : 0); + return hash; + } + + /** + * Set the data source to point to a different worldDataHolder + * + * @param source + */ + public void setDataSource(WorldDataHolder source) { + + this.dataSource = source; + } + + /** + * Get the current worldDataHolder this object is pointing to + * + * @return the dataSource + */ + public WorldDataHolder getDataSource() { + + return dataSource; + } + + /** + * @return the name + */ + public String getName() { + + return name; + } + + public void flagAsChanged() { + + WorldDataHolder testSource = getDataSource(); + String source = ""; + + if (testSource == null) + source = "GlobalGroups"; + else + source = testSource.getName(); + + GroupManager.logger.finest("DataSource: " + source + " - DataUnit: " + getName() + " flagged as changed!"); + // for(StackTraceElement st: Thread.currentThread().getStackTrace()){ + // GroupManager.logger.finest(st.toString()); + // } + sorted = false; + changed = true; + } + + public boolean isChanged() { + + return changed; + } + + public void flagAsSaved() { + + WorldDataHolder testSource = getDataSource(); + String source = ""; + + if (testSource == null) + source = "GlobalGroups"; + else + source = testSource.getName(); + + GroupManager.logger.finest("DataSource: " + source + " - DataUnit: " + getName() + " flagged as saved!"); + changed = false; + } + + public boolean hasSamePermissionNode(String permission) { + + return permissions.contains(permission); + } + + public void addPermission(String permission) { + + if (!hasSamePermissionNode(permission)) { + permissions.add(permission); + } + flagAsChanged(); + } + + public boolean removePermission(String permission) { + + flagAsChanged(); + return permissions.remove(permission); } /** - * Every group is matched only by their names and DataSources names. - * @param o - * @return true if they are equal. false if not. - */ - @Override - public boolean equals(Object o) { - if (o instanceof DataUnit) { - DataUnit go = (DataUnit) o; - if (this.getName().equalsIgnoreCase(go.getName())) { - // Global Group match. - if (this.dataSource == null && go.getDataSource() == null) - return true; - // This is a global group, the object to test isn't. - if (this.dataSource == null && go.getDataSource() != null) - return false; - // This is not a global group, but the object to test is. - if (this.dataSource != null && go.getDataSource() == null) - return false; - // Match on group name and world name. - if (this.dataSource.getName().equalsIgnoreCase(go.getDataSource().getName())) - return true; - } - } - return false; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 71 * hash + (this.name != null ? this.name.toLowerCase().hashCode() : 0); - return hash; - } - - /** - * Set the data source to point to a different worldDataHolder - * - * @param source - */ - public void setDataSource(WorldDataHolder source) { - this.dataSource = source; - } - - /** - * Get the current worldDataHolder this object is pointing to - * - * @return the dataSource - */ - public WorldDataHolder getDataSource() { - return dataSource; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - public void flagAsChanged() { - WorldDataHolder testSource = getDataSource(); - String source = ""; - - if (testSource == null) - source = "GlobalGroups"; - else - source = testSource.getName(); - - GroupManager.logger.finest("DataSource: " + source + " - DataUnit: " + getName() + " flagged as changed!"); -// for(StackTraceElement st: Thread.currentThread().getStackTrace()){ -// GroupManager.logger.finest(st.toString()); -// } - sorted = false; - changed = true; - } - - public boolean isChanged() { - return changed; - } - - public void flagAsSaved() { - WorldDataHolder testSource = getDataSource(); - String source = ""; - - if (testSource == null) - source = "GlobalGroups"; - else - source = testSource.getName(); - - GroupManager.logger.finest("DataSource: " + source + " - DataUnit: " + getName() + " flagged as saved!"); - changed = false; - } - - public boolean hasSamePermissionNode(String permission) { - return permissions.contains(permission); - } - - public void addPermission(String permission) { - if (!hasSamePermissionNode(permission)) { - permissions.add(permission); - } - flagAsChanged(); - } - - public boolean removePermission(String permission) { - flagAsChanged(); - return permissions.remove(permission); - } - - /** - * Use this only to list permissions. - * You can't edit the permissions using the returned ArrayList instance - * @return a copy of the permission list - */ - public List<String> getPermissionList() { - return Collections.unmodifiableList(permissions); - } - - public boolean isSorted() { - return this.sorted; - } - - public void sortPermissions() { - if (!isSorted()) { - Collections.sort(permissions, StringPermissionComparator.getInstance()); - sorted = true; - } - } + * Use this only to list permissions. + * You can't edit the permissions using the returned ArrayList instance + * + * @return a copy of the permission list + */ + public List<String> getPermissionList() { + + return Collections.unmodifiableList(permissions); + } + + public boolean isSorted() { + + return this.sorted; + } + + public void sortPermissions() { + + if (!isSorted()) { + Collections.sort(permissions, StringPermissionComparator.getInstance()); + sorted = true; + } + } }
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java index 19db58851..e08d1db7d 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java @@ -7,81 +7,88 @@ package org.anjocaido.groupmanager.data; import java.util.Map; /** - * + * * @author gabrielcouto */ public class GroupVariables extends Variables implements Cloneable { - private Group owner; + private Group owner; - public GroupVariables(Group owner) { - super(owner); - this.owner = owner; - addVar("prefix", ""); - addVar("suffix", ""); - addVar("build", false); - } + public GroupVariables(Group owner) { - public GroupVariables(Group owner, Map<String, Object> varList) { - super(owner); - variables = varList; - if (variables.get("prefix") == null) { - variables.put("prefix", ""); - owner.flagAsChanged(); - } - //thisGrp.prefix = infoNode.get("prefix").toString(); + super(owner); + this.owner = owner; + addVar("prefix", ""); + addVar("suffix", ""); + addVar("build", false); + } - if (variables.get("suffix") == null) { - variables.put("suffix", ""); - owner.flagAsChanged(); - } - //thisGrp.suffix = infoNode.get("suffix").toString(); + public GroupVariables(Group owner, Map<String, Object> varList) { - if (variables.get("build") == null) { - variables.put("build", false); - owner.flagAsChanged(); - } - this.owner = owner; - } + super(owner); + variables = varList; + if (variables.get("prefix") == null) { + variables.put("prefix", ""); + owner.flagAsChanged(); + } + //thisGrp.prefix = infoNode.get("prefix").toString(); - /** - * A clone of all vars here. - * @return GroupVariables clone - */ - protected GroupVariables clone(Group newOwner) { - GroupVariables clone = new GroupVariables(newOwner); - for (String key : variables.keySet()) { - clone.variables.put(key, variables.get(key)); - } - newOwner.flagAsChanged(); - return clone; - } + if (variables.get("suffix") == null) { + variables.put("suffix", ""); + owner.flagAsChanged(); + } + //thisGrp.suffix = infoNode.get("suffix").toString(); - /** - * Remove a var from the list - * @param name - */ - @Override - public void removeVar(String name) { - try { - this.variables.remove(name); - } catch (Exception e) { - } - if (name.equals("prefix")) { - addVar("prefix", ""); - } else if (name.equals("suffix")) { - addVar("suffix", ""); - } else if (name.equals("build")) { - addVar("build", false); - } - owner.flagAsChanged(); - } + if (variables.get("build") == null) { + variables.put("build", false); + owner.flagAsChanged(); + } + this.owner = owner; + } - /** - * @return the owner - */ - @Override - public Group getOwner() { - return owner; - } + /** + * A clone of all vars here. + * + * @return GroupVariables clone + */ + protected GroupVariables clone(Group newOwner) { + + GroupVariables clone = new GroupVariables(newOwner); + for (String key : variables.keySet()) { + clone.variables.put(key, variables.get(key)); + } + newOwner.flagAsChanged(); + return clone; + } + + /** + * Remove a var from the list + * + * @param name + */ + @Override + public void removeVar(String name) { + + try { + this.variables.remove(name); + } catch (Exception e) { + } + if (name.equals("prefix")) { + addVar("prefix", ""); + } else if (name.equals("suffix")) { + addVar("suffix", ""); + } else if (name.equals("build")) { + addVar("build", false); + } + owner.flagAsChanged(); + } + + /** + * @return the owner + */ + @Override + public Group getOwner() { + + return owner; + } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java index 30fe3f709..c10658fb0 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java @@ -16,7 +16,6 @@ import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.entity.Player; - /** * * @author gabrielcouto/ElgarL @@ -40,6 +39,7 @@ public class User extends DataUnit implements Cloneable { * @param name */ public User(WorldDataHolder source, String name) { + super(source, name); this.group = source.getDefaultGroup().getName(); } @@ -50,6 +50,7 @@ public class User extends DataUnit implements Cloneable { */ @Override public User clone() { + User clone = new User(getDataSource(), this.getName()); clone.group = this.group; for (String perm : this.getPermissionList()) { @@ -67,6 +68,7 @@ public class User extends DataUnit implements Cloneable { * @return null if given dataSource already contains the same user */ public User clone(WorldDataHolder dataSource) { + if (dataSource.isUserDeclared(this.getName())) { return null; } @@ -85,6 +87,7 @@ public class User extends DataUnit implements Cloneable { } public Group getGroup() { + Group result = getDataSource().getGroup(group); if (result == null) { this.setGroup(getDataSource().getDefaultGroup()); @@ -97,6 +100,7 @@ public class User extends DataUnit implements Cloneable { * @return the group */ public String getGroupName() { + Group result = getDataSource().getGroup(group); if (result == null) { group = getDataSource().getDefaultGroup().getName(); @@ -104,33 +108,23 @@ public class User extends DataUnit implements Cloneable { return group; } - /** - * @param group - * the group to set - */ - @Deprecated - public void setGroup(String group) { - this.group = group; - flagAsChanged(); - if (GroupManager.isLoaded()) - if (!GroupManager.BukkitPermissions.isPlayer_join()) - GroupManager.BukkitPermissions.updatePlayer(getBukkitPlayer()); - } /** * @param group * the group to set */ public void setGroup(Group group) { + setGroup(group, true); } - + /** * @param group the group to set * @param updatePerms if we are to trigger a superperms update. - * + * */ public void setGroup(Group group, Boolean updatePerms) { + if (!this.getDataSource().groupExists(group.getName())) { getDataSource().addGroup(group); } @@ -151,12 +145,13 @@ public class User extends DataUnit implements Cloneable { if (notify) GroupManager.notify(this.getName(), String.format(" moved to the group %s.", group.getName())); - + GroupManagerEventHandler.callEvent(this, Action.USER_GROUP_CHANGED); } } public boolean addSubGroup(Group subGroup) { + // Don't allow adding a subgroup if it's already set as the primary. if (this.group.equalsIgnoreCase(subGroup.getName())) { return false; @@ -164,12 +159,12 @@ public class User extends DataUnit implements Cloneable { // User already has this subgroup if (containsSubGroup(subGroup)) return false; - + // If the group doesn't exists add it if (!this.getDataSource().groupExists(subGroup.getName())) { getDataSource().addGroup(subGroup); } - + subGroups.add(subGroup.getName()); flagAsChanged(); if (GroupManager.isLoaded()) { @@ -178,25 +173,29 @@ public class User extends DataUnit implements Cloneable { GroupManagerEventHandler.callEvent(this, Action.USER_SUBGROUP_CHANGED); } return true; - + //subGroup = getDataSource().getGroup(subGroup.getName()); //removeSubGroup(subGroup); //subGroups.add(subGroup.getName()); } public int subGroupsSize() { + return subGroups.size(); } public boolean isSubGroupsEmpty() { + return subGroups.isEmpty(); } public boolean containsSubGroup(Group subGroup) { + return subGroups.contains(subGroup.getName()); } public boolean removeSubGroup(Group subGroup) { + try { if (subGroups.remove(subGroup.getName())) { flagAsChanged(); @@ -212,6 +211,7 @@ public class User extends DataUnit implements Cloneable { } public ArrayList<Group> subGroupListCopy() { + ArrayList<Group> val = new ArrayList<Group>(); for (String gstr : subGroups) { Group g = getDataSource().getGroup(gstr); @@ -225,6 +225,7 @@ public class User extends DataUnit implements Cloneable { } public ArrayList<String> subGroupListStringCopy() { + return new ArrayList<String>(subGroups); } @@ -232,6 +233,7 @@ public class User extends DataUnit implements Cloneable { * @return the variables */ public UserVariables getVariables() { + return variables; } @@ -240,10 +242,10 @@ public class User extends DataUnit implements Cloneable { * @param varList */ public void setVariables(Map<String, Object> varList) { + //UserVariables temp = new UserVariables(this, varList); variables.clearVars(); for (String key : varList.keySet()) { - System.out.print("Adding variable - " + key); variables.addVar(key, varList.get(key)); } flagAsChanged(); @@ -255,6 +257,7 @@ public class User extends DataUnit implements Cloneable { } public User updatePlayer(Player player) { + if (player != null) { bukkitPlayer = player; } @@ -262,6 +265,7 @@ public class User extends DataUnit implements Cloneable { } public Player getBukkitPlayer() { + if (bukkitPlayer == null) { bukkitPlayer = Bukkit.getPlayer(this.getName()); } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java index 0b3948cab..f994595c1 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java @@ -7,42 +7,47 @@ package org.anjocaido.groupmanager.data; import java.util.Map; /** - * + * * @author gabrielcouto */ public class UserVariables extends Variables { - private User owner; - - public UserVariables(User owner) { - super(owner); - this.owner = owner; - } - - public UserVariables(User owner, Map<String, Object> varList) { - super(owner); - this.variables = varList; - this.owner = owner; - } - - /** - * A clone of all vars here. - * @return UserVariables clone - */ - protected UserVariables clone(User newOwner) { - UserVariables clone = new UserVariables(newOwner); - for (String key : variables.keySet()) { - clone.variables.put(key, variables.get(key)); - } - newOwner.flagAsChanged(); - return clone; - } - - /** - * @return the owner - */ - @Override - public User getOwner() { - return owner; - } + private User owner; + + public UserVariables(User owner) { + + super(owner); + this.owner = owner; + } + + public UserVariables(User owner, Map<String, Object> varList) { + + super(owner); + this.variables = varList; + this.owner = owner; + } + + /** + * A clone of all vars here. + * + * @return UserVariables clone + */ + protected UserVariables clone(User newOwner) { + + UserVariables clone = new UserVariables(newOwner); + for (String key : variables.keySet()) { + clone.variables.put(key, variables.get(key)); + } + newOwner.flagAsChanged(); + return clone; + } + + /** + * @return the owner + */ + @Override + public User getOwner() { + + return owner; + } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java index 140d6626a..42ceba7e4 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java @@ -9,178 +9,200 @@ import java.util.Map; import java.util.Set; /** - *A class that holds variables of a user/group. + * A class that holds variables of a user/group. * In groups, it holds the contents of INFO node. * Like: * prefix * suffix * build - * + * * @author gabrielcouto */ public abstract class Variables implements Cloneable { - private DataUnit owner; - protected Map<String, Object> variables = new HashMap<String, Object>(); - - public Variables(DataUnit owner) { - this.owner = owner; - } - - /** - * Add var to the the INFO node. - * examples: - * addVar("build",true); - * addVar("prefix","c"); - * @param name key name of the var - * @param o the object value of the var - */ - public void addVar(String name, Object o) { - if (o == null) { - return; - } - if (variables.containsKey(name)) { - variables.remove(name); - } - variables.put(name, o); - owner.flagAsChanged(); - } - - /** - * Returns the object inside the var - * @param name - * @return a Object if exists. null if doesn't exists - */ - public Object getVarObject(String name) { - return variables.get(name); - } - - /** - * Get the String value for the given var name - * @param name the var key name - * @return "" if null. or the toString() value of object - */ - public String getVarString(String name) { - Object o = variables.get(name); - try { - return o == null ? "" : o.toString(); - } catch (Exception e) { - return ""; - } - } - - /** - * - * @param name - * @return false if null. or a Boolean.parseBoolean of the string - */ - public Boolean getVarBoolean(String name) { - Object o = variables.get(name); - try { - return o == null ? false : Boolean.parseBoolean(o.toString()); - } catch (Exception e) { - return false; - } - } - - /** - * - * @param name - * @return -1 if null. or a parseInt of the string - */ - public Integer getVarInteger(String name) { - Object o = variables.get(name); - try { - return o == null ? -1 : Integer.parseInt(o.toString()); - } catch (Exception e) { - return -1; - } - } - - /** - * - * @param name - * @return -1 if null. or a parseDouble of the string - */ - public Double getVarDouble(String name) { - Object o = variables.get(name); - try { - return o == null ? -1.0D : Double.parseDouble(o.toString()); - } catch (Exception e) { - return -1.0D; - } - } - - /** - * All variable keys this is holding - * @return Set of all variable names. - */ - public Set<String> getVarKeyList() { - return variables.keySet(); - } - - /** - * verify is a var exists - * @param name the key name of the var - * @return true if that var exists - */ - public boolean hasVar(String name) { - return variables.containsKey(name); - } - - /** - * Returns the quantity of vars this is holding - * @return the number of vars - */ - public int getSize() { - return variables.size(); - } - - /** - * Remove a var from the list - * @param name - */ - public void removeVar(String name) { - try { - variables.remove(name); - } catch (Exception e) { - } - owner.flagAsChanged(); - } - - public static Object parseVariableValue(String value) { - try { - Integer i = Integer.parseInt(value); - return i; - } catch (NumberFormatException e) { - } - try { - Double d = Double.parseDouble(value); - return d; - } catch (NumberFormatException e) { - } - if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes") || value.equalsIgnoreCase("on")) { - return true; - } else if (value.equalsIgnoreCase("false") || value.equalsIgnoreCase("no") || value.equalsIgnoreCase("off")) { - return false; - } - return value; - - } - - public void clearVars() { - variables.clear(); - owner.flagAsChanged(); - } - - /** - * @return the owner - */ - public DataUnit getOwner() { - return owner; - } - - public boolean isEmpty() { - return variables.isEmpty(); - } + private DataUnit owner; + protected Map<String, Object> variables = new HashMap<String, Object>(); + + public Variables(DataUnit owner) { + + this.owner = owner; + } + + /** + * Add var to the the INFO node. + * examples: + * addVar("build",true); + * addVar("prefix","c"); + * + * @param name key name of the var + * @param o the object value of the var + */ + public void addVar(String name, Object o) { + + if (o == null) { + return; + } + if (variables.containsKey(name)) { + variables.remove(name); + } + variables.put(name, o); + owner.flagAsChanged(); + } + + /** + * Returns the object inside the var + * + * @param name + * @return a Object if exists. null if doesn't exists + */ + public Object getVarObject(String name) { + + return variables.get(name); + } + + /** + * Get the String value for the given var name + * + * @param name the var key name + * @return "" if null. or the toString() value of object + */ + public String getVarString(String name) { + + Object o = variables.get(name); + try { + return o == null ? "" : o.toString(); + } catch (Exception e) { + return ""; + } + } + + /** + * + * @param name + * @return false if null. or a Boolean.parseBoolean of the string + */ + public Boolean getVarBoolean(String name) { + + Object o = variables.get(name); + try { + return o == null ? false : Boolean.parseBoolean(o.toString()); + } catch (Exception e) { + return false; + } + } + + /** + * + * @param name + * @return -1 if null. or a parseInt of the string + */ + public Integer getVarInteger(String name) { + + Object o = variables.get(name); + try { + return o == null ? -1 : Integer.parseInt(o.toString()); + } catch (Exception e) { + return -1; + } + } + + /** + * + * @param name + * @return -1 if null. or a parseDouble of the string + */ + public Double getVarDouble(String name) { + + Object o = variables.get(name); + try { + return o == null ? -1.0D : Double.parseDouble(o.toString()); + } catch (Exception e) { + return -1.0D; + } + } + + /** + * All variable keys this is holding + * + * @return Set of all variable names. + */ + public Set<String> getVarKeyList() { + + return variables.keySet(); + } + + /** + * verify is a var exists + * + * @param name the key name of the var + * @return true if that var exists + */ + public boolean hasVar(String name) { + + return variables.containsKey(name); + } + + /** + * Returns the quantity of vars this is holding + * + * @return the number of vars + */ + public int getSize() { + + return variables.size(); + } + + /** + * Remove a var from the list + * + * @param name + */ + public void removeVar(String name) { + + try { + variables.remove(name); + } catch (Exception e) { + } + owner.flagAsChanged(); + } + + public static Object parseVariableValue(String value) { + + try { + Integer i = Integer.parseInt(value); + return i; + } catch (NumberFormatException e) { + } + try { + Double d = Double.parseDouble(value); + return d; + } catch (NumberFormatException e) { + } + if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes") || value.equalsIgnoreCase("on")) { + return true; + } else if (value.equalsIgnoreCase("false") || value.equalsIgnoreCase("no") || value.equalsIgnoreCase("off")) { + return false; + } + return value; + + } + + public void clearVars() { + + variables.clear(); + owner.flagAsChanged(); + } + + /** + * @return the owner + */ + public DataUnit getOwner() { + + return owner; + } + + public boolean isEmpty() { + + return variables.isEmpty(); + } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/GroupsDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/GroupsDataHolder.java index 5d681013e..eaaaace74 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/GroupsDataHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/GroupsDataHolder.java @@ -6,8 +6,6 @@ import java.util.Map; import org.anjocaido.groupmanager.data.Group;
-
-
/**
* This container holds all Groups loaded from the relevant groupsFile.
*
@@ -31,9 +29,11 @@ public class GroupsDataHolder { * Constructor
*/
protected GroupsDataHolder() {
+
}
-
+
public void setDataSource(WorldDataHolder dataSource) {
+
this.dataSource = dataSource;
//push this data source to the users, so they pull the correct groups data.
for (Group group : groups.values())
@@ -44,6 +44,7 @@ public class GroupsDataHolder { * @return the defaultGroup
*/
public Group getDefaultGroup() {
+
return defaultGroup;
}
@@ -51,6 +52,7 @@ public class GroupsDataHolder { * @param defaultGroup the defaultGroup to set
*/
public void setDefaultGroup(Group defaultGroup) {
+
this.defaultGroup = defaultGroup;
}
@@ -58,20 +60,23 @@ public class GroupsDataHolder { * @return the groups
*/
public Map<String, Group> getGroups() {
+
return groups;
}
-
+
/**
* @param groups the groups to set
*/
public void setGroups(Map<String, Group> groups) {
+
this.groups = groups;
}
-
+
/**
* @return the groupsFile
*/
public File getGroupsFile() {
+
return groupsFile;
}
@@ -79,6 +84,7 @@ public class GroupsDataHolder { * @param groupsFile the groupsFile to set
*/
public void setGroupsFile(File groupsFile) {
+
this.groupsFile = groupsFile;
}
@@ -86,6 +92,7 @@ public class GroupsDataHolder { * @return the haveGroupsChanged
*/
public boolean HaveGroupsChanged() {
+
return haveGroupsChanged;
}
@@ -93,6 +100,7 @@ public class GroupsDataHolder { * @param haveGroupsChanged the haveGroupsChanged to set
*/
public void setGroupsChanged(boolean haveGroupsChanged) {
+
this.haveGroupsChanged = haveGroupsChanged;
}
@@ -100,6 +108,7 @@ public class GroupsDataHolder { * @return the timeStampGroups
*/
public long getTimeStampGroups() {
+
return timeStampGroups;
}
@@ -107,6 +116,7 @@ public class GroupsDataHolder { * @param timeStampGroups the timeStampGroups to set
*/
public void setTimeStampGroups(long timeStampGroups) {
+
this.timeStampGroups = timeStampGroups;
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java index b37c55e51..84561b6e5 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java @@ -11,195 +11,204 @@ import java.util.Map; import org.anjocaido.groupmanager.data.User; /** - * + * * @author gabrielcouto */ public class OverloadedWorldHolder extends WorldDataHolder { - /** + /** * */ - protected Map<String, User> overloadedUsers = new HashMap<String, User>(); + protected Map<String, User> overloadedUsers = new HashMap<String, User>(); - /** - * - * @param ph - */ - public OverloadedWorldHolder(WorldDataHolder ph) { - super(ph.getName()); - this.setGroupsFile(ph.getGroupsFile()); - this.setUsersFile(ph.getUsersFile()); - //this.setDefaultGroup(ph.getDefaultGroup()); - this.groups = ph.groups; - this.users = ph.users; - } - - /** - * - * @param userName - * @return user object or a new user if none exists. - */ - @Override - public User getUser(String userName) { - //OVERLOADED CODE - String userNameLowered = userName.toLowerCase(); - if (overloadedUsers.containsKey(userNameLowered)) { - return overloadedUsers.get(userNameLowered); - } - //END CODE - if (getUsers().containsKey(userNameLowered)) { - return getUsers().get(userNameLowered); - } - User newUser = createUser(userName); - setUsersChanged(true); - return newUser; - } - - /** - * - * @param theUser - */ - @Override - public void addUser(User theUser) { - if (theUser.getDataSource() != this) { - theUser = theUser.clone(this); - } - if (theUser == null) { - return; - } - if ((theUser.getGroup() == null) || (!getGroups().containsKey(theUser.getGroupName().toLowerCase()))) { - theUser.setGroup(getDefaultGroup()); - } - //OVERLOADED CODE - if (overloadedUsers.containsKey(theUser.getName().toLowerCase())) { - overloadedUsers.remove(theUser.getName().toLowerCase()); - overloadedUsers.put(theUser.getName().toLowerCase(), theUser); - return; - } - //END CODE - removeUser(theUser.getName()); - getUsers().put(theUser.getName().toLowerCase(), theUser); - setUsersChanged(true); - } - - /** - * - * @param userName - * @return true if removed/false if not found. - */ - @Override - public boolean removeUser(String userName) { - //OVERLOADED CODE - if (overloadedUsers.containsKey(userName.toLowerCase())) { - overloadedUsers.remove(userName.toLowerCase()); - return true; - } - //END CODE - if (getUsers().containsKey(userName.toLowerCase())) { - getUsers().remove(userName.toLowerCase()); - setUsersChanged(true); - return true; - } - return false; - } - - @Override - public boolean removeGroup(String groupName) { - if (groupName.equals(getDefaultGroup())) { - return false; - } - for (String key : getGroups().keySet()) { - if (groupName.equalsIgnoreCase(key)) { - getGroups().remove(key); - for (String userKey : getUsers().keySet()) { - User user = getUsers().get(userKey); - if (user.getGroupName().equalsIgnoreCase(key)) { - user.setGroup(getDefaultGroup()); - } - - } - //OVERLOADED CODE - for (String userKey : overloadedUsers.keySet()) { - User user = overloadedUsers.get(userKey); - if (user.getGroupName().equalsIgnoreCase(key)) { - user.setGroup(getDefaultGroup()); - } - - } - //END OVERLOAD - setGroupsChanged(true); - return true; - } - } - return false; - } - - /** - * - * @return Collection of all users - */ - @Override - public Collection<User> getUserList() { - Collection<User> overloadedList = new ArrayList<User>(); - Collection<User> normalList = getUsers().values(); - for (User u : normalList) { - if (overloadedUsers.containsKey(u.getName().toLowerCase())) { - overloadedList.add(overloadedUsers.get(u.getName().toLowerCase())); - } else { - overloadedList.add(u); - } - } - return overloadedList; - } - - /** - * - * @param userName - * @return true if user is overloaded. - */ - public boolean isOverloaded(String userName) { - return overloadedUsers.containsKey(userName.toLowerCase()); - } + /** + * + * @param ph + */ + public OverloadedWorldHolder(WorldDataHolder ph) { - /** - * - * @param userName - */ - public void overloadUser(String userName) { - if (!isOverloaded(userName)) { - User theUser = getUser(userName); - theUser = theUser.clone(); - if (overloadedUsers.containsKey(theUser.getName().toLowerCase())) { - overloadedUsers.remove(theUser.getName().toLowerCase()); - } - overloadedUsers.put(theUser.getName().toLowerCase(), theUser); - } - } - - /** - * - * @param userName - */ - public void removeOverload(String userName) { - overloadedUsers.remove(userName.toLowerCase()); - } - - /** - * Gets the user in normal state. Surpassing the overload state. - * It doesn't affect permissions. But it enables plugins change the - * actual user permissions even in overload mode. - * - * @param userName - * @return user object - */ - public User surpassOverload(String userName) { - if (!isOverloaded(userName)) { - return getUser(userName); - } - if (getUsers().containsKey(userName.toLowerCase())) { - return getUsers().get(userName.toLowerCase()); - } - User newUser = createUser(userName); - return newUser; - } + super(ph.getName()); + this.setGroupsFile(ph.getGroupsFile()); + this.setUsersFile(ph.getUsersFile()); + this.groups = ph.groups; + this.users = ph.users; + } + + /** + * + * @param userName + * @return user object or a new user if none exists. + */ + @Override + public User getUser(String userName) { + + //OVERLOADED CODE + String userNameLowered = userName.toLowerCase(); + if (overloadedUsers.containsKey(userNameLowered)) { + return overloadedUsers.get(userNameLowered); + } + //END CODE + if (getUsers().containsKey(userNameLowered)) { + return getUsers().get(userNameLowered); + } + User newUser = createUser(userName); + setUsersChanged(true); + return newUser; + } + + /** + * + * @param theUser + */ + @Override + public void addUser(User theUser) { + + if (theUser.getDataSource() != this) { + theUser = theUser.clone(this); + } + if (theUser == null) { + return; + } + if ((theUser.getGroup() == null) || (!getGroups().containsKey(theUser.getGroupName().toLowerCase()))) { + theUser.setGroup(getDefaultGroup()); + } + //OVERLOADED CODE + if (overloadedUsers.containsKey(theUser.getName().toLowerCase())) { + overloadedUsers.remove(theUser.getName().toLowerCase()); + overloadedUsers.put(theUser.getName().toLowerCase(), theUser); + return; + } + //END CODE + removeUser(theUser.getName()); + getUsers().put(theUser.getName().toLowerCase(), theUser); + setUsersChanged(true); + } + + /** + * + * @param userName + * @return true if removed/false if not found. + */ + @Override + public boolean removeUser(String userName) { + + //OVERLOADED CODE + if (overloadedUsers.containsKey(userName.toLowerCase())) { + overloadedUsers.remove(userName.toLowerCase()); + return true; + } + //END CODE + if (getUsers().containsKey(userName.toLowerCase())) { + getUsers().remove(userName.toLowerCase()); + setUsersChanged(true); + return true; + } + return false; + } + + @Override + public boolean removeGroup(String groupName) { + + if (groupName.equals(getDefaultGroup())) { + return false; + } + for (String key : getGroups().keySet()) { + if (groupName.equalsIgnoreCase(key)) { + getGroups().remove(key); + for (String userKey : getUsers().keySet()) { + User user = getUsers().get(userKey); + if (user.getGroupName().equalsIgnoreCase(key)) { + user.setGroup(getDefaultGroup()); + } + + } + //OVERLOADED CODE + for (String userKey : overloadedUsers.keySet()) { + User user = overloadedUsers.get(userKey); + if (user.getGroupName().equalsIgnoreCase(key)) { + user.setGroup(getDefaultGroup()); + } + + } + //END OVERLOAD + setGroupsChanged(true); + return true; + } + } + return false; + } + + /** + * + * @return Collection of all users + */ + @Override + public Collection<User> getUserList() { + + Collection<User> overloadedList = new ArrayList<User>(); + Collection<User> normalList = getUsers().values(); + for (User u : normalList) { + if (overloadedUsers.containsKey(u.getName().toLowerCase())) { + overloadedList.add(overloadedUsers.get(u.getName().toLowerCase())); + } else { + overloadedList.add(u); + } + } + return overloadedList; + } + + /** + * + * @param userName + * @return true if user is overloaded. + */ + public boolean isOverloaded(String userName) { + + return overloadedUsers.containsKey(userName.toLowerCase()); + } + + /** + * + * @param userName + */ + public void overloadUser(String userName) { + + if (!isOverloaded(userName)) { + User theUser = getUser(userName); + theUser = theUser.clone(); + if (overloadedUsers.containsKey(theUser.getName().toLowerCase())) { + overloadedUsers.remove(theUser.getName().toLowerCase()); + } + overloadedUsers.put(theUser.getName().toLowerCase(), theUser); + } + } + + /** + * + * @param userName + */ + public void removeOverload(String userName) { + + overloadedUsers.remove(userName.toLowerCase()); + } + + /** + * Gets the user in normal state. Surpassing the overload state. + * It doesn't affect permissions. But it enables plugins change the + * actual user permissions even in overload mode. + * + * @param userName + * @return user object + */ + public User surpassOverload(String userName) { + + if (!isOverloaded(userName)) { + return getUser(userName); + } + if (getUsers().containsKey(userName.toLowerCase())) { + return getUsers().get(userName.toLowerCase()); + } + User newUser = createUser(userName); + return newUser; + } }
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/UsersDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/UsersDataHolder.java index fa2ccaf84..665fe227d 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/UsersDataHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/UsersDataHolder.java @@ -6,8 +6,6 @@ import java.util.Map; import org.anjocaido.groupmanager.data.User;
-
-
/**
* This container holds all Users loaded from the relevant usersFile.
*
@@ -30,27 +28,31 @@ public class UsersDataHolder { * Constructor
*/
protected UsersDataHolder() {
+
}
-
+
public void setDataSource(WorldDataHolder dataSource) {
+
this.dataSource = dataSource;
//push this data source to the users, so they pull the correct groups data.
for (User user : users.values())
user.setDataSource(this.dataSource);
-
+
}
/**
* @return the users
*/
public Map<String, User> getUsers() {
+
return users;
}
-
+
/**
* @param users the users to set
*/
public void setUsers(Map<String, User> users) {
+
this.users = users;
}
@@ -58,6 +60,7 @@ public class UsersDataHolder { * @return the usersFile
*/
public File getUsersFile() {
+
return usersFile;
}
@@ -65,6 +68,7 @@ public class UsersDataHolder { * @param usersFile the usersFile to set
*/
public void setUsersFile(File usersFile) {
+
this.usersFile = usersFile;
}
@@ -72,6 +76,7 @@ public class UsersDataHolder { * @return the haveUsersChanged
*/
public boolean HaveUsersChanged() {
+
return haveUsersChanged;
}
@@ -79,6 +84,7 @@ public class UsersDataHolder { * @param haveUsersChanged the haveUsersChanged to set
*/
public void setUsersChanged(boolean haveUsersChanged) {
+
this.haveUsersChanged = haveUsersChanged;
}
@@ -86,6 +92,7 @@ public class UsersDataHolder { * @return the timeStampUsers
*/
public long getTimeStampUsers() {
+
return timeStampUsers;
}
@@ -93,6 +100,7 @@ public class UsersDataHolder { * @param timeStampUsers the timeStampUsers to set
*/
public void setTimeStampUsers(long timeStampUsers) {
+
this.timeStampUsers = timeStampUsers;
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java index e766b6c78..fefc698f9 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java @@ -14,6 +14,7 @@ import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.logging.Level; @@ -44,339 +45,371 @@ import org.yaml.snakeyaml.reader.UnicodeReader; */ public class WorldDataHolder { - /** - * World name - */ - protected String name; - /** - * The actual groups holder - */ - protected GroupsDataHolder groups = new GroupsDataHolder(); /** - * The actual users holder - */ - protected UsersDataHolder users = new UsersDataHolder(); - /** + * World name + */ + protected String name; + /** + * The actual groups holder + */ + protected GroupsDataHolder groups = new GroupsDataHolder(); + /** + * The actual users holder + */ + protected UsersDataHolder users = new UsersDataHolder(); + /** * */ - protected AnjoPermissionsHandler permissionsHandler; + protected AnjoPermissionsHandler permissionsHandler; - /** - * Prevent direct instantiation - * @param worldName - */ - public WorldDataHolder(String worldName) { - name = worldName; - } - - /** - * The main constructor for a new WorldDataHolder - * @param worldName - * @param groups - * @param users - */ - public WorldDataHolder(String worldName, GroupsDataHolder groups, UsersDataHolder users) { - this.name = worldName; - this.groups = groups; - this.users = users; - - //this.defaultGroup = defaultGroup; - } - - /** - * update the dataSource to point to this object. - * - * This should be called whenever a set of world data is fetched. - */ - public void updateDataSource() { - this.groups.setDataSource(this); - this.users.setDataSource(this); - } - - /** - * Search for a user. If it doesn't exist, create a new one with - * default group. - * - * @param userName the name of the user - * @return class that manage that user permission - */ - public User getUser(String userName) { - if (getUsers().containsKey(userName.toLowerCase())) { - return getUsers().get(userName.toLowerCase()); - } - User newUser = createUser(userName); - return newUser; - } - - /** - * Add a user to the list. If it already exists, overwrite the old. - * @param theUser the user you want to add to the permission list - */ - public void addUser(User theUser) { - if (theUser.getDataSource() != this) { - theUser = theUser.clone(this); - } - if (theUser == null) { - return; - } - if ((theUser.getGroup() == null)) { - theUser.setGroup(groups.getDefaultGroup()); - } - removeUser(theUser.getName()); - getUsers().put(theUser.getName().toLowerCase(), theUser); - setUsersChanged(true); - if (GroupManager.isLoaded()) - GroupManagerEventHandler.callEvent(theUser, Action.USER_ADDED); - } - - /** - * Removes the user from the list. (he might become a default user) - * @param userName the username from the user to remove - * @return true if it had something to remove - */ - public boolean removeUser(String userName) { - if (getUsers().containsKey(userName.toLowerCase())) { - getUsers().remove(userName.toLowerCase()); - setUsersChanged(true); - if (GroupManager.isLoaded()) - GroupManagerEventHandler.callEvent(userName, GMUserEvent.Action.USER_REMOVED); - return true; - } - return false; - } - - /** - * - * @param userName - * @return true if we have data for this player. - */ - public boolean isUserDeclared(String userName) { - return getUsers().containsKey(userName.toLowerCase()); - } + * Prevent direct instantiation + * + * @param worldName + */ + public WorldDataHolder(String worldName) { - /** - * Change the default group of the file. - * @param group the group you want make default. - */ - public void setDefaultGroup(Group group) { - if (!getGroups().containsKey(group.getName().toLowerCase()) || (group.getDataSource() != this)) { - addGroup(group); - } - groups.setDefaultGroup(getGroup(group.getName())); - setGroupsChanged(true); - if (GroupManager.isLoaded()) - GroupManagerEventHandler.callEvent(GMSystemEvent.Action.DEFAULT_GROUP_CHANGED); - } - - /** - * Returns the default group of the file - * @return the default group - */ - public Group getDefaultGroup() { - return groups.getDefaultGroup(); - } - - /** - * Returns a group of the given name - * @param groupName the name of the group - * @return a group if it is found. null if not found. - */ - public Group getGroup(String groupName) { - if (groupName.toLowerCase().startsWith("g:")) - return GroupManager.getGlobalGroups().getGroup(groupName); - else - return getGroups().get(groupName.toLowerCase()); - } - - /** - * Check if a group exists. - * Its the same of getGroup, but check if it is null. - * @param groupName the name of the group - * @return true if exists. false if not. - */ - public boolean groupExists(String groupName) { - if (groupName.toLowerCase().startsWith("g:")) - return GroupManager.getGlobalGroups().hasGroup(groupName); - else - return getGroups().containsKey(groupName.toLowerCase()); - } - - /** - * Add a group to the list - * @param groupToAdd - */ - public void addGroup(Group groupToAdd) { - if (groupToAdd.getName().toLowerCase().startsWith("g:")) { - GroupManager.getGlobalGroups().addGroup(groupToAdd); - GroupManagerEventHandler.callEvent(groupToAdd, GMGroupEvent.Action.GROUP_ADDED); - return; - } - - if (groupToAdd.getDataSource() != this) { - groupToAdd = groupToAdd.clone(this); - } - removeGroup(groupToAdd.getName()); - getGroups().put(groupToAdd.getName().toLowerCase(), groupToAdd); - setGroupsChanged(true); - if (GroupManager.isLoaded()) - GroupManagerEventHandler.callEvent(groupToAdd, GMGroupEvent.Action.GROUP_ADDED); - } - - /** - * Remove the group from the list - * @param groupName - * @return true if had something to remove. false the group was default or non-existant - */ - public boolean removeGroup(String groupName) { - if (groupName.toLowerCase().startsWith("g:")) { - return GroupManager.getGlobalGroups().removeGroup(groupName); - } - - if (getDefaultGroup() != null && groupName.equalsIgnoreCase(getDefaultGroup().getName())) { - return false; - } - if (getGroups().containsKey(groupName.toLowerCase())) { - getGroups().remove(groupName.toLowerCase()); - setGroupsChanged(true); - if (GroupManager.isLoaded()) - GroupManagerEventHandler.callEvent(groupName.toLowerCase(), GMGroupEvent.Action.GROUP_REMOVED); - return true; - } - return false; - - } - - /** - * Creates a new User with the given name - * and adds it to this holder. - * @param userName the username you want - * @return null if user already exists. or new User - */ - public User createUser(String userName) { - if (getUsers().containsKey(userName.toLowerCase())) { - return null; - } - User newUser = new User(this, userName); - newUser.setGroup(groups.getDefaultGroup(), false); - addUser(newUser); - setUsersChanged(true); - return newUser; - } - - /** - * Creates a new Group with the given name - * and adds it to this holder - * @param groupName the groupname you want - * @return null if group already exists. or new Group - */ - public Group createGroup(String groupName) { - if (groupName.toLowerCase().startsWith("g:")) { - Group newGroup = new Group(groupName); - return GroupManager.getGlobalGroups().newGroup(newGroup); - } - - if (getGroups().containsKey(groupName.toLowerCase())) { - return null; - } - - Group newGroup = new Group(this, groupName); - addGroup(newGroup); - setGroupsChanged(true); - return newGroup; - } - - /** - * - * @return a collection of the groups - */ - public Collection<Group> getGroupList() { - return getGroups().values(); - } + name = worldName; + } - /** - * - * @return a collection of the users - */ - public Collection<User> getUserList() { - return getUsers().values(); - } + /** + * The main constructor for a new WorldDataHolder + * + * @param worldName + * @param groups + * @param users + */ + public WorldDataHolder(String worldName, GroupsDataHolder groups, UsersDataHolder users) { - /** - * reads the file again - */ - public void reload() { - try { - reloadGroups(); - reloadUsers(); - } catch (Exception ex) { - Logger.getLogger(WorldDataHolder.class.getName()).log(Level.SEVERE, null, ex); - } - } - - /** - * Refresh Group data from file - */ - public void reloadGroups() { - GroupManager.setLoaded(false); - try { - // temporary holder in case the load fails. - WorldDataHolder ph = new WorldDataHolder(this.getName()); - - loadGroups(ph, getGroupsFile()); - // transfer new data - resetGroups(); - for (Group tempGroup : ph.getGroupList()) { - tempGroup.clone(this); - } - this.setDefaultGroup(getGroup(ph.getDefaultGroup().getName())); - this.removeGroupsChangedFlag(); - this.setTimeStampGroups(getGroupsFile().lastModified()); - - ph = null; - } catch (Exception ex) { - Logger.getLogger(WorldDataHolder.class.getName()).log(Level.WARNING, null, ex); - } - GroupManager.setLoaded(true); - GroupManagerEventHandler.callEvent(GMSystemEvent.Action.RELOADED); - } - - /** - * Refresh Users data from file - */ - public void reloadUsers() { - GroupManager.setLoaded(false); - try { - // temporary holder in case the load fails. - WorldDataHolder ph = new WorldDataHolder(this.getName()); - // copy groups for reference - for (Group tempGroup : this.getGroupList()) { - tempGroup.clone(ph); - } - // setup the default group before loading user data. - ph.setDefaultGroup(ph.getGroup(getDefaultGroup().getName())); - loadUsers(ph, getUsersFile()); - // transfer new data - resetUsers(); - for (User tempUser : ph.getUserList()) { - tempUser.clone(this); - } - this.removeUsersChangedFlag(); - this.setTimeStampUsers(getUsersFile().lastModified()); - - ph = null; - } catch (Exception ex) { - Logger.getLogger(WorldDataHolder.class.getName()).log(Level.WARNING, null, ex); - } - GroupManager.setLoaded(true); - GroupManagerEventHandler.callEvent(GMSystemEvent.Action.RELOADED); - } - - public void loadGroups(File groupsFile) { - - GroupManager.setLoaded(false); - try { - setGroupsFile(groupsFile); + this.name = worldName; + this.groups = groups; + this.users = users; + + // this.defaultGroup = defaultGroup; + } + + /** + * update the dataSource to point to this object. + * + * This should be called whenever a set of world data is fetched. + */ + public void updateDataSource() { + + this.groups.setDataSource(this); + this.users.setDataSource(this); + } + + /** + * Search for a user. If it doesn't exist, create a new one with + * default group. + * + * @param userName the name of the user + * @return class that manage that user permission + */ + public User getUser(String userName) { + + if (getUsers().containsKey(userName.toLowerCase())) { + return getUsers().get(userName.toLowerCase()); + } + User newUser = createUser(userName); + return newUser; + } + + /** + * Add a user to the list. If it already exists, overwrite the old. + * + * @param theUser the user you want to add to the permission list + */ + public void addUser(User theUser) { + + if (theUser.getDataSource() != this) { + theUser = theUser.clone(this); + } + if (theUser == null) { + return; + } + if ((theUser.getGroup() == null)) { + theUser.setGroup(groups.getDefaultGroup()); + } + removeUser(theUser.getName()); + getUsers().put(theUser.getName().toLowerCase(), theUser); + setUsersChanged(true); + if (GroupManager.isLoaded()) + GroupManagerEventHandler.callEvent(theUser, Action.USER_ADDED); + } + + /** + * Removes the user from the list. (he might become a default user) + * + * @param userName the username from the user to remove + * @return true if it had something to remove + */ + public boolean removeUser(String userName) { + + if (getUsers().containsKey(userName.toLowerCase())) { + getUsers().remove(userName.toLowerCase()); + setUsersChanged(true); + if (GroupManager.isLoaded()) + GroupManagerEventHandler.callEvent(userName, GMUserEvent.Action.USER_REMOVED); + return true; + } + return false; + } + + /** + * + * @param userName + * @return true if we have data for this player. + */ + public boolean isUserDeclared(String userName) { + + return getUsers().containsKey(userName.toLowerCase()); + } + + /** + * Change the default group of the file. + * + * @param group the group you want make default. + */ + public void setDefaultGroup(Group group) { + + if (!getGroups().containsKey(group.getName().toLowerCase()) || (group.getDataSource() != this)) { + addGroup(group); + } + groups.setDefaultGroup(getGroup(group.getName())); + setGroupsChanged(true); + if (GroupManager.isLoaded()) + GroupManagerEventHandler.callEvent(GMSystemEvent.Action.DEFAULT_GROUP_CHANGED); + } + + /** + * Returns the default group of the file + * + * @return the default group + */ + public Group getDefaultGroup() { + + return groups.getDefaultGroup(); + } + + /** + * Returns a group of the given name + * + * @param groupName the name of the group + * @return a group if it is found. null if not found. + */ + public Group getGroup(String groupName) { + + if (groupName.toLowerCase().startsWith("g:")) + return GroupManager.getGlobalGroups().getGroup(groupName); + else + return getGroups().get(groupName.toLowerCase()); + } + + /** + * Check if a group exists. + * Its the same of getGroup, but check if it is null. + * + * @param groupName the name of the group + * @return true if exists. false if not. + */ + public boolean groupExists(String groupName) { + + if (groupName.toLowerCase().startsWith("g:")) + return GroupManager.getGlobalGroups().hasGroup(groupName); + else + return getGroups().containsKey(groupName.toLowerCase()); + } + + /** + * Add a group to the list + * + * @param groupToAdd + */ + public void addGroup(Group groupToAdd) { + + if (groupToAdd.getName().toLowerCase().startsWith("g:")) { + GroupManager.getGlobalGroups().addGroup(groupToAdd); + GroupManagerEventHandler.callEvent(groupToAdd, GMGroupEvent.Action.GROUP_ADDED); + return; + } + + if (groupToAdd.getDataSource() != this) { + groupToAdd = groupToAdd.clone(this); + } + removeGroup(groupToAdd.getName()); + getGroups().put(groupToAdd.getName().toLowerCase(), groupToAdd); + setGroupsChanged(true); + if (GroupManager.isLoaded()) + GroupManagerEventHandler.callEvent(groupToAdd, GMGroupEvent.Action.GROUP_ADDED); + } + + /** + * Remove the group from the list + * + * @param groupName + * @return true if had something to remove. false the group was default or + * non-existant + */ + public boolean removeGroup(String groupName) { + + if (groupName.toLowerCase().startsWith("g:")) { + return GroupManager.getGlobalGroups().removeGroup(groupName); + } + + if (getDefaultGroup() != null && groupName.equalsIgnoreCase(getDefaultGroup().getName())) { + return false; + } + if (getGroups().containsKey(groupName.toLowerCase())) { + getGroups().remove(groupName.toLowerCase()); + setGroupsChanged(true); + if (GroupManager.isLoaded()) + GroupManagerEventHandler.callEvent(groupName.toLowerCase(), GMGroupEvent.Action.GROUP_REMOVED); + return true; + } + return false; + + } + + /** + * Creates a new User with the given name + * and adds it to this holder. + * + * @param userName the username you want + * @return null if user already exists. or new User + */ + public User createUser(String userName) { + + if (getUsers().containsKey(userName.toLowerCase())) { + return null; + } + User newUser = new User(this, userName); + newUser.setGroup(groups.getDefaultGroup(), false); + addUser(newUser); + setUsersChanged(true); + return newUser; + } + + /** + * Creates a new Group with the given name + * and adds it to this holder + * + * @param groupName the groupname you want + * @return null if group already exists. or new Group + */ + public Group createGroup(String groupName) { + + if (groupName.toLowerCase().startsWith("g:")) { + Group newGroup = new Group(groupName); + return GroupManager.getGlobalGroups().newGroup(newGroup); + } + + if (getGroups().containsKey(groupName.toLowerCase())) { + return null; + } + + Group newGroup = new Group(this, groupName); + addGroup(newGroup); + setGroupsChanged(true); + return newGroup; + } + + /** + * + * @return a collection of the groups + */ + public Collection<Group> getGroupList() { + + return getGroups().values(); + } + + /** + * + * @return a collection of the users + */ + public Collection<User> getUserList() { + + return getUsers().values(); + } + + /** + * reads the file again + */ + public void reload() { + + try { + reloadGroups(); + reloadUsers(); + } catch (Exception ex) { + Logger.getLogger(WorldDataHolder.class.getName()).log(Level.SEVERE, null, ex); + } + } + + /** + * Refresh Group data from file + */ + public void reloadGroups() { + + GroupManager.setLoaded(false); + try { + // temporary holder in case the load fails. + WorldDataHolder ph = new WorldDataHolder(this.getName()); + + loadGroups(ph, getGroupsFile()); + // transfer new data + resetGroups(); + for (Group tempGroup : ph.getGroupList()) { + tempGroup.clone(this); + } + this.setDefaultGroup(getGroup(ph.getDefaultGroup().getName())); + this.removeGroupsChangedFlag(); + this.setTimeStampGroups(getGroupsFile().lastModified()); + + ph = null; + } catch (Exception ex) { + Logger.getLogger(WorldDataHolder.class.getName()).log(Level.WARNING, null, ex); + } + GroupManager.setLoaded(true); + GroupManagerEventHandler.callEvent(GMSystemEvent.Action.RELOADED); + } + + /** + * Refresh Users data from file + */ + public void reloadUsers() { + + GroupManager.setLoaded(false); + try { + // temporary holder in case the load fails. + WorldDataHolder ph = new WorldDataHolder(this.getName()); + // copy groups for reference + for (Group tempGroup : this.getGroupList()) { + tempGroup.clone(ph); + } + // setup the default group before loading user data. + ph.setDefaultGroup(ph.getGroup(getDefaultGroup().getName())); + loadUsers(ph, getUsersFile()); + // transfer new data + resetUsers(); + for (User tempUser : ph.getUserList()) { + tempUser.clone(this); + } + this.removeUsersChangedFlag(); + this.setTimeStampUsers(getUsersFile().lastModified()); + + ph = null; + } catch (Exception ex) { + Logger.getLogger(WorldDataHolder.class.getName()).log(Level.WARNING, null, ex); + } + GroupManager.setLoaded(true); + GroupManagerEventHandler.callEvent(GMSystemEvent.Action.RELOADED); + } + + public void loadGroups(File groupsFile) { + + GroupManager.setLoaded(false); + try { + setGroupsFile(groupsFile); loadGroups(this, groupsFile); } catch (FileNotFoundException e) { e.printStackTrace(); @@ -386,14 +419,14 @@ public class WorldDataHolder { throw new IllegalArgumentException("Error access the groups file!\n" + groupsFile.getPath()); } - GroupManager.setLoaded(true); - } - - public void loadUsers(File usersFile) { + GroupManager.setLoaded(true); + } + + public void loadUsers(File usersFile) { - GroupManager.setLoaded(false); - try { - setUsersFile(usersFile); + GroupManager.setLoaded(false); + try { + setUsersFile(usersFile); loadUsers(this, usersFile); } catch (FileNotFoundException e) { e.printStackTrace(); @@ -403,641 +436,888 @@ public class WorldDataHolder { throw new IllegalArgumentException("Error access the users file!\n" + usersFile.getPath()); } - GroupManager.setLoaded(true); - } - /** - * Returns a NEW data holder containing data read from the files - * - * @param worldName - * @param groupsFile - * @param usersFile - * - * @throws FileNotFoundException - * @throws IOException - */ - public static WorldDataHolder load(String worldName, File groupsFile, File usersFile) throws FileNotFoundException, IOException { - WorldDataHolder ph = new WorldDataHolder(worldName); - - GroupManager.setLoaded(false); - if (groupsFile != null) loadGroups(ph, groupsFile); - if (usersFile != null) loadUsers(ph, usersFile); - GroupManager.setLoaded(true); - - return ph; - } - - /** - * Updates the WorldDataHolder from the Groups file - * - * @param ph - * @param groupsFile - * - * @throws FileNotFoundException - * @throws IOException - */ - @SuppressWarnings({"rawtypes", "unchecked"}) - protected static void loadGroups(WorldDataHolder ph, File groupsFile) throws FileNotFoundException, IOException { - - //READ GROUPS FILE - Yaml yamlGroups = new Yaml(new SafeConstructor()); - Map<String, Object> groupsRootDataNode; - if (!groupsFile.exists()) { - throw new IllegalArgumentException("The file which should contain groups does not exist!\n" + groupsFile.getPath()); - } - FileInputStream groupsInputStream = new FileInputStream(groupsFile); - try { - groupsRootDataNode = (Map<String, Object>) yamlGroups.load(new UnicodeReader(groupsInputStream)); - if (groupsRootDataNode == null) { - throw new NullPointerException(); - } - } catch (Exception ex) { - throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + groupsFile.getPath(), ex); - } finally { - groupsInputStream.close(); - } - - //PROCESS GROUPS FILE - Map<String, List<String>> inheritance = new HashMap<String, List<String>>(); - try { - Map<String, Object> allGroupsNode = (Map<String, Object>) groupsRootDataNode.get("groups"); - for (String groupKey : allGroupsNode.keySet()) { - Map<String, Object> thisGroupNode = (Map<String, Object>) allGroupsNode.get(groupKey); - Group thisGrp = ph.createGroup(groupKey); - if (thisGrp == null) { - throw new IllegalArgumentException("I think this Group was declared more than once: " + groupKey + " in file: " + groupsFile.getPath()); - } - if (thisGroupNode.get("default") == null) { - thisGroupNode.put("default", false); - } - if ((Boolean.parseBoolean(thisGroupNode.get("default").toString()))) { - if (ph.getDefaultGroup() != null) { - GroupManager.logger.warning("The group " + thisGrp.getName() + " is claiming to be default where" + ph.getDefaultGroup().getName() + " already was."); - GroupManager.logger.warning("Overriding first request for file: " + groupsFile.getPath()); - } - ph.setDefaultGroup(thisGrp); - } - - //PERMISSIONS NODE - try { - if (thisGroupNode.get("permissions") == null) { - thisGroupNode.put("permissions", new ArrayList<String>()); - } else { - if (thisGroupNode.get("permissions") instanceof List) { - for (Object o : ((List) thisGroupNode.get("permissions"))) { - try { - thisGrp.addPermission(o.toString()); - } catch (NullPointerException e) { - // Ignore this entry as it's null. - //throw new IllegalArgumentException("Invalid permission node in group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); - } - } - } else if (thisGroupNode.get("permissions") instanceof String) { - thisGrp.addPermission((String) thisGroupNode.get("permissions")); - } else { - throw new IllegalArgumentException("Unknown type of permissions node(Should be String or List<String>) for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); - } - thisGrp.sortPermissions(); - } - } catch (Exception e) { - throw new IllegalArgumentException("Invalid formatting found in permissions section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); - } - - //INFO NODE - try { - if (thisGroupNode.get("info") instanceof Map) { - Map<String, Object> infoNode = (Map<String, Object>) thisGroupNode.get("info"); - if (infoNode != null) { - thisGrp.setVariables(infoNode); - } - } else - throw new IllegalArgumentException("Unknown entry found in Info section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); - } catch (Exception e1) { - throw new IllegalArgumentException("Invalid formatting found in info section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); - } - - //END INFO NODE - - try { - if (thisGroupNode.get("inheritance") == null || thisGroupNode.get("inheritance") instanceof List) { - Object inheritNode = thisGroupNode.get("inheritance"); - if (inheritNode == null) { - thisGroupNode.put("inheritance", new ArrayList<String>()); - } else if (inheritNode instanceof List) { - List<String> groupsInh = (List<String>) inheritNode; - for (String grp : groupsInh) { - if (inheritance.get(groupKey) == null) { - List<String> thisInherits = new ArrayList<String>(); - inheritance.put(groupKey, thisInherits); - } - inheritance.get(groupKey).add(grp); - - } - } - }else - throw new IllegalArgumentException("Unknown entry found in inheritance section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); - } catch (Exception e2) { - throw new IllegalArgumentException("Invalid formatting found in inheritance section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); - } - } - } catch (Exception ex) { - ex.printStackTrace(); - throw new IllegalArgumentException("Your " + groupsFile.getPath() + " file is invalid. See console for details."); - } - - if (ph.getDefaultGroup() == null) { - throw new IllegalArgumentException("There was no Default Group declared in file: " + groupsFile.getPath()); - } - for (String groupKey : inheritance.keySet()) { - List<String> inheritedList = inheritance.get(groupKey); - Group thisGroup = ph.getGroup(groupKey); - for (String inheritedKey : inheritedList) { - Group inheritedGroup = ph.getGroup(inheritedKey); - if (thisGroup != null && inheritedGroup != null) { - thisGroup.addInherits(inheritedGroup); - } - } - } - - ph.removeGroupsChangedFlag(); - // Update the LastModified time. - ph.setGroupsFile(groupsFile); - ph.setTimeStampGroups(groupsFile.lastModified()); - - //return ph; - } - - /** - * Updates the WorldDataHolder from the Users file - * - * @param ph - * @param usersFile - * - * @throws FileNotFoundException - * @throws IOException - */ - @SuppressWarnings({"rawtypes", "unchecked"}) - protected static void loadUsers(WorldDataHolder ph, File usersFile) throws FileNotFoundException, IOException { - - //READ USERS FILE - Yaml yamlUsers = new Yaml(new SafeConstructor()); - Map<String, Object> usersRootDataNode; - if (!usersFile.exists()) { - throw new IllegalArgumentException("The file which should contain users does not exist!\n" + usersFile.getPath()); - } - FileInputStream usersInputStream = new FileInputStream(usersFile); - try { - usersRootDataNode = (Map<String, Object>) yamlUsers.load(new UnicodeReader(usersInputStream)); - if (usersRootDataNode == null) { - throw new NullPointerException(); - } - } catch (Exception ex) { - throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + usersFile.getPath(), ex); - } finally { - usersInputStream.close(); - } - - // PROCESS USERS FILE - Map<String, Object> allUsersNode = (Map<String, Object>) usersRootDataNode.get("users"); - - // Load users if the file is NOT empty - if (allUsersNode != null) - for (String usersKey : allUsersNode.keySet()) { - Map<String, Object> thisUserNode = (Map<String, Object>) allUsersNode.get(usersKey); - User thisUser = ph.createUser(usersKey); - if (thisUser == null) { - throw new IllegalArgumentException("I think this user was declared more than once: " + usersKey + " in file: " + usersFile.getPath()); - } - if (thisUserNode.get("permissions") == null) { - thisUserNode.put("permissions", new ArrayList<String>()); - } else { - if (thisUserNode.get("permissions") instanceof List) { - for (Object o : ((List) thisUserNode.get("permissions"))) { - thisUser.addPermission(o.toString()); - } - } else if (thisUserNode.get("permissions") instanceof String) { - try { - thisUser.addPermission(thisUserNode.get("permissions").toString()); - } catch (NullPointerException e) { - // Ignore this entry as it's null. - //throw new IllegalArgumentException("Invalid permission node for user: " + thisUser.getName() + " in file: " + UserFile.getPath()); - } - } - thisUser.sortPermissions(); - } - - //SUBGROUPS LOADING - if (thisUserNode.get("subgroups") == null) { - thisUserNode.put("subgroups", new ArrayList<String>()); - } - if (thisUserNode.get("subgroups") instanceof List) { - for (Object o : ((List) thisUserNode.get("subgroups"))) { - Group subGrp = ph.getGroup(o.toString()); - if (subGrp != null) { - thisUser.addSubGroup(subGrp); - } else { - GroupManager.logger.warning("Subgroup " + o.toString() + " not found for user " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath()); - } - } - } else if (thisUserNode.get("subgroups") instanceof String) { - Group subGrp = ph.getGroup(thisUserNode.get("subgroups").toString()); - if (subGrp != null) { - thisUser.addSubGroup(subGrp); - } else { - GroupManager.logger.warning("Subgroup " + thisUserNode.get("subgroups").toString() + " not found for user " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath()); - } - } - - - //USER INFO NODE - - //INFO NODE - 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()); - if (hisGroup == null) { - GroupManager.logger.warning("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName() + ": Set to '" + ph.getDefaultGroup().getName() + "' for file: " + usersFile.getPath()); - hisGroup = ph.getDefaultGroup(); - //throw new IllegalArgumentException("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName()); - } - thisUser.setGroup(hisGroup); - } else { - thisUser.setGroup(ph.getDefaultGroup()); - } - } - - ph.removeUsersChangedFlag(); - // Update the LastModified time. - ph.setUsersFile(usersFile); - ph.setTimeStampUsers(usersFile.lastModified()); - } - - /** - * Write a dataHolder in a specified file - * @param ph - * @param groupsFile - */ - public static void writeGroups(WorldDataHolder ph, File groupsFile) { - Map<String, Object> root = new HashMap<String, Object>(); - - Map<String, Object> groupsMap = new HashMap<String, Object>(); - - root.put("groups", groupsMap); - for (String groupKey : ph.getGroups().keySet()) { - Group group = ph.getGroups().get(groupKey); - - Map<String, Object> aGroupMap = new HashMap<String, Object>(); - groupsMap.put(group.getName(), aGroupMap); - - if (ph.getDefaultGroup() == null) { - GroupManager.logger.severe("There is no default group for world: " + ph.getName()); - } - aGroupMap.put("default", group.equals(ph.getDefaultGroup())); - - Map<String, Object> infoMap = new HashMap<String, Object>(); - aGroupMap.put("info", infoMap); - - for (String infoKey : group.getVariables().getVarKeyList()) { - infoMap.put(infoKey, group.getVariables().getVarObject(infoKey)); - } - - aGroupMap.put("inheritance", group.getInherits()); - - aGroupMap.put("permissions", group.getPermissionList()); - } - - if (!root.isEmpty()) { - DumperOptions opt = new DumperOptions(); - opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); - final Yaml yaml = new Yaml(opt); - try { - OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(groupsFile), "UTF-8"); - - String newLine = System.getProperty("line.separator"); - - out.write("# Group inheritance" + newLine); - out.write("# any inherited groups prefixed with a g: are global groups" + newLine); - out.write("# These groups are defined in the globalgroups.yml" + newLine); - out.write("# and can be inherited in any worlds groups/users.yml." + newLine); - out.write("#" + newLine); - out.write("# Groups without the g: prefix are groups local to this world" + newLine); - out.write("# and defined in the this groups.yml file." + newLine); - out.write(newLine); - - yaml.dump(root, out); - out.close(); - } catch (UnsupportedEncodingException ex) { - } catch (FileNotFoundException ex) { - } catch (IOException e) { + GroupManager.setLoaded(true); + } + + /** + * Returns a NEW data holder containing data read from the files + * + * @param worldName + * @param groupsFile + * @param usersFile + * + * @throws FileNotFoundException + * @throws IOException + */ + public static WorldDataHolder load(String worldName, File groupsFile, File usersFile) throws FileNotFoundException, IOException { + + WorldDataHolder ph = new WorldDataHolder(worldName); + + GroupManager.setLoaded(false); + if (groupsFile != null) + loadGroups(ph, groupsFile); + if (usersFile != null) + loadUsers(ph, usersFile); + GroupManager.setLoaded(true); + + return ph; + } + + /** + * Updates the WorldDataHolder from the Groups file + * + * @param ph + * @param groupsFile + * + * @throws FileNotFoundException + * @throws IOException + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + protected static void loadGroups(WorldDataHolder ph, File groupsFile) throws FileNotFoundException, IOException { + + // READ GROUPS FILE + + Yaml yamlGroups = new Yaml(new SafeConstructor()); + Map<String, Object> groupsRootDataNode; + + if (!groupsFile.exists()) { + throw new IllegalArgumentException("The file which should contain groups does not exist!\n" + groupsFile.getPath()); + } + FileInputStream groupsInputStream = new FileInputStream(groupsFile); + try { + groupsRootDataNode = (Map<String, Object>) yamlGroups.load(new UnicodeReader(groupsInputStream)); + if (groupsRootDataNode == null) { + throw new NullPointerException(); } - } - - // Update the LastModified time. - ph.setGroupsFile(groupsFile); - ph.setTimeStampGroups(groupsFile.lastModified()); - ph.removeGroupsChangedFlag(); - - if (GroupManager.isLoaded()) - GroupManagerEventHandler.callEvent(GMSystemEvent.Action.SAVED); - - /*FileWriter tx = null; - try { - tx = new FileWriter(groupsFile, false); - tx.write(yaml.dump(root)); - tx.flush(); - } catch (Exception e) { - } finally { - try { - tx.close(); - } catch (IOException ex) { - } - }*/ - } - - /** - * Write a dataHolder in a specified file - * @param ph - * @param usersFile - */ - public static void writeUsers(WorldDataHolder ph, File usersFile) { - Map<String, Object> root = new HashMap<String, Object>(); - - Map<String, Object> usersMap = new HashMap<String, Object>(); - root.put("users", usersMap); - for (String userKey : ph.getUsers().keySet()) { - User user = ph.getUsers().get(userKey); - if ((user.getGroup() == null || user.getGroup().equals(ph.getDefaultGroup())) && user.getPermissionList().isEmpty() && user.getVariables().isEmpty() && user.isSubGroupsEmpty()) { - continue; - } - - Map<String, Object> aUserMap = new HashMap<String, Object>(); - usersMap.put(user.getName(), aUserMap); - - if (user.getGroup() == null) { - aUserMap.put("group", ph.getDefaultGroup().getName()); - } else { - aUserMap.put("group", user.getGroup().getName()); - } - //USER INFO NODE - BETA - if (user.getVariables().getSize() > 0) { - Map<String, Object> infoMap = new HashMap<String, Object>(); - aUserMap.put("info", infoMap); - for (String infoKey : user.getVariables().getVarKeyList()) { - infoMap.put(infoKey, user.getVariables().getVarObject(infoKey)); - } - } - //END USER INFO NODE - BETA - aUserMap.put("permissions", user.getPermissionList()); - - //SUBGROUPS NODE - BETA - aUserMap.put("subgroups", user.subGroupListStringCopy()); - //END SUBGROUPS NODE - BETA - } - - if (!root.isEmpty()) { - DumperOptions opt = new DumperOptions(); - opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); - final Yaml yaml = new Yaml(opt); - try { - OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(usersFile), "UTF-8"); - yaml.dump(root, out); - out.close(); - } catch (UnsupportedEncodingException ex) { - } catch (FileNotFoundException ex) { - } catch (IOException e) { + } catch (Exception ex) { + throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + groupsFile.getPath(), ex); + } finally { + groupsInputStream.close(); + } + + // PROCESS GROUPS FILE + + Map<String, List<String>> inheritance = new HashMap<String, List<String>>(); + Map<String, Object> allGroupsNode = null; + + /* + * Fetch all groups under the 'groups' entry. + */ + try { + allGroupsNode = (Map<String, Object>) groupsRootDataNode.get("groups"); + } catch (Exception ex) { + throw new IllegalArgumentException("Your " + groupsFile.getPath() + " file is invalid. See console for details.", ex); + } + + Iterator<String> groupItr = allGroupsNode.keySet().iterator(); + String groupKey; + Integer groupCount = 0; + + /* + * loop each group entry + * and process it's data. + */ + while (groupItr.hasNext()) { + + try { + groupCount++; + // Attempt to fetch the next group name. + groupKey = groupItr.next(); + } catch (Exception ex) { + throw new IllegalArgumentException("Invalid group name for group entry (" + groupCount + ") in file: " + groupsFile.getPath(), ex); } - } - - // Update the LastModified time. - ph.setUsersFile(usersFile); - ph.setTimeStampUsers(usersFile.lastModified()); - ph.removeUsersChangedFlag(); - - if (GroupManager.isLoaded()) - GroupManagerEventHandler.callEvent(GMSystemEvent.Action.SAVED); - - /*FileWriter tx = null; - try { - tx = new FileWriter(usersFile, false); - tx.write(yaml.dump(root)); - tx.flush(); - } catch (Exception e) { - } finally { - try { - tx.close(); - } catch (IOException ex) { - } - }*/ - } - - /** - * Don't use this. Unless you want to make this plugin to interact with original Nijikokun Permissions - * This method is supposed to make the original one reload the file, and propagate the changes made here. - * - * Prefer to use the AnjoCaido's fake version of Nijikokun's Permission plugin. - * The AnjoCaido's Permission can propagate the changes made on this plugin instantly, - * without need to save the file. - * - * @param server the server that holds the plugin - * @deprecated it is not used anymore... unless if you use original Permissions - */ - @Deprecated - public static void reloadOldPlugins(Server server) { - // Only reload permissions - PluginManager pm = server.getPluginManager(); - Plugin[] plugins = pm.getPlugins(); - for (int i = 0; i < plugins.length; i++) { - //plugins[i].getConfiguration().load(); - try { - plugins[i].getClass().getMethod("setupPermissions").invoke(plugins[i]); - } catch (Exception ex) { - continue; - } - } - } - - /** - * @return the permissionsHandler - */ - public AnjoPermissionsHandler getPermissionsHandler() { - if (permissionsHandler == null) { - permissionsHandler = new AnjoPermissionsHandler(this); - } - return permissionsHandler; - } - - /** + + /* + * Fetch this groups child nodes + */ + Map<String, Object> thisGroupNode = null; + + try { + thisGroupNode = (Map<String, Object>) allGroupsNode.get(groupKey); + } catch (Exception ex) { + throw new IllegalArgumentException("Invalid child nodes for group '" + groupKey + "' in file: " + groupsFile.getPath(), ex); + } + + /* + * Create a new group with this name + * in the assigned data source. + */ + Group thisGrp = ph.createGroup(groupKey); + + if (thisGrp == null) { + throw new IllegalArgumentException("I think this Group was declared more than once: " + groupKey + " in file: " + groupsFile.getPath()); + } + + // DEFAULT NODE + + Object nodeData = null; + try { + nodeData = thisGroupNode.get("default"); + } catch (Exception ex) { + throw new IllegalArgumentException("Bad format found in 'permissions' for group: " + groupKey + " in file: " + groupsFile.getPath()); + } + + if (nodeData == null) { + /* + * If no 'default' node is found do nothing. + */ + } else if ((Boolean.parseBoolean(nodeData.toString()))) { + /* + * Set this as the default group. + * Warn if some other group has already claimed that position. + */ + if (ph.getDefaultGroup() != null) { + GroupManager.logger.warning("The group '" + thisGrp.getName() + "' is claiming to be default where '" + ph.getDefaultGroup().getName() + "' already was."); + GroupManager.logger.warning("Overriding first default request in file: " + groupsFile.getPath()); + } + ph.setDefaultGroup(thisGrp); + } + + // PERMISSIONS NODE + + nodeData = null; + try { + nodeData = thisGroupNode.get("permissions"); + } catch (Exception ex) { + throw new IllegalArgumentException("Bad format found in 'permissions' for '" + groupKey + "' in file: " + groupsFile.getPath()); + } + + if (nodeData == null) { + /* + * If no permissions node is found, or it's empty + * do nothing. + */ + } else { + /* + * There is a permission list Which seems to hold some data + */ + if (nodeData instanceof List) { + /* + * Check each entry and add it as a new permission. + */ + try { + for (Object o : ((List) nodeData)) { + try { + /* + * Only add this permission if it's not empty. + */ + if (!o.toString().isEmpty()) + thisGrp.addPermission(o.toString()); + + } catch (NullPointerException ex) { + // Ignore this entry as it's null. It can be + // safely dropped + } + } + } catch (Exception ex) { + throw new IllegalArgumentException("Invalid formatting found in 'permissions' section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath(), ex); + } + + } else if (nodeData instanceof String) { + /* + * Only add this permission if it's not empty. + */ + if (!nodeData.toString().isEmpty()) + thisGrp.addPermission((String) nodeData); + + } else { + throw new IllegalArgumentException("Unknown type of 'permissions' node(Should be String or List<String>) for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); + } + /* + * Sort all permissions so they are in the correct order for + * checking. + */ + thisGrp.sortPermissions(); + } + + // INFO NODE + + nodeData = null; + try { + nodeData = thisGroupNode.get("info"); + } catch (Exception ex) { + throw new IllegalArgumentException("Bad format found in 'info' section for group: " + groupKey + " in file: " + groupsFile.getPath()); + } + + if (nodeData == null) { + /* + * No info section was found, so leave all variables as + * defaults. + */ + GroupManager.logger.warning("The group '" + thisGrp.getName() + "' has no 'info' section!"); + GroupManager.logger.warning("Using default values: " + groupsFile.getPath()); + + } else if (nodeData instanceof Map) { + try { + if (nodeData != null) { + thisGrp.setVariables((Map<String, Object>) nodeData); + } + } catch (Exception ex) { + throw new IllegalArgumentException("Invalid formatting found in 'info' section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath(), ex); + } + + } else + throw new IllegalArgumentException("Unknown entry found in 'info' section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); + + // INHERITANCE NODE + + nodeData = null; + try { + nodeData = thisGroupNode.get("inheritance"); + } catch (Exception ex) { + throw new IllegalArgumentException("Bad format found in 'inheritance' section for group: " + groupKey + " in file: " + groupsFile.getPath()); + } + + if (nodeData == null || nodeData instanceof List) { + if (nodeData == null) { + /* + * If no inheritance node is found, or it's empty + * do nothing. + */ + } else if (nodeData instanceof List) { + + try { + for (String grp : (List<String>) nodeData) { + if (inheritance.get(groupKey) == null) { + inheritance.put(groupKey, new ArrayList<String>()); + } + inheritance.get(groupKey).add(grp); + } + + } catch (Exception ex) { + throw new IllegalArgumentException("Invalid formatting found in 'inheritance' section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath(), ex); + } + + } + } else + throw new IllegalArgumentException("Unknown entry found in 'inheritance' section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); + + // END GROUP + + } + + if (ph.getDefaultGroup() == null) { + throw new IllegalArgumentException("There was no Default Group declared in file: " + groupsFile.getPath()); + } + + /* + * Build the inheritance map and recored any errors + */ + for (String group : inheritance.keySet()) { + List<String> inheritedList = inheritance.get(group); + Group thisGroup = ph.getGroup(group); + if (thisGroup != null) + for (String inheritedKey : inheritedList) { + if (inheritedKey != null) { + Group inheritedGroup = ph.getGroup(inheritedKey); + if (inheritedGroup != null) { + thisGroup.addInherits(inheritedGroup); + } else + GroupManager.logger.warning("Inherited group '" + inheritedKey + "' not found for group " + thisGroup.getName() + ". Ignoring entry in file: " + groupsFile.getPath()); + } + } + } + + ph.removeGroupsChangedFlag(); + // Update the LastModified time. + ph.setGroupsFile(groupsFile); + ph.setTimeStampGroups(groupsFile.lastModified()); + + // return ph; + } + + /** + * Updates the WorldDataHolder from the Users file + * + * @param ph + * @param usersFile + * + * @throws FileNotFoundException + * @throws IOException + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + protected static void loadUsers(WorldDataHolder ph, File usersFile) throws FileNotFoundException, IOException { + + // READ USERS FILE + Yaml yamlUsers = new Yaml(new SafeConstructor()); + Map<String, Object> usersRootDataNode; + if (!usersFile.exists()) { + throw new IllegalArgumentException("The file which should contain users does not exist!\n" + usersFile.getPath()); + } + FileInputStream usersInputStream = new FileInputStream(usersFile); + try { + usersRootDataNode = (Map<String, Object>) yamlUsers.load(new UnicodeReader(usersInputStream)); + if (usersRootDataNode == null) { + throw new NullPointerException(); + } + } catch (Exception ex) { + throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + usersFile.getPath(), ex); + } finally { + usersInputStream.close(); + } + + // PROCESS USERS FILE + + Map<String, Object> allUsersNode = null; + + /* + * Fetch all child nodes under the 'users' entry. + */ + try { + allUsersNode = (Map<String, Object>) usersRootDataNode.get("users"); + } catch (Exception ex) { + throw new IllegalArgumentException("Your " + usersFile.getPath() + " file is invalid. See console for details.", ex); + } + + // Load users if the file is NOT empty + + if (allUsersNode != null) { + + Iterator<String> usersItr = allUsersNode.keySet().iterator(); + String usersKey; + Integer userCount = 0; + + while (usersItr.hasNext()) { + try { + userCount++; + // Attempt to fetch the next user name. + usersKey = usersItr.next(); + } catch (Exception ex) { + throw new IllegalArgumentException("Invalid node type for user entry (" + userCount + ") in file: " + usersFile.getPath(), ex); + } + + Map<String, Object> thisUserNode = null; + try { + thisUserNode = (Map<String, Object>) allUsersNode.get(usersKey); + } catch (Exception ex) { + throw new IllegalArgumentException("Bad format found for user: " + usersKey + " in file: " + usersFile.getPath()); + } + + User thisUser = ph.createUser(usersKey); + if (thisUser == null) { + throw new IllegalArgumentException("I think this user was declared more than once: " + usersKey + " in file: " + usersFile.getPath()); + } + + // USER PERMISSIONS NODES + + Object nodeData = null; + try { + nodeData = thisUserNode.get("permissions"); + } catch (Exception ex) { + throw new IllegalArgumentException("Bad format found in 'permissions' for user: " + usersKey + " in file: " + usersFile.getPath()); + } + + if (nodeData == null) { + /* + * If no permissions node is found, or it's empty + * do nothing. + */ + } else { + if (nodeData instanceof List) { + for (Object o : ((List) nodeData)) { + /* + * Only add this permission if it's not empty + */ + if (!o.toString().isEmpty()) + thisUser.addPermission(o.toString()); + } + } else if (nodeData instanceof String) { + try { + /* + * Only add this permission if it's not empty + */ + if (!nodeData.toString().isEmpty()) + thisUser.addPermission(nodeData.toString()); + } catch (NullPointerException e) { + // Ignore this entry as it's null. + } + } + thisUser.sortPermissions(); + } + + // SUBGROUPS NODES + + nodeData = null; + try { + nodeData = thisUserNode.get("subgroups"); + } catch (Exception ex) { + throw new IllegalArgumentException("Bad format found in 'subgroups' for user: " + usersKey + " in file: " + usersFile.getPath()); + } + + if (nodeData == null) { + /* + * If no subgroups node is found, or it's empty + * do nothing. + */ + } else if (nodeData instanceof List) { + for (Object o : ((List) nodeData)) { + Group subGrp = ph.getGroup(o.toString()); + if (subGrp != null) { + thisUser.addSubGroup(subGrp); + } else { + GroupManager.logger.warning("Subgroup '" + o.toString() + "' not found for user: " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath()); + } + } + } else if (nodeData instanceof String) { + Group subGrp = ph.getGroup(nodeData.toString()); + if (subGrp != null) { + thisUser.addSubGroup(subGrp); + } else { + GroupManager.logger.warning("Subgroup '" + nodeData.toString() + "' not found for user: " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath()); + } + } + + // USER INFO NODE + + nodeData = null; + try { + nodeData = thisUserNode.get("info"); + } catch (Exception ex) { + throw new IllegalArgumentException("Bad format found in 'info' section for user: " + usersKey + " in file: " + usersFile.getPath()); + } + + if (nodeData == null) { + /* + * If no info node is found, or it's empty + * do nothing. + */ + } else if (nodeData instanceof Map) { + thisUser.setVariables((Map<String, Object>) nodeData); + + } else + throw new IllegalArgumentException("Unknown entry found in 'info' section for user: " + thisUser.getName() + " in file: " + usersFile.getPath()); + + // END INFO NODE + + // PRIMARY GROUP + + nodeData = null; + try { + nodeData = thisUserNode.get("group"); + } catch (Exception ex) { + throw new IllegalArgumentException("Bad format found in 'group' section for user: " + usersKey + " in file: " + usersFile.getPath()); + } + + if (nodeData != null) { + Group hisGroup = ph.getGroup(nodeData.toString()); + if (hisGroup == null) { + GroupManager.logger.warning("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName() + ": Set to '" + ph.getDefaultGroup().getName() + "' for file: " + usersFile.getPath()); + hisGroup = ph.getDefaultGroup(); + } + thisUser.setGroup(hisGroup); + } else { + thisUser.setGroup(ph.getDefaultGroup()); + } + } + } + + ph.removeUsersChangedFlag(); + // Update the LastModified time. + ph.setUsersFile(usersFile); + ph.setTimeStampUsers(usersFile.lastModified()); + } + + /** + * Write a dataHolder in a specified file + * + * @param ph + * @param groupsFile + */ + public static void writeGroups(WorldDataHolder ph, File groupsFile) { + + Map<String, Object> root = new HashMap<String, Object>(); + + Map<String, Object> groupsMap = new HashMap<String, Object>(); + + root.put("groups", groupsMap); + for (String groupKey : ph.getGroups().keySet()) { + Group group = ph.getGroups().get(groupKey); + + Map<String, Object> aGroupMap = new HashMap<String, Object>(); + groupsMap.put(group.getName(), aGroupMap); + + if (ph.getDefaultGroup() == null) { + GroupManager.logger.severe("There is no default group for world: " + ph.getName()); + } + aGroupMap.put("default", group.equals(ph.getDefaultGroup())); + + Map<String, Object> infoMap = new HashMap<String, Object>(); + aGroupMap.put("info", infoMap); + + for (String infoKey : group.getVariables().getVarKeyList()) { + infoMap.put(infoKey, group.getVariables().getVarObject(infoKey)); + } + + aGroupMap.put("inheritance", group.getInherits()); + + aGroupMap.put("permissions", group.getPermissionList()); + } + + if (!root.isEmpty()) { + DumperOptions opt = new DumperOptions(); + opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); + final Yaml yaml = new Yaml(opt); + try { + OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(groupsFile), "UTF-8"); + + String newLine = System.getProperty("line.separator"); + + out.write("# Group inheritance" + newLine); + out.write("#" + newLine); + out.write("# Any inherited groups prefixed with a g: are global groups" + newLine); + out.write("# and are inherited from the GlobalGroups.yml." + newLine); + out.write("#" + newLine); + out.write("# Groups without the g: prefix are groups local to this world" + newLine); + out.write("# and are defined in the this groups.yml file." + newLine); + out.write("#" + newLine); + out.write("# Local group inheritances define your promotion tree when using 'manpromote/mandemote'" + newLine); + out.write(newLine); + + yaml.dump(root, out); + out.close(); + } catch (UnsupportedEncodingException ex) { + } catch (FileNotFoundException ex) { + } catch (IOException e) { + } + } + + // Update the LastModified time. + ph.setGroupsFile(groupsFile); + ph.setTimeStampGroups(groupsFile.lastModified()); + ph.removeGroupsChangedFlag(); + + if (GroupManager.isLoaded()) + GroupManagerEventHandler.callEvent(GMSystemEvent.Action.SAVED); + + /* + * FileWriter tx = null; + * try { + * tx = new FileWriter(groupsFile, false); + * tx.write(yaml.dump(root)); + * tx.flush(); + * } catch (Exception e) { + * } finally { + * try { + * tx.close(); + * } catch (IOException ex) { + * } + * } + */ + } + + /** + * Write a dataHolder in a specified file + * + * @param ph + * @param usersFile + */ + public static void writeUsers(WorldDataHolder ph, File usersFile) { + + Map<String, Object> root = new HashMap<String, Object>(); + + Map<String, Object> usersMap = new HashMap<String, Object>(); + root.put("users", usersMap); + for (String userKey : ph.getUsers().keySet()) { + User user = ph.getUsers().get(userKey); + if ((user.getGroup() == null || user.getGroup().equals(ph.getDefaultGroup())) && user.getPermissionList().isEmpty() && user.getVariables().isEmpty() && user.isSubGroupsEmpty()) { + continue; + } + + Map<String, Object> aUserMap = new HashMap<String, Object>(); + usersMap.put(user.getName(), aUserMap); + + if (user.getGroup() == null) { + aUserMap.put("group", ph.getDefaultGroup().getName()); + } else { + aUserMap.put("group", user.getGroup().getName()); + } + // USER INFO NODE - BETA + if (user.getVariables().getSize() > 0) { + Map<String, Object> infoMap = new HashMap<String, Object>(); + aUserMap.put("info", infoMap); + for (String infoKey : user.getVariables().getVarKeyList()) { + infoMap.put(infoKey, user.getVariables().getVarObject(infoKey)); + } + } + // END USER INFO NODE - BETA + aUserMap.put("permissions", user.getPermissionList()); + + // SUBGROUPS NODE - BETA + aUserMap.put("subgroups", user.subGroupListStringCopy()); + // END SUBGROUPS NODE - BETA + } + + if (!root.isEmpty()) { + DumperOptions opt = new DumperOptions(); + opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); + final Yaml yaml = new Yaml(opt); + try { + OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(usersFile), "UTF-8"); + yaml.dump(root, out); + out.close(); + } catch (UnsupportedEncodingException ex) { + } catch (FileNotFoundException ex) { + } catch (IOException e) { + } + } + + // Update the LastModified time. + ph.setUsersFile(usersFile); + ph.setTimeStampUsers(usersFile.lastModified()); + ph.removeUsersChangedFlag(); + + if (GroupManager.isLoaded()) + GroupManagerEventHandler.callEvent(GMSystemEvent.Action.SAVED); + + /* + * FileWriter tx = null; + * try { + * tx = new FileWriter(usersFile, false); + * tx.write(yaml.dump(root)); + * tx.flush(); + * } catch (Exception e) { + * } finally { + * try { + * tx.close(); + * } catch (IOException ex) { + * } + * } + */ + } + + /** + * Don't use this. Unless you want to make this plugin to interact with + * original Nijikokun Permissions + * This method is supposed to make the original one reload the file, and + * propagate the changes made here. + * + * Prefer to use the AnjoCaido's fake version of Nijikokun's Permission + * plugin. + * The AnjoCaido's Permission can propagate the changes made on this plugin + * instantly, + * without need to save the file. + * + * @param server the server that holds the plugin + * @deprecated it is not used anymore... unless if you use original + * Permissions + */ + @Deprecated + public static void reloadOldPlugins(Server server) { + + // Only reload permissions + PluginManager pm = server.getPluginManager(); + Plugin[] plugins = pm.getPlugins(); + for (int i = 0; i < plugins.length; i++) { + // plugins[i].getConfiguration().load(); + try { + plugins[i].getClass().getMethod("setupPermissions").invoke(plugins[i]); + } catch (Exception ex) { + continue; + } + } + } + + /** + * @return the permissionsHandler + */ + public AnjoPermissionsHandler getPermissionsHandler() { + + if (permissionsHandler == null) { + permissionsHandler = new AnjoPermissionsHandler(this); + } + return permissionsHandler; + } + + /** * @param haveUsersChanged the haveUsersChanged to set */ public void setUsersChanged(boolean haveUsersChanged) { + users.setUsersChanged(haveUsersChanged); } - /** - * - * @return true if any user data has changed - */ - public boolean haveUsersChanged() { - if (users.HaveUsersChanged()) { - return true; - } - for (User u : users.getUsers().values()) { - if (u.isChanged()) { - return true; - } - } - return false; - } - - /** + /** + * + * @return true if any user data has changed + */ + public boolean haveUsersChanged() { + + if (users.HaveUsersChanged()) { + return true; + } + for (User u : users.getUsers().values()) { + if (u.isChanged()) { + return true; + } + } + return false; + } + + /** * @param setGroupsChanged the haveGroupsChanged to set */ public void setGroupsChanged(boolean setGroupsChanged) { + groups.setGroupsChanged(setGroupsChanged); } - - /** - * - * @return true if any group data has changed. - */ - public boolean haveGroupsChanged() { - if (groups.HaveGroupsChanged()) { - return true; - } - for (Group g : groups.getGroups().values()) { - if (g.isChanged()) { - return true; - } - } - return false; - } - - /** + + /** + * + * @return true if any group data has changed. + */ + public boolean haveGroupsChanged() { + + if (groups.HaveGroupsChanged()) { + return true; + } + for (Group g : groups.getGroups().values()) { + if (g.isChanged()) { + return true; + } + } + return false; + } + + /** * */ - public void removeUsersChangedFlag() { - setUsersChanged(false); - for (User u : getUsers().values()) { - u.flagAsSaved(); - } - } - - /** + public void removeUsersChangedFlag() { + + setUsersChanged(false); + for (User u : getUsers().values()) { + u.flagAsSaved(); + } + } + + /** * */ - public void removeGroupsChangedFlag() { - setGroupsChanged(false); - for (Group g : getGroups().values()) { - g.flagAsSaved(); - } - } - - /** - * @return the usersFile - */ - public File getUsersFile() { - return users.getUsersFile(); - } - - /** - * @param file the usersFile to set - */ - public void setUsersFile(File file) { - users.setUsersFile(file); - } + public void removeGroupsChangedFlag() { - /** - * @return the groupsFile - */ - public File getGroupsFile() { - return groups.getGroupsFile(); - } - - /** - * @param file the groupsFile to set - */ - public void setGroupsFile(File file) { - groups.setGroupsFile(file); - } + setGroupsChanged(false); + for (Group g : getGroups().values()) { + g.flagAsSaved(); + } + } - /** - * @return the name - */ - public String getName() { - return name; - } - - /** + /** + * @return the usersFile + */ + public File getUsersFile() { + + return users.getUsersFile(); + } + + /** + * @param file the usersFile to set + */ + public void setUsersFile(File file) { + + users.setUsersFile(file); + } + + /** + * @return the groupsFile + */ + public File getGroupsFile() { + + return groups.getGroupsFile(); + } + + /** + * @param file the groupsFile to set + */ + public void setGroupsFile(File file) { + + groups.setGroupsFile(file); + } + + /** + * @return the name + */ + public String getName() { + + return name; + } + + /** * Resets Groups. */ public void resetGroups() { - //setDefaultGroup(null); + + // setDefaultGroup(null); groups.setGroups(new HashMap<String, Group>()); } - /** + + /** * Resets Users */ public void resetUsers() { + users.setUsers(new HashMap<String, User>()); } - - /** + + /** * @return the groups */ public Map<String, Group> getGroups() { + return groups.getGroups(); } - /** + + /** * @return the users */ public Map<String, User> getUsers() { + return users.getUsers(); } - + /** * @return the groups */ public GroupsDataHolder getGroupsObject() { + return groups; } + /** * @param groupsDataHolder the GroupsDataHolder to set */ public void setGroupsObject(GroupsDataHolder groupsDataHolder) { + groups = groupsDataHolder; } - /** + + /** * @return the users */ public UsersDataHolder getUsersObject() { + return users; } + /** * @param usersDataHolder the UsersDataHolder to set */ public void setUsersObject(UsersDataHolder usersDataHolder) { + users = usersDataHolder; } - - /** + + /** * @return the timeStampGroups */ public long getTimeStampGroups() { + return groups.getTimeStampGroups(); } - /** + + /** * @return the timeStampUsers */ public long getTimeStampUsers() { + return users.getTimeStampUsers(); } @@ -1045,20 +1325,24 @@ public class WorldDataHolder { * @param timeStampGroups the timeStampGroups to set */ protected void setTimeStampGroups(long timeStampGroups) { + groups.setTimeStampGroups(timeStampGroups); } - /** + + /** * @param timeStampUsers the timeStampUsers to set */ protected void setTimeStampUsers(long timeStampUsers) { + users.setTimeStampUsers(timeStampUsers); } - + public void setTimeStamps() { + if (getGroupsFile() != null) setTimeStampGroups(getGroupsFile().lastModified()); if (getUsersFile() != null) setTimeStampUsers(getUsersFile().lastModified()); - } - + } + } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java index e72118468..27a7d9a59 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java @@ -26,459 +26,484 @@ import org.bukkit.configuration.MemorySection; import org.bukkit.entity.Player; /** - * + * * @author gabrielcouto */ public class WorldsHolder { - /** - * Map with instances of loaded worlds. - */ - private Map<String, OverloadedWorldHolder> worldsData = new HashMap<String, OverloadedWorldHolder>(); - - /** - * Map of mirrors: <nonExistingWorldName, existingAndLoadedWorldName> - * The key is the mirror. - * The object is the mirrored. - * - * Mirror shows the same data of mirrored. - */ - private Map<String, String> mirrorsGroup = new HashMap<String, String>(); - private Map<String, String> mirrorsUser = new HashMap<String, String>(); - - //private OverloadedWorldHolder defaultWorld; - private String serverDefaultWorldName; - private GroupManager plugin; - private File worldsFolder; - - /** - * - * @param plugin - */ - public WorldsHolder(GroupManager plugin) { - this.plugin = plugin; - // Setup folders and check files exist for the primary world - verifyFirstRun(); - initialLoad(); - if (serverDefaultWorldName == null) { - throw new IllegalStateException("There is no default group! OMG!"); - } - } - - private void initialLoad() { - // load the initial world - initialWorldLoading(); - // Configure and load any mirrors and additional worlds as defined in config.yml - mirrorSetUp(); - // search the worlds folder for any manually created worlds (not listed in config.yml) - loadAllSearchedWorlds(); - } - - private void initialWorldLoading() { - //Load the default world - loadWorld(serverDefaultWorldName); - //defaultWorld = getUpdatedWorldData(serverDefaultWorldName); - } - - private void loadAllSearchedWorlds() { - - /* - * Read all known worlds from Bukkit - * Create the data files if they don't already exist, - * and they are not mirrored. - */ - for (World world: plugin.getServer().getWorlds()) - if ((!worldsData.containsKey(world.getName().toLowerCase())) - && ((!mirrorsGroup.containsKey(world.getName().toLowerCase())) || (!mirrorsUser.containsKey(world.getName().toLowerCase())))) - setupWorldFolder(world.getName()); - /* - * Loop over all folders within the worlds folder - * and attempt to load the world data - */ - for (File folder : worldsFolder.listFiles()) { - if (folder.isDirectory()) { - GroupManager.logger.info("World Found: " + folder.getName()); - - /* - * don't load any worlds which are already loaded - * or fully mirrored worlds that don't need data. - */ - if (!worldsData.containsKey(folder.getName().toLowerCase()) - && ((!mirrorsGroup.containsKey(folder.getName().toLowerCase())) - || (!mirrorsUser.containsKey(folder.getName().toLowerCase())))) { - loadWorld(folder.getName()); - } - - } - } - } - - @SuppressWarnings("rawtypes") - public void mirrorSetUp() { - mirrorsGroup.clear(); - mirrorsUser.clear(); - Map<String, Object> mirrorsMap = plugin.getGMConfig().getMirrorsMap(); - - HashSet<String> mirroredWorlds = new HashSet<String>(); - - if (mirrorsMap != null) { - for (String source : mirrorsMap.keySet()) { - // Make sure all non mirrored worlds have a set of data files. - setupWorldFolder(source); - // Load the world data - if (!worldsData.containsKey(source.toLowerCase())) - loadWorld(source); - - if (mirrorsMap.get(source) instanceof ArrayList) { - ArrayList mirrorList = (ArrayList) mirrorsMap.get(source); - - // These worlds fully mirror their parent - for (Object o : mirrorList) { - String world = o.toString().toLowerCase(); - if (world != serverDefaultWorldName) { - try { - mirrorsGroup.remove(world); - mirrorsUser.remove(world); - } catch (Exception e) { - } - mirrorsGroup.put(world, getWorldData(source).getName()); - mirrorsUser.put(world, getWorldData(source).getName()); - - // Track this world so we can create a datasource for it later - mirroredWorlds.add(o.toString()); - - } else - GroupManager.logger.log(Level.WARNING, "Mirroring error with " + o.toString() + ". Recursive loop detected!"); - } - } else if (mirrorsMap.get(source) instanceof MemorySection) { - MemorySection subSection = (MemorySection) mirrorsMap.get(source); - - for (String key : subSection.getKeys(true)) { - - if (key.toLowerCase() != serverDefaultWorldName) { - - if (subSection.get(key) instanceof ArrayList) { - ArrayList mirrorList = (ArrayList) subSection.get(key); - - // These worlds have defined mirroring - for (Object o : mirrorList) { - String type = o.toString().toLowerCase(); - try { - if (type.equals("groups")) - mirrorsGroup.remove(key.toLowerCase()); - - if (type.equals("users")) - mirrorsUser.remove(key.toLowerCase()); - - } catch (Exception e) { - } - if (type.equals("groups")) - mirrorsGroup.put(key.toLowerCase(), getWorldData(source).getName()); - - if (type.equals("users")) - mirrorsUser.put(key.toLowerCase(), getWorldData(source).getName()); - } - - // Track this world so we can create a datasource for it later - mirroredWorlds.add(key); - - } else - GroupManager.logger.log(Level.WARNING, "Mirroring error with " + key + ". Recursive loop detected!"); - - } else { - throw new IllegalStateException("Unknown mirroring format for " + key); - } - - } - } - } - - // Create a datasource for any worlds not already loaded - for (String world : mirroredWorlds){ - if (!worldsData.containsKey(world.toLowerCase())) { - setupWorldFolder(world); - loadWorld(world, true); - } - } - } - } - - /** - * - */ - public void reloadAll() { - // Load global groups - GroupManager.getGlobalGroups().load(); - - ArrayList<WorldDataHolder> alreadyDone = new ArrayList<WorldDataHolder>(); - for (WorldDataHolder w : worldsData.values()) { - if (alreadyDone.contains(w)) { - continue; - } - if (!mirrorsGroup.containsKey(w.getName().toLowerCase())) - w.reloadGroups(); - if (!mirrorsUser.containsKey(w.getName().toLowerCase())) - w.reloadUsers(); - - alreadyDone.add(w); - } - - } - - /** - * - * @param worldName - */ - public void reloadWorld(String worldName) { - if (!mirrorsGroup.containsKey(worldName.toLowerCase())) - getWorldData(worldName).reloadGroups(); - if (!mirrorsUser.containsKey(worldName.toLowerCase())) - getWorldData(worldName).reloadUsers(); - } - - /** - * Wrapper to retain backwards compatibility - * (call this function to auto overwrite files) - */ - public void saveChanges() { - saveChanges(true); - } + /** + * Map with instances of loaded worlds. + */ + private Map<String, OverloadedWorldHolder> worldsData = new HashMap<String, OverloadedWorldHolder>(); + + /** + * Map of mirrors: <nonExistingWorldName, existingAndLoadedWorldName> + * The key is the mirror. + * The object is the mirrored. + * + * Mirror shows the same data of mirrored. + */ + private Map<String, String> mirrorsGroup = new HashMap<String, String>(); + private Map<String, String> mirrorsUser = new HashMap<String, String>(); + + private String serverDefaultWorldName; + private GroupManager plugin; + private File worldsFolder; + + /** + * + * @param plugin + */ + public WorldsHolder(GroupManager plugin) { + + this.plugin = plugin; + resetWorldsHolder(); + } + + public void resetWorldsHolder() { + + worldsData = new HashMap<String, OverloadedWorldHolder>(); + mirrorsGroup = new HashMap<String, String>(); + mirrorsUser = new HashMap<String, String>(); + + // Setup folders and check files exist for the primary world + verifyFirstRun(); + initialLoad(); + if (serverDefaultWorldName == null) + throw new IllegalStateException("There is no default group! OMG!"); + } + + private void initialLoad() { + + // load the initial world + initialWorldLoading(); + // Configure and load any mirrors and additional worlds as defined in config.yml + mirrorSetUp(); + // search the worlds folder for any manually created worlds (not listed in config.yml) + loadAllSearchedWorlds(); + } + + private void initialWorldLoading() { + + //Load the default world + loadWorld(serverDefaultWorldName); + //defaultWorld = getUpdatedWorldData(serverDefaultWorldName); + } + + private void loadAllSearchedWorlds() { + + /* + * Read all known worlds from Bukkit + * Create the data files if they don't already exist, + * and they are not mirrored. + */ + for (World world : plugin.getServer().getWorlds()) + if ((!worldsData.containsKey(world.getName().toLowerCase())) && ((!mirrorsGroup.containsKey(world.getName().toLowerCase())) || (!mirrorsUser.containsKey(world.getName().toLowerCase())))) + setupWorldFolder(world.getName()); + /* + * Loop over all folders within the worlds folder + * and attempt to load the world data + */ + for (File folder : worldsFolder.listFiles()) { + if (folder.isDirectory()) { + GroupManager.logger.info("World Found: " + folder.getName()); + + /* + * don't load any worlds which are already loaded + * or fully mirrored worlds that don't need data. + */ + if (!worldsData.containsKey(folder.getName().toLowerCase()) && ((!mirrorsGroup.containsKey(folder.getName().toLowerCase())) || (!mirrorsUser.containsKey(folder.getName().toLowerCase())))) { + /* + * Call setupWorldFolder to check case sensitivity + * and convert to lower case, before we attempt to load this + * world. + */ + setupWorldFolder(folder.getName()); + loadWorld(folder.getName().toLowerCase()); + } + + } + } + } + + @SuppressWarnings("rawtypes") + public void mirrorSetUp() { + + mirrorsGroup.clear(); + mirrorsUser.clear(); + Map<String, Object> mirrorsMap = plugin.getGMConfig().getMirrorsMap(); + + HashSet<String> mirroredWorlds = new HashSet<String>(); + + if (mirrorsMap != null) { + for (String source : mirrorsMap.keySet()) { + // Make sure all non mirrored worlds have a set of data files. + setupWorldFolder(source); + // Load the world data + if (!worldsData.containsKey(source.toLowerCase())) + loadWorld(source); + + if (mirrorsMap.get(source) instanceof ArrayList) { + ArrayList mirrorList = (ArrayList) mirrorsMap.get(source); + + // These worlds fully mirror their parent + for (Object o : mirrorList) { + String world = o.toString().toLowerCase(); + if (world != serverDefaultWorldName) { + try { + mirrorsGroup.remove(world); + mirrorsUser.remove(world); + } catch (Exception e) { + } + mirrorsGroup.put(world, getWorldData(source).getName()); + mirrorsUser.put(world, getWorldData(source).getName()); + + // Track this world so we can create a datasource for it later + mirroredWorlds.add(o.toString()); + + } else + GroupManager.logger.log(Level.WARNING, "Mirroring error with " + o.toString() + ". Recursive loop detected!"); + } + } else if (mirrorsMap.get(source) instanceof MemorySection) { + MemorySection subSection = (MemorySection) mirrorsMap.get(source); + + for (String key : subSection.getKeys(true)) { + + if (key.toLowerCase() != serverDefaultWorldName) { + + if (subSection.get(key) instanceof ArrayList) { + ArrayList mirrorList = (ArrayList) subSection.get(key); + + // These worlds have defined mirroring + for (Object o : mirrorList) { + String type = o.toString().toLowerCase(); + try { + if (type.equals("groups")) + mirrorsGroup.remove(key.toLowerCase()); + + if (type.equals("users")) + mirrorsUser.remove(key.toLowerCase()); + + } catch (Exception e) { + } + if (type.equals("groups")) + mirrorsGroup.put(key.toLowerCase(), getWorldData(source).getName()); + + if (type.equals("users")) + mirrorsUser.put(key.toLowerCase(), getWorldData(source).getName()); + } + + // Track this world so we can create a datasource for it later + mirroredWorlds.add(key); + + } else + GroupManager.logger.log(Level.WARNING, "Mirroring error with " + key + ". Recursive loop detected!"); + + } else { + throw new IllegalStateException("Unknown mirroring format for " + key); + } + + } + } + } - /** + // Create a datasource for any worlds not already loaded + for (String world : mirroredWorlds) { + if (!worldsData.containsKey(world.toLowerCase())) { + setupWorldFolder(world); + loadWorld(world, true); + } + } + } + } + + /** * */ - public void saveChanges(boolean overwrite) { - ArrayList<WorldDataHolder> alreadyDone = new ArrayList<WorldDataHolder>(); - Tasks.removeOldFiles(plugin, plugin.getBackupFolder()); - - // Write Global Groups - if (GroupManager.getGlobalGroups().haveGroupsChanged()) { - GroupManager.getGlobalGroups().writeGroups(overwrite); - } else { - if (GroupManager.getGlobalGroups().getTimeStampGroups() < GroupManager.getGlobalGroups().getGlobalGroupsFile().lastModified()) { - System.out.print("Newer GlobalGroups file found (Loading changes)!"); - GroupManager.getGlobalGroups().load(); - } - } - - for (OverloadedWorldHolder w : worldsData.values()) { - if (alreadyDone.contains(w)) { - continue; - } - if (w == null) { - GroupManager.logger.severe("WHAT HAPPENED?"); - continue; - } - if (!mirrorsGroup.containsKey(w.getName().toLowerCase())) - if (w.haveGroupsChanged()) { - if (overwrite || (!overwrite && (w.getTimeStampGroups() >= w.getGroupsFile().lastModified()))) { - // Backup Groups file - backupFile(w,true); - - WorldDataHolder.writeGroups(w, w.getGroupsFile()); - //w.removeGroupsChangedFlag(); - } else { - // Newer file found. - GroupManager.logger.log(Level.WARNING, "Newer Groups file found for " + w.getName() + ", but we have local changes!"); - throw new IllegalStateException("Unable to save unless you issue a '/mansave force'"); - } - } else { - //Check for newer file as no local changes. - if (w.getTimeStampGroups() < w.getGroupsFile().lastModified()) { - System.out.print("Newer Groups file found (Loading changes)!"); - // Backup Groups file - backupFile(w,true); - w.reloadGroups(); - } - } - if (!mirrorsUser.containsKey(w.getName().toLowerCase())) - if (w.haveUsersChanged()) { - if (overwrite || (!overwrite && (w.getTimeStampUsers() >= w.getUsersFile().lastModified()))) { - // Backup Users file - backupFile(w,false); - - WorldDataHolder.writeUsers(w, w.getUsersFile()); - //w.removeUsersChangedFlag(); - } else { - // Newer file found. - GroupManager.logger.log(Level.WARNING, "Newer Users file found for " + w.getName() + ", but we have local changes!"); - throw new IllegalStateException("Unable to save unless you issue a '/mansave force'"); - } - } else { - //Check for newer file as no local changes. - if (w.getTimeStampUsers() < w.getUsersFile().lastModified()) { - System.out.print("Newer Users file found (Loading changes)!"); - // Backup Users file - backupFile(w,false); - w.reloadUsers(); - } - } - alreadyDone.add(w); - } - } - - /** - * Backup the Groups/Users file - * @param w - * @param groups - */ - private void backupFile(OverloadedWorldHolder w, Boolean groups) { - - File backupFile = new File(plugin.getBackupFolder(), "bkp_" + w.getName() + (groups ? "_g_" : "_u_") + Tasks.getDateString() + ".yml"); - try { - Tasks.copy((groups ? w.getGroupsFile() : w.getUsersFile()), backupFile); - } catch (IOException ex) { - GroupManager.logger.log(Level.SEVERE, null, ex); - } - } - - /** - * Returns the dataHolder for the given world. - * If the world is not on the worlds list, returns the default world - * holder. - * - * Mirrors return their parent world data. - * If no mirroring data it returns the default world. + public void reloadAll() { + + // Load global groups + GroupManager.getGlobalGroups().load(); + + ArrayList<WorldDataHolder> alreadyDone = new ArrayList<WorldDataHolder>(); + for (WorldDataHolder w : worldsData.values()) { + if (alreadyDone.contains(w)) { + continue; + } + if (!mirrorsGroup.containsKey(w.getName().toLowerCase())) + w.reloadGroups(); + if (!mirrorsUser.containsKey(w.getName().toLowerCase())) + w.reloadUsers(); + + alreadyDone.add(w); + } + + } + + /** + * + * @param worldName + */ + public void reloadWorld(String worldName) { + + if (!mirrorsGroup.containsKey(worldName.toLowerCase())) + getWorldData(worldName).reloadGroups(); + if (!mirrorsUser.containsKey(worldName.toLowerCase())) + getWorldData(worldName).reloadUsers(); + } + + /** + * Wrapper to retain backwards compatibility + * (call this function to auto overwrite files) + */ + public void saveChanges() { + + saveChanges(true); + } + + /** * - * @param worldName - * @return OverloadedWorldHolder - */ - public OverloadedWorldHolder getWorldData(String worldName) { - String worldNameLowered = worldName.toLowerCase(); - - // Find this worlds data - if (worldsData.containsKey(worldNameLowered)) { - - String usersMirror = mirrorsUser.get(worldNameLowered); - String groupsMirror = mirrorsGroup.get(worldNameLowered); - - if (usersMirror != null) { - - // If both are mirrored - if (groupsMirror != null) { - - // if the data sources are the same, return the parent - if (usersMirror == groupsMirror) - return getUpdatedWorldData(usersMirror.toLowerCase()); - - // Both data sources are mirrors, but they are from different parents - // so we return the actual data object. - return getUpdatedWorldData(worldNameLowered); - } - - // Groups isn't a mirror so return this this worlds data source - return getUpdatedWorldData(worldNameLowered); - } - - // users isn't mirrored so we need to return this worlds data source - return getUpdatedWorldData(worldNameLowered); - } - - // Oddly no data source was found for this world so return the default. - GroupManager.logger.finest("Requested world " + worldName + " not found or badly mirrored. Returning default world..."); - return getDefaultWorld(); - } - - /** - * Get the requested world data and update it's dataSource to be relevant for this world - * - * @param worldName - * @return updated world holder */ - private OverloadedWorldHolder getUpdatedWorldData(String worldName) { - - if (worldsData.containsKey(worldName.toLowerCase())) { - OverloadedWorldHolder data = worldsData.get(worldName.toLowerCase()); - data.updateDataSource(); - return data; - } - return null; - - } - - /** - * Do a matching of playerName, if its found only one player, do - * getWorldData(player) - * - * @param playerName - * @return null if matching returned no player, or more than one. - */ - public OverloadedWorldHolder getWorldDataByPlayerName(String playerName) { - List<Player> matchPlayer = plugin.getServer().matchPlayer(playerName); - if (matchPlayer.size() == 1) { - return getWorldData(matchPlayer.get(0)); - } - return null; - } - - /** - * Retrieves the field player.getWorld().getName() and do - * getWorld(worldName) - * - * @param player - * @return OverloadedWorldHolder - */ - public OverloadedWorldHolder getWorldData(Player player) { - return getWorldData(player.getWorld().getName()); - } - - /** - * It does getWorld(worldName).getPermissionsHandler() - * @param worldName - * @return AnjoPermissionsHandler - */ - public AnjoPermissionsHandler getWorldPermissions(String worldName) { - return getWorldData(worldName).getPermissionsHandler(); - } - - /** - * Returns the PermissionsHandler for this player data - * @param player - * @return AnjoPermissionsHandler - */ - public AnjoPermissionsHandler getWorldPermissions(Player player) { - return getWorldData(player).getPermissionsHandler(); - } - - /** - * Id does getWorldDataByPlayerName(playerName). - * If it doesnt return null, it will return result.getPermissionsHandler() - * @param playerName - * @return null if the player matching gone wrong. - */ - public AnjoPermissionsHandler getWorldPermissionsByPlayerName(String playerName) { - WorldDataHolder dh = getWorldDataByPlayerName(playerName); - if (dh != null) { - return dh.getPermissionsHandler(); - } - return null; - } - - private void verifyFirstRun() { - - Properties server = new Properties(); - try { - server.load(new FileInputStream(new File("server.properties"))); - serverDefaultWorldName = server.getProperty("level-name").toLowerCase(); - setupWorldFolder(serverDefaultWorldName); - } catch (IOException ex) { - GroupManager.logger.log(Level.SEVERE, null, ex); - } - - } - + public void saveChanges(boolean overwrite) { + + ArrayList<WorldDataHolder> alreadyDone = new ArrayList<WorldDataHolder>(); + Tasks.removeOldFiles(plugin, plugin.getBackupFolder()); + + // Write Global Groups + if (GroupManager.getGlobalGroups().haveGroupsChanged()) { + GroupManager.getGlobalGroups().writeGroups(overwrite); + } else { + if (GroupManager.getGlobalGroups().getTimeStampGroups() < GroupManager.getGlobalGroups().getGlobalGroupsFile().lastModified()) { + System.out.print("Newer GlobalGroups file found (Loading changes)!"); + GroupManager.getGlobalGroups().load(); + } + } + + for (OverloadedWorldHolder w : worldsData.values()) { + if (alreadyDone.contains(w)) { + continue; + } + if (w == null) { + GroupManager.logger.severe("WHAT HAPPENED?"); + continue; + } + if (!mirrorsGroup.containsKey(w.getName().toLowerCase())) + if (w.haveGroupsChanged()) { + if (overwrite || (!overwrite && (w.getTimeStampGroups() >= w.getGroupsFile().lastModified()))) { + // Backup Groups file + backupFile(w, true); + + WorldDataHolder.writeGroups(w, w.getGroupsFile()); + //w.removeGroupsChangedFlag(); + } else { + // Newer file found. + GroupManager.logger.log(Level.WARNING, "Newer Groups file found for " + w.getName() + ", but we have local changes!"); + throw new IllegalStateException("Unable to save unless you issue a '/mansave force'"); + } + } else { + //Check for newer file as no local changes. + if (w.getTimeStampGroups() < w.getGroupsFile().lastModified()) { + System.out.print("Newer Groups file found (Loading changes)!"); + // Backup Groups file + backupFile(w, true); + w.reloadGroups(); + } + } + if (!mirrorsUser.containsKey(w.getName().toLowerCase())) + if (w.haveUsersChanged()) { + if (overwrite || (!overwrite && (w.getTimeStampUsers() >= w.getUsersFile().lastModified()))) { + // Backup Users file + backupFile(w, false); + + WorldDataHolder.writeUsers(w, w.getUsersFile()); + //w.removeUsersChangedFlag(); + } else { + // Newer file found. + GroupManager.logger.log(Level.WARNING, "Newer Users file found for " + w.getName() + ", but we have local changes!"); + throw new IllegalStateException("Unable to save unless you issue a '/mansave force'"); + } + } else { + //Check for newer file as no local changes. + if (w.getTimeStampUsers() < w.getUsersFile().lastModified()) { + System.out.print("Newer Users file found (Loading changes)!"); + // Backup Users file + backupFile(w, false); + w.reloadUsers(); + } + } + alreadyDone.add(w); + } + } + + /** + * Backup the Groups/Users file + * + * @param w + * @param groups + */ + private void backupFile(OverloadedWorldHolder w, Boolean groups) { + + File backupFile = new File(plugin.getBackupFolder(), "bkp_" + w.getName() + (groups ? "_g_" : "_u_") + Tasks.getDateString() + ".yml"); + try { + Tasks.copy((groups ? w.getGroupsFile() : w.getUsersFile()), backupFile); + } catch (IOException ex) { + GroupManager.logger.log(Level.SEVERE, null, ex); + } + } + + /** + * Returns the dataHolder for the given world. + * If the world is not on the worlds list, returns the default world + * holder. + * + * Mirrors return their parent world data. + * If no mirroring data it returns the default world. + * + * @param worldName + * @return OverloadedWorldHolder + */ + public OverloadedWorldHolder getWorldData(String worldName) { + + String worldNameLowered = worldName.toLowerCase(); + + // Find this worlds data + if (worldsData.containsKey(worldNameLowered)) + return getUpdatedWorldData(worldNameLowered); + + // Oddly no data source was found for this world so return the default. + GroupManager.logger.finest("Requested world " + worldName + " not found or badly mirrored. Returning default world..."); + return getDefaultWorld(); + } + + /** + * Get the requested world data and update it's dataSource to be relevant + * for this world + * + * @param worldName + * @return updated world holder + */ + private OverloadedWorldHolder getUpdatedWorldData(String worldName) { + + String worldNameLowered = worldName.toLowerCase(); + + if (worldsData.containsKey(worldNameLowered)) { + OverloadedWorldHolder data = worldsData.get(worldNameLowered); + data.updateDataSource(); + return data; + } + return null; + + } + + /** + * Do a matching of playerName, if its found only one player, do + * getWorldData(player) + * + * @param playerName + * @return null if matching returned no player, or more than one. + */ + public OverloadedWorldHolder getWorldDataByPlayerName(String playerName) { + + List<Player> matchPlayer = plugin.getServer().matchPlayer(playerName); + if (matchPlayer.size() == 1) { + return getWorldData(matchPlayer.get(0)); + } + return null; + } + + /** + * Retrieves the field player.getWorld().getName() and do + * getWorld(worldName) + * + * @param player + * @return OverloadedWorldHolder + */ + public OverloadedWorldHolder getWorldData(Player player) { + + return getWorldData(player.getWorld().getName()); + } + + /** + * It does getWorld(worldName).getPermissionsHandler() + * + * @param worldName + * @return AnjoPermissionsHandler + */ + public AnjoPermissionsHandler getWorldPermissions(String worldName) { + + return getWorldData(worldName).getPermissionsHandler(); + } + + /** + * Returns the PermissionsHandler for this player data + * + * @param player + * @return AnjoPermissionsHandler + */ + public AnjoPermissionsHandler getWorldPermissions(Player player) { + + return getWorldData(player).getPermissionsHandler(); + } + + /** + * Id does getWorldDataByPlayerName(playerName). + * If it doesnt return null, it will return result.getPermissionsHandler() + * + * @param playerName + * @return null if the player matching gone wrong. + */ + public AnjoPermissionsHandler getWorldPermissionsByPlayerName(String playerName) { + + WorldDataHolder dh = getWorldDataByPlayerName(playerName); + if (dh != null) { + return dh.getPermissionsHandler(); + } + return null; + } + + private void verifyFirstRun() { + + Properties server = new Properties(); + try { + server.load(new FileInputStream(new File("server.properties"))); + serverDefaultWorldName = server.getProperty("level-name").toLowerCase(); + setupWorldFolder(serverDefaultWorldName); + } catch (IOException ex) { + GroupManager.logger.log(Level.SEVERE, null, ex); + } + + } + public void setupWorldFolder(String worldName) { + + String worldNameLowered = worldName.toLowerCase(); + worldsFolder = new File(plugin.getDataFolder(), "worlds"); if (!worldsFolder.exists()) { worldsFolder.mkdirs(); } - File defaultWorldFolder = new File(worldsFolder, worldName); - if ((!defaultWorldFolder.exists()) && ((!mirrorsGroup.containsKey(worldName.toLowerCase()))) || (!mirrorsUser.containsKey(worldName.toLowerCase()))) { - defaultWorldFolder.mkdirs(); + File defaultWorldFolder = new File(worldsFolder, worldNameLowered); + if ((!defaultWorldFolder.exists()) && ((!mirrorsGroup.containsKey(worldNameLowered))) || (!mirrorsUser.containsKey(worldNameLowered))) { + + /* + * check and convert all old case sensitive folders to lower case + */ + File casedWorldFolder = new File(worldsFolder, worldName); + if ((casedWorldFolder.exists()) && (casedWorldFolder.getName().toLowerCase().equals(worldNameLowered))) { + /* + * Rename the old folder to the new lower cased format + */ + casedWorldFolder.renameTo(new File(worldsFolder, worldNameLowered)); + } else { + /* + * Else we just create the folder + */ + defaultWorldFolder.mkdirs(); + } } if (defaultWorldFolder.exists()) { - if (!mirrorsGroup.containsKey(worldName.toLowerCase())) { + if (!mirrorsGroup.containsKey(worldNameLowered)) { File groupsFile = new File(defaultWorldFolder, "groups.yml"); if (!groupsFile.exists() || groupsFile.length() == 0) { @@ -491,7 +516,7 @@ public class WorldsHolder { } } - if (!mirrorsUser.containsKey(worldName.toLowerCase())) { + if (!mirrorsUser.containsKey(worldNameLowered)) { File usersFile = new File(defaultWorldFolder, "users.yml"); if (!usersFile.exists() || usersFile.length() == 0) { @@ -507,176 +532,188 @@ public class WorldsHolder { } } - /** - * Copies the specified world data to another world - * @param fromWorld - * @param toWorld - * @return true if successfully copied. - */ - public boolean cloneWorld(String fromWorld, String toWorld) { - File fromWorldFolder = new File(worldsFolder, fromWorld); - File toWorldFolder = new File(worldsFolder, toWorld); - if (toWorldFolder.exists() || !fromWorldFolder.exists()) { - return false; - } - File fromWorldGroups = new File(fromWorldFolder, "groups.yml"); - File fromWorldUsers = new File(fromWorldFolder, "users.yml"); - if (!fromWorldGroups.exists() || !fromWorldUsers.exists()) { - return false; - } - File toWorldGroups = new File(toWorldFolder, "groups.yml"); - File toWorldUsers = new File(toWorldFolder, "users.yml"); - toWorldFolder.mkdirs(); - try { - Tasks.copy(fromWorldGroups, toWorldGroups); - Tasks.copy(fromWorldUsers, toWorldUsers); - } catch (IOException ex) { - Logger.getLogger(WorldsHolder.class.getName()).log(Level.SEVERE, null, ex); - return false; - } - return true; - } - - /** - * Wrapper for LoadWorld(String,Boolean) for backwards compatibility - * - * Load a world from file. - * If it already been loaded, summon reload method from dataHolder. - * @param worldName - */ - public void loadWorld(String worldName) { - loadWorld(worldName, false); - } - - /** - * Load a world from file. - * If it already been loaded, summon reload method from dataHolder. - * @param worldName - */ - public void loadWorld(String worldName, Boolean isMirror) { - if (worldsData.containsKey(worldName.toLowerCase())) { - worldsData.get(worldName.toLowerCase()).reload(); - return; - } - GroupManager.logger.finest("Trying to load world " + worldName + "..."); - File thisWorldFolder = new File(worldsFolder, worldName); - if ((isMirror) || (thisWorldFolder.exists() && thisWorldFolder.isDirectory())) { - - // Setup file handles, if not mirrored - File groupsFile = (mirrorsGroup.containsKey(worldName.toLowerCase()))? null : new File(thisWorldFolder, "groups.yml"); - File usersFile = (mirrorsUser.containsKey(worldName.toLowerCase()))? null : new File(thisWorldFolder, "users.yml"); - - if ((groupsFile != null) && (!groupsFile.exists())) { - throw new IllegalArgumentException("Groups file for world '" + worldName + "' doesnt exist: " + groupsFile.getPath()); - } - if ((usersFile != null) && (!usersFile.exists())) { - throw new IllegalArgumentException("Users file for world '" + worldName + "' doesnt exist: " + usersFile.getPath()); - } - - WorldDataHolder tempHolder = new WorldDataHolder(worldName); - - // Map the group object for any mirror - if (mirrorsGroup.containsKey(worldName.toLowerCase())) - tempHolder.setGroupsObject(this.getWorldData(mirrorsGroup.get(worldName.toLowerCase())).getGroupsObject()); - else - tempHolder.loadGroups(groupsFile); - - // Map the user object for any mirror - if (mirrorsUser.containsKey(worldName.toLowerCase())) - tempHolder.setUsersObject(this.getWorldData(mirrorsUser.get(worldName.toLowerCase())).getUsersObject()); - else - tempHolder.loadUsers(usersFile); - - OverloadedWorldHolder thisWorldData = new OverloadedWorldHolder(tempHolder); - - // null the object so we don't keep file handles open where we shouldn't - tempHolder = null; - - // Set the file TimeStamps as it will be default from the initial load. - thisWorldData.setTimeStamps(); - - if (thisWorldData != null) { - GroupManager.logger.finest("Successful load of world " + worldName + "..."); - worldsData.put(worldName.toLowerCase(), thisWorldData); - return; - } - - //GroupManager.logger.severe("Failed to load world " + worldName + "..."); - } - } - - /** - * Tells if the such world has been mapped. - * - * It will return true if world is a mirror. - * - * @param worldName - * @return true if world is loaded or mirrored. false if not listed - */ - public boolean isInList(String worldName) { - if (worldsData.containsKey(worldName.toLowerCase()) || mirrorsGroup.containsKey(worldName.toLowerCase()) || mirrorsUser.containsKey(worldName.toLowerCase())) { - return true; - } - return false; - } - - /** - * Verify if world has it's own file permissions. - * - * @param worldName - * @return true if it has its own holder. false if not. - */ - public boolean hasOwnData(String worldName) { - if (worldsData.containsKey(worldName.toLowerCase()) && (!mirrorsGroup.containsKey(worldName.toLowerCase()) || !mirrorsUser.containsKey(worldName.toLowerCase()))) { - return true; - } - return false; - } - - /** - * @return the defaultWorld - */ - public OverloadedWorldHolder getDefaultWorld() { - return getUpdatedWorldData(serverDefaultWorldName); - } - - /** - * Returns all physically loaded worlds which have at least - * one of their own data sets for users or groups. - * - * @return ArrayList<OverloadedWorldHolder> of all loaded worlds - */ - public ArrayList<OverloadedWorldHolder> allWorldsDataList() { - ArrayList<OverloadedWorldHolder> list = new ArrayList<OverloadedWorldHolder>(); - for (OverloadedWorldHolder data : worldsData.values()) { - if ((!list.contains(data)) && (!mirrorsGroup.containsKey(data.getName().toLowerCase()) || !mirrorsUser.containsKey(data.getName().toLowerCase()))) { - - String worldNameLowered = data.getName().toLowerCase(); - String usersMirror = mirrorsUser.get(worldNameLowered); - String groupsMirror = mirrorsGroup.get(worldNameLowered); - - // is users mirrored? - if (usersMirror != null) { - - // If both are mirrored - if (groupsMirror != null) { - - // if the data sources are the same, return the parent - if (usersMirror == groupsMirror) { - if (!list.contains(usersMirror.toLowerCase())) - list.add(worldsData.get(usersMirror.toLowerCase())); - continue; - } - // Both data sources are mirrors, but they are from different parents - // so fall through to add the actual data object. - } - // Groups isn't a mirror so fall through to add this this worlds data source - } - - // users isn't mirrored so we need to add this worlds data source - list.add(data); - } - } - return list; - } + /** + * Copies the specified world data to another world + * + * @param fromWorld + * @param toWorld + * @return true if successfully copied. + */ + public boolean cloneWorld(String fromWorld, String toWorld) { + + File fromWorldFolder = new File(worldsFolder, fromWorld.toLowerCase()); + File toWorldFolder = new File(worldsFolder, toWorld.toLowerCase()); + if (toWorldFolder.exists() || !fromWorldFolder.exists()) { + return false; + } + File fromWorldGroups = new File(fromWorldFolder, "groups.yml"); + File fromWorldUsers = new File(fromWorldFolder, "users.yml"); + if (!fromWorldGroups.exists() || !fromWorldUsers.exists()) { + return false; + } + File toWorldGroups = new File(toWorldFolder, "groups.yml"); + File toWorldUsers = new File(toWorldFolder, "users.yml"); + toWorldFolder.mkdirs(); + try { + Tasks.copy(fromWorldGroups, toWorldGroups); + Tasks.copy(fromWorldUsers, toWorldUsers); + } catch (IOException ex) { + Logger.getLogger(WorldsHolder.class.getName()).log(Level.SEVERE, null, ex); + return false; + } + return true; + } + + /** + * Wrapper for LoadWorld(String,Boolean) for backwards compatibility + * + * Load a world from file. + * If it already been loaded, summon reload method from dataHolder. + * + * @param worldName + */ + public void loadWorld(String worldName) { + + loadWorld(worldName, false); + } + + /** + * Load a world from file. + * If it already been loaded, summon reload method from dataHolder. + * + * @param worldName + */ + public void loadWorld(String worldName, Boolean isMirror) { + + String worldNameLowered = worldName.toLowerCase(); + + if (worldsData.containsKey(worldNameLowered)) { + worldsData.get(worldNameLowered).reload(); + return; + } + GroupManager.logger.finest("Trying to load world " + worldName + "..."); + File thisWorldFolder = new File(worldsFolder, worldNameLowered); + if ((isMirror) || (thisWorldFolder.exists() && thisWorldFolder.isDirectory())) { + + // Setup file handles, if not mirrored + File groupsFile = (mirrorsGroup.containsKey(worldNameLowered)) ? null : new File(thisWorldFolder, "groups.yml"); + File usersFile = (mirrorsUser.containsKey(worldNameLowered)) ? null : new File(thisWorldFolder, "users.yml"); + + if ((groupsFile != null) && (!groupsFile.exists())) { + throw new IllegalArgumentException("Groups file for world '" + worldName + "' doesnt exist: " + groupsFile.getPath()); + } + if ((usersFile != null) && (!usersFile.exists())) { + throw new IllegalArgumentException("Users file for world '" + worldName + "' doesnt exist: " + usersFile.getPath()); + } + + WorldDataHolder tempHolder = new WorldDataHolder(worldName); + + // Map the group object for any mirror + if (mirrorsGroup.containsKey(worldNameLowered)) + tempHolder.setGroupsObject(this.getWorldData(mirrorsGroup.get(worldNameLowered)).getGroupsObject()); + else + tempHolder.loadGroups(groupsFile); + + // Map the user object for any mirror + if (mirrorsUser.containsKey(worldNameLowered)) + tempHolder.setUsersObject(this.getWorldData(mirrorsUser.get(worldNameLowered)).getUsersObject()); + else + tempHolder.loadUsers(usersFile); + + OverloadedWorldHolder thisWorldData = new OverloadedWorldHolder(tempHolder); + + // null the object so we don't keep file handles open where we shouldn't + tempHolder = null; + + // Set the file TimeStamps as it will be default from the initial load. + thisWorldData.setTimeStamps(); + + if (thisWorldData != null) { + GroupManager.logger.finest("Successful load of world " + worldName + "..."); + worldsData.put(worldNameLowered, thisWorldData); + return; + } + + //GroupManager.logger.severe("Failed to load world " + worldName + "..."); + } + } + + /** + * Tells if the such world has been mapped. + * + * It will return true if world is a mirror. + * + * @param worldName + * @return true if world is loaded or mirrored. false if not listed + */ + public boolean isInList(String worldName) { + + if (worldsData.containsKey(worldName.toLowerCase()) || mirrorsGroup.containsKey(worldName.toLowerCase()) || mirrorsUser.containsKey(worldName.toLowerCase())) { + return true; + } + return false; + } + + /** + * Verify if world has it's own file permissions. + * + * @param worldName + * @return true if it has its own holder. false if not. + */ + public boolean hasOwnData(String worldName) { + + if (worldsData.containsKey(worldName.toLowerCase()) && (!mirrorsGroup.containsKey(worldName.toLowerCase()) || !mirrorsUser.containsKey(worldName.toLowerCase()))) { + return true; + } + return false; + } + + /** + * @return the defaultWorld + */ + public OverloadedWorldHolder getDefaultWorld() { + + return getUpdatedWorldData(serverDefaultWorldName); + } + + /** + * Returns all physically loaded worlds which have at least + * one of their own data sets for users or groups. + * + * @return ArrayList<OverloadedWorldHolder> of all loaded worlds + */ + public ArrayList<OverloadedWorldHolder> allWorldsDataList() { + + ArrayList<OverloadedWorldHolder> list = new ArrayList<OverloadedWorldHolder>(); + for (OverloadedWorldHolder data : worldsData.values()) { + if ((!list.contains(data)) && (!mirrorsGroup.containsKey(data.getName().toLowerCase()) || !mirrorsUser.containsKey(data.getName().toLowerCase()))) { + + String worldNameLowered = data.getName().toLowerCase(); + String usersMirror = mirrorsUser.get(worldNameLowered); + String groupsMirror = mirrorsGroup.get(worldNameLowered); + + // is users mirrored? + if (usersMirror != null) { + + // If both are mirrored + if (groupsMirror != null) { + + // if the data sources are the same, return the parent + if (usersMirror == groupsMirror) { + if (!list.contains(usersMirror.toLowerCase())) + list.add(worldsData.get(usersMirror.toLowerCase())); + continue; + } + // Both data sources are mirrors, but they are from different parents + // so fall through to add the actual data object. + } + // Groups isn't a mirror so fall through to add this this worlds data source + } + + // users isn't mirrored so we need to add this worlds data source + list.add(data); + } + } + return list; + } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java index fc9b8433b..af3fb6135 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java @@ -6,79 +6,82 @@ import org.bukkit.Bukkit; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
-
/**
* @author ElgarL
- *
+ *
*/
public class GMGroupEvent extends Event {
- /**
+ /**
*
*/
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
- //////////////////////////////
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+
+ return handlers;
+ }
+
+ //////////////////////////////
protected Group group;
-
+
protected String groupName;
-
- protected Action action;
-
- public GMGroupEvent(Group group, Action action) {
- super();
-
- this.group = group;
- this.action = action;
- this.groupName = group.getName();
- }
-
- public GMGroupEvent(String groupName, Action action) {
- super();
-
- this.groupName = groupName;
- this.action = action;
- }
-
- public Action getAction(){
- return this.action;
- }
-
- public Group getGroup() {
- return group;
- }
-
- public String getGroupName() {
- return groupName;
- }
-
- public enum Action {
- GROUP_PERMISSIONS_CHANGED,
- GROUP_INHERITANCE_CHANGED,
- GROUP_INFO_CHANGED,
- GROUP_ADDED,
- GROUP_REMOVED,
- }
-
- public void schedule(final GMGroupEvent event) {
+
+ protected Action action;
+
+ public GMGroupEvent(Group group, Action action) {
+
+ super();
+
+ this.group = group;
+ this.action = action;
+ this.groupName = group.getName();
+ }
+
+ public GMGroupEvent(String groupName, Action action) {
+
+ super();
+
+ this.groupName = groupName;
+ this.action = action;
+ }
+
+ public Action getAction() {
+
+ return this.action;
+ }
+
+ public Group getGroup() {
+
+ return group;
+ }
+
+ public String getGroupName() {
+
+ return groupName;
+ }
+
+ public enum Action {
+ GROUP_PERMISSIONS_CHANGED, GROUP_INHERITANCE_CHANGED, GROUP_INFO_CHANGED, GROUP_ADDED, GROUP_REMOVED,
+ }
+
+ public void schedule(final GMGroupEvent event) {
if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() {
@Override
public void run() {
+
Bukkit.getServer().getPluginManager().callEvent(event);
}
}, 1) == -1)
GroupManager.logger.warning("Could not schedule GM Event.");
- }
+ }
}
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java index 210960876..d11581356 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java @@ -5,57 +5,58 @@ import org.bukkit.Bukkit; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
-
/**
* @author ElgarL
- *
+ *
*/
public class GMSystemEvent extends Event {
- /**
+ /**
*
*/
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- //////////////////////////////
-
+
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+
+ return handlers;
+ }
+
+ //////////////////////////////
+
protected Action action;
-
- public GMSystemEvent(Action action) {
- super();
-
- this.action = action;
- }
-
- public Action getAction(){
- return this.action;
- }
-
- public enum Action {
- RELOADED,
- SAVED,
- DEFAULT_GROUP_CHANGED,
- VALIDATE_TOGGLE,
- }
-
- public void schedule(final GMSystemEvent event) {
+
+ public GMSystemEvent(Action action) {
+
+ super();
+
+ this.action = action;
+ }
+
+ public Action getAction() {
+
+ return this.action;
+ }
+
+ public enum Action {
+ RELOADED, SAVED, DEFAULT_GROUP_CHANGED, VALIDATE_TOGGLE,
+ }
+
+ public void schedule(final GMSystemEvent event) {
if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() {
@Override
public void run() {
+
Bukkit.getServer().getPluginManager().callEvent(event);
}
}, 1) == -1)
GroupManager.logger.warning("Could not schedule GM Event.");
- }
+ }
}
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java index 206de8c86..361e7d4cc 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java @@ -6,81 +6,82 @@ import org.bukkit.Bukkit; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
-
/**
* @author ElgarL
- *
+ *
*/
public class GMUserEvent extends Event {
- /**
+ /**
*
*/
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
- //////////////////////////////
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+
+ return handlers;
+ }
+
+ //////////////////////////////
protected User user;
-
+
protected String userName;
-
- protected Action action;
-
- public GMUserEvent(User user, Action action) {
- super();
-
- this.user = user;
- this.action = action;
- this.userName = user.getName();
- }
-
- public GMUserEvent(String userName, Action action) {
- super();
-
- this.userName = userName;
- this.action = action;
- }
-
- public Action getAction(){
- return this.action;
- }
-
- public User getUser() {
- return user;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public enum Action {
- USER_PERMISSIONS_CHANGED,
- USER_INHERITANCE_CHANGED,
- USER_INFO_CHANGED,
- USER_GROUP_CHANGED,
- USER_SUBGROUP_CHANGED,
- USER_ADDED,
- USER_REMOVED,
- }
-
- public void schedule(final GMUserEvent event) {
+
+ protected Action action;
+
+ public GMUserEvent(User user, Action action) {
+
+ super();
+
+ this.user = user;
+ this.action = action;
+ this.userName = user.getName();
+ }
+
+ public GMUserEvent(String userName, Action action) {
+
+ super();
+
+ this.userName = userName;
+ this.action = action;
+ }
+
+ public Action getAction() {
+
+ return this.action;
+ }
+
+ public User getUser() {
+
+ return user;
+ }
+
+ public String getUserName() {
+
+ return userName;
+ }
+
+ public enum Action {
+ USER_PERMISSIONS_CHANGED, USER_INHERITANCE_CHANGED, USER_INFO_CHANGED, USER_GROUP_CHANGED, USER_SUBGROUP_CHANGED, USER_ADDED, USER_REMOVED,
+ }
+
+ public void schedule(final GMUserEvent event) {
if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() {
@Override
public void run() {
+
Bukkit.getServer().getPluginManager().callEvent(event);
}
}, 1) == -1)
GroupManager.logger.warning("Could not schedule GM Event.");
- }
+ }
}
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java index fd1a9d7ff..f7a7109ab 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java @@ -6,31 +6,33 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener;
import org.bukkit.event.world.WorldInitEvent;
-
/**
* @author ElgarL
*
- * Handle new world creation from other plugins
- *
+ * Handle new world creation from other plugins
+ *
*/
public class GMWorldListener implements Listener {
-
+
private final GroupManager plugin;
public GMWorldListener(GroupManager instance) {
+
plugin = instance;
registerEvents();
}
-
+
private void registerEvents() {
- plugin.getServer().getPluginManager().registerEvents(this, plugin);
- }
-
+
+ plugin.getServer().getPluginManager().registerEvents(this, plugin);
+ }
+
@EventHandler(priority = EventPriority.LOWEST)
public void onWorldInit(WorldInitEvent event) {
- String worldName = event.getWorld().getName();
-
- if (GroupManager.isLoaded() && !plugin.getWorldsHolder().isInList(worldName)) {
+
+ String worldName = event.getWorld().getName();
+
+ if (GroupManager.isLoaded() && !plugin.getWorldsHolder().isInList(worldName)) {
GroupManager.logger.info("New world detected...");
GroupManager.logger.info("Creating data for: " + worldName);
plugin.getWorldsHolder().setupWorldFolder(worldName);
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java index 3a4d8d266..5fc555cc4 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java @@ -3,40 +3,51 @@ package org.anjocaido.groupmanager.events; import org.anjocaido.groupmanager.data.Group;
import org.anjocaido.groupmanager.data.User;
-
/**
* @author ElgarL
*
- * Handles all Event generation.
- *
+ * Handles all Event generation.
+ *
*/
public class GroupManagerEventHandler {
-
+
protected static void callEvent(GMGroupEvent event) {
+
event.schedule(event);
}
+
protected static void callEvent(GMUserEvent event) {
+
event.schedule(event);
}
+
protected static void callEvent(GMSystemEvent event) {
+
event.schedule(event);
}
public static void callEvent(Group group, GMGroupEvent.Action action) {
+
callEvent(new GMGroupEvent(group, action));
}
+
public static void callEvent(String groupName, GMGroupEvent.Action action) {
+
callEvent(new GMGroupEvent(groupName, action));
}
-
+
public static void callEvent(User user, GMUserEvent.Action action) {
+
callEvent(new GMUserEvent(user, action));
}
+
public static void callEvent(String userName, GMUserEvent.Action action) {
+
callEvent(new GMUserEvent(userName, action));
}
-
+
public static void callEvent(GMSystemEvent.Action action) {
+
callEvent(new GMSystemEvent(action));
}
}
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index bd2829f38..efad11df4 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -16,10 +16,7 @@ import org.anjocaido.groupmanager.data.Group; import org.anjocaido.groupmanager.dataholder.WorldDataHolder; import org.anjocaido.groupmanager.data.User; import org.anjocaido.groupmanager.utils.PermissionCheckResult; -import org.anjocaido.groupmanager.utils.PermissionCheckResult.Type; -import org.bukkit.Bukkit; import org.bukkit.entity.Player; -import org.bukkit.permissions.Permission; /** * Everything here maintains the model created by Nijikokun @@ -29,7 +26,7 @@ import org.bukkit.permissions.Permission; * * It holds permissions only for one single world. * - * @author gabrielcouto + * @author gabrielcouto, ElgarL */ public class AnjoPermissionsHandler extends PermissionsReaderInterface { @@ -41,6 +38,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @param holder */ public AnjoPermissionsHandler(WorldDataHolder holder) { + ph = holder; } @@ -53,6 +51,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public boolean has(Player player, String permission) { + return permission(player, permission); } @@ -65,6 +64,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public boolean permission(Player player, String permission) { + return checkUserPermission(ph.getUser(player.getName()).updatePlayer(player), permission); } @@ -76,6 +76,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return true if the player has the permission */ public boolean permission(String playerName, String permission) { + return checkUserPermission(ph.getUser(playerName), permission); } @@ -87,6 +88,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public String getGroup(String userName) { + return ph.getUser(userName).getGroup().getName(); } @@ -99,10 +101,11 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public List<String> getAllPlayersPermissions(String userName) { + List<String> perms = new ArrayList<String>(); - + perms.addAll(getAllPlayersPermissions(userName, true)); - + return perms; } @@ -120,33 +123,32 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { // Add the players own permissions. playerPermArray.addAll(populatePerms(ph.getUser(userName).getPermissionList(), includeChildren)); - + ArrayList<String> alreadyProcessed = new ArrayList<String>(); - + // fetch all group permissions for (String group : getGroups(userName)) { // Don't process a group more than once. if (!alreadyProcessed.contains(group)) { alreadyProcessed.add(group); - + Set<String> groupPermArray = new HashSet<String>(); - + if (group.startsWith("g:") && GroupManager.getGlobalGroups().hasGroup(group)) { // GlobalGroups groupPermArray = populatePerms(GroupManager.getGlobalGroups().getGroupsPermissions(group), includeChildren); - + } else { // World Groups groupPermArray = populatePerms(ph.getGroup(group).getPermissionList(), includeChildren); } - + // Add all group permissions, unless negated by earlier permissions. for (String perm : groupPermArray) { boolean negated = (perm.startsWith("-")); // Perm doesn't already exists and there is no negation for it // or It's a negated perm where a normal perm doesn't exists (don't allow inheritance to negate higher perms) - if ((!negated && !playerPermArray.contains(perm) && !playerPermArray.contains("-" + perm)) - || (negated && !playerPermArray.contains(perm.substring(1)))) + if ((!negated && !playerPermArray.contains(perm) && !playerPermArray.contains("-" + perm)) || (negated && !playerPermArray.contains(perm.substring(1)) && !playerPermArray.contains("-" + perm))) playerPermArray.add(perm); } } @@ -156,69 +158,69 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { return playerPermArray; } - - private Set<String> populatePerms (List<String> perms, boolean includeChildren) { - + + private Set<String> populatePerms(List<String> permsList, boolean includeChildren) { + + // Create a new array so it's modifiable. + List<String> perms = new ArrayList<String>(permsList); Set<String> permArray = new HashSet<String>(); Boolean allPerms = false; - + // Allow * node to populate ALL permissions to Bukkit. if (perms.contains("*")) { permArray.addAll(GroupManager.BukkitPermissions.getAllRegisteredPermissions(includeChildren)); allPerms = true; + perms.remove("*"); } - + for (String perm : perms) { - if (!perm.equalsIgnoreCase("*")) { - + /** + * all permission sets are passed here pre-sorted, alphabetically. + * This means negated nodes will be processed before all permissions + * other than *. + */ + boolean negated = perm.startsWith("-"); + + if (!permArray.contains(perm)) { + permArray.add(perm); + + if ((negated) && (permArray.contains(perm.substring(1)))) + permArray.remove(perm.substring(1)); + /** - * all permission sets are passed here pre-sorted, alphabetically. - * This means negated nodes will be processed before all permissions - * other than *. + * Process child nodes if required, + * or this is a negated node AND we used * to include all + * permissions, + * in which case we need to remove all children of that node. */ - boolean negated = false; - if (perm.startsWith("-")) - negated = true; - - if (!permArray.contains(perm)) { - permArray.add(perm); - - if ((negated) && (permArray.contains(perm.substring(1)))) - permArray.remove(perm.substring(1)); - - /** - * Process child nodes if required, - * or this is a negated node AND we used * to include all permissions, - * in which case we need to remove all children of that node. - */ - if ((includeChildren) || (negated && allPerms)) { - - Map<String, Boolean> children = GroupManager.BukkitPermissions.getAllChildren((negated ? perm.substring(1) : perm), new HashSet<String>()); - - if (children != null) { - if (negated || (negated && allPerms)) { - + if ((includeChildren) || (negated && allPerms)) { + + Map<String, Boolean> children = GroupManager.BukkitPermissions.getAllChildren((negated ? perm.substring(1) : perm), new HashSet<String>()); + + if (children != null) { + if (negated) + if (allPerms) { + // Remove children of negated nodes for (String child : children.keySet()) if (children.get(child)) if (permArray.contains(child)) permArray.remove(child); - - } else if (!negated){ - + + } else { + // Add child nodes for (String child : children.keySet()) if (children.get(child)) if ((!permArray.contains(child)) && (!permArray.contains("-" + child))) permArray.add(child); } - } } } } } - + return permArray; } @@ -239,6 +241,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public boolean inGroup(String name, String group) { + if (hasGroupInInheritance(ph.getUser(name).getGroup(), group)) { return true; } @@ -329,6 +332,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public String getGroupPrefix(String groupName) { + Group g = ph.getGroup(groupName); if (g == null) { return ""; @@ -344,6 +348,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public String getGroupSuffix(String groupName) { + Group g = ph.getGroup(groupName); if (g == null) { return ""; @@ -360,6 +365,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public boolean canGroupBuild(String groupName) { + Group g = ph.getGroup(groupName); if (g == null) { return false; @@ -377,6 +383,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public String getGroupPermissionString(String groupName, String variable) { + Group start = ph.getGroup(groupName); if (start == null) { return null; @@ -398,6 +405,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public int getGroupPermissionInteger(String groupName, String variable) { + Group start = ph.getGroup(groupName); if (start == null) { return -1; @@ -419,6 +427,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public boolean getGroupPermissionBoolean(String group, String variable) { + Group start = ph.getGroup(group); if (start == null) { return false; @@ -440,6 +449,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public double getGroupPermissionDouble(String group, String variable) { + Group start = ph.getGroup(group); if (start == null) { return -1; @@ -460,6 +470,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public String getUserPermissionString(String user, String variable) { + User auser = ph.getUser(user); if (auser == null) { return ""; @@ -476,6 +487,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public int getUserPermissionInteger(String user, String variable) { + User auser = ph.getUser(user); if (auser == null) { return -1; @@ -492,6 +504,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public boolean getUserPermissionBoolean(String user, String variable) { + User auser = ph.getUser(user); if (auser == null) { return false; @@ -508,6 +521,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public double getUserPermissionDouble(String user, String variable) { + User auser = ph.getUser(user); if (auser == null) { return -1; @@ -526,6 +540,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public String getPermissionString(String user, String variable) { + User auser = ph.getUser(user); if (auser == null) { return ""; @@ -565,6 +580,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public int getPermissionInteger(String user, String variable) { + User auser = ph.getUser(user); if (auser == null) { return -1; @@ -604,6 +620,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public boolean getPermissionBoolean(String user, String variable) { + User auser = ph.getUser(user); if (auser == null) { return false; @@ -643,6 +660,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public double getPermissionDouble(String user, String variable) { + User auser = ph.getUser(user); if (auser == null) { return -1.0D; @@ -679,6 +697,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return PermissionCheckResult */ public PermissionCheckResult checkUserOnlyPermission(User user, String permission) { + user.sortPermissions(); PermissionCheckResult result = new PermissionCheckResult(); result.askedPermission = permission; @@ -702,6 +721,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return the node if permission is found. if not found, return null */ public PermissionCheckResult checkGroupOnlyPermission(Group group, String permission) { + group.sortPermissions(); PermissionCheckResult result = new PermissionCheckResult(); result.owner = group; @@ -724,6 +744,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return true if permission was found. false if not, or was negated. */ public boolean checkUserPermission(User user, String permission) { + PermissionCheckResult result = checkFullGMPermission(user, permission, true); if (result.resultType == PermissionCheckResult.Type.EXCEPTION || result.resultType == PermissionCheckResult.Type.FOUND) { return true; @@ -755,6 +776,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return PermissionCheckResult */ public PermissionCheckResult checkFullGMPermission(User user, String targetPermission, Boolean checkBukkit) { + PermissionCheckResult result = new PermissionCheckResult(); result.accessLevel = targetPermission; result.resultType = PermissionCheckResult.Type.NOTFOUND; @@ -767,9 +789,9 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { // Check Bukkit perms to support plugins which add perms via code // (Heroes). final Player player = user.getBukkitPlayer(); - final Permission bukkitPerm = Bukkit.getPluginManager().getPermission(targetPermission); - if (player != null && bukkitPerm != null) { - result.resultType = player.hasPermission(bukkitPerm) ? PermissionCheckResult.Type.FOUND : PermissionCheckResult.Type.NEGATION; + //final Permission bukkitPerm = Bukkit.getPluginManager().getPermission(targetPermission); + if ((player != null) && player.hasPermission(targetPermission)) { + result.resultType = PermissionCheckResult.Type.FOUND; result.owner = user; return result; } @@ -802,36 +824,17 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } /** - * Verifies if a given group has a variable. Including it's inheritance. - * - * it redirects to the other method now. This one was deprecated, and will - * be gone in a future release. - * - * @param start - * @param variable - * @param alreadyChecked - * @return returns the closest inherited group with the variable. - * @deprecated use now nextGroupWithVariable(Group start, String - * targetVariable) - */ - @Deprecated - public Group nextGroupWithVariable(Group start, String variable, List<Group> alreadyChecked) { - return nextGroupWithVariable(start, variable); - } - - /** * Returns the next group, including inheritance, which contains that * variable name. * * It does Breadth-first search * - * @param start - * the starting group to look for - * @param targetVariable - * the variable name + * @param start the starting group to look for + * @param targetVariable the variable name * @return The group if found. Null if not. */ public Group nextGroupWithVariable(Group start, String targetVariable) { + if (start == null || targetVariable == null) { return null; } @@ -855,39 +858,18 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { return null; } - /** - * Check if given group inherits another group. - * - * redirected to the other method. this is deprecated now. and will be gone - * in the future releases. - * - * @param start - * The group to start the search. - * @param askedGroup - * Name of the group you're looking for - * @param alreadyChecked - * groups to ignore(pass null on it, please) - * @return true if it inherits the group. - * @deprecated prefer using hasGroupInInheritance(Group start, String - * askedGroup) - */ - @Deprecated - public boolean searchGroupInInheritance(Group start, String askedGroup, List<Group> alreadyChecked) { - return hasGroupInInheritance(start, askedGroup); - } /** * Check if given group inherits another group. * * It does Breadth-first search * - * @param start - * The group to start the search. - * @param askedGroup - * Name of the group you're looking for + * @param start The group to start the search. + * @param askedGroup Name of the group you're looking for * @return true if it inherits the group. */ public boolean hasGroupInInheritance(Group start, String askedGroup) { + if (start == null || askedGroup == null) { return false; } @@ -912,25 +894,6 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } /** - * Check if the group has given permission. Including it's inheritance - * - * @param start - * @param permission - * @param alreadyChecked - * @return true if PermissionCheckResult is EXCEPTION or FOUND - * @deprecated use the other checkGroupPermissionWithInheritance for - * everything - */ - @Deprecated - public boolean checkGroupPermissionWithInheritance(Group start, String permission, List<Group> alreadyChecked) { - PermissionCheckResult result = checkGroupPermissionWithInheritance(start, permission); - if (result.resultType.equals(Type.EXCEPTION) || result.resultType.equals(Type.FOUND)) { - return true; - } - return false; - } - - /** * Returns the result of permission check. Including inheritance. If found * anything, the PermissionCheckResult that retuns will include the Group * name, and the result type. Result types will be EXCEPTION, NEGATION, @@ -945,6 +908,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return PermissionCheckResult */ public PermissionCheckResult checkGroupPermissionWithInheritance(Group start, String targetPermission) { + if (start == null || targetPermission == null) { return null; } @@ -961,7 +925,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { for (String sonName : now.getInherits()) { Group son = ph.getGroup(sonName); if (son != null && !alreadyVisited.contains(son)) { - stack.push(son); + // Add rather than push to retain inheritance order. + stack.add(son); alreadyVisited.add(son); } } @@ -973,42 +938,6 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } /** - * It uses checkGroupPermissionWithInheritance and cast the owner to Group - * type if result type was EXCEPTION or FOUND. - * - * @param start - * @param permission - * @param alreadyChecked - * @return the group that passed on test. null if no group passed. - * @deprecated use checkGroupPermissionWithInheritance for everything now. - */ - @Deprecated - public Group nextGroupWithPermission(Group start, String permission, List<Group> alreadyChecked) { - PermissionCheckResult result = checkGroupPermissionWithInheritance(start, permission); - if (result.resultType.equals(Type.EXCEPTION) || result.resultType.equals(Type.FOUND)) { - return (Group) checkGroupPermissionWithInheritance(start, permission).owner; - } - return null; - } - - /** - * Return whole list of names of groups in a inheritance chain. Including a - * starting group. - * - * it now redirects to the other method. but get away from this one, it will - * disappear in a future release. - * - * @param start - * @param alreadyChecked - * @return the group that passed on test. null if no group passed. - * @deprecated use the other method with same name, instead - */ - @Deprecated - public ArrayList<String> listAllGroupsInherited(Group start, ArrayList<String> alreadyChecked) { - return listAllGroupsInherited(start); - } - - /** * Return whole list of names of groups in a inheritance chain. Including a * starting group. * @@ -1018,6 +947,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return the group that passed on test. null if no group passed. */ public ArrayList<String> listAllGroupsInherited(Group start) { + if (start == null) { return null; } @@ -1057,6 +987,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return PermissionCheckResult.Type */ public PermissionCheckResult.Type comparePermissionString(String userAccessLevel, String fullPermissionName) { + int userAccessLevelLength; if (userAccessLevel == null || fullPermissionName == null || fullPermissionName.length() == 0 || (userAccessLevelLength = userAccessLevel.length()) == 0) { return PermissionCheckResult.Type.NOTFOUND; @@ -1082,12 +1013,9 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } if (userAccessLevel.charAt(userAccessLevel.length() - 1) == '*') { - return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, userAccessLevelLength - userAccessLevelOffset - 1) ? - result : PermissionCheckResult.Type.NOTFOUND; + return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, userAccessLevelLength - userAccessLevelOffset - 1) ? result : PermissionCheckResult.Type.NOTFOUND; } else { - return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, - Math.max(userAccessLevelLength - userAccessLevelOffset, fullPermissionName.length() - fullPermissionNameOffset)) ? - result : PermissionCheckResult.Type.NOTFOUND; + return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, Math.max(userAccessLevelLength - userAccessLevelOffset, fullPermissionName.length() - fullPermissionNameOffset)) ? result : PermissionCheckResult.Type.NOTFOUND; } } @@ -1101,6 +1029,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public String[] getGroups(String userName) { + ArrayList<String> allGroups = listAllGroupsInherited(ph.getUser(userName).getGroup()); for (Group subg : ph.getUser(userName).subGroupListCopy()) { allGroups.addAll(listAllGroupsInherited(subg)); @@ -1122,6 +1051,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @SuppressWarnings("unused") private Group breadthFirstSearch(Group start, String targerPermission) { + if (start == null || targerPermission == null) { return null; } @@ -1151,11 +1081,13 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { @Override public Group getDefaultGroup() { + return ph.getDefaultGroup(); } @Override public String getInfoString(String entryName, String path, boolean isGroup) { + if (isGroup) { Group data = ph.getGroup(entryName); if (data == null) { @@ -1173,6 +1105,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { @Override public int getInfoInteger(String entryName, String path, boolean isGroup) { + if (isGroup) { Group data = ph.getGroup(entryName); if (data == null) { @@ -1190,6 +1123,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { @Override public double getInfoDouble(String entryName, String path, boolean isGroup) { + if (isGroup) { Group data = ph.getGroup(entryName); if (data == null) { @@ -1208,6 +1142,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { @Override public boolean getInfoBoolean(String entryName, String path, boolean isGroup) { + if (isGroup) { Group data = ph.getGroup(entryName); if (data == null) { @@ -1225,21 +1160,25 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { @Override public void addUserInfo(String name, String path, Object data) { + ph.getUser(name).getVariables().addVar(path, data); } @Override public void removeUserInfo(String name, String path) { + ph.getUser(name).getVariables().removeVar(path); } @Override public void addGroupInfo(String name, String path, Object data) { + ph.getGroup(name).getVariables().addVar(path, data); } @Override public void removeGroupInfo(String name, String path) { + ph.getGroup(name).getVariables().removeVar(path); } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java index 0b6148900..e8322c391 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java @@ -1,18 +1,19 @@ /*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ * USA.
+ */
package org.anjocaido.groupmanager.permissions;
@@ -20,12 +21,14 @@ import java.lang.reflect.Field; import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
+import java.util.WeakHashMap;
import org.anjocaido.groupmanager.GroupManager;
@@ -45,7 +48,6 @@ import org.bukkit.permissions.PermissionAttachment; import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.PluginManager;
-
/**
*
* BukkitPermissions overrides to force GM reponses to Superperms
@@ -54,17 +56,18 @@ import org.bukkit.plugin.PluginManager; */
public class BukkitPermissions {
- protected Map<Player, PermissionAttachment> attachments = new HashMap<Player, PermissionAttachment>();
+ protected WeakHashMap<Player, PermissionAttachment> attachments = new WeakHashMap<Player, PermissionAttachment>();
protected LinkedHashMap<String, Permission> registeredPermissions = new LinkedHashMap<String, Permission>();
protected GroupManager plugin;
protected boolean dumpAllPermissions = true;
protected boolean dumpMatchedPermissions = true;
private boolean player_join = false;
-
+
/**
* @return the player_join
*/
public boolean isPlayer_join() {
+
return player_join;
}
@@ -72,6 +75,7 @@ public class BukkitPermissions { * @param player_join the player_join to set
*/
public void setPlayer_join(boolean player_join) {
+
this.player_join = player_join;
}
@@ -90,44 +94,53 @@ public class BukkitPermissions { }
public BukkitPermissions(GroupManager plugin) {
+
this.plugin = plugin;
- this.collectPermissions();
+ this.reset();
this.registerEvents();
- this.updateAllPlayers();
+
GroupManager.logger.info("Superperms support enabled.");
}
+
+ public void reset() {
+ this.collectPermissions();
+ this.updateAllPlayers();
+ }
private void registerEvents() {
+
PluginManager manager = plugin.getServer().getPluginManager();
manager.registerEvents(new PlayerEvents(), plugin);
manager.registerEvents(new BukkitEvents(), plugin);
}
-
public void collectPermissions() {
+
registeredPermissions.clear();
for (Permission perm : Bukkit.getPluginManager().getPermissions()) {
- registeredPermissions.put(perm.getName().toLowerCase(), perm);
+ registeredPermissions.put(perm.getName().toLowerCase(), perm);
}
-
+
}
public void updatePermissions(Player player) {
+
this.updatePermissions(player, null);
}
-
/**
- * Push all permissions which are registered with GM for this player, on this world to Bukkit
+ * Push all permissions which are registered with GM for this player, on
+ * this world to Bukkit
* and make it update for the child nodes.
*
* @param player
* @param world
*/
public void updatePermissions(Player player, String world) {
+
if (player == null || !GroupManager.isLoaded()) {
return;
}
@@ -153,17 +166,18 @@ public class BukkitPermissions { // Sort the perm list by parent/child, so it will push to superperms correctly.
playerPermArray = sort(playerPermArray);
-
+
Boolean value = false;
- for (String permission : playerPermArray) {
+ for (String permission : playerPermArray) {
value = (!permission.startsWith("-"));
- newPerms.put((value? permission : permission.substring(1)), value);
+ newPerms.put((value ? permission : permission.substring(1)), value);
}
/**
- * This is put in place until such a time as Bukkit pull 466 is implemented
- * https://github.com/Bukkit/Bukkit/pull/466
- */
+ * This is put in place until such a time as Bukkit pull 466 is
+ * implemented
+ * https://github.com/Bukkit/Bukkit/pull/466
+ */
try { // Codename_B source
@SuppressWarnings("unchecked")
Map<String, Boolean> orig = (Map<String, Boolean>) permissions.get(attachment);
@@ -180,7 +194,7 @@ public class BukkitPermissions { e.printStackTrace();
}
}
-
+
/**
* Sort a permission node list by parent/child
*
@@ -188,20 +202,20 @@ public class BukkitPermissions { * @return List sorted for priority
*/
private List<String> sort(List<String> permList) {
-
+
List<String> result = new ArrayList<String>();
-
+
for (String key : permList) {
- String a = key.charAt(0) == '-'? key.substring(1):key;
+ String a = key.charAt(0) == '-' ? key.substring(1) : key;
Map<String, Boolean> allchildren = GroupManager.BukkitPermissions.getAllChildren(a, new HashSet<String>());
if (allchildren != null) {
ListIterator<String> itr = result.listIterator();
-
- while (itr.hasNext()){
+
+ while (itr.hasNext()) {
String node = (String) itr.next();
- String b = node.charAt(0) == '-'? node.substring(1):node;
-
+ String b = node.charAt(0) == '-' ? node.substring(1) : node;
+
// Insert the parent node before the child
if (allchildren.containsKey(b)) {
itr.set(key);
@@ -213,11 +227,10 @@ public class BukkitPermissions { if (!result.contains(key))
result.add(key);
}
-
+
return result;
}
-
/**
* Fetch all permissions which are registered with superperms.
* {can include child nodes)
@@ -226,13 +239,13 @@ public class BukkitPermissions { * @return List of all permission nodes
*/
public List<String> getAllRegisteredPermissions(boolean includeChildren) {
-
+
List<String> perms = new ArrayList<String>();
-
+
for (String key : registeredPermissions.keySet()) {
if (!perms.contains(key)) {
perms.add(key);
-
+
if (includeChildren) {
Map<String, Boolean> children = getAllChildren(key, new HashSet<String>());
if (children != null) {
@@ -242,32 +255,33 @@ public class BukkitPermissions { }
}
}
-
+
}
return perms;
}
-
+
/**
* Returns a map of ALL child permissions registered with bukkit
* null is empty
*
* @param node
- * @param playerPermArray current list of perms to check against for negations
+ * @param playerPermArray current list of perms to check against for
+ * negations
* @return Map of child permissions
*/
public Map<String, Boolean> getAllChildren(String node, Set<String> playerPermArray) {
-
+
LinkedList<String> stack = new LinkedList<String>();
Map<String, Boolean> alreadyVisited = new HashMap<String, Boolean>();
stack.push(node);
alreadyVisited.put(node, true);
-
+
while (!stack.isEmpty()) {
String now = stack.pop();
-
+
Map<String, Boolean> children = getChildren(now);
-
- if ((children != null) && (!playerPermArray.contains("-"+now))) {
+
+ if ((children != null) && (!playerPermArray.contains("-" + now))) {
for (String childName : children.keySet()) {
if (!alreadyVisited.containsKey(childName)) {
stack.push(childName);
@@ -277,24 +291,26 @@ public class BukkitPermissions { }
}
alreadyVisited.remove(node);
- if (!alreadyVisited.isEmpty()) return alreadyVisited;
-
+ if (!alreadyVisited.isEmpty())
+ return alreadyVisited;
+
return null;
}
-
+
/**
- * Returns a map of the child permissions (1 node deep) as registered with Bukkit.
+ * Returns a map of the child permissions (1 node deep) as registered with
+ * Bukkit.
* null is empty
*
* @param node
* @return Map of child permissions
*/
public Map<String, Boolean> getChildren(String node) {
-
+
Permission perm = registeredPermissions.get(node.toLowerCase());
if (perm == null)
return null;
-
+
return perm.getChildren();
}
@@ -306,6 +322,7 @@ public class BukkitPermissions { * @return List<String> of permissions
*/
public List<String> listPerms(Player player) {
+
List<String> perms = new ArrayList<String>();
/*
@@ -330,31 +347,81 @@ public class BukkitPermissions { * force Bukkit to update every OnlinePlayers permissions.
*/
public void updateAllPlayers() {
+
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
updatePermissions(player);
}
}
-
+
/**
* force Bukkit to update this Players permissions.
*/
public void updatePlayer(Player player) {
+
if (player != null)
this.updatePermissions(player, null);
}
/**
+ * Force remove any attachments
+ *
+ * @param player
+ */
+ private void removeAttachment(Player player) {
+
+ if (attachments.containsKey(player)) {
+ try {
+ player.removeAttachment(attachments.get(player));
+ } catch (IllegalArgumentException e) {
+ /*
+ * Failed to remove attachment
+ * This usually means Bukkit no longer knows of it.
+ */
+ }
+ attachments.remove(player);
+ }
+ }
+
+ /**
+ * Remove all attachments in case of a restart or reload.
+ */
+ public void removeAllAttachments() {
+
+ Iterator<Player> itr = attachments.keySet().iterator();
+
+ while (itr.hasNext()) {
+ Player player = itr.next();
+ try {
+ player.removeAttachment(attachments.get(player));
+ } catch (IllegalArgumentException e) {
+ /*
+ * Failed to remove attachment
+ * This usually means Bukkit no longer knows of it.
+ */
+ }
+ }
+ attachments.clear();
+ }
+
+ /**
* Player events tracked to cause Superperms updates
*
* @author ElgarL
- *
+ *
*/
protected class PlayerEvents implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerJoin(PlayerJoinEvent event) {
+
setPlayer_join(true);
Player player = event.getPlayer();
+
+ /*
+ * Tidy up any lose ends
+ */
+ removeAttachment(player);
+
// force GM to create the player if they are not already listed.
if (plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getName()) != null) {
setPlayer_join(false);
@@ -362,23 +429,36 @@ public class BukkitPermissions { }
setPlayer_join(false);
}
-
+
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerChangeWorld(PlayerChangedWorldEvent event) { // has changed worlds
+
updatePermissions(event.getPlayer(), event.getPlayer().getWorld().getName());
}
@EventHandler(priority = EventPriority.LOWEST)
+ public void onPlayerKick(PlayerKickEvent event) {
+
+ Player player = event.getPlayer();
+
+ /*
+ * force remove any attachments as bukkit may not
+ */
+ removeAttachment(player);
+ }
+
+ @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerQuit(PlayerQuitEvent event) {
+
if (!GroupManager.isLoaded())
return;
- attachments.remove(event.getPlayer());
- }
+ Player player = event.getPlayer();
- @EventHandler(priority = EventPriority.LOWEST)
- public void onPlayerKick(PlayerKickEvent event) {
- attachments.remove(event.getPlayer());
+ /*
+ * force remove any attachments as bukkit may not
+ */
+ removeAttachment(player);
}
}
@@ -386,6 +466,7 @@ public class BukkitPermissions { @EventHandler(priority = EventPriority.NORMAL)
public void onPluginEnable(PluginEnableEvent event) {
+
if (!GroupManager.isLoaded())
return;
@@ -395,6 +476,7 @@ public class BukkitPermissions { @EventHandler(priority = EventPriority.NORMAL)
public void onPluginDisable(PluginDisableEvent event) {
+
collectPermissions();
// updateAllPlayers();
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java index 3f49757e2..69f098949 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java @@ -12,227 +12,239 @@ import org.bukkit.entity.Player; /** * Made by Nijikokun. Changed by Gabriel Couto - * + * * This class is intended to *read* permissions from a single world. - * + * * @author Nijikokun * @author Gabriel Couto * @author ElgarL */ public abstract class PermissionsReaderInterface { - /** - * - * @param player - * @param string - * @return true if has permission - */ - public abstract boolean has(Player player, String string); - - /** - * - * @param player - * @param string - * @return true if has permission - */ - public abstract boolean permission(Player player, String string); - - /** - * - * @param userName - * @return group name for this player. - */ - public abstract String getGroup(String userName); - - /** - * - * @param userName - * @param groupName - * @return true if in group - */ - public abstract boolean inGroup(String userName, String groupName); - - /** - * - * @param groupName - * @return String of prefix - */ - public abstract String getGroupPrefix(String groupName); - - /** - * - * @param groupName - * @return String of suffix - */ - public abstract String getGroupSuffix(String groupName); - - /** - * - * @param groupName - * @return true if can build - */ - public abstract boolean canGroupBuild(String groupName); - - /** - * - * @param groupName - * @param node - * @return String value - */ - public abstract String getGroupPermissionString(String groupName, String node); - - /** - * - * @param groupName - * @param node - * @return integer value - */ - public abstract int getGroupPermissionInteger(String groupName, String node); - - /** - * - * @param groupName - * @param node - * @return boolean value - */ - public abstract boolean getGroupPermissionBoolean(String groupName, String node); - - /** - * - * @param groupName - * @param node - * @return double value - */ - public abstract double getGroupPermissionDouble(String groupName, String node); - - /** - * - * @param userName - * @param node - * @return String value - */ - public abstract String getUserPermissionString(String userName, String node); - - /** - * - * @param userName - * @param node - * @return integer value - */ - public abstract int getUserPermissionInteger(String userName, String node); - - /** - * - * @param userName - * @param node - * @return boolean value - */ - public abstract boolean getUserPermissionBoolean(String userName, String node); - - /** - * - * @param userName - * @param node - * @return double value - */ - public abstract double getUserPermissionDouble(String userName, String node); - - /** - * - * @param userName - * @param node - * @return String value - */ - public abstract String getPermissionString(String userName, String node); - - /** - * - * @param userName - * @param node - * @return integer value - */ - public abstract int getPermissionInteger(String userName, String node); - - /** - * - * @param userName - * @param node - * @return boolean value - */ - public abstract boolean getPermissionBoolean(String userName, String node); - - /** - * - * @param userName - * @param node - * @return double value - */ - public abstract double getPermissionDouble(String userName, String node); - -///////////////////////////// - /** - * Gets the appropriate prefix for the user. - * This method is a utility method for chat plugins to get the user's prefix - * without having to look at every one of the user's ancestors. - * Returns an empty string if user has no parent groups. - * - * @param user Player's name - * @return Player's prefix - */ - public abstract String getUserPrefix(String user); - - /** - * Gets the appropriate suffix for the user. - * This method is a utility method for chat plugins to get the user's suffix - * without having to look at every one of the user's ancestors. - * Returns an empty string if user has no parent groups. - * - * @param user Player's name - * @return Player's suffix - */ - public abstract String getUserSuffix(String user); - - /** - * Returns the group object representing the default group of the given world. - * This method will return null if the object does not exist or the world has no default group. - * @return Group object representing default world, or null if it doesn't exist or is not defined. - */ - public abstract Group getDefaultGroup(); - - /** - * Gets a array of the names of all parent groups in the same world. - * @param name Target user's name - * @return An array containing the names of all parent groups (including ancestors) that are in the same world - */ - public abstract String[] getGroups(String name); - - public abstract String getInfoString(String entryName, String path, boolean isGroup); - //public abstract String getInfoString(String entryName, String path, boolean isGroup, Comparator<String> comparator); - - public abstract int getInfoInteger(String entryName, String path, boolean isGroup); - //public abstract int getInfoInteger(String entryName, String path, boolean isGroup, Comparator<Integer> comparator); - - /** - * Gets a double from the Info node without inheritance. - * @param entryName - * @param path - * @param isGroup - * @return -1 if not found - */ - public abstract double getInfoDouble(String entryName, String path, boolean isGroup); - //public abstract double getInfoDouble(String entryName, String path, boolean isGroup, Comparator<Double> comparator); - - public abstract boolean getInfoBoolean(String entryName, String path, boolean isGroup); - //public abstract boolean getInfoBoolean(String entryName, String path, boolean isGroup, Comparator<Boolean> comparator); - - public abstract void addUserInfo(String name, String path, Object data); - - public abstract void removeUserInfo(String name, String path); - - public abstract void addGroupInfo(String name, String path, Object data); - - public abstract void removeGroupInfo(String name, String path); -////////////////////////////// + /** + * + * @param player + * @param string + * @return true if has permission + */ + public abstract boolean has(Player player, String string); + + /** + * + * @param player + * @param string + * @return true if has permission + */ + public abstract boolean permission(Player player, String string); + + /** + * + * @param userName + * @return group name for this player. + */ + public abstract String getGroup(String userName); + + /** + * + * @param userName + * @param groupName + * @return true if in group + */ + public abstract boolean inGroup(String userName, String groupName); + + /** + * + * @param groupName + * @return String of prefix + */ + public abstract String getGroupPrefix(String groupName); + + /** + * + * @param groupName + * @return String of suffix + */ + public abstract String getGroupSuffix(String groupName); + + /** + * + * @param groupName + * @return true if can build + */ + public abstract boolean canGroupBuild(String groupName); + + /** + * + * @param groupName + * @param node + * @return String value + */ + public abstract String getGroupPermissionString(String groupName, String node); + + /** + * + * @param groupName + * @param node + * @return integer value + */ + public abstract int getGroupPermissionInteger(String groupName, String node); + + /** + * + * @param groupName + * @param node + * @return boolean value + */ + public abstract boolean getGroupPermissionBoolean(String groupName, String node); + + /** + * + * @param groupName + * @param node + * @return double value + */ + public abstract double getGroupPermissionDouble(String groupName, String node); + + /** + * + * @param userName + * @param node + * @return String value + */ + public abstract String getUserPermissionString(String userName, String node); + + /** + * + * @param userName + * @param node + * @return integer value + */ + public abstract int getUserPermissionInteger(String userName, String node); + + /** + * + * @param userName + * @param node + * @return boolean value + */ + public abstract boolean getUserPermissionBoolean(String userName, String node); + + /** + * + * @param userName + * @param node + * @return double value + */ + public abstract double getUserPermissionDouble(String userName, String node); + + /** + * + * @param userName + * @param node + * @return String value + */ + public abstract String getPermissionString(String userName, String node); + + /** + * + * @param userName + * @param node + * @return integer value + */ + public abstract int getPermissionInteger(String userName, String node); + + /** + * + * @param userName + * @param node + * @return boolean value + */ + public abstract boolean getPermissionBoolean(String userName, String node); + + /** + * + * @param userName + * @param node + * @return double value + */ + public abstract double getPermissionDouble(String userName, String node); + + ///////////////////////////// + /** + * Gets the appropriate prefix for the user. + * This method is a utility method for chat plugins to get the user's prefix + * without having to look at every one of the user's ancestors. + * Returns an empty string if user has no parent groups. + * + * @param user Player's name + * @return Player's prefix + */ + public abstract String getUserPrefix(String user); + + /** + * Gets the appropriate suffix for the user. + * This method is a utility method for chat plugins to get the user's suffix + * without having to look at every one of the user's ancestors. + * Returns an empty string if user has no parent groups. + * + * @param user Player's name + * @return Player's suffix + */ + public abstract String getUserSuffix(String user); + + /** + * Returns the group object representing the default group of the given + * world. + * This method will return null if the object does not exist or the world + * has no default group. + * + * @return Group object representing default world, or null if it doesn't + * exist or is not defined. + */ + public abstract Group getDefaultGroup(); + + /** + * Gets a array of the names of all parent groups in the same world. + * + * @param name Target user's name + * @return An array containing the names of all parent groups (including + * ancestors) that are in the same world + */ + public abstract String[] getGroups(String name); + + public abstract String getInfoString(String entryName, String path, boolean isGroup); + + //public abstract String getInfoString(String entryName, String path, boolean isGroup, Comparator<String> comparator); + + public abstract int getInfoInteger(String entryName, String path, boolean isGroup); + + //public abstract int getInfoInteger(String entryName, String path, boolean isGroup, Comparator<Integer> comparator); + + /** + * Gets a double from the Info node without inheritance. + * + * @param entryName + * @param path + * @param isGroup + * @return -1 if not found + */ + public abstract double getInfoDouble(String entryName, String path, boolean isGroup); + + //public abstract double getInfoDouble(String entryName, String path, boolean isGroup, Comparator<Double> comparator); + + public abstract boolean getInfoBoolean(String entryName, String path, boolean isGroup); + + //public abstract boolean getInfoBoolean(String entryName, String path, boolean isGroup, Comparator<Boolean> comparator); + + public abstract void addUserInfo(String name, String path, Object data); + + public abstract void removeUserInfo(String name, String path); + + public abstract void addGroupInfo(String name, String path, Object data); + + public abstract void removeGroupInfo(String name, String path); + + ////////////////////////////// public abstract List<String> getAllPlayersPermissions(String userName); diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java index 87b6806ab..de5348b17 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java @@ -9,18 +9,19 @@ import java.util.logging.Level; import java.util.logging.LogRecord; /** - * + * * @author gabrielcouto */ public class GMLoggerHandler extends ConsoleHandler { - @Override - public void publish(LogRecord record) { - String message = "GroupManager - " + record.getLevel() + " - " + record.getMessage(); - if (record.getLevel().equals(Level.SEVERE) || record.getLevel().equals(Level.WARNING)) { - System.err.println(message); - } else { - System.out.println(message); - } - } + @Override + public void publish(LogRecord record) { + + String message = "GroupManager - " + record.getLevel() + " - " + record.getMessage(); + if (record.getLevel().equals(Level.SEVERE) || record.getLevel().equals(Level.WARNING)) { + System.err.println(message); + } else { + System.out.println(message); + } + } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java index 0262bb33e..4a7298b9c 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java @@ -6,47 +6,48 @@ package org.anjocaido.groupmanager.utils; /** * Just a list of commands for this plugin + * * @author gabrielcouto */ public enum GroupManagerPermissions { - manuadd, - manudel, - manuaddsub, - manudelsub, - mangadd, - mangdel, - manuaddp, - manudelp, - manulistp, - manucheckp, - mangaddp, - mangdelp, - manglistp, - mangcheckp, - mangaddi, - mangdeli, - manuaddv, - manudelv, - manulistv, - manucheckv, - mangaddv, - mangdelv, - manglistv, - mangcheckv, - manwhois, - tempadd, - tempdel, - templist, - tempdelall, - mansave, - manload, - listgroups, - manpromote, - mandemote, - mantogglevalidate, - mantogglesave, - manworld, - manselect, - manclear + manuadd, + manudel, + manuaddsub, + manudelsub, + mangadd, + mangdel, + manuaddp, + manudelp, + manulistp, + manucheckp, + mangaddp, + mangdelp, + manglistp, + mangcheckp, + mangaddi, + mangdeli, + manuaddv, + manudelv, + manulistv, + manucheckv, + mangaddv, + mangdelv, + manglistv, + mangcheckv, + manwhois, + tempadd, + tempdel, + templist, + tempdelall, + mansave, + manload, + listgroups, + manpromote, + mandemote, + mantogglevalidate, + mantogglesave, + manworld, + manselect, + manclear } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java index 88ac48427..eb6633863 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java @@ -7,61 +7,61 @@ package org.anjocaido.groupmanager.utils; import org.anjocaido.groupmanager.data.DataUnit; /** - * + * * @author gabrielcouto */ public class PermissionCheckResult { - /** - * It should be the owner of the access level found. - * - * Use instanceof to find the owner type - */ - public DataUnit owner; - /** - * The permission node found in the DataUnit. - */ - public String accessLevel; - /** - * The full name of the permission you are looking for - */ - public String askedPermission; - /** - * The result conclusion of the search. - * It determines if the owner can do, or not. - * - * It even determines if it has an owner. - */ - public Type resultType = Type.NOTFOUND; + /** + * It should be the owner of the access level found. + * + * Use instanceof to find the owner type + */ + public DataUnit owner; + /** + * The permission node found in the DataUnit. + */ + public String accessLevel; + /** + * The full name of the permission you are looking for + */ + public String askedPermission; + /** + * The result conclusion of the search. + * It determines if the owner can do, or not. + * + * It even determines if it has an owner. + */ + public Type resultType = Type.NOTFOUND; - /** - * The type of result the search can give. - */ - public enum Type { + /** + * The type of result the search can give. + */ + public enum Type { - /** - * If found a matching node starting with '+'. - * It means the user CAN do the permission. - */ - EXCEPTION, - /** - * If found a matching node starting with '-'. - * It means the user CANNOT do the permission. - */ - NEGATION, - /** - * If just found a common matching node. - * IT means the user CAN do the permission. - */ - FOUND, - /** - * If no matchin node was found. - * It means the user CANNOT do the permission. - * - * owner field and accessLevel field should not be considered, - * when type is - * NOTFOUND - */ - NOTFOUND - } + /** + * If found a matching node starting with '+'. + * It means the user CAN do the permission. + */ + EXCEPTION, + /** + * If found a matching node starting with '-'. + * It means the user CANNOT do the permission. + */ + NEGATION, + /** + * If just found a common matching node. + * IT means the user CAN do the permission. + */ + FOUND, + /** + * If no matchin node was found. + * It means the user CANNOT do the permission. + * + * owner field and accessLevel field should not be considered, + * when type is + * NOTFOUND + */ + NOTFOUND + } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java index ab2fd605b..5a56cd9fc 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java @@ -7,43 +7,46 @@ package org.anjocaido.groupmanager.utils; import java.util.Comparator; /** - * + * * @author gabrielcouto */ public class StringPermissionComparator implements Comparator<String> { - @Override - public int compare(String permA, String permB) { - boolean ap = permA.startsWith("+"); - boolean bp = permB.startsWith("+"); - boolean am = permA.startsWith("-"); - boolean bm = permB.startsWith("-"); - if (ap && bp) { - return 0; - } - if (ap && !bp) { - return -1; - } - if (!ap && bp) { - return 1; - } - if (am && bm) { - return 0; - } - if (am && !bm) { - return -1; - } - if (!am && bm) { - return 1; - } - return permA.compareToIgnoreCase(permB); - } - private static StringPermissionComparator instance; + @Override + public int compare(String permA, String permB) { - public static StringPermissionComparator getInstance() { - if (instance == null) { - instance = new StringPermissionComparator(); - } - return instance; - } + boolean ap = permA.startsWith("+"); + boolean bp = permB.startsWith("+"); + boolean am = permA.startsWith("-"); + boolean bm = permB.startsWith("-"); + if (ap && bp) { + return 0; + } + if (ap && !bp) { + return -1; + } + if (!ap && bp) { + return 1; + } + if (am && bm) { + return 0; + } + if (am && !bm) { + return -1; + } + if (!am && bm) { + return 1; + } + return permA.compareToIgnoreCase(permB); + } + + private static StringPermissionComparator instance; + + public static StringPermissionComparator getInstance() { + + if (instance == null) { + instance = new StringPermissionComparator(); + } + return instance; + } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java index f3defd94a..d75737c66 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java @@ -4,12 +4,17 @@ */ package org.anjocaido.groupmanager.utils; +import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; +import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.List; @@ -18,109 +23,153 @@ import org.anjocaido.groupmanager.GroupManager; import org.anjocaido.groupmanager.data.Group; /** - * + * * @author gabrielcouto */ public abstract class Tasks { - public static void copy(InputStream src, File dst) throws IOException { - InputStream in = src; - OutputStream out = new FileOutputStream(dst); - - // Transfer bytes from in to out - byte[] buf = new byte[1024]; - int len; - while ((len = in.read(buf)) > 0) { - out.write(buf, 0, len); - } - out.close(); - try { - in.close(); - } catch (Exception e) { - } - } - - public static void copy(File src, File dst) throws IOException { - InputStream in = new FileInputStream(src); - copy(in, dst); - } - - public static void removeOldFiles(GroupManager gm, File folder) { - if (folder.isDirectory()) { - long oldTime = System.currentTimeMillis() - (((long)gm.getGMConfig().getBackupDuration()*60*60)*1000); - for (File olds : folder.listFiles()) { - if (olds.isFile()) { - if (olds.lastModified() < oldTime) { - try { - olds.delete(); - } catch (Exception e) { - } - } - } - } - } - } - - public static String getDateString() { - GregorianCalendar now = new GregorianCalendar(); - String date = ""; - date += now.get(Calendar.DAY_OF_MONTH); - date += "-"; - date += now.get(Calendar.HOUR); - date += "-"; - date += now.get(Calendar.MINUTE); - return date; - } - - public static String getStringListInString(List<String> list) { - if (list == null) { - return ""; - } - String result = ""; - for (int i = 0; i < list.size(); i++) { - result += list.get(i); - if (i < list.size() - 1) { - result += ", "; - } - } - return result; - } - - public static String getStringArrayInString(String[] list) { - if (list == null) { - return ""; - } - String result = ""; - for (int i = 0; i < list.length; i++) { - result += list[i]; - if (i < ((list.length) - 1)) { - result += ", "; - } - } - return result; - } - - public static String getGroupListInString(List<Group> list) { - if (list == null) { - return ""; - } - String result = ""; - for (int i = 0; i < list.size(); i++) { - result += list.get(i).getName(); - if (i < list.size() - 1) { - result += ", "; - } - } - return result; - } - - public static String join(String[] arr, String separator) { - if (arr.length == 0) - return ""; - String out = arr[0].toString(); - for (int i = 1; i < arr.length; i++) - out += separator + arr[i]; - return out; - } + /** + * Gets the exception stack trace as a string. + * + * @param exception + * @return stack trace as a string + */ + public static String getStackTraceAsString(Exception exception) { + + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + exception.printStackTrace(pw); + return sw.toString(); + } + + public static void copy(InputStream src, File dst) throws IOException { + + InputStream in = src; + OutputStream out = new FileOutputStream(dst); + + // Transfer bytes from in to out + byte[] buf = new byte[1024]; + int len; + while ((len = in.read(buf)) > 0) { + out.write(buf, 0, len); + } + out.close(); + try { + in.close(); + } catch (Exception e) { + } + } + + public static void copy(File src, File dst) throws IOException { + + InputStream in = new FileInputStream(src); + copy(in, dst); + } + + /** + * Appends a string to a file + * + * @param data + * @param file + */ + public static void appendStringToFile(String data, String file) throws IOException { + + FileWriter outStream = new FileWriter("." + System.getProperty("file.separator") + file, true); + + BufferedWriter out = new BufferedWriter(outStream); + + data.replaceAll("\n", System.getProperty("line.separator")); + + out.append(new SimpleDateFormat("yyyy-MM-dd HH-mm").format(System.currentTimeMillis())); + out.append(System.getProperty("line.separator")); + out.append(data); + out.append(System.getProperty("line.separator")); + + out.close(); + } + + public static void removeOldFiles(GroupManager gm, File folder) { + + if (folder.isDirectory()) { + long oldTime = System.currentTimeMillis() - (((long) gm.getGMConfig().getBackupDuration() * 60 * 60) * 1000); + for (File olds : folder.listFiles()) { + if (olds.isFile()) { + if (olds.lastModified() < oldTime) { + try { + olds.delete(); + } catch (Exception e) { + } + } + } + } + } + } + + public static String getDateString() { + + GregorianCalendar now = new GregorianCalendar(); + String date = ""; + date += now.get(Calendar.DAY_OF_MONTH); + date += "-"; + date += now.get(Calendar.HOUR); + date += "-"; + date += now.get(Calendar.MINUTE); + return date; + } + + public static String getStringListInString(List<String> list) { + + if (list == null) { + return ""; + } + String result = ""; + for (int i = 0; i < list.size(); i++) { + result += list.get(i); + if (i < list.size() - 1) { + result += ", "; + } + } + return result; + } + + public static String getStringArrayInString(String[] list) { + + if (list == null) { + return ""; + } + String result = ""; + for (int i = 0; i < list.length; i++) { + result += list[i]; + if (i < ((list.length) - 1)) { + result += ", "; + } + } + return result; + } + + public static String getGroupListInString(List<Group> list) { + + if (list == null) { + return ""; + } + String result = ""; + for (int i = 0; i < list.size(); i++) { + result += list.get(i).getName(); + if (i < list.size() - 1) { + result += ", "; + } + } + return result; + } + + public static String join(String[] arr, String separator) { + + if (arr.length == 0) + return ""; + String out = arr[0].toString(); + for (int i = 1; i < arr.length; i++) + out += separator + arr[i]; + return out; + } } diff --git a/EssentialsGroupManager/src/plugin.yml b/EssentialsGroupManager/src/plugin.yml index 65a5d4e95..f7faa5896 100644 --- a/EssentialsGroupManager/src/plugin.yml +++ b/EssentialsGroupManager/src/plugin.yml @@ -10,7 +10,7 @@ authors: commands: manuadd: description: Move a player to desired group.(Adds to the file if not exists) - usage: /<command> <player> <group> + usage: /<command> <player> <group> | optional [world] permissions: groupmanager.manuadd manudel: description: Remove any user specific configuration. Make him default group. @@ -163,4 +163,9 @@ commands: manclear: description: Clear world selection. Next commands will work on your world. usage: /<command> - permissions: groupmanager.manclear
\ No newline at end of file + permissions: groupmanager.manclear + +Permissions: + groupmanager.op: + description: User is treated as an op when using the GroupManager commands. + default: false
\ No newline at end of file diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java index 9766a1a11..e475296b5 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java @@ -1,7 +1,6 @@ package com.earth2me.essentials.protect; import com.earth2me.essentials.api.IEssentials; -import com.earth2me.essentials.craftbukkit.FakeExplosion; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -260,7 +259,7 @@ public class EssentialsProtectEntityListener implements Listener { return; } - final CreatureType creature = event.getCreatureType(); + final EntityType creature = event.getEntityType(); if (creature == null) { return; diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignBalance.java b/EssentialsSigns/src/com/earth2me/essentials/signs/SignBalance.java index 2ef64003a..77f82bdb5 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignBalance.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/SignBalance.java @@ -3,6 +3,7 @@ package com.earth2me.essentials.signs; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.api.IEssentials; import com.earth2me.essentials.api.IUser; +import com.earth2me.essentials.Util; public class SignBalance extends EssentialsSign @@ -15,7 +16,7 @@ public class SignBalance extends EssentialsSign @Override protected boolean onSignInteract(final ISign sign, final IUser player, final String username, final IEssentials ess) throws SignException { - player.sendMessage(_("balance", player.getMoney())); + player.sendMessage(_("balance", Util.displayCurrency(player.getMoney(), ess))); return true; } } diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignBlockListener.java b/EssentialsSigns/src/com/earth2me/essentials/signs/SignBlockListener.java index b16cdb07e..c678c2efa 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignBlockListener.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/SignBlockListener.java @@ -2,6 +2,7 @@ package com.earth2me.essentials.signs; import com.earth2me.essentials.api.IEssentials; import com.earth2me.essentials.api.IUser; +import com.earth2me.essentials.Util; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Material; @@ -19,6 +20,8 @@ public class SignBlockListener implements Listener private final transient IEssentials ess; private final transient ISignsPlugin plugin; private final static Logger LOGGER = Logger.getLogger("Minecraft"); + private final static int WALL_SIGN = Material.WALL_SIGN.getId(); + private final static int SIGN_POST = Material.SIGN_POST.getId(); public SignBlockListener(final IEssentials ess, final ISignsPlugin plugin) { @@ -26,10 +29,10 @@ public class SignBlockListener implements Listener this.plugin = plugin; } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockBreak(final BlockBreakEvent event) { - if (event.isCancelled()) + if (ess.getSettings().areSignsDisabled()) { return; } @@ -43,7 +46,7 @@ public class SignBlockListener implements Listener public boolean protectSignsAndBlocks(final Block block, final Player player) { final int mat = block.getTypeId(); - if (mat == Material.SIGN_POST.getId() || mat == Material.WALL_SIGN.getId()) + if (mat == SIGN_POST || mat == WALL_SIGN) { final Sign csign = (Sign)block.getState(); @@ -56,12 +59,18 @@ public class SignBlockListener implements Listener } } } - else + // prevent any signs be broken by destroying the block they are attached to + if (EssentialsSign.checkIfBlockBreaksSigns(block)) { - // prevent any signs be broken by destroying the block they are attached to - if (EssentialsSign.checkIfBlockBreaksSigns(block)) + LOGGER.log(Level.INFO, "Prevented that a block was broken next to a sign."); + return true; + } + for (EssentialsSign sign : ess.getSettings().enabledSigns()) + { + if (sign.getBlocks().contains(block.getType()) + && !sign.onBlockBreak(block, player, ess)) { - LOGGER.log(Level.INFO, "Prevented that a block was broken next to a sign."); + LOGGER.log(Level.INFO, "A block was protected by a sign."); return true; } for (EssentialsSign sign : plugin.getSettings().getEnabledSigns()) @@ -77,21 +86,20 @@ public class SignBlockListener implements Listener return false; } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onSignChange(final SignChangeEvent event) { - if (event.isCancelled()) + if (ess.getSettings().areSignsDisabled()) { return; } - IUser user = ess.getUser(event.getPlayer()); - if (SignsPermissions.COLOR.isAuthorized(user)) + User user = ess.getUser(event.getPlayer()); + + for (int i = 0; i < 4; i++) { - for (int i = 0; i < 4; i++) - { - event.setLine(i, event.getLine(i).replaceAll("&([0-9a-f])", "ยง$1")); - } + event.setLine(i, Util.formatString(user, "essentials.signs", event.getLine(i))); } + for (Signs signs : Signs.values()) { final EssentialsSign sign = signs.getSign(); @@ -109,25 +117,25 @@ public class SignBlockListener implements Listener } } - @EventHandler(priority = EventPriority.LOW) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockPlace(final BlockPlaceEvent event) { - if (event.isCancelled()) + if (ess.getSettings().areSignsDisabled()) { return; } final Block against = event.getBlockAgainst(); - if ((against.getType() == Material.WALL_SIGN - || against.getType() == Material.SIGN_POST) + if ((against.getTypeId() == WALL_SIGN + || against.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(against))) { event.setCancelled(true); return; } final Block block = event.getBlock(); - if (block.getType() == Material.WALL_SIGN - || block.getType() == Material.SIGN_POST) + if (block.getTypeId() == WALL_SIGN + || block.getTypeId() == SIGN_POST) { return; } @@ -143,17 +151,17 @@ public class SignBlockListener implements Listener } } - @EventHandler(priority = EventPriority.LOW) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockBurn(final BlockBurnEvent event) { - if (event.isCancelled()) + if (ess.getSettings().areSignsDisabled()) { return; } final Block block = event.getBlock(); - if (((block.getType() == Material.WALL_SIGN - || block.getType() == Material.SIGN_POST) + if (((block.getTypeId() == WALL_SIGN + || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { @@ -171,17 +179,17 @@ public class SignBlockListener implements Listener } } - @EventHandler(priority = EventPriority.LOW) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockIgnite(final BlockIgniteEvent event) { - if (event.isCancelled()) + if (ess.getSettings().areSignsDisabled()) { return; } final Block block = event.getBlock(); - if (((block.getType() == Material.WALL_SIGN - || block.getType() == Material.SIGN_POST) + if (((block.getTypeId() == WALL_SIGN + || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { @@ -204,8 +212,8 @@ public class SignBlockListener implements Listener { for (Block block : event.getBlocks()) { - if (((block.getType() == Material.WALL_SIGN - || block.getType() == Material.SIGN_POST) + if (((block.getTypeId() == WALL_SIGN + || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { @@ -230,8 +238,8 @@ public class SignBlockListener implements Listener if (event.isSticky()) { final Block block = event.getBlock(); - if (((block.getType() == Material.WALL_SIGN - || block.getType() == Material.SIGN_POST) + if (((block.getTypeId() == WALL_SIGN + || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignEnchant.java b/EssentialsSigns/src/com/earth2me/essentials/signs/SignEnchant.java index 4c5deb51f..f974b2e25 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignEnchant.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/SignEnchant.java @@ -39,7 +39,7 @@ public class SignEnchant extends EssentialsSign } catch (NumberFormatException ex) { - throw new SignException(ex.getMessage()); + throw new SignException(ex.getMessage(), ex); } if (level < 1 || level > enchantment.getMaxLevel()) { @@ -55,7 +55,7 @@ public class SignEnchant extends EssentialsSign } catch (Throwable ex) { - throw new SignException(ex.getMessage()); + throw new SignException(ex.getMessage(), ex); } getTrade(sign, 3, ess); return true; diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignEntityListener.java b/EssentialsSigns/src/com/earth2me/essentials/signs/SignEntityListener.java index 96d5e7222..00ebc60d0 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignEntityListener.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/SignEntityListener.java @@ -26,8 +26,8 @@ public class SignEntityListener implements Listener { for (Block block : event.blockList()) { - if (((block.getType() == Material.WALL_SIGN - || block.getType() == Material.SIGN_POST) + if (((block.getTypeId() == Material.WALL_SIGN.getId() + || block.getTypeId() == Material.SIGN_POST.getId()) && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { @@ -45,17 +45,17 @@ public class SignEntityListener implements Listener } } - @EventHandler(priority = EventPriority.LOW) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onEntityChangeBlock(final EntityChangeBlockEvent event) { - if (event.isCancelled()) + if (ess.getSettings().areSignsDisabled()) { return; } final Block block = event.getBlock(); - if (((block.getType() == Material.WALL_SIGN - || block.getType() == Material.SIGN_POST) + if (((block.getTypeId() == Material.WALL_SIGN.getId() + || block.getTypeId() == Material.SIGN_POST.getId()) && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignKit.java b/EssentialsSigns/src/com/earth2me/essentials/signs/SignKit.java index f6471123f..46bbb65db 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignKit.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/SignKit.java @@ -60,9 +60,9 @@ public class SignKit extends EssentialsSign try { final Kit kit = ess.getKits().getKit(kitName); - ess.getKits().sendKit(player, kit); - - //TODO: Implement Kits from 2.9 + Kit.checkTime(player, kitName, kit); + final List<String> items = Kit.getItems(player, kit); + Kit.expandItems(ess, player, items); charge.charge(player); } catch (Exception ex) diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignPlayerListener.java b/EssentialsSigns/src/com/earth2me/essentials/signs/SignPlayerListener.java index 3aed5d155..1a401ce64 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignPlayerListener.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/SignPlayerListener.java @@ -22,26 +22,22 @@ public class SignPlayerListener implements Listener this.plugin = plugin; } - @EventHandler(priority = EventPriority.LOW) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onPlayerInteract(final PlayerInteractEvent event) { - if (event.isCancelled()) + if (ess.getSettings().areSignsDisabled() || event.getAction() != Action.RIGHT_CLICK_BLOCK) { return; } - final Block block = event.getClickedBlock(); if (block == null) { return; } + final int mat = block.getTypeId(); if (mat == Material.SIGN_POST.getId() || mat == Material.WALL_SIGN.getId()) { - if (event.getAction() != Action.RIGHT_CLICK_BLOCK) - { - return; - } final Sign csign = (Sign)block.getState(); for (EssentialsSign sign : plugin.getSettings().getEnabledSigns()) { @@ -62,7 +58,6 @@ public class SignPlayerListener implements Listener { event.setCancelled(true); return; - } } } diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignProtection.java b/EssentialsSigns/src/com/earth2me/essentials/signs/SignProtection.java index ca4f6b869..bfdacee41 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignProtection.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/SignProtection.java @@ -147,7 +147,7 @@ public class SignProtection extends EssentialsSign { return SignProtectionState.OWNER; } - if (Util.stripColor(sign.getLine(3)).equalsIgnoreCase(username)) + if (Util.stripFormat(sign.getLine(3)).equalsIgnoreCase(username)) { return SignProtectionState.OWNER; } diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignTrade.java b/EssentialsSigns/src/com/earth2me/essentials/signs/SignTrade.java index 7622493b7..0dcb58c95 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignTrade.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/SignTrade.java @@ -228,7 +228,7 @@ public class SignTrade extends EssentialsSign } catch (SignException e) { - throw new SignException(_("tradeSignEmpty")); + throw new SignException(_("tradeSignEmpty"), e); } } diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/Signs.java b/EssentialsSigns/src/com/earth2me/essentials/signs/Signs.java index e29d45ad4..2cf05ee77 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/Signs.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/Signs.java @@ -19,6 +19,7 @@ public enum Signs TRADE(new SignTrade()), WARP(new SignWarp()), WEATHER(new SignWeather()); + private final EssentialsSign sign; private Signs(final EssentialsSign sign) diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java index 2f27421f9..c00ef38af 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java +++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java @@ -13,4 +13,10 @@ public class InstallationFinishedEvent extends Event { return handlers; } + + @Override + public HandlerList getHandlers() + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/src/examples/bpermissions.yml b/examples/bpermissions.yml index 6b7900c4f..6b7900c4f 100644 --- a/Essentials/src/examples/bpermissions.yml +++ b/examples/bpermissions.yml diff --git a/Essentials/src/examples/permissionsbukkit.yml b/examples/permissionsbukkit.yml index 515256ef1..515256ef1 100644 --- a/Essentials/src/examples/permissionsbukkit.yml +++ b/examples/permissionsbukkit.yml diff --git a/Essentials/src/examples/permissionsex.yml b/examples/permissionsex.yml index 3dc6354fb..3dc6354fb 100644 --- a/Essentials/src/examples/permissionsex.yml +++ b/examples/permissionsex.yml |