Correction de bug de la file d'attente /staff
This commit is contained in:
parent
2a64175718
commit
0e00b9f660
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,3 +1,3 @@
|
||||
bin/*
|
||||
jar_export/*
|
||||
/bin/
|
||||
/jar_export/
|
||||
*Thumbs.db
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<jardesc>
|
||||
<jar path="PandacraftUtils/jar_export/PandacraftUtils-2.4.jar"/>
|
||||
<jar path="PandacraftUtils/jar_export/PandacraftUtils-2.5.jar"/>
|
||||
<options buildIfNeeded="true" compress="true" descriptionLocation="/PandacraftUtils/make_jar.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
|
||||
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
|
||||
<selectedProjects/>
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: PandacraftUtils
|
||||
main: net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils
|
||||
version: 2.4
|
||||
version: 2.5
|
||||
|
||||
|
||||
|
||||
|
@ -12,6 +12,7 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.simple_commands.me.CommandM
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.simple_commands.ping.CommandPing;
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.simple_commands.setblock.CommandSetblock;
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.simple_commands.speed_message.CommandSpeedMessage;
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.simple_commands.staff_player_help.CommandStaff;
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.spawntime.SpawnTimeManager;
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.survival_cuboid.CommandWandSelection;
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.system_analyzer.CommandSystem;
|
||||
@ -28,6 +29,7 @@ public class PandacraftUtils extends JavaPlugin {
|
||||
public CommandMe commandMe;
|
||||
public CommandSpeedMessage commandSpeedMessage;
|
||||
public CommandWandSelection commandWandSelection;
|
||||
public CommandStaff commandStaff;
|
||||
|
||||
|
||||
public SpawnTimeManager spawnTimeManager;
|
||||
@ -53,6 +55,7 @@ public class PandacraftUtils extends JavaPlugin {
|
||||
commandMe = new CommandMe(this);
|
||||
commandSpeedMessage = new CommandSpeedMessage(this); // messages rapides
|
||||
commandWandSelection = new CommandWandSelection(this);
|
||||
commandStaff = new CommandStaff(this);
|
||||
|
||||
spawnTimeManager = new SpawnTimeManager(this);
|
||||
chatAnalysisManager = new ChatAnalysisManager(this);
|
||||
|
@ -7,6 +7,7 @@ import java.util.Queue;
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
|
||||
import net.mc_pandacraft.java.util.TimeUtil;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@ -82,7 +83,7 @@ public class CommandStaff implements CommandExecutor, Listener {
|
||||
return true;
|
||||
}
|
||||
|
||||
playerQueue.add(new WaitingPlayer(((Player)sender).getName(), String.join(" ", args), ((Player)sender).getLocation()));
|
||||
playerQueue.add(new WaitingPlayer(((Player)sender).getName(), StringUtils.join(args, " "), ((Player)sender).getLocation()));
|
||||
updateScoreBoardWaitingList();
|
||||
sender.sendMessage(ChatColor.GREEN+"Veuillez maintenant patienter quelques instant, le temps que le staff traite le début de la file d'attente ;)");
|
||||
sender.sendMessage(ChatColor.GREEN+"Vous êtes à la position "+getPlayerPosition((Player)sender)+" de la file d'attente");
|
||||
@ -156,9 +157,9 @@ public class CommandStaff implements CommandExecutor, Listener {
|
||||
((Player)sender).teleport(p.getLocation());
|
||||
sender.sendMessage(ChatColor.GREEN+"-----------------------------------------------");
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN+"-----------------------------------------------");
|
||||
p.sendMessage(ChatColor.GREEN+"-----------------------------------------------");
|
||||
p.sendMessage(((Player)sender).getDisplayName()+ChatColor.RESET+ChatColor.GREEN+" s'occupe maintenant de vous :)");
|
||||
sender.sendMessage(ChatColor.GREEN+"-----------------------------------------------");
|
||||
p.sendMessage(ChatColor.GREEN+"-----------------------------------------------");
|
||||
|
||||
}
|
||||
else {
|
||||
@ -168,10 +169,6 @@ public class CommandStaff implements CommandExecutor, Listener {
|
||||
sender.sendMessage(ChatColor.GREEN+"Vous avez été téléporté vers l'endroit concerné par la demande du joueur");
|
||||
((Player)sender).teleport(wp.getLocation());
|
||||
sender.sendMessage(ChatColor.GREEN+"-----------------------------------------------");
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN+"-----------------------------------------------");
|
||||
p.sendMessage(((Player)sender).getDisplayName()+ChatColor.RESET+ChatColor.GREEN+" s'occupe maintenant de vous :)");
|
||||
sender.sendMessage(ChatColor.GREEN+"-----------------------------------------------");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -223,7 +220,7 @@ public class CommandStaff implements CommandExecutor, Listener {
|
||||
// - on les replaces par l'info sur le membre du staff qui l'a ajouté à la liste
|
||||
args[0] = ChatColor.ITALIC+"(Ajouté par";
|
||||
args[1] = sender.getName() +")"+ ChatColor.RESET;
|
||||
String message = String.join(" ", args);
|
||||
String message = StringUtils.join(args, " ");
|
||||
|
||||
|
||||
playerQueue.add(new WaitingPlayer(p.getName(),message, p.getLocation()));
|
||||
@ -235,6 +232,7 @@ public class CommandStaff implements CommandExecutor, Listener {
|
||||
p.sendMessage(ChatColor.GREEN+sender.getName()+" vous a ajouté dans la file d'attente pour traiter votre demande plus tard");
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(ChatColor.RED+"La commande a mal été tapé");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -274,9 +272,9 @@ public class CommandStaff implements CommandExecutor, Listener {
|
||||
int i = 0;
|
||||
for (WaitingPlayer wp : playerQueue)
|
||||
{
|
||||
i++;
|
||||
if (wp != null && wp.getPlayerName().equalsIgnoreCase(p.getName()))
|
||||
return i;
|
||||
i++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@ -300,7 +298,7 @@ public class CommandStaff implements CommandExecutor, Listener {
|
||||
|
||||
|
||||
private void showWaintingList(CommandSender sender) {
|
||||
sender.sendMessage(ChatColor.BOLD+"----- File d'attente des joueurs pour le staff -----");
|
||||
sender.sendMessage(ChatColor.BOLD+"-- File d'attente des joueurs pour le staff --");
|
||||
|
||||
int i=0;
|
||||
for (WaitingPlayer wp : playerQueue) {
|
||||
@ -315,7 +313,7 @@ public class CommandStaff implements CommandExecutor, Listener {
|
||||
sender.sendMessage(i+". "+name+ChatColor.RESET+" : "+wp.getMessage()+" - "
|
||||
+ChatColor.ITALIC+"Il y a "+TimeUtil.durationToString((new Date()).getTime() - wp.getDate().getTime()));
|
||||
}
|
||||
sender.sendMessage(ChatColor.BOLD+"-----------------------------------------------");
|
||||
sender.sendMessage(ChatColor.BOLD+"-------------------------------------------");
|
||||
|
||||
}
|
||||
|
||||
@ -331,9 +329,10 @@ public class CommandStaff implements CommandExecutor, Listener {
|
||||
if (obj != null)
|
||||
obj.unregister();
|
||||
|
||||
|
||||
obj = scoreboardPlayerQueue.registerNewObjective("file_attente", "dummy");
|
||||
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
obj.setDisplayName(ChatColor.GOLD+"File d'attente staff");
|
||||
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
|
||||
int i=0;
|
||||
for (WaitingPlayer wp : playerQueue) {
|
||||
@ -344,18 +343,16 @@ public class CommandStaff implements CommandExecutor, Listener {
|
||||
if (p == null || !p.isOnline())
|
||||
name = wp.getPlayerName();
|
||||
else
|
||||
name = p.getDisplayName();
|
||||
name = p.getPlayerListName();
|
||||
|
||||
String line = i+"."+name;
|
||||
int boardPos = playerQueue.size()-i;
|
||||
int boardPos = playerQueue.size()-i+1;
|
||||
|
||||
|
||||
Score score = obj.getScore(plugin.getServer().getOfflinePlayer(line));
|
||||
Score score = obj.getScore(plugin.getServer().getOfflinePlayer(line.substring(0, (line.length()>16)?16:line.length())));
|
||||
|
||||
score.setScore(boardPos);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -375,13 +372,17 @@ public class CommandStaff implements CommandExecutor, Listener {
|
||||
Player p = event.getPlayer();
|
||||
if (p.hasPermission("pandacraft.grade.staff"))
|
||||
p.setScoreboard(scoreboardPlayerQueue);
|
||||
updateScoreBoardWaitingList();
|
||||
plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() {
|
||||
@Override public void run() { updateScoreBoardWaitingList(); }
|
||||
}, 2L);
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
// lancer l'update un ou deux tick plus tard si ça ne marche pas comme ça
|
||||
updateScoreBoardWaitingList();
|
||||
plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() {
|
||||
@Override public void run() { updateScoreBoardWaitingList(); }
|
||||
}, 2L);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user