mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-05 07:57:59 +01:00
More cleanup
This commit is contained in:
parent
3d29248ace
commit
1abacf00df
@ -222,10 +222,10 @@ public class EssentialsPlayerListener implements Listener
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final IText input = new TextInput(user, "motd", true, ess);
|
final IText input = new TextInput(user.getBase(), "motd", true, ess);
|
||||||
final IText output = new KeywordReplacer(input, user, ess);
|
final IText output = new KeywordReplacer(input, user.getBase(), ess);
|
||||||
final TextPager pager = new TextPager(output, true);
|
final TextPager pager = new TextPager(output, true);
|
||||||
pager.showPage("1", null, "motd", user);
|
pager.showPage("1", null, "motd", user.getBase());
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
||||||
public interface IUser extends CommandSender
|
public interface IUser
|
||||||
{
|
{
|
||||||
long getLastTeleportTimestamp();
|
long getLastTeleportTimestamp();
|
||||||
|
|
||||||
@ -86,4 +86,8 @@ public interface IUser extends CommandSender
|
|||||||
Map<String, Object> getConfigMap();
|
Map<String, Object> getConfigMap();
|
||||||
|
|
||||||
Map<String, Object> getConfigMap(String node);
|
Map<String, Object> getConfigMap(String node);
|
||||||
|
|
||||||
|
public void sendMessage(String message);
|
||||||
|
|
||||||
|
public String getName();
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ public class Kit
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
IText input = new SimpleTextInput(items);
|
IText input = new SimpleTextInput(items);
|
||||||
IText output = new KeywordReplacer(input, user, ess);
|
IText output = new KeywordReplacer(input, user.getBase(), ess);
|
||||||
|
|
||||||
boolean spew = false;
|
boolean spew = false;
|
||||||
final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments();
|
final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments();
|
||||||
|
@ -88,7 +88,7 @@ public class SpawnMob
|
|||||||
{
|
{
|
||||||
throw new Exception(_("unableToSpawnMob"));
|
throw new Exception(_("unableToSpawnMob"));
|
||||||
}
|
}
|
||||||
spawnmob(ess, server, user, user, block.getLocation(), parts, data, mobCount);
|
spawnmob(ess, server, user.getBase(), user, block.getLocation(), parts, data, mobCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method spawns a mob at loc, owned by noone
|
// This method spawns a mob at loc, owned by noone
|
||||||
|
@ -25,7 +25,7 @@ public class Commandclearinventory extends EssentialsCommand
|
|||||||
@Override
|
@Override
|
||||||
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
||||||
{
|
{
|
||||||
parseCommand(server, user, args, user.isAuthorized("essentials.clearinventory.others"), user.isAuthorized("essentials.clearinventory.all"));
|
parseCommand(server, user.getBase(), args, user.isAuthorized("essentials.clearinventory.others"), user.isAuthorized("essentials.clearinventory.all"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -39,9 +39,9 @@ public class Commandclearinventory extends EssentialsCommand
|
|||||||
List<Player> players = new ArrayList<Player>();
|
List<Player> players = new ArrayList<Player>();
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
if (sender instanceof User)
|
if (sender instanceof Player)
|
||||||
{
|
{
|
||||||
players.add(((User)sender).getBase());
|
players.add((Player)sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allowAll && args.length > 0 && args[0].contentEquals("*"))
|
if (allowAll && args.length > 0 && args[0].contentEquals("*"))
|
||||||
|
@ -63,7 +63,7 @@ public class Commandenchant extends EssentialsCommand
|
|||||||
|
|
||||||
final MetaItemStack metaStack = new MetaItemStack(stack);
|
final MetaItemStack metaStack = new MetaItemStack(stack);
|
||||||
final Enchantment enchantment = metaStack.getEnchantment(user, args[0]);
|
final Enchantment enchantment = metaStack.getEnchantment(user, args[0]);
|
||||||
metaStack.addEnchantment(user, allowUnsafe, enchantment, level);
|
metaStack.addEnchantment(user.getBase(), allowUnsafe, enchantment, level);
|
||||||
user.getInventory().setItemInHand(metaStack.getItemStack());
|
user.getInventory().setItemInHand(metaStack.getItemStack());
|
||||||
|
|
||||||
user.updateInventory();
|
user.updateInventory();
|
||||||
|
@ -23,28 +23,28 @@ public class Commandexp extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
showExp(user, user);
|
showExp(user.getBase(), user);
|
||||||
}
|
}
|
||||||
else if (args.length > 1 && args[0].equalsIgnoreCase("set") && user.isAuthorized("essentials.exp.set"))
|
else if (args.length > 1 && args[0].equalsIgnoreCase("set") && user.isAuthorized("essentials.exp.set"))
|
||||||
{
|
{
|
||||||
if (args.length == 3 && user.isAuthorized("essentials.exp.set.others"))
|
if (args.length == 3 && user.isAuthorized("essentials.exp.set.others"))
|
||||||
{
|
{
|
||||||
expMatch(server, user, args[1], args[2], false);
|
expMatch(server, user.getBase(), args[1], args[2], false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setExp(user, user, args[1], false);
|
setExp(user.getBase(), user, args[1], false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args.length > 1 && args[0].equalsIgnoreCase("give") && user.isAuthorized("essentials.exp.give"))
|
else if (args.length > 1 && args[0].equalsIgnoreCase("give") && user.isAuthorized("essentials.exp.give"))
|
||||||
{
|
{
|
||||||
if (args.length == 3 && user.isAuthorized("essentials.exp.give.others"))
|
if (args.length == 3 && user.isAuthorized("essentials.exp.give.others"))
|
||||||
{
|
{
|
||||||
expMatch(server, user, args[1], args[2], true);
|
expMatch(server, user.getBase(), args[1], args[2], true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setExp(user, user, args[1], true);
|
setExp(user.getBase(), user, args[1], true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args[0].equalsIgnoreCase("show"))
|
else if (args[0].equalsIgnoreCase("show"))
|
||||||
@ -52,11 +52,11 @@ public class Commandexp extends EssentialsCommand
|
|||||||
if (args.length >= 2 && user.isAuthorized("essentials.exp.others"))
|
if (args.length >= 2 && user.isAuthorized("essentials.exp.others"))
|
||||||
{
|
{
|
||||||
String match = args[1].trim();
|
String match = args[1].trim();
|
||||||
showMatch(server, user, match);
|
showMatch(server, user.getBase(), match);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
showExp(user, user);
|
showExp(user.getBase(), user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -65,21 +65,21 @@ public class Commandexp extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (args.length >= 2 && user.isAuthorized("essentials.exp.give.others"))
|
if (args.length >= 2 && user.isAuthorized("essentials.exp.give.others"))
|
||||||
{
|
{
|
||||||
expMatch(server, user, args[1], args[0], true);
|
expMatch(server, user.getBase(), args[1], args[0], true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setExp(user, user, args[0], true);
|
setExp(user.getBase(), user, args[0], true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args.length >= 1 && user.isAuthorized("essentials.exp.others"))
|
else if (args.length >= 1 && user.isAuthorized("essentials.exp.others"))
|
||||||
{
|
{
|
||||||
String match = args[0].trim();
|
String match = args[0].trim();
|
||||||
showMatch(server, user, match);
|
showMatch(server, user.getBase(), match);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
showExp(user, user);
|
showExp(user.getBase(), user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ public class Commandext extends EssentialsCommand
|
|||||||
throw new PlayerNotFoundException();
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
extinguishPlayers(server, user, args[0]);
|
extinguishPlayers(server, user.getBase(), args[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void extinguishPlayers(final Server server, final CommandSender sender, final String name) throws Exception
|
private void extinguishPlayers(final Server server, final CommandSender sender, final String name) throws Exception
|
||||||
|
@ -29,7 +29,7 @@ public class Commandfeed extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
user.healCooldown();
|
user.healCooldown();
|
||||||
}
|
}
|
||||||
feedOtherPlayers(server, user, args[0]);
|
feedOtherPlayers(server, user.getBase(), args[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ public class Commandfeed extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
feedPlayer(user, user.getBase());
|
feedPlayer(user.getBase(), user.getBase());
|
||||||
}
|
}
|
||||||
catch (QuietAbortException e)
|
catch (QuietAbortException e)
|
||||||
{
|
{
|
||||||
|
@ -113,7 +113,7 @@ public class Commandfirework extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mStack.addFireworkMeta(user, true, arg, ess);
|
mStack.addFireworkMeta(user.getBase(), true, arg, ess);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -27,20 +27,20 @@ public class Commandfly extends EssentialsToggleCommand
|
|||||||
Boolean toggle = matchToggleArgument(args[0]);
|
Boolean toggle = matchToggleArgument(args[0]);
|
||||||
if (toggle == null && user.isAuthorized(othersPermission))
|
if (toggle == null && user.isAuthorized(othersPermission))
|
||||||
{
|
{
|
||||||
toggleOtherPlayers(server, user, args);
|
toggleOtherPlayers(server, user.getBase(), args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
togglePlayer(user, user, toggle);
|
togglePlayer(user.getBase(), user, toggle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args.length == 2 && user.isAuthorized(othersPermission))
|
else if (args.length == 2 && user.isAuthorized(othersPermission))
|
||||||
{
|
{
|
||||||
toggleOtherPlayers(server, user, args);
|
toggleOtherPlayers(server, user.getBase(), args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
togglePlayer(user, user, null);
|
togglePlayer(user.getBase(), user, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public class Commandgamemode extends EssentialsCommand
|
|||||||
else if (args.length > 1 && args[1].trim().length() > 2 && user.isAuthorized("essentials.gamemode.others"))
|
else if (args.length > 1 && args[1].trim().length() > 2 && user.isAuthorized("essentials.gamemode.others"))
|
||||||
{
|
{
|
||||||
gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH));
|
gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH));
|
||||||
gamemodeOtherPlayers(server, user, gameMode, args[1]);
|
gamemodeOtherPlayers(server, user.getBase(), gameMode, args[1]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -63,7 +63,7 @@ public class Commandgamemode extends EssentialsCommand
|
|||||||
if (user.isAuthorized("essentials.gamemode.others"))
|
if (user.isAuthorized("essentials.gamemode.others"))
|
||||||
{
|
{
|
||||||
gameMode = matchGameMode(commandLabel);
|
gameMode = matchGameMode(commandLabel);
|
||||||
gamemodeOtherPlayers(server, user, gameMode, args[0]);
|
gamemodeOtherPlayers(server, user.getBase(), gameMode, args[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
|
@ -20,10 +20,10 @@ public class Commandgetpos extends EssentialsCommand
|
|||||||
if (args.length > 0 && user.isAuthorized("essentials.getpos.others"))
|
if (args.length > 0 && user.isAuthorized("essentials.getpos.others"))
|
||||||
{
|
{
|
||||||
final User otherUser = getPlayer(server, user, args, 0);
|
final User otherUser = getPlayer(server, user, args, 0);
|
||||||
outputPosition(user, otherUser.getLocation(), user.getLocation());
|
outputPosition(user.getBase(), otherUser.getLocation(), user.getLocation());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
outputPosition(user, user.getLocation(), null);
|
outputPosition(user.getBase(), user.getLocation(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,20 +27,20 @@ public class Commandgod extends EssentialsToggleCommand
|
|||||||
Boolean toggle = matchToggleArgument(args[0]);
|
Boolean toggle = matchToggleArgument(args[0]);
|
||||||
if (toggle == null && user.isAuthorized(othersPermission))
|
if (toggle == null && user.isAuthorized(othersPermission))
|
||||||
{
|
{
|
||||||
toggleOtherPlayers(server, user, args);
|
toggleOtherPlayers(server, user.getBase(), args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
togglePlayer(user, user, toggle);
|
togglePlayer(user.getBase(), user, toggle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args.length == 2 && user.isAuthorized(othersPermission))
|
else if (args.length == 2 && user.isAuthorized(othersPermission))
|
||||||
{
|
{
|
||||||
toggleOtherPlayers(server, user, args);
|
toggleOtherPlayers(server, user.getBase(), args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
togglePlayer(user, user, null);
|
togglePlayer(user.getBase(), user, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ public class Commandheal extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
user.healCooldown();
|
user.healCooldown();
|
||||||
}
|
}
|
||||||
healOtherPlayers(server, user, args[0]);
|
healOtherPlayers(server, user.getBase(), args[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ public class Commandhelp extends EssentialsCommand
|
|||||||
String pageStr = args.length > 0 ? args[0] : null;
|
String pageStr = args.length > 0 ? args[0] : null;
|
||||||
String chapterPageStr = args.length > 1 ? args[1] : null;
|
String chapterPageStr = args.length > 1 ? args[1] : null;
|
||||||
String command = commandLabel;
|
String command = commandLabel;
|
||||||
final IText input = new TextInput(user, "help", false, ess);
|
final IText input = new TextInput(user.getBase(), "help", false, ess);
|
||||||
|
|
||||||
if (input.getLines().isEmpty())
|
if (input.getLines().isEmpty())
|
||||||
{
|
{
|
||||||
@ -45,10 +45,10 @@ public class Commandhelp extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
output = new KeywordReplacer(input, user, ess);
|
output = new KeywordReplacer(input, user.getBase(), ess);
|
||||||
}
|
}
|
||||||
final TextPager pager = new TextPager(output);
|
final TextPager pager = new TextPager(output);
|
||||||
pager.showPage(pageStr, chapterPageStr, command, user);
|
pager.showPage(pageStr, chapterPageStr, command, user.getBase());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,7 +20,7 @@ public class Commandhelpop extends EssentialsCommand
|
|||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
user.setDisplayNick();
|
user.setDisplayNick();
|
||||||
sendMessage(server, user, user.getDisplayName(), args);
|
sendMessage(server, user.getBase(), user.getDisplayName(), args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,7 +60,7 @@ public class Commanditem extends EssentialsCommand
|
|||||||
MetaItemStack metaStack = new MetaItemStack(stack);
|
MetaItemStack metaStack = new MetaItemStack(stack);
|
||||||
final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments() && user.isAuthorized("essentials.enchantments.allowunsafe");
|
final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments() && user.isAuthorized("essentials.enchantments.allowunsafe");
|
||||||
|
|
||||||
metaStack.parseStringMeta(user, allowUnsafe, args, 2, ess);
|
metaStack.parseStringMeta(user.getBase(), allowUnsafe, args, 2, ess);
|
||||||
|
|
||||||
stack = metaStack.getItemStack();
|
stack = metaStack.getItemStack();
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ public class Commandpotion extends EssentialsCommand
|
|||||||
final MetaItemStack mStack = new MetaItemStack(stack);
|
final MetaItemStack mStack = new MetaItemStack(stack);
|
||||||
for (String arg : args)
|
for (String arg : args)
|
||||||
{
|
{
|
||||||
mStack.addPotionMeta(user, true, arg, ess);
|
mStack.addPotionMeta(user.getBase(), true, arg, ess);
|
||||||
}
|
}
|
||||||
if (mStack.completePotion())
|
if (mStack.completePotion())
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,7 @@ public class Commandpowertool extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
final String command = getFinalArg(args, 0);
|
final String command = getFinalArg(args, 0);
|
||||||
final ItemStack itemStack = user.getItemInHand();
|
final ItemStack itemStack = user.getItemInHand();
|
||||||
powertool(server, user, user, commandLabel, itemStack, command);
|
powertool(server, user.getBase(), user, commandLabel, itemStack, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -30,7 +30,7 @@ public class Commandseen 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 User user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
seen(server, user, args, user.isAuthorized("essentials.seen.banreason"), user.isAuthorized("essentials.seen.extra"), user.isAuthorized("essentials.seen.ipsearch"));
|
seen(server, user.getBase(), args, user.isAuthorized("essentials.seen.banreason"), user.isAuthorized("essentials.seen.extra"), user.isAuthorized("essentials.seen.ipsearch"));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void seen(final Server server, final CommandSender sender, final String[] args, final boolean showBan, final boolean extra, final boolean ipLookup) throws Exception
|
protected void seen(final Server server, final CommandSender sender, final String[] args, final boolean showBan, final boolean extra, final boolean ipLookup) throws Exception
|
||||||
|
@ -27,20 +27,20 @@ public class Commandsocialspy extends EssentialsToggleCommand
|
|||||||
Boolean toggle = matchToggleArgument(args[0]);
|
Boolean toggle = matchToggleArgument(args[0]);
|
||||||
if (toggle == null && user.isAuthorized(othersPermission))
|
if (toggle == null && user.isAuthorized(othersPermission))
|
||||||
{
|
{
|
||||||
toggleOtherPlayers(server, user, args);
|
toggleOtherPlayers(server, user.getBase(), args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
togglePlayer(user, user, toggle);
|
togglePlayer(user.getBase(), user, toggle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args.length == 2 && user.isAuthorized(othersPermission))
|
else if (args.length == 2 && user.isAuthorized(othersPermission))
|
||||||
{
|
{
|
||||||
toggleOtherPlayers(server, user, args);
|
toggleOtherPlayers(server, user.getBase(), args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
togglePlayer(user, user, null);
|
togglePlayer(user.getBase(), user, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class Commandspawnmob extends EssentialsCommand
|
|||||||
if (args.length >= 3)
|
if (args.length >= 3)
|
||||||
{
|
{
|
||||||
final User target = getPlayer(ess.getServer(), user, args, 2);
|
final User target = getPlayer(ess.getServer(), user, args, 2);
|
||||||
SpawnMob.spawnmob(ess, server, user, target, mobParts, mobData, mobCount);
|
SpawnMob.spawnmob(ess, server, user.getBase(), target, mobParts, mobData, mobCount);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public class Commandspeed extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
throw new PlayerNotFoundException();
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
speedOtherPlayers(server, user, isFly, isBypass, speed, args[2]);
|
speedOtherPlayers(server, user.getBase(), isFly, isBypass, speed, args[2]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ public class Commandtpaccept extends EssentialsCommand
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
user.sendMessage(_("pendingTeleportCancelled"));
|
user.sendMessage(_("pendingTeleportCancelled"));
|
||||||
ess.showError(target, ex, commandLabel);
|
ess.showError(target.getBase(), ex, commandLabel);
|
||||||
}
|
}
|
||||||
user.requestTeleport(null, false);
|
user.requestTeleport(null, false);
|
||||||
throw new NoChargeException();
|
throw new NoChargeException();
|
||||||
|
@ -27,20 +27,20 @@ public class Commandtptoggle extends EssentialsToggleCommand
|
|||||||
Boolean toggle = matchToggleArgument(args[0]);
|
Boolean toggle = matchToggleArgument(args[0]);
|
||||||
if (toggle == null && user.isAuthorized(othersPermission))
|
if (toggle == null && user.isAuthorized(othersPermission))
|
||||||
{
|
{
|
||||||
toggleOtherPlayers(server, user, args);
|
toggleOtherPlayers(server, user.getBase(), args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
togglePlayer(user, user, toggle);
|
togglePlayer(user.getBase(), user, toggle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args.length == 2 && user.isAuthorized(othersPermission))
|
else if (args.length == 2 && user.isAuthorized(othersPermission))
|
||||||
{
|
{
|
||||||
toggleOtherPlayers(server, user, args);
|
toggleOtherPlayers(server, user.getBase(), args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
togglePlayer(user, user, null);
|
togglePlayer(user.getBase(), user, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +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.IUser;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.utils.StringUtil;
|
import com.earth2me.essentials.utils.StringUtil;
|
||||||
@ -34,7 +35,7 @@ public class Commandwarp extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
throw new Exception(_("warpListPermission"));
|
throw new Exception(_("warpListPermission"));
|
||||||
}
|
}
|
||||||
warpList(user, args);
|
warpList(user.getBase(), args, user);
|
||||||
throw new NoChargeException();
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
if (args.length > 0)
|
if (args.length > 0)
|
||||||
@ -57,7 +58,7 @@ public class Commandwarp extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (args.length < 2 || NumberUtil.isInt(args[0]))
|
if (args.length < 2 || NumberUtil.isInt(args[0]))
|
||||||
{
|
{
|
||||||
warpList(sender, args);
|
warpList(sender, args, null);
|
||||||
throw new NoChargeException();
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
User otherUser = getPlayer(server, args, 1, true, false);
|
User otherUser = getPlayer(server, args, 1, true, false);
|
||||||
@ -67,7 +68,7 @@ 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, final IUser user) throws Exception
|
||||||
{
|
{
|
||||||
final IWarps warps = ess.getWarps();
|
final IWarps warps = ess.getWarps();
|
||||||
if (warps.isEmpty())
|
if (warps.isEmpty())
|
||||||
@ -76,13 +77,13 @@ public class Commandwarp extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
final List<String> warpNameList = new ArrayList<String>(warps.getList());
|
final List<String> warpNameList = new ArrayList<String>(warps.getList());
|
||||||
|
|
||||||
if (sender instanceof User)
|
if (user != null)
|
||||||
{
|
{
|
||||||
final Iterator<String> iterator = warpNameList.iterator();
|
final Iterator<String> iterator = warpNameList.iterator();
|
||||||
while (iterator.hasNext())
|
while (iterator.hasNext())
|
||||||
{
|
{
|
||||||
final String warpName = iterator.next();
|
final String warpName = iterator.next();
|
||||||
if (ess.getSettings().getPerWarpPermission() && !((User)sender).isAuthorized("essentials.warps." + warpName))
|
if (ess.getSettings().getPerWarpPermission() && !user.isAuthorized("essentials.warps." + warpName))
|
||||||
{
|
{
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
|
@ -50,11 +50,11 @@ public class EssentialsSign
|
|||||||
}
|
}
|
||||||
catch (ChargeException ex)
|
catch (ChargeException ex)
|
||||||
{
|
{
|
||||||
ess.showError(user, ex, signName);
|
ess.showError(user.getBase(), ex, signName);
|
||||||
}
|
}
|
||||||
catch (SignException ex)
|
catch (SignException ex)
|
||||||
{
|
{
|
||||||
ess.showError(user, ex, signName);
|
ess.showError(user.getBase(), ex, signName);
|
||||||
}
|
}
|
||||||
// Return true, so the player sees the wrong sign.
|
// Return true, so the player sees the wrong sign.
|
||||||
return true;
|
return true;
|
||||||
@ -96,12 +96,12 @@ public class EssentialsSign
|
|||||||
}
|
}
|
||||||
catch (ChargeException ex)
|
catch (ChargeException ex)
|
||||||
{
|
{
|
||||||
ess.showError(user, ex, signName);
|
ess.showError(user.getBase(), ex, signName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch (SignException ex)
|
catch (SignException ex)
|
||||||
{
|
{
|
||||||
ess.showError(user, ex, signName);
|
ess.showError(user.getBase(), ex, signName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ public class EssentialsSign
|
|||||||
}
|
}
|
||||||
catch (SignException ex)
|
catch (SignException ex)
|
||||||
{
|
{
|
||||||
ess.showError(user, ex, signName);
|
ess.showError(user.getBase(), ex, signName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -147,11 +147,11 @@ public class EssentialsSign
|
|||||||
}
|
}
|
||||||
catch (ChargeException ex)
|
catch (ChargeException ex)
|
||||||
{
|
{
|
||||||
ess.showError(user, ex, signName);
|
ess.showError(user.getBase(), ex, signName);
|
||||||
}
|
}
|
||||||
catch (SignException ex)
|
catch (SignException ex)
|
||||||
{
|
{
|
||||||
ess.showError(user, ex, signName);
|
ess.showError(user.getBase(), ex, signName);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -165,11 +165,11 @@ public class EssentialsSign
|
|||||||
}
|
}
|
||||||
catch (ChargeException ex)
|
catch (ChargeException ex)
|
||||||
{
|
{
|
||||||
ess.showError(user, ex, signName);
|
ess.showError(user.getBase(), ex, signName);
|
||||||
}
|
}
|
||||||
catch (SignException ex)
|
catch (SignException ex)
|
||||||
{
|
{
|
||||||
ess.showError(user, ex, signName);
|
ess.showError(user.getBase(), ex, signName);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ public class EssentialsSign
|
|||||||
}
|
}
|
||||||
catch (SignException ex)
|
catch (SignException ex)
|
||||||
{
|
{
|
||||||
ess.showError(user, ex, signName);
|
ess.showError(user.getBase(), ex, signName);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -37,10 +37,10 @@ public class SignInfo extends EssentialsSign
|
|||||||
final IText input;
|
final IText input;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
input = new TextInput(player, "info", true, ess);
|
input = new TextInput(player.getBase(), "info", true, ess);
|
||||||
final IText output = new KeywordReplacer(input, player, ess);
|
final IText output = new KeywordReplacer(input, player.getBase(), ess);
|
||||||
final TextPager pager = new TextPager(output);
|
final TextPager pager = new TextPager(output);
|
||||||
pager.showPage(chapter, page, null, player);
|
pager.showPage(chapter, page, null, player.getBase());
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
|
@ -29,7 +29,7 @@ public class SignSpawnmob extends EssentialsSign
|
|||||||
{
|
{
|
||||||
List<String> mobParts = SpawnMob.mobParts(sign.getLine(2));
|
List<String> mobParts = SpawnMob.mobParts(sign.getLine(2));
|
||||||
List<String> mobData = SpawnMob.mobData(sign.getLine(2));
|
List<String> mobData = SpawnMob.mobData(sign.getLine(2));
|
||||||
SpawnMob.spawnmob(ess, ess.getServer(), player, player, mobParts, mobData, Integer.parseInt(sign.getLine(1)));
|
SpawnMob.spawnmob(ess, ess.getServer(), player.getBase(), player, mobParts, mobData, Integer.parseInt(sign.getLine(1)));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -114,7 +114,7 @@ public abstract class EssentialsChatPlayer implements Listener
|
|||||||
}
|
}
|
||||||
catch (ChargeException e)
|
catch (ChargeException e)
|
||||||
{
|
{
|
||||||
ess.showError(chatStore.getUser(), e, chatStore.getLongType());
|
ess.showError(chatStore.getUser().getBase(), e, chatStore.getLongType());
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ public class EssentialsSpawnPlayerListener implements Listener
|
|||||||
//This method allows for multiple line player announce messages using multiline yaml syntax #EasterEgg
|
//This method allows for multiple line player announce messages using multiline yaml syntax #EasterEgg
|
||||||
if (ess.getSettings().getAnnounceNewPlayers())
|
if (ess.getSettings().getAnnounceNewPlayers())
|
||||||
{
|
{
|
||||||
final IText output = new KeywordReplacer(ess.getSettings().getAnnounceNewPlayerFormat(), user, ess);
|
final IText output = new KeywordReplacer(ess.getSettings().getAnnounceNewPlayerFormat(), user.getBase(), ess);
|
||||||
final SimpleTextPager pager = new SimpleTextPager(output);
|
final SimpleTextPager pager = new SimpleTextPager(output);
|
||||||
|
|
||||||
for (String line : pager.getLines())
|
for (String line : pager.getLines())
|
||||||
|
Loading…
Reference in New Issue
Block a user