Patch reset
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
group=com.lokamc.slice
|
||||
version=1.17.1-R0.1-SNAPSHOT
|
||||
group=com.example.paperfork
|
||||
version=1.18-R0.1-SNAPSHOT
|
||||
|
||||
mcVersion=1.17.1
|
||||
paperRef=61a09c51023c53997c31ef24849a99262f7ddaf0
|
||||
mcVersion=1.18
|
||||
paperRef=7f65b0b589cf3d3da81925e4dd09d967ba6b0b6c
|
||||
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 21 Sep 2021 08:33:45 -0500
|
||||
Subject: [PATCH] Add PlayerShieldDisableEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f0f3a57a0ce76b4736219c6ece52b8bc47a7a4ec
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java
|
||||
@@ -0,0 +1,50 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown whenever a Player's shield is disabled
|
||||
+ */
|
||||
+public class PlayerShieldDisableEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final Entity damager;
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ public PlayerShieldDisableEvent(@NotNull final Player player, @Nullable final Entity damager) {
|
||||
+ super(player);
|
||||
+ this.damager = damager;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public Entity getDamager() {
|
||||
+ return damager;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ }
|
||||
+}
|
||||
@@ -1,58 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 21 Sep 2021 15:20:16 -0500
|
||||
Subject: [PATCH] Multiple Entries with Scoreboards
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
index d5b39fb4fc16a342b5661e08df1506858168d20d..9ec00b045fe85701ce29c0ad10eb9921733107b3 100644
|
||||
--- a/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.scoreboard;
|
||||
|
||||
+import java.util.Collection; // Paper
|
||||
import java.util.Set;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@@ -317,6 +318,20 @@ public interface Team {
|
||||
*/
|
||||
void addEntry(@NotNull String entry) throws IllegalStateException, IllegalArgumentException;
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * This puts a collection of entries onto this team for the scoreboard which results in one
|
||||
+ * packet for the updates rather than a packet-per-entry.
|
||||
+ * <p>
|
||||
+ * Entries on other teams will be removed from their respective teams.
|
||||
+ *
|
||||
+ * @param entries the entries to add
|
||||
+ * @throws IllegalArgumentException if entries are null
|
||||
+ * @throws IllegalStateException if this team has been unregistered
|
||||
+ */
|
||||
+ void addEntries(@NotNull Collection<String> entries) throws IllegalStateException, IllegalArgumentException;
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Removes the player from this team.
|
||||
*
|
||||
@@ -340,6 +355,19 @@ public interface Team {
|
||||
*/
|
||||
boolean removeEntry(@NotNull String entry) throws IllegalStateException, IllegalArgumentException;
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Removes a collection of entries from this team which results in one
|
||||
+ * packet for the updates rather than a packet-per-entry.
|
||||
+ *
|
||||
+ * @param entries the entries to remove
|
||||
+ * @return if any of the entries were a part of this team
|
||||
+ * @throws IllegalArgumentException if entry is null
|
||||
+ * @throws IllegalStateException if this team has been unregistered
|
||||
+ */
|
||||
+ boolean removeEntries(@NotNull Collection<String> entries) throws IllegalStateException, IllegalArgumentException;
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Unregisters this team from the Scoreboard
|
||||
*
|
||||
@@ -1,39 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Wed, 22 Sep 2021 09:41:27 -0500
|
||||
Subject: [PATCH] Set BlockData without light update
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index ad8bce01ba459a036cd4ebbbe4fc974021924fe2..6ef43ae39a8ad4ed0e9a7bf68c17840576e235ea 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -287,6 +287,28 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
|
||||
*/
|
||||
void setBlockData(@NotNull BlockData data, boolean applyPhysics);
|
||||
|
||||
+ /**
|
||||
+ * Sets the complete data for this block
|
||||
+ *
|
||||
+ * <br>
|
||||
+ * Note that applyPhysics = false is not in general safe. It should only be
|
||||
+ * used when you need to avoid triggering a physics update of neighboring
|
||||
+ * blocks, for example when creating a {@link Bisected} block. If you are
|
||||
+ * using a custom populator, then this parameter may also be required to
|
||||
+ * prevent triggering infinite chunk loads on border blocks. This method
|
||||
+ * should NOT be used to "hack" physics by placing blocks in impossible
|
||||
+ * locations. Such blocks are liable to be removed on various events such as
|
||||
+ * world upgrades. Furthermore setting large amounts of such blocks in close
|
||||
+ * proximity may overload the server physics engine if an update is
|
||||
+ * triggered at a later point. If this occurs, the resulting behavior is
|
||||
+ * undefined.
|
||||
+ *
|
||||
+ * @param data new block specific data
|
||||
+ * @param applyPhysics false to cancel physics from the changed block
|
||||
+ * @param checkLight false to prevent a light-check update
|
||||
+ */
|
||||
+ void setBlockData(@NotNull BlockData data, boolean applyPhysics, boolean checkLight);
|
||||
+
|
||||
/**
|
||||
* Sets the type of this block
|
||||
*
|
||||
@@ -1,79 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 26 Sep 2021 09:00:51 -0500
|
||||
Subject: [PATCH] Add BlockDestroyedByNeighborEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BlockDestroyedByNeighborEvent.java b/src/main/java/io/papermc/paper/event/block/BlockDestroyedByNeighborEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7db2789d54a609b023ea6deff87b45d717aabbf0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BlockDestroyedByNeighborEvent.java
|
||||
@@ -0,0 +1,67 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a block is broken another block. This is generally the result of BlockPhysicsEvent propagation
|
||||
+ */
|
||||
+public class BlockDestroyedByNeighborEvent extends BlockEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final Player player;
|
||||
+ private final Block sourceBlock;
|
||||
+ private boolean cancel;
|
||||
+
|
||||
+ public BlockDestroyedByNeighborEvent(@NotNull final Block theBlock, @Nullable Player player, @NotNull final Block sourceBlock) {
|
||||
+ super(theBlock);
|
||||
+
|
||||
+ this.player = player;
|
||||
+ this.sourceBlock = sourceBlock;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the Player that caused this
|
||||
+ *
|
||||
+ * @return The Player that is breaking the block involved in this event
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Player getPlayer() {
|
||||
+ return player;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the source block that caused this block break
|
||||
+ *
|
||||
+ * @return The Source Block which block is involved in this event
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public final Block getSourceBlock() {
|
||||
+ return sourceBlock;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
@@ -1,52 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Sun, 26 Sep 2021 16:36:29 -0500
|
||||
Subject: [PATCH] Add Player to SpongeAbsorbEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java b/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java
|
||||
index 7029cfcd00ed5d9c7f06898ec2b81238ec775a70..0e2f21e0f1983d2e8b67deebf4d12d25107d1582 100644
|
||||
--- a/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.block.BlockState;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable; // Paper
|
||||
|
||||
/**
|
||||
* Called when a sponge absorbs water from the world.
|
||||
@@ -21,11 +22,13 @@ public class SpongeAbsorbEvent extends BlockEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
+ private final org.bukkit.entity.Player player; // Paper
|
||||
private final List<BlockState> blocks;
|
||||
|
||||
- public SpongeAbsorbEvent(@NotNull Block block, @NotNull List<BlockState> waterblocks) {
|
||||
+ public SpongeAbsorbEvent(@NotNull Block block, @Nullable org.bukkit.entity.Player player, @NotNull List<BlockState> waterblocks) { // Paper
|
||||
super(block);
|
||||
this.blocks = waterblocks;
|
||||
+ this.player = player; // Paper
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,6 +44,18 @@ public class SpongeAbsorbEvent extends BlockEvent implements Cancellable {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the Player that placed the Sponge Block
|
||||
+ *
|
||||
+ * @return The Player that placed the sponge block causing the absorb event, or null if no Player was involved
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public org.bukkit.entity.Player getPlayer() {
|
||||
+ return player;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
@@ -1,31 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Wed, 29 Sep 2021 08:40:37 -0500
|
||||
Subject: [PATCH] Add provided Material to getDrops
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index cd63406809aadbcc53857aaef31053915278dfc0..ab4982d52185bbc80d506da2a961345d46710efa 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -602,6 +602,20 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
|
||||
@NotNull
|
||||
Collection<ItemStack> getDrops(@NotNull ItemStack tool, @Nullable Entity entity);
|
||||
|
||||
+ // Slice start
|
||||
+ /**
|
||||
+ * Returns a list of items which would drop by the entity destroying this
|
||||
+ * block as though it were a given Material with a specific tool
|
||||
+ *
|
||||
+ * @param blockType The block type to use as the source loot
|
||||
+ * @param tool The tool or item in hand used for digging
|
||||
+ * @param entity the entity destroying the block
|
||||
+ * @return a list of dropped items for this type of block
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Collection<ItemStack> getDrops(@NotNull Material blockType, @NotNull ItemStack tool, @Nullable Entity entity);
|
||||
+ // Slice end
|
||||
+
|
||||
/**
|
||||
* Returns if the given item is a preferred choice to break this Block.
|
||||
*
|
||||
@@ -1,22 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 18 Oct 2021 08:52:40 -0500
|
||||
Subject: [PATCH] World Instance Flag
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 4f673e9123145dc78564dc3eef0edf75795dafc2..c840fccc7d5eab215886c3281be3a6257fa01aad 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -2606,6 +2606,11 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
*/
|
||||
public void setAutoSave(boolean value);
|
||||
|
||||
+ // Slice start
|
||||
+ public boolean isInstance();
|
||||
+ public void setInstance(boolean value);
|
||||
+ // Slice end
|
||||
+
|
||||
/**
|
||||
* Sets the Difficulty of the world.
|
||||
*
|
||||
@@ -1,52 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 30 Nov 2021 12:04:50 -0600
|
||||
Subject: [PATCH] PlayerTrackEntityEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerTrackEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerTrackEntityEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0532a7986a8091e82f1fc64b9654be26d6c8ea5e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerTrackEntityEvent.java
|
||||
@@ -0,0 +1,40 @@
|
||||
+package org.bukkit.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player tracks an entity.
|
||||
+ */
|
||||
+public class PlayerTrackEntityEvent extends PlayerEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final Entity tracked;
|
||||
+
|
||||
+ public PlayerTrackEntityEvent(@NotNull final Player player, @NotNull final Entity tracked) {
|
||||
+ super(player);
|
||||
+ this.tracked = tracked;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the entity newly tracked by the Player
|
||||
+ *
|
||||
+ * @return Entity the player is now tracking
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getTracked() {
|
||||
+ return tracked;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
@@ -1,133 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Tue, 7 Dec 2021 07:59:41 -0600
|
||||
Subject: [PATCH] Add player data saving events
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadDataEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadDataEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ae0132d9c7ae17b478d1d504961e1fd6b479f6d0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadDataEvent.java
|
||||
@@ -0,0 +1,63 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import com.google.gson.JsonObject;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+import java.util.UUID;
|
||||
+
|
||||
+/**
|
||||
+ * Calls an event in which playerdata can be provided. If null, will load from disk, otherwise will use provided data
|
||||
+ */
|
||||
+public class PlayerLoadDataEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final UUID playerId;
|
||||
+ private Object playerData;
|
||||
+ private JsonObject statistics;
|
||||
+
|
||||
+ public PlayerLoadDataEvent(@NotNull UUID playerId) {
|
||||
+ super();
|
||||
+ this.playerId = playerId;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the player's unique ID.
|
||||
+ *
|
||||
+ * @return The unique ID
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public UUID getUniqueId() {
|
||||
+ return playerId;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public Object getPlayerData() {
|
||||
+ return playerData;
|
||||
+ }
|
||||
+
|
||||
+ public void setPlayerData(@NotNull Object playerData) {
|
||||
+ this.playerData = playerData;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public JsonObject getStatistics() {
|
||||
+ return statistics;
|
||||
+ }
|
||||
+
|
||||
+ public void setStatistics(@NotNull JsonObject statistics) {
|
||||
+ this.statistics = statistics;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerSaveDataEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerSaveDataEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c706201394d89f4a6f795ebbbac3d1041f395104
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerSaveDataEvent.java
|
||||
@@ -0,0 +1,52 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Calls whenever playerdata is attempted to be saved. This is fired even if SpigotConfig.disablePlayerDataSaving is true
|
||||
+ */
|
||||
+public class PlayerSaveDataEvent extends Event implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final Player player;
|
||||
+ private boolean cancel;
|
||||
+
|
||||
+ public PlayerSaveDataEvent(@NotNull Player player) {
|
||||
+ super();
|
||||
+ this.player = player;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the player
|
||||
+ *
|
||||
+ * @return The player
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Player getPlayer() {
|
||||
+ return player;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ }
|
||||
+}
|
||||
@@ -1,78 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 21 Sep 2021 08:25:29 -0500
|
||||
Subject: [PATCH] Build Changes
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index f442236efe30d7d9e0c6a8dfb0f040540dc62753..bcdeb5a1c3c10d86d116dbf4257eb7b9d12f4426 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -22,8 +22,8 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
- implementation(project(":Paper-API"))
|
||||
- implementation(project(":Paper-MojangAPI"))
|
||||
+ implementation(project(":Slice-API")) // Slice
|
||||
+ implementation("io.papermc.paper:paper-mojangapi:1.17.1-R0.1-SNAPSHOT") // Slice
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
@@ -75,7 +75,7 @@ tasks.jar {
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
"Implementation-Title" to "CraftBukkit",
|
||||
- "Implementation-Version" to "git-Paper-$implementationVersion",
|
||||
+ "Implementation-Version" to "git-Slice-$implementationVersion", // Slice
|
||||
"Implementation-Vendor" to date, // Paper
|
||||
"Specification-Title" to "Bukkit",
|
||||
"Specification-Version" to project.version,
|
||||
@@ -202,7 +202,7 @@ tasks.test {
|
||||
fun TaskContainer.registerRunTask(
|
||||
name: String, block: JavaExec.() -> Unit
|
||||
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
||||
- group = "paper"
|
||||
+ group = "paperweight"
|
||||
standardInput = System.`in`
|
||||
workingDir = rootProject.layout.projectDirectory.dir(
|
||||
providers.gradleProperty("runWorkDir").forUseAtConfigurationTime().orElse("run")
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 5a4172faaf960d48939d6a485719041987df9242..402367f10b126c7d527e5a2b5319d331dce81857 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1729,7 +1729,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
- return "Paper"; // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||
+ return "Slice"; //Slice - Slice > //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||
}
|
||||
|
||||
public SystemReport fillSystemReport(SystemReport details) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 99a94898316b0601f55b333c15a9926eae24f8a2..f20dc9edfa15fd7705570830955d1b82b4fd59e3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -251,7 +251,7 @@ import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
- private final String serverName = "Paper"; // Paper
|
||||
+ private final String serverName = "Slice"; // Slice // Paper
|
||||
private final String serverVersion;
|
||||
private final String bukkitVersion = Versioning.getBukkitVersion();
|
||||
private final Logger logger = Logger.getLogger("Minecraft");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
index 774556a62eb240da42e84db4502e2ed43495be17..fdd8fa9ec021b4846b59e1693e32d4d02a712efe 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
@@ -11,7 +11,7 @@ public final class Versioning {
|
||||
public static String getBukkitVersion() {
|
||||
String result = "Unknown-Version";
|
||||
|
||||
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties");
|
||||
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/com.lokamc.slice/slice-api/pom.properties"); // Slice
|
||||
Properties properties = new Properties();
|
||||
|
||||
if (stream != null) {
|
||||
@@ -5,61 +5,65 @@ Subject: [PATCH] Build changes
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 1876481a830228fd15fcd2a4be5f2c28bd7e51fe..872b45c4ea41372c8cfb435cec46b643291a2fa5 100644
|
||||
index cd74406039704e5a880f00b9b60bb7b1dedc5398..c4dfc34277e59143d346725c9ef2bfbcee59bc06 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -28,8 +28,8 @@ repositories {
|
||||
@@ -18,8 +18,12 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
- implementation(project(":Paper-API"))
|
||||
- implementation(project(":Paper-MojangAPI"))
|
||||
+ implementation(project(":ForkTest-API")) // ForkTest
|
||||
+ implementation("io.papermc.paper:paper-mojangapi:1.17.1-R0.1-SNAPSHOT") // ForkTest
|
||||
- implementation(project(":paper-api"))
|
||||
- implementation(project(":paper-mojangapi"))
|
||||
+ // Slice start
|
||||
+ implementation(project(":slice-api"))
|
||||
+ implementation("io.papermc.paper:paper-mojangapi:1.18-R0.1-SNAPSHOT") {
|
||||
+ exclude("io.papermc.paper", "paper-api")
|
||||
+ }
|
||||
+ // Slice end
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.12.1")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.2.0")
|
||||
@@ -80,7 +80,7 @@ tasks.jar {
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
@@ -67,7 +71,7 @@ tasks.jar {
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
"Implementation-Title" to "CraftBukkit",
|
||||
- "Implementation-Version" to "git-Paper-$implementationVersion",
|
||||
+ "Implementation-Version" to "git-ForkTest-$implementationVersion", // ForkTest
|
||||
+ "Implementation-Version" to "git-Slice-$implementationVersion", // Slice
|
||||
"Implementation-Vendor" to date, // Paper
|
||||
"Specification-Title" to "Bukkit",
|
||||
"Specification-Version" to project.version,
|
||||
@@ -205,7 +205,7 @@ tasks.test {
|
||||
fun TaskContainer.registerRunTask(
|
||||
name: String, block: JavaExec.() -> Unit
|
||||
@@ -158,7 +162,7 @@ fun TaskContainer.registerRunTask(
|
||||
name: String,
|
||||
block: JavaExec.() -> Unit
|
||||
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
||||
- group = "paper"
|
||||
+ group = "paperweight"
|
||||
mainClass.set("org.bukkit.craftbukkit.Main")
|
||||
standardInput = System.`in`
|
||||
workingDir = rootProject.layout.projectDirectory.dir(
|
||||
providers.gradleProperty("runWorkDir").forUseAtConfigurationTime().orElse("run")
|
||||
workingDir = rootProject.layout.projectDirectory
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 3dded5c491ace6b073a7bc3178976bd70f0b9393..72d637ffc00b536357af02a52defe996dceda3b9 100644
|
||||
index 893badbe321fa974cb82f5f11ab590bb3827f8b8..4aba540f4bc8014548cc10818472431dfa6b2ede 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1651,7 +1651,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1708,7 +1708,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
- return "Paper"; //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||
+ return "ForkTest"; //ForkTest - ForkTest > //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||
- return "Paper"; // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||
+ return "Slice"; // Slice - Slice > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||
}
|
||||
|
||||
public SystemReport fillSystemReport(SystemReport details) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 6d7f16fede01c19f638e1dcdae8b07b79cd86dc0..5b8132b32234536b89601813bdba17410803428a 100644
|
||||
index d938dc26886aa8a64c11db5e49fe5639bc27e1fb..d941957dee45911626f62e55f598490a60d6c818 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -240,7 +240,7 @@ import javax.annotation.Nullable; // Paper
|
||||
@@ -255,7 +255,7 @@ import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
- private final String serverName = "Paper"; // Paper
|
||||
+ private final String serverName = "ForkTest"; // ForkTest // Paper
|
||||
+ private final String serverName = "Slice"; // Slice // Paper
|
||||
private final String serverVersion;
|
||||
private final String bukkitVersion = Versioning.getBukkitVersion();
|
||||
private final Logger logger = Logger.getLogger("Minecraft");
|
||||
@@ -72,7 +76,7 @@ index 774556a62eb240da42e84db4502e2ed43495be17..21f39bd0c33ef2635249298e6a247afb
|
||||
String result = "Unknown-Version";
|
||||
|
||||
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties");
|
||||
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/com.example.paperfork/forktest-api/pom.properties"); // ForkTest
|
||||
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/com.example.paperfork/slice-api/pom.properties"); // Slice
|
||||
Properties properties = new Properties();
|
||||
|
||||
if (stream != null) {
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 21 Sep 2021 08:33:45 -0500
|
||||
Subject: [PATCH] Add PlayerShieldDisableEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 8a864238e154e2131834d013652746b7e7a78c97..806975b124bf91ae560dc3a0289f3a298373546d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -1588,6 +1588,7 @@ public abstract class Mob extends LivingEntity {
|
||||
float f = 0.25F + (float) EnchantmentHelper.getBlockEfficiency(this) * 0.05F;
|
||||
|
||||
if (this.random.nextFloat() < f) {
|
||||
+ if (!new io.papermc.paper.event.player.PlayerShieldDisableEvent((org.bukkit.entity.Player) player.getBukkitEntity(), getBukkitEntity()).callEvent()) return; // Slice
|
||||
player.getCooldowns().addCooldown(Items.SHIELD, 100);
|
||||
this.level.broadcastEntityEvent(player, (byte) 30);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index cea92f1dc663bf0648b2bd877d86ca380a517bc9..a1d1d8b5fbb5d7f8e980b4c116b8fec34f8878d5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -936,7 +936,7 @@ public abstract class Player extends LivingEntity {
|
||||
protected void blockUsingShield(LivingEntity attacker) {
|
||||
super.blockUsingShield(attacker);
|
||||
if (attacker.getMainHandItem().getItem() instanceof AxeItem) {
|
||||
- this.disableShield(true);
|
||||
+ this.disableShield(true, attacker); // Slice
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1403,6 +1403,12 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
|
||||
public void disableShield(boolean sprinting) {
|
||||
+ // Slice start
|
||||
+ disableShield(sprinting, null);
|
||||
+ }
|
||||
+
|
||||
+ public void disableShield(boolean sprinting, @Nullable LivingEntity attacker) {
|
||||
+ // Slice end
|
||||
float f = 0.25F + (float) EnchantmentHelper.getBlockEfficiency(this) * 0.05F;
|
||||
|
||||
if (sprinting) {
|
||||
@@ -1410,6 +1416,8 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
|
||||
if (this.random.nextFloat() < f) {
|
||||
+ org.bukkit.entity.Entity finalAttacker = attacker != null ? attacker.getBukkitEntity() : null; // Slice
|
||||
+ if (!new io.papermc.paper.event.player.PlayerShieldDisableEvent((org.bukkit.entity.Player) getBukkitEntity(), finalAttacker).callEvent()) return; // Slice
|
||||
this.getCooldowns().addCooldown(Items.SHIELD, 100);
|
||||
this.stopUsingItem();
|
||||
this.level.broadcastEntityEvent(this, (byte) 30);
|
||||
@@ -1,188 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 21 Sep 2021 15:20:15 -0500
|
||||
Subject: [PATCH] Multiple Entries with Scoreboards
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
|
||||
index 4c9660176e783999301565790b8cf6f47b0d02a2..3f1b093ae766c6e219ee233a75c64f0c522cc6c2 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
|
||||
@@ -42,6 +42,12 @@ public class ClientboundSetPlayerTeamPacket implements Packet<ClientGamePacketLi
|
||||
return new ClientboundSetPlayerTeamPacket(team.getName(), operation == ClientboundSetPlayerTeamPacket.Action.ADD ? 3 : 4, Optional.empty(), ImmutableList.of(playerName));
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public static ClientboundSetPlayerTeamPacket createMultiplePlayerPacket(PlayerTeam team, Collection<String> players, ClientboundSetPlayerTeamPacket.Action operation) {
|
||||
+ return new ClientboundSetPlayerTeamPacket(team.getName(), operation == ClientboundSetPlayerTeamPacket.Action.ADD ? 3 : 4, Optional.empty(), players);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public ClientboundSetPlayerTeamPacket(FriendlyByteBuf buf) {
|
||||
this.name = buf.readUtf(16);
|
||||
this.method = buf.readByte();
|
||||
diff --git a/src/main/java/net/minecraft/server/ServerScoreboard.java b/src/main/java/net/minecraft/server/ServerScoreboard.java
|
||||
index 130a928f156961bae9ca184b3ca31004dbba1012..5d42967b1d9cbceb004566c0c503df21d1bb5c51 100644
|
||||
--- a/src/main/java/net/minecraft/server/ServerScoreboard.java
|
||||
+++ b/src/main/java/net/minecraft/server/ServerScoreboard.java
|
||||
@@ -3,6 +3,7 @@ package net.minecraft.server;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import java.util.Iterator;
|
||||
+import java.util.Collection; // Paper
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
@@ -92,6 +93,19 @@ public class ServerScoreboard extends Scoreboard {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public boolean addPlayersToTeam(Collection<String> players, PlayerTeam team) {
|
||||
+ if (super.addPlayersToTeam(players, team)) {
|
||||
+ this.sendAll(ClientboundSetPlayerTeamPacket.createMultiplePlayerPacket(team, players, ClientboundSetPlayerTeamPacket.Action.ADD));
|
||||
+ this.setDirty();
|
||||
+ return true;
|
||||
+ } else {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public void removePlayerFromTeam(String playerName, PlayerTeam team) {
|
||||
super.removePlayerFromTeam(playerName, team);
|
||||
@@ -99,6 +113,19 @@ public class ServerScoreboard extends Scoreboard {
|
||||
this.setDirty();
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public boolean removePlayersFromTeam(Collection<String> players, PlayerTeam team) {
|
||||
+ if (super.removePlayersFromTeam(players, team)) {
|
||||
+ this.sendAll(ClientboundSetPlayerTeamPacket.createMultiplePlayerPacket(team, players, ClientboundSetPlayerTeamPacket.Action.REMOVE));
|
||||
+ this.setDirty();
|
||||
+ return true;
|
||||
+ } else {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public void onObjectiveAdded(Objective objective) {
|
||||
super.onObjectiveAdded(objective);
|
||||
diff --git a/src/main/java/net/minecraft/world/scores/Scoreboard.java b/src/main/java/net/minecraft/world/scores/Scoreboard.java
|
||||
index 3e75ea4d5a6c83ca570b29e3c1a5d51fb132379a..246bb45d73c3948fae081662995ada7cdb49822d 100644
|
||||
--- a/src/main/java/net/minecraft/world/scores/Scoreboard.java
|
||||
+++ b/src/main/java/net/minecraft/world/scores/Scoreboard.java
|
||||
@@ -224,6 +224,28 @@ public class Scoreboard {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public boolean addPlayersToTeam(Collection<String> players, PlayerTeam team) {
|
||||
+ boolean anyAdded = false;
|
||||
+ for (String playerName : players) {
|
||||
+ if (playerName.length() > 40) {
|
||||
+ net.minecraft.server.MinecraftServer.LOGGER.warn("The player name '" + playerName + "' is too long!");
|
||||
+ } else {
|
||||
+ if (this.getPlayersTeam(playerName) != null) {
|
||||
+ this.removePlayerFromTeam(playerName);
|
||||
+ }
|
||||
+
|
||||
+ this.teamsByPlayer.put(playerName, team);
|
||||
+ if (team.getPlayers().add(playerName)) {
|
||||
+ anyAdded = true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return anyAdded;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public boolean removePlayerFromTeam(String playerName) {
|
||||
PlayerTeam playerTeam = this.getPlayersTeam(playerName);
|
||||
if (playerTeam != null) {
|
||||
@@ -243,6 +265,24 @@ public class Scoreboard {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public boolean removePlayersFromTeam(Collection<String> players, PlayerTeam team) {
|
||||
+ boolean anyRemoved = false;
|
||||
+ for (String playerName : players) {
|
||||
+ if (this.getPlayersTeam(playerName) != team) {
|
||||
+ net.minecraft.server.MinecraftServer.LOGGER.warn("Player " + playerName + " is either on another team or not on any team. Cannot remove from team '" + team.getName() + "'.");
|
||||
+ } else {
|
||||
+ this.teamsByPlayer.remove(playerName);
|
||||
+ if (team.getPlayers().remove(playerName)) {
|
||||
+ anyRemoved = true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return anyRemoved;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public Collection<String> getTeamNames() {
|
||||
return this.teamsByName.keySet();
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
index 2b87a652798cb632fe76bf20e9e7f8cb8bfb3b7b..f097e9fbdac1a572c12cc0299774455c75e373e9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.bukkit.craftbukkit.scoreboard;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
+import java.util.Collection; // Paper
|
||||
import java.util.Set;
|
||||
import net.minecraft.world.scores.PlayerTeam;
|
||||
import net.minecraft.world.scores.Team.Visibility;
|
||||
@@ -226,6 +227,16 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
|
||||
scoreboard.board.addPlayerToTeam(entry, team);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public void addEntries(Collection<String> entries) throws IllegalStateException, IllegalArgumentException {
|
||||
+ Validate.notNull(entries, "Entries cannot be null");
|
||||
+ CraftScoreboard scoreboard = checkState();
|
||||
+
|
||||
+ scoreboard.board.addPlayersToTeam(entries, team);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public boolean removePlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException {
|
||||
Validate.notNull(player, "OfflinePlayer cannot be null");
|
||||
@@ -245,6 +256,25 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
|
||||
return true;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public boolean removeEntries(Collection<String> entries) throws IllegalStateException, IllegalArgumentException {
|
||||
+ Validate.notNull(entries, "Entry cannot be null");
|
||||
+ CraftScoreboard scoreboard = this.checkState();
|
||||
+
|
||||
+ boolean anyRemoved = false;
|
||||
+ Collection<String> teamPlayers = this.team.getPlayers();
|
||||
+ for (String entry : entries) {
|
||||
+ if (teamPlayers.remove(entry)) {
|
||||
+ anyRemoved = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ scoreboard.board.removePlayersFromTeam(entries, team);
|
||||
+ return anyRemoved;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public boolean hasPlayer(OfflinePlayer player) throws IllegalArgumentException, IllegalStateException {
|
||||
Validate.notNull(player, "OfflinePlayer cannot be null");
|
||||
@@ -1,148 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Wed, 22 Sep 2021 09:41:27 -0500
|
||||
Subject: [PATCH] Set BlockData without light update
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
index 21d1e0c9c471e9e556b5bd70166a769b46105c7a..d46dc12001bd46596c3bb2e24144bbe4d2d3a5e1 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
@@ -241,7 +241,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
Block.dropResources(iblockdata, this.level, pos, tileentity, breakingEntity, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
- return this.setBlock(pos, Blocks.AIR.defaultBlockState(), 3, maxUpdateDepth);
|
||||
+ return this.setBlock(pos, Blocks.AIR.defaultBlockState(), 3, maxUpdateDepth, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
|
||||
+ public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight) {
|
||||
if (!this.ensureCanWrite(pos)) {
|
||||
return false;
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 9cafd000b3533ed9fd35df2ec880f55e262084fb..8420d615867faa717266d1edfa5a469df1b1e43f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -541,12 +541,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public final boolean setBlock(BlockPos pos, BlockState state, int flags) { // Paper - final for inline
|
||||
- return this.setBlock(pos, state, flags, 512);
|
||||
+ public final boolean setBlock(BlockPos pos, BlockState state, int flags, boolean checkLight) { // Paper - final for inline
|
||||
+ return this.setBlock(pos, state, flags, 512, checkLight);
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
|
||||
+ public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight) {
|
||||
// CraftBukkit start - tree generation
|
||||
if (this.captureTreeGeneration) {
|
||||
// Paper start
|
||||
@@ -593,7 +593,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
} else {
|
||||
BlockState iblockdata2 = this.getBlockState(pos);
|
||||
|
||||
- if ((flags & 128) == 0 && iblockdata2 != iblockdata1 && (iblockdata2.getLightBlock((BlockGetter) this, pos) != iblockdata1.getLightBlock((BlockGetter) this, pos) || iblockdata2.getLightEmission() != iblockdata1.getLightEmission() || iblockdata2.useShapeForLightOcclusion() || iblockdata1.useShapeForLightOcclusion())) {
|
||||
+ if (checkLight && (flags & 128) == 0 && iblockdata2 != iblockdata1 && (iblockdata2.getLightBlock((BlockGetter) this, pos) != iblockdata1.getLightBlock((BlockGetter) this, pos) || iblockdata2.getLightEmission() != iblockdata1.getLightEmission() || iblockdata2.useShapeForLightOcclusion() || iblockdata1.useShapeForLightOcclusion())) {
|
||||
this.getProfiler().push("queueCheckLight");
|
||||
this.getChunkSource().getLightEngine().checkBlock(pos);
|
||||
this.getProfiler().pop();
|
||||
@@ -740,7 +740,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
Block.dropResources(iblockdata, this, pos, tileentity, breakingEntity, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
- boolean flag1 = this.setBlock(pos, fluid.createLegacyBlock(), 3, maxUpdateDepth);
|
||||
+ boolean flag1 = this.setBlock(pos, fluid.createLegacyBlock(), 3, maxUpdateDepth, true);
|
||||
|
||||
if (flag1) {
|
||||
this.gameEvent(breakingEntity, GameEvent.BLOCK_DESTROY, pos);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/LevelWriter.java b/src/main/java/net/minecraft/world/level/LevelWriter.java
|
||||
index b6825cd32033cac34c74af1f8c980ed7fb97a754..d2dfbfa0d58b94ce583992aa56f5b0e28d4b31f2 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/LevelWriter.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/LevelWriter.java
|
||||
@@ -7,10 +7,14 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public interface LevelWriter {
|
||||
|
||||
- boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth);
|
||||
+ boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight);
|
||||
|
||||
default boolean setBlock(BlockPos pos, BlockState state, int flags) {
|
||||
- return this.setBlock(pos, state, flags, 512);
|
||||
+ return this.setBlock(pos, state, flags, 512, true);
|
||||
+ }
|
||||
+
|
||||
+ default boolean setBlock(BlockPos pos, BlockState state, int flags, boolean checkLight) {
|
||||
+ return this.setBlock(pos, state, flags, 512, checkLight);
|
||||
}
|
||||
|
||||
boolean removeBlock(BlockPos pos, boolean move);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index 8c30e28b97ac7e8b54322c903e0b75ee8135620b..64cc26d146afba7c6ecb0d3052776837a41a5618 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -197,7 +197,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
world.destroyBlock(pos, (flags & 32) == 0, (Entity) null, maxUpdateDepth);
|
||||
}
|
||||
} else {
|
||||
- world.setBlock(pos, newState, flags & -33, maxUpdateDepth);
|
||||
+ world.setBlock(pos, newState, flags & -33, maxUpdateDepth, true);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index 6f01af8cc3f9ed4d2eaa3304990ca33f8692a453..f374d5d6fc3ac9187236d141931c3c57ddd57865 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -178,11 +178,20 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public void setBlockData(BlockData data, boolean applyPhysics) {
|
||||
+ setBlockData(data, applyPhysics, true);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setBlockData(BlockData data, boolean applyPhysics, boolean checkLight) {
|
||||
Preconditions.checkArgument(data != null, "BlockData cannot be null");
|
||||
- this.setTypeAndData(((CraftBlockData) data).getState(), applyPhysics);
|
||||
+ this.setTypeAndData(((CraftBlockData) data).getState(), applyPhysics, checkLight);
|
||||
}
|
||||
|
||||
public boolean setTypeAndData(final net.minecraft.world.level.block.state.BlockState blockData, final boolean applyPhysics) {
|
||||
+ return setTypeAndData(blockData, applyPhysics, true);
|
||||
+ }
|
||||
+
|
||||
+ public boolean setTypeAndData(final net.minecraft.world.level.block.state.BlockState blockData, final boolean applyPhysics, boolean checkLight) {
|
||||
net.minecraft.world.level.block.state.BlockState old = this.getNMS();
|
||||
// SPIGOT-611: need to do this to prevent glitchiness. Easier to handle this here (like /setblock) than to fix weirdness in tile entity cleanup
|
||||
if (old.hasBlockEntity() && blockData.getBlock() != old.getBlock()) { // SPIGOT-3725 remove old tile entity if block changes
|
||||
@@ -197,7 +206,7 @@ public class CraftBlock implements Block {
|
||||
if (applyPhysics) {
|
||||
return this.world.setBlock(position, blockData, 3);
|
||||
} else {
|
||||
- boolean success = this.world.setBlock(position, blockData, 2 | 16 | 1024); // NOTIFY | NO_OBSERVER | NO_PLACE (custom)
|
||||
+ boolean success = this.world.setBlock(position, blockData, 2 | 16 | 1024, checkLight); // NOTIFY | NO_OBSERVER | NO_PLACE (custom)
|
||||
if (success && this.world instanceof net.minecraft.world.level.Level) {
|
||||
this.world.getMinecraftWorld().sendBlockUpdated(
|
||||
position,
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
|
||||
index 950d4381459d31d02acf55c4aef4f5e33367748b..0b09b06b3d9fe2cce5c6cbf70a4b84ff8edc2085 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
|
||||
@@ -231,7 +231,7 @@ public class DummyGeneratorAccess implements WorldGenLevel {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
|
||||
+ public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Thu, 23 Sep 2021 08:56:42 -0500
|
||||
Subject: [PATCH] Don't send equipment updates if only durability changed
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index cbdff14b26f67b5040c13659f9d64d9ec4c7eaed..bd054a883ecb15260aec27c81ad79e774fca69a5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3007,7 +3007,7 @@ public abstract class LivingEntity extends Entity {
|
||||
|
||||
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
|
||||
|
||||
- if (!ItemStack.matches(itemstack1, itemstack)) {
|
||||
+ if (!ItemStack.isSameIgnoreDurability(itemstack1, itemstack)) {
|
||||
// Paper start - PlayerArmorChangeEvent
|
||||
if (this instanceof ServerPlayer && enumitemslot.getType() == EquipmentSlot.Type.ARMOR) {
|
||||
final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack);
|
||||
@@ -1,43 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Thu, 23 Sep 2021 09:08:06 -0500
|
||||
Subject: [PATCH] Allow opening covered chests
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
index 1891cfb8f7ebae5a95a55f706bb04f8206121d32..d24c22e0dd84344021a77d24926c2934e71d40ff 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
@@ -356,9 +356,10 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
|
||||
}
|
||||
|
||||
private static boolean isBlockedChestByBlock(BlockGetter world, BlockPos pos) {
|
||||
- BlockPos blockposition1 = pos.above();
|
||||
-
|
||||
- return world.getBlockState(blockposition1).isRedstoneConductor(world, blockposition1);
|
||||
+ return false;
|
||||
+// BlockPos blockposition1 = pos.above();
|
||||
+//
|
||||
+// return world.getBlockState(blockposition1).isRedstoneConductor(world, blockposition1);
|
||||
}
|
||||
|
||||
private static boolean isCatSittingOnChest(LevelAccessor world, BlockPos pos) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
|
||||
index 7e45c97acce83a9fe8ada486e9fcdafe58769736..80e30b978455890506ef555773983dd4058185e3 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
|
||||
@@ -77,10 +77,10 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
|
||||
PlayerEnderChestContainer playerEnderChestContainer = player.getEnderChestInventory();
|
||||
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||
if (playerEnderChestContainer != null && blockEntity instanceof EnderChestBlockEntity) {
|
||||
- BlockPos blockPos = pos.above();
|
||||
- if (world.getBlockState(blockPos).isRedstoneConductor(world, blockPos)) {
|
||||
- return InteractionResult.sidedSuccess(world.isClientSide);
|
||||
- } else if (world.isClientSide) {
|
||||
+// BlockPos blockPos = pos.above();
|
||||
+// if (world.getBlockState(blockPos).isRedstoneConductor(world, blockPos)) {
|
||||
+// return InteractionResult.sidedSuccess(world.isClientSide);
|
||||
+ if (world.isClientSide) {
|
||||
return InteractionResult.SUCCESS;
|
||||
} else {
|
||||
EnderChestBlockEntity enderChestBlockEntity = (EnderChestBlockEntity)blockEntity;
|
||||
@@ -1,23 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Thu, 23 Sep 2021 09:29:09 -0500
|
||||
Subject: [PATCH] Don't send fire packets if player has Fire Resistance
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 94857a736d2a16e8ade286c6f2ddf8bd798008eb..ea85fc39b77aece9c9544ec01348eafa233355d1 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -760,7 +760,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
|
||||
this.checkOutOfWorld();
|
||||
if (!this.level.isClientSide) {
|
||||
- this.setSharedFlagOnFire(this.remainingFireTicks > 0);
|
||||
+ if (this instanceof net.minecraft.world.entity.LivingEntity livingEntity) {
|
||||
+ this.setSharedFlagOnFire(this.remainingFireTicks > 0 && !livingEntity.hasEffect(net.minecraft.world.effect.MobEffects.FIRE_RESISTANCE));
|
||||
+ } else {
|
||||
+ this.setSharedFlagOnFire(this.remainingFireTicks > 0);
|
||||
+ }
|
||||
}
|
||||
|
||||
this.firstTick = false;
|
||||
@@ -1,139 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Thu, 23 Sep 2021 08:27:21 -0500
|
||||
Subject: [PATCH] Track Player throughout entire block destroy
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index 12998d0e9ae0e148a155faa4468b0f78b8462cc9..b03eacbef3cf15b70ec012af0870975d3e8e8cba 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -441,6 +441,7 @@ public class ServerPlayerGameMode {
|
||||
org.bukkit.block.BlockState state = bblock.getState();
|
||||
level.captureDrops = new ArrayList<>();
|
||||
// CraftBukkit end
|
||||
+ level.pendingPlayerBlockEvents.put(pos, new Level.PendingBlockEvent(pos, this.player)); // Paper
|
||||
block.playerWillDestroy((Level) this.level, pos, iblockdata, (Player) this.player);
|
||||
boolean flag = this.level.removeBlock(pos, false);
|
||||
|
||||
@@ -465,6 +466,7 @@ public class ServerPlayerGameMode {
|
||||
// CraftBukkit start
|
||||
java.util.List<ItemEntity> itemsToDrop = level.captureDrops; // Paper - store current list
|
||||
level.captureDrops = null; // Paper - Remove this earlier so that we can actually drop stuff
|
||||
+ level.pendingPlayerBlockEvents.remove(pos); // Paper
|
||||
if (event.isDropItems()) {
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, itemsToDrop); // Paper - use stored ref
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 7695a5ec88023720d873f81fc36f78ad60fb9589..71d02915581326f5546b2f916259a1ec00e85961 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -323,6 +323,7 @@ public final class ItemStack {
|
||||
}
|
||||
}
|
||||
Item item = this.getItem();
|
||||
+ if (entityhuman != null) world.pendingPlayerBlockEvents.put(blockposition, new Level.PendingBlockEvent(blockposition, entityhuman)); // Paper
|
||||
InteractionResult enuminteractionresult = item.useOn(itemactioncontext);
|
||||
CompoundTag newData = this.getTagClone();
|
||||
int newCount = this.getCount();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 8420d615867faa717266d1edfa5a469df1b1e43f..71fca6c915f90a771e6139b985ebc51c7923778c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -176,6 +176,27 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
|
||||
public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here
|
||||
|
||||
+ // Paper start - Holder class used to track what Player is responsible the last block event
|
||||
+ public static class PendingBlockEvent {
|
||||
+
|
||||
+ public final BlockPos block;
|
||||
+ public final Player player;
|
||||
+ public @Nullable BlockPos sourceBlock;
|
||||
+
|
||||
+ public PendingBlockEvent(BlockPos block, Player player) {
|
||||
+ this(block, player, null);
|
||||
+ }
|
||||
+
|
||||
+ public PendingBlockEvent(BlockPos block, Player player, @Nullable BlockPos sourceBlock) {
|
||||
+ this.block = block;
|
||||
+ this.player = player;
|
||||
+ this.sourceBlock = sourceBlock;
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+ public final Map<BlockPos, PendingBlockEvent> pendingPlayerBlockEvents = new HashMap<>();
|
||||
+ // Paper end
|
||||
+
|
||||
// Paper start - fix and optimise world upgrading
|
||||
// copied from below
|
||||
public static ResourceKey<DimensionType> getDimensionKey(DimensionType manager) {
|
||||
@@ -695,6 +716,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (!this.preventPoiUpdated) {
|
||||
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
|
||||
}
|
||||
+ pendingPlayerBlockEvents.remove(blockposition); // Paper
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
@@ -800,8 +822,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public void neighborChanged(BlockPos pos, Block sourceBlock, BlockPos neighborPos) {
|
||||
if (!this.isClientSide) {
|
||||
BlockState iblockdata = this.getBlockState(pos);
|
||||
+ org.bukkit.block.Block blockAt = world.getBlockAt(pos.getX(), pos.getY(), pos.getZ()); // Paper
|
||||
|
||||
try {
|
||||
+ // Paper start - If this is a non-air block being set to an air block, get (remove, if exists)
|
||||
+ // our PendingBlockEvent
|
||||
+ if (blockAt.getType() != org.bukkit.Material.AIR && iblockdata.getMaterial() == net.minecraft.world.level.material.Material.AIR) {
|
||||
+ PendingBlockEvent blockEvent = pendingPlayerBlockEvents.remove(pos);
|
||||
+ if (blockEvent != null) {
|
||||
+ //Would fire a future BlockDestroyedByNeighborEvent here, but must have this conditional block
|
||||
+ //because it's important to remove from pendingPlayerBlockEvents
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
// CraftBukkit start
|
||||
CraftWorld world = ((ServerLevel) this).getWorld();
|
||||
if (world != null && ((ServerLevel)this).hasPhysicsEvent) { // Paper
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
index 65a163d93a293e1e0a12a300d6335a700099cac2..b1b6072ffff0e1cc2e9e1a585ad882bc70697d92 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
@@ -104,6 +104,12 @@ public class DoublePlantBlock extends BushBlock {
|
||||
BlockPos blockposition1 = pos.below();
|
||||
BlockState iblockdata1 = world.getBlockState(blockposition1);
|
||||
|
||||
+ Level.PendingBlockEvent blockEvent = world.pendingPlayerBlockEvents.remove(pos);
|
||||
+ if (blockEvent != null) {
|
||||
+ //Would fire a future BlockDestroyedByNeighborEvent here, but must have this conditional block
|
||||
+ //because it's important to remove from pendingPlayerBlockEvents
|
||||
+ }
|
||||
+
|
||||
if (iblockdata1.is(state.getBlock()) && iblockdata1.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.LOWER) {
|
||||
BlockState iblockdata2 = iblockdata1.hasProperty(BlockStateProperties.WATERLOGGED) && (Boolean) iblockdata1.getValue(BlockStateProperties.WATERLOGGED) ? Blocks.WATER.defaultBlockState() : Blocks.AIR.defaultBlockState();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
index 83d813025efca5846538e36508a5d4fe38b02108..e1eed33f75c3118826ccd0c994325b327e20f83f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
@@ -890,6 +890,18 @@ public abstract class BlockBehaviour {
|
||||
|
||||
blockposition_mutableblockposition.setWithOffset((Vec3i) pos, enumdirection);
|
||||
BlockState iblockdata = world.getBlockState(blockposition_mutableblockposition);
|
||||
+
|
||||
+ // Paper start - Propagate the PendingBlockEvent from the current blockPos to the next block
|
||||
+ // if it will break (!canSurvive)
|
||||
+ if (this.getMaterial() == Material.AIR && !iblockdata.canSurvive(world, blockposition_mutableblockposition)) {
|
||||
+ Level.PendingBlockEvent blockEvent = ((Level) world).pendingPlayerBlockEvents.get(pos);
|
||||
+ if (blockEvent != null) {
|
||||
+ BlockPos blockPosCopy = blockposition_mutableblockposition.immutable();
|
||||
+ ((Level) world).pendingPlayerBlockEvents.put(blockPosCopy, new Level.PendingBlockEvent(blockPosCopy, blockEvent.player, pos));
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
BlockState iblockdata1 = iblockdata.updateShape(enumdirection.getOpposite(), this.asState(), world, blockposition_mutableblockposition, pos);
|
||||
|
||||
Block.updateOrDestroy(iblockdata, iblockdata1, world, blockposition_mutableblockposition, flags, maxUpdateDepth);
|
||||
@@ -1,46 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 26 Sep 2021 09:00:50 -0500
|
||||
Subject: [PATCH] Add BlockDestroyedByNeighborEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 71fca6c915f90a771e6139b985ebc51c7923778c..96a7ae08649294062f856c67e49a793feb63ca37 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -738,6 +738,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (iblockdata.isAir()) {
|
||||
return false;
|
||||
} else {
|
||||
+ // Paper start
|
||||
+ PendingBlockEvent blockEvent = pendingPlayerBlockEvents.get(pos);
|
||||
+ if (blockEvent != null && blockEvent.sourceBlock != null) {
|
||||
+ io.papermc.paper.event.block.BlockDestroyedByNeighborEvent event =
|
||||
+ new io.papermc.paper.event.block.BlockDestroyedByNeighborEvent(org.bukkit.craftbukkit.block.CraftBlock.at(this, pos),
|
||||
+ (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity(),
|
||||
+ org.bukkit.craftbukkit.block.CraftBlock.at(this, blockEvent.sourceBlock));
|
||||
+ event.callEvent();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
FluidState fluid = this.getFluidState(pos);
|
||||
// Paper start - while the above setAir method is named same and looks very similar
|
||||
// they are NOT used with same intent and the above should not fire this event. The above method is more of a BlockSetToAirEvent,
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
index b1b6072ffff0e1cc2e9e1a585ad882bc70697d92..f2eb493d99c2eb826d8b85adbc3dc6799c575f31 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
@@ -106,8 +106,11 @@ public class DoublePlantBlock extends BushBlock {
|
||||
|
||||
Level.PendingBlockEvent blockEvent = world.pendingPlayerBlockEvents.remove(pos);
|
||||
if (blockEvent != null) {
|
||||
- //Would fire a future BlockDestroyedByNeighborEvent here, but must have this conditional block
|
||||
- //because it's important to remove from pendingPlayerBlockEvents
|
||||
+ io.papermc.paper.event.block.BlockDestroyedByNeighborEvent event =
|
||||
+ new io.papermc.paper.event.block.BlockDestroyedByNeighborEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition1),
|
||||
+ (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity(),
|
||||
+ org.bukkit.craftbukkit.block.CraftBlock.at(world, pos));
|
||||
+ if (!event.callEvent()) return;
|
||||
}
|
||||
|
||||
if (iblockdata1.is(state.getBlock()) && iblockdata1.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.LOWER) {
|
||||
@@ -1,20 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Sun, 26 Sep 2021 16:36:29 -0500
|
||||
Subject: [PATCH] Add Player to SpongeAbsorbEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
index 1ef8eadd4e59f2e5d2bbd84f6f9bcf37b59db5bd..ea711757413e2580a5806e0063b3e4fa5d4eddbb 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
@@ -110,7 +110,8 @@ public class SpongeBlock extends Block {
|
||||
if (!blocks.isEmpty()) {
|
||||
final org.bukkit.block.Block bblock = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
- SpongeAbsorbEvent event = new SpongeAbsorbEvent(bblock, (List<org.bukkit.block.BlockState>) (List) blocks);
|
||||
+ Level.PendingBlockEvent blockEvent = world.pendingPlayerBlockEvents.remove(pos); // Paper
|
||||
+ SpongeAbsorbEvent event = new SpongeAbsorbEvent(bblock, blockEvent != null ? (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity() : null, (List<org.bukkit.block.BlockState>) (List) blocks); // Paper
|
||||
world.getCraftServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
@@ -1,38 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Wed, 29 Sep 2021 08:40:37 -0500
|
||||
Subject: [PATCH] Add provided Material to getDrops
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index f374d5d6fc3ac9187236d141931c3c57ddd57865..9ed8586a3e973ba8da340b82440be8f7369ef8ca 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -552,7 +552,18 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getDrops(ItemStack item, Entity entity) {
|
||||
- net.minecraft.world.level.block.state.BlockState iblockdata = this.getNMS();
|
||||
+ return getDrops(null, item, entity); // Slice start
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Collection<ItemStack> getDrops(Material blockType, ItemStack item, Entity entity) {
|
||||
+ net.minecraft.world.level.block.state.BlockState iblockdata;
|
||||
+ if (blockType == null) {
|
||||
+ iblockdata = this.getNMS();
|
||||
+ } else {
|
||||
+ iblockdata = ((CraftBlockData) blockType.createBlockData()).getState();
|
||||
+ }
|
||||
+
|
||||
net.minecraft.world.item.ItemStack nms = CraftItemStack.asNMSCopy(item);
|
||||
|
||||
// Modelled off EntityHuman#hasBlock
|
||||
@@ -563,6 +574,7 @@ public class CraftBlock implements Block {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
+ // Slice end
|
||||
|
||||
@Override
|
||||
public boolean isPreferredTool(ItemStack item) {
|
||||
@@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 5 Oct 2021 09:05:10 -0500
|
||||
Subject: [PATCH] Allow access to LightEngine
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index b3c99c1678c3ee159861c8aac38e765d664c4d1d..b6e1459db7f03801073d39ead5cd08fda8c9b4ba 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -702,7 +702,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
return Math.max(Math.abs(k), Math.abs(l));
|
||||
}
|
||||
|
||||
- protected ThreadedLevelLightEngine getLightEngine() {
|
||||
+ public ThreadedLevelLightEngine getLightEngine() { // Slice (public)
|
||||
return this.lightEngine;
|
||||
}
|
||||
|
||||
@@ -1,213 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Wed, 6 Oct 2021 11:03:01 -0500
|
||||
Subject: [PATCH] Packet obfuscation and reduction
|
||||
|
||||
Minecraft is overzealous about packet updates for Entities. In Loka's case, we want to reduce as many unnecessary
|
||||
packet updates as possible. This patch is likely to be updated over and over in terms of reducing packet sends.
|
||||
|
||||
In summary, this patch creates the concept of a "foreignValue" of a packet's data. We treat packets in two ways:
|
||||
1) The packet sent to the player itself (the normal way). This always has all of the values as usual.
|
||||
2) The packet data as seen by any other (foreign) players.
|
||||
|
||||
This patch adds the ability to set a "foreignValue" for an entity value so as to obfuscate data received by other players.
|
||||
The current packets modified/obfuscated are the following:
|
||||
|
||||
# Health - Foreign Players will only receive packets that say the player is "alive or dead (max health or 0 health).
|
||||
# This reduces the amount of health packet updates as well which is great for players in combat.
|
||||
|
||||
# Air Level - Foreign players will only ever see a player as having full oxygen
|
||||
# Air level packets are sent PER-TICK, and as such a player with any change in air level will only spam themselves
|
||||
# with packets instead of every single player within tracking distance
|
||||
|
||||
# Score - Foreign players will only see a player's score as 0 and will not update due to gathering xp orbs, etc.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
|
||||
index 3e17f6131bf590d7c4a16b79c1c145cb4f565bc9..e1233fa58d068448d0accef7a7f6725fcb902848 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
|
||||
@@ -22,6 +22,13 @@ public class ClientboundSetEntityDataPacket implements Packet<ClientGamePacketLi
|
||||
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ public ClientboundSetEntityDataPacket(int id, List<SynchedEntityData.DataItem<?>> packedItems) {
|
||||
+ this.id = id;
|
||||
+ this.packedItems = packedItems;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
public ClientboundSetEntityDataPacket(FriendlyByteBuf buf) {
|
||||
this.id = buf.readVarInt();
|
||||
this.packedItems = SynchedEntityData.unpack(buf);
|
||||
diff --git a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
index 4df12454001f0de5f358c88d876e34c35a736c42..72c74d2369a36b14f1103aa74b096f50e7990f4d 100644
|
||||
--- a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
+++ b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
@@ -136,6 +136,11 @@ public class SynchedEntityData {
|
||||
}
|
||||
|
||||
public <T> void set(EntityDataAccessor<T> key, T value) {
|
||||
+ //Slice start
|
||||
+ set(key, value, null);
|
||||
+ }
|
||||
+
|
||||
+ public <T> void set(EntityDataAccessor<T> key, T value, @Nullable T foreignValue) { // Slice end
|
||||
SynchedEntityData.DataItem<T> datawatcher_item = this.getItem(key);
|
||||
|
||||
if (ObjectUtils.notEqual(value, datawatcher_item.getValue())) {
|
||||
@@ -145,6 +150,11 @@ public class SynchedEntityData {
|
||||
this.isDirty = true;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ if (foreignValue != null && ObjectUtils.notEqual(foreignValue, datawatcher_item.getForeignValue())) {
|
||||
+ datawatcher_item.setForeignValue(foreignValue);
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
// CraftBukkit start - add method from above
|
||||
@@ -200,6 +210,28 @@ public class SynchedEntityData {
|
||||
return list;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ @Nullable
|
||||
+ public List<SynchedEntityData.DataItem<?>> packForeignDirty(List<DataItem<?>> unpackedData) {
|
||||
+ List<SynchedEntityData.DataItem<?>> list = null;
|
||||
+
|
||||
+ for (DataItem<?> dataItem : unpackedData) {
|
||||
+ DataItem<?> item = itemsById.get(dataItem.accessor.getId());
|
||||
+ if (item.isDirty(true)) {
|
||||
+ item.setForeignDirty(false);
|
||||
+
|
||||
+ if (list == null) {
|
||||
+ list = Lists.newArrayList();
|
||||
+ }
|
||||
+
|
||||
+ list.add(item.copy(true));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return list;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@Nullable
|
||||
public List<SynchedEntityData.DataItem<?>> getAll() {
|
||||
List<SynchedEntityData.DataItem<?>> list = null;
|
||||
@@ -313,11 +345,14 @@ public class SynchedEntityData {
|
||||
final EntityDataAccessor<T> accessor;
|
||||
T value;
|
||||
private boolean dirty;
|
||||
+ @Nullable T foreignValue = null; // Slice
|
||||
+ private boolean foreignDirty; // Slice
|
||||
|
||||
public DataItem(EntityDataAccessor<T> data, T value) {
|
||||
this.accessor = data;
|
||||
this.value = value;
|
||||
this.dirty = true;
|
||||
+ this.foreignDirty = true; // Slice
|
||||
}
|
||||
|
||||
public EntityDataAccessor<T> getAccessor() {
|
||||
@@ -343,5 +378,34 @@ public class SynchedEntityData {
|
||||
public SynchedEntityData.DataItem<T> copy() {
|
||||
return new SynchedEntityData.DataItem<>(this.accessor, this.accessor.getSerializer().copy(this.value));
|
||||
}
|
||||
+
|
||||
+ // Slice start
|
||||
+ public void setForeignValue(T foreignValue) {
|
||||
+ this.foreignValue = foreignValue;
|
||||
+ this.foreignDirty = true;
|
||||
+ }
|
||||
+
|
||||
+ public @Nullable T getForeignValue() {
|
||||
+ return foreignValue;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isDirty(boolean foreign) {
|
||||
+ if (foreign) {
|
||||
+ //There must be a foreign value in order for this to be dirty, otherwise we consider this a normal
|
||||
+ //value and check the normal dirty flag.
|
||||
+ return foreignValue == null || this.foreignDirty;
|
||||
+ }
|
||||
+
|
||||
+ return this.dirty;
|
||||
+ }
|
||||
+
|
||||
+ public void setForeignDirty(boolean dirty) {
|
||||
+ this.foreignDirty = dirty;
|
||||
+ }
|
||||
+
|
||||
+ public SynchedEntityData.DataItem<T> copy(boolean foreign) {
|
||||
+ return new SynchedEntityData.DataItem<>(this.accessor, this.accessor.getSerializer().copy((foreign && this.foreignValue != null ? this.foreignValue : this.value)));
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 1c6bf5a3014beaf5f9c1c38aed4cf3225e50b8bb..6e9c5e210270647205499801b235849d20776156 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -368,7 +368,19 @@ public class ServerEntity {
|
||||
SynchedEntityData datawatcher = this.entity.getEntityData();
|
||||
|
||||
if (datawatcher.isDirty()) {
|
||||
- this.broadcastAndSend(new ClientboundSetEntityDataPacket(this.entity.getId(), datawatcher, false));
|
||||
+ // Slice start
|
||||
+ ClientboundSetEntityDataPacket dataPacket = new ClientboundSetEntityDataPacket(this.entity.getId(), datawatcher, false);
|
||||
+ if (this.entity instanceof ServerPlayer serverPlayer) {
|
||||
+ serverPlayer.connection.send(dataPacket);
|
||||
+ }
|
||||
+
|
||||
+ //Get the packedData that the original packet has, and then determine if any of those are changed in
|
||||
+ //the foreign version. If null, nothing to notify foreign trackers about.
|
||||
+ List<SynchedEntityData.DataItem<?>> dirtyItems = datawatcher.packForeignDirty(dataPacket.getUnpackedData());
|
||||
+ if (dirtyItems != null) {
|
||||
+ this.broadcast(new ClientboundSetEntityDataPacket(this.entity.getId(), dirtyItems));
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
if (this.entity instanceof LivingEntity) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 78cb0786e741f8ef8611460dab64d0e2448fb6cf..587411322e75b08b7f6c2f18a22256ff9bf526ad 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2953,7 +2953,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
- this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, event.getAmount());
|
||||
+ this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, event.getAmount(), getMaxAirSupply()); // Slice
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 51fd9bca61888861b58966a69cd1b63c742c44ca..3ed6e5d0c50c259c3df2b0cf84e2fb7ccf64def3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -633,7 +633,7 @@ public abstract class Player extends LivingEntity {
|
||||
public void increaseScore(int score) {
|
||||
int j = this.getScore();
|
||||
|
||||
- this.entityData.set(Player.DATA_SCORE_ID, j + score);
|
||||
+ this.entityData.set(Player.DATA_SCORE_ID, j + score, 0); // Slice
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 4ff4143f3a7cd89ef92f4b8882fa3e5addfe0f06..83495f9a7d92cd42c2f367891a0a04870a4a1577 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2004,7 +2004,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
this.sendHealthUpdate();
|
||||
}
|
||||
}
|
||||
- this.getHandle().getEntityData().set(LivingEntity.DATA_HEALTH_ID, (float) this.getScaledHealth());
|
||||
+ this.getHandle().getEntityData().set(LivingEntity.DATA_HEALTH_ID, (float) this.getScaledHealth(), isDead() ? 0f : 20f); // Slice
|
||||
|
||||
this.getHandle().maxHealthCache = getMaxHealth();
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 10 Oct 2021 13:36:38 -0500
|
||||
Subject: [PATCH] Smooth World Teleports
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 11f46c1b8f4c8414e0667d1873542c17d6e01f2a..fda2fedb0a24800e2690bba13d44c1cbfc3fb867 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -263,6 +263,7 @@ public class ServerPlayer extends Player {
|
||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
||||
public boolean needsChunkCenterUpdate; // Paper - no-tick view distance // Paper - public
|
||||
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
|
||||
+ public boolean smoothWorldTeleport; // Slice
|
||||
|
||||
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
|
||||
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index eaa005c1c9b4386bcdbe1d6eb28c3eca7635066c..86d00fdee17bce31a5caf370ede8a2dbc42e440b 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -940,11 +940,11 @@ public abstract class PlayerList {
|
||||
}
|
||||
// CraftBukkit start
|
||||
LevelData worlddata = worldserver1.getLevelData();
|
||||
- entityplayer1.connection.send(new ClientboundRespawnPacket(worldserver1.dimensionType(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), flag));
|
||||
+ if (!entityplayer.smoothWorldTeleport) entityplayer1.connection.send(new ClientboundRespawnPacket(worldserver1.dimensionType(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), flag));
|
||||
entityplayer1.connection.send(new ClientboundSetChunkCacheRadiusPacket(worldserver1.getChunkSource().chunkMap.playerChunkManager.getLoadDistance())); // Spigot // Paper - no-tick view distance// Paper - replace old player chunk management
|
||||
entityplayer1.setLevel(worldserver1);
|
||||
entityplayer1.unsetRemoved();
|
||||
- entityplayer1.connection.teleport(new Location(worldserver1.getWorld(), entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot()));
|
||||
+ if (!entityplayer.smoothWorldTeleport) entityplayer1.connection.teleport(new Location(worldserver1.getWorld(), entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot()));
|
||||
entityplayer1.setShiftKeyDown(false);
|
||||
|
||||
// entityplayer1.connection.b(entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
|
||||
@@ -1,41 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 18 Oct 2021 08:52:40 -0500
|
||||
Subject: [PATCH] World Instance Flag
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index d40a367670ccea01978cabf7d45f3c1a690662fc..d9d7edebbdb65990ade0c8e3c0e8bddd80927c2e 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -200,6 +200,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
public final UUID uuid;
|
||||
public boolean hasPhysicsEvent = true; // Paper
|
||||
public boolean hasEntityMoveEvent = false; // Paper
|
||||
+ public boolean instance; // Slice
|
||||
public static Throwable getAddToWorldStackTrace(Entity entity) {
|
||||
return new Throwable(entity + " Added to world at " + new java.util.Date());
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 858e29ad77aee8a1b7797c2d82902abbfd662da2..135bb95bda500f24ceef664dc522dd02570822fe 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -1197,6 +1197,18 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
world.noSave = !value;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ @Override
|
||||
+ public boolean isInstance() {
|
||||
+ return world.instance;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setInstance(boolean value) {
|
||||
+ world.instance = value;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@Override
|
||||
public void setDifficulty(Difficulty difficulty) {
|
||||
this.getHandle().serverLevelData.setDifficulty(net.minecraft.world.Difficulty.byId(difficulty.getValue()));
|
||||
@@ -1,94 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 29 Oct 2021 10:22:23 -0500
|
||||
Subject: [PATCH] Block Mob Spawns globally by EntityType
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 2509a170b8ddd812ad5be49e5345ec5a3c0cf2b8..6a0726ec0882a67d2cc6b652010e2b02a75b3833 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -665,4 +665,16 @@ public class PaperConfig {
|
||||
private static void sendFullPosForHardCollidingEntities() {
|
||||
sendFullPosForHardCollidingEntities = getBoolean("settings.send-full-pos-for-hard-colliding-entities", true);
|
||||
}
|
||||
+
|
||||
+ // Slice start
|
||||
+ public static java.util.Set<net.minecraft.world.entity.EntityType<?>> globalBlockedMobSpawnTypes = new java.util.HashSet<>();
|
||||
+
|
||||
+ private static void globalBlockedMobSpawnTypes() {
|
||||
+ java.util.List<String> list = getList("settings.global-blocked-mobspawn-types", java.util.Collections.emptyList());
|
||||
+ for (String type : list) {
|
||||
+ java.util.Optional<net.minecraft.world.entity.EntityType<?>> entityType = net.minecraft.world.entity.EntityType.byString(type.toLowerCase());
|
||||
+ entityType.ifPresent(eType -> globalBlockedMobSpawnTypes.add(eType));
|
||||
+ }
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java b/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
|
||||
index 86528ff031014e788d72a8bf7c1c9443512096bb..f66e6f750136fc3903acbcb7502e98e21e75fe5a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
|
||||
@@ -41,9 +41,10 @@ public class MobSpawnSettings {
|
||||
}), Codec.BOOL.fieldOf("player_spawn_friendly").orElse(false).forGetter(MobSpawnSettings::playerSpawnFriendly)).apply(instance, MobSpawnSettings::new);
|
||||
});
|
||||
private final float creatureGenerationProbability;
|
||||
- private final Map<MobCategory, WeightedRandomList<MobSpawnSettings.SpawnerData>> spawners;
|
||||
- private final Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> mobSpawnCosts;
|
||||
+ private Map<MobCategory, WeightedRandomList<MobSpawnSettings.SpawnerData>> spawners; // Slice
|
||||
+ private Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> mobSpawnCosts; // Slice
|
||||
private final boolean playerSpawnFriendly;
|
||||
+ private boolean stripped; // Slice
|
||||
|
||||
MobSpawnSettings(float creatureSpawnProbability, Map<MobCategory, WeightedRandomList<MobSpawnSettings.SpawnerData>> spawners, Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> spawnCosts, boolean playerSpawnFriendly) {
|
||||
this.creatureGenerationProbability = creatureSpawnProbability;
|
||||
@@ -52,12 +53,49 @@ public class MobSpawnSettings {
|
||||
this.playerSpawnFriendly = playerSpawnFriendly;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ // This very stupid thing is because Mob Spawning Biome data is statically registered before CraftServer
|
||||
+ // is even created. As a result, we need to lazily rebuild our spawning data here which is very cool and very
|
||||
+ // stupid. But it should only really happen once up front, so isn't the end of the world
|
||||
+ private void stripSpawnData() {
|
||||
+ if (com.destroystokyo.paper.PaperConfig.globalBlockedMobSpawnTypes.isEmpty()) {
|
||||
+ stripped = true;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> finalMobSpawnCosts = new java.util.HashMap<>();
|
||||
+ for (Entry<EntityType<?>, MobSpawnSettings.MobSpawnCost> entry : mobSpawnCosts.entrySet()) {
|
||||
+ if (!com.destroystokyo.paper.PaperConfig.globalBlockedMobSpawnTypes.contains(entry.getKey())) {
|
||||
+ finalMobSpawnCosts.put(entry.getKey(), entry.getValue());
|
||||
+ }
|
||||
+ }
|
||||
+ this.mobSpawnCosts = ImmutableMap.copyOf(finalMobSpawnCosts);
|
||||
+
|
||||
+ Map<MobCategory, WeightedRandomList<MobSpawnSettings.SpawnerData>> finalSpawners = new java.util.HashMap<>();
|
||||
+ for (Entry<MobCategory, WeightedRandomList<SpawnerData>> entry : spawners.entrySet()) {
|
||||
+ List<SpawnerData> finalSpawnerData = new java.util.ArrayList<>();
|
||||
+ for (SpawnerData spawnerData : entry.getValue().unwrap()) {
|
||||
+ if (!com.destroystokyo.paper.PaperConfig.globalBlockedMobSpawnTypes.contains(spawnerData.type)) {
|
||||
+ finalSpawnerData.add(spawnerData);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ finalSpawners.put(entry.getKey(), finalSpawnerData.isEmpty() ? EMPTY_MOB_LIST : WeightedRandomList.create(finalSpawnerData));
|
||||
+ }
|
||||
+
|
||||
+ this.spawners = ImmutableMap.copyOf(finalSpawners);
|
||||
+ stripped = true;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
public WeightedRandomList<MobSpawnSettings.SpawnerData> getMobs(MobCategory spawnGroup) {
|
||||
+ if (!stripped) stripSpawnData(); // Slice
|
||||
return this.spawners.getOrDefault(spawnGroup, EMPTY_MOB_LIST);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public MobSpawnSettings.MobSpawnCost getMobSpawnCost(EntityType<?> entityType) {
|
||||
+ if (!stripped) stripSpawnData(); // Slice
|
||||
return this.mobSpawnCosts.get(entityType);
|
||||
}
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 29 Oct 2021 17:06:43 -0500
|
||||
Subject: [PATCH] Very far tracking range
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 9f32296ca4afaa7f2c0dd920a4c994af7a815ec3..2b2fb92cbfeed75276f054e6f04e21b37d28b49b 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1994,8 +1994,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper end
|
||||
if (!(entity instanceof EnderDragonPart)) {
|
||||
EntityType<?> entitytypes = entity.getType();
|
||||
- int i = entitytypes.clientTrackingRange() * 16;
|
||||
- i = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, i); // Spigot
|
||||
+ // Slice
|
||||
+ int i;
|
||||
+ if (entity.visibleFromVeryFar) {
|
||||
+ i = 128;
|
||||
+ } else {
|
||||
+ i = entitytypes.clientTrackingRange() * 16;
|
||||
+ i = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, i); // Spigot
|
||||
+ }
|
||||
+ // Slice end
|
||||
|
||||
if (i != 0) {
|
||||
int j = entitytypes.updateInterval();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 7c3cd4d613489e5ad68a15f59b076668cbc82c5e..b9f85c52ee8af7349b3600a7a45f37c593ed761d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -339,6 +339,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
public void inactiveTick() { }
|
||||
// Spigot end
|
||||
|
||||
+ public boolean visibleFromVeryFar; // Slice
|
||||
+
|
||||
public float getBukkitYaw() {
|
||||
return this.yRot;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 986f045a2e6a040c6e2aab7420c8cb2d4ac3a726..eb18db47313ebefb4e66a92f072931186245e968 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -1067,6 +1067,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
this.getHandle().setSilent(flag);
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ public void setVisibleFromVeryFar(boolean flag) {
|
||||
+ this.getHandle().visibleFromVeryFar = flag;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@Override
|
||||
public boolean hasGravity() {
|
||||
return !this.getHandle().isNoGravity();
|
||||
@@ -1,18 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 30 Nov 2021 12:04:50 -0600
|
||||
Subject: [PATCH] PlayerTrackEntityEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 6e9c5e210270647205499801b235849d20776156..bae3f9447d9dbb6cc48fe4878ac2d57c4d28b9d7 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -362,6 +362,7 @@ public class ServerEntity {
|
||||
}
|
||||
}
|
||||
|
||||
+ this.entity.level.getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerTrackEntityEvent(entityplayer.getBukkitEntity().getPlayer(), this.entity.getBukkitEntity())); // Slice
|
||||
}
|
||||
|
||||
private void sendDirtyEntityData() {
|
||||
@@ -1,121 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Tue, 7 Dec 2021 07:59:41 -0600
|
||||
Subject: [PATCH] Add BlockDestroyedByNeighborEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index b03eacbef3cf15b70ec012af0870975d3e8e8cba..d792f9ad494f01d6ca78704a9fadf445e0d4e65e 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -606,6 +606,8 @@ public class ServerPlayerGameMode {
|
||||
enuminteractionresult1 = stack.placeItem(itemactioncontext, hand);
|
||||
}
|
||||
|
||||
+ world.pendingPlayerBlockEvents.remove(blockposition); // Paper
|
||||
+
|
||||
if (enuminteractionresult1.consumesAction()) {
|
||||
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, blockposition, itemstack1);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
index 9f3355dbbbab1ab88cf2b7034130c2888e38d7a7..ec43aa3661bc891a17670aec54d3f009c29b463b 100644
|
||||
--- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
+++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
@@ -201,7 +201,12 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
- protected String toJson() {
|
||||
+ // Slice start - OBFHELPER
|
||||
+ public String toJson() {
|
||||
+ return serialize().toString();
|
||||
+ }
|
||||
+
|
||||
+ public JsonObject serialize() { // Slice end
|
||||
Map<StatType<?>, JsonObject> map = Maps.newHashMap();
|
||||
ObjectIterator objectiterator = this.stats.object2IntEntrySet().iterator();
|
||||
|
||||
@@ -227,7 +232,7 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
|
||||
jsonobject1.add("stats", jsonobject);
|
||||
jsonobject1.addProperty("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion());
|
||||
- return jsonobject1.toString();
|
||||
+ return jsonobject1; // Slice
|
||||
}
|
||||
|
||||
private static <T> ResourceLocation getKey(Stat<T> stat) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
index 35c39aed9583275ef25d32c783715798b52bdb63..258813e65b521dccb19f4f3248588a7106a1e24b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
@@ -33,6 +33,7 @@ public class PlayerDataStorage {
|
||||
|
||||
public void save(Player player) {
|
||||
if (org.spigotmc.SpigotConfig.disablePlayerDataSaving) return; // Spigot
|
||||
+ if (!new com.destroystokyo.paper.event.player.PlayerSaveDataEvent((org.bukkit.entity.Player) player.getBukkitEntity()).callEvent()) return; // Slice
|
||||
try {
|
||||
CompoundTag nbttagcompound = player.saveWithoutId(new CompoundTag());
|
||||
File file = File.createTempFile(player.getStringUUID() + "-", ".dat", this.playerDir);
|
||||
@@ -52,32 +53,40 @@ public class PlayerDataStorage {
|
||||
public CompoundTag load(Player player) {
|
||||
CompoundTag nbttagcompound = null;
|
||||
|
||||
- try {
|
||||
- File file = new File(this.playerDir, player.getStringUUID() + ".dat");
|
||||
- // Spigot Start
|
||||
- boolean usingWrongFile = false;
|
||||
- if ( org.bukkit.Bukkit.getOnlineMode() && !file.exists() ) // Paper - Check online mode first
|
||||
- {
|
||||
- file = new File( this.playerDir, java.util.UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + player.getScoreboardName() ).getBytes( "UTF-8" ) ).toString() + ".dat");
|
||||
- if ( file.exists() )
|
||||
+ // Slice start - If event supplies playerdata, use it. Otherwise just load from disk as usual
|
||||
+ com.destroystokyo.paper.event.player.PlayerLoadDataEvent event = new com.destroystokyo.paper.event.player.PlayerLoadDataEvent(player.getUUID());
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+
|
||||
+ Object playerData = event.getPlayerData();
|
||||
+ if (playerData != null) {
|
||||
+ nbttagcompound = (CompoundTag) playerData;
|
||||
+ } else {
|
||||
+ try {
|
||||
+ File file = new File(this.playerDir, player.getStringUUID() + ".dat");
|
||||
+ // Spigot Start
|
||||
+ boolean usingWrongFile = false;
|
||||
+ if (org.bukkit.Bukkit.getOnlineMode() && !file.exists()) // Paper - Check online mode first
|
||||
{
|
||||
- usingWrongFile = true;
|
||||
- org.bukkit.Bukkit.getServer().getLogger().warning( "Using offline mode UUID file for player " + player.getScoreboardName() + " as it is the only copy we can find." );
|
||||
+ file = new File(this.playerDir, java.util.UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getScoreboardName()).getBytes("UTF-8")).toString() + ".dat");
|
||||
+ if (file.exists()) {
|
||||
+ usingWrongFile = true;
|
||||
+ org.bukkit.Bukkit.getServer().getLogger().warning("Using offline mode UUID file for player " + player.getScoreboardName() + " as it is the only copy we can find.");
|
||||
+ }
|
||||
}
|
||||
- }
|
||||
- // Spigot End
|
||||
+ // Spigot End
|
||||
|
||||
- if (file.exists() && file.isFile()) {
|
||||
- nbttagcompound = NbtIo.readCompressed(file);
|
||||
- }
|
||||
- // Spigot Start
|
||||
- if ( usingWrongFile )
|
||||
- {
|
||||
- file.renameTo( new File( file.getPath() + ".offline-read" ) );
|
||||
+ if (file.exists() && file.isFile()) {
|
||||
+ nbttagcompound = NbtIo.readCompressed(file);
|
||||
+ }
|
||||
+ // Spigot Start
|
||||
+ if (usingWrongFile) {
|
||||
+ file.renameTo(new File(file.getPath() + ".offline-read"));
|
||||
+ }
|
||||
+ // Spigot End
|
||||
+ } catch (Exception exception) {
|
||||
+ PlayerDataStorage.LOGGER.warn("Failed to load player data for {}", player.getName().getString());
|
||||
}
|
||||
- // Spigot End
|
||||
- } catch (Exception exception) {
|
||||
- PlayerDataStorage.LOGGER.warn("Failed to load player data for {}", player.getName().getString());
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
if (nbttagcompound != null) {
|
||||
Reference in New Issue
Block a user