mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 09:17:39 +00:00
feat: only unstuck a player if configured to do so (#2723)
- also add unstuck to a couple of other commands - closes #2675
This commit is contained in:
parent
ae4d0236cc
commit
c9b2f441c1
@ -79,6 +79,8 @@ public class Settings extends Config {
|
||||
@Create
|
||||
public REGION_RESTRICTIONS_OPTIONS REGION_RESTRICTIONS_OPTIONS;
|
||||
@Create
|
||||
public GENERAL GENERAL;
|
||||
@Create
|
||||
public ConfigBlock<LIMITS> LIMITS;
|
||||
|
||||
private Settings() {
|
||||
@ -752,4 +754,13 @@ public class Settings extends Config {
|
||||
|
||||
}
|
||||
|
||||
public static class GENERAL {
|
||||
|
||||
@Comment({
|
||||
"If the player should be relocated/unstuck when a generation command would bury them",
|
||||
})
|
||||
public boolean UNSTUCK_ON_GENERATE = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -184,6 +184,9 @@ public class GenerationCommands {
|
||||
|
||||
BlockVector3 pos = session.getPlacementPosition(actor);
|
||||
int affected = editSession.makeCylinder(pos, pattern, radiusX, radiusZ, height, !hollow);
|
||||
if (actor instanceof Player && Settings.settings().GENERAL.UNSTUCK_ON_GENERATE) {
|
||||
((Player) actor).findFreePosition();
|
||||
}
|
||||
actor.print(Caption.of("worldedit.cyl.created", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
@ -227,6 +230,9 @@ public class GenerationCommands {
|
||||
|
||||
BlockVector3 pos = session.getPlacementPosition(actor);
|
||||
int affected = editSession.makeCone(pos, pattern, radiusX, radiusZ, height, !hollow, thickness);
|
||||
if (actor instanceof Player && Settings.settings().GENERAL.UNSTUCK_ON_GENERATE) {
|
||||
((Player) actor).findFreePosition();
|
||||
}
|
||||
actor.printInfo(Caption.of("worldedit.cone.created", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
@ -293,7 +299,7 @@ public class GenerationCommands {
|
||||
}
|
||||
|
||||
int affected = editSession.makeSphere(pos, pattern, radiusX, radiusY, radiusZ, !hollow);
|
||||
if (actor instanceof Player) {
|
||||
if (actor instanceof Player && Settings.settings().GENERAL.UNSTUCK_ON_GENERATE) {
|
||||
((Player) actor).findFreePosition();
|
||||
}
|
||||
actor.print(Caption.of("worldedit.sphere.created", TextComponent.of(affected)));
|
||||
@ -379,7 +385,7 @@ public class GenerationCommands {
|
||||
worldEdit.checkMaxRadius(size);
|
||||
BlockVector3 pos = session.getPlacementPosition(actor);
|
||||
int affected = editSession.makePyramid(pos, pattern, size, !hollow);
|
||||
if (actor instanceof Player) {
|
||||
if (actor instanceof Player && Settings.settings().GENERAL.UNSTUCK_ON_GENERATE) {
|
||||
((Player) actor).findFreePosition();
|
||||
}
|
||||
actor.print(Caption.of("worldedit.pyramid.created", TextComponent.of(affected)));
|
||||
@ -457,7 +463,7 @@ public class GenerationCommands {
|
||||
hollow,
|
||||
session.getTimeout()
|
||||
);
|
||||
if (actor instanceof Player) {
|
||||
if (actor instanceof Player && Settings.settings().GENERAL.UNSTUCK_ON_GENERATE) {
|
||||
((Player) actor).findFreePosition();
|
||||
}
|
||||
actor.print(Caption.of("worldedit.generate.created", TextComponent.of(affected)));
|
||||
@ -741,7 +747,7 @@ public class GenerationCommands {
|
||||
radius.divide(max),
|
||||
sphericity / 100
|
||||
);
|
||||
if (actor instanceof Player) {
|
||||
if (actor instanceof Player && Settings.settings().GENERAL.UNSTUCK_ON_GENERATE) {
|
||||
((Player) actor).findFreePosition();
|
||||
}
|
||||
actor.print(Caption.of("worldedit.sphere.created", TextComponent.of(affected)));
|
||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.command;
|
||||
import com.fastasyncworldedit.core.FaweAPI;
|
||||
import com.fastasyncworldedit.core.FaweCache;
|
||||
import com.fastasyncworldedit.core.configuration.Caption;
|
||||
import com.fastasyncworldedit.core.configuration.Settings;
|
||||
import com.fastasyncworldedit.core.extent.processor.lighting.RelightMode;
|
||||
import com.fastasyncworldedit.core.limit.FaweLimit;
|
||||
import com.fastasyncworldedit.core.util.MaskTraverser;
|
||||
@ -715,6 +716,9 @@ public class RegionCommands {
|
||||
session.setSourceMask(mask);
|
||||
//FAWE end
|
||||
}
|
||||
if (actor instanceof Player && Settings.settings().GENERAL.UNSTUCK_ON_GENERATE) {
|
||||
((Player) actor).findFreePosition();
|
||||
}
|
||||
if (success) {
|
||||
actor.print(Caption.of("worldedit.regen.regenerated"));
|
||||
} else {
|
||||
@ -788,7 +792,7 @@ public class RegionCommands {
|
||||
String.join(" ", expression),
|
||||
session.getTimeout()
|
||||
);
|
||||
if (actor instanceof Player) {
|
||||
if (actor instanceof Player && Settings.settings().GENERAL.UNSTUCK_ON_GENERATE) {
|
||||
((Player) actor).findFreePosition();
|
||||
}
|
||||
actor.print(Caption.of("worldedit.deform.deformed", TextComponent.of(affected)));
|
||||
|
Loading…
Reference in New Issue
Block a user