Use cached thread rather than create a new one for /questadmin pointsall

This commit is contained in:
PikaMug 2020-01-20 02:46:45 -05:00
parent e8f15411c7
commit 3e42dcbc33

View File

@ -1050,8 +1050,11 @@ public class CmdExecutor implements CommandExecutor {
cs.sendMessage(ChatColor.RED + Lang.get("inputNum"));
return;
}
Thread thread = new Thread(new Runnable() {
cs.sendMessage(ChatColor.YELLOW + Lang.get("settingAllQuestPoints"));
for (Quester q : plugin.getQuesters()) {
q.setQuestPoints(amount);
}
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
File questerFolder = new File(plugin.getDataFolder(), "data");
@ -1102,11 +1105,6 @@ public class CmdExecutor implements CommandExecutor {
}
}
});
cs.sendMessage(ChatColor.YELLOW + Lang.get("settingAllQuestPoints"));
for (Quester q : plugin.getQuesters()) {
q.setQuestPoints(amount);
}
thread.start();
} else {
cs.sendMessage(ChatColor.RED + Lang.get("noPermission"));
}