mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-27 00:15:23 +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 net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
|
||||
|
||||
public class Commandtptoggle extends EssentialsCommand
|
||||
@@ -9,8 +10,26 @@ public class Commandtptoggle extends EssentialsCommand
|
||||
@Override
|
||||
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()
|
||||
? _("teleportationEnabled")
|
||||
: _("teleportationDisabled"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -105,6 +105,7 @@ public enum Permissions implements IPermission
|
||||
TPAALL,
|
||||
TPAHERE,
|
||||
TPOHERE,
|
||||
TPTOGGLE_OTHERS,
|
||||
UNLIMITED_OTHERS,
|
||||
WARP_LIST(PermissionDefault.TRUE),
|
||||
WARP_HIDDEN,
|
||||
|
Reference in New Issue
Block a user