Retrait de la connexion à la base de donnée (inutile pour le moment)

This commit is contained in:
Marc Baloup 2015-01-21 19:12:15 -05:00
parent c5b3d8b5be
commit 9b3bfe408c
4 changed files with 6 additions and 64 deletions

View File

@ -87,6 +87,7 @@ public class ConfigManager {
initChatAnalysisBadWord(); initChatAnalysisBadWord();
initCommandAlias(); initCommandAlias();
initAutomessages();
} }

View File

@ -1,7 +1,6 @@
package net.mc_pandacraft.java.plugin.pandacraftutils; package net.mc_pandacraft.java.plugin.pandacraftutils;
import java.sql.SQLException;
import net.mc_pandacraft.java.plugin.pandacraftutils.afk.CommandAfk; import net.mc_pandacraft.java.plugin.pandacraftutils.afk.CommandAfk;
import net.mc_pandacraft.java.plugin.pandacraftutils.calculator.CalculatorManager; import net.mc_pandacraft.java.plugin.pandacraftutils.calculator.CalculatorManager;
@ -21,7 +20,6 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.spawntime.SpawnTimeManager;
import net.mc_pandacraft.java.plugin.pandacraftutils.survival_cuboid.CommandCubo; import net.mc_pandacraft.java.plugin.pandacraftutils.survival_cuboid.CommandCubo;
import net.mc_pandacraft.java.plugin.pandacraftutils.survival_cuboid.CommandWandSelection; import net.mc_pandacraft.java.plugin.pandacraftutils.survival_cuboid.CommandWandSelection;
import net.mc_pandacraft.java.plugin.pandacraftutils.system_analyzer.CommandSystem; import net.mc_pandacraft.java.plugin.pandacraftutils.system_analyzer.CommandSystem;
import net.mc_pandacraft.java.util.mysql.DBConnection;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -32,7 +30,7 @@ public class PandacraftUtils extends JavaPlugin {
private static PandacraftUtils instance; private static PandacraftUtils instance;
public static PandacraftUtils getInstance() { return instance; } public static PandacraftUtils getInstance() { return instance; }
public DBConnection databaseConnection; //public DBConnection databaseConnection;
public CommandAfk commandAfk; public CommandAfk commandAfk;
public CommandList commandPlayers; public CommandList commandPlayers;
@ -61,6 +59,7 @@ public class PandacraftUtils extends JavaPlugin {
instance = this; instance = this;
/*
try { try {
databaseConnection = new DBConnection(ConfigManager.getInstance().Database_host, databaseConnection = new DBConnection(ConfigManager.getInstance().Database_host,
ConfigManager.getInstance().Database_port, ConfigManager.getInstance().Database_port,
@ -70,7 +69,7 @@ public class PandacraftUtils extends JavaPlugin {
} catch (ClassNotFoundException | SQLException e) { } catch (ClassNotFoundException | SQLException e) {
getLogger().severe("Impossible de se connecter à la base de donnée !"); getLogger().severe("Impossible de se connecter à la base de donnée !");
e.printStackTrace(); e.printStackTrace();
} }*/
commandPlayers = new CommandList(this); commandPlayers = new CommandList(this);
commandSetblock = new CommandSetblock(this); commandSetblock = new CommandSetblock(this);
@ -127,7 +126,7 @@ public class PandacraftUtils extends JavaPlugin {
ConfigManager.reloadConfig(); ConfigManager.reloadConfig();
try { databaseConnection.getConnection().close(); } catch (SQLException e) { } //try { databaseConnection.getConnection().close(); } catch (SQLException e) { }
} }

View File

@ -1,57 +0,0 @@
package net.mc_pandacraft.java.plugin.pandacraftutils.data_model;
import java.sql.Date;
import java.util.UUID;
import org.bukkit.entity.Player;
/**
* Représente les données persistante correspondant à un joueur donné sur le serveur
*
* <i>Le nom de cette classe correspond à celle de la table dans la base de donnée,
* d' la présence d'un <code>_</code>(underscore), qui n'est pas admis en général
* dans le nom d'une classe</i>
* @author Marc Baloup
*
*/
public class PandacraftUtils_Player extends Table {
// TODO Créer la table dans la base de donnée
// TODO Ajouter les champs
public UUID uuid; // NOT NULL
public String name; // NOT NULL
public boolean vanish = false; // NOT NULL
public Date mute = null;
public PandacraftUtils_Player(Player p) {
name = p.getName();
uuid = p.getUniqueId();
}
@Override
public String[] getValues() {
return new String[]{
uuid.toString(),
name,
(vanish)?"true":"false",
String.valueOf(mute)};
}
@Override
public String[] getFieldsName() {
// TODO Auto-generated method stub
return new String[]{
"uuid",
"name",
"vanish",
"mute"};
}
}

View File

@ -7,12 +7,11 @@ import java.sql.Statement;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
import net.mc_pandacraft.java.util.mysql.DBConnection; import net.mc_pandacraft.java.util.mysql.DBConnection;
public abstract class Table { public abstract class Table {
DBConnection db = PandacraftUtils.getInstance().databaseConnection; DBConnection db = null;//PandacraftUtils.getInstance().databaseConnection;
private boolean saved = false; private boolean saved = false;