mirror of
https://github.com/essentials/Essentials.git
synced 2025-10-01 08:36:48 +02:00
More work done
This commit is contained in:
@@ -18,17 +18,13 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.api.Economy;
|
import com.earth2me.essentials.api.*;
|
||||||
import com.earth2me.essentials.api.IEssentialsEconomy;
|
|
||||||
import com.earth2me.essentials.api.IGroups;
|
|
||||||
import com.earth2me.essentials.api.IJails;
|
|
||||||
import com.earth2me.essentials.api.IReload;
|
|
||||||
import com.earth2me.essentials.api.IWarps;
|
|
||||||
import com.earth2me.essentials.commands.EssentialsCommand;
|
import com.earth2me.essentials.commands.EssentialsCommand;
|
||||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||||
import com.earth2me.essentials.commands.NoChargeException;
|
import com.earth2me.essentials.commands.NoChargeException;
|
||||||
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
||||||
import com.earth2me.essentials.craftbukkit.ItemDupeFix;
|
import com.earth2me.essentials.craftbukkit.ItemDupeFix;
|
||||||
|
import com.earth2me.essentials.listener.*;
|
||||||
import com.earth2me.essentials.perm.PermissionsHandler;
|
import com.earth2me.essentials.perm.PermissionsHandler;
|
||||||
import com.earth2me.essentials.register.payment.Methods;
|
import com.earth2me.essentials.register.payment.Methods;
|
||||||
import com.earth2me.essentials.signs.SignBlockListener;
|
import com.earth2me.essentials.signs.SignBlockListener;
|
||||||
@@ -40,7 +36,6 @@ import java.io.IOException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.LogRecord;
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
@@ -16,7 +16,7 @@ import org.bukkit.enchantments.Enchantment;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.util.config.Configuration;
|
import org.bukkit.util.config.Configuration;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public class EssentialsConf extends Configuration
|
public class EssentialsConf extends Configuration
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||||
|
@@ -3,13 +3,16 @@ package com.earth2me.essentials;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import com.earth2me.essentials.api.IEssentials;
|
||||||
|
import com.earth2me.essentials.api.IUser;
|
||||||
|
import com.earth2me.essentials.user.UserData.TimestampType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsTimer implements Runnable
|
public class EssentialsTimer implements Runnable
|
||||||
{
|
{
|
||||||
private final transient IEssentials ess;
|
private final transient IEssentials ess;
|
||||||
private final transient Set<User> onlineUsers = new HashSet<User>();
|
private final transient Set<IUser> onlineUsers = new HashSet<IUser>();
|
||||||
|
|
||||||
EssentialsTimer(final IEssentials ess)
|
EssentialsTimer(final IEssentials ess)
|
||||||
{
|
{
|
||||||
@@ -22,19 +25,19 @@ public class EssentialsTimer implements Runnable
|
|||||||
final long currentTime = System.currentTimeMillis();
|
final long currentTime = System.currentTimeMillis();
|
||||||
for (Player player : ess.getServer().getOnlinePlayers())
|
for (Player player : ess.getServer().getOnlinePlayers())
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(player);
|
final IUser user = ess.getUser(player);
|
||||||
onlineUsers.add(user);
|
onlineUsers.add(user);
|
||||||
user.setLastOnlineActivity(currentTime);
|
user.setLastOnlineActivity(currentTime);
|
||||||
user.checkActivity();
|
user.checkActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
final Iterator<User> iterator = onlineUsers.iterator();
|
final Iterator<IUser> iterator = onlineUsers.iterator();
|
||||||
while (iterator.hasNext())
|
while (iterator.hasNext())
|
||||||
{
|
{
|
||||||
final User user = iterator.next();
|
final IUser user = iterator.next();
|
||||||
if (user.getLastOnlineActivity() < currentTime && user.getLastOnlineActivity() > user.getLastLogout())
|
if (user.getLastOnlineActivity() < currentTime && user.getLastOnlineActivity() > user.getTimestamp(TimestampType.LOGOUT))
|
||||||
{
|
{
|
||||||
user.setLastLogout(user.getLastOnlineActivity());
|
user.setTimestamp(TimestampType.LOGOUT, user.getLastOnlineActivity());
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import com.earth2me.essentials.api.IItemDb;
|
import com.earth2me.essentials.api.IItemDb;
|
||||||
|
import com.earth2me.essentials.api.IEssentials;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -24,7 +25,7 @@ public class ItemDb implements IConf, IItemDb
|
|||||||
private final transient ManagedFile file;
|
private final transient ManagedFile file;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reloadConfig()
|
public void onReload()
|
||||||
{
|
{
|
||||||
final List<String> lines = file.getLines();
|
final List<String> lines = file.getLines();
|
||||||
|
|
||||||
@@ -119,4 +120,10 @@ public class ItemDb implements IConf, IItemDb
|
|||||||
retval.setDurability(metaData);
|
retval.setDurability(metaData);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reloadConfig()
|
||||||
|
{
|
||||||
|
onReload();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,12 +1,15 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import com.earth2me.essentials.api.IJails;
|
import com.earth2me.essentials.api.IJails;
|
||||||
|
import com.earth2me.essentials.api.IEssentials;
|
||||||
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.storage.AsyncStorageObjectHolder;
|
import com.earth2me.essentials.storage.AsyncStorageObjectHolder;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.event.Event.Priority;
|
import org.bukkit.event.Event.Priority;
|
||||||
@@ -37,9 +40,9 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
|||||||
pluginManager.registerEvent(Type.BLOCK_DAMAGE, blockListener, Priority.Low, ess);
|
pluginManager.registerEvent(Type.BLOCK_DAMAGE, blockListener, Priority.Low, ess);
|
||||||
pluginManager.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Low, ess);
|
pluginManager.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Low, ess);
|
||||||
pluginManager.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.Low, ess);
|
pluginManager.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.Low, ess);
|
||||||
pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, Priority.High, ess);
|
pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, Priority.Highest, ess);
|
||||||
pluginManager.registerEvent(Type.PLAYER_TELEPORT, playerListener, Priority.High, ess);
|
pluginManager.registerEvent(Type.PLAYER_TELEPORT, playerListener, Priority.Highest, ess);
|
||||||
pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.High, ess);
|
pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Highest, ess);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -113,7 +116,15 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
|||||||
{
|
{
|
||||||
user.getTeleport().now(getJail(jail), false, TeleportCause.COMMAND);
|
user.getTeleport().now(getJail(jail), false, TeleportCause.COMMAND);
|
||||||
}
|
}
|
||||||
user.setJail(jail);
|
user.acquireWriteLock();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
user.getData().setJail(jail);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -145,8 +156,10 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
|||||||
@Override
|
@Override
|
||||||
public void onBlockBreak(final BlockBreakEvent event)
|
public void onBlockBreak(final BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
final User user = ((Essentials)ess).getUser(event.getPlayer());
|
@Cleanup
|
||||||
if (user.isJailed())
|
final IUser user = ess.getUser(event.getPlayer());
|
||||||
|
user.acquireReadLock();
|
||||||
|
if (user.getData().isJailed())
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@@ -155,8 +168,10 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
|||||||
@Override
|
@Override
|
||||||
public void onBlockPlace(final BlockPlaceEvent event)
|
public void onBlockPlace(final BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
final User user = ((Essentials)ess).getUser(event.getPlayer());
|
@Cleanup
|
||||||
if (user.isJailed())
|
final IUser user = ess.getUser(event.getPlayer());
|
||||||
|
user.acquireReadLock();
|
||||||
|
if (user.getData().isJailed())
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@@ -165,8 +180,10 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
|||||||
@Override
|
@Override
|
||||||
public void onBlockDamage(final BlockDamageEvent event)
|
public void onBlockDamage(final BlockDamageEvent event)
|
||||||
{
|
{
|
||||||
final User user = ((Essentials)ess).getUser(event.getPlayer());
|
@Cleanup
|
||||||
if (user.isJailed())
|
final IUser user = ess.getUser(event.getPlayer());
|
||||||
|
user.acquireReadLock();
|
||||||
|
if (user.getData().isJailed())
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@@ -179,8 +196,10 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
|||||||
@Override
|
@Override
|
||||||
public void onPlayerInteract(final PlayerInteractEvent event)
|
public void onPlayerInteract(final PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
final User user = ((Essentials)ess).getUser(event.getPlayer());
|
@Cleanup
|
||||||
if (user.isJailed())
|
final IUser user = ess.getUser(event.getPlayer());
|
||||||
|
user.acquireReadLock();
|
||||||
|
if (user.getData().isJailed())
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@@ -189,15 +208,17 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
|||||||
@Override
|
@Override
|
||||||
public void onPlayerRespawn(final PlayerRespawnEvent event)
|
public void onPlayerRespawn(final PlayerRespawnEvent event)
|
||||||
{
|
{
|
||||||
final User user = ((Essentials)ess).getUser(event.getPlayer());
|
@Cleanup
|
||||||
if (!user.isJailed() || user.getJail() == null || user.getJail().isEmpty())
|
final IUser user = ess.getUser(event.getPlayer());
|
||||||
|
user.acquireReadLock();
|
||||||
|
if (!user.getData().isJailed() || user.getData().getJail() == null || user.getData().getJail().isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
event.setRespawnLocation(getJail(user.getJail()));
|
event.setRespawnLocation(getJail(user.getData().getJail()));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -208,15 +229,17 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
|||||||
@Override
|
@Override
|
||||||
public void onPlayerTeleport(final PlayerTeleportEvent event)
|
public void onPlayerTeleport(final PlayerTeleportEvent event)
|
||||||
{
|
{
|
||||||
final User user = ((Essentials)ess).getUser(event.getPlayer());
|
@Cleanup
|
||||||
if (!user.isJailed() || user.getJail() == null || user.getJail().isEmpty())
|
final IUser user = ess.getUser(event.getPlayer());
|
||||||
|
user.acquireReadLock();
|
||||||
|
if (!user.getData().isJailed() || user.getData().getJail() == null || user.getData().getJail().isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
event.setTo(getJail(user.getJail()));
|
event.setTo(getJail(user.getData().getJail()));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -228,15 +251,17 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
|||||||
@Override
|
@Override
|
||||||
public void onPlayerJoin(final PlayerJoinEvent event)
|
public void onPlayerJoin(final PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
final User user = ((Essentials)ess).getUser(event.getPlayer());
|
@Cleanup
|
||||||
if (!user.isJailed() || user.getJail() == null || user.getJail().isEmpty())
|
final IUser user = ess.getUser(event.getPlayer());
|
||||||
|
user.acquireReadLock();
|
||||||
|
if (!user.getData().isJailed() || user.getData().getJail() == null || user.getData().getJail().isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sendToJail(user, user.getJail());
|
sendToJail(user, user.getData().getJail());
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
|
import com.earth2me.essentials.api.IEssentials;
|
||||||
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.commands.NoChargeException;
|
import com.earth2me.essentials.commands.NoChargeException;
|
||||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -11,7 +13,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
public class Kit
|
public class Kit
|
||||||
{
|
{
|
||||||
//TODO: Convert this to use one of the new text classes?
|
//TODO: Convert this to use one of the new text classes?
|
||||||
public static String listKits(final IEssentials ess, final User user) throws Exception
|
public static String listKits(final IEssentials ess, final IUser user) throws Exception
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -33,7 +35,7 @@ public class Kit
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkTime(final User user, final String kitName, final Map<String, Object> els) throws NoChargeException
|
public static void checkTime(final IUser user, final String kitName, final Map<String, Object> els) throws NoChargeException
|
||||||
{
|
{
|
||||||
final double delay = els.containsKey("delay") ? ((Number)els.get("delay")).doubleValue() : 0L;
|
final double delay = els.containsKey("delay") ? ((Number)els.get("delay")).doubleValue() : 0L;
|
||||||
final Calendar c = new GregorianCalendar();
|
final Calendar c = new GregorianCalendar();
|
||||||
@@ -59,7 +61,7 @@ public class Kit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> getItems(final User user, final Map<String, Object> els) throws Exception
|
public static List<String> getItems(final IUser user, final Map<String, Object> els) throws Exception
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -72,7 +74,7 @@ public class Kit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void expandItems(final IEssentials ess, final User user, final List<String> items) throws Exception
|
public static void expandItems(final IEssentials ess, final IUser user, final List<String> items) throws Exception
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
|
import com.earth2me.essentials.api.IEssentials;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.security.DigestInputStream;
|
import java.security.DigestInputStream;
|
||||||
|
@@ -2,6 +2,8 @@ package com.earth2me.essentials;
|
|||||||
|
|
||||||
import com.earth2me.essentials.api.ITeleport;
|
import com.earth2me.essentials.api.ITeleport;
|
||||||
import com.earth2me.essentials.api.IUser;
|
import com.earth2me.essentials.api.IUser;
|
||||||
|
import com.earth2me.essentials.api.IEssentials;
|
||||||
|
import com.earth2me.essentials.api.ISettings;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
||||||
import com.earth2me.essentials.user.CooldownException;
|
import com.earth2me.essentials.user.CooldownException;
|
||||||
@@ -9,6 +11,7 @@ import com.earth2me.essentials.user.UserData.TimestampType;
|
|||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -115,7 +118,7 @@ public class Teleport implements Runnable, ITeleport
|
|||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
ess.showError(user.getBase(), ex, "teleport");
|
ess.showCommandError(user.getBase(), "teleport", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -142,7 +145,7 @@ public class Teleport implements Runnable, ITeleport
|
|||||||
|
|
||||||
public void warp(String warp, Trade chargeFor, TeleportCause cause) throws Exception
|
public void warp(String warp, Trade chargeFor, TeleportCause cause) throws Exception
|
||||||
{
|
{
|
||||||
Location loc = ess.getWarps().getWarp(warp);
|
final Location loc = ess.getWarps2().getWarp(warp);
|
||||||
teleport(new Target(loc), chargeFor, cause);
|
teleport(new Target(loc), chargeFor, cause);
|
||||||
user.sendMessage(_("warpingTo", warp));
|
user.sendMessage(_("warpingTo", warp));
|
||||||
}
|
}
|
||||||
@@ -202,7 +205,7 @@ public class Teleport implements Runnable, ITeleport
|
|||||||
|
|
||||||
private void teleport(Target target, Trade chargeFor, TeleportCause cause) throws Exception
|
private void teleport(Target target, Trade chargeFor, TeleportCause cause) throws Exception
|
||||||
{
|
{
|
||||||
double delay = ess.getSettings().getTeleportDelay();
|
double delay = ess.getGroups().getTeleportDelay(user);
|
||||||
|
|
||||||
if (chargeFor != null)
|
if (chargeFor != null)
|
||||||
{
|
{
|
||||||
|
@@ -1,12 +1,15 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
|
import com.earth2me.essentials.api.IEssentials;
|
||||||
|
import com.earth2me.essentials.api.ISettings;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.DecimalFormatSymbols;
|
import java.text.DecimalFormatSymbols;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@@ -427,7 +430,10 @@ public class Util
|
|||||||
|
|
||||||
public static String formatCurrency(final double value, final IEssentials ess)
|
public static String formatCurrency(final double value, final IEssentials ess)
|
||||||
{
|
{
|
||||||
String str = ess.getSettings().getCurrencySymbol() + df.format(value);
|
@Cleanup
|
||||||
|
final ISettings settings = ess.getSettings();
|
||||||
|
settings.acquireReadLock();
|
||||||
|
String str = settings.getData().getEconomy().getCurrencySymbol() + df.format(value);
|
||||||
if (str.endsWith(".00"))
|
if (str.endsWith(".00"))
|
||||||
{
|
{
|
||||||
str = str.substring(0, str.length() - 3);
|
str = str.substring(0, str.length() - 3);
|
||||||
|
@@ -2,9 +2,14 @@ package com.earth2me.essentials.api;
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
|
||||||
public interface IAlternativeCommandsHandler
|
public interface IAlternativeCommandsHandler
|
||||||
{
|
{
|
||||||
Map<String, String> disabledCommands();
|
Map<String, String> disabledCommands();
|
||||||
|
|
||||||
|
public void removePlugin(Plugin plugin);
|
||||||
|
|
||||||
|
public void addPlugin(Plugin plugin);
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials.api;
|
package com.earth2me.essentials.api;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.listener.TNTExplodeListener;
|
||||||
import com.earth2me.essentials.perm.IPermissionsHandler;
|
import com.earth2me.essentials.perm.IPermissionsHandler;
|
||||||
import com.earth2me.essentials.register.payment.Methods;
|
import com.earth2me.essentials.register.payment.Methods;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@@ -52,4 +53,10 @@ public interface IEssentials extends Plugin, IReload
|
|||||||
IAlternativeCommandsHandler getAlternativeCommandsHandler();
|
IAlternativeCommandsHandler getAlternativeCommandsHandler();
|
||||||
|
|
||||||
void showCommandError(CommandSender sender, String commandLabel, Throwable exception);
|
void showCommandError(CommandSender sender, String commandLabel, Throwable exception);
|
||||||
|
|
||||||
|
public void reload();
|
||||||
|
|
||||||
|
public IUser getOfflineUser(String string);
|
||||||
|
|
||||||
|
public TNTExplodeListener getTNTListener();
|
||||||
}
|
}
|
||||||
|
@@ -10,6 +10,8 @@ public interface IGroups extends IStorageObjectHolder<Groups>
|
|||||||
|
|
||||||
double getTeleportCooldown(IUser player);
|
double getTeleportCooldown(IUser player);
|
||||||
|
|
||||||
|
double getTeleportDelay(final IUser player);
|
||||||
|
|
||||||
String getPrefix(IUser player);
|
String getPrefix(IUser player);
|
||||||
|
|
||||||
String getSuffix(IUser player);
|
String getSuffix(IUser player);
|
||||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.api;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
public interface IItemDb
|
public interface IItemDb extends IReload
|
||||||
{
|
{
|
||||||
ItemStack get(final String name, final int quantity) throws Exception;
|
ItemStack get(final String name, final int quantity) throws Exception;
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@ public interface IJails extends IReload
|
|||||||
|
|
||||||
void removeJail(String jail) throws Exception;
|
void removeJail(String jail) throws Exception;
|
||||||
|
|
||||||
void sendToJail(com.earth2me.essentials.IUser user, String jail) throws Exception;
|
void sendToJail(IUser user, String jail) throws Exception;
|
||||||
|
|
||||||
void setJail(String jailName, Location loc) throws Exception;
|
void setJail(String jailName, Location loc) throws Exception;
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@ package com.earth2me.essentials.api;
|
|||||||
|
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
|
|
||||||
|
|
||||||
@@ -9,5 +10,19 @@ public interface ITeleport
|
|||||||
{
|
{
|
||||||
void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception;
|
void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception;
|
||||||
|
|
||||||
|
void now(Entity entity, boolean cooldown, TeleportCause cause) throws Exception;
|
||||||
|
|
||||||
void back(Trade chargeFor) throws Exception;
|
void back(Trade chargeFor) throws Exception;
|
||||||
|
|
||||||
|
void teleport(Location bed, Trade charge, TeleportCause teleportCause) throws Exception;
|
||||||
|
|
||||||
|
void teleport(Entity entity, Trade chargeFor, TeleportCause cause) throws Exception;
|
||||||
|
|
||||||
|
void home(IUser player, String toLowerCase, Trade charge) throws Exception;
|
||||||
|
|
||||||
|
void respawn(Trade charge, TeleportCause teleportCause) throws Exception;
|
||||||
|
|
||||||
|
void back() throws Exception;
|
||||||
|
|
||||||
|
public void warp(String name, Trade charge, TeleportCause teleportCause) throws Exception;
|
||||||
}
|
}
|
||||||
|
@@ -4,11 +4,13 @@ import com.earth2me.essentials.commands.IEssentialsCommand;
|
|||||||
import com.earth2me.essentials.storage.IStorageObjectHolder;
|
import com.earth2me.essentials.storage.IStorageObjectHolder;
|
||||||
import com.earth2me.essentials.user.CooldownException;
|
import com.earth2me.essentials.user.CooldownException;
|
||||||
import com.earth2me.essentials.user.UserData;
|
import com.earth2me.essentials.user.UserData;
|
||||||
|
import java.util.List;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
||||||
public interface IUser extends Player, IStorageObjectHolder<UserData>, IReload, IReplyTo
|
public interface IUser extends Player, IStorageObjectHolder<UserData>, IReload, IReplyTo, Comparable<IUser>
|
||||||
{
|
{
|
||||||
boolean isAuthorized(String node);
|
boolean isAuthorized(String node);
|
||||||
|
|
||||||
@@ -22,8 +24,16 @@ public interface IUser extends Player, IStorageObjectHolder<UserData>, IReload,
|
|||||||
|
|
||||||
void takeMoney(double value);
|
void takeMoney(double value);
|
||||||
|
|
||||||
|
void takeMoney(double value, CommandSender initiator);
|
||||||
|
|
||||||
void giveMoney(double value);
|
void giveMoney(double value);
|
||||||
|
|
||||||
|
void giveMoney(double value, CommandSender initiator);
|
||||||
|
|
||||||
|
void setMoney(double value);
|
||||||
|
|
||||||
|
void payUser(final IUser reciever, final double value) throws Exception;
|
||||||
|
|
||||||
String getGroup();
|
String getGroup();
|
||||||
|
|
||||||
void setLastLocation();
|
void setLastLocation();
|
||||||
@@ -44,11 +54,49 @@ public interface IUser extends Player, IStorageObjectHolder<UserData>, IReload,
|
|||||||
|
|
||||||
void updateDisplayName();
|
void updateDisplayName();
|
||||||
|
|
||||||
boolean checkJailTimeout(final long currentTime);
|
boolean checkJailTimeout(long currentTime);
|
||||||
|
|
||||||
boolean checkMuteTimeout(final long currentTime);
|
boolean checkMuteTimeout(long currentTime);
|
||||||
|
|
||||||
boolean checkBanTimeout(final long currentTime);
|
boolean checkBanTimeout(long currentTime);
|
||||||
|
|
||||||
void setTimestamp(final UserData.TimestampType name, final long value);
|
long getTimestamp(UserData.TimestampType name);
|
||||||
|
|
||||||
|
void setTimestamp(UserData.TimestampType name, long value);
|
||||||
|
|
||||||
|
void setLastOnlineActivity(long currentTime);
|
||||||
|
|
||||||
|
void checkActivity();
|
||||||
|
|
||||||
|
long getLastOnlineActivity();
|
||||||
|
|
||||||
|
boolean isGodModeEnabled();
|
||||||
|
|
||||||
|
boolean isIgnoringPlayer(String name);
|
||||||
|
|
||||||
|
void setIgnoredPlayer(String name, boolean set);
|
||||||
|
|
||||||
|
Location getAfkPosition();
|
||||||
|
|
||||||
|
boolean toggleGodModeEnabled();
|
||||||
|
|
||||||
|
void dispose();
|
||||||
|
|
||||||
|
void updateCompass();
|
||||||
|
|
||||||
|
List<String> getHomes();
|
||||||
|
|
||||||
|
void addMail(String string);
|
||||||
|
|
||||||
|
boolean toggleMuted();
|
||||||
|
|
||||||
|
public boolean toggleSocialSpy();
|
||||||
|
|
||||||
|
public void requestTeleport(IUser user, boolean b);
|
||||||
|
|
||||||
|
public boolean isTeleportRequestHere();
|
||||||
|
|
||||||
|
public IUser getTeleportRequester();
|
||||||
|
|
||||||
|
public boolean toggleTeleportEnabled();
|
||||||
}
|
}
|
||||||
|
@@ -8,9 +8,11 @@ public interface IWarps extends IReload
|
|||||||
{
|
{
|
||||||
Location getWarp(String warp) throws Exception;
|
Location getWarp(String warp) throws Exception;
|
||||||
|
|
||||||
Collection<String> getWarps();
|
Collection<String> getList();
|
||||||
|
|
||||||
void removeWarp(String name) throws Exception;
|
void removeWarp(String name) throws Exception;
|
||||||
|
|
||||||
void setWarp(String name, Location loc) throws Exception;
|
void setWarp(String name, Location loc) throws Exception;
|
||||||
|
|
||||||
|
public boolean isEmpty();
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Backup;
|
import com.earth2me.essentials.api.IBackup;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -16,11 +16,7 @@ public class Commandbackup extends EssentialsCommand
|
|||||||
@Override
|
@Override
|
||||||
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
final Backup backup = ess.getBackup();
|
final IBackup backup = ess.getBackup();
|
||||||
if (backup == null)
|
|
||||||
{
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
backup.run();
|
backup.run();
|
||||||
sender.sendMessage(_("backupStarted"));
|
sender.sendMessage(_("backupStarted"));
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ public class Commandbalance extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
final double bal = (args.length < 1
|
final double bal = (args.length < 1
|
||||||
|| !(user.isAuthorized("essentials.balance.others")
|
|| !(user.isAuthorized("essentials.balance.others")
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import com.earth2me.essentials.textreader.ArrayListInput;
|
import com.earth2me.essentials.textreader.ArrayListInput;
|
||||||
@@ -109,7 +109,7 @@ public class Commandbalancetop extends EssentialsCommand
|
|||||||
final Map<String, Double> balances = new HashMap<String, Double>();
|
final Map<String, Double> balances = new HashMap<String, Double>();
|
||||||
for (String u : ess.getUserMap().getAllUniqueUsers())
|
for (String u : ess.getUserMap().getAllUniqueUsers())
|
||||||
{
|
{
|
||||||
final User user = ess.getUserMap().getUser(u);
|
final IUser user = ess.getUserMap().getUser(u);
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
balances.put(u, user.getMoney());
|
balances.put(u, user.getMoney());
|
||||||
|
@@ -3,7 +3,9 @@ package com.earth2me.essentials.commands;
|
|||||||
import com.earth2me.essentials.Console;
|
import com.earth2me.essentials.Console;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.OfflinePlayer;
|
import com.earth2me.essentials.OfflinePlayer;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
|
import com.earth2me.essentials.user.Ban;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -23,7 +25,8 @@ public class Commandban extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
final User user = getPlayer(server, args, 0, true);
|
@Cleanup
|
||||||
|
final IUser user = getPlayer(server, args, 0, true);
|
||||||
if (user.getBase() instanceof OfflinePlayer)
|
if (user.getBase() instanceof OfflinePlayer)
|
||||||
{
|
{
|
||||||
if (sender instanceof Player
|
if (sender instanceof Player
|
||||||
@@ -42,11 +45,13 @@ public class Commandban extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
user.acquireWriteLock();
|
||||||
String banReason;
|
String banReason;
|
||||||
|
user.getData().setBan(new Ban());
|
||||||
if (args.length > 1)
|
if (args.length > 1)
|
||||||
{
|
{
|
||||||
banReason = getFinalArg(args, 1);
|
banReason = getFinalArg(args, 1);
|
||||||
user.setBanReason(banReason);
|
user.getData().getBan().setReason(banReason);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -58,7 +63,7 @@ public class Commandban extends EssentialsCommand
|
|||||||
|
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
final User player = ess.getUser(onlinePlayer);
|
final IUser player = ess.getUser(onlinePlayer);
|
||||||
if (player.isAuthorized("essentials.ban.notify"))
|
if (player.isAuthorized("essentials.ban.notify"))
|
||||||
{
|
{
|
||||||
onlinePlayer.sendMessage(_("playerBanned", senderName, user.getName(), banReason));
|
onlinePlayer.sendMessage(_("playerBanned", senderName, user.getName(), banReason));
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@@ -21,7 +22,9 @@ public class Commandbanip extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
final User player = ess.getUser(args[0]);
|
@Cleanup
|
||||||
|
final IUser player = ess.getUser(args[0]);
|
||||||
|
player.acquireReadLock();
|
||||||
|
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
@@ -30,12 +33,12 @@ public class Commandbanip extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final String ipAddress = player.getLastLoginAddress();
|
final String ipAddress = player.getData().getIpAddress();
|
||||||
if (ipAddress.length() == 0)
|
if (ipAddress.length() == 0)
|
||||||
{
|
{
|
||||||
throw new Exception(_("playerNotFound"));
|
throw new Exception(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
ess.getServer().banIP(player.getLastLoginAddress());
|
ess.getServer().banIP(player.getData().getIpAddress());
|
||||||
sender.sendMessage(_("banIpAddress"));
|
sender.sendMessage(_("banIpAddress"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@@ -16,7 +16,7 @@ public class Commandbigtree extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
TreeType tree;
|
TreeType tree;
|
||||||
if (args.length > 0 && args[0].equalsIgnoreCase("redwood"))
|
if (args.length > 0 && args[0].equalsIgnoreCase("redwood"))
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@@ -16,7 +16,7 @@ public class Commandbreak extends EssentialsCommand
|
|||||||
|
|
||||||
//TODO: Switch to use util class
|
//TODO: Switch to use util class
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
final Block block = user.getTargetBlock(null, 20);
|
final Block block = user.getTargetBlock(null, 20);
|
||||||
if (block == null)
|
if (block == null)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -17,7 +17,7 @@ public class Commandclearinventory extends EssentialsCommand
|
|||||||
|
|
||||||
//TODO: Cleanup
|
//TODO: Cleanup
|
||||||
@Override
|
@Override
|
||||||
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
public void run(Server server, IUser user, String commandLabel, String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length > 0 && user.isAuthorized("essentials.clearinventory.others"))
|
if (args.length > 0 && user.isAuthorized("essentials.clearinventory.others"))
|
||||||
{
|
{
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ public class Commandcompass extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
final int bearing = (int)(user.getLocation().getYaw() + 180 + 360) % 360;
|
final int bearing = (int)(user.getLocation().getYaw() + 180 + 360) % 360;
|
||||||
String dir;
|
String dir;
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@@ -22,7 +23,8 @@ public class Commanddelhome extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
User user = ess.getUser(sender);
|
@Cleanup
|
||||||
|
IUser user = ess.getUser(sender);
|
||||||
String name;
|
String name;
|
||||||
final String[] expandedArg = args[0].split(":");
|
final String[] expandedArg = args[0].split(":");
|
||||||
|
|
||||||
@@ -45,7 +47,8 @@ public class Commanddelhome extends EssentialsCommand
|
|||||||
* throw new Exception("You cannot remove the vanilla home point");
|
* throw new Exception("You cannot remove the vanilla home point");
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
user.delHome(name.toLowerCase(Locale.ENGLISH));
|
user.acquireWriteLock();
|
||||||
|
user.getData().removeHome(name.toLowerCase(Locale.ENGLISH));
|
||||||
sender.sendMessage(_("deleteHome", name));
|
sender.sendMessage(_("deleteHome", name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@ public class Commanddelwarp extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
ess.getWarps().delWarp(args[0]);
|
ess.getWarps2().removeWarp(args[0]);
|
||||||
sender.sendMessage(_("deleteWarp", args[0]));
|
sender.sendMessage(_("deleteWarp", args[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ public class Commanddepth extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
final int depth = user.getLocation().getBlockY() - 63;
|
final int depth = user.getLocation().getBlockY() - 63;
|
||||||
if (depth > 0)
|
if (depth > 0)
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.ISettings;
|
||||||
|
import com.earth2me.essentials.api.IUser;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -37,7 +39,7 @@ public class Commandeco extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
final User player = ess.getUser(onlinePlayer);
|
final IUser player = ess.getUser(onlinePlayer);
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case GIVE:
|
case GIVE:
|
||||||
@@ -49,14 +51,16 @@ public class Commandeco extends EssentialsCommand
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RESET:
|
case RESET:
|
||||||
player.setMoney(amount == 0 ? ess.getSettings().getStartingBalance() : amount);
|
@Cleanup ISettings settings = ess.getSettings();
|
||||||
|
settings.acquireReadLock();
|
||||||
|
player.setMoney(amount == 0 ? settings.getData().getEconomy().getStartingBalance() : amount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final User player = getPlayer(server, args, 1, true);
|
final IUser player = getPlayer(server, args, 1, true);
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case GIVE:
|
case GIVE:
|
||||||
@@ -68,7 +72,9 @@ public class Commandeco extends EssentialsCommand
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RESET:
|
case RESET:
|
||||||
player.setMoney(amount == 0 ? ess.getSettings().getStartingBalance() : amount);
|
@Cleanup ISettings settings = ess.getSettings();
|
||||||
|
settings.acquireReadLock();
|
||||||
|
player.setMoney(amount == 0 ? settings.getData().getEconomy().getStartingBalance() : amount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import com.earth2me.essentials.Enchantments;
|
import com.earth2me.essentials.Enchantments;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@@ -19,7 +19,7 @@ public class Commandenchant extends EssentialsCommand
|
|||||||
|
|
||||||
//TODO: Implement charge costs: final Trade charge = new Trade("enchant-" + enchantmentName, ess);
|
//TODO: Implement charge costs: final Trade charge = new Trade("enchant-" + enchantmentName, ess);
|
||||||
@Override
|
@Override
|
||||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
protected void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
final ItemStack stack = user.getItemInHand();
|
final ItemStack stack = user.getItemInHand();
|
||||||
if (stack == null)
|
if (stack == null)
|
||||||
@@ -78,7 +78,7 @@ public class Commandenchant extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Enchantment getEnchantment(final String name, final User user) throws Exception
|
public static Enchantment getEnchantment(final String name, final IUser user) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
final Enchantment enchantment = Enchantments.getByName(name);
|
final Enchantment enchantment = Enchantments.getByName(name);
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.api.ISettings;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@@ -58,8 +59,11 @@ public class Commandessentials extends EssentialsCommand
|
|||||||
|
|
||||||
private void run_debug(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
private void run_debug(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
ess.getSettings().setDebug(!ess.getSettings().isDebug());
|
@Cleanup
|
||||||
sender.sendMessage("Essentials " + ess.getDescription().getVersion() + " debug mode " + (ess.getSettings().isDebug() ? "enabled" : "disabled"));
|
ISettings settings = ess.getSettings();
|
||||||
|
settings.acquireWriteLock();
|
||||||
|
settings.getData().getGeneral().setDebug(!settings.getData().getGeneral().isDebug());
|
||||||
|
sender.sendMessage("Essentials " + ess.getDescription().getVersion() + " debug mode " + (settings.getData().getGeneral().isDebug() ? "enabled" : "disabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void run_reload(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
private void run_reload(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||||
@@ -149,7 +153,7 @@ public class Commandessentials extends EssentialsCommand
|
|||||||
|
|
||||||
private void stopTune()
|
private void stopTune()
|
||||||
{
|
{
|
||||||
ess.getScheduler().cancelTask(taskid);
|
ess.getServer().getScheduler().cancelTask(taskid);
|
||||||
for (Block block : noteBlocks.values())
|
for (Block block : noteBlocks.values())
|
||||||
{
|
{
|
||||||
if (block.getType() == Material.NOTE_BLOCK)
|
if (block.getType() == Material.NOTE_BLOCK)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -26,7 +26,7 @@ public class Commandext extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -16,11 +16,11 @@ public class Commandfeed extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
protected void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length > 0 && user.isAuthorized("essentials.feed.others"))
|
if (args.length > 0 && user.isAuthorized("essentials.feed.others"))
|
||||||
{
|
{
|
||||||
feedOtherPlayers(server,user,args[0]);
|
feedOtherPlayers(server, user, args[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -30,7 +30,7 @@ public class Commandfeed extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void feedOtherPlayers(final Server server, final CommandSender sender, final String name)
|
private void feedOtherPlayers(final Server server, final CommandSender sender, final String name)
|
||||||
{
|
{
|
||||||
final List<Player> players = server.matchPlayer(name);
|
final List<Player> players = server.matchPlayer(name);
|
||||||
if (players.isEmpty())
|
if (players.isEmpty())
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.entity.Fireball;
|
import org.bukkit.entity.Fireball;
|
||||||
import org.bukkit.entity.SmallFireball;
|
import org.bukkit.entity.SmallFireball;
|
||||||
@@ -15,7 +15,7 @@ public class Commandfireball extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
protected void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
boolean small = false;
|
boolean small = false;
|
||||||
if (args.length > 0 && args[0].equalsIgnoreCase("small"))
|
if (args.length > 0 && args[0].equalsIgnoreCase("small"))
|
||||||
@@ -23,7 +23,7 @@ public class Commandfireball extends EssentialsCommand
|
|||||||
small = true;
|
small = true;
|
||||||
}
|
}
|
||||||
final Vector direction = user.getEyeLocation().getDirection().multiply(2);
|
final Vector direction = user.getEyeLocation().getDirection().multiply(2);
|
||||||
Fireball fireball = user.getWorld().spawn(user.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), small ? SmallFireball.class : Fireball.class);
|
final Fireball fireball = user.getWorld().spawn(user.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), small ? SmallFireball.class : Fireball.class);
|
||||||
fireball.setShooter(user.getBase());
|
fireball.setShooter(user.getBase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@@ -28,7 +28,7 @@ public class Commandgamemode extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
protected void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length > 0 && !args[0].trim().isEmpty() && user.isAuthorized("essentials.gamemode.others"))
|
if (args.length > 0 && !args[0].trim().isEmpty() && user.isAuthorized("essentials.gamemode.others"))
|
||||||
{
|
{
|
||||||
@@ -44,7 +44,7 @@ public class Commandgamemode extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
for (Player matchPlayer : server.matchPlayer(name))
|
for (Player matchPlayer : server.matchPlayer(name))
|
||||||
{
|
{
|
||||||
final User player = ess.getUser(matchPlayer);
|
final IUser player = ess.getUser(matchPlayer);
|
||||||
if (player.isHidden())
|
if (player.isHidden())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -14,11 +14,11 @@ public class Commandgetpos extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length > 0 && user.isAuthorized("essentials.getpos.others"))
|
if (args.length > 0 && user.isAuthorized("essentials.getpos.others"))
|
||||||
{
|
{
|
||||||
final User otherUser = getPlayer(server, args, 0);
|
final IUser otherUser = getPlayer(server, args, 0);
|
||||||
outputPosition(user, otherUser.getLocation(), user.getLocation());
|
outputPosition(user, otherUser.getLocation(), user.getLocation());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -34,7 +34,7 @@ public class Commandgetpos extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
final User user = getPlayer(server, args, 0);
|
final IUser user = getPlayer(server, args, 0);
|
||||||
outputPosition(sender, user.getLocation(), null);
|
outputPosition(sender, user.getLocation(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -26,7 +26,7 @@ public class Commandgod extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
protected void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length > 0 && !args[0].trim().isEmpty() && user.isAuthorized("essentials.god.others"))
|
if (args.length > 0 && !args[0].trim().isEmpty() && user.isAuthorized("essentials.god.others"))
|
||||||
{
|
{
|
||||||
@@ -41,7 +41,7 @@ public class Commandgod extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
for (Player matchPlayer : server.matchPlayer(name))
|
for (Player matchPlayer : server.matchPlayer(name))
|
||||||
{
|
{
|
||||||
final User player = ess.getUser(matchPlayer);
|
final IUser player = ess.getUser(matchPlayer);
|
||||||
if (player.isHidden())
|
if (player.isHidden())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
|
import com.earth2me.essentials.user.UserData.TimestampType;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -16,23 +17,19 @@ public class Commandheal extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
if (args.length > 0 && user.isAuthorized("essentials.heal.others"))
|
if (args.length > 0 && user.isAuthorized("essentials.heal.others"))
|
||||||
{
|
{
|
||||||
if (!user.isAuthorized("essentials.heal.cooldown.bypass"))
|
user.checkCooldown(TimestampType.LASTHEAL, ess.getGroups().getHealCooldown(user), true, "essentials.heal.cooldown.bypass");
|
||||||
{
|
|
||||||
user.healCooldown();
|
|
||||||
}
|
|
||||||
healOtherPlayers(server, user, args[0]);
|
healOtherPlayers(server, user, args[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!user.isAuthorized("essentials.heal.cooldown.bypass"))
|
user.checkCooldown(TimestampType.LASTHEAL, ess.getGroups().getHealCooldown(user), true, "essentials.heal.cooldown.bypass");
|
||||||
{
|
|
||||||
user.healCooldown();
|
|
||||||
}
|
|
||||||
user.setHealth(20);
|
user.setHealth(20);
|
||||||
user.setFoodLevel(20);
|
user.setFoodLevel(20);
|
||||||
user.sendMessage(_("heal"));
|
user.sendMessage(_("heal"));
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import com.earth2me.essentials.textreader.*;
|
import com.earth2me.essentials.textreader.*;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@@ -16,7 +16,7 @@ public class Commandhelp extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
protected void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
IText output;
|
IText output;
|
||||||
String pageStr = args.length > 0 ? args[0] : null;
|
String pageStr = args.length > 0 ? args[0] : null;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -15,7 +15,7 @@ public class Commandhelpop extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
@@ -26,7 +26,7 @@ public class Commandhelpop extends EssentialsCommand
|
|||||||
logger.log(Level.INFO, message);
|
logger.log(Level.INFO, message);
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
final User player = ess.getUser(onlinePlayer);
|
final IUser player = ess.getUser(onlinePlayer);
|
||||||
if (!player.isAuthorized("essentials.helpop.receive"))
|
if (!player.isAuthorized("essentials.helpop.receive"))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@@ -2,10 +2,11 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
@@ -19,11 +20,11 @@ public class Commandhome extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
final Trade charge = new Trade(this.getName(), ess);
|
final Trade charge = new Trade(this.getName(), ess);
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
User player = user;
|
IUser player = user;
|
||||||
String homeName = "";
|
String homeName = "";
|
||||||
String[] nameParts;
|
String[] nameParts;
|
||||||
if (args.length > 0)
|
if (args.length > 0)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@@ -13,13 +13,13 @@ public class Commandignore extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
protected void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
User player;
|
IUser player;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
player = getPlayer(server, args, 0);
|
player = getPlayer(server, args, 0);
|
||||||
@@ -33,7 +33,8 @@ public class Commandignore extends EssentialsCommand
|
|||||||
throw new Exception(_("playerNotFound"));
|
throw new Exception(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
final String name = player.getName();
|
final String name = player.getName();
|
||||||
if (user.isIgnoredPlayer(name))
|
user.acquireWriteLock();
|
||||||
|
if (user.isIgnoringPlayer(name))
|
||||||
{
|
{
|
||||||
user.setIgnoredPlayer(name, false);
|
user.setIgnoredPlayer(name, false);
|
||||||
user.sendMessage(_("unignorePlayer", player.getName()));
|
user.sendMessage(_("unignorePlayer", player.getName()));
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
|
import com.earth2me.essentials.user.Inventory;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@@ -15,29 +16,29 @@ public class Commandinvsee extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
protected void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
if (args.length < 1 && user.getSavedInventory() == null)
|
if (args.length < 1 && user.getData().getInventory() == null)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
User invUser = user;
|
IUser invUser = user;
|
||||||
if (args.length == 1)
|
if (args.length == 1)
|
||||||
{
|
{
|
||||||
invUser = getPlayer(server, args, 0);
|
invUser = getPlayer(server, args, 0);
|
||||||
}
|
}
|
||||||
if (invUser == user && user.getSavedInventory() != null)
|
user.acquireWriteLock();
|
||||||
|
if (invUser == user && user.getData().getInventory() != null)
|
||||||
{
|
{
|
||||||
invUser.getInventory().setContents(user.getSavedInventory());
|
invUser.getInventory().setContents(user.getData().getInventory().getBukkitInventory());
|
||||||
user.setSavedInventory(null);
|
user.getData().setInventory(null);
|
||||||
user.sendMessage(_("invRestored"));
|
user.sendMessage(_("invRestored"));
|
||||||
throw new NoChargeException();
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
|
if (user.getData().getInventory() == null)
|
||||||
if (user.getSavedInventory() == null)
|
|
||||||
{
|
{
|
||||||
user.setSavedInventory(user.getInventory().getContents());
|
user.getData().setInventory(new Inventory(user.getInventory().getContents()));
|
||||||
}
|
}
|
||||||
ItemStack[] invUserStack = invUser.getInventory().getContents();
|
ItemStack[] invUserStack = invUser.getInventory().getContents();
|
||||||
final int userStackLength = user.getInventory().getContents().length;
|
final int userStackLength = user.getInventory().getContents().length;
|
||||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@@ -17,7 +17,7 @@ public class Commandjump extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
Location loc;
|
Location loc;
|
||||||
final Location cloc = user.getLocation();
|
final Location cloc = user.getLocation();
|
||||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import com.earth2me.essentials.Console;
|
import com.earth2me.essentials.Console;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -23,7 +23,7 @@ public class Commandkick extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
final User user = getPlayer(server, args, 0);
|
final IUser user = getPlayer(server, args, 0);
|
||||||
if (user.isAuthorized("essentials.kick.exempt"))
|
if (user.isAuthorized("essentials.kick.exempt"))
|
||||||
{
|
{
|
||||||
throw new Exception(_("kickExempt"));
|
throw new Exception(_("kickExempt"));
|
||||||
@@ -34,7 +34,7 @@ public class Commandkick extends EssentialsCommand
|
|||||||
|
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
User player = ess.getUser(onlinePlayer);
|
final IUser player = ess.getUser(onlinePlayer);
|
||||||
if (player.isAuthorized("essentials.kick.notify"))
|
if (player.isAuthorized("essentials.kick.notify"))
|
||||||
{
|
{
|
||||||
onlinePlayer.sendMessage(_("playerKicked", senderName, user.getName(), kickReason));
|
onlinePlayer.sendMessage(_("playerKicked", senderName, user.getName(), kickReason));
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.*;
|
import com.earth2me.essentials.*;
|
||||||
|
import com.earth2me.essentials.api.IUser;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@@ -14,7 +15,7 @@ public class Commandkit extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.api.ISettings;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.LightningStrike;
|
import org.bukkit.entity.LightningStrike;
|
||||||
@@ -19,7 +21,7 @@ public class Commandlightning extends EssentialsCommand
|
|||||||
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
User user = null;
|
IUser user = null;
|
||||||
if (sender instanceof Player)
|
if (sender instanceof Player)
|
||||||
{
|
{
|
||||||
user = ess.getUser(((Player)sender));
|
user = ess.getUser(((Player)sender));
|
||||||
@@ -63,7 +65,10 @@ public class Commandlightning extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
matchPlayer.setHealth(matchPlayer.getHealth() < 5 ? 0 : matchPlayer.getHealth() - 5);
|
matchPlayer.setHealth(matchPlayer.getHealth() < 5 ? 0 : matchPlayer.getHealth() - 5);
|
||||||
}
|
}
|
||||||
if (ess.getSettings().warnOnSmite())
|
@Cleanup
|
||||||
|
final ISettings settings = ess.getSettings();
|
||||||
|
settings.acquireReadLock();
|
||||||
|
if (settings.getData().getCommands().getLightning().isWarnPlayer())
|
||||||
{
|
{
|
||||||
matchPlayer.sendMessage(_("lightningSmited"));
|
matchPlayer.sendMessage(_("lightningSmited"));
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -43,26 +43,28 @@ public class Commandlist extends EssentialsCommand
|
|||||||
if (showhidden && playerHidden > 0)
|
if (showhidden && playerHidden > 0)
|
||||||
{
|
{
|
||||||
online = _("listAmountHidden", server.getOnlinePlayers().length - playerHidden, playerHidden, server.getMaxPlayers());
|
online = _("listAmountHidden", server.getOnlinePlayers().length - playerHidden, playerHidden, server.getMaxPlayers());
|
||||||
} else {
|
}
|
||||||
online = _("listAmount",server.getOnlinePlayers().length - playerHidden, server.getMaxPlayers());
|
else
|
||||||
|
{
|
||||||
|
online = _("listAmount", server.getOnlinePlayers().length - playerHidden, server.getMaxPlayers());
|
||||||
}
|
}
|
||||||
sender.sendMessage(online);
|
sender.sendMessage(online);
|
||||||
|
|
||||||
if (ess.getSettings().getSortListByGroups())
|
if (ess.getSettings().getSortListByGroups())
|
||||||
{
|
{
|
||||||
Map<String, List<User>> sort = new HashMap<String, List<User>>();
|
Map<String, List<IUser>> sort = new HashMap<String, List<IUser>>();
|
||||||
for (Player OnlinePlayer : server.getOnlinePlayers())
|
for (Player OnlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
final User player = ess.getUser(OnlinePlayer);
|
final IUser player = ess.getUser(OnlinePlayer);
|
||||||
if (player.isHidden() && !showhidden)
|
if (player.isHidden() && !showhidden)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final String group = player.getGroup();
|
final String group = player.getGroup();
|
||||||
List<User> list = sort.get(group);
|
List<IUser> list = sort.get(group);
|
||||||
if (list == null)
|
if (list == null)
|
||||||
{
|
{
|
||||||
list = new ArrayList<User>();
|
list = new ArrayList<IUser>();
|
||||||
sort.put(group, list);
|
sort.put(group, list);
|
||||||
}
|
}
|
||||||
list.add(player);
|
list.add(player);
|
||||||
@@ -73,10 +75,10 @@ public class Commandlist extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
final StringBuilder groupString = new StringBuilder();
|
final StringBuilder groupString = new StringBuilder();
|
||||||
groupString.append(group).append(": ");
|
groupString.append(group).append(": ");
|
||||||
final List<User> users = sort.get(group);
|
final List<IUser> users = sort.get(group);
|
||||||
Collections.sort(users);
|
Collections.sort(users);
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (User user : users)
|
for (IUser user : users)
|
||||||
{
|
{
|
||||||
if (!first)
|
if (!first)
|
||||||
{
|
{
|
||||||
@@ -86,9 +88,17 @@ public class Commandlist extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
if (user.isAfk())
|
user.acquireReadLock();
|
||||||
|
try
|
||||||
{
|
{
|
||||||
groupString.append(_("listAfkTag"));
|
if (user.getData().isAfk())
|
||||||
|
{
|
||||||
|
groupString.append(_("listAfkTag"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
user.unlock();
|
||||||
}
|
}
|
||||||
if (user.isHidden())
|
if (user.isHidden())
|
||||||
{
|
{
|
||||||
@@ -102,10 +112,10 @@ public class Commandlist extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final List<User> users = new ArrayList<User>();
|
final List<IUser> users = new ArrayList<IUser>();
|
||||||
for (Player OnlinePlayer : server.getOnlinePlayers())
|
for (Player OnlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
final User player = ess.getUser(OnlinePlayer);
|
final IUser player = ess.getUser(OnlinePlayer);
|
||||||
if (player.isHidden() && !showhidden)
|
if (player.isHidden() && !showhidden)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -117,7 +127,7 @@ public class Commandlist extends EssentialsCommand
|
|||||||
final StringBuilder onlineUsers = new StringBuilder();
|
final StringBuilder onlineUsers = new StringBuilder();
|
||||||
onlineUsers.append(_("connectedPlayers"));
|
onlineUsers.append(_("connectedPlayers"));
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (User user : users)
|
for (IUser user : users)
|
||||||
{
|
{
|
||||||
if (!first)
|
if (!first)
|
||||||
{
|
{
|
||||||
@@ -127,9 +137,17 @@ public class Commandlist extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
if (user.isAfk())
|
user.acquireReadLock();
|
||||||
|
try
|
||||||
{
|
{
|
||||||
onlineUsers.append(_("listAfkTag"));
|
if (user.getData().isAfk())
|
||||||
|
{
|
||||||
|
onlineUsers.append(_("listAfkTag"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
user.unlock();
|
||||||
}
|
}
|
||||||
if (user.isHidden())
|
if (user.isHidden())
|
||||||
{
|
{
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -18,12 +17,12 @@ public class Commandmail extends EssentialsCommand
|
|||||||
|
|
||||||
//TODO: Tidy this up
|
//TODO: Tidy this up
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length >= 1 && "read".equalsIgnoreCase(args[0]))
|
if (args.length >= 1 && "read".equalsIgnoreCase(args[0]))
|
||||||
{
|
{
|
||||||
final List<String> mail = user.getMails();
|
final List<String> mail = user.getData().getMails();
|
||||||
if (mail.isEmpty())
|
if (mail == null || mail.isEmpty())
|
||||||
{
|
{
|
||||||
user.sendMessage(_("noMail"));
|
user.sendMessage(_("noMail"));
|
||||||
throw new NoChargeException();
|
throw new NoChargeException();
|
||||||
@@ -43,7 +42,7 @@ public class Commandmail extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player player = server.getPlayer(args[1]);
|
Player player = server.getPlayer(args[1]);
|
||||||
User u;
|
IUser u;
|
||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
u = ess.getUser(player);
|
u = ess.getUser(player);
|
||||||
@@ -56,7 +55,7 @@ public class Commandmail extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
throw new Exception(_("playerNeverOnServer", args[1]));
|
throw new Exception(_("playerNeverOnServer", args[1]));
|
||||||
}
|
}
|
||||||
if (!u.isIgnoredPlayer(user.getName()))
|
if (!u.isIgnoringPlayer(user.getName()))
|
||||||
{
|
{
|
||||||
u.addMail(user.getName() + ": " + getFinalArg(args, 2));
|
u.addMail(user.getName() + ": " + getFinalArg(args, 2));
|
||||||
}
|
}
|
||||||
@@ -75,7 +74,8 @@ public class Commandmail extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (args.length >= 1 && "clear".equalsIgnoreCase(args[0]))
|
if (args.length >= 1 && "clear".equalsIgnoreCase(args[0]))
|
||||||
{
|
{
|
||||||
user.setMails(null);
|
user.acquireWriteLock();
|
||||||
|
user.getData().setMails(null);
|
||||||
user.sendMessage(_("mailCleared"));
|
user.sendMessage(_("mailCleared"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@ public class Commandmail extends EssentialsCommand
|
|||||||
else if (args.length >= 3 && "send".equalsIgnoreCase(args[0]))
|
else if (args.length >= 3 && "send".equalsIgnoreCase(args[0]))
|
||||||
{
|
{
|
||||||
Player player = server.getPlayer(args[1]);
|
Player player = server.getPlayer(args[1]);
|
||||||
User u;
|
IUser u;
|
||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
u = ess.getUser(player);
|
u = ess.getUser(player);
|
||||||
@@ -121,7 +121,7 @@ public class Commandmail extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
//allow sending from console without "send" argument, since it's the only thing the console can do
|
//allow sending from console without "send" argument, since it's the only thing the console can do
|
||||||
Player player = server.getPlayer(args[0]);
|
Player player = server.getPlayer(args[0]);
|
||||||
User u;
|
IUser u;
|
||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
u = ess.getUser(player);
|
u = ess.getUser(player);
|
||||||
@@ -156,7 +156,7 @@ public class Commandmail extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
for (String username : ess.getUserMap().getAllUniqueUsers())
|
for (String username : ess.getUserMap().getAllUniqueUsers())
|
||||||
{
|
{
|
||||||
User user = ess.getUserMap().getUser(username);
|
IUser user = ess.getUserMap().getUser(username);
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
user.addMail(message);
|
user.addMail(message);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@@ -13,9 +13,9 @@ public class Commandme extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (user.isMuted())
|
if (user.getData().isMuted())
|
||||||
{
|
{
|
||||||
throw new Exception(_("voiceSilenced"));
|
throw new Exception(_("voiceSilenced"));
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@@ -15,7 +15,7 @@ public class Commandmore extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
final ItemStack stack = user.getItemInHand();
|
final ItemStack stack = user.getItemInHand();
|
||||||
if (stack == null)
|
if (stack == null)
|
||||||
|
@@ -2,9 +2,10 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import com.earth2me.essentials.Console;
|
import com.earth2me.essentials.Console;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.IReplyTo;
|
import com.earth2me.essentials.api.IReplyTo;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -18,7 +19,7 @@ public class Commandmsg extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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, String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 2 || args[0].trim().isEmpty() || args[1].trim().isEmpty())
|
if (args.length < 2 || args[0].trim().isEmpty() || args[1].trim().isEmpty())
|
||||||
{
|
{
|
||||||
@@ -27,8 +28,10 @@ public class Commandmsg extends EssentialsCommand
|
|||||||
|
|
||||||
if (sender instanceof Player)
|
if (sender instanceof Player)
|
||||||
{
|
{
|
||||||
User user = ess.getUser(sender);
|
@Cleanup
|
||||||
if (user.isMuted())
|
IUser user = ess.getUser(sender);
|
||||||
|
user.acquireReadLock();
|
||||||
|
if (user.getData().isMuted())
|
||||||
{
|
{
|
||||||
throw new Exception(_("voiceSilenced"));
|
throw new Exception(_("voiceSilenced"));
|
||||||
}
|
}
|
||||||
@@ -60,7 +63,7 @@ public class Commandmsg extends EssentialsCommand
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
for (Player p : matches)
|
for (Player p : matches)
|
||||||
{
|
{
|
||||||
final User u = ess.getUser(p);
|
final IUser u = ess.getUser(p);
|
||||||
if (u.isHidden())
|
if (u.isHidden())
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
@@ -74,8 +77,8 @@ public class Commandmsg extends EssentialsCommand
|
|||||||
for (Player p : matches)
|
for (Player p : matches)
|
||||||
{
|
{
|
||||||
sender.sendMessage(_("msgFormat", translatedMe, p.getDisplayName(), message));
|
sender.sendMessage(_("msgFormat", translatedMe, p.getDisplayName(), message));
|
||||||
final User u = ess.getUser(p);
|
final IUser u = ess.getUser(p);
|
||||||
if (sender instanceof Player && (u.isIgnoredPlayer(((Player)sender).getName()) || u.isHidden()))
|
if (sender instanceof Player && (u.isIgnoringPlayer(((Player)sender).getName()) || u.isHidden()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
|
import com.earth2me.essentials.user.UserData.TimestampType;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@@ -22,8 +24,10 @@ public class Commandmute extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
final User player = getPlayer(server, args, 0, true);
|
@Cleanup
|
||||||
if (!player.isMuted() && player.isAuthorized("essentials.mute.exempt"))
|
final IUser player = getPlayer(server, args, 0, true);
|
||||||
|
player.acquireReadLock();
|
||||||
|
if (!player.getData().isMuted() && player.isAuthorized("essentials.mute.exempt"))
|
||||||
{
|
{
|
||||||
throw new Exception(_("muteExempt"));
|
throw new Exception(_("muteExempt"));
|
||||||
}
|
}
|
||||||
@@ -33,7 +37,7 @@ public class Commandmute extends EssentialsCommand
|
|||||||
String time = getFinalArg(args, 1);
|
String time = getFinalArg(args, 1);
|
||||||
muteTimestamp = Util.parseDateDiff(time, true);
|
muteTimestamp = Util.parseDateDiff(time, true);
|
||||||
}
|
}
|
||||||
player.setMuteTimeout(muteTimestamp);
|
player.setTimestamp(TimestampType.MUTE, muteTimestamp);
|
||||||
final boolean muted = player.toggleMuted();
|
final boolean muted = player.toggleMuted();
|
||||||
sender.sendMessage(
|
sender.sendMessage(
|
||||||
muted
|
muted
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@@ -17,10 +17,10 @@ public class Commandnear extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
protected void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
long radius = 200;
|
long radius = 200;
|
||||||
User otherUser = null;
|
IUser otherUser = null;
|
||||||
|
|
||||||
if (args.length > 0)
|
if (args.length > 0)
|
||||||
{
|
{
|
||||||
@@ -63,7 +63,7 @@ public class Commandnear extends EssentialsCommand
|
|||||||
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
User otherUser = null;
|
IUser otherUser = null;
|
||||||
if (args.length > 0)
|
if (args.length > 0)
|
||||||
{
|
{
|
||||||
otherUser = getPlayer(server, args, 0);
|
otherUser = getPlayer(server, args, 0);
|
||||||
@@ -86,7 +86,7 @@ public class Commandnear extends EssentialsCommand
|
|||||||
sender.sendMessage(_("nearbyPlayers", getLocal(server, otherUser, radius)));
|
sender.sendMessage(_("nearbyPlayers", getLocal(server, otherUser, radius)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getLocal(final Server server, final User user, final long radius)
|
private String getLocal(final Server server, final IUser user, final long radius)
|
||||||
{
|
{
|
||||||
final Location loc = user.getLocation();
|
final Location loc = user.getLocation();
|
||||||
final World world = loc.getWorld();
|
final World world = loc.getWorld();
|
||||||
@@ -95,7 +95,7 @@ public class Commandnear extends EssentialsCommand
|
|||||||
|
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
final User player = ess.getUser(onlinePlayer);
|
final IUser player = ess.getUser(onlinePlayer);
|
||||||
if (!player.equals(user) && !player.isHidden())
|
if (!player.equals(user) && !player.isHidden())
|
||||||
{
|
{
|
||||||
final Location playerLoc = player.getLocation();
|
final Location playerLoc = player.getLocation();
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.api.ISettings;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -16,13 +18,16 @@ public class Commandnick extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
if (!ess.getSettings().changeDisplayName())
|
@Cleanup
|
||||||
|
final ISettings settings = ess.getSettings();
|
||||||
|
settings.acquireReadLock();
|
||||||
|
if (!settings.getData().getChat().getChangeDisplayname())
|
||||||
{
|
{
|
||||||
throw new Exception(_("nickDisplayName"));
|
throw new Exception(_("nickDisplayName"));
|
||||||
}
|
}
|
||||||
@@ -46,7 +51,10 @@ public class Commandnick extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
if (!ess.getSettings().changeDisplayName())
|
@Cleanup
|
||||||
|
final ISettings settings = ess.getSettings();
|
||||||
|
settings.acquireReadLock();
|
||||||
|
if (!settings.getData().getChat().getChangeDisplayname())
|
||||||
{
|
{
|
||||||
throw new Exception(_("nickDisplayName"));
|
throw new Exception(_("nickDisplayName"));
|
||||||
}
|
}
|
||||||
@@ -61,7 +69,7 @@ public class Commandnick extends EssentialsCommand
|
|||||||
sender.sendMessage(_("nickChanged"));
|
sender.sendMessage(_("nickChanged"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String formatNickname(final User user, final String nick)
|
private String formatNickname(final IUser user, final String nick)
|
||||||
{
|
{
|
||||||
if (user == null || user.isAuthorized("essentials.nick.color"))
|
if (user == null || user.isAuthorized("essentials.nick.color"))
|
||||||
{
|
{
|
||||||
@@ -84,7 +92,7 @@ public class Commandnick extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNickname(final Server server, final User target, final String nick) throws Exception
|
private void setNickname(final Server server, final IUser target, final String nick) throws Exception
|
||||||
{
|
{
|
||||||
if (nick.matches("[^a-zA-Z_0-9]"))
|
if (nick.matches("[^a-zA-Z_0-9]"))
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ public class Commandpay extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 2)
|
if (args.length < 2)
|
||||||
{
|
{
|
||||||
@@ -27,7 +27,7 @@ public class Commandpay extends EssentialsCommand
|
|||||||
Boolean foundUser = false;
|
Boolean foundUser = false;
|
||||||
for (Player p : server.matchPlayer(args[0]))
|
for (Player p : server.matchPlayer(args[0]))
|
||||||
{
|
{
|
||||||
User u = ess.getUser(p);
|
IUser u = ess.getUser(p);
|
||||||
if (u.isHidden())
|
if (u.isHidden())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ public class Commandping extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(Server server, User player, String commandLabel, String[] args) throws Exception
|
public void run(final Server server, final IUser player, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
player.sendMessage(_("pong"));
|
player.sendMessage(_("pong"));
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -19,7 +19,7 @@ public class Commandpowertool extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
protected void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
String command = getFinalArg(args, 0);
|
String command = getFinalArg(args, 0);
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ public class Commandpowertooltoggle extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
protected void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (!user.hasPowerTools())
|
if (!user.hasPowerTools())
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import com.earth2me.essentials.DescParseTickFormat;
|
import com.earth2me.essentials.DescParseTickFormat;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@@ -36,7 +36,7 @@ public class Commandptime extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
userSelector = args[1];
|
userSelector = args[1];
|
||||||
}
|
}
|
||||||
Set<User> users = getUsers(server, sender, userSelector);
|
Set<IUser> users = getUsers(server, sender, userSelector);
|
||||||
|
|
||||||
// If no arguments we are reading the time
|
// If no arguments we are reading the time
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
@@ -45,7 +45,7 @@ public class Commandptime extends EssentialsCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
User user = ess.getUser(sender);
|
IUser user = ess.getUser(sender);
|
||||||
if ((!users.contains(user) || users.size() > 1) && user != null && !user.isAuthorized("essentials.ptime.others"))
|
if ((!users.contains(user) || users.size() > 1) && user != null && !user.isAuthorized("essentials.ptime.others"))
|
||||||
{
|
{
|
||||||
user.sendMessage(_("pTimeOthersPermission"));
|
user.sendMessage(_("pTimeOthersPermission"));
|
||||||
@@ -89,14 +89,14 @@ public class Commandptime extends EssentialsCommand
|
|||||||
/**
|
/**
|
||||||
* Used to get the time and inform
|
* Used to get the time and inform
|
||||||
*/
|
*/
|
||||||
private void getUsersTime(final CommandSender sender, final Collection<User> users)
|
private void getUsersTime(final CommandSender sender, final Collection<IUser> users)
|
||||||
{
|
{
|
||||||
if (users.size() > 1)
|
if (users.size() > 1)
|
||||||
{
|
{
|
||||||
sender.sendMessage(_("pTimePlayers"));
|
sender.sendMessage(_("pTimePlayers"));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (User user : users)
|
for (IUser user : users)
|
||||||
{
|
{
|
||||||
if (user.getPlayerTimeOffset() == 0)
|
if (user.getPlayerTimeOffset() == 0)
|
||||||
{
|
{
|
||||||
@@ -120,13 +120,13 @@ public class Commandptime extends EssentialsCommand
|
|||||||
/**
|
/**
|
||||||
* Used to set the time and inform of the change
|
* Used to set the time and inform of the change
|
||||||
*/
|
*/
|
||||||
private void setUsersTime(final CommandSender sender, final Collection<User> users, final Long ticks, Boolean relative)
|
private void setUsersTime(final CommandSender sender, final Collection<IUser> users, final Long ticks, Boolean relative)
|
||||||
{
|
{
|
||||||
// Update the time
|
// Update the time
|
||||||
if (ticks == null)
|
if (ticks == null)
|
||||||
{
|
{
|
||||||
// Reset
|
// Reset
|
||||||
for (User user : users)
|
for (IUser user : users)
|
||||||
{
|
{
|
||||||
user.resetPlayerTime();
|
user.resetPlayerTime();
|
||||||
}
|
}
|
||||||
@@ -134,7 +134,7 @@ public class Commandptime extends EssentialsCommand
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Set
|
// Set
|
||||||
for (User user : users)
|
for (IUser user : users)
|
||||||
{
|
{
|
||||||
final World world = user.getWorld();
|
final World world = user.getWorld();
|
||||||
long time = user.getPlayerTime();
|
long time = user.getPlayerTime();
|
||||||
@@ -149,7 +149,7 @@ public class Commandptime extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder msg = new StringBuilder();
|
final StringBuilder msg = new StringBuilder();
|
||||||
for (User user : users)
|
for (IUser user : users)
|
||||||
{
|
{
|
||||||
if (msg.length() > 0)
|
if (msg.length() > 0)
|
||||||
{
|
{
|
||||||
@@ -181,13 +181,13 @@ public class Commandptime extends EssentialsCommand
|
|||||||
/**
|
/**
|
||||||
* Used to parse an argument of the type "users(s) selector"
|
* Used to parse an argument of the type "users(s) selector"
|
||||||
*/
|
*/
|
||||||
private Set<User> getUsers(final Server server, final CommandSender sender, final String selector) throws Exception
|
private Set<IUser> getUsers(final Server server, final CommandSender sender, final String selector) throws Exception
|
||||||
{
|
{
|
||||||
final Set<User> users = new TreeSet<User>(new UserNameComparator());
|
final Set<IUser> users = new TreeSet<IUser>();
|
||||||
// If there is no selector we want the sender itself. Or all users if sender isn't a user.
|
// If there is no selector we want the sender itself. Or all users if sender isn't a user.
|
||||||
if (selector == null)
|
if (selector == null)
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(sender);
|
final IUser user = ess.getUser(sender);
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
for (Player player : server.getOnlinePlayers())
|
for (Player player : server.getOnlinePlayers())
|
||||||
@@ -203,7 +203,7 @@ public class Commandptime extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to find the user with name = selector
|
// Try to find the user with name = selector
|
||||||
User user = null;
|
IUser user = null;
|
||||||
final List<Player> matchedPlayers = server.matchPlayer(selector);
|
final List<Player> matchedPlayers = server.matchPlayer(selector);
|
||||||
if (!matchedPlayers.isEmpty())
|
if (!matchedPlayers.isEmpty())
|
||||||
{
|
{
|
||||||
@@ -231,13 +231,3 @@ public class Commandptime extends EssentialsCommand
|
|||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class UserNameComparator implements Comparator<User>
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public int compare(User a, User b)
|
|
||||||
{
|
|
||||||
return a.getName().compareTo(b.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -2,8 +2,8 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import com.earth2me.essentials.Console;
|
import com.earth2me.essentials.Console;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.IReplyTo;
|
import com.earth2me.essentials.api.IReplyTo;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -38,8 +38,8 @@ public class Commandr extends EssentialsCommand
|
|||||||
sender.sendMessage(_("msgFormat", _("me"), targetName, message));
|
sender.sendMessage(_("msgFormat", _("me"), targetName, message));
|
||||||
if (target instanceof Player)
|
if (target instanceof Player)
|
||||||
{
|
{
|
||||||
User player = ess.getUser(target);
|
IUser player = ess.getUser(target);
|
||||||
if (player.isIgnoredPlayer(sender instanceof Player ? ((Player)sender).getName() : Console.NAME))
|
if (player.isIgnoringPlayer(sender instanceof Player ? ((Player)sender).getName() : Console.NAME))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@@ -26,7 +26,7 @@ public class Commandrealname extends EssentialsCommand
|
|||||||
final String whois = args[0].toLowerCase(Locale.ENGLISH);
|
final String whois = args[0].toLowerCase(Locale.ENGLISH);
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
final User u = ess.getUser(onlinePlayer);
|
final IUser u = ess.getUser(onlinePlayer);
|
||||||
if (u.isHidden())
|
if (u.isHidden())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@@ -29,7 +29,7 @@ public class Commandremove extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
protected void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
|
@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.*;
|
import com.earth2me.essentials.*;
|
||||||
|
import com.earth2me.essentials.api.IUser;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@@ -18,7 +19,7 @@ public class Commandrepair extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
|
import com.earth2me.essentials.user.UserData.TimestampType;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@@ -23,17 +24,17 @@ public class Commandseen extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
User u = getPlayer(server, args, 0);
|
IUser u = getPlayer(server, args, 0);
|
||||||
sender.sendMessage(_("seenOnline", u.getDisplayName(), Util.formatDateDiff(u.getLastLogin())));
|
sender.sendMessage(_("seenOnline", u.getDisplayName(), Util.formatDateDiff(u.getTimestamp(TimestampType.LOGIN))));
|
||||||
}
|
}
|
||||||
catch (NoSuchFieldException e)
|
catch (NoSuchFieldException e)
|
||||||
{
|
{
|
||||||
User u = ess.getOfflineUser(args[0]);
|
IUser u = ess.getOfflineUser(args[0]);
|
||||||
if (u == null)
|
if (u == null)
|
||||||
{
|
{
|
||||||
throw new Exception(_("playerNotFound"));
|
throw new Exception(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
sender.sendMessage(_("seenOffline", u.getDisplayName(), Util.formatDateDiff(u.getLastLogout())));
|
sender.sendMessage(_("seenOffline", u.getDisplayName(), Util.formatDateDiff(u.getTimestamp(TimestampType.LOGOUT))));
|
||||||
if (u.isBanned())
|
if (u.isBanned())
|
||||||
{
|
{
|
||||||
sender.sendMessage(_("whoisBanned", _("true")));
|
sender.sendMessage(_("whoisBanned", _("true")));
|
||||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.commands;
|
|||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@@ -20,7 +20,7 @@ public class Commandsell extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
@@ -74,7 +74,7 @@ public class Commandsell extends EssentialsCommand
|
|||||||
sellItem(user, is, args, false);
|
sellItem(user, is, args, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sellItem(User user, ItemStack is, String[] args, boolean isBulkSell) throws Exception
|
private void sellItem(IUser user, ItemStack is, String[] args, boolean isBulkSell) throws Exception
|
||||||
{
|
{
|
||||||
if (is == null || is.getType() == Material.AIR)
|
if (is == null || is.getType() == Material.AIR)
|
||||||
{
|
{
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ public class Commandsethome extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length > 0)
|
if (args.length > 0)
|
||||||
{
|
{
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ public class Commandsetjail extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ public class Commandsetwarp extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
@@ -22,7 +22,7 @@ public class Commandsetwarp extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Location loc = user.getLocation();
|
final Location loc = user.getLocation();
|
||||||
ess.getWarps().setWarp(args[0], loc);
|
ess.getWarps2().setWarp(args[0], loc);
|
||||||
user.sendMessage(_("warpSet", args[0]));
|
user.sendMessage(_("warpSet", args[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ public class Commandsetworth extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 2)
|
if (args.length < 2)
|
||||||
{
|
{
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ public class Commandsocialspy extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
user.sendMessage("§7SocialSpy " + (user.toggleSocialSpy() ? _("enabled") : _("disabled")));
|
user.sendMessage("§7SocialSpy " + (user.toggleSocialSpy() ? _("enabled") : _("disabled")));
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Mob;
|
import com.earth2me.essentials.Mob;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -19,7 +19,7 @@ public class Commandspawner extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
protected void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1 || args[0].length() < 2)
|
if (args.length < 1 || args[0].length() < 2)
|
||||||
{
|
{
|
||||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.commands;
|
|||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Mob;
|
import com.earth2me.essentials.Mob;
|
||||||
import com.earth2me.essentials.Mob.MobException;
|
import com.earth2me.essentials.Mob.MobException;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@@ -22,7 +22,7 @@ public class Commandspawnmob extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
@@ -76,7 +76,7 @@ public class Commandspawnmob extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
throw new Exception(_("unableToSpawnMob"));
|
throw new Exception(_("unableToSpawnMob"));
|
||||||
}
|
}
|
||||||
User otherUser = null;
|
IUser otherUser = null;
|
||||||
if (args.length >= 3)
|
if (args.length >= 3)
|
||||||
{
|
{
|
||||||
otherUser = getPlayer(ess.getServer(), args, 2);
|
otherUser = getPlayer(ess.getServer(), args, 2);
|
||||||
@@ -184,7 +184,7 @@ public class Commandspawnmob extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeMobData(final CreatureType type, final Entity spawned, final String data, final User user) throws Exception
|
private void changeMobData(final CreatureType type, final Entity spawned, final String data, final IUser user) throws Exception
|
||||||
{
|
{
|
||||||
if (type == CreatureType.SLIME || type == CreatureType.MAGMA_CUBE)
|
if (type == CreatureType.SLIME || type == CreatureType.MAGMA_CUBE)
|
||||||
{
|
{
|
||||||
@@ -238,7 +238,7 @@ public class Commandspawnmob extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
final Wolf wolf = ((Wolf)spawned);
|
final Wolf wolf = ((Wolf)spawned);
|
||||||
wolf.setTamed(true);
|
wolf.setTamed(true);
|
||||||
wolf.setOwner(user);
|
wolf.setOwner(user.getBase());
|
||||||
wolf.setSitting(true);
|
wolf.setSitting(true);
|
||||||
if (data.equalsIgnoreCase("tamedbaby"))
|
if (data.equalsIgnoreCase("tamedbaby"))
|
||||||
{
|
{
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
@@ -21,7 +21,7 @@ public class Commandsudo extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
final User user = getPlayer(server, args, 0, false);
|
final IUser user = getPlayer(server, args, 0, false);
|
||||||
final String command = args[1];
|
final String command = args[1];
|
||||||
final String[] arguments = new String[args.length - 2];
|
final String[] arguments = new String[args.length - 2];
|
||||||
if (arguments.length > 0)
|
if (arguments.length > 0)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ public class Commandsuicide extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
user.setHealth(0);
|
user.setHealth(0);
|
||||||
user.sendMessage(_("suicideMessage"));
|
user.sendMessage(_("suicideMessage"));
|
||||||
|
@@ -3,8 +3,9 @@ package com.earth2me.essentials.commands;
|
|||||||
import com.earth2me.essentials.Console;
|
import com.earth2me.essentials.Console;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.OfflinePlayer;
|
import com.earth2me.essentials.OfflinePlayer;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
|
import com.earth2me.essentials.user.Ban;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -24,7 +25,7 @@ public class Commandtempban extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
final User user = getPlayer(server, args, 0, true);
|
final IUser user = getPlayer(server, args, 0, true);
|
||||||
if (user.getBase() instanceof OfflinePlayer)
|
if (user.getBase() instanceof OfflinePlayer)
|
||||||
{
|
{
|
||||||
if (sender instanceof Player
|
if (sender instanceof Player
|
||||||
@@ -46,15 +47,17 @@ public class Commandtempban extends EssentialsCommand
|
|||||||
final long banTimestamp = Util.parseDateDiff(time, true);
|
final long banTimestamp = Util.parseDateDiff(time, true);
|
||||||
|
|
||||||
final String banReason = _("tempBanned", Util.formatDateDiff(banTimestamp));
|
final String banReason = _("tempBanned", Util.formatDateDiff(banTimestamp));
|
||||||
user.setBanReason(banReason);
|
user.acquireWriteLock();
|
||||||
user.setBanTimeout(banTimestamp);
|
user.getData().setBan(new Ban());
|
||||||
|
user.getData().getBan().setReason(banReason);
|
||||||
|
user.getData().getBan().setTimeout(banTimestamp);
|
||||||
user.setBanned(true);
|
user.setBanned(true);
|
||||||
user.kickPlayer(banReason);
|
user.kickPlayer(banReason);
|
||||||
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
|
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
|
||||||
|
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
final User player = ess.getUser(onlinePlayer);
|
final IUser player = ess.getUser(onlinePlayer);
|
||||||
if (player.isAuthorized("essentials.ban.notify"))
|
if (player.isAuthorized("essentials.ban.notify"))
|
||||||
{
|
{
|
||||||
onlinePlayer.sendMessage(_("playerBanned", senderName, user.getName(), banReason));
|
onlinePlayer.sendMessage(_("playerBanned", senderName, user.getName(), banReason));
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ public class Commandthunder extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import com.earth2me.essentials.DescParseTickFormat;
|
import com.earth2me.essentials.DescParseTickFormat;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@@ -34,7 +34,7 @@ public class Commandtime extends EssentialsCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final User user = ess.getUser(sender);
|
final IUser user = ess.getUser(sender);
|
||||||
if (user != null && !user.isAuthorized("essentials.time.set"))
|
if (user != null && !user.isAuthorized("essentials.time.set"))
|
||||||
{
|
{
|
||||||
user.sendMessage(_("timeSetPermission"));
|
user.sendMessage(_("timeSetPermission"));
|
||||||
@@ -110,7 +110,7 @@ public class Commandtime extends EssentialsCommand
|
|||||||
// If there is no selector we want the world the user is currently in. Or all worlds if it isn't a user.
|
// If there is no selector we want the world the user is currently in. Or all worlds if it isn't a user.
|
||||||
if (selector == null)
|
if (selector == null)
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(sender);
|
final IUser user = ess.getUser(sender);
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
worlds.addAll(server.getWorlds());
|
worlds.addAll(server.getWorlds());
|
||||||
|
@@ -2,8 +2,10 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.OfflinePlayer;
|
import com.earth2me.essentials.OfflinePlayer;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
|
import com.earth2me.essentials.user.UserData.TimestampType;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -24,9 +26,11 @@ public class Commandtogglejail extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
final User player = getPlayer(server, args, 0, true);
|
@Cleanup
|
||||||
|
final IUser player = getPlayer(server, args, 0, true);
|
||||||
|
player.acquireReadLock();
|
||||||
|
|
||||||
if (args.length >= 2 && !player.isJailed())
|
if (args.length >= 2 && !player.getData().isJailed())
|
||||||
{
|
{
|
||||||
if (player.getBase() instanceof OfflinePlayer)
|
if (player.getBase() instanceof OfflinePlayer)
|
||||||
{
|
{
|
||||||
@@ -54,16 +58,16 @@ public class Commandtogglejail extends EssentialsCommand
|
|||||||
// Check if jail exists
|
// Check if jail exists
|
||||||
ess.getJails().getJail(args[1]);
|
ess.getJails().getJail(args[1]);
|
||||||
}
|
}
|
||||||
player.setJailed(true);
|
player.acquireWriteLock();
|
||||||
|
player.getData().setJailed(true);
|
||||||
player.sendMessage(_("userJailed"));
|
player.sendMessage(_("userJailed"));
|
||||||
player.setJail(null);
|
player.getData().setJail(args[1]);
|
||||||
player.setJail(args[1]);
|
|
||||||
long timeDiff = 0;
|
long timeDiff = 0;
|
||||||
if (args.length > 2)
|
if (args.length > 2)
|
||||||
{
|
{
|
||||||
final String time = getFinalArg(args, 2);
|
final String time = getFinalArg(args, 2);
|
||||||
timeDiff = Util.parseDateDiff(time, true);
|
timeDiff = Util.parseDateDiff(time, true);
|
||||||
player.setJailTimeout(timeDiff);
|
player.setTimestamp(TimestampType.JAIL, timeDiff);
|
||||||
}
|
}
|
||||||
sender.sendMessage((timeDiff > 0
|
sender.sendMessage((timeDiff > 0
|
||||||
? _("playerJailedFor", player.getName(), Util.formatDateDiff(timeDiff))
|
? _("playerJailedFor", player.getName(), Util.formatDateDiff(timeDiff))
|
||||||
@@ -71,31 +75,33 @@ public class Commandtogglejail extends EssentialsCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length >= 2 && player.isJailed() && !args[1].equalsIgnoreCase(player.getJail()))
|
if (args.length >= 2 && player.getData().isJailed() && !args[1].equalsIgnoreCase(player.getData().getJail()))
|
||||||
{
|
{
|
||||||
sender.sendMessage(_("jailAlreadyIncarcerated", player.getJail()));
|
sender.sendMessage(_("jailAlreadyIncarcerated", player.getData().getJail()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length >= 2 && player.isJailed() && args[1].equalsIgnoreCase(player.getJail()))
|
if (args.length >= 2 && player.getData().isJailed() && args[1].equalsIgnoreCase(player.getData().getJail()))
|
||||||
{
|
{
|
||||||
final String time = getFinalArg(args, 2);
|
final String time = getFinalArg(args, 2);
|
||||||
final long timeDiff = Util.parseDateDiff(time, true);
|
final long timeDiff = Util.parseDateDiff(time, true);
|
||||||
player.setJailTimeout(timeDiff);
|
player.acquireWriteLock();
|
||||||
|
player.setTimestamp(TimestampType.JAIL, timeDiff);
|
||||||
sender.sendMessage(_("jailSentenceExtended", Util.formatDateDiff(timeDiff)));
|
sender.sendMessage(_("jailSentenceExtended", Util.formatDateDiff(timeDiff)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length == 1 || (args.length == 2 && args[1].equalsIgnoreCase(player.getJail())))
|
if (args.length == 1 || (args.length == 2 && args[1].equalsIgnoreCase(player.getData().getJail())))
|
||||||
{
|
{
|
||||||
if (!player.isJailed())
|
if (!player.getData().isJailed())
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
player.setJailed(false);
|
player.acquireWriteLock();
|
||||||
player.setJailTimeout(0);
|
player.getData().setJailed(false);
|
||||||
|
player.setTimestamp(TimestampType.JAIL, 0);
|
||||||
player.sendMessage(_("jailReleasedPlayerNotify"));
|
player.sendMessage(_("jailReleasedPlayerNotify"));
|
||||||
player.setJail(null);
|
player.getData().setJail(null);
|
||||||
if (!(player.getBase() instanceof OfflinePlayer))
|
if (!(player.getBase() instanceof OfflinePlayer))
|
||||||
{
|
{
|
||||||
player.getTeleport().back();
|
player.getTeleport().back();
|
||||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
@@ -16,7 +16,7 @@ public class Commandtop extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
final int topX = user.getLocation().getBlockX();
|
final int topX = user.getLocation().getBlockX();
|
||||||
final int topZ = user.getLocation().getBlockZ();
|
final int topZ = user.getLocation().getBlockZ();
|
||||||
|
@@ -3,7 +3,8 @@ package com.earth2me.essentials.commands;
|
|||||||
import com.earth2me.essentials.Console;
|
import com.earth2me.essentials.Console;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
@@ -17,7 +18,7 @@ public class Commandtp extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
switch (args.length)
|
switch (args.length)
|
||||||
{
|
{
|
||||||
@@ -25,8 +26,10 @@ public class Commandtp extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
final User player = getPlayer(server, args, 0);
|
@Cleanup
|
||||||
if (!player.isTeleportEnabled())
|
final IUser player = getPlayer(server, args, 0);
|
||||||
|
player.acquireReadLock();
|
||||||
|
if (!player.getData().isTeleportEnabled())
|
||||||
{
|
{
|
||||||
throw new Exception(_("teleportDisabled", player.getDisplayName()));
|
throw new Exception(_("teleportDisabled", player.getDisplayName()));
|
||||||
}
|
}
|
||||||
@@ -43,8 +46,8 @@ public class Commandtp extends EssentialsCommand
|
|||||||
throw new Exception("You need access to /tpohere to teleport other players.");
|
throw new Exception("You need access to /tpohere to teleport other players.");
|
||||||
}
|
}
|
||||||
user.sendMessage(_("teleporting"));
|
user.sendMessage(_("teleporting"));
|
||||||
final User target = getPlayer(server, args, 0);
|
final IUser target = getPlayer(server, args, 0);
|
||||||
final User toPlayer = getPlayer(server, args, 1);
|
final IUser toPlayer = getPlayer(server, args, 1);
|
||||||
target.getTeleport().now(toPlayer, false, TeleportCause.COMMAND);
|
target.getTeleport().now(toPlayer, false, TeleportCause.COMMAND);
|
||||||
target.sendMessage(_("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName()));
|
target.sendMessage(_("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName()));
|
||||||
break;
|
break;
|
||||||
@@ -60,8 +63,8 @@ public class Commandtp extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(_("teleporting"));
|
sender.sendMessage(_("teleporting"));
|
||||||
final User target = getPlayer(server, args, 0);
|
final IUser target = getPlayer(server, args, 0);
|
||||||
final User toPlayer = getPlayer(server, args, 1);
|
final IUser toPlayer = getPlayer(server, args, 1);
|
||||||
target.getTeleport().now(toPlayer, false, TeleportCause.COMMAND);
|
target.getTeleport().now(toPlayer, false, TeleportCause.COMMAND);
|
||||||
target.sendMessage(_("teleportAtoB", Console.NAME, toPlayer.getDisplayName()));
|
target.sendMessage(_("teleportAtoB", Console.NAME, toPlayer.getDisplayName()));
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@@ -13,19 +14,21 @@ public class Commandtpa extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
public void run(Server server, IUser user, String commandLabel, String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
User player = getPlayer(server, args, 0);
|
@Cleanup
|
||||||
if (!player.isTeleportEnabled())
|
IUser player = getPlayer(server, args, 0);
|
||||||
|
player.acquireReadLock();
|
||||||
|
if (!player.getData().isTeleportEnabled())
|
||||||
{
|
{
|
||||||
throw new Exception(_("teleportDisabled", player.getDisplayName()));
|
throw new Exception(_("teleportDisabled", player.getDisplayName()));
|
||||||
}
|
}
|
||||||
if (!player.isIgnoredPlayer(user.getName()))
|
if (!player.isIgnoringPlayer(user.getName()))
|
||||||
{
|
{
|
||||||
player.requestTeleport(user, false);
|
player.requestTeleport(user, false);
|
||||||
player.sendMessage(_("teleportRequest", user.getDisplayName()));
|
player.sendMessage(_("teleportRequest", user.getDisplayName()));
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -27,21 +28,23 @@ public class Commandtpaall extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
final User player = getPlayer(server, args, 0);
|
final IUser player = getPlayer(server, args, 0);
|
||||||
teleportAAllPlayers(server, sender, player);
|
teleportAAllPlayers(server, sender, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void teleportAAllPlayers(final Server server, final CommandSender sender, final User user)
|
private void teleportAAllPlayers(final Server server, final CommandSender sender, final IUser user)
|
||||||
{
|
{
|
||||||
sender.sendMessage(_("teleportAAll"));
|
sender.sendMessage(_("teleportAAll"));
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
final User player = ess.getUser(onlinePlayer);
|
@Cleanup
|
||||||
|
final IUser player = ess.getUser(onlinePlayer);
|
||||||
|
player.acquireReadLock();
|
||||||
if (user == player)
|
if (user == player)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!player.isTeleportEnabled())
|
if (!player.getData().isTeleportEnabled())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -57,7 +60,7 @@ public class Commandtpaall extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
ess.showError(sender, ex, getName());
|
ess.showCommandError(sender, getName(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,8 @@ package com.earth2me.essentials.commands;
|
|||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.OfflinePlayer;
|
import com.earth2me.essentials.OfflinePlayer;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
|
|
||||||
@@ -16,12 +17,15 @@ public class Commandtpaccept extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
|
if (user.getTeleportRequester() == null)
|
||||||
|
{
|
||||||
|
throw new Exception(_("noPendingRequest"));
|
||||||
|
}
|
||||||
|
|
||||||
final User target = user.getTeleportRequest();
|
final IUser target = user.getTeleportRequester();
|
||||||
if (target == null
|
if (target.getBase() instanceof OfflinePlayer
|
||||||
|| target.getBase() instanceof OfflinePlayer
|
|
||||||
|| (user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpahere")))
|
|| (user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpahere")))
|
||||||
{
|
{
|
||||||
throw new Exception(_("noPendingRequest"));
|
throw new Exception(_("noPendingRequest"));
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@@ -13,15 +14,17 @@ public class Commandtpahere extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
final User player = getPlayer(server, args, 0);
|
@Cleanup
|
||||||
if (!player.isTeleportEnabled())
|
final IUser player = getPlayer(server, args, 0);
|
||||||
|
player.acquireReadLock();
|
||||||
|
if (!player.getData().isTeleportEnabled())
|
||||||
{
|
{
|
||||||
throw new Exception(_("teleportDisabled", player.getDisplayName()));
|
throw new Exception(_("teleportDisabled", player.getDisplayName()));
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -28,16 +28,16 @@ public class Commandtpall extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
final User player = getPlayer(server, args, 0);
|
final IUser player = getPlayer(server, args, 0);
|
||||||
teleportAllPlayers(server, sender, player);
|
teleportAllPlayers(server, sender, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void teleportAllPlayers(Server server, CommandSender sender, User user)
|
private void teleportAllPlayers(Server server, CommandSender sender, IUser user)
|
||||||
{
|
{
|
||||||
sender.sendMessage(_("teleportAll"));
|
sender.sendMessage(_("teleportAll"));
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
final User player = ess.getUser(onlinePlayer);
|
final IUser player = ess.getUser(onlinePlayer);
|
||||||
if (user == player)
|
if (user == player)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -48,7 +48,7 @@ public class Commandtpall extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
ess.showError(sender, ex, getName());
|
ess.showCommandError(sender, getName(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@@ -13,9 +13,9 @@ public class Commandtpdeny extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
final User player = user.getTeleportRequest();
|
final IUser player = user.getTeleportRequester();
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
throw new Exception(_("noPendingRequest"));
|
throw new Exception(_("noPendingRequest"));
|
||||||
|
@@ -2,7 +2,8 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
|
|
||||||
@@ -15,10 +16,12 @@ public class Commandtphere extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
final User player = getPlayer(server, args, 0);
|
@Cleanup
|
||||||
if (!player.isTeleportEnabled())
|
final IUser player = getPlayer(server, args, 0);
|
||||||
|
player.acquireReadLock();
|
||||||
|
if (!player.getData().isTeleportEnabled())
|
||||||
{
|
{
|
||||||
throw new Exception(_("teleportDisabled", player.getDisplayName()));
|
throw new Exception(_("teleportDisabled", player.getDisplayName()));
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.OfflinePlayer;
|
import com.earth2me.essentials.OfflinePlayer;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ public class Commandtpo extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
@@ -23,7 +23,7 @@ public class Commandtpo extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Just basically the old tp command
|
//Just basically the old tp command
|
||||||
final User player = getPlayer(server, args, 0, true);
|
final IUser player = getPlayer(server, args, 0, true);
|
||||||
// Check if user is offline
|
// Check if user is offline
|
||||||
if (player.getBase() instanceof OfflinePlayer)
|
if (player.getBase() instanceof OfflinePlayer)
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.OfflinePlayer;
|
import com.earth2me.essentials.OfflinePlayer;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ public class Commandtpohere extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
@@ -23,7 +23,7 @@ public class Commandtpohere extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Just basically the old tphere command
|
//Just basically the old tphere command
|
||||||
final User player = getPlayer(server, args, 0, true);
|
final IUser player = getPlayer(server, args, 0, true);
|
||||||
|
|
||||||
// Check if user is offline
|
// Check if user is offline
|
||||||
if (player.getBase() instanceof OfflinePlayer)
|
if (player.getBase() instanceof OfflinePlayer)
|
||||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
@@ -16,7 +16,7 @@ public class Commandtppos extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 3)
|
if (args.length < 3)
|
||||||
{
|
{
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ public class Commandtptoggle extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
user.sendMessage(user.toggleTeleportEnabled()
|
user.sendMessage(user.toggleTeleportEnabled()
|
||||||
? _("teleportationEnabled")
|
? _("teleportationEnabled")
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@@ -16,7 +16,7 @@ public class Commandtree extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
TreeType tree;
|
TreeType tree;
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@@ -23,7 +24,10 @@ public class Commandunban extends EssentialsCommand
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final User player = getPlayer(server, args, 0, true);
|
@Cleanup
|
||||||
|
final IUser player = getPlayer(server, args, 0, true);
|
||||||
|
player.acquireWriteLock();
|
||||||
|
player.getData().setBan(null);
|
||||||
player.setBanned(false);
|
player.setBanned(false);
|
||||||
sender.sendMessage(_("unbannedPlayer"));
|
sender.sendMessage(_("unbannedPlayer"));
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@@ -22,8 +23,10 @@ public class Commandunbanip extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final User user = getPlayer(server, args, 0, true);
|
@Cleanup
|
||||||
ess.getServer().unbanIP(user.getLastLoginAddress());
|
final IUser user = getPlayer(server, args, 0, true);
|
||||||
|
user.acquireReadLock();
|
||||||
|
ess.getServer().unbanIP(user.getData().getIpAddress());
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@@ -2,9 +2,10 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@@ -18,18 +19,20 @@ public class Commandunlimited extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
User target = user;
|
@Cleanup
|
||||||
|
IUser target = user;
|
||||||
|
|
||||||
if (args.length > 1 && user.isAuthorized("essentials.unlimited.others"))
|
if (args.length > 1 && user.isAuthorized("essentials.unlimited.others"))
|
||||||
{
|
{
|
||||||
target = getPlayer(server, args, 1);
|
target = getPlayer(server, args, 1);
|
||||||
|
target.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("list"))
|
if (args[0].equalsIgnoreCase("list"))
|
||||||
@@ -39,7 +42,8 @@ public class Commandunlimited extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
else if (args[0].equalsIgnoreCase("clear"))
|
else if (args[0].equalsIgnoreCase("clear"))
|
||||||
{
|
{
|
||||||
final List<Integer> itemList = target.getUnlimited();
|
//TODO: Fix this, the clear should always work, even when the player does not have permission.
|
||||||
|
final List<Integer> itemList = target.getData().getUnlimited();
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
while (itemList.size() > index)
|
while (itemList.size() > index)
|
||||||
@@ -57,7 +61,7 @@ public class Commandunlimited extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getList(final User target)
|
private String getList(final IUser target)
|
||||||
{
|
{
|
||||||
final StringBuilder output = new StringBuilder();
|
final StringBuilder output = new StringBuilder();
|
||||||
output.append(_("unlimitedItems")).append(" ");
|
output.append(_("unlimitedItems")).append(" ");
|
||||||
@@ -81,7 +85,7 @@ public class Commandunlimited extends EssentialsCommand
|
|||||||
return output.toString();
|
return output.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Boolean toggleUnlimited(final User user, final User target, final String item) throws Exception
|
private Boolean toggleUnlimited(final IUser user, final IUser target, final String item) throws Exception
|
||||||
{
|
{
|
||||||
final ItemStack stack = ess.getItemDb().get(item, 1);
|
final ItemStack stack = ess.getItemDb().get(item, 1);
|
||||||
stack.setAmount(Math.min(stack.getType().getMaxStackSize(), 2));
|
stack.setAmount(Math.min(stack.getType().getMaxStackSize(), 2));
|
||||||
|
@@ -2,9 +2,9 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import com.earth2me.essentials.Warps;
|
import com.earth2me.essentials.api.IWarps;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -23,7 +23,7 @@ public class Commandwarp extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length == 0 || args[0].matches("[0-9]+"))
|
if (args.length == 0 || args[0].matches("[0-9]+"))
|
||||||
{
|
{
|
||||||
@@ -36,7 +36,7 @@ public class Commandwarp extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (args.length > 0)
|
if (args.length > 0)
|
||||||
{
|
{
|
||||||
User otherUser = null;
|
IUser otherUser = null;
|
||||||
if (args.length == 2 && user.isAuthorized("essentials.warp.otherplayers"))
|
if (args.length == 2 && user.isAuthorized("essentials.warp.otherplayers"))
|
||||||
{
|
{
|
||||||
otherUser = ess.getUser(server.getPlayer(args[1]));
|
otherUser = ess.getUser(server.getPlayer(args[1]));
|
||||||
@@ -60,7 +60,7 @@ public class Commandwarp extends EssentialsCommand
|
|||||||
warpList(sender, args);
|
warpList(sender, args);
|
||||||
throw new NoChargeException();
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
User otherUser = ess.getUser(server.getPlayer(args[1]));
|
IUser otherUser = ess.getUser(server.getPlayer(args[1]));
|
||||||
if (otherUser == null)
|
if (otherUser == null)
|
||||||
{
|
{
|
||||||
throw new Exception(_("playerNotFound"));
|
throw new Exception(_("playerNotFound"));
|
||||||
@@ -73,14 +73,14 @@ public class Commandwarp extends EssentialsCommand
|
|||||||
//TODO: Use one of the new text classes, like /help ?
|
//TODO: Use one of the new text classes, like /help ?
|
||||||
private void warpList(final CommandSender sender, final String[] args) throws Exception
|
private void warpList(final CommandSender sender, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
final Warps warps = ess.getWarps();
|
final IWarps warps = ess.getWarps2();
|
||||||
if (warps.isEmpty())
|
if (warps.isEmpty())
|
||||||
{
|
{
|
||||||
throw new Exception(_("noWarpsDefined"));
|
throw new Exception(_("noWarpsDefined"));
|
||||||
}
|
}
|
||||||
final List<String> warpNameList = new ArrayList<String>(warps.getWarpNames());
|
final List<String> warpNameList = new ArrayList<String>(warps.getList());
|
||||||
|
|
||||||
if (sender instanceof User)
|
if (sender instanceof IUser)
|
||||||
{
|
{
|
||||||
final Iterator<String> iterator = warpNameList.iterator();
|
final Iterator<String> iterator = warpNameList.iterator();
|
||||||
while (iterator.hasNext())
|
while (iterator.hasNext())
|
||||||
@@ -112,7 +112,7 @@ public class Commandwarp extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void warpUser(final User user, final String name) throws Exception
|
private void warpUser(final IUser user, final String name) throws Exception
|
||||||
{
|
{
|
||||||
final Trade charge = new Trade(this.getName(), ess);
|
final Trade charge = new Trade(this.getName(), ess);
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -16,7 +16,7 @@ public class Commandweather extends EssentialsCommand
|
|||||||
|
|
||||||
//TODO: Remove duplication
|
//TODO: Remove duplication
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user