|
@@ -717,18 +717,17 @@ public class ScriptEvents implements BlockHarvest, Craft {
|
|
|
handleEvent(e, "mob_griefing", (sc) -> {
|
|
|
Entity ent = e.getEntity();
|
|
|
setEntity(sc, ent);
|
|
|
+ boolean b = true;
|
|
|
if(ent != null) {
|
|
|
World w = ent.world;
|
|
|
if(w != null) {
|
|
|
GameRules rules = w.getGameRules();
|
|
|
if(rules != null) {
|
|
|
- boolean b = true;
|
|
|
try {
|
|
|
b = !rules.getBoolean(GameRules.MOB_GRIEFING);
|
|
|
} catch(Exception ex) {
|
|
|
ex.printStackTrace();
|
|
|
}
|
|
|
- sc.setVar("cancel", b);
|
|
|
} else {
|
|
|
System.out.println("Rules are null");
|
|
|
}
|
|
@@ -738,6 +737,7 @@ public class ScriptEvents implements BlockHarvest, Craft {
|
|
|
} else {
|
|
|
System.out.println("Entity is null");
|
|
|
}
|
|
|
+ sc.setVar("cancel", b);
|
|
|
}, (sc) -> {
|
|
|
handleVar(sc, "mob_griefing", "cancel", (v) -> {
|
|
|
e.setResult(v.getBoolean(sc) ? Result.DENY : Result.ALLOW);
|