More Pager Use
This commit is contained in:
parent
0d9a3b47ba
commit
cfda6796e4
@ -1,8 +1,5 @@
|
||||
package com.massivecraft.massivecore.cmd.massivecore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.massivecore.Aspect;
|
||||
import com.massivecraft.massivecore.AspectColl;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
@ -10,6 +7,8 @@ import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.ArgSetting;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.pager.Pager;
|
||||
import com.massivecraft.massivecore.pager.Stringifier;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class CmdMassiveCoreUsysAspectList extends MassiveCommand
|
||||
@ -40,17 +39,18 @@ public class CmdMassiveCoreUsysAspectList extends MassiveCommand
|
||||
// Args
|
||||
int page = this.readArg();
|
||||
|
||||
// Create Lines
|
||||
List<String> lines = new ArrayList<String>();
|
||||
|
||||
for (Aspect aspect : AspectColl.get().getAllRegistered())
|
||||
// Pager Create
|
||||
Pager<Aspect> pager = new Pager<Aspect>(this, "Aspect List", page, AspectColl.get().getAllRegistered(), new Stringifier<Aspect>()
|
||||
{
|
||||
String line = Txt.parse("<h>"+aspect.getId()+" <white>--> <h>"+aspect.getMultiverse().getId());
|
||||
lines.add(line);
|
||||
}
|
||||
@Override
|
||||
public String toString(Aspect aspect, int index)
|
||||
{
|
||||
return Txt.parse("<h>"+aspect.getId()+" <white>--> <h>"+aspect.getMultiverse().getId());
|
||||
}
|
||||
});
|
||||
|
||||
// Send them
|
||||
this.message(Txt.getPage(lines, page, "Aspect List", this));
|
||||
// Pager Message
|
||||
pager.message();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
package com.massivecraft.massivecore.cmd.massivecore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
@ -10,6 +7,8 @@ import com.massivecraft.massivecore.MultiverseColl;
|
||||
import com.massivecraft.massivecore.cmd.ArgSetting;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.pager.Pager;
|
||||
import com.massivecraft.massivecore.pager.Stringifier;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class CmdMassiveCoreUsysMultiverseList extends MassiveCommand
|
||||
@ -40,16 +39,18 @@ public class CmdMassiveCoreUsysMultiverseList extends MassiveCommand
|
||||
// Args
|
||||
int page = this.readArg();
|
||||
|
||||
// Create Lines
|
||||
List<String> lines = new ArrayList<String>();
|
||||
for (Multiverse multiverse : MultiverseColl.get().getAll())
|
||||
// Pager Create
|
||||
Pager<Multiverse> pager = new Pager<Multiverse>(this, "Multiverse List", page, MultiverseColl.get().getAll(), new Stringifier<Multiverse>()
|
||||
{
|
||||
String line = Txt.parse("<h>"+multiverse.getId()+" <i>has "+Txt.implodeCommaAndDot(multiverse.getUniverses(), "<aqua>%s", "<i>, ", " <i>and ", "<i>."));
|
||||
lines.add(line);
|
||||
}
|
||||
@Override
|
||||
public String toString(Multiverse multiverse, int index)
|
||||
{
|
||||
return Txt.parse("<h>"+multiverse.getId()+" <i>has "+Txt.implodeCommaAndDot(multiverse.getUniverses(), "<aqua>%s", "<i>, ", " <i>and ", "<i>."));
|
||||
}
|
||||
});
|
||||
|
||||
// Send them
|
||||
this.message(Txt.getPage(lines, page, "Multiverse List", this));
|
||||
// Pager Message
|
||||
pager.message();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user