New command unclaim all
This commit is contained in:
parent
6e00b16f38
commit
e4d798e9d6
@ -1,5 +1,5 @@
|
|||||||
name: Factions
|
name: Factions
|
||||||
version: 1.1.6
|
version: 1.1.7
|
||||||
main: com.bukkit.mcteam.factions.Factions
|
main: com.bukkit.mcteam.factions.Factions
|
||||||
commands:
|
commands:
|
||||||
f:
|
f:
|
||||||
|
@ -56,6 +56,16 @@ public class Board {
|
|||||||
flocationIds.remove(flocation);
|
flocationIds.remove(flocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void unclaimAll(int factionId) {
|
||||||
|
Iterator<Entry<FLocation, Integer>> iter = flocationIds.entrySet().iterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
Entry<FLocation, Integer> entry = iter.next();
|
||||||
|
if (entry.getValue().equals(factionId)) {
|
||||||
|
iter.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Is this coord NOT completely surrounded by coords claimed by the same faction?
|
// Is this coord NOT completely surrounded by coords claimed by the same faction?
|
||||||
// Simpler: Is there any nearby coord with a faction other than the faction here?
|
// Simpler: Is there any nearby coord with a faction other than the faction here?
|
||||||
public static boolean isBorderLocation(FLocation flocation) {
|
public static boolean isBorderLocation(FLocation flocation) {
|
||||||
|
@ -45,6 +45,7 @@ import org.mcteam.factions.commands.FCommandShow;
|
|||||||
import org.mcteam.factions.commands.FCommandTag;
|
import org.mcteam.factions.commands.FCommandTag;
|
||||||
import org.mcteam.factions.commands.FCommandTitle;
|
import org.mcteam.factions.commands.FCommandTitle;
|
||||||
import org.mcteam.factions.commands.FCommandUnclaim;
|
import org.mcteam.factions.commands.FCommandUnclaim;
|
||||||
|
import org.mcteam.factions.commands.FCommandUnclaimall;
|
||||||
import org.mcteam.factions.commands.FCommandVersion;
|
import org.mcteam.factions.commands.FCommandVersion;
|
||||||
import org.mcteam.factions.gson.Gson;
|
import org.mcteam.factions.gson.Gson;
|
||||||
import org.mcteam.factions.gson.GsonBuilder;
|
import org.mcteam.factions.gson.GsonBuilder;
|
||||||
@ -120,6 +121,7 @@ public class Factions extends JavaPlugin {
|
|||||||
commands.add(new FCommandTag());
|
commands.add(new FCommandTag());
|
||||||
commands.add(new FCommandTitle());
|
commands.add(new FCommandTitle());
|
||||||
commands.add(new FCommandUnclaim());
|
commands.add(new FCommandUnclaim());
|
||||||
|
commands.add(new FCommandUnclaimall());
|
||||||
commands.add(new FCommandVersion());
|
commands.add(new FCommandVersion());
|
||||||
|
|
||||||
// Ensure basefolder exists!
|
// Ensure basefolder exists!
|
||||||
|
@ -76,9 +76,9 @@ public class FCommandHelp extends FBaseCommand {
|
|||||||
helpPages.add(pageLines);
|
helpPages.add(pageLines);
|
||||||
|
|
||||||
pageLines = new ArrayList<String>();
|
pageLines = new ArrayList<String>();
|
||||||
pageLines.add( "Faction can claim land that will be protected." );
|
|
||||||
pageLines.add( new FCommandClaim().getUseageTemplate() );
|
pageLines.add( new FCommandClaim().getUseageTemplate() );
|
||||||
pageLines.add( new FCommandUnclaim().getUseageTemplate() );
|
pageLines.add( new FCommandUnclaim().getUseageTemplate() );
|
||||||
|
pageLines.add( new FCommandUnclaimall().getUseageTemplate() );
|
||||||
pageLines.add( new FCommandTag().getUseageTemplate() );
|
pageLines.add( new FCommandTag().getUseageTemplate() );
|
||||||
pageLines.add( new FCommandKick().getUseageTemplate() );
|
pageLines.add( new FCommandKick().getUseageTemplate() );
|
||||||
pageLines.add( new FCommandMod().getUseageTemplate() );
|
pageLines.add( new FCommandMod().getUseageTemplate() );
|
||||||
|
32
src/org/mcteam/factions/commands/FCommandUnclaimall.java
Normal file
32
src/org/mcteam/factions/commands/FCommandUnclaimall.java
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package org.mcteam.factions.commands;
|
||||||
|
|
||||||
|
import org.mcteam.factions.Board;
|
||||||
|
import org.mcteam.factions.Conf;
|
||||||
|
import org.mcteam.factions.Faction;
|
||||||
|
import org.mcteam.factions.struct.Role;
|
||||||
|
|
||||||
|
public class FCommandUnclaimall extends FBaseCommand {
|
||||||
|
|
||||||
|
public FCommandUnclaimall() {
|
||||||
|
aliases.add("unclaimall");
|
||||||
|
aliases.add("declaimall");
|
||||||
|
|
||||||
|
helpDescription = "Unclaim all of your factions land";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void perform() {
|
||||||
|
if ( ! assertHasFaction()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Faction myFaction = me.getFaction();
|
||||||
|
|
||||||
|
Board.unclaimAll(myFaction.getId());
|
||||||
|
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" unclaimed ALL of your factions land.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user