mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-27 08:24:44 +02:00
update tptoggle to allow toggling other players :: new permission: essentials.tptoggle.others
This commit is contained in:
@@ -2,6 +2,7 @@ package net.ess3.commands;
|
|||||||
|
|
||||||
import static net.ess3.I18n._;
|
import static net.ess3.I18n._;
|
||||||
import net.ess3.api.IUser;
|
import net.ess3.api.IUser;
|
||||||
|
import net.ess3.permissions.Permissions;
|
||||||
|
|
||||||
|
|
||||||
public class Commandtptoggle extends EssentialsCommand
|
public class Commandtptoggle extends EssentialsCommand
|
||||||
@@ -9,8 +10,26 @@ public class Commandtptoggle extends EssentialsCommand
|
|||||||
@Override
|
@Override
|
||||||
public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
|
public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
|
IUser otherUser = null;
|
||||||
|
if (args.length > 0 && Permissions.TPTOGGLE_OTHERS.isAuthorized(user))
|
||||||
|
{
|
||||||
|
otherUser = ess.getUserMap().getUser(server.getPlayer(args[0]));
|
||||||
|
if (otherUser == null)
|
||||||
|
{
|
||||||
|
throw new Exception(_("playerNotFound"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ess.getUserMap().getUser(server.getPlayer(args[0])).sendMessage(user.toggleTeleportEnabled()
|
||||||
|
? _("teleportationEnabled")
|
||||||
|
: _("teleportationDisabled"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
user.sendMessage(user.toggleTeleportEnabled()
|
user.sendMessage(user.toggleTeleportEnabled()
|
||||||
? _("teleportationEnabled")
|
? _("teleportationEnabled")
|
||||||
: _("teleportationDisabled"));
|
: _("teleportationDisabled"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -105,6 +105,7 @@ public enum Permissions implements IPermission
|
|||||||
TPAALL,
|
TPAALL,
|
||||||
TPAHERE,
|
TPAHERE,
|
||||||
TPOHERE,
|
TPOHERE,
|
||||||
|
TPTOGGLE_OTHERS,
|
||||||
UNLIMITED_OTHERS,
|
UNLIMITED_OTHERS,
|
||||||
WARP_LIST(PermissionDefault.TRUE),
|
WARP_LIST(PermissionDefault.TRUE),
|
||||||
WARP_HIDDEN,
|
WARP_HIDDEN,
|
||||||
|
Reference in New Issue
Block a user