Skip to content

Commit

Permalink
fix: Move back to unix timestamp for cooldowns because I never should…
Browse files Browse the repository at this point in the history
… have listened to those two guys who claimed I should be using game time #705 #433 #432
  • Loading branch information
BlayTheNinth committed Dec 7, 2023
1 parent 68cdfb9 commit 4f217e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
public class PersistentPlayerWaystoneData implements IPlayerWaystoneData {
private static final String TAG_NAME = "WaystonesData";
private static final String ACTIVATED_WAYSTONES = "Waystones";
private static final String INVENTORY_BUTTON_COOLDOWN_UNTIL = "InventoryButtonCooldownUntilNew";
private static final String WARP_STONE_COOLDOWN_UNTIL = "WarpStoneCooldownUntilNew";
private static final String INVENTORY_BUTTON_COOLDOWN_UNTIL = "InventoryButtonCooldownUntilUnix";
private static final String WARP_STONE_COOLDOWN_UNTIL = "WarpStoneCooldownUntilUnix";

@Override
public void activateWaystone(Player player, IWaystone waystone) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ private static void applyCooldown(WarpMode warpMode, Player player, int cooldown
final Level level = player.level();
switch (warpMode) {
case INVENTORY_BUTTON ->
getPlayerWaystoneData(level).setInventoryButtonCooldownUntil(player, level.getGameTime() + cooldown * 20L);
case WARP_STONE -> getPlayerWaystoneData(level).setWarpStoneCooldownUntil(player, level.getGameTime() + cooldown * 20L);
getPlayerWaystoneData(level).setInventoryButtonCooldownUntil(player, System.currentTimeMillis() + cooldown * 20L);
case WARP_STONE -> getPlayerWaystoneData(level).setWarpStoneCooldownUntil(player, System.currentTimeMillis() + cooldown * 20L);
}
WaystoneSyncManager.sendWaystoneCooldowns(player);
}
Expand Down Expand Up @@ -513,7 +513,7 @@ public static long getWarpStoneCooldownUntil(Player player) {

public static long getWarpStoneCooldownLeft(Player player) {
long cooldownUntil = getWarpStoneCooldownUntil(player);
return Math.max(0, cooldownUntil - player.level().getGameTime());
return Math.max(0, cooldownUntil - System.currentTimeMillis());
}

public static void setWarpStoneCooldownUntil(Player player, long timeStamp) {
Expand All @@ -526,7 +526,7 @@ public static long getInventoryButtonCooldownUntil(Player player) {

public static long getInventoryButtonCooldownLeft(Player player) {
long cooldownUntil = getInventoryButtonCooldownUntil(player);
return Math.max(0, cooldownUntil - player.level().getGameTime());
return Math.max(0, cooldownUntil - System.currentTimeMillis());
}

public static void setInventoryButtonCooldownUntil(Player player, long timeStamp) {
Expand Down

0 comments on commit 4f217e3

Please sign in to comment.