geforkt von Mirrors/Paper
net.minecraft.server.commands
Dieser Commit ist enthalten in:
Ursprung
973fe2a945
Commit
93114d09f2
@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/server/commands/BanIpCommands.java
|
||||
+++ b/net/minecraft/server/commands/BanIpCommands.java
|
||||
@@ -66,7 +66,7 @@
|
||||
@@ -68,7 +_,7 @@
|
||||
}
|
||||
|
||||
for (ServerPlayer serverPlayer : list) {
|
||||
for (ServerPlayer serverPlayer : playersWithAddress) {
|
||||
- serverPlayer.connection.disconnect(Component.translatable("multiplayer.disconnect.ip_banned"));
|
||||
+ serverPlayer.connection.disconnect(Component.translatable("multiplayer.disconnect.ip_banned"), org.bukkit.event.player.PlayerKickEvent.Cause.IP_BANNED); // Paper - kick event cause
|
||||
}
|
||||
|
||||
return list.size();
|
||||
return playersWithAddress.size();
|
@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/server/commands/BanPlayerCommands.java
|
||||
+++ b/net/minecraft/server/commands/BanPlayerCommands.java
|
||||
@@ -55,7 +_,7 @@
|
||||
);
|
||||
ServerPlayer player = source.getServer().getPlayerList().getPlayer(gameProfile.getId());
|
||||
if (player != null) {
|
||||
- player.connection.disconnect(Component.translatable("multiplayer.disconnect.banned"));
|
||||
+ player.connection.disconnect(Component.translatable("multiplayer.disconnect.banned"), org.bukkit.event.player.PlayerKickEvent.Cause.BANNED); // Paper - kick event cause
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/server/commands/DeOpCommands.java
|
||||
+++ b/net/minecraft/server/commands/DeOpCommands.java
|
||||
@@ -35,7 +35,7 @@
|
||||
@@ -35,7 +_,7 @@
|
||||
if (playerList.isOp(gameProfile)) {
|
||||
playerList.deop(gameProfile);
|
||||
i++;
|
||||
- source.sendSuccess(() -> Component.translatable("commands.deop.success", targets.iterator().next().getName()), true);
|
||||
- source.sendSuccess(() -> Component.translatable("commands.deop.success", players.iterator().next().getName()), true);
|
||||
+ source.sendSuccess(() -> Component.translatable("commands.deop.success", gameProfile.getName()), true); // Paper - fixes MC-253721
|
||||
}
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/server/commands/DefaultGameModeCommands.java
|
||||
+++ b/net/minecraft/server/commands/DefaultGameModeCommands.java
|
||||
@@ -28,9 +28,13 @@
|
||||
GameType gameType = minecraftServer.getForcedGameType();
|
||||
if (gameType != null) {
|
||||
for (ServerPlayer serverPlayer : minecraftServer.getPlayerList().getPlayers()) {
|
||||
- if (serverPlayer.setGameMode(gameType)) {
|
||||
@@ -28,9 +_,13 @@
|
||||
GameType forcedGameType = server.getForcedGameType();
|
||||
if (forcedGameType != null) {
|
||||
for (ServerPlayer serverPlayer : server.getPlayerList().getPlayers()) {
|
||||
- if (serverPlayer.setGameMode(forcedGameType)) {
|
||||
- i++;
|
||||
+ // Paper start - Expand PlayerGameModeChangeEvent
|
||||
+ org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameType, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, net.kyori.adventure.text.Component.empty());
|
||||
+ org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gamemode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, net.kyori.adventure.text.Component.empty());
|
||||
+ if (event != null && event.isCancelled()) {
|
||||
+ source.sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), false);
|
||||
+ commandSource.sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), false);
|
||||
}
|
||||
+ // Paper end - Expand PlayerGameModeChangeEvent
|
||||
+ i++;
|
@ -0,0 +1,16 @@
|
||||
--- a/net/minecraft/server/commands/DifficultyCommand.java
|
||||
+++ b/net/minecraft/server/commands/DifficultyCommand.java
|
||||
@@ -31,10 +_,11 @@
|
||||
|
||||
public static int setDifficulty(CommandSourceStack source, Difficulty difficulty) throws CommandSyntaxException {
|
||||
MinecraftServer server = source.getServer();
|
||||
- if (server.getWorldData().getDifficulty() == difficulty) {
|
||||
+ net.minecraft.server.level.ServerLevel serverLevel = source.getLevel(); // CraftBukkit
|
||||
+ if (serverLevel.getDifficulty() == difficulty) { // CraftBukkit
|
||||
throw ERROR_ALREADY_DIFFICULT.create(difficulty.getKey());
|
||||
} else {
|
||||
- server.setDifficulty(difficulty, true);
|
||||
+ server.setDifficulty(serverLevel, difficulty, true); // Paper - per level difficulty; don't skip other difficulty-changing logic (fix upstream's fix)
|
||||
source.sendSuccess(() -> Component.translatable("commands.difficulty.success", difficulty.getDisplayName()), true);
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
--- a/net/minecraft/server/commands/EffectCommands.java
|
||||
+++ b/net/minecraft/server/commands/EffectCommands.java
|
||||
@@ -180,7 +_,7 @@
|
||||
for (Entity entity : targets) {
|
||||
if (entity instanceof LivingEntity) {
|
||||
MobEffectInstance mobEffectInstance = new MobEffectInstance(effect, i1, amplifier, false, showParticles);
|
||||
- if (((LivingEntity)entity).addEffect(mobEffectInstance, source.getEntity())) {
|
||||
+ if (((LivingEntity)entity).addEffect(mobEffectInstance, source.getEntity(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -210,7 +_,7 @@
|
||||
int i = 0;
|
||||
|
||||
for (Entity entity : targets) {
|
||||
- if (entity instanceof LivingEntity && ((LivingEntity)entity).removeAllEffects()) {
|
||||
+ if (entity instanceof LivingEntity && ((LivingEntity)entity).removeAllEffects(org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -235,7 +_,7 @@
|
||||
int i = 0;
|
||||
|
||||
for (Entity entity : targets) {
|
||||
- if (entity instanceof LivingEntity && ((LivingEntity)entity).removeEffect(effect)) {
|
||||
+ if (entity instanceof LivingEntity && ((LivingEntity)entity).removeEffect(effect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
|
||||
i++;
|
||||
}
|
||||
}
|
@ -1,17 +1,17 @@
|
||||
--- a/net/minecraft/server/commands/GameModeCommand.java
|
||||
+++ b/net/minecraft/server/commands/GameModeCommand.java
|
||||
@@ -60,9 +60,14 @@
|
||||
@@ -54,9 +_,14 @@
|
||||
int i = 0;
|
||||
|
||||
for (ServerPlayer serverPlayer : targets) {
|
||||
- if (serverPlayer.setGameMode(gameMode)) {
|
||||
for (ServerPlayer serverPlayer : players) {
|
||||
- if (serverPlayer.setGameMode(gameType)) {
|
||||
+ // Paper start - Expand PlayerGameModeChangeEvent
|
||||
+ org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.COMMAND, net.kyori.adventure.text.Component.empty());
|
||||
+ org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameType, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.COMMAND, net.kyori.adventure.text.Component.empty());
|
||||
+ if (event != null && !event.isCancelled()) {
|
||||
logGamemodeChange(context.getSource(), serverPlayer, gameMode);
|
||||
logGamemodeChange(source.getSource(), serverPlayer, gameType);
|
||||
i++;
|
||||
+ } else if (event != null && event.cancelMessage() != null) {
|
||||
+ context.getSource().sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), true);
|
||||
+ source.getSource().sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), true);
|
||||
+ // Paper end - Expand PlayerGameModeChangeEvent
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/server/commands/GameRuleCommand.java
|
||||
+++ b/net/minecraft/server/commands/GameRuleCommand.java
|
||||
@@ -30,14 +_,14 @@
|
||||
|
||||
static <T extends GameRules.Value<T>> int setRule(CommandContext<CommandSourceStack> source, GameRules.Key<T> gameRule) {
|
||||
CommandSourceStack commandSourceStack = source.getSource();
|
||||
- T rule = commandSourceStack.getServer().getGameRules().getRule(gameRule);
|
||||
- rule.setFromArgument(source, "value");
|
||||
+ T rule = commandSourceStack.getLevel().getGameRules().getRule(gameRule); // CraftBukkit
|
||||
+ rule.setFromArgument(source, "value", gameRule); // Paper - Add WorldGameRuleChangeEvent
|
||||
commandSourceStack.sendSuccess(() -> Component.translatable("commands.gamerule.set", gameRule.getId(), rule.toString()), true);
|
||||
return rule.getCommandResult();
|
||||
}
|
||||
|
||||
static <T extends GameRules.Value<T>> int queryRule(CommandSourceStack source, GameRules.Key<T> gameRule) {
|
||||
- T rule = source.getServer().getGameRules().getRule(gameRule);
|
||||
+ T rule = source.getLevel().getGameRules().getRule(gameRule); // CraftBukkit
|
||||
source.sendSuccess(() -> Component.translatable("commands.gamerule.query", gameRule.getId(), rule.toString()), false);
|
||||
return rule.getCommandResult();
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
--- a/net/minecraft/server/commands/GiveCommand.java
|
||||
+++ b/net/minecraft/server/commands/GiveCommand.java
|
||||
@@ -51,6 +_,7 @@
|
||||
|
||||
private static int giveItem(CommandSourceStack source, ItemInput item, Collection<ServerPlayer> targets, int count) throws CommandSyntaxException {
|
||||
ItemStack itemStack = item.createItemStack(1, false);
|
||||
+ final Component displayName = itemStack.getDisplayName(); // Paper - get display name early
|
||||
int maxStackSize = itemStack.getMaxStackSize();
|
||||
int i = maxStackSize * 100;
|
||||
if (count > i) {
|
||||
@@ -66,7 +_,7 @@
|
||||
ItemStack itemStack1 = item.createItemStack(min, false);
|
||||
boolean flag = serverPlayer.getInventory().add(itemStack1);
|
||||
if (flag && itemStack1.isEmpty()) {
|
||||
- ItemEntity itemEntity = serverPlayer.drop(itemStack, false);
|
||||
+ ItemEntity itemEntity = serverPlayer.drop(itemStack, false, false, false); // CraftBukkit - SPIGOT-2942: Add boolean to call event
|
||||
if (itemEntity != null) {
|
||||
itemEntity.makeFakeItem();
|
||||
}
|
||||
@@ -95,11 +_,11 @@
|
||||
|
||||
if (targets.size() == 1) {
|
||||
source.sendSuccess(
|
||||
- () -> Component.translatable("commands.give.success.single", count, itemStack.getDisplayName(), targets.iterator().next().getDisplayName()),
|
||||
+ () -> Component.translatable("commands.give.success.single", count, displayName, targets.iterator().next().getDisplayName()), // Paper - use cached display name
|
||||
true
|
||||
);
|
||||
} else {
|
||||
- source.sendSuccess(() -> Component.translatable("commands.give.success.single", count, itemStack.getDisplayName(), targets.size()), true);
|
||||
+ source.sendSuccess(() -> Component.translatable("commands.give.success.single", count, displayName, targets.size()), true); // Paper - use cached display name
|
||||
}
|
||||
|
||||
return targets.size();
|
@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/server/commands/KickCommand.java
|
||||
+++ b/net/minecraft/server/commands/KickCommand.java
|
||||
@@ -48,7 +48,7 @@
|
||||
@@ -48,7 +_,7 @@
|
||||
|
||||
for (ServerPlayer serverPlayer : targets) {
|
||||
for (ServerPlayer serverPlayer : players) {
|
||||
if (!source.getServer().isSingleplayerOwner(serverPlayer.getGameProfile())) {
|
||||
- serverPlayer.connection.disconnect(reason);
|
||||
+ serverPlayer.connection.disconnect(reason, org.bukkit.event.player.PlayerKickEvent.Cause.KICK_COMMAND); // Paper - kick event cause
|
@ -0,0 +1,18 @@
|
||||
--- a/net/minecraft/server/commands/ListPlayersCommand.java
|
||||
+++ b/net/minecraft/server/commands/ListPlayersCommand.java
|
||||
@@ -32,7 +_,14 @@
|
||||
|
||||
private static int format(CommandSourceStack source, Function<ServerPlayer, Component> nameExtractor) {
|
||||
PlayerList playerList = source.getServer().getPlayerList();
|
||||
- List<ServerPlayer> players = playerList.getPlayers();
|
||||
+ // CraftBukkit start
|
||||
+ List<ServerPlayer> playersTemp = playerList.getPlayers();
|
||||
+ if (source.getBukkitSender() instanceof org.bukkit.entity.Player) {
|
||||
+ org.bukkit.entity.Player sender = (org.bukkit.entity.Player) source.getBukkitSender();
|
||||
+ playersTemp = playersTemp.stream().filter((ep) -> sender.canSee(ep.getBukkitEntity())).collect(java.util.stream.Collectors.toList());
|
||||
+ }
|
||||
+ final List<ServerPlayer> players = playersTemp;
|
||||
+ // CraftBukkit end
|
||||
Component component = ComponentUtils.formatList(players, nameExtractor);
|
||||
source.sendSuccess(() -> Component.translatable("commands.list.players", players.size(), playerList.getMaxPlayers(), component), false);
|
||||
return players.size();
|
@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/server/commands/LootCommand.java
|
||||
+++ b/net/minecraft/server/commands/LootCommand.java
|
||||
@@ -395,6 +_,7 @@
|
||||
|
||||
private static int dropInWorld(CommandSourceStack source, Vec3 pos, List<ItemStack> items, LootCommand.Callback callback) throws CommandSyntaxException {
|
||||
ServerLevel level = source.getLevel();
|
||||
+ items.removeIf(ItemStack::isEmpty); // CraftBukkit - SPIGOT-6959 Remove empty items for avoid throw an error in new EntityItem
|
||||
items.forEach(itemStack -> {
|
||||
ItemEntity itemEntity = new ItemEntity(level, pos.x, pos.y, pos.z, itemStack.copy());
|
||||
itemEntity.setDefaultPickUpDelay();
|
@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/server/commands/OpCommand.java
|
||||
+++ b/net/minecraft/server/commands/OpCommand.java
|
||||
@@ -46,7 +46,7 @@
|
||||
@@ -46,7 +_,7 @@
|
||||
if (!playerList.isOp(gameProfile)) {
|
||||
playerList.op(gameProfile);
|
||||
i++;
|
||||
- source.sendSuccess(() -> Component.translatable("commands.op.success", targets.iterator().next().getName()), true);
|
||||
- source.sendSuccess(() -> Component.translatable("commands.op.success", gameProfiles.iterator().next().getName()), true);
|
||||
+ source.sendSuccess(() -> Component.translatable("commands.op.success", gameProfile.getName()), true); // Paper - fixes MC-253721
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/server/commands/PlaceCommand.java
|
||||
+++ b/net/minecraft/server/commands/PlaceCommand.java
|
||||
@@ -280,6 +_,7 @@
|
||||
if (!structureStart.isValid()) {
|
||||
throw ERROR_STRUCTURE_FAILED.create();
|
||||
} else {
|
||||
+ structureStart.generationEventCause = org.bukkit.event.world.AsyncStructureGenerateEvent.Cause.COMMAND; // CraftBukkit - set AsyncStructureGenerateEvent.Cause.COMMAND as generation cause
|
||||
BoundingBox boundingBox = structureStart.getBoundingBox();
|
||||
ChunkPos chunkPos = new ChunkPos(SectionPos.blockToSectionCoord(boundingBox.minX()), SectionPos.blockToSectionCoord(boundingBox.minZ()));
|
||||
ChunkPos chunkPos1 = new ChunkPos(SectionPos.blockToSectionCoord(boundingBox.maxX()), SectionPos.blockToSectionCoord(boundingBox.maxZ()));
|
@ -1,18 +1,19 @@
|
||||
--- a/net/minecraft/server/commands/ReloadCommand.java
|
||||
+++ b/net/minecraft/server/commands/ReloadCommand.java
|
||||
@@ -20,7 +20,7 @@
|
||||
public ReloadCommand() {}
|
||||
@@ -16,7 +_,7 @@
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
|
||||
public static void reloadPacks(Collection<String> dataPacks, CommandSourceStack source) {
|
||||
- source.getServer().reloadResources(dataPacks).exceptionally((throwable) -> {
|
||||
+ source.getServer().reloadResources(dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally((throwable) -> { // Paper - Add ServerResourcesReloadedEvent
|
||||
ReloadCommand.LOGGER.warn("Failed to execute reload", throwable);
|
||||
public static void reloadPacks(Collection<String> selectedIds, CommandSourceStack source) {
|
||||
- source.getServer().reloadResources(selectedIds).exceptionally(throwable -> {
|
||||
+ source.getServer().reloadResources(selectedIds, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally(throwable -> { // Paper - Add ServerResourcesReloadedEvent
|
||||
LOGGER.warn("Failed to execute reload", throwable);
|
||||
source.sendFailure(Component.translatable("commands.reload.failure"));
|
||||
return null;
|
||||
@@ -44,6 +44,16 @@
|
||||
return collection1;
|
||||
}
|
||||
@@ -36,6 +_,16 @@
|
||||
|
||||
return list;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public static void reload(MinecraftServer minecraftserver) {
|
||||
+ PackRepository resourcepackrepository = minecraftserver.getPackRepository();
|
||||
@ -22,7 +23,6 @@
|
||||
+ minecraftserver.reloadResources(collection1, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN); // Paper - Add ServerResourcesReloadedEvent
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||
dispatcher.register((LiteralArgumentBuilder) ((LiteralArgumentBuilder) net.minecraft.commands.Commands.literal("reload").requires((commandlistenerwrapper) -> {
|
||||
return commandlistenerwrapper.hasPermission(2);
|
||||
dispatcher.register(Commands.literal("reload").requires(source -> source.hasPermission(2)).executes(context -> {
|
@ -0,0 +1,29 @@
|
||||
--- a/net/minecraft/server/commands/ScheduleCommand.java
|
||||
+++ b/net/minecraft/server/commands/ScheduleCommand.java
|
||||
@@ -32,7 +_,7 @@
|
||||
);
|
||||
private static final SimpleCommandExceptionType ERROR_MACRO = new SimpleCommandExceptionType(Component.translatableEscape("commands.schedule.macro"));
|
||||
private static final SuggestionProvider<CommandSourceStack> SUGGEST_SCHEDULE = (context, builder) -> SharedSuggestionProvider.suggest(
|
||||
- context.getSource().getServer().getWorldData().overworldData().getScheduledEvents().getEventsIds(), builder
|
||||
+ context.getSource().getLevel().serverLevelData.getScheduledEvents().getEventsIds(), builder // Paper - Make schedule command per-world
|
||||
);
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||
@@ -101,7 +_,7 @@
|
||||
} else {
|
||||
long l = source.getLevel().getGameTime() + time;
|
||||
ResourceLocation resourceLocation = function.getFirst();
|
||||
- TimerQueue<MinecraftServer> scheduledEvents = source.getServer().getWorldData().overworldData().getScheduledEvents();
|
||||
+ TimerQueue<MinecraftServer> scheduledEvents = source.getLevel().serverLevelData.overworldData().getScheduledEvents(); // CraftBukkit - SPIGOT-6667: Use world specific function timer
|
||||
Optional<CommandFunction<CommandSourceStack>> optional = function.getSecond().left();
|
||||
if (optional.isPresent()) {
|
||||
if (optional.get() instanceof MacroFunction) {
|
||||
@@ -132,7 +_,7 @@
|
||||
}
|
||||
|
||||
private static int remove(CommandSourceStack source, String function) throws CommandSyntaxException {
|
||||
- int i = source.getServer().getWorldData().overworldData().getScheduledEvents().remove(function);
|
||||
+ int i = source.getLevel().serverLevelData.overworldData().getScheduledEvents().remove(function); // Paper - Make schedule command per-world
|
||||
if (i == 0) {
|
||||
throw ERROR_CANT_REMOVE.create(function);
|
||||
} else {
|
@ -0,0 +1,43 @@
|
||||
--- a/net/minecraft/server/commands/SetSpawnCommand.java
|
||||
+++ b/net/minecraft/server/commands/SetSpawnCommand.java
|
||||
@@ -66,24 +_,34 @@
|
||||
private static int setSpawn(CommandSourceStack source, Collection<ServerPlayer> targets, BlockPos pos, float angle) {
|
||||
ResourceKey<Level> resourceKey = source.getLevel().dimension();
|
||||
|
||||
+ final Collection<ServerPlayer> actualTargets = new java.util.ArrayList<>(); // Paper - Add PlayerSetSpawnEvent
|
||||
for (ServerPlayer serverPlayer : targets) {
|
||||
- serverPlayer.setRespawnPosition(resourceKey, pos, angle, true, false);
|
||||
- }
|
||||
+ // Paper start - Add PlayerSetSpawnEvent
|
||||
+ if (serverPlayer.setRespawnPosition(resourceKey, pos, angle, true, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.COMMAND)) {
|
||||
+ actualTargets.add(serverPlayer);
|
||||
+ }
|
||||
+ // Paper end - Add PlayerSetSpawnEvent
|
||||
+ }
|
||||
+ // Paper start - Add PlayerSetSpawnEvent
|
||||
+ if (actualTargets.isEmpty()) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ // Paper end - Add PlayerSetSpawnEvent
|
||||
|
||||
String string = resourceKey.location().toString();
|
||||
- if (targets.size() == 1) {
|
||||
+ if (actualTargets.size() == 1) { // Paper - Add PlayerSetSpawnEvent
|
||||
source.sendSuccess(
|
||||
() -> Component.translatable(
|
||||
- "commands.spawnpoint.success.single", pos.getX(), pos.getY(), pos.getZ(), angle, string, targets.iterator().next().getDisplayName()
|
||||
+ "commands.spawnpoint.success.single", pos.getX(), pos.getY(), pos.getZ(), angle, string, actualTargets.iterator().next().getDisplayName() // Paper - Add PlayerSetSpawnEvent
|
||||
),
|
||||
true
|
||||
);
|
||||
} else {
|
||||
source.sendSuccess(
|
||||
- () -> Component.translatable("commands.spawnpoint.success.multiple", pos.getX(), pos.getY(), pos.getZ(), angle, string, targets.size()), true
|
||||
+ () -> Component.translatable("commands.spawnpoint.success.multiple", pos.getX(), pos.getY(), pos.getZ(), angle, string, actualTargets.size()), true // Paper - Add PlayerSetSpawnEvent
|
||||
);
|
||||
}
|
||||
|
||||
- return targets.size();
|
||||
+ return actualTargets.size(); // Paper - Add PlayerSetSpawnEvent
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/server/commands/SetWorldSpawnCommand.java
|
||||
+++ b/net/minecraft/server/commands/SetWorldSpawnCommand.java
|
||||
@@ -30,7 +30,7 @@
|
||||
private static int setSpawn(CommandSourceStack source, BlockPos pos, float angle) {
|
||||
ServerLevel worldserver = source.getLevel();
|
||||
@@ -33,7 +_,7 @@
|
||||
|
||||
- if (worldserver.dimension() != Level.OVERWORLD) {
|
||||
+ if (false && worldserver.dimension() != Level.OVERWORLD) { // CraftBukkit - SPIGOT-7649: allow in all worlds
|
||||
private static int setSpawn(CommandSourceStack source, BlockPos pos, float angle) {
|
||||
ServerLevel level = source.getLevel();
|
||||
- if (level.dimension() != Level.OVERWORLD) {
|
||||
+ if (false && level.dimension() != Level.OVERWORLD) { // CraftBukkit - SPIGOT-7649: allow in all worlds
|
||||
source.sendFailure(Component.translatable("commands.setworldspawn.failure.not_overworld"));
|
||||
return 0;
|
||||
} else {
|
@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/server/commands/SpreadPlayersCommand.java
|
||||
+++ b/net/minecraft/server/commands/SpreadPlayersCommand.java
|
||||
@@ -255,6 +_,7 @@
|
||||
entity.getYRot(),
|
||||
entity.getXRot(),
|
||||
true
|
||||
+ , org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND // CraftBukkit - handle teleport reason
|
||||
);
|
||||
double d1 = Double.MAX_VALUE;
|
||||
|
@ -0,0 +1,19 @@
|
||||
--- a/net/minecraft/server/commands/SummonCommand.java
|
||||
+++ b/net/minecraft/server/commands/SummonCommand.java
|
||||
@@ -82,6 +_,7 @@
|
||||
ServerLevel level = source.getLevel();
|
||||
Entity entity = EntityType.loadEntityRecursive(compoundTag, level, EntitySpawnReason.COMMAND, entity1 -> {
|
||||
entity1.moveTo(pos.x, pos.y, pos.z, entity1.getYRot(), entity1.getXRot());
|
||||
+ entity1.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.COMMAND; // Paper - Entity#getEntitySpawnReason
|
||||
return entity1;
|
||||
});
|
||||
if (entity == null) {
|
||||
@@ -92,7 +_,7 @@
|
||||
.finalizeSpawn(source.getLevel(), source.getLevel().getCurrentDifficultyAt(entity.blockPosition()), EntitySpawnReason.COMMAND, null);
|
||||
}
|
||||
|
||||
- if (!level.tryAddFreshEntityWithPassengers(entity)) {
|
||||
+ if (!level.tryAddFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.COMMAND)) { // CraftBukkit - pass a spawn reason of "COMMAND"
|
||||
throw ERROR_DUPLICATE_UUID.create();
|
||||
} else {
|
||||
return entity;
|
@ -0,0 +1,43 @@
|
||||
--- a/net/minecraft/server/commands/TeleportCommand.java
|
||||
+++ b/net/minecraft/server/commands/TeleportCommand.java
|
||||
@@ -20,6 +_,7 @@
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@@ -290,7 +_,31 @@
|
||||
float f1 = relatives.contains(Relative.X_ROT) ? xRot - target.getXRot() : xRot;
|
||||
float f2 = Mth.wrapDegrees(f);
|
||||
float f3 = Mth.wrapDegrees(f1);
|
||||
- if (target.teleportTo(level, d, d1, d2, relatives, f2, f3, true)) {
|
||||
+ // CraftBukkit start - Teleport event
|
||||
+ boolean result;
|
||||
+ if (target instanceof ServerPlayer player) {
|
||||
+ result = player.teleportTo(level, d, d1, d2, relatives, f2, f3, true, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND);
|
||||
+ } else {
|
||||
+ org.bukkit.Location to = new org.bukkit.Location(level.getWorld(), d, d1, d2, f2, f3);
|
||||
+ org.bukkit.event.entity.EntityTeleportEvent event = new org.bukkit.event.entity.EntityTeleportEvent(target.getBukkitEntity(), target.getBukkitEntity().getLocation(), to);
|
||||
+ level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled() || event.getTo() == null) { // Paper
|
||||
+ return;
|
||||
+ }
|
||||
+ to = event.getTo(); // Paper - actually track new location
|
||||
+
|
||||
+ d = to.getX();
|
||||
+ d1 = to.getY();
|
||||
+ d2 = to.getZ();
|
||||
+ f2 = to.getYaw();
|
||||
+ f3 = to.getPitch();
|
||||
+ level = ((org.bukkit.craftbukkit.CraftWorld) to.getWorld()).getHandle();
|
||||
+
|
||||
+ result = target.teleportTo(level, d, d1, d2, relatives, f2, f3, true);
|
||||
+ }
|
||||
+
|
||||
+ if (result) {
|
||||
+ // CraftBukkit end
|
||||
if (lookAt != null) {
|
||||
lookAt.perform(source, target);
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
--- a/net/minecraft/server/commands/TimeCommand.java
|
||||
+++ b/net/minecraft/server/commands/TimeCommand.java
|
||||
@@ -56,8 +_,15 @@
|
||||
}
|
||||
|
||||
public static int setTime(CommandSourceStack source, int time) {
|
||||
- for (ServerLevel serverLevel : source.getServer().getAllLevels()) {
|
||||
- serverLevel.setDayTime(time);
|
||||
+ for (ServerLevel serverLevel : io.papermc.paper.configuration.GlobalConfiguration.get().commands.timeCommandAffectsAllWorlds ? source.getServer().getAllLevels() : java.util.List.of(source.getLevel())) { // CraftBukkit - SPIGOT-6496: Only set the time for the world the command originates in // Paper - add config option for spigot's change
|
||||
+ // serverLevel.setDayTime(time);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.world.TimeSkipEvent event = new org.bukkit.event.world.TimeSkipEvent(serverLevel.getWorld(), org.bukkit.event.world.TimeSkipEvent.SkipReason.COMMAND, time - serverLevel.getDayTime());
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ serverLevel.setDayTime(serverLevel.getDayTime() + event.getSkipAmount());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
source.getServer().forceTimeSynchronization();
|
||||
@@ -66,8 +_,14 @@
|
||||
}
|
||||
|
||||
public static int addTime(CommandSourceStack source, int amount) {
|
||||
- for (ServerLevel serverLevel : source.getServer().getAllLevels()) {
|
||||
- serverLevel.setDayTime(serverLevel.getDayTime() + amount);
|
||||
+ for (ServerLevel serverLevel : io.papermc.paper.configuration.GlobalConfiguration.get().commands.timeCommandAffectsAllWorlds ? source.getServer().getAllLevels() : java.util.List.of(source.getLevel())) { // CraftBukkit - SPIGOT-6496: Only set the time for the world the command originates in // Paper - add config option for spigot's change
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.world.TimeSkipEvent event = new org.bukkit.event.world.TimeSkipEvent(serverLevel.getWorld(), org.bukkit.event.world.TimeSkipEvent.SkipReason.COMMAND, amount);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ serverLevel.setDayTime(serverLevel.getDayTime() + event.getSkipAmount());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
source.getServer().forceTimeSynchronization();
|
@ -0,0 +1,30 @@
|
||||
--- a/net/minecraft/server/commands/WeatherCommand.java
|
||||
+++ b/net/minecraft/server/commands/WeatherCommand.java
|
||||
@@ -44,23 +_,23 @@
|
||||
}
|
||||
|
||||
private static int getDuration(CommandSourceStack source, int time, IntProvider timeProvider) {
|
||||
- return time == -1 ? timeProvider.sample(source.getServer().overworld().getRandom()) : time;
|
||||
+ return time == -1 ? timeProvider.sample(source.getLevel().getRandom()) : time; // CraftBukkit - SPIGOT-7680: per-world
|
||||
}
|
||||
|
||||
private static int setClear(CommandSourceStack source, int time) {
|
||||
- source.getServer().overworld().setWeatherParameters(getDuration(source, time, ServerLevel.RAIN_DELAY), 0, false, false);
|
||||
+ source.getLevel().setWeatherParameters(getDuration(source, time, ServerLevel.RAIN_DELAY), 0, false, false); // CraftBukkit - SPIGOT-7680: per-world
|
||||
source.sendSuccess(() -> Component.translatable("commands.weather.set.clear"), true);
|
||||
return time;
|
||||
}
|
||||
|
||||
private static int setRain(CommandSourceStack source, int time) {
|
||||
- source.getServer().overworld().setWeatherParameters(0, getDuration(source, time, ServerLevel.RAIN_DURATION), true, false);
|
||||
+ source.getLevel().setWeatherParameters(0, getDuration(source, time, ServerLevel.RAIN_DURATION), true, false); // CraftBukkit - SPIGOT-7680: per-world
|
||||
source.sendSuccess(() -> Component.translatable("commands.weather.set.rain"), true);
|
||||
return time;
|
||||
}
|
||||
|
||||
private static int setThunder(CommandSourceStack source, int time) {
|
||||
- source.getServer().overworld().setWeatherParameters(0, getDuration(source, time, ServerLevel.THUNDER_DURATION), true, true);
|
||||
+ source.getLevel().setWeatherParameters(0, getDuration(source, time, ServerLevel.THUNDER_DURATION), true, true); // CraftBukkit - SPIGOT-7680: per-world
|
||||
source.sendSuccess(() -> Component.translatable("commands.weather.set.thunder"), true);
|
||||
return time;
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
--- a/net/minecraft/server/commands/WorldBorderCommand.java
|
||||
+++ b/net/minecraft/server/commands/WorldBorderCommand.java
|
||||
@@ -135,7 +_,7 @@
|
||||
}
|
||||
|
||||
private static int setDamageBuffer(CommandSourceStack source, float distance) throws CommandSyntaxException {
|
||||
- WorldBorder worldBorder = source.getServer().overworld().getWorldBorder();
|
||||
+ WorldBorder worldBorder = source.getLevel().getWorldBorder(); // CraftBukkit
|
||||
if (worldBorder.getDamageSafeZone() == distance) {
|
||||
throw ERROR_SAME_DAMAGE_BUFFER.create();
|
||||
} else {
|
||||
@@ -146,7 +_,7 @@
|
||||
}
|
||||
|
||||
private static int setDamageAmount(CommandSourceStack source, float damagePerBlock) throws CommandSyntaxException {
|
||||
- WorldBorder worldBorder = source.getServer().overworld().getWorldBorder();
|
||||
+ WorldBorder worldBorder = source.getLevel().getWorldBorder(); // CraftBukkit
|
||||
if (worldBorder.getDamagePerBlock() == damagePerBlock) {
|
||||
throw ERROR_SAME_DAMAGE_AMOUNT.create();
|
||||
} else {
|
||||
@@ -159,7 +_,7 @@
|
||||
}
|
||||
|
||||
private static int setWarningTime(CommandSourceStack source, int time) throws CommandSyntaxException {
|
||||
- WorldBorder worldBorder = source.getServer().overworld().getWorldBorder();
|
||||
+ WorldBorder worldBorder = source.getLevel().getWorldBorder(); // CraftBukkit
|
||||
if (worldBorder.getWarningTime() == time) {
|
||||
throw ERROR_SAME_WARNING_TIME.create();
|
||||
} else {
|
||||
@@ -170,7 +_,7 @@
|
||||
}
|
||||
|
||||
private static int setWarningDistance(CommandSourceStack source, int distance) throws CommandSyntaxException {
|
||||
- WorldBorder worldBorder = source.getServer().overworld().getWorldBorder();
|
||||
+ WorldBorder worldBorder = source.getLevel().getWorldBorder(); // CraftBukkit
|
||||
if (worldBorder.getWarningBlocks() == distance) {
|
||||
throw ERROR_SAME_WARNING_DISTANCE.create();
|
||||
} else {
|
||||
@@ -181,13 +_,13 @@
|
||||
}
|
||||
|
||||
private static int getSize(CommandSourceStack source) {
|
||||
- double size = source.getServer().overworld().getWorldBorder().getSize();
|
||||
+ double size = source.getLevel().getWorldBorder().getSize(); // CraftBukkit
|
||||
source.sendSuccess(() -> Component.translatable("commands.worldborder.get", String.format(Locale.ROOT, "%.0f", size)), false);
|
||||
return Mth.floor(size + 0.5);
|
||||
}
|
||||
|
||||
private static int setCenter(CommandSourceStack source, Vec2 pos) throws CommandSyntaxException {
|
||||
- WorldBorder worldBorder = source.getServer().overworld().getWorldBorder();
|
||||
+ WorldBorder worldBorder = source.getLevel().getWorldBorder(); // CraftBukkit
|
||||
if (worldBorder.getCenterX() == pos.x && worldBorder.getCenterZ() == pos.y) {
|
||||
throw ERROR_SAME_CENTER.create();
|
||||
} else if (!(Math.abs(pos.x) > 2.9999984E7) && !(Math.abs(pos.y) > 2.9999984E7)) {
|
||||
@@ -205,7 +_,7 @@
|
||||
}
|
||||
|
||||
private static int setSize(CommandSourceStack source, double newSize, long time) throws CommandSyntaxException {
|
||||
- WorldBorder worldBorder = source.getServer().overworld().getWorldBorder();
|
||||
+ WorldBorder worldBorder = source.getLevel().getWorldBorder(); // CraftBukkit
|
||||
double size = worldBorder.getSize();
|
||||
if (size == newSize) {
|
||||
throw ERROR_SAME_SIZE.create();
|
@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/BanPlayerCommands.java
|
||||
+++ b/net/minecraft/server/commands/BanPlayerCommands.java
|
||||
@@ -55,7 +55,7 @@
|
||||
);
|
||||
ServerPlayer serverPlayer = source.getServer().getPlayerList().getPlayer(gameProfile.getId());
|
||||
if (serverPlayer != null) {
|
||||
- serverPlayer.connection.disconnect(Component.translatable("multiplayer.disconnect.banned"));
|
||||
+ serverPlayer.connection.disconnect(Component.translatable("multiplayer.disconnect.banned"), org.bukkit.event.player.PlayerKickEvent.Cause.BANNED); // Paper - kick event cause
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/DifficultyCommand.java
|
||||
+++ b/net/minecraft/server/commands/DifficultyCommand.java
|
||||
@@ -44,11 +44,12 @@
|
||||
|
||||
public static int setDifficulty(CommandSourceStack source, Difficulty difficulty) throws CommandSyntaxException {
|
||||
MinecraftServer minecraftserver = source.getServer();
|
||||
+ net.minecraft.server.level.ServerLevel worldServer = source.getLevel(); // CraftBukkit
|
||||
|
||||
- if (minecraftserver.getWorldData().getDifficulty() == difficulty) {
|
||||
+ if (worldServer.getDifficulty() == difficulty) { // CraftBukkit
|
||||
throw DifficultyCommand.ERROR_ALREADY_DIFFICULT.create(difficulty.getKey());
|
||||
} else {
|
||||
- minecraftserver.setDifficulty(difficulty, true);
|
||||
+ minecraftserver.setDifficulty(worldServer, difficulty, true); // Paper - per level difficulty; don't skip other difficulty-changing logic (fix upstream's fix)
|
||||
source.sendSuccess(() -> {
|
||||
return Component.translatable("commands.difficulty.success", difficulty.getDisplayName());
|
||||
}, true);
|
@ -1,29 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/EffectCommands.java
|
||||
+++ b/net/minecraft/server/commands/EffectCommands.java
|
||||
@@ -84,7 +84,7 @@
|
||||
if (entity instanceof LivingEntity) {
|
||||
MobEffectInstance mobeffect = new MobEffectInstance(statusEffect, k, amplifier, false, showParticles);
|
||||
|
||||
- if (((LivingEntity) entity).addEffect(mobeffect, source.getEntity())) {
|
||||
+ if (((LivingEntity) entity).addEffect(mobeffect, source.getEntity(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
- if (entity instanceof LivingEntity && ((LivingEntity) entity).removeAllEffects()) {
|
||||
+ if (entity instanceof LivingEntity && ((LivingEntity) entity).removeAllEffects(org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
|
||||
++i;
|
||||
}
|
||||
}
|
||||
@@ -144,7 +144,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
- if (entity instanceof LivingEntity && ((LivingEntity) entity).removeEffect(statusEffect)) {
|
||||
+ if (entity instanceof LivingEntity && ((LivingEntity) entity).removeEffect(statusEffect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
|
||||
++i;
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/GameRuleCommand.java
|
||||
+++ b/net/minecraft/server/commands/GameRuleCommand.java
|
||||
@@ -34,9 +34,9 @@
|
||||
|
||||
static <T extends GameRules.Value<T>> int setRule(CommandContext<CommandSourceStack> context, GameRules.Key<T> key) {
|
||||
CommandSourceStack commandlistenerwrapper = (CommandSourceStack) context.getSource();
|
||||
- T t0 = commandlistenerwrapper.getServer().getGameRules().getRule(key);
|
||||
+ T t0 = commandlistenerwrapper.getLevel().getGameRules().getRule(key); // CraftBukkit
|
||||
|
||||
- t0.setFromArgument(context, "value");
|
||||
+ t0.setFromArgument(context, "value", key); // Paper - Add WorldGameRuleChangeEvent
|
||||
commandlistenerwrapper.sendSuccess(() -> {
|
||||
return Component.translatable("commands.gamerule.set", key.getId(), t0.toString());
|
||||
}, true);
|
||||
@@ -44,7 +44,7 @@
|
||||
}
|
||||
|
||||
static <T extends GameRules.Value<T>> int queryRule(CommandSourceStack source, GameRules.Key<T> key) {
|
||||
- T t0 = source.getServer().getGameRules().getRule(key);
|
||||
+ T t0 = source.getLevel().getGameRules().getRule(key); // CraftBukkit
|
||||
|
||||
source.sendSuccess(() -> {
|
||||
return Component.translatable("commands.gamerule.query", key.getId(), t0.toString());
|
@ -1,33 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/GiveCommand.java
|
||||
+++ b/net/minecraft/server/commands/GiveCommand.java
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
private static int giveItem(CommandSourceStack source, ItemInput item, Collection<ServerPlayer> targets, int count) throws CommandSyntaxException {
|
||||
ItemStack itemstack = item.createItemStack(1, false);
|
||||
+ final Component displayName = itemstack.getDisplayName(); // Paper - get display name early
|
||||
int j = itemstack.getMaxStackSize();
|
||||
int k = j * 100;
|
||||
|
||||
@@ -60,7 +61,7 @@
|
||||
ItemEntity entityitem;
|
||||
|
||||
if (flag && itemstack1.isEmpty()) {
|
||||
- entityitem = entityplayer.drop(itemstack, false);
|
||||
+ entityitem = entityplayer.drop(itemstack, false, false, false); // CraftBukkit - SPIGOT-2942: Add boolean to call event
|
||||
if (entityitem != null) {
|
||||
entityitem.makeFakeItem();
|
||||
}
|
||||
@@ -79,11 +80,11 @@
|
||||
|
||||
if (targets.size() == 1) {
|
||||
source.sendSuccess(() -> {
|
||||
- return Component.translatable("commands.give.success.single", count, itemstack.getDisplayName(), ((ServerPlayer) targets.iterator().next()).getDisplayName());
|
||||
+ return Component.translatable("commands.give.success.single", count, displayName, ((ServerPlayer) targets.iterator().next()).getDisplayName()); // Paper - use cached display name
|
||||
}, true);
|
||||
} else {
|
||||
source.sendSuccess(() -> {
|
||||
- return Component.translatable("commands.give.success.single", count, itemstack.getDisplayName(), targets.size());
|
||||
+ return Component.translatable("commands.give.success.single", count, displayName, targets.size()); // Paper - use cached display name
|
||||
}, true);
|
||||
}
|
||||
|
@ -1,18 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/ListPlayersCommand.java
|
||||
+++ b/net/minecraft/server/commands/ListPlayersCommand.java
|
||||
@@ -35,7 +35,14 @@
|
||||
|
||||
private static int format(CommandSourceStack source, Function<ServerPlayer, Component> nameProvider) {
|
||||
PlayerList playerlist = source.getServer().getPlayerList();
|
||||
- List<ServerPlayer> list = playerlist.getPlayers();
|
||||
+ // CraftBukkit start
|
||||
+ List<ServerPlayer> players = playerlist.getPlayers();
|
||||
+ if (source.getBukkitSender() instanceof org.bukkit.entity.Player) {
|
||||
+ org.bukkit.entity.Player sender = (org.bukkit.entity.Player) source.getBukkitSender();
|
||||
+ players = players.stream().filter((ep) -> sender.canSee(ep.getBukkitEntity())).collect(java.util.stream.Collectors.toList());
|
||||
+ }
|
||||
+ List<ServerPlayer> list = players;
|
||||
+ // CraftBukkit end
|
||||
Component ichatbasecomponent = ComponentUtils.formatList(list, nameProvider);
|
||||
|
||||
source.sendSuccess(() -> {
|
@ -1,19 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/LootCommand.java
|
||||
+++ b/net/minecraft/server/commands/LootCommand.java
|
||||
@@ -95,7 +95,7 @@
|
||||
}
|
||||
|
||||
private static <T extends ArgumentBuilder<CommandSourceStack, T>> T addTargets(T rootArgument, LootCommand.TailProvider sourceConstructor) {
|
||||
- return rootArgument.then(((LiteralArgumentBuilder) net.minecraft.commands.Commands.literal("replace").then(net.minecraft.commands.Commands.literal("entity").then(net.minecraft.commands.Commands.argument("entities", EntityArgument.entities()).then(sourceConstructor.construct(net.minecraft.commands.Commands.argument("slot", SlotArgument.slot()), (commandcontext, list, commandloot_a) -> {
|
||||
+ return (T) rootArgument.then(((LiteralArgumentBuilder) net.minecraft.commands.Commands.literal("replace").then(net.minecraft.commands.Commands.literal("entity").then(net.minecraft.commands.Commands.argument("entities", EntityArgument.entities()).then(sourceConstructor.construct(net.minecraft.commands.Commands.argument("slot", SlotArgument.slot()), (commandcontext, list, commandloot_a) -> { // CraftBukkit - decompile error
|
||||
return LootCommand.entityReplace(EntityArgument.getEntities(commandcontext, "entities"), SlotArgument.getSlot(commandcontext, "slot"), list.size(), list, commandloot_a);
|
||||
}).then(sourceConstructor.construct(net.minecraft.commands.Commands.argument("count", IntegerArgumentType.integer(0)), (commandcontext, list, commandloot_a) -> {
|
||||
return LootCommand.entityReplace(EntityArgument.getEntities(commandcontext, "entities"), SlotArgument.getSlot(commandcontext, "slot"), IntegerArgumentType.getInteger(commandcontext, "count"), list, commandloot_a);
|
||||
@@ -250,6 +250,7 @@
|
||||
private static int dropInWorld(CommandSourceStack source, Vec3 pos, List<ItemStack> stacks, LootCommand.Callback messageSender) throws CommandSyntaxException {
|
||||
ServerLevel worldserver = source.getLevel();
|
||||
|
||||
+ stacks.removeIf(ItemStack::isEmpty); // CraftBukkit - SPIGOT-6959 Remove empty items for avoid throw an error in new EntityItem
|
||||
stacks.forEach((itemstack) -> {
|
||||
ItemEntity entityitem = new ItemEntity(worldserver, pos.x, pos.y, pos.z, itemstack.copy());
|
||||
|
@ -1,10 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/PlaceCommand.java
|
||||
+++ b/net/minecraft/server/commands/PlaceCommand.java
|
||||
@@ -132,6 +132,7 @@
|
||||
if (!structurestart.isValid()) {
|
||||
throw PlaceCommand.ERROR_STRUCTURE_FAILED.create();
|
||||
} else {
|
||||
+ structurestart.generationEventCause = org.bukkit.event.world.AsyncStructureGenerateEvent.Cause.COMMAND; // CraftBukkit - set AsyncStructureGenerateEvent.Cause.COMMAND as generation cause
|
||||
BoundingBox structureboundingbox = structurestart.getBoundingBox();
|
||||
ChunkPos chunkcoordintpair = new ChunkPos(SectionPos.blockToSectionCoord(structureboundingbox.minX()), SectionPos.blockToSectionCoord(structureboundingbox.minZ()));
|
||||
ChunkPos chunkcoordintpair1 = new ChunkPos(SectionPos.blockToSectionCoord(structureboundingbox.maxX()), SectionPos.blockToSectionCoord(structureboundingbox.maxZ()));
|
@ -1,29 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/ScheduleCommand.java
|
||||
+++ b/net/minecraft/server/commands/ScheduleCommand.java
|
||||
@@ -33,7 +33,7 @@
|
||||
});
|
||||
private static final SimpleCommandExceptionType ERROR_MACRO = new SimpleCommandExceptionType(Component.translatableEscape("commands.schedule.macro"));
|
||||
private static final SuggestionProvider<CommandSourceStack> SUGGEST_SCHEDULE = (commandcontext, suggestionsbuilder) -> {
|
||||
- return SharedSuggestionProvider.suggest((Iterable) ((CommandSourceStack) commandcontext.getSource()).getServer().getWorldData().overworldData().getScheduledEvents().getEventsIds(), suggestionsbuilder);
|
||||
+ return SharedSuggestionProvider.suggest((Iterable) ((net.minecraft.commands.CommandSourceStack) commandcontext.getSource()).getLevel().serverLevelData.getScheduledEvents().getEventsIds(), suggestionsbuilder); // Paper - Make schedule command per-world
|
||||
};
|
||||
|
||||
public ScheduleCommand() {}
|
||||
@@ -58,7 +58,7 @@
|
||||
} else {
|
||||
long j = source.getLevel().getGameTime() + (long) time;
|
||||
ResourceLocation minecraftkey = (ResourceLocation) function.getFirst();
|
||||
- TimerQueue<MinecraftServer> customfunctioncallbacktimerqueue = source.getServer().getWorldData().overworldData().getScheduledEvents();
|
||||
+ TimerQueue<MinecraftServer> customfunctioncallbacktimerqueue = source.getLevel().serverLevelData.overworldData().getScheduledEvents(); // CraftBukkit - SPIGOT-6667: Use world specific function timer
|
||||
Optional<net.minecraft.commands.functions.CommandFunction<CommandSourceStack>> optional = ((Either) function.getSecond()).left();
|
||||
String s;
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
}
|
||||
|
||||
private static int remove(CommandSourceStack source, String eventName) throws CommandSyntaxException {
|
||||
- int i = source.getServer().getWorldData().overworldData().getScheduledEvents().remove(eventName);
|
||||
+ int i = source.getLevel().serverLevelData.getScheduledEvents().remove(eventName); // Paper - Make schedule command per-world
|
||||
|
||||
if (i == 0) {
|
||||
throw ScheduleCommand.ERROR_CANT_REMOVE.create(eventName);
|
@ -1,42 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/SetSpawnCommand.java
|
||||
+++ b/net/minecraft/server/commands/SetSpawnCommand.java
|
||||
@@ -38,24 +38,34 @@
|
||||
ResourceKey<Level> resourcekey = source.getLevel().dimension();
|
||||
Iterator iterator = targets.iterator();
|
||||
|
||||
+ final Collection<ServerPlayer> actualTargets = new java.util.ArrayList<>(); // Paper - Add PlayerSetSpawnEvent
|
||||
while (iterator.hasNext()) {
|
||||
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
|
||||
|
||||
- entityplayer.setRespawnPosition(resourcekey, pos, angle, true, false);
|
||||
+ // Paper start - Add PlayerSetSpawnEvent
|
||||
+ if (entityplayer.setRespawnPosition(resourcekey, pos, angle, true, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.COMMAND)) {
|
||||
+ actualTargets.add(entityplayer);
|
||||
+ }
|
||||
+ // Paper end - Add PlayerSetSpawnEvent
|
||||
}
|
||||
+ // Paper start - Add PlayerSetSpawnEvent
|
||||
+ if (actualTargets.isEmpty()) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ // Paper end - Add PlayerSetSpawnEvent
|
||||
|
||||
String s = resourcekey.location().toString();
|
||||
|
||||
- if (targets.size() == 1) {
|
||||
+ if (actualTargets.size() == 1) { // Paper - Add PlayerSetSpawnEvent
|
||||
source.sendSuccess(() -> {
|
||||
- return Component.translatable("commands.spawnpoint.success.single", pos.getX(), pos.getY(), pos.getZ(), angle, s, ((ServerPlayer) targets.iterator().next()).getDisplayName());
|
||||
+ return Component.translatable("commands.spawnpoint.success.single", pos.getX(), pos.getY(), pos.getZ(), angle, s, ((ServerPlayer) actualTargets.iterator().next()).getDisplayName()); // Paper - Add PlayerSetSpawnEvent
|
||||
}, true);
|
||||
} else {
|
||||
source.sendSuccess(() -> {
|
||||
- return Component.translatable("commands.spawnpoint.success.multiple", pos.getX(), pos.getY(), pos.getZ(), angle, s, targets.size());
|
||||
+ return Component.translatable("commands.spawnpoint.success.multiple", pos.getX(), pos.getY(), pos.getZ(), angle, s, actualTargets.size()); // Paper - Add PlayerSetSpawnEvent
|
||||
}, true);
|
||||
}
|
||||
|
||||
- return targets.size();
|
||||
+ return actualTargets.size(); // Paper - Add PlayerSetSpawnEvent
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/SpreadPlayersCommand.java
|
||||
+++ b/net/minecraft/server/commands/SpreadPlayersCommand.java
|
||||
@@ -93,7 +93,7 @@
|
||||
if (entity instanceof Player) {
|
||||
set.add(entity.getTeam());
|
||||
} else {
|
||||
- set.add((Object) null);
|
||||
+ set.add((Team) null); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@
|
||||
commandspreadplayers_a = piles[j++];
|
||||
}
|
||||
|
||||
- entity.teleportTo(world, (double) Mth.floor(commandspreadplayers_a.x) + 0.5D, (double) commandspreadplayers_a.getSpawnY(world, maxY), (double) Mth.floor(commandspreadplayers_a.z) + 0.5D, Set.of(), entity.getYRot(), entity.getXRot(), true);
|
||||
+ entity.teleportTo(world, (double) Mth.floor(commandspreadplayers_a.x) + 0.5D, (double) commandspreadplayers_a.getSpawnY(world, maxY), (double) Mth.floor(commandspreadplayers_a.z) + 0.5D, Set.of(), entity.getYRot(), entity.getXRot(), true, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit - handle teleport reason
|
||||
d1 = Double.MAX_VALUE;
|
||||
SpreadPlayersCommand.Position[] acommandspreadplayers_a1 = piles;
|
||||
int k = piles.length;
|
@ -1,19 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/SummonCommand.java
|
||||
+++ b/net/minecraft/server/commands/SummonCommand.java
|
||||
@@ -57,6 +57,7 @@
|
||||
ServerLevel worldserver = source.getLevel();
|
||||
Entity entity = EntityType.loadEntityRecursive(nbttagcompound1, worldserver, EntitySpawnReason.COMMAND, (entity1) -> {
|
||||
entity1.moveTo(pos.x, pos.y, pos.z, entity1.getYRot(), entity1.getXRot());
|
||||
+ entity1.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.COMMAND; // Paper - Entity#getEntitySpawnReason
|
||||
return entity1;
|
||||
});
|
||||
|
||||
@@ -67,7 +68,7 @@
|
||||
((Mob) entity).finalizeSpawn(source.getLevel(), source.getLevel().getCurrentDifficultyAt(entity.blockPosition()), EntitySpawnReason.COMMAND, (SpawnGroupData) null);
|
||||
}
|
||||
|
||||
- if (!worldserver.tryAddFreshEntityWithPassengers(entity)) {
|
||||
+ if (!worldserver.tryAddFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.COMMAND)) { // CraftBukkit - pass a spawn reason of "COMMAND"
|
||||
throw SummonCommand.ERROR_DUPLICATE_UUID.create();
|
||||
} else {
|
||||
return entity;
|
@ -1,55 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/TeleportCommand.java
|
||||
+++ b/net/minecraft/server/commands/TeleportCommand.java
|
||||
@@ -22,6 +22,7 @@
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@@ -30,6 +31,11 @@
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec2;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.CraftWorld;
|
||||
+import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class TeleportCommand {
|
||||
|
||||
@@ -167,7 +173,31 @@
|
||||
float f4 = Mth.wrapDegrees(f2);
|
||||
float f5 = Mth.wrapDegrees(f3);
|
||||
|
||||
- if (target.teleportTo(world, d3, d4, d5, movementFlags, f4, f5, true)) {
|
||||
+ // CraftBukkit start - Teleport event
|
||||
+ boolean result;
|
||||
+ if (target instanceof ServerPlayer player) {
|
||||
+ result = player.teleportTo(world, d3, d4, d5, movementFlags, f4, f5, true, PlayerTeleportEvent.TeleportCause.COMMAND);
|
||||
+ } else {
|
||||
+ Location to = new Location(world.getWorld(), d3, d4, d5, f4, f5);
|
||||
+ EntityTeleportEvent event = new EntityTeleportEvent(target.getBukkitEntity(), target.getBukkitEntity().getLocation(), to);
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled() || event.getTo() == null) { // Paper
|
||||
+ return;
|
||||
+ }
|
||||
+ to = event.getTo(); // Paper - actually track new location
|
||||
+
|
||||
+ d3 = to.getX();
|
||||
+ d4 = to.getY();
|
||||
+ d5 = to.getZ();
|
||||
+ f4 = to.getYaw();
|
||||
+ f5 = to.getPitch();
|
||||
+ world = ((CraftWorld) to.getWorld()).getHandle();
|
||||
+
|
||||
+ result = target.teleportTo(world, d3, d4, d5, movementFlags, f4, f5, true);
|
||||
+ }
|
||||
+
|
||||
+ if (result) {
|
||||
+ // CraftBukkit end
|
||||
if (facingLocation != null) {
|
||||
facingLocation.perform(source, target);
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/TimeCommand.java
|
||||
+++ b/net/minecraft/server/commands/TimeCommand.java
|
||||
@@ -8,6 +8,10 @@
|
||||
import net.minecraft.commands.arguments.TimeArgument;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.event.world.TimeSkipEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class TimeCommand {
|
||||
|
||||
@@ -49,12 +53,18 @@
|
||||
}
|
||||
|
||||
public static int setTime(CommandSourceStack source, int time) {
|
||||
- Iterator iterator = source.getServer().getAllLevels().iterator();
|
||||
+ Iterator iterator = io.papermc.paper.configuration.GlobalConfiguration.get().commands.timeCommandAffectsAllWorlds ? source.getServer().getAllLevels().iterator() : com.google.common.collect.Iterators.singletonIterator(source.getLevel()); // CraftBukkit - SPIGOT-6496: Only set the time for the world the command originates in // Paper - add config option for spigot's change
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
ServerLevel worldserver = (ServerLevel) iterator.next();
|
||||
|
||||
- worldserver.setDayTime((long) time);
|
||||
+ // CraftBukkit start
|
||||
+ TimeSkipEvent event = new TimeSkipEvent(worldserver.getWorld(), TimeSkipEvent.SkipReason.COMMAND, time - worldserver.getDayTime());
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ worldserver.setDayTime((long) worldserver.getDayTime() + event.getSkipAmount());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
source.getServer().forceTimeSynchronization();
|
||||
@@ -65,12 +75,18 @@
|
||||
}
|
||||
|
||||
public static int addTime(CommandSourceStack source, int time) {
|
||||
- Iterator iterator = source.getServer().getAllLevels().iterator();
|
||||
+ Iterator iterator = io.papermc.paper.configuration.GlobalConfiguration.get().commands.timeCommandAffectsAllWorlds ? source.getServer().getAllLevels().iterator() : com.google.common.collect.Iterators.singletonIterator(source.getLevel()); // CraftBukkit - SPIGOT-6496: Only set the time for the world the command originates in // Paper - add config option for spigot's change
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
ServerLevel worldserver = (ServerLevel) iterator.next();
|
||||
|
||||
- worldserver.setDayTime(worldserver.getDayTime() + (long) time);
|
||||
+ // CraftBukkit start
|
||||
+ TimeSkipEvent event = new TimeSkipEvent(worldserver.getWorld(), TimeSkipEvent.SkipReason.COMMAND, time);
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ worldserver.setDayTime(worldserver.getDayTime() + event.getSkipAmount());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
source.getServer().forceTimeSynchronization();
|
@ -1,34 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/WeatherCommand.java
|
||||
+++ b/net/minecraft/server/commands/WeatherCommand.java
|
||||
@@ -34,11 +34,11 @@
|
||||
}
|
||||
|
||||
private static int getDuration(CommandSourceStack source, int duration, IntProvider provider) {
|
||||
- return duration == -1 ? provider.sample(source.getServer().overworld().getRandom()) : duration;
|
||||
+ return duration == -1 ? provider.sample(source.getLevel().getRandom()) : duration; // CraftBukkit - SPIGOT-7680: per-world
|
||||
}
|
||||
|
||||
private static int setClear(CommandSourceStack source, int duration) {
|
||||
- source.getServer().overworld().setWeatherParameters(WeatherCommand.getDuration(source, duration, ServerLevel.RAIN_DELAY), 0, false, false);
|
||||
+ source.getLevel().setWeatherParameters(WeatherCommand.getDuration(source, duration, ServerLevel.RAIN_DELAY), 0, false, false); // CraftBukkit - SPIGOT-7680: per-world
|
||||
source.sendSuccess(() -> {
|
||||
return Component.translatable("commands.weather.set.clear");
|
||||
}, true);
|
||||
@@ -46,7 +46,7 @@
|
||||
}
|
||||
|
||||
private static int setRain(CommandSourceStack source, int duration) {
|
||||
- source.getServer().overworld().setWeatherParameters(0, WeatherCommand.getDuration(source, duration, ServerLevel.RAIN_DURATION), true, false);
|
||||
+ source.getLevel().setWeatherParameters(0, WeatherCommand.getDuration(source, duration, ServerLevel.RAIN_DURATION), true, false); // CraftBukkit - SPIGOT-7680: per-world
|
||||
source.sendSuccess(() -> {
|
||||
return Component.translatable("commands.weather.set.rain");
|
||||
}, true);
|
||||
@@ -54,7 +54,7 @@
|
||||
}
|
||||
|
||||
private static int setThunder(CommandSourceStack source, int duration) {
|
||||
- source.getServer().overworld().setWeatherParameters(0, WeatherCommand.getDuration(source, duration, ServerLevel.THUNDER_DURATION), true, true);
|
||||
+ source.getLevel().setWeatherParameters(0, WeatherCommand.getDuration(source, duration, ServerLevel.THUNDER_DURATION), true, true); // CraftBukkit - SPIGOT-7680: per-world
|
||||
source.sendSuccess(() -> {
|
||||
return Component.translatable("commands.weather.set.thunder");
|
||||
}, true);
|
@ -1,65 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/WorldBorderCommand.java
|
||||
+++ b/net/minecraft/server/commands/WorldBorderCommand.java
|
||||
@@ -57,7 +57,7 @@
|
||||
}
|
||||
|
||||
private static int setDamageBuffer(CommandSourceStack source, float distance) throws CommandSyntaxException {
|
||||
- WorldBorder worldborder = source.getServer().overworld().getWorldBorder();
|
||||
+ WorldBorder worldborder = source.getLevel().getWorldBorder(); // CraftBukkit
|
||||
|
||||
if (worldborder.getDamageSafeZone() == (double) distance) {
|
||||
throw WorldBorderCommand.ERROR_SAME_DAMAGE_BUFFER.create();
|
||||
@@ -71,7 +71,7 @@
|
||||
}
|
||||
|
||||
private static int setDamageAmount(CommandSourceStack source, float damagePerBlock) throws CommandSyntaxException {
|
||||
- WorldBorder worldborder = source.getServer().overworld().getWorldBorder();
|
||||
+ WorldBorder worldborder = source.getLevel().getWorldBorder(); // CraftBukkit
|
||||
|
||||
if (worldborder.getDamagePerBlock() == (double) damagePerBlock) {
|
||||
throw WorldBorderCommand.ERROR_SAME_DAMAGE_AMOUNT.create();
|
||||
@@ -85,7 +85,7 @@
|
||||
}
|
||||
|
||||
private static int setWarningTime(CommandSourceStack source, int time) throws CommandSyntaxException {
|
||||
- WorldBorder worldborder = source.getServer().overworld().getWorldBorder();
|
||||
+ WorldBorder worldborder = source.getLevel().getWorldBorder(); // CraftBukkit
|
||||
|
||||
if (worldborder.getWarningTime() == time) {
|
||||
throw WorldBorderCommand.ERROR_SAME_WARNING_TIME.create();
|
||||
@@ -99,7 +99,7 @@
|
||||
}
|
||||
|
||||
private static int setWarningDistance(CommandSourceStack source, int distance) throws CommandSyntaxException {
|
||||
- WorldBorder worldborder = source.getServer().overworld().getWorldBorder();
|
||||
+ WorldBorder worldborder = source.getLevel().getWorldBorder(); // CraftBukkit
|
||||
|
||||
if (worldborder.getWarningBlocks() == distance) {
|
||||
throw WorldBorderCommand.ERROR_SAME_WARNING_DISTANCE.create();
|
||||
@@ -113,7 +113,7 @@
|
||||
}
|
||||
|
||||
private static int getSize(CommandSourceStack source) {
|
||||
- double d0 = source.getServer().overworld().getWorldBorder().getSize();
|
||||
+ double d0 = source.getLevel().getWorldBorder().getSize(); // CraftBukkit
|
||||
|
||||
source.sendSuccess(() -> {
|
||||
return Component.translatable("commands.worldborder.get", String.format(Locale.ROOT, "%.0f", d0));
|
||||
@@ -122,7 +122,7 @@
|
||||
}
|
||||
|
||||
private static int setCenter(CommandSourceStack source, Vec2 pos) throws CommandSyntaxException {
|
||||
- WorldBorder worldborder = source.getServer().overworld().getWorldBorder();
|
||||
+ WorldBorder worldborder = source.getLevel().getWorldBorder(); // CraftBukkit
|
||||
|
||||
if (worldborder.getCenterX() == (double) pos.x && worldborder.getCenterZ() == (double) pos.y) {
|
||||
throw WorldBorderCommand.ERROR_SAME_CENTER.create();
|
||||
@@ -138,7 +138,7 @@
|
||||
}
|
||||
|
||||
private static int setSize(CommandSourceStack source, double distance, long time) throws CommandSyntaxException {
|
||||
- WorldBorder worldborder = source.getServer().overworld().getWorldBorder();
|
||||
+ WorldBorder worldborder = source.getLevel().getWorldBorder(); // CraftBukkit
|
||||
double d1 = worldborder.getSize();
|
||||
|
||||
if (d1 == distance) {
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren