mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-26 19:18:29 +01:00
Fix kit timers, kit times more than 25 years will be treated as single use.
This commit is contained in:
parent
889f60e58e
commit
61903355cd
@ -37,7 +37,7 @@ public class Kit
|
||||
|
||||
}
|
||||
|
||||
public static void checkTime(final User user, final String kitName, final Map<String, Object> els) throws NoChargeException
|
||||
public static void checkTime(final User user, final String kitName, final Map<String, Object> els) throws Exception
|
||||
{
|
||||
if (user.isAuthorized("essentials.kit.exemptdelay")) {
|
||||
return;
|
||||
@ -46,7 +46,7 @@ public class Kit
|
||||
final Calendar time = new GregorianCalendar();
|
||||
|
||||
// Take the current time, and remove the delay from it.
|
||||
final double delay = els.containsKey("delay") ? ((Number)els.get("delay")).doubleValue() : 0L;
|
||||
final double delay = els.containsKey("delay") ? ((Number)els.get("delay")).doubleValue() : 0.0d;
|
||||
final Calendar earliestTime = new GregorianCalendar();
|
||||
earliestTime.add(Calendar.SECOND, -(int)delay);
|
||||
earliestTime.add(Calendar.MILLISECOND, -(int)((delay * 1000.0) % 1000.0));
|
||||
@ -56,7 +56,7 @@ public class Kit
|
||||
// When was the last kit used?
|
||||
final long lastTime = user.getKitTimestamp(kitName);
|
||||
|
||||
if (lastTime < earliestLong)
|
||||
if (lastTime < earliestLong || lastTime == 0L)
|
||||
{
|
||||
user.setKitTimestamp(kitName, time.getTimeInMillis());
|
||||
}
|
||||
@ -66,6 +66,11 @@ public class Kit
|
||||
// If this happens, let's give the user the benifit of the doubt.
|
||||
user.setKitTimestamp(kitName, time.getTimeInMillis());
|
||||
}
|
||||
else if (earliestLong < 0L)
|
||||
{
|
||||
user.sendMessage(_("kitOnce"));
|
||||
throw new NoChargeException();
|
||||
}
|
||||
else
|
||||
{
|
||||
time.setTimeInMillis(lastTime);
|
||||
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||
kitOnce=\u00a74You can't use that kit again.
|
||||
|
@ -465,3 +465,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||
kitOnce=\u00a74You can't use that kit again.
|
||||
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||
kitOnce=\u00a74You can't use that kit again.
|
||||
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||
kitOnce=\u00a74You can't use that kit again.
|
||||
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||
kitOnce=\u00a74You can't use that kit again.
|
||||
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Nombre de warp invalido
|
||||
userUnknown=\u00a74Peligro: El jugador '\u00a7c{0}\u00a74' Nunca a ingresado a este servidor.
|
||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||
kitOnce=\u00a74You can't use that kit again.
|
||||
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||
kitOnce=\u00a74You can't use that kit again.
|
||||
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Nom de warp invalide
|
||||
userUnknown=\u00a74Attention : Le joueur '\u00a7c{0}\u00a74' n'est jamais venu sur ce serveur.
|
||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||
kitOnce=\u00a74You can't use that kit again.
|
||||
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||
kitOnce=\u00a74You can't use that kit again.
|
||||
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||
kitOnce=\u00a74You can't use that kit again.
|
||||
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||
kitOnce=\u00a74You can't use that kit again.
|
||||
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||
kitOnce=\u00a74You can't use that kit again.
|
||||
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||
kitOnce=\u00a74You can't use that kit again.
|
||||
|
Loading…
Reference in New Issue
Block a user