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) {
|
public void run(File file) {
|
||||||
long age = now - file.lastModified();
|
long age = now - file.lastModified();
|
||||||
if (age > timeDiff) {
|
if (age > timeDiff) {
|
||||||
System.out.println("Deleting file: " + file);
|
Fawe.debug("Deleting file: " + file);
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ public class MainUtil {
|
|||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
deleteDirectory(files[i]);
|
deleteDirectory(files[i]);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Deleting file: " + file);
|
Fawe.debug("Deleting file: " + file);
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,10 @@ public class WorldWrapper extends AbstractWorld {
|
|||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AbstractWorld getParent() {
|
||||||
|
return parent instanceof WorldWrapper ? ((WorldWrapper) parent).getParent() : parent;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean useItem(Vector position, BaseItem item, Direction face) {
|
public boolean useItem(Vector position, BaseItem item, Direction face) {
|
||||||
return parent.useItem(position, item, 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.AbstractWorld;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -235,6 +236,19 @@ public class EditSession implements Extent {
|
|||||||
}
|
}
|
||||||
this.actor = event.getActor();
|
this.actor = event.getActor();
|
||||||
this.queue = SetQueue.IMP.getNewQueue(world.getName(), true);
|
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.world = (world = new WorldWrapper((AbstractWorld) world));
|
||||||
this.wrapper = Fawe.imp().getEditSessionWrapper(this);
|
this.wrapper = Fawe.imp().getEditSessionWrapper(this);
|
||||||
// Not a player; bypass history
|
// Not a player; bypass history
|
||||||
|
Loading…
Reference in New Issue
Block a user