Compare commits
40 Commits
2.2.7-STAB
...
2.3.1-STAB
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e55f053e4d | ||
|
|
945edc946e | ||
|
|
8cace99444 | ||
|
|
5d4735859b | ||
|
|
cef153691d | ||
|
|
4dec162d46 | ||
|
|
606e82c890 | ||
|
|
323dce1c4f | ||
|
|
36c8d53a85 | ||
|
|
81bac35b51 | ||
|
|
19f09a6379 | ||
|
|
19ea590e5f | ||
|
|
d6a274ddc5 | ||
|
|
5591048136 | ||
|
|
fe7738fea0 | ||
|
|
3ba6e1f376 | ||
|
|
dfbfbf9981 | ||
|
|
13399c53c5 | ||
|
|
55d6af7195 | ||
|
|
4f675dfd66 | ||
|
|
22957b641b | ||
|
|
0fc3e47289 | ||
|
|
730693aed1 | ||
|
|
61570be012 | ||
|
|
bcc04e6174 | ||
|
|
d30780e06e | ||
|
|
ed73baf5f1 | ||
|
|
94d2035c78 | ||
|
|
8ff8c78a44 | ||
|
|
591dc2172f | ||
|
|
1a4c860c46 | ||
|
|
ad56264c5d | ||
|
|
def1a8b15a | ||
|
|
8b577d360b | ||
|
|
f34ebc73fa | ||
|
|
c86db7ab51 | ||
|
|
070f239948 | ||
|
|
018f08699d | ||
|
|
5542245b2a | ||
|
|
6eb204587d |
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.Saber.pw
|
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!
|
||||||
|
|
||||||
|
|||||||
2
pom.xml
2
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-2.2.7-RC</version>
|
<version>1.6.9.5-2.3.1-RC</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>SaberFactions</name>
|
<name>SaberFactions</name>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
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;
|
||||||
@@ -99,15 +98,30 @@ public class Conf {
|
|||||||
public static boolean autoLeaveDeleteFPlayerData = true; // Let them just remove player from Faction.
|
public static boolean autoLeaveDeleteFPlayerData = true; // Let them just remove player from Faction.
|
||||||
public static boolean worldGuardChecking = false;
|
public static boolean worldGuardChecking = false;
|
||||||
public static boolean worldGuardBuildPriority = false;
|
public static boolean worldGuardBuildPriority = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Claim Fill
|
||||||
|
public static int maxFillClaimCount = 25;
|
||||||
|
public static int maxFillClaimDistance = 5;
|
||||||
|
|
||||||
public static boolean factionsDrainEnabled = false;
|
public static boolean factionsDrainEnabled = false;
|
||||||
//RESERVE
|
//RESERVE
|
||||||
public static boolean useReserveSystem = true;
|
public static boolean useReserveSystem = true;
|
||||||
//AUDIT
|
//AUDIT
|
||||||
public static boolean useAuditSystem = true;
|
public static boolean useAuditSystem = true;
|
||||||
|
|
||||||
|
//INSPECT
|
||||||
|
public static boolean useInspectSystem = true;
|
||||||
|
|
||||||
//GUI's
|
//GUI's
|
||||||
public static boolean useDisbandGUI = true;
|
public static boolean useDisbandGUI = true;
|
||||||
|
|
||||||
|
//SEALTH
|
||||||
|
public static boolean useSealthSystem = true;
|
||||||
|
|
||||||
|
//STRIKES
|
||||||
|
public static boolean useStrikeSystem = 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>";
|
||||||
@@ -123,7 +137,7 @@ public class Conf {
|
|||||||
public static Boolean factionDiscordTags = false;
|
public static Boolean factionDiscordTags = false;
|
||||||
public static String factionTag = "(NAME) [FACTION]";
|
public static String factionTag = "(NAME) [FACTION]";
|
||||||
public static Boolean factionRoles = false;
|
public static Boolean factionRoles = false;
|
||||||
public static List<Integer> factionRoleColor = new ArrayList<Integer>(){{
|
public static List<Integer> factionRoleColor = new ArrayList<Integer>() {{
|
||||||
add(25);
|
add(25);
|
||||||
add(162);
|
add(162);
|
||||||
add(203);
|
add(203);
|
||||||
@@ -259,6 +273,7 @@ public class Conf {
|
|||||||
public static Set<Material> territoryBypassProtectedMaterials = EnumSet.noneOf(Material.class);
|
public static Set<Material> territoryBypassProtectedMaterials = EnumSet.noneOf(Material.class);
|
||||||
// Dependency check
|
// Dependency check
|
||||||
public static boolean dependencyCheck = true;
|
public static boolean dependencyCheck = true;
|
||||||
|
public static boolean enableClickToClaim = true;
|
||||||
|
|
||||||
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<>();
|
||||||
@@ -580,7 +595,9 @@ public class Conf {
|
|||||||
FactionsPlugin.getInstance().persist.save(i);
|
FactionsPlugin.getInstance().persist.save(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void saveSync() { FactionsPlugin.instance.persist.saveSync(i); }
|
public static void saveSync() {
|
||||||
|
FactionsPlugin.instance.persist.saveSync(i);
|
||||||
|
}
|
||||||
|
|
||||||
public enum Backend {
|
public enum Backend {
|
||||||
JSON,
|
JSON,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ 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 {
|
||||||
@@ -150,7 +151,9 @@ 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"; }
|
public String formatXAndZ(String splitter) {
|
||||||
|
return chunkToBlock(this.x) + "x" + splitter + " " + chunkToBlock(this.z) + "z";
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------//
|
//----------------------------------------------//
|
||||||
// Misc Geometry
|
// Misc Geometry
|
||||||
@@ -178,8 +181,8 @@ public class FLocation implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInChunk(Location loc) {
|
public boolean isInChunk(Location loc) {
|
||||||
if(loc == null) return false;
|
if (loc == null) return false;
|
||||||
if(loc.getWorld() == null) 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;
|
||||||
|
|||||||
@@ -34,60 +34,70 @@ public interface FPlayer extends EconomyParticipator {
|
|||||||
/**
|
/**
|
||||||
* Determine if a player has enemies nearby based on the enemy check task in CmdFly
|
* 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
|
* NOTE: THIS VALUE IS ONLY UPDATED WHEN A USER IS USING FLY
|
||||||
|
*
|
||||||
* @return enemiesNearby as a boolean
|
* @return enemiesNearby as a boolean
|
||||||
*/
|
*/
|
||||||
boolean hasEnemiesNearby();
|
boolean hasEnemiesNearby();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set if this FPlayer has an enemy nearby
|
* Set if this FPlayer has an enemy nearby
|
||||||
|
*
|
||||||
* @param b enemiesNearby
|
* @param b enemiesNearby
|
||||||
*/
|
*/
|
||||||
void setEnemiesNearby(Boolean b);
|
void setEnemiesNearby(Boolean b);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if a player has setup their Discord before
|
* Get if a player has setup their Discord before
|
||||||
|
*
|
||||||
* @return if the player setup Discord as a boolean
|
* @return if the player setup Discord as a boolean
|
||||||
*/
|
*/
|
||||||
boolean discordSetup();
|
boolean discordSetup();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the players Discord user ID
|
* Get the players Discord user ID
|
||||||
|
*
|
||||||
* @return players Discord user ID as a String
|
* @return players Discord user ID as a String
|
||||||
*/
|
*/
|
||||||
String discordUserID();
|
String discordUserID();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the players Boolean defining if the player has setup their Discord
|
* Set the players Boolean defining if the player has setup their Discord
|
||||||
|
*
|
||||||
* @param b Boolean for discordSetup to be defined to
|
* @param b Boolean for discordSetup to be defined to
|
||||||
*/
|
*/
|
||||||
void setDiscordSetup(Boolean b);
|
void setDiscordSetup(Boolean b);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the players Discord user ID
|
* Set the players Discord user ID
|
||||||
|
*
|
||||||
* @param s String for their user ID to be set to
|
* @param s String for their user ID to be set to
|
||||||
*/
|
*/
|
||||||
void setDiscordUserID(String s);
|
void setDiscordUserID(String s);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the players Discord user (If the player has not setup Discord it will return null!)
|
* Get the players Discord user (If the player has not setup Discord it will return null!)
|
||||||
|
*
|
||||||
* @return User from players set Discord User ID
|
* @return User from players set Discord User ID
|
||||||
*/
|
*/
|
||||||
User discordUser();
|
User discordUser();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to check if this player should be served titles
|
* Used to check if this player should be served titles
|
||||||
|
*
|
||||||
* @return if this FPlayer has titles enabled as a boolean
|
* @return if this FPlayer has titles enabled as a boolean
|
||||||
*/
|
*/
|
||||||
boolean hasTitlesEnabled();
|
boolean hasTitlesEnabled();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to set if player should be served titles
|
* Used to set if player should be served titles
|
||||||
|
*
|
||||||
* @param b Boolean to titlesEnabled to
|
* @param b Boolean to titlesEnabled to
|
||||||
*/
|
*/
|
||||||
void setTitlesEnabled(Boolean b);
|
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
|
||||||
*/
|
*/
|
||||||
boolean isInFactionsChest();
|
boolean isInFactionsChest();
|
||||||
|
|||||||
@@ -247,6 +247,8 @@ public interface Faction extends EconomyParticipator {
|
|||||||
|
|
||||||
void setHome(Location home);
|
void setHome(Location home);
|
||||||
|
|
||||||
|
void deleteHome();
|
||||||
|
|
||||||
long getFoundedDate();
|
long getFoundedDate();
|
||||||
|
|
||||||
void setFoundedDate(long newDate);
|
void setFoundedDate(long newDate);
|
||||||
|
|||||||
@@ -78,8 +78,10 @@ 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;
|
||||||
|
public List<String> itemList = getConfig().getStringList("fchest.Items-Not-Allowed");
|
||||||
SkriptAddon skriptAddon;
|
SkriptAddon skriptAddon;
|
||||||
private FactionsPlayerListener factionsPlayerListener;
|
private FactionsPlayerListener factionsPlayerListener;
|
||||||
private boolean locked = false;
|
private boolean locked = false;
|
||||||
@@ -89,7 +91,6 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
private ClipPlaceholderAPIManager clipPlaceholderAPIManager;
|
private ClipPlaceholderAPIManager clipPlaceholderAPIManager;
|
||||||
private boolean mvdwPlaceholderAPIManager = false;
|
private boolean mvdwPlaceholderAPIManager = false;
|
||||||
private Listener[] eventsListener;
|
private Listener[] eventsListener;
|
||||||
public List<String> itemList = getConfig().getStringList("fchest.Items-Not-Allowed");
|
|
||||||
private Worldguard wg;
|
private Worldguard wg;
|
||||||
private FLogManager fLogManager;
|
private FLogManager fLogManager;
|
||||||
private List<ReserveObject> reserveObjects;
|
private List<ReserveObject> reserveObjects;
|
||||||
@@ -164,6 +165,10 @@ 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 ====");
|
||||||
@@ -425,6 +430,18 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
try {
|
||||||
|
String path = Paths.get(getDataFolder().getAbsolutePath()).toAbsolutePath().toString() + File.separator + "reserves.json";
|
||||||
|
File file = new File(path);
|
||||||
|
if (!file.exists()) {
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
file.createNewFile();
|
||||||
|
}
|
||||||
|
Files.write(Paths.get(file.getPath()), getGsonBuilder().create().toJson(reserveObjects).getBytes());
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
// only save data if plugin actually completely loaded successfully
|
// only save data if plugin actually completely loaded successfully
|
||||||
if (this.loadSuccessful) Conf.saveSync();
|
if (this.loadSuccessful) Conf.saveSync();
|
||||||
|
|
||||||
@@ -464,7 +481,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));
|
||||||
|
|||||||
@@ -21,8 +21,10 @@ public class Aliases {
|
|||||||
public static ArrayList<String> claim_auto = new ArrayList<>(Collections.singletonList("autoclaim"));
|
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_claim = new ArrayList<>(Collections.singletonList("claim"));
|
||||||
public static ArrayList<String> claim_at = new ArrayList<>(Collections.singletonList("claimat"));
|
public static ArrayList<String> claim_at = new ArrayList<>(Collections.singletonList("claimat"));
|
||||||
|
public static ArrayList<String> claim_claimFill = new ArrayList<>(Arrays.asList("claimfill", "cf"));
|
||||||
public static ArrayList<String> claim_line = new ArrayList<>(Arrays.asList("claimline", "cl"));
|
public static ArrayList<String> claim_line = new ArrayList<>(Arrays.asList("claimline", "cl"));
|
||||||
public static ArrayList<String> claim_corner = new ArrayList<>(Arrays.asList("corner"));
|
public static ArrayList<String> claim_corner = new ArrayList<>(Arrays.asList("corner"));
|
||||||
|
public static ArrayList<String> delfHome = new ArrayList<>(Arrays.asList("delhome", "deletehome"));
|
||||||
public static ArrayList<String> unclaim_all_safe = new ArrayList<>(Arrays.asList("safeunclaimall", "safedeclaimall"));
|
public static ArrayList<String> unclaim_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_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_unsafe = new ArrayList<>(Arrays.asList("unclaimall", "declaimall"));
|
||||||
|
|||||||
51
src/main/java/com/massivecraft/factions/cmd/CmdDelHome.java
Normal file
51
src/main/java/com/massivecraft/factions/cmd/CmdDelHome.java
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Conf;
|
||||||
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factions - Developed by Driftay.
|
||||||
|
* All rights reserved 2020.
|
||||||
|
* Creation Date: 3/24/2020
|
||||||
|
*/
|
||||||
|
public class CmdDelHome extends FCommand {
|
||||||
|
|
||||||
|
public CmdDelHome() {
|
||||||
|
this.aliases.addAll(Aliases.delfHome);
|
||||||
|
|
||||||
|
this.requirements = new CommandRequirements.Builder(Permission.DELHOME)
|
||||||
|
.memberOnly()
|
||||||
|
.withAction(PermissableAction.SETHOME)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void perform(CommandContext context) {
|
||||||
|
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
||||||
|
//Check if homes are enabled
|
||||||
|
if (!Conf.homesEnabled) {
|
||||||
|
context.msg(TL.COMMAND_SETHOME_DISABLED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//If They Don't Have Home
|
||||||
|
if (!context.faction.hasHome()) {
|
||||||
|
context.msg(TL.COMMAND_HOME_NOHOME.toString());
|
||||||
|
context.msg(FactionsPlugin.getInstance().cmdBase.cmdSethome.getUsageTemplate(context));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
context.faction.deleteHome();
|
||||||
|
context.faction.msg(TL.COMMAND_DELHOME_SUCCESS, context.fPlayer.describeTo(context.faction, true));
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TL getUsageTranslation() {
|
||||||
|
return TL.COMMAND_DELHOME_DESCRIPTION;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@ 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;
|
||||||
@@ -72,13 +71,14 @@ public class CmdDisband extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boolean access = false;
|
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)) {
|
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;
|
access = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!access) {
|
if (!access) {
|
||||||
if(Conf.useDisbandGUI) {
|
if (Conf.useDisbandGUI && !context.fPlayer.isAdminBypassing() || !context.player.isOp()) {
|
||||||
if (!disbandMap.containsKey(context.player.getUniqueId().toString())) {
|
if (!disbandMap.containsKey(context.player.getUniqueId().toString())) {
|
||||||
new FDisbandFrame(context.faction).buildGUI(context.fPlayer);
|
new FDisbandFrame(context.faction).buildGUI(context.fPlayer);
|
||||||
return;
|
return;
|
||||||
@@ -110,6 +110,7 @@ public class CmdDisband extends FCommand {
|
|||||||
} else {
|
} else {
|
||||||
context.player.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
|
context.player.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
|
||||||
}
|
}
|
||||||
|
Bukkit.broadcastMessage("Called");
|
||||||
faction.disband(context.player, PlayerDisbandReason.COMMAND);
|
faction.disband(context.player, PlayerDisbandReason.COMMAND);
|
||||||
if (!context.fPlayer.canFlyAtLocation() && FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) {
|
if (!context.fPlayer.canFlyAtLocation() && FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) {
|
||||||
context.fPlayer.setFFlying(false, false);
|
context.fPlayer.setFFlying(false, false);
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ 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.ChatColor;
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -103,7 +102,7 @@ public class CmdFly extends FCommand {
|
|||||||
if (toFac.getAccess(fme, PermissableAction.FLY) == Access.ALLOW) return true;
|
if (toFac.getAccess(fme, PermissableAction.FLY) == Access.ALLOW) return true;
|
||||||
if (fme.getFaction().isWilderness()) return false;
|
if (fme.getFaction().isWilderness()) return false;
|
||||||
if (toFac.isSystemFaction())
|
if (toFac.isSystemFaction())
|
||||||
return me.hasPermission(Permission.valueOf("FLY_" + ChatColor.stripColor(toFac.getTag()).toUpperCase()).node);
|
return me.hasPermission(toFac.isWilderness() ? Permission.FLY_WILDERNESS.node : toFac.isSafeZone() ? Permission.FLY_SAFEZONE.node : Permission.FLY_WARZONE.node);
|
||||||
Relation relationTo = toFac.getRelationTo(fme.getFaction());
|
Relation relationTo = toFac.getRelationTo(fme.getFaction());
|
||||||
if (!relationTo.isEnemy() && !relationTo.isMember())
|
if (!relationTo.isEnemy() && !relationTo.isMember())
|
||||||
return me.hasPermission(Permission.valueOf("FLY_" + relationTo.name()).node);
|
return me.hasPermission(Permission.valueOf("FLY_" + relationTo.name()).node);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
@@ -21,6 +22,11 @@ public class CmdInspect extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
|
if (!Conf.useInspectSystem) {
|
||||||
|
context.fPlayer.msg(TL.GENERIC_DISABLED, "Faction Inspection");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (context.fPlayer.isInspectMode()) {
|
if (context.fPlayer.isInspectMode()) {
|
||||||
context.fPlayer.setInspectMode(false);
|
context.fPlayer.setInspectMode(false);
|
||||||
context.msg(TL.COMMAND_INSPECT_DISABLED_MSG);
|
context.msg(TL.COMMAND_INSPECT_DISABLED_MSG);
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ public class CmdJoin extends FCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
faction.deinvite(fplayer);
|
faction.deinvite(fplayer);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
context.fPlayer.setRole(faction.getDefaultRole());
|
context.fPlayer.setRole(faction.getDefaultRole());
|
||||||
FactionsPlugin.instance.logFactionEvent(faction, FLogType.INVITES, context.fPlayer.getName(), CC.Green + "joined", "the faction");
|
FactionsPlugin.instance.logFactionEvent(faction, FLogType.INVITES, context.fPlayer.getName(), CC.Green + "joined", "the faction");
|
||||||
@@ -154,7 +155,7 @@ public class CmdJoin extends FCommand {
|
|||||||
|
|
||||||
private int getFactionMemberLimit(Faction f) {
|
private int getFactionMemberLimit(Faction f) {
|
||||||
if (f.getUpgrade(UpgradeType.MEMBERS) == 0) return Conf.factionMemberLimit;
|
if (f.getUpgrade(UpgradeType.MEMBERS) == 0) return Conf.factionMemberLimit;
|
||||||
return Conf.factionMemberLimit + FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Members.Member-Boost.level-" + f.getUpgrade(UpgradeType.MEMBERS));
|
return Conf.factionMemberLimit + FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Members.Members-Limit.level-" + f.getUpgrade(UpgradeType.MEMBERS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -74,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);
|
||||||
@@ -110,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);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
@@ -19,6 +20,12 @@ public class CmdStealth extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
|
if (!Conf.useSealthSystem) {
|
||||||
|
context.msg(TL.GENERIC_DISABLED, "Factions Stealth");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (context.faction != null && !context.faction.getId().equalsIgnoreCase("0") && !context.faction.getId().equalsIgnoreCase("none") && !context.faction.getId().equalsIgnoreCase("safezone") && !context.faction.getId().equalsIgnoreCase("warzone")) {
|
if (context.faction != null && !context.faction.getId().equalsIgnoreCase("0") && !context.faction.getId().equalsIgnoreCase("none") && !context.faction.getId().equalsIgnoreCase("safezone") && !context.faction.getId().equalsIgnoreCase("warzone")) {
|
||||||
context.fPlayer.setStealth(!context.fPlayer.isStealthEnabled());
|
context.fPlayer.setStealth(!context.fPlayer.isStealthEnabled());
|
||||||
context.msg(context.fPlayer.isStealthEnabled() ? TL.COMMAND_STEALTH_ENABLE : TL.COMMAND_STEALTH_DISABLE);
|
context.msg(context.fPlayer.isStealthEnabled() ? TL.COMMAND_STEALTH_ENABLE : TL.COMMAND_STEALTH_DISABLE);
|
||||||
|
|||||||
@@ -35,6 +35,12 @@ public class CmdStuck extends FCommand {
|
|||||||
final long delay = FactionsPlugin.getInstance().getConfig().getLong("hcf.stuck.delay", 30);
|
final long delay = FactionsPlugin.getInstance().getConfig().getLong("hcf.stuck.delay", 30);
|
||||||
final int radius = FactionsPlugin.getInstance().getConfig().getInt("hcf.stuck.radius", 10);
|
final int radius = FactionsPlugin.getInstance().getConfig().getInt("hcf.stuck.radius", 10);
|
||||||
|
|
||||||
|
if (!FactionsPlugin.getInstance().getConfig().getBoolean("hcf.stuck.Enabled", false)) {
|
||||||
|
context.msg(TL.GENERIC_DISABLED, "Factions Stuck");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (FactionsPlugin.getInstance().getStuckMap().containsKey(player.getUniqueId())) {
|
if (FactionsPlugin.getInstance().getStuckMap().containsKey(player.getUniqueId())) {
|
||||||
long wait = FactionsPlugin.getInstance().getTimers().get(player.getUniqueId()) - System.currentTimeMillis();
|
long wait = FactionsPlugin.getInstance().getTimers().get(player.getUniqueId()) - System.currentTimeMillis();
|
||||||
String time = DurationFormatUtils.formatDuration(wait, TL.COMMAND_STUCK_TIMEFORMAT.toString(), true);
|
String time = DurationFormatUtils.formatDuration(wait, TL.COMMAND_STUCK_TIMEFORMAT.toString(), true);
|
||||||
|
|||||||
@@ -168,6 +168,8 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
|
|||||||
public CmdLookup cmdLookup = new CmdLookup();
|
public CmdLookup cmdLookup = new CmdLookup();
|
||||||
public CmdAudit cmdAudit = new CmdAudit();
|
public CmdAudit cmdAudit = new CmdAudit();
|
||||||
public CmdReserve cmdReserve = new CmdReserve();
|
public CmdReserve cmdReserve = new CmdReserve();
|
||||||
|
public CmdDelHome cmdDelHome = new CmdDelHome();
|
||||||
|
public CmdClaimFill cmdClaimFill = new CmdClaimFill();
|
||||||
//Variables to know if we already setup certain sub commands
|
//Variables to know if we already setup certain sub commands
|
||||||
public Boolean discordEnabled = false;
|
public Boolean discordEnabled = false;
|
||||||
public Boolean checkEnabled = false;
|
public Boolean checkEnabled = false;
|
||||||
@@ -184,6 +186,7 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
|
|||||||
public Boolean internalFTOPEnabled = false;
|
public Boolean internalFTOPEnabled = false;
|
||||||
public Boolean fWildEnabled = false;
|
public Boolean fWildEnabled = false;
|
||||||
public Boolean fAuditEnabled = false;
|
public Boolean fAuditEnabled = false;
|
||||||
|
public Boolean fStrikes = false;
|
||||||
|
|
||||||
public FCmdRoot() {
|
public FCmdRoot() {
|
||||||
super();
|
super();
|
||||||
@@ -212,6 +215,7 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
|
|||||||
this.addSubCommand(this.cmdCreate);
|
this.addSubCommand(this.cmdCreate);
|
||||||
this.addSubCommand(this.cmdDeinvite);
|
this.addSubCommand(this.cmdDeinvite);
|
||||||
this.addSubCommand(this.cmdDescription);
|
this.addSubCommand(this.cmdDescription);
|
||||||
|
this.addSubCommand(this.cmdDelHome);
|
||||||
this.addSubCommand(this.cmdDisband);
|
this.addSubCommand(this.cmdDisband);
|
||||||
this.addSubCommand(this.cmdHelp);
|
this.addSubCommand(this.cmdHelp);
|
||||||
this.addSubCommand(this.cmdHome);
|
this.addSubCommand(this.cmdHome);
|
||||||
@@ -262,6 +266,7 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
|
|||||||
this.addSubCommand(this.cmdDelFWarp);
|
this.addSubCommand(this.cmdDelFWarp);
|
||||||
this.addSubCommand(this.cmdModifyPower);
|
this.addSubCommand(this.cmdModifyPower);
|
||||||
this.addSubCommand(this.cmdLogins);
|
this.addSubCommand(this.cmdLogins);
|
||||||
|
this.addSubCommand(this.cmdClaimFill);
|
||||||
this.addSubCommand(this.cmdClaimLine);
|
this.addSubCommand(this.cmdClaimLine);
|
||||||
this.addSubCommand(this.cmdAHome);
|
this.addSubCommand(this.cmdAHome);
|
||||||
this.addSubCommand(this.cmdPerm);
|
this.addSubCommand(this.cmdPerm);
|
||||||
@@ -292,7 +297,6 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
|
|||||||
this.addSubCommand(this.cmdChest);
|
this.addSubCommand(this.cmdChest);
|
||||||
this.addSubCommand(this.cmdSetBanner);
|
this.addSubCommand(this.cmdSetBanner);
|
||||||
this.addSubCommand(this.cmdCorner);
|
this.addSubCommand(this.cmdCorner);
|
||||||
this.addSubCommand(this.cmdStrikes);
|
|
||||||
this.addSubCommand(this.cmdFGlobal);
|
this.addSubCommand(this.cmdFGlobal);
|
||||||
this.addSubCommand(this.cmdViewChest);
|
this.addSubCommand(this.cmdViewChest);
|
||||||
this.addSubCommand(this.cmdConvertConfig);
|
this.addSubCommand(this.cmdConvertConfig);
|
||||||
@@ -355,6 +359,11 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
|
|||||||
fAuditEnabled = true;
|
fAuditEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Conf.useStrikeSystem) {
|
||||||
|
this.addSubCommand(this.cmdStrikes);
|
||||||
|
fStrikes = true;
|
||||||
|
}
|
||||||
|
|
||||||
//Other
|
//Other
|
||||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("Wild.Enabled", false) && !fWildEnabled) {
|
if (FactionsPlugin.getInstance().getConfig().getBoolean("Wild.Enabled", false) && !fWildEnabled) {
|
||||||
this.addSubCommand(this.cmdWild);
|
this.addSubCommand(this.cmdWild);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public enum FLogType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Material getMaterial() {
|
public Material getMaterial() {
|
||||||
return XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("faudit-gui.materials." + name().toLowerCase())).parseMaterial();
|
return XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("faudit-gui.materials." + name().toLowerCase())).get().parseMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMsg() {
|
public String getMsg() {
|
||||||
|
|||||||
@@ -52,19 +52,19 @@ public class CheckSettingsFrame implements InventoryHolder, FactionGUI {
|
|||||||
|
|
||||||
public void build() {
|
public void build() {
|
||||||
Faction faction = fPlayer.getFaction();
|
Faction faction = fPlayer.getFaction();
|
||||||
ItemStack wallsStack = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("f-check.wall-check.Type")).parseItem();
|
ItemStack wallsStack = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("f-check.wall-check.Type")).get().parseItem();
|
||||||
ItemMeta wallsMeta = wallsStack.getItemMeta();
|
ItemMeta wallsMeta = wallsStack.getItemMeta();
|
||||||
wallsMeta.setDisplayName(TL.CHECK_WALL_CHECK_GUI_ICON.toString());
|
wallsMeta.setDisplayName(TL.CHECK_WALL_CHECK_GUI_ICON.toString());
|
||||||
wallsMeta.setLore(Collections.singletonList(TL.CHECK_CHECK_LORE_LINE.format(getFormatted(faction.getWallCheckMinutes()))));
|
wallsMeta.setLore(Collections.singletonList(TL.CHECK_CHECK_LORE_LINE.format(getFormatted(faction.getWallCheckMinutes()))));
|
||||||
wallsStack.setItemMeta(wallsMeta);
|
wallsStack.setItemMeta(wallsMeta);
|
||||||
inventory.setItem(FactionsPlugin.getInstance().getConfig().getInt("f-check.wall-check.slot"), wallsStack);
|
inventory.setItem(FactionsPlugin.getInstance().getConfig().getInt("f-check.wall-check.slot"), wallsStack);
|
||||||
ItemStack bufferStack = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("f-check.buffer-check.Type")).parseItem();
|
ItemStack bufferStack = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("f-check.buffer-check.Type")).get().parseItem();
|
||||||
ItemMeta bufferMeta = bufferStack.getItemMeta();
|
ItemMeta bufferMeta = bufferStack.getItemMeta();
|
||||||
bufferMeta.setDisplayName(TL.CHECK_BUFFER_CHECK_GUI_ICON.toString());
|
bufferMeta.setDisplayName(TL.CHECK_BUFFER_CHECK_GUI_ICON.toString());
|
||||||
bufferMeta.setLore(Collections.singletonList(TL.CHECK_CHECK_LORE_LINE.format(getFormatted(faction.getBufferCheckMinutes()))));
|
bufferMeta.setLore(Collections.singletonList(TL.CHECK_CHECK_LORE_LINE.format(getFormatted(faction.getBufferCheckMinutes()))));
|
||||||
bufferStack.setItemMeta(bufferMeta);
|
bufferStack.setItemMeta(bufferMeta);
|
||||||
inventory.setItem(FactionsPlugin.getInstance().getConfig().getInt("f-check.buffer-check.slot"), bufferStack);
|
inventory.setItem(FactionsPlugin.getInstance().getConfig().getInt("f-check.buffer-check.slot"), bufferStack);
|
||||||
ItemStack historyStack = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("f-check.history.Type")).parseItem();
|
ItemStack historyStack = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("f-check.history.Type")).get().parseItem();
|
||||||
ItemMeta historyMeta = historyStack.getItemMeta();
|
ItemMeta historyMeta = historyStack.getItemMeta();
|
||||||
historyMeta.setDisplayName(TL.CHECK_HISTORY_GUI_ICON.toString());
|
historyMeta.setDisplayName(TL.CHECK_HISTORY_GUI_ICON.toString());
|
||||||
historyStack.setItemMeta(historyMeta);
|
historyStack.setItemMeta(historyMeta);
|
||||||
|
|||||||
@@ -0,0 +1,130 @@
|
|||||||
|
package com.massivecraft.factions.cmd.claim;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by FactionsUUID Team
|
||||||
|
*/
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Board;
|
||||||
|
import com.massivecraft.factions.Conf;
|
||||||
|
import com.massivecraft.factions.FLocation;
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.cmd.Aliases;
|
||||||
|
import com.massivecraft.factions.cmd.CommandContext;
|
||||||
|
import com.massivecraft.factions.cmd.CommandRequirements;
|
||||||
|
import com.massivecraft.factions.cmd.FCommand;
|
||||||
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.Access;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class CmdClaimFill extends FCommand {
|
||||||
|
|
||||||
|
public CmdClaimFill() {
|
||||||
|
|
||||||
|
// Aliases
|
||||||
|
this.aliases.addAll(Aliases.claim_claimFill);
|
||||||
|
|
||||||
|
// Args
|
||||||
|
this.optionalArgs.put("limit", String.valueOf(Conf.maxFillClaimCount));
|
||||||
|
this.optionalArgs.put("faction", "you");
|
||||||
|
|
||||||
|
this.requirements = new CommandRequirements.Builder(Permission.CLAIM_FILL)
|
||||||
|
.playerOnly()
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void perform(CommandContext context) {
|
||||||
|
// Args
|
||||||
|
final int limit = context.argAsInt(0, Conf.maxFillClaimCount);
|
||||||
|
|
||||||
|
if (limit > Conf.maxFillClaimCount) {
|
||||||
|
context.msg(TL.COMMAND_CLAIMFILL_ABOVEMAX, Conf.maxFillClaimCount);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Faction forFaction = context.argAsFaction(2, context.faction);
|
||||||
|
Location location = context.player.getLocation();
|
||||||
|
FLocation loc = new FLocation(location);
|
||||||
|
|
||||||
|
Faction currentFaction = Board.getInstance().getFactionAt(loc);
|
||||||
|
|
||||||
|
if (currentFaction.equals(forFaction)) {
|
||||||
|
context.msg(TL.CLAIM_ALREADYOWN, forFaction.describeTo(context.fPlayer, true));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!currentFaction.isWilderness()) {
|
||||||
|
context.msg(TL.COMMAND_CLAIMFILL_ALREADYCLAIMED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!context.fPlayer.isAdminBypassing() && forFaction.getAccess(context.fPlayer, PermissableAction.TERRITORY) != Access.ALLOW) {
|
||||||
|
context.msg(TL.CLAIM_CANTCLAIM, forFaction.describeTo(context.fPlayer));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final double distance = Conf.maxFillClaimDistance;
|
||||||
|
long startX = loc.getX();
|
||||||
|
long startZ = loc.getZ();
|
||||||
|
|
||||||
|
Set<FLocation> toClaim = new HashSet<>();
|
||||||
|
Queue<FLocation> queue = new LinkedList<>();
|
||||||
|
FLocation currentHead;
|
||||||
|
queue.add(loc);
|
||||||
|
toClaim.add(loc);
|
||||||
|
while (!queue.isEmpty() && toClaim.size() <= limit) {
|
||||||
|
currentHead = queue.poll();
|
||||||
|
|
||||||
|
if (Math.abs(currentHead.getX() - startX) > distance || Math.abs(currentHead.getZ() - startZ) > distance) {
|
||||||
|
context.msg(TL.COMMAND_CLAIMFILL_TOOFAR, distance);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
addIf(toClaim, queue, currentHead.getRelative(0, 1));
|
||||||
|
addIf(toClaim, queue, currentHead.getRelative(0, -1));
|
||||||
|
addIf(toClaim, queue, currentHead.getRelative(1, 0));
|
||||||
|
addIf(toClaim, queue, currentHead.getRelative(-1, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toClaim.size() > limit) {
|
||||||
|
context.msg(TL.COMMAND_CLAIMFILL_PASTLIMIT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toClaim.size() > context.faction.getPowerRounded() - context.faction.getLandRounded()) {
|
||||||
|
context.msg(TL.COMMAND_CLAIMFILL_NOTENOUGHLANDLEFT, forFaction.describeTo(context.fPlayer), toClaim.size());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int limFail = Conf.radiusClaimFailureLimit;
|
||||||
|
int fails = 0;
|
||||||
|
for (FLocation currentLocation : toClaim) {
|
||||||
|
if (!context.fPlayer.attemptClaim(forFaction, currentLocation, true)) {
|
||||||
|
fails++;
|
||||||
|
}
|
||||||
|
if (fails >= limFail) {
|
||||||
|
context.msg(TL.COMMAND_CLAIMFILL_TOOMUCHFAIL, fails);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addIf(Set<FLocation> toClaim, Queue<FLocation> queue, FLocation examine) {
|
||||||
|
if (Board.getInstance().getFactionAt(examine).isWilderness() && !toClaim.contains(examine)) {
|
||||||
|
toClaim.add(examine);
|
||||||
|
queue.add(examine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TL getUsageTranslation() {
|
||||||
|
return TL.COMMAND_CLAIMFILL_DESCRIPTION;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.massivecraft.factions.cmd.tnt;
|
package com.massivecraft.factions.cmd.tnt;
|
||||||
|
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.Factions;
|
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import com.massivecraft.factions.cmd.Aliases;
|
import com.massivecraft.factions.cmd.Aliases;
|
||||||
import com.massivecraft.factions.cmd.CommandContext;
|
import com.massivecraft.factions.cmd.CommandContext;
|
||||||
@@ -20,13 +19,15 @@ import org.bukkit.inventory.Inventory;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class CmdTntFill extends FCommand {
|
public class CmdTntFill extends FCommand {
|
||||||
|
|
||||||
public CmdTntFill() {
|
public CmdTntFill() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("tntfill");
|
this.aliases.addAll(Aliases.tnt_tntfill);
|
||||||
|
|
||||||
this.requiredArgs.add("radius");
|
this.requiredArgs.add("radius");
|
||||||
this.requiredArgs.add("amount");
|
this.requiredArgs.add("amount");
|
||||||
@@ -38,6 +39,24 @@ public class CmdTntFill extends FCommand {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void removeItems(Inventory inventory, ItemStack item, int toRemove) {
|
||||||
|
if (toRemove <= 0 || inventory == null || item == null)
|
||||||
|
return;
|
||||||
|
for (int i = 0; i < inventory.getSize(); i++) {
|
||||||
|
ItemStack loopItem = inventory.getItem(i);
|
||||||
|
if (loopItem == null || !item.isSimilar(loopItem))
|
||||||
|
continue;
|
||||||
|
if (toRemove <= 0)
|
||||||
|
return;
|
||||||
|
if (toRemove < loopItem.getAmount()) {
|
||||||
|
loopItem.setAmount(loopItem.getAmount() - toRemove);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
inventory.clear(i);
|
||||||
|
toRemove -= loopItem.getAmount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (!FactionsPlugin.instance.getConfig().getBoolean("Tntfill.enabled")) {
|
if (!FactionsPlugin.instance.getConfig().getBoolean("Tntfill.enabled")) {
|
||||||
@@ -146,24 +165,6 @@ public class CmdTntFill extends FCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeItems(Inventory inventory, ItemStack item, int toRemove) {
|
|
||||||
if (toRemove <= 0 || inventory == null || item == null)
|
|
||||||
return;
|
|
||||||
for (int i = 0; i < inventory.getSize(); i++) {
|
|
||||||
ItemStack loopItem = inventory.getItem(i);
|
|
||||||
if (loopItem == null || !item.isSimilar(loopItem))
|
|
||||||
continue;
|
|
||||||
if (toRemove <= 0)
|
|
||||||
return;
|
|
||||||
if (toRemove < loopItem.getAmount()) {
|
|
||||||
loopItem.setAmount(loopItem.getAmount() - toRemove);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
inventory.clear(i);
|
|
||||||
toRemove -= loopItem.getAmount();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Counts the item type available in the inventory.
|
// Counts the item type available in the inventory.
|
||||||
private int inventoryItemCount(Inventory inventory, Material mat) {
|
private int inventoryItemCount(Inventory inventory, Material mat) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class WildGUI implements FactionGUI {
|
|||||||
@Override
|
@Override
|
||||||
public void build() {
|
public void build() {
|
||||||
inv = Bukkit.createInventory(this, FactionsPlugin.getInstance().getConfig().getInt("Wild.GUI.Size"), FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("Wild.GUI.Name")));
|
inv = Bukkit.createInventory(this, FactionsPlugin.getInstance().getConfig().getInt("Wild.GUI.Size"), FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("Wild.GUI.Name")));
|
||||||
ItemStack fillItem = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("Wild.GUI.FillMaterial")).parseItem();
|
ItemStack fillItem = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("Wild.GUI.FillMaterial")).get().parseItem();
|
||||||
ItemMeta meta = fillItem.getItemMeta();
|
ItemMeta meta = fillItem.getItemMeta();
|
||||||
if (meta == null) return;
|
if (meta == null) return;
|
||||||
meta.setDisplayName("");
|
meta.setDisplayName("");
|
||||||
@@ -55,7 +55,7 @@ public class WildGUI implements FactionGUI {
|
|||||||
inv.setItem(fill, fillItem);
|
inv.setItem(fill, fillItem);
|
||||||
}
|
}
|
||||||
for (String key : Objects.requireNonNull(FactionsPlugin.getInstance().getConfig().getConfigurationSection("Wild.Zones")).getKeys(false)) {
|
for (String key : Objects.requireNonNull(FactionsPlugin.getInstance().getConfig().getConfigurationSection("Wild.Zones")).getKeys(false)) {
|
||||||
ItemStack zoneItem = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("Wild.Zones." + key + ".Material")).parseItem();
|
ItemStack zoneItem = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("Wild.Zones." + key + ".Material")).get().parseItem();
|
||||||
ItemMeta zoneMeta = zoneItem.getItemMeta();
|
ItemMeta zoneMeta = zoneItem.getItemMeta();
|
||||||
if (zoneMeta == null) return;
|
if (zoneMeta == null) return;
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class CmdInviteBot extends FCommand {
|
|||||||
* @author Driftay
|
* @author Driftay
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public CmdInviteBot(){
|
public CmdInviteBot() {
|
||||||
super();
|
super();
|
||||||
this.aliases.add("invitebot");
|
this.aliases.add("invitebot");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ 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.util.exceptions.SaberException;
|
|
||||||
import net.dv8tion.jda.core.AccountType;
|
import net.dv8tion.jda.core.AccountType;
|
||||||
import net.dv8tion.jda.core.JDA;
|
import net.dv8tion.jda.core.JDA;
|
||||||
import net.dv8tion.jda.core.JDABuilder;
|
import net.dv8tion.jda.core.JDABuilder;
|
||||||
@@ -25,7 +24,6 @@ public class Discord {
|
|||||||
public static HashMap<FPlayer, Integer> waitingLinkk;
|
public static HashMap<FPlayer, Integer> waitingLinkk;
|
||||||
//We want to track the amount of times setup has been tried and the result may be useful for determining issues
|
//We want to track the amount of times setup has been tried and the result may be useful for determining issues
|
||||||
public static HashSet<DiscordSetupAttempt> setupLog;
|
public static HashSet<DiscordSetupAttempt> setupLog;
|
||||||
private static FactionsPlugin plugin;
|
|
||||||
public static Boolean confUseDiscord;
|
public static Boolean confUseDiscord;
|
||||||
public static String botToken;
|
public static String botToken;
|
||||||
public static String mainGuildID;
|
public static String mainGuildID;
|
||||||
@@ -37,6 +35,7 @@ public class Discord {
|
|||||||
public static Boolean useEmotes;
|
public static Boolean useEmotes;
|
||||||
public static Emote positive;
|
public static Emote positive;
|
||||||
public static Emote negative;
|
public static Emote negative;
|
||||||
|
private static FactionsPlugin plugin;
|
||||||
|
|
||||||
public Discord(FactionsPlugin plugin) {
|
public Discord(FactionsPlugin plugin) {
|
||||||
Discord.plugin = plugin;
|
Discord.plugin = plugin;
|
||||||
@@ -62,7 +61,9 @@ public class Discord {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Boolean startBot() {
|
private static Boolean startBot() {
|
||||||
if (!Conf.useDiscordSystem) {return false;}
|
if (!Conf.useDiscordSystem) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
jda = new JDABuilder(AccountType.BOT).setToken(Conf.discordBotToken).buildBlocking();
|
jda = new JDABuilder(AccountType.BOT).setToken(Conf.discordBotToken).buildBlocking();
|
||||||
} catch (LoginException | InterruptedException e) {
|
} catch (LoginException | InterruptedException e) {
|
||||||
@@ -78,11 +79,11 @@ public class Discord {
|
|||||||
try {
|
try {
|
||||||
confUseDiscord = Conf.useDiscordSystem;
|
confUseDiscord = Conf.useDiscordSystem;
|
||||||
botToken = Conf.discordBotToken;
|
botToken = Conf.discordBotToken;
|
||||||
if (jda != null && Conf.leaderRoles || Conf.factionDiscordTags) {
|
if (jda != null && Conf.leaderRoles || Conf.factionDiscordTags) {
|
||||||
mainGuild = jda.getGuildById(Conf.mainGuildID);
|
mainGuild = jda.getGuildById(Conf.mainGuildID);
|
||||||
} else {
|
} else {
|
||||||
mainGuild = null;
|
mainGuild = null;
|
||||||
}
|
}
|
||||||
mainGuildID = Conf.mainGuildID;
|
mainGuildID = Conf.mainGuildID;
|
||||||
useDiscord = !botToken.equals("<token here>") && !mainGuildID.equals("<Discord Server ID here>") && confUseDiscord;
|
useDiscord = !botToken.equals("<token here>") && !mainGuildID.equals("<Discord Server ID here>") && confUseDiscord;
|
||||||
roleColor = new java.awt.Color(Conf.factionRoleColor.get(0), Conf.factionRoleColor.get(1), Conf.factionRoleColor.get(2));
|
roleColor = new java.awt.Color(Conf.factionRoleColor.get(0), Conf.factionRoleColor.get(1), Conf.factionRoleColor.get(2));
|
||||||
@@ -90,13 +91,22 @@ public class Discord {
|
|||||||
try {
|
try {
|
||||||
positive = jda.getEmoteById(Conf.positiveReaction);
|
positive = jda.getEmoteById(Conf.positiveReaction);
|
||||||
negative = jda.getEmoteById(Conf.negativeReaction);
|
negative = jda.getEmoteById(Conf.negativeReaction);
|
||||||
if (positive == null | negative == null) {useEmotes = false;}
|
if (positive == null | negative == null) {
|
||||||
|
useEmotes = false;
|
||||||
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
FactionsPlugin.getInstance().getLogger().log(Level.WARNING, "Invalid Emote(s) disabling them.");
|
FactionsPlugin.getInstance().getLogger().log(Level.WARNING, "Invalid Emote(s) disabling them.");
|
||||||
useEmotes = false;
|
useEmotes = false;
|
||||||
}
|
}
|
||||||
if (mainGuild != null) {leader = mainGuild.getRoleById(Conf.leaderRole);} else {leader = null;}
|
if (mainGuild != null) {
|
||||||
} else {useEmotes = false; leader = null;}
|
leader = mainGuild.getRoleById(Conf.leaderRole);
|
||||||
|
} else {
|
||||||
|
leader = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
useEmotes = false;
|
||||||
|
leader = null;
|
||||||
|
}
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
setupLog.add(new DiscordSetupAttempt("Threw an NPE while setting up variables", System.currentTimeMillis()));
|
setupLog.add(new DiscordSetupAttempt("Threw an NPE while setting up variables", System.currentTimeMillis()));
|
||||||
}
|
}
|
||||||
@@ -111,11 +121,21 @@ public class Discord {
|
|||||||
public static String getNicknameString(FPlayer f) {
|
public static String getNicknameString(FPlayer f) {
|
||||||
if (useDiscord) {
|
if (useDiscord) {
|
||||||
String temp = Conf.factionTag;
|
String temp = Conf.factionTag;
|
||||||
if (temp.contains("NAME")) { temp = temp.replace("NAME", f.getName()); }
|
if (temp.contains("NAME")) {
|
||||||
if (temp.contains("DiscordName")) { temp = temp.replace("DiscordName", (f.discordUser() == null) ? (f.getName()) : (f.discordUser().getName())); }
|
temp = temp.replace("NAME", f.getName());
|
||||||
if (temp.contains("FACTION")) { temp = temp.replace("FACTION", f.getFaction().getTag()); }
|
}
|
||||||
if (temp.contains("FactionRole")) { temp = temp.replace("FactionRole", f.getRole().getRoleCapitalized()); }
|
if (temp.contains("DiscordName")) {
|
||||||
if (temp.contains("FactionRolePrefix")) { temp = temp.replace("FactionRolePrefix", f.getRole().getPrefix()); }
|
temp = temp.replace("DiscordName", (f.discordUser() == null) ? (f.getName()) : (f.discordUser().getName()));
|
||||||
|
}
|
||||||
|
if (temp.contains("FACTION")) {
|
||||||
|
temp = temp.replace("FACTION", f.getFaction().getTag());
|
||||||
|
}
|
||||||
|
if (temp.contains("FactionRole")) {
|
||||||
|
temp = temp.replace("FactionRole", f.getRole().getRoleCapitalized());
|
||||||
|
}
|
||||||
|
if (temp.contains("FactionRolePrefix")) {
|
||||||
|
temp = temp.replace("FactionRolePrefix", f.getRole().getPrefix());
|
||||||
|
}
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -138,7 +158,9 @@ public class Discord {
|
|||||||
public static Role getRoleFromName(String s) {
|
public static Role getRoleFromName(String s) {
|
||||||
if (useDiscord && mainGuild != null) {
|
if (useDiscord && mainGuild != null) {
|
||||||
for (Role r : mainGuild.getRoles()) {
|
for (Role r : mainGuild.getRoles()) {
|
||||||
if (r.getName().equals(s)) {return r;}
|
if (r.getName().equals(s)) {
|
||||||
|
return r;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -151,8 +173,12 @@ public class Discord {
|
|||||||
* @return Role generated faction role
|
* @return Role generated faction role
|
||||||
*/
|
*/
|
||||||
public static Role createFactionRole(String s) {
|
public static Role createFactionRole(String s) {
|
||||||
if (!useDiscord) { return null; }
|
if (!useDiscord) {
|
||||||
if (mainGuild == null) { return null; }
|
return null;
|
||||||
|
}
|
||||||
|
if (mainGuild == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(Conf.factionRolePrefix);
|
sb.append(Conf.factionRolePrefix);
|
||||||
sb.append(s);
|
sb.append(s);
|
||||||
@@ -176,6 +202,7 @@ public class Discord {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of the Faction Role that would be generated with the tag
|
* Get the name of the Faction Role that would be generated with the tag
|
||||||
|
*
|
||||||
* @param tag Faction Name/Tag
|
* @param tag Faction Name/Tag
|
||||||
* @return Name of would be Role
|
* @return Name of would be Role
|
||||||
*/
|
*/
|
||||||
@@ -204,13 +231,19 @@ public class Discord {
|
|||||||
* @param f FPlayer target
|
* @param f FPlayer target
|
||||||
*/
|
*/
|
||||||
public static void resetNick(FPlayer f) {
|
public static void resetNick(FPlayer f) {
|
||||||
if (mainGuild == null) { return; }
|
if (mainGuild == null) {
|
||||||
if (mainGuild.getMember(f.discordUser()) == null) { return; }
|
return;
|
||||||
|
}
|
||||||
|
if (mainGuild.getMember(f.discordUser()) == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
mainGuild.getController().setNickname(mainGuild.getMember(f.discordUser()), f.discordUser().getName()).queue();
|
mainGuild.getController().setNickname(mainGuild.getMember(f.discordUser()), f.discordUser().getName()).queue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void changeFactionTag(Faction f, String oldTag) {
|
public static void changeFactionTag(Faction f, String oldTag) {
|
||||||
if (!useDiscord | mainGuild == null) { return; }
|
if (!useDiscord | mainGuild == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (FPlayer fp : f.getFPlayers()) {
|
for (FPlayer fp : f.getFPlayers()) {
|
||||||
if (fp.discordSetup() && isInMainGuild(fp.discordUser())) {
|
if (fp.discordSetup() && isInMainGuild(fp.discordUser())) {
|
||||||
try {
|
try {
|
||||||
@@ -222,7 +255,9 @@ public class Discord {
|
|||||||
mainGuild.getController().removeSingleRoleFromMember(m, Objects.requireNonNull(getRoleFromName(oldTag))).queue();
|
mainGuild.getController().removeSingleRoleFromMember(m, Objects.requireNonNull(getRoleFromName(oldTag))).queue();
|
||||||
mainGuild.getController().addSingleRoleToMember(m, Objects.requireNonNull(createFactionRole(f.getTag()))).queue();
|
mainGuild.getController().addSingleRoleToMember(m, Objects.requireNonNull(createFactionRole(f.getTag()))).queue();
|
||||||
}
|
}
|
||||||
} catch (HierarchyException e) {System.out.print(e.getMessage());}
|
} catch (HierarchyException e) {
|
||||||
|
System.out.print(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,8 @@ public class DiscordListener extends ListenerAdapter {
|
|||||||
prefix = ".";
|
prefix = ".";
|
||||||
}
|
}
|
||||||
String content = event.getMessage().getContentRaw();
|
String content = event.getMessage().getContentRaw();
|
||||||
if (!content.startsWith(prefix) && !content.startsWith(event.getGuild().getSelfMember().getAsMention())) return;
|
if (!content.startsWith(prefix) && !content.startsWith(event.getGuild().getSelfMember().getAsMention()))
|
||||||
|
return;
|
||||||
if (content.startsWith(prefix + "help") || content.startsWith(event.getGuild().getSelfMember().getAsMention() + " help")) {
|
if (content.startsWith(prefix + "help") || content.startsWith(event.getGuild().getSelfMember().getAsMention() + " help")) {
|
||||||
this.help(event, content, prefix);
|
this.help(event, content, prefix);
|
||||||
} else if (content.startsWith(prefix + "stats")) {
|
} else if (content.startsWith(prefix + "stats")) {
|
||||||
@@ -124,7 +125,8 @@ public class DiscordListener extends ListenerAdapter {
|
|||||||
this.settings(event);
|
this.settings(event);
|
||||||
}
|
}
|
||||||
} catch (PermissionException exception) {
|
} catch (PermissionException exception) {
|
||||||
if (!event.getGuild().getSelfMember().hasPermission(event.getChannel(), Permission.MESSAGE_READ, Permission.MESSAGE_WRITE)) return;
|
if (!event.getGuild().getSelfMember().hasPermission(event.getChannel(), Permission.MESSAGE_READ, Permission.MESSAGE_WRITE))
|
||||||
|
return;
|
||||||
event.getChannel().sendMessage((":x: Missing permission, `" + exception.getPermission().toString() + "`")).queue();
|
event.getChannel().sendMessage((":x: Missing permission, `" + exception.getPermission().toString() + "`")).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,7 +137,8 @@ public class DiscordListener extends ListenerAdapter {
|
|||||||
|
|
||||||
private Faction getFactionWithWarning(TextChannel textChannel) {
|
private Faction getFactionWithWarning(TextChannel textChannel) {
|
||||||
Faction faction = this.getFaction(textChannel.getGuild());
|
Faction faction = this.getFaction(textChannel.getGuild());
|
||||||
if (faction == null) textChannel.sendMessage((":x: This guild isn't linked to a faction, use `/f setguild " + textChannel.getGuild().getId() + "` in game")).queue();
|
if (faction == null)
|
||||||
|
textChannel.sendMessage((":x: This guild isn't linked to a faction, use `/f setguild " + textChannel.getGuild().getId() + "` in game")).queue();
|
||||||
return faction;
|
return faction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,7 +345,7 @@ public class DiscordListener extends ListenerAdapter {
|
|||||||
|
|
||||||
private void setNotifyFormat(GuildMessageReceivedEvent event, String content, String prefix) {
|
private void setNotifyFormat(GuildMessageReceivedEvent event, String content, String prefix) {
|
||||||
Faction faction = this.getFactionWithWarning(event.getChannel());
|
Faction faction = this.getFactionWithWarning(event.getChannel());
|
||||||
if (faction == null)return;
|
if (faction == null) return;
|
||||||
if (cantAccessPermissionWithWarning(event.getChannel(), event.getMember())) return;
|
if (cantAccessPermissionWithWarning(event.getChannel(), event.getMember())) return;
|
||||||
if (!content.contains(" ")) {
|
if (!content.contains(" ")) {
|
||||||
event.getChannel().sendMessage((":x: Usage, `" + prefix + "setnotifyformat <format>` (%type%)")).queue();
|
event.getChannel().sendMessage((":x: Usage, `" + prefix + "setnotifyformat <format>` (%type%)")).queue();
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ public class DiscordSetupAttempt {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor used when an attempt fails
|
* Constructor used when an attempt fails
|
||||||
|
*
|
||||||
* @param reason String reason for the attempt failing
|
* @param reason String reason for the attempt failing
|
||||||
* @param time Long current system time in millis
|
* @param time Long current system time in millis
|
||||||
*/
|
*/
|
||||||
public DiscordSetupAttempt(String reason, Long time) {
|
public DiscordSetupAttempt(String reason, Long time) {
|
||||||
this.success = false;
|
this.success = false;
|
||||||
@@ -18,6 +19,7 @@ public class DiscordSetupAttempt {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor used for successful attempts
|
* Constructor used for successful attempts
|
||||||
|
*
|
||||||
* @param time Long Current system time in millis
|
* @param time Long Current system time in millis
|
||||||
*/
|
*/
|
||||||
public DiscordSetupAttempt(Long time) {
|
public DiscordSetupAttempt(Long time) {
|
||||||
@@ -28,30 +30,43 @@ public class DiscordSetupAttempt {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if this attempt to setup the Discord bot was successful
|
* Get if this attempt to setup the Discord bot was successful
|
||||||
|
*
|
||||||
* @return Boolean success
|
* @return Boolean success
|
||||||
*/
|
*/
|
||||||
public Boolean getSuccess() {return this.success;}
|
public Boolean getSuccess() {
|
||||||
|
return this.success;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the reason for the setup failing (If it was successful it will return null)
|
* Get the reason for the setup failing (If it was successful it will return null)
|
||||||
|
*
|
||||||
* @return String reason
|
* @return String reason
|
||||||
*/
|
*/
|
||||||
public String getReason() {return this.reason;}
|
public String getReason() {
|
||||||
|
return this.reason;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the time this setup was attempted
|
* Get the time this setup was attempted
|
||||||
|
*
|
||||||
* @return Long initialTime
|
* @return Long initialTime
|
||||||
*/
|
*/
|
||||||
public Long getInitialTime() {return this.initialTime;}
|
public Long getInitialTime() {
|
||||||
|
return this.initialTime;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the difference of time between when attempted and present time
|
* Get the difference of time between when attempted and present time
|
||||||
|
*
|
||||||
* @return Long time difference in milliseconds
|
* @return Long time difference in milliseconds
|
||||||
*/
|
*/
|
||||||
public Long getDifferentialTime() {return System.currentTimeMillis()-initialTime;}
|
public Long getDifferentialTime() {
|
||||||
|
return System.currentTimeMillis() - initialTime;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the difference in time between when attempted and present time formatted MS,Seconds,Minutes,Hours,Years
|
* Get the difference in time between when attempted and present time formatted MS,Seconds,Minutes,Hours,Years
|
||||||
|
*
|
||||||
* @return String with formatted time difference
|
* @return String with formatted time difference
|
||||||
*/
|
*/
|
||||||
public String getDifferentialFormatted() {
|
public String getDifferentialFormatted() {
|
||||||
@@ -61,25 +76,25 @@ public class DiscordSetupAttempt {
|
|||||||
if (inProcessTime >= 1000) {
|
if (inProcessTime >= 1000) {
|
||||||
timeIndex++;
|
timeIndex++;
|
||||||
//Seconds
|
//Seconds
|
||||||
inProcessTime = inProcessTime/Integer.toUnsignedLong(1000);
|
inProcessTime = inProcessTime / Integer.toUnsignedLong(1000);
|
||||||
if (inProcessTime >= 60) {
|
if (inProcessTime >= 60) {
|
||||||
timeIndex++;
|
timeIndex++;
|
||||||
//Minutes
|
//Minutes
|
||||||
inProcessTime = inProcessTime/Integer.toUnsignedLong(60);
|
inProcessTime = inProcessTime / Integer.toUnsignedLong(60);
|
||||||
if (inProcessTime >= 60) {
|
if (inProcessTime >= 60) {
|
||||||
timeIndex++;
|
timeIndex++;
|
||||||
//Hours
|
//Hours
|
||||||
inProcessTime = inProcessTime/Integer.toUnsignedLong(60);
|
inProcessTime = inProcessTime / Integer.toUnsignedLong(60);
|
||||||
if (inProcessTime >= 24) {
|
if (inProcessTime >= 24) {
|
||||||
timeIndex++;
|
timeIndex++;
|
||||||
//Days
|
//Days
|
||||||
inProcessTime = inProcessTime/Integer.toUnsignedLong(24);
|
inProcessTime = inProcessTime / Integer.toUnsignedLong(24);
|
||||||
//Skipping months
|
//Skipping months
|
||||||
if (inProcessTime >= 365) {
|
if (inProcessTime >= 365) {
|
||||||
timeIndex++;
|
timeIndex++;
|
||||||
//Years
|
//Years
|
||||||
//If someone really has 100% uptime in a year idek
|
//If someone really has 100% uptime in a year idek
|
||||||
inProcessTime = inProcessTime/Integer.toUnsignedLong(365);
|
inProcessTime = inProcessTime / Integer.toUnsignedLong(365);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,12 +106,24 @@ public class DiscordSetupAttempt {
|
|||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
String s = "";
|
String s = "";
|
||||||
switch (timeIndex) {
|
switch (timeIndex) {
|
||||||
case 0: s = "MS"; break;
|
case 0:
|
||||||
case 1: s = "Seconds"; break;
|
s = "MS";
|
||||||
case 2: s = "Minutes"; break;
|
break;
|
||||||
case 3: s = "Hours"; break;
|
case 1:
|
||||||
case 4: s = "Days"; break;
|
s = "Seconds";
|
||||||
case 5: s = "Years"; break;
|
break;
|
||||||
|
case 2:
|
||||||
|
s = "Minutes";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
s = "Hours";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
s = "Days";
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
s = "Years";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
sb.append(s);
|
sb.append(s);
|
||||||
sb.append(" ago");
|
sb.append(" ago");
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import com.massivecraft.factions.Faction;
|
|||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import mkremins.fanciful.FancyMessage;
|
import mkremins.fanciful.FancyMessage;
|
||||||
import net.dv8tion.jda.core.AccountType;
|
|
||||||
import net.dv8tion.jda.core.JDABuilder;
|
|
||||||
import net.dv8tion.jda.core.Permission;
|
import net.dv8tion.jda.core.Permission;
|
||||||
import net.dv8tion.jda.core.entities.Message;
|
import net.dv8tion.jda.core.entities.Message;
|
||||||
import net.dv8tion.jda.core.entities.TextChannel;
|
import net.dv8tion.jda.core.entities.TextChannel;
|
||||||
@@ -19,12 +17,10 @@ import net.dv8tion.jda.webhook.WebhookMessage;
|
|||||||
import net.dv8tion.jda.webhook.WebhookMessageBuilder;
|
import net.dv8tion.jda.webhook.WebhookMessageBuilder;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
import javax.security.auth.login.LoginException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
public class FactionChatHandler extends ListenerAdapter {
|
public class FactionChatHandler extends ListenerAdapter {
|
||||||
|
|
||||||
@@ -69,7 +65,9 @@ public class FactionChatHandler extends ListenerAdapter {
|
|||||||
while (i <= x.size() - 1) {
|
while (i <= x.size() - 1) {
|
||||||
mention.append(" ").append(x.get(i));
|
mention.append(" ").append(x.get(i));
|
||||||
ii.add(i);
|
ii.add(i);
|
||||||
if (mention.toString().contains("#")) {break;}
|
if (mention.toString().contains("#")) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (mention.toString().contains("#")) {
|
if (mention.toString().contains("#")) {
|
||||||
|
|||||||
@@ -76,32 +76,40 @@ public class PowerLossEvent extends FactionPlayerEvent implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the configured damage to a players individual power on death
|
* Gets the configured damage to a players individual power on death
|
||||||
|
*
|
||||||
* @return power to be lost as a Double.
|
* @return power to be lost as a Double.
|
||||||
*/
|
*/
|
||||||
public double getDefaultPowerLost() {return Conf.powerPerDeath;}
|
public double getDefaultPowerLost() {
|
||||||
|
return Conf.powerPerDeath;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the variable power lost. Custom power ignored when less than or equal to zero.
|
* Gets the variable power lost. Custom power ignored when less than or equal to zero.
|
||||||
|
*
|
||||||
* @return custom power to be lost as a Double.
|
* @return custom power to be lost as a Double.
|
||||||
*/
|
*/
|
||||||
public double getCustomPowerLost() {return this.modified;}
|
public double getCustomPowerLost() {
|
||||||
|
return this.modified;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the variable power lost. Custom power ignored when less than or equal to zero.
|
* Sets the variable power lost. Custom power ignored when less than or equal to zero.
|
||||||
|
*
|
||||||
* @param loss Double amount for the custom power loss to be set to.
|
* @param loss Double amount for the custom power loss to be set to.
|
||||||
*/
|
*/
|
||||||
public void setCustomPowerLost(Double loss) {modified = loss;}
|
public void setCustomPowerLost(Double loss) {
|
||||||
|
modified = loss;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if custom power is to be used.
|
* Determines if custom power is to be used.
|
||||||
|
*
|
||||||
* @return If custom power is to be used as a boolean.
|
* @return If custom power is to be used as a boolean.
|
||||||
*/
|
*/
|
||||||
public boolean usingCustomPower() {
|
public boolean usingCustomPower() {
|
||||||
if (modified > 0) {
|
return modified > 0;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
return cancelled;
|
return cancelled;
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package com.massivecraft.factions.event;
|
|||||||
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.zcore.persist.MemoryFPlayer;
|
|
||||||
import com.massivecraft.factions.zcore.persist.MemoryFPlayers;
|
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,6 +23,7 @@ public class PowerRegenEvent extends FactionPlayerEvent implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the amount of power this player will regen by default
|
* Get the amount of power this player will regen by default
|
||||||
|
*
|
||||||
* @return power amount gained as a Double.
|
* @return power amount gained as a Double.
|
||||||
*/
|
*/
|
||||||
public double getDefaultPowerGained() {
|
public double getDefaultPowerGained() {
|
||||||
@@ -33,26 +32,30 @@ public class PowerRegenEvent extends FactionPlayerEvent implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the amount of custom power this player will gain. Ignored if less than or equal to 0.
|
* Get the amount of custom power this player will gain. Ignored if less than or equal to 0.
|
||||||
|
*
|
||||||
* @return Custom power as a double
|
* @return Custom power as a double
|
||||||
*/
|
*/
|
||||||
public double getCustomPower() {return modified;}
|
public double getCustomPower() {
|
||||||
|
return modified;
|
||||||
/**
|
|
||||||
* Get if we will be using the custom power gain instead of default.
|
|
||||||
* @return If we will process the event custom returned as a Boolean.
|
|
||||||
*/
|
|
||||||
public boolean usingCustomPower() {
|
|
||||||
if (modified > 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the custom power gain for this event.
|
* Set the custom power gain for this event.
|
||||||
|
*
|
||||||
* @param gain Amount of power to be added to player.
|
* @param gain Amount of power to be added to player.
|
||||||
*/
|
*/
|
||||||
public void setCustomPower(Double gain) {modified = gain;}
|
public void setCustomPower(Double gain) {
|
||||||
|
modified = gain;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get if we will be using the custom power gain instead of default.
|
||||||
|
*
|
||||||
|
* @return If we will process the event custom returned as a Boolean.
|
||||||
|
*/
|
||||||
|
public boolean usingCustomPower() {
|
||||||
|
return modified > 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class Worldguard {
|
public class Worldguard {
|
||||||
|
|
||||||
|
private static Worldguard instance;
|
||||||
/**
|
/**
|
||||||
* @author FactionsUUID Team
|
* @author FactionsUUID Team
|
||||||
*/
|
*/
|
||||||
@@ -53,8 +54,6 @@ public class Worldguard {
|
|||||||
private StateFlag breakFlag;
|
private StateFlag breakFlag;
|
||||||
private boolean initialized = false;
|
private boolean initialized = false;
|
||||||
|
|
||||||
private static Worldguard instance;
|
|
||||||
|
|
||||||
public Worldguard() {
|
public Worldguard() {
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
@@ -72,16 +71,20 @@ public class Worldguard {
|
|||||||
Method getInstanceMethod = worldGuardClass.getMethod("getInstance");
|
Method getInstanceMethod = worldGuardClass.getMethod("getInstance");
|
||||||
worldGuard = getInstanceMethod.invoke(null);
|
worldGuard = getInstanceMethod.invoke(null);
|
||||||
FactionsPlugin.instance.log("Found WorldGuard 7+");
|
FactionsPlugin.instance.log("Found WorldGuard 7+");
|
||||||
} catch (Exception ex) { FactionsPlugin.instance.log("Found WorldGuard <7"); }
|
} catch (Exception ex) {
|
||||||
|
FactionsPlugin.instance.log("Found WorldGuard <7");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Worldguard getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return worldGuardPlugin != null;
|
return worldGuardPlugin != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Worldguard getInstance() { return instance; }
|
|
||||||
|
|
||||||
protected RegionAssociable getAssociable(Player player) {
|
protected RegionAssociable getAssociable(Player player) {
|
||||||
RegionAssociable associable;
|
RegionAssociable associable;
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
@@ -173,9 +176,9 @@ public class Worldguard {
|
|||||||
try {
|
try {
|
||||||
if (worldAdaptMethod != null) {
|
if (worldAdaptMethod != null) {
|
||||||
Object worldEditWorld = worldAdaptMethod.invoke(null, world);
|
Object worldEditWorld = worldAdaptMethod.invoke(null, world);
|
||||||
regionManager = (RegionManager)regionContainerGetMethod.invoke(regionContainer, worldEditWorld);
|
regionManager = (RegionManager) regionContainerGetMethod.invoke(regionContainer, worldEditWorld);
|
||||||
} else {
|
} else {
|
||||||
regionManager = (RegionManager)regionContainerGetMethod.invoke(regionContainer, world);
|
regionManager = (RegionManager) regionContainerGetMethod.invoke(regionContainer, world);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
FactionsPlugin.instance.log("An error occurred looking up a WorldGuard RegionManager");
|
FactionsPlugin.instance.log("An error occurred looking up a WorldGuard RegionManager");
|
||||||
@@ -190,7 +193,7 @@ public class Worldguard {
|
|||||||
Object vector = vectorConstructorAsAMethodBecauseWhyNot == null
|
Object vector = vectorConstructorAsAMethodBecauseWhyNot == null
|
||||||
? vectorConstructor.newInstance(location.getX(), location.getY(), location.getZ())
|
? vectorConstructor.newInstance(location.getX(), location.getY(), location.getZ())
|
||||||
: vectorConstructorAsAMethodBecauseWhyNot.invoke(null, location.getX(), location.getY(), location.getZ());
|
: vectorConstructorAsAMethodBecauseWhyNot.invoke(null, location.getX(), location.getY(), location.getZ());
|
||||||
return (ApplicableRegionSet)regionManagerGetMethod.invoke(regionManager, vector);
|
return (ApplicableRegionSet) regionManagerGetMethod.invoke(regionManager, vector);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
FactionsPlugin.instance.log("An error occurred looking up a WorldGuard ApplicableRegionSet");
|
FactionsPlugin.instance.log("An error occurred looking up a WorldGuard ApplicableRegionSet");
|
||||||
FactionsPlugin.instance.log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
FactionsPlugin.instance.log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
||||||
@@ -201,7 +204,8 @@ public class Worldguard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to check WorldGuard to see if a Player has permission to place a block.
|
* Used to check WorldGuard to see if a Player has permission to place a block.
|
||||||
* @param player player in question.
|
*
|
||||||
|
* @param player player in question.
|
||||||
* @param location Location of block placed.
|
* @param location Location of block placed.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -212,8 +216,9 @@ public class Worldguard {
|
|||||||
Object query = createQueryMethod.invoke(regionContainer);
|
Object query = createQueryMethod.invoke(regionContainer);
|
||||||
if (locationAdaptMethod != null) {
|
if (locationAdaptMethod != null) {
|
||||||
Object loc = locationAdaptMethod.invoke(null, location);
|
Object loc = locationAdaptMethod.invoke(null, location);
|
||||||
return (boolean)regionQueryTestStateMethod.invoke(query, loc, getAssociable(player), new StateFlag[]{buildFlag});
|
return (boolean) regionQueryTestStateMethod.invoke(query, loc, getAssociable(player), new StateFlag[]{buildFlag});
|
||||||
} else return (boolean)regionQueryTestStateMethod.invoke(query, location, getAssociable(player), new StateFlag[]{buildFlag});
|
} else
|
||||||
|
return (boolean) regionQueryTestStateMethod.invoke(query, location, getAssociable(player), new StateFlag[]{buildFlag});
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
FactionsPlugin.instance.log("An error occurred querying WorldGuard! Report this issue to SF Developers!");
|
FactionsPlugin.instance.log("An error occurred querying WorldGuard! Report this issue to SF Developers!");
|
||||||
FactionsPlugin.instance.log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
FactionsPlugin.instance.log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
||||||
@@ -224,7 +229,8 @@ public class Worldguard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to check WorldGuard to see if a player has permission to break a block.
|
* Used to check WorldGuard to see if a player has permission to break a block.
|
||||||
* @param player player in question.
|
*
|
||||||
|
* @param player player in question.
|
||||||
* @param location Location of block broken.
|
* @param location Location of block broken.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -236,7 +242,8 @@ public class Worldguard {
|
|||||||
if (locationAdaptMethod != null) {
|
if (locationAdaptMethod != null) {
|
||||||
Object loc = locationAdaptMethod.invoke(null, location);
|
Object loc = locationAdaptMethod.invoke(null, location);
|
||||||
return (boolean) regionQueryTestStateMethod.invoke(query, loc, getAssociable(player), new StateFlag[]{breakFlag});
|
return (boolean) regionQueryTestStateMethod.invoke(query, loc, getAssociable(player), new StateFlag[]{breakFlag});
|
||||||
} else return (boolean) regionQueryTestStateMethod.invoke(query, location, getAssociable(player), new StateFlag[]{breakFlag});
|
} else
|
||||||
|
return (boolean) regionQueryTestStateMethod.invoke(query, location, getAssociable(player), new StateFlag[]{breakFlag});
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
FactionsPlugin.instance.log("An error occurred querying WorldGuard! Report this issue to SF Developers!");
|
FactionsPlugin.instance.log("An error occurred querying WorldGuard! Report this issue to SF Developers!");
|
||||||
@@ -246,10 +253,13 @@ public class Worldguard {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkForRegionsInChunk(FLocation floc) { return checkForRegionsInChunk(floc.getChunk()); }
|
public boolean checkForRegionsInChunk(FLocation floc) {
|
||||||
|
return checkForRegionsInChunk(floc.getChunk());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for checking if regions are located in a chunk
|
* Used for checking if regions are located in a chunk
|
||||||
|
*
|
||||||
* @param chunk Chunk in question.
|
* @param chunk Chunk in question.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -284,7 +294,8 @@ public class Worldguard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* General check for WorldGuard region @ location.
|
* General check for WorldGuard region @ location.
|
||||||
* @param player player in question.
|
*
|
||||||
|
* @param player player in question.
|
||||||
* @param location Location of block broken.
|
* @param location Location of block broken.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
@@ -161,18 +162,20 @@ public class FactionsBlockListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
Faction at = Board.getInstance().getFactionAt(new FLocation(event.getBlockPlaced()));
|
|
||||||
|
|
||||||
if (!event.canBuild()) return;
|
if (!event.canBuild()) return;
|
||||||
if (event.getBlockPlaced().getType() == Material.FIRE) return;
|
if (event.getBlockPlaced().getType() == Material.FIRE) return;
|
||||||
|
boolean isSpawner = event.getBlock().getType().equals(XMaterial.SPAWNER.parseMaterial());
|
||||||
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "build", false)) {
|
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "build", false)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.getBlock().getType().equals(XMaterial.SPAWNER.parseMaterial()) && Conf.spawnerLock) {
|
|
||||||
event.setCancelled(true);
|
if (isSpawner) {
|
||||||
event.getPlayer().sendMessage(FactionsPlugin.getInstance().color(TL.COMMAND_SPAWNER_LOCK_CANNOT_PLACE.toString()));
|
if (Conf.spawnerLock) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
event.getPlayer().sendMessage(FactionsPlugin.getInstance().color(TL.COMMAND_SPAWNER_LOCK_CANNOT_PLACE.toString()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,7 +380,7 @@ public class FactionsBlockListener implements Listener {
|
|||||||
int radius = FactionsPlugin.getInstance().getConfig().getInt("fbanners.Banner-Effect-Radius");
|
int radius = FactionsPlugin.getInstance().getConfig().getInt("fbanners.Banner-Effect-Radius");
|
||||||
List<String> effects = FactionsPlugin.getInstance().getConfig().getStringList("fbanners.Effects");
|
List<String> effects = FactionsPlugin.getInstance().getConfig().getStringList("fbanners.Effects");
|
||||||
int affectorTask = Bukkit.getScheduler().scheduleSyncRepeatingTask(FactionsPlugin.getInstance(), () -> {
|
int affectorTask = Bukkit.getScheduler().scheduleSyncRepeatingTask(FactionsPlugin.getInstance(), () -> {
|
||||||
for (Entity e1 : banner.getLocation().getWorld().getNearbyEntities(banner.getLocation(), radius, 255.0, radius)) {
|
for (Entity e1 : Objects.requireNonNull(banner.getLocation().getWorld()).getNearbyEntities(banner.getLocation(), radius, 255.0, radius)) {
|
||||||
if (e1 instanceof Player) {
|
if (e1 instanceof Player) {
|
||||||
Player player = (Player) e1;
|
Player player = (Player) e1;
|
||||||
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
|
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
|
||||||
@@ -386,7 +389,7 @@ public class FactionsBlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
for (String effect : effects) {
|
for (String effect : effects) {
|
||||||
String[] components = effect.split(":");
|
String[] components = effect.split(":");
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.getByName(components[0]), 100, Integer.parseInt(components[1])));
|
player.addPotionEffect(new PotionEffect(Objects.requireNonNull(PotionEffectType.getByName(components[0])), 100, Integer.parseInt(components[1])));
|
||||||
}
|
}
|
||||||
ParticleEffect.LAVA.display(1.0f, 1.0f, 1.0f, 1.0f, 10, banner.getLocation(), 16.0);
|
ParticleEffect.LAVA.display(1.0f, 1.0f, 1.0f, 1.0f, 10, banner.getLocation(), 16.0);
|
||||||
ParticleEffect.FLAME.display(1.0f, 1.0f, 1.0f, 1.0f, 10, banner.getLocation(), 16.0);
|
ParticleEffect.FLAME.display(1.0f, 1.0f, 1.0f, 1.0f, 10, banner.getLocation(), 16.0);
|
||||||
@@ -493,13 +496,25 @@ public class FactionsBlockListener implements Listener {
|
|||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
|
|
||||||
Faction at = Board.getInstance().getFactionAt(new FLocation(block));
|
Faction at = Board.getInstance().getFactionAt(new FLocation(block));
|
||||||
boolean isSpawner = event.getBlock().getType() == XMaterial.SPAWNER.parseMaterial();
|
boolean isSpawner = event.getBlock().getType().equals(XMaterial.SPAWNER.parseMaterial());
|
||||||
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), !isSpawner ? "destroy" : "mine spawners", false)) {
|
|
||||||
|
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (block != null && isSpawner) {
|
|
||||||
ItemStack item = new ItemStack(block.getType(), 1, (short) block.getData());
|
FPlayer fme = FPlayers.getInstance().getByPlayer(event.getPlayer());
|
||||||
|
if (fme == null || !fme.hasFaction()) return;
|
||||||
|
|
||||||
|
if (isSpawner) {
|
||||||
|
Access access = fme.getFaction().getAccess(fme, PermissableAction.SPAWNER);
|
||||||
|
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
|
||||||
|
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "mine spawners");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSpawner && !fme.isAdminBypassing()) {
|
||||||
|
ItemStack item = new ItemStack(block.getType(), 1, block.getData());
|
||||||
if (at != null && at.isNormal()) {
|
if (at != null && at.isNormal()) {
|
||||||
FPlayer fplayer = FPlayers.getInstance().getByPlayer(event.getPlayer());
|
FPlayer fplayer = FPlayers.getInstance().getByPlayer(event.getPlayer());
|
||||||
if (fplayer != null) {
|
if (fplayer != null) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import com.massivecraft.factions.util.MiscUtil;
|
|||||||
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.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.TravelAgent;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.entity.minecart.ExplosiveMinecart;
|
import org.bukkit.entity.minecart.ExplosiveMinecart;
|
||||||
@@ -20,7 +20,6 @@ import org.bukkit.event.hanging.HangingBreakEvent;
|
|||||||
import org.bukkit.event.hanging.HangingBreakEvent.RemoveCause;
|
import org.bukkit.event.hanging.HangingBreakEvent.RemoveCause;
|
||||||
import org.bukkit.event.hanging.HangingPlaceEvent;
|
import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerPortalEvent;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.projectiles.ProjectileSource;
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
@@ -155,16 +154,17 @@ public class FactionsEntityListener implements Listener {
|
|||||||
|
|
||||||
// Run the check for a player
|
// Run the check for a player
|
||||||
if (damager instanceof Player) {
|
if (damager instanceof Player) {
|
||||||
// Generate the action message.
|
Player player = (Player) damager;
|
||||||
String entityAction;
|
Material material = null;
|
||||||
|
switch (sub.getEntity().getType()) {
|
||||||
if (damagee.getType() == EntityType.ITEM_FRAME) {
|
case ITEM_FRAME:
|
||||||
entityAction = "item frames";
|
material = Material.ITEM_FRAME;
|
||||||
} else {
|
break;
|
||||||
entityAction = "armor stands";
|
case ARMOR_STAND:
|
||||||
|
material = Material.ARMOR_STAND;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
if (material != null && !FactionsBlockListener.playerCanBuildDestroyBlock(player, damagee.getLocation(), "destroy " + material.toString().toLowerCase(), false)) {
|
||||||
if (!FactionsBlockListener.playerCanBuildDestroyBlock((Player) damager, damagee.getLocation(), "destroy " + entityAction, false)) {
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -240,7 +240,7 @@ public class FactionsEntityListener implements Listener {
|
|||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
if (FactionsPlugin.getInstance().getStuckMap().containsKey(uuid))
|
if (FactionsPlugin.getInstance().getStuckMap().containsKey(uuid))
|
||||||
FPlayers.getInstance().getByPlayer(player).msg(TL.COMMAND_STUCK_CANCELLED);
|
FPlayers.getInstance().getByPlayer(player).msg(TL.COMMAND_STUCK_CANCELLED);
|
||||||
FactionsPlugin.getInstance().getStuckMap().remove(uuid);
|
FactionsPlugin.getInstance().getStuckMap().remove(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
@@ -292,7 +292,7 @@ public class FactionsEntityListener implements Listener {
|
|||||||
|
|
||||||
if (faction.noExplosionsInTerritory() || (faction.isPeaceful() && Conf.peacefulTerritoryDisableBoom))
|
if (faction.noExplosionsInTerritory() || (faction.isPeaceful() && Conf.peacefulTerritoryDisableBoom))
|
||||||
return false;
|
return false;
|
||||||
// faction is peaceful and has explosions set to disabled
|
// faction is peaceful and has explosions set to disabled
|
||||||
|
|
||||||
boolean online = faction.hasPlayersOnline();
|
boolean online = faction.hasPlayersOnline();
|
||||||
|
|
||||||
@@ -682,8 +682,8 @@ public class FactionsEntityListener implements Listener {
|
|||||||
Player victim = (Player) e.getEntity();
|
Player victim = (Player) e.getEntity();
|
||||||
FPlayer fdamager = FPlayers.getInstance().getByPlayer(damager);
|
FPlayer fdamager = FPlayers.getInstance().getByPlayer(damager);
|
||||||
FPlayer fvictim = FPlayers.getInstance().getByPlayer(victim);
|
FPlayer fvictim = FPlayers.getInstance().getByPlayer(victim);
|
||||||
if(damager == victim) return;
|
if (damager == victim) return;
|
||||||
if(fdamager == fvictim) return;
|
if (fdamager == fvictim) return;
|
||||||
if (fvictim.getRelationTo(fdamager) == Relation.TRUCE) {
|
if (fvictim.getRelationTo(fdamager) == Relation.TRUCE) {
|
||||||
fdamager.msg(TL.PLAYER_PVP_CANTHURT, fvictim.describeTo(fdamager));
|
fdamager.msg(TL.PLAYER_PVP_CANTHURT, fvictim.describeTo(fdamager));
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.massivecraft.factions.listeners;
|
package com.massivecraft.factions.listeners;
|
||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
|
||||||
import com.massivecraft.factions.util.XMaterial;
|
import com.massivecraft.factions.util.XMaterial;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|||||||
@@ -53,12 +53,14 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
public class FactionsPlayerListener implements Listener {
|
public class FactionsPlayerListener implements Listener {
|
||||||
|
|
||||||
|
public static Set<FLocation> corners;
|
||||||
|
public static BukkitTask positionTask = null;
|
||||||
|
public static Map<UUID, Location> lastLocations = new HashMap<>();
|
||||||
/**
|
/**
|
||||||
* @author FactionsUUID Team
|
* @author FactionsUUID Team
|
||||||
*/
|
*/
|
||||||
|
|
||||||
HashMap<Player, Boolean> fallMap = new HashMap<>();
|
HashMap<Player, Boolean> fallMap = new HashMap<>();
|
||||||
public static Set<FLocation> corners;
|
|
||||||
// Holds the next time a player can have a map shown.
|
// Holds the next time a player can have a map shown.
|
||||||
private HashMap<UUID, Long> showTimes = new HashMap<>();
|
private HashMap<UUID, Long> showTimes = new HashMap<>();
|
||||||
|
|
||||||
@@ -225,7 +227,6 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
return CheckPlayerAccess(player, me, loc, myFaction, otherFaction.getAccess(me, action), action, Conf.territoryPainBuild);
|
return CheckPlayerAccess(player, me, loc, myFaction, otherFaction.getAccess(me, action), action, Conf.territoryPainBuild);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static boolean preventCommand(String fullCmd, Player player) {
|
public static boolean preventCommand(String fullCmd, Player player) {
|
||||||
if ((Conf.territoryNeutralDenyCommands.isEmpty() && Conf.territoryEnemyDenyCommands.isEmpty() && Conf.permanentFactionMemberDenyCommands.isEmpty() && Conf.warzoneDenyCommands.isEmpty())) {
|
if ((Conf.territoryNeutralDenyCommands.isEmpty() && Conf.territoryEnemyDenyCommands.isEmpty() && Conf.permanentFactionMemberDenyCommands.isEmpty() && Conf.warzoneDenyCommands.isEmpty())) {
|
||||||
return false;
|
return false;
|
||||||
@@ -261,7 +262,7 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
Relation rel = at.getRelationTo(me);
|
Relation rel = at.getRelationTo(me);
|
||||||
if (at.isNormal() && rel.isAlly() && !Conf.territoryAllyDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.territoryAllyDenyCommands.iterator())) {
|
if (at.isNormal() && rel.isAlly() && !Conf.territoryAllyDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.territoryAllyDenyCommands.iterator())) {
|
||||||
me.msg(TL.PLAYER_COMMAND_ALLY, fullCmd);
|
me.msg(TL.PLAYER_COMMAND_ALLY, fullCmd);
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (at.isNormal() && rel.isNeutral() && !Conf.territoryNeutralDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.territoryNeutralDenyCommands.iterator())) {
|
if (at.isNormal() && rel.isNeutral() && !Conf.territoryNeutralDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.territoryNeutralDenyCommands.iterator())) {
|
||||||
@@ -338,7 +339,7 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
return PermissableAction.DOOR;
|
return PermissableAction.DOOR;
|
||||||
if (material.name().toUpperCase().contains("BUTTON") || material.name().toUpperCase().contains("PRESSURE") || material.name().contains("DIODE") || material.name().contains("COMPARATOR"))
|
if (material.name().toUpperCase().contains("BUTTON") || material.name().toUpperCase().contains("PRESSURE") || material.name().contains("DIODE") || material.name().contains("COMPARATOR"))
|
||||||
return PermissableAction.BUTTON;
|
return PermissableAction.BUTTON;
|
||||||
if (FactionsPlugin.instance.mc113 || FactionsPlugin.instance.mc114) {
|
if (FactionsPlugin.instance.mc113 || FactionsPlugin.instance.mc114 || FactionsPlugin.getInstance().mc115) {
|
||||||
switch (material) {
|
switch (material) {
|
||||||
case LEVER:
|
case LEVER:
|
||||||
return PermissableAction.LEVER;
|
return PermissableAction.LEVER;
|
||||||
@@ -381,6 +382,8 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
case TRAPPED_CHEST:
|
case TRAPPED_CHEST:
|
||||||
case CHEST_MINECART:
|
case CHEST_MINECART:
|
||||||
|
|
||||||
|
case BARREL:
|
||||||
|
|
||||||
case SHULKER_BOX:
|
case SHULKER_BOX:
|
||||||
case BLACK_SHULKER_BOX:
|
case BLACK_SHULKER_BOX:
|
||||||
case BLUE_SHULKER_BOX:
|
case BLUE_SHULKER_BOX:
|
||||||
@@ -400,6 +403,8 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
case YELLOW_SHULKER_BOX:
|
case YELLOW_SHULKER_BOX:
|
||||||
|
|
||||||
case FURNACE:
|
case FURNACE:
|
||||||
|
case BLAST_FURNACE:
|
||||||
|
case SMOKER:
|
||||||
case DROPPER:
|
case DROPPER:
|
||||||
case DISPENSER:
|
case DISPENSER:
|
||||||
case ENCHANTING_TABLE:
|
case ENCHANTING_TABLE:
|
||||||
@@ -439,6 +444,8 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
case ENCHANTING_TABLE:
|
case ENCHANTING_TABLE:
|
||||||
case DROPPER:
|
case DROPPER:
|
||||||
case FURNACE:
|
case FURNACE:
|
||||||
|
case BLAST_FURNACE:
|
||||||
|
case SMOKER:
|
||||||
case HOPPER:
|
case HOPPER:
|
||||||
case ANVIL:
|
case ANVIL:
|
||||||
case CHIPPED_ANVIL:
|
case CHIPPED_ANVIL:
|
||||||
@@ -637,9 +644,6 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
return (result.length() == 3 ? result + "0" : result) + "/hrs ago";
|
return (result.length() == 3 ? result + "0" : result) + "/hrs ago";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BukkitTask positionTask = null;
|
|
||||||
public static Map<UUID, Location> lastLocations = new HashMap<>();
|
|
||||||
|
|
||||||
public void startPositionCheck() {
|
public void startPositionCheck() {
|
||||||
positionTask = Bukkit.getScheduler().runTaskTimer(FactionsPlugin.instance, () -> {
|
positionTask = Bukkit.getScheduler().runTaskTimer(FactionsPlugin.instance, () -> {
|
||||||
if (Bukkit.getOnlinePlayers().size() > 0) {
|
if (Bukkit.getOnlinePlayers().size() > 0) {
|
||||||
@@ -818,8 +822,8 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
|
|
||||||
Material type;
|
Material type;
|
||||||
if (event.getItem() != null) {
|
if (event.getItem() != null) {
|
||||||
// Convert 1.8 Material Names -> 1.14
|
// Convert 1.8 Material Names -> 1.15
|
||||||
type = XMaterial.matchXMaterial(event.getItem().getType().toString()).parseMaterial();
|
type = XMaterial.matchXMaterial(event.getItem().getType().toString()).get().parseMaterial();
|
||||||
} else {
|
} else {
|
||||||
type = null;
|
type = null;
|
||||||
}
|
}
|
||||||
@@ -918,13 +922,21 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onLogoutMove(PlayerMoveEvent e) {
|
public void onLogoutMove(PlayerMoveEvent e) {
|
||||||
LogoutHandler handler = LogoutHandler.getByName(e.getPlayer().getName());
|
LogoutHandler handler = LogoutHandler.getByName(e.getPlayer().getName());
|
||||||
|
|
||||||
|
if (Objects.requireNonNull(e.getTo()).getBlockX() == e.getFrom().getBlockX() &&
|
||||||
|
e.getTo().getBlockY() == e.getFrom().getBlockY() &&
|
||||||
|
e.getTo().getBlockZ() == e.getFrom().getBlockZ())
|
||||||
|
return;
|
||||||
|
|
||||||
if (handler.isLogoutActive(e.getPlayer())) {
|
if (handler.isLogoutActive(e.getPlayer())) {
|
||||||
handler.cancelLogout(e.getPlayer());
|
handler.cancelLogout(e.getPlayer());
|
||||||
e.getPlayer().sendMessage(String.valueOf(TL.COMMAND_LOGOUT_MOVED));
|
e.getPlayer().sendMessage(String.valueOf(TL.COMMAND_LOGOUT_MOVED));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CmdWild.waitingTeleport.containsKey(e.getPlayer())) {
|
if (CmdWild.waitingTeleport.containsKey(e.getPlayer())) {
|
||||||
CmdWild.waitingTeleport.remove(e.getPlayer());
|
CmdWild.waitingTeleport.remove(e.getPlayer());
|
||||||
FPlayers.getInstance().getByPlayer(e.getPlayer()).msg(TL.COMMAND_WILD_INTERUPTED);
|
FPlayers.getInstance().getByPlayer(e.getPlayer()).msg(TL.COMMAND_WILD_INTERUPTED);
|
||||||
@@ -1060,13 +1072,13 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
FPlayer fp = FPlayers.getInstance().getByPlayer(e.getPlayer());
|
FPlayer fp = FPlayers.getInstance().getByPlayer(e.getPlayer());
|
||||||
|
|
||||||
if(fp == null) return;
|
if (fp == null) return;
|
||||||
|
|
||||||
if (fp.getChatMode() != ChatMode.FACTION) {
|
if (fp.getChatMode() != ChatMode.FACTION) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Faction f = fp.getFaction();
|
Faction f = fp.getFaction();
|
||||||
if(f == null) return;
|
if (f == null) return;
|
||||||
if (f.isSystemFaction()) {
|
if (f.isSystemFaction()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1085,7 +1097,7 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Member m : t.getMembers()) {
|
for (Member m : t.getMembers()) {
|
||||||
if (m.getEffectiveName().contains(target) | m.getUser().getName().contains(target)){
|
if (m.getEffectiveName().contains(target) | m.getUser().getName().contains(target)) {
|
||||||
targets.add("@" + m.getUser().getName() + "#" + m.getUser().getDiscriminator());
|
targets.add("@" + m.getUser().getName() + "#" + m.getUser().getDiscriminator());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import org.bukkit.inventory.Inventory;
|
|||||||
import org.bukkit.inventory.ItemFlag;
|
import org.bukkit.inventory.ItemFlag;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class MissionGUI implements FactionGUI {
|
public class MissionGUI implements FactionGUI {
|
||||||
@@ -56,7 +57,9 @@ public class MissionGUI implements FactionGUI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (plugin.getConfig().getBoolean("Randomization.Enabled")) {return;}
|
} else if (plugin.getConfig().getBoolean("Randomization.Enabled")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (configurationSection == null) return;
|
if (configurationSection == null) return;
|
||||||
|
|
||||||
int max = plugin.getConfig().getInt("MaximumMissionsAllowedAtOnce");
|
int max = plugin.getConfig().getInt("MaximumMissionsAllowedAtOnce");
|
||||||
@@ -64,7 +67,8 @@ public class MissionGUI implements FactionGUI {
|
|||||||
fPlayer.msg(TL.MISSION_MISSION_MAX_ALLOWED, max);
|
fPlayer.msg(TL.MISSION_MISSION_MAX_ALLOWED, max);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (missionName.equals(plugin.color(FactionsPlugin.getInstance().getConfig().getString("Randomization.Start-Item.Disallowed.Name")))) return;
|
if (missionName.equals(plugin.color(FactionsPlugin.getInstance().getConfig().getString("Randomization.Start-Item.Disallowed.Name"))))
|
||||||
|
return;
|
||||||
|
|
||||||
if (fPlayer.getFaction().getMissions().containsKey(missionName)) {
|
if (fPlayer.getFaction().getMissions().containsKey(missionName)) {
|
||||||
fPlayer.msg(TL.MISSION_MISSION_ACTIVE);
|
fPlayer.msg(TL.MISSION_MISSION_ACTIVE);
|
||||||
@@ -73,7 +77,7 @@ public class MissionGUI implements FactionGUI {
|
|||||||
ConfigurationSection section = configurationSection.getConfigurationSection(missionName);
|
ConfigurationSection section = configurationSection.getConfigurationSection(missionName);
|
||||||
if (section == null) return;
|
if (section == null) return;
|
||||||
|
|
||||||
if(FactionsPlugin.getInstance().getConfig().getBoolean("DenyMissionsMoreThenOnce")) {
|
if (FactionsPlugin.getInstance().getConfig().getBoolean("DenyMissionsMoreThenOnce")) {
|
||||||
if (fPlayer.getFaction().getCompletedMissions().contains(missionName)) {
|
if (fPlayer.getFaction().getCompletedMissions().contains(missionName)) {
|
||||||
fPlayer.msg(TL.MISSION_ALREAD_COMPLETED);
|
fPlayer.msg(TL.MISSION_ALREAD_COMPLETED);
|
||||||
return;
|
return;
|
||||||
@@ -96,7 +100,7 @@ public class MissionGUI implements FactionGUI {
|
|||||||
if (configurationSection == null) {
|
if (configurationSection == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ItemStack fillItem = XMaterial.matchXMaterial(configurationSection.getString("FillItem.Material")).parseItem();
|
ItemStack fillItem = XMaterial.matchXMaterial(configurationSection.getString("FillItem.Material")).get().parseItem();
|
||||||
ItemMeta fillmeta = fillItem.getItemMeta();
|
ItemMeta fillmeta = fillItem.getItemMeta();
|
||||||
fillmeta.setDisplayName("");
|
fillmeta.setDisplayName("");
|
||||||
fillItem.setItemMeta(fillmeta);
|
fillItem.setItemMeta(fillmeta);
|
||||||
@@ -109,7 +113,7 @@ public class MissionGUI implements FactionGUI {
|
|||||||
ConfigurationSection section = configurationSection.getConfigurationSection(key);
|
ConfigurationSection section = configurationSection.getConfigurationSection(key);
|
||||||
int slot = section.getInt("Slot");
|
int slot = section.getInt("Slot");
|
||||||
|
|
||||||
ItemStack itemStack = XMaterial.matchXMaterial(section.getString("Material")).parseItem();
|
ItemStack itemStack = XMaterial.matchXMaterial(section.getString("Material")).get().parseItem();
|
||||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||||
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', section.getString("Name")));
|
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', section.getString("Name")));
|
||||||
List<String> loreLines = new ArrayList<>();
|
List<String> loreLines = new ArrayList<>();
|
||||||
@@ -134,7 +138,7 @@ public class MissionGUI implements FactionGUI {
|
|||||||
if (plugin.getConfig().getBoolean("Randomization.Enabled")) {
|
if (plugin.getConfig().getBoolean("Randomization.Enabled")) {
|
||||||
ItemStack start;
|
ItemStack start;
|
||||||
ItemMeta meta;
|
ItemMeta meta;
|
||||||
start = XMaterial.matchXMaterial(plugin.getConfig().getString("Randomization.Start-Item.Allowed.Material")).parseItem();
|
start = XMaterial.matchXMaterial(plugin.getConfig().getString("Randomization.Start-Item.Allowed.Material")).get().parseItem();
|
||||||
meta = start.getItemMeta();
|
meta = start.getItemMeta();
|
||||||
meta.setDisplayName(plugin.color(plugin.getConfig().getString("Randomization.Start-Item.Allowed.Name")));
|
meta.setDisplayName(plugin.color(plugin.getConfig().getString("Randomization.Start-Item.Allowed.Name")));
|
||||||
List<String> loree = new ArrayList<>();
|
List<String> loree = new ArrayList<>();
|
||||||
@@ -144,7 +148,7 @@ public class MissionGUI implements FactionGUI {
|
|||||||
meta.setLore(loree);
|
meta.setLore(loree);
|
||||||
start.setItemMeta(meta);
|
start.setItemMeta(meta);
|
||||||
if (fPlayer.getFaction().getCompletedMissions().size() >= configurationSection.getKeys(false).size() - 1 && plugin.getConfig().getBoolean("DenyMissionsMoreThenOnce")) {
|
if (fPlayer.getFaction().getCompletedMissions().size() >= configurationSection.getKeys(false).size() - 1 && plugin.getConfig().getBoolean("DenyMissionsMoreThenOnce")) {
|
||||||
start = XMaterial.matchXMaterial(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Material")).parseItem();
|
start = XMaterial.matchXMaterial(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Material")).get().parseItem();
|
||||||
meta = start.getItemMeta();
|
meta = start.getItemMeta();
|
||||||
meta.setDisplayName(plugin.color(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Name")));
|
meta.setDisplayName(plugin.color(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Name")));
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
@@ -155,7 +159,7 @@ public class MissionGUI implements FactionGUI {
|
|||||||
start.setItemMeta(meta);
|
start.setItemMeta(meta);
|
||||||
}
|
}
|
||||||
if (fPlayer.getFaction().getMissions().size() >= plugin.getConfig().getInt("MaximumMissionsAllowedAtOnce")) {
|
if (fPlayer.getFaction().getMissions().size() >= plugin.getConfig().getInt("MaximumMissionsAllowedAtOnce")) {
|
||||||
start = XMaterial.matchXMaterial(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Material")).parseItem();
|
start = XMaterial.matchXMaterial(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Material")).get().parseItem();
|
||||||
meta = start.getItemMeta();
|
meta = start.getItemMeta();
|
||||||
meta.setDisplayName(plugin.color(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Name")));
|
meta.setDisplayName(plugin.color(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Name")));
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class ShopGUIFrame {
|
|||||||
for (int a = 1; a <= items; a++) {
|
for (int a = 1; a <= items; a++) {
|
||||||
String s = a + "";
|
String s = a + "";
|
||||||
int slot = ShopConfig.getShop().getInt("items." + s + ".slot");
|
int slot = ShopConfig.getShop().getInt("items." + s + ".slot");
|
||||||
Material material = XMaterial.matchXMaterial(ShopConfig.getShop().getString("items." + s + ".block")).parseMaterial();
|
Material material = XMaterial.matchXMaterial(ShopConfig.getShop().getString("items." + s + ".block")).get().parseMaterial();
|
||||||
int cost = ShopConfig.getShop().getInt("items." + s + ".cost");
|
int cost = ShopConfig.getShop().getInt("items." + s + ".cost");
|
||||||
String name = ShopConfig.getShop().getString("items." + s + ".name");
|
String name = ShopConfig.getShop().getString("items." + s + ".name");
|
||||||
boolean glowing = ShopConfig.getShop().getBoolean("items." + s + ".glowing");
|
boolean glowing = ShopConfig.getShop().getBoolean("items." + s + ".glowing");
|
||||||
@@ -93,7 +93,7 @@ public class ShopGUIFrame {
|
|||||||
|
|
||||||
private ItemStack buildDummyItem(Faction f) {
|
private ItemStack buildDummyItem(Faction f) {
|
||||||
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("F-Shop.GUI.dummy-item");
|
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("F-Shop.GUI.dummy-item");
|
||||||
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem();
|
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
if (meta != null) {
|
if (meta != null) {
|
||||||
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public enum Permission {
|
|||||||
CHECK("check"),
|
CHECK("check"),
|
||||||
CLAIM("claim"),
|
CLAIM("claim"),
|
||||||
CLAIMAT("claimat"),
|
CLAIMAT("claimat"),
|
||||||
|
CLAIM_FILL("claimfill"),
|
||||||
CLAIM_LINE("claim.line"),
|
CLAIM_LINE("claim.line"),
|
||||||
CLAIM_RADIUS("claim.radius"),
|
CLAIM_RADIUS("claim.radius"),
|
||||||
CONFIG("config"),
|
CONFIG("config"),
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ public enum Relation implements Permissable {
|
|||||||
String displayName = replacePlaceholders(RELATION_CONFIG.getString("placeholder-item.name", ""));
|
String displayName = replacePlaceholders(RELATION_CONFIG.getString("placeholder-item.name", ""));
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
|
|
||||||
Material material = XMaterial.matchXMaterial(RELATION_CONFIG.getString("materials." + name().toLowerCase())).parseMaterial();
|
Material material = XMaterial.matchXMaterial(RELATION_CONFIG.getString("materials." + name().toLowerCase())).get().parseMaterial();
|
||||||
if (material == null) {
|
if (material == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public enum Role implements Permissable {
|
|||||||
String displayName = replacePlaceholders(RELATION_CONFIG.getString("placeholder-item.name", ""));
|
String displayName = replacePlaceholders(RELATION_CONFIG.getString("placeholder-item.name", ""));
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
|
|
||||||
Material material = XMaterial.matchXMaterial(RELATION_CONFIG.getString("materials." + name().toLowerCase(), "STAINED_CLAY")).parseMaterial();
|
Material material = XMaterial.matchXMaterial(RELATION_CONFIG.getString("materials." + name().toLowerCase(), "STAINED_CLAY")).get().parseMaterial();
|
||||||
if (material == null) {
|
if (material == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,9 @@ public enum FactionTag implements Tag {
|
|||||||
return null;
|
return null;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
ANNOUNCEMENT("{announcement}", (fac) -> { return String.valueOf(fac.getAnnouncements()); }),
|
ANNOUNCEMENT("{announcement}", (fac) -> {
|
||||||
|
return String.valueOf(fac.getAnnouncements());
|
||||||
|
}),
|
||||||
PEACEFUL("{peaceful}", (fac) -> fac.isPeaceful() ? Conf.colorNeutral + TL.COMMAND_SHOW_PEACEFUL.toString() : ""),
|
PEACEFUL("{peaceful}", (fac) -> fac.isPeaceful() ? Conf.colorNeutral + TL.COMMAND_SHOW_PEACEFUL.toString() : ""),
|
||||||
PERMANENT("permanent", (fac) -> fac.isPermanent() ? "permanent" : "{notPermanent}"), // no braces needed
|
PERMANENT("permanent", (fac) -> fac.isPermanent() ? "permanent" : "{notPermanent}"), // no braces needed
|
||||||
LAND_VALUE("{land-value}", (fac) -> Econ.shouldBeUsed() ? Econ.moneyString(Econ.calculateTotalLandValue(fac.getLandRounded())) : Tag.isMinimalShow() ? null : TL.ECON_OFF.format("value")),
|
LAND_VALUE("{land-value}", (fac) -> Econ.shouldBeUsed() ? Econ.moneyString(Econ.calculateTotalLandValue(fac.getLandRounded())) : Tag.isMinimalShow() ? null : TL.ECON_OFF.format("value")),
|
||||||
@@ -95,7 +97,7 @@ public enum FactionTag implements Tag {
|
|||||||
return String.valueOf(fac.getFPlayersWhereOnline(false).size());
|
return String.valueOf(fac.getFPlayersWhereOnline(false).size());
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
FACTION_STRIKES("{faction-strikes}",(fac) -> String.valueOf(fac.getStrikes())),
|
FACTION_STRIKES("{faction-strikes}", (fac) -> String.valueOf(fac.getStrikes())),
|
||||||
FACTION_POINTS("{faction-points}", (fac) -> String.valueOf(fac.getPoints())),
|
FACTION_POINTS("{faction-points}", (fac) -> String.valueOf(fac.getPoints())),
|
||||||
FACTION_SIZE("{members}", (fac) -> String.valueOf(fac.getFPlayers().size())),
|
FACTION_SIZE("{members}", (fac) -> String.valueOf(fac.getFPlayers().size())),
|
||||||
FACTION_KILLS("{faction-kills}", (fac) -> String.valueOf(fac.getKills())),
|
FACTION_KILLS("{faction-kills}", (fac) -> String.valueOf(fac.getKills())),
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.massivecraft.factions.tag;
|
package com.massivecraft.factions.tag;
|
||||||
|
|
||||||
import com.massivecraft.factions.FPlayers;
|
import com.massivecraft.factions.FPlayers;
|
||||||
import com.massivecraft.factions.Factions;
|
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.factions.tag;
|
package com.massivecraft.factions.tag;
|
||||||
|
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import com.massivecraft.factions.integration.Econ;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import org.apache.commons.lang.time.DurationFormatUtils;
|
import org.apache.commons.lang.time.DurationFormatUtils;
|
||||||
@@ -15,7 +16,13 @@ public enum PlayerTag implements Tag {
|
|||||||
/**
|
/**
|
||||||
* @author FactionsUUID Team
|
* @author FactionsUUID Team
|
||||||
*/
|
*/
|
||||||
|
GROUP("{group}", (fp) -> {
|
||||||
|
if (fp.isOnline()) {
|
||||||
|
return FactionsPlugin.getInstance().getPrimaryGroup(fp.getPlayer());
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}),
|
||||||
LAST_SEEN("{lastSeen}", (fp) -> {
|
LAST_SEEN("{lastSeen}", (fp) -> {
|
||||||
String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fp.getLastLoginTime(), true, true) + TL.COMMAND_STATUS_AGOSUFFIX;
|
String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fp.getLastLoginTime(), true, true) + TL.COMMAND_STATUS_AGOSUFFIX;
|
||||||
return fp.isOnline() ? ChatColor.GREEN + TL.COMMAND_STATUS_ONLINE.toString() : (System.currentTimeMillis() - fp.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized);
|
return fp.isOnline() ? ChatColor.GREEN + TL.COMMAND_STATUS_ONLINE.toString() : (System.currentTimeMillis() - fp.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized);
|
||||||
|
|||||||
@@ -3,12 +3,13 @@ package com.massivecraft.factions.util;
|
|||||||
/**
|
/**
|
||||||
* @author Saser
|
* @author Saser
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
public class CC {
|
public class CC {
|
||||||
public static String Black = ChatColor.BLACK.toString();
|
public static String Black = ChatColor.BLACK.toString();
|
||||||
public static String BlackB = ChatColor.BLACK + ChatColor.BOLD.toString();
|
public static String BlackB = ChatColor.BLACK + ChatColor.BOLD.toString();
|
||||||
public static String BlackI = ChatColor.BLACK + ChatColor.ITALIC.toString();;
|
public static String BlackI = ChatColor.BLACK + ChatColor.ITALIC.toString();
|
||||||
public static String BlackU = ChatColor.BLACK + ChatColor.UNDERLINE.toString();
|
public static String BlackU = ChatColor.BLACK + ChatColor.UNDERLINE.toString();
|
||||||
public static String DarkBlue = ChatColor.DARK_BLUE.toString();
|
public static String DarkBlue = ChatColor.DARK_BLUE.toString();
|
||||||
public static String DarkBlueB = ChatColor.DARK_BLUE + ChatColor.BOLD.toString();
|
public static String DarkBlueB = ChatColor.DARK_BLUE + ChatColor.BOLD.toString();
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
|
|||||||
case "faction_description":
|
case "faction_description":
|
||||||
return faction.getDescription();
|
return faction.getDescription();
|
||||||
case "faction_claims":
|
case "faction_claims":
|
||||||
return fPlayer.hasFaction() ? String.valueOf(faction.getAllClaims().size()) : "0";
|
return fPlayer.hasFaction() ? String.valueOf(faction.getAllClaims().size()) : "0";
|
||||||
case "faction_maxclaims":
|
case "faction_maxclaims":
|
||||||
return String.valueOf(Conf.claimedLandsMax);
|
return String.valueOf(Conf.claimedLandsMax);
|
||||||
case "faction_founded":
|
case "faction_founded":
|
||||||
@@ -169,10 +169,28 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
|
|||||||
return Econ.shouldBeUsed() ? Econ.moneyString(Econ.getBalance(faction.getAccountId())) : TL.ECON_OFF.format("balance");
|
return Econ.shouldBeUsed() ? Econ.moneyString(Econ.getBalance(faction.getAccountId())) : TL.ECON_OFF.format("balance");
|
||||||
case "faction_allies":
|
case "faction_allies":
|
||||||
return String.valueOf(faction.getRelationCount(Relation.ALLY));
|
return String.valueOf(faction.getRelationCount(Relation.ALLY));
|
||||||
|
case "faction_allies_players":
|
||||||
|
return String.valueOf(this.countOn(faction, Relation.ALLY, null, fPlayer));
|
||||||
|
case "faction_allies_players_online":
|
||||||
|
return String.valueOf(this.countOn(faction, Relation.ALLY, true, fPlayer));
|
||||||
|
case "faction_allies_players_offline":
|
||||||
|
return String.valueOf(this.countOn(faction, Relation.ALLY, false, fPlayer));
|
||||||
case "faction_enemies":
|
case "faction_enemies":
|
||||||
return String.valueOf(faction.getRelationCount(Relation.ENEMY));
|
return String.valueOf(faction.getRelationCount(Relation.ENEMY));
|
||||||
|
case "faction_enemies_players":
|
||||||
|
return String.valueOf(this.countOn(faction, Relation.ENEMY, null, fPlayer));
|
||||||
|
case "faction_enemies_players_online":
|
||||||
|
return String.valueOf(this.countOn(faction, Relation.ENEMY, true, fPlayer));
|
||||||
|
case "faction_enemies_players_offline":
|
||||||
|
return String.valueOf(this.countOn(faction, Relation.ENEMY, false, fPlayer));
|
||||||
case "faction_truces":
|
case "faction_truces":
|
||||||
return String.valueOf(faction.getRelationCount(Relation.TRUCE));
|
return String.valueOf(faction.getRelationCount(Relation.TRUCE));
|
||||||
|
case "faction_truces_players":
|
||||||
|
return String.valueOf(this.countOn(faction, Relation.TRUCE, null, fPlayer));
|
||||||
|
case "faction_truces_players_online":
|
||||||
|
return String.valueOf(this.countOn(faction, Relation.TRUCE, true, fPlayer));
|
||||||
|
case "faction_truces_players_offline":
|
||||||
|
return String.valueOf(this.countOn(faction, Relation.TRUCE, false, fPlayer));
|
||||||
case "faction_online":
|
case "faction_online":
|
||||||
return String.valueOf(faction.getOnlinePlayers().size());
|
return String.valueOf(faction.getOnlinePlayers().size());
|
||||||
case "faction_offline":
|
case "faction_offline":
|
||||||
@@ -187,6 +205,8 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
|
|||||||
return String.valueOf(faction.getDeaths());
|
return String.valueOf(faction.getDeaths());
|
||||||
case "faction_maxvaults":
|
case "faction_maxvaults":
|
||||||
return String.valueOf(faction.getMaxVaults());
|
return String.valueOf(faction.getMaxVaults());
|
||||||
|
case "faction_relation_color":
|
||||||
|
return fPlayer.getColorTo(faction).toString();
|
||||||
case "faction_grace":
|
case "faction_grace":
|
||||||
return String.valueOf(Conf.gracePeriod);
|
return String.valueOf(Conf.gracePeriod);
|
||||||
case "faction_name_at_location":
|
case "faction_name_at_location":
|
||||||
@@ -196,4 +216,21 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private int countOn(Faction f, Relation relation, Boolean status, FPlayer player) {
|
||||||
|
int count = 0;
|
||||||
|
for (Faction faction : Factions.getInstance().getAllFactions()) {
|
||||||
|
if (faction.getRelationTo(f) == relation) {
|
||||||
|
if (status == null) {
|
||||||
|
count += faction.getFPlayers().size();
|
||||||
|
} else if (status) {
|
||||||
|
count += faction.getFPlayersWhereOnline(true, player).size();
|
||||||
|
} else {
|
||||||
|
count += faction.getFPlayersWhereOnline(false, player).size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -38,8 +38,8 @@ public class FactionWarpsFrame {
|
|||||||
GUIItems.add(new GuiItem(buildDummyItem(), e -> e.setCancelled(true)));
|
GUIItems.add(new GuiItem(buildDummyItem(), e -> e.setCancelled(true)));
|
||||||
slots.forEach(slot -> GUIItems.set(slot, new GuiItem(XMaterial.AIR.parseItem())));
|
slots.forEach(slot -> GUIItems.set(slot, new GuiItem(XMaterial.AIR.parseItem())));
|
||||||
for (final Map.Entry<String, LazyLocation> warp : fplayer.getFaction().getWarps().entrySet()) {
|
for (final Map.Entry<String, LazyLocation> warp : fplayer.getFaction().getWarps().entrySet()) {
|
||||||
if (slots.size() < fplayer.getFaction().getWarps().entrySet().size()){
|
if (slots.size() < fplayer.getFaction().getWarps().entrySet().size()) {
|
||||||
slots.add(slots.get(slots.size()-1)+1);
|
slots.add(slots.get(slots.size() - 1) + 1);
|
||||||
FactionsPlugin.instance.log("Automatically setting F WARP GUI slot since slot not specified. Head config.yml and add more entries in warp-slots section.");
|
FactionsPlugin.instance.log("Automatically setting F WARP GUI slot since slot not specified. Head config.yml and add more entries in warp-slots section.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ public class FactionWarpsFrame {
|
|||||||
|
|
||||||
private ItemStack buildWarpAsset(final Map.Entry<String, LazyLocation> warp, final Faction faction) {
|
private ItemStack buildWarpAsset(final Map.Entry<String, LazyLocation> warp, final Faction faction) {
|
||||||
final ConfigurationSection config = this.section.getConfigurationSection("warp-item");
|
final ConfigurationSection config = this.section.getConfigurationSection("warp-item");
|
||||||
final ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem();
|
final ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
||||||
final ItemMeta meta = item.getItemMeta();
|
final ItemMeta meta = item.getItemMeta();
|
||||||
meta.setLore(FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().replacePlaceholders(config.getStringList("Lore"), new Placeholder("{warp-protected}", faction.hasWarpPassword(warp.getKey()) ? "Enabled" : "Disabled"), new Placeholder("{warp-cost}", FactionsPlugin.getInstance().getConfig().getBoolean("warp-cost.enabled", false) ? Integer.toString(FactionsPlugin.getInstance().getConfig().getInt("warp-cost.warp", 5)) : "Disabled"))));
|
meta.setLore(FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().replacePlaceholders(config.getStringList("Lore"), new Placeholder("{warp-protected}", faction.hasWarpPassword(warp.getKey()) ? "Enabled" : "Disabled"), new Placeholder("{warp-cost}", FactionsPlugin.getInstance().getConfig().getBoolean("warp-cost.enabled", false) ? Integer.toString(FactionsPlugin.getInstance().getConfig().getInt("warp-cost.warp", 5)) : "Disabled"))));
|
||||||
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name").replace("{warp}", warp.getKey())));
|
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name").replace("{warp}", warp.getKey())));
|
||||||
@@ -82,7 +82,7 @@ public class FactionWarpsFrame {
|
|||||||
|
|
||||||
private ItemStack buildDummyItem() {
|
private ItemStack buildDummyItem() {
|
||||||
final ConfigurationSection config = this.section.getConfigurationSection("dummy-item");
|
final ConfigurationSection config = this.section.getConfigurationSection("dummy-item");
|
||||||
final ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem();
|
final ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
||||||
final ItemMeta meta = item.getItemMeta();
|
final ItemMeta meta = item.getItemMeta();
|
||||||
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
||||||
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));
|
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.massivecraft.factions.util;
|
package com.massivecraft.factions.util;
|
||||||
|
|
||||||
import com.google.gson.*;
|
import com.google.gson.*;
|
||||||
import com.massivecraft.factions.Conf;
|
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ public class ItemBuilder {
|
|||||||
public ItemBuilder(Material material, int amount) {
|
public ItemBuilder(Material material, int amount) {
|
||||||
this(new ItemStack(material, amount));
|
this(new ItemStack(material, amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBuilder(Material material) {
|
public ItemBuilder(Material material) {
|
||||||
this(material, 1);
|
this(material, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.massivecraft.factions.util;
|
|||||||
/**
|
/**
|
||||||
* @author Saser
|
* @author Saser
|
||||||
*/
|
*/
|
||||||
import com.massivecraft.factions.util.XMaterial;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@@ -24,7 +24,7 @@ public class ItemUtil {
|
|||||||
} else {
|
} else {
|
||||||
int itemsFound = 0;
|
int itemsFound = 0;
|
||||||
|
|
||||||
for(int i = 0; i < inventory.getSize(); ++i) {
|
for (int i = 0; i < inventory.getSize(); ++i) {
|
||||||
ItemStack item = inventory.getItem(i);
|
ItemStack item = inventory.getItem(i);
|
||||||
if (item != null && item.getType() != Material.AIR) {
|
if (item != null && item.getType() != Material.AIR) {
|
||||||
++itemsFound;
|
++itemsFound;
|
||||||
@@ -41,7 +41,7 @@ public class ItemUtil {
|
|||||||
return skull.clone();
|
return skull.clone();
|
||||||
} else {
|
} else {
|
||||||
skull = new ItemStack(XMaterial.PLAYER_HEAD.parseMaterial());
|
skull = new ItemStack(XMaterial.PLAYER_HEAD.parseMaterial());
|
||||||
SkullMeta sm = (SkullMeta)skull.getItemMeta();
|
SkullMeta sm = (SkullMeta) skull.getItemMeta();
|
||||||
sm.setOwner(name);
|
sm.setOwner(name);
|
||||||
skull.setItemMeta(sm);
|
skull.setItemMeta(sm);
|
||||||
cachedSkulls.put(name, skull.clone());
|
cachedSkulls.put(name, skull.clone());
|
||||||
|
|||||||
@@ -3,15 +3,14 @@ package com.massivecraft.factions.util;
|
|||||||
/**
|
/**
|
||||||
* @author Saser
|
* @author Saser
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.massivecraft.factions.cmd.audit.FactionLogs;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class JSONUtils {
|
public class JSONUtils {
|
||||||
public static Gson gson = (new GsonBuilder()).enableComplexMapKeySerialization().create();
|
public static Gson gson = (new GsonBuilder()).enableComplexMapKeySerialization().create();
|
||||||
@@ -94,7 +93,7 @@ public class JSONUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Type getTypeFromObject(Object object) {
|
private static Type getTypeFromObject(Object object) {
|
||||||
return object instanceof Type ? (Type)object : getTypeFromClass(object.getClass());
|
return object instanceof Type ? (Type) object : getTypeFromClass(object.getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Type getTypeFromClass(Class<?> clazz) {
|
private static Type getTypeFromClass(Class<?> clazz) {
|
||||||
|
|||||||
@@ -5,18 +5,17 @@ package com.massivecraft.factions.util;
|
|||||||
*/
|
*/
|
||||||
public class Pair<Left, Right> {
|
public class Pair<Left, Right> {
|
||||||
|
|
||||||
public static <Left, Right> Pair<Left, Right> of(Left left, Right right) {
|
|
||||||
return new Pair<>(left, right);
|
|
||||||
}
|
|
||||||
|
|
||||||
private final Left left;
|
private final Left left;
|
||||||
private final Right right;
|
private final Right right;
|
||||||
|
|
||||||
private Pair(Left left, Right right) {
|
private Pair(Left left, Right right) {
|
||||||
this.left = left;
|
this.left = left;
|
||||||
this.right = right;
|
this.right = right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <Left, Right> Pair<Left, Right> of(Left left, Right right) {
|
||||||
|
return new Pair<>(left, right);
|
||||||
|
}
|
||||||
|
|
||||||
public Left getLeft() {
|
public Left getLeft() {
|
||||||
return this.left;
|
return this.left;
|
||||||
}
|
}
|
||||||
|
|||||||
108
src/main/java/com/massivecraft/factions/util/TimeUtil.java
Normal file
108
src/main/java/com/massivecraft/factions/util/TimeUtil.java
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
package com.massivecraft.factions.util;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factions - Developed by Driftay.
|
||||||
|
* All rights reserved 2020.
|
||||||
|
* Creation Date: 1/30/2020
|
||||||
|
*/
|
||||||
|
public class TimeUtil {
|
||||||
|
|
||||||
|
public static long parseDateDiff(String time, boolean future) throws Exception {
|
||||||
|
Pattern timePattern = Pattern.compile("(?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)?", 2);
|
||||||
|
Matcher m = timePattern.matcher(time);
|
||||||
|
int years = 0;
|
||||||
|
int months = 0;
|
||||||
|
int weeks = 0;
|
||||||
|
int days = 0;
|
||||||
|
int hours = 0;
|
||||||
|
int minutes = 0;
|
||||||
|
int seconds = 0;
|
||||||
|
boolean found = false;
|
||||||
|
while (m.find()) {
|
||||||
|
if (m.group() != null) {
|
||||||
|
if (m.group().isEmpty()) continue;
|
||||||
|
for (int i = 0; i < m.groupCount(); ++i) {
|
||||||
|
if (m.group(i) != null && !m.group(i).isEmpty()) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) continue;
|
||||||
|
|
||||||
|
if (m.group(1) != null && !m.group(1).isEmpty()) years = Integer.parseInt(m.group(1));
|
||||||
|
|
||||||
|
if (m.group(2) != null && !m.group(2).isEmpty()) months = Integer.parseInt(m.group(2));
|
||||||
|
|
||||||
|
if (m.group(3) != null && !m.group(3).isEmpty()) weeks = Integer.parseInt(m.group(3));
|
||||||
|
|
||||||
|
if (m.group(4) != null && !m.group(4).isEmpty()) days = Integer.parseInt(m.group(4));
|
||||||
|
|
||||||
|
if (m.group(5) != null && !m.group(5).isEmpty()) hours = Integer.parseInt(m.group(5));
|
||||||
|
|
||||||
|
if (m.group(6) != null && !m.group(6).isEmpty()) minutes = Integer.parseInt(m.group(6));
|
||||||
|
|
||||||
|
if (m.group(7) != null && !m.group(7).isEmpty()) {
|
||||||
|
seconds = Integer.parseInt(m.group(7));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) throw new Exception("Illegal Date");
|
||||||
|
|
||||||
|
if (years > 20) throw new Exception("Illegal Date");
|
||||||
|
|
||||||
|
Calendar c = new GregorianCalendar();
|
||||||
|
if (years > 0) c.add(Calendar.YEAR, years * (future ? 1 : -1));
|
||||||
|
|
||||||
|
if (months > 0) c.add(Calendar.MONTH, months * (future ? 1 : -1));
|
||||||
|
|
||||||
|
if (weeks > 0) c.add(Calendar.WEEK_OF_YEAR, weeks * (future ? 1 : -1));
|
||||||
|
|
||||||
|
if (days > 0) c.add(Calendar.DATE, days * (future ? 1 : -1));
|
||||||
|
|
||||||
|
if (hours > 0) c.add(Calendar.HOUR_OF_DAY, hours * (future ? 1 : -1));
|
||||||
|
|
||||||
|
if (minutes > 0) c.add(Calendar.MINUTE, minutes * (future ? 1 : -1));
|
||||||
|
|
||||||
|
if (seconds > 0) c.add(Calendar.SECOND, seconds * (future ? 1 : -1));
|
||||||
|
|
||||||
|
System.out.println("current: " + c.getTimeInMillis() + " Time: " + System.currentTimeMillis() + " Form: " + formatTime(c.getTimeInMillis() / 1000L));
|
||||||
|
return c.getTimeInMillis() / 1000L;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String formatDifference(long time) {
|
||||||
|
if (time == 0L) return "Never";
|
||||||
|
|
||||||
|
long day = TimeUnit.SECONDS.toDays(time);
|
||||||
|
long hours = TimeUnit.SECONDS.toHours(time) - day * 24L;
|
||||||
|
long minutes = TimeUnit.SECONDS.toMinutes(time) - TimeUnit.SECONDS.toHours(time) * 60L;
|
||||||
|
long seconds = TimeUnit.SECONDS.toSeconds(time) - TimeUnit.SECONDS.toMinutes(time) * 60L;
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
if (day > 0L) sb.append(day).append((day == 1L) ? "day" : "days").append(" ");
|
||||||
|
|
||||||
|
if (hours > 0L) sb.append(hours).append((hours == 1L) ? "h" : "h").append(" ");
|
||||||
|
|
||||||
|
if (minutes > 0L) sb.append(minutes).append((minutes == 1L) ? "m" : "m").append(" ");
|
||||||
|
|
||||||
|
if (seconds > 0L) sb.append(seconds).append((seconds == 1L) ? "s" : "s");
|
||||||
|
|
||||||
|
String diff = sb.toString().trim();
|
||||||
|
return diff.isEmpty() ? "Now" : diff;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String formatTime(long time) {
|
||||||
|
if (time == System.currentTimeMillis()) return "Now";
|
||||||
|
|
||||||
|
if (time == -1L) return "Never";
|
||||||
|
|
||||||
|
return formatDifference(time - System.currentTimeMillis() / 1000L);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -10,6 +10,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class Updater {
|
public class Updater {
|
||||||
public static double currentVersion = 1.1;
|
public static double currentVersion = 1.1;
|
||||||
|
|
||||||
public static void updateIfNeeded(FileConfiguration conf) {
|
public static void updateIfNeeded(FileConfiguration conf) {
|
||||||
double version = conf.getDouble("Config-Version", 0);
|
double version = conf.getDouble("Config-Version", 0);
|
||||||
//Previous version
|
//Previous version
|
||||||
@@ -41,6 +42,8 @@ public class Updater {
|
|||||||
try {
|
try {
|
||||||
conf.save(new File("plugins/Factions/config.yml"));
|
conf.save(new File("plugins/Factions/config.yml"));
|
||||||
FactionsPlugin.getInstance().reloadConfig();
|
FactionsPlugin.getInstance().reloadConfig();
|
||||||
} catch (IOException e) {e.printStackTrace();}
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public class UtilFly {
|
|||||||
}
|
}
|
||||||
}, 0, FactionsPlugin.getInstance().getConfig().getInt("fly-task-interval", 10));
|
}, 0, FactionsPlugin.getInstance().getConfig().getInt("fly-task-interval", 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void setFly(FPlayer fp, boolean fly, boolean silent, boolean damage) {
|
public static void setFly(FPlayer fp, boolean fly, boolean silent, boolean damage) {
|
||||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight"))
|
if (!FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight"))
|
||||||
@@ -45,6 +46,7 @@ public class UtilFly {
|
|||||||
|
|
||||||
setFallDamage(fp, fly, damage);
|
setFallDamage(fp, fly, damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void checkFly(FPlayer me, Faction factionTo) {
|
public static void checkFly(FPlayer me, Faction factionTo) {
|
||||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight"))
|
if (!FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight"))
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@ package com.massivecraft.factions.util.serializable;
|
|||||||
/**
|
/**
|
||||||
* @author Saser
|
* @author Saser
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.massivecraft.factions.util.serializable;
|
|||||||
/**
|
/**
|
||||||
* @author Saser
|
* @author Saser
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
@@ -10,14 +11,12 @@ import com.massivecraft.factions.FactionsPlugin;
|
|||||||
import com.massivecraft.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.DyeColor;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.material.MaterialData;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -26,9 +25,9 @@ import java.util.UUID;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public abstract class GUIMenu {
|
public abstract class GUIMenu {
|
||||||
|
private static Map<UUID, GUIMenu> menus = new HashMap<>();
|
||||||
protected Inventory menu;
|
protected Inventory menu;
|
||||||
private Map<Integer, ClickableItemStack> menuItems = new HashMap<>();
|
private Map<Integer, ClickableItemStack> menuItems = new HashMap<>();
|
||||||
private static Map<UUID, GUIMenu> menus = new HashMap<>();
|
|
||||||
private Consumer<InventoryCloseEvent> closeCallback;
|
private Consumer<InventoryCloseEvent> closeCallback;
|
||||||
private String name;
|
private String name;
|
||||||
private int size;
|
private int size;
|
||||||
@@ -44,6 +43,14 @@ public abstract class GUIMenu {
|
|||||||
this.menu = Bukkit.createInventory(null, size, name);
|
this.menu = Bukkit.createInventory(null, size, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int fitSlots(int size) {
|
||||||
|
return size <= 9 ? 9 : (size <= 18 ? 18 : (size <= 27 ? 27 : (size <= 36 ? 36 : (size <= 45 ? 45 : (size <= 54 ? 54 : 54)))));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<UUID, GUIMenu> getMenus() {
|
||||||
|
return menus;
|
||||||
|
}
|
||||||
|
|
||||||
public void setInventorySize(int size) {
|
public void setInventorySize(int size) {
|
||||||
if (this.size != size) {
|
if (this.size != size) {
|
||||||
int oldSize = this.size;
|
int oldSize = this.size;
|
||||||
@@ -59,11 +66,6 @@ public abstract class GUIMenu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIMenu setPreviousMenu(GUIMenu menu) {
|
|
||||||
this.previousMenu = menu;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItem(int slot, ClickableItemStack item) {
|
public void setItem(int slot, ClickableItemStack item) {
|
||||||
this.menu.setItem(slot, item);
|
this.menu.setItem(slot, item);
|
||||||
this.menuItems.put(slot, item);
|
this.menuItems.put(slot, item);
|
||||||
@@ -82,9 +84,9 @@ public abstract class GUIMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ClickableItemStack getBackButton(Material data, String name, String... lore) {
|
public ClickableItemStack getBackButton(Material data, String name, String... lore) {
|
||||||
return (new ClickableItemStack(new ItemStack(data != null ? data : Material.RED_STAINED_GLASS_PANE, 1, data != null ? (short) 0 : 0 ))).setDisplayName(name != null ? name : ChatColor.RED + ChatColor.BOLD.toString() + "Back").setLore(lore != null ? Lists.newArrayList(lore) : Lists.newArrayList(ChatColor.GRAY + "Click to return to previous menu.")).setClickCallback((e) -> {
|
return (new ClickableItemStack(new ItemStack(data != null ? data : Material.RED_STAINED_GLASS_PANE, 1, data != null ? (short) 0 : 0))).setDisplayName(name != null ? name : ChatColor.RED + ChatColor.BOLD.toString() + "Back").setLore(lore != null ? Lists.newArrayList(lore) : Lists.newArrayList(ChatColor.GRAY + "Click to return to previous menu.")).setClickCallback((e) -> {
|
||||||
if (this.previousMenu != null) {
|
if (this.previousMenu != null) {
|
||||||
this.previousMenu.open((Player)e.getWhoClicked());
|
this.previousMenu.open((Player) e.getWhoClicked());
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -113,7 +115,7 @@ public abstract class GUIMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void fillEmpty(ClickableItemStack item) {
|
public void fillEmpty(ClickableItemStack item) {
|
||||||
for(int i = 0; i < this.menu.getSize(); ++i) {
|
for (int i = 0; i < this.menu.getSize(); ++i) {
|
||||||
ItemStack is = this.menu.getItem(i);
|
ItemStack is = this.menu.getItem(i);
|
||||||
if (is == null || is.getType() == Material.AIR) {
|
if (is == null || is.getType() == Material.AIR) {
|
||||||
this.setItem(i, item);
|
this.setItem(i, item);
|
||||||
@@ -122,18 +124,10 @@ public abstract class GUIMenu {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int fitSlots(int size) {
|
|
||||||
return size <= 9 ? 9 : (size <= 18 ? 18 : (size <= 27 ? 27 : (size <= 36 ? 36 : (size <= 45 ? 45 : (size <= 54 ? 54 : 54)))));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<Integer, ClickableItemStack> getMenuItems() {
|
public Map<Integer, ClickableItemStack> getMenuItems() {
|
||||||
return this.menuItems;
|
return this.menuItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<UUID, GUIMenu> getMenus() {
|
|
||||||
return menus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Consumer<InventoryCloseEvent> getCloseCallback() {
|
public Consumer<InventoryCloseEvent> getCloseCallback() {
|
||||||
return this.closeCallback;
|
return this.closeCallback;
|
||||||
}
|
}
|
||||||
@@ -153,4 +147,9 @@ public abstract class GUIMenu {
|
|||||||
public GUIMenu getPreviousMenu() {
|
public GUIMenu getPreviousMenu() {
|
||||||
return this.previousMenu;
|
return this.previousMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GUIMenu setPreviousMenu(GUIMenu menu) {
|
||||||
|
this.previousMenu = menu;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ public class InventoryItem {
|
|||||||
this.item = original;
|
this.item = original;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryItem(ItemBuilder original) { this(original.build()); }
|
public InventoryItem(ItemBuilder original) {
|
||||||
|
this(original.build());
|
||||||
|
}
|
||||||
|
|
||||||
public InventoryItem click(ClickType type, Runnable runnable) {
|
public InventoryItem click(ClickType type, Runnable runnable) {
|
||||||
this.clickMap.put(type, runnable);
|
this.clickMap.put(type, runnable);
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ public abstract class MPlugin extends JavaPlugin {
|
|||||||
Board.getInstance().forceSave();
|
Board.getInstance().forceSave();
|
||||||
}
|
}
|
||||||
log("Disabled");
|
log("Disabled");
|
||||||
} catch (IllegalPluginAccessException e){
|
} catch (IllegalPluginAccessException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ 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.util.XMaterial;
|
import com.massivecraft.factions.util.XMaterial;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
@@ -43,8 +45,22 @@ public class FDisbandFrame {
|
|||||||
fPlayer.getPlayer().performCommand("f disband");
|
fPlayer.getPlayer().performCommand("f disband");
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
//Separator
|
||||||
GUIItems.set(4, new GuiItem(XMaterial.BLACK_WOOL.parseItem(), (e) -> e.setCancelled(true)));
|
FileConfiguration config = FactionsPlugin.getInstance().getConfig();
|
||||||
|
ItemStack separatorItem = XMaterial.matchXMaterial(config.getString("f-disband-gui.separation-item.Type")).get().parseItem();
|
||||||
|
ItemMeta separatorMeta = separatorItem.getItemMeta();
|
||||||
|
separatorMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getString("f-disband-gui.separation-item.Name")));
|
||||||
|
List<String> separatorLore = config.getStringList("f-disband-gui.separation-item.Lore");
|
||||||
|
if (separatorMeta.getLore() != null) separatorMeta.getLore().clear();
|
||||||
|
if (separatorLore != null) {
|
||||||
|
List<String> lore = new ArrayList<>();
|
||||||
|
for (String loreEntry : config.getStringList("f-disband-gui.separation-item.Lore")) {
|
||||||
|
lore.add(ChatColor.translateAlternateColorCodes('&', loreEntry));
|
||||||
|
}
|
||||||
|
separatorMeta.setLore(lore);
|
||||||
|
}
|
||||||
|
GUIItems.set(4, new GuiItem(separatorItem, (e) -> e.setCancelled(true)));
|
||||||
|
//End Separator
|
||||||
|
|
||||||
for (i = 5; i < 10; ++i) {
|
for (i = 5; i < 10; ++i) {
|
||||||
GUIItems.add(new GuiItem(deny, (e) -> {
|
GUIItems.add(new GuiItem(deny, (e) -> {
|
||||||
@@ -61,7 +77,7 @@ public class FDisbandFrame {
|
|||||||
|
|
||||||
private ItemStack buildConfirmDummyItem(Faction faction) {
|
private ItemStack buildConfirmDummyItem(Faction faction) {
|
||||||
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("f-disband-gui.confirm-item");
|
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("f-disband-gui.confirm-item");
|
||||||
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem();
|
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
if (meta != null) {
|
if (meta != null) {
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
@@ -77,7 +93,7 @@ public class FDisbandFrame {
|
|||||||
|
|
||||||
private ItemStack buildDenyDummyItem() {
|
private ItemStack buildDenyDummyItem() {
|
||||||
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("f-disband-gui.deny-item");
|
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("f-disband-gui.deny-item");
|
||||||
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem();
|
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
if (meta != null) {
|
if (meta != null) {
|
||||||
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.massivecraft.factions.zcore.fperms;
|
package com.massivecraft.factions.zcore.fperms;
|
||||||
|
|
||||||
import com.massivecraft.factions.util.XMaterial;
|
|
||||||
|
|
||||||
public class DefaultPermissions {
|
public class DefaultPermissions {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public enum PermissableAction {
|
|||||||
|
|
||||||
public ItemStack buildAsset(FPlayer fme, Permissable perm) {
|
public ItemStack buildAsset(FPlayer fme, Permissable perm) {
|
||||||
ConfigurationSection section = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.action");
|
ConfigurationSection section = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.action");
|
||||||
ItemStack item = XMaterial.matchXMaterial(section.getString("Materials." + this.name)).parseItem();
|
ItemStack item = XMaterial.matchXMaterial(section.getString("Materials." + this.name)).get().parseItem();
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
|
||||||
meta.setDisplayName(FactionsPlugin.getInstance().color(section.getString("placeholder-item.name").replace("{action}", this.name)));
|
meta.setDisplayName(FactionsPlugin.getInstance().color(section.getString("placeholder-item.name").replace("{action}", this.name)));
|
||||||
|
|||||||
@@ -53,12 +53,12 @@ public class PermissableActionFrame {
|
|||||||
case LEFT:
|
case LEFT:
|
||||||
access = Access.ALLOW;
|
access = Access.ALLOW;
|
||||||
success = fplayer.getFaction().setPermission(perm, action, access);
|
success = fplayer.getFaction().setPermission(perm, action, access);
|
||||||
FactionsPlugin.instance.logFactionEvent(fplayer.getFaction(), FLogType.PERM_EDIT_DEFAULTS,fplayer.getName(), ChatColor.GREEN.toString() + ChatColor.BOLD + "ALLOWED", action.getName(), perm.name());
|
FactionsPlugin.instance.logFactionEvent(fplayer.getFaction(), FLogType.PERM_EDIT_DEFAULTS, fplayer.getName(), ChatColor.GREEN.toString() + ChatColor.BOLD + "ALLOWED", action.getName(), perm.name());
|
||||||
break;
|
break;
|
||||||
case RIGHT:
|
case RIGHT:
|
||||||
access = Access.DENY;
|
access = Access.DENY;
|
||||||
success = fplayer.getFaction().setPermission(perm, action, access);
|
success = fplayer.getFaction().setPermission(perm, action, access);
|
||||||
FactionsPlugin.instance.logFactionEvent(fplayer.getFaction(), FLogType.PERM_EDIT_DEFAULTS,fplayer.getName(), ChatColor.RED.toString() + ChatColor.BOLD + "DENIED", action.getName(), perm.name());
|
FactionsPlugin.instance.logFactionEvent(fplayer.getFaction(), FLogType.PERM_EDIT_DEFAULTS, fplayer.getName(), ChatColor.RED.toString() + ChatColor.BOLD + "DENIED", action.getName(), perm.name());
|
||||||
break;
|
break;
|
||||||
case MIDDLE:
|
case MIDDLE:
|
||||||
access = Access.UNDEFINED;
|
access = Access.UNDEFINED;
|
||||||
@@ -91,7 +91,7 @@ public class PermissableActionFrame {
|
|||||||
|
|
||||||
private ItemStack buildDummyItem() {
|
private ItemStack buildDummyItem() {
|
||||||
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.dummy-item");
|
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.dummy-item");
|
||||||
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem();
|
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
||||||
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));
|
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));
|
||||||
@@ -101,7 +101,7 @@ public class PermissableActionFrame {
|
|||||||
|
|
||||||
private ItemStack buildBackItem() {
|
private ItemStack buildBackItem() {
|
||||||
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.back-item");
|
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.back-item");
|
||||||
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem();
|
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
||||||
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));
|
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class PermissableRelationFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack buildAsset(String loc, String relation) {
|
private ItemStack buildAsset(String loc, String relation) {
|
||||||
ItemStack item = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString(loc)).parseItem();
|
ItemStack item = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString(loc)).get().parseItem();
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setDisplayName(FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fperm-gui.relation.Placeholder-Item.Name").replace("{relation}", relation)));
|
meta.setDisplayName(FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fperm-gui.relation.Placeholder-Item.Name").replace("{relation}", relation)));
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
@@ -65,7 +65,7 @@ public class PermissableRelationFrame {
|
|||||||
|
|
||||||
private ItemStack buildDummyItem() {
|
private ItemStack buildDummyItem() {
|
||||||
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.dummy-item");
|
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.dummy-item");
|
||||||
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem();
|
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
||||||
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));
|
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.massivecraft.factions.FPlayers;
|
|||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import com.massivecraft.factions.util.XMaterial;
|
import com.massivecraft.factions.util.XMaterial;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@@ -15,6 +16,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Saser
|
* @author Saser
|
||||||
@@ -25,8 +27,9 @@ public class FUpgradeFrame {
|
|||||||
|
|
||||||
public FUpgradeFrame(Faction f) {
|
public FUpgradeFrame(Faction f) {
|
||||||
this.gui = new Gui(FactionsPlugin.getInstance(),
|
this.gui = new Gui(FactionsPlugin.getInstance(),
|
||||||
FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.rows", 5),
|
FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Rows", 5),
|
||||||
FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Title").replace("{faction}", f.getTag()));
|
ChatColor.translateAlternateColorCodes('&', Objects.requireNonNull(FactionsPlugin.getInstance().getConfig()
|
||||||
|
.getString("fupgrades.MainMenu.Title")).replace("{faction}", f.getTag())));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildGUI(FPlayer fplayer) {
|
public void buildGUI(FPlayer fplayer) {
|
||||||
@@ -95,13 +98,13 @@ public class FUpgradeFrame {
|
|||||||
private void updateFactionPowerBoost(Faction f) {
|
private void updateFactionPowerBoost(Faction f) {
|
||||||
double boost = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.Power.Power-Boost.level-" + (f.getUpgrade(UpgradeType.POWER) + 1));
|
double boost = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.Power.Power-Boost.level-" + (f.getUpgrade(UpgradeType.POWER) + 1));
|
||||||
if (boost < 0.0) return;
|
if (boost < 0.0) return;
|
||||||
f.setPowerBoost(f.getPower() + boost);
|
f.setPowerBoost(boost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private ItemStack buildDummyItem() {
|
private ItemStack buildDummyItem() {
|
||||||
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fupgrades.MainMenu.DummyItem");
|
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fupgrades.MainMenu.DummyItem");
|
||||||
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem();
|
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
if (meta != null) {
|
if (meta != null) {
|
||||||
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public enum UpgradeType {
|
|||||||
|
|
||||||
public ItemStack buildAsset(Faction f) {
|
public ItemStack buildAsset(Faction f) {
|
||||||
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fupgrades.MainMenu." + this.id + ".DisplayItem");
|
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fupgrades.MainMenu." + this.id + ".DisplayItem");
|
||||||
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem();
|
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
||||||
int level = f.getUpgrade(this);
|
int level = f.getUpgrade(this);
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
if (meta != null) {
|
if (meta != null) {
|
||||||
|
|||||||
@@ -23,6 +23,63 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||||||
|
|
||||||
public class UpgradesListener implements Listener {
|
public class UpgradesListener implements Listener {
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public static void onDamageReduction(EntityDamageByEntityEvent e) {
|
||||||
|
if (e.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(e.getDamager() instanceof Player) || !(e.getEntity() instanceof Player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getEntity());
|
||||||
|
FPlayer dame = FPlayers.getInstance().getByPlayer((Player) e.getDamager());
|
||||||
|
if (fme == null || dame == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FLocation floc = new FLocation(fme.getPlayer().getLocation());
|
||||||
|
if (Board.getInstance().getFactionAt(floc) == fme.getFaction()) {
|
||||||
|
if (dame.getFaction() == fme.getFaction()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
double damage = e.getDamage();
|
||||||
|
int level = fme.getFaction().getUpgrade(UpgradeType.DAMAGEDECREASE);
|
||||||
|
double increase = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.DamageReduction.DamageReductionPercent.level-" + level);
|
||||||
|
e.setDamage(damage - damage / 100.0 * increase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public static void onDamageIncrease(EntityDamageByEntityEvent e) {
|
||||||
|
if (e == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(e.getDamager() instanceof Player) || !(e.getEntity() instanceof Player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.getDamager().hasMetadata("NPC") || e.getEntity().hasMetadata("NPC")) return;
|
||||||
|
|
||||||
|
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getEntity());
|
||||||
|
FPlayer dame = FPlayers.getInstance().getByPlayer((Player) e.getDamager());
|
||||||
|
if (fme == null || dame == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FLocation floc = new FLocation(fme.getPlayer().getLocation());
|
||||||
|
|
||||||
|
if (floc == null) return;
|
||||||
|
|
||||||
|
if (Board.getInstance().getFactionAt(floc) == fme.getFaction()) {
|
||||||
|
if (dame.getFaction() == fme.getFaction()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
double damage = e.getDamage();
|
||||||
|
int level = fme.getFaction().getUpgrade(UpgradeType.DAMAGEINCREASE);
|
||||||
|
double increase = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.DamageIncrease.DamageIncreasePercent.level-" + level);
|
||||||
|
e.setDamage(damage + damage / 100.0 * increase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Illyria Team
|
* @author Illyria Team
|
||||||
*/
|
*/
|
||||||
@@ -68,70 +125,44 @@ public class UpgradesListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onCropGrow( BlockGrowEvent e) {
|
public void onCropGrow(BlockGrowEvent e) {
|
||||||
FLocation floc = new FLocation(e.getBlock().getLocation());
|
FLocation floc = new FLocation(e.getBlock().getLocation());
|
||||||
Faction factionAtLoc = Board.getInstance().getFactionAt(floc);
|
Faction factionAtLoc = Board.getInstance().getFactionAt(floc);
|
||||||
if (!factionAtLoc.isWilderness()) {
|
if (!factionAtLoc.isWilderness()) {
|
||||||
int level = factionAtLoc.getUpgrade(UpgradeType.CROP);
|
int level = factionAtLoc.getUpgrade(UpgradeType.CROP);
|
||||||
int chance = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-" + level);
|
int chance = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-" + level);
|
||||||
if (level == 0 || chance == 0) {
|
if (level == 0 || chance == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int randomNum = ThreadLocalRandom.current().nextInt(1, 101);
|
int randomNum = ThreadLocalRandom.current().nextInt(1, 101);
|
||||||
if (randomNum <= chance) {
|
if (randomNum <= chance) {
|
||||||
this.growCrop(e);
|
this.growCrop(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void growCrop( BlockGrowEvent e) {
|
private void growCrop(BlockGrowEvent e) {
|
||||||
if (e.getBlock().getType().equals(XMaterial.WHEAT.parseMaterial())) {
|
if (e.getBlock().getType().equals(XMaterial.WHEAT.parseMaterial())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
Crops c = new Crops(CropState.RIPE);
|
Crops c = new Crops(CropState.RIPE);
|
||||||
BlockState bs = e.getBlock().getState();
|
BlockState bs = e.getBlock().getState();
|
||||||
bs.setData(c);
|
bs.setData(c);
|
||||||
bs.update();
|
bs.update();
|
||||||
}
|
}
|
||||||
Block below = e.getBlock().getLocation().subtract(0.0, 1.0, 0.0).getBlock();
|
Block below = e.getBlock().getLocation().subtract(0.0, 1.0, 0.0).getBlock();
|
||||||
if (below.getType() == XMaterial.SUGAR_CANE.parseMaterial()) {
|
if (below.getType() == XMaterial.SUGAR_CANE.parseMaterial()) {
|
||||||
Block above = e.getBlock().getLocation().add(0.0, 1.0, 0.0).getBlock();
|
Block above = e.getBlock().getLocation().add(0.0, 1.0, 0.0).getBlock();
|
||||||
if (above.getType() == Material.AIR && above.getLocation().add(0.0, -2.0, 0.0).getBlock().getType() != Material.AIR) {
|
if (above.getType() == Material.AIR && above.getLocation().add(0.0, -2.0, 0.0).getBlock().getType() != Material.AIR) {
|
||||||
above.setType(XMaterial.SUGAR_CANE.parseMaterial());
|
above.setType(XMaterial.SUGAR_CANE.parseMaterial());
|
||||||
}
|
}
|
||||||
}
|
} else if (below.getType() == Material.CACTUS) {
|
||||||
else if (below.getType() == Material.CACTUS) {
|
Block above = e.getBlock().getLocation().add(0.0, 1.0, 0.0).getBlock();
|
||||||
Block above = e.getBlock().getLocation().add(0.0, 1.0, 0.0).getBlock();
|
|
||||||
if (above.getType() == Material.AIR && above.getLocation().add(0.0, -2.0, 0.0).getBlock().getType() != Material.AIR) {
|
if (above.getType() == Material.AIR && above.getLocation().add(0.0, -2.0, 0.0).getBlock().getType() != Material.AIR) {
|
||||||
above.setType(Material.CACTUS);
|
above.setType(Material.CACTUS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public static void onDamageReduction(EntityDamageByEntityEvent e) {
|
|
||||||
if (e.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!(e.getDamager() instanceof Player) || !(e.getEntity() instanceof Player)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getEntity());
|
|
||||||
FPlayer dame = FPlayers.getInstance().getByPlayer((Player) e.getDamager());
|
|
||||||
if (fme == null || dame == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
FLocation floc = new FLocation(fme.getPlayer().getLocation());
|
|
||||||
if (Board.getInstance().getFactionAt(floc) == fme.getFaction()) {
|
|
||||||
if (dame.getFaction() == fme.getFaction()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
double damage = e.getDamage();
|
|
||||||
int level = fme.getFaction().getUpgrade(UpgradeType.DAMAGEDECREASE);
|
|
||||||
double increase = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.DamageReduction.DamageReductionPercent.level-" + level);
|
|
||||||
e.setDamage(damage - damage / 100.0 * increase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onWaterRedstone(BlockFromToEvent e) {
|
public void onWaterRedstone(BlockFromToEvent e) {
|
||||||
List<String> unbreakable = FactionsPlugin.getInstance().getConfig().getStringList("no-water-destroy.Item-List");
|
List<String> unbreakable = FactionsPlugin.getInstance().getConfig().getStringList("no-water-destroy.Item-List");
|
||||||
@@ -152,37 +183,6 @@ public class UpgradesListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public static void onDamageIncrease(EntityDamageByEntityEvent e) {
|
|
||||||
if (e == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!(e.getDamager() instanceof Player) || !(e.getEntity() instanceof Player)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(e.getDamager().hasMetadata("NPC") || e.getEntity().hasMetadata("NPC")) return;
|
|
||||||
|
|
||||||
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getEntity());
|
|
||||||
FPlayer dame = FPlayers.getInstance().getByPlayer((Player) e.getDamager());
|
|
||||||
if (fme == null || dame == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FLocation floc = new FLocation(fme.getPlayer().getLocation());
|
|
||||||
|
|
||||||
if(floc == null) return;
|
|
||||||
|
|
||||||
if (Board.getInstance().getFactionAt(floc) == fme.getFaction()) {
|
|
||||||
if (dame.getFaction() == fme.getFaction()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
double damage = e.getDamage();
|
|
||||||
int level = fme.getFaction().getUpgrade(UpgradeType.DAMAGEINCREASE);
|
|
||||||
double increase = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.DamageIncrease.DamageIncreasePercent.level-" + level);
|
|
||||||
e.setDamage(damage + damage / 100.0 * increase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onArmorDamage(PlayerItemDamageEvent e) {
|
public void onArmorDamage(PlayerItemDamageEvent e) {
|
||||||
if (FPlayers.getInstance().getByPlayer(e.getPlayer()) == null) {
|
if (FPlayers.getInstance().getByPlayer(e.getPlayer()) == null) {
|
||||||
|
|||||||
@@ -236,8 +236,10 @@ public abstract class MemoryBoard extends Board {
|
|||||||
row.then("-").color(Conf.colorWilderness);
|
row.then("-").color(Conf.colorWilderness);
|
||||||
// Lol someone didnt add the x and z making it claim the wrong position Can i copyright this xD
|
// Lol someone didnt add the x and z making it claim the wrong position Can i copyright this xD
|
||||||
if (fplayer.getPlayer().hasPermission(Permission.CLAIMAT.node)) {
|
if (fplayer.getPlayer().hasPermission(Permission.CLAIMAT.node)) {
|
||||||
row.tooltip(TL.CLAIM_CLICK_TO_CLAIM.format(dx + topLeft.getX(), dz + topLeft.getZ()))
|
if (Conf.enableClickToClaim) {
|
||||||
.command(String.format("/f claimat %s %d %d", flocation.getWorldName(), dx + topLeft.getX(), dz + topLeft.getZ()));
|
row.tooltip(TL.CLAIM_CLICK_TO_CLAIM.format(dx + topLeft.getX(), dz + topLeft.getZ()))
|
||||||
|
.command(String.format("/f claimat %s %d %d", flocation.getWorldName(), dx + topLeft.getX(), dz + topLeft.getZ()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (factionHere.isSafeZone()) {
|
} else if (factionHere.isSafeZone()) {
|
||||||
row.then("+").color(Conf.colorSafezone).tooltip(oneLineToolTip(factionHere, fplayer));
|
row.then("+").color(Conf.colorSafezone).tooltip(oneLineToolTip(factionHere, fplayer));
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
oldFaction.removeFPlayer(this);
|
oldFaction.removeFPlayer(this);
|
||||||
}
|
}
|
||||||
if (alt) faction.addAltPlayer(this);
|
if (alt) faction.addAltPlayer(this);
|
||||||
else faction.addFPlayer(this);
|
else faction.addFPlayer(this);
|
||||||
this.factionId = faction.getId();
|
this.factionId = faction.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,17 +222,29 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
return this.notificationsEnabled;
|
return this.notificationsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasEnemiesNearby() {return this.enemiesNearby;}
|
public boolean hasEnemiesNearby() {
|
||||||
|
return this.enemiesNearby;
|
||||||
|
}
|
||||||
|
|
||||||
public void setEnemiesNearby(Boolean b) {this.enemiesNearby = b;}
|
public void setEnemiesNearby(Boolean b) {
|
||||||
|
this.enemiesNearby = b;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean discordSetup() {return this.discordSetup;}
|
public boolean discordSetup() {
|
||||||
|
return this.discordSetup;
|
||||||
|
}
|
||||||
|
|
||||||
public String discordUserID() {return this.discordUserID;}
|
public String discordUserID() {
|
||||||
|
return this.discordUserID;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDiscordSetup(Boolean b) {this.discordSetup = b;}
|
public void setDiscordSetup(Boolean b) {
|
||||||
|
this.discordSetup = b;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDiscordUserID(String s) {this.discordUserID = s;}
|
public void setDiscordUserID(String s) {
|
||||||
|
this.discordUserID = s;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasTitlesEnabled() {
|
public boolean hasTitlesEnabled() {
|
||||||
return this.titlesEnabled;
|
return this.titlesEnabled;
|
||||||
@@ -242,7 +254,9 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
this.titlesEnabled = b;
|
this.titlesEnabled = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User discordUser() {return Discord.jda.getUserById(this.discordUserID);}
|
public User discordUser() {
|
||||||
|
return Discord.jda.getUserById(this.discordUserID);
|
||||||
|
}
|
||||||
|
|
||||||
public String getFactionId() {
|
public String getFactionId() {
|
||||||
return this.factionId;
|
return this.factionId;
|
||||||
@@ -288,7 +302,9 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
} else {
|
} else {
|
||||||
this.role = event.getTo();
|
this.role = event.getTo();
|
||||||
}
|
}
|
||||||
} catch (HierarchyException e) {System.out.print(e.getMessage());}
|
} catch (HierarchyException e) {
|
||||||
|
System.out.print(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,7 +353,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
public void setIsAutoSafeClaimEnabled(boolean enabled) {
|
public void setIsAutoSafeClaimEnabled(boolean enabled) {
|
||||||
this.autoSafeZoneEnabled = enabled;
|
this.autoSafeZoneEnabled = enabled;
|
||||||
if (enabled) this.autoClaimFor = null;
|
if (enabled) this.autoClaimFor = null;
|
||||||
this.autoWarZoneEnabled = false;
|
this.autoWarZoneEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAutoWarClaimEnabled() {
|
public boolean isAutoWarClaimEnabled() {
|
||||||
@@ -347,7 +363,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
public void setIsAutoWarClaimEnabled(boolean enabled) {
|
public void setIsAutoWarClaimEnabled(boolean enabled) {
|
||||||
this.autoWarZoneEnabled = enabled;
|
this.autoWarZoneEnabled = enabled;
|
||||||
if (enabled) this.autoClaimFor = null;
|
if (enabled) this.autoClaimFor = null;
|
||||||
this.autoSafeZoneEnabled = false;
|
this.autoSafeZoneEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAdminBypassing() {
|
public boolean isAdminBypassing() {
|
||||||
@@ -404,11 +420,15 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
try {
|
try {
|
||||||
if (Discord.useDiscord && this.discordSetup() && Discord.isInMainGuild(this.discordUser()) && Discord.mainGuild != null) {
|
if (Discord.useDiscord && this.discordSetup() && Discord.isInMainGuild(this.discordUser()) && Discord.mainGuild != null) {
|
||||||
Member m = Discord.mainGuild.getMember(this.discordUser());
|
Member m = Discord.mainGuild.getMember(this.discordUser());
|
||||||
if (Conf.leaderRoles && this.role == Role.LEADER && Discord.leader != null) Discord.mainGuild.getController().removeSingleRoleFromMember(m, Discord.leader).queue();
|
if (Conf.leaderRoles && this.role == Role.LEADER && Discord.leader != null)
|
||||||
if (Conf.factionRoles) Discord.mainGuild.getController().removeSingleRoleFromMember(m, Objects.requireNonNull(Discord.createFactionRole(this.getFaction().getTag()))).queue();
|
Discord.mainGuild.getController().removeSingleRoleFromMember(m, Discord.leader).queue();
|
||||||
|
if (Conf.factionRoles)
|
||||||
|
Discord.mainGuild.getController().removeSingleRoleFromMember(m, Objects.requireNonNull(Discord.createFactionRole(this.getFaction().getTag()))).queue();
|
||||||
if (Conf.factionDiscordTags) Discord.resetNick(this);
|
if (Conf.factionDiscordTags) Discord.resetNick(this);
|
||||||
}
|
}
|
||||||
} catch (HierarchyException e) {System.out.print(e.getMessage());}
|
} catch (HierarchyException e) {
|
||||||
|
System.out.print(e.getMessage());
|
||||||
|
}
|
||||||
//End Discord
|
//End Discord
|
||||||
currentFaction.removeFPlayer(this);
|
currentFaction.removeFPlayer(this);
|
||||||
if (currentFaction.isNormal()) currentFaction.clearClaimOwnership(this);
|
if (currentFaction.isNormal()) currentFaction.clearClaimOwnership(this);
|
||||||
@@ -475,7 +495,8 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
|
|
||||||
public void setTitle(CommandSender sender, String title) {
|
public void setTitle(CommandSender sender, String title) {
|
||||||
// Check if the setter has it.
|
// Check if the setter has it.
|
||||||
if (sender.hasPermission(Permission.TITLE_COLOR.node)) title = ChatColor.translateAlternateColorCodes('&', title);
|
if (sender.hasPermission(Permission.TITLE_COLOR.node))
|
||||||
|
title = ChatColor.translateAlternateColorCodes('&', title);
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -604,7 +625,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
this.power += delta;
|
this.power += delta;
|
||||||
if (this.power > this.getPowerMax())
|
if (this.power > this.getPowerMax())
|
||||||
this.power = this.getPowerMax();
|
this.power = this.getPowerMax();
|
||||||
else if (this.power < this.getPowerMin())
|
else if (this.power < this.getPowerMin())
|
||||||
this.power = this.getPowerMin();
|
this.power = this.getPowerMin();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -627,9 +648,11 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
public int getPowerMinRounded() {
|
public int getPowerMinRounded() {
|
||||||
return (int) Math.round(this.getPowerMin());
|
return (int) Math.round(this.getPowerMin());
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getMillisPassed() {
|
public long getMillisPassed() {
|
||||||
return this.millisPassed;
|
return this.millisPassed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getLastPowerUpdateTime() {
|
public long getLastPowerUpdateTime() {
|
||||||
return this.lastPowerUpdateTime;
|
return this.lastPowerUpdateTime;
|
||||||
}
|
}
|
||||||
@@ -647,13 +670,15 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
this.lastPowerUpdateTime = now;
|
this.lastPowerUpdateTime = now;
|
||||||
|
|
||||||
Player thisPlayer = this.getPlayer();
|
Player thisPlayer = this.getPlayer();
|
||||||
if (thisPlayer != null && thisPlayer.isDead()) return; // don't let dead players regain power until they respawn
|
if (thisPlayer != null && thisPlayer.isDead())
|
||||||
|
return; // don't let dead players regain power until they respawn
|
||||||
PowerRegenEvent powerRegenEvent = new PowerRegenEvent(getFaction(), this);
|
PowerRegenEvent powerRegenEvent = new PowerRegenEvent(getFaction(), this);
|
||||||
Bukkit.getScheduler().runTask(FactionsPlugin.getInstance(), () -> Bukkit.getServer().getPluginManager().callEvent(powerRegenEvent));
|
Bukkit.getScheduler().runTask(FactionsPlugin.getInstance(), () -> Bukkit.getServer().getPluginManager().callEvent(powerRegenEvent));
|
||||||
|
|
||||||
if (!powerRegenEvent.isCancelled())
|
if (!powerRegenEvent.isCancelled())
|
||||||
if (!powerRegenEvent.usingCustomPower()) this.alterPower(millisPassed * Conf.powerPerMinute / 60000); // millisPerMinute : 60 * 1000
|
if (!powerRegenEvent.usingCustomPower())
|
||||||
else this.alterPower(+powerRegenEvent.getCustomPower());
|
this.alterPower(millisPassed * Conf.powerPerMinute / 60000); // millisPerMinute : 60 * 1000
|
||||||
|
else this.alterPower(+powerRegenEvent.getCustomPower());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void losePowerFromBeingOffline() {
|
public void losePowerFromBeingOffline() {
|
||||||
@@ -705,7 +730,8 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
FScoreboard.get(this).setTemporarySidebar(new FInfoSidebar(toShow));
|
FScoreboard.get(this).setTemporarySidebar(new FInfoSidebar(toShow));
|
||||||
showChat = FactionsPlugin.getInstance().getConfig().getBoolean("scoreboard.also-send-chat", true);
|
showChat = FactionsPlugin.getInstance().getConfig().getBoolean("scoreboard.also-send-chat", true);
|
||||||
}
|
}
|
||||||
if (showChat) this.sendMessage(FactionsPlugin.getInstance().txt.parse(TL.FACTION_LEAVE.format(from.getTag(this), toShow.getTag(this))));
|
if (showChat)
|
||||||
|
this.sendMessage(FactionsPlugin.getInstance().txt.parse(TL.FACTION_LEAVE.format(from.getTag(this), toShow.getTag(this))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
@@ -767,7 +793,8 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
// Am I the last one in the faction?
|
// Am I the last one in the faction?
|
||||||
if (myFaction.getFPlayers().size() == 1) {
|
if (myFaction.getFPlayers().size() == 1) {
|
||||||
// Transfer all money
|
// Transfer all money
|
||||||
if (Econ.shouldBeUsed()) Econ.transferMoney(this, myFaction, this, Econ.getBalance(myFaction.getAccountId()));
|
if (Econ.shouldBeUsed())
|
||||||
|
Econ.transferMoney(this, myFaction, this, Econ.getBalance(myFaction.getAccountId()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -795,7 +822,8 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
Bukkit.getPluginManager().callEvent(disbandEvent);
|
Bukkit.getPluginManager().callEvent(disbandEvent);
|
||||||
|
|
||||||
Factions.getInstance().removeFaction(myFaction.getId());
|
Factions.getInstance().removeFaction(myFaction.getId());
|
||||||
if (Conf.logFactionDisband) FactionsPlugin.getInstance().log(TL.LEAVE_DISBANDEDLOG.format(myFaction.getTag(), myFaction.getId(), this.getName()));
|
if (Conf.logFactionDisband)
|
||||||
|
FactionsPlugin.getInstance().log(TL.LEAVE_DISBANDEDLOG.format(myFaction.getTag(), myFaction.getId(), this.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -927,6 +955,9 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setFFlying(boolean fly, boolean damage) {
|
public void setFFlying(boolean fly, boolean damage) {
|
||||||
|
if (!FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight"))
|
||||||
|
return;
|
||||||
|
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
|
|
||||||
@@ -935,7 +966,8 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
|
|
||||||
if (!damage) {
|
if (!damage) {
|
||||||
msg(TL.COMMAND_FLY_CHANGE, fly ? "enabled" : "disabled");
|
msg(TL.COMMAND_FLY_CHANGE, fly ? "enabled" : "disabled");
|
||||||
if (!fly) sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3) + ""));
|
if (!fly)
|
||||||
|
sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3) + ""));
|
||||||
} else {
|
} else {
|
||||||
msg(TL.COMMAND_FLY_DAMAGE);
|
msg(TL.COMMAND_FLY_DAMAGE);
|
||||||
}
|
}
|
||||||
@@ -959,9 +991,11 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
public boolean isInFactionsChest() {
|
public boolean isInFactionsChest() {
|
||||||
return inChest;
|
return inChest;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInFactionsChest(boolean b) {
|
public void setInFactionsChest(boolean b) {
|
||||||
inChest = b;
|
inChest = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInVault() {
|
public boolean isInVault() {
|
||||||
return inVault;
|
return inVault;
|
||||||
}
|
}
|
||||||
@@ -1224,7 +1258,8 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
|
|
||||||
|
|
||||||
Board.getInstance().setFactionAt(forFaction, flocation);
|
Board.getInstance().setFactionAt(forFaction, flocation);
|
||||||
if (Conf.logLandClaims) FactionsPlugin.getInstance().log(TL.CLAIM_CLAIMEDLOG.toString(), this.getName(), flocation.getCoordString(), forFaction.getTag());
|
if (Conf.logLandClaims)
|
||||||
|
FactionsPlugin.getInstance().log(TL.CLAIM_CLAIMEDLOG.toString(), this.getName(), flocation.getCoordString(), forFaction.getTag());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
protected Map<Permissable, Map<PermissableAction, Access>> permissions = new HashMap<>();
|
protected Map<Permissable, Map<PermissableAction, Access>> permissions = new HashMap<>();
|
||||||
protected Set<BanInfo> bans = new HashSet<>();
|
protected Set<BanInfo> bans = new HashSet<>();
|
||||||
protected String player;
|
protected String player;
|
||||||
|
protected String discord;
|
||||||
Inventory chest;
|
Inventory chest;
|
||||||
Map<String, Object> bannerSerialized;
|
Map<String, Object> bannerSerialized;
|
||||||
private long lastDeath;
|
private long lastDeath;
|
||||||
@@ -86,7 +87,6 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
private int warpLimit;
|
private int warpLimit;
|
||||||
private double reinforcedArmor;
|
private double reinforcedArmor;
|
||||||
private List<String> completedMissions;
|
private List<String> completedMissions;
|
||||||
protected String discord;
|
|
||||||
private String factionChatChannelId;
|
private String factionChatChannelId;
|
||||||
private String wallNotifyChannelId;
|
private String wallNotifyChannelId;
|
||||||
private String bufferNotifyChannelId;
|
private String bufferNotifyChannelId;
|
||||||
@@ -340,8 +340,8 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
|
|
||||||
boolean disbanderIsConsole = disbander == null;
|
boolean disbanderIsConsole = disbander == null;
|
||||||
FPlayer fdisbander = null;
|
FPlayer fdisbander = null;
|
||||||
if(!disbanderIsConsole){
|
if (!disbanderIsConsole) {
|
||||||
fdisbander= FPlayers.getInstance().getByOfflinePlayer(disbander);
|
fdisbander = FPlayers.getInstance().getByOfflinePlayer(disbander);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -376,7 +376,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
if (Econ.shouldBeUsed() && !disbanderIsConsole) {
|
if (Econ.shouldBeUsed() && !disbanderIsConsole) {
|
||||||
// Should we prevent to withdraw money if the faction was just created
|
// Should we prevent to withdraw money if the faction was just created
|
||||||
if (Conf.econFactionStartingBalance != 0 && (System.currentTimeMillis() - this.foundedDate) <= (Conf.econDenyWithdrawWhenMinutesAgeLessThan * 6000)) {
|
if (Conf.econFactionStartingBalance != 0 && (System.currentTimeMillis() - this.foundedDate) <= (Conf.econDenyWithdrawWhenMinutesAgeLessThan * 6000)) {
|
||||||
msg("Your faction is too young to withdraw money like this");
|
msg(TL.COMMAND_DISBAND_TOO_YOUNG);
|
||||||
} else {
|
} else {
|
||||||
//Give all the faction's money to the disbander
|
//Give all the faction's money to the disbander
|
||||||
double amount = Econ.getBalance(this.getAccountId());
|
double amount = Econ.getBalance(this.getAccountId());
|
||||||
@@ -529,10 +529,14 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getReinforcedArmor() { return this.reinforcedArmor; }
|
public double getReinforcedArmor() {
|
||||||
|
return this.reinforcedArmor;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setReinforcedArmor(double newPercent) { reinforcedArmor = newPercent; }
|
public void setReinforcedArmor(double newPercent) {
|
||||||
|
reinforcedArmor = newPercent;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getBanner() {
|
public ItemStack getBanner() {
|
||||||
@@ -589,11 +593,21 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
return this.memberRoleId;
|
return this.memberRoleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMemberRoleId(String memberRoleId) {
|
||||||
|
this.memberRoleId = memberRoleId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFactionChatChannelId() {
|
public String getFactionChatChannelId() {
|
||||||
return this.factionChatChannelId;
|
return this.factionChatChannelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFactionChatChannelId(String factionChatChannelId) {
|
||||||
|
this.factionChatChannelId = factionChatChannelId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getWallNotifyChannelId() {
|
public String getWallNotifyChannelId() {
|
||||||
return this.wallNotifyChannelId;
|
return this.wallNotifyChannelId;
|
||||||
@@ -644,16 +658,6 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
this.weeWooFormat = weeWooFormat;
|
this.weeWooFormat = weeWooFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFactionChatChannelId(String factionChatChannelId) {
|
|
||||||
this.factionChatChannelId = factionChatChannelId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMemberRoleId(String memberRoleId) {
|
|
||||||
this.memberRoleId = memberRoleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isWeeWoo() {
|
public boolean isWeeWoo() {
|
||||||
return this.weeWoo;
|
return this.weeWoo;
|
||||||
}
|
}
|
||||||
@@ -718,12 +722,6 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
return this.tag;
|
return this.tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkPerms() {
|
|
||||||
if (this.permissions == null || this.permissions.isEmpty()) {
|
|
||||||
this.resetPerms();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTag(String str) {
|
public void setTag(String str) {
|
||||||
if (Conf.factionTagForceUpperCase) {
|
if (Conf.factionTagForceUpperCase) {
|
||||||
str = str.toUpperCase();
|
str = str.toUpperCase();
|
||||||
@@ -731,6 +729,12 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
this.tag = str;
|
this.tag = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkPerms() {
|
||||||
|
if (this.permissions == null || this.permissions.isEmpty()) {
|
||||||
|
this.resetPerms();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getTag(String prefix) {
|
public String getTag(String prefix) {
|
||||||
return prefix + this.tag;
|
return prefix + this.tag;
|
||||||
}
|
}
|
||||||
@@ -774,6 +778,11 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
this.home = new LazyLocation(home);
|
this.home = new LazyLocation(home);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void deleteHome() {
|
||||||
|
this.home = null;
|
||||||
|
}
|
||||||
|
|
||||||
public long getFoundedDate() {
|
public long getFoundedDate() {
|
||||||
if (this.foundedDate == 0) {
|
if (this.foundedDate == 0) {
|
||||||
setFoundedDate(System.currentTimeMillis());
|
setFoundedDate(System.currentTimeMillis());
|
||||||
@@ -1329,7 +1338,9 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletedMissions() {return this.completedMissions;}
|
public List<String> getCompletedMissions() {
|
||||||
|
return this.completedMissions;
|
||||||
|
}
|
||||||
|
|
||||||
public void clearAllClaimOwnership() {
|
public void clearAllClaimOwnership() {
|
||||||
claimOwnership.clear();
|
claimOwnership.clear();
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ public abstract class MemoryFactions extends Factions {
|
|||||||
} else {
|
} else {
|
||||||
Faction faction = factions.get("0");
|
Faction faction = factions.get("0");
|
||||||
if (!faction.getTag().equalsIgnoreCase(TL.WILDERNESS.toString())) faction.setTag(TL.WILDERNESS.toString());
|
if (!faction.getTag().equalsIgnoreCase(TL.WILDERNESS.toString())) faction.setTag(TL.WILDERNESS.toString());
|
||||||
if (!faction.getDescription().equalsIgnoreCase(TL.WILDERNESS_DESCRIPTION.toString())) faction.setDescription(TL.WILDERNESS_DESCRIPTION.toString());
|
if (!faction.getDescription().equalsIgnoreCase(TL.WILDERNESS_DESCRIPTION.toString()))
|
||||||
|
faction.setDescription(TL.WILDERNESS_DESCRIPTION.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the safe zone faction exists
|
// Make sure the safe zone faction exists
|
||||||
@@ -38,7 +39,8 @@ public abstract class MemoryFactions extends Factions {
|
|||||||
} else {
|
} else {
|
||||||
Faction faction = factions.get("-1");
|
Faction faction = factions.get("-1");
|
||||||
if (!faction.getTag().equalsIgnoreCase(TL.SAFEZONE.toString())) faction.setTag(TL.SAFEZONE.toString());
|
if (!faction.getTag().equalsIgnoreCase(TL.SAFEZONE.toString())) faction.setTag(TL.SAFEZONE.toString());
|
||||||
if (!faction.getDescription().equalsIgnoreCase(TL.SAFEZONE_DESCRIPTION.toString())) faction.setDescription(TL.SAFEZONE_DESCRIPTION.toString());
|
if (!faction.getDescription().equalsIgnoreCase(TL.SAFEZONE_DESCRIPTION.toString()))
|
||||||
|
faction.setDescription(TL.SAFEZONE_DESCRIPTION.toString());
|
||||||
// if SafeZone has old pre-1.6.0 name, rename it to remove troublesome " "
|
// if SafeZone has old pre-1.6.0 name, rename it to remove troublesome " "
|
||||||
if (faction.getTag().contains(" ")) faction.setTag(TL.SAFEZONE.toString());
|
if (faction.getTag().contains(" ")) faction.setTag(TL.SAFEZONE.toString());
|
||||||
}
|
}
|
||||||
@@ -52,7 +54,8 @@ public abstract class MemoryFactions extends Factions {
|
|||||||
} else {
|
} else {
|
||||||
Faction faction = factions.get("-2");
|
Faction faction = factions.get("-2");
|
||||||
if (!faction.getTag().equalsIgnoreCase(TL.WARZONE.toString())) faction.setTag(TL.WARZONE.toString());
|
if (!faction.getTag().equalsIgnoreCase(TL.WARZONE.toString())) faction.setTag(TL.WARZONE.toString());
|
||||||
if (!faction.getDescription().equalsIgnoreCase(TL.WARZONE_DESCRIPTION.toString())) faction.setDescription(TL.WARZONE_DESCRIPTION.toString());
|
if (!faction.getDescription().equalsIgnoreCase(TL.WARZONE_DESCRIPTION.toString()))
|
||||||
|
faction.setDescription(TL.WARZONE_DESCRIPTION.toString());
|
||||||
// if WarZone has old pre-1.6.0 name, rename it to remove troublesome " "
|
// if WarZone has old pre-1.6.0 name, rename it to remove troublesome " "
|
||||||
if (faction.getTag().contains(" ")) faction.setTag(TL.WARZONE.toString());
|
if (faction.getTag().contains(" ")) faction.setTag(TL.WARZONE.toString());
|
||||||
}
|
}
|
||||||
@@ -89,7 +92,7 @@ public abstract class MemoryFactions extends Factions {
|
|||||||
|
|
||||||
if (lendiff < best || best == 0)
|
if (lendiff < best || best == 0)
|
||||||
best = lendiff;
|
best = lendiff;
|
||||||
bestMatch = faction;
|
bestMatch = faction;
|
||||||
}
|
}
|
||||||
return bestMatch;
|
return bestMatch;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.massivecraft.factions.zcore.persist.json;
|
package com.massivecraft.factions.zcore.persist.json;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class PermUtil {
|
|||||||
public boolean has(CommandSender me, String perm, boolean informSenderIfNot) {
|
public boolean has(CommandSender me, String perm, boolean informSenderIfNot) {
|
||||||
if (has(me, perm))
|
if (has(me, perm))
|
||||||
return true;
|
return true;
|
||||||
else if (informSenderIfNot && me != null)
|
else if (informSenderIfNot && me != null)
|
||||||
me.sendMessage(this.getForbiddenMessage(perm));
|
me.sendMessage(this.getForbiddenMessage(perm));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -242,6 +242,14 @@ public enum TL {
|
|||||||
COMMAND_CLAIM_DENIED("&c&l[!]&7 You &cdo not &7have &cpermission&7 to &cclaim&7 in a radius."),
|
COMMAND_CLAIM_DENIED("&c&l[!]&7 You &cdo not &7have &cpermission&7 to &cclaim&7 in a radius."),
|
||||||
COMMAND_CLAIM_DESCRIPTION("Claim land from where you are standing"),
|
COMMAND_CLAIM_DESCRIPTION("Claim land from where you are standing"),
|
||||||
|
|
||||||
|
COMMAND_CLAIMFILL_DESCRIPTION("Claim land filling in a gap in claims"),
|
||||||
|
COMMAND_CLAIMFILL_ABOVEMAX("&cThe maximum limit for claim fill is %s."),
|
||||||
|
COMMAND_CLAIMFILL_ALREADYCLAIMED("&cCannot claim fill using already claimed land!"),
|
||||||
|
COMMAND_CLAIMFILL_TOOFAR("&cThis fill would exceed the maximum distance of %.2f"),
|
||||||
|
COMMAND_CLAIMFILL_PASTLIMIT("&cThis claim would exceed the limit!"),
|
||||||
|
COMMAND_CLAIMFILL_NOTENOUGHLANDLEFT("%s &cdoes not have enough land left to make %d claims"),
|
||||||
|
COMMAND_CLAIMFILL_TOOMUCHFAIL("&cAborting claim fill after %d failures"),
|
||||||
|
|
||||||
COMMAND_CLAIMLINE_INVALIDRADIUS("&c&l[!]&7 If you &cspecify&7 a distance, it must be at least &c1&7."),
|
COMMAND_CLAIMLINE_INVALIDRADIUS("&c&l[!]&7 If you &cspecify&7 a distance, it must be at least &c1&7."),
|
||||||
COMMAND_CLAIMLINE_DENIED("&c&l[!]&7 You &cdo not &7have&c permission&7 to claim in a line."),
|
COMMAND_CLAIMLINE_DENIED("&c&l[!]&7 You &cdo not &7have&c permission&7 to claim in a line."),
|
||||||
COMMAND_CLAIMLINE_DESCRIPTION("Claim land in a straight line."),
|
COMMAND_CLAIMLINE_DESCRIPTION("Claim land in a straight line."),
|
||||||
@@ -298,6 +306,11 @@ public enum TL {
|
|||||||
COMMAND_CREATE_CREATEDLOG(" created a new faction: "),
|
COMMAND_CREATE_CREATEDLOG(" created a new faction: "),
|
||||||
COMMAND_CREATE_DESCRIPTION("Create a new faction"),
|
COMMAND_CREATE_DESCRIPTION("Create a new faction"),
|
||||||
|
|
||||||
|
|
||||||
|
COMMAND_DELHOME_SUCCESS("%1$s has deleted your faction home"),
|
||||||
|
COMMAND_DELHOME_DESCRIPTION("delete home of your faction"),
|
||||||
|
|
||||||
|
|
||||||
COMMAND_CHECK_DESCRIPTION("manage your factions check system!"),
|
COMMAND_CHECK_DESCRIPTION("manage your factions check system!"),
|
||||||
CHECK_BUFFERS_CHECK("\n &c&lFaction Walls&7 » &bCheck Your Buffers! \n"),
|
CHECK_BUFFERS_CHECK("\n &c&lFaction Walls&7 » &bCheck Your Buffers! \n"),
|
||||||
CHECK_WALLS_CHECK("\n &c&lFaction Walls&7 » &bCheck Your Walls! \n"),
|
CHECK_WALLS_CHECK("\n &c&lFaction Walls&7 » &bCheck Your Walls! \n"),
|
||||||
@@ -377,6 +390,7 @@ public enum TL {
|
|||||||
COMMAND_DESCRIPTION_DESCRIPTION("Change the faction description"),
|
COMMAND_DESCRIPTION_DESCRIPTION("Change the faction description"),
|
||||||
|
|
||||||
COMMAND_DISBAND_IMMUTABLE("&c&l[!]&7 &7You &ccannot&7 disband &2Wilderness&7,&e SafeZone&7, or &4WarZone."),
|
COMMAND_DISBAND_IMMUTABLE("&c&l[!]&7 &7You &ccannot&7 disband &2Wilderness&7,&e SafeZone&7, or &4WarZone."),
|
||||||
|
COMMAND_DISBAND_TOO_YOUNG("&c&l[!] &7Your Faction is too young to withdraw money like this!"),
|
||||||
COMMAND_DISBAND_MARKEDPERMANENT("&c&l[!]&7 This faction is designated as&c permanent&7, so you cannot disband it."),
|
COMMAND_DISBAND_MARKEDPERMANENT("&c&l[!]&7 This faction is designated as&c permanent&7, so you cannot disband it."),
|
||||||
COMMAND_DISBAND_BROADCAST_YOURS("&c&l[!]&7 &c%1$s&7 disbanded your &cfaction."),
|
COMMAND_DISBAND_BROADCAST_YOURS("&c&l[!]&7 &c%1$s&7 disbanded your &cfaction."),
|
||||||
COMMAND_DISBAND_BROADCAST_GENERIC("&c&l[!]&7 The Faction &c%1$s&7 was disbanded."),
|
COMMAND_DISBAND_BROADCAST_GENERIC("&c&l[!]&7 The Faction &c%1$s&7 was disbanded."),
|
||||||
@@ -1091,7 +1105,7 @@ public enum TL {
|
|||||||
GENERIC_YOUMUSTBE("&cYour must be atleast %1$s to do this!"),
|
GENERIC_YOUMUSTBE("&cYour must be atleast %1$s to do this!"),
|
||||||
GENERIC_MEMBERONLY("&cYou must be in a faction to do this!"),
|
GENERIC_MEMBERONLY("&cYou must be in a faction to do this!"),
|
||||||
|
|
||||||
// MISSION_CREATED_COOLDOWN("&c&l[!] &7Due to your immediate faction creation, you may not start missions for &b%1$s minutes&7!"),
|
// MISSION_CREATED_COOLDOWN("&c&l[!] &7Due to your immediate faction creation, you may not start missions for &b%1$s minutes&7!"),
|
||||||
MISSION_MISSION_STARTED("&f%1$s &dstarted the %2$s &fmission"),
|
MISSION_MISSION_STARTED("&f%1$s &dstarted the %2$s &fmission"),
|
||||||
MISSION_ALREAD_COMPLETED("&c&l[!] &7You may not restart a mission you have already completed"),
|
MISSION_ALREAD_COMPLETED("&c&l[!] &7You may not restart a mission you have already completed"),
|
||||||
MISSION_MISSION_ACTIVE("&c&l[!] &7This mission is currently active!"),
|
MISSION_MISSION_ACTIVE("&c&l[!] &7This mission is currently active!"),
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ scoreboard:
|
|||||||
- " &8» &cYour Balance&7: &f{balance}"
|
- " &8» &cYour Balance&7: &f{balance}"
|
||||||
- "&7&m---------------------------"
|
- "&7&m---------------------------"
|
||||||
|
|
||||||
|
#Formatted ONLY When A User is NOT in a Faction
|
||||||
factionless-enabled: true
|
factionless-enabled: true
|
||||||
factionless:
|
factionless:
|
||||||
- "&7&m--------------------------"
|
- "&7&m--------------------------"
|
||||||
@@ -260,6 +261,7 @@ hcf:
|
|||||||
buffer-zone: 0
|
buffer-zone: 0
|
||||||
|
|
||||||
stuck:
|
stuck:
|
||||||
|
Enabled: false
|
||||||
delay: 30
|
delay: 30
|
||||||
radius: 10
|
radius: 10
|
||||||
|
|
||||||
@@ -403,6 +405,7 @@ help:
|
|||||||
- '&c/f points &8- &7Check your factions points.'
|
- '&c/f points &8- &7Check your factions points.'
|
||||||
- '&c/f invsee &8- &7Check a faction members inventory.'
|
- '&c/f invsee &8- &7Check a faction members inventory.'
|
||||||
- '&c/f stealth &8- &7Go into stealth mode to not disable enemies flight.'
|
- '&c/f stealth &8- &7Go into stealth mode to not disable enemies flight.'
|
||||||
|
- '&7&m--------------------&r &e/f help &7&m-----------------------'
|
||||||
############################################################
|
############################################################
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
# | F Permission GUI | #
|
# | F Permission GUI | #
|
||||||
@@ -593,8 +596,8 @@ fwarp-gui:
|
|||||||
# | Faction Creation/Disband Broadcast | #
|
# | Faction Creation/Disband Broadcast | #
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
############################################################
|
############################################################
|
||||||
faction-creation-broadcast: true
|
faction-creation-broadcast: true #Disabling this will not make faction creation broadcasts appear in chat.
|
||||||
faction-disband-broadcast: true
|
faction-disband-broadcast: true #Disabling this will not make faction disband broadcasts appear in chat.
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
@@ -603,7 +606,7 @@ faction-disband-broadcast: true
|
|||||||
############################################################
|
############################################################
|
||||||
#Everything else from display names to lores, is managed by lang.yml, so edit it there
|
#Everything else from display names to lores, is managed by lang.yml, so edit it there
|
||||||
f-check:
|
f-check:
|
||||||
gui-rows: 3
|
gui-rows: 3 #Rows for the check gui
|
||||||
wall-check:
|
wall-check:
|
||||||
Type: COBBLESTONE
|
Type: COBBLESTONE
|
||||||
slot: 10
|
slot: 10
|
||||||
@@ -619,13 +622,16 @@ f-check:
|
|||||||
# | Faction Invisibility | #
|
# | Faction Invisibility | #
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
############################################################
|
############################################################
|
||||||
See-Invisible-Faction-Members: false
|
#This option is to see if another faction member can see their faction members that have the invisible potion effect
|
||||||
|
See-Invisible-Faction-Members: false #ONLY WHEN SCOREBOARD IS ENABLED
|
||||||
|
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
# | Faction Inventory See | #
|
# | Faction Inventory See | #
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
############################################################
|
############################################################
|
||||||
|
#This option is the ability to see other faction members inventories
|
||||||
f-inventory-see:
|
f-inventory-see:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
############################################################
|
############################################################
|
||||||
@@ -633,6 +639,7 @@ f-inventory-see:
|
|||||||
# | Faction Alt Accounts | #
|
# | Faction Alt Accounts | #
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
############################################################
|
############################################################
|
||||||
|
#Faction Alts for extra power, sand printing, afking spawners
|
||||||
f-alts:
|
f-alts:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
@@ -657,6 +664,7 @@ frules:
|
|||||||
# | Faction TNT Bank | #
|
# | Faction TNT Bank | #
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
############################################################
|
############################################################
|
||||||
|
#Faction Tnt Resolved Around A Virtual TNT Bank With Upgrades If Enabled
|
||||||
ftnt:
|
ftnt:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Bank-Limit: 250000
|
Bank-Limit: 250000
|
||||||
@@ -666,6 +674,7 @@ ftnt:
|
|||||||
# | Faction Discord | #
|
# | Faction Discord | #
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
############################################################
|
############################################################
|
||||||
|
#This option allows factions to set their discord link to their specific faction
|
||||||
fdiscord:
|
fdiscord:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
@@ -674,6 +683,7 @@ fdiscord:
|
|||||||
# | Faction PayPal | #
|
# | Faction PayPal | #
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
############################################################
|
############################################################
|
||||||
|
#This option allows factions to set their paypal link to their specific faction
|
||||||
fpaypal:
|
fpaypal:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
@@ -682,6 +692,7 @@ fpaypal:
|
|||||||
# | Faction Checkpoints | #
|
# | Faction Checkpoints | #
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
############################################################
|
############################################################
|
||||||
|
#This option is for a quick fast and in a hurry teleport to raids etc.
|
||||||
checkpoints:
|
checkpoints:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
@@ -690,6 +701,7 @@ checkpoints:
|
|||||||
# | Faction Near | #
|
# | Faction Near | #
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
############################################################
|
############################################################
|
||||||
|
#This option is to allow faction members to be seen via /f near
|
||||||
fnear:
|
fnear:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Radius: 50
|
Radius: 50
|
||||||
@@ -699,6 +711,7 @@ fnear:
|
|||||||
# | Faction Shop | #
|
# | Faction Shop | #
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
############################################################
|
############################################################
|
||||||
|
#Faction Shop is 100% configurable (See More in shop.yml)
|
||||||
F-Shop:
|
F-Shop:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
GUI:
|
GUI:
|
||||||
@@ -751,6 +764,11 @@ f-disband-gui:
|
|||||||
Lore:
|
Lore:
|
||||||
- ' '
|
- ' '
|
||||||
- '&7Click to cancel faction disband.'
|
- '&7Click to cancel faction disband.'
|
||||||
|
separation-item:
|
||||||
|
Type: BLACK_WOOL
|
||||||
|
Name: ' '
|
||||||
|
Lore:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
@@ -758,6 +776,7 @@ f-disband-gui:
|
|||||||
# | Faction GracePeriod | #
|
# | Faction GracePeriod | #
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
############################################################
|
############################################################
|
||||||
|
#This option will deny all explosions
|
||||||
f-grace:
|
f-grace:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
@@ -889,6 +908,8 @@ ffocus:
|
|||||||
# | Faction Vault | #
|
# | Faction Vault | #
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
############################################################
|
############################################################
|
||||||
|
#Faction Vaults are a placeable chest that can be accessed
|
||||||
|
#While maintaining that factor it can still be raided by other factions.
|
||||||
fvault:
|
fvault:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
No-Hoppers-near-vault: true
|
No-Hoppers-near-vault: true
|
||||||
@@ -907,6 +928,8 @@ fvault:
|
|||||||
# | Faction Chest | #
|
# | Faction Chest | #
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
############################################################
|
############################################################
|
||||||
|
#Faction Chests are a virtual chest based system that cannot be raided
|
||||||
|
#Used for storing items that equate to high value of the faction.
|
||||||
fchest:
|
fchest:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Default-Size: 1 #In Rows
|
Default-Size: 1 #In Rows
|
||||||
@@ -1056,7 +1079,7 @@ fupgrades:
|
|||||||
- '&c&lDecreased Spawner Delay'
|
- '&c&lDecreased Spawner Delay'
|
||||||
- '&4&l* &cLevel 1: &f0.10%'
|
- '&4&l* &cLevel 1: &f0.10%'
|
||||||
- '&4&l* &cLevel 2: &f0.20%'
|
- '&4&l* &cLevel 2: &f0.20%'
|
||||||
- '&4&l* &cLevel 3: &f0.30'
|
- '&4&l* &cLevel 3: &f0.30%'
|
||||||
- '&f'
|
- '&f'
|
||||||
- '&c&lCosts'
|
- '&c&lCosts'
|
||||||
- '&4&l* &cLevel 1: &f$1,000,000'
|
- '&4&l* &cLevel 1: &f$1,000,000'
|
||||||
@@ -1369,6 +1392,7 @@ Tntfill:
|
|||||||
enabled: true
|
enabled: true
|
||||||
max-radius: 32
|
max-radius: 32
|
||||||
max-amount: 64
|
max-amount: 64
|
||||||
|
|
||||||
Wild:
|
Wild:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
# Time to wait in seconds #
|
# Time to wait in seconds #
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ name: Factions
|
|||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
main: com.massivecraft.factions.FactionsPlugin
|
main: com.massivecraft.factions.FactionsPlugin
|
||||||
authors: [Olof Larsson, Brett Flannigan, drtshock, ProSavage, SvenjaReißaus, FroggyKnight, Driftay]
|
authors: [Olof Larsson, Brett Flannigan, drtshock, ProSavage, SvenjaReißaus, Driftay]
|
||||||
softdepend: [Skript, CoreProtect, PlayerVaults, PlaceholderAPI, MVdWPlaceholderAPI, PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, CAPI, AuthMe, Vault, Spout, WorldEdit, WorldGuard, AuthDB, CaptureThePoints, CombatTag, dynmap, FactionsTop]
|
softdepend: [Skript, CoreProtect, PlayerVaults, PlaceholderAPI, MVdWPlaceholderAPI, PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, CAPI, AuthMe, Vault, Spout, WorldEdit, WorldGuard, AuthDB, CaptureThePoints, CombatTag, dynmap, FactionsTop]
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
|||||||
Reference in New Issue
Block a user