From 97b6c75ffad2e0a8f6ca7bdf260783fe904bcf19 Mon Sep 17 00:00:00 2001 From: Driftay Date: Sat, 4 Apr 2020 07:48:25 -0400 Subject: [PATCH] Alt Placeholders & Remove Creeper Anti Glitch (SaberCoreX has this module) --- src/main/java/com/massivecraft/factions/Conf.java | 1 - .../factions/listeners/FactionsEntityListener.java | 12 ------------ .../factions/util/ClipPlaceholderAPIManager.java | 4 +++- .../com/massivecraft/factions/zcore/util/TL.java | 4 ++-- .../factions/zcore/util/TagReplacer.java | 10 ++++++++++ 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/Conf.java b/src/main/java/com/massivecraft/factions/Conf.java index 7b1a9529..3783a694 100644 --- a/src/main/java/com/massivecraft/factions/Conf.java +++ b/src/main/java/com/massivecraft/factions/Conf.java @@ -156,7 +156,6 @@ public class Conf { public static boolean logPlayerCommands = true; // prevent some potential exploits public static boolean denyFlightIfInNoClaimingWorld = false; - public static boolean preventCreeperGlitch = true; public static boolean handleExploitObsidianGenerators = true; public static boolean handleExploitEnderPearlClipping = true; public static boolean handleExploitInteractionSpam = true; diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java index 3d3e8fdd..5ee3b078 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -35,18 +35,6 @@ public class FactionsEntityListener implements Listener { private static final Set badPotionEffects = new LinkedHashSet<>(Arrays.asList(PotionEffectType.BLINDNESS, PotionEffectType.CONFUSION, PotionEffectType.HARM, PotionEffectType.HUNGER, PotionEffectType.POISON, PotionEffectType.SLOW, PotionEffectType.SLOW_DIGGING, PotionEffectType.WEAKNESS, PotionEffectType.WITHER)); - @EventHandler - public void onCreeperGlitch(EntityDamageEvent e) { - if (!Conf.preventCreeperGlitch) { - return; - } - if (!e.getEntity().getType().equals(EntityType.CREEPER)) { - return; - } - if (e.getCause().equals(EntityDamageEvent.DamageCause.DROWNING) || e.getCause().equals(EntityDamageEvent.DamageCause.SUFFOCATION)) { - e.getEntity().remove(); - } - } @EventHandler(priority = EventPriority.NORMAL) public void onEntityDeath(EntityDeathEvent event) { diff --git a/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java b/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java index 67fa2c73..696e685c 100644 --- a/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java +++ b/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java @@ -128,6 +128,8 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R return TL.sdf.format(faction.getFoundedDate()); case "faction_joining": return (faction.getOpen() ? TL.COMMAND_SHOW_UNINVITED.toString() : TL.COMMAND_SHOW_INVITATION.toString()); + case "faction_alt_count": + return String.valueOf(faction.getAltPlayers().size()); case "faction_strikes": return fPlayer.hasFaction() ? String.valueOf(faction.getStrikes()) : "0"; case "faction_peaceful": @@ -208,7 +210,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R case "faction_relation_color": return fPlayer.getColorTo(faction).toString(); case "faction_grace": - return String.valueOf(Conf.gracePeriod); + return Conf.gracePeriod ? "Enabled" : "Disabled"; 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/util/TL.java b/src/main/java/com/massivecraft/factions/zcore/util/TL.java index 069797a1..0404b871 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TL.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TL.java @@ -840,8 +840,8 @@ public enum TL { COMMAND_LOGOUT_DAMAGE_TAKEN("&c&l[!] &7Your logout was cancelled because you were damaged!"), COMMAND_LOGOUT_TELEPORTED("&c&l[!] &7Your logout was cancelled because you teleported!"), - COMMAND_NOTIFICATIONS_TOGGLED_ON("&c&l[!] &7You will now see claimed land notifications!"), - COMMAND_NOTIFICATIONS_TOGGLED_OFF("&c&l[!] &7You will no longer see claimed land notifications!"), + COMMAND_NOTIFICATIONS_TOGGLED_ON("&c&l[!] &7You will &anow see &7claimed land notifications!"), + COMMAND_NOTIFICATIONS_TOGGLED_OFF("&c&l[!] &7You will &cno longer see &7claimed land notifications!"), COMMAND_NOTIFICATIONS_DESCRIPTION("Toggle notifications for land claiming"), COMMAND_SHOW_NOFACTION_SELF("You are not in a faction"), diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TagReplacer.java b/src/main/java/com/massivecraft/factions/zcore/util/TagReplacer.java index 72ee09c7..e80d2d66 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TagReplacer.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TagReplacer.java @@ -67,6 +67,7 @@ public enum TagReplacer { ALLIES_COUNT(TagType.FACTION, "{allies}"), ENEMIES_COUNT(TagType.FACTION, "{enemies}"), TRUCES_COUNT(TagType.FACTION, "{truces}"), + ALT_COUNT(TagType.FACTION, "{alt-count}"), ONLINE_COUNT(TagType.FACTION, "{online}"), OFFLINE_COUNT(TagType.FACTION, "{offline}"), FACTION_SIZE(TagType.FACTION, "{members}"), @@ -76,11 +77,13 @@ public enum TagReplacer { FACTION_STRIKES(TagType.FACTION, "{strikes}"), FACTION_POINTS(TagType.FACTION, "{faction-points}"), + /** * General variables, require no faction or player */ MAX_WARPS(TagType.GENERAL, "{max-warps}"), MAX_ALLIES(TagType.GENERAL, "{max-allies}"), + MAX_ALTS(TagType.GENERAL, "{max-alts}"), MAX_ENEMIES(TagType.GENERAL, "{max-enemies}"), MAX_TRUCES(TagType.GENERAL, "{max-truces}"), FACTIONLESS(TagType.GENERAL, "{factionless}"), @@ -130,6 +133,11 @@ public enum TagReplacer { return String.valueOf(FactionsPlugin.getInstance().getConfig().getInt("max-relations.ally", 10)); } return TL.GENERIC_INFINITY.toString(); + case MAX_ALTS: + if(FactionsPlugin.getInstance().getConfig().getBoolean("f-alts.Enabled")){ + return String.valueOf(Conf.factionAltMemberLimit); + } + return TL.GENERIC_INFINITY.toString(); case MAX_ENEMIES: if (FactionsPlugin.getInstance().getConfig().getBoolean("max-relations.enabled", true)) { return String.valueOf(FactionsPlugin.getInstance().getConfig().getInt("max-relations.enemy", 10)); @@ -241,6 +249,8 @@ public enum TagReplacer { return String.valueOf(fac.getRelationCount(Relation.ENEMY)); case TRUCES_COUNT: return String.valueOf(fac.getRelationCount(Relation.TRUCE)); + case ALT_COUNT: + return String.valueOf(fac.getAltPlayers().size()); case ONLINE_COUNT: if (fp != null && fp.isOnline()) { return String.valueOf(fac.getFPlayersWhereOnline(true, fp).size());