Compare commits
20 Commits
bb3b7e6979
...
da0ba1e34b
| Author | SHA1 | Date | |
|---|---|---|---|
| da0ba1e34b | |||
| 6bc3fc6acd | |||
|
|
9b1798d643 | ||
|
|
c467df95a2 | ||
|
|
5a6ab97be6 | ||
|
|
515e12ca2d | ||
|
|
37b9ca1f90 | ||
|
|
7819df10a4 | ||
|
|
f225858235 | ||
|
|
058455e4ca | ||
|
|
d764c3ff8c | ||
| 53747c723b | |||
| a6bd638bab | |||
| 04924c1385 | |||
| 44cf7ff229 | |||
|
|
c06d6c6ae2 | ||
|
|
eb48d457d9 | ||
| 1f3cbc08da | |||
| 94b0d30c7f | |||
| 2833e4c0a5 |
@@ -492,6 +492,7 @@ public net.minecraft.world.inventory.BrewingStandMenu brewingStandData
|
||||
public net.minecraft.world.inventory.CraftingMenu access
|
||||
public net.minecraft.world.inventory.DispenserMenu dispenser
|
||||
public net.minecraft.world.inventory.HorseInventoryMenu SLOT_BODY_ARMOR
|
||||
public net.minecraft.world.inventory.HorseInventoryMenu horse
|
||||
public net.minecraft.world.inventory.MerchantContainer selectionHint
|
||||
public net.minecraft.world.inventory.Slot slot
|
||||
public net.minecraft.world.item.AdventureModePredicate predicates
|
||||
|
||||
@@ -79,7 +79,7 @@ public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
|
||||
RegistryKey<BlockType> BLOCK = create("block");
|
||||
/**
|
||||
* @apiNote use preferably only in the context of registry entries.
|
||||
* @see io.papermc.paper.registry.data
|
||||
* @see io.papermc.paper.registry.keys.ItemTypeKeys
|
||||
*/
|
||||
@ApiStatus.Experimental // Paper - already required for registry builders
|
||||
RegistryKey<ItemType> ITEM = create("item");
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package org.bukkit;
|
||||
|
||||
import java.io.File;
|
||||
import io.papermc.paper.raytracing.PositionedRayTraceConfigurationBuilder;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@@ -2410,9 +2408,17 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
public BiomeProvider getBiomeProvider();
|
||||
|
||||
/**
|
||||
* Saves world to disk
|
||||
* Saves the world to disk
|
||||
*/
|
||||
public void save();
|
||||
default void save() {
|
||||
save(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the world to disk
|
||||
* @param flush Whether to wait for the chunk writer to finish
|
||||
*/
|
||||
void save(boolean flush);
|
||||
|
||||
/**
|
||||
* Gets a list of all applied {@link BlockPopulator}s for this World
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.Range;
|
||||
|
||||
/**
|
||||
* A chunk generator is responsible for the initial shaping of an entire
|
||||
@@ -777,5 +778,18 @@ public abstract class ChunkGenerator {
|
||||
*/
|
||||
@Deprecated(since = "1.8.8")
|
||||
public byte getData(int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Get the current height of a position in the chunk data.
|
||||
* <p>This will differ based on which state generation of the chunk is currently at.
|
||||
* If for example the chunk is in the generate surface stage,
|
||||
* this will return what was already generated in the noise stage.</p>
|
||||
*
|
||||
* @param heightMap Heightmap to determine where to grab height
|
||||
* @param x the x location in the chunk from 0-15 inclusive
|
||||
* @param z the z location in the chunk from 0-15 inclusive
|
||||
* @return Y coordinate at highest position
|
||||
*/
|
||||
int getHeight(@NotNull HeightMap heightMap, @Range(from = 0L, to = 15L) int x, @Range(from = 0L, to = 15L) int z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,6 +242,11 @@ public interface InventoryView {
|
||||
@NotNull
|
||||
public InventoryType.SlotType getSlotType(int slot);
|
||||
|
||||
/**
|
||||
* Opens the inventory view.
|
||||
*/
|
||||
void open();
|
||||
|
||||
/**
|
||||
* Closes the inventory view.
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@@ -1306,6 +1307,31 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
this.craftDelegate.resetData(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies component values and component removals from the provided ItemStack.
|
||||
* <p>
|
||||
* Example:
|
||||
* <pre>{@code
|
||||
* Set<DataComponentType> types = Set.of(
|
||||
* DataComponentTypes.CONSUMABLE,
|
||||
* DataComponentTypes.ENCHANTMENT_GLINT_OVERRIDE,
|
||||
* DataComponentTypes.RARITY
|
||||
* );
|
||||
*
|
||||
* ItemStack source = ItemStack.of(Material.ENCHANTED_GOLDEN_APPLE);
|
||||
* ItemStack target = ItemStack.of(Material.GOLDEN_CARROT);
|
||||
*
|
||||
* target.copyDataFrom(source, types::contains);
|
||||
* }</pre>
|
||||
*
|
||||
* @param source the item stack to copy from
|
||||
* @param filter predicate for which components to copy
|
||||
*/
|
||||
@org.jetbrains.annotations.ApiStatus.Experimental
|
||||
public void copyDataFrom(final @NotNull ItemStack source, final @NotNull Predicate<io.papermc.paper.datacomponent.@NotNull DataComponentType> filter) {
|
||||
this.craftDelegate.copyDataFrom(source, filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the data component type is overridden from the default for the
|
||||
* item type.
|
||||
|
||||
@@ -366,7 +366,7 @@ index d95413af04121fe91ca0f3b0c70025b9808acef9..ad665c7535c615d2b03a3e7864be435f
|
||||
import org.slf4j.Logger;
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||
index cdb4d313eb33c049c8467fe5d31fb0d671737768..40b799fd90b0db13bdaa8834c021f5ca8f25ce10 100644
|
||||
index f45fb8ddb08d82ce76018b5a5c4fce5b3b319559..12f0dc36c5adcdbd9e1dad5f8512ac184da3960f 100644
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -551,6 +551,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
@@ -476,7 +476,7 @@ index 24735284fda151414d99faad401d25ba60995f9a..23b342cc31c7e72ade0e1ccad86a9ccf
|
||||
public void tick() {
|
||||
super.tick();
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 54cf80831372d102e8d2966ac104678caebdf336..d89c3949e16ff6cb0374da29ec6731d854b5f105 100644
|
||||
index 2facc7ad69bfe28c2f928a026ba5ab37387ab039..6256d7f8f4ee8bd4e3673b4e069af5cc0069c8f2 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -381,6 +381,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -533,7 +533,7 @@ index 54cf80831372d102e8d2966ac104678caebdf336..d89c3949e16ff6cb0374da29ec6731d8
|
||||
movement = this.maybeBackOffFromEdge(movement, type);
|
||||
Vec3 vec3 = this.collide(movement);
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index bf5fd2a6c8630ea2bb06881d4d365dda9a4e90ea..4713c29cc2add476f568163a29cb297f5d1049df 100644
|
||||
index e0c310d970a687945b6a771b4ecb94044128c33c..4546aca8e2e144ec207653c713fc49f849908827 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3103,6 +3103,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -552,7 +552,7 @@ index bf5fd2a6c8630ea2bb06881d4d365dda9a4e90ea..4713c29cc2add476f568163a29cb297f
|
||||
public void tick() {
|
||||
super.tick();
|
||||
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
|
||||
index f7d69db61d1293510428ae275e8a50571dde5ddf..1ed07fd23985a6bf8cf8300f74c92b7531a79fc6 100644
|
||||
index e12b47ca5eeb842bae606c0c7a8e3e4cf7d468a9..e330bf990e4874baed1b21cd8c9b44d66ec5b823 100644
|
||||
--- a/net/minecraft/world/entity/Mob.java
|
||||
+++ b/net/minecraft/world/entity/Mob.java
|
||||
@@ -215,6 +215,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
@@ -764,7 +764,7 @@ index c1e09e701757a300183b62d343ded03033e63aa7..56574f8ef879159edc0114da09300143
|
||||
public void tick() {
|
||||
super.tick();
|
||||
diff --git a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
||||
index 7c0862c50b44555fb27ce7dc46f4ec95a3eb0022..774ca9e0b56fd175ae246051de762d0c4256ca58 100644
|
||||
index a3e4605a81eeaca77cc3a3ab937b75a415d83037..c7ae41b2cbc1eb85a6eb9c16813bd326fb8f49f0 100644
|
||||
--- a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
||||
+++ b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
||||
@@ -102,6 +102,21 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
|
||||
@@ -776,11 +776,11 @@ index 7c0862c50b44555fb27ce7dc46f4ec95a3eb0022..774ca9e0b56fd175ae246051de762d0c
|
||||
+ public void inactiveTick() {
|
||||
+ this.life++;
|
||||
+ if (this.life > this.lifetime && this.level() instanceof ServerLevel serverLevel) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
|
||||
+ // Paper start - Call FireworkExplodeEvent
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this)) {
|
||||
+ this.explode(serverLevel);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // Paper end - Call FireworkExplodeEvent
|
||||
+ }
|
||||
+ super.inactiveTick();
|
||||
+ }
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Chaoscaot <chaos@chaoscaot.de>
|
||||
Date: Wed, 25 Dec 2024 12:18:00 +0100
|
||||
Subject: [PATCH] SW Remove Worldlock and Symlink Check
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/level/storage/LevelStorageSource.java b/net/minecraft/world/level/storage/LevelStorageSource.java
|
||||
index de43e54698125ce9f319d4889dd49f7029fe95e0..e21d744040bcf58b391f002f2dd1129e532ff1b6 100644
|
||||
--- a/net/minecraft/world/level/storage/LevelStorageSource.java
|
||||
+++ b/net/minecraft/world/level/storage/LevelStorageSource.java
|
||||
@@ -343,7 +343,7 @@ public class LevelStorageSource {
|
||||
|
||||
public LevelStorageSource.LevelStorageAccess validateAndCreateAccess(String saveName, ResourceKey<LevelStem> dimensionType) throws IOException, ContentValidationException { // CraftBukkit
|
||||
Path levelPath = this.getLevelPath(saveName);
|
||||
- List<ForbiddenSymlinkInfo> list = Boolean.getBoolean("paper.disableWorldSymlinkValidation") ? List.of() : this.worldDirValidator.validateDirectory(levelPath, true); // Paper - add skipping of symlinks scan
|
||||
+ List<ForbiddenSymlinkInfo> list = List.of(); // Paper - add skipping of symlinks scan
|
||||
if (!list.isEmpty()) {
|
||||
throw new ContentValidationException(levelPath, list);
|
||||
} else {
|
||||
@@ -420,7 +420,6 @@ public class LevelStorageSource {
|
||||
}
|
||||
|
||||
public class LevelStorageAccess implements AutoCloseable {
|
||||
- final DirectoryLock lock;
|
||||
public final LevelStorageSource.LevelDirectory levelDirectory;
|
||||
private final String levelId;
|
||||
private final Map<LevelResource, Path> resources = Maps.newHashMap();
|
||||
@@ -432,7 +431,6 @@ public class LevelStorageSource {
|
||||
// CraftBukkit end
|
||||
this.levelId = levelId;
|
||||
this.levelDirectory = new LevelStorageSource.LevelDirectory(levelDir);
|
||||
- this.lock = DirectoryLock.create(levelDir);
|
||||
}
|
||||
|
||||
public long estimateDiskSpace() {
|
||||
@@ -476,9 +474,7 @@ public class LevelStorageSource {
|
||||
}
|
||||
|
||||
private void checkLock() {
|
||||
- if (!this.lock.isValid()) {
|
||||
- throw new IllegalStateException("Lock is no longer valid");
|
||||
- }
|
||||
+ //nope
|
||||
}
|
||||
|
||||
public PlayerDataStorage createPlayerStorage() {
|
||||
@@ -532,7 +528,7 @@ public class LevelStorageSource {
|
||||
}
|
||||
|
||||
public Optional<Path> getIconFile() {
|
||||
- return !this.lock.isValid() ? Optional.empty() : Optional.of(this.levelDirectory.iconFile());
|
||||
+ return Optional.of(this.levelDirectory.iconFile());
|
||||
}
|
||||
|
||||
public void deleteLevel() throws IOException {
|
||||
@@ -561,7 +557,6 @@ public class LevelStorageSource {
|
||||
throw exception;
|
||||
} else {
|
||||
if (dir.equals(LevelStorageAccess.this.levelDirectory.path())) {
|
||||
- LevelStorageAccess.this.lock.close();
|
||||
Files.deleteIfExists(path);
|
||||
}
|
||||
|
||||
@@ -645,7 +640,7 @@ public class LevelStorageSource {
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
- this.lock.close();
|
||||
+ //ignored
|
||||
}
|
||||
|
||||
public boolean restoreLevelDataFromOld() {
|
||||
@@ -0,0 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Chaoscaot <chaos@chaoscaot.de>
|
||||
Date: Wed, 25 Dec 2024 12:36:40 +0100
|
||||
Subject: [PATCH] SW Remove Debug Message
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/players/StoredUserList.java b/net/minecraft/server/players/StoredUserList.java
|
||||
index d445e8f126f077d8419c52fa5436ea963a1a42a4..dfb0d766b5244646d18ddec5d8b91eddb69d9e97 100644
|
||||
--- a/net/minecraft/server/players/StoredUserList.java
|
||||
+++ b/net/minecraft/server/players/StoredUserList.java
|
||||
@@ -12,6 +12,7 @@ import com.mojang.logging.LogUtils;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
+import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collection;
|
||||
@@ -103,6 +104,8 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
|
||||
|
||||
try (BufferedWriter writer = Files.newWriter(this.file, StandardCharsets.UTF_8)) {
|
||||
GSON.toJson(jsonArray, GSON.newJsonWriter(writer));
|
||||
+ } catch (FileNotFoundException e) {
|
||||
+ return;
|
||||
}
|
||||
}
|
||||
|
||||
152
paper-server/patches/features/0034-SW-Disable-Commands.patch
Normal file
152
paper-server/patches/features/0034-SW-Disable-Commands.patch
Normal file
@@ -0,0 +1,152 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Chaoscaot <chaos@chaoscaot.de>
|
||||
Date: Sun, 30 Mar 2025 12:00:50 +0200
|
||||
Subject: [PATCH] SW Disable Commands
|
||||
|
||||
|
||||
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
|
||||
index f8969a68cd352ce4fe5109205e78f5e19ab6e020..efae844a9419b1e06bcd6ed0d2a4d70cb622330f 100644
|
||||
--- a/net/minecraft/commands/Commands.java
|
||||
+++ b/net/minecraft/commands/Commands.java
|
||||
@@ -155,66 +155,66 @@ public class Commands {
|
||||
}
|
||||
public Commands(Commands.CommandSelection selection, CommandBuildContext context, final boolean modern) {
|
||||
// Paper end - Brigadier API - modern minecraft overloads that do not use redirects but are copies instead
|
||||
- AdvancementCommands.register(this.dispatcher);
|
||||
- AttributeCommand.register(this.dispatcher, context);
|
||||
- ExecuteCommand.register(this.dispatcher, context);
|
||||
- BossBarCommands.register(this.dispatcher, context);
|
||||
+ //AdvancementCommands.register(this.dispatcher);
|
||||
+ //AttributeCommand.register(this.dispatcher, context);
|
||||
+ //ExecuteCommand.register(this.dispatcher, context);
|
||||
+ //BossBarCommands.register(this.dispatcher, context);
|
||||
ClearInventoryCommands.register(this.dispatcher, context);
|
||||
- CloneCommands.register(this.dispatcher, context);
|
||||
- DamageCommand.register(this.dispatcher, context);
|
||||
- DataCommands.register(this.dispatcher);
|
||||
- DataPackCommand.register(this.dispatcher);
|
||||
- DebugCommand.register(this.dispatcher);
|
||||
- DefaultGameModeCommands.register(this.dispatcher);
|
||||
- DifficultyCommand.register(this.dispatcher);
|
||||
+ //CloneCommands.register(this.dispatcher, context);
|
||||
+ //DamageCommand.register(this.dispatcher, context);
|
||||
+ //DataCommands.register(this.dispatcher);
|
||||
+ //DataPackCommand.register(this.dispatcher);
|
||||
+ //DebugCommand.register(this.dispatcher);
|
||||
+ //DefaultGameModeCommands.register(this.dispatcher);
|
||||
+ //DifficultyCommand.register(this.dispatcher);
|
||||
EffectCommands.register(this.dispatcher, context);
|
||||
- EmoteCommands.register(this.dispatcher);
|
||||
+ //EmoteCommands.register(this.dispatcher);
|
||||
EnchantCommand.register(this.dispatcher, context);
|
||||
- ExperienceCommand.register(this.dispatcher);
|
||||
- FillCommand.register(this.dispatcher, context);
|
||||
+ //ExperienceCommand.register(this.dispatcher);
|
||||
+ //FillCommand.register(this.dispatcher, context);
|
||||
FillBiomeCommand.register(this.dispatcher, context);
|
||||
- ForceLoadCommand.register(this.dispatcher);
|
||||
- FunctionCommand.register(this.dispatcher);
|
||||
+ //ForceLoadCommand.register(this.dispatcher);
|
||||
+ //FunctionCommand.register(this.dispatcher);
|
||||
GameModeCommand.register(this.dispatcher);
|
||||
GameRuleCommand.register(this.dispatcher, context);
|
||||
GiveCommand.register(this.dispatcher, context);
|
||||
- HelpCommand.register(this.dispatcher);
|
||||
- ItemCommands.register(this.dispatcher, context);
|
||||
+ //HelpCommand.register(this.dispatcher);
|
||||
+ //ItemCommands.register(this.dispatcher, context);
|
||||
KickCommand.register(this.dispatcher);
|
||||
KillCommand.register(this.dispatcher);
|
||||
- ListPlayersCommand.register(this.dispatcher);
|
||||
- LocateCommand.register(this.dispatcher, context);
|
||||
- LootCommand.register(this.dispatcher, context);
|
||||
- MsgCommand.register(this.dispatcher);
|
||||
- ParticleCommand.register(this.dispatcher, context);
|
||||
- PlaceCommand.register(this.dispatcher);
|
||||
- PlaySoundCommand.register(this.dispatcher);
|
||||
- RandomCommand.register(this.dispatcher);
|
||||
- ReloadCommand.register(this.dispatcher);
|
||||
- RecipeCommand.register(this.dispatcher);
|
||||
- ReturnCommand.register(this.dispatcher);
|
||||
- RideCommand.register(this.dispatcher);
|
||||
+ //ListPlayersCommand.register(this.dispatcher);
|
||||
+ //LocateCommand.register(this.dispatcher, context);
|
||||
+ //LootCommand.register(this.dispatcher, context);
|
||||
+ //MsgCommand.register(this.dispatcher);
|
||||
+ //ParticleCommand.register(this.dispatcher, context);
|
||||
+ //PlaceCommand.register(this.dispatcher);
|
||||
+ //PlaySoundCommand.register(this.dispatcher);
|
||||
+ //RandomCommand.register(this.dispatcher);
|
||||
+ //ReloadCommand.register(this.dispatcher);
|
||||
+ //RecipeCommand.register(this.dispatcher);
|
||||
+ //ReturnCommand.register(this.dispatcher);
|
||||
+ //RideCommand.register(this.dispatcher);
|
||||
RotateCommand.register(this.dispatcher);
|
||||
- SayCommand.register(this.dispatcher);
|
||||
- ScheduleCommand.register(this.dispatcher);
|
||||
- ScoreboardCommand.register(this.dispatcher, context);
|
||||
- SeedCommand.register(this.dispatcher, selection != Commands.CommandSelection.INTEGRATED);
|
||||
- SetBlockCommand.register(this.dispatcher, context);
|
||||
- SetSpawnCommand.register(this.dispatcher);
|
||||
+ //SayCommand.register(this.dispatcher);
|
||||
+ //ScheduleCommand.register(this.dispatcher);
|
||||
+ //ScoreboardCommand.register(this.dispatcher, context);
|
||||
+ //SeedCommand.register(this.dispatcher, selection != Commands.CommandSelection.INTEGRATED);
|
||||
+ //SetBlockCommand.register(this.dispatcher, context);
|
||||
+ //SetSpawnCommand.register(this.dispatcher);
|
||||
SetWorldSpawnCommand.register(this.dispatcher);
|
||||
SpectateCommand.register(this.dispatcher);
|
||||
- SpreadPlayersCommand.register(this.dispatcher);
|
||||
- StopSoundCommand.register(this.dispatcher);
|
||||
+ //SpreadPlayersCommand.register(this.dispatcher);
|
||||
+ //StopSoundCommand.register(this.dispatcher);
|
||||
SummonCommand.register(this.dispatcher, context);
|
||||
- TagCommand.register(this.dispatcher);
|
||||
- TeamCommand.register(this.dispatcher, context);
|
||||
- TeamMsgCommand.register(this.dispatcher);
|
||||
+ //TagCommand.register(this.dispatcher);
|
||||
+ //TeamCommand.register(this.dispatcher, context);
|
||||
+ //TeamMsgCommand.register(this.dispatcher);
|
||||
TeleportCommand.register(this.dispatcher);
|
||||
- TellRawCommand.register(this.dispatcher, context);
|
||||
+ //TellRawCommand.register(this.dispatcher, context);
|
||||
TickCommand.register(this.dispatcher);
|
||||
TimeCommand.register(this.dispatcher);
|
||||
- TitleCommand.register(this.dispatcher, context);
|
||||
- TriggerCommand.register(this.dispatcher);
|
||||
+ //TitleCommand.register(this.dispatcher, context);
|
||||
+ //TriggerCommand.register(this.dispatcher);
|
||||
WeatherCommand.register(this.dispatcher);
|
||||
WorldBorderCommand.register(this.dispatcher);
|
||||
if (JvmProfiler.INSTANCE.isAvailable()) {
|
||||
@@ -235,20 +235,20 @@ public class Commands {
|
||||
}
|
||||
|
||||
if (selection.includeDedicated) {
|
||||
- BanIpCommands.register(this.dispatcher);
|
||||
- BanListCommands.register(this.dispatcher);
|
||||
- BanPlayerCommands.register(this.dispatcher);
|
||||
- DeOpCommands.register(this.dispatcher);
|
||||
- OpCommand.register(this.dispatcher);
|
||||
- PardonCommand.register(this.dispatcher);
|
||||
- PardonIpCommand.register(this.dispatcher);
|
||||
- PerfCommand.register(this.dispatcher);
|
||||
+ //BanIpCommands.register(this.dispatcher);
|
||||
+ //BanListCommands.register(this.dispatcher);
|
||||
+ //BanPlayerCommands.register(this.dispatcher);
|
||||
+ //DeOpCommands.register(this.dispatcher);
|
||||
+ //OpCommand.register(this.dispatcher);
|
||||
+ //PardonCommand.register(this.dispatcher);
|
||||
+ //PardonIpCommand.register(this.dispatcher);
|
||||
+ //PerfCommand.register(this.dispatcher);
|
||||
SaveAllCommand.register(this.dispatcher);
|
||||
SaveOffCommand.register(this.dispatcher);
|
||||
SaveOnCommand.register(this.dispatcher);
|
||||
- SetPlayerIdleTimeoutCommand.register(this.dispatcher);
|
||||
+ //SetPlayerIdleTimeoutCommand.register(this.dispatcher);
|
||||
StopCommand.register(this.dispatcher);
|
||||
- TransferCommand.register(this.dispatcher);
|
||||
+ //TransferCommand.register(this.dispatcher);
|
||||
WhitelistCommand.register(this.dispatcher);
|
||||
}
|
||||
|
||||
@@ -1,21 +1,26 @@
|
||||
--- a/net/minecraft/network/protocol/common/custom/DiscardedPayload.java
|
||||
+++ b/net/minecraft/network/protocol/common/custom/DiscardedPayload.java
|
||||
@@ -4,13 +_,14 @@
|
||||
@@ -4,13 +_,19 @@
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
-public record DiscardedPayload(ResourceLocation id) implements CustomPacketPayload {
|
||||
+public record DiscardedPayload(ResourceLocation id, io.netty.buffer.ByteBuf data) implements CustomPacketPayload { // CraftBukkit - store data
|
||||
+public record DiscardedPayload(ResourceLocation id, byte[] data) implements CustomPacketPayload { // Paper - store data
|
||||
public static <T extends FriendlyByteBuf> StreamCodec<T, DiscardedPayload> codec(ResourceLocation id, int maxSize) {
|
||||
- return CustomPacketPayload.codec((value, output) -> {}, buffer -> {
|
||||
+ return CustomPacketPayload.codec((value, output) -> {
|
||||
+ output.writeBytes(value.data); // CraftBukkit - serialize
|
||||
+ // Paper start
|
||||
+ // Always write data
|
||||
+ output.writeBytes(value.data);
|
||||
+ }, buffer -> {
|
||||
int i = buffer.readableBytes();
|
||||
if (i >= 0 && i <= maxSize) {
|
||||
- buffer.skipBytes(i);
|
||||
- return new DiscardedPayload(id);
|
||||
+ return new DiscardedPayload(id, buffer.readBytes(i)); // CraftBukkit
|
||||
+ final byte[] data = new byte[i];
|
||||
+ buffer.readBytes(data);
|
||||
+ return new DiscardedPayload(id, data);
|
||||
+ // Paper end
|
||||
} else {
|
||||
throw new IllegalArgumentException("Payload may not be larger than " + maxSize + " bytes");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/server/commands/RideCommand.java
|
||||
+++ b/net/minecraft/server/commands/RideCommand.java
|
||||
@@ -58,7 +_,7 @@
|
||||
Entity vehicle1 = target.getVehicle();
|
||||
if (vehicle1 != null) {
|
||||
throw ERROR_ALREADY_RIDING.create(target.getDisplayName(), vehicle1.getDisplayName());
|
||||
- } else if (vehicle.getType() == EntityType.PLAYER) {
|
||||
+ } else if (vehicle.getType() == EntityType.PLAYER && !io.papermc.paper.configuration.GlobalConfiguration.get().commands.rideCommandAllowPlayerAsVehicle) { // Paper - allow player as vehicle
|
||||
throw ERROR_MOUNTING_PLAYER.create();
|
||||
} else if (target.getSelfAndPassengers().anyMatch(passenger -> passenger == vehicle)) {
|
||||
throw ERROR_MOUNTING_LOOP.create();
|
||||
@@ -95,7 +95,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,30 +_,119 @@
|
||||
@@ -88,30 +_,123 @@
|
||||
public void handlePong(ServerboundPongPacket packet) {
|
||||
}
|
||||
|
||||
@@ -105,64 +105,68 @@
|
||||
@Override
|
||||
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
|
||||
- }
|
||||
+ // CraftBukkit start
|
||||
+ // Paper start - Brand support
|
||||
+ // Paper start
|
||||
+ if (packet.payload() instanceof net.minecraft.network.protocol.common.custom.BrandPayload(String brand)) {
|
||||
+ this.player.clientBrandName = brand;
|
||||
+ }
|
||||
+ // Paper end - Brand support
|
||||
+
|
||||
+ if (!(packet.payload() instanceof final net.minecraft.network.protocol.common.custom.DiscardedPayload discardedPayload)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||
+ net.minecraft.resources.ResourceLocation identifier = packet.payload().type().id();
|
||||
+ io.netty.buffer.ByteBuf payload = discardedPayload.data();
|
||||
+
|
||||
+ if (identifier.equals(ServerCommonPacketListenerImpl.CUSTOM_REGISTER)) {
|
||||
+ try {
|
||||
+ String channels = payload.toString(com.google.common.base.Charsets.UTF_8);
|
||||
+ for (String channel : channels.split("\0")) {
|
||||
+ this.getCraftPlayer().addChannel(channel);
|
||||
+ }
|
||||
+ } catch (Exception ex) {
|
||||
+ ServerGamePacketListenerImpl.LOGGER.error("Couldn't register custom payload", ex);
|
||||
+ this.disconnect(Component.literal("Invalid payload REGISTER!"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
|
||||
+ }
|
||||
+ } else if (identifier.equals(ServerCommonPacketListenerImpl.CUSTOM_UNREGISTER)) {
|
||||
+ try {
|
||||
+ String channels = payload.toString(com.google.common.base.Charsets.UTF_8);
|
||||
+ for (String channel : channels.split("\0")) {
|
||||
+ this.getCraftPlayer().removeChannel(channel);
|
||||
+ }
|
||||
+ } catch (Exception ex) {
|
||||
+ ServerGamePacketListenerImpl.LOGGER.error("Couldn't unregister custom payload", ex);
|
||||
+ this.disconnect(Component.literal("Invalid payload UNREGISTER!"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
|
||||
+ }
|
||||
+ } else {
|
||||
+ try {
|
||||
+ byte[] data = new byte[payload.readableBytes()];
|
||||
+ payload.readBytes(data);
|
||||
+ // Paper start - Brand support; Retain this incase upstream decides to 'break' the new mechanism in favour of backwards compat...
|
||||
+ if (identifier.equals(MINECRAFT_BRAND)) {
|
||||
+ try {
|
||||
+ this.player.clientBrandName = new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.copiedBuffer(data)).readUtf(256);
|
||||
+ } catch (StringIndexOutOfBoundsException ex) {
|
||||
+ this.player.clientBrandName = "illegal";
|
||||
+ PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||
+
|
||||
+ final net.minecraft.resources.ResourceLocation identifier = packet.payload().type().id();
|
||||
+ final byte[] data = discardedPayload.data();
|
||||
+ try {
|
||||
+ final boolean registerChannel = ServerCommonPacketListenerImpl.CUSTOM_REGISTER.equals(identifier);
|
||||
+ if (registerChannel || ServerCommonPacketListenerImpl.CUSTOM_UNREGISTER.equals(identifier)) {
|
||||
+ // Strings separated by zeros instead of length prefixes
|
||||
+ int startIndex = 0;
|
||||
+ for (int i = 0; i < data.length; i++) {
|
||||
+ final byte b = data[i];
|
||||
+ if (b != 0) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ readChannelIdentifier(data, startIndex, i, registerChannel);
|
||||
+ startIndex = i + 1;
|
||||
+ }
|
||||
+ // Paper end - Brand support
|
||||
+ this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), identifier.toString(), data);
|
||||
+ } catch (Exception ex) {
|
||||
+ ServerGamePacketListenerImpl.LOGGER.error("Couldn't dispatch custom payload", ex);
|
||||
+ this.disconnect(Component.literal("Invalid custom payload!"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
|
||||
+
|
||||
+ // Read the last one
|
||||
+ readChannelIdentifier(data, startIndex, data.length, registerChannel);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (identifier.equals(MINECRAFT_BRAND)) {
|
||||
+ this.player.clientBrandName = new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.wrappedBuffer(data)).readUtf(256);
|
||||
+ }
|
||||
+
|
||||
+ this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), identifier.toString(), data);
|
||||
+ } catch (final Exception e) {
|
||||
+ ServerGamePacketListenerImpl.LOGGER.error("Couldn't handle custom payload on channel {}", identifier, e);
|
||||
+ this.disconnect(Component.literal("Invalid custom payload payload!"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void readChannelIdentifier(final byte[] data, final int from, final int to, final boolean register) {
|
||||
+ final int length = to - from;
|
||||
+ if (length == 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ final String channel = new String(data, from, length, java.nio.charset.StandardCharsets.US_ASCII);
|
||||
+ if (register) {
|
||||
+ this.getCraftPlayer().addChannel(channel);
|
||||
+ } else {
|
||||
+ this.getCraftPlayer().removeChannel(channel);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public final boolean isDisconnected() {
|
||||
+ return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper - Fix duplication bugs
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // Paper end
|
||||
|
||||
@Override
|
||||
public void handleResourcePackResponse(ServerboundResourcePackPacket packet) {
|
||||
|
||||
@@ -2104,7 +2104,7 @@
|
||||
+ ItemStack cursor = this.player.containerMenu.getCarried();
|
||||
+ if (clickedItem.isEmpty()) {
|
||||
+ if (!cursor.isEmpty()) {
|
||||
+ if (cursor.getItem() instanceof net.minecraft.world.item.BundleItem && packet.getButtonNum() != 0) {
|
||||
+ if (cursor.getItem() instanceof net.minecraft.world.item.BundleItem && cursor.has(DataComponents.BUNDLE_CONTENTS) && packet.getButtonNum() != 0) {
|
||||
+ action = cursor.get(DataComponents.BUNDLE_CONTENTS).isEmpty() ? InventoryAction.NOTHING : InventoryAction.PLACE_FROM_BUNDLE;
|
||||
+ } else {
|
||||
+ action = packet.getButtonNum() == 0 ? InventoryAction.PLACE_ALL : InventoryAction.PLACE_ONE;
|
||||
@@ -2112,7 +2112,7 @@
|
||||
+ }
|
||||
+ } else if (slot.mayPickup(this.player)) {
|
||||
+ if (cursor.isEmpty()) {
|
||||
+ if (slot.getItem().getItem() instanceof net.minecraft.world.item.BundleItem && packet.getButtonNum() != 0) {
|
||||
+ if (slot.getItem().getItem() instanceof net.minecraft.world.item.BundleItem && slot.getItem().has(DataComponents.BUNDLE_CONTENTS) && packet.getButtonNum() != 0) {
|
||||
+ action = slot.getItem().get(DataComponents.BUNDLE_CONTENTS).isEmpty() ? InventoryAction.NOTHING : InventoryAction.PICKUP_FROM_BUNDLE;
|
||||
+ } else {
|
||||
+ action = packet.getButtonNum() == 0 ? InventoryAction.PICKUP_ALL : InventoryAction.PICKUP_HALF;
|
||||
@@ -2132,7 +2132,7 @@
|
||||
+ action = InventoryAction.PLACE_SOME;
|
||||
+ }
|
||||
+ } else if (cursor.getCount() <= slot.getMaxStackSize()) {
|
||||
+ if (cursor.getItem() instanceof net.minecraft.world.item.BundleItem && packet.getButtonNum() == 0) {
|
||||
+ if (cursor.getItem() instanceof net.minecraft.world.item.BundleItem && cursor.has(DataComponents.BUNDLE_CONTENTS) && packet.getButtonNum() == 0) {
|
||||
+ int toPickup = cursor.get(DataComponents.BUNDLE_CONTENTS).getMaxAmountToAdd(slot.getItem());
|
||||
+ if (toPickup >= slot.getItem().getCount()) {
|
||||
+ action = InventoryAction.PICKUP_ALL_INTO_BUNDLE;
|
||||
@@ -2141,7 +2141,7 @@
|
||||
+ } else {
|
||||
+ action = InventoryAction.PICKUP_SOME_INTO_BUNDLE;
|
||||
+ }
|
||||
+ } else if (slot.getItem().getItem() instanceof net.minecraft.world.item.BundleItem && packet.getButtonNum() == 0) {
|
||||
+ } else if (slot.getItem().getItem() instanceof net.minecraft.world.item.BundleItem && slot.getItem().has(DataComponents.BUNDLE_CONTENTS) && packet.getButtonNum() == 0) {
|
||||
+ int toPickup = slot.getItem().get(DataComponents.BUNDLE_CONTENTS).getMaxAmountToAdd(cursor);
|
||||
+ if (toPickup >= cursor.getCount()) {
|
||||
+ action = InventoryAction.PLACE_ALL_INTO_BUNDLE;
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
|
||||
if (this.life > this.lifetime && this.level() instanceof ServerLevel serverLevel) {
|
||||
- this.explode(serverLevel);
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
|
||||
+ // Paper start - Call FireworkExplodeEvent
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this)) {
|
||||
+ this.explode(serverLevel);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // Paper end - Call FireworkExplodeEvent
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,11 +43,11 @@
|
||||
super.onHitEntity(result);
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
- this.explode(serverLevel);
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
|
||||
+ // Paper start - Call FireworkExplodeEvent
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this)) {
|
||||
+ this.explode(serverLevel);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // Paper end - Call FireworkExplodeEvent
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,11 +56,11 @@
|
||||
this.level().getBlockState(blockPos).entityInside(this.level(), blockPos, this);
|
||||
if (this.level() instanceof ServerLevel serverLevel && this.hasExplosion()) {
|
||||
- this.explode(serverLevel);
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
|
||||
+ // Paper start - Call FireworkExplodeEvent
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this)) {
|
||||
+ this.explode(serverLevel);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // Paper end - Call FireworkExplodeEvent
|
||||
}
|
||||
|
||||
super.onHitBlock(result);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/inventory/HorseInventoryMenu.java
|
||||
+++ b/net/minecraft/world/inventory/HorseInventoryMenu.java
|
||||
@@ -19,9 +_,23 @@
|
||||
private final AbstractHorse horse;
|
||||
public final AbstractHorse horse;
|
||||
public static final int SLOT_BODY_ARMOR = 1;
|
||||
private static final int SLOT_HORSE_INVENTORY_START = 2;
|
||||
+ // CraftBukkit start
|
||||
|
||||
@@ -92,7 +92,7 @@ public enum VersionHistoryManager {
|
||||
)) {
|
||||
gson.toJson(currentData, writer);
|
||||
} catch (final IOException e) {
|
||||
logger.log(Level.SEVERE, "Failed to write to version history file", e);
|
||||
// logger.log(Level.SEVERE, "Failed to write to version history file", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ public abstract class Configurations<G, W> {
|
||||
loader.save(node);
|
||||
} catch (ConfigurateException ex) {
|
||||
if (ex.getCause() instanceof AccessDeniedException) {
|
||||
LOGGER.warn("Could not save {}: Paper could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at https://docs.papermc.io/paper/configuration for more details.", filename, ex);
|
||||
//LOGGER.warn("Could not save {}: Paper could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at https://docs.papermc.io/paper/configuration for more details.", filename, ex);
|
||||
} else throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.ServerboundPlaceRecipePacket;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Items;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
@@ -202,6 +201,8 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public class Commands extends ConfigurationPart {
|
||||
public boolean suggestPlayerNamesWhenNullTabCompletions = true;
|
||||
public boolean timeCommandAffectsAllWorlds = false;
|
||||
@Comment("Allow mounting entities to a player in the Vanilla '/ride' command.")
|
||||
public boolean rideCommandAllowPlayerAsVehicle = false;
|
||||
}
|
||||
|
||||
public Logging logging;
|
||||
|
||||
@@ -467,8 +467,6 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
|
||||
// Symlinks are not correctly checked in createDirectories
|
||||
static void createDirectoriesSymlinkAware(Path path) throws IOException {
|
||||
if (!Files.isDirectory(path)) {
|
||||
Files.createDirectories(path);
|
||||
}
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,7 +519,7 @@ public final class CraftServer implements Server {
|
||||
try {
|
||||
this.configuration.save(this.getConfigFile());
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, "Could not save " + this.getConfigFile(), ex);
|
||||
//Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, "Could not save " + this.getConfigFile(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -527,7 +527,7 @@ public final class CraftServer implements Server {
|
||||
try {
|
||||
this.commandsConfiguration.save(this.getCommandsConfigFile());
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, "Could not save " + this.getCommandsConfigFile(), ex);
|
||||
//Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, "Could not save " + this.getCommandsConfigFile(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -617,7 +617,7 @@ public final class CraftServer implements Server {
|
||||
DefaultPermissions.registerCorePermissions();
|
||||
CraftDefaultPermissions.registerCorePermissions();
|
||||
if (!io.papermc.paper.configuration.GlobalConfiguration.get().misc.loadPermissionsYmlBeforePlugins) this.loadCustomPermissions(); // Paper
|
||||
this.helpMap.initializeCommands();
|
||||
//this.helpMap.initializeCommands();
|
||||
this.syncCommands();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1264,13 +1264,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
// Paper end
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
public void save(boolean flush) {
|
||||
org.spigotmc.AsyncCatcher.catchOp("world save"); // Spigot
|
||||
this.server.checkSaveState();
|
||||
boolean oldSave = this.world.noSave;
|
||||
|
||||
this.world.noSave = false;
|
||||
this.world.save(null, false, false);
|
||||
this.world.save(null, flush, false);
|
||||
|
||||
this.world.noSave = oldSave;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.util.function.Consumer;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.protocol.game.ClientboundHorseScreenOpenPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket;
|
||||
import net.minecraft.network.protocol.game.ServerboundContainerClosePacket;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@@ -24,6 +25,8 @@ import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.projectile.FireworkRocketEntity;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.inventory.HorseInventoryMenu;
|
||||
import net.minecraft.world.inventory.InventoryMenu;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.inventory.MerchantMenu;
|
||||
import net.minecraft.world.item.ItemCooldowns;
|
||||
@@ -455,6 +458,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
AbstractContainerMenu container;
|
||||
if (inventory instanceof CraftInventoryView) {
|
||||
container = ((CraftInventoryView) inventory).getHandle();
|
||||
Preconditions.checkArgument(!(container instanceof InventoryMenu), "Can not open player's InventoryView");
|
||||
} else {
|
||||
container = new CraftContainer(inventory, this.getHandle(), player.nextContainerCounter());
|
||||
}
|
||||
@@ -481,7 +485,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
if (adventure$title == null) adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(inventory.getTitle()); // Paper
|
||||
if (result.getFirst() != null) adventure$title = result.getFirst(); // Paper - Add titleOverride to InventoryOpenEvent
|
||||
//player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, CraftChatMessage.fromString(title)[0])); // Paper - comment
|
||||
if (!player.isImmobile()) player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper - Prevent opening inventories when frozen
|
||||
if (!player.isImmobile()) {
|
||||
if (container instanceof HorseInventoryMenu horse) {
|
||||
player.connection.send(new ClientboundHorseScreenOpenPacket(horse.containerId, horse.horse.getInventoryColumns(), horse.horse.getId()));
|
||||
} else {
|
||||
player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title)));
|
||||
}
|
||||
}
|
||||
player.containerMenu = container;
|
||||
player.initMenu(container);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.io.BaseEncoding;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.papermc.paper.FeatureHooks;
|
||||
import io.papermc.paper.configuration.GlobalConfiguration;
|
||||
import io.papermc.paper.entity.LookAnchor;
|
||||
@@ -103,7 +102,6 @@ import net.minecraft.server.players.UserWhiteListEntry;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeMap;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.food.FoodData;
|
||||
@@ -174,7 +172,6 @@ import org.bukkit.craftbukkit.map.CraftMapView;
|
||||
import org.bukkit.craftbukkit.map.RenderData;
|
||||
import org.bukkit.craftbukkit.potion.CraftPotionEffectType;
|
||||
import org.bukkit.craftbukkit.potion.CraftPotionUtil;
|
||||
import org.bukkit.craftbukkit.profile.CraftPlayerProfile;
|
||||
import org.bukkit.craftbukkit.scoreboard.CraftScoreboard;
|
||||
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
@@ -189,7 +186,6 @@ import org.bukkit.event.player.PlayerExpCooldownChangeEvent;
|
||||
import org.bukkit.event.player.PlayerHideEntityEvent;
|
||||
import org.bukkit.event.player.PlayerRegisterChannelEvent;
|
||||
import org.bukkit.event.player.PlayerShowEntityEvent;
|
||||
import org.bukkit.event.player.PlayerSpawnChangeEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerUnregisterChannelEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
@@ -202,7 +198,6 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.messaging.StandardMessenger;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.profile.PlayerProfile;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -2463,7 +2458,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
private void sendCustomPayload(ResourceLocation id, byte[] message) {
|
||||
ClientboundCustomPayloadPacket packet = new ClientboundCustomPayloadPacket(new DiscardedPayload(id, Unpooled.wrappedBuffer(message)));
|
||||
ClientboundCustomPayloadPacket packet = new ClientboundCustomPayloadPacket(new DiscardedPayload(id, message));
|
||||
this.getHandle().connection.send(packet);
|
||||
}
|
||||
|
||||
|
||||
@@ -1762,10 +1762,13 @@ public class CraftEventFactory {
|
||||
return (Cancellable) event;
|
||||
}
|
||||
|
||||
public static FireworkExplodeEvent callFireworkExplodeEvent(FireworkRocketEntity firework) {
|
||||
public static boolean callFireworkExplodeEvent(FireworkRocketEntity firework) {
|
||||
FireworkExplodeEvent event = new FireworkExplodeEvent((Firework) firework.getBukkitEntity());
|
||||
firework.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
return event;
|
||||
if (!event.callEvent()) {
|
||||
firework.discard(null);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static PrepareAnvilEvent callPrepareAnvilEvent(AnvilView view, ItemStack item) {
|
||||
|
||||
@@ -8,12 +8,13 @@ import net.minecraft.world.level.block.EntityBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import org.bukkit.HeightMap;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.craftbukkit.CraftHeightMap;
|
||||
import org.bukkit.craftbukkit.block.CraftBiome;
|
||||
import org.bukkit.craftbukkit.block.CraftBlockType;
|
||||
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
@@ -180,4 +181,12 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData {
|
||||
access.removeBlockEntity(blockPosition);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight(final HeightMap heightMap, final int x, final int z) {
|
||||
Preconditions.checkArgument(heightMap != null, "HeightMap cannot be null");
|
||||
Preconditions.checkArgument(x >= 0 && x <= 15 && z >= 0 && z <= 15, "Cannot get height outside of a chunks bounds, must be between 0 and 15, got x: %s, z: %s", x, z);
|
||||
|
||||
return getHandle().getHeight(CraftHeightMap.toNMS(heightMap), x, z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.core.Registry;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
import org.bukkit.HeightMap;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
@@ -200,4 +201,9 @@ public final class OldCraftChunkData implements ChunkGenerator.ChunkData {
|
||||
Set<BlockPos> getLights() {
|
||||
return this.lights;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight(HeightMap heightMap, final int x, final int z) {
|
||||
throw new UnsupportedOperationException("Unsupported, in older chunk generator api");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,6 +208,11 @@ public abstract class CraftAbstractInventoryView implements InventoryView {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
getPlayer().openInventory(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
this.getPlayer().closeInventory();
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.advancements.critereon.ItemPredicate;
|
||||
import net.minecraft.advancements.critereon.MinMaxBounds;
|
||||
@@ -15,6 +16,7 @@ import net.minecraft.core.HolderSet;
|
||||
import net.minecraft.core.component.DataComponentMap;
|
||||
import net.minecraft.core.component.DataComponentPatch;
|
||||
import net.minecraft.core.component.DataComponentPredicate;
|
||||
import net.minecraft.core.component.DataComponentType;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.core.component.PatchedDataComponentMap;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
@@ -54,7 +56,7 @@ public final class CraftItemStack extends ItemStack {
|
||||
if (bukkit instanceof final CraftItemStack craftItemStack) {
|
||||
return craftItemStack;
|
||||
} else {
|
||||
return (CraftItemStack) API_ITEM_STACK_CRAFT_DELEGATE_FIELD.get(bukkit);
|
||||
return (CraftItemStack) API_ITEM_STACK_CRAFT_DELEGATE_FIELD.get(bukkit);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,12 +73,12 @@ public final class CraftItemStack extends ItemStack {
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (!(obj instanceof final org.bukkit.inventory.ItemStack bukkit)) return false;
|
||||
if (!(obj instanceof final ItemStack bukkit)) return false;
|
||||
final CraftItemStack craftStack = getCraftStack(bukkit);
|
||||
if (this.handle == craftStack.handle) return true;
|
||||
else if (this.handle == null || craftStack.handle == null) return false;
|
||||
else if (this.handle.isEmpty() && craftStack.handle.isEmpty()) return true;
|
||||
else return net.minecraft.world.item.ItemStack.matches(this.handle, craftStack.handle);
|
||||
if (this.handle == null || craftStack.handle == null) return false;
|
||||
if (this.handle.isEmpty() && craftStack.handle.isEmpty()) return true;
|
||||
return net.minecraft.world.item.ItemStack.matches(this.handle, craftStack.handle);
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@@ -648,14 +650,32 @@ public final class CraftItemStack extends ItemStack {
|
||||
this.handle.set(nms, nmsValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyDataFrom(final ItemStack source, final Predicate<io.papermc.paper.datacomponent.DataComponentType> filter) {
|
||||
Preconditions.checkArgument(source != null, "source cannot be null");
|
||||
Preconditions.checkArgument(filter != null, "filter cannot be null");
|
||||
if (this.isEmpty() || source.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Predicate<DataComponentType<?>> nmsFilter = nms -> filter.test(io.papermc.paper.datacomponent.PaperDataComponentType.minecraftToBukkit(nms));
|
||||
net.minecraft.world.item.ItemStack sourceNmsStack = getCraftStack(source).handle;
|
||||
this.handle.applyComponents(sourceNmsStack.getPrototype().filter(nmsType -> {
|
||||
return !sourceNmsStack.hasNonDefault(nmsType) && nmsFilter.test(nmsType);
|
||||
}));
|
||||
|
||||
final DataComponentPatch.SplitResult split = sourceNmsStack.getComponentsPatch().split();
|
||||
this.handle.applyComponents(split.added().filter(nmsFilter));
|
||||
split.removed().stream().filter(nmsFilter).forEach(this.handle::remove);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDataOverridden(final io.papermc.paper.datacomponent.DataComponentType type) {
|
||||
if (this.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
final net.minecraft.core.component.DataComponentType<?> nms = io.papermc.paper.datacomponent.PaperDataComponentType.bukkitToMinecraft(type);
|
||||
// maybe a more efficient way is to expose the "patch" map in PatchedDataComponentMap and just check if the type exists as a key
|
||||
return !java.util.Objects.equals(this.handle.get(nms), this.handle.getPrototype().get(nms));
|
||||
return this.handle.hasNonDefault(nms);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -97,7 +97,7 @@ public class SpigotConfig {
|
||||
try {
|
||||
SpigotConfig.config.save(SpigotConfig.CONFIG_FILE);
|
||||
} catch (IOException ex) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Could not save " + SpigotConfig.CONFIG_FILE, ex);
|
||||
//Bukkit.getLogger().log(Level.SEVERE, "Could not save " + SpigotConfig.CONFIG_FILE, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
11
steamwarci.yml
Normal file
11
steamwarci.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
build:
|
||||
- "JAVA_HOME=/usr/lib/jvm/java-21.0.5-openjdk-amd64 ./gradlew applyPatches"
|
||||
- "JAVA_HOME=/usr/lib/jvm/java-21.0.5-openjdk-amd64 ./gradlew createMojmapBundlerJar"
|
||||
- "JAVA_HOME=/usr/lib/jvm/java-21.0.5-openjdk-amd64 ./gradlew --stop"
|
||||
|
||||
artifacts:
|
||||
"/binarys/paper-1.21.4.jar": "paper-server/build/libs/paper-bundler-1.21.4-R0.1-SNAPSHOT-mojmap.jar"
|
||||
"/binarys/spigot-1.21.4-inner.jar": "paper-server/build/libs/paper-server-1.21.4-R0.1-SNAPSHOT.jar"
|
||||
|
||||
release:
|
||||
- "mvn deploy:deploy-file -DgroupId=de.steamwar -DartifactId=spigot -Dversion=1.21.4 -Dpackaging=jar -Dfile=paper-server/build/libs/paper-server-1.21.4-R0.1-SNAPSHOT.jar -Durl=file:///var/www/html/maven/"
|
||||
Reference in New Issue
Block a user