mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 11:27:35 +01:00
Fix and clean up MapItemSavedData Spigot patch
It's been dysfunctional for a good while, though I don't think it's even needed. That can be investigated later
This commit is contained in:
parent
e6559c5533
commit
a15bb2bbd0
@ -1097,7 +1097,7 @@
|
|||||||
String string = "onTrackingStart called during navigation iteration";
|
String string = "onTrackingStart called during navigation iteration";
|
||||||
Util.logAndPauseIfInIde(
|
Util.logAndPauseIfInIde(
|
||||||
"onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration")
|
"onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration")
|
||||||
@@ -1757,10 +_,61 @@
|
@@ -1757,10 +_,51 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
|
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
|
||||||
@ -1120,28 +1120,18 @@
|
|||||||
public void onTrackingEnd(Entity entity) {
|
public void onTrackingEnd(Entity entity) {
|
||||||
+ org.spigotmc.AsyncCatcher.catchOp("entity unregister"); // Spigot
|
+ org.spigotmc.AsyncCatcher.catchOp("entity unregister"); // Spigot
|
||||||
+ // Spigot start
|
+ // Spigot start
|
||||||
+ if ( entity instanceof Player )
|
+ // TODO I don't think this is needed anymore
|
||||||
+ {
|
+ if (entity instanceof Player player) {
|
||||||
+ com.google.common.collect.Streams.stream( ServerLevel.this.getServer().getAllLevels() ).map( ServerLevel::getDataStorage ).forEach( (worldData) ->
|
+ for (final ServerLevel level : ServerLevel.this.getServer().getAllLevels()) {
|
||||||
+ {
|
+ for (final Optional<net.minecraft.world.level.saveddata.SavedData> savedData : level.getDataStorage().cache.values()) {
|
||||||
+ for (Object o : worldData.cache.values() )
|
+ if (savedData.isEmpty() || !(savedData.get() instanceof MapItemSavedData map)) {
|
||||||
+ {
|
+ continue;
|
||||||
+ if ( o instanceof MapItemSavedData )
|
|
||||||
+ {
|
|
||||||
+ MapItemSavedData map = (MapItemSavedData) o;
|
|
||||||
+ map.carriedByPlayers.remove( (Player) entity );
|
|
||||||
+ for (
|
|
||||||
+ java.util.Iterator<net.minecraft.world.level.saveddata.maps.MapItemSavedData.HoldingPlayer> iter = map.carriedBy.iterator();
|
|
||||||
+ iter.hasNext();
|
|
||||||
+ ) {
|
|
||||||
+ if ( iter.next().player == entity )
|
|
||||||
+ {
|
|
||||||
+ iter.remove();
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
|
+ map.carriedByPlayers.remove(player);
|
||||||
|
+ map.carriedBy.removeIf(holdingPlayer -> holdingPlayer.player == player);
|
||||||
+ }
|
+ }
|
||||||
+ } );
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Spigot end
|
+ // Spigot end
|
||||||
+ // Spigot Start
|
+ // Spigot Start
|
||||||
|
@ -857,7 +857,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPortalCooldown(int cooldown) {
|
public void setPortalCooldown(int cooldown) {
|
||||||
this.getHandle().setPortalCooldown(cooldown);;
|
this.getHandle().setPortalCooldown(cooldown);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user