From e36927db9f7b3c1e5ca41490f9f480419eb80919 Mon Sep 17 00:00:00 2001 From: Naman Date: Fri, 13 Apr 2018 21:05:43 -0500 Subject: [PATCH] 1.1-RELEASECANDIDATE-1 Made the particles in /f fly more cloud like Changed wilderness color to Darkgreen Added a factionless check to inspect, so itll now disable the when you try to check with no faction. Inspect will disable upon entering combat You cannot claim outside the worldborder anymore, the chunkbuffer is taken into account. Particles WILL NOT appear in /vanish and in spectator mode --- src/main/java/com/massivecraft/factions/Conf.java | 4 ++-- src/main/java/com/massivecraft/factions/P.java | 14 ++------------ .../java/com/massivecraft/factions/cmd/CmdFly.java | 11 ++++++++--- .../com/massivecraft/factions/cmd/CmdRules.java | 4 ++-- .../com/massivecraft/factions/cmd/FCmdRoot.java | 2 +- .../factions/listeners/FactionsEntityListener.java | 11 +++++++++++ .../factions/listeners/FactionsPlayerListener.java | 6 ++++++ .../factions/scoreboards/BufferedObjective.java | 2 +- .../factions/scoreboards/FScoreboard.java | 2 +- .../factions/scoreboards/FTeamWrapper.java | 1 - .../massivecraft/factions/struct/Permission.java | 1 + .../factions/zcore/persist/MemoryBoard.java | 6 +++++- .../factions/zcore/persist/MemoryFPlayer.java | 5 ++++- .../com/massivecraft/factions/zcore/util/TL.java | 5 ++++- src/main/resources/plugin.yml | 2 +- 15 files changed, 49 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/Conf.java b/src/main/java/com/massivecraft/factions/Conf.java index 65689c4d..08205688 100644 --- a/src/main/java/com/massivecraft/factions/Conf.java +++ b/src/main/java/com/massivecraft/factions/Conf.java @@ -14,14 +14,14 @@ public class Conf { public static boolean allowNoSlashCommand = true; // Colors - public static ChatColor colorMember = ChatColor.GREEN; + public static ChatColor colorMember = ChatColor.DARK_GREEN; public static ChatColor colorAlly = ChatColor.LIGHT_PURPLE; public static ChatColor colorTruce = ChatColor.DARK_PURPLE; public static ChatColor colorNeutral = ChatColor.WHITE; public static ChatColor colorEnemy = ChatColor.RED; public static ChatColor colorPeaceful = ChatColor.GOLD; - public static ChatColor colorWilderness = ChatColor.GREEN; + public static ChatColor colorWilderness = ChatColor.DARK_GREEN; public static ChatColor colorSafezone = ChatColor.GOLD; public static ChatColor colorWar = ChatColor.DARK_RED; diff --git a/src/main/java/com/massivecraft/factions/P.java b/src/main/java/com/massivecraft/factions/P.java index 26901f40..e09387d7 100644 --- a/src/main/java/com/massivecraft/factions/P.java +++ b/src/main/java/com/massivecraft/factions/P.java @@ -128,9 +128,7 @@ public class P extends MPlugin { Board.getInstance().clean(); //inspect stuff - if (!initCoreProtect()){ - P.p.log("Inspect will be disabled, you need coreprotect installed for it to function!"); - } + // Add Base Commands this.cmdBase = new FCmdRoot(); @@ -349,15 +347,7 @@ public class P extends MPlugin { } - //Inspect stuff - private boolean initCoreProtect() - { - if (!getServer().getPluginManager().isPluginEnabled("CoreProtect")) { - return false; - } - CoreProtectAPI coreProtectAPI = CoreProtect.getInstance().getAPI(); - return true; - } + diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFly.java b/src/main/java/com/massivecraft/factions/cmd/CmdFly.java index 16fa05e3..3bac143b 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFly.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFly.java @@ -47,15 +47,21 @@ public class CmdFly extends FCommand { if (!player.isFlying()) { continue; } + if (player.getGameMode() == GameMode.SPECTATOR){ + continue; + } + if (FPlayers.getInstance().getByPlayer(player).isVanished()){ + continue; + } - ParticleEffect.CLOUD.display(0, 0, 0, 0, 1, player.getLocation().add(0, -0.35, 0), 16); + ParticleEffect.CLOUD.display((float) 0, (float) 0, (float) 0, (float) 0, 3, player.getLocation().add(0, -0.35, 0), 16); } if (flyMap.keySet().size() == 0) { Bukkit.getScheduler().cancelTask(id); id = -1; } } - }, 10L, 10L); + }, 10L, 3L); } public static void startFlyCheck() { @@ -76,7 +82,6 @@ public class CmdFly extends FCommand { continue; } FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player); - if (fPlayer == null) { continue; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdRules.java b/src/main/java/com/massivecraft/factions/cmd/CmdRules.java index a9266ad1..332f6556 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdRules.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdRules.java @@ -52,8 +52,8 @@ public class CmdRules extends FCommand { if (args.get(0).equalsIgnoreCase("set")) { fme.msg(TL.COMMAND_RULES_SET_INVALIDARGS); } - if (args.get(0).equalsIgnoreCase("add")) { - fme.msg(TL.COMMAND_RULES_ADD_INVALIDARGS); + if (args.get(0).equalsIgnoreCase("remove")) { + fme.msg(TL.COMMAND_RULES_REMOVE_INVALIDARGS); } if (args.get(0).equalsIgnoreCase("clear")) { fme.getFaction().clearRules(); diff --git a/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java b/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java index 943a419c..8e2709bf 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java +++ b/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java @@ -202,7 +202,7 @@ public class FCmdRoot extends FCommand { this.addSubCommand(this.cmdTpBanner); this.addSubCommand(this.cmdKillHolograms); - if (CoreProtect.getInstance() != null){ + if (Bukkit.getServer().getPluginManager().getPlugin("CoreProtect") != null){ P.p.log("Found CoreProtect, enabling Inspect"); this.addSubCommand(this.cmdInspect); } else { diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java index 833ae570..bf0f2894 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.listeners; import com.massivecraft.factions.*; +import com.massivecraft.factions.event.FPlayerJoinEvent; import com.massivecraft.factions.event.PowerLossEvent; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.util.MiscUtil; @@ -143,10 +144,20 @@ public class FactionsEntityListener implements Listener { if (damagee != null && damagee instanceof Player) { cancelFStuckTeleport((Player) damagee); cancelFFly((Player) damagee); + FPlayer fplayer = FPlayers.getInstance().getByPlayer((Player) damagee); + if (fplayer.isInspectMode()){ + fplayer.setInspectMode(false); + fplayer.msg(TL.COMMAND_INSPECT_DISABLED); + } } if (damager instanceof Player) { cancelFStuckTeleport((Player) damager); cancelFFly((Player) damager); + FPlayer fplayer = FPlayers.getInstance().getByPlayer((Player) damager); + if (fplayer.isInspectMode()){ + fplayer.setInspectMode(false); + fplayer.msg(TL.COMMAND_INSPECT_DISABLED); + } } } else if (Conf.safeZonePreventAllDamageToPlayers && isPlayerInSafeZone(event.getEntity())) { // Players can not take any damage in a Safe Zone diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 85b15521..fbf74d4b 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -267,7 +267,13 @@ public class FactionsPlayerListener implements Listener { if (!fplayer.isInspectMode()){ return; } + e.setCancelled(true); if (!fplayer.isAdminBypassing()){ + if (!fplayer.hasFaction()){ + fplayer.setInspectMode(false); + fplayer.msg(TL.COMMAND_INSPECT_DISABLED_NOFAC); + return; + } if (fplayer.getFaction() != Board.getInstance().getFactionAt(new FLocation(e.getPlayer().getLocation()))){ fplayer.msg(TL.COMMAND_INSPECT_NOTINCLAIM); return; diff --git a/src/main/java/com/massivecraft/factions/scoreboards/BufferedObjective.java b/src/main/java/com/massivecraft/factions/scoreboards/BufferedObjective.java index dd4f6342..5f69c135 100644 --- a/src/main/java/com/massivecraft/factions/scoreboards/BufferedObjective.java +++ b/src/main/java/com/massivecraft/factions/scoreboards/BufferedObjective.java @@ -162,4 +162,4 @@ public class BufferedObjective { private String getNextTeamName() { return baseName.substring(0, 10) + "_" + ((teamPtr++) % 999999); } -} +} \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java b/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java index edeafe47..f1626c26 100644 --- a/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java +++ b/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java @@ -146,4 +146,4 @@ public class FScoreboard { bufferedObjective.flip(); } } -} +} \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/scoreboards/FTeamWrapper.java b/src/main/java/com/massivecraft/factions/scoreboards/FTeamWrapper.java index 120af283..8ac6a541 100644 --- a/src/main/java/com/massivecraft/factions/scoreboards/FTeamWrapper.java +++ b/src/main/java/com/massivecraft/factions/scoreboards/FTeamWrapper.java @@ -204,4 +204,3 @@ public class FTeamWrapper { teams.clear(); } } - diff --git a/src/main/java/com/massivecraft/factions/struct/Permission.java b/src/main/java/com/massivecraft/factions/struct/Permission.java index 9834d58d..9b40475c 100644 --- a/src/main/java/com/massivecraft/factions/struct/Permission.java +++ b/src/main/java/com/massivecraft/factions/struct/Permission.java @@ -99,6 +99,7 @@ public enum Permission { TPBANNER("tpbanner"), KILLHOLOS("killholos"), INSPECT("inspect"), + TNTFILL("tntfill"), WARP("warp"); public final String node; diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java index 5a74775e..b922f4ad 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java @@ -250,6 +250,8 @@ public abstract class MemoryBoard extends Board { ArrayList ret = new ArrayList<>(); Faction factionLoc = getFactionAt(flocation); ret.add(new FancyMessage(P.p.txt.titleize("(" + flocation.getCoordString() + ") " + factionLoc.getTag(fplayer)))); + int buffer = P.p.getConfig().getInt("world-border.buffer", 0); + // Get the compass ArrayList asciiCompass = AsciiCompass.getAsciiCompass(inDegrees, ChatColor.RED, P.p.txt.parse("")); @@ -283,7 +285,9 @@ public abstract class MemoryBoard extends Board { FLocation flocationHere = topLeft.getRelative(dx, dz); Faction factionHere = getFactionAt(flocationHere); Relation relation = fplayer.getRelationTo(factionHere); - if (factionHere.isWilderness()) { + if (flocationHere.isOutsideWorldBorder(buffer)){ + row.then("-").color(ChatColor.BLACK).tooltip(TL.CLAIM_MAP_OUTSIDEBORDER.toString()); + } else if (factionHere.isWilderness()) { row.then("-").color(Conf.colorWilderness); // Lol someone didnt add the x and z making it claim the wrong position Can i copyright this xD if (fplayer.getPlayer().hasPermission(Permission.CLAIMAT.node)) { 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 77331c2e..f864092b 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java @@ -724,7 +724,10 @@ public abstract class MemoryFPlayer implements FPlayer { if (Conf.worldGuardChecking && Worldguard.checkForRegionsInChunk(flocation)) { // Checks for WorldGuard regions in the chunk attempting to be claimed error = P.p.txt.parse(TL.CLAIM_PROTECTED.toString()); - } else if (Conf.worldsNoClaiming.contains(flocation.getWorldName())) { + } else if(flocation.isOutsideWorldBorder(P.p.getConfig().getInt("world-border.buffer", 0))){ + error = P.p.txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString()); + } + else if (Conf.worldsNoClaiming.contains(flocation.getWorldName())) { error = P.p.txt.parse(TL.CLAIM_DISABLED.toString()); } else if (this.isAdminBypassing()) { return true; 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 55d3386c..c5d60edc 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TL.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TL.java @@ -310,6 +310,7 @@ public enum TL { COMMAND_HOME_DESCRIPTION("Teleport to the faction home"), COMMAND_INSPECT_DISABLED("&c&l[!]&7 Inspect mode is now &cdisabled."), + COMMAND_INSPECT_DISABLED_NOFAC("&c&l[!]&7 Inspect mode is now &cdisabled,&7 because you &cdo not have a faction!"), COMMAND_INSPECT_ENABLED("&c&l[!]&7 Inspect mode is now &aEnabled."), COMMAND_INSPECT_HEADER("&c&m---&7Inspect Data&c&m---&c//&7x:{x},y:{y},z:{z}"), COMMAND_INSPECT_ROW("&c{time} &7// &c{action} &7// &c{player} &7// &c{block-type}"), @@ -660,6 +661,7 @@ public enum TL { COMMAND_TNT_POSITIVE("&cPlease use positive numbers!"), COMMAND_TNT_DESCRIPTION("add/widthraw from faction's tnt bank"), + COMMAND_UNBAN_DESCRIPTION("Unban someone from your Faction"), COMMAND_UNBAN_NOTBANNED("&7%s &cisn't banned. Not doing anything."), COMMAND_UNBAN_UNBANNED("&e%1$s &cunbanned &7%2$s"), @@ -748,6 +750,7 @@ public enum TL { CLAIM_OUTSIDEWORLDBORDER("Your claim is outside the border."), CLAIM_OUTSIDEBORDERBUFFER("Your claim is outside the border. %d chunks away world edge required."), CLAIM_CLICK_TO_CLAIM("Click to try to claim &2(%1$d, %2$d)"), + CLAIM_MAP_OUTSIDEBORDER("&cThis claim is outside the worldborder!"), CLAIM_YOUAREHERE("You are here"), /** @@ -898,7 +901,7 @@ public enum TL { FACTION_LEAVE("faction-leave", "Leaving %1$s, Entering %2$s"), FACTIONS_ANNOUNCEMENT_TOP("faction-announcement-top", "&d--Unread Faction Announcements--"), FACTIONS_ANNOUNCEMENT_BOTTOM("faction-announcement-bottom", "&d--Unread Faction Announcements--"), - DEFAULT_PREFIX("default-prefix", "{relationcolor}[{faction}] &r"), + DEFAULT_PREFIX("default-prefix", "{relationcolor}[{faction}] &r {player-name}"), FACTION_LOGIN("faction-login", "&e%1$s &9logged in."), FACTION_LOGOUT("faction-logout", "&e%1$s &9logged out.."), NOFACTION_PREFIX("nofactions-prefix", "&6[&a4-&6]&r"), diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d91acb24..ad9611c1 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: Factions -version: ${project.version}-SF-1.0.23-BETA +version: ${project.version}-SF-1.1-STABLE main: com.massivecraft.factions.P authors: [Olof Larsson, Brett Flannigan, drtshock, ProSavage] softdepend: [CoreProtect, PlayerVaults, PlaceholderAPI, MVdWPlaceholderAPI, PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, CAPI, AuthMe, Vault, Spout, WorldEdit, WorldGuard, AuthDB, CaptureThePoints, CombatTag, dynmap, FactionsTop]