Compare commits
115 Commits
2.0.9-BETA
...
duels
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3771feb01 | ||
|
|
07599fa06d | ||
|
|
3d997bbf16 | ||
|
|
a086f8db7a | ||
|
|
2c13204294 | ||
|
|
43c567ee02 | ||
|
|
dfbfbf9981 | ||
|
|
13399c53c5 | ||
|
|
55d6af7195 | ||
|
|
4f675dfd66 | ||
|
|
22957b641b | ||
|
|
0fc3e47289 | ||
|
|
730693aed1 | ||
|
|
61570be012 | ||
|
|
bcc04e6174 | ||
|
|
d30780e06e | ||
|
|
ed73baf5f1 | ||
|
|
94d2035c78 | ||
|
|
8ff8c78a44 | ||
|
|
591dc2172f | ||
|
|
1a4c860c46 | ||
|
|
ad56264c5d | ||
|
|
def1a8b15a | ||
|
|
8b577d360b | ||
|
|
f34ebc73fa | ||
|
|
c86db7ab51 | ||
|
|
070f239948 | ||
|
|
018f08699d | ||
|
|
5542245b2a | ||
|
|
6eb204587d | ||
|
|
ce1eedd7cd | ||
|
|
417cc57aa7 | ||
|
|
57ac2c8c98 | ||
|
|
25515d863e | ||
|
|
2412931122 | ||
|
|
51838df0d7 | ||
|
|
e3e6f5561c | ||
|
|
a54a7aa4fb | ||
|
|
9de773ddae | ||
|
|
9a32cd9501 | ||
|
|
90d39a3974 | ||
|
|
6544513ca7 | ||
|
|
f7619f0685 | ||
|
|
a20c2ec2eb | ||
|
|
028734a42c | ||
|
|
29b9eadd57 | ||
|
|
83a33c2222 | ||
|
|
c274918244 | ||
|
|
57833bee13 | ||
|
|
0a1346f1c2 | ||
|
|
5145ae1714 | ||
|
|
086ec3e145 | ||
|
|
d538502457 | ||
|
|
978782e2fe | ||
|
|
ce1004d318 | ||
|
|
3545253844 | ||
|
|
ad69019ba6 | ||
|
|
b8f6a05538 | ||
|
|
98b40d325a | ||
|
|
8f2e58733d | ||
|
|
ae17f3d788 | ||
|
|
a71bbd5b14 | ||
|
|
05e1a7297c | ||
|
|
1f9965b13a | ||
|
|
fb32d2155b | ||
|
|
4c90bae87c | ||
|
|
05cfd5d8b0 | ||
|
|
b2fdcd5649 | ||
|
|
f4bfa83e24 | ||
|
|
4222dd9689 | ||
|
|
ccb2dae890 | ||
|
|
f7297c96c4 | ||
|
|
87f0810914 | ||
|
|
016c82fa85 | ||
|
|
fad866cf33 | ||
|
|
c3319ce109 | ||
|
|
ca5d7663f9 | ||
|
|
cee9c1f4d7 | ||
|
|
fb03d78234 | ||
|
|
e0134d680e | ||
|
|
8e855bc9bb | ||
|
|
2772d85603 | ||
|
|
acf06c78ed | ||
|
|
cda1610a58 | ||
|
|
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 |
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -23,7 +23,7 @@ A clear and concise description of what you expected to happen.
|
|||||||
**Screenshots**
|
**Screenshots**
|
||||||
If applicable, add screenshots to help explain your problem.
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
**Server VErsion (please complete the following information):**
|
**Server Version (please complete the following information):**
|
||||||
- Spigot Version: [e.g. Paperspigot 1.8.8]
|
- Spigot Version: [e.g. Paperspigot 1.8.8]
|
||||||
- Factions Version [use /f version]
|
- Factions Version [use /f version]
|
||||||
- Minecraft Version: [If a bug is dependent on client version]
|
- Minecraft Version: [If a bug is dependent on client version]
|
||||||
|
|||||||
37
README.md
37
README.md
@@ -1,9 +1,8 @@
|
|||||||
# SaberFactions
|
# SaberFactions
|
||||||
|
|
||||||
 [](https://www.codefactor.io/repository/github/driftay/saber-factions)
|
 [](https://www.codefactor.io/repository/github/driftay/saber-factions) [](https://github.com/SaberLLC/Saber-Factions/blob/1.6.x/LICENSE) 
|
||||||
|
|
||||||
SaberFactions is a fork of both FactionsUUID and SavageFactions. Creators of those plugins include DtrShock and ProSavage. Credits to them.
|
SaberFactions is an exotic, performance optmized, and feature rich factions plugin that focuses on not only making the player experience as great as possibly but maintaining this aspect with the cost of NOTHING! We strive to continue development for SaberFactions as the factions community is strongly growing and seeking new players every day.
|
||||||
SaberFactions is the newest, latest and greatest factions plugin designed for the best and most functional factions experience minecraft has seen!
|
|
||||||
|
|
||||||
## Some Exciting Features
|
## Some Exciting Features
|
||||||
Some of our features include the following
|
Some of our features include the following
|
||||||
@@ -14,21 +13,27 @@ Some of our features include the following
|
|||||||
* More F Upgrades - Unbreakable Redstone Upgrade, Members Upgrade, and Power Upgrade.
|
* More F Upgrades - Unbreakable Redstone Upgrade, Members Upgrade, and Power Upgrade.
|
||||||
* Factions Corner - In the corner of a world? No Problem /f corner will claim your entire buffer for you!
|
* Factions Corner - In the corner of a world? No Problem /f corner will claim your entire buffer for you!
|
||||||
* Command Cooldowns - Configurable Command Cooldowns for most "spam" commands. And so Much More to Come!
|
* Command Cooldowns - Configurable Command Cooldowns for most "spam" commands. And so Much More to Come!
|
||||||
|
* Faction Points - A point based currency that can be used for any aspect of factions gameplay!
|
||||||
|
* Faction Shop - A shop that essentially lets players buy in-game items in exchange for faction points!
|
||||||
|
* Faction Discord Integration - A discord intergrated factions bot for each faction to have their own personalized discord bot within their faction!
|
||||||
|
* Faction Audit - A full based logging system (GUI designed) to see every aspect of what happens in your faction!
|
||||||
|
* Factions Check System - An automated check system that alerts players when to check walls/buffers!
|
||||||
|
* Faction Reserves - A system designed to reserve a specific faction name for a specific player!
|
||||||
|
|
||||||
## Dependency With Maven
|
## Dependency With Maven
|
||||||
```
|
```
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jitpack.io</id>
|
<id>jitpack.io</id>
|
||||||
<url>https://jitpack.io</url>
|
<url>https://jitpack.io</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.Driftay</groupId>
|
<groupId>com.github.SaberLLC</groupId>
|
||||||
<artifactId>Saber-Factions</artifactId>
|
<artifactId>Saber-Factions</artifactId>
|
||||||
<version>1.4.1</version>
|
<version>2.2.7-STABLE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
## Moving Forward
|
## Moving Forward
|
||||||
|
|
||||||
@@ -36,8 +41,8 @@ Moving forward we plan to take all suggestions into consideration, as they come
|
|||||||
We Plan on Releasing the latest and greatest factions/skyblock/prison plugins minecraft has to offer and wont settle for anything less
|
We Plan on Releasing the latest and greatest factions/skyblock/prison plugins minecraft has to offer and wont settle for anything less
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
Our Discord is Currently In Progress of a Massive Overhaul, but we still encourage our community to join and express any concerns/questions/suggestions they may have!
|
Have a problem, question, or concer? We encourage our community to join and express any inquiry you may have
|
||||||
https://discord.gg/37JvmM
|
https://discord.saber.pw
|
||||||
|
|
||||||
Look forward to a bright future and a journey with all of you!
|
Look forward to a bright future and a journey with all of you!
|
||||||
|
|
||||||
|
|||||||
18
pom.xml
18
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.9-BETA</version>
|
<version>1.6.9.5-2.2.9-RC</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>
|
||||||
@@ -381,6 +385,12 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mojang</groupId>
|
||||||
|
<artifactId>authlib</artifactId>
|
||||||
|
<version>1.5.21</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>me.rayzr522</groupId>
|
<groupId>me.rayzr522</groupId>
|
||||||
<artifactId>jsonmessage</artifactId>
|
<artifactId>jsonmessage</artifactId>
|
||||||
@@ -401,6 +411,10 @@
|
|||||||
<name>bintray</name>
|
<name>bintray</name>
|
||||||
<url>http://jcenter.bintray.com</url>
|
<url>http://jcenter.bintray.com</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>mojang-repo</id>
|
||||||
|
<url>https://libraries.minecraft.net/</url>
|
||||||
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>net.coreprotect</id>
|
<id>net.coreprotect</id>
|
||||||
<url>http://maven.playpro.com/</url>
|
<url>http://maven.playpro.com/</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;
|
||||||
@@ -21,7 +22,7 @@ public class Conf {
|
|||||||
public static final transient double DYNMAP_STYLE_FILL_OPACITY = 0.35D;
|
public static final transient double DYNMAP_STYLE_FILL_OPACITY = 0.35D;
|
||||||
public static final transient String DYNMAP_STYLE_HOME_MARKER = "greenflag";
|
public static final transient String DYNMAP_STYLE_HOME_MARKER = "greenflag";
|
||||||
public static final transient boolean DYNMAP_STYLE_BOOST = false;
|
public static final transient boolean DYNMAP_STYLE_BOOST = false;
|
||||||
public static List<String> baseCommandAliases = new ArrayList<>();
|
public static List<String> baseCommandAliases = new ArrayList<>(Collections.singletonList("f"));
|
||||||
public static boolean allowNoSlashCommand = true;
|
public static boolean allowNoSlashCommand = true;
|
||||||
|
|
||||||
// Colors
|
// Colors
|
||||||
@@ -98,12 +99,37 @@ 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;
|
||||||
|
//RESERVE
|
||||||
|
public static boolean useReserveSystem = true;
|
||||||
|
//AUDIT
|
||||||
|
public static boolean useAuditSystem = true;
|
||||||
|
|
||||||
|
//GUI's
|
||||||
|
public static boolean useDisbandGUI = true;
|
||||||
|
|
||||||
//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;
|
||||||
@@ -115,6 +141,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;
|
||||||
@@ -219,6 +246,7 @@ public class Conf {
|
|||||||
public static boolean ownedMessageInsideTerritory = true;
|
public static boolean ownedMessageInsideTerritory = true;
|
||||||
public static boolean ownedMessageByChunk = false;
|
public static boolean ownedMessageByChunk = false;
|
||||||
public static boolean pistonProtectionThroughDenyBuild = true;
|
public static boolean pistonProtectionThroughDenyBuild = true;
|
||||||
|
public static Set<Material> loggableMaterials = EnumSet.noneOf(Material.class);
|
||||||
public static Set<Material> territoryProtectedMaterials = EnumSet.noneOf(Material.class);
|
public static Set<Material> territoryProtectedMaterials = EnumSet.noneOf(Material.class);
|
||||||
public static Set<Material> territoryDenyUsageMaterials = EnumSet.noneOf(Material.class);
|
public static Set<Material> territoryDenyUsageMaterials = EnumSet.noneOf(Material.class);
|
||||||
public static Set<Material> territoryProtectedMaterialsWhenOffline = EnumSet.noneOf(Material.class);
|
public static Set<Material> territoryProtectedMaterialsWhenOffline = EnumSet.noneOf(Material.class);
|
||||||
@@ -234,7 +262,6 @@ public class Conf {
|
|||||||
|
|
||||||
public static Set<Material> territoryCancelAndAllowItemUseMaterial = new HashSet<>();
|
public static Set<Material> territoryCancelAndAllowItemUseMaterial = new HashSet<>();
|
||||||
public static Set<Material> territoryDenySwitchMaterials = new HashSet<>();
|
public static Set<Material> territoryDenySwitchMaterials = new HashSet<>();
|
||||||
public static Set<Material> territoryBypasssProtectedMaterials = EnumSet.noneOf(Material.class);
|
|
||||||
public static boolean allowCreeperEggingChests = true;
|
public static boolean allowCreeperEggingChests = true;
|
||||||
|
|
||||||
// Economy settings
|
// Economy settings
|
||||||
@@ -384,7 +411,6 @@ public class Conf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
baseCommandAliases.add("f");
|
|
||||||
|
|
||||||
blacklistedFactionNames.add("somenamehere");
|
blacklistedFactionNames.add("somenamehere");
|
||||||
|
|
||||||
@@ -535,11 +561,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() {
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import java.util.Set;
|
|||||||
public class FLocation implements Serializable {
|
public class FLocation implements Serializable {
|
||||||
private static final long serialVersionUID = -8292915234027387983L;
|
private static final long serialVersionUID = -8292915234027387983L;
|
||||||
private static final boolean worldBorderSupport;
|
private static final boolean worldBorderSupport;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
boolean worldBorderClassPresent = false;
|
boolean worldBorderClassPresent = false;
|
||||||
try {
|
try {
|
||||||
@@ -22,7 +21,6 @@ public class FLocation implements Serializable {
|
|||||||
worldBorderClassPresent = true;
|
worldBorderClassPresent = true;
|
||||||
} catch (ClassNotFoundException ignored) {
|
} catch (ClassNotFoundException ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
worldBorderSupport = worldBorderClassPresent;
|
worldBorderSupport = worldBorderClassPresent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +43,7 @@ public class FLocation implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FLocation(Location location) {
|
public FLocation(Location location) {
|
||||||
this(location.getWorld().getName(), blockToChunk(location.getBlockX()), blockToChunk(location.getBlockZ()));
|
this(Objects.requireNonNull(location.getWorld()).getName(), blockToChunk(location.getBlockX()), blockToChunk(location.getBlockZ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public FLocation(Player player) {
|
public FLocation(Player player) {
|
||||||
@@ -70,8 +68,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,6 +150,8 @@ public class FLocation implements Serializable {
|
|||||||
return "" + x + "," + z;
|
return "" + x + "," + z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String formatXAndZ(String splitter) { return chunkToBlock(this.x) + "x" + splitter + " " + chunkToBlock(this.z) + "z"; }
|
||||||
|
|
||||||
//----------------------------------------------//
|
//----------------------------------------------//
|
||||||
// Misc Geometry
|
// Misc Geometry
|
||||||
//----------------------------------------------//
|
//----------------------------------------------//
|
||||||
@@ -178,9 +178,9 @@ public class FLocation implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInChunk(Location loc) {
|
public boolean isInChunk(Location loc) {
|
||||||
if (loc == null) {
|
if(loc == null) return false;
|
||||||
return false;
|
if(loc.getWorld() == null) return false;
|
||||||
}
|
|
||||||
Chunk chunk = loc.getChunk();
|
Chunk chunk = loc.getChunk();
|
||||||
return loc.getWorld().getName().equalsIgnoreCase(getWorldName()) && chunk.getX() == x && chunk.getZ() == z;
|
return loc.getWorld().getName().equalsIgnoreCase(getWorldName()) && chunk.getX() == x && chunk.getZ() == z;
|
||||||
}
|
}
|
||||||
@@ -192,18 +192,23 @@ public class FLocation implements Serializable {
|
|||||||
* @return whether this location is outside of the border
|
* @return whether this location is outside of the border
|
||||||
*/
|
*/
|
||||||
public boolean isOutsideWorldBorder(int buffer) {
|
public boolean isOutsideWorldBorder(int buffer) {
|
||||||
if (!worldBorderSupport) {
|
if (!worldBorderSupport) return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
WorldBorder border = getWorld().getWorldBorder();
|
WorldBorder border = getWorld().getWorldBorder();
|
||||||
Chunk chunk = border.getCenter().getChunk();
|
Location center = border.getCenter();
|
||||||
|
double size = border.getSize();
|
||||||
|
|
||||||
int lim = FLocation.chunkToRegion((int) border.getSize()) - buffer;
|
int bufferBlocks = buffer << 4;
|
||||||
int diffX = chunk.getX() - x;
|
|
||||||
int diffZ = chunk.getZ() - z;
|
|
||||||
|
|
||||||
return (diffX > lim || diffZ > lim) || (-diffX >= lim || -diffZ >= lim);
|
double borderMinX = (center.getX() - size / 2.0D) + bufferBlocks;
|
||||||
|
double borderMinZ = (center.getZ() - size / 2.0D) + bufferBlocks;
|
||||||
|
double borderMaxX = (center.getX() + size / 2.0D) - bufferBlocks;
|
||||||
|
double borderMaxZ = (center.getZ() + size / 2.0D) - bufferBlocks;
|
||||||
|
|
||||||
|
int chunkMinX = this.x << 4;
|
||||||
|
int chunkMaxX = chunkMinX | 15;
|
||||||
|
int chunkMinZ = this.z << 4;
|
||||||
|
int chunkMaxZ = chunkMinZ | 15;
|
||||||
|
return (chunkMinX >= borderMaxX) || (chunkMinZ >= borderMaxZ) || (chunkMaxX <= borderMinX) || (chunkMaxZ <= borderMinZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------//
|
//----------------------------------------------//
|
||||||
@@ -213,10 +218,7 @@ public class FLocation implements Serializable {
|
|||||||
double radiusSquared = radius * radius;
|
double radiusSquared = radius * radius;
|
||||||
|
|
||||||
Set<FLocation> ret = new LinkedHashSet<>();
|
Set<FLocation> ret = new LinkedHashSet<>();
|
||||||
if (radius <= 0) {
|
if (radius <= 0) return ret;
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int xfrom = (int) Math.floor(this.x - radius);
|
int xfrom = (int) Math.floor(this.x - radius);
|
||||||
int xto = (int) Math.ceil(this.x + radius);
|
int xto = (int) Math.ceil(this.x + radius);
|
||||||
int zfrom = (int) Math.floor(this.z - radius);
|
int zfrom = (int) Math.floor(this.z - radius);
|
||||||
@@ -230,7 +232,6 @@ public class FLocation implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,13 +247,8 @@ public class FLocation implements Serializable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == this) {
|
if (obj == this) return true;
|
||||||
return true;
|
if (!(obj instanceof FLocation)) return false;
|
||||||
}
|
|
||||||
if (!(obj instanceof FLocation)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
FLocation that = (FLocation) obj;
|
FLocation that = (FLocation) obj;
|
||||||
return this.x == that.x && this.z == that.z && (Objects.equals(this.worldName, that.worldName));
|
return this.x == that.x && this.z == that.z && (Objects.equals(this.worldName, that.worldName));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,12 +7,15 @@ 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;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,6 +33,85 @@ public interface FPlayer extends EconomyParticipator {
|
|||||||
|
|
||||||
boolean hasNotificationsEnabled();
|
boolean hasNotificationsEnabled();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a player has enemies nearby based on the enemy check task in CmdFly
|
||||||
|
* NOTE: THIS VALUE IS ONLY UPDATED WHEN A USER IS USING FLY
|
||||||
|
* @return enemiesNearby as a boolean
|
||||||
|
*/
|
||||||
|
boolean hasEnemiesNearby();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set if this FPlayer has an enemy nearby
|
||||||
|
* @param b enemiesNearby
|
||||||
|
*/
|
||||||
|
void setEnemiesNearby(Boolean b);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get this players inventory prior to entering the duel (Will be set to null after duel!)
|
||||||
|
* @return Map of old inventory contents
|
||||||
|
*/
|
||||||
|
Map<Integer, ItemStack> getOldInv();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set this players stored inventory, this inventory will be retrieved after a duel is complete
|
||||||
|
* @param inv Map of inventory contents
|
||||||
|
*/
|
||||||
|
void setOldInv(Map<Integer, ItemStack> inv);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to check if player has entered a duel and has not proceeded
|
||||||
|
* @return boolean determining if the player is in a duel
|
||||||
|
*/
|
||||||
|
boolean isInDuel();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used before and after duels to set the inDuel status of the FPlayer
|
||||||
|
* @param b Desired status
|
||||||
|
*/
|
||||||
|
void setInDuel(Boolean b);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get if a player has setup their Discord before
|
||||||
|
* @return if the player setup Discord as a boolean
|
||||||
|
*/
|
||||||
|
boolean discordSetup();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the players Discord user ID
|
||||||
|
* @return players Discord user ID as a String
|
||||||
|
*/
|
||||||
|
String discordUserID();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the players Boolean defining if the player has setup their Discord
|
||||||
|
* @param b Boolean for discordSetup to be defined to
|
||||||
|
*/
|
||||||
|
void setDiscordSetup(Boolean b);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the players Discord user ID
|
||||||
|
* @param s String for their user ID to be set to
|
||||||
|
*/
|
||||||
|
void setDiscordUserID(String s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the players Discord user (If the player has not setup Discord it will return null!)
|
||||||
|
* @return User from players set Discord User ID
|
||||||
|
*/
|
||||||
|
User discordUser();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to check if this player should be served titles
|
||||||
|
* @return if this FPlayer has titles enabled as a boolean
|
||||||
|
*/
|
||||||
|
boolean hasTitlesEnabled();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to set if player should be served titles
|
||||||
|
* @param b Boolean to titlesEnabled to
|
||||||
|
*/
|
||||||
|
void setTitlesEnabled(Boolean b);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to determine if a player is in their faction's chest
|
* Used to determine if a player is in their faction's chest
|
||||||
* @return if player is in their faction's as a boolean
|
* @return if player is in their faction's as a boolean
|
||||||
@@ -218,7 +300,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);
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
public interface Faction extends EconomyParticipator {
|
public interface Faction extends EconomyParticipator {
|
||||||
|
|
||||||
|
void broadcast(String s);
|
||||||
|
|
||||||
String getMemberRoleId();
|
String getMemberRoleId();
|
||||||
|
|
||||||
void setMemberRoleId(String roleId);
|
void setMemberRoleId(String roleId);
|
||||||
@@ -441,4 +443,7 @@ public interface Faction extends EconomyParticipator {
|
|||||||
|
|
||||||
void paypalSet(String paypal);
|
void paypalSet(String paypal);
|
||||||
|
|
||||||
|
// -------------------------------
|
||||||
|
// Shields
|
||||||
|
// -------------------------------
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,15 +4,17 @@ import ch.njol.skript.Skript;
|
|||||||
import ch.njol.skript.SkriptAddon;
|
import ch.njol.skript.SkriptAddon;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.massivecraft.factions.cmd.CmdAutoHelp;
|
import com.massivecraft.factions.cmd.*;
|
||||||
import com.massivecraft.factions.cmd.CommandContext;
|
import com.massivecraft.factions.cmd.audit.FChestListener;
|
||||||
import com.massivecraft.factions.cmd.FCmdRoot;
|
import com.massivecraft.factions.cmd.audit.FLogManager;
|
||||||
import com.massivecraft.factions.cmd.FCommand;
|
import com.massivecraft.factions.cmd.audit.FLogType;
|
||||||
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.reserve.ListParameterizedType;
|
||||||
|
import com.massivecraft.factions.cmd.reserve.ReserveObject;
|
||||||
|
import com.massivecraft.factions.discord.Discord;
|
||||||
import com.massivecraft.factions.discord.DiscordListener;
|
import com.massivecraft.factions.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;
|
||||||
@@ -24,12 +26,14 @@ import com.massivecraft.factions.struct.Relation;
|
|||||||
import com.massivecraft.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
import com.massivecraft.factions.util.*;
|
import com.massivecraft.factions.util.*;
|
||||||
import com.massivecraft.factions.util.Particles.ReflectionUtils;
|
import com.massivecraft.factions.util.Particles.ReflectionUtils;
|
||||||
|
import com.massivecraft.factions.util.Sync.SyncExecutor;
|
||||||
|
import com.massivecraft.factions.util.Wait.WaitExecutor;
|
||||||
import com.massivecraft.factions.zcore.CommandVisibility;
|
import com.massivecraft.factions.zcore.CommandVisibility;
|
||||||
import com.massivecraft.factions.zcore.MPlugin;
|
import com.massivecraft.factions.zcore.MPlugin;
|
||||||
import com.massivecraft.factions.zcore.fperms.Access;
|
import com.massivecraft.factions.zcore.fperms.Access;
|
||||||
import com.massivecraft.factions.zcore.fperms.Permissable;
|
import com.massivecraft.factions.zcore.fperms.Permissable;
|
||||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.fupgrades.*;
|
import com.massivecraft.factions.zcore.fupgrades.UpgradesListener;
|
||||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
import com.massivecraft.factions.zcore.util.TextUtil;
|
||||||
import me.lucko.commodore.CommodoreProvider;
|
import me.lucko.commodore.CommodoreProvider;
|
||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
@@ -37,8 +41,6 @@ import net.milkbowl.vault.permission.Permission;
|
|||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.ArmorStand;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
@@ -51,6 +53,9 @@ import org.bukkit.plugin.RegisteredServiceProvider;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.OpenOption;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@@ -67,7 +72,6 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
// Plugins can check this boolean while hooking in have
|
// Plugins can check this boolean while hooking in have
|
||||||
// a green light to use the api.
|
// a green light to use the api.
|
||||||
public static boolean startupFinished = false;
|
public static boolean startupFinished = false;
|
||||||
public static Economy econ = null;
|
|
||||||
public boolean PlaceholderApi;
|
public boolean PlaceholderApi;
|
||||||
// Commands
|
// Commands
|
||||||
public FCmdRoot cmdBase;
|
public FCmdRoot cmdBase;
|
||||||
@@ -77,6 +81,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
public boolean mc112 = false;
|
public boolean mc112 = false;
|
||||||
public boolean mc113 = false;
|
public boolean mc113 = false;
|
||||||
public boolean mc114 = false;
|
public boolean mc114 = false;
|
||||||
|
public boolean mc115 = false;
|
||||||
public boolean useNonPacketParticles = false;
|
public boolean useNonPacketParticles = false;
|
||||||
public boolean factionsFlight = false;
|
public boolean factionsFlight = false;
|
||||||
SkriptAddon skriptAddon;
|
SkriptAddon skriptAddon;
|
||||||
@@ -90,6 +95,8 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
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;
|
private Worldguard wg;
|
||||||
|
private FLogManager fLogManager;
|
||||||
|
private List<ReserveObject> reserveObjects;
|
||||||
|
|
||||||
|
|
||||||
public FactionsPlugin() {
|
public FactionsPlugin() {
|
||||||
@@ -119,25 +126,19 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void playSoundForAll(String sound) {
|
public void playSoundForAll(String sound) {
|
||||||
for (Player pl : Bukkit.getOnlinePlayers()) {
|
for (Player pl : Bukkit.getOnlinePlayers()) playSound(pl, sound);
|
||||||
playSound(pl, sound);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playSoundForAll(List<String> sounds) {
|
public void playSoundForAll(List<String> sounds) {
|
||||||
for (Player pl : Bukkit.getOnlinePlayers()) {
|
for (Player pl : Bukkit.getOnlinePlayers()) playSound(pl, sounds);
|
||||||
playSound(pl, sounds);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playSound(Player p, List<String> sounds) {
|
public void playSound(Player p, List<String> sounds) {
|
||||||
for (String sound : sounds) {
|
for (String sound : sounds) playSound(p, sound);
|
||||||
playSound(p, sound);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playSound(Player p, String sound) {
|
public void playSound(Player p, String sound) {
|
||||||
float pitch = Float.valueOf(sound.split(":")[1]);
|
float pitch = Float.parseFloat(sound.split(":")[1]);
|
||||||
sound = sound.split(":")[0];
|
sound = sound.split(":")[0];
|
||||||
p.playSound(p.getLocation(), Sound.valueOf(sound), pitch, 5.0F);
|
p.playSound(p.getLocation(), Sound.valueOf(sound), pitch, 5.0F);
|
||||||
}
|
}
|
||||||
@@ -167,37 +168,44 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
FactionsPlugin.instance.log("Minecraft Version 1.14 found.");
|
FactionsPlugin.instance.log("Minecraft Version 1.14 found.");
|
||||||
mc114 = true;
|
mc114 = true;
|
||||||
break;
|
break;
|
||||||
|
case 15:
|
||||||
|
FactionsPlugin.instance.log("Minecraft Version 1.15 found.");
|
||||||
|
mc115 = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
migrateFPlayerLeaders();
|
migrateFPlayerLeaders();
|
||||||
log("==== End Setup ====");
|
log("==== End Setup ====");
|
||||||
|
|
||||||
if (!preEnable()) {
|
if (!preEnable()) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.loadSuccessful = false;
|
this.loadSuccessful = false;
|
||||||
|
|
||||||
if (!new File(this.getDataFolder() + "/config.yml").exists()) {
|
if (!new File(this.getDataFolder() + "/config.yml").exists()) {
|
||||||
this.saveResource("config.yml", false);
|
this.saveResource("config.yml", false);
|
||||||
this.reloadConfig();
|
this.reloadConfig();
|
||||||
}
|
}
|
||||||
|
//Start synctask
|
||||||
|
SyncExecutor.startTask();
|
||||||
|
//Start wait task executor
|
||||||
|
WaitExecutor.startTask();
|
||||||
//Attempt to generate a permission list
|
//Attempt to generate a permission list
|
||||||
PermissionList.generateFile();
|
PermissionList.generateFile();
|
||||||
// Load Conf from disk
|
// Load Conf from disk
|
||||||
Conf.load();
|
Conf.load();
|
||||||
|
fLogManager = new FLogManager();
|
||||||
//Dependency checks
|
//Dependency checks
|
||||||
if (Conf.dependencyCheck && (!Bukkit.getPluginManager().isPluginEnabled("Vault") && !Bukkit.getPluginManager().isPluginEnabled("Essentials"))) {
|
if (Conf.dependencyCheck && (!Bukkit.getPluginManager().isPluginEnabled("Vault"))) {
|
||||||
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 Vault is installed!");
|
||||||
Conf.save();
|
Conf.save();
|
||||||
Bukkit.getPluginManager().disablePlugin(instance);
|
Bukkit.getPluginManager().disablePlugin(instance);
|
||||||
divider();
|
divider();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//TODO fix this
|
||||||
//Update their config if needed
|
//Update their config if needed
|
||||||
// Updater.updateIfNeeded(getConfig());
|
// Updater.updateIfNeeded(getConfig());
|
||||||
RegisteredServiceProvider<Economy> rsp = FactionsPlugin.this.getServer().getServicesManager().getRegistration(Economy.class);
|
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();
|
||||||
@@ -210,20 +218,15 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
fPlayer.resetFactionData(false);
|
fPlayer.resetFactionData(false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (fPlayer.isAlt()) {
|
if (fPlayer.isAlt()) faction.addAltPlayer(fPlayer);
|
||||||
faction.addAltPlayer(fPlayer);
|
else faction.addFPlayer(fPlayer);
|
||||||
} else {
|
|
||||||
faction.addFPlayer(fPlayer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getConfig().getBoolean("enable-faction-flight", true)) {
|
|
||||||
UtilFly.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
Board.getInstance().load();
|
Board.getInstance().load();
|
||||||
Board.getInstance().clean();
|
Board.getInstance().clean();
|
||||||
|
//Load command aliases
|
||||||
|
Aliases.load();
|
||||||
// Add Base Commands
|
// Add Base Commands
|
||||||
this.cmdBase = new FCmdRoot();
|
this.cmdBase = new FCmdRoot();
|
||||||
this.cmdAutoHelp = new CmdAutoHelp();
|
this.cmdAutoHelp = new CmdAutoHelp();
|
||||||
@@ -243,9 +246,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
log("Minecraft Version 1.9 or higher found, using non packet based particle API");
|
log("Minecraft Version 1.9 or higher found, using non packet based particle API");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getConfig().getBoolean("enable-faction-flight")) {
|
if (getConfig().getBoolean("enable-faction-flight")) factionsFlight = true;
|
||||||
factionsFlight = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getServer().getPluginManager().getPlugin("Skript") != null) {
|
if (getServer().getPluginManager().getPlugin("Skript") != null) {
|
||||||
log("Skript was found! Registering FactionsPlugin Addon...");
|
log("Skript was found! Registering FactionsPlugin Addon...");
|
||||||
@@ -259,21 +260,19 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
}
|
}
|
||||||
if (Conf.useCheckSystem) {
|
if (Conf.useCheckSystem) {
|
||||||
int minute = 1200;
|
int minute = 1200;
|
||||||
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new CheckTask(this, 3), 0L, (long) (minute * 3));
|
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new CheckTask(this, 3), 0L, minute * 3);
|
||||||
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new CheckTask(this, 5), 0L, (long) (minute * 5));
|
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new CheckTask(this, 5), 0L, minute * 5);
|
||||||
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new CheckTask(this, 10), 0L, (long) (minute * 10));
|
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new CheckTask(this, 10), 0L, minute * 10);
|
||||||
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new CheckTask(this, 15), 0L, (long) (minute * 15));
|
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new CheckTask(this, 15), 0L, minute * 15);
|
||||||
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new CheckTask(this, 30), 0L, (long) (minute * 30));
|
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new CheckTask(this, 30), 0L, minute * 30);
|
||||||
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();
|
||||||
|
fLogManager.loadLogs(this);
|
||||||
|
|
||||||
getServer().getPluginManager().registerEvents(factionsPlayerListener = new FactionsPlayerListener(), this);
|
getServer().getPluginManager().registerEvents(factionsPlayerListener = new FactionsPlayerListener(), this);
|
||||||
|
|
||||||
@@ -283,9 +282,10 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
new FactionsEntityListener(),
|
new FactionsEntityListener(),
|
||||||
new FactionsExploitListener(),
|
new FactionsExploitListener(),
|
||||||
new FactionsBlockListener(),
|
new FactionsBlockListener(),
|
||||||
new FUpgradesGUI(),
|
|
||||||
new UpgradesListener(),
|
new UpgradesListener(),
|
||||||
new MissionHandler(this),
|
new MissionHandler(this),
|
||||||
|
new FChestListener(),
|
||||||
|
new MenuListener(),
|
||||||
new AntiChestListener()
|
new AntiChestListener()
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -295,7 +295,25 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
this.getCommand(refCommand).setExecutor(cmdBase);
|
this.getCommand(refCommand).setExecutor(cmdBase);
|
||||||
|
|
||||||
if (!CommodoreProvider.isSupported()) this.getCommand(refCommand).setTabCompleter(this);
|
if (!CommodoreProvider.isSupported()) this.getCommand(refCommand).setTabCompleter(this);
|
||||||
|
reserveObjects = new ArrayList<>();
|
||||||
|
String path = Paths.get(this.getDataFolder().getAbsolutePath()).toAbsolutePath().toString() + File.separator + "reserves.json";
|
||||||
|
File file = new File(path);
|
||||||
|
try {
|
||||||
|
String json;
|
||||||
|
if (!file.exists()) {
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
file.createNewFile();
|
||||||
|
}
|
||||||
|
json = String.join("", Files.readAllLines(Paths.get(file.getPath()))).replace("\n", "").replace("\r", "");
|
||||||
|
if (json.equalsIgnoreCase("")) {
|
||||||
|
Files.write(Paths.get(path), "[]".getBytes());
|
||||||
|
json = "[]";
|
||||||
|
}
|
||||||
|
reserveObjects = this.getGsonBuilder().create().fromJson(json, new ListParameterizedType(ReserveObject.class));
|
||||||
|
if (reserveObjects == null) reserveObjects = new ArrayList<>();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
if (getDescription().getFullName().contains("BETA")) {
|
if (getDescription().getFullName().contains("BETA")) {
|
||||||
divider();
|
divider();
|
||||||
System.out.println("You are using a BETA version of the plugin!");
|
System.out.println("You are using a BETA version of the plugin!");
|
||||||
@@ -352,7 +370,6 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
try {
|
try {
|
||||||
BufferedReader br = new BufferedReader(new FileReader(fplayerFile));
|
BufferedReader br = new BufferedReader(new FileReader(fplayerFile));
|
||||||
System.out.println("Migrating old players.json file.");
|
System.out.println("Migrating old players.json file.");
|
||||||
|
|
||||||
String line;
|
String line;
|
||||||
while ((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
if (line.contains("\"role\": \"ADMIN\"")) {
|
if (line.contains("\"role\": \"ADMIN\"")) {
|
||||||
@@ -384,9 +401,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
private boolean setupPermissions() {
|
private boolean setupPermissions() {
|
||||||
try {
|
try {
|
||||||
RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
|
RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
|
||||||
if (rsp != null) {
|
if (rsp != null) perms = rsp.getProvider();
|
||||||
perms = rsp.getProvider();
|
|
||||||
}
|
|
||||||
} catch (NoClassDefFoundError ex) {
|
} catch (NoClassDefFoundError ex) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -415,7 +430,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("`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-'");
|
||||||
@@ -423,24 +438,41 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
// only save data if plugin actually completely loaded successfully
|
try {
|
||||||
if (this.loadSuccessful) {
|
String path = Paths.get(getDataFolder().getAbsolutePath()).toAbsolutePath().toString() + File.separator + "reserves.json";
|
||||||
Conf.saveSync();
|
File file = new File(path);
|
||||||
|
if (!file.exists()) {
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
file.createNewFile();
|
||||||
|
}
|
||||||
|
Files.write(Paths.get(file.getPath()),getGsonBuilder().create().toJson(reserveObjects).getBytes());
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only save data if plugin actually completely loaded successfully
|
||||||
|
if (this.loadSuccessful) Conf.saveSync();
|
||||||
|
|
||||||
|
|
||||||
if (AutoLeaveTask != null) {
|
if (AutoLeaveTask != null) {
|
||||||
this.getServer().getScheduler().cancelTask(AutoLeaveTask);
|
this.getServer().getScheduler().cancelTask(AutoLeaveTask);
|
||||||
AutoLeaveTask = null;
|
AutoLeaveTask = null;
|
||||||
}
|
}
|
||||||
DiscordListener.saveGuilds();
|
DiscordListener.saveGuilds();
|
||||||
|
if (Discord.jda != null) {
|
||||||
|
Discord.jda.shutdownNow();
|
||||||
|
}
|
||||||
super.onDisable();
|
super.onDisable();
|
||||||
|
try {
|
||||||
|
fLogManager.saveLogs();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startAutoLeaveTask(boolean restartIfRunning) {
|
public void startAutoLeaveTask(boolean restartIfRunning) {
|
||||||
if (AutoLeaveTask != null) {
|
if (AutoLeaveTask != null) {
|
||||||
if (!restartIfRunning) {
|
if (!restartIfRunning) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.getServer().getScheduler().cancelTask(AutoLeaveTask);
|
this.getServer().getScheduler().cancelTask(AutoLeaveTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,7 +489,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack createItem(Material material, int amount, short datavalue, String name, List<String> lore) {
|
public ItemStack createItem(Material material, int amount, short datavalue, String name, List<String> lore) {
|
||||||
ItemStack item = new ItemStack(XMaterial.matchXMaterial(material.toString()).parseMaterial(), amount, datavalue);
|
ItemStack item = new ItemStack(XMaterial.matchXMaterial(material.toString()).get().parseMaterial(), amount, datavalue);
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setDisplayName(color(name));
|
meta.setDisplayName(color(name));
|
||||||
meta.setLore(colorList(lore));
|
meta.setLore(colorList(lore));
|
||||||
@@ -492,9 +524,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] split) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] split) {
|
||||||
if (split.length == 0) {
|
if (split.length == 0) return handleCommand(sender, "/f help", false);
|
||||||
return handleCommand(sender, "/f help", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// otherwise, needs to be handled; presumably another plugin directly ran the command
|
// otherwise, needs to be handled; presumably another plugin directly ran the command
|
||||||
String cmd = Conf.baseCommandAliases.isEmpty() ? "/f" : "/" + Conf.baseCommandAliases.get(0);
|
String cmd = Conf.baseCommandAliases.isEmpty() ? "/f" : "/" + Conf.baseCommandAliases.get(0);
|
||||||
@@ -507,8 +537,6 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
// Must be a LinkedList to prevent UnsupportedOperationException.
|
// Must be a LinkedList to prevent UnsupportedOperationException.
|
||||||
List<String> argsList = new LinkedList<>(Arrays.asList(args));
|
List<String> argsList = new LinkedList<>(Arrays.asList(args));
|
||||||
CommandContext context = new CommandContext(sender, argsList, alias);
|
CommandContext context = new CommandContext(sender, argsList, alias);
|
||||||
String cmd = Conf.baseCommandAliases.isEmpty() ? "/f" : "/" + Conf.baseCommandAliases.get(0);
|
|
||||||
// String cmdValid = (cmd + " " + TextUtil.implode(context.args, " ")).trim();
|
|
||||||
List<FCommand> commandsList = cmdBase.subCommands;
|
List<FCommand> commandsList = cmdBase.subCommands;
|
||||||
FCommand commandsEx = cmdBase;
|
FCommand commandsEx = cmdBase;
|
||||||
List<String> completions = new ArrayList<>();
|
List<String> completions = new ArrayList<>();
|
||||||
@@ -537,16 +565,12 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
String lastArg = args[args.length - 1].toLowerCase();
|
String lastArg = args[args.length - 1].toLowerCase();
|
||||||
|
|
||||||
completions = completions.stream()
|
completions = completions.stream()
|
||||||
.filter(m -> m.toLowerCase().startsWith(lastArg))
|
.filter(m -> m.toLowerCase().startsWith(lastArg))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
return completions;
|
return completions;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
String lastArg = args[args.length - 1].toLowerCase();
|
String lastArg = args[args.length - 1].toLowerCase();
|
||||||
|
|
||||||
for (Role value : Role.values()) completions.add(value.nicename);
|
for (Role value : Role.values()) completions.add(value.nicename);
|
||||||
for (Relation value : Relation.values()) completions.add(value.nicename);
|
for (Relation value : Relation.values()) completions.add(value.nicename);
|
||||||
// The stream and foreach from the old implementation looped 2 times, by looping all players -> filtered -> looped filter and added -> filtered AGAIN at the end.
|
// The stream and foreach from the old implementation looped 2 times, by looping all players -> filtered -> looped filter and added -> filtered AGAIN at the end.
|
||||||
@@ -559,22 +583,6 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createTimedHologram(final Location location, String text, Long timeout) {
|
|
||||||
ArmorStand as = (ArmorStand) location.add(0.5, 1, 0.5).getWorld().spawnEntity(location, EntityType.ARMOR_STAND); //Spawn the ArmorStand
|
|
||||||
as.setVisible(false); //Makes the ArmorStand invisible
|
|
||||||
as.setGravity(false); //Make sure it doesn't fall
|
|
||||||
as.setCanPickupItems(false); //I'm not sure what happens if you leave this as it is, but you might as well disable it
|
|
||||||
as.setCustomName(FactionsPlugin.instance.color(text)); //Set this to the text you want
|
|
||||||
as.setCustomNameVisible(true); //This makes the text appear no matter if your looking at the entity or not
|
|
||||||
final ArmorStand armorStand = as;
|
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(FactionsPlugin.instance, () -> {
|
|
||||||
armorStand.remove();
|
|
||||||
getLogger().info("Removing Hologram.");
|
|
||||||
}
|
|
||||||
, timeout * 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// Functions for other plugins to hook into
|
// Functions for other plugins to hook into
|
||||||
@@ -601,11 +609,8 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
// Does player have Faction Chat enabled? If so, chat plugins should preferably not do channels,
|
// Does player have Faction Chat enabled? If so, chat plugins should preferably not do channels,
|
||||||
// local chat, or anything else which targets individual recipients, so Faction Chat can be done
|
// local chat, or anything else which targets individual recipients, so Faction Chat can be done
|
||||||
public boolean isPlayerFactionChatting(Player player) {
|
public boolean isPlayerFactionChatting(Player player) {
|
||||||
if (player == null) {
|
if (player == null) return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
FPlayer me = FPlayers.getInstance().getByPlayer(player);
|
FPlayer me = FPlayers.getInstance().getByPlayer(player);
|
||||||
|
|
||||||
return me != null && me.getChatMode().isAtLeast(ChatMode.ALLIANCE);
|
return me != null && me.getChatMode().isAtLeast(ChatMode.ALLIANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -626,15 +631,11 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
public String getPlayerFactionTagRelation(Player speaker, Player listener) {
|
public String getPlayerFactionTagRelation(Player speaker, Player listener) {
|
||||||
String tag = "~";
|
String tag = "~";
|
||||||
|
|
||||||
if (speaker == null) {
|
if (speaker == null) return tag;
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
FPlayer me = FPlayers.getInstance().getByPlayer(speaker);
|
FPlayer me = FPlayers.getInstance().getByPlayer(speaker);
|
||||||
if (me == null) {
|
if (me == null) return tag;
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if listener isn't set, or config option is disabled, give back uncolored tag
|
// if listener isn't set, or config option is disabled, give back uncolored tag
|
||||||
if (listener == null || !Conf.chatTagRelationColored) {
|
if (listener == null || !Conf.chatTagRelationColored) {
|
||||||
tag = me.getChatTag().trim();
|
tag = me.getChatTag().trim();
|
||||||
@@ -642,29 +643,28 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
FPlayer you = FPlayers.getInstance().getByPlayer(listener);
|
FPlayer you = FPlayers.getInstance().getByPlayer(listener);
|
||||||
if (you == null) {
|
if (you == null) {
|
||||||
tag = me.getChatTag().trim();
|
tag = me.getChatTag().trim();
|
||||||
} else // everything checks out, give the colored tag
|
} else { // everything checks out, give the colored tag
|
||||||
{
|
|
||||||
tag = me.getChatTag(you).trim();
|
tag = me.getChatTag(you).trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tag.isEmpty()) {
|
if (tag.isEmpty()) tag = "~";
|
||||||
tag = "~";
|
|
||||||
}
|
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public FLogManager getFlogManager() {
|
||||||
|
return fLogManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void logFactionEvent(Faction faction, FLogType type, String... arguments) {
|
||||||
|
this.fLogManager.log(faction, type, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
// Get a player's title within their faction, mainly for usage by chat plugins for local/channel chat
|
// Get a player's title within their faction, mainly for usage by chat plugins for local/channel chat
|
||||||
public String getPlayerTitle(Player player) {
|
public String getPlayerTitle(Player player) {
|
||||||
if (player == null) {
|
if (player == null) return "";
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
FPlayer me = FPlayers.getInstance().getByPlayer(player);
|
FPlayer me = FPlayers.getInstance().getByPlayer(player);
|
||||||
if (me == null) {
|
if (me == null) return "";
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return me.getTitle().trim();
|
return me.getTitle().trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -675,9 +675,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
|
|
||||||
//colors a string list
|
//colors a string list
|
||||||
public List<String> colorList(List<String> lore) {
|
public List<String> colorList(List<String> lore) {
|
||||||
for (int i = 0; i <= lore.size() - 1; i++) {
|
for (int i = 0; i <= lore.size() - 1; i++) lore.set(i, color(lore.get(i)));
|
||||||
lore.set(i, color(lore.get(i)));
|
|
||||||
}
|
|
||||||
return lore;
|
return lore;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -686,14 +684,16 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
return Factions.getInstance().getFactionTags();
|
return Factions.getInstance().getFactionTags();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ReserveObject> getFactionReserves() {
|
||||||
|
return this.reserveObjects;
|
||||||
|
}
|
||||||
|
|
||||||
// Get a list of all players in the specified faction
|
// Get a list of all players in the specified faction
|
||||||
public Set<String> getPlayersInFaction(String factionTag) {
|
public Set<String> getPlayersInFaction(String factionTag) {
|
||||||
Set<String> players = new HashSet<>();
|
Set<String> players = new HashSet<>();
|
||||||
Faction faction = Factions.getInstance().getByTag(factionTag);
|
Faction faction = Factions.getInstance().getByTag(factionTag);
|
||||||
if (faction != null) {
|
if (faction != null) {
|
||||||
for (FPlayer fplayer : faction.getFPlayers()) {
|
for (FPlayer fplayer : faction.getFPlayers()) players.add(fplayer.getName());
|
||||||
players.add(fplayer.getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return players;
|
return players;
|
||||||
}
|
}
|
||||||
@@ -703,9 +703,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
Set<String> players = new HashSet<>();
|
Set<String> players = new HashSet<>();
|
||||||
Faction faction = Factions.getInstance().getByTag(factionTag);
|
Faction faction = Factions.getInstance().getByTag(factionTag);
|
||||||
if (faction != null) {
|
if (faction != null) {
|
||||||
for (FPlayer fplayer : faction.getFPlayersWhereOnline(true)) {
|
for (FPlayer fplayer : faction.getFPlayersWhereOnline(true)) players.add(fplayer.getName());
|
||||||
players.add(fplayer.getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return players;
|
return players;
|
||||||
}
|
}
|
||||||
@@ -725,9 +723,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void debug(Level level, String s) {
|
public void debug(Level level, String s) {
|
||||||
if (getConfig().getBoolean("debug", false)) {
|
if (getConfig().getBoolean("debug", false)) getLogger().log(level, s);
|
||||||
getLogger().log(level, s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public FactionsPlayerListener getFactionsPlayerListener() {
|
public FactionsPlayerListener getFactionsPlayerListener() {
|
||||||
|
|||||||
150
src/main/java/com/massivecraft/factions/cmd/Aliases.java
Normal file
150
src/main/java/com/massivecraft/factions/cmd/Aliases.java
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DroppingAnvil
|
||||||
|
*/
|
||||||
|
public class Aliases {
|
||||||
|
public static ArrayList<String> alts_alts = new ArrayList<>(Arrays.asList("alts", "alt"));
|
||||||
|
public static ArrayList<String> alts_list = new ArrayList<>(Arrays.asList("list", "l"));
|
||||||
|
public static ArrayList<String> alts_invite = new ArrayList<>(Collections.singletonList("invite"));
|
||||||
|
public static ArrayList<String> alts_kick = new ArrayList<>(Collections.singletonList("kick"));
|
||||||
|
public static ArrayList<String> audit = new ArrayList<>(Arrays.asList("audit", "log", "logs"));
|
||||||
|
public static ArrayList<String> check = new ArrayList<>(Arrays.asList("check"));
|
||||||
|
public static ArrayList<String> weewoo = new ArrayList<>(Collections.singletonList("weewoo"));
|
||||||
|
public static ArrayList<String> chest = new ArrayList<>(Arrays.asList("chest", "pv"));
|
||||||
|
public static ArrayList<String> claim_auto = new ArrayList<>(Collections.singletonList("autoclaim"));
|
||||||
|
public static ArrayList<String> claim_claim = new ArrayList<>(Collections.singletonList("claim"));
|
||||||
|
public static ArrayList<String> claim_at = new ArrayList<>(Collections.singletonList("claimat"));
|
||||||
|
public static ArrayList<String> claim_line = new ArrayList<>(Arrays.asList("claimline", "cl"));
|
||||||
|
public static ArrayList<String> claim_corner = new ArrayList<>(Arrays.asList("corner"));
|
||||||
|
public static ArrayList<String> unclaim_all_safe = new ArrayList<>(Arrays.asList("safeunclaimall", "safedeclaimall"));
|
||||||
|
public static ArrayList<String> unclaim_unclaim = new ArrayList<>(Arrays.asList("unclaim", "declaim"));
|
||||||
|
public static ArrayList<String> unclaim_all_unsafe = new ArrayList<>(Arrays.asList("unclaimall", "declaimall"));
|
||||||
|
public static ArrayList<String> unclaim_all_war = new ArrayList<>(Arrays.asList("warunclaimall", "wardeclaimall"));
|
||||||
|
public static ArrayList<String> money_money = new ArrayList<>(Arrays.asList("money", "bank"));
|
||||||
|
public static ArrayList<String> money_balance = new ArrayList<>(Arrays.asList("b", "balance"));
|
||||||
|
public static ArrayList<String> money_deposit = new ArrayList<>(Arrays.asList("d", "deposit"));
|
||||||
|
public static ArrayList<String> money_transfer_Ff = new ArrayList<>(Collections.singletonList("ff"));
|
||||||
|
public static ArrayList<String> money_transfer_Fp = new ArrayList<>(Collections.singletonList("fp"));
|
||||||
|
public static ArrayList<String> money_transfer_Pf = new ArrayList<>(Collections.singletonList("pf"));
|
||||||
|
public static ArrayList<String> money_withdraw = new ArrayList<>(Arrays.asList("w", "withdraw"));
|
||||||
|
public static ArrayList<String> grace = new ArrayList<>(Collections.singletonList("grace"));
|
||||||
|
public static ArrayList<String> logout = new ArrayList<>(Collections.singletonList("logout"));
|
||||||
|
public static ArrayList<String> points_points = new ArrayList<>(Collections.singletonList("points"));
|
||||||
|
public static ArrayList<String> points_add = new ArrayList<>(Collections.singletonList("add"));
|
||||||
|
public static ArrayList<String> points_remove = new ArrayList<>(Collections.singletonList("remove"));
|
||||||
|
public static ArrayList<String> points_set = new ArrayList<>(Collections.singletonList("set"));
|
||||||
|
public static ArrayList<String> relation_ally = new ArrayList<>(Collections.singletonList("ally"));
|
||||||
|
public static ArrayList<String> relation_enemy = new ArrayList<>(Collections.singletonList("enemy"));
|
||||||
|
public static ArrayList<String> relation_neutral = new ArrayList<>(Collections.singletonList("neutral"));
|
||||||
|
public static ArrayList<String> relation_truce = new ArrayList<>(Collections.singletonList("truce"));
|
||||||
|
public static ArrayList<String> reserve = new ArrayList<>(Collections.singletonList("reserve"));
|
||||||
|
public static ArrayList<String> roles_demote = new ArrayList<>(Collections.singletonList("demote"));
|
||||||
|
public static ArrayList<String> roles_promote = new ArrayList<>(Collections.singletonList("promote"));
|
||||||
|
public static ArrayList<String> tnt_tnt = new ArrayList<>(Collections.singletonList("tnt"));
|
||||||
|
public static ArrayList<String> tnt_tntfill = new ArrayList<>(Collections.singletonList("tntfill"));
|
||||||
|
public static ArrayList<String> wild = new ArrayList<>(Collections.singletonList("wild"));
|
||||||
|
public static ArrayList<String> admin = new ArrayList<>(Arrays.asList("admin", "setadmin", "leader", "setleader"));
|
||||||
|
public static ArrayList<String> ahome = new ArrayList<>(Collections.singletonList("ahome"));
|
||||||
|
public static ArrayList<String> announce = new ArrayList<>(Arrays.asList("ann", "announce"));
|
||||||
|
public static ArrayList<String> help = new ArrayList<>(Arrays.asList("help", "h", "?"));
|
||||||
|
public static ArrayList<String> ban_ban = new ArrayList<>(Collections.singletonList("ban"));
|
||||||
|
public static ArrayList<String> ban_banlist = new ArrayList<>(Arrays.asList("banlist", "bans", "banl"));
|
||||||
|
public static ArrayList<String> banner = new ArrayList<>(Collections.singletonList("banner"));
|
||||||
|
public static ArrayList<String> boom = new ArrayList<>(Arrays.asList("noboom", "explosions", "toggleexplosions"));
|
||||||
|
public static ArrayList<String> bypass = new ArrayList<>(Collections.singletonList("bypass"));
|
||||||
|
public static ArrayList<String> chat = new ArrayList<>(Arrays.asList("chat", "c"));
|
||||||
|
public static ArrayList<String> chatspy = new ArrayList<>(Collections.singletonList("chatspy"));
|
||||||
|
public static ArrayList<String> checkpoint = new ArrayList<>(Arrays.asList("checkp", "checkpoint", "cpoint"));
|
||||||
|
public static ArrayList<String> coleader = new ArrayList<>(Arrays.asList("coleader", "setcoleader", "co", "setco"));
|
||||||
|
public static ArrayList<String> config = new ArrayList<>(Collections.singletonList("config"));
|
||||||
|
public static ArrayList<String> convert = new ArrayList<>(Collections.singletonList("convert"));
|
||||||
|
public static ArrayList<String> coords = new ArrayList<>(Arrays.asList("coords", "coord"));
|
||||||
|
public static ArrayList<String> create = new ArrayList<>(Collections.singletonList("create"));
|
||||||
|
public static ArrayList<String> debug = new ArrayList<>(Collections.singletonList("debug"));
|
||||||
|
public static ArrayList<String> deinvite = new ArrayList<>(Arrays.asList("deinvite", "deinv"));
|
||||||
|
public static ArrayList<String> deletefwarp = new ArrayList<>(Arrays.asList("delwarp", "dw", "deletewarp"));
|
||||||
|
public static ArrayList<String> description = new ArrayList<>(Arrays.asList("desc", "description"));
|
||||||
|
public static ArrayList<String> disband = new ArrayList<>(Collections.singletonList("disband"));
|
||||||
|
public static ArrayList<String> discord_discord = new ArrayList<>(Collections.singletonList("discord"));
|
||||||
|
public static ArrayList<String> drain = new ArrayList<>(Collections.singletonList("drain"));
|
||||||
|
public static ArrayList<String> global = new ArrayList<>(Arrays.asList("gchat", "global", "globalchat"));
|
||||||
|
public static ArrayList<String> fly = new ArrayList<>(Collections.singletonList("fly"));
|
||||||
|
public static ArrayList<String> focus = new ArrayList<>(Collections.singletonList("focus"));
|
||||||
|
public static ArrayList<String> warp = new ArrayList<>(Arrays.asList("warp", "warps"));
|
||||||
|
public static ArrayList<String> getvault = new ArrayList<>(Collections.singletonList("getvault"));
|
||||||
|
public static ArrayList<String> home = new ArrayList<>(Collections.singletonList("home"));
|
||||||
|
public static ArrayList<String> inspect = new ArrayList<>(Arrays.asList("inspect", "ins"));
|
||||||
|
public static ArrayList<String> invsee = new ArrayList<>(Arrays.asList("invsee", "inventorysee"));
|
||||||
|
public static ArrayList<String> invite = new ArrayList<>(Arrays.asList("invite", "inv"));
|
||||||
|
public static ArrayList<String> join = new ArrayList<>(Collections.singletonList("join"));
|
||||||
|
public static ArrayList<String> kick = new ArrayList<>(Collections.singletonList("kick"));
|
||||||
|
public static ArrayList<String> killholograms = new ArrayList<>(Collections.singletonList("killholos"));
|
||||||
|
public static ArrayList<String> leave = new ArrayList<>(Collections.singletonList("leave"));
|
||||||
|
public static ArrayList<String> list = new ArrayList<>(Arrays.asList("list", "ls"));
|
||||||
|
public static ArrayList<String> lock = new ArrayList<>(Collections.singletonList("lock"));
|
||||||
|
public static ArrayList<String> logins = new ArrayList<>(Arrays.asList("logins", "login", "logouts"));
|
||||||
|
public static ArrayList<String> lookup = new ArrayList<>(Collections.singletonList("lookup"));
|
||||||
|
public static ArrayList<String> lowPower = new ArrayList<>(Collections.singletonList("lowpower"));
|
||||||
|
public static ArrayList<String> map_map = new ArrayList<>(Collections.singletonList("map"));
|
||||||
|
public static ArrayList<String> map_height = new ArrayList<>(Arrays.asList("mapheight", "mh"));
|
||||||
|
public static ArrayList<String> mod = new ArrayList<>(Arrays.asList("mod", "setmod", "officer", "setofficer"));
|
||||||
|
public static ArrayList<String> modifyPower = new ArrayList<>(Arrays.asList("mp", "pm", "modpower", "modifypower"));
|
||||||
|
public static ArrayList<String> near = new ArrayList<>(Arrays.asList("near", "nearby"));
|
||||||
|
public static ArrayList<String> open = new ArrayList<>(Collections.singletonList("open"));
|
||||||
|
public static ArrayList<String> owner_owner = new ArrayList<>(Collections.singletonList("owner"));
|
||||||
|
public static ArrayList<String> owner_list = new ArrayList<>(Collections.singletonList("ownerlist"));
|
||||||
|
public static ArrayList<String> paypal_see = new ArrayList<>(Arrays.asList("paypal", "seepaypal"));
|
||||||
|
public static ArrayList<String> paypal_set = new ArrayList<>(Collections.singletonList("setpaypal"));
|
||||||
|
public static ArrayList<String> peaceful = new ArrayList<>(Collections.singletonList("peaceful"));
|
||||||
|
public static ArrayList<String> perm = new ArrayList<>(Arrays.asList("perm", "perms", "permission", "permissions"));
|
||||||
|
public static ArrayList<String> permanent_faction = new ArrayList<>(Collections.singletonList("permanent"));
|
||||||
|
public static ArrayList<String> permanent_power = new ArrayList<>(Collections.singletonList("permanentpower"));
|
||||||
|
public static ArrayList<String> titles = new ArrayList<>(Collections.singletonList("titles"));
|
||||||
|
public static ArrayList<String> power_power = new ArrayList<>(Arrays.asList("pow", "power"));
|
||||||
|
public static ArrayList<String> power_boost = new ArrayList<>(Collections.singletonList("powerboost"));
|
||||||
|
public static ArrayList<String> reload = new ArrayList<>(Collections.singletonList("reload"));
|
||||||
|
public static ArrayList<String> rules = new ArrayList<>(Arrays.asList("r", "rule", "rules"));
|
||||||
|
public static ArrayList<String> saveAll = new ArrayList<>(Arrays.asList("save", "saveall"));
|
||||||
|
public static ArrayList<String> scoreboard = new ArrayList<>(Arrays.asList("sb", "scoreboard"));
|
||||||
|
public static ArrayList<String> seeChunk = new ArrayList<>(Arrays.asList("sc", "seechunk"));
|
||||||
|
public static ArrayList<String> discord_see = new ArrayList<>(Collections.singletonList("seediscord"));
|
||||||
|
public static ArrayList<String> discord_set = new ArrayList<>(Collections.singletonList("setdiscord"));
|
||||||
|
public static ArrayList<String> setBanner = new ArrayList<>(Collections.singletonList("setbanner"));
|
||||||
|
public static ArrayList<String> setDefaultRole = new ArrayList<>(Arrays.asList("defaultrole", "def", "default", "defaultrank"));
|
||||||
|
public static ArrayList<String> setWarp = new ArrayList<>(Arrays.asList("sw", "setwarp"));
|
||||||
|
public static ArrayList<String> setHome = new ArrayList<>(Collections.singletonList("sethome"));
|
||||||
|
public static ArrayList<String> setMaxVaults = new ArrayList<>(Arrays.asList("smv", "setmaxvaults"));
|
||||||
|
public static ArrayList<String> show_show = new ArrayList<>(Arrays.asList("show", "who"));
|
||||||
|
public static ArrayList<String> show_claims = new ArrayList<>(Arrays.asList("showclaim", "showclaims"));
|
||||||
|
public static ArrayList<String> show_invites = new ArrayList<>(Collections.singletonList("showinvites"));
|
||||||
|
public static ArrayList<String> spawnerlock = new ArrayList<>(Arrays.asList("lockspawners", "spawnerlock"));
|
||||||
|
public static ArrayList<String> status = new ArrayList<>(Arrays.asList("s", "status"));
|
||||||
|
public static ArrayList<String> stealth = new ArrayList<>(Arrays.asList("stealth", "ninja"));
|
||||||
|
public static ArrayList<String> strikes_strikes = new ArrayList<>(Collections.singletonList("strikes"));
|
||||||
|
public static ArrayList<String> strikes_give = new ArrayList<>(Collections.singletonList("give"));
|
||||||
|
public static ArrayList<String> strikes_info = new ArrayList<>(Collections.singletonList("info"));
|
||||||
|
public static ArrayList<String> strikes_set = new ArrayList<>(Collections.singletonList("set"));
|
||||||
|
public static ArrayList<String> strikes_take = new ArrayList<>(Collections.singletonList("take"));
|
||||||
|
public static ArrayList<String> stuck = new ArrayList<>(Arrays.asList("stuck", "halp!"));
|
||||||
|
public static ArrayList<String> tag = new ArrayList<>(Arrays.asList("tag", "rename"));
|
||||||
|
public static ArrayList<String> title = new ArrayList<>(Collections.singletonList("title"));
|
||||||
|
public static ArrayList<String> toggleAllianceChat = new ArrayList<>(Arrays.asList("tac", "ac", "togglealliancechat"));
|
||||||
|
public static ArrayList<String> top = new ArrayList<>(Arrays.asList("t", "top"));
|
||||||
|
public static ArrayList<String> tpBanner = new ArrayList<>(Collections.singletonList("tpbanner"));
|
||||||
|
public static ArrayList<String> unban = new ArrayList<>(Collections.singletonList("unban"));
|
||||||
|
public static ArrayList<String> upgrades = new ArrayList<>(Arrays.asList("upgrades", "upgrade"));
|
||||||
|
public static ArrayList<String> vault = new ArrayList<>(Collections.singletonList("vault"));
|
||||||
|
public static ArrayList<String> viewChest = new ArrayList<>(Arrays.asList("viewchest", "viewpv"));
|
||||||
|
private static transient Aliases i = new Aliases();
|
||||||
|
|
||||||
|
public static void load() {
|
||||||
|
FactionsPlugin.getInstance().persist.loadOrSaveDefault(i, Aliases.class, "aliases");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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,9 +8,13 @@ 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.addAll(Aliases.ahome);
|
||||||
|
|
||||||
this.requiredArgs.add("player");
|
this.requiredArgs.add("player");
|
||||||
|
|
||||||
|
|||||||
@@ -3,20 +3,24 @@ 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.cmd.audit.FLogType;
|
||||||
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;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
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.addAll(Aliases.admin);
|
||||||
this.aliases.add("setadmin");
|
|
||||||
this.aliases.add("leader");
|
|
||||||
this.aliases.add("setleader");
|
|
||||||
|
|
||||||
this.requiredArgs.add("player");
|
this.requiredArgs.add("player");
|
||||||
|
|
||||||
@@ -25,63 +29,81 @@ public class CmdAdmin extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (context.player == null) {
|
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
||||||
context.msg(TL.GENERIC_PLAYERONLY);
|
if (context.player == null) {
|
||||||
return;
|
context.msg(TL.GENERIC_PLAYERONLY);
|
||||||
}
|
return;
|
||||||
// Allows admins bypass this.
|
}
|
||||||
if (!context.fPlayer.isAdminBypassing() && !context.fPlayer.getRole().equals(Role.LEADER)) {
|
// Allows admins bypass this.
|
||||||
context.msg(TL.COMMAND_ADMIN_NOTADMIN);
|
if (!context.fPlayer.isAdminBypassing() && !context.fPlayer.getRole().equals(Role.LEADER)) {
|
||||||
return;
|
context.msg(TL.COMMAND_ADMIN_NOTADMIN);
|
||||||
}
|
return;
|
||||||
FPlayer fyou = context.argAsBestFPlayerMatch(0);
|
}
|
||||||
if (fyou == null) {
|
FPlayer fyou = context.argAsBestFPlayerMatch(0);
|
||||||
return;
|
if (fyou == null) {
|
||||||
}
|
|
||||||
|
|
||||||
boolean permAny = Permission.ADMIN_ANY.has(context.sender, false);
|
|
||||||
Faction targetFaction = fyou.getFaction();
|
|
||||||
|
|
||||||
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) {
|
||||||
|
promoteNewLeader(targetFaction);
|
||||||
|
context.msg(TL.COMMAND_ADMIN_DEMOTES, fyou.describeTo(context.fPlayer, true));
|
||||||
|
fyou.msg(TL.COMMAND_ADMIN_DEMOTED, context.player == null ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(fyou, true));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// promote target player, and demote existing admin if one exists
|
||||||
|
if (admin != null) {
|
||||||
|
setRole(admin, Role.COLEADER);
|
||||||
|
}
|
||||||
|
setRole(fyou, Role.LEADER);
|
||||||
|
context.msg(TL.COMMAND_ADMIN_PROMOTES, fyou.describeTo(context.fPlayer, true));
|
||||||
|
|
||||||
|
FactionsPlugin.instance.getFlogManager().log(targetFaction, FLogType.RANK_EDIT, context.fPlayer.getName(), fyou.getName(), ChatColor.RED + "Admin");
|
||||||
|
|
||||||
|
// 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));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setRole(FPlayer fp, Role r) {
|
||||||
|
FactionsPlugin.getInstance().getServer().getScheduler().runTask(FactionsPlugin.instance, () -> {
|
||||||
|
fp.setRole(r);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void promoteNewLeader(Faction f) {
|
||||||
|
FactionsPlugin.getInstance().getServer().getScheduler().runTask(FactionsPlugin.instance, () -> {
|
||||||
|
f.promoteNewLeader();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public TL getUsageTranslation() {
|
public TL getUsageTranslation() {
|
||||||
|
|||||||
@@ -12,10 +12,13 @@ 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.addAll(Aliases.announce);
|
||||||
this.aliases.add("announce");
|
|
||||||
|
|
||||||
this.requiredArgs.add("message");
|
this.requiredArgs.add("message");
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,12 @@ 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.addAll(Aliases.help);
|
||||||
this.aliases.add("h");
|
|
||||||
this.aliases.add("help");
|
|
||||||
|
|
||||||
this.setHelpShort("");
|
this.setHelpShort("");
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
|
import com.massivecraft.factions.cmd.audit.FLogType;
|
||||||
import com.massivecraft.factions.event.FPlayerLeaveEvent;
|
import com.massivecraft.factions.event.FPlayerLeaveEvent;
|
||||||
import com.massivecraft.factions.struct.BanInfo;
|
import com.massivecraft.factions.struct.BanInfo;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.util.CC;
|
||||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@@ -13,9 +15,13 @@ 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.addAll(Aliases.ban_ban);
|
||||||
|
|
||||||
this.requiredArgs.add("target");
|
this.requiredArgs.add("target");
|
||||||
|
|
||||||
@@ -75,6 +81,7 @@ public class CmdBan extends FCommand {
|
|||||||
|
|
||||||
// Lets inform the people!
|
// Lets inform the people!
|
||||||
target.msg(TL.COMMAND_BAN_TARGET, context.faction.getTag(target.getFaction()));
|
target.msg(TL.COMMAND_BAN_TARGET, context.faction.getTag(target.getFaction()));
|
||||||
|
FactionsPlugin.instance.logFactionEvent(context.faction, FLogType.BANS, context.fPlayer.getName(), CC.Green + "banned", target.getName());
|
||||||
context.faction.msg(TL.COMMAND_BAN_BANNED, context.fPlayer.getName(), target.getName());
|
context.faction.msg(TL.COMMAND_BAN_BANNED, context.fPlayer.getName(), target.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,11 +13,13 @@ 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.addAll(Aliases.ban_banlist);
|
||||||
this.aliases.add("bans");
|
|
||||||
this.aliases.add("banl");
|
|
||||||
|
|
||||||
this.optionalArgs.put("faction", "faction");
|
this.optionalArgs.put("faction", "faction");
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,13 @@ 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.addAll(Aliases.banner);
|
||||||
this.aliases.add("warbanner");
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.BANNER).playerOnly().memberOnly().build();
|
this.requirements = new CommandRequirements.Builder(Permission.BANNER).playerOnly().memberOnly().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,12 +33,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")));
|
||||||
@@ -45,6 +47,7 @@ public class CmdBanner extends FCommand {
|
|||||||
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) {
|
||||||
@@ -54,10 +57,10 @@ public class CmdBanner extends FCommand {
|
|||||||
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,11 +6,13 @@ 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.addAll(Aliases.boom);
|
||||||
this.aliases.add("explosions");
|
|
||||||
this.aliases.add("toggleexplosions");
|
|
||||||
|
|
||||||
//this.requiredArgs.add("");
|
//this.requiredArgs.add("");
|
||||||
this.optionalArgs.put("on/off", "flip");
|
this.optionalArgs.put("on/off", "flip");
|
||||||
|
|||||||
@@ -6,9 +6,13 @@ 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.addAll(Aliases.bypass);
|
||||||
|
|
||||||
//this.requiredArgs.add("");
|
//this.requiredArgs.add("");
|
||||||
this.optionalArgs.put("on/off", "flip");
|
this.optionalArgs.put("on/off", "flip");
|
||||||
|
|||||||
@@ -10,10 +10,13 @@ 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.addAll(Aliases.chat);
|
||||||
this.aliases.add("chat");
|
|
||||||
|
|
||||||
//this.requiredArgs.add("");
|
//this.requiredArgs.add("");
|
||||||
this.optionalArgs.put("mode", "next");
|
this.optionalArgs.put("mode", "next");
|
||||||
|
|||||||
@@ -6,9 +6,13 @@ 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.addAll(Aliases.chatspy);
|
||||||
|
|
||||||
this.optionalArgs.put("on/off", "flip");
|
this.optionalArgs.put("on/off", "flip");
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,14 @@ 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.addAll(Aliases.checkpoint);
|
||||||
this.aliases.add("checkpoint");
|
|
||||||
this.aliases.add("cpoint");
|
|
||||||
|
|
||||||
this.optionalArgs.put("set", "");
|
this.optionalArgs.put("set", "");
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ 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.cmd.audit.FLogType;
|
||||||
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;
|
||||||
@@ -10,12 +12,14 @@ 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.addAll(Aliases.coleader);
|
||||||
this.aliases.add("setcoleader");
|
|
||||||
this.aliases.add("coleader");
|
|
||||||
this.aliases.add("setco");
|
|
||||||
|
|
||||||
this.optionalArgs.put("player name", "name");
|
this.optionalArgs.put("player name", "name");
|
||||||
|
|
||||||
@@ -76,6 +80,7 @@ public class CmdColeader extends FCommand {
|
|||||||
you.setRole(Role.COLEADER);
|
you.setRole(Role.COLEADER);
|
||||||
targetFaction.msg(TL.COMMAND_COLEADER_PROMOTED, you.describeTo(targetFaction, true));
|
targetFaction.msg(TL.COMMAND_COLEADER_PROMOTED, you.describeTo(targetFaction, true));
|
||||||
context.msg(TL.COMMAND_COLEADER_PROMOTES, you.describeTo(context.fPlayer, true));
|
context.msg(TL.COMMAND_COLEADER_PROMOTES, you.describeTo(context.fPlayer, true));
|
||||||
|
FactionsPlugin.instance.getFlogManager().log(targetFaction, FLogType.RANK_EDIT, context.fPlayer.getName(), you.getName(), ChatColor.RED + "Co-Leader");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class CmdConfig extends FCommand {
|
|||||||
|
|
||||||
public CmdConfig() {
|
public CmdConfig() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("config");
|
this.aliases.addAll(Aliases.config);
|
||||||
|
|
||||||
this.requiredArgs.add("setting");
|
this.requiredArgs.add("setting");
|
||||||
this.requiredArgs.add("value");
|
this.requiredArgs.add("value");
|
||||||
@@ -225,7 +225,7 @@ public class CmdConfig extends FCommand {
|
|||||||
if (!success.isEmpty()) {
|
if (!success.isEmpty()) {
|
||||||
if (context.sender instanceof Player) {
|
if (context.sender instanceof Player) {
|
||||||
context.sendMessage(success);
|
context.sendMessage(success);
|
||||||
FactionsPlugin.getInstance().log(success + TL.COMMAND_CONFIG_LOG.format((Player) context.sender));
|
FactionsPlugin.getInstance().log(success + TL.COMMAND_CONFIG_LOG.format(context.sender));
|
||||||
} else // using FactionsPlugin.getInstance().log() instead of sendMessage if run from server console so that "[Factions v#.#.#]" is prepended in server log
|
} else // using FactionsPlugin.getInstance().log() instead of sendMessage if run from server console so that "[Factions v#.#.#]" is prepended in server log
|
||||||
{
|
{
|
||||||
FactionsPlugin.getInstance().log(success);
|
FactionsPlugin.getInstance().log(success);
|
||||||
|
|||||||
@@ -9,8 +9,12 @@ 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.addAll(Aliases.convert);
|
||||||
this.requiredArgs.add("[MYSQL|JSON]");
|
this.requiredArgs.add("[MYSQL|JSON]");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.CONVERT)
|
this.requirements = new CommandRequirements.Builder(Permission.CONVERT)
|
||||||
|
|||||||
@@ -7,10 +7,13 @@ 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.addAll(Aliases.coords);
|
||||||
this.aliases.add("coord");
|
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.COORD)
|
this.requirements = new CommandRequirements.Builder(Permission.COORD)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
|
|||||||
@@ -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,16 +9,23 @@ 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.addAll(Aliases.create);
|
||||||
|
|
||||||
this.requiredArgs.add("faction tag");
|
this.requiredArgs.add("faction tag");
|
||||||
|
|
||||||
@@ -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,24 @@ 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)
|
||||||
|
|||||||
69
src/main/java/com/massivecraft/factions/cmd/CmdDebug.java
Normal file
69
src/main/java/com/massivecraft/factions/cmd/CmdDebug.java
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
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,10 +14,13 @@ 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.addAll(Aliases.deinvite);
|
||||||
this.aliases.add("deinv");
|
|
||||||
|
|
||||||
this.optionalArgs.put("player name", "name");
|
this.optionalArgs.put("player name", "name");
|
||||||
|
|
||||||
@@ -28,10 +31,7 @@ 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
|
|
||||||
// `No player "null" could be found.` message.
|
|
||||||
if (context.args.get(0) == null) {
|
|
||||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.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);
|
||||||
@@ -54,6 +54,7 @@ public class CmdDeinvite extends FCommand {
|
|||||||
if (you == null) {
|
if (you == null) {
|
||||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
||||||
for (String id : context.faction.getInvites()) {
|
for (String id : context.faction.getInvites()) {
|
||||||
|
if (context.faction.getInvites().isEmpty()) return;
|
||||||
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_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||||
@@ -69,9 +70,7 @@ public class CmdDeinvite extends FCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
context.faction.deinvite(you);
|
context.faction.deinvite(you);
|
||||||
|
|
||||||
you.msg(TL.COMMAND_DEINVITE_REVOKED, context.fPlayer.describeTo(you), context.faction.describeTo(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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,13 @@ 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.addAll(Aliases.deletefwarp);
|
||||||
this.aliases.add("dw");
|
|
||||||
this.aliases.add("deletewarp");
|
|
||||||
this.requiredArgs.add("warp name");
|
this.requiredArgs.add("warp name");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.SETWARP)
|
this.requirements = new CommandRequirements.Builder(Permission.SETWARP)
|
||||||
|
|||||||
@@ -3,16 +3,22 @@ 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.cmd.audit.FLogType;
|
||||||
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;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
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.addAll(Aliases.description);
|
||||||
this.aliases.add("description");
|
|
||||||
|
|
||||||
this.requiredArgs.add("desc");
|
this.requiredArgs.add("desc");
|
||||||
|
|
||||||
@@ -25,26 +31,29 @@ 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"));
|
String desc = TextUtil.implode(context.args, " ").replaceAll("%", "").replaceAll("(&([a-f0-9klmnor]))", "& $2");
|
||||||
|
context.faction.setDescription(desc);
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(FactionsPlugin.instance, () -> FactionsPlugin.instance.logFactionEvent(context.faction, FLogType.FDESC_EDIT, context.fPlayer.getName(), desc));
|
||||||
|
if (!Conf.broadcastDescriptionChanges) {
|
||||||
|
context.msg(TL.COMMAND_DESCRIPTION_CHANGED, context.faction.describeTo(context.fPlayer));
|
||||||
|
context.sendMessage(context.faction.getDescription());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Conf.broadcastDescriptionChanges) {
|
// Broadcast the description to everyone
|
||||||
context.msg(TL.COMMAND_DESCRIPTION_CHANGED, context.faction.describeTo(context.fPlayer));
|
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||||
context.sendMessage(context.faction.getDescription());
|
fplayer.msg(TL.COMMAND_DESCRIPTION_CHANGES, context.faction.describeTo(fplayer));
|
||||||
return;
|
fplayer.sendMessage(context.faction.getDescription()); // players can inject "&" or "`" or "<i>" or whatever in their description; &k is particularly interesting looking
|
||||||
}
|
}
|
||||||
|
});
|
||||||
// Broadcast the description to everyone
|
|
||||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,35 +4,40 @@ import com.massivecraft.factions.*;
|
|||||||
import com.massivecraft.factions.event.FactionDisbandEvent.PlayerDisbandReason;
|
import com.massivecraft.factions.event.FactionDisbandEvent.PlayerDisbandReason;
|
||||||
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.util.UtilFly;
|
import com.massivecraft.factions.zcore.fdisband.FDisbandFrame;
|
||||||
import com.massivecraft.factions.zcore.fperms.Access;
|
import com.massivecraft.factions.zcore.fperms.Access;
|
||||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
|
||||||
public class CmdDisband extends FCommand {
|
public class CmdDisband extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
|
//TODO: Add Disband Confirmation GUI
|
||||||
|
|
||||||
private static HashMap<String, String> disbandMap = new HashMap<>();
|
private static HashMap<String, String> disbandMap = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
public CmdDisband() {
|
public CmdDisband() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("disband");
|
this.aliases.addAll(Aliases.disband);
|
||||||
|
|
||||||
this.optionalArgs.put("faction tag", "yours");
|
this.optionalArgs.put("faction tag", "yours");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.DISBAND)
|
this.requirements = new CommandRequirements.Builder(Permission.DISBAND)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
|
long time;
|
||||||
// The faction, default to your own.. but null if console sender.
|
// The faction, default to your own.. but null if console sender.
|
||||||
Faction faction = context.argAsFaction(0, context.fPlayer == null ? null : context.faction);
|
Faction faction = context.argAsFaction(0, context.fPlayer == null ? null : context.faction);
|
||||||
if (faction == null) return;
|
if (faction == null) return;
|
||||||
@@ -40,9 +45,7 @@ public class CmdDisband extends FCommand {
|
|||||||
boolean isMyFaction = context.fPlayer != null && faction == context.faction;
|
boolean isMyFaction = context.fPlayer != null && faction == context.faction;
|
||||||
|
|
||||||
if (!isMyFaction) {
|
if (!isMyFaction) {
|
||||||
if (!Permission.DISBAND_ANY.has(context.sender, true)) {
|
if (!Permission.DISBAND_ANY.has(context.sender, true)) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -69,6 +72,22 @@ public class CmdDisband extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
boolean access = false;
|
||||||
|
if (context.fPlayer.getPlayer().hasMetadata("disband_confirm") && (time = context.fPlayer.getPlayer().getMetadata("disband_confirm").get(0).asLong()) != 0L && System.currentTimeMillis() - time <= TimeUnit.SECONDS.toMillis(3L)) {
|
||||||
|
access = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!access) {
|
||||||
|
if(Conf.useDisbandGUI && !context.fPlayer.isAdminBypassing() || !context.player.isOp()) {
|
||||||
|
if (!disbandMap.containsKey(context.player.getUniqueId().toString())) {
|
||||||
|
new FDisbandFrame(context.faction).buildGUI(context.fPlayer);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// check for tnt before disbanding.
|
// check for tnt before disbanding.
|
||||||
if (!disbandMap.containsKey(context.player.getUniqueId().toString()) && faction.getTnt() > 0) {
|
if (!disbandMap.containsKey(context.player.getUniqueId().toString()) && faction.getTnt() > 0) {
|
||||||
context.msg(TL.COMMAND_DISBAND_CONFIRM.toString().replace("{tnt}", faction.getTnt() + ""));
|
context.msg(TL.COMMAND_DISBAND_CONFIRM.toString().replace("{tnt}", faction.getTnt() + ""));
|
||||||
@@ -80,19 +99,20 @@ public class CmdDisband extends FCommand {
|
|||||||
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);
|
||||||
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()) {
|
if (!follower.canFlyAtLocation() && FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) {
|
||||||
follower.setFFlying(false, false);
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
context.fPlayer.setFFlying(false, false);
|
if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight"))
|
||||||
|
context.fPlayer.setFFlying(false, false);
|
||||||
} else {
|
} else {
|
||||||
context.player.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
|
context.player.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
|
||||||
}
|
}
|
||||||
faction.disband(context.player, PlayerDisbandReason.COMMAND);
|
faction.disband(context.player, PlayerDisbandReason.COMMAND);
|
||||||
if (!context.fPlayer.canFlyAtLocation()) {
|
if (!context.fPlayer.canFlyAtLocation() && FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) {
|
||||||
context.fPlayer.setFFlying(false, false);
|
context.fPlayer.setFFlying(false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
44
src/main/java/com/massivecraft/factions/cmd/CmdDiscord.java
Normal file
44
src/main/java/com/massivecraft/factions/cmd/CmdDiscord.java
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author droppinganvil
|
||||||
|
*/
|
||||||
|
public class CmdDiscord extends FCommand {
|
||||||
|
public CmdDiscord() {
|
||||||
|
super();
|
||||||
|
this.aliases.addAll(Aliases.discord_discord);
|
||||||
|
this.requirements = new CommandRequirements.Builder(Permission.DISCORD)
|
||||||
|
.playerOnly()
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void perform(CommandContext context) {
|
||||||
|
if (context.fPlayer.discordSetup()) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
63
src/main/java/com/massivecraft/factions/cmd/CmdDrain.java
Normal file
63
src/main/java/com/massivecraft/factions/cmd/CmdDrain.java
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
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 java.text.DecimalFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Saser
|
||||||
|
*/
|
||||||
|
public class CmdDrain extends FCommand {
|
||||||
|
public CmdDrain() {
|
||||||
|
this.aliases.addAll(Aliases.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,13 +9,15 @@ 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() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("gchat");
|
this.aliases.addAll(Aliases.global);
|
||||||
this.aliases.add("global");
|
|
||||||
this.aliases.add("globalchat");
|
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.GLOBALCHAT)
|
this.requirements = new CommandRequirements.Builder(Permission.GLOBALCHAT)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
|
|||||||
@@ -14,10 +14,13 @@ 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.addAll(Aliases.warp);
|
||||||
this.aliases.add("warps");
|
|
||||||
this.optionalArgs.put("warpname", "warpname");
|
this.optionalArgs.put("warpname", "warpname");
|
||||||
this.optionalArgs.put("password", "password");
|
this.optionalArgs.put("password", "password");
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ 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<>();
|
public static ConcurrentHashMap<String, Boolean> flyMap = new ConcurrentHashMap<>();
|
||||||
public static BukkitTask particleTask = null;
|
public static BukkitTask particleTask = null;
|
||||||
@@ -27,10 +31,10 @@ public class CmdFly extends FCommand {
|
|||||||
|
|
||||||
public CmdFly() {
|
public CmdFly() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("fly");
|
this.aliases.addAll(Aliases.fly);
|
||||||
this.optionalArgs.put("on/off", "flip");
|
this.optionalArgs.put("on/off", "flip");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.FLY)
|
this.requirements = new CommandRequirements.Builder(Permission.FLY_FLY)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
.memberOnly()
|
.memberOnly()
|
||||||
.build();
|
.build();
|
||||||
@@ -74,19 +78,15 @@ public class CmdFly extends FCommand {
|
|||||||
}
|
}
|
||||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||||
Faction myFaction = fPlayer.getFaction();
|
Faction myFaction = fPlayer.getFaction();
|
||||||
if (myFaction.isWilderness()) {
|
if (!player.hasPermission("factions.fly.bypassnearbyenemycheck") && !fPlayer.isAdminBypassing()) {
|
||||||
fPlayer.setFlying(false);
|
if (fPlayer.hasEnemiesNearby()) disableFlightSync(fPlayer);
|
||||||
flyMap.remove(name);
|
checkEnemiesSync(fPlayer);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (player.hasPermission("factions.fly.bypassnearbyenemycheck") || fPlayer.checkIfNearbyEnemies()) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
FLocation myFloc = new FLocation(player.getLocation());
|
FLocation myFloc = new FLocation(player.getLocation());
|
||||||
if (Board.getInstance().getFactionAt(myFloc) != myFaction) {
|
if (Board.getInstance().getFactionAt(myFloc) != myFaction) {
|
||||||
if (!checkBypassPerms(fPlayer, player, Board.getInstance().getFactionAt(myFloc))) {
|
if (!checkFly(fPlayer, player, Board.getInstance().getFactionAt(myFloc))) {
|
||||||
Bukkit.getScheduler().runTask(FactionsPlugin.instance, () -> fPlayer.setFFlying(false, false));
|
disableFlightSync(fPlayer);
|
||||||
flyMap.remove(name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,33 +96,17 @@ public class CmdFly extends FCommand {
|
|||||||
}, 20L, 20L);
|
}, 20L, 20L);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean checkBypassPerms(FPlayer fme, Player me, Faction toFac) {
|
public static boolean checkFly(FPlayer fme, Player me, Faction toFac) {
|
||||||
if (toFac != fme.getFaction()) {
|
if (Conf.denyFlightIfInNoClaimingWorld && !Conf.worldsNoClaiming.isEmpty() && Conf.worldsNoClaiming.stream().anyMatch(me.getWorld().getName()::equalsIgnoreCase))
|
||||||
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()) {
|
return false;
|
||||||
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
if (toFac.getAccess(fme, PermissableAction.FLY) == Access.ALLOW) return true;
|
||||||
return false;
|
if (fme.getFaction().isWilderness()) return false;
|
||||||
}
|
if (toFac.isSystemFaction())
|
||||||
Access access = toFac.getAccess(fme, PermissableAction.FLY);
|
return me.hasPermission(toFac.isWilderness() ? Permission.FLY_WILDERNESS.node : toFac.isSafeZone() ? Permission.FLY_SAFEZONE.node : Permission.FLY_WARZONE.node);
|
||||||
if ((!(me.hasPermission(Permission.FLY_ENEMY.node) || access == Access.ALLOW)) && toFac.getRelationTo(fme.getFaction()) == Relation.ENEMY) {
|
Relation relationTo = toFac.getRelationTo(fme.getFaction());
|
||||||
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
if (!relationTo.isEnemy() && !relationTo.isMember())
|
||||||
return false;
|
return me.hasPermission(Permission.valueOf("FLY_" + relationTo.name()).node);
|
||||||
}
|
return false;
|
||||||
if (!(me.hasPermission(Permission.FLY_ALLY.node) || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.ALLY) {
|
|
||||||
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!(me.hasPermission(Permission.FLY_TRUCE.node) || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.TRUCE) {
|
|
||||||
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(me.hasPermission(Permission.FLY_NEUTRAL.node) || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.NEUTRAL && !toFac.isSystemFaction()) {
|
|
||||||
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return me.hasPermission(Permission.FLY.node) && (access != Access.DENY || toFac.isSystemFaction());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -138,34 +122,43 @@ public class CmdFly extends FCommand {
|
|||||||
flyMap.remove(fme.getPlayer().getName());
|
flyMap.remove(fme.getPlayer().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void disableFlightSync(FPlayer fme) {
|
||||||
|
Bukkit.getScheduler().runTask(FactionsPlugin.instance, () -> fme.setFFlying(false, false));
|
||||||
|
flyMap.remove(fme.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void checkEnemiesSync(FPlayer fp) {
|
||||||
|
Bukkit.getScheduler().runTask(FactionsPlugin.instance, fp::checkIfNearbyEnemies);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isInFlightChecker(Player player) {
|
public boolean isInFlightChecker(Player player) {
|
||||||
return flyMap.containsKey(player.getName());
|
return flyMap.containsKey(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
// Disabled by default.
|
if (!context.fPlayer.isAdminBypassing()) {
|
||||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight", false)) {
|
List<Entity> entities = context.player.getNearbyEntities(16.0D, 256.0D, 16.0D);
|
||||||
context.fPlayer.msg(TL.COMMAND_FLY_DISABLED);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FLocation myfloc = new FLocation(context.player.getLocation());
|
for (int i = 0; i <= entities.size() - 1; ++i) {
|
||||||
Faction toFac = Board.getInstance().getFactionAt(myfloc);
|
if (entities.get(i) instanceof Player) {
|
||||||
if (!checkBypassPerms(context.fPlayer, context.player, toFac)) return;
|
Player eplayer = (Player) entities.get(i);
|
||||||
List<Entity> entities = context.player.getNearbyEntities(16.0D, 256.0D, 16.0D);
|
FPlayer efplayer = FPlayers.getInstance().getByPlayer(eplayer);
|
||||||
|
if (efplayer.getRelationTo(context.fPlayer) == Relation.ENEMY && !efplayer.isStealthEnabled()) {
|
||||||
for (int i = 0; i <= entities.size() - 1; ++i) {
|
context.msg(TL.COMMAND_FLY_CHECK_ENEMY);
|
||||||
if (entities.get(i) instanceof Player) {
|
return;
|
||||||
Player eplayer = (Player) entities.get(i);
|
}
|
||||||
FPlayer efplayer = FPlayers.getInstance().getByPlayer(eplayer);
|
context.fPlayer.setEnemiesNearby(false);
|
||||||
if (efplayer.getRelationTo(context.fPlayer) == Relation.ENEMY && !efplayer.isStealthEnabled()) {
|
|
||||||
context.msg(TL.COMMAND_FLY_CHECK_ENEMY);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
FLocation myfloc = new FLocation(context.player.getLocation());
|
||||||
|
Faction toFac = Board.getInstance().getFactionAt(myfloc);
|
||||||
|
if (!checkFly(context.fPlayer, context.player, toFac)) {
|
||||||
|
context.fPlayer.sendMessage(TL.COMMAND_FLY_NO_ACCESS.format(toFac.getTag()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (context.args.size() == 0) {
|
if (context.args.size() == 0) {
|
||||||
toggleFlight(context.fPlayer.isFlying(), context.fPlayer, context);
|
toggleFlight(context.fPlayer.isFlying(), context.fPlayer, context);
|
||||||
@@ -181,19 +174,17 @@ public class CmdFly extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", () -> {
|
||||||
|
fme.setFlying(true);
|
||||||
|
flyMap.put(fme.getPlayer().getName(), true);
|
||||||
|
if (particleTask == null) {
|
||||||
|
startParticles();
|
||||||
|
}
|
||||||
|
|
||||||
if (fme.canFlyAtLocation())
|
if (flyTask == null) {
|
||||||
context.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", () -> {
|
startFlyCheck();
|
||||||
fme.setFlying(true);
|
}
|
||||||
flyMap.put(fme.getPlayer().getName(), true);
|
}, FactionsPlugin.getInstance().getConfig().getLong("warmups.f-fly", 0));
|
||||||
if (particleTask == null) {
|
|
||||||
startParticles();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flyTask == null) {
|
|
||||||
startFlyCheck();
|
|
||||||
}
|
|
||||||
}, FactionsPlugin.getInstance().getConfig().getLong("warmups.f-fly", 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,8 +7,13 @@ 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.addAll(Aliases.focus);
|
||||||
|
|
||||||
requiredArgs.add("player");
|
requiredArgs.add("player");
|
||||||
|
|
||||||
@@ -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,9 +9,14 @@ 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.addAll(Aliases.getvault);
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.GETVAULT)
|
this.requirements = new CommandRequirements.Builder(Permission.GETVAULT)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
@@ -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,11 @@ 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,13 +13,16 @@ 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;
|
||||||
|
|
||||||
|
//TODO: Add Help GUI
|
||||||
public CmdHelp() {
|
public CmdHelp() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("help");
|
this.aliases.addAll(Aliases.help);
|
||||||
this.aliases.add("h");
|
|
||||||
this.aliases.add("?");
|
|
||||||
|
|
||||||
//this.requiredArgs.add("");
|
//this.requiredArgs.add("");
|
||||||
this.optionalArgs.put("page", "1");
|
this.optionalArgs.put("page", "1");
|
||||||
|
|||||||
@@ -20,9 +20,13 @@ 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.addAll(Aliases.home);
|
||||||
this.optionalArgs.put("faction", "yours");
|
this.optionalArgs.put("faction", "yours");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.HOME)
|
this.requirements = new CommandRequirements.Builder(Permission.HOME)
|
||||||
|
|||||||
@@ -4,11 +4,14 @@ 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.addAll(Aliases.inspect);
|
||||||
this.aliases.add("ins");
|
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.INSPECT)
|
this.requirements = new CommandRequirements.Builder(Permission.INSPECT)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
.memberOnly()
|
.memberOnly()
|
||||||
|
|||||||
@@ -16,11 +16,14 @@ import java.util.Objects;
|
|||||||
|
|
||||||
public class CmdInventorySee extends FCommand {
|
public class CmdInventorySee extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Driftay
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdInventorySee() {
|
public CmdInventorySee() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.aliases.add("invsee");
|
this.aliases.addAll(Aliases.invsee);
|
||||||
this.aliases.add("inventorysee");
|
|
||||||
|
|
||||||
this.requiredArgs.add("member name");
|
this.requiredArgs.add("member name");
|
||||||
|
|
||||||
@@ -32,7 +35,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ 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.FactionsPlugin;
|
||||||
|
import com.massivecraft.factions.cmd.audit.FLogType;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.util.CC;
|
||||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import mkremins.fanciful.FancyMessage;
|
import mkremins.fanciful.FancyMessage;
|
||||||
@@ -11,10 +13,13 @@ 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.addAll(Aliases.invite);
|
||||||
this.aliases.add("inv");
|
|
||||||
|
|
||||||
this.requiredArgs.add("player name");
|
this.requiredArgs.add("player name");
|
||||||
|
|
||||||
@@ -64,11 +69,10 @@ public class CmdInvite extends FCommand {
|
|||||||
.command("/" + Conf.baseCommandAliases.get(0) + " join " + context.faction.getTag())
|
.command("/" + Conf.baseCommandAliases.get(0) + " join " + context.faction.getTag())
|
||||||
.then(context.faction.describeTo(target)).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
|
.then(context.faction.describeTo(target)).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
|
||||||
.command("/" + Conf.baseCommandAliases.get(0) + " join " + context.faction.getTag());
|
.command("/" + Conf.baseCommandAliases.get(0) + " join " + context.faction.getTag());
|
||||||
|
|
||||||
message.send(target.getPlayer());
|
message.send(target.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
context.faction.msg(TL.COMMAND_INVITE_INVITED, context.fPlayer.describeTo(context.faction, true), target.describeTo(context.faction));
|
context.faction.msg(TL.COMMAND_INVITE_INVITED, context.fPlayer.describeTo(context.faction, true), target.describeTo(context.faction));
|
||||||
|
FactionsPlugin.instance.logFactionEvent(context.faction, FLogType.INVITES, context.fPlayer.getName(), CC.Green + "invited", target.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,17 +1,28 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
import com.massivecraft.factions.*;
|
import com.massivecraft.factions.*;
|
||||||
|
import com.massivecraft.factions.cmd.audit.FLogType;
|
||||||
|
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.util.CC;
|
||||||
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;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
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.addAll(Aliases.join);
|
||||||
this.requiredArgs.add("faction name");
|
this.requiredArgs.add("faction name");
|
||||||
this.optionalArgs.put("player", "you");
|
this.optionalArgs.put("player", "you");
|
||||||
|
|
||||||
@@ -116,7 +127,21 @@ public class CmdJoin extends FCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
faction.deinvite(fplayer);
|
faction.deinvite(fplayer);
|
||||||
context.fPlayer.setRole(faction.getDefaultRole());
|
try {
|
||||||
|
context.fPlayer.setRole(faction.getDefaultRole());
|
||||||
|
FactionsPlugin.instance.logFactionEvent(faction, FLogType.INVITES, context.fPlayer.getName(), CC.Green + "joined", "the faction");
|
||||||
|
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, Objects.requireNonNull(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) {
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ 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.FactionsPlugin;
|
||||||
|
import com.massivecraft.factions.cmd.audit.FLogType;
|
||||||
import com.massivecraft.factions.event.FPlayerLeaveEvent;
|
import com.massivecraft.factions.event.FPlayerLeaveEvent;
|
||||||
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.util.CC;
|
||||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import mkremins.fanciful.FancyMessage;
|
import mkremins.fanciful.FancyMessage;
|
||||||
@@ -16,9 +18,13 @@ 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.addAll(Aliases.kick);
|
||||||
this.optionalArgs.put("player name", "player name");
|
this.optionalArgs.put("player name", "player name");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.KICK)
|
this.requirements = new CommandRequirements.Builder(Permission.KICK)
|
||||||
@@ -118,6 +124,7 @@ public class CmdKick extends FCommand {
|
|||||||
if (toKick.getRole() == Role.LEADER) {
|
if (toKick.getRole() == Role.LEADER) {
|
||||||
toKickFaction.promoteNewLeader();
|
toKickFaction.promoteNewLeader();
|
||||||
}
|
}
|
||||||
|
FactionsPlugin.instance.logFactionEvent(toKickFaction, FLogType.INVITES, context.fPlayer.getName(), CC.Red + "kicked", toKick.getName());
|
||||||
toKickFaction.deinvite(toKick);
|
toKickFaction.deinvite(toKick);
|
||||||
toKick.resetFactionData();
|
toKick.resetFactionData();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,14 @@ 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.addAll(Aliases.killholograms);
|
||||||
this.requiredArgs.add("radius");
|
this.requiredArgs.add("radius");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.KILLHOLOS)
|
this.requirements = new CommandRequirements.Builder(Permission.KILLHOLOS)
|
||||||
|
|||||||
@@ -5,9 +5,13 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
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.addAll(Aliases.leave);
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.LEAVE)
|
this.requirements = new CommandRequirements.Builder(Permission.LEAVE)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
|
|||||||
@@ -14,12 +14,15 @@ 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() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("list");
|
this.aliases.addAll(Aliases.list);
|
||||||
this.aliases.add("ls");
|
|
||||||
|
|
||||||
// default values in case user has old config
|
// default values in case user has old config
|
||||||
defaults[0] = "&e&m----------&r&e[ &2Faction List &9{pagenumber}&e/&9{pagecount} &e]&m----------";
|
defaults[0] = "&e&m----------&r&e[ &2Faction List &9{pagenumber}&e/&9{pagecount} &e]&m----------";
|
||||||
@@ -39,74 +42,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,16 +6,19 @@ 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:
|
||||||
description: use the /f lock [on/off] command to temporarily lock the data files from being overwritten
|
description: use the /f lock [on/off] command to temporarily lock the data files from being overwritten
|
||||||
default: op
|
default: op
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public CmdLock() {
|
public CmdLock() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("lock");
|
this.aliases.addAll(Aliases.lock);
|
||||||
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)
|
||||||
|
|||||||
@@ -5,12 +5,13 @@ 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.addAll(Aliases.logins);
|
||||||
this.aliases.add("logins");
|
|
||||||
this.aliases.add("logout");
|
|
||||||
this.aliases.add("logouts");
|
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.MONITOR_LOGINS)
|
this.requirements = new CommandRequirements.Builder(Permission.MONITOR_LOGINS)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
|
|||||||
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.addAll(Aliases.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,9 +7,13 @@ 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.addAll(Aliases.lowPower);
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.POWER_ANY)
|
this.requirements = new CommandRequirements.Builder(Permission.POWER_ANY)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
|
|||||||
@@ -9,9 +9,13 @@ 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.addAll(Aliases.map_map);
|
||||||
this.optionalArgs.put("on/off", "once");
|
this.optionalArgs.put("on/off", "once");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.MAP)
|
this.requirements = new CommandRequirements.Builder(Permission.MAP)
|
||||||
|
|||||||
@@ -5,11 +5,14 @@ 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();
|
||||||
|
|
||||||
this.aliases.add("mapheight");
|
this.aliases.addAll(Aliases.map_height);
|
||||||
this.aliases.add("mh");
|
|
||||||
this.optionalArgs.put("height", "height");
|
this.optionalArgs.put("height", "height");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.MAPHEIGHT)
|
this.requirements = new CommandRequirements.Builder(Permission.MAPHEIGHT)
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ 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.cmd.audit.FLogType;
|
||||||
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,12 +13,13 @@ 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.addAll(Aliases.mod);
|
||||||
this.aliases.add("setmod");
|
|
||||||
this.aliases.add("officer");
|
|
||||||
this.aliases.add("setofficer");
|
|
||||||
|
|
||||||
this.optionalArgs.put("player name", "name");
|
this.optionalArgs.put("player name", "name");
|
||||||
|
|
||||||
@@ -72,6 +75,8 @@ public class CmdMod extends FCommand {
|
|||||||
you.setRole(Role.MODERATOR);
|
you.setRole(Role.MODERATOR);
|
||||||
targetFaction.msg(TL.COMMAND_MOD_PROMOTED, you.describeTo(targetFaction, true));
|
targetFaction.msg(TL.COMMAND_MOD_PROMOTED, you.describeTo(targetFaction, true));
|
||||||
context.msg(TL.COMMAND_MOD_PROMOTES, you.describeTo(context.fPlayer, true));
|
context.msg(TL.COMMAND_MOD_PROMOTES, you.describeTo(context.fPlayer, true));
|
||||||
|
FactionsPlugin.instance.getFlogManager().log(targetFaction, FLogType.RANK_EDIT, context.fPlayer.getName(), you.getName(), ChatColor.LIGHT_PURPLE + "Mod");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,13 +6,14 @@ 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();
|
||||||
|
|
||||||
this.aliases.add("pm");
|
this.aliases.addAll(Aliases.modifyPower);
|
||||||
this.aliases.add("mp");
|
|
||||||
this.aliases.add("modifypower");
|
|
||||||
this.aliases.add("modpower");
|
|
||||||
|
|
||||||
this.requiredArgs.add("name");
|
this.requiredArgs.add("name");
|
||||||
this.requiredArgs.add("power");
|
this.requiredArgs.add("power");
|
||||||
|
|||||||
@@ -9,10 +9,14 @@ 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.addAll(Aliases.near);
|
||||||
this.aliases.add("nearby");
|
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.NEAR)
|
this.requirements = new CommandRequirements.Builder(Permission.NEAR)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
|
|||||||
@@ -3,15 +3,20 @@ 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.addAll(Aliases.open);
|
||||||
this.optionalArgs.put("yes/no", "flip");
|
this.optionalArgs.put("yes/no", "flip");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.OPEN)
|
this.requirements = new CommandRequirements.Builder(Permission.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,9 +8,13 @@ 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.addAll(Aliases.owner_owner);
|
||||||
this.optionalArgs.put("player name", "you");
|
this.optionalArgs.put("player name", "you");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.OWNER)
|
this.requirements = new CommandRequirements.Builder(Permission.OWNER)
|
||||||
|
|||||||
@@ -9,9 +9,13 @@ 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.addAll(Aliases.owner_list);
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.OWNERLIST)
|
this.requirements = new CommandRequirements.Builder(Permission.OWNERLIST)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
|
|||||||
@@ -6,9 +6,13 @@ 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.addAll(Aliases.paypal_see);
|
||||||
this.aliases.add("paypal");
|
|
||||||
|
|
||||||
this.optionalArgs.put("faction", "yours");
|
this.optionalArgs.put("faction", "yours");
|
||||||
|
|
||||||
@@ -20,12 +24,11 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (context.args.size() == 0) {
|
if (context.args.size() == 0) {
|
||||||
if (context.fPlayer.getFaction().getPaypal() == null) {
|
if (context.fPlayer.getFaction().getPaypal() == null) {
|
||||||
context.msg(TL.COMMAND_PAYPAL_NOTSET);
|
context.msg(TL.COMMAND_PAYPAL_NOTSET);
|
||||||
|
|||||||
@@ -8,8 +8,12 @@ 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.addAll(Aliases.paypal_set);
|
||||||
|
|
||||||
this.optionalArgs.put("faction", "yours");
|
this.optionalArgs.put("faction", "yours");
|
||||||
|
|
||||||
@@ -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,9 +8,13 @@ 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.addAll(Aliases.peaceful);
|
||||||
this.requiredArgs.add("faction tag");
|
this.requiredArgs.add("faction tag");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.SET_PEACEFUL)
|
this.requirements = new CommandRequirements.Builder(Permission.SET_PEACEFUL)
|
||||||
|
|||||||
@@ -17,12 +17,13 @@ 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.addAll(Aliases.perm);
|
||||||
this.aliases.add("perms");
|
|
||||||
this.aliases.add("permission");
|
|
||||||
this.aliases.add("permissions");
|
|
||||||
|
|
||||||
this.optionalArgs.put("relation", "relation");
|
this.optionalArgs.put("relation", "relation");
|
||||||
this.optionalArgs.put("action", "action");
|
this.optionalArgs.put("action", "action");
|
||||||
|
|||||||
@@ -10,9 +10,13 @@ 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.addAll(Aliases.permanent_faction);
|
||||||
this.requiredArgs.add("faction tag");
|
this.requiredArgs.add("faction tag");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.SET_PERMANENT)
|
this.requirements = new CommandRequirements.Builder(Permission.SET_PERMANENT)
|
||||||
|
|||||||
@@ -6,9 +6,14 @@ 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.addAll(Aliases.permanent_power);
|
||||||
this.requiredArgs.add("faction");
|
this.requiredArgs.add("faction");
|
||||||
this.requiredArgs.add("power");
|
this.requiredArgs.add("power");
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
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.addAll(Aliases.titles);
|
||||||
|
this.requirements = new CommandRequirements.Builder(Permission.TOGGLE_TITLES)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void perform(CommandContext context) {
|
||||||
|
context.fPlayer.setTitlesEnabled(!context.fPlayer.hasTitlesEnabled());
|
||||||
|
context.msg(TL.COMMAND_TITLETOGGLE_TOGGLED, context.fPlayer.hasTitlesEnabled() ? FactionsPlugin.getInstance().color("&dEnabled") : FactionsPlugin.getInstance().color("&dDisabled"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TL getUsageTranslation() {
|
||||||
|
return TL.COMMAND_TITLETOGGLE_DESCRIPTION;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,10 +7,13 @@ 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.addAll(Aliases.power_power);
|
||||||
this.aliases.add("pow");
|
|
||||||
this.optionalArgs.put("player name", "you");
|
this.optionalArgs.put("player name", "you");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.POWER)
|
this.requirements = new CommandRequirements.Builder(Permission.POWER)
|
||||||
|
|||||||
@@ -9,9 +9,13 @@ 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.addAll(Aliases.power_boost);
|
||||||
this.requiredArgs.add("plugin|f|player|faction");
|
this.requiredArgs.add("plugin|f|player|faction");
|
||||||
this.requiredArgs.add("name");
|
this.requiredArgs.add("name");
|
||||||
this.requiredArgs.add("# or reset");
|
this.requiredArgs.add("# or reset");
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ 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.duels.RequestGUI;
|
||||||
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,9 +11,13 @@ 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.addAll(Aliases.reload);
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.RELOAD).build();
|
this.requirements = new CommandRequirements.Builder(Permission.RELOAD).build();
|
||||||
}
|
}
|
||||||
@@ -26,7 +32,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,7 +40,14 @@ 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);
|
||||||
|
//Duels
|
||||||
|
RequestGUI.inv = null;
|
||||||
|
RequestGUI.responseMap.clear();
|
||||||
|
|
||||||
context.msg(TL.COMMAND_RELOAD_TIME, timeReload);
|
context.msg(TL.COMMAND_RELOAD_TIME, timeReload);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,14 @@ 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.addAll(Aliases.rules);
|
||||||
aliases.add("rule");
|
|
||||||
aliases.add("rules");
|
|
||||||
|
|
||||||
this.optionalArgs.put("add/remove/set/clear", "");
|
this.optionalArgs.put("add/remove/set/clear", "");
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,12 @@ 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.addAll(Aliases.scoreboard);
|
||||||
this.aliases.add("scoreboard");
|
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.SCOREBOARD)
|
this.requirements = new CommandRequirements.Builder(Permission.SCOREBOARD)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
import com.massivecraft.factions.Board;
|
import com.massivecraft.factions.*;
|
||||||
import com.massivecraft.factions.Conf;
|
|
||||||
import com.massivecraft.factions.FPlayers;
|
|
||||||
import com.massivecraft.factions.Factions;
|
|
||||||
import com.massivecraft.factions.shop.ShopConfig;
|
import com.massivecraft.factions.shop.ShopConfig;
|
||||||
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;
|
||||||
|
|
||||||
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.addAll(Aliases.saveAll);
|
||||||
this.aliases.add("save");
|
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.SAVE)
|
this.requirements = new CommandRequirements.Builder(Permission.SAVE)
|
||||||
.build();
|
.build();
|
||||||
@@ -25,6 +25,11 @@ public class CmdSaveAll extends FCommand {
|
|||||||
Factions.getInstance().forceSave(false);
|
Factions.getInstance().forceSave(false);
|
||||||
Board.getInstance().forceSave(false);
|
Board.getInstance().forceSave(false);
|
||||||
Conf.save();
|
Conf.save();
|
||||||
|
try {
|
||||||
|
FactionsPlugin.instance.getFlogManager().saveLogs();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
ShopConfig.saveShop();
|
ShopConfig.saveShop();
|
||||||
context.msg(TL.COMMAND_SAVEALL_SUCCESS);
|
context.msg(TL.COMMAND_SAVEALL_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -28,8 +32,7 @@ public class CmdSeeChunk extends FCommand {
|
|||||||
|
|
||||||
public CmdSeeChunk() {
|
public CmdSeeChunk() {
|
||||||
super();
|
super();
|
||||||
aliases.add("seechunk");
|
aliases.addAll(Aliases.seeChunk);
|
||||||
aliases.add("sc");
|
|
||||||
|
|
||||||
this.useParticles = FactionsPlugin.getInstance().getConfig().getBoolean("see-chunk.particles", true);
|
this.useParticles = FactionsPlugin.getInstance().getConfig().getBoolean("see-chunk.particles", true);
|
||||||
interval = FactionsPlugin.getInstance().getConfig().getLong("see-chunk.interval", 10L);
|
interval = FactionsPlugin.getInstance().getConfig().getLong("see-chunk.interval", 10L);
|
||||||
@@ -71,7 +74,9 @@ public class CmdSeeChunk extends FCommand {
|
|||||||
for (Object nameObject : seeChunkMap.keySet()) {
|
for (Object nameObject : seeChunkMap.keySet()) {
|
||||||
String name = nameObject + "";
|
String name = nameObject + "";
|
||||||
Player player = Bukkit.getPlayer(name);
|
Player player = Bukkit.getPlayer(name);
|
||||||
showBorders(player);
|
if (player != null) {
|
||||||
|
showBorders(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
manageTask();
|
manageTask();
|
||||||
}, 0, interval);
|
}, 0, interval);
|
||||||
@@ -107,24 +112,19 @@ public class CmdSeeChunk extends FCommand {
|
|||||||
private void showPillar(Player player, World world, int blockX, int blockZ) {
|
private void showPillar(Player player, World world, int blockX, int blockZ) {
|
||||||
for (int blockY = 0; blockY < player.getLocation().getBlockY() + 30; blockY++) {
|
for (int blockY = 0; blockY < player.getLocation().getBlockY() + 30; blockY++) {
|
||||||
Location loc = new Location(world, blockX, blockY, blockZ).add(0.5, 0, 0.5);
|
Location loc = new Location(world, blockX, blockY, blockZ).add(0.5, 0, 0.5);
|
||||||
if (loc.getBlock().getType() != Material.AIR) {
|
if (loc.getBlock().getType() != Material.AIR) continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (useParticles) {
|
if (useParticles) {
|
||||||
if (FactionsPlugin.getInstance().useNonPacketParticles) {
|
if (FactionsPlugin.getInstance().useNonPacketParticles) {
|
||||||
// Dust options only exists in the 1.13 API, so we use an
|
// Dust options only exists in the 1.13 API, so we use an
|
||||||
// alternative method to achieve this in lower versions.
|
// alternative method to achieve this in lower versions.
|
||||||
if (FactionsPlugin.getInstance().mc113 || FactionsPlugin.getInstance().mc114) {
|
if (FactionsPlugin.getInstance().mc113 || FactionsPlugin.getInstance().mc114 || FactionsPlugin.getInstance().mc115) {
|
||||||
player.spawnParticle(Particle.REDSTONE, loc, 0, new Particle.DustOptions(Color.RED, 1));
|
player.spawnParticle(Particle.REDSTONE, loc, 0, new Particle.DustOptions(Color.RED, 1));
|
||||||
} else {
|
} else {
|
||||||
player.getWorld().spawnParticle(Particle.REDSTONE, loc, 0, 255, 0, 0, 1);
|
player.getWorld().spawnParticle(Particle.REDSTONE, loc, 0, 255, 0, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.effect.display(0, 0, 0, 0, 1, loc, player);
|
this.effect.display(0, 0, 0, 0, 1, loc, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Material type = blockY % 5 == 0 ? XMaterial.REDSTONE_LAMP.parseMaterial() : XMaterial.BLACK_STAINED_GLASS.parseMaterial();
|
Material type = blockY % 5 == 0 ? XMaterial.REDSTONE_LAMP.parseMaterial() : XMaterial.BLACK_STAINED_GLASS.parseMaterial();
|
||||||
VisualizeUtil.addLocation(player, loc, type);
|
VisualizeUtil.addLocation(player, loc, type);
|
||||||
|
|||||||
@@ -5,11 +5,14 @@ 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;
|
||||||
|
|
||||||
public class CmdSeeDiscord extends FCommand{
|
public class CmdSeeDiscord extends FCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Driftay
|
||||||
|
*/
|
||||||
|
|
||||||
public CmdSeeDiscord() {
|
public CmdSeeDiscord() {
|
||||||
this.aliases.add("seediscord");
|
this.aliases.addAll(Aliases.discord_see);
|
||||||
this.aliases.add("discord");
|
|
||||||
|
|
||||||
this.optionalArgs.put("faction", "yours");
|
this.optionalArgs.put("faction", "yours");
|
||||||
|
|
||||||
@@ -21,12 +24,11 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (context.args.size() == 0) {
|
if (context.args.size() == 0) {
|
||||||
if (context.fPlayer.getFaction().getDiscord() == null) {
|
if (context.fPlayer.getFaction().getDiscord() == null) {
|
||||||
context.msg(TL.COMMAND_DISCORD_NOTSET);
|
context.msg(TL.COMMAND_DISCORD_NOTSET);
|
||||||
|
|||||||
@@ -5,9 +5,13 @@ 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.addAll(Aliases.setBanner);
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.BANNER)
|
this.requirements = new CommandRequirements.Builder(Permission.BANNER)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
|
|||||||
@@ -6,13 +6,14 @@ 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();
|
||||||
|
|
||||||
this.aliases.add("defaultrole");
|
this.aliases.addAll(Aliases.setDefaultRole);
|
||||||
this.aliases.add("defaultrank");
|
|
||||||
this.aliases.add("default");
|
|
||||||
this.aliases.add("def");
|
|
||||||
this.requiredArgs.add("role");
|
this.requiredArgs.add("role");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.DEFAULTRANK)
|
this.requirements = new CommandRequirements.Builder(Permission.DEFAULTRANK)
|
||||||
|
|||||||
@@ -8,9 +8,13 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdSetDiscord extends FCommand {
|
public class CmdSetDiscord extends FCommand {
|
||||||
|
|
||||||
public CmdSetDiscord(){
|
/**
|
||||||
|
* @author Driftay
|
||||||
|
*/
|
||||||
|
|
||||||
|
public CmdSetDiscord() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("setdiscord");
|
this.aliases.addAll(Aliases.discord_set);
|
||||||
|
|
||||||
this.optionalArgs.put("faction", "yours");
|
this.optionalArgs.put("faction", "yours");
|
||||||
|
|
||||||
@@ -60,7 +64,7 @@ public class CmdSetDiscord extends FCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDiscordInvite(String invite){
|
private boolean isDiscordInvite(String invite) {
|
||||||
return invite.contains("discord.gg") || invite.contains("discord.me");
|
return invite.contains("discord.gg") || invite.contains("discord.me");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,13 @@ 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.addAll(Aliases.setWarp);
|
||||||
this.aliases.add("sw");
|
|
||||||
this.requiredArgs.add("warp name");
|
this.requiredArgs.add("warp name");
|
||||||
this.optionalArgs.put("password", "password");
|
this.optionalArgs.put("password", "password");
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.SETWARP).playerOnly().memberOnly().withAction(PermissableAction.SETWARP).build();
|
this.requirements = new CommandRequirements.Builder(Permission.SETWARP).playerOnly().memberOnly().withAction(PermissableAction.SETWARP).build();
|
||||||
|
|||||||
@@ -7,9 +7,12 @@ 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.addAll(Aliases.setMaxVaults);
|
||||||
this.aliases.add("smv");
|
|
||||||
this.requiredArgs.add("faction");
|
this.requiredArgs.add("faction");
|
||||||
this.requiredArgs.add("number");
|
this.requiredArgs.add("number");
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,18 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.*;
|
import com.massivecraft.factions.*;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.Access;
|
||||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
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.addAll(Aliases.setHome);
|
||||||
this.optionalArgs.put("faction tag", "mine");
|
this.optionalArgs.put("faction tag", "mine");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.SETHOME)
|
this.requirements = new CommandRequirements.Builder(Permission.SETHOME)
|
||||||
@@ -20,36 +25,48 @@ 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 (!context.args.isEmpty()) {
|
||||||
if (!context.payForCommand(Conf.econCostSethome, TL.COMMAND_SETHOME_TOSET, TL.COMMAND_SETHOME_FORSET)) {
|
Faction target = context.argAsFaction(0);
|
||||||
return;
|
if (target == null) return;
|
||||||
}
|
context.faction = target;
|
||||||
|
if (target.getAccess(context.fPlayer, PermissableAction.SETHOME) != Access.ALLOW) {
|
||||||
|
context.fPlayer.msg(TL.GENERIC_FPERM_NOPERMISSION, "set faction home");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
faction.setHome(context.player.getLocation());
|
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||||
|
if (!context.payForCommand(Conf.econCostSethome, TL.COMMAND_SETHOME_TOSET, TL.COMMAND_SETHOME_FORSET)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
faction.msg(TL.COMMAND_SETHOME_SET, context.fPlayer.describeTo(context.faction, true));
|
faction.setHome(context.player.getLocation());
|
||||||
faction.sendMessage(FactionsPlugin.getInstance().cmdBase.cmdHome.getUsageTemplate(context));
|
|
||||||
if (faction != context.faction) {
|
faction.msg(TL.COMMAND_SETHOME_SET, context.fPlayer.describeTo(context.faction, true));
|
||||||
context.msg(TL.COMMAND_SETHOME_SETOTHER, faction.getTag(context.fPlayer));
|
faction.sendMessage(FactionsPlugin.getInstance().cmdBase.cmdHome.getUsageTemplate(context));
|
||||||
}
|
if (faction != context.faction) {
|
||||||
|
context.msg(TL.COMMAND_SETHOME_SETOTHER, faction.getTag(context.fPlayer));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -14,11 +14,14 @@ 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() {
|
||||||
this.aliases.add("show");
|
this.aliases.addAll(Aliases.show_show);
|
||||||
this.aliases.add("who");
|
|
||||||
|
|
||||||
// add defaults to /f show in case config doesnt have it
|
// add defaults to /f show in case config doesnt have it
|
||||||
defaults.add("{header}");
|
defaults.add("{header}");
|
||||||
|
|||||||
@@ -8,9 +8,12 @@ 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.addAll(Aliases.show_claims);
|
||||||
this.aliases.add("showclaim");
|
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.SHOWCLAIMS)
|
this.requirements = new CommandRequirements.Builder(Permission.SHOWCLAIMS)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
|
|||||||
@@ -10,9 +10,13 @@ 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.addAll(Aliases.show_invites);
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.SHOW_INVITES)
|
this.requirements = new CommandRequirements.Builder(Permission.SHOW_INVITES)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
@@ -29,8 +33,6 @@ public class CmdShowInvites extends FCommand {
|
|||||||
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,17 +7,20 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
|
|
||||||
public class CmdSpawnerLock extends FCommand {
|
public class CmdSpawnerLock extends FCommand {
|
||||||
|
|
||||||
public CmdSpawnerLock(){
|
/**
|
||||||
|
* @author Illyria Team
|
||||||
|
*/
|
||||||
|
|
||||||
|
public CmdSpawnerLock() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("lockspawners");
|
this.aliases.addAll(Aliases.spawnerlock);
|
||||||
this.aliases.add("spawnerlock");
|
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.LOCKSPAWNERS)
|
this.requirements = new CommandRequirements.Builder(Permission.LOCKSPAWNERS)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context){
|
public void perform(CommandContext context) {
|
||||||
Conf.spawnerLock = !Conf.spawnerLock;
|
Conf.spawnerLock = !Conf.spawnerLock;
|
||||||
context.msg(TL.COMMAND_SPAWNER_LOCK_TOGGLED, Conf.spawnerLock ? FactionsPlugin.getInstance().color("&aEnabled") : FactionsPlugin.getInstance().color("&4Disabled"));
|
context.msg(TL.COMMAND_SPAWNER_LOCK_TOGGLED, Conf.spawnerLock ? FactionsPlugin.getInstance().color("&aEnabled") : FactionsPlugin.getInstance().color("&4Disabled"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,10 +10,13 @@ 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.addAll(Aliases.status);
|
||||||
this.aliases.add("s");
|
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.STATUS)
|
this.requirements = new CommandRequirements.Builder(Permission.STATUS)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
|
|||||||
@@ -4,9 +4,13 @@ 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.addAll(Aliases.stealth);
|
||||||
this.aliases.add("stealth");
|
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.STEALTH)
|
this.requirements = new CommandRequirements.Builder(Permission.STEALTH)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
|
|||||||
@@ -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();
|
||||||
@@ -15,7 +18,7 @@ public class CmdStrikes extends FCommand {
|
|||||||
public CmdStrikes() {
|
public CmdStrikes() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.aliases.add("strikes");
|
this.aliases.addAll(Aliases.strikes_strikes);
|
||||||
|
|
||||||
this.addSubCommand(cmdStrikesGive);
|
this.addSubCommand(cmdStrikesGive);
|
||||||
this.addSubCommand(cmdStrikesInfo);
|
this.addSubCommand(cmdStrikesInfo);
|
||||||
|
|||||||
@@ -6,10 +6,13 @@ 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();
|
||||||
this.aliases.add("give");
|
this.aliases.addAll(Aliases.strikes_give);
|
||||||
this.requiredArgs.add(0, "faction");
|
this.requiredArgs.add(0, "faction");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.SETSTRIKES)
|
this.requirements = new CommandRequirements.Builder(Permission.SETSTRIKES)
|
||||||
|
|||||||
@@ -6,9 +6,13 @@ 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.addAll(Aliases.strikes_info);
|
||||||
this.optionalArgs.put("target", "faction");
|
this.optionalArgs.put("target", "faction");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.SETSTRIKES)
|
this.requirements = new CommandRequirements.Builder(Permission.SETSTRIKES)
|
||||||
|
|||||||
@@ -6,9 +6,13 @@ 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.addAll(Aliases.strikes_set);
|
||||||
this.requiredArgs.add(0, "faction");
|
this.requiredArgs.add(0, "faction");
|
||||||
this.requiredArgs.add(1, "amount");
|
this.requiredArgs.add(1, "amount");
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,13 @@ 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();
|
||||||
this.aliases.add("take");
|
this.aliases.addAll(Aliases.strikes_take);
|
||||||
this.requiredArgs.add(0, "faction");
|
this.requiredArgs.add(0, "faction");
|
||||||
this.requiredArgs.add(1, "number of strikes");
|
this.requiredArgs.add(1, "number of strikes");
|
||||||
|
|
||||||
|
|||||||
@@ -13,10 +13,13 @@ 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.addAll(Aliases.stuck);
|
||||||
this.aliases.add("halp!"); // halp!c:
|
|
||||||
|
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.STUCK)
|
this.requirements = new CommandRequirements.Builder(Permission.STUCK)
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
import com.massivecraft.factions.*;
|
import com.massivecraft.factions.*;
|
||||||
|
import com.massivecraft.factions.cmd.audit.FLogType;
|
||||||
|
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,9 +15,12 @@ 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.addAll(Aliases.tag);
|
||||||
this.aliases.add("rename");
|
|
||||||
|
|
||||||
this.requiredArgs.add("faction tag");
|
this.requiredArgs.add("faction tag");
|
||||||
|
|
||||||
@@ -28,6 +33,7 @@ public class CmdTag extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
|
|
||||||
String tag = context.argAsString(0);
|
String tag = context.argAsString(0);
|
||||||
|
|
||||||
// TODO does not first test cover selfcase?
|
// TODO does not first test cover selfcase?
|
||||||
@@ -61,6 +67,9 @@ public class CmdTag extends FCommand {
|
|||||||
|
|
||||||
String oldtag = context.faction.getTag();
|
String oldtag = context.faction.getTag();
|
||||||
context.faction.setTag(tag);
|
context.faction.setTag(tag);
|
||||||
|
Discord.changeFactionTag(context.faction, oldtag);
|
||||||
|
FactionsPlugin.instance.logFactionEvent(context.faction, FLogType.FTAG_EDIT, context.fPlayer.getName(), tag);
|
||||||
|
|
||||||
|
|
||||||
// Inform
|
// Inform
|
||||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||||
@@ -68,14 +77,12 @@ public class CmdTag extends FCommand {
|
|||||||
fplayer.msg(TL.COMMAND_TAG_FACTION, context.fPlayer.describeTo(context.faction, true), context.faction.getTag(context.faction));
|
fplayer.msg(TL.COMMAND_TAG_FACTION, context.fPlayer.describeTo(context.faction, true), context.faction.getTag(context.faction));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Broadcast the tag change (if applicable)
|
// Broadcast the tag change (if applicable)
|
||||||
if (Conf.broadcastTagChanges) {
|
if (Conf.broadcastTagChanges) {
|
||||||
Faction faction = fplayer.getFaction();
|
Faction faction = fplayer.getFaction();
|
||||||
fplayer.msg(TL.COMMAND_TAG_CHANGED, context.fPlayer.getColorTo(faction) + oldtag, context.faction.getTag(faction));
|
fplayer.msg(TL.COMMAND_TAG_CHANGED, context.fPlayer.getColorTo(faction) + oldtag, context.faction.getTag(faction));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FTeamWrapper.updatePrefixes(context.faction);
|
FTeamWrapper.updatePrefixes(context.faction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,19 @@ 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.addAll(Aliases.title);
|
||||||
this.requiredArgs.add("player name");
|
this.requiredArgs.add("player name");
|
||||||
this.optionalArgs.put("title", "");
|
this.optionalArgs.put("title", "");
|
||||||
|
|
||||||
@@ -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,11 +6,13 @@ 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.addAll(Aliases.toggleAllianceChat);
|
||||||
this.aliases.add("togglealliancechat");
|
|
||||||
this.aliases.add("ac");
|
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.TOGGLE_ALLIANCE_CHAT)
|
this.requirements = new CommandRequirements.Builder(Permission.TOGGLE_ALLIANCE_CHAT)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
|
|||||||
@@ -12,10 +12,13 @@ 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.addAll(Aliases.top);
|
||||||
this.aliases.add("t");
|
|
||||||
this.requiredArgs.add("criteria");
|
this.requiredArgs.add("criteria");
|
||||||
this.optionalArgs.put("page", "1");
|
this.optionalArgs.put("page", "1");
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,19 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import com.massivecraft.factions.listeners.FactionsBlockListener;
|
import com.massivecraft.factions.listeners.FactionsBlockListener;
|
||||||
import com.massivecraft.factions.listeners.FactionsPlayerListener;
|
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.util.WarmUpUtil;
|
import com.massivecraft.factions.util.WarmUpUtil;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
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.addAll(Aliases.tpBanner);
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.TPBANNER)
|
this.requirements = new CommandRequirements.Builder(Permission.TPBANNER)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
@@ -25,8 +28,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", () -> {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user