Correction de bug de synchronisation + préparation du nouveau système de messagerie privé
This commit is contained in:
parent
650f6891ea
commit
99c8711602
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<jardesc>
|
||||
<jar path="PandacraftUtils/jar_export/PandacraftUtils-4.1.jar"/>
|
||||
<jar path="PandacraftUtils/jar_export/PandacraftUtils-4.2.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: 4.1
|
||||
version: 4.2
|
||||
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@ import java.sql.SQLException;
|
||||
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.commands.PandacraftUtilsCommandsManager;
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.config.ConfigManager;
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.data_model.SQLManager;
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.data_model.ORM;
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.listener.BlockListener;
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.listener.EntityListener;
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.listener.PlayerListener;
|
||||
@ -119,7 +119,7 @@ public class PandacraftUtils extends JavaPlugin {
|
||||
|
||||
|
||||
ConfigManager.loadNewInstance();
|
||||
SQLManager.loadNewInstance();
|
||||
ORM.init();
|
||||
OnlinePlayerManager.loadNewInstance();
|
||||
PandacraftUtilsCommandsManager.loadNewInstance();
|
||||
|
||||
|
@ -107,22 +107,51 @@ public class CommandSystem extends AbstractCommandExecutor {
|
||||
}
|
||||
else if (args.length > 0 && (args[0].equalsIgnoreCase("thread") || args[0].equalsIgnoreCase("threads")))
|
||||
{
|
||||
sender.sendMessage(decoration_color+"------------- Threads chargés -------------");
|
||||
try
|
||||
{
|
||||
ThreadInfo[] threadsInfo = ManagementFactory.getThreadMXBean().dumpAllThreads(false, false);
|
||||
|
||||
int count = 0;
|
||||
for(ThreadInfo thrd : threadsInfo)
|
||||
{
|
||||
if (thrd == null)
|
||||
continue;
|
||||
count++;
|
||||
ThreadInfo threadInfoSelected = null;
|
||||
|
||||
sender.sendMessage("#"+thrd.getThreadId()+" §7"+thrd.getThreadName()+"§r : "+thrd.getThreadState().toString().toLowerCase());
|
||||
if (args.length > 1)
|
||||
{
|
||||
String threadName = getLastParam(args, 1);
|
||||
for (ThreadInfo th : threadsInfo)
|
||||
if (th != null && th.getThreadName().equalsIgnoreCase(threadName))
|
||||
threadInfoSelected = th;
|
||||
}
|
||||
|
||||
if (threadInfoSelected != null) {
|
||||
sender.sendMessage(decoration_color+"--------------- Info Thread ---------------");
|
||||
sender.sendMessage("#"+threadInfoSelected.getThreadId()+" §7"+threadInfoSelected.getThreadName()+"§r : "+threadInfoSelected.getThreadState().toString());
|
||||
StackTraceElement[] stack = threadInfoSelected.getStackTrace();
|
||||
sender.sendMessage("StackTrace : ("+stack.length+" element(s))");
|
||||
for (StackTraceElement stEl : stack) {
|
||||
sender.sendMessage(ChatColor.GRAY+" - "+stEl.toString());
|
||||
}
|
||||
sender.sendMessage(decoration_color+"-------------------------------------------");
|
||||
|
||||
}
|
||||
sender.sendMessage(decoration_color+"Total : §7"+count+" thread"+((count>1)?"s":""));
|
||||
else {
|
||||
|
||||
sender.sendMessage(decoration_color+"------------- Threads chargés -------------");
|
||||
int count = 0;
|
||||
for(ThreadInfo thrd : threadsInfo)
|
||||
{
|
||||
if (thrd == null)
|
||||
continue;
|
||||
count++;
|
||||
|
||||
sender.sendMessage("#"+thrd.getThreadId()+" §7"+thrd.getThreadName()+"§r : "+thrd.getThreadState().toString());
|
||||
|
||||
}
|
||||
sender.sendMessage(decoration_color+"Total : §7"+count+" thread"+((count>1)?"s":""));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,49 @@
|
||||
package net.mc_pandacraft.java.plugin.pandacraftutils.data_model;
|
||||
|
||||
public class MPGroupElement extends SQLElement {
|
||||
|
||||
private String groupName;
|
||||
|
||||
|
||||
|
||||
public MPGroupElement(String name) {
|
||||
super("pandacraft_mp_group");
|
||||
setGroupName(name);
|
||||
}
|
||||
|
||||
protected MPGroupElement(int id, String name) {
|
||||
super("pandacraft_mp_group", id);
|
||||
setGroupName(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected String[] getValues() {
|
||||
return new String[] {
|
||||
groupName
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getFieldsName() {
|
||||
return new String[] {
|
||||
"groupName"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getGroupName() { return groupName; }
|
||||
|
||||
public void setGroupName(String name) {
|
||||
if (name == null)
|
||||
throw new NullPointerException();
|
||||
groupName = name;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package net.mc_pandacraft.java.plugin.pandacraftutils.data_model;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class MPGroupTable extends SQLTable<MPGroupElement> {
|
||||
|
||||
public MPGroupTable() throws SQLException {
|
||||
super("pandacraft_mp_group");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String createTableParameters() {
|
||||
return "id INT AUTO_INCREMENT PRIMARY KEY,"
|
||||
+ "groupName VARCHAR(16) NOT NULL";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MPGroupElement getElementInstance(ResultSet sqlResult)
|
||||
throws SQLException {
|
||||
return new MPGroupElement(
|
||||
sqlResult.getInt("id"),
|
||||
sqlResult.getString("groupName"));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package net.mc_pandacraft.java.plugin.pandacraftutils.data_model;
|
||||
|
||||
public class MPGroupUserElement extends SQLElement {
|
||||
|
||||
private int groupId;
|
||||
private String playerName;
|
||||
|
||||
|
||||
public MPGroupUserElement(int gId, String pName) {
|
||||
super("pandacraft_mp_group_user");
|
||||
setGroupId(gId);
|
||||
setPlayerName(pName);
|
||||
}
|
||||
|
||||
protected MPGroupUserElement(int id, int gId, String pName) {
|
||||
super("pandacraft_mp_group_user", id);
|
||||
setGroupId(gId);
|
||||
setPlayerName(pName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected String[] getValues() {
|
||||
return new String[] {
|
||||
Integer.toString(groupId),
|
||||
playerName
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getFieldsName() {
|
||||
return new String[] {
|
||||
"groupId",
|
||||
"playerName"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public int getGroupId() { return groupId; }
|
||||
public String getPlayerName() { return playerName; }
|
||||
|
||||
public void setGroupId(int gId) { groupId = gId; }
|
||||
public void setPlayerName(String playerName) {
|
||||
if (playerName == null)
|
||||
throw new NullPointerException();
|
||||
this.playerName = playerName;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package net.mc_pandacraft.java.plugin.pandacraftutils.data_model;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class MPGroupUserTable extends SQLTable<MPGroupUserElement> {
|
||||
|
||||
public MPGroupUserTable() throws SQLException {
|
||||
super("pandacraft_mp_group_user");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String createTableParameters() {
|
||||
return "id INT AUTO_INCREMENT PRIMARY KEY,"
|
||||
+ "groupId INT NOT NULL,"
|
||||
+ "playerName VARCHAR(16) NOT NULL";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MPGroupUserElement getElementInstance(ResultSet sqlResult)
|
||||
throws SQLException {
|
||||
return new MPGroupUserElement(
|
||||
sqlResult.getInt("id"),
|
||||
sqlResult.getInt("groupId"),
|
||||
sqlResult.getString("playerName"));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,153 @@
|
||||
package net.mc_pandacraft.java.plugin.pandacraftutils.data_model;
|
||||
|
||||
/**
|
||||
* Représente un message dans la base de donnée<br/>
|
||||
* <br/>
|
||||
* Les propriétés suivantes doivent être complétés hors constructeur (par défaut <code>null</code>) :
|
||||
* <ul>
|
||||
* <li><code>destNick</code></li>
|
||||
* <li>ou <code>destGroup</code></li>
|
||||
* </ul>
|
||||
* La propriété <code>deleted</code> est défini par défaut à Faux.
|
||||
* @author Marc Baloup
|
||||
*
|
||||
*/
|
||||
public class MPMessageElement extends SQLElement {
|
||||
|
||||
private long time;
|
||||
private int securityKey; // permet de différencier deux message, dans le cas où 2 messages ont exactement la même valeur time
|
||||
private String viewerNick;
|
||||
private String sourceNick;
|
||||
private String destNick = null;
|
||||
private Integer destGroup = null;
|
||||
private String message;
|
||||
private boolean read;
|
||||
private boolean deleted = false;
|
||||
private boolean serverSync;
|
||||
|
||||
|
||||
|
||||
public MPMessageElement(long t, int secKey, String viewNick, String srcNick, String msg, boolean r, boolean sync) {
|
||||
super("pandacraft_mp_message");
|
||||
setTime(t);
|
||||
setSecurityKey(secKey);
|
||||
setViewerNick(viewNick);
|
||||
setSourceNick(srcNick);
|
||||
setMessage(msg);
|
||||
setRead(r);
|
||||
setServerSync(sync);
|
||||
}
|
||||
|
||||
|
||||
protected MPMessageElement(int id, long t, int secKey, String viewNick, String srcNick, String msg, boolean r, boolean sync) {
|
||||
super("pandacraft_mp_message", id);
|
||||
setTime(t);
|
||||
setSecurityKey(secKey);
|
||||
setViewerNick(viewNick);
|
||||
setSourceNick(srcNick);
|
||||
setMessage(msg);
|
||||
setRead(r);
|
||||
setServerSync(sync);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected String[] getValues() {
|
||||
return new String[] {
|
||||
Long.toString(time),
|
||||
Integer.toString(securityKey),
|
||||
viewerNick,
|
||||
sourceNick,
|
||||
destNick,
|
||||
(destGroup==null)?null:destGroup.toString(),
|
||||
message,
|
||||
(read)?"1":"0",
|
||||
(deleted)?"1":"0",
|
||||
(serverSync)?"1":"0"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected String[] getFieldsName() {
|
||||
return new String[] {
|
||||
"time",
|
||||
"securityKey",
|
||||
"viewerNick",
|
||||
"sourceNick",
|
||||
"destNick",
|
||||
"destGroup",
|
||||
"message",
|
||||
"read",
|
||||
"deleted",
|
||||
"serverSync"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public long getTime() { return time; }
|
||||
public int getSecurityKey() { return securityKey; }
|
||||
public String getViewerNick() { return viewerNick; }
|
||||
public String getSourceNick() { return sourceNick; }
|
||||
public String getDestNick() { return destNick; }
|
||||
public Integer getDestGroup() { return destGroup; }
|
||||
public String getMessage() { return message; }
|
||||
public boolean isRead() { return read; }
|
||||
public boolean isDeleted() { return deleted; }
|
||||
public boolean isServerSync() { return serverSync; }
|
||||
|
||||
|
||||
|
||||
|
||||
public void setTime(long t) { time = t; }
|
||||
public void setSecurityKey(int secKey) { securityKey = secKey; }
|
||||
|
||||
public void setViewerNick(String viewNick) {
|
||||
if (viewNick == null)
|
||||
throw new NullPointerException();
|
||||
viewerNick = viewNick;
|
||||
}
|
||||
|
||||
public void setSourceNick(String srcNick) { sourceNick = srcNick; }
|
||||
|
||||
public void setDestNick(String destNick) {
|
||||
this.destNick = destNick;
|
||||
if (destNick != null)
|
||||
destGroup = null;
|
||||
}
|
||||
|
||||
public void setDestGroup(Integer destGroup) {
|
||||
this.destGroup = destGroup;
|
||||
if (destGroup != null)
|
||||
destNick = null;
|
||||
}
|
||||
|
||||
public void setMessage(String msg) {
|
||||
if (msg == null)
|
||||
throw new NullPointerException();
|
||||
message = msg;
|
||||
}
|
||||
|
||||
public void setRead(boolean r) { read = r; }
|
||||
public void setDeleted(boolean del) { deleted = del; }
|
||||
public void setServerSync(boolean sync) { serverSync = sync; }
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package net.mc_pandacraft.java.plugin.pandacraftutils.data_model;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class MPMessageTable extends SQLTable<MPMessageElement> {
|
||||
|
||||
public MPMessageTable() throws SQLException {
|
||||
super("pandacraft_mp_message");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String createTableParameters() {
|
||||
return "id INT AUTO_INCREMENT PRIMARY KEY,"
|
||||
+ "time BIGINT NOT NULL,"
|
||||
+ "securityKey INT NOT NULL,"
|
||||
+ "viewerNick VARCHAR(16) NOT NULL,"
|
||||
+ "sourceNick VARCHAR(16) NULL," // Null si la source est la console ou une autre entité qu'un joueur
|
||||
+ "destNick VARCHAR(16) NULL,"
|
||||
+ "destGroup INT NULL,"
|
||||
+ "message VARCHAR(512) NOT NULL,"
|
||||
+ "read TINYINT NOT NULL,"
|
||||
+ "deleted TINYINT NOT NULL,"
|
||||
+ "serverSync TINYINT NOT NULL";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MPMessageElement getElementInstance(ResultSet sqlResult)
|
||||
throws SQLException {
|
||||
MPMessageElement el = new MPMessageElement(
|
||||
sqlResult.getInt("id"),
|
||||
sqlResult.getLong("time"),
|
||||
sqlResult.getInt("securityKey"),
|
||||
sqlResult.getString("viewerNick"),
|
||||
sqlResult.getString("sourceNick"),
|
||||
sqlResult.getString("message"),
|
||||
sqlResult.getBoolean("read"),
|
||||
sqlResult.getBoolean("serverSync"));
|
||||
el.setDestNick(sqlResult.getString("destNick"));
|
||||
|
||||
int group = sqlResult.getInt("destGroup");
|
||||
el.setDestGroup(sqlResult.wasNull()?null:group);
|
||||
|
||||
el.setDestNick(sqlResult.getString("destNick"));
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package net.mc_pandacraft.java.plugin.pandacraftutils.data_model;
|
||||
|
||||
public class MPWebSessionElement extends SQLElement {
|
||||
|
||||
private String playerName;
|
||||
private long lastWebActivity;
|
||||
private boolean isInGameOnline;
|
||||
private String playerDisplayName;
|
||||
|
||||
public MPWebSessionElement(String pName, long lastWebAct, boolean onlineIG, String dispName) {
|
||||
super("pandacraft_mp_web_session");
|
||||
setPlayerName(pName);
|
||||
setLastWebActivity(lastWebAct);
|
||||
setInGameOnline(onlineIG);
|
||||
setPlayerDisplayName(dispName);
|
||||
}
|
||||
|
||||
protected MPWebSessionElement(int id, String pName, long lastWebAct, boolean onlineIG, String dispName) {
|
||||
super("pandacraft_mp_web_session", id);
|
||||
setPlayerName(pName);
|
||||
setLastWebActivity(lastWebAct);
|
||||
setInGameOnline(onlineIG);
|
||||
setPlayerDisplayName(dispName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getValues() {
|
||||
return new String[] {
|
||||
playerName,
|
||||
Long.toString(lastWebActivity),
|
||||
(isInGameOnline)?"1":"0",
|
||||
playerDisplayName
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getFieldsName() {
|
||||
return new String[] {
|
||||
"playerName",
|
||||
"lastWebActivity",
|
||||
"isInGameOnline",
|
||||
"playerDisplayName"
|
||||
};
|
||||
}
|
||||
|
||||
public String getPlayerName() { return playerName; }
|
||||
public long getLastWebActivity() { return lastWebActivity; }
|
||||
public boolean isInGameOnline() { return isInGameOnline; }
|
||||
public String getPlayerDisplayName() { return playerDisplayName; }
|
||||
|
||||
|
||||
|
||||
public void setPlayerName(String pName) {
|
||||
if (pName == null)
|
||||
throw new NullPointerException();
|
||||
playerName = pName;
|
||||
}
|
||||
|
||||
public void setLastWebActivity(long lastWebAct) { lastWebActivity = lastWebAct; }
|
||||
|
||||
public void setInGameOnline(boolean onlineIG) { isInGameOnline = onlineIG; }
|
||||
|
||||
public void setPlayerDisplayName(String dispName) {
|
||||
if (dispName == null)
|
||||
throw new NullPointerException();
|
||||
playerDisplayName = dispName;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package net.mc_pandacraft.java.plugin.pandacraftutils.data_model;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class MPWebSessionTable extends SQLTable<MPWebSessionElement> {
|
||||
|
||||
public MPWebSessionTable() throws SQLException {
|
||||
super("pandacraft_mp_web_session");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String createTableParameters() {
|
||||
return "id INT AUTO_INCREMENT PRIMARY KEY,"
|
||||
+ "playerName VARCHAR(16) NOT NULL,"
|
||||
+ "lastWebActivity BIGINT NOT NULL,"
|
||||
+ "isInGameOnline TINYINT NOT NULL,"
|
||||
+ "playerDisplayName VARCHAR(255) NOT NULL";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MPWebSessionElement getElementInstance(ResultSet sqlResult)
|
||||
throws SQLException {
|
||||
return new MPWebSessionElement(
|
||||
sqlResult.getInt("id"),
|
||||
sqlResult.getString("playerName"),
|
||||
sqlResult.getLong("lastWebActivity"),
|
||||
sqlResult.getBoolean("isInGameOnline"),
|
||||
sqlResult.getString("playerDisplayName"));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package net.mc_pandacraft.java.plugin.pandacraftutils.data_model;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* ORM = Object-Relational Mapping
|
||||
* @author Marc Baloup
|
||||
*
|
||||
*/
|
||||
public final class ORM {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static Map<String, SQLTable> tables = new HashMap<String, SQLTable>();
|
||||
|
||||
|
||||
public synchronized static void init() {
|
||||
try {
|
||||
|
||||
/*
|
||||
* Les tables SQL sont à instancier ici !
|
||||
*/
|
||||
|
||||
tables.put("modo_history", new ModoHistoryTable());
|
||||
|
||||
tables.put("mp_message", new MPMessageTable());
|
||||
tables.put("mp_group", new MPGroupTable());
|
||||
tables.put("mp_group_user", new MPGroupUserTable());
|
||||
tables.put("mp_web_session", new MPWebSessionTable());
|
||||
|
||||
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public synchronized static SQLTable getTable(String name) {
|
||||
return tables.get(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private ORM() { } // rend la classe non instanciable
|
||||
|
||||
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
package net.mc_pandacraft.java.plugin.pandacraftutils.data_model;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class SQLManager {
|
||||
|
||||
private static SQLManager instance;
|
||||
|
||||
/**
|
||||
* Retourne l'unique instance de la classe. Si elle n'existe pas, on tente de créer
|
||||
* @return L'unique instance de la classe
|
||||
*/
|
||||
|
||||
public synchronized static SQLManager getInstance() {
|
||||
if (instance == null)
|
||||
loadNewInstance();
|
||||
return instance;
|
||||
}
|
||||
|
||||
public synchronized static void loadNewInstance() {
|
||||
instance = new SQLManager();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private Map<String, SQLTable> tables = new HashMap<String, SQLTable>();
|
||||
|
||||
|
||||
public SQLManager() {
|
||||
try {
|
||||
|
||||
/*
|
||||
* Les tables SQL sont à instancier ici !
|
||||
*/
|
||||
|
||||
tables.put("modo_history", new ModoHistoryTable());
|
||||
|
||||
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -73,10 +73,27 @@ public abstract class SQLTable<T extends SQLElement> {
|
||||
|
||||
|
||||
public List<T> getAll() throws SQLException {
|
||||
|
||||
return getAll(null, null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public List<T> getAll(String where, String orderBy, Integer limit, Integer offset) throws SQLException {
|
||||
Statement stmt = db.getConnection().createStatement();
|
||||
String sql = "SELECT * FROM "+tableName+";";
|
||||
String sql = "SELECT * FROM "+tableName;
|
||||
|
||||
if (where != null)
|
||||
sql += " WHERE "+where;
|
||||
if (orderBy != null)
|
||||
sql += " ORDER BY "+orderBy;
|
||||
if (limit != null)
|
||||
sql += " LIMIT "+limit;
|
||||
if (offset != null)
|
||||
sql += " OFFSET "+offset;
|
||||
sql += ";";
|
||||
|
||||
ResultSet set = stmt.executeQuery(sql);
|
||||
|
||||
List<T> elmts = new ArrayList<T>();
|
||||
while (set.next())
|
||||
elmts.add(getElementInstance(set));
|
||||
|
@ -26,7 +26,7 @@ public class VanillaMessageManager {
|
||||
|
||||
if (OnlinePlayerManager.get(event.getPlayer()).isVanished()) return;
|
||||
|
||||
plugin.getServer().broadcastMessage(ChatColor.YELLOW+event.getPlayer().getDisplayName()+ChatColor.YELLOW+" vient de se connecter");
|
||||
plugin.broadcast(ChatColor.YELLOW+event.getPlayer().getDisplayName()+ChatColor.YELLOW+" vient de se connecter", false);
|
||||
}
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ public class VanillaMessageManager {
|
||||
// on affiche le message que si le joueur n'est pas vanish
|
||||
if (OnlinePlayerManager.get(event.getPlayer()).isVanished()) return;
|
||||
|
||||
plugin.getServer().broadcastMessage(ChatColor.YELLOW+event.getPlayer().getDisplayName()+ChatColor.YELLOW+" a quitté le jeu");
|
||||
plugin.broadcast(ChatColor.YELLOW+event.getPlayer().getDisplayName()+ChatColor.YELLOW+" a quitté le jeu", false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -342,7 +342,7 @@ public class OnlinePlayer extends OffPlayer {
|
||||
* gère cette foncionnalitée
|
||||
*/
|
||||
public boolean isVanished() {
|
||||
return EssentialsInterface.isPlayerVanished(player);
|
||||
return getEssentialsUser().isVanished();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user