1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-12 01:25:26 +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
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.");
}
}

View File

@@ -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();
}

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:
* 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
{