aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/server/commands/WorldBorderCommand.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/server/commands/WorldBorderCommand.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/server/commands/WorldBorderCommand.java.patch220
1 files changed, 220 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/server/commands/WorldBorderCommand.java.patch b/patch-remap/mache-spigotflower/net/minecraft/server/commands/WorldBorderCommand.java.patch
new file mode 100644
index 0000000000..4224aaf266
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/server/commands/WorldBorderCommand.java.patch
@@ -0,0 +1,220 @@
+--- a/net/minecraft/server/commands/WorldBorderCommand.java
++++ b/net/minecraft/server/commands/WorldBorderCommand.java
+@@ -10,7 +10,6 @@
+ import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
+ import java.util.Locale;
+ import net.minecraft.commands.CommandSourceStack;
+-import net.minecraft.commands.Commands;
+ import net.minecraft.commands.arguments.coordinates.Vec2Argument;
+ import net.minecraft.network.chat.Component;
+ import net.minecraft.util.Mth;
+@@ -31,106 +30,106 @@
+
+ public WorldBorderCommand() {}
+
+- public static void register(CommandDispatcher<CommandSourceStack> commanddispatcher) {
+- commanddispatcher.register((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) Commands.literal("worldborder").requires((commandsourcestack) -> {
+- return commandsourcestack.hasPermission(2);
+- })).then(Commands.literal("add").then(((RequiredArgumentBuilder) Commands.argument("distance", DoubleArgumentType.doubleArg(-5.9999968E7D, 5.9999968E7D)).executes((commandcontext) -> {
++ public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
++ dispatcher.register((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) net.minecraft.commands.Commands.literal("worldborder").requires((commandlistenerwrapper) -> {
++ return commandlistenerwrapper.hasPermission(2);
++ })).then(net.minecraft.commands.Commands.literal("add").then(((RequiredArgumentBuilder) net.minecraft.commands.Commands.argument("distance", DoubleArgumentType.doubleArg(-5.9999968E7D, 5.9999968E7D)).executes((commandcontext) -> {
+ return setSize((CommandSourceStack) commandcontext.getSource(), ((CommandSourceStack) commandcontext.getSource()).getLevel().getWorldBorder().getSize() + DoubleArgumentType.getDouble(commandcontext, "distance"), 0L);
+- })).then(Commands.argument("time", IntegerArgumentType.integer(0)).executes((commandcontext) -> {
++ })).then(net.minecraft.commands.Commands.argument("time", IntegerArgumentType.integer(0)).executes((commandcontext) -> {
+ return setSize((CommandSourceStack) commandcontext.getSource(), ((CommandSourceStack) commandcontext.getSource()).getLevel().getWorldBorder().getSize() + DoubleArgumentType.getDouble(commandcontext, "distance"), ((CommandSourceStack) commandcontext.getSource()).getLevel().getWorldBorder().getLerpRemainingTime() + (long) IntegerArgumentType.getInteger(commandcontext, "time") * 1000L);
+- }))))).then(Commands.literal("set").then(((RequiredArgumentBuilder) Commands.argument("distance", DoubleArgumentType.doubleArg(-5.9999968E7D, 5.9999968E7D)).executes((commandcontext) -> {
++ }))))).then(net.minecraft.commands.Commands.literal("set").then(((RequiredArgumentBuilder) net.minecraft.commands.Commands.argument("distance", DoubleArgumentType.doubleArg(-5.9999968E7D, 5.9999968E7D)).executes((commandcontext) -> {
+ return setSize((CommandSourceStack) commandcontext.getSource(), DoubleArgumentType.getDouble(commandcontext, "distance"), 0L);
+- })).then(Commands.argument("time", IntegerArgumentType.integer(0)).executes((commandcontext) -> {
++ })).then(net.minecraft.commands.Commands.argument("time", IntegerArgumentType.integer(0)).executes((commandcontext) -> {
+ return setSize((CommandSourceStack) commandcontext.getSource(), DoubleArgumentType.getDouble(commandcontext, "distance"), (long) IntegerArgumentType.getInteger(commandcontext, "time") * 1000L);
+- }))))).then(Commands.literal("center").then(Commands.argument("pos", Vec2Argument.vec2()).executes((commandcontext) -> {
++ }))))).then(net.minecraft.commands.Commands.literal("center").then(net.minecraft.commands.Commands.argument("pos", Vec2Argument.vec2()).executes((commandcontext) -> {
+ return setCenter((CommandSourceStack) commandcontext.getSource(), Vec2Argument.getVec2(commandcontext, "pos"));
+- })))).then(((LiteralArgumentBuilder) Commands.literal("damage").then(Commands.literal("amount").then(Commands.argument("damagePerBlock", FloatArgumentType.floatArg(0.0F)).executes((commandcontext) -> {
++ })))).then(((LiteralArgumentBuilder) net.minecraft.commands.Commands.literal("damage").then(net.minecraft.commands.Commands.literal("amount").then(net.minecraft.commands.Commands.argument("damagePerBlock", FloatArgumentType.floatArg(0.0F)).executes((commandcontext) -> {
+ return setDamageAmount((CommandSourceStack) commandcontext.getSource(), FloatArgumentType.getFloat(commandcontext, "damagePerBlock"));
+- })))).then(Commands.literal("buffer").then(Commands.argument("distance", FloatArgumentType.floatArg(0.0F)).executes((commandcontext) -> {
++ })))).then(net.minecraft.commands.Commands.literal("buffer").then(net.minecraft.commands.Commands.argument("distance", FloatArgumentType.floatArg(0.0F)).executes((commandcontext) -> {
+ return setDamageBuffer((CommandSourceStack) commandcontext.getSource(), FloatArgumentType.getFloat(commandcontext, "distance"));
+- }))))).then(Commands.literal("get").executes((commandcontext) -> {
++ }))))).then(net.minecraft.commands.Commands.literal("get").executes((commandcontext) -> {
+ return getSize((CommandSourceStack) commandcontext.getSource());
+- }))).then(((LiteralArgumentBuilder) Commands.literal("warning").then(Commands.literal("distance").then(Commands.argument("distance", IntegerArgumentType.integer(0)).executes((commandcontext) -> {
++ }))).then(((LiteralArgumentBuilder) net.minecraft.commands.Commands.literal("warning").then(net.minecraft.commands.Commands.literal("distance").then(net.minecraft.commands.Commands.argument("distance", IntegerArgumentType.integer(0)).executes((commandcontext) -> {
+ return setWarningDistance((CommandSourceStack) commandcontext.getSource(), IntegerArgumentType.getInteger(commandcontext, "distance"));
+- })))).then(Commands.literal("time").then(Commands.argument("time", IntegerArgumentType.integer(0)).executes((commandcontext) -> {
++ })))).then(net.minecraft.commands.Commands.literal("time").then(net.minecraft.commands.Commands.argument("time", IntegerArgumentType.integer(0)).executes((commandcontext) -> {
+ return setWarningTime((CommandSourceStack) commandcontext.getSource(), IntegerArgumentType.getInteger(commandcontext, "time"));
+ })))));
+ }
+
+- private static int setDamageBuffer(CommandSourceStack commandsourcestack, float f) throws CommandSyntaxException {
+- WorldBorder worldborder = commandsourcestack.getServer().overworld().getWorldBorder();
++ private static int setDamageBuffer(CommandSourceStack source, float distance) throws CommandSyntaxException {
++ WorldBorder worldborder = source.getLevel().getWorldBorder(); // CraftBukkit
+
+- if (worldborder.getDamageSafeZone() == (double) f) {
++ if (worldborder.getDamageSafeZone() == (double) distance) {
+ throw WorldBorderCommand.ERROR_SAME_DAMAGE_BUFFER.create();
+ } else {
+- worldborder.setDamageSafeZone((double) f);
+- commandsourcestack.sendSuccess(() -> {
+- return Component.translatable("commands.worldborder.damage.buffer.success", String.format(Locale.ROOT, "%.2f", f));
++ worldborder.setDamageSafeZone((double) distance);
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.worldborder.damage.buffer.success", String.format(Locale.ROOT, "%.2f", distance));
+ }, true);
+- return (int) f;
++ return (int) distance;
+ }
+ }
+
+- private static int setDamageAmount(CommandSourceStack commandsourcestack, float f) throws CommandSyntaxException {
+- WorldBorder worldborder = commandsourcestack.getServer().overworld().getWorldBorder();
++ private static int setDamageAmount(CommandSourceStack source, float damagePerBlock) throws CommandSyntaxException {
++ WorldBorder worldborder = source.getLevel().getWorldBorder(); // CraftBukkit
+
+- if (worldborder.getDamagePerBlock() == (double) f) {
++ if (worldborder.getDamagePerBlock() == (double) damagePerBlock) {
+ throw WorldBorderCommand.ERROR_SAME_DAMAGE_AMOUNT.create();
+ } else {
+- worldborder.setDamagePerBlock((double) f);
+- commandsourcestack.sendSuccess(() -> {
+- return Component.translatable("commands.worldborder.damage.amount.success", String.format(Locale.ROOT, "%.2f", f));
++ worldborder.setDamagePerBlock((double) damagePerBlock);
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.worldborder.damage.amount.success", String.format(Locale.ROOT, "%.2f", damagePerBlock));
+ }, true);
+- return (int) f;
++ return (int) damagePerBlock;
+ }
+ }
+
+- private static int setWarningTime(CommandSourceStack commandsourcestack, int i) throws CommandSyntaxException {
+- WorldBorder worldborder = commandsourcestack.getServer().overworld().getWorldBorder();
++ private static int setWarningTime(CommandSourceStack source, int time) throws CommandSyntaxException {
++ WorldBorder worldborder = source.getLevel().getWorldBorder(); // CraftBukkit
+
+- if (worldborder.getWarningTime() == i) {
++ if (worldborder.getWarningTime() == time) {
+ throw WorldBorderCommand.ERROR_SAME_WARNING_TIME.create();
+ } else {
+- worldborder.setWarningTime(i);
+- commandsourcestack.sendSuccess(() -> {
+- return Component.translatable("commands.worldborder.warning.time.success", i);
++ worldborder.setWarningTime(time);
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.worldborder.warning.time.success", time);
+ }, true);
+- return i;
++ return time;
+ }
+ }
+
+- private static int setWarningDistance(CommandSourceStack commandsourcestack, int i) throws CommandSyntaxException {
+- WorldBorder worldborder = commandsourcestack.getServer().overworld().getWorldBorder();
++ private static int setWarningDistance(CommandSourceStack source, int distance) throws CommandSyntaxException {
++ WorldBorder worldborder = source.getLevel().getWorldBorder(); // CraftBukkit
+
+- if (worldborder.getWarningBlocks() == i) {
++ if (worldborder.getWarningBlocks() == distance) {
+ throw WorldBorderCommand.ERROR_SAME_WARNING_DISTANCE.create();
+ } else {
+- worldborder.setWarningBlocks(i);
+- commandsourcestack.sendSuccess(() -> {
+- return Component.translatable("commands.worldborder.warning.distance.success", i);
++ worldborder.setWarningBlocks(distance);
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.worldborder.warning.distance.success", distance);
+ }, true);
+- return i;
++ return distance;
+ }
+ }
+
+- private static int getSize(CommandSourceStack commandsourcestack) {
+- double d0 = commandsourcestack.getServer().overworld().getWorldBorder().getSize();
++ private static int getSize(CommandSourceStack source) {
++ double d0 = source.getLevel().getWorldBorder().getSize(); // CraftBukkit
+
+- commandsourcestack.sendSuccess(() -> {
++ source.sendSuccess(() -> {
+ return Component.translatable("commands.worldborder.get", String.format(Locale.ROOT, "%.0f", d0));
+ }, false);
+ return Mth.floor(d0 + 0.5D);
+ }
+
+- private static int setCenter(CommandSourceStack commandsourcestack, Vec2 vec2) throws CommandSyntaxException {
+- WorldBorder worldborder = commandsourcestack.getServer().overworld().getWorldBorder();
++ private static int setCenter(CommandSourceStack source, Vec2 pos) throws CommandSyntaxException {
++ WorldBorder worldborder = source.getLevel().getWorldBorder(); // CraftBukkit
+
+- if (worldborder.getCenterX() == (double) vec2.x && worldborder.getCenterZ() == (double) vec2.y) {
++ if (worldborder.getCenterX() == (double) pos.x && worldborder.getCenterZ() == (double) pos.y) {
+ throw WorldBorderCommand.ERROR_SAME_CENTER.create();
+- } else if ((double) Math.abs(vec2.x) <= 2.9999984E7D && (double) Math.abs(vec2.y) <= 2.9999984E7D) {
+- worldborder.setCenter((double) vec2.x, (double) vec2.y);
+- commandsourcestack.sendSuccess(() -> {
+- return Component.translatable("commands.worldborder.center.success", String.format(Locale.ROOT, "%.2f", vec2.x), String.format(Locale.ROOT, "%.2f", vec2.y));
++ } else if ((double) Math.abs(pos.x) <= 2.9999984E7D && (double) Math.abs(pos.y) <= 2.9999984E7D) {
++ worldborder.setCenter((double) pos.x, (double) pos.y);
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.worldborder.center.success", String.format(Locale.ROOT, "%.2f", pos.x), String.format(Locale.ROOT, "%.2f", pos.y));
+ }, true);
+ return 0;
+ } else {
+@@ -138,36 +137,36 @@
+ }
+ }
+
+- private static int setSize(CommandSourceStack commandsourcestack, double d0, long i) throws CommandSyntaxException {
+- WorldBorder worldborder = commandsourcestack.getServer().overworld().getWorldBorder();
++ private static int setSize(CommandSourceStack source, double newSize, long i) throws CommandSyntaxException {
++ WorldBorder worldborder = source.getLevel().getWorldBorder(); // CraftBukkit
+ double d1 = worldborder.getSize();
+
+- if (d1 == d0) {
++ if (d1 == newSize) {
+ throw WorldBorderCommand.ERROR_SAME_SIZE.create();
+- } else if (d0 < 1.0D) {
++ } else if (newSize < 1.0D) {
+ throw WorldBorderCommand.ERROR_TOO_SMALL.create();
+- } else if (d0 > 5.9999968E7D) {
++ } else if (newSize > 5.9999968E7D) {
+ throw WorldBorderCommand.ERROR_TOO_BIG.create();
+ } else {
+ if (i > 0L) {
+- worldborder.lerpSizeBetween(d1, d0, i);
+- if (d0 > d1) {
+- commandsourcestack.sendSuccess(() -> {
+- return Component.translatable("commands.worldborder.set.grow", String.format(Locale.ROOT, "%.1f", d0), Long.toString(i / 1000L));
++ worldborder.lerpSizeBetween(d1, newSize, i);
++ if (newSize > d1) {
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.worldborder.set.grow", String.format(Locale.ROOT, "%.1f", newSize), Long.toString(i / 1000L));
+ }, true);
+ } else {
+- commandsourcestack.sendSuccess(() -> {
+- return Component.translatable("commands.worldborder.set.shrink", String.format(Locale.ROOT, "%.1f", d0), Long.toString(i / 1000L));
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.worldborder.set.shrink", String.format(Locale.ROOT, "%.1f", newSize), Long.toString(i / 1000L));
+ }, true);
+ }
+ } else {
+- worldborder.setSize(d0);
+- commandsourcestack.sendSuccess(() -> {
+- return Component.translatable("commands.worldborder.set.immediate", String.format(Locale.ROOT, "%.1f", d0));
++ worldborder.setSize(newSize);
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.worldborder.set.immediate", String.format(Locale.ROOT, "%.1f", newSize));
+ }, true);
+ }
+
+- return (int) (d0 - d1);
++ return (int) (newSize - d1);
+ }
+ }
+ }