mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-04 19:46:27 +00:00
Adding permissions for overwriting exisitng warps
essentials.warp.overwrite.[warpname] will allow overwrting of exsiting warps essentials.warp.overwrite.* for all warps Adding WarpNotFoundException class
This commit is contained in:
parent
267495a406
commit
6cf2bb5cd9
9 changed files with 42 additions and 1 deletions
|
@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
|
|||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Warps;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
|
||||
|
@ -26,7 +27,25 @@ public class Commandsetwarp extends EssentialsCommand
|
|||
}
|
||||
|
||||
final Location loc = user.getLocation();
|
||||
ess.getWarps().setWarp(args[0], loc);
|
||||
final Warps warps = ess.getWarps();
|
||||
Location warpLoc = null;
|
||||
|
||||
try
|
||||
{
|
||||
warpLoc = warps.getWarp(args[0]);
|
||||
}
|
||||
catch (WarpNotFoundException ex)
|
||||
{
|
||||
}
|
||||
|
||||
if (warpLoc == null || user.hasPermission("essentials.warp.overwrite." + args[0]))
|
||||
{
|
||||
warps.setWarp(args[0], loc);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("warpOverwrite"));
|
||||
}
|
||||
user.sendMessage(_("warpSet", args[0]));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package com.earth2me.essentials.commands;
|
||||
|
||||
|
||||
public class WarpNotFoundException extends Exception
|
||||
{
|
||||
public WarpNotFoundException()
|
||||
{
|
||||
super("Warp not found");
|
||||
}
|
||||
|
||||
public WarpNotFoundException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue