@@ -4,20 +4,20 @@
|
||||
Advancement advancement = advancementdataworld.a((MinecraftKey) entry.getKey());
|
||||
|
||||
if (advancement == null) {
|
||||
- AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.f);
|
||||
- AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.file);
|
||||
+ // CraftBukkit start
|
||||
+ if (entry.getKey().getNamespace().equals("minecraft")) {
|
||||
+ AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.f);
|
||||
+ AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.file);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
this.a(advancement, (AdvancementProgress) entry.getValue());
|
||||
}
|
||||
@@ -296,6 +300,7 @@
|
||||
this.j.add(advancement);
|
||||
@@ -276,6 +280,7 @@
|
||||
this.progressChanged.add(advancement);
|
||||
flag = true;
|
||||
if (!flag1 && advancementprogress.isDone()) {
|
||||
+ this.player.world.getServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit
|
||||
+ this.player.level.getServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit
|
||||
advancement.d().a(this.player);
|
||||
if (advancement.c() != null && advancement.c().i() && this.player.world.getGameRules().getBoolean(GameRules.ANNOUNCE_ADVANCEMENTS)) {
|
||||
this.e.sendMessage(new ChatMessage("chat.type.advancement." + advancement.c().e().a(), new Object[]{this.player.getScoreboardDisplayName(), advancement.j()}), ChatMessageType.SYSTEM, SystemUtils.b);
|
||||
if (advancement.c() != null && advancement.c().i() && this.player.level.getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
|
||||
this.playerList.sendMessage(new ChatMessage("chat.type.advancement." + advancement.c().e().a(), new Object[]{this.player.getScoreboardDisplayName(), advancement.j()}), ChatMessageType.SYSTEM, SystemUtils.NIL_UUID);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/CustomFunctionData.java
|
||||
+++ b/net/minecraft/server/CustomFunctionData.java
|
||||
@@ -36,7 +36,7 @@
|
||||
@@ -44,7 +44,7 @@
|
||||
}
|
||||
|
||||
public CommandDispatcher<CommandListenerWrapper> getCommandDispatcher() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/DispenserRegistry.java
|
||||
+++ b/net/minecraft/server/DispenserRegistry.java
|
||||
@@ -26,6 +26,12 @@
|
||||
@@ -28,6 +28,12 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -12,8 +12,32 @@
|
||||
+
|
||||
public class DispenserRegistry {
|
||||
|
||||
public static final PrintStream a = System.out;
|
||||
@@ -50,6 +56,69 @@
|
||||
public static final PrintStream STDOUT = System.out;
|
||||
@@ -38,6 +44,23 @@
|
||||
|
||||
public static void init() {
|
||||
if (!DispenserRegistry.isBootstrapped) {
|
||||
+ // CraftBukkit start
|
||||
+ String name = DispenserRegistry.class.getSimpleName();
|
||||
+ switch (name) {
|
||||
+ case "DispenserRegistry":
|
||||
+ break;
|
||||
+ case "Bootstrap":
|
||||
+ System.err.println("***************************************************************************");
|
||||
+ System.err.println("*** WARNING: This server jar may only be used for development purposes. ***");
|
||||
+ System.err.println("***************************************************************************");
|
||||
+ break;
|
||||
+ default:
|
||||
+ System.err.println("**********************************************************************");
|
||||
+ System.err.println("*** WARNING: This server jar is unsupported, use at your own risk. ***");
|
||||
+ System.err.println("**********************************************************************");
|
||||
+ break;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
DispenserRegistry.isBootstrapped = true;
|
||||
if (IRegistry.REGISTRY.keySet().isEmpty()) {
|
||||
throw new IllegalStateException("Unable to load registries");
|
||||
@@ -55,6 +78,69 @@
|
||||
TagStatic.b();
|
||||
d();
|
||||
}
|
||||
@@ -34,51 +58,51 @@
|
||||
+ DataConverterFlattenData.map(1021, "{Name:'minecraft:oak_sign',Properties:{rotation:'13'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'13'}}");
|
||||
+ DataConverterFlattenData.map(1022, "{Name:'minecraft:oak_sign',Properties:{rotation:'14'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'14'}}");
|
||||
+ DataConverterFlattenData.map(1023, "{Name:'minecraft:oak_sign',Properties:{rotation:'15'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'15'}}");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(323, "minecraft:oak_sign");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(323, "minecraft:oak_sign");
|
||||
+
|
||||
+ DataConverterFlattenData.map(1440, "{Name:\'minecraft:portal\',Properties:{axis:\'x\'}}", new String[]{"{Name:\'minecraft:portal\',Properties:{axis:\'x\'}}"});
|
||||
+
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(409, "minecraft:prismarine_shard");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(410, "minecraft:prismarine_crystals");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(411, "minecraft:rabbit");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(412, "minecraft:cooked_rabbit");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(413, "minecraft:rabbit_stew");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(414, "minecraft:rabbit_foot");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(415, "minecraft:rabbit_hide");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(416, "minecraft:armor_stand");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(409, "minecraft:prismarine_shard");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(410, "minecraft:prismarine_crystals");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(411, "minecraft:rabbit");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(412, "minecraft:cooked_rabbit");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(413, "minecraft:rabbit_stew");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(414, "minecraft:rabbit_foot");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(415, "minecraft:rabbit_hide");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(416, "minecraft:armor_stand");
|
||||
+
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(423, "minecraft:mutton");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(424, "minecraft:cooked_mutton");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(425, "minecraft:banner");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(426, "minecraft:end_crystal");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(427, "minecraft:spruce_door");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(428, "minecraft:birch_door");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(429, "minecraft:jungle_door");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(430, "minecraft:acacia_door");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(431, "minecraft:dark_oak_door");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(432, "minecraft:chorus_fruit");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(433, "minecraft:chorus_fruit_popped");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(434, "minecraft:beetroot");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(435, "minecraft:beetroot_seeds");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(436, "minecraft:beetroot_soup");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(437, "minecraft:dragon_breath");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(438, "minecraft:splash_potion");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(439, "minecraft:spectral_arrow");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(440, "minecraft:tipped_arrow");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(441, "minecraft:lingering_potion");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(442, "minecraft:shield");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(443, "minecraft:elytra");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(444, "minecraft:spruce_boat");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(445, "minecraft:birch_boat");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(446, "minecraft:jungle_boat");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(447, "minecraft:acacia_boat");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(448, "minecraft:dark_oak_boat");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(449, "minecraft:totem_of_undying");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(450, "minecraft:shulker_shell");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(452, "minecraft:iron_nugget");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(453, "minecraft:knowledge_book");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(423, "minecraft:mutton");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(424, "minecraft:cooked_mutton");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(425, "minecraft:banner");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(426, "minecraft:end_crystal");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(427, "minecraft:spruce_door");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(428, "minecraft:birch_door");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(429, "minecraft:jungle_door");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(430, "minecraft:acacia_door");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(431, "minecraft:dark_oak_door");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(432, "minecraft:chorus_fruit");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(433, "minecraft:chorus_fruit_popped");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(434, "minecraft:beetroot");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(435, "minecraft:beetroot_seeds");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(436, "minecraft:beetroot_soup");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(437, "minecraft:dragon_breath");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(438, "minecraft:splash_potion");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(439, "minecraft:spectral_arrow");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(440, "minecraft:tipped_arrow");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(441, "minecraft:lingering_potion");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(442, "minecraft:shield");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(443, "minecraft:elytra");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(444, "minecraft:spruce_boat");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(445, "minecraft:birch_boat");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(446, "minecraft:jungle_boat");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(447, "minecraft:acacia_boat");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(448, "minecraft:dark_oak_boat");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(449, "minecraft:totem_of_undying");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(450, "minecraft:shulker_shell");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(452, "minecraft:iron_nugget");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(453, "minecraft:knowledge_book");
|
||||
+
|
||||
+ DataConverterSpawnEgg.ID_MAPPING[23] = "Arrow";
|
||||
+ DataConverterSpawnEgg.ID_TO_ENTITY[23] = "Arrow";
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/Main.java
|
||||
+++ b/net/minecraft/server/Main.java
|
||||
@@ -54,13 +54,20 @@
|
||||
@@ -58,6 +58,12 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -13,16 +13,18 @@
|
||||
public class Main {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
@@ -65,8 +71,9 @@
|
||||
public Main() {}
|
||||
|
||||
@DontObfuscate
|
||||
- public static void main(String[] astring) {
|
||||
+ public static void main(final OptionSet optionset) { // CraftBukkit - replaces main(String[] astring)
|
||||
SharedConstants.a();
|
||||
+ /* CraftBukkit start - Replace everything
|
||||
OptionParser optionparser = new OptionParser();
|
||||
OptionSpec<Void> optionspec = optionparser.accepts("nogui");
|
||||
OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
|
||||
@@ -84,21 +91,23 @@
|
||||
@@ -90,20 +97,22 @@
|
||||
optionparser.printHelpOn(System.err);
|
||||
return;
|
||||
}
|
||||
@@ -33,26 +35,21 @@
|
||||
DispenserRegistry.init();
|
||||
DispenserRegistry.c();
|
||||
SystemUtils.l();
|
||||
IRegistryCustom.Dimension iregistrycustom_dimension = IRegistryCustom.b();
|
||||
- Path path = Paths.get("server.properties");
|
||||
- DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(iregistrycustom_dimension, path);
|
||||
+ java.nio.file.Path java_nio_file_path = Paths.get("server.properties");
|
||||
+ DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(iregistrycustom_dimension, optionset); // CraftBukkit - CLI argument support
|
||||
IRegistryCustom.Dimension iregistrycustom_dimension = IRegistryCustom.a();
|
||||
Path path = Paths.get("server.properties");
|
||||
- DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(path);
|
||||
+ DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support
|
||||
|
||||
dedicatedserversettings.save();
|
||||
- Path path1 = Paths.get("eula.txt");
|
||||
- EULA eula = new EULA(path1);
|
||||
+ java.nio.file.Path java_nio_file_path1 = Paths.get("eula.txt");
|
||||
+ EULA eula = new EULA(java_nio_file_path1);
|
||||
Path path1 = Paths.get("eula.txt");
|
||||
EULA eula = new EULA(path1);
|
||||
|
||||
- if (optionset.has(optionspec1)) {
|
||||
- Main.LOGGER.info("Initialized '{}' and '{}'", path.toAbsolutePath(), path1.toAbsolutePath());
|
||||
+ if (optionset.has("initSettings")) { // CraftBukkit
|
||||
+ Main.LOGGER.info("Initialized '{}' and '{}'", java_nio_file_path.toAbsolutePath(), java_nio_file_path1.toAbsolutePath());
|
||||
Main.LOGGER.info("Initialized '{}' and '{}'", path.toAbsolutePath(), path1.toAbsolutePath());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -107,24 +116,42 @@
|
||||
@@ -113,14 +122,15 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -61,15 +58,19 @@
|
||||
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Proxy.NO_PROXY);
|
||||
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
|
||||
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
|
||||
UserCache usercache = new UserCache(gameprofilerepository, new File(file, MinecraftServer.b.getName()));
|
||||
- String s = (String) Optional.ofNullable(optionset.valueOf(optionspec10)).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
UserCache usercache = new UserCache(gameprofilerepository, new File(file, MinecraftServer.USERID_CACHE_FILE.getName()));
|
||||
- String s = (String) Optional.ofNullable((String) optionset.valueOf(optionspec10)).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
+ // CraftBukkit start
|
||||
+ String s = (String) Optional.ofNullable(optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
+ String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
Convertable convertable = Convertable.a(file.toPath());
|
||||
- Convertable.ConversionSession convertable_conversionsession = convertable.c(s);
|
||||
+ Convertable.ConversionSession convertable_conversionsession = convertable.c(s, WorldDimension.OVERWORLD);
|
||||
|
||||
MinecraftServer.convertWorld(convertable_conversionsession);
|
||||
WorldInfo worldinfo = convertable_conversionsession.d();
|
||||
@@ -131,13 +141,30 @@
|
||||
}
|
||||
|
||||
DataPackConfiguration datapackconfiguration = convertable_conversionsession.e();
|
||||
- boolean flag = optionset.has(optionspec6);
|
||||
+ boolean flag = optionset.has("safeMode");
|
||||
@@ -78,9 +79,9 @@
|
||||
Main.LOGGER.warn("Safe mode active, only vanilla datapack will be loaded");
|
||||
}
|
||||
|
||||
ResourcePackRepository resourcepackrepository = new ResourcePackRepository(new ResourcePackSource[]{new ResourcePackSourceVanilla(), new ResourcePackSourceFolder(convertable_conversionsession.getWorldFolder(SavedFile.DATAPACKS).toFile(), PackSource.c)});
|
||||
ResourcePackRepository resourcepackrepository = new ResourcePackRepository(EnumResourcePackType.SERVER_DATA, new ResourcePackSource[]{new ResourcePackSourceVanilla(), new ResourcePackSourceFolder(convertable_conversionsession.getWorldFolder(SavedFile.DATAPACK_DIR).toFile(), PackSource.WORLD)});
|
||||
+ // CraftBukkit start
|
||||
+ File bukkitDataPackFolder = new File(convertable_conversionsession.getWorldFolder(SavedFile.DATAPACKS).toFile(), "bukkit");
|
||||
+ File bukkitDataPackFolder = new File(convertable_conversionsession.getWorldFolder(SavedFile.DATAPACK_DIR).toFile(), "bukkit");
|
||||
+ if (!bukkitDataPackFolder.exists()) {
|
||||
+ bukkitDataPackFolder.mkdirs();
|
||||
+ }
|
||||
@@ -96,18 +97,18 @@
|
||||
+ throw new RuntimeException("Could not initialize Bukkit datapack", ex);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
DataPackConfiguration datapackconfiguration1 = MinecraftServer.a(resourcepackrepository, datapackconfiguration == null ? DataPackConfiguration.a : datapackconfiguration, flag);
|
||||
CompletableFuture completablefuture = DataPackResources.a(resourcepackrepository.f(), CommandDispatcher.ServerType.DEDICATED, dedicatedserversettings.getProperties().functionPermissionLevel, SystemUtils.f(), Runnable::run);
|
||||
DataPackConfiguration datapackconfiguration1 = MinecraftServer.a(resourcepackrepository, datapackconfiguration == null ? DataPackConfiguration.DEFAULT : datapackconfiguration, flag);
|
||||
CompletableFuture completablefuture = DataPackResources.a(resourcepackrepository.f(), iregistrycustom_dimension, CommandDispatcher.ServerType.DEDICATED, dedicatedserversettings.getProperties().functionPermissionLevel, SystemUtils.f(), Runnable::run);
|
||||
|
||||
@@ -139,6 +166,7 @@
|
||||
@@ -152,6 +179,7 @@
|
||||
}
|
||||
|
||||
datapackresources.i();
|
||||
datapackresources.j();
|
||||
+ /*
|
||||
RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.a, datapackresources.h(), iregistrycustom_dimension);
|
||||
Object object = convertable_conversionsession.a((DynamicOps) registryreadops, datapackconfiguration1);
|
||||
RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.INSTANCE, datapackresources.i(), (IRegistryCustom) iregistrycustom_dimension);
|
||||
|
||||
@@ -166,21 +194,32 @@
|
||||
dedicatedserversettings.getProperties().a((IRegistryCustom) iregistrycustom_dimension);
|
||||
@@ -181,21 +209,32 @@
|
||||
}
|
||||
|
||||
convertable_conversionsession.a((IRegistryCustom) iregistrycustom_dimension, (SaveData) object);
|
||||
@@ -126,7 +127,7 @@
|
||||
+ boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui");
|
||||
|
||||
if (flag1 && !GraphicsEnvironment.isHeadless()) {
|
||||
dedicatedserver1.bd();
|
||||
dedicatedserver1.bi();
|
||||
}
|
||||
|
||||
+ if (optionset.has("port")) {
|
||||
@@ -142,7 +143,7 @@
|
||||
Thread thread = new Thread("Server Shutdown Thread") {
|
||||
public void run() {
|
||||
dedicatedserver.safeShutdown(true);
|
||||
@@ -189,14 +228,15 @@
|
||||
@@ -204,14 +243,15 @@
|
||||
|
||||
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER));
|
||||
Runtime.getRuntime().addShutdownHook(thread);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -155,6 +155,25 @@
|
||||
@@ -166,6 +166,25 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable {
|
||||
|
||||
public static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -224,6 +243,20 @@
|
||||
private final DefinedStructureManager ak;
|
||||
protected SaveData saveData;
|
||||
@@ -258,6 +277,20 @@
|
||||
private final DefinedStructureManager structureManager;
|
||||
protected SaveData worldData;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public DataPackConfiguration datapackconfiguration;
|
||||
@@ -47,7 +47,7 @@
|
||||
public static <S extends MinecraftServer> S a(Function<Thread, S> function) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
Thread thread = new Thread(() -> {
|
||||
@@ -233,21 +266,21 @@
|
||||
@@ -267,14 +300,14 @@
|
||||
thread.setUncaughtExceptionHandler((thread1, throwable) -> {
|
||||
MinecraftServer.LOGGER.error(throwable);
|
||||
});
|
||||
@@ -59,27 +59,28 @@
|
||||
return s0;
|
||||
}
|
||||
|
||||
- public MinecraftServer(Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
+ public MinecraftServer(OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
- public MinecraftServer(Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
+ public MinecraftServer(OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
super("Server");
|
||||
this.m = new GameProfilerSwitcher(SystemUtils.a, this::ai);
|
||||
this.methodProfiler = GameProfilerDisabled.a;
|
||||
this.serverPing = new ServerPing();
|
||||
this.r = new Random();
|
||||
this.serverPort = -1;
|
||||
- this.worldServer = Maps.newLinkedHashMap();
|
||||
+ this.worldServer = Maps.newLinkedHashMap(); // CraftBukkit - keep order, k+v already use identity methods
|
||||
this.isRunning = true;
|
||||
this.h = new long[100];
|
||||
this.K = "";
|
||||
@@ -273,7 +306,34 @@
|
||||
this.ak = new DefinedStructureManager(datapackresources.h(), convertable_conversionsession, datafixer);
|
||||
this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
|
||||
this.profiler = this.metricsRecorder.e();
|
||||
@@ -286,7 +319,7 @@
|
||||
this.status = new ServerPing();
|
||||
this.random = new Random();
|
||||
this.port = -1;
|
||||
- this.levels = Maps.newLinkedHashMap();
|
||||
+ this.levels = Maps.newLinkedHashMap(); // CraftBukkit - keep order, k+v already use identity methods
|
||||
this.running = true;
|
||||
this.tickTimes = new long[100];
|
||||
this.resourcePack = "";
|
||||
@@ -316,13 +349,40 @@
|
||||
this.structureManager = new DefinedStructureManager(datapackresources.i(), convertable_conversionsession, datafixer);
|
||||
this.serverThread = thread;
|
||||
this.executorService = SystemUtils.f();
|
||||
this.executor = SystemUtils.f();
|
||||
+ // CraftBukkit start
|
||||
+ this.options = options;
|
||||
+ this.datapackconfiguration = datapackconfiguration;
|
||||
+ this.vanillaCommandDispatcher = datapackresources.commandDispatcher; // CraftBukkit
|
||||
+ this.vanillaCommandDispatcher = datapackresources.commands; // CraftBukkit
|
||||
+ // Try to see if we're actually running in a terminal, disable jline if not
|
||||
+ if (System.console() == null && System.getProperty("jline.terminal") == null) {
|
||||
+ System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
|
||||
@@ -106,42 +107,49 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
private void initializeScoreboards(WorldPersistentData worldpersistentdata) {
|
||||
PersistentScoreboard persistentscoreboard = (PersistentScoreboard) worldpersistentdata.a(PersistentScoreboard::new, "scoreboard");
|
||||
@@ -286,7 +346,7 @@
|
||||
ScoreboardServer scoreboardserver = this.getScoreboard();
|
||||
|
||||
Objects.requireNonNull(scoreboardserver);
|
||||
- Function function = scoreboardserver::a;
|
||||
+ Function<net.minecraft.nbt.NBTTagCompound, net.minecraft.world.scores.PersistentScoreboard> function = scoreboardserver::a; // CraftBukkit - decompile error
|
||||
ScoreboardServer scoreboardserver1 = this.getScoreboard();
|
||||
|
||||
Objects.requireNonNull(scoreboardserver1);
|
||||
@@ -333,7 +393,7 @@
|
||||
|
||||
public static void convertWorld(Convertable.ConversionSession convertable_conversionsession) {
|
||||
if (convertable_conversionsession.isConvertable()) {
|
||||
- MinecraftServer.LOGGER.info("Converting map!");
|
||||
+ MinecraftServer.LOGGER.info("Converting map! {}", convertable_conversionsession.getLevelName()); // CraftBukkit
|
||||
convertable_conversionsession.convert(new IProgressUpdate() {
|
||||
private long a = SystemUtils.getMonotonicMillis();
|
||||
private long timeStamp = SystemUtils.getMonotonicMillis();
|
||||
|
||||
@@ -309,48 +369,197 @@
|
||||
@@ -362,48 +422,197 @@
|
||||
|
||||
}
|
||||
|
||||
- protected void loadWorld() {
|
||||
- this.loadResourcesZip();
|
||||
- this.saveData.a(this.getServerModName(), this.getModded().isPresent());
|
||||
- WorldLoadListener worldloadlistener = this.worldLoadListenerFactory.create(11);
|
||||
- this.worldData.a(this.getServerModName(), this.getModded().isPresent());
|
||||
- WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
|
||||
+ protected void loadWorld(String s) {
|
||||
+ // CraftBukkit start
|
||||
+ Convertable.ConversionSession worldSession = this.convertable;
|
||||
+ IRegistryCustom.Dimension iregistrycustom_dimension = this.customRegistry;
|
||||
+ RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.a, this.dataPackResources.h(), iregistrycustom_dimension);
|
||||
+ Convertable.ConversionSession worldSession = this.storageSource;
|
||||
+ IRegistryCustom.Dimension iregistrycustom_dimension = this.registryHolder;
|
||||
+ RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.INSTANCE, this.resources.i(), (IRegistryCustom) iregistrycustom_dimension);
|
||||
+ WorldDataServer overworldData = (WorldDataServer) worldSession.a((DynamicOps) registryreadops, datapackconfiguration);
|
||||
+ if (overworldData == null) {
|
||||
+ WorldSettings worldsettings;
|
||||
+ GeneratorSettings generatorsettings;
|
||||
+
|
||||
+ if (this.isDemoMode()) {
|
||||
+ worldsettings = MinecraftServer.c;
|
||||
+ worldsettings = MinecraftServer.DEMO_SETTINGS;
|
||||
+ generatorsettings = GeneratorSettings.a((IRegistryCustom) iregistrycustom_dimension);
|
||||
+ } else {
|
||||
+ DedicatedServerProperties dedicatedserverproperties = ((DedicatedServer) this).getDedicatedServerProperties();
|
||||
+
|
||||
+ worldsettings = new WorldSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(), datapackconfiguration);
|
||||
+ generatorsettings = options.has("bonusChest") ? dedicatedserverproperties.generatorSettings.j() : dedicatedserverproperties.generatorSettings;
|
||||
+ generatorsettings = options.has("bonusChest") ? dedicatedserverproperties.worldGenSettings.j() : dedicatedserverproperties.worldGenSettings;
|
||||
+ }
|
||||
+
|
||||
+ overworldData = new WorldDataServer(worldsettings, generatorsettings, Lifecycle.stable());
|
||||
@@ -156,13 +164,13 @@
|
||||
+ WorldServer world;
|
||||
+ int dimension = 0;
|
||||
+
|
||||
+ if (dimensionKey == WorldDimension.THE_NETHER) {
|
||||
+ if (dimensionKey == WorldDimension.NETHER) {
|
||||
+ if (getAllowNether()) {
|
||||
+ dimension = -1;
|
||||
+ } else {
|
||||
+ continue;
|
||||
+ }
|
||||
+ } else if (dimensionKey == WorldDimension.THE_END) {
|
||||
+ } else if (dimensionKey == WorldDimension.END) {
|
||||
+ if (server.getAllowEnd()) {
|
||||
+ dimension = 1;
|
||||
+ } else {
|
||||
@@ -225,13 +233,13 @@
|
||||
+ GeneratorSettings generatorsettings;
|
||||
+
|
||||
+ if (this.isDemoMode()) {
|
||||
+ worldsettings = MinecraftServer.c;
|
||||
+ worldsettings = MinecraftServer.DEMO_SETTINGS;
|
||||
+ generatorsettings = GeneratorSettings.a((IRegistryCustom) iregistrycustom_dimension);
|
||||
+ } else {
|
||||
+ DedicatedServerProperties dedicatedserverproperties = ((DedicatedServer) this).getDedicatedServerProperties();
|
||||
+
|
||||
+ worldsettings = new WorldSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(), datapackconfiguration);
|
||||
+ generatorsettings = options.has("bonusChest") ? dedicatedserverproperties.generatorSettings.j() : dedicatedserverproperties.generatorSettings;
|
||||
+ generatorsettings = options.has("bonusChest") ? dedicatedserverproperties.worldGenSettings.j() : dedicatedserverproperties.worldGenSettings;
|
||||
+ }
|
||||
+
|
||||
+ worlddata = new WorldDataServer(worldsettings, generatorsettings, Lifecycle.stable());
|
||||
@@ -241,7 +249,7 @@
|
||||
+ net.minecraft.server.Main.convertWorld(worldSession, DataConverterRegistry.a(), options.has("eraseCache"), () -> {
|
||||
+ return true;
|
||||
+ }, worlddata.getGeneratorSettings().d().d().stream().map((entry1) -> {
|
||||
+ return ResourceKey.a(IRegistry.K, ((ResourceKey) entry1.getKey()).a());
|
||||
+ return ResourceKey.a(IRegistry.DIMENSION_TYPE_REGISTRY, ((ResourceKey) entry1.getKey()).a());
|
||||
+ }).collect(ImmutableSet.toImmutableSet()));
|
||||
+ }
|
||||
+
|
||||
@@ -256,35 +264,35 @@
|
||||
+ ChunkGenerator chunkgenerator;
|
||||
+
|
||||
+ if (worlddimension == null) {
|
||||
+ dimensionmanager = (DimensionManager) this.customRegistry.a().d(DimensionManager.OVERWORLD);
|
||||
+ chunkgenerator = GeneratorSettings.a(customRegistry.b(IRegistry.ay), customRegistry.b(IRegistry.ar), (new Random()).nextLong());
|
||||
+ dimensionmanager = (DimensionManager) this.registryHolder.d(IRegistry.DIMENSION_TYPE_REGISTRY).d(DimensionManager.OVERWORLD_LOCATION);
|
||||
+ chunkgenerator = GeneratorSettings.a(this.registryHolder.d(IRegistry.BIOME_REGISTRY), this.registryHolder.d(IRegistry.NOISE_GENERATOR_SETTINGS_REGISTRY), (new Random()).nextLong());
|
||||
+ } else {
|
||||
+ dimensionmanager = worlddimension.b();
|
||||
+ chunkgenerator = worlddimension.c();
|
||||
+ }
|
||||
+
|
||||
+ ResourceKey<World> worldKey = ResourceKey.a(IRegistry.L, dimensionKey.a());
|
||||
+ ResourceKey<World> worldKey = ResourceKey.a(IRegistry.DIMENSION_REGISTRY, dimensionKey.a());
|
||||
+
|
||||
+ if (dimensionKey == WorldDimension.OVERWORLD) {
|
||||
+ this.saveData = worlddata;
|
||||
+ this.saveData.setGameType(((DedicatedServer) this).getDedicatedServerProperties().gamemode); // From DedicatedServer.init
|
||||
+ this.worldData = worlddata;
|
||||
+ this.worldData.setGameType(((DedicatedServer) this).getDedicatedServerProperties().gamemode); // From DedicatedServer.init
|
||||
+
|
||||
+ WorldLoadListener worldloadlistener = this.worldLoadListenerFactory.create(11);
|
||||
+ WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
|
||||
+
|
||||
+ world = new WorldServer(this, this.executorService, worldSession, iworlddataserver, worldKey, dimensionmanager, worldloadlistener, chunkgenerator, flag, j, list, true, org.bukkit.World.Environment.getEnvironment(dimension), gen);
|
||||
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, dimensionmanager, worldloadlistener, chunkgenerator, flag, j, list, true, org.bukkit.World.Environment.getEnvironment(dimension), gen);
|
||||
+ WorldPersistentData worldpersistentdata = world.getWorldPersistentData();
|
||||
+ this.initializeScoreboards(worldpersistentdata);
|
||||
+ this.server.scoreboardManager = new org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager(this, world.getScoreboard());
|
||||
+ this.persistentCommandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
+ this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
+ } else {
|
||||
+ WorldLoadListener worldloadlistener = this.worldLoadListenerFactory.create(11);
|
||||
+ world = new WorldServer(this, this.executorService, worldSession, iworlddataserver, worldKey, dimensionmanager, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), true, org.bukkit.World.Environment.getEnvironment(dimension), gen);
|
||||
+ WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
|
||||
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, dimensionmanager, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), true, org.bukkit.World.Environment.getEnvironment(dimension), gen);
|
||||
+ }
|
||||
+
|
||||
+ worlddata.a(this.getServerModName(), this.getModded().isPresent());
|
||||
+ this.initWorld(world, worlddata, saveData, worlddata.getGeneratorSettings());
|
||||
+ this.initWorld(world, worlddata, worldData, worlddata.getGeneratorSettings());
|
||||
+
|
||||
+ this.worldServer.put(world.getDimensionKey(), world);
|
||||
+ this.levels.put(world.getDimensionKey(), world);
|
||||
+ this.getPlayerList().setPlayerFileData(world);
|
||||
+
|
||||
+ if (worlddata.getCustomBossEvents() != null) {
|
||||
@@ -294,21 +302,21 @@
|
||||
this.updateWorldSettings();
|
||||
- this.loadSpawn(worldloadlistener);
|
||||
+ for (WorldServer worldserver : this.getWorlds()) {
|
||||
+ this.loadSpawn(worldserver.getChunkProvider().playerChunkMap.worldLoadListener, worldserver);
|
||||
+ this.loadSpawn(worldserver.getChunkProvider().chunkMap.progressListener, worldserver);
|
||||
+ this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
|
||||
+ }
|
||||
+
|
||||
+ this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
|
||||
+ this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
|
||||
+ this.serverConnection.acceptConnections();
|
||||
+ this.connection.acceptConnections();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
protected void updateWorldSettings() {}
|
||||
|
||||
- protected void a(WorldLoadListener worldloadlistener) {
|
||||
- IWorldDataServer iworlddataserver = this.saveData.H();
|
||||
- GeneratorSettings generatorsettings = this.saveData.getGeneratorSettings();
|
||||
- IWorldDataServer iworlddataserver = this.worldData.H();
|
||||
- GeneratorSettings generatorsettings = this.worldData.getGeneratorSettings();
|
||||
+ // CraftBukkit start
|
||||
+ public void initWorld(WorldServer worldserver, IWorldDataServer iworlddataserver, SaveData saveData, GeneratorSettings generatorsettings) {
|
||||
boolean flag = generatorsettings.isDebugWorld();
|
||||
@@ -321,8 +329,8 @@
|
||||
- Object object;
|
||||
-
|
||||
- if (worlddimension == null) {
|
||||
- dimensionmanager = (DimensionManager) this.customRegistry.a().d(DimensionManager.OVERWORLD);
|
||||
- object = GeneratorSettings.a(this.customRegistry.b(IRegistry.ay), this.customRegistry.b(IRegistry.ar), (new Random()).nextLong());
|
||||
- dimensionmanager = (DimensionManager) this.registryHolder.d(IRegistry.DIMENSION_TYPE_REGISTRY).d(DimensionManager.OVERWORLD_LOCATION);
|
||||
- object = GeneratorSettings.a(this.registryHolder.d(IRegistry.BIOME_REGISTRY), this.registryHolder.d(IRegistry.NOISE_GENERATOR_SETTINGS_REGISTRY), (new Random()).nextLong());
|
||||
- } else {
|
||||
- dimensionmanager = worlddimension.b();
|
||||
- object = worlddimension.c();
|
||||
@@ -331,28 +339,28 @@
|
||||
+ worldserver.getWorld().getPopulators().addAll(worldserver.generator.getDefaultPopulators(worldserver.getWorld()));
|
||||
}
|
||||
-
|
||||
- WorldServer worldserver = new WorldServer(this, this.executorService, this.convertable, iworlddataserver, World.OVERWORLD, dimensionmanager, worldloadlistener, (ChunkGenerator) object, flag, j, list, true);
|
||||
- WorldServer worldserver = new WorldServer(this, this.executor, this.storageSource, iworlddataserver, World.OVERWORLD, dimensionmanager, worldloadlistener, (ChunkGenerator) object, flag, j, list, true);
|
||||
-
|
||||
- this.worldServer.put(World.OVERWORLD, worldserver);
|
||||
- this.levels.put(World.OVERWORLD, worldserver);
|
||||
- WorldPersistentData worldpersistentdata = worldserver.getWorldPersistentData();
|
||||
-
|
||||
- this.initializeScoreboards(worldpersistentdata);
|
||||
- this.persistentCommandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
- this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
WorldBorder worldborder = worldserver.getWorldBorder();
|
||||
|
||||
worldborder.a(iworlddataserver.r());
|
||||
+ this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldInitEvent(worldserver.getWorld())); // CraftBukkit - SPIGOT-5569
|
||||
if (!iworlddataserver.p()) {
|
||||
try {
|
||||
a(worldserver, iworlddataserver, generatorsettings.c(), flag, true);
|
||||
@@ -372,31 +581,8 @@
|
||||
a(worldserver, iworlddataserver, generatorsettings.c(), flag);
|
||||
@@ -425,31 +634,8 @@
|
||||
|
||||
iworlddataserver.c(true);
|
||||
}
|
||||
-
|
||||
- this.getPlayerList().setPlayerFileData(worldserver);
|
||||
- if (this.saveData.getCustomBossEvents() != null) {
|
||||
- this.getBossBattleCustomData().load(this.saveData.getCustomBossEvents());
|
||||
- if (this.worldData.getCustomBossEvents() != null) {
|
||||
- this.getBossBattleCustomData().load(this.worldData.getCustomBossEvents());
|
||||
- }
|
||||
-
|
||||
- Iterator iterator = registrymaterials.d().iterator();
|
||||
@@ -362,23 +370,23 @@
|
||||
- ResourceKey<WorldDimension> resourcekey = (ResourceKey) entry.getKey();
|
||||
-
|
||||
- if (resourcekey != WorldDimension.OVERWORLD) {
|
||||
- ResourceKey<World> resourcekey1 = ResourceKey.a(IRegistry.L, resourcekey.a());
|
||||
- ResourceKey<World> resourcekey1 = ResourceKey.a(IRegistry.DIMENSION_REGISTRY, resourcekey.a());
|
||||
- DimensionManager dimensionmanager1 = ((WorldDimension) entry.getValue()).b();
|
||||
- ChunkGenerator chunkgenerator = ((WorldDimension) entry.getValue()).c();
|
||||
- SecondaryWorldData secondaryworlddata = new SecondaryWorldData(this.saveData, iworlddataserver);
|
||||
- WorldServer worldserver1 = new WorldServer(this, this.executorService, this.convertable, secondaryworlddata, resourcekey1, dimensionmanager1, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), false);
|
||||
- SecondaryWorldData secondaryworlddata = new SecondaryWorldData(this.worldData, iworlddataserver);
|
||||
- WorldServer worldserver1 = new WorldServer(this, this.executor, this.storageSource, secondaryworlddata, resourcekey1, dimensionmanager1, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), false);
|
||||
-
|
||||
- worldborder.a((IWorldBorderListener) (new IWorldBorderListener.a(worldserver1.getWorldBorder())));
|
||||
- this.worldServer.put(resourcekey1, worldserver1);
|
||||
- this.levels.put(resourcekey1, worldserver1);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
private static void a(WorldServer worldserver, IWorldDataServer iworlddataserver, boolean flag, boolean flag1, boolean flag2) {
|
||||
ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator();
|
||||
@@ -412,6 +598,21 @@
|
||||
private static void a(WorldServer worldserver, IWorldDataServer iworlddataserver, boolean flag, boolean flag1) {
|
||||
if (flag1) {
|
||||
@@ -462,6 +648,21 @@
|
||||
return biomebase.b().b();
|
||||
}, random);
|
||||
ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition);
|
||||
@@ -400,60 +408,58 @@
|
||||
|
||||
if (blockposition == null) {
|
||||
MinecraftServer.LOGGER.warn("Unable to find spawn biome");
|
||||
@@ -478,8 +679,15 @@
|
||||
@@ -536,8 +737,15 @@
|
||||
iworlddataserver.setGameType(EnumGamemode.SPECTATOR);
|
||||
}
|
||||
|
||||
- public void loadSpawn(WorldLoadListener worldloadlistener) {
|
||||
- WorldServer worldserver = this.E();
|
||||
- WorldServer worldserver = this.F();
|
||||
+ // CraftBukkit start
|
||||
+ public void loadSpawn(WorldLoadListener worldloadlistener, WorldServer worldserver) {
|
||||
+ if (!worldserver.getWorld().getKeepSpawnInMemory()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // WorldServer worldserver = this.E();
|
||||
+ // WorldServer worldserver = this.F();
|
||||
+ this.forceTicks = true;
|
||||
+ // CraftBukkit end
|
||||
|
||||
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.getDimensionKey().a());
|
||||
BlockPosition blockposition = worldserver.getSpawn();
|
||||
@@ -492,17 +700,21 @@
|
||||
@@ -550,16 +758,20 @@
|
||||
chunkproviderserver.addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
|
||||
|
||||
while (chunkproviderserver.b() != 441) {
|
||||
- this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
|
||||
- this.nextTickTime = SystemUtils.getMonotonicMillis() + 10L;
|
||||
- this.sleepForTick();
|
||||
+ // CraftBukkit start
|
||||
+ // this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
|
||||
+ // this.nextTickTime = SystemUtils.getMonotonicMillis() + 10L;
|
||||
+ this.executeModerately();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
- this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
|
||||
- this.nextTickTime = SystemUtils.getMonotonicMillis() + 10L;
|
||||
- this.sleepForTick();
|
||||
- Iterator iterator = this.worldServer.values().iterator();
|
||||
- Iterator iterator = this.levels.values().iterator();
|
||||
-
|
||||
- while (iterator.hasNext()) {
|
||||
- WorldServer worldserver1 = (WorldServer) iterator.next();
|
||||
- ForcedChunk forcedchunk = (ForcedChunk) worldserver1.getWorldPersistentData().b(ForcedChunk::new, "chunks");
|
||||
+ // CraftBukkit start
|
||||
+ // this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
|
||||
+ // this.nextTickTime = SystemUtils.getMonotonicMillis() + 10L;
|
||||
+ this.executeModerately();
|
||||
+ // Iterator iterator = this.worldServer.values().iterator();
|
||||
+
|
||||
+ if (true) {
|
||||
+ WorldServer worldserver1 = worldserver;
|
||||
+ ForcedChunk forcedchunk = (ForcedChunk) worldserver.getWorldPersistentData().b(ForcedChunk::new, "chunks");
|
||||
+ // CraftBukkit end
|
||||
ForcedChunk forcedchunk = (ForcedChunk) worldserver1.getWorldPersistentData().a(ForcedChunk::b, "chunks");
|
||||
|
||||
if (forcedchunk != null) {
|
||||
LongIterator longiterator = forcedchunk.a().iterator();
|
||||
@@ -516,11 +728,18 @@
|
||||
@@ -574,11 +786,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
|
||||
- this.nextTickTime = SystemUtils.getMonotonicMillis() + 10L;
|
||||
- this.sleepForTick();
|
||||
+ // CraftBukkit start
|
||||
+ // this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
|
||||
@@ -471,24 +477,24 @@
|
||||
}
|
||||
|
||||
protected void loadResourcesZip() {
|
||||
@@ -565,12 +784,16 @@
|
||||
worldserver.save((IProgressUpdate) null, flag1, worldserver.savingDisabled && !flag2);
|
||||
@@ -623,12 +842,16 @@
|
||||
worldserver.save((IProgressUpdate) null, flag1, worldserver.noSave && !flag2);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - moved to WorldServer.save
|
||||
+ /*
|
||||
WorldServer worldserver1 = this.E();
|
||||
IWorldDataServer iworlddataserver = this.saveData.H();
|
||||
WorldServer worldserver1 = this.F();
|
||||
IWorldDataServer iworlddataserver = this.worldData.H();
|
||||
|
||||
iworlddataserver.a(worldserver1.getWorldBorder().t());
|
||||
this.saveData.setCustomBossEvents(this.getBossBattleCustomData().save());
|
||||
this.convertable.a(this.customRegistry, this.saveData, this.getPlayerList().save());
|
||||
this.worldData.setCustomBossEvents(this.getBossBattleCustomData().save());
|
||||
this.storageSource.a(this.registryHolder, this.worldData, this.getPlayerList().save());
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
return flag3;
|
||||
}
|
||||
|
||||
@@ -579,8 +802,29 @@
|
||||
@@ -637,8 +860,29 @@
|
||||
this.stop();
|
||||
}
|
||||
|
||||
@@ -502,7 +508,7 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
protected void stop() {
|
||||
public void stop() {
|
||||
+ // CraftBukkit start - prevent double stopping on multiple threads
|
||||
+ synchronized(stopLock) {
|
||||
+ if (hasStopped) return;
|
||||
@@ -518,7 +524,7 @@
|
||||
if (this.getServerConnection() != null) {
|
||||
this.getServerConnection().b();
|
||||
}
|
||||
@@ -589,6 +833,7 @@
|
||||
@@ -647,6 +891,7 @@
|
||||
MinecraftServer.LOGGER.info("Saving players");
|
||||
this.playerList.savePlayers();
|
||||
this.playerList.shutdown();
|
||||
@@ -526,25 +532,27 @@
|
||||
}
|
||||
|
||||
MinecraftServer.LOGGER.info("Saving worlds");
|
||||
@@ -666,14 +911,16 @@
|
||||
while (this.isRunning) {
|
||||
long i = SystemUtils.getMonotonicMillis() - this.nextTick;
|
||||
@@ -724,9 +969,10 @@
|
||||
while (this.running) {
|
||||
long i = SystemUtils.getMonotonicMillis() - this.nextTickTime;
|
||||
|
||||
- if (i > 2000L && this.nextTick - this.lastOverloadTime >= 15000L) {
|
||||
+ if (i > 5000L && this.nextTick - this.lastOverloadTime >= 30000L) { // CraftBukkit
|
||||
- if (i > 2000L && this.nextTickTime - this.lastOverloadWarning >= 15000L) {
|
||||
+ if (i > 5000L && this.nextTickTime - this.lastOverloadWarning >= 30000L) { // CraftBukkit
|
||||
long j = i / 50L;
|
||||
|
||||
+ if (server.getWarnOnOverload()) // CraftBukkit
|
||||
MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j);
|
||||
this.nextTick += j * 50L;
|
||||
this.lastOverloadTime = this.nextTick;
|
||||
this.nextTickTime += j * 50L;
|
||||
this.lastOverloadWarning = this.nextTickTime;
|
||||
@@ -737,6 +983,7 @@
|
||||
this.debugCommandProfiler = new MinecraftServer.a(SystemUtils.getMonotonicNanos(), this.tickCount);
|
||||
}
|
||||
|
||||
+ MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
||||
this.nextTick += 50L;
|
||||
GameProfilerTick gameprofilertick = GameProfilerTick.a("Server");
|
||||
|
||||
@@ -719,6 +966,12 @@
|
||||
this.nextTickTime += 50L;
|
||||
this.bi();
|
||||
this.profiler.enter("tick");
|
||||
@@ -782,6 +1029,12 @@
|
||||
} catch (Throwable throwable1) {
|
||||
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
|
||||
} finally {
|
||||
@@ -557,13 +565,13 @@
|
||||
this.exit();
|
||||
}
|
||||
|
||||
@@ -727,8 +980,15 @@
|
||||
@@ -790,8 +1043,15 @@
|
||||
}
|
||||
|
||||
private boolean canSleepForTick() {
|
||||
- return this.isEntered() || SystemUtils.getMonotonicMillis() < (this.X ? this.W : this.nextTick);
|
||||
- return this.isEntered() || SystemUtils.getMonotonicMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime);
|
||||
+ // CraftBukkit start
|
||||
+ return this.forceTicks || this.isEntered() || SystemUtils.getMonotonicMillis() < (this.X ? this.W : this.nextTick);
|
||||
+ return this.forceTicks || this.isEntered() || SystemUtils.getMonotonicMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime);
|
||||
+ }
|
||||
+
|
||||
+ private void executeModerately() {
|
||||
@@ -574,23 +582,23 @@
|
||||
|
||||
protected void sleepForTick() {
|
||||
this.executeAll();
|
||||
@@ -834,7 +1094,7 @@
|
||||
this.serverPing.b().a(agameprofile);
|
||||
@@ -906,7 +1166,7 @@
|
||||
this.status.b().a(agameprofile);
|
||||
}
|
||||
|
||||
- if (this.ticks % 6000 == 0) {
|
||||
+ if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit
|
||||
- if (this.tickCount % 6000 == 0) {
|
||||
+ if (autosavePeriod > 0 && this.tickCount % autosavePeriod == 0) { // CraftBukkit
|
||||
MinecraftServer.LOGGER.debug("Autosave started");
|
||||
this.methodProfiler.enter("save");
|
||||
this.profiler.enter("save");
|
||||
this.playerList.savePlayers();
|
||||
@@ -864,22 +1124,39 @@
|
||||
@@ -936,22 +1196,39 @@
|
||||
}
|
||||
|
||||
protected void b(BooleanSupplier booleansupplier) {
|
||||
+ this.server.getScheduler().mainThreadHeartbeat(this.ticks); // CraftBukkit
|
||||
this.methodProfiler.enter("commandFunctions");
|
||||
public void b(BooleanSupplier booleansupplier) {
|
||||
+ this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit
|
||||
this.profiler.enter("commandFunctions");
|
||||
this.getFunctionData().tick();
|
||||
this.methodProfiler.exitEnter("levels");
|
||||
this.profiler.exitEnter("levels");
|
||||
Iterator iterator = this.getWorlds().iterator();
|
||||
|
||||
+ // CraftBukkit start
|
||||
@@ -600,59 +608,59 @@
|
||||
+ }
|
||||
+
|
||||
+ // Send time updates to everyone, it will get the right time from the world the player is in.
|
||||
+ if (this.ticks % 20 == 0) {
|
||||
+ if (this.tickCount % 20 == 0) {
|
||||
+ for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
|
||||
+ EntityPlayer entityplayer = (EntityPlayer) this.getPlayerList().players.get(i);
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE))); // Add support for per player time
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.level.getTime(), entityplayer.getPlayerTime(), entityplayer.level.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
while (iterator.hasNext()) {
|
||||
WorldServer worldserver = (WorldServer) iterator.next();
|
||||
|
||||
this.methodProfiler.a(() -> {
|
||||
this.profiler.a(() -> {
|
||||
return worldserver + " " + worldserver.getDimensionKey().a();
|
||||
});
|
||||
+ /* Drop global time updates
|
||||
if (this.ticks % 20 == 0) {
|
||||
this.methodProfiler.enter("timeSync");
|
||||
this.playerList.a((Packet) (new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE))), worldserver.getDimensionKey());
|
||||
this.methodProfiler.exit();
|
||||
if (this.tickCount % 20 == 0) {
|
||||
this.profiler.enter("timeSync");
|
||||
this.playerList.a((Packet) (new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))), worldserver.getDimensionKey());
|
||||
this.profiler.exit();
|
||||
}
|
||||
+ // CraftBukkit end */
|
||||
|
||||
this.methodProfiler.enter("tick");
|
||||
this.profiler.enter("tick");
|
||||
|
||||
@@ -963,7 +1240,7 @@
|
||||
}
|
||||
@@ -1040,7 +1317,7 @@
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
- return "vanilla";
|
||||
+ return server.getName(); // CraftBukkit - cb > vanilla!
|
||||
}
|
||||
|
||||
public CrashReport b(CrashReport crashreport) {
|
||||
@@ -1320,16 +1597,17 @@
|
||||
public SystemReport b(SystemReport systemreport) {
|
||||
@@ -1412,16 +1689,17 @@
|
||||
|
||||
public CompletableFuture<Void> a(Collection<String> collection) {
|
||||
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
|
||||
- Stream stream = collection.stream();
|
||||
+ Stream<String> stream = collection.stream(); // CraftBukkit - decompile error
|
||||
ResourcePackRepository resourcepackrepository = this.resourcePackRepository;
|
||||
ResourcePackRepository resourcepackrepository = this.packRepository;
|
||||
|
||||
this.resourcePackRepository.getClass();
|
||||
Objects.requireNonNull(this.packRepository);
|
||||
- return (ImmutableList) stream.map(resourcepackrepository::a).filter(Objects::nonNull).map(ResourcePackLoader::d).collect(ImmutableList.toImmutableList());
|
||||
+ return stream.map(resourcepackrepository::a).filter(Objects::nonNull).map(ResourcePackLoader::d).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error
|
||||
}, this).thenCompose((immutablelist) -> {
|
||||
return DataPackResources.a(immutablelist, this.j() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.h(), this.executorService, this);
|
||||
return DataPackResources.a(immutablelist, this.registryHolder, this.k() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.i(), this.executor, this);
|
||||
}).thenAcceptAsync((datapackresources) -> {
|
||||
this.dataPackResources.close();
|
||||
this.dataPackResources = datapackresources;
|
||||
this.resources.close();
|
||||
this.resources = datapackresources;
|
||||
+ this.server.syncCommands(); // SPIGOT-5884: Lost on reload
|
||||
this.resourcePackRepository.a(collection);
|
||||
this.saveData.a(a(this.resourcePackRepository));
|
||||
datapackresources.i();
|
||||
@@ -1695,6 +1973,22 @@
|
||||
this.packRepository.a(collection);
|
||||
this.worldData.a(a(this.packRepository));
|
||||
datapackresources.j();
|
||||
@@ -1766,6 +2044,22 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -672,6 +680,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
private void a(@Nullable GameProfilerTick gameprofilertick) {
|
||||
if (this.O) {
|
||||
this.O = false;
|
||||
private void bi() {
|
||||
if (this.willStartRecordingMetrics) {
|
||||
this.metricsRecorder = ActiveMetricsRecorder.a(new ServerMetricsSamplersProvider(SystemUtils.timeSource, this.k()), SystemUtils.timeSource, SystemUtils.g(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
|
||||
|
||||
@@ -1,100 +1,100 @@
|
||||
--- a/net/minecraft/server/ScoreboardServer.java
|
||||
+++ b/net/minecraft/server/ScoreboardServer.java
|
||||
@@ -32,7 +32,7 @@
|
||||
@@ -34,7 +34,7 @@
|
||||
public void handleScoreChanged(ScoreboardScore scoreboardscore) {
|
||||
super.handleScoreChanged(scoreboardscore);
|
||||
if (this.b.contains(scoreboardscore.getObjective())) {
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, scoreboardscore.getObjective().getName(), scoreboardscore.getPlayerName(), scoreboardscore.getScore()));
|
||||
if (this.trackedObjectives.contains(scoreboardscore.getObjective())) {
|
||||
- this.server.getPlayerList().sendAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, scoreboardscore.getObjective().getName(), scoreboardscore.getPlayerName(), scoreboardscore.getScore()));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, scoreboardscore.getObjective().getName(), scoreboardscore.getPlayerName(), scoreboardscore.getScore()));
|
||||
}
|
||||
|
||||
this.b();
|
||||
@@ -41,7 +41,7 @@
|
||||
this.a();
|
||||
@@ -43,7 +43,7 @@
|
||||
@Override
|
||||
public void handlePlayerRemoved(String s) {
|
||||
super.handlePlayerRemoved(s);
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, (String) null, s, 0));
|
||||
- this.server.getPlayerList().sendAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, (String) null, s, 0));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, (String) null, s, 0));
|
||||
this.b();
|
||||
this.a();
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
@@ -51,7 +51,7 @@
|
||||
public void a(String s, ScoreboardObjective scoreboardobjective) {
|
||||
super.a(s, scoreboardobjective);
|
||||
if (this.b.contains(scoreboardobjective)) {
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, scoreboardobjective.getName(), s, 0));
|
||||
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
||||
- this.server.getPlayerList().sendAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, scoreboardobjective.getName(), s, 0));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, scoreboardobjective.getName(), s, 0));
|
||||
}
|
||||
|
||||
this.b();
|
||||
@@ -62,7 +62,7 @@
|
||||
this.a();
|
||||
@@ -64,7 +64,7 @@
|
||||
super.setDisplaySlot(i, scoreboardobjective);
|
||||
if (scoreboardobjective1 != scoreboardobjective && scoreboardobjective1 != null) {
|
||||
if (this.h(scoreboardobjective1) > 0) {
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective));
|
||||
- this.server.getPlayerList().sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective));
|
||||
} else {
|
||||
this.g(scoreboardobjective1);
|
||||
}
|
||||
@@ -70,7 +70,7 @@
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
if (scoreboardobjective != null) {
|
||||
if (this.b.contains(scoreboardobjective)) {
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective));
|
||||
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
||||
- this.server.getPlayerList().sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective));
|
||||
} else {
|
||||
this.e(scoreboardobjective);
|
||||
}
|
||||
@@ -82,7 +82,7 @@
|
||||
@@ -84,7 +84,7 @@
|
||||
@Override
|
||||
public boolean addPlayerToTeam(String s, ScoreboardTeam scoreboardteam) {
|
||||
if (super.addPlayerToTeam(s, scoreboardteam)) {
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(s), 3));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(s), 3));
|
||||
this.b();
|
||||
- this.server.getPlayerList().sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.ADD));
|
||||
+ this.sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.ADD));
|
||||
this.a();
|
||||
return true;
|
||||
} else {
|
||||
@@ -93,7 +93,7 @@
|
||||
@@ -95,7 +95,7 @@
|
||||
@Override
|
||||
public void removePlayerFromTeam(String s, ScoreboardTeam scoreboardteam) {
|
||||
super.removePlayerFromTeam(s, scoreboardteam);
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(s), 4));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(s), 4));
|
||||
this.b();
|
||||
- this.server.getPlayerList().sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.REMOVE));
|
||||
+ this.sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.REMOVE));
|
||||
this.a();
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
@@ -109,7 +109,7 @@
|
||||
public void handleObjectiveChanged(ScoreboardObjective scoreboardobjective) {
|
||||
super.handleObjectiveChanged(scoreboardobjective);
|
||||
if (this.b.contains(scoreboardobjective)) {
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardObjective(scoreboardobjective, 2));
|
||||
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
||||
- this.server.getPlayerList().sendAll(new PacketPlayOutScoreboardObjective(scoreboardobjective, 2));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardObjective(scoreboardobjective, 2));
|
||||
}
|
||||
|
||||
this.b();
|
||||
@@ -126,21 +126,21 @@
|
||||
this.a();
|
||||
@@ -128,21 +128,21 @@
|
||||
@Override
|
||||
public void handleTeamAdded(ScoreboardTeam scoreboardteam) {
|
||||
super.handleTeamAdded(scoreboardteam);
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 0));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 0));
|
||||
this.b();
|
||||
- this.server.getPlayerList().sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam, true));
|
||||
+ this.sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam, true));
|
||||
this.a();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleTeamChanged(ScoreboardTeam scoreboardteam) {
|
||||
super.handleTeamChanged(scoreboardteam);
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 2));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 2));
|
||||
this.b();
|
||||
- this.server.getPlayerList().sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam, false));
|
||||
+ this.sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam, false));
|
||||
this.a();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleTeamRemoved(ScoreboardTeam scoreboardteam) {
|
||||
super.handleTeamRemoved(scoreboardteam);
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 1));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 1));
|
||||
this.b();
|
||||
- this.server.getPlayerList().sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam));
|
||||
+ this.sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam));
|
||||
this.a();
|
||||
}
|
||||
|
||||
@@ -189,6 +189,7 @@
|
||||
@@ -113,15 +113,15 @@
|
||||
Iterator iterator1 = list.iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
@@ -245,6 +247,16 @@
|
||||
return i;
|
||||
@@ -257,6 +259,16 @@
|
||||
return this.b().b(nbttagcompound);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Send to players
|
||||
+ private void sendAll(Packet packet) {
|
||||
+ for (EntityPlayer entityplayer : (List<EntityPlayer>) this.a.getPlayerList().players) {
|
||||
+ for (EntityPlayer entityplayer : (List<EntityPlayer>) this.server.getPlayerList().players) {
|
||||
+ if (entityplayer.getBukkitEntity().getScoreboard().getHandle() == this) {
|
||||
+ entityplayer.playerConnection.sendPacket(packet);
|
||||
+ entityplayer.connection.sendPacket(packet);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
+
|
||||
public class BossBattleCustom extends BossBattleServer {
|
||||
|
||||
private final MinecraftKey h;
|
||||
private final Set<UUID> i = Sets.newHashSet();
|
||||
private int j;
|
||||
private int k = 100;
|
||||
private final MinecraftKey id;
|
||||
private final Set<UUID> players = Sets.newHashSet();
|
||||
private int value;
|
||||
private int max = 100;
|
||||
+ // CraftBukkit start
|
||||
+ private KeyedBossBar bossBar;
|
||||
+
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/server/commands/CommandEffect.java
|
||||
+++ b/net/minecraft/server/commands/CommandEffect.java
|
||||
@@ -71,7 +71,7 @@
|
||||
@@ -73,7 +73,7 @@
|
||||
if (entity instanceof EntityLiving) {
|
||||
MobEffect mobeffect = new MobEffect(mobeffectlist, k, i, false, flag);
|
||||
|
||||
- if (((EntityLiving) entity).addEffect(mobeffect)) {
|
||||
+ if (((EntityLiving) entity).addEffect(mobeffect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
|
||||
- if (((EntityLiving) entity).addEffect(mobeffect, commandlistenerwrapper.getEntity())) {
|
||||
+ if (((EntityLiving) entity).addEffect(mobeffect, commandlistenerwrapper.getEntity(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@
|
||||
@@ -99,7 +99,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
++i;
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@
|
||||
@@ -124,7 +124,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/CommandGamemode.java
|
||||
+++ b/net/minecraft/server/commands/CommandGamemode.java
|
||||
@@ -63,6 +63,12 @@
|
||||
|
||||
if (entityplayer.playerInteractManager.getGameMode() != enumgamemode) {
|
||||
entityplayer.a(enumgamemode);
|
||||
+ // CraftBukkit start - handle event cancelling the change
|
||||
+ if (entityplayer.playerInteractManager.getGameMode() != enumgamemode) {
|
||||
+ commandcontext.getSource().sendFailureMessage(new net.minecraft.network.chat.ChatComponentText("Failed to set the gamemode of '" + entityplayer.getName() + "'"));
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
a((CommandListenerWrapper) commandcontext.getSource(), entityplayer, enumgamemode);
|
||||
++i;
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
--- a/net/minecraft/server/commands/CommandGamerule.java
|
||||
+++ b/net/minecraft/server/commands/CommandGamerule.java
|
||||
@@ -29,7 +29,7 @@
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
private static <T extends GameRules.GameRuleValue<T>> int b(CommandContext<CommandListenerWrapper> commandcontext, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
static <T extends GameRules.GameRuleValue<T>> int a(CommandContext<CommandListenerWrapper> commandcontext, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
CommandListenerWrapper commandlistenerwrapper = (CommandListenerWrapper) commandcontext.getSource();
|
||||
- T t0 = commandlistenerwrapper.getServer().getGameRules().get(gamerules_gamerulekey);
|
||||
+ T t0 = commandlistenerwrapper.getWorld().getGameRules().get(gamerules_gamerulekey); // CraftBukkit
|
||||
|
||||
t0.b(commandcontext, "value");
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.gamerule.set", new Object[]{gamerules_gamerulekey.a(), t0.toString()}), true);
|
||||
@@ -37,7 +37,7 @@
|
||||
@@ -39,7 +39,7 @@
|
||||
}
|
||||
|
||||
private static <T extends GameRules.GameRuleValue<T>> int b(CommandListenerWrapper commandlistenerwrapper, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
static <T extends GameRules.GameRuleValue<T>> int a(CommandListenerWrapper commandlistenerwrapper, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
- T t0 = commandlistenerwrapper.getServer().getGameRules().get(gamerules_gamerulekey);
|
||||
+ T t0 = commandlistenerwrapper.getWorld().getGameRules().get(gamerules_gamerulekey); // CraftBukkit
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/commands/CommandList.java
|
||||
+++ b/net/minecraft/server/commands/CommandList.java
|
||||
@@ -36,6 +36,12 @@
|
||||
@@ -37,6 +37,12 @@
|
||||
private static int a(CommandListenerWrapper commandlistenerwrapper, Function<EntityPlayer, IChatBaseComponent> function) {
|
||||
PlayerList playerlist = commandlistenerwrapper.getServer().getPlayerList();
|
||||
List<EntityPlayer> list = playerlist.getPlayers();
|
||||
@@ -10,6 +10,6 @@
|
||||
+ list = list.stream().filter((ep) -> sender.canSee(ep.getBukkitEntity())).collect(java.util.stream.Collectors.toList());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
IChatMutableComponent ichatmutablecomponent = ChatComponentUtils.b(list, function);
|
||||
IChatBaseComponent ichatbasecomponent = ChatComponentUtils.b(list, function);
|
||||
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.list.players", new Object[]{list.size(), playerlist.getMaxPlayers(), ichatmutablecomponent}), false);
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.list.players", new Object[]{list.size(), playerlist.getMaxPlayers(), ichatbasecomponent}), false);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/commands/CommandReload.java
|
||||
+++ b/net/minecraft/server/commands/CommandReload.java
|
||||
@@ -42,6 +42,16 @@
|
||||
@@ -44,6 +44,16 @@
|
||||
return collection1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/commands/CommandSpreadPlayers.java
|
||||
+++ b/net/minecraft/server/commands/CommandSpreadPlayers.java
|
||||
@@ -77,7 +77,7 @@
|
||||
@@ -80,7 +80,7 @@
|
||||
if (entity instanceof EntityHuman) {
|
||||
set.add(entity.getScoreboardTeam());
|
||||
} else {
|
||||
@@ -9,27 +9,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@
|
||||
@@ -289,7 +289,7 @@
|
||||
|
||||
for (boolean flag2 = iblockaccess.getType(blockposition_mutableblockposition).isAir(); blockposition_mutableblockposition.getY() > 0; flag2 = flag1) {
|
||||
for (boolean flag2 = iblockaccess.getType(blockposition_mutableblockposition).isAir(); blockposition_mutableblockposition.getY() > iblockaccess.getMinBuildHeight(); flag2 = flag1) {
|
||||
blockposition_mutableblockposition.c(EnumDirection.DOWN);
|
||||
- flag1 = iblockaccess.getType(blockposition_mutableblockposition).isAir();
|
||||
+ flag1 = getType(iblockaccess, blockposition_mutableblockposition).isAir(); // CraftBukkit
|
||||
if (!flag1 && flag2 && flag) {
|
||||
return blockposition_mutableblockposition.getY() + 1;
|
||||
}
|
||||
@@ -299,7 +299,7 @@
|
||||
@@ -302,7 +302,7 @@
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i) {
|
||||
BlockPosition blockposition = new BlockPosition(this.a, (double) (this.a(iblockaccess, i) - 1), this.b);
|
||||
BlockPosition blockposition = new BlockPosition(this.x, (double) (this.a(iblockaccess, i) - 1), this.z);
|
||||
- IBlockData iblockdata = iblockaccess.getType(blockposition);
|
||||
+ IBlockData iblockdata = getType(iblockaccess, blockposition); // CraftBukkit
|
||||
Material material = iblockdata.getMaterial();
|
||||
|
||||
return blockposition.getY() < i && !material.isLiquid() && material != Material.FIRE;
|
||||
@@ -309,5 +309,12 @@
|
||||
this.a = MathHelper.a(random, d0, d2);
|
||||
this.b = MathHelper.a(random, d1, d3);
|
||||
@@ -312,5 +312,12 @@
|
||||
this.x = MathHelper.a(random, d0, d2);
|
||||
this.z = MathHelper.a(random, d1, d3);
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - add a version of getType which force loads chunks
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/server/commands/CommandSummon.java
|
||||
+++ b/net/minecraft/server/commands/CommandSummon.java
|
||||
@@ -64,7 +64,7 @@
|
||||
@@ -66,7 +66,7 @@
|
||||
((EntityInsentient) entity).prepare(commandlistenerwrapper.getWorld(), commandlistenerwrapper.getWorld().getDamageScaler(entity.getChunkCoordinates()), EnumMobSpawn.COMMAND, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
}
|
||||
|
||||
- if (!worldserver.addAllEntitiesSafely(entity)) {
|
||||
+ if (!worldserver.addAllEntitiesSafely(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.COMMAND)) { // CraftBukkit - pass a spawn reason of "COMMAND"
|
||||
throw CommandSummon.b.create();
|
||||
throw CommandSummon.ERROR_DUPLICATE_UUID.create();
|
||||
} else {
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.summon.success", new Object[]{entity.getScoreboardDisplayName()}), true);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/commands/CommandTeleport.java
|
||||
+++ b/net/minecraft/server/commands/CommandTeleport.java
|
||||
@@ -35,6 +35,12 @@
|
||||
@@ -36,6 +36,12 @@
|
||||
import net.minecraft.world.phys.Vec2F;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -12,25 +12,23 @@
|
||||
+
|
||||
public class CommandTeleport {
|
||||
|
||||
private static final SimpleCommandExceptionType a = new SimpleCommandExceptionType(new ChatMessage("commands.teleport.invalidPosition"));
|
||||
@@ -150,9 +156,9 @@
|
||||
private static final SimpleCommandExceptionType INVALID_POSITION = new SimpleCommandExceptionType(new ChatMessage("commands.teleport.invalidPosition"));
|
||||
@@ -160,14 +166,29 @@
|
||||
}
|
||||
|
||||
if (worldserver == entity.world) {
|
||||
- ((EntityPlayer) entity).playerConnection.a(d0, d1, d2, f, f1, set);
|
||||
+ ((EntityPlayer) entity).playerConnection.a(d0, d1, d2, f, f1, set, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
|
||||
if (worldserver == entity.level) {
|
||||
- ((EntityPlayer) entity).connection.a(d0, d1, d2, f2, f3, set);
|
||||
+ ((EntityPlayer) entity).connection.a(d0, d1, d2, f2, f3, set, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
|
||||
} else {
|
||||
- ((EntityPlayer) entity).a(worldserver, d0, d1, d2, f, f1);
|
||||
+ ((EntityPlayer) entity).a(worldserver, d0, d1, d2, f, f1, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
|
||||
- ((EntityPlayer) entity).a(worldserver, d0, d1, d2, f2, f3);
|
||||
+ ((EntityPlayer) entity).a(worldserver, d0, d1, d2, f2, f3, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
|
||||
}
|
||||
|
||||
entity.setHeadRotation(f);
|
||||
@@ -161,6 +167,21 @@
|
||||
float f3 = MathHelper.g(f1);
|
||||
|
||||
f3 = MathHelper.a(f3, -90.0F, 90.0F);
|
||||
entity.setHeadRotation(f2);
|
||||
} else {
|
||||
float f4 = MathHelper.a(f3, -90.0F, 90.0F);
|
||||
+ // CraftBukkit start - Teleport event
|
||||
+ Location to = new Location(worldserver.getWorld(), d0, d1, d2, f2, f3);
|
||||
+ Location to = new Location(worldserver.getWorld(), d0, d1, d2, f2, f4);
|
||||
+ EntityTeleportEvent event = new EntityTeleportEvent(entity.getBukkitEntity(), entity.getBukkitEntity().getLocation(), to);
|
||||
+ worldserver.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
@@ -41,9 +39,9 @@
|
||||
+ d1 = to.getY();
|
||||
+ d2 = to.getZ();
|
||||
+ f2 = to.getYaw();
|
||||
+ f3 = to.getPitch();
|
||||
+ f4 = to.getPitch();
|
||||
+ worldserver = ((CraftWorld) to.getWorld()).getHandle();
|
||||
+ // CraftBukkit end
|
||||
if (worldserver == entity.world) {
|
||||
entity.setPositionRotation(d0, d1, d2, f2, f3);
|
||||
entity.setHeadRotation(f2);
|
||||
|
||||
if (worldserver == entity.level) {
|
||||
entity.setPositionRotation(d0, d1, d2, f2, f4);
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
+
|
||||
public class CommandTime {
|
||||
|
||||
public static void a(CommandDispatcher<CommandListenerWrapper> commanddispatcher) {
|
||||
@@ -51,7 +56,13 @@
|
||||
public CommandTime() {}
|
||||
@@ -53,7 +58,13 @@
|
||||
while (iterator.hasNext()) {
|
||||
WorldServer worldserver = (WorldServer) iterator.next();
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
}
|
||||
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.time.set", new Object[]{i}), true);
|
||||
@@ -64,7 +75,13 @@
|
||||
@@ -66,7 +77,13 @@
|
||||
while (iterator.hasNext()) {
|
||||
WorldServer worldserver = (WorldServer) iterator.next();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -60,6 +60,15 @@
|
||||
@@ -64,6 +64,15 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
+
|
||||
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -74,8 +83,10 @@
|
||||
static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -82,8 +91,10 @@
|
||||
@Nullable
|
||||
private final TextFilter r;
|
||||
private final IChatBaseComponent resourcePackPrompt;
|
||||
|
||||
- public DedicatedServer(Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, DataPackResources datapackresources, SaveData savedata, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
- super(thread, iregistrycustom_dimension, convertable_conversionsession, savedata, resourcepackrepository, Proxy.NO_PROXY, datafixer, datapackresources, minecraftsessionservice, gameprofilerepository, usercache, worldloadlistenerfactory);
|
||||
@@ -26,10 +26,10 @@
|
||||
+ public DedicatedServer(joptsimple.OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, DataPackResources datapackresources, SaveData savedata, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
+ super(options, datapackconfiguration, thread, iregistrycustom_dimension, convertable_conversionsession, savedata, resourcepackrepository, Proxy.NO_PROXY, datafixer, datapackresources, minecraftsessionservice, gameprofilerepository, usercache, worldloadlistenerfactory);
|
||||
+ // CraftBukkit end
|
||||
this.propertyManager = dedicatedserversettings;
|
||||
this.remoteControlCommandListener = new RemoteControlCommandListener(this);
|
||||
this.r = null;
|
||||
@@ -85,13 +96,44 @@
|
||||
this.settings = dedicatedserversettings;
|
||||
this.rconConsoleSource = new RemoteControlCommandListener(this);
|
||||
this.textFilterClient = TextFilter.a(dedicatedserversettings.getProperties().textFilteringConfig);
|
||||
@@ -94,13 +105,44 @@
|
||||
public boolean init() throws IOException {
|
||||
Thread thread = new Thread("Server console handler") {
|
||||
public void run() {
|
||||
@@ -77,7 +77,7 @@
|
||||
}
|
||||
} catch (IOException ioexception) {
|
||||
DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
|
||||
@@ -100,6 +142,27 @@
|
||||
@@ -109,6 +151,27 @@
|
||||
}
|
||||
};
|
||||
|
||||
@@ -105,21 +105,21 @@
|
||||
thread.setDaemon(true);
|
||||
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER));
|
||||
thread.start();
|
||||
@@ -126,7 +189,7 @@
|
||||
this.setForceGamemode(dedicatedserverproperties.forceGamemode);
|
||||
@@ -134,7 +197,7 @@
|
||||
this.setMotd(dedicatedserverproperties.motd);
|
||||
super.setIdleTimeout((Integer) dedicatedserverproperties.playerIdleTimeout.get());
|
||||
this.i(dedicatedserverproperties.enforceWhitelist);
|
||||
- this.saveData.setGameType(dedicatedserverproperties.gamemode);
|
||||
+ // this.saveData.setGameType(dedicatedserverproperties.gamemode); // CraftBukkit - moved to world loading
|
||||
this.h(dedicatedserverproperties.enforceWhitelist);
|
||||
- this.worldData.setGameType(dedicatedserverproperties.gamemode);
|
||||
+ // this.worldData.setGameType(dedicatedserverproperties.gamemode); // CraftBukkit - moved to world loading
|
||||
DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode);
|
||||
InetAddress inetaddress = null;
|
||||
|
||||
@@ -150,6 +213,12 @@
|
||||
@@ -158,6 +221,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ this.a((PlayerList) (new DedicatedPlayerList(this, this.customRegistry, this.worldNBTStorage)));
|
||||
+ this.a((PlayerList) (new DedicatedPlayerList(this, this.registryHolder, this.playerDataStorage)));
|
||||
+ server.loadPlugins();
|
||||
+ server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.STARTUP);
|
||||
+ // CraftBukkit end
|
||||
@@ -127,47 +127,46 @@
|
||||
if (!this.getOnlineMode()) {
|
||||
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
|
||||
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
|
||||
@@ -164,7 +233,7 @@
|
||||
@@ -172,14 +241,14 @@
|
||||
if (!NameReferencingFileConverter.e(this)) {
|
||||
return false;
|
||||
} else {
|
||||
- this.a((PlayerList) (new DedicatedPlayerList(this, this.customRegistry, this.worldNBTStorage)));
|
||||
- this.a((PlayerList) (new DedicatedPlayerList(this, this.registryHolder, this.playerDataStorage)));
|
||||
+ // this.a((PlayerList) (new DedicatedPlayerList(this, this.customRegistry, this.worldNBTStorage))); // CraftBukkit - moved up
|
||||
long i = SystemUtils.getMonotonicNanos();
|
||||
|
||||
this.c(dedicatedserverproperties.maxBuildHeight);
|
||||
@@ -172,7 +241,7 @@
|
||||
TileEntitySkull.a(this.getUserCache());
|
||||
TileEntitySkull.a(this.getMinecraftSessionService());
|
||||
UserCache.a(this.getOnlineMode());
|
||||
DedicatedServer.LOGGER.info("Preparing level \"{}\"", this.getWorld());
|
||||
- this.loadWorld();
|
||||
+ this.loadWorld(convertable.getLevelName()); // CraftBukkit
|
||||
+ this.loadWorld(storageSource.getLevelName()); // CraftBukkit
|
||||
long j = SystemUtils.getMonotonicNanos() - i;
|
||||
String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D);
|
||||
|
||||
@@ -189,6 +258,7 @@
|
||||
@@ -196,6 +265,7 @@
|
||||
if (dedicatedserverproperties.enableRcon) {
|
||||
DedicatedServer.LOGGER.info("Starting remote control listener");
|
||||
this.remoteControlListener = RemoteControlListener.a((IMinecraftServer) this);
|
||||
+ this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(this.remoteControlCommandListener); // CraftBukkit
|
||||
this.rconThread = RemoteControlListener.a((IMinecraftServer) this);
|
||||
+ this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(this.rconConsoleSource); // CraftBukkit
|
||||
}
|
||||
|
||||
if (this.getMaxTickTime() > 0L) {
|
||||
@@ -303,6 +373,7 @@
|
||||
this.remoteStatusListener.b();
|
||||
@@ -345,6 +415,7 @@
|
||||
this.queryThreadGs4.b();
|
||||
}
|
||||
|
||||
+ System.exit(0); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -331,7 +402,15 @@
|
||||
while (!this.serverCommandQueue.isEmpty()) {
|
||||
ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0);
|
||||
@@ -378,7 +449,15 @@
|
||||
while (!this.consoleInput.isEmpty()) {
|
||||
ServerCommand servercommand = (ServerCommand) this.consoleInput.remove(0);
|
||||
|
||||
- this.getCommandDispatcher().a(servercommand.source, servercommand.command);
|
||||
- this.getCommandDispatcher().a(servercommand.source, servercommand.msg);
|
||||
+ // CraftBukkit start - ServerCommand for preprocessing
|
||||
+ ServerCommandEvent event = new ServerCommandEvent(console, servercommand.command);
|
||||
+ ServerCommandEvent event = new ServerCommandEvent(console, servercommand.msg);
|
||||
+ server.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) continue;
|
||||
+ servercommand = new ServerCommand(event.getCommand(), servercommand.source);
|
||||
@@ -178,7 +177,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -541,14 +620,45 @@
|
||||
@@ -583,14 +662,45 @@
|
||||
|
||||
@Override
|
||||
public String getPlugins() {
|
||||
@@ -211,24 +210,24 @@
|
||||
|
||||
@Override
|
||||
public String executeRemoteCommand(String s) {
|
||||
this.remoteControlCommandListener.clearMessages();
|
||||
this.rconConsoleSource.clearMessages();
|
||||
this.executeSync(() -> {
|
||||
- this.getCommandDispatcher().a(this.remoteControlCommandListener.getWrapper(), s);
|
||||
- this.getCommandDispatcher().a(this.rconConsoleSource.getWrapper(), s);
|
||||
+ // CraftBukkit start - fire RemoteServerCommandEvent
|
||||
+ RemoteServerCommandEvent event = new RemoteServerCommandEvent(remoteConsole, s);
|
||||
+ server.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ ServerCommand serverCommand = new ServerCommand(event.getCommand(), remoteControlCommandListener.getWrapper());
|
||||
+ ServerCommand serverCommand = new ServerCommand(event.getCommand(), rconConsoleSource.getWrapper());
|
||||
+ server.dispatchServerCommand(remoteConsole, serverCommand);
|
||||
+ // CraftBukkit end
|
||||
});
|
||||
return this.remoteControlCommandListener.getMessages();
|
||||
return this.rconConsoleSource.getMessages();
|
||||
}
|
||||
@@ -590,4 +700,15 @@
|
||||
public ITextFilter a(EntityPlayer entityplayer) {
|
||||
return this.r != null ? this.r.a(entityplayer.getProfile()) : null;
|
||||
@@ -663,4 +773,15 @@
|
||||
public IChatBaseComponent bb() {
|
||||
return this.resourcePackPrompt;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
@@ -9,8 +9,14 @@
|
||||
@@ -10,8 +10,14 @@
|
||||
import net.minecraft.world.level.EnumGamemode;
|
||||
import net.minecraft.world.level.levelgen.GeneratorSettings;
|
||||
|
||||
@@ -15,35 +15,36 @@
|
||||
public final boolean onlineMode = this.getBoolean("online-mode", true);
|
||||
public final boolean preventProxyConnections = this.getBoolean("prevent-proxy-connections", false);
|
||||
public final String serverIp = this.getString("server-ip", "");
|
||||
@@ -61,8 +67,10 @@
|
||||
public final PropertyManager<DedicatedServerProperties>.EditableProperty<Boolean> whiteList;
|
||||
public final GeneratorSettings generatorSettings;
|
||||
@@ -64,8 +70,10 @@
|
||||
@Nullable
|
||||
public GeneratorSettings worldGenSettings;
|
||||
|
||||
- public DedicatedServerProperties(Properties properties, IRegistryCustom iregistrycustom) {
|
||||
- public DedicatedServerProperties(Properties properties) {
|
||||
- super(properties);
|
||||
+ // CraftBukkit start
|
||||
+ public DedicatedServerProperties(Properties properties, IRegistryCustom iregistrycustom, OptionSet optionset) {
|
||||
+ public DedicatedServerProperties(Properties properties, OptionSet optionset) {
|
||||
+ super(properties, optionset);
|
||||
+ // CraftBukkit end
|
||||
this.difficulty = (EnumDifficulty) this.a("difficulty", a(EnumDifficulty::getById, EnumDifficulty::a), EnumDifficulty::c, EnumDifficulty.EASY);
|
||||
this.gamemode = (EnumGamemode) this.a("gamemode", a(EnumGamemode::getById, EnumGamemode::a), EnumGamemode::b, EnumGamemode.SURVIVAL);
|
||||
this.levelName = this.getString("level-name", "world");
|
||||
@@ -113,12 +121,14 @@
|
||||
this.generatorSettings = GeneratorSettings.a(iregistrycustom, properties);
|
||||
@@ -112,13 +120,15 @@
|
||||
this.whiteList = this.b("white-list", false);
|
||||
}
|
||||
|
||||
- public static DedicatedServerProperties load(IRegistryCustom iregistrycustom, Path path) {
|
||||
- return new DedicatedServerProperties(loadPropertiesFile(path), iregistrycustom);
|
||||
- public static DedicatedServerProperties load(Path path) {
|
||||
- return new DedicatedServerProperties(loadPropertiesFile(path));
|
||||
+ // CraftBukkit start
|
||||
+ public static DedicatedServerProperties load(IRegistryCustom iregistrycustom, Path path, OptionSet optionset) {
|
||||
+ return new DedicatedServerProperties(loadPropertiesFile(path), iregistrycustom, optionset);
|
||||
+ public static DedicatedServerProperties load(Path path, OptionSet optionset) {
|
||||
+ return new DedicatedServerProperties(loadPropertiesFile(path), optionset);
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected DedicatedServerProperties reload(IRegistryCustom iregistrycustom, Properties properties) {
|
||||
- return new DedicatedServerProperties(properties, iregistrycustom);
|
||||
- DedicatedServerProperties dedicatedserverproperties = new DedicatedServerProperties(properties);
|
||||
+ protected DedicatedServerProperties reload(IRegistryCustom iregistrycustom, Properties properties, OptionSet optionset) {
|
||||
+ return new DedicatedServerProperties(properties, iregistrycustom, optionset);
|
||||
+ DedicatedServerProperties dedicatedserverproperties = new DedicatedServerProperties(properties, optionset);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
dedicatedserverproperties.a(iregistrycustom);
|
||||
return dedicatedserverproperties;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServerSettings.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServerSettings.java
|
||||
@@ -4,14 +4,21 @@
|
||||
@@ -3,14 +3,21 @@
|
||||
import java.nio.file.Path;
|
||||
import java.util.function.UnaryOperator;
|
||||
import net.minecraft.core.IRegistryCustom;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.io.File;
|
||||
@@ -11,16 +11,16 @@
|
||||
+
|
||||
public class DedicatedServerSettings {
|
||||
|
||||
private final Path path;
|
||||
private final Path source;
|
||||
private DedicatedServerProperties properties;
|
||||
|
||||
- public DedicatedServerSettings(IRegistryCustom iregistrycustom, Path path) {
|
||||
- this.path = path;
|
||||
- this.properties = DedicatedServerProperties.load(iregistrycustom, path);
|
||||
- public DedicatedServerSettings(Path path) {
|
||||
- this.source = path;
|
||||
- this.properties = DedicatedServerProperties.load(path);
|
||||
+ // CraftBukkit start
|
||||
+ public DedicatedServerSettings(IRegistryCustom iregistrycustom, OptionSet optionset) {
|
||||
+ this.path = ((File) optionset.valueOf("config")).toPath();
|
||||
+ this.properties = DedicatedServerProperties.load(iregistrycustom, path, optionset);
|
||||
+ public DedicatedServerSettings(OptionSet optionset) {
|
||||
+ this.source = ((File) optionset.valueOf("config")).toPath();
|
||||
+ this.properties = DedicatedServerProperties.load(source, optionset);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
public static Properties loadPropertiesFile(Path path) {
|
||||
Properties properties = new Properties();
|
||||
|
||||
@@ -61,6 +76,11 @@
|
||||
@@ -58,6 +73,11 @@
|
||||
|
||||
public void savePropertiesFile(Path path) {
|
||||
try {
|
||||
@@ -42,9 +42,9 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
OutputStream outputstream = Files.newOutputStream(path);
|
||||
Throwable throwable = null;
|
||||
|
||||
@@ -92,7 +112,7 @@
|
||||
try {
|
||||
@@ -86,7 +106,7 @@
|
||||
private static <V extends Number> Function<String, V> a(Function<String, V> function) {
|
||||
return (s) -> {
|
||||
try {
|
||||
@@ -53,7 +53,7 @@
|
||||
} catch (NumberFormatException numberformatexception) {
|
||||
return null;
|
||||
}
|
||||
@@ -111,7 +131,7 @@
|
||||
@@ -105,7 +125,7 @@
|
||||
|
||||
@Nullable
|
||||
private String c(String s) {
|
||||
@@ -62,7 +62,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -139,7 +159,7 @@
|
||||
@@ -133,7 +153,7 @@
|
||||
V v1 = MoreObjects.firstNonNull(s1 != null ? function.apply(s1) : null, v0);
|
||||
|
||||
this.properties.put(s, function1.apply(v1));
|
||||
@@ -71,7 +71,7 @@
|
||||
}
|
||||
|
||||
protected <V> V a(String s, Function<String, V> function, UnaryOperator<V> unaryoperator, Function<V, String> function1, V v0) {
|
||||
@@ -168,7 +188,7 @@
|
||||
@@ -162,7 +182,7 @@
|
||||
}
|
||||
|
||||
protected int getInt(String s, int i) {
|
||||
@@ -80,7 +80,7 @@
|
||||
}
|
||||
|
||||
protected PropertyManager<T>.EditableProperty<Integer> b(String s, int i) {
|
||||
@@ -180,7 +200,7 @@
|
||||
@@ -174,7 +194,7 @@
|
||||
}
|
||||
|
||||
protected long getLong(String s, long i) {
|
||||
@@ -89,7 +89,7 @@
|
||||
}
|
||||
|
||||
protected boolean getBoolean(String s, boolean flag) {
|
||||
@@ -203,7 +223,7 @@
|
||||
@@ -197,7 +217,7 @@
|
||||
return properties;
|
||||
}
|
||||
|
||||
@@ -98,19 +98,19 @@
|
||||
|
||||
public class EditableProperty<V> implements Supplier<V> {
|
||||
|
||||
@@ -211,7 +231,7 @@
|
||||
private final V c;
|
||||
private final Function<V, String> d;
|
||||
@@ -205,7 +225,7 @@
|
||||
private final V value;
|
||||
private final Function<V, String> serializer;
|
||||
|
||||
- private EditableProperty(String s, Object object, Function function) {
|
||||
+ private EditableProperty(String s, V object, Function function) { // CraftBukkit - decompile error
|
||||
this.b = s;
|
||||
this.c = object;
|
||||
this.d = function;
|
||||
@@ -225,7 +245,7 @@
|
||||
- EditableProperty(String s, Object object, Function function) {
|
||||
+ EditableProperty(String s, V object, Function function) { // CraftBukkit - decompile error
|
||||
this.key = s;
|
||||
this.value = object;
|
||||
this.serializer = function;
|
||||
@@ -219,7 +239,7 @@
|
||||
Properties properties = PropertyManager.this.a();
|
||||
|
||||
properties.put(this.b, this.d.apply(v0));
|
||||
properties.put(this.key, this.serializer.apply(v0));
|
||||
- return PropertyManager.this.reload(iregistrycustom, properties);
|
||||
+ return PropertyManager.this.reload(iregistrycustom, properties, PropertyManager.this.options); // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -1,14 +1,23 @@
|
||||
--- a/net/minecraft/server/gui/ServerGUI.java
|
||||
+++ b/net/minecraft/server/gui/ServerGUI.java
|
||||
@@ -160,6 +160,7 @@
|
||||
this.e.forEach(Runnable::run);
|
||||
@@ -96,7 +96,7 @@
|
||||
private JComponent c() {
|
||||
JPanel jpanel = new JPanel(new BorderLayout());
|
||||
GuiStatsComponent guistatscomponent = new GuiStatsComponent(this.server);
|
||||
- Collection collection = this.finalizers;
|
||||
+ Collection<Runnable> collection = this.finalizers; // CraftBukkit - decompile error
|
||||
|
||||
Objects.requireNonNull(guistatscomponent);
|
||||
collection.add(guistatscomponent::a);
|
||||
@@ -166,6 +166,7 @@
|
||||
this.finalizers.forEach(Runnable::run);
|
||||
}
|
||||
|
||||
+ private static final java.util.regex.Pattern ANSI = java.util.regex.Pattern.compile("\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})*)?[m|K]"); // CraftBukkit
|
||||
public void a(JTextArea jtextarea, JScrollPane jscrollpane, String s) {
|
||||
if (!SwingUtilities.isEventDispatchThread()) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
@@ -175,7 +176,7 @@
|
||||
@@ -181,7 +182,7 @@
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,64 +1,64 @@
|
||||
--- a/net/minecraft/server/level/ChunkMapDistance.java
|
||||
+++ b/net/minecraft/server/level/ChunkMapDistance.java
|
||||
@@ -65,7 +65,7 @@
|
||||
@@ -73,7 +73,7 @@
|
||||
while (objectiterator.hasNext()) {
|
||||
Entry<ArraySetSorted<Ticket<?>>> entry = (Entry) objectiterator.next();
|
||||
|
||||
- if (((ArraySetSorted) entry.getValue()).removeIf((ticket) -> {
|
||||
+ if ((entry.getValue()).removeIf((ticket) -> { // CraftBukkit - decompile error
|
||||
return ticket.b(this.currentTick);
|
||||
return ticket.b(this.ticketTickCounter);
|
||||
})) {
|
||||
this.ticketLevelTracker.update(entry.getLongKey(), getLowestTicketLevel((ArraySetSorted) entry.getValue()), false);
|
||||
@@ -101,10 +101,25 @@
|
||||
this.ticketTracker.update(entry.getLongKey(), getLowestTicketLevel((ArraySetSorted) entry.getValue()), false);
|
||||
@@ -109,10 +109,25 @@
|
||||
}
|
||||
|
||||
if (!this.pendingChunkUpdates.isEmpty()) {
|
||||
- this.pendingChunkUpdates.forEach((playerchunk) -> {
|
||||
if (!this.chunksToUpdateFutures.isEmpty()) {
|
||||
- this.chunksToUpdateFutures.forEach((playerchunk) -> {
|
||||
+ // CraftBukkit start
|
||||
+ // Iterate pending chunk updates with protection against concurrent modification exceptions
|
||||
+ java.util.Iterator<PlayerChunk> iter = this.pendingChunkUpdates.iterator();
|
||||
+ int expectedSize = this.pendingChunkUpdates.size();
|
||||
+ java.util.Iterator<PlayerChunk> iter = this.chunksToUpdateFutures.iterator();
|
||||
+ int expectedSize = this.chunksToUpdateFutures.size();
|
||||
+ do {
|
||||
+ PlayerChunk playerchunk = iter.next();
|
||||
+ iter.remove();
|
||||
+ expectedSize--;
|
||||
+
|
||||
playerchunk.a(playerchunkmap);
|
||||
playerchunk.a(playerchunkmap, this.mainThreadExecutor);
|
||||
- });
|
||||
- this.pendingChunkUpdates.clear();
|
||||
- this.chunksToUpdateFutures.clear();
|
||||
+
|
||||
+ // Reset iterator if set was modified using add()
|
||||
+ if (this.pendingChunkUpdates.size() != expectedSize) {
|
||||
+ expectedSize = this.pendingChunkUpdates.size();
|
||||
+ iter = this.pendingChunkUpdates.iterator();
|
||||
+ if (this.chunksToUpdateFutures.size() != expectedSize) {
|
||||
+ expectedSize = this.chunksToUpdateFutures.size();
|
||||
+ iter = this.chunksToUpdateFutures.iterator();
|
||||
+ }
|
||||
+ } while (iter.hasNext());
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
return true;
|
||||
} else {
|
||||
if (!this.l.isEmpty()) {
|
||||
@@ -140,23 +155,25 @@
|
||||
if (!this.ticketsToRelease.isEmpty()) {
|
||||
@@ -148,23 +163,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private void addTicket(long i, Ticket<?> ticket) {
|
||||
+ private boolean addTicket(long i, Ticket<?> ticket) { // CraftBukkit - void -> boolean
|
||||
- void addTicket(long i, Ticket<?> ticket) {
|
||||
+ boolean addTicket(long i, Ticket<?> ticket) { // CraftBukkit - void -> boolean
|
||||
ArraySetSorted<Ticket<?>> arraysetsorted = this.e(i);
|
||||
int j = getLowestTicketLevel(arraysetsorted);
|
||||
- Ticket<?> ticket1 = (Ticket) arraysetsorted.a((Object) ticket);
|
||||
+ Ticket<?> ticket1 = (Ticket) arraysetsorted.a(ticket); // CraftBukkit - decompile error
|
||||
|
||||
ticket1.a(this.currentTick);
|
||||
ticket1.a(this.ticketTickCounter);
|
||||
if (ticket.b() < j) {
|
||||
this.ticketLevelTracker.update(i, ticket.b(), true);
|
||||
this.ticketTracker.update(i, ticket.b(), true);
|
||||
}
|
||||
|
||||
+ return ticket == ticket1; // CraftBukkit
|
||||
}
|
||||
|
||||
- private void removeTicket(long i, Ticket<?> ticket) {
|
||||
+ private boolean removeTicket(long i, Ticket<?> ticket) { // CraftBukkit - void -> boolean
|
||||
- void removeTicket(long i, Ticket<?> ticket) {
|
||||
+ boolean removeTicket(long i, Ticket<?> ticket) { // CraftBukkit - void -> boolean
|
||||
ArraySetSorted<Ticket<?>> arraysetsorted = this.e(i);
|
||||
|
||||
+ boolean removed = false; // CraftBukkit
|
||||
@@ -68,10 +68,10 @@
|
||||
}
|
||||
|
||||
if (arraysetsorted.isEmpty()) {
|
||||
@@ -164,16 +181,29 @@
|
||||
@@ -172,16 +189,29 @@
|
||||
}
|
||||
|
||||
this.ticketLevelTracker.update(i, getLowestTicketLevel(arraysetsorted), false);
|
||||
this.ticketTracker.update(i, getLowestTicketLevel(arraysetsorted), false);
|
||||
+ return removed; // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -101,16 +101,16 @@
|
||||
}
|
||||
|
||||
public <T> void addTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||
@@ -216,6 +246,7 @@
|
||||
@@ -224,6 +254,7 @@
|
||||
public void b(SectionPosition sectionposition, EntityPlayer entityplayer) {
|
||||
long i = sectionposition.r().pair();
|
||||
ObjectSet<EntityPlayer> objectset = (ObjectSet) this.c.get(i);
|
||||
ObjectSet<EntityPlayer> objectset = (ObjectSet) this.playersPerChunk.get(i);
|
||||
+ if (objectset == null) return; // CraftBukkit - SPIGOT-6208
|
||||
|
||||
objectset.remove(entityplayer);
|
||||
if (objectset.isEmpty()) {
|
||||
@@ -257,6 +288,26 @@
|
||||
return this.i.a();
|
||||
@@ -300,6 +331,26 @@
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@@ -122,7 +122,7 @@
|
||||
+ ArraySetSorted<Ticket<?>> tickets = entry.getValue();
|
||||
+ if (tickets.remove(target)) {
|
||||
+ // copied from removeTicket
|
||||
+ this.ticketLevelTracker.update(entry.getLongKey(), getLowestTicketLevel(tickets), false);
|
||||
+ this.ticketTracker.update(entry.getLongKey(), getLowestTicketLevel(tickets), false);
|
||||
+
|
||||
+ // can't use entry after it's removed
|
||||
+ if (tickets.isEmpty()) {
|
||||
@@ -133,6 +133,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
class a extends ChunkMap {
|
||||
private class a extends ChunkMap {
|
||||
|
||||
public a() {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
--- a/net/minecraft/server/level/ChunkProviderServer.java
|
||||
+++ b/net/minecraft/server/level/ChunkProviderServer.java
|
||||
@@ -79,6 +79,24 @@
|
||||
@@ -83,6 +83,24 @@
|
||||
this.clearCache();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - properly implement isChunkLoaded
|
||||
+ public boolean isChunkLoaded(int chunkX, int chunkZ) {
|
||||
+ PlayerChunk chunk = this.playerChunkMap.getUpdatingChunk(ChunkCoordIntPair.pair(chunkX, chunkZ));
|
||||
+ PlayerChunk chunk = this.chunkMap.getUpdatingChunk(ChunkCoordIntPair.pair(chunkX, chunkZ));
|
||||
+ if (chunk == null) {
|
||||
+ return false;
|
||||
+ }
|
||||
@@ -14,7 +14,7 @@
|
||||
+ }
|
||||
+
|
||||
+ public Chunk getChunkUnchecked(int chunkX, int chunkZ) {
|
||||
+ PlayerChunk chunk = this.playerChunkMap.getUpdatingChunk(ChunkCoordIntPair.pair(chunkX, chunkZ));
|
||||
+ PlayerChunk chunk = this.chunkMap.getUpdatingChunk(ChunkCoordIntPair.pair(chunkX, chunkZ));
|
||||
+ if (chunk == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
@@ -25,16 +25,16 @@
|
||||
@Override
|
||||
public LightEngineThreaded getLightEngine() {
|
||||
return this.lightEngine;
|
||||
@@ -123,7 +141,7 @@
|
||||
@@ -127,7 +145,7 @@
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
if (k == this.cachePos[l] && chunkstatus == this.cacheStatus[l]) {
|
||||
ichunkaccess = this.cacheChunk[l];
|
||||
if (k == this.lastChunkPos[l] && chunkstatus == this.lastChunkStatus[l]) {
|
||||
ichunkaccess = this.lastChunk[l];
|
||||
- if (ichunkaccess != null || !flag) {
|
||||
+ if (ichunkaccess != 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 ichunkaccess;
|
||||
}
|
||||
}
|
||||
@@ -169,12 +187,12 @@
|
||||
@@ -175,12 +193,12 @@
|
||||
if (playerchunk == null) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
if (ichunkaccess1 != null) {
|
||||
this.a(k, ichunkaccess1, ChunkStatus.FULL);
|
||||
@@ -201,7 +219,15 @@
|
||||
@@ -228,7 +246,15 @@
|
||||
int l = 33 + ChunkStatus.a(chunkstatus);
|
||||
PlayerChunk playerchunk = this.getChunk(k);
|
||||
|
||||
@@ -63,10 +63,10 @@
|
||||
+ }
|
||||
+ if (flag && !currentlyUnloading) {
|
||||
+ // CraftBukkit end
|
||||
this.chunkMapDistance.a(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
|
||||
this.distanceManager.a(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
|
||||
if (this.a(playerchunk, l)) {
|
||||
GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler();
|
||||
@@ -220,7 +246,7 @@
|
||||
GameProfilerFiller gameprofilerfiller = this.level.getMethodProfiler();
|
||||
@@ -247,7 +273,7 @@
|
||||
}
|
||||
|
||||
private boolean a(@Nullable PlayerChunk playerchunk, int i) {
|
||||
@@ -74,31 +74,17 @@
|
||||
+ return playerchunk == null || playerchunk.oldTicketLevel > i; // CraftBukkit using oldTicketLevel for isLoaded checks
|
||||
}
|
||||
|
||||
public boolean isLoaded(int i, int j) {
|
||||
@@ -282,19 +308,19 @@
|
||||
public boolean a(Entity entity) {
|
||||
long i = ChunkCoordIntPair.pair(MathHelper.floor(entity.locX()) >> 4, MathHelper.floor(entity.locZ()) >> 4);
|
||||
|
||||
- return this.a(i, PlayerChunk::b);
|
||||
+ return this.a(i, (Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>>) PlayerChunk::b); // CraftBukkit - decompile error
|
||||
@Override
|
||||
@@ -307,7 +333,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a(ChunkCoordIntPair chunkcoordintpair) {
|
||||
- return this.a(chunkcoordintpair.pair(), PlayerChunk::b);
|
||||
+ return this.a(chunkcoordintpair.pair(), (Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>>) PlayerChunk::b); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a(BlockPosition blockposition) {
|
||||
long i = ChunkCoordIntPair.pair(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
||||
|
||||
public boolean a(long i) {
|
||||
- return this.a(i, PlayerChunk::a);
|
||||
+ return this.a(i, (Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>>) PlayerChunk::a); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private boolean a(long i, Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>> function) {
|
||||
@@ -316,11 +342,31 @@
|
||||
@@ -329,11 +355,31 @@
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
@@ -113,44 +99,46 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.lightEngine.close();
|
||||
this.playerChunkMap.close();
|
||||
this.chunkMap.close();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - modelled on below
|
||||
+ public void purgeUnload() {
|
||||
+ this.world.getMethodProfiler().enter("purge");
|
||||
+ this.chunkMapDistance.purgeTickets();
|
||||
+ this.level.getMethodProfiler().enter("purge");
|
||||
+ this.distanceManager.purgeTickets();
|
||||
+ this.tickDistanceManager();
|
||||
+ this.world.getMethodProfiler().exitEnter("unload");
|
||||
+ this.playerChunkMap.unloadChunks(() -> true);
|
||||
+ this.world.getMethodProfiler().exit();
|
||||
+ this.level.getMethodProfiler().exitEnter("unload");
|
||||
+ this.chunkMap.unloadChunks(() -> true);
|
||||
+ this.level.getMethodProfiler().exit();
|
||||
+ this.clearCache();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
public void tick(BooleanSupplier booleansupplier) {
|
||||
this.world.getMethodProfiler().enter("purge");
|
||||
this.chunkMapDistance.purgeTickets();
|
||||
@@ -340,12 +386,12 @@
|
||||
this.lastTickTime = i;
|
||||
WorldData worlddata = this.world.getWorldData();
|
||||
boolean flag = this.world.isDebugWorld();
|
||||
- boolean flag1 = this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING);
|
||||
+ boolean flag1 = this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING) && !world.getPlayers().isEmpty(); // CraftBukkit
|
||||
this.level.getMethodProfiler().enter("purge");
|
||||
@@ -354,12 +400,12 @@
|
||||
this.lastInhabitedUpdate = i;
|
||||
WorldData worlddata = this.level.getWorldData();
|
||||
boolean flag = this.level.isDebugWorld();
|
||||
- boolean flag1 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING);
|
||||
+ boolean flag1 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !level.getPlayers().isEmpty(); // CraftBukkit
|
||||
|
||||
if (!flag) {
|
||||
this.world.getMethodProfiler().enter("pollingChunks");
|
||||
int k = this.world.getGameRules().getInt(GameRules.RANDOM_TICK_SPEED);
|
||||
this.level.getMethodProfiler().enter("pollingChunks");
|
||||
int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
|
||||
- boolean flag2 = worlddata.getTime() % 400L == 0L;
|
||||
+ boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit
|
||||
+ boolean flag2 = level.ticksPerAnimalSpawns != 0L && worlddata.getTime() % level.ticksPerAnimalSpawns == 0L; // CraftBukkit
|
||||
|
||||
this.world.getMethodProfiler().enter("naturalSpawnCount");
|
||||
int l = this.chunkMapDistance.b();
|
||||
@@ -532,12 +578,18 @@
|
||||
this.level.getMethodProfiler().enter("naturalSpawnCount");
|
||||
int l = this.distanceManager.b();
|
||||
@@ -548,13 +594,19 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean executeNext() {
|
||||
- protected boolean executeNext() {
|
||||
+ // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
|
||||
+ public boolean executeNext() {
|
||||
+ try {
|
||||
if (ChunkProviderServer.this.tickDistanceManager()) {
|
||||
return true;
|
||||
@@ -159,7 +147,7 @@
|
||||
return super.executeNext();
|
||||
}
|
||||
+ } finally {
|
||||
+ playerChunkMap.callbackExecutor.run();
|
||||
+ chunkMap.callbackExecutor.run();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,11 @@
|
||||
--- a/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
+++ b/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
@@ -40,6 +40,11 @@
|
||||
@@ -42,6 +42,12 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.server.network.ServerPlayerConnection;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.player.PlayerVelocityEvent;
|
||||
+// CraftBukkit end
|
||||
@@ -12,44 +13,51 @@
|
||||
public class EntityTrackerEntry {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -60,8 +65,12 @@
|
||||
private List<Entity> p;
|
||||
private boolean q;
|
||||
private boolean r;
|
||||
@@ -63,8 +69,12 @@
|
||||
private List<Entity> lastPassengers;
|
||||
private boolean wasRiding;
|
||||
private boolean wasOnGround;
|
||||
+ // CraftBukkit start
|
||||
+ private final Set<EntityPlayer> trackedPlayers;
|
||||
+ private final Set<ServerPlayerConnection> trackedPlayers;
|
||||
|
||||
- public EntityTrackerEntry(WorldServer worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer) {
|
||||
+ public EntityTrackerEntry(WorldServer worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<EntityPlayer> trackedPlayers) {
|
||||
+ public EntityTrackerEntry(WorldServer worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<ServerPlayerConnection> trackedPlayers) {
|
||||
+ this.trackedPlayers = trackedPlayers;
|
||||
+ // CraftBukkit end
|
||||
this.m = Vec3D.ORIGIN;
|
||||
this.p = Collections.emptyList();
|
||||
this.b = worldserver;
|
||||
@@ -81,16 +90,16 @@
|
||||
this.ap = Vec3D.ZERO;
|
||||
this.lastPassengers = Collections.emptyList();
|
||||
this.level = worldserver;
|
||||
@@ -84,22 +94,22 @@
|
||||
|
||||
if (!list.equals(this.p)) {
|
||||
this.p = list;
|
||||
- this.f.accept(new PacketPlayOutMount(this.tracker));
|
||||
+ this.broadcastIncludingSelf(new PacketPlayOutMount(this.tracker)); // CraftBukkit
|
||||
if (!list.equals(this.lastPassengers)) {
|
||||
this.lastPassengers = list;
|
||||
- this.broadcast.accept(new PacketPlayOutMount(this.entity));
|
||||
+ this.broadcastIncludingSelf(new PacketPlayOutMount(this.entity)); // CraftBukkit
|
||||
}
|
||||
|
||||
- if (this.tracker instanceof EntityItemFrame && this.tickCounter % 10 == 0) {
|
||||
+ if (this.tracker instanceof EntityItemFrame /*&& this.tickCounter % 10 == 0*/) { // CraftBukkit - Moved below, should always enter this block
|
||||
EntityItemFrame entityitemframe = (EntityItemFrame) this.tracker;
|
||||
- if (this.entity instanceof EntityItemFrame && this.tickCount % 10 == 0) {
|
||||
+ if (this.entity instanceof EntityItemFrame /*&& this.tickCounter % 10 == 0*/) { // CraftBukkit - Moved below, should always enter this block
|
||||
EntityItemFrame entityitemframe = (EntityItemFrame) this.entity;
|
||||
ItemStack itemstack = entityitemframe.getItem();
|
||||
|
||||
- if (itemstack.getItem() instanceof ItemWorldMap) {
|
||||
+ if (this.tickCounter % 10 == 0 && itemstack.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks
|
||||
WorldMap worldmap = ItemWorldMap.getSavedMap(itemstack, this.b);
|
||||
- Iterator iterator = this.b.getPlayers().iterator();
|
||||
+ Iterator iterator = this.trackedPlayers.iterator(); // CraftBukkit
|
||||
+ if (this.tickCount % 10 == 0 && itemstack.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks
|
||||
Integer integer = ItemWorldMap.d(itemstack);
|
||||
WorldMap worldmap = ItemWorldMap.a(integer, (World) this.level);
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
@@ -135,6 +144,17 @@
|
||||
boolean flag2 = flag1 || this.tickCounter % 60 == 0;
|
||||
boolean flag3 = Math.abs(i - this.yRot) >= 1 || Math.abs(j - this.xRot) >= 1;
|
||||
if (worldmap != null) {
|
||||
- Iterator iterator = this.level.getPlayers().iterator();
|
||||
+ Iterator<ServerPlayerConnection> iterator = this.trackedPlayers.iterator(); // CraftBukkit
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
- EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
+ EntityPlayer entityplayer = iterator.next().d(); // CraftBukkit
|
||||
|
||||
worldmap.a((EntityHuman) entityplayer, itemstack);
|
||||
Packet<?> packet = worldmap.a(integer, entityplayer);
|
||||
@@ -142,6 +152,17 @@
|
||||
boolean flag2 = flag1 || this.tickCount % 60 == 0;
|
||||
boolean flag3 = Math.abs(i - this.yRotp) >= 1 || Math.abs(j - this.xRotp) >= 1;
|
||||
|
||||
+ // CraftBukkit start - Code moved from below
|
||||
+ if (flag2) {
|
||||
@@ -57,15 +65,15 @@
|
||||
+ }
|
||||
+
|
||||
+ if (flag3) {
|
||||
+ this.yRot = i;
|
||||
+ this.xRot = j;
|
||||
+ this.yRotp = i;
|
||||
+ this.xRotp = j;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.tickCounter > 0 || this.tracker instanceof EntityArrow) {
|
||||
if (this.tickCount > 0 || this.entity instanceof EntityArrow) {
|
||||
long k = PacketPlayOutEntity.a(vec3d.x);
|
||||
long l = PacketPlayOutEntity.a(vec3d.y);
|
||||
@@ -173,6 +193,7 @@
|
||||
@@ -180,6 +201,7 @@
|
||||
}
|
||||
|
||||
this.c();
|
||||
@@ -73,28 +81,28 @@
|
||||
if (flag2) {
|
||||
this.d();
|
||||
}
|
||||
@@ -181,6 +202,7 @@
|
||||
this.yRot = i;
|
||||
this.xRot = j;
|
||||
@@ -188,6 +210,7 @@
|
||||
this.yRotp = i;
|
||||
this.xRotp = j;
|
||||
}
|
||||
+ // CraftBukkit end */
|
||||
|
||||
this.q = false;
|
||||
this.wasRiding = false;
|
||||
}
|
||||
@@ -196,7 +218,27 @@
|
||||
@@ -203,7 +226,27 @@
|
||||
|
||||
++this.tickCounter;
|
||||
if (this.tracker.velocityChanged) {
|
||||
- this.broadcastIncludingSelf(new PacketPlayOutEntityVelocity(this.tracker));
|
||||
++this.tickCount;
|
||||
if (this.entity.hurtMarked) {
|
||||
- this.broadcastIncludingSelf(new PacketPlayOutEntityVelocity(this.entity));
|
||||
+ // CraftBukkit start - Create PlayerVelocity event
|
||||
+ boolean cancelled = false;
|
||||
+
|
||||
+ if (this.tracker instanceof EntityPlayer) {
|
||||
+ Player player = (Player) this.tracker.getBukkitEntity();
|
||||
+ if (this.entity instanceof EntityPlayer) {
|
||||
+ Player player = (Player) this.entity.getBukkitEntity();
|
||||
+ org.bukkit.util.Vector velocity = player.getVelocity();
|
||||
+
|
||||
+ PlayerVelocityEvent event = new PlayerVelocityEvent(player, velocity.clone());
|
||||
+ this.tracker.world.getServer().getPluginManager().callEvent(event);
|
||||
+ this.entity.level.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ cancelled = true;
|
||||
@@ -104,70 +112,69 @@
|
||||
+ }
|
||||
+
|
||||
+ if (!cancelled) {
|
||||
+ this.broadcastIncludingSelf(new PacketPlayOutEntityVelocity(this.tracker));
|
||||
+ this.broadcastIncludingSelf(new PacketPlayOutEntityVelocity(this.entity));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.tracker.velocityChanged = false;
|
||||
this.entity.hurtMarked = false;
|
||||
}
|
||||
|
||||
@@ -211,14 +253,17 @@
|
||||
PlayerConnection playerconnection = entityplayer.playerConnection;
|
||||
@@ -218,13 +261,16 @@
|
||||
PlayerConnection playerconnection = entityplayer.connection;
|
||||
|
||||
entityplayer.playerConnection.getClass();
|
||||
Objects.requireNonNull(entityplayer.connection);
|
||||
- this.a(playerconnection::sendPacket);
|
||||
+ this.a(playerconnection::sendPacket, entityplayer); // CraftBukkit - add player
|
||||
this.tracker.b(entityplayer);
|
||||
entityplayer.d(this.tracker);
|
||||
this.entity.c(entityplayer);
|
||||
}
|
||||
|
||||
- public void a(Consumer<Packet<?>> consumer) {
|
||||
+ public void a(Consumer<Packet<?>> consumer, EntityPlayer entityplayer) { // CraftBukkit - add player
|
||||
if (this.tracker.dead) {
|
||||
- EntityTrackerEntry.LOGGER.warn("Fetching packet for removed entity " + this.tracker);
|
||||
if (this.entity.isRemoved()) {
|
||||
- EntityTrackerEntry.LOGGER.warn("Fetching packet for removed entity {}", this.entity);
|
||||
+ // CraftBukkit start - Remove useless error spam, just return
|
||||
+ // EntityTrackerEntry.LOGGER.warn("Fetching packet for removed entity " + this.tracker);
|
||||
+ // EntityTrackerEntry.LOGGER.warn("Fetching packet for removed entity {}", this.entity);
|
||||
+ return;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
Packet<?> packet = this.tracker.P();
|
||||
@@ -234,6 +279,12 @@
|
||||
if (this.tracker instanceof EntityLiving) {
|
||||
Collection<AttributeModifiable> collection = ((EntityLiving) this.tracker).getAttributeMap().b();
|
||||
Packet<?> packet = this.entity.getPacket();
|
||||
@@ -240,6 +286,12 @@
|
||||
if (this.entity instanceof EntityLiving) {
|
||||
Collection<AttributeModifiable> collection = ((EntityLiving) this.entity).getAttributeMap().b();
|
||||
|
||||
+ // CraftBukkit start - If sending own attributes send scaled health instead of current maximum health
|
||||
+ if (this.tracker.getId() == entityplayer.getId()) {
|
||||
+ ((EntityPlayer) this.tracker).getBukkitEntity().injectScaledMaxHealth(collection, false);
|
||||
+ if (this.entity.getId() == entityplayer.getId()) {
|
||||
+ ((EntityPlayer) this.entity).getBukkitEntity().injectScaledMaxHealth(collection, false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (!collection.isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutUpdateAttributes(this.tracker.getId(), collection));
|
||||
consumer.accept(new PacketPlayOutUpdateAttributes(this.entity.getId(), collection));
|
||||
}
|
||||
@@ -265,8 +316,14 @@
|
||||
@@ -271,8 +323,14 @@
|
||||
if (!list.isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutEntityEquipment(this.tracker.getId(), list));
|
||||
consumer.accept(new PacketPlayOutEntityEquipment(this.entity.getId(), list));
|
||||
}
|
||||
+ ((EntityLiving) this.tracker).updateEquipment(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending
|
||||
+ ((EntityLiving) this.entity).updateEquipment(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Fix for nonsensical head yaw
|
||||
+ this.headYaw = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F);
|
||||
+ consumer.accept(new PacketPlayOutEntityHeadRotation(this.tracker, (byte) headYaw));
|
||||
+ this.yHeadRotp = MathHelper.d(this.entity.getHeadRotation() * 256.0F / 360.0F);
|
||||
+ consumer.accept(new PacketPlayOutEntityHeadRotation(this.entity, (byte) yHeadRotp));
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.tracker instanceof EntityLiving) {
|
||||
EntityLiving entityliving = (EntityLiving) this.tracker;
|
||||
if (this.entity instanceof EntityLiving) {
|
||||
EntityLiving entityliving = (EntityLiving) this.entity;
|
||||
Iterator iterator = entityliving.getEffects().iterator();
|
||||
@@ -307,6 +364,11 @@
|
||||
Set<AttributeModifiable> set = ((EntityLiving) this.tracker).getAttributeMap().getAttributes();
|
||||
@@ -313,6 +371,11 @@
|
||||
Set<AttributeModifiable> set = ((EntityLiving) this.entity).getAttributeMap().getAttributes();
|
||||
|
||||
if (!set.isEmpty()) {
|
||||
+ // CraftBukkit start - Send scaled max health
|
||||
+ if (this.tracker instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) this.tracker).getBukkitEntity().injectScaledMaxHealth(set, false);
|
||||
+ if (this.entity instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) this.entity).getBukkitEntity().injectScaledMaxHealth(set, false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.broadcastIncludingSelf(new PacketPlayOutUpdateAttributes(this.tracker.getId(), set));
|
||||
this.broadcastIncludingSelf(new PacketPlayOutUpdateAttributes(this.entity.getId(), set));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/PlayerChunk.java
|
||||
+++ b/net/minecraft/server/level/PlayerChunk.java
|
||||
@@ -33,6 +33,10 @@
|
||||
@@ -38,6 +38,10 @@
|
||||
import net.minecraft.world.level.chunk.ProtoChunkExtension;
|
||||
import net.minecraft.world.level.lighting.LightEngine;
|
||||
|
||||
@@ -10,18 +10,23 @@
|
||||
+
|
||||
public class PlayerChunk {
|
||||
|
||||
public static final Either<IChunkAccess, PlayerChunk.Failure> UNLOADED_CHUNK_ACCESS = Either.right(PlayerChunk.Failure.b);
|
||||
@@ -65,7 +69,7 @@
|
||||
this.fullChunkFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE;
|
||||
this.tickingFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE;
|
||||
this.entityTickingFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE;
|
||||
- this.chunkSave = CompletableFuture.completedFuture((Object) null);
|
||||
+ this.chunkSave = CompletableFuture.completedFuture(null); // CraftBukkit - decompile error
|
||||
this.dirtyBlocks = new ShortSet[16];
|
||||
this.location = chunkcoordintpair;
|
||||
public static final Either<IChunkAccess, PlayerChunk.Failure> UNLOADED_CHUNK = Either.right(PlayerChunk.Failure.UNLOADED);
|
||||
@@ -75,11 +79,11 @@
|
||||
this.fullChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
this.tickingChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
this.entityTickingChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
- this.chunkToSave = CompletableFuture.completedFuture((Object) null);
|
||||
+ this.chunkToSave = CompletableFuture.completedFuture(null); // CraftBukkit - decompile error
|
||||
this.chunkToSaveHistory = null;
|
||||
this.blockChangedLightSectionFilter = new BitSet();
|
||||
this.skyChangedLightSectionFilter = new BitSet();
|
||||
- this.pendingFullStateConfirmation = CompletableFuture.completedFuture((Object) null);
|
||||
+ this.pendingFullStateConfirmation = CompletableFuture.completedFuture(null); // CraftBukkit - decompile error
|
||||
this.pos = chunkcoordintpair;
|
||||
this.levelHeightAccessor = levelheightaccessor;
|
||||
this.lightEngine = lightengine;
|
||||
@@ -77,6 +81,19 @@
|
||||
this.a(i);
|
||||
@@ -92,6 +96,19 @@
|
||||
this.changedBlocksPerSection = new ShortSet[levelheightaccessor.getSectionsCount()];
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@@ -38,9 +43,9 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> getStatusFutureUnchecked(ChunkStatus chunkstatus) {
|
||||
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.statusFutures.get(chunkstatus.c());
|
||||
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.futures.get(chunkstatus.c());
|
||||
|
||||
@@ -102,9 +119,9 @@
|
||||
@@ -117,9 +134,9 @@
|
||||
@Nullable
|
||||
public Chunk getChunk() {
|
||||
CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture = this.a();
|
||||
@@ -52,25 +57,34 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -135,6 +152,7 @@
|
||||
@@ -164,6 +181,7 @@
|
||||
if (chunk != null) {
|
||||
byte b0 = (byte) SectionPosition.a(blockposition.getY());
|
||||
int i = this.levelHeightAccessor.getSectionIndex(blockposition.getY());
|
||||
|
||||
+ if (b0 < 0 || b0 >= this.dirtyBlocks.length) return; // CraftBukkit - SPIGOT-6086, SPIGOT-6296
|
||||
if (this.dirtyBlocks[b0] == null) {
|
||||
this.p = true;
|
||||
this.dirtyBlocks[b0] = new ShortArraySet();
|
||||
@@ -237,7 +255,7 @@
|
||||
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.statusFutures.get(i);
|
||||
+ if (i < 0 || i >= this.changedBlocksPerSection.length) return; // CraftBukkit - SPIGOT-6086, SPIGOT-6296
|
||||
if (this.changedBlocksPerSection[i] == null) {
|
||||
this.hasChangedSections = true;
|
||||
this.changedBlocksPerSection[i] = new ShortArraySet();
|
||||
@@ -274,7 +292,7 @@
|
||||
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.futures.get(i);
|
||||
|
||||
if (completablefuture != null) {
|
||||
- Either<IChunkAccess, PlayerChunk.Failure> either = (Either) completablefuture.getNow((Object) null);
|
||||
+ Either<IChunkAccess, PlayerChunk.Failure> either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error
|
||||
boolean flag = either != null && either.right().isPresent();
|
||||
|
||||
if (either == null || either.left().isPresent()) {
|
||||
return completablefuture;
|
||||
@@ -292,6 +310,30 @@
|
||||
boolean flag1 = this.ticketLevel <= PlayerChunkMap.GOLDEN_TICKET;
|
||||
if (!flag) {
|
||||
@@ -341,7 +359,7 @@
|
||||
this.pendingFullStateConfirmation = completablefuture1;
|
||||
completablefuture.thenAccept((either) -> {
|
||||
either.ifLeft((chunk) -> {
|
||||
- completablefuture1.complete((Object) null);
|
||||
+ completablefuture1.complete(null); // CraftBukkit - decompile error
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -358,6 +376,30 @@
|
||||
boolean flag1 = this.ticketLevel <= PlayerChunkMap.MAX_CHUNK_DISTANCE;
|
||||
PlayerChunk.State playerchunk_state = getChunkState(this.oldTicketLevel);
|
||||
PlayerChunk.State playerchunk_state1 = getChunkState(this.ticketLevel);
|
||||
+ // CraftBukkit start
|
||||
@@ -89,7 +103,7 @@
|
||||
+ }
|
||||
+ }).exceptionally((throwable) -> {
|
||||
+ // ensure exceptions are printed, by default this is not the case
|
||||
+ MinecraftServer.LOGGER.fatal("Failed to schedule unload callback for chunk " + PlayerChunk.this.location, throwable);
|
||||
+ MinecraftServer.LOGGER.fatal("Failed to schedule unload callback for chunk " + PlayerChunk.this.pos, throwable);
|
||||
+ return null;
|
||||
+ });
|
||||
+
|
||||
@@ -100,18 +114,18 @@
|
||||
CompletableFuture completablefuture;
|
||||
|
||||
if (flag) {
|
||||
@@ -323,7 +365,7 @@
|
||||
@@ -388,7 +430,7 @@
|
||||
if (flag2 && !flag3) {
|
||||
completablefuture = this.fullChunkFuture;
|
||||
this.fullChunkFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE;
|
||||
this.fullChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
- this.a(completablefuture.thenApply((either1) -> {
|
||||
+ this.a(((CompletableFuture<Either<Chunk, PlayerChunk.Failure>>) completablefuture).thenApply((either1) -> { // CraftBukkit - decompile error
|
||||
playerchunkmap.getClass();
|
||||
Objects.requireNonNull(playerchunkmap);
|
||||
return either1.ifLeft(playerchunkmap::a);
|
||||
}));
|
||||
@@ -361,6 +403,26 @@
|
||||
}), "unfull");
|
||||
@@ -432,6 +474,26 @@
|
||||
|
||||
this.u.a(this.location, this::k, this.ticketLevel, this::d);
|
||||
this.onLevelChange.a(this.pos, this::k, this.ticketLevel, this::d);
|
||||
this.oldTicketLevel = this.ticketLevel;
|
||||
+ // CraftBukkit start
|
||||
+ // ChunkLoadEvent: Called after the chunk is loaded: isChunkLoaded returns true and chunk is ready to be modified by plugins.
|
||||
@@ -125,7 +139,7 @@
|
||||
+ }
|
||||
+ }).exceptionally((throwable) -> {
|
||||
+ // ensure exceptions are printed, by default this is not the case
|
||||
+ MinecraftServer.LOGGER.fatal("Failed to schedule load callback for chunk " + PlayerChunk.this.location, throwable);
|
||||
+ MinecraftServer.LOGGER.fatal("Failed to schedule load callback for chunk " + PlayerChunk.this.pos, throwable);
|
||||
+ return null;
|
||||
+ });
|
||||
+
|
||||
|
||||
@@ -1,47 +1,43 @@
|
||||
--- a/net/minecraft/server/level/PlayerChunkMap.java
|
||||
+++ b/net/minecraft/server/level/PlayerChunkMap.java
|
||||
@@ -89,6 +89,8 @@
|
||||
@@ -91,6 +91,8 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+import org.bukkit.entity.Player; // CraftBukkit
|
||||
+
|
||||
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.e {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -119,6 +121,31 @@
|
||||
private final Queue<Runnable> A;
|
||||
private int viewDistance;
|
||||
private static final byte CHUNK_TYPE_REPLACEABLE = -1;
|
||||
@@ -129,6 +131,27 @@
|
||||
private final Queue<Runnable> unloadQueue;
|
||||
int viewDistance;
|
||||
|
||||
+ // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback()
|
||||
+ public final CallbackExecutor callbackExecutor = new CallbackExecutor();
|
||||
+ public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable {
|
||||
+
|
||||
+ private Runnable queued;
|
||||
+ private final java.util.Queue<Runnable> queue = new java.util.ArrayDeque<>();
|
||||
+
|
||||
+ @Override
|
||||
+ public void execute(Runnable runnable) {
|
||||
+ if (queued != null) {
|
||||
+ throw new IllegalStateException("Already queued");
|
||||
+ }
|
||||
+ queued = runnable;
|
||||
+ queue.add(runnable);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void run() {
|
||||
+ Runnable task = queued;
|
||||
+ queued = null;
|
||||
+ if (task != null) {
|
||||
+ Runnable task;
|
||||
+ while ((task = queue.poll()) != null) {
|
||||
+ task.run();
|
||||
+ }
|
||||
+ }
|
||||
+ };
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, Supplier<WorldPersistentData> supplier, int i, boolean flag) {
|
||||
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier<WorldPersistentData> supplier, int i, boolean flag) {
|
||||
super(new File(convertable_conversionsession.a(worldserver.getDimensionKey()), "region"), datafixer, flag);
|
||||
this.visibleChunks = this.updatingChunks.clone();
|
||||
@@ -239,9 +266,12 @@
|
||||
this.visibleChunkMap = this.updatingChunkMap.clone();
|
||||
@@ -279,9 +302,12 @@
|
||||
|
||||
return completablefuture1.thenApply((list1) -> {
|
||||
List<IChunkAccess> list2 = Lists.newArrayList();
|
||||
@@ -56,24 +52,24 @@
|
||||
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
|
||||
Optional<IChunkAccess> optional = either.left();
|
||||
|
||||
@@ -344,7 +374,7 @@
|
||||
PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.w.getName());
|
||||
@@ -389,7 +415,7 @@
|
||||
PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.storageFolder.getName());
|
||||
} else {
|
||||
this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).forEach((playerchunk) -> {
|
||||
this.visibleChunkMap.values().stream().filter(PlayerChunk::hasBeenLoaded).forEach((playerchunk) -> {
|
||||
- IChunkAccess ichunkaccess = (IChunkAccess) playerchunk.getChunkSave().getNow((Object) null);
|
||||
+ IChunkAccess ichunkaccess = (IChunkAccess) playerchunk.getChunkSave().getNow(null); // CraftBukkit - decompile error
|
||||
|
||||
if (ichunkaccess instanceof ProtoChunkExtension || ichunkaccess instanceof Chunk) {
|
||||
this.saveChunk(ichunkaccess);
|
||||
@@ -355,7 +385,6 @@
|
||||
@@ -400,7 +426,6 @@
|
||||
}
|
||||
|
||||
}
|
||||
-
|
||||
protected void unloadChunks(BooleanSupplier booleansupplier) {
|
||||
GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler();
|
||||
GameProfilerFiller gameprofilerfiller = this.level.getMethodProfiler();
|
||||
|
||||
@@ -394,7 +423,7 @@
|
||||
@@ -439,7 +464,7 @@
|
||||
|
||||
private void a(long i, PlayerChunk playerchunk) {
|
||||
CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkSave();
|
||||
@@ -82,42 +78,40 @@
|
||||
CompletableFuture<IChunkAccess> completablefuture1 = playerchunk.getChunkSave();
|
||||
|
||||
if (completablefuture1 != completablefuture) {
|
||||
@@ -616,8 +645,23 @@
|
||||
@@ -615,7 +640,21 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
+ // CraftBukkit start - these are spawned serialized (DefinedStructure) and we don't call an add event below at the moment due to ordering complexities
|
||||
+ boolean needsRemoval = false;
|
||||
+ if (chunk.needsDecoration) {
|
||||
+ net.minecraft.server.dedicated.DedicatedServer server = this.world.getServer().getServer();
|
||||
+ if (!server.getSpawnNPCs() && entity instanceof net.minecraft.world.entity.npc.NPC) {
|
||||
+ entity.die();
|
||||
+ needsRemoval = true;
|
||||
+ }
|
||||
+
|
||||
+ if (!server.getSpawnAnimals() && (entity instanceof net.minecraft.world.entity.animal.EntityAnimal || entity instanceof net.minecraft.world.entity.animal.EntityWaterAnimal)) {
|
||||
+ entity.die();
|
||||
+ needsRemoval = true;
|
||||
+ }
|
||||
+ }
|
||||
private static void a(WorldServer worldserver, List<NBTTagCompound> list) {
|
||||
if (!list.isEmpty()) {
|
||||
- worldserver.b(EntityTypes.a(list, (World) worldserver));
|
||||
+ // CraftBukkit start - these are spawned serialized (DefinedStructure) and we don't call an add event below at the moment due to ordering complexities
|
||||
+ worldserver.b(EntityTypes.a(list, (World) worldserver).filter((entity) -> {
|
||||
+ boolean needsRemoval = false;
|
||||
+ net.minecraft.server.dedicated.DedicatedServer server = worldserver.getServer().getServer();
|
||||
+ if (!server.getSpawnNPCs() && entity instanceof net.minecraft.world.entity.npc.NPC) {
|
||||
+ entity.die();
|
||||
+ needsRemoval = true;
|
||||
+ }
|
||||
+ if (!server.getSpawnAnimals() && (entity instanceof net.minecraft.world.entity.animal.EntityAnimal || entity instanceof net.minecraft.world.entity.animal.EntityWaterAnimal)) {
|
||||
+ entity.die();
|
||||
+ needsRemoval = true;
|
||||
+ }
|
||||
+ return !needsRemoval;
|
||||
+ }));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
- if (!(entity instanceof EntityHuman) && !this.world.addEntityChunk(entity)) {
|
||||
+ if (!(entity instanceof EntityHuman) && (needsRemoval || !this.world.addEntityChunk(entity))) {
|
||||
+ // CraftBukkit end
|
||||
if (list == null) {
|
||||
list = Lists.newArrayList(new Entity[]{entity});
|
||||
} else {
|
||||
@@ -828,7 +872,8 @@
|
||||
}
|
||||
@@ -843,7 +882,8 @@
|
||||
return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty();
|
||||
});
|
||||
|
||||
- csvwriter.a(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getChunkStatus).orElse((Object) null), optional1.map(Chunk::getState).orElse((Object) null), a(playerchunk.c()), a(playerchunk.a()), a(playerchunk.b()), this.chunkDistanceManager.c(entry.getLongKey()), !this.isOutsideOfRange(chunkcoordintpair), optional1.map((chunk) -> {
|
||||
- csvwriter.a(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getChunkStatus).orElse((Object) null), optional1.map(Chunk::getState).orElse((Object) null), a(playerchunk.c()), a(playerchunk.a()), a(playerchunk.b()), this.distanceManager.c(entry.getLongKey()), !this.isOutsideOfRange(chunkcoordintpair), optional1.map((chunk) -> {
|
||||
+ // CraftBukkit - decompile error
|
||||
+ csvwriter.a(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getChunkStatus).orElse(null), optional1.map(Chunk::getState).orElse(null), a(playerchunk.c()), a(playerchunk.a()), a(playerchunk.b()), this.chunkDistanceManager.c(entry.getLongKey()), !this.isOutsideOfRange(chunkcoordintpair), optional1.map((chunk) -> {
|
||||
return Stream.of(chunk.getEntitySlices()).mapToInt(EntitySlice::size).sum();
|
||||
}).orElse(0), optional1.map((chunk) -> {
|
||||
+ csvwriter.a(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getChunkStatus).orElse(null), optional1.map(Chunk::getState).orElse(null), a(playerchunk.c()), a(playerchunk.a()), a(playerchunk.b()), this.distanceManager.c(entry.getLongKey()), !this.isOutsideOfRange(chunkcoordintpair), optional1.map((chunk) -> {
|
||||
return chunk.getTileEntities().size();
|
||||
@@ -839,7 +884,7 @@
|
||||
}).orElse(0));
|
||||
}
|
||||
@@ -852,7 +892,7 @@
|
||||
|
||||
private static String a(CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture) {
|
||||
try {
|
||||
@@ -126,48 +120,41 @@
|
||||
|
||||
return either != null ? (String) either.map((chunk) -> {
|
||||
return "done";
|
||||
@@ -857,7 +902,7 @@
|
||||
@@ -870,7 +910,7 @@
|
||||
private NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException {
|
||||
NBTTagCompound nbttagcompound = this.read(chunkcoordintpair);
|
||||
|
||||
- return nbttagcompound == null ? null : this.getChunkData(this.world.getDimensionKey(), this.l, nbttagcompound);
|
||||
+ return nbttagcompound == null ? null : this.getChunkData(this.world.getTypeKey(), this.l, nbttagcompound, chunkcoordintpair, world); // CraftBukkit
|
||||
- return nbttagcompound == null ? null : this.getChunkData(this.level.getDimensionKey(), this.overworldDataStorage, nbttagcompound);
|
||||
+ return nbttagcompound == null ? null : this.getChunkData(this.level.getTypeKey(), this.overworldDataStorage, nbttagcompound, chunkcoordintpair, level); // CraftBukkit
|
||||
}
|
||||
|
||||
boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) {
|
||||
@@ -1189,7 +1234,7 @@
|
||||
public final Set<EntityPlayer> trackedPlayers = Sets.newHashSet();
|
||||
@@ -1233,7 +1273,7 @@
|
||||
public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet();
|
||||
|
||||
public EntityTracker(Entity entity, int i, int j, boolean flag) {
|
||||
- this.trackerEntry = new EntityTrackerEntry(PlayerChunkMap.this.world, entity, j, flag, this::broadcast);
|
||||
+ this.trackerEntry = new EntityTrackerEntry(PlayerChunkMap.this.world, entity, j, flag, this::broadcast, trackedPlayers); // CraftBukkit
|
||||
this.tracker = entity;
|
||||
this.trackingDistance = i;
|
||||
this.e = SectionPosition.a(entity);
|
||||
@@ -1242,7 +1287,7 @@
|
||||
- this.serverEntity = new EntityTrackerEntry(PlayerChunkMap.this.level, entity, j, flag, this::broadcast);
|
||||
+ this.serverEntity = new EntityTrackerEntry(PlayerChunkMap.this.level, entity, j, flag, this::broadcast, seenBy); // CraftBukkit
|
||||
this.entity = entity;
|
||||
this.range = i;
|
||||
this.lastSectionPos = SectionPosition.a(entity);
|
||||
@@ -1286,10 +1326,18 @@
|
||||
|
||||
public void updatePlayer(EntityPlayer entityplayer) {
|
||||
if (entityplayer != this.tracker) {
|
||||
- Vec3D vec3d = entityplayer.getPositionVector().d(this.trackerEntry.b());
|
||||
+ Vec3D vec3d = entityplayer.getPositionVector().d(this.tracker.getPositionVector()); // MC-155077, SPIGOT-5113
|
||||
if (entityplayer != this.entity) {
|
||||
- Vec3D vec3d = entityplayer.getPositionVector().d(this.serverEntity.b());
|
||||
+ Vec3D vec3d = entityplayer.getPositionVector().d(this.entity.getPositionVector()); // MC-155077, SPIGOT-5113
|
||||
int i = Math.min(this.b(), (PlayerChunkMap.this.viewDistance - 1) * 16);
|
||||
boolean flag = vec3d.x >= (double) (-i) && vec3d.x <= (double) i && vec3d.z >= (double) (-i) && vec3d.z <= (double) i && this.tracker.a(entityplayer);
|
||||
boolean flag = vec3d.x >= (double) (-i) && vec3d.x <= (double) i && vec3d.z >= (double) (-i) && vec3d.z <= (double) i && this.entity.a(entityplayer);
|
||||
|
||||
@@ -1258,6 +1303,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - respect vanish API
|
||||
+ if (this.tracker instanceof EntityPlayer) {
|
||||
+ Player player = ((EntityPlayer) this.tracker).getBukkitEntity();
|
||||
+ if (!entityplayer.getBukkitEntity().canSee(player)) {
|
||||
+ flag1 = false;
|
||||
+ }
|
||||
+ // CraftBukkit start - respect vanish API
|
||||
+ if (this.entity instanceof EntityPlayer) {
|
||||
+ Player player = ((EntityPlayer) this.entity).getBukkitEntity();
|
||||
+ if (!entityplayer.getBukkitEntity().canSee(player)) {
|
||||
+ flag = false;
|
||||
+ }
|
||||
+
|
||||
+ entityplayer.removeQueue.remove(Integer.valueOf(this.tracker.getId()));
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (flag1 && this.trackedPlayers.add(entityplayer)) {
|
||||
this.trackerEntry.b(entityplayer);
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (flag) {
|
||||
if (this.seenBy.add(entityplayer.connection)) {
|
||||
this.serverEntity.b(entityplayer);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/PlayerInteractManager.java
|
||||
+++ b/net/minecraft/server/level/PlayerInteractManager.java
|
||||
@@ -26,6 +26,25 @@
|
||||
@@ -25,6 +25,25 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -26,49 +26,49 @@
|
||||
public class PlayerInteractManager {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -60,7 +79,7 @@
|
||||
this.gamemode = enumgamemode;
|
||||
enumgamemode.a(this.player.abilities);
|
||||
@@ -65,7 +84,7 @@
|
||||
this.gameModeForPlayer = enumgamemode;
|
||||
enumgamemode.a(this.player.getAbilities());
|
||||
this.player.updateAbilities();
|
||||
- this.player.server.getPlayerList().sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_GAME_MODE, new EntityPlayer[]{this.player}));
|
||||
+ this.player.server.getPlayerList().sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_GAME_MODE, new EntityPlayer[]{this.player}), this.player); // CraftBukkit
|
||||
this.world.everyoneSleeping();
|
||||
this.level.everyoneSleeping();
|
||||
}
|
||||
|
||||
@@ -89,7 +108,7 @@
|
||||
@@ -87,7 +106,7 @@
|
||||
}
|
||||
|
||||
public void a() {
|
||||
- ++this.currentTick;
|
||||
+ this.currentTick = MinecraftServer.currentTick; // CraftBukkit;
|
||||
- ++this.gameTicks;
|
||||
+ this.gameTicks = MinecraftServer.currentTick; // CraftBukkit;
|
||||
IBlockData iblockdata;
|
||||
|
||||
if (this.j) {
|
||||
@@ -145,9 +164,31 @@
|
||||
if (this.hasDelayedDestroy) {
|
||||
@@ -143,9 +162,31 @@
|
||||
|
||||
if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.START_DESTROY_BLOCK) {
|
||||
if (!this.world.a((EntityHuman) this.player, blockposition)) {
|
||||
if (!this.level.a((EntityHuman) this.player, blockposition)) {
|
||||
+ // CraftBukkit start - fire PlayerInteractEvent
|
||||
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.inventory.getItemInHand(), EnumHand.MAIN_HAND);
|
||||
this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false, "may not interact"));
|
||||
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.getInventory().getItemInHand(), EnumHand.MAIN_HAND);
|
||||
this.player.connection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.level.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false, "may not interact"));
|
||||
+ // Update any tile entity data for this block
|
||||
+ TileEntity tileentity = world.getTileEntity(blockposition);
|
||||
+ TileEntity tileentity = level.getTileEntity(blockposition);
|
||||
+ if (tileentity != null) {
|
||||
+ this.player.playerConnection.sendPacket(tileentity.getUpdatePacket());
|
||||
+ this.player.connection.sendPacket(tileentity.getUpdatePacket());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.inventory.getItemInHand(), EnumHand.MAIN_HAND);
|
||||
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.getInventory().getItemInHand(), EnumHand.MAIN_HAND);
|
||||
+ if (event.isCancelled()) {
|
||||
+ // Let the client know the block still exists
|
||||
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutBlockChange(this.level, blockposition));
|
||||
+ // Update any tile entity data for this block
|
||||
+ TileEntity tileentity = this.world.getTileEntity(blockposition);
|
||||
+ TileEntity tileentity = this.level.getTileEntity(blockposition);
|
||||
+ if (tileentity != null) {
|
||||
+ this.player.playerConnection.sendPacket(tileentity.getUpdatePacket());
|
||||
+ this.player.connection.sendPacket(tileentity.getUpdatePacket());
|
||||
+ }
|
||||
return;
|
||||
}
|
||||
@@ -76,40 +76,40 @@
|
||||
|
||||
if (this.isCreative()) {
|
||||
this.a(blockposition, packetplayinblockdig_enumplayerdigtype, "creative destroy");
|
||||
@@ -163,11 +204,43 @@
|
||||
@@ -161,11 +202,43 @@
|
||||
float f = 1.0F;
|
||||
|
||||
iblockdata = this.world.getType(blockposition);
|
||||
iblockdata = this.level.getType(blockposition);
|
||||
- if (!iblockdata.isAir()) {
|
||||
+ // CraftBukkit start - Swings at air do *NOT* exist.
|
||||
+ if (event.useInteractedBlock() == Event.Result.DENY) {
|
||||
+ // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
|
||||
+ IBlockData data = this.world.getType(blockposition);
|
||||
+ IBlockData data = this.level.getType(blockposition);
|
||||
+ if (data.getBlock() instanceof BlockDoor) {
|
||||
+ // For some reason *BOTH* the bottom/top part have to be marked updated.
|
||||
+ boolean bottom = data.get(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER;
|
||||
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition));
|
||||
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, bottom ? blockposition.up() : blockposition.down()));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutBlockChange(this.level, blockposition));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutBlockChange(this.level, bottom ? blockposition.up() : blockposition.down()));
|
||||
+ } else if (data.getBlock() instanceof BlockTrapdoor) {
|
||||
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutBlockChange(this.level, blockposition));
|
||||
+ }
|
||||
+ } else if (!iblockdata.isAir()) {
|
||||
iblockdata.attack(this.world, blockposition, this.player);
|
||||
f = iblockdata.getDamage(this.player, this.player.world, blockposition);
|
||||
iblockdata.attack(this.level, blockposition, this.player);
|
||||
f = iblockdata.getDamage(this.player, this.player.level, blockposition);
|
||||
}
|
||||
|
||||
+ if (event.useItemInHand() == Event.Result.DENY) {
|
||||
+ // If we 'insta destroyed' then the client needs to be informed.
|
||||
+ if (f > 1.0f) {
|
||||
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutBlockChange(this.level, blockposition));
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+ org.bukkit.event.block.BlockDamageEvent blockEvent = CraftEventFactory.callBlockDamageEvent(this.player, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.player.inventory.getItemInHand(), f >= 1.0f);
|
||||
+ org.bukkit.event.block.BlockDamageEvent blockEvent = CraftEventFactory.callBlockDamageEvent(this.player, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.player.getInventory().getItemInHand(), f >= 1.0f);
|
||||
+
|
||||
+ if (blockEvent.isCancelled()) {
|
||||
+ // Let the client know the block still exists
|
||||
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutBlockChange(this.level, blockposition));
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@@ -121,41 +121,40 @@
|
||||
if (!iblockdata.isAir() && f >= 1.0F) {
|
||||
this.a(blockposition, packetplayinblockdig_enumplayerdigtype, "insta mine");
|
||||
} else {
|
||||
@@ -211,7 +284,7 @@
|
||||
@@ -209,7 +282,7 @@
|
||||
} else if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.ABORT_DESTROY_BLOCK) {
|
||||
this.f = false;
|
||||
if (!Objects.equals(this.h, blockposition)) {
|
||||
- PlayerInteractManager.LOGGER.warn("Mismatch in destroy block pos: " + this.h + " " + blockposition);
|
||||
+ PlayerInteractManager.LOGGER.debug("Mismatch in destroy block pos: " + this.h + " " + blockposition); // CraftBukkit - SPIGOT-5457 sent by client when interact event cancelled
|
||||
this.world.a(this.player.getId(), this.h, -1);
|
||||
this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(this.h, this.world.getType(this.h), packetplayinblockdig_enumplayerdigtype, true, "aborted mismatched destroying"));
|
||||
this.isDestroyingBlock = false;
|
||||
if (!Objects.equals(this.destroyPos, blockposition)) {
|
||||
- PlayerInteractManager.LOGGER.warn("Mismatch in destroy block pos: {} {}", this.destroyPos, blockposition);
|
||||
+ PlayerInteractManager.LOGGER.debug("Mismatch in destroy block pos: {} {}", this.destroyPos, blockposition); // CraftBukkit - SPIGOT-5457 sent by client when interact event cancelled
|
||||
this.level.a(this.player.getId(), this.destroyPos, -1);
|
||||
this.player.connection.sendPacket(new PacketPlayOutBlockBreak(this.destroyPos, this.level.getType(this.destroyPos), packetplayinblockdig_enumplayerdigtype, true, "aborted mismatched destroying"));
|
||||
}
|
||||
@@ -227,17 +300,73 @@
|
||||
@@ -225,17 +298,72 @@
|
||||
if (this.breakBlock(blockposition)) {
|
||||
this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, true, s));
|
||||
this.player.connection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.level.getType(blockposition), packetplayinblockdig_enumplayerdigtype, true, s));
|
||||
} else {
|
||||
- this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false, s));
|
||||
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition)); // CraftBukkit - SPIGOT-5196
|
||||
- this.player.connection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.level.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false, s));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutBlockChange(this.level, blockposition)); // CraftBukkit - SPIGOT-5196
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean breakBlock(BlockPosition blockposition) {
|
||||
IBlockData iblockdata = this.world.getType(blockposition);
|
||||
IBlockData iblockdata = this.level.getType(blockposition);
|
||||
+ // CraftBukkit start - fire BlockBreakEvent
|
||||
+ org.bukkit.block.Block bblock = CraftBlock.at(world, blockposition);
|
||||
+ org.bukkit.block.Block bblock = CraftBlock.at(level, blockposition);
|
||||
+ BlockBreakEvent event = null;
|
||||
+
|
||||
+ if (this.player instanceof EntityPlayer) {
|
||||
+ // Sword + Creative mode pre-cancel
|
||||
+ boolean isSwordNoBreak = !this.player.getItemInMainHand().getItem().a(iblockdata, this.world, blockposition, (EntityHuman) this.player);
|
||||
+ boolean isSwordNoBreak = !this.player.getItemInMainHand().getItem().a(iblockdata, this.level, blockposition, (EntityHuman) this.player);
|
||||
+
|
||||
+ // Tell client the block is gone immediately then process events
|
||||
+ // Don't tell the client if its a creative sword break because its not broken!
|
||||
+ if (world.getTileEntity(blockposition) == null && !isSwordNoBreak) {
|
||||
+ PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(this.world, blockposition);
|
||||
+ packet.block = Blocks.AIR.getBlockData();
|
||||
+ this.player.playerConnection.sendPacket(packet);
|
||||
+ if (level.getTileEntity(blockposition) == null && !isSwordNoBreak) {
|
||||
+ PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(blockposition, Blocks.AIR.getBlockData());
|
||||
+ this.player.connection.sendPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ event = new BlockBreakEvent(bblock, this.player.getBukkitEntity());
|
||||
@@ -164,60 +163,60 @@
|
||||
+ event.setCancelled(isSwordNoBreak);
|
||||
+
|
||||
+ // Calculate default block experience
|
||||
+ IBlockData nmsData = this.world.getType(blockposition);
|
||||
+ IBlockData nmsData = this.level.getType(blockposition);
|
||||
+ Block nmsBlock = nmsData.getBlock();
|
||||
+
|
||||
+ ItemStack itemstack = this.player.getEquipment(EnumItemSlot.MAINHAND);
|
||||
+
|
||||
+ if (nmsBlock != null && !event.isCancelled() && !this.isCreative() && this.player.hasBlock(nmsBlock.getBlockData())) {
|
||||
+ event.setExpToDrop(nmsBlock.getExpDrop(nmsData, this.world, blockposition, itemstack));
|
||||
+ event.setExpToDrop(nmsBlock.getExpDrop(nmsData, this.level, blockposition, itemstack));
|
||||
+ }
|
||||
|
||||
- if (!this.player.getItemInMainHand().getItem().a(iblockdata, (World) this.world, blockposition, (EntityHuman) this.player)) {
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
- if (!this.player.getItemInMainHand().getItem().a(iblockdata, (World) this.level, blockposition, (EntityHuman) this.player)) {
|
||||
+ this.level.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ if (isSwordNoBreak) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Let the client know the block still exists
|
||||
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutBlockChange(this.level, blockposition));
|
||||
+
|
||||
+ // Brute force all possible updates
|
||||
+ for (EnumDirection dir : EnumDirection.values()) {
|
||||
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition.shift(dir)));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutBlockChange(level, blockposition.shift(dir)));
|
||||
+ }
|
||||
+
|
||||
+ // Update any tile entity data for this block
|
||||
+ TileEntity tileentity = this.world.getTileEntity(blockposition);
|
||||
+ TileEntity tileentity = this.level.getTileEntity(blockposition);
|
||||
+ if (tileentity != null) {
|
||||
+ this.player.playerConnection.sendPacket(tileentity.getUpdatePacket());
|
||||
+ this.player.connection.sendPacket(tileentity.getUpdatePacket());
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ if (false && !this.player.getItemInMainHand().getItem().a(iblockdata, (World) this.world, blockposition, (EntityHuman) this.player)) { // CraftBukkit - false
|
||||
+ if (false && !this.player.getItemInMainHand().getItem().a(iblockdata, (World) this.level, blockposition, (EntityHuman) this.player)) { // CraftBukkit - false
|
||||
return false;
|
||||
} else {
|
||||
+ iblockdata = this.world.getType(blockposition); // CraftBukkit - update state from plugins
|
||||
+ iblockdata = this.level.getType(blockposition); // CraftBukkit - update state from plugins
|
||||
+ if (iblockdata.isAir()) return false; // CraftBukkit - A plugin set block to air without cancelling
|
||||
TileEntity tileentity = this.world.getTileEntity(blockposition);
|
||||
TileEntity tileentity = this.level.getTileEntity(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
@@ -247,6 +376,10 @@
|
||||
} else if (this.player.a((World) this.world, blockposition, this.gamemode)) {
|
||||
@@ -245,6 +373,10 @@
|
||||
} else if (this.player.a((World) this.level, blockposition, this.gameModeForPlayer)) {
|
||||
return false;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.BlockState state = bblock.getState();
|
||||
+ world.captureDrops = new ArrayList<>();
|
||||
+ level.captureDrops = new ArrayList<>();
|
||||
+ // CraftBukkit end
|
||||
block.a((World) this.world, blockposition, iblockdata, (EntityHuman) this.player);
|
||||
boolean flag = this.world.a(blockposition, false);
|
||||
block.a((World) this.level, blockposition, iblockdata, (EntityHuman) this.player);
|
||||
boolean flag = this.level.a(blockposition, false);
|
||||
|
||||
@@ -255,19 +388,32 @@
|
||||
@@ -253,19 +385,32 @@
|
||||
}
|
||||
|
||||
if (this.isCreative()) {
|
||||
@@ -228,10 +227,10 @@
|
||||
ItemStack itemstack1 = itemstack.cloneItemStack();
|
||||
boolean flag1 = this.player.hasBlock(iblockdata);
|
||||
|
||||
itemstack.a(this.world, iblockdata, blockposition, this.player);
|
||||
itemstack.a(this.level, iblockdata, blockposition, this.player);
|
||||
- if (flag && flag1) {
|
||||
+ if (flag && flag1 && event.isDropItems()) { // CraftBukkit - Check if block should drop items
|
||||
block.a(this.world, this.player, blockposition, iblockdata, tileentity, itemstack1);
|
||||
block.a(this.level, this.player, blockposition, iblockdata, tileentity, itemstack1);
|
||||
}
|
||||
|
||||
- return true;
|
||||
@@ -239,13 +238,13 @@
|
||||
+ }
|
||||
+ // CraftBukkit start
|
||||
+ if (event.isDropItems()) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, world.captureDrops);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, level.captureDrops);
|
||||
}
|
||||
+ world.captureDrops = null;
|
||||
+ level.captureDrops = null;
|
||||
+
|
||||
+ // Drop event experience
|
||||
+ if (flag && event != null) {
|
||||
+ iblockdata.getBlock().dropExperience(this.world, blockposition, event.getExpToDrop());
|
||||
+ iblockdata.getBlock().dropExperience(this.level, blockposition, event.getExpToDrop());
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
@@ -253,7 +252,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,12 +455,52 @@
|
||||
@@ -307,12 +452,52 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,7 +268,7 @@
|
||||
+ EnumInteractionResult enuminteractionresult = EnumInteractionResult.PASS;
|
||||
+ boolean cancelledBlock = false;
|
||||
|
||||
if (this.gamemode == EnumGamemode.SPECTATOR) {
|
||||
if (this.gameModeForPlayer == EnumGamemode.SPECTATOR) {
|
||||
ITileInventory itileinventory = iblockdata.b(world, blockposition);
|
||||
+ cancelledBlock = !(itileinventory instanceof ITileInventory);
|
||||
+ }
|
||||
@@ -289,24 +288,24 @@
|
||||
+ // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
|
||||
+ if (iblockdata.getBlock() instanceof BlockDoor) {
|
||||
+ boolean bottom = iblockdata.get(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER;
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, bottom ? blockposition.up() : blockposition.down()));
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutBlockChange(world, bottom ? blockposition.up() : blockposition.down()));
|
||||
+ } else if (iblockdata.getBlock() instanceof BlockCake) {
|
||||
+ entityplayer.getBukkitEntity().sendHealthUpdate(); // SPIGOT-1341 - reset health for cake
|
||||
+ } else if (interactItemStack.getItem() instanceof ItemBisected) {
|
||||
+ // send a correcting update to the client, as it already placed the upper half of the bisected item
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition.shift(movingobjectpositionblock.getDirection()).up()));
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutBlockChange(world, blockposition.shift(movingobjectpositionblock.getDirection()).up()));
|
||||
+
|
||||
+ // send a correcting update to the client for the block above as well, this because of replaceable blocks (such as grass, sea grass etc)
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition.up()));
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutBlockChange(world, blockposition.up()));
|
||||
+ }
|
||||
+ entityplayer.getBukkitEntity().updateInventory(); // SPIGOT-2867
|
||||
+ enuminteractionresult = (event.useItemInHand() != Event.Result.ALLOW) ? EnumInteractionResult.SUCCESS : EnumInteractionResult.PASS;
|
||||
+ } else if (this.gamemode == EnumGamemode.SPECTATOR) {
|
||||
+ } else if (this.gameModeForPlayer == EnumGamemode.SPECTATOR) {
|
||||
+ ITileInventory itileinventory = iblockdata.b(world, blockposition);
|
||||
|
||||
if (itileinventory != null) {
|
||||
entityplayer.openContainer(itileinventory);
|
||||
@@ -328,7 +514,7 @@
|
||||
@@ -326,7 +511,7 @@
|
||||
ItemStack itemstack1 = itemstack.cloneItemStack();
|
||||
|
||||
if (!flag1) {
|
||||
@@ -314,8 +313,8 @@
|
||||
+ enuminteractionresult = iblockdata.interact(world, entityplayer, enumhand, movingobjectpositionblock);
|
||||
|
||||
if (enuminteractionresult.a()) {
|
||||
CriterionTriggers.M.a(entityplayer, blockposition, itemstack1);
|
||||
@@ -336,17 +522,17 @@
|
||||
CriterionTriggers.ITEM_USED_ON_BLOCK.a(entityplayer, blockposition, itemstack1);
|
||||
@@ -334,17 +519,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,7 +335,7 @@
|
||||
}
|
||||
|
||||
if (enuminteractionresult1.a()) {
|
||||
@@ -354,10 +540,10 @@
|
||||
@@ -352,10 +537,10 @@
|
||||
}
|
||||
|
||||
return enuminteractionresult1;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/RegionLimitedWorldAccess.java
|
||||
+++ b/net/minecraft/server/level/RegionLimitedWorldAccess.java
|
||||
@@ -273,6 +273,13 @@
|
||||
@@ -308,6 +308,13 @@
|
||||
|
||||
@Override
|
||||
public boolean addEntity(Entity entity) {
|
||||
@@ -11,6 +11,6 @@
|
||||
+ @Override
|
||||
+ public boolean addEntity(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ // CraftBukkit end
|
||||
int i = MathHelper.floor(entity.locX() / 16.0D);
|
||||
int j = MathHelper.floor(entity.locZ() / 16.0D);
|
||||
int i = SectionPosition.a(entity.cW());
|
||||
int j = SectionPosition.a(entity.dc());
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/net/minecraft/server/level/WorldServer.java
|
||||
@@ -145,6 +145,21 @@
|
||||
@@ -152,6 +152,22 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
+import java.util.logging.Level;
|
||||
+import net.minecraft.world.entity.monster.EntityDrowned;
|
||||
+import net.minecraft.world.level.block.ITileEntity;
|
||||
+import net.minecraft.world.level.block.entity.TileEntity;
|
||||
+import net.minecraft.world.level.storage.WorldDataServer;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.WeatherType;
|
||||
@@ -21,21 +22,22 @@
|
||||
+
|
||||
public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
||||
public static final BlockPosition a = new BlockPosition(100, 50, 0);
|
||||
@@ -156,7 +171,7 @@
|
||||
private final ChunkProviderServer chunkProvider;
|
||||
boolean tickingEntities;
|
||||
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
|
||||
@@ -160,7 +176,7 @@
|
||||
final List<EntityPlayer> players;
|
||||
private final ChunkProviderServer chunkSource;
|
||||
private final MinecraftServer server;
|
||||
- public final IWorldDataServer worldDataServer;
|
||||
+ public final WorldDataServer worldDataServer; // CraftBukkit - type
|
||||
public boolean savingDisabled;
|
||||
private boolean everyoneSleeping;
|
||||
private int emptyTime;
|
||||
@@ -173,8 +188,23 @@
|
||||
private final StructureManager structureManager;
|
||||
private final boolean Q;
|
||||
- public final IWorldDataServer serverLevelData;
|
||||
+ public final WorldDataServer serverLevelData; // CraftBukkit - type
|
||||
final EntityTickList entityTickList;
|
||||
private final PersistentEntitySectionManager<Entity> entityManager;
|
||||
public boolean noSave;
|
||||
@@ -180,31 +196,52 @@
|
||||
private final StructureManager structureFeatureManager;
|
||||
private final boolean tickTime;
|
||||
|
||||
- public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1) {
|
||||
- Objects.requireNonNull(minecraftserver);
|
||||
- super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
@@ -44,50 +46,67 @@
|
||||
+ public final UUID uuid;
|
||||
+
|
||||
+ public Chunk getChunkIfLoaded(int x, int z) {
|
||||
+ return this.chunkProvider.getChunkAt(x, z, false);
|
||||
+ return this.chunkSource.getChunkAt(x, z, false);
|
||||
+ }
|
||||
+
|
||||
+ // Add env and gen to constructor, WorldData -> WorldDataServer
|
||||
+ public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
|
||||
+ // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
|
||||
+ super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env);
|
||||
+ this.pvpMode = minecraftserver.getPVP();
|
||||
+ convertable = convertable_conversionsession;
|
||||
+ uuid = WorldUUID.getUUID(convertable_conversionsession.folder.toFile());
|
||||
+ uuid = WorldUUID.getUUID(convertable_conversionsession.levelPath.toFile());
|
||||
+ // CraftBukkit end
|
||||
this.nextTickListBlock = new TickListServer<>(this, (block) -> {
|
||||
this.players = Lists.newArrayList();
|
||||
this.entityTickList = new EntityTickList();
|
||||
- Predicate predicate = (block) -> {
|
||||
+ Predicate<Block> predicate = (block) -> { // CraftBukkit - decompile eror
|
||||
return block == null || block.getBlockData().isAir();
|
||||
}, IRegistry.BLOCK::getKey, this::b);
|
||||
@@ -186,10 +216,17 @@
|
||||
this.Q = flag1;
|
||||
};
|
||||
RegistryBlocks registryblocks = IRegistry.BLOCK;
|
||||
|
||||
Objects.requireNonNull(registryblocks);
|
||||
- this.blockTicks = new TickListServer<>(this, predicate, registryblocks::getKey, this::b);
|
||||
- predicate = (fluidtype) -> {
|
||||
+ this.blockTicks = new TickListServer<>(this, predicate, IRegistry.BLOCK::getKey, this::b); // CraftBukkit - decompile error
|
||||
+ Predicate<FluidType> predicate2 = (fluidtype) -> { // CraftBukkit - decompile error
|
||||
return fluidtype == null || fluidtype == FluidTypes.EMPTY;
|
||||
};
|
||||
registryblocks = IRegistry.FLUID;
|
||||
Objects.requireNonNull(registryblocks);
|
||||
- this.liquidTicks = new TickListServer<>(this, predicate, registryblocks::getKey, this::a);
|
||||
+ this.liquidTicks = new TickListServer<>(this, predicate2, IRegistry.FLUID::getKey, this::a); // CraftBukkit - decompile error
|
||||
this.navigatingMobs = new ObjectOpenHashSet();
|
||||
this.blockEvents = new ObjectLinkedOpenHashSet();
|
||||
this.dragonParts = new Int2ObjectOpenHashMap();
|
||||
this.tickTime = flag1;
|
||||
this.server = minecraftserver;
|
||||
this.mobSpawners = list;
|
||||
- this.worldDataServer = iworlddataserver;
|
||||
this.customSpawners = list;
|
||||
- this.serverLevelData = iworlddataserver;
|
||||
+ // CraftBukkit start
|
||||
+ this.worldDataServer = (WorldDataServer) iworlddataserver;
|
||||
+ worldDataServer.world = this;
|
||||
+ this.serverLevelData = (WorldDataServer) iworlddataserver;
|
||||
+ serverLevelData.world = this;
|
||||
+ if (gen != null) {
|
||||
+ chunkgenerator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, chunkgenerator, gen);
|
||||
+ }
|
||||
+
|
||||
this.chunkProvider = new ChunkProviderServer(this, convertable_conversionsession, minecraftserver.getDataFixer(), minecraftserver.getDefinedStructureManager(), executor, chunkgenerator, minecraftserver.getPlayerList().getViewDistance(), minecraftserver.isSyncChunkWrites(), worldloadlistener, () -> {
|
||||
return minecraftserver.E().getWorldPersistentData();
|
||||
});
|
||||
+ // CraftBukkit end
|
||||
this.portalTravelAgent = new PortalTravelAgent(this);
|
||||
this.Q();
|
||||
this.R();
|
||||
@@ -201,14 +238,50 @@
|
||||
boolean flag2 = minecraftserver.isSyncChunkWrites();
|
||||
DataFixer datafixer = minecraftserver.getDataFixer();
|
||||
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, new File(convertable_conversionsession.a(resourcekey), "entities"), datafixer, flag2, minecraftserver);
|
||||
@@ -231,15 +268,51 @@
|
||||
iworlddataserver.setGameType(minecraftserver.getGamemode());
|
||||
}
|
||||
|
||||
- this.structureManager = new StructureManager(this, minecraftserver.getSaveData().getGeneratorSettings());
|
||||
+ this.structureManager = new StructureManager(this, this.worldDataServer.getGeneratorSettings()); // CraftBukkit
|
||||
- this.structureFeatureManager = new StructureManager(this, minecraftserver.getSaveData().getGeneratorSettings());
|
||||
+ this.structureFeatureManager = new StructureManager(this, this.serverLevelData.getGeneratorSettings()); // CraftBukkit
|
||||
if (this.getDimensionManager().isCreateDragonBattle()) {
|
||||
- this.dragonBattle = new EnderDragonBattle(this, minecraftserver.getSaveData().getGeneratorSettings().getSeed(), minecraftserver.getSaveData().C());
|
||||
+ this.dragonBattle = new EnderDragonBattle(this, this.worldDataServer.getGeneratorSettings().getSeed(), this.worldDataServer.C()); // CraftBukkit
|
||||
- this.dragonFight = new EnderDragonBattle(this, minecraftserver.getSaveData().getGeneratorSettings().getSeed(), minecraftserver.getSaveData().C());
|
||||
+ this.dragonFight = new EnderDragonBattle(this, this.serverLevelData.getGeneratorSettings().getSeed(), this.serverLevelData.C()); // CraftBukkit
|
||||
} else {
|
||||
this.dragonBattle = null;
|
||||
this.dragonFight = null;
|
||||
}
|
||||
|
||||
this.sleepStatus = new SleepStatus();
|
||||
+ this.getServer().addWorld(this.getWorld()); // CraftBukkit
|
||||
+ }
|
||||
+
|
||||
@@ -95,13 +114,13 @@
|
||||
+ @Override
|
||||
+ public TileEntity getTileEntity(BlockPosition pos, boolean validate) {
|
||||
+ TileEntity result = super.getTileEntity(pos, validate);
|
||||
+ if (!validate || Thread.currentThread() != this.serverThread) {
|
||||
+ if (!validate || Thread.currentThread() != this.thread) {
|
||||
+ // SPIGOT-5378: avoid deadlock, this can be called in loading logic (i.e lighting) but getType() will block on chunk load
|
||||
+ return result;
|
||||
+ }
|
||||
+ Block type = getType(pos).getBlock();
|
||||
|
||||
+ if (result != null && type != Blocks.AIR) {
|
||||
+ IBlockData type = getType(pos);
|
||||
+
|
||||
+ if (result != null && !type.a(Blocks.AIR)) {
|
||||
+ if (!result.getTileType().isValidBlock(type)) {
|
||||
+ result = fixTileEntity(pos, type, result);
|
||||
+ }
|
||||
@@ -110,15 +129,14 @@
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ private TileEntity fixTileEntity(BlockPosition pos, Block type, TileEntity found) {
|
||||
+ private TileEntity fixTileEntity(BlockPosition pos, IBlockData type, TileEntity found) {
|
||||
+ this.getServer().getLogger().log(Level.SEVERE, "Block at {0}, {1}, {2} is {3} but has {4}" + ". "
|
||||
+ + "Bukkit will attempt to fix this, but there may be additional damage that we cannot recover.", new Object[]{pos.getX(), pos.getY(), pos.getZ(), type, found});
|
||||
+
|
||||
+ if (type instanceof ITileEntity) {
|
||||
+ TileEntity replacement = ((ITileEntity) type).createTile(this);
|
||||
+ TileEntity replacement = ((ITileEntity) type).createTile(pos, type);
|
||||
+ if (replacement != null) {
|
||||
+ replacement.setLocation(this, pos);
|
||||
+ this.setTileEntity(pos, replacement);
|
||||
+ this.setTileEntity(replacement);
|
||||
+ }
|
||||
+ return replacement;
|
||||
+ } else {
|
||||
@@ -128,22 +146,22 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
public void a(int i, int j, boolean flag, boolean flag1) {
|
||||
this.worldDataServer.setClearWeatherTime(i);
|
||||
@@ -299,6 +372,7 @@
|
||||
this.serverLevelData.setClearWeatherTime(i);
|
||||
@@ -331,6 +404,7 @@
|
||||
this.rainLevel = MathHelper.a(this.rainLevel, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
+ /* CraftBukkit start
|
||||
if (this.lastRainLevel != this.rainLevel) {
|
||||
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.h, this.rainLevel)), this.getDimensionKey());
|
||||
if (this.oRainLevel != this.rainLevel) {
|
||||
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel)), this.getDimensionKey());
|
||||
}
|
||||
@@ -317,18 +391,47 @@
|
||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.h, this.rainLevel));
|
||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.i, this.thunderLevel));
|
||||
@@ -349,16 +423,45 @@
|
||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel));
|
||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel));
|
||||
}
|
||||
+ // */
|
||||
+ for (int idx = 0; idx < this.players.size(); ++idx) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).world == this) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).level == this) {
|
||||
+ ((EntityPlayer) this.players.get(idx)).tickWeather();
|
||||
+ }
|
||||
+ }
|
||||
@@ -151,28 +169,25 @@
|
||||
+ if (flag != this.isRaining()) {
|
||||
+ // Only send weather packets to those affected
|
||||
+ for (int idx = 0; idx < this.players.size(); ++idx) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).world == this) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).level == this) {
|
||||
+ ((EntityPlayer) this.players.get(idx)).setPlayerWeather((!flag ? WeatherType.DOWNFALL : WeatherType.CLEAR), false);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ for (int idx = 0; idx < this.players.size(); ++idx) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).world == this) {
|
||||
+ ((EntityPlayer) this.players.get(idx)).updateWeather(this.lastRainLevel, this.rainLevel, this.lastThunderLevel, this.thunderLevel);
|
||||
+ if (((EntityPlayer) this.players.get(idx)).level == this) {
|
||||
+ ((EntityPlayer) this.players.get(idx)).updateWeather(this.oRainLevel, this.rainLevel, this.oThunderLevel, this.thunderLevel);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (this.everyoneSleeping && this.players.stream().noneMatch((entityplayer) -> {
|
||||
- return !entityplayer.isSpectator() && !entityplayer.isDeeplySleeping();
|
||||
+ return !entityplayer.isSpectator() && !entityplayer.isDeeplySleeping() && !entityplayer.fauxSleeping; // CraftBukkit
|
||||
})) {
|
||||
- this.everyoneSleeping = false;
|
||||
i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
|
||||
if (this.sleepStatus.a(i) && this.sleepStatus.a(i, this.players)) {
|
||||
+ // CraftBukkit start
|
||||
+ long l = this.worldData.getDayTime() + 24000L;
|
||||
+ long l = this.levelData.getDayTime() + 24000L;
|
||||
+ TimeSkipEvent event = new TimeSkipEvent(this.getWorld(), TimeSkipEvent.SkipReason.NIGHT_SKIP, (l - l % 24000L) - this.getDayTime());
|
||||
if (this.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) {
|
||||
- long l = this.worldData.getDayTime() + 24000L;
|
||||
if (this.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) {
|
||||
- long l = this.levelData.getDayTime() + 24000L;
|
||||
+ getServer().getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.setDayTime(this.getDayTime() + event.getSkipAmount());
|
||||
@@ -183,49 +198,41 @@
|
||||
|
||||
- this.wakeupPlayers();
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.everyoneSleeping = false;
|
||||
+ this.wakeupPlayers();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.getGameRules().getBoolean(GameRules.DO_WEATHER_CYCLE)) {
|
||||
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE)) {
|
||||
this.clearWeather();
|
||||
}
|
||||
@@ -350,7 +453,7 @@
|
||||
this.ak();
|
||||
this.ticking = false;
|
||||
gameprofilerfiller.exitEnter("entities");
|
||||
@@ -380,7 +483,7 @@
|
||||
this.aq();
|
||||
this.handlingTick = false;
|
||||
gameprofilerfiller.exit();
|
||||
- boolean flag3 = !this.players.isEmpty() || !this.getForceLoadedChunks().isEmpty();
|
||||
+ boolean flag3 = true || !this.players.isEmpty() || !this.getForceLoadedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
|
||||
|
||||
if (flag3) {
|
||||
this.resetEmptyTime();
|
||||
@@ -369,6 +472,7 @@
|
||||
Entity entity = (Entity) entry.getValue();
|
||||
Entity entity1 = entity.getVehicle();
|
||||
@@ -396,7 +499,7 @@
|
||||
|
||||
+ /* CraftBukkit start - We prevent spawning in general, so this butchering is not needed
|
||||
if (!this.server.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
|
||||
entity.die();
|
||||
}
|
||||
@@ -376,6 +480,7 @@
|
||||
if (!this.server.getSpawnNPCs() && entity instanceof NPC) {
|
||||
entity.die();
|
||||
}
|
||||
+ // CraftBukkit end */
|
||||
|
||||
gameprofilerfiller.enter("checkDespawn");
|
||||
if (!entity.dead) {
|
||||
@@ -450,7 +555,7 @@
|
||||
}
|
||||
this.entityTickList.a((entity) -> {
|
||||
if (!entity.isRemoved()) {
|
||||
- if (this.i(entity)) {
|
||||
+ if (false && this.i(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
|
||||
entity.die();
|
||||
} else {
|
||||
gameprofilerfiller.enter("checkDespawn");
|
||||
@@ -461,7 +564,7 @@
|
||||
|
||||
private void wakeupPlayers() {
|
||||
this.sleepStatus.a();
|
||||
- ((List) this.players.stream().filter(EntityLiving::isSleeping).collect(Collectors.toList())).forEach((entityplayer) -> {
|
||||
+ (this.players.stream().filter(EntityLiving::isSleeping).collect(Collectors.toList())).forEach((entityplayer) -> { // CraftBukkit - decompile error
|
||||
entityplayer.wakeup(false, false);
|
||||
});
|
||||
}
|
||||
@@ -477,14 +582,14 @@
|
||||
entityhorseskeleton.t(true);
|
||||
@@ -488,14 +591,14 @@
|
||||
entityhorseskeleton.v(true);
|
||||
entityhorseskeleton.setAgeRaw(0);
|
||||
entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
||||
- this.addEntity(entityhorseskeleton);
|
||||
@@ -241,80 +248,63 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,11 +600,11 @@
|
||||
@@ -506,12 +609,12 @@
|
||||
BiomeBase biomebase = this.getBiome(blockposition);
|
||||
|
||||
if (biomebase.a(this, blockposition1)) {
|
||||
if (biomebase.a((IWorldReader) this, blockposition1)) {
|
||||
- this.setTypeUpdate(blockposition1, Blocks.ICE.getBlockData());
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition1, Blocks.ICE.getBlockData(), null); // CraftBukkit
|
||||
}
|
||||
|
||||
if (flag && biomebase.b(this, blockposition)) {
|
||||
- this.setTypeUpdate(blockposition, Blocks.SNOW.getBlockData());
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW.getBlockData(), null); // CraftBukkit
|
||||
}
|
||||
if (flag) {
|
||||
if (biomebase.b(this, blockposition)) {
|
||||
- this.setTypeUpdate(blockposition, Blocks.SNOW.getBlockData());
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW.getBlockData(), null); // CraftBukkit
|
||||
}
|
||||
|
||||
if (flag && this.getBiome(blockposition1).c() == BiomeBase.Precipitation.RAIN) {
|
||||
@@ -546,7 +651,7 @@
|
||||
protected BlockPosition a(BlockPosition blockposition) {
|
||||
BlockPosition blockposition1 = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, blockposition);
|
||||
AxisAlignedBB axisalignedbb = (new AxisAlignedBB(blockposition1, new BlockPosition(blockposition1.getX(), this.getBuildHeight(), blockposition1.getZ()))).g(3.0D);
|
||||
- List<EntityLiving> list = this.a(EntityLiving.class, axisalignedbb, (entityliving) -> {
|
||||
+ List<EntityLiving> list = this.a(EntityLiving.class, axisalignedbb, (java.util.function.Predicate<EntityLiving>) (entityliving) -> { // CraftBukkit - decompile error
|
||||
return entityliving != null && entityliving.isAlive() && this.e(entityliving.getChunkCoordinates());
|
||||
});
|
||||
|
||||
@@ -575,7 +680,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
- if (entityplayer.isSpectator()) {
|
||||
+ if (entityplayer.isSpectator() || (entityplayer.fauxSleeping && !entityplayer.isSleeping())) { // CraftBukkit
|
||||
++i;
|
||||
} else if (entityplayer.isSleeping()) {
|
||||
++j;
|
||||
@@ -593,10 +698,22 @@
|
||||
IBlockData iblockdata = this.getType(blockposition1);
|
||||
@@ -642,10 +745,22 @@
|
||||
}
|
||||
|
||||
private void clearWeather() {
|
||||
- this.worldDataServer.setWeatherDuration(0);
|
||||
- this.serverLevelData.setWeatherDuration(0);
|
||||
+ // CraftBukkit start
|
||||
this.worldDataServer.setStorm(false);
|
||||
- this.worldDataServer.setThunderDuration(0);
|
||||
this.serverLevelData.setStorm(false);
|
||||
- this.serverLevelData.setThunderDuration(0);
|
||||
+ // If we stop due to everyone sleeping we should reset the weather duration to some other random value.
|
||||
+ // Not that everyone ever manages to get the whole server to sleep at the same time....
|
||||
+ if (!this.worldDataServer.hasStorm()) {
|
||||
+ this.worldDataServer.setWeatherDuration(0);
|
||||
+ if (!this.serverLevelData.hasStorm()) {
|
||||
+ this.serverLevelData.setWeatherDuration(0);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.worldDataServer.setThundering(false);
|
||||
this.serverLevelData.setThundering(false);
|
||||
+ // CraftBukkit start
|
||||
+ // If we stop due to everyone sleeping we should reset the weather duration to some other random value.
|
||||
+ // Not that everyone ever manages to get the whole server to sleep at the same time....
|
||||
+ if (!this.worldDataServer.isThundering()) {
|
||||
+ this.worldDataServer.setThunderDuration(0);
|
||||
+ if (!this.serverLevelData.isThundering()) {
|
||||
+ this.serverLevelData.setThunderDuration(0);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public void resetEmptyTime() {
|
||||
@@ -637,6 +754,7 @@
|
||||
@@ -680,6 +795,7 @@
|
||||
});
|
||||
gameprofilerfiller.c("tickNonPassenger");
|
||||
entity.tick();
|
||||
+ entity.postTick(); // CraftBukkit
|
||||
this.getMethodProfiler().exit();
|
||||
Iterator iterator = entity.getPassengers().iterator();
|
||||
|
||||
@@ -703,6 +819,7 @@
|
||||
});
|
||||
gameprofilerfiller.c("tickNonPassenger");
|
||||
entity.tick();
|
||||
+ entity.postTick(); // CraftBukkit
|
||||
gameprofilerfiller.c("tickPassenger");
|
||||
entity1.passengerTick();
|
||||
+ entity1.postTick(); // CraftBukkit
|
||||
gameprofilerfiller.exit();
|
||||
}
|
||||
Iterator iterator = entity1.getPassengers().iterator();
|
||||
|
||||
@@ -669,6 +787,7 @@
|
||||
});
|
||||
gameprofilerfiller.c("tickPassenger");
|
||||
entity1.passengerTick();
|
||||
+ entity1.postTick(); // CraftBukkit
|
||||
gameprofilerfiller.exit();
|
||||
}
|
||||
|
||||
@@ -725,6 +844,7 @@
|
||||
@@ -727,6 +844,7 @@
|
||||
ChunkProviderServer chunkproviderserver = this.getChunkProvider();
|
||||
|
||||
if (!flag1) {
|
||||
@@ -322,28 +312,28 @@
|
||||
if (iprogressupdate != null) {
|
||||
iprogressupdate.a(new ChatMessage("menu.savingLevel"));
|
||||
}
|
||||
@@ -736,11 +856,19 @@
|
||||
@@ -744,11 +862,19 @@
|
||||
}
|
||||
|
||||
chunkproviderserver.save(flag);
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - moved from MinecraftServer.saveChunks
|
||||
+ WorldServer worldserver1 = this;
|
||||
+
|
||||
+ worldDataServer.a(worldserver1.getWorldBorder().t());
|
||||
+ worldDataServer.setCustomBossEvents(this.server.getBossBattleCustomData().save());
|
||||
+ convertable.a(this.server.customRegistry, this.worldDataServer, this.server.getPlayerList().save());
|
||||
+ serverLevelData.a(worldserver1.getWorldBorder().t());
|
||||
+ serverLevelData.setCustomBossEvents(this.server.getBossBattleCustomData().save());
|
||||
+ convertable.a(this.server.registryHolder, this.serverLevelData, this.server.getPlayerList().save());
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
private void aj() {
|
||||
if (this.dragonBattle != null) {
|
||||
- this.server.getSaveData().a(this.dragonBattle.a());
|
||||
+ this.worldDataServer.a(this.dragonBattle.a()); // CraftBukkit
|
||||
private void ap() {
|
||||
if (this.dragonFight != null) {
|
||||
- this.server.getSaveData().a(this.dragonFight.a());
|
||||
+ this.serverLevelData.a(this.dragonFight.a()); // CraftBukkit
|
||||
}
|
||||
|
||||
this.getChunkProvider().getWorldPersistentData().a();
|
||||
@@ -801,11 +929,24 @@
|
||||
@@ -794,15 +920,34 @@
|
||||
|
||||
@Override
|
||||
public boolean addEntity(Entity entity) {
|
||||
@@ -370,47 +360,56 @@
|
||||
}
|
||||
|
||||
public void addEntityTeleport(Entity entity) {
|
||||
@@ -855,13 +996,18 @@
|
||||
this.registerEntity(entityplayer);
|
||||
- this.addEntity0(entity);
|
||||
+ // CraftBukkit start
|
||||
+ this.addEntity0(entity, CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
+ }
|
||||
+
|
||||
+ public void addEntityTeleport(Entity entity, CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ this.addEntity0(entity, reason);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public void addPlayerCommand(EntityPlayer entityplayer) {
|
||||
@@ -830,27 +975,39 @@
|
||||
this.a((EntityPlayer) entity, Entity.RemovalReason.DISCARDED);
|
||||
}
|
||||
|
||||
- this.entityManager.a((EntityAccess) entityplayer);
|
||||
+ this.entityManager.a(entityplayer); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
- private boolean addEntity0(Entity entity) {
|
||||
+ // CraftBukkit start
|
||||
+ private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
if (entity.dead) {
|
||||
if (entity.isRemoved()) {
|
||||
- WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType()));
|
||||
+ // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // CraftBukkit
|
||||
return false;
|
||||
} else if (this.isUUIDTaken(entity)) {
|
||||
return false;
|
||||
} else {
|
||||
- return this.entityManager.a((EntityAccess) entity);
|
||||
+ if (!CraftEventFactory.doEntityAddEventCalling(this, entity, spawnReason)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
IChunkAccess ichunkaccess = this.getChunkAt(MathHelper.floor(entity.locX() / 16.0D), MathHelper.floor(entity.locZ() / 16.0D), ChunkStatus.FULL, entity.attachedToPlayer);
|
||||
|
||||
if (!(ichunkaccess instanceof Chunk)) {
|
||||
@@ -890,7 +1036,7 @@
|
||||
if (entity1 == null) {
|
||||
return false;
|
||||
} else {
|
||||
- WorldServer.LOGGER.warn("Trying to add entity with duplicated UUID {}. Existing {}#{}, new: {}#{}", uuid, EntityTypes.getName(entity1.getEntityType()), entity1.getId(), EntityTypes.getName(entity.getEntityType()), entity.getId());
|
||||
+ // WorldServer.LOGGER.warn("Trying to add entity with duplicated UUID {}. Existing {}#{}, new: {}#{}", uuid, EntityTypes.getName(entity1.getEntityType()), entity1.getId(), EntityTypes.getName(entity.getEntityType()), entity.getId()); // CraftBukkit
|
||||
return true;
|
||||
+
|
||||
+ return this.entityManager.a(entity); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
@@ -919,10 +1065,16 @@
|
||||
}
|
||||
|
||||
public boolean addAllEntitiesSafely(Entity entity) {
|
||||
- Stream stream = entity.recursiveStream().map(Entity::getUniqueID);
|
||||
+ // CraftBukkit start
|
||||
+ return this.addAllEntitiesSafely(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
+ }
|
||||
+
|
||||
+ public boolean addAllEntitiesSafely(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ // CraftBukkit end
|
||||
if (entity.recursiveStream().anyMatch(this::isUUIDTaken)) {
|
||||
+ Stream<UUID> stream = entity.recursiveStream().map(Entity::getUniqueID); // CraftBukkit - decompile error
|
||||
PersistentEntitySectionManager persistententitysectionmanager = this.entityManager;
|
||||
|
||||
Objects.requireNonNull(this.entityManager);
|
||||
if (stream.anyMatch(persistententitysectionmanager::a)) {
|
||||
return false;
|
||||
} else {
|
||||
- this.addAllEntities(entity);
|
||||
@@ -418,52 +417,8 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -973,10 +1125,17 @@
|
||||
}
|
||||
|
||||
this.getScoreboard().a(entity);
|
||||
+ // CraftBukkit start - SPIGOT-5278
|
||||
+ if (entity instanceof EntityDrowned) {
|
||||
+ this.navigators.remove(((EntityDrowned) entity).navigationWater);
|
||||
+ this.navigators.remove(((EntityDrowned) entity).navigationLand);
|
||||
+ } else
|
||||
+ // CraftBukkit end
|
||||
if (entity instanceof EntityInsentient) {
|
||||
this.navigators.remove(((EntityInsentient) entity).getNavigation());
|
||||
}
|
||||
|
||||
+ entity.valid = false; // CraftBukkit
|
||||
}
|
||||
|
||||
private void registerEntity(Entity entity) {
|
||||
@@ -997,9 +1156,16 @@
|
||||
|
||||
this.entitiesByUUID.put(entity.getUniqueID(), entity);
|
||||
this.getChunkProvider().addEntity(entity);
|
||||
+ // CraftBukkit start - SPIGOT-5278
|
||||
+ if (entity instanceof EntityDrowned) {
|
||||
+ this.navigators.add(((EntityDrowned) entity).navigationWater);
|
||||
+ this.navigators.add(((EntityDrowned) entity).navigationLand);
|
||||
+ } else
|
||||
+ // CraftBukkit end
|
||||
if (entity instanceof EntityInsentient) {
|
||||
this.navigators.add(((EntityInsentient) entity).getNavigation());
|
||||
}
|
||||
+ entity.valid = true; // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1015,7 +1181,7 @@
|
||||
}
|
||||
|
||||
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).
|
||||
|
||||
if (ichunkaccess instanceof Chunk) {
|
||||
((Chunk) ichunkaccess).b(entity);
|
||||
@@ -1029,10 +1195,32 @@
|
||||
this.everyoneSleeping();
|
||||
@@ -863,10 +1020,32 @@
|
||||
entityplayer.a(entity_removalreason);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@@ -495,7 +450,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
@@ -1041,6 +1229,12 @@
|
||||
@@ -875,6 +1054,12 @@
|
||||
double d1 = (double) blockposition.getY() - entityplayer.locY();
|
||||
double d2 = (double) blockposition.getZ() - entityplayer.locZ();
|
||||
|
||||
@@ -506,17 +461,17 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
entityplayer.connection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
}
|
||||
@@ -1079,7 +1273,18 @@
|
||||
Iterator iterator = this.navigators.iterator();
|
||||
@@ -923,7 +1108,18 @@
|
||||
Iterator iterator = this.navigatingMobs.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
- NavigationAbstract navigationabstract = (NavigationAbstract) iterator.next();
|
||||
- EntityInsentient entityinsentient = (EntityInsentient) iterator.next();
|
||||
+ // CraftBukkit start - fix SPIGOT-6362
|
||||
+ NavigationAbstract navigationabstract;
|
||||
+ EntityInsentient entityinsentient;
|
||||
+ try {
|
||||
+ navigationabstract = (NavigationAbstract) iterator.next();
|
||||
+ entityinsentient = (EntityInsentient) iterator.next();
|
||||
+ } catch (java.util.ConcurrentModificationException ex) {
|
||||
+ // This can happen because the pathfinder update below may trigger a chunk load, which in turn may cause more navigators to register
|
||||
+ // In this case we just run the update again across all the iterators as the chunk will then be loaded
|
||||
@@ -525,10 +480,10 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
|
||||
|
||||
if (!navigationabstract.i()) {
|
||||
navigationabstract.b(blockposition);
|
||||
@@ -1101,10 +1306,20 @@
|
||||
@@ -946,10 +1142,20 @@
|
||||
|
||||
@Override
|
||||
public Explosion createExplosion(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) {
|
||||
@@ -549,7 +504,7 @@
|
||||
if (explosion_effect == Explosion.Effect.NONE) {
|
||||
explosion.clearBlocks();
|
||||
}
|
||||
@@ -1169,13 +1384,20 @@
|
||||
@@ -1023,13 +1229,20 @@
|
||||
}
|
||||
|
||||
public <T extends ParticleParam> int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
|
||||
@@ -572,85 +527,39 @@
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -1217,7 +1439,7 @@
|
||||
@@ -1079,7 +1292,7 @@
|
||||
|
||||
@Nullable
|
||||
public BlockPosition a(StructureGenerator<?> structuregenerator, BlockPosition blockposition, int i, boolean flag) {
|
||||
- return !this.server.getSaveData().getGeneratorSettings().shouldGenerateMapFeatures() ? null : this.getChunkProvider().getChunkGenerator().findNearestMapFeature(this, structuregenerator, blockposition, i, flag);
|
||||
+ return !this.worldDataServer.getGeneratorSettings().shouldGenerateMapFeatures() ? null : this.getChunkProvider().getChunkGenerator().findNearestMapFeature(this, structuregenerator, blockposition, i, flag); // CraftBukkit
|
||||
+ return !this.serverLevelData.getGeneratorSettings().shouldGenerateMapFeatures() ? null : this.getChunkProvider().getChunkGenerator().findNearestMapFeature(this, structuregenerator, blockposition, i, flag); // CraftBukkit
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1255,7 +1477,13 @@
|
||||
@@ -1116,11 +1329,21 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public WorldMap a(String s) {
|
||||
return (WorldMap) this.getMinecraftServer().E().getWorldPersistentData().b(() -> {
|
||||
- return new WorldMap(s);
|
||||
- return (WorldMap) this.getMinecraftServer().F().getWorldPersistentData().a(WorldMap::b, s);
|
||||
+ return (WorldMap) this.getMinecraftServer().F().getWorldPersistentData().a((nbttagcompound) -> {
|
||||
+ // CraftBukkit start
|
||||
+ // We only get here when the data file exists, but is not a valid map
|
||||
+ WorldMap newMap = new WorldMap(s);
|
||||
+ WorldMap newMap = WorldMap.b(nbttagcompound);
|
||||
+ newMap.id = s;
|
||||
+ MapInitializeEvent event = new MapInitializeEvent(newMap.mapView);
|
||||
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
+ return newMap;
|
||||
+ // CraftBukkit end
|
||||
}, s);
|
||||
+ }, s);
|
||||
}
|
||||
|
||||
@@ -1386,9 +1614,9 @@
|
||||
reputationhandler.a(reputationevent, entity);
|
||||
@Override
|
||||
public void a(String s, WorldMap worldmap) {
|
||||
+ worldmap.id = s; // CraftBukkit
|
||||
this.getMinecraftServer().F().getWorldPersistentData().a(s, (PersistentBase) worldmap);
|
||||
}
|
||||
|
||||
- public void a(Path path) throws IOException {
|
||||
+ public void a(java.nio.file.Path java_nio_file_path) throws IOException {
|
||||
PlayerChunkMap playerchunkmap = this.getChunkProvider().playerChunkMap;
|
||||
- BufferedWriter bufferedwriter = Files.newBufferedWriter(path.resolve("stats.txt"));
|
||||
+ BufferedWriter bufferedwriter = Files.newBufferedWriter(java_nio_file_path.resolve("stats.txt"));
|
||||
Throwable throwable = null;
|
||||
|
||||
try {
|
||||
@@ -1432,7 +1660,7 @@
|
||||
CrashReport crashreport = new CrashReport("Level dump", new Exception("dummy"));
|
||||
|
||||
this.a(crashreport);
|
||||
- BufferedWriter bufferedwriter1 = Files.newBufferedWriter(path.resolve("example_crash.txt"));
|
||||
+ BufferedWriter bufferedwriter1 = Files.newBufferedWriter(java_nio_file_path.resolve("example_crash.txt"));
|
||||
Throwable throwable3 = null;
|
||||
|
||||
try {
|
||||
@@ -1455,8 +1683,8 @@
|
||||
|
||||
}
|
||||
|
||||
- Path path1 = path.resolve("chunks.csv");
|
||||
- BufferedWriter bufferedwriter2 = Files.newBufferedWriter(path1);
|
||||
+ java.nio.file.Path java_nio_file_path1 = java_nio_file_path.resolve("chunks.csv");
|
||||
+ BufferedWriter bufferedwriter2 = Files.newBufferedWriter(java_nio_file_path1);
|
||||
Throwable throwable6 = null;
|
||||
|
||||
try {
|
||||
@@ -1479,8 +1707,8 @@
|
||||
|
||||
}
|
||||
|
||||
- Path path2 = path.resolve("entities.csv");
|
||||
- BufferedWriter bufferedwriter3 = Files.newBufferedWriter(path2);
|
||||
+ java.nio.file.Path java_nio_file_path2 = java_nio_file_path.resolve("entities.csv");
|
||||
+ BufferedWriter bufferedwriter3 = Files.newBufferedWriter(java_nio_file_path2);
|
||||
Throwable throwable9 = null;
|
||||
|
||||
try {
|
||||
@@ -1503,8 +1731,8 @@
|
||||
|
||||
}
|
||||
|
||||
- Path path3 = path.resolve("block_entities.csv");
|
||||
- BufferedWriter bufferedwriter4 = Files.newBufferedWriter(path3);
|
||||
+ java.nio.file.Path java_nio_file_path3 = java_nio_file_path.resolve("block_entities.csv");
|
||||
+ BufferedWriter bufferedwriter4 = Files.newBufferedWriter(java_nio_file_path3);
|
||||
Throwable throwable12 = null;
|
||||
|
||||
try {
|
||||
@@ -1566,6 +1794,11 @@
|
||||
@@ -1432,6 +1655,11 @@
|
||||
@Override
|
||||
public void update(BlockPosition blockposition, Block block) {
|
||||
if (!this.isDebugWorld()) {
|
||||
@@ -662,53 +571,40 @@
|
||||
this.applyPhysics(blockposition, block);
|
||||
}
|
||||
|
||||
@@ -1580,12 +1813,12 @@
|
||||
@@ -1451,12 +1679,12 @@
|
||||
}
|
||||
|
||||
public boolean isFlatWorld() {
|
||||
- return this.server.getSaveData().getGeneratorSettings().isFlatWorld();
|
||||
+ return this.worldDataServer.getGeneratorSettings().isFlatWorld(); // CraftBukkit
|
||||
+ return this.serverLevelData.getGeneratorSettings().isFlatWorld(); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSeed() {
|
||||
- return this.server.getSaveData().getGeneratorSettings().getSeed();
|
||||
+ return this.worldDataServer.getGeneratorSettings().getSeed(); // CraftBukkit
|
||||
+ return this.serverLevelData.getGeneratorSettings().getSeed(); // CraftBukkit
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1605,9 +1838,9 @@
|
||||
|
||||
@VisibleForTesting
|
||||
public String F() {
|
||||
- return String.format("players: %s, entities: %d [%s], block_entities: %d [%s], block_ticks: %d, fluid_ticks: %d, chunk_source: %s", this.players.size(), this.entitiesById.size(), a((Collection) this.entitiesById.values(), (entity) -> {
|
||||
+ return String.format("players: %s, entities: %d [%s], block_entities: %d [%s], block_ticks: %d, fluid_ticks: %d, chunk_source: %s", this.players.size(), this.entitiesById.size(), a(this.entitiesById.values(), (entity) -> { // CraftBukkit - decompile error
|
||||
return IRegistry.ENTITY_TYPE.getKey(entity.getEntityType());
|
||||
- }), this.tileEntityListTick.size(), a((Collection) this.tileEntityListTick, (tileentity) -> {
|
||||
+ }), this.tileEntityListTick.size(), a(this.tileEntityListTick, (tileentity) -> { // CraftBukkit - decompile error
|
||||
return IRegistry.BLOCK_ENTITY_TYPE.getKey(tileentity.getTileType());
|
||||
}), this.getBlockTickList().a(), this.getFluidTickList().a(), this.P());
|
||||
}
|
||||
@@ -1615,7 +1848,7 @@
|
||||
private static <T> String a(Collection<T> collection, Function<T, MinecraftKey> function) {
|
||||
@@ -1484,7 +1712,7 @@
|
||||
private static <T> String a(Iterable<T> iterable, Function<T, String> function) {
|
||||
try {
|
||||
Object2IntOpenHashMap<MinecraftKey> object2intopenhashmap = new Object2IntOpenHashMap();
|
||||
- Iterator iterator = collection.iterator();
|
||||
+ Iterator<T> iterator = collection.iterator(); // CraftBukkit - decompile error
|
||||
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
|
||||
- Iterator iterator = iterable.iterator();
|
||||
+ Iterator<T> iterator = iterable.iterator(); // CraftBukkit - decompile error
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -1624,7 +1857,8 @@
|
||||
object2intopenhashmap.addTo(minecraftkey, 1);
|
||||
@@ -1493,7 +1721,7 @@
|
||||
object2intopenhashmap.addTo(s, 1);
|
||||
}
|
||||
|
||||
- return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(it.unimi.dsi.fastutil.objects.Object2IntMap.Entry::getIntValue).reversed()).limit(5L).map((it_unimi_dsi_fastutil_objects_object2intmap_entry) -> {
|
||||
+ // CraftBukkit - decompile error
|
||||
+ return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<MinecraftKey>::getIntValue).reversed()).limit(5L).map((it_unimi_dsi_fastutil_objects_object2intmap_entry) -> {
|
||||
return it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey() + ":" + it_unimi_dsi_fastutil_objects_object2intmap_entry.getIntValue();
|
||||
}).collect(Collectors.joining(","));
|
||||
} catch (Exception exception) {
|
||||
@@ -1633,16 +1867,32 @@
|
||||
- return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(Entry::getIntValue).reversed()).limit(5L).map((entry) -> {
|
||||
+ return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(Entry<String>::getIntValue).reversed()).limit(5L).map((entry) -> { // CraftBukkit - decompile error
|
||||
String s1 = (String) entry.getKey();
|
||||
|
||||
return s1 + ":" + entry.getIntValue();
|
||||
@@ -1504,17 +1732,33 @@
|
||||
}
|
||||
|
||||
public static void a(WorldServer worldserver) {
|
||||
@@ -718,7 +614,7 @@
|
||||
+
|
||||
+ public static void a(WorldServer worldserver, Entity entity) {
|
||||
+ // CraftBukkit end
|
||||
BlockPosition blockposition = WorldServer.a;
|
||||
BlockPosition blockposition = WorldServer.END_SPAWN_POINT;
|
||||
int i = blockposition.getX();
|
||||
int j = blockposition.getY() - 2;
|
||||
int k = blockposition.getZ();
|
||||
@@ -742,4 +638,21 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1601,6 +1845,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ entity.valid = true; // CraftBukkit
|
||||
}
|
||||
|
||||
public void a(Entity entity) {
|
||||
@@ -1633,6 +1878,7 @@
|
||||
gameeventlistenerregistrar.a(entity.level);
|
||||
}
|
||||
|
||||
+ entity.valid = false; // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,25 +15,25 @@
|
||||
+ private static final HashMap<InetAddress, Long> throttleTracker = new HashMap<InetAddress, Long>();
|
||||
+ private static int throttleCounter = 0;
|
||||
+ // CraftBukkit end
|
||||
private static final IChatBaseComponent a = new ChatComponentText("Ignoring status request");
|
||||
private final MinecraftServer b;
|
||||
private final NetworkManager c;
|
||||
private static final IChatBaseComponent IGNORE_STATUS_REASON = new ChatComponentText("Ignoring status request");
|
||||
private final MinecraftServer server;
|
||||
private final NetworkManager connection;
|
||||
@@ -27,6 +36,40 @@
|
||||
switch (packethandshakinginsetprotocol.b()) {
|
||||
case LOGIN:
|
||||
this.c.setProtocol(EnumProtocol.LOGIN);
|
||||
this.connection.setProtocol(EnumProtocol.LOGIN);
|
||||
+ // CraftBukkit start - Connection throttle
|
||||
+ try {
|
||||
+ long currentTime = System.currentTimeMillis();
|
||||
+ long connectionThrottle = this.b.server.getConnectionThrottle();
|
||||
+ InetAddress address = ((java.net.InetSocketAddress) this.c.getSocketAddress()).getAddress();
|
||||
+ long connectionThrottle = this.server.server.getConnectionThrottle();
|
||||
+ InetAddress address = ((java.net.InetSocketAddress) this.connection.getSocketAddress()).getAddress();
|
||||
+
|
||||
+ synchronized (throttleTracker) {
|
||||
+ if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) {
|
||||
+ throttleTracker.put(address, currentTime);
|
||||
+ ChatMessage chatmessage = new ChatMessage("Connection throttled! Please wait before reconnecting.");
|
||||
+ this.c.sendPacket(new PacketLoginOutDisconnect(chatmessage));
|
||||
+ this.c.close(chatmessage);
|
||||
+ this.connection.sendPacket(new PacketLoginOutDisconnect(chatmessage));
|
||||
+ this.connection.close(chatmessage);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@@ -60,10 +60,10 @@
|
||||
ChatMessage chatmessage;
|
||||
|
||||
@@ -40,6 +83,7 @@
|
||||
this.c.close(chatmessage);
|
||||
this.connection.close(chatmessage);
|
||||
} else {
|
||||
this.c.setPacketListener(new LoginListener(this.b, this.c));
|
||||
+ ((LoginListener) this.c.j()).hostname = packethandshakinginsetprotocol.hostname + ":" + packethandshakinginsetprotocol.port; // CraftBukkit - set hostname
|
||||
this.connection.setPacketListener(new LoginListener(this.server, this.connection));
|
||||
+ ((LoginListener) this.connection.j()).hostname = packethandshakinginsetprotocol.hostName + ":" + packethandshakinginsetprotocol.port; // CraftBukkit - set hostname
|
||||
}
|
||||
break;
|
||||
case STATUS:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/server/network/LegacyPingHandler.java
|
||||
+++ b/net/minecraft/server/network/LegacyPingHandler.java
|
||||
@@ -35,11 +35,12 @@
|
||||
MinecraftServer minecraftserver = this.b.d();
|
||||
@@ -36,11 +36,12 @@
|
||||
MinecraftServer minecraftserver = this.serverConnectionListener.d();
|
||||
int i = bytebuf.readableBytes();
|
||||
String s;
|
||||
+ org.bukkit.event.server.ServerListPingEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(minecraftserver.server, inetsocketaddress.getAddress(), minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()); // CraftBukkit
|
||||
@@ -14,7 +14,7 @@
|
||||
this.a(channelhandlercontext, this.a(s));
|
||||
break;
|
||||
case 1:
|
||||
@@ -48,7 +49,7 @@
|
||||
@@ -49,7 +50,7 @@
|
||||
}
|
||||
|
||||
LegacyPingHandler.LOGGER.debug("Ping: (1.4-1.5.x) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort());
|
||||
@@ -23,7 +23,7 @@
|
||||
this.a(channelhandlercontext, this.a(s));
|
||||
break;
|
||||
default:
|
||||
@@ -67,7 +68,7 @@
|
||||
@@ -68,7 +69,7 @@
|
||||
}
|
||||
|
||||
LegacyPingHandler.LOGGER.debug("Ping: (1.6) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/network/LoginListener.java
|
||||
+++ b/net/minecraft/server/network/LoginListener.java
|
||||
@@ -35,6 +35,13 @@
|
||||
@@ -36,6 +36,13 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -13,16 +13,16 @@
|
||||
+
|
||||
public class LoginListener implements PacketLoginInListener {
|
||||
|
||||
private static final AtomicInteger b = new AtomicInteger(0);
|
||||
@@ -49,6 +56,7 @@
|
||||
private final String j;
|
||||
private SecretKey loginKey;
|
||||
private EntityPlayer l;
|
||||
private static final AtomicInteger UNIQUE_THREAD_ID = new AtomicInteger(0);
|
||||
@@ -52,6 +59,7 @@
|
||||
private final String serverId;
|
||||
@Nullable
|
||||
private EntityPlayer delayedAcceptPlayer;
|
||||
+ public String hostname = ""; // CraftBukkit - add field
|
||||
|
||||
public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
|
||||
this.g = LoginListener.EnumProtocolState.HELLO;
|
||||
@@ -77,6 +85,20 @@
|
||||
this.state = LoginListener.EnumProtocolState.HELLO;
|
||||
@@ -80,6 +88,20 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
+ try {
|
||||
+ IChatBaseComponent ichatbasecomponent = new ChatComponentText(s);
|
||||
+ LoginListener.LOGGER.info("Disconnecting {}: {}", this.d(), s);
|
||||
+ this.networkManager.sendPacket(new PacketLoginOutDisconnect(ichatbasecomponent));
|
||||
+ this.networkManager.close(ichatbasecomponent);
|
||||
+ this.connection.sendPacket(new PacketLoginOutDisconnect(ichatbasecomponent));
|
||||
+ this.connection.close(ichatbasecomponent);
|
||||
+ } catch (Exception exception) {
|
||||
+ LoginListener.LOGGER.error("Error whilst disconnecting player", exception);
|
||||
+ }
|
||||
@@ -42,14 +42,14 @@
|
||||
+
|
||||
@Override
|
||||
public NetworkManager a() {
|
||||
return this.networkManager;
|
||||
@@ -98,10 +120,12 @@
|
||||
this.i = this.a(this.i);
|
||||
return this.connection;
|
||||
@@ -101,10 +123,12 @@
|
||||
this.gameProfile = this.a(this.gameProfile);
|
||||
}
|
||||
|
||||
- IChatBaseComponent ichatbasecomponent = this.server.getPlayerList().attemptLogin(this.networkManager.getSocketAddress(), this.i);
|
||||
- IChatBaseComponent ichatbasecomponent = this.server.getPlayerList().attemptLogin(this.connection.getSocketAddress(), this.gameProfile);
|
||||
+ // CraftBukkit start - fire PlayerLoginEvent
|
||||
+ EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.i, hostname);
|
||||
+ EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.gameProfile, hostname);
|
||||
|
||||
- if (ichatbasecomponent != null) {
|
||||
- this.disconnect(ichatbasecomponent);
|
||||
@@ -57,32 +57,29 @@
|
||||
+ // this.disconnect(ichatbasecomponent);
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
this.g = LoginListener.EnumProtocolState.ACCEPTED;
|
||||
if (this.server.ax() >= 0 && !this.networkManager.isLocal()) {
|
||||
@@ -115,9 +139,9 @@
|
||||
this.state = LoginListener.EnumProtocolState.ACCEPTED;
|
||||
if (this.server.aw() >= 0 && !this.connection.isLocal()) {
|
||||
@@ -117,7 +141,7 @@
|
||||
EntityPlayer entityplayer = this.server.getPlayerList().getPlayer(this.gameProfile.getId());
|
||||
|
||||
if (entityplayer != null) {
|
||||
this.g = LoginListener.EnumProtocolState.DELAY_ACCEPT;
|
||||
- this.l = this.server.getPlayerList().processLogin(this.i);
|
||||
+ this.l = this.server.getPlayerList().processLogin(this.i, s); // CraftBukkit - add player reference
|
||||
} else {
|
||||
- this.server.getPlayerList().a(this.networkManager, this.server.getPlayerList().processLogin(this.i));
|
||||
+ this.server.getPlayerList().a(this.networkManager, this.server.getPlayerList().processLogin(this.i, s)); // CraftBukkit - add player reference
|
||||
}
|
||||
}
|
||||
try {
|
||||
- EntityPlayer entityplayer1 = this.server.getPlayerList().processLogin(this.gameProfile);
|
||||
+ EntityPlayer entityplayer1 = this.server.getPlayerList().processLogin(this.gameProfile, s); // CraftBukkit - add player reference
|
||||
|
||||
@@ -175,6 +199,43 @@
|
||||
if (entityplayer != null) {
|
||||
this.state = LoginListener.EnumProtocolState.DELAY_ACCEPT;
|
||||
@@ -191,6 +215,43 @@
|
||||
try {
|
||||
LoginListener.this.i = LoginListener.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.a());
|
||||
if (LoginListener.this.i != null) {
|
||||
LoginListener.this.gameProfile = LoginListener.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.a());
|
||||
if (LoginListener.this.gameProfile != null) {
|
||||
+ // CraftBukkit start - fire PlayerPreLoginEvent
|
||||
+ if (!networkManager.isConnected()) {
|
||||
+ if (!connection.isConnected()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ String playerName = i.getName();
|
||||
+ java.net.InetAddress address = ((java.net.InetSocketAddress) networkManager.getSocketAddress()).getAddress();
|
||||
+ java.util.UUID uniqueId = i.getId();
|
||||
+ String playerName = gameProfile.getName();
|
||||
+ java.net.InetAddress address = ((java.net.InetSocketAddress) connection.getSocketAddress()).getAddress();
|
||||
+ java.util.UUID uniqueId = gameProfile.getId();
|
||||
+ final org.bukkit.craftbukkit.CraftServer server = LoginListener.this.server.server;
|
||||
+
|
||||
+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
|
||||
@@ -112,10 +109,10 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
LoginListener.LOGGER.info("UUID of player {} is {}", LoginListener.this.i.getName(), LoginListener.this.i.getId());
|
||||
LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
|
||||
LoginListener.LOGGER.info("UUID of player {} is {}", LoginListener.this.gameProfile.getName(), LoginListener.this.gameProfile.getId());
|
||||
LoginListener.this.state = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
|
||||
} else if (LoginListener.this.server.isEmbeddedServer()) {
|
||||
@@ -194,6 +255,11 @@
|
||||
@@ -210,6 +271,11 @@
|
||||
LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down"));
|
||||
LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable");
|
||||
}
|
||||
|
||||
@@ -18,21 +18,21 @@
|
||||
+
|
||||
public class PacketStatusListener implements PacketStatusInListener {
|
||||
|
||||
private static final IChatBaseComponent a = new ChatMessage("multiplayer.status.request_handled");
|
||||
private static final IChatBaseComponent DISCONNECT_REASON = new ChatMessage("multiplayer.status.request_handled");
|
||||
@@ -36,8 +48,96 @@
|
||||
this.networkManager.close(PacketStatusListener.a);
|
||||
this.connection.close(PacketStatusListener.DISCONNECT_REASON);
|
||||
} else {
|
||||
this.d = true;
|
||||
- this.networkManager.sendPacket(new PacketStatusOutServerInfo(this.minecraftServer.getServerPing()));
|
||||
this.hasRequestedStatus = true;
|
||||
- this.connection.sendPacket(new PacketStatusOutServerInfo(this.server.getServerPing()));
|
||||
+ // CraftBukkit start
|
||||
+ // this.networkManager.sendPacket(new PacketStatusOutServerInfo(this.minecraftServer.getServerPing()));
|
||||
+ final Object[] players = minecraftServer.getPlayerList().players.toArray();
|
||||
+ final Object[] players = server.getPlayerList().players.toArray();
|
||||
+ class ServerListPingEvent extends org.bukkit.event.server.ServerListPingEvent {
|
||||
+
|
||||
+ CraftIconCache icon = minecraftServer.server.getServerIcon();
|
||||
+ CraftIconCache icon = server.server.getServerIcon();
|
||||
+
|
||||
+ ServerListPingEvent() {
|
||||
+ super(((InetSocketAddress) networkManager.getSocketAddress()).getAddress(), minecraftServer.getMotd(), minecraftServer.getPlayerList().getMaxPlayers());
|
||||
+ super(((InetSocketAddress) connection.getSocketAddress()).getAddress(), server.getMotd(), server.getPlayerList().getMaxPlayers());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@@ -92,7 +92,7 @@
|
||||
+ }
|
||||
+
|
||||
+ ServerListPingEvent event = new ServerListPingEvent();
|
||||
+ this.minecraftServer.server.getPluginManager().callEvent(event);
|
||||
+ this.server.server.getPluginManager().callEvent(event);
|
||||
+
|
||||
+ java.util.List<GameProfile> profiles = new java.util.ArrayList<GameProfile>(players.length);
|
||||
+ for (Object player : players) {
|
||||
@@ -109,9 +109,9 @@
|
||||
+ ping.setMOTD(CraftChatMessage.fromString(event.getMotd(), true)[0]);
|
||||
+ ping.setPlayerSample(playerSample);
|
||||
+ int version = SharedConstants.getGameVersion().getProtocolVersion();
|
||||
+ ping.setServerInfo(new ServerPing.ServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), version));
|
||||
+ ping.setServerInfo(new ServerPing.ServerData(server.getServerModName() + " " + server.getVersion(), version));
|
||||
+
|
||||
+ this.networkManager.sendPacket(new PacketStatusOutServerInfo(ping));
|
||||
+ this.connection.sendPacket(new PacketStatusOutServerInfo(ping));
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,13 @@
|
||||
--- a/net/minecraft/server/network/ServerConnection.java
|
||||
+++ b/net/minecraft/server/network/ServerConnection.java
|
||||
@@ -87,14 +87,24 @@
|
||||
int j = ServerConnection.this.e.k();
|
||||
@@ -96,14 +96,24 @@
|
||||
int j = ServerConnection.this.server.l();
|
||||
Object object = j > 0 ? new NetworkManagerServer(j) : new NetworkManager(EnumProtocolDirection.SERVERBOUND);
|
||||
|
||||
- ServerConnection.this.connectedChannels.add(object);
|
||||
+ ServerConnection.this.connectedChannels.add((NetworkManager) object); // CraftBukkit - decompile error
|
||||
- ServerConnection.this.connections.add(object);
|
||||
+ ServerConnection.this.connections.add((NetworkManager) object); // CraftBukkit - decompile error
|
||||
channel.pipeline().addLast("packet_handler", (ChannelHandler) object);
|
||||
((NetworkManager) object).setPacketListener(new HandshakeListener(ServerConnection.this.e, (NetworkManager) object));
|
||||
((NetworkManager) object).setPacketListener(new HandshakeListener(ServerConnection.this.server, (NetworkManager) object));
|
||||
}
|
||||
- }).group((EventLoopGroup) lazyinitvar.a()).localAddress(inetaddress, i)).bind().syncUninterruptibly());
|
||||
+ }).group((EventLoopGroup) lazyinitvar.a()).localAddress(inetaddress, i)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void acceptConnections() {
|
||||
+ synchronized (this.listeningChannels) {
|
||||
+ for (ChannelFuture future : this.listeningChannels) {
|
||||
+ synchronized (this.channels) {
|
||||
+ for (ChannelFuture future : this.channels) {
|
||||
+ future.channel().config().setAutoRead(true);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void b() {
|
||||
this.c = false;
|
||||
Iterator iterator = this.listeningChannels.iterator();
|
||||
public SocketAddress a() {
|
||||
List list = this.channels;
|
||||
ChannelFuture channelfuture;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/players/ExpirableListEntry.java
|
||||
+++ b/net/minecraft/server/players/ExpirableListEntry.java
|
||||
@@ -24,7 +24,7 @@
|
||||
@@ -25,7 +25,7 @@
|
||||
}
|
||||
|
||||
protected ExpirableListEntry(T t0, JsonObject jsonobject) {
|
||||
@@ -9,21 +9,17 @@
|
||||
|
||||
Date date;
|
||||
|
||||
@@ -75,4 +75,26 @@
|
||||
jsonobject.addProperty("expires", this.d == null ? "forever" : ExpirableListEntry.a.format(this.d));
|
||||
jsonobject.addProperty("reason", this.e);
|
||||
@@ -80,4 +80,22 @@
|
||||
jsonobject.addProperty("expires", this.expires == null ? "forever" : ExpirableListEntry.DATE_FORMAT.format(this.expires));
|
||||
jsonobject.addProperty("reason", this.reason);
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public Date getCreated() {
|
||||
+ return this.b;
|
||||
+ }
|
||||
+
|
||||
+ private static <T> T checkExpiry(T object, JsonObject jsonobject) {
|
||||
+ Date expires = null;
|
||||
+
|
||||
+ try {
|
||||
+ expires = jsonobject.has("expires") ? a.parse(jsonobject.get("expires").getAsString()) : null;
|
||||
+ expires = jsonobject.has("expires") ? DATE_FORMAT.parse(jsonobject.get("expires").getAsString()) : null;
|
||||
+ } catch (ParseException ex) {
|
||||
+ // Guess we don't have a date
|
||||
+ }
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
--- a/net/minecraft/server/players/JsonList.java
|
||||
+++ b/net/minecraft/server/players/JsonList.java
|
||||
@@ -52,7 +52,7 @@
|
||||
@@ -54,7 +54,7 @@
|
||||
@Nullable
|
||||
public V get(K k0) {
|
||||
this.g();
|
||||
- return (JsonListEntry) this.d.get(this.a(k0));
|
||||
+ return (V) this.d.get(this.a(k0)); // CraftBukkit - fix decompile error
|
||||
- return (JsonListEntry) this.map.get(this.a(k0));
|
||||
+ return (V) this.map.get(this.a(k0)); // CraftBukkit - fix decompile error
|
||||
}
|
||||
|
||||
public void remove(K k0) {
|
||||
@@ -74,6 +74,12 @@
|
||||
return (String[]) this.d.keySet().toArray(new String[this.d.size()]);
|
||||
@@ -76,6 +76,12 @@
|
||||
return (String[]) this.map.keySet().toArray(new String[0]);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public Collection<V> getValues() {
|
||||
+ return this.d.values();
|
||||
+ return this.map.values();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public boolean isEmpty() {
|
||||
return this.d.size() < 1;
|
||||
return this.map.size() < 1;
|
||||
}
|
||||
@@ -91,7 +97,7 @@
|
||||
Iterator iterator = this.d.values().iterator();
|
||||
@@ -93,7 +99,7 @@
|
||||
Iterator iterator = this.map.values().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
- V v0 = (JsonListEntry) iterator.next();
|
||||
@@ -31,30 +31,35 @@
|
||||
|
||||
if (v0.hasExpired()) {
|
||||
list.add(v0.getKey());
|
||||
@@ -101,7 +107,7 @@
|
||||
@@ -103,7 +109,7 @@
|
||||
iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
- K k0 = iterator.next();
|
||||
+ K k0 = (K) iterator.next(); // CraftBukkit - decompile error
|
||||
|
||||
this.d.remove(this.a(k0));
|
||||
this.map.remove(this.a(k0));
|
||||
}
|
||||
@@ -121,7 +127,7 @@
|
||||
@@ -118,11 +124,11 @@
|
||||
|
||||
public void save() throws IOException {
|
||||
JsonArray jsonarray = new JsonArray();
|
||||
- Stream stream = this.map.values().stream().map((jsonlistentry) -> {
|
||||
+ Stream<JsonObject> stream = this.map.values().stream().map((jsonlistentry) -> { // CraftBukkit - decompile error
|
||||
JsonObject jsonobject = new JsonObject();
|
||||
|
||||
jsonlistentry.getClass();
|
||||
Objects.requireNonNull(jsonlistentry);
|
||||
- return (JsonObject) SystemUtils.a((Object) jsonobject, jsonlistentry::a);
|
||||
+ return (JsonObject) SystemUtils.a(jsonobject, jsonlistentry::a); // CraftBukkit - decompile error
|
||||
}).forEach(jsonarray::add);
|
||||
BufferedWriter bufferedwriter = Files.newWriter(this.c, StandardCharsets.UTF_8);
|
||||
Throwable throwable = null;
|
||||
});
|
||||
|
||||
Objects.requireNonNull(jsonarray);
|
||||
@@ -165,7 +171,7 @@
|
||||
JsonListEntry<K> jsonlistentry = this.a(jsonobject);
|
||||
|
||||
if (jsonlistentry.getKey() != null) {
|
||||
- this.d.put(this.a(jsonlistentry.getKey()), jsonlistentry);
|
||||
+ this.d.put(this.a(jsonlistentry.getKey()), (V) jsonlistentry); // CraftBukkit - fix decompile error
|
||||
- this.map.put(this.a(jsonlistentry.getKey()), jsonlistentry);
|
||||
+ this.map.put(this.a(jsonlistentry.getKey()), (V) jsonlistentry); // CraftBukkit - fix decompile error
|
||||
}
|
||||
}
|
||||
} catch (Throwable throwable1) {
|
||||
} catch (Throwable throwable) {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
+
|
||||
public class NameReferencingFileConverter {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -85,7 +90,7 @@
|
||||
static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -87,7 +92,7 @@
|
||||
try {
|
||||
gameprofilebanlist.load();
|
||||
} catch (IOException ioexception) {
|
||||
@@ -21,7 +21,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +148,7 @@
|
||||
@@ -145,7 +150,7 @@
|
||||
try {
|
||||
ipbanlist.load();
|
||||
} catch (IOException ioexception) {
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +189,7 @@
|
||||
@@ -186,7 +191,7 @@
|
||||
try {
|
||||
oplist.load();
|
||||
} catch (IOException ioexception) {
|
||||
@@ -39,7 +39,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +233,7 @@
|
||||
@@ -230,7 +235,7 @@
|
||||
try {
|
||||
whitelist.load();
|
||||
} catch (IOException ioexception) {
|
||||
@@ -48,7 +48,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,6 +356,30 @@
|
||||
@@ -353,6 +358,30 @@
|
||||
File file5 = new File(file, s2 + ".dat");
|
||||
File file6 = new File(file4, s3 + ".dat");
|
||||
|
||||
@@ -76,6 +76,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
NameReferencingFileConverter.b(file4);
|
||||
NameReferencingFileConverter.a(file4);
|
||||
if (!file5.renameTo(file6)) {
|
||||
throw new NameReferencingFileConverter.FileConversionException("Could not convert file for " + s2);
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -90,6 +90,27 @@
|
||||
@@ -93,6 +93,25 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import com.google.common.base.Predicate;
|
||||
+import com.google.common.collect.Iterables;
|
||||
+
|
||||
+import java.util.stream.Collectors;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutChat;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
|
||||
+import net.minecraft.server.dedicated.DedicatedServer;
|
||||
+import net.minecraft.server.network.LoginListener;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.CraftServer;
|
||||
+import org.bukkit.craftbukkit.CraftWorld;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
@@ -27,30 +25,30 @@
|
||||
+
|
||||
public abstract class PlayerList {
|
||||
|
||||
public static final File b = new File("banned-players.json");
|
||||
@@ -99,14 +120,16 @@
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final SimpleDateFormat g = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
|
||||
public static final File USERBANLIST_FILE = new File("banned-players.json");
|
||||
@@ -103,14 +122,16 @@
|
||||
private static final int SEND_PLAYER_INFO_INTERVAL = 600;
|
||||
private static final SimpleDateFormat BAN_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
|
||||
private final MinecraftServer server;
|
||||
- public final List<EntityPlayer> players = Lists.newArrayList();
|
||||
+ public final List<EntityPlayer> players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety
|
||||
private final Map<UUID, EntityPlayer> j = Maps.newHashMap();
|
||||
private final GameProfileBanList k;
|
||||
private final IpBanList l;
|
||||
private final OpList operators;
|
||||
private final Map<UUID, EntityPlayer> playersByUUID = Maps.newHashMap();
|
||||
private final GameProfileBanList bans;
|
||||
private final IpBanList ipBans;
|
||||
private final OpList ops;
|
||||
private final WhiteList whitelist;
|
||||
- private final Map<UUID, ServerStatisticManager> o;
|
||||
- private final Map<UUID, AdvancementDataPlayer> p;
|
||||
- private final Map<UUID, ServerStatisticManager> stats;
|
||||
- private final Map<UUID, AdvancementDataPlayer> advancements;
|
||||
+ // CraftBukkit start
|
||||
+ // private final Map<UUID, ServerStatisticManager> o;
|
||||
+ // private final Map<UUID, AdvancementDataPlayer> p;
|
||||
+ // CraftBukkit end
|
||||
public final WorldNBTStorage playerFileData;
|
||||
private boolean hasWhitelist;
|
||||
private final IRegistryCustom.Dimension s;
|
||||
@@ -116,13 +139,23 @@
|
||||
private boolean v;
|
||||
private int w;
|
||||
public final WorldNBTStorage playerIo;
|
||||
private boolean doWhiteList;
|
||||
private final IRegistryCustom.Dimension registryHolder;
|
||||
@@ -120,13 +141,23 @@
|
||||
private static final boolean ALLOW_LOGOUTIVATOR = false;
|
||||
private int sendAllPlayerInfoIn;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private CraftServer cserver;
|
||||
@@ -61,20 +59,20 @@
|
||||
+ minecraftserver.reader.addCompleter(new org.bukkit.craftbukkit.command.ConsoleCommandCompleter(minecraftserver.server));
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.k = new GameProfileBanList(PlayerList.b);
|
||||
this.l = new IpBanList(PlayerList.c);
|
||||
this.operators = new OpList(PlayerList.d);
|
||||
this.whitelist = new WhiteList(PlayerList.e);
|
||||
- this.o = Maps.newHashMap();
|
||||
- this.p = Maps.newHashMap();
|
||||
this.bans = new GameProfileBanList(PlayerList.USERBANLIST_FILE);
|
||||
this.ipBans = new IpBanList(PlayerList.IPBANLIST_FILE);
|
||||
this.ops = new OpList(PlayerList.OPLIST_FILE);
|
||||
this.whitelist = new WhiteList(PlayerList.WHITELIST_FILE);
|
||||
- this.stats = Maps.newHashMap();
|
||||
- this.advancements = Maps.newHashMap();
|
||||
+ // CraftBukkit start
|
||||
+ // this.o = Maps.newHashMap();
|
||||
+ // this.p = Maps.newHashMap();
|
||||
+ // CraftBukkit end
|
||||
this.server = minecraftserver;
|
||||
this.s = iregistrycustom_dimension;
|
||||
this.registryHolder = iregistrycustom_dimension;
|
||||
this.maxPlayers = i;
|
||||
@@ -138,6 +171,12 @@
|
||||
@@ -142,6 +173,12 @@
|
||||
usercache.a(gameprofile);
|
||||
NBTTagCompound nbttagcompound = this.a(entityplayer);
|
||||
ResourceKey resourcekey;
|
||||
@@ -86,8 +84,8 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (nbttagcompound != null) {
|
||||
DataResult dataresult = DimensionManager.a(new Dynamic(DynamicOpsNBT.a, nbttagcompound.get("Dimension")));
|
||||
@@ -168,7 +207,8 @@
|
||||
DataResult dataresult = DimensionManager.a(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("Dimension")));
|
||||
@@ -171,7 +208,8 @@
|
||||
s1 = networkmanager.getSocketAddress().toString();
|
||||
}
|
||||
|
||||
@@ -96,16 +94,16 @@
|
||||
+ // PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ());
|
||||
WorldData worlddata = worldserver1.getWorldData();
|
||||
|
||||
this.a(entityplayer, (EntityPlayer) null, worldserver1);
|
||||
@@ -178,6 +218,7 @@
|
||||
boolean flag1 = gamerules.getBoolean(GameRules.REDUCED_DEBUG_INFO);
|
||||
entityplayer.c(nbttagcompound);
|
||||
@@ -181,6 +219,7 @@
|
||||
boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO);
|
||||
|
||||
playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), entityplayer.playerInteractManager.c(), BiomeManager.a(worldserver1.getSeed()), worlddata.isHardcore(), this.server.F(), this.s, worldserver1.getDimensionManager(), worldserver1.getDimensionKey(), this.getMaxPlayers(), this.viewDistance, flag1, !flag, worldserver1.isDebugWorld(), worldserver1.isFlatWorld()));
|
||||
playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.gameMode.getGameMode(), entityplayer.gameMode.c(), BiomeManager.a(worldserver1.getSeed()), worlddata.isHardcore(), this.server.G(), this.registryHolder, worldserver1.getDimensionManager(), worldserver1.getDimensionKey(), this.getMaxPlayers(), this.viewDistance, flag1, !flag, worldserver1.isDebugWorld(), worldserver1.isFlatWorld()));
|
||||
+ entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
|
||||
playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())));
|
||||
playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.BRAND, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())));
|
||||
playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.abilities));
|
||||
@@ -196,19 +237,61 @@
|
||||
playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.getAbilities()));
|
||||
@@ -199,19 +238,61 @@
|
||||
} else {
|
||||
chatmessage = new ChatMessage("multiplayer.player.joined.renamed", new Object[]{entityplayer.getScoreboardDisplayName(), s});
|
||||
}
|
||||
@@ -113,10 +111,10 @@
|
||||
+ chatmessage.a(EnumChatFormat.YELLOW);
|
||||
+ String joinMessage = CraftChatMessage.fromComponent(chatmessage);
|
||||
|
||||
- this.sendMessage(chatmessage.a(EnumChatFormat.YELLOW), ChatMessageType.SYSTEM, SystemUtils.b);
|
||||
playerconnection.a(entityplayer.locX(), entityplayer.locY(), entityplayer.locZ(), entityplayer.yaw, entityplayer.pitch);
|
||||
- this.sendMessage(chatmessage.a(EnumChatFormat.YELLOW), ChatMessageType.SYSTEM, SystemUtils.NIL_UUID);
|
||||
playerconnection.b(entityplayer.locX(), entityplayer.locY(), entityplayer.locZ(), entityplayer.getYRot(), entityplayer.getXRot());
|
||||
this.players.add(entityplayer);
|
||||
this.j.put(entityplayer.getUniqueID(), entityplayer);
|
||||
this.playersByUUID.put(entityplayer.getUniqueID(), entityplayer);
|
||||
- this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer}));
|
||||
+ // this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer})); // CraftBukkit - replaced with loop below
|
||||
+
|
||||
@@ -124,7 +122,7 @@
|
||||
+ PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(cserver.getPlayer(entityplayer), joinMessage);
|
||||
+ cserver.getPluginManager().callEvent(playerJoinEvent);
|
||||
+
|
||||
+ if (!entityplayer.playerConnection.networkManager.isConnected()) {
|
||||
+ if (!entityplayer.connection.connection.isConnected()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@@ -132,7 +130,7 @@
|
||||
+
|
||||
+ if (joinMessage != null && joinMessage.length() > 0) {
|
||||
+ for (IChatBaseComponent line : org.bukkit.craftbukkit.util.CraftChatMessage.fromString(joinMessage)) {
|
||||
+ server.getPlayerList().sendAll(new PacketPlayOutChat(line, ChatMessageType.SYSTEM, SystemUtils.b));
|
||||
+ server.getPlayerList().sendAll(new PacketPlayOutChat(line, ChatMessageType.SYSTEM, SystemUtils.NIL_UUID));
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@@ -141,26 +139,26 @@
|
||||
+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, entityplayer);
|
||||
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
- entityplayer.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{(EntityPlayer) this.players.get(i)}));
|
||||
- entityplayer.connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{(EntityPlayer) this.players.get(i)}));
|
||||
+ EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
|
||||
+
|
||||
+ if (entityplayer1.getBukkitEntity().canSee(entityplayer.getBukkitEntity())) {
|
||||
+ entityplayer1.playerConnection.sendPacket(packet);
|
||||
+ entityplayer1.connection.sendPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ if (!entityplayer.getBukkitEntity().canSee(entityplayer1.getBukkitEntity())) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[] { entityplayer1}));
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[] { entityplayer1}));
|
||||
+ }
|
||||
+ entityplayer.sentListPacket = true;
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityplayer.getId(), entityplayer.getDataWatcher(), true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutEntityMetadata(entityplayer.getId(), entityplayer.getDataWatcher(), true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn
|
||||
+
|
||||
+ // CraftBukkit start - Only add if the player wasn't moved in the event
|
||||
+ if (entityplayer.world == worldserver1 && !worldserver1.getPlayers().contains(entityplayer)) {
|
||||
+ if (entityplayer.level == worldserver1 && !worldserver1.getPlayers().contains(entityplayer)) {
|
||||
+ worldserver1.addPlayerJoin(entityplayer);
|
||||
+ this.server.getBossBattleCustomData().a(entityplayer);
|
||||
}
|
||||
@@ -171,8 +169,8 @@
|
||||
+ // CraftBukkit end
|
||||
this.a(entityplayer, worldserver1);
|
||||
if (!this.server.getResourcePack().isEmpty()) {
|
||||
entityplayer.setResourcePack(this.server.getResourcePack(), this.server.getResourcePackHash());
|
||||
@@ -224,8 +307,11 @@
|
||||
entityplayer.setResourcePack(this.server.getResourcePack(), this.server.getResourcePackHash(), this.server.aY(), this.server.bb());
|
||||
@@ -227,8 +308,11 @@
|
||||
|
||||
if (nbttagcompound != null && nbttagcompound.hasKeyOfType("RootVehicle", 10)) {
|
||||
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
|
||||
@@ -186,71 +184,71 @@
|
||||
});
|
||||
|
||||
if (entity != null) {
|
||||
@@ -268,6 +354,8 @@
|
||||
@@ -271,6 +355,8 @@
|
||||
}
|
||||
|
||||
entityplayer.syncInventory();
|
||||
+ // CraftBukkit - Moved from above, added world
|
||||
+ PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), worldserver1.worldDataServer.getName(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ());
|
||||
+ PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), worldserver1.serverLevelData.getName(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ());
|
||||
}
|
||||
|
||||
public void sendScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) {
|
||||
@@ -300,30 +388,31 @@
|
||||
@@ -303,30 +389,31 @@
|
||||
}
|
||||
|
||||
public void setPlayerFileData(WorldServer worldserver) {
|
||||
+ if (playerFileData != null) return; // CraftBukkit
|
||||
+ if (playerIo != null) return; // CraftBukkit
|
||||
worldserver.getWorldBorder().a(new IWorldBorderListener() {
|
||||
@Override
|
||||
public void a(WorldBorder worldborder, double d0) {
|
||||
- PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_SIZE));
|
||||
+ PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_SIZE), worldborder.world);
|
||||
- PlayerList.this.sendAll(new ClientboundSetBorderSizePacket(worldborder));
|
||||
+ PlayerList.this.sendAll(new ClientboundSetBorderSizePacket(worldborder), worldborder.world); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(WorldBorder worldborder, double d0, double d1, long i) {
|
||||
- PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.LERP_SIZE));
|
||||
+ PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.LERP_SIZE), worldborder.world);
|
||||
- PlayerList.this.sendAll(new ClientboundSetBorderLerpSizePacket(worldborder));
|
||||
+ PlayerList.this.sendAll(new ClientboundSetBorderLerpSizePacket(worldborder), worldborder.world); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(WorldBorder worldborder, double d0, double d1) {
|
||||
- PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_CENTER));
|
||||
+ PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_CENTER), worldborder.world);
|
||||
- PlayerList.this.sendAll(new ClientboundSetBorderCenterPacket(worldborder));
|
||||
+ PlayerList.this.sendAll(new ClientboundSetBorderCenterPacket(worldborder), worldborder.world); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(WorldBorder worldborder, int i) {
|
||||
- PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_WARNING_TIME));
|
||||
+ PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_WARNING_TIME), worldborder.world);
|
||||
- PlayerList.this.sendAll(new ClientboundSetBorderWarningDelayPacket(worldborder));
|
||||
+ PlayerList.this.sendAll(new ClientboundSetBorderWarningDelayPacket(worldborder), worldborder.world); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b(WorldBorder worldborder, int i) {
|
||||
- PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_WARNING_BLOCKS));
|
||||
+ PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_WARNING_BLOCKS), worldborder.world);
|
||||
- PlayerList.this.sendAll(new ClientboundSetBorderWarningDistancePacket(worldborder));
|
||||
+ PlayerList.this.sendAll(new ClientboundSetBorderWarningDistancePacket(worldborder), worldborder.world); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -351,14 +440,15 @@
|
||||
@@ -354,14 +441,15 @@
|
||||
}
|
||||
|
||||
protected void savePlayerFile(EntityPlayer entityplayer) {
|
||||
+ if (!entityplayer.getBukkitEntity().isPersistent()) return; // CraftBukkit
|
||||
this.playerFileData.save(entityplayer);
|
||||
- ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) this.o.get(entityplayer.getUniqueID());
|
||||
this.playerIo.save(entityplayer);
|
||||
- ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) this.stats.get(entityplayer.getUniqueID());
|
||||
+ ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) entityplayer.getStatisticManager(); // CraftBukkit
|
||||
|
||||
if (serverstatisticmanager != null) {
|
||||
serverstatisticmanager.save();
|
||||
}
|
||||
|
||||
- AdvancementDataPlayer advancementdataplayer = (AdvancementDataPlayer) this.p.get(entityplayer.getUniqueID());
|
||||
- AdvancementDataPlayer advancementdataplayer = (AdvancementDataPlayer) this.advancements.get(entityplayer.getUniqueID());
|
||||
+ AdvancementDataPlayer advancementdataplayer = (AdvancementDataPlayer) entityplayer.getAdvancementData(); // CraftBukkit
|
||||
|
||||
if (advancementdataplayer != null) {
|
||||
advancementdataplayer.b();
|
||||
@@ -366,10 +456,24 @@
|
||||
@@ -369,10 +457,24 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -262,7 +260,7 @@
|
||||
+
|
||||
+ // CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
|
||||
+ // See SPIGOT-5799, SPIGOT-6145
|
||||
+ if (entityplayer.activeContainer != entityplayer.defaultContainer) {
|
||||
+ if (entityplayer.containerMenu != entityplayer.inventoryMenu) {
|
||||
+ entityplayer.closeInventory();
|
||||
+ }
|
||||
+
|
||||
@@ -276,19 +274,18 @@
|
||||
this.savePlayerFile(entityplayer);
|
||||
if (entityplayer.isPassenger()) {
|
||||
Entity entity = entityplayer.getRootVehicle();
|
||||
@@ -401,18 +505,66 @@
|
||||
@@ -396,18 +498,66 @@
|
||||
|
||||
if (entityplayer1 == entityplayer) {
|
||||
this.j.remove(uuid);
|
||||
- this.o.remove(uuid);
|
||||
- this.p.remove(uuid);
|
||||
this.playersByUUID.remove(uuid);
|
||||
- this.stats.remove(uuid);
|
||||
- this.advancements.remove(uuid);
|
||||
+ // CraftBukkit start
|
||||
+ // this.o.remove(uuid);
|
||||
+ // this.p.remove(uuid);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
- this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[]{entityplayer}));
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ // this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[]{entityplayer}));
|
||||
+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, entityplayer);
|
||||
@@ -296,15 +293,16 @@
|
||||
+ EntityPlayer entityplayer2 = (EntityPlayer) this.players.get(i);
|
||||
+
|
||||
+ if (entityplayer2.getBukkitEntity().canSee(entityplayer.getBukkitEntity())) {
|
||||
+ entityplayer2.playerConnection.sendPacket(packet);
|
||||
+ entityplayer2.connection.sendPacket(packet);
|
||||
+ } else {
|
||||
+ entityplayer2.getBukkitEntity().removeDisconnectingPlayer(entityplayer.getBukkitEntity());
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
+ // This removes the scoreboard (and player reference) for the specific player in the manager
|
||||
+ cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity());
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
- this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[]{entityplayer}));
|
||||
+ return playerQuitEvent.getQuitMessage(); // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -314,7 +312,7 @@
|
||||
+ public EntityPlayer attemptLogin(LoginListener loginlistener, GameProfile gameprofile, String hostname) {
|
||||
ChatMessage chatmessage;
|
||||
|
||||
- if (this.k.isBanned(gameprofile)) {
|
||||
- if (this.bans.isBanned(gameprofile)) {
|
||||
+ // Moved from processLogin
|
||||
+ UUID uuid = EntityHuman.a(gameprofile);
|
||||
+ List<EntityPlayer> list = Lists.newArrayList();
|
||||
@@ -333,24 +331,24 @@
|
||||
+ while (iterator.hasNext()) {
|
||||
+ entityplayer = (EntityPlayer) iterator.next();
|
||||
+ savePlayerFile(entityplayer); // CraftBukkit - Force the player's inventory to be saved
|
||||
+ entityplayer.playerConnection.disconnect(new ChatMessage("multiplayer.disconnect.duplicate_login", new Object[0]));
|
||||
+ entityplayer.connection.disconnect(new ChatMessage("multiplayer.disconnect.duplicate_login", new Object[0]));
|
||||
+ }
|
||||
+
|
||||
+ // Instead of kicking then returning, we need to store the kick reason
|
||||
+ // in the event, check with plugins to see if it's ok, and THEN kick
|
||||
+ // depending on the outcome.
|
||||
+ SocketAddress socketaddress = loginlistener.networkManager.getSocketAddress();
|
||||
+ SocketAddress socketaddress = loginlistener.connection.getSocketAddress();
|
||||
+
|
||||
+ EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(World.OVERWORLD), gameprofile, new PlayerInteractManager(this.server.getWorldServer(World.OVERWORLD)));
|
||||
+ EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(World.OVERWORLD), gameprofile);
|
||||
+ Player player = entity.getBukkitEntity();
|
||||
+ PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress());
|
||||
+
|
||||
+ if (getProfileBans().isBanned(gameprofile) && !getProfileBans().get(gameprofile).hasExpired()) {
|
||||
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.k.get(gameprofile);
|
||||
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.bans.get(gameprofile);
|
||||
|
||||
chatmessage = new ChatMessage("multiplayer.disconnect.banned.reason", new Object[]{gameprofilebanentry.getReason()});
|
||||
@@ -420,10 +572,12 @@
|
||||
chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned.expiration", new Object[]{PlayerList.g.format(gameprofilebanentry.getExpires())}));
|
||||
@@ -415,10 +565,12 @@
|
||||
chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned.expiration", new Object[]{PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires())}));
|
||||
}
|
||||
|
||||
- return chatmessage;
|
||||
@@ -358,33 +356,33 @@
|
||||
+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage));
|
||||
} else if (!this.isWhitelisted(gameprofile)) {
|
||||
- return new ChatMessage("multiplayer.disconnect.not_whitelisted");
|
||||
- } else if (this.l.isBanned(socketaddress)) {
|
||||
- } else if (this.ipBans.isBanned(socketaddress)) {
|
||||
+ chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted");
|
||||
+ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, CraftChatMessage.fromComponent(chatmessage));
|
||||
+ } else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) {
|
||||
IpBanEntry ipbanentry = this.l.get(socketaddress);
|
||||
IpBanEntry ipbanentry = this.ipBans.get(socketaddress);
|
||||
|
||||
chatmessage = new ChatMessage("multiplayer.disconnect.banned_ip.reason", new Object[]{ipbanentry.getReason()});
|
||||
@@ -431,13 +585,25 @@
|
||||
chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned_ip.expiration", new Object[]{PlayerList.g.format(ipbanentry.getExpires())}));
|
||||
@@ -426,13 +578,25 @@
|
||||
chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned_ip.expiration", new Object[]{PlayerList.BAN_DATE_FORMAT.format(ipbanentry.getExpires())}));
|
||||
}
|
||||
|
||||
- return chatmessage;
|
||||
+ // return chatmessage;
|
||||
+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage));
|
||||
} else {
|
||||
- return this.players.size() >= this.maxPlayers && !this.f(gameprofile) ? new ChatMessage("multiplayer.disconnect.server_full") : null;
|
||||
+ // return this.players.size() >= this.maxPlayers && !this.f(gameprofile) ? new ChatMessage("multiplayer.disconnect.server_full") : null;
|
||||
+ if (this.players.size() >= this.maxPlayers && !this.f(gameprofile)) {
|
||||
- return this.players.size() >= this.maxPlayers && !this.d(gameprofile) ? new ChatMessage("multiplayer.disconnect.server_full") : null;
|
||||
+ // return this.players.size() >= this.maxPlayers && !this.d(gameprofile) ? new ChatMessage("multiplayer.disconnect.server_full") : null;
|
||||
+ if (this.players.size() >= this.maxPlayers && !this.d(gameprofile)) {
|
||||
+ event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full");
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
+
|
||||
+ cserver.getPluginManager().callEvent(event);
|
||||
+ if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) {
|
||||
+ loginlistener.disconnect(event.getKickMessage());
|
||||
+ return null;
|
||||
}
|
||||
+ }
|
||||
+ return entity;
|
||||
}
|
||||
|
||||
@@ -394,10 +392,10 @@
|
||||
UUID uuid = EntityHuman.a(gameprofile);
|
||||
List<EntityPlayer> list = Lists.newArrayList();
|
||||
|
||||
@@ -473,14 +639,24 @@
|
||||
@@ -459,14 +623,24 @@
|
||||
}
|
||||
|
||||
return new EntityPlayer(this.server, worldserver, gameprofile, (PlayerInteractManager) object);
|
||||
return new EntityPlayer(this.server, this.server.F(), gameprofile);
|
||||
+ */
|
||||
+ return player;
|
||||
+ // CraftBukkit end
|
||||
@@ -411,7 +409,7 @@
|
||||
+ public EntityPlayer moveToWorld(EntityPlayer entityplayer, WorldServer worldserver, boolean flag, Location location, boolean avoidSuffocation) {
|
||||
+ entityplayer.stopRiding(); // CraftBukkit
|
||||
this.players.remove(entityplayer);
|
||||
entityplayer.getWorldServer().removePlayer(entityplayer);
|
||||
entityplayer.getWorldServer().a(entityplayer, Entity.RemovalReason.DISCARDED);
|
||||
BlockPosition blockposition = entityplayer.getSpawn();
|
||||
float f = entityplayer.getSpawnAngle();
|
||||
boolean flag1 = entityplayer.isSpawnForced();
|
||||
@@ -419,24 +417,20 @@
|
||||
WorldServer worldserver = this.server.getWorldServer(entityplayer.getSpawnDimension());
|
||||
Optional optional;
|
||||
|
||||
@@ -500,6 +676,11 @@
|
||||
}
|
||||
@@ -478,6 +652,11 @@
|
||||
|
||||
EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getProfile(), (PlayerInteractManager) object);
|
||||
WorldServer worldserver1 = worldserver != null && optional.isPresent() ? worldserver : this.server.F();
|
||||
EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getProfile());
|
||||
+ // */
|
||||
+ EntityPlayer entityplayer1 = entityplayer;
|
||||
+ org.bukkit.World fromWorld = entityplayer.getBukkitEntity().getWorld();
|
||||
+ entityplayer.viewingCredits = false;
|
||||
+ entityplayer.wonGame = false;
|
||||
+ // CraftBukkit end
|
||||
|
||||
entityplayer1.playerConnection = entityplayer.playerConnection;
|
||||
entityplayer1.connection = entityplayer.connection;
|
||||
entityplayer1.copyFrom(entityplayer, flag);
|
||||
@@ -513,52 +694,113 @@
|
||||
entityplayer1.addScoreboardTag(s);
|
||||
}
|
||||
@@ -493,49 +672,110 @@
|
||||
|
||||
- this.a(entityplayer1, entityplayer, worldserver1);
|
||||
+ // this.a(entityplayer1, entityplayer, worldserver1); // CraftBukkit - removed
|
||||
boolean flag2 = false;
|
||||
|
||||
- if (optional.isPresent()) {
|
||||
@@ -472,30 +466,30 @@
|
||||
+ } else {
|
||||
+ Vec3D vec3d1 = Vec3D.c((BaseBlockPosition) blockposition).d(vec3d).d();
|
||||
+
|
||||
+ f1 = (float) MathHelper.g(MathHelper.d(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
+ f1 = (float) MathHelper.f(MathHelper.d(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
+ }
|
||||
|
||||
- f1 = (float) MathHelper.g(MathHelper.d(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
+
|
||||
+ entityplayer1.setRespawnPosition(worldserver1.getDimensionKey(), blockposition, f, flag1, false);
|
||||
+ flag2 = !flag && flag3;
|
||||
+ isBedSpawn = true;
|
||||
+ location = new Location(worldserver1.getWorld(), vec3d.x, vec3d.y, vec3d.z, f1, 0.0F);
|
||||
+ } else if (blockposition != null) {
|
||||
+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.a, 0.0F));
|
||||
+ entityplayer1.connection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- f1 = (float) MathHelper.f(MathHelper.d(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
+ if (location == null) {
|
||||
+ worldserver1 = this.server.getWorldServer(World.OVERWORLD);
|
||||
+ blockposition = entityplayer1.getSpawnPoint(worldserver1);
|
||||
+ location = new Location(worldserver1.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.1F), (double) ((float) blockposition.getZ() + 0.5F));
|
||||
}
|
||||
|
||||
- entityplayer1.setPositionRotation(vec3d.x, vec3d.y, vec3d.z, f1, 0.0F);
|
||||
- entityplayer1.setRespawnPosition(worldserver1.getDimensionKey(), blockposition, f, flag1, false);
|
||||
- flag2 = !flag && flag3;
|
||||
- } else if (blockposition != null) {
|
||||
- entityplayer1.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.a, 0.0F));
|
||||
+ if (location == null) {
|
||||
+ worldserver1 = this.server.getWorldServer(World.OVERWORLD);
|
||||
+ blockposition = entityplayer1.getSpawnPoint(worldserver1);
|
||||
+ location = new Location(worldserver1.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.1F), (double) ((float) blockposition.getZ() + 0.5F));
|
||||
+ }
|
||||
+
|
||||
- entityplayer1.connection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
|
||||
+ Player respawnPlayer = cserver.getPlayer(entityplayer1);
|
||||
+ PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !flag2, flag2);
|
||||
+ cserver.getPluginManager().callEvent(respawnEvent);
|
||||
@@ -509,48 +503,48 @@
|
||||
+ entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
+ // CraftBukkit end
|
||||
|
||||
- while (!worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) {
|
||||
+ while (avoidSuffocation && !worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) {
|
||||
- while (!worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < (double) worldserver1.getMaxBuildHeight()) {
|
||||
+ while (avoidSuffocation && !worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < (double) worldserver1.getMaxBuildHeight()) {
|
||||
entityplayer1.setPosition(entityplayer1.locX(), entityplayer1.locY() + 1.0D, entityplayer1.locZ());
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ WorldData worlddata = worldserver1.getWorldData();
|
||||
+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver1.getDimensionManager(), worldserver1.getDimensionKey(), BiomeManager.a(worldserver1.getSeed()), entityplayer1.playerInteractManager.getGameMode(), entityplayer1.playerInteractManager.c(), worldserver1.isDebugWorld(), worldserver1.isFlatWorld(), flag));
|
||||
+ entityplayer1.connection.sendPacket(new PacketPlayOutRespawn(worldserver1.getDimensionManager(), worldserver1.getDimensionKey(), BiomeManager.a(worldserver1.getSeed()), entityplayer1.gameMode.getGameMode(), entityplayer1.gameMode.c(), worldserver1.isDebugWorld(), worldserver1.isFlatWorld(), flag));
|
||||
+ entityplayer1.spawnIn(worldserver1);
|
||||
+ entityplayer1.dead = false;
|
||||
+ entityplayer1.playerConnection.teleport(new Location(worldserver1.getWorld(), entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.yaw, entityplayer1.pitch));
|
||||
+ entityplayer1.unsetRemoved();
|
||||
+ entityplayer1.connection.teleport(new Location(worldserver1.getWorld(), entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.getYRot(), entityplayer1.getXRot()));
|
||||
+ entityplayer1.setSneaking(false);
|
||||
|
||||
- WorldData worlddata = entityplayer1.world.getWorldData();
|
||||
- WorldData worlddata = entityplayer1.level.getWorldData();
|
||||
-
|
||||
- entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(entityplayer1.world.getDimensionManager(), entityplayer1.world.getDimensionKey(), BiomeManager.a(entityplayer1.getWorldServer().getSeed()), entityplayer1.playerInteractManager.getGameMode(), entityplayer1.playerInteractManager.c(), entityplayer1.getWorldServer().isDebugWorld(), entityplayer1.getWorldServer().isFlatWorld(), flag));
|
||||
- entityplayer1.playerConnection.a(entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.yaw, entityplayer1.pitch);
|
||||
+ // entityplayer1.playerConnection.a(entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.yaw, entityplayer1.pitch);
|
||||
entityplayer1.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(worldserver1.getSpawn(), worldserver1.v()));
|
||||
entityplayer1.playerConnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
entityplayer1.playerConnection.sendPacket(new PacketPlayOutExperience(entityplayer1.exp, entityplayer1.expTotal, entityplayer1.expLevel));
|
||||
- entityplayer1.connection.sendPacket(new PacketPlayOutRespawn(entityplayer1.level.getDimensionManager(), entityplayer1.level.getDimensionKey(), BiomeManager.a(entityplayer1.getWorldServer().getSeed()), entityplayer1.gameMode.getGameMode(), entityplayer1.gameMode.c(), entityplayer1.getWorldServer().isDebugWorld(), entityplayer1.getWorldServer().isFlatWorld(), flag));
|
||||
- entityplayer1.connection.b(entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
|
||||
+ // entityplayer1.connection.b(entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
|
||||
entityplayer1.connection.sendPacket(new PacketPlayOutSpawnPosition(worldserver1.getSpawn(), worldserver1.x()));
|
||||
entityplayer1.connection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
entityplayer1.connection.sendPacket(new PacketPlayOutExperience(entityplayer1.experienceProgress, entityplayer1.totalExperience, entityplayer1.experienceLevel));
|
||||
this.a(entityplayer1, worldserver1);
|
||||
this.d(entityplayer1);
|
||||
- worldserver1.addPlayerRespawn(entityplayer1);
|
||||
- this.players.add(entityplayer1);
|
||||
- this.j.put(entityplayer1.getUniqueID(), entityplayer1);
|
||||
- this.playersByUUID.put(entityplayer1.getUniqueID(), entityplayer1);
|
||||
- entityplayer1.syncInventory();
|
||||
+ if (!entityplayer.playerConnection.isDisconnected()) {
|
||||
+ if (!entityplayer.connection.isDisconnected()) {
|
||||
+ worldserver1.addPlayerRespawn(entityplayer1);
|
||||
+ this.players.add(entityplayer1);
|
||||
+ this.j.put(entityplayer1.getUniqueID(), entityplayer1);
|
||||
+ this.playersByUUID.put(entityplayer1.getUniqueID(), entityplayer1);
|
||||
+ }
|
||||
+ // entityplayer1.syncInventory();
|
||||
entityplayer1.setHealth(entityplayer1.getHealth());
|
||||
if (flag2) {
|
||||
entityplayer1.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.BLOCK_RESPAWN_ANCHOR_DEPLETE, SoundCategory.BLOCKS, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 1.0F, 1.0F));
|
||||
entityplayer1.connection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.RESPAWN_ANCHOR_DEPLETE, SoundCategory.BLOCKS, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 1.0F, 1.0F));
|
||||
}
|
||||
+ // Added from changeDimension
|
||||
+ updateClient(entityplayer); // Update health, etc...
|
||||
+ entityplayer.updateAbilities();
|
||||
+ for (Object o1 : entityplayer.getEffects()) {
|
||||
+ MobEffect mobEffect = (MobEffect) o1;
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobEffect));
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobEffect));
|
||||
+ }
|
||||
+
|
||||
+ // Fire advancement trigger
|
||||
@@ -563,34 +557,34 @@
|
||||
+ }
|
||||
|
||||
+ // Save player file again if they were disconnected
|
||||
+ if (entityplayer.playerConnection.isDisconnected()) {
|
||||
+ if (entityplayer.connection.isDisconnected()) {
|
||||
+ this.savePlayerFile(entityplayer);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return entityplayer1;
|
||||
}
|
||||
|
||||
@@ -571,7 +813,18 @@
|
||||
@@ -548,7 +788,18 @@
|
||||
|
||||
public void tick() {
|
||||
if (++this.w > 600) {
|
||||
if (++this.sendAllPlayerInfoIn > 600) {
|
||||
- this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_LATENCY, this.players));
|
||||
+ // CraftBukkit start
|
||||
+ for (int i = 0; i < this.players.size(); ++i) {
|
||||
+ final EntityPlayer target = (EntityPlayer) this.players.get(i);
|
||||
+
|
||||
+ target.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_LATENCY, Iterables.filter(this.players, new Predicate<EntityPlayer>() {
|
||||
+ target.connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_LATENCY, this.players.stream().filter(new Predicate<EntityPlayer>() {
|
||||
+ @Override
|
||||
+ public boolean apply(EntityPlayer input) {
|
||||
+ return target.getBukkitEntity().canSee(input.getBukkitEntity());
|
||||
+ }
|
||||
+ })));
|
||||
+ }).collect(Collectors.toList())));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.w = 0;
|
||||
this.sendAllPlayerInfoIn = 0;
|
||||
}
|
||||
|
||||
@@ -584,6 +837,25 @@
|
||||
@@ -565,6 +816,25 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -601,30 +595,30 @@
|
||||
+ if (entityhuman != null && entityhuman instanceof EntityPlayer && !entityplayer.getBukkitEntity().canSee(((EntityPlayer) entityhuman).getBukkitEntity())) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ ((EntityPlayer) this.players.get(i)).playerConnection.sendPacket(packet);
|
||||
+ ((EntityPlayer) this.players.get(i)).connection.sendPacket(packet);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void sendAll(Packet packet, World world) {
|
||||
+ for (int i = 0; i < world.getPlayers().size(); ++i) {
|
||||
+ ((EntityPlayer) world.getPlayers().get(i)).playerConnection.sendPacket(packet);
|
||||
+ ((EntityPlayer) world.getPlayers().get(i)).connection.sendPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void a(Packet<?> packet, ResourceKey<World> resourcekey) {
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
|
||||
@@ -684,6 +956,7 @@
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0));
|
||||
Iterator iterator = this.players.iterator();
|
||||
|
||||
@@ -667,6 +937,7 @@
|
||||
entityplayer.connection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0));
|
||||
}
|
||||
|
||||
+ entityplayer.getBukkitEntity().recalculatePermissions(); // CraftBukkit
|
||||
this.server.getCommandDispatcher().a(entityplayer);
|
||||
}
|
||||
|
||||
@@ -716,6 +989,12 @@
|
||||
@@ -699,6 +970,12 @@
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
|
||||
|
||||
@@ -634,23 +628,23 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (entityplayer != entityhuman && entityplayer.world.getDimensionKey() == resourcekey) {
|
||||
if (entityplayer != entityhuman && entityplayer.level.getDimensionKey() == resourcekey) {
|
||||
double d4 = d0 - entityplayer.locX();
|
||||
double d5 = d1 - entityplayer.locY();
|
||||
@@ -755,23 +1034,34 @@
|
||||
@@ -738,23 +1015,34 @@
|
||||
public void reloadWhitelist() {}
|
||||
|
||||
public void a(EntityPlayer entityplayer, WorldServer worldserver) {
|
||||
- WorldBorder worldborder = this.server.E().getWorldBorder();
|
||||
+ WorldBorder worldborder = entityplayer.world.getWorldBorder(); // CraftBukkit
|
||||
- WorldBorder worldborder = this.server.F().getWorldBorder();
|
||||
+ WorldBorder worldborder = entityplayer.level.getWorldBorder(); // CraftBukkit
|
||||
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.INITIALIZE));
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)));
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(worldserver.getSpawn(), worldserver.v()));
|
||||
entityplayer.connection.sendPacket(new ClientboundInitializeBorderPacket(worldborder));
|
||||
entityplayer.connection.sendPacket(new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)));
|
||||
entityplayer.connection.sendPacket(new PacketPlayOutSpawnPosition(worldserver.getSpawn(), worldserver.x()));
|
||||
if (worldserver.isRaining()) {
|
||||
- entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.b, 0.0F));
|
||||
- entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.h, worldserver.d(1.0F)));
|
||||
- entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.i, worldserver.b(1.0F)));
|
||||
- entityplayer.connection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.START_RAINING, 0.0F));
|
||||
- entityplayer.connection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, worldserver.d(1.0F)));
|
||||
- entityplayer.connection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, worldserver.b(1.0F)));
|
||||
+ // CraftBukkit start - handle player weather
|
||||
+ // entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.b, 0.0F));
|
||||
+ // entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.h, worldserver.d(1.0F)));
|
||||
@@ -663,62 +657,52 @@
|
||||
}
|
||||
|
||||
public void updateClient(EntityPlayer entityplayer) {
|
||||
entityplayer.updateInventory(entityplayer.defaultContainer);
|
||||
entityplayer.inventoryMenu.updateInventory();
|
||||
- entityplayer.triggerHealthUpdate();
|
||||
+ // entityplayer.triggerHealthUpdate();
|
||||
+ entityplayer.getBukkitEntity().updateScaledHealth(); // CraftBukkit - Update scaled health on respawn and worldchange
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
|
||||
entityplayer.connection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.getInventory().selected));
|
||||
+ // CraftBukkit start - from GameRules
|
||||
+ int i = entityplayer.world.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23;
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) i));
|
||||
+ float immediateRespawn = entityplayer.world.getGameRules().getBoolean(GameRules.DO_IMMEDIATE_RESPAWN) ? 1.0F: 0.0F;
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.l, immediateRespawn));
|
||||
+ int i = entityplayer.level.getGameRules().getBoolean(GameRules.RULE_REDUCEDDEBUGINFO) ? 22 : 23;
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) i));
|
||||
+ float immediateRespawn = entityplayer.level.getGameRules().getBoolean(GameRules.RULE_DO_IMMEDIATE_RESPAWN) ? 1.0F: 0.0F;
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.IMMEDIATE_RESPAWN, immediateRespawn));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public int getPlayerCount() {
|
||||
@@ -824,31 +1114,54 @@
|
||||
entityplayer.playerInteractManager.a(this.u, EnumGamemode.NOT_SET);
|
||||
}
|
||||
|
||||
- entityplayer.playerInteractManager.b(worldserver.getMinecraftServer().getSaveData().getGameType());
|
||||
+ entityplayer.playerInteractManager.b(worldserver.worldDataServer.getGameType()); // CraftBukkit
|
||||
@@ -805,12 +1093,22 @@
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
- for (int i = 0; i < this.players.size(); ++i) {
|
||||
- ((EntityPlayer) this.players.get(i)).playerConnection.disconnect(new ChatMessage("multiplayer.disconnect.server_shutdown"));
|
||||
- ((EntityPlayer) this.players.get(i)).connection.disconnect(new ChatMessage("multiplayer.disconnect.server_shutdown"));
|
||||
+ // CraftBukkit start - disconnect safely
|
||||
+ for (EntityPlayer player : this.players) {
|
||||
+ player.playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message
|
||||
+ player.connection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ }
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void sendMessage(IChatBaseComponent[] iChatBaseComponents) {
|
||||
+ for (IChatBaseComponent component : iChatBaseComponents) {
|
||||
+ sendMessage(component, ChatMessageType.SYSTEM, SystemUtils.b);
|
||||
+ sendMessage(component, ChatMessageType.SYSTEM, SystemUtils.NIL_UUID);
|
||||
+ }
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
public void sendMessage(IChatBaseComponent ichatbasecomponent, ChatMessageType chatmessagetype, UUID uuid) {
|
||||
this.server.sendMessage(ichatbasecomponent, uuid);
|
||||
- this.sendAll(new PacketPlayOutChat(ichatbasecomponent, chatmessagetype, uuid));
|
||||
+ // CraftBukkit start - we run this through our processor first so we can get web links etc
|
||||
+ this.sendAll(new PacketPlayOutChat(CraftChatMessage.fixComponent(ichatbasecomponent), chatmessagetype, uuid));
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+
|
||||
+ public void sendMessage(IChatBaseComponent ichatbasecomponent) {
|
||||
+ this.sendMessage(ichatbasecomponent, ChatMessageType.SYSTEM, SystemUtils.b);
|
||||
Iterator iterator = this.players.iterator();
|
||||
@@ -838,16 +1136,23 @@
|
||||
|
||||
}
|
||||
|
||||
- public ServerStatisticManager getStatisticManager(EntityHuman entityhuman) {
|
||||
- UUID uuid = entityhuman.getUniqueID();
|
||||
- ServerStatisticManager serverstatisticmanager = uuid == null ? null : (ServerStatisticManager) this.o.get(uuid);
|
||||
- ServerStatisticManager serverstatisticmanager = uuid == null ? null : (ServerStatisticManager) this.stats.get(uuid);
|
||||
+ // CraftBukkit start
|
||||
+ public ServerStatisticManager getStatisticManager(EntityPlayer entityhuman) {
|
||||
+ ServerStatisticManager serverstatisticmanager = entityhuman.getStatisticManager();
|
||||
@@ -731,7 +715,7 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (serverstatisticmanager == null) {
|
||||
File file = this.server.a(SavedFile.STATS).toFile();
|
||||
File file = this.server.a(SavedFile.PLAYER_STATS_DIR).toFile();
|
||||
File file1 = new File(file, uuid + ".json");
|
||||
|
||||
if (!file1.exists()) {
|
||||
@@ -740,37 +724,37 @@
|
||||
|
||||
if (file2.exists() && file2.isFile()) {
|
||||
file2.renameTo(file1);
|
||||
@@ -856,7 +1169,7 @@
|
||||
@@ -855,7 +1160,7 @@
|
||||
}
|
||||
|
||||
serverstatisticmanager = new ServerStatisticManager(this.server, file1);
|
||||
- this.o.put(uuid, serverstatisticmanager);
|
||||
- this.stats.put(uuid, serverstatisticmanager);
|
||||
+ // this.o.put(uuid, serverstatisticmanager); // CraftBukkit
|
||||
}
|
||||
|
||||
return serverstatisticmanager;
|
||||
@@ -864,14 +1177,14 @@
|
||||
@@ -863,14 +1168,14 @@
|
||||
|
||||
public AdvancementDataPlayer f(EntityPlayer entityplayer) {
|
||||
UUID uuid = entityplayer.getUniqueID();
|
||||
- AdvancementDataPlayer advancementdataplayer = (AdvancementDataPlayer) this.p.get(uuid);
|
||||
- AdvancementDataPlayer advancementdataplayer = (AdvancementDataPlayer) this.advancements.get(uuid);
|
||||
+ AdvancementDataPlayer advancementdataplayer = (AdvancementDataPlayer) entityplayer.getAdvancementData(); // CraftBukkit
|
||||
|
||||
if (advancementdataplayer == null) {
|
||||
File file = this.server.a(SavedFile.ADVANCEMENTS).toFile();
|
||||
File file = this.server.a(SavedFile.PLAYER_ADVANCEMENTS_DIR).toFile();
|
||||
File file1 = new File(file, uuid + ".json");
|
||||
|
||||
advancementdataplayer = new AdvancementDataPlayer(this.server.getDataFixer(), this, this.server.getAdvancementData(), file1, entityplayer);
|
||||
- this.p.put(uuid, advancementdataplayer);
|
||||
- this.advancements.put(uuid, advancementdataplayer);
|
||||
+ // this.p.put(uuid, advancementdataplayer); // CraftBukkit
|
||||
}
|
||||
|
||||
advancementdataplayer.a(entityplayer);
|
||||
@@ -907,13 +1220,20 @@
|
||||
@@ -906,13 +1211,20 @@
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
- Iterator iterator = this.p.values().iterator();
|
||||
- Iterator iterator = this.advancements.values().iterator();
|
||||
+ // CraftBukkit start
|
||||
+ /*Iterator iterator = this.p.values().iterator();
|
||||
|
||||
@@ -786,5 +770,5 @@
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
this.sendAll(new PacketPlayOutTags(this.server.getTagRegistry()));
|
||||
this.sendAll(new PacketPlayOutTags(this.server.getTagRegistry().a((IRegistryCustom) this.registryHolder)));
|
||||
PacketPlayOutRecipeUpdate packetplayoutrecipeupdate = new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b());
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/server/players/SleepStatus.java
|
||||
+++ b/net/minecraft/server/players/SleepStatus.java
|
||||
@@ -18,7 +18,7 @@
|
||||
}
|
||||
|
||||
public boolean a(int i, List<EntityPlayer> list) {
|
||||
- int j = (int) list.stream().filter(EntityHuman::isDeeplySleeping).count();
|
||||
+ int j = (int) list.stream().filter((eh) -> { return eh.isDeeplySleeping() || eh.fauxSleeping; }).count(); // CraftBukkit
|
||||
|
||||
return j >= this.b(i);
|
||||
}
|
||||
@@ -46,7 +46,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
- if (!entityplayer.isSpectator()) {
|
||||
+ if (!entityplayer.isSpectator() && !entityplayer.fauxSleeping) { // CraftBukkit
|
||||
++this.activePlayers;
|
||||
if (entityplayer.isSleeping()) {
|
||||
++this.sleepingPlayers;
|
||||
@@ -5,7 +5,7 @@
|
||||
package net.minecraft.server.players;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -83,7 +84,7 @@
|
||||
@@ -92,7 +93,7 @@
|
||||
}
|
||||
|
||||
public void onProfileLookupFailed(GameProfile gameprofile, Exception exception) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/server/rcon/RemoteControlCommandListener.java
|
||||
+++ b/net/minecraft/server/rcon/RemoteControlCommandListener.java
|
||||
@@ -36,6 +36,17 @@
|
||||
return new CommandListenerWrapper(this, Vec3D.b((BaseBlockPosition) worldserver.getSpawn()), Vec2F.a, worldserver, 4, "Rcon", RemoteControlCommandListener.b, this.server, (Entity) null);
|
||||
@@ -37,6 +37,17 @@
|
||||
return new CommandListenerWrapper(this, Vec3D.b((BaseBlockPosition) worldserver.getSpawn()), Vec2F.ZERO, worldserver, 4, "Rcon", RemoteControlCommandListener.RCON_COMPONENT, this.server, (Entity) null);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Send a String
|
||||
|
||||
Reference in New Issue
Block a user