Skip to content

Commit

Permalink
Fixed: Исправлен эвент взрыва от взрывов иннера
Browse files Browse the repository at this point in the history
  • Loading branch information
Reider745 committed May 9, 2024
1 parent 44a3355 commit 089964d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ __Zote Core__ — серверное ядро, основанное на Inner C
Запустите собранное ядро, открыв консоль в папке с ним:

```sh
java -jar ZoteCore-SNAPSHOT.jar
java -jar ZoteCore-SNAPSHOT.jar -XX:MaxRAMPercentage=95.0 --add-opens java.base/jdk.internal.loader=ALL-UNNAMED
```

## Конфигурация
Expand Down
8 changes: 2 additions & 6 deletions src/main/java/com/reider745/world/BlockSourceMethods.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,10 @@ public static void addToTickingQueue(Level level, int x, int y, int z, int runti

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 BlockExplosionPrimeEvent event = new BlockExplosionPrimeEvent(block, power, 0d);
final BlockExplosionPrimeEvent event = new BlockExplosionPrimeEvent(block, power, fire ? .4 : 0d);
event.setIncendiary(fire);

synchronized (EventListener.DEALING_LOCK) {
EventListener.dealingEvent = event;
Server.getInstance().getPluginManager().callEvent(event);
EventListener.dealingEvent = null;
}
Server.getInstance().getPluginManager().callEvent(event);

if (event.isCancelled()) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ public static void reportError(Throwable err, String updatableStr) {
private Context currentContext = null;

private void executeUpdateWithContext(Context ctx, ScriptableObject obj) {
if(shouldBeRemoved(obj)){
postedRemovedUpdatables.add(obj);
return;
}

Object _update = obj.get("update", obj);
try {
Function update = (Function) _update;
Expand All @@ -125,10 +130,6 @@ private void executeUpdateWithContext(Context ctx, ScriptableObject obj) {
}
return;
}

if (shouldBeRemoved(obj)) {
postedRemovedUpdatables.add(obj);
}
}

private boolean executeUpdate(ScriptableObject obj) {
Expand All @@ -141,7 +142,9 @@ private boolean executeUpdate(ScriptableObject obj) {
TickExecutor.getInstance().execute(new Runnable() {
@Override
public void run() {
executeUpdateWithContext(Compiler.assureContextForCurrentThread(), obj);
synchronized (obj) {
executeUpdateWithContext(Compiler.assureContextForCurrentThread(), obj);
}
}
});
} else {
Expand Down

0 comments on commit 089964d

Please sign in to comment.