Fixed: Исправлен эвент взрыва от взрывов иннера

This commit is contained in:
Reider745
2024-05-09 08:11:46 +03:00
parent 44a3355fa6
commit 089964d877
3 changed files with 11 additions and 12 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ __Zote Core__ — серверное ядро, основанное на Inner C
Запустите собранное ядро, открыв консоль в папке с ним: Запустите собранное ядро, открыв консоль в папке с ним:
```sh ```sh
java -jar ZoteCore-SNAPSHOT.jar java -jar ZoteCore-SNAPSHOT.jar -XX:MaxRAMPercentage=95.0 --add-opens java.base/jdk.internal.loader=ALL-UNNAMED
``` ```
## Конфигурация ## Конфигурация
@@ -187,14 +187,10 @@ public class BlockSourceMethods {
public static void explode(Level level, float x, float y, float z, float power, boolean fire) { public static void explode(Level level, float x, float y, float z, float power, boolean fire) {
final Block block = level.getBlock((int) x, (int) y, (int) z); final Block block = level.getBlock((int) x, (int) y, (int) z);
final BlockExplosionPrimeEvent event = new BlockExplosionPrimeEvent(block, power, 0d); final BlockExplosionPrimeEvent event = new BlockExplosionPrimeEvent(block, power, fire ? .4 : 0d);
event.setIncendiary(fire); event.setIncendiary(fire);
synchronized (EventListener.DEALING_LOCK) { Server.getInstance().getPluginManager().callEvent(event);
EventListener.dealingEvent = event;
Server.getInstance().getPluginManager().callEvent(event);
EventListener.dealingEvent = null;
}
if (event.isCancelled()) { if (event.isCancelled()) {
return; return;
@@ -104,6 +104,11 @@ public class Updatable {
private Context currentContext = null; private Context currentContext = null;
private void executeUpdateWithContext(Context ctx, ScriptableObject obj) { private void executeUpdateWithContext(Context ctx, ScriptableObject obj) {
if(shouldBeRemoved(obj)){
postedRemovedUpdatables.add(obj);
return;
}
Object _update = obj.get("update", obj); Object _update = obj.get("update", obj);
try { try {
Function update = (Function) _update; Function update = (Function) _update;
@@ -125,10 +130,6 @@ public class Updatable {
} }
return; return;
} }
if (shouldBeRemoved(obj)) {
postedRemovedUpdatables.add(obj);
}
} }
private boolean executeUpdate(ScriptableObject obj) { private boolean executeUpdate(ScriptableObject obj) {
@@ -141,7 +142,9 @@ public class Updatable {
TickExecutor.getInstance().execute(new Runnable() { TickExecutor.getInstance().execute(new Runnable() {
@Override @Override
public void run() { public void run() {
executeUpdateWithContext(Compiler.assureContextForCurrentThread(), obj); synchronized (obj) {
executeUpdateWithContext(Compiler.assureContextForCurrentThread(), obj);
}
} }
}); });
} else { } else {