1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-12 17:45:08 +02:00

That just leaves the big ol' core. Largely ignore Compat as it is very temporary.

This commit is contained in:
md_5
2012-06-27 20:27:27 +10:00
parent 4561a7f010
commit 06f54fdbac
11 changed files with 83 additions and 94 deletions

View File

@@ -9,14 +9,8 @@ public class Essentials extends JavaPlugin
@Override @Override
public void onEnable() 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: Update files to new 3.0 format
//TODO: Move Eco Api here //TODO: Move Eco Api here
} }
@Override
public void onDisable()
{
throw new UnsupportedOperationException("Not supported yet.");
}
} }

View File

@@ -386,7 +386,6 @@ public class EssentialsUpgrade
* ((Number)vals.get(4)).floatValue())); } } } } usersFile.renameTo(new File(usersFile.getAbsolutePath() + ".old")); * ((Number)vals.get(4)).floatValue())); } } } } usersFile.renameTo(new File(usersFile.getAbsolutePath() + ".old"));
* } * }
*/ */
private void convertWarps() private void convertWarps()
{ {
final File warpsFolder = new File(ess.getDataFolder(), "warps"); final File warpsFolder = new File(ess.getDataFolder(), "warps");
@@ -461,56 +460,56 @@ public class EssentialsUpgrade
} }
/*final File warpFile = new File(ess.getDataFolder(), "warps.txt"); /*final File warpFile = new File(ess.getDataFolder(), "warps.txt");
if (warpFile.exists()) if (warpFile.exists())
{ {
try try
{ {
final BufferedReader rx = new BufferedReader(new FileReader(warpFile)); final BufferedReader rx = new BufferedReader(new FileReader(warpFile));
try try
{ {
for (String[] parts = new String[0]; rx.ready(); parts = rx.readLine().split(":")) for (String[] parts = new String[0]; rx.ready(); parts = rx.readLine().split(":"))
{ {
if (parts.length < 6) if (parts.length < 6)
{ {
continue; continue;
} }
final String name = parts[0]; final String name = parts[0];
final double x = Double.parseDouble(parts[1].trim()); final double x = Double.parseDouble(parts[1].trim());
final double y = Double.parseDouble(parts[2].trim()); final double y = Double.parseDouble(parts[2].trim());
final double z = Double.parseDouble(parts[3].trim()); final double z = Double.parseDouble(parts[3].trim());
final float yaw = Float.parseFloat(parts[4].trim()); final float yaw = Float.parseFloat(parts[4].trim());
final float pitch = Float.parseFloat(parts[5].trim()); final float pitch = Float.parseFloat(parts[5].trim());
if (name.isEmpty()) if (name.isEmpty())
{ {
continue; continue;
} }
World w = null; World w = null;
for (World world : ess.getServer().getWorlds()) for (World world : ess.getServer().getWorlds())
{ {
if (world.getEnvironment() != World.Environment.NETHER) if (world.getEnvironment() != World.Environment.NETHER)
{ {
w = world; w = world;
break; break;
} }
} }
final Location loc = new Location(name, x, y, z, yaw, pitch); final Location loc = new Location(name, x, y, z, yaw, pitch);
ess.getWarps().setWarp(name, loc); ess.getWarps().setWarp(name, loc);
if (!warpFile.renameTo(new File(ess.getDataFolder(), "warps.txt.old"))) if (!warpFile.renameTo(new File(ess.getDataFolder(), "warps.txt.old")))
{ {
throw new Exception(_("fileRenameError", "warps.txt")); throw new Exception(_("fileRenameError", "warps.txt"));
} }
} }
} }
finally finally
{ {
rx.close(); rx.close();
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.log(Level.SEVERE, null, 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); * ess.getDataFolder().getParentFile().getParentFile(); final File worldDirectory = new File(bukkitDirectory, name);
* if (worldDirectory.exists() && worldDirectory.isDirectory()) { return new FakeWorld(worldDirectory.getName(), * if (worldDirectory.exists() && worldDirectory.isDirectory()) { return new FakeWorld(worldDirectory.getName(),
* World.Environment.NORMAL); } return null; * World.Environment.NORMAL); } return null;
} }
*/ */
public Location getFakeLocation(EssentialsConf config, String path) public Location getFakeLocation(EssentialsConf config, String path)
{ {
@@ -697,7 +696,7 @@ public class EssentialsUpgrade
return; return;
} }
//todo - metrics //todo - metrics
// ess.getSettings().setMetricsEnabled(false); // ess.getSettings().setMetricsEnabled(false);
doneFile.setProperty("warnMetrics", true); doneFile.setProperty("warnMetrics", true);
doneFile.save(); doneFile.save();
} }

