|
1 | 1 | --- a/net/minecraft/server/level/Ticket.java
|
2 | 2 | +++ b/net/minecraft/server/level/Ticket.java
|
3 |
| -@@ -66,4 +_,13 @@ |
4 |
| - public boolean isTimedOut() { |
5 |
| - return this.type.hasTimeout() && this.ticksLeft < 0L; |
6 |
| - } |
| 3 | +@@ -14,17 +_,36 @@ |
| 4 | + ExtraCodecs.NON_NEGATIVE_INT.fieldOf("level").forGetter(Ticket::getTicketLevel), |
| 5 | + Codec.LONG.optionalFieldOf("ticks_left", 0L).forGetter(ticket -> ticket.ticksLeft) |
| 6 | + ) |
| 7 | +- .apply(instance, Ticket::new) |
| 8 | ++ .apply(instance, (type, level, ticks) -> new Ticket(type, level.intValue(), ticks.longValue())) // Paper - add identifier |
| 9 | + ); |
| 10 | + private final TicketType type; |
| 11 | + private final int ticketLevel; |
| 12 | + private long ticksLeft; |
| 13 | ++ // Paper start - add identifier |
| 14 | ++ private Object identifier; |
| 15 | ++ |
| 16 | ++ public Object getIdentifier() { |
| 17 | ++ return this.identifier; |
| 18 | ++ } |
| 19 | ++ // Paper end - add identifier |
7 | 20 | +
|
8 |
| -+ // Paper start - plugin chunk tickets |
9 |
| -+ public [email protected] Plugin key; |
10 |
| -+ public Ticket withPluginRef(org.bukkit.plugin.Plugin plugin) { |
11 |
| -+ com.google.common.base.Preconditions.checkState(this.type == net.minecraft.server.level.TicketType.PLUGIN_TICKET); |
12 |
| -+ this.key = plugin; |
13 |
| -+ return this; |
| 21 | + |
| 22 | + public Ticket(TicketType type, int ticketLevel) { |
| 23 | +- this(type, ticketLevel, type.timeout()); |
| 24 | ++ // Paper start - add identifier |
| 25 | ++ this(type, ticketLevel, null); |
| 26 | ++ } |
| 27 | ++ public Ticket(TicketType type, int ticketLevel, Object identifier) { |
| 28 | ++ this(type, ticketLevel, type.timeout(), identifier); |
| 29 | ++ // Paper end - add identifier |
| 30 | + } |
| 31 | + |
| 32 | + private Ticket(TicketType type, int ticketLevel, long ticksLeft) { |
| 33 | ++ // Paper start - add identifier |
| 34 | ++ this(type, ticketLevel, ticksLeft, null); |
14 | 35 | + }
|
15 |
| -+ // Paper end - plugin chunk tickets |
16 |
| - } |
| 36 | ++ private Ticket(TicketType type, int ticketLevel, long ticksLeft, Object identifier) { |
| 37 | ++ this.identifier = identifier; |
| 38 | ++ // Paper end - add identifier |
| 39 | + this.type = type; |
| 40 | + this.ticketLevel = ticketLevel; |
| 41 | + this.ticksLeft = ticksLeft; |
0 commit comments