mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Add some missing hidden checks
This commit is contained in:
parent
8f6c61fa99
commit
896e14670f
7 changed files with 48 additions and 31 deletions
|
@ -118,12 +118,16 @@ public class Commandexp extends EssentialsCommand
|
||||||
private void showMatch(final Server server, final CommandSender sender, final String match) throws NotEnoughArgumentsException
|
private void showMatch(final Server server, final CommandSender sender, final String match) throws NotEnoughArgumentsException
|
||||||
{
|
{
|
||||||
boolean foundUser = false;
|
boolean foundUser = false;
|
||||||
final List<Player> matchedPlayers = server.matchPlayer(match);
|
final List<Player> matchedPlayers = server.matchPlayer(match);
|
||||||
for (Player matchPlayer : matchedPlayers)
|
for (Player matchPlayer : matchedPlayers)
|
||||||
{
|
{
|
||||||
|
final User player = ess.getUser(matchPlayer);
|
||||||
|
if (player.isHidden())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
foundUser = true;
|
foundUser = true;
|
||||||
final User target = ess.getUser(matchPlayer);
|
showExp(sender, player);
|
||||||
showExp(sender, target);
|
|
||||||
}
|
}
|
||||||
if (!foundUser)
|
if (!foundUser)
|
||||||
{
|
{
|
||||||
|
@ -134,12 +138,16 @@ public class Commandexp extends EssentialsCommand
|
||||||
private void expMatch(final Server server, final CommandSender sender, final String match, String amount, final boolean give) throws NotEnoughArgumentsException
|
private void expMatch(final Server server, final CommandSender sender, final String match, String amount, final boolean give) throws NotEnoughArgumentsException
|
||||||
{
|
{
|
||||||
boolean foundUser = false;
|
boolean foundUser = false;
|
||||||
final List<Player> matchedPlayers = server.matchPlayer(match);
|
final List<Player> matchedPlayers = server.matchPlayer(match);
|
||||||
for (Player matchPlayer : matchedPlayers)
|
for (Player matchPlayer : matchedPlayers)
|
||||||
{
|
{
|
||||||
|
final User player = ess.getUser(matchPlayer);
|
||||||
|
if (player.isHidden())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
foundUser = true;
|
foundUser = true;
|
||||||
final User target = ess.getUser(matchPlayer);
|
setExp(sender, player, amount, give);
|
||||||
setExp(sender, target, amount, give);
|
|
||||||
}
|
}
|
||||||
if (!foundUser)
|
if (!foundUser)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,6 +45,11 @@ public class Commandext extends EssentialsCommand
|
||||||
final List<Player> matchedPlayers = server.matchPlayer(name);
|
final List<Player> matchedPlayers = server.matchPlayer(name);
|
||||||
for (Player matchPlayer : matchedPlayers)
|
for (Player matchPlayer : matchedPlayers)
|
||||||
{
|
{
|
||||||
|
final User player = ess.getUser(matchPlayer);
|
||||||
|
if (player.isHidden())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
foundUser = true;
|
foundUser = true;
|
||||||
matchPlayer.setFireTicks(0);
|
matchPlayer.setFireTicks(0);
|
||||||
sender.sendMessage(_("extinguishOthers", matchPlayer.getDisplayName()));
|
sender.sendMessage(_("extinguishOthers", matchPlayer.getDisplayName()));
|
||||||
|
|
|
@ -36,7 +36,8 @@ public class Commandfeed extends EssentialsCommand
|
||||||
final List<Player> matchedPlayers = server.matchPlayer(name);
|
final List<Player> matchedPlayers = server.matchPlayer(name);
|
||||||
for (Player matchPlayer : matchedPlayers)
|
for (Player matchPlayer : matchedPlayers)
|
||||||
{
|
{
|
||||||
if (ess.getUser(matchPlayer).isHidden())
|
final User player = ess.getUser(matchPlayer);
|
||||||
|
if (player.isHidden())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,26 +77,26 @@ public class Commandgamemode extends EssentialsCommand
|
||||||
user.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()));
|
user.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final GameMode gameMode, final String player) throws NotEnoughArgumentsException
|
private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final GameMode gameMode, final String name) throws NotEnoughArgumentsException
|
||||||
{
|
{
|
||||||
//TODO: TL this
|
//TODO: TL this
|
||||||
if (player.trim().length() < 2 || gameMode == null)
|
if (name.trim().length() < 2 || gameMode == null)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException("You need to specify a valid player/mode.");
|
throw new NotEnoughArgumentsException("You need to specify a valid player/mode.");
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean foundUser = false;
|
boolean foundUser = false;
|
||||||
final List<Player> matchedPlayers = server.matchPlayer(player);
|
final List<Player> matchedPlayers = server.matchPlayer(name);
|
||||||
for (Player matchPlayer : matchedPlayers)
|
for (Player matchPlayer : matchedPlayers)
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(matchPlayer);
|
final User player = ess.getUser(matchPlayer);
|
||||||
if (user.isHidden())
|
if (player.isHidden())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foundUser = true;
|
foundUser = true;
|
||||||
user.setGameMode(gameMode);
|
player.setGameMode(gameMode);
|
||||||
sender.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()));
|
sender.sendMessage(_("gameMode", _(player.getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName()));
|
||||||
}
|
}
|
||||||
if (!foundUser)
|
if (!foundUser)
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,7 +55,8 @@ public class Commandheal extends EssentialsCommand
|
||||||
final List<Player> matchedPlayers = server.matchPlayer(name);
|
final List<Player> matchedPlayers = server.matchPlayer(name);
|
||||||
for (Player matchPlayer : matchedPlayers)
|
for (Player matchPlayer : matchedPlayers)
|
||||||
{
|
{
|
||||||
if (ess.getUser(matchPlayer).isHidden())
|
final User player = ess.getUser(matchPlayer);
|
||||||
|
if (player.isHidden())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class Commandpay extends EssentialsCommand
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: TL this.
|
//TODO: TL this.
|
||||||
if (args[0].trim().length() < 2)
|
if (args[0].trim().length() < 2)
|
||||||
{
|
{
|
||||||
|
@ -30,19 +30,19 @@ public class Commandpay extends EssentialsCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
double amount = Double.parseDouble(args[1].replaceAll("[^0-9\\.]", ""));
|
double amount = Double.parseDouble(args[1].replaceAll("[^0-9\\.]", ""));
|
||||||
|
|
||||||
boolean foundUser = false;
|
boolean foundUser = false;
|
||||||
final List<Player> matchedPlayers = server.matchPlayer(args[0]);
|
final List<Player> matchedPlayers = server.matchPlayer(args[0]);
|
||||||
for (Player matchPlayer : matchedPlayers)
|
for (Player matchPlayer : matchedPlayers)
|
||||||
{
|
{
|
||||||
User u = ess.getUser(matchPlayer);
|
User player = ess.getUser(matchPlayer);
|
||||||
if (u.isHidden())
|
if (player.isHidden())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foundUser = true;
|
foundUser = true;
|
||||||
user.payUser(u, amount);
|
user.payUser(player, amount);
|
||||||
Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), u.getName(), new Trade(amount, ess), user.getLocation(), ess);
|
Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), player.getName(), new Trade(amount, ess), user.getLocation(), ess);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foundUser)
|
if (!foundUser)
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class Commandspeed extends EssentialsCommand
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isFly)
|
if (isFly)
|
||||||
{
|
{
|
||||||
user.setFlySpeed(getRealMoveSpeed(speed, isFly, isBypass));
|
user.setFlySpeed(getRealMoveSpeed(speed, isFly, isBypass));
|
||||||
|
@ -66,10 +66,10 @@ public class Commandspeed extends EssentialsCommand
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void speedOtherPlayers(final Server server, final CommandSender sender, final boolean isFly, final boolean isBypass, final float speed, final String target) throws NotEnoughArgumentsException
|
private void speedOtherPlayers(final Server server, final CommandSender sender, final boolean isFly, final boolean isBypass, final float speed, final String name) throws NotEnoughArgumentsException
|
||||||
{
|
{
|
||||||
boolean foundUser = false;
|
boolean foundUser = false;
|
||||||
final List<Player> matchedPlayers = server.matchPlayer(target);
|
final List<Player> matchedPlayers = server.matchPlayer(name);
|
||||||
for (Player matchPlayer : matchedPlayers)
|
for (Player matchPlayer : matchedPlayers)
|
||||||
{
|
{
|
||||||
final User player = ess.getUser(matchPlayer);
|
final User player = ess.getUser(matchPlayer);
|
||||||
|
@ -94,17 +94,19 @@ public class Commandspeed extends EssentialsCommand
|
||||||
throw new NotEnoughArgumentsException(_("playerNotFound"));
|
throw new NotEnoughArgumentsException(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Boolean flyPermCheck(User user, boolean input) throws Exception
|
private Boolean flyPermCheck(User user, boolean input) throws Exception
|
||||||
{
|
{
|
||||||
boolean canFly = user.isAuthorized("essentials.speed.fly");
|
boolean canFly = user.isAuthorized("essentials.speed.fly");
|
||||||
boolean canWalk = user.isAuthorized("essentials.speed.walk");
|
boolean canWalk = user.isAuthorized("essentials.speed.walk");
|
||||||
if (input && canFly || !input && canWalk || !canFly && !canWalk) {
|
if (input && canFly || !input && canWalk || !canFly && !canWalk)
|
||||||
|
{
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
else if (canWalk) {
|
else if (canWalk)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue