Add edit config command.

This commit is contained in:
TheComputerGeek2 2017-02-21 23:22:08 -08:00
parent 87c06db63e
commit 398154b576
7 changed files with 75 additions and 0 deletions

View File

@ -84,6 +84,7 @@ permissions:
factions.unclaim.all: {description: unclaim all faction land, default: false} factions.unclaim.all: {description: unclaim all faction land, default: false}
factions.unsethome: {description: unset faction home, default: false} factions.unsethome: {description: unset faction home, default: false}
factions.unstuck: {description: teleport to nearest wilderness, default: false} factions.unstuck: {description: teleport to nearest wilderness, default: false}
factions.config: {description: edit the factions config, default: false}
factions.version: {description: see plugin version, default: false} factions.version: {description: see plugin version, default: false}
# -------------------------------------------- # # -------------------------------------------- #
# STAR NOTATION # STAR NOTATION
@ -167,6 +168,7 @@ permissions:
factions.unclaim.all: true factions.unclaim.all: true
factions.unsethome: true factions.unsethome: true
factions.unstuck: true factions.unstuck: true
factions.config: true
factions.version: true factions.version: true
# -------------------------------------------- # # -------------------------------------------- #
# KITS # KITS
@ -179,6 +181,7 @@ permissions:
default: false default: false
children: children:
factions.kit.rank2: true factions.kit.rank2: true
factions.config: true
factions.kit.rank2: factions.kit.rank2:
default: false default: false
children: children:

View File

@ -1,5 +1,9 @@
package com.massivecraft.factions; package com.massivecraft.factions;
import com.massivecraft.factions.cmd.type.TypeFactionChunkChangeType;
import com.massivecraft.factions.cmd.type.TypeRel;
import com.massivecraft.factions.event.EventFactionsChunkChangeType;
import com.massivecraft.massivecore.command.type.RegistryType;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import com.massivecraft.factions.adapter.BoardAdapter; import com.massivecraft.factions.adapter.BoardAdapter;
@ -122,6 +126,10 @@ public class Factions extends MassivePlugin
"<i>What factions exists and what players belong to them." "<i>What factions exists and what players belong to them."
); );
// Register types
RegistryType.register(Rel.class, TypeRel.get());
RegistryType.register(EventFactionsChunkChangeType.class, TypeFactionChunkChangeType.get());
// Register Faction accountId Extractor // Register Faction accountId Extractor
// TODO: Perhaps this should be placed in the econ integration somewhere? // TODO: Perhaps this should be placed in the econ integration somewhere?
MUtil.registerExtractor(String.class, "accountId", ExtractorFactionAccountId.get()); MUtil.registerExtractor(String.class, "accountId", ExtractorFactionAccountId.get());

View File

@ -85,6 +85,7 @@ public enum Perm implements Identified
UNCLAIM_ALL, UNCLAIM_ALL,
UNSETHOME, UNSETHOME,
UNSTUCK, UNSTUCK,
CONFIG,
VERSION, VERSION,
// END OF LIST // END OF LIST

View File

@ -68,6 +68,7 @@ public class CmdFactions extends FactionsCommand
public CmdFactionsDisband cmdFactionsDisband = new CmdFactionsDisband(); public CmdFactionsDisband cmdFactionsDisband = new CmdFactionsDisband();
public CmdFactionsPowerBoost cmdFactionsPowerBoost = new CmdFactionsPowerBoost(); public CmdFactionsPowerBoost cmdFactionsPowerBoost = new CmdFactionsPowerBoost();
public CmdFactionsSetpower cmdFactionsSetpower = new CmdFactionsSetpower(); public CmdFactionsSetpower cmdFactionsSetpower = new CmdFactionsSetpower();
public CmdFactionsConfig cmdFactionsConfig = new CmdFactionsConfig();
public MassiveCommandVersion cmdFactionsVersion = new MassiveCommandVersion(Factions.get()).setAliases("v", "version").addRequirements(RequirementHasPerm.get(Perm.VERSION)); public MassiveCommandVersion cmdFactionsVersion = new MassiveCommandVersion(Factions.get()).setAliases("v", "version").addRequirements(RequirementHasPerm.get(Perm.VERSION));
// -------------------------------------------- // // -------------------------------------------- //
@ -123,6 +124,7 @@ public class CmdFactions extends FactionsCommand
this.addChild(this.cmdFactionsDisband); this.addChild(this.cmdFactionsDisband);
this.addChild(this.cmdFactionsPowerBoost); this.addChild(this.cmdFactionsPowerBoost);
this.addChild(this.cmdFactionsSetpower); this.addChild(this.cmdFactionsSetpower);
this.addChild(this.cmdFactionsConfig);
this.addChild(this.cmdFactionsVersion); this.addChild(this.cmdFactionsVersion);
// Deprecated Commands // Deprecated Commands

