mirror of
https://github.com/essentials/Essentials.git
synced 2025-09-15 08:52:07 +02:00
Compare commits
167 Commits
stable-2.6
...
stable-2.6
Author | SHA1 | Date | |
---|---|---|---|
|
11e8240c5c | ||
|
aa922c5b67 | ||
|
1a020698d1 | ||
|
022b8caa18 | ||
|
14c406f7fb | ||
|
4d877741d4 | ||
|
1cbd10a38e | ||
|
358456c8ea | ||
|
1c7dcfc63d | ||
|
82b225a261 | ||
|
6ab30159fa | ||
|
a86a1990cd | ||
|
625c7d0302 | ||
|
27a0552c2a | ||
|
7c5674c294 | ||
|
f5c442aa5c | ||
|
569af0bcf0 | ||
|
238748f360 | ||
|
e049364557 | ||
|
121966436e | ||
|
d3afd7a670 | ||
|
9d121af860 | ||
|
200ef0c8e2 | ||
|
6f77a2ba07 | ||
|
db97ce99ef | ||
|
e7b790861f | ||
|
d3aaf3c14a | ||
|
d732821e06 | ||
|
e628c36172 | ||
|
9312871250 | ||
|
860d446d28 | ||
|
03adb56d25 | ||
|
4aecc034c2 | ||
|
1543bfd550 | ||
|
a111a07bca | ||
|
9ec398b39b | ||
|
eb71097546 | ||
|
1bb3eb0d07 | ||
|
5395b6f73a | ||
|
5851c5a88b | ||
|
1c1726cfa4 | ||
|
a6bafca091 | ||
|
6877f95636 | ||
|
cb41b7ac33 | ||
|
d2fa4523ce | ||
|
9129386f12 | ||
|
c7fcb72d6c | ||
|
02ee314ab1 | ||
|
04af8ef329 | ||
|
a34c92d55a | ||
|
4cdf803ab7 | ||
|
6012086fa5 | ||
|
67c0f57756 | ||
|
164070b487 | ||
|
d658c75cec | ||
|
4c69412501 | ||
|
75a0164ea0 | ||
|
9dde04e4b8 | ||
|
3496df6468 | ||
|
ac794bb2b7 | ||
|
7384991efa | ||
|
f3dc846b1b | ||
|
4595c15bee | ||
|
81994160e8 | ||
|
cf59a90c52 | ||
|
a9a87710f3 | ||
|
5984cd5835 | ||
|
8fe0887141 | ||
|
8389a59d54 | ||
|
010245e1a5 | ||
|
1e3d2fbfd2 | ||
|
313df9988d | ||
|
16384159e7 | ||
|
06900e19f0 | ||
|
57c25bf151 | ||
|
55fc8bdd57 | ||
|
ae030b227a | ||
|
aaf25d8b9a | ||
|
0645d58594 | ||
|
11d22f95cc | ||
|
4f85751694 | ||
|
65a78a6ea9 | ||
|
9f52931191 | ||
|
93d0ab7906 | ||
|
6b0d0daa2e | ||
|
9718e654ac | ||
|
4d5121c21d | ||
|
531f40ceee | ||
|
b672d38db8 | ||
|
401498a4f7 | ||
|
acdad5c6ac | ||
|
1a0aa7970b | ||
|
579b30c8f7 | ||
|
c1fa543524 | ||
|
0297d22fac | ||
|
608ebfdb4a | ||
|
da337284e5 | ||
|
0aa9f79629 | ||
|
9f4d79a756 | ||
|
aa0935c64b | ||
|
16111b56ad | ||
|
4c0fc6e52f | ||
|
7668af15b0 | ||
|
3b9aa445e9 | ||
|
b2614e363b | ||
|
49e2c38289 | ||
|
3030093907 | ||
|
0e867df195 | ||
|
bfd6049913 | ||
|
d2c02569d0 | ||
|
1f6daa7424 | ||
|
30af6f36ce | ||
|
f712b56671 | ||
|
0462026f33 | ||
|
ea76161ba5 | ||
|
629dee3a91 | ||
|
f415924811 | ||
|
4172c563d0 | ||
|
ab67d0e232 | ||
|
5ea512817a | ||
|
d4c7ea1cd1 | ||
|
4edf1ad3f5 | ||
|
6224b07215 | ||
|
a5239ef601 | ||
|
458068ae87 | ||
|
44e920e441 | ||
|
f8450e39e3 | ||
|
c6e68f72ea | ||
|
4a52cd7c98 | ||
|
9d68261bac | ||
|
8bb50189bc | ||
|
eb665a059a | ||
|
f2407bcc31 | ||
|
a8cfbe1eab | ||
|
03b73072d9 | ||
|
48049f3870 | ||
|
d2c553652f | ||
|
3dc29be083 | ||
|
ee00fb77d0 | ||
|
d890418944 | ||
|
8e0560ae1a | ||
|
82e5447526 | ||
|
8b23f8608d | ||
|
0dd5134f5a | ||
|
a39a904c8a | ||
|
1d38b72835 | ||
|
efcab71969 | ||
|
41e11a738d | ||
|
62e1710607 | ||
|
c681befdf2 | ||
|
2db256678e | ||
|
a2ca381bbd | ||
|
32f5a31ea5 | ||
|
87dc671a0d | ||
|
621f9b4f48 | ||
|
3858e1cdd6 | ||
|
ff7cc5aec9 | ||
|
d18a47a643 | ||
|
497a08940e | ||
|
bd8fe521cd | ||
|
59c93901d3 | ||
|
3177f25eb6 | ||
|
b0fe189156 | ||
|
8103e822ed | ||
|
c597653ce2 | ||
|
d9ceb727ef | ||
|
2844af0039 |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -32,4 +32,9 @@
|
||||
/YamlAnnotations/
|
||||
/EssentialsUpdate/nbproject/private/
|
||||
/EssentialsRelease/
|
||||
/EssentialsUpdate/
|
||||
/EssentialsUpdate/dist/
|
||||
/EssentialsUpdate/build/
|
||||
/WebPush/apikey.php
|
||||
|
||||
/WebPush/apikey.php
|
||||
/WebPush/apikey.php
|
@@ -1,6 +1,7 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.processors.list=lombok.core.AnnotationProcessor
|
||||
annotation.processing.run.all.processors=false
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
application.title=Essentials
|
||||
application.vendor=
|
||||
@@ -68,6 +69,7 @@ file.reference.iCo4.jar=../lib/iCo4.jar
|
||||
file.reference.iCo5.jar=../lib/iCo5.jar
|
||||
file.reference.iCo6.jar=../lib/iCo6.jar
|
||||
file.reference.junit-4.5.jar=..\\lib\\junit_4\\junit-4.5.jar
|
||||
file.reference.lombok-0.10.1.jar=../lib/lombok-0.10.1.jar
|
||||
file.reference.MultiCurrency.jar=../lib/MultiCurrency.jar
|
||||
file.reference.Permissions3.jar=../lib/Permissions3.jar
|
||||
file.reference.PermissionsBukkit-1.2.jar=../lib/PermissionsBukkit-1.2.jar
|
||||
@@ -86,7 +88,8 @@ javac.classpath=\
|
||||
${file.reference.BOSEconomy7.jar}:\
|
||||
${file.reference.PermissionsEx.jar}:\
|
||||
${file.reference.bPermissions.jar}:\
|
||||
${file.reference.PermissionsBukkit-1.2.jar}
|
||||
${file.reference.PermissionsBukkit-1.2.jar}:\
|
||||
${file.reference.lombok-0.10.1.jar}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
|
@@ -5,6 +5,7 @@ import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
|
||||
@@ -12,7 +13,7 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
public class Backup implements Runnable
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
private transient final CraftServer server;
|
||||
private transient final Server server;
|
||||
private transient final IEssentials ess;
|
||||
private transient boolean running = false;
|
||||
private transient int taskId = -1;
|
||||
@@ -21,7 +22,7 @@ public class Backup implements Runnable
|
||||
public Backup(final IEssentials ess)
|
||||
{
|
||||
this.ess = ess;
|
||||
server = (CraftServer)ess.getServer();
|
||||
server = ess.getServer();
|
||||
if (server.getOnlinePlayers().length > 0)
|
||||
{
|
||||
startTask();
|
||||
@@ -60,7 +61,7 @@ public class Backup implements Runnable
|
||||
return;
|
||||
}
|
||||
LOGGER.log(Level.INFO, Util.i18n("backupStarted"));
|
||||
final CommandSender cs = server.getServer().console;
|
||||
final CommandSender cs = server.getConsoleSender();
|
||||
server.dispatchCommand(cs, "save-all");
|
||||
server.dispatchCommand(cs, "save-off");
|
||||
|
||||
|
@@ -2,33 +2,35 @@ package com.earth2me.essentials;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
|
||||
public final class Console implements IReplyTo {
|
||||
|
||||
public final class Console implements IReplyTo
|
||||
{
|
||||
private static Console instance = new Console();
|
||||
private CommandSender replyTo;
|
||||
public final static String NAME = "Console";
|
||||
|
||||
private Console() {
|
||||
|
||||
}
|
||||
|
||||
public static CommandSender getCommandSender(Server server) throws Exception {
|
||||
if (! (server instanceof CraftServer)) {
|
||||
throw new Exception(Util.i18n("invalidServer"));
|
||||
}
|
||||
return ((CraftServer)server).getServer().console;
|
||||
|
||||
private Console()
|
||||
{
|
||||
}
|
||||
|
||||
public void setReplyTo(CommandSender user) {
|
||||
public static CommandSender getCommandSender(Server server) throws Exception
|
||||
{
|
||||
return server.getConsoleSender();
|
||||
}
|
||||
|
||||
public void setReplyTo(CommandSender user)
|
||||
{
|
||||
replyTo = user;
|
||||
}
|
||||
|
||||
public CommandSender getReplyTo() {
|
||||
public CommandSender getReplyTo()
|
||||
{
|
||||
return replyTo;
|
||||
}
|
||||
|
||||
public static Console getConsoleReplyTo() {
|
||||
|
||||
public static Console getConsoleReplyTo()
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
0
Essentials/src/com/earth2me/essentials/DescParseTickFormat.java
Executable file → Normal file
0
Essentials/src/com/earth2me/essentials/DescParseTickFormat.java
Executable file → Normal file
@@ -201,11 +201,6 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
pm.registerEvent(Type.PLAYER_TELEPORT, jailPlayerListener, Priority.High, this);
|
||||
pm.registerEvent(Type.PLAYER_JOIN, jailPlayerListener, Priority.High, this);
|
||||
|
||||
if (settings.isNetherEnabled() && getServer().getWorlds().size() < 2)
|
||||
{
|
||||
getServer().createWorld(settings.getNetherName(), World.Environment.NETHER);
|
||||
}
|
||||
|
||||
pm.registerEvent(Type.ENTITY_EXPLODE, tntListener, Priority.High, this);
|
||||
|
||||
final EssentialsTimer timer = new EssentialsTimer(this);
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.block.BlockListener;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
@@ -93,7 +94,7 @@ public class EssentialsBlockListener extends BlockListener
|
||||
return;
|
||||
}
|
||||
boolean unlimitedForUser = user.hasUnlimited(is);
|
||||
if (unlimitedForUser)
|
||||
if (unlimitedForUser && user.getGameMode() == GameMode.SURVIVAL)
|
||||
{
|
||||
ess.scheduleSyncDelayedTask(
|
||||
new Runnable()
|
||||
|
@@ -9,6 +9,7 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityListener;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
@@ -69,16 +70,21 @@ public class EssentialsEntityListener extends EntityListener
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDeath(EntityDeathEvent event)
|
||||
public void onEntityDeath(final EntityDeathEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Player)
|
||||
if (event instanceof PlayerDeathEvent)
|
||||
{
|
||||
User user = ess.getUser(event.getEntity());
|
||||
final PlayerDeathEvent pdevent = (PlayerDeathEvent)event;
|
||||
final User user = ess.getUser(pdevent.getEntity());
|
||||
if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back"))
|
||||
{
|
||||
user.setLastLocation();
|
||||
user.sendMessage(Util.i18n("backAfterDeath"));
|
||||
}
|
||||
if (!ess.getSettings().areDeathMessagesEnabled())
|
||||
{
|
||||
pdevent.setDeathMessage("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +93,9 @@ public class EssentialsEntityListener extends EntityListener
|
||||
{
|
||||
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
|
||||
{
|
||||
//TODO: Remove the following line, when we're happy to remove backwards compatability with 1185.
|
||||
event.setFoodLevel(20);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
import org.bukkit.event.player.PlayerAnimationType;
|
||||
import org.bukkit.event.player.PlayerBedEnterEvent;
|
||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
@@ -46,11 +47,11 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||
public void onPlayerRespawn(final PlayerRespawnEvent event)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
user.setDisplayName(user.getNick());
|
||||
user.setDisplayNick(user.getNick());
|
||||
updateCompass(user);
|
||||
if (ess.getSettings().changeDisplayName())
|
||||
{
|
||||
user.setDisplayName(user.getNick());
|
||||
user.setDisplayNick(user.getNick());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +77,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||
user.updateActivity(true);
|
||||
if (ess.getSettings().changeDisplayName())
|
||||
{
|
||||
user.setDisplayName(user.getNick());
|
||||
user.setDisplayNick(user.getNick());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,113 +108,11 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||
return;
|
||||
}
|
||||
|
||||
Location afk = user.getAfkPosition();
|
||||
if (afk == null || !event.getTo().getWorld().equals(afk.getWorld()) || afk.distanceSquared(event.getTo()) > 9) {
|
||||
final Location afk = user.getAfkPosition();
|
||||
if (afk == null || !event.getTo().getWorld().equals(afk.getWorld()) || afk.distanceSquared(event.getTo()) > 9)
|
||||
{
|
||||
user.updateActivity(true);
|
||||
}
|
||||
|
||||
if (!ess.getSettings().getNetherPortalsEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Block block = event.getPlayer().getWorld().getBlockAt(event.getTo().getBlockX(), event.getTo().getBlockY(), event.getTo().getBlockZ());
|
||||
final List<World> worlds = server.getWorlds();
|
||||
|
||||
if (block.getType() == Material.PORTAL && worlds.size() > 1 && user.isAuthorized("essentials.portal"))
|
||||
{
|
||||
if (user.getJustPortaled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
World nether = server.getWorld(ess.getSettings().getNetherName());
|
||||
if (nether == null)
|
||||
{
|
||||
for (World world : worlds)
|
||||
{
|
||||
if (world.getEnvironment() == World.Environment.NETHER)
|
||||
{
|
||||
nether = world;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nether == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
final World world = user.getWorld() == nether ? worlds.get(0) : nether;
|
||||
|
||||
double factor;
|
||||
if (user.getWorld().getEnvironment() == World.Environment.NETHER && world.getEnvironment() == World.Environment.NORMAL)
|
||||
{
|
||||
factor = ess.getSettings().getNetherRatio();
|
||||
}
|
||||
else if (user.getWorld().getEnvironment() == World.Environment.NORMAL && world.getEnvironment() == World.Environment.NETHER)
|
||||
{
|
||||
factor = 1.0 / ess.getSettings().getNetherRatio();
|
||||
}
|
||||
else
|
||||
{
|
||||
factor = 1.0;
|
||||
}
|
||||
|
||||
Location loc = event.getTo();
|
||||
int x = loc.getBlockX();
|
||||
int y = loc.getBlockY();
|
||||
int z = loc.getBlockZ();
|
||||
|
||||
if (user.getWorld().getBlockAt(x, y, z - 1).getType() == Material.PORTAL)
|
||||
{
|
||||
z--;
|
||||
}
|
||||
if (user.getWorld().getBlockAt(x - 1, y, z).getType() == Material.PORTAL)
|
||||
{
|
||||
x--;
|
||||
}
|
||||
|
||||
x = (int)(x * factor);
|
||||
z = (int)(z * factor);
|
||||
loc = new Location(world, x + .5, y, z + .5);
|
||||
|
||||
Block dest = world.getBlockAt(x, y, z);
|
||||
NetherPortal portal = NetherPortal.findPortal(dest);
|
||||
if (portal == null)
|
||||
{
|
||||
if (world.getEnvironment() == World.Environment.NETHER || ess.getSettings().getGenerateExitPortals())
|
||||
{
|
||||
portal = NetherPortal.createPortal(dest);
|
||||
LOGGER.info(Util.format("userCreatedPortal", event.getPlayer().getName()));
|
||||
user.sendMessage(Util.i18n("generatingPortal"));
|
||||
loc = portal.getSpawn();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.info(Util.format("userUsedPortal", event.getPlayer().getName()));
|
||||
user.sendMessage(Util.i18n("usingPortal"));
|
||||
loc = portal.getSpawn();
|
||||
}
|
||||
|
||||
event.setFrom(loc);
|
||||
event.setTo(loc);
|
||||
try
|
||||
{
|
||||
user.getTeleport().now(loc, new Trade("portal", ess));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
user.sendMessage(ex.getMessage());
|
||||
}
|
||||
user.setJustPortaled(true);
|
||||
user.sendMessage(Util.i18n("teleportingPortal"));
|
||||
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
user.setJustPortaled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -268,7 +167,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||
|
||||
if (ess.getSettings().changeDisplayName())
|
||||
{
|
||||
user.setDisplayName(user.getNick());
|
||||
user.setDisplayNick(user.getNick());
|
||||
}
|
||||
user.updateActivity(false);
|
||||
if (user.isAuthorized("essentials.sleepingignored"))
|
||||
@@ -307,20 +206,21 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||
{
|
||||
if (event.getResult() != Result.ALLOWED && event.getResult() != Result.KICK_FULL && event.getResult() != Result.KICK_BANNED)
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Disconnecting user " + event.getPlayer().toString() + " due to " + event.getResult().toString());
|
||||
return;
|
||||
}
|
||||
User user = ess.getUser(event.getPlayer());
|
||||
user.setNPC(false);
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
user.checkBanTimeout(currentTime);
|
||||
boolean banExpired = user.checkBanTimeout(currentTime);
|
||||
user.checkMuteTimeout(currentTime);
|
||||
user.checkJailTimeout(currentTime);
|
||||
|
||||
if (user.isBanned())
|
||||
if (banExpired == false && (user.isBanned() || event.getResult() == Result.KICK_BANNED))
|
||||
{
|
||||
final String banReason = user.getBanReason();
|
||||
event.disallow(Result.KICK_BANNED, banReason != null && !banReason.isEmpty() ? banReason : Util.i18n("defaultBanReason"));
|
||||
event.disallow(Result.KICK_BANNED, banReason != null && !banReason.isEmpty() && !banReason.equalsIgnoreCase("ban") ? banReason : Util.i18n("defaultBanReason"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -356,7 +256,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
if (ess.getSettings().changeDisplayName())
|
||||
{
|
||||
user.setDisplayName(user.getNick());
|
||||
user.setDisplayNick(user.getNick());
|
||||
}
|
||||
updateCompass(user);
|
||||
}
|
||||
|
@@ -21,10 +21,9 @@ public class EssentialsPluginListener extends ServerListener implements IConf
|
||||
public void onPluginEnable(final PluginEnableEvent event)
|
||||
{
|
||||
ess.getPermissionsHandler().checkPermissions();
|
||||
if (!ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().setMethod(event.getPlugin()))
|
||||
if (!ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().setMethod(ess.getServer().getPluginManager()))
|
||||
{
|
||||
LOGGER.log(Level.INFO, "[Essentials] Payment method found (" + ess.getPaymentMethod().getMethod().getName() + " version: " + ess.getPaymentMethod().getMethod().getVersion() + ")");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +34,7 @@ public class EssentialsPluginListener extends ServerListener implements IConf
|
||||
// Check to see if the plugin thats being disabled is the one we are using
|
||||
if (ess.getPaymentMethod() != null && ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().checkDisabled(event.getPlugin()))
|
||||
{
|
||||
ess.getPaymentMethod().reset();
|
||||
LOGGER.log(Level.INFO, "[Essentials] Payment method was disabled. No longer accepting payments.");
|
||||
}
|
||||
}
|
||||
|
190
Essentials/src/com/earth2me/essentials/FakeInventory.java
Normal file
190
Essentials/src/com/earth2me/essentials/FakeInventory.java
Normal file
@@ -0,0 +1,190 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import java.util.HashMap;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
public class FakeInventory implements Inventory
|
||||
{
|
||||
ItemStack[] items;
|
||||
|
||||
public FakeInventory(ItemStack[] items)
|
||||
{
|
||||
this.items = new ItemStack[items.length];
|
||||
for (int i = 0; i < items.length; i++)
|
||||
{
|
||||
if (items[i] == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
this.items[i] = new ItemStack(items[i].getTypeId(), items[i].getAmount(), items[i].getDurability());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize()
|
||||
{
|
||||
return items.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(int i)
|
||||
{
|
||||
return items[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItem(int i, ItemStack is)
|
||||
{
|
||||
items[i] = is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<Integer, ItemStack> addItem(ItemStack... iss)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<Integer, ItemStack> removeItem(ItemStack... iss)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getContents()
|
||||
{
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContents(ItemStack[] iss)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(int i)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Material mtrl)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(ItemStack is)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(int i, int i1)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Material mtrl, int i)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(ItemStack is, int i)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<Integer, ? extends ItemStack> all(int i)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<Integer, ? extends ItemStack> all(Material mtrl)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<Integer, ? extends ItemStack> all(ItemStack is)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int first(int i)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int first(Material mtrl)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int first(ItemStack is)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int firstEmpty()
|
||||
{
|
||||
for (int i = 0; i < items.length; i++)
|
||||
{
|
||||
if (items[i] == null || items[i].getTypeId() == 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(int i)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Material mtrl)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(ItemStack is)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear(int i)
|
||||
{
|
||||
items[i] = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
for (int i = 0; i < items.length; i++)
|
||||
{
|
||||
items[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,6 +5,7 @@ import java.util.UUID;
|
||||
import org.bukkit.BlockChangeDelegate;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.TreeType;
|
||||
@@ -437,4 +438,21 @@ public class FakeWorld implements World
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Difficulty getDifficulty()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDifficulty(Difficulty difficulty)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSeaLevel()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
|
@@ -35,8 +35,6 @@ public interface ISettings extends IConf
|
||||
|
||||
int getDefaultStackSize();
|
||||
|
||||
boolean getGenerateExitPortals();
|
||||
|
||||
double getHealCooldown();
|
||||
|
||||
Object getKit(String name);
|
||||
@@ -45,12 +43,6 @@ public interface ISettings extends IConf
|
||||
|
||||
String getLocale();
|
||||
|
||||
String getNetherName();
|
||||
|
||||
boolean getNetherPortalsEnabled();
|
||||
|
||||
double getNetherRatio();
|
||||
|
||||
String getNewbieSpawn();
|
||||
|
||||
String getNicknamePrefix();
|
||||
@@ -73,7 +65,11 @@ public interface ISettings extends IConf
|
||||
|
||||
boolean getRespawnAtHome();
|
||||
|
||||
int getMultipleHomes();
|
||||
List getMultipleHomes();
|
||||
|
||||
int getHomeLimit(String set);
|
||||
|
||||
int getHomeLimit(User user);
|
||||
|
||||
boolean getSortListByGroups();
|
||||
|
||||
@@ -101,8 +97,6 @@ public interface ISettings extends IConf
|
||||
|
||||
boolean isEcoDisabled();
|
||||
|
||||
boolean isNetherEnabled();
|
||||
|
||||
boolean isTradeInStacks(int id);
|
||||
|
||||
List<Integer> itemSpawnBlacklist();
|
||||
@@ -113,8 +107,6 @@ public interface ISettings extends IConf
|
||||
|
||||
boolean spawnIfNoHome();
|
||||
|
||||
boolean use1to1RatioInNether();
|
||||
|
||||
boolean warnOnBuildDisallow();
|
||||
|
||||
boolean warnOnSmite();
|
||||
@@ -140,4 +132,6 @@ public interface ISettings extends IConf
|
||||
long getAutoAfkKick();
|
||||
|
||||
boolean getFreezeAfkPlayers();
|
||||
|
||||
boolean areDeathMessagesEnabled();
|
||||
}
|
||||
|
@@ -64,6 +64,20 @@ public final class InventoryWorkaround
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static boolean addAllItems(final Inventory cinventory, final boolean forceDurability, final ItemStack... items)
|
||||
{
|
||||
final Inventory fake = new FakeInventory(cinventory.getContents());
|
||||
if (addItem(fake, forceDurability, items).isEmpty())
|
||||
{
|
||||
addItem(cinventory, forceDurability, items);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<Integer, ItemStack> addItem(final Inventory cinventory, final boolean forceDurability, final ItemStack... items)
|
||||
{
|
||||
final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
|
||||
@@ -106,7 +120,7 @@ public final class InventoryWorkaround
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
while (true)
|
||||
{
|
||||
// Do we already have a stack of it?
|
||||
|
@@ -26,11 +26,10 @@ public enum Mob
|
||||
SPIDER("Spider", Enemies.ENEMY, CreatureType.SPIDER),
|
||||
SQUID("Squid", Enemies.FRIENDLY, CreatureType.SQUID),
|
||||
ZOMBIE("Zombie", Enemies.ENEMY, CreatureType.ZOMBIE),
|
||||
MONSTER("Monster", Enemies.ENEMY, CreatureType.MONSTER),
|
||||
WOLF("Wolf", Enemies.NEUTRAL, CreatureType.WOLF),
|
||||
CAVESPIDER("CaveSpider", Enemies.ENEMY, CreatureType.CAVE_SPIDER),
|
||||
ENDERMAN("Enderman", Enemies.ENEMY, CreatureType.ENDERMAN),
|
||||
SILVERFISH("Silverfish", Enemies.ENEMY, CreatureType.SILVERFISH);
|
||||
ENDERMAN("Enderman", Enemies.ENEMY, "", CreatureType.ENDERMAN),
|
||||
SILVERFISH("Silverfish", Enemies.ENEMY, "", CreatureType.SILVERFISH);
|
||||
|
||||
public static final Logger logger = Logger.getLogger("Minecraft");
|
||||
|
||||
|
@@ -1,167 +0,0 @@
|
||||
/**
|
||||
* @author SpaceManiac
|
||||
* @licent MIT
|
||||
* @origin https://github.com/SpaceManiac/Nether/blob/master/org/innectis/Nether/NetherPortal.java
|
||||
*/
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
||||
public class NetherPortal
|
||||
{
|
||||
private Block block;
|
||||
|
||||
public NetherPortal(Block b)
|
||||
{
|
||||
block = b;
|
||||
}
|
||||
|
||||
public Block getBlock()
|
||||
{
|
||||
return block;
|
||||
}
|
||||
|
||||
public void setBlock(Block b)
|
||||
{
|
||||
block = b;
|
||||
}
|
||||
|
||||
// Return a random spawnable location
|
||||
public Location getSpawn()
|
||||
{
|
||||
if (block.getWorld().getBlockAt(block.getX() + 1, block.getY(), block.getZ()).getType().equals(Material.PORTAL)
|
||||
|| block.getWorld().getBlockAt(block.getX() - 1, block.getY(), block.getZ()).getType().equals(Material.PORTAL))
|
||||
{
|
||||
// portal is in X direction
|
||||
return new Location(block.getWorld(), block.getX() + 1,
|
||||
block.getY(), block.getZ() + 1 - 2 * Math.round(Math.random()));
|
||||
}
|
||||
else
|
||||
{
|
||||
// portal is in Z direction
|
||||
return new Location(block.getWorld(), block.getX() + 1 - 2 * Math.round(Math.random()),
|
||||
block.getY(), block.getZ() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// ==============================
|
||||
// Find a nearby portal within 16 blocks of the given block
|
||||
// Not guaranteed to be the nearest
|
||||
public static NetherPortal findPortal(Block dest)
|
||||
{
|
||||
World world = dest.getWorld();
|
||||
|
||||
// Get list of columns in a circle around the block
|
||||
ArrayList<Block> columns = new ArrayList<Block>();
|
||||
for (int x = dest.getX() - 16; x <= dest.getX() + 16; ++x)
|
||||
{
|
||||
for (int z = dest.getZ() - 16; z <= dest.getZ() + 16; ++z)
|
||||
{
|
||||
int dx = dest.getX() - x, dz = dest.getZ() - z;
|
||||
if (dx * dx + dz * dz <= 256)
|
||||
{
|
||||
columns.add(world.getBlockAt(x, 0, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// For each column try to find a portal block
|
||||
for (Block col : columns)
|
||||
{
|
||||
for (int y = 127; y >= 0; --y)
|
||||
{
|
||||
Block b = world.getBlockAt(col.getX(), y, col.getZ());
|
||||
if (b.getType().equals(Material.PORTAL) && Math.abs(dest.getY() - y) <= 16)
|
||||
{
|
||||
// Huzzah!
|
||||
return new NetherPortal(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Nope!
|
||||
return null;
|
||||
}
|
||||
|
||||
// Create a new portal at the specified block, fudging position if needed
|
||||
// Will occasionally end up making portals in bad places, but let's hope not
|
||||
public static NetherPortal createPortal(Block dest)
|
||||
{
|
||||
World world = dest.getWorld();
|
||||
|
||||
// Try not to spawn within water or lava
|
||||
Material m = dest.getType();
|
||||
while (((m.equals(Material.LAVA) || m.equals(Material.WATER) || m.equals(Material.STATIONARY_LAVA)
|
||||
|| m.equals(Material.STATIONARY_WATER) || m.equals(Material.SAND) || m.equals(Material.GRAVEL))) &&
|
||||
dest.getY() < 120)
|
||||
{
|
||||
dest = world.getBlockAt(dest.getX(), dest.getY() + 4, dest.getZ());
|
||||
m = dest.getType();
|
||||
}
|
||||
|
||||
// Not too high or too low overall
|
||||
if (dest.getY() > 120)
|
||||
{
|
||||
dest = world.getBlockAt(dest.getX(), 120, dest.getZ());
|
||||
}
|
||||
else if (dest.getY() < 8)
|
||||
{
|
||||
dest = world.getBlockAt(dest.getX(), 8, dest.getZ());
|
||||
}
|
||||
|
||||
// Create the physical portal
|
||||
// For now, don't worry about direction
|
||||
|
||||
int x = dest.getX(), y = dest.getY(), z = dest.getZ();
|
||||
Logger.getLogger("Minecraft").log(Level.INFO, Util.format("creatingPortal", x, y, z));
|
||||
|
||||
// Clear area around portal
|
||||
ArrayList<Block> columns = new ArrayList<Block>();
|
||||
for (int x2 = x - 4; x2 <= x + 4; ++x2)
|
||||
{
|
||||
for (int z2 = z - 4; z2 <= z + 4; ++z2)
|
||||
{
|
||||
double dx = x + 0.5f - x2, dz = z - z2;
|
||||
if (dx * dx + dz * dz <= 13)
|
||||
{
|
||||
columns.add(world.getBlockAt(x2, 0, z2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clear area around portal
|
||||
for (Block col : columns)
|
||||
{
|
||||
// Stone platform
|
||||
world.getBlockAt(col.getX(), y - 1, col.getZ()).setType(Material.STONE);
|
||||
for (int yd = 0; yd < 4; ++yd)
|
||||
{
|
||||
world.getBlockAt(col.getX(), y + yd, col.getZ()).setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
// Build obsidian frame
|
||||
for (int xd = -1; xd < 3; ++xd)
|
||||
{
|
||||
for (int yd = -1; yd < 4; ++yd)
|
||||
{
|
||||
if (xd == -1 || yd == -1 || xd == 2 || yd == 3)
|
||||
{
|
||||
world.getBlockAt(x + xd, y + yd, z).setType(Material.OBSIDIAN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set it alight!
|
||||
dest.setType(Material.FIRE);
|
||||
|
||||
return new NetherPortal(dest);
|
||||
}
|
||||
}
|
@@ -5,6 +5,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import lombok.Delegate;
|
||||
import org.bukkit.Achievement;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
@@ -35,40 +36,32 @@ import org.bukkit.util.Vector;
|
||||
|
||||
public class OfflinePlayer implements Player
|
||||
{
|
||||
private final String name;
|
||||
final transient IEssentials ess;
|
||||
private final transient IEssentials ess;
|
||||
private Location location = new Location(null, 0, 0, 0, 0, 0);
|
||||
private World world;
|
||||
private UUID uniqueId = UUID.randomUUID();
|
||||
private org.bukkit.OfflinePlayer base;
|
||||
@Delegate(types=org.bukkit.OfflinePlayer.class)
|
||||
private final org.bukkit.OfflinePlayer base;
|
||||
|
||||
public OfflinePlayer(String name, IEssentials ess)
|
||||
public OfflinePlayer(final String name, final IEssentials ess)
|
||||
{
|
||||
this.name = name;
|
||||
this.ess = ess;
|
||||
this.world = ess.getServer().getWorlds().get(0);
|
||||
this.base = ess.getServer().getOfflinePlayer(name);
|
||||
}
|
||||
|
||||
public boolean isOnline()
|
||||
{
|
||||
return base.isOnline();
|
||||
}
|
||||
|
||||
public boolean isOp()
|
||||
{
|
||||
return base.isOp();
|
||||
}
|
||||
|
||||
public void sendMessage(String string)
|
||||
@Override
|
||||
public void sendMessage(final String string)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName()
|
||||
{
|
||||
return name;
|
||||
return base.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplayName(String string)
|
||||
{
|
||||
}
|
||||
@@ -86,11 +79,6 @@ public class OfflinePlayer implements Player
|
||||
{
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public PlayerInventory getInventory()
|
||||
{
|
||||
return null;
|
||||
@@ -576,42 +564,13 @@ public class OfflinePlayer implements Player
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public void setOp(boolean bln)
|
||||
{
|
||||
base.setOp(bln);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendMap(MapView mv)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBanned()
|
||||
{
|
||||
return base.isBanned();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBanned(boolean bln)
|
||||
{
|
||||
base.setBanned(bln);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWhitelisted()
|
||||
{
|
||||
return base.isWhitelisted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWhitelisted(boolean bln)
|
||||
{
|
||||
base.setWhitelisted(bln);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameMode getGameMode()
|
||||
{
|
||||
@@ -695,7 +654,7 @@ public class OfflinePlayer implements Player
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Location getBedSpawnLocation()
|
||||
{
|
||||
@@ -713,5 +672,28 @@ public class OfflinePlayer implements Player
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setPlayerListName(String name)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerListName()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTicksLived()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTicksLived(int i)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
|
@@ -1,37 +1,53 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import lombok.Delegate;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.IInventory;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.Permissible;
|
||||
import org.bukkit.permissions.ServerOperator;
|
||||
|
||||
|
||||
public class PlayerExtension extends PlayerWrapper
|
||||
public class PlayerExtension implements Player
|
||||
{
|
||||
protected final IEssentials ess;
|
||||
|
||||
public PlayerExtension(Player base, IEssentials ess)
|
||||
protected final transient IEssentials ess;
|
||||
@Delegate(types =
|
||||
{
|
||||
super(base);
|
||||
Player.class, Entity.class, CommandSender.class, ServerOperator.class,
|
||||
HumanEntity.class, ConfigurationSerializable.class, LivingEntity.class,
|
||||
Permissible.class
|
||||
})
|
||||
protected Player base;
|
||||
|
||||
public PlayerExtension(final Player base, final IEssentials ess)
|
||||
{
|
||||
this.base = base;
|
||||
this.ess = ess;
|
||||
}
|
||||
|
||||
public float getCorrectedYaw()
|
||||
|
||||
public final Player getBase()
|
||||
{
|
||||
float angle = (getLocation().getYaw() - 90.0f) % 360.0f;
|
||||
if (angle < 0) {
|
||||
angle += 360.0f;
|
||||
}
|
||||
return angle;
|
||||
return base;
|
||||
}
|
||||
|
||||
public final Player setBase(final Player base)
|
||||
{
|
||||
return this.base = base;
|
||||
}
|
||||
|
||||
public void showInventory(IInventory inventory)
|
||||
public void showInventory(final IInventory inventory)
|
||||
{
|
||||
getHandle().a(inventory);
|
||||
}
|
||||
|
||||
public void showInventory(CraftInventoryPlayer inventory)
|
||||
public void showInventory(final CraftInventoryPlayer inventory)
|
||||
{
|
||||
showInventory((IInventory)inventory.getInventory());
|
||||
}
|
||||
@@ -46,7 +62,7 @@ public class PlayerExtension extends PlayerWrapper
|
||||
return ess.getPermissionsHandler().getGroup(base);
|
||||
}
|
||||
|
||||
public boolean inGroup(String group)
|
||||
public boolean inGroup(final String group)
|
||||
{
|
||||
return ess.getPermissionsHandler().inGroup(base, group);
|
||||
}
|
||||
|
@@ -1,747 +0,0 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.*;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.inventory.*;
|
||||
import org.bukkit.map.MapView;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionAttachment;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class PlayerWrapper implements Player
|
||||
{
|
||||
protected Player base;
|
||||
|
||||
public PlayerWrapper(Player base)
|
||||
{
|
||||
this.base = base;
|
||||
}
|
||||
|
||||
public final Player getBase()
|
||||
{
|
||||
return base;
|
||||
}
|
||||
|
||||
public final Player setBase(Player base)
|
||||
{
|
||||
return this.base = base;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplayName(String string)
|
||||
{
|
||||
base.setDisplayName(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompassTarget(Location lctn)
|
||||
{
|
||||
base.setCompassTarget(lctn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress getAddress()
|
||||
{
|
||||
return base.getAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kickPlayer(String string)
|
||||
{
|
||||
base.kickPlayer(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return base.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayerInventory getInventory()
|
||||
{
|
||||
return base.getInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemInHand()
|
||||
{
|
||||
return base.getItemInHand();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItemInHand(ItemStack is)
|
||||
{
|
||||
base.setItemInHand(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealth()
|
||||
{
|
||||
return base.getHealth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHealth(int i)
|
||||
{
|
||||
base.setHealth(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Egg throwEgg()
|
||||
{
|
||||
return base.throwEgg();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Snowball throwSnowball()
|
||||
{
|
||||
return base.throwSnowball();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Arrow shootArrow()
|
||||
{
|
||||
return base.shootArrow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInsideVehicle()
|
||||
{
|
||||
return base.isInsideVehicle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean leaveVehicle()
|
||||
{
|
||||
return base.leaveVehicle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vehicle getVehicle()
|
||||
{
|
||||
return base.getVehicle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation()
|
||||
{
|
||||
return base.getLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
{
|
||||
return base.getWorld();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Server getServer()
|
||||
{
|
||||
return base.getServer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline()
|
||||
{
|
||||
return base.isOnline();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOp()
|
||||
{
|
||||
return base.isOp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean teleport(Location lctn)
|
||||
{
|
||||
return base.teleport(lctn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean teleport(Entity entity)
|
||||
{
|
||||
return base.teleport(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(String string)
|
||||
{
|
||||
base.sendMessage(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVelocity(Vector vector)
|
||||
{
|
||||
base.setVelocity(vector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getVelocity()
|
||||
{
|
||||
return base.getVelocity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getEyeHeight()
|
||||
{
|
||||
return base.getEyeHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getEyeHeight(boolean bln)
|
||||
{
|
||||
return base.getEyeHeight(bln);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Block> getLineOfSight(HashSet<Byte> hs, int i)
|
||||
{
|
||||
return base.getLineOfSight(hs, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getTargetBlock(HashSet<Byte> hs, int i)
|
||||
{
|
||||
return base.getTargetBlock(hs, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Block> getLastTwoTargetBlocks(HashSet<Byte> hs, int i)
|
||||
{
|
||||
return base.getLastTwoTargetBlocks(hs, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireTicks()
|
||||
{
|
||||
return base.getFireTicks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFireTicks()
|
||||
{
|
||||
return base.getMaxFireTicks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFireTicks(int i)
|
||||
{
|
||||
base.setFireTicks(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove()
|
||||
{
|
||||
base.remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* This is not deprecated because the underlying method isn't really deprecated; rather, it's just "imperfect". By
|
||||
* We will continue to use this method even after the underlying CraftBukkit method is changed, so do not deprecate
|
||||
* it. Chances are Bukkit will also choose to un-deprecate this method at some point.
|
||||
*/
|
||||
@Override
|
||||
public void updateInventory()
|
||||
{
|
||||
base.updateInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chat(String string)
|
||||
{
|
||||
base.chat(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSneaking()
|
||||
{
|
||||
return base.isSneaking();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSneaking(boolean bln)
|
||||
{
|
||||
base.setSneaking(bln);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEntityId()
|
||||
{
|
||||
return base.getEntityId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performCommand(String string)
|
||||
{
|
||||
return base.performCommand(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRemainingAir()
|
||||
{
|
||||
return base.getRemainingAir();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRemainingAir(int i)
|
||||
{
|
||||
base.setRemainingAir(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumAir()
|
||||
{
|
||||
return base.getMaximumAir();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaximumAir(int i)
|
||||
{
|
||||
base.setMaximumAir(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName()
|
||||
{
|
||||
if (base.getDisplayName() != null)
|
||||
return base.getDisplayName();
|
||||
else
|
||||
return base.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damage(int i)
|
||||
{
|
||||
base.damage(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damage(int i, Entity entity)
|
||||
{
|
||||
base.damage(i, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getEyeLocation()
|
||||
{
|
||||
return base.getEyeLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendRawMessage(String string) {
|
||||
base.sendRawMessage(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getCompassTarget()
|
||||
{
|
||||
return base.getCompassTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumNoDamageTicks()
|
||||
{
|
||||
return base.getMaximumNoDamageTicks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaximumNoDamageTicks(int i)
|
||||
{
|
||||
base.setMaximumNoDamageTicks(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLastDamage()
|
||||
{
|
||||
return base.getLastDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLastDamage(int i)
|
||||
{
|
||||
base.setLastDamage(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNoDamageTicks()
|
||||
{
|
||||
return base.getNoDamageTicks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNoDamageTicks(int i)
|
||||
{
|
||||
base.setNoDamageTicks(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity getPassenger()
|
||||
{
|
||||
return base.getPassenger();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setPassenger(Entity entity)
|
||||
{
|
||||
return base.setPassenger(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return base.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eject()
|
||||
{
|
||||
return base.eject();
|
||||
}
|
||||
|
||||
public void saveData()
|
||||
{
|
||||
base.saveData();
|
||||
}
|
||||
|
||||
public void loadData()
|
||||
{
|
||||
base.loadData();
|
||||
}
|
||||
|
||||
public boolean isSleeping()
|
||||
{
|
||||
return base.isSleeping();
|
||||
}
|
||||
|
||||
public int getSleepTicks()
|
||||
{
|
||||
return base.getSleepTicks();
|
||||
}
|
||||
|
||||
public List<Entity> getNearbyEntities(double d, double d1, double d2)
|
||||
{
|
||||
return base.getNearbyEntities(d, d1, d2);
|
||||
}
|
||||
|
||||
public boolean isDead()
|
||||
{
|
||||
return base.isDead();
|
||||
}
|
||||
|
||||
public float getFallDistance()
|
||||
{
|
||||
return base.getFallDistance();
|
||||
}
|
||||
|
||||
public void setFallDistance(float f)
|
||||
{
|
||||
base.setFallDistance(f);
|
||||
}
|
||||
|
||||
public void setSleepingIgnored(boolean bln)
|
||||
{
|
||||
base.setSleepingIgnored(bln);
|
||||
}
|
||||
|
||||
public boolean isSleepingIgnored()
|
||||
{
|
||||
return base.isSleepingIgnored();
|
||||
}
|
||||
|
||||
public void awardAchievement(Achievement a)
|
||||
{
|
||||
base.awardAchievement(a);
|
||||
}
|
||||
|
||||
public void incrementStatistic(Statistic ststc)
|
||||
{
|
||||
base.incrementStatistic(ststc);
|
||||
}
|
||||
|
||||
public void incrementStatistic(Statistic ststc, int i)
|
||||
{
|
||||
base.incrementStatistic(ststc, i);
|
||||
}
|
||||
|
||||
public void incrementStatistic(Statistic ststc, Material mtrl)
|
||||
{
|
||||
base.incrementStatistic(ststc, mtrl);
|
||||
}
|
||||
|
||||
public void incrementStatistic(Statistic ststc, Material mtrl, int i)
|
||||
{
|
||||
base.incrementStatistic(ststc, mtrl, i);
|
||||
}
|
||||
|
||||
public void playNote(Location lctn, byte b, byte b1)
|
||||
{
|
||||
base.playNote(lctn, b, b1);
|
||||
}
|
||||
|
||||
public void sendBlockChange(Location lctn, Material mtrl, byte b)
|
||||
{
|
||||
base.sendBlockChange(lctn, mtrl, b);
|
||||
}
|
||||
|
||||
public void sendBlockChange(Location lctn, int i, byte b)
|
||||
{
|
||||
base.sendBlockChange(lctn, i, b);
|
||||
}
|
||||
|
||||
public void setLastDamageCause(EntityDamageEvent ede)
|
||||
{
|
||||
base.setLastDamageCause(ede);
|
||||
|
||||
}
|
||||
|
||||
public EntityDamageEvent getLastDamageCause()
|
||||
{
|
||||
return base.getLastDamageCause();
|
||||
}
|
||||
|
||||
public void playEffect(Location lctn, Effect effect, int i)
|
||||
{
|
||||
base.playEffect(lctn, effect, i);
|
||||
}
|
||||
|
||||
public boolean sendChunkChange(Location lctn, int i, int i1, int i2, byte[] bytes)
|
||||
{
|
||||
return base.sendChunkChange(lctn, i, i1, i2, bytes);
|
||||
}
|
||||
|
||||
public UUID getUniqueId()
|
||||
{
|
||||
return base.getUniqueId();
|
||||
}
|
||||
|
||||
public void playNote(Location lctn, Instrument i, Note note)
|
||||
{
|
||||
base.playNote(lctn, i, note);
|
||||
}
|
||||
|
||||
public void setPlayerTime(long l, boolean bln)
|
||||
{
|
||||
base.setPlayerTime(l, bln);
|
||||
}
|
||||
|
||||
public long getPlayerTime()
|
||||
{
|
||||
return base.getPlayerTime();
|
||||
}
|
||||
|
||||
public long getPlayerTimeOffset()
|
||||
{
|
||||
return base.getPlayerTimeOffset();
|
||||
}
|
||||
|
||||
public boolean isPlayerTimeRelative()
|
||||
{
|
||||
return base.isPlayerTimeRelative();
|
||||
}
|
||||
|
||||
public void resetPlayerTime()
|
||||
{
|
||||
base.resetPlayerTime();
|
||||
}
|
||||
|
||||
public boolean isPermissionSet(String string)
|
||||
{
|
||||
return base.isPermissionSet(string);
|
||||
}
|
||||
|
||||
public boolean isPermissionSet(Permission prmsn)
|
||||
{
|
||||
return base.isPermissionSet(prmsn);
|
||||
}
|
||||
|
||||
public boolean hasPermission(String string)
|
||||
{
|
||||
return base.hasPermission(string);
|
||||
}
|
||||
|
||||
public boolean hasPermission(Permission prmsn)
|
||||
{
|
||||
return base.hasPermission(prmsn);
|
||||
}
|
||||
|
||||
public PermissionAttachment addAttachment(Plugin plugin, String string, boolean bln)
|
||||
{
|
||||
return base.addAttachment(plugin, string, bln);
|
||||
}
|
||||
|
||||
public PermissionAttachment addAttachment(Plugin plugin)
|
||||
{
|
||||
return base.addAttachment(plugin);
|
||||
}
|
||||
|
||||
public PermissionAttachment addAttachment(Plugin plugin, String string, boolean bln, int i)
|
||||
{
|
||||
return base.addAttachment(plugin, string, bln, i);
|
||||
}
|
||||
|
||||
public PermissionAttachment addAttachment(Plugin plugin, int i)
|
||||
{
|
||||
return base.addAttachment(plugin, i);
|
||||
}
|
||||
|
||||
public void removeAttachment(PermissionAttachment pa)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public void recalculatePermissions()
|
||||
{
|
||||
base.recalculatePermissions();
|
||||
}
|
||||
|
||||
public Set<PermissionAttachmentInfo> getEffectivePermissions()
|
||||
{
|
||||
return base.getEffectivePermissions();
|
||||
}
|
||||
|
||||
public void setOp(boolean bln)
|
||||
{
|
||||
base.setOp(bln);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMap(MapView mv)
|
||||
{
|
||||
base.sendMap(mv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBanned()
|
||||
{
|
||||
return base.isBanned();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBanned(boolean bln)
|
||||
{
|
||||
base.setBanned(bln);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWhitelisted()
|
||||
{
|
||||
return base.isWhitelisted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWhitelisted(boolean bln)
|
||||
{
|
||||
base.setWhitelisted(bln);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameMode getGameMode()
|
||||
{
|
||||
return base.getGameMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGameMode(GameMode gm)
|
||||
{
|
||||
base.setGameMode(gm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExperience()
|
||||
{
|
||||
return base.getExperience();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExperience(int i)
|
||||
{
|
||||
base.setExperience(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel()
|
||||
{
|
||||
return base.getLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLevel(int i)
|
||||
{
|
||||
base.setLevel(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalExperience()
|
||||
{
|
||||
return base.getTotalExperience();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTotalExperience(int i)
|
||||
{
|
||||
base.setTotalExperience(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExhaustion()
|
||||
{
|
||||
return base.getExhaustion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExhaustion(float f)
|
||||
{
|
||||
base.setExhaustion(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSaturation()
|
||||
{
|
||||
return base.getSaturation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSaturation(float f)
|
||||
{
|
||||
base.setSaturation(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFoodLevel()
|
||||
{
|
||||
return base.getFoodLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFoodLevel(int i)
|
||||
{
|
||||
base.setFoodLevel(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getBedSpawnLocation()
|
||||
{
|
||||
return base.getBedSpawnLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSprinting()
|
||||
{
|
||||
return base.isSprinting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSprinting(boolean bln)
|
||||
{
|
||||
base.setSprinting(bln);
|
||||
}
|
||||
|
||||
}
|
@@ -30,12 +30,6 @@ public class Settings implements ISettings
|
||||
{
|
||||
return config.getBoolean("respawn-at-home", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMultipleHomes()
|
||||
{
|
||||
return config.getInt("multiple-homes", 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBedSetsHome()
|
||||
@@ -43,6 +37,39 @@ public class Settings implements ISettings
|
||||
return config.getBoolean("bed-sethome", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMultipleHomes()
|
||||
{
|
||||
return config.getKeys("sethome-multiple");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHomeLimit(final User user)
|
||||
{
|
||||
final List<String> homeList = getMultipleHomes();
|
||||
if (homeList == null)
|
||||
{
|
||||
//TODO: Replace this code to remove backwards compat, after settings are automatically updated
|
||||
// return getHomeLimit("default");
|
||||
return config.getInt("multiple-homes", 5);
|
||||
}
|
||||
int limit = getHomeLimit("default");
|
||||
for (String set : homeList)
|
||||
{
|
||||
if (user.isAuthorized("essentials.sethome.multiple." + set) && (limit < getHomeLimit(set)))
|
||||
{
|
||||
limit = getHomeLimit(set);
|
||||
}
|
||||
}
|
||||
return limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHomeLimit(final String set)
|
||||
{
|
||||
return config.getInt("sethome-multiple." + set, config.getInt("sethome-multiple.default", 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChatRadius()
|
||||
{
|
||||
@@ -60,19 +87,13 @@ public class Settings implements ISettings
|
||||
{
|
||||
return config.getInt("default-stack-size", 64);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getStartingBalance()
|
||||
{
|
||||
return config.getInt("starting-balance", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getNetherPortalsEnabled()
|
||||
{
|
||||
return isNetherEnabled() && config.getBoolean("nether.portals-enabled", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCommandDisabled(final IEssentialsCommand cmd)
|
||||
{
|
||||
@@ -84,7 +105,10 @@ public class Settings implements ISettings
|
||||
{
|
||||
for (String c : config.getStringList("disabled-commands", new ArrayList<String>(0)))
|
||||
{
|
||||
if (!c.equalsIgnoreCase(label)) continue;
|
||||
if (!c.equalsIgnoreCase(label))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return config.getBoolean("disable-" + label.toLowerCase(), false);
|
||||
@@ -101,18 +125,24 @@ public class Settings implements ISettings
|
||||
{
|
||||
for (String c : config.getStringList("restricted-commands", new ArrayList<String>(0)))
|
||||
{
|
||||
if (!c.equalsIgnoreCase(label)) continue;
|
||||
if (!c.equalsIgnoreCase(label))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return config.getBoolean("restrict-" + label.toLowerCase(), false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isPlayerCommand(String label)
|
||||
{
|
||||
for (String c : config.getStringList("player-commands", new ArrayList<String>(0)))
|
||||
{
|
||||
if (!c.equalsIgnoreCase(label)) continue;
|
||||
if (!c.equalsIgnoreCase(label))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -126,7 +156,9 @@ public class Settings implements ISettings
|
||||
for (String c : config.getStringList("overridden-commands", defaultList))
|
||||
{
|
||||
if (!c.equalsIgnoreCase(name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return config.getBoolean("override-" + name.toLowerCase(), false);
|
||||
@@ -143,7 +175,9 @@ public class Settings implements ISettings
|
||||
{
|
||||
double cost = config.getDouble("command-costs." + label, 0.0);
|
||||
if (cost == 0.0)
|
||||
{
|
||||
cost = config.getDouble("cost-" + label, 0.0);
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
|
||||
@@ -171,13 +205,14 @@ public class Settings implements ISettings
|
||||
Map<String, Object> kits = (Map<String, Object>)config.getProperty("kits");
|
||||
for (Map.Entry<String, Object> entry : kits.entrySet())
|
||||
{
|
||||
if (entry.getKey().equalsIgnoreCase(name.replace('.', '_').replace('/', '_'))) {
|
||||
if (entry.getKey().equalsIgnoreCase(name.replace('.', '_').replace('/', '_')))
|
||||
{
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getKits()
|
||||
{
|
||||
@@ -190,9 +225,13 @@ public class Settings implements ISettings
|
||||
String colorName = config.getString("ops-name-color", null);
|
||||
|
||||
if (colorName == null)
|
||||
{
|
||||
return ChatColor.RED;
|
||||
if("none".equalsIgnoreCase(colorName) || colorName.isEmpty())
|
||||
}
|
||||
if ("none".equalsIgnoreCase(colorName) || colorName.isEmpty())
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -211,35 +250,23 @@ public class Settings implements ISettings
|
||||
return config.getBoolean("reclaim-onlogout", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNetherName()
|
||||
{
|
||||
return config.getString("nether.folder", "nether");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNetherEnabled()
|
||||
{
|
||||
return config.getBoolean("nether.enabled", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpawnMobLimit()
|
||||
{
|
||||
return config.getInt("spawnmob-limit", 10);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean showNonEssCommandsInHelp()
|
||||
{
|
||||
return config.getBoolean("non-ess-in-help", true);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hidePermissionlessHelp()
|
||||
public boolean hidePermissionlessHelp()
|
||||
{
|
||||
return config.getBoolean("hide-permissionless-help", true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProtectCreeperMaxHeight()
|
||||
@@ -272,12 +299,6 @@ public class Settings implements ISettings
|
||||
config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getGenerateExitPortals()
|
||||
{
|
||||
return config.getBoolean("nether.generate-exit-portals", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getAnnounceNewPlayers()
|
||||
{
|
||||
@@ -301,12 +322,13 @@ public class Settings implements ISettings
|
||||
{
|
||||
return config.getString("newbies.spawnpoint", "default");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPerWarpPermission()
|
||||
public boolean getPerWarpPermission()
|
||||
{
|
||||
return config.getBoolean("per-warp-permission", false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getSortListByGroups()
|
||||
{
|
||||
@@ -314,7 +336,8 @@ public class Settings implements ISettings
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadConfig() {
|
||||
public void reloadConfig()
|
||||
{
|
||||
config.load();
|
||||
}
|
||||
|
||||
@@ -322,16 +345,21 @@ public class Settings implements ISettings
|
||||
public List<Integer> itemSpawnBlacklist()
|
||||
{
|
||||
final List<Integer> epItemSpwn = new ArrayList<Integer>();
|
||||
for (String itemName : config.getString("item-spawn-blacklist", "").split(",")) {
|
||||
for (String itemName : config.getString("item-spawn-blacklist", "").split(","))
|
||||
{
|
||||
itemName = itemName.trim();
|
||||
if (itemName.isEmpty()) {
|
||||
if (itemName.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ItemStack is;
|
||||
try {
|
||||
try
|
||||
{
|
||||
is = ess.getItemDb().get(itemName);
|
||||
epItemSpwn.add(is.getTypeId());
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, "item-spawn-blacklist"));
|
||||
}
|
||||
}
|
||||
@@ -350,21 +378,6 @@ public class Settings implements ISettings
|
||||
return config.getBoolean("protect.disable.warn-on-build-disallow", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean use1to1RatioInNether()
|
||||
{
|
||||
return config.getBoolean("nether.use-1to1-ratio", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getNetherRatio()
|
||||
{
|
||||
if (config.getBoolean("nether.use-1to1-ratio", false)) {
|
||||
return 1.0;
|
||||
}
|
||||
return config.getDouble("nether.ratio", 16.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDebug()
|
||||
{
|
||||
@@ -374,9 +387,9 @@ public class Settings implements ISettings
|
||||
@Override
|
||||
public boolean warnOnSmite()
|
||||
{
|
||||
return config.getBoolean("warn-on-smite" ,true);
|
||||
return config.getBoolean("warn-on-smite", true);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean permissionBasedItemSpawn()
|
||||
{
|
||||
@@ -410,23 +423,28 @@ public class Settings implements ISettings
|
||||
@Override
|
||||
public boolean getProtectPreventSpawn(final String creatureName)
|
||||
{
|
||||
return config.getBoolean("protect.prevent.spawn."+creatureName, false);
|
||||
return config.getBoolean("protect.prevent.spawn." + creatureName, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> getProtectList(final String configName)
|
||||
{
|
||||
final List<Integer> list = new ArrayList<Integer>();
|
||||
for (String itemName : config.getString(configName, "").split(",")) {
|
||||
for (String itemName : config.getString(configName, "").split(","))
|
||||
{
|
||||
itemName = itemName.trim();
|
||||
if (itemName.isEmpty()) {
|
||||
if (itemName.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ItemStack itemStack;
|
||||
try {
|
||||
try
|
||||
{
|
||||
itemStack = ess.getItemDb().get(itemName);
|
||||
list.add(itemStack.getTypeId());
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, configName));
|
||||
}
|
||||
}
|
||||
@@ -444,12 +462,13 @@ public class Settings implements ISettings
|
||||
{
|
||||
return config.getBoolean(configName, def);
|
||||
}
|
||||
|
||||
private final static double MAXMONEY = 10000000000000.0;
|
||||
|
||||
public double getMaxMoney()
|
||||
{
|
||||
double max = config.getDouble("max-money", MAXMONEY);
|
||||
if (Math.abs(max) > MAXMONEY) {
|
||||
if (Math.abs(max) > MAXMONEY)
|
||||
{
|
||||
max = max < 0 ? -MAXMONEY : MAXMONEY;
|
||||
}
|
||||
return max;
|
||||
@@ -459,7 +478,7 @@ public class Settings implements ISettings
|
||||
{
|
||||
return config.getBoolean("economy-log-enabled", false);
|
||||
}
|
||||
|
||||
|
||||
public boolean removeGodOnDisconnect()
|
||||
{
|
||||
return config.getBoolean("remove-god-on-disconnect", false);
|
||||
@@ -503,4 +522,10 @@ public class Settings implements ISettings
|
||||
{
|
||||
return config.getBoolean("freeze-afk-players", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areDeathMessagesEnabled()
|
||||
{
|
||||
return config.getBoolean("death-messages", true);
|
||||
}
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
|
||||
/**
|
||||
* Original authors: toi & Raphfrk
|
||||
*/
|
||||
@Deprecated
|
||||
public class TargetBlock
|
||||
{
|
||||
private transient final Location location;
|
||||
|
@@ -256,7 +256,7 @@ public class Teleport implements Runnable
|
||||
|
||||
public void back() throws Exception
|
||||
{
|
||||
back(null);
|
||||
now(new Target(user.getLastLocation()));
|
||||
}
|
||||
|
||||
public void home(IUser user, String home, Trade chargeFor) throws Exception
|
||||
|
@@ -18,22 +18,22 @@ public class Trade
|
||||
private final transient Double money;
|
||||
private final transient ItemStack itemStack;
|
||||
private final transient IEssentials ess;
|
||||
|
||||
|
||||
public Trade(final String command, final IEssentials ess)
|
||||
{
|
||||
this(command, null, null, ess);
|
||||
}
|
||||
|
||||
|
||||
public Trade(final double money, final IEssentials ess)
|
||||
{
|
||||
this(null, money, null, ess);
|
||||
}
|
||||
|
||||
|
||||
public Trade(final ItemStack items, final IEssentials ess)
|
||||
{
|
||||
this(null, null, items, ess);
|
||||
}
|
||||
|
||||
|
||||
private Trade(final String command, final Double money, final ItemStack item, final IEssentials ess)
|
||||
{
|
||||
this.command = command;
|
||||
@@ -41,7 +41,7 @@ public class Trade
|
||||
this.itemStack = item;
|
||||
this.ess = ess;
|
||||
}
|
||||
|
||||
|
||||
public void isAffordableFor(final IUser user) throws ChargeException
|
||||
{
|
||||
final double mon = user.getMoney();
|
||||
@@ -52,13 +52,13 @@ public class Trade
|
||||
{
|
||||
throw new ChargeException(Util.i18n("notEnoughMoney"));
|
||||
}
|
||||
|
||||
|
||||
if (getItemStack() != null
|
||||
&& !InventoryWorkaround.containsItem(user.getInventory(), true, itemStack))
|
||||
{
|
||||
throw new ChargeException(Util.format("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase().replace("_", " ")));
|
||||
}
|
||||
|
||||
|
||||
if (command != null && !command.isEmpty()
|
||||
&& !user.isAuthorized("essentials.nocommandcost.all")
|
||||
&& !user.isAuthorized("essentials.nocommandcost." + command)
|
||||
@@ -69,24 +69,38 @@ public class Trade
|
||||
throw new ChargeException(Util.i18n("notEnoughMoney"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void pay(final IUser user)
|
||||
{
|
||||
pay(user, true);
|
||||
}
|
||||
|
||||
public boolean pay(final IUser user, final boolean dropItems)
|
||||
{
|
||||
boolean success = true;
|
||||
if (getMoney() != null && getMoney() > 0)
|
||||
{
|
||||
user.giveMoney(getMoney());
|
||||
}
|
||||
if (getItemStack() != null)
|
||||
{
|
||||
final Map<Integer, ItemStack> leftOver = InventoryWorkaround.addItem(user.getInventory(), true, getItemStack());
|
||||
for (ItemStack itemStack : leftOver.values())
|
||||
if (dropItems)
|
||||
{
|
||||
InventoryWorkaround.dropItem(user.getLocation(), itemStack);
|
||||
final Map<Integer, ItemStack> leftOver = InventoryWorkaround.addItem(user.getInventory(), true, getItemStack());
|
||||
for (ItemStack itemStack : leftOver.values())
|
||||
{
|
||||
InventoryWorkaround.dropItem(user.getLocation(), itemStack);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
success = InventoryWorkaround.addAllItems(user.getInventory(), true, getItemStack());
|
||||
}
|
||||
user.updateInventory();
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
public void charge(final IUser user) throws ChargeException
|
||||
{
|
||||
if (getMoney() != null)
|
||||
@@ -120,18 +134,18 @@ public class Trade
|
||||
user.takeMoney(cost);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Double getMoney()
|
||||
{
|
||||
return money;
|
||||
}
|
||||
|
||||
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
return itemStack;
|
||||
}
|
||||
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)
|
||||
{
|
||||
if (!ess.getSettings().isEcoLogEnabled())
|
||||
@@ -225,10 +239,11 @@ public class Trade
|
||||
Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void closeLog()
|
||||
{
|
||||
if (fw != null) {
|
||||
if (fw != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
fw.close();
|
||||
|
@@ -20,14 +20,12 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
private transient long lastOnlineActivity;
|
||||
private transient long lastActivity = System.currentTimeMillis();
|
||||
private boolean hidden = false;
|
||||
private transient boolean godStateBeforeAfk;
|
||||
private transient Location afkPosition;
|
||||
|
||||
User(final Player base, final IEssentials ess)
|
||||
{
|
||||
super(base, ess);
|
||||
teleport = new Teleport(this, ess);
|
||||
godStateBeforeAfk = isGodModeEnabled();
|
||||
afkPosition = getLocation();
|
||||
}
|
||||
|
||||
@@ -285,6 +283,22 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
return nickname.toString();
|
||||
}
|
||||
|
||||
public void setDisplayNick(String name)
|
||||
{
|
||||
setDisplayName(name);
|
||||
//TODO: Maybe we need to limit nick length, or try use a string trim.
|
||||
if (name.length() <= 16)
|
||||
{
|
||||
setPlayerListName(name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName()
|
||||
{
|
||||
return super.getDisplayName() == null ? super.getName() : super.getDisplayName();
|
||||
}
|
||||
|
||||
public Teleport getTeleport()
|
||||
{
|
||||
return teleport;
|
||||
@@ -348,16 +362,8 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
public void setAfk(final boolean set)
|
||||
{
|
||||
this.setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") ? true : set);
|
||||
if (set && !isAfk() && ess.getSettings().getFreezeAfkPlayers())
|
||||
if (set && !isAfk())
|
||||
{
|
||||
godStateBeforeAfk = isGodModeEnabled();
|
||||
setGodModeEnabled(true);
|
||||
}
|
||||
if (!set && isAfk() && ess.getSettings().getFreezeAfkPlayers())
|
||||
{
|
||||
setGodModeEnabled(godStateBeforeAfk);
|
||||
}
|
||||
if (set && !isAfk()) {
|
||||
afkPosition = getLocation();
|
||||
}
|
||||
super.setAfk(set);
|
||||
@@ -381,7 +387,8 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
this.hidden = hidden;
|
||||
}
|
||||
|
||||
public void checkJailTimeout(final long currentTime)
|
||||
//Returns true if status expired during this check
|
||||
public boolean checkJailTimeout(final long currentTime)
|
||||
{
|
||||
if (getJailTimeout() > 0 && getJailTimeout() < currentTime && isJailed())
|
||||
{
|
||||
@@ -396,26 +403,34 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void checkMuteTimeout(final long currentTime)
|
||||
//Returns true if status expired during this check
|
||||
public boolean checkMuteTimeout(final long currentTime)
|
||||
{
|
||||
if (getMuteTimeout() > 0 && getMuteTimeout() < currentTime && isMuted())
|
||||
{
|
||||
setMuteTimeout(0);
|
||||
sendMessage(Util.i18n("canTalkAgain"));
|
||||
setMuted(false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void checkBanTimeout(final long currentTime)
|
||||
//Returns true if status expired during this check
|
||||
public boolean checkBanTimeout(final long currentTime)
|
||||
{
|
||||
if (getBanTimeout() > 0 && getBanTimeout() < currentTime && isBanned())
|
||||
{
|
||||
setBanTimeout(0);
|
||||
setBanned(false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void updateActivity(final boolean broadcast)
|
||||
@@ -451,10 +466,11 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
}
|
||||
}
|
||||
final long autoafk = ess.getSettings().getAutoAfk();
|
||||
if (!isAfk() && autoafk > 0 && lastActivity + autoafk * 1000 < System.currentTimeMillis())
|
||||
if (!isAfk() && autoafk > 0 && lastActivity + autoafk * 1000 < System.currentTimeMillis() && isAuthorized("essentials.afk"))
|
||||
{
|
||||
setAfk(true);
|
||||
if (!isHidden()) {
|
||||
if (!isHidden())
|
||||
{
|
||||
ess.broadcastMessage(this, Util.format("userIsAway", getDisplayName()));
|
||||
}
|
||||
}
|
||||
@@ -468,9 +484,16 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
@Override
|
||||
public boolean toggleGodModeEnabled()
|
||||
{
|
||||
if (!isGodModeEnabled()) {
|
||||
if (!isGodModeEnabled())
|
||||
{
|
||||
setFoodLevel(20);
|
||||
}
|
||||
return super.toggleGodModeEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGodModeEnabled()
|
||||
{
|
||||
return super.isGodModeEnabled() || (isAfk() && ess.getSettings().getFreezeAfkPlayers());
|
||||
}
|
||||
}
|
||||
|
@@ -58,6 +58,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
isSocialSpyEnabled = _isSocialSpyEnabled();
|
||||
isNPC = _isNPC();
|
||||
arePowerToolsEnabled = _arePowerToolsEnabled();
|
||||
kitTimestamps = _getKitTimestamps();
|
||||
}
|
||||
private double money;
|
||||
|
||||
@@ -154,6 +155,8 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
|
||||
public void setHome(String name, Location loc)
|
||||
{
|
||||
//Invalid names will corrupt the yaml
|
||||
name = Util.sanitizeFileName(name);
|
||||
homes.put(name, loc);
|
||||
config.setProperty("homes." + name, loc);
|
||||
config.save();
|
||||
@@ -161,7 +164,12 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
|
||||
public void delHome(String name) throws Exception
|
||||
{
|
||||
if (getHome(name) != null)
|
||||
String search = name;
|
||||
if (!homes.containsKey(search))
|
||||
{
|
||||
search = Util.sanitizeFileName(name);
|
||||
}
|
||||
if (homes.containsKey(search))
|
||||
{
|
||||
homes.remove(name);
|
||||
config.removeProperty("homes." + name);
|
||||
@@ -241,12 +249,13 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
|
||||
}
|
||||
|
||||
public void clearAllPowertools() {
|
||||
public void clearAllPowertools()
|
||||
{
|
||||
powertools.clear();
|
||||
config.setProperty("powertools", powertools);
|
||||
config.save();
|
||||
}
|
||||
|
||||
|
||||
public List<String> getPowertool(ItemStack stack)
|
||||
{
|
||||
return (List<String>)powertools.get(stack.getTypeId());
|
||||
@@ -265,12 +274,11 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
config.setProperty("powertools", powertools);
|
||||
config.save();
|
||||
}
|
||||
|
||||
|
||||
public boolean hasPowerTools()
|
||||
{
|
||||
return powertools.size() > 0;
|
||||
}
|
||||
|
||||
private Location lastLocation;
|
||||
|
||||
private Location _getLastLocation()
|
||||
@@ -292,6 +300,10 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
|
||||
public void setLastLocation(Location loc)
|
||||
{
|
||||
if (loc == null || loc.getWorld() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
lastLocation = loc;
|
||||
config.setProperty("lastlocation", loc);
|
||||
config.save();
|
||||
@@ -779,31 +791,57 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
config.setProperty("npc", set);
|
||||
config.save();
|
||||
}
|
||||
|
||||
private boolean arePowerToolsEnabled;
|
||||
|
||||
|
||||
public boolean arePowerToolsEnabled()
|
||||
{
|
||||
return arePowerToolsEnabled;
|
||||
}
|
||||
|
||||
|
||||
public void setPowerToolsEnabled(boolean set)
|
||||
{
|
||||
arePowerToolsEnabled = set;
|
||||
config.setProperty("powertoolsenabled", set);
|
||||
config.save();
|
||||
}
|
||||
|
||||
|
||||
public boolean togglePowerToolsEnabled()
|
||||
{
|
||||
boolean ret = !arePowerToolsEnabled();
|
||||
setPowerToolsEnabled(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
private boolean _arePowerToolsEnabled()
|
||||
{
|
||||
return config.getBoolean("powertoolsenabled", true);
|
||||
}
|
||||
|
||||
private Map<String, Object> kitTimestamps;
|
||||
|
||||
private Map<String, Object> _getKitTimestamps()
|
||||
{
|
||||
final Object map = config.getProperty("timestamps.kits");
|
||||
|
||||
if (map instanceof Map)
|
||||
{
|
||||
return (Map<String, Object>)map;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new HashMap<String, Object>();
|
||||
}
|
||||
}
|
||||
|
||||
public Long getKitTimestamp(final String name)
|
||||
{
|
||||
final Number num = (Number)kitTimestamps.get(name.toLowerCase());
|
||||
return num == null ? null : num.longValue();
|
||||
}
|
||||
|
||||
public void setKitTimestamp(final String name, final long time)
|
||||
{
|
||||
kitTimestamps.put(name.toLowerCase(), time);
|
||||
config.setProperty("timestamps.kits", kitTimestamps);
|
||||
config.save();
|
||||
}
|
||||
}
|
||||
|
@@ -227,30 +227,36 @@ public class Util
|
||||
AIR_MATERIALS.add(Material.SAPLING.getId());
|
||||
AIR_MATERIALS.add(Material.POWERED_RAIL.getId());
|
||||
AIR_MATERIALS.add(Material.DETECTOR_RAIL.getId());
|
||||
AIR_MATERIALS.add(Material.LONG_GRASS.getId());
|
||||
AIR_MATERIALS.add(Material.DEAD_BUSH.getId());
|
||||
AIR_MATERIALS.add(Material.RAILS.getId());
|
||||
AIR_MATERIALS.add(Material.YELLOW_FLOWER.getId());
|
||||
AIR_MATERIALS.add(Material.RED_ROSE.getId());
|
||||
AIR_MATERIALS.add(Material.RED_MUSHROOM.getId());
|
||||
AIR_MATERIALS.add(Material.BROWN_MUSHROOM.getId());
|
||||
AIR_MATERIALS.add(Material.RED_MUSHROOM.getId());
|
||||
AIR_MATERIALS.add(Material.TORCH.getId());
|
||||
AIR_MATERIALS.add(Material.REDSTONE_WIRE.getId());
|
||||
AIR_MATERIALS.add(Material.SEEDS.getId());
|
||||
AIR_MATERIALS.add(Material.SIGN_POST.getId());
|
||||
AIR_MATERIALS.add(Material.WALL_SIGN.getId());
|
||||
AIR_MATERIALS.add(Material.WOODEN_DOOR.getId());
|
||||
AIR_MATERIALS.add(Material.LADDER.getId());
|
||||
AIR_MATERIALS.add(Material.SUGAR_CANE_BLOCK.getId());
|
||||
AIR_MATERIALS.add(Material.REDSTONE_WIRE.getId());
|
||||
AIR_MATERIALS.add(Material.RAILS.getId());
|
||||
AIR_MATERIALS.add(Material.WALL_SIGN.getId());
|
||||
AIR_MATERIALS.add(Material.LEVER.getId());
|
||||
AIR_MATERIALS.add(Material.STONE_PLATE.getId());
|
||||
AIR_MATERIALS.add(Material.IRON_DOOR_BLOCK.getId());
|
||||
AIR_MATERIALS.add(Material.WOOD_PLATE.getId());
|
||||
AIR_MATERIALS.add(Material.REDSTONE_TORCH_OFF.getId());
|
||||
AIR_MATERIALS.add(Material.REDSTONE_TORCH_ON.getId());
|
||||
AIR_MATERIALS.add(Material.TORCH.getId());
|
||||
AIR_MATERIALS.add(Material.SOIL.getId());
|
||||
AIR_MATERIALS.add(Material.DIODE_BLOCK_OFF.getId());
|
||||
AIR_MATERIALS.add(Material.DIODE_BLOCK_ON.getId());
|
||||
AIR_MATERIALS.add(Material.TRAP_DOOR.getId());
|
||||
AIR_MATERIALS.add(Material.STONE_BUTTON.getId());
|
||||
AIR_MATERIALS.add(Material.STONE_PLATE.getId());
|
||||
AIR_MATERIALS.add(Material.WOOD_PLATE.getId());
|
||||
AIR_MATERIALS.add(Material.IRON_DOOR_BLOCK.getId());
|
||||
AIR_MATERIALS.add(Material.WOODEN_DOOR.getId());
|
||||
AIR_MATERIALS.add(Material.SUGAR_CANE_BLOCK.getId());
|
||||
AIR_MATERIALS.add(Material.DIODE_BLOCK_OFF.getId());
|
||||
AIR_MATERIALS.add(Material.DIODE_BLOCK_ON.getId());
|
||||
AIR_MATERIALS.add(Material.TRAP_DOOR.getId());
|
||||
AIR_MATERIALS.add(Material.PUMPKIN_STEM.getId());
|
||||
AIR_MATERIALS.add(Material.MELON_STEM.getId());
|
||||
AIR_MATERIALS.add(Material.VINE.getId());
|
||||
//TODO: Add 1.9 materials
|
||||
|
||||
}
|
||||
|
||||
public static Location getSafeDestination(final Location loc) throws Exception
|
||||
@@ -260,9 +266,9 @@ public class Util
|
||||
throw new Exception(Util.i18n("destinationNotSet"));
|
||||
}
|
||||
final World world = loc.getWorld();
|
||||
int x = (int)Math.round(loc.getX());
|
||||
int x = loc.getBlockX();
|
||||
int y = (int)Math.round(loc.getY());
|
||||
int z = (int)Math.round(loc.getZ());
|
||||
int z = loc.getBlockZ();
|
||||
|
||||
while (isBlockAboveAir(world, x, y, z))
|
||||
{
|
||||
|
@@ -21,6 +21,7 @@ public final class Economy
|
||||
}
|
||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||
private static IEssentials ess;
|
||||
private static final String noCallBeforeLoad = "Essentials API is called before Essentials is loaded.";
|
||||
|
||||
/**
|
||||
* @param aEss the ess to set
|
||||
@@ -66,6 +67,10 @@ public final class Economy
|
||||
|
||||
private static User getUserByName(String name)
|
||||
{
|
||||
if (ess == null)
|
||||
{
|
||||
throw new RuntimeException(noCallBeforeLoad);
|
||||
}
|
||||
User user;
|
||||
Player player = ess.getServer().getPlayer(name);
|
||||
if (player != null)
|
||||
@@ -176,6 +181,10 @@ public final class Economy
|
||||
*/
|
||||
public static void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException
|
||||
{
|
||||
if (ess == null)
|
||||
{
|
||||
throw new RuntimeException(noCallBeforeLoad);
|
||||
}
|
||||
setMoney(name, ess.getSettings().getStartingBalance());
|
||||
}
|
||||
|
||||
@@ -231,6 +240,10 @@ public final class Economy
|
||||
*/
|
||||
public static String format(double amount)
|
||||
{
|
||||
if (ess == null)
|
||||
{
|
||||
throw new RuntimeException(noCallBeforeLoad);
|
||||
}
|
||||
return Util.formatCurrency(amount, ess);
|
||||
}
|
||||
|
||||
|
@@ -46,7 +46,7 @@ public class Commandban extends EssentialsCommand
|
||||
if (args.length > 1)
|
||||
{
|
||||
banReason = getFinalArg(args, 1);
|
||||
player.setBanReason(commandLabel);
|
||||
player.setBanReason(banReason);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -13,14 +14,24 @@ public class Commandbanip extends EssentialsCommand
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
ess.getServer().banIP(args[0]);
|
||||
sender.sendMessage(Util.i18n("banIpAddress"));
|
||||
final User u = ess.getUser(args[0]);
|
||||
|
||||
if (u == null)
|
||||
{
|
||||
ess.getServer().banIP(args[0]);
|
||||
sender.sendMessage(Util.i18n("banIpAddress"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ess.getServer().banIP(u.getAddress().getAddress().getHostAddress());
|
||||
sender.sendMessage(Util.i18n("banIpAddress"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -15,17 +15,44 @@ public class Commandcompass extends EssentialsCommand
|
||||
@Override
|
||||
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
int r = (int)user.getCorrectedYaw();
|
||||
int r = (int)(user.getLocation().getYaw() + 180 + 360) % 360;
|
||||
String dir;
|
||||
if (r < 23) dir = "N";
|
||||
else if (r < 68) dir = "NE";
|
||||
else if (r < 113) dir = "E";
|
||||
else if (r < 158) dir = "SE";
|
||||
else if (r < 203) dir = "S";
|
||||
else if (r < 248) dir = "SW";
|
||||
else if (r < 293) dir = "W";
|
||||
else if (r < 338) dir = "NW";
|
||||
else dir = "N";
|
||||
if (r < 23)
|
||||
{
|
||||
dir = "N";
|
||||
}
|
||||
else if (r < 68)
|
||||
{
|
||||
dir = "NE";
|
||||
}
|
||||
else if (r < 113)
|
||||
{
|
||||
dir = "E";
|
||||
}
|
||||
else if (r < 158)
|
||||
{
|
||||
dir = "SE";
|
||||
}
|
||||
else if (r < 203)
|
||||
{
|
||||
dir = "S";
|
||||
}
|
||||
else if (r < 248)
|
||||
{
|
||||
dir = "SW";
|
||||
}
|
||||
else if (r < 293)
|
||||
{
|
||||
dir = "W";
|
||||
}
|
||||
else if (r < 338)
|
||||
{
|
||||
dir = "NW";
|
||||
}
|
||||
else
|
||||
{
|
||||
dir = "N";
|
||||
}
|
||||
user.sendMessage(Util.format("compassBearing", dir, r));
|
||||
}
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ public class Commanddelhome extends EssentialsCommand
|
||||
}
|
||||
else if (args.length > 1 && (user == null || user.isAuthorized("essentials.delhome.others")))
|
||||
{
|
||||
user = getPlayer(server, args, 0);
|
||||
user = getPlayer(server, args, 0, true);
|
||||
name = args[1];
|
||||
}
|
||||
else
|
||||
|
@@ -56,7 +56,6 @@ public class Commandessentials extends EssentialsCommand
|
||||
}
|
||||
final String tuneStr = "1D#,1E,2F#,,2A#,1E,1D#,1E,2F#,2B,2D#,2E,2D#,2A#,2B,,2F#,,1D#,1E,2F#,2B,2C#,2A#,2B,2C#,2E,2D#,2E,2C#,,2F#,,2G#,,1D,1D#,,1C#,1D,1C#,1B,,1B,,1C#,,1D,,1D,1C#,1B,1C#,1D#,2F#,2G#,1D#,2F#,1C#,1D#,1B,1C#,1B,1D#,,2F#,,2G#,1D#,2F#,1C#,1D#,1B,1D,1D#,1D,1C#,1B,1C#,1D,,1B,1C#,1D#,2F#,1C#,1D,1C#,1B,1C#,,1B,,1C#,,2F#,,2G#,,1D,1D#,,1C#,1D,1C#,1B,,1B,,1C#,,1D,,1D,1C#,1B,1C#,1D#,2F#,2G#,1D#,2F#,1C#,1D#,1B,1C#,1B,1D#,,2F#,,2G#,1D#,2F#,1C#,1D#,1B,1D,1D#,1D,1C#,1B,1C#,1D,,1B,1C#,1D#,2F#,1C#,1D,1C#,1B,1C#,,1B,,1B,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1A#,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1F#,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1A#,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1F#,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1A#,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1F#,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1A#,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1F#,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1B,,";
|
||||
final String[] tune = tuneStr.split(",");
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
final Location loc = player.getLocation();
|
||||
@@ -91,7 +90,7 @@ public class Commandessentials extends EssentialsCommand
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
Block block = noteBlocks.get(player);
|
||||
if (block == null)
|
||||
if (block == null || block.getType() != Material.NOTE_BLOCK)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -110,7 +109,10 @@ public class Commandessentials extends EssentialsCommand
|
||||
ess.getScheduler().cancelTask(taskid);
|
||||
for (Block block : noteBlocks.values())
|
||||
{
|
||||
block.setType(Material.AIR);
|
||||
if (block.getType() == Material.NOTE_BLOCK)
|
||||
{
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
noteBlocks.clear();
|
||||
}
|
||||
|
@@ -16,10 +16,10 @@ public class Commandgetpos extends EssentialsCommand
|
||||
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
Location coords = user.getLocation();
|
||||
user.sendMessage("§7X: " + coords.getBlockX() + " (-North <-> +South)");
|
||||
user.sendMessage("§7X: " + coords.getBlockX() + " (+East <-> -West)");
|
||||
user.sendMessage("§7Y: " + coords.getBlockY() + " (+Up <-> -Down)");
|
||||
user.sendMessage("§7Z: " + coords.getBlockZ() + " (+East <-> -West)");
|
||||
user.sendMessage("§7Yaw: " + user.getCorrectedYaw() + " (Rotation)");
|
||||
user.sendMessage("§7Z: " + coords.getBlockZ() + " (+South <-> -North)");
|
||||
user.sendMessage("§7Yaw: " + (coords.getYaw() + 180 + 360) % 360 + " (Rotation)");
|
||||
user.sendMessage("§7Pitch: " + coords.getPitch() + " (Head angle)");
|
||||
}
|
||||
}
|
||||
|
@@ -34,6 +34,7 @@ public class Commandheal extends EssentialsCommand
|
||||
user.healCooldown();
|
||||
}
|
||||
user.setHealth(20);
|
||||
user.setFoodLevel(20);
|
||||
user.sendMessage(Util.i18n("heal"));
|
||||
}
|
||||
|
||||
|
@@ -45,18 +45,18 @@ public class Commandhome extends EssentialsCommand
|
||||
catch (NotEnoughArgumentsException e)
|
||||
{
|
||||
List<String> homes = u.getHomes();
|
||||
if (homes.isEmpty())
|
||||
if (homes.isEmpty() && u.equals(user) && ess.getSettings().spawnIfNoHome())
|
||||
{
|
||||
user.getTeleport().respawn(ess.getSpawn(), charge);
|
||||
}
|
||||
else if (homes.isEmpty())
|
||||
{
|
||||
throw new Exception(u == user ? Util.i18n("noHomeSet") : Util.i18n("noHomeSetPlayer"));
|
||||
}
|
||||
else if ((homes.size() == 1) && u == user)
|
||||
else if (homes.size() == 1 && u.equals(user))
|
||||
{
|
||||
user.getTeleport().home(u, homes.get(0), charge);
|
||||
}
|
||||
else if (ess.getSettings().spawnIfNoHome())
|
||||
{
|
||||
user.getTeleport().respawn(ess.getSpawn(), charge);
|
||||
}
|
||||
else
|
||||
{
|
||||
user.sendMessage(Util.format("homes", Util.joinList(homes)));
|
||||
|
@@ -49,5 +49,6 @@ public class Commandinvsee extends EssentialsCommand
|
||||
user.getInventory().setContents(invUserStack);
|
||||
user.sendMessage(Util.format("invSee", invUser.getDisplayName()));
|
||||
user.sendMessage(Util.i18n("invSeeHelp"));
|
||||
throw new NoChargeException();
|
||||
}
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ import com.earth2me.essentials.Util;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
|
||||
public class Commandkill extends EssentialsCommand
|
||||
@@ -23,6 +24,13 @@ public class Commandkill extends EssentialsCommand
|
||||
|
||||
for (Player p : server.matchPlayer(args[0]))
|
||||
{
|
||||
final EntityDamageEvent ede = new EntityDamageEvent(p, sender instanceof Player && ((Player)sender).getName().equals(p.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, 1000);
|
||||
server.getPluginManager().callEvent(ede);
|
||||
if (ede.isCancelled() && !sender.hasPermission("essentials.kill.force"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
p.setHealth(0);
|
||||
sender.sendMessage(Util.format("kill", p.getDisplayName()));
|
||||
}
|
||||
|
@@ -15,22 +15,20 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Commandkit extends EssentialsCommand
|
||||
{
|
||||
static private final Map<User, Map<String, Long>> kitPlayers = new HashMap<User, Map<String, Long>>();
|
||||
|
||||
public Commandkit()
|
||||
{
|
||||
super("kit");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
Map<String, Object> kits = ess.getSettings().getKits();
|
||||
StringBuilder list = new StringBuilder();
|
||||
final Map<String, Object> kits = ess.getSettings().getKits();
|
||||
final StringBuilder list = new StringBuilder();
|
||||
for (String k : kits.keySet())
|
||||
{
|
||||
if (user.isAuthorized("essentials.kit." + k.toLowerCase()))
|
||||
@@ -56,8 +54,8 @@ public class Commandkit extends EssentialsCommand
|
||||
{
|
||||
try
|
||||
{
|
||||
String kitName = args[0].toLowerCase();
|
||||
Object kit = ess.getSettings().getKit(kitName);
|
||||
final String kitName = args[0].toLowerCase();
|
||||
final Object kit = ess.getSettings().getKit(kitName);
|
||||
List<String> items;
|
||||
|
||||
if (!user.isAuthorized("essentials.kit." + kitName))
|
||||
@@ -70,39 +68,26 @@ public class Commandkit extends EssentialsCommand
|
||||
{
|
||||
|
||||
//System.out.println("Kit is timed");
|
||||
Map<String, Object> els = (Map<String, Object>)kit;
|
||||
final Map<String, Object> els = (Map<String, Object>)kit;
|
||||
items = (List<String>)els.get("items");
|
||||
double delay = els.containsKey("delay") ? ((Number)els.get("delay")).doubleValue() : 0L;
|
||||
Calendar c = new GregorianCalendar();
|
||||
c.add(Calendar.SECOND, (int)delay);
|
||||
c.add(Calendar.MILLISECOND, (int)((delay*1000.0)%1000.0));
|
||||
final double delay = els.containsKey("delay") ? ((Number)els.get("delay")).doubleValue() : 0L;
|
||||
final Calendar c = new GregorianCalendar();
|
||||
c.add(Calendar.SECOND, -(int)delay);
|
||||
c.add(Calendar.MILLISECOND, -(int)((delay*1000.0)%1000.0));
|
||||
|
||||
long time = c.getTimeInMillis();
|
||||
Calendar now = new GregorianCalendar();
|
||||
|
||||
Map<String, Long> kitTimes;
|
||||
if (!kitPlayers.containsKey(user))
|
||||
{
|
||||
kitTimes = new HashMap<String, Long>();
|
||||
kitTimes.put(kitName, time);
|
||||
kitPlayers.put(user, kitTimes);
|
||||
}
|
||||
else
|
||||
{
|
||||
kitTimes = kitPlayers.get(user);
|
||||
if (!kitTimes.containsKey(kitName))
|
||||
{
|
||||
kitTimes.put(kitName, time);
|
||||
}
|
||||
else if (kitTimes.get(kitName) < now.getTimeInMillis())
|
||||
{
|
||||
kitTimes.put(kitName, time);
|
||||
}
|
||||
else
|
||||
{
|
||||
user.sendMessage(Util.format("kitTimed", Util.formatDateDiff(kitTimes.get(kitName))));
|
||||
return;
|
||||
}
|
||||
final long mintime = c.getTimeInMillis();
|
||||
|
||||
final Long lastTime = user.getKitTimestamp(kitName);
|
||||
if (lastTime == null || lastTime < mintime) {
|
||||
final Calendar now = new GregorianCalendar();
|
||||
user.setKitTimestamp(kitName, now.getTimeInMillis());
|
||||
} else {
|
||||
final Calendar future = new GregorianCalendar();
|
||||
future.setTimeInMillis(lastTime);
|
||||
future.add(Calendar.SECOND, (int)delay);
|
||||
future.add(Calendar.MILLISECOND, (int)((delay*1000.0)%1000.0));
|
||||
user.sendMessage(Util.format("kitTimed", Util.formatDateDiff(future.getTimeInMillis())));
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -110,7 +95,7 @@ public class Commandkit extends EssentialsCommand
|
||||
items = (List<String>)kit;
|
||||
}
|
||||
|
||||
Trade charge = new Trade("kit-" + kitName, ess);
|
||||
final Trade charge = new Trade("kit-" + kitName, ess);
|
||||
try
|
||||
{
|
||||
charge.isAffordableFor(user);
|
||||
@@ -124,11 +109,11 @@ public class Commandkit extends EssentialsCommand
|
||||
boolean spew = false;
|
||||
for (String d : items)
|
||||
{
|
||||
String[] parts = d.split("[^0-9]+", 3);
|
||||
int id = Material.getMaterial(Integer.parseInt(parts[0])).getId();
|
||||
int amount = parts.length > 1 ? Integer.parseInt(parts[parts.length > 2 ? 2 : 1]) : 1;
|
||||
short data = parts.length > 2 ? Short.parseShort(parts[1]) : 0;
|
||||
HashMap<Integer,ItemStack> overfilled = user.getInventory().addItem(new ItemStack(id, amount, data));
|
||||
final String[] parts = d.split("[^0-9]+", 3);
|
||||
final int id = Material.getMaterial(Integer.parseInt(parts[0])).getId();
|
||||
final int amount = parts.length > 1 ? Integer.parseInt(parts[parts.length > 2 ? 2 : 1]) : 1;
|
||||
final short data = parts.length > 2 ? Short.parseShort(parts[1]) : 0;
|
||||
final HashMap<Integer,ItemStack> overfilled = user.getInventory().addItem(new ItemStack(id, amount, data));
|
||||
for (ItemStack itemStack : overfilled.values())
|
||||
{
|
||||
user.getWorld().dropItemNaturally(user.getLocation(), itemStack);
|
||||
|
@@ -5,6 +5,7 @@ import org.bukkit.Server;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
@@ -23,13 +24,15 @@ public class Commandmail extends EssentialsCommand
|
||||
List<String> mail = user.getMails();
|
||||
if (mail.isEmpty())
|
||||
{
|
||||
throw new Exception(Util.i18n("noMail"));
|
||||
user.sendMessage(Util.i18n("noMail"));
|
||||
throw new NoChargeException();
|
||||
}
|
||||
for (String s : mail)
|
||||
{
|
||||
user.sendMessage(s);
|
||||
}
|
||||
throw new Exception(Util.i18n("mailClear"));
|
||||
user.sendMessage(Util.i18n("mailClear"));
|
||||
return;
|
||||
}
|
||||
if (args.length >= 3 && "send".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
@@ -62,7 +65,63 @@ public class Commandmail extends EssentialsCommand
|
||||
if (args.length >= 1 && "clear".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
user.setMails(null);
|
||||
throw new Exception(Util.i18n("mailCleared"));
|
||||
user.sendMessage(Util.i18n("mailCleared"));
|
||||
return;
|
||||
}
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
if (args.length >= 1 && "read".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
throw new Exception(Util.format("onlyPlayers", commandLabel + " read"));
|
||||
}
|
||||
else if (args.length >= 1 && "clear".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
throw new Exception(Util.format("onlyPlayers", commandLabel + " clear"));
|
||||
}
|
||||
else if (args.length >= 3 && "send".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
Player player = server.getPlayer(args[1]);
|
||||
User u;
|
||||
if (player != null)
|
||||
{
|
||||
u = ess.getUser(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
u = ess.getOfflineUser(args[1]);
|
||||
}
|
||||
if (u == null)
|
||||
{
|
||||
throw new Exception(Util.format("playerNeverOnServer", args[1]));
|
||||
}
|
||||
u.addMail("Server: " + getFinalArg(args, 2));
|
||||
sender.sendMessage(Util.i18n("mailSent"));
|
||||
return;
|
||||
}
|
||||
else if (args.length >= 2)
|
||||
{
|
||||
//allow sending from console without "send" argument, since it's the only thing the console can do
|
||||
Player player = server.getPlayer(args[0]);
|
||||
User u;
|
||||
if (player != null)
|
||||
{
|
||||
u = ess.getUser(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
u = ess.getOfflineUser(args[0]);
|
||||
}
|
||||
if (u == null)
|
||||
{
|
||||
throw new Exception(Util.format("playerNeverOnServer", args[0]));
|
||||
}
|
||||
u.addMail("Server: " + getFinalArg(args, 1));
|
||||
sender.sendMessage(Util.i18n("mailSent"));
|
||||
return;
|
||||
}
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ public class Commandnick extends EssentialsCommand
|
||||
String nick = args[0];
|
||||
if ("off".equalsIgnoreCase(nick) || user.getName().equalsIgnoreCase(nick))
|
||||
{
|
||||
user.setDisplayName(user.getName());
|
||||
user.setDisplayNick(user.getName());
|
||||
user.setNickname(null);
|
||||
user.sendMessage(Util.i18n("nickNoMore"));
|
||||
return;
|
||||
@@ -67,7 +67,7 @@ public class Commandnick extends EssentialsCommand
|
||||
}
|
||||
}
|
||||
|
||||
user.setDisplayName(ess.getSettings().getNicknamePrefix() + nick);
|
||||
user.setDisplayNick(ess.getSettings().getNicknamePrefix() + nick);
|
||||
user.setNickname(nick);
|
||||
user.sendMessage(Util.format("nickSet", user.getDisplayName() + "§7."));
|
||||
}
|
||||
@@ -95,13 +95,13 @@ public class Commandnick extends EssentialsCommand
|
||||
String nick = args[1];
|
||||
if ("off".equalsIgnoreCase(nick) || target.getName().equalsIgnoreCase(nick))
|
||||
{
|
||||
target.setDisplayName(target.getName());
|
||||
target.setDisplayNick(target.getName());
|
||||
target.setNickname(null);
|
||||
target.sendMessage(Util.i18n("nickNoMore"));
|
||||
}
|
||||
else
|
||||
{
|
||||
target.setDisplayName(ess.getSettings().getNicknamePrefix() + nick);
|
||||
target.setDisplayNick(ess.getSettings().getNicknamePrefix() + nick);
|
||||
target.setNickname(nick);
|
||||
target.sendMessage(Util.format("nickSet", target.getDisplayName() + "§7."));
|
||||
}
|
||||
|
22
Essentials/src/com/earth2me/essentials/commands/Commandptime.java
Executable file → Normal file
22
Essentials/src/com/earth2me/essentials/commands/Commandptime.java
Executable file → Normal file
@@ -11,7 +11,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -97,29 +96,31 @@ public class Commandptime extends EssentialsCommand
|
||||
*/
|
||||
private void getUsersTime(final CommandSender sender, final Collection<User> users)
|
||||
{
|
||||
if (users.size() > 1)
|
||||
if (users.size() > 1)
|
||||
{
|
||||
sender.sendMessage(Util.format("pTimePlayers"));
|
||||
}
|
||||
|
||||
for (User user : users)
|
||||
|
||||
for (User user : users)
|
||||
{
|
||||
if(user.getPlayerTimeOffset() == 0)
|
||||
if (user.getPlayerTimeOffset() == 0)
|
||||
{
|
||||
sender.sendMessage(Util.format("pTimeNormal", user.getName()));
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
String time = DescParseTickFormat.format(user.getPlayerTime());
|
||||
if(!user.isPlayerTimeRelative())
|
||||
if (!user.isPlayerTimeRelative())
|
||||
{
|
||||
sender.sendMessage(Util.format("pTimeCurrentFixed", user.getName(), time));
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
sender.sendMessage(Util.format("pTimeCurrent", user.getName(), time));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -177,7 +178,8 @@ public class Commandptime extends EssentialsCommand
|
||||
{
|
||||
sender.sendMessage(Util.format("pTimeSetFixed", time, msg.toString()));
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
sender.sendMessage(Util.format("pTimeSet", time, msg.toString()));
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
@@ -15,7 +16,7 @@ public class Commandrealname extends EssentialsCommand
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
||||
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
@@ -36,7 +37,7 @@ public class Commandrealname extends EssentialsCommand
|
||||
{
|
||||
continue;
|
||||
}
|
||||
user.sendMessage(u.getDisplayName() + " " + Util.i18n("is") + " " + u.getName());
|
||||
sender.sendMessage(u.getDisplayName() + " " + Util.i18n("is") + " " + u.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -30,6 +30,10 @@ public class Commandrepair extends EssentialsCommand
|
||||
if (args[0].equalsIgnoreCase("hand"))
|
||||
{
|
||||
final ItemStack item = user.getItemInHand();
|
||||
if (item == null)
|
||||
{
|
||||
throw new Exception(Util.i18n("repairInvalidType"));
|
||||
}
|
||||
final String itemName = item.getType().toString().toLowerCase();
|
||||
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess);
|
||||
|
||||
@@ -84,6 +88,10 @@ public class Commandrepair extends EssentialsCommand
|
||||
{
|
||||
for (ItemStack item : items)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
final String itemName = item.getType().toString().toLowerCase();
|
||||
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess);
|
||||
try
|
||||
|
@@ -28,14 +28,14 @@ public class Commandsethome extends EssentialsCommand
|
||||
{
|
||||
if (user.isAuthorized("essentials.sethome.multiple"))
|
||||
{
|
||||
if ((user.isAuthorized("essentials.sethome.multiple.unlimited")) || (user.getHomes().size() < ess.getSettings().getMultipleHomes())
|
||||
if ((user.isAuthorized("essentials.sethome.multiple.unlimited")) || (user.getHomes().size() < ess.getSettings().getHomeLimit(user))
|
||||
|| (user.getHomes().contains(args[0].toLowerCase())))
|
||||
{
|
||||
user.setHome(args[0].toLowerCase());
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(Util.format("maxHomes", ess.getSettings().getMultipleHomes()));
|
||||
throw new Exception(Util.format("maxHomes", ess.getSettings().getHomeLimit(user)));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -56,11 +56,6 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
}
|
||||
}
|
||||
|
||||
if (ess.getSettings().getProtectPreventSpawn(mobType.toLowerCase())
|
||||
|| (mountType != null && ess.getSettings().getProtectPreventSpawn(mountType.toLowerCase())))
|
||||
{
|
||||
throw new Exception(Util.i18n("unableToSpawnMob"));
|
||||
}
|
||||
|
||||
Entity spawnedMob = null;
|
||||
Mob mob = null;
|
||||
@@ -72,6 +67,12 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
{
|
||||
throw new Exception(Util.i18n("invalidMob"));
|
||||
}
|
||||
|
||||
if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase()))
|
||||
{
|
||||
throw new Exception(Util.i18n("unableToSpawnMob"));
|
||||
}
|
||||
|
||||
int[] ignore =
|
||||
{
|
||||
8, 9
|
||||
@@ -79,8 +80,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
Block block = (new TargetBlock(user, 300, 0.2, ignore)).getTargetBlock();
|
||||
if (block == null)
|
||||
{
|
||||
user.sendMessage(Util.i18n("unableToSpawnMob"));
|
||||
return;
|
||||
throw new Exception(Util.i18n("unableToSpawnMob"));
|
||||
}
|
||||
Location loc = block.getLocation();
|
||||
Location sloc = Util.getSafeDestination(loc);
|
||||
@@ -90,8 +90,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
}
|
||||
catch (MobException e)
|
||||
{
|
||||
user.sendMessage(Util.i18n("unableToSpawnMob"));
|
||||
return;
|
||||
throw new Exception(Util.i18n("unableToSpawnMob"));
|
||||
}
|
||||
|
||||
if (mountType != null)
|
||||
@@ -102,14 +101,18 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
user.sendMessage(Util.i18n("invalidMob"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (ess.getSettings().getProtectPreventSpawn(mobMount.getType().toString().toLowerCase()))
|
||||
{
|
||||
throw new Exception(Util.i18n("unableToSpawnMob"));
|
||||
}
|
||||
try
|
||||
{
|
||||
spawnedMount = mobMount.spawn(user, server, loc);
|
||||
}
|
||||
catch (MobException e)
|
||||
{
|
||||
user.sendMessage(Util.i18n("unableToSpawnMob"));
|
||||
return;
|
||||
throw new Exception(Util.i18n("unableToSpawnMob"));
|
||||
}
|
||||
spawnedMob.setPassenger(spawnedMount);
|
||||
}
|
||||
@@ -144,8 +147,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
}
|
||||
catch (MobException e)
|
||||
{
|
||||
user.sendMessage(Util.i18n("unableToSpawnMob"));
|
||||
return;
|
||||
throw new Exception(Util.i18n("unableToSpawnMob"));
|
||||
}
|
||||
spawnedMob.setPassenger(spawnedMount);
|
||||
}
|
||||
|
4
Essentials/src/com/earth2me/essentials/commands/Commandtime.java
Executable file → Normal file
4
Essentials/src/com/earth2me/essentials/commands/Commandtime.java
Executable file → Normal file
@@ -25,7 +25,7 @@ public class Commandtime extends EssentialsCommand
|
||||
{
|
||||
worldSelector = args[1];
|
||||
}
|
||||
Set<World> worlds = getWorlds(server, sender, worldSelector);
|
||||
final Set<World> worlds = getWorlds(server, sender, worldSelector);
|
||||
|
||||
// If no arguments we are reading the time
|
||||
if (args.length == 0)
|
||||
@@ -34,7 +34,7 @@ public class Commandtime extends EssentialsCommand
|
||||
return;
|
||||
}
|
||||
|
||||
User user = ess.getUser(sender);
|
||||
final User user = ess.getUser(sender);
|
||||
if (user != null && !user.isAuthorized("essentials.time.set"))
|
||||
{
|
||||
user.sendMessage(Util.i18n("timeSetPermission"));
|
||||
|
@@ -21,11 +21,9 @@ public class Commandunban extends EssentialsCommand
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
String name;
|
||||
try
|
||||
{
|
||||
User u = getPlayer(server, args, 0, true);
|
||||
name = u.getName();
|
||||
final User u = getPlayer(server, args, 0, true);
|
||||
u.setBanned(false);
|
||||
sender.sendMessage(Util.i18n("unbannedPlayer"));
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
public class Commandweather extends EssentialsCommand
|
||||
@@ -29,16 +30,50 @@ public class Commandweather extends EssentialsCommand
|
||||
world.setStorm(isStorm ? true : false);
|
||||
world.setWeatherDuration(Integer.parseInt(args[1]) * 20);
|
||||
user.sendMessage(isStorm
|
||||
? Util.format("weatherStormFor", args[1])
|
||||
: Util.format("weatherSunFor", args[1]));
|
||||
? Util.format("weatherStormFor", world.getName(), args[1])
|
||||
: Util.format("weatherSunFor", world.getName(), args[1]));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
world.setStorm(isStorm ? true : false);
|
||||
user.sendMessage(isStorm
|
||||
? Util.i18n("weatherStorm")
|
||||
: Util.i18n("weatherSun"));
|
||||
? Util.format("weatherStorm", world.getName())
|
||||
: Util.format("weatherSun", world.getName()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 2) //running from console means inserting a world arg before other args
|
||||
{
|
||||
throw new Exception("When running from console, usage is: /" + commandLabel + " <world> <storm/sun> [duration]");
|
||||
}
|
||||
|
||||
boolean isStorm = args[1].equalsIgnoreCase("storm");
|
||||
World world = server.getWorld(args[0]);
|
||||
if (world == null)
|
||||
{
|
||||
throw new Exception("World named " + args[0] + " not found!");
|
||||
}
|
||||
if (args.length > 2)
|
||||
{
|
||||
|
||||
world.setStorm(isStorm ? true : false);
|
||||
world.setWeatherDuration(Integer.parseInt(args[2]) * 20);
|
||||
sender.sendMessage(isStorm
|
||||
? Util.format("weatherStormFor", world.getName(), args[2])
|
||||
: Util.format("weatherSunFor", world.getName(), args[2]));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
world.setStorm(isStorm ? true : false);
|
||||
sender.sendMessage(isStorm
|
||||
? Util.format("weatherStorm", world.getName())
|
||||
: Util.format("weatherSun", world.getName()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@@ -17,26 +17,28 @@ public class Commandworld extends EssentialsCommand
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
World world;
|
||||
List<World> worlds = server.getWorlds();
|
||||
|
||||
if (args.length < 1)
|
||||
{
|
||||
World nether = server.getWorld(ess.getSettings().getNetherName());
|
||||
if (nether == null) {
|
||||
for (World world2 : worlds)
|
||||
World nether = null;
|
||||
|
||||
final List<World> worlds = server.getWorlds();
|
||||
|
||||
for (World world2 : worlds)
|
||||
{
|
||||
if (world2.getEnvironment() == World.Environment.NETHER)
|
||||
{
|
||||
if (world2.getEnvironment() == World.Environment.NETHER) {
|
||||
nether = world2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nether == null) {
|
||||
return;
|
||||
nether = world2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nether == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
world = user.getWorld() == nether ? worlds.get(0) : nether;
|
||||
}
|
||||
else
|
||||
@@ -54,23 +56,22 @@ public class Commandworld extends EssentialsCommand
|
||||
double factor;
|
||||
if (user.getWorld().getEnvironment() == World.Environment.NETHER && world.getEnvironment() == World.Environment.NORMAL)
|
||||
{
|
||||
factor = ess.getSettings().getNetherRatio();
|
||||
factor = 8.0;
|
||||
}
|
||||
else if (user.getWorld().getEnvironment() != world.getEnvironment())
|
||||
else if (user.getWorld().getEnvironment() == World.Environment.NORMAL && world.getEnvironment() == World.Environment.NETHER)
|
||||
{
|
||||
factor = 1.0 / ess.getSettings().getNetherRatio();
|
||||
factor = 1.0 / 8.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
factor = 1.0;
|
||||
}
|
||||
|
||||
Location loc = user.getLocation();
|
||||
loc = new Location(world, loc.getBlockX() * factor + .5, loc.getBlockY(), loc.getBlockZ() * factor + .5);
|
||||
final Location loc = user.getLocation();
|
||||
final Location target = new Location(world, loc.getBlockX() * factor + .5, loc.getBlockY(), loc.getBlockZ() * factor + .5);
|
||||
|
||||
Trade charge = new Trade(this.getName(), ess);
|
||||
final Trade charge = new Trade(this.getName(), ess);
|
||||
charge.isAffordableFor(user);
|
||||
user.getTeleport().teleport(loc, charge);
|
||||
user.getTeleport().teleport(target, charge);
|
||||
throw new NoChargeException();
|
||||
}
|
||||
}
|
||||
|
@@ -3,6 +3,8 @@ package com.earth2me.essentials.commands;
|
||||
import org.bukkit.Server;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
@@ -33,7 +35,7 @@ public class Commandworth extends EssentialsCommand
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
amount = 64;
|
||||
amount = is.getType().getMaxStackSize();
|
||||
}
|
||||
|
||||
is.setAmount(amount);
|
||||
@@ -56,4 +58,49 @@ public class Commandworth extends EssentialsCommand
|
||||
amount,
|
||||
Util.formatCurrency(worth, ess)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
ItemStack is = ess.getItemDb().get(args[0]);
|
||||
int amount = is.getAmount();
|
||||
|
||||
try
|
||||
{
|
||||
if (args.length > 1)
|
||||
{
|
||||
amount = Integer.parseInt(args[1]);
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
amount = is.getType().getMaxStackSize();
|
||||
}
|
||||
|
||||
is.setAmount(amount);
|
||||
double worth = ess.getWorth().getPrice(is);
|
||||
if (Double.isNaN(worth))
|
||||
{
|
||||
throw new Exception(Util.i18n("itemCannotBeSold"));
|
||||
}
|
||||
|
||||
sender.sendMessage(is.getDurability() != 0
|
||||
? Util.format("worthMeta",
|
||||
is.getType().toString().toLowerCase().replace("_", ""),
|
||||
is.getDurability(),
|
||||
Util.formatCurrency(worth * amount, ess),
|
||||
amount,
|
||||
Util.formatCurrency(worth, ess))
|
||||
: Util.format("worth",
|
||||
is.getType().toString().toLowerCase().replace("_", ""),
|
||||
Util.formatCurrency(worth * amount, ess),
|
||||
amount,
|
||||
Util.formatCurrency(worth, ess)));
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -55,7 +55,7 @@ public class BPermissionsHandler implements IPermissionsHandler
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group)
|
||||
{
|
||||
return hasPermission(base, "bPermissions.build");
|
||||
return hasPermission(base, "essentials.build") || hasPermission(base, "bPermissions.build");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -74,4 +74,10 @@ public class PermissionsBukkitHandler extends SuperpermsHandler
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(Player base, String group)
|
||||
{
|
||||
return base.hasPermission("essentials.build") || base.hasPermission("permissions.build");
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
||||
/**
|
||||
* Method.java
|
||||
* Interface to be implemented by a payment method.
|
||||
*
|
||||
* @author Nijikokun <nijikokun@shortmail.com> (@nijikokun)
|
||||
* @copyright Copyright (C) 2011
|
||||
@@ -41,6 +41,14 @@ public interface Method
|
||||
*/
|
||||
public String getVersion();
|
||||
|
||||
/**
|
||||
* Returns the amount of decimal places that get stored
|
||||
* NOTE: it will return -1 if there is no rounding
|
||||
*
|
||||
* @return <code>int</code> for each decimal place
|
||||
*/
|
||||
public int fractionalDigits();
|
||||
|
||||
/**
|
||||
* Formats amounts into this payment methods style of currency display.
|
||||
*
|
||||
@@ -82,6 +90,23 @@ public interface Method
|
||||
*/
|
||||
public boolean hasBankAccount(String bank, String name);
|
||||
|
||||
/**
|
||||
* Forces an account creation
|
||||
*
|
||||
* @param name Account name
|
||||
* @return <code>boolean</code>
|
||||
*/
|
||||
public boolean createAccount(String name);
|
||||
|
||||
/**
|
||||
* Forces an account creation
|
||||
*
|
||||
* @param name Account name
|
||||
* @param balance Initial account balance
|
||||
* @return <code>boolean</code>
|
||||
*/
|
||||
public boolean createAccount(String name, Double balance);
|
||||
|
||||
/**
|
||||
* Returns a <code>MethodAccount</code> class for an account <code>name</code>.
|
||||
*
|
||||
|
@@ -2,12 +2,10 @@ package com.earth2me.essentials.register.payment;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
* The <code>Methods</code> initializes Methods that utilize the Method interface
|
||||
@@ -15,15 +13,13 @@ import java.util.Set;
|
||||
*
|
||||
* Allowing you to check whether a payment method exists or not.
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* Methods methods = new Methods();
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* Methods also allows you to set a preferred method of payment before it captures
|
||||
* payment plugins in the initialization process.
|
||||
*
|
||||
* in <code>bukkit.yml</code>:
|
||||
* <blockquote><pre>
|
||||
* Methods methods = new Methods("iConomy");
|
||||
* economy:
|
||||
* preferred: "iConomy"
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* @author: Nijikokun <nijikokun@shortmail.com> (@nijikokun)
|
||||
@@ -32,51 +28,62 @@ import java.util.Set;
|
||||
*/
|
||||
public class Methods
|
||||
{
|
||||
private boolean self = false;
|
||||
private Method Method = null;
|
||||
private String preferred = "";
|
||||
private Set<Method> Methods = new HashSet<Method>();
|
||||
private Set<String> Dependencies = new HashSet<String>();
|
||||
private Set<Method> Attachables = new HashSet<Method>();
|
||||
private static String version = null;
|
||||
private static boolean self = false;
|
||||
private static Method Method = null;
|
||||
private static String preferred = "";
|
||||
private static Set<Method> Methods = new HashSet<Method>();
|
||||
private static Set<String> Dependencies = new HashSet<String>();
|
||||
private static Set<Method> Attachables = new HashSet<Method>();
|
||||
|
||||
/**
|
||||
* Initialize Method class
|
||||
*/
|
||||
public Methods()
|
||||
static
|
||||
{
|
||||
this._init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes <code>Methods</code> class utilizing a "preferred" payment method check before
|
||||
* returning the first method that was initialized.
|
||||
*
|
||||
* @param preferred Payment method that is most preferred for this setup.
|
||||
*/
|
||||
public Methods(String preferred)
|
||||
{
|
||||
this._init();
|
||||
|
||||
if (this.Dependencies.contains(preferred))
|
||||
{
|
||||
this.preferred = preferred;
|
||||
}
|
||||
_init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement all methods along with their respective name & class.
|
||||
*
|
||||
* @see #Methods()
|
||||
* @see #Methods(java.lang.String)
|
||||
*/
|
||||
private void _init()
|
||||
private static void _init()
|
||||
{
|
||||
this.addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo4());
|
||||
this.addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo5());
|
||||
this.addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo6());
|
||||
this.addMethod("BOSEconomy", new com.earth2me.essentials.register.payment.methods.BOSE6());
|
||||
this.addMethod("BOSEconomy", new com.earth2me.essentials.register.payment.methods.BOSE7());
|
||||
this.addMethod("MultiCurrency", new com.earth2me.essentials.register.payment.methods.MCUR());
|
||||
addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo6());
|
||||
addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo5());
|
||||
addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo4());
|
||||
addMethod("BOSEconomy", new com.earth2me.essentials.register.payment.methods.BOSE6());
|
||||
addMethod("BOSEconomy", new com.earth2me.essentials.register.payment.methods.BOSE7());
|
||||
addMethod("Currency", new com.earth2me.essentials.register.payment.methods.MCUR());
|
||||
Dependencies.add("MultiCurrency");
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by the plugin to setup version
|
||||
*
|
||||
* @param v version
|
||||
*/
|
||||
public static void setVersion(String v)
|
||||
{
|
||||
version = v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use to reset methods during disable
|
||||
*/
|
||||
public static void reset()
|
||||
{
|
||||
version = null;
|
||||
self = false;
|
||||
Method = null;
|
||||
preferred = "";
|
||||
Attachables.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Use to get version of Register plugin
|
||||
* @return version
|
||||
*/
|
||||
public static String getVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +93,7 @@ public class Methods
|
||||
* @return <code>Set<String></code> - Array of payment methods that are loaded.
|
||||
* @see #setMethod(org.bukkit.plugin.Plugin)
|
||||
*/
|
||||
public Set<String> getDependencies()
|
||||
public static Set<String> getDependencies()
|
||||
{
|
||||
return Dependencies;
|
||||
}
|
||||
@@ -98,7 +105,7 @@ public class Methods
|
||||
* @param plugin Plugin data from bukkit, Internal Class file.
|
||||
* @return Method <em>or</em> Null
|
||||
*/
|
||||
public Method createMethod(Plugin plugin)
|
||||
public static Method createMethod(Plugin plugin)
|
||||
{
|
||||
for (Method method : Methods)
|
||||
{
|
||||
@@ -112,7 +119,7 @@ public class Methods
|
||||
return null;
|
||||
}
|
||||
|
||||
private void addMethod(String name, Method method)
|
||||
private static void addMethod(String name, Method method)
|
||||
{
|
||||
Dependencies.add(name);
|
||||
Methods.add(method);
|
||||
@@ -125,7 +132,7 @@ public class Methods
|
||||
* @see #setMethod(org.bukkit.plugin.Plugin)
|
||||
* @see #checkDisabled(org.bukkit.plugin.Plugin)
|
||||
*/
|
||||
public boolean hasMethod()
|
||||
public static boolean hasMethod()
|
||||
{
|
||||
return (Method != null);
|
||||
}
|
||||
@@ -134,15 +141,16 @@ public class Methods
|
||||
* Checks Plugin Class against a multitude of checks to verify it's usability
|
||||
* as a payment method.
|
||||
*
|
||||
* @param method Plugin data from bukkit, Internal Class file.
|
||||
* @param <code>PluginManager</code> the plugin manager for the server
|
||||
* @return <code>boolean</code> True on success, False on failure.
|
||||
*/
|
||||
public boolean setMethod(Plugin method)
|
||||
public static boolean setMethod(PluginManager manager)
|
||||
{
|
||||
if (hasMethod())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (self)
|
||||
{
|
||||
self = false;
|
||||
@@ -152,44 +160,37 @@ public class Methods
|
||||
int count = 0;
|
||||
boolean match = false;
|
||||
Plugin plugin = null;
|
||||
PluginManager manager = method.getServer().getPluginManager();
|
||||
|
||||
for (String name : this.getDependencies())
|
||||
for (String name : getDependencies())
|
||||
{
|
||||
if (hasMethod())
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (method.getDescription().getName().equals(name))
|
||||
{
|
||||
plugin = method;
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin = manager.getPlugin(name);
|
||||
}
|
||||
if (plugin == null)
|
||||
|
||||
plugin = manager.getPlugin(name);
|
||||
if (plugin == null || !plugin.isEnabled())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Method current = this.createMethod(plugin);
|
||||
Method current = createMethod(plugin);
|
||||
if (current == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.preferred.isEmpty())
|
||||
if (preferred.isEmpty())
|
||||
{
|
||||
this.Method = current;
|
||||
Method = current;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Attachables.add(current);
|
||||
Attachables.add(current);
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.preferred.isEmpty())
|
||||
if (!preferred.isEmpty())
|
||||
{
|
||||
do
|
||||
{
|
||||
@@ -199,7 +200,7 @@ public class Methods
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Method attached : this.Attachables)
|
||||
for (Method attached : Attachables)
|
||||
{
|
||||
if (attached == null)
|
||||
{
|
||||
@@ -212,21 +213,21 @@ public class Methods
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.preferred.isEmpty())
|
||||
if (preferred.isEmpty())
|
||||
{
|
||||
this.Method = attached;
|
||||
Method = attached;
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
if (this.preferred.equalsIgnoreCase(attached.getName()))
|
||||
if (preferred.equalsIgnoreCase(attached.getName()))
|
||||
{
|
||||
this.Method = attached;
|
||||
Method = attached;
|
||||
}
|
||||
else
|
||||
{
|
||||
Method = attached;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Method = attached;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,12 +240,28 @@ public class Methods
|
||||
return hasMethod();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the preferred economy
|
||||
*
|
||||
* @return <code>boolean</code>
|
||||
*/
|
||||
public static boolean setPreferred(String check)
|
||||
{
|
||||
if (getDependencies().contains(check))
|
||||
{
|
||||
preferred = check;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab the existing and initialized (hopefully) Method Class.
|
||||
*
|
||||
* @return <code>Method</code> <em>or</em> <code>Null</code>
|
||||
*/
|
||||
public Method getMethod()
|
||||
public static Method getMethod()
|
||||
{
|
||||
return Method;
|
||||
}
|
||||
@@ -256,16 +273,18 @@ public class Methods
|
||||
* @param method Plugin data from bukkit, Internal Class file.
|
||||
* @return <code>boolean</code>
|
||||
*/
|
||||
public boolean checkDisabled(Plugin method)
|
||||
public static boolean checkDisabled(Plugin method)
|
||||
{
|
||||
if (!hasMethod())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Method.isCompatible(method))
|
||||
{
|
||||
Method = null;
|
||||
}
|
||||
|
||||
return (Method == null);
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,11 @@
|
||||
package com.earth2me.essentials.register.payment.methods;
|
||||
|
||||
import com.earth2me.essentials.register.payment.Method;
|
||||
|
||||
import cosine.boseconomy.BOSEconomy;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
||||
/**
|
||||
* BOSEconomy 6 Implementation of Method
|
||||
*
|
||||
@@ -11,191 +13,279 @@ import org.bukkit.plugin.Plugin;
|
||||
* @copyright (c) 2011
|
||||
* @license AOL license <http://aol.nexua.org>
|
||||
*/
|
||||
public class BOSE6 implements Method {
|
||||
private BOSEconomy BOSEconomy;
|
||||
@SuppressWarnings("deprecation")
|
||||
public class BOSE6 implements Method
|
||||
{
|
||||
private BOSEconomy BOSEconomy;
|
||||
|
||||
public BOSEconomy getPlugin() {
|
||||
return this.BOSEconomy;
|
||||
}
|
||||
public BOSEconomy getPlugin()
|
||||
{
|
||||
return this.BOSEconomy;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "BOSEconomy";
|
||||
}
|
||||
public String getName()
|
||||
{
|
||||
return "BOSEconomy";
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return "0.6.2";
|
||||
}
|
||||
public String getVersion()
|
||||
{
|
||||
return "0.6.2";
|
||||
}
|
||||
|
||||
public String format(double amount) {
|
||||
String currency = this.BOSEconomy.getMoneyNamePlural();
|
||||
if(amount == 1) currency = this.BOSEconomy.getMoneyName();
|
||||
return amount + " " + currency;
|
||||
}
|
||||
public int fractionalDigits()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean hasBanks() {
|
||||
return true;
|
||||
}
|
||||
public String format(double amount)
|
||||
{
|
||||
String currency = this.BOSEconomy.getMoneyNamePlural();
|
||||
|
||||
public boolean hasBank(String bank) {
|
||||
return this.BOSEconomy.bankExists(bank);
|
||||
}
|
||||
if (amount == 1)
|
||||
{
|
||||
currency = this.BOSEconomy.getMoneyName();
|
||||
}
|
||||
|
||||
public boolean hasAccount(String name) {
|
||||
return this.BOSEconomy.playerRegistered(name, false);
|
||||
}
|
||||
return amount + " " + currency;
|
||||
}
|
||||
|
||||
public boolean hasBankAccount(String bank, String name) {
|
||||
return this.BOSEconomy.isBankOwner(bank, name) || this.BOSEconomy.isBankMember(bank, name);
|
||||
}
|
||||
public boolean hasBanks()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public MethodAccount getAccount(String name) {
|
||||
if(!hasAccount(name)) return null;
|
||||
return new BOSEAccount(name, this.BOSEconomy);
|
||||
}
|
||||
public boolean hasBank(String bank)
|
||||
{
|
||||
return this.BOSEconomy.bankExists(bank);
|
||||
}
|
||||
|
||||
public MethodBankAccount getBankAccount(String bank, String name) {
|
||||
if(!hasBankAccount(bank, name)) return null;
|
||||
return new BOSEBankAccount(bank, BOSEconomy);
|
||||
}
|
||||
public boolean hasAccount(String name)
|
||||
{
|
||||
return this.BOSEconomy.playerRegistered(name, false);
|
||||
}
|
||||
|
||||
public boolean isCompatible(Plugin plugin) {
|
||||
return plugin.getDescription().getName().equalsIgnoreCase("boseconomy") && plugin instanceof BOSEconomy && plugin.getDescription().getVersion().equals("0.6.2");
|
||||
}
|
||||
public boolean hasBankAccount(String bank, String name)
|
||||
{
|
||||
return this.BOSEconomy.isBankOwner(bank, name)
|
||||
|| this.BOSEconomy.isBankMember(bank, name);
|
||||
}
|
||||
|
||||
public void setPlugin(Plugin plugin) {
|
||||
BOSEconomy = (BOSEconomy)plugin;
|
||||
}
|
||||
public boolean createAccount(String name)
|
||||
{
|
||||
if (hasAccount(name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public class BOSEAccount implements MethodAccount {
|
||||
private String name;
|
||||
private BOSEconomy BOSEconomy;
|
||||
this.BOSEconomy.registerPlayer(name);
|
||||
return true;
|
||||
}
|
||||
|
||||
public BOSEAccount(String name, BOSEconomy bOSEconomy) {
|
||||
this.name = name;
|
||||
this.BOSEconomy = bOSEconomy;
|
||||
}
|
||||
public boolean createAccount(String name, Double balance)
|
||||
{
|
||||
if (hasAccount(name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public double balance() {
|
||||
return (double) this.BOSEconomy.getPlayerMoney(this.name);
|
||||
}
|
||||
this.BOSEconomy.registerPlayer(name);
|
||||
this.BOSEconomy.setPlayerMoney(name, balance, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean set(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, IntAmount, false);
|
||||
}
|
||||
public MethodAccount getAccount(String name)
|
||||
{
|
||||
if (!hasAccount(name))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean add(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
return this.BOSEconomy.addPlayerMoney(this.name, IntAmount, false);
|
||||
}
|
||||
return new BOSEAccount(name, this.BOSEconomy);
|
||||
}
|
||||
|
||||
public boolean subtract(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance - IntAmount), false);
|
||||
}
|
||||
public MethodBankAccount getBankAccount(String bank, String name)
|
||||
{
|
||||
if (!hasBankAccount(bank, name))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean multiply(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance * IntAmount), false);
|
||||
}
|
||||
return new BOSEBankAccount(bank, BOSEconomy);
|
||||
}
|
||||
|
||||
public boolean divide(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance / IntAmount), false);
|
||||
}
|
||||
public boolean isCompatible(Plugin plugin)
|
||||
{
|
||||
return plugin.getDescription().getName().equalsIgnoreCase("boseconomy")
|
||||
&& plugin instanceof BOSEconomy
|
||||
&& plugin.getDescription().getVersion().equals("0.6.2");
|
||||
}
|
||||
|
||||
public boolean hasEnough(double amount) {
|
||||
return (this.balance() >= amount);
|
||||
}
|
||||
public void setPlugin(Plugin plugin)
|
||||
{
|
||||
BOSEconomy = (BOSEconomy)plugin;
|
||||
}
|
||||
|
||||
public boolean hasOver(double amount) {
|
||||
return (this.balance() > amount);
|
||||
}
|
||||
|
||||
public boolean hasUnder(double amount) {
|
||||
return (this.balance() < amount);
|
||||
}
|
||||
public class BOSEAccount implements MethodAccount
|
||||
{
|
||||
private final String name;
|
||||
private final BOSEconomy BOSEconomy;
|
||||
|
||||
public boolean isNegative() {
|
||||
return (this.balance() < 0);
|
||||
}
|
||||
public BOSEAccount(String name, BOSEconomy bOSEconomy)
|
||||
{
|
||||
this.name = name;
|
||||
this.BOSEconomy = bOSEconomy;
|
||||
}
|
||||
|
||||
public boolean remove() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public double balance()
|
||||
{
|
||||
return (double)this.BOSEconomy.getPlayerMoney(this.name);
|
||||
}
|
||||
|
||||
public class BOSEBankAccount implements MethodBankAccount {
|
||||
private final String bank;
|
||||
private final BOSEconomy BOSEconomy;
|
||||
public boolean set(double amount)
|
||||
{
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, IntAmount, false);
|
||||
}
|
||||
|
||||
public BOSEBankAccount(String bank, BOSEconomy bOSEconomy) {
|
||||
this.bank = bank;
|
||||
this.BOSEconomy = bOSEconomy;
|
||||
}
|
||||
public boolean add(double amount)
|
||||
{
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
return this.BOSEconomy.addPlayerMoney(this.name, IntAmount, false);
|
||||
}
|
||||
|
||||
public String getBankName() {
|
||||
return this.bank;
|
||||
}
|
||||
public boolean subtract(double amount)
|
||||
{
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance - IntAmount), false);
|
||||
}
|
||||
|
||||
public int getBankId() {
|
||||
return -1;
|
||||
}
|
||||
public boolean multiply(double amount)
|
||||
{
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance * IntAmount), false);
|
||||
}
|
||||
|
||||
public double balance() {
|
||||
return (double) this.BOSEconomy.getBankMoney(bank);
|
||||
}
|
||||
public boolean divide(double amount)
|
||||
{
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance / IntAmount), false);
|
||||
}
|
||||
|
||||
public boolean set(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
return this.BOSEconomy.setBankMoney(bank, IntAmount, true);
|
||||
}
|
||||
public boolean hasEnough(double amount)
|
||||
{
|
||||
return (this.balance() >= amount);
|
||||
}
|
||||
|
||||
public boolean add(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance + IntAmount), false);
|
||||
}
|
||||
public boolean hasOver(double amount)
|
||||
{
|
||||
return (this.balance() > amount);
|
||||
}
|
||||
|
||||
public boolean subtract(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance - IntAmount), false);
|
||||
}
|
||||
public boolean hasUnder(double amount)
|
||||
{
|
||||
return (this.balance() < amount);
|
||||
}
|
||||
|
||||
public boolean multiply(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance * IntAmount), false);
|
||||
}
|
||||
public boolean isNegative()
|
||||
{
|
||||
return (this.balance() < 0);
|
||||
}
|
||||
|
||||
public boolean divide(double amount) {
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance / IntAmount), false);
|
||||
}
|
||||
public boolean remove()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasEnough(double amount) {
|
||||
return (this.balance() >= amount);
|
||||
}
|
||||
|
||||
public boolean hasOver(double amount) {
|
||||
return (this.balance() > amount);
|
||||
}
|
||||
public class BOSEBankAccount implements MethodBankAccount
|
||||
{
|
||||
private final String bank;
|
||||
private final BOSEconomy BOSEconomy;
|
||||
|
||||
public boolean hasUnder(double amount) {
|
||||
return (this.balance() < amount);
|
||||
}
|
||||
public BOSEBankAccount(String bank, BOSEconomy bOSEconomy)
|
||||
{
|
||||
this.bank = bank;
|
||||
this.BOSEconomy = bOSEconomy;
|
||||
}
|
||||
|
||||
public boolean isNegative() {
|
||||
return (this.balance() < 0);
|
||||
}
|
||||
public String getBankName()
|
||||
{
|
||||
return this.bank;
|
||||
}
|
||||
|
||||
public boolean remove() {
|
||||
return this.BOSEconomy.removeBank(bank);
|
||||
}
|
||||
}
|
||||
public int getBankId()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public double balance()
|
||||
{
|
||||
return (double)this.BOSEconomy.getBankMoney(bank);
|
||||
}
|
||||
|
||||
public boolean set(double amount)
|
||||
{
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
return this.BOSEconomy.setBankMoney(bank, IntAmount, true);
|
||||
}
|
||||
|
||||
public boolean add(double amount)
|
||||
{
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance + IntAmount), false);
|
||||
}
|
||||
|
||||
public boolean subtract(double amount)
|
||||
{
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance - IntAmount), false);
|
||||
}
|
||||
|
||||
public boolean multiply(double amount)
|
||||
{
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance * IntAmount), false);
|
||||
}
|
||||
|
||||
public boolean divide(double amount)
|
||||
{
|
||||
int IntAmount = (int)Math.ceil(amount);
|
||||
int balance = (int)this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance / IntAmount), false);
|
||||
}
|
||||
|
||||
public boolean hasEnough(double amount)
|
||||
{
|
||||
return (this.balance() >= amount);
|
||||
}
|
||||
|
||||
public boolean hasOver(double amount)
|
||||
{
|
||||
return (this.balance() > amount);
|
||||
}
|
||||
|
||||
public boolean hasUnder(double amount)
|
||||
{
|
||||
return (this.balance() < amount);
|
||||
}
|
||||
|
||||
public boolean isNegative()
|
||||
{
|
||||
return (this.balance() < 0);
|
||||
}
|
||||
|
||||
public boolean remove()
|
||||
{
|
||||
return this.BOSEconomy.removeBank(bank);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,9 +1,11 @@
|
||||
package com.earth2me.essentials.register.payment.methods;
|
||||
|
||||
import com.earth2me.essentials.register.payment.Method;
|
||||
|
||||
import cosine.boseconomy.BOSEconomy;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
||||
/**
|
||||
* BOSEconomy 7 Implementation of Method
|
||||
*
|
||||
@@ -12,182 +14,267 @@ import org.bukkit.plugin.Plugin;
|
||||
* @copyright (c) 2011
|
||||
* @license AOL license <http://aol.nexua.org>
|
||||
*/
|
||||
public class BOSE7 implements Method
|
||||
{
|
||||
private BOSEconomy BOSEconomy;
|
||||
|
||||
public class BOSE7 implements Method {
|
||||
private BOSEconomy BOSEconomy;
|
||||
public BOSEconomy getPlugin()
|
||||
{
|
||||
return this.BOSEconomy;
|
||||
}
|
||||
|
||||
public BOSEconomy getPlugin() {
|
||||
return this.BOSEconomy;
|
||||
}
|
||||
public String getName()
|
||||
{
|
||||
return "BOSEconomy";
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "BOSEconomy";
|
||||
}
|
||||
public String getVersion()
|
||||
{
|
||||
return "0.7.0";
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return "0.7.0";
|
||||
}
|
||||
public int fractionalDigits()
|
||||
{
|
||||
return this.BOSEconomy.getFractionalDigits();
|
||||
}
|
||||
|
||||
public String format(double amount) {
|
||||
String currency = this.BOSEconomy.getMoneyNamePlural();
|
||||
if(amount == 1) currency = this.BOSEconomy.getMoneyName();
|
||||
return amount + " " + currency;
|
||||
}
|
||||
public String format(double amount)
|
||||
{
|
||||
String currency = this.BOSEconomy.getMoneyNamePlural();
|
||||
|
||||
public boolean hasBanks() {
|
||||
return true;
|
||||
}
|
||||
if (amount == 1)
|
||||
{
|
||||
currency = this.BOSEconomy.getMoneyName();
|
||||
}
|
||||
|
||||
public boolean hasBank(String bank) {
|
||||
return this.BOSEconomy.bankExists(bank);
|
||||
}
|
||||
return amount + " " + currency;
|
||||
}
|
||||
|
||||
public boolean hasAccount(String name) {
|
||||
return this.BOSEconomy.playerRegistered(name, false);
|
||||
}
|
||||
public boolean hasBanks()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasBankAccount(String bank, String name) {
|
||||
return this.BOSEconomy.isBankOwner(bank, name) || this.BOSEconomy.isBankMember(bank, name);
|
||||
}
|
||||
public boolean hasBank(String bank)
|
||||
{
|
||||
return this.BOSEconomy.bankExists(bank);
|
||||
}
|
||||
|
||||
public MethodAccount getAccount(String name) {
|
||||
if(!hasAccount(name)) return null;
|
||||
return new BOSEAccount(name, this.BOSEconomy);
|
||||
}
|
||||
public boolean hasAccount(String name)
|
||||
{
|
||||
return this.BOSEconomy.playerRegistered(name, false);
|
||||
}
|
||||
|
||||
public MethodBankAccount getBankAccount(String bank, String name) {
|
||||
if(!hasBankAccount(bank, name)) return null;
|
||||
return new BOSEBankAccount(bank, BOSEconomy);
|
||||
}
|
||||
public boolean hasBankAccount(String bank, String name)
|
||||
{
|
||||
return this.BOSEconomy.isBankOwner(bank, name) || this.BOSEconomy.isBankMember(bank, name);
|
||||
}
|
||||
|
||||
public boolean isCompatible(Plugin plugin) {
|
||||
return plugin.getDescription().getName().equalsIgnoreCase("boseconomy") && plugin instanceof BOSEconomy && !plugin.getDescription().getVersion().equals("0.6.2");
|
||||
}
|
||||
public boolean createAccount(String name)
|
||||
{
|
||||
if (hasAccount(name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setPlugin(Plugin plugin) {
|
||||
BOSEconomy = (BOSEconomy)plugin;
|
||||
}
|
||||
this.BOSEconomy.registerPlayer(name);
|
||||
return true;
|
||||
}
|
||||
|
||||
public class BOSEAccount implements MethodAccount {
|
||||
private String name;
|
||||
private BOSEconomy BOSEconomy;
|
||||
public boolean createAccount(String name, Double balance)
|
||||
{
|
||||
if (hasAccount(name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public BOSEAccount(String name, BOSEconomy bOSEconomy) {
|
||||
this.name = name;
|
||||
this.BOSEconomy = bOSEconomy;
|
||||
}
|
||||
this.BOSEconomy.registerPlayer(name);
|
||||
this.BOSEconomy.setPlayerMoney(name, balance, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
public double balance() {
|
||||
return this.BOSEconomy.getPlayerMoneyDouble(this.name);
|
||||
}
|
||||
public MethodAccount getAccount(String name)
|
||||
{
|
||||
if (!hasAccount(name))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean set(double amount) {
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, amount, false);
|
||||
}
|
||||
return new BOSEAccount(name, this.BOSEconomy);
|
||||
}
|
||||
|
||||
public boolean add(double amount) {
|
||||
return this.BOSEconomy.addPlayerMoney(this.name, amount, false);
|
||||
}
|
||||
public MethodBankAccount getBankAccount(String bank, String name)
|
||||
{
|
||||
if (!hasBankAccount(bank, name))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean subtract(double amount) {
|
||||
double balance = this.balance();
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance - amount), false);
|
||||
}
|
||||
return new BOSEBankAccount(bank, BOSEconomy);
|
||||
}
|
||||
|
||||
public boolean multiply(double amount) {
|
||||
double balance = this.balance();
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance * amount), false);
|
||||
}
|
||||
public boolean isCompatible(Plugin plugin)
|
||||
{
|
||||
return plugin.getDescription().getName().equalsIgnoreCase("boseconomy")
|
||||
&& plugin instanceof BOSEconomy
|
||||
&& !plugin.getDescription().getVersion().equals("0.6.2");
|
||||
}
|
||||
|
||||
public boolean divide(double amount) {
|
||||
double balance = this.balance();
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance / amount), false);
|
||||
}
|
||||
public void setPlugin(Plugin plugin)
|
||||
{
|
||||
BOSEconomy = (BOSEconomy)plugin;
|
||||
}
|
||||
|
||||
public boolean hasEnough(double amount) {
|
||||
return (this.balance() >= amount);
|
||||
}
|
||||
|
||||
public boolean hasOver(double amount) {
|
||||
return (this.balance() > amount);
|
||||
}
|
||||
public class BOSEAccount implements MethodAccount
|
||||
{
|
||||
private String name;
|
||||
private BOSEconomy BOSEconomy;
|
||||
|
||||
public boolean hasUnder(double amount) {
|
||||
return (this.balance() < amount);
|
||||
}
|
||||
public BOSEAccount(String name, BOSEconomy bOSEconomy)
|
||||
{
|
||||
this.name = name;
|
||||
this.BOSEconomy = bOSEconomy;
|
||||
}
|
||||
|
||||
public boolean isNegative() {
|
||||
return (this.balance() < 0);
|
||||
}
|
||||
public double balance()
|
||||
{
|
||||
return this.BOSEconomy.getPlayerMoneyDouble(this.name);
|
||||
}
|
||||
|
||||
public boolean remove() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public boolean set(double amount)
|
||||
{
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, amount, false);
|
||||
}
|
||||
|
||||
public class BOSEBankAccount implements MethodBankAccount {
|
||||
private String bank;
|
||||
private BOSEconomy BOSEconomy;
|
||||
public boolean add(double amount)
|
||||
{
|
||||
return this.BOSEconomy.addPlayerMoney(this.name, amount, false);
|
||||
}
|
||||
|
||||
public BOSEBankAccount(String bank, BOSEconomy bOSEconomy) {
|
||||
this.bank = bank;
|
||||
this.BOSEconomy = bOSEconomy;
|
||||
}
|
||||
public boolean subtract(double amount)
|
||||
{
|
||||
double balance = this.balance();
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance - amount), false);
|
||||
}
|
||||
|
||||
public String getBankName() {
|
||||
return this.bank;
|
||||
}
|
||||
public boolean multiply(double amount)
|
||||
{
|
||||
double balance = this.balance();
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance * amount), false);
|
||||
}
|
||||
|
||||
public int getBankId() {
|
||||
return -1;
|
||||
}
|
||||
public boolean divide(double amount)
|
||||
{
|
||||
double balance = this.balance();
|
||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance / amount), false);
|
||||
}
|
||||
|
||||
public double balance() {
|
||||
return this.BOSEconomy.getBankMoneyDouble(bank);
|
||||
}
|
||||
public boolean hasEnough(double amount)
|
||||
{
|
||||
return (this.balance() >= amount);
|
||||
}
|
||||
|
||||
public boolean set(double amount) {
|
||||
return this.BOSEconomy.setBankMoney(bank, amount, true);
|
||||
}
|
||||
public boolean hasOver(double amount)
|
||||
{
|
||||
return (this.balance() > amount);
|
||||
}
|
||||
|
||||
public boolean add(double amount) {
|
||||
double balance = this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance + amount), false);
|
||||
}
|
||||
public boolean hasUnder(double amount)
|
||||
{
|
||||
return (this.balance() < amount);
|
||||
}
|
||||
|
||||
public boolean subtract(double amount) {
|
||||
double balance = this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance - amount), false);
|
||||
}
|
||||
public boolean isNegative()
|
||||
{
|
||||
return (this.balance() < 0);
|
||||
}
|
||||
|
||||
public boolean multiply(double amount) {
|
||||
double balance = this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance * amount), false);
|
||||
}
|
||||
public boolean remove()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean divide(double amount) {
|
||||
double balance = this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance / amount), false);
|
||||
}
|
||||
|
||||
public boolean hasEnough(double amount) {
|
||||
return (this.balance() >= amount);
|
||||
}
|
||||
public class BOSEBankAccount implements MethodBankAccount
|
||||
{
|
||||
private String bank;
|
||||
private BOSEconomy BOSEconomy;
|
||||
|
||||
public boolean hasOver(double amount) {
|
||||
return (this.balance() > amount);
|
||||
}
|
||||
public BOSEBankAccount(String bank, BOSEconomy bOSEconomy)
|
||||
{
|
||||
this.bank = bank;
|
||||
this.BOSEconomy = bOSEconomy;
|
||||
}
|
||||
|
||||
public boolean hasUnder(double amount) {
|
||||
return (this.balance() < amount);
|
||||
}
|
||||
public String getBankName()
|
||||
{
|
||||
return this.bank;
|
||||
}
|
||||
|
||||
public boolean isNegative() {
|
||||
return (this.balance() < 0);
|
||||
}
|
||||
public int getBankId()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean remove() {
|
||||
return this.BOSEconomy.removeBank(bank);
|
||||
}
|
||||
}
|
||||
public double balance()
|
||||
{
|
||||
return this.BOSEconomy.getBankMoneyDouble(bank);
|
||||
}
|
||||
|
||||
public boolean set(double amount)
|
||||
{
|
||||
return this.BOSEconomy.setBankMoney(bank, amount, true);
|
||||
}
|
||||
|
||||
public boolean add(double amount)
|
||||
{
|
||||
double balance = this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance + amount), false);
|
||||
}
|
||||
|
||||
public boolean subtract(double amount)
|
||||
{
|
||||
double balance = this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance - amount), false);
|
||||
}
|
||||
|
||||
public boolean multiply(double amount)
|
||||
{
|
||||
double balance = this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance * amount), false);
|
||||
}
|
||||
|
||||
public boolean divide(double amount)
|
||||
{
|
||||
double balance = this.balance();
|
||||
return this.BOSEconomy.setBankMoney(bank, (balance / amount), false);
|
||||
}
|
||||
|
||||
public boolean hasEnough(double amount)
|
||||
{
|
||||
return (this.balance() >= amount);
|
||||
}
|
||||
|
||||
public boolean hasOver(double amount)
|
||||
{
|
||||
return (this.balance() > amount);
|
||||
}
|
||||
|
||||
public boolean hasUnder(double amount)
|
||||
{
|
||||
return (this.balance() < amount);
|
||||
}
|
||||
|
||||
public boolean isNegative()
|
||||
{
|
||||
return (this.balance() < 0);
|
||||
}
|
||||
|
||||
public boolean remove()
|
||||
{
|
||||
return this.BOSEconomy.removeBank(bank);
|
||||
}
|
||||
}
|
||||
}
|
@@ -7,6 +7,7 @@ import me.ashtheking.currency.CurrencyList;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
||||
/**
|
||||
* MultiCurrency Method implementation.
|
||||
*
|
||||
@@ -14,107 +15,153 @@ import org.bukkit.plugin.Plugin;
|
||||
* @copyright (c) 2011
|
||||
* @license AOL license <http://aol.nexua.org>
|
||||
*/
|
||||
public class MCUR implements Method {
|
||||
private Currency currencyList;
|
||||
public class MCUR implements Method
|
||||
{
|
||||
private Currency currencyList;
|
||||
|
||||
public Object getPlugin() {
|
||||
return this.currencyList;
|
||||
}
|
||||
public Object getPlugin()
|
||||
{
|
||||
return this.currencyList;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "MultiCurrency";
|
||||
}
|
||||
public String getName()
|
||||
{
|
||||
return "MultiCurrency";
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return "0.09";
|
||||
}
|
||||
public String getVersion()
|
||||
{
|
||||
return "0.09";
|
||||
}
|
||||
|
||||
public String format(double amount) {
|
||||
return amount + " Currency";
|
||||
}
|
||||
public int fractionalDigits()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean hasBanks() {
|
||||
return false;
|
||||
}
|
||||
public String format(double amount)
|
||||
{
|
||||
return amount + " Currency";
|
||||
}
|
||||
|
||||
public boolean hasBank(String bank) {
|
||||
return false;
|
||||
}
|
||||
public boolean hasBanks()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasAccount(String name) {
|
||||
return true;
|
||||
}
|
||||
public boolean hasBank(String bank)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasBankAccount(String bank, String name) {
|
||||
return false;
|
||||
}
|
||||
public boolean hasAccount(String name)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public MethodAccount getAccount(String name) {
|
||||
return new MCurrencyAccount(name);
|
||||
}
|
||||
public boolean hasBankAccount(String bank, String name)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public MethodBankAccount getBankAccount(String bank, String name) {
|
||||
return null;
|
||||
}
|
||||
public boolean createAccount(String name)
|
||||
{
|
||||
CurrencyList.setValue((String)CurrencyList.maxCurrency(name)[0], name, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isCompatible(Plugin plugin) {
|
||||
return plugin.getDescription().getName().equalsIgnoreCase(getName()) && plugin instanceof Currency;
|
||||
}
|
||||
public boolean createAccount(String name, Double balance)
|
||||
{
|
||||
CurrencyList.setValue((String)CurrencyList.maxCurrency(name)[0], name, balance);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setPlugin(Plugin plugin) {
|
||||
currencyList = (Currency) plugin;
|
||||
}
|
||||
public MethodAccount getAccount(String name)
|
||||
{
|
||||
return new MCurrencyAccount(name);
|
||||
}
|
||||
|
||||
public class MCurrencyAccount implements MethodAccount{
|
||||
private String name;
|
||||
public MethodBankAccount getBankAccount(String bank, String name)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public MCurrencyAccount(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public boolean isCompatible(Plugin plugin)
|
||||
{
|
||||
return (plugin.getDescription().getName().equalsIgnoreCase("Currency")
|
||||
|| plugin.getDescription().getName().equalsIgnoreCase("MultiCurrency"))
|
||||
&& plugin instanceof Currency;
|
||||
}
|
||||
|
||||
public double balance() {
|
||||
return CurrencyList.getValue((String) CurrencyList.maxCurrency(name)[0], name);
|
||||
}
|
||||
public void setPlugin(Plugin plugin)
|
||||
{
|
||||
currencyList = (Currency)plugin;
|
||||
}
|
||||
|
||||
public boolean set(double amount) {
|
||||
CurrencyList.setValue((String) CurrencyList.maxCurrency(name)[0], name, amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean add(double amount) {
|
||||
return CurrencyList.add(name, amount);
|
||||
}
|
||||
public class MCurrencyAccount implements MethodAccount
|
||||
{
|
||||
private String name;
|
||||
|
||||
public boolean subtract(double amount) {
|
||||
return CurrencyList.subtract(name, amount);
|
||||
}
|
||||
public MCurrencyAccount(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean multiply(double amount) {
|
||||
return CurrencyList.multiply(name, amount);
|
||||
}
|
||||
public double balance()
|
||||
{
|
||||
return CurrencyList.getValue((String)CurrencyList.maxCurrency(name)[0], name);
|
||||
}
|
||||
|
||||
public boolean divide(double amount) {
|
||||
return CurrencyList.divide(name, amount);
|
||||
}
|
||||
public boolean set(double amount)
|
||||
{
|
||||
CurrencyList.setValue((String)CurrencyList.maxCurrency(name)[0], name, amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasEnough(double amount) {
|
||||
return CurrencyList.hasEnough(name, amount);
|
||||
}
|
||||
public boolean add(double amount)
|
||||
{
|
||||
return CurrencyList.add(name, amount);
|
||||
}
|
||||
|
||||
public boolean hasOver(double amount) {
|
||||
return CurrencyList.hasOver(name, amount);
|
||||
}
|
||||
public boolean subtract(double amount)
|
||||
{
|
||||
return CurrencyList.subtract(name, amount);
|
||||
}
|
||||
|
||||
public boolean hasUnder(double amount) {
|
||||
return CurrencyList.hasUnder(name, amount);
|
||||
}
|
||||
public boolean multiply(double amount)
|
||||
{
|
||||
return CurrencyList.multiply(name, amount);
|
||||
}
|
||||
|
||||
public boolean isNegative() {
|
||||
return CurrencyList.isNegative(name);
|
||||
}
|
||||
public boolean divide(double amount)
|
||||
{
|
||||
return CurrencyList.divide(name, amount);
|
||||
}
|
||||
|
||||
public boolean remove() {
|
||||
return CurrencyList.remove(name);
|
||||
}
|
||||
}
|
||||
public boolean hasEnough(double amount)
|
||||
{
|
||||
return CurrencyList.hasEnough(name, amount);
|
||||
}
|
||||
|
||||
public boolean hasOver(double amount)
|
||||
{
|
||||
return CurrencyList.hasOver(name, amount);
|
||||
}
|
||||
|
||||
public boolean hasUnder(double amount)
|
||||
{
|
||||
return CurrencyList.hasUnder(name, amount);
|
||||
}
|
||||
|
||||
public boolean isNegative()
|
||||
{
|
||||
return CurrencyList.isNegative(name);
|
||||
}
|
||||
|
||||
public boolean remove()
|
||||
{
|
||||
return CurrencyList.remove(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,12 +1,13 @@
|
||||
package com.earth2me.essentials.register.payment.methods;
|
||||
|
||||
import com.earth2me.essentials.register.payment.Method;
|
||||
import com.nijiko.coelho.iConomy.iConomy;
|
||||
import com.nijiko.coelho.iConomy.system.Account;
|
||||
|
||||
import com.earth2me.essentials.register.payment.Method;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
||||
/**
|
||||
* iConomy 4 Implementation of Method
|
||||
*
|
||||
@@ -14,122 +15,213 @@ import org.bukkit.plugin.Plugin;
|
||||
* @copyright (c) 2011
|
||||
* @license AOL license <http://aol.nexua.org>
|
||||
*/
|
||||
public class iCo4 implements Method {
|
||||
private iConomy iConomy;
|
||||
public class iCo4 implements Method
|
||||
{
|
||||
private iConomy iConomy;
|
||||
|
||||
public iConomy getPlugin() {
|
||||
return this.iConomy;
|
||||
}
|
||||
public iConomy getPlugin()
|
||||
{
|
||||
return this.iConomy;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "iConomy";
|
||||
}
|
||||
public String getName()
|
||||
{
|
||||
return "iConomy";
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return "4";
|
||||
}
|
||||
public String getVersion()
|
||||
{
|
||||
return "4";
|
||||
}
|
||||
|
||||
public String format(double amount) {
|
||||
return this.iConomy.getBank().format(amount);
|
||||
}
|
||||
public int fractionalDigits()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public boolean hasBanks() {
|
||||
return false;
|
||||
}
|
||||
public String format(double amount)
|
||||
{
|
||||
return com.nijiko.coelho.iConomy.iConomy.getBank().format(amount);
|
||||
}
|
||||
|
||||
public boolean hasBank(String bank) {
|
||||
return false;
|
||||
}
|
||||
public boolean hasBanks()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasAccount(String name) {
|
||||
return this.iConomy.getBank().hasAccount(name);
|
||||
}
|
||||
public boolean hasBank(String bank)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasBankAccount(String bank, String name) {
|
||||
return false;
|
||||
}
|
||||
public boolean hasAccount(String name)
|
||||
{
|
||||
return com.nijiko.coelho.iConomy.iConomy.getBank().hasAccount(name);
|
||||
}
|
||||
|
||||
public MethodAccount getAccount(String name) {
|
||||
return new iCoAccount(this.iConomy.getBank().getAccount(name));
|
||||
}
|
||||
public boolean hasBankAccount(String bank, String name)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public MethodBankAccount getBankAccount(String bank, String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isCompatible(Plugin plugin) {
|
||||
return plugin.getDescription().getName().equalsIgnoreCase("iconomy") && plugin.getClass().getName().equals("com.nijiko.coelho.iConomy.iConomy") && plugin instanceof iConomy;
|
||||
}
|
||||
public boolean createAccount(String name)
|
||||
{
|
||||
if (hasAccount(name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setPlugin(Plugin plugin) {
|
||||
iConomy = (iConomy)plugin;
|
||||
}
|
||||
|
||||
public class iCoAccount implements MethodAccount {
|
||||
private Account account;
|
||||
try
|
||||
{
|
||||
com.nijiko.coelho.iConomy.iConomy.getBank().addAccount(name);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public iCoAccount(Account account) {
|
||||
this.account = account;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public Account getiCoAccount() {
|
||||
return account;
|
||||
}
|
||||
public boolean createAccount(String name, Double balance)
|
||||
{
|
||||
if (hasAccount(name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public double balance() {
|
||||
return this.account.getBalance();
|
||||
}
|
||||
try
|
||||
{
|
||||
com.nijiko.coelho.iConomy.iConomy.getBank().addAccount(name, balance);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean set(double amount) {
|
||||
if(this.account == null) return false;
|
||||
this.account.setBalance(amount);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean add(double amount) {
|
||||
if(this.account == null) return false;
|
||||
this.account.add(amount);
|
||||
return true;
|
||||
}
|
||||
public MethodAccount getAccount(String name)
|
||||
{
|
||||
return new iCoAccount(com.nijiko.coelho.iConomy.iConomy.getBank().getAccount(name));
|
||||
}
|
||||
|
||||
public boolean subtract(double amount) {
|
||||
if(this.account == null) return false;
|
||||
this.account.subtract(amount);
|
||||
return true;
|
||||
}
|
||||
public MethodBankAccount getBankAccount(String bank, String name)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean multiply(double amount) {
|
||||
if(this.account == null) return false;
|
||||
this.account.multiply(amount);
|
||||
return true;
|
||||
}
|
||||
public boolean isCompatible(Plugin plugin)
|
||||
{
|
||||
return plugin.getDescription().getName().equalsIgnoreCase("iconomy")
|
||||
&& plugin.getClass().getName().equals("com.nijiko.coelho.iConomy.iConomy")
|
||||
&& plugin instanceof iConomy;
|
||||
}
|
||||
|
||||
public boolean divide(double amount) {
|
||||
if(this.account == null) return false;
|
||||
this.account.divide(amount);
|
||||
return true;
|
||||
}
|
||||
public void setPlugin(Plugin plugin)
|
||||
{
|
||||
iConomy = (iConomy)plugin;
|
||||
}
|
||||
|
||||
public boolean hasEnough(double amount) {
|
||||
return this.account.hasEnough(amount);
|
||||
}
|
||||
|
||||
public boolean hasOver(double amount) {
|
||||
return this.account.hasOver(amount);
|
||||
}
|
||||
public class iCoAccount implements MethodAccount
|
||||
{
|
||||
private Account account;
|
||||
|
||||
public boolean hasUnder(double amount) {
|
||||
return (this.balance() < amount);
|
||||
}
|
||||
public iCoAccount(Account account)
|
||||
{
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public boolean isNegative() {
|
||||
return this.account.isNegative();
|
||||
}
|
||||
public Account getiCoAccount()
|
||||
{
|
||||
return account;
|
||||
}
|
||||
|
||||
public boolean remove() {
|
||||
if(this.account == null) return false;
|
||||
this.account.remove();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public double balance()
|
||||
{
|
||||
return this.account.getBalance();
|
||||
}
|
||||
|
||||
public boolean set(double amount)
|
||||
{
|
||||
if (this.account == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.account.setBalance(amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean add(double amount)
|
||||
{
|
||||
if (this.account == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.account.add(amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean subtract(double amount)
|
||||
{
|
||||
if (this.account == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.account.subtract(amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean multiply(double amount)
|
||||
{
|
||||
if (this.account == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.account.multiply(amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean divide(double amount)
|
||||
{
|
||||
if (this.account == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.account.divide(amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasEnough(double amount)
|
||||
{
|
||||
return this.account.hasEnough(amount);
|
||||
}
|
||||
|
||||
public boolean hasOver(double amount)
|
||||
{
|
||||
return this.account.hasOver(amount);
|
||||
}
|
||||
|
||||
public boolean hasUnder(double amount)
|
||||
{
|
||||
return (this.balance() < amount);
|
||||
}
|
||||
|
||||
public boolean isNegative()
|
||||
{
|
||||
return this.account.isNegative();
|
||||
}
|
||||
|
||||
public boolean remove()
|
||||
{
|
||||
if (this.account == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.account.remove();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package com.earth2me.essentials.register.payment.methods;
|
||||
|
||||
import com.earth2me.essentials.register.payment.Method;
|
||||
import com.iConomy.iConomy;
|
||||
import com.iConomy.system.Account;
|
||||
import com.iConomy.system.BankAccount;
|
||||
import com.iConomy.system.Holdings;
|
||||
import com.iConomy.util.Constants;
|
||||
|
||||
import com.earth2me.essentials.register.payment.Method;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@@ -37,9 +37,14 @@ public class iCo5 implements Method
|
||||
return "5";
|
||||
}
|
||||
|
||||
public int fractionalDigits()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public String format(double amount)
|
||||
{
|
||||
return this.iConomy.format(amount);
|
||||
return com.iConomy.iConomy.format(amount);
|
||||
}
|
||||
|
||||
public boolean hasBanks()
|
||||
@@ -49,32 +54,61 @@ public class iCo5 implements Method
|
||||
|
||||
public boolean hasBank(String bank)
|
||||
{
|
||||
return (hasBanks()) && this.iConomy.Banks.exists(bank);
|
||||
return (hasBanks()) && com.iConomy.iConomy.Banks.exists(bank);
|
||||
}
|
||||
|
||||
public boolean hasAccount(String name)
|
||||
{
|
||||
return this.iConomy.hasAccount(name);
|
||||
return com.iConomy.iConomy.hasAccount(name);
|
||||
}
|
||||
|
||||
public boolean hasBankAccount(String bank, String name)
|
||||
{
|
||||
return (hasBank(bank)) && this.iConomy.getBank(bank).hasAccount(name);
|
||||
return (hasBank(bank)) && com.iConomy.iConomy.getBank(bank).hasAccount(name);
|
||||
}
|
||||
|
||||
public boolean createAccount(String name)
|
||||
{
|
||||
if (hasAccount(name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return com.iConomy.iConomy.Accounts.create(name);
|
||||
}
|
||||
|
||||
public boolean createAccount(String name, Double balance)
|
||||
{
|
||||
if (hasAccount(name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!com.iConomy.iConomy.Accounts.create(name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
getAccount(name).set(balance);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public MethodAccount getAccount(String name)
|
||||
{
|
||||
return new iCoAccount(this.iConomy.getAccount(name));
|
||||
return new iCoAccount(com.iConomy.iConomy.getAccount(name));
|
||||
}
|
||||
|
||||
public MethodBankAccount getBankAccount(String bank, String name)
|
||||
{
|
||||
return new iCoBankAccount(this.iConomy.getBank(bank).getAccount(name));
|
||||
return new iCoBankAccount(com.iConomy.iConomy.getBank(bank).getAccount(name));
|
||||
}
|
||||
|
||||
public boolean isCompatible(Plugin plugin)
|
||||
{
|
||||
return plugin.getDescription().getName().equalsIgnoreCase("iconomy") && plugin.getClass().getName().equals("com.iConomy.iConomy") && plugin instanceof iConomy;
|
||||
return plugin.getDescription().getName().equalsIgnoreCase("iconomy")
|
||||
&& plugin.getClass().getName().equals("com.iConomy.iConomy")
|
||||
&& plugin instanceof iConomy;
|
||||
}
|
||||
|
||||
public void setPlugin(Plugin plugin)
|
||||
|
@@ -1,14 +1,15 @@
|
||||
package com.earth2me.essentials.register.payment.methods;
|
||||
|
||||
import com.earth2me.essentials.register.payment.Method;
|
||||
import com.iCo6.iConomy;
|
||||
import com.iCo6.system.Account;
|
||||
import com.iCo6.system.Accounts;
|
||||
import com.iCo6.system.Holdings;
|
||||
|
||||
import com.earth2me.essentials.register.payment.Method;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
||||
/**
|
||||
* iConomy 6 Implementation of Method
|
||||
*
|
||||
@@ -16,127 +17,197 @@ import org.bukkit.plugin.Plugin;
|
||||
* @copyright (c) 2011
|
||||
* @license AOL license <http://aol.nexua.org>
|
||||
*/
|
||||
public class iCo6 implements Method {
|
||||
private iConomy iConomy;
|
||||
public class iCo6 implements Method
|
||||
{
|
||||
private iConomy iConomy;
|
||||
|
||||
public iConomy getPlugin() {
|
||||
return this.iConomy;
|
||||
}
|
||||
public iConomy getPlugin()
|
||||
{
|
||||
return this.iConomy;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "iConomy";
|
||||
}
|
||||
public String getName()
|
||||
{
|
||||
return "iConomy";
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return "6";
|
||||
}
|
||||
public String getVersion()
|
||||
{
|
||||
return "6";
|
||||
}
|
||||
|
||||
public String format(double amount) {
|
||||
return this.iConomy.format(amount);
|
||||
}
|
||||
public int fractionalDigits()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public boolean hasBanks() {
|
||||
return false;
|
||||
}
|
||||
public String format(double amount)
|
||||
{
|
||||
return com.iCo6.iConomy.format(amount);
|
||||
}
|
||||
|
||||
public boolean hasBank(String bank) {
|
||||
return false;
|
||||
}
|
||||
public boolean hasBanks()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasAccount(String name) {
|
||||
return (new Accounts()).exists(name);
|
||||
}
|
||||
public boolean hasBank(String bank)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasBankAccount(String bank, String name) {
|
||||
return false;
|
||||
}
|
||||
public boolean hasAccount(String name)
|
||||
{
|
||||
return (new Accounts()).exists(name);
|
||||
}
|
||||
|
||||
public MethodAccount getAccount(String name) {
|
||||
return new iCoAccount((new Accounts()).get(name));
|
||||
}
|
||||
public boolean hasBankAccount(String bank, String name)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public MethodBankAccount getBankAccount(String bank, String name) {
|
||||
return null;
|
||||
}
|
||||
public boolean createAccount(String name)
|
||||
{
|
||||
if (hasAccount(name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isCompatible(Plugin plugin) {
|
||||
try { Class.forName("com.iCo6.IO"); }
|
||||
catch(Exception e) { return false; }
|
||||
return (new Accounts()).create(name);
|
||||
}
|
||||
|
||||
return plugin.getDescription().getName().equalsIgnoreCase("iconomy") && plugin.getClass().getName().equals("com.iCo6.iConomy") && plugin instanceof iConomy;
|
||||
}
|
||||
public boolean createAccount(String name, Double balance)
|
||||
{
|
||||
if (hasAccount(name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setPlugin(Plugin plugin) {
|
||||
iConomy = (iConomy)plugin;
|
||||
}
|
||||
return (new Accounts()).create(name, balance);
|
||||
}
|
||||
|
||||
public class iCoAccount implements MethodAccount {
|
||||
private Account account;
|
||||
private Holdings holdings;
|
||||
public MethodAccount getAccount(String name)
|
||||
{
|
||||
return new iCoAccount((new Accounts()).get(name));
|
||||
}
|
||||
|
||||
public iCoAccount(Account account) {
|
||||
this.account = account;
|
||||
this.holdings = account.getHoldings();
|
||||
}
|
||||
public MethodBankAccount getBankAccount(String bank, String name)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Account getiCoAccount() {
|
||||
return account;
|
||||
}
|
||||
public boolean isCompatible(Plugin plugin)
|
||||
{
|
||||
return plugin.getDescription().getName().equalsIgnoreCase("iconomy")
|
||||
&& plugin.getClass().getName().equals("com.iCo6.iConomy")
|
||||
&& plugin instanceof iConomy;
|
||||
}
|
||||
|
||||
public double balance() {
|
||||
return this.holdings.getBalance();
|
||||
}
|
||||
public void setPlugin(Plugin plugin)
|
||||
{
|
||||
iConomy = (iConomy)plugin;
|
||||
}
|
||||
|
||||
public boolean set(double amount) {
|
||||
if(this.holdings == null) return false;
|
||||
this.holdings.setBalance(amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean add(double amount) {
|
||||
if(this.holdings == null) return false;
|
||||
this.holdings.add(amount);
|
||||
return true;
|
||||
}
|
||||
public class iCoAccount implements MethodAccount
|
||||
{
|
||||
private Account account;
|
||||
private Holdings holdings;
|
||||
|
||||
public boolean subtract(double amount) {
|
||||
if(this.holdings == null) return false;
|
||||
this.holdings.subtract(amount);
|
||||
return true;
|
||||
}
|
||||
public iCoAccount(Account account)
|
||||
{
|
||||
this.account = account;
|
||||
this.holdings = account.getHoldings();
|
||||
}
|
||||
|
||||
public boolean multiply(double amount) {
|
||||
if(this.holdings == null) return false;
|
||||
this.holdings.multiply(amount);
|
||||
return true;
|
||||
}
|
||||
public Account getiCoAccount()
|
||||
{
|
||||
return account;
|
||||
}
|
||||
|
||||
public boolean divide(double amount) {
|
||||
if(this.holdings == null) return false;
|
||||
this.holdings.divide(amount);
|
||||
return true;
|
||||
}
|
||||
public double balance()
|
||||
{
|
||||
return this.holdings.getBalance();
|
||||
}
|
||||
|
||||
public boolean hasEnough(double amount) {
|
||||
return this.holdings.hasEnough(amount);
|
||||
}
|
||||
public boolean set(double amount)
|
||||
{
|
||||
if (this.holdings == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.holdings.setBalance(amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasOver(double amount) {
|
||||
return this.holdings.hasOver(amount);
|
||||
}
|
||||
public boolean add(double amount)
|
||||
{
|
||||
if (this.holdings == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.holdings.add(amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasUnder(double amount) {
|
||||
return this.holdings.hasUnder(amount);
|
||||
}
|
||||
public boolean subtract(double amount)
|
||||
{
|
||||
if (this.holdings == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.holdings.subtract(amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isNegative() {
|
||||
return this.holdings.isNegative();
|
||||
}
|
||||
public boolean multiply(double amount)
|
||||
{
|
||||
if (this.holdings == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.holdings.multiply(amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean remove() {
|
||||
if(this.account == null) return false;
|
||||
this.account.remove();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean divide(double amount)
|
||||
{
|
||||
if (this.holdings == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.holdings.divide(amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasEnough(double amount)
|
||||
{
|
||||
return this.holdings.hasEnough(amount);
|
||||
}
|
||||
|
||||
public boolean hasOver(double amount)
|
||||
{
|
||||
return this.holdings.hasOver(amount);
|
||||
}
|
||||
|
||||
public boolean hasUnder(double amount)
|
||||
{
|
||||
return this.holdings.hasUnder(amount);
|
||||
}
|
||||
|
||||
public boolean isNegative()
|
||||
{
|
||||
return this.holdings.isNegative();
|
||||
}
|
||||
|
||||
public boolean remove()
|
||||
{
|
||||
if (this.account == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.account.remove();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
17
Essentials/src/com/earth2me/essentials/settings/Backup.java
Normal file
17
Essentials/src/com/earth2me/essentials/settings/Backup.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.earth2me.essentials.settings;
|
||||
|
||||
import com.earth2me.essentials.storage.Comment;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class Backup extends StorageObject
|
||||
{
|
||||
@Comment("Interval in minutes")
|
||||
private long interval = 60;
|
||||
@Comment("Add a command that backups your data, e.g. 'rdiff-backup World1 backups/World1'")
|
||||
private String command;
|
||||
}
|
32
Essentials/src/com/earth2me/essentials/settings/Chat.java
Normal file
32
Essentials/src/com/earth2me/essentials/settings/Chat.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.earth2me.essentials.settings;
|
||||
|
||||
import com.earth2me.essentials.storage.Comment;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class Chat extends StorageObject
|
||||
{
|
||||
@Comment("The character(s) to prefix all nicknames, so that you know they are not true usernames.")
|
||||
private String nicknamePrefix = "~";
|
||||
|
||||
@Comment("Disable this if you have any other plugin, that modifies the displayname of a user.")
|
||||
private boolean changeDisplayname = true;
|
||||
|
||||
private String displaynameFormat = "{PREFIX}{NICKNAMEPREFIX}{NAME}{SUFFIX}";
|
||||
|
||||
@Comment({
|
||||
"If EssentialsChat is installed, this will define how far a player's voice travels, in blocks. Set to 0 to make all chat global.",
|
||||
"Note that users with the \"essentials.chat.spy\" permission will hear everything, regardless of this setting.",
|
||||
"Users with essentials.chat.shout can override this by prefixing text with an exclamation mark (!)",
|
||||
"Or with essentials.chat.question can override this by prefixing text with a question mark (?)",
|
||||
"You can add command costs for shout/question by adding chat-shout and chat-question to the command costs section."
|
||||
})
|
||||
private int localRadius = 0;
|
||||
|
||||
@Comment("Set the default chat format here, it will be overwritten by group specific chat formats.")
|
||||
private String defaultFormat = "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}";
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
package com.earth2me.essentials.settings;
|
||||
|
||||
import com.earth2me.essentials.settings.commands.Afk;
|
||||
import com.earth2me.essentials.settings.commands.God;
|
||||
import com.earth2me.essentials.settings.commands.Help;
|
||||
import com.earth2me.essentials.settings.commands.Home;
|
||||
import com.earth2me.essentials.settings.commands.Kit;
|
||||
import com.earth2me.essentials.settings.commands.Lightning;
|
||||
import com.earth2me.essentials.settings.commands.Spawnmob;
|
||||
import com.earth2me.essentials.storage.Comment;
|
||||
import com.earth2me.essentials.storage.ListType;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class Commands extends StorageObject
|
||||
{
|
||||
private Afk afk = new Afk();
|
||||
private God god = new God();
|
||||
private Help help = new Help();
|
||||
private Home home = new Home();
|
||||
private Kit kit = new Kit();
|
||||
private Lightning lightning = new Lightning();
|
||||
private Spawnmob spawnmob = new Spawnmob();
|
||||
@ListType
|
||||
@Comment(
|
||||
{
|
||||
"When a command conflicts with another plugin, by default, Essentials will try to force the OTHER plugin to take",
|
||||
"priority. If a command is in this list, Essentials will try to give ITSELF priority. This does not always work:",
|
||||
"usually whichever plugin was updated most recently wins out. However, the full name of the command will always work.",
|
||||
"For example, if WorldGuard and Essentials are both enabled, and WorldGuard takes control over /god, /essentials:god",
|
||||
"will still map to Essentials, whereas it might normally get forced upon WorldGuard. Commands prefixed with an \"e\",",
|
||||
"such as /egod, will always grant Essentials priority.",
|
||||
"We should try to take priority over /god. If this doesn't work, use /essentials:god or /egod.",
|
||||
"If god is set using WorldGuard, use /ungod to remove then use whichever you see fit."
|
||||
})
|
||||
private List<String> overwritten = new ArrayList<String>();
|
||||
|
||||
@ListType
|
||||
@Comment("Disabled commands will be completelly unavailable on the server.")
|
||||
private List<String> disabled = new ArrayList<String>();
|
||||
}
|
42
Essentials/src/com/earth2me/essentials/settings/Economy.java
Normal file
42
Essentials/src/com/earth2me/essentials/settings/Economy.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.earth2me.essentials.settings;
|
||||
|
||||
import com.earth2me.essentials.storage.Comment;
|
||||
import com.earth2me.essentials.storage.MapType;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class Economy extends StorageObject
|
||||
{
|
||||
@Comment("Defines the balance with which new players begin. Defaults to 0.")
|
||||
private double startingBalance = 0.0;
|
||||
@MapType(Double.class)
|
||||
@Comment("Defines the cost to use the given commands PER USE")
|
||||
private Map<String, Double> commandCosts = new HashMap<String, Double>();
|
||||
@Comment("Set this to a currency symbol you want to use.")
|
||||
private String currencySymbol = "$";
|
||||
|
||||
public String getCurrencySymbol()
|
||||
{
|
||||
return currencySymbol == null || currencySymbol.isEmpty() ? "$" : currencySymbol.substring(0, 1);
|
||||
}
|
||||
private final transient static double MAXMONEY = 10000000000000.0;
|
||||
@Comment(
|
||||
{
|
||||
"Set the maximum amount of money a player can have",
|
||||
"The amount is always limited to 10 trillions because of the limitations of a java double"
|
||||
})
|
||||
private double maxMoney = MAXMONEY;
|
||||
|
||||
public double getMaxMoney()
|
||||
{
|
||||
return Math.abs(maxMoney) > MAXMONEY ? MAXMONEY : Math.abs(maxMoney);
|
||||
}
|
||||
@Comment("Enable this to log all interactions with trade/buy/sell signs and sell command")
|
||||
private boolean logEnabled = false;
|
||||
}
|
33
Essentials/src/com/earth2me/essentials/settings/General.java
Normal file
33
Essentials/src/com/earth2me/essentials/settings/General.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.earth2me.essentials.settings;
|
||||
|
||||
import com.earth2me.essentials.storage.Comment;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class General extends StorageObject
|
||||
{
|
||||
@Comment("Backup runs a command while saving is disabled")
|
||||
private Backup backup = new Backup();
|
||||
@Comment("You can disable the death messages of minecraft.")
|
||||
private boolean deathMessages = true;
|
||||
@Comment("Turn this on, if you want to see more error messages, if something goes wrong.")
|
||||
private boolean debug = false;
|
||||
@Comment(
|
||||
{
|
||||
"Set the locale here, if you want to change the language of Essentials.",
|
||||
"If this is not set, Essentials will use the language of your computer.",
|
||||
"Available locales: da, de, en, fr, nl"
|
||||
})
|
||||
private String locale;
|
||||
@Comment(
|
||||
{
|
||||
"Should we announce to the server when someone logs in for the first time?",
|
||||
"If so, use this format, replacing {DISPLAYNAME} with the player name.",
|
||||
"If not, set to ''"
|
||||
})
|
||||
private String newPlayerAnnouncement = "&dWelcome {DISPLAYNAME} to the server!";
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
package com.earth2me.essentials.settings;
|
||||
|
||||
import com.earth2me.essentials.storage.Comment;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class GroupOptions extends StorageObject
|
||||
{
|
||||
@Comment("Message format of chat messages")
|
||||
private String messageFormat;
|
||||
@Comment("Prefix for name")
|
||||
private String prefix;
|
||||
@Comment("Suffix for name")
|
||||
private String suffix;
|
||||
@Comment("Amount of homes a player can have")
|
||||
private Integer homes;
|
||||
@Comment("Cooldown between teleports")
|
||||
private Integer teleportCooldown;
|
||||
@Comment("Delay before teleport")
|
||||
private Integer teleportDelay;
|
||||
@Comment("Cooldown between heals")
|
||||
private Integer healCooldown;
|
||||
}
|
27
Essentials/src/com/earth2me/essentials/settings/Groups.java
Normal file
27
Essentials/src/com/earth2me/essentials/settings/Groups.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.earth2me.essentials.settings;
|
||||
|
||||
import com.earth2me.essentials.storage.Comment;
|
||||
import com.earth2me.essentials.storage.MapType;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import java.util.LinkedHashMap;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class Groups extends StorageObject
|
||||
{
|
||||
public Groups() {
|
||||
GroupOptions defaultOptions = new GroupOptions();
|
||||
groups.put("default", defaultOptions);
|
||||
}
|
||||
@Comment(
|
||||
{
|
||||
"The order of the groups matters, the groups are checked from top to bottom.",
|
||||
"All group names have to be lower case.",
|
||||
"The groups can be connected to users using the permission essentials.groups.groupname"
|
||||
})
|
||||
@MapType(GroupOptions.class)
|
||||
private LinkedHashMap<String, GroupOptions> groups = new LinkedHashMap<String, GroupOptions>();
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
package com.earth2me.essentials.settings;
|
||||
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.bukkit.Server;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class Location extends StorageObject
|
||||
{
|
||||
private String worldName = "Test";
|
||||
private double x;
|
||||
private double y;
|
||||
private double z;
|
||||
private Float yaw;
|
||||
private Float pitch;
|
||||
|
||||
public org.bukkit.Location getBukkit(Server server)
|
||||
{
|
||||
if (yaw == null || pitch == null)
|
||||
{
|
||||
return new org.bukkit.Location(server.getWorld(worldName), x, y, z);
|
||||
}
|
||||
return new org.bukkit.Location(server.getWorld(worldName), x, y, z, yaw, pitch);
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
package com.earth2me.essentials.settings;
|
||||
|
||||
import com.earth2me.essentials.storage.Comment;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class Settings extends StorageObject
|
||||
{
|
||||
@Comment(
|
||||
{
|
||||
"##########################################################",
|
||||
"+------------------------------------------------------+ #",
|
||||
"| General Settings | #",
|
||||
"+------------------------------------------------------+ #",
|
||||
"##########################################################"
|
||||
})
|
||||
private General general = new General();
|
||||
@Comment(
|
||||
{
|
||||
"##########################################################",
|
||||
"+------------------------------------------------------+ #",
|
||||
"| Chat Settings | #",
|
||||
"+------------------------------------------------------+ #",
|
||||
"##########################################################"
|
||||
})
|
||||
private Chat chat = new Chat();
|
||||
@Comment(
|
||||
{
|
||||
"##########################################################",
|
||||
"+------------------------------------------------------+ #",
|
||||
"| Economy Settings | #",
|
||||
"+------------------------------------------------------+ #",
|
||||
"##########################################################"
|
||||
})
|
||||
private Economy economy = new Economy();
|
||||
@Comment(
|
||||
{
|
||||
"##########################################################",
|
||||
"+------------------------------------------------------+ #",
|
||||
"| Commands Settings | #",
|
||||
"+------------------------------------------------------+ #",
|
||||
"##########################################################"
|
||||
})
|
||||
private Commands commands = new Commands();
|
||||
@Comment(
|
||||
{
|
||||
"##########################################################",
|
||||
"+------------------------------------------------------+ #",
|
||||
"| Group Settings | #",
|
||||
"+------------------------------------------------------+ #",
|
||||
"##########################################################"
|
||||
})
|
||||
private Groups groups = new Groups();
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package com.earth2me.essentials.settings.commands;
|
||||
|
||||
import com.earth2me.essentials.storage.Comment;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class Afk extends StorageObject
|
||||
{
|
||||
@Comment(
|
||||
{
|
||||
"After this timeout in seconds, the user will be set as afk.",
|
||||
"Set to -1 for no timeout."
|
||||
})
|
||||
private int autoAFK = 300;
|
||||
@Comment(
|
||||
{
|
||||
"Auto-AFK Kick",
|
||||
"After this timeout in seconds, the user will be kicked from the server.",
|
||||
"Set to -1 for no timeout."
|
||||
})
|
||||
private int autoAFKKick = -1;
|
||||
@Comment(
|
||||
{
|
||||
"Set this to true, if you want to freeze the player, if he is afk.",
|
||||
"Other players or monsters can't push him out of afk mode then.",
|
||||
"This will also enable temporary god mode for the afk player.",
|
||||
"The player has to use the command /afk to leave the afk mode.",
|
||||
"You have to add a message to your welcome message or help page,",
|
||||
"since the player will not get a message, if he tries to move."
|
||||
})
|
||||
private boolean freezeAFKPlayers = false;
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.earth2me.essentials.settings.commands;
|
||||
|
||||
import com.earth2me.essentials.storage.Comment;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
public class God extends StorageObject
|
||||
{
|
||||
@Comment("Turn off god mode when people exit")
|
||||
private boolean removeOnDisconnect = false;
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
package com.earth2me.essentials.settings.commands;
|
||||
|
||||
import com.earth2me.essentials.storage.Comment;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class Help extends StorageObject
|
||||
{
|
||||
@Comment("Show other plugins commands in help")
|
||||
private boolean showNonEssCommandsInHelp = true;
|
||||
@Comment(
|
||||
{
|
||||
"Hide plugins which don't give a permission in their plugin.yml for each command.",
|
||||
"You can override a true value here for a single plugin by adding a permission to a user/group.",
|
||||
"The individual permission is: essentials.help.<plugin>, anyone with essentials.* or '*' will see all help this setting reguardless.",
|
||||
"You can use negative permissions to remove access to just a single plugins help if the following is enabled."
|
||||
})
|
||||
private boolean hidePermissionlessCommands = true;
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package com.earth2me.essentials.settings.commands;
|
||||
|
||||
import com.earth2me.essentials.storage.Comment;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class Home extends StorageObject
|
||||
{
|
||||
@Comment("When players die, should they respawn at their homes, instead of the spawnpoint?")
|
||||
private boolean respawnAtHome = false;
|
||||
@Comment(
|
||||
{
|
||||
"When a player interacts with a bed, should their home be set to that location?",
|
||||
"If you enable this and remove default player access to the /sethome command, ",
|
||||
"you can make beds the only way for players to set their home location."
|
||||
})
|
||||
private boolean bedSetsHome = false;
|
||||
@Comment("If no home is set, should the player be send to spawn, when /home is used.")
|
||||
private boolean spawnIfNoHome = false;
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
package com.earth2me.essentials.settings.commands;
|
||||
|
||||
import com.earth2me.essentials.storage.MapType;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class Kit extends StorageObject
|
||||
{
|
||||
|
||||
public Kit()
|
||||
{
|
||||
final KitObject kit = new KitObject();
|
||||
kit.setDelay(10.0);
|
||||
kit.setItems(Arrays.asList("277 1,278 1,279 1".split(",")));
|
||||
kits.put("tools", kit);
|
||||
}
|
||||
|
||||
|
||||
@MapType(KitObject.class)
|
||||
private Map<String,KitObject> kits = new HashMap<String, KitObject>();
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package com.earth2me.essentials.settings.commands;
|
||||
|
||||
import com.earth2me.essentials.storage.ListType;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class KitObject extends StorageObject
|
||||
{
|
||||
@ListType
|
||||
private List<String> items = new ArrayList<String>();
|
||||
private Double delay;
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.earth2me.essentials.settings.commands;
|
||||
|
||||
import com.earth2me.essentials.storage.Comment;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class Lightning extends StorageObject
|
||||
{
|
||||
@Comment("Shall we notify users when using /lightning")
|
||||
private boolean warnPlayer = true;
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.earth2me.essentials.settings.commands;
|
||||
|
||||
import com.earth2me.essentials.storage.Comment;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class Spawnmob extends StorageObject
|
||||
{
|
||||
@Comment("The maximum amount of monsters, a player can spawn with a call of /spawnmob.")
|
||||
private int limit = 10;
|
||||
}
|
@@ -223,7 +223,7 @@ public class EssentialsSign
|
||||
if (signblock.getType() == Material.WALL_SIGN)
|
||||
{
|
||||
final org.bukkit.material.Sign signMat = (org.bukkit.material.Sign)signblock.getState().getData();
|
||||
if (signMat.getFacing() == blockFace && isValidSign(new BlockSign(signblock)))
|
||||
if (signMat != null && signMat.getFacing() == blockFace && isValidSign(new BlockSign(signblock)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@@ -27,7 +27,9 @@ public class SignBuy extends EssentialsSign
|
||||
final Trade items = getTrade(sign, 1, 2, player, ess);
|
||||
final Trade charge = getTrade(sign, 3, ess);
|
||||
charge.isAffordableFor(player);
|
||||
items.pay(player);
|
||||
if (!items.pay(player, false)) {
|
||||
throw new ChargeException("Inventory full");
|
||||
}
|
||||
charge.charge(player);
|
||||
Trade.log("Sign", "Buy", "Interact", username, charge, username, items, sign.getBlock().getLocation(), ess);
|
||||
return true;
|
||||
|
@@ -10,7 +10,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SignTrade extends EssentialsSign
|
||||
{
|
||||
|
||||
public SignTrade()
|
||||
{
|
||||
super("Trade");
|
||||
@@ -34,25 +33,33 @@ public class SignTrade extends EssentialsSign
|
||||
{
|
||||
if (sign.getLine(3).substring(2).equalsIgnoreCase(username))
|
||||
{
|
||||
final Trade store = rechargeSign(sign, ess, player);
|
||||
Trade stored = null;
|
||||
try
|
||||
{
|
||||
final Trade stored = getTrade(sign, 1, true, true, ess);
|
||||
stored = getTrade(sign, 1, true, true, ess);
|
||||
substractAmount(sign, 1, stored, ess);
|
||||
stored.pay(player);
|
||||
Trade.log("Sign", "Trade", "OwnerInteract", username, null, username, stored, sign.getBlock().getLocation(), ess);
|
||||
}
|
||||
}
|
||||
catch (SignException e)
|
||||
{
|
||||
throw new SignException(Util.i18n("tradeSignEmptyOwner"));
|
||||
}
|
||||
if (store == null)
|
||||
{
|
||||
throw new SignException(Util.i18n("tradeSignEmptyOwner"), e);
|
||||
}
|
||||
}
|
||||
Trade.log("Sign", "Trade", "OwnerInteract", username, store, username, stored, sign.getBlock().getLocation(), ess);
|
||||
}
|
||||
else
|
||||
{
|
||||
final Trade charge = getTrade(sign, 1, false, false, ess);
|
||||
final Trade trade = getTrade(sign, 2, false, true, ess);
|
||||
charge.isAffordableFor(player);
|
||||
if (!trade.pay(player, false))
|
||||
{
|
||||
throw new ChargeException("Full inventory");
|
||||
}
|
||||
substractAmount(sign, 2, trade, ess);
|
||||
trade.pay(player);
|
||||
addAmount(sign, 1, charge, ess);
|
||||
charge.charge(player);
|
||||
Trade.log("Sign", "Trade", "Interact", sign.getLine(3), charge, username, trade, sign.getBlock().getLocation(), ess);
|
||||
@@ -61,17 +68,48 @@ public class SignTrade extends EssentialsSign
|
||||
return true;
|
||||
}
|
||||
|
||||
private Trade rechargeSign(final ISign sign, final IEssentials ess, final User player) throws SignException, ChargeException
|
||||
{
|
||||
final Trade trade = getTrade(sign, 2, false, false, ess);
|
||||
if (trade.getItemStack() != null && player.getItemInHand() != null
|
||||
&& trade.getItemStack().getTypeId() == player.getItemInHand().getTypeId()
|
||||
&& trade.getItemStack().getDurability() == player.getItemInHand().getDurability())
|
||||
{
|
||||
int amount = player.getItemInHand().getAmount();
|
||||
amount -= amount % trade.getItemStack().getAmount();
|
||||
if (amount > 0)
|
||||
{
|
||||
final Trade store = new Trade(new ItemStack(player.getItemInHand().getTypeId(), amount, player.getItemInHand().getDurability()), ess);
|
||||
addAmount(sign, 2, store, ess);
|
||||
store.charge(player);
|
||||
return store;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onSignBreak(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException
|
||||
{
|
||||
if ((sign.getLine(3).length() > 3 && sign.getLine(3).substring(2).equalsIgnoreCase(username))
|
||||
|| player.isAuthorized("essentials.signs.trade.override"))
|
||||
{
|
||||
final Trade stored1 = getTrade(sign, 1, true, false, ess);
|
||||
final Trade stored2 = getTrade(sign, 2, true, false, ess);
|
||||
stored1.pay(player);
|
||||
stored2.pay(player);
|
||||
Trade.log("Sign", "Trade", "Break", username, stored2, username, stored1, sign.getBlock().getLocation(), ess);
|
||||
try
|
||||
{
|
||||
final Trade stored1 = getTrade(sign, 1, true, false, ess);
|
||||
final Trade stored2 = getTrade(sign, 2, true, false, ess);
|
||||
stored1.pay(player);
|
||||
stored2.pay(player);
|
||||
Trade.log("Sign", "Trade", "Break", username, stored2, username, stored1, sign.getBlock().getLocation(), ess);
|
||||
}
|
||||
catch (SignException e)
|
||||
{
|
||||
if (player.isAuthorized("essentials.signs.trade.override"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -128,7 +166,7 @@ public class SignTrade extends EssentialsSign
|
||||
throw new SignException(Util.i18n("moreThanZero"));
|
||||
}
|
||||
String newline = amount + " " + split[1] + ":0";
|
||||
if ((newline + amount).length() > 16)
|
||||
if ((newline + amount).length() > 15)
|
||||
{
|
||||
throw new SignException("Line can be too long!");
|
||||
}
|
||||
@@ -237,7 +275,12 @@ public class SignTrade extends EssentialsSign
|
||||
final Double amount = getDouble(split[1]);
|
||||
if (money != null && amount != null)
|
||||
{
|
||||
sign.setLine(index, Util.formatCurrency(money, ess) + ":" + Util.formatCurrency(amount + value, ess).substring(1));
|
||||
final String newline = Util.formatCurrency(money, ess) + ":" + Util.formatCurrency(amount + value, ess).substring(1);
|
||||
if (newline.length() > 15)
|
||||
{
|
||||
throw new SignException("Line too long!");
|
||||
}
|
||||
sign.setLine(index, newline);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -247,7 +290,12 @@ public class SignTrade extends EssentialsSign
|
||||
final int stackamount = getIntegerPositive(split[0]);
|
||||
final ItemStack item = getItemStack(split[1], stackamount, ess);
|
||||
final int amount = getInteger(split[2]);
|
||||
sign.setLine(index, stackamount + " " + split[1] + ":" + (amount + Math.round(value)));
|
||||
final String newline = stackamount + " " + split[1] + ":" + (amount + Math.round(value));
|
||||
if (newline.length() > 15)
|
||||
{
|
||||
throw new SignException("Line too long!");
|
||||
}
|
||||
sign.setLine(index, newline);
|
||||
return;
|
||||
}
|
||||
throw new SignException(Util.format("invalidSignLine", index + 1));
|
||||
|
16
Essentials/src/com/earth2me/essentials/storage/Comment.java
Normal file
16
Essentials/src/com/earth2me/essentials/storage/Comment.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.earth2me.essentials.storage;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
@Target(ElementType.FIELD)
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Comment
|
||||
{
|
||||
String[] value() default "";
|
||||
}
|
14
Essentials/src/com/earth2me/essentials/storage/ListType.java
Normal file
14
Essentials/src/com/earth2me/essentials/storage/ListType.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.earth2me.essentials.storage;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface ListType
|
||||
{
|
||||
Class value() default String.class;
|
||||
}
|
14
Essentials/src/com/earth2me/essentials/storage/MapType.java
Normal file
14
Essentials/src/com/earth2me/essentials/storage/MapType.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.earth2me.essentials.storage;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface MapType
|
||||
{
|
||||
Class value() default String.class;
|
||||
}
|
@@ -0,0 +1,250 @@
|
||||
package com.earth2me.essentials.storage;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Reader;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.yaml.snakeyaml.DumperOptions;
|
||||
import org.yaml.snakeyaml.TypeDescription;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import org.yaml.snakeyaml.composer.Composer;
|
||||
import org.yaml.snakeyaml.constructor.Constructor;
|
||||
import org.yaml.snakeyaml.introspector.PropertyUtils;
|
||||
|
||||
|
||||
public class StorageObject
|
||||
{
|
||||
protected Class<? extends StorageObject> clazz;
|
||||
|
||||
protected StorageObject()
|
||||
{
|
||||
}
|
||||
private static Map<Class, Constructor> constructors = new HashMap<Class, Constructor>();
|
||||
|
||||
public static <T extends StorageObject> T load(Class<? extends T> clazz, Reader reader)
|
||||
{
|
||||
Constructor constructor;
|
||||
if (constructors.containsKey(clazz))
|
||||
{
|
||||
constructor = constructors.get(clazz);
|
||||
}
|
||||
else
|
||||
{
|
||||
constructor = prepareConstructor(clazz);
|
||||
constructors.put(clazz, constructor);
|
||||
}
|
||||
|
||||
final Yaml yaml = new Yaml(constructor);
|
||||
T ret = (T)yaml.load(reader);
|
||||
if (ret == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
ret = (T)clazz.newInstance();
|
||||
}
|
||||
catch (InstantiationException ex)
|
||||
{
|
||||
Logger.getLogger(StorageObject.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
catch (IllegalAccessException ex)
|
||||
{
|
||||
Logger.getLogger(StorageObject.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
ret.clazz = clazz;
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static Constructor prepareConstructor(final Class<?> clazz)
|
||||
{
|
||||
final Constructor constructor = new Constructor(clazz);
|
||||
final Set<Class> classes = new HashSet<Class>();
|
||||
|
||||
prepareConstructor(constructor, classes, clazz);
|
||||
return constructor;
|
||||
}
|
||||
|
||||
private static void prepareConstructor(final Constructor constructor, final Set<Class> classes, final Class clazz)
|
||||
{
|
||||
classes.add(clazz);
|
||||
final TypeDescription description = new TypeDescription(clazz);
|
||||
for (Field field : clazz.getDeclaredFields())
|
||||
{
|
||||
final ListType listType = field.getAnnotation(ListType.class);
|
||||
if (listType != null)
|
||||
{
|
||||
description.putListPropertyType(field.getName(), listType.value());
|
||||
if (StorageObject.class.isAssignableFrom(listType.value())
|
||||
&& !classes.contains(listType.value()))
|
||||
{
|
||||
prepareConstructor(constructor, classes, listType.value());
|
||||
}
|
||||
}
|
||||
final MapType mapType = field.getAnnotation(MapType.class);
|
||||
if (mapType != null)
|
||||
{
|
||||
description.putMapPropertyType(field.getName(), String.class, mapType.value());
|
||||
if (StorageObject.class.isAssignableFrom(mapType.value())
|
||||
&& !classes.contains(mapType.value()))
|
||||
{
|
||||
prepareConstructor(constructor, classes, mapType.value());
|
||||
}
|
||||
}
|
||||
if (StorageObject.class.isAssignableFrom(field.getType())
|
||||
&& !classes.contains(field.getType()))
|
||||
{
|
||||
prepareConstructor(constructor, classes, field.getType());
|
||||
}
|
||||
}
|
||||
constructor.addTypeDescription(description);
|
||||
}
|
||||
private transient Yaml yaml;
|
||||
|
||||
public void save(final PrintWriter writer)
|
||||
{
|
||||
final DumperOptions ops = new DumperOptions();
|
||||
yaml = new Yaml(ops);
|
||||
try
|
||||
{
|
||||
writeToFile(this, writer, 0, clazz);
|
||||
}
|
||||
catch (IllegalArgumentException ex)
|
||||
{
|
||||
Logger.getLogger(StorageObject.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
catch (IllegalAccessException ex)
|
||||
{
|
||||
Logger.getLogger(StorageObject.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void writeToFile(final Object object, final PrintWriter writer, final int depth, final Class clazz) throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
for (Field field : clazz.getDeclaredFields())
|
||||
{
|
||||
final int modifier = field.getModifiers();
|
||||
if (Modifier.isPrivate(modifier) && !Modifier.isTransient(modifier) && !Modifier.isStatic(modifier))
|
||||
{
|
||||
field.setAccessible(true);
|
||||
final boolean commentPresent = field.isAnnotationPresent(Comment.class);
|
||||
final String name = field.getName();
|
||||
if (commentPresent)
|
||||
{
|
||||
final Comment comments = field.getAnnotation(Comment.class);
|
||||
for (String comment : comments.value())
|
||||
{
|
||||
final String trimmed = comment.trim();
|
||||
if (trimmed.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
writeIndention(writer, depth);
|
||||
writer.print("# ");
|
||||
writer.print(trimmed);
|
||||
writer.println();
|
||||
}
|
||||
}
|
||||
|
||||
final Object data = field.get(object);
|
||||
if (data == null && !commentPresent)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
writeIndention(writer, depth);
|
||||
if (data == null && commentPresent)
|
||||
{
|
||||
writer.print('#');
|
||||
}
|
||||
writer.print(name);
|
||||
writer.print(": ");
|
||||
if (data == null && commentPresent)
|
||||
{
|
||||
writer.println();
|
||||
writer.println();
|
||||
continue;
|
||||
}
|
||||
if (data instanceof StorageObject)
|
||||
{
|
||||
writer.println();
|
||||
writeToFile(data, writer, depth + 1, data.getClass());
|
||||
}
|
||||
else if (data instanceof Map)
|
||||
{
|
||||
writer.println();
|
||||
for (Entry<String, Object> entry : ((Map<String, Object>)data).entrySet())
|
||||
{
|
||||
final Object value = entry.getValue();
|
||||
if (value != null)
|
||||
{
|
||||
writeIndention(writer, depth + 1);
|
||||
writer.print(entry.getKey());
|
||||
writer.print(": ");
|
||||
if (value instanceof StorageObject)
|
||||
{
|
||||
writer.println();
|
||||
writeToFile(value, writer, depth + 2, value.getClass());
|
||||
}
|
||||
else if (value instanceof String || value instanceof Boolean || value instanceof Number)
|
||||
{
|
||||
yaml.dumpAll(Collections.singletonList(value).iterator(), writer);
|
||||
writer.println();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (data instanceof Collection)
|
||||
{
|
||||
writer.println();
|
||||
for (Object entry : (Collection<Object>)data)
|
||||
{
|
||||
if (entry != null)
|
||||
{
|
||||
writeIndention(writer, depth + 1);
|
||||
writer.print("- ");
|
||||
if (entry instanceof String || entry instanceof Boolean || entry instanceof Number)
|
||||
{
|
||||
yaml.dumpAll(Collections.singletonList(entry).iterator(), writer);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
}
|
||||
writer.println();
|
||||
}
|
||||
else if (data instanceof String || data instanceof Boolean || data instanceof Number)
|
||||
{
|
||||
yaml.dumpAll(Collections.singletonList(data).iterator(), writer);
|
||||
writer.println();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void writeIndention(final PrintWriter writer, final int depth)
|
||||
{
|
||||
for (int i = 0; i < depth; i++)
|
||||
{
|
||||
writer.print(" ");
|
||||
}
|
||||
}
|
||||
}
|
@@ -79,15 +79,6 @@ reclaim-onlogout: false
|
||||
# Should primitive spawn protection be enabled? For most servers, this should be flase; it is better to use a third-party plugin to protect it.
|
||||
spawn-protection: false
|
||||
|
||||
# Nether settings (switch between worlds with "/world nether" and "/world normal")
|
||||
# Sets whether the nether system is enabled, what folder to save the world in, and whether portals should teleport players between worlds.
|
||||
nether:
|
||||
enabled: false
|
||||
folder: nether
|
||||
portals-enabled: false
|
||||
generate-exit-portals: false
|
||||
ratio: 16
|
||||
|
||||
# Mob limit on spawnmob
|
||||
spawnmob-limit: 10
|
||||
|
||||
@@ -95,6 +86,7 @@ spawnmob-limit: 10
|
||||
warn-on-smite: true
|
||||
|
||||
# The message of the day, displayed on connect and by typing /motd.
|
||||
# Valid tags are: {PLAYER}, {IP}, {BALANCE}, {MAILS}, {WORLD}, {ONLINE}, {UNIQUE}, {PLAYERLIST}
|
||||
motd:
|
||||
- '&cWelcome, {PLAYER}&c!'
|
||||
- '&fType &c/help&f for a list of commands.'
|
||||
@@ -246,6 +238,9 @@ auto-afk-kick: -1
|
||||
# The player has to use the command /afk to leave the afk mode.
|
||||
freeze-afk-players: false
|
||||
|
||||
# You can disable the death messages of minecraft here
|
||||
death-messages: true
|
||||
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
# | EssentialsHome | #
|
||||
@@ -262,10 +257,16 @@ bed-sethome: false
|
||||
# If no home is set send you to spawn when /home is used
|
||||
spawn-if-no-home: false
|
||||
|
||||
# If users have essentials.sethome.multiple how many homes can they have
|
||||
# People with essentials.sethome.multiple.unlimited are not limited by this number
|
||||
multiple-homes: 5
|
||||
|
||||
# Allow players to have multiple homes.
|
||||
# Define different amounts of multiple homes for different permissions, e.g. essentials.sethome.multiple.vip
|
||||
# People with essentials.sethome.multiple.unlimited are not limited by these numbers.
|
||||
sethome-multiple:
|
||||
# essentials.sethome.multiple
|
||||
default: 3
|
||||
# essentials.sethome.multiple.vip
|
||||
vip: 5
|
||||
# essentials.sethome.multiple.staff
|
||||
staff: 10
|
||||
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
@@ -488,7 +489,7 @@ protect:
|
||||
use: true
|
||||
|
||||
# Should we tell people they are not allowed to build
|
||||
warn-on-build-disallow: false
|
||||
warn-on-build-disallow: true
|
||||
|
||||
|
||||
# Disable weather options
|
||||
|
@@ -501,20 +501,20 @@ detecttrack,28,0
|
||||
detectrail,28,0
|
||||
dtrack,28,0
|
||||
drail,28,0
|
||||
stickypistonbase,29,0
|
||||
stickypiston,29,0
|
||||
stickpistonbase,29,0
|
||||
stickpiston,29,0
|
||||
stickyp,29,0
|
||||
spistonbase,29,0
|
||||
spiston,29,0
|
||||
pistonstickybase,29,0
|
||||
pistonsticky,29,0
|
||||
pistonstickbase,29,0
|
||||
pistonstick,29,0
|
||||
pistonsbase,29,0
|
||||
pistons,29,0
|
||||
psticky,29,0
|
||||
stickypistonbase,29,7
|
||||
stickypiston,29,7
|
||||
stickpistonbase,29,7
|
||||
stickpiston,29,7
|
||||
stickyp,29,7
|
||||
spistonbase,29,7
|
||||
spiston,29,7
|
||||
pistonstickybase,29,7
|
||||
pistonsticky,29,7
|
||||
pistonstickbase,29,7
|
||||
pistonstick,29,7
|
||||
pistonsbase,29,7
|
||||
pistons,29,7
|
||||
psticky,29,7
|
||||
spiderweb,30,0
|
||||
sweb,30,0
|
||||
web,30,0
|
||||
@@ -534,21 +534,21 @@ deadshrub,32,0
|
||||
shrubdead,32,0
|
||||
dshrub,32,0
|
||||
shrubd,32,0
|
||||
normalpistonbase,33,0
|
||||
normalpiston,33,0
|
||||
normpistonbase,33,0
|
||||
normpiston,33,0
|
||||
npistonbase,33,0
|
||||
npiston,33,0
|
||||
pistonnormalbase,33,0
|
||||
pistonnormal,33,0
|
||||
pistonnormbase,33,0
|
||||
pistonnorm,33,0
|
||||
pistonnbase,33,0
|
||||
pistonn,33,0
|
||||
pistonbase,33,0
|
||||
piston,33,0
|
||||
pistonblock,33,0
|
||||
normalpistonbase,33,7
|
||||
normalpiston,33,7
|
||||
normpistonbase,33,7
|
||||
normpiston,33,7
|
||||
npistonbase,33,7
|
||||
npiston,33,7
|
||||
pistonnormalbase,33,7
|
||||
pistonnormal,33,7
|
||||
pistonnormbase,33,7
|
||||
pistonnorm,33,7
|
||||
pistonnbase,33,7
|
||||
pistonn,33,7
|
||||
pistonbase,33,7
|
||||
piston,33,7
|
||||
pistonblock,33,7
|
||||
pistonextensionnormal,34,0
|
||||
pistonextensionnorm,34,0
|
||||
pistonextensionn,34,0
|
||||
@@ -1259,10 +1259,12 @@ sfstone,97,0
|
||||
stonesilverfish,97,0
|
||||
fishstone,97,0
|
||||
trapstone,97,0
|
||||
silverfish,97,0
|
||||
stonebrick,98,0
|
||||
stonebricks,98,0
|
||||
stonebrickblock,98,0
|
||||
stonebb,98,0
|
||||
sbrick,98,0
|
||||
mossystonebrick,98,1
|
||||
mossystonebricks,98,1
|
||||
mossystonebrickblock,98,1
|
||||
|
|
@@ -54,7 +54,7 @@ deleteJail = \u00a77Jail {0} has been removed.
|
||||
deleteWarp = \u00a77Warp {0} has been removed.
|
||||
deniedAccessCommand = {0} was denied access to command.
|
||||
dependancyDownloaded = [Essentials] Dependancy {0} downloaded successfully.
|
||||
dependancyException = [Essentials] An error occured when trying to download a dependacy
|
||||
dependancyException = [Essentials] An error occurred when trying to download a dependacy
|
||||
dependancyNotFound = [Essentials] A required dependancy was not found, downloading now.
|
||||
depth = \u00a77You are at sea level.
|
||||
depthAboveSea = \u00a77You are {0} block(s) above sea level.
|
||||
@@ -171,7 +171,7 @@ mobsAvailable = \u00a77Mobs: {0}
|
||||
mobSpawnError = Error while changing mob spawner.
|
||||
mobSpawnLimit = Mob quantity limited to server limit
|
||||
mobSpawnTarget = Target block must be a mob spawner.
|
||||
moneyRecievedFrom = \u00a7a{0} has been recieved from {1}
|
||||
moneyRecievedFrom = \u00a7a{0} has been received from {1}
|
||||
moneySentTo = \u00a7a{0} has been sent to {1}
|
||||
moneyTaken = {0} taken from your bank account.
|
||||
month = month
|
||||
@@ -265,7 +265,7 @@ requestAcceptedFrom = \u00a77{0} accepted your teleport request.
|
||||
requestDenied = \u00a77Teleport request denied.
|
||||
requestDeniedFrom = \u00a77{0} denied your teleport request.
|
||||
requestSent = \u00a77Request sent to {0}\u00a77.
|
||||
returnPlayerToJailError = Error occured when trying to return player to jail.
|
||||
returnPlayerToJailError = Error occurred when trying to return player to jail.
|
||||
second = second
|
||||
seconds = seconds
|
||||
seenOffline = Player {0} is offline since {1}
|
||||
@@ -351,10 +351,10 @@ warpSet = \u00a77Warp {0} set.
|
||||
warpUsePermission = \u00a7cYou do not have Permission to use that warp.
|
||||
warpingTo = \u00a77Warping to {0}.
|
||||
warpsCount = \u00a77There are {0} warps. Showing page {1} of {2}.
|
||||
weatherStorm = \u00a77You set the weather to storm in your world
|
||||
weatherStormFor = \u00a77You set the weather to storm in your world for {0} seconds
|
||||
weatherSun = \u00a77You set the weather to sun in your world
|
||||
weatherSunFor = \u00a77You set the weather to sun in your world for {0} seconds
|
||||
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
|
||||
whoisGeoLocation = \u00a79 - Location: {0}
|
||||
whoisHealth = \u00a79 - Health: {0}/20
|
||||
whoisIPAddress = \u00a79 - IP Address: {0}
|
||||
|
@@ -350,10 +350,10 @@ warpSet = \u00a77Warp {0} sat.
|
||||
warpUsePermission = \u00a7cDu har ikke tilladelse til at benytte den warp.
|
||||
warpingTo = \u00a77Warper til {0}.
|
||||
warpsCount = \u00a77There are {0} warps. Showing page {1} of {2}.
|
||||
weatherStorm = \u00a77Du har sat vejret til storm i din verden
|
||||
weatherStormFor = \u00a77Du har sat vejret til storm i din verden i {0} sekunder
|
||||
weatherSun = \u00a77Du har sat vejret til sol
|
||||
weatherSunFor = \u00a77Du har sat vejret til sol i din verden i {0} sekunder
|
||||
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
|
||||
whoisGeoLocation = \u00a79 - Placering: {0}
|
||||
whoisHealth = \u00a79 - Helbred: {0}/20
|
||||
whoisIPAddress = \u00a79 - IP Addresse: {0}
|
||||
|
@@ -53,9 +53,9 @@ deleteHome = \u00a77Zuhause {0} wurde gel\u00f6scht.
|
||||
deleteJail = \u00a77Gef\u00e4ngnis {0} wurde gel\u00f6scht.
|
||||
deleteWarp = \u00a77Warp-Punkt {0} wurde gel\u00f6scht.
|
||||
deniedAccessCommand = {0} hat keinen Zugriff auf diesen Befehl.
|
||||
dependancyDownloaded = [Essentials] Dependancy {0} downloaded successfully.
|
||||
dependancyException = [Essentials] An error occured when trying to download a dependacy
|
||||
dependancyNotFound = [Essentials] A required dependancy was not found, downloading now.
|
||||
dependancyDownloaded = [Essentials] Abh\u00e4ngigkeit {0} erfolgreich runtergeladen.
|
||||
dependancyException = [Essentials] W\u00e4hrend dem Download von einer Abh\u00e4ngigkeit ist ein Fehler aufgetreten.
|
||||
dependancyNotFound = [Essentials] Eine erforderliche Abh\u00e4ngigkeit wurde nicht gefunde, Download startet jetzt..
|
||||
depth = \u00a77Du bist auf Meeresh\u00f6he.
|
||||
depthAboveSea = \u00a77Du bist {0} Bl\u00f6cke \u00fcber Meeresh\u00f6he.
|
||||
depthBelowSea = \u00a77Du bist {0} Bl\u00f6cke unter Meeresh\u00f6he.
|
||||
@@ -87,7 +87,7 @@ generatingPortal = \u00a77Erstelle ein Ausgangsportal.
|
||||
geoIpUrlEmpty = GeoIP Download-URL ist leer.
|
||||
geoIpUrlInvalid = GeoIP Download-URL ist ung\u00fcltig.
|
||||
geoipJoinFormat = Spieler {0} kommt aus {1}
|
||||
godDisabledFor = aktiviert f\u00fcr {0}
|
||||
godDisabledFor = deaktiviert f\u00fcr {0}
|
||||
godEnabledFor = aktiviert f\u00fcr {0}
|
||||
godMode = \u00a77Unsterblichkeit {0}.
|
||||
haveBeenReleased = \u00a77Du wurdest frei gelassen.
|
||||
@@ -99,7 +99,7 @@ helpPages = Seite \u00a7c{0}\u00a7f von \u00a7c{1}\u00a7f:
|
||||
holeInFloor = Loch im Boden
|
||||
homeSet = \u00a77Zuhause gesetzt.
|
||||
homeSetToBed = \u00a77Dein Zuhause ist nun an diesem Bett.
|
||||
homes = Homes: {0}
|
||||
homes = Heime: {0}
|
||||
hour = Stunde
|
||||
hours = Stunden
|
||||
ignorePlayer = Du ignorierst ab jetzt Spieler {0}.
|
||||
@@ -132,11 +132,11 @@ itemSoldConsole = {0} verkauft {1} f\u00fcr \u00a77{2}\u00a77 ({3} Einheiten je
|
||||
itemSpawn = \u00a77Gebe {0}x {1}
|
||||
itemsCsvNotLoaded = Konnte items.csv nicht laden.
|
||||
jailAlreadyIncarcerated = \u00a7cPerson is already in jail: {0}
|
||||
jailMessage = \u00a7cYou do the crime, you do the time.
|
||||
jailMessage = \u00a7cDu hast ein Verbrechen begangen, also hast du Zeit.
|
||||
jailNotExist = Dieses Gef\u00e4ngnis existiert nicht.
|
||||
jailReleased = \u00a77Player \u00a7e{0}\u00a77 unjailed.
|
||||
jailReleasedPlayerNotify = \u00a77You have been released!
|
||||
jailSentenceExtended = Jail time extend to: {0)
|
||||
jailReleased = \u00a77Spieler \u00a7e{0}\u00a77 wurde freigelassen.
|
||||
jailReleasedPlayerNotify = \u00a77Du wurdest freigelassen!
|
||||
jailSentenceExtended = Gef\u00e4ngnisszeit erweitert auf: {0)
|
||||
jailSet = \u00a77Gef\u00e4ngnis {0} wurde erstellt.
|
||||
jumpError = Das w\u00fcrde deinen Computer \u00fcberlasten.
|
||||
kickDefault = Vom Server geworfen
|
||||
@@ -193,7 +193,7 @@ nickSet = \u00a77Dein Nickname ist nun \u00a7c{0}
|
||||
noAccessCommand = \u00a7cDu hast keinen Zugriff auf diesen Befehl.
|
||||
noAccessPermission = \u00a7cDu hast keine Rechte, den Block {0} zu \u00f6ffnen.
|
||||
noDestroyPermission = \u00a7cDu hast keine Rechte, den Block {0} zu zerst\u00f6ren.
|
||||
noHelpFound = \u00a7cNo matching commands.
|
||||
noHelpFound = \u00a7cKeine \u00fcbereinstimmenden Kommandos.
|
||||
noHomeSet = Du hast kein Zuhause gesetzt.
|
||||
noHomeSetPlayer = Spieler hat kein Zuhause gesetzt.
|
||||
noKitPermission = \u00a7cDu brauchst die Berechtigung \u00a7c{0}\u00a7c um diese Ausr\u00fcstung anzufordern.
|
||||
@@ -204,7 +204,7 @@ noMotd = \u00a7cEs existiert keine Willkommensnachricht.
|
||||
noNewMail = \u00a77Du hast keine Nachrichten.
|
||||
noPendingRequest = Du hast keine Teleportierungsanfragen.
|
||||
noPlacePermission = \u00a7cDu hast keine Rechte, einen Block in der N\u00e4he des Schildes zu platzieren.
|
||||
noPowerTools=You have no power tools assigned.
|
||||
noPowerTools = Du hast keine Powertools zugewiesen.
|
||||
noRules = \u00a7cEs wurden keine Regeln definiert.
|
||||
noWarpsDefined = Keine Warp-Punkte erstellt.
|
||||
none = keine
|
||||
@@ -225,7 +225,7 @@ pTimeOthersPermission = \u00a7cDu hast keine Berechtigung die Zeit von anderen S
|
||||
pTimePlayers = Diese Spieler haben ihre eigene Zeit:
|
||||
pTimeReset = Zeit wurde zur\u00fcgesetzt f\u00fcr: \u00a7e{0}
|
||||
pTimeSet = Zeit wurde f\u00fcr \u00a7e{1}\u00a7f zu \u00a73{0}\u00a7f gesetzt.
|
||||
pTimeSetFixed = Player time is fixed to \u00a73{0}\u00a7f for: \u00a7e{1}
|
||||
pTimeSetFixed = Spielerzeit ist festgesetzt zu \u00a73{0}\u00a7f f\u00fcr: \u00a7e{1}
|
||||
parseError = Fehler beim Parsen von {0} in Zeile {1}
|
||||
pendingTeleportCancelled = \u00a7cLaufende Teleportierung abgebrochen.
|
||||
permissionsError = Permissions/GroupManager fehlt; Chat-Prefixe/-Suffixe sind ausgeschaltet.
|
||||
@@ -244,13 +244,14 @@ possibleWorlds = \u00a77M\u00f6gliche Welten sind nummeriet von 0 bis {0}.
|
||||
powerToolAir = Befehl kann nicht mit Luft verbunden werden.
|
||||
powerToolAlreadySet = Befehl \u00a7c{0}\u00a7f ist bereits zu {1} hinzugef\u00fcgt.
|
||||
powerToolAttach = Befehl \u00a7c{0}\u00a7f erfolgreich zu {1} hinzugef\u00fcgt.
|
||||
powerToolClearAll= Alle Powertoolkommandos wurden entfernt.
|
||||
powerToolList = {1} hat die folgenden Befehle: \u00a7c{0}\u00a7f.
|
||||
powerToolListEmpty = {0} hat keinen Befehl.
|
||||
powerToolNoSuchCommandAssigned = Befehl \u00a7c{0}\u00a7f wurde nicht zu {1} hinzugef\u00fcgt.
|
||||
powerToolRemove = Befehl \u00a7c{0}\u00a7f erfolgreich von {1} entfernt.
|
||||
powerToolRemoveAll = Alle Befehle von {0} entfernt.
|
||||
powerToolsEnabled=All of your power tools have been enabled.
|
||||
powerToolsDisabled=All of your power tools have been disabled.
|
||||
powerToolsEnabled = Alle deine Powertools wurden aktiviert.
|
||||
powerToolsDisabled = Alle deine Powertools wurden deaktiviert.
|
||||
protectionOwner = \u00a76[EssentialsProtect] Besitzer dieses Blocks: {0}
|
||||
questionFormat = \u00a77[Frage]\u00a7f {0}
|
||||
reloadAllPlugins = \u00a77Alle plugins neu geladen.
|
||||
@@ -275,7 +276,7 @@ shoutFormat = \u00a77[Schrei]\u00a7f {0}
|
||||
signFormatFail = \u00a74[{0}]
|
||||
signFormatSuccess = \u00a71[{0}]
|
||||
signFormatTemplate = [{0}]
|
||||
signProtectInvalidLocation = \u00a74You are not allowed to create sign here.
|
||||
signProtectInvalidLocation = \u00a74Du bist nicht befugt ein Schild hierhin zu setzen.
|
||||
similarWarpExist = Ein Warp-Punkt mit einem \u00e4hnlichen Namen existiert bereits.
|
||||
slimeMalformedSize = Ung\u00fcltige Gr\u00f6sse.
|
||||
soloMob = Das Monster m\u00f6chte allein sein.
|
||||
@@ -327,7 +328,7 @@ unknownItemInList = Unbekannter Gegenstand {0} in Liste {1}.
|
||||
unknownItemName = Unbekannter Gegenstand: {0}
|
||||
unlimitedItemPermission = \u00a7cDu hast keine Rechte f\u00fcr {0}.
|
||||
unlimitedItems = Unendliche Objekte:
|
||||
unmutedPlayer = Player {0} ist nicht mehr stumm.
|
||||
unmutedPlayer = Spieler {0} ist nicht mehr stumm.
|
||||
upgradingFilesError = Fehler beim Aktualisieren der Dateien
|
||||
userCreatedPortal = {0} benutzt ein Portal und hat ein Ausgangsportal erstellt.
|
||||
userDoesNotExist = Spieler {0} existiert nicht.
|
||||
@@ -349,10 +350,10 @@ warpSet = \u00a77Warp-Punkt {0} wurde erstellt.
|
||||
warpUsePermission = \u00a7cDu hast keinen Zugriff f\u00fcr diesen Warp-Punkt.
|
||||
warpingTo = \u00a77Teleportiere zu Warp-Punkt {0}.
|
||||
warpsCount = \u00a77Es gibt {0} Warp-Punkte. Zeige Seite {1} von {2}.
|
||||
weatherStorm = \u00a77In deiner Welt st\u00fcrmt es nun.
|
||||
weatherStormFor = \u00a77In deiner Welt st\u00fcrmt es nun f\u00fcr {0} Sekunden.
|
||||
weatherSun = \u00a77In deiner Welt scheint nun die Sonne.
|
||||
weatherSunFor = \u00a77In deiner Welt scheint nun f\u00fcr {0} Sekunden die Sonne.
|
||||
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.
|
||||
whoisGeoLocation = \u00a79 - Herkunft: {0}
|
||||
whoisHealth = \u00a79 - Gesundheit: {0}/20
|
||||
whoisIPAddress = \u00a79 - IP-Adresse: {0}
|
||||
@@ -368,6 +369,4 @@ year = Jahr
|
||||
years = Jahre
|
||||
youAreHealed = \u00a77Du wurdest geheilt.
|
||||
youHaveNewMail = \u00a7cDu hast {0} Nachrichten!\u00a7f Schreibe \u00a77/mail read\u00a7f um deine Nachrichten anzuzeigen.
|
||||
powerToolClearAll= All powertool commands have been cleared.
|
||||
|
||||
|
||||
|
@@ -54,7 +54,7 @@ deleteJail = \u00a77Jail {0} has been removed.
|
||||
deleteWarp = \u00a77Warp {0} has been removed.
|
||||
deniedAccessCommand = {0} was denied access to command.
|
||||
dependancyDownloaded = [Essentials] Dependancy {0} downloaded successfully.
|
||||
dependancyException = [Essentials] An error occured when trying to download a dependacy
|
||||
dependancyException = [Essentials] An error occurred when trying to download a dependacy
|
||||
dependancyNotFound = [Essentials] A required dependancy was not found, downloading now.
|
||||
depth = \u00a77You are at sea level.
|
||||
depthAboveSea = \u00a77You are {0} block(s) above sea level.
|
||||
@@ -170,7 +170,7 @@ missingPrefixSuffix = Missing a prefix or suffix for {0}
|
||||
mobSpawnError = Error while changing mob spawner.
|
||||
mobSpawnLimit = Mob quantity limited to server limit
|
||||
mobSpawnTarget = Target block must be a mob spawner.
|
||||
moneyRecievedFrom = \u00a7a{0} has been recieved from {1}
|
||||
moneyRecievedFrom = \u00a7a{0} has been received from {1}
|
||||
moneySentTo = \u00a7a{0} has been sent to {1}
|
||||
moneyTaken = {0} taken from your bank account.
|
||||
month = month
|
||||
@@ -264,7 +264,7 @@ requestAcceptedFrom = \u00a77{0} accepted your teleport request.
|
||||
requestDenied = \u00a77Teleport request denied.
|
||||
requestDeniedFrom = \u00a77{0} denied your teleport request
|
||||
requestSent = \u00a77Request sent to {0}\u00a77.
|
||||
returnPlayerToJailError = Error occured when trying to return player to jail.
|
||||
returnPlayerToJailError = Error occurred when trying to return player to jail.
|
||||
second = second
|
||||
seconds = seconds
|
||||
seenOffline = Player {0} is offline since {1}
|
||||
@@ -350,10 +350,10 @@ warpSet = \u00a77Warp {0} set.
|
||||
warpUsePermission = \u00a7cYou do not have Permission to use that warp.
|
||||
warpingTo = \u00a77Warping to {0}.
|
||||
warpsCount = \u00a77There are {0} warps. Showing page {1} of {2}.
|
||||
weatherStorm = \u00a77You set the weather to storm in your world
|
||||
weatherStormFor = \u00a77You set the weather to storm in your world for {0} seconds
|
||||
weatherSun = \u00a77You set the weather to sun in your world
|
||||
weatherSunFor = \u00a77You set the weather to sun in your world for {0} seconds
|
||||
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
|
||||
whoisGeoLocation = \u00a79 - Location: {0}
|
||||
whoisHealth = \u00a79 - Health: {0}/20
|
||||
whoisIPAddress = \u00a79 - IP Address: {0}
|
||||
|
@@ -350,10 +350,10 @@ warpSet = \u00a77Le warp {0} a \u00e9t\u00e9 cr\u00e9\u00e9.
|
||||
warpUsePermission = \u00a7cVous n''avez pas la permission d''utiliser ce warp.
|
||||
warpingTo = \u00a77T\u00e9l\u00e9portation au warp {0}.
|
||||
warpsCount = \u00a77There are {0} warps. Showing page {1} of {2}.
|
||||
weatherStorm = \u00a77Vous avez d\u00e9fini l''orage dans votre monde
|
||||
weatherStormFor = \u00a77Vous avez d\u00e9fini l''orage dans votre monde pour {0} secondes.
|
||||
weatherSun = \u00a77Vous avez mis le beau temps dans votre monde
|
||||
weatherSunFor = \u00a77Vous avez mis le beau temps dans votre monde pour {0} secondes.
|
||||
weatherStorm = \u00a77Vous avez d\u00e9fini l''orage dans {0}
|
||||
weatherStormFor = \u00a77Vous avez d\u00e9fini l''orage dans {0} pour {1} secondes.
|
||||
weatherSun = \u00a77Vous avez mis le beau temps dans {0}
|
||||
weatherSunFor = \u00a77Vous avez mis le beau temps dans {0} pour {1} secondes.
|
||||
whoisGeoLocation = \u00a79 - Emplacement: {0}
|
||||
whoisHealth = \u00a79 - Vie: {0} / 20
|
||||
whoisIPAddress = \u00a79 - Adresse IP: {0}
|
||||
|
@@ -350,10 +350,10 @@ warpSet = \u00a77Warp {0} ingesteld.
|
||||
warpUsePermission = \u00a7cOnbevoegd om die warp te gebruiken.
|
||||
warpingTo = \u00a77Aan het warpen naar {0}.
|
||||
warpsCount = \u00a77There are {0} warps. Showing page {1} of {2}.
|
||||
weatherStorm = \u00a77Je hebt het weer naar storm gezet in de wereld
|
||||
weatherStormFor = \u00a77Je hebt het weer in de wereld naar storm gezet voor {0} seconde
|
||||
weatherSun = \u00a77Je hebt het weer naar zon gezet in de wereld
|
||||
weatherSunFor = \u00a77Je hebt het weer in de wereld naar zon gezet voor {0} seconde
|
||||
weatherStorm = \u00a77Je hebt het weer naar storm gezet in de {0}
|
||||
weatherStormFor = \u00a77Je hebt het weer in de {0} naar storm gezet voor {1} seconde
|
||||
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
|
||||
whoisGeoLocation = \u00a79 - Locatie: {0}
|
||||
whoisHealth = \u00a79 - Levens: {0}/20
|
||||
whoisIPAddress = \u00a79 - IP Adres: {0}
|
||||
|
@@ -3,7 +3,7 @@ name: Essentials
|
||||
main: com.earth2me.essentials.Essentials
|
||||
# Note to developers: This next line cannot change, or the automatic versioning system will break.
|
||||
version: TeamCity
|
||||
website: http://www.earth2me.net:8001/
|
||||
website: http://ci.earth2me.net/
|
||||
description: Provides an essential, core set of commands for Bukkit.
|
||||
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits]
|
||||
commands:
|
||||
@@ -293,7 +293,7 @@ commands:
|
||||
togglejail:
|
||||
description: Prevents a player from interacting with the world and teleports him/her to the the jail specified
|
||||
usage: /<command> [player] [jailname] <datediff>
|
||||
aliases: [tjail,etogglejail]
|
||||
aliases: [tjail,unjail,eunjail,etogglejail]
|
||||
top:
|
||||
description: Teleport to the highest block at your current position.
|
||||
usage: /<command>
|
||||
|
@@ -1,45 +0,0 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
|
||||
public class EssentialsTest extends TestCase
|
||||
{
|
||||
public EssentialsTest(String testName)
|
||||
{
|
||||
super(testName);
|
||||
}
|
||||
|
||||
private static void should(String what)
|
||||
{
|
||||
System.out.println("Essentials should " + what);
|
||||
}
|
||||
|
||||
public void testLoadClasses()
|
||||
{
|
||||
should("make all classes accessible");
|
||||
try
|
||||
{
|
||||
ItemDb itemDb = null;
|
||||
Mob mob = null;
|
||||
NetherPortal netherPortal = null;
|
||||
OfflinePlayer offlinePlayer = null;
|
||||
Settings settings = null;
|
||||
Spawn spawn = null;
|
||||
TargetBlock targetBlock = null;
|
||||
User user = null;
|
||||
assertNull(itemDb);
|
||||
assertNull(mob);
|
||||
assertNull(netherPortal);
|
||||
assertNull(offlinePlayer);
|
||||
assertNull(settings);
|
||||
assertNull(spawn);
|
||||
assertNull(targetBlock);
|
||||
assertNull(user);
|
||||
}
|
||||
catch (Throwable ex)
|
||||
{
|
||||
fail(ex.toString());
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,6 +1,7 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import com.avaje.ebean.config.ServerConfig;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -14,7 +15,9 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
@@ -43,41 +46,48 @@ public class FakeServer implements Server
|
||||
return "1.0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Player[] getOnlinePlayers()
|
||||
{
|
||||
return players.toArray(new Player[0]);
|
||||
}
|
||||
|
||||
|
||||
public void setOnlinePlayers(List<Player> players)
|
||||
{
|
||||
this.players = players;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxPlayers()
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPort()
|
||||
{
|
||||
return 25565;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIp()
|
||||
{
|
||||
return "127.0.0.1";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerName()
|
||||
{
|
||||
return "Test Server";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerId()
|
||||
{
|
||||
return "Test Server";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int broadcastMessage(String string)
|
||||
{
|
||||
int i = 0;
|
||||
@@ -89,11 +99,19 @@ public class FakeServer implements Server
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUpdateFolder()
|
||||
{
|
||||
return "update";
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getUpdateFolderFile()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Player getPlayer(String string)
|
||||
{
|
||||
for (Player player : players)
|
||||
@@ -106,6 +124,7 @@ public class FakeServer implements Server
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Player> matchPlayer(String string)
|
||||
{
|
||||
List<Player> matches = new ArrayList<Player>();
|
||||
@@ -119,15 +138,17 @@ public class FakeServer implements Server
|
||||
return matches;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginManager getPluginManager()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BukkitScheduler getScheduler()
|
||||
{
|
||||
return new BukkitScheduler() {
|
||||
|
||||
return new BukkitScheduler()
|
||||
{
|
||||
@Override
|
||||
public int scheduleSyncDelayedTask(Plugin plugin, Runnable r, long l)
|
||||
{
|
||||
@@ -215,16 +236,19 @@ public class FakeServer implements Server
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServicesManager getServicesManager()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<World> getWorlds()
|
||||
{
|
||||
return worlds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World createWorld(String string, Environment e)
|
||||
{
|
||||
World w = new FakeWorld(string, e);
|
||||
@@ -232,6 +256,7 @@ public class FakeServer implements Server
|
||||
return w;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World createWorld(String string, Environment e, long l)
|
||||
{
|
||||
World w = new FakeWorld(string, e);
|
||||
@@ -239,45 +264,54 @@ public class FakeServer implements Server
|
||||
return w;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld(String string)
|
||||
{
|
||||
for (World world : worlds)
|
||||
{
|
||||
if (world.getName().equalsIgnoreCase(string)) {
|
||||
if (world.getName().equalsIgnoreCase(string))
|
||||
{
|
||||
return world;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Logger getLogger()
|
||||
{
|
||||
return Logger.getLogger("Minecraft");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginCommand getPluginCommand(String string)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void savePlayers()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchCommand(CommandSender cs, String string)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureDbConfig(ServerConfig sc)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addRecipe(Recipe recipe)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
@@ -287,7 +321,7 @@ public class FakeServer implements Server
|
||||
{
|
||||
players.add(base1);
|
||||
}
|
||||
|
||||
|
||||
public OfflinePlayer createPlayer(String name, IEssentials ess)
|
||||
{
|
||||
OfflinePlayer player = new OfflinePlayer(name, ess);
|
||||
@@ -295,41 +329,55 @@ public class FakeServer implements Server
|
||||
return player;
|
||||
}
|
||||
|
||||
@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.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean unloadWorld(String string, boolean bln)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean unloadWorld(World world, boolean bln)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String[]> getCommandAliases()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpawnRadius()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpawnRadius(int i)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getOnlineMode()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
@@ -340,6 +388,7 @@ public class FakeServer implements Server
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld(UUID uuid)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
@@ -418,9 +467,70 @@ public class FakeServer implements Server
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.OfflinePlayer getOfflinePlayer(String string)
|
||||
public org.bukkit.OfflinePlayer getOfflinePlayer(final String string)
|
||||
{
|
||||
return null;
|
||||
return new org.bukkit.OfflinePlayer() {
|
||||
|
||||
@Override
|
||||
public boolean isOnline()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return string;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBanned()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBanned(boolean bln)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWhitelisted()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWhitelisted(boolean bln)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Player getPlayer()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOp()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOp(boolean bln)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> serialize()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -454,7 +564,19 @@ public class FakeServer implements Server
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefaultGameMode(GameMode gm)
|
||||
public void setDefaultGameMode(GameMode gamemode)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConsoleCommandSender getConsoleSender()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set getOperators()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
37
Essentials/test/com/earth2me/essentials/StorageTest.java
Normal file
37
Essentials/test/com/earth2me/essentials/StorageTest.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import com.earth2me.essentials.settings.Settings;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Reader;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
public class StorageTest extends TestCase
|
||||
{
|
||||
@Test
|
||||
public void testSettings()
|
||||
{
|
||||
assertTrue(StorageObject.class.isAssignableFrom(Settings.class));
|
||||
final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
|
||||
final Reader reader = new InputStreamReader(bais);
|
||||
final Settings settings = StorageObject.load(Settings.class, reader);
|
||||
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
final PrintWriter writer = new PrintWriter(baos);
|
||||
settings.save(writer);
|
||||
writer.close();
|
||||
byte[] written = baos.toByteArray();
|
||||
System.out.println(new String(written));
|
||||
final ByteArrayInputStream bais2 = new ByteArrayInputStream(written);
|
||||
final Reader reader2 = new InputStreamReader(bais2);
|
||||
final Settings settings2 = StorageObject.load(Settings.class, reader2);
|
||||
System.out.println(settings.toString());
|
||||
System.out.println(settings2.toString());
|
||||
//assertEquals("Default and rewritten config should be equal", settings, settings2);
|
||||
//that assertion fails, because empty list and maps return as null
|
||||
}
|
||||
}
|
@@ -25,7 +25,7 @@ public class EssentialsChat extends JavaPlugin
|
||||
chatListener = new HashMap<String, IEssentialsChatListener>();
|
||||
|
||||
final EssentialsChatPlayerListener playerListener = new EssentialsChatPlayerListener(getServer(), ess, chatListener);
|
||||
pluginManager.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.Highest, this);
|
||||
pluginManager.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.High, this);
|
||||
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion()))
|
||||
{
|
||||
LOGGER.log(Level.WARNING, Util.i18n("versionMismatchAll"));
|
||||
|
@@ -13,4 +13,39 @@ v 1.1:
|
||||
- Push updates to superperms for all valid GM commands.
|
||||
- All GroupManager commands issued by players are now echoed in the console.
|
||||
- Reverted WorldHolder static change to maintain backward plugin compatibility.
|
||||
- Update to handle 'getDescription().getPermissions(') returning a list (CB 1172).
|
||||
- Update to handle 'getDescription().getPermissions(') returning a list (CB 1172).
|
||||
- Fix for null in PLAYER_TELEPORT for bukkit perms.
|
||||
- Fixed wasteful updating of perms on a manload.
|
||||
- manulistp now accepts an additional + to list ALL Superperms effective permissions (/manulistp <name> +).
|
||||
- manucheckp also outputs superperms results.
|
||||
- Removed superperms update on plugins unloading. Unneeded and created undesired lag on shutdown.
|
||||
- Added a BukkitPermsUpdateTask to only update superperms once on a load/reload.
|
||||
- Fix for GM not checking inheritance for known superperms nodes.
|
||||
- Optimized getAllPlayersPermissions and fixed pushing unknown perms to superperms.
|
||||
v 1.2:
|
||||
- Changed priority of Registered events to lowest.
|
||||
- Fixed an issue with superperms where plugins define perms with inheritance after the root perms
|
||||
v 1.3:
|
||||
- Rewrote Config loading to use Bukkits Configuration features
|
||||
- Added an opOverride setting in config.
|
||||
If present and set to false, op's will not get overriding permissions in GroupManager.
|
||||
(one op will not be able to alter another op's settings)
|
||||
- GM will now create all relevant world data files for non mirrored worlds.
|
||||
(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)
|
||||
- Fix for Bukkit passing a null To location on a player Portaling
|
||||
- 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:
|
||||
- Updated for Bukkits new YamlConfiguration.
|
||||
- Cleared remaining Cast errors cause by object cloning.
|
||||
- Removed extra notification messages for the player issuing the group move command.
|
||||
- Added a config setting - bukkit_perms_override: false
|
||||
Enable to allow default Bukkit based permissions to remain enabled, unless directly negated within GroupManager.
|
||||
- Fixed reading world mirrors from the config.
|
||||
- Simplified config.yml while retaining backwards compatibility.
|
||||
- Added data.save.hours setting to config. This allow control over how long backups are retained.
|
@@ -1,15 +1,29 @@
|
||||
settings:
|
||||
config:
|
||||
# With this enabled anyone set as op has full permissions when managing GroupManager
|
||||
opOverrides: true
|
||||
|
||||
# If enabled any bukkit permissiosn which default to true will be left enabled.
|
||||
# If the player is op any permissions set to Op will follow suit.
|
||||
bukkit_perms_override: false
|
||||
|
||||
data:
|
||||
save:
|
||||
# How often GroupManager will save it's data back to groups and users.yml
|
||||
minutes: 10
|
||||
# Number of hours to retain backups (plugins/GroupManager/backup)
|
||||
hours: 24
|
||||
|
||||
logging:
|
||||
# level of detail GroupManager will use when logging.
|
||||
# Acceptable entries are - ALL,CONFIG,FINE,FINER,FINEST,INFO,OFF,SEVERE,WARNING
|
||||
level: INFO
|
||||
permission:
|
||||
world:
|
||||
mirror:
|
||||
|
||||
mirrors:
|
||||
# Worlds listed here have their permissions mirrored in their children.
|
||||
world:
|
||||
- world_nether
|
||||
- world2
|
||||
- world3
|
||||
world4:
|
||||
- world5
|
||||
# world4:
|
||||
# - world5
|
@@ -8,6 +8,7 @@ groups:
|
||||
- essentials.motd
|
||||
- essentials.rules
|
||||
- essentials.spawn
|
||||
- groupmanager.notify.self
|
||||
inheritance: []
|
||||
info:
|
||||
prefix: '&e'
|
||||
@@ -119,6 +120,7 @@ groups:
|
||||
- groupmanager.manuadd
|
||||
- groupmanager.manudel
|
||||
- groupmanager.manwhois
|
||||
- groupmanager.notify.other
|
||||
inheritance:
|
||||
- builder
|
||||
info:
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user