mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 12:23:59 +00:00
[Fix] offline player matching for online only commands.
/kick,/warp, /burn & /tppos should only match online players
This commit is contained in:
parent
f5c17fc7c7
commit
ea9bf854cc
4 changed files with 11 additions and 19 deletions
|
@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._;
|
||||||
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;
|
||||||
|
import com.earth2me.essentials.User;
|
||||||
|
|
||||||
|
|
||||||
public class Commandburn extends EssentialsCommand
|
public class Commandburn extends EssentialsCommand
|
||||||
|
@ -27,10 +28,8 @@ public class Commandburn extends EssentialsCommand
|
||||||
throw new NotEnoughArgumentsException("You need to specify a player to burn.");
|
throw new NotEnoughArgumentsException("You need to specify a player to burn.");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player p : server.matchPlayer(args[0]))
|
User user = getPlayer(server, args, 0);
|
||||||
{
|
user.setFireTicks(Integer.parseInt(args[1]) * 20);
|
||||||
p.setFireTicks(Integer.parseInt(args[1]) * 20);
|
sender.sendMessage(_("burnMsg", user.getDisplayName(), Integer.parseInt(args[1])));
|
||||||
sender.sendMessage(_("burnMsg", p.getDisplayName(), Integer.parseInt(args[1])));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class Commandkick extends EssentialsCommand
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
final User target = getPlayer(server, args, 0, true);
|
final User target = getPlayer(server, args, 0);
|
||||||
if (sender instanceof Player)
|
if (sender instanceof Player)
|
||||||
{
|
{
|
||||||
User user = ess.getUser(sender);
|
User user = ess.getUser(sender);
|
||||||
|
@ -33,6 +33,7 @@ public class Commandkick extends EssentialsCommand
|
||||||
{
|
{
|
||||||
throw new PlayerNotFoundException();
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.isAuthorized("essentials.kick.exempt"))
|
if (target.isAuthorized("essentials.kick.exempt"))
|
||||||
{
|
{
|
||||||
throw new Exception(_("kickExempt"));
|
throw new Exception(_("kickExempt"));
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class Commandtppos extends EssentialsCommand
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
User user = ess.getUser(server.getPlayer(args[0]));
|
User user = getPlayer(server, args, 0);
|
||||||
final double x = args[1].startsWith("~") ? user.getLocation().getX() + Integer.parseInt(args[1].substring(1)) : Integer.parseInt(args[1]);
|
final double x = args[1].startsWith("~") ? user.getLocation().getX() + Integer.parseInt(args[1].substring(1)) : Integer.parseInt(args[1]);
|
||||||
final double y = args[2].startsWith("~") ? user.getLocation().getY() + Integer.parseInt(args[2].substring(1)) : Integer.parseInt(args[2]);
|
final double y = args[2].startsWith("~") ? user.getLocation().getY() + Integer.parseInt(args[2].substring(1)) : Integer.parseInt(args[2]);
|
||||||
final double z = args[3].startsWith("~") ? user.getLocation().getZ() + Integer.parseInt(args[3].substring(1)) : Integer.parseInt(args[3]);
|
final double z = args[3].startsWith("~") ? user.getLocation().getZ() + Integer.parseInt(args[3].substring(1)) : Integer.parseInt(args[3]);
|
||||||
|
|
|
@ -41,11 +41,7 @@ public class Commandwarp extends EssentialsCommand
|
||||||
User otherUser = null;
|
User otherUser = null;
|
||||||
if (args.length == 2 && (user.isAuthorized("essentials.warp.otherplayers") || user.isAuthorized("essentials.warp.others")))
|
if (args.length == 2 && (user.isAuthorized("essentials.warp.otherplayers") || user.isAuthorized("essentials.warp.others")))
|
||||||
{
|
{
|
||||||
otherUser = ess.getUser(server.getPlayer(args[1]));
|
otherUser = getPlayer(server, args, 1);
|
||||||
if (otherUser == null)
|
|
||||||
{
|
|
||||||
throw new Exception(_("playerNotFound"));
|
|
||||||
}
|
|
||||||
warpUser(user, otherUser, args[0]);
|
warpUser(user, otherUser, args[0]);
|
||||||
throw new NoChargeException();
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
|
@ -62,11 +58,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]));
|
User otherUser = getPlayer(server, args, 1);
|
||||||
if (otherUser == null)
|
|
||||||
{
|
|
||||||
throw new Exception(_("playerNotFound"));
|
|
||||||
}
|
|
||||||
otherUser.getTeleport().warp(args[0], null, TeleportCause.COMMAND);
|
otherUser.getTeleport().warp(args[0], null, TeleportCause.COMMAND);
|
||||||
throw new NoChargeException();
|
throw new NoChargeException();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue