Compare commits
80 Commits
2.2.3-STAB
...
2.3.1-STAB
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e55f053e4d | ||
|
|
945edc946e | ||
|
|
8cace99444 | ||
|
|
5d4735859b | ||
|
|
cef153691d | ||
|
|
4dec162d46 | ||
|
|
606e82c890 | ||
|
|
323dce1c4f | ||
|
|
36c8d53a85 | ||
|
|
81bac35b51 | ||
|
|
19f09a6379 | ||
|
|
19ea590e5f | ||
|
|
d6a274ddc5 | ||
|
|
5591048136 | ||
|
|
fe7738fea0 | ||
|
|
3ba6e1f376 | ||
|
|
dfbfbf9981 | ||
|
|
13399c53c5 | ||
|
|
55d6af7195 | ||
|
|
4f675dfd66 | ||
|
|
22957b641b | ||
|
|
0fc3e47289 | ||
|
|
730693aed1 | ||
|
|
61570be012 | ||
|
|
bcc04e6174 | ||
|
|
d30780e06e | ||
|
|
ed73baf5f1 | ||
|
|
94d2035c78 | ||
|
|
8ff8c78a44 | ||
|
|
591dc2172f | ||
|
|
1a4c860c46 | ||
|
|
ad56264c5d | ||
|
|
def1a8b15a | ||
|
|
8b577d360b | ||
|
|
f34ebc73fa | ||
|
|
c86db7ab51 | ||
|
|
070f239948 | ||
|
|
018f08699d | ||
|
|
5542245b2a | ||
|
|
6eb204587d | ||
|
|
ce1eedd7cd | ||
|
|
417cc57aa7 | ||
|
|
57ac2c8c98 | ||
|
|
25515d863e | ||
|
|
2412931122 | ||
|
|
51838df0d7 | ||
|
|
e3e6f5561c | ||
|
|
a54a7aa4fb | ||
|
|
9de773ddae | ||
|
|
9a32cd9501 | ||
|
|
90d39a3974 | ||
|
|
6544513ca7 | ||
|
|
f7619f0685 | ||
|
|
a20c2ec2eb | ||
|
|
028734a42c | ||
|
|
29b9eadd57 | ||
|
|
83a33c2222 | ||
|
|
c274918244 | ||
|
|
57833bee13 | ||
|
|
0a1346f1c2 | ||
|
|
5145ae1714 | ||
|
|
086ec3e145 | ||
|
|
d538502457 | ||
|
|
978782e2fe | ||
|
|
ce1004d318 | ||
|
|
3545253844 | ||
|
|
ad69019ba6 | ||
|
|
b8f6a05538 | ||
|
|
98b40d325a | ||
|
|
8f2e58733d | ||
|
|
ae17f3d788 | ||
|
|
a71bbd5b14 | ||
|
|
05e1a7297c | ||
|
|
1f9965b13a | ||
|
|
fb32d2155b | ||
|
|
4c90bae87c | ||
|
|
05cfd5d8b0 | ||
|
|
b2fdcd5649 | ||
|
|
f4bfa83e24 | ||
|
|
4222dd9689 |
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -23,7 +23,7 @@ A clear and concise description of what you expected to happen.
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Server VErsion (please complete the following information):**
|
||||
**Server Version (please complete the following information):**
|
||||
- Spigot Version: [e.g. Paperspigot 1.8.8]
|
||||
- Factions Version [use /f version]
|
||||
- Minecraft Version: [If a bug is dependent on client version]
|
||||
|
||||
37
README.md
37
README.md
@@ -1,9 +1,8 @@
|
||||
# SaberFactions
|
||||
|
||||
 [](https://www.codefactor.io/repository/github/driftay/saber-factions)
|
||||
 [](https://www.codefactor.io/repository/github/driftay/saber-factions) [](https://github.com/SaberLLC/Saber-Factions/blob/1.6.x/LICENSE) 
|
||||
|
||||
SaberFactions is a fork of both FactionsUUID and SavageFactions. Creators of those plugins include DtrShock and ProSavage. Credits to them.
|
||||
SaberFactions is the newest, latest and greatest factions plugin designed for the best and most functional factions experience minecraft has seen!
|
||||
SaberFactions is an exotic, performance optmized, and feature rich factions plugin that focuses on not only making the player experience as great as possibly but maintaining this aspect with the cost of NOTHING! We strive to continue development for SaberFactions as the factions community is strongly growing and seeking new players every day.
|
||||
|
||||
## Some Exciting Features
|
||||
Some of our features include the following
|
||||
@@ -14,21 +13,27 @@ Some of our features include the following
|
||||
* More F Upgrades - Unbreakable Redstone Upgrade, Members Upgrade, and Power Upgrade.
|
||||
* Factions Corner - In the corner of a world? No Problem /f corner will claim your entire buffer for you!
|
||||
* Command Cooldowns - Configurable Command Cooldowns for most "spam" commands. And so Much More to Come!
|
||||
* Faction Points - A point based currency that can be used for any aspect of factions gameplay!
|
||||
* Faction Shop - A shop that essentially lets players buy in-game items in exchange for faction points!
|
||||
* Faction Discord Integration - A discord intergrated factions bot for each faction to have their own personalized discord bot within their faction!
|
||||
* Faction Audit - A full based logging system (GUI designed) to see every aspect of what happens in your faction!
|
||||
* Factions Check System - An automated check system that alerts players when to check walls/buffers!
|
||||
* Faction Reserves - A system designed to reserve a specific faction name for a specific player!
|
||||
|
||||
## Dependency With Maven
|
||||
```
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.Driftay</groupId>
|
||||
<artifactId>Saber-Factions</artifactId>
|
||||
<version>1.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.SaberLLC</groupId>
|
||||
<artifactId>Saber-Factions</artifactId>
|
||||
<version>2.2.7-STABLE</version>
|
||||
</dependency>
|
||||
```
|
||||
## Moving Forward
|
||||
|
||||
@@ -36,8 +41,8 @@ Moving forward we plan to take all suggestions into consideration, as they come
|
||||
We Plan on Releasing the latest and greatest factions/skyblock/prison plugins minecraft has to offer and wont settle for anything less
|
||||
|
||||
## Support
|
||||
Our Discord is Currently In Progress of a Massive Overhaul, but we still encourage our community to join and express any concerns/questions/suggestions they may have
|
||||
https://Discord.Saber.pw
|
||||
Have a problem, question, or concer? We encourage our community to join and express any inquiry you may have
|
||||
https://discord.saber.pw
|
||||
|
||||
Look forward to a bright future and a journey with all of you!
|
||||
|
||||
|
||||
12
pom.xml
12
pom.xml
@@ -4,7 +4,7 @@
|
||||
|
||||
<groupId>com.massivecraft</groupId>
|
||||
<artifactId>Factions</artifactId>
|
||||
<version>1.6.9.5-U0.2.1-2.2.3-STABLE</version>
|
||||
<version>1.6.9.5-2.3.1-RC</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>SaberFactions</name>
|
||||
@@ -385,6 +385,12 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mojang</groupId>
|
||||
<artifactId>authlib</artifactId>
|
||||
<version>1.5.21</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.rayzr522</groupId>
|
||||
<artifactId>jsonmessage</artifactId>
|
||||
@@ -405,6 +411,10 @@
|
||||
<name>bintray</name>
|
||||
<url>http://jcenter.bintray.com</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>mojang-repo</id>
|
||||
<url>https://libraries.minecraft.net/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>net.coreprotect</id>
|
||||
<url>http://maven.playpro.com/</url>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.massivecraft.factions;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.massivecraft.factions.integration.dynmap.DynmapStyle;
|
||||
import com.massivecraft.factions.util.XMaterial;
|
||||
import com.massivecraft.factions.zcore.fperms.DefaultPermissions;
|
||||
@@ -99,11 +98,30 @@ public class Conf {
|
||||
public static boolean autoLeaveDeleteFPlayerData = true; // Let them just remove player from Faction.
|
||||
public static boolean worldGuardChecking = false;
|
||||
public static boolean worldGuardBuildPriority = false;
|
||||
public static boolean factionsDrainEnabled = false;
|
||||
|
||||
|
||||
//Claim Fill
|
||||
public static int maxFillClaimCount = 25;
|
||||
public static int maxFillClaimDistance = 5;
|
||||
|
||||
public static boolean factionsDrainEnabled = false;
|
||||
//RESERVE
|
||||
public static boolean useReserveSystem = true;
|
||||
//AUDIT
|
||||
public static boolean useAuditSystem = true;
|
||||
|
||||
//INSPECT
|
||||
public static boolean useInspectSystem = true;
|
||||
|
||||
//GUI's
|
||||
public static boolean useDisbandGUI = true;
|
||||
|
||||
//SEALTH
|
||||
public static boolean useSealthSystem = true;
|
||||
|
||||
//STRIKES
|
||||
public static boolean useStrikeSystem = true;
|
||||
|
||||
//DISCORD
|
||||
public static boolean useDiscordSystem = false;
|
||||
public static String discordBotToken = "<token here>";
|
||||
@@ -119,7 +137,7 @@ public class Conf {
|
||||
public static Boolean factionDiscordTags = false;
|
||||
public static String factionTag = "(NAME) [FACTION]";
|
||||
public static Boolean factionRoles = false;
|
||||
public static List<Integer> factionRoleColor = new ArrayList<Integer>(){{
|
||||
public static List<Integer> factionRoleColor = new ArrayList<Integer>() {{
|
||||
add(25);
|
||||
add(162);
|
||||
add(203);
|
||||
@@ -255,6 +273,7 @@ public class Conf {
|
||||
public static Set<Material> territoryBypassProtectedMaterials = EnumSet.noneOf(Material.class);
|
||||
// Dependency check
|
||||
public static boolean dependencyCheck = true;
|
||||
public static boolean enableClickToClaim = true;
|
||||
|
||||
public static Set<Material> territoryCancelAndAllowItemUseMaterial = new HashSet<>();
|
||||
public static Set<Material> territoryDenySwitchMaterials = new HashSet<>();
|
||||
@@ -576,7 +595,9 @@ public class Conf {
|
||||
FactionsPlugin.getInstance().persist.save(i);
|
||||
}
|
||||
|
||||
public static void saveSync() { FactionsPlugin.instance.persist.saveSync(i); }
|
||||
public static void saveSync() {
|
||||
FactionsPlugin.instance.persist.saveSync(i);
|
||||
}
|
||||
|
||||
public enum Backend {
|
||||
JSON,
|
||||
|
||||
@@ -22,7 +22,6 @@ public class FLocation implements Serializable {
|
||||
worldBorderClassPresent = true;
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
}
|
||||
|
||||
worldBorderSupport = worldBorderClassPresent;
|
||||
}
|
||||
|
||||
@@ -45,7 +44,7 @@ public class FLocation implements Serializable {
|
||||
}
|
||||
|
||||
public FLocation(Location location) {
|
||||
this(location.getWorld().getName(), blockToChunk(location.getBlockX()), blockToChunk(location.getBlockZ()));
|
||||
this(Objects.requireNonNull(location.getWorld()).getName(), blockToChunk(location.getBlockX()), blockToChunk(location.getBlockZ()));
|
||||
}
|
||||
|
||||
public FLocation(Player player) {
|
||||
@@ -152,7 +151,9 @@ public class FLocation implements Serializable {
|
||||
return "" + x + "," + z;
|
||||
}
|
||||
|
||||
public String formatXAndZ(String splitter) { return chunkToBlock(this.x) + "x" + splitter + " " + chunkToBlock(this.z) + "z"; }
|
||||
public String formatXAndZ(String splitter) {
|
||||
return chunkToBlock(this.x) + "x" + splitter + " " + chunkToBlock(this.z) + "z";
|
||||
}
|
||||
|
||||
//----------------------------------------------//
|
||||
// Misc Geometry
|
||||
@@ -180,9 +181,9 @@ public class FLocation implements Serializable {
|
||||
}
|
||||
|
||||
public boolean isInChunk(Location loc) {
|
||||
if (loc == null) {
|
||||
return false;
|
||||
}
|
||||
if (loc == null) return false;
|
||||
if (loc.getWorld() == null) return false;
|
||||
|
||||
Chunk chunk = loc.getChunk();
|
||||
return loc.getWorld().getName().equalsIgnoreCase(getWorldName()) && chunk.getX() == x && chunk.getZ() == z;
|
||||
}
|
||||
@@ -194,18 +195,23 @@ public class FLocation implements Serializable {
|
||||
* @return whether this location is outside of the border
|
||||
*/
|
||||
public boolean isOutsideWorldBorder(int buffer) {
|
||||
if (!worldBorderSupport) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!worldBorderSupport) return false;
|
||||
WorldBorder border = getWorld().getWorldBorder();
|
||||
Chunk chunk = border.getCenter().getChunk();
|
||||
Location center = border.getCenter();
|
||||
double size = border.getSize();
|
||||
|
||||
int lim = FLocation.chunkToRegion((int) border.getSize()) - buffer;
|
||||
int diffX = chunk.getX() - x;
|
||||
int diffZ = chunk.getZ() - z;
|
||||
int bufferBlocks = buffer << 4;
|
||||
|
||||
return (diffX > lim || diffZ > lim) || (-diffX >= lim || -diffZ >= lim);
|
||||
double borderMinX = (center.getX() - size / 2.0D) + bufferBlocks;
|
||||
double borderMinZ = (center.getZ() - size / 2.0D) + bufferBlocks;
|
||||
double borderMaxX = (center.getX() + size / 2.0D) - bufferBlocks;
|
||||
double borderMaxZ = (center.getZ() + size / 2.0D) - bufferBlocks;
|
||||
|
||||
int chunkMinX = this.x << 4;
|
||||
int chunkMaxX = chunkMinX | 15;
|
||||
int chunkMinZ = this.z << 4;
|
||||
int chunkMaxZ = chunkMinZ | 15;
|
||||
return (chunkMinX >= borderMaxX) || (chunkMinZ >= borderMaxZ) || (chunkMaxX <= borderMinX) || (chunkMaxZ <= borderMinZ);
|
||||
}
|
||||
|
||||
//----------------------------------------------//
|
||||
@@ -215,10 +221,7 @@ public class FLocation implements Serializable {
|
||||
double radiusSquared = radius * radius;
|
||||
|
||||
Set<FLocation> ret = new LinkedHashSet<>();
|
||||
if (radius <= 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (radius <= 0) return ret;
|
||||
int xfrom = (int) Math.floor(this.x - radius);
|
||||
int xto = (int) Math.ceil(this.x + radius);
|
||||
int zfrom = (int) Math.floor(this.z - radius);
|
||||
@@ -232,7 +235,6 @@ public class FLocation implements Serializable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -248,13 +250,8 @@ public class FLocation implements Serializable {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof FLocation)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (obj == this) return true;
|
||||
if (!(obj instanceof FLocation)) return false;
|
||||
FLocation that = (FLocation) obj;
|
||||
return this.x == that.x && this.z == that.z && (Objects.equals(this.worldName, that.worldName));
|
||||
}
|
||||
|
||||
@@ -31,50 +31,73 @@ public interface FPlayer extends EconomyParticipator {
|
||||
|
||||
boolean hasNotificationsEnabled();
|
||||
|
||||
/**
|
||||
* Determine if a player has enemies nearby based on the enemy check task in CmdFly
|
||||
* NOTE: THIS VALUE IS ONLY UPDATED WHEN A USER IS USING FLY
|
||||
*
|
||||
* @return enemiesNearby as a boolean
|
||||
*/
|
||||
boolean hasEnemiesNearby();
|
||||
|
||||
/**
|
||||
* Set if this FPlayer has an enemy nearby
|
||||
*
|
||||
* @param b enemiesNearby
|
||||
*/
|
||||
void setEnemiesNearby(Boolean b);
|
||||
|
||||
/**
|
||||
* Get if a player has setup their Discord before
|
||||
*
|
||||
* @return if the player setup Discord as a boolean
|
||||
*/
|
||||
boolean discordSetup();
|
||||
|
||||
/**
|
||||
* Get the players Discord user ID
|
||||
*
|
||||
* @return players Discord user ID as a String
|
||||
*/
|
||||
String discordUserID();
|
||||
|
||||
/**
|
||||
* Set the players Boolean defining if the player has setup their Discord
|
||||
*
|
||||
* @param b Boolean for discordSetup to be defined to
|
||||
*/
|
||||
void setDiscordSetup(Boolean b);
|
||||
|
||||
/**
|
||||
* Set the players Discord user ID
|
||||
*
|
||||
* @param s String for their user ID to be set to
|
||||
*/
|
||||
void setDiscordUserID(String s);
|
||||
|
||||
/**
|
||||
* Get the players Discord user (If the player has not setup Discord it will return null!)
|
||||
*
|
||||
* @return User from players set Discord User ID
|
||||
*/
|
||||
User discordUser();
|
||||
|
||||
/**
|
||||
* Used to check if this player should be served titles
|
||||
*
|
||||
* @return if this FPlayer has titles enabled as a boolean
|
||||
*/
|
||||
boolean hasTitlesEnabled();
|
||||
|
||||
/**
|
||||
* Used to set if player should be served titles
|
||||
*
|
||||
* @param b Boolean to titlesEnabled to
|
||||
*/
|
||||
void setTitlesEnabled(Boolean b);
|
||||
|
||||
/**
|
||||
* Used to determine if a player is in their faction's chest
|
||||
*
|
||||
* @return if player is in their faction's as a boolean
|
||||
*/
|
||||
boolean isInFactionsChest();
|
||||
|
||||
@@ -247,6 +247,8 @@ public interface Faction extends EconomyParticipator {
|
||||
|
||||
void setHome(Location home);
|
||||
|
||||
void deleteHome();
|
||||
|
||||
long getFoundedDate();
|
||||
|
||||
void setFoundedDate(long newDate);
|
||||
@@ -441,4 +443,7 @@ public interface Faction extends EconomyParticipator {
|
||||
|
||||
void paypalSet(String paypal);
|
||||
|
||||
// -------------------------------
|
||||
// Shields
|
||||
// -------------------------------
|
||||
}
|
||||
|
||||
@@ -4,16 +4,15 @@ import ch.njol.skript.Skript;
|
||||
import ch.njol.skript.SkriptAddon;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.massivecraft.factions.cmd.CmdAutoHelp;
|
||||
import com.massivecraft.factions.cmd.CommandContext;
|
||||
import com.massivecraft.factions.cmd.FCmdRoot;
|
||||
import com.massivecraft.factions.cmd.FCommand;
|
||||
import com.massivecraft.factions.cmd.*;
|
||||
import com.massivecraft.factions.cmd.audit.FChestListener;
|
||||
import com.massivecraft.factions.cmd.audit.FLogManager;
|
||||
import com.massivecraft.factions.cmd.audit.FLogType;
|
||||
import com.massivecraft.factions.cmd.check.CheckTask;
|
||||
import com.massivecraft.factions.cmd.check.WeeWooTask;
|
||||
import com.massivecraft.factions.cmd.chest.AntiChestListener;
|
||||
import com.massivecraft.factions.cmd.reserve.ListParameterizedType;
|
||||
import com.massivecraft.factions.cmd.reserve.ReserveObject;
|
||||
import com.massivecraft.factions.discord.Discord;
|
||||
import com.massivecraft.factions.discord.DiscordListener;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
@@ -32,7 +31,7 @@ import com.massivecraft.factions.zcore.MPlugin;
|
||||
import com.massivecraft.factions.zcore.fperms.Access;
|
||||
import com.massivecraft.factions.zcore.fperms.Permissable;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.fupgrades.*;
|
||||
import com.massivecraft.factions.zcore.fupgrades.UpgradesListener;
|
||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
||||
import me.lucko.commodore.CommodoreProvider;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
@@ -40,8 +39,6 @@ import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
@@ -54,6 +51,8 @@ import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Type;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.logging.Level;
|
||||
@@ -70,7 +69,6 @@ public class FactionsPlugin extends MPlugin {
|
||||
// Plugins can check this boolean while hooking in have
|
||||
// a green light to use the api.
|
||||
public static boolean startupFinished = false;
|
||||
public static Economy econ = null;
|
||||
public boolean PlaceholderApi;
|
||||
// Commands
|
||||
public FCmdRoot cmdBase;
|
||||
@@ -80,8 +78,10 @@ public class FactionsPlugin extends MPlugin {
|
||||
public boolean mc112 = false;
|
||||
public boolean mc113 = false;
|
||||
public boolean mc114 = false;
|
||||
public boolean mc115 = false;
|
||||
public boolean useNonPacketParticles = false;
|
||||
public boolean factionsFlight = false;
|
||||
public List<String> itemList = getConfig().getStringList("fchest.Items-Not-Allowed");
|
||||
SkriptAddon skriptAddon;
|
||||
private FactionsPlayerListener factionsPlayerListener;
|
||||
private boolean locked = false;
|
||||
@@ -91,9 +91,9 @@ public class FactionsPlugin extends MPlugin {
|
||||
private ClipPlaceholderAPIManager clipPlaceholderAPIManager;
|
||||
private boolean mvdwPlaceholderAPIManager = false;
|
||||
private Listener[] eventsListener;
|
||||
public List<String> itemList = getConfig().getStringList("fchest.Items-Not-Allowed");
|
||||
private Worldguard wg;
|
||||
private FLogManager fLogManager;
|
||||
private List<ReserveObject> reserveObjects;
|
||||
|
||||
|
||||
public FactionsPlugin() {
|
||||
@@ -123,25 +123,19 @@ public class FactionsPlugin extends MPlugin {
|
||||
}
|
||||
|
||||
public void playSoundForAll(String sound) {
|
||||
for (Player pl : Bukkit.getOnlinePlayers()) {
|
||||
playSound(pl, sound);
|
||||
}
|
||||
for (Player pl : Bukkit.getOnlinePlayers()) playSound(pl, sound);
|
||||
}
|
||||
|
||||
public void playSoundForAll(List<String> sounds) {
|
||||
for (Player pl : Bukkit.getOnlinePlayers()) {
|
||||
playSound(pl, sounds);
|
||||
}
|
||||
for (Player pl : Bukkit.getOnlinePlayers()) playSound(pl, sounds);
|
||||
}
|
||||
|
||||
public void playSound(Player p, List<String> sounds) {
|
||||
for (String sound : sounds) {
|
||||
playSound(p, sound);
|
||||
}
|
||||
for (String sound : sounds) playSound(p, sound);
|
||||
}
|
||||
|
||||
public void playSound(Player p, String sound) {
|
||||
float pitch = Float.valueOf(sound.split(":")[1]);
|
||||
float pitch = Float.parseFloat(sound.split(":")[1]);
|
||||
sound = sound.split(":")[0];
|
||||
p.playSound(p.getLocation(), Sound.valueOf(sound), pitch, 5.0F);
|
||||
}
|
||||
@@ -171,13 +165,15 @@ public class FactionsPlugin extends MPlugin {
|
||||
FactionsPlugin.instance.log("Minecraft Version 1.14 found.");
|
||||
mc114 = true;
|
||||
break;
|
||||
case 15:
|
||||
FactionsPlugin.instance.log("Minecraft Version 1.15 found.");
|
||||
mc115 = true;
|
||||
break;
|
||||
}
|
||||
migrateFPlayerLeaders();
|
||||
log("==== End Setup ====");
|
||||
|
||||
if (!preEnable()) {
|
||||
return;
|
||||
}
|
||||
if (!preEnable()) return;
|
||||
this.loadSuccessful = false;
|
||||
|
||||
if (!new File(this.getDataFolder() + "/config.yml").exists()) {
|
||||
@@ -190,19 +186,18 @@ public class FactionsPlugin extends MPlugin {
|
||||
Conf.load();
|
||||
fLogManager = new FLogManager();
|
||||
//Dependency checks
|
||||
if (Conf.dependencyCheck && (!Bukkit.getPluginManager().isPluginEnabled("Vault") && !Bukkit.getPluginManager().isPluginEnabled("Essentials"))) {
|
||||
if (Conf.dependencyCheck && (!Bukkit.getPluginManager().isPluginEnabled("Vault"))) {
|
||||
divider();
|
||||
System.out.println("You are missing dependencies!");
|
||||
System.out.println("Please verify EssentialsX and Vault are installed!");
|
||||
System.out.println("Please verify and Vault are installed!");
|
||||
Conf.save();
|
||||
Bukkit.getPluginManager().disablePlugin(instance);
|
||||
divider();
|
||||
return;
|
||||
}
|
||||
//Update their config if needed
|
||||
// Updater.updateIfNeeded(getConfig());
|
||||
// Updater.updateIfNeeded(getConfig());
|
||||
RegisteredServiceProvider<Economy> rsp = FactionsPlugin.this.getServer().getServicesManager().getRegistration(Economy.class);
|
||||
FactionsPlugin.econ = rsp.getProvider();
|
||||
com.massivecraft.factions.integration.Essentials.setup();
|
||||
hookedPlayervaults = setupPlayervaults();
|
||||
FPlayers.getInstance().load();
|
||||
@@ -215,20 +210,15 @@ public class FactionsPlugin extends MPlugin {
|
||||
fPlayer.resetFactionData(false);
|
||||
continue;
|
||||
}
|
||||
if (fPlayer.isAlt()) {
|
||||
faction.addAltPlayer(fPlayer);
|
||||
} else {
|
||||
faction.addFPlayer(fPlayer);
|
||||
}
|
||||
if (fPlayer.isAlt()) faction.addAltPlayer(fPlayer);
|
||||
else faction.addFPlayer(fPlayer);
|
||||
}
|
||||
|
||||
if (getConfig().getBoolean("enable-faction-flight", true)) {
|
||||
UtilFly.run();
|
||||
}
|
||||
|
||||
Board.getInstance().load();
|
||||
Board.getInstance().clean();
|
||||
|
||||
//Load command aliases
|
||||
Aliases.load();
|
||||
// Add Base Commands
|
||||
this.cmdBase = new FCmdRoot();
|
||||
this.cmdAutoHelp = new CmdAutoHelp();
|
||||
@@ -248,9 +238,7 @@ public class FactionsPlugin extends MPlugin {
|
||||
log("Minecraft Version 1.9 or higher found, using non packet based particle API");
|
||||
}
|
||||
|
||||
if (getConfig().getBoolean("enable-faction-flight")) {
|
||||
factionsFlight = true;
|
||||
}
|
||||
if (getConfig().getBoolean("enable-faction-flight")) factionsFlight = true;
|
||||
|
||||
if (getServer().getPluginManager().getPlugin("Skript") != null) {
|
||||
log("Skript was found! Registering FactionsPlugin Addon...");
|
||||
@@ -286,7 +274,6 @@ public class FactionsPlugin extends MPlugin {
|
||||
new FactionsEntityListener(),
|
||||
new FactionsExploitListener(),
|
||||
new FactionsBlockListener(),
|
||||
new FUpgradesGUI(),
|
||||
new UpgradesListener(),
|
||||
new MissionHandler(this),
|
||||
new FChestListener(),
|
||||
@@ -300,7 +287,25 @@ public class FactionsPlugin extends MPlugin {
|
||||
this.getCommand(refCommand).setExecutor(cmdBase);
|
||||
|
||||
if (!CommodoreProvider.isSupported()) this.getCommand(refCommand).setTabCompleter(this);
|
||||
|
||||
reserveObjects = new ArrayList<>();
|
||||
String path = Paths.get(this.getDataFolder().getAbsolutePath()).toAbsolutePath().toString() + File.separator + "reserves.json";
|
||||
File file = new File(path);
|
||||
try {
|
||||
String json;
|
||||
if (!file.exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
file.createNewFile();
|
||||
}
|
||||
json = String.join("", Files.readAllLines(Paths.get(file.getPath()))).replace("\n", "").replace("\r", "");
|
||||
if (json.equalsIgnoreCase("")) {
|
||||
Files.write(Paths.get(path), "[]".getBytes());
|
||||
json = "[]";
|
||||
}
|
||||
reserveObjects = this.getGsonBuilder().create().fromJson(json, new ListParameterizedType(ReserveObject.class));
|
||||
if (reserveObjects == null) reserveObjects = new ArrayList<>();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (getDescription().getFullName().contains("BETA")) {
|
||||
divider();
|
||||
System.out.println("You are using a BETA version of the plugin!");
|
||||
@@ -357,7 +362,6 @@ public class FactionsPlugin extends MPlugin {
|
||||
try {
|
||||
BufferedReader br = new BufferedReader(new FileReader(fplayerFile));
|
||||
System.out.println("Migrating old players.json file.");
|
||||
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
if (line.contains("\"role\": \"ADMIN\"")) {
|
||||
@@ -389,9 +393,7 @@ public class FactionsPlugin extends MPlugin {
|
||||
private boolean setupPermissions() {
|
||||
try {
|
||||
RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
|
||||
if (rsp != null) {
|
||||
perms = rsp.getProvider();
|
||||
}
|
||||
if (rsp != null) perms = rsp.getProvider();
|
||||
} catch (NoClassDefFoundError ex) {
|
||||
return false;
|
||||
}
|
||||
@@ -428,16 +430,30 @@ public class FactionsPlugin extends MPlugin {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
// only save data if plugin actually completely loaded successfully
|
||||
if (this.loadSuccessful) {
|
||||
Conf.saveSync();
|
||||
try {
|
||||
String path = Paths.get(getDataFolder().getAbsolutePath()).toAbsolutePath().toString() + File.separator + "reserves.json";
|
||||
File file = new File(path);
|
||||
if (!file.exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
file.createNewFile();
|
||||
}
|
||||
Files.write(Paths.get(file.getPath()), getGsonBuilder().create().toJson(reserveObjects).getBytes());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// only save data if plugin actually completely loaded successfully
|
||||
if (this.loadSuccessful) Conf.saveSync();
|
||||
|
||||
|
||||
if (AutoLeaveTask != null) {
|
||||
this.getServer().getScheduler().cancelTask(AutoLeaveTask);
|
||||
AutoLeaveTask = null;
|
||||
}
|
||||
DiscordListener.saveGuilds();
|
||||
if (Discord.jda != null) {
|
||||
Discord.jda.shutdownNow();
|
||||
}
|
||||
super.onDisable();
|
||||
try {
|
||||
fLogManager.saveLogs();
|
||||
@@ -448,9 +464,7 @@ public class FactionsPlugin extends MPlugin {
|
||||
|
||||
public void startAutoLeaveTask(boolean restartIfRunning) {
|
||||
if (AutoLeaveTask != null) {
|
||||
if (!restartIfRunning) {
|
||||
return;
|
||||
}
|
||||
if (!restartIfRunning) return;
|
||||
this.getServer().getScheduler().cancelTask(AutoLeaveTask);
|
||||
}
|
||||
|
||||
@@ -467,7 +481,7 @@ public class FactionsPlugin extends MPlugin {
|
||||
}
|
||||
|
||||
public ItemStack createItem(Material material, int amount, short datavalue, String name, List<String> lore) {
|
||||
ItemStack item = new ItemStack(XMaterial.matchXMaterial(material.toString()).parseMaterial(), amount, datavalue);
|
||||
ItemStack item = new ItemStack(XMaterial.matchXMaterial(material.toString()).get().parseMaterial(), amount, datavalue);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(color(name));
|
||||
meta.setLore(colorList(lore));
|
||||
@@ -502,9 +516,7 @@ public class FactionsPlugin extends MPlugin {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] split) {
|
||||
if (split.length == 0) {
|
||||
return handleCommand(sender, "/f help", false);
|
||||
}
|
||||
if (split.length == 0) return handleCommand(sender, "/f help", false);
|
||||
|
||||
// otherwise, needs to be handled; presumably another plugin directly ran the command
|
||||
String cmd = Conf.baseCommandAliases.isEmpty() ? "/f" : "/" + Conf.baseCommandAliases.get(0);
|
||||
@@ -517,8 +529,6 @@ public class FactionsPlugin extends MPlugin {
|
||||
// Must be a LinkedList to prevent UnsupportedOperationException.
|
||||
List<String> argsList = new LinkedList<>(Arrays.asList(args));
|
||||
CommandContext context = new CommandContext(sender, argsList, alias);
|
||||
String cmd = Conf.baseCommandAliases.isEmpty() ? "/f" : "/" + Conf.baseCommandAliases.get(0);
|
||||
// String cmdValid = (cmd + " " + TextUtil.implode(context.args, " ")).trim();
|
||||
List<FCommand> commandsList = cmdBase.subCommands;
|
||||
FCommand commandsEx = cmdBase;
|
||||
List<String> completions = new ArrayList<>();
|
||||
@@ -547,16 +557,12 @@ public class FactionsPlugin extends MPlugin {
|
||||
}
|
||||
}
|
||||
String lastArg = args[args.length - 1].toLowerCase();
|
||||
|
||||
completions = completions.stream()
|
||||
.filter(m -> m.toLowerCase().startsWith(lastArg))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return completions;
|
||||
|
||||
} else {
|
||||
String lastArg = args[args.length - 1].toLowerCase();
|
||||
|
||||
for (Role value : Role.values()) completions.add(value.nicename);
|
||||
for (Relation value : Relation.values()) completions.add(value.nicename);
|
||||
// The stream and foreach from the old implementation looped 2 times, by looping all players -> filtered -> looped filter and added -> filtered AGAIN at the end.
|
||||
@@ -595,11 +601,8 @@ public class FactionsPlugin extends MPlugin {
|
||||
// Does player have Faction Chat enabled? If so, chat plugins should preferably not do channels,
|
||||
// local chat, or anything else which targets individual recipients, so Faction Chat can be done
|
||||
public boolean isPlayerFactionChatting(Player player) {
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
if (player == null) return false;
|
||||
FPlayer me = FPlayers.getInstance().getByPlayer(player);
|
||||
|
||||
return me != null && me.getChatMode().isAtLeast(ChatMode.ALLIANCE);
|
||||
}
|
||||
|
||||
@@ -620,15 +623,11 @@ public class FactionsPlugin extends MPlugin {
|
||||
public String getPlayerFactionTagRelation(Player speaker, Player listener) {
|
||||
String tag = "~";
|
||||
|
||||
if (speaker == null) {
|
||||
return tag;
|
||||
}
|
||||
if (speaker == null) return tag;
|
||||
|
||||
|
||||
FPlayer me = FPlayers.getInstance().getByPlayer(speaker);
|
||||
if (me == null) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
if (me == null) return tag;
|
||||
// if listener isn't set, or config option is disabled, give back uncolored tag
|
||||
if (listener == null || !Conf.chatTagRelationColored) {
|
||||
tag = me.getChatTag().trim();
|
||||
@@ -636,15 +635,11 @@ public class FactionsPlugin extends MPlugin {
|
||||
FPlayer you = FPlayers.getInstance().getByPlayer(listener);
|
||||
if (you == null) {
|
||||
tag = me.getChatTag().trim();
|
||||
} else // everything checks out, give the colored tag
|
||||
{
|
||||
} else { // everything checks out, give the colored tag
|
||||
tag = me.getChatTag(you).trim();
|
||||
}
|
||||
}
|
||||
if (tag.isEmpty()) {
|
||||
tag = "~";
|
||||
}
|
||||
|
||||
if (tag.isEmpty()) tag = "~";
|
||||
return tag;
|
||||
}
|
||||
|
||||
@@ -659,15 +654,9 @@ public class FactionsPlugin extends MPlugin {
|
||||
|
||||
// Get a player's title within their faction, mainly for usage by chat plugins for local/channel chat
|
||||
public String getPlayerTitle(Player player) {
|
||||
if (player == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (player == null) return "";
|
||||
FPlayer me = FPlayers.getInstance().getByPlayer(player);
|
||||
if (me == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (me == null) return "";
|
||||
return me.getTitle().trim();
|
||||
}
|
||||
|
||||
@@ -678,9 +667,7 @@ public class FactionsPlugin extends MPlugin {
|
||||
|
||||
//colors a string list
|
||||
public List<String> colorList(List<String> lore) {
|
||||
for (int i = 0; i <= lore.size() - 1; i++) {
|
||||
lore.set(i, color(lore.get(i)));
|
||||
}
|
||||
for (int i = 0; i <= lore.size() - 1; i++) lore.set(i, color(lore.get(i)));
|
||||
return lore;
|
||||
}
|
||||
|
||||
@@ -689,14 +676,16 @@ public class FactionsPlugin extends MPlugin {
|
||||
return Factions.getInstance().getFactionTags();
|
||||
}
|
||||
|
||||
public List<ReserveObject> getFactionReserves() {
|
||||
return this.reserveObjects;
|
||||
}
|
||||
|
||||
// Get a list of all players in the specified faction
|
||||
public Set<String> getPlayersInFaction(String factionTag) {
|
||||
Set<String> players = new HashSet<>();
|
||||
Faction faction = Factions.getInstance().getByTag(factionTag);
|
||||
if (faction != null) {
|
||||
for (FPlayer fplayer : faction.getFPlayers()) {
|
||||
players.add(fplayer.getName());
|
||||
}
|
||||
for (FPlayer fplayer : faction.getFPlayers()) players.add(fplayer.getName());
|
||||
}
|
||||
return players;
|
||||
}
|
||||
@@ -706,9 +695,7 @@ public class FactionsPlugin extends MPlugin {
|
||||
Set<String> players = new HashSet<>();
|
||||
Faction faction = Factions.getInstance().getByTag(factionTag);
|
||||
if (faction != null) {
|
||||
for (FPlayer fplayer : faction.getFPlayersWhereOnline(true)) {
|
||||
players.add(fplayer.getName());
|
||||
}
|
||||
for (FPlayer fplayer : faction.getFPlayersWhereOnline(true)) players.add(fplayer.getName());
|
||||
}
|
||||
return players;
|
||||
}
|
||||
@@ -728,9 +715,7 @@ public class FactionsPlugin extends MPlugin {
|
||||
}
|
||||
|
||||
public void debug(Level level, String s) {
|
||||
if (getConfig().getBoolean("debug", false)) {
|
||||
getLogger().log(level, s);
|
||||
}
|
||||
if (getConfig().getBoolean("debug", false)) getLogger().log(level, s);
|
||||
}
|
||||
|
||||
public FactionsPlayerListener getFactionsPlayerListener() {
|
||||
|
||||
152
src/main/java/com/massivecraft/factions/cmd/Aliases.java
Normal file
152
src/main/java/com/massivecraft/factions/cmd/Aliases.java
Normal file
@@ -0,0 +1,152 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
public class Aliases {
|
||||
/**
|
||||
* @author DroppingAnvil
|
||||
*/
|
||||
public static ArrayList<String> alts_alts = new ArrayList<>(Arrays.asList("alts", "alt"));
|
||||
public static ArrayList<String> alts_list = new ArrayList<>(Arrays.asList("list", "l"));
|
||||
public static ArrayList<String> alts_invite = new ArrayList<>(Collections.singletonList("invite"));
|
||||
public static ArrayList<String> alts_kick = new ArrayList<>(Collections.singletonList("kick"));
|
||||
public static ArrayList<String> audit = new ArrayList<>(Arrays.asList("audit", "log", "logs"));
|
||||
public static ArrayList<String> check = new ArrayList<>(Arrays.asList("check"));
|
||||
public static ArrayList<String> weewoo = new ArrayList<>(Collections.singletonList("weewoo"));
|
||||
public static ArrayList<String> chest = new ArrayList<>(Arrays.asList("chest", "pv"));
|
||||
public static ArrayList<String> claim_auto = new ArrayList<>(Collections.singletonList("autoclaim"));
|
||||
public static ArrayList<String> claim_claim = new ArrayList<>(Collections.singletonList("claim"));
|
||||
public static ArrayList<String> claim_at = new ArrayList<>(Collections.singletonList("claimat"));
|
||||
public static ArrayList<String> claim_claimFill = new ArrayList<>(Arrays.asList("claimfill", "cf"));
|
||||
public static ArrayList<String> claim_line = new ArrayList<>(Arrays.asList("claimline", "cl"));
|
||||
public static ArrayList<String> claim_corner = new ArrayList<>(Arrays.asList("corner"));
|
||||
public static ArrayList<String> delfHome = new ArrayList<>(Arrays.asList("delhome", "deletehome"));
|
||||
public static ArrayList<String> unclaim_all_safe = new ArrayList<>(Arrays.asList("safeunclaimall", "safedeclaimall"));
|
||||
public static ArrayList<String> unclaim_unclaim = new ArrayList<>(Arrays.asList("unclaim", "declaim"));
|
||||
public static ArrayList<String> unclaim_all_unsafe = new ArrayList<>(Arrays.asList("unclaimall", "declaimall"));
|
||||
public static ArrayList<String> unclaim_all_war = new ArrayList<>(Arrays.asList("warunclaimall", "wardeclaimall"));
|
||||
public static ArrayList<String> money_money = new ArrayList<>(Arrays.asList("money", "bank"));
|
||||
public static ArrayList<String> money_balance = new ArrayList<>(Arrays.asList("b", "balance"));
|
||||
public static ArrayList<String> money_deposit = new ArrayList<>(Arrays.asList("d", "deposit"));
|
||||
public static ArrayList<String> money_transfer_Ff = new ArrayList<>(Collections.singletonList("ff"));
|
||||
public static ArrayList<String> money_transfer_Fp = new ArrayList<>(Collections.singletonList("fp"));
|
||||
public static ArrayList<String> money_transfer_Pf = new ArrayList<>(Collections.singletonList("pf"));
|
||||
public static ArrayList<String> money_withdraw = new ArrayList<>(Arrays.asList("w", "withdraw"));
|
||||
public static ArrayList<String> grace = new ArrayList<>(Collections.singletonList("grace"));
|
||||
public static ArrayList<String> logout = new ArrayList<>(Collections.singletonList("logout"));
|
||||
public static ArrayList<String> points_points = new ArrayList<>(Collections.singletonList("points"));
|
||||
public static ArrayList<String> points_add = new ArrayList<>(Collections.singletonList("add"));
|
||||
public static ArrayList<String> points_remove = new ArrayList<>(Collections.singletonList("remove"));
|
||||
public static ArrayList<String> points_set = new ArrayList<>(Collections.singletonList("set"));
|
||||
public static ArrayList<String> relation_ally = new ArrayList<>(Collections.singletonList("ally"));
|
||||
public static ArrayList<String> relation_enemy = new ArrayList<>(Collections.singletonList("enemy"));
|
||||
public static ArrayList<String> relation_neutral = new ArrayList<>(Collections.singletonList("neutral"));
|
||||
public static ArrayList<String> relation_truce = new ArrayList<>(Collections.singletonList("truce"));
|
||||
public static ArrayList<String> reserve = new ArrayList<>(Collections.singletonList("reserve"));
|
||||
public static ArrayList<String> roles_demote = new ArrayList<>(Collections.singletonList("demote"));
|
||||
public static ArrayList<String> roles_promote = new ArrayList<>(Collections.singletonList("promote"));
|
||||
public static ArrayList<String> tnt_tnt = new ArrayList<>(Collections.singletonList("tnt"));
|
||||
public static ArrayList<String> tnt_tntfill = new ArrayList<>(Collections.singletonList("tntfill"));
|
||||
public static ArrayList<String> wild = new ArrayList<>(Collections.singletonList("wild"));
|
||||
public static ArrayList<String> admin = new ArrayList<>(Arrays.asList("admin", "setadmin", "leader", "setleader"));
|
||||
public static ArrayList<String> ahome = new ArrayList<>(Collections.singletonList("ahome"));
|
||||
public static ArrayList<String> announce = new ArrayList<>(Arrays.asList("ann", "announce"));
|
||||
public static ArrayList<String> help = new ArrayList<>(Arrays.asList("help", "h", "?"));
|
||||
public static ArrayList<String> ban_ban = new ArrayList<>(Collections.singletonList("ban"));
|
||||
public static ArrayList<String> ban_banlist = new ArrayList<>(Arrays.asList("banlist", "bans", "banl"));
|
||||
public static ArrayList<String> banner = new ArrayList<>(Collections.singletonList("banner"));
|
||||
public static ArrayList<String> boom = new ArrayList<>(Arrays.asList("noboom", "explosions", "toggleexplosions"));
|
||||
public static ArrayList<String> bypass = new ArrayList<>(Collections.singletonList("bypass"));
|
||||
public static ArrayList<String> chat = new ArrayList<>(Arrays.asList("chat", "c"));
|
||||
public static ArrayList<String> chatspy = new ArrayList<>(Collections.singletonList("chatspy"));
|
||||
public static ArrayList<String> checkpoint = new ArrayList<>(Arrays.asList("checkp", "checkpoint", "cpoint"));
|
||||
public static ArrayList<String> coleader = new ArrayList<>(Arrays.asList("coleader", "setcoleader", "co", "setco"));
|
||||
public static ArrayList<String> config = new ArrayList<>(Collections.singletonList("config"));
|
||||
public static ArrayList<String> convert = new ArrayList<>(Collections.singletonList("convert"));
|
||||
public static ArrayList<String> coords = new ArrayList<>(Arrays.asList("coords", "coord"));
|
||||
public static ArrayList<String> create = new ArrayList<>(Collections.singletonList("create"));
|
||||
public static ArrayList<String> debug = new ArrayList<>(Collections.singletonList("debug"));
|
||||
public static ArrayList<String> deinvite = new ArrayList<>(Arrays.asList("deinvite", "deinv"));
|
||||
public static ArrayList<String> deletefwarp = new ArrayList<>(Arrays.asList("delwarp", "dw", "deletewarp"));
|
||||
public static ArrayList<String> description = new ArrayList<>(Arrays.asList("desc", "description"));
|
||||
public static ArrayList<String> disband = new ArrayList<>(Collections.singletonList("disband"));
|
||||
public static ArrayList<String> discord_discord = new ArrayList<>(Collections.singletonList("discord"));
|
||||
public static ArrayList<String> drain = new ArrayList<>(Collections.singletonList("drain"));
|
||||
public static ArrayList<String> global = new ArrayList<>(Arrays.asList("gchat", "global", "globalchat"));
|
||||
public static ArrayList<String> fly = new ArrayList<>(Collections.singletonList("fly"));
|
||||
public static ArrayList<String> focus = new ArrayList<>(Collections.singletonList("focus"));
|
||||
public static ArrayList<String> warp = new ArrayList<>(Arrays.asList("warp", "warps"));
|
||||
public static ArrayList<String> getvault = new ArrayList<>(Collections.singletonList("getvault"));
|
||||
public static ArrayList<String> home = new ArrayList<>(Collections.singletonList("home"));
|
||||
public static ArrayList<String> inspect = new ArrayList<>(Arrays.asList("inspect", "ins"));
|
||||
public static ArrayList<String> invsee = new ArrayList<>(Arrays.asList("invsee", "inventorysee"));
|
||||
public static ArrayList<String> invite = new ArrayList<>(Arrays.asList("invite", "inv"));
|
||||
public static ArrayList<String> join = new ArrayList<>(Collections.singletonList("join"));
|
||||
public static ArrayList<String> kick = new ArrayList<>(Collections.singletonList("kick"));
|
||||
public static ArrayList<String> killholograms = new ArrayList<>(Collections.singletonList("killholos"));
|
||||
public static ArrayList<String> leave = new ArrayList<>(Collections.singletonList("leave"));
|
||||
public static ArrayList<String> list = new ArrayList<>(Arrays.asList("list", "ls"));
|
||||
public static ArrayList<String> lock = new ArrayList<>(Collections.singletonList("lock"));
|
||||
public static ArrayList<String> logins = new ArrayList<>(Arrays.asList("logins", "login", "logouts"));
|
||||
public static ArrayList<String> lookup = new ArrayList<>(Collections.singletonList("lookup"));
|
||||
public static ArrayList<String> lowPower = new ArrayList<>(Collections.singletonList("lowpower"));
|
||||
public static ArrayList<String> map_map = new ArrayList<>(Collections.singletonList("map"));
|
||||
public static ArrayList<String> map_height = new ArrayList<>(Arrays.asList("mapheight", "mh"));
|
||||
public static ArrayList<String> mod = new ArrayList<>(Arrays.asList("mod", "setmod", "officer", "setofficer"));
|
||||
public static ArrayList<String> modifyPower = new ArrayList<>(Arrays.asList("mp", "pm", "modpower", "modifypower"));
|
||||
public static ArrayList<String> near = new ArrayList<>(Arrays.asList("near", "nearby"));
|
||||
public static ArrayList<String> open = new ArrayList<>(Collections.singletonList("open"));
|
||||
public static ArrayList<String> owner_owner = new ArrayList<>(Collections.singletonList("owner"));
|
||||
public static ArrayList<String> owner_list = new ArrayList<>(Collections.singletonList("ownerlist"));
|
||||
public static ArrayList<String> paypal_see = new ArrayList<>(Arrays.asList("paypal", "seepaypal"));
|
||||
public static ArrayList<String> paypal_set = new ArrayList<>(Collections.singletonList("setpaypal"));
|
||||
public static ArrayList<String> peaceful = new ArrayList<>(Collections.singletonList("peaceful"));
|
||||
public static ArrayList<String> perm = new ArrayList<>(Arrays.asList("perm", "perms", "permission", "permissions"));
|
||||
public static ArrayList<String> permanent_faction = new ArrayList<>(Collections.singletonList("permanent"));
|
||||
public static ArrayList<String> permanent_power = new ArrayList<>(Collections.singletonList("permanentpower"));
|
||||
public static ArrayList<String> titles = new ArrayList<>(Collections.singletonList("titles"));
|
||||
public static ArrayList<String> power_power = new ArrayList<>(Arrays.asList("pow", "power"));
|
||||
public static ArrayList<String> power_boost = new ArrayList<>(Collections.singletonList("powerboost"));
|
||||
public static ArrayList<String> reload = new ArrayList<>(Collections.singletonList("reload"));
|
||||
public static ArrayList<String> rules = new ArrayList<>(Arrays.asList("r", "rule", "rules"));
|
||||
public static ArrayList<String> saveAll = new ArrayList<>(Arrays.asList("save", "saveall"));
|
||||
public static ArrayList<String> scoreboard = new ArrayList<>(Arrays.asList("sb", "scoreboard"));
|
||||
public static ArrayList<String> seeChunk = new ArrayList<>(Arrays.asList("sc", "seechunk"));
|
||||
public static ArrayList<String> discord_see = new ArrayList<>(Collections.singletonList("seediscord"));
|
||||
public static ArrayList<String> discord_set = new ArrayList<>(Collections.singletonList("setdiscord"));
|
||||
public static ArrayList<String> setBanner = new ArrayList<>(Collections.singletonList("setbanner"));
|
||||
public static ArrayList<String> setDefaultRole = new ArrayList<>(Arrays.asList("defaultrole", "def", "default", "defaultrank"));
|
||||
public static ArrayList<String> setWarp = new ArrayList<>(Arrays.asList("sw", "setwarp"));
|
||||
public static ArrayList<String> setHome = new ArrayList<>(Collections.singletonList("sethome"));
|
||||
public static ArrayList<String> setMaxVaults = new ArrayList<>(Arrays.asList("smv", "setmaxvaults"));
|
||||
public static ArrayList<String> show_show = new ArrayList<>(Arrays.asList("show", "who"));
|
||||
public static ArrayList<String> show_claims = new ArrayList<>(Arrays.asList("showclaim", "showclaims"));
|
||||
public static ArrayList<String> show_invites = new ArrayList<>(Collections.singletonList("showinvites"));
|
||||
public static ArrayList<String> spawnerlock = new ArrayList<>(Arrays.asList("lockspawners", "spawnerlock"));
|
||||
public static ArrayList<String> status = new ArrayList<>(Arrays.asList("s", "status"));
|
||||
public static ArrayList<String> stealth = new ArrayList<>(Arrays.asList("stealth", "ninja"));
|
||||
public static ArrayList<String> strikes_strikes = new ArrayList<>(Collections.singletonList("strikes"));
|
||||
public static ArrayList<String> strikes_give = new ArrayList<>(Collections.singletonList("give"));
|
||||
public static ArrayList<String> strikes_info = new ArrayList<>(Collections.singletonList("info"));
|
||||
public static ArrayList<String> strikes_set = new ArrayList<>(Collections.singletonList("set"));
|
||||
public static ArrayList<String> strikes_take = new ArrayList<>(Collections.singletonList("take"));
|
||||
public static ArrayList<String> stuck = new ArrayList<>(Arrays.asList("stuck", "halp!"));
|
||||
public static ArrayList<String> tag = new ArrayList<>(Arrays.asList("tag", "rename"));
|
||||
public static ArrayList<String> title = new ArrayList<>(Collections.singletonList("title"));
|
||||
public static ArrayList<String> toggleAllianceChat = new ArrayList<>(Arrays.asList("tac", "ac", "togglealliancechat"));
|
||||
public static ArrayList<String> top = new ArrayList<>(Arrays.asList("t", "top"));
|
||||
public static ArrayList<String> tpBanner = new ArrayList<>(Collections.singletonList("tpbanner"));
|
||||
public static ArrayList<String> unban = new ArrayList<>(Collections.singletonList("unban"));
|
||||
public static ArrayList<String> upgrades = new ArrayList<>(Arrays.asList("upgrades", "upgrade"));
|
||||
public static ArrayList<String> vault = new ArrayList<>(Collections.singletonList("vault"));
|
||||
public static ArrayList<String> viewChest = new ArrayList<>(Arrays.asList("viewchest", "viewpv"));
|
||||
private static transient Aliases i = new Aliases();
|
||||
|
||||
public static void load() {
|
||||
FactionsPlugin.getInstance().persist.loadOrSaveDefault(i, Aliases.class, "aliases");
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ public class CmdAHome extends FCommand {
|
||||
|
||||
public CmdAHome() {
|
||||
super();
|
||||
this.aliases.add("ahome");
|
||||
this.aliases.addAll(Aliases.ahome);
|
||||
|
||||
this.requiredArgs.add("player");
|
||||
|
||||
|
||||
@@ -20,10 +20,7 @@ public class CmdAdmin extends FCommand {
|
||||
|
||||
public CmdAdmin() {
|
||||
super();
|
||||
this.aliases.add("admin");
|
||||
this.aliases.add("setadmin");
|
||||
this.aliases.add("leader");
|
||||
this.aliases.add("setleader");
|
||||
this.aliases.addAll(Aliases.admin);
|
||||
|
||||
this.requiredArgs.add("player");
|
||||
|
||||
@@ -73,7 +70,7 @@ public class CmdAdmin extends FCommand {
|
||||
|
||||
// if target player is currently admin, demote and replace him
|
||||
if (fyou == admin) {
|
||||
targetFaction.promoteNewLeader();
|
||||
promoteNewLeader(targetFaction);
|
||||
context.msg(TL.COMMAND_ADMIN_DEMOTES, fyou.describeTo(context.fPlayer, true));
|
||||
fyou.msg(TL.COMMAND_ADMIN_DEMOTED, context.player == null ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(fyou, true));
|
||||
return;
|
||||
@@ -81,9 +78,9 @@ public class CmdAdmin extends FCommand {
|
||||
|
||||
// promote target player, and demote existing admin if one exists
|
||||
if (admin != null) {
|
||||
admin.setRole(Role.COLEADER);
|
||||
setRole(admin, Role.COLEADER);
|
||||
}
|
||||
fyou.setRole(Role.LEADER);
|
||||
setRole(fyou, Role.LEADER);
|
||||
context.msg(TL.COMMAND_ADMIN_PROMOTES, fyou.describeTo(context.fPlayer, true));
|
||||
|
||||
FactionsPlugin.instance.getFlogManager().log(targetFaction, FLogType.RANK_EDIT, context.fPlayer.getName(), fyou.getName(), ChatColor.RED + "Admin");
|
||||
@@ -97,6 +94,18 @@ public class CmdAdmin extends FCommand {
|
||||
});
|
||||
}
|
||||
|
||||
private void setRole(FPlayer fp, Role r) {
|
||||
FactionsPlugin.getInstance().getServer().getScheduler().runTask(FactionsPlugin.instance, () -> {
|
||||
fp.setRole(r);
|
||||
});
|
||||
}
|
||||
|
||||
private void promoteNewLeader(Faction f) {
|
||||
FactionsPlugin.getInstance().getServer().getScheduler().runTask(FactionsPlugin.instance, () -> {
|
||||
f.promoteNewLeader();
|
||||
});
|
||||
}
|
||||
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_ADMIN_DESCRIPTION;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,7 @@ public class CmdAnnounce extends FCommand {
|
||||
|
||||
public CmdAnnounce() {
|
||||
super();
|
||||
this.aliases.add("ann");
|
||||
this.aliases.add("announce");
|
||||
this.aliases.addAll(Aliases.announce);
|
||||
|
||||
this.requiredArgs.add("message");
|
||||
|
||||
|
||||
@@ -13,9 +13,7 @@ public class CmdAutoHelp extends FCommand {
|
||||
*/
|
||||
|
||||
public CmdAutoHelp() {
|
||||
this.aliases.add("?");
|
||||
this.aliases.add("h");
|
||||
this.aliases.add("help");
|
||||
this.aliases.addAll(Aliases.help);
|
||||
|
||||
this.setHelpShort("");
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public class CmdBan extends FCommand {
|
||||
|
||||
public CmdBan() {
|
||||
super();
|
||||
this.aliases.add("ban");
|
||||
this.aliases.addAll(Aliases.ban_ban);
|
||||
|
||||
this.requiredArgs.add("target");
|
||||
|
||||
|
||||
@@ -19,9 +19,7 @@ public class CmdBanlist extends FCommand {
|
||||
|
||||
public CmdBanlist() {
|
||||
super();
|
||||
this.aliases.add("banlist");
|
||||
this.aliases.add("bans");
|
||||
this.aliases.add("banl");
|
||||
this.aliases.addAll(Aliases.ban_banlist);
|
||||
|
||||
this.optionalArgs.put("faction", "faction");
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@ public class CmdBanner extends FCommand {
|
||||
*/
|
||||
|
||||
public CmdBanner() {
|
||||
this.aliases.add("banner");
|
||||
this.aliases.add("warbanner");
|
||||
this.aliases.addAll(Aliases.banner);
|
||||
this.requirements = new CommandRequirements.Builder(Permission.BANNER).playerOnly().memberOnly().build();
|
||||
}
|
||||
|
||||
@@ -47,6 +46,7 @@ public class CmdBanner extends FCommand {
|
||||
warBanner.setAmount(1);
|
||||
context.player.getInventory().addItem(warBanner);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean hasMoney(FPlayer fme, int amt) {
|
||||
Economy econ = FactionsPlugin.getInstance().getEcon();
|
||||
@@ -56,6 +56,7 @@ public class CmdBanner extends FCommand {
|
||||
fme.msg(TL.COMMAND_BANNER_NOTENOUGHMONEY);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void takeMoney(FPlayer fme, int amt) {
|
||||
if (this.hasMoney(fme, amt)) {
|
||||
|
||||
@@ -12,9 +12,7 @@ public class CmdBoom extends FCommand {
|
||||
|
||||
public CmdBoom() {
|
||||
super();
|
||||
this.aliases.add("noboom");
|
||||
this.aliases.add("explosions");
|
||||
this.aliases.add("toggleexplosions");
|
||||
this.aliases.addAll(Aliases.boom);
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("on/off", "flip");
|
||||
|
||||
@@ -12,7 +12,7 @@ public class CmdBypass extends FCommand {
|
||||
|
||||
public CmdBypass() {
|
||||
super();
|
||||
this.aliases.add("bypass");
|
||||
this.aliases.addAll(Aliases.bypass);
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("on/off", "flip");
|
||||
|
||||
@@ -16,8 +16,7 @@ public class CmdChat extends FCommand {
|
||||
|
||||
public CmdChat() {
|
||||
super();
|
||||
this.aliases.add("c");
|
||||
this.aliases.add("chat");
|
||||
this.aliases.addAll(Aliases.chat);
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("mode", "next");
|
||||
|
||||
@@ -12,7 +12,7 @@ public class CmdChatSpy extends FCommand {
|
||||
|
||||
public CmdChatSpy() {
|
||||
super();
|
||||
this.aliases.add("chatspy");
|
||||
this.aliases.addAll(Aliases.chatspy);
|
||||
|
||||
this.optionalArgs.put("on/off", "flip");
|
||||
|
||||
|
||||
@@ -13,9 +13,7 @@ public class CmdCheckpoint extends FCommand {
|
||||
|
||||
public CmdCheckpoint() {
|
||||
super();
|
||||
this.aliases.add("checkp");
|
||||
this.aliases.add("checkpoint");
|
||||
this.aliases.add("cpoint");
|
||||
this.aliases.addAll(Aliases.checkpoint);
|
||||
|
||||
this.optionalArgs.put("set", "");
|
||||
|
||||
|
||||
@@ -19,10 +19,7 @@ public class CmdColeader extends FCommand {
|
||||
|
||||
public CmdColeader() {
|
||||
super();
|
||||
this.aliases.add("co");
|
||||
this.aliases.add("setcoleader");
|
||||
this.aliases.add("coleader");
|
||||
this.aliases.add("setco");
|
||||
this.aliases.addAll(Aliases.coleader);
|
||||
|
||||
this.optionalArgs.put("player name", "name");
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public class CmdConfig extends FCommand {
|
||||
|
||||
public CmdConfig() {
|
||||
super();
|
||||
this.aliases.add("config");
|
||||
this.aliases.addAll(Aliases.config);
|
||||
|
||||
this.requiredArgs.add("setting");
|
||||
this.requiredArgs.add("value");
|
||||
@@ -225,7 +225,7 @@ public class CmdConfig extends FCommand {
|
||||
if (!success.isEmpty()) {
|
||||
if (context.sender instanceof Player) {
|
||||
context.sendMessage(success);
|
||||
FactionsPlugin.getInstance().log(success + TL.COMMAND_CONFIG_LOG.format((Player) context.sender));
|
||||
FactionsPlugin.getInstance().log(success + TL.COMMAND_CONFIG_LOG.format(context.sender));
|
||||
} else // using FactionsPlugin.getInstance().log() instead of sendMessage if run from server console so that "[Factions v#.#.#]" is prepended in server log
|
||||
{
|
||||
FactionsPlugin.getInstance().log(success);
|
||||
|
||||
@@ -14,7 +14,7 @@ public class CmdConvert extends FCommand {
|
||||
*/
|
||||
|
||||
public CmdConvert() {
|
||||
this.aliases.add("convert");
|
||||
this.aliases.addAll(Aliases.convert);
|
||||
this.requiredArgs.add("[MYSQL|JSON]");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.CONVERT)
|
||||
|
||||
@@ -13,8 +13,7 @@ public class CmdCoords extends FCommand {
|
||||
|
||||
public CmdCoords() {
|
||||
super();
|
||||
this.aliases.add("coords");
|
||||
this.aliases.add("coord");
|
||||
this.aliases.addAll(Aliases.coords);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.COORD)
|
||||
.playerOnly()
|
||||
|
||||
@@ -25,7 +25,7 @@ public class CmdCreate extends FCommand {
|
||||
|
||||
public CmdCreate() {
|
||||
super();
|
||||
this.aliases.add("create");
|
||||
this.aliases.addAll(Aliases.create);
|
||||
|
||||
this.requiredArgs.add("faction tag");
|
||||
|
||||
@@ -115,7 +115,9 @@ public class CmdCreate extends FCommand {
|
||||
Discord.mainGuild.getController().setNickname(m, Discord.getNicknameString(context.fPlayer)).queue();
|
||||
}
|
||||
}
|
||||
} catch (HierarchyException e) {System.out.print(e.getMessage());}
|
||||
} catch (HierarchyException e) {
|
||||
System.out.print(e.getMessage());
|
||||
}
|
||||
//End Discord
|
||||
context.msg(TL.COMMAND_CREATE_YOUSHOULD, FactionsPlugin.getInstance().cmdBase.cmdDescription.getUsageTemplate(context));
|
||||
if (Conf.econEnabled) Econ.setBalance(faction.getAccountId(), Conf.econFactionStartingBalance);
|
||||
|
||||
@@ -13,6 +13,7 @@ public class CmdDebug extends FCommand {
|
||||
this.aliases.add("debug");
|
||||
this.requirements = new CommandRequirements.Builder(Permission.DEBUG).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
FactionsPlugin.getInstance().divider();
|
||||
@@ -51,7 +52,9 @@ public class CmdDebug extends FCommand {
|
||||
System.out.print("Emotes enabled: " + Discord.useEmotes);
|
||||
System.out.print("Leader role null: " + (Discord.leader == null ? "True" : "False"));
|
||||
System.out.print("Attempt Log:");
|
||||
for (DiscordSetupAttempt d : Discord.setupLog) {System.out.print(d.getDifferentialFormatted() + " " + d.getSuccess() + " " + d.getReason());}
|
||||
for (DiscordSetupAttempt d : Discord.setupLog) {
|
||||
System.out.print(d.getDifferentialFormatted() + " " + d.getSuccess() + " " + d.getReason());
|
||||
}
|
||||
System.out.print("End Attempt Log");
|
||||
System.out.print("----End Discord----");
|
||||
System.out.print("--------End Debug Info--------");
|
||||
|
||||
@@ -20,8 +20,7 @@ public class CmdDeinvite extends FCommand {
|
||||
|
||||
public CmdDeinvite() {
|
||||
super();
|
||||
this.aliases.add("deinvite");
|
||||
this.aliases.add("deinv");
|
||||
this.aliases.addAll(Aliases.deinvite);
|
||||
|
||||
this.optionalArgs.put("player name", "name");
|
||||
|
||||
@@ -32,47 +31,47 @@ public class CmdDeinvite extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
if (context.args.size() == 0) {
|
||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
||||
for (String id : context.faction.getInvites()) {
|
||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||
String name = fp != null ? fp.getName() : id;
|
||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||
}
|
||||
context.sendFancyMessage(msg);
|
||||
if (context.args.size() == 0) {
|
||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
||||
for (String id : context.faction.getInvites()) {
|
||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||
String name = fp != null ? fp.getName() : id;
|
||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||
}
|
||||
context.sendFancyMessage(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
FPlayer you = context.argAsBestFPlayerMatch(0);
|
||||
if (!context.fPlayer.isAdminBypassing()) {
|
||||
Access access = context.faction.getAccess(context.fPlayer, PermissableAction.INVITE);
|
||||
if (access != Access.ALLOW && context.fPlayer.getRole() != Role.LEADER) {
|
||||
context.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
FPlayer you = context.argAsBestFPlayerMatch(0);
|
||||
if (!context.fPlayer.isAdminBypassing()) {
|
||||
Access access = context.faction.getAccess(context.fPlayer, PermissableAction.INVITE);
|
||||
if (access != Access.ALLOW && context.fPlayer.getRole() != Role.LEADER) {
|
||||
context.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
|
||||
return;
|
||||
}
|
||||
if (you == null) {
|
||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
||||
for (String id : context.faction.getInvites()) {
|
||||
if (context.faction.getInvites().isEmpty()) return;
|
||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||
String name = fp != null ? fp.getName() : id;
|
||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||
}
|
||||
context.sendFancyMessage(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (you == null) {
|
||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
||||
for (String id : context.faction.getInvites()) {
|
||||
if (context.faction.getInvites().isEmpty()) return;
|
||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||
String name = fp != null ? fp.getName() : id;
|
||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||
}
|
||||
context.sendFancyMessage(msg);
|
||||
return;
|
||||
}
|
||||
if (you.getFaction() == context.faction) {
|
||||
context.msg(TL.COMMAND_DEINVITE_ALREADYMEMBER, you.getName(), context.faction.getTag());
|
||||
context.msg(TL.COMMAND_DEINVITE_MIGHTWANT, FactionsPlugin.getInstance().cmdBase.cmdKick.getUsageTemplate(context));
|
||||
return;
|
||||
}
|
||||
|
||||
if (you.getFaction() == context.faction) {
|
||||
context.msg(TL.COMMAND_DEINVITE_ALREADYMEMBER, you.getName(), context.faction.getTag());
|
||||
context.msg(TL.COMMAND_DEINVITE_MIGHTWANT, FactionsPlugin.getInstance().cmdBase.cmdKick.getUsageTemplate(context));
|
||||
return;
|
||||
}
|
||||
|
||||
context.faction.deinvite(you);
|
||||
you.msg(TL.COMMAND_DEINVITE_REVOKED, context.fPlayer.describeTo(you), context.faction.describeTo(you));
|
||||
context.faction.msg(TL.COMMAND_DEINVITE_REVOKES, context.fPlayer.describeTo(context.faction), you.describeTo(context.faction));
|
||||
context.faction.deinvite(you);
|
||||
you.msg(TL.COMMAND_DEINVITE_REVOKED, context.fPlayer.describeTo(you), context.faction.describeTo(you));
|
||||
context.faction.msg(TL.COMMAND_DEINVITE_REVOKES, context.fPlayer.describeTo(context.faction), you.describeTo(context.faction));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,9 +13,7 @@ public class CmdDelFWarp extends FCommand {
|
||||
|
||||
public CmdDelFWarp() {
|
||||
super();
|
||||
this.aliases.add("delwarp");
|
||||
this.aliases.add("dw");
|
||||
this.aliases.add("deletewarp");
|
||||
this.aliases.addAll(Aliases.deletefwarp);
|
||||
this.requiredArgs.add("warp name");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.SETWARP)
|
||||
|
||||
51
src/main/java/com/massivecraft/factions/cmd/CmdDelHome.java
Normal file
51
src/main/java/com/massivecraft/factions/cmd/CmdDelHome.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
/**
|
||||
* Factions - Developed by Driftay.
|
||||
* All rights reserved 2020.
|
||||
* Creation Date: 3/24/2020
|
||||
*/
|
||||
public class CmdDelHome extends FCommand {
|
||||
|
||||
public CmdDelHome() {
|
||||
this.aliases.addAll(Aliases.delfHome);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.DELHOME)
|
||||
.memberOnly()
|
||||
.withAction(PermissableAction.SETHOME)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
||||
//Check if homes are enabled
|
||||
if (!Conf.homesEnabled) {
|
||||
context.msg(TL.COMMAND_SETHOME_DISABLED);
|
||||
return;
|
||||
}
|
||||
//If They Don't Have Home
|
||||
if (!context.faction.hasHome()) {
|
||||
context.msg(TL.COMMAND_HOME_NOHOME.toString());
|
||||
context.msg(FactionsPlugin.getInstance().cmdBase.cmdSethome.getUsageTemplate(context));
|
||||
return;
|
||||
}
|
||||
|
||||
context.faction.deleteHome();
|
||||
context.faction.msg(TL.COMMAND_DELHOME_SUCCESS, context.fPlayer.describeTo(context.faction, true));
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_DELHOME_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,7 @@ public class CmdDescription extends FCommand {
|
||||
|
||||
public CmdDescription() {
|
||||
super();
|
||||
this.aliases.add("desc");
|
||||
this.aliases.add("description");
|
||||
this.aliases.addAll(Aliases.description);
|
||||
|
||||
this.requiredArgs.add("desc");
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.event.FactionDisbandEvent.PlayerDisbandReason;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.util.UtilFly;
|
||||
import com.massivecraft.factions.zcore.fdisband.FDisbandFrame;
|
||||
import com.massivecraft.factions.zcore.fperms.Access;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
@@ -12,6 +12,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
public class CmdDisband extends FCommand {
|
||||
@@ -20,23 +21,22 @@ public class CmdDisband extends FCommand {
|
||||
* @author FactionsUUID Team
|
||||
*/
|
||||
|
||||
//TODO: Add Disband Confirmation GUI
|
||||
|
||||
private static HashMap<String, String> disbandMap = new HashMap<>();
|
||||
|
||||
|
||||
public CmdDisband() {
|
||||
super();
|
||||
this.aliases.add("disband");
|
||||
|
||||
this.aliases.addAll(Aliases.disband);
|
||||
this.optionalArgs.put("faction tag", "yours");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.DISBAND)
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
long time;
|
||||
// The faction, default to your own.. but null if console sender.
|
||||
Faction faction = context.argAsFaction(0, context.fPlayer == null ? null : context.faction);
|
||||
if (faction == null) return;
|
||||
@@ -44,9 +44,7 @@ public class CmdDisband extends FCommand {
|
||||
boolean isMyFaction = context.fPlayer != null && faction == context.faction;
|
||||
|
||||
if (!isMyFaction) {
|
||||
if (!Permission.DISBAND_ANY.has(context.sender, true)) {
|
||||
return;
|
||||
}
|
||||
if (!Permission.DISBAND_ANY.has(context.sender, true)) return;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,6 +71,22 @@ public class CmdDisband extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
boolean access = false;
|
||||
if (context.fPlayer.getPlayer().hasMetadata("disband_confirm") && (time = context.fPlayer.getPlayer().getMetadata("disband_confirm").get(0).asLong()) != 0L && System.currentTimeMillis() - time <= TimeUnit.SECONDS.toMillis(3L)) {
|
||||
access = true;
|
||||
}
|
||||
|
||||
if (!access) {
|
||||
if (Conf.useDisbandGUI && !context.fPlayer.isAdminBypassing() || !context.player.isOp()) {
|
||||
if (!disbandMap.containsKey(context.player.getUniqueId().toString())) {
|
||||
new FDisbandFrame(context.faction).buildGUI(context.fPlayer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// check for tnt before disbanding.
|
||||
if (!disbandMap.containsKey(context.player.getUniqueId().toString()) && faction.getTnt() > 0) {
|
||||
context.msg(TL.COMMAND_DISBAND_CONFIRM.toString().replace("{tnt}", faction.getTnt() + ""));
|
||||
@@ -84,19 +98,21 @@ public class CmdDisband extends FCommand {
|
||||
String amountString = context.sender instanceof ConsoleCommandSender ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(follower);
|
||||
if (follower.getFaction() == faction) {
|
||||
follower.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, amountString);
|
||||
if (!follower.canFlyAtLocation()) {
|
||||
if (!follower.canFlyAtLocation() && FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) {
|
||||
follower.setFFlying(false, false);
|
||||
}
|
||||
} else {
|
||||
follower.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, amountString, faction.getTag(follower));
|
||||
}
|
||||
}
|
||||
context.fPlayer.setFFlying(false, false);
|
||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight"))
|
||||
context.fPlayer.setFFlying(false, false);
|
||||
} else {
|
||||
context.player.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
|
||||
}
|
||||
Bukkit.broadcastMessage("Called");
|
||||
faction.disband(context.player, PlayerDisbandReason.COMMAND);
|
||||
if (!context.fPlayer.canFlyAtLocation()) {
|
||||
if (!context.fPlayer.canFlyAtLocation() && FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) {
|
||||
context.fPlayer.setFFlying(false, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,11 +9,12 @@ import java.util.Random;
|
||||
public class CmdDiscord extends FCommand {
|
||||
public CmdDiscord() {
|
||||
super();
|
||||
this.aliases.add("discord");
|
||||
this.aliases.addAll(Aliases.discord_discord);
|
||||
this.requirements = new CommandRequirements.Builder(Permission.DISCORD)
|
||||
.playerOnly()
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
if (context.fPlayer.discordSetup()) {
|
||||
|
||||
@@ -7,16 +7,15 @@ import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* @author Saser
|
||||
*/
|
||||
public class CmdDrain extends FCommand{
|
||||
public CmdDrain(){
|
||||
this.aliases.add("drain");
|
||||
public class CmdDrain extends FCommand {
|
||||
public CmdDrain() {
|
||||
this.aliases.addAll(Aliases.drain);
|
||||
this.requirements = new CommandRequirements.Builder(Permission.DRAIN)
|
||||
.playerOnly()
|
||||
.memberOnly()
|
||||
@@ -34,12 +33,12 @@ public class CmdDrain extends FCommand{
|
||||
|
||||
double totalBalance = 0;
|
||||
|
||||
for(FPlayer fPlayer : context.faction.getFPlayers()) {
|
||||
if(context.faction.getFPlayers().size() == 1){
|
||||
for (FPlayer fPlayer : context.faction.getFPlayers()) {
|
||||
if (context.faction.getFPlayers().size() == 1) {
|
||||
context.fPlayer.msg(TL.COMMAND_DRAIN_NO_PLAYERS);
|
||||
return;
|
||||
}
|
||||
if (FPlayers.getInstance().getByPlayer(context.player).equals(fPlayer)){
|
||||
if (FPlayers.getInstance().getByPlayer(context.player).equals(fPlayer)) {
|
||||
continue; // skip the command executor
|
||||
}
|
||||
double balance = FactionsPlugin.getInstance().getEcon().getBalance(fPlayer.getPlayer());
|
||||
|
||||
@@ -17,9 +17,7 @@ public class CmdFGlobal extends FCommand {
|
||||
|
||||
public CmdFGlobal() {
|
||||
super();
|
||||
this.aliases.add("gchat");
|
||||
this.aliases.add("global");
|
||||
this.aliases.add("globalchat");
|
||||
this.aliases.addAll(Aliases.global);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.GLOBALCHAT)
|
||||
.playerOnly()
|
||||
|
||||
@@ -20,8 +20,7 @@ public class CmdFWarp extends FCommand {
|
||||
|
||||
public CmdFWarp() {
|
||||
super();
|
||||
this.aliases.add("warp");
|
||||
this.aliases.add("warps");
|
||||
this.aliases.addAll(Aliases.warp);
|
||||
this.optionalArgs.put("warpname", "warpname");
|
||||
this.optionalArgs.put("password", "password");
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ public class CmdFly extends FCommand {
|
||||
|
||||
public CmdFly() {
|
||||
super();
|
||||
this.aliases.add("fly");
|
||||
this.aliases.addAll(Aliases.fly);
|
||||
this.optionalArgs.put("on/off", "flip");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.FLY)
|
||||
this.requirements = new CommandRequirements.Builder(Permission.FLY_FLY)
|
||||
.playerOnly()
|
||||
.memberOnly()
|
||||
.build();
|
||||
@@ -78,19 +78,15 @@ public class CmdFly extends FCommand {
|
||||
}
|
||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||
Faction myFaction = fPlayer.getFaction();
|
||||
if (myFaction.isWilderness()) {
|
||||
fPlayer.setFlying(false);
|
||||
flyMap.remove(name);
|
||||
continue;
|
||||
}
|
||||
if (player.hasPermission("factions.fly.bypassnearbyenemycheck") || fPlayer.checkIfNearbyEnemies()) {
|
||||
if (!player.hasPermission("factions.fly.bypassnearbyenemycheck") && !fPlayer.isAdminBypassing()) {
|
||||
if (fPlayer.hasEnemiesNearby()) disableFlightSync(fPlayer);
|
||||
checkEnemiesSync(fPlayer);
|
||||
continue;
|
||||
}
|
||||
FLocation myFloc = new FLocation(player.getLocation());
|
||||
if (Board.getInstance().getFactionAt(myFloc) != myFaction) {
|
||||
if (!checkBypassPerms(fPlayer, player, Board.getInstance().getFactionAt(myFloc))) {
|
||||
Bukkit.getScheduler().runTask(FactionsPlugin.instance, () -> fPlayer.setFFlying(false, false));
|
||||
flyMap.remove(name);
|
||||
if (!checkFly(fPlayer, player, Board.getInstance().getFactionAt(myFloc))) {
|
||||
disableFlightSync(fPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,36 +96,17 @@ public class CmdFly extends FCommand {
|
||||
}, 20L, 20L);
|
||||
}
|
||||
|
||||
public static boolean checkBypassPerms(FPlayer fme, Player me, Faction toFac) {
|
||||
public static boolean checkFly(FPlayer fme, Player me, Faction toFac) {
|
||||
if (Conf.denyFlightIfInNoClaimingWorld && !Conf.worldsNoClaiming.isEmpty() && Conf.worldsNoClaiming.stream().anyMatch(me.getWorld().getName()::equalsIgnoreCase))
|
||||
return false;
|
||||
|
||||
if (toFac != fme.getFaction()) {
|
||||
if (!me.hasPermission(Permission.FLY_WILD.node) && toFac.isWilderness() || !me.hasPermission(Permission.FLY_SAFEZONE.node) && toFac.isSafeZone() || !me.hasPermission(Permission.FLY_WARZONE.node) && toFac.isWarZone()) {
|
||||
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||
return false;
|
||||
}
|
||||
Access access = toFac.getAccess(fme, PermissableAction.FLY);
|
||||
if ((!(me.hasPermission(Permission.FLY_ENEMY.node) || access == Access.ALLOW)) && toFac.getRelationTo(fme.getFaction()) == Relation.ENEMY) {
|
||||
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||
return false;
|
||||
}
|
||||
if (!(me.hasPermission(Permission.FLY_ALLY.node) || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.ALLY) {
|
||||
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||
return false;
|
||||
}
|
||||
if (!(me.hasPermission(Permission.FLY_TRUCE.node) || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.TRUCE) {
|
||||
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(me.hasPermission(Permission.FLY_NEUTRAL.node) || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.NEUTRAL && !toFac.isSystemFaction()) {
|
||||
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||
return false;
|
||||
}
|
||||
return me.hasPermission(Permission.FLY.node) && (access != Access.DENY || toFac.isSystemFaction());
|
||||
}
|
||||
return true;
|
||||
if (toFac.getAccess(fme, PermissableAction.FLY) == Access.ALLOW) return true;
|
||||
if (fme.getFaction().isWilderness()) return false;
|
||||
if (toFac.isSystemFaction())
|
||||
return me.hasPermission(toFac.isWilderness() ? Permission.FLY_WILDERNESS.node : toFac.isSafeZone() ? Permission.FLY_SAFEZONE.node : Permission.FLY_WARZONE.node);
|
||||
Relation relationTo = toFac.getRelationTo(fme.getFaction());
|
||||
if (!relationTo.isEnemy() && !relationTo.isMember())
|
||||
return me.hasPermission(Permission.valueOf("FLY_" + relationTo.name()).node);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,34 +122,43 @@ public class CmdFly extends FCommand {
|
||||
flyMap.remove(fme.getPlayer().getName());
|
||||
}
|
||||
|
||||
private static void disableFlightSync(FPlayer fme) {
|
||||
Bukkit.getScheduler().runTask(FactionsPlugin.instance, () -> fme.setFFlying(false, false));
|
||||
flyMap.remove(fme.getName());
|
||||
}
|
||||
|
||||
private static void checkEnemiesSync(FPlayer fp) {
|
||||
Bukkit.getScheduler().runTask(FactionsPlugin.instance, fp::checkIfNearbyEnemies);
|
||||
}
|
||||
|
||||
public boolean isInFlightChecker(Player player) {
|
||||
return flyMap.containsKey(player.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
// Disabled by default.
|
||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight", false)) {
|
||||
context.fPlayer.msg(TL.COMMAND_FLY_DISABLED);
|
||||
return;
|
||||
}
|
||||
if (!context.fPlayer.isAdminBypassing()) {
|
||||
List<Entity> entities = context.player.getNearbyEntities(16.0D, 256.0D, 16.0D);
|
||||
|
||||
FLocation myfloc = new FLocation(context.player.getLocation());
|
||||
Faction toFac = Board.getInstance().getFactionAt(myfloc);
|
||||
if (!checkBypassPerms(context.fPlayer, context.player, toFac)) return;
|
||||
List<Entity> entities = context.player.getNearbyEntities(16.0D, 256.0D, 16.0D);
|
||||
|
||||
for (int i = 0; i <= entities.size() - 1; ++i) {
|
||||
if (entities.get(i) instanceof Player) {
|
||||
Player eplayer = (Player) entities.get(i);
|
||||
FPlayer efplayer = FPlayers.getInstance().getByPlayer(eplayer);
|
||||
if (efplayer.getRelationTo(context.fPlayer) == Relation.ENEMY && !efplayer.isStealthEnabled()) {
|
||||
context.msg(TL.COMMAND_FLY_CHECK_ENEMY);
|
||||
return;
|
||||
for (int i = 0; i <= entities.size() - 1; ++i) {
|
||||
if (entities.get(i) instanceof Player) {
|
||||
Player eplayer = (Player) entities.get(i);
|
||||
FPlayer efplayer = FPlayers.getInstance().getByPlayer(eplayer);
|
||||
if (efplayer.getRelationTo(context.fPlayer) == Relation.ENEMY && !efplayer.isStealthEnabled()) {
|
||||
context.msg(TL.COMMAND_FLY_CHECK_ENEMY);
|
||||
return;
|
||||
}
|
||||
context.fPlayer.setEnemiesNearby(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FLocation myfloc = new FLocation(context.player.getLocation());
|
||||
Faction toFac = Board.getInstance().getFactionAt(myfloc);
|
||||
if (!checkFly(context.fPlayer, context.player, toFac)) {
|
||||
context.fPlayer.sendMessage(TL.COMMAND_FLY_NO_ACCESS.format(toFac.getTag()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (context.args.size() == 0) {
|
||||
toggleFlight(context.fPlayer.isFlying(), context.fPlayer, context);
|
||||
@@ -188,22 +174,17 @@ public class CmdFly extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
context.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", () -> {
|
||||
fme.setFlying(true);
|
||||
flyMap.put(fme.getPlayer().getName(), true);
|
||||
if (particleTask == null) {
|
||||
startParticles();
|
||||
}
|
||||
|
||||
if (fme.canFlyAtLocation()) {
|
||||
context.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", () -> {
|
||||
fme.setFlying(true);
|
||||
flyMap.put(fme.getPlayer().getName(), true);
|
||||
if (particleTask == null) {
|
||||
startParticles();
|
||||
}
|
||||
|
||||
if (flyTask == null) {
|
||||
startFlyCheck();
|
||||
}
|
||||
}, FactionsPlugin.getInstance().getConfig().getLong("warmups.f-fly", 0));
|
||||
} else {
|
||||
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(fme.getLastStoodAt()).getTag());
|
||||
}
|
||||
if (flyTask == null) {
|
||||
startFlyCheck();
|
||||
}
|
||||
}, FactionsPlugin.getInstance().getConfig().getLong("warmups.f-fly", 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,7 +13,7 @@ public class CmdFocus extends FCommand {
|
||||
*/
|
||||
|
||||
public CmdFocus() {
|
||||
aliases.add("focus");
|
||||
aliases.addAll(Aliases.focus);
|
||||
|
||||
requiredArgs.add("player");
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ public class CmdGetVault extends FCommand {
|
||||
|
||||
public CmdGetVault() {
|
||||
super();
|
||||
this.aliases.add("getvault");
|
||||
this.aliases.addAll(Aliases.getvault);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.GETVAULT)
|
||||
.playerOnly()
|
||||
@@ -47,7 +47,9 @@ public class CmdGetVault extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!context.fPlayer.takeMoney(amount)) {return;}
|
||||
if (!context.fPlayer.takeMoney(amount)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//success :)
|
||||
context.player.getInventory().addItem(vault);
|
||||
|
||||
@@ -19,11 +19,10 @@ public class CmdHelp extends FCommand {
|
||||
|
||||
public ArrayList<ArrayList<String>> helpPages;
|
||||
|
||||
//TODO: Add Help GUI
|
||||
public CmdHelp() {
|
||||
super();
|
||||
this.aliases.add("help");
|
||||
this.aliases.add("h");
|
||||
this.aliases.add("?");
|
||||
this.aliases.addAll(Aliases.help);
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("page", "1");
|
||||
|
||||
@@ -26,7 +26,7 @@ public class CmdHome extends FCommand {
|
||||
|
||||
public CmdHome() {
|
||||
super();
|
||||
this.aliases.add("home");
|
||||
this.aliases.addAll(Aliases.home);
|
||||
this.optionalArgs.put("faction", "yours");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.HOME)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
@@ -11,9 +12,7 @@ public class CmdInspect extends FCommand {
|
||||
|
||||
public CmdInspect() {
|
||||
super();
|
||||
this.aliases.add("inspect");
|
||||
this.aliases.add("ins");
|
||||
|
||||
this.aliases.addAll(Aliases.inspect);
|
||||
this.requirements = new CommandRequirements.Builder(Permission.INSPECT)
|
||||
.playerOnly()
|
||||
.memberOnly()
|
||||
@@ -23,6 +22,11 @@ public class CmdInspect extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
if (!Conf.useInspectSystem) {
|
||||
context.fPlayer.msg(TL.GENERIC_DISABLED, "Faction Inspection");
|
||||
return;
|
||||
}
|
||||
|
||||
if (context.fPlayer.isInspectMode()) {
|
||||
context.fPlayer.setInspectMode(false);
|
||||
context.msg(TL.COMMAND_INSPECT_DISABLED_MSG);
|
||||
|
||||
@@ -23,8 +23,7 @@ public class CmdInventorySee extends FCommand {
|
||||
public CmdInventorySee() {
|
||||
super();
|
||||
|
||||
this.aliases.add("invsee");
|
||||
this.aliases.add("inventorysee");
|
||||
this.aliases.addAll(Aliases.invsee);
|
||||
|
||||
this.requiredArgs.add("member name");
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@ public class CmdInvite extends FCommand {
|
||||
|
||||
public CmdInvite() {
|
||||
super();
|
||||
this.aliases.add("invite");
|
||||
this.aliases.add("inv");
|
||||
this.aliases.addAll(Aliases.invite);
|
||||
|
||||
this.requiredArgs.add("player name");
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public class CmdJoin extends FCommand {
|
||||
|
||||
public CmdJoin() {
|
||||
super();
|
||||
this.aliases.add("join");
|
||||
this.aliases.addAll(Aliases.join);
|
||||
this.requiredArgs.add("faction name");
|
||||
this.optionalArgs.put("player", "you");
|
||||
|
||||
@@ -127,6 +127,7 @@ public class CmdJoin extends FCommand {
|
||||
}
|
||||
|
||||
faction.deinvite(fplayer);
|
||||
|
||||
try {
|
||||
context.fPlayer.setRole(faction.getDefaultRole());
|
||||
FactionsPlugin.instance.logFactionEvent(faction, FLogType.INVITES, context.fPlayer.getName(), CC.Green + "joined", "the faction");
|
||||
@@ -139,7 +140,9 @@ public class CmdJoin extends FCommand {
|
||||
Discord.mainGuild.getController().setNickname(m, Discord.getNicknameString(context.fPlayer)).queue();
|
||||
}
|
||||
}
|
||||
} catch (HierarchyException e) {System.out.print(e.getMessage());}
|
||||
} catch (HierarchyException e) {
|
||||
System.out.print(e.getMessage());
|
||||
}
|
||||
|
||||
if (Conf.logFactionJoin) {
|
||||
if (samePlayer) {
|
||||
@@ -152,7 +155,7 @@ public class CmdJoin extends FCommand {
|
||||
|
||||
private int getFactionMemberLimit(Faction f) {
|
||||
if (f.getUpgrade(UpgradeType.MEMBERS) == 0) return Conf.factionMemberLimit;
|
||||
return Conf.factionMemberLimit + FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Members.Member-Boost.level-" + f.getUpgrade(UpgradeType.MEMBERS));
|
||||
return Conf.factionMemberLimit + FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Members.Members-Limit.level-" + f.getUpgrade(UpgradeType.MEMBERS));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,7 +24,7 @@ public class CmdKick extends FCommand {
|
||||
|
||||
public CmdKick() {
|
||||
super();
|
||||
this.aliases.add("kick");
|
||||
this.aliases.addAll(Aliases.kick);
|
||||
this.optionalArgs.put("player name", "player name");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.KICK)
|
||||
|
||||
@@ -11,7 +11,7 @@ public class CmdKillHolograms extends FCommand {
|
||||
|
||||
public CmdKillHolograms() {
|
||||
super();
|
||||
this.aliases.add("killholos");
|
||||
this.aliases.addAll(Aliases.killholograms);
|
||||
this.requiredArgs.add("radius");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.KILLHOLOS)
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class CmdLeave extends FCommand {
|
||||
|
||||
@@ -13,7 +11,7 @@ public class CmdLeave extends FCommand {
|
||||
|
||||
public CmdLeave() {
|
||||
super();
|
||||
this.aliases.add("leave");
|
||||
this.aliases.addAll(Aliases.leave);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.LEAVE)
|
||||
.playerOnly()
|
||||
|
||||
@@ -22,8 +22,7 @@ public class CmdList extends FCommand {
|
||||
|
||||
public CmdList() {
|
||||
super();
|
||||
this.aliases.add("list");
|
||||
this.aliases.add("ls");
|
||||
this.aliases.addAll(Aliases.list);
|
||||
|
||||
// default values in case user has old config
|
||||
defaults[0] = "&e&m----------&r&e[ &2Faction List &9{pagenumber}&e/&9{pagecount} &e]&m----------";
|
||||
|
||||
@@ -16,10 +16,9 @@ public class CmdLock extends FCommand {
|
||||
description: use the /f lock [on/off] command to temporarily lock the data files from being overwritten
|
||||
default: op
|
||||
*/
|
||||
|
||||
public CmdLock() {
|
||||
super();
|
||||
this.aliases.add("lock");
|
||||
this.aliases.addAll(Aliases.lock);
|
||||
this.optionalArgs.put("on/off", "flip");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.LOCK)
|
||||
|
||||
@@ -11,10 +11,7 @@ public class CmdLogins extends FCommand {
|
||||
|
||||
public CmdLogins() {
|
||||
super();
|
||||
this.aliases.add("login");
|
||||
this.aliases.add("logins");
|
||||
this.aliases.add("logout");
|
||||
this.aliases.add("logouts");
|
||||
this.aliases.addAll(Aliases.logins);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.MONITOR_LOGINS)
|
||||
.playerOnly()
|
||||
|
||||
@@ -18,7 +18,7 @@ public class CmdLookup extends FCommand {
|
||||
|
||||
public CmdLookup() {
|
||||
super();
|
||||
this.aliases.add("lookup");
|
||||
this.aliases.addAll(Aliases.lookup);
|
||||
this.requiredArgs.add("faction name");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.LOOKUP)
|
||||
|
||||
@@ -13,7 +13,7 @@ public class CmdLowPower extends FCommand {
|
||||
|
||||
public CmdLowPower() {
|
||||
super();
|
||||
this.aliases.add("lowpower");
|
||||
this.aliases.addAll(Aliases.lowPower);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.POWER_ANY)
|
||||
.playerOnly()
|
||||
|
||||
@@ -15,7 +15,7 @@ public class CmdMap extends FCommand {
|
||||
|
||||
public CmdMap() {
|
||||
super();
|
||||
this.aliases.add("map");
|
||||
this.aliases.addAll(Aliases.map_map);
|
||||
this.optionalArgs.put("on/off", "once");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.MAP)
|
||||
|
||||
@@ -12,8 +12,7 @@ public class CmdMapHeight extends FCommand {
|
||||
public CmdMapHeight() {
|
||||
super();
|
||||
|
||||
this.aliases.add("mapheight");
|
||||
this.aliases.add("mh");
|
||||
this.aliases.addAll(Aliases.map_height);
|
||||
this.optionalArgs.put("height", "height");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.MAPHEIGHT)
|
||||
|
||||
@@ -19,10 +19,7 @@ public class CmdMod extends FCommand {
|
||||
|
||||
public CmdMod() {
|
||||
super();
|
||||
this.aliases.add("mod");
|
||||
this.aliases.add("setmod");
|
||||
this.aliases.add("officer");
|
||||
this.aliases.add("setofficer");
|
||||
this.aliases.addAll(Aliases.mod);
|
||||
|
||||
this.optionalArgs.put("player name", "name");
|
||||
|
||||
@@ -34,53 +31,53 @@ public class CmdMod extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
FPlayer you = context.argAsBestFPlayerMatch(0);
|
||||
if (you == null) {
|
||||
FancyMessage msg = new FancyMessage(TL.COMMAND_MOD_CANDIDATES.toString()).color(ChatColor.GOLD);
|
||||
for (FPlayer player : context.faction.getFPlayersWhereRole(Role.NORMAL)) {
|
||||
String s = player.getName();
|
||||
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_MOD_CLICKTOPROMOTE.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " mod " + s);
|
||||
}
|
||||
|
||||
context.sendFancyMessage(msg);
|
||||
return;
|
||||
FPlayer you = context.argAsBestFPlayerMatch(0);
|
||||
if (you == null) {
|
||||
FancyMessage msg = new FancyMessage(TL.COMMAND_MOD_CANDIDATES.toString()).color(ChatColor.GOLD);
|
||||
for (FPlayer player : context.faction.getFPlayersWhereRole(Role.NORMAL)) {
|
||||
String s = player.getName();
|
||||
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_MOD_CLICKTOPROMOTE.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " mod " + s);
|
||||
}
|
||||
|
||||
boolean permAny = Permission.MOD_ANY.has(context.sender, false);
|
||||
Faction targetFaction = you.getFaction();
|
||||
if (targetFaction != context.faction && !permAny) {
|
||||
context.msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(context.fPlayer, true));
|
||||
return;
|
||||
}
|
||||
context.sendFancyMessage(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (context.fPlayer != null && context.fPlayer.getRole() != Role.LEADER && !permAny) {
|
||||
context.msg(TL.COMMAND_MOD_NOTADMIN);
|
||||
return;
|
||||
}
|
||||
boolean permAny = Permission.MOD_ANY.has(context.sender, false);
|
||||
Faction targetFaction = you.getFaction();
|
||||
if (targetFaction != context.faction && !permAny) {
|
||||
context.msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(context.fPlayer, true));
|
||||
return;
|
||||
}
|
||||
|
||||
if (you == context.fPlayer && !permAny) {
|
||||
context.msg(TL.COMMAND_MOD_SELF);
|
||||
return;
|
||||
}
|
||||
if (context.fPlayer != null && context.fPlayer.getRole() != Role.LEADER && !permAny) {
|
||||
context.msg(TL.COMMAND_MOD_NOTADMIN);
|
||||
return;
|
||||
}
|
||||
|
||||
if (you.getRole() == Role.LEADER) {
|
||||
context.msg(TL.COMMAND_MOD_TARGETISADMIN);
|
||||
return;
|
||||
}
|
||||
if (you == context.fPlayer && !permAny) {
|
||||
context.msg(TL.COMMAND_MOD_SELF);
|
||||
return;
|
||||
}
|
||||
|
||||
if (you.getRole() == Role.MODERATOR) {
|
||||
// Revoke
|
||||
you.setRole(Role.NORMAL);
|
||||
targetFaction.msg(TL.COMMAND_MOD_REVOKED, you.describeTo(targetFaction, true));
|
||||
context.msg(TL.COMMAND_MOD_REVOKES, you.describeTo(context.fPlayer, true));
|
||||
} else {
|
||||
// Give
|
||||
you.setRole(Role.MODERATOR);
|
||||
targetFaction.msg(TL.COMMAND_MOD_PROMOTED, you.describeTo(targetFaction, true));
|
||||
context.msg(TL.COMMAND_MOD_PROMOTES, you.describeTo(context.fPlayer, true));
|
||||
FactionsPlugin.instance.getFlogManager().log(targetFaction, FLogType.RANK_EDIT, context.fPlayer.getName(), you.getName(), ChatColor.LIGHT_PURPLE + "Mod");
|
||||
if (you.getRole() == Role.LEADER) {
|
||||
context.msg(TL.COMMAND_MOD_TARGETISADMIN);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
if (you.getRole() == Role.MODERATOR) {
|
||||
// Revoke
|
||||
you.setRole(Role.NORMAL);
|
||||
targetFaction.msg(TL.COMMAND_MOD_REVOKED, you.describeTo(targetFaction, true));
|
||||
context.msg(TL.COMMAND_MOD_REVOKES, you.describeTo(context.fPlayer, true));
|
||||
} else {
|
||||
// Give
|
||||
you.setRole(Role.MODERATOR);
|
||||
targetFaction.msg(TL.COMMAND_MOD_PROMOTED, you.describeTo(targetFaction, true));
|
||||
context.msg(TL.COMMAND_MOD_PROMOTES, you.describeTo(context.fPlayer, true));
|
||||
FactionsPlugin.instance.getFlogManager().log(targetFaction, FLogType.RANK_EDIT, context.fPlayer.getName(), you.getName(), ChatColor.LIGHT_PURPLE + "Mod");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,10 +13,7 @@ public class CmdModifyPower extends FCommand {
|
||||
public CmdModifyPower() {
|
||||
super();
|
||||
|
||||
this.aliases.add("pm");
|
||||
this.aliases.add("mp");
|
||||
this.aliases.add("modifypower");
|
||||
this.aliases.add("modpower");
|
||||
this.aliases.addAll(Aliases.modifyPower);
|
||||
|
||||
this.requiredArgs.add("name");
|
||||
this.requiredArgs.add("power");
|
||||
|
||||
@@ -16,8 +16,7 @@ public class CmdNear extends FCommand {
|
||||
|
||||
public CmdNear() {
|
||||
super();
|
||||
this.aliases.add("near");
|
||||
this.aliases.add("nearby");
|
||||
this.aliases.addAll(Aliases.near);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.NEAR)
|
||||
.playerOnly()
|
||||
|
||||
@@ -16,7 +16,7 @@ public class CmdOpen extends FCommand {
|
||||
|
||||
public CmdOpen() {
|
||||
super();
|
||||
this.aliases.add("open");
|
||||
this.aliases.addAll(Aliases.open);
|
||||
this.optionalArgs.put("yes/no", "flip");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.OPEN)
|
||||
|
||||
@@ -14,7 +14,7 @@ public class CmdOwner extends FCommand {
|
||||
|
||||
public CmdOwner() {
|
||||
super();
|
||||
this.aliases.add("owner");
|
||||
this.aliases.addAll(Aliases.owner_owner);
|
||||
this.optionalArgs.put("player name", "you");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.OWNER)
|
||||
|
||||
@@ -15,7 +15,7 @@ public class CmdOwnerList extends FCommand {
|
||||
|
||||
public CmdOwnerList() {
|
||||
super();
|
||||
this.aliases.add("ownerlist");
|
||||
this.aliases.addAll(Aliases.owner_list);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.OWNERLIST)
|
||||
.playerOnly()
|
||||
|
||||
@@ -12,8 +12,7 @@ public class CmdPaypalSee extends FCommand {
|
||||
*/
|
||||
|
||||
public CmdPaypalSee() {
|
||||
this.aliases.add("seepaypal");
|
||||
this.aliases.add("paypal");
|
||||
this.aliases.addAll(Aliases.paypal_see);
|
||||
|
||||
this.optionalArgs.put("faction", "yours");
|
||||
|
||||
@@ -30,7 +29,6 @@ public class CmdPaypalSee extends FCommand {
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (context.args.size() == 0) {
|
||||
if (context.fPlayer.getFaction().getPaypal() == null) {
|
||||
context.msg(TL.COMMAND_PAYPAL_NOTSET);
|
||||
|
||||
@@ -13,7 +13,7 @@ public class CmdPaypalSet extends FCommand {
|
||||
*/
|
||||
|
||||
public CmdPaypalSet() {
|
||||
this.aliases.add("setpaypal");
|
||||
this.aliases.addAll(Aliases.paypal_set);
|
||||
|
||||
this.optionalArgs.put("faction", "yours");
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public class CmdPeaceful extends FCommand {
|
||||
|
||||
public CmdPeaceful() {
|
||||
super();
|
||||
this.aliases.add("peaceful");
|
||||
this.aliases.addAll(Aliases.peaceful);
|
||||
this.requiredArgs.add("faction tag");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.SET_PEACEFUL)
|
||||
|
||||
@@ -23,10 +23,7 @@ public class CmdPerm extends FCommand {
|
||||
|
||||
public CmdPerm() {
|
||||
super();
|
||||
this.aliases.add("perm");
|
||||
this.aliases.add("perms");
|
||||
this.aliases.add("permission");
|
||||
this.aliases.add("permissions");
|
||||
this.aliases.addAll(Aliases.perm);
|
||||
|
||||
this.optionalArgs.put("relation", "relation");
|
||||
this.optionalArgs.put("action", "action");
|
||||
|
||||
@@ -16,7 +16,7 @@ public class CmdPermanent extends FCommand {
|
||||
|
||||
public CmdPermanent() {
|
||||
super();
|
||||
this.aliases.add("permanent");
|
||||
this.aliases.addAll(Aliases.permanent_faction);
|
||||
this.requiredArgs.add("faction tag");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.SET_PERMANENT)
|
||||
|
||||
@@ -13,7 +13,7 @@ public class CmdPermanentPower extends FCommand {
|
||||
|
||||
public CmdPermanentPower() {
|
||||
super();
|
||||
this.aliases.add("permanentpower");
|
||||
this.aliases.addAll(Aliases.permanent_power);
|
||||
this.requiredArgs.add("faction");
|
||||
this.requiredArgs.add("power");
|
||||
|
||||
|
||||
@@ -7,15 +7,19 @@ import com.massivecraft.factions.zcore.util.TL;
|
||||
public class CmdPlayerTitleToggle extends FCommand {
|
||||
public CmdPlayerTitleToggle() {
|
||||
super();
|
||||
this.aliases.add("titles");
|
||||
this.aliases.addAll(Aliases.titles);
|
||||
this.requirements = new CommandRequirements.Builder(Permission.TOGGLE_TITLES)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
context.fPlayer.setTitlesEnabled(!context.fPlayer.hasTitlesEnabled());
|
||||
context.msg(TL.COMMAND_TITLETOGGLE_TOGGLED, context.fPlayer.hasTitlesEnabled() ? FactionsPlugin.getInstance().color("&dEnabled") : FactionsPlugin.getInstance().color("&dDisabled"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {return TL.COMMAND_TITLETOGGLE_DESCRIPTION;}
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_TITLETOGGLE_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,7 @@ public class CmdPower extends FCommand {
|
||||
|
||||
public CmdPower() {
|
||||
super();
|
||||
this.aliases.add("power");
|
||||
this.aliases.add("pow");
|
||||
this.aliases.addAll(Aliases.power_power);
|
||||
this.optionalArgs.put("player name", "you");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.POWER)
|
||||
|
||||
@@ -15,7 +15,7 @@ public class CmdPowerBoost extends FCommand {
|
||||
|
||||
public CmdPowerBoost() {
|
||||
super();
|
||||
this.aliases.add("powerboost");
|
||||
this.aliases.addAll(Aliases.power_boost);
|
||||
this.requiredArgs.add("plugin|f|player|faction");
|
||||
this.requiredArgs.add("name");
|
||||
this.requiredArgs.add("# or reset");
|
||||
|
||||
@@ -16,7 +16,7 @@ public class CmdReload extends FCommand {
|
||||
|
||||
public CmdReload() {
|
||||
super();
|
||||
this.aliases.add("reload");
|
||||
this.aliases.addAll(Aliases.reload);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.RELOAD).build();
|
||||
}
|
||||
|
||||
@@ -15,9 +15,7 @@ public class CmdRules extends FCommand {
|
||||
|
||||
public CmdRules() {
|
||||
super();
|
||||
aliases.add("r");
|
||||
aliases.add("rule");
|
||||
aliases.add("rules");
|
||||
aliases.addAll(Aliases.rules);
|
||||
|
||||
this.optionalArgs.put("add/remove/set/clear", "");
|
||||
|
||||
|
||||
@@ -11,8 +11,7 @@ public class CmdSB extends FCommand {
|
||||
*/
|
||||
|
||||
public CmdSB() {
|
||||
this.aliases.add("sb");
|
||||
this.aliases.add("scoreboard");
|
||||
this.aliases.addAll(Aliases.scoreboard);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.SCOREBOARD)
|
||||
.playerOnly()
|
||||
|
||||
@@ -13,8 +13,7 @@ public class CmdSaveAll extends FCommand {
|
||||
|
||||
public CmdSaveAll() {
|
||||
super();
|
||||
this.aliases.add("saveall");
|
||||
this.aliases.add("save");
|
||||
this.aliases.addAll(Aliases.saveAll);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.SAVE)
|
||||
.build();
|
||||
|
||||
@@ -32,8 +32,7 @@ public class CmdSeeChunk extends FCommand {
|
||||
|
||||
public CmdSeeChunk() {
|
||||
super();
|
||||
aliases.add("seechunk");
|
||||
aliases.add("sc");
|
||||
aliases.addAll(Aliases.seeChunk);
|
||||
|
||||
this.useParticles = FactionsPlugin.getInstance().getConfig().getBoolean("see-chunk.particles", true);
|
||||
interval = FactionsPlugin.getInstance().getConfig().getLong("see-chunk.interval", 10L);
|
||||
@@ -75,7 +74,9 @@ public class CmdSeeChunk extends FCommand {
|
||||
for (Object nameObject : seeChunkMap.keySet()) {
|
||||
String name = nameObject + "";
|
||||
Player player = Bukkit.getPlayer(name);
|
||||
showBorders(player);
|
||||
if (player != null) {
|
||||
showBorders(player);
|
||||
}
|
||||
}
|
||||
manageTask();
|
||||
}, 0, interval);
|
||||
@@ -111,24 +112,19 @@ public class CmdSeeChunk extends FCommand {
|
||||
private void showPillar(Player player, World world, int blockX, int blockZ) {
|
||||
for (int blockY = 0; blockY < player.getLocation().getBlockY() + 30; blockY++) {
|
||||
Location loc = new Location(world, blockX, blockY, blockZ).add(0.5, 0, 0.5);
|
||||
if (loc.getBlock().getType() != Material.AIR) {
|
||||
continue;
|
||||
}
|
||||
if (loc.getBlock().getType() != Material.AIR) continue;
|
||||
if (useParticles) {
|
||||
if (FactionsPlugin.getInstance().useNonPacketParticles) {
|
||||
// Dust options only exists in the 1.13 API, so we use an
|
||||
// alternative method to achieve this in lower versions.
|
||||
if (FactionsPlugin.getInstance().mc113 || FactionsPlugin.getInstance().mc114) {
|
||||
if (FactionsPlugin.getInstance().mc113 || FactionsPlugin.getInstance().mc114 || FactionsPlugin.getInstance().mc115) {
|
||||
player.spawnParticle(Particle.REDSTONE, loc, 0, new Particle.DustOptions(Color.RED, 1));
|
||||
} else {
|
||||
player.getWorld().spawnParticle(Particle.REDSTONE, loc, 0, 255, 0, 0, 1);
|
||||
}
|
||||
|
||||
} else {
|
||||
this.effect.display(0, 0, 0, 0, 1, loc, player);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
Material type = blockY % 5 == 0 ? XMaterial.REDSTONE_LAMP.parseMaterial() : XMaterial.BLACK_STAINED_GLASS.parseMaterial();
|
||||
VisualizeUtil.addLocation(player, loc, type);
|
||||
|
||||
@@ -5,15 +5,14 @@ import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdSeeDiscord extends FCommand{
|
||||
public class CmdSeeDiscord extends FCommand {
|
||||
|
||||
/**
|
||||
* @author Driftay
|
||||
*/
|
||||
|
||||
public CmdSeeDiscord() {
|
||||
this.aliases.add("seediscord");
|
||||
this.aliases.add("discord");
|
||||
this.aliases.addAll(Aliases.discord_see);
|
||||
|
||||
this.optionalArgs.put("faction", "yours");
|
||||
|
||||
@@ -30,7 +29,6 @@ public class CmdSeeDiscord extends FCommand{
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (context.args.size() == 0) {
|
||||
if (context.fPlayer.getFaction().getDiscord() == null) {
|
||||
context.msg(TL.COMMAND_DISCORD_NOTSET);
|
||||
|
||||
@@ -11,7 +11,7 @@ public class CmdSetBanner extends FCommand {
|
||||
|
||||
public CmdSetBanner() {
|
||||
super();
|
||||
aliases.add("setbanner");
|
||||
aliases.addAll(Aliases.setBanner);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.BANNER)
|
||||
.playerOnly()
|
||||
|
||||
@@ -13,10 +13,7 @@ public class CmdSetDefaultRole extends FCommand {
|
||||
public CmdSetDefaultRole() {
|
||||
super();
|
||||
|
||||
this.aliases.add("defaultrole");
|
||||
this.aliases.add("defaultrank");
|
||||
this.aliases.add("default");
|
||||
this.aliases.add("def");
|
||||
this.aliases.addAll(Aliases.setDefaultRole);
|
||||
this.requiredArgs.add("role");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.DEFAULTRANK)
|
||||
|
||||
@@ -12,9 +12,9 @@ public class CmdSetDiscord extends FCommand {
|
||||
* @author Driftay
|
||||
*/
|
||||
|
||||
public CmdSetDiscord(){
|
||||
public CmdSetDiscord() {
|
||||
super();
|
||||
this.aliases.add("setdiscord");
|
||||
this.aliases.addAll(Aliases.discord_set);
|
||||
|
||||
this.optionalArgs.put("faction", "yours");
|
||||
|
||||
@@ -64,7 +64,7 @@ public class CmdSetDiscord extends FCommand {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isDiscordInvite(String invite){
|
||||
private boolean isDiscordInvite(String invite) {
|
||||
return invite.contains("discord.gg") || invite.contains("discord.me");
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,7 @@ public class CmdSetFWarp extends FCommand {
|
||||
*/
|
||||
|
||||
public CmdSetFWarp() {
|
||||
this.aliases.add("setwarp");
|
||||
this.aliases.add("sw");
|
||||
this.aliases.addAll(Aliases.setWarp);
|
||||
this.requiredArgs.add("warp name");
|
||||
this.optionalArgs.put("password", "password");
|
||||
this.requirements = new CommandRequirements.Builder(Permission.SETWARP).playerOnly().memberOnly().withAction(PermissableAction.SETWARP).build();
|
||||
|
||||
@@ -12,8 +12,7 @@ public class CmdSetMaxVaults extends FCommand {
|
||||
*/
|
||||
|
||||
public CmdSetMaxVaults() {
|
||||
this.aliases.add("setmaxvaults");
|
||||
this.aliases.add("smv");
|
||||
this.aliases.addAll(Aliases.setMaxVaults);
|
||||
this.requiredArgs.add("faction");
|
||||
this.requiredArgs.add("number");
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.fperms.Access;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
@@ -12,7 +13,7 @@ public class CmdSethome extends FCommand {
|
||||
*/
|
||||
|
||||
public CmdSethome() {
|
||||
this.aliases.add("sethome");
|
||||
this.aliases.addAll(Aliases.setHome);
|
||||
this.optionalArgs.put("faction tag", "mine");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.SETHOME)
|
||||
@@ -43,6 +44,16 @@ public class CmdSethome extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!context.args.isEmpty()) {
|
||||
Faction target = context.argAsFaction(0);
|
||||
if (target == null) return;
|
||||
context.faction = target;
|
||||
if (target.getAccess(context.fPlayer, PermissableAction.SETHOME) != Access.ALLOW) {
|
||||
context.fPlayer.msg(TL.GENERIC_FPERM_NOPERMISSION, "set faction home");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if (!context.payForCommand(Conf.econCostSethome, TL.COMMAND_SETHOME_TOSET, TL.COMMAND_SETHOME_FORSET)) {
|
||||
return;
|
||||
|
||||
@@ -21,8 +21,7 @@ public class CmdShow extends FCommand {
|
||||
List<String> defaults = new ArrayList<>();
|
||||
|
||||
public CmdShow() {
|
||||
this.aliases.add("show");
|
||||
this.aliases.add("who");
|
||||
this.aliases.addAll(Aliases.show_show);
|
||||
|
||||
// add defaults to /f show in case config doesnt have it
|
||||
defaults.add("{header}");
|
||||
|
||||
@@ -13,8 +13,7 @@ public class CmdShowClaims extends FCommand {
|
||||
*/
|
||||
|
||||
public CmdShowClaims() {
|
||||
this.aliases.add("showclaims");
|
||||
this.aliases.add("showclaim");
|
||||
this.aliases.addAll(Aliases.show_claims);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.SHOWCLAIMS)
|
||||
.playerOnly()
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import mkremins.fanciful.FancyMessage;
|
||||
@@ -17,7 +16,7 @@ public class CmdShowInvites extends FCommand {
|
||||
|
||||
public CmdShowInvites() {
|
||||
super();
|
||||
aliases.add("showinvites");
|
||||
aliases.addAll(Aliases.show_invites);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.SHOW_INVITES)
|
||||
.playerOnly()
|
||||
@@ -28,12 +27,12 @@ public class CmdShowInvites extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
FancyMessage msg = new FancyMessage(TL.COMMAND_SHOWINVITES_PENDING.toString()).color(ChatColor.GOLD);
|
||||
for (String id : context.faction.getInvites()) {
|
||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||
String name = fp != null ? fp.getName() : id;
|
||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_SHOWINVITES_CLICKTOREVOKE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||
}
|
||||
FancyMessage msg = new FancyMessage(TL.COMMAND_SHOWINVITES_PENDING.toString()).color(ChatColor.GOLD);
|
||||
for (String id : context.faction.getInvites()) {
|
||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||
String name = fp != null ? fp.getName() : id;
|
||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_SHOWINVITES_CLICKTOREVOKE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,17 +11,16 @@ public class CmdSpawnerLock extends FCommand {
|
||||
* @author Illyria Team
|
||||
*/
|
||||
|
||||
public CmdSpawnerLock(){
|
||||
public CmdSpawnerLock() {
|
||||
super();
|
||||
this.aliases.add("lockspawners");
|
||||
this.aliases.add("spawnerlock");
|
||||
this.aliases.addAll(Aliases.spawnerlock);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.LOCKSPAWNERS)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context){
|
||||
public void perform(CommandContext context) {
|
||||
Conf.spawnerLock = !Conf.spawnerLock;
|
||||
context.msg(TL.COMMAND_SPAWNER_LOCK_TOGGLED, Conf.spawnerLock ? FactionsPlugin.getInstance().color("&aEnabled") : FactionsPlugin.getInstance().color("&4Disabled"));
|
||||
}
|
||||
|
||||
@@ -16,8 +16,7 @@ public class CmdStatus extends FCommand {
|
||||
|
||||
public CmdStatus() {
|
||||
super();
|
||||
this.aliases.add("status");
|
||||
this.aliases.add("s");
|
||||
this.aliases.addAll(Aliases.status);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.STATUS)
|
||||
.playerOnly()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
@@ -10,8 +11,7 @@ public class CmdStealth extends FCommand {
|
||||
*/
|
||||
|
||||
public CmdStealth() {
|
||||
this.aliases.add("ninja");
|
||||
this.aliases.add("stealth");
|
||||
this.aliases.addAll(Aliases.stealth);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.STEALTH)
|
||||
.playerOnly()
|
||||
@@ -20,6 +20,12 @@ public class CmdStealth extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
if (!Conf.useSealthSystem) {
|
||||
context.msg(TL.GENERIC_DISABLED, "Factions Stealth");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (context.faction != null && !context.faction.getId().equalsIgnoreCase("0") && !context.faction.getId().equalsIgnoreCase("none") && !context.faction.getId().equalsIgnoreCase("safezone") && !context.faction.getId().equalsIgnoreCase("warzone")) {
|
||||
context.fPlayer.setStealth(!context.fPlayer.isStealthEnabled());
|
||||
context.msg(context.fPlayer.isStealthEnabled() ? TL.COMMAND_STEALTH_ENABLE : TL.COMMAND_STEALTH_DISABLE);
|
||||
|
||||
@@ -18,7 +18,7 @@ public class CmdStrikes extends FCommand {
|
||||
public CmdStrikes() {
|
||||
super();
|
||||
|
||||
this.aliases.add("strikes");
|
||||
this.aliases.addAll(Aliases.strikes_strikes);
|
||||
|
||||
this.addSubCommand(cmdStrikesGive);
|
||||
this.addSubCommand(cmdStrikesInfo);
|
||||
|
||||
@@ -12,7 +12,7 @@ public class CmdStrikesGive extends FCommand {
|
||||
|
||||
public CmdStrikesGive() {
|
||||
super();
|
||||
this.aliases.add("give");
|
||||
this.aliases.addAll(Aliases.strikes_give);
|
||||
this.requiredArgs.add(0, "faction");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.SETSTRIKES)
|
||||
|
||||
@@ -12,7 +12,7 @@ public class CmdStrikesInfo extends FCommand {
|
||||
|
||||
public CmdStrikesInfo() {
|
||||
super();
|
||||
this.aliases.add("info");
|
||||
this.aliases.addAll(Aliases.strikes_info);
|
||||
this.optionalArgs.put("target", "faction");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.SETSTRIKES)
|
||||
|
||||
@@ -12,7 +12,7 @@ public class CmdStrikesSet extends FCommand {
|
||||
|
||||
public CmdStrikesSet() {
|
||||
super();
|
||||
this.aliases.add("set");
|
||||
this.aliases.addAll(Aliases.strikes_set);
|
||||
this.requiredArgs.add(0, "faction");
|
||||
this.requiredArgs.add(1, "amount");
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public class CmdStrikesTake extends FCommand {
|
||||
|
||||
public CmdStrikesTake() {
|
||||
super();
|
||||
this.aliases.add("take");
|
||||
this.aliases.addAll(Aliases.strikes_take);
|
||||
this.requiredArgs.add(0, "faction");
|
||||
this.requiredArgs.add(1, "number of strikes");
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@ public class CmdStuck extends FCommand {
|
||||
|
||||
public CmdStuck() {
|
||||
super();
|
||||
this.aliases.add("stuck");
|
||||
this.aliases.add("halp!"); // halp!c:
|
||||
this.aliases.addAll(Aliases.stuck);
|
||||
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.STUCK)
|
||||
@@ -36,6 +35,12 @@ public class CmdStuck extends FCommand {
|
||||
final long delay = FactionsPlugin.getInstance().getConfig().getLong("hcf.stuck.delay", 30);
|
||||
final int radius = FactionsPlugin.getInstance().getConfig().getInt("hcf.stuck.radius", 10);
|
||||
|
||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("hcf.stuck.Enabled", false)) {
|
||||
context.msg(TL.GENERIC_DISABLED, "Factions Stuck");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (FactionsPlugin.getInstance().getStuckMap().containsKey(player.getUniqueId())) {
|
||||
long wait = FactionsPlugin.getInstance().getTimers().get(player.getUniqueId()) - System.currentTimeMillis();
|
||||
String time = DurationFormatUtils.formatDuration(wait, TL.COMMAND_STUCK_TIMEFORMAT.toString(), true);
|
||||
|
||||
@@ -20,8 +20,7 @@ public class CmdTag extends FCommand {
|
||||
*/
|
||||
|
||||
public CmdTag() {
|
||||
this.aliases.add("tag");
|
||||
this.aliases.add("rename");
|
||||
this.aliases.addAll(Aliases.tag);
|
||||
|
||||
this.requiredArgs.add("faction tag");
|
||||
|
||||
@@ -34,59 +33,57 @@ public class CmdTag extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
||||
|
||||
String tag = context.argAsString(0);
|
||||
String tag = context.argAsString(0);
|
||||
|
||||
// TODO does not first test cover selfcase?
|
||||
if (Factions.getInstance().isTagTaken(tag) && !MiscUtil.getComparisonString(tag).equals(context.faction.getComparisonTag())) {
|
||||
context.msg(TL.COMMAND_TAG_TAKEN);
|
||||
return;
|
||||
// TODO does not first test cover selfcase?
|
||||
if (Factions.getInstance().isTagTaken(tag) && !MiscUtil.getComparisonString(tag).equals(context.faction.getComparisonTag())) {
|
||||
context.msg(TL.COMMAND_TAG_TAKEN);
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<String> errors = MiscUtil.validateTag(tag);
|
||||
if (errors.size() > 0) {
|
||||
context.sendMessage(errors);
|
||||
return;
|
||||
}
|
||||
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
|
||||
if (!context.canAffordCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE.toString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// trigger the faction rename event (cancellable)
|
||||
FactionRenameEvent renameEvent = new FactionRenameEvent(context.fPlayer, tag);
|
||||
Bukkit.getServer().getPluginManager().callEvent(renameEvent);
|
||||
if (renameEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// then make 'em pay (if applicable)
|
||||
if (!context.payForCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE, TL.COMMAND_TAG_FORCHANGE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String oldtag = context.faction.getTag();
|
||||
context.faction.setTag(tag);
|
||||
Discord.changeFactionTag(context.faction, oldtag);
|
||||
FactionsPlugin.instance.logFactionEvent(context.faction, FLogType.FTAG_EDIT, context.fPlayer.getName(), tag);
|
||||
|
||||
|
||||
// Inform
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
if (fplayer.getFactionId().equals(context.faction.getId())) {
|
||||
fplayer.msg(TL.COMMAND_TAG_FACTION, context.fPlayer.describeTo(context.faction, true), context.faction.getTag(context.faction));
|
||||
continue;
|
||||
}
|
||||
|
||||
ArrayList<String> errors = MiscUtil.validateTag(tag);
|
||||
if (errors.size() > 0) {
|
||||
context.sendMessage(errors);
|
||||
return;
|
||||
// Broadcast the tag change (if applicable)
|
||||
if (Conf.broadcastTagChanges) {
|
||||
Faction faction = fplayer.getFaction();
|
||||
fplayer.msg(TL.COMMAND_TAG_CHANGED, context.fPlayer.getColorTo(faction) + oldtag, context.faction.getTag(faction));
|
||||
}
|
||||
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
|
||||
if (!context.canAffordCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE.toString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// trigger the faction rename event (cancellable)
|
||||
FactionRenameEvent renameEvent = new FactionRenameEvent(context.fPlayer, tag);
|
||||
Bukkit.getServer().getPluginManager().callEvent(renameEvent);
|
||||
if (renameEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// then make 'em pay (if applicable)
|
||||
if (!context.payForCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE, TL.COMMAND_TAG_FORCHANGE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String oldtag = context.faction.getTag();
|
||||
context.faction.setTag(tag);
|
||||
Discord.changeFactionTag(context.faction, oldtag);
|
||||
FactionsPlugin.instance.logFactionEvent(context.faction, FLogType.FTAG_EDIT, context.fPlayer.getName(), tag);
|
||||
|
||||
|
||||
// Inform
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
if (fplayer.getFactionId().equals(context.faction.getId())) {
|
||||
fplayer.msg(TL.COMMAND_TAG_FACTION, context.fPlayer.describeTo(context.faction, true), context.faction.getTag(context.faction));
|
||||
continue;
|
||||
}
|
||||
// Broadcast the tag change (if applicable)
|
||||
if (Conf.broadcastTagChanges) {
|
||||
Faction faction = fplayer.getFaction();
|
||||
fplayer.msg(TL.COMMAND_TAG_CHANGED, context.fPlayer.getColorTo(faction) + oldtag, context.faction.getTag(faction));
|
||||
}
|
||||
}
|
||||
FTeamWrapper.updatePrefixes(context.faction);
|
||||
});
|
||||
}
|
||||
FTeamWrapper.updatePrefixes(context.faction);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,7 +14,7 @@ public class CmdTitle extends FCommand {
|
||||
*/
|
||||
|
||||
public CmdTitle() {
|
||||
this.aliases.add("title");
|
||||
this.aliases.addAll(Aliases.title);
|
||||
this.requiredArgs.add("player name");
|
||||
this.optionalArgs.put("title", "");
|
||||
|
||||
|
||||
@@ -12,9 +12,7 @@ public class CmdToggleAllianceChat extends FCommand {
|
||||
|
||||
public CmdToggleAllianceChat() {
|
||||
super();
|
||||
this.aliases.add("tac");
|
||||
this.aliases.add("togglealliancechat");
|
||||
this.aliases.add("ac");
|
||||
this.aliases.addAll(Aliases.toggleAllianceChat);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.TOGGLE_ALLIANCE_CHAT)
|
||||
.playerOnly()
|
||||
|
||||
@@ -18,8 +18,7 @@ public class CmdTop extends FCommand {
|
||||
|
||||
public CmdTop() {
|
||||
super();
|
||||
this.aliases.add("top");
|
||||
this.aliases.add("t");
|
||||
this.aliases.addAll(Aliases.top);
|
||||
this.requiredArgs.add("criteria");
|
||||
this.optionalArgs.put("page", "1");
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.listeners.FactionsBlockListener;
|
||||
import com.massivecraft.factions.listeners.FactionsPlayerListener;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.util.WarmUpUtil;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
@@ -15,7 +14,7 @@ public class CmdTpBanner extends FCommand {
|
||||
|
||||
public CmdTpBanner() {
|
||||
super();
|
||||
this.aliases.add("tpbanner");
|
||||
this.aliases.addAll(Aliases.tpBanner);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.TPBANNER)
|
||||
.playerOnly()
|
||||
|
||||
@@ -14,7 +14,7 @@ public class CmdUnban extends FCommand {
|
||||
|
||||
public CmdUnban() {
|
||||
super();
|
||||
this.aliases.add("unban");
|
||||
this.aliases.addAll(Aliases.unban);
|
||||
this.requiredArgs.add("target");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.BAN)
|
||||
@@ -48,7 +48,7 @@ public class CmdUnban extends FCommand {
|
||||
context.faction.unban(target);
|
||||
|
||||
context.msg(TL.COMMAND_UNBAN_UNBANNED, context.fPlayer.getName(), target.getName());
|
||||
target.msg(TL.COMMAND_UNBAN_TARGET.toString(), context.faction.getTag(target));
|
||||
target.msg(TL.COMMAND_UNBAN_TARGET, context.faction.getTag(target));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user