mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 11:49:12 +00:00
[trunk] adding support to warp other players to warps, this requires the essentials.warp.otherplayers permission
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1342 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
parent
d9a5b73ea4
commit
50780f7399
2 changed files with 30 additions and 18 deletions
|
@ -4,6 +4,7 @@ import org.bukkit.Server;
|
|||
import com.earth2me.essentials.Essentials;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Warps;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
public class Commandwarp extends EssentialsCommand
|
||||
|
@ -16,7 +17,7 @@ public class Commandwarp extends EssentialsCommand
|
|||
@Override
|
||||
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
boolean perWarpPermission = ess.getSettings().getPerWarpPermission();
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
if (!user.isAuthorized("essentials.warp.list"))
|
||||
|
@ -34,7 +35,7 @@ public class Commandwarp extends EssentialsCommand
|
|||
int i = 0;
|
||||
for (String warpName : warps.getWarpNames())
|
||||
{
|
||||
if (perWarpPermission)
|
||||
if (ess.getSettings().getPerWarpPermission())
|
||||
{
|
||||
if (user.isAuthorized("essentials.warp." + warpName))
|
||||
{
|
||||
|
@ -52,26 +53,37 @@ public class Commandwarp extends EssentialsCommand
|
|||
user.sendMessage(sb.toString());
|
||||
return;
|
||||
}
|
||||
if (args.length > 0)
|
||||
{
|
||||
User otherUser = null;
|
||||
if (args.length == 2 && user.isAuthorized("essentials.warp.otherplayers"))
|
||||
{
|
||||
otherUser = ess.getUser(server.getPlayer(args[1]));
|
||||
if(otherUser == null)
|
||||
{
|
||||
user.sendMessage("§cPlayer not found");
|
||||
return;
|
||||
}
|
||||
warpUser(otherUser, args[0]);
|
||||
}
|
||||
warpUser(user, args[0]);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
private void warpUser(User user, String name) throws Exception
|
||||
{
|
||||
if (perWarpPermission)
|
||||
if (ess.getSettings().getPerWarpPermission())
|
||||
{
|
||||
if (user.isAuthorized("essentials.warp." + args[0]))
|
||||
if (user.isAuthorized("essentials.warp." + name))
|
||||
{
|
||||
user.charge(this);
|
||||
user.getTeleport().warp(args[0], this.getName());
|
||||
charge(user);
|
||||
user.getTeleport().warp(name, this.getName());
|
||||
return;
|
||||
}
|
||||
user.sendMessage("§cYou do not have Permission to use that warp.");
|
||||
return;
|
||||
}
|
||||
user.charge(this);
|
||||
user.getTeleport().warp(args[0], this.getName());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
user.sendMessage(ex.getMessage());
|
||||
}
|
||||
charge(user);
|
||||
user.getTeleport().warp(name, this.getName());
|
||||
}
|
||||
}
|
|
@ -309,7 +309,7 @@ commands:
|
|||
aliases: [eunlimited]
|
||||
warp:
|
||||
description: List all warps or warp to the specified location.
|
||||
usage: /<command> <warp>
|
||||
usage: /<command> <warp> <player>
|
||||
aliases: [ewarp]
|
||||
weather:
|
||||
description: Setting the weather.
|
||||
|
|
Loading…
Reference in a new issue