forked from Upstream/mmocore
This fixes the deprecated setSkillCasting, and also fixes the casting-timeout system to use the latest action, whether its the casting mode enter or the casting skill action.
This commit is contained in:
parent
385f554116
commit
99dbb95b63
@ -23,7 +23,9 @@ public enum PlayerActivity {
|
|||||||
|
|
||||||
CAST_SKILL(() -> MMOCore.plugin.configManager.globalSkillCooldown),
|
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<Long> timeout;
|
private final Provider<Long> timeout;
|
||||||
|
|
||||||
|
@ -1052,10 +1052,14 @@ public class PlayerData extends SynchronizedDataHolder implements OfflinePlayerD
|
|||||||
|
|
||||||
skillCasting.close();
|
skillCasting.close();
|
||||||
this.skillCasting = null;
|
this.skillCasting = null;
|
||||||
|
setLastActivity(PlayerActivity.EXIT_CASTING);
|
||||||
setLastActivity(PlayerActivity.ACTION_BAR_MESSAGE, 0); // Reset action bar
|
setLastActivity(PlayerActivity.ACTION_BAR_MESSAGE, 0); // Reset action bar
|
||||||
return true;
|
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() {
|
public boolean isCastingTimeoutExpired() {
|
||||||
if (MMOCore.plugin.configManager.castingTimeoutTime <= 0) return false;
|
if (MMOCore.plugin.configManager.castingTimeoutTime <= 0) return false;
|
||||||
if (!isCasting()) return false;
|
if (!isCasting()) return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user