From 3aa98121e5de3a58582c3a1a30e482ae01ac5815 Mon Sep 17 00:00:00 2001 From: Driftay Date: Sun, 12 Apr 2020 06:26:27 -0400 Subject: [PATCH 01/14] Factions Fly Cache on Startup, Attempt At SaveSync Fix --- .../java/com/massivecraft/factions/Conf.java | 2 +- .../massivecraft/factions/FactionsPlugin.java | 55 +++++++++---------- .../massivecraft/factions/cmd/CmdDisband.java | 6 +- .../massivecraft/factions/cmd/CmdReload.java | 2 +- .../massivecraft/factions/cmd/CmdStealth.java | 2 +- .../listeners/FactionsPlayerListener.java | 2 +- .../massivecraft/factions/util/UtilFly.java | 4 +- .../massivecraft/factions/zcore/MPlugin.java | 3 - .../factions/zcore/persist/MemoryFPlayer.java | 2 +- 9 files changed, 35 insertions(+), 43 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/Conf.java b/src/main/java/com/massivecraft/factions/Conf.java index 39383305..ae457a7e 100644 --- a/src/main/java/com/massivecraft/factions/Conf.java +++ b/src/main/java/com/massivecraft/factions/Conf.java @@ -122,7 +122,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/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/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/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/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index a9963a0a..870db485 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -572,7 +572,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)) { 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/persist/MemoryFPlayer.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java index e678d3d9..099112ff 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java @@ -961,7 +961,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(); From 6205bbca9fcf3392768c744a0035e0fdbc892e0e Mon Sep 17 00:00:00 2001 From: Driftay Date: Mon, 13 Apr 2020 05:03:41 -0400 Subject: [PATCH 02/14] Added a bunch of fixes from github requests --- .../massivecraft/factions/cmd/CmdShowInvites.java | 1 + .../java/com/massivecraft/factions/cmd/CmdUnban.java | 3 ++- .../factions/listeners/FactionsPlayerListener.java | 2 ++ .../factions/scoreboards/sidebar/FInfoSidebar.java | 12 +++++++++++- .../factions/util/ClipPlaceholderAPIManager.java | 8 ++++++-- .../factions/zcore/frame/fdisband/FDisbandFrame.java | 2 +- .../factions/zcore/persist/MemoryFPlayer.java | 4 +--- .../com/massivecraft/factions/zcore/util/TL.java | 3 ++- src/main/resources/config.yml | 1 + 9 files changed, 27 insertions(+), 9 deletions(-) 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/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/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 870db485..e4f497ca 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -47,7 +47,9 @@ import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryDragEvent; import org.bukkit.event.player.*; +import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitTask; +import org.bukkit.util.NumberConversions; import java.util.*; import java.util.logging.Level; 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/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/persist/MemoryFPlayer.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java index 099112ff..cbbd0c3a 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,10 @@ public abstract class MemoryFPlayer implements FPlayer { public void sendFactionHereMessage(Faction from) { Faction toShow = Board.getInstance().getFactionAt(getLastStoodAt()); - boolean showChat = true; 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)))); } 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..5b07bd12 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TL.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TL.java @@ -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 59437e69..e05070d3 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -753,6 +753,7 @@ Falling-Block-Fix: # +------------------------------------------------------+ # ############################################################ f-disband-gui: + title: '&7Confirm Disband' confirm-item: Type: LIME_STAINED_GLASS_PANE Name: '&a&lConfirm' From 7ea81a6c10135f4465a88f539dd00313a20a8a12 Mon Sep 17 00:00:00 2001 From: Driftay Date: Mon, 13 Apr 2020 13:09:15 -0400 Subject: [PATCH 03/14] Addressed Issue: https://github.com/SaberLLC/Saber-Factions/issues/69 --- .../com/massivecraft/factions/cmd/CmdAdmin.java | 16 ++++++---------- src/main/resources/config.yml | 1 + 2 files changed, 7 insertions(+), 10 deletions(-) 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/resources/config.yml b/src/main/resources/config.yml index e05070d3..3af2c1ef 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -600,6 +600,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. ############################################################ # +------------------------------------------------------+ # From 319940d9b36b972bc84ff7e603d617923d2ccf4a Mon Sep 17 00:00:00 2001 From: CanardConfit Date: Mon, 13 Apr 2020 19:12:11 +0200 Subject: [PATCH 04/14] Fix Issue #75 --- src/main/java/com/massivecraft/factions/util/MiscUtil.java | 1 + 1 file changed, 1 insertion(+) 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; } } From baee5d2158008e6a8ff10715f39be80df36b35b6 Mon Sep 17 00:00:00 2001 From: Driftay Date: Mon, 13 Apr 2020 13:24:30 -0400 Subject: [PATCH 05/14] Addressed Issue: #77 & #68 --- src/main/java/com/massivecraft/factions/cmd/CmdShowClaims.java | 2 ++ .../com/massivecraft/factions/zcore/persist/MemoryFPlayer.java | 3 +++ 2 files changed, 5 insertions(+) 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/zcore/persist/MemoryFPlayer.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java index cbbd0c3a..2c939a42 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java @@ -728,6 +728,9 @@ public abstract class MemoryFPlayer implements FPlayer { public void sendFactionHereMessage(Faction from) { Faction toShow = Board.getInstance().getFactionAt(getLastStoodAt()); + + if(Conf.worldsNoClaiming.contains(getLastStoodAt().getWorldName())) return; + if (showInfoBoard(toShow)) { FScoreboard.get(this).setTemporarySidebar(new FInfoSidebar(toShow)); } From f088b42bbee9a8f23a288906bc736bbba55de837 Mon Sep 17 00:00:00 2001 From: Driftay Date: Mon, 13 Apr 2020 13:29:01 -0400 Subject: [PATCH 06/14] Added uneeded comment --- src/main/resources/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 3af2c1ef..f11b3938 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----------------------------------------------------' From cf075c270ec3339d906a19dd70f523c2f5e654f8 Mon Sep 17 00:00:00 2001 From: Driftay Date: Mon, 13 Apr 2020 13:35:27 -0400 Subject: [PATCH 07/14] Addressed Issue: #81 --- .../factions/listeners/FactionsBlockListener.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java index fb0cc063..e008f1e7 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; From 97072267624b3c1e47643ffcaf8cf9101bea66c3 Mon Sep 17 00:00:00 2001 From: Driftay Date: Mon, 13 Apr 2020 15:20:46 -0400 Subject: [PATCH 08/14] Addressed Issue: #90 & Added Configurable removePlayerDataWhenBanned message --- src/main/java/com/massivecraft/factions/Conf.java | 1 + .../factions/listeners/FactionsBlockListener.java | 2 +- .../factions/listeners/FactionsPlayerListener.java | 14 ++++---------- .../zcore/frame/fwarps/FactionWarpsFrame.java | 3 ++- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/Conf.java b/src/main/java/com/massivecraft/factions/Conf.java index 9f84fe17..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; diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java index e008f1e7..54dd479d 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -191,7 +191,7 @@ public class FactionsBlockListener implements Listener { 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 e4f497ca..97f6f8aa 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -47,9 +47,7 @@ import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryDragEvent; import org.bukkit.event.player.*; -import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitTask; -import org.bukkit.util.NumberConversions; import java.util.*; import java.util.logging.Level; @@ -455,7 +453,6 @@ public class FactionsPlayerListener implements Listener { case CHIPPED_ANVIL: case DAMAGED_ANVIL: case BREWING_STAND: - return PermissableAction.CONTAINER; default: return null; @@ -843,15 +840,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(); @@ -971,7 +965,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/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); From d1252df3ba625ed91ac56cecbe3dd547fbd94779 Mon Sep 17 00:00:00 2001 From: Driftay Date: Mon, 13 Apr 2020 15:28:37 -0400 Subject: [PATCH 09/14] Addressed Issue: 70 Some Blocks may be missing, but they are 100% configurable in conf.json I don't want to hardcode item names that people want to block by default. ex: crafting tables --- .../factions/listeners/FactionsPlayerListener.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 97f6f8aa..3588b7c4 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -385,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: From 0395280a9ef2b3bd6321d26e6000e17a9642e1e8 Mon Sep 17 00:00:00 2001 From: Driftay Date: Mon, 13 Apr 2020 16:12:46 -0400 Subject: [PATCH 10/14] Addressed Issue #72 --- .../factions/cmd/CmdDeinvite.java | 26 +++---------------- 1 file changed, 4 insertions(+), 22 deletions(-) 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; From 4f55b10c7d141f3a72b6b1cefd9c1e9e8d32a637 Mon Sep 17 00:00:00 2001 From: Driftay Date: Mon, 13 Apr 2020 18:44:17 -0400 Subject: [PATCH 11/14] Fixed Faction Claiming Over Themselves --- .../factions/zcore/persist/MemoryFPlayer.java | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) 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 2c939a42..73601f26 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java @@ -843,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. From 69765e472cd6cb8209f98db7443ab66bc343a39c Mon Sep 17 00:00:00 2001 From: CanardConfit Date: Tue, 14 Apr 2020 01:01:05 +0200 Subject: [PATCH 12/14] Fix issue #84 --- .../java/com/massivecraft/factions/cmd/CmdInvite.java | 11 ++++------- .../java/com/massivecraft/factions/zcore/util/TL.java | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) 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/zcore/util/TL.java b/src/main/java/com/massivecraft/factions/zcore/util/TL.java index 5b07bd12..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."), From 6d72e5d1673d5b09e40d5f8e497fdc1cf33d9aab Mon Sep 17 00:00:00 2001 From: CanardConfit Date: Tue, 14 Apr 2020 01:01:05 +0200 Subject: [PATCH 13/14] Fix issue #84 --- .../java/com/massivecraft/factions/cmd/CmdInvite.java | 11 ++++------- .../java/com/massivecraft/factions/zcore/util/TL.java | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) 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/zcore/util/TL.java b/src/main/java/com/massivecraft/factions/zcore/util/TL.java index 5b07bd12..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."), From aca075b5c7c2ce5ff0500467673eb2d6e0a04e48 Mon Sep 17 00:00:00 2001 From: Driftay Date: Mon, 13 Apr 2020 20:30:02 -0400 Subject: [PATCH 14/14] Version Change --- pom.xml | 2 +- .../massivecraft/factions/listeners/FactionsPlayerListener.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) 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/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 3588b7c4..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;