From afef79ea66c49a3c9bc712a2a7ec6dec0ca91711 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Thu, 3 Sep 2015 15:45:25 +1000 Subject: [PATCH] Some changes Fixes #605 Possibly #604 Other minor tweaks --- .../com/intellectualcrafters/plot/PS.java | 2 - .../plot/commands/CreateRoadSchematic.java | 2 +- .../plot/commands/DebugRoadRegen.java | 2 + .../plot/commands/FlagCmd.java | 8 +- .../plot/object/Plot.java | 25 ++++++ .../plot/object/Rating.java | 9 +- .../plot/util/ExpireManager.java | 2 +- .../plot/util/MainUtil.java | 2 +- .../plot/util/Permissions.java | 16 +++- .../database/plotme/LikePlotMeConverter.java | 10 ++- .../bukkit/listeners/ChunkListener.java | 13 ++- .../bukkit/listeners/PlayerEvents.java | 2 +- .../listeners/worldedit/WESubscriber.java | 1 - .../bukkit/object/BukkitPlayer.java | 44 ++++++---- .../bukkit/util/SetBlockFast_1_8.java | 3 - .../com/plotsquared/sponge/SpongeMain.java | 8 +- .../sponge/events/PlayerClaimPlotEvent.java | 2 +- .../sponge/events/PlayerEnterPlotEvent.java | 2 +- .../sponge/events/PlayerEvent.java | 2 +- .../sponge/events/PlayerLeavePlotEvent.java | 2 +- .../sponge/events/PlayerPlotDeniedEvent.java | 2 +- .../sponge/events/PlayerPlotHelperEvent.java | 2 +- .../sponge/events/PlayerPlotTrustedEvent.java | 2 +- .../events/PlayerTeleportToPlotEvent.java | 2 +- .../sponge/listener/MainListener.java | 75 +++++++--------- .../sponge/object/SpongePlayer.java | 6 +- .../sponge/util/SpongeCommand.java | 2 +- .../sponge/util/SpongeInventoryUtil.java | 2 +- .../plotsquared/sponge/util/SpongeUtil.java | 2 +- .../uuid/SpongeLowerOfflineUUIDWrapper.java | 2 +- src/main/resources/plugin.yml | 87 ++++++++++--------- 31 files changed, 195 insertions(+), 146 deletions(-) diff --git a/src/main/java/com/intellectualcrafters/plot/PS.java b/src/main/java/com/intellectualcrafters/plot/PS.java index a77d8b979..13b0812da 100644 --- a/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/src/main/java/com/intellectualcrafters/plot/PS.java @@ -1835,8 +1835,6 @@ public class PS { options.put("cache.permissions", Settings.PERMISSION_CACHING); options.put("cache.ratings", Settings.CACHE_RATINGS); - options.put("cache.ratings", Settings.CACHE_RATINGS); - // Titles options.put("titles", Settings.TITLES); diff --git a/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java b/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java index 3294923ef..1f0937750 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java @@ -52,7 +52,7 @@ public class CreateRoadSchematic extends SubCommand { return sendMessage(player, C.NOT_IN_PLOT_WORLD); } HybridUtils.manager.setupRoadSchematic(plot); - MainUtil.sendMessage(player, "&6Saved new road schematic (see console for more information)"); + MainUtil.sendMessage(player, "&6Saved new road schematic. To test the road, fly to a few other plots and use /plot debugroadregen"); return true; } } diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java index c42f596bb..bd919fc78 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java @@ -69,6 +69,7 @@ public class DebugRoadRegen extends SubCommand { } boolean result = HybridUtils.manager.regenerateRoad(world, chunk, extend); MainUtil.sendMessage(player, "&6Regenerating chunk: " + chunk.x + "," + chunk.z + "\n&6 - Result: " + (result == true ? "&aSuccess" : "&cFailed")); + MainUtil.sendMessage(player, "&cTo regenerate all roads: /plot regenallroads"); } else { HybridPlotManager manager = (HybridPlotManager) PS.get().getPlotManager(world); @@ -76,6 +77,7 @@ public class DebugRoadRegen extends SubCommand { manager.createRoadSouth(plotworld, plot); manager.createRoadSouthEast(plotworld, plot); MainUtil.sendMessage(player, "&6Regenerating plot south/east roads: " + plot.id + "\n&6 - Result: &aSuccess"); + MainUtil.sendMessage(player, "&cTo regenerate all roads: /plot regenallroads"); } return true; } diff --git a/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java b/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java index cc197a42a..58520793a 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java @@ -125,8 +125,8 @@ public class FlagCmd extends SubCommand { return false; } final String value = StringMan.join(Arrays.copyOfRange(args, 2, args.length), " "); - if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase()) && !Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + "." + value.toLowerCase())) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase()); + if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + "." + value.toLowerCase())) { + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + "." + value.toLowerCase()); return false; } final Object parsed = af.parseValueRaw(value); @@ -161,7 +161,7 @@ public class FlagCmd extends SubCommand { if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) { for (String entry : args[2].split(",")) { if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + "." + entry)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase()); + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + "." + entry); return false; } } @@ -201,7 +201,7 @@ public class FlagCmd extends SubCommand { if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) { for (String entry : args[2].split(",")) { if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + "." + entry)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase()); + MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + "." + entry); return false; } } diff --git a/src/main/java/com/intellectualcrafters/plot/object/Plot.java b/src/main/java/com/intellectualcrafters/plot/object/Plot.java index c447c21bd..489bb02fc 100644 --- a/src/main/java/com/intellectualcrafters/plot/object/Plot.java +++ b/src/main/java/com/intellectualcrafters/plot/object/Plot.java @@ -542,6 +542,31 @@ public class Plot { PlotAnalysis.analyzePlot(this, whenDone); } + /** + * Set a flag for this plot + * @param flag + * @param value + */ + public void setFlag(String flag, Object value) { + FlagManager.addPlotFlag(this, new Flag(FlagManager.getFlag(flag), value)); + } + + /** + * Remove a flag from this plot + * @param flag + */ + public void removeFlag(String flag) { + FlagManager.removePlotFlag(this, flag); + } + + /** + * Get the flag for a given key + * @param flag + */ + public Flag getFlag(String key) { + return FlagManager.getPlotFlag(this, key); + } + /** * Delete a plot * @see PS#removePlot(String, PlotId, boolean) diff --git a/src/main/java/com/intellectualcrafters/plot/object/Rating.java b/src/main/java/com/intellectualcrafters/plot/object/Rating.java index b701baa1a..d2928b687 100644 --- a/src/main/java/com/intellectualcrafters/plot/object/Rating.java +++ b/src/main/java/com/intellectualcrafters/plot/object/Rating.java @@ -18,7 +18,15 @@ public class Rating { private int initial; public Rating(int value) { + this.initial = value; ratingMap = new HashMap<>(); + if (value < 10) { + for (int i = 0 ; i < Settings.RATING_CATEGORIES.size(); i++) { + ratingMap.put(Settings.RATING_CATEGORIES.get(i), value); + } + changed = true; + return; + } if (Settings.RATING_CATEGORIES != null && Settings.RATING_CATEGORIES.size() > 1) { for (int i = 0 ; i < Settings.RATING_CATEGORIES.size(); i++) { ratingMap.put(Settings.RATING_CATEGORIES.get(i), (value % 10) - 1); @@ -28,7 +36,6 @@ public class Rating { else { ratingMap.put(null, value); } - this.initial = value; } public List getCategories() { diff --git a/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java b/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java index d018891b9..5b7af320a 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java +++ b/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java @@ -122,7 +122,7 @@ public class ExpireManager { public void run() { PlotAnalysis changed = this.value; if (Settings.CLEAR_THRESHOLD != -1 && plotworld.TYPE == 0 && changed != null) { - if (changed.getComplexity() > Settings.CLEAR_THRESHOLD) { + if (changed.changes != 0 && changed.getComplexity() > Settings.CLEAR_THRESHOLD) { PS.debug("$2[&5Expire&dManager$2] &bIgnoring modified plot: " + plot + " : " + changed.getComplexity() + " - " + changed.changes); expiredPlots.get(world).remove(plot); FlagManager.addPlotFlag(plot, new Flag(FlagManager.getFlag("analysis"), changed.asList())); diff --git a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index 26cc2928e..63566922f 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -1261,7 +1261,7 @@ public class MainUtil { Location loc = new Location(bot.getWorld(), bot.getX() + home.x, bot.getY() + home.y, bot.getZ() + home.z); if (BlockManager.manager.getBlock(loc).id != 0) { // sendConsoleMessage("ID was " + BukkitUtil.getBlock(loc).id); - loc.setY(Math.max(getHeighestBlock(w, bot.getX(), bot.getZ()), bot.getY())); + loc.setY(Math.max(getHeighestBlock(w, loc.getX(), loc.getZ()), bot.getY())); } return loc; } diff --git a/src/main/java/com/intellectualcrafters/plot/util/Permissions.java b/src/main/java/com/intellectualcrafters/plot/util/Permissions.java index 9b819d0f4..fc5af3478 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/Permissions.java +++ b/src/main/java/com/intellectualcrafters/plot/util/Permissions.java @@ -1,5 +1,7 @@ package com.intellectualcrafters.plot.util; +import org.bukkit.permissions.Permission; + import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.PlotPlayer; import com.plotsquared.general.commands.CommandCaller; @@ -13,13 +15,24 @@ public class Permissions { return hasPermission((CommandCaller) player, perm); } - public static boolean hasPermission(final CommandCaller player, final String perm) { + public static boolean hasPermission(final CommandCaller player, String perm) { if ((player == null) || player.hasPermission(C.PERMISSION_ADMIN.s()) || player.hasPermission(C.PERMISSION_STAR.s())) { return true; } if (player.hasPermission(perm)) { return true; } + perm = perm.toLowerCase().replaceAll("^[^a-z|0-9|\\.|_|-]", ""); + String[] nodes = perm.split("\\."); + final StringBuilder n = new StringBuilder(); + for (int i = 0; i < (nodes.length - 1); i++) { + n.append(nodes[i] + (".")); + if (!perm.equals(n + C.PERMISSION_STAR.s())) { + if (player.hasPermission(n + C.PERMISSION_STAR.s())) { + return true; + } + } + } return false; } @@ -40,6 +53,7 @@ public class Permissions { if (player.hasPermission(stub + ".*")) { return Integer.MAX_VALUE; } + System.out.print(range); for (int i = range; i > 0; i--) { if (player.hasPermission(stub + "." + i)) { return i; diff --git a/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java b/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java index a885d6ddf..e6929826c 100644 --- a/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java +++ b/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java @@ -190,8 +190,16 @@ public class LikePlotMeConverter { pathwidth = 7; } PS.get().config.set("worlds." + world + ".road.width", pathwidth); + + Integer pathheight = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".RoadHeight"); // + if (pathheight == null || pathheight == 0) { + pathheight = 64; + } + PS.get().config.set("worlds." + world + ".road.height", pathheight); + PS.get().config.set("worlds." + world + ".wall.height", pathheight); + PS.get().config.set("worlds." + world + ".plot.height", pathheight); Integer plotsize = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".PlotSize"); // - if (plotsize == null) { + if (plotsize == null || plotsize == 0) { plotsize = 32; } PS.get().config.set("worlds." + world + ".plot.size", plotsize); diff --git a/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java b/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java index 2a90a85ef..d2885b8a4 100644 --- a/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java +++ b/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java @@ -68,6 +68,9 @@ public class ChunkListener implements Listener { PlotPlayer pp = entry.getValue(); Location loc = pp.getLocation(); String world = loc.getWorld(); + if (!PS.get().isPlotWorld(world)) { + continue; + } HashMap map = players.get(world); if (map == null) { map = new HashMap<>(); @@ -107,8 +110,10 @@ public class ChunkListener implements Listener { for (World world : Bukkit.getWorlds()) { String name = world.getName(); boolean autosave = world.isAutoSave(); - boolean plotworld = PS.get().isPlotWorld(name); - if (!Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE && autosave && plotworld) { + if (!PS.get().isPlotWorld(name)) { + continue; + } + if (!Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE && autosave) { world.setAutoSave(false); } HashMap map = players.get(name); @@ -119,12 +124,12 @@ public class ChunkListener implements Listener { int x = chunk.getX(); int z = chunk.getZ(); if (!map.containsKey(new ChunkLoc(x, z))) { - if (!Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE || !plotworld || !unloadChunk(name, chunk)) { + if (!Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE || !unloadChunk(name, chunk)) { chunk.unload(true, false); } } } - if (!Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE && autosave && plotworld) { + if (!Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE && autosave) { world.setAutoSave(true); } } diff --git a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index d6dedea39..f43e43852 100644 --- a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -346,7 +346,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen } Flag flag; - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS) && (flag = FlagManager.getPlotFlag(plot, "blocked-cmds")) != null) { + if ((flag = FlagManager.getPlotFlag(plot, "blocked-cmds")) != null && !Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) { List v = (List) flag.getValue(); String msg = event.getMessage().toLowerCase().replaceFirst("/", ""); diff --git a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WESubscriber.java b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WESubscriber.java index 6736a1f2c..5bff0cb6a 100644 --- a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WESubscriber.java +++ b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WESubscriber.java @@ -61,7 +61,6 @@ public class WESubscriber { if (pp != null && pp.getAttribute("worldedit")) { return; } - PlotPlayer player = UUIDHandler.getPlayer(actor.getName()); HashSet mask = WEManager.getMask(player); PlotWorld plotworld = PS.get().getPlotWorld(world); diff --git a/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java b/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java index f33005e74..82fde8eb3 100644 --- a/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java +++ b/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java @@ -1,17 +1,16 @@ package com.plotsquared.bukkit.object; import java.util.HashSet; -import java.util.Map; import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.GameMode; -import org.bukkit.Material; import org.bukkit.WeatherType; import org.bukkit.entity.Player; import org.bukkit.permissions.Permission; import org.bukkit.permissions.PermissionDefault; +import org.bukkit.plugin.PluginManager; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; @@ -19,7 +18,6 @@ import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.MainUtil; -import com.intellectualcrafters.plot.util.MathMan; import com.intellectualcrafters.plot.util.PlotGamemode; import com.intellectualcrafters.plot.util.PlotWeather; import com.intellectualcrafters.plot.util.UUIDHandler; @@ -83,22 +81,7 @@ public class BukkitPlayer extends PlotPlayer { return EconHandler.manager.hasPermission(getName(), node); } boolean value = this.player.hasPermission(node); - if (!value) { - final String[] nodes = node.split("\\."); - if (!MathMan.isInteger(nodes[nodes.length - 1])) { - final StringBuilder n = new StringBuilder(); - for (int i = 0; i < (nodes.length - 1); i++) { - n.append(nodes[i] + (".")); - if (!node.equals(n + C.PERMISSION_STAR.s())) { - value = player.hasPermission(n + C.PERMISSION_STAR.s()); - if (value) { - break; - } - } - } - value = this.player.hasPermission(node); - } - } + System.out.print(value + " | " + node); if (Settings.PERMISSION_CACHING) { if (value) { this.hasPerm.add(node); @@ -110,6 +93,29 @@ public class BukkitPlayer extends PlotPlayer { return value; } + public Permission getPermission(String node) { + PluginManager manager = Bukkit.getPluginManager(); + Permission perm = manager.getPermission(node); + if (perm == null) { + String[] nodes = node.split("\\."); + perm = new Permission(node); + final StringBuilder n = new StringBuilder(); + for (int i = 0; i < (nodes.length - 1); i++) { + n.append(nodes[i] + (".")); + if (!node.equals(n + C.PERMISSION_STAR.s())) { + Permission parent = getPermission(n + C.PERMISSION_STAR.s()); + if (parent != null) { + perm.addParent(parent, true); + } + } + } + manager.addPermission(perm); + } + manager.recalculatePermissionDefaults(perm); + perm.recalculatePermissibles(); + return perm; + } + @Override public void sendMessage(final String message) { this.player.sendMessage(message); diff --git a/src/main/java/com/plotsquared/bukkit/util/SetBlockFast_1_8.java b/src/main/java/com/plotsquared/bukkit/util/SetBlockFast_1_8.java index ad747ca0e..bd11497df 100644 --- a/src/main/java/com/plotsquared/bukkit/util/SetBlockFast_1_8.java +++ b/src/main/java/com/plotsquared/bukkit/util/SetBlockFast_1_8.java @@ -197,7 +197,6 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager { case 47: case 48: case 49: - case 50: case 51: case 52: case 54: @@ -215,8 +214,6 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager { case 11: case 73: case 74: - case 75: - case 76: case 78: case 79: case 80: diff --git a/src/main/java/com/plotsquared/sponge/SpongeMain.java b/src/main/java/com/plotsquared/sponge/SpongeMain.java index 2d84c5ead..baa7b3f68 100644 --- a/src/main/java/com/plotsquared/sponge/SpongeMain.java +++ b/src/main/java/com/plotsquared/sponge/SpongeMain.java @@ -20,11 +20,8 @@ import org.spongepowered.api.Server; import org.spongepowered.api.block.BlockState; import org.spongepowered.api.block.BlockType; import org.spongepowered.api.block.BlockTypes; -import org.spongepowered.api.entity.player.Player; -import org.spongepowered.api.event.Subscribe; -import org.spongepowered.api.event.entity.player.PlayerChatEvent; -import org.spongepowered.api.event.state.PreInitializationEvent; -import org.spongepowered.api.event.state.ServerAboutToStartEvent; +import org.spongepowered.api.entity.living.player.Player; +import org.spongepowered.api.event.entity.living.player.PlayerChatEvent; import org.spongepowered.api.plugin.Plugin; import org.spongepowered.api.plugin.PluginContainer; import org.spongepowered.api.service.profile.GameProfileResolver; @@ -37,6 +34,7 @@ import org.spongepowered.api.world.GeneratorTypes; import org.spongepowered.api.world.World; import com.google.common.base.Optional; +import com.google.common.eventbus.Subscribe; import com.google.inject.Inject; import com.intellectualcrafters.configuration.ConfigurationSection; import com.intellectualcrafters.plot.IPlotMain; diff --git a/src/main/java/com/plotsquared/sponge/events/PlayerClaimPlotEvent.java b/src/main/java/com/plotsquared/sponge/events/PlayerClaimPlotEvent.java index fc5790244..74cf6d65e 100644 --- a/src/main/java/com/plotsquared/sponge/events/PlayerClaimPlotEvent.java +++ b/src/main/java/com/plotsquared/sponge/events/PlayerClaimPlotEvent.java @@ -1,6 +1,6 @@ package com.plotsquared.sponge.events; -import org.spongepowered.api.entity.player.Player; +import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.event.Cancellable; import com.intellectualcrafters.plot.object.Plot; diff --git a/src/main/java/com/plotsquared/sponge/events/PlayerEnterPlotEvent.java b/src/main/java/com/plotsquared/sponge/events/PlayerEnterPlotEvent.java index 9ff6d895e..7d654fefe 100644 --- a/src/main/java/com/plotsquared/sponge/events/PlayerEnterPlotEvent.java +++ b/src/main/java/com/plotsquared/sponge/events/PlayerEnterPlotEvent.java @@ -1,6 +1,6 @@ package com.plotsquared.sponge.events; -import org.spongepowered.api.entity.player.Player; +import org.spongepowered.api.entity.living.player.Player; import com.intellectualcrafters.plot.object.Plot; diff --git a/src/main/java/com/plotsquared/sponge/events/PlayerEvent.java b/src/main/java/com/plotsquared/sponge/events/PlayerEvent.java index 474aa70cc..87d2af6af 100644 --- a/src/main/java/com/plotsquared/sponge/events/PlayerEvent.java +++ b/src/main/java/com/plotsquared/sponge/events/PlayerEvent.java @@ -1,6 +1,6 @@ package com.plotsquared.sponge.events; -import org.spongepowered.api.entity.player.Player; +import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.event.AbstractEvent; public abstract class PlayerEvent extends AbstractEvent { diff --git a/src/main/java/com/plotsquared/sponge/events/PlayerLeavePlotEvent.java b/src/main/java/com/plotsquared/sponge/events/PlayerLeavePlotEvent.java index 4af5b76c7..e65716fc0 100644 --- a/src/main/java/com/plotsquared/sponge/events/PlayerLeavePlotEvent.java +++ b/src/main/java/com/plotsquared/sponge/events/PlayerLeavePlotEvent.java @@ -1,6 +1,6 @@ package com.plotsquared.sponge.events; -import org.spongepowered.api.entity.player.Player; +import org.spongepowered.api.entity.living.player.Player; import com.intellectualcrafters.plot.object.Plot; diff --git a/src/main/java/com/plotsquared/sponge/events/PlayerPlotDeniedEvent.java b/src/main/java/com/plotsquared/sponge/events/PlayerPlotDeniedEvent.java index f6a0157c2..692bc46ab 100644 --- a/src/main/java/com/plotsquared/sponge/events/PlayerPlotDeniedEvent.java +++ b/src/main/java/com/plotsquared/sponge/events/PlayerPlotDeniedEvent.java @@ -2,7 +2,7 @@ package com.plotsquared.sponge.events; import java.util.UUID; -import org.spongepowered.api.entity.player.Player; +import org.spongepowered.api.entity.living.player.Player; import com.intellectualcrafters.plot.object.Plot; diff --git a/src/main/java/com/plotsquared/sponge/events/PlayerPlotHelperEvent.java b/src/main/java/com/plotsquared/sponge/events/PlayerPlotHelperEvent.java index 9e40411fa..be3f62b1b 100644 --- a/src/main/java/com/plotsquared/sponge/events/PlayerPlotHelperEvent.java +++ b/src/main/java/com/plotsquared/sponge/events/PlayerPlotHelperEvent.java @@ -2,7 +2,7 @@ package com.plotsquared.sponge.events; import java.util.UUID; -import org.spongepowered.api.entity.player.Player; +import org.spongepowered.api.entity.living.player.Player; import com.intellectualcrafters.plot.object.Plot; diff --git a/src/main/java/com/plotsquared/sponge/events/PlayerPlotTrustedEvent.java b/src/main/java/com/plotsquared/sponge/events/PlayerPlotTrustedEvent.java index 2886cd768..69e3f336b 100644 --- a/src/main/java/com/plotsquared/sponge/events/PlayerPlotTrustedEvent.java +++ b/src/main/java/com/plotsquared/sponge/events/PlayerPlotTrustedEvent.java @@ -2,7 +2,7 @@ package com.plotsquared.sponge.events; import java.util.UUID; -import org.spongepowered.api.entity.player.Player; +import org.spongepowered.api.entity.living.player.Player; import com.intellectualcrafters.plot.object.Plot; diff --git a/src/main/java/com/plotsquared/sponge/events/PlayerTeleportToPlotEvent.java b/src/main/java/com/plotsquared/sponge/events/PlayerTeleportToPlotEvent.java index f7b5ca5c0..f4049efc9 100644 --- a/src/main/java/com/plotsquared/sponge/events/PlayerTeleportToPlotEvent.java +++ b/src/main/java/com/plotsquared/sponge/events/PlayerTeleportToPlotEvent.java @@ -1,6 +1,6 @@ package com.plotsquared.sponge.events; -import org.spongepowered.api.entity.player.Player; +import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.event.Cancellable; import com.intellectualcrafters.plot.object.Location; diff --git a/src/main/java/com/plotsquared/sponge/listener/MainListener.java b/src/main/java/com/plotsquared/sponge/listener/MainListener.java index cf4a1a754..5d60b1527 100644 --- a/src/main/java/com/plotsquared/sponge/listener/MainListener.java +++ b/src/main/java/com/plotsquared/sponge/listener/MainListener.java @@ -12,29 +12,13 @@ import org.spongepowered.api.entity.living.Ambient; import org.spongepowered.api.entity.living.Living; import org.spongepowered.api.entity.living.animal.Animal; import org.spongepowered.api.entity.living.monster.Monster; -import org.spongepowered.api.entity.player.Player; +import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.vehicle.Boat; import org.spongepowered.api.entity.vehicle.minecart.Minecart; -import org.spongepowered.api.event.Subscribe; -import org.spongepowered.api.event.block.BlockMoveEvent; -import org.spongepowered.api.event.block.BlockRedstoneUpdateEvent; -import org.spongepowered.api.event.block.FloraGrowEvent; -import org.spongepowered.api.event.block.FluidSpreadEvent; -import org.spongepowered.api.event.entity.EntityChangeBlockEvent; -import org.spongepowered.api.event.entity.EntitySpawnEvent; -import org.spongepowered.api.event.entity.EntityTeleportEvent; -import org.spongepowered.api.event.entity.player.PlayerBreakBlockEvent; -import org.spongepowered.api.event.entity.player.PlayerChangeWorldEvent; -import org.spongepowered.api.event.entity.player.PlayerChatEvent; -import org.spongepowered.api.event.entity.player.PlayerInteractBlockEvent; -import org.spongepowered.api.event.entity.player.PlayerJoinEvent; -import org.spongepowered.api.event.entity.player.PlayerMoveEvent; -import org.spongepowered.api.event.entity.player.PlayerPlaceBlockEvent; -import org.spongepowered.api.event.entity.player.PlayerQuitEvent; -import org.spongepowered.api.event.message.CommandEvent; -import org.spongepowered.api.event.network.PlayerConnectionEvent; -import org.spongepowered.api.event.world.ChunkPreGenerateEvent; -import org.spongepowered.api.event.world.WorldOnExplosionEvent; +import org.spongepowered.api.event.entity.living.player.PlayerChatEvent; +import org.spongepowered.api.event.entity.living.player.PlayerConnectionEvent; +import org.spongepowered.api.event.entity.living.player.PlayerJoinEvent; +import org.spongepowered.api.event.entity.living.player.PlayerQuitEvent; import org.spongepowered.api.network.PlayerConnection; import org.spongepowered.api.text.Text; import org.spongepowered.api.text.Texts; @@ -46,6 +30,7 @@ import org.spongepowered.api.world.extent.Extent; import com.flowpowered.math.vector.Vector3d; import com.flowpowered.math.vector.Vector3i; import com.google.common.base.Predicate; +import com.google.common.eventbus.Subscribe; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; @@ -726,10 +711,10 @@ public class MainListener { if (!PlotListener.plotExit(pp, lastPlot)) { MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED); if (lastPlot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) { - event.setNewLocation(from); + event.setTo(from); } else { - event.setNewLocation(world.getSpawnLocation()); + event.setTo(world.getSpawnLocation()); } return; } @@ -742,10 +727,10 @@ public class MainListener { if (!PlotListener.plotEntry(pp, plot)) { MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED); if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) { - event.setNewLocation(from); + event.setTo(from); } else { - event.setNewLocation(world.getSpawnLocation()); + event.setTo(world.getSpawnLocation()); } return; } @@ -755,13 +740,13 @@ public class MainListener { if (x2 > border) { Vector3d pos = to.getPosition(); to = to.setPosition(new Vector3d(border - 4, pos.getY(), pos.getZ())); - event.setNewLocation(to); + event.setTo(to); MainUtil.sendMessage(pp, C.BORDER); } else if (x2 < -border) { Vector3d pos = to.getPosition(); to = to.setPosition(new Vector3d(-border + 4, pos.getY(), pos.getZ())); - event.setNewLocation(to); + event.setTo(to); MainUtil.sendMessage(pp, C.BORDER); } } @@ -793,10 +778,10 @@ public class MainListener { if (!PlotListener.plotExit(pp, lastPlot)) { MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED); if (lastPlot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) { - event.setNewLocation(from); + event.setTo(from); } else { - event.setNewLocation(world.getSpawnLocation()); + event.setTo(world.getSpawnLocation()); } return; } @@ -809,10 +794,10 @@ public class MainListener { if (!PlotListener.plotEntry(pp, plot)) { MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED); if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) { - event.setNewLocation(from); + event.setTo(from); } else { - event.setNewLocation(world.getSpawnLocation()); + event.setTo(world.getSpawnLocation()); } return; } @@ -822,13 +807,13 @@ public class MainListener { if (z2 > border) { Vector3d pos = to.getPosition(); to = to.setPosition(new Vector3d(pos.getX(), pos.getY(), border - 4)); - event.setNewLocation(to); + event.setTo(to); MainUtil.sendMessage(pp, C.BORDER); } else if (z2 < -border) { Vector3d pos = to.getPosition(); to = to.setPosition(new Vector3d(pos.getX(), pos.getY(), -border + 4)); - event.setNewLocation(to); + event.setTo(to); MainUtil.sendMessage(pp, C.BORDER); } } @@ -867,10 +852,10 @@ public class MainListener { if (!PlotListener.plotExit(pp, lastPlot)) { MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED); if (lastPlot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) { - event.setNewLocation(from); + event.setTo(from); } else { - event.setNewLocation(world.getSpawnLocation()); + event.setTo(world.getSpawnLocation()); } return; } @@ -883,10 +868,10 @@ public class MainListener { if (!PlotListener.plotEntry(pp, plot)) { MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED); if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) { - event.setNewLocation(from); + event.setTo(from); } else { - event.setNewLocation(world.getSpawnLocation()); + event.setTo(world.getSpawnLocation()); } return; } @@ -896,13 +881,13 @@ public class MainListener { if (x2 > border) { Vector3d pos = to.getPosition(); to = to.setPosition(new Vector3d(border - 4, pos.getY(), pos.getZ())); - event.setNewLocation(to); + event.setTo(to); MainUtil.sendMessage(pp, C.BORDER); } else if (x2 < -border) { Vector3d pos = to.getPosition(); to = to.setPosition(new Vector3d(-border + 4, pos.getY(), pos.getZ())); - event.setNewLocation(to); + event.setTo(to); MainUtil.sendMessage(pp, C.BORDER); } } @@ -934,10 +919,10 @@ public class MainListener { if (!PlotListener.plotExit(pp, lastPlot)) { MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED); if (lastPlot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) { - event.setNewLocation(from); + event.setTo(from); } else { - event.setNewLocation(player.getWorld().getSpawnLocation()); + event.setTo(player.getWorld().getSpawnLocation()); } return; } @@ -950,10 +935,10 @@ public class MainListener { if (!PlotListener.plotEntry(pp, plot)) { MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED); if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) { - event.setNewLocation(from); + event.setTo(from); } else { - event.setNewLocation(player.getWorld().getSpawnLocation()); + event.setTo(player.getWorld().getSpawnLocation()); } return; } @@ -963,13 +948,13 @@ public class MainListener { if (z2 > border) { Vector3d pos = to.getPosition(); to = to.setPosition(new Vector3d(pos.getX(), pos.getY(), border - 4)); - event.setNewLocation(to); + event.setTo(to); MainUtil.sendMessage(pp, C.BORDER); } else if (z2 < -border) { Vector3d pos = to.getPosition(); to = to.setPosition(new Vector3d(pos.getX(), pos.getY(), -border + 4)); - event.setNewLocation(to); + event.setTo(to); MainUtil.sendMessage(pp, C.BORDER); } } diff --git a/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java b/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java index d3c37021e..31cea1248 100644 --- a/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java +++ b/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java @@ -7,9 +7,9 @@ import java.util.UUID; import org.spongepowered.api.data.key.Keys; import org.spongepowered.api.data.manipulator.mutable.TargetedLocationData; import org.spongepowered.api.data.value.mutable.Value; -import org.spongepowered.api.entity.player.Player; -import org.spongepowered.api.entity.player.gamemode.GameMode; -import org.spongepowered.api.entity.player.gamemode.GameModes; +import org.spongepowered.api.entity.living.player.Player; +import org.spongepowered.api.entity.living.player.gamemode.GameMode; +import org.spongepowered.api.entity.living.player.gamemode.GameModes; import org.spongepowered.api.text.TextBuilder; import org.spongepowered.api.text.Texts; import org.spongepowered.api.text.action.HoverAction; diff --git a/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java b/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java index 81f67345e..ed3322220 100644 --- a/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java +++ b/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java @@ -5,7 +5,7 @@ import java.util.Arrays; import java.util.List; import java.util.UUID; -import org.spongepowered.api.entity.player.Player; +import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.text.Text; import org.spongepowered.api.text.Texts; import org.spongepowered.api.util.command.CommandCallable; diff --git a/src/main/java/com/plotsquared/sponge/util/SpongeInventoryUtil.java b/src/main/java/com/plotsquared/sponge/util/SpongeInventoryUtil.java index c3f3b5cdd..806fcf249 100644 --- a/src/main/java/com/plotsquared/sponge/util/SpongeInventoryUtil.java +++ b/src/main/java/com/plotsquared/sponge/util/SpongeInventoryUtil.java @@ -3,7 +3,7 @@ package com.plotsquared.sponge.util; import java.util.ArrayList; import java.util.Locale; -import org.spongepowered.api.entity.player.Player; +import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.item.ItemType; import org.spongepowered.api.item.ItemTypes; import org.spongepowered.api.item.inventory.Carrier; diff --git a/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java b/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java index a13c06a8d..47f19f9f9 100644 --- a/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java +++ b/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java @@ -1,7 +1,7 @@ package com.plotsquared.sponge.util; import org.spongepowered.api.entity.Entity; -import org.spongepowered.api.entity.player.Player; +import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.world.World; import org.spongepowered.api.world.extent.Extent; diff --git a/src/main/java/com/plotsquared/sponge/uuid/SpongeLowerOfflineUUIDWrapper.java b/src/main/java/com/plotsquared/sponge/uuid/SpongeLowerOfflineUUIDWrapper.java index ec5d68b69..057e86e6c 100644 --- a/src/main/java/com/plotsquared/sponge/uuid/SpongeLowerOfflineUUIDWrapper.java +++ b/src/main/java/com/plotsquared/sponge/uuid/SpongeLowerOfflineUUIDWrapper.java @@ -3,7 +3,7 @@ package com.plotsquared.sponge.uuid; import java.util.UUID; import org.spongepowered.api.GameProfile; -import org.spongepowered.api.entity.player.Player; +import org.spongepowered.api.entity.living.player.Player; import com.google.common.base.Charsets; import com.intellectualcrafters.plot.object.OfflinePlotPlayer; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index b54098875..e3c6024f4 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -15,10 +15,6 @@ commands: permission: plots.use permission-message: "You are lacking the permission node 'plots.use'" permissions: - plots.admin: - children: - plots.*: true - default: op plots.use: default: true plots.permpack.basicflags: @@ -26,43 +22,48 @@ permissions: children: plots.set.flag: true plots.flag: true - plots.set.flag.titles: true - plots.set.flag.greeting: true - plots.set.flag.farewell: true - plots.set.flag.notify-enter: true - plots.set.flag.notify-leave: true - plots.set.flag.feed: true - plots.set.flag.heal: true - plots.set.flag.invincible: true - plots.set.flag.instabreak: true - plots.set.flag.fly: true - plots.set.flag.gamemode: true - plots.set.flag.time: true - plots.set.flag.weather: true - plots.set.flag.music: true - plots.set.flag.disable-physics: true - plots.set.flag.pve: true - plots.set.flag.pvp: true - plots.set.flag.explosion: true - plots.set.flag.hostile-interact: true - plots.set.flag.hostile-attack: true - plots.set.flag.animal-interact: true - plots.set.flag.animal-attack: true - plots.set.flag.tamed-interact: true - plots.set.flag.tamed-attack: true - plots.set.flag.misc-interact: true - plots.set.flag.hanging-place: true - plots.set.flag.hanging-break: true - plots.set.flag.vehicle-use: true - plots.set.flag.vehicle-place: true - plots.set.flag.vehicle-break: true - plots.set.flag.player-interact: true - plots.set.flag.place: true - plots.set.flag.break: true - plots.set.flag.use: true - plots.set.flag.forcefield: true - plots.set.flag.price: true - plots.set.flag.no-worldedit: true + plots.flag.add: true + plots.flag.remove: true + plots.flag.list: true + plots.flag.info: true + plots.set.flag.titles.*: true + plots.set.flag.greeting.*: true + plots.set.flag.farewell.*: true + plots.set.flag.notify-enter.*: true + plots.set.flag.notify-leave.*: true + plots.set.flag.feed.*: true + plots.set.flag.heal.*: true + plots.set.flag.invincible.*: true + plots.set.flag.instabreak.*: true + plots.set.flag.fly.*: true + plots.set.flag.gamemode.*: true + plots.set.flag.time.*: true + plots.set.flag.weather.*: true + plots.set.flag.music.*: true + plots.set.flag.disable-physics.*: true + plots.set.flag.pve.*: true + plots.set.flag.pvp.*: true + plots.set.flag.explosion.*: true + plots.set.flag.hostile-interact.*: true + plots.set.flag.hostile-attack.*: true + plots.set.flag.player-interact.*: true + plots.set.flag.animal-interact.*: true + plots.set.flag.animal-attack.*: true + plots.set.flag.tamed-interact.*: true + plots.set.flag.tamed-attack.*: true + plots.set.flag.misc-interact.*: true + plots.set.flag.hanging-place.*: true + plots.set.flag.hanging-break.*: true + plots.set.flag.vehicle-use.*: true + plots.set.flag.vehicle-place.*: true + plots.set.flag.vehicle-break.*: true + plots.set.flag.player-interact.*: true + plots.set.flag.place.*: true + plots.set.flag.break.*: true + plots.set.flag.use.*: true + plots.set.flag.forcefield.*: true + plots.set.flag.price.*: true + plots.set.flag.no-worldedit.*: true plots.permpack.basicinbox: default: op children: @@ -104,6 +105,10 @@ permissions: plots.visit.owned: true plots.visit.shared: true plots.set.flag: true + plots.flag.add: true + plots.flag.remove: true + plots.flag.list: true + plots.flag.info: true plots.flag: true plots.buy: true plots.chat: true