Browse Source

XP Gain from Roll has a CD now (60 seconds)

nossr50 6 years ago
parent
commit
e40a7bb4e1

+ 12 - 5
Changelog.txt

@@ -7,12 +7,19 @@ Key:
   ! Change
   - Removal
 
+Version 2.1.21
+    Improved anti-farm/anti-grinding mechanics for Rolling
+    When you gain XP from Rolling there is a cooldown period (60~ seconds) for gaining XP again
+    This XP cooldown period extends if players are taking fall damage within the cooldown period
+        NOTE: Roll already has a few built in measures to prevent XP grinding / abuse, those are still the same.
+        NOTE: Rolls still happen in the cooldown period, you just won't gain XP.
+
 Version 2.1.20
-    Added Hungarian localization (Locale code: hu_HU) (thanks andris155)
-    Players can now fish in the same spot about 3 times before mcMMO will mark the area as being over-fished (over-fishing is to prevent abuse)
-    Added a toggle to turn off the fishing exploit detection to experience.yml "ExploitFix.Fishing"
-        Note: The new config update is coming soon and will use a different setting, putting this out as a band-aid fix for people that don't like the new fishing exploit prevention stuff
-    Added a message to warn players that their next fishing attempt will result in over-fishing (Locale: Fishing.LowResources)
+Added Hungarian localization (Locale code: hu_HU) (thanks andris155)
+Players can now fish in the same spot about 3 times before mcMMO will mark the area as being over-fished (over-fishing is to prevent abuse)
+Added a toggle to turn off the fishing exploit detection to experience.yml "ExploitFix.Fishing"
+    Note: The new config update is coming soon and will use a different setting, putting this out as a band-aid fix for people that don't like the new fishing exploit prevention stuff
+Added a message to warn players that their next fishing attempt will result in over-fishing (Locale: Fishing.LowResources)
 
 Version 2.1.19
     Greatly Improved Fishing AFK/Exploit Detection

+ 1 - 1
pom.xml

@@ -2,7 +2,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.gmail.nossr50.mcMMO</groupId>
     <artifactId>mcMMO</artifactId>
-    <version>2.1.20</version>
+    <version>2.1.21</version>
     <name>mcMMO</name>
     <url>https://github.com/mcMMO-Dev/mcMMO</url>
     <scm>

+ 4 - 4
src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java

@@ -210,7 +210,7 @@ public class Roll extends AcrobaticsSubSkill {
             //player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text"));
 
             //if (!SkillUtils.cooldownExpired((long) mcMMOPlayer.getTeleportATS(), Config.getInstance().getXPAfterTeleportCooldown())) {
-            if(!isExploiting(player))
+            if(!isExploiting(player) && mcMMOPlayer.getAcrobaticsManager().canGainRollXP())
                 SkillUtils.applyXpGain(mcMMOPlayer, getPrimarySkill(), calculateRollXP(player, damage, true), XPGainReason.PVE);
             //}
 
@@ -219,7 +219,7 @@ public class Roll extends AcrobaticsSubSkill {
         }
         else if (!isFatal(player, damage)) {
             //if (!SkillUtils.cooldownExpired((long) mcMMOPlayer.getTeleportATS(), Config.getInstance().getXPAfterTeleportCooldown())) {
-            if(!isExploiting(player))
+            if(!isExploiting(player) && mcMMOPlayer.getAcrobaticsManager().canGainRollXP())
                 SkillUtils.applyXpGain(mcMMOPlayer, getPrimarySkill(), calculateRollXP(player, damage, false), XPGainReason.PVE);
             //}
         }
@@ -249,14 +249,14 @@ public class Roll extends AcrobaticsSubSkill {
         {
             NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Acrobatics.Ability.Proc");
             SoundManager.sendCategorizedSound(player, player.getLocation(), SoundType.ROLL_ACTIVATED, SoundCategory.PLAYERS,0.5F);
-            if(!isExploiting(player))
+            if(!isExploiting(player) && mcMMOPlayer.getAcrobaticsManager().canGainRollXP())
                 SkillUtils.applyXpGain(mcMMOPlayer, getPrimarySkill(), calculateRollXP(player, damage, true), XPGainReason.PVE);
 
             addFallLocation(player);
             return modifiedDamage;
         }
         else if (!isFatal(player, damage)) {
-            if(!isExploiting(player))
+            if(!isExploiting(player) && mcMMOPlayer.getAcrobaticsManager().canGainRollXP())
                 SkillUtils.applyXpGain(mcMMOPlayer, getPrimarySkill(), calculateRollXP(player, damage, false), XPGainReason.PVE);
             
             addFallLocation(player);

+ 18 - 0
src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java

@@ -24,6 +24,24 @@ public class AcrobaticsManager extends SkillManager {
         super(mcMMOPlayer, PrimarySkillType.ACROBATICS);
     }
 
+    private long rollXPCooldown = 0;
+    private long rollXPInterval = (1000 * 60); //1 Minute
+    private long rollXPIntervalLengthen = (1000 * 10); //10 Seconds
+
+    public boolean canGainRollXP()
+    {
+        if(System.currentTimeMillis() >= rollXPCooldown)
+        {
+            rollXPCooldown = System.currentTimeMillis() + rollXPInterval;
+            rollXPIntervalLengthen = (1000 * 10); //5 Seconds
+            return true;
+        } else {
+            rollXPCooldown += rollXPIntervalLengthen;
+            rollXPIntervalLengthen += 1000; //Add another second to the next penalty
+            return false;
+        }
+    }
+
     public boolean canDodge(Entity damager) {
         if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ACROBATICS_DODGE))
             return false;