mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 12:23:59 +00:00
Added support for teleporting to hidden players
Permission: essentials.teleport.hidden
This commit is contained in:
parent
6fa2b14d65
commit
65df249510
2 changed files with 39 additions and 8 deletions
|
@ -1,5 +1,6 @@
|
||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.OfflinePlayer;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
|
@ -21,9 +22,23 @@ public class Commandtpo extends EssentialsCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
//Just basically the old tp command
|
//Just basically the old tp command
|
||||||
User p = getPlayer(server, args, 0);
|
User p = getPlayer(server, args, 0, true);
|
||||||
charge(user);
|
// Check if user is offline
|
||||||
user.getTeleport().now(p, false);
|
if (p.getBase() instanceof OfflinePlayer)
|
||||||
user.sendMessage(Util.i18n("teleporting"));
|
{
|
||||||
|
throw new NoSuchFieldException(Util.i18n("playerNotFound"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify permission
|
||||||
|
if (!p.isHidden() || user.isAuthorized("essentials.teleport.hidden"))
|
||||||
|
{
|
||||||
|
charge(user);
|
||||||
|
user.getTeleport().now(p, false);
|
||||||
|
user.sendMessage(Util.i18n("teleporting"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new NoSuchFieldException(Util.i18n("playerNotFound"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.OfflinePlayer;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
|
@ -21,9 +22,24 @@ public class Commandtpohere extends EssentialsCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
//Just basically the old tphere command
|
//Just basically the old tphere command
|
||||||
User p = getPlayer(server, args, 0);
|
User p = getPlayer(server, args, 0, true);
|
||||||
charge(user);
|
|
||||||
p.getTeleport().now(user, false);
|
// Check if user is offline
|
||||||
user.sendMessage(Util.i18n("teleporting"));
|
if (p.getBase() instanceof OfflinePlayer)
|
||||||
|
{
|
||||||
|
throw new NoSuchFieldException(Util.i18n("playerNotFound"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify permission
|
||||||
|
if (!p.isHidden() || user.isAuthorized("essentials.teleport.hidden"))
|
||||||
|
{
|
||||||
|
charge(user);
|
||||||
|
p.getTeleport().now(user, false);
|
||||||
|
user.sendMessage(Util.i18n("teleporting"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new NoSuchFieldException(Util.i18n("playerNotFound"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue