diff --git a/pom.xml b/pom.xml
index 1ea983b2..cff55ba5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.massivecraft
Factions
- 1.6.9.5-2.3.3-RC
+ 1.6.9.5-2.3.4-RC
jar
SaberFactions
diff --git a/src/main/java/com/massivecraft/factions/Conf.java b/src/main/java/com/massivecraft/factions/Conf.java
index 1f3791fc..c1055a93 100644
--- a/src/main/java/com/massivecraft/factions/Conf.java
+++ b/src/main/java/com/massivecraft/factions/Conf.java
@@ -98,6 +98,7 @@ 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;
@@ -122,7 +123,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;
diff --git a/src/main/java/com/massivecraft/factions/FactionsPlugin.java b/src/main/java/com/massivecraft/factions/FactionsPlugin.java
index 18c5b5a0..a72dac89 100755
--- a/src/main/java/com/massivecraft/factions/FactionsPlugin.java
+++ b/src/main/java/com/massivecraft/factions/FactionsPlugin.java
@@ -82,7 +82,7 @@ public class FactionsPlugin extends MPlugin {
public boolean mc114 = false;
public boolean mc115 = false;
public boolean useNonPacketParticles = false;
- public boolean factionsFlight = false;
+ public static boolean factionsFlight = false;
public List itemList = getConfig().getStringList("fchest.Items-Not-Allowed");
SkriptAddon skriptAddon;
private FactionsPlayerListener factionsPlayerListener;
@@ -453,37 +453,32 @@ public class FactionsPlugin extends MPlugin {
@Override
public void onDisable() {
- super.onDisable();
- timerManager.saveTimerData();
- try {
- String path = Paths.get(getDataFolder().getAbsolutePath()).toAbsolutePath().toString() + File.separator + "reserves.json";
- File file = new File(path);
- if (!file.exists()) {
- file.getParentFile().mkdirs();
- file.createNewFile();
- }
- Files.write(Paths.get(file.getPath()), getGsonBuilder().create().toJson(reserveObjects).getBytes());
- } catch (IOException e) {
- e.printStackTrace();
- }
-
// only save data if plugin actually completely loaded successfully
- if (this.loadSuccessful) Conf.saveSync();
-
-
- if (AutoLeaveTask != null) {
- this.getServer().getScheduler().cancelTask(AutoLeaveTask);
- AutoLeaveTask = null;
- }
- DiscordListener.saveGuilds();
- if (Discord.jda != null) {
- Discord.jda.shutdownNow();
- }
- try {
- fLogManager.saveLogs();
- } catch (Exception e) {
- e.printStackTrace();
+ if (this.loadSuccessful) {
+ Conf.load();
+ Conf.saveSync();
+ timerManager.saveTimerData();
+ DiscordListener.saveGuilds();
+ if (Discord.jda != null) Discord.jda.shutdownNow();
+ try {
+ fLogManager.saveLogs();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ try {
+ String path = Paths.get(getDataFolder().getAbsolutePath()).toAbsolutePath().toString() + File.separator + "reserves.json";
+ File file = new File(path);
+ if (!file.exists()) {
+ file.getParentFile().mkdirs();
+ file.createNewFile();
+ }
+ Files.write(Paths.get(file.getPath()), getGsonBuilder().create().toJson(reserveObjects).getBytes());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
}
+ this.getServer().getScheduler().cancelTasks(this);
+ super.onDisable();
}
public void startAutoLeaveTask(boolean restartIfRunning) {
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java b/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java
index 0001de8a..21718cb9 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java
@@ -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() {
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java b/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java
index 781499a0..f4252194 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java
@@ -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;
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java b/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java
index 724ec327..71d487f5 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java
@@ -101,14 +101,14 @@ 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")) {
+ if (!follower.canFlyAtLocation() && FactionsPlugin.factionsFlight) {
follower.setFFlying(false, false);
}
} else {
follower.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, amountString, faction.getTag(follower));
}
}
- if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) {
+ if (FactionsPlugin.factionsFlight) {
faction.disband(context.player, PlayerDisbandReason.COMMAND);
context.fPlayer.setFFlying(false, false);
Cooldown.setCooldown(context.fPlayer.getPlayer(), "disbandCooldown", FactionsPlugin.getInstance().getConfig().getInt("fcooldowns.f-disband"));
@@ -119,7 +119,7 @@ public class CmdDisband extends FCommand {
}
faction.disband(context.player, PlayerDisbandReason.COMMAND);
Cooldown.setCooldown(context.fPlayer.getPlayer(), "disbandCooldown", FactionsPlugin.getInstance().getConfig().getInt("fcooldowns.f-disband"));
- if (!context.fPlayer.canFlyAtLocation() && FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) {
+ if (!context.fPlayer.canFlyAtLocation() && FactionsPlugin.factionsFlight) {
context.fPlayer.setFFlying(false, false);
}
}
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java b/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java
index e27a0444..f6656197 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java
@@ -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());
}
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdReload.java b/src/main/java/com/massivecraft/factions/cmd/CmdReload.java
index 6655d6a0..4cdf3034 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdReload.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdReload.java
@@ -31,7 +31,7 @@ public class CmdReload extends FCommand {
if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight", false)) {
- FactionsPlugin.getInstance().factionsFlight = true;
+ FactionsPlugin.factionsFlight = true;
}
if (!FactionsPlugin.getInstance().mc17) {
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdShowClaims.java b/src/main/java/com/massivecraft/factions/cmd/CmdShowClaims.java
index 62f9f94d..3be6e0ea 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdShowClaims.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdShowClaims.java
@@ -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();
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdShowInvites.java b/src/main/java/com/massivecraft/factions/cmd/CmdShowInvites.java
index 6dd0a368..f4728eb5 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdShowInvites.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdShowInvites.java
@@ -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
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdStealth.java b/src/main/java/com/massivecraft/factions/cmd/CmdStealth.java
index deb7428e..6f2bd53e 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdStealth.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdStealth.java
@@ -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;
}
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdUnban.java b/src/main/java/com/massivecraft/factions/cmd/CmdUnban.java
index 81742a66..442b74aa 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdUnban.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdUnban.java
@@ -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
diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java
index fb0cc063..54dd479d 100644
--- a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java
+++ b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java
@@ -180,12 +180,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;
diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java
index a9963a0a..b3850fe5 100644
--- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java
+++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java
@@ -36,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;
@@ -385,6 +387,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:
@@ -453,7 +459,6 @@ public class FactionsPlayerListener implements Listener {
case CHIPPED_ANVIL:
case DAMAGED_ANVIL:
case BREWING_STAND:
-
return PermissableAction.CONTAINER;
default:
return null;
@@ -572,7 +577,7 @@ public class FactionsPlayerListener implements Listener {
}
@Deprecated
public void checkCanFly(FPlayer me) {
- if (!FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight") || !FactionsPlugin.instance.getConfig().getBoolean("ffly.AutoEnable"))
+ if (!FactionsPlugin.factionsFlight || !FactionsPlugin.instance.getConfig().getBoolean("ffly.AutoEnable"))
return;
if (me.isFlying()) return;
if (me.getPlayer().hasPermission(Permission.FLY_FLY.node)) {
@@ -841,15 +846,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();
@@ -969,7 +971,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();
diff --git a/src/main/java/com/massivecraft/factions/scoreboards/sidebar/FInfoSidebar.java b/src/main/java/com/massivecraft/factions/scoreboards/sidebar/FInfoSidebar.java
index 31ed0b9c..e8085f9e 100644
--- a/src/main/java/com/massivecraft/factions/scoreboards/sidebar/FInfoSidebar.java
+++ b/src/main/java/com/massivecraft/factions/scoreboards/sidebar/FInfoSidebar.java
@@ -31,7 +31,17 @@ public class FInfoSidebar extends FSidebarProvider {
ListIterator 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;
}
diff --git a/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java b/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java
index 9b472981..663beac8 100644
--- a/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java
+++ b/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java
@@ -210,8 +210,12 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
return String.valueOf(faction.getMaxVaults());
case "faction_relation_color":
return fPlayer.getColorTo(faction).toString();
- case "faction_grace_time":
- return String.valueOf(TimerManager.getRemaining(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining(), true));
+ 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();
diff --git a/src/main/java/com/massivecraft/factions/util/MiscUtil.java b/src/main/java/com/massivecraft/factions/util/MiscUtil.java
index 9490d402..736d479e 100644
--- a/src/main/java/com/massivecraft/factions/util/MiscUtil.java
+++ b/src/main/java/com/massivecraft/factions/util/MiscUtil.java
@@ -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;
}
}
diff --git a/src/main/java/com/massivecraft/factions/util/UtilFly.java b/src/main/java/com/massivecraft/factions/util/UtilFly.java
index b5ab004f..d5782526 100644
--- a/src/main/java/com/massivecraft/factions/util/UtilFly.java
+++ b/src/main/java/com/massivecraft/factions/util/UtilFly.java
@@ -15,7 +15,7 @@ public class UtilFly {
*/
@Deprecated
public static void run() {
- if (!FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight"))
+ if (!FactionsPlugin.factionsFlight)
return;
Bukkit.getScheduler().scheduleSyncRepeatingTask(FactionsPlugin.getInstance(), () -> {
@@ -28,7 +28,7 @@ public class UtilFly {
@Deprecated
public static void setFly(FPlayer fp, boolean fly, boolean silent, boolean damage) {
- if (!FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight"))
+ if (!FactionsPlugin.factionsFlight)
return;
fp.getPlayer().setAllowFlight(fly);
diff --git a/src/main/java/com/massivecraft/factions/zcore/MPlugin.java b/src/main/java/com/massivecraft/factions/zcore/MPlugin.java
index e5f560d7..9f1a5855 100644
--- a/src/main/java/com/massivecraft/factions/zcore/MPlugin.java
+++ b/src/main/java/com/massivecraft/factions/zcore/MPlugin.java
@@ -178,7 +178,6 @@ public abstract class MPlugin extends JavaPlugin {
}
public void onDisable() {
- try {
if (saveTask != null) {
this.getServer().getScheduler().cancelTask(saveTask);
saveTask = null;
@@ -190,8 +189,6 @@ public abstract class MPlugin extends JavaPlugin {
Board.getInstance().forceSave();
}
log("Disabled");
- } catch (IllegalPluginAccessException e) {
- }
}
// -------------------------------------------- //
diff --git a/src/main/java/com/massivecraft/factions/zcore/frame/fdisband/FDisbandFrame.java b/src/main/java/com/massivecraft/factions/zcore/frame/fdisband/FDisbandFrame.java
index b53f47b5..eb49148f 100644
--- a/src/main/java/com/massivecraft/factions/zcore/frame/fdisband/FDisbandFrame.java
+++ b/src/main/java/com/massivecraft/factions/zcore/frame/fdisband/FDisbandFrame.java
@@ -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) {
diff --git a/src/main/java/com/massivecraft/factions/zcore/frame/fwarps/FactionWarpsFrame.java b/src/main/java/com/massivecraft/factions/zcore/frame/fwarps/FactionWarpsFrame.java
index 31be3e85..2ef816a6 100644
--- a/src/main/java/com/massivecraft/factions/zcore/frame/fwarps/FactionWarpsFrame.java
+++ b/src/main/java/com/massivecraft/factions/zcore/frame/fwarps/FactionWarpsFrame.java
@@ -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 warp : fplayer.getFaction().getWarps().entrySet()) {
if (slots.size() < fplayer.getFaction().getWarps().entrySet().size()) {
slots.add(slots.get(slots.size() - 1) + 1);
diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java
index e678d3d9..73601f26 100644
--- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java
+++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java
@@ -728,12 +728,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))));
}
@@ -842,71 +843,72 @@ 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) - 1;
+ 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) - 1)) {
- error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.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 = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_DISABLED.toString());
+ 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) {
+ } 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));
+ 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.
@@ -961,7 +963,7 @@ public abstract class MemoryFPlayer implements FPlayer {
}
public void setFFlying(boolean fly, boolean damage) {
- if (!FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight"))
+ if (!FactionsPlugin.factionsFlight)
return;
Player player = getPlayer();
diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TL.java b/src/main/java/com/massivecraft/factions/zcore/util/TL.java
index cb2f1819..9b8b4262 100644
--- a/src/main/java/com/massivecraft/factions/zcore/util/TL.java
+++ b/src/main/java/com/massivecraft/factions/zcore/util/TL.java
@@ -470,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."),
@@ -972,7 +972,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."),
@@ -1121,6 +1121,7 @@ public enum TL {
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"),
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 15b636dd..ceed0853 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -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----------------------------------------------------'
@@ -600,6 +602,7 @@ fwarp-gui:
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.
############################################################
# +------------------------------------------------------+ #
@@ -753,6 +756,7 @@ Falling-Block-Fix:
# +------------------------------------------------------+ #
############################################################
f-disband-gui:
+ title: '&7Confirm Disband'
confirm-item:
Type: LIME_STAINED_GLASS_PANE
Name: '&a&lConfirm'