@Override public void perform() { Faction faction = this.arg(0, ARFaction.get(), msenderFaction); if (faction == null) return; if (!this.argIsSet(1)) { msg(Txt.titleize("Flags for " + faction.describeTo(msender, true))); for (FFlag flag : FFlag.values()) { msg(flag.getStateInfo(faction.getFlag(flag), true)); } return; } FFlag flag = this.arg(1, ARFFlag.get()); if (flag == null) return; if (!this.argIsSet(2)) { msg(Txt.titleize("Flag for " + faction.describeTo(msender, true))); msg(flag.getStateInfo(faction.getFlag(flag), true)); return; } Boolean targetValue = this.arg(2, ARBoolean.get()); if (targetValue == null) return; // Do the sender have the right to change flags? if (!Perm.FLAG_SET.has(sender, true)) return; // Do the change msg(Txt.titleize("Flag for " + faction.describeTo(msender, true))); faction.setFlag(flag, targetValue); msg(flag.getStateInfo(faction.getFlag(flag), true)); }
public CmdBookPowertool() { // Aliases this.addAliases("pt", "powertool"); // Args this.addArg(ARBoolean.get(), "true/false", "toggle"); // Requirements this.addRequirements(ReqHasPerm.get(Perm.POWERTOOL.node)); this.addRequirements(ReqIsPlayer.get()); }
public CmdFactionsPermSet() { // Aliases this.addAliases("set"); // Args this.addArg(ARMPerm.get(), "perm"); this.addArg(ARRel.get(), "relation"); this.addArg(ARBoolean.get(), "yes/no"); this.addArg(ARFaction.get(), "faction", "you"); // Requirements this.addRequirements(ReqHasPerm.get(Perm.PERM_SET.node)); }
@Override public void perform() throws MassiveException { // Args boolean old = msender.isSeeingChunk(); boolean targetDefault = !old; Boolean target = this.arg(0, ARBoolean.get(), targetDefault); String targetDesc = Txt.parse(target ? "<g>ON" : "<b>OFF"); // NoChange if (target.equals(old)) { msg("<i>See Chunk is already %s<i>.", targetDesc); return; } // Apply msender.setSeeingChunk(target); // Inform msg("<i>See Chunk is now %s<i>.", targetDesc); }