View File

@@ -4,8 +4,7 @@ import com.earth2me.essentials.utils.Util;
/** /**
* Instead of using this api directly, we recommend to use the register plugin: * Instead of using this api directly, we recommend to use the register plugin: http://bit.ly/RegisterMethod
* http://bit.ly/RegisterMethod
*/ */
public final class Economy public final class Economy
{ {
@@ -17,9 +16,10 @@ public final class Economy
/** /**
* Returns the balance of a user * Returns the balance of a user
*
* @param name Name of the user * @param name Name of the user
* @return balance * @return balance
* @throws UserDoesNotExistException * @throws UserDoesNotExistException
*/ */
public static double getMoney(String name) throws UserDoesNotExistException public static double getMoney(String name) throws UserDoesNotExistException
{ {
@@ -32,6 +32,7 @@ public final class Economy
/** /**
* Sets the balance of a user * Sets the balance of a user
*
* @param name Name of the user * @param name Name of the user
* @param balance The balance you want to set * @param balance The balance you want to set
* @throws UserDoesNotExistException If a user by that name does not exists * @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 * Adds money to the balance of a user
*
* @param name Name of the user * @param name Name of the user
* @param amount The money you want to add * @param amount The money you want to add
* @throws UserDoesNotExistException If a user by that name does not exists * @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 * Substracts money from the balance of a user
*
* @param name Name of the user * @param name Name of the user
* @param amount The money you want to substract * @param amount The money you want to substract
* @throws UserDoesNotExistException If a user by that name does not exists * @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 * Divides the balance of a user by a value
*
* @param name Name of the user * @param name Name of the user
* @param value The balance is divided by this value * @param value The balance is divided by this value
* @throws UserDoesNotExistException If a user by that name does not exists * @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 * Multiplies the balance of a user by a value
*
* @param name Name of the user * @param name Name of the user
* @param value The balance is multiplied by this value * @param value The balance is multiplied by this value
* @throws UserDoesNotExistException If a user by that name does not exists * @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 * Resets the balance of a user to the starting balance
*
* @param name Name of the user * @param name Name of the user
* @throws UserDoesNotExistException If a user by that name does not exists * @throws UserDoesNotExistException If a user by that name does not exists
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance * @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 * Test if the user has a negative balance
*
* @param name Name of the user * @param name Name of the user
* @return true, if the user has a negative balance * @return true, if the user has a negative balance
* @throws UserDoesNotExistException If a user by that name does not exists * @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. * Formats the amount of money like all other Essentials functions. Example: $100000 or $12345.67
* Example: $100000 or $12345.67 *
* @param amount The amount of money * @param amount The amount of money
* @return Formatted money * @return Formatted money
*/ */
@@ -174,6 +181,7 @@ public final class Economy
/** /**
* Test if a player exists to avoid the UserDoesNotExistException * Test if a player exists to avoid the UserDoesNotExistException
*
* @param name Name of the user * @param name Name of the user
* @return true, if the user exists * @return true, if the user exists
*/ */
@@ -188,9 +196,10 @@ public final class Economy
/** /**
* Test if a player is a npc * Test if a player is a npc
*
* @param name Name of the player * @param name Name of the player
* @return true, if it's a npc * @return true, if it's a npc
* @throws UserDoesNotExistException * @throws UserDoesNotExistException
*/ */
public static boolean isNPC(String name) 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. * Creates dummy files for a npc, if there is no player yet with that name.
*
* @param name Name of the player * @param name Name of the player
* @return true, if a new npc was created * @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 * @param name Name of the player
* @throws UserDoesNotExistException * @throws UserDoesNotExistException
*/ */
public static void removeNPC(String name) throws UserDoesNotExistException public static void removeNPC(String name) throws UserDoesNotExistException
{ {

View File

@@ -6,7 +6,9 @@ import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
public class ChatPermissions {
public class ChatPermissions
{
private static Map<String, IPermission> permissions = new HashMap<String, IPermission>(); private static Map<String, IPermission> permissions = new HashMap<String, IPermission>();
public static IPermission getPermission(final String groupName) public static IPermission getPermission(final String groupName)
@@ -14,7 +16,7 @@ public class ChatPermissions {
IPermission perm = permissions.get(groupName); IPermission perm = permissions.get(groupName);
if (perm == null) 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); permissions.put(groupName, perm);
} }
return perm; return perm;

View File

@@ -1,8 +1,8 @@
package com.earth2me.essentials.chat; package com.earth2me.essentials.chat;
import com.earth2me.essentials.economy.Trade;
import com.earth2me.essentials.api.IEssentials; import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.api.IUser; import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.economy.Trade;
public class ChatStore public class ChatStore

View File

@@ -45,9 +45,4 @@ public class EssentialsChat extends JavaPlugin
final EssentialsLocalChatEventListener localChatListener = new EssentialsLocalChatEventListener(getServer(), ess); final EssentialsLocalChatEventListener localChatListener = new EssentialsLocalChatEventListener(getServer(), ess);
pluginManager.registerEvents(localChatListener, this); pluginManager.registerEvents(localChatListener, this);
} }
@Override
public void onDisable()
{
}
} }

View File

@@ -111,7 +111,7 @@ public abstract class EssentialsChatPlayer implements Listener
protected void handleLocalChat(final PlayerChatEvent event, final ChatStore chatStore) protected void handleLocalChat(final PlayerChatEvent event, final ChatStore chatStore)
{ {
long radius = 0; long radius = 0;
ISettings settings = ess.getSettings(); ISettings settings = ess.getSettings();
settings.acquireReadLock(); settings.acquireReadLock();

View File

@@ -98,6 +98,7 @@ public class EssentialsLocalChatEvent extends Event implements Cancellable
return parentEvent; return parentEvent;
} }
@Override
public HandlerList getHandlers() public HandlerList getHandlers()
{ {
return handlers; return handlers;
@@ -107,4 +108,4 @@ public class EssentialsLocalChatEvent extends Event implements Cancellable
{ {
return handlers; return handlers;
} }
} }

View File

@@ -3,8 +3,6 @@ package com.earth2me.essentials.chat;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.api.IEssentials; import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.api.IUser; import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.permissions.Permissions;
import java.util.logging.Logger;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.World; import org.bukkit.World;
@@ -18,7 +16,6 @@ public class EssentialsLocalChatEventListener implements Listener
{ {
protected transient IEssentials ess; protected transient IEssentials ess;
protected final transient Server server; protected final transient Server server;
private static final Logger LOGGER = Logger.getLogger("Minecraft");
public EssentialsLocalChatEventListener(final Server server, final IEssentials ess) public EssentialsLocalChatEventListener(final Server server, final IEssentials ess)
{ {

View File

@@ -7,6 +7,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
public class ConfigHolder extends AsyncStorageObjectHolder<GeoIP> public class ConfigHolder extends AsyncStorageObjectHolder<GeoIP>
{ {
private final transient Plugin geoip; private final transient Plugin geoip;
@@ -27,13 +28,10 @@ public class ConfigHolder extends AsyncStorageObjectHolder<GeoIP>
@Override @Override
public void finishRead() public void finishRead()
{ {
} }
@Override @Override
public void finishWrite() public void finishWrite()
{ {
} }
} }

View File

@@ -9,15 +9,6 @@ import org.bukkit.plugin.java.JavaPlugin;
public class EssentialsGeoIP extends JavaPlugin public class EssentialsGeoIP extends JavaPlugin
{ {
public EssentialsGeoIP()
{
}
@Override
public void onDisable()
{
}
@Override @Override
public void onEnable() public void onEnable()
{ {
@@ -27,7 +18,8 @@ public class EssentialsGeoIP extends JavaPlugin
{ {
getLogger().log(Level.WARNING, _("versionMismatchAll")); getLogger().log(Level.WARNING, _("versionMismatchAll"));
} }
if (!ess.isEnabled()) { if (!ess.isEnabled())
{
this.setEnabled(false); this.setEnabled(false);
return; return;
} }