Upstream Update (#5211)

This commit is contained in:
MiniDigger | Martin 2021-02-21 21:55:01 +01:00
parent 8bafdd49dc
commit db0dd75a20
21 changed files with 43 additions and 91 deletions

View File

@ -202,7 +202,7 @@ diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/buk
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/NamespacedKey.java
+++ b/src/main/java/org/bukkit/NamespacedKey.java
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
* underscores, hyphens, and forward slashes.
*
*/

View File

@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end
+
/**
* Returns whether the world has an ongoing storm.
* Gets the full in-game time on this world since the world generation
*
diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

View File

@ -308,7 +308,7 @@ diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/buk
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/NamespacedKey.java
+++ b/src/main/java/org/bukkit/NamespacedKey.java
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
* underscores, hyphens, and forward slashes.
*
*/
@ -318,8 +318,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/**
* The namespace representing all inbuilt keys.
@@ -0,0 +0,0 @@ public final class NamespacedKey {
public static NamespacedKey minecraft(@NotNull String key) {
return new NamespacedKey(MINECRAFT, key);
public static NamespacedKey fromString(@NotNull String key) {
return fromString(key, null);
}
+
+ // Paper start

View File

@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -0,0 +0,0 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
this.tileEntity = tileEntityClass.cast(world.getHandle().getTileEntity(this.getPosition()));
Preconditions.checkState(this.tileEntity != null, "Tile is null, asynchronous access? " + block);
Preconditions.checkState(this.tileEntity != null, "Tile is null, asynchronous access? %s", block);
+ // Paper start
+ this.snapshotDisabled = DISABLE_SNAPSHOT;

View File

@ -32,8 +32,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end
+
@Override
public boolean createExplosion(double x, double y, double z, float power) {
return createExplosion(x, y, z, power, false, true);
public long getGameTime() {
return world.worldData.getTime();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java

View File

@ -166,4 +166,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
// Paper end
private final Spigot spigot = new Spigot()
// Spigot start

View File

@ -1826,14 +1826,6 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.Statistic;
import org.bukkit.WeatherType;
-import org.bukkit.World;
import org.bukkit.block.data.BlockData;
import org.bukkit.configuration.serialization.DelegateDeserialization;
import org.bukkit.conversations.Conversation;
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
@ -2410,11 +2402,12 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
@@ -0,0 +0,0 @@ package org.bukkit.craftbukkit.inventory;
@@ -0,0 +0,0 @@
package org.bukkit.craftbukkit.inventory;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
-import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.collect.Lists;
+
+import com.google.common.collect.ImmutableMap; // Paper
import java.util.ArrayList;

View File

@ -11,8 +11,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/ChunkMapDistance.java
+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java
@@ -0,0 +0,0 @@ public abstract class ChunkMapDistance {
long i = sectionposition.r().pair();
ObjectSet<EntityPlayer> objectset = (ObjectSet) this.c.get(i);
if (objectset == null) return; // CraftBukkit - SPIGOT-6208
- objectset.remove(entityplayer);
- if (objectset.isEmpty()) {

View File

@ -443,10 +443,11 @@ diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -0,0 +0,0 @@ package org.spigotmc;
@@ -0,0 +0,0 @@
package org.spigotmc;
import java.util.Collection;
import java.util.List;
+import java.util.List;
+
+import net.minecraft.server.Activity;
import net.minecraft.server.AxisAlignedBB;
@ -634,7 +635,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
*/
private static void activateChunkEntities(Chunk chunk)
{
- for ( List<Entity> slice : chunk.entitySlices )
- for ( java.util.List<Entity> slice : chunk.entitySlices )
- {
- for ( Entity entity : (Collection<Entity>) slice )
+ // Paper start

View File

@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
private void removeEntityFromChunk(Entity entity) {
- IChunkAccess ichunkaccess = this.getChunkAt(entity.chunkX, entity.chunkZ, ChunkStatus.FULL, false);
- IChunkAccess ichunkaccess = chunkProvider.getChunkUnchecked(entity.chunkX, entity.chunkZ); // CraftBukkit - SPIGOT-5228: getChunkAt won't find the entity's chunk if it has already been unloaded (i.e. if it switched to state INACCESSIBLE).
+ Chunk ichunkaccess = entity.getCurrentChunk(); // Paper - getChunkAt(x,z,full,false) is broken by CraftBukkit as it won't return an unloading chunk. Use our current chunk reference as this points to what chunk they need to be removed from anyways
- if (ichunkaccess instanceof Chunk) {

View File

@ -158,9 +158,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end
+
// Spigot start
private final Spigot spigot = new Spigot()
{
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java

View File

@ -40,34 +40,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Collections;
@@ -0,0 +0,0 @@ import net.minecraft.server.EntityAnimal;
import net.minecraft.server.EntityAreaEffectCloud;
import net.minecraft.server.EntityDamageSource;
import net.minecraft.server.EntityDamageSourceIndirect;
-import net.minecraft.server.EntityEnderCrystal;
import net.minecraft.server.EntityEnderDragon;
import net.minecraft.server.EntityExperienceOrb;
import net.minecraft.server.EntityFireworks;
@@ -0,0 +0,0 @@ import net.minecraft.server.EntityVillager;
import net.minecraft.server.EntityWaterAnimal;
import net.minecraft.server.EnumDirection;
import net.minecraft.server.EnumHand;
-import net.minecraft.server.EnumItemSlot;
import net.minecraft.server.Explosion;
import net.minecraft.server.GeneratorAccess;
import net.minecraft.server.IBlockData;
-import net.minecraft.server.IChatBaseComponent;
import net.minecraft.server.IInventory;
import net.minecraft.server.IProjectile;
import net.minecraft.server.ItemActionContext;
@@ -0,0 +0,0 @@ import net.minecraft.server.Unit;
import net.minecraft.server.World;
import net.minecraft.server.WorldServer;
import org.bukkit.Bukkit;
-import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Server;
@@ -0,0 +0,0 @@ import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.Vehicle;
import org.bukkit.entity.Villager;
@ -76,22 +48,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Result;
@@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityEnterLoveModeEvent;
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.entity.EntityPlaceEvent;
-import org.bukkit.event.entity.EntityPortalEvent;
import org.bukkit.event.entity.EntityPotionEffectEvent;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
@@ -0,0 +0,0 @@ import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.meta.BookMeta;
import org.bukkit.potion.PotionEffect;
-import org.bukkit.projectiles.ProjectileSource;
import org.bukkit.event.entity.SpawnerSpawnEvent; // Spigot
@@ -0,0 +0,0 @@ public class CraftEventFactory {
return event;

View File

@ -3993,24 +3993,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ public final boolean isEntityTickingReady() {
+ return this.isEntityTickingReady;
}
+ }
+
+ public final boolean isTickingReady() {
+ return this.isTickingReady;
+ }
+
+ public final boolean isFullChunkReady() {
+ return this.isFullChunkReady;
+ }
}
+ // Paper end
+
// CraftBukkit start
- public Chunk getFullChunk() {
+ public final Chunk getFullChunk() { // Paper - final for inline
if (!getChunkState(this.oldTicketLevel).isAtLeast(PlayerChunk.State.BORDER)) return null; // note: using oldTicketLevel for isLoaded checks
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> statusFuture = this.getStatusFutureUnchecked(ChunkStatus.FULL);
Either<IChunkAccess, PlayerChunk.Failure> either = (Either<IChunkAccess, PlayerChunk.Failure>) statusFuture.getNow(null);
return either == null ? null : (Chunk) either.left().orElse(null);
return this.getFullChunkUnchecked();
}
@@ -0,0 +0,0 @@ public class PlayerChunk {
return (either == null) ? null : (Chunk) either.left().orElse(null);
}
// CraftBukkit end
+ // Paper start - "real" get full chunk immediately

View File

@ -687,9 +687,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
ignoreVanillaPermissions = commandsConfiguration.getBoolean("ignore-vanilla-permissions");
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
{
return spigot;
}
// Spigot end
+
+ // Paper start
+ @SuppressWarnings({"rawtypes", "unchecked"})

View File

@ -42,9 +42,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.tileEntityListTick.remove(tileTickPosition--);
+ continue;
+ // Paper end
}
// Spigot start
finally {
// Spigot start
} finally {
tileentity.tickTimer.stopTiming();
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
try {
consumer.accept(entity);

View File

@ -134,7 +134,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
- // Kick all players
- for ( EntityPlayer p : (List< EntityPlayer>) MinecraftServer.getServer().getPlayerList().players )
- for ( EntityPlayer p : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players )
- {
- p.playerConnection.disconnect(SpigotConfig.restartMessage);
- }

View File

@ -1846,10 +1846,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void restart() {
org.spigotmc.RestartCommand.restart();
diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
deleted file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
+++ /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
@@ -0,0 +0,0 @@
-package org.bukkit.craftbukkit;
-
@ -1921,7 +1920,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
-
- String name = "Task: " + plugin + " Runnable: " + taskname;
- if (period > 0) {
- name += "(interval:" + period +")";
- name += "(interval:" + period + ")";
- } else {
- name += "(Single)";
- }
@ -2120,13 +2119,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+import co.aikar.timings.NullTimingHandler;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitTask;
-import org.bukkit.craftbukkit.SpigotTimings; // Spigot
-import org.spigotmc.CustomTimingsHandler; // Spigot
+import co.aikar.timings.MinecraftTimings; // Paper
+import co.aikar.timings.Timing; // Paper
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitTask;
public class CraftTask implements BukkitTask, Runnable { // Spigot
@@ -0,0 +0,0 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
*/
private volatile long period;

View File

@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if ( entity instanceof EntityPlayer )
{
return config.playerTrackingRange;
- } else if ( entity.activationType == ActivationRange.ActivationType.MONSTER || entity.activationType == ActivationRange.ActivationType.RAIDER )
- } else if ( entity.activationType == ActivationRange.ActivationType.MONSTER || entity.activationType == ActivationRange.ActivationType.RAIDER )
- {
- return config.monsterTrackingRange;
- } else if ( entity instanceof EntityGhast )

@ -1 +1 @@
Subproject commit 1b5ad2af5decf1d2cd276ae391d75a8ab1167b15
Subproject commit 1e843b72bbd67b7b5ec785eae260fb00a5b64292

@ -1 +1 @@
Subproject commit 8049146227e4f8e44013f6b825ee91bdc7e3290f
Subproject commit b7eed25467eb583d77cda6a042387dc48fe14f97

@ -1 +1 @@
Subproject commit 89d6047d1aea78b9011ba38681663780a63233c9
Subproject commit 73fb6094f4fa318955bb5bb11a1ec1af12cf90a1