Skip to content

Commit

Permalink
Fix wrong message on newbie expire
Browse files Browse the repository at this point in the history
  • Loading branch information
ChanceSD committed Jun 27, 2023
1 parent a9eb69e commit 577b781
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public final void setNewbie(final boolean newbie) {
message(Messages.getNewbieProtection().replace("%", Integer.toString(Settings.getNewbieProtectionTime())));
this.newbieTask = new NewbieTask(this, 0);
} else if (this.newbie && newbieTask != null) {
if (newbieTask.isScheduled()) {
if (newbieTask.isExpired()) {
message(Messages.getNewbieProtectionEnd());
} else {
message(Messages.getNewbieProtectionRemoved());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class NewbieTask implements Runnable {
private final PvPlayer player;
private final long finishTime;
private final ScheduledFuture<?> task;
private boolean expired;

public NewbieTask(final PvPlayer player, final long time) {
this.player = player;
Expand All @@ -25,15 +26,16 @@ public NewbieTask(final PvPlayer player, final long time) {

@Override
public final void run() {
this.expired = true;
player.setNewbie(false);
}

public synchronized void cancel() {
task.cancel(true);
}

public boolean isScheduled() {
return task.isDone();
public boolean isExpired() {
return this.expired;
}

public long getTimeleft() {
Expand Down

0 comments on commit 577b781

Please sign in to comment.