Archived
0

Fixed expired message not being printed

This commit is contained in:
BuildTools 2017-07-25 15:07:51 +02:00
parent 508aceb717
commit f051852d44

View File

@ -2,6 +2,8 @@ package net.nemez.chatapi.click;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import net.nemez.chatapi.ChatAPI;
public abstract class ClickCallback { public abstract class ClickCallback {
private boolean repeatable, async; private boolean repeatable, async;
@ -11,7 +13,7 @@ public abstract class ClickCallback {
public ClickCallback(boolean repeatable, boolean async, String expiredMessage) { public ClickCallback(boolean repeatable, boolean async, String expiredMessage) {
this.repeatable = repeatable; this.repeatable = repeatable;
this.async = async; this.async = async;
this.expiredMessage = expiredMessage; this.expiredMessage = ChatAPI.colorify(null, expiredMessage);
this.expired = false; this.expired = false;
} }
@ -20,6 +22,10 @@ public abstract class ClickCallback {
public final void execute(CommandSender sender) { public final void execute(CommandSender sender) {
if (!expired) { if (!expired) {
run(sender); run(sender);
}else{
if (sender != null) {
sender.sendMessage(expiredMessage);
}
} }
if (!repeatable) { if (!repeatable) {
expired = true; expired = true;