mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Denied
This commit is contained in:
parent
e41676544d
commit
46e2b1344e
@ -31,12 +31,12 @@ import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent;
|
|||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.util.BlockManager;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public class Denied extends SubCommand {
|
public class Denied extends SubCommand {
|
||||||
public Denied() {
|
public Denied() {
|
||||||
super(Command.DENIED, "Manage plot helpers", "denied {add|remove} {player}", CommandCategory.ACTIONS, true);
|
super(Command.DENIED, "Manage plot helpers", "denied {add|remove} {player}", CommandCategory.ACTIONS, true);
|
||||||
@ -87,18 +87,17 @@ public class Denied extends SubCommand {
|
|||||||
}
|
}
|
||||||
plot.addDenied(uuid);
|
plot.addDenied(uuid);
|
||||||
DBFunc.setDenied(loc.getWorld(), plot, uuid);
|
DBFunc.setDenied(loc.getWorld(), plot, uuid);
|
||||||
final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true);
|
//FIXME PlayerPlotDeniedEvent
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
|
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Player player = UUIDHandler.uuidWrapper.getPlayer(uuid);
|
final PlotPlayer player = UUIDHandler.getPlayer(uuid);
|
||||||
if (!uuid.equals(DBFunc.everyone) && (player != null) && player.isOnline()) {
|
if (!uuid.equals(DBFunc.everyone) && (player != null) && player.isOnline()) {
|
||||||
final Plot pl = MainUtil.getPlot(loc);
|
final Plot pl = MainUtil.getPlot(loc);
|
||||||
if ((pl != null) && pl.id.equals(plot.id)) {
|
if ((pl != null) && pl.id.equals(plot.id)) {
|
||||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.YOU_BE_DENIED);
|
MainUtil.sendMessage(player, C.YOU_BE_DENIED);
|
||||||
player.teleport(player.getWorld().getSpawnLocation());
|
player.teleport(BlockManager.manager.getSpawn(loc.getWorld()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(plr, C.DENIED_ADDED);
|
MainUtil.sendMessage(plr, C.DENIED_ADDED);
|
||||||
@ -118,8 +117,7 @@ public class Denied extends SubCommand {
|
|||||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||||
plot.removeDenied(uuid);
|
plot.removeDenied(uuid);
|
||||||
DBFunc.removeDenied(loc.getWorld(), plot, uuid);
|
DBFunc.removeDenied(loc.getWorld(), plot, uuid);
|
||||||
final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false);
|
// FIXME PlayerPlotDeniedEvent
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
|
||||||
MainUtil.sendMessage(plr, C.DENIED_REMOVED);
|
MainUtil.sendMessage(plr, C.DENIED_REMOVED);
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(plr, C.DENIED_NEED_ARGUMENT);
|
MainUtil.sendMessage(plr, C.DENIED_NEED_ARGUMENT);
|
||||||
|
@ -29,6 +29,8 @@ public abstract class BlockManager {
|
|||||||
return (int) r;
|
return (int) r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract Location getSpawn(String world);
|
||||||
|
|
||||||
public abstract String[] getSign(Location loc);
|
public abstract String[] getSign(Location loc);
|
||||||
|
|
||||||
public abstract boolean isWorld(String world);
|
public abstract boolean isWorld(String world);
|
||||||
|
@ -210,4 +210,10 @@ public class BukkitUtil extends BlockManager {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location getSpawn(String world) {
|
||||||
|
org.bukkit.Location temp = getWorld(world).getSpawnLocation();
|
||||||
|
return new Location(world, temp.getBlockX(), temp.getBlockY(), temp.getBlockZ());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user