Merge pull request #1 from MassiveCraft/master

Merging
This commit is contained in:
Mark Hughes 2014-09-17 19:55:08 +10:00
commit 9e8cfe8128
177 changed files with 3680 additions and 1098 deletions

17
.gitignore vendored
View File

@ -1,20 +1,31 @@
# Eclipse stuff # Eclipse
/.classpath /.classpath
/.project /.project
/.settings /.settings
/*.jardesc
# IntelliJ
*.iml
*.ipr
*.iws
.idea/
# NetBeans # NetBeans
/nbproject /nbproject
/build.xml
# vim # vim
.*.sw[a-p] .*.sw[a-p]
# Maven
/build.xml
/target
/dependency-reduced-pom.xml
# various other potential build files # various other potential build files
/build /build
/bin /bin
/dist /dist
/*.jardesc /manifest.mf
# Mac filesystem dust # Mac filesystem dust
.DS_Store .DS_Store

View File

@ -1,3 +1,3 @@
<a href="http://massivecraft.com/plugins/factions"> <a href="http://massivecraft.com/factions">
![Factions Logotype](https://raw.github.com/MassiveCraft/Factions/master/media/logo300.png)<br> ![Factions Logotype](https://raw.github.com/MassiveCraft/Factions/master/media/logo300.png)<br>
<b>http://massivecraft.com/plugins/factions</b></a> <b>http://massivecraft.com/factions</b></a>

BIN
lib/LWC-4.4.0.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
media/Thumbs.db Normal file

Binary file not shown.

82
pom.xml Normal file
View File

@ -0,0 +1,82 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<name>Factions</name>
<url>http://www.massivecraft.com/factions</url>
<groupId>com.massivecraft</groupId>
<artifactId>Factions</artifactId>
<version>2.6.1</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<defaultGoal>clean install</defaultGoal>
<finalName>Factions</finalName>
<sourceDirectory>${basedir}/src/main/java/</sourceDirectory>
<resources>
<resource>
<targetPath>.</targetPath>
<directory>${basedir}/src/main/resources/</directory>
<filtering>true</filtering>
<includes>
<include>*.yml</include>
<include>*.md</include>
<include>*.txt</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.massivecraft</groupId>
<artifactId>MassiveCore</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>us.dynmap</groupId>
<artifactId>dynmap-api</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>us.dynmap</groupId>
<artifactId>DynmapCore</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.dthielke</groupId>
<artifactId>HeroChat</artifactId>
<version>5.6.7</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/HeroChat-5.6.7.jar</systemPath>
</dependency>
<dependency>
<groupId>com.griefcraft</groupId>
<artifactId>LWC</artifactId>
<version>4.4.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/LWC-4.4.0.jar</systemPath>
</dependency>
</dependencies>
<repositories>
<repository>
<id>dynmap-repo</id>
<url>http://repo.mikeprimm.com/</url>
</repository>
</repositories>
</project>

View File

@ -1,25 +0,0 @@
package com.massivecraft.factions;
import java.util.*;
import com.massivecraft.mcore.SimpleConfig;
import com.massivecraft.mcore.util.MUtil;
public class ConfServer extends SimpleConfig
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static transient ConfServer i = new ConfServer();
public static ConfServer get() { return i; }
public ConfServer() { super(Factions.get()); }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
public static List<String> baseCommandAliases = MUtil.list("f");
public static String dburi = "default";
}

View File

@ -1,87 +0,0 @@
package com.massivecraft.factions;
import java.util.Set;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import com.massivecraft.mcore.util.MUtil;
public class Const
{
// MStore Collection Names
public static final String COLLECTION_BASENAME = "factions";
public static final String COLLECTION_BASENAME_ = COLLECTION_BASENAME+"_";
public static final String COLLECTION_BASENAME_BOARD = COLLECTION_BASENAME_+"board";
public static final String COLLECTION_BASENAME_FACTION = COLLECTION_BASENAME_+"faction";
public static final String COLLECTION_BASENAME_UPLAYER = COLLECTION_BASENAME_+"uplayer";
public static final String COLLECTION_BASENAME_MPLAYER = COLLECTION_BASENAME_+"mplayer";
public static final String COLLECTION_BASENAME_UCONF = COLLECTION_BASENAME_+"uconf";
public static final String COLLECTION_BASENAME_MCONF = COLLECTION_BASENAME_+"mconf";
// Aspect Ids
public static final String ASPECT_ID = "factions";
// ASCII Map
public static final int MAP_HEIGHT = 8;
public static final int MAP_WIDTH = 39;
public static final char[] MAP_KEY_CHARS = "\\/#?$%=&^ABCDEFGHJKLMNOPQRSTUVWXYZ1234567890abcdeghjmnopqrsuvwxyz".toCharArray();
// Enumerations
public static final Set<Material> MATERIALS_EDIT_ON_INTERACT = MUtil.set(
Material.DIODE_BLOCK_OFF,
Material.DIODE_BLOCK_ON,
Material.NOTE_BLOCK,
Material.CAULDRON,
Material.SOIL
);
public static final Set<Material> MATERIALS_EDIT_TOOLS = MUtil.set(
Material.FIREBALL,
Material.FLINT_AND_STEEL,
Material.BUCKET,
Material.WATER_BUCKET,
Material.LAVA_BUCKET
);
public static final Set<Material> MATERIALS_DOOR = MUtil.set(
Material.WOODEN_DOOR,
Material.TRAP_DOOR,
Material.FENCE_GATE
);
public static final Set<Material> MATERIALS_CONTAINER = MUtil.set(
Material.DISPENSER,
Material.CHEST,
Material.FURNACE,
Material.BURNING_FURNACE,
Material.JUKEBOX,
Material.BREWING_STAND,
Material.ENCHANTMENT_TABLE,
Material.ANVIL,
Material.BEACON,
Material.TRAPPED_CHEST,
Material.HOPPER,
Material.DROPPER
);
public static final Set<EntityType> ENTITY_TYPES_MONSTERS = MUtil.set(
EntityType.BLAZE,
EntityType.CAVE_SPIDER,
EntityType.CREEPER,
EntityType.ENDERMAN,
EntityType.ENDER_DRAGON,
EntityType.GHAST,
EntityType.GIANT,
EntityType.MAGMA_CUBE,
EntityType.PIG_ZOMBIE,
EntityType.SILVERFISH,
EntityType.SKELETON,
EntityType.SLIME,
EntityType.SPIDER,
EntityType.WITCH,
EntityType.WITHER,
EntityType.ZOMBIE
);
}

View File

@ -1,22 +0,0 @@
package com.massivecraft.factions.cmd.arg;
import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.UPlayerColls;
import com.massivecraft.mcore.cmd.arg.ARSenderEntity;
import com.massivecraft.mcore.cmd.arg.ArgReader;
public class ARUPlayer
{
// -------------------------------------------- //
// INSTANCE
// -------------------------------------------- //
public static ArgReader<UPlayer> getFullAny(Object o) { return ARSenderEntity.getFullAny(UPlayerColls.get().get(o)); }
public static ArgReader<UPlayer> getStartAny(Object o) { return ARSenderEntity.getStartAny(UPlayerColls.get().get(o)); }
public static ArgReader<UPlayer> getFullOnline(Object o) { return ARSenderEntity.getFullOnline(UPlayerColls.get().get(o)); }
public static ArgReader<UPlayer> getStartOnline(Object o) { return ARSenderEntity.getStartOnline(UPlayerColls.get().get(o)); }
}

View File

@ -1,159 +0,0 @@
package com.massivecraft.factions.entity;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import org.bukkit.ChatColor;
import org.bukkit.event.EventPriority;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.listeners.FactionsListenerChat;
import com.massivecraft.mcore.store.Entity;
public class MConf extends Entity<MConf>
{
// -------------------------------------------- //
// META
// -------------------------------------------- //
protected static transient MConf i;
public static MConf get() { return i; }
// -------------------------------------------- //
// OVERRIDE: ENTITY
// -------------------------------------------- //
@Override
public MConf load(MConf that)
{
super.load(that);
if (!Factions.get().isDatabaseInitialized()) return this;
FactionsListenerChat.get().setup();
return this;
}
// -------------------------------------------- //
// TASKS
// -------------------------------------------- //
public double taskPlayerPowerUpdateMinutes = 1;
public double taskPlayerDataRemoveMinutes = 5;
public double taskEconLandRewardMinutes = 20;
// -------------------------------------------- //
// REMOVE DATA
// -------------------------------------------- //
public boolean removePlayerDataWhenBanned = true;
public double removePlayerDataAfterInactiveDays = 20.0;
// -------------------------------------------- //
// CLAIM LIMITS
// -------------------------------------------- //
// if someone is doing a radius claim and the process fails to claim land this many times in a row, it will exit
public int radiusClaimFailureLimit = 9;
// the maximum radius allowed when using the claim command.
public int radiusClaimRadiusLimit = 5;
// -------------------------------------------- //
// CHAT
// -------------------------------------------- //
// We offer a simple standard way to set the format
public boolean chatSetFormat = false;
public EventPriority chatSetFormatAt = EventPriority.LOWEST;
public String chatSetFormatTo = "<{factions_relcolor}§l{factions_roleprefix}§r{factions_relcolor}{factions_name|rp}§f%1$s> %2$s";
// We offer a simple standard way to parse the chat tags
public boolean chatParseTags = true;
public EventPriority chatParseTagsAt = EventPriority.LOW;
// HeroChat: The Faction Channel
public String herochatFactionName = "Faction";
public String herochatFactionNick = "F";
public String herochatFactionFormat = "{color}[&l{nick}&r{color} &l{factions_roleprefix}&r{color}{factions_title|rp}{sender}{color}] &f{msg}";
public ChatColor herochatFactionColor = ChatColor.GREEN;
public int herochatFactionDistance = 0;
public boolean herochatFactionIsShortcutAllowed = false;
public boolean herochatFactionCrossWorld = true;
public boolean herochatFactionMuted = false;
public Set<String> herochatFactionWorlds = new HashSet<String>();
// HeroChat: The Allies Channel
public String herochatAlliesName = "Allies";
public String herochatAlliesNick = "A";
public String herochatAlliesFormat = "{color}[&l{nick}&r&f {factions_relcolor}&l{factions_roleprefix}&r{factions_relcolor}{factions_name|rp}{sender}{color}] &f{msg}";
public ChatColor herochatAlliesColor = ChatColor.DARK_PURPLE;
public int herochatAlliesDistance = 0;
public boolean herochatAlliesIsShortcutAllowed = false;
public boolean herochatAlliesCrossWorld = true;
public boolean herochatAlliesMuted = false;
public Set<String> herochatAlliesWorlds = new HashSet<String>();
// -------------------------------------------- //
// COLORS
// -------------------------------------------- //
public ChatColor colorMember = ChatColor.GREEN;
public ChatColor colorAlly = ChatColor.DARK_PURPLE;
public ChatColor colorTruce = ChatColor.LIGHT_PURPLE;
public ChatColor colorNeutral = ChatColor.WHITE;
public ChatColor colorEnemy = ChatColor.RED;
public ChatColor colorNoPVP = ChatColor.GOLD;
public ChatColor colorFriendlyFire = ChatColor.DARK_RED;
//public ChatColor colorWilderness = ChatColor.DARK_GREEN;
// -------------------------------------------- //
// PREFIXES
// -------------------------------------------- //
public String prefixLeader = "**";
public String prefixOfficer = "*";
public String prefixMember = "+";
public String prefixRecruit = "-";
// -------------------------------------------- //
// DERPY OVERRIDES
// -------------------------------------------- //
// TODO: Should worldsNoPowerLoss rather be a bukkit permission node?
// TODO: These are derpy because they possibly use an invalid design approach.
// After universe support is added. Would some of these be removed?
// Could it also be more customizeable using some sort of permission lookup map?
// mainly for other plugins/mods that use a fake player to take actions, which shouldn't be subject to our protections
public Set<String> playersWhoBypassAllProtection = new LinkedHashSet<String>();
public Set<String> worldsNoClaiming = new LinkedHashSet<String>();
public Set<String> worldsNoPowerLoss = new LinkedHashSet<String>();
public Set<String> worldsIgnorePvP = new LinkedHashSet<String>();
// -------------------------------------------- //
// EXPLOITS
// -------------------------------------------- //
public boolean handleExploitObsidianGenerators = true;
public boolean handleExploitEnderPearlClipping = true;
public boolean handleExploitTNTWaterlog = false;
// -------------------------------------------- //
// LOGGING
// -------------------------------------------- //
public boolean logFactionCreate = true;
public boolean logFactionDisband = true;
public boolean logFactionJoin = true;
public boolean logFactionKick = true;
public boolean logFactionLeave = true;
public boolean logLandClaims = true;
public boolean logLandUnclaims = true;
public boolean logMoneyTransactions = true;
public boolean logPlayerCommands = true;
}

View File

@ -1,8 +0,0 @@
package com.massivecraft.factions.event;
import com.massivecraft.mcore.event.MCoreEvent;
public abstract class FactionsEventAbstract extends MCoreEvent
{
}

View File

@ -1,31 +0,0 @@
package com.massivecraft.factions.integration.herochat;
import com.massivecraft.mcore.integration.IntegrationFeaturesAbstract;
public class HerochatFeatures extends IntegrationFeaturesAbstract
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static HerochatFeatures i = new HerochatFeatures();
public static HerochatFeatures get() { return i; }
private HerochatFeatures() { super("Herochat"); }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void activate()
{
HerochatEngine.get().activate();
}
@Override
public void deactivate()
{
HerochatEngine.get().deactivate();
}
}

View File

@ -0,0 +1,23 @@
package com.massivecraft.factions;
public class Const
{
// Collections & Aspects
public static final String BASENAME = "factions";
public static final String BASENAME_ = BASENAME+"_";
public static final String COLLECTION_BOARD = BASENAME_+"board";
public static final String COLLECTION_FACTION = BASENAME_+"faction";
public static final String COLLECTION_UPLAYER = BASENAME_+"uplayer";
public static final String COLLECTION_MPLAYER = BASENAME_+"mplayer";
public static final String COLLECTION_UCONF = BASENAME_+"uconf";
public static final String COLLECTION_MCONF = BASENAME_+"mconf";
public static final String ASPECT = BASENAME;
// ASCII Map
public static final int MAP_HEIGHT = 8;
public static final int MAP_WIDTH = 39;
public static final char[] MAP_KEY_CHARS = "\\/#?$%=&^ABCDEFGHJKLMNOPQRSTUVWXYZ1234567890abcdeghjmnopqrsuvwxyz".toCharArray();
}

View File

@ -0,0 +1,125 @@
package com.massivecraft.factions;
import java.util.Set;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.plugin.Plugin;
import com.massivecraft.factions.entity.Board;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.BoardColls;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.FactionColls;
import com.massivecraft.factions.entity.MPlayerColl;
import com.massivecraft.factions.entity.UPlayerColl;
import com.massivecraft.factions.entity.UPlayerColls;
import com.massivecraft.massivecore.EngineAbstract;
import com.massivecraft.massivecore.event.EventMassiveCoreUuidUpdate;
import com.massivecraft.massivecore.util.IdUpdateUtil;
import com.massivecraft.massivecore.util.MUtil;
public class EngineIdUpdate extends EngineAbstract
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static EngineIdUpdate i = new EngineIdUpdate();
public static EngineIdUpdate get() { return i; }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public Plugin getPlugin()
{
return Factions.get();
}
// -------------------------------------------- //
// LISTENER
// -------------------------------------------- //
@EventHandler(priority = EventPriority.MONITOR)
public void update(EventMassiveCoreUuidUpdate event)
{
for (FactionColl coll : FactionColls.get().getColls())
{
for (Faction entity : coll.getAll())
{
update(coll, entity);
}
}
IdUpdateUtil.update(MPlayerColl.get());
for (UPlayerColl coll : UPlayerColls.get().getColls())
{
IdUpdateUtil.update(coll);
}
for (BoardColl coll : BoardColls.get().getColls())
{
update(coll);
}
}
public static void update(FactionColl coll, Faction entity)
{
// Before and After
Set<String> before = entity.getInvitedPlayerIds();
if (before == null) return;
Set<String> after = IdUpdateUtil.update(before, true);
if (after == null) return;
// NoChange
if (MUtil.equals(before, after)) return;
// Apply
entity.setInvitedPlayerIds(after);
entity.sync();
}
public static void update(BoardColl coll)
{
for (Board board : coll.getAll())
{
update(board);
}
}
public static void update(Board board)
{
boolean changed = false;
for (TerritoryAccess ta : board.getMap().values())
{
changed |= update(ta);
}
if (changed)
{
board.changed();
board.sync();
}
}
public static boolean update(TerritoryAccess entity)
{
// Before and After
Set<String> before = entity.playerIds;
if (before == null) return false;
Set<String> after = IdUpdateUtil.update(before, true);
if (after == null) return false;
// NoChange
if (MUtil.equals(before, after)) return false;
// Apply
entity.playerIds = after;
//entity.sync();
return true;
}
}

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions; package com.massivecraft.factions;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.util.extractor.Extractor; import com.massivecraft.massivecore.util.extractor.Extractor;
public class ExtractorFactionAccountId implements Extractor public class ExtractorFactionAccountId implements Extractor
{ {
@ -23,7 +23,7 @@ public class ExtractorFactionAccountId implements Extractor
{ {
String factionId = ((Faction)o).getId(); String factionId = ((Faction)o).getId();
if (factionId == null) return null; if (factionId == null) return null;
return "faction-"+factionId; return Factions.FACTION_MONEY_ACCOUNT_ID_PREFIX + factionId;
} }
return null; return null;

View File

@ -32,6 +32,7 @@ public enum FFlag
FRIENDLYFIRE("friendlyfire", "<i>Can friends hurt eachother here?", false), FRIENDLYFIRE("friendlyfire", "<i>Can friends hurt eachother here?", false),
MONSTERS("monsters", "<i>Can monsters spawn in this territory?", true), MONSTERS("monsters", "<i>Can monsters spawn in this territory?", true),
EXPLOSIONS("explosions", "<i>Can explosions occur in this territory?", true), EXPLOSIONS("explosions", "<i>Can explosions occur in this territory?", true),
OFFLINE_EXPLOSIONS("offlineexplosions", "<i>Can explosions occur if faction is offline?", false),
FIRESPREAD("firespread", "<i>Can fire spread in territory?", true), FIRESPREAD("firespread", "<i>Can fire spread in territory?", true),
ENDERGRIEF("endergrief", "<i>Can endermen grief in this territory?", false), ENDERGRIEF("endergrief", "<i>Can endermen grief in this territory?", false),
@ -98,6 +99,7 @@ public enum FFlag
if (str.startsWith("fr") || str.startsWith("ff")) return FRIENDLYFIRE; if (str.startsWith("fr") || str.startsWith("ff")) return FRIENDLYFIRE;
if (str.startsWith("m")) return MONSTERS; if (str.startsWith("m")) return MONSTERS;
if (str.startsWith("ex")) return EXPLOSIONS; if (str.startsWith("ex")) return EXPLOSIONS;
if (str.startsWith("o")) return OFFLINE_EXPLOSIONS;
if (str.startsWith("fi")) return FIRESPREAD; if (str.startsWith("fi")) return FIRESPREAD;
if (str.startsWith("en")) return ENDERGRIEF; if (str.startsWith("en")) return ENDERGRIEF;
return null; return null;

View File

@ -11,8 +11,8 @@ import com.massivecraft.factions.entity.BoardColls;
import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UConf;
import com.massivecraft.mcore.ps.PS; import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
/** /**
* Permissions that you (a player) may or may not have in the territory of a certain faction. * Permissions that you (a player) may or may not have in the territory of a certain faction.

View File

@ -6,7 +6,7 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.Predictate; import com.massivecraft.massivecore.Predictate;
public class FactionEqualsPredictate implements Predictate<CommandSender>, Serializable public class FactionEqualsPredictate implements Predictate<CommandSender>, Serializable
{ {

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions;
import java.util.Comparator; import java.util.Comparator;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
public class FactionListComparator implements Comparator<Faction> public class FactionListComparator implements Comparator<Faction>
{ {

View File

@ -29,8 +29,10 @@ import com.massivecraft.factions.entity.UConfColls;
import com.massivecraft.factions.entity.UPlayerColls; import com.massivecraft.factions.entity.UPlayerColls;
import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.FactionColls;
import com.massivecraft.factions.entity.MConfColl; import com.massivecraft.factions.entity.MConfColl;
import com.massivecraft.factions.integration.herochat.HerochatFeatures; import com.massivecraft.factions.integration.dynmap.IntegrationDynmap;
import com.massivecraft.factions.integration.lwc.LwcFeatures; import com.massivecraft.factions.integration.dynmap.IntegrationDynmapFactions;
import com.massivecraft.factions.integration.herochat.IntegrationHerochat;
import com.massivecraft.factions.integration.lwc.IntegrationLwc;
import com.massivecraft.factions.listeners.FactionsListenerChat; import com.massivecraft.factions.listeners.FactionsListenerChat;
import com.massivecraft.factions.listeners.FactionsListenerEcon; import com.massivecraft.factions.listeners.FactionsListenerEcon;
import com.massivecraft.factions.listeners.FactionsListenerExploit; import com.massivecraft.factions.listeners.FactionsListenerExploit;
@ -40,18 +42,23 @@ import com.massivecraft.factions.mixin.PowerMixinDefault;
import com.massivecraft.factions.task.TaskPlayerDataRemove; import com.massivecraft.factions.task.TaskPlayerDataRemove;
import com.massivecraft.factions.task.TaskEconLandReward; import com.massivecraft.factions.task.TaskEconLandReward;
import com.massivecraft.factions.task.TaskPlayerPowerUpdate; import com.massivecraft.factions.task.TaskPlayerPowerUpdate;
import com.massivecraft.massivecore.Aspect;
import com.massivecraft.mcore.Aspect; import com.massivecraft.massivecore.AspectColl;
import com.massivecraft.mcore.AspectColl; import com.massivecraft.massivecore.MassivePlugin;
import com.massivecraft.mcore.MPlugin; import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.mcore.Multiverse; import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.mcore.util.MUtil; import com.massivecraft.massivecore.xlib.gson.Gson;
import com.massivecraft.mcore.xlib.gson.Gson; import com.massivecraft.massivecore.xlib.gson.GsonBuilder;
import com.massivecraft.mcore.xlib.gson.GsonBuilder;
public class Factions extends MPlugin public class Factions extends MassivePlugin
{ {
// -------------------------------------------- //
// CONSTANTS
// -------------------------------------------- //
public final static String FACTION_MONEY_ACCOUNT_ID_PREFIX = "faction-";
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
@ -94,11 +101,8 @@ public class Factions extends MPlugin
{ {
if ( ! preEnable()) return; if ( ! preEnable()) return;
// Load Server Config
ConfServer.get().load();
// Initialize Aspects // Initialize Aspects
this.aspect = AspectColl.get().get(Const.ASPECT_ID, true); this.aspect = AspectColl.get().get(Const.ASPECT, true);
this.aspect.register(); this.aspect.register();
this.aspect.setDesc( this.aspect.setDesc(
"<i>If the factions system even is enabled and how it's configured.", "<i>If the factions system even is enabled and how it's configured.",
@ -122,9 +126,10 @@ public class Factions extends MPlugin
// Commands // Commands
this.outerCmdFactions = new CmdFactions(); this.outerCmdFactions = new CmdFactions();
this.outerCmdFactions.register(this); this.outerCmdFactions.register();
// Setup Listeners // Setup Listeners
EngineIdUpdate.get().activate();
FactionsListenerMain.get().setup(); FactionsListenerMain.get().setup();
FactionsListenerChat.get().setup(); FactionsListenerChat.get().setup();
FactionsListenerExploit.get().setup(); FactionsListenerExploit.get().setup();
@ -136,14 +141,16 @@ public class Factions extends MPlugin
// Integrate // Integrate
this.integrate( this.integrate(
HerochatFeatures.get(), IntegrationHerochat.get(),
LwcFeatures.get() IntegrationLwc.get(),
IntegrationDynmap.get(),
IntegrationDynmapFactions.get()
); );
// Schedule recurring non-tps-dependent tasks // Schedule recurring non-tps-dependent tasks
TaskPlayerPowerUpdate.get().schedule(this); TaskPlayerPowerUpdate.get().activate(this);
TaskPlayerDataRemove.get().schedule(this); TaskPlayerDataRemove.get().activate(this);
TaskEconLandReward.get().schedule(this); TaskEconLandReward.get().activate(this);
// Register built in chat modifiers // Register built in chat modifiers
ChatModifierLc.get().register(); ChatModifierLc.get().register();

View File

@ -1,6 +1,6 @@
package com.massivecraft.factions; package com.massivecraft.factions;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class Lang public class Lang
{ {

View File

@ -2,7 +2,7 @@ package com.massivecraft.factions;
import org.bukkit.permissions.Permissible; import org.bukkit.permissions.Permissible;
import com.massivecraft.mcore.util.PermUtil; import com.massivecraft.massivecore.util.PermUtil;
public enum Perm public enum Perm
{ {

View File

@ -32,8 +32,9 @@ public class TerritoryAccess
private final Set<String> factionIds; private final Set<String> factionIds;
public Set<String> getFactionIds() { return this.factionIds; } public Set<String> getFactionIds() { return this.factionIds; }
// TODO: remate private final
// default is empty // default is empty
private final Set<String> playerIds; public Set<String> playerIds;
public Set<String> getPlayerIds() { return this.playerIds; } public Set<String> getPlayerIds() { return this.playerIds; }
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -3,14 +3,13 @@ package com.massivecraft.factions.adapter;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.Map; import java.util.Map;
import com.massivecraft.mcore.ps.PS; import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.mcore.xlib.gson.JsonDeserializationContext; import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext;
import com.massivecraft.mcore.xlib.gson.JsonDeserializer; import com.massivecraft.massivecore.xlib.gson.JsonDeserializer;
import com.massivecraft.mcore.xlib.gson.JsonElement; import com.massivecraft.massivecore.xlib.gson.JsonElement;
import com.massivecraft.mcore.xlib.gson.JsonParseException; import com.massivecraft.massivecore.xlib.gson.JsonParseException;
import com.massivecraft.mcore.xlib.gson.JsonSerializationContext; import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext;
import com.massivecraft.mcore.xlib.gson.JsonSerializer; import com.massivecraft.massivecore.xlib.gson.JsonSerializer;
import com.massivecraft.factions.TerritoryAccess; import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.factions.entity.Board; import com.massivecraft.factions.entity.Board;

View File

@ -5,15 +5,14 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.ConcurrentSkipListMap; import java.util.concurrent.ConcurrentSkipListMap;
import com.massivecraft.mcore.ps.PS; import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.mcore.xlib.gson.JsonDeserializationContext; import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext;
import com.massivecraft.mcore.xlib.gson.JsonDeserializer; import com.massivecraft.massivecore.xlib.gson.JsonDeserializer;
import com.massivecraft.mcore.xlib.gson.JsonElement; import com.massivecraft.massivecore.xlib.gson.JsonElement;
import com.massivecraft.mcore.xlib.gson.JsonObject; import com.massivecraft.massivecore.xlib.gson.JsonObject;
import com.massivecraft.mcore.xlib.gson.JsonParseException; import com.massivecraft.massivecore.xlib.gson.JsonParseException;
import com.massivecraft.mcore.xlib.gson.JsonSerializationContext; import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext;
import com.massivecraft.mcore.xlib.gson.JsonSerializer; import com.massivecraft.massivecore.xlib.gson.JsonSerializer;
import com.massivecraft.factions.TerritoryAccess; import com.massivecraft.factions.TerritoryAccess;
public class BoardMapAdapter implements JsonDeserializer<Map<PS, TerritoryAccess>>, JsonSerializer<Map<PS, TerritoryAccess>> public class BoardMapAdapter implements JsonDeserializer<Map<PS, TerritoryAccess>>, JsonSerializer<Map<PS, TerritoryAccess>>

View File

@ -3,10 +3,10 @@ package com.massivecraft.factions.adapter;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import com.massivecraft.factions.FFlag; import com.massivecraft.factions.FFlag;
import com.massivecraft.mcore.xlib.gson.JsonDeserializationContext; import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext;
import com.massivecraft.mcore.xlib.gson.JsonDeserializer; import com.massivecraft.massivecore.xlib.gson.JsonDeserializer;
import com.massivecraft.mcore.xlib.gson.JsonElement; import com.massivecraft.massivecore.xlib.gson.JsonElement;
import com.massivecraft.mcore.xlib.gson.JsonParseException; import com.massivecraft.massivecore.xlib.gson.JsonParseException;
public class FFlagAdapter implements JsonDeserializer<FFlag> public class FFlagAdapter implements JsonDeserializer<FFlag>
{ {

View File

@ -2,12 +2,11 @@ package com.massivecraft.factions.adapter;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import com.massivecraft.mcore.xlib.gson.JsonDeserializationContext;
import com.massivecraft.mcore.xlib.gson.JsonDeserializer;
import com.massivecraft.mcore.xlib.gson.JsonElement;
import com.massivecraft.mcore.xlib.gson.JsonParseException;
import com.massivecraft.factions.FPerm; import com.massivecraft.factions.FPerm;
import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonDeserializer;
import com.massivecraft.massivecore.xlib.gson.JsonElement;
import com.massivecraft.massivecore.xlib.gson.JsonParseException;
public class FPermAdapter implements JsonDeserializer<FPerm> public class FPermAdapter implements JsonDeserializer<FPerm>
{ {

View File

@ -2,14 +2,13 @@ package com.massivecraft.factions.adapter;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import com.massivecraft.mcore.xlib.gson.JsonDeserializationContext;
import com.massivecraft.mcore.xlib.gson.JsonDeserializer;
import com.massivecraft.mcore.xlib.gson.JsonElement;
import com.massivecraft.mcore.xlib.gson.JsonObject;
import com.massivecraft.mcore.xlib.gson.JsonParseException;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonDeserializer;
import com.massivecraft.massivecore.xlib.gson.JsonElement;
import com.massivecraft.massivecore.xlib.gson.JsonObject;
import com.massivecraft.massivecore.xlib.gson.JsonParseException;
public class FactionPreprocessAdapter implements JsonDeserializer<Faction> public class FactionPreprocessAdapter implements JsonDeserializer<Faction>
{ {

View File

@ -2,12 +2,11 @@ package com.massivecraft.factions.adapter;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import com.massivecraft.mcore.xlib.gson.JsonDeserializationContext;
import com.massivecraft.mcore.xlib.gson.JsonDeserializer;
import com.massivecraft.mcore.xlib.gson.JsonElement;
import com.massivecraft.mcore.xlib.gson.JsonParseException;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonDeserializer;
import com.massivecraft.massivecore.xlib.gson.JsonElement;
import com.massivecraft.massivecore.xlib.gson.JsonParseException;
public class RelAdapter implements JsonDeserializer<Rel> public class RelAdapter implements JsonDeserializer<Rel>
{ {
@ -27,4 +26,5 @@ public class RelAdapter implements JsonDeserializer<Rel>
{ {
return Rel.parse(json.getAsString()); return Rel.parse(json.getAsString());
} }
} }

View File

@ -3,17 +3,16 @@ package com.massivecraft.factions.adapter;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.Set; import java.util.Set;
import com.massivecraft.mcore.xlib.gson.JsonDeserializationContext;
import com.massivecraft.mcore.xlib.gson.JsonDeserializer;
import com.massivecraft.mcore.xlib.gson.JsonElement;
import com.massivecraft.mcore.xlib.gson.JsonObject;
import com.massivecraft.mcore.xlib.gson.JsonParseException;
import com.massivecraft.mcore.xlib.gson.JsonPrimitive;
import com.massivecraft.mcore.xlib.gson.JsonSerializationContext;
import com.massivecraft.mcore.xlib.gson.JsonSerializer;
import com.massivecraft.mcore.xlib.gson.reflect.TypeToken;
import com.massivecraft.factions.TerritoryAccess; import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonDeserializer;
import com.massivecraft.massivecore.xlib.gson.JsonElement;
import com.massivecraft.massivecore.xlib.gson.JsonObject;
import com.massivecraft.massivecore.xlib.gson.JsonParseException;
import com.massivecraft.massivecore.xlib.gson.JsonPrimitive;
import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonSerializer;
import com.massivecraft.massivecore.xlib.gson.reflect.TypeToken;
public class TerritoryAccessAdapter implements JsonDeserializer<TerritoryAccess>, JsonSerializer<TerritoryAccess> public class TerritoryAccessAdapter implements JsonDeserializer<TerritoryAccess>, JsonSerializer<TerritoryAccess>
{ {

View File

@ -62,7 +62,7 @@ public class ChatFormatter
public static boolean unregisterTag(ChatTag tag) public static boolean unregisterTag(ChatTag tag)
{ {
if (tag == null) return false; if (tag == null) return false;
return idToTag.remove(tag) != null; return idToTag.remove(tag.getId()) != null;
} }
// -------------------------------------------- // // -------------------------------------------- //
@ -95,7 +95,7 @@ public class ChatFormatter
public static boolean unregisterModifier(ChatModifier modifier) public static boolean unregisterModifier(ChatModifier modifier)
{ {
if (modifier == null) return false; if (modifier == null) return false;
return idToModifier.remove(modifier) != null; return idToModifier.remove(modifier.getId()) != null;
} }
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.chat.modifier;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.massivecraft.factions.chat.ChatModifierAbstract; import com.massivecraft.factions.chat.ChatModifierAbstract;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class ChatModifierParse extends ChatModifierAbstract public class ChatModifierParse extends ChatModifierAbstract
{ {

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.chat.modifier;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.massivecraft.factions.chat.ChatModifierAbstract; import com.massivecraft.factions.chat.ChatModifierAbstract;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class ChatModifierUcf extends ChatModifierAbstract public class ChatModifierUcf extends ChatModifierAbstract
{ {

View File

@ -23,11 +23,12 @@ public class ChatTagRelcolor extends ChatTagAbstract
@Override @Override
public String getReplacement(CommandSender sender, CommandSender recipient) public String getReplacement(CommandSender sender, CommandSender recipient)
{ {
if (recipient == null) return "";
// Check disabled // Check disabled
if (UConf.isDisabled(sender)) return ""; if (UConf.isDisabled(sender)) return "";
// Opt out if no recipient
if (recipient == null) return null;
// Get entities // Get entities
UPlayer usender = UPlayer.get(sender); UPlayer usender = UPlayer.get(sender);
UPlayer urecipient = UPlayer.get(recipient); UPlayer urecipient = UPlayer.get(recipient);

View File

@ -5,7 +5,7 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.chat.ChatTagAbstract;
import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UConf;
import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class ChatTagRole extends ChatTagAbstract public class ChatTagRole extends ChatTagAbstract
{ {

View File

@ -1,15 +1,19 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import java.util.Collections; import java.util.List;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.mcore.cmd.HelpCommand; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.mcore.cmd.VersionCommand; import com.massivecraft.massivecore.cmd.HelpCommand;
import com.massivecraft.massivecore.cmd.VersionCommand;
public class CmdFactions extends FCommand public class CmdFactions extends FCommand
{ {
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
public CmdFactionsList cmdFactionsList = new CmdFactionsList(); public CmdFactionsList cmdFactionsList = new CmdFactionsList();
public CmdFactionsFaction cmdFactionsFaction = new CmdFactionsFaction(); public CmdFactionsFaction cmdFactionsFaction = new CmdFactionsFaction();
public CmdFactionsPlayer cmdFactionsPlayer = new CmdFactionsPlayer(); public CmdFactionsPlayer cmdFactionsPlayer = new CmdFactionsPlayer();
@ -47,17 +51,13 @@ public class CmdFactions extends FCommand
public CmdFactionsPowerBoost cmdFactionsPowerBoost = new CmdFactionsPowerBoost(); public CmdFactionsPowerBoost cmdFactionsPowerBoost = new CmdFactionsPowerBoost();
public VersionCommand cmdFactionsVersion = new VersionCommand(Factions.get(), Perm.VERSION.node, "v", "version"); public VersionCommand cmdFactionsVersion = new VersionCommand(Factions.get(), Perm.VERSION.node, "v", "version");
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactions() public CmdFactions()
{ {
this.aliases.addAll(ConfServer.baseCommandAliases); // Add SubCommands
// remove any nulls from extra commas
// TODO: When is this required? Should this be added to MCore?
this.aliases.removeAll(Collections.singletonList(null));
this.setDesc("The faction base command");
this.setHelp("This command contains all faction stuff.");
this.addSubCommand(HelpCommand.get()); this.addSubCommand(HelpCommand.get());
this.addSubCommand(this.cmdFactionsList); this.addSubCommand(this.cmdFactionsList);
this.addSubCommand(this.cmdFactionsFaction); this.addSubCommand(this.cmdFactionsFaction);
@ -95,13 +95,20 @@ public class CmdFactions extends FCommand
this.addSubCommand(this.cmdFactionsAdmin); this.addSubCommand(this.cmdFactionsAdmin);
this.addSubCommand(this.cmdFactionsPowerBoost); this.addSubCommand(this.cmdFactionsPowerBoost);
this.addSubCommand(this.cmdFactionsVersion); this.addSubCommand(this.cmdFactionsVersion);
// Misc
this.setDesc("The faction base command");
this.setHelp("This command contains all faction stuff.");
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public List<String> getAliases()
{ {
this.getCommandChain().add(this); return MConf.get().aliasesF;
HelpCommand.getInstance().execute(this.sender, this.args, this.commandChain);
} }
} }

View File

@ -2,35 +2,50 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.mcore.cmd.HelpCommand; import com.massivecraft.massivecore.cmd.HelpCommand;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
public class CmdFactionsAccess extends FCommand public class CmdFactionsAccess extends FCommand
{ {
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
public CmdFactionsAccessView cmdFactionsAccessView = new CmdFactionsAccessView(); public CmdFactionsAccessView cmdFactionsAccessView = new CmdFactionsAccessView();
public CmdFactionsAccessPlayer cmdFactionsAccessPlayer = new CmdFactionsAccessPlayer(); public CmdFactionsAccessPlayer cmdFactionsAccessPlayer = new CmdFactionsAccessPlayer();
public CmdFactionsAccessFaction cmdFactionsAccessFaction = new CmdFactionsAccessFaction(); public CmdFactionsAccessFaction cmdFactionsAccessFaction = new CmdFactionsAccessFaction();
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsAccess() public CmdFactionsAccess()
{ {
this.addAliases("access"); // Add SubCommands
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqIsPlayer.get());
this.addRequirements(ReqHasPerm.get(Perm.ACCESS.node));
this.addSubCommand(this.cmdFactionsAccessView); this.addSubCommand(this.cmdFactionsAccessView);
this.addSubCommand(this.cmdFactionsAccessPlayer); this.addSubCommand(this.cmdFactionsAccessPlayer);
this.addSubCommand(this.cmdFactionsAccessFaction); this.addSubCommand(this.cmdFactionsAccessFaction);
// Aliases
this.addAliases("access");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqIsPlayer.get());
this.addRequirements(ReqHasPerm.get(Perm.ACCESS.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
this.getCommandChain().add(this); this.getCommandChain().add(this);
HelpCommand.getInstance().execute(this.sender, this.args, this.commandChain); HelpCommand.get().execute(this.sender, this.args, this.commandChain);
} }
} }

View File

@ -9,24 +9,37 @@ import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.BoardColls; import com.massivecraft.factions.entity.BoardColls;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.ps.PS; import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.mcore.ps.PSFormatHumanSpace; import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public abstract class CmdFactionsAccessAbstract extends FCommand public abstract class CmdFactionsAccessAbstract extends FCommand
{ {
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
public PS chunk; public PS chunk;
public TerritoryAccess ta; public TerritoryAccess ta;
public Faction hostFaction; public Faction hostFaction;
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsAccessAbstract() public CmdFactionsAccessAbstract()
{ {
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqIsPlayer.get()); this.addRequirements(ReqIsPlayer.get());
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -58,4 +71,5 @@ public abstract class CmdFactionsAccessAbstract extends FCommand
} }
return Txt.implodeCommaAnd(descriptions, Txt.parse("<i>, "), Txt.parse(" <i>and ")); return Txt.implodeCommaAnd(descriptions, Txt.parse("<i>, "), Txt.parse(" <i>and "));
} }
} }

View File

@ -5,21 +5,32 @@ import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.BoardColls; import com.massivecraft.factions.entity.BoardColls;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.arg.ARBoolean; import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsAccessFaction extends CmdFactionsAccessAbstract public class CmdFactionsAccessFaction extends CmdFactionsAccessAbstract
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsAccessFaction() public CmdFactionsAccessFaction()
{ {
// Aliases
this.addAliases("f", "faction"); this.addAliases("f", "faction");
// Args
this.addRequiredArg("faction"); this.addRequiredArg("faction");
this.addOptionalArg("yes/no", "toggle"); this.addOptionalArg("yes/no", "toggle");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.ACCESS_FACTION.node)); this.addRequirements(ReqHasPerm.get(Perm.ACCESS_FACTION.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void innerPerform() public void innerPerform()
{ {
@ -40,4 +51,5 @@ public class CmdFactionsAccessFaction extends CmdFactionsAccessAbstract
// Inform // Inform
this.sendAccessInfo(); this.sendAccessInfo();
} }
} }

View File

@ -5,26 +5,37 @@ import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARUPlayer; import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.entity.BoardColls; import com.massivecraft.factions.entity.BoardColls;
import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.mcore.cmd.arg.ARBoolean; import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsAccessPlayer extends CmdFactionsAccessAbstract public class CmdFactionsAccessPlayer extends CmdFactionsAccessAbstract
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsAccessPlayer() public CmdFactionsAccessPlayer()
{ {
// Aliases
this.addAliases("p", "player"); this.addAliases("p", "player");
// Args
this.addRequiredArg("player"); this.addRequiredArg("player");
this.addOptionalArg("yes/no", "toggle"); this.addOptionalArg("yes/no", "toggle");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.ACCESS_PLAYER.node)); this.addRequirements(ReqHasPerm.get(Perm.ACCESS_PLAYER.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void innerPerform() public void innerPerform()
{ {
// Args // Args
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(usender)); UPlayer uplayer = this.arg(0, ARUPlayer.getAny(usender));
if (uplayer == null) return; if (uplayer == null) return;
Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isPlayerIdGranted(uplayer.getId())); Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isPlayerIdGranted(uplayer.getId()));
@ -40,4 +51,5 @@ public class CmdFactionsAccessPlayer extends CmdFactionsAccessAbstract
// Inform // Inform
this.sendAccessInfo(); this.sendAccessInfo();
} }
} }

View File

@ -1,21 +1,31 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsAccessView extends CmdFactionsAccessAbstract public class CmdFactionsAccessView extends CmdFactionsAccessAbstract
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsAccessView() public CmdFactionsAccessView()
{ {
// Aliases
this.addAliases("v", "view"); this.addAliases("v", "view");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.ACCESS_VIEW.node)); this.addRequirements(ReqHasPerm.get(Perm.ACCESS_VIEW.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void innerPerform() public void innerPerform()
{ {
this.sendAccessInfo(); this.sendAccessInfo();
} }
} }

View File

@ -2,21 +2,32 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.mcore.cmd.arg.ARBoolean; import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsAdmin extends FCommand public class CmdFactionsAdmin extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsAdmin() public CmdFactionsAdmin()
{ {
// Aliases
this.addAliases("admin"); this.addAliases("admin");
// Args
this.addOptionalArg("on/off", "flip"); this.addOptionalArg("on/off", "flip");
// Requirements
// this.addRequirements(ReqFactionsEnabled.get()); // this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.ADMIN.node)); this.addRequirements(ReqHasPerm.get(Perm.ADMIN.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -36,4 +47,5 @@ public class CmdFactionsAdmin extends FCommand
Factions.get().log(msender.getId() + " DISABLED admin bypass mode."); Factions.get().log(msender.getId() + " DISABLED admin bypass mode.");
} }
} }
} }

View File

@ -6,23 +6,34 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UConf;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.ps.PS; import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsAutoClaim extends FCommand public class CmdFactionsAutoClaim extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsAutoClaim() public CmdFactionsAutoClaim()
{ {
// Aliases
this.addAliases("autoclaim"); this.addAliases("autoclaim");
// Args
this.addOptionalArg("faction", "you"); this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.AUTOCLAIM.node)); this.addRequirements(ReqHasPerm.get(Perm.AUTOCLAIM.node));
this.addRequirements(ReqIsPlayer.get()); this.addRequirements(ReqIsPlayer.get());
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {

View File

@ -7,27 +7,37 @@ import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.task.SpiralTask; import com.massivecraft.factions.task.SpiralTask;
import com.massivecraft.mcore.cmd.arg.ARInteger; import com.massivecraft.massivecore.cmd.arg.ARInteger;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.ps.PS; import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsClaim extends FCommand public class CmdFactionsClaim extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsClaim() public CmdFactionsClaim()
{ {
// Aliases
this.addAliases("claim"); this.addAliases("claim");
// Args
this.addOptionalArg("radius", "1"); this.addOptionalArg("radius", "1");
this.addOptionalArg("faction", "you"); this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqIsPlayer.get()); this.addRequirements(ReqIsPlayer.get());
this.addRequirements(ReqHasPerm.get(Perm.CLAIM.node)); this.addRequirements(ReqHasPerm.get(Perm.CLAIM.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -98,4 +108,5 @@ public class CmdFactionsClaim extends FCommand
}; };
} }
} }

View File

@ -13,25 +13,36 @@ import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl; import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.FactionColls;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.event.FactionsEventCreate; import com.massivecraft.factions.event.EventFactionsCreate;
import com.massivecraft.factions.event.FactionsEventMembershipChange; import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason; import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.store.MStore; import com.massivecraft.massivecore.store.MStore;
public class CmdFactionsCreate extends FCommand public class CmdFactionsCreate extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsCreate() public CmdFactionsCreate()
{ {
// Aliases
this.addAliases("create"); this.addAliases("create");
// Args
this.addRequiredArg("name"); this.addRequiredArg("name");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasntFaction.get()); this.addRequirements(ReqHasntFaction.get());
this.addRequirements(ReqHasPerm.get(Perm.CREATE.node)); this.addRequirements(ReqHasPerm.get(Perm.CREATE.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -58,7 +69,7 @@ public class CmdFactionsCreate extends FCommand
String factionId = MStore.createId(); String factionId = MStore.createId();
// Event // Event
FactionsEventCreate createEvent = new FactionsEventCreate(sender, coll.getUniverse(), factionId, newName); EventFactionsCreate createEvent = new EventFactionsCreate(sender, coll.getUniverse(), factionId, newName);
createEvent.run(); createEvent.run();
if (createEvent.isCancelled()) return; if (createEvent.isCancelled()) return;
@ -69,7 +80,7 @@ public class CmdFactionsCreate extends FCommand
usender.setRole(Rel.LEADER); usender.setRole(Rel.LEADER);
usender.setFaction(faction); usender.setFaction(faction);
FactionsEventMembershipChange joinEvent = new FactionsEventMembershipChange(sender, usender, faction, MembershipChangeReason.CREATE); EventFactionsMembershipChange joinEvent = new EventFactionsMembershipChange(sender, usender, faction, MembershipChangeReason.CREATE);
joinEvent.run(); joinEvent.run();
// NOTE: join event cannot be cancelled or you'll have an empty faction // NOTE: join event cannot be cancelled or you'll have an empty faction

View File

@ -5,17 +5,23 @@ import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARUPlayer; import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsDemote extends FCommand public class CmdFactionsDemote extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsDemote() public CmdFactionsDemote()
{ {
// Aliases
this.addAliases("demote"); this.addAliases("demote");
// Args
this.addRequiredArg("player"); this.addRequiredArg("player");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.DEMOTE.node)); this.addRequirements(ReqHasPerm.get(Perm.DEMOTE.node));
@ -24,10 +30,14 @@ public class CmdFactionsDemote extends FCommand
//We'll handle this internally //We'll handle this internally
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
UPlayer you = this.arg(0, ARUPlayer.getStartAny(usender)); UPlayer you = this.arg(0, ARUPlayer.getAny(usender));
if (you == null) return; if (you == null) return;
if (you.getFaction() != usenderFaction) if (you.getFaction() != usenderFaction)

View File

@ -5,25 +5,37 @@ import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.cmd.req.ReqHasFaction; import com.massivecraft.factions.cmd.req.ReqHasFaction;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast; import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.event.FactionsEventDescriptionChange; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.factions.event.EventFactionsDescriptionChange;
import com.massivecraft.mcore.mixin.Mixin; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.mixin.Mixin;
public class CmdFactionsDescription extends FCommand public class CmdFactionsDescription extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsDescription() public CmdFactionsDescription()
{ {
// Aliases
this.addAliases("desc"); this.addAliases("desc");
// Args
this.addRequiredArg("desc"); this.addRequiredArg("desc");
this.setErrorOnToManyArgs(false); this.setErrorOnToManyArgs(false);
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.DESCRIPTION.node)); this.addRequirements(ReqHasPerm.get(Perm.DESCRIPTION.node));
this.addRequirements(ReqHasFaction.get()); this.addRequirements(ReqHasFaction.get());
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER)); this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -31,7 +43,7 @@ public class CmdFactionsDescription extends FCommand
String newDescription = this.argConcatFrom(0); String newDescription = this.argConcatFrom(0);
// Event // Event
FactionsEventDescriptionChange event = new FactionsEventDescriptionChange(sender, usenderFaction, newDescription); EventFactionsDescriptionChange event = new EventFactionsDescriptionChange(sender, usenderFaction, newDescription);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;
newDescription = event.getNewDescription(); newDescription = event.getNewDescription();
@ -40,7 +52,10 @@ public class CmdFactionsDescription extends FCommand
usenderFaction.setDescription(newDescription); usenderFaction.setDescription(newDescription);
// Inform // Inform
usenderFaction.msg("<i>%s <i>set your faction description to:\n%s", Mixin.getDisplayName(sender), usenderFaction.getDescription()); for (UPlayer follower : usenderFaction.getUPlayers())
{
follower.msg("<i>%s <i>set your faction description to:\n%s", Mixin.getDisplayName(sender, follower), usenderFaction.getDescription());
}
} }
} }

View File

@ -7,28 +7,40 @@ import com.massivecraft.factions.entity.UPlayerColls;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.FactionColls;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.event.FactionsEventDisband; import com.massivecraft.factions.event.EventFactionsDisband;
import com.massivecraft.factions.event.FactionsEventMembershipChange; import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason; import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
import com.massivecraft.factions.FFlag; import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.FPerm; import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsDisband extends FCommand public class CmdFactionsDisband extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsDisband() public CmdFactionsDisband()
{ {
// Aliases
this.addAliases("disband"); this.addAliases("disband");
// Args
this.addOptionalArg("faction", "you"); this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.DISBAND.node)); this.addRequirements(ReqHasPerm.get(Perm.DISBAND.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -47,7 +59,7 @@ public class CmdFactionsDisband extends FCommand
} }
// Event // Event
FactionsEventDisband event = new FactionsEventDisband(me, faction); EventFactionsDisband event = new EventFactionsDisband(me, faction);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;
@ -56,7 +68,7 @@ public class CmdFactionsDisband extends FCommand
// Run event for each player in the faction // Run event for each player in the faction
for (UPlayer uplayer : faction.getUPlayers()) for (UPlayer uplayer : faction.getUPlayers())
{ {
FactionsEventMembershipChange membershipChangeEvent = new FactionsEventMembershipChange(sender, uplayer, FactionColls.get().get(faction).getNone(), MembershipChangeReason.DISBAND); EventFactionsMembershipChange membershipChangeEvent = new EventFactionsMembershipChange(sender, uplayer, FactionColls.get().get(faction).getNone(), MembershipChangeReason.DISBAND);
membershipChangeEvent.run(); membershipChangeEvent.run();
} }
@ -76,9 +88,10 @@ public class CmdFactionsDisband extends FCommand
if (MConf.get().logFactionDisband) if (MConf.get().logFactionDisband)
{ {
Factions.get().log(Txt.parse("<i>The faction <h>%s <i>(<h>%s<i>) was disbanded by <h>%s<i>.", faction.getName(), faction.getId(), usender.getDisplayName())); Factions.get().log(Txt.parse("<i>The faction <h>%s <i>(<h>%s<i>) was disbanded by <h>%s<i>.", faction.getName(), faction.getId(), usender.getDisplayName(IdUtil.getConsole())));
} }
faction.detach(); faction.detach();
} }
} }

View File

@ -11,31 +11,42 @@ import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UConf;
import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.FactionsEventChunkChangeType; import com.massivecraft.factions.event.EventFactionsChunkChangeType;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.FFlag; import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.PlayerRoleComparator; import com.massivecraft.factions.PlayerRoleComparator;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.mixin.Mixin; import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.mcore.money.Money; import com.massivecraft.massivecore.money.Money;
import com.massivecraft.mcore.util.TimeDiffUtil; import com.massivecraft.massivecore.util.TimeDiffUtil;
import com.massivecraft.mcore.util.TimeUnit; import com.massivecraft.massivecore.util.TimeUnit;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsFaction extends FCommand public class CmdFactionsFaction extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsFaction() public CmdFactionsFaction()
{ {
// Aliases
this.addAliases("f", "faction"); this.addAliases("f", "faction");
// Args
this.addOptionalArg("faction", "you"); this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.FACTION.node)); this.addRequirements(ReqHasPerm.get(Perm.FACTION.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -75,7 +86,7 @@ public class CmdFactionsFaction extends FCommand
{ {
long landCount = faction.getLandCount(); long landCount = faction.getLandCount();
for (FactionsEventChunkChangeType type : FactionsEventChunkChangeType.values()) for (EventFactionsChunkChangeType type : EventFactionsChunkChangeType.values())
{ {
Double money = uconf.econChunkCost.get(type); Double money = uconf.econChunkCost.get(type);
if (money == null) continue; if (money == null) continue;
@ -93,13 +104,13 @@ public class CmdFactionsFaction extends FCommand
money *= -1; money *= -1;
} }
msg("<a>Total land %s %s: <i>%s", type.toString().toLowerCase(), word, Money.format(faction, money)); msg("<a>Total land %s %s: <i>%s", type.toString().toLowerCase(), word, Money.format(money));
} }
// Show bank contents // Show bank contents
if (UConf.get(faction).bankEnabled) if (UConf.get(faction).bankEnabled)
{ {
msg("<a>Bank contains: <i>"+Money.format(faction, Money.get(faction))); msg("<a>Bank contains: <i>"+Money.format(Money.get(faction)));
} }
} }

View File

@ -6,25 +6,35 @@ import com.massivecraft.factions.cmd.arg.ARFFlag;
import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.arg.ARBoolean; import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsFlag extends FCommand public class CmdFactionsFlag extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsFlag() public CmdFactionsFlag()
{ {
// Aliases
this.addAliases("flag"); this.addAliases("flag");
// Args
this.addOptionalArg("faction", "you"); this.addOptionalArg("faction", "you");
this.addOptionalArg("flag", "all"); this.addOptionalArg("flag", "all");
this.addOptionalArg("yes/no", "read"); this.addOptionalArg("yes/no", "read");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.FLAG.node)); this.addRequirements(ReqHasPerm.get(Perm.FLAG.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {

View File

@ -14,26 +14,36 @@ import com.massivecraft.factions.entity.BoardColls;
import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UConf;
import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.FactionsEventHomeTeleport; import com.massivecraft.factions.event.EventFactionsHomeTeleport;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.mixin.Mixin; import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.mcore.mixin.TeleporterException; import com.massivecraft.massivecore.mixin.TeleporterException;
import com.massivecraft.mcore.ps.PS; import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsHome extends FCommand public class CmdFactionsHome extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsHome() public CmdFactionsHome()
{ {
// Aliases
this.addAliases("home"); this.addAliases("home");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.HOME.node)); this.addRequirements(ReqHasPerm.get(Perm.HOME.node));
this.addRequirements(ReqHasFaction.get()); this.addRequirements(ReqHasFaction.get());
this.addRequirements(ReqIsPlayer.get()); this.addRequirements(ReqIsPlayer.get());
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -123,7 +133,7 @@ public class CmdFactionsHome extends FCommand
} }
// Event // Event
FactionsEventHomeTeleport event = new FactionsEventHomeTeleport(sender); EventFactionsHomeTeleport event = new EventFactionsHomeTeleport(sender);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;

View File

@ -7,31 +7,42 @@ import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.cmd.req.ReqHasFaction; import com.massivecraft.factions.cmd.req.ReqHasFaction;
import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.event.FactionsEventInvitedChange; import com.massivecraft.factions.event.EventFactionsInvitedChange;
import com.massivecraft.mcore.cmd.arg.ARBoolean; import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
public class CmdFactionsInvite extends FCommand public class CmdFactionsInvite extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsInvite() public CmdFactionsInvite()
{ {
// Aliases
this.addAliases("inv", "invite"); this.addAliases("inv", "invite");
// Args
this.addRequiredArg("player"); this.addRequiredArg("player");
this.addOptionalArg("yes/no", "toggle"); this.addOptionalArg("yes/no", "toggle");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.INVITE.node)); this.addRequirements(ReqHasPerm.get(Perm.INVITE.node));
this.addRequirements(ReqHasFaction.get()); this.addRequirements(ReqHasFaction.get());
this.addRequirements(ReqIsPlayer.get()); this.addRequirements(ReqIsPlayer.get());
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
// Args // Args
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender)); UPlayer uplayer = this.arg(0, ARUPlayer.getAny(sender));
if (uplayer == null) return; if (uplayer == null) return;
Boolean newInvited = this.arg(1, ARBoolean.get(), !usenderFaction.isInvited(uplayer)); Boolean newInvited = this.arg(1, ARBoolean.get(), !usenderFaction.isInvited(uplayer));
@ -49,7 +60,7 @@ public class CmdFactionsInvite extends FCommand
if ( ! FPerm.INVITE.has(usender, usenderFaction, true)) return; if ( ! FPerm.INVITE.has(usender, usenderFaction, true)) return;
// Event // Event
FactionsEventInvitedChange event = new FactionsEventInvitedChange(sender, uplayer, usenderFaction, newInvited); EventFactionsInvitedChange event = new EventFactionsInvitedChange(sender, uplayer, usenderFaction, newInvited);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;
newInvited = event.isNewInvited(); newInvited = event.isNewInvited();

View File

@ -9,24 +9,35 @@ import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UConf;
import com.massivecraft.factions.event.FactionsEventMembershipChange; import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason; import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsJoin extends FCommand public class CmdFactionsJoin extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsJoin() public CmdFactionsJoin()
{ {
// Aliases
this.addAliases("join"); this.addAliases("join");
// Args
this.addRequiredArg("faction"); this.addRequiredArg("faction");
this.addOptionalArg("player", "you"); this.addOptionalArg("player", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.JOIN.node)); this.addRequirements(ReqHasPerm.get(Perm.JOIN.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -34,7 +45,7 @@ public class CmdFactionsJoin extends FCommand
Faction faction = this.arg(0, ARFaction.get(sender)); Faction faction = this.arg(0, ARFaction.get(sender));
if (faction == null) return; if (faction == null) return;
UPlayer uplayer = this.arg(1, ARUPlayer.getStartAny(sender), usender); UPlayer uplayer = this.arg(1, ARUPlayer.getAny(sender), usender);
if (uplayer == null) return; if (uplayer == null) return;
Faction uplayerFaction = uplayer.getFaction(); Faction uplayerFaction = uplayer.getFaction();
@ -82,7 +93,7 @@ public class CmdFactionsJoin extends FCommand
} }
// Event // Event
FactionsEventMembershipChange membershipChangeEvent = new FactionsEventMembershipChange(sender, usender, faction, MembershipChangeReason.JOIN); EventFactionsMembershipChange membershipChangeEvent = new EventFactionsMembershipChange(sender, usender, faction, MembershipChangeReason.JOIN);
membershipChangeEvent.run(); membershipChangeEvent.run();
if (membershipChangeEvent.isCancelled()) return; if (membershipChangeEvent.isCancelled()) return;
@ -113,4 +124,5 @@ public class CmdFactionsJoin extends FCommand
} }
} }
} }
} }

View File

@ -11,28 +11,39 @@ import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.FactionColls;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UConf;
import com.massivecraft.factions.event.FactionsEventMembershipChange; import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason; import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.IdUtil;
public class CmdFactionsKick extends FCommand public class CmdFactionsKick extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsKick() public CmdFactionsKick()
{ {
// Aliases
this.addAliases("kick"); this.addAliases("kick");
// Args
this.addRequiredArg("player"); this.addRequiredArg("player");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.KICK.node)); this.addRequirements(ReqHasPerm.get(Perm.KICK.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
// Arg // Arg
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender)); UPlayer uplayer = this.arg(0, ARUPlayer.getAny(sender));
if (uplayer == null) return; if (uplayer == null) return;
// Validate // Validate
@ -60,7 +71,7 @@ public class CmdFactionsKick extends FCommand
if (!FPerm.KICK.has(usender, uplayerFaction, true)) return; if (!FPerm.KICK.has(usender, uplayerFaction, true)) return;
// Event // Event
FactionsEventMembershipChange event = new FactionsEventMembershipChange(sender, uplayer, FactionColls.get().get(uplayer).getNone(), MembershipChangeReason.KICK); EventFactionsMembershipChange event = new EventFactionsMembershipChange(sender, uplayer, FactionColls.get().get(uplayer).getNone(), MembershipChangeReason.KICK);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;
@ -74,7 +85,7 @@ public class CmdFactionsKick extends FCommand
if (MConf.get().logFactionKick) if (MConf.get().logFactionKick)
{ {
Factions.get().log(usender.getDisplayName() + " kicked " + uplayer.getName() + " from the faction " + uplayerFaction.getName()); Factions.get().log(usender.getDisplayName(IdUtil.getConsole()) + " kicked " + uplayer.getName() + " from the faction " + uplayerFaction.getName());
} }
// Apply // Apply

View File

@ -8,29 +8,39 @@ import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.UPlayerColls; import com.massivecraft.factions.entity.UPlayerColls;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.FactionsEventMembershipChange; import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason; import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
import com.massivecraft.factions.util.RelationUtil; import com.massivecraft.factions.util.RelationUtil;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsLeader extends FCommand public class CmdFactionsLeader extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsLeader() public CmdFactionsLeader()
{ {
// Aliases
this.addAliases("leader"); this.addAliases("leader");
// Args
this.addRequiredArg("player"); this.addRequiredArg("player");
this.addOptionalArg("faction", "you"); this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.LEADER.node)); this.addRequirements(ReqHasPerm.get(Perm.LEADER.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
UPlayer newLeader = this.arg(0, ARUPlayer.getStartAny(sender)); UPlayer newLeader = this.arg(0, ARUPlayer.getAny(sender));
if (newLeader == null) return; if (newLeader == null) return;
Faction targetFaction = this.arg(1, ARFaction.get(sender), usenderFaction); Faction targetFaction = this.arg(1, ARFaction.get(sender), usenderFaction);
@ -68,7 +78,7 @@ public class CmdFactionsLeader extends FCommand
// only run event when newLeader isn't actually in the faction // only run event when newLeader isn't actually in the faction
if (newLeader.getFaction() != targetFaction) if (newLeader.getFaction() != targetFaction)
{ {
FactionsEventMembershipChange event = new FactionsEventMembershipChange(sender, newLeader, targetFaction, MembershipChangeReason.LEADER); EventFactionsMembershipChange event = new EventFactionsMembershipChange(sender, newLeader, targetFaction, MembershipChangeReason.LEADER);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;
} }
@ -97,4 +107,5 @@ public class CmdFactionsLeader extends FCommand
uplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(usender, uplayer, true), newLeader.describeTo(uplayer), targetFaction.describeTo(uplayer)); uplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(usender, uplayer, true), newLeader.describeTo(uplayer), targetFaction.describeTo(uplayer));
} }
} }
} }

View File

@ -3,19 +3,29 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.cmd.req.ReqHasFaction; import com.massivecraft.factions.cmd.req.ReqHasFaction;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsLeave extends FCommand { public class CmdFactionsLeave extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsLeave() public CmdFactionsLeave()
{ {
// Aliases
this.addAliases("leave"); this.addAliases("leave");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.LEAVE.node)); this.addRequirements(ReqHasPerm.get(Perm.LEAVE.node));
this.addRequirements(ReqHasFaction.get()); this.addRequirements(ReqHasFaction.get());
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {

View File

@ -8,23 +8,34 @@ import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.FactionColls;
import com.massivecraft.mcore.cmd.arg.ARInteger; import com.massivecraft.massivecore.cmd.arg.ARInteger;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsList extends FCommand public class CmdFactionsList extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsList() public CmdFactionsList()
{ {
// Aliases
this.addAliases("l", "list"); this.addAliases("l", "list");
// Args
this.addOptionalArg("page", "1"); this.addOptionalArg("page", "1");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.LIST.node)); this.addRequirements(ReqHasPerm.get(Perm.LIST.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -69,4 +80,5 @@ public class CmdFactionsList extends FCommand
sendMessage(lines); sendMessage(lines);
} }
} }

View File

@ -3,24 +3,35 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.BoardColls; import com.massivecraft.factions.entity.BoardColls;
import com.massivecraft.mcore.cmd.arg.ARBoolean; import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.ps.PS; import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsMap extends FCommand public class CmdFactionsMap extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsMap() public CmdFactionsMap()
{ {
// Aliases
this.addAliases("map"); this.addAliases("map");
// Args
this.addOptionalArg("on/off", "once"); this.addOptionalArg("on/off", "once");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.MAP.node)); this.addRequirements(ReqHasPerm.get(Perm.MAP.node));
this.addRequirements(ReqIsPlayer.get()); this.addRequirements(ReqIsPlayer.get());
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {

View File

@ -3,11 +3,14 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled; import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.mcore.cmd.HelpCommand; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
public class CmdFactionsMoney extends FCommand public class CmdFactionsMoney extends FCommand
{ {
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
public CmdFactionsMoneyBalance cmdMoneyBalance = new CmdFactionsMoneyBalance(); public CmdFactionsMoneyBalance cmdMoneyBalance = new CmdFactionsMoneyBalance();
public CmdFactionsMoneyDeposit cmdMoneyDeposit = new CmdFactionsMoneyDeposit(); public CmdFactionsMoneyDeposit cmdMoneyDeposit = new CmdFactionsMoneyDeposit();
public CmdFactionsMoneyWithdraw cmdMoneyWithdraw = new CmdFactionsMoneyWithdraw(); public CmdFactionsMoneyWithdraw cmdMoneyWithdraw = new CmdFactionsMoneyWithdraw();
@ -15,27 +18,27 @@ public class CmdFactionsMoney extends FCommand
public CmdFactionsMoneyTransferFp cmdMoneyTransferFp = new CmdFactionsMoneyTransferFp(); public CmdFactionsMoneyTransferFp cmdMoneyTransferFp = new CmdFactionsMoneyTransferFp();
public CmdFactionsMoneyTransferPf cmdMoneyTransferPf = new CmdFactionsMoneyTransferPf(); public CmdFactionsMoneyTransferPf cmdMoneyTransferPf = new CmdFactionsMoneyTransferPf();
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsMoney() public CmdFactionsMoney()
{ {
this.addAliases("money"); // Add SubCommands
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqBankCommandsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.MONEY.node));
this.addSubCommand(this.cmdMoneyBalance); this.addSubCommand(this.cmdMoneyBalance);
this.addSubCommand(this.cmdMoneyDeposit); this.addSubCommand(this.cmdMoneyDeposit);
this.addSubCommand(this.cmdMoneyWithdraw); this.addSubCommand(this.cmdMoneyWithdraw);
this.addSubCommand(this.cmdMoneyTransferFf); this.addSubCommand(this.cmdMoneyTransferFf);
this.addSubCommand(this.cmdMoneyTransferFp); this.addSubCommand(this.cmdMoneyTransferFp);
this.addSubCommand(this.cmdMoneyTransferPf); this.addSubCommand(this.cmdMoneyTransferPf);
}
@Override // Aliases
public void perform() this.addAliases("money");
{
this.getCommandChain().add(this); // Requirements
HelpCommand.getInstance().execute(this.sender, this.args, this.commandChain); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqBankCommandsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.MONEY.node));
} }
} }

View File

@ -6,21 +6,32 @@ import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsMoneyBalance extends FCommand public class CmdFactionsMoneyBalance extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsMoneyBalance() public CmdFactionsMoneyBalance()
{ {
// Aliases
this.addAliases("b", "balance"); this.addAliases("b", "balance");
// Args
this.addOptionalArg("faction", "you"); this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.MONEY_BALANCE.node)); this.addRequirements(ReqHasPerm.get(Perm.MONEY_BALANCE.node));
this.addRequirements(ReqBankCommandsEnabled.get()); this.addRequirements(ReqBankCommandsEnabled.get());
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {

View File

@ -8,28 +8,38 @@ import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble; import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.money.Money; import com.massivecraft.massivecore.money.Money;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
public class CmdFactionsMoneyDeposit extends FCommand public class CmdFactionsMoneyDeposit extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsMoneyDeposit() public CmdFactionsMoneyDeposit()
{ {
// Aliases
this.addAliases("d", "deposit"); this.addAliases("d", "deposit");
// Args
this.addRequiredArg("amount"); this.addRequiredArg("amount");
this.addOptionalArg("faction", "you"); this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.MONEY_DEPOSIT.node)); this.addRequirements(ReqHasPerm.get(Perm.MONEY_DEPOSIT.node));
this.addRequirements(ReqBankCommandsEnabled.get()); this.addRequirements(ReqBankCommandsEnabled.get());
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -43,7 +53,7 @@ public class CmdFactionsMoneyDeposit extends FCommand
if (success && MConf.get().logMoneyTransactions) if (success && MConf.get().logMoneyTransactions)
{ {
Factions.get().log(ChatColor.stripColor(Txt.parse("%s deposited %s in the faction bank: %s", usender.getName(), Money.format(usender, amount), faction.describeTo(null)))); Factions.get().log(ChatColor.stripColor(Txt.parse("%s deposited %s in the faction bank: %s", usender.getName(), Money.format(amount), faction.describeTo(null))));
} }
} }

View File

@ -8,29 +8,40 @@ import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble; import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.money.Money; import com.massivecraft.massivecore.money.Money;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
public class CmdFactionsMoneyTransferFf extends FCommand public class CmdFactionsMoneyTransferFf extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsMoneyTransferFf() public CmdFactionsMoneyTransferFf()
{ {
// Aliases
this.addAliases("ff"); this.addAliases("ff");
// Args
this.addRequiredArg("amount"); this.addRequiredArg("amount");
this.addRequiredArg("faction"); this.addRequiredArg("faction");
this.addRequiredArg("faction"); this.addRequiredArg("faction");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.MONEY_F2F.node)); this.addRequirements(ReqHasPerm.get(Perm.MONEY_F2F.node));
this.addRequirements(ReqBankCommandsEnabled.get()); this.addRequirements(ReqBankCommandsEnabled.get());
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -47,7 +58,8 @@ public class CmdFactionsMoneyTransferFf extends FCommand
if (success && MConf.get().logMoneyTransactions) if (success && MConf.get().logMoneyTransactions)
{ {
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", usender.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null)))); Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", usender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null))));
} }
} }
} }

View File

@ -10,29 +10,40 @@ import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble; import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.money.Money; import com.massivecraft.massivecore.money.Money;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
public class CmdFactionsMoneyTransferFp extends FCommand public class CmdFactionsMoneyTransferFp extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsMoneyTransferFp() public CmdFactionsMoneyTransferFp()
{ {
// Aliases
this.addAliases("fp"); this.addAliases("fp");
// Args
this.addRequiredArg("amount"); this.addRequiredArg("amount");
this.addRequiredArg("faction"); this.addRequiredArg("faction");
this.addRequiredArg("player"); this.addRequiredArg("player");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.MONEY_F2P.node)); this.addRequirements(ReqHasPerm.get(Perm.MONEY_F2P.node));
this.addRequirements(ReqBankCommandsEnabled.get()); this.addRequirements(ReqBankCommandsEnabled.get());
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -42,14 +53,15 @@ public class CmdFactionsMoneyTransferFp extends FCommand
Faction from = this.arg(1, ARFaction.get(sender)); Faction from = this.arg(1, ARFaction.get(sender));
if (from == null) return; if (from == null) return;
UPlayer to = this.arg(2, ARUPlayer.getStartAny(sender)); UPlayer to = this.arg(2, ARUPlayer.getAny(sender));
if (to == null) return; if (to == null) return;
boolean success = Econ.transferMoney(usender, from, to, amount); boolean success = Econ.transferMoney(usender, from, to, amount);
if (success && MConf.get().logMoneyTransactions) if (success && MConf.get().logMoneyTransactions)
{ {
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", usender.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null)))); Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", usender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null))));
} }
} }
} }

View File

@ -10,36 +10,47 @@ import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble; import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.money.Money; import com.massivecraft.massivecore.money.Money;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
public class CmdFactionsMoneyTransferPf extends FCommand public class CmdFactionsMoneyTransferPf extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsMoneyTransferPf() public CmdFactionsMoneyTransferPf()
{ {
// Aliases
this.addAliases("pf"); this.addAliases("pf");
// Args
this.addRequiredArg("amount"); this.addRequiredArg("amount");
this.addRequiredArg("player"); this.addRequiredArg("player");
this.addRequiredArg("faction"); this.addRequiredArg("faction");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.MONEY_P2F.node)); this.addRequirements(ReqHasPerm.get(Perm.MONEY_P2F.node));
this.addRequirements(ReqBankCommandsEnabled.get()); this.addRequirements(ReqBankCommandsEnabled.get());
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
Double amount = this.arg(0, ARDouble.get()); Double amount = this.arg(0, ARDouble.get());
if (amount == null) return; if (amount == null) return;
UPlayer from = this.arg(1, ARUPlayer.getStartAny(sender)); UPlayer from = this.arg(1, ARUPlayer.getAny(sender));
if (from == null) return; if (from == null) return;
Faction to = this.arg(2, ARFaction.get(sender)); Faction to = this.arg(2, ARFaction.get(sender));
@ -49,7 +60,8 @@ public class CmdFactionsMoneyTransferPf extends FCommand
if (success && MConf.get().logMoneyTransactions) if (success && MConf.get().logMoneyTransactions)
{ {
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", usender.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null)))); Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", usender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null))));
} }
} }
} }

View File

@ -9,28 +9,39 @@ import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble; import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.money.Money; import com.massivecraft.massivecore.money.Money;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
public class CmdFactionsMoneyWithdraw extends FCommand public class CmdFactionsMoneyWithdraw extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsMoneyWithdraw() public CmdFactionsMoneyWithdraw()
{ {
// Aliases
this.addAliases("w", "withdraw"); this.addAliases("w", "withdraw");
// Args
this.addRequiredArg("amount"); this.addRequiredArg("amount");
this.addOptionalArg("faction", "you"); this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.MONEY_WITHDRAW.node)); this.addRequirements(ReqHasPerm.get(Perm.MONEY_WITHDRAW.node));
this.addRequirements(ReqBankCommandsEnabled.get()); this.addRequirements(ReqBankCommandsEnabled.get());
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -46,7 +57,8 @@ public class CmdFactionsMoneyWithdraw extends FCommand
if (success && MConf.get().logMoneyTransactions) if (success && MConf.get().logMoneyTransactions)
{ {
Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", usender.getName(), Money.format(from, amount), from.describeTo(null)))); Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", usender.getName(), Money.format(amount), from.describeTo(null))));
} }
} }
} }

View File

@ -10,24 +10,36 @@ import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl; import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.FactionColls;
import com.massivecraft.factions.event.FactionsEventNameChange; import com.massivecraft.factions.entity.UConf;
import com.massivecraft.factions.event.EventFactionsNameChange;
import com.massivecraft.factions.util.MiscUtil; import com.massivecraft.factions.util.MiscUtil;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsName extends FCommand public class CmdFactionsName extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsName() public CmdFactionsName()
{ {
// Aliases
this.addAliases("name"); this.addAliases("name");
// Args
this.addRequiredArg("new name"); this.addRequiredArg("new name");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.NAME.node)); this.addRequirements(ReqHasPerm.get(Perm.NAME.node));
this.addRequirements(ReqHasFaction.get()); this.addRequirements(ReqHasFaction.get());
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER)); this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -52,7 +64,7 @@ public class CmdFactionsName extends FCommand
} }
// Event // Event
FactionsEventNameChange event = new FactionsEventNameChange(sender, usenderFaction, newName); EventFactionsNameChange event = new EventFactionsNameChange(sender, usenderFaction, newName);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;
newName = event.getNewName(); newName = event.getNewName();
@ -63,13 +75,15 @@ public class CmdFactionsName extends FCommand
// Inform // Inform
usenderFaction.msg("%s<i> changed your faction name to %s", usender.describeTo(usenderFaction, true), usenderFaction.getName(usenderFaction)); usenderFaction.msg("%s<i> changed your faction name to %s", usender.describeTo(usenderFaction, true), usenderFaction.getName(usenderFaction));
if (!UConf.get(usender).broadcastNameChange) return;
for (Faction faction : FactionColls.get().get(usenderFaction).getAll()) for (Faction faction : FactionColls.get().get(usenderFaction).getAll())
{ {
if (faction == usenderFaction) if (faction == usenderFaction)
{ {
continue; continue;
} }
faction.msg("<i>The faction %s<i> changed their name to %s.", usender.getColorTo(faction)+oldName, usenderFaction.getName(faction)); faction.msg("<i>The player %s<i> changed their faction name from %s<i> to %s<i>.", usender.describeTo(faction, true), usender.getColorTo(faction)+oldName, usenderFaction.getName(faction));
} }
} }

View File

@ -6,24 +6,35 @@ import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsOfficer extends FCommand public class CmdFactionsOfficer extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsOfficer() public CmdFactionsOfficer()
{ {
// Aliases
this.addAliases("officer"); this.addAliases("officer");
// Args
this.addRequiredArg("player"); this.addRequiredArg("player");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.OFFICER.node)); this.addRequirements(ReqHasPerm.get(Perm.OFFICER.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender)); UPlayer you = this.arg(0, ARUPlayer.getAny(sender));
if (you == null) return; if (you == null) return;
boolean permAny = Perm.OFFICER_ANY.has(sender, false); boolean permAny = Perm.OFFICER_ANY.has(sender, false);

View File

@ -5,24 +5,35 @@ import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.cmd.req.ReqHasFaction; import com.massivecraft.factions.cmd.req.ReqHasFaction;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast; import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.event.FactionsEventOpenChange; import com.massivecraft.factions.event.EventFactionsOpenChange;
import com.massivecraft.mcore.cmd.arg.ARBoolean; import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsOpen extends FCommand public class CmdFactionsOpen extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsOpen() public CmdFactionsOpen()
{ {
// Aliases
this.addAliases("open"); this.addAliases("open");
// Args
this.addOptionalArg("yes/no", "toggle"); this.addOptionalArg("yes/no", "toggle");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.OPEN.node)); this.addRequirements(ReqHasPerm.get(Perm.OPEN.node));
this.addRequirements(ReqHasFaction.get()); this.addRequirements(ReqHasFaction.get());
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER)); this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -31,7 +42,7 @@ public class CmdFactionsOpen extends FCommand
if (newOpen == null) return; if (newOpen == null) return;
// Event // Event
FactionsEventOpenChange event = new FactionsEventOpenChange(sender, usenderFaction, newOpen); EventFactionsOpenChange event = new EventFactionsOpenChange(sender, usenderFaction, newOpen);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;
newOpen = event.isNewOpen(); newOpen = event.isNewOpen();

View File

@ -8,26 +8,37 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.arg.ARRel; import com.massivecraft.factions.cmd.arg.ARRel;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.arg.ARBoolean; import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsPerm extends FCommand public class CmdFactionsPerm extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsPerm() public CmdFactionsPerm()
{ {
// Aliases
this.addAliases("perm"); this.addAliases("perm");
// Args
this.addOptionalArg("faction", "you"); this.addOptionalArg("faction", "you");
this.addOptionalArg("perm", "all"); this.addOptionalArg("perm", "all");
this.addOptionalArg("relation", "read"); this.addOptionalArg("relation", "read");
this.addOptionalArg("yes/no", "read"); this.addOptionalArg("yes/no", "read");
this.setErrorOnToManyArgs(false); this.setErrorOnToManyArgs(false);
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.PERM.node)); this.addRequirements(ReqHasPerm.get(Perm.PERM.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {

View File

@ -6,29 +6,40 @@ import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARUPlayer; import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.mcore.Progressbar; import com.massivecraft.massivecore.Progressbar;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.TimeDiffUtil; import com.massivecraft.massivecore.util.TimeDiffUtil;
import com.massivecraft.mcore.util.TimeUnit; import com.massivecraft.massivecore.util.TimeUnit;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsPlayer extends FCommand public class CmdFactionsPlayer extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsPlayer() public CmdFactionsPlayer()
{ {
// Aliases
this.addAliases("p", "player"); this.addAliases("p", "player");
// Args
this.addOptionalArg("player", "you"); this.addOptionalArg("player", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.PLAYER.node)); this.addRequirements(ReqHasPerm.get(Perm.PLAYER.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
// Args // Args
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender), usender); UPlayer uplayer = this.arg(0, ARUPlayer.getAny(sender), usender);
if (uplayer == null) return; if (uplayer == null) return;
// INFO: Title // INFO: Title
@ -70,4 +81,5 @@ public class CmdFactionsPlayer extends FCommand
msg("<k>Power per Death: <v>%.2f", uplayer.getPowerPerDeath()); msg("<k>Power per Death: <v>%.2f", uplayer.getPowerPerDeath());
} }
} }

View File

@ -7,23 +7,34 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.arg.ARDouble; import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsPowerBoost extends FCommand public class CmdFactionsPowerBoost extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsPowerBoost() public CmdFactionsPowerBoost()
{ {
// Aliases
this.addAliases("powerboost"); this.addAliases("powerboost");
// Args
this.addRequiredArg("p|f|player|faction"); this.addRequiredArg("p|f|player|faction");
this.addRequiredArg("name"); this.addRequiredArg("name");
this.addRequiredArg("#"); this.addRequiredArg("#");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.POWERBOOST.node)); this.addRequirements(ReqHasPerm.get(Perm.POWERBOOST.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -47,7 +58,7 @@ public class CmdFactionsPowerBoost extends FCommand
if (doPlayer) if (doPlayer)
{ {
UPlayer targetPlayer = this.arg(1, ARUPlayer.getStartAny(sender)); UPlayer targetPlayer = this.arg(1, ARUPlayer.getAny(sender));
if (targetPlayer == null) return; if (targetPlayer == null) return;
targetPlayer.setPowerBoost(targetPower); targetPlayer.setPowerBoost(targetPower);
@ -65,4 +76,5 @@ public class CmdFactionsPowerBoost extends FCommand
msg("<i>"+target+" now has a power bonus/penalty of "+targetPower+" to min and max power levels."); msg("<i>"+target+" now has a power bonus/penalty of "+targetPower+" to min and max power levels.");
Factions.get().log(usender.getName()+" has set the power bonus/penalty for "+target+" to "+targetPower+"."); Factions.get().log(usender.getName()+" has set the power bonus/penalty for "+target+" to "+targetPower+".");
} }
} }

View File

@ -5,16 +5,23 @@ import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARUPlayer; import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsPromote extends FCommand public class CmdFactionsPromote extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsPromote() public CmdFactionsPromote()
{ {
// Aliases
this.addAliases("promote"); this.addAliases("promote");
// Args
this.addRequiredArg("player"); this.addRequiredArg("player");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.PROMOTE.node)); this.addRequirements(ReqHasPerm.get(Perm.PROMOTE.node));
@ -23,10 +30,14 @@ public class CmdFactionsPromote extends FCommand
//We'll handle this internally //We'll handle this internally
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender)); UPlayer you = this.arg(0, ARUPlayer.getAny(sender));
if (you == null) return; if (you == null) return;
if (you.getFaction() != usenderFaction) if (you.getFaction() != usenderFaction)

View File

@ -1,6 +1,5 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FFlag; import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
@ -9,23 +8,34 @@ import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.cmd.req.ReqHasFaction; import com.massivecraft.factions.cmd.req.ReqHasFaction;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast; import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.FactionsEventRelationChange; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.factions.event.EventFactionsRelationChange;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public abstract class CmdFactionsRelationAbstract extends FCommand public abstract class CmdFactionsRelationAbstract extends FCommand
{ {
public Rel targetRelation; public Rel targetRelation;
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsRelationAbstract() public CmdFactionsRelationAbstract()
{ {
// Aliases
this.addRequiredArg("faction"); this.addRequiredArg("faction");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.RELATION.node)); this.addRequirements(ReqHasPerm.get(Perm.RELATION.node));
this.addRequirements(ReqHasFaction.get()); this.addRequirements(ReqHasFaction.get());
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER)); this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -56,7 +66,7 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
} }
// Event // Event
FactionsEventRelationChange event = new FactionsEventRelationChange(sender, usenderFaction, otherFaction, newRelation); EventFactionsRelationChange event = new EventFactionsRelationChange(sender, usenderFaction, otherFaction, newRelation);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;
newRelation = event.getNewRelation(); newRelation = event.getNewRelation();
@ -75,7 +85,7 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
else else
{ {
otherFaction.msg("%s<i> wishes to be %s.", usenderFaction.describeTo(otherFaction, true), newRelation.getColor()+newRelation.getDescFactionOne()); otherFaction.msg("%s<i> wishes to be %s.", usenderFaction.describeTo(otherFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
otherFaction.msg("<i>Type <c>/"+ConfServer.baseCommandAliases.get(0)+" "+newRelation+" "+usenderFaction.getName()+"<i> to accept."); otherFaction.msg("<i>Type <c>/"+MConf.get().aliasesF.get(0)+" "+newRelation+" "+usenderFaction.getName()+"<i> to accept.");
usenderFaction.msg("%s<i> were informed that you wish to be %s<i>.", otherFaction.describeTo(usenderFaction, true), newRelation.getColor()+newRelation.getDescFactionOne()); usenderFaction.msg("%s<i> were informed that you wish to be %s<i>.", otherFaction.describeTo(usenderFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
} }
@ -93,4 +103,5 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
usenderFaction.msg("<i>This will have no effect while your faction is peaceful."); usenderFaction.msg("<i>This will have no effect while your faction is peaceful.");
} }
} }
} }

View File

@ -4,10 +4,17 @@ import com.massivecraft.factions.Rel;
public class CmdFactionsRelationAlly extends CmdFactionsRelationAbstract public class CmdFactionsRelationAlly extends CmdFactionsRelationAbstract
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsRelationAlly() public CmdFactionsRelationAlly()
{ {
// Aliases
this.addAliases("ally"); this.addAliases("ally");
// Misc
this.targetRelation = Rel.ALLY; this.targetRelation = Rel.ALLY;
} }
} }

View File

@ -4,10 +4,17 @@ import com.massivecraft.factions.Rel;
public class CmdFactionsRelationEnemy extends CmdFactionsRelationAbstract public class CmdFactionsRelationEnemy extends CmdFactionsRelationAbstract
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsRelationEnemy() public CmdFactionsRelationEnemy()
{ {
// Aliases
this.addAliases("enemy"); this.addAliases("enemy");
// Misc
this.targetRelation = Rel.ENEMY; this.targetRelation = Rel.ENEMY;
} }
} }

View File

@ -4,10 +4,17 @@ import com.massivecraft.factions.Rel;
public class CmdFactionsRelationNeutral extends CmdFactionsRelationAbstract public class CmdFactionsRelationNeutral extends CmdFactionsRelationAbstract
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsRelationNeutral() public CmdFactionsRelationNeutral()
{ {
// Aliases
this.addAliases("neutral"); this.addAliases("neutral");
// Misc
this.targetRelation = Rel.NEUTRAL; this.targetRelation = Rel.NEUTRAL;
} }
} }

View File

@ -4,10 +4,17 @@ import com.massivecraft.factions.Rel;
public class CmdFactionsRelationTruce extends CmdFactionsRelationAbstract public class CmdFactionsRelationTruce extends CmdFactionsRelationAbstract
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsRelationTruce() public CmdFactionsRelationTruce()
{ {
// Aliases
this.addAliases("truce"); this.addAliases("truce");
// Misc
this.targetRelation = Rel.TRUCE; this.targetRelation = Rel.TRUCE;
} }
} }

View File

@ -7,22 +7,32 @@ import org.bukkit.entity.Player;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.util.VisualizeUtil; import com.massivecraft.factions.util.VisualizeUtil;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.ps.PS; import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.mcore.ps.PSFormatHumanSpace; import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
public class CmdFactionsSeeChunk extends FCommand public class CmdFactionsSeeChunk extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsSeeChunk() public CmdFactionsSeeChunk()
{ {
// Aliases
this.addAliases("sc", "seechunk"); this.addAliases("sc", "seechunk");
// Requirements
// this.addRequirements(ReqFactionsEnabled.get()); // this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.SEE_CHUNK.node)); this.addRequirements(ReqHasPerm.get(Perm.SEE_CHUNK.node));
this.addRequirements(ReqIsPlayer.get()); this.addRequirements(ReqIsPlayer.get());
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -56,12 +66,13 @@ public class CmdFactionsSeeChunk extends FCommand
msg("<i>Visualized %s", chunk.toString(PSFormatHumanSpace.get())); msg("<i>Visualized %s", chunk.toString(PSFormatHumanSpace.get()));
} }
@SuppressWarnings("deprecation")
public static void showPillar(Player player, World world, int blockX, int blockZ) public static void showPillar(Player player, World world, int blockX, int blockZ)
{ {
for (int blockY = 0; blockY < world.getMaxHeight(); blockY++) for (int blockY = 0; blockY < world.getMaxHeight(); blockY++)
{ {
Location loc = new Location(world, blockX, blockY, blockZ); Location loc = new Location(world, blockX, blockY, blockZ);
if (loc.getBlock().getTypeId() != 0) continue; if (loc.getBlock().getType() != Material.AIR) continue;
int typeId = blockY % 5 == 0 ? Material.GLOWSTONE.getId() : Material.GLASS.getId(); int typeId = blockY % 5 == 0 ? Material.GLOWSTONE.getId() : Material.GLASS.getId();
VisualizeUtil.addLocation(player, loc, typeId); VisualizeUtil.addLocation(player, loc, typeId);
} }

View File

@ -7,24 +7,35 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UConf;
import com.massivecraft.factions.event.FactionsEventHomeChange; import com.massivecraft.factions.event.EventFactionsHomeChange;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.ps.PS; import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsSethome extends FCommand public class CmdFactionsSethome extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsSethome() public CmdFactionsSethome()
{ {
// Aliases
this.addAliases("sethome"); this.addAliases("sethome");
// Args
this.addOptionalArg("faction", "you"); this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqIsPlayer.get()); this.addRequirements(ReqIsPlayer.get());
this.addRequirements(ReqHasPerm.get(Perm.SETHOME.node)); this.addRequirements(ReqHasPerm.get(Perm.SETHOME.node));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
@ -52,7 +63,7 @@ public class CmdFactionsSethome extends FCommand
} }
// Event // Event
FactionsEventHomeChange event = new FactionsEventHomeChange(sender, faction, newHome); EventFactionsHomeChange event = new EventFactionsHomeChange(sender, faction, newHome);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;
newHome = event.getNewHome(); newHome = event.getNewHome();

View File

@ -8,30 +8,41 @@ import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast; import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.event.FactionsEventTitleChange; import com.massivecraft.factions.event.EventFactionsTitleChange;
import com.massivecraft.mcore.cmd.arg.ARString; import com.massivecraft.massivecore.cmd.arg.ARString;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsTitle extends FCommand public class CmdFactionsTitle extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsTitle() public CmdFactionsTitle()
{ {
// Aliases
this.addAliases("title"); this.addAliases("title");
// Args
this.addRequiredArg("player"); this.addRequiredArg("player");
this.addOptionalArg("title", ""); this.addOptionalArg("title", "");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.TITLE.node)); this.addRequirements(ReqHasPerm.get(Perm.TITLE.node));
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER)); this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {
// Args // Args
UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender)); UPlayer you = this.arg(0, ARUPlayer.getAny(sender));
if (you == null) return; if (you == null) return;
String newTitle = this.argConcatFrom(1, ARString.get(), ""); String newTitle = this.argConcatFrom(1, ARString.get(), "");
@ -47,7 +58,7 @@ public class CmdFactionsTitle extends FCommand
if ( ! canIAdministerYou(usender, you)) return; if ( ! canIAdministerYou(usender, you)) return;
// Event // Event
FactionsEventTitleChange event = new FactionsEventTitleChange(sender, you, newTitle); EventFactionsTitleChange event = new EventFactionsTitleChange(sender, you, newTitle);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;
newTitle = event.getNewTitle(); newTitle = event.getNewTitle();

View File

@ -5,22 +5,32 @@ import com.massivecraft.factions.cmd.req.ReqHasFaction;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.FactionColls;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.ps.PS; import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsUnclaim extends FCommand public class CmdFactionsUnclaim extends FCommand
{ {
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsUnclaim() public CmdFactionsUnclaim()
{ {
// Aliases
this.addAliases("unclaim"); this.addAliases("unclaim");
// Requirements
this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.UNCLAIM.node)); this.addRequirements(ReqHasPerm.get(Perm.UNCLAIM.node));
this.addRequirements(ReqHasFaction.get()); this.addRequirements(ReqHasFaction.get());
this.addRequirements(ReqIsPlayer.get()); this.addRequirements(ReqIsPlayer.get());
} }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override @Override
public void perform() public void perform()
{ {

Some files were not shown because too many files have changed in this diff Show More