@@ -34,10 +34,10 @@
|
||||
return;
|
||||
}
|
||||
+ */ // CraftBukkit end
|
||||
+
|
||||
+ try {
|
||||
|
||||
- Path path = (Path) optionset.valueOf(optionspec13);
|
||||
+ try {
|
||||
+
|
||||
+ Path path = (Path) optionset.valueOf("pidFile"); // CraftBukkit
|
||||
|
||||
if (path != null) {
|
||||
|
||||
@@ -151,11 +151,15 @@
|
||||
+ // CraftBukkit start
|
||||
+ private void loadWorld0(String s) {
|
||||
+ Convertable.ConversionSession worldSession = this.storageSource;
|
||||
+
|
||||
|
||||
- this.levels.put(World.OVERWORLD, worldserver);
|
||||
- WorldPersistentData worldpersistentdata = worldserver.getDataStorage();
|
||||
+ IRegistry<WorldDimension> dimensions = this.registries.compositeAccess().registryOrThrow(Registries.LEVEL_STEM);
|
||||
+ for (WorldDimension worldDimension : dimensions) {
|
||||
+ ResourceKey<WorldDimension> dimensionKey = dimensions.getResourceKey(worldDimension).get();
|
||||
+
|
||||
|
||||
- this.readScoreboard(worldpersistentdata);
|
||||
- this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
+ WorldServer world;
|
||||
+ int dimension = 0;
|
||||
+
|
||||
@@ -218,14 +222,10 @@
|
||||
+ throw new RuntimeException(ex);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- this.levels.put(World.OVERWORLD, worldserver);
|
||||
- WorldPersistentData worldpersistentdata = worldserver.getDataStorage();
|
||||
+
|
||||
+ org.bukkit.generator.ChunkGenerator gen = this.server.getGenerator(name);
|
||||
+ org.bukkit.generator.BiomeProvider biomeProvider = this.server.getBiomeProvider(name);
|
||||
|
||||
- this.readScoreboard(worldpersistentdata);
|
||||
- this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
+
|
||||
+ WorldDataServer worlddata;
|
||||
+ WorldLoader.a worldloader_a = this.worldLoader;
|
||||
+ IRegistry<WorldDimension> iregistry = worldloader_a.datapackDimensions().registryOrThrow(Registries.LEVEL_STEM);
|
||||
|
||||
@@ -77,8 +77,8 @@
|
||||
+ this.displayName = this.getScoreboardName();
|
||||
+ this.bukkitPickUpLoot = true;
|
||||
+ this.maxHealthCache = this.getMaxHealth();
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ // Yes, this doesn't match Vanilla, but it's the best we can do for now.
|
||||
+ // If this is an issue, PRs are welcome
|
||||
+ public final BlockPosition getSpawnPoint(WorldServer worldserver) {
|
||||
@@ -115,9 +115,9 @@
|
||||
+ }
|
||||
+
|
||||
+ return blockposition;
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
private void fudgeSpawnLocation(WorldServer worldserver) {
|
||||
BlockPosition blockposition = worldserver.getSharedSpawnPos();
|
||||
|
||||
@@ -302,7 +302,9 @@
|
||||
+ }
|
||||
+ java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(this.getInventory().getContainerSize());
|
||||
+ boolean keepInventory = this.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || this.isSpectator();
|
||||
+
|
||||
|
||||
- if (flag) {
|
||||
- IChatBaseComponent ichatbasecomponent = this.getCombatTracker().getDeathMessage();
|
||||
+ if (!keepInventory) {
|
||||
+ for (ItemStack item : this.getInventory().getContents()) {
|
||||
+ if (!item.isEmpty() && !EnchantmentManager.hasVanishingCurse(item)) {
|
||||
@@ -316,9 +318,7 @@
|
||||
+ loot.add(item);
|
||||
+ }
|
||||
+ this.drops.clear(); // SPIGOT-5188: make sure to clear
|
||||
|
||||
- if (flag) {
|
||||
- IChatBaseComponent ichatbasecomponent = this.getCombatTracker().getDeathMessage();
|
||||
+
|
||||
+ IChatBaseComponent defaultMessage = this.getCombatTracker().getDeathMessage();
|
||||
+
|
||||
+ String deathmessage = defaultMessage.getString();
|
||||
@@ -480,7 +480,9 @@
|
||||
+ exit = tpEvent.getTo();
|
||||
+ worldserver = ((CraftWorld) exit.getWorld()).getHandle();
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
- worldserver1.getProfiler().pop();
|
||||
- worldserver1.getProfiler().push("placing");
|
||||
+ worldserver1.getProfiler().pop();
|
||||
+ worldserver1.getProfiler().push("placing");
|
||||
+ if (true) { // CraftBukkit
|
||||
@@ -493,9 +495,7 @@
|
||||
+ playerlist.sendPlayerPermissionLevel(this);
|
||||
+ worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
+ this.unsetRemoved();
|
||||
|
||||
- worldserver1.getProfiler().pop();
|
||||
- worldserver1.getProfiler().push("placing");
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
this.setServerLevel(worldserver);
|
||||
- this.connection.teleport(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, shapedetectorshape.xRot);
|
||||
@@ -583,14 +583,14 @@
|
||||
+ // CraftBukkit start
|
||||
+ ResourceKey<World> maindimensionkey = CraftDimensionUtil.getMainDimensionKey(worldserver);
|
||||
+ ResourceKey<World> maindimensionkey1 = CraftDimensionUtil.getMainDimensionKey(this.level());
|
||||
+
|
||||
|
||||
- CriterionTriggers.CHANGED_DIMENSION.trigger(this, resourcekey, resourcekey1);
|
||||
- if (resourcekey == World.NETHER && resourcekey1 == World.OVERWORLD && this.enteredNetherPosition != null) {
|
||||
+ CriterionTriggers.CHANGED_DIMENSION.trigger(this, maindimensionkey, maindimensionkey1);
|
||||
+ if (maindimensionkey != resourcekey || maindimensionkey1 != resourcekey1) {
|
||||
+ CriterionTriggers.CHANGED_DIMENSION.trigger(this, resourcekey, resourcekey1);
|
||||
+ }
|
||||
|
||||
- CriterionTriggers.CHANGED_DIMENSION.trigger(this, resourcekey, resourcekey1);
|
||||
- if (resourcekey == World.NETHER && resourcekey1 == World.OVERWORLD && this.enteredNetherPosition != null) {
|
||||
+
|
||||
+ if (maindimensionkey == World.NETHER && maindimensionkey1 == World.OVERWORLD && this.enteredNetherPosition != null) {
|
||||
+ // CraftBukkit end
|
||||
CriterionTriggers.NETHER_TRAVEL.trigger(this, this.enteredNetherPosition);
|
||||
|
||||
@@ -113,22 +113,21 @@
|
||||
if (!collection.isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutUpdateAttributes(this.entity.getId(), collection));
|
||||
}
|
||||
@@ -303,8 +342,15 @@
|
||||
@@ -303,7 +342,14 @@
|
||||
if (!list.isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutEntityEquipment(this.entity.getId(), list));
|
||||
}
|
||||
+ ((EntityLiving) this.entity).detectEquipmentUpdates(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start - MC-109346: Fix for nonsensical head yaw
|
||||
+ if (this.entity instanceof EntityPlayer) {
|
||||
+ consumer.accept(new PacketPlayOutEntityHeadRotation(this.entity, (byte) MathHelper.floor(this.entity.getYHeadRot() * 256.0F / 360.0F)));
|
||||
+ }
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
if (!this.entity.getPassengers().isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutMount(this.entity));
|
||||
}
|
||||
@@ -338,6 +384,11 @@
|
||||
Set<AttributeModifiable> set = ((EntityLiving) this.entity).getAttributes().getDirtyAttributes();
|
||||
|
||||
|
||||
@@ -158,7 +158,8 @@
|
||||
+ // CraftBukkit start - fire BlockBreakEvent
|
||||
+ org.bukkit.block.Block bblock = CraftBlock.at(level, blockposition);
|
||||
+ BlockBreakEvent event = null;
|
||||
+
|
||||
|
||||
- if (!this.player.getMainHandItem().getItem().canAttackBlock(iblockdata, this.level, blockposition, this.player)) {
|
||||
+ if (this.player instanceof EntityPlayer) {
|
||||
+ // Sword + Creative mode pre-cancel
|
||||
+ boolean isSwordNoBreak = !this.player.getMainHandItem().getItem().canAttackBlock(iblockdata, this.level, blockposition, this.player);
|
||||
@@ -193,8 +194,7 @@
|
||||
+ }
|
||||
+ // Let the client know the block still exists
|
||||
+ this.player.connection.send(new PacketPlayOutBlockChange(this.level, blockposition));
|
||||
|
||||
- if (!this.player.getMainHandItem().getItem().canAttackBlock(iblockdata, this.level, blockposition, this.player)) {
|
||||
+
|
||||
+ // Brute force all possible updates
|
||||
+ for (EnumDirection dir : EnumDirection.values()) {
|
||||
+ this.player.connection.send(new PacketPlayOutBlockChange(level, blockposition.relative(dir)));
|
||||
@@ -252,13 +252,13 @@
|
||||
+ // CraftBukkit start
|
||||
+ if (event.isDropItems()) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, level.captureDrops);
|
||||
}
|
||||
+ }
|
||||
+ level.captureDrops = null;
|
||||
+
|
||||
+ // Drop event experience
|
||||
+ if (flag && event != null) {
|
||||
+ iblockdata.getBlock().popExperience(this.level, blockposition, event.getExpToDrop());
|
||||
+ }
|
||||
}
|
||||
+
|
||||
+ return true;
|
||||
+ // CraftBukkit end
|
||||
|
||||
@@ -46,7 +46,9 @@
|
||||
+ // CraftBukkit start
|
||||
+ public final Convertable.ConversionSession convertable;
|
||||
+ public final UUID uuid;
|
||||
+
|
||||
|
||||
- Objects.requireNonNull(minecraftserver);
|
||||
- super(iworlddataserver, resourcekey, iregistrycustom_dimension, holder, minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates());
|
||||
+ public Chunk getChunkIfLoaded(int x, int z) {
|
||||
+ return this.chunkSource.getChunk(x, z, false);
|
||||
+ }
|
||||
@@ -55,9 +57,7 @@
|
||||
+ public ResourceKey<WorldDimension> getTypeKey() {
|
||||
+ return convertable.dimensionType;
|
||||
+ }
|
||||
|
||||
- Objects.requireNonNull(minecraftserver);
|
||||
- super(iworlddataserver, resourcekey, iregistrycustom_dimension, holder, minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates());
|
||||
+
|
||||
+ // Add env and gen to constructor, IWorldDataServer -> WorldDataServer
|
||||
+ public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, WorldDataServer iworlddataserver, ResourceKey<World> resourcekey, WorldDimension worlddimension, WorldLoadListener worldloadlistener, boolean flag, long i, List<MobSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
||||
+ // IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess(); // CraftBukkit - decompile error
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/network/ServerConnection.java
|
||||
+++ b/net/minecraft/server/network/ServerConnection.java
|
||||
@@ -98,16 +98,26 @@
|
||||
@@ -98,15 +98,25 @@
|
||||
|
||||
NetworkManager.configureSerialization(channelpipeline, EnumProtocolDirection.SERVERBOUND, (BandwidthDebugMonitor) null);
|
||||
int j = ServerConnection.this.server.getRateLimitPacketsPerSecond();
|
||||
@@ -13,19 +13,18 @@
|
||||
}
|
||||
- }).group(eventloopgroup).localAddress(inetaddress, i)).bind().syncUninterruptibly());
|
||||
+ }).group(eventloopgroup).localAddress(inetaddress, i)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public void acceptConnections() {
|
||||
+ synchronized (this.channels) {
|
||||
+ for (ChannelFuture future : this.channels) {
|
||||
+ future.channel().config().setAutoRead(true);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
public SocketAddress startMemoryChannel() {
|
||||
List list = this.channels;
|
||||
ChannelFuture channelfuture;
|
||||
|
||||
@@ -427,14 +427,14 @@
|
||||
+ */
|
||||
+ return player == null;
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public EntityPlayer respawn(EntityPlayer entityplayer, boolean flag, RespawnReason reason) {
|
||||
+ return this.respawn(entityplayer, this.server.getLevel(entityplayer.getRespawnDimension()), flag, null, true, reason);
|
||||
}
|
||||
|
||||
- public EntityPlayer respawn(EntityPlayer entityplayer, boolean flag) {
|
||||
+ // CraftBukkit start
|
||||
+ public EntityPlayer respawn(EntityPlayer entityplayer, boolean flag, RespawnReason reason) {
|
||||
+ return this.respawn(entityplayer, this.server.getLevel(entityplayer.getRespawnDimension()), flag, null, true, reason);
|
||||
+ }
|
||||
+
|
||||
+ public EntityPlayer respawn(EntityPlayer entityplayer, WorldServer worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason) {
|
||||
+ entityplayer.stopRiding(); // CraftBukkit
|
||||
this.players.remove(entityplayer);
|
||||
@@ -483,7 +483,8 @@
|
||||
+ } else {
|
||||
+ optional = Optional.empty();
|
||||
+ }
|
||||
+
|
||||
|
||||
- f1 = (float) MathHelper.wrapDegrees(MathHelper.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
+ if (optional.isPresent()) {
|
||||
+ IBlockData iblockdata = worldserver1.getBlockState(blockposition);
|
||||
+ boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR);
|
||||
@@ -506,13 +507,6 @@
|
||||
+ entityplayer1.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
|
||||
+ entityplayer1.setRespawnPosition(null, null, 0f, false, false, PlayerSpawnChangeEvent.Cause.RESET); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- f1 = (float) MathHelper.wrapDegrees(MathHelper.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
+ if (location == null) {
|
||||
+ worldserver1 = this.server.getLevel(World.OVERWORLD);
|
||||
+ blockposition = entityplayer1.getSpawnPoint(worldserver1);
|
||||
+ location = CraftLocation.toBukkit(blockposition, worldserver1.getWorld()).add(0.5F, 0.1F, 0.5F);
|
||||
}
|
||||
|
||||
- entityplayer1.moveTo(vec3d.x, vec3d.y, vec3d.z, f1, 0.0F);
|
||||
@@ -520,6 +514,12 @@
|
||||
- flag2 = !flag && flag3;
|
||||
- } else if (blockposition != null) {
|
||||
- entityplayer1.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
|
||||
+ if (location == null) {
|
||||
+ worldserver1 = this.server.getLevel(World.OVERWORLD);
|
||||
+ blockposition = entityplayer1.getSpawnPoint(worldserver1);
|
||||
+ location = CraftLocation.toBukkit(blockposition, worldserver1.getWorld()).add(0.5F, 0.1F, 0.5F);
|
||||
+ }
|
||||
+
|
||||
+ Player respawnPlayer = entityplayer1.getBukkitEntity();
|
||||
+ PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !flag2, flag2, reason);
|
||||
+ cserver.getPluginManager().callEvent(respawnEvent);
|
||||
|
||||
@@ -14,12 +14,11 @@
|
||||
private static final IChatBaseComponent RCON_COMPONENT = IChatBaseComponent.literal("Rcon");
|
||||
private final StringBuffer buffer = new StringBuffer();
|
||||
private final MinecraftServer server;
|
||||
-
|
||||
- public RemoteControlCommandListener(MinecraftServer minecraftserver) {
|
||||
+ // CraftBukkit start
|
||||
+ public final SocketAddress socketAddress;
|
||||
+ private final CraftRemoteConsoleCommandSender remoteConsole = new CraftRemoteConsoleCommandSender(this);
|
||||
+
|
||||
|
||||
- public RemoteControlCommandListener(MinecraftServer minecraftserver) {
|
||||
+ public RemoteControlCommandListener(MinecraftServer minecraftserver, SocketAddress socketAddress) {
|
||||
+ this.socketAddress = socketAddress;
|
||||
+ // CraftBukkit end
|
||||
|
||||
Reference in New Issue
Block a user