Sfoglia il codice sorgente

no entity change event on plots

Kajetan Johannes Hammerle 3 anni fa
parent
commit
0b31f2ddb1

+ 1 - 0
src/me/hammerle/kp/Events.java

@@ -287,6 +287,7 @@ public class Events implements Listener {
         if(e.getBlock().getType() == Material.FARMLAND) {
             e.setCancelled(true);
         }
+        PlotEvents.onEntityChangeBlock(e);
         ScriptEvents.onEntityChangeBlock(e);
     }
 

+ 9 - 0
src/me/hammerle/kp/plots/PlotEvents.java

@@ -150,4 +150,13 @@ public class PlotEvents {
             e.setCancelled(true);
         }
     }
+
+    public static void onEntityChangeBlock(EntityChangeBlockEvent e) {
+        if(e.getEntity() instanceof Player) {
+            return;
+        }
+        if(WorldPlotMap.hasPlotAt(e.getEntity().getLocation())) {
+            e.setCancelled(true);
+        }
+    }
 }