From 06f54fdbac1874c549b5181d92b4a9474da55dcc Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 27 Jun 2012 20:27:27 +1000 Subject: That just leaves the big ol' core. Largely ignore Compat as it is very temporary. --- .../src/com/earth2me/essentials/Essentials.java | 8 +- .../com/earth2me/essentials/EssentialsUpgrade.java | 105 ++++++++++----------- .../src/com/earth2me/essentials/api/Economy.java | 27 ++++-- .../earth2me/essentials/chat/ChatPermissions.java | 6 +- .../com/earth2me/essentials/chat/ChatStore.java | 2 +- .../earth2me/essentials/chat/EssentialsChat.java | 5 - .../essentials/chat/EssentialsChatPlayer.java | 2 +- .../essentials/chat/EssentialsLocalChatEvent.java | 3 +- .../chat/EssentialsLocalChatEventListener.java | 3 - .../earth2me/essentials/geoip/ConfigHolder.java | 4 +- .../earth2me/essentials/geoip/EssentialsGeoIP.java | 12 +-- 11 files changed, 83 insertions(+), 94 deletions(-) diff --git a/Essentials2Compat/src/com/earth2me/essentials/Essentials.java b/Essentials2Compat/src/com/earth2me/essentials/Essentials.java index dc612e8d6..840ef7d37 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/Essentials.java +++ b/Essentials2Compat/src/com/earth2me/essentials/Essentials.java @@ -9,14 +9,8 @@ public class Essentials extends JavaPlugin @Override public void onEnable() { - Bukkit.getLogger().info("You can remove this compatibility plugin, when all plugins are updated to Essentials 3"); + Bukkit.getLogger().info("You can remove this compatibility plugin, when all plugins are updated to Essentials-3"); //TODO: Update files to new 3.0 format //TODO: Move Eco Api here } - - @Override - public void onDisable() - { - throw new UnsupportedOperationException("Not supported yet."); - } } diff --git a/Essentials2Compat/src/com/earth2me/essentials/EssentialsUpgrade.java b/Essentials2Compat/src/com/earth2me/essentials/EssentialsUpgrade.java index 865af41e3..d912caf7e 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/EssentialsUpgrade.java +++ b/Essentials2Compat/src/com/earth2me/essentials/EssentialsUpgrade.java @@ -386,7 +386,6 @@ public class EssentialsUpgrade * ((Number)vals.get(4)).floatValue())); } } } } usersFile.renameTo(new File(usersFile.getAbsolutePath() + ".old")); * } */ - private void convertWarps() { final File warpsFolder = new File(ess.getDataFolder(), "warps"); @@ -461,56 +460,56 @@ public class EssentialsUpgrade } /*final File warpFile = new File(ess.getDataFolder(), "warps.txt"); - if (warpFile.exists()) - { - try - { - final BufferedReader rx = new BufferedReader(new FileReader(warpFile)); - try - { - for (String[] parts = new String[0]; rx.ready(); parts = rx.readLine().split(":")) - { - if (parts.length < 6) - { - continue; - } - final String name = parts[0]; - final double x = Double.parseDouble(parts[1].trim()); - final double y = Double.parseDouble(parts[2].trim()); - final double z = Double.parseDouble(parts[3].trim()); - final float yaw = Float.parseFloat(parts[4].trim()); - final float pitch = Float.parseFloat(parts[5].trim()); - if (name.isEmpty()) - { - continue; - } - World w = null; - for (World world : ess.getServer().getWorlds()) - { - if (world.getEnvironment() != World.Environment.NETHER) - { - w = world; - break; - } - } - final Location loc = new Location(name, x, y, z, yaw, pitch); - ess.getWarps().setWarp(name, loc); - if (!warpFile.renameTo(new File(ess.getDataFolder(), "warps.txt.old"))) - { - throw new Exception(_("fileRenameError", "warps.txt")); - } - } - } - finally - { - rx.close(); - } - } - catch (Exception ex) - { - LOGGER.log(Level.SEVERE, null, ex); - } - }*/ + if (warpFile.exists()) + { + try + { + final BufferedReader rx = new BufferedReader(new FileReader(warpFile)); + try + { + for (String[] parts = new String[0]; rx.ready(); parts = rx.readLine().split(":")) + { + if (parts.length < 6) + { + continue; + } + final String name = parts[0]; + final double x = Double.parseDouble(parts[1].trim()); + final double y = Double.parseDouble(parts[2].trim()); + final double z = Double.parseDouble(parts[3].trim()); + final float yaw = Float.parseFloat(parts[4].trim()); + final float pitch = Float.parseFloat(parts[5].trim()); + if (name.isEmpty()) + { + continue; + } + World w = null; + for (World world : ess.getServer().getWorlds()) + { + if (world.getEnvironment() != World.Environment.NETHER) + { + w = world; + break; + } + } + final Location loc = new Location(name, x, y, z, yaw, pitch); + ess.getWarps().setWarp(name, loc); + if (!warpFile.renameTo(new File(ess.getDataFolder(), "warps.txt.old"))) + { + throw new Exception(_("fileRenameError", "warps.txt")); + } + } + } + finally + { + rx.close(); + } + } + catch (Exception ex) + { + LOGGER.log(Level.SEVERE, null, ex); + } + }*/ } /* @@ -532,7 +531,7 @@ public class EssentialsUpgrade * ess.getDataFolder().getParentFile().getParentFile(); final File worldDirectory = new File(bukkitDirectory, name); * if (worldDirectory.exists() && worldDirectory.isDirectory()) { return new FakeWorld(worldDirectory.getName(), * World.Environment.NORMAL); } return null; - } + } */ public Location getFakeLocation(EssentialsConf config, String path) { @@ -697,7 +696,7 @@ public class EssentialsUpgrade return; } //todo - metrics - // ess.getSettings().setMetricsEnabled(false); + // ess.getSettings().setMetricsEnabled(false); doneFile.setProperty("warnMetrics", true); doneFile.save(); } diff --git a/Essentials2Compat/src/com/earth2me/essentials/api/Economy.java b/Essentials2Compat/src/com/earth2me/essentials/api/Economy.java index cf8cb640c..663c451c6 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/api/Economy.java +++ b/Essentials2Compat/src/com/earth2me/essentials/api/Economy.java @@ -4,8 +4,7 @@ import com.earth2me.essentials.utils.Util; /** - * Instead of using this api directly, we recommend to use the register plugin: - * http://bit.ly/RegisterMethod + * Instead of using this api directly, we recommend to use the register plugin: http://bit.ly/RegisterMethod */ public final class Economy { @@ -17,9 +16,10 @@ public final class Economy /** * Returns the balance of a user + * * @param name Name of the user * @return balance - * @throws UserDoesNotExistException + * @throws UserDoesNotExistException */ public static double getMoney(String name) throws UserDoesNotExistException { @@ -32,6 +32,7 @@ public final class Economy /** * Sets the balance of a user + * * @param name Name of the user * @param balance The balance you want to set * @throws UserDoesNotExistException If a user by that name does not exists @@ -48,6 +49,7 @@ public final class Economy /** * Adds money to the balance of a user + * * @param name Name of the user * @param amount The money you want to add * @throws UserDoesNotExistException If a user by that name does not exists @@ -61,6 +63,7 @@ public final class Economy /** * Substracts money from the balance of a user + * * @param name Name of the user * @param amount The money you want to substract * @throws UserDoesNotExistException If a user by that name does not exists @@ -74,6 +77,7 @@ public final class Economy /** * Divides the balance of a user by a value + * * @param name Name of the user * @param value The balance is divided by this value * @throws UserDoesNotExistException If a user by that name does not exists @@ -87,6 +91,7 @@ public final class Economy /** * Multiplies the balance of a user by a value + * * @param name Name of the user * @param value The balance is multiplied by this value * @throws UserDoesNotExistException If a user by that name does not exists @@ -100,6 +105,7 @@ public final class Economy /** * Resets the balance of a user to the starting balance + * * @param name Name of the user * @throws UserDoesNotExistException If a user by that name does not exists * @throws NoLoanPermittedException If the user is not allowed to have a negative balance @@ -148,6 +154,7 @@ public final class Economy /** * Test if the user has a negative balance + * * @param name Name of the user * @return true, if the user has a negative balance * @throws UserDoesNotExistException If a user by that name does not exists @@ -158,8 +165,8 @@ public final class Economy } /** - * Formats the amount of money like all other Essentials functions. - * Example: $100000 or $12345.67 + * Formats the amount of money like all other Essentials functions. Example: $100000 or $12345.67 + * * @param amount The amount of money * @return Formatted money */ @@ -174,6 +181,7 @@ public final class Economy /** * Test if a player exists to avoid the UserDoesNotExistException + * * @param name Name of the user * @return true, if the user exists */ @@ -188,9 +196,10 @@ public final class Economy /** * Test if a player is a npc + * * @param name Name of the player * @return true, if it's a npc - * @throws UserDoesNotExistException + * @throws UserDoesNotExistException */ public static boolean isNPC(String name) throws UserDoesNotExistException { @@ -203,6 +212,7 @@ public final class Economy /** * Creates dummy files for a npc, if there is no player yet with that name. + * * @param name Name of the player * @return true, if a new npc was created */ @@ -216,9 +226,10 @@ public final class Economy } /** - * Deletes a user, if it is marked as npc. + * Deletes a user, if it is marked as npc. + * * @param name Name of the player - * @throws UserDoesNotExistException + * @throws UserDoesNotExistException */ public static void removeNPC(String name) throws UserDoesNotExistException { diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/ChatPermissions.java b/EssentialsChat/src/com/earth2me/essentials/chat/ChatPermissions.java index 9a8bd9e88..43142915f 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/ChatPermissions.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/ChatPermissions.java @@ -6,7 +6,9 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; -public class ChatPermissions { + +public class ChatPermissions +{ private static Map permissions = new HashMap(); public static IPermission getPermission(final String groupName) @@ -14,7 +16,7 @@ public class ChatPermissions { IPermission perm = permissions.get(groupName); if (perm == null) { - perm = new BasePermission("essentials.chat.",groupName.toLowerCase(Locale.ENGLISH)); + perm = new BasePermission("essentials.chat.", groupName.toLowerCase(Locale.ENGLISH)); permissions.put(groupName, perm); } return perm; diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/ChatStore.java b/EssentialsChat/src/com/earth2me/essentials/chat/ChatStore.java index 887ac8337..f01ada07b 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/ChatStore.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/ChatStore.java @@ -1,8 +1,8 @@ package com.earth2me.essentials.chat; -import com.earth2me.essentials.economy.Trade; import com.earth2me.essentials.api.IEssentials; import com.earth2me.essentials.api.IUser; +import com.earth2me.essentials.economy.Trade; public class ChatStore diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java index a4d4283a7..1ff0d6f41 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java @@ -45,9 +45,4 @@ public class EssentialsChat extends JavaPlugin final EssentialsLocalChatEventListener localChatListener = new EssentialsLocalChatEventListener(getServer(), ess); pluginManager.registerEvents(localChatListener, this); } - - @Override - public void onDisable() - { - } } diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java index d0ae47d31..fcd9d7e01 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java @@ -111,7 +111,7 @@ public abstract class EssentialsChatPlayer implements Listener protected void handleLocalChat(final PlayerChatEvent event, final ChatStore chatStore) { - + long radius = 0; ISettings settings = ess.getSettings(); settings.acquireReadLock(); diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsLocalChatEvent.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsLocalChatEvent.java index 2eae385a9..4ca1a4496 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsLocalChatEvent.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsLocalChatEvent.java @@ -98,6 +98,7 @@ public class EssentialsLocalChatEvent extends Event implements Cancellable return parentEvent; } + @Override public HandlerList getHandlers() { return handlers; @@ -107,4 +108,4 @@ public class EssentialsLocalChatEvent extends Event implements Cancellable { return handlers; } -} \ No newline at end of file +} diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsLocalChatEventListener.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsLocalChatEventListener.java index 04c49b698..db596b15f 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsLocalChatEventListener.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsLocalChatEventListener.java @@ -3,8 +3,6 @@ package com.earth2me.essentials.chat; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.api.IEssentials; import com.earth2me.essentials.api.IUser; -import com.earth2me.essentials.permissions.Permissions; -import java.util.logging.Logger; import org.bukkit.Location; import org.bukkit.Server; import org.bukkit.World; @@ -18,7 +16,6 @@ public class EssentialsLocalChatEventListener implements Listener { protected transient IEssentials ess; protected final transient Server server; - private static final Logger LOGGER = Logger.getLogger("Minecraft"); public EssentialsLocalChatEventListener(final Server server, final IEssentials ess) { diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/ConfigHolder.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/ConfigHolder.java index bf45e54c6..183c591ab 100644 --- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/ConfigHolder.java +++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/ConfigHolder.java @@ -7,6 +7,7 @@ import java.io.File; import java.io.IOException; import org.bukkit.plugin.Plugin; + public class ConfigHolder extends AsyncStorageObjectHolder { private final transient Plugin geoip; @@ -27,13 +28,10 @@ public class ConfigHolder extends AsyncStorageObjectHolder @Override public void finishRead() { - } @Override public void finishWrite() { - } - } diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java index b6697a658..43b4959da 100644 --- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java +++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java @@ -9,15 +9,6 @@ import org.bukkit.plugin.java.JavaPlugin; public class EssentialsGeoIP extends JavaPlugin { - public EssentialsGeoIP() - { - } - - @Override - public void onDisable() - { - } - @Override public void onEnable() { @@ -27,7 +18,8 @@ public class EssentialsGeoIP extends JavaPlugin { getLogger().log(Level.WARNING, _("versionMismatchAll")); } - if (!ess.isEnabled()) { + if (!ess.isEnabled()) + { this.setEnabled(false); return; } -- cgit v1.2.3