Reformat
This commit is contained in:
@@ -11,26 +11,35 @@ import org.bukkit.Bukkit;
|
||||
|
||||
public class CmdDisband extends FCommand {
|
||||
public CmdDisband() {
|
||||
super(); this.aliases.add("disband");
|
||||
super();
|
||||
this.aliases.add("disband");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("faction tag", "yours");
|
||||
|
||||
this.permission = Permission.DISBAND.node; this.disableOnLock = true;
|
||||
this.permission = Permission.DISBAND.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false;
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
// The faction, default to your own.. but null if console sender.
|
||||
Faction faction = this.argAsFaction(0, fme == null ? null : myFaction); if (faction == null) { return; }
|
||||
Faction faction = this.argAsFaction(0, fme == null ? null : myFaction);
|
||||
if (faction == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isMyFaction = fme == null ? false : faction == myFaction;
|
||||
|
||||
if (isMyFaction) {
|
||||
if (!assertMinRole(Role.ADMIN)) { return; }
|
||||
if (!assertMinRole(Role.ADMIN)) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!Permission.DISBAND_ANY.has(sender, true)) {
|
||||
return;
|
||||
@@ -38,13 +47,19 @@ public class CmdDisband extends FCommand {
|
||||
}
|
||||
|
||||
if (!faction.isNormal()) {
|
||||
msg("<i>You cannot disband the Wilderness, SafeZone, or WarZone."); return;
|
||||
} if (faction.isPermanent()) {
|
||||
msg("<i>This faction is designated as permanent, so you cannot disband it."); return;
|
||||
msg("<i>You cannot disband the Wilderness, SafeZone, or WarZone.");
|
||||
return;
|
||||
}
|
||||
if (faction.isPermanent()) {
|
||||
msg("<i>This faction is designated as permanent, so you cannot disband it.");
|
||||
return;
|
||||
}
|
||||
|
||||
FactionDisbandEvent disbandEvent = new FactionDisbandEvent(me, faction.getId());
|
||||
Bukkit.getServer().getPluginManager().callEvent(disbandEvent); if (disbandEvent.isCancelled()) { return; }
|
||||
Bukkit.getServer().getPluginManager().callEvent(disbandEvent);
|
||||
if (disbandEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Send FPlayerLeaveEvent for each player in the faction
|
||||
for (FPlayer fplayer : faction.getFPlayers()) {
|
||||
@@ -59,7 +74,8 @@ public class CmdDisband extends FCommand {
|
||||
} else {
|
||||
fplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getTag(fplayer));
|
||||
}
|
||||
} if (Conf.logFactionDisband) {
|
||||
}
|
||||
if (Conf.logFactionDisband) {
|
||||
P.p.log("The faction " + faction.getTag() + " (" + faction.getId() + ") was disbanded by " + (senderIsConsole ? "console command" : fme.getName()) + ".");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user