diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTOutputStream.java b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTOutputStream.java index 452784981..54a6f895a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTOutputStream.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTOutputStream.java @@ -270,4 +270,12 @@ public final class NBTOutputStream implements Closeable { public void close() throws IOException { this.os.close(); } + + /** + * Flush output + * @throws IOException + */ + public void flush() throws IOException { + this.os.flush(); + } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java index c1d6fe751..f0e8838b7 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java @@ -57,6 +57,7 @@ import com.intellectualcrafters.plot.commands.DebugUUID; import com.intellectualcrafters.plot.commands.Delete; import com.intellectualcrafters.plot.commands.Deny; import com.intellectualcrafters.plot.commands.Disable; +import com.intellectualcrafters.plot.commands.Download; import com.intellectualcrafters.plot.commands.FlagCmd; import com.intellectualcrafters.plot.commands.Help; import com.intellectualcrafters.plot.commands.Home; @@ -269,6 +270,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain { @Override public void registerCommands() { new MainCommand(); + MainCommand.subCommands.add(new Download()); MainCommand.subCommands.add(new Disable()); MainCommand.subCommands.add(new Update()); MainCommand.subCommands.add(new Template()); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PS.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PS.java index 52335e032..7c50bddea 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PS.java @@ -1222,6 +1222,10 @@ public class PS { // Schematics options.put("schematics.save_path", Settings.SCHEMATIC_SAVE_PATH); + // Web + options.put("web.url", Settings.WEB_URL); + options.put("web.server-ip", Settings.WEB_IP); + // Caching options.put("cache.permissions", Settings.PERMISSION_CACHING); options.put("cache.ratings", Settings.CACHE_RATINGS); @@ -1306,6 +1310,10 @@ public class PS { // Schematics Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path"); + // Web + Settings.WEB_URL = config.getString("web.url"); + Settings.WEB_IP = config.getString("web.server-ip"); + // Caching Settings.PERMISSION_CACHING = config.getBoolean("cache.permissions"); Settings.CACHE_RATINGS = config.getBoolean("cache.ratings"); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java index 5be1d7bbc..1fd47fd74 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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.Perm + * @see com.intellectualcrafters.plot.util.Permissions */ @Deprecated - public Perm[] getPermissions() { - return Perm.values(); + public Permissions[] getPermissions() { + return Permissions.values(); } /** diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Add.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Add.java index d9a9c3d80..1c0a6a45a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Add.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Add.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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()) && !Perm.hasPermission(plr, "plots.admin.command.add")) { + if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.add")) { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); return true; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java index 50abb619c..0c98eebb4 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; public class Auto extends SubCommand { public Auto() { @@ -85,7 +85,7 @@ public class Auto extends SubCommand { } } if (args.length > 0) { - if (Perm.hasPermission(plr, "plots.auto.mega")) { + if (Permissions.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 (!Perm.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) { + if (!Permissions.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) { MainUtil.sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic); return true; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java index 7b2f8152f..1fae73967 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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 (!Perm.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) { + if (!Permissions.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) { return sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic); } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java index 5f351aff7..93d34131e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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 && !(Perm.hasPermission(plr, "plots.confirm.bypass"))) { + if (Settings.CONFIRM_CLEAR && !(Permissions.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))) && !Perm.hasPermission(plr, "plots.admin.command.clear")) { + if (((plot == null) || !plot.hasOwner() || !plot.isOwner(UUIDHandler.getUUID(plr))) && !Permissions.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 && !(Perm.hasPermission(plr, "plots.confirm.bypass"))) { + if (Settings.CONFIRM_CLEAR && !(Permissions.hasPermission(plr, "plots.confirm.bypass"))) { CmdConfirm.addPending(plr, "/plot clear " + plot.id, runnable); } else { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java index 968e24a10..ed1aef502 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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 (!Perm.hasPermission(plr, "plots.cluster.list")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.cluster.create")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.cluster.delete")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.cluster.delete.other")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.cluster.resize")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.cluster.resize.other")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.cluster.delete")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.cluster.regen.other")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.cluster.invite")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.cluster.invite.other")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.cluster.kick")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.cluster.kick.other")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.cluster.leave")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.cluster.helpers")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.cluster.tp")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.cluster.tp.other")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.cluster.info")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.cluster.sethome")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.cluster.sethome.other")) { + if (!Permissions.hasPermission(plr, "plots.cluster.sethome.other")) { MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.cluster.sethome.other"); return false; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java index 5521b76da..e6ebde753 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java @@ -38,13 +38,11 @@ public enum Command { ADD("add","a"), TRUST("trust", "t"), DENY("deny", "d"), - REMOVE("remove", "r"), UNTRUST("untrust", "ut"), UNDENY("undeny", "ud"), - TOGGLE("toggle", "attribute"), - + DOWNLOAD("download", "dl"), MOVE("move"), FLAG("flag", "f"), TARGET("target"), diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/CommandPermission.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/CommandPermission.java index aa1817eda..32f1901cf 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/CommandPermission.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/CommandPermission.java @@ -21,7 +21,7 @@ package com.intellectualcrafters.plot.commands; import com.intellectualcrafters.plot.object.PlotPlayer; -import com.intellectualcrafters.plot.util.Perm; +import com.intellectualcrafters.plot.util.Permissions; /** * 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 Perm.hasPermission(player, this.permission); + return Permissions.hasPermission(player, this.permission); } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java index 2ccf87e51..996a744d4 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; /** * 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(Perm.ADMIN.s)) { + if (!plot1.isAdded(plr.getUUID()) && !plr.hasPermission(Permissions.ADMIN.s)) { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); return false; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java index 9b7480cea..9adbc94da 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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))) && !Perm.hasPermission(plr, "plots.admin.command.debugclear")) { + if (((plot == null) || !plot.hasOwner() || !plot.isOwner(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.debugclear")) { return sendMessage(plr, C.NO_PLOT_PERMS); } assert plot != null; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugFill.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugFill.java index cc63489dd..3684f29e5 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugFill.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugFill.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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()) && !Perm.hasPermission(player, "plots.admin.command.fill")) { + if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.fill")) { MainUtil.sendMessage(player, C.NO_PLOT_PERMS); return true; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java index a102130a2..1d731a78c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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)))) && !Perm.hasPermission(plr, "plots.admin.command.delete")) { + if ((((plot == null) || !plot.hasOwner() || !plot.isOwner(UUIDHandler.uuidWrapper.getUUID(plr)))) && !Permissions.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 && !(Perm.hasPermission(plr, "plots.confirm.bypass"))) { + if (Settings.CONFIRM_DELETE && !(Permissions.hasPermission(plr, "plots.confirm.bypass"))) { CmdConfirm.addPending(plr, "/plot delete " + plot.id, runnable); } else { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Deny.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Deny.java index fe5297d4d..d50bf4f63 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Deny.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Deny.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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()) && !Perm.hasPermission(plr, "plots.admin.command.deny")) { + if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.deny")) { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); return true; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Download.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Download.java new file mode 100644 index 000000000..7d82d7353 --- /dev/null +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Download.java @@ -0,0 +1,51 @@ +package com.intellectualcrafters.plot.commands; + +import java.net.URL; + +import com.intellectualcrafters.jnbt.CompoundTag; +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.object.PlotWorld; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.SchematicHandler; +import com.intellectualcrafters.plot.util.TaskManager; + +public class Download extends SubCommand { + public Download() { + super(Command.DOWNLOAD, "Download your plot", "dl", CommandCategory.ACTIONS, true); + } + + @Override + public boolean execute(final PlotPlayer plr, String... args) { + final String world = plr.getLocation().getWorld(); + if (!PS.get().isPlotWorld(world)) { + return !sendMessage(plr, C.NOT_IN_PLOT_WORLD); + } + final Plot plot = MainUtil.getPlot(plr.getLocation()); + if (plot == null) { + return !sendMessage(plr, C.NOT_IN_PLOT); + } + if (MainUtil.runners.containsKey(plot)) { + MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER); + return false; + } + MainUtil.runners.put(plot, 1); + MainUtil.sendMessage(plr, C.GENERATING_LINK); + final CompoundTag tag = SchematicHandler.manager.getCompoundTag(plot.world, plot.id); + TaskManager.runTaskAsync(new Runnable() { + @Override + public void run() { + URL url = SchematicHandler.manager.upload(tag); + if (url == null) { + MainUtil.sendMessage(plr, C.GENERATING_LINK_FAILED); + return; + } + MainUtil.sendMessage(plr, url.toString()); + MainUtil.runners.remove(plot); + } + }); + return true; + } +} diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java index e324c43b7..0a2c21549 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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()) && !Perm.hasPermission(player, "plots.set.flag.other")) { + if (!plot.isAdded(player.getUUID()) && !Permissions.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 (!Perm.hasPermission(player, "plots.set.flag")) { + if (!Permissions.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 (!Perm.hasPermission(player, "plots.set.flag")) { + if (!Permissions.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 (!Perm.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) { + if (!Permissions.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 (!Perm.hasPermission(player, "plots.flag.remove")) { + if (!Permissions.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 (!Perm.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) { + if (!Permissions.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 (!Perm.hasPermission(player, "plots.flag.add")) { + if (!Permissions.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 (!Perm.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) { + if (!Permissions.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 (!Perm.hasPermission(player, "plots.flag.list")) { + if (!Permissions.hasPermission(player, "plots.flag.list")) { MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.list"); return false; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java index ed0c9cba2..73bed1336 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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())) && !Perm.hasPermission(plr, "plots.admin.command.kick"))) { + if (plot == null || ((!plot.hasOwner() || !plot.isOwner(plr.getUUID())) && !Permissions.hasPermission(plr, "plots.admin.command.kick"))) { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); return false; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java index ca3b9a71e..ea89f5ca3 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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 = Perm.hasPermission(plr, "plots.admin.command.merge"); + final boolean admin = Permissions.hasPermission(plr, "plots.admin.command.merge"); if (!plot.isOwner(plr.getUUID()) && !admin) { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); return false; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Move.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Move.java index ee7841065..d0ce4adc8 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Move.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Move.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; /** * 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(Perm.ADMIN.s)) { + if (!plot1.isAdded(plr.getUUID()) && !plr.hasPermission(Permissions.ADMIN.s)) { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); return false; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Remove.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Remove.java index 72e83c9b7..bbf8809fc 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Remove.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Remove.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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()) && !Perm.hasPermission(plr, "plots.admin.command.remove")) { + if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.remove")) { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); return true; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java index 1022873ce..0a01443bf 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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 (!Perm.hasPermission(plr, "plots.schematic.paste")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.schematic.test")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.schematic.save")) { + if (!Permissions.hasPermission(plr, "plots.schematic.save")) { MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.save"); return false; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java index 31c46c1b6..5f48d8765 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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 (!Perm.hasPermission(plr, "plots.set.other")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.set.flag." + args[1].toLowerCase())) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.set.home")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.set.alias")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.set.biome")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.set." + component)) { + if (!Permissions.hasPermission(plr, "plots.set." + component)) { MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set." + component); } PlotBlock[] blocks; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java index 3354ad9b8..ecf9a97f7 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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 (!Perm.hasPermission(plr, "plots.admin.command.setowner")) { + if (!Permissions.hasPermission(plr, "plots.admin.command.setowner")) { MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]); return false; } } else { - if (!Perm.hasPermission(plr, "plots.admin.command.setowner")) { + if (!Permissions.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 (!Perm.hasPermission(plr, "plots.admin.command.setowner")) { + if (!Permissions.hasPermission(plr, "plots.admin.command.setowner")) { MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command.setowner"); return false; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java index d918e30ea..ffdd46aa7 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; /** * 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())) && !Perm.hasPermission(plr, "plots.admin.command.swap")) { + if (((plot == null) || !plot.hasOwner() || !plot.isOwner(plr.getUUID())) && !Permissions.hasPermission(plr, "plots.admin.command.swap")) { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); return false; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trust.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trust.java index d82db61bf..ad49322cd 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trust.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trust.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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()) && !Perm.hasPermission(plr, "plots.admin.command.trust")) { + if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.trust")) { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); return true; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java index 88d410c3a..6b2d1c8d5 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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()))) && !Perm.hasPermission(plr, "plots.admin.command.unclaim")) { + if ((((plot == null) || !plot.hasOwner() || !plot.isOwner(plr.getUUID()))) && !Permissions.hasPermission(plr, "plots.admin.command.unclaim")) { return !sendMessage(plr, C.NO_PLOT_PERMS); } assert plot != null; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java index 9a7fb6a7a..687ce7e53 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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()) && !Perm.hasPermission(plr, "plots.admin.command.undeny")) { + if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.undeny")) { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); return true; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java index beb8fcd68..326d88620 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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())) && !Perm.hasPermission(plr, "plots.admin.command.unlink")) { + if (((plot == null) || !plot.hasOwner() || !plot.isOwner(plr.getUUID())) && !Permissions.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 && !(Perm.hasPermission(plr, "plots.confirm.bypass"))) { + if (Settings.CONFIRM_UNLINK && !(Permissions.hasPermission(plr, "plots.confirm.bypass"))) { CmdConfirm.addPending(plr, "/plot unlink " + plot.id, runnable); } else { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java index 83a5fbcae..ffbf7d084 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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()) && !Perm.hasPermission(plr, "plots.admin.command.untrust")) { + if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.untrust")) { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); return true; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java index 54659efdc..a6970d73b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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 (!Perm.hasPermission(plr, "plots.visit.unowned")) { + if (!Permissions.hasPermission(plr, "plots.visit.unowned")) { sendMessage(plr, C.NO_PERMISSION, "plots.visit.unowned"); return false; } } else if (plot.isOwner(plr.getUUID())) { - if (!Perm.hasPermission(plr, "plots.visit.owned") && !Perm.hasPermission(plr, "plots.home")) { + if (!Permissions.hasPermission(plr, "plots.visit.owned") && !Permissions.hasPermission(plr, "plots.home")) { sendMessage(plr, C.NO_PERMISSION, "plots.visit.owned, plots.home"); return false; } } else if (plot.isAdded(plr.getUUID())) { - if (!Perm.hasPermission(plr, "plots.visit.shared")) { + if (!Permissions.hasPermission(plr, "plots.visit.shared")) { sendMessage(plr, C.NO_PERMISSION, "plots.visit.shared"); return false; } } else { - if (!Perm.hasPermission(plr, "plots.visit.other")) { + if (!Permissions.hasPermission(plr, "plots.visit.other")) { sendMessage(plr, C.NO_PERMISSION, "plots.visit.other"); return false; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/WE_Anywhere.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/WE_Anywhere.java index 72addb92c..f14bddb9b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/WE_Anywhere.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/WE_Anywhere.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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 (Perm.hasPermission(plr, "plots.worldedit.bypass")) { + if (Permissions.hasPermission(plr, "plots.worldedit.bypass")) { if (WEManager.bypass.contains(plr.getName())) { WEManager.bypass.remove(plr.getName()); MainUtil.sendMessage(plr, C.WORLDEDIT_RESTRICTED); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java index 1971132ab..39fd3d74f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java @@ -42,7 +42,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.Rating; import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.MainUtil; -import com.intellectualcrafters.plot.util.Perm; +import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.StringComparison; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; import com.intellectualcrafters.plot.util.bukkit.chat.FancyMessage; @@ -123,7 +123,7 @@ public class list extends SubCommand { if (plr == null) { break; } - if (!Perm.hasPermission(plr, "plots.list.mine")) { + if (!Permissions.hasPermission(plr, "plots.list.mine")) { MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.mine"); return false; } @@ -134,7 +134,7 @@ public class list extends SubCommand { if (plr == null) { break; } - if (!Perm.hasPermission(plr, "plots.list.shared")) { + if (!Permissions.hasPermission(plr, "plots.list.shared")) { MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.shared"); return false; } @@ -147,11 +147,11 @@ public class list extends SubCommand { break; } case "world": { - if (!Perm.hasPermission(plr, "plots.list.world")) { + if (!Permissions.hasPermission(plr, "plots.list.world")) { MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world"); return false; } - if (!Perm.hasPermission(plr, "plots.list.world." + world)) { + if (!Permissions.hasPermission(plr, "plots.list.world." + world)) { MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world." + world); return false; } @@ -159,7 +159,7 @@ public class list extends SubCommand { break; } case "all": { - if (!Perm.hasPermission(plr, "plots.list.all")) { + if (!Permissions.hasPermission(plr, "plots.list.all")) { MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.all"); return false; } @@ -167,7 +167,7 @@ public class list extends SubCommand { break; } case "top": { - if (!Perm.hasPermission(plr, "plots.list.top")) { + if (!Permissions.hasPermission(plr, "plots.list.top")) { MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.top"); return false; } @@ -203,7 +203,7 @@ public class list extends SubCommand { break; } case "forsale": { - if (!Perm.hasPermission(plr, "plots.list.forsale")) { + if (!Permissions.hasPermission(plr, "plots.list.forsale")) { MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.forsale"); return false; } @@ -220,7 +220,7 @@ public class list extends SubCommand { break; } case "unowned": { - if (!Perm.hasPermission(plr, "plots.list.unowned")) { + if (!Permissions.hasPermission(plr, "plots.list.unowned")) { MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.unowned"); return false; } @@ -233,7 +233,7 @@ public class list extends SubCommand { break; } case "unknown": { - if (!Perm.hasPermission(plr, "plots.list.unknown")) { + if (!Permissions.hasPermission(plr, "plots.list.unknown")) { MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.unknown"); return false; } @@ -250,11 +250,11 @@ public class list extends SubCommand { } default: { if (PS.get().isPlotWorld(args[0])) { - if (!Perm.hasPermission(plr, "plots.list.world")) { + if (!Permissions.hasPermission(plr, "plots.list.world")) { MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world"); return false; } - if (!Perm.hasPermission(plr, "plots.list.world." + args[0])) { + if (!Permissions.hasPermission(plr, "plots.list.world." + args[0])) { MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world." + args[0]); return false; } @@ -263,7 +263,7 @@ public class list extends SubCommand { } UUID uuid = UUIDHandler.getUUID(args[0]); if (uuid != null) { - if (!Perm.hasPermission(plr, "plots.list.player")) { + if (!Permissions.hasPermission(plr, "plots.list.player")) { MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.player"); return false; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java index ab26e4130..639cb5bea 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java @@ -51,6 +51,11 @@ public enum C { MOVE_SUCCESS("$4Successfully moved plot.", "Move"), COPY_SUCCESS("$4Successfully copied plot.", "Move"), REQUIRES_UNOWNED("$2The location specified is already occupied.", "Move"), + /* + * Web + */ + GENERATING_LINK("$1Processing plot...", "Web"), + GENERATING_LINK_FAILED("$2Failed to generate download link!", "Web"), /* * Compass */ diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java index 135a10c42..d7150a464 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java @@ -38,6 +38,13 @@ public class Settings { public static boolean PERMISSION_CACHING = false; public static boolean CACHE_RATINGS = true; public static boolean UUID_FROM_DISK = false; + + /** + * Web + */ + public static String WEB_URL = "http://empcraft.com/plots/"; + public static String WEB_IP = "your.ip.here"; + /** * Ratings */ diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index 07ef19a11..8b3be7efc 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -362,7 +362,7 @@ public class SQLManager implements AbstractDB { for (int j = 0; j <= amount; j++) { final List subList = objList.subList(j * packet, Math.min(size, (j + 1) * packet)); if (subList.size() == 0) { - return; + break; } if (last == -1) { last = subList.size(); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java index e82a3a98b..3d9c49c4a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java @@ -106,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.Perm; +import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; @@ -333,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 (Perm.hasPermission(pp, "plots.worldedit.bypass")) { + if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) { WEManager.bypass.add(pp.getName()); } } @@ -391,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 (!Perm.hasPermission(pp, "plots.admin.entry.denied")) { + if (!Permissions.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()); @@ -464,7 +464,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } if (!plot.hasOwner()) { final PlotPlayer pp = BukkitUtil.getPlayer(player); - if (Perm.hasPermission(pp, "plots.admin.destroy.unowned")) { + if (Permissions.hasPermission(pp, "plots.admin.destroy.unowned")) { return; } MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.destroy.unowned"); @@ -478,7 +478,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if ((destroy != null) && ((HashSet) destroy.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) { return; } - if (Perm.hasPermission(pp, "plots.admin.destroy.other")) { + if (Permissions.hasPermission(pp, "plots.admin.destroy.other")) { return; } MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.destroy.other"); @@ -488,7 +488,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi return; } final PlotPlayer pp = BukkitUtil.getPlayer(player); - if (Perm.hasPermission(pp, "plots.admin.destroy.road")) { + if (Permissions.hasPermission(pp, "plots.admin.destroy.road")) { return; } if (MainUtil.isPlotArea(loc)) { @@ -535,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 (!Perm.hasPermission(player, "plots.worldedit.bypass")) { + if (!Permissions.hasPermission(player, "plots.worldedit.bypass")) { WEManager.bypass.remove(player.getName()); } else { @@ -566,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 (!Perm.hasPermission(pp, "plots.admin.build.road")) { + if (!Permissions.hasPermission(pp, "plots.admin.build.road")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road"); event.setCancelled(true); return; @@ -575,7 +575,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } else { if (!plot.hasOwner()) { final PlotPlayer pp = BukkitUtil.getPlayer(p); - if (!Perm.hasPermission(pp, "plots.admin.build.unowned")) { + if (!Permissions.hasPermission(pp, "plots.admin.build.unowned")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned"); event.setCancelled(true); return; @@ -583,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 (!Perm.hasPermission(pp, "plots.admin.build.other")) { + if (!Permissions.hasPermission(pp, "plots.admin.build.other")) { if (MainUtil.isPlotArea(loc)) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.other"); event.setCancelled(true); @@ -655,7 +655,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } if (!plot.hasOwner()) { final PlotPlayer pp = BukkitUtil.getPlayer(player); - if (Perm.hasPermission(pp, "plots.admin.destroy.unowned")) { + if (Permissions.hasPermission(pp, "plots.admin.destroy.unowned")) { return; } MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.destroy.unowned"); @@ -669,7 +669,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if ((destroy != null) && ((HashSet) destroy.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) { return; } - if (Perm.hasPermission(pp, "plots.admin.destroy.other")) { + if (Permissions.hasPermission(pp, "plots.admin.destroy.other")) { return; } MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.destroy.other"); @@ -679,7 +679,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi return; } final PlotPlayer pp = BukkitUtil.getPlayer(player); - if (Perm.hasPermission(pp, "plots.admin.destroy.road")) { + if (Permissions.hasPermission(pp, "plots.admin.destroy.road")) { return; } if (MainUtil.isPlotArea(loc)) { @@ -1166,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 (!Perm.hasPermission(pp, "plots.admin.build.road")) { + if (!Permissions.hasPermission(pp, "plots.admin.build.road")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road"); e.setCancelled(true); return; @@ -1175,7 +1175,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } else { if (!plot.hasOwner()) { final PlotPlayer pp = BukkitUtil.getPlayer(p); - if (!Perm.hasPermission(pp, "plots.admin.build.unowned")) { + if (!Permissions.hasPermission(pp, "plots.admin.build.unowned")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned"); e.setCancelled(true); return; @@ -1183,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 (!Perm.hasPermission(pp, "plots.admin.build.other")) { + if (!Permissions.hasPermission(pp, "plots.admin.build.other")) { if (MainUtil.isPlotArea(loc)) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.other"); e.setCancelled(true); @@ -1209,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 (Perm.hasPermission(pp, "plots.admin.enter.denied")) { + if (Permissions.hasPermission(pp, "plots.admin.enter.denied")) { return; } MainUtil.sendMessage(pp, C.YOU_BE_DENIED); @@ -1243,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 (Perm.hasPermission(pp, "plots.admin.build.road")) { + if (Permissions.hasPermission(pp, "plots.admin.build.road")) { return; } MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road"); @@ -1252,7 +1252,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } } else { if (!plot.hasOwner()) { - if (Perm.hasPermission(pp, "plots.admin.build.unowned")) { + if (Permissions.hasPermission(pp, "plots.admin.build.unowned")) { return; } MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned"); @@ -1263,7 +1263,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if ((use != null) && ((HashSet) use.getValue()).contains(new PlotBlock((short) e.getBucket().getId(), (byte) 0))) { return; } - if (Perm.hasPermission(pp, "plots.admin.build.other")) { + if (Permissions.hasPermission(pp, "plots.admin.build.other")) { return; } if (MainUtil.isPlotArea(loc)) { @@ -1331,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 (Perm.hasPermission(pp, "plots.admin.build.road")) { + if (Permissions.hasPermission(pp, "plots.admin.build.road")) { return; } MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road"); @@ -1340,7 +1340,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } } else { if (!plot.hasOwner()) { - if (Perm.hasPermission(pp, "plots.admin.build.unowned")) { + if (Permissions.hasPermission(pp, "plots.admin.build.unowned")) { return; } MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned"); @@ -1352,7 +1352,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if ((use != null) && ((HashSet) use.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) { return; } - if (Perm.hasPermission(pp, "plots.admin.build.other")) { + if (Permissions.hasPermission(pp, "plots.admin.build.other")) { return; } if (MainUtil.isPlotArea(loc)) { @@ -1385,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 (!Perm.hasPermission(pp, "plots.admin.build.road")) { + if (!Permissions.hasPermission(pp, "plots.admin.build.road")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road"); e.setCancelled(true); return; @@ -1393,7 +1393,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } } else { if (!plot.hasOwner()) { - if (!Perm.hasPermission(pp, "plots.admin.build.unowned")) { + if (!Permissions.hasPermission(pp, "plots.admin.build.unowned")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned"); e.setCancelled(true); return; @@ -1402,7 +1402,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (FlagManager.isPlotFlagTrue(plot, "hanging-place")) { return; } - if (!Perm.hasPermission(pp, "plots.admin.build.other")) { + if (!Permissions.hasPermission(pp, "plots.admin.build.other")) { if (MainUtil.isPlotArea(loc)) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.other"); e.setCancelled(true); @@ -1425,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 (!Perm.hasPermission(pp, "plots.admin.destroy.road")) { + if (!Permissions.hasPermission(pp, "plots.admin.destroy.road")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.destroy.road"); e.setCancelled(true); return; @@ -1433,7 +1433,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } } else { if (!plot.hasOwner()) { - if (!Perm.hasPermission(pp, "plots.admin.destroy.unowned")) { + if (!Permissions.hasPermission(pp, "plots.admin.destroy.unowned")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.destroy.unowned"); e.setCancelled(true); return; @@ -1442,7 +1442,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (FlagManager.isPlotFlagTrue(plot, "hanging-break")) { return; } - if (!Perm.hasPermission(pp, "plots.admin.destroy.other")) { + if (!Permissions.hasPermission(pp, "plots.admin.destroy.other")) { if (MainUtil.isPlotArea(l)) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.destroy.other"); e.setCancelled(true); @@ -1466,14 +1466,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (!MainUtil.isPlotAreaAbs(l)) { return; } - if (!Perm.hasPermission(pp, "plots.admin.interact.road")) { + if (!Permissions.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 (!Perm.hasPermission(pp, "plots.admin.interact.unowned")) { + if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.unowned"); e.setCancelled(true); return; @@ -1492,7 +1492,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if ((entity instanceof RideableMinecart) && FlagManager.isPlotFlagTrue(plot, "vehicle-use")) { return; } - if (!Perm.hasPermission(pp, "plots.admin.interact.other")) { + if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) { if (MainUtil.isPlotArea(l)) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.other"); e.setCancelled(true); @@ -1518,14 +1518,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (!MainUtil.isPlotAreaAbs(l)) { return; } - if (!Perm.hasPermission(pp, "plots.admin.vehicle.break.road")) { + if (!Permissions.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 (!Perm.hasPermission(pp, "plots.admin.vehicle.break.unowned")) { + if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.unowned")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.vehicle.break.unowned"); e.setCancelled(true); return; @@ -1536,7 +1536,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (FlagManager.isPlotFlagTrue(plot, "vehicle-break")) { return; } - if (!Perm.hasPermission(pp, "plots.admin.vehicle.break.other")) { + if (!Permissions.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); @@ -1612,7 +1612,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi return; } final PlotPlayer pp = BukkitUtil.getPlayer(p); - if (!Perm.hasPermission(pp, "plots.admin.pve.road")) { + if (!Permissions.hasPermission(pp, "plots.admin.pve.road")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pve.road"); e.setCancelled(true); return; @@ -1620,7 +1620,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } else { if (!plot.hasOwner()) { final PlotPlayer pp = BukkitUtil.getPlayer(p); - if (!Perm.hasPermission(pp, "plots.admin.pve.unowned")) { + if (!Permissions.hasPermission(pp, "plots.admin.pve.unowned")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pve.unowned"); if (projectile != null) { projectile.remove(); @@ -1647,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 (!Perm.hasPermission(pp, "plots.admin.pve.other")) { + if (!Permissions.hasPermission(pp, "plots.admin.pve.other")) { if (MainUtil.isPlotArea(l)) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.pve.other"); if (projectile != null) { @@ -1678,20 +1678,20 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (!MainUtil.isPlotAreaAbs(l)) { return; } - if (!Perm.hasPermission(pp, "plots.admin.projectile.road")) { + if (!Permissions.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 (!Perm.hasPermission(pp, "plots.admin.projectile.unowned")) { + if (!Permissions.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 (!Perm.hasPermission(pp, "plots.admin.projectile.other")) { + if (!Permissions.hasPermission(pp, "plots.admin.projectile.other")) { if (MainUtil.isPlotArea(l)) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.projectile.other"); e.setHatching(false); @@ -1715,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 (!Perm.hasPermission(pp, "plots.admin.build.unowned")) { + if (!Permissions.hasPermission(pp, "plots.admin.build.unowned")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned"); event.setCancelled(true); return; @@ -1724,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) place.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) && !Perm.hasPermission(pp, "plots.admin.build.other")) { + if (((place == null) || !((HashSet) place.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) && !Permissions.hasPermission(pp, "plots.admin.build.other")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.other"); event.setCancelled(true); return; @@ -1736,7 +1736,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } return; } - else if (!Perm.hasPermission(pp, "plots.admin.build.road")) { + else if (!Permissions.hasPermission(pp, "plots.admin.build.road")) { if (MainUtil.isPlotAreaAbs(loc)) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road"); event.setCancelled(true); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java index fd8139242..c0cfe0066 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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 (!Perm.hasPermission(pp, "plots.admin.interact.road")) { + if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.road"); cancelled = true; } } else { if (!plot.hasOwner()) { - if (!Perm.hasPermission(pp, "plots.admin.interact.unowned")) { + if (!Permissions.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 (!Perm.hasPermission(pp, "plots.admin.interact.other")) { + if (!Permissions.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 (!Perm.hasPermission(pp, "plots.admin.interact.road")) { + if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.road"); e.setCancelled(true); } } else { if (!plot.hasOwner()) { - if (!Perm.hasPermission(pp, "plots.admin.interact.unowned")) { + if (!Permissions.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 (!Perm.hasPermission(pp, "plots.admin.interact.other")) { + if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.other"); e.setCancelled(true); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java index e3143d91a..c29de3453 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java @@ -51,7 +51,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.Perm; +import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; @@ -175,7 +175,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 (Perm.hasPermission(pt, "plots.flag.notify-enter.bypass")) { + if (Permissions.hasPermission(pt, "plots.flag.notify-enter.bypass")) { return; } if (plot.hasOwner()) { @@ -214,7 +214,7 @@ public class PlotPlusListener extends PlotListener implements Listener { feedRunnable.remove(leaver.getName()); healRunnable.remove(leaver.getName()); if (FlagManager.isBooleanFlag(plot, "notify-leave", false)) { - if (Perm.hasPermission(pl, "plots.flag.notify-leave.bypass")) { + if (Permissions.hasPermission(pl, "plots.flag.notify-leave.bypass")) { return; } if (plot.hasOwner()) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WEListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WEListener.java index c44c9c8f8..d88226c61 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WEListener.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WEListener.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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 (Perm.hasPermission(player, "plots.worldedit.bypass")) { + if (Permissions.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 (Perm.hasPermission(pp, "plots.worldedit.bypass")) { + if (Permissions.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 (Perm.hasPermission(pp, "plots.worldedit.bypass")) { + if (Permissions.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 (Perm.hasPermission(pp, "plots.worldedit.bypass")) { + if (Permissions.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 (Perm.hasPermission(pp, "plots.worldedit.bypass")) { + if (Permissions.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 (Perm.hasPermission(pp, "plots.worldedit.bypass")) { + if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) { MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASS); } return true; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WESubscriber.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WESubscriber.java index ae9e108d6..e1819905e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WESubscriber.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WESubscriber.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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 mask = WEManager.getMask(player); if (mask.size() == 0) { - if (Perm.hasPermission(player, "plots.worldedit.bypass")) { + if (Permissions.hasPermission(player, "plots.worldedit.bypass")) { MainUtil.sendMessage(player, C.WORLDEDIT_BYPASS); } event.setExtent(new NullExtent()); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/InboxOwner.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/InboxOwner.java index 745d58902..34ebf02a7 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/InboxOwner.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/InboxOwner.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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 Perm.hasPermission(player, "plots.inbox.read." + toString()); + return Permissions.hasPermission(player, "plots.inbox.read." + toString()); } - return (Perm.hasPermission(player, "plots.inbox.read." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Perm.hasPermission(player, "plots.inbox.read." + toString() + ".other"))); + return (Permissions.hasPermission(player, "plots.inbox.read." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Permissions.hasPermission(player, "plots.inbox.read." + toString() + ".other"))); } @Override public boolean canWrite(Plot plot, PlotPlayer player) { if (plot == null) { - return Perm.hasPermission(player, "plots.inbox.write." + toString()); + return Permissions.hasPermission(player, "plots.inbox.write." + toString()); } - return (Perm.hasPermission(player, "plots.inbox.write." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Perm.hasPermission(player, "plots.inbox.write." + toString() + ".other"))); + return (Permissions.hasPermission(player, "plots.inbox.write." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Permissions.hasPermission(player, "plots.inbox.write." + toString() + ".other"))); } @Override public boolean canModify(Plot plot, PlotPlayer player) { if (plot == null) { - return Perm.hasPermission(player, "plots.inbox.modify." + toString()); + return Permissions.hasPermission(player, "plots.inbox.modify." + toString()); } - return (Perm.hasPermission(player, "plots.inbox.modify." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Perm.hasPermission(player, "plots.inbox.modify." + toString() + ".other"))); + return (Permissions.hasPermission(player, "plots.inbox.modify." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Permissions.hasPermission(player, "plots.inbox.modify." + toString() + ".other"))); } @Override diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/InboxPublic.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/InboxPublic.java index 850d3c8a8..77c924ab1 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/InboxPublic.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/InboxPublic.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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 Perm.hasPermission(player, "plots.inbox.read." + toString()); + return Permissions.hasPermission(player, "plots.inbox.read." + toString()); } - return (Perm.hasPermission(player, "plots.inbox.read." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Perm.hasPermission(player, "plots.inbox.read." + toString() + ".other"))); + return (Permissions.hasPermission(player, "plots.inbox.read." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Permissions.hasPermission(player, "plots.inbox.read." + toString() + ".other"))); } @Override public boolean canWrite(Plot plot, PlotPlayer player) { if (plot == null) { - return Perm.hasPermission(player, "plots.inbox.write." + toString()); + return Permissions.hasPermission(player, "plots.inbox.write." + toString()); } - return (Perm.hasPermission(player, "plots.inbox.write." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Perm.hasPermission(player, "plots.inbox.write." + toString() + ".other"))); + return (Permissions.hasPermission(player, "plots.inbox.write." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Permissions.hasPermission(player, "plots.inbox.write." + toString() + ".other"))); } @Override public boolean canModify(Plot plot, PlotPlayer player) { if (plot == null) { - return Perm.hasPermission(player, "plots.inbox.modify." + toString()); + return Permissions.hasPermission(player, "plots.inbox.modify." + toString()); } - return (Perm.hasPermission(player, "plots.inbox.modify." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Perm.hasPermission(player, "plots.inbox.modify." + toString() + ".other"))); + return (Permissions.hasPermission(player, "plots.inbox.modify." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Permissions.hasPermission(player, "plots.inbox.modify." + toString() + ".other"))); } @Override diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/InboxReport.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/InboxReport.java index fa5a2ef73..d0e8f8179 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/InboxReport.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/InboxReport.java @@ -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.Perm; +import com.intellectualcrafters.plot.util.Permissions; 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 Perm.hasPermission(player, "plots.inbox.read." + toString()); + return Permissions.hasPermission(player, "plots.inbox.read." + toString()); } - return (Perm.hasPermission(player, "plots.inbox.read." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Perm.hasPermission(player, "plots.inbox.read." + toString() + ".other"))); + return (Permissions.hasPermission(player, "plots.inbox.read." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Permissions.hasPermission(player, "plots.inbox.read." + toString() + ".other"))); } @Override public boolean canWrite(Plot plot, PlotPlayer player) { if (plot == null) { - return Perm.hasPermission(player, "plots.inbox.write." + toString()); + return Permissions.hasPermission(player, "plots.inbox.write." + toString()); } - return (Perm.hasPermission(player, "plots.inbox.write." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Perm.hasPermission(player, "plots.inbox.write." + toString() + ".other"))); + return (Permissions.hasPermission(player, "plots.inbox.write." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Permissions.hasPermission(player, "plots.inbox.write." + toString() + ".other"))); } @Override public boolean canModify(Plot plot, PlotPlayer player) { if (plot == null) { - return Perm.hasPermission(player, "plots.inbox.modify." + toString()); + return Permissions.hasPermission(player, "plots.inbox.modify." + toString()); } - return (Perm.hasPermission(player, "plots.inbox.modify." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Perm.hasPermission(player, "plots.inbox.modify." + toString() + ".other"))); + return (Permissions.hasPermission(player, "plots.inbox.modify." + toString()) && (PlotHandler.isOwner(plot, player.getUUID()) || Permissions.hasPermission(player, "plots.inbox.modify." + toString() + ".other"))); } @Override diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java index 0c6f8a5fe..f94732058 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java @@ -79,82 +79,82 @@ public abstract class EventUtil { } case BREAK_BLOCK: { if (plot == null) { - return Perm.hasPermission(pp, Perm.BREAK_ROAD.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.BREAK_ROAD.s, notifyPerms); } if (!plot.hasOwner()) { - return Perm.hasPermission(pp, Perm.BREAK_UNOWNED.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.BREAK_UNOWNED.s, notifyPerms); } Flag flag = FlagManager.getPlotFlag(plot, "break"); HashSet value = flag == null ? null : (HashSet) flag.getValue(); if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) { - return Perm.hasPermission(pp, Perm.BREAK_OTHER.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.BREAK_OTHER.s, notifyPerms); } } case BREAK_HANGING: if (plot == null) { - return Perm.hasPermission(pp, Perm.BREAK_ROAD.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.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 Permissions.hasPermission(pp, Permissions.BREAK_OTHER.s, notifyPerms); } - return Perm.hasPermission(pp, Perm.BREAK_UNOWNED.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.BREAK_UNOWNED.s, notifyPerms); case BREAK_MISC: if (plot == null) { - return Perm.hasPermission(pp, Perm.BREAK_ROAD.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.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 Permissions.hasPermission(pp, Permissions.BREAK_OTHER.s, notifyPerms); } - return Perm.hasPermission(pp, Perm.BREAK_UNOWNED.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.BREAK_UNOWNED.s, notifyPerms); case BREAK_VEHICLE: if (plot == null) { - return Perm.hasPermission(pp, Perm.BREAK_ROAD.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.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 Permissions.hasPermission(pp, Permissions.BREAK_OTHER.s, notifyPerms); } - return Perm.hasPermission(pp, Perm.BREAK_UNOWNED.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.BREAK_UNOWNED.s, notifyPerms); case INTERACT_BLOCK: { if (plot == null) { - return Perm.hasPermission(pp, Perm.INTERACT_ROAD.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.INTERACT_ROAD.s, notifyPerms); } if (!plot.hasOwner()) { - return Perm.hasPermission(pp, Perm.INTERACT_UNOWNED.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.INTERACT_UNOWNED.s, notifyPerms); } Flag flag = FlagManager.getPlotFlag(plot, "use"); HashSet value = flag == null ? null : (HashSet) flag.getValue(); if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) { - return Perm.hasPermission(pp, Perm.INTERACT_OTHER.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms); } } case PLACE_BLOCK: { if (plot == null) { - return Perm.hasPermission(pp, Perm.BUILD_ROAD.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.BUILD_ROAD.s, notifyPerms); } if (!plot.hasOwner()) { - return Perm.hasPermission(pp, Perm.BUILD_UNOWNED.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.BUILD_UNOWNED.s, notifyPerms); } Flag flag = FlagManager.getPlotFlag(plot, "place"); HashSet value = flag == null ? null : (HashSet) flag.getValue(); if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) { - return Perm.hasPermission(pp, Perm.BUILD_OTHER.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.BUILD_OTHER.s, notifyPerms); } } case TRIGGER_PHYSICAL: { if (plot == null) { - return Perm.hasPermission(pp, Perm.INTERACT_ROAD.s, false); + return Permissions.hasPermission(pp, Permissions.INTERACT_ROAD.s, false); } if (!plot.hasOwner()) { - return Perm.hasPermission(pp, Perm.INTERACT_UNOWNED.s, false); + return Permissions.hasPermission(pp, Permissions.INTERACT_UNOWNED.s, false); } if (FlagManager.isPlotFlagTrue(plot, "device-interact")) { return true; @@ -162,15 +162,15 @@ public abstract class EventUtil { Flag flag = FlagManager.getPlotFlag(plot, "use"); HashSet value = flag == null ? null : (HashSet) flag.getValue(); if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) { - return Perm.hasPermission(pp, Perm.INTERACT_OTHER.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms); } } case INTERACT_HANGING: { if (plot == null) { - return Perm.hasPermission(pp, Perm.INTERACT_ROAD.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.INTERACT_ROAD.s, notifyPerms); } if (!plot.hasOwner()) { - return Perm.hasPermission(pp, Perm.INTERACT_UNOWNED.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.INTERACT_UNOWNED.s, notifyPerms); } if (FlagManager.isPlotFlagTrue(plot, "hanging-interact")) { return true; @@ -178,15 +178,15 @@ public abstract class EventUtil { Flag flag = FlagManager.getPlotFlag(plot, "use"); HashSet value = flag == null ? null : (HashSet) flag.getValue(); if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) { - return Perm.hasPermission(pp, Perm.INTERACT_OTHER.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms); } } case INTERACT_MISC: { if (plot == null) { - return Perm.hasPermission(pp, Perm.INTERACT_ROAD.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.INTERACT_ROAD.s, notifyPerms); } if (!plot.hasOwner()) { - return Perm.hasPermission(pp, Perm.INTERACT_UNOWNED.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.INTERACT_UNOWNED.s, notifyPerms); } if (FlagManager.isPlotFlagTrue(plot, "misc-interact")) { return true; @@ -194,15 +194,15 @@ public abstract class EventUtil { Flag flag = FlagManager.getPlotFlag(plot, "use"); HashSet value = flag == null ? null : (HashSet) flag.getValue(); if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) { - return Perm.hasPermission(pp, Perm.INTERACT_OTHER.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms); } } case INTERACT_VEHICLE: { if (plot == null) { - return Perm.hasPermission(pp, Perm.INTERACT_ROAD.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.INTERACT_ROAD.s, notifyPerms); } if (!plot.hasOwner()) { - return Perm.hasPermission(pp, Perm.INTERACT_UNOWNED.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.INTERACT_UNOWNED.s, notifyPerms); } if (FlagManager.isPlotFlagTrue(plot, "vehicle-use")) { return true; @@ -210,15 +210,15 @@ public abstract class EventUtil { Flag flag = FlagManager.getPlotFlag(plot, "use"); HashSet value = flag == null ? null : (HashSet) flag.getValue(); if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) { - return Perm.hasPermission(pp, Perm.INTERACT_OTHER.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms); } } case SPAWN_MOB: { if (plot == null) { - return Perm.hasPermission(pp, Perm.INTERACT_OTHER.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms); } if (!plot.hasOwner()) { - return Perm.hasPermission(pp, Perm.INTERACT_UNOWNED.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.INTERACT_UNOWNED.s, notifyPerms); } if (FlagManager.isPlotFlagTrue(plot, "mob-place")) { @@ -227,7 +227,7 @@ public abstract class EventUtil { Flag flag = FlagManager.getPlotFlag(plot, "place"); HashSet value = flag == null ? null : (HashSet) flag.getValue(); if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) { - return Perm.hasPermission(pp, Perm.INTERACT_OTHER.s, notifyPerms); + return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms); } } case PLACE_HANGING: diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index 6bfb2308d..c47c37dec 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -353,7 +353,7 @@ public class MainUtil { else { location = getDefaultHome(plot); } - if ((Settings.TELEPORT_DELAY == 0) || Perm.hasPermission(player, "plots.teleport.delay.bypass")) { + if ((Settings.TELEPORT_DELAY == 0) || Permissions.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()) && !Perm.hasPermission(player, "plots.admin.command.claim")) { + if (!cluster.isAdded(player.getUUID()) && !Permissions.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 Perm.hasPermissionRange(p, "plots.plot", Settings.MAX_PLOTS); + return Permissions.hasPermissionRange(p, "plots.plot", Settings.MAX_PLOTS); } public static Plot getPlot(final Location loc) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Perm.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Permissions.java similarity index 97% rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Perm.java rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Permissions.java index f0a1b476f..26c7c9f88 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Perm.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Permissions.java @@ -3,7 +3,7 @@ package com.intellectualcrafters.plot.util; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.PlotPlayer; -public enum Perm { +public enum Permissions { // ADMIN ADMIN("plots.admin", "do-not-change"), // BUILD @@ -22,7 +22,7 @@ public enum Perm { public String s; public String cat; - Perm(String perm, String cat) { + Permissions(String perm, String cat) { this.s = perm; this.cat = cat; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java index eaf8a75d1..971a65438 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java @@ -1,17 +1,26 @@ package com.intellectualcrafters.plot.util; +import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLConnection; +import java.nio.file.Files; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.UUID; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; @@ -212,8 +221,7 @@ public abstract class SchematicHandler { final short[] blocks = new short[b.length]; final Dimension dimension = new Dimension(width, height, length); for (int index = 0; index < b.length; index++) { - if ((index >> 1) >= addId.length) { // No corresponding - // AddBlocks index + if ((index >> 1) >= addId.length) { blocks[index] = (short) (b[index] & 0xFF); } else { if ((index & 1) == 0) { @@ -289,6 +297,56 @@ public abstract class SchematicHandler { } } + public URL upload(final CompoundTag tag) { + if (tag == null) { + PS.log("&cCannot save empty tag"); + return null; + } + try { + UUID uuid = UUID.randomUUID(); + String website = Settings.WEB_URL + "upload.php?" + uuid; + String charset = "UTF-8"; + String param = "value"; + String boundary = Long.toHexString(System.currentTimeMillis()); + String CRLF = "\r\n"; + URLConnection con = new URL(website).openConnection(); + con.setDoOutput(true); + con.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary); + try ( + OutputStream output = con.getOutputStream(); + PrintWriter writer = new PrintWriter(new OutputStreamWriter(output, charset), true); + ) { + writer.append("--" + boundary).append(CRLF); + writer.append("Content-Disposition: form-data; name=\"param\"").append(CRLF); + writer.append("Content-Type: text/plain; charset=" + charset).append(CRLF); + writer.append(CRLF).append(param).append(CRLF).flush(); + writer.append("--" + boundary).append(CRLF); + writer.append("Content-Disposition: form-data; name=\"schematicFile\"; filename=\"" + "plot.schematic" + "\"").append(CRLF); + writer.append("Content-Type: " + URLConnection.guessContentTypeFromName("plot.schematic")).append(CRLF); + writer.append("Content-Transfer-Encoding: binary").append(CRLF); + writer.append(CRLF).flush(); + GZIPOutputStream gzip = new GZIPOutputStream(output); + NBTOutputStream nos = new NBTOutputStream(gzip); + nos.writeTag(tag); + gzip.finish(); + nos.flush(); + output.flush(); + writer.append(CRLF).flush(); + writer.append("--" + boundary + "--").append(CRLF).flush(); + nos.close(); + output.close(); + } + int responseCode = ((HttpURLConnection) con).getResponseCode(); + if (responseCode != 200) { + return null; + } + return new URL(Settings.WEB_URL + "?key=" + uuid + "&ip=" + Settings.WEB_IP); + } catch (final Exception e) { + e.printStackTrace(); + } + return null; + } + /** * Saves a schematic to a file path *