mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-28 03:34:43 +02:00
Add diminished returns when a player has earned too much XP
When a player reaches a certain (configurable) threshold value of total XP earned in a specific skill, his earned XP in this skill will be decreased. Depending on how far the player has exceeded the threshold value, his XP will decrease more. After the (configurable) time interval of 10 minutes, the registered data will be cleared and the player can earn XP as normal again.
This commit is contained in:
@ -0,0 +1,21 @@
|
||||
package com.gmail.nossr50.runnables.player;
|
||||
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class ClearRegisteredXPGainTask extends BukkitRunnable {
|
||||
@Override
|
||||
public void run() {
|
||||
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
if (skillType.isChildSkill()) {
|
||||
continue;
|
||||
}
|
||||
mcMMOPlayer.getProfile().setRegisteredXpGain(skillType, 0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user