Skip to content

Commit 094dd2b

Browse files
committed
fix old config removal
1 parent 00777fd commit 094dd2b

6 files changed

Lines changed: 12 additions & 14 deletions

File tree

paper-api/src/main/java/org/bukkit/event/world/ClockTimeSkipEvent.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import org.bukkit.event.Event;
55
import org.bukkit.event.HandlerList;
66
import org.jetbrains.annotations.ApiStatus;
7-
import org.jetbrains.annotations.NotNull;
7+
import org.jspecify.annotations.NullMarked;
88

99
/**
1010
* Called when the time skips for a world clock.
@@ -13,6 +13,7 @@
1313
*/
1414
// TODO - snapshot - 26.1 clock
1515
@ApiStatus.Experimental
16+
@NullMarked
1617
public class ClockTimeSkipEvent extends Event implements Cancellable {
1718

1819
private static final HandlerList HANDLER_LIST = new HandlerList();
@@ -23,7 +24,7 @@ public class ClockTimeSkipEvent extends Event implements Cancellable {
2324
private boolean cancelled;
2425

2526
@ApiStatus.Internal
26-
public ClockTimeSkipEvent(@NotNull SkipReason skipReason, long skipAmount) {
27+
public ClockTimeSkipEvent(final SkipReason skipReason, final long skipAmount) {
2728
this.skipReason = skipReason;
2829
this.skipAmount = skipAmount;
2930
}
@@ -33,7 +34,6 @@ public ClockTimeSkipEvent(@NotNull SkipReason skipReason, long skipAmount) {
3334
*
3435
* @return a SkipReason value detailing why the time has skipped
3536
*/
36-
@NotNull
3737
public SkipReason getSkipReason() {
3838
return this.skipReason;
3939
}
@@ -66,13 +66,11 @@ public void setCancelled(boolean cancel) {
6666
this.cancelled = cancel;
6767
}
6868

69-
@NotNull
7069
@Override
7170
public HandlerList getHandlers() {
7271
return HANDLER_LIST;
7372
}
7473

75-
@NotNull
7674
public static HandlerList getHandlerList() {
7775
return HANDLER_LIST;
7876
}

paper-server/patches/sources/net/minecraft/server/commands/TimeCommand.java.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
- return totalTicks;
4848
+ ServerClockManager clockManager = source.getLevel().clockManager();
4949
+ long currentTotalTicks = clockManager.getTotalTicks(clock);
50-
+ org.bukkit.event.world.ClockTimeSkipEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callTimeSkipEvent(source, totalTicks - currentTotalTicks);
50+
+ org.bukkit.event.world.ClockTimeSkipEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.createTimeSkipEvent(source, totalTicks - currentTotalTicks);
5151
+ final long newTotalTicks;
5252
+ if (event.callEvent()) {
5353
+ newTotalTicks = currentTotalTicks + event.getSkipAmount();
@@ -63,7 +63,7 @@
6363
- ServerClockManager clockManager = source.getServer().clockManager();
6464
- clockManager.addTicks(clock, time);
6565
+ ServerClockManager clockManager = source.getLevel().clockManager();
66-
+ org.bukkit.event.world.ClockTimeSkipEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callTimeSkipEvent(source, time);
66+
+ org.bukkit.event.world.ClockTimeSkipEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.createTimeSkipEvent(source, time);
6767
+ if (event.callEvent()) {
6868
+ clockManager.addTicks(clock, event.getSkipAmount());
6969
+ }
@@ -82,7 +82,7 @@
8282
throw ERROR_NO_TIME_MARKER_FOUND.create(clock.getRegisteredName(), timeMarkerId);
8383
} else {
8484
+ final long currentTime = clockManager.getTotalTicks(clock);
85-
+ final org.bukkit.event.world.ClockTimeSkipEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callTimeSkipEvent(source, targetTime.getAsLong() - currentTime);
85+
+ final org.bukkit.event.world.ClockTimeSkipEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.createTimeSkipEvent(source, targetTime.getAsLong() - currentTime);
8686
+ if (event.callEvent()) {
8787
+ clockManager.setTotalTicks(clock, currentTime + event.getSkipAmount());
8888
+ }

paper-server/patches/sources/net/minecraft/world/clock/ServerClockManager.java.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
);
55
private final PackedClockStates packedClockStates;
66
private MinecraftServer server;
7-
+ private @org.checkerframework.checker.nullness.qual.Nullable ServerLevel level; // Paper - per-world time
7+
+ private @org.jspecify.annotations.Nullable ServerLevel level; // Paper - per-world time
88
private final Map<Holder<WorldClock>, ServerClockManager.ClockInstance> clocks = new HashMap<>();
99

1010
private ServerClockManager(final PackedClockStates packedClockStates) {
@@ -15,7 +15,7 @@
1515
+ // Paper start - per-world time
1616
+ this.init(server, null);
1717
+ }
18-
+ public void init(final MinecraftServer server, @org.checkerframework.checker.nullness.qual.Nullable final ServerLevel level) {
18+
+ public void init(final MinecraftServer server, @org.jspecify.annotations.Nullable final ServerLevel level) {
1919
+ this.level = level;
2020
+ // Paper end - per-world time
2121
this.server = server;

paper-server/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal", "NotNullFieldNotInitialized", "InnerClassMayBeStatic"})
3131
public class GlobalConfiguration extends ConfigurationPart {
3232
private static final Logger LOGGER = LogUtils.getLogger();
33-
static final int CURRENT_VERSION = 32; // (when you change the version, change the comment, so it conflicts on rebases): rename all-worlds time config
33+
static final int CURRENT_VERSION = 31; // (when you change the version, change the comment, so it conflicts on rebases): allow-nether property to config
3434
private static GlobalConfiguration instance;
3535
public static boolean isFirstStart = false;
3636
public static GlobalConfiguration get() {

paper-server/src/main/java/io/papermc/paper/configuration/RemovedConfigurations.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ interface RemovedConfigurations {
5858
path("misc", "light-queue-size"),
5959
path("spawn", "keep-spawn-loaded"),
6060
path("spawn", "keep-spawn-loaded-range"),
61-
path("misc", "shield-blocking-delay"),
62-
path("command", "time-command-affects-all-worlds")
61+
path("misc", "shield-blocking-delay")
6362
};
6463

6564
NodePath[] REMOVED_GLOBAL_PATHS = {
@@ -88,6 +87,7 @@ interface RemovedConfigurations {
8887
path("chunk-system", "gen-parallelism"),
8988
path("logging"), // server is no longer obfuscated since 26.1
9089
path("unsupported-settings", "compression-format"),
90+
path("commands", "time-command-affects-all-worlds") // replaced with time.affects-all-worlds
9191
};
9292

9393
}

paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2421,7 +2421,7 @@ public static boolean callPlayerToggleEntityAgeLockEvent(net.minecraft.world.ent
24212421
return true;
24222422
}
24232423

2424-
public static ClockTimeSkipEvent callTimeSkipEvent(final CommandSourceStack source, final long skipAmount) {
2424+
public static ClockTimeSkipEvent createTimeSkipEvent(final CommandSourceStack source, final long skipAmount) {
24252425
if (io.papermc.paper.configuration.GlobalConfiguration.get().time.affectsAllWorlds) {
24262426
return new ClockTimeSkipEvent(ClockTimeSkipEvent.SkipReason.COMMAND, skipAmount);
24272427
}

0 commit comments

Comments
 (0)