Make accidental faction disbanding more difficult

This commit is contained in:
Magnus Ulf 2019-01-19 12:21:28 +01:00
parent 84b66ba18b
commit 1e36c9f744
2 changed files with 13 additions and 5 deletions

View File

@ -12,6 +12,8 @@ import com.massivecraft.factions.event.EventFactionsDisband;
import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.type.primitive.TypeStringConfirmation;
import com.massivecraft.massivecore.util.ConfirmationUtil;
import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.Txt;
@ -24,7 +26,8 @@ public class CmdFactionsDisband extends FactionsCommand
public CmdFactionsDisband()
{
// Parameters
this.addParameter(TypeFaction.get(), "faction", "you");
this.addParameter(TypeFaction.get(), "faction");
this.addParameter(TypeStringConfirmation.get(), "confirmation", "");
}
// -------------------------------------------- //
@ -35,7 +38,10 @@ public class CmdFactionsDisband extends FactionsCommand
public void perform() throws MassiveException
{
// Args
Faction faction = this.readArg(msenderFaction);
Faction faction = this.readArg();
String confirmationString = this.readArg(null);
if(MConf.get().requireConfirmationForFactionDisbanding) ConfirmationUtil.tryConfirm(this);
// MPerm
if ( ! MPerm.getPermDisband().has(msender, faction, true)) return;
@ -43,8 +49,7 @@ public class CmdFactionsDisband extends FactionsCommand
// Verify
if (faction.getFlag(MFlag.getFlagPermanent()))
{
msg("<i>This faction is designated as permanent, so you cannot disband it.");
return;
throw new MassiveException().addMsg("<i>This faction is designated as permanent, so you cannot disband it.");
}
// Event

View File

@ -336,6 +336,9 @@ public class MConf extends Entity<MConf>
// through the denying of MPerm build
public boolean handlePistonProtectionThroughDenyBuild = true;
// Make faction disbanding a confirmation thing
public boolean requireConfirmationForFactionDisbanding = true;
// -------------------------------------------- //
// DENY COMMANDS
// -------------------------------------------- //