diff options
22 files changed, 130 insertions, 192 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index 3ee7c1777..d8d1f5554 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -66,7 +66,7 @@ import org.yaml.snakeyaml.error.YAMLException; public class Essentials extends JavaPlugin implements IEssentials { - public static final int BUKKIT_VERSION = 1846; + public static final int BUKKIT_VERSION = 1952; private static final Logger LOGGER = Logger.getLogger("Minecraft"); private transient ISettings settings; private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this); diff --git a/Essentials/src/com/earth2me/essentials/EssentialsConf.java b/Essentials/src/com/earth2me/essentials/EssentialsConf.java index ec6e27b53..9ffe7e5b6 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsConf.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsConf.java @@ -3,7 +3,6 @@ package com.earth2me.essentials; import static com.earth2me.essentials.I18n._; import java.io.*; import java.util.HashMap; -import java.util.List; import java.util.Locale; import java.util.Map; import java.util.logging.Level; @@ -12,12 +11,14 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.World; +import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.configuration.InvalidConfigurationException; +import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; -import org.bukkit.util.config.Configuration; -public class EssentialsConf extends Configuration +public class EssentialsConf extends YamlConfiguration { private static final Logger LOGGER = Logger.getLogger("Minecraft"); private transient File configFile; @@ -26,15 +27,10 @@ public class EssentialsConf extends Configuration public EssentialsConf(final File configFile) { - super(configFile); + super(); this.configFile = configFile; - if (this.root == null) - { - this.root = new HashMap<String, Object>(); - } } - @Override public void load() { configFile = configFile.getAbsoluteFile(); @@ -105,20 +101,24 @@ public class EssentialsConf extends Configuration } } + try { - super.load(); + super.load(configFile); } - catch (RuntimeException e) - { - File broken = new File(configFile.getAbsolutePath() + ".broken." + System.currentTimeMillis()); - configFile.renameTo(broken); - LOGGER.log(Level.SEVERE, "The file " + configFile.toString() + " is broken, it has been renamed to " + broken.toString(), e.getCause()); + catch (FileNotFoundException ex) + { + LOGGER.log(Level.SEVERE, null, ex); } - - if (this.root == null) + catch (IOException ex) { - this.root = new HashMap<String, Object>(); + LOGGER.log(Level.SEVERE, null, ex); + } + catch (InvalidConfigurationException ex) + { + File broken = new File(configFile.getAbsolutePath() + ".broken." + System.currentTimeMillis()); + configFile.renameTo(broken); + LOGGER.log(Level.SEVERE, "The file " + configFile.toString() + " is broken, it has been renamed to " + broken.toString(), ex.getCause()); } } @@ -193,7 +193,7 @@ public class EssentialsConf extends Configuration public boolean hasProperty(final String path) { - return getProperty(path) != null; + return isSet(path); } public Location getLocation(final String path, final Server server) throws Exception @@ -218,24 +218,25 @@ public class EssentialsConf extends Configuration public void setProperty(final String path, final Location loc) { - setProperty((path == null ? "" : path + ".") + "world", loc.getWorld().getName()); - setProperty((path == null ? "" : path + ".") + "x", loc.getX()); - setProperty((path == null ? "" : path + ".") + "y", loc.getY()); - setProperty((path == null ? "" : path + ".") + "z", loc.getZ()); - setProperty((path == null ? "" : path + ".") + "yaw", loc.getYaw()); - setProperty((path == null ? "" : path + ".") + "pitch", loc.getPitch()); + set((path == null ? "" : path + ".") + "world", loc.getWorld().getName()); + set((path == null ? "" : path + ".") + "x", loc.getX()); + set((path == null ? "" : path + ".") + "y", loc.getY()); + set((path == null ? "" : path + ".") + "z", loc.getZ()); + set((path == null ? "" : path + ".") + "yaw", loc.getYaw()); + set((path == null ? "" : path + ".") + "pitch", loc.getPitch()); } + @Override public ItemStack getItemStack(final String path) { final ItemStack stack = new ItemStack( Material.valueOf(getString(path + ".type", "AIR")), getInt(path + ".amount", 1), (short)getInt(path + ".damage", 0)); - final List<String> enchants = getKeys(path + ".enchant"); + final ConfigurationSection enchants = getConfigurationSection(path + ".enchant"); if (enchants != null) { - for (String enchant : enchants) + for (String enchant : enchants.getKeys(false)) { final Enchantment enchantment = Enchantment.getByName(enchant.toUpperCase(Locale.ENGLISH)); if (enchantment == null) @@ -271,14 +272,14 @@ public class EssentialsConf extends Configuration } // getData().getData() is broken //map.put("data", stack.getDurability()); - setProperty(path, map); + set(path, map); } public long getLong(final String path, final long def) { try { - final Number num = (Number)getProperty(path); + final Number num = (Number)get(path); return num == null ? def : num.longValue(); } catch (ClassCastException ex) @@ -292,7 +293,7 @@ public class EssentialsConf extends Configuration { try { - Number num = (Number)getProperty(path); + Number num = (Number)get(path); return num == null ? def : num.doubleValue(); } catch (ClassCastException ex) @@ -300,4 +301,27 @@ public class EssentialsConf extends Configuration return def; } } + + public void save() { + try + { + save(configFile); + } + catch (IOException ex) + { + LOGGER.log(Level.SEVERE, null, ex); + } + } + + public Object getProperty(String path) { + return get(path); + } + + public void setProperty(String path, Object object) { + set(path, object); + } + + public void removeProperty(String path) { + set(path, null); + } } diff --git a/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java b/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java index ae444af2e..26e6f25bc 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java @@ -95,7 +95,7 @@ public class EssentialsUpgrade } final EssentialsConf conf = new EssentialsConf(configFile); conf.load(); - List<String> lines = conf.getStringList(name, null); + List<String> lines = conf.getStringList(name); if (lines != null && !lines.isEmpty()) { if (!file.createNewFile()) @@ -332,7 +332,7 @@ public class EssentialsUpgrade config.setProperty("homes.home", defloc); } - List<String> worlds = config.getKeys("home.worlds"); + Set<String> worlds = config.getConfigurationSection("home.worlds").getKeys(false); Location loc; String worldName; @@ -381,7 +381,7 @@ public class EssentialsUpgrade } final EssentialsConf usersConfig = new EssentialsConf(usersFile); usersConfig.load(); - for (String username : usersConfig.getKeys(null)) + for (String username : usersConfig.getKeys(false)) { final User user = new User(new OfflinePlayer(username, ess), ess); final String nickname = usersConfig.getString(username + ".nickname"); @@ -389,7 +389,7 @@ public class EssentialsUpgrade { user.setNickname(nickname); } - final List<String> mails = usersConfig.getStringList(username + ".mail", null); + final List<String> mails = usersConfig.getStringList(username + ".mail"); if (mails != null && !mails.isEmpty()) { user.setMails(mails); @@ -701,7 +701,7 @@ public class EssentialsUpgrade if (!config.hasProperty("spawns")) { final Spawns spawns = new Spawns(); - List<String> keys = config.getKeys(); + Set<String> keys = config.getKeys(false); for (String group : keys) { Location loc = getFakeLocation(config, group); @@ -748,7 +748,7 @@ public class EssentialsUpgrade if (!config.hasProperty("jails")) { final com.earth2me.essentials.settings.Jails jails = new com.earth2me.essentials.settings.Jails(); - List<String> keys = config.getKeys(); + Set<String> keys = config.getKeys(false); for (String jailName : keys) { Location loc = getFakeLocation(config, jailName); diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index c29cc5b1a..b7a128ebc 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -65,7 +65,7 @@ public interface ISettings extends IConf boolean getRespawnAtHome(); - List getMultipleHomes(); + Set getMultipleHomes(); int getHomeLimit(String set); diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java index 18fc60cbc..440d3fad3 100644 --- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java +++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java @@ -667,18 +667,6 @@ public class OfflinePlayer implements Player } @Override - public int getExperience() - { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void setExperience(int i) - { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override public int getLevel() { throw new UnsupportedOperationException("Not supported yet."); diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index 592b80694..218a9163c 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -45,15 +45,15 @@ public class Settings implements ISettings } @Override - public List<String> getMultipleHomes() + public Set<String> getMultipleHomes() { - return config.getKeys("sethome-multiple"); + return config.getConfigurationSection("sethome-multiple").getKeys(false); } @Override public int getHomeLimit(final User user) { - final List<String> homeList = getMultipleHomes(); + final Set<String> homeList = getMultipleHomes(); if (homeList == null) { //TODO: Replace this code to remove backwards compat, after settings are automatically updated @@ -116,7 +116,7 @@ public class Settings implements ISettings @Override public boolean isCommandDisabled(String label) { - for (String c : config.getStringList("disabled-commands", new ArrayList<String>(0))) + for (String c : config.getStringList("disabled-commands")) { if (!c.equalsIgnoreCase(label)) { @@ -136,7 +136,7 @@ public class Settings implements ISettings @Override public boolean isCommandRestricted(String label) { - for (String c : config.getStringList("restricted-commands", new ArrayList<String>(0))) + for (String c : config.getStringList("restricted-commands")) { if (!c.equalsIgnoreCase(label)) { @@ -150,7 +150,7 @@ public class Settings implements ISettings @Override public boolean isPlayerCommand(String label) { - for (String c : config.getStringList("player-commands", new ArrayList<String>(0))) + for (String c : config.getStringList("player-commands")) { if (!c.equalsIgnoreCase(label)) { @@ -164,9 +164,7 @@ public class Settings implements ISettings @Override public boolean isCommandOverridden(String name) { - List<String> defaultList = new ArrayList<String>(1); - defaultList.add("god"); - for (String c : config.getStringList("overridden-commands", defaultList)) + for (String c : config.getStringList("overridden-commands")) { if (!c.equalsIgnoreCase(name)) { @@ -215,7 +213,7 @@ public class Settings implements ISettings @Override public Object getKit(String name) { - Map<String, Object> kits = (Map<String, Object>)config.getProperty("kits"); + Map<String, Object> kits = (Map<String, Object>)config.get("kits"); for (Map.Entry<String, Object> entry : kits.entrySet()) { if (entry.getKey().equalsIgnoreCase(name.replace('.', '_').replace('/', '_'))) @@ -229,7 +227,7 @@ public class Settings implements ISettings @Override public Map<String, Object> getKits() { - return (Map<String, Object>)config.getProperty("kits"); + return (Map<String, Object>)config.get("kits"); } @Override @@ -254,7 +252,7 @@ public class Settings implements ISettings { } - return ChatColor.getByCode(Integer.parseInt(colorName, 16)); + return ChatColor.getByChar(colorName); } @Override @@ -355,7 +353,7 @@ public class Settings implements ISettings public void reloadConfig() { config.load(); - noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds", Collections.<String>emptyList())); + noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds")); enabledSigns = getEnabledSigns(); itemSpawnBl = getItemSpawnBlacklist(); chatFormats.clear(); @@ -407,7 +405,7 @@ public class Settings implements ISettings { List<EssentialsSign> newSigns = new ArrayList<EssentialsSign>(); - for (String signName : config.getStringList("enabledSigns", null)) + for (String signName : config.getStringList("enabledSigns")) { signName = signName.trim().toUpperCase(Locale.ENGLISH); if (signName.isEmpty()) diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java index e2a365ad2..44ac096b9 100644 --- a/Essentials/src/com/earth2me/essentials/UserData.java +++ b/Essentials/src/com/earth2me/essentials/UserData.java @@ -209,7 +209,7 @@ public abstract class UserData extends PlayerExtension implements IConf private List<Integer> _getUnlimited() { - return config.getIntList("unlimited", new ArrayList<Integer>()); + return config.getIntegerList("unlimited"); } public List<Integer> getUnlimited() @@ -383,7 +383,7 @@ public abstract class UserData extends PlayerExtension implements IConf private List<String> _getMails() { - return config.getStringList("mail", new ArrayList<String>()); + return config.getStringList("mail"); } public List<String> getMails() @@ -491,7 +491,7 @@ public abstract class UserData extends PlayerExtension implements IConf public List<String> getIgnoredPlayers() { - return config.getStringList("ignore", new ArrayList<String>()); + return config.getStringList("ignore"); } public void setIgnoredPlayers(List<String> players) diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java index 3fbb7874c..0ea06e72b 100644 --- a/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java @@ -232,12 +232,6 @@ public class FakeWorld implements World } @Override - public long getId() - { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override public Location getSpawnLocation() { throw new UnsupportedOperationException("Not supported yet."); @@ -578,4 +572,16 @@ public class FakeWorld implements World { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public <T extends Entity> Collection<T> getEntitiesByClass(Class<T> type) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Collection<Entity> getEntitiesByClasses(Class<?>... types) + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java b/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java index d9e28becc..a0446179f 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java @@ -6,7 +6,7 @@ import org.bukkit.block.Block; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.entity.EndermanPickupEvent; +import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityExplodeEvent; @@ -44,7 +44,7 @@ public class SignEntityListener implements Listener } @EventHandler(priority = EventPriority.LOW) - public void onEndermanPickup(final EndermanPickupEvent event) + public void onEntityChangeBlock(final EntityChangeBlockEvent event) { if (event.isCancelled() || ess.getSettings().areSignsDisabled()) { diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java index 14f81b605..a7335a957 100644 --- a/Essentials/test/com/earth2me/essentials/FakeServer.java +++ b/Essentials/test/com/earth2me/essentials/FakeServer.java @@ -14,6 +14,7 @@ import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.PluginCommand; import org.bukkit.entity.Player; import org.bukkit.generator.ChunkGenerator; +import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.Recipe; import org.bukkit.map.MapView; import org.bukkit.plugin.Plugin; @@ -250,7 +251,6 @@ public class FakeServer implements Server return worlds; } - @Override public World createWorld(String string, Environment e) { World w = new FakeWorld(string, e); @@ -258,7 +258,6 @@ public class FakeServer implements Server return w; } - @Override public World createWorld(String string, Environment e, long l) { World w = new FakeWorld(string, e); @@ -332,18 +331,6 @@ public class FakeServer implements Server } @Override - public World createWorld(String string, Environment e, ChunkGenerator cg) - { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public World createWorld(String string, Environment e, long l, ChunkGenerator cg) - { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override public World createWorld(WorldCreator creator) { throw new UnsupportedOperationException("Not supported yet."); @@ -666,4 +653,28 @@ public class FakeServer implements Server { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public List<Recipe> getRecipesFor(ItemStack is) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Iterator<Recipe> recipeIterator() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void clearRecipes() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void resetRecipes() + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java index 8115b1a75..e766b6c78 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java @@ -856,7 +856,7 @@ public class WorldDataHolder { PluginManager pm = server.getPluginManager(); Plugin[] plugins = pm.getPlugins(); for (int i = 0; i < plugins.length; i++) { - plugins[i].getConfiguration().load(); + //plugins[i].getConfiguration().load(); try { plugins[i].getClass().getMethod("setupPermissions").invoke(plugins[i]); } catch (Exception ex) { diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java index fdb740646..f109cf4f7 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java @@ -37,7 +37,7 @@ public class GMGroupEvent extends Event { protected Action action;
public GMGroupEvent(Group group, Action action) {
- super(action.toString());
+ super();
this.group = group;
this.action = action;
@@ -45,7 +45,7 @@ public class GMGroupEvent extends Event { }
public GMGroupEvent(String groupName, Action action) {
- super(action.toString());
+ super();
this.groupName = groupName;
this.action = action;
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java index 1ff605d5c..6f4c0ea08 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java @@ -32,7 +32,7 @@ public class GMSystemEvent extends Event { protected Action action;
public GMSystemEvent(Action action) {
- super(action.toString());
+ super();
this.action = action;
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java index d40a7d63e..543580f41 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java @@ -37,7 +37,7 @@ public class GMUserEvent extends Event { protected Action action;
public GMUserEvent(User user, Action action) {
- super(action.toString());
+ super();
this.user = user;
this.action = action;
@@ -45,7 +45,7 @@ public class GMUserEvent extends Event { }
public GMUserEvent(String userName, Action action) {
- super(action.toString());
+ super();
this.userName = userName;
this.action = action;
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyBlockListener.java deleted file mode 100644 index 7ff17b381..000000000 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyBlockListener.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.earth2me.essentials.protect; - -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockBurnEvent; -import org.bukkit.event.block.BlockFromToEvent; -import org.bukkit.event.block.BlockIgniteEvent; -import org.bukkit.event.block.BlockListener; - -@Deprecated -public class EmergencyBlockListener extends BlockListener -{ - - @Override - public void onBlockBurn(final BlockBurnEvent event) - { - event.setCancelled(true); - } - - @Override - public void onBlockIgnite(final BlockIgniteEvent event) - { - event.setCancelled(true); - } - - @Override - public void onBlockFromTo(final BlockFromToEvent event) - { - event.setCancelled(true); - } - - @Override - public void onBlockBreak(final BlockBreakEvent event) - { - event.setCancelled(true); - } -} diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyEntityListener.java deleted file mode 100644 index 08b04aae1..000000000 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyEntityListener.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.earth2me.essentials.protect; - -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.entity.EntityListener; - -@Deprecated -public class EmergencyEntityListener extends EntityListener -{ - - @Override - public void onEntityExplode(final EntityExplodeEvent event) - { - event.setCancelled(true); - } - - @Override - public void onEntityDamage(final EntityDamageEvent event) - { - event.setCancelled(true); - } -} diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyPlayerListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyPlayerListener.java deleted file mode 100644 index 169e9af79..000000000 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyPlayerListener.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.earth2me.essentials.protect; - -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerListener; - -@Deprecated -public class EmergencyPlayerListener extends PlayerListener -{ - - @Override - public void onPlayerJoin(PlayerJoinEvent event) - { - event.getPlayer().sendMessage("Essentials Protect is in emergency mode. Check your log for errors."); - } - -} diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java index af80647a6..9c257662d 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java @@ -9,8 +9,6 @@ import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.Logger; import org.bukkit.entity.Player; -import org.bukkit.event.Event.Priority; -import org.bukkit.event.Event.Type; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; @@ -65,21 +63,8 @@ public class EssentialsProtect extends JavaPlugin implements IProtect private void enableEmergencyMode(final PluginManager pm) { - //final EmergencyListener emListener = new EmergencyListener(); - //pm.registerEvents(emListener, this); - - //TODO: Remove deprecated listners in a few weeks. - - final EmergencyBlockListener emBlockListener = new EmergencyBlockListener(); - final EmergencyEntityListener emEntityListener = new EmergencyEntityListener(); - final EmergencyPlayerListener emPlayerListener = new EmergencyPlayerListener(); - pm.registerEvent(Type.PLAYER_JOIN, emPlayerListener, Priority.Low, this); - pm.registerEvent(Type.BLOCK_BURN, emBlockListener, Priority.Low, this); - pm.registerEvent(Type.BLOCK_IGNITE, emBlockListener, Priority.Low, this); - pm.registerEvent(Type.BLOCK_FROMTO, emBlockListener, Priority.Low, this); - pm.registerEvent(Type.BLOCK_BREAK, emBlockListener, Priority.Low, this); - pm.registerEvent(Type.ENTITY_DAMAGE, emEntityListener, Priority.Low, this); - pm.registerEvent(Type.ENTITY_EXPLODE, emEntityListener, Priority.Low, this); + final EmergencyListener emListener = new EmergencyListener(); + pm.registerEvents(emListener, this); for (Player player : getServer().getOnlinePlayers()) { diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java index 40167ec41..57302517f 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java @@ -328,7 +328,7 @@ public class EssentialsProtectEntityListener implements Listener } @EventHandler(priority = EventPriority.HIGHEST) - public void onEndermanPickup(EndermanPickupEvent event) + public void onEntityChangeBlock(EntityChangeBlockEvent event) { if (event.isCancelled()) { diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java index 930a31bda..02b35c3d6 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java +++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java @@ -7,6 +7,6 @@ public class InstallationFinishedEvent extends Event { public InstallationFinishedEvent() { - super(Type.CUSTOM_EVENT); + super(); } } diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java index 85ef50949..a35312129 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java @@ -36,7 +36,7 @@ public class UserManager implements IConf public final String getUserByAddress(final String search) { - final List<String> usernames = users.getKeys(null); + final Set<String> usernames = users.getKeys(false); for (String username : usernames) { final String address = users.getString(username + "." + ADDRESS, null); @@ -73,7 +73,7 @@ public class UserManager implements IConf { users.load(); spyusers.clear(); - final List<String> keys = users.getKeys(null); + final Set<String> keys = users.getKeys(false); for (String key : keys) { if (isSpy(key)) diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java index 72bdb113d..bb44d3127 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java @@ -183,7 +183,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager if (config.getBoolean("log-enabled", false)) { LOGGER.addHandler(this); - logUsers = config.getStringList("log-users", new ArrayList<String>()); + logUsers = config.getStringList("log-users"); final String level = config.getString("log-level", "info"); try { @@ -351,7 +351,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager private void sendCommand(final Chat chat, final String message) { - if (config.getStringList("op-users", new ArrayList<String>()).contains(StringUtils.parseBareAddress(chat.getParticipant()))) + if (config.getStringList("op-users").contains(StringUtils.parseBareAddress(chat.getParticipant()))) { try { |