Compare commits
75 Commits
2.3.3-STAB
...
2.3.7-STAB
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf71603eeb | ||
|
|
c45b68a95f | ||
|
|
67a9a6db28 | ||
|
|
0ea56fe5d2 | ||
|
|
7d3c4d6e33 | ||
|
|
4d05b4a376 | ||
|
|
c29850eaaa | ||
|
|
ece5dd0bb7 | ||
|
|
bbaee8ab06 | ||
|
|
c42949ec59 | ||
|
|
f5f8e6aad2 | ||
|
|
447bfedbb1 | ||
|
|
1d4a1c2a1a | ||
|
|
31b8f0be25 | ||
|
|
e2d85d83f3 | ||
|
|
66f2fd22f6 | ||
|
|
842eb097c6 | ||
|
|
2f18da3cfb | ||
|
|
5fb8d06d98 | ||
|
|
868e7f4102 | ||
|
|
d8b08ef6d7 | ||
|
|
7bffed2d34 | ||
|
|
541e1fc69b | ||
|
|
07dce634af | ||
|
|
75faaa4bb5 | ||
|
|
17e2a86717 | ||
|
|
f384100925 | ||
|
|
b8c695c2f4 | ||
|
|
78a5e65e5c | ||
|
|
33761fee2b | ||
|
|
bf23521309 | ||
|
|
55fd5ffdfd | ||
|
|
04273de995 | ||
|
|
7fc1ad19ad | ||
|
|
01913e7286 | ||
|
|
ae7bb670d7 | ||
|
|
499d41dea0 | ||
|
|
e0d2e6b4db | ||
|
|
e37745eff9 | ||
|
|
86cba0e24c | ||
|
|
69a4651e23 | ||
|
|
f2c6d0b9da | ||
|
|
8f343a5344 | ||
|
|
8665d92476 | ||
|
|
b89db7b082 | ||
|
|
00cb78fd9b | ||
|
|
aca075b5c7 | ||
|
|
03886aa84e | ||
|
|
22472f63f1 | ||
|
|
6d72e5d167 | ||
|
|
69765e472c | ||
|
|
4f55b10c7d | ||
|
|
0395280a9e | ||
|
|
d1252df3ba | ||
|
|
9707226762 | ||
|
|
cf075c270e | ||
|
|
f088b42bbe | ||
|
|
baee5d2158 | ||
|
|
f871787b0c | ||
|
|
749fca0690 | ||
|
|
319940d9b3 | ||
|
|
7ea81a6c10 | ||
|
|
6205bbca9f | ||
|
|
241a16bc2a | ||
|
|
3aa98121e5 | ||
|
|
144798b2dd | ||
|
|
dac07178e5 | ||
|
|
f8421c09cf | ||
|
|
932a5768b0 | ||
|
|
861f88a916 | ||
|
|
5b7f3b0f0e | ||
|
|
304662fa9b | ||
|
|
5a6c660f7f | ||
|
|
0fc736cdf5 | ||
|
|
ef7db546a3 |
@@ -1,6 +1,7 @@
|
|||||||
# SaberFactions
|
# SaberFactions
|
||||||
|
|
||||||
 [](https://www.codefactor.io/repository/github/driftay/saber-factions) [](https://github.com/SaberLLC/Saber-Factions/blob/1.6.x/LICENSE) 
|
 [](https://www.codefactor.io/repository/github/driftay/saber-factions) [](https://github.com/SaberLLC/Saber-Factions/blob/1.6.x/LICENSE)  [](https://jitpack.io/#SaberLLC/Saber-Factions)
|
||||||
|
|
||||||
|
|
||||||
SaberFactions is an exotic, performance optimized, 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 an exotic, performance optimized, 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.
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ Some of our features include the following
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.SaberLLC</groupId>
|
<groupId>com.github.SaberLLC</groupId>
|
||||||
<artifactId>Saber-Factions</artifactId>
|
<artifactId>Saber-Factions</artifactId>
|
||||||
<version>2.2.7-STABLE</version>
|
<version>2.3.3-STABLE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
## Moving Forward
|
## Moving Forward
|
||||||
|
|||||||
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.3.3-RC</version>
|
<version>1.6.9.5-2.3.7-RC</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>SaberFactions</name>
|
<name>SaberFactions</name>
|
||||||
|
|||||||
@@ -98,10 +98,14 @@ public class Conf {
|
|||||||
public static double autoLeaveRoutineRunsEveryXMinutes = 5.0;
|
public static double autoLeaveRoutineRunsEveryXMinutes = 5.0;
|
||||||
public static int autoLeaveRoutineMaxMillisecondsPerTick = 5; // 1 server tick is roughly 50ms, so default max 10% of a tick
|
public static int autoLeaveRoutineMaxMillisecondsPerTick = 5; // 1 server tick is roughly 50ms, so default max 10% of a tick
|
||||||
public static boolean removePlayerDataWhenBanned = true;
|
public static boolean removePlayerDataWhenBanned = true;
|
||||||
|
public static String removePlayerDataWhenBannedReason = "Banned by admin.";
|
||||||
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;
|
||||||
|
|
||||||
|
//RADIUS CLAIMING
|
||||||
|
public static boolean useRadiusClaimSystem = true;
|
||||||
|
|
||||||
//FRIENDLY FIRE
|
//FRIENDLY FIRE
|
||||||
public static boolean friendlyFireFPlayersCommand = false;
|
public static boolean friendlyFireFPlayersCommand = false;
|
||||||
|
|
||||||
@@ -122,7 +126,7 @@ public class Conf {
|
|||||||
public static boolean useDisbandGUI = true;
|
public static boolean useDisbandGUI = true;
|
||||||
|
|
||||||
//SEALTH
|
//SEALTH
|
||||||
public static boolean useSealthSystem = true;
|
public static boolean useStealthSystem = true;
|
||||||
|
|
||||||
//STRIKES
|
//STRIKES
|
||||||
public static boolean useStrikeSystem = true;
|
public static boolean useStrikeSystem = true;
|
||||||
@@ -275,8 +279,7 @@ public class Conf {
|
|||||||
/// Useful for HCF features.
|
/// Useful for HCF features.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Set<Material> territoryBypassProtectedMaterials = EnumSet.noneOf(Material.class);
|
public static Set<Material> territoryBypassProtectedMaterials = EnumSet.noneOf(Material.class);
|
||||||
// Dependency check
|
|
||||||
public static boolean dependencyCheck = true;
|
|
||||||
public static boolean enableClickToClaim = true;
|
public static boolean enableClickToClaim = true;
|
||||||
|
|
||||||
public static Set<Material> territoryCancelAndAllowItemUseMaterial = new HashSet<>();
|
public static Set<Material> territoryCancelAndAllowItemUseMaterial = new HashSet<>();
|
||||||
@@ -423,6 +426,10 @@ public class Conf {
|
|||||||
public static HashMap<String, DefaultPermissions> defaultFactionPermissions = new HashMap<>();
|
public static HashMap<String, DefaultPermissions> defaultFactionPermissions = new HashMap<>();
|
||||||
public static HashSet<PermissableAction> lockedPermissions = new HashSet<>();
|
public static HashSet<PermissableAction> lockedPermissions = new HashSet<>();
|
||||||
|
|
||||||
|
public static boolean useComplexFly = true;
|
||||||
|
|
||||||
|
public static boolean wildLoadChunkBeforeTeleport = true;
|
||||||
|
|
||||||
private static transient Conf i = new Conf();
|
private static transient Conf i = new Conf();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@@ -553,7 +560,6 @@ public class Conf {
|
|||||||
territoryDenyUsageMaterials.add(Material.ARMOR_STAND);
|
territoryDenyUsageMaterials.add(Material.ARMOR_STAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
territoryProtectedMaterialsWhenOffline.add(Material.BEACON);
|
territoryProtectedMaterialsWhenOffline.add(Material.BEACON);
|
||||||
|
|
||||||
territoryDenyUsageMaterialsWhenOffline.add(XMaterial.FIRE_CHARGE.parseMaterial());
|
territoryDenyUsageMaterialsWhenOffline.add(XMaterial.FIRE_CHARGE.parseMaterial());
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import com.massivecraft.factions.integration.Worldguard;
|
|||||||
import com.massivecraft.factions.integration.dynmap.EngineDynmap;
|
import com.massivecraft.factions.integration.dynmap.EngineDynmap;
|
||||||
import com.massivecraft.factions.listeners.*;
|
import com.massivecraft.factions.listeners.*;
|
||||||
import com.massivecraft.factions.missions.MissionHandler;
|
import com.massivecraft.factions.missions.MissionHandler;
|
||||||
import com.massivecraft.factions.struct.ChatMode;
|
|
||||||
import com.massivecraft.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
import com.massivecraft.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
import com.massivecraft.factions.util.*;
|
import com.massivecraft.factions.util.*;
|
||||||
@@ -39,15 +38,15 @@ import me.lucko.commodore.CommodoreProvider;
|
|||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bukkit.*;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||||
|
|
||||||
@@ -66,6 +65,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
// Our single plugin instance.
|
// Our single plugin instance.
|
||||||
// Single 4 life.
|
// Single 4 life.
|
||||||
public static FactionsPlugin instance;
|
public static FactionsPlugin instance;
|
||||||
|
public static boolean cachedRadiusClaim;
|
||||||
public static Permission perms = null;
|
public static Permission perms = null;
|
||||||
// This plugin sets the boolean true when fully enabled.
|
// This plugin sets the boolean true when fully enabled.
|
||||||
// Plugins can check this boolean while hooking in have
|
// Plugins can check this boolean while hooking in have
|
||||||
@@ -82,7 +82,6 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
public boolean mc114 = false;
|
public boolean mc114 = false;
|
||||||
public boolean mc115 = false;
|
public boolean mc115 = false;
|
||||||
public boolean useNonPacketParticles = false;
|
public boolean useNonPacketParticles = false;
|
||||||
public boolean factionsFlight = false;
|
|
||||||
public List<String> itemList = getConfig().getStringList("fchest.Items-Not-Allowed");
|
public List<String> itemList = getConfig().getStringList("fchest.Items-Not-Allowed");
|
||||||
SkriptAddon skriptAddon;
|
SkriptAddon skriptAddon;
|
||||||
private FactionsPlayerListener factionsPlayerListener;
|
private FactionsPlayerListener factionsPlayerListener;
|
||||||
@@ -129,28 +128,20 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
this.setAutoSave(val);
|
this.setAutoSave(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playSoundForAll(String sound) {
|
|
||||||
for (Player pl : Bukkit.getOnlinePlayers()) playSound(pl, sound);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void playSoundForAll(List<String> sounds) {
|
|
||||||
for (Player pl : Bukkit.getOnlinePlayers()) playSound(pl, sounds);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void playSound(Player p, List<String> sounds) {
|
|
||||||
for (String sound : sounds) playSound(p, sound);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void playSound(Player p, String sound) {
|
|
||||||
float pitch = Float.parseFloat(sound.split(":")[1]);
|
|
||||||
sound = sound.split(":")[0];
|
|
||||||
p.playSound(p.getLocation(), Sound.valueOf(sound), pitch, 5.0F);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
log("==== Setup ====");
|
log("==== Setup ====");
|
||||||
|
|
||||||
|
if (getServer().getPluginManager().getPlugin("Vault") == null) {
|
||||||
|
divider();
|
||||||
|
System.out.println("You are missing dependencies!");
|
||||||
|
System.out.println("Please verify [Vault] is installed!");
|
||||||
|
Conf.save();
|
||||||
|
Bukkit.getPluginManager().disablePlugin(instance);
|
||||||
|
divider();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int version = Integer.parseInt(ReflectionUtils.PackageType.getServerVersion().split("_")[1]);
|
int version = Integer.parseInt(ReflectionUtils.PackageType.getServerVersion().split("_")[1]);
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case 7:
|
case 7:
|
||||||
@@ -183,35 +174,22 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
int pluginId = 7013;
|
int pluginId = 7013;
|
||||||
Metrics metrics = new Metrics(this, pluginId);
|
Metrics metrics = new Metrics(this, pluginId);
|
||||||
|
|
||||||
|
if (!preEnable()) {
|
||||||
if (!preEnable()) return;
|
|
||||||
this.loadSuccessful = false;
|
this.loadSuccessful = false;
|
||||||
|
return;
|
||||||
if (!new File(this.getDataFolder() + "/config.yml").exists()) {
|
|
||||||
this.saveResource("config.yml", false);
|
|
||||||
this.reloadConfig();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
saveDefaultConfig();
|
||||||
//Start wait task executor
|
//Start wait task executor
|
||||||
WaitExecutor.startTask();
|
WaitExecutor.startTask();
|
||||||
// Load Conf from disk
|
// Load Conf from disk
|
||||||
fileManager = new FileManager();
|
|
||||||
getFileManager().setupFiles();
|
|
||||||
Conf.load();
|
Conf.load();
|
||||||
|
|
||||||
|
fileManager = new FileManager();
|
||||||
|
fileManager.setupFiles();
|
||||||
|
|
||||||
fLogManager = new FLogManager();
|
fLogManager = new FLogManager();
|
||||||
//Dependency checks
|
|
||||||
if (Conf.dependencyCheck && (!Bukkit.getPluginManager().isPluginEnabled("Vault"))) {
|
|
||||||
divider();
|
|
||||||
System.out.println("You are missing dependencies!");
|
|
||||||
System.out.println("Please verify [Vault] is installed!");
|
|
||||||
Conf.save();
|
|
||||||
Bukkit.getPluginManager().disablePlugin(instance);
|
|
||||||
divider();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//Update their config if needed
|
|
||||||
// Updater.updateIfNeeded(getConfig());
|
|
||||||
RegisteredServiceProvider<Economy> rsp = FactionsPlugin.this.getServer().getServicesManager().getRegistration(Economy.class);
|
|
||||||
com.massivecraft.factions.integration.Essentials.setup();
|
com.massivecraft.factions.integration.Essentials.setup();
|
||||||
hookedPlayervaults = setupPlayervaults();
|
hookedPlayervaults = setupPlayervaults();
|
||||||
FPlayers.getInstance().load();
|
FPlayers.getInstance().load();
|
||||||
@@ -228,6 +206,12 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
else faction.addFPlayer(fPlayer);
|
else faction.addFPlayer(fPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Factions.getInstance().getAllFactions().forEach(Faction::refreshFPlayers);
|
||||||
|
|
||||||
|
if (getConfig().getBoolean("enable-faction-flight", true)) {
|
||||||
|
UtilFly.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Board.getInstance().load();
|
Board.getInstance().load();
|
||||||
Board.getInstance().clean();
|
Board.getInstance().clean();
|
||||||
@@ -247,15 +231,15 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
// start up task which runs the autoLeaveAfterDaysOfInactivity routine
|
// start up task which runs the autoLeaveAfterDaysOfInactivity routine
|
||||||
startAutoLeaveTask(false);
|
startAutoLeaveTask(false);
|
||||||
|
|
||||||
|
cachedRadiusClaim = Conf.useRadiusClaimSystem;
|
||||||
|
|
||||||
if (version > 8) {
|
if (version > 8) {
|
||||||
useNonPacketParticles = true;
|
useNonPacketParticles = true;
|
||||||
log("Minecraft Version 1.9 or higher found, using non packet based particle API");
|
log("Minecraft Version 1.9 or higher found, using non packet based particle API");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getConfig().getBoolean("enable-faction-flight")) factionsFlight = true;
|
|
||||||
|
|
||||||
if (getServer().getPluginManager().getPlugin("Skript") != null) {
|
if (getServer().getPluginManager().getPlugin("Skript") != null) {
|
||||||
log("Skript was found! Registering FactionsPlugin Addon...");
|
log("Skript was found! Registering SaberFactions Addon...");
|
||||||
skriptAddon = Skript.registerAddon(this);
|
skriptAddon = Skript.registerAddon(this);
|
||||||
try {
|
try {
|
||||||
skriptAddon.loadClasses("com.massivecraft.factions.skript", "expressions");
|
skriptAddon.loadClasses("com.massivecraft.factions.skript", "expressions");
|
||||||
@@ -264,6 +248,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
}
|
}
|
||||||
log("Skript addon registered!");
|
log("Skript addon registered!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Conf.useCheckSystem) {
|
if (Conf.useCheckSystem) {
|
||||||
int minute = 1200;
|
int minute = 1200;
|
||||||
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new CheckTask(this, 3), 0L, minute * 3);
|
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new CheckTask(this, 3), 0L, minute * 3);
|
||||||
@@ -295,16 +280,20 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
new MissionHandler(this),
|
new MissionHandler(this),
|
||||||
new FChestListener(),
|
new FChestListener(),
|
||||||
new MenuListener(),
|
new MenuListener(),
|
||||||
timerManager.graceTimer,
|
|
||||||
new AntiChestListener()
|
new AntiChestListener()
|
||||||
};
|
};
|
||||||
|
|
||||||
for (Listener eventListener : eventsListener)
|
for (Listener eventListener : eventsListener)
|
||||||
getServer().getPluginManager().registerEvents(eventListener, this);
|
getServer().getPluginManager().registerEvents(eventListener, this);
|
||||||
|
|
||||||
|
if (Conf.useGraceSystem) {
|
||||||
|
getServer().getPluginManager().registerEvents(timerManager.graceTimer, this);
|
||||||
|
}
|
||||||
|
|
||||||
this.getCommand(refCommand).setExecutor(cmdBase);
|
this.getCommand(refCommand).setExecutor(cmdBase);
|
||||||
|
|
||||||
if (!CommodoreProvider.isSupported()) this.getCommand(refCommand).setTabCompleter(this);
|
if (!CommodoreProvider.isSupported()) this.getCommand(refCommand).setTabCompleter(this);
|
||||||
|
|
||||||
reserveObjects = new ArrayList<>();
|
reserveObjects = new ArrayList<>();
|
||||||
String path = Paths.get(this.getDataFolder().getAbsolutePath()).toAbsolutePath().toString() + File.separator + "reserves.json";
|
String path = Paths.get(this.getDataFolder().getAbsolutePath()).toAbsolutePath().toString() + File.separator + "reserves.json";
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
@@ -340,10 +329,6 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
FactionsPlugin.startupFinished = true;
|
FactionsPlugin.startupFinished = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SkriptAddon getSkriptAddon() {
|
|
||||||
return skriptAddon;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void setupPlaceholderAPI() {
|
private void setupPlaceholderAPI() {
|
||||||
Plugin clip = getServer().getPluginManager().getPlugin("PlaceholderAPI");
|
Plugin clip = getServer().getPluginManager().getPlugin("PlaceholderAPI");
|
||||||
@@ -450,8 +435,19 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
super.onDisable();
|
if (this.AutoLeaveTask != null) {
|
||||||
|
getServer().getScheduler().cancelTask(this.AutoLeaveTask);
|
||||||
|
this.AutoLeaveTask = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Conf.saveSync();
|
||||||
timerManager.saveTimerData();
|
timerManager.saveTimerData();
|
||||||
|
DiscordListener.saveGuilds();
|
||||||
|
|
||||||
|
if (Discord.jda != null) Discord.jda.shutdownNow();
|
||||||
|
|
||||||
|
fLogManager.saveLogs();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String path = Paths.get(getDataFolder().getAbsolutePath()).toAbsolutePath().toString() + File.separator + "reserves.json";
|
String path = Paths.get(getDataFolder().getAbsolutePath()).toAbsolutePath().toString() + File.separator + "reserves.json";
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
@@ -464,23 +460,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
// only save data if plugin actually completely loaded successfully
|
super.onDisable();
|
||||||
if (this.loadSuccessful) Conf.saveSync();
|
|
||||||
|
|
||||||
|
|
||||||
if (AutoLeaveTask != null) {
|
|
||||||
this.getServer().getScheduler().cancelTask(AutoLeaveTask);
|
|
||||||
AutoLeaveTask = null;
|
|
||||||
}
|
|
||||||
DiscordListener.saveGuilds();
|
|
||||||
if (Discord.jda != null) {
|
|
||||||
Discord.jda.shutdownNow();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
fLogManager.saveLogs();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startAutoLeaveTask(boolean restartIfRunning) {
|
public void startAutoLeaveTask(boolean restartIfRunning) {
|
||||||
@@ -501,26 +481,9 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
Conf.save();
|
Conf.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack createItem(Material material, int amount, short datavalue, String name, List<String> lore) {
|
|
||||||
ItemStack item = new ItemStack(XMaterial.matchXMaterial(material.toString()).get().parseMaterial(), amount, datavalue);
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
|
||||||
meta.setDisplayName(color(name));
|
|
||||||
meta.setLore(colorList(lore));
|
|
||||||
item.setItemMeta(meta);
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack createLazyItem(Material material, int amount, short datavalue, String name, String lore) {
|
|
||||||
ItemStack item = new ItemStack(material, amount, datavalue);
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
|
||||||
meta.setDisplayName(color(FactionsPlugin.instance.getConfig().getString(name)));
|
|
||||||
meta.setLore(colorList(FactionsPlugin.instance.getConfig().getStringList(lore)));
|
|
||||||
item.setItemMeta(meta);
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Economy getEcon() {
|
public Economy getEcon() {
|
||||||
RegisteredServiceProvider<Economy> rsp = FactionsPlugin.instance.getServer().getServicesManager().getRegistration(Economy.class);
|
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
|
||||||
return rsp.getProvider();
|
return rsp.getProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,7 +508,6 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
List<FCommand> commandsList = cmdBase.subCommands;
|
List<FCommand> commandsList = cmdBase.subCommands;
|
||||||
FCommand commandsEx = cmdBase;
|
FCommand commandsEx = cmdBase;
|
||||||
List<String> completions = new ArrayList<>();
|
List<String> completions = new ArrayList<>();
|
||||||
|
|
||||||
// Check for "" first arg because spigot is mangled.
|
// Check for "" first arg because spigot is mangled.
|
||||||
if (context.args.get(0).equals("")) {
|
if (context.args.get(0).equals("")) {
|
||||||
for (FCommand subCommand : commandsEx.subCommands) {
|
for (FCommand subCommand : commandsEx.subCommands) {
|
||||||
@@ -593,70 +555,11 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
// Functions for other plugins to hook into
|
// Functions for other plugins to hook into
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
// This value will be updated whenever new hooks are added
|
|
||||||
public int hookSupportVersion() {
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If another plugin is handling insertion of chat tags, this should be used to notify Factions
|
// If another plugin is handling insertion of chat tags, this should be used to notify Factions
|
||||||
public void handleFactionTagExternally(boolean notByFactions) {
|
public void handleFactionTagExternally(boolean notByFactions) {
|
||||||
Conf.chatTagHandledByAnotherPlugin = notByFactions;
|
Conf.chatTagHandledByAnotherPlugin = notByFactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simply put, should this chat event be left for Factions to handle? For now, that means players with Faction Chat
|
|
||||||
// enabled or use of the Factions f command without a slash; combination of isPlayerFactionChatting() and isFactionsCommand()
|
|
||||||
|
|
||||||
public boolean shouldLetFactionsHandleThisChat(AsyncPlayerChatEvent event) {
|
|
||||||
return event != null && (isPlayerFactionChatting(event.getPlayer()) || isFactionsCommand(event.getMessage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Does player have Faction Chat enabled? If so, chat plugins should preferably not do channels,
|
|
||||||
// local chat, or anything else which targets individual recipients, so Faction Chat can be done
|
|
||||||
public boolean isPlayerFactionChatting(Player player) {
|
|
||||||
if (player == null) return false;
|
|
||||||
FPlayer me = FPlayers.getInstance().getByPlayer(player);
|
|
||||||
return me != null && me.getChatMode().isAtLeast(ChatMode.ALLIANCE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is this chat message actually a Factions command, and thus should be left alone by other plugins?
|
|
||||||
|
|
||||||
// TODO: GET THIS BACK AND WORKING
|
|
||||||
|
|
||||||
public boolean isFactionsCommand(String check) {
|
|
||||||
return !(check == null || check.isEmpty()) && this.handleCommand(null, check, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a player's faction tag (faction name), mainly for usage by chat plugins for local/channel chat
|
|
||||||
public String getPlayerFactionTag(Player player) {
|
|
||||||
return getPlayerFactionTagRelation(player, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Same as above, but with relation (enemy/neutral/ally) coloring potentially added to the tag
|
|
||||||
public String getPlayerFactionTagRelation(Player speaker, Player listener) {
|
|
||||||
String tag = "~";
|
|
||||||
|
|
||||||
if (speaker == null) return tag;
|
|
||||||
|
|
||||||
|
|
||||||
FPlayer me = FPlayers.getInstance().getByPlayer(speaker);
|
|
||||||
if (me == null) return tag;
|
|
||||||
// if listener isn't set, or config option is disabled, give back uncolored tag
|
|
||||||
if (listener == null || !Conf.chatTagRelationColored) {
|
|
||||||
tag = me.getChatTag().trim();
|
|
||||||
} else {
|
|
||||||
FPlayer you = FPlayers.getInstance().getByPlayer(listener);
|
|
||||||
if (you == null) {
|
|
||||||
tag = me.getChatTag().trim();
|
|
||||||
} else { // everything checks out, give the colored tag
|
|
||||||
tag = me.getChatTag(you).trim();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tag.isEmpty()) tag = "~";
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public FLogManager getFlogManager() {
|
public FLogManager getFlogManager() {
|
||||||
return fLogManager;
|
return fLogManager;
|
||||||
}
|
}
|
||||||
@@ -665,14 +568,6 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
this.fLogManager.log(faction, type, arguments);
|
this.fLogManager.log(faction, type, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a player's title within their faction, mainly for usage by chat plugins for local/channel chat
|
|
||||||
public String getPlayerTitle(Player player) {
|
|
||||||
if (player == null) return "";
|
|
||||||
FPlayer me = FPlayers.getInstance().getByPlayer(player);
|
|
||||||
if (me == null) return "";
|
|
||||||
return me.getTitle().trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String color(String line) {
|
public String color(String line) {
|
||||||
line = ChatColor.translateAlternateColorCodes('&', line);
|
line = ChatColor.translateAlternateColorCodes('&', line);
|
||||||
return line;
|
return line;
|
||||||
@@ -684,38 +579,10 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
return lore;
|
return lore;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a list of all faction tags (names)
|
|
||||||
public Set<String> getFactionTags() {
|
|
||||||
return Factions.getInstance().getFactionTags();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ReserveObject> getFactionReserves() {
|
public List<ReserveObject> getFactionReserves() {
|
||||||
return this.reserveObjects;
|
return this.reserveObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a list of all players in the specified faction
|
|
||||||
public Set<String> getPlayersInFaction(String factionTag) {
|
|
||||||
Set<String> players = new HashSet<>();
|
|
||||||
Faction faction = Factions.getInstance().getByTag(factionTag);
|
|
||||||
if (faction != null) {
|
|
||||||
for (FPlayer fplayer : faction.getFPlayers()) players.add(fplayer.getName());
|
|
||||||
}
|
|
||||||
return players;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a list of all online players in the specified faction
|
|
||||||
public Set<String> getOnlinePlayersInFaction(String factionTag) {
|
|
||||||
Set<String> players = new HashSet<>();
|
|
||||||
Faction faction = Factions.getInstance().getByTag(factionTag);
|
|
||||||
if (faction != null) {
|
|
||||||
for (FPlayer fplayer : faction.getFPlayersWhereOnline(true)) players.add(fplayer.getName());
|
|
||||||
}
|
|
||||||
return players;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isHookedPlayervaults() {
|
|
||||||
return hookedPlayervaults;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPrimaryGroup(OfflinePlayer player) {
|
public String getPrimaryGroup(OfflinePlayer player) {
|
||||||
return perms == null || !perms.hasGroupSupport() ? " " : perms.getPrimaryGroup(Bukkit.getWorlds().get(0).toString(), player);
|
return perms == null || !perms.hasGroupSupport() ? " " : perms.getPrimaryGroup(Bukkit.getWorlds().get(0).toString(), player);
|
||||||
@@ -737,7 +604,4 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
debug(Level.INFO, s);
|
debug(Level.INFO, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Worldguard getWg() {
|
|
||||||
return wg;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,24 +86,20 @@ public class CmdAdmin extends FCommand {
|
|||||||
FactionsPlugin.instance.getFlogManager().log(targetFaction, FLogType.RANK_EDIT, context.fPlayer.getName(), fyou.getName(), ChatColor.RED + "Admin");
|
FactionsPlugin.instance.getFlogManager().log(targetFaction, FLogType.RANK_EDIT, context.fPlayer.getName(), fyou.getName(), ChatColor.RED + "Admin");
|
||||||
|
|
||||||
// Inform all players
|
// Inform all players
|
||||||
|
if(FactionsPlugin.instance.getConfig().getBoolean("faction-leader-broadcast")) {
|
||||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||||
fplayer.msg(TL.COMMAND_ADMIN_PROMOTED,
|
fplayer.msg(TL.COMMAND_ADMIN_PROMOTED, context.player == null ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(fplayer, true), fyou.describeTo(fplayer), targetFaction.describeTo(fplayer));
|
||||||
context.player == null ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(fplayer, true),
|
}
|
||||||
fyou.describeTo(fplayer), targetFaction.describeTo(fplayer));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setRole(FPlayer fp, Role r) {
|
private void setRole(FPlayer fp, Role r) {
|
||||||
FactionsPlugin.getInstance().getServer().getScheduler().runTask(FactionsPlugin.instance, () -> {
|
FactionsPlugin.getInstance().getServer().getScheduler().runTask(FactionsPlugin.instance, () -> fp.setRole(r));
|
||||||
fp.setRole(r);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void promoteNewLeader(Faction f) {
|
private void promoteNewLeader(Faction f) {
|
||||||
FactionsPlugin.getInstance().getServer().getScheduler().runTask(FactionsPlugin.instance, () -> {
|
FactionsPlugin.getInstance().getServer().getScheduler().runTask(FactionsPlugin.instance, (Runnable) f::promoteNewLeader);
|
||||||
f.promoteNewLeader();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TL getUsageTranslation() {
|
public TL getUsageTranslation() {
|
||||||
|
|||||||
@@ -25,36 +25,17 @@ public class CmdDeinvite extends FCommand {
|
|||||||
this.optionalArgs.put("player name", "name");
|
this.optionalArgs.put("player name", "name");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.DEINVITE)
|
this.requirements = new CommandRequirements.Builder(Permission.DEINVITE)
|
||||||
|
.withAction(PermissableAction.INVITE)
|
||||||
.memberOnly()
|
.memberOnly()
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (context.args.size() == 0) {
|
|
||||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
|
||||||
for (String id : context.faction.getInvites()) {
|
|
||||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
|
||||||
String name = fp != null ? fp.getName() : id;
|
|
||||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
|
||||||
}
|
|
||||||
context.sendFancyMessage(msg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FPlayer you = context.argAsBestFPlayerMatch(0);
|
FPlayer you = context.argAsBestFPlayerMatch(0);
|
||||||
if (!context.fPlayer.isAdminBypassing()) {
|
|
||||||
Access access = context.faction.getAccess(context.fPlayer, PermissableAction.INVITE);
|
|
||||||
if (access != Access.ALLOW && context.fPlayer.getRole() != Role.LEADER) {
|
|
||||||
context.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (you == null) {
|
if (you == null) {
|
||||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
||||||
for (String id : context.faction.getInvites()) {
|
for (String id : context.faction.getInvites()) {
|
||||||
if (context.faction.getInvites().isEmpty()) return;
|
|
||||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||||
String name = fp != null ? fp.getName() : id;
|
String name = fp != null ? fp.getName() : id;
|
||||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||||
@@ -65,15 +46,16 @@ public class CmdDeinvite extends FCommand {
|
|||||||
|
|
||||||
if (you.getFaction() == context.faction) {
|
if (you.getFaction() == context.faction) {
|
||||||
context.msg(TL.COMMAND_DEINVITE_ALREADYMEMBER, you.getName(), context.faction.getTag());
|
context.msg(TL.COMMAND_DEINVITE_ALREADYMEMBER, you.getName(), context.faction.getTag());
|
||||||
context.msg(TL.COMMAND_DEINVITE_MIGHTWANT, FactionsPlugin.getInstance().cmdBase.cmdKick.getUsageTemplate(context));
|
context.msg(TL.COMMAND_DEINVITE_MIGHTWANT, FCmdRoot.instance.cmdKick.getUsageTemplate(context));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
context.faction.deinvite(you);
|
context.faction.deinvite(you);
|
||||||
|
|
||||||
you.msg(TL.COMMAND_DEINVITE_REVOKED, context.fPlayer.describeTo(you), context.faction.describeTo(you));
|
you.msg(TL.COMMAND_DEINVITE_REVOKED, context.fPlayer.describeTo(you), context.faction.describeTo(you));
|
||||||
|
|
||||||
context.faction.msg(TL.COMMAND_DEINVITE_REVOKES, context.fPlayer.describeTo(context.faction), you.describeTo(context.faction));
|
context.faction.msg(TL.COMMAND_DEINVITE_REVOKES, context.fPlayer.describeTo(context.faction), you.describeTo(context.faction));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TL getUsageTranslation() {
|
public TL getUsageTranslation() {
|
||||||
return TL.COMMAND_DEINVITE_DESCRIPTION;
|
return TL.COMMAND_DEINVITE_DESCRIPTION;
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class CmdDisband extends FCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!access) {
|
if (!access) {
|
||||||
if (Conf.useDisbandGUI && !context.fPlayer.isAdminBypassing() || !context.player.isOp()) {
|
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;
|
||||||
@@ -101,27 +101,15 @@ public class CmdDisband extends FCommand {
|
|||||||
String amountString = context.sender instanceof ConsoleCommandSender ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(follower);
|
String amountString = context.sender instanceof ConsoleCommandSender ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(follower);
|
||||||
if (follower.getFaction() == faction) {
|
if (follower.getFaction() == faction) {
|
||||||
follower.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, amountString);
|
follower.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, amountString);
|
||||||
if (!follower.canFlyAtLocation() && FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) {
|
|
||||||
follower.setFFlying(false, false);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
follower.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, amountString, faction.getTag(follower));
|
follower.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, amountString, faction.getTag(follower));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) {
|
|
||||||
faction.disband(context.player, PlayerDisbandReason.COMMAND);
|
|
||||||
context.fPlayer.setFFlying(false, false);
|
|
||||||
Cooldown.setCooldown(context.fPlayer.getPlayer(), "disbandCooldown", FactionsPlugin.getInstance().getConfig().getInt("fcooldowns.f-disband"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
context.player.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
|
context.player.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
|
||||||
}
|
}
|
||||||
faction.disband(context.player, PlayerDisbandReason.COMMAND);
|
faction.disband(context.player, PlayerDisbandReason.COMMAND);
|
||||||
Cooldown.setCooldown(context.fPlayer.getPlayer(), "disbandCooldown", FactionsPlugin.getInstance().getConfig().getInt("fcooldowns.f-disband"));
|
Cooldown.setCooldown(context.fPlayer.getPlayer(), "disbandCooldown", FactionsPlugin.getInstance().getConfig().getInt("fcooldowns.f-disband"));
|
||||||
if (!context.fPlayer.canFlyAtLocation() && FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) {
|
|
||||||
context.fPlayer.setFFlying(false, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ public class CmdFly extends FCommand {
|
|||||||
|
|
||||||
public static ConcurrentHashMap<String, Boolean> flyMap = new ConcurrentHashMap<>();
|
public static ConcurrentHashMap<String, Boolean> flyMap = new ConcurrentHashMap<>();
|
||||||
public static BukkitTask particleTask = null;
|
public static BukkitTask particleTask = null;
|
||||||
public static BukkitTask flyTask = null;
|
|
||||||
public static boolean autoenable = FactionsPlugin.instance.getConfig().getBoolean("ffly.AutoEnable");
|
public static final boolean fly = FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight");
|
||||||
|
|
||||||
|
|
||||||
public CmdFly() {
|
public CmdFly() {
|
||||||
@@ -42,15 +42,12 @@ public class CmdFly extends FCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void startParticles() {
|
public static void startParticles() {
|
||||||
|
|
||||||
particleTask = Bukkit.getScheduler().runTaskTimerAsynchronously(FactionsPlugin.instance, () -> {
|
particleTask = Bukkit.getScheduler().runTaskTimerAsynchronously(FactionsPlugin.instance, () -> {
|
||||||
for (String name : flyMap.keySet()) {
|
for (String name : flyMap.keySet()) {
|
||||||
Player player = Bukkit.getPlayer(name);
|
Player player = Bukkit.getPlayer(name);
|
||||||
if (player == null) continue;
|
if (player == null) continue;
|
||||||
if (!player.isFlying()) continue;
|
if (!player.isFlying()) continue;
|
||||||
if (!FactionsPlugin.getInstance().mc17) {
|
if (!FactionsPlugin.getInstance().mc17 && player.getGameMode() == GameMode.SPECTATOR) continue;
|
||||||
if (player.getGameMode() == GameMode.SPECTATOR) continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
|
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
|
||||||
fplayer.isVanished();
|
fplayer.isVanished();
|
||||||
@@ -62,75 +59,44 @@ public class CmdFly extends FCommand {
|
|||||||
}, 10L, 3L);
|
}, 10L, 3L);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void startFlyCheck() {
|
public static boolean checkBypassPerms(FPlayer fme, Player me, Faction toFac, boolean sendMessage) {
|
||||||
flyTask = Bukkit.getScheduler().runTaskTimerAsynchronously(FactionsPlugin.instance, () -> {
|
if (Conf.denyFlightIfInNoClaimingWorld && !Conf.worldsNoClaiming.isEmpty() && Conf.worldsNoClaiming.stream().anyMatch(me.getWorld().getName()::equalsIgnoreCase))
|
||||||
checkTaskState();
|
|
||||||
if (flyMap.keySet().size() != 0) {
|
|
||||||
for (String name : flyMap.keySet()) {
|
|
||||||
if (name == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Player player = Bukkit.getPlayer(name);
|
|
||||||
if (player == null
|
|
||||||
|| !player.isFlying()
|
|
||||||
|| player.getGameMode() == GameMode.CREATIVE
|
|
||||||
|| !FactionsPlugin.getInstance().mc17 && player.getGameMode() == GameMode.SPECTATOR) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
|
||||||
if (fPlayer.isAdminBypassing()) continue;
|
|
||||||
if (!player.hasPermission("factions.fly.bypassnearbyenemycheck")) {
|
|
||||||
if (fPlayer.hasEnemiesNearby()) {
|
|
||||||
disableFlightSync(fPlayer);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
checkEnemiesSync(fPlayer);
|
|
||||||
}
|
|
||||||
FLocation myFloc = new FLocation(player.getLocation());
|
|
||||||
if (!checkFly(fPlayer, player, Board.getInstance().getFactionAt(myFloc))) {
|
|
||||||
disableFlightSync(fPlayer);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}, 20L, 15L);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean checkFly(FPlayer fme, Player me, Faction toFac) {
|
|
||||||
if ((Conf.denyFlightIfInNoClaimingWorld && !Conf.worldsNoClaiming.isEmpty() && Conf.worldsNoClaiming.stream().anyMatch(me.getWorld().getName()::equalsIgnoreCase)) || me.hasPermission(Permission.FLY_FLY.node))
|
|
||||||
return false;
|
return false;
|
||||||
if (toFac.getAccess(fme, PermissableAction.FLY) == Access.ALLOW) return true;
|
|
||||||
if (fme.getFaction().isWilderness()) return false;
|
if (toFac != fme.getFaction()) {
|
||||||
if (toFac.isSystemFaction())
|
if (!me.hasPermission(Permission.FLY_WILDERNESS.node) && toFac.isWilderness() || !me.hasPermission(Permission.FLY_SAFEZONE.node) && toFac.isSafeZone() || !me.hasPermission(Permission.FLY_WARZONE.node) && toFac.isWarZone()) {
|
||||||
return me.hasPermission(toFac.isWilderness() ? Permission.FLY_WILDERNESS.node : toFac.isSafeZone() ? Permission.FLY_SAFEZONE.node : Permission.FLY_WARZONE.node);
|
if(sendMessage) fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||||
Relation relationTo = toFac.getRelationTo(fme.getFaction());
|
return false;
|
||||||
if (!relationTo.isEnemy() && !relationTo.isMember())
|
}
|
||||||
return me.hasPermission(Permission.valueOf("FLY_" + relationTo.name()).node);
|
Access access = toFac.getAccess(fme, PermissableAction.FLY);
|
||||||
|
if ((!(me.hasPermission(Permission.FLY_ENEMY.node) || access == Access.ALLOW)) && toFac.getRelationTo(fme.getFaction()) == Relation.ENEMY) {
|
||||||
|
if(sendMessage) fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(me.hasPermission(Permission.FLY_ALLY.node) || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.ALLY) {
|
||||||
|
if(sendMessage) fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(me.hasPermission(Permission.FLY_TRUCE.node) || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.TRUCE) {
|
||||||
|
if(sendMessage) fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(me.hasPermission(Permission.FLY_NEUTRAL.node) || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.NEUTRAL && !toFac.isSystemFaction()) {
|
||||||
|
if(sendMessage) fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return me.hasPermission(Permission.FLY_FLY.node) && (access != Access.DENY || toFac.isSystemFaction());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static void checkTaskState() {
|
|
||||||
if (flyMap.isEmpty()) {
|
|
||||||
flyTask.cancel();
|
|
||||||
flyTask = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void disableFlight(final FPlayer fme) {
|
public static void disableFlight(final FPlayer fme) {
|
||||||
fme.setFlying(false);
|
fme.setFlying(false);
|
||||||
flyMap.remove(fme.getPlayer().getName());
|
flyMap.remove(fme.getPlayer().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void disableFlightSync(FPlayer fme) {
|
|
||||||
Bukkit.getScheduler().runTask(FactionsPlugin.instance, () -> fme.setFFlying(false, false));
|
|
||||||
flyMap.remove(fme.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void checkEnemiesSync(FPlayer fp) {
|
|
||||||
Bukkit.getScheduler().runTask(FactionsPlugin.instance, fp::checkIfNearbyEnemies);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isInFlightChecker(Player player) {
|
public boolean isInFlightChecker(Player player) {
|
||||||
return flyMap.containsKey(player.getName());
|
return flyMap.containsKey(player.getName());
|
||||||
@@ -155,7 +121,7 @@ public class CmdFly extends FCommand {
|
|||||||
|
|
||||||
FLocation myfloc = new FLocation(context.player.getLocation());
|
FLocation myfloc = new FLocation(context.player.getLocation());
|
||||||
Faction toFac = Board.getInstance().getFactionAt(myfloc);
|
Faction toFac = Board.getInstance().getFactionAt(myfloc);
|
||||||
if (!checkFly(context.fPlayer, context.player, toFac)) {
|
if (!checkBypassPerms(context.fPlayer, context.player, toFac, false)) {
|
||||||
context.fPlayer.sendMessage(TL.COMMAND_FLY_NO_ACCESS.format(toFac.getTag()));
|
context.fPlayer.sendMessage(TL.COMMAND_FLY_NO_ACCESS.format(toFac.getTag()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -175,17 +141,15 @@ public class CmdFly extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fme.canFlyAtLocation()) {
|
||||||
context.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", () -> {
|
context.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", () -> {
|
||||||
fme.setFlying(true);
|
fme.setFlying(true);
|
||||||
flyMap.put(fme.getPlayer().getName(), true);
|
flyMap.put(fme.getPlayer().getName(), true);
|
||||||
if (particleTask == null) {
|
if (particleTask == null) startParticles();
|
||||||
startParticles();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flyTask == null) {
|
|
||||||
startFlyCheck();
|
|
||||||
}
|
|
||||||
}, FactionsPlugin.getInstance().getConfig().getLong("warmups.f-fly", 0));
|
}, FactionsPlugin.getInstance().getConfig().getLong("warmups.f-fly", 0));
|
||||||
|
} else {
|
||||||
|
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(fme.getLastStoodAt()).getTag());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.util.ItemBuilder;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.Inventory;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class CmdGetVault extends FCommand {
|
public class CmdGetVault extends FCommand {
|
||||||
@@ -30,9 +30,13 @@ public class CmdGetVault extends FCommand {
|
|||||||
context.fPlayer.msg(TL.GENERIC_DISABLED, "Faction Vaults");
|
context.fPlayer.msg(TL.GENERIC_DISABLED, "Faction Vaults");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Location vaultLocation = context.faction.getVault();
|
|
||||||
ItemStack vault = FactionsPlugin.getInstance().createItem(Material.CHEST, 1, (short) 0, FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fvault.Item.Name")), FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fvault.Item.Lore")));
|
|
||||||
|
|
||||||
|
Location vaultLocation = context.faction.getVault();
|
||||||
|
ItemStack vault = new ItemBuilder(Material.CHEST)
|
||||||
|
.amount(1)
|
||||||
|
.name(FactionsPlugin.getInstance().getConfig().getString("fvault.Item.Name"))
|
||||||
|
.lore(FactionsPlugin.getInstance().getConfig().getStringList("fvault.Item.Lore"))
|
||||||
|
.build();
|
||||||
|
|
||||||
//check if vault is set
|
//check if vault is set
|
||||||
if (vaultLocation != null) {
|
if (vaultLocation != null) {
|
||||||
@@ -40,36 +44,19 @@ public class CmdGetVault extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//has enough money?
|
//has enough money?
|
||||||
int amount = FactionsPlugin.getInstance().getConfig().getInt("fvault.Price");
|
int amount = FactionsPlugin.getInstance().getConfig().getInt("fvault.Price");
|
||||||
if (!context.fPlayer.hasMoney(amount)) {
|
if (!context.fPlayer.hasMoney(amount)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!context.fPlayer.takeMoney(amount)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//success :)
|
//success :)
|
||||||
|
context.fPlayer.takeMoney(amount);
|
||||||
context.player.getInventory().addItem(vault);
|
context.player.getInventory().addItem(vault);
|
||||||
context.fPlayer.msg(TL.COMMAND_GETVAULT_RECEIVE);
|
context.fPlayer.msg(TL.COMMAND_GETVAULT_RECEIVE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean inventoryContains(Inventory inventory, ItemStack item) {
|
|
||||||
int count = 0;
|
|
||||||
ItemStack[] items = inventory.getContents();
|
|
||||||
for (int i = 0; i < items.length; i++) {
|
|
||||||
if (items[i] != null && items[i].getType() == item.getType() && items[i].getDurability() == item.getDurability()) {
|
|
||||||
count += items[i].getAmount();
|
|
||||||
}
|
|
||||||
if (count >= item.getAmount()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TL getUsageTranslation() {
|
public TL getUsageTranslation() {
|
||||||
|
|||||||
@@ -60,14 +60,11 @@ public class CmdInvite extends FCommand {
|
|||||||
// Send the invitation to the target player when online, otherwise just ignore
|
// Send the invitation to the target player when online, otherwise just ignore
|
||||||
if (target.isOnline()) {
|
if (target.isOnline()) {
|
||||||
// Tooltips, colors, and commands only apply to the string immediately before it.
|
// Tooltips, colors, and commands only apply to the string immediately before it.
|
||||||
FancyMessage message = new FancyMessage(context.fPlayer.describeTo(target, true))
|
FancyMessage message = new FancyMessage(TL.COMMAND_INVITE_INVITEDYOU.toString()
|
||||||
|
.replace("%1$s", context.fPlayer.describeTo(target, true))
|
||||||
|
.replace("%2$s", context.faction.getTag())
|
||||||
|
.replaceAll("&", "§"))
|
||||||
.tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
|
.tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
|
||||||
.command("/" + Conf.baseCommandAliases.get(0) + " join " + context.faction.getTag())
|
|
||||||
.then(TL.COMMAND_INVITE_INVITEDYOU.toString())
|
|
||||||
.color(ChatColor.YELLOW)
|
|
||||||
.tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
|
|
||||||
.command("/" + Conf.baseCommandAliases.get(0) + " join " + context.faction.getTag())
|
|
||||||
.then(context.faction.describeTo(target)).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
|
|
||||||
.command("/" + Conf.baseCommandAliases.get(0) + " join " + context.faction.getTag());
|
.command("/" + Conf.baseCommandAliases.get(0) + " join " + context.faction.getTag());
|
||||||
message.send(target.getPlayer());
|
message.send(target.getPlayer());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class CmdJoin extends FCommand {
|
|||||||
|
|
||||||
int altLimit = Conf.factionAltMemberLimit;
|
int altLimit = Conf.factionAltMemberLimit;
|
||||||
|
|
||||||
if (altLimit > 0 && faction.getAltPlayers().size() >= altLimit && !faction.altInvited(context.fPlayer)) {
|
if (altLimit > 0 && faction.getAltPlayers().size() >= altLimit && faction.altInvited(context.fPlayer)) {
|
||||||
context.msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(context.fPlayer), altLimit, fplayer.describeTo(context.fPlayer, false));
|
context.msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(context.fPlayer), altLimit, fplayer.describeTo(context.fPlayer, false));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -115,8 +115,6 @@ public class CmdJoin extends FCommand {
|
|||||||
fplayer.msg(TL.COMMAND_JOIN_MOVED, context.fPlayer.describeTo(fplayer, true), faction.getTag(fplayer));
|
fplayer.msg(TL.COMMAND_JOIN_MOVED, context.fPlayer.describeTo(fplayer, true), faction.getTag(fplayer));
|
||||||
}
|
}
|
||||||
|
|
||||||
faction.msg(TL.COMMAND_JOIN_JOINED, fplayer.describeTo(faction, true));
|
|
||||||
|
|
||||||
fplayer.resetFactionData();
|
fplayer.resetFactionData();
|
||||||
|
|
||||||
if (faction.altInvited(fplayer)) {
|
if (faction.altInvited(fplayer)) {
|
||||||
@@ -144,6 +142,8 @@ public class CmdJoin extends FCommand {
|
|||||||
System.out.print(e.getMessage());
|
System.out.print(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
faction.msg(TL.COMMAND_JOIN_JOINED, fplayer.describeTo(faction, true));
|
||||||
|
|
||||||
if (Conf.logFactionJoin) {
|
if (Conf.logFactionJoin) {
|
||||||
if (samePlayer) {
|
if (samePlayer) {
|
||||||
FactionsPlugin.getInstance().log(TL.COMMAND_JOIN_JOINEDLOG.toString(), fplayer.getName(), faction.getTag());
|
FactionsPlugin.getInstance().log(TL.COMMAND_JOIN_JOINEDLOG.toString(), fplayer.getName(), faction.getTag());
|
||||||
|
|||||||
@@ -30,10 +30,6 @@ public class CmdReload extends FCommand {
|
|||||||
FactionsPlugin.getInstance().loadLang();
|
FactionsPlugin.getInstance().loadLang();
|
||||||
|
|
||||||
|
|
||||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight", false)) {
|
|
||||||
FactionsPlugin.getInstance().factionsFlight = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!FactionsPlugin.getInstance().mc17) {
|
if (!FactionsPlugin.getInstance().mc17) {
|
||||||
FactionsPlayerListener.loadCorners();
|
FactionsPlayerListener.loadCorners();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,17 +24,21 @@ public class CmdShow extends FCommand {
|
|||||||
this.aliases.addAll(Aliases.show_show);
|
this.aliases.addAll(Aliases.show_show);
|
||||||
|
|
||||||
// add defaults to /f show in case config doesnt have it
|
// add defaults to /f show in case config doesnt have it
|
||||||
defaults.add("{header}");
|
defaults.add("&8&m--------------&7 &8<&e{faction}&8> &8&m--------------");
|
||||||
defaults.add("<a>Description: <i>{description}");
|
defaults.add("&4* &cOwner: &f{leader}");
|
||||||
defaults.add("<a>Joining: <i>{joining} {peaceful}");
|
defaults.add("&4* &cDescription: &f{description}");
|
||||||
defaults.add("<a>Land / Power / Maxpower: <i> {chunks} / {power} / {maxPower}");
|
defaults.add("&4* &cLand / Power / Max Power: &f{chunks} &8/ &f{power} &8/ &f{maxPower}");
|
||||||
defaults.add("<a>Founded: <i>{create-date}");
|
defaults.add("&4* &cFaction Strikes: &f{strikes}");
|
||||||
defaults.add("<a>This faction is permanent, remaining even with no members.");
|
defaults.add("&4* &cFaction Points: &f{faction-points}");
|
||||||
defaults.add("<a>Land value: <i>{land-value} {land-refund}");
|
defaults.add("&4* &cFounded: &f{create-date}");
|
||||||
defaults.add("<a>Balance: <i>{faction-balance}");
|
defaults.add("&4* &cBalance: &f{faction-balance}");
|
||||||
defaults.add("<a>Allies(<i>{allies}<a>/<i>{max-allies}<a>): {allies-list}");
|
defaults.add("&4* &cAllies: &a{allies-list}");
|
||||||
defaults.add("<a>Online: (<i>{online}<a>/<i>{members}<a>): {online-list}");
|
defaults.add("&4* &cEnemies: &4{enemies-list}");
|
||||||
defaults.add("<a>Offline: (<i>{offline}<a>/<i>{members}<a>): {offline-list}");
|
defaults.add("&4* &cOnline Members: &8[&f{online}/{members}&8] &a{online-list}");
|
||||||
|
defaults.add("&4* &cOffline Members: &8[&f{offline}/{members}&8] &a{offline-list}");
|
||||||
|
defaults.add("&4* &cAlts: &f{alts}");
|
||||||
|
defaults.add("&4* &cBans: &f{faction-bancount}");
|
||||||
|
defaults.add("&8&m----------------------------------------");
|
||||||
|
|
||||||
// this.requiredArgs.add("");
|
// this.requiredArgs.add("");
|
||||||
this.optionalArgs.put("faction tag", "yours");
|
this.optionalArgs.put("faction tag", "yours");
|
||||||
@@ -45,6 +49,7 @@ public class CmdShow extends FCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
Faction faction = context.faction;
|
Faction faction = context.faction;
|
||||||
|
FactionsPlugin instance = FactionsPlugin.getInstance();
|
||||||
if (context.argIsSet(0))
|
if (context.argIsSet(0))
|
||||||
faction = context.argAsFaction(0);
|
faction = context.argAsFaction(0);
|
||||||
|
|
||||||
@@ -52,7 +57,7 @@ public class CmdShow extends FCommand {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (context.fPlayer != null && !context.player.getPlayer().hasPermission("factions.show.bypassexempt")
|
if (context.fPlayer != null && !context.player.getPlayer().hasPermission("factions.show.bypassexempt")
|
||||||
&& FactionsPlugin.getInstance().getConfig().getStringList("show-exempt").contains(faction.getTag())) {
|
&& instance.getConfig().getStringList("show-exempt").contains(faction.getTag())) {
|
||||||
context.msg(TL.COMMAND_SHOW_EXEMPT);
|
context.msg(TL.COMMAND_SHOW_EXEMPT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -62,7 +67,7 @@ public class CmdShow extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> show = FactionsPlugin.getInstance().getConfig().getStringList("show");
|
List<String> show = instance.getConfig().getStringList("show");
|
||||||
if (show == null || show.isEmpty())
|
if (show == null || show.isEmpty())
|
||||||
show = defaults;
|
show = defaults;
|
||||||
|
|
||||||
@@ -71,13 +76,14 @@ public class CmdShow extends FCommand {
|
|||||||
// send header and that's all
|
// send header and that's all
|
||||||
String header = show.get(0);
|
String header = show.get(0);
|
||||||
if (TagReplacer.HEADER.contains(header)) {
|
if (TagReplacer.HEADER.contains(header)) {
|
||||||
context.msg(FactionsPlugin.getInstance().txt.titleize(tag));
|
context.msg(instance.txt.titleize(tag));
|
||||||
} else {
|
} else {
|
||||||
context.msg(FactionsPlugin.getInstance().txt.parse(TagReplacer.FACTION.replace(header, tag)));
|
context.msg(instance.txt.parse(TagReplacer.FACTION.replace(header, tag)));
|
||||||
}
|
}
|
||||||
return; // we only show header for non-normal factions
|
return; // we only show header for non-normal factions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<FancyMessage> fancy = new ArrayList<>();
|
||||||
for (String raw : show) {
|
for (String raw : show) {
|
||||||
String parsed = TagUtil.parsePlain(faction, context.fPlayer, raw); // use relations
|
String parsed = TagUtil.parsePlain(faction, context.fPlayer, raw); // use relations
|
||||||
if (parsed == null) {
|
if (parsed == null) {
|
||||||
@@ -89,9 +95,9 @@ public class CmdShow extends FCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (TagUtil.hasFancy(parsed)) {
|
if (TagUtil.hasFancy(parsed)) {
|
||||||
List<FancyMessage> fancy = TagUtil.parseFancy(faction, context.fPlayer, parsed);
|
List<FancyMessage> localFancy = TagUtil.parseFancy(faction, context.fPlayer, parsed);
|
||||||
if (fancy != null)
|
if (localFancy != null)
|
||||||
context.sendFancyMessage(fancy);
|
fancy.addAll(localFancy);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -103,9 +109,12 @@ public class CmdShow extends FCommand {
|
|||||||
if (parsed.contains("%")) {
|
if (parsed.contains("%")) {
|
||||||
parsed = parsed.replaceAll("%", ""); // Just in case it got in there before we disallowed it.
|
parsed = parsed.replaceAll("%", ""); // Just in case it got in there before we disallowed it.
|
||||||
}
|
}
|
||||||
context.msg(FactionsPlugin.getInstance().txt.parse(parsed));
|
parsed = FactionsPlugin.getInstance().txt.parse(parsed);
|
||||||
|
FancyMessage localFancy = instance.txt.parseFancy(parsed);
|
||||||
|
fancy.add(localFancy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
instance.getServer().getScheduler().runTask(instance, () -> context.sendFancyMessage(fancy));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.google.common.collect.ArrayListMultimap;
|
|||||||
import com.google.common.collect.ListMultimap;
|
import com.google.common.collect.ListMultimap;
|
||||||
import com.massivecraft.factions.FLocation;
|
import com.massivecraft.factions.FLocation;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
public class CmdShowClaims extends FCommand {
|
public class CmdShowClaims extends FCommand {
|
||||||
@@ -16,6 +17,7 @@ public class CmdShowClaims extends FCommand {
|
|||||||
this.aliases.addAll(Aliases.show_claims);
|
this.aliases.addAll(Aliases.show_claims);
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.SHOWCLAIMS)
|
this.requirements = new CommandRequirements.Builder(Permission.SHOWCLAIMS)
|
||||||
|
.withAction(PermissableAction.TERRITORY)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
.memberOnly()
|
.memberOnly()
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class CmdShowInvites extends FCommand {
|
|||||||
String name = fp != null ? fp.getName() : id;
|
String name = fp != null ? fp.getName() : id;
|
||||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_SHOWINVITES_CLICKTOREVOKE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_SHOWINVITES_CLICKTOREVOKE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||||
}
|
}
|
||||||
|
context.sendFancyMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class CmdStealth extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (!Conf.useSealthSystem) {
|
if (!Conf.useStealthSystem) {
|
||||||
context.msg(TL.GENERIC_DISABLED, "Factions Stealth");
|
context.msg(TL.GENERIC_DISABLED, "Factions Stealth");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.massivecraft.factions.struct.Permission;
|
|||||||
import com.massivecraft.factions.zcore.fperms.Access;
|
import com.massivecraft.factions.zcore.fperms.Access;
|
||||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
public class CmdUnban extends FCommand {
|
public class CmdUnban extends FCommand {
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ public class CmdUnban extends FCommand {
|
|||||||
context.faction.unban(target);
|
context.faction.unban(target);
|
||||||
|
|
||||||
context.msg(TL.COMMAND_UNBAN_UNBANNED, context.fPlayer.getName(), target.getName());
|
context.msg(TL.COMMAND_UNBAN_UNBANNED, context.fPlayer.getName(), target.getName());
|
||||||
target.msg(TL.COMMAND_UNBAN_TARGET, context.faction.getTag(target));
|
target.msg(TL.COMMAND_UNBAN_TARGETUNBANNED, context.faction.getTag(target));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -399,11 +399,9 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
|
|||||||
addSubCommand(this.cmdFocus);
|
addSubCommand(this.cmdFocus);
|
||||||
fFocusEnabled = true;
|
fFocusEnabled = true;
|
||||||
}
|
}
|
||||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight", false) && !fFlyEnabled) {
|
if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight", true) && !fFlyEnabled) {
|
||||||
this.addSubCommand(this.cmdFly);
|
this.addSubCommand(this.cmdFly);
|
||||||
fFlyEnabled = true;
|
fFlyEnabled = true;
|
||||||
CmdFly.startFlyCheck();
|
|
||||||
CmdFly.startParticles();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,10 @@ public class AntiChestListener implements Listener {
|
|||||||
if (e.isCancelled()) return;
|
if (e.isCancelled()) return;
|
||||||
|
|
||||||
Inventory clicked = e.getClickedInventory();
|
Inventory clicked = e.getClickedInventory();
|
||||||
|
Inventory clicker = e.getWhoClicked().getInventory();
|
||||||
|
|
||||||
if (e.getClick().isShiftClick()) {
|
if (e.getClick().isShiftClick()) {
|
||||||
if (clicked == e.getWhoClicked().getInventory()) {
|
if (clicked == clicker) {
|
||||||
ItemStack clickedOn = e.getCurrentItem();
|
ItemStack clickedOn = e.getCurrentItem();
|
||||||
if (clickedOn != null && FactionsPlugin.getInstance().itemList.contains(clickedOn.getType().toString())) {
|
if (clickedOn != null && FactionsPlugin.getInstance().itemList.contains(clickedOn.getType().toString())) {
|
||||||
fPlayer.msg(TL.CHEST_ITEM_DENIED_TRANSFER, clickedOn.getType().toString());
|
fPlayer.msg(TL.CHEST_ITEM_DENIED_TRANSFER, clickedOn.getType().toString());
|
||||||
@@ -38,11 +39,17 @@ public class AntiChestListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clicked != e.getWhoClicked().getInventory()) {
|
if (clicked != clicker) {
|
||||||
ItemStack onCursor = e.getCursor();
|
ItemStack onCursor = e.getCursor();
|
||||||
if (onCursor != null && FactionsPlugin.getInstance().itemList.contains(onCursor.getType().toString())) {
|
if (onCursor != null && FactionsPlugin.getInstance().itemList.contains(onCursor.getType().toString())) {
|
||||||
fPlayer.msg(TL.CHEST_ITEM_DENIED_TRANSFER, onCursor.getType().toString());
|
fPlayer.msg(TL.CHEST_ITEM_DENIED_TRANSFER, onCursor.getType().toString());
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
} else if (e.getClick().isKeyboardClick()) {
|
||||||
|
ItemStack item = clicker.getItem(e.getHotbarButton());
|
||||||
|
if (item != null && FactionsPlugin.getInstance().itemList.contains(item.getType().toString())) {
|
||||||
|
fPlayer.msg(TL.CHEST_ITEM_DENIED_TRANSFER, item.getType().toString());
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.massivecraft.factions.cmd.claim;
|
package com.massivecraft.factions.cmd.claim;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Board;
|
||||||
import com.massivecraft.factions.FLocation;
|
import com.massivecraft.factions.FLocation;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
@@ -62,12 +63,16 @@ public class CmdAutoClaim extends FCommand {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Faction at = Board.getInstance().getFactionAt(new FLocation(context.fPlayer.getPlayer().getLocation()));
|
||||||
context.fPlayer.setAutoClaimFor(forFaction);
|
context.fPlayer.setAutoClaimFor(forFaction);
|
||||||
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", new FLocation(context.fPlayer.getPlayer().getLocation()).formatXAndZ(","));
|
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", new FLocation(context.fPlayer.getPlayer().getLocation()).formatXAndZ(","));
|
||||||
context.msg(TL.COMMAND_AUTOCLAIM_ENABLED, forFaction.describeTo(context.fPlayer));
|
context.msg(TL.COMMAND_AUTOCLAIM_ENABLED, forFaction.describeTo(context.fPlayer));
|
||||||
|
if (FactionsPlugin.cachedRadiusClaim && context.fPlayer.attemptClaim(forFaction, context.player.getLocation(), true)) {
|
||||||
|
context.fPlayer.getFaction().getFPlayersWhereOnline(true).forEach(f -> f.msg(TL.CLAIM_CLAIMED, context.fPlayer.describeTo(f, true), context.fPlayer.getFaction().describeTo(f), at.describeTo(f)));
|
||||||
|
} else {
|
||||||
context.fPlayer.attemptClaim(forFaction, context.fPlayer.getPlayer().getLocation(), true);
|
context.fPlayer.attemptClaim(forFaction, context.fPlayer.getPlayer().getLocation(), true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TL getUsageTranslation() {
|
public TL getUsageTranslation() {
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package com.massivecraft.factions.cmd.claim;
|
package com.massivecraft.factions.cmd.claim;
|
||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.*;
|
||||||
import com.massivecraft.factions.FLocation;
|
|
||||||
import com.massivecraft.factions.Faction;
|
|
||||||
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;
|
||||||
import com.massivecraft.factions.cmd.CommandRequirements;
|
import com.massivecraft.factions.cmd.CommandRequirements;
|
||||||
@@ -59,8 +56,14 @@ public class CmdClaim extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Faction at = Board.getInstance().getFactionAt(new FLocation(context.fPlayer.getPlayer().getLocation()));
|
||||||
|
|
||||||
if (radius < 2) {
|
if (radius < 2) {
|
||||||
// single chunk
|
if (FactionsPlugin.cachedRadiusClaim && context.fPlayer.attemptClaim(forFaction, context.player.getLocation(), false)) {
|
||||||
|
context.fPlayer.getFaction().getFPlayersWhereOnline(true).forEach(f -> f.msg(TL.CLAIM_CLAIMED, context.fPlayer.describeTo(f, true), context.fPlayer.getFaction().describeTo(f), at.describeTo(f)));
|
||||||
|
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", (new FLocation(context.fPlayer.getPlayer().getLocation())).formatXAndZ(","));
|
||||||
|
return;
|
||||||
|
}
|
||||||
context.fPlayer.attemptClaim(forFaction, context.player.getLocation(), true);
|
context.fPlayer.attemptClaim(forFaction, context.player.getLocation(), true);
|
||||||
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", (new FLocation(context.fPlayer.getPlayer().getLocation())).formatXAndZ(","));
|
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", (new FLocation(context.fPlayer.getPlayer().getLocation())).formatXAndZ(","));
|
||||||
} else {
|
} else {
|
||||||
@@ -68,16 +71,17 @@ public class CmdClaim extends FCommand {
|
|||||||
if (!Permission.CLAIM_RADIUS.has(context.sender, true)) {
|
if (!Permission.CLAIM_RADIUS.has(context.sender, true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
new SpiralTask(new FLocation(context.player), radius) {
|
new SpiralTask(new FLocation(context.player), radius) {
|
||||||
private final int limit = Conf.radiusClaimFailureLimit - 1;
|
private final int limit = Conf.radiusClaimFailureLimit - 1;
|
||||||
private int failCount = 0;
|
private int failCount = 0;
|
||||||
|
private int successfulClaims = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean work() {
|
public boolean work() {
|
||||||
boolean success = context.fPlayer.attemptClaim(forFaction, this.currentLocation(), true);
|
boolean success = context.fPlayer.attemptClaim(forFaction, this.currentLocation(), true);
|
||||||
if (success) {
|
if (success) {
|
||||||
failCount = 0;
|
failCount = 0;
|
||||||
|
successfulClaims++;
|
||||||
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", (new FLocation(context.fPlayer.getPlayer().getLocation())).formatXAndZ(","));
|
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", (new FLocation(context.fPlayer.getPlayer().getLocation())).formatXAndZ(","));
|
||||||
} else if (failCount++ >= limit) {
|
} else if (failCount++ >= limit) {
|
||||||
this.stop();
|
this.stop();
|
||||||
@@ -85,6 +89,15 @@ public class CmdClaim extends FCommand {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void finish() {
|
||||||
|
if (FactionsPlugin.cachedRadiusClaim) {
|
||||||
|
if (successfulClaims > 0) {
|
||||||
|
context.fPlayer.getFaction().getFPlayersWhereOnline(true).forEach(f -> f.msg(TL.CLAIM_RADIUS_CLAIM, context.fPlayer.describeTo(f, true), String.valueOf(successfulClaims), context.fPlayer.getPlayer().getLocation().getChunk().getX(), context.fPlayer.getPlayer().getLocation().getChunk().getZ()));
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd.claim;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Board;
|
import com.massivecraft.factions.Board;
|
||||||
import com.massivecraft.factions.FLocation;
|
import com.massivecraft.factions.FLocation;
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
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;
|
||||||
@@ -39,6 +40,15 @@ public class CmdClaimAt extends FCommand {
|
|||||||
int x = context.argAsInt(1);
|
int x = context.argAsInt(1);
|
||||||
int z = context.argAsInt(2);
|
int z = context.argAsInt(2);
|
||||||
FLocation location = new FLocation(context.argAsString(0), x, z);
|
FLocation location = new FLocation(context.argAsString(0), x, z);
|
||||||
|
|
||||||
|
Faction at = Board.getInstance().getFactionAt(new FLocation(context.fPlayer.getPlayer().getLocation()));
|
||||||
|
|
||||||
|
if (FactionsPlugin.cachedRadiusClaim && context.fPlayer.attemptClaim(context.fPlayer.getFaction(), context.player.getLocation(), true)) {
|
||||||
|
context.fPlayer.getFaction().getFPlayersWhereOnline(true).forEach(f -> f.msg(TL.CLAIM_CLAIMED, context.fPlayer.describeTo(f, true), context.fPlayer.getFaction().describeTo(f), at.describeTo(f)));
|
||||||
|
FactionsPlugin.instance.logFactionEvent(context.fPlayer.getFaction(), FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", (new FLocation(context.fPlayer.getPlayer().getLocation())).formatXAndZ(","));
|
||||||
|
showMap(context);
|
||||||
|
return;
|
||||||
|
}
|
||||||
context.fPlayer.attemptClaim(context.faction, location, true);
|
context.fPlayer.attemptClaim(context.faction, location, true);
|
||||||
FactionsPlugin.instance.logFactionEvent(context.fPlayer.getFaction(), FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", (location).formatXAndZ(","));
|
FactionsPlugin.instance.logFactionEvent(context.fPlayer.getFaction(), FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", (location).formatXAndZ(","));
|
||||||
showMap(context);
|
showMap(context);
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package com.massivecraft.factions.cmd.claim;
|
package com.massivecraft.factions.cmd.claim;
|
||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.*;
|
||||||
import com.massivecraft.factions.FLocation;
|
|
||||||
import com.massivecraft.factions.Faction;
|
|
||||||
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;
|
||||||
import com.massivecraft.factions.cmd.CommandRequirements;
|
import com.massivecraft.factions.cmd.CommandRequirements;
|
||||||
@@ -71,6 +68,7 @@ public class CmdClaimLine extends FCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Faction forFaction = context.argAsFaction(2, context.faction);
|
final Faction forFaction = context.argAsFaction(2, context.faction);
|
||||||
|
Faction at = Board.getInstance().getFactionAt(new FLocation(context.fPlayer.getPlayer().getLocation()));
|
||||||
|
|
||||||
if (forFaction != context.fPlayer.getFaction()) {
|
if (forFaction != context.fPlayer.getFaction()) {
|
||||||
if (!context.fPlayer.isAdminBypassing()) {
|
if (!context.fPlayer.isAdminBypassing()) {
|
||||||
@@ -84,11 +82,20 @@ public class CmdClaimLine extends FCommand {
|
|||||||
Location location = context.player.getLocation();
|
Location location = context.player.getLocation();
|
||||||
|
|
||||||
// TODO: make this a task like claiming a radius?
|
// TODO: make this a task like claiming a radius?
|
||||||
|
int claims = 0;
|
||||||
|
|
||||||
for (int i = 0; i < amount; i++) {
|
for (int i = 0; i < amount; i++) {
|
||||||
|
if (FactionsPlugin.cachedRadiusClaim && context.fPlayer.attemptClaim(forFaction, context.player.getLocation(), false)) {
|
||||||
|
claims++;
|
||||||
|
} else {
|
||||||
context.fPlayer.attemptClaim(forFaction, location, true);
|
context.fPlayer.attemptClaim(forFaction, location, true);
|
||||||
|
claims++;
|
||||||
|
}
|
||||||
location = location.add(blockFace.getModX() * 16, 0, blockFace.getModZ() * 16);
|
location = location.add(blockFace.getModX() * 16, 0, blockFace.getModZ() * 16);
|
||||||
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", String.valueOf(i), new FLocation(context.player.getLocation()).formatXAndZ(","));
|
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", String.valueOf(i), new FLocation(context.player.getLocation()).formatXAndZ(","));
|
||||||
}
|
}
|
||||||
|
int cachedClaims = claims;
|
||||||
|
context.fPlayer.getFaction().getFPlayersWhereOnline(true).forEach(f -> f.msg(TL.CLAIM_RADIUS_CLAIM, context.fPlayer.describeTo(f, true), String.valueOf(cachedClaims), context.fPlayer.getPlayer().getLocation().getChunk().getX(), context.fPlayer.getPlayer().getLocation().getChunk().getZ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -57,6 +57,16 @@ public class FPromoteCommand extends FCommand {
|
|||||||
context.msg(TL.COMMAND_PROMOTE_NOT_SAME);
|
context.msg(TL.COMMAND_PROMOTE_NOT_SAME);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Don't allow people to promote people with same or higher rank than their.
|
||||||
|
if (context.fPlayer.getRole().value <= target.getRole().value) {
|
||||||
|
context.msg(TL.COMMAND_PROMOTE_HIGHER_RANK, target.getName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Don't allow people to demote people who already have the lowest rank.
|
||||||
|
if (current.value == 0 && relative <= 0) {
|
||||||
|
context.msg(TL.COMMAND_PROMOTE_LOWEST_RANK, target.getName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Don't allow people to promote people to their same or higher rank.
|
// Don't allow people to promote people to their same or higher rank.
|
||||||
if (context.fPlayer.getRole().value <= promotion.value) {
|
if (context.fPlayer.getRole().value <= promotion.value) {
|
||||||
context.msg(TL.COMMAND_PROMOTE_NOT_ALLOWED);
|
context.msg(TL.COMMAND_PROMOTE_NOT_ALLOWED);
|
||||||
@@ -64,11 +74,16 @@ public class FPromoteCommand extends FCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (promotion == null) {
|
// Don't allow people to demote people who already have the lowest rank.
|
||||||
context.msg(TL.COMMAND_PROMOTE_NOTTHATPLAYER);
|
if (current.value == 0 && relative <= 0) {
|
||||||
|
context.msg(TL.COMMAND_PROMOTE_LOWEST_RANK, target.getName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Don't allow people to promote people who already have the highest rank.
|
||||||
|
if (current.value == 4 && relative > 0) {
|
||||||
|
context.msg(TL.COMMAND_PROMOTE_HIGHEST_RANK, target.getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't allow people to promote people to their same or higher rnak.
|
// Don't allow people to promote people to their same or higher rnak.
|
||||||
if (context.fPlayer.getRole().value <= promotion.value) {
|
if (context.fPlayer.getRole().value <= promotion.value) {
|
||||||
context.msg(TL.COMMAND_PROMOTE_NOT_ALLOWED);
|
context.msg(TL.COMMAND_PROMOTE_NOT_ALLOWED);
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
package com.massivecraft.factions.cmd.wild;
|
package com.massivecraft.factions.cmd.wild;
|
||||||
|
|
||||||
|
|
||||||
import com.massivecraft.factions.Board;
|
import com.massivecraft.factions.*;
|
||||||
import com.massivecraft.factions.FLocation;
|
|
||||||
import com.massivecraft.factions.FPlayers;
|
|
||||||
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;
|
||||||
import com.massivecraft.factions.cmd.CommandRequirements;
|
import com.massivecraft.factions.cmd.CommandRequirements;
|
||||||
@@ -14,6 +11,7 @@ import com.massivecraft.factions.util.wait.WaitedTask;
|
|||||||
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.World;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
@@ -22,8 +20,12 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DroppingAnvil
|
||||||
|
*/
|
||||||
public class CmdWild extends FCommand implements WaitedTask {
|
public class CmdWild extends FCommand implements WaitedTask {
|
||||||
public static HashMap<Player, String> teleportRange;
|
public static HashMap<Player, String> teleportRange;
|
||||||
public static HashSet<Player> teleporting;
|
public static HashSet<Player> teleporting;
|
||||||
@@ -44,8 +46,6 @@ public class CmdWild extends FCommand implements WaitedTask {
|
|||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (!teleportRange.containsKey(context.player)) {
|
if (!teleportRange.containsKey(context.player)) {
|
||||||
context.player.openInventory(new WildGUI(context.player, context.fPlayer).getInventory());
|
context.player.openInventory(new WildGUI(context.player, context.fPlayer).getInventory());
|
||||||
} else {
|
|
||||||
context.fPlayer.msg(TL.COMMAND_WILD_WAIT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,16 +55,18 @@ public class CmdWild extends FCommand implements WaitedTask {
|
|||||||
int tries = 0;
|
int tries = 0;
|
||||||
ConfigurationSection c = FactionsPlugin.getInstance().getConfig().getConfigurationSection("Wild.Zones." + teleportRange.get(p));
|
ConfigurationSection c = FactionsPlugin.getInstance().getConfig().getConfigurationSection("Wild.Zones." + teleportRange.get(p));
|
||||||
while (tries < 5) {
|
while (tries < 5) {
|
||||||
|
assert c != null;
|
||||||
int x = new Random().nextInt((c.getInt("Range.MaxX") - c.getInt("Range.MinX")) + 1) + c.getInt("Range.MinX");
|
int x = new Random().nextInt((c.getInt("Range.MaxX") - c.getInt("Range.MinX")) + 1) + c.getInt("Range.MinX");
|
||||||
int z = new Random().nextInt((c.getInt("Range.MaxZ") - c.getInt("Range.MinZ")) + 1) + c.getInt("Range.MinZ");
|
int z = new Random().nextInt((c.getInt("Range.MaxZ") - c.getInt("Range.MinZ")) + 1) + c.getInt("Range.MinZ");
|
||||||
if (Board.getInstance().getFactionAt(new FLocation(p.getWorld().getName(), x, z)).isWilderness()) {
|
if (Board.getInstance().getFactionAt(new FLocation(p.getWorld().getName(), x, z)).isWilderness()) {
|
||||||
success = true;
|
success = true;
|
||||||
FLocation loc = new FLocation(p.getWorld().getName(), x, z);
|
FLocation loc = new FLocation(Objects.requireNonNull(c.getString("World", "World")), x, z);
|
||||||
teleportRange.remove(p);
|
teleportRange.remove(p);
|
||||||
if (!FPlayers.getInstance().getByPlayer(p).takeMoney(c.getInt("Cost"))) {
|
if (!FPlayers.getInstance().getByPlayer(p).takeMoney(c.getInt("Cost"))) {
|
||||||
p.sendMessage(TL.GENERIC_NOTENOUGHMONEY.toString());
|
p.sendMessage(TL.GENERIC_NOTENOUGHMONEY.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (Conf.wildLoadChunkBeforeTeleport && !loc.getChunk().isLoaded()) loc.getChunk().load();
|
||||||
teleportPlayer(p, loc);
|
teleportPlayer(p, loc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -72,6 +74,7 @@ public class CmdWild extends FCommand implements WaitedTask {
|
|||||||
}
|
}
|
||||||
if (!success) {
|
if (!success) {
|
||||||
p.sendMessage(TL.COMMAND_WILD_FAILED.toString());
|
p.sendMessage(TL.COMMAND_WILD_FAILED.toString());
|
||||||
|
teleportRange.remove(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +92,7 @@ public class CmdWild extends FCommand implements WaitedTask {
|
|||||||
|
|
||||||
public void applyEffects(Player p) {
|
public void applyEffects(Player p) {
|
||||||
for (String s : FactionsPlugin.getInstance().getConfig().getStringList("Wild.Arrival.Effects")) {
|
for (String s : FactionsPlugin.getInstance().getConfig().getStringList("Wild.Arrival.Effects")) {
|
||||||
p.addPotionEffect(new PotionEffect(PotionEffectType.getByName(s), 40, 1));
|
p.addPotionEffect(new PotionEffect(Objects.requireNonNull(PotionEffectType.getByName(s)), 40, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,6 +114,7 @@ public class CmdWild extends FCommand implements WaitedTask {
|
|||||||
@Override
|
@Override
|
||||||
public void handleFailure(Player player) {
|
public void handleFailure(Player player) {
|
||||||
player.sendMessage(TL.COMMAND_WILD_INTERUPTED.toString());
|
player.sendMessage(TL.COMMAND_WILD_INTERUPTED.toString());
|
||||||
|
teleportRange.remove(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DroppingAnvil
|
||||||
|
*/
|
||||||
public class WildGUI implements FactionGUI {
|
public class WildGUI implements FactionGUI {
|
||||||
Player player;
|
Player player;
|
||||||
FPlayer fplayer;
|
FPlayer fplayer;
|
||||||
@@ -37,7 +40,7 @@ public class WildGUI implements FactionGUI {
|
|||||||
if (map.containsKey(slot)) {
|
if (map.containsKey(slot)) {
|
||||||
String zone = map.get(slot);
|
String zone = map.get(slot);
|
||||||
if (fplayer.hasMoney(FactionsPlugin.getInstance().getConfig().getInt("Wild.Zones." + zone + ".Cost"))) {
|
if (fplayer.hasMoney(FactionsPlugin.getInstance().getConfig().getInt("Wild.Zones." + zone + ".Cost"))) {
|
||||||
WaitExecutor.taskMap.put(player, new WaitTask(FactionsPlugin.getInstance().getConfig().getInt("Wild.Wait"), TL.COMMAND_WILD_INPROGRESS, player, CmdWild.instance));
|
WaitExecutor.taskMap.put(player, new WaitTask(FactionsPlugin.getInstance().getConfig().getInt("Wild.Wait"), TL.COMMAND_WILD_WAIT, player, CmdWild.instance));
|
||||||
CmdWild.teleportRange.put(player, zone);
|
CmdWild.teleportRange.put(player, zone);
|
||||||
fplayer.msg(TL.COMMAND_WILD_WAIT, FactionsPlugin.getInstance().getConfig().getInt("Wild.Wait") + " Seconds");
|
fplayer.msg(TL.COMMAND_WILD_WAIT, FactionsPlugin.getInstance().getConfig().getInt("Wild.Wait") + " Seconds");
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
@@ -57,7 +60,8 @@ 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")).get().parseItem();
|
ItemStack zoneItem = XMaterial.matchXMaterial(Objects.requireNonNull(FactionsPlugin.getInstance().getConfig().getString("Wild.Zones." + key + ".Material"))).get().parseItem();
|
||||||
|
assert zoneItem != null;
|
||||||
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<>();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.massivecraft.factions.event;
|
package com.massivecraft.factions.event;
|
||||||
|
|
||||||
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 org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
@@ -10,51 +9,20 @@ import org.bukkit.event.Cancellable;
|
|||||||
*/
|
*/
|
||||||
public class PowerRegenEvent extends FactionPlayerEvent implements Cancellable {
|
public class PowerRegenEvent extends FactionPlayerEvent implements Cancellable {
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Illyria Team
|
|
||||||
*/
|
|
||||||
|
|
||||||
private boolean cancelled = false;
|
private boolean cancelled = false;
|
||||||
private double modified = 0;
|
private double delta;
|
||||||
|
|
||||||
public PowerRegenEvent(Faction f, FPlayer p) {
|
public PowerRegenEvent(Faction f, FPlayer p, double delta) {
|
||||||
super(f, p);
|
super(f, p);
|
||||||
|
this.delta = delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public double getDelta() {
|
||||||
* Get the amount of power this player will regen by default
|
return delta;
|
||||||
*
|
|
||||||
* @return power amount gained as a Double.
|
|
||||||
*/
|
|
||||||
public double getDefaultPowerGained() {
|
|
||||||
return fPlayer.getMillisPassed() * Conf.powerPerMinute / 60000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void setDelta(double delta) {
|
||||||
* Get the amount of custom power this player will gain. Ignored if less than or equal to 0.
|
this.delta = delta;
|
||||||
*
|
|
||||||
* @return Custom power as a double
|
|
||||||
*/
|
|
||||||
public double getCustomPower() {
|
|
||||||
return modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the custom power gain for this event.
|
|
||||||
*
|
|
||||||
* @param gain Amount of power to be added to player.
|
|
||||||
*/
|
|
||||||
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
|
||||||
|
|||||||
@@ -32,9 +32,8 @@ public class Econ {
|
|||||||
private static Economy econ = null;
|
private static Economy econ = null;
|
||||||
|
|
||||||
public static void setup() {
|
public static void setup() {
|
||||||
if (isSetup()) {
|
if (isSetup()) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String integrationFail = "Economy integration is " + (Conf.econEnabled ? "enabled, but" : "disabled, and") + " the plugin \"Vault\" ";
|
String integrationFail = "Economy integration is " + (Conf.econEnabled ? "enabled, but" : "disabled, and") + " the plugin \"Vault\" ";
|
||||||
|
|
||||||
@@ -42,20 +41,14 @@ public class Econ {
|
|||||||
FactionsPlugin.getInstance().log(integrationFail + "is not installed.");
|
FactionsPlugin.getInstance().log(integrationFail + "is not installed.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegisteredServiceProvider<Economy> rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
|
RegisteredServiceProvider<Economy> rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
|
||||||
if (rsp == null) {
|
if (rsp == null) {
|
||||||
FactionsPlugin.getInstance().log(integrationFail + "is not hooked into an economy plugin.");
|
FactionsPlugin.getInstance().log(integrationFail + "is not hooked into an economy plugin.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
econ = rsp.getProvider();
|
econ = rsp.getProvider();
|
||||||
|
|
||||||
FactionsPlugin.getInstance().log("Economy integration through Vault plugin successful.");
|
FactionsPlugin.getInstance().log("Economy integration through Vault plugin successful.");
|
||||||
|
if (!Conf.econEnabled) FactionsPlugin.getInstance().log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true");
|
||||||
if (!Conf.econEnabled) {
|
|
||||||
FactionsPlugin.getInstance().log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true");
|
|
||||||
}
|
|
||||||
|
|
||||||
//FactionsPlugin.getInstance().cmdBase.cmdHelp.updateHelp();
|
//FactionsPlugin.getInstance().cmdBase.cmdHelp.updateHelp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,26 +61,24 @@ public class Econ {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void modifyUniverseMoney(double delta) {
|
public static void modifyUniverseMoney(double delta) {
|
||||||
if (!shouldBeUsed()) {
|
if (!shouldBeUsed()) return;
|
||||||
return;
|
if (Conf.econUniverseAccount == null) return;
|
||||||
}
|
if (Conf.econUniverseAccount.length() == 0) return;
|
||||||
|
if (!econ.hasAccount(Conf.econUniverseAccount)) return;
|
||||||
if (Conf.econUniverseAccount == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Conf.econUniverseAccount.length() == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!econ.hasAccount(Conf.econUniverseAccount)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
modifyBalance(Conf.econUniverseAccount, delta);
|
modifyBalance(Conf.econUniverseAccount, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void sendBalanceInfo(FPlayer to, EconomyParticipator about) {
|
||||||
|
if (!shouldBeUsed()) {
|
||||||
|
FactionsPlugin.instance.log(Level.WARNING, "Vault does not appear to be hooked into an economy plugin.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
to.msg(TL.ECON_PLAYERBALANCE, about.describeTo(to, true), Econ.moneyString(econ.getBalance(about.getAccountId())));
|
||||||
|
}
|
||||||
|
|
||||||
public static void sendBalanceInfo(CommandSender to, Faction about) {
|
public static void sendBalanceInfo(CommandSender to, Faction about) {
|
||||||
if (!shouldBeUsed()) {
|
if (!shouldBeUsed()) {
|
||||||
FactionsPlugin.getInstance().log(Level.WARNING, "Vault does not appear to be hooked into an economy plugin.");
|
FactionsPlugin.instance.log(Level.WARNING, "Vault does not appear to be hooked into an economy plugin.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
to.sendMessage(String.format(TL.ECON_PLAYERBALANCE.toString(), about.getTag(), Econ.moneyString(econ.getBalance(about.getAccountId()))));
|
to.sendMessage(String.format(TL.ECON_PLAYERBALANCE.toString(), about.getTag(), Econ.moneyString(econ.getBalance(about.getAccountId()))));
|
||||||
@@ -98,37 +89,20 @@ public class Econ {
|
|||||||
Faction fYou = RelationUtil.getFaction(you);
|
Faction fYou = RelationUtil.getFaction(you);
|
||||||
|
|
||||||
// This is a system invoker. Accept it.
|
// This is a system invoker. Accept it.
|
||||||
if (fI == null) {
|
if (fI == null) return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bypassing players can do any kind of transaction
|
// Bypassing players can do any kind of transaction
|
||||||
if (i instanceof FPlayer && ((FPlayer) i).isAdminBypassing()) {
|
if (i instanceof FPlayer && ((FPlayer) i).isAdminBypassing()) return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Players with the any withdraw can do.
|
// Players with the any withdraw can do.
|
||||||
if (i instanceof FPlayer && Permission.MONEY_WITHDRAW_ANY.has(((FPlayer) i).getPlayer())) {
|
if (i instanceof FPlayer && Permission.MONEY_WITHDRAW_ANY.has(((FPlayer) i).getPlayer())) return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// You can deposit to anywhere you feel like. It's your loss if you can't withdraw it again.
|
// You can deposit to anywhere you feel like. It's your loss if you can't withdraw it again.
|
||||||
if (i == you) {
|
if (i == you) return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// A faction can always transfer away the money of it's members and its own money...
|
// A faction can always transfer away the money of it's members and its own money...
|
||||||
// This will however probably never happen as a faction does not have free will.
|
// This will however probably never happen as a faction does not have free will.
|
||||||
// Ohh by the way... Yes it could. For daily rent to the faction.
|
// Ohh by the way... Yes it could. For daily rent to the faction.
|
||||||
if (i == fI && fI == fYou) {
|
if (i == fI && fI == fYou) return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Factions can be controlled by members that are moderators... or any member if any member can withdraw.
|
// Factions can be controlled by members that are moderators... or any member if any member can withdraw.
|
||||||
if (i instanceof FPlayer && you instanceof Faction && fI == fYou && (Conf.bankMembersCanWithdraw || ((FPlayer) i).getRole().value >= Role.MODERATOR.value)) {
|
if (you instanceof Faction && fI == fYou && (Conf.bankMembersCanWithdraw || (i instanceof FPlayer && ((FPlayer) i).getRole().value >= Role.MODERATOR.value)))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise you may not!;,,;
|
// Otherwise you may not!;,,;
|
||||||
i.msg(TL.ECON_CANTCONTROLMONEY, i.describeTo(i, true), you.describeTo(i));
|
i.msg(TL.ECON_CANTCONTROLMONEY, i.describeTo(i, true), you.describeTo(i));
|
||||||
return false;
|
return false;
|
||||||
@@ -140,7 +114,7 @@ public class Econ {
|
|||||||
|
|
||||||
public static boolean transferMoney(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount, boolean notify) {
|
public static boolean transferMoney(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount, boolean notify) {
|
||||||
if (!shouldBeUsed()) {
|
if (!shouldBeUsed()) {
|
||||||
invoker.msg(TL.ECON_OFF);
|
invoker.msg(TL.ECON_DISABLED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,30 +128,21 @@ public class Econ {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check the rights
|
// Check the rights
|
||||||
if (!canIControllYou(invoker, from)) {
|
if (!canIControllYou(invoker, from)) return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
OfflinePlayer fromAcc;
|
OfflinePlayer fromAcc;
|
||||||
OfflinePlayer toAcc;
|
OfflinePlayer toAcc;
|
||||||
|
|
||||||
if (isUUID(from.getAccountId())) {
|
if (isUUID(from.getAccountId())) {
|
||||||
fromAcc = Bukkit.getOfflinePlayer(UUID.fromString(from.getAccountId()));
|
fromAcc = Bukkit.getOfflinePlayer(UUID.fromString(from.getAccountId()));
|
||||||
if (fromAcc.getName() == null) {
|
if (fromAcc.getName() == null) return false;
|
||||||
return false;
|
} else fromAcc = Bukkit.getOfflinePlayer(from.getAccountId());
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fromAcc = Bukkit.getOfflinePlayer(from.getAccountId());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isUUID(to.getAccountId())) {
|
if (isUUID(to.getAccountId())) {
|
||||||
toAcc = Bukkit.getOfflinePlayer(UUID.fromString(to.getAccountId()));
|
toAcc = Bukkit.getOfflinePlayer(UUID.fromString(to.getAccountId()));
|
||||||
if (toAcc.getName() == null) {
|
if (toAcc.getName() == null) return false;
|
||||||
return false;
|
} else toAcc = Bukkit.getOfflinePlayer(to.getAccountId());
|
||||||
}
|
|
||||||
} else {
|
|
||||||
toAcc = Bukkit.getOfflinePlayer(to.getAccountId());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is there enough money for the transaction to happen?
|
// Is there enough money for the transaction to happen?
|
||||||
if (!econ.has(fromAcc, amount)) {
|
if (!econ.has(fromAcc, amount)) {
|
||||||
@@ -185,13 +150,6 @@ public class Econ {
|
|||||||
if (invoker != null && notify) {
|
if (invoker != null && notify) {
|
||||||
invoker.msg(TL.COMMAND_MONEYTRANSFERFF_TRANSFERCANTAFFORD, from.describeTo(invoker, true), moneyString(amount), to.describeTo(invoker));
|
invoker.msg(TL.COMMAND_MONEYTRANSFERFF_TRANSFERCANTAFFORD, from.describeTo(invoker, true), moneyString(amount), to.describeTo(invoker));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if the new balance is over Essential's money cap.
|
|
||||||
if (Essentials.isOverBalCap(to, econ.getBalance(toAcc) + amount)) {
|
|
||||||
invoker.msg(TL.ECON_OVER_BAL_CAP, amount);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,21 +159,15 @@ public class Econ {
|
|||||||
if (erw.transactionSuccess()) {
|
if (erw.transactionSuccess()) {
|
||||||
EconomyResponse erd = econ.depositPlayer(toAcc, amount);
|
EconomyResponse erd = econ.depositPlayer(toAcc, amount);
|
||||||
if (erd.transactionSuccess()) {
|
if (erd.transactionSuccess()) {
|
||||||
if (notify) {
|
if (notify) sendTransferInfo(invoker, from, to, amount);
|
||||||
sendTransferInfo(invoker, from, to, amount);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else econ.depositPlayer(fromAcc, amount);
|
||||||
// transaction failed, refund account
|
|
||||||
econ.depositPlayer(fromAcc, amount);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we get here something with the transaction failed
|
// if we get here something with the transaction failed
|
||||||
if (notify) {
|
if (notify)
|
||||||
invoker.msg(TL.ECON_UNABLETOTRANSFER, moneyString(amount), to.describeTo(invoker), from.describeTo(invoker, true));
|
invoker.msg(TL.ECON_UNABLETOTRANSFER, moneyString(amount), to.describeTo(invoker), from.describeTo(invoker, true));
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,28 +192,22 @@ public class Econ {
|
|||||||
recipients.addAll(getFplayers(to));
|
recipients.addAll(getFplayers(to));
|
||||||
|
|
||||||
if (invoker == null) {
|
if (invoker == null) {
|
||||||
for (FPlayer recipient : recipients) {
|
for (FPlayer recipient : recipients)
|
||||||
recipient.msg(TL.ECON_MONEYTRASFERREDFROM, moneyString(amount), from.describeTo(recipient), to.describeTo(recipient));
|
recipient.msg(TL.ECON_MONEYTRASFERREDFROM, moneyString(amount), from.describeTo(recipient), to.describeTo(recipient));
|
||||||
}
|
|
||||||
} else if (invoker == from) {
|
} else if (invoker == from) {
|
||||||
for (FPlayer recipient : recipients) {
|
for (FPlayer recipient : recipients)
|
||||||
recipient.msg(TL.ECON_PERSONGAVEMONEYTO, from.describeTo(recipient, true), moneyString(amount), to.describeTo(recipient));
|
recipient.msg(TL.ECON_PERSONGAVEMONEYTO, from.describeTo(recipient, true), moneyString(amount), to.describeTo(recipient));
|
||||||
}
|
|
||||||
} else if (invoker == to) {
|
} else if (invoker == to) {
|
||||||
for (FPlayer recipient : recipients) {
|
for (FPlayer recipient : recipients)
|
||||||
recipient.msg(TL.ECON_PERSONTOOKMONEYFROM, to.describeTo(recipient, true), moneyString(amount), from.describeTo(recipient));
|
recipient.msg(TL.ECON_PERSONTOOKMONEYFROM, to.describeTo(recipient, true), moneyString(amount), from.describeTo(recipient));
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
for (FPlayer recipient : recipients) {
|
for (FPlayer recipient : recipients)
|
||||||
recipient.msg(TL.ECON_MONEYTRASFERREDFROMPERSONTOPERSON, invoker.describeTo(recipient, true), moneyString(amount), from.describeTo(recipient), to.describeTo(recipient));
|
recipient.msg(TL.ECON_MONEYTRASFERREDFROMPERSONTOPERSON, invoker.describeTo(recipient, true), moneyString(amount), from.describeTo(recipient), to.describeTo(recipient));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean hasAtLeast(EconomyParticipator ep, double delta, String toDoThis) {
|
public static boolean hasAtLeast(EconomyParticipator ep, double delta, String toDoThis) {
|
||||||
if (!shouldBeUsed()) {
|
if (!shouldBeUsed()) return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// going the hard way round as econ.has refuses to work.
|
// going the hard way round as econ.has refuses to work.
|
||||||
boolean affordable = false;
|
boolean affordable = false;
|
||||||
@@ -269,85 +215,59 @@ public class Econ {
|
|||||||
|
|
||||||
if (isUUID(ep.getAccountId())) {
|
if (isUUID(ep.getAccountId())) {
|
||||||
OfflinePlayer offline = Bukkit.getOfflinePlayer(UUID.fromString(ep.getAccountId()));
|
OfflinePlayer offline = Bukkit.getOfflinePlayer(UUID.fromString(ep.getAccountId()));
|
||||||
if (offline.getName() != null) {
|
if (offline.getName() != null)
|
||||||
currentBalance = econ.getBalance(Bukkit.getOfflinePlayer(UUID.fromString(ep.getAccountId())));
|
currentBalance = econ.getBalance(Bukkit.getOfflinePlayer(UUID.fromString(ep.getAccountId())));
|
||||||
} else {
|
else currentBalance = 0;
|
||||||
currentBalance = 0;
|
} else currentBalance = econ.getBalance(ep.getAccountId());
|
||||||
}
|
if (currentBalance >= delta) affordable = true;
|
||||||
} else {
|
|
||||||
currentBalance = econ.getBalance(ep.getAccountId());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentBalance >= delta) {
|
|
||||||
affordable = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!affordable) {
|
if (!affordable) {
|
||||||
if (toDoThis != null && !toDoThis.isEmpty()) {
|
if (toDoThis != null && !toDoThis.isEmpty())
|
||||||
ep.msg(TL.COMMAND_MONEY_CANTAFFORD, ep.describeTo(ep, true), moneyString(delta), toDoThis);
|
ep.msg(TL.COMMAND_MONEY_CANTAFFORD, ep.describeTo(ep, true), moneyString(delta), toDoThis);
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean modifyMoney(EconomyParticipator ep, double delta, String toDoThis, String forDoingThis) {
|
public static boolean modifyMoney(EconomyParticipator ep, double delta, String toDoThis, String forDoingThis) {
|
||||||
if (!shouldBeUsed()) {
|
if (!shouldBeUsed()) return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
OfflinePlayer acc;
|
OfflinePlayer acc;
|
||||||
|
|
||||||
if (isUUID(ep.getAccountId())) {
|
if (isUUID(ep.getAccountId())) {
|
||||||
acc = Bukkit.getOfflinePlayer(UUID.fromString(ep.getAccountId()));
|
acc = Bukkit.getOfflinePlayer(UUID.fromString(ep.getAccountId()));
|
||||||
if (acc.getName() == null) {
|
if (acc.getName() == null) return false;
|
||||||
return false;
|
} else acc = Bukkit.getOfflinePlayer(ep.getAccountId());
|
||||||
}
|
|
||||||
} else {
|
|
||||||
acc = Bukkit.getOfflinePlayer(ep.getAccountId());
|
|
||||||
}
|
|
||||||
|
|
||||||
String You = ep.describeTo(ep, true);
|
String You = ep.describeTo(ep, true);
|
||||||
|
|
||||||
if (delta == 0) {
|
if (delta == 0) return true;
|
||||||
// no money actually transferred?
|
else if (delta > 0) {
|
||||||
// ep.msg("<h>%s<i> didn't have to pay anything %s.", You, forDoingThis); // might be for gains, might be for losses
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (delta > 0) {
|
|
||||||
// The player should gain money
|
// The player should gain money
|
||||||
// The account might not have enough space
|
// The account might not have enough space
|
||||||
EconomyResponse er = econ.depositPlayer(acc, delta);
|
EconomyResponse er = econ.depositPlayer(acc, delta);
|
||||||
if (er.transactionSuccess()) {
|
if (er.transactionSuccess()) {
|
||||||
modifyUniverseMoney(-delta);
|
modifyUniverseMoney(-delta);
|
||||||
if (forDoingThis != null && !forDoingThis.isEmpty()) {
|
if (forDoingThis != null && !forDoingThis.isEmpty())
|
||||||
ep.msg(TL.COMMAND_MONEY_GAINED, You, moneyString(delta), forDoingThis);
|
ep.msg(TL.COMMAND_MONEY_GAINED, You, moneyString(delta), forDoingThis);
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// transfer to account failed
|
// transfer to account failed
|
||||||
if (forDoingThis != null && !forDoingThis.isEmpty()) {
|
if (forDoingThis != null && !forDoingThis.isEmpty())
|
||||||
ep.msg(TL.ECON_DEPOSITFAILED, You, moneyString(delta), forDoingThis);
|
ep.msg(TL.ECON_DEPOSITFAILED, You, moneyString(delta), forDoingThis);
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// The player should loose money
|
// The player should loose money
|
||||||
// The player might not have enough.
|
// The player might not have enough.
|
||||||
|
|
||||||
if (econ.has(acc, -delta) && econ.withdrawPlayer(acc, -delta).transactionSuccess()) {
|
if (econ.has(acc, -delta) && econ.withdrawPlayer(acc, -delta).transactionSuccess()) {
|
||||||
// There is enough money to pay
|
// There is enough money to pay
|
||||||
modifyUniverseMoney(-delta);
|
modifyUniverseMoney(-delta);
|
||||||
if (forDoingThis != null && !forDoingThis.isEmpty()) {
|
if (forDoingThis != null && !forDoingThis.isEmpty())
|
||||||
ep.msg(TL.ECON_MONEYLOST, You, moneyString(-delta), forDoingThis);
|
ep.msg(TL.ECON_MONEYLOST, You, moneyString(-delta), forDoingThis);
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// There was not enough money to pay
|
// There was not enough money to pay
|
||||||
if (toDoThis != null && !toDoThis.isEmpty()) {
|
if (toDoThis != null && !toDoThis.isEmpty())
|
||||||
ep.msg(TL.ECON_CANTAFFORD, You, moneyString(-delta), toDoThis);
|
ep.msg(TL.ECON_CANTAFFORD, You, moneyString(-delta), toDoThis);
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -359,10 +279,7 @@ public class Econ {
|
|||||||
|
|
||||||
// calculate the cost for claiming land
|
// calculate the cost for claiming land
|
||||||
public static double calculateClaimCost(int ownedLand, boolean takingFromAnotherFaction) {
|
public static double calculateClaimCost(int ownedLand, boolean takingFromAnotherFaction) {
|
||||||
if (!shouldBeUsed()) {
|
if (!shouldBeUsed()) return 0d;
|
||||||
return 0d;
|
|
||||||
}
|
|
||||||
|
|
||||||
// basic claim cost, plus land inflation cost, minus the potential bonus given for claiming from another faction
|
// basic claim cost, plus land inflation cost, minus the potential bonus given for claiming from another faction
|
||||||
return Conf.econCostClaimWilderness + (Conf.econCostClaimWilderness * Conf.econClaimAdditionalMultiplier * ownedLand) - (takingFromAnotherFaction ? Conf.econCostClaimFromFactionBonus : 0);
|
return Conf.econCostClaimWilderness + (Conf.econCostClaimWilderness * Conf.econClaimAdditionalMultiplier * ownedLand) - (takingFromAnotherFaction ? Conf.econCostClaimFromFactionBonus : 0);
|
||||||
}
|
}
|
||||||
@@ -375,9 +292,7 @@ public class Econ {
|
|||||||
// calculate value of all owned land
|
// calculate value of all owned land
|
||||||
public static double calculateTotalLandValue(int ownedLand) {
|
public static double calculateTotalLandValue(int ownedLand) {
|
||||||
double amount = 0;
|
double amount = 0;
|
||||||
for (int x = 0; x < ownedLand; x++) {
|
for (int x = 0; x < ownedLand; x++) amount += calculateClaimCost(x, false);
|
||||||
amount += calculateClaimCost(x, false);
|
|
||||||
}
|
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,9 +316,7 @@ public class Econ {
|
|||||||
|
|
||||||
public static String getFriendlyBalance(UUID uuid) {
|
public static String getFriendlyBalance(UUID uuid) {
|
||||||
OfflinePlayer offline = Bukkit.getOfflinePlayer(uuid);
|
OfflinePlayer offline = Bukkit.getOfflinePlayer(uuid);
|
||||||
if (offline.getName() == null) {
|
if (offline.getName() == null) return "0";
|
||||||
return "0";
|
|
||||||
}
|
|
||||||
return format.format(econ.getBalance(offline));
|
return format.format(econ.getBalance(offline));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,19 +326,13 @@ public class Econ {
|
|||||||
|
|
||||||
public static boolean setBalance(String account, double amount) {
|
public static boolean setBalance(String account, double amount) {
|
||||||
double current = econ.getBalance(account);
|
double current = econ.getBalance(account);
|
||||||
if (current > amount) {
|
if (current > amount) return econ.withdrawPlayer(account, current - amount).transactionSuccess();
|
||||||
return econ.withdrawPlayer(account, current - amount).transactionSuccess();
|
else return econ.depositPlayer(account, amount - current).transactionSuccess();
|
||||||
} else {
|
|
||||||
return econ.depositPlayer(account, amount - current).transactionSuccess();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean modifyBalance(String account, double amount) {
|
public static boolean modifyBalance(String account, double amount) {
|
||||||
if (amount < 0) {
|
if (amount < 0) return econ.withdrawPlayer(account, -amount).transactionSuccess();
|
||||||
return econ.withdrawPlayer(account, -amount).transactionSuccess();
|
else return econ.depositPlayer(account, amount).transactionSuccess();
|
||||||
} else {
|
|
||||||
return econ.depositPlayer(account, amount).transactionSuccess();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean deposit(String account, double amount) {
|
public static boolean deposit(String account, double amount) {
|
||||||
|
|||||||
@@ -4,47 +4,30 @@ import com.earth2me.essentials.Teleport;
|
|||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
|
||||||
import net.ess3.api.IEssentials;
|
import net.ess3.api.IEssentials;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.metadata.MetadataValue;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
public class Essentials {
|
public class Essentials {
|
||||||
|
|
||||||
/**
|
|
||||||
* @author FactionsUUID Team
|
|
||||||
*/
|
|
||||||
|
|
||||||
private static IEssentials essentials;
|
private static IEssentials essentials;
|
||||||
|
|
||||||
public static void setup() {
|
public static void setup() {
|
||||||
Plugin ess = Bukkit.getPluginManager().getPlugin("Essentials");
|
essentials = (IEssentials) Bukkit.getPluginManager().getPlugin("Essentials");
|
||||||
if (ess != null) {
|
|
||||||
essentials = (IEssentials) ess;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isOverBalCap(EconomyParticipator participator, double amount) {
|
|
||||||
if (essentials == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return amount > essentials.getSettings().getMaxMoney().doubleValue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// return false if feature is disabled or Essentials isn't available
|
// return false if feature is disabled or Essentials isn't available
|
||||||
public static boolean handleTeleport(Player player, Location loc) {
|
public static boolean handleTeleport(Player player, Location loc) {
|
||||||
if (!Conf.homesTeleportCommandEssentialsIntegration || essentials == null) {
|
if (!Conf.homesTeleportCommandEssentialsIntegration || essentials == null) return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Teleport teleport = essentials.getUser(player).getTeleport();
|
Teleport teleport = essentials.getUser(player).getTeleport();
|
||||||
Trade trade = new Trade(new BigDecimal(Conf.econCostHome), essentials);
|
Trade trade = new Trade(BigDecimal.valueOf(Conf.econCostHome), essentials);
|
||||||
try {
|
try {
|
||||||
teleport.teleport(loc, trade, TeleportCause.PLUGIN);
|
teleport.teleport(loc, trade, TeleportCause.PLUGIN);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -54,8 +37,21 @@ public class Essentials {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isVanished(Player player) {
|
public static boolean isVanished(Player player) {
|
||||||
if (essentials == null) return false;
|
// Edge case handling.
|
||||||
|
if (player == null) return false;
|
||||||
|
boolean vanish = false;
|
||||||
|
if (essentials != null) {
|
||||||
User user = essentials.getUser(player);
|
User user = essentials.getUser(player);
|
||||||
return user != null && user.isVanished();
|
if (user != null && user.isVanished()) return true;
|
||||||
|
}
|
||||||
|
if (player.hasMetadata("vanished"))
|
||||||
|
for (MetadataValue meta : player.getMetadata("vanished")) {
|
||||||
|
if (meta == null) continue;
|
||||||
|
if (meta.asBoolean()) {
|
||||||
|
vanish = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return vanish;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.*;
|
import org.bukkit.event.block.*;
|
||||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
|
||||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
@@ -180,12 +179,18 @@ public class FactionsBlockListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onBlockFromTo(BlockFromToEvent event) {
|
public void onBlockFromTo(BlockFromToEvent event) {
|
||||||
if (!Conf.handleExploitLiquidFlow) return;
|
if (!Conf.handleExploitLiquidFlow) return;
|
||||||
|
|
||||||
if (event.getBlock().isLiquid()) {
|
if (event.getBlock().isLiquid()) {
|
||||||
if (event.getToBlock().isEmpty()) {
|
if (event.getToBlock().isEmpty()) {
|
||||||
Faction from = Board.getInstance().getFactionAt(new FLocation(event.getBlock()));
|
Faction from = Board.getInstance().getFactionAt(new FLocation(event.getBlock()));
|
||||||
Faction to = Board.getInstance().getFactionAt(new FLocation(event.getToBlock()));
|
Faction to = Board.getInstance().getFactionAt(new FLocation(event.getToBlock()));
|
||||||
if (from == to) return;
|
if (from == to) return;
|
||||||
// from faction != to faction
|
// from faction != to faction
|
||||||
|
if(to.isSystemFaction()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (to.isNormal()) {
|
if (to.isNormal()) {
|
||||||
if (from.isNormal() && from.getRelationTo(to).isAlly()) {
|
if (from.isNormal() && from.getRelationTo(to).isAlly()) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.massivecraft.factions.*;
|
|||||||
import com.massivecraft.factions.event.PowerLossEvent;
|
import com.massivecraft.factions.event.PowerLossEvent;
|
||||||
import com.massivecraft.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
import com.massivecraft.factions.util.MiscUtil;
|
import com.massivecraft.factions.util.MiscUtil;
|
||||||
|
import com.massivecraft.factions.util.timer.type.GraceTimer;
|
||||||
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;
|
||||||
@@ -327,7 +328,6 @@ public class FactionsEntityListener implements Listener {
|
|||||||
|
|
||||||
public boolean isPlayerInSafeZone(Entity damagee) {
|
public boolean isPlayerInSafeZone(Entity damagee) {
|
||||||
if (!(damagee instanceof Player)) return false;
|
if (!(damagee instanceof Player)) return false;
|
||||||
|
|
||||||
return Board.getInstance().getFactionAt(new FLocation(damagee.getLocation())).isSafeZone();
|
return Board.getInstance().getFactionAt(new FLocation(damagee.getLocation())).isSafeZone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,12 +338,8 @@ public class FactionsEntityListener implements Listener {
|
|||||||
public boolean canDamagerHurtDamagee(EntityDamageByEntityEvent sub, boolean notify) {
|
public boolean canDamagerHurtDamagee(EntityDamageByEntityEvent sub, boolean notify) {
|
||||||
Entity damager = sub.getDamager();
|
Entity damager = sub.getDamager();
|
||||||
Entity damagee = sub.getEntity();
|
Entity damagee = sub.getEntity();
|
||||||
|
|
||||||
if (!(damagee instanceof Player)) return true;
|
if (!(damagee instanceof Player)) return true;
|
||||||
|
|
||||||
FPlayer defender = FPlayers.getInstance().getByPlayer((Player) damagee);
|
FPlayer defender = FPlayers.getInstance().getByPlayer((Player) damagee);
|
||||||
|
|
||||||
|
|
||||||
if (damager instanceof Player) {
|
if (damager instanceof Player) {
|
||||||
FPlayer attacker = FPlayers.getInstance().getByPlayer((Player) damager);
|
FPlayer attacker = FPlayers.getInstance().getByPlayer((Player) damager);
|
||||||
if (defender == null || defender.getPlayer() == null) return true;
|
if (defender == null || defender.getPlayer() == null) return true;
|
||||||
@@ -358,12 +354,8 @@ public class FactionsEntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Location defenderLoc = defender.getPlayer().getLocation();
|
Location defenderLoc = defender.getPlayer().getLocation();
|
||||||
Faction defLocFaction = Board.getInstance().getFactionAt(new FLocation(defenderLoc));
|
Faction defLocFaction = Board.getInstance().getFactionAt(new FLocation(defenderLoc));
|
||||||
|
|
||||||
|
|
||||||
// for damage caused by projectiles, getDamager() returns the projectile... what we need to know is the source
|
// for damage caused by projectiles, getDamager() returns the projectile... what we need to know is the source
|
||||||
if (damager instanceof Projectile) {
|
if (damager instanceof Projectile) {
|
||||||
Projectile projectile = (Projectile) damager;
|
Projectile projectile = (Projectile) damager;
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ import net.dv8tion.jda.core.entities.Member;
|
|||||||
import net.dv8tion.jda.core.entities.TextChannel;
|
import net.dv8tion.jda.core.entities.TextChannel;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Boat;
|
||||||
|
import org.bukkit.entity.Minecart;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@@ -56,8 +58,6 @@ import java.util.logging.Level;
|
|||||||
public class FactionsPlayerListener implements Listener {
|
public class FactionsPlayerListener implements Listener {
|
||||||
|
|
||||||
public static Set<FLocation> corners;
|
public static Set<FLocation> corners;
|
||||||
public static BukkitTask positionTask = null;
|
|
||||||
public static Map<UUID, Location> lastLocations = new HashMap<>();
|
|
||||||
/**
|
/**
|
||||||
* @author FactionsUUID Team
|
* @author FactionsUUID Team
|
||||||
*/
|
*/
|
||||||
@@ -309,7 +309,7 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
if ((landOwned && factionToCheck.getOwnerListString(loc).contains(player.getName())) || (me.getRole() == Role.LEADER && me.getFactionId().equals(factionToCheck.getId()))) {
|
if ((landOwned && factionToCheck.getOwnerListString(loc).contains(player.getName())) || (me.getRole() == Role.LEADER && me.getFactionId().equals(factionToCheck.getId()))) {
|
||||||
return true;
|
return true;
|
||||||
} else if (landOwned && !factionToCheck.getOwnerListString(loc).contains(player.getName())) {
|
} else if (landOwned && !factionToCheck.getOwnerListString(loc).contains(player.getName())) {
|
||||||
me.msg(TL.ACTIONS_OWNEDTERRITORYDENY, factionToCheck.getOwnerListString(loc));
|
me.msg(TL.ACTIONS_OWNEDTERRITORYDENY.toString().replace("{owners}", factionToCheck.getOwnerListString(loc)));
|
||||||
if (doPain) player.damage(Conf.actionDeniedPainAmount);
|
if (doPain) player.damage(Conf.actionDeniedPainAmount);
|
||||||
return false;
|
return false;
|
||||||
} else if (!landOwned && access == Access.ALLOW) {
|
} else if (!landOwned && access == Access.ALLOW) {
|
||||||
@@ -385,6 +385,10 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
case CHEST_MINECART:
|
case CHEST_MINECART:
|
||||||
|
|
||||||
case BARREL:
|
case BARREL:
|
||||||
|
case COMPOSTER:
|
||||||
|
case LOOM:
|
||||||
|
case CARTOGRAPHY_TABLE:
|
||||||
|
case GRINDSTONE:
|
||||||
|
|
||||||
case SHULKER_BOX:
|
case SHULKER_BOX:
|
||||||
case BLACK_SHULKER_BOX:
|
case BLACK_SHULKER_BOX:
|
||||||
@@ -453,7 +457,6 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
case CHIPPED_ANVIL:
|
case CHIPPED_ANVIL:
|
||||||
case DAMAGED_ANVIL:
|
case DAMAGED_ANVIL:
|
||||||
case BREWING_STAND:
|
case BREWING_STAND:
|
||||||
|
|
||||||
return PermissableAction.CONTAINER;
|
return PermissableAction.CONTAINER;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
@@ -474,6 +477,8 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
// Update the lastLoginTime for this fplayer
|
// Update the lastLoginTime for this fplayer
|
||||||
me.setLastLoginTime(System.currentTimeMillis());
|
me.setLastLoginTime(System.currentTimeMillis());
|
||||||
|
|
||||||
|
lastLocations.put(player.getUniqueId(), player.getLocation());
|
||||||
|
|
||||||
// Store player's current FLocation and notify them where they are
|
// Store player's current FLocation and notify them where they are
|
||||||
me.setLastStoodAt(new FLocation(player.getLocation()));
|
me.setLastStoodAt(new FLocation(player.getLocation()));
|
||||||
|
|
||||||
@@ -530,6 +535,7 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
|
Player this_ = event.getPlayer();
|
||||||
FPlayer me = FPlayers.getInstance().getByPlayer(event.getPlayer());
|
FPlayer me = FPlayers.getInstance().getByPlayer(event.getPlayer());
|
||||||
|
|
||||||
// Make sure player's power is up to date when they log off.
|
// Make sure player's power is up to date when they log off.
|
||||||
@@ -546,6 +552,8 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
FactionsPlugin.instance.getTimers().remove(me.getPlayer().getUniqueId());
|
FactionsPlugin.instance.getTimers().remove(me.getPlayer().getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastLocations.remove(this_.getUniqueId());
|
||||||
|
|
||||||
Faction myFaction = me.getFaction();
|
Faction myFaction = me.getFaction();
|
||||||
if (!myFaction.isWilderness()) myFaction.memberLoggedOff();
|
if (!myFaction.isWilderness()) myFaction.memberLoggedOff();
|
||||||
|
|
||||||
@@ -570,18 +578,20 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
.replace("{leader}", faction.getFPlayerAdmin() + "");
|
.replace("{leader}", faction.getFPlayerAdmin() + "");
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
@Deprecated
|
|
||||||
public void checkCanFly(FPlayer me) {
|
public void checkCanFly(FPlayer me) {
|
||||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight") || !FactionsPlugin.instance.getConfig().getBoolean("ffly.AutoEnable"))
|
if (!me.canFlyAtLocation() || me.checkIfNearbyEnemies()) {
|
||||||
|
if (me.isFlying())
|
||||||
|
me.setFFlying(false, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (me.isFlying() || !FactionsPlugin.instance.getConfig().getBoolean("ffly.AutoEnable"))
|
||||||
return;
|
return;
|
||||||
if (me.isFlying()) return;
|
|
||||||
if (me.getPlayer().hasPermission(Permission.FLY_FLY.node)) {
|
|
||||||
me.setFFlying(true, false);
|
me.setFFlying(true, false);
|
||||||
CmdFly.flyMap.put(me.getName(), true);
|
CmdFly.flyMap.put(me.getName(), true);
|
||||||
if (CmdFly.particleTask == null)
|
if (CmdFly.particleTask == null)
|
||||||
CmdFly.startParticles();
|
CmdFly.startParticles();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//inspect
|
//inspect
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@@ -645,15 +655,16 @@ 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 final static Map<UUID, Location> lastLocations = new HashMap<>();
|
||||||
|
|
||||||
public void startPositionCheck() {
|
public void startPositionCheck() {
|
||||||
positionTask = Bukkit.getScheduler().runTaskTimer(FactionsPlugin.instance, () -> {
|
positionTask = Bukkit.getScheduler().runTaskTimer(FactionsPlugin.getInstance(), () -> {
|
||||||
if (Bukkit.getOnlinePlayers().size() > 0) {
|
if (lastLocations.isEmpty()) return;
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Map.Entry<UUID, Location> check : lastLocations.entrySet()) {
|
||||||
if (!lastLocations.containsKey(player.getUniqueId())) {
|
Player player = Bukkit.getPlayer(check.getKey());
|
||||||
lastLocations.put(player.getUniqueId(), player.getLocation());
|
if (player != null) {
|
||||||
continue;
|
refreshPosition(player, check.getValue(), player.getLocation());
|
||||||
}
|
|
||||||
refreshPosition(player, lastLocations.get(player.getUniqueId()), player.getLocation());
|
|
||||||
lastLocations.put(player.getUniqueId(), player.getLocation());
|
lastLocations.put(player.getUniqueId(), player.getLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -719,16 +730,16 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
}, 5);
|
}, 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (FCmdRoot.instance.fFlyEnabled && CmdFly.autoenable && CmdFly.checkFly(me, me.getPlayer(), factionTo)) {
|
|
||||||
me.setFFlying(true, false);
|
|
||||||
CmdFly.flyMap.put(me.getName(), true);
|
|
||||||
if (CmdFly.particleTask == null)
|
|
||||||
CmdFly.startParticles();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
checkCanFly(me);
|
||||||
|
|
||||||
|
Faction at = Board.getInstance().getFactionAt(new FLocation(me.getPlayer().getLocation()));
|
||||||
if (me.getAutoClaimFor() != null) {
|
if (me.getAutoClaimFor() != null) {
|
||||||
|
if (FactionsPlugin.cachedRadiusClaim && me.attemptClaim(me.getFaction(), me.getPlayer().getLocation(), true)) {
|
||||||
|
me.getFaction().getFPlayersWhereOnline(true).forEach(f -> f.msg(TL.CLAIM_CLAIMED, me.describeTo(f, true), me.getFaction().describeTo(f), at.describeTo(f)));
|
||||||
|
} else {
|
||||||
me.attemptClaim(me.getAutoClaimFor(), newLocation, true);
|
me.attemptClaim(me.getAutoClaimFor(), newLocation, true);
|
||||||
|
}
|
||||||
FactionsPlugin.instance.logFactionEvent(me.getAutoClaimFor(), FLogType.CHUNK_CLAIMS, me.getName(), CC.GreenB + "CLAIMED", String.valueOf(1), (new FLocation(player.getLocation())).formatXAndZ(","));
|
FactionsPlugin.instance.logFactionEvent(me.getAutoClaimFor(), FLogType.CHUNK_CLAIMS, me.getName(), CC.GreenB + "CLAIMED", String.valueOf(1), (new FLocation(player.getLocation())).formatXAndZ(","));
|
||||||
if (Conf.disableFlightOnFactionClaimChange) CmdFly.disableFlight(me);
|
if (Conf.disableFlightOnFactionClaimChange) CmdFly.disableFlight(me);
|
||||||
} else if (me.isAutoSafeClaimEnabled()) {
|
} else if (me.isAutoSafeClaimEnabled()) {
|
||||||
@@ -841,15 +852,12 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventorySee(InventoryClickEvent e) {
|
public void onInventorySee(InventoryClickEvent e) {
|
||||||
if (e.getCurrentItem() == null)
|
if (e.getCurrentItem() == null) return;
|
||||||
return;
|
if (!e.getView().getTitle().endsWith("'s Inventory")) return;
|
||||||
|
|
||||||
if (!e.getView().getTitle().endsWith("'s Inventory"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerBoneMeal(PlayerInteractEvent event) {
|
public void onPlayerBoneMeal(PlayerInteractEvent event) {
|
||||||
Block block = event.getClickedBlock();
|
Block block = event.getClickedBlock();
|
||||||
@@ -969,7 +977,7 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
if (badGuy == null) return;
|
if (badGuy == null) return;
|
||||||
|
|
||||||
// if player was banned (not just kicked), get rid of their stored info
|
// if player was banned (not just kicked), get rid of their stored info
|
||||||
if (Conf.removePlayerDataWhenBanned && event.getReason().equals("Banned by admin.")) {
|
if (Conf.removePlayerDataWhenBanned && event.getReason().equals(Conf.removePlayerDataWhenBannedReason)) {
|
||||||
if (badGuy.getRole() == Role.LEADER) badGuy.getFaction().promoteNewLeader();
|
if (badGuy.getRole() == Role.LEADER) badGuy.getFaction().promoteNewLeader();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,17 @@ public class FInfoSidebar extends FSidebarProvider {
|
|||||||
|
|
||||||
ListIterator<String> it = lines.listIterator();
|
ListIterator<String> it = lines.listIterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
it.set(replaceTags(faction, fplayer, it.next()));
|
String next = it.next();
|
||||||
|
if (next == null) {
|
||||||
|
it.remove();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String replaced = replaceTags(faction, fplayer, next);
|
||||||
|
if (replaced == null) {
|
||||||
|
it.remove();
|
||||||
|
} else {
|
||||||
|
it.set(replaced);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,14 +46,14 @@ 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 = FactionsPlugin.getInstance().getFileManager().getShop().fetchInt("items." + s + ".slot");
|
int slot = FactionsPlugin.getInstance().getFileManager().getShop().fetchInt("items." + s + ".slot");
|
||||||
ItemStack material = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getFileManager().getShop().fetchString("items." + s + ".block")).get().parseItem();
|
ItemStack item = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getFileManager().getShop().fetchString("items." + s + ".block")).get().parseItem();
|
||||||
int cost = FactionsPlugin.getInstance().getFileManager().getShop().fetchInt("items." + s + ".cost");
|
int cost = FactionsPlugin.getInstance().getFileManager().getShop().fetchInt("items." + s + ".cost");
|
||||||
String name = FactionsPlugin.getInstance().getFileManager().getShop().fetchString("items." + s + ".name");
|
String name = FactionsPlugin.getInstance().getFileManager().getShop().fetchString("items." + s + ".name");
|
||||||
boolean glowing = FactionsPlugin.getInstance().getFileManager().getShop().fetchBoolean("items." + s + ".glowing");
|
boolean glowing = FactionsPlugin.getInstance().getFileManager().getShop().fetchBoolean("items." + s + ".glowing");
|
||||||
List<String> lore = FactionsPlugin.getInstance().getFileManager().getShop().fetchStringList("items." + s + ".lore");
|
List<String> lore = FactionsPlugin.getInstance().getFileManager().getShop().fetchStringList("items." + s + ".lore");
|
||||||
|
|
||||||
|
|
||||||
ItemStack item = new ItemStack(material);
|
assert item != null;
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setDisplayName(FactionsPlugin.instance.color(name));
|
meta.setDisplayName(FactionsPlugin.instance.color(name));
|
||||||
meta.addItemFlags();
|
meta.addItemFlags();
|
||||||
|
|||||||
@@ -149,10 +149,7 @@ public enum FactionTag implements Tag {
|
|||||||
if (!this.foundInString(text)) {
|
if (!this.foundInString(text)) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
String result = null;
|
String result = this.function == null ? this.biFunction.apply(faction, player) : this.function.apply(faction);
|
||||||
if (this.biFunction != null) {
|
|
||||||
result = this.function == null ? this.biFunction.apply(faction, player) : this.function.apply(faction);
|
|
||||||
}
|
|
||||||
return result == null ? null : text.replace(this.tag, result);
|
return result == null ? null : text.replace(this.tag, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public enum PlayerTag implements Tag {
|
|||||||
}),
|
}),
|
||||||
PLAYER_BALANCE("{balance}", (fp) -> Econ.isSetup() ? Econ.getFriendlyBalance(fp) : (Tag.isMinimalShow() ? null : TL.ECON_OFF.format("balance"))),
|
PLAYER_BALANCE("{balance}", (fp) -> Econ.isSetup() ? Econ.getFriendlyBalance(fp) : (Tag.isMinimalShow() ? null : TL.ECON_OFF.format("balance"))),
|
||||||
PLAYER_POWER("{player-power}", (fp) -> String.valueOf(fp.getPowerRounded())),
|
PLAYER_POWER("{player-power}", (fp) -> String.valueOf(fp.getPowerRounded())),
|
||||||
|
ROLE("{player-role}", FPlayer::getRolePrefix),
|
||||||
PLAYER_MAXPOWER("{player-maxpower}", (fp) -> String.valueOf(fp.getPowerMaxRounded())),
|
PLAYER_MAXPOWER("{player-maxpower}", (fp) -> String.valueOf(fp.getPowerMaxRounded())),
|
||||||
PLAYER_KILLS("{player-kills}", (fp) -> String.valueOf(fp.getKills())),
|
PLAYER_KILLS("{player-kills}", (fp) -> String.valueOf(fp.getKills())),
|
||||||
PLAYER_DEATHS("{player-deaths}", (fp) -> String.valueOf(fp.getDeaths())),
|
PLAYER_DEATHS("{player-deaths}", (fp) -> String.valueOf(fp.getDeaths())),
|
||||||
|
|||||||
@@ -14,7 +14,10 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements Relational {
|
public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements Relational {
|
||||||
|
|
||||||
@@ -210,16 +213,45 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
|
|||||||
return String.valueOf(faction.getMaxVaults());
|
return String.valueOf(faction.getMaxVaults());
|
||||||
case "faction_relation_color":
|
case "faction_relation_color":
|
||||||
return fPlayer.getColorTo(faction).toString();
|
return fPlayer.getColorTo(faction).toString();
|
||||||
case "faction_grace_time":
|
case "grace_time":
|
||||||
|
if(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining() >= 0) {
|
||||||
return String.valueOf(TimerManager.getRemaining(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining(), true));
|
return String.valueOf(TimerManager.getRemaining(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining(), true));
|
||||||
|
} else {
|
||||||
|
return TL.GRACE_DISABLED_PLACEHOLDER.toString();
|
||||||
|
}
|
||||||
case "faction_name_at_location":
|
case "faction_name_at_location":
|
||||||
Faction factionAtLocation = Board.getInstance().getFactionAt(new FLocation(player.getLocation()));
|
Faction factionAtLocation = Board.getInstance().getFactionAt(new FLocation(player.getLocation()));
|
||||||
return factionAtLocation != null ? factionAtLocation.getTag() : Factions.getInstance().getWilderness().getTag();
|
return factionAtLocation != null ? factionAtLocation.getTag() : Factions.getInstance().getWilderness().getTag();
|
||||||
}
|
}
|
||||||
|
//If its not hardcoded lets try to grab it anyways
|
||||||
return null;
|
boolean targetFaction = false;
|
||||||
|
Object target = fPlayer;
|
||||||
|
String stripped = "";
|
||||||
|
if (placeholder.startsWith("faction_")) {
|
||||||
|
targetFaction = true;
|
||||||
|
target = faction;
|
||||||
|
stripped = placeholder.replace("faction_", "");
|
||||||
|
} else {
|
||||||
|
stripped = placeholder.replace("player_", "");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Object pulled;
|
||||||
|
if (targetFaction) {
|
||||||
|
pulled = Faction.class.getDeclaredMethod(stripped).invoke(target);
|
||||||
|
} else {
|
||||||
|
pulled = FPlayer.class.getDeclaredMethod(stripped).invoke(target);
|
||||||
|
}
|
||||||
|
return String.valueOf(pulled);
|
||||||
|
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||||
|
logInvalid(stripped);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return TL.PLACEHOLDERAPI_NULL.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void logInvalid(String placeholder) {
|
||||||
|
FactionsPlugin.getInstance().getLogger().log(Level.INFO, "Invalid request through PlaceholderAPI for placeholder '" + placeholder + "'");
|
||||||
|
}
|
||||||
|
|
||||||
private int countOn(Faction f, Relation relation, Boolean status, FPlayer player) {
|
private int countOn(Faction f, Relation relation, Boolean status, FPlayer player) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.massivecraft.factions.util;
|
|||||||
|
|
||||||
import com.massivecraft.factions.FLocation;
|
import com.massivecraft.factions.FLocation;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
@@ -26,7 +27,9 @@ public class CornerTask extends BukkitRunnable {
|
|||||||
cancel();
|
cancel();
|
||||||
} else {
|
} else {
|
||||||
FLocation fLocation = surrounding.remove(0);
|
FLocation fLocation = surrounding.remove(0);
|
||||||
if (fPlayer.attemptClaim(fPlayer.getFaction(), fLocation, true)) {
|
if (FactionsPlugin.cachedRadiusClaim && fPlayer.attemptClaim(fPlayer.getFaction(), fLocation, true)) {
|
||||||
|
++amount;
|
||||||
|
} else if (fPlayer.attemptClaim(fPlayer.getFaction(), fLocation, true)) {
|
||||||
++amount;
|
++amount;
|
||||||
} else {
|
} else {
|
||||||
fPlayer.sendMessage(TL.COMMAND_CORNER_FAIL_WITH_FEEDBACK.toString().replace("&", "§") + amount);
|
fPlayer.sendMessage(TL.COMMAND_CORNER_FAIL_WITH_FEEDBACK.toString().replace("&", "§") + amount);
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ public class MiscUtil {
|
|||||||
for (char c : str.toCharArray()) {
|
for (char c : str.toCharArray()) {
|
||||||
if (!substanceChars.contains(String.valueOf(c))) {
|
if (!substanceChars.contains(String.valueOf(c))) {
|
||||||
errors.add(FactionsPlugin.getInstance().txt.parse(TL.GENERIC_FACTIONTAG_ALPHANUMERIC.toString(), c));
|
errors.add(FactionsPlugin.getInstance().txt.parse(TL.GENERIC_FACTIONTAG_ALPHANUMERIC.toString(), c));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ public class UtilFly {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void run() {
|
public static void run() {
|
||||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(FactionsPlugin.getInstance(), () -> {
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(FactionsPlugin.getInstance(), () -> {
|
||||||
for (FPlayer fp : FPlayers.getInstance().getOnlinePlayers()) {
|
for (FPlayer fp : FPlayers.getInstance().getOnlinePlayers()) {
|
||||||
@@ -28,8 +26,6 @@ public class UtilFly {
|
|||||||
|
|
||||||
@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"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
fp.getPlayer().setAllowFlight(fly);
|
fp.getPlayer().setAllowFlight(fly);
|
||||||
fp.getPlayer().setFlying(fly);
|
fp.getPlayer().setFlying(fly);
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ import org.bukkit.entity.Player;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factions - Developed by Driftay.
|
* @author DroppingAnvil
|
||||||
* All rights reserved 2020.
|
|
||||||
* Creation Date: 4/4/2020
|
|
||||||
*/
|
*/
|
||||||
public class WaitExecutor {
|
public class WaitExecutor {
|
||||||
public static ConcurrentHashMap<Player, WaitTask> taskMap = new ConcurrentHashMap<>();
|
public static ConcurrentHashMap<Player, WaitTask> taskMap = new ConcurrentHashMap<>();
|
||||||
|
|||||||
@@ -3,10 +3,7 @@ package com.massivecraft.factions.zcore;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.massivecraft.factions.Board;
|
import com.massivecraft.factions.*;
|
||||||
import com.massivecraft.factions.Conf;
|
|
||||||
import com.massivecraft.factions.FPlayers;
|
|
||||||
import com.massivecraft.factions.Factions;
|
|
||||||
import com.massivecraft.factions.zcore.persist.SaveTask;
|
import com.massivecraft.factions.zcore.persist.SaveTask;
|
||||||
import com.massivecraft.factions.zcore.util.PermUtil;
|
import com.massivecraft.factions.zcore.util.PermUtil;
|
||||||
import com.massivecraft.factions.zcore.util.Persist;
|
import com.massivecraft.factions.zcore.util.Persist;
|
||||||
@@ -15,7 +12,6 @@ import com.massivecraft.factions.zcore.util.TextUtil;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.plugin.IllegalPluginAccessException;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@@ -100,9 +96,7 @@ public abstract class MPlugin extends JavaPlugin {
|
|||||||
long saveTicks = (long) (20 * 60 * Conf.saveToFileEveryXMinutes); // Approximately every 30 min by default
|
long saveTicks = (long) (20 * 60 * Conf.saveToFileEveryXMinutes); // Approximately every 30 min by default
|
||||||
saveTask = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new SaveTask(this), saveTicks, saveTicks);
|
saveTask = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new SaveTask(this), saveTicks, saveTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadLang();
|
loadLang();
|
||||||
|
|
||||||
loadSuccessful = true;
|
loadSuccessful = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -178,7 +172,6 @@ public abstract class MPlugin extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
try {
|
|
||||||
if (saveTask != null) {
|
if (saveTask != null) {
|
||||||
this.getServer().getScheduler().cancelTask(saveTask);
|
this.getServer().getScheduler().cancelTask(saveTask);
|
||||||
saveTask = null;
|
saveTask = null;
|
||||||
@@ -189,9 +182,8 @@ public abstract class MPlugin extends JavaPlugin {
|
|||||||
FPlayers.getInstance().forceSave();
|
FPlayers.getInstance().forceSave();
|
||||||
Board.getInstance().forceSave();
|
Board.getInstance().forceSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
log("Disabled");
|
log("Disabled");
|
||||||
} catch (IllegalPluginAccessException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class FDisbandFrame {
|
|||||||
private Gui gui;
|
private Gui gui;
|
||||||
|
|
||||||
public FDisbandFrame(Faction faction) {
|
public FDisbandFrame(Faction faction) {
|
||||||
this.gui = new Gui(FactionsPlugin.getInstance(), 1, "Confirm Disband");
|
this.gui = new Gui(FactionsPlugin.getInstance(), 1, ChatColor.translateAlternateColorCodes('&', Objects.requireNonNull(FactionsPlugin.getInstance().getConfig().getString("f-disband-gui.title"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildGUI(FPlayer fPlayer) {
|
public void buildGUI(FPlayer fPlayer) {
|
||||||
|
|||||||
@@ -25,22 +25,22 @@ public class UpgradesListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public static void onDamageReduction(EntityDamageByEntityEvent e) {
|
public static void onDamageReduction(EntityDamageByEntityEvent e) {
|
||||||
if (e.isCancelled()) {
|
if (e.isCancelled()) return;
|
||||||
return;
|
|
||||||
}
|
if (!(e.getDamager() instanceof Player) || !(e.getEntity() instanceof Player)) return;
|
||||||
if (!(e.getDamager() instanceof Player) || !(e.getEntity() instanceof Player)) {
|
if(e.getEntity() == null) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getEntity());
|
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getEntity());
|
||||||
FPlayer dame = FPlayers.getInstance().getByPlayer((Player) e.getDamager());
|
FPlayer dame = FPlayers.getInstance().getByPlayer((Player) e.getDamager());
|
||||||
if (fme == null || dame == null) {
|
|
||||||
return;
|
if (fme == null || dame == null) return;
|
||||||
}
|
|
||||||
FLocation floc = new FLocation(fme.getPlayer().getLocation());
|
FLocation floc = new FLocation(fme.getPlayer().getLocation());
|
||||||
|
|
||||||
|
if(floc == null) return;
|
||||||
|
|
||||||
if (Board.getInstance().getFactionAt(floc) == fme.getFaction()) {
|
if (Board.getInstance().getFactionAt(floc) == fme.getFaction()) {
|
||||||
if (dame.getFaction() == fme.getFaction()) {
|
if (dame.getFaction() == fme.getFaction()) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
double damage = e.getDamage();
|
double damage = e.getDamage();
|
||||||
int level = fme.getFaction().getUpgrade(UpgradeType.DAMAGEDECREASE);
|
int level = fme.getFaction().getUpgrade(UpgradeType.DAMAGEDECREASE);
|
||||||
double increase = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.DamageReduction.DamageReductionPercent.level-" + level);
|
double increase = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.DamageReduction.DamageReductionPercent.level-" + level);
|
||||||
@@ -50,20 +50,17 @@ public class UpgradesListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public static void onDamageIncrease(EntityDamageByEntityEvent e) {
|
public static void onDamageIncrease(EntityDamageByEntityEvent e) {
|
||||||
if (e == null) {
|
if (e == null) return;
|
||||||
return;
|
|
||||||
}
|
if (!(e.getDamager() instanceof Player) || !(e.getEntity() instanceof Player)) return;
|
||||||
if (!(e.getDamager() instanceof Player) || !(e.getEntity() instanceof Player)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.getDamager().hasMetadata("NPC") || e.getEntity().hasMetadata("NPC")) return;
|
if (e.getDamager().hasMetadata("NPC") || e.getEntity().hasMetadata("NPC")) return;
|
||||||
|
|
||||||
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getEntity());
|
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getEntity());
|
||||||
FPlayer dame = FPlayers.getInstance().getByPlayer((Player) e.getDamager());
|
FPlayer dame = FPlayers.getInstance().getByPlayer((Player) e.getDamager());
|
||||||
if (fme == null || dame == null) {
|
if (fme == null || dame == null) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FLocation floc = new FLocation(fme.getPlayer().getLocation());
|
FLocation floc = new FLocation(fme.getPlayer().getLocation());
|
||||||
|
|
||||||
@@ -87,9 +84,8 @@ public class UpgradesListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onDeath(EntityDeathEvent e) {
|
public void onDeath(EntityDeathEvent e) {
|
||||||
Entity killer = e.getEntity().getKiller();
|
Entity killer = e.getEntity().getKiller();
|
||||||
if (killer == null || !(killer instanceof Player)) {
|
if (killer == null || !(killer instanceof Player)) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
FLocation floc = new FLocation(e.getEntity().getLocation());
|
FLocation floc = new FLocation(e.getEntity().getLocation());
|
||||||
Faction faction = Board.getInstance().getFactionAt(floc);
|
Faction faction = Board.getInstance().getFactionAt(floc);
|
||||||
if (!faction.isWilderness()) {
|
if (!faction.isWilderness()) {
|
||||||
@@ -112,9 +108,7 @@ public class UpgradesListener implements Listener {
|
|||||||
Faction factionAtLoc = Board.getInstance().getFactionAt(floc);
|
Faction factionAtLoc = Board.getInstance().getFactionAt(floc);
|
||||||
if (!factionAtLoc.isWilderness()) {
|
if (!factionAtLoc.isWilderness()) {
|
||||||
int level = factionAtLoc.getUpgrade(UpgradeType.SPAWNER);
|
int level = factionAtLoc.getUpgrade(UpgradeType.SPAWNER);
|
||||||
if (level == 0) {
|
if (level == 0) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.lowerSpawnerDelay(e, FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.Spawners.Spawner-Boost.level-" + level));
|
this.lowerSpawnerDelay(e, FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.Spawners.Spawner-Boost.level-" + level));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,13 +125,10 @@ public class UpgradesListener implements Listener {
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,21 +164,16 @@ public class UpgradesListener implements Listener {
|
|||||||
if (!factionAtLoc.isWilderness()) {
|
if (!factionAtLoc.isWilderness()) {
|
||||||
int level = factionAtLoc.getUpgrade(UpgradeType.REDSTONE);
|
int level = factionAtLoc.getUpgrade(UpgradeType.REDSTONE);
|
||||||
if (level != 0) {
|
if (level != 0) {
|
||||||
if (level == 1) {
|
if (level == 1) FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Redstone.Cost");
|
||||||
FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Redstone.Cost");
|
if (unbreakable.contains(block)) e.setCancelled(true);
|
||||||
}
|
|
||||||
if (unbreakable.contains(block)) {
|
|
||||||
e.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@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) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (e.getItem().getType().toString().contains("LEGGINGS") || e.getItem().getType().toString().contains("CHESTPLATE") || e.getItem().getType().toString().contains("HELMET") || e.getItem().getType().toString().contains("BOOTS")) {
|
if (e.getItem().getType().toString().contains("LEGGINGS") || e.getItem().getType().toString().contains("CHESTPLATE") || e.getItem().getType().toString().contains("HELMET") || e.getItem().getType().toString().contains("BOOTS")) {
|
||||||
int lvl = FPlayers.getInstance().getByPlayer(e.getPlayer()).getFaction().getUpgrade(UpgradeType.REINFORCEDARMOR);
|
int lvl = FPlayers.getInstance().getByPlayer(e.getPlayer()).getFaction().getUpgrade(UpgradeType.REINFORCEDARMOR);
|
||||||
double drop = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.Armor.Armor-HP-Drop.level-" + lvl);
|
double drop = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.Armor.Armor-HP-Drop.level-" + lvl);
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ public class FactionWarpsFrame {
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
for (int x = 0; x <= gui.getRows() * 9 - 1; ++x)
|
for (int x = 0; x <= gui.getRows() * 9 - 1; ++x)
|
||||||
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())));
|
//We comment this out for now so it does not interfere with item placement when no warps are set
|
||||||
|
//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);
|
||||||
|
|||||||
@@ -663,25 +663,34 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
public void updatePower() {
|
public void updatePower() {
|
||||||
if (this.isOffline()) {
|
if (this.isOffline()) {
|
||||||
losePowerFromBeingOffline();
|
losePowerFromBeingOffline();
|
||||||
if (!Conf.powerRegenOffline) return;
|
if (!Conf.powerRegenOffline) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else if (hasFaction() && getFaction().isPowerFrozen()) {
|
} else if (hasFaction() && getFaction().isPowerFrozen()) {
|
||||||
return; // Don't let power regen if faction power is frozen.
|
return; // Don't let power regen if faction power is frozen.
|
||||||
}
|
}
|
||||||
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
this.millisPassed = now - this.lastPowerUpdateTime;
|
long millisPassed = now - this.lastPowerUpdateTime;
|
||||||
this.lastPowerUpdateTime = now;
|
this.lastPowerUpdateTime = now;
|
||||||
|
|
||||||
Player thisPlayer = this.getPlayer();
|
Player thisPlayer = this.getPlayer();
|
||||||
if (thisPlayer != null && thisPlayer.isDead())
|
if (thisPlayer != null && thisPlayer.isDead()) {
|
||||||
return; // don't let dead players regain power until they respawn
|
return; // don't let dead players regain power until they respawn
|
||||||
PowerRegenEvent powerRegenEvent = new PowerRegenEvent(getFaction(), this);
|
}
|
||||||
Bukkit.getScheduler().runTask(FactionsPlugin.getInstance(), () -> Bukkit.getServer().getPluginManager().callEvent(powerRegenEvent));
|
|
||||||
|
|
||||||
if (!powerRegenEvent.isCancelled())
|
double delta = millisPassed * Conf.powerPerMinute / 60000; // millisPerMinute : 60 * 1000
|
||||||
if (!powerRegenEvent.usingCustomPower())
|
if (Bukkit.getPluginManager().getPlugin("FactionsPlugin") != null) {
|
||||||
this.alterPower(millisPassed * Conf.powerPerMinute / 60000); // millisPerMinute : 60 * 1000
|
Bukkit.getScheduler().runTask(FactionsPlugin.getInstance(), () -> {
|
||||||
else this.alterPower(+powerRegenEvent.getCustomPower());
|
PowerRegenEvent powerRegenEvent = new PowerRegenEvent(getFaction(), this, delta);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(powerRegenEvent);
|
||||||
|
if (!powerRegenEvent.isCancelled()) {
|
||||||
|
this.alterPower(powerRegenEvent.getDelta());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.alterPower(delta);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void losePowerFromBeingOffline() {
|
public void losePowerFromBeingOffline() {
|
||||||
@@ -728,12 +737,13 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
|
|
||||||
public void sendFactionHereMessage(Faction from) {
|
public void sendFactionHereMessage(Faction from) {
|
||||||
Faction toShow = Board.getInstance().getFactionAt(getLastStoodAt());
|
Faction toShow = Board.getInstance().getFactionAt(getLastStoodAt());
|
||||||
boolean showChat = true;
|
|
||||||
|
if(Conf.worldsNoClaiming.contains(getLastStoodAt().getWorldName())) return;
|
||||||
|
|
||||||
if (showInfoBoard(toShow)) {
|
if (showInfoBoard(toShow)) {
|
||||||
FScoreboard.get(this).setTemporarySidebar(new FInfoSidebar(toShow));
|
FScoreboard.get(this).setTemporarySidebar(new FInfoSidebar(toShow));
|
||||||
showChat = FactionsPlugin.getInstance().getConfig().getBoolean("scoreboard.also-send-chat", true);
|
|
||||||
}
|
}
|
||||||
if (showChat)
|
if (FactionsPlugin.getInstance().getConfig().getBoolean("scoreboard.also-send-chat", true))
|
||||||
this.sendMessage(FactionsPlugin.getInstance().txt.parse(TL.FACTION_LEAVE.format(from.getTag(this), toShow.getTag(this))));
|
this.sendMessage(FactionsPlugin.getInstance().txt.parse(TL.FACTION_LEAVE.format(from.getTag(this), toShow.getTag(this))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -842,71 +852,72 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canClaimForFactionAtLocation(Faction forFaction, FLocation flocation, boolean notifyFailure) {
|
public boolean canClaimForFactionAtLocation(Faction forFaction, FLocation flocation, boolean notifyFailure) {
|
||||||
|
FactionsPlugin plugin = FactionsPlugin.getInstance();
|
||||||
String error = null;
|
String error = null;
|
||||||
Faction myFaction = getFaction();
|
Faction myFaction = getFaction();
|
||||||
Faction currentFaction = Board.getInstance().getFactionAt(flocation);
|
Faction currentFaction = Board.getInstance().getFactionAt(flocation);
|
||||||
int ownedLand = forFaction.getLandRounded();
|
int ownedLand = forFaction.getLandRounded();
|
||||||
int factionBuffer = FactionsPlugin.getInstance().getConfig().getInt("hcf.buffer-zone", 0);
|
int factionBuffer = plugin.getConfig().getInt("hcf.buffer-zone", 0);
|
||||||
int worldBuffer = FactionsPlugin.getInstance().getConfig().getInt("world-border.buffer", 0) - 1;
|
int worldBuffer = plugin.getConfig().getInt("world-border.buffer", 0) - 1;
|
||||||
|
|
||||||
if (Conf.worldGuardChecking && Worldguard.getInstance().checkForRegionsInChunk(flocation) && !this.isAdminBypassing()) {
|
if (Conf.worldGuardChecking && Worldguard.getInstance().checkForRegionsInChunk(flocation)) {
|
||||||
// Checks for WorldGuard regions in the chunk attempting to be claimed
|
// Checks for WorldGuard regions in the chunk attempting to be claimed
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_PROTECTED.toString());
|
error = plugin.txt.parse(TL.CLAIM_PROTECTED.toString());
|
||||||
} else if (flocation.isOutsideWorldBorder(FactionsPlugin.getInstance().getConfig().getInt("world-border.buffer", 0) - 1)) {
|
} else if (flocation.isOutsideWorldBorder(plugin.getConfig().getInt("world-border.buffer", 0) - 1)) {
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString());
|
error = plugin.txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString());
|
||||||
} else if (Conf.worldsNoClaiming.contains(flocation.getWorldName())) {
|
} else if (Conf.worldsNoClaiming.contains(flocation.getWorldName())) {
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_DISABLED.toString());
|
error = plugin.txt.parse(TL.CLAIM_DISABLED.toString());
|
||||||
} else if (this.isAdminBypassing()) {
|
} else if (this.isAdminBypassing()) {
|
||||||
return true;
|
return true;
|
||||||
} else if (forFaction.isSafeZone() && Permission.MANAGE_SAFE_ZONE.has(getPlayer())) {
|
} else if (forFaction.isSafeZone() && Permission.MANAGE_SAFE_ZONE.has(getPlayer())) {
|
||||||
return true;
|
return true;
|
||||||
} else if (forFaction.isWarZone() && Permission.MANAGE_WAR_ZONE.has(getPlayer())) {
|
} else if (forFaction.isWarZone() && Permission.MANAGE_WAR_ZONE.has(getPlayer())) {
|
||||||
return true;
|
return true;
|
||||||
} else if (currentFaction.getAccess(this, PermissableAction.TERRITORY) == Access.ALLOW) {
|
} else if (currentFaction.getAccess(this, PermissableAction.TERRITORY) == Access.ALLOW && forFaction != currentFaction ) {
|
||||||
return true;
|
return true;
|
||||||
} else if (myFaction != forFaction) {
|
} else if (myFaction != forFaction) {
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_CANTCLAIM.toString(), forFaction.describeTo(this));
|
error = plugin.txt.parse(TL.CLAIM_CANTCLAIM.toString(), forFaction.describeTo(this));
|
||||||
} else if (forFaction == currentFaction) {
|
} else if (forFaction == currentFaction) {
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_ALREADYOWN.toString(), forFaction.describeTo(this, true));
|
error = plugin.txt.parse(TL.CLAIM_ALREADYOWN.toString(), forFaction.describeTo(this, true));
|
||||||
} else if (forFaction.getFPlayers().size() < Conf.claimsRequireMinFactionMembers) {
|
} else if (forFaction.getFPlayers().size() < Conf.claimsRequireMinFactionMembers) {
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_MEMBERS.toString(), Conf.claimsRequireMinFactionMembers);
|
error = plugin.txt.parse(TL.CLAIM_MEMBERS.toString(), Conf.claimsRequireMinFactionMembers);
|
||||||
} else if (currentFaction.isSafeZone()) {
|
} else if (currentFaction.isSafeZone()) {
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_SAFEZONE.toString());
|
error = plugin.txt.parse(TL.CLAIM_SAFEZONE.toString());
|
||||||
} else if (currentFaction.isWarZone()) {
|
} else if (currentFaction.isWarZone()) {
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_WARZONE.toString());
|
error = plugin.txt.parse(TL.CLAIM_WARZONE.toString());
|
||||||
} else if (FactionsPlugin.getInstance().getConfig().getBoolean("hcf.allow-overclaim", true) && ownedLand >= forFaction.getPowerRounded()) {
|
} else if (plugin.getConfig().getBoolean("hcf.allow-overclaim", true) && ownedLand >= forFaction.getPowerRounded()) {
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_POWER.toString());
|
error = plugin.txt.parse(TL.CLAIM_POWER.toString());
|
||||||
} else if (Conf.claimedLandsMax != 0 && ownedLand >= Conf.claimedLandsMax && forFaction.isNormal()) {
|
} else if (Conf.claimedLandsMax != 0 && ownedLand >= Conf.claimedLandsMax && forFaction.isNormal()) {
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_LIMIT.toString());
|
error = plugin.txt.parse(TL.CLAIM_LIMIT.toString());
|
||||||
} else if (currentFaction.getRelationTo(forFaction) == Relation.ALLY) {
|
} else if (currentFaction.getRelationTo(forFaction) == Relation.ALLY) {
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_ALLY.toString());
|
error = plugin.txt.parse(TL.CLAIM_ALLY.toString());
|
||||||
} else if (Conf.claimsMustBeConnected && !this.isAdminBypassing() && myFaction.getLandRoundedInWorld(flocation.getWorldName()) > 0 && !Board.getInstance().isConnectedLocation(flocation, myFaction) && (!Conf.claimsCanBeUnconnectedIfOwnedByOtherFaction || !currentFaction.isNormal())) {
|
} else if (Conf.claimsMustBeConnected && !this.isAdminBypassing() && myFaction.getLandRoundedInWorld(flocation.getWorldName()) > 0 && !Board.getInstance().isConnectedLocation(flocation, myFaction) && (!Conf.claimsCanBeUnconnectedIfOwnedByOtherFaction || !currentFaction.isNormal())) {
|
||||||
if (Conf.claimsCanBeUnconnectedIfOwnedByOtherFaction) {
|
if (Conf.claimsCanBeUnconnectedIfOwnedByOtherFaction) {
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_CONTIGIOUS.toString());
|
error = plugin.txt.parse(TL.CLAIM_CONTIGIOUS.toString());
|
||||||
} else {
|
} else {
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_FACTIONCONTIGUOUS.toString());
|
error = plugin.txt.parse(TL.CLAIM_FACTIONCONTIGUOUS.toString());
|
||||||
}
|
}
|
||||||
} else if (factionBuffer > 0 && Board.getInstance().hasFactionWithin(flocation, myFaction, factionBuffer)) {
|
} else if (factionBuffer > 0 && Board.getInstance().hasFactionWithin(flocation, myFaction, factionBuffer)) {
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_TOOCLOSETOOTHERFACTION.format(factionBuffer));
|
error = plugin.txt.parse(TL.CLAIM_TOOCLOSETOOTHERFACTION.format(factionBuffer));
|
||||||
} else if (flocation.isOutsideWorldBorder(worldBuffer)) {
|
} else if (flocation.isOutsideWorldBorder(worldBuffer)) {
|
||||||
if (worldBuffer > 0) {
|
if (worldBuffer > 0) {
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_OUTSIDEBORDERBUFFER.format(worldBuffer));
|
error = plugin.txt.parse(TL.CLAIM_OUTSIDEBORDERBUFFER.format(worldBuffer));
|
||||||
} else {
|
} else {
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString());
|
error = plugin.txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString());
|
||||||
}
|
}
|
||||||
} else if (currentFaction.isNormal()) {
|
} else if (currentFaction.isNormal()) {
|
||||||
if (myFaction.isPeaceful()) {
|
if (myFaction.isPeaceful()) {
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_PEACEFUL.toString(), currentFaction.getTag(this));
|
error = plugin.txt.parse(TL.CLAIM_PEACEFUL.toString(), currentFaction.getTag(this));
|
||||||
} else if (currentFaction.isPeaceful()) {
|
} else if (currentFaction.isPeaceful()) {
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_PEACEFULTARGET.toString(), currentFaction.getTag(this));
|
error = plugin.txt.parse(TL.CLAIM_PEACEFULTARGET.toString(), currentFaction.getTag(this));
|
||||||
} else if (!currentFaction.hasLandInflation()) {
|
} else if (!currentFaction.hasLandInflation()) {
|
||||||
// TODO more messages WARN current faction most importantly
|
// TODO more messages WARN current faction most importantly
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_THISISSPARTA.toString(), currentFaction.getTag(this));
|
error = plugin.txt.parse(TL.CLAIM_THISISSPARTA.toString(), currentFaction.getTag(this));
|
||||||
} else if (currentFaction.hasLandInflation() && !FactionsPlugin.getInstance().getConfig().getBoolean("hcf.allow-overclaim", true)) {
|
} else if (currentFaction.hasLandInflation() && !plugin.getConfig().getBoolean("hcf.allow-overclaim", true)) {
|
||||||
// deny over claim when it normally would be allowed.
|
// deny over claim when it normally would be allowed.
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_OVERCLAIM_DISABLED.toString());
|
error = plugin.txt.parse(TL.CLAIM_OVERCLAIM_DISABLED.toString());
|
||||||
} else if (!Board.getInstance().isBorderLocation(flocation)) {
|
} else if (!Board.getInstance().isBorderLocation(flocation)) {
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_BORDER.toString());
|
error = plugin.txt.parse(TL.CLAIM_BORDER.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: Add more else if statements.
|
// TODO: Add more else if statements.
|
||||||
@@ -961,9 +972,6 @@ 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;
|
||||||
|
|
||||||
@@ -972,8 +980,9 @@ 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)
|
if (!fly) {
|
||||||
sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3) + ""));
|
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);
|
||||||
}
|
}
|
||||||
@@ -991,6 +1000,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
Bukkit.getScheduler().runTaskLater(FactionsPlugin.getInstance(), () -> setTakeFallDamage(true), 20L * cooldown);
|
Bukkit.getScheduler().runTaskLater(FactionsPlugin.getInstance(), () -> setTakeFallDamage(true), 20L * cooldown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isFlying = fly;
|
isFlying = fly;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1016,8 +1026,14 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
|
|
||||||
public boolean canFlyAtLocation(FLocation location) {
|
public boolean canFlyAtLocation(FLocation location) {
|
||||||
Faction faction = Board.getInstance().getFactionAt(location);
|
Faction faction = Board.getInstance().getFactionAt(location);
|
||||||
if ((faction == getFaction() && getRole() == Role.LEADER) || isAdminBypassing) return true;
|
if ((faction == getFaction() && getRole() == Role.LEADER) || isAdminBypassing) {
|
||||||
if (faction.isSystemFaction()) return CmdFly.checkFly(this, getPlayer(), faction);
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (faction.isSystemFaction()) {
|
||||||
|
return CmdFly.checkBypassPerms(this, getPlayer(), faction, false);
|
||||||
|
}
|
||||||
|
|
||||||
Access access = faction.getAccess(this, PermissableAction.FLY);
|
Access access = faction.getAccess(this, PermissableAction.FLY);
|
||||||
return access == null || access == Access.UNDEFINED || access == Access.ALLOW;
|
return access == null || access == Access.UNDEFINED || access == Access.ALLOW;
|
||||||
}
|
}
|
||||||
@@ -1286,12 +1302,14 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
|
|
||||||
|
|
||||||
// announce success
|
// announce success
|
||||||
|
if(!FactionsPlugin.cachedRadiusClaim) {
|
||||||
Set<FPlayer> informTheseFPlayers = new HashSet<>();
|
Set<FPlayer> informTheseFPlayers = new HashSet<>();
|
||||||
informTheseFPlayers.add(this);
|
informTheseFPlayers.add(this);
|
||||||
informTheseFPlayers.addAll(forFaction.getFPlayersWhereOnline(true));
|
informTheseFPlayers.addAll(forFaction.getFPlayersWhereOnline(true));
|
||||||
for (FPlayer fp : informTheseFPlayers) {
|
for (FPlayer fp : informTheseFPlayers) {
|
||||||
fp.msg(TL.CLAIM_CLAIMED, this.describeTo(fp, true), forFaction.describeTo(fp), currentFaction.describeTo(fp));
|
fp.msg(TL.CLAIM_CLAIMED, this.describeTo(fp, true), forFaction.describeTo(fp), currentFaction.describeTo(fp));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Board.getInstance().setFactionAt(forFaction, flocation);
|
Board.getInstance().setFactionAt(forFaction, flocation);
|
||||||
|
|
||||||
|
|||||||
@@ -1277,9 +1277,10 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
if (Conf.logFactionDisband)
|
if (Conf.logFactionDisband)
|
||||||
FactionsPlugin.getInstance().log("The faction " + this.getTag() + " (" + this.getId() + ") has been disbanded since it has no members left" + (autoLeave ? " and by inactivity" : "") + ".");
|
FactionsPlugin.getInstance().log("The faction " + this.getTag() + " (" + this.getId() + ") has been disbanded since it has no members left" + (autoLeave ? " and by inactivity" : "") + ".");
|
||||||
|
|
||||||
|
if(FactionsPlugin.getInstance().getConfig().getBoolean("faction-disband-broadcast")) {
|
||||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers())
|
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers())
|
||||||
fplayer.msg(TL.COMMAND_DISBAND_BROADCAST_GENERIC, this.getTag(fplayer));
|
fplayer.msg(TL.COMMAND_DISBAND_BROADCAST_GENERIC, this.getTag(fplayer));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FactionDisbandEvent disbandEvent = new FactionDisbandEvent(null, getId(), autoLeave ? PlayerDisbandReason.INACTIVITY : PlayerDisbandReason.LEAVE);
|
FactionDisbandEvent disbandEvent = new FactionDisbandEvent(null, getId(), autoLeave ? PlayerDisbandReason.INACTIVITY : PlayerDisbandReason.LEAVE);
|
||||||
|
|||||||
@@ -141,14 +141,14 @@ public enum TL {
|
|||||||
COMMAND_ADMIN_TARGETSELF("'&c&l[!] &cThe target player musn''t be yourself."),
|
COMMAND_ADMIN_TARGETSELF("'&c&l[!] &cThe target player musn''t be yourself."),
|
||||||
COMMAND_ADMIN_DEMOTES("&c&l[!] &cYou have demoted &7%1$s &cfrom the position of faction admin."),
|
COMMAND_ADMIN_DEMOTES("&c&l[!] &cYou have demoted &7%1$s &cfrom the position of faction admin."),
|
||||||
COMMAND_ADMIN_DEMOTED("&c&l[!] &cYou have been demoted from the position of faction admin by &7%1$s&c"),
|
COMMAND_ADMIN_DEMOTED("&c&l[!] &cYou have been demoted from the position of faction admin by &7%1$s&c"),
|
||||||
COMMAND_ADMIN_PROMOTES("&e&l[!] &eYou have promoted &6%1$s &eto the position of faction admin."),
|
COMMAND_ADMIN_PROMOTES("&c&l[!] &7You have promoted &c%1$s &7to the position of faction admin."),
|
||||||
COMMAND_ADMIN_PROMOTED("&e&l[!] &6%1$s &egave &6%2$s ðe leadership of &6%3$s&e."),
|
COMMAND_ADMIN_PROMOTED("&c&l[!] &c%1$s &7gave &c%2$s &7the leadership of &c%3$s&7."),
|
||||||
COMMAND_ADMIN_DESCRIPTION("Hand over your admin rights"),
|
COMMAND_ADMIN_DESCRIPTION("Hand over your admin rights"),
|
||||||
COMMAND_ADMIN_NOMEMBERS("&e&l[!] &cNo one else to promote, please disband faction."),
|
COMMAND_ADMIN_NOMEMBERS("&e&l[!] &cNo one else to promote, please disband faction."),
|
||||||
|
|
||||||
COMMAND_AHOME_DESCRIPTION("Send a player to their f home no matter what."),
|
COMMAND_AHOME_DESCRIPTION("Send a player to their f home no matter what."),
|
||||||
COMMAND_AHOME_NOHOME("%1$s doesn't have an f home."),
|
COMMAND_AHOME_NOHOME("%1$s doesn't have an f home."),
|
||||||
COMMAND_AHOME_SUCCESS("$1%s was sent to their f home."),
|
COMMAND_AHOME_SUCCESS("%1%s was sent to their f home."),
|
||||||
COMMAND_AHOME_OFFLINE("%1$s is offline."),
|
COMMAND_AHOME_OFFLINE("%1$s is offline."),
|
||||||
COMMAND_AHOME_TARGET("You were sent to your f home."),
|
COMMAND_AHOME_TARGET("You were sent to your f home."),
|
||||||
|
|
||||||
@@ -302,7 +302,7 @@ public enum TL {
|
|||||||
COMMAND_CREATE_TOCREATE("to create a new faction"),
|
COMMAND_CREATE_TOCREATE("to create a new faction"),
|
||||||
COMMAND_CREATE_FORCREATE("for creating a new faction"),
|
COMMAND_CREATE_FORCREATE("for creating a new faction"),
|
||||||
COMMAND_CREATE_ERROR("&c&l[!]&7 There was an &cinternal error&7 while trying to create your faction. &cPlease try again&7."),
|
COMMAND_CREATE_ERROR("&c&l[!]&7 There was an &cinternal error&7 while trying to create your faction. &cPlease try again&7."),
|
||||||
COMMAND_CREATE_CREATED("&c&l[!]&7 &c%1$s &7created a new faction &c&l%2$s"),
|
COMMAND_CREATE_CREATED("&c&l[!]&7 &c%1$s &7created a new faction named &c&l%2$s&7."),
|
||||||
COMMAND_CREATE_YOUSHOULD("&c&l[!]&7 You should now: &c%1$s"),
|
COMMAND_CREATE_YOUSHOULD("&c&l[!]&7 You should now: &c%1$s"),
|
||||||
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"),
|
||||||
@@ -395,20 +395,20 @@ public enum TL {
|
|||||||
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."),
|
||||||
COMMAND_DISBAND_BROADCAST_NOTYOURS("&c&l[!]&7 &c%1$s &7disbanded the faction &c%2$s."),
|
COMMAND_DISBAND_BROADCAST_NOTYOURS("&c&l[!]&7 &c%1$s &7disbanded the faction &c%2$s&7."),
|
||||||
COMMAND_DISBAND_HOLDINGS("&c&l[!]&7 &7You have been given the disbanded &cfaction's bank&7, totaling &c%1$s."),
|
COMMAND_DISBAND_HOLDINGS("&c&l[!]&7 &7You have been given the disbanded &cfaction's bank&7, totaling &c%1$s."),
|
||||||
COMMAND_DISBAND_PLAYER("&c&l[!] &7You have disbanded your &cfaction"),
|
COMMAND_DISBAND_PLAYER("&c&l[!] &7You have disbanded your &cfaction"),
|
||||||
COMMAND_DISBAND_CONFIRM("&c&l[!]&7 Your Faction has&c {tnt} &7tnt left in the bank, it will be &clost&7 if the faction is &cdisbanded&7. Type&c /f disband &7again within &c10&7 seconds to&c disband&7."),
|
COMMAND_DISBAND_CONFIRM("&c&l[!]&7 Your Faction has&c {tnt} &7tnt left in the bank, it will be &clost&7 if the faction is &cdisbanded&7. Type&c /f disband &7again within &c10&7 seconds to&c disband&7."),
|
||||||
COMMAND_DISBAND_DESCRIPTION("Disband a faction"),
|
COMMAND_DISBAND_DESCRIPTION("Disband a faction"),
|
||||||
|
|
||||||
COMMAND_FLY_DISABLED("&c&l[!]&7 Sorry, Faction flight is &cdisabled &7on this server"),
|
COMMAND_FLY_DISABLED("&c&l[!]&7 Sorry, Faction flight is &cdisabled &7on this server."),
|
||||||
COMMAND_FLY_DESCRIPTION("Enter or leave Faction flight mode"),
|
COMMAND_FLY_DESCRIPTION("Enter or leave Faction flight mode"),
|
||||||
COMMAND_FLY_CHANGE("&c&l[!]&7 Faction flight &c%1$s"),
|
COMMAND_FLY_CHANGE("&c&l[!]&7 Faction flight has been &c%1$s&7."),
|
||||||
COMMAND_FLY_COOLDOWN("&c&l[!]&7 You will &cnot&7 take fall damage for &c{amount}&7 seconds"),
|
COMMAND_FLY_COOLDOWN("&c&l[!]&7 You will &cnot&7 take fall damage for &c{amount}&7 seconds."),
|
||||||
COMMAND_FLY_DAMAGE("&c&l[!]&7 Faction flight &cdisabled&7 due to entering combat"),
|
COMMAND_FLY_DAMAGE("&c&l[!]&7 Faction flight &cdisabled&7 due to entering combat."),
|
||||||
COMMAND_FLY_NO_ACCESS("&c&l[!]&7 &cCannot fly &7in territory of %1$s"),
|
COMMAND_FLY_NO_ACCESS("&c&l[!]&7 &cCannot fly &7in territory of %1$s"),
|
||||||
COMMAND_FLY_ENEMY_NEAR("&c&l[!]&7 Flight has been&c disabled&7 an enemy is nearby"),
|
COMMAND_FLY_ENEMY_NEAR("&c&l[!]&7 Flight has been&c disabled&7 an enemy is nearby."),
|
||||||
COMMAND_FLY_CHECK_ENEMY("&c&l[!]&7 Cannot fly here, an enemy is &cnearby"),
|
COMMAND_FLY_CHECK_ENEMY("&c&l[!]&7 Cannot fly here, an enemy is &cnearby&7."),
|
||||||
COMMAND_FLY_NO_EPEARL("&c&l[!] &7You &ccannot&7 throw enderpearls while flying!"),
|
COMMAND_FLY_NO_EPEARL("&c&l[!] &7You &ccannot&7 throw enderpearls while flying!"),
|
||||||
|
|
||||||
COMMAND_FOCUS_SAMEFACTION("&c[!] You may not focus players in your faction!"),
|
COMMAND_FOCUS_SAMEFACTION("&c[!] You may not focus players in your faction!"),
|
||||||
@@ -470,7 +470,7 @@ public enum TL {
|
|||||||
COMMAND_INVITE_TOINVITE("to invite someone"),
|
COMMAND_INVITE_TOINVITE("to invite someone"),
|
||||||
COMMAND_INVITE_FORINVITE("for inviting someone"),
|
COMMAND_INVITE_FORINVITE("for inviting someone"),
|
||||||
COMMAND_INVITE_CLICKTOJOIN("Click to join!"),
|
COMMAND_INVITE_CLICKTOJOIN("Click to join!"),
|
||||||
COMMAND_INVITE_INVITEDYOU(" &chas invited you to join "),
|
COMMAND_INVITE_INVITEDYOU("&l[!]&7 &c%1$s&7 has invited you to join &c%2$s&7"),
|
||||||
COMMAND_INVITE_INVITED("&c&l[!]&7 &c%1$s&7 invited &c%2$s&7 to your faction."),
|
COMMAND_INVITE_INVITED("&c&l[!]&7 &c%1$s&7 invited &c%2$s&7 to your faction."),
|
||||||
COMMAND_ALTINVITE_INVITED_ALT("&c&l[!]&7 &c%1$s&7 invited &c%2$s&7 to your faction as an alt."),
|
COMMAND_ALTINVITE_INVITED_ALT("&c&l[!]&7 &c%1$s&7 invited &c%2$s&7 to your faction as an alt."),
|
||||||
|
|
||||||
@@ -621,7 +621,7 @@ public enum TL {
|
|||||||
COMMAND_OPEN_OPEN("open"),
|
COMMAND_OPEN_OPEN("open"),
|
||||||
COMMAND_OPEN_CLOSED("closed"),
|
COMMAND_OPEN_CLOSED("closed"),
|
||||||
COMMAND_OPEN_CHANGES("&c&l[!]&7 &c%1$s&7 changed the faction to &c%2$s&7."),
|
COMMAND_OPEN_CHANGES("&c&l[!]&7 &c%1$s&7 changed the faction to &c%2$s&7."),
|
||||||
COMMAND_OPEN_CHANGED("&c&l[!]&7 The faction &c%1$s&7 is now &c%2$s"),
|
COMMAND_OPEN_CHANGED("&c&l[!]&7 The faction &c%1$s&7 is now &c%2$s&7."),
|
||||||
COMMAND_OPEN_DESCRIPTION("Switch if invitation is required to join"),
|
COMMAND_OPEN_DESCRIPTION("Switch if invitation is required to join"),
|
||||||
|
|
||||||
COMMAND_OWNER_DISABLED("&c&l[!]&7 Sorry, but &cowned areas &7are &cdisabled &7on this server."),
|
COMMAND_OWNER_DISABLED("&c&l[!]&7 Sorry, but &cowned areas &7are &cdisabled &7on this server."),
|
||||||
@@ -707,11 +707,14 @@ public enum TL {
|
|||||||
COMMAND_PERMANENT_GRANT("&c&l[!]&7 added permanent status to"),
|
COMMAND_PERMANENT_GRANT("&c&l[!]&7 added permanent status to"),
|
||||||
COMMAND_PERMANENT_REVOKE("&c&l[!]&7 removed permanent status from"),
|
COMMAND_PERMANENT_REVOKE("&c&l[!]&7 removed permanent status from"),
|
||||||
COMMAND_PERMANENT_YOURS("&c&l[!]&7 &c%1$s&7 has &c%2$s&7 your faction"),
|
COMMAND_PERMANENT_YOURS("&c&l[!]&7 &c%1$s&7 has &c%2$s&7 your faction"),
|
||||||
COMMAND_PERMANENT_OTHER("&c&l[!]&7 &c%s &7has &c%s &7the faction &c'%s'."),
|
COMMAND_PERMANENT_OTHER("&c&l[!]&7 &c%s &7has &c%s &7the faction '&c%s&7'."),
|
||||||
COMMAND_PROMOTE_TARGET("&c&l[!]&7 You've been &c%1$s&7 to &c%2$s"),
|
COMMAND_PROMOTE_TARGET("&c&l[!]&7 You've been &c%1$s&7 to &c%2$s&7."),
|
||||||
COMMAND_PROMOTE_SUCCESS("&c&l[!]&7 You successfully&c %1$s %2$s &cto&7 %3$s"),
|
COMMAND_PROMOTE_SUCCESS("&c&l[!]&7 You successfully &c%1$s %2$s &cto&7 %3$s&7."),
|
||||||
COMMAND_PROMOTE_PROMOTED("promoted"),
|
COMMAND_PROMOTE_PROMOTED("promoted"),
|
||||||
COMMAND_PROMOTE_DEMOTED("demoted"),
|
COMMAND_PROMOTE_DEMOTED("demoted"),
|
||||||
|
COMMAND_PROMOTE_LOWEST_RANK("&c&l[!]&7 &c%1$s&7 already has the lowest rank in the faction."),
|
||||||
|
COMMAND_PROMOTE_HIGHEST_RANK("&c&l[!]&7 &c%1$s&7 already has the highest rank in the faction."),
|
||||||
|
COMMAND_PROMOTE_HIGHER_RANK("&c&l[!]&7 &c%1$s&7 has a higher rank than yours. You &4can not modify&7 his rank."),
|
||||||
COMMAND_PROMOTE_COLEADER_ADMIN("&c&l[!]&7 &cColeaders cant promote players to Admin!"),
|
COMMAND_PROMOTE_COLEADER_ADMIN("&c&l[!]&7 &cColeaders cant promote players to Admin!"),
|
||||||
|
|
||||||
COMMAND_PERMANENTPOWER_DESCRIPTION("Toggle permanent faction power option"),
|
COMMAND_PERMANENTPOWER_DESCRIPTION("Toggle permanent faction power option"),
|
||||||
@@ -723,7 +726,6 @@ public enum TL {
|
|||||||
COMMAND_PROMOTE_DESCRIPTION("/f promote <name>"),
|
COMMAND_PROMOTE_DESCRIPTION("/f promote <name>"),
|
||||||
COMMAND_PROMOTE_WRONGFACTION("&c&l[!]&7 &c%1$s&7 is &cnot&7 part of your faction."),
|
COMMAND_PROMOTE_WRONGFACTION("&c&l[!]&7 &c%1$s&7 is &cnot&7 part of your faction."),
|
||||||
COMMAND_NOACCESS("&c&l[!]&7 You don't have access to that."),
|
COMMAND_NOACCESS("&c&l[!]&7 You don't have access to that."),
|
||||||
COMMAND_PROMOTE_NOTTHATPLAYER("&c&l[!]&7 That player &ccannot&7 be promoted."),
|
|
||||||
COMMAND_PROMOTE_NOT_ALLOWED("&c&l[!]&7 You cannot promote to the same rank as yourself!"),
|
COMMAND_PROMOTE_NOT_ALLOWED("&c&l[!]&7 You cannot promote to the same rank as yourself!"),
|
||||||
COMMAND_PROMOTE_NOTSELF("&c&l[!]&7 You cannot manage your own rank."),
|
COMMAND_PROMOTE_NOTSELF("&c&l[!]&7 You cannot manage your own rank."),
|
||||||
COMMAND_PROMOTE_NOT_SAME("&c&l[!]&7 You cannot promote to the same rank as yourself!"),
|
COMMAND_PROMOTE_NOT_SAME("&c&l[!]&7 You cannot promote to the same rank as yourself!"),
|
||||||
@@ -750,16 +752,16 @@ public enum TL {
|
|||||||
COMMAND_RELATIONS_ALREADYINRELATIONSHIP("&c&l[!]&7 You &calready&7 have that relation wish set with&c %1$s."),
|
COMMAND_RELATIONS_ALREADYINRELATIONSHIP("&c&l[!]&7 You &calready&7 have that relation wish set with&c %1$s."),
|
||||||
COMMAND_RELATIONS_TOMARRY("to change a relation wish"),
|
COMMAND_RELATIONS_TOMARRY("to change a relation wish"),
|
||||||
COMMAND_RELATIONS_FORMARRY("for changing a relation wish"),
|
COMMAND_RELATIONS_FORMARRY("for changing a relation wish"),
|
||||||
COMMAND_RELATIONS_MUTUAL("&c&l[!]&7 Your faction is now %1$s to %2$s"),
|
COMMAND_RELATIONS_MUTUAL("&c&l[!]&7 Your faction is now %1$s&7 to &c%2$s&7."),
|
||||||
COMMAND_RELATIONS_PEACEFUL("&c&l[!]&7 This will have no effect while your faction is peaceful."),
|
COMMAND_RELATIONS_PEACEFUL("&c&l[!]&7 This will have no effect while your faction is peaceful."),
|
||||||
COMMAND_RELATIONS_PEACEFULOTHER("&c&l[!]&7 This will have &cno effect&7 while their faction is peaceful."),
|
COMMAND_RELATIONS_PEACEFULOTHER("&c&l[!]&7 This will have &cno effect&7 while their faction is peaceful."),
|
||||||
COMMAND_RELATIONS_DESCRIPTION("Set relation wish to another faction"),
|
COMMAND_RELATIONS_DESCRIPTION("Set relation wish to another faction"),
|
||||||
COMMAND_RELATIONS_EXCEEDS_ME("&c&l[!]&7 Failed to set relation wish. You can only have %1$s %2$s."),
|
COMMAND_RELATIONS_EXCEEDS_ME("&c&l[!]&7 Failed to set relation wish. You can only have %1$s %2$s."),
|
||||||
COMMAND_RELATIONS_EXCEEDS_THEY("&c&l[!]&7 Failed to set relation wish. They can only have %1$s %2$s."),
|
COMMAND_RELATIONS_EXCEEDS_THEY("&c&l[!]&7 Failed to set relation wish. They can only have %1$s %2$s."),
|
||||||
|
|
||||||
COMMAND_RELATIONS_PROPOSAL_1("&c&l[!]&7&c %1$s &7wishes to be your&c %2$s"),
|
COMMAND_RELATIONS_PROPOSAL_1("&c&l[!]&7 &c%1$s &7wishes to be your &c%2$s&7."),
|
||||||
COMMAND_RELATIONS_PROPOSAL_2("&c&l[!]&7 Type &c/%1$s %2$s %3$s&7 to accept."),
|
COMMAND_RELATIONS_PROPOSAL_2("&c&l[!]&7 Type &c/%1$s %2$s %3$s&7 to accept."),
|
||||||
COMMAND_RELATIONS_PROPOSAL_SENT("&c&l[!]&7 &c%1$s&7 were informed that you wish to be &c%2$s"),
|
COMMAND_RELATIONS_PROPOSAL_SENT("&c&l[!]&7 &c%1$s&7 were informed that you wish to be &c%2$s&7."),
|
||||||
|
|
||||||
COMMAND_RELOAD_TIME("&c&l[!]&7 Reloaded &call &7configuration files from disk, took &c%1$d ms."),
|
COMMAND_RELOAD_TIME("&c&l[!]&7 Reloaded &call &7configuration files from disk, took &c%1$d ms."),
|
||||||
COMMAND_RELOAD_DESCRIPTION("Reload data file(s) from disk"),
|
COMMAND_RELOAD_DESCRIPTION("Reload data file(s) from disk"),
|
||||||
@@ -972,7 +974,7 @@ public enum TL {
|
|||||||
COMMAND_UNBAN_NOTBANNED("&7%s &cisn't banned. Not doing anything."),
|
COMMAND_UNBAN_NOTBANNED("&7%s &cisn't banned. Not doing anything."),
|
||||||
COMMAND_UNBAN_TARGET_IN_OTHER_FACTION("&c%1$s is not in your faction!"),
|
COMMAND_UNBAN_TARGET_IN_OTHER_FACTION("&c%1$s is not in your faction!"),
|
||||||
COMMAND_UNBAN_UNBANNED("&e%1$s &cunbanned &7%2$s"),
|
COMMAND_UNBAN_UNBANNED("&e%1$s &cunbanned &7%2$s"),
|
||||||
COMMAND_UNBAN_TARGET("&aYou were unbanned from &r%s"),
|
COMMAND_UNBAN_TARGETUNBANNED("&aYou were unbanned from &r%s"),
|
||||||
|
|
||||||
COMMAND_UNCLAIM_SAFEZONE_SUCCESS("Safe zone was unclaimed."),
|
COMMAND_UNCLAIM_SAFEZONE_SUCCESS("Safe zone was unclaimed."),
|
||||||
COMMAND_UNCLAIM_SAFEZONE_NOPERM("This is a safe zone. You lack permissions to unclaim."),
|
COMMAND_UNCLAIM_SAFEZONE_NOPERM("This is a safe zone. You lack permissions to unclaim."),
|
||||||
@@ -1033,12 +1035,12 @@ public enum TL {
|
|||||||
/**
|
/**
|
||||||
* Leaving - This is accessed through a command, and so it MAY need a COMMAND_* slug :s
|
* Leaving - This is accessed through a command, and so it MAY need a COMMAND_* slug :s
|
||||||
*/
|
*/
|
||||||
LEAVE_PASSADMIN("You must give the admin role to someone else first."),
|
LEAVE_PASSADMIN("&c&l[!] &7You must give the admin role to someone else first."),
|
||||||
LEAVE_NEGATIVEPOWER("You cannot leave until your power is positive."),
|
LEAVE_NEGATIVEPOWER("&c&l[!] &7You cannot leave until your power is positive."),
|
||||||
LEAVE_TOLEAVE("to leave your faction."),
|
LEAVE_TOLEAVE("to leave your faction."),
|
||||||
LEAVE_FORLEAVE("for leaving your faction."),
|
LEAVE_FORLEAVE("for leaving your faction."),
|
||||||
LEAVE_LEFT("%s left faction %s."),
|
LEAVE_LEFT("&c&l[!] &c%s&7 left faction &c%s&7."),
|
||||||
LEAVE_DISBANDED("%s was disbanded."),
|
LEAVE_DISBANDED("&c&l[!] &c%s&7 was disbanded."),
|
||||||
LEAVE_DISBANDEDLOG("The faction %s (%s) was disbanded due to the last player (%s) leaving."),
|
LEAVE_DISBANDEDLOG("The faction %s (%s) was disbanded due to the last player (%s) leaving."),
|
||||||
LEAVE_DESCRIPTION("\\n &a&l» &7Leave your faction"),
|
LEAVE_DESCRIPTION("\\n &a&l» &7Leave your faction"),
|
||||||
AUTOLEAVE_ADMIN_PROMOTED("&e&l[!] &7Faction admin &c%s&7 has been removed. &c%s&7 has been promoted as the new faction admin."),
|
AUTOLEAVE_ADMIN_PROMOTED("&e&l[!] &7Faction admin &c%s&7 has been removed. &c%s&7 has been promoted as the new faction admin."),
|
||||||
@@ -1067,6 +1069,7 @@ public enum TL {
|
|||||||
CLAIM_FORCLAIM("for claiming this land"),
|
CLAIM_FORCLAIM("for claiming this land"),
|
||||||
CLAIM_TOOVERCLAIM("to overclaim this land"),
|
CLAIM_TOOVERCLAIM("to overclaim this land"),
|
||||||
CLAIM_FOROVERCLAIM("for over claiming this land"),
|
CLAIM_FOROVERCLAIM("for over claiming this land"),
|
||||||
|
CLAIM_RADIUS_CLAIM("%1$s &eclaimed %2$s chunks &astarting from &e(X: %3$s, Z: %4$s)"),
|
||||||
CLAIM_CLAIMED("%s claimed land for %s from %s."),
|
CLAIM_CLAIMED("%s claimed land for %s from %s."),
|
||||||
CLAIM_CLAIMEDLOG("%s claimed land at (%s) for the faction: %s"),
|
CLAIM_CLAIMEDLOG("%s claimed land at (%s) for the faction: %s"),
|
||||||
CLAIM_OVERCLAIM_DISABLED("Over claiming is disabled on this server."),
|
CLAIM_OVERCLAIM_DISABLED("Over claiming is disabled on this server."),
|
||||||
@@ -1121,6 +1124,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!"),
|
||||||
GENERIC_WORLDGUARD("&cThis area is worldguard protected."),
|
GENERIC_WORLDGUARD("&cThis area is worldguard protected."),
|
||||||
|
GRACE_DISABLED_PLACEHOLDER("Disabled"),
|
||||||
|
|
||||||
// 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"),
|
||||||
@@ -1170,7 +1174,7 @@ public enum TL {
|
|||||||
ECON_PERSONTOOKMONEYFROM("%1$s took %2$s from %3$s."),
|
ECON_PERSONTOOKMONEYFROM("%1$s took %2$s from %3$s."),
|
||||||
ECON_DISABLED("Factions econ is disabled."),
|
ECON_DISABLED("Factions econ is disabled."),
|
||||||
ECON_OVER_BAL_CAP("&4The amount &e%s &4is over Essentials' balance cap."),
|
ECON_OVER_BAL_CAP("&4The amount &e%s &4is over Essentials' balance cap."),
|
||||||
ECON_MONEYLOST("&c%s &7lost &c%s &7%s."),
|
ECON_MONEYLOST("&c&l[!] %s &7lost &c%s &7%s."),
|
||||||
ECON_CANTAFFORD("&c%s &7can't afford &c%s&7 %s."),
|
ECON_CANTAFFORD("&c%s &7can't afford &c%s&7 %s."),
|
||||||
ECON_UNABLETOTRANSFER("&7Unable to transfer &c%s&7 to &c%s&7 from &c%s&7."),
|
ECON_UNABLETOTRANSFER("&7Unable to transfer &c%s&7 to &c%s&7 from &c%s&7."),
|
||||||
ECON_PLAYERBALANCE("&c%s&7's balance is &c%s&7."),
|
ECON_PLAYERBALANCE("&c%s&7's balance is &c%s&7."),
|
||||||
@@ -1283,7 +1287,9 @@ public enum TL {
|
|||||||
WARMUPS_NOTIFY_FLIGHT("&eFlight will enable in &d%2$d &eseconds."),
|
WARMUPS_NOTIFY_FLIGHT("&eFlight will enable in &d%2$d &eseconds."),
|
||||||
WARMUPS_NOTIFY_TELEPORT("&eYou will teleport to &d%1$s &ein &d%2$d &eseconds."),
|
WARMUPS_NOTIFY_TELEPORT("&eYou will teleport to &d%1$s &ein &d%2$d &eseconds."),
|
||||||
WARMUPS_ALREADY("&cYou are already warming up."),
|
WARMUPS_ALREADY("&cYou are already warming up."),
|
||||||
WARMUPS_CANCELLED("&cYou have cancelled your warmup.");
|
WARMUPS_CANCELLED("&cYou have cancelled your warmup."),
|
||||||
|
|
||||||
|
PLACEHOLDERAPI_NULL("");
|
||||||
|
|
||||||
public static SimpleDateFormat sdf;
|
public static SimpleDateFormat sdf;
|
||||||
private static YamlConfiguration LANG;
|
private static YamlConfiguration LANG;
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ public class TagUtil {
|
|||||||
if (FactionsPlugin.getInstance().isMVdWPlaceholderAPIHooked() && player.isOnline()) {
|
if (FactionsPlugin.getInstance().isMVdWPlaceholderAPIHooked() && player.isOnline()) {
|
||||||
line = be.maximvdw.placeholderapi.PlaceholderAPI.replacePlaceholders(player, line);
|
line = be.maximvdw.placeholderapi.PlaceholderAPI.replacePlaceholders(player, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,33 +47,45 @@ public class TextUtil {
|
|||||||
String text = "";
|
String text = "";
|
||||||
FancyMessage message = new FancyMessage(text);
|
FancyMessage message = new FancyMessage(text);
|
||||||
ChatColor color = null;
|
ChatColor color = null;
|
||||||
|
ChatColor style = null;
|
||||||
char[] chars = first.toCharArray();
|
char[] chars = first.toCharArray();
|
||||||
|
|
||||||
for (int i = 0; i < chars.length; i++) {
|
for (int i = 0; i < chars.length; i++) {
|
||||||
// changed this so javadocs wont throw an error
|
// changed this so javadocs wont throw an error
|
||||||
String compareChar = chars[i] + "";
|
String compareChar = chars[i] + "";
|
||||||
if (compareChar.equals("§")) {
|
if (compareChar.equals("§")) {
|
||||||
if (color != null) {
|
if (color != null || style != null) {
|
||||||
if (color.isColor()) {
|
message.then(text);
|
||||||
message.then(text).color(color);
|
if (color != null)
|
||||||
} else {
|
message.color(color);
|
||||||
message.then(text).style(color);
|
if (style != null) {
|
||||||
|
message.style(style);
|
||||||
|
style = null;
|
||||||
}
|
}
|
||||||
text = "";
|
text = "";
|
||||||
}
|
}
|
||||||
color = ChatColor.getByChar(chars[i + 1]);
|
ChatColor tempColor = ChatColor.getByChar(chars[i + 1]);
|
||||||
|
if (tempColor != null) {
|
||||||
|
if (tempColor == ChatColor.RESET) {
|
||||||
|
color = ChatColor.WHITE;
|
||||||
|
} else if (tempColor.isColor()) {
|
||||||
|
color = tempColor;
|
||||||
|
} else {
|
||||||
|
style = tempColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
i++; // skip color char
|
i++; // skip color char
|
||||||
} else {
|
} else {
|
||||||
text += chars[i];
|
text += chars[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (text.length() > 0) {
|
if (text.length() > 0) {
|
||||||
if (color != null) {
|
if (color != null || style != null) {
|
||||||
if (color.isColor()) {
|
message.then(text);
|
||||||
message.then(text).color(color);
|
if (color != null)
|
||||||
} else {
|
message.color(color);
|
||||||
message.then(text).style(color);
|
if (style != null)
|
||||||
}
|
message.style(style);
|
||||||
} else {
|
} else {
|
||||||
message.text(text);
|
message.text(text);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -362,7 +362,9 @@ help:
|
|||||||
- '&c/f banlist &8- &7List banned players from your faction.'
|
- '&c/f banlist &8- &7List banned players from your faction.'
|
||||||
- '&c/f lowpower &8- &7List player with power under max from your faction.'
|
- '&c/f lowpower &8- &7List player with power under max from your faction.'
|
||||||
- '&c/f coords &8- &7Broadcast your location to your faction.'
|
- '&c/f coords &8- &7Broadcast your location to your faction.'
|
||||||
|
#THIS IS AFFILIATED WITH F PERMS PERMISSION (TERRITORY) LOL
|
||||||
- '&c/f showclaims &8- &7List all claims from your faction.'
|
- '&c/f showclaims &8- &7List all claims from your faction.'
|
||||||
|
#THIS IS AFFILIATED WITH F PERMS PERMISSION (TERRITORY) LOL
|
||||||
- '&7&m--------------------&r &e/f help 2 &7&m-----------------------'
|
- '&7&m--------------------&r &e/f help 2 &7&m-----------------------'
|
||||||
'2':
|
'2':
|
||||||
- '&7&m----------------------------------------------------'
|
- '&7&m----------------------------------------------------'
|
||||||
@@ -600,6 +602,7 @@ fwarp-gui:
|
|||||||
faction-creation-broadcast: true #Disabling this will not make faction creation broadcasts appear in chat.
|
faction-creation-broadcast: true #Disabling this will not make faction creation broadcasts appear in chat.
|
||||||
faction-disband-broadcast: true #Disabling this will not make faction disband broadcasts appear in chat.
|
faction-disband-broadcast: true #Disabling this will not make faction disband broadcasts appear in chat.
|
||||||
faction-open-broadcast: true #Disabling this will not make faction open broadcasts appear in chat.
|
faction-open-broadcast: true #Disabling this will not make faction open broadcasts appear in chat.
|
||||||
|
faction-leader-broadcast: true #Disabling this will not make leader changes appear in chat.
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
@@ -753,6 +756,7 @@ Falling-Block-Fix:
|
|||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
############################################################
|
############################################################
|
||||||
f-disband-gui:
|
f-disband-gui:
|
||||||
|
title: '&7Confirm Disband'
|
||||||
confirm-item:
|
confirm-item:
|
||||||
Type: LIME_STAINED_GLASS_PANE
|
Type: LIME_STAINED_GLASS_PANE
|
||||||
Name: '&a&lConfirm'
|
Name: '&a&lConfirm'
|
||||||
@@ -828,7 +832,7 @@ Missions:
|
|||||||
- "&b&lMine &f&n10,000&r &2Sugar Cane"
|
- "&b&lMine &f&n10,000&r &2Sugar Cane"
|
||||||
Mission:
|
Mission:
|
||||||
Type: "MINE"
|
Type: "MINE"
|
||||||
Material: "SUGAR_CANE_BLOCK"
|
Material: "SUGAR_CANE"
|
||||||
Amount: 10000
|
Amount: 10000
|
||||||
Reward:
|
Reward:
|
||||||
Commands: ["f points add %faction% 100"]
|
Commands: ["f points add %faction% 100"]
|
||||||
@@ -1246,9 +1250,9 @@ fupgrades:
|
|||||||
Members:
|
Members:
|
||||||
Max-Level: 3
|
Max-Level: 3
|
||||||
Members-Limit:
|
Members-Limit:
|
||||||
level-1: 30
|
level-1: 5 #The Number Of Members It Will Increase By
|
||||||
level-2: 35
|
level-2: 10
|
||||||
level-3: 40
|
level-3: 15
|
||||||
Cost:
|
Cost:
|
||||||
level-1: 1000000
|
level-1: 1000000
|
||||||
level-2: 2000000
|
level-2: 2000000
|
||||||
@@ -1262,9 +1266,9 @@ fupgrades:
|
|||||||
- '&7&oYour current level is &e&l&o{level}'
|
- '&7&oYour current level is &e&l&o{level}'
|
||||||
- ''
|
- ''
|
||||||
- '&c&lFaction Member Limit'
|
- '&c&lFaction Member Limit'
|
||||||
- '&4&l* &cLevel 1: &f30'
|
- '&4&l* &cLevel 1: &f35'
|
||||||
- '&4&l* &cLevel 2: &f35'
|
- '&4&l* &cLevel 2: &f40'
|
||||||
- '&4&l* &cLevel 3: &f40'
|
- '&4&l* &cLevel 3: &f45'
|
||||||
- '&f'
|
- '&f'
|
||||||
- '&c&lCosts'
|
- '&c&lCosts'
|
||||||
- '&4&l* &cLevel 1: &f$1,000,000'
|
- '&4&l* &cLevel 1: &f$1,000,000'
|
||||||
@@ -1444,6 +1448,7 @@ Wild:
|
|||||||
Zones:
|
Zones:
|
||||||
# You may create your own zones here please just follow the original format #
|
# You may create your own zones here please just follow the original format #
|
||||||
Close:
|
Close:
|
||||||
|
World: World
|
||||||
Range:
|
Range:
|
||||||
MinX: -200
|
MinX: -200
|
||||||
MaxX: 200
|
MaxX: 200
|
||||||
@@ -1458,6 +1463,7 @@ Wild:
|
|||||||
Name: '&cLow Range'
|
Name: '&cLow Range'
|
||||||
Slot: 1
|
Slot: 1
|
||||||
Medium:
|
Medium:
|
||||||
|
World: World
|
||||||
Range:
|
Range:
|
||||||
MinX: -400
|
MinX: -400
|
||||||
MaxX: 400
|
MaxX: 400
|
||||||
@@ -1472,6 +1478,7 @@ Wild:
|
|||||||
Name: '&cMedium Range'
|
Name: '&cMedium Range'
|
||||||
Slot: 4
|
Slot: 4
|
||||||
Far:
|
Far:
|
||||||
|
World: World
|
||||||
Range:
|
Range:
|
||||||
MinX: -800
|
MinX: -800
|
||||||
MaxX: 800
|
MaxX: 800
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ COMMAND:
|
|||||||
INUSE: <b>That tag is already in use.
|
INUSE: <b>That tag is already in use.
|
||||||
TOCREATE: to create a new faction
|
TOCREATE: to create a new faction
|
||||||
FORCREATE: for creating a new faction
|
FORCREATE: for creating a new faction
|
||||||
ERROR: <b>There was an internal error while trying to create your faction. Please try again.
|
ERROR: '<b>There was an internal error while trying to create your faction. Please try again.'
|
||||||
CREATED: %s<i> created a new faction %s
|
CREATED: '%s<i> created a new faction %s'
|
||||||
CREATEDLOG: ' は新しい党派を造りました: '
|
CREATEDLOG: ' は新しい党派を造りました: '
|
||||||
YOUSHOULD: '<i>You should now: %s'
|
YOUSHOULD: '<i>You should now: %s'
|
||||||
DEINVITE:
|
DEINVITE:
|
||||||
|
|||||||
Reference in New Issue
Block a user