View File

@ -0,0 +1,22 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.massivecore.command.editor.CommandEditSingleton;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
public class CmdFactionsConfig extends CommandEditSingleton<MConf>
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsConfig()
{
super(MConf.get());
// Requirements
this.addRequirements(RequirementHasPerm.get(Perm.CONFIG));
}
}

View File

@ -0,0 +1,19 @@
package com.massivecraft.factions.cmd.type;
import com.massivecraft.factions.event.EventFactionsChunkChangeType;
import com.massivecraft.massivecore.command.type.enumeration.TypeEnum;
public class TypeFactionChunkChangeType extends TypeEnum<EventFactionsChunkChangeType>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static TypeFactionChunkChangeType i = new TypeFactionChunkChangeType();
public static TypeFactionChunkChangeType get() { return i; }
public TypeFactionChunkChangeType()
{
super(EventFactionsChunkChangeType.class);
}
}

View File

@ -7,6 +7,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import com.massivecraft.massivecore.command.editor.annotation.EditorName;
import com.massivecraft.massivecore.command.editor.annotation.EditorType;
import com.massivecraft.massivecore.command.editor.annotation.EditorTypeInner;
import com.massivecraft.massivecore.command.editor.annotation.EditorVisible;
import com.massivecraft.massivecore.command.type.TypeMillisDiff;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@ -22,6 +27,7 @@ import com.massivecraft.massivecore.store.Entity;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.TimeUnit; import com.massivecraft.massivecore.util.TimeUnit;
@EditorName("config")
public class MConf extends Entity<MConf> public class MConf extends Entity<MConf>
{ {
// -------------------------------------------- // // -------------------------------------------- //
@ -96,14 +102,17 @@ public class MConf extends Entity<MConf>
// After how many milliseconds should players be automatically kicked from their faction? // After how many milliseconds should players be automatically kicked from their faction?
// The Default // The Default
@EditorType(TypeMillisDiff.class)
public long removePlayerMillisDefault = 10 * TimeUnit.MILLIS_PER_DAY; // 10 days public long removePlayerMillisDefault = 10 * TimeUnit.MILLIS_PER_DAY; // 10 days
// Player Age Bonus // Player Age Bonus
@EditorTypeInner({TypeMillisDiff.class, TypeMillisDiff.class})
public Map<Long, Long> removePlayerMillisPlayerAgeToBonus = MUtil.map( public Map<Long, Long> removePlayerMillisPlayerAgeToBonus = MUtil.map(
2 * TimeUnit.MILLIS_PER_WEEK, 10 * TimeUnit.MILLIS_PER_DAY // +10 days after 2 weeks 2 * TimeUnit.MILLIS_PER_WEEK, 10 * TimeUnit.MILLIS_PER_DAY // +10 days after 2 weeks
); );
// Faction Age Bonus // Faction Age Bonus
@EditorTypeInner({TypeMillisDiff.class, TypeMillisDiff.class})
public Map<Long, Long> removePlayerMillisFactionAgeToBonus = MUtil.map( public Map<Long, Long> removePlayerMillisFactionAgeToBonus = MUtil.map(
4 * TimeUnit.MILLIS_PER_WEEK, 10 * TimeUnit.MILLIS_PER_DAY, // +10 days after 4 weeks 4 * TimeUnit.MILLIS_PER_WEEK, 10 * TimeUnit.MILLIS_PER_DAY, // +10 days after 4 weeks
2 * TimeUnit.MILLIS_PER_WEEK, 5 * TimeUnit.MILLIS_PER_DAY // +5 days after 2 weeks 2 * TimeUnit.MILLIS_PER_WEEK, 5 * TimeUnit.MILLIS_PER_DAY // +5 days after 2 weeks
@ -492,6 +501,7 @@ public class MConf extends Entity<MConf>
public int seeChunkKeepEvery = 5; public int seeChunkKeepEvery = 5;
public int seeChunkSkipEvery = 0; public int seeChunkSkipEvery = 0;
@EditorType(TypeMillisDiff.class)
public long seeChunkPeriodMillis = 500; public long seeChunkPeriodMillis = 500;
public int seeChunkParticleAmount = 30; public int seeChunkParticleAmount = 30;
public float seeChunkParticleOffsetY = 2; public float seeChunkParticleOffsetY = 2;
@ -529,6 +539,7 @@ public class MConf extends Entity<MConf>
// This way they can be protected in Faction territory. // This way they can be protected in Faction territory.
// Interacting with these materials when they are already placed in the terrain results in an edit. // Interacting with these materials when they are already placed in the terrain results in an edit.
@EditorVisible(false)
public BackstringEnumSet<Material> materialsEditOnInteract = new BackstringEnumSet<Material>(Material.class, public BackstringEnumSet<Material> materialsEditOnInteract = new BackstringEnumSet<Material>(Material.class,
"DIODE_BLOCK_OFF", // Minecraft 1.? "DIODE_BLOCK_OFF", // Minecraft 1.?
"DIODE_BLOCK_ON", // Minecraft 1.? "DIODE_BLOCK_ON", // Minecraft 1.?
@ -543,6 +554,7 @@ public class MConf extends Entity<MConf>
// Interacting with the the terrain holding this item in hand results in an edit. // Interacting with the the terrain holding this item in hand results in an edit.
// There's no need to add all block materials here. Only special items other than blocks. // There's no need to add all block materials here. Only special items other than blocks.
@EditorVisible(false)
public BackstringEnumSet<Material> materialsEditTools = new BackstringEnumSet<Material>(Material.class, public BackstringEnumSet<Material> materialsEditTools = new BackstringEnumSet<Material>(Material.class,
"FIREBALL", // Minecraft 1.? "FIREBALL", // Minecraft 1.?
"FLINT_AND_STEEL", // Minecraft 1.? "FLINT_AND_STEEL", // Minecraft 1.?
@ -555,6 +567,7 @@ public class MConf extends Entity<MConf>
// The duplication bug found in Spigot 1.8 protocol patch // The duplication bug found in Spigot 1.8 protocol patch
// https://github.com/MassiveCraft/Factions/issues/693 // https://github.com/MassiveCraft/Factions/issues/693
@EditorVisible(false)
public BackstringEnumSet<Material> materialsEditToolsDupeBug = new BackstringEnumSet<Material>(Material.class, public BackstringEnumSet<Material> materialsEditToolsDupeBug = new BackstringEnumSet<Material>(Material.class,
"CHEST", // Minecraft 1.? "CHEST", // Minecraft 1.?
"SIGN_POST", // Minecraft 1.? "SIGN_POST", // Minecraft 1.?
@ -565,6 +578,7 @@ public class MConf extends Entity<MConf>
); );
// Interacting with these materials placed in the terrain results in door toggling. // Interacting with these materials placed in the terrain results in door toggling.
@EditorVisible(false)
public BackstringEnumSet<Material> materialsDoor = new BackstringEnumSet<Material>(Material.class, public BackstringEnumSet<Material> materialsDoor = new BackstringEnumSet<Material>(Material.class,
"WOODEN_DOOR", // Minecraft 1.? "WOODEN_DOOR", // Minecraft 1.?
"ACACIA_DOOR", // Minecraft 1.8 "ACACIA_DOOR", // Minecraft 1.8
@ -582,6 +596,7 @@ public class MConf extends Entity<MConf>
); );
// Interacting with these materials placed in the terrain results in opening a container. // Interacting with these materials placed in the terrain results in opening a container.
@EditorVisible(false)
public BackstringEnumSet<Material> materialsContainer = new BackstringEnumSet<Material>(Material.class, public BackstringEnumSet<Material> materialsContainer = new BackstringEnumSet<Material>(Material.class,
"DISPENSER", // Minecraft 1.? "DISPENSER", // Minecraft 1.?
"CHEST", // Minecraft 1.? "CHEST", // Minecraft 1.?
@ -616,12 +631,14 @@ public class MConf extends Entity<MConf>
); );
// Interacting with these entities results in an edit. // Interacting with these entities results in an edit.
@EditorVisible(false)
public BackstringEnumSet<EntityType> entityTypesEditOnInteract = new BackstringEnumSet<EntityType>(EntityType.class, public BackstringEnumSet<EntityType> entityTypesEditOnInteract = new BackstringEnumSet<EntityType>(EntityType.class,
"ITEM_FRAME", // Minecraft 1.? "ITEM_FRAME", // Minecraft 1.?
"ARMOR_STAND" // Minecraft 1.8 "ARMOR_STAND" // Minecraft 1.8
); );
// Damaging these entities results in an edit. // Damaging these entities results in an edit.
@EditorVisible(false)
public BackstringEnumSet<EntityType> entityTypesEditOnDamage = new BackstringEnumSet<EntityType>(EntityType.class, public BackstringEnumSet<EntityType> entityTypesEditOnDamage = new BackstringEnumSet<EntityType>(EntityType.class,
"ITEM_FRAME", // Minecraft 1.? "ITEM_FRAME", // Minecraft 1.?
"ARMOR_STAND", // Minecraft 1.8 "ARMOR_STAND", // Minecraft 1.8
@ -629,12 +646,14 @@ public class MConf extends Entity<MConf>
); );
// Interacting with these entities results in opening a container. // Interacting with these entities results in opening a container.
@EditorVisible(false)
public BackstringEnumSet<EntityType> entityTypesContainer = new BackstringEnumSet<EntityType>(EntityType.class, public BackstringEnumSet<EntityType> entityTypesContainer = new BackstringEnumSet<EntityType>(EntityType.class,
"MINECART_CHEST", // Minecraft 1.? "MINECART_CHEST", // Minecraft 1.?
"MINECART_HOPPER" // Minecraft 1.? "MINECART_HOPPER" // Minecraft 1.?
); );
// The complete list of entities considered to be monsters. // The complete list of entities considered to be monsters.
@EditorVisible(false)
public BackstringEnumSet<EntityType> entityTypesMonsters = new BackstringEnumSet<EntityType>(EntityType.class, public BackstringEnumSet<EntityType> entityTypesMonsters = new BackstringEnumSet<EntityType>(EntityType.class,
"BLAZE", // Minecraft 1.? "BLAZE", // Minecraft 1.?
"CAVE_SPIDER", // Minecraft 1.? "CAVE_SPIDER", // Minecraft 1.?
@ -667,6 +686,7 @@ public class MConf extends Entity<MConf>
); );
// List of entities considered to be animals. // List of entities considered to be animals.
@EditorVisible(false)
public BackstringEnumSet<EntityType> entityTypesAnimals = new BackstringEnumSet<EntityType>(EntityType.class, public BackstringEnumSet<EntityType> entityTypesAnimals = new BackstringEnumSet<EntityType>(EntityType.class,
"BAT", // Minecraft 1.? "BAT", // Minecraft 1.?
"CHICKEN", // Minecraft 1.? "CHICKEN", // Minecraft 1.?