diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 4991dd668..a070c0b0b 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -10,13 +10,8 @@
-
-
-
-
-
-
-
+
+
@@ -40,77 +35,73 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
+
+
+
-
-
+
+
-
-
+
+
@@ -119,29 +110,51 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
+
+
+
+
+
@@ -159,10 +172,6 @@
@@ -251,7 +264,6 @@
-
@@ -319,6 +331,10 @@
+
+
+
+
@@ -341,17 +357,44 @@
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -408,6 +451,160 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $PROJECT_DIR$/.classpath
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/C.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/PlayerFunctions.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/PlotManager.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Auto.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Camera.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Claim.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Clear.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Clipboard.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Command.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/CommandPermission.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Copy.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Debug.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Denied.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Help.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Helpers.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Home.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Info.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Inventory.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Kick.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/MainCommand.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Merge.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Paste.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Rate.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Reload.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Schematic.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/SetOwner.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Setup.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/SubCommand.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/TP.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Trusted.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Unlink.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Visit.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/list.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/plugin.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/database/DBFunc.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotManager.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/listeners/PlayerEvents.java
+
+
+
+
+
+
+
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Purge.java
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -569,7 +766,8 @@
-
+
+
1411382351159
@@ -703,11 +901,39 @@
1413103688160
1413103688160
-
+
+ 1413127618309
+ 1413127618309
+
+
+ 1413222030174
+ 1413222030174
+
+
+ 1413222222053
+ 1413222222053
+
+
+ 1413223175550
+ 1413223175550
+
+
+ 1413228139584
+ 1413228139584
+
+
+ 1413296165870
+ 1413296165870
+
+
+ 1413620688438
+ 1413620688438
+
+
-
+
@@ -744,13 +970,13 @@
-
-
+
+
-
+
@@ -763,11 +989,11 @@
-
+
-
+
@@ -784,8 +1010,8 @@
-
+
@@ -801,16 +1027,10 @@
+
-
-
-
-
-
-
-
@@ -829,7 +1049,14 @@
-
+
+
+
+
+
+
+
+
@@ -841,69 +1068,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1019,13 +1183,6 @@
-
-
-
-
-
-
-
@@ -1054,20 +1211,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1112,14 +1255,6 @@
-
-
-
-
-
-
-
-
@@ -1128,22 +1263,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1160,22 +1279,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1184,40 +1287,207 @@
-
+
-
-
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
index acee8cd0d..b49db0260 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
@@ -645,6 +645,8 @@ public class PlotMain extends JavaPlugin {
getServer().getPluginManager().registerEvents(new PlayerEvents(), this);
+ defaultFlags();
+
if (getServer().getPluginManager().getPlugin("CameraAPI") != null) {
cameraAPI = CameraAPI.getInstance();
Camera camera = new Camera();
@@ -1223,6 +1225,33 @@ public class PlotMain extends JavaPlugin {
*/
}
+ // Material.STONE_BUTTON, Material.WOOD_BUTTON,
+ // Material.LEVER, Material.STONE_PLATE, Material.WOOD_PLATE,
+ // Material.CHEST, Material.TRAPPED_CHEST, Material.TRAP_DOOR,
+ // Material.WOOD_DOOR, Material.WOODEN_DOOR,
+ // Material.DISPENSER, Material.DROPPER
+ public static HashMap materialFlags = new HashMap<>();
+ static {
+ materialFlags.put(Material.WOODEN_DOOR, "wooden_door");
+ materialFlags.put(Material.IRON_DOOR, "iron_door");
+ materialFlags.put(Material.STONE_BUTTON, "stone_button");
+ materialFlags.put(Material.WOOD_BUTTON, "wooden_button");
+ materialFlags.put(Material.LEVER, "lever");
+ materialFlags.put(Material.WOOD_PLATE, "wooden_plate");
+ materialFlags.put(Material.STONE_PLATE, "stone_plate");
+ materialFlags.put(Material.CHEST, "chest");
+ materialFlags.put(Material.TRAPPED_CHEST, "trapped_chest");
+ materialFlags.put(Material.TRAP_DOOR, "trap_door");
+ materialFlags.put(Material.DISPENSER, "dispenser");
+ materialFlags.put(Material.DROPPER, "dropper");
+ }
+
+ private static void defaultFlags() {
+ for(String str : materialFlags.values()) {
+ FlagManager.addFlag(new AbstractFlag(str));
+ }
+ }
+
public static void addPlotWorld(String world, PlotWorld plotworld, PlotManager manager) {
worlds.put(world, plotworld);
managers.put(world, manager);
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/listeners/PlayerEvents.java b/PlotSquared/src/com/intellectualcrafters/plot/listeners/PlayerEvents.java
index cc78dcc03..e0358284c 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/listeners/PlayerEvents.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/listeners/PlayerEvents.java
@@ -34,10 +34,7 @@ import org.bukkit.event.player.*;
import org.bukkit.event.world.StructureGrowEvent;
import org.bukkit.event.world.WorldLoadEvent;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
+import java.util.*;
/**
* Player Events involving plots
@@ -496,6 +493,10 @@ public class PlayerEvents implements Listener {
}
}
+ public boolean getFlagValue(String value) {
+ return Arrays.asList("true", "on", "enabled", "yes").contains(value.toLowerCase());
+ }
+
@EventHandler
public void onInteract(PlayerInteractEvent event) {
if (event.getClickedBlock() == null) {
@@ -523,6 +524,13 @@ public class PlayerEvents implements Listener {
// })).contains(event.getClickedBlock().getType())) {
// return;
// }
+
+ if(PlotMain.materialFlags.containsKey(event.getClickedBlock().getType())) {
+ String flag = PlotMain.materialFlags.get(event.getClickedBlock().getType());
+ if(plot.settings.getFlag(flag) != null && getFlagValue(plot.settings.getFlag(flag).getValue()))
+ return;
+ }
+
if (!plot.hasRights(event.getPlayer())) {
event.setCancelled(true);
}