Compare commits
94 Commits
2.3.2
...
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 | ||
|
|
4496d4251b | ||
|
|
d86d8fc73a | ||
|
|
380caf1ca3 | ||
|
|
103c69fecf | ||
|
|
d4ac0ab310 | ||
|
|
8fb697888f | ||
|
|
b15ff69682 | ||
|
|
919a3ada25 | ||
|
|
62e4114466 | ||
|
|
cb2afb5a4f | ||
|
|
8efe68111b | ||
|
|
388f83694d | ||
|
|
23320db201 | ||
|
|
0c5cc3a978 | ||
|
|
8d1b26e561 | ||
|
|
ef90cd5be8 | ||
|
|
5809387df2 | ||
|
|
5cf21d479e | ||
|
|
44cac68a15 |
@@ -1,6 +1,7 @@
|
||||
# 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.
|
||||
|
||||
@@ -32,7 +33,7 @@ Some of our features include the following
|
||||
<dependency>
|
||||
<groupId>com.github.SaberLLC</groupId>
|
||||
<artifactId>Saber-Factions</artifactId>
|
||||
<version>2.2.7-STABLE</version>
|
||||
<version>2.3.3-STABLE</version>
|
||||
</dependency>
|
||||
```
|
||||
## Moving Forward
|
||||
|
||||
20
pom.xml
20
pom.xml
@@ -4,7 +4,7 @@
|
||||
|
||||
<groupId>com.massivecraft</groupId>
|
||||
<artifactId>Factions</artifactId>
|
||||
<version>1.6.9.5-2.3.2-RC</version>
|
||||
<version>1.6.9.5-2.3.7-RC</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>SaberFactions</name>
|
||||
@@ -41,6 +41,14 @@
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com.github.stefvanschie.inventoryframework</pattern>
|
||||
<shadedPattern>com.massivecraft.factions.shade.stefvanschie.inventoryframework</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.bstats</pattern>
|
||||
<shadedPattern>com.massivecraft.factions.shade.org.bstats</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>net.dv8tion</pattern>
|
||||
<shadedPattern>com.massivecraft.factions.shade.net.dv8tion</shadedPattern>
|
||||
@@ -403,9 +411,19 @@
|
||||
<version>2.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>CodeMC</id>
|
||||
<url>https://repo.codemc.org/repository/maven-public</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>central</id>
|
||||
<name>bintray</name>
|
||||
|
||||
@@ -22,6 +22,7 @@ public class Conf {
|
||||
public static final transient String DYNMAP_STYLE_HOME_MARKER = "greenflag";
|
||||
public static final transient boolean DYNMAP_STYLE_BOOST = false;
|
||||
public static List<String> baseCommandAliases = new ArrayList<>();
|
||||
public static String serverTimeZone = "EST";
|
||||
public static boolean allowNoSlashCommand = true;
|
||||
|
||||
// Colors
|
||||
@@ -54,8 +55,8 @@ public class Conf {
|
||||
public static boolean factionTagForceUpperCase = false;
|
||||
public static boolean newFactionsDefaultOpen = false;
|
||||
// when faction membership hits this limit, players will no longer be able to join using /f join; default is 0, no limit
|
||||
public static int factionMemberLimit = 0;
|
||||
public static int factionAltMemberLimit = 0;
|
||||
public static int factionMemberLimit = 30;
|
||||
public static int factionAltMemberLimit = 10;
|
||||
// what faction ID to start new players in when they first join the server; default is 0, "no faction"
|
||||
public static String newPlayerStartingFactionID = "0";
|
||||
public static boolean showMapFactionKey = true;
|
||||
@@ -86,7 +87,9 @@ public class Conf {
|
||||
public static int factionBufferSize = 20;
|
||||
public static boolean useCheckSystem = true;
|
||||
public static boolean spawnerLock = false;
|
||||
public static boolean gracePeriod = false;
|
||||
public static boolean useGraceSystem = true;
|
||||
public static boolean broadcastGraceToggles = true;
|
||||
public static int gracePeriodTimeDays = 7;
|
||||
public static boolean noEnderpearlsInFly = false;
|
||||
public static boolean broadcastDescriptionChanges = false;
|
||||
public static boolean broadcastTagChanges = false;
|
||||
@@ -95,10 +98,16 @@ public class Conf {
|
||||
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 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 worldGuardChecking = false;
|
||||
public static boolean worldGuardBuildPriority = false;
|
||||
|
||||
//RADIUS CLAIMING
|
||||
public static boolean useRadiusClaimSystem = true;
|
||||
|
||||
//FRIENDLY FIRE
|
||||
public static boolean friendlyFireFPlayersCommand = false;
|
||||
|
||||
//Claim Fill
|
||||
public static int maxFillClaimCount = 25;
|
||||
@@ -117,7 +126,7 @@ public class Conf {
|
||||
public static boolean useDisbandGUI = true;
|
||||
|
||||
//SEALTH
|
||||
public static boolean useSealthSystem = true;
|
||||
public static boolean useStealthSystem = true;
|
||||
|
||||
//STRIKES
|
||||
public static boolean useStrikeSystem = true;
|
||||
@@ -270,8 +279,7 @@ public class Conf {
|
||||
/// Useful for HCF features.
|
||||
/// </summary>
|
||||
public static Set<Material> territoryBypassProtectedMaterials = EnumSet.noneOf(Material.class);
|
||||
// Dependency check
|
||||
public static boolean dependencyCheck = true;
|
||||
|
||||
public static boolean enableClickToClaim = true;
|
||||
|
||||
public static Set<Material> territoryCancelAndAllowItemUseMaterial = new HashSet<>();
|
||||
@@ -282,7 +290,7 @@ public class Conf {
|
||||
public static boolean econEnabled = false;
|
||||
public static String econUniverseAccount = "";
|
||||
public static double econCostClaimWilderness = 30.0;
|
||||
public static double econCostClaimFromFactionBonus = 30.0;
|
||||
public static double econCostClaimFromFactionBonus = 0.0;
|
||||
public static double econOverclaimRewardMultiplier = 0.0;
|
||||
public static double econClaimAdditionalMultiplier = 0.5;
|
||||
public static double econClaimRefundMultiplier = 0.7;
|
||||
@@ -418,6 +426,10 @@ public class Conf {
|
||||
public static HashMap<String, DefaultPermissions> defaultFactionPermissions = new HashMap<>();
|
||||
public static HashSet<PermissableAction> lockedPermissions = new HashSet<>();
|
||||
|
||||
public static boolean useComplexFly = true;
|
||||
|
||||
public static boolean wildLoadChunkBeforeTeleport = true;
|
||||
|
||||
private static transient Conf i = new Conf();
|
||||
|
||||
static {
|
||||
@@ -548,7 +560,6 @@ public class Conf {
|
||||
territoryDenyUsageMaterials.add(Material.ARMOR_STAND);
|
||||
}
|
||||
|
||||
|
||||
territoryProtectedMaterialsWhenOffline.add(Material.BEACON);
|
||||
|
||||
territoryDenyUsageMaterialsWhenOffline.add(XMaterial.FIRE_CHARGE.parseMaterial());
|
||||
|
||||
@@ -288,6 +288,11 @@ public interface FPlayer extends EconomyParticipator {
|
||||
|
||||
boolean hasMoney(int amt);
|
||||
|
||||
//Fplayer specific friendly fire.
|
||||
boolean hasFriendlyFire();
|
||||
|
||||
void setFriendlyFire(boolean status);
|
||||
|
||||
//inspect Stuff
|
||||
|
||||
boolean isInspectMode();
|
||||
@@ -387,6 +392,7 @@ public interface FPlayer extends EconomyParticipator {
|
||||
// Actions
|
||||
// -------------------------------
|
||||
|
||||
|
||||
void leave(boolean makePay);
|
||||
|
||||
boolean canClaimForFaction(Faction forFaction);
|
||||
|
||||
@@ -21,11 +21,11 @@ import com.massivecraft.factions.integration.Worldguard;
|
||||
import com.massivecraft.factions.integration.dynmap.EngineDynmap;
|
||||
import com.massivecraft.factions.listeners.*;
|
||||
import com.massivecraft.factions.missions.MissionHandler;
|
||||
import com.massivecraft.factions.struct.ChatMode;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.util.*;
|
||||
import com.massivecraft.factions.util.adapters.*;
|
||||
import com.massivecraft.factions.util.timer.TimerManager;
|
||||
import com.massivecraft.factions.util.wait.WaitExecutor;
|
||||
import com.massivecraft.factions.zcore.CommandVisibility;
|
||||
import com.massivecraft.factions.zcore.MPlugin;
|
||||
@@ -34,19 +34,19 @@ import com.massivecraft.factions.zcore.fperms.Access;
|
||||
import com.massivecraft.factions.zcore.fperms.Permissable;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.frame.fupgrades.UpgradesListener;
|
||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
||||
import me.lucko.commodore.CommodoreProvider;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.*;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
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.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
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.RegisteredServiceProvider;
|
||||
|
||||
@@ -65,6 +65,7 @@ public class FactionsPlugin extends MPlugin {
|
||||
// Our single plugin instance.
|
||||
// Single 4 life.
|
||||
public static FactionsPlugin instance;
|
||||
public static boolean cachedRadiusClaim;
|
||||
public static Permission perms = null;
|
||||
// This plugin sets the boolean true when fully enabled.
|
||||
// Plugins can check this boolean while hooking in have
|
||||
@@ -81,7 +82,6 @@ public class FactionsPlugin extends MPlugin {
|
||||
public boolean mc114 = false;
|
||||
public boolean mc115 = false;
|
||||
public boolean useNonPacketParticles = false;
|
||||
public boolean factionsFlight = false;
|
||||
public List<String> itemList = getConfig().getStringList("fchest.Items-Not-Allowed");
|
||||
SkriptAddon skriptAddon;
|
||||
private FactionsPlayerListener factionsPlayerListener;
|
||||
@@ -96,10 +96,7 @@ public class FactionsPlugin extends MPlugin {
|
||||
private FLogManager fLogManager;
|
||||
private List<ReserveObject> reserveObjects;
|
||||
private FileManager fileManager;
|
||||
|
||||
public FileManager getFileManager() {
|
||||
return fileManager;
|
||||
}
|
||||
private TimerManager timerManager;
|
||||
|
||||
public FactionsPlugin() {
|
||||
instance = this;
|
||||
@@ -109,6 +106,10 @@ public class FactionsPlugin extends MPlugin {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public FileManager getFileManager() {
|
||||
return fileManager;
|
||||
}
|
||||
|
||||
public boolean getLocked() {
|
||||
return this.locked;
|
||||
}
|
||||
@@ -127,28 +128,20 @@ public class FactionsPlugin extends MPlugin {
|
||||
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
|
||||
public void onEnable() {
|
||||
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]);
|
||||
switch (version) {
|
||||
case 7:
|
||||
@@ -178,34 +171,25 @@ public class FactionsPlugin extends MPlugin {
|
||||
migrateFPlayerLeaders();
|
||||
log("==== End Setup ====");
|
||||
|
||||
if (!preEnable()) return;
|
||||
this.loadSuccessful = false;
|
||||
int pluginId = 7013;
|
||||
Metrics metrics = new Metrics(this, pluginId);
|
||||
|
||||
if (!new File(this.getDataFolder() + "/config.yml").exists()) {
|
||||
this.saveResource("config.yml", false);
|
||||
this.reloadConfig();
|
||||
if (!preEnable()) {
|
||||
this.loadSuccessful = false;
|
||||
return;
|
||||
}
|
||||
|
||||
saveDefaultConfig();
|
||||
//Start wait task executor
|
||||
WaitExecutor.startTask();
|
||||
// Load Conf from disk
|
||||
fileManager = new FileManager();
|
||||
getFileManager().setupFiles();
|
||||
Conf.load();
|
||||
|
||||
fileManager = new FileManager();
|
||||
fileManager.setupFiles();
|
||||
|
||||
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();
|
||||
hookedPlayervaults = setupPlayervaults();
|
||||
FPlayers.getInstance().load();
|
||||
@@ -222,6 +206,12 @@ public class FactionsPlugin extends MPlugin {
|
||||
else faction.addFPlayer(fPlayer);
|
||||
}
|
||||
|
||||
Factions.getInstance().getAllFactions().forEach(Faction::refreshFPlayers);
|
||||
|
||||
if (getConfig().getBoolean("enable-faction-flight", true)) {
|
||||
UtilFly.run();
|
||||
}
|
||||
|
||||
|
||||
Board.getInstance().load();
|
||||
Board.getInstance().clean();
|
||||
@@ -241,15 +231,15 @@ public class FactionsPlugin extends MPlugin {
|
||||
// start up task which runs the autoLeaveAfterDaysOfInactivity routine
|
||||
startAutoLeaveTask(false);
|
||||
|
||||
cachedRadiusClaim = Conf.useRadiusClaimSystem;
|
||||
|
||||
if (version > 8) {
|
||||
useNonPacketParticles = true;
|
||||
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) {
|
||||
log("Skript was found! Registering FactionsPlugin Addon...");
|
||||
log("Skript was found! Registering SaberFactions Addon...");
|
||||
skriptAddon = Skript.registerAddon(this);
|
||||
try {
|
||||
skriptAddon.loadClasses("com.massivecraft.factions.skript", "expressions");
|
||||
@@ -258,6 +248,7 @@ public class FactionsPlugin extends MPlugin {
|
||||
}
|
||||
log("Skript addon registered!");
|
||||
}
|
||||
|
||||
if (Conf.useCheckSystem) {
|
||||
int minute = 1200;
|
||||
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new CheckTask(this, 3), 0L, minute * 3);
|
||||
@@ -273,6 +264,10 @@ public class FactionsPlugin extends MPlugin {
|
||||
|
||||
fLogManager.loadLogs(this);
|
||||
|
||||
this.timerManager = new TimerManager(this);
|
||||
this.timerManager.reloadTimerData();
|
||||
System.out.println("[SABER-FACTIONS] - Loaded " + timerManager.getTimers().size() + " timers into list!");
|
||||
|
||||
getServer().getPluginManager().registerEvents(factionsPlayerListener = new FactionsPlayerListener(), this);
|
||||
|
||||
// Register Event Handlers
|
||||
@@ -291,9 +286,14 @@ public class FactionsPlugin extends MPlugin {
|
||||
for (Listener eventListener : eventsListener)
|
||||
getServer().getPluginManager().registerEvents(eventListener, this);
|
||||
|
||||
if (Conf.useGraceSystem) {
|
||||
getServer().getPluginManager().registerEvents(timerManager.graceTimer, this);
|
||||
}
|
||||
|
||||
this.getCommand(refCommand).setExecutor(cmdBase);
|
||||
|
||||
if (!CommodoreProvider.isSupported()) this.getCommand(refCommand).setTabCompleter(this);
|
||||
|
||||
reserveObjects = new ArrayList<>();
|
||||
String path = Paths.get(this.getDataFolder().getAbsolutePath()).toAbsolutePath().toString() + File.separator + "reserves.json";
|
||||
File file = new File(path);
|
||||
@@ -313,6 +313,7 @@ public class FactionsPlugin extends MPlugin {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (getDescription().getFullName().contains("BETA")) {
|
||||
divider();
|
||||
System.out.println("You are using a BETA version of the plugin!");
|
||||
@@ -328,10 +329,6 @@ public class FactionsPlugin extends MPlugin {
|
||||
FactionsPlugin.startupFinished = true;
|
||||
}
|
||||
|
||||
public SkriptAddon getSkriptAddon() {
|
||||
return skriptAddon;
|
||||
}
|
||||
|
||||
|
||||
private void setupPlaceholderAPI() {
|
||||
Plugin clip = getServer().getPluginManager().getPlugin("PlaceholderAPI");
|
||||
@@ -438,6 +435,19 @@ public class FactionsPlugin extends MPlugin {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
if (this.AutoLeaveTask != null) {
|
||||
getServer().getScheduler().cancelTask(this.AutoLeaveTask);
|
||||
this.AutoLeaveTask = null;
|
||||
}
|
||||
|
||||
Conf.saveSync();
|
||||
timerManager.saveTimerData();
|
||||
DiscordListener.saveGuilds();
|
||||
|
||||
if (Discord.jda != null) Discord.jda.shutdownNow();
|
||||
|
||||
fLogManager.saveLogs();
|
||||
|
||||
try {
|
||||
String path = Paths.get(getDataFolder().getAbsolutePath()).toAbsolutePath().toString() + File.separator + "reserves.json";
|
||||
File file = new File(path);
|
||||
@@ -450,24 +460,7 @@ public class FactionsPlugin extends MPlugin {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// only save data if plugin actually completely loaded successfully
|
||||
if (this.loadSuccessful) Conf.saveSync();
|
||||
|
||||
|
||||
if (AutoLeaveTask != null) {
|
||||
this.getServer().getScheduler().cancelTask(AutoLeaveTask);
|
||||
AutoLeaveTask = null;
|
||||
}
|
||||
DiscordListener.saveGuilds();
|
||||
if (Discord.jda != null) {
|
||||
Discord.jda.shutdownNow();
|
||||
}
|
||||
super.onDisable();
|
||||
try {
|
||||
fLogManager.saveLogs();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void startAutoLeaveTask(boolean restartIfRunning) {
|
||||
@@ -488,26 +481,9 @@ public class FactionsPlugin extends MPlugin {
|
||||
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() {
|
||||
RegisteredServiceProvider<Economy> rsp = FactionsPlugin.instance.getServer().getServicesManager().getRegistration(Economy.class);
|
||||
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
|
||||
return rsp.getProvider();
|
||||
}
|
||||
|
||||
@@ -522,14 +498,6 @@ public class FactionsPlugin extends MPlugin {
|
||||
return sender instanceof Player && FactionsPlayerListener.preventCommand(commandString, (Player) sender) || super.handleCommand(sender, commandString, testOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] split) {
|
||||
if (split.length == 0) return handleCommand(sender, "/f help", false);
|
||||
|
||||
// otherwise, needs to be handled; presumably another plugin directly ran the command
|
||||
String cmd = Conf.baseCommandAliases.isEmpty() ? "/f" : "/" + Conf.baseCommandAliases.get(0);
|
||||
return handleCommand(sender, cmd + " " + TextUtil.implode(Arrays.asList(split), " "), false);
|
||||
}
|
||||
|
||||
// This method must stay for < 1.12 versions
|
||||
@Override
|
||||
@@ -540,7 +508,6 @@ public class FactionsPlugin extends MPlugin {
|
||||
List<FCommand> commandsList = cmdBase.subCommands;
|
||||
FCommand commandsEx = cmdBase;
|
||||
List<String> completions = new ArrayList<>();
|
||||
|
||||
// Check for "" first arg because spigot is mangled.
|
||||
if (context.args.get(0).equals("")) {
|
||||
for (FCommand subCommand : commandsEx.subCommands) {
|
||||
@@ -588,70 +555,11 @@ public class FactionsPlugin extends MPlugin {
|
||||
// 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
|
||||
public void handleFactionTagExternally(boolean 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() {
|
||||
return fLogManager;
|
||||
}
|
||||
@@ -660,14 +568,6 @@ public class FactionsPlugin extends MPlugin {
|
||||
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) {
|
||||
line = ChatColor.translateAlternateColorCodes('&', line);
|
||||
return line;
|
||||
@@ -679,43 +579,19 @@ public class FactionsPlugin extends MPlugin {
|
||||
return lore;
|
||||
}
|
||||
|
||||
// Get a list of all faction tags (names)
|
||||
public Set<String> getFactionTags() {
|
||||
return Factions.getInstance().getFactionTags();
|
||||
}
|
||||
|
||||
public List<ReserveObject> getFactionReserves() {
|
||||
return this.reserveObjects;
|
||||
}
|
||||
|
||||
// Get a list of all players in the specified faction
|
||||
public Set<String> getPlayersInFaction(String factionTag) {
|
||||
Set<String> players = new HashSet<>();
|
||||
Faction faction = Factions.getInstance().getByTag(factionTag);
|
||||
if (faction != null) {
|
||||
for (FPlayer fplayer : faction.getFPlayers()) players.add(fplayer.getName());
|
||||
}
|
||||
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) {
|
||||
return perms == null || !perms.hasGroupSupport() ? " " : perms.getPrimaryGroup(Bukkit.getWorlds().get(0).toString(), player);
|
||||
}
|
||||
|
||||
public TimerManager getTimerManager() {
|
||||
return timerManager;
|
||||
}
|
||||
|
||||
public void debug(Level level, String s) {
|
||||
if (getConfig().getBoolean("debug", false)) getLogger().log(level, s);
|
||||
}
|
||||
@@ -728,7 +604,4 @@ public class FactionsPlugin extends MPlugin {
|
||||
debug(Level.INFO, s);
|
||||
}
|
||||
|
||||
public Worldguard getWg() {
|
||||
return wg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ public class Aliases {
|
||||
/**
|
||||
* @author DroppingAnvil
|
||||
*/
|
||||
|
||||
public static ArrayList<String> friendlyFire = new ArrayList<>(Arrays.asList("friendlyfire", "ff"));
|
||||
public static ArrayList<String> notifications = new ArrayList<>(Arrays.asList("notifications", "notis"));
|
||||
public static ArrayList<String> alts_alts = new ArrayList<>(Arrays.asList("alts", "alt"));
|
||||
public static ArrayList<String> alts_list = new ArrayList<>(Arrays.asList("list", "l"));
|
||||
|
||||
@@ -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");
|
||||
|
||||
// Inform all players
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
fplayer.msg(TL.COMMAND_ADMIN_PROMOTED,
|
||||
context.player == null ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(fplayer, true),
|
||||
fyou.describeTo(fplayer), targetFaction.describeTo(fplayer));
|
||||
if(FactionsPlugin.instance.getConfig().getBoolean("faction-leader-broadcast")) {
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
fplayer.msg(TL.COMMAND_ADMIN_PROMOTED, context.player == null ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(fplayer, true), fyou.describeTo(fplayer), targetFaction.describeTo(fplayer));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setRole(FPlayer fp, Role r) {
|
||||
FactionsPlugin.getInstance().getServer().getScheduler().runTask(FactionsPlugin.instance, () -> {
|
||||
fp.setRole(r);
|
||||
});
|
||||
FactionsPlugin.getInstance().getServer().getScheduler().runTask(FactionsPlugin.instance, () -> fp.setRole(r));
|
||||
}
|
||||
|
||||
private void promoteNewLeader(Faction f) {
|
||||
FactionsPlugin.getInstance().getServer().getScheduler().runTask(FactionsPlugin.instance, () -> {
|
||||
f.promoteNewLeader();
|
||||
});
|
||||
FactionsPlugin.getInstance().getServer().getScheduler().runTask(FactionsPlugin.instance, (Runnable) f::promoteNewLeader);
|
||||
}
|
||||
|
||||
public TL getUsageTranslation() {
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.massivecraft.factions.event.FactionCreateEvent;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.util.Cooldown;
|
||||
import com.massivecraft.factions.util.MiscUtil;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import net.dv8tion.jda.core.entities.Member;
|
||||
@@ -53,6 +54,11 @@ public class CmdCreate extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if(Cooldown.isOnCooldown(context.fPlayer.getPlayer(), "createCooldown") && !context.fPlayer.isAdminBypassing()){
|
||||
context.msg(TL.COMMAND_COOLDOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
ReserveObject factionReserve = FactionsPlugin.getInstance().getFactionReserves().stream().filter(factionReserve1 -> factionReserve1.getFactionName().equalsIgnoreCase(tag)).findFirst().orElse(null);
|
||||
if (factionReserve != null && !factionReserve.getName().equalsIgnoreCase(context.player.getName())) {
|
||||
context.msg(TL.COMMAND_CREATE_ALREADY_RESERVED);
|
||||
@@ -105,6 +111,7 @@ public class CmdCreate extends FCommand {
|
||||
// That way we don't have to mess up deleting more stuff.
|
||||
// And prevent the user from being returned to NORMAL after deleting his old faction.
|
||||
context.fPlayer.setRole(Role.LEADER);
|
||||
Cooldown.setCooldown(context.fPlayer.getPlayer(), "createCooldown", FactionsPlugin.getInstance().getConfig().getInt("fcooldowns.f-create"));
|
||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("faction-creation-broadcast", true)) {
|
||||
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
follower.msg(TL.COMMAND_CREATE_CREATED, context.fPlayer.getName(), faction.getTag(follower));
|
||||
|
||||
@@ -25,36 +25,17 @@ public class CmdDeinvite extends FCommand {
|
||||
this.optionalArgs.put("player name", "name");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.DEINVITE)
|
||||
.withAction(PermissableAction.INVITE)
|
||||
.memberOnly()
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
if (context.args.size() == 0) {
|
||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
||||
for (String id : context.faction.getInvites()) {
|
||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||
String name = fp != null ? fp.getName() : id;
|
||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||
}
|
||||
context.sendFancyMessage(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
FPlayer you = context.argAsBestFPlayerMatch(0);
|
||||
if (!context.fPlayer.isAdminBypassing()) {
|
||||
Access access = context.faction.getAccess(context.fPlayer, PermissableAction.INVITE);
|
||||
if (access != Access.ALLOW && context.fPlayer.getRole() != Role.LEADER) {
|
||||
context.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (you == null) {
|
||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
||||
for (String id : context.faction.getInvites()) {
|
||||
if (context.faction.getInvites().isEmpty()) return;
|
||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||
String name = fp != null ? fp.getName() : id;
|
||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||
@@ -65,15 +46,16 @@ public class CmdDeinvite extends FCommand {
|
||||
|
||||
if (you.getFaction() == context.faction) {
|
||||
context.msg(TL.COMMAND_DEINVITE_ALREADYMEMBER, you.getName(), context.faction.getTag());
|
||||
context.msg(TL.COMMAND_DEINVITE_MIGHTWANT, FactionsPlugin.getInstance().cmdBase.cmdKick.getUsageTemplate(context));
|
||||
context.msg(TL.COMMAND_DEINVITE_MIGHTWANT, FCmdRoot.instance.cmdKick.getUsageTemplate(context));
|
||||
return;
|
||||
}
|
||||
|
||||
context.faction.deinvite(you);
|
||||
|
||||
you.msg(TL.COMMAND_DEINVITE_REVOKED, context.fPlayer.describeTo(you), context.faction.describeTo(you));
|
||||
|
||||
context.faction.msg(TL.COMMAND_DEINVITE_REVOKES, context.fPlayer.describeTo(context.faction), you.describeTo(context.faction));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_DEINVITE_DESCRIPTION;
|
||||
|
||||
@@ -4,9 +4,10 @@ import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.event.FactionDisbandEvent.PlayerDisbandReason;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.zcore.frame.fdisband.FDisbandFrame;
|
||||
import com.massivecraft.factions.util.Cooldown;
|
||||
import com.massivecraft.factions.zcore.fperms.Access;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.frame.fdisband.FDisbandFrame;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
@@ -69,6 +70,11 @@ public class CmdDisband extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if(Cooldown.isOnCooldown(context.fPlayer.getPlayer(), "disbandCooldown") && !context.fPlayer.isAdminBypassing()){
|
||||
context.msg(TL.COMMAND_COOLDOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
boolean access = false;
|
||||
if (context.fPlayer.getPlayer().hasMetadata("disband_confirm") && (time = context.fPlayer.getPlayer().getMetadata("disband_confirm").get(0).asLong()) != 0L && System.currentTimeMillis() - time <= TimeUnit.SECONDS.toMillis(3L)) {
|
||||
@@ -76,7 +82,7 @@ public class CmdDisband extends FCommand {
|
||||
}
|
||||
|
||||
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())) {
|
||||
new FDisbandFrame(context.faction).buildGUI(context.fPlayer);
|
||||
return;
|
||||
@@ -84,7 +90,6 @@ public class CmdDisband extends FCommand {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// check for tnt before disbanding.
|
||||
if (!disbandMap.containsKey(context.player.getUniqueId().toString()) && faction.getTnt() > 0) {
|
||||
context.msg(TL.COMMAND_DISBAND_CONFIRM.toString().replace("{tnt}", faction.getTnt() + ""));
|
||||
@@ -96,25 +101,15 @@ public class CmdDisband extends FCommand {
|
||||
String amountString = context.sender instanceof ConsoleCommandSender ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(follower);
|
||||
if (follower.getFaction() == faction) {
|
||||
follower.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, amountString);
|
||||
if (!follower.canFlyAtLocation() && FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) {
|
||||
follower.setFFlying(false, false);
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
context.player.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
|
||||
}
|
||||
faction.disband(context.player, PlayerDisbandReason.COMMAND);
|
||||
if (!context.fPlayer.canFlyAtLocation() && FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) {
|
||||
context.fPlayer.setFFlying(false, false);
|
||||
}
|
||||
Cooldown.setCooldown(context.fPlayer.getPlayer(), "disbandCooldown", FactionsPlugin.getInstance().getConfig().getInt("fcooldowns.f-disband"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,8 @@ public class CmdFly extends FCommand {
|
||||
|
||||
public static ConcurrentHashMap<String, Boolean> flyMap = new ConcurrentHashMap<>();
|
||||
public static BukkitTask particleTask = null;
|
||||
public static BukkitTask flyTask = null;
|
||||
|
||||
public static final boolean fly = FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight");
|
||||
|
||||
|
||||
public CmdFly() {
|
||||
@@ -41,15 +42,12 @@ public class CmdFly extends FCommand {
|
||||
}
|
||||
|
||||
public static void startParticles() {
|
||||
|
||||
particleTask = Bukkit.getScheduler().runTaskTimerAsynchronously(FactionsPlugin.instance, () -> {
|
||||
for (String name : flyMap.keySet()) {
|
||||
Player player = Bukkit.getPlayer(name);
|
||||
if (player == null) continue;
|
||||
if (!player.isFlying()) continue;
|
||||
if (!FactionsPlugin.getInstance().mc17) {
|
||||
if (player.getGameMode() == GameMode.SPECTATOR) continue;
|
||||
}
|
||||
if (!FactionsPlugin.getInstance().mc17 && player.getGameMode() == GameMode.SPECTATOR) continue;
|
||||
|
||||
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
|
||||
fplayer.isVanished();
|
||||
@@ -61,75 +59,44 @@ public class CmdFly extends FCommand {
|
||||
}, 10L, 3L);
|
||||
}
|
||||
|
||||
public static void startFlyCheck() {
|
||||
flyTask = Bukkit.getScheduler().runTaskTimerAsynchronously(FactionsPlugin.instance, () -> {
|
||||
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);
|
||||
Faction myFaction = fPlayer.getFaction();
|
||||
if (!player.hasPermission("factions.fly.bypassnearbyenemycheck") && !fPlayer.isAdminBypassing()) {
|
||||
if (fPlayer.hasEnemiesNearby()) disableFlightSync(fPlayer);
|
||||
checkEnemiesSync(fPlayer);
|
||||
continue;
|
||||
}
|
||||
FLocation myFloc = new FLocation(player.getLocation());
|
||||
if (Board.getInstance().getFactionAt(myFloc) != myFaction) {
|
||||
if (!checkFly(fPlayer, player, Board.getInstance().getFactionAt(myFloc))) {
|
||||
disableFlightSync(fPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}, 20L, 20L);
|
||||
}
|
||||
|
||||
public static boolean checkFly(FPlayer fme, Player me, Faction toFac) {
|
||||
public static boolean checkBypassPerms(FPlayer fme, Player me, Faction toFac, boolean sendMessage) {
|
||||
if (Conf.denyFlightIfInNoClaimingWorld && !Conf.worldsNoClaiming.isEmpty() && Conf.worldsNoClaiming.stream().anyMatch(me.getWorld().getName()::equalsIgnoreCase))
|
||||
return false;
|
||||
if (toFac.getAccess(fme, PermissableAction.FLY) == Access.ALLOW) return true;
|
||||
if (fme.getFaction().isWilderness()) return false;
|
||||
if (toFac.isSystemFaction())
|
||||
return me.hasPermission(toFac.isWilderness() ? Permission.FLY_WILDERNESS.node : toFac.isSafeZone() ? Permission.FLY_SAFEZONE.node : Permission.FLY_WARZONE.node);
|
||||
Relation relationTo = toFac.getRelationTo(fme.getFaction());
|
||||
if (!relationTo.isEnemy() && !relationTo.isMember())
|
||||
return me.hasPermission(Permission.valueOf("FLY_" + relationTo.name()).node);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (toFac != fme.getFaction()) {
|
||||
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()) {
|
||||
if(sendMessage) fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||
return false;
|
||||
}
|
||||
Access access = toFac.getAccess(fme, PermissableAction.FLY);
|
||||
if ((!(me.hasPermission(Permission.FLY_ENEMY.node) || access == Access.ALLOW)) && toFac.getRelationTo(fme.getFaction()) == Relation.ENEMY) {
|
||||
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;
|
||||
}
|
||||
|
||||
public static void checkTaskState() {
|
||||
if (flyMap.isEmpty()) {
|
||||
flyTask.cancel();
|
||||
flyTask = null;
|
||||
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 disableFlight(final FPlayer fme) {
|
||||
fme.setFlying(false);
|
||||
flyMap.remove(fme.getPlayer().getName());
|
||||
}
|
||||
|
||||
private static void disableFlightSync(FPlayer fme) {
|
||||
Bukkit.getScheduler().runTask(FactionsPlugin.instance, () -> fme.setFFlying(false, false));
|
||||
flyMap.remove(fme.getName());
|
||||
}
|
||||
|
||||
private static void checkEnemiesSync(FPlayer fp) {
|
||||
Bukkit.getScheduler().runTask(FactionsPlugin.instance, fp::checkIfNearbyEnemies);
|
||||
}
|
||||
|
||||
public boolean isInFlightChecker(Player player) {
|
||||
return flyMap.containsKey(player.getName());
|
||||
@@ -154,7 +121,7 @@ public class CmdFly extends FCommand {
|
||||
|
||||
FLocation myfloc = new FLocation(context.player.getLocation());
|
||||
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()));
|
||||
return;
|
||||
}
|
||||
@@ -174,17 +141,15 @@ public class CmdFly extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
context.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", () -> {
|
||||
fme.setFlying(true);
|
||||
flyMap.put(fme.getPlayer().getName(), true);
|
||||
if (particleTask == null) {
|
||||
startParticles();
|
||||
}
|
||||
|
||||
if (flyTask == null) {
|
||||
startFlyCheck();
|
||||
}
|
||||
}, FactionsPlugin.getInstance().getConfig().getLong("warmups.f-fly", 0));
|
||||
if (fme.canFlyAtLocation()) {
|
||||
context.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", () -> {
|
||||
fme.setFlying(true);
|
||||
flyMap.put(fme.getPlayer().getName(), true);
|
||||
if (particleTask == null) startParticles();
|
||||
}, FactionsPlugin.getInstance().getConfig().getLong("warmups.f-fly", 0));
|
||||
} else {
|
||||
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(fme.getLastStoodAt()).getTag());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
/**
|
||||
* Factions - Developed by Driftay.
|
||||
* All rights reserved 2020.
|
||||
* Creation Date: 4/6/2020
|
||||
*/
|
||||
public class CmdFriendlyFire extends FCommand {
|
||||
|
||||
public CmdFriendlyFire(){
|
||||
super();
|
||||
this.aliases.addAll(Aliases.friendlyFire);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.FRIENDLYFIRE)
|
||||
.playerOnly()
|
||||
.memberOnly()
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
if(!Conf.friendlyFireFPlayersCommand){
|
||||
context.msg(TL.GENERIC_DISABLED, "friendly fire");
|
||||
return;
|
||||
}
|
||||
|
||||
if(context.fPlayer.hasFriendlyFire()){
|
||||
context.fPlayer.setFriendlyFire(false);
|
||||
context.msg(TL.COMMAND_FRIENDLY_FIRE_TOGGLE_OFF);
|
||||
} else {
|
||||
context.fPlayer.setFriendlyFire(true);
|
||||
context.msg(TL.COMMAND_FRIENDLY_FIRE_TOGGLE_ON);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_FRIENDLY_FIRE_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.util.ItemBuilder;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class CmdGetVault extends FCommand {
|
||||
@@ -30,9 +30,13 @@ public class CmdGetVault extends FCommand {
|
||||
context.fPlayer.msg(TL.GENERIC_DISABLED, "Faction Vaults");
|
||||
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
|
||||
if (vaultLocation != null) {
|
||||
@@ -40,36 +44,19 @@ public class CmdGetVault extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//has enough money?
|
||||
int amount = FactionsPlugin.getInstance().getConfig().getInt("fvault.Price");
|
||||
if (!context.fPlayer.hasMoney(amount)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!context.fPlayer.takeMoney(amount)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//success :)
|
||||
context.fPlayer.takeMoney(amount);
|
||||
context.player.getInventory().addItem(vault);
|
||||
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
|
||||
public TL getUsageTranslation() {
|
||||
|
||||
@@ -60,14 +60,11 @@ public class CmdInvite extends FCommand {
|
||||
// Send the invitation to the target player when online, otherwise just ignore
|
||||
if (target.isOnline()) {
|
||||
// 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())
|
||||
.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());
|
||||
message.send(target.getPlayer());
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class CmdJoin extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Conf.factionMemberLimit > 0 && faction.getFPlayers().size() >= getFactionMemberLimit(faction)) {
|
||||
if (!faction.altInvited(fplayer) && Conf.factionMemberLimit > 0 && faction.getFPlayers().size() >= getFactionMemberLimit(faction)) {
|
||||
context.msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(context.fPlayer), getFactionMemberLimit(faction), fplayer.describeTo(context.fPlayer, false));
|
||||
return;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class CmdJoin extends FCommand {
|
||||
|
||||
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));
|
||||
return;
|
||||
}
|
||||
@@ -115,8 +115,6 @@ public class CmdJoin extends FCommand {
|
||||
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();
|
||||
|
||||
if (faction.altInvited(fplayer)) {
|
||||
@@ -144,6 +142,8 @@ public class CmdJoin extends FCommand {
|
||||
System.out.print(e.getMessage());
|
||||
}
|
||||
|
||||
faction.msg(TL.COMMAND_JOIN_JOINED, fplayer.describeTo(faction, true));
|
||||
|
||||
if (Conf.logFactionJoin) {
|
||||
if (samePlayer) {
|
||||
FactionsPlugin.getInstance().log(TL.COMMAND_JOIN_JOINEDLOG.toString(), fplayer.getName(), faction.getTag());
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.util.Cooldown;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdOpen extends FCommand {
|
||||
@@ -38,12 +39,19 @@ public class CmdOpen extends FCommand {
|
||||
|
||||
String open = context.faction.getOpen() ? TL.COMMAND_OPEN_OPEN.toString() : TL.COMMAND_OPEN_CLOSED.toString();
|
||||
|
||||
if(Cooldown.isOnCooldown(context.fPlayer.getPlayer(), "openCooldown") && !context.fPlayer.isAdminBypassing()){
|
||||
context.msg(TL.COMMAND_COOLDOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
// Inform
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
if (fplayer.getFactionId().equals(context.faction.getId())) {
|
||||
fplayer.msg(TL.COMMAND_OPEN_CHANGES, context.fPlayer.getName(), open);
|
||||
Cooldown.setCooldown(fplayer.getPlayer(), "openCooldown", FactionsPlugin.getInstance().getConfig().getInt("fcooldowns.f-open"));
|
||||
continue;
|
||||
}
|
||||
if(FactionsPlugin.getInstance().getConfig().getBoolean("faction-open-broadcast")) return;
|
||||
fplayer.msg(TL.COMMAND_OPEN_CHANGED, context.faction.getTag(fplayer.getFaction()), open);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -30,10 +30,6 @@ public class CmdReload extends FCommand {
|
||||
FactionsPlugin.getInstance().loadLang();
|
||||
|
||||
|
||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight", false)) {
|
||||
FactionsPlugin.getInstance().factionsFlight = true;
|
||||
}
|
||||
|
||||
if (!FactionsPlugin.getInstance().mc17) {
|
||||
FactionsPlayerListener.loadCorners();
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ public class CmdSaveAll extends FCommand {
|
||||
Factions.getInstance().forceSave(false);
|
||||
Board.getInstance().forceSave(false);
|
||||
Conf.save();
|
||||
FactionsPlugin.getInstance().getTimerManager().saveTimerData();
|
||||
try {
|
||||
FactionsPlugin.instance.getFlogManager().saveLogs();
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -24,17 +24,21 @@ public class CmdShow extends FCommand {
|
||||
this.aliases.addAll(Aliases.show_show);
|
||||
|
||||
// add defaults to /f show in case config doesnt have it
|
||||
defaults.add("{header}");
|
||||
defaults.add("<a>Description: <i>{description}");
|
||||
defaults.add("<a>Joining: <i>{joining} {peaceful}");
|
||||
defaults.add("<a>Land / Power / Maxpower: <i> {chunks} / {power} / {maxPower}");
|
||||
defaults.add("<a>Founded: <i>{create-date}");
|
||||
defaults.add("<a>This faction is permanent, remaining even with no members.");
|
||||
defaults.add("<a>Land value: <i>{land-value} {land-refund}");
|
||||
defaults.add("<a>Balance: <i>{faction-balance}");
|
||||
defaults.add("<a>Allies(<i>{allies}<a>/<i>{max-allies}<a>): {allies-list}");
|
||||
defaults.add("<a>Online: (<i>{online}<a>/<i>{members}<a>): {online-list}");
|
||||
defaults.add("<a>Offline: (<i>{offline}<a>/<i>{members}<a>): {offline-list}");
|
||||
defaults.add("&8&m--------------&7 &8<&e{faction}&8> &8&m--------------");
|
||||
defaults.add("&4* &cOwner: &f{leader}");
|
||||
defaults.add("&4* &cDescription: &f{description}");
|
||||
defaults.add("&4* &cLand / Power / Max Power: &f{chunks} &8/ &f{power} &8/ &f{maxPower}");
|
||||
defaults.add("&4* &cFaction Strikes: &f{strikes}");
|
||||
defaults.add("&4* &cFaction Points: &f{faction-points}");
|
||||
defaults.add("&4* &cFounded: &f{create-date}");
|
||||
defaults.add("&4* &cBalance: &f{faction-balance}");
|
||||
defaults.add("&4* &cAllies: &a{allies-list}");
|
||||
defaults.add("&4* &cEnemies: &4{enemies-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.optionalArgs.put("faction tag", "yours");
|
||||
@@ -45,6 +49,7 @@ public class CmdShow extends FCommand {
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
Faction faction = context.faction;
|
||||
FactionsPlugin instance = FactionsPlugin.getInstance();
|
||||
if (context.argIsSet(0))
|
||||
faction = context.argAsFaction(0);
|
||||
|
||||
@@ -52,7 +57,7 @@ public class CmdShow extends FCommand {
|
||||
return;
|
||||
|
||||
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);
|
||||
return;
|
||||
}
|
||||
@@ -62,7 +67,7 @@ public class CmdShow extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> show = FactionsPlugin.getInstance().getConfig().getStringList("show");
|
||||
List<String> show = instance.getConfig().getStringList("show");
|
||||
if (show == null || show.isEmpty())
|
||||
show = defaults;
|
||||
|
||||
@@ -71,13 +76,14 @@ public class CmdShow extends FCommand {
|
||||
// send header and that's all
|
||||
String header = show.get(0);
|
||||
if (TagReplacer.HEADER.contains(header)) {
|
||||
context.msg(FactionsPlugin.getInstance().txt.titleize(tag));
|
||||
context.msg(instance.txt.titleize(tag));
|
||||
} 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
|
||||
}
|
||||
|
||||
List<FancyMessage> fancy = new ArrayList<>();
|
||||
for (String raw : show) {
|
||||
String parsed = TagUtil.parsePlain(faction, context.fPlayer, raw); // use relations
|
||||
if (parsed == null) {
|
||||
@@ -89,9 +95,9 @@ public class CmdShow extends FCommand {
|
||||
}
|
||||
|
||||
if (TagUtil.hasFancy(parsed)) {
|
||||
List<FancyMessage> fancy = TagUtil.parseFancy(faction, context.fPlayer, parsed);
|
||||
if (fancy != null)
|
||||
context.sendFancyMessage(fancy);
|
||||
List<FancyMessage> localFancy = TagUtil.parseFancy(faction, context.fPlayer, parsed);
|
||||
if (localFancy != null)
|
||||
fancy.addAll(localFancy);
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -103,9 +109,12 @@ public class CmdShow extends FCommand {
|
||||
if (parsed.contains("%")) {
|
||||
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
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.ListMultimap;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdShowClaims extends FCommand {
|
||||
@@ -16,6 +17,7 @@ public class CmdShowClaims extends FCommand {
|
||||
this.aliases.addAll(Aliases.show_claims);
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.SHOWCLAIMS)
|
||||
.withAction(PermissableAction.TERRITORY)
|
||||
.playerOnly()
|
||||
.memberOnly()
|
||||
.build();
|
||||
|
||||
@@ -33,6 +33,7 @@ public class CmdShowInvites extends FCommand {
|
||||
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);
|
||||
}
|
||||
context.sendFancyMessage(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,7 @@ public class CmdStealth extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
if (!Conf.useSealthSystem) {
|
||||
if (!Conf.useStealthSystem) {
|
||||
context.msg(TL.GENERIC_DISABLED, "Factions Stealth");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.massivecraft.factions.event.FactionRenameEvent;
|
||||
import com.massivecraft.factions.scoreboards.FTeamWrapper;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.util.Cooldown;
|
||||
import com.massivecraft.factions.util.MiscUtil;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -53,6 +54,11 @@ public class CmdTag extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if(Cooldown.isOnCooldown(context.player, "tagCooldown") && !context.fPlayer.isAdminBypassing()){
|
||||
context.msg(TL.COMMAND_COOLDOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
// trigger the faction rename event (cancellable)
|
||||
FactionRenameEvent renameEvent = new FactionRenameEvent(context.fPlayer, tag);
|
||||
Bukkit.getServer().getPluginManager().callEvent(renameEvent);
|
||||
@@ -65,8 +71,11 @@ public class CmdTag extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
String oldtag = context.faction.getTag();
|
||||
context.faction.setTag(tag);
|
||||
|
||||
Discord.changeFactionTag(context.faction, oldtag);
|
||||
FactionsPlugin.instance.logFactionEvent(context.faction, FLogType.FTAG_EDIT, context.fPlayer.getName(), tag);
|
||||
|
||||
@@ -75,6 +84,7 @@ public class CmdTag extends FCommand {
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
if (fplayer.getFactionId().equals(context.faction.getId())) {
|
||||
fplayer.msg(TL.COMMAND_TAG_FACTION, context.fPlayer.describeTo(context.faction, true), context.faction.getTag(context.faction));
|
||||
Cooldown.setCooldown(fplayer.getPlayer(), "tagCooldown", FactionsPlugin.getInstance().getConfig().getInt("fcooldowns.f-tag"));
|
||||
continue;
|
||||
}
|
||||
// Broadcast the tag change (if applicable)
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.fperms.Access;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class CmdUnban extends FCommand {
|
||||
|
||||
@@ -48,7 +49,7 @@ public class CmdUnban extends FCommand {
|
||||
context.faction.unban(target);
|
||||
|
||||
context.msg(TL.COMMAND_UNBAN_UNBANNED, context.fPlayer.getName(), target.getName());
|
||||
target.msg(TL.COMMAND_UNBAN_TARGET, context.faction.getTag(target));
|
||||
target.msg(TL.COMMAND_UNBAN_TARGETUNBANNED, context.faction.getTag(target));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.massivecraft.factions.cmd.check.CmdCheck;
|
||||
import com.massivecraft.factions.cmd.check.CmdWeeWoo;
|
||||
import com.massivecraft.factions.cmd.chest.CmdChest;
|
||||
import com.massivecraft.factions.cmd.claim.*;
|
||||
import com.massivecraft.factions.cmd.configsf.CmdConvertConfig;
|
||||
import com.massivecraft.factions.cmd.econ.CmdMoney;
|
||||
import com.massivecraft.factions.cmd.grace.CmdGrace;
|
||||
import com.massivecraft.factions.cmd.logout.CmdLogout;
|
||||
@@ -156,7 +155,6 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
|
||||
public CmdCheck cmdCheck = new CmdCheck();
|
||||
public CmdWeeWoo cmdWeeWoo = new CmdWeeWoo();
|
||||
public CmdWild cmdWild = new CmdWild();
|
||||
public CmdConvertConfig cmdConvertConfig = new CmdConvertConfig();
|
||||
public CmdSpawnerLock cmdSpawnerLock = new CmdSpawnerLock();
|
||||
public CmdSetDiscord cmdSetDiscord = new CmdSetDiscord();
|
||||
public CmdSeeDiscord cmdSeeDiscord = new CmdSeeDiscord();
|
||||
@@ -171,6 +169,7 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
|
||||
public CmdDelHome cmdDelHome = new CmdDelHome();
|
||||
public CmdClaimFill cmdClaimFill = new CmdClaimFill();
|
||||
public CmdNotifications cmdNotifications = new CmdNotifications();
|
||||
public CmdFriendlyFire cmdFriendlyFire = new CmdFriendlyFire();
|
||||
|
||||
//Variables to know if we already setup certain sub commands
|
||||
public Boolean discordEnabled = false;
|
||||
@@ -301,11 +300,11 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
|
||||
this.addSubCommand(this.cmdCorner);
|
||||
this.addSubCommand(this.cmdFGlobal);
|
||||
this.addSubCommand(this.cmdViewChest);
|
||||
this.addSubCommand(this.cmdConvertConfig);
|
||||
this.addSubCommand(this.cmdSpawnerLock);
|
||||
this.addSubCommand(this.cmdDrain);
|
||||
this.addSubCommand(this.cmdLookup);
|
||||
this.addSubCommand(this.cmdNotifications);
|
||||
this.addSubCommand(this.cmdFriendlyFire);
|
||||
addVariableCommands();
|
||||
if (CommodoreProvider.isSupported()) brigadierManager.build();
|
||||
}
|
||||
@@ -400,7 +399,7 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
|
||||
addSubCommand(this.cmdFocus);
|
||||
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);
|
||||
fFlyEnabled = true;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ import com.google.common.collect.Lists;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.zcore.frame.FactionGUI;
|
||||
import com.massivecraft.factions.util.XMaterial;
|
||||
import com.massivecraft.factions.zcore.frame.FactionGUI;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.massivecraft.factions.cmd.check;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.zcore.frame.FactionGUI;
|
||||
import com.massivecraft.factions.util.XMaterial;
|
||||
import com.massivecraft.factions.zcore.frame.FactionGUI;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
@@ -27,9 +27,10 @@ public class AntiChestListener implements Listener {
|
||||
if (e.isCancelled()) return;
|
||||
|
||||
Inventory clicked = e.getClickedInventory();
|
||||
Inventory clicker = e.getWhoClicked().getInventory();
|
||||
|
||||
if (e.getClick().isShiftClick()) {
|
||||
if (clicked == e.getWhoClicked().getInventory()) {
|
||||
if (clicked == clicker) {
|
||||
ItemStack clickedOn = e.getCurrentItem();
|
||||
if (clickedOn != null && FactionsPlugin.getInstance().itemList.contains(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();
|
||||
if (onCursor != null && FactionsPlugin.getInstance().itemList.contains(onCursor.getType().toString())) {
|
||||
fPlayer.msg(TL.CHEST_ITEM_DENIED_TRANSFER, onCursor.getType().toString());
|
||||
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;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
@@ -62,11 +63,15 @@ public class CmdAutoClaim extends FCommand {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Faction at = Board.getInstance().getFactionAt(new FLocation(context.fPlayer.getPlayer().getLocation()));
|
||||
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(","));
|
||||
context.msg(TL.COMMAND_AUTOCLAIM_ENABLED, forFaction.describeTo(context.fPlayer));
|
||||
context.fPlayer.attemptClaim(forFaction, context.fPlayer.getPlayer().getLocation(), true);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.massivecraft.factions.cmd.claim;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.cmd.Aliases;
|
||||
import com.massivecraft.factions.cmd.CommandContext;
|
||||
import com.massivecraft.factions.cmd.CommandRequirements;
|
||||
@@ -59,8 +56,14 @@ public class CmdClaim extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
Faction at = Board.getInstance().getFactionAt(new FLocation(context.fPlayer.getPlayer().getLocation()));
|
||||
|
||||
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);
|
||||
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", (new FLocation(context.fPlayer.getPlayer().getLocation())).formatXAndZ(","));
|
||||
} else {
|
||||
@@ -68,24 +71,33 @@ public class CmdClaim extends FCommand {
|
||||
if (!Permission.CLAIM_RADIUS.has(context.sender, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
new SpiralTask(new FLocation(context.player), radius) {
|
||||
private final int limit = Conf.radiusClaimFailureLimit - 1;
|
||||
private int failCount = 0;
|
||||
private int successfulClaims = 0;
|
||||
|
||||
@Override
|
||||
public boolean work() {
|
||||
boolean success = context.fPlayer.attemptClaim(forFaction, this.currentLocation(), true);
|
||||
if (success) {
|
||||
failCount = 0;
|
||||
successfulClaims++;
|
||||
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) {
|
||||
this.stop();
|
||||
return false;
|
||||
}
|
||||
|
||||
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.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.cmd.Aliases;
|
||||
import com.massivecraft.factions.cmd.CommandContext;
|
||||
@@ -39,6 +40,15 @@ public class CmdClaimAt extends FCommand {
|
||||
int x = context.argAsInt(1);
|
||||
int z = context.argAsInt(2);
|
||||
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);
|
||||
FactionsPlugin.instance.logFactionEvent(context.fPlayer.getFaction(), FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", (location).formatXAndZ(","));
|
||||
showMap(context);
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.massivecraft.factions.cmd.claim;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.cmd.Aliases;
|
||||
import com.massivecraft.factions.cmd.CommandContext;
|
||||
import com.massivecraft.factions.cmd.CommandRequirements;
|
||||
@@ -71,6 +68,7 @@ public class CmdClaimLine extends FCommand {
|
||||
}
|
||||
|
||||
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 (!context.fPlayer.isAdminBypassing()) {
|
||||
@@ -84,11 +82,20 @@ public class CmdClaimLine extends FCommand {
|
||||
Location location = context.player.getLocation();
|
||||
|
||||
// TODO: make this a task like claiming a radius?
|
||||
int claims = 0;
|
||||
|
||||
for (int i = 0; i < amount; i++) {
|
||||
context.fPlayer.attemptClaim(forFaction, location, true);
|
||||
if (FactionsPlugin.cachedRadiusClaim && context.fPlayer.attemptClaim(forFaction, context.player.getLocation(), false)) {
|
||||
claims++;
|
||||
} else {
|
||||
context.fPlayer.attemptClaim(forFaction, location, true);
|
||||
claims++;
|
||||
}
|
||||
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(","));
|
||||
}
|
||||
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
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.massivecraft.factions.cmd.configsf;
|
||||
|
||||
import com.massivecraft.factions.cmd.CommandContext;
|
||||
import com.massivecraft.factions.cmd.CommandRequirements;
|
||||
import com.massivecraft.factions.cmd.FCommand;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdConvertConfig extends FCommand {
|
||||
|
||||
public CmdConvertConfig() {
|
||||
super();
|
||||
this.aliases.add("convertconfig");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.CONVERTCONFIG)
|
||||
.playerOnly()
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
ConvertConfigHandler.convertconfig(context.player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_CONVERTCONFIG_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
@@ -1,147 +0,0 @@
|
||||
package com.massivecraft.factions.cmd.configsf;
|
||||
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class ConvertConfigHandler {
|
||||
|
||||
static File savageConfigFile = new File("plugins/Factions/SavageFactions/config.yml");
|
||||
static FileConfiguration sv = YamlConfiguration.loadConfiguration(savageConfigFile);
|
||||
static File configFile = new File("plugins/Factions/config.yml");
|
||||
static FileConfiguration sb = YamlConfiguration.loadConfiguration(configFile);
|
||||
static JavaPlugin plugin = JavaPlugin.getProvidingPlugin(FactionsPlugin.class);
|
||||
|
||||
public static void setString(String s) {
|
||||
sb.set(s, sv.getString(s));
|
||||
}
|
||||
|
||||
public static void setInt(String s) {
|
||||
sb.set(s, sv.getInt(s));
|
||||
}
|
||||
|
||||
public static void setConfigSec(String s) {
|
||||
ConfigurationSection cs = sv.getConfigurationSection(s);
|
||||
sb.set(s, cs);
|
||||
}
|
||||
|
||||
public static void setBoolean(String s) {
|
||||
sb.set(s, sv.getBoolean(s));
|
||||
}
|
||||
|
||||
public static void convertconfig(Player player) {
|
||||
if (new File("plugins/Factions/SavageFactions/config.yml").exists()) {
|
||||
BukkitScheduler scheduler = plugin.getServer().getScheduler();
|
||||
scheduler.scheduleAsyncDelayedTask(plugin, () -> {
|
||||
File savageConfigFile = new File("plugins/Factions/SavageFactions/config.yml");
|
||||
FileConfiguration sv = YamlConfiguration.loadConfiguration(savageConfigFile);
|
||||
File configFile = new File("plugins/Factions/config.yml");
|
||||
FileConfiguration sb = YamlConfiguration.loadConfiguration(configFile);
|
||||
sb.set("ConfigConvertedFromSavageFactions", true);
|
||||
sb.set("debug", sv.getBoolean("debug"));
|
||||
ConfigurationSection ffe = sv.getConfigurationSection("findfactionsexploit");
|
||||
sb.set("findfactionsexploit", ffe);
|
||||
setString("default-relation");
|
||||
ConfigurationSection pC = sv.getConfigurationSection("portals");
|
||||
sb.set("portals", pC);
|
||||
sb.set("maxwarps", sv.getInt("maxwarps"));
|
||||
setConfigSec("warp-cost");
|
||||
setBoolean("enable-faction-flight");
|
||||
setBoolean("ffly.AutoEnable");
|
||||
setInt("fly-falldamage-cooldown");
|
||||
setBoolean("disable-pistons-in-territory");
|
||||
setConfigSec("tooltips");
|
||||
setConfigSec("scoreboard");
|
||||
sb.set("scoreboard.also-send-chat", true);
|
||||
setConfigSec("warmups");
|
||||
setConfigSec("max-relations");
|
||||
setInt("world-border.buffer");
|
||||
setConfigSec("hcf");
|
||||
sb.set("show", sv.getStringList("show"));
|
||||
setBoolean("show-exempt");
|
||||
sb.set("map", sv.getStringList("map"));
|
||||
setConfigSec("list");
|
||||
setBoolean("use-old-help");
|
||||
setConfigSec("help");
|
||||
setConfigSec("fperm-gui");
|
||||
sb.set("fperm-gui.action.slots.check", 50);
|
||||
setConfigSec("fwarp-gui");
|
||||
setBoolean("faction-creation-broadcast");
|
||||
setBoolean("faction-disband-broadcast");
|
||||
setBoolean("See-Invisible-Faction-Members");
|
||||
setConfigSec("frules");
|
||||
setConfigSec("ftnt");
|
||||
setBoolean("fpaypal.Enabled");
|
||||
setBoolean("checkpoints.Enabled");
|
||||
setConfigSec("fnear");
|
||||
setConfigSec("ffocus");
|
||||
setConfigSec("fvualt");
|
||||
setString("fupgrades.MainMenu.Title");
|
||||
setString("fupgrades.MainMenu.DummyItem.Name");
|
||||
setString("fupgrades.MainMenu.DummyItem.Type");
|
||||
List<String> l = sv.getStringList("fupgrades.MainMenu.DummyItem.Lore");
|
||||
sb.set("fupgrades.MainMenu.DummyItem.Lore", l);
|
||||
setConfigSec("fupgrades.MainMenu.Crops.Crop-Boost");
|
||||
setConfigSec("fupgrades.MainMenu.Crops.Cost");
|
||||
sb.set("fupgrades.MainMenu.Crops.CropItem", sv.getConfigurationSection("fupgrades.MainMenu.Crops.DisplayItem"));
|
||||
setConfigSec("fupgrades.MainMenu.EXP.EXP-Boost");
|
||||
setConfigSec("fupgrades.MainMenu.EXP.Cost");
|
||||
sb.set("fupgrades.MainMenu.EXP.EXPItem", sv.getConfigurationSection("fupgrades.MainMenu.EXP.DisplayItem"));
|
||||
setConfigSec("fupgrades.MainMenu.Power.Power-Boost");
|
||||
setConfigSec("fupgrades.MainMenu.Power.Cost");
|
||||
sb.set("fupgrades.MainMenu.Power.PowerItem", sv.getConfigurationSection("fupgrades.MainMenu.Power.DisplayItem"));
|
||||
List<Integer> p = new ArrayList();
|
||||
p.add(sv.getInt("fupgrades.MainMenu.Power.DisplayItem.Slot"));
|
||||
sb.set("fupgrades.MainMenu.Power.PowerItem.slots", p);
|
||||
sb.set("fupgrades.MainMenu.Power.PowerItem.Amount", 1);
|
||||
sb.set("fupgrades.MainMenu.Power.PowerItem.Damage", 0);
|
||||
sb.set("fupgrades.MainMenu.Power.PowerItem.Slot", null);
|
||||
sb.set("fupgrades.MainMenu.Members.Members-Limit", sv.getConfigurationSection("fupgrades.MainMenu.Members.Members-Boost"));
|
||||
setConfigSec("fupgrades.MainMenu.Spawners.Spawner-Boost");
|
||||
setConfigSec("fupgrades.MainMenu.Spawners.Cost");
|
||||
sb.set("fupgrades.MainMenu.Spawners.SpawnerItem", sv.getConfigurationSection("fupgrades.MainMenu.Spawners.DisplayItem"));
|
||||
setConfigSec("fupgrades.MainMenu.Chest.Chest-Size");
|
||||
setConfigSec("fupgrades.MainMenu.Chest.Cost");
|
||||
sb.set("fupgrades.MainMenu.Chest.ChestItem", sv.getConfigurationSection("fupgrades.MainMenu.Chest.DisplayItem"));
|
||||
setConfigSec("fupgrades.MainMenu.Members.Cost");
|
||||
sb.set("fupgrades.MainMenu.Members.MembersItem", sv.getConfigurationSection("fupgrades.MainMenu.Members.DisplayItem"));
|
||||
sb.set("fupgrades.MainMenu.Members.MembersItem.Amount", 1);
|
||||
sb.set("fupgrades.MainMenu.Members.MembersItem.Damage", 0);
|
||||
if (sv.getString("fupgrades.MainMenu.Members.DisplayItem.Type").equalsIgnoreCase("PLAYER_HEAD"))
|
||||
sb.set("fupgrades.MainMenu.Members.MembersItem.Type", "PAPER");
|
||||
List<Integer> x = new ArrayList();
|
||||
x.add(sv.getInt("fupgrades.MainMenu.Members.DisplayItem.Slot"));
|
||||
sb.set("fupgrades.MainMenu.Members.MembersItem.slots", x);
|
||||
sb.set("fupgrades.MainMenu.Members.MembersItem.Slot", null);
|
||||
sb.set("fupgrades.MainMenu.Members.Members-Limit", sv.getConfigurationSection("fupgrades.MainMenu.Members.Members-Boost"));
|
||||
setConfigSec("fbanners");
|
||||
setConfigSec("see-chunk");
|
||||
setConfigSec("Tntfill");
|
||||
try {
|
||||
sb.save(configFile);
|
||||
plugin.reloadConfig();
|
||||
} catch (IOException e) {
|
||||
player.sendMessage(TL.COMMAND_CONVERTCONFIG_FAIL.toString());
|
||||
Bukkit.getLogger().log(Level.SEVERE, Arrays.toString(e.getStackTrace()));
|
||||
}
|
||||
player.sendMessage(TL.COMMAND_CONVERTCONFIG_SUCCESS.toString());
|
||||
}, 0L);
|
||||
} else {
|
||||
player.sendMessage(TL.COMMAND_CONVERTCONFIG_FAILCONFIGMISSING.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public class CmdMoneyDeposit extends FCommand {
|
||||
double amount = context.argAsDouble(0, 0d);
|
||||
EconomyParticipator faction = context.argAsFaction(1, context.faction);
|
||||
|
||||
if(amount <= 0){
|
||||
if (amount <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public class CmdMoneyTransferFf extends FCommand {
|
||||
public void perform(CommandContext context) {
|
||||
double amount = context.argAsDouble(0, 0d);
|
||||
|
||||
if(amount <= 0){
|
||||
if (amount <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class CmdMoneyTransferFp extends FCommand {
|
||||
public void perform(CommandContext context) {
|
||||
double amount = context.argAsDouble(0, 0d);
|
||||
|
||||
if(amount <= 0){
|
||||
if (amount <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class CmdMoneyTransferPf extends FCommand {
|
||||
public void perform(CommandContext context) {
|
||||
double amount = context.argAsDouble(0, 0d);
|
||||
|
||||
if(amount <= 0){
|
||||
if (amount <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class CmdMoneyWithdraw extends FCommand {
|
||||
public void perform(CommandContext context) {
|
||||
double amount = context.argAsDouble(0, 0d);
|
||||
|
||||
if(amount <= 0){
|
||||
if (amount <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,35 +1,73 @@
|
||||
package com.massivecraft.factions.cmd.grace;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.cmd.Aliases;
|
||||
import com.massivecraft.factions.cmd.CommandContext;
|
||||
import com.massivecraft.factions.cmd.CommandRequirements;
|
||||
import com.massivecraft.factions.cmd.FCommand;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.util.timer.TimerManager;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class CmdGrace extends FCommand {
|
||||
|
||||
/**
|
||||
* @author Driftay
|
||||
*/
|
||||
|
||||
//TODO: Make Timed Format For Grace Period
|
||||
public CmdGrace() {
|
||||
super();
|
||||
this.aliases.addAll(Aliases.grace);
|
||||
|
||||
this.optionalArgs.put("on/off", "toggle");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.GRACE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
Conf.gracePeriod = !Conf.gracePeriod;
|
||||
context.msg(TL.COMMAND_GRACE_TOGGLE, Conf.gracePeriod ? FactionsPlugin.getInstance().color("&aEnabled") : FactionsPlugin.getInstance().color("&4Disabled"));
|
||||
}
|
||||
if (!Conf.useGraceSystem) {
|
||||
context.msg(TL.GENERIC_DISABLED, "factions grace");
|
||||
return;
|
||||
}
|
||||
|
||||
if(context.args.size() == 1) {
|
||||
if (context.sender.hasPermission(String.valueOf(Permission.GRACETOGGLE))) {
|
||||
if (context.argAsString(0).equalsIgnoreCase("on") || context.argAsString(0).equalsIgnoreCase("start")) {
|
||||
FactionsPlugin.getInstance().getTimerManager().graceTimer.setPaused(false);
|
||||
FactionsPlugin.getInstance().getTimerManager().graceTimer.setRemaining(TimeUnit.DAYS.toMillis(Conf.gracePeriodTimeDays), true);
|
||||
if (Conf.broadcastGraceToggles) {
|
||||
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers())
|
||||
follower.msg(TL.COMMAND_GRACE_ENABLED_FORMAT, String.valueOf(TimerManager.getRemaining(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining(), true)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (context.argAsString(0).equalsIgnoreCase("off") || context.argAsString(0).equalsIgnoreCase("stop")) {
|
||||
FactionsPlugin.getInstance().getTimerManager().graceTimer.setRemaining(TimeUnit.SECONDS.toMillis(0L), true);
|
||||
FactionsPlugin.getInstance().getTimerManager().graceTimer.setPaused(false);
|
||||
if (Conf.broadcastGraceToggles) {
|
||||
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers())
|
||||
follower.msg(TL.COMMAND_GRACE_DISABLED_FORMAT);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining() <= 0L) {
|
||||
context.fPlayer.msg(TL.COMMAND_GRACE_DISABLED_NO_FORMAT.toString());
|
||||
} else {
|
||||
context.fPlayer.msg(TL.COMMAND_GRACE_TIME_REMAINING, String.valueOf(TimerManager.getRemaining(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining(), true)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
|
||||
@@ -32,7 +32,7 @@ public class CmdPointsBalance extends FCommand {
|
||||
|
||||
if (context.argIsSet(0)) {
|
||||
faction = context.argAsFaction(0);
|
||||
} else if(context.faction.isNormal()){
|
||||
} else if (context.faction.isNormal()) {
|
||||
context.msg(TL.COMMAND_POINTS_SHOW_OWN, context.faction.getPoints());
|
||||
return;
|
||||
} else {
|
||||
|
||||
@@ -57,6 +57,16 @@ public class FPromoteCommand extends FCommand {
|
||||
context.msg(TL.COMMAND_PROMOTE_NOT_SAME);
|
||||
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.
|
||||
if (context.fPlayer.getRole().value <= promotion.value) {
|
||||
context.msg(TL.COMMAND_PROMOTE_NOT_ALLOWED);
|
||||
@@ -64,11 +74,16 @@ public class FPromoteCommand extends FCommand {
|
||||
}
|
||||
}
|
||||
|
||||
if (promotion == null) {
|
||||
context.msg(TL.COMMAND_PROMOTE_NOTTHATPLAYER);
|
||||
// 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 who already have the highest rank.
|
||||
if (current.value == 4 && relative > 0) {
|
||||
context.msg(TL.COMMAND_PROMOTE_HIGHEST_RANK, target.getName());
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't allow people to promote people to their same or higher rnak.
|
||||
if (context.fPlayer.getRole().value <= promotion.value) {
|
||||
context.msg(TL.COMMAND_PROMOTE_NOT_ALLOWED);
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class CmdTntFill extends FCommand {
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package com.massivecraft.factions.cmd.wild;
|
||||
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.cmd.Aliases;
|
||||
import com.massivecraft.factions.cmd.CommandContext;
|
||||
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 org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
@@ -22,8 +20,12 @@ import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* @author DroppingAnvil
|
||||
*/
|
||||
public class CmdWild extends FCommand implements WaitedTask {
|
||||
public static HashMap<Player, String> teleportRange;
|
||||
public static HashSet<Player> teleporting;
|
||||
@@ -44,8 +46,6 @@ public class CmdWild extends FCommand implements WaitedTask {
|
||||
public void perform(CommandContext context) {
|
||||
if (!teleportRange.containsKey(context.player)) {
|
||||
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;
|
||||
ConfigurationSection c = FactionsPlugin.getInstance().getConfig().getConfigurationSection("Wild.Zones." + teleportRange.get(p));
|
||||
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 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()) {
|
||||
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);
|
||||
if (!FPlayers.getInstance().getByPlayer(p).takeMoney(c.getInt("Cost"))) {
|
||||
p.sendMessage(TL.GENERIC_NOTENOUGHMONEY.toString());
|
||||
return;
|
||||
}
|
||||
if (Conf.wildLoadChunkBeforeTeleport && !loc.getChunk().isLoaded()) loc.getChunk().load();
|
||||
teleportPlayer(p, loc);
|
||||
break;
|
||||
}
|
||||
@@ -72,6 +74,7 @@ public class CmdWild extends FCommand implements WaitedTask {
|
||||
}
|
||||
if (!success) {
|
||||
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) {
|
||||
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
|
||||
public void handleFailure(Player player) {
|
||||
player.sendMessage(TL.COMMAND_WILD_INTERUPTED.toString());
|
||||
teleportRange.remove(player);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@ package com.massivecraft.factions.cmd.wild;
|
||||
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.util.XMaterial;
|
||||
import com.massivecraft.factions.util.wait.WaitExecutor;
|
||||
import com.massivecraft.factions.util.wait.WaitTask;
|
||||
import com.massivecraft.factions.zcore.frame.FactionGUI;
|
||||
import com.massivecraft.factions.util.XMaterial;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -20,6 +20,9 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author DroppingAnvil
|
||||
*/
|
||||
public class WildGUI implements FactionGUI {
|
||||
Player player;
|
||||
FPlayer fplayer;
|
||||
@@ -37,7 +40,7 @@ public class WildGUI implements FactionGUI {
|
||||
if (map.containsKey(slot)) {
|
||||
String zone = map.get(slot);
|
||||
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);
|
||||
fplayer.msg(TL.COMMAND_WILD_WAIT, FactionsPlugin.getInstance().getConfig().getInt("Wild.Wait") + " Seconds");
|
||||
player.closeInventory();
|
||||
@@ -57,7 +60,8 @@ public class WildGUI implements FactionGUI {
|
||||
inv.setItem(fill, fillItem);
|
||||
}
|
||||
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();
|
||||
if (zoneMeta == null) return;
|
||||
List<String> lore = new ArrayList<>();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.massivecraft.factions.event;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import org.bukkit.event.Cancellable;
|
||||
@@ -10,51 +9,20 @@ import org.bukkit.event.Cancellable;
|
||||
*/
|
||||
public class PowerRegenEvent extends FactionPlayerEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* @author Illyria Team
|
||||
*/
|
||||
|
||||
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);
|
||||
this.delta = delta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the amount of power this player will regen by default
|
||||
*
|
||||
* @return power amount gained as a Double.
|
||||
*/
|
||||
public double getDefaultPowerGained() {
|
||||
return fPlayer.getMillisPassed() * Conf.powerPerMinute / 60000;
|
||||
public double getDelta() {
|
||||
return delta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the amount of custom power this player will gain. Ignored if less than or equal to 0.
|
||||
*
|
||||
* @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;
|
||||
public void setDelta(double delta) {
|
||||
this.delta = delta;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,4 +35,4 @@ public class PowerRegenEvent extends FactionPlayerEvent implements Cancellable {
|
||||
this.cancelled = c;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -32,9 +32,8 @@ public class Econ {
|
||||
private static Economy econ = null;
|
||||
|
||||
public static void setup() {
|
||||
if (isSetup()) {
|
||||
return;
|
||||
}
|
||||
if (isSetup()) return;
|
||||
|
||||
|
||||
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.");
|
||||
return;
|
||||
}
|
||||
|
||||
RegisteredServiceProvider<Economy> rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
|
||||
if (rsp == null) {
|
||||
FactionsPlugin.getInstance().log(integrationFail + "is not hooked into an economy plugin.");
|
||||
return;
|
||||
}
|
||||
econ = rsp.getProvider();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -68,26 +61,24 @@ public class Econ {
|
||||
}
|
||||
|
||||
public static void modifyUniverseMoney(double delta) {
|
||||
if (!shouldBeUsed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Conf.econUniverseAccount == null) {
|
||||
return;
|
||||
}
|
||||
if (Conf.econUniverseAccount.length() == 0) {
|
||||
return;
|
||||
}
|
||||
if (!econ.hasAccount(Conf.econUniverseAccount)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!shouldBeUsed()) return;
|
||||
if (Conf.econUniverseAccount == null) return;
|
||||
if (Conf.econUniverseAccount.length() == 0) return;
|
||||
if (!econ.hasAccount(Conf.econUniverseAccount)) return;
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
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);
|
||||
|
||||
// This is a system invoker. Accept it.
|
||||
if (fI == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (fI == null) return true;
|
||||
// Bypassing players can do any kind of transaction
|
||||
if (i instanceof FPlayer && ((FPlayer) i).isAdminBypassing()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (i instanceof FPlayer && ((FPlayer) i).isAdminBypassing()) return true;
|
||||
// Players with the any withdraw can do.
|
||||
if (i instanceof FPlayer && Permission.MONEY_WITHDRAW_ANY.has(((FPlayer) i).getPlayer())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (i instanceof FPlayer && Permission.MONEY_WITHDRAW_ANY.has(((FPlayer) i).getPlayer())) return true;
|
||||
// You can deposit to anywhere you feel like. It's your loss if you can't withdraw it again.
|
||||
if (i == you) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (i == you) return true;
|
||||
// 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.
|
||||
// Ohh by the way... Yes it could. For daily rent to the faction.
|
||||
if (i == fI && fI == fYou) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (i == fI && fI == fYou) return true;
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Otherwise you may not!;,,;
|
||||
i.msg(TL.ECON_CANTCONTROLMONEY, i.describeTo(i, true), you.describeTo(i));
|
||||
return false;
|
||||
@@ -140,7 +114,7 @@ public class Econ {
|
||||
|
||||
public static boolean transferMoney(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount, boolean notify) {
|
||||
if (!shouldBeUsed()) {
|
||||
invoker.msg(TL.ECON_OFF);
|
||||
invoker.msg(TL.ECON_DISABLED);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -154,30 +128,21 @@ public class Econ {
|
||||
}
|
||||
|
||||
// Check the rights
|
||||
if (!canIControllYou(invoker, from)) {
|
||||
return false;
|
||||
}
|
||||
if (!canIControllYou(invoker, from)) return false;
|
||||
|
||||
OfflinePlayer fromAcc;
|
||||
OfflinePlayer toAcc;
|
||||
|
||||
if (isUUID(from.getAccountId())) {
|
||||
fromAcc = Bukkit.getOfflinePlayer(UUID.fromString(from.getAccountId()));
|
||||
if (fromAcc.getName() == null) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
fromAcc = Bukkit.getOfflinePlayer(from.getAccountId());
|
||||
}
|
||||
if (fromAcc.getName() == null) return false;
|
||||
} else fromAcc = Bukkit.getOfflinePlayer(from.getAccountId());
|
||||
|
||||
|
||||
if (isUUID(to.getAccountId())) {
|
||||
toAcc = Bukkit.getOfflinePlayer(UUID.fromString(to.getAccountId()));
|
||||
if (toAcc.getName() == null) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
toAcc = Bukkit.getOfflinePlayer(to.getAccountId());
|
||||
}
|
||||
if (toAcc.getName() == null) return false;
|
||||
} else toAcc = Bukkit.getOfflinePlayer(to.getAccountId());
|
||||
|
||||
// Is there enough money for the transaction to happen?
|
||||
if (!econ.has(fromAcc, amount)) {
|
||||
@@ -185,13 +150,6 @@ public class Econ {
|
||||
if (invoker != null && notify) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -201,21 +159,15 @@ public class Econ {
|
||||
if (erw.transactionSuccess()) {
|
||||
EconomyResponse erd = econ.depositPlayer(toAcc, amount);
|
||||
if (erd.transactionSuccess()) {
|
||||
if (notify) {
|
||||
sendTransferInfo(invoker, from, to, amount);
|
||||
}
|
||||
if (notify) sendTransferInfo(invoker, from, to, amount);
|
||||
return true;
|
||||
} else {
|
||||
// transaction failed, refund account
|
||||
econ.depositPlayer(fromAcc, amount);
|
||||
}
|
||||
} else econ.depositPlayer(fromAcc, amount);
|
||||
|
||||
}
|
||||
|
||||
// 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));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -240,28 +192,22 @@ public class Econ {
|
||||
recipients.addAll(getFplayers(to));
|
||||
|
||||
if (invoker == null) {
|
||||
for (FPlayer recipient : recipients) {
|
||||
for (FPlayer recipient : recipients)
|
||||
recipient.msg(TL.ECON_MONEYTRASFERREDFROM, moneyString(amount), from.describeTo(recipient), to.describeTo(recipient));
|
||||
}
|
||||
} 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));
|
||||
}
|
||||
} 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));
|
||||
}
|
||||
} 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasAtLeast(EconomyParticipator ep, double delta, String toDoThis) {
|
||||
if (!shouldBeUsed()) {
|
||||
return true;
|
||||
}
|
||||
if (!shouldBeUsed()) return true;
|
||||
|
||||
// going the hard way round as econ.has refuses to work.
|
||||
boolean affordable = false;
|
||||
@@ -269,85 +215,59 @@ public class Econ {
|
||||
|
||||
if (isUUID(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())));
|
||||
} else {
|
||||
currentBalance = 0;
|
||||
}
|
||||
} else {
|
||||
currentBalance = econ.getBalance(ep.getAccountId());
|
||||
}
|
||||
|
||||
if (currentBalance >= delta) {
|
||||
affordable = true;
|
||||
}
|
||||
else currentBalance = 0;
|
||||
} else currentBalance = econ.getBalance(ep.getAccountId());
|
||||
if (currentBalance >= delta) affordable = true;
|
||||
|
||||
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);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean modifyMoney(EconomyParticipator ep, double delta, String toDoThis, String forDoingThis) {
|
||||
if (!shouldBeUsed()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!shouldBeUsed()) return false;
|
||||
OfflinePlayer acc;
|
||||
|
||||
if (isUUID(ep.getAccountId())) {
|
||||
acc = Bukkit.getOfflinePlayer(UUID.fromString(ep.getAccountId()));
|
||||
if (acc.getName() == null) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
acc = Bukkit.getOfflinePlayer(ep.getAccountId());
|
||||
}
|
||||
|
||||
if (acc.getName() == null) return false;
|
||||
} else acc = Bukkit.getOfflinePlayer(ep.getAccountId());
|
||||
String You = ep.describeTo(ep, true);
|
||||
|
||||
if (delta == 0) {
|
||||
// no money actually transferred?
|
||||
// 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) {
|
||||
if (delta == 0) return true;
|
||||
else if (delta > 0) {
|
||||
// The player should gain money
|
||||
// The account might not have enough space
|
||||
EconomyResponse er = econ.depositPlayer(acc, delta);
|
||||
if (er.transactionSuccess()) {
|
||||
modifyUniverseMoney(-delta);
|
||||
if (forDoingThis != null && !forDoingThis.isEmpty()) {
|
||||
if (forDoingThis != null && !forDoingThis.isEmpty())
|
||||
ep.msg(TL.COMMAND_MONEY_GAINED, You, moneyString(delta), forDoingThis);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
// transfer to account failed
|
||||
if (forDoingThis != null && !forDoingThis.isEmpty()) {
|
||||
if (forDoingThis != null && !forDoingThis.isEmpty())
|
||||
ep.msg(TL.ECON_DEPOSITFAILED, You, moneyString(delta), forDoingThis);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// The player should loose money
|
||||
// The player might not have enough.
|
||||
|
||||
if (econ.has(acc, -delta) && econ.withdrawPlayer(acc, -delta).transactionSuccess()) {
|
||||
// There is enough money to pay
|
||||
modifyUniverseMoney(-delta);
|
||||
if (forDoingThis != null && !forDoingThis.isEmpty()) {
|
||||
if (forDoingThis != null && !forDoingThis.isEmpty())
|
||||
ep.msg(TL.ECON_MONEYLOST, You, moneyString(-delta), forDoingThis);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
// 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);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -359,10 +279,7 @@ public class Econ {
|
||||
|
||||
// calculate the cost for claiming land
|
||||
public static double calculateClaimCost(int ownedLand, boolean takingFromAnotherFaction) {
|
||||
if (!shouldBeUsed()) {
|
||||
return 0d;
|
||||
}
|
||||
|
||||
if (!shouldBeUsed()) return 0d;
|
||||
// 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);
|
||||
}
|
||||
@@ -375,9 +292,7 @@ public class Econ {
|
||||
// calculate value of all owned land
|
||||
public static double calculateTotalLandValue(int ownedLand) {
|
||||
double amount = 0;
|
||||
for (int x = 0; x < ownedLand; x++) {
|
||||
amount += calculateClaimCost(x, false);
|
||||
}
|
||||
for (int x = 0; x < ownedLand; x++) amount += calculateClaimCost(x, false);
|
||||
return amount;
|
||||
}
|
||||
|
||||
@@ -401,9 +316,7 @@ public class Econ {
|
||||
|
||||
public static String getFriendlyBalance(UUID uuid) {
|
||||
OfflinePlayer offline = Bukkit.getOfflinePlayer(uuid);
|
||||
if (offline.getName() == null) {
|
||||
return "0";
|
||||
}
|
||||
if (offline.getName() == null) return "0";
|
||||
return format.format(econ.getBalance(offline));
|
||||
}
|
||||
|
||||
@@ -413,19 +326,13 @@ public class Econ {
|
||||
|
||||
public static boolean setBalance(String account, double amount) {
|
||||
double current = econ.getBalance(account);
|
||||
if (current > amount) {
|
||||
return econ.withdrawPlayer(account, current - amount).transactionSuccess();
|
||||
} else {
|
||||
return econ.depositPlayer(account, amount - current).transactionSuccess();
|
||||
}
|
||||
if (current > amount) return econ.withdrawPlayer(account, current - amount).transactionSuccess();
|
||||
else return econ.depositPlayer(account, amount - current).transactionSuccess();
|
||||
}
|
||||
|
||||
public static boolean modifyBalance(String account, double amount) {
|
||||
if (amount < 0) {
|
||||
return econ.withdrawPlayer(account, -amount).transactionSuccess();
|
||||
} else {
|
||||
return econ.depositPlayer(account, amount).transactionSuccess();
|
||||
}
|
||||
if (amount < 0) return econ.withdrawPlayer(account, -amount).transactionSuccess();
|
||||
else return econ.depositPlayer(account, amount).transactionSuccess();
|
||||
}
|
||||
|
||||
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.User;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class Essentials {
|
||||
|
||||
/**
|
||||
* @author FactionsUUID Team
|
||||
*/
|
||||
|
||||
private static IEssentials essentials;
|
||||
|
||||
public static void setup() {
|
||||
Plugin ess = 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();
|
||||
essentials = (IEssentials) Bukkit.getPluginManager().getPlugin("Essentials");
|
||||
}
|
||||
|
||||
// return false if feature is disabled or Essentials isn't available
|
||||
public static boolean handleTeleport(Player player, Location loc) {
|
||||
if (!Conf.homesTeleportCommandEssentialsIntegration || essentials == null) {
|
||||
return false;
|
||||
}
|
||||
if (!Conf.homesTeleportCommandEssentialsIntegration || essentials == null) return false;
|
||||
|
||||
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 {
|
||||
teleport.teleport(loc, trade, TeleportCause.PLUGIN);
|
||||
} catch (Exception e) {
|
||||
@@ -54,8 +37,21 @@ public class Essentials {
|
||||
}
|
||||
|
||||
public static boolean isVanished(Player player) {
|
||||
if (essentials == null) return false;
|
||||
User user = essentials.getUser(player);
|
||||
return user != null && user.isVanished();
|
||||
// Edge case handling.
|
||||
if (player == null) return false;
|
||||
boolean vanish = false;
|
||||
if (essentials != null) {
|
||||
User user = essentials.getUser(player);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.sk89q.worldguard.domains.Association;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.association.Associables;
|
||||
import com.sk89q.worldguard.protection.association.RegionAssociable;
|
||||
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
|
||||
@@ -22,7 +21,9 @@ import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
* WorldGuard Permission Checking.
|
||||
@@ -34,10 +35,6 @@ import java.util.*;
|
||||
public class Worldguard {
|
||||
|
||||
private static Worldguard instance;
|
||||
/**
|
||||
* @author FactionsUUID Team
|
||||
*/
|
||||
|
||||
private Object worldGuard;
|
||||
private WorldGuardPlugin worldGuardPlugin;
|
||||
private Object regionContainer;
|
||||
@@ -59,7 +56,7 @@ public class Worldguard {
|
||||
Plugin p = Bukkit.getPluginManager().getPlugin("WorldGuard");
|
||||
|
||||
if (p == null) {
|
||||
FactionsPlugin.instance.log("Could not find WorldGuard! Support will not be added.");
|
||||
FactionsPlugin.getInstance().log("Could not find WorldGuard! Support will not be added.");
|
||||
return;
|
||||
}
|
||||
if (p instanceof WorldGuardPlugin) {
|
||||
@@ -69,9 +66,9 @@ public class Worldguard {
|
||||
Class<?> worldGuardClass = Class.forName("com.sk89q.worldguard.WorldGuard");
|
||||
Method getInstanceMethod = worldGuardClass.getMethod("getInstance");
|
||||
worldGuard = getInstanceMethod.invoke(null);
|
||||
FactionsPlugin.instance.log("Found WorldGuard 7+");
|
||||
FactionsPlugin.getInstance().log("Found WorldGuard 7+");
|
||||
} catch (Exception ex) {
|
||||
FactionsPlugin.instance.log("Found WorldGuard <7");
|
||||
FactionsPlugin.getInstance().log("Found WorldGuard <7");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,42 +92,6 @@ public class Worldguard {
|
||||
return associable;
|
||||
}
|
||||
|
||||
public static boolean isPvPDisabled(Location l) {
|
||||
try {
|
||||
ApplicableRegionSet regionSet = Objects.requireNonNull(instance.getRegionManager(l.getWorld())).getApplicableRegions(l);
|
||||
if (regionSet.size() < 1) {
|
||||
try {
|
||||
return Objects.requireNonNull(Objects.requireNonNull(instance.getRegionManager(l.getWorld())).getRegion("__global__")).getFlags().get(DefaultFlag.PVP) == StateFlag.State.DENY;
|
||||
} catch (Exception e) {
|
||||
if (!(e instanceof NullPointerException)) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
boolean return_flag = false;
|
||||
int return_priority = -1;
|
||||
for (ProtectedRegion region : regionSet) {
|
||||
if (region.getFlags().containsKey(DefaultFlag.PVP)) {
|
||||
StateFlag.State pvp_flag = (StateFlag.State) region.getFlags().get(DefaultFlag.PVP);
|
||||
int region_priority = region.getPriority();
|
||||
if (return_priority == -1) {
|
||||
return_flag = pvp_flag == StateFlag.State.DENY;
|
||||
return_priority = region_priority;
|
||||
} else if (region_priority > return_priority) {
|
||||
return_flag = pvp_flag == StateFlag.State.DENY;
|
||||
return_priority = region_priority;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return return_flag;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Credits to the people listed above for using reflections to load WorldGuard 6.0 & 7.0 in 1 class!
|
||||
*/
|
||||
@@ -159,8 +120,8 @@ public class Worldguard {
|
||||
breakFlag = (StateFlag) flagsClass.getField("BREAK").get(null);
|
||||
|
||||
} catch (Exception ex) {
|
||||
FactionsPlugin.instance.log("We failed to load some part of World Guard. Support will be removed!");
|
||||
FactionsPlugin.instance.log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
||||
FactionsPlugin.getInstance().log("We failed to load some part of World Guard. Support will be removed!");
|
||||
FactionsPlugin.getInstance().log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
||||
regionContainer = null;
|
||||
return;
|
||||
}
|
||||
@@ -178,8 +139,8 @@ public class Worldguard {
|
||||
breakFlag = (StateFlag) flagsClass.getField("BREAK").get(null);
|
||||
|
||||
} catch (Exception ex) {
|
||||
FactionsPlugin.instance.log("We failed to load some part of World Guard. Support will be removed!");
|
||||
FactionsPlugin.instance.log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
||||
FactionsPlugin.getInstance().log("We failed to load some part of World Guard. Support will be removed!");
|
||||
FactionsPlugin.getInstance().log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
||||
regionContainer = null;
|
||||
return;
|
||||
}
|
||||
@@ -195,8 +156,8 @@ public class Worldguard {
|
||||
vectorConstructorAsAMethodBecauseWhyNot = vectorClass.getMethod("at", Double.TYPE, Double.TYPE, Double.TYPE);
|
||||
regionManagerGetMethod = RegionManager.class.getMethod("getApplicableRegions", vectorClass);
|
||||
} catch (Exception sodonewiththis) {
|
||||
FactionsPlugin.instance.log("We failed to load Vector Classes from WorldGuard! Support will be removed!");
|
||||
FactionsPlugin.instance.log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
||||
FactionsPlugin.getInstance().log("We failed to load Vector Classes from WorldGuard! Support will be removed!");
|
||||
FactionsPlugin.getInstance().log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
||||
regionContainer = null;
|
||||
return;
|
||||
}
|
||||
@@ -216,7 +177,7 @@ public class Worldguard {
|
||||
regionManager = (RegionManager) regionContainerGetMethod.invoke(regionContainer, world);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
FactionsPlugin.instance.log("An error occurred looking up a WorldGuard RegionManager");
|
||||
FactionsPlugin.getInstance().log("An error occurred looking up a WorldGuard RegionManager");
|
||||
}
|
||||
return regionManager;
|
||||
}
|
||||
@@ -230,8 +191,8 @@ public class Worldguard {
|
||||
: vectorConstructorAsAMethodBecauseWhyNot.invoke(null, location.getX(), location.getY(), location.getZ());
|
||||
return (ApplicableRegionSet) regionManagerGetMethod.invoke(regionManager, vector);
|
||||
} catch (Exception ex) {
|
||||
FactionsPlugin.instance.log("An error occurred looking up a WorldGuard ApplicableRegionSet");
|
||||
FactionsPlugin.instance.log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
||||
FactionsPlugin.getInstance().log("An error occurred looking up a WorldGuard ApplicableRegionSet");
|
||||
FactionsPlugin.getInstance().log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -255,8 +216,8 @@ public class Worldguard {
|
||||
} else
|
||||
return (boolean) regionQueryTestStateMethod.invoke(query, location, getAssociable(player), new StateFlag[]{buildFlag});
|
||||
} catch (Exception ex) {
|
||||
FactionsPlugin.instance.log("An error occurred querying WorldGuard! Report this issue to SF Developers!");
|
||||
FactionsPlugin.instance.log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
||||
FactionsPlugin.getInstance().log("An error occurred querying WorldGuard! Report this issue to SF Developers!");
|
||||
FactionsPlugin.getInstance().log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -281,8 +242,8 @@ public class Worldguard {
|
||||
return (boolean) regionQueryTestStateMethod.invoke(query, location, getAssociable(player), new StateFlag[]{breakFlag});
|
||||
|
||||
} catch (Exception ex) {
|
||||
FactionsPlugin.instance.log("An error occurred querying WorldGuard! Report this issue to SF Developers!");
|
||||
FactionsPlugin.instance.log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
||||
FactionsPlugin.getInstance().log("An error occurred querying WorldGuard! Report this issue to SF Developers!");
|
||||
FactionsPlugin.getInstance().log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -320,8 +281,8 @@ public class Worldguard {
|
||||
|
||||
return overlaps != null && !overlaps.isEmpty();
|
||||
} catch (Exception ex) {
|
||||
FactionsPlugin.instance.log("An error occurred querying WorldGuard! Report this issue to SF Developers!");
|
||||
FactionsPlugin.instance.log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
||||
FactionsPlugin.getInstance().log("An error occurred querying WorldGuard! Report this issue to SF Developers!");
|
||||
FactionsPlugin.getInstance().log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -27,7 +27,6 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
@@ -94,26 +93,23 @@ public class FactionsBlockListener implements Listener {
|
||||
boolean landOwned = (myFaction.doesLocationHaveOwnersSet(loc) && !myFaction.getOwnerList(loc).isEmpty());
|
||||
if ((landOwned && myFaction.getOwnerListString(loc).contains(player.getName())) || (me.getRole() == Role.LEADER && me.getFactionId().equals(myFaction.getId())))
|
||||
return true;
|
||||
else {
|
||||
String replace = TL.ACTIONS_NOPERMISSIONPAIN.toString().replace("{action}", action.toString());
|
||||
if (landOwned && !myFaction.getOwnerListString(loc).contains(player.getName())) {
|
||||
me.msg(TL.ACTIONS_OWNEDTERRITORYDENY.toString().replace("{owners}", myFaction.getOwnerListString(loc)));
|
||||
if (shouldHurt) {
|
||||
player.damage(Conf.actionDeniedPainAmount);
|
||||
me.msg(replace.replace("{faction}", Board.getInstance().getFactionAt(loc).getTag(myFaction)));
|
||||
}
|
||||
return false;
|
||||
} else if (!landOwned && access == Access.DENY) { // If land is not owned but access is set to DENY anyway
|
||||
if (shouldHurt) {
|
||||
player.damage(Conf.actionDeniedPainAmount);
|
||||
if ((Board.getInstance().getFactionAt(loc).getTag(myFaction)) != null)
|
||||
me.msg(replace.replace("{faction}", Board.getInstance().getFactionAt(loc).getTag(myFaction)));
|
||||
}
|
||||
if (myFaction.getTag(me.getFaction()) != null && action != null)
|
||||
me.msg(TL.ACTIONS_NOPERMISSION.toString().replace("{faction}", myFaction.getTag(me.getFaction())).replace("{action}", action.toString()));
|
||||
return false;
|
||||
} else if (access == Access.ALLOW) return true;
|
||||
}
|
||||
else if (landOwned && !myFaction.getOwnerListString(loc).contains(player.getName())) {
|
||||
me.msg(TL.ACTIONS_OWNEDTERRITORYDENY.toString().replace("{owners}", myFaction.getOwnerListString(loc)));
|
||||
if (shouldHurt) {
|
||||
player.damage(Conf.actionDeniedPainAmount);
|
||||
me.msg(TL.ACTIONS_NOPERMISSIONPAIN.toString().replace("{action}", action.toString()).replace("{faction}", Board.getInstance().getFactionAt(loc).getTag(myFaction)));
|
||||
}
|
||||
return false;
|
||||
} else if (!landOwned && access == Access.DENY) { // If land is not owned but access is set to DENY anyway
|
||||
if (shouldHurt) {
|
||||
player.damage(Conf.actionDeniedPainAmount);
|
||||
if ((Board.getInstance().getFactionAt(loc).getTag(myFaction)) != null)
|
||||
me.msg(TL.ACTIONS_NOPERMISSIONPAIN.toString().replace("{action}", action.toString()).replace("{faction}", Board.getInstance().getFactionAt(loc).getTag(myFaction)));
|
||||
}
|
||||
if (myFaction.getTag(me.getFaction()) != null && action != null)
|
||||
me.msg(TL.ACTIONS_NOPERMISSION.toString().replace("{faction}", myFaction.getTag(me.getFaction())).replace("{action}", action.toString()));
|
||||
return false;
|
||||
} else if (access == Access.ALLOW) return true;
|
||||
me.msg(TL.ACTIONS_NOPERMISSION.toString().replace("{faction}", myFaction.getTag(me.getFaction())).replace("{action}", action.toString()));
|
||||
return false;
|
||||
}
|
||||
@@ -183,12 +179,18 @@ public class FactionsBlockListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockFromTo(BlockFromToEvent event) {
|
||||
if (!Conf.handleExploitLiquidFlow) return;
|
||||
|
||||
if (event.getBlock().isLiquid()) {
|
||||
if (event.getToBlock().isEmpty()) {
|
||||
Faction from = Board.getInstance().getFactionAt(new FLocation(event.getBlock()));
|
||||
Faction to = Board.getInstance().getFactionAt(new FLocation(event.getToBlock()));
|
||||
if (from == to) return;
|
||||
// from faction != to faction
|
||||
if(to.isSystemFaction()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (to.isNormal()) {
|
||||
if (from.isNormal() && from.getRelationTo(to).isAlly()) {
|
||||
return;
|
||||
@@ -416,9 +418,8 @@ public class FactionsBlockListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onFrostWalker(EntityBlockFormEvent event) {
|
||||
if (event.getEntity() == null || event.getEntity().getType() != EntityType.PLAYER || event.getBlock() == null) {
|
||||
if (event.getEntity() == null || event.getEntity().getType() != EntityType.PLAYER || event.getBlock() == null)
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) event.getEntity();
|
||||
Location location = event.getBlock().getLocation();
|
||||
@@ -426,14 +427,10 @@ public class FactionsBlockListener implements Listener {
|
||||
// only notify every 10 seconds
|
||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||
boolean justCheck = fPlayer.getLastFrostwalkerMessage() + 10000 > System.currentTimeMillis();
|
||||
if (!justCheck) {
|
||||
fPlayer.setLastFrostwalkerMessage();
|
||||
}
|
||||
if (!justCheck) fPlayer.setLastFrostwalkerMessage();
|
||||
|
||||
// Check if they have build permissions here. If not, block this from happening.
|
||||
if (!playerCanBuildDestroyBlock(player, location, PermissableAction.FROST_WALK.toString(), justCheck)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
if (!playerCanBuildDestroyBlock(player, location, PermissableAction.FROST_WALK.toString(), justCheck)) event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -448,29 +445,6 @@ public class FactionsBlockListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
//Grace
|
||||
@EventHandler
|
||||
public void onBreak(EntityExplodeEvent e) {
|
||||
if (!Conf.gracePeriod) return;
|
||||
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onTNTPlace(BlockPlaceEvent e1) {
|
||||
FPlayer fp = FPlayers.getInstance().getByPlayer(e1.getPlayer());
|
||||
if (!Conf.gracePeriod) return;
|
||||
|
||||
if (!fp.isAdminBypassing()) {
|
||||
if (e1.getBlock().getType().equals(Material.TNT)) {
|
||||
e1.setCancelled(true);
|
||||
|
||||
fp.msg(TL.COMMAND_GRACE_ENABLED, e1.getBlockPlaced().getType().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canPistonMoveBlock(Faction pistonFaction, Location target) {
|
||||
Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(target));
|
||||
|
||||
@@ -493,7 +467,6 @@ public class FactionsBlockListener implements Listener {
|
||||
|
||||
Faction at = Board.getInstance().getFactionAt(new FLocation(block));
|
||||
boolean isSpawner = event.getBlock().getType().equals(XMaterial.SPAWNER.parseMaterial());
|
||||
|
||||
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@@ -538,6 +511,7 @@ public class FactionsBlockListener implements Listener {
|
||||
Player p = (Player) event.getRemover();
|
||||
if (!playerCanBuildDestroyBlock(p, event.getEntity().getLocation(), "destroy", true)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@ import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.event.PowerLossEvent;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.util.MiscUtil;
|
||||
import com.massivecraft.factions.util.timer.type.GraceTimer;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.entity.minecart.ExplosiveMinecart;
|
||||
@@ -95,11 +95,9 @@ public class FactionsEntityListener implements Listener {
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
if (event instanceof EntityDamageByEntityEvent) {
|
||||
EntityDamageByEntityEvent sub = (EntityDamageByEntityEvent) event;
|
||||
if (!this.canDamagerHurtDamagee(sub, true)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
// event is not cancelled by factions
|
||||
if (!this.canDamagerHurtDamagee(sub, true)) event.setCancelled(true);
|
||||
|
||||
// event is not cancelled by factions
|
||||
Entity damagee = sub.getEntity();
|
||||
Entity damager = sub.getDamager();
|
||||
if (damagee instanceof Player) {
|
||||
@@ -126,15 +124,12 @@ public class FactionsEntityListener implements Listener {
|
||||
// this should disable the fly so
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// this should trigger if the attacker shootin the arrow is a mob
|
||||
return;
|
||||
}
|
||||
} else return; // this should trigger if the attacker shootin the arrow is a mob
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Protect armor stands/item frames from being damaged in protected territories
|
||||
if (damagee.getType() == EntityType.ITEM_FRAME || damagee.getType().name().equals("armor_stand")) {
|
||||
if (damagee.getType() == EntityType.ITEM_FRAME || damagee.getType() == EntityType.ARMOR_STAND) {
|
||||
// Manage projectiles launched by players
|
||||
if (damager instanceof Projectile && ((Projectile) damager).getShooter() instanceof Entity) {
|
||||
damager = (Entity) ((Projectile) damager).getShooter();
|
||||
@@ -142,37 +137,22 @@ public class FactionsEntityListener implements Listener {
|
||||
|
||||
// Run the check for a player
|
||||
if (damager instanceof Player) {
|
||||
Player player = (Player) damager;
|
||||
Material material = null;
|
||||
switch (sub.getEntity().getType()) {
|
||||
case ITEM_FRAME:
|
||||
material = Material.ITEM_FRAME;
|
||||
break;
|
||||
case ARMOR_STAND:
|
||||
material = Material.ARMOR_STAND;
|
||||
break;
|
||||
}
|
||||
if (material != null && !FactionsBlockListener.playerCanBuildDestroyBlock(player, damagee.getLocation(), "destroy " + material.toString().toLowerCase(), false)) {
|
||||
|
||||
if (!FactionsBlockListener.playerCanBuildDestroyBlock((Player) damager, damagee.getLocation(), "destroy", false))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
} else {
|
||||
// we don't want to let mobs/arrows destroy item frames/armor stands
|
||||
// so we only have to run the check as if there had been an explosion at the damager location
|
||||
if (!this.checkExplosionForBlock(damager, damagee.getLocation().getBlock())) {
|
||||
if (!this.checkExplosionForBlock(damager, damagee.getLocation().getBlock()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
// we don't need to go after
|
||||
return;
|
||||
}
|
||||
|
||||
//this one should trigger if something other than a player takes damage
|
||||
if (damager instanceof Player) {
|
||||
// now itll only go here if the damage is dealt by a player
|
||||
return;
|
||||
// we cancel it so fly isnt removed when you hit a mob etc
|
||||
}
|
||||
if (damager instanceof Player) return;
|
||||
}
|
||||
if (damagee != null && damagee instanceof Player) {
|
||||
cancelFStuckTeleport((Player) damagee);
|
||||
@@ -216,6 +196,7 @@ public class FactionsEntityListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void cancelFFly(Player player) {
|
||||
if (player == null) return;
|
||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||
@@ -347,7 +328,6 @@ public class FactionsEntityListener implements Listener {
|
||||
|
||||
public boolean isPlayerInSafeZone(Entity damagee) {
|
||||
if (!(damagee instanceof Player)) return false;
|
||||
|
||||
return Board.getInstance().getFactionAt(new FLocation(damagee.getLocation())).isSafeZone();
|
||||
}
|
||||
|
||||
@@ -358,29 +338,34 @@ public class FactionsEntityListener implements Listener {
|
||||
public boolean canDamagerHurtDamagee(EntityDamageByEntityEvent sub, boolean notify) {
|
||||
Entity damager = sub.getDamager();
|
||||
Entity damagee = sub.getEntity();
|
||||
|
||||
if (!(damagee instanceof Player)) return true;
|
||||
|
||||
|
||||
FPlayer defender = FPlayers.getInstance().getByPlayer((Player) damagee);
|
||||
|
||||
if (defender == null || defender.getPlayer() == null) return true;
|
||||
|
||||
|
||||
if (damager instanceof Player) {
|
||||
FPlayer attacker = FPlayers.getInstance().getByPlayer((Player) damager);
|
||||
if (defender == null || defender.getPlayer() == null) return true;
|
||||
if (attacker.getFaction() == defender.getFaction()) {
|
||||
if (attacker.hasFriendlyFire() && defender.hasFriendlyFire()) return true;
|
||||
if (attacker.hasFriendlyFire() && !defender.hasFriendlyFire()) {
|
||||
attacker.msg(TL.FRIENDLY_FIRE_OFF_ATTACKER, defender.getName());
|
||||
return false;
|
||||
} else if (!attacker.hasFriendlyFire() && defender.hasFriendlyFire()) {
|
||||
attacker.msg(TL.FRIENDLY_FIRE_YOU_MUST);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Location defenderLoc = defender.getPlayer().getLocation();
|
||||
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
|
||||
if (damager instanceof Projectile) {
|
||||
Projectile projectile = (Projectile) damager;
|
||||
|
||||
if (!(projectile.getShooter() instanceof Entity)) return true;
|
||||
damager = (Entity) projectile.getShooter();
|
||||
}
|
||||
|
||||
if (damager == damagee) return true; // ender pearl usage and other self-inflicted damage
|
||||
|
||||
// Players can not take attack damage in a SafeZone, or possibly peaceful territory
|
||||
// Players can not take attack damage in a SafeZone or peaceful territory depending on Conf options.
|
||||
if (defLocFaction.noPvPInTerritory()) {
|
||||
if (damager instanceof Player) {
|
||||
if (notify) {
|
||||
@@ -394,19 +379,14 @@ public class FactionsEntityListener implements Listener {
|
||||
|
||||
if (!(damager instanceof Player)) return true;
|
||||
|
||||
|
||||
FPlayer attacker = FPlayers.getInstance().getByPlayer((Player) damager);
|
||||
|
||||
if (attacker == null || attacker.getPlayer() == null) return true;
|
||||
|
||||
|
||||
if (Conf.playersWhoBypassAllProtection.contains(attacker.getName())) return true;
|
||||
|
||||
|
||||
if (attacker.hasLoginPvpDisabled()) {
|
||||
if (notify) {
|
||||
attacker.msg(TL.PLAYER_PVP_LOGIN, Conf.noPVPDamageToOthersForXSecondsAfterLogin);
|
||||
}
|
||||
if (notify) attacker.msg(TL.PLAYER_PVP_LOGIN, Conf.noPVPDamageToOthersForXSecondsAfterLogin);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -414,47 +394,32 @@ public class FactionsEntityListener implements Listener {
|
||||
|
||||
// so we know from above that the defender isn't in a safezone... what about the attacker, sneaky dog that he might be?
|
||||
if (locFaction.noPvPInTerritory()) {
|
||||
if (notify) {
|
||||
if (notify)
|
||||
attacker.msg(TL.PLAYER_CANTHURT, (locFaction.isSafeZone() ? TL.REGION_SAFEZONE.toString() : TL.REGION_PEACEFUL.toString()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (locFaction.isWarZone() && Conf.warZoneFriendlyFire) return true;
|
||||
|
||||
|
||||
if (Conf.worldsIgnorePvP.contains(defenderLoc.getWorld().getName())) return true;
|
||||
|
||||
|
||||
Faction defendFaction = defender.getFaction();
|
||||
Faction attackFaction = attacker.getFaction();
|
||||
|
||||
if (attackFaction.isWilderness() && Conf.disablePVPForFactionlessPlayers) {
|
||||
if (notify) {
|
||||
attacker.msg(TL.PLAYER_PVP_REQUIREFACTION);
|
||||
}
|
||||
if (notify) attacker.msg(TL.PLAYER_PVP_REQUIREFACTION);
|
||||
return false;
|
||||
} else if (defendFaction.isWilderness()) {
|
||||
if (defLocFaction == attackFaction && Conf.enablePVPAgainstFactionlessInAttackersLand) {
|
||||
// Allow PVP vs. Factionless in attacker's faction territory
|
||||
return true;
|
||||
} else if (Conf.disablePVPForFactionlessPlayers) {
|
||||
if (notify) {
|
||||
attacker.msg(TL.PLAYER_PVP_FACTIONLESS);
|
||||
}
|
||||
if (notify) attacker.msg(TL.PLAYER_PVP_FACTIONLESS);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (defendFaction.isPeaceful()) {
|
||||
if (notify) {
|
||||
attacker.msg(TL.PLAYER_PVP_PEACEFUL);
|
||||
}
|
||||
return false;
|
||||
} else if (attackFaction.isPeaceful()) {
|
||||
if (notify) {
|
||||
attacker.msg(TL.PLAYER_PVP_PEACEFUL);
|
||||
}
|
||||
if (defendFaction.isPeaceful() || attackFaction.isPeaceful()) {
|
||||
if (notify) attacker.msg(TL.PLAYER_PVP_PEACEFUL);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -462,21 +427,16 @@ public class FactionsEntityListener implements Listener {
|
||||
|
||||
// You can not hurt neutral factions
|
||||
if (Conf.disablePVPBetweenNeutralFactions && relation.isNeutral()) {
|
||||
if (notify) {
|
||||
attacker.msg(TL.PLAYER_PVP_NEUTRAL);
|
||||
}
|
||||
if (notify) attacker.msg(TL.PLAYER_PVP_NEUTRAL);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Players without faction may be hurt anywhere
|
||||
if (!defender.hasFaction()) return true;
|
||||
|
||||
|
||||
// You can never hurt faction members or allies
|
||||
if (relation.isMember() || relation.isAlly() || relation.isTruce()) {
|
||||
if (notify) {
|
||||
attacker.msg(TL.PLAYER_PVP_CANTHURT, defender.describeTo(attacker));
|
||||
}
|
||||
if (relation.isMember() || relation.isAlly()) {
|
||||
if (notify) attacker.msg(TL.PLAYER_PVP_CANTHURT, defender.describeTo(attacker));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -490,23 +450,10 @@ public class FactionsEntityListener implements Listener {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Damage will be dealt. However check if the damage should be reduced.
|
||||
/*
|
||||
if (damage > 0.0 && ownTerritory && Conf.territoryShieldFactor > 0) {
|
||||
double newDamage = Math.ceil(damage * (1D - Conf.territoryShieldFactor));
|
||||
sub.setDamage(newDamage);
|
||||
|
||||
// Send message
|
||||
if (notify) {
|
||||
String perc = MessageFormat.format("{0,number,#%}", (Conf.territoryShieldFactor)); // TODO does this display correctly??
|
||||
defender.msg("<i>Enemy damage reduced by <rose>%s<i>.", perc);
|
||||
}
|
||||
} */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||
if (event.getLocation() == null) return;
|
||||
@@ -557,14 +504,10 @@ public class FactionsEntityListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onHangerBreak(HangingBreakByEntityEvent e) {
|
||||
if (e.getRemover() == null) return;
|
||||
if (!(e.getRemover() instanceof Player)) return;
|
||||
Player p = (Player) e.getRemover();
|
||||
if (e.getEntity().getType().equals(EntityType.PAINTING)) {
|
||||
if (!FactionsBlockListener.playerCanBuildDestroyBlock(p, e.getEntity().getLocation(), "destroy", false)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
} else if (e.getEntity().getType().equals(EntityType.ITEM_FRAME)) {
|
||||
|
||||
if (e.getEntity().getType() == EntityType.PAINTING || e.getEntity().getType() == EntityType.ITEM_FRAME) {
|
||||
if (!FactionsBlockListener.playerCanBuildDestroyBlock(p, e.getEntity().getLocation(), "destroy", false)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
@@ -572,48 +515,38 @@ public class FactionsEntityListener implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onPaintingPlace(HangingPlaceEvent event) {
|
||||
if (event.getEntity().getType().equals(EntityType.PAINTING)) {
|
||||
if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "build", false)) {
|
||||
event.setCancelled(true);
|
||||
// Fix: update player's inventory to avoid items glitches
|
||||
event.getPlayer().updateInventory();
|
||||
}
|
||||
} else if (event.getEntity().getType().equals(EntityType.ITEM_FRAME)) {
|
||||
if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), event.getEntity().getLocation(), "build", false)) {
|
||||
event.setCancelled(true);
|
||||
// Fix: update player's inventory to avoid items glitches
|
||||
event.getPlayer().updateInventory();
|
||||
public void onPaintingPlace(HangingPlaceEvent e) {
|
||||
if (e.getPlayer() == null) return;
|
||||
|
||||
if (e.getEntity().getType() == EntityType.PAINTING || e.getEntity().getType() == EntityType.ITEM_FRAME) {
|
||||
if (!FactionsBlockListener.playerCanBuildDestroyBlock(e.getPlayer(), e.getBlock().getLocation(), "build", false)) {
|
||||
e.setCancelled(true);
|
||||
e.getPlayer().updateInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
public void onEntityChangeBlock(EntityChangeBlockEvent e) {
|
||||
Entity entity = e.getEntity();
|
||||
Location loc = e.getBlock().getLocation();
|
||||
|
||||
// for now, only interested in Enderman and Wither boss tomfoolery
|
||||
if (!(entity instanceof Enderman) && !(entity instanceof Wither)) return;
|
||||
|
||||
|
||||
Location loc = event.getBlock().getLocation();
|
||||
|
||||
if (entity instanceof Enderman) {
|
||||
if (stopEndermanBlockManipulation(loc)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (entity instanceof Wither) {
|
||||
if (entity.getType() == EntityType.ENDERMAN) {
|
||||
if (stopEndermanBlockManipulation(loc)) e.setCancelled(true);
|
||||
} else if (entity.getType() == EntityType.WITHER) {
|
||||
Faction faction = Board.getInstance().getFactionAt(new FLocation(loc));
|
||||
// it's a bit crude just using fireball protection, but I'd rather not add in a whole new set of xxxBlockWitherExplosion or whatever
|
||||
if ((faction.isWilderness() && Conf.wildernessBlockFireballs && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) ||
|
||||
(faction.isNormal() && (faction.hasPlayersOnline() ? Conf.territoryBlockFireballs : Conf.territoryBlockFireballsWhenOffline)) ||
|
||||
(faction.isWarZone() && Conf.warZoneBlockFireballs) ||
|
||||
faction.isSafeZone()) {
|
||||
event.setCancelled(true);
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@EventHandler
|
||||
public void onTravel(PlayerPortalEvent event) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.cmd.CmdFGlobal;
|
||||
import com.massivecraft.factions.cmd.CmdFly;
|
||||
import com.massivecraft.factions.cmd.CmdSeeChunk;
|
||||
import com.massivecraft.factions.cmd.FCmdRoot;
|
||||
import com.massivecraft.factions.cmd.audit.FLogType;
|
||||
import com.massivecraft.factions.cmd.logout.LogoutHandler;
|
||||
import com.massivecraft.factions.cmd.wild.CmdWild;
|
||||
@@ -19,12 +20,12 @@ import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.util.CC;
|
||||
import com.massivecraft.factions.util.wait.WaitExecutor;
|
||||
import com.massivecraft.factions.zcore.frame.FactionGUI;
|
||||
import com.massivecraft.factions.util.VisualizeUtil;
|
||||
import com.massivecraft.factions.util.XMaterial;
|
||||
import com.massivecraft.factions.util.wait.WaitExecutor;
|
||||
import com.massivecraft.factions.zcore.fperms.Access;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.frame.FactionGUI;
|
||||
import com.massivecraft.factions.zcore.persist.MemoryFPlayer;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import com.massivecraft.factions.zcore.util.TagUtil;
|
||||
@@ -35,6 +36,8 @@ import net.dv8tion.jda.core.entities.Member;
|
||||
import net.dv8tion.jda.core.entities.TextChannel;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Boat;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -55,8 +58,6 @@ import java.util.logging.Level;
|
||||
public class FactionsPlayerListener implements Listener {
|
||||
|
||||
public static Set<FLocation> corners;
|
||||
public static BukkitTask positionTask = null;
|
||||
public static Map<UUID, Location> lastLocations = new HashMap<>();
|
||||
/**
|
||||
* @author FactionsUUID Team
|
||||
*/
|
||||
@@ -308,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()))) {
|
||||
return true;
|
||||
} 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);
|
||||
return false;
|
||||
} else if (!landOwned && access == Access.ALLOW) {
|
||||
@@ -384,6 +385,10 @@ public class FactionsPlayerListener implements Listener {
|
||||
case CHEST_MINECART:
|
||||
|
||||
case BARREL:
|
||||
case COMPOSTER:
|
||||
case LOOM:
|
||||
case CARTOGRAPHY_TABLE:
|
||||
case GRINDSTONE:
|
||||
|
||||
case SHULKER_BOX:
|
||||
case BLACK_SHULKER_BOX:
|
||||
@@ -452,7 +457,6 @@ public class FactionsPlayerListener implements Listener {
|
||||
case CHIPPED_ANVIL:
|
||||
case DAMAGED_ANVIL:
|
||||
case BREWING_STAND:
|
||||
|
||||
return PermissableAction.CONTAINER;
|
||||
default:
|
||||
return null;
|
||||
@@ -473,6 +477,8 @@ public class FactionsPlayerListener implements Listener {
|
||||
// Update the lastLoginTime for this fplayer
|
||||
me.setLastLoginTime(System.currentTimeMillis());
|
||||
|
||||
lastLocations.put(player.getUniqueId(), player.getLocation());
|
||||
|
||||
// Store player's current FLocation and notify them where they are
|
||||
me.setLastStoodAt(new FLocation(player.getLocation()));
|
||||
|
||||
@@ -529,6 +535,7 @@ public class FactionsPlayerListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
Player this_ = event.getPlayer();
|
||||
FPlayer me = FPlayers.getInstance().getByPlayer(event.getPlayer());
|
||||
|
||||
// Make sure player's power is up to date when they log off.
|
||||
@@ -545,6 +552,8 @@ public class FactionsPlayerListener implements Listener {
|
||||
FactionsPlugin.instance.getTimers().remove(me.getPlayer().getUniqueId());
|
||||
}
|
||||
|
||||
lastLocations.remove(this_.getUniqueId());
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
if (!myFaction.isWilderness()) myFaction.memberLoggedOff();
|
||||
|
||||
@@ -571,13 +580,13 @@ public class FactionsPlayerListener implements Listener {
|
||||
}
|
||||
|
||||
public void checkCanFly(FPlayer me) {
|
||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) return;
|
||||
if (me.isFlying() && !me.isVanished() && (!me.canFlyAtLocation() || me.checkIfNearbyEnemies())) {
|
||||
me.setFFlying(false, false);
|
||||
me.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(me.getLastStoodAt()).getTag());
|
||||
if (!me.canFlyAtLocation() || me.checkIfNearbyEnemies()) {
|
||||
if (me.isFlying())
|
||||
me.setFFlying(false, false);
|
||||
return;
|
||||
}
|
||||
if (me.isFlying() || !FactionsPlugin.instance.getConfig().getBoolean("ffly.AutoEnable")) return;
|
||||
if (me.isFlying() || !FactionsPlugin.instance.getConfig().getBoolean("ffly.AutoEnable"))
|
||||
return;
|
||||
me.setFFlying(true, false);
|
||||
CmdFly.flyMap.put(me.getName(), true);
|
||||
if (CmdFly.particleTask == null)
|
||||
@@ -646,43 +655,17 @@ public class FactionsPlayerListener implements Listener {
|
||||
return (result.length() == 3 ? result + "0" : result) + "/hrs ago";
|
||||
}
|
||||
|
||||
public void startPositionCheck() {
|
||||
positionTask = Bukkit.getScheduler().runTaskTimer(FactionsPlugin.instance, () -> {
|
||||
if (Bukkit.getOnlinePlayers().size() > 0) {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (!lastLocations.containsKey(player.getUniqueId())) {
|
||||
lastLocations.put(player.getUniqueId(), player.getLocation());
|
||||
continue;
|
||||
}
|
||||
refreshPosition(player, lastLocations.get(player.getUniqueId()), player.getLocation());
|
||||
lastLocations.put(player.getUniqueId(), player.getLocation());
|
||||
if (CmdFly.flyMap.containsKey(player.getName())) {
|
||||
String name = player.getName();
|
||||
if (!player.isFlying()
|
||||
|| player.getGameMode() == GameMode.CREATIVE
|
||||
|| !FactionsPlugin.instance.mc17 && player.getGameMode() == GameMode.SPECTATOR) {
|
||||
continue;
|
||||
}
|
||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||
Faction myFaction = fPlayer.getFaction();
|
||||
if (myFaction.isWilderness()) {
|
||||
Bukkit.getScheduler().runTask(FactionsPlugin.instance, () -> fPlayer.setFlying(false));
|
||||
CmdFly.flyMap.remove(player.getName());
|
||||
continue;
|
||||
}
|
||||
Bukkit.getScheduler().runTask(FactionsPlugin.instance, () -> {
|
||||
if (!fPlayer.checkIfNearbyEnemies()) {
|
||||
FLocation myFloc = new FLocation(player.getLocation());
|
||||
if (Board.getInstance().getFactionAt(myFloc) != myFaction) {
|
||||
if (!CmdFly.checkFly(fPlayer, player, Board.getInstance().getFactionAt(myFloc))) {
|
||||
fPlayer.setFFlying(false, false);
|
||||
CmdFly.flyMap.remove(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
public static BukkitTask positionTask = null;
|
||||
public final static Map<UUID, Location> lastLocations = new HashMap<>();
|
||||
|
||||
public void startPositionCheck() {
|
||||
positionTask = Bukkit.getScheduler().runTaskTimer(FactionsPlugin.getInstance(), () -> {
|
||||
if (lastLocations.isEmpty()) return;
|
||||
for (Map.Entry<UUID, Location> check : lastLocations.entrySet()) {
|
||||
Player player = Bukkit.getPlayer(check.getKey());
|
||||
if (player != null) {
|
||||
refreshPosition(player, check.getValue(), player.getLocation());
|
||||
lastLocations.put(player.getUniqueId(), player.getLocation());
|
||||
}
|
||||
}
|
||||
}, 5L, 10L);
|
||||
@@ -747,10 +730,16 @@ public class FactionsPlayerListener implements Listener {
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
this.checkCanFly(me);
|
||||
|
||||
checkCanFly(me);
|
||||
|
||||
Faction at = Board.getInstance().getFactionAt(new FLocation(me.getPlayer().getLocation()));
|
||||
if (me.getAutoClaimFor() != null) {
|
||||
me.attemptClaim(me.getAutoClaimFor(), newLocation, true);
|
||||
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);
|
||||
}
|
||||
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);
|
||||
} else if (me.isAutoSafeClaimEnabled()) {
|
||||
@@ -863,15 +852,12 @@ public class FactionsPlayerListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onInventorySee(InventoryClickEvent e) {
|
||||
if (e.getCurrentItem() == null)
|
||||
return;
|
||||
|
||||
if (!e.getView().getTitle().endsWith("'s Inventory"))
|
||||
return;
|
||||
|
||||
if (e.getCurrentItem() == null) return;
|
||||
if (!e.getView().getTitle().endsWith("'s Inventory")) return;
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerBoneMeal(PlayerInteractEvent event) {
|
||||
Block block = event.getClickedBlock();
|
||||
@@ -991,7 +977,7 @@ public class FactionsPlayerListener implements Listener {
|
||||
if (badGuy == null) return;
|
||||
|
||||
// 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();
|
||||
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.massivecraft.factions.missions;
|
||||
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.zcore.frame.FactionGUI;
|
||||
import com.massivecraft.factions.util.XMaterial;
|
||||
import com.massivecraft.factions.zcore.frame.FactionGUI;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
@@ -31,7 +31,17 @@ public class FInfoSidebar extends FSidebarProvider {
|
||||
|
||||
ListIterator<String> it = lines.listIterator();
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -11,10 +11,8 @@ import com.massivecraft.factions.util.XMaterial;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -22,7 +20,6 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ShopGUIFrame {
|
||||
@@ -49,14 +46,14 @@ public class ShopGUIFrame {
|
||||
for (int a = 1; a <= items; a++) {
|
||||
String s = a + "";
|
||||
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");
|
||||
String name = FactionsPlugin.getInstance().getFileManager().getShop().fetchString("items." + s + ".name");
|
||||
boolean glowing = FactionsPlugin.getInstance().getFileManager().getShop().fetchBoolean("items." + s + ".glowing");
|
||||
List<String> lore = FactionsPlugin.getInstance().getFileManager().getShop().fetchStringList("items." + s + ".lore");
|
||||
|
||||
|
||||
ItemStack item = new ItemStack(material);
|
||||
assert item != null;
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(FactionsPlugin.instance.color(name));
|
||||
meta.addItemFlags();
|
||||
|
||||
@@ -54,8 +54,10 @@ public enum Permission {
|
||||
FLY_TRUCE("fly.truce"),
|
||||
FLY_NEUTRAL("fly.neutral"),
|
||||
FOCUS("focus"),
|
||||
FRIENDLYFIRE("friendlyfire"),
|
||||
GLOBALCHAT("globalchat"),
|
||||
GRACE("grace"),
|
||||
GRACETOGGLE("gracetoggle"),
|
||||
HELP("help"),
|
||||
HOME("home"),
|
||||
INVITE("invite"),
|
||||
|
||||
@@ -149,10 +149,7 @@ public enum FactionTag implements Tag {
|
||||
if (!this.foundInString(text)) {
|
||||
return text;
|
||||
}
|
||||
String result = null;
|
||||
if (this.biFunction != null) {
|
||||
result = this.function == null ? this.biFunction.apply(faction, player) : this.function.apply(faction);
|
||||
}
|
||||
String result = this.function == null ? this.biFunction.apply(faction, player) : this.function.apply(faction);
|
||||
return result == null ? null : text.replace(this.tag, result);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ public enum FancyTag implements Tag {
|
||||
* @author FactionsUUID Team
|
||||
*/
|
||||
|
||||
NEUTRAL_LIST("{neutral-list}", (target, fme, prefix, gm) -> processRelation(prefix, target, fme, Relation.NEUTRAL)),
|
||||
ALLIES_LIST("{allies-list}", (target, fme, prefix, gm) -> processRelation(prefix, target, fme, Relation.ALLY)),
|
||||
ENEMIES_LIST("{enemies-list}", (target, fme, prefix, gm) -> processRelation(prefix, target, fme, Relation.ENEMY)),
|
||||
TRUCES_LIST("{truces-list}", (target, fme, prefix, gm) -> processRelation(prefix, target, fme, Relation.TRUCE)),
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.massivecraft.factions.tag;
|
||||
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.util.timer.TimerManager;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
@@ -12,7 +13,7 @@ public enum GeneralTag implements Tag {
|
||||
/**
|
||||
* @author FactionsUUID Team
|
||||
*/
|
||||
|
||||
GRACE_TIMER("{grace-time}", () -> String.valueOf(TimerManager.getRemaining(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining(), true))),
|
||||
MAX_WARPS("{max-warps}", () -> String.valueOf(FactionsPlugin.getInstance().getConfig().getInt("max-warps", 5))),
|
||||
MAX_ALLIES("{max-allies}", () -> getRelation("ally")),
|
||||
MAX_ENEMIES("{max-enemies}", () -> getRelation("enemy")),
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.massivecraft.factions.tag;
|
||||
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.apache.commons.lang.time.DurationFormatUtils;
|
||||
@@ -16,19 +15,13 @@ public enum PlayerTag implements Tag {
|
||||
/**
|
||||
* @author FactionsUUID Team
|
||||
*/
|
||||
GROUP("{group}", (fp) -> {
|
||||
if (fp.isOnline()) {
|
||||
return FactionsPlugin.getInstance().getPrimaryGroup(fp.getPlayer());
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}),
|
||||
LAST_SEEN("{lastSeen}", (fp) -> {
|
||||
String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fp.getLastLoginTime(), true, true) + TL.COMMAND_STATUS_AGOSUFFIX;
|
||||
return fp.isOnline() ? ChatColor.GREEN + TL.COMMAND_STATUS_ONLINE.toString() : (System.currentTimeMillis() - fp.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized);
|
||||
}),
|
||||
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())),
|
||||
ROLE("{player-role}", FPlayer::getRolePrefix),
|
||||
PLAYER_MAXPOWER("{player-maxpower}", (fp) -> String.valueOf(fp.getPowerMaxRounded())),
|
||||
PLAYER_KILLS("{player-kills}", (fp) -> String.valueOf(fp.getKills())),
|
||||
PLAYER_DEATHS("{player-deaths}", (fp) -> String.valueOf(fp.getDeaths())),
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.tag.FactionTag;
|
||||
import com.massivecraft.factions.tag.Tag;
|
||||
import com.massivecraft.factions.util.timer.TimerManager;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import me.clip.placeholderapi.expansion.Relational;
|
||||
@@ -13,7 +14,10 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements Relational {
|
||||
|
||||
@@ -209,16 +213,45 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
|
||||
return String.valueOf(faction.getMaxVaults());
|
||||
case "faction_relation_color":
|
||||
return fPlayer.getColorTo(faction).toString();
|
||||
case "faction_grace":
|
||||
return Conf.gracePeriod ? "Enabled" : "Disabled";
|
||||
case "grace_time":
|
||||
if(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining() >= 0) {
|
||||
return String.valueOf(TimerManager.getRemaining(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining(), true));
|
||||
} else {
|
||||
return TL.GRACE_DISABLED_PLACEHOLDER.toString();
|
||||
}
|
||||
case "faction_name_at_location":
|
||||
Faction factionAtLocation = Board.getInstance().getFactionAt(new FLocation(player.getLocation()));
|
||||
return factionAtLocation != null ? factionAtLocation.getTag() : Factions.getInstance().getWilderness().getTag();
|
||||
}
|
||||
//If its not hardcoded lets try to grab it anyways
|
||||
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 null;
|
||||
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) {
|
||||
int count = 0;
|
||||
|
||||
82
src/main/java/com/massivecraft/factions/util/Config.java
Normal file
82
src/main/java/com/massivecraft/factions/util/Config.java
Normal file
@@ -0,0 +1,82 @@
|
||||
package com.massivecraft.factions.util;
|
||||
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Factions - Developed by Driftay.
|
||||
* All rights reserved 2020.
|
||||
* Creation Date: 4/7/2020
|
||||
*/
|
||||
public class Config extends YamlConfiguration {
|
||||
private String fileName;
|
||||
private FactionsPlugin plugin;
|
||||
|
||||
public Config(FactionsPlugin plugin, String fileName) {
|
||||
this(plugin, fileName, ".yml");
|
||||
}
|
||||
|
||||
public Config(FactionsPlugin plugin, String fileName, String fileExtension) {
|
||||
this.plugin = plugin;
|
||||
this.fileName = fileName + (fileName.endsWith(fileExtension) ? "" : fileExtension);
|
||||
this.createFile();
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return this.fileName;
|
||||
}
|
||||
|
||||
public FactionsPlugin getPlugin() {
|
||||
return this.plugin;
|
||||
}
|
||||
|
||||
private void createFile() {
|
||||
File folder = this.plugin.getDataFolder();
|
||||
try {
|
||||
File ex = new File(folder, this.fileName);
|
||||
if (!ex.exists()) {
|
||||
if (this.plugin.getResource(this.fileName) != null) {
|
||||
this.plugin.saveResource(this.fileName, false);
|
||||
} else {
|
||||
this.save(ex);
|
||||
}
|
||||
} else {
|
||||
this.load(ex);
|
||||
this.save(ex);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void save() {
|
||||
File folder = this.plugin.getDataFolder();
|
||||
try {
|
||||
this.save(new File(folder, this.fileName));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof Config)) {
|
||||
return false;
|
||||
}
|
||||
Config config = (Config) o;
|
||||
if (this.fileName != null) {
|
||||
if (this.fileName.equals(config.fileName)) {
|
||||
return Objects.equals(this.plugin, config.plugin);
|
||||
}
|
||||
} else if (config.fileName == null) {
|
||||
return Objects.equals(this.plugin, config.plugin);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
27
src/main/java/com/massivecraft/factions/util/Cooldown.java
Normal file
27
src/main/java/com/massivecraft/factions/util/Cooldown.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.massivecraft.factions.util;
|
||||
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Factions - Developed by Driftay.
|
||||
* All rights reserved 2020.
|
||||
* Creation Date: 4/6/2020
|
||||
*/
|
||||
public class Cooldown {
|
||||
|
||||
public static void setCooldown(Player player, String name, int seconds) {
|
||||
player.setMetadata(name, new FixedMetadataValue(FactionsPlugin.getInstance(), System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(seconds)));
|
||||
}
|
||||
|
||||
public static boolean isOnCooldown(Player player, String name) {
|
||||
if (!player.hasMetadata(name) || player.getMetadata(name).size() <= 0) return false;
|
||||
long time = player.getMetadata(name).get(0).asLong();
|
||||
return (time > System.currentTimeMillis());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.massivecraft.factions.util;
|
||||
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@@ -26,7 +27,9 @@ public class CornerTask extends BukkitRunnable {
|
||||
cancel();
|
||||
} else {
|
||||
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;
|
||||
} else {
|
||||
fPlayer.sendMessage(TL.COMMAND_CORNER_FAIL_WITH_FEEDBACK.toString().replace("&", "§") + amount);
|
||||
|
||||
@@ -85,6 +85,7 @@ public class MiscUtil {
|
||||
for (char c : str.toCharArray()) {
|
||||
if (!substanceChars.contains(String.valueOf(c))) {
|
||||
errors.add(FactionsPlugin.getInstance().txt.parse(TL.GENERIC_FACTIONTAG_ALPHANUMERIC.toString(), c));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ package com.massivecraft.factions.util;
|
||||
* All rights reserved 2020.
|
||||
* Creation Date: 4/4/2020
|
||||
*/
|
||||
import com.massivecraft.factions.util.XMaterial;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
|
||||
@@ -5,6 +5,7 @@ package com.massivecraft.factions.util;
|
||||
* All rights reserved 2020.
|
||||
* Creation Date: 4/4/2020
|
||||
*/
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
@@ -15,8 +15,6 @@ public class UtilFly {
|
||||
*/
|
||||
@Deprecated
|
||||
public static void run() {
|
||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight"))
|
||||
return;
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(FactionsPlugin.getInstance(), () -> {
|
||||
for (FPlayer fp : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
@@ -28,8 +26,6 @@ public class UtilFly {
|
||||
|
||||
@Deprecated
|
||||
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().setFlying(fly);
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.massivecraft.factions.util.timer;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import org.apache.commons.lang.time.FastDateFormat;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
* Factions - Developed by Driftay.
|
||||
* All rights reserved 2020.
|
||||
* Creation Date: 4/7/2020
|
||||
*/
|
||||
public final class DateTimeFormats {
|
||||
public static final TimeZone SERVER_TIME_ZONE = TimeZone.getTimeZone(Conf.serverTimeZone);
|
||||
public static final ZoneId SERVER_ZONE_ID = SERVER_TIME_ZONE.toZoneId();
|
||||
public static final FastDateFormat DAY_MTH_HR_MIN_SECS = FastDateFormat.getInstance("dd/MM HH:mm:ss", SERVER_TIME_ZONE, Locale.ENGLISH);
|
||||
public static final FastDateFormat DAY_MTH_YR_HR_MIN_AMPM = FastDateFormat.getInstance("dd/MM/yy hh:mma", SERVER_TIME_ZONE, Locale.ENGLISH);
|
||||
public static final FastDateFormat DAY_MTH_HR_MIN_AMPM = FastDateFormat.getInstance("dd/MM hh:mma", SERVER_TIME_ZONE, Locale.ENGLISH);
|
||||
public static final FastDateFormat HR_MIN_AMPM = FastDateFormat.getInstance("hh:mma", SERVER_TIME_ZONE, Locale.ENGLISH);
|
||||
public static final FastDateFormat HR_MIN_AMPM_TIMEZONE = FastDateFormat.getInstance("hh:mma z", SERVER_TIME_ZONE, Locale.ENGLISH);
|
||||
public static final FastDateFormat HR_MIN = FastDateFormat.getInstance("hh:mm", SERVER_TIME_ZONE, Locale.ENGLISH);
|
||||
public static final FastDateFormat MIN_SECS = FastDateFormat.getInstance("mm:ss", SERVER_TIME_ZONE, Locale.ENGLISH);
|
||||
public static final ThreadLocal<DecimalFormat> SECONDS = ThreadLocal.withInitial(() -> new DecimalFormat("0"));
|
||||
public static final ThreadLocal<DecimalFormat> REMAINING_SECONDS = ThreadLocal.withInitial(() -> new DecimalFormat("0.#"));
|
||||
public static final ThreadLocal<DecimalFormat> REMAINING_SECONDS_TRAILING = ThreadLocal.withInitial(() -> new DecimalFormat("0.0"));
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.massivecraft.factions.util.timer;
|
||||
|
||||
import com.massivecraft.factions.util.Config;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Factions - Developed by Driftay.
|
||||
* All rights reserved 2020.
|
||||
* Creation Date: 4/7/2020
|
||||
*/
|
||||
public abstract class GlobalTimer extends Timer {
|
||||
private TimerRunnable runnable;
|
||||
|
||||
|
||||
public GlobalTimer(String name, long defaultCooldown) {
|
||||
super(name, defaultCooldown);
|
||||
}
|
||||
|
||||
|
||||
public boolean clearCooldown() {
|
||||
if (this.runnable != null) {
|
||||
this.runnable.cancel();
|
||||
this.runnable = null;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public boolean isPaused() {
|
||||
return (this.runnable != null) && (this.runnable.isPaused());
|
||||
}
|
||||
|
||||
|
||||
public void setPaused(boolean paused) {
|
||||
if ((this.runnable != null) && (this.runnable.isPaused() != paused)) {
|
||||
this.runnable.setPaused(paused);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public long getRemaining() {
|
||||
return this.runnable == null ? 0L : this.runnable.getRemaining();
|
||||
}
|
||||
|
||||
public long getRemaining(long now) {
|
||||
return this.runnable == null ? 0L : this.runnable.getRemaining(now);
|
||||
}
|
||||
|
||||
|
||||
public boolean setRemaining() {
|
||||
return setRemaining(this.defaultCooldown, false);
|
||||
}
|
||||
|
||||
|
||||
public boolean setRemaining(long duration, boolean overwrite) {
|
||||
boolean hadCooldown = false;
|
||||
if (this.runnable != null) {
|
||||
if (!overwrite) {
|
||||
return false;
|
||||
}
|
||||
hadCooldown = this.runnable.getRemaining() > 0L;
|
||||
this.runnable.setRemaining(duration);
|
||||
} else {
|
||||
this.runnable = new TimerRunnable(this, duration);
|
||||
}
|
||||
return !hadCooldown;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.massivecraft.factions.util.timer;
|
||||
|
||||
import com.massivecraft.factions.util.Config;
|
||||
|
||||
/**
|
||||
* Factions - Developed by Driftay.
|
||||
* All rights reserved 2020.
|
||||
* Creation Date: 4/7/2020
|
||||
*/
|
||||
public abstract class Timer {
|
||||
protected final String name;
|
||||
public final long defaultCooldown;
|
||||
|
||||
|
||||
public Timer(String name, long defaultCooldown) {
|
||||
this.name = name;
|
||||
this.defaultCooldown = defaultCooldown;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void load(Config config) {
|
||||
}
|
||||
|
||||
|
||||
public void save(Config config) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.massivecraft.factions.util.timer;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.util.Config;
|
||||
import com.massivecraft.factions.util.timer.type.GraceTimer;
|
||||
import org.apache.commons.lang.time.DurationFormatUtils;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Factions - Developed by Driftay.
|
||||
* All rights reserved 2020.
|
||||
* Creation Date: 4/7/2020
|
||||
*/
|
||||
public class TimerManager implements Listener, Runnable {
|
||||
private final Set<Timer> timers;
|
||||
private final FactionsPlugin plugin;
|
||||
private final List<TimerRunnable> timerRunnableList = new ArrayList<>();
|
||||
private Config config;
|
||||
public GraceTimer graceTimer;
|
||||
private static final long MINUTE = TimeUnit.MINUTES.toMillis(1L);
|
||||
private static final long HOUR = TimeUnit.HOURS.toMillis(1L);
|
||||
private static final long MULTI_HOUR = TimeUnit.HOURS.toMillis(10);
|
||||
|
||||
public static String getRemaining(long millis, boolean milliseconds) {
|
||||
return getRemaining(millis, milliseconds, true);
|
||||
}
|
||||
|
||||
public static String getRemaining(long duration, boolean milliseconds, boolean trail) {
|
||||
if ((milliseconds) && (duration < MINUTE)) {
|
||||
return ( (trail ? DateTimeFormats.REMAINING_SECONDS_TRAILING : DateTimeFormats.REMAINING_SECONDS).get()).format(duration * 0.001D) + 's';
|
||||
}
|
||||
return DurationFormatUtils.formatDuration(duration, (duration >= HOUR ? (duration >= MULTI_HOUR ? "d" : "") + "d:" : "") + "HH:mm:ss");
|
||||
}
|
||||
|
||||
public TimerManager(FactionsPlugin plugin) {
|
||||
this.timers = new HashSet<>();
|
||||
this.plugin = plugin;
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
if(Conf.useGraceSystem) {
|
||||
this.registerTimer(this.graceTimer = new GraceTimer());
|
||||
}
|
||||
plugin.getServer().getScheduler().runTaskTimer(plugin, this, 4, 4);
|
||||
}
|
||||
|
||||
public Collection<Timer> getTimers() {
|
||||
return this.timers;
|
||||
}
|
||||
|
||||
public void registerTimer(Timer timer) {
|
||||
this.timers.add(timer);
|
||||
if (timer instanceof Listener) {
|
||||
this.plugin.getServer().getPluginManager().registerEvents((Listener) timer, this.plugin);
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterTimer(Timer timer) {
|
||||
this.timers.remove(timer);
|
||||
}
|
||||
|
||||
public void reloadTimerData() {
|
||||
this.config = new Config(this.plugin, "timers");
|
||||
for (Timer timer : this.timers) {
|
||||
timer.load(this.config);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveTimerData() {
|
||||
for (Timer timer : this.timers) {
|
||||
timer.save(this.config);
|
||||
}
|
||||
this.config.save();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
long now = System.currentTimeMillis();
|
||||
timerRunnableList.removeIf(next -> next.check(now));
|
||||
}
|
||||
|
||||
public List<TimerRunnable> getTimerRunnableList() {
|
||||
return timerRunnableList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.massivecraft.factions.util.timer;
|
||||
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Factions - Developed by Driftay.
|
||||
* All rights reserved 2020.
|
||||
* Creation Date: 4/7/2020
|
||||
*/
|
||||
|
||||
public class TimerRunnable {
|
||||
private final Timer timer;
|
||||
private long expiryMillis;
|
||||
private long pauseMillis;
|
||||
private boolean cancelled = false;
|
||||
|
||||
|
||||
public TimerRunnable(Timer timer, long duration) {
|
||||
this.timer = timer;
|
||||
setRemaining(duration);
|
||||
FactionsPlugin plugin = FactionsPlugin.getInstance();
|
||||
plugin.getTimerManager().getTimerRunnableList().add(this);
|
||||
}
|
||||
|
||||
|
||||
public TimerRunnable(UUID playerUUID, Timer timer, long duration) {
|
||||
this.timer = timer;
|
||||
setRemaining(duration);
|
||||
FactionsPlugin plugin = FactionsPlugin.getInstance();
|
||||
plugin.getTimerManager().getTimerRunnableList().add(this);
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
public Timer getTimer() {
|
||||
return this.timer;
|
||||
}
|
||||
|
||||
|
||||
public long getRemaining() {
|
||||
return getRemaining(false);
|
||||
}
|
||||
|
||||
public long getRemaining(long now) {
|
||||
return getRemaining(false, now);
|
||||
}
|
||||
|
||||
|
||||
public void setRemaining(long remaining) {
|
||||
setExpiryMillis(remaining);
|
||||
}
|
||||
|
||||
|
||||
public long getRemaining(boolean ignorePaused) {
|
||||
if ((!ignorePaused) && (this.pauseMillis != 0L)) return this.pauseMillis;
|
||||
return this.expiryMillis - System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public long getRemaining(boolean ignorePaused, long now) {
|
||||
if ((!ignorePaused) && (this.pauseMillis != 0L)) return this.pauseMillis;
|
||||
return this.expiryMillis - now;
|
||||
}
|
||||
|
||||
|
||||
public long getExpiryMillis() {
|
||||
return this.expiryMillis;
|
||||
}
|
||||
|
||||
|
||||
private void setExpiryMillis(long remainingMillis) {
|
||||
long expiryMillis = System.currentTimeMillis() + remainingMillis;
|
||||
if (expiryMillis == this.expiryMillis) return;
|
||||
this.expiryMillis = expiryMillis;
|
||||
}
|
||||
|
||||
public boolean check(long now) {
|
||||
if (cancelled) return true;
|
||||
return getRemaining(false, now) <= 0;
|
||||
}
|
||||
|
||||
|
||||
public long getPauseMillis() {
|
||||
return this.pauseMillis;
|
||||
}
|
||||
|
||||
|
||||
public void setPauseMillis(long pauseMillis) {
|
||||
this.pauseMillis = pauseMillis;
|
||||
}
|
||||
|
||||
|
||||
public boolean isPaused() {
|
||||
return this.pauseMillis != 0L;
|
||||
}
|
||||
|
||||
|
||||
public void setPaused(boolean paused) {
|
||||
if (paused == isPaused()) return;
|
||||
|
||||
if (paused) {
|
||||
this.pauseMillis = getRemaining(true);
|
||||
cancel();
|
||||
} else {
|
||||
setExpiryMillis(this.pauseMillis);
|
||||
this.pauseMillis = 0L;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void cancel() {
|
||||
cancelled = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.massivecraft.factions.util.timer.type;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.util.Config;
|
||||
import com.massivecraft.factions.util.timer.GlobalTimer;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Factions - Developed by Driftay.
|
||||
* All rights reserved 2020.
|
||||
* Creation Date: 4/7/2020
|
||||
*/
|
||||
public class GraceTimer extends GlobalTimer implements Listener {
|
||||
|
||||
public GraceTimer() {
|
||||
super("GRACE", TimeUnit.DAYS.toMillis(Conf.gracePeriodTimeDays));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBreak(EntityExplodeEvent e) {
|
||||
if(getRemaining() > 0)
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTNTPlace(BlockPlaceEvent event) {
|
||||
FPlayer fp = FPlayers.getInstance().getByPlayer(event.getPlayer());
|
||||
if(getRemaining() > 0) {
|
||||
if (!fp.isAdminBypassing()) {
|
||||
if (event.getBlock().getType().equals(Material.TNT)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(Config config) {
|
||||
setPaused(config.getBoolean(this.name + ".paused"));
|
||||
setRemaining(config.getLong(this.name + ".time"), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(Config config) {
|
||||
config.set(this.name + ".paused", isPaused());
|
||||
config.set(this.name + ".time", getRemaining());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,13 +8,11 @@ import org.bukkit.entity.Player;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* Factions - Developed by Driftay.
|
||||
* All rights reserved 2020.
|
||||
* Creation Date: 4/4/2020
|
||||
* @author DroppingAnvil
|
||||
*/
|
||||
public class WaitExecutor {
|
||||
private static boolean enabled = false;
|
||||
public static ConcurrentHashMap<Player, WaitTask> taskMap = new ConcurrentHashMap<>();
|
||||
private static boolean enabled = false;
|
||||
|
||||
public static void startTask() {
|
||||
if (enabled) return;
|
||||
|
||||
@@ -25,6 +25,10 @@ public class WaitTask {
|
||||
return wait;
|
||||
}
|
||||
|
||||
public void setWait(Integer i) {
|
||||
wait = i;
|
||||
}
|
||||
|
||||
public TL getMessage() {
|
||||
return msg;
|
||||
}
|
||||
@@ -33,10 +37,6 @@ public class WaitTask {
|
||||
return player;
|
||||
}
|
||||
|
||||
public void setWait(Integer i) {
|
||||
wait = i;
|
||||
}
|
||||
|
||||
public void success() {
|
||||
origin.handleSuccess(player);
|
||||
}
|
||||
|
||||
@@ -3,10 +3,7 @@ package com.massivecraft.factions.zcore;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.zcore.persist.SaveTask;
|
||||
import com.massivecraft.factions.zcore.util.PermUtil;
|
||||
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.command.CommandSender;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.IllegalPluginAccessException;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
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
|
||||
saveTask = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new SaveTask(this), saveTicks, saveTicks);
|
||||
}
|
||||
|
||||
loadLang();
|
||||
|
||||
loadSuccessful = true;
|
||||
return true;
|
||||
}
|
||||
@@ -178,20 +172,18 @@ public abstract class MPlugin extends JavaPlugin {
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
try {
|
||||
if (saveTask != null) {
|
||||
this.getServer().getScheduler().cancelTask(saveTask);
|
||||
saveTask = null;
|
||||
}
|
||||
// only save data if plugin actually loaded successfully
|
||||
if (loadSuccessful) {
|
||||
Factions.getInstance().forceSave();
|
||||
FPlayers.getInstance().forceSave();
|
||||
Board.getInstance().forceSave();
|
||||
}
|
||||
log("Disabled");
|
||||
} catch (IllegalPluginAccessException e) {
|
||||
if (saveTask != null) {
|
||||
this.getServer().getScheduler().cancelTask(saveTask);
|
||||
saveTask = null;
|
||||
}
|
||||
// only save data if plugin actually loaded successfully
|
||||
if (loadSuccessful) {
|
||||
Factions.getInstance().forceSave();
|
||||
FPlayers.getInstance().forceSave();
|
||||
Board.getInstance().forceSave();
|
||||
}
|
||||
|
||||
log("Disabled");
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
|
||||
@@ -28,7 +28,7 @@ public class FDisbandFrame {
|
||||
private Gui gui;
|
||||
|
||||
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) {
|
||||
|
||||
@@ -28,42 +28,35 @@ public class FUpgradeFrame {
|
||||
public FUpgradeFrame(Faction f) {
|
||||
this.gui = new Gui(FactionsPlugin.getInstance(),
|
||||
FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Rows", 5),
|
||||
ChatColor.translateAlternateColorCodes('&', Objects.requireNonNull(FactionsPlugin.getInstance().getConfig()
|
||||
.getString("fupgrades.MainMenu.Title")).replace("{faction}", f.getTag())));
|
||||
ChatColor.translateAlternateColorCodes('&', FactionsPlugin.getInstance().getConfig()
|
||||
.getString("fupgrades.MainMenu.Title").replace("{faction}", f.getTag())));
|
||||
}
|
||||
|
||||
public void buildGUI(FPlayer fplayer) {
|
||||
PaginatedPane pane = new PaginatedPane(0, 0, 9, this.gui.getRows());
|
||||
List<GuiItem> GUIItems = new ArrayList<>();
|
||||
ItemStack dummy = buildDummyItem();
|
||||
for (int x = 0; x <= this.gui.getRows() * 9 - 1; ++x)
|
||||
GUIItems.add(new GuiItem(dummy, (e) -> e.setCancelled(true)));
|
||||
|
||||
for (int x = 0; x <= this.gui.getRows() * 9 - 1; ++x) GUIItems.add(new GuiItem(dummy, e -> e.setCancelled(true)));
|
||||
for (UpgradeType value : UpgradeType.values()) {
|
||||
if (value.getSlot() != -1) {
|
||||
GUIItems.set(value.getSlot(), new GuiItem(value.buildAsset(fplayer.getFaction()), (e) -> {
|
||||
GUIItems.set(value.getSlot(), new GuiItem(value.buildAsset(fplayer.getFaction()), e -> {
|
||||
e.setCancelled(true);
|
||||
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getWhoClicked());
|
||||
if (fme.getFaction().getUpgrade(value) != value.getMaxLevel()) {
|
||||
int cost = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu." + value.toString() + ".Cost.level-" + (fme.getFaction().getUpgrade(value) + 1));
|
||||
if (fme.getFaction().getUpgrade(value) == value.getMaxLevel()) return;
|
||||
int cost = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu." + value.toString() + ".Cost.level-" + (fme.getFaction().getUpgrade(value) + 1));
|
||||
if (fme.hasMoney(cost)) {
|
||||
fme.takeMoney(cost);
|
||||
if (value == UpgradeType.CHEST)
|
||||
updateChests(fme.getFaction());
|
||||
if (value == UpgradeType.CHEST) updateChests(fme.getFaction());
|
||||
|
||||
if (value == UpgradeType.POWER)
|
||||
updateFactionPowerBoost(fme.getFaction());
|
||||
if (value == UpgradeType.POWER) updateFactionPowerBoost(fme.getFaction());
|
||||
|
||||
if (value == UpgradeType.TNT)
|
||||
updateTNT(fme.getFaction());
|
||||
if (value == UpgradeType.TNT) updateTNT(fme.getFaction());
|
||||
|
||||
if (value == UpgradeType.WARP)
|
||||
updateWarps(fme.getFaction());
|
||||
if (value == UpgradeType.WARP) updateWarps(fme.getFaction());
|
||||
|
||||
fme.getFaction().setUpgrade(value, fme.getFaction().getUpgrade(value) + 1);
|
||||
this.buildGUI(fme);
|
||||
buildGUI(fme);
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,18 +22,18 @@ public enum UpgradeType {
|
||||
* @author Illyria Team
|
||||
*/
|
||||
|
||||
CHEST("Chest", 3),
|
||||
SPAWNER("Spawners", 3),
|
||||
EXP("EXP", 3),
|
||||
CROP("Crops", 3),
|
||||
POWER("Power", 3),
|
||||
REDSTONE("Redstone", 1),
|
||||
MEMBERS("Members", 3),
|
||||
TNT("TNT", 3),
|
||||
WARP("Warps", 3),
|
||||
DAMAGEINCREASE("DamageIncrease", 3),
|
||||
DAMAGEDECREASE("DamageReduct", 3),
|
||||
REINFORCEDARMOR("Armor", 3);
|
||||
CHEST("Chest", FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Chest.Max-Level")),
|
||||
SPAWNER("Spawners", FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Spawners.Max-Level")),
|
||||
EXP("EXP", FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.EXP.Max-Level")),
|
||||
CROP("Crops", FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Crops.Max-Level")),
|
||||
POWER("Power", FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Power.Max-Level")),
|
||||
REDSTONE("Redstone", FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Redstone.Max-Level")),
|
||||
MEMBERS("Members", FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Members.Max-Level")),
|
||||
TNT("TNT", FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.TNT.Max-Level")),
|
||||
WARP("Warps", FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Warps.Max-Level")),
|
||||
DAMAGEINCREASE("DamageIncrease", FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.DamageIncrease.Max-Level")),
|
||||
DAMAGEDECREASE("DamageReduct", FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.DamageReduct.Max-Level")),
|
||||
REINFORCEDARMOR("Armor", FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Armor.Max-Level"));
|
||||
|
||||
private String id;
|
||||
private int maxLevel;
|
||||
@@ -86,7 +86,6 @@ public enum UpgradeType {
|
||||
private ItemStack updateLevelStatus(ItemStack item, int level) {
|
||||
if (level >= 1) {
|
||||
item.setAmount(level);
|
||||
enchant(item);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -25,22 +25,22 @@ public class UpgradesListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public static void onDamageReduction(EntityDamageByEntityEvent e) {
|
||||
if (e.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
if (!(e.getDamager() instanceof Player) || !(e.getEntity() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
if (e.isCancelled()) return;
|
||||
|
||||
if (!(e.getDamager() instanceof Player) || !(e.getEntity() instanceof Player)) return;
|
||||
if(e.getEntity() == null) return;
|
||||
|
||||
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getEntity());
|
||||
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());
|
||||
|
||||
if(floc == null) return;
|
||||
|
||||
if (Board.getInstance().getFactionAt(floc) == fme.getFaction()) {
|
||||
if (dame.getFaction() == fme.getFaction()) {
|
||||
return;
|
||||
}
|
||||
if (dame.getFaction() == fme.getFaction()) return;
|
||||
|
||||
double damage = e.getDamage();
|
||||
int level = fme.getFaction().getUpgrade(UpgradeType.DAMAGEDECREASE);
|
||||
double increase = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.DamageReduction.DamageReductionPercent.level-" + level);
|
||||
@@ -50,20 +50,17 @@ public class UpgradesListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public static void onDamageIncrease(EntityDamageByEntityEvent e) {
|
||||
if (e == null) {
|
||||
return;
|
||||
}
|
||||
if (!(e.getDamager() instanceof Player) || !(e.getEntity() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
if (e == null) return;
|
||||
|
||||
if (!(e.getDamager() instanceof Player) || !(e.getEntity() instanceof Player)) return;
|
||||
|
||||
|
||||
if (e.getDamager().hasMetadata("NPC") || e.getEntity().hasMetadata("NPC")) return;
|
||||
|
||||
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getEntity());
|
||||
FPlayer dame = FPlayers.getInstance().getByPlayer((Player) e.getDamager());
|
||||
if (fme == null || dame == null) {
|
||||
return;
|
||||
}
|
||||
if (fme == null || dame == null) return;
|
||||
|
||||
|
||||
FLocation floc = new FLocation(fme.getPlayer().getLocation());
|
||||
|
||||
@@ -87,9 +84,8 @@ public class UpgradesListener implements Listener {
|
||||
@EventHandler
|
||||
public void onDeath(EntityDeathEvent e) {
|
||||
Entity killer = e.getEntity().getKiller();
|
||||
if (killer == null || !(killer instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
if (killer == null || !(killer instanceof Player)) return;
|
||||
|
||||
FLocation floc = new FLocation(e.getEntity().getLocation());
|
||||
Faction faction = Board.getInstance().getFactionAt(floc);
|
||||
if (!faction.isWilderness()) {
|
||||
@@ -112,9 +108,7 @@ public class UpgradesListener implements Listener {
|
||||
Faction factionAtLoc = Board.getInstance().getFactionAt(floc);
|
||||
if (!factionAtLoc.isWilderness()) {
|
||||
int level = factionAtLoc.getUpgrade(UpgradeType.SPAWNER);
|
||||
if (level == 0) {
|
||||
return;
|
||||
}
|
||||
if (level == 0) return;
|
||||
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()) {
|
||||
int level = factionAtLoc.getUpgrade(UpgradeType.CROP);
|
||||
int chance = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-" + level);
|
||||
if (level == 0 || chance == 0) {
|
||||
return;
|
||||
}
|
||||
if (level == 0 || chance == 0) return;
|
||||
|
||||
int randomNum = ThreadLocalRandom.current().nextInt(1, 101);
|
||||
if (randomNum <= chance) {
|
||||
this.growCrop(e);
|
||||
}
|
||||
if (randomNum <= chance) this.growCrop(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,21 +164,16 @@ public class UpgradesListener implements Listener {
|
||||
if (!factionAtLoc.isWilderness()) {
|
||||
int level = factionAtLoc.getUpgrade(UpgradeType.REDSTONE);
|
||||
if (level != 0) {
|
||||
if (level == 1) {
|
||||
FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Redstone.Cost");
|
||||
}
|
||||
if (unbreakable.contains(block)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
if (level == 1) FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Redstone.Cost");
|
||||
if (unbreakable.contains(block)) e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onArmorDamage(PlayerItemDamageEvent e) {
|
||||
if (FPlayers.getInstance().getByPlayer(e.getPlayer()) == null) {
|
||||
return;
|
||||
}
|
||||
if (FPlayers.getInstance().getByPlayer(e.getPlayer()) == null) 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")) {
|
||||
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);
|
||||
|
||||
@@ -40,7 +40,8 @@ public class FactionWarpsFrame {
|
||||
int count = 0;
|
||||
for (int x = 0; x <= gui.getRows() * 9 - 1; ++x)
|
||||
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()) {
|
||||
if (slots.size() < fplayer.getFaction().getWarps().entrySet().size()) {
|
||||
slots.add(slots.get(slots.size() - 1) + 1);
|
||||
|
||||
@@ -90,6 +90,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
protected boolean titlesEnabled = true;
|
||||
protected boolean isAlt = false;
|
||||
boolean inspectMode = false;
|
||||
boolean friendlyFire = false;
|
||||
|
||||
public MemoryFPlayer() {
|
||||
}
|
||||
@@ -662,25 +663,34 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
public void updatePower() {
|
||||
if (this.isOffline()) {
|
||||
losePowerFromBeingOffline();
|
||||
if (!Conf.powerRegenOffline) return;
|
||||
if (!Conf.powerRegenOffline) {
|
||||
return;
|
||||
}
|
||||
} else if (hasFaction() && getFaction().isPowerFrozen()) {
|
||||
return; // Don't let power regen if faction power is frozen.
|
||||
}
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
this.millisPassed = now - this.lastPowerUpdateTime;
|
||||
long millisPassed = now - this.lastPowerUpdateTime;
|
||||
this.lastPowerUpdateTime = now;
|
||||
|
||||
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
|
||||
PowerRegenEvent powerRegenEvent = new PowerRegenEvent(getFaction(), this);
|
||||
Bukkit.getScheduler().runTask(FactionsPlugin.getInstance(), () -> Bukkit.getServer().getPluginManager().callEvent(powerRegenEvent));
|
||||
}
|
||||
|
||||
if (!powerRegenEvent.isCancelled())
|
||||
if (!powerRegenEvent.usingCustomPower())
|
||||
this.alterPower(millisPassed * Conf.powerPerMinute / 60000); // millisPerMinute : 60 * 1000
|
||||
else this.alterPower(+powerRegenEvent.getCustomPower());
|
||||
double delta = millisPassed * Conf.powerPerMinute / 60000; // millisPerMinute : 60 * 1000
|
||||
if (Bukkit.getPluginManager().getPlugin("FactionsPlugin") != null) {
|
||||
Bukkit.getScheduler().runTask(FactionsPlugin.getInstance(), () -> {
|
||||
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() {
|
||||
@@ -727,12 +737,13 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
|
||||
public void sendFactionHereMessage(Faction from) {
|
||||
Faction toShow = Board.getInstance().getFactionAt(getLastStoodAt());
|
||||
boolean showChat = true;
|
||||
|
||||
if(Conf.worldsNoClaiming.contains(getLastStoodAt().getWorldName())) return;
|
||||
|
||||
if (showInfoBoard(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))));
|
||||
}
|
||||
|
||||
@@ -817,7 +828,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
if (myFaction.isNormal() && !perm && myFaction.getFPlayers().isEmpty()) {
|
||||
// Remove this faction
|
||||
|
||||
if(FactionsPlugin.getInstance().getConfig().getBoolean("faction-disband-broadcast")) {
|
||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("faction-disband-broadcast")) {
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers())
|
||||
fplayer.msg(TL.LEAVE_DISBANDED, myFaction.describeTo(fplayer, true));
|
||||
}
|
||||
@@ -841,80 +852,79 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
}
|
||||
|
||||
public boolean canClaimForFactionAtLocation(Faction forFaction, FLocation flocation, boolean notifyFailure) {
|
||||
FactionsPlugin plugin = FactionsPlugin.getInstance();
|
||||
String error = null;
|
||||
Faction myFaction = getFaction();
|
||||
Faction currentFaction = Board.getInstance().getFactionAt(flocation);
|
||||
int ownedLand = forFaction.getLandRounded();
|
||||
int factionBuffer = FactionsPlugin.getInstance().getConfig().getInt("hcf.buffer-zone", 0);
|
||||
int worldBuffer = FactionsPlugin.getInstance().getConfig().getInt("world-border.buffer", 0);
|
||||
int factionBuffer = plugin.getConfig().getInt("hcf.buffer-zone", 0);
|
||||
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
|
||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_PROTECTED.toString());
|
||||
} else if (flocation.isOutsideWorldBorder(FactionsPlugin.getInstance().getConfig().getInt("world-border.buffer", 0))) {
|
||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString());
|
||||
} else if (Conf.useWorldConfigurationsAsWhitelist != Conf.worldsNoClaiming.contains(flocation.getWorldName())) {
|
||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_DISABLED.toString());
|
||||
error = plugin.txt.parse(TL.CLAIM_PROTECTED.toString());
|
||||
} else if (flocation.isOutsideWorldBorder(plugin.getConfig().getInt("world-border.buffer", 0) - 1)) {
|
||||
error = plugin.txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString());
|
||||
} else if (Conf.worldsNoClaiming.contains(flocation.getWorldName())) {
|
||||
error = plugin.txt.parse(TL.CLAIM_DISABLED.toString());
|
||||
} else if (this.isAdminBypassing()) {
|
||||
return true;
|
||||
} else if (forFaction.isSafeZone() && Permission.MANAGE_SAFE_ZONE.has(getPlayer())) {
|
||||
return true;
|
||||
} else if (forFaction.isWarZone() && Permission.MANAGE_WAR_ZONE.has(getPlayer())) {
|
||||
return true;
|
||||
} else if (currentFaction.getAccess(this, PermissableAction.TERRITORY) == Access.ALLOW) {
|
||||
return true;
|
||||
} else if (currentFaction.isWilderness() && forFaction.getAccess(this, PermissableAction.TERRITORY) == Access.ALLOW) {
|
||||
} else if (currentFaction.getAccess(this, PermissableAction.TERRITORY) == Access.ALLOW && forFaction != currentFaction ) {
|
||||
return true;
|
||||
} 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) {
|
||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_ALREADYOWN.toString(), forFaction.describeTo(this, true));
|
||||
} else if (forFaction.getAccess(this, PermissableAction.TERRITORY) != Access.ALLOW) {
|
||||
error = TL.COMMAND_CLAIM_DENIED.toString();
|
||||
error = plugin.txt.parse(TL.CLAIM_ALREADYOWN.toString(), forFaction.describeTo(this, true));
|
||||
} 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()) {
|
||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_SAFEZONE.toString());
|
||||
error = plugin.txt.parse(TL.CLAIM_SAFEZONE.toString());
|
||||
} else if (currentFaction.isWarZone()) {
|
||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_WARZONE.toString());
|
||||
} else if (FactionsPlugin.getInstance().getConfig().getBoolean("hcf.allow-overclaim", true) && ownedLand >= forFaction.getPowerRounded()) {
|
||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_POWER.toString());
|
||||
error = plugin.txt.parse(TL.CLAIM_WARZONE.toString());
|
||||
} else if (plugin.getConfig().getBoolean("hcf.allow-overclaim", true) && ownedLand >= forFaction.getPowerRounded()) {
|
||||
error = plugin.txt.parse(TL.CLAIM_POWER.toString());
|
||||
} 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) {
|
||||
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())) {
|
||||
if (Conf.claimsCanBeUnconnectedIfOwnedByOtherFaction) {
|
||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_CONTIGIOUS.toString());
|
||||
error = plugin.txt.parse(TL.CLAIM_CONTIGIOUS.toString());
|
||||
} 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)) {
|
||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_TOOCLOSETOOTHERFACTION.format(factionBuffer));
|
||||
error = plugin.txt.parse(TL.CLAIM_TOOCLOSETOOTHERFACTION.format(factionBuffer));
|
||||
} else if (flocation.isOutsideWorldBorder(worldBuffer)) {
|
||||
if (worldBuffer > 0) {
|
||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_OUTSIDEBORDERBUFFER.format(worldBuffer));
|
||||
error = plugin.txt.parse(TL.CLAIM_OUTSIDEBORDERBUFFER.format(worldBuffer));
|
||||
} else {
|
||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString());
|
||||
error = plugin.txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString());
|
||||
}
|
||||
} else if (currentFaction.isNormal()) {
|
||||
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()) {
|
||||
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()) {
|
||||
// TODO more messages WARN current faction most importantly
|
||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_THISISSPARTA.toString(), currentFaction.getTag(this));
|
||||
} else if (currentFaction.hasLandInflation() && !FactionsPlugin.getInstance().getConfig().getBoolean("hcf.allow-overclaim", true)) {
|
||||
error = plugin.txt.parse(TL.CLAIM_THISISSPARTA.toString(), currentFaction.getTag(this));
|
||||
} else if (currentFaction.hasLandInflation() && !plugin.getConfig().getBoolean("hcf.allow-overclaim", true)) {
|
||||
// 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)) {
|
||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_BORDER.toString());
|
||||
error = plugin.txt.parse(TL.CLAIM_BORDER.toString());
|
||||
}
|
||||
}
|
||||
// TODO: Add more else if statements.
|
||||
|
||||
if (notifyFailure && error != null) msg(error);
|
||||
if (notifyFailure && error != null) {
|
||||
msg(error);
|
||||
}
|
||||
return error == null;
|
||||
}
|
||||
|
||||
@@ -962,9 +972,6 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
}
|
||||
|
||||
public void setFFlying(boolean fly, boolean damage) {
|
||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight"))
|
||||
return;
|
||||
|
||||
Player player = getPlayer();
|
||||
if (player == null) return;
|
||||
|
||||
@@ -973,7 +980,9 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
|
||||
if (!damage) {
|
||||
msg(TL.COMMAND_FLY_CHANGE, fly ? "enabled" : "disabled");
|
||||
if (!fly) sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3) + ""));
|
||||
if (!fly) {
|
||||
sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3) + ""));
|
||||
}
|
||||
} else {
|
||||
msg(TL.COMMAND_FLY_DAMAGE);
|
||||
}
|
||||
@@ -991,6 +1000,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
Bukkit.getScheduler().runTaskLater(FactionsPlugin.getInstance(), () -> setTakeFallDamage(true), 20L * cooldown);
|
||||
}
|
||||
}
|
||||
|
||||
isFlying = fly;
|
||||
}
|
||||
|
||||
@@ -1016,8 +1026,14 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
|
||||
public boolean canFlyAtLocation(FLocation location) {
|
||||
Faction faction = Board.getInstance().getFactionAt(location);
|
||||
if ((faction == getFaction() && getRole() == Role.LEADER) || isAdminBypassing) return true;
|
||||
if (faction.isSystemFaction()) return CmdFly.checkFly(this, getPlayer(), faction);
|
||||
if ((faction == getFaction() && getRole() == Role.LEADER) || isAdminBypassing) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (faction.isSystemFaction()) {
|
||||
return CmdFly.checkBypassPerms(this, getPlayer(), faction, false);
|
||||
}
|
||||
|
||||
Access access = faction.getAccess(this, PermissableAction.FLY);
|
||||
return access == null || access == Access.UNDEFINED || access == Access.ALLOW;
|
||||
}
|
||||
@@ -1203,6 +1219,15 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public boolean hasFriendlyFire(){
|
||||
return friendlyFire;
|
||||
}
|
||||
|
||||
public void setFriendlyFire(boolean status){
|
||||
friendlyFire = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInspectMode() {
|
||||
return inspectMode;
|
||||
@@ -1216,10 +1241,14 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
public boolean attemptClaim(Faction forFaction, FLocation flocation, boolean notifyFailure) {
|
||||
// notifyFailure is false if called by auto-claim; no need to notify on every failure for it
|
||||
// return value is false on failure, true on success
|
||||
|
||||
Faction currentFaction = Board.getInstance().getFactionAt(flocation);
|
||||
int ownedLand = forFaction.getLandRounded();
|
||||
|
||||
if (!this.canClaimForFactionAtLocation(forFaction, flocation, notifyFailure)) return false;
|
||||
if (!this.canClaimForFactionAtLocation(forFaction, flocation, notifyFailure)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// if economy is enabled and they're not on the bypass list, make sure they can pay
|
||||
boolean mustPay = Econ.shouldBeUsed() && !this.isAdminBypassing() && !forFaction.isSafeZone() && !forFaction.isWarZone() && (Conf.econCostClaimWilderness != 0);
|
||||
double cost = 0.0;
|
||||
@@ -1238,36 +1267,56 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
payee = this;
|
||||
}
|
||||
|
||||
if (!Econ.hasAtLeast(payee, cost, TL.CLAIM_TOCLAIM.toString())) return false;
|
||||
if (!Econ.hasAtLeast(payee, cost, TL.CLAIM_TOCLAIM.toString())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (forFaction.getClaimOwnership().containsKey(flocation) && !forFaction.isPlayerInOwnerList(this, flocation)) {
|
||||
this.msg(TL.GENERIC_FPERM_OWNER_NOPERMISSION, "claim");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Conf.worldGuardChecking && Worldguard.getInstance().checkForRegionsInChunk(flocation)) {
|
||||
this.msg(TL.GENERIC_WORLDGUARD);
|
||||
return false;
|
||||
}
|
||||
|
||||
LandClaimEvent claimEvent = new LandClaimEvent(flocation, forFaction, this);
|
||||
Bukkit.getPluginManager().callEvent(claimEvent);
|
||||
if (claimEvent.isCancelled()) return false;
|
||||
|
||||
if (claimEvent.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// then make 'em pay (if applicable)
|
||||
if (mustPay && !Econ.modifyMoney(payee, -cost, TL.CLAIM_TOCLAIM.toString(), TL.CLAIM_FORCLAIM.toString()))
|
||||
if (mustPay && !Econ.modifyMoney(payee, -cost, TL.CLAIM_TOCLAIM.toString(), TL.CLAIM_FORCLAIM.toString())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Was an over claim
|
||||
if (mustPay && currentFaction.isNormal() && currentFaction.hasLandInflation())
|
||||
if (currentFaction.isNormal() && currentFaction.hasLandInflation()) {
|
||||
// Give them money for over claiming.
|
||||
Econ.modifyMoney(payee, Conf.econOverclaimRewardMultiplier, TL.CLAIM_TOOVERCLAIM.toString(), TL.CLAIM_FOROVERCLAIM.toString());
|
||||
|
||||
|
||||
// announce success
|
||||
Set<FPlayer> informTheseFPlayers = new HashSet<>();
|
||||
informTheseFPlayers.add(this);
|
||||
informTheseFPlayers.addAll(forFaction.getFPlayersWhereOnline(true));
|
||||
for (FPlayer fp : informTheseFPlayers) {
|
||||
if (!fp.hasNotificationsEnabled()) continue;
|
||||
fp.msg(TL.CLAIM_CLAIMED, this.describeTo(fp, true), forFaction.describeTo(fp), currentFaction.describeTo(fp));
|
||||
}
|
||||
|
||||
|
||||
// announce success
|
||||
if(!FactionsPlugin.cachedRadiusClaim) {
|
||||
Set<FPlayer> informTheseFPlayers = new HashSet<>();
|
||||
informTheseFPlayers.add(this);
|
||||
informTheseFPlayers.addAll(forFaction.getFPlayersWhereOnline(true));
|
||||
for (FPlayer fp : informTheseFPlayers) {
|
||||
fp.msg(TL.CLAIM_CLAIMED, this.describeTo(fp, true), forFaction.describeTo(fp), currentFaction.describeTo(fp));
|
||||
}
|
||||
}
|
||||
|
||||
Board.getInstance().setFactionAt(forFaction, flocation);
|
||||
if (Conf.logLandClaims)
|
||||
|
||||
if (Conf.logLandClaims) {
|
||||
FactionsPlugin.getInstance().log(TL.CLAIM_CLAIMEDLOG.toString(), this.getName(), flocation.getCoordString(), forFaction.getTag());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1277,9 +1277,10 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
||||
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" : "") + ".");
|
||||
|
||||
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers())
|
||||
fplayer.msg(TL.COMMAND_DISBAND_BROADCAST_GENERIC, this.getTag(fplayer));
|
||||
if(FactionsPlugin.getInstance().getConfig().getBoolean("faction-disband-broadcast")) {
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers())
|
||||
fplayer.msg(TL.COMMAND_DISBAND_BROADCAST_GENERIC, this.getTag(fplayer));
|
||||
}
|
||||
|
||||
|
||||
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_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_PROMOTES("&e&l[!] &eYou have promoted &6%1$s &eto 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_PROMOTES("&c&l[!] &7You have promoted &c%1$s &7to the position of faction admin."),
|
||||
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_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_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_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_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_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_CREATEDLOG(" created 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_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_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_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_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_CHANGE("&c&l[!]&7 Faction flight &c%1$s"),
|
||||
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_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_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_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_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&7."),
|
||||
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!"),
|
||||
@@ -416,6 +416,11 @@ public enum TL {
|
||||
COMMAND_FOCUS_NO_LONGER("&c&l[!] &7Your faction is no longer focusing &c%s"),
|
||||
COMMAND_FOCUS_DESCRIPTION("Focus a Specific Player"),
|
||||
|
||||
COMMAND_FRIENDLY_FIRE_DESCRIPTION("Toggle friendly fire for yourself."),
|
||||
COMMAND_FRIENDLY_FIRE_TOGGLE_OFF("&c[!] &7You have toggled friendly fire &4off&7!"),
|
||||
COMMAND_FRIENDLY_FIRE_TOGGLE_ON("&c[!] &7You have toggled friendly fire &aon&7!"),
|
||||
FRIENDLY_FIRE_OFF_ATTACKER("&b%1$s &7has friendly fire toggle &4off&7!"),
|
||||
FRIENDLY_FIRE_YOU_MUST("&c[!] &7You must have friendly fire active to attack faction members!"),
|
||||
|
||||
COMMAND_FWARP_CLICKTOWARP("&c&l[!]&7 Click to &cwarp!"),
|
||||
COMMAND_FWARP_COMMANDFORMAT("&c&l[!]&7 /f warp <warpname> &c[password]"),
|
||||
@@ -429,9 +434,12 @@ public enum TL {
|
||||
COMMAND_FWARP_PASSWORD_REQUIRED("&c&l[!]&c Warp Password:"),
|
||||
COMMAND_FWARP_PASSWORD_TIMEOUT("&c&l[!]&7 Warp password &ccanceled"),
|
||||
|
||||
COMMAND_GRACE_TIME_REMAINING("&c&lGracePeriod &8» &cTime Remaining: &b%1$s"),
|
||||
COMMAND_GRACE_DISABLED_NO_FORMAT("&c[!] &7Grace is disabled! Explosions are allowed!"),
|
||||
COMMAND_GRACE_ENABLED_FORMAT("&c&lGracePeriod &8» &7Grace Period Has Now &aStarted&7! &cTime Remaining: &b%1$s"),
|
||||
COMMAND_GRACE_DISABLED_FORMAT("&c&lGracePeriod &8» &7Grace Period Has Now &cEnded&7! &cExplosions are now enabled!"),
|
||||
COMMAND_GRACE_DESCRIPTION("Toggles Grace Period on/off"),
|
||||
COMMAND_GRACE_ENABLED("&cYou cannot place &e%s &cwhile grace period is active!"),
|
||||
COMMAND_GRACE_TOGGLE("&8» &7Grace period is now &c%1$s"),
|
||||
COMMAND_GRACE_ENABLED_PLACEMENT("&cYou cannot place &e%s &cwhile grace period is active!"),
|
||||
|
||||
COMMAND_HINT_PERMISSION("&aYou can manage your factions permissions using &7/f perms"),
|
||||
|
||||
@@ -462,7 +470,7 @@ public enum TL {
|
||||
COMMAND_INVITE_TOINVITE("to invite someone"),
|
||||
COMMAND_INVITE_FORINVITE("for inviting someone"),
|
||||
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_ALTINVITE_INVITED_ALT("&c&l[!]&7 &c%1$s&7 invited &c%2$s&7 to your faction as an alt."),
|
||||
|
||||
@@ -606,12 +614,14 @@ public enum TL {
|
||||
COMMAND_MONEYWITHDRAW_DESCRIPTION("Withdraw money"),
|
||||
COMMAND_MONEYWITHDRAW_WITHDRAW("&c&l[!]&7 &c%1$s&7 withdrew&c %2$s &7from the faction bank:&c %3$s"),
|
||||
|
||||
|
||||
COMMAND_COOLDOWN("&c&l[!] &7You are currently on cooldown for this command!"),
|
||||
COMMAND_OPEN_TOOPEN("to open or close the faction"),
|
||||
COMMAND_OPEN_FOROPEN("for opening or closing the faction"),
|
||||
COMMAND_OPEN_OPEN("open"),
|
||||
COMMAND_OPEN_CLOSED("closed"),
|
||||
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_OWNER_DISABLED("&c&l[!]&7 Sorry, but &cowned areas &7are &cdisabled &7on this server."),
|
||||
@@ -697,11 +707,14 @@ public enum TL {
|
||||
COMMAND_PERMANENT_GRANT("&c&l[!]&7 added permanent status to"),
|
||||
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_OTHER("&c&l[!]&7 &c%s &7has &c%s &7the faction &c'%s'."),
|
||||
COMMAND_PROMOTE_TARGET("&c&l[!]&7 You've been &c%1$s&7 to &c%2$s"),
|
||||
COMMAND_PROMOTE_SUCCESS("&c&l[!]&7 You successfully&c %1$s %2$s &cto&7 %3$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&7."),
|
||||
COMMAND_PROMOTE_SUCCESS("&c&l[!]&7 You successfully &c%1$s %2$s &cto&7 %3$s&7."),
|
||||
COMMAND_PROMOTE_PROMOTED("promoted"),
|
||||
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_PERMANENTPOWER_DESCRIPTION("Toggle permanent faction power option"),
|
||||
@@ -713,7 +726,6 @@ public enum TL {
|
||||
COMMAND_PROMOTE_DESCRIPTION("/f promote <name>"),
|
||||
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_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_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!"),
|
||||
@@ -721,7 +733,7 @@ public enum TL {
|
||||
|
||||
COMMAND_POWER_TOSHOW("to show player power info"),
|
||||
COMMAND_POWER_FORSHOW("for showing player power info"),
|
||||
COMMAND_POWER_POWER("&c&l[!]&7 &c%1$s » &cPower &7/ &cMaxpower&a » &c%2$d &7/&c%3$d %4$s"),
|
||||
COMMAND_POWER_POWER("&c&l[!]&7 &c%1$s » &cPower &7/ &cMaxpower&a » &c%2$d &7/ &c%3$d %4$s"),
|
||||
COMMAND_POWER_BONUS(" (bonus: "),
|
||||
COMMAND_POWER_PENALTY(" (penalty: "),
|
||||
COMMAND_POWER_DESCRIPTION("&a&l» &7Show player &apower &7info"),
|
||||
@@ -740,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_TOMARRY("to change 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_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_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_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_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_DESCRIPTION("Reload data file(s) from disk"),
|
||||
@@ -962,7 +974,7 @@ public enum TL {
|
||||
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_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_NOPERM("This is a safe zone. You lack permissions to unclaim."),
|
||||
@@ -1023,12 +1035,12 @@ public enum TL {
|
||||
/**
|
||||
* 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_NEGATIVEPOWER("You cannot leave until your power is positive."),
|
||||
LEAVE_PASSADMIN("&c&l[!] &7You must give the admin role to someone else first."),
|
||||
LEAVE_NEGATIVEPOWER("&c&l[!] &7You cannot leave until your power is positive."),
|
||||
LEAVE_TOLEAVE("to leave your faction."),
|
||||
LEAVE_FORLEAVE("for leaving your faction."),
|
||||
LEAVE_LEFT("%s left faction %s."),
|
||||
LEAVE_DISBANDED("%s was disbanded."),
|
||||
LEAVE_LEFT("&c&l[!] &c%s&7 left faction &c%s&7."),
|
||||
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_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."),
|
||||
@@ -1057,6 +1069,7 @@ public enum TL {
|
||||
CLAIM_FORCLAIM("for claiming this land"),
|
||||
CLAIM_TOOVERCLAIM("to overclaim 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_CLAIMEDLOG("%s claimed land at (%s) for the faction: %s"),
|
||||
CLAIM_OVERCLAIM_DISABLED("Over claiming is disabled on this server."),
|
||||
@@ -1110,6 +1123,8 @@ public enum TL {
|
||||
GENERIC_NOFACTION_FOUND("&cCouldn't find a faction with that name!"),
|
||||
GENERIC_YOUMUSTBE("&cYour must be atleast %1$s to do this!"),
|
||||
GENERIC_MEMBERONLY("&cYou must be in a faction to do this!"),
|
||||
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_MISSION_STARTED("&f%1$s &dstarted the %2$s &fmission"),
|
||||
@@ -1159,7 +1174,7 @@ public enum TL {
|
||||
ECON_PERSONTOOKMONEYFROM("%1$s took %2$s from %3$s."),
|
||||
ECON_DISABLED("Factions econ is disabled."),
|
||||
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_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."),
|
||||
@@ -1272,7 +1287,9 @@ public enum TL {
|
||||
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_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;
|
||||
private static YamlConfiguration LANG;
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.massivecraft.factions.zcore.util;
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.util.timer.TimerManager;
|
||||
import org.apache.commons.lang.time.DurationFormatUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -20,6 +21,7 @@ public enum TagReplacer {
|
||||
/**
|
||||
* Fancy variables, used by f show
|
||||
*/
|
||||
NEUTRAL_LIST(TagType.FANCY, "{neutral-list}"),
|
||||
ALLIES_LIST(TagType.FANCY, "{allies-list}"),
|
||||
ONLINE_LIST(TagType.FANCY, "{online-list}"),
|
||||
ENEMIES_LIST(TagType.FANCY, "{enemies-list}"),
|
||||
@@ -81,6 +83,7 @@ public enum TagReplacer {
|
||||
/**
|
||||
* General variables, require no faction or player
|
||||
*/
|
||||
GRACE_TIMER(TagType.GENERAL, "{grace-time}"),
|
||||
MAX_WARPS(TagType.GENERAL, "{max-warps}"),
|
||||
MAX_ALLIES(TagType.GENERAL, "{max-allies}"),
|
||||
MAX_ALTS(TagType.GENERAL, "{max-alts}"),
|
||||
@@ -124,6 +127,8 @@ public enum TagReplacer {
|
||||
*/
|
||||
protected String getValue() {
|
||||
switch (this) {
|
||||
case GRACE_TIMER:
|
||||
return String.valueOf(TimerManager.getRemaining(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining(), true));
|
||||
case TOTAL_ONLINE:
|
||||
return String.valueOf(Bukkit.getOnlinePlayers().size());
|
||||
case FACTIONLESS:
|
||||
@@ -134,7 +139,7 @@ public enum TagReplacer {
|
||||
}
|
||||
return TL.GENERIC_INFINITY.toString();
|
||||
case MAX_ALTS:
|
||||
if(FactionsPlugin.getInstance().getConfig().getBoolean("f-alts.Enabled")){
|
||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("f-alts.Enabled")) {
|
||||
return String.valueOf(Conf.factionAltMemberLimit);
|
||||
}
|
||||
return TL.GENERIC_INFINITY.toString();
|
||||
|
||||
@@ -105,7 +105,6 @@ public class TagUtil {
|
||||
if (FactionsPlugin.getInstance().isMVdWPlaceholderAPIHooked() && player.isOnline()) {
|
||||
line = be.maximvdw.placeholderapi.PlaceholderAPI.replacePlaceholders(player, line);
|
||||
}
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,33 +47,45 @@ public class TextUtil {
|
||||
String text = "";
|
||||
FancyMessage message = new FancyMessage(text);
|
||||
ChatColor color = null;
|
||||
ChatColor style = null;
|
||||
char[] chars = first.toCharArray();
|
||||
|
||||
for (int i = 0; i < chars.length; i++) {
|
||||
// changed this so javadocs wont throw an error
|
||||
String compareChar = chars[i] + "";
|
||||
if (compareChar.equals("§")) {
|
||||
if (color != null) {
|
||||
if (color.isColor()) {
|
||||
message.then(text).color(color);
|
||||
} else {
|
||||
message.then(text).style(color);
|
||||
if (color != null || style != null) {
|
||||
message.then(text);
|
||||
if (color != null)
|
||||
message.color(color);
|
||||
if (style != null) {
|
||||
message.style(style);
|
||||
style = null;
|
||||
}
|
||||
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
|
||||
} else {
|
||||
text += chars[i];
|
||||
}
|
||||
}
|
||||
if (text.length() > 0) {
|
||||
if (color != null) {
|
||||
if (color.isColor()) {
|
||||
message.then(text).color(color);
|
||||
} else {
|
||||
message.then(text).style(color);
|
||||
}
|
||||
if (color != null || style != null) {
|
||||
message.then(text);
|
||||
if (color != null)
|
||||
message.color(color);
|
||||
if (style != null)
|
||||
message.style(style);
|
||||
} else {
|
||||
message.text(text);
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ help:
|
||||
# We use '1' to preserve default functionality of /f help 1
|
||||
'1':
|
||||
- '&7&m----------------------------------------------------'
|
||||
- '&6&lFactions Help &8- &f(1/2) '
|
||||
- '&6&lFactions Help &8- &f(1/3) '
|
||||
- '&7&m----------------------------------------------------'
|
||||
- '&c/f create &f<name> &8- &7Create your own faction.'
|
||||
- '&c/f who &f<name> &8- &7Show faction information.'
|
||||
@@ -362,7 +362,9 @@ help:
|
||||
- '&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 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.'
|
||||
#THIS IS AFFILIATED WITH F PERMS PERMISSION (TERRITORY) LOL
|
||||
- '&7&m--------------------&r &e/f help 2 &7&m-----------------------'
|
||||
'2':
|
||||
- '&7&m----------------------------------------------------'
|
||||
@@ -594,11 +596,13 @@ fwarp-gui:
|
||||
- ' '
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
# | Faction Creation/Disband Broadcast | #
|
||||
# | Faction Broadcasts | #
|
||||
# +------------------------------------------------------+ #
|
||||
############################################################
|
||||
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-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.
|
||||
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
@@ -729,8 +733,7 @@ F-Shop:
|
||||
# | Faction Command Cooldowns | #
|
||||
# +------------------------------------------------------+ #
|
||||
############################################################
|
||||
#To-Do#
|
||||
fcooldowns:
|
||||
fcooldowns: #All of These Cooldowns Are In Seconds
|
||||
f-open: 5
|
||||
f-disband: 10
|
||||
f-create: 10
|
||||
@@ -753,6 +756,7 @@ Falling-Block-Fix:
|
||||
# +------------------------------------------------------+ #
|
||||
############################################################
|
||||
f-disband-gui:
|
||||
title: '&7Confirm Disband'
|
||||
confirm-item:
|
||||
Type: LIME_STAINED_GLASS_PANE
|
||||
Name: '&a&lConfirm'
|
||||
@@ -828,7 +832,7 @@ Missions:
|
||||
- "&b&lMine &f&n10,000&r &2Sugar Cane"
|
||||
Mission:
|
||||
Type: "MINE"
|
||||
Material: "SUGAR_CANE_BLOCK"
|
||||
Material: "SUGAR_CANE"
|
||||
Amount: 10000
|
||||
Reward:
|
||||
Commands: ["f points add %faction% 100"]
|
||||
@@ -954,6 +958,7 @@ fupgrades:
|
||||
Lore:
|
||||
- ' '
|
||||
Crops:
|
||||
Max-Level: 4
|
||||
Crop-Boost:
|
||||
level-1: 10
|
||||
level-2: 20
|
||||
@@ -969,7 +974,7 @@ fupgrades:
|
||||
Lore:
|
||||
- '&7&oIncrease growth &c&ospeed&7&o of crops in &c&oclaims.'
|
||||
- '&7&oChance to Grow Two Levels.'
|
||||
- 'Current level is &e&l&o{level}'
|
||||
- '&7&oYour current level is &e&l&o{level}'
|
||||
- ''
|
||||
- '&c&lChances'
|
||||
- '&4&l* &cLevel 1: &f10% Chance'
|
||||
@@ -984,6 +989,7 @@ fupgrades:
|
||||
- '&7&o(( Tip: &f&oleft-click&7&o to &c&oupgrade&7&o ))'
|
||||
Slot: 31
|
||||
EXP:
|
||||
Max-Level: 3
|
||||
EXP-Boost:
|
||||
level-1: 1.5
|
||||
level-2: 2.0
|
||||
@@ -1013,6 +1019,7 @@ fupgrades:
|
||||
- '&7&o(( Tip: &f&oleft-click&7&o to &c&oupgrade&7&o ))'
|
||||
Slot: 32
|
||||
Power:
|
||||
Max-Level: 3
|
||||
Power-Boost:
|
||||
level-1: 100.0
|
||||
level-2: 200.0
|
||||
@@ -1028,7 +1035,7 @@ fupgrades:
|
||||
Lore:
|
||||
- '&a&oIncrease&7&o the amount of &c&opower'
|
||||
- '&7&oyour &a&ofaction has&7&o.'
|
||||
- 'Current level is &e&l&o{level}'
|
||||
- '&7&oYour current level is &e&l&o{level}'
|
||||
- ''
|
||||
- '&c&lIncreased Faction Power'
|
||||
- '&4&l* &cLevel 1: &f100'
|
||||
@@ -1043,6 +1050,7 @@ fupgrades:
|
||||
- '&7&o(( Tip: &f&oleft-click&7&o to &c&oupgrade&7&o ))'
|
||||
Slot: 22
|
||||
Redstone:
|
||||
Max-Level: 1
|
||||
Cost:
|
||||
level-1: 1000000
|
||||
DisplayItem:
|
||||
@@ -1058,6 +1066,7 @@ fupgrades:
|
||||
- '&7&o(( Tip: &f&oLeft-click&7&o to &c&oupgrade&7&o ))'
|
||||
Slot: 23
|
||||
Spawners:
|
||||
Max-Level: 3
|
||||
Spawner-Boost:
|
||||
# This is a Percentage so .10 means 10% lowered spawner delay!
|
||||
level-1: 0.10
|
||||
@@ -1088,6 +1097,7 @@ fupgrades:
|
||||
- '&7&o(( Tip: &f&oleft-click&7&o to &c&oupgrade&7&o ))'
|
||||
Slot: 30
|
||||
DamageReduct:
|
||||
Max-Level: 3
|
||||
DamageReductPercent:
|
||||
level-1: 3
|
||||
level-2: 5
|
||||
@@ -1117,6 +1127,7 @@ fupgrades:
|
||||
- '&7&o(( Tip: &f&oleft-click&7&o to &c&oupgrade&7&o ))'
|
||||
Slot: 7
|
||||
DamageIncrease:
|
||||
Max-Level: 3
|
||||
DamageIncreasePercent:
|
||||
level-1: 3
|
||||
level-2: 5
|
||||
@@ -1146,6 +1157,7 @@ fupgrades:
|
||||
- '&7&o(( Tip: &f&oleft-click&7&o to &c&oupgrade&7&o ))'
|
||||
Slot: 1
|
||||
TNT:
|
||||
Max-Level: 3
|
||||
tnt-limit:
|
||||
level-1: 500000
|
||||
level-2: 1000000
|
||||
@@ -1175,6 +1187,7 @@ fupgrades:
|
||||
- '&7&o(( Tip: &f&oleft-click&7&o to &c&oupgrade&7&o ))'
|
||||
Slot: 21
|
||||
Warps:
|
||||
Max-Level: 3
|
||||
warp-limit:
|
||||
level-1: 3
|
||||
level-2: 4
|
||||
@@ -1204,6 +1217,7 @@ fupgrades:
|
||||
- '&7&o(( Tip: &f&oleft-click&7&o to &c&oupgrade&7&o ))'
|
||||
Slot: 24
|
||||
Chest:
|
||||
Max-Level: 3
|
||||
Chest-Size:
|
||||
# This is rows
|
||||
level-1: 2
|
||||
@@ -1234,10 +1248,11 @@ fupgrades:
|
||||
- '&7&o(( Tip: &f&oleft-click&7&o to &c&oupgrade&7&o ))'
|
||||
Slot: 20
|
||||
Members:
|
||||
Max-Level: 3
|
||||
Members-Limit:
|
||||
level-1: 30
|
||||
level-2: 35
|
||||
level-3: 40
|
||||
level-1: 5 #The Number Of Members It Will Increase By
|
||||
level-2: 10
|
||||
level-3: 15
|
||||
Cost:
|
||||
level-1: 1000000
|
||||
level-2: 2000000
|
||||
@@ -1251,9 +1266,9 @@ fupgrades:
|
||||
- '&7&oYour current level is &e&l&o{level}'
|
||||
- ''
|
||||
- '&c&lFaction Member Limit'
|
||||
- '&4&l* &cLevel 1: &f30'
|
||||
- '&4&l* &cLevel 2: &f35'
|
||||
- '&4&l* &cLevel 3: &f40'
|
||||
- '&4&l* &cLevel 1: &f35'
|
||||
- '&4&l* &cLevel 2: &f40'
|
||||
- '&4&l* &cLevel 3: &f45'
|
||||
- '&f'
|
||||
- '&c&lCosts'
|
||||
- '&4&l* &cLevel 1: &f$1,000,000'
|
||||
@@ -1263,6 +1278,7 @@ fupgrades:
|
||||
- '&7&o(( Tip: &f&oleft-click&7&o to &c&oupgrade&7&o ))'
|
||||
Slot: 40
|
||||
Armor:
|
||||
Max-Level: 3
|
||||
Armor-HP-Drop:
|
||||
# HP Drop is in percent so .10 would mean it would drop 10% of the damage to the armor
|
||||
level-1: .10
|
||||
@@ -1432,6 +1448,7 @@ Wild:
|
||||
Zones:
|
||||
# You may create your own zones here please just follow the original format #
|
||||
Close:
|
||||
World: World
|
||||
Range:
|
||||
MinX: -200
|
||||
MaxX: 200
|
||||
@@ -1446,6 +1463,7 @@ Wild:
|
||||
Name: '&cLow Range'
|
||||
Slot: 1
|
||||
Medium:
|
||||
World: World
|
||||
Range:
|
||||
MinX: -400
|
||||
MaxX: 400
|
||||
@@ -1460,6 +1478,7 @@ Wild:
|
||||
Name: '&cMedium Range'
|
||||
Slot: 4
|
||||
Far:
|
||||
World: World
|
||||
Range:
|
||||
MinX: -800
|
||||
MaxX: 800
|
||||
@@ -1548,6 +1567,7 @@ Wild:
|
||||
# - {action-access-color} : Access color
|
||||
|
||||
# General variables. Can be used anywhere.
|
||||
# - {grace-time} : Time of Grace Period
|
||||
# - {total-online} : Total # of players on the server
|
||||
# - {max-warps} : Max # of warps a faction can set
|
||||
# - {max-allies} : Max # of allies a faction can have
|
||||
|
||||
@@ -89,8 +89,8 @@ COMMAND:
|
||||
INUSE: <b>That tag is already in use.
|
||||
TOCREATE: to create 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.
|
||||
CREATED: %s<i> created a new faction %s
|
||||
ERROR: '<b>There was an internal error while trying to create your faction. Please try again.'
|
||||
CREATED: '%s<i> created a new faction %s'
|
||||
CREATEDLOG: ' は新しい党派を造りました: '
|
||||
YOUSHOULD: '<i>You should now: %s'
|
||||
DEINVITE:
|
||||
|
||||
@@ -158,6 +158,8 @@ permissions:
|
||||
description: auto-claim land as you walk around
|
||||
factions.bypass:
|
||||
description: enable admin bypass mode
|
||||
factions.friendlyfire:
|
||||
description: ability to toggle on friend fire per player
|
||||
factions.lookup:
|
||||
description: Lookup claim & home stats for faction
|
||||
factions.chat:
|
||||
|
||||
Reference in New Issue
Block a user