mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-24 12:16:44 +01:00
Various changes
Permissions: - Changed permissions class to an enum - started using some permissions for EventUtil Events: - fixed armor stands being placed outside allowed area - fixed item frames and paintings being placeable outside allowed area - fixed eating and reading being restricted where it shouldn't - Added various new flags for fine tuned protection - Recoded the result of multiple flags to be more logical - recoded player interact event - fixed ender dragon egg teleportation onto other plots - tried centralizing some logic to the EventUtil class PlotAPI: - minor tweaks to the PlotAPI class PlotSquared updater: - removed some debug - testing a bit more Chunk sending: - fixed plot clearing, and related block changes not sending chunk updates to 1.7.10 clients TODO: - verify all works - finish centralizing event system
This commit is contained in:
parent
8ee90263bb
commit
3a1577469b
1
.gitignore
vendored
1
.gitignore
vendored
@ -101,3 +101,4 @@ hs_err_pid*
|
||||
/plotsquared/target
|
||||
*.MF
|
||||
PlotSquared/schematic.zip
|
||||
*.bat
|
@ -1099,6 +1099,7 @@ public class PS {
|
||||
FlagManager.addFlag(new AbstractFlag("disable-physics", new FlagValue.BooleanValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("fly", new FlagValue.BooleanValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("explosion", new FlagValue.BooleanValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("mob-place", new FlagValue.BooleanValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("hostile-interact", new FlagValue.BooleanValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("hostile-attack", new FlagValue.BooleanValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("animal-interact", new FlagValue.BooleanValue()));
|
||||
@ -1106,11 +1107,15 @@ public class PS {
|
||||
FlagManager.addFlag(new AbstractFlag("tamed-interact", new FlagValue.BooleanValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("tamed-attack", new FlagValue.BooleanValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("misc-interact", new FlagValue.BooleanValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("misc-place", new FlagValue.BooleanValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("misc-break", new FlagValue.BooleanValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("hanging-interact", new FlagValue.BooleanValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("hanging-place", new FlagValue.BooleanValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("hanging-break", new FlagValue.BooleanValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("vehicle-use", new FlagValue.BooleanValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("vehicle-place", new FlagValue.BooleanValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("vehicle-break", new FlagValue.BooleanValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("device-interact", new FlagValue.BooleanValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("place", new FlagValue.PlotBlockListValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("break", new FlagValue.PlotBlockListValue()));
|
||||
FlagManager.addFlag(new AbstractFlag("use", new FlagValue.PlotBlockListValue()));
|
||||
|
@ -46,7 +46,7 @@ import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.ClusterManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.bukkit.BukkitSetBlockManager;
|
||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||
@ -247,11 +247,11 @@ import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||
*
|
||||
* @return MainUtil
|
||||
*
|
||||
* @see com.intellectualcrafters.plot.util.Permissions
|
||||
* @see com.intellectualcrafters.plot.util.Perm
|
||||
*/
|
||||
@Deprecated
|
||||
public Permissions getPermissions() {
|
||||
return new Permissions();
|
||||
public Perm[] getPermissions() {
|
||||
return Perm.values();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
public class Add extends SubCommand {
|
||||
@ -53,7 +53,7 @@ public class Add extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
|
||||
return false;
|
||||
}
|
||||
if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.add")) {
|
||||
if (!plot.isOwner(plr.getUUID()) && !Perm.hasPermission(plr, "plots.admin.command.add")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.ClusterManager;
|
||||
import com.intellectualcrafters.plot.util.EconHandler;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
|
||||
public class Auto extends SubCommand {
|
||||
public Auto() {
|
||||
@ -85,7 +85,7 @@ public class Auto extends SubCommand {
|
||||
}
|
||||
}
|
||||
if (args.length > 0) {
|
||||
if (Permissions.hasPermission(plr, "plots.auto.mega")) {
|
||||
if (Perm.hasPermission(plr, "plots.auto.mega")) {
|
||||
try {
|
||||
final String[] split = args[0].split(",");
|
||||
size_x = Integer.parseInt(split[0]);
|
||||
@ -146,7 +146,7 @@ public class Auto extends SubCommand {
|
||||
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
|
||||
return true;
|
||||
}
|
||||
if (!Permissions.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) {
|
||||
if (!Perm.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) {
|
||||
MainUtil.sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
|
||||
return true;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.EconHandler;
|
||||
import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
||||
|
||||
@ -113,7 +113,7 @@ public class Claim extends SubCommand {
|
||||
if (!world.SCHEMATICS.contains(schematic.toLowerCase())) {
|
||||
return sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
|
||||
}
|
||||
if (!Permissions.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) {
|
||||
if (!Perm.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) {
|
||||
return sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.CmdConfirm;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
@ -66,7 +66,7 @@ public class Clear extends SubCommand {
|
||||
PS.log("Plot " + plot.getId().toString() + " cleared.");
|
||||
}
|
||||
};
|
||||
if (Settings.CONFIRM_CLEAR && !(Permissions.hasPermission(plr, "plots.confirm.bypass"))) {
|
||||
if (Settings.CONFIRM_CLEAR && !(Perm.hasPermission(plr, "plots.confirm.bypass"))) {
|
||||
CmdConfirm.addPending(plr, "/plot clear " + id, runnable);
|
||||
}
|
||||
else {
|
||||
@ -110,7 +110,7 @@ public class Clear extends SubCommand {
|
||||
if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {
|
||||
return sendMessage(plr, C.UNLINK_REQUIRED);
|
||||
}
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.isOwner(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.clear")) {
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.isOwner(UUIDHandler.getUUID(plr))) && !Perm.hasPermission(plr, "plots.admin.command.clear")) {
|
||||
return sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
}
|
||||
assert plot != null;
|
||||
@ -133,7 +133,7 @@ public class Clear extends SubCommand {
|
||||
}
|
||||
}
|
||||
};
|
||||
if (Settings.CONFIRM_CLEAR && !(Permissions.hasPermission(plr, "plots.confirm.bypass"))) {
|
||||
if (Settings.CONFIRM_CLEAR && !(Perm.hasPermission(plr, "plots.confirm.bypass"))) {
|
||||
CmdConfirm.addPending(plr, "/plot clear " + plot.id, runnable);
|
||||
}
|
||||
else {
|
||||
|
@ -40,7 +40,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.ClusterManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
public class Cluster extends SubCommand {
|
||||
@ -60,7 +60,7 @@ public class Cluster extends SubCommand {
|
||||
switch (sub) {
|
||||
case "l":
|
||||
case "list": {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.list")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.list")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.list");
|
||||
return false;
|
||||
}
|
||||
@ -87,7 +87,7 @@ public class Cluster extends SubCommand {
|
||||
}
|
||||
case "c":
|
||||
case "create": {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.create")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.create")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.create");
|
||||
return false;
|
||||
}
|
||||
@ -157,7 +157,7 @@ public class Cluster extends SubCommand {
|
||||
case "disband":
|
||||
case "del":
|
||||
case "delete": {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.delete")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.delete")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.delete");
|
||||
return false;
|
||||
}
|
||||
@ -180,7 +180,7 @@ public class Cluster extends SubCommand {
|
||||
}
|
||||
}
|
||||
if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.delete.other")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.delete.other")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.delete.other");
|
||||
return false;
|
||||
}
|
||||
@ -210,7 +210,7 @@ public class Cluster extends SubCommand {
|
||||
}
|
||||
case "res":
|
||||
case "resize": {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.resize")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.resize")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.resize");
|
||||
return false;
|
||||
}
|
||||
@ -232,7 +232,7 @@ public class Cluster extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.resize.other")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.resize.other")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.resize.other");
|
||||
return false;
|
||||
}
|
||||
@ -252,7 +252,7 @@ public class Cluster extends SubCommand {
|
||||
case "reg":
|
||||
case "regenerate":
|
||||
case "regen": {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.delete")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.delete")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.regen");
|
||||
return false;
|
||||
}
|
||||
@ -275,7 +275,7 @@ public class Cluster extends SubCommand {
|
||||
}
|
||||
}
|
||||
if (!cluster.owner.equals(UUIDHandler.getUUID(plr))) {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.regen.other")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.regen.other")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.regen.other");
|
||||
return false;
|
||||
}
|
||||
@ -287,7 +287,7 @@ public class Cluster extends SubCommand {
|
||||
case "add":
|
||||
case "inv":
|
||||
case "invite": {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.invite")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.invite")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.invite");
|
||||
return false;
|
||||
}
|
||||
@ -302,7 +302,7 @@ public class Cluster extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.invite.other")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.invite.other")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.invite.other");
|
||||
return false;
|
||||
}
|
||||
@ -329,7 +329,7 @@ public class Cluster extends SubCommand {
|
||||
case "k":
|
||||
case "remove":
|
||||
case "kick": {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.kick")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.kick")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.kick");
|
||||
return false;
|
||||
}
|
||||
@ -343,7 +343,7 @@ public class Cluster extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.kick.other")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.kick.other")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.kick.other");
|
||||
return false;
|
||||
}
|
||||
@ -381,7 +381,7 @@ public class Cluster extends SubCommand {
|
||||
}
|
||||
case "quit":
|
||||
case "leave": {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.leave")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.leave")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.leave");
|
||||
return false;
|
||||
}
|
||||
@ -431,7 +431,7 @@ public class Cluster extends SubCommand {
|
||||
case "admin":
|
||||
case "helper":
|
||||
case "helpers": {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.helpers")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.helpers")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.helpers");
|
||||
return false;
|
||||
}
|
||||
@ -465,7 +465,7 @@ public class Cluster extends SubCommand {
|
||||
case "spawn":
|
||||
case "home":
|
||||
case "tp": {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.tp")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.tp")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.tp");
|
||||
return false;
|
||||
}
|
||||
@ -480,7 +480,7 @@ public class Cluster extends SubCommand {
|
||||
}
|
||||
final UUID uuid = UUIDHandler.getUUID(plr);
|
||||
if (!cluster.isAdded(uuid)) {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.tp.other")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.tp.other")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.tp.other");
|
||||
return false;
|
||||
}
|
||||
@ -492,7 +492,7 @@ public class Cluster extends SubCommand {
|
||||
case "info":
|
||||
case "show":
|
||||
case "information": {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.info")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.info")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.info");
|
||||
return false;
|
||||
}
|
||||
@ -534,7 +534,7 @@ public class Cluster extends SubCommand {
|
||||
case "sh":
|
||||
case "setspawn":
|
||||
case "sethome": {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.sethome")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.sethome")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.sethome");
|
||||
return false;
|
||||
}
|
||||
@ -548,7 +548,7 @@ public class Cluster extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!cluster.hasHelperRights(UUIDHandler.getUUID(plr))) {
|
||||
if (!Permissions.hasPermission(plr, "plots.cluster.sethome.other")) {
|
||||
if (!Perm.hasPermission(plr, "plots.cluster.sethome.other")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.sethome.other");
|
||||
return false;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
|
||||
/**
|
||||
* Created by Citymonstret on 2014-08-03.
|
||||
@ -47,6 +47,6 @@ public class CommandPermission {
|
||||
* @return true of player has the required permission node
|
||||
*/
|
||||
public boolean hasPermission(final PlotPlayer player) {
|
||||
return Permissions.hasPermission(player, this.permission);
|
||||
return Perm.hasPermission(player, this.permission);
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
|
||||
/**
|
||||
* Created 2014-08-01 for PlotSquared
|
||||
@ -50,7 +50,7 @@ public class Copy extends SubCommand {
|
||||
if (plot1 == null) {
|
||||
return !MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if (!plot1.isAdded(plr.getUUID()) && !plr.hasPermission(Permissions.ADMIN)) {
|
||||
if (!plot1.isAdded(plr.getUUID()) && !plr.hasPermission(Perm.ADMIN.s)) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return false;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
public class DebugClear extends SubCommand {
|
||||
@ -85,7 +85,7 @@ public class DebugClear extends SubCommand {
|
||||
if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {
|
||||
return sendMessage(plr, C.UNLINK_REQUIRED);
|
||||
}
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.isOwner(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.debugclear")) {
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.isOwner(UUIDHandler.getUUID(plr))) && !Perm.hasPermission(plr, "plots.admin.command.debugclear")) {
|
||||
return sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
}
|
||||
assert plot != null;
|
||||
|
@ -26,7 +26,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.SetBlockQueue;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
|
||||
@ -50,7 +50,7 @@ public class DebugFill extends SubCommand {
|
||||
MainUtil.sendMessage(player, C.PLOT_UNOWNED);
|
||||
return false;
|
||||
}
|
||||
if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.fill")) {
|
||||
if (!plot.isOwner(player.getUUID()) && !Perm.hasPermission(player, "plots.admin.command.fill")) {
|
||||
MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.CmdConfirm;
|
||||
import com.intellectualcrafters.plot.util.EconHandler;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
@ -50,7 +50,7 @@ public class Delete extends SubCommand {
|
||||
if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {
|
||||
return !sendMessage(plr, C.UNLINK_REQUIRED);
|
||||
}
|
||||
if ((((plot == null) || !plot.hasOwner() || !plot.isOwner(UUIDHandler.uuidWrapper.getUUID(plr)))) && !Permissions.hasPermission(plr, "plots.admin.command.delete")) {
|
||||
if ((((plot == null) || !plot.hasOwner() || !plot.isOwner(UUIDHandler.uuidWrapper.getUUID(plr)))) && !Perm.hasPermission(plr, "plots.admin.command.delete")) {
|
||||
return !sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
}
|
||||
assert plot != null;
|
||||
@ -83,7 +83,7 @@ public class Delete extends SubCommand {
|
||||
DBFunc.delete(plot);
|
||||
}
|
||||
};
|
||||
if (Settings.CONFIRM_DELETE && !(Permissions.hasPermission(plr, "plots.confirm.bypass"))) {
|
||||
if (Settings.CONFIRM_DELETE && !(Perm.hasPermission(plr, "plots.confirm.bypass"))) {
|
||||
CmdConfirm.addPending(plr, "/plot delete " + plot.id, runnable);
|
||||
}
|
||||
else {
|
||||
|
@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
public class Deny extends SubCommand {
|
||||
@ -53,7 +53,7 @@ public class Deny extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
|
||||
return false;
|
||||
}
|
||||
if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.deny")) {
|
||||
if (!plot.isOwner(plr.getUUID()) && !Perm.hasPermission(plr, "plots.admin.command.deny")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
|
||||
public class FlagCmd extends SubCommand {
|
||||
public FlagCmd() {
|
||||
@ -67,7 +67,7 @@ public class FlagCmd extends SubCommand {
|
||||
sendMessage(player, C.PLOT_NOT_CLAIMED);
|
||||
return false;
|
||||
}
|
||||
if (!plot.isAdded(player.getUUID()) && !Permissions.hasPermission(player, "plots.set.flag.other")) {
|
||||
if (!plot.isAdded(player.getUUID()) && !Perm.hasPermission(player, "plots.set.flag.other")) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag.other");
|
||||
return false;
|
||||
}
|
||||
@ -77,7 +77,7 @@ public class FlagCmd extends SubCommand {
|
||||
}
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "info": {
|
||||
if (!Permissions.hasPermission(player, "plots.set.flag")) {
|
||||
if (!Perm.hasPermission(player, "plots.set.flag")) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.info");
|
||||
return false;
|
||||
}
|
||||
@ -100,7 +100,7 @@ public class FlagCmd extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
case "set": {
|
||||
if (!Permissions.hasPermission(player, "plots.set.flag")) {
|
||||
if (!Perm.hasPermission(player, "plots.set.flag")) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag");
|
||||
return false;
|
||||
}
|
||||
@ -113,7 +113,7 @@ public class FlagCmd extends SubCommand {
|
||||
MainUtil.sendMessage(player, C.NOT_VALID_FLAG);
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
||||
if (!Perm.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||
return false;
|
||||
}
|
||||
@ -134,7 +134,7 @@ public class FlagCmd extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
case "remove": {
|
||||
if (!Permissions.hasPermission(player, "plots.flag.remove")) {
|
||||
if (!Perm.hasPermission(player, "plots.flag.remove")) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.remove");
|
||||
return false;
|
||||
}
|
||||
@ -147,7 +147,7 @@ public class FlagCmd extends SubCommand {
|
||||
MainUtil.sendMessage(player, C.NOT_VALID_FLAG);
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
||||
if (!Perm.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||
return false;
|
||||
}
|
||||
@ -172,7 +172,7 @@ public class FlagCmd extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
case "add": {
|
||||
if (!Permissions.hasPermission(player, "plots.flag.add")) {
|
||||
if (!Perm.hasPermission(player, "plots.flag.add")) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.add");
|
||||
return false;
|
||||
}
|
||||
@ -185,7 +185,7 @@ public class FlagCmd extends SubCommand {
|
||||
MainUtil.sendMessage(player, C.NOT_VALID_FLAG);
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
||||
if (!Perm.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||
return false;
|
||||
}
|
||||
@ -212,7 +212,7 @@ public class FlagCmd extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
case "list": {
|
||||
if (!Permissions.hasPermission(player, "plots.flag.list")) {
|
||||
if (!Perm.hasPermission(player, "plots.flag.list")) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.list");
|
||||
return false;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
@SuppressWarnings({ "unused", "deprecation", "javadoc" })
|
||||
@ -42,7 +42,7 @@ public class Kick extends SubCommand {
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if (plot == null || ((!plot.hasOwner() || !plot.isOwner(plr.getUUID())) && !Permissions.hasPermission(plr, "plots.admin.command.kick"))) {
|
||||
if (plot == null || ((!plot.hasOwner() || !plot.isOwner(plr.getUUID())) && !Perm.hasPermission(plr, "plots.admin.command.kick"))) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return false;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ import com.intellectualcrafters.plot.util.CmdConfirm;
|
||||
import com.intellectualcrafters.plot.util.EconHandler;
|
||||
import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
/**
|
||||
@ -84,7 +84,7 @@ public class Merge extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
|
||||
return false;
|
||||
}
|
||||
final boolean admin = Permissions.hasPermission(plr, "plots.admin.command.merge");
|
||||
final boolean admin = Perm.hasPermission(plr, "plots.admin.command.merge");
|
||||
if (!plot.isOwner(plr.getUUID()) && !admin) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return false;
|
||||
|
@ -28,7 +28,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
|
||||
/**
|
||||
* Created 2014-08-01 for PlotSquared
|
||||
@ -52,7 +52,7 @@ public class Move extends SubCommand {
|
||||
if (plot1 == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if (!plot1.isAdded(plr.getUUID()) && !plr.hasPermission(Permissions.ADMIN)) {
|
||||
if (!plot1.isAdded(plr.getUUID()) && !plr.hasPermission(Perm.ADMIN.s)) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return false;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
public class Remove extends SubCommand {
|
||||
@ -52,7 +52,7 @@ public class Remove extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
|
||||
return false;
|
||||
}
|
||||
if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.remove")) {
|
||||
if (!plot.isOwner(plr.getUUID()) && !Perm.hasPermission(plr, "plots.admin.command.remove")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler.DataCollection;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
|
||||
@ -65,7 +65,7 @@ public class SchematicCmd extends SubCommand {
|
||||
PS.log(C.IS_CONSOLE.s());
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(plr, "plots.schematic.paste")) {
|
||||
if (!Perm.hasPermission(plr, "plots.schematic.paste")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.paste");
|
||||
return false;
|
||||
}
|
||||
@ -162,7 +162,7 @@ public class SchematicCmd extends SubCommand {
|
||||
PS.log(C.IS_CONSOLE.s());
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(plr, "plots.schematic.test")) {
|
||||
if (!Perm.hasPermission(plr, "plots.schematic.test")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.test");
|
||||
return false;
|
||||
}
|
||||
@ -226,7 +226,7 @@ public class SchematicCmd extends SubCommand {
|
||||
}
|
||||
case "export":
|
||||
case "save": {
|
||||
if (!Permissions.hasPermission(plr, "plots.schematic.save")) {
|
||||
if (!Perm.hasPermission(plr, "plots.schematic.save")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.save");
|
||||
return false;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||
import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.SetBlockQueue;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
@ -71,7 +71,7 @@ public class Set extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!plot.isAdded(plr.getUUID())) {
|
||||
if (!Permissions.hasPermission(plr, "plots.set.other")) {
|
||||
if (!Perm.hasPermission(plr, "plots.set.other")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set.other");
|
||||
return false;
|
||||
}
|
||||
@ -106,7 +106,7 @@ public class Set extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.NOT_VALID_FLAG);
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(plr, "plots.set.flag." + args[1].toLowerCase())) {
|
||||
if (!Perm.hasPermission(plr, "plots.set.flag." + args[1].toLowerCase())) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||
return false;
|
||||
}
|
||||
@ -146,7 +146,7 @@ public class Set extends SubCommand {
|
||||
}
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("home")) {
|
||||
if (!Permissions.hasPermission(plr, "plots.set.home")) {
|
||||
if (!Perm.hasPermission(plr, "plots.set.home")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set.home");
|
||||
return false;
|
||||
}
|
||||
@ -167,7 +167,7 @@ public class Set extends SubCommand {
|
||||
return MainUtil.sendMessage(plr, C.POSITION_SET);
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("alias")) {
|
||||
if (!Permissions.hasPermission(plr, "plots.set.alias")) {
|
||||
if (!Perm.hasPermission(plr, "plots.set.alias")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set.alias");
|
||||
return false;
|
||||
}
|
||||
@ -195,7 +195,7 @@ public class Set extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("biome")) {
|
||||
if (!Permissions.hasPermission(plr, "plots.set.biome")) {
|
||||
if (!Perm.hasPermission(plr, "plots.set.biome")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set.biome");
|
||||
return false;
|
||||
}
|
||||
@ -231,7 +231,7 @@ public class Set extends SubCommand {
|
||||
final String[] components = manager.getPlotComponents(plotworld, plot.id);
|
||||
for (final String component : components) {
|
||||
if (component.equalsIgnoreCase(args[0])) {
|
||||
if (!Permissions.hasPermission(plr, "plots.set." + component)) {
|
||||
if (!Perm.hasPermission(plr, "plots.set." + component)) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set." + component);
|
||||
}
|
||||
PlotBlock[] blocks;
|
||||
|
@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
public class SetOwner extends SubCommand {
|
||||
@ -68,13 +68,13 @@ public class SetOwner extends SubCommand {
|
||||
|
||||
PlotPlayer other = UUIDHandler.getPlayer(args[0]);
|
||||
if (other == null) {
|
||||
if (!Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
|
||||
if (!Perm.hasPermission(plr, "plots.admin.command.setowner")) {
|
||||
MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
|
||||
if (!Perm.hasPermission(plr, "plots.admin.command.setowner")) {
|
||||
int size = plots.size();
|
||||
final int currentPlots = (Settings.GLOBAL_LIMIT ? MainUtil.getPlayerPlotCount(other) : MainUtil.getPlayerPlotCount(loc.getWorld(), other)) + size;
|
||||
if (currentPlots > MainUtil.getAllowedPlots(other)) {
|
||||
@ -85,7 +85,7 @@ public class SetOwner extends SubCommand {
|
||||
}
|
||||
|
||||
if (!plot.isOwner(plr.getUUID())) {
|
||||
if (!Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
|
||||
if (!Perm.hasPermission(plr, "plots.admin.command.setowner")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command.setowner");
|
||||
return false;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.ClusterManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
|
||||
/**
|
||||
* Created 2014-08-01 for PlotSquared
|
||||
@ -57,7 +57,7 @@ public class Swap extends SubCommand {
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.isOwner(plr.getUUID())) && !Permissions.hasPermission(plr, "plots.admin.command.swap")) {
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.isOwner(plr.getUUID())) && !Perm.hasPermission(plr, "plots.admin.command.swap")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return false;
|
||||
}
|
||||
|
@ -131,13 +131,9 @@ public class Trim extends SubCommand {
|
||||
plots.remove(0);
|
||||
final Location pos1 = MainUtil.getPlotBottomLoc(world, plot.id);
|
||||
final Location pos2 = MainUtil.getPlotTopLoc(world, plot.id);
|
||||
System.out.print(plot);
|
||||
System.out.print(pos1);
|
||||
System.out.print(pos2);
|
||||
for (int x = pos1.getX(); x <= pos2.getX(); x += 512 ) {
|
||||
for (int z = pos1.getZ(); z <= pos2.getZ(); z += 512 ) {
|
||||
ChunkLoc chunk = ChunkManager.getChunkChunk(new Location(world, x, 0, z));
|
||||
System.out.print(chunk.x + "," + chunk.z);
|
||||
chunks.remove(chunk);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
public class Trust extends SubCommand {
|
||||
@ -53,7 +53,7 @@ public class Trust extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
|
||||
return false;
|
||||
}
|
||||
if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.trust")) {
|
||||
if (!plot.isOwner(plr.getUUID()) && !Perm.hasPermission(plr, "plots.admin.command.trust")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.EconHandler;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
|
||||
public class Unclaim extends SubCommand {
|
||||
public Unclaim() {
|
||||
@ -45,7 +45,7 @@ public class Unclaim extends SubCommand {
|
||||
if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {
|
||||
return !sendMessage(plr, C.UNLINK_REQUIRED);
|
||||
}
|
||||
if ((((plot == null) || !plot.hasOwner() || !plot.isOwner(plr.getUUID()))) && !Permissions.hasPermission(plr, "plots.admin.command.unclaim")) {
|
||||
if ((((plot == null) || !plot.hasOwner() || !plot.isOwner(plr.getUUID()))) && !Perm.hasPermission(plr, "plots.admin.command.unclaim")) {
|
||||
return !sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
}
|
||||
assert plot != null;
|
||||
|
@ -28,7 +28,7 @@ import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
public class Undeny extends SubCommand {
|
||||
@ -51,7 +51,7 @@ public class Undeny extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
|
||||
return false;
|
||||
}
|
||||
if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.undeny")) {
|
||||
if (!plot.isOwner(plr.getUUID()) && !Perm.hasPermission(plr, "plots.admin.command.undeny")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.CmdConfirm;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
|
||||
/**
|
||||
@ -47,7 +47,7 @@ public class Unlink extends SubCommand {
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.isOwner(plr.getUUID())) && !Permissions.hasPermission(plr, "plots.admin.command.unlink")) {
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.isOwner(plr.getUUID())) && !Perm.hasPermission(plr, "plots.admin.command.unlink")) {
|
||||
return sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
}
|
||||
if (MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {
|
||||
@ -64,7 +64,7 @@ public class Unlink extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.UNLINK_SUCCESS);
|
||||
}
|
||||
};
|
||||
if (Settings.CONFIRM_UNLINK && !(Permissions.hasPermission(plr, "plots.confirm.bypass"))) {
|
||||
if (Settings.CONFIRM_UNLINK && !(Perm.hasPermission(plr, "plots.confirm.bypass"))) {
|
||||
CmdConfirm.addPending(plr, "/plot unlink " + plot.id, runnable);
|
||||
}
|
||||
else {
|
||||
|
@ -28,7 +28,7 @@ import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
public class Untrust extends SubCommand {
|
||||
@ -51,7 +51,7 @@ public class Untrust extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
|
||||
return false;
|
||||
}
|
||||
if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.untrust")) {
|
||||
if (!plot.isOwner(plr.getUUID()) && !Perm.hasPermission(plr, "plots.admin.command.untrust")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
public class Visit extends SubCommand {
|
||||
@ -91,25 +91,25 @@ public class Visit extends SubCommand {
|
||||
|
||||
Plot plot = plots.get(index);
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(plr, "plots.visit.unowned")) {
|
||||
if (!Perm.hasPermission(plr, "plots.visit.unowned")) {
|
||||
sendMessage(plr, C.NO_PERMISSION, "plots.visit.unowned");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (plot.isOwner(plr.getUUID())) {
|
||||
if (!Permissions.hasPermission(plr, "plots.visit.owned") && !Permissions.hasPermission(plr, "plots.home")) {
|
||||
if (!Perm.hasPermission(plr, "plots.visit.owned") && !Perm.hasPermission(plr, "plots.home")) {
|
||||
sendMessage(plr, C.NO_PERMISSION, "plots.visit.owned, plots.home");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (plot.isAdded(plr.getUUID())) {
|
||||
if (!Permissions.hasPermission(plr, "plots.visit.shared")) {
|
||||
if (!Perm.hasPermission(plr, "plots.visit.shared")) {
|
||||
sendMessage(plr, C.NO_PERMISSION, "plots.visit.shared");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!Permissions.hasPermission(plr, "plots.visit.other")) {
|
||||
if (!Perm.hasPermission(plr, "plots.visit.other")) {
|
||||
sendMessage(plr, C.NO_PERMISSION, "plots.visit.other");
|
||||
return false;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.listeners.worldedit.WEManager;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
|
||||
public class WE_Anywhere extends SubCommand {
|
||||
public WE_Anywhere() {
|
||||
@ -38,7 +38,7 @@ public class WE_Anywhere extends SubCommand {
|
||||
MainUtil.sendMessage(plr, "&cWorldEdit is not enabled on this server");
|
||||
return false;
|
||||
}
|
||||
if (Permissions.hasPermission(plr, "plots.worldedit.bypass")) {
|
||||
if (Perm.hasPermission(plr, "plots.worldedit.bypass")) {
|
||||
if (WEManager.bypass.contains(plr.getName())) {
|
||||
WEManager.bypass.remove(plr.getName());
|
||||
MainUtil.sendMessage(plr, C.WORLDEDIT_RESTRICTED);
|
||||
|
@ -41,7 +41,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.EconHandler;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.util.bukkit.chat.FancyMessage;
|
||||
@ -122,7 +122,7 @@ public class list extends SubCommand {
|
||||
if (plr == null) {
|
||||
break;
|
||||
}
|
||||
if (!Permissions.hasPermission(plr, "plots.list.mine")) {
|
||||
if (!Perm.hasPermission(plr, "plots.list.mine")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.mine");
|
||||
return false;
|
||||
}
|
||||
@ -133,7 +133,7 @@ public class list extends SubCommand {
|
||||
if (plr == null) {
|
||||
break;
|
||||
}
|
||||
if (!Permissions.hasPermission(plr, "plots.list.shared")) {
|
||||
if (!Perm.hasPermission(plr, "plots.list.shared")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.shared");
|
||||
return false;
|
||||
}
|
||||
@ -146,11 +146,11 @@ public class list extends SubCommand {
|
||||
break;
|
||||
}
|
||||
case "world": {
|
||||
if (!Permissions.hasPermission(plr, "plots.list.world")) {
|
||||
if (!Perm.hasPermission(plr, "plots.list.world")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world");
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(plr, "plots.list.world." + world)) {
|
||||
if (!Perm.hasPermission(plr, "plots.list.world." + world)) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world." + world);
|
||||
return false;
|
||||
}
|
||||
@ -158,7 +158,7 @@ public class list extends SubCommand {
|
||||
break;
|
||||
}
|
||||
case "all": {
|
||||
if (!Permissions.hasPermission(plr, "plots.list.all")) {
|
||||
if (!Perm.hasPermission(plr, "plots.list.all")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.all");
|
||||
return false;
|
||||
}
|
||||
@ -166,7 +166,7 @@ public class list extends SubCommand {
|
||||
break;
|
||||
}
|
||||
case "top": {
|
||||
if (!Permissions.hasPermission(plr, "plots.list.top")) {
|
||||
if (!Perm.hasPermission(plr, "plots.list.top")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.top");
|
||||
return false;
|
||||
}
|
||||
@ -200,7 +200,7 @@ public class list extends SubCommand {
|
||||
break;
|
||||
}
|
||||
case "forsale": {
|
||||
if (!Permissions.hasPermission(plr, "plots.list.forsale")) {
|
||||
if (!Perm.hasPermission(plr, "plots.list.forsale")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.forsale");
|
||||
return false;
|
||||
}
|
||||
@ -217,7 +217,7 @@ public class list extends SubCommand {
|
||||
break;
|
||||
}
|
||||
case "unowned": {
|
||||
if (!Permissions.hasPermission(plr, "plots.list.unowned")) {
|
||||
if (!Perm.hasPermission(plr, "plots.list.unowned")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.unowned");
|
||||
return false;
|
||||
}
|
||||
@ -230,7 +230,7 @@ public class list extends SubCommand {
|
||||
break;
|
||||
}
|
||||
case "unknown": {
|
||||
if (!Permissions.hasPermission(plr, "plots.list.unknown")) {
|
||||
if (!Perm.hasPermission(plr, "plots.list.unknown")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.unknown");
|
||||
return false;
|
||||
}
|
||||
@ -247,11 +247,11 @@ public class list extends SubCommand {
|
||||
}
|
||||
default: {
|
||||
if (PS.get().isPlotWorld(args[0])) {
|
||||
if (!Permissions.hasPermission(plr, "plots.list.world")) {
|
||||
if (!Perm.hasPermission(plr, "plots.list.world")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world");
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(plr, "plots.list.world." + args[0])) {
|
||||
if (!Perm.hasPermission(plr, "plots.list.world." + args[0])) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world." + args[0]);
|
||||
return false;
|
||||
}
|
||||
@ -260,7 +260,7 @@ public class list extends SubCommand {
|
||||
}
|
||||
UUID uuid = UUIDHandler.getUUID(args[0]);
|
||||
if (uuid != null) {
|
||||
if (!Permissions.hasPermission(plr, "plots.list.player")) {
|
||||
if (!Perm.hasPermission(plr, "plots.list.player")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.player");
|
||||
return false;
|
||||
}
|
||||
|
@ -196,12 +196,9 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
|
||||
@Override
|
||||
public boolean accepts(String version) {
|
||||
System.out.print("CHECKING VERSION");
|
||||
if (version == null) {
|
||||
System.out.print("VERSION IS NULL");
|
||||
return true;
|
||||
}
|
||||
System.out.print("VERSION IS: " + version);
|
||||
return PS.get().canUpdate(version, "0.17.0");
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ public class LikePlotMeConverter {
|
||||
return false;
|
||||
}
|
||||
|
||||
System.out.print("CONNECTOR ACCEPTS VERSION");
|
||||
PS.log("&3Using connector: " + connector.getClass().getCanonicalName());
|
||||
|
||||
Connection connection = connector.getPlotMeConnection(plugin, plotConfig, dataFolder);
|
||||
|
||||
|
@ -156,6 +156,9 @@ public class FlagManager {
|
||||
}
|
||||
|
||||
public static boolean isPlotFlagTrue(final Plot plot, final String strFlag) {
|
||||
if (plot.owner == null) {
|
||||
return false;
|
||||
}
|
||||
final Flag flag = getPlotFlag(plot, strFlag);
|
||||
if (flag == null) {
|
||||
return false;
|
||||
@ -167,6 +170,9 @@ public class FlagManager {
|
||||
}
|
||||
|
||||
public static boolean isPlotFlagFalse(final Plot plot, final String strFlag) {
|
||||
if (plot.owner == null) {
|
||||
return false;
|
||||
}
|
||||
final Flag flag = getPlotFlag(plot, strFlag);
|
||||
if (flag == null) {
|
||||
return false;
|
||||
|
@ -0,0 +1,42 @@
|
||||
package com.intellectualcrafters.plot.listeners;
|
||||
|
||||
public enum PlayerBlockEventType {
|
||||
// Non interactive
|
||||
EAT,
|
||||
READ,
|
||||
|
||||
// Right click with monster egg
|
||||
SPAWN_MOB,
|
||||
|
||||
// Dragon egg
|
||||
TELEPORT_OBJECT,
|
||||
|
||||
// armor stands
|
||||
PLACE_MISC,
|
||||
// blocks
|
||||
PLACE_BLOCK,
|
||||
// paintings / item frames
|
||||
PLACE_HANGING,
|
||||
// vehicles
|
||||
PLACE_VEHICLE,
|
||||
|
||||
// armor stands
|
||||
BREAK_MISC,
|
||||
// blocks
|
||||
BREAK_BLOCK,
|
||||
// paintings / item frames
|
||||
BREAK_HANGING,
|
||||
BREAK_VEHICLE,
|
||||
|
||||
// armor stands
|
||||
INTERACT_MISC,
|
||||
// blocks
|
||||
INTERACT_BLOCK,
|
||||
// vehicle
|
||||
INTERACT_VEHICLE,
|
||||
// item frame / painting
|
||||
INTERACT_HANGING,
|
||||
|
||||
// Pressure plate, tripwire etc
|
||||
TRIGGER_PHYSICAL,
|
||||
}
|
@ -72,10 +72,12 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerUnleashEntityEvent;
|
||||
import org.bukkit.event.vehicle.VehicleCreateEvent;
|
||||
import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
import org.bukkit.event.world.StructureGrowEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
@ -89,6 +91,7 @@ import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.listeners.worldedit.WEManager;
|
||||
import com.intellectualcrafters.plot.object.BukkitLazyBlock;
|
||||
import com.intellectualcrafters.plot.object.BukkitPlayer;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
@ -103,7 +106,7 @@ import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
@ -330,7 +333,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
UUIDHandler.add(name, uuid);
|
||||
ExpireManager.dates.put(uuid, System.currentTimeMillis());
|
||||
if (PS.get().worldEdit != null) {
|
||||
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
if (Perm.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
WEManager.bypass.add(pp.getName());
|
||||
}
|
||||
}
|
||||
@ -388,7 +391,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (plot.denied.size() > 0) {
|
||||
if (plot.isDenied(pp.getUUID())) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.entry.denied")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.entry.denied")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.entry.denied");
|
||||
if (!plot.equals(MainUtil.getPlot(BukkitUtil.getLocation(event.getFrom())))) {
|
||||
player.teleport(event.getFrom());
|
||||
@ -461,7 +464,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (Permissions.hasPermission(pp, "plots.admin.destroy.unowned")) {
|
||||
if (Perm.hasPermission(pp, "plots.admin.destroy.unowned")) {
|
||||
return;
|
||||
}
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.destroy.unowned");
|
||||
@ -475,7 +478,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if ((destroy != null) && ((HashSet<PlotBlock>) destroy.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) {
|
||||
return;
|
||||
}
|
||||
if (Permissions.hasPermission(pp, "plots.admin.destroy.other")) {
|
||||
if (Perm.hasPermission(pp, "plots.admin.destroy.other")) {
|
||||
return;
|
||||
}
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.destroy.other");
|
||||
@ -485,7 +488,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
return;
|
||||
}
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (Permissions.hasPermission(pp, "plots.admin.destroy.road")) {
|
||||
if (Perm.hasPermission(pp, "plots.admin.destroy.road")) {
|
||||
return;
|
||||
}
|
||||
if (MainUtil.isPlotArea(loc)) {
|
||||
@ -532,7 +535,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
public void onWorldChanged(final PlayerChangedWorldEvent event) {
|
||||
final PlotPlayer player = BukkitUtil.getPlayer(event.getPlayer());
|
||||
if (PS.get().worldEdit != null) {
|
||||
if (!Permissions.hasPermission(player, "plots.worldedit.bypass")) {
|
||||
if (!Perm.hasPermission(player, "plots.worldedit.bypass")) {
|
||||
WEManager.bypass.remove(player.getName());
|
||||
}
|
||||
else {
|
||||
@ -563,7 +566,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (plot == null) {
|
||||
if (MainUtil.isPlotAreaAbs(loc)) {
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.build.road")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.build.road")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -572,7 +575,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
} else {
|
||||
if (!plot.hasOwner()) {
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.build.unowned")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.build.unowned")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -580,7 +583,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
} else {
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!plot.isAdded(pp.getUUID())) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.build.other")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.build.other")) {
|
||||
if (MainUtil.isPlotArea(loc)) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.other");
|
||||
event.setCancelled(true);
|
||||
@ -652,7 +655,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (Permissions.hasPermission(pp, "plots.admin.destroy.unowned")) {
|
||||
if (Perm.hasPermission(pp, "plots.admin.destroy.unowned")) {
|
||||
return;
|
||||
}
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.destroy.unowned");
|
||||
@ -666,7 +669,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if ((destroy != null) && ((HashSet<PlotBlock>) destroy.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) {
|
||||
return;
|
||||
}
|
||||
if (Permissions.hasPermission(pp, "plots.admin.destroy.other")) {
|
||||
if (Perm.hasPermission(pp, "plots.admin.destroy.other")) {
|
||||
return;
|
||||
}
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.destroy.other");
|
||||
@ -676,7 +679,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
return;
|
||||
}
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (Permissions.hasPermission(pp, "plots.admin.destroy.road")) {
|
||||
if (Perm.hasPermission(pp, "plots.admin.destroy.road")) {
|
||||
return;
|
||||
}
|
||||
if (MainUtil.isPlotArea(loc)) {
|
||||
@ -833,65 +836,176 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (block == null) {
|
||||
return;
|
||||
}
|
||||
Material type = block.getType();
|
||||
|
||||
if (action == Action.RIGHT_CLICK_BLOCK && type.isSolid() && type.isBlock() && type.isOccluding() && !type.isBurnable()) {
|
||||
BlockState state = block.getState();
|
||||
if (state.getData().getClass().equals(MaterialData.class)) {
|
||||
Class<? extends BlockState> clazz = state.getClass();
|
||||
if (clazz.getSimpleName().equals("CraftBlockState")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
final Player player = event.getPlayer();
|
||||
final String world = player.getWorld().getName();
|
||||
if (!PS.get().isPlotWorld(world)) {
|
||||
return;
|
||||
}
|
||||
final Location loc = BukkitUtil.getLocation(event.getClickedBlock().getLocation());
|
||||
Location loc = BukkitUtil.getLocation(block.getLocation());
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
|
||||
Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot != null) {
|
||||
if (!plot.hasOwner()) {
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
|
||||
return;
|
||||
PlayerBlockEventType eventType = null;
|
||||
|
||||
|
||||
BukkitLazyBlock lb;
|
||||
|
||||
switch (action) {
|
||||
case PHYSICAL: {
|
||||
eventType = PlayerBlockEventType.TRIGGER_PHYSICAL;
|
||||
lb = new BukkitLazyBlock(block);
|
||||
break;
|
||||
}
|
||||
if (action != Action.PHYSICAL && action != Action.LEFT_CLICK_BLOCK) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.unowned");
|
||||
case RIGHT_CLICK_BLOCK: {
|
||||
Material blockType = block.getType();
|
||||
int blockId = blockType.getId();
|
||||
switch (blockType) {
|
||||
case ANVIL:
|
||||
case ACACIA_DOOR:
|
||||
case BIRCH_DOOR:
|
||||
case DARK_OAK_DOOR:
|
||||
case IRON_DOOR:
|
||||
case JUNGLE_DOOR:
|
||||
case SPRUCE_DOOR:
|
||||
case TRAP_DOOR:
|
||||
case IRON_TRAPDOOR:
|
||||
case WOOD_DOOR:
|
||||
case WOODEN_DOOR:
|
||||
case TRAPPED_CHEST:
|
||||
case ENDER_CHEST:
|
||||
case CHEST:
|
||||
case ACACIA_FENCE_GATE:
|
||||
case BIRCH_FENCE_GATE:
|
||||
case DARK_OAK_FENCE_GATE:
|
||||
case FENCE_GATE:
|
||||
case JUNGLE_FENCE_GATE:
|
||||
case SPRUCE_FENCE_GATE:
|
||||
case LEVER:
|
||||
case DIODE:
|
||||
case DIODE_BLOCK_OFF:
|
||||
case DIODE_BLOCK_ON:
|
||||
case COMMAND:
|
||||
case REDSTONE_COMPARATOR:
|
||||
case REDSTONE_COMPARATOR_OFF:
|
||||
case REDSTONE_COMPARATOR_ON:
|
||||
case REDSTONE_ORE:
|
||||
case WOOD_BUTTON:
|
||||
case STONE_BUTTON:
|
||||
case BEACON:
|
||||
case BED_BLOCK:
|
||||
case SIGN:
|
||||
case SIGN_POST:
|
||||
case ENCHANTMENT_TABLE:
|
||||
case BREWING_STAND:
|
||||
case STANDING_BANNER:
|
||||
case BURNING_FURNACE:
|
||||
case FURNACE:
|
||||
case CAKE_BLOCK:
|
||||
case DISPENSER:
|
||||
case DROPPER:
|
||||
case HOPPER:
|
||||
case NOTE_BLOCK:
|
||||
case JUKEBOX:
|
||||
case WORKBENCH: {
|
||||
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
||||
break;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
case DRAGON_EGG: {
|
||||
eventType = PlayerBlockEventType.TELEPORT_OBJECT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
lb = new BukkitLazyBlock(blockId, block);
|
||||
ItemStack hand = player.getItemInHand();
|
||||
if (eventType != null && !player.isSneaking()) {
|
||||
break;
|
||||
}
|
||||
if (hand == null) {
|
||||
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
||||
lb = new BukkitLazyBlock(block);
|
||||
break;
|
||||
}
|
||||
|
||||
final Flag use = FlagManager.getPlotFlag(plot, "use");
|
||||
if ((use != null) && ((HashSet<PlotBlock>) use.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) {
|
||||
// TODO calls both:
|
||||
// redstone ore
|
||||
|
||||
lb = new BukkitLazyBlock(new PlotBlock((short) hand.getTypeId(), (byte) hand.getDurability()));
|
||||
switch (hand.getType()) {
|
||||
case MONSTER_EGG:
|
||||
case MONSTER_EGGS: {
|
||||
eventType = PlayerBlockEventType.SPAWN_MOB;
|
||||
break;
|
||||
}
|
||||
|
||||
case WRITTEN_BOOK:
|
||||
case BOOK_AND_QUILL:
|
||||
case BOOK: {
|
||||
eventType = PlayerBlockEventType.READ;
|
||||
break;
|
||||
}
|
||||
|
||||
case APPLE:
|
||||
case BAKED_POTATO:
|
||||
case MUSHROOM_SOUP:
|
||||
case BREAD:
|
||||
case CARROT:
|
||||
case CARROT_ITEM:
|
||||
case COOKIE:
|
||||
case GRILLED_PORK:
|
||||
case POISONOUS_POTATO:
|
||||
case MUTTON:
|
||||
case PORK:
|
||||
case POTATO:
|
||||
case POTATO_ITEM:
|
||||
case POTION:
|
||||
case PUMPKIN_PIE:
|
||||
case RABBIT:
|
||||
case RABBIT_FOOT:
|
||||
case RABBIT_STEW:
|
||||
case RAW_BEEF:
|
||||
case RAW_FISH:
|
||||
case RAW_CHICKEN: {
|
||||
eventType = PlayerBlockEventType.EAT;
|
||||
break;
|
||||
}
|
||||
|
||||
case MINECART :
|
||||
case STORAGE_MINECART :
|
||||
case POWERED_MINECART :
|
||||
case HOPPER_MINECART :
|
||||
case EXPLOSIVE_MINECART:
|
||||
case COMMAND_MINECART:
|
||||
case BOAT: {
|
||||
eventType = PlayerBlockEventType.PLACE_VEHICLE;
|
||||
break;
|
||||
}
|
||||
case PAINTING:
|
||||
case ITEM_FRAME: {
|
||||
eventType = PlayerBlockEventType.PLACE_HANGING;
|
||||
break;
|
||||
}
|
||||
|
||||
case ARMOR_STAND: {
|
||||
eventType = PlayerBlockEventType.PLACE_MISC;
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LEFT_CLICK_BLOCK: {
|
||||
eventType = PlayerBlockEventType.BREAK_BLOCK;
|
||||
lb = new BukkitLazyBlock(block);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
return;
|
||||
}
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (!plot.isAdded(pp.getUUID())) {
|
||||
if (Permissions.hasPermission(pp, "plots.admin.interact.other")) {
|
||||
return;
|
||||
}
|
||||
if (action != Action.PHYSICAL && action != Action.LEFT_CLICK_BLOCK) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.other");
|
||||
}
|
||||
if (!EventUtil.manager.checkPlayerBlockEvent(pp, eventType, loc, lb, true)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (Permissions.hasPermission(pp, "plots.admin.interact.road")) {
|
||||
return;
|
||||
}
|
||||
if (MainUtil.isPlotArea(loc)) {
|
||||
if (action != Action.PHYSICAL && action != Action.LEFT_CLICK_BLOCK) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.road");
|
||||
}
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1052,7 +1166,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (plot == null) {
|
||||
if (MainUtil.isPlotAreaAbs(loc)) {
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.build.road")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.build.road")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
@ -1061,7 +1175,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
} else {
|
||||
if (!plot.hasOwner()) {
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.build.unowned")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.build.unowned")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
@ -1069,7 +1183,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
} else {
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!plot.isAdded(pp.getUUID())) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.build.other")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.build.other")) {
|
||||
if (MainUtil.isPlotArea(loc)) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.other");
|
||||
e.setCancelled(true);
|
||||
@ -1095,7 +1209,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (plot != null) {
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
if (plot.isDenied(pp.getUUID())) {
|
||||
if (Permissions.hasPermission(pp, "plots.admin.enter.denied")) {
|
||||
if (Perm.hasPermission(pp, "plots.admin.enter.denied")) {
|
||||
return;
|
||||
}
|
||||
MainUtil.sendMessage(pp, C.YOU_BE_DENIED);
|
||||
@ -1129,7 +1243,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
if (MainUtil.isPlotAreaAbs(loc)) {
|
||||
if (Permissions.hasPermission(pp, "plots.admin.build.road")) {
|
||||
if (Perm.hasPermission(pp, "plots.admin.build.road")) {
|
||||
return;
|
||||
}
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road");
|
||||
@ -1138,7 +1252,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
}
|
||||
} else {
|
||||
if (!plot.hasOwner()) {
|
||||
if (Permissions.hasPermission(pp, "plots.admin.build.unowned")) {
|
||||
if (Perm.hasPermission(pp, "plots.admin.build.unowned")) {
|
||||
return;
|
||||
}
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned");
|
||||
@ -1149,7 +1263,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if ((use != null) && ((HashSet<PlotBlock>) use.getValue()).contains(new PlotBlock((short) e.getBucket().getId(), (byte) 0))) {
|
||||
return;
|
||||
}
|
||||
if (Permissions.hasPermission(pp, "plots.admin.build.other")) {
|
||||
if (Perm.hasPermission(pp, "plots.admin.build.other")) {
|
||||
return;
|
||||
}
|
||||
if (MainUtil.isPlotArea(loc)) {
|
||||
@ -1217,7 +1331,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
if (MainUtil.isPlotAreaAbs(loc)) {
|
||||
if (Permissions.hasPermission(pp, "plots.admin.build.road")) {
|
||||
if (Perm.hasPermission(pp, "plots.admin.build.road")) {
|
||||
return;
|
||||
}
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road");
|
||||
@ -1226,7 +1340,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
}
|
||||
} else {
|
||||
if (!plot.hasOwner()) {
|
||||
if (Permissions.hasPermission(pp, "plots.admin.build.unowned")) {
|
||||
if (Perm.hasPermission(pp, "plots.admin.build.unowned")) {
|
||||
return;
|
||||
}
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned");
|
||||
@ -1238,7 +1352,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if ((use != null) && ((HashSet<PlotBlock>) use.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) {
|
||||
return;
|
||||
}
|
||||
if (Permissions.hasPermission(pp, "plots.admin.build.other")) {
|
||||
if (Perm.hasPermission(pp, "plots.admin.build.other")) {
|
||||
return;
|
||||
}
|
||||
if (MainUtil.isPlotArea(loc)) {
|
||||
@ -1251,6 +1365,16 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onVehicleCreate(final VehicleCreateEvent event) {
|
||||
Vehicle entity = event.getVehicle();
|
||||
Location loc = BukkitUtil.getLocation(entity);
|
||||
Plot plot = MainUtil.getPlot(loc);
|
||||
if (checkEntity(entity, plot)) {
|
||||
entity.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onHangingPlace(final HangingPlaceEvent e) {
|
||||
final Block b = e.getBlock();
|
||||
@ -1261,7 +1385,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
if (MainUtil.isPlotAreaAbs(loc)) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.build.road")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.build.road")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
@ -1269,7 +1393,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
}
|
||||
} else {
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.build.unowned")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.build.unowned")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
@ -1278,7 +1402,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (FlagManager.isPlotFlagTrue(plot, "hanging-place")) {
|
||||
return;
|
||||
}
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.build.other")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.build.other")) {
|
||||
if (MainUtil.isPlotArea(loc)) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.other");
|
||||
e.setCancelled(true);
|
||||
@ -1301,7 +1425,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
Plot plot = MainUtil.getPlot(l);
|
||||
if (plot == null) {
|
||||
if (MainUtil.isPlotAreaAbs(l)) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.destroy.road")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.destroy.road")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.destroy.road");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
@ -1309,7 +1433,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
}
|
||||
} else {
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.destroy.unowned")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.destroy.unowned")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.destroy.unowned");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
@ -1318,7 +1442,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (FlagManager.isPlotFlagTrue(plot, "hanging-break")) {
|
||||
return;
|
||||
}
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.destroy.other")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.destroy.other")) {
|
||||
if (MainUtil.isPlotArea(l)) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.destroy.other");
|
||||
e.setCancelled(true);
|
||||
@ -1342,14 +1466,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (!MainUtil.isPlotAreaAbs(l)) {
|
||||
return;
|
||||
}
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.interact.road")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.road");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.interact.unowned")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.unowned");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
@ -1368,7 +1492,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if ((entity instanceof RideableMinecart) && FlagManager.isPlotFlagTrue(plot, "vehicle-use")) {
|
||||
return;
|
||||
}
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.interact.other")) {
|
||||
if (MainUtil.isPlotArea(l)) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.other");
|
||||
e.setCancelled(true);
|
||||
@ -1380,16 +1504,6 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onVehicleCreate(final VehicleCreateEvent event) {
|
||||
Vehicle entity = event.getVehicle();
|
||||
Location loc = BukkitUtil.getLocation(entity);
|
||||
Plot plot = MainUtil.getPlot(loc);
|
||||
if (checkEntity(entity, plot)) {
|
||||
entity.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onVehicleDestroy(final VehicleDestroyEvent e) {
|
||||
final Location l = BukkitUtil.getLocation(e.getVehicle());
|
||||
@ -1404,14 +1518,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (!MainUtil.isPlotAreaAbs(l)) {
|
||||
return;
|
||||
}
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.road")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.vehicle.break.road")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.vehicle.break.road");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.unowned")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.vehicle.break.unowned")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.vehicle.break.unowned");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
@ -1422,7 +1536,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (FlagManager.isPlotFlagTrue(plot, "vehicle-break")) {
|
||||
return;
|
||||
}
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.other")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.vehicle.break.other")) {
|
||||
if (MainUtil.isPlotArea(l)) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.vehicle.break.other");
|
||||
e.setCancelled(true);
|
||||
@ -1498,7 +1612,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
return;
|
||||
}
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.pve.road")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.pve.road")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pve.road");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
@ -1506,7 +1620,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
} else {
|
||||
if (!plot.hasOwner()) {
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.pve.unowned")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.pve.unowned")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pve.unowned");
|
||||
if (projectile != null) {
|
||||
projectile.remove();
|
||||
@ -1533,7 +1647,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if ((victim instanceof Tameable) && ((Tameable) victim).isTamed() && FlagManager.isPlotFlagTrue(plot, "tamed-attack")) {
|
||||
return;
|
||||
}
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.pve.other")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.pve.other")) {
|
||||
if (MainUtil.isPlotArea(l)) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pve.other");
|
||||
if (projectile != null) {
|
||||
@ -1564,20 +1678,20 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (!MainUtil.isPlotAreaAbs(l)) {
|
||||
return;
|
||||
}
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.projectile.road")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.projectile.road")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.projectile.road");
|
||||
e.setHatching(false);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.projectile.unowned")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.projectile.unowned")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.projectile.unowned");
|
||||
e.setHatching(false);
|
||||
return;
|
||||
}
|
||||
} else if (!plot.isAdded(pp.getUUID())) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.projectile.other")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.projectile.other")) {
|
||||
if (MainUtil.isPlotArea(l)) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.projectile.other");
|
||||
e.setHatching(false);
|
||||
@ -1601,7 +1715,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot != null) {
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.build.unowned")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.build.unowned")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -1610,7 +1724,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
else if (!plot.isAdded(pp.getUUID())) {
|
||||
final Flag place = FlagManager.getPlotFlag(plot, "place");
|
||||
final Block block = event.getBlock();
|
||||
if (((place == null) || !((HashSet<PlotBlock>) place.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) && !Permissions.hasPermission(pp, "plots.admin.build.other")) {
|
||||
if (((place == null) || !((HashSet<PlotBlock>) place.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) && !Perm.hasPermission(pp, "plots.admin.build.other")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.other");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -1622,7 +1736,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (!Permissions.hasPermission(pp, "plots.admin.build.road")) {
|
||||
else if (!Perm.hasPermission(pp, "plots.admin.build.road")) {
|
||||
if (MainUtil.isPlotAreaAbs(loc)) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road");
|
||||
event.setCancelled(true);
|
||||
|
@ -26,7 +26,7 @@ import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||
|
||||
public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
||||
@ -84,14 +84,14 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
||||
if (!MainUtil.isPlotArea(l)) {
|
||||
return;
|
||||
}
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.interact.road")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.road");
|
||||
cancelled = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.interact.unowned")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.unowned");
|
||||
cancelled = true;
|
||||
}
|
||||
@ -99,7 +99,7 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
||||
else {
|
||||
final UUID uuid = pp.getUUID();
|
||||
if (!plot.isAdded(uuid)) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.interact.other")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.other");
|
||||
cancelled = true;
|
||||
}
|
||||
@ -133,14 +133,14 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
||||
if (!MainUtil.isPlotArea(l)) {
|
||||
return;
|
||||
}
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.interact.road")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.road");
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.interact.unowned")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.unowned");
|
||||
e.setCancelled(true);
|
||||
}
|
||||
@ -148,7 +148,7 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
||||
else {
|
||||
final UUID uuid = pp.getUUID();
|
||||
if (!plot.isAdded(uuid)) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
|
||||
if (!Perm.hasPermission(pp, "plots.admin.interact.other")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.other");
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotHandler;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
@ -163,7 +163,7 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
||||
if (FlagManager.isBooleanFlag(plot, "notify-enter", false)) {
|
||||
final Player trespasser = event.getPlayer();
|
||||
final PlotPlayer pt = BukkitUtil.getPlayer(trespasser);
|
||||
if (Permissions.hasPermission(pt, "plots.flag.notify-enter.bypass")) {
|
||||
if (Perm.hasPermission(pt, "plots.flag.notify-enter.bypass")) {
|
||||
return;
|
||||
}
|
||||
if (plot.hasOwner()) {
|
||||
@ -211,7 +211,7 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
||||
healRunnable.remove(leaver);
|
||||
}
|
||||
if (FlagManager.isBooleanFlag(plot, "notify-leave", false)) {
|
||||
if (Permissions.hasPermission(pl, "plots.flag.notify-leave.bypass")) {
|
||||
if (Perm.hasPermission(pl, "plots.flag.notify-leave.bypass")) {
|
||||
return;
|
||||
}
|
||||
if (plot.hasOwner()) {
|
||||
|
@ -18,7 +18,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.bukkit.selections.Selection;
|
||||
@ -87,7 +87,7 @@ public class WEListener implements Listener {
|
||||
MainUtil.sendMessage(player, C.WORLDEDIT_VOLUME.s().replaceAll("%current%", volume + "").replaceAll("%max%", max + ""));
|
||||
e.setCancelled(true);
|
||||
}
|
||||
if (Permissions.hasPermission(player, "plots.worldedit.bypass")) {
|
||||
if (Perm.hasPermission(player, "plots.worldedit.bypass")) {
|
||||
MainUtil.sendMessage(player, C.WORLDEDIT_BYPASS);
|
||||
}
|
||||
return true;
|
||||
@ -116,7 +116,7 @@ public class WEListener implements Listener {
|
||||
if (arg != null) {
|
||||
e.setCancelled(true);
|
||||
MainUtil.sendMessage(pp, C.REQUIRE_SELECTION_IN_MASK, arg);
|
||||
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
if (Perm.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASS);
|
||||
}
|
||||
return true;
|
||||
@ -125,7 +125,7 @@ public class WEListener implements Listener {
|
||||
if (!WEManager.regionContains(region, mask)) {
|
||||
MainUtil.sendMessage(pp, C.REQUIRE_SELECTION_IN_MASK, "pos1 + pos2");
|
||||
e.setCancelled(true);
|
||||
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
if (Perm.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASS);
|
||||
}
|
||||
return true;
|
||||
@ -187,7 +187,7 @@ public class WEListener implements Listener {
|
||||
if (iterations > maxIterations) {
|
||||
MainUtil.sendMessage(pp, C.WORLDEDIT_ITERATIONS.s().replaceAll("%current%", iterations + "").replaceAll("%max%", maxIterations + ""));
|
||||
e.setCancelled(true);
|
||||
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
if (Perm.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASS);
|
||||
}
|
||||
return true;
|
||||
@ -231,7 +231,7 @@ public class WEListener implements Listener {
|
||||
if (Settings.WE_BLACKLIST.contains(reduced)) {
|
||||
MainUtil.sendMessage(pp, C.WORLDEDIT_UNSAFE);
|
||||
e.setCancelled(true);
|
||||
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
if (Perm.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASS);
|
||||
}
|
||||
}
|
||||
@ -242,7 +242,7 @@ public class WEListener implements Listener {
|
||||
}
|
||||
e.setCancelled(true);
|
||||
MainUtil.sendMessage(pp, C.NO_PLOT_PERMS);
|
||||
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
if (Perm.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASS);
|
||||
}
|
||||
return true;
|
||||
|
@ -8,7 +8,7 @@ import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
import com.sk89q.worldedit.event.extent.EditSessionEvent;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
@ -32,7 +32,7 @@ public class WESubscriber {
|
||||
PlotPlayer player = UUIDHandler.getPlayer(actor.getName());
|
||||
HashSet<RegionWrapper> mask = WEManager.getMask(player);
|
||||
if (mask.size() == 0) {
|
||||
if (Permissions.hasPermission(player, "plots.worldedit.bypass")) {
|
||||
if (Perm.hasPermission(player, "plots.worldedit.bypass")) {
|
||||
MainUtil.sendMessage(player, C.WORLDEDIT_BYPASS);
|
||||
}
|
||||
event.setExtent(new NullExtent());
|
||||
|
@ -0,0 +1,138 @@
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
public class BukkitLazyBlock extends LazyBlock {
|
||||
|
||||
private int id = -1;
|
||||
private Block block;
|
||||
private PlotBlock pb;
|
||||
|
||||
|
||||
public BukkitLazyBlock(int id, Block block) {
|
||||
this.id = id;
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public BukkitLazyBlock(PlotBlock pb) {
|
||||
this.id = pb.id;
|
||||
this.pb = pb;
|
||||
}
|
||||
|
||||
public BukkitLazyBlock(Block block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlotBlock getPlotBlock() {
|
||||
if (pb != null) {
|
||||
return pb;
|
||||
}
|
||||
if (id == -1 ) {
|
||||
id = block.getTypeId();
|
||||
}
|
||||
byte data;
|
||||
switch(id) {
|
||||
case 0:
|
||||
case 2:
|
||||
case 4:
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
case 20:
|
||||
case 21:
|
||||
case 22:
|
||||
case 24:
|
||||
case 25:
|
||||
case 30:
|
||||
case 32:
|
||||
case 37:
|
||||
case 39:
|
||||
case 40:
|
||||
case 41:
|
||||
case 42:
|
||||
case 45:
|
||||
case 46:
|
||||
case 47:
|
||||
case 48:
|
||||
case 49:
|
||||
case 50:
|
||||
case 51:
|
||||
case 52:
|
||||
case 54:
|
||||
case 55:
|
||||
case 56:
|
||||
case 57:
|
||||
case 58:
|
||||
case 60:
|
||||
case 61:
|
||||
case 62:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case 73:
|
||||
case 74:
|
||||
case 75:
|
||||
case 76:
|
||||
case 78:
|
||||
case 79:
|
||||
case 80:
|
||||
case 81:
|
||||
case 82:
|
||||
case 83:
|
||||
case 84:
|
||||
case 85:
|
||||
case 87:
|
||||
case 88:
|
||||
case 101:
|
||||
case 102:
|
||||
case 103:
|
||||
case 110:
|
||||
case 112:
|
||||
case 113:
|
||||
case 117:
|
||||
case 121:
|
||||
case 122:
|
||||
case 123:
|
||||
case 124:
|
||||
case 129:
|
||||
case 133:
|
||||
case 138:
|
||||
case 137:
|
||||
case 140:
|
||||
case 165:
|
||||
case 166:
|
||||
case 169:
|
||||
case 170:
|
||||
case 172:
|
||||
case 173:
|
||||
case 174:
|
||||
case 176:
|
||||
case 177:
|
||||
case 181:
|
||||
case 182:
|
||||
case 188:
|
||||
case 189:
|
||||
case 190:
|
||||
case 191:
|
||||
case 192:
|
||||
data = 0;
|
||||
default:
|
||||
data = block.getData();
|
||||
}
|
||||
pb = new PlotBlock((short) id, data);
|
||||
return pb;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
if (id == -1) {
|
||||
id = block.getTypeId();
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
public abstract class LazyBlock {
|
||||
public abstract PlotBlock getPlotBlock();
|
||||
|
||||
public int getId() {
|
||||
return getPlotBlock().id;
|
||||
}
|
||||
}
|
@ -24,6 +24,9 @@ package com.intellectualcrafters.plot.object;
|
||||
* @author Empire92
|
||||
*/
|
||||
public class PlotBlock {
|
||||
|
||||
public static PlotBlock EVERYTHING = new PlotBlock((short) 0, (byte) 0);
|
||||
|
||||
public final short id;
|
||||
public final byte data;
|
||||
|
||||
|
@ -7,7 +7,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotHandler;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
|
||||
public class InboxOwner extends CommentInbox {
|
||||
@ -15,25 +15,25 @@ public class InboxOwner extends CommentInbox {
|
||||
@Override
|
||||
public boolean canRead(Plot plot, PlotPlayer player) {
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player, "plots.inbox.read." + toString());
|
||||
return Perm.hasPermission(player, "plots.inbox.read." + toString());
|
||||
}
|
||||
return (Permissions.hasPermission(player, "plots.inbox.read." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Permissions.hasPermission(player, "plots.inbox.read." + toString() + ".other")));
|
||||
return (Perm.hasPermission(player, "plots.inbox.read." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Perm.hasPermission(player, "plots.inbox.read." + toString() + ".other")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrite(Plot plot, PlotPlayer player) {
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player, "plots.inbox.write." + toString());
|
||||
return Perm.hasPermission(player, "plots.inbox.write." + toString());
|
||||
}
|
||||
return (Permissions.hasPermission(player, "plots.inbox.write." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Permissions.hasPermission(player, "plots.inbox.write." + toString() + ".other")));
|
||||
return (Perm.hasPermission(player, "plots.inbox.write." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Perm.hasPermission(player, "plots.inbox.write." + toString() + ".other")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canModify(Plot plot, PlotPlayer player) {
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player, "plots.inbox.modify." + toString());
|
||||
return Perm.hasPermission(player, "plots.inbox.modify." + toString());
|
||||
}
|
||||
return (Permissions.hasPermission(player, "plots.inbox.modify." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Permissions.hasPermission(player, "plots.inbox.modify." + toString() + ".other")));
|
||||
return (Perm.hasPermission(player, "plots.inbox.modify." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Perm.hasPermission(player, "plots.inbox.modify." + toString() + ".other")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,7 +7,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotHandler;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
|
||||
public class InboxPublic extends CommentInbox {
|
||||
@ -15,25 +15,25 @@ public class InboxPublic extends CommentInbox {
|
||||
@Override
|
||||
public boolean canRead(Plot plot, PlotPlayer player) {
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player, "plots.inbox.read." + toString());
|
||||
return Perm.hasPermission(player, "plots.inbox.read." + toString());
|
||||
}
|
||||
return (Permissions.hasPermission(player, "plots.inbox.read." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Permissions.hasPermission(player, "plots.inbox.read." + toString() + ".other")));
|
||||
return (Perm.hasPermission(player, "plots.inbox.read." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Perm.hasPermission(player, "plots.inbox.read." + toString() + ".other")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrite(Plot plot, PlotPlayer player) {
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player, "plots.inbox.write." + toString());
|
||||
return Perm.hasPermission(player, "plots.inbox.write." + toString());
|
||||
}
|
||||
return (Permissions.hasPermission(player, "plots.inbox.write." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Permissions.hasPermission(player, "plots.inbox.write." + toString() + ".other")));
|
||||
return (Perm.hasPermission(player, "plots.inbox.write." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Perm.hasPermission(player, "plots.inbox.write." + toString() + ".other")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canModify(Plot plot, PlotPlayer player) {
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player, "plots.inbox.modify." + toString());
|
||||
return Perm.hasPermission(player, "plots.inbox.modify." + toString());
|
||||
}
|
||||
return (Permissions.hasPermission(player, "plots.inbox.modify." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Permissions.hasPermission(player, "plots.inbox.modify." + toString() + ".other")));
|
||||
return (Perm.hasPermission(player, "plots.inbox.modify." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Perm.hasPermission(player, "plots.inbox.modify." + toString() + ".other")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,7 +5,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotHandler;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.Perm;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
|
||||
public class InboxReport extends CommentInbox {
|
||||
@ -13,25 +13,25 @@ public class InboxReport extends CommentInbox {
|
||||
@Override
|
||||
public boolean canRead(Plot plot, PlotPlayer player) {
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player, "plots.inbox.read." + toString());
|
||||
return Perm.hasPermission(player, "plots.inbox.read." + toString());
|
||||
}
|
||||
return (Permissions.hasPermission(player, "plots.inbox.read." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Permissions.hasPermission(player, "plots.inbox.read." + toString() + ".other")));
|
||||
return (Perm.hasPermission(player, "plots.inbox.read." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Perm.hasPermission(player, "plots.inbox.read." + toString() + ".other")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrite(Plot plot, PlotPlayer player) {
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player, "plots.inbox.write." + toString());
|
||||
return Perm.hasPermission(player, "plots.inbox.write." + toString());
|
||||
}
|
||||
return (Permissions.hasPermission(player, "plots.inbox.write." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Permissions.hasPermission(player, "plots.inbox.write." + toString() + ".other")));
|
||||
return (Perm.hasPermission(player, "plots.inbox.write." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Perm.hasPermission(player, "plots.inbox.write." + toString() + ".other")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canModify(Plot plot, PlotPlayer player) {
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player, "plots.inbox.modify." + toString());
|
||||
return Perm.hasPermission(player, "plots.inbox.modify." + toString());
|
||||
}
|
||||
return (Permissions.hasPermission(player, "plots.inbox.modify." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Permissions.hasPermission(player, "plots.inbox.modify." + toString() + ".other")));
|
||||
return (Perm.hasPermission(player, "plots.inbox.modify." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Perm.hasPermission(player, "plots.inbox.modify." + toString() + ".other")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,12 +1,18 @@
|
||||
package com.intellectualcrafters.plot.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.flag.FlagValue.PlotBlockListValue;
|
||||
import com.intellectualcrafters.plot.listeners.PlayerBlockEventType;
|
||||
import com.intellectualcrafters.plot.object.LazyBlock;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
@ -51,4 +57,188 @@ public abstract class EventUtil {
|
||||
public abstract void callTrusted(final PlotPlayer initiator, final Plot plot, final UUID player, final boolean added);
|
||||
|
||||
public abstract void callMember(final PlotPlayer initiator, final Plot plot, final UUID player, final boolean added);
|
||||
|
||||
public boolean checkPlayerBlockEvent(PlotPlayer pp, PlayerBlockEventType type, Location loc, LazyBlock block, boolean notifyPerms) {
|
||||
Plot plot = MainUtil.getPlot(loc);
|
||||
UUID uuid = pp.getUUID();
|
||||
if (plot == null) {
|
||||
if (!MainUtil.isPlotAreaAbs(loc)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (plot.isAdded(uuid)) {
|
||||
return true;
|
||||
}
|
||||
switch (type) {
|
||||
case TELEPORT_OBJECT: {
|
||||
return false;
|
||||
}
|
||||
case EAT:
|
||||
case READ: {
|
||||
return true;
|
||||
}
|
||||
case BREAK_BLOCK: {
|
||||
if (plot == null) {
|
||||
return Perm.hasPermission(pp, Perm.BREAK_ROAD.s, notifyPerms);
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
return Perm.hasPermission(pp, Perm.BREAK_UNOWNED.s, notifyPerms);
|
||||
}
|
||||
Flag flag = FlagManager.getPlotFlag(plot, "break");
|
||||
HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
|
||||
if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
|
||||
return Perm.hasPermission(pp, Perm.BREAK_OTHER.s, notifyPerms);
|
||||
}
|
||||
}
|
||||
case BREAK_HANGING:
|
||||
if (plot == null) {
|
||||
return Perm.hasPermission(pp, Perm.BREAK_ROAD.s, notifyPerms);
|
||||
}
|
||||
if (FlagManager.isPlotFlagTrue(plot, "hanging-break")) {
|
||||
return true;
|
||||
}
|
||||
if (plot.hasOwner()) {
|
||||
return Perm.hasPermission(pp, Perm.BREAK_OTHER.s, notifyPerms);
|
||||
}
|
||||
return Perm.hasPermission(pp, Perm.BREAK_UNOWNED.s, notifyPerms);
|
||||
case BREAK_MISC:
|
||||
if (plot == null) {
|
||||
return Perm.hasPermission(pp, Perm.BREAK_ROAD.s, notifyPerms);
|
||||
}
|
||||
if (FlagManager.isPlotFlagTrue(plot, "misc-break")) {
|
||||
return true;
|
||||
}
|
||||
if (plot.hasOwner()) {
|
||||
return Perm.hasPermission(pp, Perm.BREAK_OTHER.s, notifyPerms);
|
||||
}
|
||||
return Perm.hasPermission(pp, Perm.BREAK_UNOWNED.s, notifyPerms);
|
||||
case BREAK_VEHICLE:
|
||||
if (plot == null) {
|
||||
return Perm.hasPermission(pp, Perm.BREAK_ROAD.s, notifyPerms);
|
||||
}
|
||||
if (FlagManager.isPlotFlagTrue(plot, "vehicle-break")) {
|
||||
return true;
|
||||
}
|
||||
if (plot.hasOwner()) {
|
||||
return Perm.hasPermission(pp, Perm.BREAK_OTHER.s, notifyPerms);
|
||||
}
|
||||
return Perm.hasPermission(pp, Perm.BREAK_UNOWNED.s, notifyPerms);
|
||||
case INTERACT_BLOCK: {
|
||||
if (plot == null) {
|
||||
return Perm.hasPermission(pp, Perm.INTERACT_ROAD.s, notifyPerms);
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
return Perm.hasPermission(pp, Perm.INTERACT_UNOWNED.s, notifyPerms);
|
||||
}
|
||||
Flag flag = FlagManager.getPlotFlag(plot, "use");
|
||||
HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
|
||||
if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
|
||||
return Perm.hasPermission(pp, Perm.INTERACT_OTHER.s, notifyPerms);
|
||||
}
|
||||
}
|
||||
case PLACE_BLOCK: {
|
||||
if (plot == null) {
|
||||
return Perm.hasPermission(pp, Perm.BUILD_ROAD.s, notifyPerms);
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
return Perm.hasPermission(pp, Perm.BUILD_UNOWNED.s, notifyPerms);
|
||||
}
|
||||
Flag flag = FlagManager.getPlotFlag(plot, "place");
|
||||
HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
|
||||
if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
|
||||
return Perm.hasPermission(pp, Perm.BUILD_OTHER.s, notifyPerms);
|
||||
}
|
||||
}
|
||||
case TRIGGER_PHYSICAL: {
|
||||
if (plot == null) {
|
||||
return Perm.hasPermission(pp, Perm.INTERACT_ROAD.s, false);
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
return Perm.hasPermission(pp, Perm.INTERACT_UNOWNED.s, false);
|
||||
}
|
||||
if (FlagManager.isPlotFlagTrue(plot, "device-interact")) {
|
||||
return true;
|
||||
}
|
||||
Flag flag = FlagManager.getPlotFlag(plot, "use");
|
||||
HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
|
||||
if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
|
||||
return Perm.hasPermission(pp, Perm.INTERACT_OTHER.s, notifyPerms);
|
||||
}
|
||||
}
|
||||
case INTERACT_HANGING: {
|
||||
if (plot == null) {
|
||||
return Perm.hasPermission(pp, Perm.INTERACT_ROAD.s, notifyPerms);
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
return Perm.hasPermission(pp, Perm.INTERACT_UNOWNED.s, notifyPerms);
|
||||
}
|
||||
if (FlagManager.isPlotFlagTrue(plot, "hanging-interact")) {
|
||||
return true;
|
||||
}
|
||||
Flag flag = FlagManager.getPlotFlag(plot, "use");
|
||||
HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
|
||||
if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
|
||||
return Perm.hasPermission(pp, Perm.INTERACT_OTHER.s, notifyPerms);
|
||||
}
|
||||
}
|
||||
case INTERACT_MISC: {
|
||||
if (plot == null) {
|
||||
return Perm.hasPermission(pp, Perm.INTERACT_ROAD.s, notifyPerms);
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
return Perm.hasPermission(pp, Perm.INTERACT_UNOWNED.s, notifyPerms);
|
||||
}
|
||||
if (FlagManager.isPlotFlagTrue(plot, "misc-interact")) {
|
||||
return true;
|
||||
}
|
||||
Flag flag = FlagManager.getPlotFlag(plot, "use");
|
||||
HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
|
||||
if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
|
||||
return Perm.hasPermission(pp, Perm.INTERACT_OTHER.s, notifyPerms);
|
||||
}
|
||||
}
|
||||
case INTERACT_VEHICLE: {
|
||||
if (plot == null) {
|
||||
return Perm.hasPermission(pp, Perm.INTERACT_ROAD.s, notifyPerms);
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
return Perm.hasPermission(pp, Perm.INTERACT_UNOWNED.s, notifyPerms);
|
||||
}
|
||||
if (FlagManager.isPlotFlagTrue(plot, "vehicle-use")) {
|
||||
return true;
|
||||
}
|
||||
Flag flag = FlagManager.getPlotFlag(plot, "use");
|
||||
HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
|
||||
if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
|
||||
return Perm.hasPermission(pp, Perm.INTERACT_OTHER.s, notifyPerms);
|
||||
}
|
||||
}
|
||||
case SPAWN_MOB: {
|
||||
if (plot == null) {
|
||||
return Perm.hasPermission(pp, Perm.INTERACT_OTHER.s, notifyPerms);
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
return Perm.hasPermission(pp, Perm.INTERACT_UNOWNED.s, notifyPerms);
|
||||
}
|
||||
|
||||
if (FlagManager.isPlotFlagTrue(plot, "mob-place")) {
|
||||
return true;
|
||||
}
|
||||
Flag flag = FlagManager.getPlotFlag(plot, "place");
|
||||
HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
|
||||
if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
|
||||
return Perm.hasPermission(pp, Perm.INTERACT_OTHER.s, notifyPerms);
|
||||
}
|
||||
}
|
||||
case PLACE_HANGING:
|
||||
break;
|
||||
case PLACE_MISC:
|
||||
break;
|
||||
case PLACE_VEHICLE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ public class MainUtil {
|
||||
else {
|
||||
location = getDefaultHome(plot);
|
||||
}
|
||||
if ((Settings.TELEPORT_DELAY == 0) || Permissions.hasPermission(player, "plots.teleport.delay.bypass")) {
|
||||
if ((Settings.TELEPORT_DELAY == 0) || Perm.hasPermission(player, "plots.teleport.delay.bypass")) {
|
||||
sendMessage(player, C.TELEPORTED_TO_PLOT);
|
||||
player.teleport(location);
|
||||
return true;
|
||||
@ -1093,7 +1093,7 @@ public class MainUtil {
|
||||
if (Settings.ENABLE_CLUSTERS) {
|
||||
PlotCluster cluster = ClusterManager.getCluster(plot);
|
||||
if (cluster != null) {
|
||||
if (!cluster.isAdded(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.claim")) {
|
||||
if (!cluster.isAdded(player.getUUID()) && !Perm.hasPermission(player, "plots.admin.command.claim")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1558,7 +1558,7 @@ public class MainUtil {
|
||||
* @return int
|
||||
*/
|
||||
public static int getAllowedPlots(final PlotPlayer p) {
|
||||
return Permissions.hasPermissionRange(p, "plots.plot", Settings.MAX_PLOTS);
|
||||
return Perm.hasPermissionRange(p, "plots.plot", Settings.MAX_PLOTS);
|
||||
}
|
||||
|
||||
public static Plot getPlot(final Location loc) {
|
||||
|
@ -0,0 +1,83 @@
|
||||
package com.intellectualcrafters.plot.util;
|
||||
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
|
||||
public enum Perm {
|
||||
// ADMIN
|
||||
ADMIN("plots.admin", "do-not-change"),
|
||||
// BUILD
|
||||
BUILD_OTHER("plots.admin.build.other", "build"),
|
||||
BUILD_ROAD("plots.admin.build.road", "build"),
|
||||
BUILD_UNOWNED("plots.admin.build.unowned", "build"),
|
||||
// INTERACT
|
||||
INTERACT_OTHER("plots.admin.interact.other", "interact"),
|
||||
INTERACT_ROAD("plots.admin.interact.road", "interact"),
|
||||
INTERACT_UNOWNED("plots.admin.interact.unowned", "interact"),
|
||||
// BREAK
|
||||
BREAK_OTHER("plots.admin.break.other", "break"),
|
||||
BREAK_ROAD("plots.admin.break.road", "break"),
|
||||
BREAK_UNOWNED("plots.admin.break.unowned", "break");
|
||||
|
||||
public String s;
|
||||
public String cat;
|
||||
|
||||
Perm(String perm, String cat) {
|
||||
this.s = perm;
|
||||
this.cat = cat;
|
||||
}
|
||||
|
||||
public static boolean hasPermission(final PlotPlayer player, final String perm) {
|
||||
if ((player == null) || player.isOp() || player.hasPermission(ADMIN.s)) {
|
||||
return true;
|
||||
}
|
||||
if (player.hasPermission(perm)) {
|
||||
return true;
|
||||
}
|
||||
final String[] nodes = perm.split("\\.");
|
||||
final StringBuilder n = new StringBuilder();
|
||||
for (int i = 0; i < (nodes.length - 1); i++) {
|
||||
n.append(nodes[i] + ("."));
|
||||
if (player.hasPermission(n + "*")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean hasPermission(final PlotPlayer player, final String perm, boolean notify) {
|
||||
if ((player == null) || player.isOp() || player.hasPermission(ADMIN.s)) {
|
||||
return true;
|
||||
}
|
||||
if (player.hasPermission(perm)) {
|
||||
return true;
|
||||
}
|
||||
final String[] nodes = perm.split("\\.");
|
||||
final StringBuilder n = new StringBuilder();
|
||||
for (int i = 0; i < (nodes.length - 1); i++) {
|
||||
n.append(nodes[i] + ("."));
|
||||
if (player.hasPermission(n + "*")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (notify) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, perm);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int hasPermissionRange(final PlotPlayer player, final String stub, final int range) {
|
||||
if ((player == null) || player.isOp() || player.hasPermission(ADMIN.s)) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
if (player.hasPermission(stub + ".*")) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
for (int i = range; i > 0; i--) {
|
||||
if (player.hasPermission(stub + "." + i)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
package com.intellectualcrafters.plot.util;
|
||||
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
|
||||
public class Permissions {
|
||||
// ADMIN
|
||||
public static String ADMIN = "plots.admin";
|
||||
// BUILD
|
||||
public static String BUILD_OTHER = "plots.admin.build.other";
|
||||
public static String BUILD_ROAD = "plots.admin.build.road";
|
||||
public static String BUILD_UNOWNED = "plots.admin.build.unowned";
|
||||
// INTERACT
|
||||
public static String INTERACT_OTHER = "plots.admin.interact.other";
|
||||
public static String INTERACT_ROAD = "plots.admin.interact.road";
|
||||
public static String INTERACT_UNOWNED = "plots.admin.interact.unowned";
|
||||
// BREAK
|
||||
public static String BREAK_OTHER = "plots.admin.break.other";
|
||||
public static String BREAK_ROAD = "plots.admin.break.road";
|
||||
public static String BREAK_UNOWNED = "plots.admin.break.unowned";
|
||||
|
||||
public static boolean hasPermission(final PlotPlayer player, final String perm) {
|
||||
if ((player == null) || player.isOp() || player.hasPermission(ADMIN)) {
|
||||
return true;
|
||||
}
|
||||
if (player.hasPermission(perm)) {
|
||||
return true;
|
||||
}
|
||||
final String[] nodes = perm.split("\\.");
|
||||
final StringBuilder n = new StringBuilder();
|
||||
for (int i = 0; i < (nodes.length - 1); i++) {
|
||||
n.append(nodes[i] + ("."));
|
||||
if (player.hasPermission(n + "*")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int hasPermissionRange(final PlotPlayer player, final String stub, final int range) {
|
||||
if ((player == null) || player.isOp() || player.hasPermission(ADMIN)) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
if (player.hasPermission(stub + ".*")) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
for (int i = range; i > 0; i--) {
|
||||
if (player.hasPermission(stub + "." + i)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
package com.intellectualcrafters.plot.util;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
public class Updater {
|
||||
public Updater() {
|
||||
// https://www.spigotmc.org/resources/plotsquared.1177/history
|
||||
try {
|
||||
|
||||
String resource = "plotsquared.1177";
|
||||
String url = "https://www.spigotmc.org/resources/" + resource + "/history";
|
||||
String download = "<a href=\"resources/" + resource + "/download?version=";
|
||||
URL history = new URL(url);
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(history.openStream()));
|
||||
String inputLine;
|
||||
while ((inputLine = in.readLine()) != null)
|
||||
if (inputLine.length() > download.length() && inputLine.startsWith(download)) {
|
||||
System.out.println("===========================");
|
||||
System.out.println("FOUND LINE");
|
||||
System.out.println("===========================");
|
||||
}
|
||||
System.out.println(inputLine);
|
||||
in.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -120,8 +120,8 @@ public class SetBlockFast extends BukkitSetBlockManager {
|
||||
}
|
||||
if (!MainUtil.canSendChunk) {
|
||||
for (Chunk chunk : chunks) {
|
||||
chunk.getWorld().refreshChunk(chunk.getX(), chunk.getZ());
|
||||
chunk.unload(true, false);
|
||||
// chunk.getWorld().refreshChunk(chunk.getX(), chunk.getZ());
|
||||
chunk.load();
|
||||
}
|
||||
return;
|
||||
|
@ -333,6 +333,7 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager {
|
||||
}
|
||||
if (!MainUtil.canSendChunk) {
|
||||
for (Chunk chunk : chunks) {
|
||||
chunk.getWorld().refreshChunk(chunk.getX(), chunk.getZ());
|
||||
chunk.unload(true, false);
|
||||
chunk.load();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user