mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Diff cleanup
This commit is contained in:
parent
d27f668a2e
commit
1b17b90f32
@ -72,14 +72,11 @@ public class MctopCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
private void display(int page, String skill, CommandSender sender, boolean sql, Command command) {
|
||||
|
||||
|
||||
|
||||
|
||||
if (!skill.equalsIgnoreCase("all") && !Permissions.mctop(sender, SkillType.getSkill(skill))) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
if (sql) {
|
||||
if (skill.equalsIgnoreCase("all")) {
|
||||
sqlDisplay(page, "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing", sender);
|
||||
@ -131,4 +128,3 @@ public class MctopCommand implements CommandExecutor {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@ package com.gmail.nossr50.database.queuemanager;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
public class AsyncQueueManager implements Runnable {
|
||||
|
||||
private LinkedBlockingQueue<Queueable> queue;
|
||||
private boolean running;
|
||||
|
||||
@ -11,7 +10,6 @@ public class AsyncQueueManager implements Runnable {
|
||||
this.queue = new LinkedBlockingQueue<Queueable>();
|
||||
this.running = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@ -32,29 +30,33 @@ public class AsyncQueueManager implements Runnable {
|
||||
return queue.contains(new EqualString(player));
|
||||
}
|
||||
|
||||
private class EqualString {
|
||||
private String player;
|
||||
public EqualString(String player) {
|
||||
this.player = player;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof Queueable) {
|
||||
return ((Queueable)obj).getPlayer().equalsIgnoreCase(player);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void disable() {
|
||||
running = false;
|
||||
// Throw one more Queueable into queue to unblock take()
|
||||
queue.add(new EndThread());
|
||||
}
|
||||
|
||||
private class EqualString {
|
||||
private String player;
|
||||
|
||||
public EqualString(String player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof Queueable) {
|
||||
return ((Queueable)obj).getPlayer().equalsIgnoreCase(player);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private class EndThread implements Queueable {
|
||||
@Override
|
||||
public void run() { }
|
||||
|
||||
@Override
|
||||
public String getPlayer() { return null; }
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package com.gmail.nossr50.database.queuemanager;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@ -22,10 +21,11 @@ public class McRankAsync implements Queueable {
|
||||
this.player = sender.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final Map<String, Integer> skills = DatabaseManager.readSQLRank(playerName);
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
|
||||
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Heading"));
|
||||
|
@ -3,7 +3,6 @@ package com.gmail.nossr50.database.queuemanager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@ -27,15 +26,17 @@ public class McTopAsync implements Queueable {
|
||||
this.player = sender.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
String tablePrefix = Config.getInstance().getMySQLTablePrefix();
|
||||
final HashMap<Integer, ArrayList<String>> userslist = DatabaseManager.read("SELECT " + query + ", user, NOW() FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON (user_id = id) WHERE " + query + " > 0 ORDER BY " + query + " DESC, user LIMIT " + ((page * 10) - 10) + ",10");
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
|
||||
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (query.equals("taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing")) {
|
||||
if (query.equalsIgnoreCase("taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing")) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", StringUtils.getCapitalized(query)));
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.gmail.nossr50.database.queuemanager;
|
||||
|
||||
public interface Queueable {
|
||||
public void run();
|
||||
public String getPlayer();
|
||||
public void run();
|
||||
public String getPlayer();
|
||||
}
|
||||
|
@ -91,7 +91,6 @@ public class mcMMO extends JavaPlugin {
|
||||
// XP Event Check
|
||||
private boolean xpEventEnabled = false;
|
||||
|
||||
|
||||
// Metadata Values
|
||||
public static FixedMetadataValue metadataValue;
|
||||
public final static String entityMetadataKey = "mcMMO: Spawned Entity";
|
||||
|
Loading…
Reference in New Issue
Block a user