SPIGOT-6934: Bring plugin chunk tickets back in line with forceload tickets
This commit is contained in:
parent
1e87776acb
commit
af4d848ffd
@ -56,7 +56,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (arraysetsorted.isEmpty()) {
|
if (arraysetsorted.isEmpty()) {
|
||||||
@@ -188,16 +205,29 @@
|
@@ -188,6 +205,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ticketTracker.update(i, getTicketLevelAt(arraysetsorted), false);
|
this.ticketTracker.update(i, getTicketLevelAt(arraysetsorted), false);
|
||||||
@ -64,32 +64,43 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public <T> void addTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
public <T> void addTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||||
- this.addTicket(chunkcoordintpair.toLong(), new Ticket<>(tickettype, i, t0));
|
@@ -201,19 +219,33 @@
|
||||||
+ // CraftBukkit start
|
|
||||||
+ this.addTicketAtLevel(tickettype, chunkcoordintpair, i, t0);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public <T> boolean addTicketAtLevel(TicketType<T> ticketType, ChunkCoordIntPair chunkcoordintpair, int level, T identifier) {
|
|
||||||
+ return this.addTicket(chunkcoordintpair.toLong(), new Ticket<>(ticketType, level, identifier));
|
|
||||||
+ // CraftBukkit end
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T> void removeTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
|
||||||
- Ticket<T> ticket = new Ticket<>(tickettype, i, t0);
|
|
||||||
+ // CraftBukkit start
|
|
||||||
+ this.removeTicketAtLevel(tickettype, chunkcoordintpair, i, t0);
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- this.removeTicket(chunkcoordintpair.toLong(), ticket);
|
|
||||||
+ public <T> boolean removeTicketAtLevel(TicketType<T> ticketType, ChunkCoordIntPair chunkcoordintpair, int level, T identifier) {
|
|
||||||
+ Ticket<T> ticket = new Ticket<>(ticketType, level, identifier);
|
|
||||||
+
|
|
||||||
+ return this.removeTicket(chunkcoordintpair.toLong(), ticket);
|
|
||||||
+ // CraftBukkit end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> void addRegionTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
public <T> void addRegionTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||||
@@ -252,6 +282,7 @@
|
+ // CraftBukkit start
|
||||||
|
+ addRegionTicketAtDistance(tickettype, chunkcoordintpair, i, t0);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public <T> boolean addRegionTicketAtDistance(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||||
|
+ // CraftBukkit end
|
||||||
|
Ticket<T> ticket = new Ticket<>(tickettype, 33 - i, t0);
|
||||||
|
long j = chunkcoordintpair.toLong();
|
||||||
|
|
||||||
|
- this.addTicket(j, ticket);
|
||||||
|
+ boolean added = this.addTicket(j, ticket); // CraftBukkit
|
||||||
|
this.tickingTicketsTracker.addTicket(j, ticket);
|
||||||
|
+ return added; // CraftBukkit
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> void removeRegionTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||||
|
+ // CraftBukkit start
|
||||||
|
+ removeRegionTicketAtDistance(tickettype, chunkcoordintpair, i, t0);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public <T> boolean removeRegionTicketAtDistance(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||||
|
+ // CraftBukkit end
|
||||||
|
Ticket<T> ticket = new Ticket<>(tickettype, 33 - i, t0);
|
||||||
|
long j = chunkcoordintpair.toLong();
|
||||||
|
|
||||||
|
- this.removeTicket(j, ticket);
|
||||||
|
+ boolean removed = this.removeTicket(j, ticket); // CraftBukkit
|
||||||
|
this.tickingTicketsTracker.removeTicket(j, ticket);
|
||||||
|
+ return removed; // CraftBukkit
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArraySetSorted<Ticket<?>> getTickets(long i) {
|
||||||
|
@@ -252,6 +284,7 @@
|
||||||
ChunkCoordIntPair chunkcoordintpair = sectionposition.chunk();
|
ChunkCoordIntPair chunkcoordintpair = sectionposition.chunk();
|
||||||
long i = chunkcoordintpair.toLong();
|
long i = chunkcoordintpair.toLong();
|
||||||
ObjectSet<EntityPlayer> objectset = (ObjectSet) this.playersPerChunk.get(i);
|
ObjectSet<EntityPlayer> objectset = (ObjectSet) this.playersPerChunk.get(i);
|
||||||
@ -97,7 +108,7 @@
|
|||||||
|
|
||||||
objectset.remove(entityplayer);
|
objectset.remove(entityplayer);
|
||||||
if (objectset.isEmpty()) {
|
if (objectset.isEmpty()) {
|
||||||
@@ -347,6 +378,26 @@
|
@@ -347,6 +380,26 @@
|
||||||
return this.tickingTicketsTracker;
|
return this.tickingTicketsTracker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|||||||
|
|
||||||
ChunkMapDistance chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager;
|
ChunkMapDistance chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager;
|
||||||
|
|
||||||
if (chunkDistanceManager.addTicketAtLevel(TicketType.PLUGIN_TICKET, new ChunkCoordIntPair(x, z), 31, plugin)) { // keep in-line with force loading, add at level 31
|
if (chunkDistanceManager.addRegionTicketAtDistance(TicketType.PLUGIN_TICKET, new ChunkCoordIntPair(x, z), 2, plugin)) { // keep in-line with force loading, add at level 31
|
||||||
this.getChunkAt(x, z); // ensure loaded
|
this.getChunkAt(x, z); // ensure loaded
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -378,7 +378,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|||||||
Preconditions.checkNotNull(plugin, "null plugin");
|
Preconditions.checkNotNull(plugin, "null plugin");
|
||||||
|
|
||||||
ChunkMapDistance chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager;
|
ChunkMapDistance chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager;
|
||||||
return chunkDistanceManager.removeTicketAtLevel(TicketType.PLUGIN_TICKET, new ChunkCoordIntPair(x, z), 31, plugin); // keep in-line with force loading, remove at level 31
|
return chunkDistanceManager.removeRegionTicketAtDistance(TicketType.PLUGIN_TICKET, new ChunkCoordIntPair(x, z), 2, plugin); // keep in-line with force loading, remove at level 31
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user