mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-10-25 06:51:19 +00:00
Update fly command to allow for /fly on|*ena*|1 and inversely, /fly off|*dis*|0.
This commit is contained in:
parent
83120f707f
commit
6a8a2dd28b
|
@ -28,15 +28,29 @@ public class Commandfly 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
|
||||||
{
|
{
|
||||||
if (args.length > 0 && args[0].trim().length() > 2 && user.isAuthorized("essentials.fly.others"))
|
if (args.length == 1)
|
||||||
|
{
|
||||||
|
if (args[0].contains("on") || args[0].contains("ena") || args[0].equalsIgnoreCase("1"))
|
||||||
|
{
|
||||||
|
user.setAllowFlight(true);
|
||||||
|
}
|
||||||
|
else if (args[0].contains("off") || args[0].contains("dis") || args[0].equalsIgnoreCase("0"))
|
||||||
|
{
|
||||||
|
user.setAllowFlight(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (args.length > 0 && args[0].trim().length() > 2 && user.isAuthorized("essentials.fly.others"))
|
||||||
{
|
{
|
||||||
flyOtherPlayers(server, user, args);
|
flyOtherPlayers(server, user, args);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
user.setAllowFlight(!user.getAllowFlight());
|
else
|
||||||
if (!user.getAllowFlight())
|
|
||||||
{
|
{
|
||||||
user.setFlying(false);
|
user.setAllowFlight(!user.getAllowFlight());
|
||||||
|
if (!user.getAllowFlight())
|
||||||
|
{
|
||||||
|
user.setFlying(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
user.sendMessage(_("flyMode", _(user.getAllowFlight() ? "enabled" : "disabled"), user.getDisplayName()));
|
user.sendMessage(_("flyMode", _(user.getAllowFlight() ? "enabled" : "disabled"), user.getDisplayName()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue