mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
Merge remote-tracking branch 'upstream/feature/translatable-text' into i18n-merge
This commit is contained in:
@ -56,6 +56,7 @@ import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.TargetBlock;
|
||||
import com.sk89q.worldedit.util.auth.AuthorizationException;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -358,10 +359,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
.isMovementBlocker()) {
|
||||
int platformY = Math.max(initialY, y - 3 - clearance);
|
||||
if (platformY < initialY) { // if ==, they already have the given clearance, if <, clearance is too large
|
||||
printError("Not enough space above you!");
|
||||
return false;
|
||||
} else if (platformY == initialY) {
|
||||
printError("You're already at the ceiling.");
|
||||
return false;
|
||||
}
|
||||
floatAt(x, platformY + 1, z, alwaysGlass);
|
||||
@ -590,13 +589,13 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
|
||||
@Override
|
||||
public File openFileOpenDialog(String[] extensions) {
|
||||
printError("File dialogs are not supported in your environment.");
|
||||
printError(TranslatableComponent.of("worldedit.platform.no-file-dialog"));
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File openFileSaveDialog(String[] extensions) {
|
||||
printError("File dialogs are not supported in your environment.");
|
||||
printError(TranslatableComponent.of("worldedit.platform.no-file-dialog"));
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -645,7 +644,6 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("CloneDoesntCallSuperClone")
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
throw new CloneNotSupportedException("Not supported");
|
||||
|
@ -38,6 +38,7 @@ import com.sk89q.worldedit.session.request.Request;
|
||||
import com.sk89q.worldedit.util.Identifiable;
|
||||
import com.sk89q.worldedit.util.auth.Subject;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -45,6 +46,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.concurrent.locks.Condition;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* An object that can perform actions in WorldEdit.
|
||||
@ -71,30 +73,56 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
|
||||
* Print a message.
|
||||
*
|
||||
* @param msg The message text
|
||||
* @deprecated Use component-based functions (print)
|
||||
*/
|
||||
@Deprecated
|
||||
void printRaw(String msg);
|
||||
|
||||
/**
|
||||
* Print a WorldEdit message.
|
||||
*
|
||||
* @param msg The message text
|
||||
* @deprecated Use component-based functions (printDebug)
|
||||
*/
|
||||
@Deprecated
|
||||
void printDebug(String msg);
|
||||
|
||||
/**
|
||||
* Print a WorldEdit message.
|
||||
*
|
||||
* @param msg The message text
|
||||
* @deprecated Use component-based functions (printInfo)
|
||||
*/
|
||||
@Deprecated
|
||||
void print(String msg);
|
||||
|
||||
/**
|
||||
* Print a WorldEdit error.
|
||||
*
|
||||
* @param msg The error message text
|
||||
* @deprecated Use component-based functions (printError)
|
||||
*/
|
||||
@Deprecated
|
||||
void printError(String msg);
|
||||
|
||||
/**
|
||||
* Print a WorldEdit error.
|
||||
*
|
||||
* @param component The component to print
|
||||
*/
|
||||
default void printError(Component component) {
|
||||
print(component.color(TextColor.RED));
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a WorldEdit message.
|
||||
*
|
||||
* @param component The component to print
|
||||
*/
|
||||
default void printInfo(Component component) {
|
||||
print(component.color(TextColor.LIGHT_PURPLE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a {@link Component}.
|
||||
*
|
||||
@ -109,6 +137,15 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
|
||||
*/
|
||||
boolean canDestroyBedrock();
|
||||
|
||||
/**
|
||||
* Print a WorldEdit message.
|
||||
*
|
||||
* @param component The component to print
|
||||
*/
|
||||
default void printDebug(Component component) {
|
||||
print(component.color(TextColor.GRAY));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this actor is a player.
|
||||
*
|
||||
@ -232,4 +269,11 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
|
||||
}
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the locale of this actor.
|
||||
*
|
||||
* @return The locale
|
||||
*/
|
||||
Locale getLocale();
|
||||
}
|
||||
|
@ -813,7 +813,7 @@ public final class PlatformCommandManager {
|
||||
store.injectValue(Key.of(Player.class), ValueProvider.constant((Player) actor));
|
||||
} else {
|
||||
store.injectValue(Key.of(Player.class), context -> {
|
||||
throw new CommandException(TextComponent.of("This command must be used with a player."), ImmutableList.of());
|
||||
throw new CommandException(TranslatableComponent.of("worldedit.command.player-only"), ImmutableList.of());
|
||||
});
|
||||
}
|
||||
store.injectValue(Key.of(Arguments.class), ValueProvider.constant(arguments));
|
||||
@ -831,8 +831,8 @@ public final class PlatformCommandManager {
|
||||
}
|
||||
|
||||
private void handleUnknownException(Actor actor, Throwable t) {
|
||||
actor.printError("Please report this error: [See console]");
|
||||
actor.printRaw(t.getClass().getName() + ": " + t.getMessage());
|
||||
actor.printError(TranslatableComponent.of("worldedit.command.error.report"));
|
||||
actor.print(TextComponent.of(t.getClass().getName() + ": " + t.getMessage()));
|
||||
log.error("An unexpected error while handling a WorldEdit command", t);
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,6 @@ import com.sk89q.worldedit.event.platform.Interaction;
|
||||
import com.sk89q.worldedit.event.platform.PlatformInitializeEvent;
|
||||
import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
|
||||
import com.sk89q.worldedit.event.platform.PlayerInputEvent;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
@ -34,9 +34,12 @@ import com.sk89q.worldedit.session.SessionKey;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import java.util.Locale;
|
||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -141,22 +144,22 @@ public class PlayerProxy extends AbstractPlayerActor {
|
||||
|
||||
@Override
|
||||
public void printRaw(String msg) {
|
||||
basePlayer.printRaw(msg);
|
||||
basePlayer.print(TextComponent.of(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printDebug(String msg) {
|
||||
basePlayer.printDebug(msg);
|
||||
basePlayer.printDebug(TextComponent.of(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(String msg) {
|
||||
basePlayer.print(msg);
|
||||
basePlayer.printInfo(TextComponent.of(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printError(String msg) {
|
||||
basePlayer.printError(msg);
|
||||
basePlayer.printError(TextComponent.of(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -226,4 +229,9 @@ public class PlayerProxy extends AbstractPlayerActor {
|
||||
public void floatAt(int x, int y, int z, boolean alwaysGlass) {
|
||||
basePlayer.floatAt(x, y, z, alwaysGlass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Locale getLocale() {
|
||||
return basePlayer.getLocale();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user