gestion plus propre des grades dans le plugin
This commit is contained in:
parent
1a8a911a12
commit
9a45dbf44b
@ -103,7 +103,6 @@ permissions:
|
|||||||
pandacraft.me:
|
pandacraft.me:
|
||||||
description: Utiliser la commande me
|
description: Utiliser la commande me
|
||||||
default: true
|
default: true
|
||||||
# à ajouter ###############
|
|
||||||
pandacraft.me.color:
|
pandacraft.me.color:
|
||||||
description: Utiliser la commande me avec des couleurs
|
description: Utiliser la commande me avec des couleurs
|
||||||
default: op
|
default: op
|
||||||
@ -135,17 +134,14 @@ permissions:
|
|||||||
description: Ne pas être auto AFK
|
description: Ne pas être auto AFK
|
||||||
default: false
|
default: false
|
||||||
|
|
||||||
# à ajouter ######################
|
|
||||||
pandacraft.broadcast:
|
pandacraft.broadcast:
|
||||||
description: Utiliser la commande broadcast et broadcastperm
|
description: Utiliser la commande broadcast et broadcastperm
|
||||||
default: op
|
default: op
|
||||||
|
|
||||||
# à ajouter ######################
|
|
||||||
pandacraft.automessager:
|
pandacraft.automessager:
|
||||||
description: Utiliser la commande automessager
|
description: Utiliser la commande automessager
|
||||||
default: op
|
default: op
|
||||||
|
|
||||||
# à ajouter ######################
|
|
||||||
pandacraft.admin:
|
pandacraft.admin:
|
||||||
description: Utiliser la commande admin
|
description: Utiliser la commande admin
|
||||||
default: op
|
default: op
|
||||||
@ -156,27 +152,3 @@ permissions:
|
|||||||
default: op
|
default: op
|
||||||
|
|
||||||
|
|
||||||
pandacraft.grade.default:
|
|
||||||
description: Représente le grade Visiteur
|
|
||||||
default: false
|
|
||||||
pandacraft.grade.users:
|
|
||||||
description: Représente le grade Membre
|
|
||||||
default: false
|
|
||||||
pandacraft.grade.premium:
|
|
||||||
description: Représente le grade Premium
|
|
||||||
default: false
|
|
||||||
pandacraft.grade.ultimate:
|
|
||||||
description: Représente le grade Premium plus
|
|
||||||
default: false
|
|
||||||
pandacraft.grade.modos:
|
|
||||||
description: Représente le grade Modos
|
|
||||||
default: false
|
|
||||||
pandacraft.grade.admins:
|
|
||||||
description: Représente le grade Admins
|
|
||||||
default: false
|
|
||||||
pandacraft.grade.not_default:
|
|
||||||
description: Représente tout les joueurs inscrits
|
|
||||||
default: false
|
|
||||||
pandacraft.grade.staff:
|
|
||||||
description: Représente tout le staff
|
|
||||||
default: false
|
|
||||||
|
@ -186,7 +186,7 @@ public class ConfigManager {
|
|||||||
|
|
||||||
message = new HashMap<String, String>();
|
message = new HashMap<String, String>();
|
||||||
message.put("message", ChatColor.BLUE+"Bienvenue sur Pandacraft ! :) Pour pouvoir jouer, n'oubliez pas de vous inscrire en cliquant sur le lien en dessous%n &ahttps://www.mc-pandacraft.net/?p=inscription");
|
message.put("message", ChatColor.BLUE+"Bienvenue sur Pandacraft ! :) Pour pouvoir jouer, n'oubliez pas de vous inscrire en cliquant sur le lien en dessous%n &ahttps://www.mc-pandacraft.net/?p=inscription");
|
||||||
message.put("permissions", "pandacraft.grade.default");
|
message.put("permissions", "group.default");
|
||||||
Automessages_messages.add(message);
|
Automessages_messages.add(message);
|
||||||
|
|
||||||
message = new HashMap<String, String>();
|
message = new HashMap<String, String>();
|
||||||
@ -316,19 +316,19 @@ public class ConfigManager {
|
|||||||
alias = new HashMap<String, String>();
|
alias = new HashMap<String, String>();
|
||||||
alias.put("initialCommand", "/day");
|
alias.put("initialCommand", "/day");
|
||||||
alias.put("replaceWith", "/ptime day");
|
alias.put("replaceWith", "/ptime day");
|
||||||
alias.put("permissions", "pandacraft.grade.users"); // multiple permission separated with semicolumn
|
alias.put("permissions", "group.users"); // multiple permission separated with semicolumn
|
||||||
CommandAlias_alias.add(alias);
|
CommandAlias_alias.add(alias);
|
||||||
|
|
||||||
alias = new HashMap<String, String>();
|
alias = new HashMap<String, String>();
|
||||||
alias.put("initialCommand", "/night");
|
alias.put("initialCommand", "/night");
|
||||||
alias.put("replaceWith", "/ptime night");
|
alias.put("replaceWith", "/ptime night");
|
||||||
alias.put("permissions", "pandacraft.grade.users");
|
alias.put("permissions", "group.users");
|
||||||
CommandAlias_alias.add(alias);
|
CommandAlias_alias.add(alias);
|
||||||
|
|
||||||
alias = new HashMap<String, String>();
|
alias = new HashMap<String, String>();
|
||||||
alias.put("initialCommand", "/time");
|
alias.put("initialCommand", "/time");
|
||||||
alias.put("replaceWith", "/ptime");
|
alias.put("replaceWith", "/ptime");
|
||||||
alias.put("permissions", "pandacraft.grade.users");
|
alias.put("permissions", "group.users");
|
||||||
CommandAlias_alias.add(alias);
|
CommandAlias_alias.add(alias);
|
||||||
|
|
||||||
alias = new HashMap<String, String>();
|
alias = new HashMap<String, String>();
|
||||||
@ -358,7 +358,7 @@ public class ConfigManager {
|
|||||||
alias = new HashMap<String, String>();
|
alias = new HashMap<String, String>();
|
||||||
alias.put("initialCommand", "/inscription");
|
alias.put("initialCommand", "/inscription");
|
||||||
alias.put("replaceWith", "/mail send marcbal Inscription");
|
alias.put("replaceWith", "/mail send marcbal Inscription");
|
||||||
alias.put("permissions", "pandacraft.grade.not_default");
|
alias.put("permissions", "group.users");
|
||||||
CommandAlias_alias.add(alias);
|
CommandAlias_alias.add(alias);
|
||||||
/*
|
/*
|
||||||
Map<String, String> alias = new HashMap<String, String>();
|
Map<String, String> alias = new HashMap<String, String>();
|
||||||
|
@ -67,7 +67,7 @@ public class CommandAfk extends AbstractCommandExecutor {
|
|||||||
if (execute_self)
|
if (execute_self)
|
||||||
{
|
{
|
||||||
Player p = (Player)sender;
|
Player p = (Player)sender;
|
||||||
OnlinePlayer ap = OnlinePlayerManager.getInstance().get(p);
|
OnlinePlayer ap = OnlinePlayerManager.get(p);
|
||||||
if (ap == null)
|
if (ap == null)
|
||||||
plugin.getLogger().severe("Cant find AfkPlayer with name "+p.getName()+" when performing command /afk");
|
plugin.getLogger().severe("Cant find AfkPlayer with name "+p.getName()+" when performing command /afk");
|
||||||
else
|
else
|
||||||
@ -76,7 +76,7 @@ public class CommandAfk extends AbstractCommandExecutor {
|
|||||||
}
|
}
|
||||||
else if (execute_other && other_player != null)
|
else if (execute_other && other_player != null)
|
||||||
{
|
{
|
||||||
OnlinePlayer ap = OnlinePlayerManager.getInstance().get(other_player);
|
OnlinePlayer ap = OnlinePlayerManager.get(other_player);
|
||||||
if (ap == null)
|
if (ap == null)
|
||||||
plugin.getLogger().severe("Cant find AfkPlayer with name "+other_player.getName()+" when performing command /afk <player>");
|
plugin.getLogger().severe("Cant find AfkPlayer with name "+other_player.getName()+" when performing command /afk <player>");
|
||||||
ap.adminToggleAfk();
|
ap.adminToggleAfk();
|
||||||
|
@ -41,7 +41,6 @@ public class CommandAutomessager extends AbstractCommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OnlinePlayerManager
|
OnlinePlayerManager
|
||||||
.getInstance()
|
|
||||||
.get((Player)sender)
|
.get((Player)sender)
|
||||||
.sendMessageFromServer(messages.get(id).getMessage());
|
.sendMessageFromServer(messages.get(id).getMessage());
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ public class CommandList extends AbstractCommandExecutor {
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int vl = OnlinePlayerManager.getInstance().get(p).getVL();
|
int vl = OnlinePlayerManager.get(p).getVL();
|
||||||
int max_vl = ConfigManager.getInstance().ChatAnalysis_maxViolationLevel;
|
int max_vl = ConfigManager.getInstance().ChatAnalysis_maxViolationLevel;
|
||||||
aff_list.add("§f"+name+"§r - §7"+vl+"/"+max_vl);
|
aff_list.add("§f"+name+"§r - §7"+vl+"/"+max_vl);
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ public class CommandList extends AbstractCommandExecutor {
|
|||||||
}
|
}
|
||||||
else if (args.length > 0 && args[0].toLowerCase().equals("afk"))
|
else if (args.length > 0 && args[0].toLowerCase().equals("afk"))
|
||||||
{
|
{
|
||||||
OnlinePlayer op = OnlinePlayerManager.getInstance().get(p);
|
OnlinePlayer op = OnlinePlayerManager.get(p);
|
||||||
boolean afk = (op != null && op.isAfk());
|
boolean afk = (op != null && op.isAfk());
|
||||||
double afk_time = (op != null)?op.getDurationSinceLastAction():-1;
|
double afk_time = (op != null)?op.getDurationSinceLastAction():-1;
|
||||||
String afkTime;
|
String afkTime;
|
||||||
@ -191,7 +191,7 @@ public class CommandList extends AbstractCommandExecutor {
|
|||||||
:(p.getGameMode() == GameMode.CREATIVE)?"§bCréa§r"
|
:(p.getGameMode() == GameMode.CREATIVE)?"§bCréa§r"
|
||||||
:(p.getGameMode() == GameMode.ADVENTURE)?("§8Aventure§r;vie:§7"+health+"§r;faim:§7"+eat+"§r"+((flyMode)?";§7canFly":""))
|
:(p.getGameMode() == GameMode.ADVENTURE)?("§8Aventure§r;vie:§7"+health+"§r;faim:§7"+eat+"§r"+((flyMode)?";§7canFly":""))
|
||||||
:"§oInconnu";
|
:"§oInconnu";
|
||||||
String afk = (OnlinePlayerManager.getInstance().get(p) != null && OnlinePlayerManager.getInstance().get(p).isAfk())?" §c(Afk)§r":"";
|
String afk = (OnlinePlayerManager.get(p) != null && OnlinePlayerManager.get(p).isAfk())?" §c(Afk)§r":"";
|
||||||
aff_list.add("§f"+name+"§r"+afk+" - §7"+world+"§r - "+gm);
|
aff_list.add("§f"+name+"§r"+afk+" - §7"+world+"§r - "+gm);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4,6 +4,7 @@ import java.util.Date;
|
|||||||
|
|
||||||
import net.mc_pandacraft.java.plugin.pandacraftutils.modules.StaffQueueManager;
|
import net.mc_pandacraft.java.plugin.pandacraftutils.modules.StaffQueueManager;
|
||||||
import net.mc_pandacraft.java.plugin.pandacraftutils.modules.StaffQueueManager.WaitingPlayer;
|
import net.mc_pandacraft.java.plugin.pandacraftutils.modules.StaffQueueManager.WaitingPlayer;
|
||||||
|
import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager;
|
||||||
import net.mc_pandacraft.java.util.TimeUtil;
|
import net.mc_pandacraft.java.util.TimeUtil;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
@ -25,7 +26,7 @@ public class CommandStaff extends AbstractCommandExecutor {
|
|||||||
StaffQueueManager staffManager = plugin.staffQueueManager;
|
StaffQueueManager staffManager = plugin.staffQueueManager;
|
||||||
|
|
||||||
|
|
||||||
if (sender instanceof Player && !((Player)sender).hasPermission("pandacraft.grade.staff"))
|
if (sender instanceof Player && !OnlinePlayerManager.get((Player)sender).isInStaff())
|
||||||
{ // un joueur qui n'est pas du staff
|
{ // un joueur qui n'est pas du staff
|
||||||
|
|
||||||
// le joueur est-il déjà en file d'attente ?
|
// le joueur est-il déjà en file d'attente ?
|
||||||
|
@ -36,7 +36,7 @@ public class Command_Selection extends AbstractCommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player p = (Player) sender;
|
Player p = (Player) sender;
|
||||||
OnlinePlayer op = OnlinePlayerManager.getInstance().get(p);
|
OnlinePlayer op = OnlinePlayerManager.get(p);
|
||||||
|
|
||||||
|
|
||||||
Player otherP = null;
|
Player otherP = null;
|
||||||
|
@ -53,7 +53,7 @@ public class AfkManager extends BukkitRunnable implements Listener {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// methode exécutée toute les secondes
|
// methode exécutée toute les secondes
|
||||||
Collection<OnlinePlayer> oPlayers = OnlinePlayerManager.getInstance().getAll();
|
Collection<OnlinePlayer> oPlayers = OnlinePlayerManager.getAll();
|
||||||
for (OnlinePlayer ap : oPlayers.toArray(new OnlinePlayer[oPlayers.size()]))
|
for (OnlinePlayer ap : oPlayers.toArray(new OnlinePlayer[oPlayers.size()]))
|
||||||
{ // parcours de tout les joueurs
|
{ // parcours de tout les joueurs
|
||||||
if (ap == null)
|
if (ap == null)
|
||||||
@ -97,7 +97,7 @@ public class AfkManager extends BukkitRunnable implements Listener {
|
|||||||
if ( (from.getPitch() == to.getPitch() && from.getYaw() == to.getYaw())
|
if ( (from.getPitch() == to.getPitch() && from.getYaw() == to.getYaw())
|
||||||
|| (from.getX() == to.getX() && from.getY() == to.getY() && from.getZ() == to.getZ()))
|
|| (from.getX() == to.getX() && from.getY() == to.getY() && from.getZ() == to.getZ()))
|
||||||
return;
|
return;
|
||||||
OnlinePlayerManager.getInstance().get(event.getPlayer()).isDoingAction();
|
OnlinePlayerManager.get(event.getPlayer()).isDoingAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ public class AfkManager extends BukkitRunnable implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
OnlinePlayerManager.getInstance().get(event.getPlayer()).isDoingAction();
|
OnlinePlayerManager.get(event.getPlayer()).isDoingAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -135,7 +135,7 @@ public class AfkManager extends BukkitRunnable implements Listener {
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OnlinePlayerManager.getInstance().get(event.getPlayer()).isDoingAction();
|
OnlinePlayerManager.get(event.getPlayer()).isDoingAction();
|
||||||
}
|
}
|
||||||
catch (NullPointerException e) { }
|
catch (NullPointerException e) { }
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ public class AfkManager extends BukkitRunnable implements Listener {
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OnlinePlayerManager.getInstance().get(event.getPlayer()).isDoingAction();
|
OnlinePlayerManager.get(event.getPlayer()).isDoingAction();
|
||||||
}
|
}
|
||||||
catch (NullPointerException e) { }
|
catch (NullPointerException e) { }
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ public class AfkManager extends BukkitRunnable implements Listener {
|
|||||||
// car un piston "téléporte" le joueur (techniquement parlant, dans le jeu) à 1 bloc de distance
|
// car un piston "téléporte" le joueur (techniquement parlant, dans le jeu) à 1 bloc de distance
|
||||||
if (event.getFrom().getWorld() != event.getTo().getWorld()
|
if (event.getFrom().getWorld() != event.getTo().getWorld()
|
||||||
|| event.getFrom().distanceSquared(event.getTo()) > 2*2)
|
|| event.getFrom().distanceSquared(event.getTo()) > 2*2)
|
||||||
OnlinePlayerManager.getInstance().get(event.getPlayer()).isDoingAction();
|
OnlinePlayerManager.get(event.getPlayer()).isDoingAction();
|
||||||
}
|
}
|
||||||
catch (NullPointerException e) { }
|
catch (NullPointerException e) { }
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ public class AfkManager extends BukkitRunnable implements Listener {
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OnlinePlayerManager.getInstance().get(event.getPlayer()).isDoingAction();
|
OnlinePlayerManager.get(event.getPlayer()).isDoingAction();
|
||||||
}
|
}
|
||||||
catch (NullPointerException e) { }
|
catch (NullPointerException e) { }
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ public class AfkManager extends BukkitRunnable implements Listener {
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OnlinePlayerManager.getInstance().get(event.getPlayer()).isDoingAction();
|
OnlinePlayerManager.get(event.getPlayer()).isDoingAction();
|
||||||
}
|
}
|
||||||
catch (NullPointerException e) { }
|
catch (NullPointerException e) { }
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ public class AfkManager extends BukkitRunnable implements Listener {
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OnlinePlayerManager.getInstance().get(event.getPlayer()).isDoingAction();
|
OnlinePlayerManager.get(event.getPlayer()).isDoingAction();
|
||||||
}
|
}
|
||||||
catch (NullPointerException e) { }
|
catch (NullPointerException e) { }
|
||||||
}
|
}
|
||||||
@ -198,7 +198,7 @@ public class AfkManager extends BukkitRunnable implements Listener {
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OnlinePlayerManager.getInstance().get(event.getPlayer()).isDoingAction();
|
OnlinePlayerManager.get(event.getPlayer()).isDoingAction();
|
||||||
}
|
}
|
||||||
catch (NullPointerException e) { }
|
catch (NullPointerException e) { }
|
||||||
}
|
}
|
||||||
@ -208,7 +208,7 @@ public class AfkManager extends BukkitRunnable implements Listener {
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OnlinePlayerManager.getInstance().get(event.getPlayer()).isDoingAction();
|
OnlinePlayerManager.get(event.getPlayer()).isDoingAction();
|
||||||
}
|
}
|
||||||
catch (NullPointerException e) { }
|
catch (NullPointerException e) { }
|
||||||
}
|
}
|
||||||
@ -218,7 +218,7 @@ public class AfkManager extends BukkitRunnable implements Listener {
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OnlinePlayerManager.getInstance().get(event.getPlayer()).isDoingAction();
|
OnlinePlayerManager.get(event.getPlayer()).isDoingAction();
|
||||||
}
|
}
|
||||||
catch (NullPointerException e) { }
|
catch (NullPointerException e) { }
|
||||||
}
|
}
|
||||||
|
@ -37,12 +37,12 @@ public class AutoMessagesManager extends BukkitRunnable {
|
|||||||
// message
|
// message
|
||||||
// permissions
|
// permissions
|
||||||
|
|
||||||
Collection<OnlinePlayer> oPlayers = OnlinePlayerManager.getInstance().getAll();
|
Collection<OnlinePlayer> oPlayers = OnlinePlayerManager.getAll();
|
||||||
|
|
||||||
|
|
||||||
for (OnlinePlayer op : oPlayers) {
|
for (OnlinePlayer op : oPlayers) {
|
||||||
|
|
||||||
int interval_sec = op.getPlayer().hasPermission("pandacraft.grade.default") ? interval_default : interval_players;
|
int interval_sec = op.isGuest() ? interval_default : interval_players;
|
||||||
|
|
||||||
op.firstAutomessageCkeck(interval_sec);
|
op.firstAutomessageCkeck(interval_sec);
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public class CalculatorManager implements Listener {
|
|||||||
if (!message.startsWith("="))
|
if (!message.startsWith("="))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
OnlinePlayer op = OnlinePlayerManager.getInstance().get(event.getPlayer());
|
OnlinePlayer op = OnlinePlayerManager.get(event.getPlayer());
|
||||||
List<HistoryElement> history = op.getCalculator_history();
|
List<HistoryElement> history = op.getCalculator_history();
|
||||||
|
|
||||||
if (message.length() == 1)
|
if (message.length() == 1)
|
||||||
|
@ -27,7 +27,7 @@ public class ChatAnalysisManager implements Listener {
|
|||||||
public void onAsyncPlayerChat(AsyncPlayerChatEvent event)
|
public void onAsyncPlayerChat(AsyncPlayerChatEvent event)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
OnlinePlayer op = OnlinePlayerManager.getInstance().get(event.getPlayer());
|
OnlinePlayer op = OnlinePlayerManager.get(event.getPlayer());
|
||||||
if (event.getPlayer().hasPermission("pandacraft.antispam.exempt"))
|
if (event.getPlayer().hasPermission("pandacraft.antispam.exempt"))
|
||||||
return;
|
return;
|
||||||
String message = event.getMessage();
|
String message = event.getMessage();
|
||||||
@ -75,7 +75,7 @@ public class ChatAnalysisManager implements Listener {
|
|||||||
public void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event)
|
public void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
OnlinePlayer op = OnlinePlayerManager.getInstance().get(event.getPlayer());
|
OnlinePlayer op = OnlinePlayerManager.get(event.getPlayer());
|
||||||
if (event.getPlayer().hasPermission("pandacraft.antispam.exempt"))
|
if (event.getPlayer().hasPermission("pandacraft.antispam.exempt"))
|
||||||
return;
|
return;
|
||||||
String command_line = event.getMessage();
|
String command_line = event.getMessage();
|
||||||
|
@ -16,6 +16,8 @@ import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
|||||||
|
|
||||||
import net.mc_pandacraft.java.plugin.pandacraftutils.ConfigManager;
|
import net.mc_pandacraft.java.plugin.pandacraftutils.ConfigManager;
|
||||||
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
|
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
|
||||||
|
import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayer;
|
||||||
|
import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager;
|
||||||
import net.mc_pandacraft.java.plugin.pandacraftutils.plugin_interface.EssentialsInterface;
|
import net.mc_pandacraft.java.plugin.pandacraftutils.plugin_interface.EssentialsInterface;
|
||||||
|
|
||||||
public class PacketOutServerInfoListener {
|
public class PacketOutServerInfoListener {
|
||||||
@ -43,7 +45,7 @@ public class PacketOutServerInfoListener {
|
|||||||
|
|
||||||
|
|
||||||
List<Player> plAdmin = new ArrayList<Player>();
|
List<Player> plAdmin = new ArrayList<Player>();
|
||||||
List<Player> plModo = new ArrayList<Player>();
|
List<Player> plStaff = new ArrayList<Player>();
|
||||||
List<Player> plPlayerUltimate = new ArrayList<Player>();
|
List<Player> plPlayerUltimate = new ArrayList<Player>();
|
||||||
List<Player> plPlayerPremium = new ArrayList<Player>();
|
List<Player> plPlayerPremium = new ArrayList<Player>();
|
||||||
List<Player> plPlayer = new ArrayList<Player>();
|
List<Player> plPlayer = new ArrayList<Player>();
|
||||||
@ -55,13 +57,15 @@ public class PacketOutServerInfoListener {
|
|||||||
// on passe si le joueur est vanish
|
// on passe si le joueur est vanish
|
||||||
if(EssentialsInterface.isPlayerVanished(p)) continue;
|
if(EssentialsInterface.isPlayerVanished(p)) continue;
|
||||||
|
|
||||||
if (p.hasPermission("pandacraft.grade.admins"))
|
OnlinePlayer op = OnlinePlayerManager.get(p);
|
||||||
|
|
||||||
|
if (op.isInGroup("admins"))
|
||||||
plAdmin.add(p);
|
plAdmin.add(p);
|
||||||
else if (p.hasPermission("pandacraft.grade.modos"))
|
else if (op.isInStaff())
|
||||||
plModo.add(p);
|
plStaff.add(p);
|
||||||
else if (p.hasPermission("pandacraft.grade.ultimate"))
|
else if (op.isInGroup("ultimate"))
|
||||||
plPlayerUltimate.add(p);
|
plPlayerUltimate.add(p);
|
||||||
else if (p.hasPermission("pandacraft.grade.premium"))
|
else if (op.isInGroup("premium"))
|
||||||
plPlayerPremium.add(p);
|
plPlayerPremium.add(p);
|
||||||
else
|
else
|
||||||
plPlayer.add(p);
|
plPlayer.add(p);
|
||||||
@ -73,14 +77,14 @@ public class PacketOutServerInfoListener {
|
|||||||
|
|
||||||
List<WrappedGameProfile> list = new ArrayList<WrappedGameProfile>();
|
List<WrappedGameProfile> list = new ArrayList<WrappedGameProfile>();
|
||||||
|
|
||||||
if (!plAdmin.isEmpty() || !plModo.isEmpty())
|
if (!plAdmin.isEmpty() || !plStaff.isEmpty())
|
||||||
{
|
{
|
||||||
list.add(new WrappedGameProfile("", "§cStaff connecté :"));
|
list.add(new WrappedGameProfile("", "§cStaff connecté :"));
|
||||||
for (Player p : plAdmin)
|
for (Player p : plAdmin)
|
||||||
{
|
{
|
||||||
list.add(new WrappedGameProfile("", "§7 - "+p.getDisplayName()));
|
list.add(new WrappedGameProfile("", "§7 - "+p.getDisplayName()));
|
||||||
}
|
}
|
||||||
for (Player p : plModo)
|
for (Player p : plStaff)
|
||||||
{
|
{
|
||||||
list.add(new WrappedGameProfile("", "§7 - "+p.getDisplayName()));
|
list.add(new WrappedGameProfile("", "§7 - "+p.getDisplayName()));
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
|
||||||
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
|
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
|
||||||
|
import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager;
|
||||||
import net.mc_pandacraft.java.util.ScoreBoardUtil;
|
import net.mc_pandacraft.java.util.ScoreBoardUtil;
|
||||||
import net.mc_pandacraft.java.util.TimeUtil;
|
import net.mc_pandacraft.java.util.TimeUtil;
|
||||||
|
|
||||||
@ -191,7 +192,7 @@ public class StaffQueueManager implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
if (p.hasPermission("pandacraft.grade.staff"))
|
if (OnlinePlayerManager.get(p).isInStaff())
|
||||||
p.setScoreboard(scoreboardPlayerQueue);
|
p.setScoreboard(scoreboardPlayerQueue);
|
||||||
plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() {
|
plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() {
|
||||||
@Override public void run() { updateScoreBoardWaitingList(); }
|
@Override public void run() { updateScoreBoardWaitingList(); }
|
||||||
|
@ -36,7 +36,7 @@ public class WESelectionDisplayManager extends BukkitRunnable {
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
for (OnlinePlayer op : OnlinePlayerManager.getInstance().getAll())
|
for (OnlinePlayer op : OnlinePlayerManager.getAll())
|
||||||
{
|
{
|
||||||
Player p = op.getPlayer();
|
Player p = op.getPlayer();
|
||||||
// on vérifie que le joueur soit en ligne
|
// on vérifie que le joueur soit en ligne
|
||||||
|
@ -16,6 +16,8 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import ru.tehkode.permissions.bukkit.PermissionsEx;
|
||||||
|
|
||||||
public class OnlinePlayer {
|
public class OnlinePlayer {
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private final PandacraftUtils plugin = PandacraftUtils.getInstance();
|
private final PandacraftUtils plugin = PandacraftUtils.getInstance();
|
||||||
@ -242,4 +244,52 @@ public class OnlinePlayer {
|
|||||||
public void sendMessageFromServer(String message) {
|
public void sendMessageFromServer(String message) {
|
||||||
player.sendMessage(ConfigManager.getInstance().ServerMessages_prefix + message);
|
player.sendMessage(ConfigManager.getInstance().ServerMessages_prefix + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Grades
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Indique si le joueur est dans le groupe Spécifié
|
||||||
|
* @param group Le groupe par rapport au plugin de permission
|
||||||
|
* @return <i>true</i> si le joueur est dans le groupe spécifié, <i>false</i> sinon
|
||||||
|
*/
|
||||||
|
public boolean isInGroup(String group) {
|
||||||
|
if (group == null) return false;
|
||||||
|
return PermissionsEx.getUser(player).inGroup(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indique si le joueur est un nouveau joueur (si il ne s'est pas inscrit sur le site)
|
||||||
|
* @return <i>true</i> si le joueur n'est pas inscrit, <i>false</i> sinon
|
||||||
|
*/
|
||||||
|
public boolean isGuest() {
|
||||||
|
return isInGroup("default");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indique si le joueur s'est inscrit sur le site
|
||||||
|
* @return <i>true</i> si c'est le cas, <i>false</i> sinon
|
||||||
|
*/
|
||||||
|
public boolean isRegistered() {
|
||||||
|
return !isGuest();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indique si le joueur fait parti du staff
|
||||||
|
* @return <i>true</i> si c'est le cas, <i>false</i> sinon
|
||||||
|
*/
|
||||||
|
public boolean isInStaff() {
|
||||||
|
return isInGroup("admins") ||
|
||||||
|
isInGroup("devs") ||
|
||||||
|
isInGroup("modos") ||
|
||||||
|
isInGroup("archis") ||
|
||||||
|
isInGroup("guides");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,17 +75,17 @@ public final class OnlinePlayerManager implements Listener {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public OnlinePlayer get(Player p) {
|
public static OnlinePlayer get(Player p) {
|
||||||
return players.get(p);
|
return getInstance().players.get(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<OnlinePlayer> getAll() {
|
public static Collection<OnlinePlayer> getAll() {
|
||||||
return players.values();
|
return getInstance().players.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean contains(Player p) {
|
public static boolean contains(Player p) {
|
||||||
return players.containsKey(p);
|
return getInstance().players.containsKey(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user