Page ArgSetting

This commit is contained in:
Olof Larsson 2015-05-13 23:00:05 +02:00
parent 13a97293cd
commit 2795db4433
5 changed files with 13 additions and 13 deletions

View File

@ -189,7 +189,7 @@ public class ArgSetting<T>
// COMMONLY USED ARG SETTINGS // COMMONLY USED ARG SETTINGS
// -------------------------------------------- // // -------------------------------------------- //
public static ArgSetting<Integer> getPager() public static ArgSetting<Integer> getPage()
{ {
// We can't use a singletone, because people might // We can't use a singletone, because people might
// want to set a description. // want to set a description.

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.MassiveCommand; import com.massivecraft.massivecore.cmd.MassiveCommand;
import com.massivecraft.massivecore.cmd.arg.ARInteger;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class HelpCommand extends MassiveCommand public class HelpCommand extends MassiveCommand
@ -21,7 +20,7 @@ public class HelpCommand extends MassiveCommand
this.addAliases("?", "h", "help"); this.addAliases("?", "h", "help");
// Args // Args
this.addArg(ARInteger.get(), "page", "1"); this.addArg(ArgSetting.getPage());
// Other // Other
this.setDesc(""); this.setDesc("");
@ -35,7 +34,7 @@ public class HelpCommand extends MassiveCommand
public void perform() throws MassiveException public void perform() throws MassiveException
{ {
// Args // Args
int pagenumber = this.readArg(1); int page = this.readArg();
// Get parent command // Get parent command
if ( ! this.hasParentCommand()) return; if ( ! this.hasParentCommand()) return;
@ -57,7 +56,7 @@ public class HelpCommand extends MassiveCommand
} }
// Send Lines // Send Lines
sendMessage(Txt.getPage(lines, pagenumber, "Help for command \"" + parentCommand.getAliases().get(0) + "\"", sender)); sendMessage(Txt.getPage(lines, page, "Help for command \"" + parentCommand.getAliases().get(0) + "\"", sender));
} }
} }

View File

@ -20,7 +20,7 @@ public class CmdMassiveCoreBufferWhitespace extends MassiveCommand
this.addAliases("w", "whitespace"); this.addAliases("w", "whitespace");
// Args // Args
this.addArg(ARInteger.get(), "times", "1").setDesc("the amount of whitespace to add to your buffer"); this.addArg(1, ARInteger.get(), "times").setDesc("the amount of whitespace to add to your buffer");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.BUFFER_WHITESPACE.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.BUFFER_WHITESPACE.node));
@ -33,7 +33,7 @@ public class CmdMassiveCoreBufferWhitespace extends MassiveCommand
@Override @Override
public void perform() throws MassiveException public void perform() throws MassiveException
{ {
int times = this.readArg(1); int times = this.readArg();
String string = Txt.repeat(" ", times); String string = Txt.repeat(" ", times);

View File

@ -24,7 +24,7 @@ public class CmdMassiveCoreUsysAspectList extends MassiveCommand
this.addAliases("l", "list"); this.addAliases("l", "list");
// Args // Args
this.addArg(ArgSetting.getPager()).setDesc("the page in the aspect list"); this.addArg(ArgSetting.getPage()).setDesc("the page in the aspect list");
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_ASPECT_LIST.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_ASPECT_LIST.node));
@ -38,7 +38,7 @@ public class CmdMassiveCoreUsysAspectList extends MassiveCommand
public void perform() throws MassiveException public void perform() throws MassiveException
{ {
// Args // Args
int pageHumanBased = this.readArg(); int page = this.readArg();
// Create Lines // Create Lines
List<String> lines = new ArrayList<String>(); List<String> lines = new ArrayList<String>();
@ -50,7 +50,7 @@ public class CmdMassiveCoreUsysAspectList extends MassiveCommand
} }
// Send them // Send them
this.sendMessage(Txt.getPage(lines, pageHumanBased, "Aspect List", sender)); this.sendMessage(Txt.getPage(lines, page, "Aspect List", sender));
} }
} }

View File

@ -7,6 +7,7 @@ import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Multiverse; import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.MultiverseColl; import com.massivecraft.massivecore.MultiverseColl;
import com.massivecraft.massivecore.cmd.ArgSetting;
import com.massivecraft.massivecore.cmd.MassiveCommand; import com.massivecraft.massivecore.cmd.MassiveCommand;
import com.massivecraft.massivecore.cmd.arg.ARInteger; import com.massivecraft.massivecore.cmd.arg.ARInteger;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
@ -24,7 +25,7 @@ public class CmdMassiveCoreUsysMultiverseList extends MassiveCommand
this.addAliases("l", "list"); this.addAliases("l", "list");
// Args // Args
this.addArg(ARInteger.get(), "page", "1").setDesc("the page in the multiverse list"); this.addArg(ArgSetting.getPage());
// Requirements // Requirements
this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_MULTIVERSE_LIST.node)); this.addRequirements(ReqHasPerm.get(MassiveCorePerm.USYS_MULTIVERSE_LIST.node));
@ -38,7 +39,7 @@ public class CmdMassiveCoreUsysMultiverseList extends MassiveCommand
public void perform() throws MassiveException public void perform() throws MassiveException
{ {
// Args // Args
int pageHumanBased = this.readArg(1); int page = this.readArg();
// Create Lines // Create Lines
List<String> lines = new ArrayList<String>(); List<String> lines = new ArrayList<String>();
@ -49,7 +50,7 @@ public class CmdMassiveCoreUsysMultiverseList extends MassiveCommand
} }
// Send them // Send them
this.sendMessage(Txt.getPage(lines, pageHumanBased, "Multiverse List", sender)); this.sendMessage(Txt.getPage(lines, page, "Multiverse List", sender));
} }
} }