Alt Placeholders & Remove Creeper Anti Glitch (SaberCoreX has this module)

This commit is contained in:
Driftay 2020-04-04 07:48:25 -04:00
parent af1ee43771
commit 97b6c75ffa
5 changed files with 15 additions and 16 deletions

View File

@ -156,7 +156,6 @@ public class Conf {
public static boolean logPlayerCommands = true; public static boolean logPlayerCommands = true;
// prevent some potential exploits // prevent some potential exploits
public static boolean denyFlightIfInNoClaimingWorld = false; public static boolean denyFlightIfInNoClaimingWorld = false;
public static boolean preventCreeperGlitch = true;
public static boolean handleExploitObsidianGenerators = true; public static boolean handleExploitObsidianGenerators = true;
public static boolean handleExploitEnderPearlClipping = true; public static boolean handleExploitEnderPearlClipping = true;
public static boolean handleExploitInteractionSpam = true; public static boolean handleExploitInteractionSpam = true;

View File

@ -35,18 +35,6 @@ public class FactionsEntityListener implements Listener {
private static final Set<PotionEffectType> badPotionEffects = new LinkedHashSet<>(Arrays.asList(PotionEffectType.BLINDNESS, PotionEffectType.CONFUSION, PotionEffectType.HARM, PotionEffectType.HUNGER, PotionEffectType.POISON, PotionEffectType.SLOW, PotionEffectType.SLOW_DIGGING, PotionEffectType.WEAKNESS, PotionEffectType.WITHER)); private static final Set<PotionEffectType> 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) @EventHandler(priority = EventPriority.NORMAL)
public void onEntityDeath(EntityDeathEvent event) { public void onEntityDeath(EntityDeathEvent event) {

View File

@ -128,6 +128,8 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
return TL.sdf.format(faction.getFoundedDate()); return TL.sdf.format(faction.getFoundedDate());
case "faction_joining": case "faction_joining":
return (faction.getOpen() ? TL.COMMAND_SHOW_UNINVITED.toString() : TL.COMMAND_SHOW_INVITATION.toString()); 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": case "faction_strikes":
return fPlayer.hasFaction() ? String.valueOf(faction.getStrikes()) : "0"; return fPlayer.hasFaction() ? String.valueOf(faction.getStrikes()) : "0";
case "faction_peaceful": case "faction_peaceful":
@ -208,7 +210,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
case "faction_relation_color": case "faction_relation_color":
return fPlayer.getColorTo(faction).toString(); return fPlayer.getColorTo(faction).toString();
case "faction_grace": case "faction_grace":
return String.valueOf(Conf.gracePeriod); return Conf.gracePeriod ? "Enabled" : "Disabled";
case "faction_name_at_location": case "faction_name_at_location":
Faction factionAtLocation = Board.getInstance().getFactionAt(new FLocation(player.getLocation())); Faction factionAtLocation = Board.getInstance().getFactionAt(new FLocation(player.getLocation()));
return factionAtLocation != null ? factionAtLocation.getTag() : Factions.getInstance().getWilderness().getTag(); return factionAtLocation != null ? factionAtLocation.getTag() : Factions.getInstance().getWilderness().getTag();

View File

@ -840,8 +840,8 @@ public enum TL {
COMMAND_LOGOUT_DAMAGE_TAKEN("&c&l[!] &7Your logout was cancelled because you were damaged!"), 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_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_ON("&c&l[!] &7You will &anow see &7claimed land notifications!"),
COMMAND_NOTIFICATIONS_TOGGLED_OFF("&c&l[!] &7You will no longer see claimed 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_NOTIFICATIONS_DESCRIPTION("Toggle notifications for land claiming"),
COMMAND_SHOW_NOFACTION_SELF("You are not in a faction"), COMMAND_SHOW_NOFACTION_SELF("You are not in a faction"),

View File

@ -67,6 +67,7 @@ public enum TagReplacer {
ALLIES_COUNT(TagType.FACTION, "{allies}"), ALLIES_COUNT(TagType.FACTION, "{allies}"),
ENEMIES_COUNT(TagType.FACTION, "{enemies}"), ENEMIES_COUNT(TagType.FACTION, "{enemies}"),
TRUCES_COUNT(TagType.FACTION, "{truces}"), TRUCES_COUNT(TagType.FACTION, "{truces}"),
ALT_COUNT(TagType.FACTION, "{alt-count}"),
ONLINE_COUNT(TagType.FACTION, "{online}"), ONLINE_COUNT(TagType.FACTION, "{online}"),
OFFLINE_COUNT(TagType.FACTION, "{offline}"), OFFLINE_COUNT(TagType.FACTION, "{offline}"),
FACTION_SIZE(TagType.FACTION, "{members}"), FACTION_SIZE(TagType.FACTION, "{members}"),
@ -76,11 +77,13 @@ public enum TagReplacer {
FACTION_STRIKES(TagType.FACTION, "{strikes}"), FACTION_STRIKES(TagType.FACTION, "{strikes}"),
FACTION_POINTS(TagType.FACTION, "{faction-points}"), FACTION_POINTS(TagType.FACTION, "{faction-points}"),
/** /**
* General variables, require no faction or player * General variables, require no faction or player
*/ */
MAX_WARPS(TagType.GENERAL, "{max-warps}"), MAX_WARPS(TagType.GENERAL, "{max-warps}"),
MAX_ALLIES(TagType.GENERAL, "{max-allies}"), MAX_ALLIES(TagType.GENERAL, "{max-allies}"),
MAX_ALTS(TagType.GENERAL, "{max-alts}"),
MAX_ENEMIES(TagType.GENERAL, "{max-enemies}"), MAX_ENEMIES(TagType.GENERAL, "{max-enemies}"),
MAX_TRUCES(TagType.GENERAL, "{max-truces}"), MAX_TRUCES(TagType.GENERAL, "{max-truces}"),
FACTIONLESS(TagType.GENERAL, "{factionless}"), FACTIONLESS(TagType.GENERAL, "{factionless}"),
@ -130,6 +133,11 @@ public enum TagReplacer {
return String.valueOf(FactionsPlugin.getInstance().getConfig().getInt("max-relations.ally", 10)); return String.valueOf(FactionsPlugin.getInstance().getConfig().getInt("max-relations.ally", 10));
} }
return TL.GENERIC_INFINITY.toString(); 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: case MAX_ENEMIES:
if (FactionsPlugin.getInstance().getConfig().getBoolean("max-relations.enabled", true)) { if (FactionsPlugin.getInstance().getConfig().getBoolean("max-relations.enabled", true)) {
return String.valueOf(FactionsPlugin.getInstance().getConfig().getInt("max-relations.enemy", 10)); 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)); return String.valueOf(fac.getRelationCount(Relation.ENEMY));
case TRUCES_COUNT: case TRUCES_COUNT:
return String.valueOf(fac.getRelationCount(Relation.TRUCE)); return String.valueOf(fac.getRelationCount(Relation.TRUCE));
case ALT_COUNT:
return String.valueOf(fac.getAltPlayers().size());
case ONLINE_COUNT: case ONLINE_COUNT:
if (fp != null && fp.isOnline()) { if (fp != null && fp.isOnline()) {
return String.valueOf(fac.getFPlayersWhereOnline(true, fp).size()); return String.valueOf(fac.getFPlayersWhereOnline(true, fp).size());