diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerActivity.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerActivity.java index 5c602d0a..877da39d 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerActivity.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerActivity.java @@ -23,7 +23,9 @@ public enum PlayerActivity { CAST_SKILL(() -> MMOCore.plugin.configManager.globalSkillCooldown), - ENTER_CASTING(null); + //Added by Kilo for the Timeout System (ENTER_CASTING). The EXIT_CASTING is unused, but tracked. + ENTER_CASTING(null), + EXIT_CASTING(null); private final Provider timeout; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index 0616392b..1c918f79 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -1052,10 +1052,14 @@ public class PlayerData extends SynchronizedDataHolder implements OfflinePlayerD skillCasting.close(); this.skillCasting = null; + setLastActivity(PlayerActivity.EXIT_CASTING); setLastActivity(PlayerActivity.ACTION_BAR_MESSAGE, 0); // Reset action bar return true; } + /** + * @return if the "skill-casting.timeout" integer (second) is less than the most recent event beteen CAST_SKILL and ENTER_CASTING, it chooses the most recent one as its comparison. This is used for the timeout of casting. Returns false if the value is 0 or if the player is not casting. + */ public boolean isCastingTimeoutExpired() { if (MMOCore.plugin.configManager.castingTimeoutTime <= 0) return false; if (!isCasting()) return false;