mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-28 13:45:36 +01:00
Workaround for CoreProtect logging
This commit is contained in:
parent
aa02b34d7c
commit
652a983907
@ -57,7 +57,7 @@ public class MainUtil {
|
||||
public void run(File file) {
|
||||
long age = now - file.lastModified();
|
||||
if (age > timeDiff) {
|
||||
System.out.println("Deleting file: " + file);
|
||||
Fawe.debug("Deleting file: " + file);
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
@ -73,7 +73,7 @@ public class MainUtil {
|
||||
if (file.isDirectory()) {
|
||||
deleteDirectory(files[i]);
|
||||
} else {
|
||||
System.out.println("Deleting file: " + file);
|
||||
Fawe.debug("Deleting file: " + file);
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,10 @@ public class WorldWrapper extends AbstractWorld {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public AbstractWorld getParent() {
|
||||
return parent instanceof WorldWrapper ? ((WorldWrapper) parent).getParent() : parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useItem(Vector position, BaseItem item, Direction face) {
|
||||
return parent.useItem(position, item, face);
|
||||
|
@ -118,6 +118,7 @@ import com.sk89q.worldedit.util.eventbus.EventBus;
|
||||
import com.sk89q.worldedit.world.AbstractWorld;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@ -235,6 +236,19 @@ public class EditSession implements Extent {
|
||||
}
|
||||
this.actor = event.getActor();
|
||||
this.queue = SetQueue.IMP.getNewQueue(world.getName(), true);
|
||||
// Set the world of the event to the actual world (workaround for CoreProtect)
|
||||
try {
|
||||
Class<? extends EditSessionEvent> eventClass = event.getClass();
|
||||
Field fieldWorld = eventClass.getDeclaredField("world");
|
||||
fieldWorld.setAccessible(true);
|
||||
if (world instanceof WorldWrapper) {
|
||||
fieldWorld.set(event, ((WorldWrapper) world).getParent());
|
||||
} else {
|
||||
fieldWorld.set(event, world);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.world = (world = new WorldWrapper((AbstractWorld) world));
|
||||
this.wrapper = Fawe.imp().getEditSessionWrapper(this);
|
||||
// Not a player; bypass history
|
||||
|
Loading…
Reference in New Issue
Block a user