Compare commits
56 Commits
2.0.5
...
2.2.2-BETA
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d1e1ea6ed | ||
|
|
372eed65a0 | ||
|
|
86f92a7fb0 | ||
|
|
897fdbf83a | ||
|
|
4e11234a08 | ||
|
|
3a22bb348e | ||
|
|
91ca08e66b | ||
|
|
11d9f9230b | ||
|
|
38cf542d8c | ||
|
|
93b485aae8 | ||
|
|
b9996a2250 | ||
|
|
368a605d31 | ||
|
|
fec07b6fac | ||
|
|
58e43b41cc | ||
|
|
d5645f3b0a | ||
|
|
fa10bf7003 | ||
|
|
ca9502a4b6 | ||
|
|
0a60a581f5 | ||
|
|
faf245b870 | ||
|
|
f124877dba | ||
|
|
fc5befd7cc | ||
|
|
d03ca58105 | ||
|
|
f437144fba | ||
|
|
9284707db6 | ||
|
|
7b07e3ed23 | ||
|
|
c0719ec4f5 | ||
|
|
c9fd86ef9e | ||
|
|
939a60c611 | ||
|
|
36f22262c6 | ||
|
|
f5e9ce3d90 | ||
|
|
e244b469aa | ||
|
|
5f80ecfa76 | ||
|
|
28517ef391 | ||
|
|
5744b7e28e | ||
|
|
f3b0dcdb7f | ||
|
|
0b127cbe72 | ||
|
|
4f6329996f | ||
|
|
3710031b80 | ||
|
|
6c10cdd47d | ||
|
|
5eeb8a2020 | ||
|
|
fe5378e9d7 | ||
|
|
e60d58e68b | ||
|
|
649392363f | ||
|
|
1927f49221 | ||
|
|
9349a914ce | ||
|
|
f8e22896d5 | ||
|
|
ac859db55f | ||
|
|
8c7addb68e | ||
|
|
d808bac17b | ||
|
|
d3a7fc67a5 | ||
|
|
bd77c8266c | ||
|
|
8bde1385fc | ||
|
|
472cb86465 | ||
|
|
d77ee76ea7 | ||
|
|
441382acdc | ||
|
|
d3870731f4 |
28
pom.xml
28
pom.xml
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<groupId>com.massivecraft</groupId>
|
<groupId>com.massivecraft</groupId>
|
||||||
<artifactId>Factions</artifactId>
|
<artifactId>Factions</artifactId>
|
||||||
<version>1.6.9.5-U0.2.1-2.0.5-BETA</version>
|
<version>1.6.9.5-U0.2.1-2.2.2-BETA</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>SaberFactions</name>
|
<name>SaberFactions</name>
|
||||||
@@ -41,6 +41,10 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
<relocations>
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>net.dv8tion</pattern>
|
||||||
|
<shadedPattern>com.massivecraft.factions.shade.net.dv8tion</shadedPattern>
|
||||||
|
</relocation>
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>mkremins.fanciful</pattern>
|
<pattern>mkremins.fanciful</pattern>
|
||||||
<shadedPattern>com.massivecraft.factions.shade.mkremins.fanciful</shadedPattern>
|
<shadedPattern>com.massivecraft.factions.shade.mkremins.fanciful</shadedPattern>
|
||||||
@@ -101,7 +105,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.13-R0.1-SNAPSHOT</version>
|
<version>1.15.1-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
@@ -126,6 +130,11 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.ocpsoft.prettytime</groupId>
|
||||||
|
<artifactId>prettytime</artifactId>
|
||||||
|
<version>4.0.0.Final</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.milkbowl.vault</groupId>
|
<groupId>net.milkbowl.vault</groupId>
|
||||||
<artifactId>VaultAPI</artifactId>
|
<artifactId>VaultAPI</artifactId>
|
||||||
@@ -377,9 +386,10 @@
|
|||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codemc.worldguardwrapper</groupId>
|
<groupId>me.rayzr522</groupId>
|
||||||
<artifactId>worldguardwrapper</artifactId>
|
<artifactId>jsonmessage</artifactId>
|
||||||
<version>1.1.6-SNAPSHOT</version>
|
<version>1.0.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.jagrosh</groupId>
|
<groupId>com.jagrosh</groupId>
|
||||||
@@ -411,6 +421,14 @@
|
|||||||
<id>spigot-repo</id>
|
<id>spigot-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>org.ocpsoft.prettytime</id>
|
||||||
|
<url>https://mvnrepository.com/artifact/org.ocpsoft.prettytime/prettytime</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>rayzr-repo</id>
|
||||||
|
<url>https://cdn.rawgit.com/Rayzr522/maven-repo/master/</url>
|
||||||
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>maven.sk89q.com</id>
|
<id>maven.sk89q.com</id>
|
||||||
<url>http://maven.sk89q.com/repo/</url>
|
<url>http://maven.sk89q.com/repo/</url>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.factions;
|
package com.massivecraft.factions;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.massivecraft.factions.integration.dynmap.DynmapStyle;
|
import com.massivecraft.factions.integration.dynmap.DynmapStyle;
|
||||||
import com.massivecraft.factions.util.XMaterial;
|
import com.massivecraft.factions.util.XMaterial;
|
||||||
import com.massivecraft.factions.zcore.fperms.DefaultPermissions;
|
import com.massivecraft.factions.zcore.fperms.DefaultPermissions;
|
||||||
@@ -70,6 +71,7 @@ public class Conf {
|
|||||||
public static boolean chatTagEnabled = true;
|
public static boolean chatTagEnabled = true;
|
||||||
public static transient boolean chatTagHandledByAnotherPlugin = false;
|
public static transient boolean chatTagHandledByAnotherPlugin = false;
|
||||||
public static boolean chatTagRelationColored = true;
|
public static boolean chatTagRelationColored = true;
|
||||||
|
public static List<String> blacklistedFactionNames = new ArrayList<>();
|
||||||
public static String chatTagReplaceString = "[FACTION]";
|
public static String chatTagReplaceString = "[FACTION]";
|
||||||
public static String chatTagInsertAfterString = "";
|
public static String chatTagInsertAfterString = "";
|
||||||
public static String chatTagInsertBeforeString = "";
|
public static String chatTagInsertBeforeString = "";
|
||||||
@@ -97,12 +99,30 @@ public class Conf {
|
|||||||
public static boolean autoLeaveDeleteFPlayerData = true; // Let them just remove player from Faction.
|
public static boolean autoLeaveDeleteFPlayerData = true; // Let them just remove player from Faction.
|
||||||
public static boolean worldGuardChecking = false;
|
public static boolean worldGuardChecking = false;
|
||||||
public static boolean worldGuardBuildPriority = false;
|
public static boolean worldGuardBuildPriority = false;
|
||||||
|
public static boolean factionsDrainEnabled = false;
|
||||||
|
|
||||||
//DISCORD
|
//DISCORD
|
||||||
public static boolean useDiscordSystem = false;
|
public static boolean useDiscordSystem = false;
|
||||||
public static String discordBotToken = "<token here>";
|
public static String discordBotToken = "<token here>";
|
||||||
public static String fromDiscordFactionChatPrefix = "&f[&dDiscord&f] ";
|
public static String fromDiscordFactionChatPrefix = "&f[&dDiscord&f] ";
|
||||||
public static String avatarUrl = "http://cravatar.eu/helmavatar/%uuid%.png";
|
public static String avatarUrl = "http://cravatar.eu/helmavatar/%uuid%.png";
|
||||||
public static String webhookName = "SaberFactions Hook";
|
public static String webhookName = "SaberFactions Hook";
|
||||||
|
public static String mainGuildID = "<Discord Server ID here>";
|
||||||
|
public static String positiveReaction = "<Server emote here>";
|
||||||
|
public static String negativeReaction = "<Server emote here>";
|
||||||
|
public static Boolean restrictActionsWhenNotLinked = false;
|
||||||
|
public static Boolean leaderRoles = false;
|
||||||
|
public static String leaderRole = "<Leader Role ID>";
|
||||||
|
public static Boolean factionDiscordTags = false;
|
||||||
|
public static String factionTag = "(NAME) [FACTION]";
|
||||||
|
public static Boolean factionRoles = false;
|
||||||
|
public static List<Integer> factionRoleColor = new ArrayList<Integer>(){{
|
||||||
|
add(25);
|
||||||
|
add(162);
|
||||||
|
add(203);
|
||||||
|
}};
|
||||||
|
public static String factionRolePrefix = "✦";
|
||||||
|
public static String factionRoleSuffix = "✦";
|
||||||
// server logging options
|
// server logging options
|
||||||
public static boolean logFactionCreate = true;
|
public static boolean logFactionCreate = true;
|
||||||
public static boolean logFactionDisband = true;
|
public static boolean logFactionDisband = true;
|
||||||
@@ -114,6 +134,7 @@ public class Conf {
|
|||||||
public static boolean logMoneyTransactions = true;
|
public static boolean logMoneyTransactions = true;
|
||||||
public static boolean logPlayerCommands = true;
|
public static boolean logPlayerCommands = true;
|
||||||
// prevent some potential exploits
|
// prevent some potential exploits
|
||||||
|
public static boolean denyFlightIfInNoClaimingWorld = false;
|
||||||
public static boolean preventCreeperGlitch = true;
|
public static boolean preventCreeperGlitch = true;
|
||||||
public static boolean handleExploitObsidianGenerators = true;
|
public static boolean handleExploitObsidianGenerators = true;
|
||||||
public static boolean handleExploitEnderPearlClipping = true;
|
public static boolean handleExploitEnderPearlClipping = true;
|
||||||
@@ -230,6 +251,11 @@ public class Conf {
|
|||||||
public static Set<Material> territoryBypassProtectedMaterials = EnumSet.noneOf(Material.class);
|
public static Set<Material> territoryBypassProtectedMaterials = EnumSet.noneOf(Material.class);
|
||||||
// Dependency check
|
// Dependency check
|
||||||
public static boolean dependencyCheck = true;
|
public static boolean dependencyCheck = true;
|
||||||
|
|
||||||
|
public static Set<Material> territoryCancelAndAllowItemUseMaterial = new HashSet<>();
|
||||||
|
public static Set<Material> territoryDenySwitchMaterials = new HashSet<>();
|
||||||
|
public static boolean allowCreeperEggingChests = true;
|
||||||
|
|
||||||
// Economy settings
|
// Economy settings
|
||||||
public static boolean econEnabled = false;
|
public static boolean econEnabled = false;
|
||||||
public static String econUniverseAccount = "";
|
public static String econUniverseAccount = "";
|
||||||
@@ -342,6 +368,7 @@ public class Conf {
|
|||||||
// faction-<factionId>
|
// faction-<factionId>
|
||||||
public static int defaultMaxVaults = 0;
|
public static int defaultMaxVaults = 0;
|
||||||
public static boolean disableFlightOnFactionClaimChange = true;
|
public static boolean disableFlightOnFactionClaimChange = true;
|
||||||
|
public static boolean sendFactionChangeMessage = true;
|
||||||
|
|
||||||
public static Backend backEnd = Backend.JSON;
|
public static Backend backEnd = Backend.JSON;
|
||||||
|
|
||||||
@@ -378,6 +405,8 @@ public class Conf {
|
|||||||
static {
|
static {
|
||||||
baseCommandAliases.add("f");
|
baseCommandAliases.add("f");
|
||||||
|
|
||||||
|
blacklistedFactionNames.add("somenamehere");
|
||||||
|
|
||||||
territoryEnemyDenyCommands.add("home");
|
territoryEnemyDenyCommands.add("home");
|
||||||
territoryEnemyDenyCommands.add("sethome");
|
territoryEnemyDenyCommands.add("sethome");
|
||||||
territoryEnemyDenyCommands.add("spawn");
|
territoryEnemyDenyCommands.add("spawn");
|
||||||
@@ -385,11 +414,108 @@ public class Conf {
|
|||||||
territoryEnemyDenyCommands.add("tpaccept");
|
territoryEnemyDenyCommands.add("tpaccept");
|
||||||
territoryEnemyDenyCommands.add("tpa");
|
territoryEnemyDenyCommands.add("tpa");
|
||||||
|
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.ACACIA_FENCE_GATE.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.BIRCH_FENCE_GATE.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.DARK_OAK_FENCE_GATE.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.JUNGLE_FENCE_GATE.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.OAK_FENCE_GATE.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.SPRUCE_FENCE_GATE.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.ACACIA_DOOR.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.BIRCH_DOOR.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.DARK_OAK_DOOR.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.JUNGLE_DOOR.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.OAK_DOOR.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.SPRUCE_DOOR.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.DISPENSER.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.CHEST.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.TRAPPED_CHEST.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.ACACIA_BUTTON.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.BIRCH_BUTTON.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.DARK_OAK_BUTTON.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.JUNGLE_BUTTON.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.OAK_BUTTON.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.SPRUCE_BUTTON.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.DROPPER.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.HOPPER.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.ITEM_FRAME.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.ACACIA_TRAPDOOR.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.BIRCH_TRAPDOOR.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.DARK_OAK_TRAPDOOR.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.JUNGLE_TRAPDOOR.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.OAK_TRAPDOOR.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.SPRUCE_TRAPDOOR.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.LEVER.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.COMPARATOR.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.REPEATER.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.ACACIA_BUTTON.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.BIRCH_BUTTON.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.DARK_OAK_BUTTON.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.JUNGLE_BUTTON.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.OAK_BUTTON.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.SPRUCE_BUTTON.parseMaterial());
|
||||||
|
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.PURPLE_SHULKER_BOX.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.WHITE_SHULKER_BOX.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.MAGENTA_SHULKER_BOX.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.LIGHT_BLUE_SHULKER_BOX.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.CYAN_SHULKER_BOX.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.BLUE_SHULKER_BOX.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.BROWN_SHULKER_BOX.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.ORANGE_SHULKER_BOX.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.GREEN_SHULKER_BOX.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.RED_SHULKER_BOX.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.BLACK_SHULKER_BOX.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.GRAY_SHULKER_BOX.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.LIME_SHULKER_BOX.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.LIGHT_GRAY_SHULKER_BOX.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.PINK_SHULKER_BOX.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.YELLOW_SHULKER_BOX.parseMaterial());
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.SHULKER_BOX.parseMaterial());
|
||||||
|
|
||||||
|
// 1.14 Barrel is a container.
|
||||||
|
territoryDenySwitchMaterials.add(XMaterial.BARREL.parseMaterial());
|
||||||
|
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.GOLDEN_APPLE.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.APPLE.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.ENCHANTED_GOLDEN_APPLE.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.COOKED_BEEF.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.COOKED_MUTTON.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.COOKED_CHICKEN.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.COOKED_COD.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.COOKED_PORKCHOP.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.COOKED_RABBIT.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.COOKED_SALMON.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.ENDER_PEARL.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.POTION.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.SPLASH_POTION.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.CREEPER_SPAWN_EGG.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.BOW.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.DIAMOND_HELMET.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.DIAMOND_CHESTPLATE.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.DIAMOND_LEGGINGS.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.DIAMOND_BOOTS.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.IRON_HELMET.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.IRON_CHESTPLATE.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.IRON_LEGGINGS.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.IRON_BOOTS.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.LEATHER_HELMET.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.LEATHER_CHESTPLATE.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.LEATHER_LEGGINGS.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.LEATHER_BOOTS.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.CHAINMAIL_HELMET.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.CHAINMAIL_CHESTPLATE.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.CHAINMAIL_LEGGINGS.parseMaterial());
|
||||||
|
territoryCancelAndAllowItemUseMaterial.add(XMaterial.CHAINMAIL_BOOTS.parseMaterial());
|
||||||
|
|
||||||
|
|
||||||
/// TODO: Consider removing this in a future release, as permissions works just fine now
|
/// TODO: Consider removing this in a future release, as permissions works just fine now
|
||||||
territoryProtectedMaterials.add(Material.BEACON);
|
territoryProtectedMaterials.add(Material.BEACON);
|
||||||
|
|
||||||
// Config is not loading if value is empty ???
|
// Config is not loading if value is empty ???
|
||||||
territoryBypassProtectedMaterials.add(Material.COOKIE);
|
territoryBypassProtectedMaterials.add(Material.COOKIE);
|
||||||
|
territoryBypassProtectedMaterials.add(Material.CHEST);
|
||||||
|
territoryBypassProtectedMaterials.add(Material.TRAPPED_CHEST);
|
||||||
|
|
||||||
|
|
||||||
territoryDenyUsageMaterials.add(XMaterial.FIRE_CHARGE.parseMaterial());
|
territoryDenyUsageMaterials.add(XMaterial.FIRE_CHARGE.parseMaterial());
|
||||||
territoryDenyUsageMaterials.add(Material.FLINT_AND_STEEL);
|
territoryDenyUsageMaterials.add(Material.FLINT_AND_STEEL);
|
||||||
@@ -428,11 +554,14 @@ public class Conf {
|
|||||||
safeZoneNerfedCreatureTypes.add(EntityType.ZOMBIE);
|
safeZoneNerfedCreatureTypes.add(EntityType.ZOMBIE);
|
||||||
|
|
||||||
// Is this called lazy load?
|
// Is this called lazy load?
|
||||||
defaultFactionPermissions.put("LEADER", new DefaultPermissions(true));
|
|
||||||
defaultFactionPermissions.put("COLEADER", new DefaultPermissions(true));
|
defaultFactionPermissions.put("COLEADER", new DefaultPermissions(true));
|
||||||
defaultFactionPermissions.put("MODERATOR", new DefaultPermissions(true));
|
defaultFactionPermissions.put("MODERATOR", new DefaultPermissions(true));
|
||||||
defaultFactionPermissions.put("NORMAL MEMBER", new DefaultPermissions(false));
|
defaultFactionPermissions.put("NORMAL MEMBER", new DefaultPermissions(false));
|
||||||
defaultFactionPermissions.put("RECRUIT", new DefaultPermissions(false));
|
defaultFactionPermissions.put("RECRUIT", new DefaultPermissions(false));
|
||||||
|
defaultFactionPermissions.put("ALLY", new DefaultPermissions(false));
|
||||||
|
defaultFactionPermissions.put("ENEMY", new DefaultPermissions(false));
|
||||||
|
defaultFactionPermissions.put("TRUCE", new DefaultPermissions(false));
|
||||||
|
defaultFactionPermissions.put("NEUTRAL", new DefaultPermissions(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void load() {
|
public static void load() {
|
||||||
@@ -443,6 +572,8 @@ public class Conf {
|
|||||||
FactionsPlugin.getInstance().persist.save(i);
|
FactionsPlugin.getInstance().persist.save(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void saveSync() { FactionsPlugin.instance.persist.saveSync(i); }
|
||||||
|
|
||||||
public enum Backend {
|
public enum Backend {
|
||||||
JSON,
|
JSON,
|
||||||
//MYSQL, TODO add MySQL storage
|
//MYSQL, TODO add MySQL storage
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ public class FLocation implements Serializable {
|
|||||||
String worldName = string.substring(start, index);
|
String worldName = string.substring(start, index);
|
||||||
start = index + 1;
|
start = index + 1;
|
||||||
index = string.indexOf(",", start);
|
index = string.indexOf(",", start);
|
||||||
int x = Integer.valueOf(string.substring(start, index));
|
int x = Integer.parseInt(string.substring(start, index));
|
||||||
int y = Integer.valueOf(string.substring(index + 1, string.length() - 1));
|
int y = Integer.parseInt(string.substring(index + 1, string.length() - 1));
|
||||||
return new FLocation(worldName, x, y);
|
return new FLocation(worldName, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.massivecraft.factions.struct.Relation;
|
|||||||
import com.massivecraft.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
import com.massivecraft.factions.util.WarmUpUtil;
|
import com.massivecraft.factions.util.WarmUpUtil;
|
||||||
import mkremins.fanciful.FancyMessage;
|
import mkremins.fanciful.FancyMessage;
|
||||||
|
import net.dv8tion.jda.core.entities.User;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -30,6 +31,59 @@ public interface FPlayer extends EconomyParticipator {
|
|||||||
|
|
||||||
boolean hasNotificationsEnabled();
|
boolean hasNotificationsEnabled();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set if the player is inside of their faction's chest
|
||||||
|
*/
|
||||||
|
void setInFactionsChest(boolean b);
|
||||||
|
|
||||||
boolean isAlt();
|
boolean isAlt();
|
||||||
|
|
||||||
void setAlt(boolean alt);
|
void setAlt(boolean alt);
|
||||||
@@ -207,7 +261,7 @@ public interface FPlayer extends EconomyParticipator {
|
|||||||
|
|
||||||
int getDeaths();
|
int getDeaths();
|
||||||
|
|
||||||
void takeMoney(int amt);
|
boolean takeMoney(int amt);
|
||||||
|
|
||||||
boolean hasMoney(int amt);
|
boolean hasMoney(int amt);
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,8 @@ import com.massivecraft.factions.cmd.FCommand;
|
|||||||
import com.massivecraft.factions.cmd.check.CheckTask;
|
import com.massivecraft.factions.cmd.check.CheckTask;
|
||||||
import com.massivecraft.factions.cmd.check.WeeWooTask;
|
import com.massivecraft.factions.cmd.check.WeeWooTask;
|
||||||
import com.massivecraft.factions.cmd.chest.AntiChestListener;
|
import com.massivecraft.factions.cmd.chest.AntiChestListener;
|
||||||
import com.massivecraft.factions.cmd.chest.ChestLogsHandler;
|
import com.massivecraft.factions.discord.Discord;
|
||||||
import com.massivecraft.factions.discord.DiscordListener;
|
import com.massivecraft.factions.discord.DiscordListener;
|
||||||
import com.massivecraft.factions.discord.FactionChatHandler;
|
|
||||||
import com.massivecraft.factions.integration.Econ;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
import com.massivecraft.factions.integration.Worldguard;
|
import com.massivecraft.factions.integration.Worldguard;
|
||||||
import com.massivecraft.factions.integration.dynmap.EngineDynmap;
|
import com.massivecraft.factions.integration.dynmap.EngineDynmap;
|
||||||
@@ -90,6 +89,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
private boolean mvdwPlaceholderAPIManager = false;
|
private boolean mvdwPlaceholderAPIManager = false;
|
||||||
private Listener[] eventsListener;
|
private Listener[] eventsListener;
|
||||||
public List<String> itemList = getConfig().getStringList("fchest.Items-Not-Allowed");
|
public List<String> itemList = getConfig().getStringList("fchest.Items-Not-Allowed");
|
||||||
|
private Worldguard wg;
|
||||||
|
|
||||||
|
|
||||||
public FactionsPlugin() {
|
public FactionsPlugin() {
|
||||||
@@ -185,17 +185,19 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
// Load Conf from disk
|
// Load Conf from disk
|
||||||
Conf.load();
|
Conf.load();
|
||||||
//Dependency checks
|
//Dependency checks
|
||||||
if (Conf.dependencyCheck && (Bukkit.getPluginManager().isPluginEnabled("Vault") && Bukkit.getPluginManager().isPluginEnabled("Essentials"))) {
|
if (Conf.dependencyCheck && (!Bukkit.getPluginManager().isPluginEnabled("Vault") && !Bukkit.getPluginManager().isPluginEnabled("Essentials"))) {
|
||||||
RegisteredServiceProvider<Economy> rsp = FactionsPlugin.this.getServer().getServicesManager().getRegistration(Economy.class);
|
|
||||||
FactionsPlugin.econ = rsp.getProvider();
|
|
||||||
} else if (Conf.dependencyCheck) {
|
|
||||||
divider();
|
divider();
|
||||||
System.out.println("You are missing dependencies!");
|
System.out.println("You are missing dependencies!");
|
||||||
System.out.println("Please verify EssentialsX and Vault are installed!");
|
System.out.println("Please verify EssentialsX and Vault are installed!");
|
||||||
|
Conf.save();
|
||||||
Bukkit.getPluginManager().disablePlugin(instance);
|
Bukkit.getPluginManager().disablePlugin(instance);
|
||||||
divider();
|
divider();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//Update their config if needed
|
||||||
|
// Updater.updateIfNeeded(getConfig());
|
||||||
|
RegisteredServiceProvider<Economy> rsp = FactionsPlugin.this.getServer().getServicesManager().getRegistration(Economy.class);
|
||||||
|
FactionsPlugin.econ = rsp.getProvider();
|
||||||
com.massivecraft.factions.integration.Essentials.setup();
|
com.massivecraft.factions.integration.Essentials.setup();
|
||||||
hookedPlayervaults = setupPlayervaults();
|
hookedPlayervaults = setupPlayervaults();
|
||||||
FPlayers.getInstance().load();
|
FPlayers.getInstance().load();
|
||||||
@@ -229,9 +231,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
Econ.setup();
|
Econ.setup();
|
||||||
setupPermissions();
|
setupPermissions();
|
||||||
|
|
||||||
if (Conf.worldGuardChecking || Conf.worldGuardBuildPriority) {
|
if (Conf.worldGuardChecking || Conf.worldGuardBuildPriority) wg = new Worldguard();
|
||||||
Worldguard.init(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
EngineDynmap.getInstance().init();
|
EngineDynmap.getInstance().init();
|
||||||
|
|
||||||
@@ -267,11 +267,8 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
this.getServer().getScheduler().runTaskTimer(this, CheckTask::cleanupTask, 0L, 1200L);
|
this.getServer().getScheduler().runTaskTimer(this, CheckTask::cleanupTask, 0L, 1200L);
|
||||||
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new WeeWooTask(this), 600L, 600L);
|
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new WeeWooTask(this), 600L, 600L);
|
||||||
}
|
}
|
||||||
if(Conf.useDiscordSystem && !Conf.discordBotToken.equals("<token here>")) {
|
//Setup Discord Bot
|
||||||
new FactionChatHandler(this);
|
new Discord(this);
|
||||||
} else {
|
|
||||||
System.out.println("\n\n\n SABER-FACTIONS-DISCORD-INTEGRATION - You are not using Discord integration features, set conf.json option useDiscordSystem to true and put a valid token in before using!\n\n\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
ShopConfig.setup();
|
ShopConfig.setup();
|
||||||
|
|
||||||
@@ -286,8 +283,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
new FUpgradesGUI(),
|
new FUpgradesGUI(),
|
||||||
new UpgradesListener(),
|
new UpgradesListener(),
|
||||||
new MissionHandler(this),
|
new MissionHandler(this),
|
||||||
new AntiChestListener(),
|
new AntiChestListener()
|
||||||
new ChestLogsHandler()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (Listener eventListener : eventsListener)
|
for (Listener eventListener : eventsListener)
|
||||||
@@ -416,7 +412,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
.registerTypeAdapterFactory(EnumTypeAdapter.ENUM_FACTORY);
|
.registerTypeAdapterFactory(EnumTypeAdapter.ENUM_FACTORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void divider() {
|
public void divider() {
|
||||||
System.out.println(" .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-");
|
System.out.println(" .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-");
|
||||||
System.out.println(" / / \\ \\ / / \\ \\ / / \\ \\ / / \\ \\ / / \\ \\ / / \\ \\ / / \\ \\ / / \\");
|
System.out.println(" / / \\ \\ / / \\ \\ / / \\ \\ / / \\ \\ / / \\ \\ / / \\ \\ / / \\ \\ / / \\");
|
||||||
System.out.println("`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-'");
|
System.out.println("`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-'");
|
||||||
@@ -426,9 +422,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
// only save data if plugin actually completely loaded successfully
|
// only save data if plugin actually completely loaded successfully
|
||||||
if (this.loadSuccessful) {
|
if (this.loadSuccessful) {
|
||||||
// Dont save, as this is kind of pointless, as the /f config command manually saves.
|
Conf.saveSync();
|
||||||
// So any edits done are saved, this way manual edits to json can go through.
|
|
||||||
// Conf.save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AutoLeaveTask != null) {
|
if (AutoLeaveTask != null) {
|
||||||
@@ -740,4 +734,8 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
public void debug(String s) {
|
public void debug(String s) {
|
||||||
debug(Level.INFO, s);
|
debug(Level.INFO, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Worldguard getWg() {
|
||||||
|
return wg;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class BrigadierManager {
|
public class BrigadierManager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public Commodore commodore;
|
public Commodore commodore;
|
||||||
public LiteralArgumentBuilder<Object> brigadier = LiteralArgumentBuilder.literal("factions");
|
public LiteralArgumentBuilder<Object> brigadier = LiteralArgumentBuilder.literal("factions");
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ import com.mojang.brigadier.builder.ArgumentBuilder;
|
|||||||
|
|
||||||
public interface BrigadierProvider {
|
public interface BrigadierProvider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
ArgumentBuilder<Object, ?> get(ArgumentBuilder<Object, ?> parent);
|
ArgumentBuilder<Object, ?> get(ArgumentBuilder<Object, ?> parent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import org.bukkit.event.player.PlayerTeleportEvent;
|
|||||||
|
|
||||||
public class CmdAHome extends FCommand {
|
public class CmdAHome extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdAHome() {
|
public CmdAHome() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("ahome");
|
this.aliases.add("ahome");
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.FPlayers;
|
import com.massivecraft.factions.FPlayers;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import com.massivecraft.factions.event.FPlayerJoinEvent;
|
import com.massivecraft.factions.event.FPlayerJoinEvent;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
@@ -11,6 +12,10 @@ import org.bukkit.Bukkit;
|
|||||||
|
|
||||||
public class CmdAdmin extends FCommand {
|
public class CmdAdmin extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdAdmin() {
|
public CmdAdmin() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("admin");
|
this.aliases.add("admin");
|
||||||
@@ -25,59 +30,67 @@ public class CmdAdmin extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
// Allows admins bypass this.
|
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
||||||
if (!context.fPlayer.isAdminBypassing() && !context.fPlayer.getRole().equals(Role.LEADER)) {
|
if (context.player == null) {
|
||||||
context.msg(TL.COMMAND_ADMIN_NOTADMIN);
|
context.msg(TL.GENERIC_PLAYERONLY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FPlayer fyou = context.argAsBestFPlayerMatch(0);
|
// Allows admins bypass this.
|
||||||
if (fyou == null) {
|
if (!context.fPlayer.isAdminBypassing() && !context.fPlayer.getRole().equals(Role.LEADER)) {
|
||||||
return;
|
context.msg(TL.COMMAND_ADMIN_NOTADMIN);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
boolean permAny = Permission.ADMIN_ANY.has(context.sender, false);
|
FPlayer fyou = context.argAsBestFPlayerMatch(0);
|
||||||
Faction targetFaction = fyou.getFaction();
|
if (fyou == null) {
|
||||||
|
|
||||||
if (targetFaction != context.faction && !permAny) {
|
|
||||||
context.msg(TL.COMMAND_ADMIN_NOTMEMBER, fyou.describeTo(context.fPlayer, true));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fyou == context.fPlayer && !permAny) {
|
|
||||||
context.msg(TL.COMMAND_ADMIN_TARGETSELF);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// only perform a FPlayerJoinEvent when newLeader isn't actually in the faction
|
|
||||||
if (fyou.getFaction() != targetFaction) {
|
|
||||||
FPlayerJoinEvent event = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(context.player), targetFaction, FPlayerJoinEvent.PlayerJoinReason.LEADER);
|
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
FPlayer admin = targetFaction.getFPlayerAdmin();
|
boolean permAny = Permission.ADMIN_ANY.has(context.sender, false);
|
||||||
|
Faction targetFaction = fyou.getFaction();
|
||||||
|
|
||||||
// if target player is currently admin, demote and replace him
|
if (targetFaction != context.faction && !permAny) {
|
||||||
if (fyou == admin) {
|
context.msg(TL.COMMAND_ADMIN_NOTMEMBER, fyou.describeTo(context.fPlayer, true));
|
||||||
targetFaction.promoteNewLeader();
|
return;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// promote target player, and demote existing admin if one exists
|
if (fyou == context.fPlayer && !permAny) {
|
||||||
if (admin != null) {
|
context.msg(TL.COMMAND_ADMIN_TARGETSELF);
|
||||||
admin.setRole(Role.COLEADER);
|
return;
|
||||||
}
|
}
|
||||||
fyou.setRole(Role.LEADER);
|
|
||||||
context.msg(TL.COMMAND_ADMIN_PROMOTES, fyou.describeTo(context.fPlayer, true));
|
|
||||||
|
|
||||||
// Inform all players
|
// only perform a FPlayerJoinEvent when newLeader isn't actually in the faction
|
||||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
if (fyou.getFaction() != targetFaction) {
|
||||||
fplayer.msg(TL.COMMAND_ADMIN_PROMOTED, context.player == null ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(fplayer, true), fyou.describeTo(fplayer), targetFaction.describeTo(fplayer));
|
FPlayerJoinEvent event = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(context.player), targetFaction, FPlayerJoinEvent.PlayerJoinReason.LEADER);
|
||||||
}
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FPlayer admin = targetFaction.getFPlayerAdmin();
|
||||||
|
|
||||||
|
// if target player is currently admin, demote and replace him
|
||||||
|
if (fyou == admin) {
|
||||||
|
targetFaction.promoteNewLeader();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// promote target player, and demote existing admin if one exists
|
||||||
|
if (admin != null) {
|
||||||
|
admin.setRole(Role.COLEADER);
|
||||||
|
}
|
||||||
|
fyou.setRole(Role.LEADER);
|
||||||
|
context.msg(TL.COMMAND_ADMIN_PROMOTES, fyou.describeTo(context.fPlayer, true));
|
||||||
|
|
||||||
|
// Inform all players
|
||||||
|
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||||
|
fplayer.msg(TL.COMMAND_ADMIN_PROMOTED,
|
||||||
|
context.player == null ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(fplayer, true),
|
||||||
|
fyou.describeTo(fplayer), targetFaction.describeTo(fplayer));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public TL getUsageTranslation() {
|
public TL getUsageTranslation() {
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class CmdAnnounce extends FCommand {
|
public class CmdAnnounce extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdAnnounce() {
|
public CmdAnnounce() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("ann");
|
this.aliases.add("ann");
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public class CmdAutoHelp extends FCommand {
|
public class CmdAutoHelp extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdAutoHelp() {
|
public CmdAutoHelp() {
|
||||||
this.aliases.add("?");
|
this.aliases.add("?");
|
||||||
this.aliases.add("h");
|
this.aliases.add("h");
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
public class CmdBan extends FCommand {
|
public class CmdBan extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdBan() {
|
public CmdBan() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("ban");
|
this.aliases.add("ban");
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ import java.util.List;
|
|||||||
|
|
||||||
public class CmdBanlist extends FCommand {
|
public class CmdBanlist extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdBanlist() {
|
public CmdBanlist() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("banlist");
|
this.aliases.add("banlist");
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ import org.bukkit.inventory.PlayerInventory;
|
|||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
public class CmdBanner extends FCommand {
|
public class CmdBanner extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Illyria Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdBanner() {
|
public CmdBanner() {
|
||||||
this.aliases.add("banner");
|
this.aliases.add("banner");
|
||||||
this.aliases.add("warbanner");
|
this.aliases.add("warbanner");
|
||||||
@@ -29,12 +34,10 @@ public class CmdBanner extends FCommand {
|
|||||||
context.msg(TL.COMMAND_BANNER_NOBANNER);
|
context.msg(TL.COMMAND_BANNER_NOBANNER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!context.fPlayer.hasMoney(FactionsPlugin.getInstance().getConfig().getInt("fbanners.Banner-Cost", 5000))) {
|
if (!context.fPlayer.takeMoney(FactionsPlugin.getInstance().getConfig().getInt("fbanners.Banner-Cost", 5000))) {
|
||||||
context.msg(TL.COMMAND_BANNER_NOTENOUGHMONEY);
|
context.msg(TL.COMMAND_BANNER_NOTENOUGHMONEY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.takeMoney(context.fPlayer, FactionsPlugin.getInstance().getConfig().getInt("fbanners.Banner-Cost", 5000));
|
|
||||||
this.takeMoney(context.fPlayer, FactionsPlugin.getInstance().getConfig().getInt("fbanners.Banner-Cost", 5000));
|
|
||||||
ItemStack warBanner = context.fPlayer.getFaction().getBanner();
|
ItemStack warBanner = context.fPlayer.getFaction().getBanner();
|
||||||
ItemMeta warmeta = warBanner.getItemMeta();
|
ItemMeta warmeta = warBanner.getItemMeta();
|
||||||
warmeta.setDisplayName(FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fbanners.Item.Name")));
|
warmeta.setDisplayName(FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fbanners.Item.Name")));
|
||||||
@@ -44,7 +47,7 @@ public class CmdBanner extends FCommand {
|
|||||||
warBanner.setAmount(1);
|
warBanner.setAmount(1);
|
||||||
context.player.getInventory().addItem(warBanner);
|
context.player.getInventory().addItem(warBanner);
|
||||||
}
|
}
|
||||||
|
@Deprecated
|
||||||
public boolean hasMoney(FPlayer fme, int amt) {
|
public boolean hasMoney(FPlayer fme, int amt) {
|
||||||
Economy econ = FactionsPlugin.getInstance().getEcon();
|
Economy econ = FactionsPlugin.getInstance().getEcon();
|
||||||
if (econ.getBalance(fme.getPlayer()) >= amt) {
|
if (econ.getBalance(fme.getPlayer()) >= amt) {
|
||||||
@@ -53,11 +56,10 @@ public class CmdBanner extends FCommand {
|
|||||||
fme.msg(TL.COMMAND_BANNER_NOTENOUGHMONEY);
|
fme.msg(TL.COMMAND_BANNER_NOTENOUGHMONEY);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@Deprecated
|
||||||
public void takeMoney(FPlayer fme, int amt) {
|
public void takeMoney(FPlayer fme, int amt) {
|
||||||
if (this.hasMoney(fme, amt)) {
|
if (this.hasMoney(fme, amt)) {
|
||||||
Economy econ = FactionsPlugin.getInstance().getEcon();
|
Economy econ = FactionsPlugin.getInstance().getEcon();
|
||||||
econ.withdrawPlayer(fme.getPlayer(), (double) amt);
|
|
||||||
fme.sendMessage(TL.COMMAND_BANNER_MONEYTAKE.toString().replace("{amount}", amt + ""));
|
fme.sendMessage(TL.COMMAND_BANNER_MONEYTAKE.toString().replace("{amount}", amt + ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdBoom extends FCommand {
|
public class CmdBoom extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdBoom() {
|
public CmdBoom() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("noboom");
|
this.aliases.add("noboom");
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdBypass extends FCommand {
|
public class CmdBypass extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdBypass() {
|
public CmdBypass() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("bypass");
|
this.aliases.add("bypass");
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
|||||||
|
|
||||||
public class CmdChat extends FCommand {
|
public class CmdChat extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdChat() {
|
public CmdChat() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("c");
|
this.aliases.add("c");
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdChatSpy extends FCommand {
|
public class CmdChatSpy extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdChatSpy() {
|
public CmdChatSpy() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("chatspy");
|
this.aliases.add("chatspy");
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ import com.massivecraft.factions.util.WarmUpUtil;
|
|||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
public class CmdCheckpoint extends FCommand {
|
public class CmdCheckpoint extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Illyria Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdCheckpoint() {
|
public CmdCheckpoint() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("checkp");
|
this.aliases.add("checkp");
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ import mkremins.fanciful.FancyMessage;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
public class CmdColeader extends FCommand {
|
public class CmdColeader extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdColeader() {
|
public CmdColeader() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("co");
|
this.aliases.add("co");
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ import org.bukkit.command.ConsoleCommandSender;
|
|||||||
|
|
||||||
public class CmdConvert extends FCommand {
|
public class CmdConvert extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdConvert() {
|
public CmdConvert() {
|
||||||
this.aliases.add("convert");
|
this.aliases.add("convert");
|
||||||
this.requiredArgs.add("[MYSQL|JSON]");
|
this.requiredArgs.add("[MYSQL|JSON]");
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ import org.bukkit.Location;
|
|||||||
|
|
||||||
public class CmdCoords extends FCommand {
|
public class CmdCoords extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Illyria Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdCoords() {
|
public CmdCoords() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("coords");
|
this.aliases.add("coords");
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
import com.massivecraft.factions.*;
|
import com.massivecraft.factions.*;
|
||||||
|
import com.massivecraft.factions.discord.Discord;
|
||||||
import com.massivecraft.factions.event.FPlayerJoinEvent;
|
import com.massivecraft.factions.event.FPlayerJoinEvent;
|
||||||
import com.massivecraft.factions.event.FactionCreateEvent;
|
import com.massivecraft.factions.event.FactionCreateEvent;
|
||||||
import com.massivecraft.factions.integration.Econ;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
@@ -8,13 +9,20 @@ import com.massivecraft.factions.struct.Permission;
|
|||||||
import com.massivecraft.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
import com.massivecraft.factions.util.MiscUtil;
|
import com.massivecraft.factions.util.MiscUtil;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
import net.dv8tion.jda.core.entities.Member;
|
||||||
|
import net.dv8tion.jda.core.exceptions.HierarchyException;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|
||||||
public class CmdCreate extends FCommand {
|
public class CmdCreate extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdCreate() {
|
public CmdCreate() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("create");
|
this.aliases.add("create");
|
||||||
@@ -28,6 +36,10 @@ public class CmdCreate extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
|
if (Conf.restrictActionsWhenNotLinked && !context.fPlayer.discordSetup()) {
|
||||||
|
context.player.sendMessage(ChatColor.translateAlternateColorCodes('&', TL.DISCORD_LINK_REQUIRED.toString()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
String tag = context.argAsString(0);
|
String tag = context.argAsString(0);
|
||||||
|
|
||||||
if (context.fPlayer.hasFaction()) {
|
if (context.fPlayer.hasFaction()) {
|
||||||
@@ -78,7 +90,6 @@ public class CmdCreate extends FCommand {
|
|||||||
FPlayerJoinEvent joinEvent = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(context.player), faction, FPlayerJoinEvent.PlayerJoinReason.CREATE);
|
FPlayerJoinEvent joinEvent = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(context.player), faction, FPlayerJoinEvent.PlayerJoinReason.CREATE);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(joinEvent);
|
Bukkit.getServer().getPluginManager().callEvent(joinEvent);
|
||||||
// join event cannot be cancelled or you'll have an empty faction
|
// join event cannot be cancelled or you'll have an empty faction
|
||||||
|
|
||||||
// finish setting up the FPlayer
|
// finish setting up the FPlayer
|
||||||
context.fPlayer.setFaction(faction, false);
|
context.fPlayer.setFaction(faction, false);
|
||||||
// We should consider adding the role just AFTER joining the faction.
|
// We should consider adding the role just AFTER joining the faction.
|
||||||
@@ -90,6 +101,22 @@ public class CmdCreate extends FCommand {
|
|||||||
follower.msg(TL.COMMAND_CREATE_CREATED, context.fPlayer.getName(), faction.getTag(follower));
|
follower.msg(TL.COMMAND_CREATE_CREATED, context.fPlayer.getName(), faction.getTag(follower));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Discord
|
||||||
|
try {
|
||||||
|
if (Discord.useDiscord && context.fPlayer.discordSetup() && Discord.isInMainGuild(context.fPlayer.discordUser()) && Discord.mainGuild != null) {
|
||||||
|
Member m = Discord.mainGuild.getMember(context.fPlayer.discordUser());
|
||||||
|
if (Conf.factionRoles) {
|
||||||
|
Discord.mainGuild.getController().addSingleRoleToMember(m, Discord.createFactionRole(faction.getTag())).queue();
|
||||||
|
}
|
||||||
|
if (Conf.leaderRoles && Discord.leader != null) {
|
||||||
|
Discord.mainGuild.getController().addSingleRoleToMember(m, Discord.leader).queue();
|
||||||
|
}
|
||||||
|
if (Conf.factionDiscordTags) {
|
||||||
|
Discord.mainGuild.getController().setNickname(m, Discord.getNicknameString(context.fPlayer)).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (HierarchyException e) {System.out.print(e.getMessage());}
|
||||||
|
//End Discord
|
||||||
context.msg(TL.COMMAND_CREATE_YOUSHOULD, FactionsPlugin.getInstance().cmdBase.cmdDescription.getUsageTemplate(context));
|
context.msg(TL.COMMAND_CREATE_YOUSHOULD, FactionsPlugin.getInstance().cmdBase.cmdDescription.getUsageTemplate(context));
|
||||||
if (Conf.econEnabled) Econ.setBalance(faction.getAccountId(), Conf.econFactionStartingBalance);
|
if (Conf.econEnabled) Econ.setBalance(faction.getAccountId(), Conf.econFactionStartingBalance);
|
||||||
if (Conf.logFactionCreate)
|
if (Conf.logFactionCreate)
|
||||||
|
|||||||
66
src/main/java/com/massivecraft/factions/cmd/CmdDebug.java
Normal file
66
src/main/java/com/massivecraft/factions/cmd/CmdDebug.java
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
|
import com.massivecraft.factions.discord.Discord;
|
||||||
|
import com.massivecraft.factions.discord.DiscordSetupAttempt;
|
||||||
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
public class CmdDebug extends FCommand {
|
||||||
|
public CmdDebug() {
|
||||||
|
super();
|
||||||
|
this.aliases.add("debug");
|
||||||
|
this.requirements = new CommandRequirements.Builder(Permission.DEBUG).build();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void perform(CommandContext context) {
|
||||||
|
FactionsPlugin.getInstance().divider();
|
||||||
|
System.out.print("----------Debug Info----------");
|
||||||
|
System.out.print("-------Main-------");
|
||||||
|
System.out.print("Server Version: " + FactionsPlugin.getInstance().getServer().getVersion());
|
||||||
|
System.out.print("Server Bukkit Version: " + FactionsPlugin.getInstance().getServer().getBukkitVersion());
|
||||||
|
System.out.print("SaberFactions Version: " + FactionsPlugin.getInstance().getDescription().getVersion());
|
||||||
|
System.out.print("Is Beta Version: " + (FactionsPlugin.getInstance().getDescription().getFullName().contains("BETA") ? "True" : "False"));
|
||||||
|
System.out.print("Players Online: " + Bukkit.getOnlinePlayers().size());
|
||||||
|
System.out.print("------Command------");
|
||||||
|
System.out.print("Discord Commands: " + FCmdRoot.instance.discordEnabled);
|
||||||
|
System.out.print("Check/WeeWoo Commands: " + FCmdRoot.instance.checkEnabled);
|
||||||
|
System.out.print("Mission Command: " + FCmdRoot.instance.missionsEnabled);
|
||||||
|
System.out.print("Shop Command: " + FCmdRoot.instance.fShopEnabled);
|
||||||
|
System.out.print("Inventory See Command: " + FCmdRoot.instance.invSeeEnabled);
|
||||||
|
System.out.print("Points Command: " + FCmdRoot.instance.fPointsEnabled);
|
||||||
|
System.out.print("Alts Command: " + FCmdRoot.instance.fAltsEnabled);
|
||||||
|
System.out.print("Grace Command: " + FCmdRoot.instance.fGraceEnabled);
|
||||||
|
System.out.print("Focus Command: " + FCmdRoot.instance.fFocusEnabled);
|
||||||
|
System.out.print("Fly Command: " + FCmdRoot.instance.fFlyEnabled);
|
||||||
|
System.out.print("PayPal Commands: " + FCmdRoot.instance.fPayPalEnabled);
|
||||||
|
System.out.print("Inspect Command: " + FCmdRoot.instance.coreProtectEnabled);
|
||||||
|
System.out.print("Internal FTOP Command: " + FCmdRoot.instance.internalFTOPEnabled);
|
||||||
|
System.out.print("----End Command----");
|
||||||
|
System.out.print("-----End Main-----");
|
||||||
|
System.out.print("------Discord------");
|
||||||
|
System.out.print("Discord Integration enabled in config: " + Discord.confUseDiscord);
|
||||||
|
System.out.print("Discord Integration enabled: " + Discord.useDiscord);
|
||||||
|
System.out.print("Setup attempts: " + Discord.setupLog.size());
|
||||||
|
System.out.print("FPlayers waiting to link: " + Discord.waitingLink.size());
|
||||||
|
System.out.print("Bot Token: " + (Discord.botToken == "<token here>" ? "Not Set" : "Set"));
|
||||||
|
System.out.print("JDA Null: " + (Discord.jda == null ? "True" : "False"));
|
||||||
|
System.out.print("Main Guild ID: " + Discord.mainGuildID);
|
||||||
|
System.out.print("Main Guild Null: " + (Discord.mainGuild == null ? "True" : "False"));
|
||||||
|
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());}
|
||||||
|
System.out.print("End Attempt Log");
|
||||||
|
System.out.print("----End Discord----");
|
||||||
|
System.out.print("--------End Debug Info--------");
|
||||||
|
FactionsPlugin.getInstance().divider();
|
||||||
|
context.fPlayer.msg(TL.COMMAND_DEBUG_PRINTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TL getUsageTranslation() {
|
||||||
|
return TL.COMMAND_DEBUG_DESCRIPTION;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,10 @@ import org.bukkit.ChatColor;
|
|||||||
|
|
||||||
public class CmdDeinvite extends FCommand {
|
public class CmdDeinvite extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdDeinvite() {
|
public CmdDeinvite() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("deinvite");
|
this.aliases.add("deinvite");
|
||||||
@@ -28,51 +32,47 @@ public class CmdDeinvite extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
|
if (context.args.size() == 0) {
|
||||||
// Check if arg 0 == null do you don't have
|
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
||||||
// `No player "null" could be found.` message.
|
for (String id : context.faction.getInvites()) {
|
||||||
if (context.args.get(0) == null) {
|
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
String name = fp != null ? fp.getName() : id;
|
||||||
for (String id : context.faction.getInvites()) {
|
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
}
|
||||||
String name = fp != null ? fp.getName() : id;
|
context.sendFancyMessage(msg);
|
||||||
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (you == null) {
|
FPlayer you = context.argAsBestFPlayerMatch(0);
|
||||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
if (!context.fPlayer.isAdminBypassing()) {
|
||||||
for (String id : context.faction.getInvites()) {
|
Access access = context.faction.getAccess(context.fPlayer, PermissableAction.INVITE);
|
||||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
if (access != Access.ALLOW && context.fPlayer.getRole() != Role.LEADER) {
|
||||||
String name = fp != null ? fp.getName() : id;
|
context.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
|
||||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
context.sendFancyMessage(msg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (you.getFaction() == context.faction) {
|
if (you == null) {
|
||||||
context.msg(TL.COMMAND_DEINVITE_ALREADYMEMBER, you.getName(), context.faction.getTag());
|
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
||||||
context.msg(TL.COMMAND_DEINVITE_MIGHTWANT, FactionsPlugin.getInstance().cmdBase.cmdKick.getUsageTemplate(context));
|
for (String id : context.faction.getInvites()) {
|
||||||
return;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
context.faction.deinvite(you);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
you.msg(TL.COMMAND_DEINVITE_REVOKED, context.fPlayer.describeTo(you), context.faction.describeTo(you));
|
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.msg(TL.COMMAND_DEINVITE_REVOKES, context.fPlayer.describeTo(context.faction), you.describeTo(context.faction));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdDelFWarp extends FCommand {
|
public class CmdDelFWarp extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdDelFWarp() {
|
public CmdDelFWarp() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("delwarp");
|
this.aliases.add("delwarp");
|
||||||
|
|||||||
@@ -3,12 +3,17 @@ package com.massivecraft.factions.cmd;
|
|||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.FPlayers;
|
import com.massivecraft.factions.FPlayers;
|
||||||
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
import com.massivecraft.factions.zcore.util.TextUtil;
|
||||||
|
|
||||||
public class CmdDescription extends FCommand {
|
public class CmdDescription extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdDescription() {
|
public CmdDescription() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("desc");
|
this.aliases.add("desc");
|
||||||
@@ -25,26 +30,28 @@ public class CmdDescription extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
||||||
if (!context.payForCommand(Conf.econCostDesc, TL.COMMAND_DESCRIPTION_TOCHANGE, TL.COMMAND_DESCRIPTION_FORCHANGE)) {
|
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||||
return;
|
if (!context.payForCommand(Conf.econCostDesc, TL.COMMAND_DESCRIPTION_TOCHANGE, TL.COMMAND_DESCRIPTION_FORCHANGE)) {
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// since "&" color tags seem to work even through plain old FPlayer.sendMessage() for some reason, we need to break those up
|
// since "&" color tags seem to work even through plain old FPlayer.sendMessage() for some reason, we need to break those up
|
||||||
// And replace all the % because it messes with string formatting and this is easy way around that.
|
// And replace all the % because it messes with string formatting and this is easy way around that.
|
||||||
context.faction.setDescription(TextUtil.implode(context.args, " ").replaceAll("%", "").replaceAll("(&([a-f0-9klmnor]))", "& $2"));
|
context.faction.setDescription(TextUtil.implode(context.args, " ").replaceAll("%", "").replaceAll("(&([a-f0-9klmnor]))", "& $2"));
|
||||||
|
|
||||||
if (!Conf.broadcastDescriptionChanges) {
|
if (!Conf.broadcastDescriptionChanges) {
|
||||||
context.msg(TL.COMMAND_DESCRIPTION_CHANGED, context.faction.describeTo(context.fPlayer));
|
context.msg(TL.COMMAND_DESCRIPTION_CHANGED, context.faction.describeTo(context.fPlayer));
|
||||||
context.sendMessage(context.faction.getDescription());
|
context.sendMessage(context.faction.getDescription());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Broadcast the description to everyone
|
// Broadcast the description to everyone
|
||||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||||
fplayer.msg(TL.COMMAND_DESCRIPTION_CHANGES, context.faction.describeTo(fplayer));
|
fplayer.msg(TL.COMMAND_DESCRIPTION_CHANGES, context.faction.describeTo(fplayer));
|
||||||
fplayer.sendMessage(context.faction.getDescription()); // players can inject "&" or "`" or "<i>" or whatever in their description; &k is particularly interesting looking
|
fplayer.sendMessage(context.faction.getDescription()); // players can inject "&" or "`" or "<i>" or whatever in their description; &k is particularly interesting looking
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
public class CmdDisband extends FCommand {
|
public class CmdDisband extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
private static HashMap<String, String> disbandMap = new HashMap<>();
|
private static HashMap<String, String> disbandMap = new HashMap<>();
|
||||||
|
|
||||||
@@ -78,18 +82,23 @@ public class CmdDisband extends FCommand {
|
|||||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("faction-disband-broadcast", true)) {
|
if (FactionsPlugin.getInstance().getConfig().getBoolean("faction-disband-broadcast", true)) {
|
||||||
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
|
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
|
||||||
String amountString = context.sender instanceof ConsoleCommandSender ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(follower);
|
String amountString = context.sender instanceof ConsoleCommandSender ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(follower);
|
||||||
UtilFly.checkFly(context.fPlayer, Board.getInstance().getFactionAt(new FLocation(follower)));
|
|
||||||
if (follower.getFaction() == faction) {
|
if (follower.getFaction() == faction) {
|
||||||
follower.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, amountString);
|
follower.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, amountString);
|
||||||
|
if (!follower.canFlyAtLocation()) {
|
||||||
|
follower.setFFlying(false, false);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
follower.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, amountString, faction.getTag(follower));
|
follower.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, amountString, faction.getTag(follower));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
faction.disband(context.player, PlayerDisbandReason.COMMAND);
|
context.fPlayer.setFFlying(false, false);
|
||||||
} else {
|
} else {
|
||||||
faction.disband(context.player, PlayerDisbandReason.COMMAND);
|
|
||||||
context.player.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
|
context.player.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
|
||||||
}
|
}
|
||||||
|
faction.disband(context.player, PlayerDisbandReason.COMMAND);
|
||||||
|
if (!context.fPlayer.canFlyAtLocation()) {
|
||||||
|
context.fPlayer.setFFlying(false, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
40
src/main/java/com/massivecraft/factions/cmd/CmdDiscord.java
Normal file
40
src/main/java/com/massivecraft/factions/cmd/CmdDiscord.java
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.discord.Discord;
|
||||||
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class CmdDiscord extends FCommand {
|
||||||
|
public CmdDiscord() {
|
||||||
|
super();
|
||||||
|
this.aliases.add("discord");
|
||||||
|
this.requirements = new CommandRequirements.Builder(Permission.DISCORD)
|
||||||
|
.playerOnly()
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void perform(CommandContext context) {
|
||||||
|
if (context.fPlayer.discordSetup()) {
|
||||||
|
context.fPlayer.msg(TL.DISCORD_ALREADY_LINKED, context.fPlayer.discordUser().getName());
|
||||||
|
} else {
|
||||||
|
if (Discord.waitingLink.containsValue(context.fPlayer)) {
|
||||||
|
context.fPlayer.msg(TL.DISCORD_CODE_SENT, Discord.waitingLinkk.get(context.fPlayer), Discord.mainGuild.getSelfMember().getEffectiveName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Integer random = new Random().nextInt(9999);
|
||||||
|
while (Discord.waitingLink.containsValue(random)) {
|
||||||
|
random = new Random().nextInt(9999);
|
||||||
|
}
|
||||||
|
Discord.waitingLink.put(random, context.fPlayer);
|
||||||
|
Discord.waitingLinkk.put(context.fPlayer, random);
|
||||||
|
context.fPlayer.msg(TL.DISCORD_CODE_SENT, String.valueOf(random));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TL getUsageTranslation() {
|
||||||
|
return TL.COMMAND_DISCORD_DESCRIPTION;
|
||||||
|
}
|
||||||
|
}
|
||||||
64
src/main/java/com/massivecraft/factions/cmd/CmdDrain.java
Normal file
64
src/main/java/com/massivecraft/factions/cmd/CmdDrain.java
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
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.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");
|
||||||
|
this.requirements = new CommandRequirements.Builder(Permission.DRAIN)
|
||||||
|
.playerOnly()
|
||||||
|
.memberOnly()
|
||||||
|
.withAction(PermissableAction.DRAIN)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void perform(CommandContext context) {
|
||||||
|
if (!Conf.factionsDrainEnabled) {
|
||||||
|
context.fPlayer.msg(TL.GENERIC_DISABLED, "Factions Drain");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
double totalBalance = 0;
|
||||||
|
|
||||||
|
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)){
|
||||||
|
continue; // skip the command executor
|
||||||
|
}
|
||||||
|
double balance = FactionsPlugin.getInstance().getEcon().getBalance(fPlayer.getPlayer());
|
||||||
|
if (balance > 0) {
|
||||||
|
FactionsPlugin.getInstance().getEcon().depositPlayer(context.player, balance);
|
||||||
|
FactionsPlugin.getInstance().getEcon().withdrawPlayer(fPlayer.getPlayer(), balance);
|
||||||
|
totalBalance = (totalBalance + balance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
context.fPlayer.msg(TL.COMMAND_DRAIN_RECIEVED_AMOUNT, commas(totalBalance));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String commas(final double amount) {
|
||||||
|
final DecimalFormat formatter = new DecimalFormat("#,###.00");
|
||||||
|
return formatter.format(amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TL getUsageTranslation() {
|
||||||
|
return TL.COMMAND_DRAIN_DESCRIPTION;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,10 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class CmdFGlobal extends FCommand {
|
public class CmdFGlobal extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Trent
|
||||||
|
*/
|
||||||
|
|
||||||
public static List<UUID> toggled = new ArrayList<>();
|
public static List<UUID> toggled = new ArrayList<>();
|
||||||
|
|
||||||
public CmdFGlobal() {
|
public CmdFGlobal() {
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class CmdFWarp extends FCommand {
|
public class CmdFWarp extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdFWarp() {
|
public CmdFWarp() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("warp");
|
this.aliases.add("warp");
|
||||||
|
|||||||
@@ -19,9 +19,13 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
public class CmdFly extends FCommand {
|
public class CmdFly extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public static ConcurrentHashMap<String, Boolean> flyMap = new ConcurrentHashMap<String, Boolean>();
|
|
||||||
public static int id = -1;
|
public static ConcurrentHashMap<String, Boolean> flyMap = new ConcurrentHashMap<>();
|
||||||
|
public static BukkitTask particleTask = null;
|
||||||
public static BukkitTask flyTask = null;
|
public static BukkitTask flyTask = null;
|
||||||
|
|
||||||
|
|
||||||
@@ -38,7 +42,7 @@ public class CmdFly extends FCommand {
|
|||||||
|
|
||||||
public static void startParticles() {
|
public static void startParticles() {
|
||||||
|
|
||||||
id = Bukkit.getScheduler().scheduleSyncRepeatingTask(FactionsPlugin.getInstance(), () -> {
|
particleTask = Bukkit.getScheduler().runTaskTimerAsynchronously(FactionsPlugin.instance, () -> {
|
||||||
for (String name : flyMap.keySet()) {
|
for (String name : flyMap.keySet()) {
|
||||||
Player player = Bukkit.getPlayer(name);
|
Player player = Bukkit.getPlayer(name);
|
||||||
if (player == null) continue;
|
if (player == null) continue;
|
||||||
@@ -49,11 +53,10 @@ public class CmdFly extends FCommand {
|
|||||||
|
|
||||||
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
|
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
|
||||||
fplayer.isVanished();
|
fplayer.isVanished();
|
||||||
|
|
||||||
}
|
}
|
||||||
if (flyMap.keySet().size() == 0) {
|
if (flyMap.isEmpty()) {
|
||||||
Bukkit.getScheduler().cancelTask(id);
|
particleTask.cancel();
|
||||||
id = -1;
|
particleTask = null;
|
||||||
}
|
}
|
||||||
}, 10L, 3L);
|
}, 10L, 3L);
|
||||||
}
|
}
|
||||||
@@ -98,6 +101,9 @@ public class CmdFly extends FCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean checkBypassPerms(FPlayer fme, Player me, Faction toFac) {
|
public static boolean checkBypassPerms(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 (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()) {
|
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));
|
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||||
@@ -117,7 +123,7 @@ public class CmdFly extends FCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(me.hasPermission(Permission.FLY_NEUTRAL.node) || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.NEUTRAL && !isSystemFaction(toFac)) {
|
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));
|
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -126,11 +132,6 @@ public class CmdFly extends FCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean isSystemFaction(Faction faction) {
|
|
||||||
return faction.isSafeZone() ||
|
|
||||||
faction.isWarZone() ||
|
|
||||||
faction.isWilderness();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void checkTaskState() {
|
public static void checkTaskState() {
|
||||||
if (flyMap.isEmpty()) {
|
if (flyMap.isEmpty()) {
|
||||||
@@ -188,14 +189,21 @@ public class CmdFly extends FCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (fme.canFlyAtLocation())
|
if (fme.canFlyAtLocation()) {
|
||||||
context.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", () -> {
|
context.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", () -> {
|
||||||
fme.setFlying(true);
|
fme.setFlying(true);
|
||||||
flyMap.put(fme.getPlayer().getName(), true);
|
flyMap.put(fme.getPlayer().getName(), true);
|
||||||
|
if (particleTask == null) {
|
||||||
|
startParticles();
|
||||||
|
}
|
||||||
|
|
||||||
if (flyTask == null) {
|
if (flyTask == null) {
|
||||||
startFlyCheck();
|
startFlyCheck();
|
||||||
}
|
}
|
||||||
}, FactionsPlugin.getInstance().getConfig().getLong("warmups.f-fly", 0));
|
}, FactionsPlugin.getInstance().getConfig().getLong("warmups.f-fly", 0));
|
||||||
|
} else {
|
||||||
|
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(fme.getLastStoodAt()).getTag());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ import com.massivecraft.factions.struct.Permission;
|
|||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
public class CmdFocus extends FCommand {
|
public class CmdFocus extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Driftay
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdFocus() {
|
public CmdFocus() {
|
||||||
aliases.add("focus");
|
aliases.add("focus");
|
||||||
|
|
||||||
@@ -21,7 +26,7 @@ public class CmdFocus extends FCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("ffocus.Enabled")) {
|
if (!FactionsPlugin.getInstance().getConfig().getBoolean("ffocus.Enabled")) {
|
||||||
context.msg(TL.GENERIC_DISABLED);
|
context.msg(TL.GENERIC_DISABLED, "Faction Focus");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FPlayer target = context.argAsFPlayer(0);
|
FPlayer target = context.argAsFPlayer(0);
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ import org.bukkit.inventory.Inventory;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class CmdGetVault extends FCommand {
|
public class CmdGetVault extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Illyria Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdGetVault() {
|
public CmdGetVault() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("getvault");
|
this.aliases.add("getvault");
|
||||||
@@ -22,7 +27,7 @@ public class CmdGetVault extends FCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fvault.Enabled")) {
|
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fvault.Enabled")) {
|
||||||
context.fPlayer.sendMessage("This command is disabled!");
|
context.fPlayer.msg(TL.GENERIC_DISABLED, "Faction Vaults");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Location vaultLocation = context.faction.getVault();
|
Location vaultLocation = context.faction.getVault();
|
||||||
@@ -42,9 +47,9 @@ public class CmdGetVault extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!context.fPlayer.takeMoney(amount)) {return;}
|
||||||
|
|
||||||
//success :)
|
//success :)
|
||||||
context.fPlayer.takeMoney(amount);
|
|
||||||
context.player.getInventory().addItem(vault);
|
context.player.getInventory().addItem(vault);
|
||||||
context.fPlayer.msg(TL.COMMAND_GETVAULT_RECEIVE);
|
context.fPlayer.msg(TL.COMMAND_GETVAULT_RECEIVE);
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ import java.util.List;
|
|||||||
|
|
||||||
public class CmdHelp extends FCommand {
|
public class CmdHelp extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public ArrayList<ArrayList<String>> helpPages;
|
public ArrayList<ArrayList<String>> helpPages;
|
||||||
|
|
||||||
public CmdHelp() {
|
public CmdHelp() {
|
||||||
|
|||||||
@@ -20,10 +20,14 @@ import java.util.List;
|
|||||||
|
|
||||||
public class CmdHome extends FCommand {
|
public class CmdHome extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdHome() {
|
public CmdHome() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("home");
|
this.aliases.add("home");
|
||||||
this.optionalArgs.put("home", "faction-name");
|
this.optionalArgs.put("faction", "yours");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.HOME)
|
this.requirements = new CommandRequirements.Builder(Permission.HOME)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
@@ -45,10 +49,14 @@ public class CmdHome extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.args.size() == 1) {
|
if (context.args.size() >= 1) {
|
||||||
Faction faction = context.argAsFaction(0);
|
Faction target = context.argAsFaction(0);
|
||||||
if (faction == null) return;
|
if (target == null) return;
|
||||||
context.faction = faction;
|
context.faction = target;
|
||||||
|
if (target.getAccess(context.fPlayer, PermissableAction.HOME) != Access.ALLOW) {
|
||||||
|
context.fPlayer.msg(TL.GENERIC_FPERM_NOPERMISSION, "teleport home");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!context.faction.hasHome()) {
|
if (!context.faction.hasHome()) {
|
||||||
@@ -83,9 +91,9 @@ public class CmdHome extends FCommand {
|
|||||||
if (Conf.homesTeleportAllowedEnemyDistance > 0
|
if (Conf.homesTeleportAllowedEnemyDistance > 0
|
||||||
&& !faction.isSafeZone()
|
&& !faction.isSafeZone()
|
||||||
&& (!context.fPlayer.isInOwnTerritory()
|
&& (!context.fPlayer.isInOwnTerritory()
|
||||||
|| !Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory)
|
|| (context.fPlayer.isInOwnTerritory()
|
||||||
&& (!Conf.homesTeleportIgnoreEnemiesIfInNoClaimingWorld
|
&& !Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory))) {
|
||||||
|| !Conf.worldsNoClaiming.contains(context.fPlayer.getPlayer().getWorld().getName()))) {
|
|
||||||
World w = loc.getWorld();
|
World w = loc.getWorld();
|
||||||
double x = loc.getX();
|
double x = loc.getX();
|
||||||
double y = loc.getY();
|
double y = loc.getY();
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ import com.massivecraft.factions.struct.Permission;
|
|||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
public class CmdInspect extends FCommand {
|
public class CmdInspect extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Illyria Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdInspect() {
|
public CmdInspect() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("inspect");
|
this.aliases.add("inspect");
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ import java.util.Objects;
|
|||||||
|
|
||||||
public class CmdInventorySee extends FCommand {
|
public class CmdInventorySee extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Driftay
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdInventorySee() {
|
public CmdInventorySee() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
@@ -32,7 +36,7 @@ public class CmdInventorySee extends FCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("f-inventory-see.Enabled")) {
|
if (!FactionsPlugin.getInstance().getConfig().getBoolean("f-inventory-see.Enabled")) {
|
||||||
context.msg(TL.GENERIC_DISABLED);
|
context.msg(TL.GENERIC_DISABLED, "Inventory See");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ import org.bukkit.ChatColor;
|
|||||||
|
|
||||||
public class CmdInvite extends FCommand {
|
public class CmdInvite extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdInvite() {
|
public CmdInvite() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("invite");
|
this.aliases.add("invite");
|
||||||
|
|||||||
@@ -1,14 +1,21 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
import com.massivecraft.factions.*;
|
import com.massivecraft.factions.*;
|
||||||
|
import com.massivecraft.factions.discord.Discord;
|
||||||
import com.massivecraft.factions.event.FPlayerJoinEvent;
|
import com.massivecraft.factions.event.FPlayerJoinEvent;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.zcore.fupgrades.UpgradeType;
|
import com.massivecraft.factions.zcore.fupgrades.UpgradeType;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
import net.dv8tion.jda.core.entities.Member;
|
||||||
|
import net.dv8tion.jda.core.exceptions.HierarchyException;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
public class CmdJoin extends FCommand {
|
public class CmdJoin extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdJoin() {
|
public CmdJoin() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("join");
|
this.aliases.add("join");
|
||||||
@@ -116,7 +123,18 @@ public class CmdJoin extends FCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
faction.deinvite(fplayer);
|
faction.deinvite(fplayer);
|
||||||
context.fPlayer.setRole(faction.getDefaultRole());
|
try {
|
||||||
|
context.fPlayer.setRole(faction.getDefaultRole());
|
||||||
|
if (Discord.useDiscord && context.fPlayer.discordSetup() && Discord.isInMainGuild(context.fPlayer.discordUser()) && Discord.mainGuild != null) {
|
||||||
|
Member m = Discord.mainGuild.getMember(context.fPlayer.discordUser());
|
||||||
|
if (Conf.factionRoles) {
|
||||||
|
Discord.mainGuild.getController().addSingleRoleToMember(m, Discord.createFactionRole(faction.getTag())).queue();
|
||||||
|
}
|
||||||
|
if (Conf.factionDiscordTags) {
|
||||||
|
Discord.mainGuild.getController().setNickname(m, Discord.getNicknameString(context.fPlayer)).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (HierarchyException e) {System.out.print(e.getMessage());}
|
||||||
|
|
||||||
if (Conf.logFactionJoin) {
|
if (Conf.logFactionJoin) {
|
||||||
if (samePlayer) {
|
if (samePlayer) {
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ import org.bukkit.command.ConsoleCommandSender;
|
|||||||
|
|
||||||
public class CmdKick extends FCommand {
|
public class CmdKick extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdKick() {
|
public CmdKick() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("kick");
|
this.aliases.add("kick");
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ import com.massivecraft.factions.struct.Permission;
|
|||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
public class CmdKillHolograms extends FCommand {
|
public class CmdKillHolograms extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Illyria Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdKillHolograms() {
|
public CmdKillHolograms() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("killholos");
|
this.aliases.add("killholos");
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
public class CmdLeave extends FCommand {
|
public class CmdLeave extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdLeave() {
|
public CmdLeave() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("leave");
|
this.aliases.add("leave");
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ import java.util.List;
|
|||||||
|
|
||||||
public class CmdList extends FCommand {
|
public class CmdList extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
private String[] defaults = new String[3];
|
private String[] defaults = new String[3];
|
||||||
|
|
||||||
public CmdList() {
|
public CmdList() {
|
||||||
@@ -39,74 +43,76 @@ public class CmdList extends FCommand {
|
|||||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
// 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.econCostList, "to list the factions", "for listing the factions"))
|
if (!context.payForCommand(Conf.econCostList, "to list the factions", "for listing the factions"))
|
||||||
return;
|
return;
|
||||||
|
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
||||||
|
|
||||||
ArrayList<Faction> factionList = Factions.getInstance().getAllFactions();
|
ArrayList<Faction> factionList = Factions.getInstance().getAllFactions();
|
||||||
factionList.remove(Factions.getInstance().getWilderness());
|
factionList.remove(Factions.getInstance().getWilderness());
|
||||||
factionList.remove(Factions.getInstance().getSafeZone());
|
factionList.remove(Factions.getInstance().getSafeZone());
|
||||||
factionList.remove(Factions.getInstance().getWarZone());
|
factionList.remove(Factions.getInstance().getWarZone());
|
||||||
|
|
||||||
// remove exempt factions
|
// remove exempt factions
|
||||||
if (context.fPlayer != null && context.fPlayer.getPlayer() != null && !context.fPlayer.getPlayer().hasPermission("factions.show.bypassexempt")) {
|
if (context.fPlayer != null && context.fPlayer.getPlayer() != null && !context.fPlayer.getPlayer().hasPermission("factions.show.bypassexempt")) {
|
||||||
List<String> exemptFactions = FactionsPlugin.getInstance().getConfig().getStringList("show-exempt");
|
List<String> exemptFactions = FactionsPlugin.getInstance().getConfig().getStringList("show-exempt");
|
||||||
|
|
||||||
factionList.removeIf(next -> exemptFactions.contains(next.getTag()));
|
factionList.removeIf(next -> exemptFactions.contains(next.getTag()));
|
||||||
}
|
|
||||||
|
|
||||||
// Sort by total followers first
|
|
||||||
factionList.sort((f1, f2) -> {
|
|
||||||
int f1Size = f1.getFPlayers().size();
|
|
||||||
int f2Size = f2.getFPlayers().size();
|
|
||||||
if (f1Size < f2Size) {
|
|
||||||
return 1;
|
|
||||||
} else if (f1Size > f2Size) {
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
// Sort by total followers first
|
||||||
|
factionList.sort((f1, f2) -> {
|
||||||
|
int f1Size = f1.getFPlayers().size();
|
||||||
|
int f2Size = f2.getFPlayers().size();
|
||||||
|
if (f1Size < f2Size) {
|
||||||
|
return 1;
|
||||||
|
} else if (f1Size > f2Size) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Then sort by how many members are online now
|
||||||
|
factionList.sort((f1, f2) -> {
|
||||||
|
int f1Size = f1.getFPlayersWhereOnline(true).size();
|
||||||
|
int f2Size = f2.getFPlayersWhereOnline(true).size();
|
||||||
|
if (f1Size < f2Size) {
|
||||||
|
return 1;
|
||||||
|
} else if (f1Size > f2Size) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
ArrayList<String> lines = new ArrayList<>();
|
||||||
|
|
||||||
|
factionList.add(0, Factions.getInstance().getWilderness());
|
||||||
|
|
||||||
|
final int pageheight = 9;
|
||||||
|
int pagenumber = context.argAsInt(0, 1);
|
||||||
|
int pagecount = (factionList.size() / pageheight) + 1;
|
||||||
|
if (pagenumber > pagecount) {
|
||||||
|
pagenumber = pagecount;
|
||||||
|
} else if (pagenumber < 1) {
|
||||||
|
pagenumber = 1;
|
||||||
|
}
|
||||||
|
int start = (pagenumber - 1) * pageheight;
|
||||||
|
int end = start + pageheight;
|
||||||
|
if (end > factionList.size()) {
|
||||||
|
end = factionList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String header = FactionsPlugin.getInstance().getConfig().getString("list.header", defaults[0]);
|
||||||
|
header = header.replace("{pagenumber}", String.valueOf(pagenumber)).replace("{pagecount}", String.valueOf(pagecount));
|
||||||
|
lines.add(FactionsPlugin.getInstance().txt.parse(header));
|
||||||
|
|
||||||
|
for (Faction faction : factionList.subList(start, end)) {
|
||||||
|
if (faction.isWilderness()) {
|
||||||
|
lines.add(FactionsPlugin.getInstance().txt.parse(TagUtil.parsePlain(faction, FactionsPlugin.getInstance().getConfig().getString("list.factionless", defaults[1]))));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
lines.add(FactionsPlugin.getInstance().txt.parse(TagUtil.parsePlain(faction, context.fPlayer, FactionsPlugin.getInstance().getConfig().getString("list.entry", defaults[2]))));
|
||||||
|
}
|
||||||
|
context.sendMessage(lines);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Then sort by how many members are online now
|
|
||||||
factionList.sort((f1, f2) -> {
|
|
||||||
int f1Size = f1.getFPlayersWhereOnline(true).size();
|
|
||||||
int f2Size = f2.getFPlayersWhereOnline(true).size();
|
|
||||||
if (f1Size < f2Size) {
|
|
||||||
return 1;
|
|
||||||
} else if (f1Size > f2Size) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
ArrayList<String> lines = new ArrayList<>();
|
|
||||||
|
|
||||||
factionList.add(0, Factions.getInstance().getWilderness());
|
|
||||||
|
|
||||||
final int pageheight = 9;
|
|
||||||
int pagenumber = context.argAsInt(0, 1);
|
|
||||||
int pagecount = (factionList.size() / pageheight) + 1;
|
|
||||||
if (pagenumber > pagecount) {
|
|
||||||
pagenumber = pagecount;
|
|
||||||
} else if (pagenumber < 1) {
|
|
||||||
pagenumber = 1;
|
|
||||||
}
|
|
||||||
int start = (pagenumber - 1) * pageheight;
|
|
||||||
int end = start + pageheight;
|
|
||||||
if (end > factionList.size()) {
|
|
||||||
end = factionList.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
String header = FactionsPlugin.getInstance().getConfig().getString("list.header", defaults[0]);
|
|
||||||
header = header.replace("{pagenumber}", String.valueOf(pagenumber)).replace("{pagecount}", String.valueOf(pagecount));
|
|
||||||
lines.add(FactionsPlugin.getInstance().txt.parse(header));
|
|
||||||
|
|
||||||
for (Faction faction : factionList.subList(start, end)) {
|
|
||||||
if (faction.isWilderness()) {
|
|
||||||
lines.add(FactionsPlugin.getInstance().txt.parse(TagUtil.parsePlain(faction, FactionsPlugin.getInstance().getConfig().getString("list.factionless", defaults[1]))));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
lines.add(FactionsPlugin.getInstance().txt.parse(TagUtil.parsePlain(faction, context.fPlayer, FactionsPlugin.getInstance().getConfig().getString("list.entry", defaults[2]))));
|
|
||||||
}
|
|
||||||
context.sendMessage(lines);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdLock extends FCommand {
|
public class CmdLock extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
// TODO: This solution needs refactoring.
|
// TODO: This solution needs refactoring.
|
||||||
/*
|
/*
|
||||||
factions.lock:
|
factions.lock:
|
||||||
@@ -19,7 +23,6 @@ public class CmdLock extends FCommand {
|
|||||||
this.optionalArgs.put("on/off", "flip");
|
this.optionalArgs.put("on/off", "flip");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.LOCK)
|
this.requirements = new CommandRequirements.Builder(Permission.LOCK)
|
||||||
.playerOnly()
|
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdLogins extends FCommand {
|
public class CmdLogins extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdLogins() {
|
public CmdLogins() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("login");
|
this.aliases.add("login");
|
||||||
|
|||||||
54
src/main/java/com/massivecraft/factions/cmd/CmdLookup.java
Normal file
54
src/main/java/com/massivecraft/factions/cmd/CmdLookup.java
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Board;
|
||||||
|
import com.massivecraft.factions.FLocation;
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Saser
|
||||||
|
*/
|
||||||
|
public class CmdLookup extends FCommand {
|
||||||
|
|
||||||
|
private DecimalFormat format = new DecimalFormat("#.#");
|
||||||
|
|
||||||
|
public CmdLookup() {
|
||||||
|
super();
|
||||||
|
this.aliases.add("lookup");
|
||||||
|
this.requiredArgs.add("faction name");
|
||||||
|
|
||||||
|
this.requirements = new CommandRequirements.Builder(Permission.LOOKUP)
|
||||||
|
.playerOnly()
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void perform(CommandContext context) {
|
||||||
|
Faction faction = context.argAsFaction(0);
|
||||||
|
if (faction == null) {
|
||||||
|
context.msg(TL.COMMAND_LOOKUP_INVALID);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (faction.isNormal()) {
|
||||||
|
if (faction.getHome() != null) {
|
||||||
|
context.msg(TL.COMMAND_LOOKUP_FACTION_HOME, this.format.format(faction.getHome().getX()), this.format.format(faction.getHome().getY()), this.format.format(faction.getHome().getZ()));
|
||||||
|
}
|
||||||
|
Set<FLocation> locations = Board.getInstance().getAllClaims(faction);
|
||||||
|
context.msg(TL.COMMAND_LOOKUP_CLAIM_COUNT, locations.size(), faction.getTag());
|
||||||
|
for (FLocation flocation : locations) {
|
||||||
|
context.msg(TL.COMMAND_LOOKUP_CLAIM_LIST, flocation.getWorldName(), flocation.getX() * 16L, flocation.getZ() * 16L);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
context.msg(TL.COMMAND_LOOKUP_ONLY_NORMAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TL getUsageTranslation() {
|
||||||
|
return TL.COMMAND_LOOKUP_DESCRIPTION;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdLowPower extends FCommand {
|
public class CmdLowPower extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Illyria Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdLowPower() {
|
public CmdLowPower() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("lowpower");
|
this.aliases.add("lowpower");
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdMap extends FCommand {
|
public class CmdMap extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdMap() {
|
public CmdMap() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("map");
|
this.aliases.add("map");
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdMapHeight extends FCommand {
|
public class CmdMapHeight extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdMapHeight() {
|
public CmdMapHeight() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
@@ -11,6 +12,10 @@ import org.bukkit.ChatColor;
|
|||||||
|
|
||||||
public class CmdMod extends FCommand {
|
public class CmdMod extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdMod() {
|
public CmdMod() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("mod");
|
this.aliases.add("mod");
|
||||||
@@ -28,51 +33,51 @@ public class CmdMod extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
FPlayer you = context.argAsBestFPlayerMatch(0);
|
FPlayer you = context.argAsBestFPlayerMatch(0);
|
||||||
if (you == null) {
|
if (you == null) {
|
||||||
FancyMessage msg = new FancyMessage(TL.COMMAND_MOD_CANDIDATES.toString()).color(ChatColor.GOLD);
|
FancyMessage msg = new FancyMessage(TL.COMMAND_MOD_CANDIDATES.toString()).color(ChatColor.GOLD);
|
||||||
for (FPlayer player : context.faction.getFPlayersWhereRole(Role.NORMAL)) {
|
for (FPlayer player : context.faction.getFPlayersWhereRole(Role.NORMAL)) {
|
||||||
String s = player.getName();
|
String s = player.getName();
|
||||||
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_MOD_CLICKTOPROMOTE.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " mod " + s);
|
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_MOD_CLICKTOPROMOTE.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " mod " + s);
|
||||||
|
}
|
||||||
|
|
||||||
|
context.sendFancyMessage(msg);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
context.sendFancyMessage(msg);
|
boolean permAny = Permission.MOD_ANY.has(context.sender, false);
|
||||||
return;
|
Faction targetFaction = you.getFaction();
|
||||||
}
|
if (targetFaction != context.faction && !permAny) {
|
||||||
|
context.msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(context.fPlayer, true));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boolean permAny = Permission.MOD_ANY.has(context.sender, false);
|
if (context.fPlayer != null && context.fPlayer.getRole() != Role.LEADER && !permAny) {
|
||||||
Faction targetFaction = you.getFaction();
|
context.msg(TL.COMMAND_MOD_NOTADMIN);
|
||||||
if (targetFaction != context.faction && !permAny) {
|
return;
|
||||||
context.msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(context.fPlayer, true));
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (context.fPlayer != null && context.fPlayer.getRole() != Role.LEADER && !permAny) {
|
if (you == context.fPlayer && !permAny) {
|
||||||
context.msg(TL.COMMAND_MOD_NOTADMIN);
|
context.msg(TL.COMMAND_MOD_SELF);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (you == context.fPlayer && !permAny) {
|
if (you.getRole() == Role.LEADER) {
|
||||||
context.msg(TL.COMMAND_MOD_SELF);
|
context.msg(TL.COMMAND_MOD_TARGETISADMIN);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (you.getRole() == Role.LEADER) {
|
if (you.getRole() == Role.MODERATOR) {
|
||||||
context.msg(TL.COMMAND_MOD_TARGETISADMIN);
|
// Revoke
|
||||||
return;
|
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));
|
||||||
if (you.getRole() == Role.MODERATOR) {
|
} else {
|
||||||
// Revoke
|
// Give
|
||||||
you.setRole(Role.NORMAL);
|
you.setRole(Role.MODERATOR);
|
||||||
targetFaction.msg(TL.COMMAND_MOD_REVOKED, you.describeTo(targetFaction, true));
|
targetFaction.msg(TL.COMMAND_MOD_PROMOTED, you.describeTo(targetFaction, true));
|
||||||
context.msg(TL.COMMAND_MOD_REVOKES, you.describeTo(context.fPlayer, true));
|
context.msg(TL.COMMAND_MOD_PROMOTES, 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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdModifyPower extends FCommand {
|
public class CmdModifyPower extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdModifyPower() {
|
public CmdModifyPower() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CmdNear extends FCommand {
|
public class CmdNear extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdNear() {
|
public CmdNear() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("near");
|
this.aliases.add("near");
|
||||||
|
|||||||
@@ -3,12 +3,17 @@ package com.massivecraft.factions.cmd;
|
|||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.FPlayers;
|
import com.massivecraft.factions.FPlayers;
|
||||||
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
public class CmdOpen extends FCommand {
|
public class CmdOpen extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdOpen() {
|
public CmdOpen() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("open");
|
this.aliases.add("open");
|
||||||
@@ -23,23 +28,25 @@ public class CmdOpen extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
||||||
if (!context.payForCommand(Conf.econCostOpen, TL.COMMAND_OPEN_TOOPEN, TL.COMMAND_OPEN_FOROPEN)) {
|
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||||
return;
|
if (!context.payForCommand(Conf.econCostOpen, TL.COMMAND_OPEN_TOOPEN, TL.COMMAND_OPEN_FOROPEN)) {
|
||||||
}
|
return;
|
||||||
|
|
||||||
context.faction.setOpen(context.argAsBool(0, !context.faction.getOpen()));
|
|
||||||
|
|
||||||
String open = context.faction.getOpen() ? TL.COMMAND_OPEN_OPEN.toString() : TL.COMMAND_OPEN_CLOSED.toString();
|
|
||||||
|
|
||||||
// Inform
|
|
||||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
|
||||||
if (fplayer.getFactionId().equals(context.faction.getId())) {
|
|
||||||
fplayer.msg(TL.COMMAND_OPEN_CHANGES, context.fPlayer.getName(), open);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
fplayer.msg(TL.COMMAND_OPEN_CHANGED, context.faction.getTag(fplayer.getFaction()), open);
|
|
||||||
}
|
context.faction.setOpen(context.argAsBool(0, !context.faction.getOpen()));
|
||||||
|
|
||||||
|
String open = context.faction.getOpen() ? TL.COMMAND_OPEN_OPEN.toString() : TL.COMMAND_OPEN_CLOSED.toString();
|
||||||
|
|
||||||
|
// Inform
|
||||||
|
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||||
|
if (fplayer.getFactionId().equals(context.faction.getId())) {
|
||||||
|
fplayer.msg(TL.COMMAND_OPEN_CHANGES, context.fPlayer.getName(), open);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
fplayer.msg(TL.COMMAND_OPEN_CHANGED, context.faction.getTag(fplayer.getFaction()), open);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdOwner extends FCommand {
|
public class CmdOwner extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdOwner() {
|
public CmdOwner() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("owner");
|
this.aliases.add("owner");
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdOwnerList extends FCommand {
|
public class CmdOwnerList extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdOwnerList() {
|
public CmdOwnerList() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("ownerlist");
|
this.aliases.add("ownerlist");
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ import com.massivecraft.factions.struct.Permission;
|
|||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
public class CmdPaypalSee extends FCommand {
|
public class CmdPaypalSee extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Driftay
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdPaypalSee() {
|
public CmdPaypalSee() {
|
||||||
this.aliases.add("seepaypal");
|
this.aliases.add("seepaypal");
|
||||||
this.aliases.add("paypal");
|
this.aliases.add("paypal");
|
||||||
@@ -20,7 +25,7 @@ public class CmdPaypalSee extends FCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fpaypal.Enabled")) {
|
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fpaypal.Enabled")) {
|
||||||
context.msg(TL.GENERIC_DISABLED);
|
context.msg(TL.GENERIC_DISABLED, "Faction Paypals");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdPaypalSet extends FCommand {
|
public class CmdPaypalSet extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Driftay
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdPaypalSet() {
|
public CmdPaypalSet() {
|
||||||
this.aliases.add("setpaypal");
|
this.aliases.add("setpaypal");
|
||||||
|
|
||||||
@@ -25,7 +29,7 @@ public class CmdPaypalSet extends FCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fpaypal.Enabled")) {
|
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fpaypal.Enabled")) {
|
||||||
context.fPlayer.msg(TL.GENERIC_DISABLED);
|
context.fPlayer.msg(TL.GENERIC_DISABLED, "Faction Paypals");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (context.fPlayer.getRole() != Role.LEADER && !context.fPlayer.isAdminBypassing()) {
|
if (context.fPlayer.getRole() != Role.LEADER && !context.fPlayer.isAdminBypassing()) {
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdPeaceful extends FCommand {
|
public class CmdPeaceful extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdPeaceful() {
|
public CmdPeaceful() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("peaceful");
|
this.aliases.add("peaceful");
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ import java.util.Set;
|
|||||||
|
|
||||||
public class CmdPerm extends FCommand {
|
public class CmdPerm extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdPerm() {
|
public CmdPerm() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("perm");
|
this.aliases.add("perm");
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdPermanent extends FCommand {
|
public class CmdPermanent extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdPermanent() {
|
public CmdPermanent() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("permanent");
|
this.aliases.add("permanent");
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ import com.massivecraft.factions.struct.Permission;
|
|||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
public class CmdPermanentPower extends FCommand {
|
public class CmdPermanentPower extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdPermanentPower() {
|
public CmdPermanentPower() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("permanentpower");
|
this.aliases.add("permanentpower");
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
|
public class CmdPlayerTitleToggle extends FCommand {
|
||||||
|
public CmdPlayerTitleToggle() {
|
||||||
|
super();
|
||||||
|
this.aliases.add("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;}
|
||||||
|
}
|
||||||
@@ -7,6 +7,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdPower extends FCommand {
|
public class CmdPower extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdPower() {
|
public CmdPower() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("power");
|
this.aliases.add("power");
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ import org.bukkit.command.ConsoleCommandSender;
|
|||||||
|
|
||||||
public class CmdPowerBoost extends FCommand {
|
public class CmdPowerBoost extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdPowerBoost() {
|
public CmdPowerBoost() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("powerboost");
|
this.aliases.add("powerboost");
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
|
import com.massivecraft.factions.discord.Discord;
|
||||||
import com.massivecraft.factions.listeners.FactionsPlayerListener;
|
import com.massivecraft.factions.listeners.FactionsPlayerListener;
|
||||||
import com.massivecraft.factions.shop.ShopConfig;
|
import com.massivecraft.factions.shop.ShopConfig;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
@@ -9,6 +10,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdReload extends FCommand {
|
public class CmdReload extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdReload() {
|
public CmdReload() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("reload");
|
this.aliases.add("reload");
|
||||||
@@ -26,7 +31,7 @@ public class CmdReload extends FCommand {
|
|||||||
FactionsPlugin.getInstance().loadLang();
|
FactionsPlugin.getInstance().loadLang();
|
||||||
|
|
||||||
|
|
||||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) {
|
if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight", false)) {
|
||||||
FactionsPlugin.getInstance().factionsFlight = true;
|
FactionsPlugin.getInstance().factionsFlight = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,6 +39,10 @@ public class CmdReload extends FCommand {
|
|||||||
FactionsPlayerListener.loadCorners();
|
FactionsPlayerListener.loadCorners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Discord.setupDiscord();
|
||||||
|
//Recheck if commands should truly be disabled and rebuild.
|
||||||
|
FCmdRoot.instance.addVariableCommands();
|
||||||
|
FCmdRoot.instance.rebuild();
|
||||||
long timeReload = (System.currentTimeMillis() - timeInitStart);
|
long timeReload = (System.currentTimeMillis() - timeInitStart);
|
||||||
|
|
||||||
context.msg(TL.COMMAND_RELOAD_TIME, timeReload);
|
context.msg(TL.COMMAND_RELOAD_TIME, timeReload);
|
||||||
|
|||||||
@@ -8,6 +8,11 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class CmdRules extends FCommand {
|
public class CmdRules extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Illyria Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdRules() {
|
public CmdRules() {
|
||||||
super();
|
super();
|
||||||
aliases.add("r");
|
aliases.add("r");
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdSB extends FCommand {
|
public class CmdSB extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdSB() {
|
public CmdSB() {
|
||||||
this.aliases.add("sb");
|
this.aliases.add("sb");
|
||||||
this.aliases.add("scoreboard");
|
this.aliases.add("scoreboard");
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdSaveAll extends FCommand {
|
public class CmdSaveAll extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdSaveAll() {
|
public CmdSaveAll() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("saveall");
|
this.aliases.add("saveall");
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
public class CmdSeeChunk extends FCommand {
|
public class CmdSeeChunk extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
//Used a hashmap cuz imma make a particle selection gui later, will store it where the boolean is rn.
|
//Used a hashmap cuz imma make a particle selection gui later, will store it where the boolean is rn.
|
||||||
public static HashMap<String, Boolean> seeChunkMap = new HashMap<>();
|
public static HashMap<String, Boolean> seeChunkMap = new HashMap<>();
|
||||||
private long interval;
|
private long interval;
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdSeeDiscord extends FCommand{
|
public class CmdSeeDiscord extends FCommand{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Driftay
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdSeeDiscord() {
|
public CmdSeeDiscord() {
|
||||||
this.aliases.add("seediscord");
|
this.aliases.add("seediscord");
|
||||||
this.aliases.add("discord");
|
this.aliases.add("discord");
|
||||||
@@ -21,7 +25,7 @@ public class CmdSeeDiscord extends FCommand{
|
|||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fdiscord.Enabled")) {
|
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fdiscord.Enabled")) {
|
||||||
context.msg(TL.GENERIC_DISABLED);
|
context.msg(TL.GENERIC_DISABLED, "Faction Discords");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdSetBanner extends FCommand {
|
public class CmdSetBanner extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Illyria Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdSetBanner() {
|
public CmdSetBanner() {
|
||||||
super();
|
super();
|
||||||
aliases.add("setbanner");
|
aliases.add("setbanner");
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdSetDefaultRole extends FCommand {
|
public class CmdSetDefaultRole extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdSetDefaultRole() {
|
public CmdSetDefaultRole() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdSetDiscord extends FCommand {
|
public class CmdSetDiscord extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Driftay
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdSetDiscord(){
|
public CmdSetDiscord(){
|
||||||
super();
|
super();
|
||||||
this.aliases.add("setdiscord");
|
this.aliases.add("setdiscord");
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
|||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
public class CmdSetFWarp extends FCommand {
|
public class CmdSetFWarp extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdSetFWarp() {
|
public CmdSetFWarp() {
|
||||||
this.aliases.add("setwarp");
|
this.aliases.add("setwarp");
|
||||||
this.aliases.add("sw");
|
this.aliases.add("sw");
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ import org.bukkit.ChatColor;
|
|||||||
|
|
||||||
public class CmdSetMaxVaults extends FCommand {
|
public class CmdSetMaxVaults extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdSetMaxVaults() {
|
public CmdSetMaxVaults() {
|
||||||
this.aliases.add("setmaxvaults");
|
this.aliases.add("setmaxvaults");
|
||||||
this.aliases.add("smv");
|
this.aliases.add("smv");
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdSethome extends FCommand {
|
public class CmdSethome extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdSethome() {
|
public CmdSethome() {
|
||||||
this.aliases.add("sethome");
|
this.aliases.add("sethome");
|
||||||
this.optionalArgs.put("faction tag", "mine");
|
this.optionalArgs.put("faction tag", "mine");
|
||||||
@@ -20,36 +24,38 @@ public class CmdSethome extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (!Conf.homesEnabled) {
|
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
||||||
context.msg(TL.COMMAND_SETHOME_DISABLED);
|
if (!Conf.homesEnabled) {
|
||||||
return;
|
context.msg(TL.COMMAND_SETHOME_DISABLED);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Faction faction = context.argAsFaction(0, context.faction);
|
Faction faction = context.argAsFaction(0, context.faction);
|
||||||
if (faction == null) {
|
if (faction == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can the player set the faction home HERE?
|
// Can the player set the faction home HERE?
|
||||||
if (!Permission.BYPASS.has(context.player) &&
|
if (!Permission.BYPASS.has(context.player) &&
|
||||||
Conf.homesMustBeInClaimedTerritory &&
|
Conf.homesMustBeInClaimedTerritory &&
|
||||||
Board.getInstance().getFactionAt(new FLocation(context.player)) != faction) {
|
Board.getInstance().getFactionAt(new FLocation(context.player)) != faction) {
|
||||||
context.msg(TL.COMMAND_SETHOME_NOTCLAIMED);
|
context.msg(TL.COMMAND_SETHOME_NOTCLAIMED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
// 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)) {
|
if (!context.payForCommand(Conf.econCostSethome, TL.COMMAND_SETHOME_TOSET, TL.COMMAND_SETHOME_FORSET)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
faction.setHome(context.player.getLocation());
|
faction.setHome(context.player.getLocation());
|
||||||
|
|
||||||
faction.msg(TL.COMMAND_SETHOME_SET, context.fPlayer.describeTo(context.faction, true));
|
faction.msg(TL.COMMAND_SETHOME_SET, context.fPlayer.describeTo(context.faction, true));
|
||||||
faction.sendMessage(FactionsPlugin.getInstance().cmdBase.cmdHome.getUsageTemplate(context));
|
faction.sendMessage(FactionsPlugin.getInstance().cmdBase.cmdHome.getUsageTemplate(context));
|
||||||
if (faction != context.faction) {
|
if (faction != context.faction) {
|
||||||
context.msg(TL.COMMAND_SETHOME_SETOTHER, faction.getTag(context.fPlayer));
|
context.msg(TL.COMMAND_SETHOME_SETOTHER, faction.getTag(context.fPlayer));
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ import java.util.List;
|
|||||||
|
|
||||||
public class CmdShow extends FCommand {
|
public class CmdShow extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
List<String> defaults = new ArrayList<>();
|
List<String> defaults = new ArrayList<>();
|
||||||
|
|
||||||
public CmdShow() {
|
public CmdShow() {
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdShowClaims extends FCommand {
|
public class CmdShowClaims extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Illyria Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdShowClaims() {
|
public CmdShowClaims() {
|
||||||
this.aliases.add("showclaims");
|
this.aliases.add("showclaims");
|
||||||
this.aliases.add("showclaim");
|
this.aliases.add("showclaim");
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.FPlayers;
|
import com.massivecraft.factions.FPlayers;
|
||||||
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import mkremins.fanciful.FancyMessage;
|
import mkremins.fanciful.FancyMessage;
|
||||||
@@ -10,6 +11,10 @@ import org.bukkit.ChatColor;
|
|||||||
|
|
||||||
public class CmdShowInvites extends FCommand {
|
public class CmdShowInvites extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdShowInvites() {
|
public CmdShowInvites() {
|
||||||
super();
|
super();
|
||||||
aliases.add("showinvites");
|
aliases.add("showinvites");
|
||||||
@@ -23,14 +28,12 @@ public class CmdShowInvites extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
FancyMessage msg = new FancyMessage(TL.COMMAND_SHOWINVITES_PENDING.toString()).color(ChatColor.GOLD);
|
FancyMessage msg = new FancyMessage(TL.COMMAND_SHOWINVITES_PENDING.toString()).color(ChatColor.GOLD);
|
||||||
for (String id : context.faction.getInvites()) {
|
for (String id : context.faction.getInvites()) {
|
||||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||||
String name = fp != null ? fp.getName() : 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);
|
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_SHOWINVITES_CLICKTOREVOKE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
context.sendFancyMessage(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdSpawnerLock extends FCommand {
|
public class CmdSpawnerLock extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Illyria Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdSpawnerLock(){
|
public CmdSpawnerLock(){
|
||||||
super();
|
super();
|
||||||
this.aliases.add("lockspawners");
|
this.aliases.add("lockspawners");
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public class CmdStatus extends FCommand {
|
public class CmdStatus extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdStatus() {
|
public CmdStatus() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("status");
|
this.aliases.add("status");
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ import com.massivecraft.factions.struct.Permission;
|
|||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
public class CmdStealth extends FCommand {
|
public class CmdStealth extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Driftay
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdStealth() {
|
public CmdStealth() {
|
||||||
this.aliases.add("ninja");
|
this.aliases.add("ninja");
|
||||||
this.aliases.add("stealth");
|
this.aliases.add("stealth");
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdStrikes extends FCommand {
|
public class CmdStrikes extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Driftay
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdStrikesGive cmdStrikesGive = new CmdStrikesGive();
|
public CmdStrikesGive cmdStrikesGive = new CmdStrikesGive();
|
||||||
public CmdStrikesInfo cmdStrikesInfo = new CmdStrikesInfo();
|
public CmdStrikesInfo cmdStrikesInfo = new CmdStrikesInfo();
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdStrikesGive extends FCommand {
|
public class CmdStrikesGive extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Driftay
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdStrikesGive() {
|
public CmdStrikesGive() {
|
||||||
super();
|
super();
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdStrikesInfo extends FCommand {
|
public class CmdStrikesInfo extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Driftay
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdStrikesInfo() {
|
public CmdStrikesInfo() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("info");
|
this.aliases.add("info");
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdStrikesSet extends FCommand {
|
public class CmdStrikesSet extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Driftay
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdStrikesSet() {
|
public CmdStrikesSet() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("set");
|
this.aliases.add("set");
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdStrikesTake extends FCommand {
|
public class CmdStrikesTake extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Driftay
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdStrikesTake() {
|
public CmdStrikesTake() {
|
||||||
super();
|
super();
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class CmdStuck extends FCommand {
|
public class CmdStuck extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdStuck() {
|
public CmdStuck() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("stuck");
|
this.aliases.add("stuck");
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
import com.massivecraft.factions.*;
|
import com.massivecraft.factions.*;
|
||||||
|
import com.massivecraft.factions.discord.Discord;
|
||||||
import com.massivecraft.factions.event.FactionRenameEvent;
|
import com.massivecraft.factions.event.FactionRenameEvent;
|
||||||
import com.massivecraft.factions.scoreboards.FTeamWrapper;
|
import com.massivecraft.factions.scoreboards.FTeamWrapper;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
@@ -13,6 +14,10 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public class CmdTag extends FCommand {
|
public class CmdTag extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdTag() {
|
public CmdTag() {
|
||||||
this.aliases.add("tag");
|
this.aliases.add("tag");
|
||||||
this.aliases.add("rename");
|
this.aliases.add("rename");
|
||||||
@@ -28,55 +33,59 @@ public class CmdTag extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
String tag = context.argAsString(0);
|
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
||||||
|
|
||||||
// TODO does not first test cover selfcase?
|
String tag = context.argAsString(0);
|
||||||
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);
|
// TODO does not first test cover selfcase?
|
||||||
if (errors.size() > 0) {
|
if (Factions.getInstance().isTagTaken(tag) && !MiscUtil.getComparisonString(tag).equals(context.faction.getComparisonTag())) {
|
||||||
context.sendMessage(errors);
|
context.msg(TL.COMMAND_TAG_TAKEN);
|
||||||
return;
|
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);
|
|
||||||
|
|
||||||
// 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)
|
ArrayList<String> errors = MiscUtil.validateTag(tag);
|
||||||
if (Conf.broadcastTagChanges) {
|
if (errors.size() > 0) {
|
||||||
Faction faction = fplayer.getFaction();
|
context.sendMessage(errors);
|
||||||
fplayer.msg(TL.COMMAND_TAG_CHANGED, context.fPlayer.getColorTo(faction) + oldtag, context.faction.getTag(faction));
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
FTeamWrapper.updatePrefixes(context.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);
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,12 +2,17 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
import com.massivecraft.factions.zcore.util.TextUtil;
|
||||||
|
|
||||||
public class CmdTitle extends FCommand {
|
public class CmdTitle extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdTitle() {
|
public CmdTitle() {
|
||||||
this.aliases.add("title");
|
this.aliases.add("title");
|
||||||
this.requiredArgs.add("player name");
|
this.requiredArgs.add("player name");
|
||||||
@@ -20,16 +25,19 @@ public class CmdTitle extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
FPlayer you = context.argAsBestFPlayerMatch(0);
|
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
||||||
if (you == null) return;
|
FPlayer you = context.argAsBestFPlayerMatch(0);
|
||||||
context.args.remove(0);
|
if (you == null) return;
|
||||||
String title = TextUtil.implode(context.args, " ");
|
context.args.remove(0);
|
||||||
if (!context.canIAdministerYou(context.fPlayer, you)) return;
|
String title = TextUtil.implode(context.args, " ");
|
||||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
if (!context.canIAdministerYou(context.fPlayer, you)) return;
|
||||||
if (!context.payForCommand(Conf.econCostTitle, TL.COMMAND_TITLE_TOCHANGE, TL.COMMAND_TITLE_FORCHANGE)) return;
|
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||||
you.setTitle(context.sender, title);
|
if (!context.payForCommand(Conf.econCostTitle, TL.COMMAND_TITLE_TOCHANGE, TL.COMMAND_TITLE_FORCHANGE))
|
||||||
// Inform
|
return;
|
||||||
context.faction.msg(TL.COMMAND_TITLE_CHANGED, context.fPlayer.describeTo(context.faction, true), you.describeTo(context.faction, true));
|
you.setTitle(context.sender, title);
|
||||||
|
// Inform
|
||||||
|
context.faction.msg(TL.COMMAND_TITLE_CHANGED, context.fPlayer.describeTo(context.faction, true), you.describeTo(context.faction, true));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdToggleAllianceChat extends FCommand {
|
public class CmdToggleAllianceChat extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdToggleAllianceChat() {
|
public CmdToggleAllianceChat() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("tac");
|
this.aliases.add("tac");
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public class CmdTop extends FCommand {
|
public class CmdTop extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdTop() {
|
public CmdTop() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("top");
|
this.aliases.add("top");
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdTpBanner extends FCommand {
|
public class CmdTpBanner extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Illyria Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdTpBanner() {
|
public CmdTpBanner() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("tpbanner");
|
this.aliases.add("tpbanner");
|
||||||
@@ -25,8 +29,6 @@ public class CmdTpBanner extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final FactionsPlayerListener fpl = new FactionsPlayerListener();
|
|
||||||
|
|
||||||
if (FactionsBlockListener.bannerLocations.containsKey(context.fPlayer.getTag())) {
|
if (FactionsBlockListener.bannerLocations.containsKey(context.fPlayer.getTag())) {
|
||||||
context.msg(TL.COMMAND_TPBANNER_SUCCESS);
|
context.msg(TL.COMMAND_TPBANNER_SUCCESS);
|
||||||
context.doWarmUp(WarmUpUtil.Warmup.BANNER, TL.WARMUPS_NOTIFY_TELEPORT, "Banner", () -> {
|
context.doWarmUp(WarmUpUtil.Warmup.BANNER, TL.WARMUPS_NOTIFY_TELEPORT, "Banner", () -> {
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdUnban extends FCommand {
|
public class CmdUnban extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdUnban() {
|
public CmdUnban() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("unban");
|
this.aliases.add("unban");
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ import com.massivecraft.factions.zcore.fupgrades.FUpgradesGUI;
|
|||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
public class CmdUpgrades extends FCommand {
|
public class CmdUpgrades extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Illyria Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdUpgrades() {
|
public CmdUpgrades() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("upgrades");
|
this.aliases.add("upgrades");
|
||||||
@@ -21,7 +26,7 @@ public class CmdUpgrades extends FCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fupgrades.Enabled")) {
|
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fupgrades.Enabled")) {
|
||||||
context.fPlayer.sendMessage("This command is disabled!");
|
context.fPlayer.msg(TL.COMMAND_UPGRADES_DISABLED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new FUpgradesGUI().openMainMenu(context.fPlayer);
|
new FUpgradesGUI().openMainMenu(context.fPlayer);
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ import org.bukkit.inventory.Inventory;
|
|||||||
|
|
||||||
public class CmdVault extends FCommand {
|
public class CmdVault extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Illyria Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdVault() {
|
public CmdVault() {
|
||||||
this.aliases.add("vault");
|
this.aliases.add("vault");
|
||||||
|
|
||||||
@@ -28,7 +32,7 @@ public class CmdVault extends FCommand {
|
|||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
|
|
||||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fvault.Enabled")) {
|
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fvault.Enabled")) {
|
||||||
context.fPlayer.sendMessage("This command is disabled!");
|
context.fPlayer.msg(TL.GENERIC_DISABLED, "Faction Vaults");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdVersion extends FCommand {
|
public class CmdVersion extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdVersion() {
|
public CmdVersion() {
|
||||||
this.aliases.add("version");
|
this.aliases.add("version");
|
||||||
this.aliases.add("ver");
|
this.aliases.add("ver");
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdViewChest extends FCommand {
|
public class CmdViewChest extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Driftay
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdViewChest() {
|
public CmdViewChest() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("viewchest");
|
this.aliases.add("viewchest");
|
||||||
@@ -22,7 +26,7 @@ public class CmdViewChest extends FCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fchest.Enabled")) {
|
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fchest.Enabled")) {
|
||||||
context.msg(TL.GENERIC_DISABLED);
|
context.msg(TL.GENERIC_DISABLED, "Faction Chests");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user