mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 14:16:45 +01:00
339a54b0ac
optimize our tool and ability cooldown tracking and hopefully reduce server load.
31 lines
831 B
Java
31 lines
831 B
Java
package com.gmail.nossr50.runnables.skills;
|
|
|
|
import org.bukkit.scheduler.BukkitRunnable;
|
|
|
|
import com.gmail.nossr50.config.Config;
|
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|
import com.gmail.nossr50.datatypes.skills.ToolType;
|
|
|
|
public class ToolLowerTask extends BukkitRunnable {
|
|
private McMMOPlayer mcMMOPlayer;
|
|
private ToolType tool;
|
|
|
|
public ToolLowerTask(McMMOPlayer mcMMOPlayer, ToolType tool) {
|
|
this.mcMMOPlayer = mcMMOPlayer;
|
|
this.tool = tool;
|
|
}
|
|
|
|
@Override
|
|
public void run() {
|
|
if (!mcMMOPlayer.getToolPreparationMode(tool)) {
|
|
return;
|
|
}
|
|
|
|
mcMMOPlayer.setToolPreparationMode(tool, false);
|
|
|
|
if (Config.getInstance().getAbilityMessagesEnabled()) {
|
|
mcMMOPlayer.getPlayer().sendMessage(tool.getLowerTool());
|
|
}
|
|
}
|
|
}
|