mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 17:18:37 +01:00
Fix further incorrect messages for jail countdowns (#3941)
Fixes #3939, fixes #3940.
This commit is contained in:
parent
36422ab22b
commit
1258d2f0a1
@ -598,7 +598,11 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
||||
|
||||
@Override
|
||||
public String getFormattedJailTime() {
|
||||
return DateUtil.formatDateDiff(getOnlineJailedTime() > 0 ? (System.currentTimeMillis() - getJailTimeout()) : getJailTimeout());
|
||||
return DateUtil.formatDateDiff(getOnlineJailedTime() > 0 ? getOnlineJailExpireTime() : getJailTimeout());
|
||||
}
|
||||
|
||||
private long getOnlineJailExpireTime() {
|
||||
return ((getOnlineJailedTime() - getBase().getStatistic(PLAY_ONE_TICK)) * 50) + System.currentTimeMillis();
|
||||
}
|
||||
|
||||
//Returns true if status expired during this check
|
||||
|
@ -79,6 +79,7 @@ public class Commandtogglejail extends EssentialsCommand {
|
||||
player.setJail(jailName);
|
||||
if (args.length > 2) {
|
||||
player.setJailTimeout(timeDiff);
|
||||
// 50 MSPT (milliseconds per tick)
|
||||
player.setOnlineJailedTime(ess.getSettings().isJailOnlineTime() ? ((player.getBase().getStatistic(PLAY_ONE_TICK)) + (timeDiff / 50)) : 0);
|
||||
}
|
||||
sender.sendMessage(timeDiff > 0 ? tl("playerJailedFor", player.getName(), DateUtil.formatDateDiff(finalDisplayTime)) : tl("playerJailed", player.getName()));
|
||||
@ -99,9 +100,12 @@ public class Commandtogglejail extends EssentialsCommand {
|
||||
}
|
||||
|
||||
if (args.length >= 2 && player.isJailed() && args[1].equalsIgnoreCase(player.getJail())) {
|
||||
final long timeDiff = DateUtil.parseDateDiff(getFinalArg(args, 2), true);
|
||||
final String unparsedTime = getFinalArg(args, 2);
|
||||
final long displayTimeDiff = DateUtil.parseDateDiff(unparsedTime, true);
|
||||
final long timeDiff = DateUtil.parseDateDiff(unparsedTime, true, ess.getSettings().isJailOnlineTime());
|
||||
player.setJailTimeout(timeDiff);
|
||||
sender.sendMessage(tl("jailSentenceExtended", DateUtil.formatDateDiff(timeDiff)));
|
||||
player.setOnlineJailedTime(ess.getSettings().isJailOnlineTime() ? ((player.getBase().getStatistic(PLAY_ONE_TICK)) + (timeDiff / 50)) : 0);
|
||||
sender.sendMessage(tl("jailSentenceExtended", DateUtil.formatDateDiff(displayTimeDiff)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user