mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-11-14 10:45:23 +01:00
Fix wrong formatting of cooldowns
This commit is contained in:
parent
22820632f9
commit
893ef67ff6
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>Minepacks</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.3</version>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:GeorgH93/Minepacks.git</connection>
|
||||
|
@ -14,8 +14,8 @@ Language:
|
||||
InvalidBackpack: "Invalid backpack."
|
||||
NotAllowedInBackpack: "&c{ItemName} is not allowed in the backpack."
|
||||
Open:
|
||||
#Parameter: {TimeLeft} time in seconds till he can reopen his backpack, {TimeSpanLeft}
|
||||
Cooldown: "&2Please wait {TimeSpanLeft} seconds till you reopen your backpack."
|
||||
#Parameter: {TimeLeft} time in seconds till the backpack can be reopened, {TimeSpanLeft} time formatted as string till the backpack can be reopened
|
||||
Cooldown: "[{\"text\":\"Please wait \",\"color\":\"dark_green\"},{\"text\":\"{TimeSpanLeft}\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"{TimeLeft} seconds\"}},{\"text\":\" till you reopen your backpack.\"}]"
|
||||
#Parameter: {CurrentGameMode}, {AllowedGameModes}
|
||||
WrongGameMode: "You are not allowed to open your backpack in your current game-mode."
|
||||
Clean:
|
||||
|
@ -11,7 +11,7 @@ Language:
|
||||
InvalidBackpack: "バックパックが無効です。"
|
||||
NotAllowedInBackpack: "&c{ItemName}はバックパックに入れることができません。"
|
||||
Open:
|
||||
Cooldown: "&2バックパックを開くまで{TimeSpanLeft}秒待ってください。"
|
||||
Cooldown: "&2バックパックを開くまで{TimeLeft}秒待ってください。"
|
||||
WrongGameMode: "現在のゲームモードでバックパックを開くことは許可されていません。"
|
||||
Clean:
|
||||
BackpackCleaned: "バックパックを削除しました。"
|
||||
|
@ -74,7 +74,7 @@ public void execute(@NotNull CommandSender sender, @NotNull String main, @NotNul
|
||||
long cd = plugin.getCooldownManager().getRemainingCooldown(player);
|
||||
if(cd > 0)
|
||||
{
|
||||
TimeSpan ts = new TimeSpan(cd, true);
|
||||
TimeSpan ts = TimeSpan.fromMilliseconds(cd);
|
||||
messageCooldown.send(sender, cd / 1000f, ts.toString());
|
||||
return;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 GeorgH93
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -27,6 +27,7 @@
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -58,7 +59,7 @@ public void close()
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
|
||||
public void setCooldown(Player player)
|
||||
public void setCooldown(@NotNull Player player)
|
||||
{
|
||||
final long cooldownTime = System.currentTimeMillis() + cooldown;
|
||||
if(syncCooldown)
|
||||
@ -69,12 +70,12 @@ public void setCooldown(Player player)
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public boolean isInCooldown(Player player)
|
||||
public boolean isInCooldown(@NotNull Player player)
|
||||
{
|
||||
return cooldowns.getOrDefault(player.getUniqueId(), 0L) > System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public long getRemainingCooldown(Player player)
|
||||
public long getRemainingCooldown(@NotNull Player player)
|
||||
{
|
||||
long cd = cooldowns.getOrDefault(player.getUniqueId(), 0L);
|
||||
if(cd > System.currentTimeMillis())
|
||||
|
Loading…
Reference in New Issue
Block a user