mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-17 12:30:13 +08:00
Add paging to mail.
Support aliases in rule and baltop output.
This commit is contained in:
parent
4fd026ff99
commit
53a7cd732f
@ -53,7 +53,7 @@ public class Commandbalancetop extends EssentialsCommand
|
||||
{
|
||||
if (cacheage > System.currentTimeMillis() - CACHETIME)
|
||||
{
|
||||
outputCache(sender, page);
|
||||
outputCache(sender, commandLabel, page);
|
||||
return;
|
||||
}
|
||||
if (ess.getUserMap().getUniqueUsers() > MINUSERS)
|
||||
@ -65,7 +65,7 @@ public class Commandbalancetop extends EssentialsCommand
|
||||
{
|
||||
lock.readLock().unlock();
|
||||
}
|
||||
ess.runTaskAsynchronously(new Viewer(sender, page, force));
|
||||
ess.runTaskAsynchronously(new Viewer(sender, commandLabel, page, force));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -73,12 +73,12 @@ public class Commandbalancetop extends EssentialsCommand
|
||||
{
|
||||
sender.sendMessage(tl("orderBalances", ess.getUserMap().getUniqueUsers()));
|
||||
}
|
||||
ess.runTaskAsynchronously(new Viewer(sender, page, force));
|
||||
ess.runTaskAsynchronously(new Viewer(sender, commandLabel, page, force));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void outputCache(final CommandSource sender, int page)
|
||||
private static void outputCache(final CommandSource sender, String command, int page)
|
||||
{
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(cacheage);
|
||||
@ -167,12 +167,14 @@ public class Commandbalancetop extends EssentialsCommand
|
||||
private final transient CommandSource sender;
|
||||
private final transient int page;
|
||||
private final transient boolean force;
|
||||
private final transient String commandLabel;
|
||||
|
||||
public Viewer(final CommandSource sender, final int page, final boolean force)
|
||||
public Viewer(final CommandSource sender, final String commandLabel, final int page, final boolean force)
|
||||
{
|
||||
this.sender = sender;
|
||||
this.page = page;
|
||||
this.force = force;
|
||||
this.commandLabel = commandLabel;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -183,7 +185,7 @@ public class Commandbalancetop extends EssentialsCommand
|
||||
{
|
||||
if (!force && cacheage > System.currentTimeMillis() - CACHETIME)
|
||||
{
|
||||
outputCache(sender, page);
|
||||
outputCache(sender, commandLabel, page);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -191,7 +193,7 @@ public class Commandbalancetop extends EssentialsCommand
|
||||
{
|
||||
lock.readLock().unlock();
|
||||
}
|
||||
ess.runTaskAsynchronously(new Calculator(new Viewer(sender, page, false), force));
|
||||
ess.runTaskAsynchronously(new Calculator(new Viewer(sender, commandLabel, page, false), force));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,10 @@ package com.earth2me.essentials.commands;
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.textreader.IText;
|
||||
import com.earth2me.essentials.textreader.SimpleTextInput;
|
||||
import com.earth2me.essentials.textreader.SimpleTextPager;
|
||||
import com.earth2me.essentials.textreader.TextPager;
|
||||
import com.earth2me.essentials.utils.FormatUtil;
|
||||
import com.earth2me.essentials.utils.StringUtil;
|
||||
import org.bukkit.Server;
|
||||
@ -34,10 +38,11 @@ public class Commandmail extends EssentialsCommand
|
||||
user.sendMessage(tl("noMail"));
|
||||
throw new NoChargeException();
|
||||
}
|
||||
for (String messages : mail)
|
||||
{
|
||||
user.sendMessage(messages);
|
||||
}
|
||||
|
||||
IText input = new SimpleTextInput(mail);
|
||||
final TextPager pager = new TextPager(input);
|
||||
pager.showPage(args.length > 1 ? args[1] : null, null, commandLabel + " " + args[0], user.getSource());
|
||||
|
||||
user.sendMessage(tl("mailClear"));
|
||||
return;
|
||||
}
|
||||
|
@ -26,6 +26,6 @@ public class Commandrules extends EssentialsCommand
|
||||
final IText input = new TextInput(sender, "rules", true, ess);
|
||||
final IText output = new KeywordReplacer(input, sender, ess);
|
||||
final TextPager pager = new TextPager(output);
|
||||
pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, "rules", sender);
|
||||
pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, commandLabel, sender);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user