@@ -17,7 +17,7 @@
|
||||
this.progressChanged.add(advancement);
|
||||
flag = true;
|
||||
if (!flag1 && advancementprogress.isDone()) {
|
||||
+ this.player.level.getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit
|
||||
+ this.player.level().getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit
|
||||
advancement.getRewards().grant(this.player);
|
||||
if (advancement.getDisplay() != null && advancement.getDisplay().shouldAnnounceChat() && this.player.level.getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
|
||||
if (advancement.getDisplay() != null && advancement.getDisplay().shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
|
||||
this.playerList.broadcastSystemMessage(IChatBaseComponent.translatable("chat.type.advancement." + advancement.getDisplay().getFrame().getName(), this.player.getDisplayName(), advancement.getChatComponent()), false);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/CustomFunctionData.java
|
||||
+++ b/net/minecraft/server/CustomFunctionData.java
|
||||
@@ -42,7 +42,7 @@
|
||||
@@ -43,7 +43,7 @@
|
||||
}
|
||||
|
||||
public CommandDispatcher<CommandListenerWrapper> getDispatcher() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/DispenserRegistry.java
|
||||
+++ b/net/minecraft/server/DispenserRegistry.java
|
||||
@@ -26,6 +26,12 @@
|
||||
@@ -30,6 +30,12 @@
|
||||
import net.minecraft.world.level.block.BlockFire;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public class DispenserRegistry {
|
||||
|
||||
public static final PrintStream STDOUT = System.out;
|
||||
@@ -36,6 +42,23 @@
|
||||
@@ -41,6 +47,23 @@
|
||||
|
||||
public static void bootStrap() {
|
||||
if (!DispenserRegistry.isBootstrapped) {
|
||||
@@ -35,11 +35,11 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
DispenserRegistry.isBootstrapped = true;
|
||||
if (BuiltInRegistries.REGISTRY.keySet().isEmpty()) {
|
||||
throw new IllegalStateException("Unable to load registries");
|
||||
@@ -52,6 +75,69 @@
|
||||
BuiltInRegistries.bootStrap();
|
||||
Instant instant = Instant.now();
|
||||
|
||||
@@ -61,6 +84,69 @@
|
||||
wrapStreams();
|
||||
DispenserRegistry.bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis());
|
||||
}
|
||||
+ // CraftBukkit start - easier than fixing the decompile
|
||||
+ DataConverterFlattenData.register(1008, "{Name:'minecraft:oak_sign',Properties:{rotation:'0'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'0'}}");
|
||||
|
||||
@@ -89,8 +89,8 @@
|
||||
+ // CraftBukkit start
|
||||
+ String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
Convertable convertable = Convertable.createDefault(file.toPath());
|
||||
- Convertable.ConversionSession convertable_conversionsession = convertable.createAccess(s);
|
||||
+ Convertable.ConversionSession convertable_conversionsession = convertable.createAccess(s, WorldDimension.OVERWORLD);
|
||||
- Convertable.ConversionSession convertable_conversionsession = convertable.validateAndCreateAccess(s);
|
||||
+ Convertable.ConversionSession convertable_conversionsession = convertable.validateAndCreateAccess(s, WorldDimension.OVERWORLD);
|
||||
WorldInfo worldinfo = convertable_conversionsession.getSummary();
|
||||
|
||||
if (worldinfo != null) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -165,6 +165,32 @@
|
||||
@@ -164,6 +164,33 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
+import net.minecraft.world.level.levelgen.WorldDimensions;
|
||||
+import net.minecraft.world.level.levelgen.presets.WorldPresets;
|
||||
+import net.minecraft.world.level.storage.WorldDataServer;
|
||||
+import net.minecraft.world.level.validation.ContentValidationException;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.CraftServer;
|
||||
+import org.bukkit.craftbukkit.Main;
|
||||
@@ -33,7 +34,7 @@
|
||||
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements ICommandListener, AutoCloseable {
|
||||
|
||||
public static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -250,6 +276,20 @@
|
||||
@@ -249,6 +276,20 @@
|
||||
protected SaveData worldData;
|
||||
private volatile boolean isSaving;
|
||||
|
||||
@@ -54,7 +55,7 @@
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> function) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
Thread thread = new Thread(() -> {
|
||||
@@ -263,14 +303,14 @@
|
||||
@@ -262,14 +303,14 @@
|
||||
thread.setPriority(8);
|
||||
}
|
||||
|
||||
@@ -71,7 +72,7 @@
|
||||
super("Server");
|
||||
this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
|
||||
this.profiler = this.metricsRecorder.getProfiler();
|
||||
@@ -290,7 +330,7 @@
|
||||
@@ -289,7 +330,7 @@
|
||||
this.frameTimer = new CircularTimer();
|
||||
this.registries = worldstem.registries();
|
||||
this.worldData = worldstem.worldData();
|
||||
@@ -80,7 +81,7 @@
|
||||
throw new IllegalStateException("Missing Overworld dimension data");
|
||||
} else {
|
||||
this.proxy = proxy;
|
||||
@@ -313,13 +353,40 @@
|
||||
@@ -312,13 +353,40 @@
|
||||
this.serverThread = thread;
|
||||
this.executor = SystemUtils.backgroundExecutor();
|
||||
}
|
||||
@@ -122,7 +123,7 @@
|
||||
ScoreboardServer scoreboardserver1 = this.getScoreboard();
|
||||
|
||||
Objects.requireNonNull(scoreboardserver1);
|
||||
@@ -328,7 +395,7 @@
|
||||
@@ -327,7 +395,7 @@
|
||||
|
||||
protected abstract boolean initServer() throws IOException;
|
||||
|
||||
@@ -131,7 +132,7 @@
|
||||
if (!JvmProfiler.INSTANCE.isRunning()) {
|
||||
;
|
||||
}
|
||||
@@ -336,12 +403,8 @@
|
||||
@@ -335,12 +403,8 @@
|
||||
boolean flag = false;
|
||||
ProfiledDuration profiledduration = JvmProfiler.INSTANCE.onWorldLoadedStarted();
|
||||
|
||||
@@ -145,7 +146,7 @@
|
||||
if (profiledduration != null) {
|
||||
profiledduration.finish();
|
||||
}
|
||||
@@ -356,25 +419,183 @@
|
||||
@@ -355,25 +419,183 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -186,7 +187,7 @@
|
||||
- long j = BiomeManager.obfuscateSeed(i);
|
||||
- List<MobSpawner> list = ImmutableList.of(new MobSpawnerPhantom(), new MobSpawnerPatrol(), new MobSpawnerCat(), new VillageSiege(), new MobSpawnerTrader(iworlddataserver));
|
||||
- WorldDimension worlddimension = (WorldDimension) iregistry.get(WorldDimension.OVERWORLD);
|
||||
- WorldServer worldserver = new WorldServer(this, this.executor, this.storageSource, iworlddataserver, World.OVERWORLD, worlddimension, worldloadlistener, flag, j, list, true);
|
||||
- WorldServer worldserver = new WorldServer(this, this.executor, this.storageSource, iworlddataserver, World.OVERWORLD, worlddimension, worldloadlistener, flag, j, list, true, (RandomSequences) null);
|
||||
+ String worldType = (dimension == -999) ? dimensionKey.location().getNamespace() + "_" + dimensionKey.location().getPath() : org.bukkit.World.Environment.getEnvironment(dimension).toString().toLowerCase();
|
||||
+ String name = (dimensionKey == WorldDimension.OVERWORLD) ? s : s + "_" + worldType;
|
||||
+ if (dimension != 0) {
|
||||
@@ -225,8 +226,8 @@
|
||||
+ }
|
||||
+
|
||||
+ try {
|
||||
+ worldSession = Convertable.createDefault(server.getWorldContainer().toPath()).createAccess(name, dimensionKey);
|
||||
+ } catch (IOException ex) {
|
||||
+ worldSession = Convertable.createDefault(server.getWorldContainer().toPath()).validateAndCreateAccess(name, dimensionKey);
|
||||
+ } catch (IOException | ContentValidationException ex) {
|
||||
+ throw new RuntimeException(ex);
|
||||
+ }
|
||||
+ }
|
||||
@@ -296,14 +297,14 @@
|
||||
|
||||
- this.readScoreboard(worldpersistentdata);
|
||||
- this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, worlddimension, worldloadlistener, flag, j, list, true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
|
||||
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, worlddimension, worldloadlistener, flag, j, list, true, (RandomSequences) null, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
|
||||
+ WorldPersistentData worldpersistentdata = world.getDataStorage();
|
||||
+ this.readScoreboard(worldpersistentdata);
|
||||
+ this.server.scoreboardManager = new org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager(this, world.getScoreboard());
|
||||
+ this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
+ } else {
|
||||
+ WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
|
||||
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, worlddimension, worldloadlistener, flag, j, ImmutableList.of(), true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
|
||||
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, worlddimension, worldloadlistener, flag, j, ImmutableList.of(), true, this.overworld().getRandomSequences(), org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
|
||||
+ }
|
||||
+
|
||||
+ worlddata.setModdedInfo(this.getServerModName(), this.getModdedStatus().shouldReportAsModified());
|
||||
@@ -344,7 +345,7 @@
|
||||
|
||||
if (!iworlddataserver.isInitialized()) {
|
||||
try {
|
||||
@@ -398,29 +619,8 @@
|
||||
@@ -397,30 +619,8 @@
|
||||
iworlddataserver.setInitialized(true);
|
||||
}
|
||||
|
||||
@@ -353,6 +354,7 @@
|
||||
- this.getCustomBossEvents().load(this.worldData.getCustomBossEvents());
|
||||
- }
|
||||
-
|
||||
- RandomSequences randomsequences = worldserver.getRandomSequences();
|
||||
- Iterator iterator = iregistry.entrySet().iterator();
|
||||
-
|
||||
- while (iterator.hasNext()) {
|
||||
@@ -362,7 +364,7 @@
|
||||
- if (resourcekey != WorldDimension.OVERWORLD) {
|
||||
- ResourceKey<World> resourcekey1 = ResourceKey.create(Registries.DIMENSION, resourcekey.location());
|
||||
- SecondaryWorldData secondaryworlddata = new SecondaryWorldData(this.worldData, iworlddataserver);
|
||||
- WorldServer worldserver1 = new WorldServer(this, this.executor, this.storageSource, secondaryworlddata, resourcekey1, (WorldDimension) entry.getValue(), worldloadlistener, flag, j, ImmutableList.of(), false);
|
||||
- WorldServer worldserver1 = new WorldServer(this, this.executor, this.storageSource, secondaryworlddata, resourcekey1, (WorldDimension) entry.getValue(), worldloadlistener, flag, j, ImmutableList.of(), false, randomsequences);
|
||||
-
|
||||
- worldborder.addListener(new IWorldBorderListener.a(worldserver1.getWorldBorder()));
|
||||
- this.levels.put(resourcekey1, worldserver1);
|
||||
@@ -411,9 +413,9 @@
|
||||
|
||||
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.dimension().location());
|
||||
BlockPosition blockposition = worldserver.getSharedSpawnPos();
|
||||
@@ -498,19 +716,23 @@
|
||||
@@ -497,19 +715,23 @@
|
||||
ChunkProviderServer chunkproviderserver = worldserver.getChunkSource();
|
||||
|
||||
chunkproviderserver.getLightEngine().setTaskPerBatch(500);
|
||||
this.nextTickTime = SystemUtils.getMillis();
|
||||
- chunkproviderserver.addRegionTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
|
||||
+ // CraftBukkit start
|
||||
@@ -444,7 +446,7 @@
|
||||
ForcedChunk forcedchunk = (ForcedChunk) worldserver1.getDataStorage().get(ForcedChunk::load, "chunks");
|
||||
|
||||
if (forcedchunk != null) {
|
||||
@@ -525,11 +747,18 @@
|
||||
@@ -524,10 +746,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,7 +457,6 @@
|
||||
+ this.executeModerately();
|
||||
+ // CraftBukkit end
|
||||
worldloadlistener.stop();
|
||||
chunkproviderserver.getLightEngine().setTaskPerBatch(5);
|
||||
- this.updateMobSpawningFlags();
|
||||
+ // CraftBukkit start
|
||||
+ // this.updateMobSpawningFlags();
|
||||
@@ -466,7 +467,7 @@
|
||||
}
|
||||
|
||||
public EnumGamemode getDefaultGameType() {
|
||||
@@ -559,12 +788,16 @@
|
||||
@@ -557,12 +786,16 @@
|
||||
worldserver.save((IProgressUpdate) null, flag1, worldserver.noSave && !flag2);
|
||||
}
|
||||
|
||||
@@ -483,7 +484,7 @@
|
||||
if (flag1) {
|
||||
Iterator iterator1 = this.getAllLevels().iterator();
|
||||
|
||||
@@ -599,12 +832,33 @@
|
||||
@@ -597,12 +830,33 @@
|
||||
this.stopServer();
|
||||
}
|
||||
|
||||
@@ -517,7 +518,7 @@
|
||||
if (this.getConnection() != null) {
|
||||
this.getConnection().stop();
|
||||
}
|
||||
@@ -614,6 +868,7 @@
|
||||
@@ -612,6 +866,7 @@
|
||||
MinecraftServer.LOGGER.info("Saving players");
|
||||
this.playerList.saveAll();
|
||||
this.playerList.removeAll();
|
||||
@@ -525,7 +526,7 @@
|
||||
}
|
||||
|
||||
MinecraftServer.LOGGER.info("Saving worlds");
|
||||
@@ -701,15 +956,16 @@
|
||||
@@ -699,15 +954,16 @@
|
||||
}
|
||||
|
||||
this.nextTickTime = SystemUtils.getMillis();
|
||||
@@ -544,7 +545,7 @@
|
||||
MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j);
|
||||
this.nextTickTime += j * 50L;
|
||||
this.lastOverloadWarning = this.nextTickTime;
|
||||
@@ -720,6 +976,7 @@
|
||||
@@ -718,6 +974,7 @@
|
||||
this.debugCommandProfiler = new MinecraftServer.TimeProfiler(SystemUtils.getNanos(), this.tickCount);
|
||||
}
|
||||
|
||||
@@ -552,7 +553,7 @@
|
||||
this.nextTickTime += 50L;
|
||||
this.startMetricsRecordingTick();
|
||||
this.profiler.push("tick");
|
||||
@@ -758,6 +1015,12 @@
|
||||
@@ -756,6 +1013,12 @@
|
||||
this.services.profileCache().clearExecutor();
|
||||
}
|
||||
|
||||
@@ -565,7 +566,7 @@
|
||||
this.onServerExit();
|
||||
}
|
||||
|
||||
@@ -791,9 +1054,16 @@
|
||||
@@ -789,9 +1052,16 @@
|
||||
}
|
||||
|
||||
private boolean haveTime() {
|
||||
@@ -583,7 +584,7 @@
|
||||
protected void waitUntilNextTick() {
|
||||
this.runAllTasks();
|
||||
this.managedBlock(() -> {
|
||||
@@ -838,7 +1108,7 @@
|
||||
@@ -836,7 +1106,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -592,7 +593,7 @@
|
||||
this.getProfiler().incrementCounter("runTask");
|
||||
super.doRunTask(ticktask);
|
||||
}
|
||||
@@ -891,7 +1161,7 @@
|
||||
@@ -889,7 +1159,7 @@
|
||||
this.status = this.buildServerStatus();
|
||||
}
|
||||
|
||||
@@ -601,7 +602,7 @@
|
||||
MinecraftServer.LOGGER.debug("Autosave started");
|
||||
this.profiler.push("save");
|
||||
this.saveEverything(true, false, false);
|
||||
@@ -938,22 +1208,39 @@
|
||||
@@ -936,22 +1206,39 @@
|
||||
}
|
||||
|
||||
public void tickChildren(BooleanSupplier booleansupplier) {
|
||||
@@ -621,7 +622,7 @@
|
||||
+ if (this.tickCount % 20 == 0) {
|
||||
+ for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
|
||||
+ EntityPlayer entityplayer = (EntityPlayer) this.getPlayerList().players.get(i);
|
||||
+ entityplayer.connection.send(new PacketPlayOutUpdateTime(entityplayer.level.getGameTime(), entityplayer.getPlayerTime(), entityplayer.level.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
|
||||
+ entityplayer.connection.send(new PacketPlayOutUpdateTime(entityplayer.level().getGameTime(), entityplayer.getPlayerTime(), entityplayer.level().getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@@ -641,7 +642,7 @@
|
||||
|
||||
this.profiler.push("tick");
|
||||
|
||||
@@ -1033,6 +1320,22 @@
|
||||
@@ -1031,6 +1318,22 @@
|
||||
return (WorldServer) this.levels.get(resourcekey);
|
||||
}
|
||||
|
||||
@@ -664,7 +665,7 @@
|
||||
public Set<ResourceKey<World>> levelKeys() {
|
||||
return this.levels.keySet();
|
||||
}
|
||||
@@ -1059,7 +1362,7 @@
|
||||
@@ -1057,7 +1360,7 @@
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
@@ -695,7 +696,7 @@
|
||||
this.packRepository.setSelected(collection);
|
||||
WorldDataConfiguration worlddataconfiguration = new WorldDataConfiguration(getSelectedPacks(this.packRepository), this.worldData.enabledFeatures());
|
||||
|
||||
@@ -1785,7 +2089,7 @@
|
||||
@@ -1777,7 +2081,7 @@
|
||||
try {
|
||||
label51:
|
||||
{
|
||||
@@ -704,7 +705,7 @@
|
||||
|
||||
try {
|
||||
arraylist = Lists.newArrayList(NativeModuleLister.listModules());
|
||||
@@ -1835,6 +2139,22 @@
|
||||
@@ -1827,6 +2131,22 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -727,7 +728,7 @@
|
||||
private void startMetricsRecordingTick() {
|
||||
if (this.willStartRecordingMetrics) {
|
||||
this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(SystemUtils.timeSource, this.isDedicatedServer()), SystemUtils.timeSource, SystemUtils.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
|
||||
@@ -1961,8 +2281,30 @@
|
||||
@@ -1953,8 +2273,30 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/commands/CommandDifficulty.java
|
||||
+++ b/net/minecraft/server/commands/CommandDifficulty.java
|
||||
@@ -42,11 +42,12 @@
|
||||
@@ -44,11 +44,12 @@
|
||||
|
||||
public static int setDifficulty(CommandListenerWrapper commandlistenerwrapper, EnumDifficulty enumdifficulty) throws CommandSyntaxException {
|
||||
MinecraftServer minecraftserver = commandlistenerwrapper.getServer();
|
||||
@@ -12,6 +12,6 @@
|
||||
} else {
|
||||
- minecraftserver.setDifficulty(enumdifficulty, true);
|
||||
+ worldServer.serverLevelData.setDifficulty(enumdifficulty); // CraftBukkit
|
||||
commandlistenerwrapper.sendSuccess(IChatBaseComponent.translatable("commands.difficulty.success", enumdifficulty.getDisplayName()), true);
|
||||
return 0;
|
||||
}
|
||||
commandlistenerwrapper.sendSuccess(() -> {
|
||||
return IChatBaseComponent.translatable("commands.difficulty.success", enumdifficulty.getDisplayName());
|
||||
}, true);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@
|
||||
@@ -114,7 +114,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
++i;
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@
|
||||
@@ -144,7 +144,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
+ T t0 = commandlistenerwrapper.getLevel().getGameRules().getRule(gamerules_gamerulekey); // CraftBukkit
|
||||
|
||||
t0.setFromArgument(commandcontext, "value");
|
||||
commandlistenerwrapper.sendSuccess(IChatBaseComponent.translatable("commands.gamerule.set", gamerules_gamerulekey.getId(), t0.toString()), true);
|
||||
@@ -39,7 +39,7 @@
|
||||
commandlistenerwrapper.sendSuccess(() -> {
|
||||
@@ -41,7 +41,7 @@
|
||||
}
|
||||
|
||||
static <T extends GameRules.GameRuleValue<T>> int queryRule(CommandListenerWrapper commandlistenerwrapper, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
- T t0 = commandlistenerwrapper.getServer().getGameRules().getRule(gamerules_gamerulekey);
|
||||
+ T t0 = commandlistenerwrapper.getLevel().getGameRules().getRule(gamerules_gamerulekey); // CraftBukkit
|
||||
|
||||
commandlistenerwrapper.sendSuccess(IChatBaseComponent.translatable("commands.gamerule.query", gamerules_gamerulekey.getId(), t0.toString()), false);
|
||||
return t0.getCommandResult();
|
||||
commandlistenerwrapper.sendSuccess(() -> {
|
||||
return IChatBaseComponent.translatable("commands.gamerule.query", gamerules_gamerulekey.getId(), t0.toString());
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/server/commands/CommandGive.java
|
||||
+++ b/net/minecraft/server/commands/CommandGive.java
|
||||
@@ -60,7 +60,7 @@
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
if (flag && itemstack.isEmpty()) {
|
||||
itemstack.setCount(1);
|
||||
- entityitem = entityplayer.drop(itemstack, false);
|
||||
+ entityitem = entityplayer.drop(itemstack, false, false, false); // SPIGOT-2942: Add boolean to call event
|
||||
if (flag && itemstack1.isEmpty()) {
|
||||
itemstack1.setCount(1);
|
||||
- entityitem = entityplayer.drop(itemstack1, false);
|
||||
+ entityitem = entityplayer.drop(itemstack1, false, false, false); // SPIGOT-2942: Add boolean to call event
|
||||
if (entityitem != null) {
|
||||
entityitem.makeFakeItem();
|
||||
}
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
--- a/net/minecraft/server/commands/CommandList.java
|
||||
+++ b/net/minecraft/server/commands/CommandList.java
|
||||
@@ -36,6 +36,12 @@
|
||||
@@ -35,7 +35,14 @@
|
||||
|
||||
private static int format(CommandListenerWrapper commandlistenerwrapper, Function<EntityPlayer, IChatBaseComponent> function) {
|
||||
PlayerList playerlist = commandlistenerwrapper.getServer().getPlayerList();
|
||||
List<EntityPlayer> list = playerlist.getPlayers();
|
||||
- List<EntityPlayer> list = playerlist.getPlayers();
|
||||
+ // CraftBukkit start
|
||||
+ List<EntityPlayer> players = playerlist.getPlayers();
|
||||
+ if (commandlistenerwrapper.getBukkitSender() instanceof org.bukkit.entity.Player) {
|
||||
+ org.bukkit.entity.Player sender = (org.bukkit.entity.Player) commandlistenerwrapper.getBukkitSender();
|
||||
+ list = list.stream().filter((ep) -> sender.canSee(ep.getBukkitEntity())).collect(java.util.stream.Collectors.toList());
|
||||
+ players = players.stream().filter((ep) -> sender.canSee(ep.getBukkitEntity())).collect(java.util.stream.Collectors.toList());
|
||||
+ }
|
||||
+ List<EntityPlayer> list = players;
|
||||
+ // CraftBukkit end
|
||||
IChatBaseComponent ichatbasecomponent = ChatComponentUtils.formatList(list, function);
|
||||
|
||||
commandlistenerwrapper.sendSuccess(IChatBaseComponent.translatable("commands.list.players", list.size(), playerlist.getMaxPlayers(), ichatbasecomponent), false);
|
||||
commandlistenerwrapper.sendSuccess(() -> {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/commands/CommandSpreadPlayers.java
|
||||
+++ b/net/minecraft/server/commands/CommandSpreadPlayers.java
|
||||
@@ -90,7 +90,7 @@
|
||||
@@ -92,7 +92,7 @@
|
||||
if (entity instanceof EntityHuman) {
|
||||
set.add(entity.getTeam());
|
||||
} else {
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@
|
||||
@@ -202,7 +202,7 @@
|
||||
commandspreadplayers_a = acommandspreadplayers_a[j++];
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
d1 = Double.MAX_VALUE;
|
||||
CommandSpreadPlayers.a[] acommandspreadplayers_a1 = acommandspreadplayers_a;
|
||||
int k = acommandspreadplayers_a.length;
|
||||
@@ -299,7 +299,7 @@
|
||||
@@ -301,7 +301,7 @@
|
||||
|
||||
for (boolean flag2 = iblockaccess.getBlockState(blockposition_mutableblockposition).isAir(); blockposition_mutableblockposition.getY() > iblockaccess.getMinBuildHeight(); flag2 = flag1) {
|
||||
blockposition_mutableblockposition.move(EnumDirection.DOWN);
|
||||
@@ -27,16 +27,16 @@
|
||||
if (!flag1 && flag2 && flag) {
|
||||
return blockposition_mutableblockposition.getY() + 1;
|
||||
}
|
||||
@@ -312,7 +312,7 @@
|
||||
@@ -314,7 +314,7 @@
|
||||
|
||||
public boolean isSafe(IBlockAccess iblockaccess, int i) {
|
||||
BlockPosition blockposition = BlockPosition.containing(this.x, (double) (this.getSpawnY(iblockaccess, i) - 1), this.z);
|
||||
- IBlockData iblockdata = iblockaccess.getBlockState(blockposition);
|
||||
+ IBlockData iblockdata = getBlockState(iblockaccess, blockposition); // CraftBukkit
|
||||
Material material = iblockdata.getMaterial();
|
||||
|
||||
return blockposition.getY() < i && !material.isLiquid() && material != Material.FIRE;
|
||||
@@ -322,5 +322,12 @@
|
||||
return blockposition.getY() < i && !iblockdata.liquid() && !iblockdata.is(TagsBlock.FIRE);
|
||||
}
|
||||
@@ -323,5 +323,12 @@
|
||||
this.x = MathHelper.nextDouble(randomsource, d0, d2);
|
||||
this.z = MathHelper.nextDouble(randomsource, d1, d3);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
public class CommandTeleport {
|
||||
|
||||
private static final SimpleCommandExceptionType INVALID_POSITION = new SimpleCommandExceptionType(IChatBaseComponent.translatable("commands.teleport.invalidPosition"));
|
||||
@@ -147,7 +154,30 @@
|
||||
@@ -155,7 +162,30 @@
|
||||
float f2 = MathHelper.wrapDegrees(f);
|
||||
float f3 = MathHelper.wrapDegrees(f1);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class CommandTime {
|
||||
|
||||
public CommandTime() {}
|
||||
@@ -47,12 +52,18 @@
|
||||
@@ -49,12 +54,18 @@
|
||||
}
|
||||
|
||||
public static int setTime(CommandListenerWrapper commandlistenerwrapper, int i) {
|
||||
@@ -32,8 +32,8 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
commandlistenerwrapper.sendSuccess(IChatBaseComponent.translatable("commands.time.set", i), true);
|
||||
@@ -60,12 +71,18 @@
|
||||
commandlistenerwrapper.sendSuccess(() -> {
|
||||
@@ -64,12 +75,18 @@
|
||||
}
|
||||
|
||||
public static int addTime(CommandListenerWrapper commandlistenerwrapper, int i) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/commands/CommandTrigger.java
|
||||
+++ b/net/minecraft/server/commands/CommandTrigger.java
|
||||
@@ -90,7 +90,7 @@
|
||||
@@ -96,7 +96,7 @@
|
||||
if (scoreboardobjective.getCriteria() != IScoreboardCriteria.TRIGGER) {
|
||||
throw CommandTrigger.ERROR_INVALID_OBJECTIVE.create();
|
||||
} else {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
if (worldborder.getDamageSafeZone() == (double) f) {
|
||||
throw CommandWorldBorder.ERROR_SAME_DAMAGE_BUFFER.create();
|
||||
@@ -69,7 +69,7 @@
|
||||
@@ -71,7 +71,7 @@
|
||||
}
|
||||
|
||||
private static int setDamageAmount(CommandListenerWrapper commandlistenerwrapper, float f) throws CommandSyntaxException {
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
if (worldborder.getDamagePerBlock() == (double) f) {
|
||||
throw CommandWorldBorder.ERROR_SAME_DAMAGE_AMOUNT.create();
|
||||
@@ -81,7 +81,7 @@
|
||||
@@ -85,7 +85,7 @@
|
||||
}
|
||||
|
||||
private static int setWarningTime(CommandListenerWrapper commandlistenerwrapper, int i) throws CommandSyntaxException {
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
if (worldborder.getWarningTime() == i) {
|
||||
throw CommandWorldBorder.ERROR_SAME_WARNING_TIME.create();
|
||||
@@ -93,7 +93,7 @@
|
||||
@@ -99,7 +99,7 @@
|
||||
}
|
||||
|
||||
private static int setWarningDistance(CommandListenerWrapper commandlistenerwrapper, int i) throws CommandSyntaxException {
|
||||
@@ -36,15 +36,16 @@
|
||||
|
||||
if (worldborder.getWarningBlocks() == i) {
|
||||
throw CommandWorldBorder.ERROR_SAME_WARNING_DISTANCE.create();
|
||||
@@ -105,14 +105,14 @@
|
||||
@@ -113,7 +113,7 @@
|
||||
}
|
||||
|
||||
private static int getSize(CommandListenerWrapper commandlistenerwrapper) {
|
||||
- double d0 = commandlistenerwrapper.getServer().overworld().getWorldBorder().getSize();
|
||||
+ double d0 = commandlistenerwrapper.getLevel().getWorldBorder().getSize(); // CraftBukkit
|
||||
|
||||
commandlistenerwrapper.sendSuccess(IChatBaseComponent.translatable("commands.worldborder.get", String.format(Locale.ROOT, "%.0f", d0)), false);
|
||||
return MathHelper.floor(d0 + 0.5D);
|
||||
commandlistenerwrapper.sendSuccess(() -> {
|
||||
return IChatBaseComponent.translatable("commands.worldborder.get", String.format(Locale.ROOT, "%.0f", d0));
|
||||
@@ -122,7 +122,7 @@
|
||||
}
|
||||
|
||||
private static int setCenter(CommandListenerWrapper commandlistenerwrapper, Vec2F vec2f) throws CommandSyntaxException {
|
||||
@@ -53,7 +54,7 @@
|
||||
|
||||
if (worldborder.getCenterX() == (double) vec2f.x && worldborder.getCenterZ() == (double) vec2f.y) {
|
||||
throw CommandWorldBorder.ERROR_SAME_CENTER.create();
|
||||
@@ -126,7 +126,7 @@
|
||||
@@ -138,7 +138,7 @@
|
||||
}
|
||||
|
||||
private static int setSize(CommandListenerWrapper commandlistenerwrapper, double d0, long i) throws CommandSyntaxException {
|
||||
|
||||
@@ -177,7 +177,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -537,14 +617,45 @@
|
||||
@@ -539,14 +619,45 @@
|
||||
|
||||
@Override
|
||||
public String getPluginNames() {
|
||||
@@ -225,7 +225,7 @@
|
||||
});
|
||||
return this.rconConsoleSource.getCommandResponse();
|
||||
}
|
||||
@@ -597,4 +708,15 @@
|
||||
@@ -599,4 +710,15 @@
|
||||
public Optional<MinecraftServer.ServerResourcePackInfo> getServerResourcePack() {
|
||||
return this.settings.getProperties().serverResourcePackInfo;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/dedicated/PropertyManager.java
|
||||
+++ b/net/minecraft/server/dedicated/PropertyManager.java
|
||||
@@ -17,13 +17,28 @@
|
||||
@@ -23,13 +23,28 @@
|
||||
import net.minecraft.core.IRegistryCustom;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
|
||||
public static Properties loadFromFile(Path path) {
|
||||
@@ -58,6 +73,11 @@
|
||||
@@ -97,6 +112,11 @@
|
||||
|
||||
public void store(Path path) {
|
||||
try {
|
||||
@@ -39,10 +39,10 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
OutputStream outputstream = Files.newOutputStream(path);
|
||||
BufferedWriter bufferedwriter = Files.newBufferedWriter(path, StandardCharsets.UTF_8);
|
||||
|
||||
try {
|
||||
@@ -86,7 +106,7 @@
|
||||
@@ -125,7 +145,7 @@
|
||||
private static <V extends Number> Function<String, V> wrapNumberDeserializer(Function<String, V> function) {
|
||||
return (s) -> {
|
||||
try {
|
||||
@@ -51,7 +51,7 @@
|
||||
} catch (NumberFormatException numberformatexception) {
|
||||
return null;
|
||||
}
|
||||
@@ -105,7 +125,7 @@
|
||||
@@ -144,7 +164,7 @@
|
||||
|
||||
@Nullable
|
||||
private String getStringRaw(String s) {
|
||||
@@ -60,7 +60,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -121,6 +141,16 @@
|
||||
@@ -160,6 +180,16 @@
|
||||
}
|
||||
|
||||
protected <V> V get(String s, Function<String, V> function, Function<V, String> function1, V v0) {
|
||||
@@ -77,7 +77,7 @@
|
||||
String s1 = this.getStringRaw(s);
|
||||
V v1 = MoreObjects.firstNonNull(s1 != null ? function.apply(s1) : null, v0);
|
||||
|
||||
@@ -133,7 +163,7 @@
|
||||
@@ -172,7 +202,7 @@
|
||||
V v1 = MoreObjects.firstNonNull(s1 != null ? function.apply(s1) : null, v0);
|
||||
|
||||
this.properties.put(s, function1.apply(v1));
|
||||
@@ -86,7 +86,7 @@
|
||||
}
|
||||
|
||||
protected <V> V get(String s, Function<String, V> function, UnaryOperator<V> unaryoperator, Function<V, String> function1, V v0) {
|
||||
@@ -197,7 +227,7 @@
|
||||
@@ -236,7 +266,7 @@
|
||||
return properties;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
|
||||
public class EditableProperty<V> implements Supplier<V> {
|
||||
|
||||
@@ -205,7 +235,7 @@
|
||||
@@ -244,7 +274,7 @@
|
||||
private final V value;
|
||||
private final Function<V, String> serializer;
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
this.key = s;
|
||||
this.value = object;
|
||||
this.serializer = function;
|
||||
@@ -219,7 +249,7 @@
|
||||
@@ -258,7 +288,7 @@
|
||||
Properties properties = PropertyManager.this.cloneProperties();
|
||||
|
||||
properties.put(this.key, this.serializer.apply(v0));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/ChunkMapDistance.java
|
||||
+++ b/net/minecraft/server/level/ChunkMapDistance.java
|
||||
@@ -126,10 +126,25 @@
|
||||
@@ -122,10 +122,25 @@
|
||||
}
|
||||
|
||||
if (!this.chunksToUpdateFutures.isEmpty()) {
|
||||
@@ -29,7 +29,7 @@
|
||||
return true;
|
||||
} else {
|
||||
if (!this.ticketsToRelease.isEmpty()) {
|
||||
@@ -165,7 +180,7 @@
|
||||
@@ -161,7 +176,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
ArraySetSorted<Ticket<?>> arraysetsorted = this.getTickets(i);
|
||||
int j = getTicketLevelAt(arraysetsorted);
|
||||
Ticket<?> ticket1 = (Ticket) arraysetsorted.addOrGet(ticket);
|
||||
@@ -175,13 +190,15 @@
|
||||
@@ -171,13 +186,15 @@
|
||||
this.ticketTracker.update(i, ticket.getTicketLevel(), true);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
}
|
||||
|
||||
if (arraysetsorted.isEmpty()) {
|
||||
@@ -189,6 +206,7 @@
|
||||
@@ -185,6 +202,7 @@
|
||||
}
|
||||
|
||||
this.ticketTracker.update(i, getTicketLevelAt(arraysetsorted), false);
|
||||
@@ -64,7 +64,7 @@
|
||||
}
|
||||
|
||||
public <T> void addTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||
@@ -202,19 +220,33 @@
|
||||
@@ -198,19 +216,33 @@
|
||||
}
|
||||
|
||||
public <T> void addRegionTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||
@@ -74,7 +74,7 @@
|
||||
+
|
||||
+ public <T> boolean addRegionTicketAtDistance(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||
+ // CraftBukkit end
|
||||
Ticket<T> ticket = new Ticket<>(tickettype, 33 - i, t0);
|
||||
Ticket<T> ticket = new Ticket<>(tickettype, ChunkLevel.byStatus(FullChunkStatus.FULL) - i, t0);
|
||||
long j = chunkcoordintpair.toLong();
|
||||
|
||||
- this.addTicket(j, ticket);
|
||||
@@ -90,7 +90,7 @@
|
||||
+
|
||||
+ public <T> boolean removeRegionTicketAtDistance(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||
+ // CraftBukkit end
|
||||
Ticket<T> ticket = new Ticket<>(tickettype, 33 - i, t0);
|
||||
Ticket<T> ticket = new Ticket<>(tickettype, ChunkLevel.byStatus(FullChunkStatus.FULL) - i, t0);
|
||||
long j = chunkcoordintpair.toLong();
|
||||
|
||||
- this.removeTicket(j, ticket);
|
||||
@@ -100,7 +100,7 @@
|
||||
}
|
||||
|
||||
private ArraySetSorted<Ticket<?>> getTickets(long i) {
|
||||
@@ -253,6 +285,7 @@
|
||||
@@ -249,6 +281,7 @@
|
||||
ChunkCoordIntPair chunkcoordintpair = sectionposition.chunk();
|
||||
long i = chunkcoordintpair.toLong();
|
||||
ObjectSet<EntityPlayer> objectset = (ObjectSet) this.playersPerChunk.get(i);
|
||||
@@ -108,7 +108,7 @@
|
||||
|
||||
objectset.remove(entityplayer);
|
||||
if (objectset.isEmpty()) {
|
||||
@@ -382,6 +415,26 @@
|
||||
@@ -378,6 +411,26 @@
|
||||
return !this.tickets.isEmpty();
|
||||
}
|
||||
|
||||
@@ -134,4 +134,4 @@
|
||||
+
|
||||
private class a extends ChunkMap {
|
||||
|
||||
public a() {
|
||||
private static final int MAX_LEVEL = ChunkLevel.MAX_LEVEL + 1;
|
||||
|
||||
@@ -42,16 +42,16 @@
|
||||
if (ichunkaccess1 != null) {
|
||||
this.storeInCache(k, ichunkaccess1, ChunkStatus.FULL);
|
||||
@@ -230,7 +240,15 @@
|
||||
int l = 33 + ChunkStatus.getDistance(chunkstatus);
|
||||
int l = ChunkLevel.byStatus(chunkstatus);
|
||||
PlayerChunk playerchunk = this.getVisibleChunkIfPresent(k);
|
||||
|
||||
- if (flag) {
|
||||
+ // CraftBukkit start - don't add new ticket for currently unloading chunk
|
||||
+ boolean currentlyUnloading = false;
|
||||
+ if (playerchunk != null) {
|
||||
+ PlayerChunk.State oldChunkState = PlayerChunk.getFullChunkStatus(playerchunk.oldTicketLevel);
|
||||
+ PlayerChunk.State currentChunkState = PlayerChunk.getFullChunkStatus(playerchunk.getTicketLevel());
|
||||
+ currentlyUnloading = (oldChunkState.isOrAfter(PlayerChunk.State.BORDER) && !currentChunkState.isOrAfter(PlayerChunk.State.BORDER));
|
||||
+ FullChunkStatus oldChunkState = ChunkLevel.fullStatus(playerchunk.oldTicketLevel);
|
||||
+ FullChunkStatus currentChunkState = ChunkLevel.fullStatus(playerchunk.getTicketLevel());
|
||||
+ currentlyUnloading = (oldChunkState.isOrAfter(FullChunkStatus.FULL) && !currentChunkState.isOrAfter(FullChunkStatus.FULL));
|
||||
+ }
|
||||
+ if (flag && !currentlyUnloading) {
|
||||
+ // CraftBukkit end
|
||||
@@ -67,7 +67,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -316,7 +334,7 @@
|
||||
@@ -317,7 +335,7 @@
|
||||
} else if (!this.level.shouldTickBlocksAt(i)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||
return either != null && either.left().isPresent();
|
||||
}
|
||||
@@ -329,11 +347,31 @@
|
||||
@@ -330,11 +348,31 @@
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
@@ -109,7 +109,7 @@
|
||||
@Override
|
||||
public void tick(BooleanSupplier booleansupplier, boolean flag) {
|
||||
this.level.getProfiler().push("purge");
|
||||
@@ -365,7 +403,7 @@
|
||||
@@ -366,7 +404,7 @@
|
||||
|
||||
gameprofilerfiller.push("pollingChunks");
|
||||
int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
|
||||
@@ -118,7 +118,7 @@
|
||||
|
||||
gameprofilerfiller.push("naturalSpawnCount");
|
||||
int l = this.distanceManager.getNaturalSpawnChunkCount();
|
||||
@@ -386,7 +424,7 @@
|
||||
@@ -387,7 +425,7 @@
|
||||
}
|
||||
|
||||
gameprofilerfiller.popPush("spawnAndTick");
|
||||
@@ -127,7 +127,7 @@
|
||||
|
||||
Collections.shuffle(list);
|
||||
Iterator iterator1 = list.iterator();
|
||||
@@ -591,13 +629,19 @@
|
||||
@@ -592,13 +630,19 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile) {
|
||||
super(worldserver, worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle(), gameprofile);
|
||||
this.chatVisibility = EnumChatVisibility.FULL;
|
||||
@@ -275,12 +322,56 @@
|
||||
@@ -274,12 +321,56 @@
|
||||
this.advancements = minecraftserver.getPlayerList().getPlayerAdvancements(this);
|
||||
this.setMaxUpStep(1.0F);
|
||||
this.fudgeSpawnLocation(worldserver);
|
||||
@@ -119,7 +119,7 @@
|
||||
int i = Math.max(0, this.server.getSpawnRadius(worldserver));
|
||||
int j = MathHelper.floor(worldserver.getWorldBorder().getDistanceToBorder((double) blockposition.getX(), (double) blockposition.getZ()));
|
||||
|
||||
@@ -329,7 +420,7 @@
|
||||
@@ -328,7 +419,7 @@
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
if (nbttagcompound.contains("warden_spawn_tracker", 10)) {
|
||||
@@ -128,7 +128,7 @@
|
||||
Logger logger = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -348,17 +439,26 @@
|
||||
@@ -347,17 +438,26 @@
|
||||
if (nbttagcompound.contains("recipeBook", 10)) {
|
||||
this.recipeBook.fromNbt(nbttagcompound.getCompound("recipeBook"), this.server.getRecipeManager());
|
||||
}
|
||||
@@ -156,7 +156,7 @@
|
||||
Logger logger1 = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger1);
|
||||
@@ -371,7 +471,7 @@
|
||||
@@ -370,7 +470,7 @@
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
@@ -165,7 +165,7 @@
|
||||
Logger logger = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -392,7 +492,20 @@
|
||||
@@ -391,7 +491,20 @@
|
||||
Entity entity = this.getRootVehicle();
|
||||
Entity entity1 = this.getVehicle();
|
||||
|
||||
@@ -187,7 +187,7 @@
|
||||
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
|
||||
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
|
||||
|
||||
@@ -417,8 +530,32 @@
|
||||
@@ -416,8 +529,32 @@
|
||||
nbttagcompound.put("SpawnDimension", nbtbase);
|
||||
});
|
||||
}
|
||||
@@ -197,7 +197,7 @@
|
||||
|
||||
+ // CraftBukkit start - World fallback code, either respawn location or global spawn
|
||||
+ public void spawnIn(World world) {
|
||||
+ this.level = world;
|
||||
+ this.setLevel(world);
|
||||
+ if (world == null) {
|
||||
+ this.unsetRemoved();
|
||||
+ Vec3D position = null;
|
||||
@@ -211,7 +211,7 @@
|
||||
+ world = ((CraftWorld) Bukkit.getServer().getWorlds().get(0)).getHandle();
|
||||
+ position = Vec3D.atCenterOf(world.getSharedSpawnPos());
|
||||
+ }
|
||||
+ this.level = world;
|
||||
+ this.setLevel(world);
|
||||
+ this.setPos(position);
|
||||
+ }
|
||||
+ this.gameMode.setLevel((WorldServer) world);
|
||||
@@ -220,7 +220,7 @@
|
||||
|
||||
public void setExperiencePoints(int i) {
|
||||
float f = (float) this.getXpNeededForNextLevel();
|
||||
@@ -478,6 +615,11 @@
|
||||
@@ -477,6 +614,11 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -232,7 +232,7 @@
|
||||
this.gameMode.tick();
|
||||
this.wardenSpawnTracker.tick();
|
||||
--this.spawnInvulnerableTime;
|
||||
@@ -534,7 +676,7 @@
|
||||
@@ -533,7 +675,7 @@
|
||||
}
|
||||
|
||||
if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) {
|
||||
@@ -241,7 +241,7 @@
|
||||
this.lastSentHealth = this.getHealth();
|
||||
this.lastSentFood = this.foodData.getFoodLevel();
|
||||
this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
|
||||
@@ -565,6 +707,12 @@
|
||||
@@ -564,6 +706,12 @@
|
||||
this.updateScoreForCriteria(IScoreboardCriteria.EXPERIENCE, MathHelper.ceil((float) this.lastRecordedExperience));
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@
|
||||
if (this.experienceLevel != this.lastRecordedLevel) {
|
||||
this.lastRecordedLevel = this.experienceLevel;
|
||||
this.updateScoreForCriteria(IScoreboardCriteria.LEVEL, MathHelper.ceil((float) this.lastRecordedLevel));
|
||||
@@ -579,6 +727,20 @@
|
||||
@@ -578,6 +726,20 @@
|
||||
CriterionTriggers.LOCATION.trigger(this);
|
||||
}
|
||||
|
||||
@@ -275,26 +275,26 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking player");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Player being ticked");
|
||||
@@ -621,7 +783,8 @@
|
||||
@@ -620,7 +782,8 @@
|
||||
}
|
||||
|
||||
private void updateScoreForCriteria(IScoreboardCriteria iscoreboardcriteria, int i) {
|
||||
- this.getScoreboard().forAllObjectives(iscoreboardcriteria, this.getScoreboardName(), (scoreboardscore) -> {
|
||||
+ // CraftBukkit - Use our scores instead
|
||||
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(iscoreboardcriteria, this.getScoreboardName(), (scoreboardscore) -> {
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(iscoreboardcriteria, this.getScoreboardName(), (scoreboardscore) -> {
|
||||
scoreboardscore.setScore(i);
|
||||
});
|
||||
}
|
||||
@@ -630,9 +793,47 @@
|
||||
@@ -629,9 +792,47 @@
|
||||
public void die(DamageSource damagesource) {
|
||||
this.gameEvent(GameEvent.ENTITY_DIE);
|
||||
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
||||
boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
||||
+ // CraftBukkit start - fire PlayerDeathEvent
|
||||
+ if (this.isRemoved()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(this.getInventory().getContainerSize());
|
||||
+ boolean keepInventory = this.level.getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || this.isSpectator();
|
||||
+ boolean keepInventory = this.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || this.isSpectator();
|
||||
+
|
||||
+ if (!keepInventory) {
|
||||
+ for (ItemStack item : this.getInventory().getContents()) {
|
||||
@@ -333,10 +333,10 @@
|
||||
+ ichatbasecomponent = org.bukkit.craftbukkit.util.CraftChatMessage.fromStringOrNull(deathMessage);
|
||||
+ }
|
||||
|
||||
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
|
||||
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getId(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
|
||||
boolean flag1 = true;
|
||||
@@ -663,12 +864,18 @@
|
||||
if (this.level.getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
|
||||
@@ -662,12 +863,18 @@
|
||||
if (this.level().getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
|
||||
this.tellNeutralMobsThatIDied();
|
||||
}
|
||||
-
|
||||
@@ -354,42 +354,42 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ // CraftBukkit - Get our scores instead
|
||||
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.DEATH_COUNT, this.getScoreboardName(), ScoreboardScore::increment);
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.DEATH_COUNT, this.getScoreboardName(), ScoreboardScore::increment);
|
||||
EntityLiving entityliving = this.getKillCredit();
|
||||
|
||||
if (entityliving != null) {
|
||||
@@ -706,10 +913,12 @@
|
||||
@@ -705,10 +912,12 @@
|
||||
String s = this.getScoreboardName();
|
||||
String s1 = entity.getScoreboardName();
|
||||
|
||||
- this.getScoreboard().forAllObjectives(IScoreboardCriteria.KILL_COUNT_ALL, s, ScoreboardScore::increment);
|
||||
+ // CraftBukkit - Get our scores instead
|
||||
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.KILL_COUNT_ALL, s, ScoreboardScore::increment);
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.KILL_COUNT_ALL, s, ScoreboardScore::increment);
|
||||
if (entity instanceof EntityHuman) {
|
||||
this.awardStat(StatisticList.PLAYER_KILLS);
|
||||
- this.getScoreboard().forAllObjectives(IScoreboardCriteria.KILL_COUNT_PLAYERS, s, ScoreboardScore::increment);
|
||||
+ // CraftBukkit - Get our scores instead
|
||||
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.KILL_COUNT_PLAYERS, s, ScoreboardScore::increment);
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.KILL_COUNT_PLAYERS, s, ScoreboardScore::increment);
|
||||
} else {
|
||||
this.awardStat(StatisticList.MOB_KILLS);
|
||||
}
|
||||
@@ -727,7 +936,8 @@
|
||||
@@ -726,7 +935,8 @@
|
||||
int i = scoreboardteam.getColor().getId();
|
||||
|
||||
if (i >= 0 && i < aiscoreboardcriteria.length) {
|
||||
- this.getScoreboard().forAllObjectives(aiscoreboardcriteria[i], s, ScoreboardScore::increment);
|
||||
+ // CraftBukkit - Get our scores instead
|
||||
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(aiscoreboardcriteria[i], s, ScoreboardScore::increment);
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(aiscoreboardcriteria[i], s, ScoreboardScore::increment);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -777,18 +987,20 @@
|
||||
@@ -776,18 +986,20 @@
|
||||
}
|
||||
|
||||
private boolean isPvpAllowed() {
|
||||
- return this.server.isPvpAllowed();
|
||||
+ // CraftBukkit - this.server.isPvpAllowed() -> this.world.pvpMode
|
||||
+ return this.level.pvpMode;
|
||||
+ return this.level().pvpMode;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -398,8 +398,8 @@
|
||||
ShapeDetectorShape shapedetectorshape = super.findDimensionEntryPoint(worldserver);
|
||||
+ worldserver = (shapedetectorshape == null) ? worldserver : shapedetectorshape.world; // CraftBukkit
|
||||
|
||||
- if (shapedetectorshape != null && this.level.dimension() == World.OVERWORLD && worldserver.dimension() == World.END) {
|
||||
+ if (shapedetectorshape != null && this.level.getTypeKey() == WorldDimension.OVERWORLD && worldserver != null && worldserver.getTypeKey() == WorldDimension.END) { // CraftBukkit
|
||||
- if (shapedetectorshape != null && this.level().dimension() == World.OVERWORLD && worldserver.dimension() == World.END) {
|
||||
+ if (shapedetectorshape != null && this.level().getTypeKey() == WorldDimension.OVERWORLD && worldserver != null && worldserver.getTypeKey() == WorldDimension.END) { // CraftBukkit
|
||||
Vec3D vec3d = shapedetectorshape.pos.add(0.0D, -1.0D, 0.0D);
|
||||
|
||||
- return new ShapeDetectorShape(vec3d, Vec3D.ZERO, 90.0F, 0.0F);
|
||||
@@ -407,7 +407,7 @@
|
||||
} else {
|
||||
return shapedetectorshape;
|
||||
}
|
||||
@@ -797,11 +1009,20 @@
|
||||
@@ -796,11 +1008,20 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
@@ -421,7 +421,7 @@
|
||||
+ // CraftBukkit end
|
||||
+ if (this.isSleeping()) return this; // CraftBukkit - SPIGOT-3154
|
||||
+ // this.isChangingDimension = true; // CraftBukkit - Moved down and into PlayerList#changeDimension
|
||||
WorldServer worldserver1 = this.getLevel();
|
||||
WorldServer worldserver1 = this.serverLevel();
|
||||
- ResourceKey<World> resourcekey = worldserver1.dimension();
|
||||
+ ResourceKey<WorldDimension> resourcekey = worldserver1.getTypeKey(); // CraftBukkit
|
||||
|
||||
@@ -429,9 +429,9 @@
|
||||
+ if (resourcekey == WorldDimension.END && worldserver != null && worldserver.getTypeKey() == WorldDimension.OVERWORLD) { // CraftBukkit
|
||||
+ this.isChangingDimension = true; // CraftBukkit - Moved down from above
|
||||
this.unRide();
|
||||
this.getLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
this.serverLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
if (!this.wonGame) {
|
||||
@@ -812,6 +1033,8 @@
|
||||
@@ -811,6 +1032,8 @@
|
||||
|
||||
return this;
|
||||
} else {
|
||||
@@ -439,8 +439,8 @@
|
||||
+ /*
|
||||
WorldData worlddata = worldserver.getLevelData();
|
||||
|
||||
this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), (byte) 3, this.getLastDeathLocation()));
|
||||
@@ -821,20 +1044,50 @@
|
||||
this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), (byte) 3, this.getLastDeathLocation(), this.getPortalCooldown()));
|
||||
@@ -820,20 +1043,50 @@
|
||||
playerlist.sendPlayerPermissionLevel(this);
|
||||
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
this.unsetRemoved();
|
||||
@@ -479,8 +479,8 @@
|
||||
+ if (true) { // CraftBukkit
|
||||
+ this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
|
||||
+
|
||||
+ this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), (byte) 3, this.getLastDeathLocation()));
|
||||
+ this.connection.send(new PacketPlayOutServerDifficulty(this.level.getDifficulty(), this.level.getLevelData().isDifficultyLocked()));
|
||||
+ this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), (byte) 3, this.getLastDeathLocation(), this.getPortalCooldown()));
|
||||
+ this.connection.send(new PacketPlayOutServerDifficulty(this.level().getDifficulty(), this.level().getLevelData().isDifficultyLocked()));
|
||||
+ PlayerList playerlist = this.server.getPlayerList();
|
||||
+
|
||||
+ playerlist.sendPlayerPermissionLevel(this);
|
||||
@@ -490,20 +490,20 @@
|
||||
- worldserver1.getProfiler().pop();
|
||||
- worldserver1.getProfiler().push("placing");
|
||||
+ // CraftBukkit end
|
||||
this.setLevel(worldserver);
|
||||
this.setServerLevel(worldserver);
|
||||
- this.connection.teleport(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, shapedetectorshape.xRot);
|
||||
+ this.connection.teleport(exit); // CraftBukkit - use internal teleport without event
|
||||
this.connection.resetPosition();
|
||||
worldserver.addDuringPortalTeleport(this);
|
||||
worldserver1.getProfiler().pop();
|
||||
@@ -854,39 +1107,66 @@
|
||||
@@ -853,39 +1106,66 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld());
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(changeEvent);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(changeEvent);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -559,7 +559,7 @@
|
||||
+ if (optional.isPresent() || !canCreatePortal) { // CraftBukkit
|
||||
return optional;
|
||||
} else {
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis = (EnumDirection.EnumAxis) this.level.getBlockState(this.portalEntrancePos).getOptionalValue(BlockPortal.AXIS).orElse(EnumDirection.EnumAxis.X);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis = (EnumDirection.EnumAxis) this.level().getBlockState(this.portalEntrancePos).getOptionalValue(BlockPortal.AXIS).orElse(EnumDirection.EnumAxis.X);
|
||||
- Optional<BlockUtil.Rectangle> optional1 = worldserver.getPortalForcer().createPortal(blockposition, enumdirection_enumaxis);
|
||||
+ Optional<BlockUtil.Rectangle> optional1 = worldserver.getPortalForcer().createPortal(blockposition, enumdirection_enumaxis, this, createRadius); // CraftBukkit
|
||||
|
||||
@@ -569,13 +569,13 @@
|
||||
}
|
||||
|
||||
return optional1;
|
||||
@@ -896,13 +1176,21 @@
|
||||
@@ -895,13 +1175,21 @@
|
||||
public void triggerDimensionChangeTriggers(WorldServer worldserver) {
|
||||
ResourceKey<World> resourcekey = worldserver.dimension();
|
||||
ResourceKey<World> resourcekey1 = this.level.dimension();
|
||||
ResourceKey<World> resourcekey1 = this.level().dimension();
|
||||
+ // CraftBukkit start
|
||||
+ ResourceKey<World> maindimensionkey = CraftDimensionUtil.getMainDimensionKey(worldserver);
|
||||
+ ResourceKey<World> maindimensionkey1 = CraftDimensionUtil.getMainDimensionKey(this.level);
|
||||
+ ResourceKey<World> maindimensionkey1 = CraftDimensionUtil.getMainDimensionKey(this.level());
|
||||
+
|
||||
+ CriterionTriggers.CHANGED_DIMENSION.trigger(this, maindimensionkey, maindimensionkey1);
|
||||
+ if (maindimensionkey != resourcekey || maindimensionkey1 != resourcekey1) {
|
||||
@@ -594,31 +594,31 @@
|
||||
this.enteredNetherPosition = null;
|
||||
}
|
||||
|
||||
@@ -919,19 +1207,17 @@
|
||||
@@ -918,19 +1206,17 @@
|
||||
this.containerMenu.broadcastChanges();
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) {
|
||||
- EnumDirection enumdirection = (EnumDirection) this.level.getBlockState(blockposition).getValue(BlockFacingHorizontal.FACING);
|
||||
- EnumDirection enumdirection = (EnumDirection) this.level().getBlockState(blockposition).getValue(BlockFacingHorizontal.FACING);
|
||||
-
|
||||
+ // CraftBukkit start - moved bed result checks from below into separate method
|
||||
+ private Either<EntityHuman.EnumBedResult, Unit> getBedResult(BlockPosition blockposition, EnumDirection enumdirection) {
|
||||
if (!this.isSleeping() && this.isAlive()) {
|
||||
- if (!this.level.dimensionType().natural()) {
|
||||
+ if (!this.level.dimensionType().natural() || !this.level.dimensionType().bedWorks()) {
|
||||
- if (!this.level().dimensionType().natural()) {
|
||||
+ if (!this.level().dimensionType().natural() || !this.level().dimensionType().bedWorks()) {
|
||||
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
|
||||
} else if (!this.bedInRange(blockposition, enumdirection)) {
|
||||
return Either.left(EntityHuman.EnumBedResult.TOO_FAR_AWAY);
|
||||
} else if (this.bedBlocked(blockposition, enumdirection)) {
|
||||
return Either.left(EntityHuman.EnumBedResult.OBSTRUCTED);
|
||||
} else {
|
||||
- this.setRespawnPosition(this.level.dimension(), blockposition, this.getYRot(), false, true);
|
||||
+ this.setRespawnPosition(this.level.dimension(), blockposition, this.getYRot(), false, true, PlayerSpawnChangeEvent.Cause.BED); // CraftBukkit
|
||||
if (this.level.isDay()) {
|
||||
- this.setRespawnPosition(this.level().dimension(), blockposition, this.getYRot(), false, true);
|
||||
+ this.setRespawnPosition(this.level().dimension(), blockposition, this.getYRot(), false, true, PlayerSpawnChangeEvent.Cause.BED); // CraftBukkit
|
||||
if (this.level().isDay()) {
|
||||
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_NOW);
|
||||
} else {
|
||||
@@ -948,7 +1234,36 @@
|
||||
@@ -947,7 +1233,36 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -633,7 +633,7 @@
|
||||
+
|
||||
+ @Override
|
||||
+ public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition, boolean force) {
|
||||
+ EnumDirection enumdirection = (EnumDirection) this.level.getBlockState(blockposition).getValue(BlockFacingHorizontal.FACING);
|
||||
+ EnumDirection enumdirection = (EnumDirection) this.level().getBlockState(blockposition).getValue(BlockFacingHorizontal.FACING);
|
||||
+ Either<EntityHuman.EnumBedResult, Unit> bedResult = this.getBedResult(blockposition, enumdirection);
|
||||
+
|
||||
+ if (bedResult.left().orElse(null) == EntityHuman.EnumBedResult.OTHER_PROBLEM) {
|
||||
@@ -656,7 +656,7 @@
|
||||
this.awardStat(StatisticList.SLEEP_IN_BED);
|
||||
CriterionTriggers.SLEPT_IN_BED.trigger(this);
|
||||
});
|
||||
@@ -961,9 +1276,8 @@
|
||||
@@ -960,9 +1275,8 @@
|
||||
return either;
|
||||
}
|
||||
}
|
||||
@@ -667,7 +667,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -990,6 +1304,24 @@
|
||||
@@ -989,6 +1303,24 @@
|
||||
|
||||
@Override
|
||||
public void stopSleepInBed(boolean flag, boolean flag1) {
|
||||
@@ -678,22 +678,22 @@
|
||||
+
|
||||
+ org.bukkit.block.Block bed;
|
||||
+ if (bedPosition != null) {
|
||||
+ bed = this.level.getWorld().getBlockAt(bedPosition.getX(), bedPosition.getY(), bedPosition.getZ());
|
||||
+ bed = this.level().getWorld().getBlockAt(bedPosition.getX(), bedPosition.getY(), bedPosition.getZ());
|
||||
+ } else {
|
||||
+ bed = this.level.getWorld().getBlockAt(player.getLocation());
|
||||
+ bed = this.level().getWorld().getBlockAt(player.getLocation());
|
||||
+ }
|
||||
+
|
||||
+ PlayerBedLeaveEvent event = new PlayerBedLeaveEvent(player, bed, true);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.isSleeping()) {
|
||||
this.getLevel().getChunkSource().broadcastAndSend(this, new PacketPlayOutAnimation(this, 2));
|
||||
this.serverLevel().getChunkSource().broadcastAndSend(this, new PacketPlayOutAnimation(this, 2));
|
||||
}
|
||||
@@ -1038,8 +1370,9 @@
|
||||
this.connection.send(new PacketPlayOutOpenSignEditor(tileentitysign.getBlockPos()));
|
||||
@@ -1037,8 +1369,9 @@
|
||||
this.connection.send(new PacketPlayOutOpenSignEditor(tileentitysign.getBlockPos(), flag));
|
||||
}
|
||||
|
||||
- public void nextContainerCounter() {
|
||||
@@ -703,7 +703,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1047,13 +1380,35 @@
|
||||
@@ -1046,13 +1379,35 @@
|
||||
if (itileinventory == null) {
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
@@ -739,7 +739,7 @@
|
||||
if (container == null) {
|
||||
if (this.isSpectator()) {
|
||||
this.displayClientMessage(IChatBaseComponent.translatable("container.spectatorCantOpen").withStyle(EnumChatFormat.RED), true);
|
||||
@@ -1061,9 +1416,11 @@
|
||||
@@ -1060,9 +1415,11 @@
|
||||
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
@@ -753,7 +753,7 @@
|
||||
return OptionalInt.of(this.containerCounter);
|
||||
}
|
||||
}
|
||||
@@ -1076,13 +1433,24 @@
|
||||
@@ -1075,13 +1432,24 @@
|
||||
|
||||
@Override
|
||||
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
||||
@@ -780,7 +780,7 @@
|
||||
this.initMenu(this.containerMenu);
|
||||
}
|
||||
|
||||
@@ -1105,6 +1473,7 @@
|
||||
@@ -1104,6 +1472,7 @@
|
||||
|
||||
@Override
|
||||
public void closeContainer() {
|
||||
@@ -788,7 +788,7 @@
|
||||
this.connection.send(new PacketPlayOutCloseWindow(this.containerMenu.containerId));
|
||||
this.doCloseContainer();
|
||||
}
|
||||
@@ -1127,6 +1496,16 @@
|
||||
@@ -1126,6 +1495,16 @@
|
||||
}
|
||||
|
||||
this.jumping = flag;
|
||||
@@ -805,25 +805,25 @@
|
||||
this.setShiftKeyDown(flag1);
|
||||
}
|
||||
|
||||
@@ -1135,7 +1514,7 @@
|
||||
@@ -1134,7 +1513,7 @@
|
||||
@Override
|
||||
public void awardStat(Statistic<?> statistic, int i) {
|
||||
this.stats.increment(this, statistic, i);
|
||||
- this.getScoreboard().forAllObjectives(statistic, this.getScoreboardName(), (scoreboardscore) -> {
|
||||
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(statistic, this.getScoreboardName(), (scoreboardscore) -> { // CraftBukkit - Get our scores instead
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(statistic, this.getScoreboardName(), (scoreboardscore) -> { // CraftBukkit - Get our scores instead
|
||||
scoreboardscore.add(i);
|
||||
});
|
||||
}
|
||||
@@ -1143,7 +1522,7 @@
|
||||
@@ -1142,7 +1521,7 @@
|
||||
@Override
|
||||
public void resetStat(Statistic<?> statistic) {
|
||||
this.stats.setValue(this, statistic, 0);
|
||||
- this.getScoreboard().forAllObjectives(statistic, this.getScoreboardName(), ScoreboardScore::reset);
|
||||
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(statistic, this.getScoreboardName(), ScoreboardScore::reset); // CraftBukkit - Get our scores instead
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(statistic, this.getScoreboardName(), ScoreboardScore::reset); // CraftBukkit - Get our scores instead
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1159,7 +1538,7 @@
|
||||
@@ -1163,7 +1542,7 @@
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
MinecraftKey minecraftkey = aminecraftkey1[j];
|
||||
@@ -832,7 +832,7 @@
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
optional.ifPresent(list::add);
|
||||
@@ -1194,6 +1573,7 @@
|
||||
@@ -1198,6 +1577,7 @@
|
||||
|
||||
public void resetSentInfo() {
|
||||
this.lastSentHealth = -1.0E8F;
|
||||
@@ -840,7 +840,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1252,7 +1632,7 @@
|
||||
@@ -1256,7 +1636,7 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
@@ -849,7 +849,7 @@
|
||||
this.seenCredits = entityplayer.seenCredits;
|
||||
this.enteredNetherPosition = entityplayer.enteredNetherPosition;
|
||||
this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft());
|
||||
@@ -1302,6 +1682,12 @@
|
||||
@@ -1306,6 +1686,12 @@
|
||||
|
||||
@Override
|
||||
public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1) {
|
||||
@@ -862,10 +862,10 @@
|
||||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(BlockPosition.containing(d0, d1, d2));
|
||||
|
||||
worldserver.getChunkSource().addRegionTicket(TicketType.POST_TELEPORT, chunkcoordintpair, 1, this.getId());
|
||||
@@ -1311,9 +1697,9 @@
|
||||
@@ -1315,9 +1701,9 @@
|
||||
}
|
||||
|
||||
if (worldserver == this.level) {
|
||||
if (worldserver == this.level()) {
|
||||
- this.connection.teleport(d0, d1, d2, f, f1, set);
|
||||
+ this.connection.teleport(d0, d1, d2, f, f1, set, cause); // CraftBukkit
|
||||
} else {
|
||||
@@ -874,7 +874,7 @@
|
||||
}
|
||||
|
||||
this.setYHeadRot(f);
|
||||
@@ -1417,7 +1803,20 @@
|
||||
@@ -1420,7 +1806,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -895,7 +895,7 @@
|
||||
this.chatVisibility = packetplayinsettings.chatVisibility();
|
||||
this.canChatColor = packetplayinsettings.chatColors();
|
||||
this.textFilteringEnabled = packetplayinsettings.textFilteringEnabled();
|
||||
@@ -1492,7 +1891,7 @@
|
||||
@@ -1495,7 +1894,7 @@
|
||||
if (world instanceof WorldServer) {
|
||||
WorldServer worldserver = (WorldServer) world;
|
||||
|
||||
@@ -904,7 +904,7 @@
|
||||
}
|
||||
|
||||
if (entity != null) {
|
||||
@@ -1529,7 +1928,7 @@
|
||||
@@ -1532,7 +1931,7 @@
|
||||
|
||||
@Nullable
|
||||
public IChatBaseComponent getTabListDisplayName() {
|
||||
@@ -913,7 +913,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1550,9 +1949,16 @@
|
||||
@@ -1553,9 +1952,16 @@
|
||||
return this.advancements;
|
||||
}
|
||||
|
||||
@@ -927,10 +927,10 @@
|
||||
this.setCamera(this);
|
||||
this.stopRiding();
|
||||
+ /* CraftBukkit start - replace with bukkit handling for multi-world
|
||||
if (worldserver == this.level) {
|
||||
if (worldserver == this.level()) {
|
||||
this.connection.teleport(d0, d1, d2, f, f1);
|
||||
} else {
|
||||
@@ -1572,6 +1978,9 @@
|
||||
@@ -1575,6 +1981,9 @@
|
||||
this.server.getPlayerList().sendLevelInfo(this, worldserver);
|
||||
this.server.getPlayerList().sendAllPlayerInfo(this);
|
||||
}
|
||||
@@ -940,7 +940,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -1593,6 +2002,32 @@
|
||||
@@ -1596,6 +2005,32 @@
|
||||
}
|
||||
|
||||
public void setRespawnPosition(ResourceKey<World> resourcekey, @Nullable BlockPosition blockposition, float f, boolean flag, boolean flag1) {
|
||||
@@ -973,9 +973,9 @@
|
||||
if (blockposition != null) {
|
||||
boolean flag2 = blockposition.equals(this.respawnPosition) && resourcekey.equals(this.respawnDimension);
|
||||
|
||||
@@ -1762,4 +2197,146 @@
|
||||
this.hurtDir = (float) (MathHelper.atan2(d1, d0) * 57.2957763671875D - (double) this.getYRot());
|
||||
this.connection.send(new ClientboundHurtAnimationPacket(this));
|
||||
@@ -1805,4 +2240,146 @@
|
||||
}
|
||||
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - Add per-player time and weather.
|
||||
@@ -985,10 +985,10 @@
|
||||
+ public long getPlayerTime() {
|
||||
+ if (this.relativeTime) {
|
||||
+ // Adds timeOffset to the current server time.
|
||||
+ return this.level.getDayTime() + this.timeOffset;
|
||||
+ return this.level().getDayTime() + this.timeOffset;
|
||||
+ } else {
|
||||
+ // Adds timeOffset to the beginning of this day.
|
||||
+ return this.level.getDayTime() - (this.level.getDayTime() % 24000) + this.timeOffset;
|
||||
+ return this.level().getDayTime() - (this.level().getDayTime() % 24000) + this.timeOffset;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@@ -1054,7 +1054,7 @@
|
||||
+
|
||||
+ public void resetPlayerWeather() {
|
||||
+ this.weather = null;
|
||||
+ this.setPlayerWeather(this.level.getLevelData().isRaining() ? WeatherType.DOWNFALL : WeatherType.CLEAR, false);
|
||||
+ this.setPlayerWeather(this.level().getLevelData().isRaining() ? WeatherType.DOWNFALL : WeatherType.CLEAR, false);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@@ -1080,7 +1080,7 @@
|
||||
+
|
||||
+ public void reset() {
|
||||
+ float exp = 0;
|
||||
+ boolean keepInventory = this.level.getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY);
|
||||
+ boolean keepInventory = this.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY);
|
||||
+
|
||||
+ if (this.keepLevel) { // CraftBukkit - SPIGOT-6687: Only use keepLevel (was pre-set with RULE_KEEPINVENTORY value in PlayerDeathEvent)
|
||||
+ exp = this.experienceProgress;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
+++ b/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
@@ -44,6 +44,12 @@
|
||||
@@ -42,6 +42,12 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public class EntityTrackerEntry {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -65,8 +71,12 @@
|
||||
@@ -63,8 +69,12 @@
|
||||
private boolean wasOnGround;
|
||||
@Nullable
|
||||
private List<DataWatcher.b<?>> trackedDataValues;
|
||||
@@ -27,16 +27,16 @@
|
||||
this.ap = Vec3D.ZERO;
|
||||
this.lastPassengers = Collections.emptyList();
|
||||
this.level = worldserver;
|
||||
@@ -86,7 +96,7 @@
|
||||
@@ -84,7 +94,7 @@
|
||||
List<Entity> list = this.entity.getPassengers();
|
||||
|
||||
if (!list.equals(this.lastPassengers)) {
|
||||
- this.broadcast.accept(new PacketPlayOutMount(this.entity));
|
||||
+ this.broadcastAndSend(new PacketPlayOutMount(this.entity)); // CraftBukkit
|
||||
this.changedPassengers(list, this.lastPassengers).forEach((entity) -> {
|
||||
removedPassengers(list, this.lastPassengers).forEach((entity) -> {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||
@@ -105,18 +115,18 @@
|
||||
@@ -101,18 +111,18 @@
|
||||
if (entity instanceof EntityItemFrame) {
|
||||
EntityItemFrame entityitemframe = (EntityItemFrame) entity;
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
worldmap.tickCarriedBy(entityplayer, itemstack);
|
||||
Packet<?> packet = worldmap.getUpdatePacket(integer, entityplayer);
|
||||
@@ -229,7 +239,27 @@
|
||||
@@ -225,7 +235,27 @@
|
||||
|
||||
++this.tickCount;
|
||||
if (this.entity.hurtMarked) {
|
||||
@@ -72,7 +72,7 @@
|
||||
+ org.bukkit.util.Vector velocity = player.getVelocity();
|
||||
+
|
||||
+ PlayerVelocityEvent event = new PlayerVelocityEvent(player, velocity.clone());
|
||||
+ this.entity.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.entity.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ cancelled = true;
|
||||
@@ -88,18 +88,9 @@
|
||||
this.entity.hurtMarked = false;
|
||||
}
|
||||
|
||||
@@ -252,14 +282,17 @@
|
||||
List<Packet<PacketListenerPlayOut>> list = new ArrayList();
|
||||
@@ -253,7 +283,10 @@
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
- this.sendPairingData(list::add);
|
||||
+ this.sendPairingData(list::add, entityplayer); // CraftBukkit - add player
|
||||
entityplayer.connection.send(new ClientboundBundlePacket(list));
|
||||
this.entity.startSeenByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
- public void sendPairingData(Consumer<Packet<PacketListenerPlayOut>> consumer) {
|
||||
+ public void sendPairingData(Consumer<Packet<PacketListenerPlayOut>> consumer, EntityPlayer entityplayer) { // CraftBukkit - add player
|
||||
public void sendPairingData(EntityPlayer entityplayer, Consumer<Packet<PacketListenerPlayOut>> consumer) {
|
||||
if (this.entity.isRemoved()) {
|
||||
- EntityTrackerEntry.LOGGER.warn("Fetching packet for removed entity {}", this.entity);
|
||||
+ // CraftBukkit start - Remove useless error spam, just return
|
||||
@@ -109,7 +100,7 @@
|
||||
}
|
||||
|
||||
Packet<PacketListenerPlayOut> packet = this.entity.getAddEntityPacket();
|
||||
@@ -275,6 +308,12 @@
|
||||
@@ -269,6 +302,12 @@
|
||||
if (this.entity instanceof EntityLiving) {
|
||||
Collection<AttributeModifiable> collection = ((EntityLiving) this.entity).getAttributes().getSyncableAttributes();
|
||||
|
||||
@@ -122,7 +113,7 @@
|
||||
if (!collection.isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutUpdateAttributes(this.entity.getId(), collection));
|
||||
}
|
||||
@@ -306,8 +345,14 @@
|
||||
@@ -300,8 +339,14 @@
|
||||
if (!list.isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutEntityEquipment(this.entity.getId(), list));
|
||||
}
|
||||
@@ -134,10 +125,10 @@
|
||||
+ consumer.accept(new PacketPlayOutEntityHeadRotation(this.entity, (byte) yHeadRotp));
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.entity instanceof EntityLiving) {
|
||||
EntityLiving entityliving = (EntityLiving) this.entity;
|
||||
Iterator iterator = entityliving.getActiveEffects().iterator();
|
||||
@@ -350,6 +395,11 @@
|
||||
if (!this.entity.getPassengers().isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutMount(this.entity));
|
||||
}
|
||||
@@ -333,6 +378,11 @@
|
||||
Set<AttributeModifiable> set = ((EntityLiving) this.entity).getAttributes().getDirtyAttributes();
|
||||
|
||||
if (!set.isEmpty()) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/server/level/PlayerChunk.java
|
||||
+++ b/net/minecraft/server/level/PlayerChunk.java
|
||||
@@ -37,6 +37,10 @@
|
||||
@@ -36,6 +36,10 @@
|
||||
import net.minecraft.world.level.chunk.ProtoChunkExtension;
|
||||
import net.minecraft.world.level.lighting.LightEngine;
|
||||
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
@@ -11,7 +11,7 @@
|
||||
public class PlayerChunk {
|
||||
|
||||
public static final Either<IChunkAccess, PlayerChunk.Failure> UNLOADED_CHUNK = Either.right(PlayerChunk.Failure.UNLOADED);
|
||||
@@ -75,11 +79,11 @@
|
||||
@@ -71,11 +75,11 @@
|
||||
this.fullChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
this.tickingChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
this.entityTickingChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
@@ -24,15 +24,15 @@
|
||||
+ this.pendingFullStateConfirmation = CompletableFuture.completedFuture(null); // CraftBukkit - decompile error
|
||||
this.pos = chunkcoordintpair;
|
||||
this.levelHeightAccessor = levelheightaccessor;
|
||||
this.lightEngine = lightengine;
|
||||
@@ -92,6 +96,20 @@
|
||||
this.lightEngine = levellightengine;
|
||||
@@ -88,6 +92,20 @@
|
||||
this.changedBlocksPerSection = new ShortSet[levelheightaccessor.getSectionsCount()];
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public Chunk getFullChunkNow() {
|
||||
+ // Note: We use the oldTicketLevel for isLoaded checks.
|
||||
+ if (!getFullChunkStatus(this.oldTicketLevel).isOrAfter(PlayerChunk.State.BORDER)) return null;
|
||||
+ if (!ChunkLevel.fullStatus(this.oldTicketLevel).isOrAfter(FullChunkStatus.FULL)) return null;
|
||||
+ return this.getFullChunkNowUnchecked();
|
||||
+ }
|
||||
+
|
||||
@@ -46,7 +46,7 @@
|
||||
public CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> getFutureIfPresentUnchecked(ChunkStatus chunkstatus) {
|
||||
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.futures.get(chunkstatus.getIndex());
|
||||
|
||||
@@ -117,17 +135,17 @@
|
||||
@@ -113,17 +131,17 @@
|
||||
@Nullable
|
||||
public Chunk getTickingChunk() {
|
||||
CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture = this.getTickingChunkFuture();
|
||||
@@ -68,7 +68,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -172,6 +190,7 @@
|
||||
@@ -168,6 +186,7 @@
|
||||
if (chunk != null) {
|
||||
int i = this.levelHeightAccessor.getSectionIndex(blockposition.getY());
|
||||
|
||||
@@ -76,12 +76,12 @@
|
||||
if (this.changedBlocksPerSection[i] == null) {
|
||||
this.hasChangedSections = true;
|
||||
this.changedBlocksPerSection[i] = new ShortOpenHashSet();
|
||||
@@ -182,10 +201,10 @@
|
||||
@@ -178,10 +197,10 @@
|
||||
}
|
||||
|
||||
public void sectionLightChanged(EnumSkyBlock enumskyblock, int i) {
|
||||
- Either<IChunkAccess, PlayerChunk.Failure> either = (Either) this.getFutureIfPresent(ChunkStatus.FEATURES).getNow((Object) null);
|
||||
+ Either<IChunkAccess, PlayerChunk.Failure> either = (Either) this.getFutureIfPresent(ChunkStatus.FEATURES).getNow(null); // CraftBukkit - decompile error
|
||||
- Either<IChunkAccess, PlayerChunk.Failure> either = (Either) this.getFutureIfPresent(ChunkStatus.INITIALIZE_LIGHT).getNow((Object) null);
|
||||
+ Either<IChunkAccess, PlayerChunk.Failure> either = (Either) this.getFutureIfPresent(ChunkStatus.INITIALIZE_LIGHT).getNow(null); // CraftBukkit - decompile error
|
||||
|
||||
if (either != null) {
|
||||
- IChunkAccess ichunkaccess = (IChunkAccess) either.left().orElse((Object) null);
|
||||
@@ -89,7 +89,20 @@
|
||||
|
||||
if (ichunkaccess != null) {
|
||||
ichunkaccess.setUnsaved(true);
|
||||
@@ -372,7 +391,7 @@
|
||||
@@ -246,8 +265,11 @@
|
||||
PacketPlayOutMultiBlockChange packetplayoutmultiblockchange = new PacketPlayOutMultiBlockChange(sectionposition, shortset, chunksection);
|
||||
|
||||
this.broadcast(list, packetplayoutmultiblockchange);
|
||||
+ // CraftBukkit start
|
||||
+ List finalList = list;
|
||||
packetplayoutmultiblockchange.runUpdates((blockposition1, iblockdata1) -> {
|
||||
- this.broadcastBlockEntityIfNeeded(list, world, blockposition1, iblockdata1);
|
||||
+ this.broadcastBlockEntityIfNeeded(finalList, world, blockposition1, iblockdata1);
|
||||
+ // CraftBukkit end
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -372,7 +394,7 @@
|
||||
this.pendingFullStateConfirmation = completablefuture1;
|
||||
completablefuture.thenAccept((either) -> {
|
||||
either.ifLeft((chunk) -> {
|
||||
@@ -98,13 +111,13 @@
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -389,6 +408,30 @@
|
||||
boolean flag1 = this.ticketLevel <= PlayerChunkMap.MAX_CHUNK_DISTANCE;
|
||||
PlayerChunk.State playerchunk_state = getFullChunkStatus(this.oldTicketLevel);
|
||||
PlayerChunk.State playerchunk_state1 = getFullChunkStatus(this.ticketLevel);
|
||||
@@ -389,6 +411,30 @@
|
||||
boolean flag1 = ChunkLevel.isLoaded(this.ticketLevel);
|
||||
FullChunkStatus fullchunkstatus = ChunkLevel.fullStatus(this.oldTicketLevel);
|
||||
FullChunkStatus fullchunkstatus1 = ChunkLevel.fullStatus(this.ticketLevel);
|
||||
+ // CraftBukkit start
|
||||
+ // ChunkUnloadEvent: Called before the chunk is unloaded: isChunkLoaded is still true and chunk can still be modified by plugins.
|
||||
+ if (playerchunk_state.isOrAfter(PlayerChunk.State.BORDER) && !playerchunk_state1.isOrAfter(PlayerChunk.State.BORDER)) {
|
||||
+ if (fullchunkstatus.isOrAfter(FullChunkStatus.FULL) && !fullchunkstatus1.isOrAfter(FullChunkStatus.FULL)) {
|
||||
+ this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> {
|
||||
+ Chunk chunk = (Chunk)either.left().orElse(null);
|
||||
+ if (chunk != null) {
|
||||
@@ -129,13 +142,13 @@
|
||||
|
||||
if (flag) {
|
||||
Either<IChunkAccess, PlayerChunk.Failure> either = Either.right(new PlayerChunk.Failure() {
|
||||
@@ -459,6 +502,26 @@
|
||||
@@ -459,6 +505,26 @@
|
||||
|
||||
this.onLevelChange.onLevelChange(this.pos, this::getQueueLevel, this.ticketLevel, this::setQueueLevel);
|
||||
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.
|
||||
+ if (!playerchunk_state.isOrAfter(PlayerChunk.State.BORDER) && playerchunk_state1.isOrAfter(PlayerChunk.State.BORDER)) {
|
||||
+ if (!fullchunkstatus.isOrAfter(FullChunkStatus.FULL) && fullchunkstatus1.isOrAfter(FullChunkStatus.FULL)) {
|
||||
+ this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> {
|
||||
+ Chunk chunk = (Chunk)either.left().orElse(null);
|
||||
+ if (chunk != null) {
|
||||
@@ -155,4 +168,4 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public static ChunkStatus getStatus(int i) {
|
||||
public boolean wasAccessibleSinceLastSave() {
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
+import org.bukkit.entity.Player;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.e {
|
||||
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
|
||||
private static final byte CHUNK_TYPE_REPLACEABLE = -1;
|
||||
@@ -152,6 +158,27 @@
|
||||
@@ -151,6 +157,27 @@
|
||||
private final Queue<Runnable> unloadQueue;
|
||||
int viewDistance;
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, StructureTemplateManager structuretemplatemanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier<WorldPersistentData> supplier, int i, boolean flag) {
|
||||
super(convertable_conversionsession.getDimensionPath(worldserver.dimension()).resolve("region"), datafixer, flag);
|
||||
this.visibleChunkMap = this.updatingChunkMap.clone();
|
||||
@@ -170,6 +197,11 @@
|
||||
@@ -169,6 +196,11 @@
|
||||
this.storageName = path.getFileName().toString();
|
||||
this.level = worldserver;
|
||||
this.generator = chunkgenerator;
|
||||
@@ -53,22 +53,22 @@
|
||||
IRegistryCustom iregistrycustom = worldserver.registryAccess();
|
||||
long j = worldserver.getSeed();
|
||||
|
||||
@@ -329,9 +361,12 @@
|
||||
CompletableFuture<List<Either<IChunkAccess, PlayerChunk.Failure>>> completablefuture1 = SystemUtils.sequence(list);
|
||||
CompletableFuture<Either<List<IChunkAccess>, PlayerChunk.Failure>> completablefuture2 = completablefuture1.thenApply((list2) -> {
|
||||
List<IChunkAccess> list3 = Lists.newArrayList();
|
||||
- final int l1 = 0;
|
||||
+ // CraftBukkit start - decompile error
|
||||
+ int cnt = 0;
|
||||
@@ -335,9 +367,12 @@
|
||||
CompletableFuture<List<Either<IChunkAccess, PlayerChunk.Failure>>> completablefuture1 = SystemUtils.sequence(list);
|
||||
CompletableFuture<Either<List<IChunkAccess>, PlayerChunk.Failure>> completablefuture2 = completablefuture1.thenApply((list2) -> {
|
||||
List<IChunkAccess> list3 = Lists.newArrayList();
|
||||
- final int l1 = 0;
|
||||
+ // CraftBukkit start - decompile error
|
||||
+ int cnt = 0;
|
||||
|
||||
- for (Iterator iterator = list2.iterator(); iterator.hasNext(); ++l1) {
|
||||
+ for (Iterator iterator = list2.iterator(); iterator.hasNext(); ++cnt) {
|
||||
+ final int l1 = cnt;
|
||||
+ // CraftBukkit end
|
||||
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
|
||||
- for (Iterator iterator = list2.iterator(); iterator.hasNext(); ++l1) {
|
||||
+ for (Iterator iterator = list2.iterator(); iterator.hasNext(); ++cnt) {
|
||||
+ final int l1 = cnt;
|
||||
+ // CraftBukkit end
|
||||
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
|
||||
|
||||
if (either == null) {
|
||||
@@ -536,7 +571,7 @@
|
||||
if (either == null) {
|
||||
@@ -543,7 +578,7 @@
|
||||
|
||||
private void scheduleUnload(long i, PlayerChunk playerchunk) {
|
||||
CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkToSave();
|
||||
@@ -77,7 +77,7 @@
|
||||
CompletableFuture<IChunkAccess> completablefuture1 = playerchunk.getChunkToSave();
|
||||
|
||||
if (completablefuture1 != completablefuture) {
|
||||
@@ -625,9 +660,9 @@
|
||||
@@ -634,9 +669,9 @@
|
||||
ProtoChunk protochunk = ChunkRegionLoader.read(this.level, this.poiManager, chunkcoordintpair, (NBTTagCompound) optional.get());
|
||||
|
||||
this.markPosition(chunkcoordintpair, protochunk.getStatus().getChunkType());
|
||||
@@ -89,7 +89,7 @@
|
||||
}
|
||||
}, this.mainThreadExecutor).exceptionallyAsync((throwable) -> {
|
||||
return this.handleChunkLoadFailure(throwable, chunkcoordintpair);
|
||||
@@ -733,7 +768,21 @@
|
||||
@@ -751,7 +786,21 @@
|
||||
|
||||
private static void postLoadProtoChunk(WorldServer worldserver, List<NBTTagCompound> list) {
|
||||
if (!list.isEmpty()) {
|
||||
@@ -112,7 +112,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -832,7 +881,7 @@
|
||||
@@ -852,7 +901,7 @@
|
||||
if (!playerchunk.wasAccessibleSinceLastSave()) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -121,7 +121,7 @@
|
||||
|
||||
if (!(ichunkaccess instanceof ProtoChunkExtension) && !(ichunkaccess instanceof Chunk)) {
|
||||
return false;
|
||||
@@ -994,7 +1043,8 @@
|
||||
@@ -1014,7 +1063,8 @@
|
||||
return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty();
|
||||
});
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
return chunk.getBlockEntities().size();
|
||||
}).orElse(0), tickingtracker.getTicketDebugString(i), tickingtracker.getLevel(i), optional1.map((chunk) -> {
|
||||
return chunk.getBlockTicks().count();
|
||||
@@ -1007,7 +1057,7 @@
|
||||
@@ -1027,7 +1077,7 @@
|
||||
|
||||
private static String printFuture(CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture) {
|
||||
try {
|
||||
@@ -140,7 +140,7 @@
|
||||
|
||||
return either != null ? (String) either.map((chunk) -> {
|
||||
return "done";
|
||||
@@ -1023,12 +1073,14 @@
|
||||
@@ -1043,12 +1093,14 @@
|
||||
|
||||
private CompletableFuture<Optional<NBTTagCompound>> readChunk(ChunkCoordIntPair chunkcoordintpair) {
|
||||
return this.read(chunkcoordintpair).thenApplyAsync((optional) -> {
|
||||
@@ -158,7 +158,7 @@
|
||||
}
|
||||
|
||||
boolean anyPlayerCloseEnoughForSpawning(ChunkCoordIntPair chunkcoordintpair) {
|
||||
@@ -1482,7 +1534,7 @@
|
||||
@@ -1503,7 +1555,7 @@
|
||||
public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet();
|
||||
|
||||
public EntityTracker(Entity entity, int i, int j, boolean flag) {
|
||||
@@ -167,7 +167,7 @@
|
||||
this.entity = entity;
|
||||
this.range = i;
|
||||
this.lastSectionPos = SectionPosition.of((EntityAccess) entity);
|
||||
@@ -1541,6 +1593,11 @@
|
||||
@@ -1562,6 +1614,11 @@
|
||||
double d2 = d0 * d0;
|
||||
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(entityplayer);
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
+ }
|
||||
+ } else if (!iblockdata.isAir()) {
|
||||
iblockdata.attack(this.level, blockposition, this.player);
|
||||
f = iblockdata.getDestroyProgress(this.player, this.player.level, blockposition);
|
||||
f = iblockdata.getDestroyProgress(this.player, this.player.level(), blockposition);
|
||||
}
|
||||
|
||||
+ if (event.useItemInHand() == Event.Result.DENY) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/net/minecraft/server/level/WorldServer.java
|
||||
@@ -159,6 +159,26 @@
|
||||
@@ -162,6 +162,26 @@
|
||||
import net.minecraft.world.ticks.TickListServer;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
||||
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
|
||||
@@ -172,7 +192,7 @@
|
||||
@@ -175,7 +195,7 @@
|
||||
final List<EntityPlayer> players;
|
||||
private final ChunkProviderServer chunkSource;
|
||||
private final MinecraftServer server;
|
||||
@@ -36,11 +36,11 @@
|
||||
final EntityTickList entityTickList;
|
||||
public final PersistentEntitySectionManager<Entity> entityManager;
|
||||
private final GameEventDispatcher gameEventDispatcher;
|
||||
@@ -196,12 +216,30 @@
|
||||
private final StructureCheck structureCheck;
|
||||
@@ -200,12 +220,30 @@
|
||||
private final boolean tickTime;
|
||||
private final RandomSequences randomSequences;
|
||||
|
||||
- public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, WorldDimension worlddimension, WorldLoadListener worldloadlistener, boolean flag, long i, List<MobSpawner> list, boolean flag1) {
|
||||
- public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, WorldDimension worlddimension, WorldLoadListener worldloadlistener, boolean flag, long i, List<MobSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences) {
|
||||
- IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess();
|
||||
- Holder holder = worlddimension.type();
|
||||
+ // CraftBukkit start
|
||||
@@ -59,7 +59,7 @@
|
||||
- Objects.requireNonNull(minecraftserver);
|
||||
- super(iworlddataserver, resourcekey, iregistrycustom_dimension, holder, minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates());
|
||||
+ // Add env and gen to constructor, IWorldDataServer -> WorldDataServer
|
||||
+ public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, WorldDataServer iworlddataserver, ResourceKey<World> resourcekey, WorldDimension worlddimension, WorldLoadListener worldloadlistener, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
||||
+ public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, WorldDataServer iworlddataserver, ResourceKey<World> resourcekey, WorldDimension worlddimension, WorldLoadListener worldloadlistener, boolean flag, long i, List<MobSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
||||
+ // IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess(); // CraftBukkit - decompile error
|
||||
+ // Holder holder = worlddimension.type(); // CraftBukkit - decompile error
|
||||
+
|
||||
@@ -72,7 +72,7 @@
|
||||
this.players = Lists.newArrayList();
|
||||
this.entityTickList = new EntityTickList();
|
||||
this.blockTicks = new TickListServer<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
|
||||
@@ -215,6 +253,22 @@
|
||||
@@ -219,6 +257,22 @@
|
||||
this.customSpawners = list;
|
||||
this.serverLevelData = iworlddataserver;
|
||||
ChunkGenerator chunkgenerator = worlddimension.generator();
|
||||
@@ -95,7 +95,7 @@
|
||||
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
||||
DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver);
|
||||
@@ -246,15 +300,16 @@
|
||||
@@ -250,9 +304,9 @@
|
||||
long l = minecraftserver.getWorldData().worldGenOptions().seed();
|
||||
|
||||
this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this.chunkSource.randomState(), this, chunkgenerator.getBiomeSource(), l, datafixer);
|
||||
@@ -108,14 +108,15 @@
|
||||
} else {
|
||||
this.dragonFight = null;
|
||||
}
|
||||
|
||||
this.sleepStatus = new SleepStatus();
|
||||
this.gameEventDispatcher = new GameEventDispatcher(this);
|
||||
@@ -266,6 +320,7 @@
|
||||
return new RandomSequences(l);
|
||||
}, "random_sequences");
|
||||
});
|
||||
+ this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
|
||||
}
|
||||
|
||||
public void setWeatherParameters(int i, int j, boolean flag, boolean flag1) {
|
||||
@@ -286,12 +341,20 @@
|
||||
/** @deprecated */
|
||||
@@ -304,12 +359,20 @@
|
||||
long j;
|
||||
|
||||
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
|
||||
@@ -139,7 +140,7 @@
|
||||
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
|
||||
this.resetWeatherCycle();
|
||||
}
|
||||
@@ -317,7 +380,7 @@
|
||||
@@ -335,7 +398,7 @@
|
||||
this.runBlockEvents();
|
||||
this.handlingTick = false;
|
||||
gameprofilerfiller.pop();
|
||||
@@ -148,7 +149,7 @@
|
||||
|
||||
if (flag) {
|
||||
this.resetEmptyTime();
|
||||
@@ -333,7 +396,7 @@
|
||||
@@ -351,7 +414,7 @@
|
||||
|
||||
this.entityTickList.forEach((entity) -> {
|
||||
if (!entity.isRemoved()) {
|
||||
@@ -157,7 +158,7 @@
|
||||
entity.discard();
|
||||
} else {
|
||||
gameprofilerfiller.push("checkDespawn");
|
||||
@@ -405,7 +468,7 @@
|
||||
@@ -423,7 +486,7 @@
|
||||
|
||||
private void wakeUpAllPlayers() {
|
||||
this.sleepStatus.removeAllSleepers();
|
||||
@@ -166,7 +167,7 @@
|
||||
entityplayer.stopSleepInBed(false, false);
|
||||
});
|
||||
}
|
||||
@@ -433,7 +496,7 @@
|
||||
@@ -451,7 +514,7 @@
|
||||
entityhorseskeleton.setTrap(true);
|
||||
entityhorseskeleton.setAge(0);
|
||||
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
||||
@@ -175,7 +176,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,7 +505,7 @@
|
||||
@@ -460,7 +523,7 @@
|
||||
if (entitylightning != null) {
|
||||
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
|
||||
entitylightning.setVisualOnly(flag1);
|
||||
@@ -184,7 +185,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -456,7 +519,7 @@
|
||||
@@ -475,7 +538,7 @@
|
||||
BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition).value();
|
||||
|
||||
if (biomebase.shouldFreeze(this, blockposition1)) {
|
||||
@@ -193,8 +194,8 @@
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
@@ -471,10 +534,10 @@
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, l + 1);
|
||||
@@ -489,10 +552,10 @@
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, i1 + 1);
|
||||
|
||||
Block.pushEntitiesUp(iblockdata, iblockdata1, this, blockposition);
|
||||
- this.setBlockAndUpdate(blockposition, iblockdata1);
|
||||
@@ -206,7 +207,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -670,6 +733,7 @@
|
||||
@@ -688,6 +751,7 @@
|
||||
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
@@ -214,13 +215,13 @@
|
||||
if (this.oRainLevel != this.rainLevel) {
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
|
||||
}
|
||||
@@ -688,14 +752,47 @@
|
||||
@@ -706,14 +770,47 @@
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel));
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel));
|
||||
}
|
||||
+ // */
|
||||
+ for (int idx = 0; idx < this.players.size(); ++idx) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).level == this) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).level() == this) {
|
||||
+ ((EntityPlayer) this.players.get(idx)).tickWeather();
|
||||
+ }
|
||||
+ }
|
||||
@@ -228,13 +229,13 @@
|
||||
+ 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)).level == 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)).level == this) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).level() == this) {
|
||||
+ ((EntityPlayer) this.players.get(idx)).updateWeather(this.oRainLevel, this.rainLevel, this.oThunderLevel, this.thunderLevel);
|
||||
+ }
|
||||
+ }
|
||||
@@ -264,7 +265,7 @@
|
||||
}
|
||||
|
||||
public void resetEmptyTime() {
|
||||
@@ -730,6 +827,7 @@
|
||||
@@ -748,6 +845,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickNonPassenger");
|
||||
entity.tick();
|
||||
@@ -272,7 +273,7 @@
|
||||
this.getProfiler().pop();
|
||||
Iterator iterator = entity.getPassengers().iterator();
|
||||
|
||||
@@ -753,6 +851,7 @@
|
||||
@@ -771,6 +869,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickPassenger");
|
||||
entity1.rideTick();
|
||||
@@ -280,7 +281,7 @@
|
||||
gameprofilerfiller.pop();
|
||||
Iterator iterator = entity1.getPassengers().iterator();
|
||||
|
||||
@@ -777,6 +876,7 @@
|
||||
@@ -795,6 +894,7 @@
|
||||
ChunkProviderServer chunkproviderserver = this.getChunkSource();
|
||||
|
||||
if (!flag1) {
|
||||
@@ -288,7 +289,7 @@
|
||||
if (iprogressupdate != null) {
|
||||
iprogressupdate.progressStartNoAbort(IChatBaseComponent.translatable("menu.savingLevel"));
|
||||
}
|
||||
@@ -794,11 +894,19 @@
|
||||
@@ -812,11 +912,19 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -309,7 +310,7 @@
|
||||
}
|
||||
|
||||
this.getChunkSource().getDataStorage().save();
|
||||
@@ -863,15 +971,37 @@
|
||||
@@ -881,15 +989,37 @@
|
||||
|
||||
@Override
|
||||
public boolean addFreshEntity(Entity entity) {
|
||||
@@ -350,7 +351,7 @@
|
||||
}
|
||||
|
||||
public void addDuringCommandTeleport(EntityPlayer entityplayer) {
|
||||
@@ -902,24 +1032,37 @@
|
||||
@@ -920,24 +1050,37 @@
|
||||
this.entityManager.addNewEntity(entityplayer);
|
||||
}
|
||||
|
||||
@@ -392,7 +393,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -933,10 +1076,32 @@
|
||||
@@ -951,10 +1094,32 @@
|
||||
entityplayer.remove(entity_removalreason);
|
||||
}
|
||||
|
||||
@@ -425,7 +426,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
@@ -945,6 +1110,12 @@
|
||||
@@ -963,6 +1128,12 @@
|
||||
double d1 = (double) blockposition.getY() - entityplayer.getY();
|
||||
double d2 = (double) blockposition.getZ() - entityplayer.getZ();
|
||||
|
||||
@@ -438,7 +439,7 @@
|
||||
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
||||
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
}
|
||||
@@ -1004,7 +1175,18 @@
|
||||
@@ -1022,7 +1193,18 @@
|
||||
Iterator iterator = this.navigatingMobs.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -458,7 +459,7 @@
|
||||
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
|
||||
|
||||
if (navigationabstract.shouldRecomputePath(blockposition)) {
|
||||
@@ -1066,6 +1248,11 @@
|
||||
@@ -1084,6 +1266,11 @@
|
||||
@Override
|
||||
public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, World.a world_a) {
|
||||
Explosion explosion = this.explode(entity, damagesource, explosiondamagecalculator, d0, d1, d2, f, flag, world_a, false);
|
||||
@@ -470,7 +471,7 @@
|
||||
|
||||
if (!explosion.interactsWithBlocks()) {
|
||||
explosion.clearToBlow();
|
||||
@@ -1138,13 +1325,20 @@
|
||||
@@ -1156,13 +1343,20 @@
|
||||
}
|
||||
|
||||
public <T extends ParticleParam> int sendParticles(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
|
||||
@@ -493,7 +494,7 @@
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -1195,7 +1389,7 @@
|
||||
@@ -1213,7 +1407,7 @@
|
||||
|
||||
@Nullable
|
||||
public BlockPosition findNearestMapStructure(TagKey<Structure> tagkey, BlockPosition blockposition, int i, boolean flag) {
|
||||
@@ -502,7 +503,7 @@
|
||||
return null;
|
||||
} else {
|
||||
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().registryOrThrow(Registries.STRUCTURE).getTag(tagkey);
|
||||
@@ -1232,11 +1426,21 @@
|
||||
@@ -1250,11 +1444,21 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public WorldMap getMapData(String s) {
|
||||
@@ -525,7 +526,7 @@
|
||||
this.getServer().overworld().getDataStorage().set(s, worldmap);
|
||||
}
|
||||
|
||||
@@ -1534,6 +1738,11 @@
|
||||
@@ -1552,6 +1756,11 @@
|
||||
@Override
|
||||
public void blockUpdated(BlockPosition blockposition, Block block) {
|
||||
if (!this.isDebug()) {
|
||||
@@ -537,7 +538,7 @@
|
||||
this.updateNeighborsAt(blockposition, block);
|
||||
}
|
||||
|
||||
@@ -1553,12 +1762,12 @@
|
||||
@@ -1571,12 +1780,12 @@
|
||||
}
|
||||
|
||||
public boolean isFlat() {
|
||||
@@ -552,7 +553,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1581,7 +1790,7 @@
|
||||
@@ -1599,7 +1808,7 @@
|
||||
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
|
||||
try {
|
||||
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
|
||||
@@ -561,7 +562,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -1590,7 +1799,7 @@
|
||||
@@ -1608,7 +1817,7 @@
|
||||
object2intopenhashmap.addTo(s, 1);
|
||||
}
|
||||
|
||||
@@ -570,7 +571,7 @@
|
||||
String s1 = (String) entry.getKey();
|
||||
|
||||
return s1 + ":" + entry.getIntValue();
|
||||
@@ -1601,17 +1810,33 @@
|
||||
@@ -1619,17 +1828,33 @@
|
||||
}
|
||||
|
||||
public static void makeObsidianPlatform(WorldServer worldserver) {
|
||||
@@ -606,7 +607,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1727,6 +1952,7 @@
|
||||
@@ -1753,6 +1978,7 @@
|
||||
}
|
||||
|
||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
|
||||
@@ -614,7 +615,7 @@
|
||||
}
|
||||
|
||||
public void onTrackingEnd(Entity entity) {
|
||||
@@ -1763,6 +1989,14 @@
|
||||
@@ -1789,6 +2015,14 @@
|
||||
}
|
||||
|
||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
+ private static final HashMap<InetAddress, Long> throttleTracker = new HashMap<InetAddress, Long>();
|
||||
+ private static int throttleCounter = 0;
|
||||
+ // CraftBukkit end
|
||||
private static final IChatBaseComponent IGNORE_STATUS_REASON = IChatBaseComponent.literal("Ignoring status request");
|
||||
private static final IChatBaseComponent IGNORE_STATUS_REASON = IChatBaseComponent.translatable("disconnect.ignoring_status_request");
|
||||
private final MinecraftServer server;
|
||||
private final NetworkManager connection;
|
||||
@@ -24,9 +33,44 @@
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/network/PlayerConnection.java
|
||||
+++ b/net/minecraft/server/network/PlayerConnection.java
|
||||
@@ -184,6 +184,69 @@
|
||||
@@ -185,6 +185,69 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
public class PlayerConnection implements ServerPlayerConnection, TickablePacketListener, PacketListenerPlayIn {
|
||||
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -200,7 +263,9 @@
|
||||
@@ -201,7 +264,9 @@
|
||||
private long keepAliveTime;
|
||||
private boolean keepAlivePending;
|
||||
private long keepAliveChallenge;
|
||||
@@ -81,7 +81,7 @@
|
||||
private int dropSpamTickCount;
|
||||
private double firstGoodX;
|
||||
private double firstGoodY;
|
||||
@@ -246,8 +311,31 @@
|
||||
@@ -247,8 +312,31 @@
|
||||
this.keepAliveTime = SystemUtils.getMillis();
|
||||
entityplayer.getTextFilter().join();
|
||||
this.signedMessageDecoder = minecraftserver.enforceSecureProfile() ? SignedMessageChain.b.REJECT_ALL : SignedMessageChain.b.unsigned(entityplayer.getUUID());
|
||||
@@ -114,7 +114,7 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -302,7 +390,7 @@
|
||||
@@ -303,7 +391,7 @@
|
||||
this.server.getProfiler().push("keepAlive");
|
||||
long i = SystemUtils.getMillis();
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
if (this.keepAlivePending) {
|
||||
this.disconnect(IChatBaseComponent.translatable("disconnect.timeout"));
|
||||
} else {
|
||||
@@ -314,15 +402,21 @@
|
||||
@@ -315,15 +403,21 @@
|
||||
}
|
||||
|
||||
this.server.getProfiler().pop();
|
||||
@@ -140,12 +140,12 @@
|
||||
--this.dropSpamTickCount;
|
||||
}
|
||||
|
||||
if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && SystemUtils.getMillis() - this.player.getLastActionTime() > (long) (this.server.getPlayerIdleTimeout() * 1000 * 60)) {
|
||||
if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && SystemUtils.getMillis() - this.player.getLastActionTime() > (long) this.server.getPlayerIdleTimeout() * 1000L * 60L) {
|
||||
+ this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
|
||||
this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.idling"));
|
||||
}
|
||||
|
||||
@@ -346,16 +440,67 @@
|
||||
@@ -347,16 +441,67 @@
|
||||
return this.server.isSingleplayerOwner(this.player.getGameProfile());
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@
|
||||
}
|
||||
|
||||
private <T, R> CompletableFuture<R> filterTextPacket(T t0, BiFunction<ITextFilter, T, CompletableFuture<R>> bifunction) {
|
||||
@@ -419,7 +564,34 @@
|
||||
@@ -420,7 +565,34 @@
|
||||
double d9 = entity.getDeltaMovement().lengthSqr();
|
||||
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
|
||||
|
||||
@@ -250,7 +250,7 @@
|
||||
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8});
|
||||
this.connection.send(new PacketPlayOutVehicleMove(entity));
|
||||
return;
|
||||
@@ -451,14 +623,72 @@
|
||||
@@ -460,14 +632,72 @@
|
||||
}
|
||||
|
||||
entity.absMoveTo(d3, d4, d5, f, f1);
|
||||
@@ -320,30 +320,30 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.player.getLevel().getChunkSource().move(this.player);
|
||||
this.player.serverLevel().getChunkSource().move(this.player);
|
||||
this.player.checkMovementStatistics(this.player.getX() - d0, this.player.getY() - d1, this.player.getZ() - d2);
|
||||
this.clientVehicleIsFloating = d11 >= -0.03125D && !flag1 && !this.server.isFlightAllowed() && !entity.isNoGravity() && this.noBlocksAround(entity);
|
||||
@@ -492,6 +722,7 @@
|
||||
@@ -501,6 +731,7 @@
|
||||
}
|
||||
|
||||
this.awaitingPositionFromClient = null;
|
||||
+ this.player.getLevel().getChunkSource().move(this.player); // CraftBukkit
|
||||
+ this.player.serverLevel().getChunkSource().move(this.player); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -499,7 +730,7 @@
|
||||
@@ -508,7 +739,7 @@
|
||||
@Override
|
||||
public void handleRecipeBookSeenRecipePacket(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipedisplayed, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipedisplayed, this, this.player.serverLevel());
|
||||
- Optional optional = this.server.getRecipeManager().byKey(packetplayinrecipedisplayed.getRecipe());
|
||||
+ Optional<? extends IRecipe<?>> optional = this.server.getRecipeManager().byKey(packetplayinrecipedisplayed.getRecipe()); // CraftBukkit - decompile error
|
||||
RecipeBookServer recipebookserver = this.player.getRecipeBook();
|
||||
|
||||
Objects.requireNonNull(recipebookserver);
|
||||
@@ -529,6 +760,12 @@
|
||||
@@ -538,6 +769,12 @@
|
||||
@Override
|
||||
public void handleCustomCommandSuggestions(PacketPlayInTabComplete packetplayintabcomplete) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayintabcomplete, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayintabcomplete, this, this.player.serverLevel());
|
||||
+ // CraftBukkit start
|
||||
+ if (chatSpamTickCount.addAndGet(1) > 500 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
|
||||
+ this.disconnect(IChatBaseComponent.translatable("disconnect.spam"));
|
||||
@@ -353,7 +353,7 @@
|
||||
StringReader stringreader = new StringReader(packetplayintabcomplete.getCommand());
|
||||
|
||||
if (stringreader.canRead() && stringreader.peek() == '/') {
|
||||
@@ -538,6 +775,7 @@
|
||||
@@ -547,6 +784,7 @@
|
||||
ParseResults<CommandListenerWrapper> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
|
||||
|
||||
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
|
||||
@@ -361,7 +361,7 @@
|
||||
this.connection.send(new PacketPlayOutTabComplete(packetplayintabcomplete.getId(), suggestions));
|
||||
});
|
||||
}
|
||||
@@ -787,6 +1025,13 @@
|
||||
@@ -792,6 +1030,13 @@
|
||||
|
||||
if (container instanceof ContainerMerchant) {
|
||||
ContainerMerchant containermerchant = (ContainerMerchant) container;
|
||||
@@ -375,7 +375,7 @@
|
||||
|
||||
if (!containermerchant.stillValid(this.player)) {
|
||||
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, containermerchant);
|
||||
@@ -801,6 +1046,13 @@
|
||||
@@ -806,6 +1051,13 @@
|
||||
|
||||
@Override
|
||||
public void handleEditBook(PacketPlayInBEdit packetplayinbedit) {
|
||||
@@ -389,7 +389,7 @@
|
||||
int i = packetplayinbedit.getSlot();
|
||||
|
||||
if (PlayerInventory.isHotbarSlot(i) || i == 40) {
|
||||
@@ -809,7 +1061,7 @@
|
||||
@@ -814,7 +1066,7 @@
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
optional.ifPresent(list::add);
|
||||
@@ -398,7 +398,7 @@
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
stream.forEach(list::add);
|
||||
@@ -827,7 +1079,7 @@
|
||||
@@ -832,7 +1084,7 @@
|
||||
ItemStack itemstack = this.player.getInventory().getItem(i);
|
||||
|
||||
if (itemstack.is(Items.WRITABLE_BOOK)) {
|
||||
@@ -407,7 +407,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -852,16 +1104,16 @@
|
||||
@@ -857,16 +1109,16 @@
|
||||
|
||||
this.updateBookPages(list, (s) -> {
|
||||
return IChatBaseComponent.ChatSerializer.toJson(IChatBaseComponent.literal(s));
|
||||
@@ -428,7 +428,7 @@
|
||||
return NBTTagString.valueOf((String) unaryoperator.apply(filteredtext.filteredOrEmpty()));
|
||||
});
|
||||
|
||||
@@ -887,6 +1139,7 @@
|
||||
@@ -892,6 +1144,7 @@
|
||||
}
|
||||
|
||||
itemstack.addTagElement("pages", nbttaglist);
|
||||
@@ -436,16 +436,16 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -923,7 +1176,7 @@
|
||||
@@ -928,7 +1181,7 @@
|
||||
} else {
|
||||
WorldServer worldserver = this.player.getLevel();
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
|
||||
- if (!this.player.wonGame) {
|
||||
+ if (!this.player.wonGame && !this.player.isImmobile()) { // CraftBukkit
|
||||
if (this.tickCount == 0) {
|
||||
this.resetPosition();
|
||||
}
|
||||
@@ -933,7 +1186,7 @@
|
||||
@@ -938,7 +1191,7 @@
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
|
||||
}
|
||||
@@ -454,10 +454,10 @@
|
||||
} else {
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
double d0 = clampHorizontal(packetplayinflying.getX(this.player.getX()));
|
||||
@@ -945,7 +1198,15 @@
|
||||
@@ -950,7 +1203,15 @@
|
||||
if (this.player.isPassenger()) {
|
||||
this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1);
|
||||
this.player.getLevel().getChunkSource().move(this.player);
|
||||
this.player.serverLevel().getChunkSource().move(this.player);
|
||||
+ this.allowedPlayerTicks = 20; // CraftBukkit
|
||||
} else {
|
||||
+ // CraftBukkit - Make sure the move is valid but then reset it for plugins to modify
|
||||
@@ -470,7 +470,7 @@
|
||||
double d3 = this.player.getX();
|
||||
double d4 = this.player.getY();
|
||||
double d5 = this.player.getZ();
|
||||
@@ -965,15 +1226,33 @@
|
||||
@@ -969,15 +1230,33 @@
|
||||
++this.receivedMovePacketCount;
|
||||
int i = this.receivedMovePacketCount - this.knownMovePacketCount;
|
||||
|
||||
@@ -485,7 +485,7 @@
|
||||
i = 1;
|
||||
}
|
||||
|
||||
+ if (packetplayinflying.hasRot || d11 > 0) {
|
||||
+ if (packetplayinflying.hasRot || d10 > 0) {
|
||||
+ allowedPlayerTicks -= 1;
|
||||
+ } else {
|
||||
+ allowedPlayerTicks = 20;
|
||||
@@ -497,35 +497,32 @@
|
||||
+ speed = player.getAbilities().walkingSpeed * 10f;
|
||||
+ }
|
||||
+
|
||||
if (!this.player.isChangingDimension() && (!this.player.getLevel().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) {
|
||||
if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) {
|
||||
float f2 = this.player.isFallFlying() ? 300.0F : 100.0F;
|
||||
|
||||
- if (d11 - d10 > (double) (f2 * (float) i) && !this.isSingleplayerOwner()) {
|
||||
+ if (d11 - d10 > Math.max(f2, Math.pow((double) (10.0F * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
|
||||
- if (d10 - d9 > (double) (f2 * (float) i) && !this.isSingleplayerOwner()) {
|
||||
+ if (d10 - d9 > Math.max(f2, Math.pow((double) (10.0F * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
|
||||
+ // CraftBukkit end
|
||||
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", new Object[]{this.player.getName().getString(), d7, d8, d9});
|
||||
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", new Object[]{this.player.getName().getString(), d6, d7, d8});
|
||||
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot());
|
||||
return;
|
||||
@@ -994,6 +1273,7 @@
|
||||
@@ -998,6 +1277,7 @@
|
||||
boolean flag1 = this.player.verticalCollisionBelow;
|
||||
|
||||
this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9));
|
||||
this.player.move(EnumMoveType.PLAYER, new Vec3D(d6, d7, d8));
|
||||
+ this.player.onGround = packetplayinflying.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move
|
||||
double d12 = d8;
|
||||
double d11 = d7;
|
||||
|
||||
d7 = d0 - this.player.getX();
|
||||
@@ -1013,9 +1293,72 @@
|
||||
d6 = d0 - this.player.getX();
|
||||
@@ -1016,9 +1296,67 @@
|
||||
}
|
||||
|
||||
this.player.absMoveTo(d0, d1, d2, f, f1);
|
||||
if (!this.player.noPhysics && !this.player.isSleeping() && (flag2 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb))) {
|
||||
if (!this.player.noPhysics && !this.player.isSleeping() && (flag2 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb, d0, d1, d2))) {
|
||||
- this.teleport(d3, d4, d5, f, f1);
|
||||
+ this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet()); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet.
|
||||
this.player.doCheckFallDamage(this.player.getY() - d6, packetplayinflying.isOnGround());
|
||||
this.player.doCheckFallDamage(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5, packetplayinflying.isOnGround());
|
||||
} else {
|
||||
+ // CraftBukkit start - fire PlayerMoveEvent
|
||||
+ // Rest to old location first
|
||||
+ this.player.absMoveTo(prevX, prevY, prevZ, prevYaw, prevPitch);
|
||||
+
|
||||
+ Player player = this.getCraftPlayer();
|
||||
+ Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location.
|
||||
+ Location to = player.getLocation().clone(); // Start off the To location as the Players current location.
|
||||
@@ -582,13 +579,11 @@
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ this.player.absMoveTo(d0, d1, d2, f, f1); // Copied from above
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.clientIsFloating = d12 >= -0.03125D && !flag1 && this.player.gameMode.getGameModeForPlayer() != EnumGamemode.SPECTATOR && !this.server.isFlightAllowed() && !this.player.getAbilities().mayfly && !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.isFallFlying() && !this.player.isAutoSpinAttack() && this.noBlocksAround(this.player);
|
||||
this.player.getLevel().getChunkSource().move(this.player);
|
||||
this.player.doCheckFallDamage(this.player.getY() - d6, packetplayinflying.isOnGround());
|
||||
@@ -1054,11 +1397,68 @@
|
||||
this.player.absMoveTo(d0, d1, d2, f, f1);
|
||||
this.clientIsFloating = d11 >= -0.03125D && !flag1 && this.player.gameMode.getGameModeForPlayer() != EnumGamemode.SPECTATOR && !this.server.isFlightAllowed() && !this.player.getAbilities().mayfly && !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.isFallFlying() && !this.player.isAutoSpinAttack() && this.noBlocksAround(this.player);
|
||||
this.player.serverLevel().getChunkSource().move(this.player);
|
||||
@@ -1059,11 +1397,68 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -658,7 +653,7 @@
|
||||
double d3 = set.contains(RelativeMovement.X) ? this.player.getX() : 0.0D;
|
||||
double d4 = set.contains(RelativeMovement.Y) ? this.player.getY() : 0.0D;
|
||||
double d5 = set.contains(RelativeMovement.Z) ? this.player.getZ() : 0.0D;
|
||||
@@ -1070,6 +1470,14 @@
|
||||
@@ -1075,6 +1470,14 @@
|
||||
this.awaitingTeleport = 0;
|
||||
}
|
||||
|
||||
@@ -673,15 +668,15 @@
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
this.player.absMoveTo(d0, d1, d2, f, f1);
|
||||
this.player.connection.send(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport));
|
||||
@@ -1078,6 +1486,7 @@
|
||||
@@ -1083,6 +1486,7 @@
|
||||
@Override
|
||||
public void handlePlayerAction(PacketPlayInBlockDig packetplayinblockdig) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockdig, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockdig, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
BlockPosition blockposition = packetplayinblockdig.getPos();
|
||||
|
||||
this.player.resetLastActionTime();
|
||||
@@ -1088,14 +1497,46 @@
|
||||
@@ -1093,14 +1497,46 @@
|
||||
if (!this.player.isSpectator()) {
|
||||
ItemStack itemstack = this.player.getItemInHand(EnumHand.OFF_HAND);
|
||||
|
||||
@@ -730,15 +725,15 @@
|
||||
this.player.drop(false);
|
||||
}
|
||||
|
||||
@@ -1133,6 +1574,7 @@
|
||||
@@ -1138,6 +1574,7 @@
|
||||
@Override
|
||||
public void handleUseItemOn(PacketPlayInUseItem packetplayinuseitem) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseitem, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseitem, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.player.connection.ackBlockChangesUpTo(packetplayinuseitem.getSequence());
|
||||
WorldServer worldserver = this.player.getLevel();
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
EnumHand enumhand = packetplayinuseitem.getHand();
|
||||
@@ -1156,6 +1598,7 @@
|
||||
@@ -1161,6 +1598,7 @@
|
||||
|
||||
if (blockposition.getY() < i) {
|
||||
if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) {
|
||||
@@ -746,15 +741,15 @@
|
||||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
|
||||
|
||||
if (enumdirection == EnumDirection.UP && !enuminteractionresult.consumesAction() && blockposition.getY() >= i - 1 && wasBlockPlacementAttempt(this.player, itemstack)) {
|
||||
@@ -1184,6 +1627,7 @@
|
||||
@@ -1189,6 +1627,7 @@
|
||||
@Override
|
||||
public void handleUseItem(PacketPlayInBlockPlace packetplayinblockplace) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockplace, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockplace, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.ackBlockChangesUpTo(packetplayinblockplace.getSequence());
|
||||
WorldServer worldserver = this.player.getLevel();
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
EnumHand enumhand = packetplayinblockplace.getHand();
|
||||
@@ -1191,6 +1635,49 @@
|
||||
@@ -1196,6 +1635,49 @@
|
||||
|
||||
this.player.resetLastActionTime();
|
||||
if (!itemstack.isEmpty() && itemstack.isItemEnabled(worldserver.enabledFeatures())) {
|
||||
@@ -775,7 +770,7 @@
|
||||
+ float f8 = f3 * f5;
|
||||
+ double d3 = player.gameMode.getGameModeForPlayer()== EnumGamemode.CREATIVE ? 5.0D : 4.5D;
|
||||
+ Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
|
||||
+ MovingObjectPosition movingobjectposition = this.player.level.clip(new RayTrace(vec3d, vec3d1, RayTrace.BlockCollisionOption.OUTLINE, RayTrace.FluidCollisionOption.NONE, player));
|
||||
+ MovingObjectPosition movingobjectposition = this.player.level().clip(new RayTrace(vec3d, vec3d1, RayTrace.BlockCollisionOption.OUTLINE, RayTrace.FluidCollisionOption.NONE, player));
|
||||
+
|
||||
+ boolean cancelled;
|
||||
+ if (movingobjectposition == null || movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.BLOCK) {
|
||||
@@ -783,7 +778,7 @@
|
||||
+ cancelled = event.useItemInHand() == Event.Result.DENY;
|
||||
+ } else {
|
||||
+ MovingObjectPositionBlock movingobjectpositionblock = (MovingObjectPositionBlock) movingobjectposition;
|
||||
+ if (player.gameMode.firedInteract && player.gameMode.interactPosition.equals(movingobjectpositionblock.getBlockPos()) && player.gameMode.interactHand == enumhand && ItemStack.tagMatches(player.gameMode.interactItemStack, itemstack)) {
|
||||
+ if (player.gameMode.firedInteract && player.gameMode.interactPosition.equals(movingobjectpositionblock.getBlockPos()) && player.gameMode.interactHand == enumhand && ItemStack.isSameItemSameTags(player.gameMode.interactItemStack, itemstack)) {
|
||||
+ cancelled = player.gameMode.interactResult;
|
||||
+ } else {
|
||||
+ org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, true, enumhand);
|
||||
@@ -804,7 +799,7 @@
|
||||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand);
|
||||
|
||||
if (enuminteractionresult.shouldSwing()) {
|
||||
@@ -1211,7 +1698,7 @@
|
||||
@@ -1216,7 +1698,7 @@
|
||||
Entity entity = packetplayinspectate.getEntity(worldserver);
|
||||
|
||||
if (entity != null) {
|
||||
@@ -813,7 +808,7 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1226,6 +1713,7 @@
|
||||
@@ -1231,6 +1713,7 @@
|
||||
PlayerConnection.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
|
||||
this.disconnect(IChatBaseComponent.translatable("multiplayer.requiredTexturePrompt.disconnect"));
|
||||
}
|
||||
@@ -821,7 +816,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -1247,12 +1735,27 @@
|
||||
@@ -1252,12 +1735,27 @@
|
||||
|
||||
@Override
|
||||
public void onDisconnect(IChatBaseComponent ichatbasecomponent) {
|
||||
@@ -850,7 +845,7 @@
|
||||
this.player.getTextFilter().leave();
|
||||
if (this.isSingleplayerOwner()) {
|
||||
PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out");
|
||||
@@ -1275,6 +1778,15 @@
|
||||
@@ -1280,6 +1778,15 @@
|
||||
}
|
||||
|
||||
public void send(Packet<?> packet, @Nullable PacketSendListener packetsendlistener) {
|
||||
@@ -866,10 +861,10 @@
|
||||
try {
|
||||
this.connection.send(packet, packetsendlistener);
|
||||
} catch (Throwable throwable) {
|
||||
@@ -1291,7 +1803,16 @@
|
||||
@@ -1296,7 +1803,16 @@
|
||||
@Override
|
||||
public void handleSetCarriedItem(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinhelditemslot, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinhelditemslot, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
if (packetplayinhelditemslot.getSlot() >= 0 && packetplayinhelditemslot.getSlot() < PlayerInventory.getSelectionSize()) {
|
||||
+ PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getCraftPlayer(), this.player.getInventory().selected, packetplayinhelditemslot.getSlot());
|
||||
@@ -883,7 +878,7 @@
|
||||
if (this.player.getInventory().selected != packetplayinhelditemslot.getSlot() && this.player.getUsedItemHand() == EnumHand.MAIN_HAND) {
|
||||
this.player.stopUsingItem();
|
||||
}
|
||||
@@ -1300,18 +1821,25 @@
|
||||
@@ -1305,18 +1821,25 @@
|
||||
this.player.resetLastActionTime();
|
||||
} else {
|
||||
PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
|
||||
@@ -910,7 +905,7 @@
|
||||
PlayerChatMessage playerchatmessage;
|
||||
|
||||
try {
|
||||
@@ -1329,9 +1857,9 @@
|
||||
@@ -1334,9 +1857,9 @@
|
||||
PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent((IChatBaseComponent) completablefuture1.join()).filter(((FilteredText) completablefuture.join()).mask());
|
||||
|
||||
this.broadcastChatMessage(playerchatmessage1);
|
||||
@@ -922,7 +917,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1346,6 +1874,12 @@
|
||||
@@ -1351,6 +1874,12 @@
|
||||
|
||||
if (optional.isPresent()) {
|
||||
this.server.submit(() -> {
|
||||
@@ -935,7 +930,7 @@
|
||||
this.performChatCommand(serverboundchatcommandpacket, (LastSeenMessages) optional.get());
|
||||
this.detectRateSpam();
|
||||
});
|
||||
@@ -1355,12 +1889,25 @@
|
||||
@@ -1360,12 +1889,25 @@
|
||||
}
|
||||
|
||||
private void performChatCommand(ServerboundChatCommandPacket serverboundchatcommandpacket, LastSeenMessages lastseenmessages) {
|
||||
@@ -963,7 +958,7 @@
|
||||
} catch (SignedMessageChain.a signedmessagechain_a) {
|
||||
this.handleMessageDecodeFailure(signedmessagechain_a);
|
||||
return;
|
||||
@@ -1368,10 +1915,10 @@
|
||||
@@ -1373,10 +1915,10 @@
|
||||
|
||||
CommandSigningContext.a commandsigningcontext_a = new CommandSigningContext.a(map);
|
||||
|
||||
@@ -976,7 +971,7 @@
|
||||
}
|
||||
|
||||
private void handleMessageDecodeFailure(SignedMessageChain.a signedmessagechain_a) {
|
||||
@@ -1412,7 +1959,7 @@
|
||||
@@ -1417,7 +1959,7 @@
|
||||
} else {
|
||||
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(lastseenmessages_b);
|
||||
|
||||
@@ -985,7 +980,7 @@
|
||||
this.send(new ClientboundSystemChatPacket(IChatBaseComponent.translatable("chat.disabled.options").withStyle(EnumChatFormat.RED), false));
|
||||
return Optional.empty();
|
||||
} else {
|
||||
@@ -1460,6 +2007,122 @@
|
||||
@@ -1465,6 +2007,122 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1108,7 +1103,7 @@
|
||||
private PlayerChatMessage getSignedMessage(PacketPlayInChat packetplayinchat, LastSeenMessages lastseenmessages) throws SignedMessageChain.a {
|
||||
SignedMessageBody signedmessagebody = new SignedMessageBody(packetplayinchat.message(), packetplayinchat.timeStamp(), packetplayinchat.salt(), lastseenmessages);
|
||||
|
||||
@@ -1467,13 +2130,33 @@
|
||||
@@ -1472,13 +2130,33 @@
|
||||
}
|
||||
|
||||
private void broadcastChatMessage(PlayerChatMessage playerchatmessage) {
|
||||
@@ -1145,10 +1140,10 @@
|
||||
this.disconnect(IChatBaseComponent.translatable("disconnect.spam"));
|
||||
}
|
||||
|
||||
@@ -1495,13 +2178,59 @@
|
||||
@@ -1500,13 +2178,59 @@
|
||||
@Override
|
||||
public void handleAnimate(PacketPlayInArmAnimation packetplayinarmanimation) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinarmanimation, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinarmanimation, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.player.resetLastActionTime();
|
||||
+ // CraftBukkit start - Raytrace to look for 'rogue armswings'
|
||||
@@ -1157,11 +1152,11 @@
|
||||
+ double d0 = this.player.getX();
|
||||
+ double d1 = this.player.getY() + (double) this.player.getEyeHeight();
|
||||
+ double d2 = this.player.getZ();
|
||||
+ Location origin = new Location(this.player.level.getWorld(), d0, d1, d2, f2, f1);
|
||||
+ Location origin = new Location(this.player.level().getWorld(), d0, d1, d2, f2, f1);
|
||||
+
|
||||
+ double d3 = player.gameMode.getGameModeForPlayer() == EnumGamemode.CREATIVE ? 5.0D : 4.5D;
|
||||
+ // SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time
|
||||
+ org.bukkit.util.RayTraceResult result = this.player.level.getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> entity != this.player.getBukkitEntity() && this.player.getBukkitEntity().canSee(entity));
|
||||
+ org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> entity != this.player.getBukkitEntity() && this.player.getBukkitEntity().canSee(entity));
|
||||
+
|
||||
+ if (result == null) {
|
||||
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), EnumHand.MAIN_HAND);
|
||||
@@ -1178,7 +1173,7 @@
|
||||
|
||||
@Override
|
||||
public void handlePlayerCommand(PacketPlayInEntityAction packetplayinentityaction) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinentityaction, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinentityaction, this, this.player.serverLevel());
|
||||
+ // CraftBukkit start
|
||||
+ if (this.player.isRemoved()) return;
|
||||
+ switch (packetplayinentityaction.getAction()) {
|
||||
@@ -1205,7 +1200,7 @@
|
||||
this.player.resetLastActionTime();
|
||||
Entity entity;
|
||||
IJumpable ijumpable;
|
||||
@@ -1583,6 +2312,12 @@
|
||||
@@ -1588,6 +2312,12 @@
|
||||
}
|
||||
|
||||
public void sendPlayerChatMessage(PlayerChatMessage playerchatmessage, ChatMessageType.a chatmessagetype_a) {
|
||||
@@ -1215,18 +1210,18 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.send(new ClientboundPlayerChatPacket(playerchatmessage.link().sender(), playerchatmessage.link().index(), playerchatmessage.signature(), playerchatmessage.signedBody().pack(this.messageSignatureCache), playerchatmessage.unsignedContent(), playerchatmessage.filterMask(), chatmessagetype_a.toNetwork(this.player.level.registryAccess())));
|
||||
this.send(new ClientboundPlayerChatPacket(playerchatmessage.link().sender(), playerchatmessage.link().index(), playerchatmessage.signature(), playerchatmessage.signedBody().pack(this.messageSignatureCache), playerchatmessage.unsignedContent(), playerchatmessage.filterMask(), chatmessagetype_a.toNetwork(this.player.level().registryAccess())));
|
||||
this.addPendingMessage(playerchatmessage);
|
||||
}
|
||||
@@ -1598,6 +2333,7 @@
|
||||
@@ -1603,6 +2333,7 @@
|
||||
@Override
|
||||
public void handleInteract(PacketPlayInUseEntity packetplayinuseentity) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseentity, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseentity, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
final WorldServer worldserver = this.player.getLevel();
|
||||
final WorldServer worldserver = this.player.serverLevel();
|
||||
final Entity entity = packetplayinuseentity.getTarget(worldserver);
|
||||
|
||||
@@ -1612,13 +2348,51 @@
|
||||
@@ -1617,13 +2348,51 @@
|
||||
|
||||
if (axisalignedbb.distanceToSqr(this.player.getEyePosition()) < PlayerConnection.MAX_INTERACTION_DISTANCE) {
|
||||
packetplayinuseentity.dispatch(new PacketPlayInUseEntity.c() {
|
||||
@@ -1279,7 +1274,7 @@
|
||||
if (enuminteractionresult.consumesAction()) {
|
||||
CriterionTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(PlayerConnection.this.player, itemstack1, entity);
|
||||
if (enuminteractionresult.shouldSwing()) {
|
||||
@@ -1631,23 +2405,29 @@
|
||||
@@ -1636,23 +2405,29 @@
|
||||
|
||||
@Override
|
||||
public void onInteraction(EnumHand enumhand) {
|
||||
@@ -1312,7 +1307,7 @@
|
||||
}
|
||||
} else {
|
||||
PlayerConnection.this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.invalid_entity_attacked"));
|
||||
@@ -1670,14 +2450,14 @@
|
||||
@@ -1675,14 +2450,14 @@
|
||||
case PERFORM_RESPAWN:
|
||||
if (this.player.wonGame) {
|
||||
this.player.wonGame = false;
|
||||
@@ -1328,11 +1323,11 @@
|
||||
+ this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH);
|
||||
if (this.server.isHardcore()) {
|
||||
this.player.setGameMode(EnumGamemode.SPECTATOR);
|
||||
((GameRules.GameRuleBoolean) this.player.getLevel().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server);
|
||||
@@ -1693,15 +2473,21 @@
|
||||
((GameRules.GameRuleBoolean) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server);
|
||||
@@ -1698,15 +2473,21 @@
|
||||
@Override
|
||||
public void handleContainerClose(PacketPlayInCloseWindow packetplayinclosewindow) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinclosewindow, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinclosewindow, this, this.player.serverLevel());
|
||||
+
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
+ CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit
|
||||
@@ -1342,7 +1337,7 @@
|
||||
|
||||
@Override
|
||||
public void handleContainerClick(PacketPlayInWindowClick packetplayinwindowclick) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinwindowclick, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinwindowclick, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.player.resetLastActionTime();
|
||||
- if (this.player.containerMenu.containerId == packetplayinwindowclick.getContainerId()) {
|
||||
@@ -1353,7 +1348,7 @@
|
||||
this.player.containerMenu.sendAllDataToRemote();
|
||||
} else if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
|
||||
@@ -1714,7 +2500,284 @@
|
||||
@@ -1719,7 +2500,284 @@
|
||||
boolean flag = packetplayinwindowclick.getStateId() != this.player.containerMenu.getStateId();
|
||||
|
||||
this.player.containerMenu.suppressRemoteUpdates();
|
||||
@@ -1400,7 +1395,7 @@
|
||||
+ if (cursor.isEmpty()) {
|
||||
+ action = packetplayinwindowclick.getButtonNum() == 0 ? InventoryAction.PICKUP_ALL : InventoryAction.PICKUP_HALF;
|
||||
+ } else if (slot.mayPlace(cursor)) {
|
||||
+ if (clickedItem.sameItem(cursor) && ItemStack.tagMatches(clickedItem, cursor)) {
|
||||
+ if (ItemStack.isSameItemSameTags(clickedItem, cursor)) {
|
||||
+ int toPlace = packetplayinwindowclick.getButtonNum() == 0 ? cursor.getCount() : 1;
|
||||
+ toPlace = Math.min(toPlace, clickedItem.getMaxStackSize() - clickedItem.getCount());
|
||||
+ toPlace = Math.min(toPlace, slot.container.getMaxStackSize() - clickedItem.getCount());
|
||||
@@ -1416,7 +1411,7 @@
|
||||
+ } else if (cursor.getCount() <= slot.getMaxStackSize()) {
|
||||
+ action = InventoryAction.SWAP_WITH_CURSOR;
|
||||
+ }
|
||||
+ } else if (cursor.getItem() == clickedItem.getItem() && ItemStack.tagMatches(cursor, clickedItem)) {
|
||||
+ } else if (ItemStack.isSameItemSameTags(cursor, clickedItem)) {
|
||||
+ if (clickedItem.getCount() >= 0) {
|
||||
+ if (clickedItem.getCount() + cursor.getCount() <= cursor.getMaxStackSize()) {
|
||||
+ // As of 1.5, this is result slots only
|
||||
@@ -1639,15 +1634,15 @@
|
||||
ObjectIterator objectiterator = Int2ObjectMaps.fastIterable(packetplayinwindowclick.getChangedSlots()).iterator();
|
||||
|
||||
while (objectiterator.hasNext()) {
|
||||
@@ -1754,6 +2817,7 @@
|
||||
@@ -1759,6 +2817,7 @@
|
||||
@Override
|
||||
public void handleContainerButtonClick(PacketPlayInEnchantItem packetplayinenchantitem) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinenchantitem, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinenchantitem, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.player.resetLastActionTime();
|
||||
if (this.player.containerMenu.containerId == packetplayinenchantitem.getContainerId() && !this.player.isSpectator()) {
|
||||
if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
@@ -1796,6 +2860,43 @@
|
||||
@@ -1801,6 +2860,43 @@
|
||||
|
||||
boolean flag1 = packetplayinsetcreativeslot.getSlotNum() >= 1 && packetplayinsetcreativeslot.getSlotNum() <= 45;
|
||||
boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
|
||||
@@ -1691,66 +1686,26 @@
|
||||
|
||||
if (flag1 && flag2) {
|
||||
this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.getSlotNum()).setByPlayer(itemstack);
|
||||
@@ -1818,6 +2919,7 @@
|
||||
@@ -1823,6 +2919,7 @@
|
||||
}
|
||||
|
||||
private void updateSignText(PacketPlayInUpdateSign packetplayinupdatesign, List<FilteredText> list) {
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.player.resetLastActionTime();
|
||||
WorldServer worldserver = this.player.getLevel();
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
BlockPosition blockposition = packetplayinupdatesign.getPos();
|
||||
@@ -1834,18 +2936,37 @@
|
||||
|
||||
if (!tileentitysign.isEditable() || !this.player.getUUID().equals(tileentitysign.getPlayerWhoMayEdit())) {
|
||||
PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString());
|
||||
+ this.send(tileentity.getUpdatePacket()); // CraftBukkit
|
||||
return;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ Player player = this.player.getBukkitEntity();
|
||||
+ int x = packetplayinupdatesign.getPos().getX();
|
||||
+ int y = packetplayinupdatesign.getPos().getY();
|
||||
+ int z = packetplayinupdatesign.getPos().getZ();
|
||||
+ String[] lines = new String[4];
|
||||
+
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
FilteredText filteredtext = (FilteredText) list.get(i);
|
||||
|
||||
if (this.player.isTextFilteringEnabled()) {
|
||||
- tileentitysign.setMessage(i, IChatBaseComponent.literal(filteredtext.filteredOrEmpty()));
|
||||
+ lines[i] = EnumChatFormat.stripFormatting(filteredtext.filteredOrEmpty());
|
||||
} else {
|
||||
- tileentitysign.setMessage(i, IChatBaseComponent.literal(filteredtext.raw()), IChatBaseComponent.literal(filteredtext.filteredOrEmpty()));
|
||||
+ lines[i] = EnumChatFormat.stripFormatting(filteredtext.raw());
|
||||
+ }
|
||||
+ }
|
||||
+ SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines);
|
||||
+ this.cserver.getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ IChatBaseComponent[] components = org.bukkit.craftbukkit.block.CraftSign.sanitizeLines(event.getLines());
|
||||
+ for (int i = 0; i < components.length; i++) {
|
||||
+ tileentitysign.setMessage(i, components[i]);
|
||||
}
|
||||
+ tileentitysign.isEditable = false;
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
tileentitysign.setChanged();
|
||||
worldserver.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3);
|
||||
@@ -1855,6 +2976,7 @@
|
||||
@@ -1843,6 +2940,7 @@
|
||||
|
||||
@Override
|
||||
public void handleKeepAlive(PacketPlayInKeepAlive packetplayinkeepalive) {
|
||||
+ PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinkeepalive, this, this.player.getLevel()); // CraftBukkit
|
||||
+ PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinkeepalive, this, this.player.serverLevel()); // CraftBukkit
|
||||
if (this.keepAlivePending && packetplayinkeepalive.getId() == this.keepAliveChallenge) {
|
||||
int i = (int) (SystemUtils.getMillis() - this.keepAliveTime);
|
||||
|
||||
@@ -1869,7 +2991,17 @@
|
||||
@@ -1857,7 +2955,17 @@
|
||||
@Override
|
||||
public void handlePlayerAbilities(PacketPlayInAbilities packetplayinabilities) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinabilities, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinabilities, this, this.player.serverLevel());
|
||||
- this.player.getAbilities().flying = packetplayinabilities.isFlying() && this.player.getAbilities().mayfly;
|
||||
+ // CraftBukkit start
|
||||
+ if (this.player.getAbilities().mayfly && this.player.getAbilities().flying != packetplayinabilities.isFlying()) {
|
||||
@@ -1766,7 +1721,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1878,8 +3010,50 @@
|
||||
@@ -1866,8 +2974,50 @@
|
||||
this.player.updateOptions(packetplayinsettings);
|
||||
}
|
||||
|
||||
@@ -1778,7 +1733,7 @@
|
||||
+
|
||||
+ @Override
|
||||
+ public void handleCustomPayload(PacketPlayInCustomPayload packetplayincustompayload) {
|
||||
+ PlayerConnectionUtils.ensureRunningOnSameThread(packetplayincustompayload, this, this.player.getLevel());
|
||||
+ PlayerConnectionUtils.ensureRunningOnSameThread(packetplayincustompayload, this, this.player.serverLevel());
|
||||
+ if (packetplayincustompayload.identifier.equals(CUSTOM_REGISTER)) {
|
||||
+ try {
|
||||
+ String channels = packetplayincustompayload.data.toString(com.google.common.base.Charsets.UTF_8);
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
--- a/net/minecraft/server/packs/repository/ResourcePackLoader.java
|
||||
+++ b/net/minecraft/server/packs/repository/ResourcePackLoader.java
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private final String id;
|
||||
- private final ResourcePackLoader.c resources;
|
||||
+ public final ResourcePackLoader.c resources; // PAIL private -> public
|
||||
private final IChatBaseComponent title;
|
||||
private final IChatBaseComponent description;
|
||||
private final EnumResourcePackVersion compatibility;
|
||||
@@ -59,7 +59,7 @@
|
||||
try {
|
||||
IResourcePack iresourcepack = resourcepackloader_c.open(s);
|
||||
|
||||
- ResourcePackLoader.a resourcepackloader_a;
|
||||
+ ResourcePackLoader.a resourcepackloader_a = null; // CraftBukkit - decompile fix
|
||||
label53:
|
||||
{
|
||||
FeatureFlagsMetadataSection featureflagsmetadatasection;
|
||||
@@ -93,7 +93,7 @@
|
||||
iresourcepack.close();
|
||||
}
|
||||
|
||||
- return featureflagsmetadatasection;
|
||||
+ return resourcepackloader_a; // CraftBukkit - decompile fix
|
||||
}
|
||||
|
||||
if (iresourcepack != null) {
|
||||
@@ -73,8 +73,8 @@
|
||||
this.server = minecraftserver;
|
||||
this.registries = layeredregistryaccess;
|
||||
this.synchronizedRegistries = (new IRegistryCustom.c(RegistrySynchronization.networkedRegistries(layeredregistryaccess))).freeze();
|
||||
@@ -161,9 +193,15 @@
|
||||
usercache.add(gameprofile);
|
||||
@@ -168,9 +200,15 @@
|
||||
|
||||
NBTTagCompound nbttagcompound = this.load(entityplayer);
|
||||
ResourceKey resourcekey;
|
||||
+ // CraftBukkit start - Better rename detection
|
||||
@@ -90,7 +90,7 @@
|
||||
Logger logger = PlayerList.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -190,7 +228,8 @@
|
||||
@@ -197,7 +235,8 @@
|
||||
s1 = networkmanager.getRemoteAddress().toString();
|
||||
}
|
||||
|
||||
@@ -100,15 +100,15 @@
|
||||
WorldData worlddata = worldserver1.getLevelData();
|
||||
|
||||
entityplayer.loadGameTypes(nbttagcompound);
|
||||
@@ -200,6 +239,7 @@
|
||||
@@ -207,6 +246,7 @@
|
||||
boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO);
|
||||
|
||||
playerconnection.send(new PacketPlayOutLogin(entityplayer.getId(), worlddata.isHardcore(), entityplayer.gameMode.getGameModeForPlayer(), entityplayer.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.synchronizedRegistries, worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), this.viewDistance, this.simulationDistance, flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat(), entityplayer.getLastDeathLocation()));
|
||||
playerconnection.send(new PacketPlayOutLogin(entityplayer.getId(), worlddata.isHardcore(), entityplayer.gameMode.getGameModeForPlayer(), entityplayer.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.synchronizedRegistries, worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), this.viewDistance, this.simulationDistance, flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat(), entityplayer.getLastDeathLocation(), entityplayer.getPortalCooldown()));
|
||||
+ entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
|
||||
playerconnection.send(new ClientboundUpdateEnabledFeaturesPacket(FeatureFlags.REGISTRY.toNames(worldserver1.enabledFeatures())));
|
||||
playerconnection.send(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.BRAND, (new PacketDataSerializer(Unpooled.buffer())).writeUtf(this.getServer().getServerModName())));
|
||||
playerconnection.send(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
@@ -219,8 +259,10 @@
|
||||
@@ -226,8 +266,10 @@
|
||||
} else {
|
||||
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.player.joined.renamed", entityplayer.getDisplayName(), s);
|
||||
}
|
||||
@@ -120,7 +120,7 @@
|
||||
playerconnection.teleport(entityplayer.getX(), entityplayer.getY(), entityplayer.getZ(), entityplayer.getYRot(), entityplayer.getXRot());
|
||||
ServerPing serverping = this.server.getStatus();
|
||||
|
||||
@@ -231,10 +273,61 @@
|
||||
@@ -238,10 +280,61 @@
|
||||
entityplayer.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players));
|
||||
this.players.add(entityplayer);
|
||||
this.playersByUUID.put(entityplayer.getUUID(), entityplayer);
|
||||
@@ -175,17 +175,17 @@
|
||||
- this.server.getCustomBossEvents().onPlayerConnect(entityplayer);
|
||||
+
|
||||
+ // CraftBukkit start - Only add if the player wasn't moved in the event
|
||||
+ if (entityplayer.level == worldserver1 && !worldserver1.players().contains(entityplayer)) {
|
||||
+ if (entityplayer.level() == worldserver1 && !worldserver1.players().contains(entityplayer)) {
|
||||
+ worldserver1.addNewPlayer(entityplayer);
|
||||
+ this.server.getCustomBossEvents().onPlayerConnect(entityplayer);
|
||||
+ }
|
||||
+
|
||||
+ worldserver1 = entityplayer.getLevel(); // CraftBukkit - Update in case join event changed it
|
||||
+ worldserver1 = entityplayer.serverLevel(); // CraftBukkit - Update in case join event changed it
|
||||
+ // CraftBukkit end
|
||||
this.server.getServerResourcePack().ifPresent((minecraftserver_serverresourcepackinfo) -> {
|
||||
entityplayer.sendTexturePack(minecraftserver_serverresourcepackinfo.url(), minecraftserver_serverresourcepackinfo.hash(), minecraftserver_serverresourcepackinfo.isRequired(), minecraftserver_serverresourcepackinfo.prompt());
|
||||
});
|
||||
@@ -248,8 +341,11 @@
|
||||
@@ -255,8 +348,11 @@
|
||||
|
||||
if (nbttagcompound != null && nbttagcompound.contains("RootVehicle", 10)) {
|
||||
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
|
||||
@@ -199,7 +199,7 @@
|
||||
});
|
||||
|
||||
if (entity != null) {
|
||||
@@ -292,6 +388,8 @@
|
||||
@@ -299,6 +395,8 @@
|
||||
}
|
||||
|
||||
entityplayer.initInventoryMenu();
|
||||
@@ -208,7 +208,7 @@
|
||||
}
|
||||
|
||||
public void updateEntireScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) {
|
||||
@@ -324,30 +422,31 @@
|
||||
@@ -331,30 +429,31 @@
|
||||
}
|
||||
|
||||
public void addWorldborderListener(WorldServer worldserver) {
|
||||
@@ -245,7 +245,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -375,14 +474,15 @@
|
||||
@@ -382,14 +481,15 @@
|
||||
}
|
||||
|
||||
protected void save(EntityPlayer entityplayer) {
|
||||
@@ -263,13 +263,13 @@
|
||||
|
||||
if (advancementdataplayer != null) {
|
||||
advancementdataplayer.save();
|
||||
@@ -390,10 +490,24 @@
|
||||
@@ -397,10 +497,24 @@
|
||||
|
||||
}
|
||||
|
||||
- public void remove(EntityPlayer entityplayer) {
|
||||
+ public String remove(EntityPlayer entityplayer) { // CraftBukkit - return string
|
||||
WorldServer worldserver = entityplayer.getLevel();
|
||||
WorldServer worldserver = entityplayer.serverLevel();
|
||||
|
||||
entityplayer.awardStat(StatisticList.LEAVE_GAME);
|
||||
+
|
||||
@@ -289,7 +289,7 @@
|
||||
this.save(entityplayer);
|
||||
if (entityplayer.isPassenger()) {
|
||||
Entity entity = entityplayer.getRootVehicle();
|
||||
@@ -417,18 +531,66 @@
|
||||
@@ -424,18 +538,66 @@
|
||||
|
||||
if (entityplayer1 == entityplayer) {
|
||||
this.playersByUUID.remove(uuid);
|
||||
@@ -362,7 +362,7 @@
|
||||
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.bans.get(gameprofile);
|
||||
|
||||
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.disconnect.banned.reason", gameprofilebanentry.getReason());
|
||||
@@ -436,10 +598,12 @@
|
||||
@@ -443,10 +605,12 @@
|
||||
ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned.expiration", PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires())));
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@
|
||||
IpBanEntry ipbanentry = this.ipBans.get(socketaddress);
|
||||
|
||||
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.reason", ipbanentry.getReason());
|
||||
@@ -447,13 +611,25 @@
|
||||
@@ -454,13 +618,25 @@
|
||||
ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.expiration", PlayerList.BAN_DATE_FORMAT.format(ipbanentry.getExpires())));
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@
|
||||
UUID uuid = UUIDUtil.getOrCreatePlayerUUID(gameprofile);
|
||||
List<EntityPlayer> list = Lists.newArrayList();
|
||||
|
||||
@@ -480,14 +656,24 @@
|
||||
@@ -487,14 +663,24 @@
|
||||
}
|
||||
|
||||
return new EntityPlayer(this.server, this.server.overworld(), gameprofile);
|
||||
@@ -425,7 +425,7 @@
|
||||
+ public EntityPlayer respawn(EntityPlayer entityplayer, WorldServer worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason) {
|
||||
+ entityplayer.stopRiding(); // CraftBukkit
|
||||
this.players.remove(entityplayer);
|
||||
entityplayer.getLevel().removePlayerImmediately(entityplayer, Entity.RemovalReason.DISCARDED);
|
||||
entityplayer.serverLevel().removePlayerImmediately(entityplayer, Entity.RemovalReason.DISCARDED);
|
||||
BlockPosition blockposition = entityplayer.getRespawnPosition();
|
||||
float f = entityplayer.getRespawnAngle();
|
||||
boolean flag1 = entityplayer.isRespawnForced();
|
||||
@@ -433,7 +433,7 @@
|
||||
WorldServer worldserver = this.server.getLevel(entityplayer.getRespawnDimension());
|
||||
Optional optional;
|
||||
|
||||
@@ -499,6 +685,11 @@
|
||||
@@ -506,6 +692,11 @@
|
||||
|
||||
WorldServer worldserver1 = worldserver != null && optional.isPresent() ? worldserver : this.server.overworld();
|
||||
EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getGameProfile());
|
||||
@@ -445,7 +445,7 @@
|
||||
|
||||
entityplayer1.connection = entityplayer.connection;
|
||||
entityplayer1.restoreFrom(entityplayer, flag);
|
||||
@@ -514,50 +705,112 @@
|
||||
@@ -521,50 +712,112 @@
|
||||
|
||||
boolean flag2 = false;
|
||||
|
||||
@@ -526,16 +526,16 @@
|
||||
}
|
||||
|
||||
int i = flag ? 1 : 0;
|
||||
- WorldData worlddata = entityplayer1.level.getLevelData();
|
||||
- WorldData worlddata = entityplayer1.level().getLevelData();
|
||||
+ // CraftBukkit start
|
||||
+ WorldData worlddata = worldserver1.getLevelData();
|
||||
+ entityplayer1.connection.send(new PacketPlayOutRespawn(worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), (byte) i, entityplayer1.getLastDeathLocation()));
|
||||
+ entityplayer1.connection.send(new PacketPlayOutRespawn(worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), (byte) i, entityplayer1.getLastDeathLocation(), entityplayer1.getPortalCooldown()));
|
||||
+ entityplayer1.spawnIn(worldserver1);
|
||||
+ entityplayer1.unsetRemoved();
|
||||
+ entityplayer1.connection.teleport(CraftLocation.toBukkit(entityplayer1.position(), worldserver1.getWorld(), entityplayer1.getYRot(), entityplayer1.getXRot()));
|
||||
+ entityplayer1.setShiftKeyDown(false);
|
||||
|
||||
- entityplayer1.connection.send(new PacketPlayOutRespawn(entityplayer1.level.dimensionTypeId(), entityplayer1.level.dimension(), BiomeManager.obfuscateSeed(entityplayer1.getLevel().getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), entityplayer1.getLevel().isDebug(), entityplayer1.getLevel().isFlat(), (byte) i, entityplayer1.getLastDeathLocation()));
|
||||
- entityplayer1.connection.send(new PacketPlayOutRespawn(entityplayer1.level().dimensionTypeId(), entityplayer1.level().dimension(), BiomeManager.obfuscateSeed(entityplayer1.serverLevel().getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), entityplayer1.level().isDebug(), entityplayer1.serverLevel().isFlat(), (byte) i, entityplayer1.getLastDeathLocation(), entityplayer1.getPortalCooldown()));
|
||||
- entityplayer1.connection.teleport(entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
|
||||
+ // entityplayer1.connection.teleport(entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
|
||||
entityplayer1.connection.send(new PacketPlayOutSpawnPosition(worldserver1.getSharedSpawnPos(), worldserver1.getSharedSpawnAngle()));
|
||||
@@ -581,7 +581,7 @@
|
||||
return entityplayer1;
|
||||
}
|
||||
|
||||
@@ -570,7 +823,18 @@
|
||||
@@ -577,7 +830,18 @@
|
||||
|
||||
public void tick() {
|
||||
if (++this.sendAllPlayerInfoIn > 600) {
|
||||
@@ -601,7 +601,7 @@
|
||||
this.sendAllPlayerInfoIn = 0;
|
||||
}
|
||||
|
||||
@@ -587,6 +851,25 @@
|
||||
@@ -594,6 +858,25 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -627,7 +627,7 @@
|
||||
public void broadcastAll(Packet<?> packet, ResourceKey<World> resourcekey) {
|
||||
Iterator iterator = this.players.iterator();
|
||||
|
||||
@@ -665,7 +948,7 @@
|
||||
@@ -672,7 +955,7 @@
|
||||
}
|
||||
|
||||
public void deop(GameProfile gameprofile) {
|
||||
@@ -636,7 +636,7 @@
|
||||
EntityPlayer entityplayer = this.getPlayer(gameprofile.getId());
|
||||
|
||||
if (entityplayer != null) {
|
||||
@@ -689,6 +972,7 @@
|
||||
@@ -696,6 +979,7 @@
|
||||
entityplayer.connection.send(new PacketPlayOutEntityStatus(entityplayer, b0));
|
||||
}
|
||||
|
||||
@@ -644,7 +644,7 @@
|
||||
this.server.getCommands().sendCommands(entityplayer);
|
||||
}
|
||||
|
||||
@@ -721,6 +1005,12 @@
|
||||
@@ -728,6 +1012,12 @@
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
|
||||
|
||||
@@ -654,15 +654,15 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (entityplayer != entityhuman && entityplayer.level.dimension() == resourcekey) {
|
||||
if (entityplayer != entityhuman && entityplayer.level().dimension() == resourcekey) {
|
||||
double d4 = d0 - entityplayer.getX();
|
||||
double d5 = d1 - entityplayer.getY();
|
||||
@@ -760,23 +1050,35 @@
|
||||
@@ -767,23 +1057,35 @@
|
||||
public void reloadWhiteList() {}
|
||||
|
||||
public void sendLevelInfo(EntityPlayer entityplayer, WorldServer worldserver) {
|
||||
- WorldBorder worldborder = this.server.overworld().getWorldBorder();
|
||||
+ WorldBorder worldborder = entityplayer.level.getWorldBorder(); // CraftBukkit
|
||||
+ WorldBorder worldborder = entityplayer.level().getWorldBorder(); // CraftBukkit
|
||||
|
||||
entityplayer.connection.send(new ClientboundInitializeBorderPacket(worldborder));
|
||||
entityplayer.connection.send(new PacketPlayOutUpdateTime(worldserver.getGameTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)));
|
||||
@@ -690,15 +690,15 @@
|
||||
+ entityplayer.getEntityData().refresh(entityplayer); // CraftBukkkit - SPIGOT-7218: sync metadata
|
||||
entityplayer.connection.send(new PacketPlayOutHeldItemSlot(entityplayer.getInventory().selected));
|
||||
+ // CraftBukkit start - from GameRules
|
||||
+ int i = entityplayer.level.getGameRules().getBoolean(GameRules.RULE_REDUCEDDEBUGINFO) ? 22 : 23;
|
||||
+ int i = entityplayer.level().getGameRules().getBoolean(GameRules.RULE_REDUCEDDEBUGINFO) ? 22 : 23;
|
||||
+ entityplayer.connection.send(new PacketPlayOutEntityStatus(entityplayer, (byte) i));
|
||||
+ float immediateRespawn = entityplayer.level.getGameRules().getBoolean(GameRules.RULE_DO_IMMEDIATE_RESPAWN) ? 1.0F: 0.0F;
|
||||
+ float immediateRespawn = entityplayer.level().getGameRules().getBoolean(GameRules.RULE_DO_IMMEDIATE_RESPAWN) ? 1.0F: 0.0F;
|
||||
+ entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.IMMEDIATE_RESPAWN, immediateRespawn));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public int getPlayerCount() {
|
||||
@@ -832,12 +1134,22 @@
|
||||
@@ -839,12 +1141,22 @@
|
||||
}
|
||||
|
||||
public void removeAll() {
|
||||
@@ -723,7 +723,7 @@
|
||||
public void broadcastSystemMessage(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
||||
this.broadcastSystemMessage(ichatbasecomponent, (entityplayer) -> {
|
||||
return ichatbasecomponent;
|
||||
@@ -895,16 +1207,23 @@
|
||||
@@ -902,16 +1214,23 @@
|
||||
return playerchatmessage.hasSignature() && !playerchatmessage.hasExpiredServer(Instant.now());
|
||||
}
|
||||
|
||||
@@ -751,7 +751,7 @@
|
||||
Path path = file2.toPath();
|
||||
|
||||
if (FileUtils.isPathNormalized(path) && FileUtils.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) {
|
||||
@@ -913,7 +1232,7 @@
|
||||
@@ -920,7 +1239,7 @@
|
||||
}
|
||||
|
||||
serverstatisticmanager = new ServerStatisticManager(this.server, file1);
|
||||
@@ -760,7 +760,7 @@
|
||||
}
|
||||
|
||||
return serverstatisticmanager;
|
||||
@@ -921,13 +1240,13 @@
|
||||
@@ -928,13 +1247,13 @@
|
||||
|
||||
public AdvancementDataPlayer getPlayerAdvancements(EntityPlayer entityplayer) {
|
||||
UUID uuid = entityplayer.getUUID();
|
||||
@@ -776,7 +776,7 @@
|
||||
}
|
||||
|
||||
advancementdataplayer.setPlayer(entityplayer);
|
||||
@@ -978,13 +1297,20 @@
|
||||
@@ -985,13 +1304,20 @@
|
||||
}
|
||||
|
||||
public void reloadResources() {
|
||||
|
||||
Reference in New Issue
Block a user