New and Improved Scoreboard System

- Scoreboards now AUTO-UPDATE
 - Scoreboards now COME IN COLOR
 - If you want, they can come in EVERY COLOR (Config setting)
 - Scoreboards can be displayed alongside chat output!
 - Prevention of denial of service to SQL via spamming /mctop using a cooldown
 - Added /mccooldown command to show cooldowns for all available skills
This commit is contained in:
riking
2013-09-11 19:42:27 -07:00
parent 89dabaeb43
commit 95f15e68fe
33 changed files with 1539 additions and 590 deletions

View File

@@ -2,25 +2,34 @@ package com.gmail.nossr50.runnables.commands;
import java.util.Map;
import org.apache.commons.lang.Validate;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.skills.SkillType;
public class McrankCommandAsyncTask extends BukkitRunnable {
private final String playerName;
private final CommandSender sender;
private final boolean useBoard, useChat;
public McrankCommandAsyncTask(String playerName, CommandSender sender) {
public McrankCommandAsyncTask(String playerName, CommandSender sender, boolean useBoard, boolean useChat) {
Validate.isTrue(useBoard || useChat, "Attempted to start a rank retrieval with both board and chat off");
Validate.notNull(sender, "Attempted to start a rank retrieval with no recipient");
if (useBoard) Validate.isTrue(sender instanceof Player, "Attempted to start a rank retrieval displaying scoreboard to a non-player");
this.playerName = playerName;
this.sender = sender;
this.useBoard = useBoard;
this.useChat = useChat;
}
@Override
public void run() {
Map<String, Integer> skills = mcMMO.getDatabaseManager().readRank(playerName);
Map<SkillType, Integer> skills = mcMMO.getDatabaseManager().readRank(playerName);
new McrankCommandDisplayTask(skills, sender, playerName).runTaskLater(mcMMO.p, 1);
new McrankCommandDisplayTask(skills, sender, playerName, useBoard, useChat).runTaskLater(mcMMO.p, 1);
}
}