mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 17:18:37 +01:00
Fix baltop not working in command blocks (#5078)
This commit is contained in:
parent
0be056b9c2
commit
bdc5f4c830
@ -7,6 +7,7 @@ import com.earth2me.essentials.utils.NumberUtil;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import net.essentialsx.api.v2.services.BalanceTop;
|
import net.essentialsx.api.v2.services.BalanceTop;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.command.BlockCommandSender;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
@ -32,8 +33,15 @@ public class Commandbalancetop extends EssentialsCommand {
|
|||||||
final Calendar cal = Calendar.getInstance();
|
final Calendar cal = Calendar.getInstance();
|
||||||
cal.setTimeInMillis(ess.getBalanceTop().getCacheAge());
|
cal.setTimeInMillis(ess.getBalanceTop().getCacheAge());
|
||||||
final DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
|
final DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
|
||||||
sender.sendMessage(tl("balanceTop", format.format(cal.getTime())));
|
final Runnable runnable = () -> {
|
||||||
new TextPager(cache).showPage(Integer.toString(page), null, "balancetop", sender);
|
sender.sendMessage(tl("balanceTop", format.format(cal.getTime())));
|
||||||
|
new TextPager(cache).showPage(Integer.toString(page), null, "balancetop", sender);
|
||||||
|
};
|
||||||
|
if (sender.getSender() instanceof BlockCommandSender) {
|
||||||
|
ess.scheduleSyncDelayedTask(runnable);
|
||||||
|
} else {
|
||||||
|
runnable.run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user