mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 04:32:11 -07:00
readd beacon effect cause
This commit is contained in:
@@ -65,15 +65,15 @@
|
||||
}
|
||||
|
||||
- if (!eula.hasAgreedToEULA()) {
|
||||
+ // Spigot Start
|
||||
+ // Spigot start
|
||||
+ boolean eulaAgreed = Boolean.getBoolean("com.mojang.eula.agree");
|
||||
+ if (eulaAgreed) {
|
||||
+ System.err.println("You have used the Spigot command line EULA agreement flag.");
|
||||
+ System.err.println("By using this setting you are indicating your agreement to Mojang's EULA (https://account.mojang.com/documents/minecraft_eula).");
|
||||
+ System.err.println("If you do not agree to the above EULA please stop your server and remove this flag immediately.");
|
||||
+ LOGGER.error("You have used the Spigot command line EULA agreement flag.");
|
||||
+ LOGGER.error("By using this setting you are indicating your agreement to Mojang's EULA (https://aka.ms/MinecraftEULA).");
|
||||
+ LOGGER.error("If you do not agree to the above EULA please stop your server and remove this flag immediately.");
|
||||
+ }
|
||||
+ // Spigot End
|
||||
+ if (!eula.hasAgreedToEULA() && !eulaAgreed) { // Spigot
|
||||
+ if (!eula.hasAgreedToEULA() && !eulaAgreed) {
|
||||
+ // Spigot end
|
||||
LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
|
||||
return;
|
||||
}
|
||||
@@ -84,11 +84,11 @@
|
||||
+ // Paper start - Detect headless JRE
|
||||
+ String awtException = io.papermc.paper.util.ServerEnvironment.awtDependencyCheck();
|
||||
+ if (awtException != null) {
|
||||
+ Main.LOGGER.error("You are using a headless JRE distribution.");
|
||||
+ Main.LOGGER.error("This distribution is missing certain graphic libraries that the Minecraft server needs to function.");
|
||||
+ Main.LOGGER.error("For instructions on how to install the non-headless JRE, see https://docs.papermc.io/misc/java-install");
|
||||
+ Main.LOGGER.error("");
|
||||
+ Main.LOGGER.error(awtException);
|
||||
+ LOGGER.error("You are using a headless JRE distribution.");
|
||||
+ LOGGER.error("This distribution is missing certain graphic libraries that the Minecraft server needs to function.");
|
||||
+ LOGGER.error("For instructions on how to install the non-headless JRE, see https://docs.papermc.io/misc/java-install");
|
||||
+ LOGGER.error("");
|
||||
+ LOGGER.error(awtException);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end - Detect headless JRE
|
||||
@@ -195,7 +195,7 @@
|
||||
thread1,
|
||||
levelStorageAccess,
|
||||
packRepository,
|
||||
@@ -257,17 +_,29 @@
|
||||
@@ -257,17 +_,34 @@
|
||||
services,
|
||||
LoggerChunkProgressListener::createFromGameruleRadius
|
||||
);
|
||||
@@ -203,7 +203,12 @@
|
||||
dedicatedServer1.setPort(optionSet.valueOf(optionSpec11));
|
||||
- dedicatedServer1.setDemo(optionSet.has(optionSpec2));
|
||||
+ */
|
||||
+ dedicatedServer1.setDemo(optionSet.has("demo")); // Paper
|
||||
+ // Paper start
|
||||
+ if (optionSet.has("serverId")) {
|
||||
+ dedicatedServer1.setId((String) optionSet.valueOf("serverId"));
|
||||
+ }
|
||||
+ dedicatedServer1.setDemo(optionSet.has("demo"));
|
||||
+ // Paper end
|
||||
+ /*
|
||||
dedicatedServer1.setId(optionSet.valueOf(optionSpec12));
|
||||
- boolean flag = !optionSet.has(optionSpec) && !optionSet.valuesOf(optionSpec15).contains("nogui");
|
||||
|
@@ -61,7 +61,7 @@
|
||||
+ public static final int TICK_TIME = 1000000000 / MinecraftServer.TPS;
|
||||
+ private static final int SAMPLE_INTERVAL = 20; // Paper - improve server tick loop
|
||||
+ @Deprecated(forRemoval = true) // Paper
|
||||
+ public final double[] recentTps = new double[ 3 ];
|
||||
+ public final double[] recentTps = new double[3];
|
||||
+ // Spigot end
|
||||
+ public volatile boolean hasFullyShutdown; // Paper - Improved watchdog support
|
||||
+ public volatile boolean abnormalExit; // Paper - Improved watchdog support
|
||||
@@ -623,16 +623,17 @@
|
||||
}
|
||||
|
||||
LOGGER.info("Saving worlds");
|
||||
@@ -646,6 +_,15 @@
|
||||
@@ -646,6 +_,16 @@
|
||||
} catch (IOException var4) {
|
||||
LOGGER.error("Failed to unlock level {}", this.storageSource.getLevelId(), var4);
|
||||
}
|
||||
+ // Spigot start
|
||||
+ io.papermc.paper.util.MCUtil.ASYNC_EXECUTOR.shutdown(); // Paper
|
||||
+ try { io.papermc.paper.util.MCUtil.ASYNC_EXECUTOR.awaitTermination(30, java.util.concurrent.TimeUnit.SECONDS); // Paper
|
||||
+ try {
|
||||
+ io.papermc.paper.util.MCUtil.ASYNC_EXECUTOR.awaitTermination(30, java.util.concurrent.TimeUnit.SECONDS); // Paper
|
||||
+ } catch (java.lang.InterruptedException ignored) {} // Paper
|
||||
+ if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
|
||||
+ MinecraftServer.LOGGER.info("Saving usercache.json");
|
||||
+ LOGGER.info("Saving usercache.json");
|
||||
+ this.getProfileCache().save(false); // Paper - Perf: Async GameProfileCache saving
|
||||
+ }
|
||||
+ // Spigot end
|
||||
@@ -654,15 +655,10 @@
|
||||
this.running = false;
|
||||
if (waitForServer) {
|
||||
try {
|
||||
@@ -671,6 +_,63 @@
|
||||
@@ -671,6 +_,57 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // Spigot Start
|
||||
+ private static double calcTps(double avg, double exp, double tps) {
|
||||
+ return (avg * exp) + (tps * (1 - exp));
|
||||
+ }
|
||||
+
|
||||
+ // Paper start - Further improve server tick loop
|
||||
+ private static final long SEC_IN_NANO = 1000000000;
|
||||
+ private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L;
|
||||
@@ -713,7 +709,6 @@
|
||||
+ }
|
||||
+ private static final java.math.BigDecimal TPS_BASE = new java.math.BigDecimal(1E9).multiply(new java.math.BigDecimal(SAMPLE_INTERVAL));
|
||||
+ // Paper end
|
||||
+ // Spigot End
|
||||
+
|
||||
protected void runServer() {
|
||||
try {
|
||||
@@ -725,7 +720,7 @@
|
||||
+ this.server.spark.enableBeforePlugins(); // Paper - spark
|
||||
+ // Spigot start
|
||||
+ org.spigotmc.WatchdogThread.hasStarted = true; // Paper
|
||||
+ Arrays.fill( this.recentTps, 20 );
|
||||
+ Arrays.fill(this.recentTps, 20);
|
||||
+ // Paper start - further improve server tick loop
|
||||
+ long tickSection = Util.getNanos();
|
||||
+ long currentTime;
|
||||
@@ -1181,7 +1176,7 @@
|
||||
if (this.isEnforceWhitelist()) {
|
||||
PlayerList playerList = commandSource.getServer().getPlayerList();
|
||||
UserWhiteList whiteList = playerList.getWhiteList();
|
||||
+ if (!((net.minecraft.server.dedicated.DedicatedServer) getServer()).getProperties().whiteList.get()) return; // Paper - whitelist not enabled
|
||||
+ if (!((net.minecraft.server.dedicated.DedicatedServer) this).getProperties().whiteList.get()) return; // Paper - whitelist not enabled
|
||||
|
||||
for (ServerPlayer serverPlayer : Lists.newArrayList(playerList.getPlayers())) {
|
||||
- if (!whiteList.isWhiteListed(serverPlayer.getGameProfile())) {
|
||||
|
@@ -4,12 +4,12 @@
|
||||
}
|
||||
|
||||
public boolean stopSprinting() {
|
||||
+ // CraftBukkit start, add sendLog parameter
|
||||
+ // CraftBukkit start - add sendLog parameter
|
||||
+ return this.stopSprinting(true);
|
||||
+ }
|
||||
+
|
||||
+ public boolean stopSprinting(boolean sendLog) {
|
||||
+ // CraftBukkit end
|
||||
+ // CraftBukkit end - add sendLog parameter
|
||||
if (this.remainingSprintTicks > 0L) {
|
||||
- this.finishTickSprint();
|
||||
+ this.finishTickSprint(sendLog); // CraftBukkit - add sendLog parameter
|
||||
|
@@ -1,10 +0,0 @@
|
||||
--- 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();
|
@@ -123,11 +123,11 @@
|
||||
|
||||
+ // Paper start - detect running as root
|
||||
+ if (io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) {
|
||||
+ DedicatedServer.LOGGER.warn("****************************");
|
||||
+ DedicatedServer.LOGGER.warn("YOU ARE RUNNING THIS SERVER AS AN ADMINISTRATIVE OR ROOT USER. THIS IS NOT ADVISED.");
|
||||
+ DedicatedServer.LOGGER.warn("YOU ARE OPENING YOURSELF UP TO POTENTIAL RISKS WHEN DOING THIS.");
|
||||
+ DedicatedServer.LOGGER.warn("FOR MORE INFORMATION, SEE https://madelinemiller.dev/blog/root-minecraft-server/");
|
||||
+ DedicatedServer.LOGGER.warn("****************************");
|
||||
+ LOGGER.warn("****************************");
|
||||
+ LOGGER.warn("YOU ARE RUNNING THIS SERVER AS AN ADMINISTRATIVE OR ROOT USER. THIS IS NOT ADVISED.");
|
||||
+ LOGGER.warn("YOU ARE OPENING YOURSELF UP TO POTENTIAL RISKS WHEN DOING THIS.");
|
||||
+ LOGGER.warn("FOR MORE INFORMATION, SEE https://madelinemiller.dev/blog/root-minecraft-server/");
|
||||
+ LOGGER.warn("****************************");
|
||||
+ }
|
||||
+ // Paper end - detect running as root
|
||||
+
|
||||
@@ -174,12 +174,12 @@
|
||||
+ java.net.SocketAddress bindAddress;
|
||||
+ if (this.getLocalIp().startsWith("unix:")) {
|
||||
+ if (!io.netty.channel.epoll.Epoll.isAvailable()) {
|
||||
+ DedicatedServer.LOGGER.error("**** INVALID CONFIGURATION!");
|
||||
+ DedicatedServer.LOGGER.error("You are trying to use a Unix domain socket but you're not on a supported OS.");
|
||||
+ LOGGER.error("**** INVALID CONFIGURATION!");
|
||||
+ LOGGER.error("You are trying to use a Unix domain socket but you're not on a supported OS.");
|
||||
+ return false;
|
||||
+ } else if (!io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled && !org.spigotmc.SpigotConfig.bungee) {
|
||||
+ DedicatedServer.LOGGER.error("**** INVALID CONFIGURATION!");
|
||||
+ DedicatedServer.LOGGER.error("Unix domain sockets require IPs to be forwarded from a proxy.");
|
||||
+ LOGGER.error("**** INVALID CONFIGURATION!");
|
||||
+ LOGGER.error("Unix domain sockets require IPs to be forwarded from a proxy.");
|
||||
+ return false;
|
||||
+ }
|
||||
+ bindAddress = new io.netty.channel.unix.DomainSocketAddress(this.getLocalIp().substring("unix:".length()));
|
||||
@@ -229,11 +229,11 @@
|
||||
+ // Spigot start
|
||||
+ // Paper start - Add Velocity IP Forwarding Support
|
||||
+ if (usingProxy) {
|
||||
+ DedicatedServer.LOGGER.warn("Whilst this makes it possible to use " + proxyFlavor + ", unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose.");
|
||||
+ DedicatedServer.LOGGER.warn("Please see " + proxyLink + " for further information.");
|
||||
+ LOGGER.warn("Whilst this makes it possible to use {}, unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose.", proxyFlavor);
|
||||
+ LOGGER.warn("Please see {} for further information.", proxyLink);
|
||||
+ // Paper end - Add Velocity IP Forwarding Support
|
||||
+ } else {
|
||||
+ DedicatedServer.LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
|
||||
+ LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
|
||||
+ }
|
||||
+ // Spigot end
|
||||
LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
|
||||
|
@@ -24,7 +24,7 @@
|
||||
}
|
||||
|
||||
public static Properties loadFromFile(Path path) {
|
||||
+ if (!path.toFile().exists()) return new Properties(); // CraftBukkit - SPIGOT-7465, MC-264979: Don't load if file doesn't exist
|
||||
+ if (!Files.exists(path)) return new Properties(); // CraftBukkit - SPIGOT-7465, MC-264979: Don't load if file doesn't exist
|
||||
try {
|
||||
try {
|
||||
Properties var13;
|
||||
|
@@ -148,7 +148,7 @@
|
||||
}
|
||||
|
||||
- protected void setServerViewDistance(int viewDistance) {
|
||||
+ public void setServerViewDistance(int viewDistance) { // Paper - publi
|
||||
+ public void setServerViewDistance(int viewDistance) { // Paper - public
|
||||
int i = Mth.clamp(viewDistance, 2, 32);
|
||||
if (i != this.serverViewDistance) {
|
||||
this.serverViewDistance = i;
|
||||
@@ -274,7 +274,7 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end - ignore and warn about illegal addEntity calls instead of crashing server
|
||||
+ if (entity instanceof ServerPlayer && ((ServerPlayer) entity).supressTrackerForLogin) return; // Paper - Fire PlayerJoinEvent when Player is actually ready; Delayadding to tracker until after list packets
|
||||
+ if (entity instanceof ServerPlayer && ((ServerPlayer) entity).supressTrackerForLogin) return; // Paper - Fire PlayerJoinEvent when Player is actually ready; Delay adding to tracker until after list packets
|
||||
if (!(entity instanceof EnderDragonPart)) {
|
||||
EntityType<?> type = entity.getType();
|
||||
int i = type.clientTrackingRange() * 16;
|
||||
@@ -327,14 +327,14 @@
|
||||
if (player != this.entity) {
|
||||
- Vec3 vec3 = player.position().subtract(this.entity.position());
|
||||
+ // Paper start - remove allocation of Vec3D here
|
||||
+ // Vec3 vec3d = player.position().subtract(this.entity.position());
|
||||
+ double vec3d_dx = player.getX() - this.entity.getX();
|
||||
+ double vec3d_dz = player.getZ() - this.entity.getZ();
|
||||
+ // Vec3 vec3 = player.position().subtract(this.entity.position());
|
||||
+ double vec3_dx = player.getX() - this.entity.getX();
|
||||
+ double vec3_dz = player.getZ() - this.entity.getZ();
|
||||
+ // Paper end - remove allocation of Vec3D here
|
||||
int playerViewDistance = ChunkMap.this.getPlayerViewDistance(player);
|
||||
double d = Math.min(this.getEffectiveRange(), playerViewDistance * 16);
|
||||
- double d1 = vec3.x * vec3.x + vec3.z * vec3.z;
|
||||
+ double d1 = vec3d_dx * vec3d_dx + vec3d_dz * vec3d_dz; // Paper
|
||||
+ double d1 = vec3_dx * vec3_dx + vec3_dz * vec3_dz; // Paper
|
||||
double d2 = d * d;
|
||||
- boolean flag = d1 <= d2
|
||||
- && this.entity.broadcastToPlayer(player)
|
||||
@@ -344,8 +344,8 @@
|
||||
+ if (flag && level.paperConfig().entities.trackingRangeY.enabled) {
|
||||
+ double rangeY = level.paperConfig().entities.trackingRangeY.get(this.entity, -1);
|
||||
+ if (rangeY != -1) {
|
||||
+ double vec3d_dy = player.getY() - this.entity.getY();
|
||||
+ flag = vec3d_dy * vec3d_dy <= rangeY * rangeY;
|
||||
+ double vec3_dy = player.getY() - this.entity.getY();
|
||||
+ flag = vec3_dy * vec3_dy <= rangeY * rangeY;
|
||||
+ }
|
||||
+ }
|
||||
+ flag = flag && this.entity.broadcastToPlayer(player) && ChunkMap.this.isChunkTracked(player, this.entity.chunkPosition().x, this.entity.chunkPosition().z);
|
||||
|
@@ -84,7 +84,7 @@
|
||||
if (packedChunkPos == this.lastChunkPos[i] && chunkStatus == this.lastChunkStatus[i]) {
|
||||
ChunkAccess chunkAccess = this.lastChunk[i];
|
||||
- if (chunkAccess != null || !requireChunk) {
|
||||
+ if (chunkAccess != null) { // CraftBukkit - the chunk can become accessible in the meantime TODO for non-null chunks it might also make sense to check that the chunk's state hasn't changed in the meantime
|
||||
+ if (chunkAccess != null) { // CraftBukkit - the chunk can become accessible in the meantime TODO for non-null chunks it might also make sense to check that the chunk's state hasn't changed in the meantime
|
||||
return chunkAccess;
|
||||
}
|
||||
}
|
||||
@@ -178,7 +178,7 @@
|
||||
this.lastSpawnState = spawnState;
|
||||
profiler.popPush("spawnAndTick");
|
||||
- boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING);
|
||||
+ boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit;
|
||||
+ boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
|
||||
int _int = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
|
||||
List<MobCategory> filteredSpawningCategories;
|
||||
if (_boolean && (this.spawnEnemies || this.spawnFriendlies)) {
|
||||
|
@@ -200,7 +200,7 @@
|
||||
this.registryAccess(),
|
||||
server.getStructureManager(),
|
||||
- dimension,
|
||||
+ getTypeKey(), // Paper - Fix missing CB diff
|
||||
+ getTypeKey(), // Paper - Fix missing CB diff
|
||||
chunkGenerator,
|
||||
this.chunkSource.randomState(),
|
||||
this,
|
||||
@@ -302,7 +302,7 @@
|
||||
DifficultyInstance currentDifficultyAt = this.getCurrentDifficultyAt(blockPos);
|
||||
boolean flag = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)
|
||||
- && this.random.nextDouble() < currentDifficultyAt.getEffectiveDifficulty() * 0.01
|
||||
+ && this.random.nextDouble() < currentDifficultyAt.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01D) // Paper - Configurable spawn chances for skeleton horses
|
||||
+ && this.random.nextDouble() < currentDifficultyAt.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01) // Paper - Configurable spawn chances for skeleton horses
|
||||
&& !this.getBlockState(blockPos.below()).is(Blocks.LIGHTNING_ROD);
|
||||
if (flag) {
|
||||
SkeletonHorse skeletonHorse = EntityType.SKELETON_HORSE.create(this, EntitySpawnReason.EVENT);
|
||||
@@ -409,23 +409,23 @@
|
||||
this.server.getPlayerList().broadcastAll(new ClientboundGameEventPacket(ClientboundGameEventPacket.THUNDER_LEVEL_CHANGE, this.thunderLevel));
|
||||
}
|
||||
+ */
|
||||
+ for (int idx = 0; idx < this.players.size(); ++idx) {
|
||||
+ if (((ServerPlayer) this.players.get(idx)).level() == this) {
|
||||
+ ((ServerPlayer) this.players.get(idx)).tickWeather();
|
||||
+ for (ServerPlayer player : this.players) {
|
||||
+ if (player.level() == this) {
|
||||
+ player.tickWeather();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (isRaining != this.isRaining()) {
|
||||
+ // Only send weather packets to those affected
|
||||
+ for (int idx = 0; idx < this.players.size(); ++idx) {
|
||||
+ if (((ServerPlayer) this.players.get(idx)).level() == this) {
|
||||
+ ((ServerPlayer) this.players.get(idx)).setPlayerWeather((!isRaining ? org.bukkit.WeatherType.DOWNFALL : org.bukkit.WeatherType.CLEAR), false);
|
||||
+ for (ServerPlayer player : this.players) {
|
||||
+ if (player.level() == this) {
|
||||
+ player.setPlayerWeather((!isRaining ? org.bukkit.WeatherType.DOWNFALL : org.bukkit.WeatherType.CLEAR), false);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ for (int idx = 0; idx < this.players.size(); ++idx) {
|
||||
+ if (((ServerPlayer) this.players.get(idx)).level() == this) {
|
||||
+ ((ServerPlayer) this.players.get(idx)).updateWeather(this.oRainLevel, this.rainLevel, this.oThunderLevel, this.thunderLevel);
|
||||
+ for (ServerPlayer player : this.players) {
|
||||
+ if (player.level() == this) {
|
||||
+ player.updateWeather(this.oRainLevel, this.rainLevel, this.oThunderLevel, this.thunderLevel);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@@ -600,19 +600,19 @@
|
||||
}
|
||||
|
||||
public void unload(LevelChunk chunk) {
|
||||
+ // Spigot Start
|
||||
+ for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) {
|
||||
+ if (tileentity instanceof net.minecraft.world.Container) {
|
||||
+ // Spigot start
|
||||
+ for (net.minecraft.world.level.block.entity.BlockEntity blockEntity : chunk.getBlockEntities().values()) {
|
||||
+ if (blockEntity instanceof net.minecraft.world.Container) {
|
||||
+ // Paper start - this area looks like it can load chunks, change the behavior
|
||||
+ // chests for example can apply physics to the world
|
||||
+ // so instead we just change the active container and call the event
|
||||
+ for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((net.minecraft.world.Container) tileentity).getViewers())) {
|
||||
+ ((org.bukkit.craftbukkit.entity.CraftHumanEntity) h).getHandle().closeUnloadedInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper - Inventory close reason
|
||||
+ for (org.bukkit.entity.HumanEntity human : Lists.newArrayList(((net.minecraft.world.Container) blockEntity).getViewers())) {
|
||||
+ ((org.bukkit.craftbukkit.entity.CraftHumanEntity) human).getHandle().closeUnloadedInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper - Inventory close reason
|
||||
+ }
|
||||
+ // Paper end - this area looks like it can load chunks, change the behavior
|
||||
+ }
|
||||
+ }
|
||||
+ // Spigot End
|
||||
+ // Spigot end
|
||||
chunk.clearAllBlockEntities();
|
||||
chunk.unregisterTickContainerFromLevel(this);
|
||||
}
|
||||
@@ -776,7 +776,7 @@
|
||||
+ ParticleOptions smallExplosionParticles,
|
||||
+ ParticleOptions largeExplosionParticles,
|
||||
+ Holder<SoundEvent> explosionSound,
|
||||
+ java.util.function.Consumer<ServerExplosion> configurator
|
||||
+ @Nullable java.util.function.Consumer<ServerExplosion> configurator
|
||||
+ ) {
|
||||
+ // CraftBukkit end
|
||||
Explosion.BlockInteraction blockInteraction = switch (explosionInteraction) {
|
||||
@@ -865,7 +865,7 @@
|
||||
- for (int i1 = 0; i1 < this.players.size(); i1++) {
|
||||
- ServerPlayer serverPlayer = this.players.get(i1);
|
||||
+ for (int i1 = 0; i1 < receivers.size(); i1++) { // Paper - particle API
|
||||
+ ServerPlayer serverPlayer = receivers.get(i1); // Paper - particle API
|
||||
+ ServerPlayer serverPlayer = receivers.get(i1); // Paper - particle API
|
||||
+ if (sender != null && !serverPlayer.getBukkitEntity().canSee(sender.getBukkitEntity())) continue; // CraftBukkit
|
||||
if (this.sendParticles(serverPlayer, overrideLimiter, posX, posY, posZ, clientboundLevelParticlesPacket)) {
|
||||
i++;
|
||||
@@ -889,11 +889,11 @@
|
||||
+
|
||||
+ final Optional<net.minecraft.world.level.saveddata.SavedData> cacheEntry = storage.cache.get(mapId.key());
|
||||
+ if (cacheEntry == null) { // Cache did not contain, try to load and may init
|
||||
+ final MapItemSavedData worldmap = storage.get(MapItemSavedData.factory(), mapId.key()); // get populates the cache
|
||||
+ if (worldmap != null) { // map was read, init it and return
|
||||
+ worldmap.id = mapId;
|
||||
+ new org.bukkit.event.server.MapInitializeEvent(worldmap.mapView).callEvent();
|
||||
+ return worldmap;
|
||||
+ final MapItemSavedData mapData = storage.get(MapItemSavedData.factory(), mapId.key()); // get populates the cache
|
||||
+ if (mapData != null) { // map was read, init it and return
|
||||
+ mapData.id = mapId;
|
||||
+ new org.bukkit.event.server.MapInitializeEvent(mapData.mapView).callEvent();
|
||||
+ return mapData;
|
||||
+ }
|
||||
+
|
||||
+ return null; // Map does not exist, reading failed.
|
||||
@@ -1096,7 +1096,7 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // Spigot end
|
||||
+ // Spigot Start
|
||||
+ // Spigot start
|
||||
+ if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
|
||||
+ // Paper start - Fix merchant inventory not closing on entity removal
|
||||
+ if (entity.getBukkitEntity() instanceof org.bukkit.inventory.Merchant merchant && merchant.getTrader() != null) {
|
||||
@@ -1107,7 +1107,7 @@
|
||||
+ h.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper - Inventory close reason
|
||||
+ }
|
||||
+ }
|
||||
+ // Spigot End
|
||||
+ // Spigot end
|
||||
ServerLevel.this.getChunkSource().removeEntity(entity);
|
||||
if (entity instanceof ServerPlayer serverPlayer) {
|
||||
ServerLevel.this.players.remove(serverPlayer);
|
||||
|
@@ -334,7 +334,7 @@
|
||||
private void updateScoreForCriteria(ObjectiveCriteria criteria, int points) {
|
||||
- this.getScoreboard().forAllObjectives(criteria, this, scoreAccess -> scoreAccess.set(points));
|
||||
- }
|
||||
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(criteria, this, scoreAccess -> scoreAccess.set(points));
|
||||
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(criteria, this, scoreAccess -> scoreAccess.set(points)); // CraftBukkit - Use our scores instead
|
||||
+ }
|
||||
+
|
||||
+ // Paper start - PlayerDeathEvent#getItemsToKeep
|
||||
@@ -571,11 +571,11 @@
|
||||
+ );
|
||||
+ // Paper end - respawn flags
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(respawnEvent);
|
||||
+ // Spigot Start
|
||||
+ // Spigot start
|
||||
+ if (this.connection.isDisconnected()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ // Spigot End
|
||||
+ // Spigot end
|
||||
+
|
||||
+ location = respawnEvent.getRespawnLocation();
|
||||
+
|
||||
@@ -613,7 +613,7 @@
|
||||
boolean isPossibleToRespawnInThis1 = blockState1.getBlock().isPossibleToRespawnInThis(blockState1);
|
||||
return isPossibleToRespawnInThis && isPossibleToRespawnInThis1
|
||||
- ? Optional.of(new ServerPlayer.RespawnPosAngle(new Vec3(pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5), angle))
|
||||
+ ? Optional.of(new ServerPlayer.RespawnPosAngle(new Vec3(pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5), angle, false, false)) // CraftBukkit
|
||||
+ ? Optional.of(new ServerPlayer.RespawnPosAngle(new Vec3(pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5), angle, false, false)) // CraftBukkit
|
||||
: Optional.empty();
|
||||
}
|
||||
}
|
||||
@@ -1159,7 +1159,7 @@
|
||||
}
|
||||
|
||||
- boolean flag = super.teleportTo(level, x, y, z, relativeMovements, yaw, pitch, setCamera);
|
||||
+ boolean flag = super.teleportTo(level, x, y, z, relativeMovements, yaw, pitch, setCamera, cause); // CraftBukkit
|
||||
+ boolean flag = super.teleportTo(level, x, y, z, relativeMovements, yaw, pitch, setCamera, cause); // CraftBukkit
|
||||
if (flag) {
|
||||
this.setYHeadRot(relativeMovements.contains(Relative.Y_ROT) ? this.getYHeadRot() + yaw : yaw);
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@
|
||||
|
||||
public void tick() {
|
||||
- this.gameTicks++;
|
||||
+ this.gameTicks = net.minecraft.server.MinecraftServer.currentTick; // CraftBukkit;
|
||||
+ this.gameTicks = net.minecraft.server.MinecraftServer.currentTick; // CraftBukkit
|
||||
if (this.hasDelayedDestroy) {
|
||||
- BlockState blockState = this.level.getBlockState(this.delayedDestroyPos);
|
||||
- if (blockState.isAir()) {
|
||||
@@ -102,7 +102,7 @@
|
||||
- return;
|
||||
- }
|
||||
+ // Update any tile entity data for this block
|
||||
+ capturedBlockEntity = true; // Paper - Send block entities after destroy prediction
|
||||
+ this.capturedBlockEntity = true; // Paper - Send block entities after destroy prediction
|
||||
+ // CraftBukkit end
|
||||
+ return;
|
||||
+ }
|
||||
@@ -113,7 +113,7 @@
|
||||
+ // Let the client know the block still exists
|
||||
+ // this.player.connection.send(new ClientboundBlockUpdatePacket(this.level, pos)); // Paper - Don't resync blocks
|
||||
+ // Update any tile entity data for this block
|
||||
+ capturedBlockEntity = true; // Paper - Send block entities after destroy prediction
|
||||
+ this.capturedBlockEntity = true; // Paper - Send block entities after destroy prediction
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@@ -207,7 +207,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -235,36 +_,125 @@
|
||||
@@ -235,36 +_,127 @@
|
||||
|
||||
public boolean destroyBlock(BlockPos pos) {
|
||||
BlockState blockState = this.level.getBlockState(pos);
|
||||
@@ -258,12 +258,14 @@
|
||||
+ // Paper end - Don't resync blocks
|
||||
+
|
||||
+ // Update any tile entity data for this block
|
||||
+ if (!captureSentBlockEntities) { // Paper - Send block entities after destroy prediction
|
||||
+ BlockEntity tileentity = this.level.getBlockEntity(pos);
|
||||
+ if (tileentity != null) {
|
||||
+ this.player.connection.send(tileentity.getUpdatePacket());
|
||||
+ if (!this.captureSentBlockEntities) { // Paper - Send block entities after destroy prediction
|
||||
+ BlockEntity blockEntity = this.level.getBlockEntity(pos);
|
||||
+ if (blockEntity != null) {
|
||||
+ this.player.connection.send(blockEntity.getUpdatePacket());
|
||||
+ }
|
||||
+ } else {capturedBlockEntity = true;} // Paper - Send block entities after destroy prediction
|
||||
+ } else {
|
||||
+ this.capturedBlockEntity = true; // Paper - Send block entities after destroy prediction
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
|
@@ -1785,21 +1785,20 @@
|
||||
}
|
||||
|
||||
public void sendDisguisedChatMessage(Component message, ChatType.Bound boundType) {
|
||||
@@ -1579,6 +_,18 @@
|
||||
@@ -1579,6 +_,17 @@
|
||||
return this.connection.getRemoteAddress();
|
||||
}
|
||||
|
||||
+ // Spigot Start
|
||||
+ public SocketAddress getRawAddress()
|
||||
+ {
|
||||
+ // Spigot start
|
||||
+ public SocketAddress getRawAddress() {
|
||||
+ // Paper start - Unix domain socket support; this can be nullable in the case of a Unix domain socket, so if it is, fake something
|
||||
+ if (connection.channel.remoteAddress() == null) {
|
||||
+ if (this.connection.channel.remoteAddress() == null) {
|
||||
+ return new java.net.InetSocketAddress(java.net.InetAddress.getLoopbackAddress(), 0);
|
||||
+ }
|
||||
+ // Paper end - Unix domain socket support
|
||||
+ return this.connection.channel.remoteAddress();
|
||||
+ }
|
||||
+ // Spigot End
|
||||
+ // Spigot end
|
||||
+
|
||||
public void switchToConfig() {
|
||||
this.waitingForSwitchToConfig = true;
|
||||
@@ -1812,12 +1811,12 @@
|
||||
if (this.player.hasClientLoaded()) {
|
||||
final ServerLevel serverLevel = this.player.serverLevel();
|
||||
final Entity target = packet.getTarget(serverLevel);
|
||||
+ // Spigot Start
|
||||
+ // Spigot start
|
||||
+ if (target == this.player && !this.player.isSpectator()) {
|
||||
+ this.disconnect(Component.literal("Cannot interact with self!"), org.bukkit.event.player.PlayerKickEvent.Cause.SELF_INTERACTION); // Paper - kick event cause
|
||||
+ return;
|
||||
+ }
|
||||
+ // Spigot End
|
||||
+ // Spigot end
|
||||
this.player.resetLastActionTime();
|
||||
this.player.setShiftKeyDown(packet.isUsingSecondaryAction());
|
||||
if (target != null) {
|
||||
|
@@ -107,9 +107,9 @@
|
||||
+ if (event.callEvent()) {
|
||||
+ // If we've failed somehow, let the client know so and go no further.
|
||||
+ if (event.isFailed()) {
|
||||
+ Component component = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.failMessage());
|
||||
+ this.connection.send(new ClientboundLoginDisconnectPacket(component));
|
||||
+ this.connection.disconnect(component);
|
||||
+ Component message = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.failMessage());
|
||||
+ this.connection.send(new ClientboundLoginDisconnectPacket(message));
|
||||
+ this.connection.disconnect(message);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@@ -129,7 +129,7 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+ // Spigot Start
|
||||
+ // Spigot start
|
||||
+ String[] split = packet.hostName().split("\00");
|
||||
+ if (!handledByEvent && proxyLogicEnabled) { // Paper
|
||||
+ // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
|
||||
@@ -141,20 +141,20 @@
|
||||
+ // Paper end - Unix domain socket support
|
||||
+ this.connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] );
|
||||
+ } else {
|
||||
+ Component chatmessage = Component.literal("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!");
|
||||
+ this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
|
||||
+ this.connection.disconnect(chatmessage);
|
||||
+ Component message = Component.literal("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!");
|
||||
+ this.connection.send(new ClientboundLoginDisconnectPacket(message));
|
||||
+ this.connection.disconnect(message);
|
||||
+ return;
|
||||
+ }
|
||||
+ if (split.length == 4) {
|
||||
+ this.connection.spoofedProfile = ServerHandshakePacketListenerImpl.gson.fromJson(split[3], com.mojang.authlib.properties.Property[].class);
|
||||
+ }
|
||||
+ } else if ((split.length == 3 || split.length == 4) && (ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher(split[1]).matches())) {
|
||||
+ Component chatmessage = Component.literal("Unknown data in login hostname, did you forget to enable BungeeCord in spigot.yml?");
|
||||
+ this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
|
||||
+ this.connection.disconnect(chatmessage);
|
||||
+ Component message = Component.literal("Unknown data in login hostname, did you forget to enable BungeeCord in spigot.yml?");
|
||||
+ this.connection.send(new ClientboundLoginDisconnectPacket(message));
|
||||
+ this.connection.disconnect(message);
|
||||
+ }
|
||||
+ // Spigot End
|
||||
+ // Spigot end
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -47,7 +47,7 @@
|
||||
GameProfileCache.GameProfileInfo gameProfileInfo = new GameProfileCache.GameProfileInfo(gameProfile, time);
|
||||
this.safeAdd(gameProfileInfo);
|
||||
- this.save();
|
||||
+ if(!org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) this.save(true); // Spigot - skip saving if disabled // Paper - Perf: Async GameProfileCache saving
|
||||
+ if (!org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) this.save(true); // Spigot - skip saving if disabled // Paper - Perf: Async GameProfileCache saving
|
||||
}
|
||||
|
||||
private long getNextOperation() {
|
||||
@@ -130,11 +130,11 @@
|
||||
|
||||
return (List<GameProfileCache.GameProfileInfo>)var9;
|
||||
} catch (FileNotFoundException var7) {
|
||||
+ // Spigot Start
|
||||
+ // Spigot start
|
||||
+ } catch (com.google.gson.JsonSyntaxException | NullPointerException ex) {
|
||||
+ GameProfileCache.LOGGER.warn( "Usercache.json is corrupted or has bad formatting. Deleting it to prevent further issues." );
|
||||
+ LOGGER.warn( "Usercache.json is corrupted or has bad formatting. Deleting it to prevent further issues." );
|
||||
+ this.file.delete();
|
||||
+ // Spigot End
|
||||
+ // Spigot end
|
||||
} catch (JsonParseException | IOException var8) {
|
||||
LOGGER.warn("Failed to load profile cache {}", this.file, var8);
|
||||
}
|
||||
|
@@ -671,11 +671,11 @@
|
||||
+ } else {
|
||||
+ teleportTransition = new TeleportTransition(((org.bukkit.craftbukkit.CraftWorld) location.getWorld()).getHandle(), org.bukkit.craftbukkit.util.CraftLocation.toVec3D(location), Vec3.ZERO, location.getYaw(), location.getPitch(), TeleportTransition.DO_NOTHING);
|
||||
+ }
|
||||
+ // Spigot Start
|
||||
+ // Spigot start
|
||||
+ if (teleportTransition == null) { // Paper - Add PlayerPostRespawnEvent - diff on change - spigot early returns if respawn pos is null, that is how they handle disconnected player in respawn event
|
||||
+ return player;
|
||||
+ }
|
||||
+ // Spigot End
|
||||
+ // Spigot end
|
||||
+ ServerLevel level = teleportTransition.newLevel();
|
||||
+ serverPlayer.spawnIn(level);
|
||||
+ serverPlayer.unsetRemoved();
|
||||
|
@@ -68,14 +68,14 @@
|
||||
this.map.put(this.getKeyForUser(storedUserEntry.getUser()), (V)storedUserEntry);
|
||||
}
|
||||
}
|
||||
+ // Spigot Start
|
||||
+ // Spigot start
|
||||
+ } catch (com.google.gson.JsonParseException | NullPointerException ex) {
|
||||
+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Unable to read file " + this.file + ", backing it up to {0}.backup and creating new copy.", ex);
|
||||
+ LOGGER.warn("Unable to read file {}, backing it up to {0}.backup and creating new copy.", this.file, ex);
|
||||
+ File backup = new File(this.file + ".backup");
|
||||
+ this.file.renameTo(backup);
|
||||
+ this.file.delete();
|
||||
}
|
||||
+ // Spigot End
|
||||
+ // Spigot end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/players/UserBanListEntry.java
|
||||
+++ b/net/minecraft/server/players/UserBanListEntry.java
|
||||
@@ -37,19 +_,29 @@
|
||||
@@ -37,19 +_,27 @@
|
||||
|
||||
@Nullable
|
||||
private static GameProfile createGameProfile(JsonObject json) {
|
||||
@@ -21,16 +21,14 @@
|
||||
|
||||
- return new GameProfile(uuid, json.get("name").getAsString());
|
||||
+ }
|
||||
+ if ( json.has("name"))
|
||||
+ {
|
||||
+ if (json.has("name")) {
|
||||
+ name = json.get("name").getAsString();
|
||||
+ }
|
||||
+ if ( uuid != null || name != null )
|
||||
+ {
|
||||
+ return new GameProfile( uuid, name );
|
||||
+ if (uuid != null || name != null) {
|
||||
+ return new GameProfile(uuid, name);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
+ // Spigot End
|
||||
+ // Spigot end
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user