Fix per-world worldborder command

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2021-12-03 07:34:39 +11:00
parent ee342addea
commit 9f2d553877

View file

@ -0,0 +1,64 @@
--- a/net/minecraft/server/commands/CommandWorldBorder.java
+++ b/net/minecraft/server/commands/CommandWorldBorder.java
@@ -57,7 +57,7 @@
}
private static int setDamageBuffer(CommandListenerWrapper commandlistenerwrapper, float f) throws CommandSyntaxException {
- WorldBorder worldborder = commandlistenerwrapper.getServer().overworld().getWorldBorder();
+ WorldBorder worldborder = commandlistenerwrapper.getLevel().getWorldBorder(); // CraftBukkit
if (worldborder.getDamageSafeZone() == (double) f) {
throw CommandWorldBorder.ERROR_SAME_DAMAGE_BUFFER.create();
@@ -69,7 +69,7 @@
}
private static int setDamageAmount(CommandListenerWrapper commandlistenerwrapper, float f) throws CommandSyntaxException {
- WorldBorder worldborder = commandlistenerwrapper.getServer().overworld().getWorldBorder();
+ WorldBorder worldborder = commandlistenerwrapper.getLevel().getWorldBorder(); // CraftBukkit
if (worldborder.getDamagePerBlock() == (double) f) {
throw CommandWorldBorder.ERROR_SAME_DAMAGE_AMOUNT.create();
@@ -81,7 +81,7 @@
}
private static int setWarningTime(CommandListenerWrapper commandlistenerwrapper, int i) throws CommandSyntaxException {
- WorldBorder worldborder = commandlistenerwrapper.getServer().overworld().getWorldBorder();
+ WorldBorder worldborder = commandlistenerwrapper.getLevel().getWorldBorder(); // CraftBukkit
if (worldborder.getWarningTime() == i) {
throw CommandWorldBorder.ERROR_SAME_WARNING_TIME.create();
@@ -93,7 +93,7 @@
}
private static int setWarningDistance(CommandListenerWrapper commandlistenerwrapper, int i) throws CommandSyntaxException {
- WorldBorder worldborder = commandlistenerwrapper.getServer().overworld().getWorldBorder();
+ WorldBorder worldborder = commandlistenerwrapper.getLevel().getWorldBorder(); // CraftBukkit
if (worldborder.getWarningBlocks() == i) {
throw CommandWorldBorder.ERROR_SAME_WARNING_DISTANCE.create();
@@ -105,14 +105,14 @@
}
private static int getSize(CommandListenerWrapper commandlistenerwrapper) {
- double d0 = commandlistenerwrapper.getServer().overworld().getWorldBorder().getSize();
+ double d0 = commandlistenerwrapper.getLevel().getWorldBorder().getSize(); // CraftBukkit
commandlistenerwrapper.sendSuccess(new ChatMessage("commands.worldborder.get", new Object[]{String.format(Locale.ROOT, "%.0f", d0)}), false);
return MathHelper.floor(d0 + 0.5D);
}
private static int setCenter(CommandListenerWrapper commandlistenerwrapper, Vec2F vec2f) throws CommandSyntaxException {
- WorldBorder worldborder = commandlistenerwrapper.getServer().overworld().getWorldBorder();
+ WorldBorder worldborder = commandlistenerwrapper.getLevel().getWorldBorder(); // CraftBukkit
if (worldborder.getCenterX() == (double) vec2f.x && worldborder.getCenterZ() == (double) vec2f.y) {
throw CommandWorldBorder.ERROR_SAME_CENTER.create();
@@ -126,7 +126,7 @@
}
private static int setSize(CommandListenerWrapper commandlistenerwrapper, double d0, long i) throws CommandSyntaxException {
- WorldBorder worldborder = commandlistenerwrapper.getServer().overworld().getWorldBorder();
+ WorldBorder worldborder = commandlistenerwrapper.getLevel().getWorldBorder(); // CraftBukkit
double d1 = worldborder.getSize();
if (d1 == d0) {