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
/.project
/.settings
/*.jardesc
# IntelliJ
*.iml
*.ipr
*.iws
.idea/
# NetBeans
/nbproject
/build.xml
# vim
.*.sw[a-p]
# Maven
/build.xml
/target
/dependency-reduced-pom.xml
# various other potential build files
/build
/bin
/dist
/*.jardesc
/manifest.mf
# Mac filesystem dust
.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>
<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;
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
{
@ -23,7 +23,7 @@ public class ExtractorFactionAccountId implements Extractor
{
String factionId = ((Faction)o).getId();
if (factionId == null) return null;
return "faction-"+factionId;
return Factions.FACTION_MONEY_ACCOUNT_ID_PREFIX + factionId;
}
return null;

View File

@ -32,6 +32,7 @@ public enum FFlag
FRIENDLYFIRE("friendlyfire", "<i>Can friends hurt eachother here?", false),
MONSTERS("monsters", "<i>Can monsters spawn 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),
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("m")) return MONSTERS;
if (str.startsWith("ex")) return EXPLOSIONS;
if (str.startsWith("o")) return OFFLINE_EXPLOSIONS;
if (str.startsWith("fi")) return FIRESPREAD;
if (str.startsWith("en")) return ENDERGRIEF;
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.Faction;
import com.massivecraft.factions.entity.UConf;
import com.massivecraft.mcore.ps.PS;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.Txt;
/**
* 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.Faction;
import com.massivecraft.mcore.Predictate;
import com.massivecraft.massivecore.Predictate;
public class FactionEqualsPredictate implements Predictate<CommandSender>, Serializable
{

View File

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

View File

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

View File

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

View File

@ -32,8 +32,9 @@ public class TerritoryAccess
private final Set<String> factionIds;
public Set<String> getFactionIds() { return this.factionIds; }
// TODO: remate private final
// default is empty
private final Set<String> playerIds;
public Set<String> 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.util.Map;
import com.massivecraft.mcore.ps.PS;
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.mcore.xlib.gson.JsonSerializationContext;
import com.massivecraft.mcore.xlib.gson.JsonSerializer;
import com.massivecraft.massivecore.ps.PS;
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;
import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonSerializer;
import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.factions.entity.Board;

View File

@ -5,15 +5,14 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentSkipListMap;
import com.massivecraft.mcore.ps.PS;
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.JsonSerializationContext;
import com.massivecraft.mcore.xlib.gson.JsonSerializer;
import com.massivecraft.massivecore.ps.PS;
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.JsonSerializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonSerializer;
import com.massivecraft.factions.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 com.massivecraft.factions.FFlag;
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.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 FFlagAdapter implements JsonDeserializer<FFlag>
{

View File

@ -2,12 +2,11 @@ package com.massivecraft.factions.adapter;
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.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>
{

View File

@ -2,14 +2,13 @@ package com.massivecraft.factions.adapter;
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.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>
{

View File

@ -2,12 +2,11 @@ package com.massivecraft.factions.adapter;
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.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>
{
@ -27,4 +26,5 @@ public class RelAdapter implements JsonDeserializer<Rel>
{
return Rel.parse(json.getAsString());
}
}

View File

@ -3,17 +3,16 @@ package com.massivecraft.factions.adapter;
import java.lang.reflect.Type;
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.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>
{

View File

@ -62,7 +62,7 @@ public class ChatFormatter
public static boolean unregisterTag(ChatTag tag)
{
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)
{
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 com.massivecraft.factions.chat.ChatModifierAbstract;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.massivecore.util.Txt;
public class ChatModifierParse extends ChatModifierAbstract
{

View File

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

View File

@ -23,11 +23,12 @@ public class ChatTagRelcolor extends ChatTagAbstract
@Override
public String getReplacement(CommandSender sender, CommandSender recipient)
{
if (recipient == null) return "";
// Check disabled
if (UConf.isDisabled(sender)) return "";
// Opt out if no recipient
if (recipient == null) return null;
// Get entities
UPlayer usender = UPlayer.get(sender);
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.entity.UConf;
import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.massivecore.util.Txt;
public class ChatTagRole extends ChatTagAbstract
{

View File

@ -1,15 +1,19 @@
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.Perm;
import com.massivecraft.mcore.cmd.HelpCommand;
import com.massivecraft.mcore.cmd.VersionCommand;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.massivecore.cmd.HelpCommand;
import com.massivecraft.massivecore.cmd.VersionCommand;
public class CmdFactions extends FCommand
{
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
public CmdFactionsList cmdFactionsList = new CmdFactionsList();
public CmdFactionsFaction cmdFactionsFaction = new CmdFactionsFaction();
public CmdFactionsPlayer cmdFactionsPlayer = new CmdFactionsPlayer();
@ -47,17 +51,13 @@ public class CmdFactions extends FCommand
public CmdFactionsPowerBoost cmdFactionsPowerBoost = new CmdFactionsPowerBoost();
public VersionCommand cmdFactionsVersion = new VersionCommand(Factions.get(), Perm.VERSION.node, "v", "version");
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactions()
{
this.aliases.addAll(ConfServer.baseCommandAliases);
// 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.");
// Add SubCommands
this.addSubCommand(HelpCommand.get());
this.addSubCommand(this.cmdFactionsList);
this.addSubCommand(this.cmdFactionsFaction);
@ -95,13 +95,20 @@ public class CmdFactions extends FCommand
this.addSubCommand(this.cmdFactionsAdmin);
this.addSubCommand(this.cmdFactionsPowerBoost);
this.addSubCommand(this.cmdFactionsVersion);
// Misc
this.setDesc("The faction base command");
this.setHelp("This command contains all faction stuff.");
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
public List<String> getAliases()
{
this.getCommandChain().add(this);
HelpCommand.getInstance().execute(this.sender, this.args, this.commandChain);
return MConf.get().aliasesF;
}
}

View File

@ -2,35 +2,50 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.mcore.cmd.HelpCommand;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.cmd.HelpCommand;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
public class CmdFactionsAccess extends FCommand
{
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
public CmdFactionsAccessView cmdFactionsAccessView = new CmdFactionsAccessView();
public CmdFactionsAccessPlayer cmdFactionsAccessPlayer = new CmdFactionsAccessPlayer();
public CmdFactionsAccessFaction cmdFactionsAccessFaction = new CmdFactionsAccessFaction();
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsAccess()
{
this.addAliases("access");
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqIsPlayer.get());
this.addRequirements(ReqHasPerm.get(Perm.ACCESS.node));
// Add SubCommands
this.addSubCommand(this.cmdFactionsAccessView);
this.addSubCommand(this.cmdFactionsAccessPlayer);
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
public void perform()
{
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.entity.BoardColls;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.ps.PS;
import com.massivecraft.mcore.ps.PSFormatHumanSpace;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
import com.massivecraft.massivecore.util.Txt;
public abstract class CmdFactionsAccessAbstract extends FCommand
{
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
public PS chunk;
public TerritoryAccess ta;
public Faction hostFaction;
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsAccessAbstract()
{
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqIsPlayer.get());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -58,4 +71,5 @@ public abstract class CmdFactionsAccessAbstract extends FCommand
}
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.entity.BoardColls;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsAccessFaction extends CmdFactionsAccessAbstract
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsAccessFaction()
{
// Aliases
this.addAliases("f", "faction");
// Args
this.addRequiredArg("faction");
this.addOptionalArg("yes/no", "toggle");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.ACCESS_FACTION.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void innerPerform()
{
@ -40,4 +51,5 @@ public class CmdFactionsAccessFaction extends CmdFactionsAccessAbstract
// Inform
this.sendAccessInfo();
}
}

View File

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

View File

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

View File

@ -2,21 +2,32 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.mcore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsAdmin extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsAdmin()
{
// Aliases
this.addAliases("admin");
// Args
this.addOptionalArg("on/off", "flip");
//this.addRequirements(ReqFactionsEnabled.get());
// Requirements
// this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.ADMIN.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -36,4 +47,5 @@ public class CmdFactionsAdmin extends FCommand
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.entity.Faction;
import com.massivecraft.factions.entity.UConf;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.ps.PS;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsAutoClaim extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsAutoClaim()
{
// Aliases
this.addAliases("autoclaim");
// Args
this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.AUTOCLAIM.node));
this.addRequirements(ReqIsPlayer.get());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
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.MConf;
import com.massivecraft.factions.task.SpiralTask;
import com.massivecraft.mcore.cmd.arg.ARInteger;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.ps.PS;
import com.massivecraft.massivecore.cmd.arg.ARInteger;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsClaim extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsClaim()
{
// Aliases
this.addAliases("claim");
// Args
this.addOptionalArg("radius", "1");
this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqIsPlayer.get());
this.addRequirements(ReqHasPerm.get(Perm.CLAIM.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
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.FactionColls;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.event.FactionsEventCreate;
import com.massivecraft.factions.event.FactionsEventMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.store.MStore;
import com.massivecraft.factions.event.EventFactionsCreate;
import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.store.MStore;
public class CmdFactionsCreate extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsCreate()
{
// Aliases
this.addAliases("create");
// Args
this.addRequiredArg("name");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasntFaction.get());
this.addRequirements(ReqHasPerm.get(Perm.CREATE.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -58,7 +69,7 @@ public class CmdFactionsCreate extends FCommand
String factionId = MStore.createId();
// Event
FactionsEventCreate createEvent = new FactionsEventCreate(sender, coll.getUniverse(), factionId, newName);
EventFactionsCreate createEvent = new EventFactionsCreate(sender, coll.getUniverse(), factionId, newName);
createEvent.run();
if (createEvent.isCancelled()) return;
@ -69,7 +80,7 @@ public class CmdFactionsCreate extends FCommand
usender.setRole(Rel.LEADER);
usender.setFaction(faction);
FactionsEventMembershipChange joinEvent = new FactionsEventMembershipChange(sender, usender, faction, MembershipChangeReason.CREATE);
EventFactionsMembershipChange joinEvent = new EventFactionsMembershipChange(sender, usender, faction, MembershipChangeReason.CREATE);
joinEvent.run();
// 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.req.ReqFactionsEnabled;
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
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsDemote()
{
// Aliases
this.addAliases("demote");
// Args
this.addRequiredArg("player");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.DEMOTE.node));
@ -24,10 +30,14 @@ public class CmdFactionsDemote extends FCommand
//We'll handle this internally
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
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.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.ReqHasFaction;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.event.FactionsEventDescriptionChange;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.mixin.Mixin;
import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.event.EventFactionsDescriptionChange;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.mixin.Mixin;
public class CmdFactionsDescription extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsDescription()
{
// Aliases
this.addAliases("desc");
// Args
this.addRequiredArg("desc");
this.setErrorOnToManyArgs(false);
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.DESCRIPTION.node));
this.addRequirements(ReqHasFaction.get());
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -31,7 +43,7 @@ public class CmdFactionsDescription extends FCommand
String newDescription = this.argConcatFrom(0);
// Event
FactionsEventDescriptionChange event = new FactionsEventDescriptionChange(sender, usenderFaction, newDescription);
EventFactionsDescriptionChange event = new EventFactionsDescriptionChange(sender, usenderFaction, newDescription);
event.run();
if (event.isCancelled()) return;
newDescription = event.getNewDescription();
@ -40,7 +52,10 @@ public class CmdFactionsDescription extends FCommand
usenderFaction.setDescription(newDescription);
// 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.FactionColls;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.event.FactionsEventDisband;
import com.massivecraft.factions.event.FactionsEventMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
import com.massivecraft.factions.event.EventFactionsDisband;
import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsDisband extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsDisband()
{
// Aliases
this.addAliases("disband");
// Args
this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.DISBAND.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -47,7 +59,7 @@ public class CmdFactionsDisband extends FCommand
}
// Event
FactionsEventDisband event = new FactionsEventDisband(me, faction);
EventFactionsDisband event = new EventFactionsDisband(me, faction);
event.run();
if (event.isCancelled()) return;
@ -56,7 +68,7 @@ public class CmdFactionsDisband extends FCommand
// Run event for each player in the faction
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();
}
@ -76,9 +88,10 @@ public class CmdFactionsDisband extends FCommand
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();
}
}

View File

@ -11,31 +11,42 @@ import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.UConf;
import com.massivecraft.factions.entity.UPlayer;
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.FFlag;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.PlayerRoleComparator;
import com.massivecraft.factions.Rel;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.mixin.Mixin;
import com.massivecraft.mcore.money.Money;
import com.massivecraft.mcore.util.TimeDiffUtil;
import com.massivecraft.mcore.util.TimeUnit;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.money.Money;
import com.massivecraft.massivecore.util.TimeDiffUtil;
import com.massivecraft.massivecore.util.TimeUnit;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsFaction extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsFaction()
{
// Aliases
this.addAliases("f", "faction");
// Args
this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.FACTION.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -75,7 +86,7 @@ public class CmdFactionsFaction extends FCommand
{
long landCount = faction.getLandCount();
for (FactionsEventChunkChangeType type : FactionsEventChunkChangeType.values())
for (EventFactionsChunkChangeType type : EventFactionsChunkChangeType.values())
{
Double money = uconf.econChunkCost.get(type);
if (money == null) continue;
@ -93,13 +104,13 @@ public class CmdFactionsFaction extends FCommand
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
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.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsFlag extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsFlag()
{
// Aliases
this.addAliases("flag");
// Args
this.addOptionalArg("faction", "you");
this.addOptionalArg("flag", "all");
this.addOptionalArg("yes/no", "read");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.FLAG.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
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.UPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.FactionsEventHomeTeleport;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.mixin.Mixin;
import com.massivecraft.mcore.mixin.TeleporterException;
import com.massivecraft.mcore.ps.PS;
import com.massivecraft.factions.event.EventFactionsHomeTeleport;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.mixin.TeleporterException;
import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsHome extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsHome()
{
// Aliases
this.addAliases("home");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.HOME.node));
this.addRequirements(ReqHasFaction.get());
this.addRequirements(ReqIsPlayer.get());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -123,7 +133,7 @@ public class CmdFactionsHome extends FCommand
}
// Event
FactionsEventHomeTeleport event = new FactionsEventHomeTeleport(sender);
EventFactionsHomeTeleport event = new EventFactionsHomeTeleport(sender);
event.run();
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.ReqHasFaction;
import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.event.FactionsEventInvitedChange;
import com.massivecraft.mcore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
import com.massivecraft.factions.event.EventFactionsInvitedChange;
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
public class CmdFactionsInvite extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsInvite()
{
// Aliases
this.addAliases("inv", "invite");
// Args
this.addRequiredArg("player");
this.addOptionalArg("yes/no", "toggle");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.INVITE.node));
this.addRequirements(ReqHasFaction.get());
this.addRequirements(ReqIsPlayer.get());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
// Args
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender));
UPlayer uplayer = this.arg(0, ARUPlayer.getAny(sender));
if (uplayer == null) return;
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;
// Event
FactionsEventInvitedChange event = new FactionsEventInvitedChange(sender, uplayer, usenderFaction, newInvited);
EventFactionsInvitedChange event = new EventFactionsInvitedChange(sender, uplayer, usenderFaction, newInvited);
event.run();
if (event.isCancelled()) return;
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.MConf;
import com.massivecraft.factions.entity.UConf;
import com.massivecraft.factions.event.FactionsEventMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsJoin extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsJoin()
{
// Aliases
this.addAliases("join");
// Args
this.addRequiredArg("faction");
this.addOptionalArg("player", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.JOIN.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -34,7 +45,7 @@ public class CmdFactionsJoin extends FCommand
Faction faction = this.arg(0, ARFaction.get(sender));
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;
Faction uplayerFaction = uplayer.getFaction();
@ -82,7 +93,7 @@ public class CmdFactionsJoin extends FCommand
}
// Event
FactionsEventMembershipChange membershipChangeEvent = new FactionsEventMembershipChange(sender, usender, faction, MembershipChangeReason.JOIN);
EventFactionsMembershipChange membershipChangeEvent = new EventFactionsMembershipChange(sender, usender, faction, MembershipChangeReason.JOIN);
membershipChangeEvent.run();
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.MConf;
import com.massivecraft.factions.entity.UConf;
import com.massivecraft.factions.event.FactionsEventMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.IdUtil;
public class CmdFactionsKick extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsKick()
{
// Aliases
this.addAliases("kick");
// Args
this.addRequiredArg("player");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.KICK.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
// Arg
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender));
UPlayer uplayer = this.arg(0, ARUPlayer.getAny(sender));
if (uplayer == null) return;
// Validate
@ -60,7 +71,7 @@ public class CmdFactionsKick extends FCommand
if (!FPerm.KICK.has(usender, uplayerFaction, true)) return;
// 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();
if (event.isCancelled()) return;
@ -74,7 +85,7 @@ public class CmdFactionsKick extends FCommand
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

View File

@ -8,29 +8,39 @@ import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.UPlayerColls;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.FactionsEventMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
import com.massivecraft.factions.util.RelationUtil;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsLeader extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsLeader()
{
// Aliases
this.addAliases("leader");
// Args
this.addRequiredArg("player");
this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.LEADER.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
UPlayer newLeader = this.arg(0, ARUPlayer.getStartAny(sender));
UPlayer newLeader = this.arg(0, ARUPlayer.getAny(sender));
if (newLeader == null) return;
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
if (newLeader.getFaction() != targetFaction)
{
FactionsEventMembershipChange event = new FactionsEventMembershipChange(sender, newLeader, targetFaction, MembershipChangeReason.LEADER);
EventFactionsMembershipChange event = new EventFactionsMembershipChange(sender, newLeader, targetFaction, MembershipChangeReason.LEADER);
event.run();
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));
}
}
}

View File

@ -3,19 +3,29 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
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()
{
// Aliases
this.addAliases("leave");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.LEAVE.node));
this.addRequirements(ReqHasFaction.get());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
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.entity.Faction;
import com.massivecraft.factions.entity.FactionColls;
import com.massivecraft.mcore.cmd.arg.ARInteger;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.massivecore.cmd.arg.ARInteger;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsList extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsList()
{
// Aliases
this.addAliases("l", "list");
// Args
this.addOptionalArg("page", "1");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.LIST.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -69,4 +80,5 @@ public class CmdFactionsList extends FCommand
sendMessage(lines);
}
}

View File

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

View File

@ -3,11 +3,14 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.mcore.cmd.HelpCommand;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsMoney extends FCommand
{
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
public CmdFactionsMoneyBalance cmdMoneyBalance = new CmdFactionsMoneyBalance();
public CmdFactionsMoneyDeposit cmdMoneyDeposit = new CmdFactionsMoneyDeposit();
public CmdFactionsMoneyWithdraw cmdMoneyWithdraw = new CmdFactionsMoneyWithdraw();
@ -15,27 +18,27 @@ public class CmdFactionsMoney extends FCommand
public CmdFactionsMoneyTransferFp cmdMoneyTransferFp = new CmdFactionsMoneyTransferFp();
public CmdFactionsMoneyTransferPf cmdMoneyTransferPf = new CmdFactionsMoneyTransferPf();
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsMoney()
{
this.addAliases("money");
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqBankCommandsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.MONEY.node));
// Add SubCommands
this.addSubCommand(this.cmdMoneyBalance);
this.addSubCommand(this.cmdMoneyDeposit);
this.addSubCommand(this.cmdMoneyWithdraw);
this.addSubCommand(this.cmdMoneyTransferFf);
this.addSubCommand(this.cmdMoneyTransferFp);
this.addSubCommand(this.cmdMoneyTransferPf);
}
@Override
public void perform()
{
this.getCommandChain().add(this);
HelpCommand.getInstance().execute(this.sender, this.args, this.commandChain);
// Aliases
this.addAliases("money");
// Requirements
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.integration.Econ;
import com.massivecraft.factions.Perm;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsMoneyBalance extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsMoneyBalance()
{
// Aliases
this.addAliases("b", "balance");
// Args
this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.MONEY_BALANCE.node));
this.addRequirements(ReqBankCommandsEnabled.get());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
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.MConf;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.money.Money;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.money.Money;
import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
public class CmdFactionsMoneyDeposit extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsMoneyDeposit()
{
// Aliases
this.addAliases("d", "deposit");
// Args
this.addRequiredArg("amount");
this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.MONEY_DEPOSIT.node));
this.addRequirements(ReqBankCommandsEnabled.get());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -43,7 +53,7 @@ public class CmdFactionsMoneyDeposit extends FCommand
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.Factions;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.money.Money;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.money.Money;
import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
public class CmdFactionsMoneyTransferFf extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsMoneyTransferFf()
{
// Aliases
this.addAliases("ff");
// Args
this.addRequiredArg("amount");
this.addRequiredArg("faction");
this.addRequiredArg("faction");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.MONEY_F2F.node));
this.addRequirements(ReqBankCommandsEnabled.get());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -47,7 +58,8 @@ public class CmdFactionsMoneyTransferFf extends FCommand
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.Factions;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.money.Money;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.money.Money;
import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
public class CmdFactionsMoneyTransferFp extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsMoneyTransferFp()
{
// Aliases
this.addAliases("fp");
// Args
this.addRequiredArg("amount");
this.addRequiredArg("faction");
this.addRequiredArg("player");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.MONEY_F2P.node));
this.addRequirements(ReqBankCommandsEnabled.get());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -42,14 +53,15 @@ public class CmdFactionsMoneyTransferFp extends FCommand
Faction from = this.arg(1, ARFaction.get(sender));
if (from == null) return;
UPlayer to = this.arg(2, ARUPlayer.getStartAny(sender));
UPlayer to = this.arg(2, ARUPlayer.getAny(sender));
if (to == null) return;
boolean success = Econ.transferMoney(usender, from, to, amount);
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.Factions;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.money.Money;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.money.Money;
import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
public class CmdFactionsMoneyTransferPf extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsMoneyTransferPf()
{
// Aliases
this.addAliases("pf");
// Args
this.addRequiredArg("amount");
this.addRequiredArg("player");
this.addRequiredArg("faction");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.MONEY_P2F.node));
this.addRequirements(ReqBankCommandsEnabled.get());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
Double amount = this.arg(0, ARDouble.get());
if (amount == null) return;
UPlayer from = this.arg(1, ARUPlayer.getStartAny(sender));
UPlayer from = this.arg(1, ARUPlayer.getAny(sender));
if (from == null) return;
Faction to = this.arg(2, ARFaction.get(sender));
@ -49,7 +60,8 @@ public class CmdFactionsMoneyTransferPf extends FCommand
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.Factions;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.money.Money;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.money.Money;
import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
public class CmdFactionsMoneyWithdraw extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsMoneyWithdraw()
{
// Aliases
this.addAliases("w", "withdraw");
// Args
this.addRequiredArg("amount");
this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.MONEY_WITHDRAW.node));
this.addRequirements(ReqBankCommandsEnabled.get());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -46,7 +57,8 @@ public class CmdFactionsMoneyWithdraw extends FCommand
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.FactionColl;
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.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsName extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsName()
{
// Aliases
this.addAliases("name");
// Args
this.addRequiredArg("new name");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.NAME.node));
this.addRequirements(ReqHasFaction.get());
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -52,7 +64,7 @@ public class CmdFactionsName extends FCommand
}
// Event
FactionsEventNameChange event = new FactionsEventNameChange(sender, usenderFaction, newName);
EventFactionsNameChange event = new EventFactionsNameChange(sender, usenderFaction, newName);
event.run();
if (event.isCancelled()) return;
newName = event.getNewName();
@ -63,13 +75,15 @@ public class CmdFactionsName extends FCommand
// Inform
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())
{
if (faction == usenderFaction)
{
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.entity.UPlayer;
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
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsOfficer()
{
// Aliases
this.addAliases("officer");
// Args
this.addRequiredArg("player");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.OFFICER.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender));
UPlayer you = this.arg(0, ARUPlayer.getAny(sender));
if (you == null) return;
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.ReqHasFaction;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.event.FactionsEventOpenChange;
import com.massivecraft.mcore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.factions.event.EventFactionsOpenChange;
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsOpen extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsOpen()
{
// Aliases
this.addAliases("open");
// Args
this.addOptionalArg("yes/no", "toggle");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.OPEN.node));
this.addRequirements(ReqHasFaction.get());
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -31,7 +42,7 @@ public class CmdFactionsOpen extends FCommand
if (newOpen == null) return;
// Event
FactionsEventOpenChange event = new FactionsEventOpenChange(sender, usenderFaction, newOpen);
EventFactionsOpenChange event = new EventFactionsOpenChange(sender, usenderFaction, newOpen);
event.run();
if (event.isCancelled()) return;
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.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsPerm extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsPerm()
{
// Aliases
this.addAliases("perm");
// Args
this.addOptionalArg("faction", "you");
this.addOptionalArg("perm", "all");
this.addOptionalArg("relation", "read");
this.addOptionalArg("yes/no", "read");
this.setErrorOnToManyArgs(false);
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.PERM.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
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.req.ReqFactionsEnabled;
import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.mcore.Progressbar;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.TimeDiffUtil;
import com.massivecraft.mcore.util.TimeUnit;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.massivecore.Progressbar;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.TimeDiffUtil;
import com.massivecraft.massivecore.util.TimeUnit;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsPlayer extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsPlayer()
{
// Aliases
this.addAliases("p", "player");
// Args
this.addOptionalArg("player", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.PLAYER.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
// Args
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender), usender);
UPlayer uplayer = this.arg(0, ARUPlayer.getAny(sender), usender);
if (uplayer == null) return;
// INFO: Title
@ -70,4 +81,5 @@ public class CmdFactionsPlayer extends FCommand
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.entity.UPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsPowerBoost extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsPowerBoost()
{
// Aliases
this.addAliases("powerboost");
// Args
this.addRequiredArg("p|f|player|faction");
this.addRequiredArg("name");
this.addRequiredArg("#");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.POWERBOOST.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -47,7 +58,7 @@ public class CmdFactionsPowerBoost extends FCommand
if (doPlayer)
{
UPlayer targetPlayer = this.arg(1, ARUPlayer.getStartAny(sender));
UPlayer targetPlayer = this.arg(1, ARUPlayer.getAny(sender));
if (targetPlayer == null) return;
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.");
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.req.ReqFactionsEnabled;
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
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsPromote()
{
// Aliases
this.addAliases("promote");
// Args
this.addRequiredArg("player");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.PROMOTE.node));
@ -23,10 +30,14 @@ public class CmdFactionsPromote extends FCommand
//We'll handle this internally
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
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.getFaction() != usenderFaction)

View File

@ -1,6 +1,5 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.Perm;
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.ReqRoleIsAtLeast;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.FactionsEventRelationChange;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.event.EventFactionsRelationChange;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public abstract class CmdFactionsRelationAbstract extends FCommand
{
public Rel targetRelation;
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsRelationAbstract()
{
// Aliases
this.addRequiredArg("faction");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.RELATION.node));
this.addRequirements(ReqHasFaction.get());
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -56,7 +66,7 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
}
// Event
FactionsEventRelationChange event = new FactionsEventRelationChange(sender, usenderFaction, otherFaction, newRelation);
EventFactionsRelationChange event = new EventFactionsRelationChange(sender, usenderFaction, otherFaction, newRelation);
event.run();
if (event.isCancelled()) return;
newRelation = event.getNewRelation();
@ -75,7 +85,7 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
else
{
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());
}
@ -93,4 +103,5 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
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
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsRelationAlly()
{
// Aliases
this.addAliases("ally");
// Misc
this.targetRelation = Rel.ALLY;
}
}

View File

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

View File

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

View File

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

View File

@ -7,22 +7,32 @@ import org.bukkit.entity.Player;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.util.VisualizeUtil;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.ps.PS;
import com.massivecraft.mcore.ps.PSFormatHumanSpace;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
public class CmdFactionsSeeChunk extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsSeeChunk()
{
// Aliases
this.addAliases("sc", "seechunk");
//this.addRequirements(ReqFactionsEnabled.get());
// Requirements
// this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.SEE_CHUNK.node));
this.addRequirements(ReqIsPlayer.get());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -56,12 +66,13 @@ public class CmdFactionsSeeChunk extends FCommand
msg("<i>Visualized %s", chunk.toString(PSFormatHumanSpace.get()));
}
@SuppressWarnings("deprecation")
public static void showPillar(Player player, World world, int blockX, int blockZ)
{
for (int blockY = 0; blockY < world.getMaxHeight(); blockY++)
{
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();
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.entity.Faction;
import com.massivecraft.factions.entity.UConf;
import com.massivecraft.factions.event.FactionsEventHomeChange;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.ps.PS;
import com.massivecraft.factions.event.EventFactionsHomeChange;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsSethome extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsSethome()
{
// Aliases
this.addAliases("sethome");
// Args
this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqIsPlayer.get());
this.addRequirements(ReqHasPerm.get(Perm.SETHOME.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
@ -52,7 +63,7 @@ public class CmdFactionsSethome extends FCommand
}
// Event
FactionsEventHomeChange event = new FactionsEventHomeChange(sender, faction, newHome);
EventFactionsHomeChange event = new EventFactionsHomeChange(sender, faction, newHome);
event.run();
if (event.isCancelled()) return;
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.ReqRoleIsAtLeast;
import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.event.FactionsEventTitleChange;
import com.massivecraft.mcore.cmd.arg.ARString;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.factions.event.EventFactionsTitleChange;
import com.massivecraft.massivecore.cmd.arg.ARString;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsTitle extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsTitle()
{
// Aliases
this.addAliases("title");
// Args
this.addRequiredArg("player");
this.addOptionalArg("title", "");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.TITLE.node));
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
// Args
UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender));
UPlayer you = this.arg(0, ARUPlayer.getAny(sender));
if (you == null) return;
String newTitle = this.argConcatFrom(1, ARString.get(), "");
@ -47,7 +58,7 @@ public class CmdFactionsTitle extends FCommand
if ( ! canIAdministerYou(usender, you)) return;
// Event
FactionsEventTitleChange event = new FactionsEventTitleChange(sender, you, newTitle);
EventFactionsTitleChange event = new EventFactionsTitleChange(sender, you, newTitle);
event.run();
if (event.isCancelled()) return;
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.FactionColls;
import com.massivecraft.factions.Perm;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.ps.PS;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsUnclaim extends FCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsUnclaim()
{
// Aliases
this.addAliases("unclaim");
// Requirements
this.addRequirements(ReqFactionsEnabled.get());
this.addRequirements(ReqHasPerm.get(Perm.UNCLAIM.node));
this.addRequirements(ReqHasFaction.get());
this.addRequirements(ReqIsPlayer.get());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{

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