diff --git a/Changelog.txt b/Changelog.txt index bb63ccd77..8e52d104e 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -10,6 +10,9 @@ Key: Version 2.2.0 mcMMO's config system has been rewritten Parties no longer have a cap, you can level them forever for bragging rights + Optimizations were made for many anti-exploit behaviours + Acrobatic's Dodge will no longer reward XP for a few seconds after a TP + Roll will not give XP for a few seconds after a TP You can now disable the party system completely Many config files are now generated on demand instead of being copied from within the JAR All config nodes that used to be styled with CamelCase or otherwise now use hyphens (-) as spaces for readability and consistency @@ -131,7 +134,7 @@ Version 2.2.0 Update_Check, Prefer_Beta Removed the following config settings for being unwanted - Config_Update_Overwrite + Config_Update_Overwrite, Tool_Mods_Enabled, Armor_Mods_Enabled, Block_Mods_Enabled, Entity_Mods_Enabled API Changes Added API method to check if player parties are size capped diff --git a/src/main/java/com/gmail/nossr50/config/hocon/antiexploit/ConfigSectionExploitAcrobatics.java b/src/main/java/com/gmail/nossr50/config/hocon/antiexploit/ConfigSectionExploitAcrobatics.java index 4758a93c6..ccd243bec 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/antiexploit/ConfigSectionExploitAcrobatics.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/antiexploit/ConfigSectionExploitAcrobatics.java @@ -8,6 +8,7 @@ public class ConfigSectionExploitAcrobatics { public static final int ACROBATIC_LOCATION_LIMIT_DEFAULT = 50; public static final boolean PREVENT_ACROBATICS_ABUSE_DEFAULT = true; + public static final int TELEPORT_COOLDOWN_DEFAULT = 30; @Setting(value = "Player-Fall-Location-Tracking", comment = "The amount of locations to keep track of for player falls." + @@ -27,6 +28,14 @@ public class ConfigSectionExploitAcrobatics { "\nDefault value: "+PREVENT_ACROBATICS_ABUSE_DEFAULT) private boolean preventAcrobaticsAbuse = PREVENT_ACROBATICS_ABUSE_DEFAULT; + @Setting(value = "No-XP-After-Teleporting-Cooldown-In-Seconds", comment = "Prevents XP gains for Acrobatics for a set period of time after teleporting." + + "\nDefault value: "+TELEPORT_COOLDOWN_DEFAULT) + private int teleportCooldownSeconds = TELEPORT_COOLDOWN_DEFAULT; + + public int getTeleportCooldownSeconds() { + return teleportCooldownSeconds; + } + public int getAcrobaticLocationLimit() { return acrobaticLocationLimit; } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/superabilities/ConfigSuperAbilities.java b/src/main/java/com/gmail/nossr50/config/hocon/superabilities/ConfigSuperAbilities.java index 1869dac46..3f585ff12 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/superabilities/ConfigSuperAbilities.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/superabilities/ConfigSuperAbilities.java @@ -26,7 +26,7 @@ public class ConfigSuperAbilities { private ConfigSectionSuperAbilityCooldowns superAbilityCooldowns = new ConfigSectionSuperAbilityCooldowns(); @Setting(value = "Super-Ability-Max-Length", - comment = "The maximum amount of time a player can use a super ability." + + comment = "The maximum amount of time in seconds that a super ability can last." + "\nMost super abilities get longer as a player grows in skill.") private ConfigSectionSuperAbilityMaxLength superAbilityMaxLength = new ConfigSectionSuperAbilityMaxLength(); diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index 75b658a21..dd0d432ef 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -92,7 +92,7 @@ public class McMMOPlayer { private int recentlyHurt; private int respawnATS; - private int teleportATS; + private long teleportATS; private long databaseATS; //private int chimeraWingLastUse; private Location teleportCommence; @@ -388,12 +388,12 @@ public class McMMOPlayer { respawnATS = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR); } - public int getTeleportATS() { + public long getTeleportATS() { return teleportATS; } public void actualizeTeleportATS() { - teleportATS = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR); + teleportATS = System.currentTimeMillis() + (mcMMO.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().getTeleportCooldownSeconds() * 1000); } public long getDatabaseATS() { diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java index bf989a067..7777c3bad 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java @@ -285,6 +285,10 @@ public class Roll extends AcrobaticsSubSkill { return true; } + //Teleport CD + if(System.currentTimeMillis() < UserManager.getPlayer(player).getTeleportATS()) + return true; + if(fallLocationMap.get(player) == null) fallLocationMap.put(player, new LimitedSizeList(mcMMO.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().getAcrobaticLocationLimit())); diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index deeabeb5f..a8a517e18 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -77,11 +77,12 @@ public class PlayerListener implements Listener { return; } - if (!UserManager.hasPlayerDataKey(player) || MainConfig.getInstance().getXPAfterTeleportCooldown() <= 0 || event.getFrom().equals(event.getTo())) { + if (!UserManager.hasPlayerDataKey(player) || event.getFrom().equals(event.getTo())) { return; } - UserManager.getPlayer(player).actualizeTeleportATS(); + if(mcMMO.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().isPreventAcrobaticsAbuse()) + UserManager.getPlayer(player).actualizeTeleportATS(); } /** diff --git a/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java b/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java index 2cd3ff8d3..0902ede1d 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java @@ -78,7 +78,8 @@ public class AcrobaticsManager extends SkillManager { //Check respawn to prevent abuse if(!mcMMO.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().isPreventAcrobaticsAbuse()) applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVP); - else if (SkillUtils.cooldownExpired(mcMMOPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)) { + else if (SkillUtils.cooldownExpired(mcMMOPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS) + && mcMMOPlayer.getTeleportATS() < System.currentTimeMillis()) { applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVP); }