Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.15 KB | None | 0 0
  1. erreur 1 en console quand je lance le serveur :
  2. [14:50:34 INFO]: [Callisto] Enabling Callisto v1.0
  3. [14:50:34 WARN]: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Commun
  4. ications link failure
  5.  
  6. The last packet sent successfully to the server was 0 milliseconds ago. The driv
  7. er has not received any packets from the server.
  8. [14:50:34 WARN]: at sun.reflect.NativeConstructorAccessorImpl.newInstance
  9. 0(Native Method)
  10. [14:50:34 WARN]: at sun.reflect.NativeConstructorAccessorImpl.newInstance
  11. (Unknown Source)
  12. [14:50:34 WARN]: at sun.reflect.DelegatingConstructorAccessorImpl.newInst
  13. ance(Unknown Source)
  14. [14:50:34 WARN]: at java.lang.reflect.Constructor.newInstance(Unknown Sou
  15. rce)
  16. [14:50:34 WARN]: at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
  17. [14:50:34 WARN]: at com.mysql.jdbc.SQLError.createCommunicationsException
  18. (SQLError.java:990)
  19. [14:50:34 WARN]: at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)
  20. [14:50:34 WARN]: at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionI
  21. mpl.java:2186)
  22. [14:50:34 WARN]: at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(Conne
  23. ctionImpl.java:2219)
  24. [14:50:34 WARN]: at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionI
  25. mpl.java:2014)
  26. [14:50:34 WARN]: at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.j
  27. ava:776)
  28. [14:50:34 WARN]: at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection
  29. .java:47)
  30. [14:50:34 WARN]: at sun.reflect.NativeConstructorAccessorImpl.newInstance
  31. 0(Native Method)
  32. [14:50:34 WARN]: at sun.reflect.NativeConstructorAccessorImpl.newInstance
  33. (Unknown Source)
  34. [14:50:34 WARN]: at sun.reflect.DelegatingConstructorAccessorImpl.newInst
  35. ance(Unknown Source)
  36. [14:50:34 WARN]: at java.lang.reflect.Constructor.newInstance(Unknown Sou
  37. rce)
  38. [14:50:34 WARN]: at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
  39. [14:50:34 WARN]: at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionI
  40. mpl.java:386)
  41. [14:50:34 WARN]: at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegist
  42. eringDriver.java:330)
  43. [14:50:34 WARN]: at java.sql.DriverManager.getConnection(Unknown Source)
  44. [14:50:34 WARN]: at java.sql.DriverManager.getConnection(Unknown Source)
  45. [14:50:34 WARN]: at Main.BanSystem.MySQL.connect(MySQL.java:14)
  46. [14:50:34 WARN]: at Main.Main.onEnable(Main.java:19)
  47. [14:50:34 WARN]: at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlug
  48. in.java:264)
  49. [14:50:34 WARN]: at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(
  50. JavaPluginLoader.java:337)
  51. [14:50:34 WARN]: at org.bukkit.plugin.SimplePluginManager.enablePlugin(Si
  52. mplePluginManager.java:403)
  53. [14:50:34 WARN]: at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlu
  54. gin(CraftServer.java:381)
  55. [14:50:34 WARN]: at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlu
  56. gins(CraftServer.java:330)
  57. [14:50:34 WARN]: at net.minecraft.server.v1_12_R1.MinecraftServer.t(Minec
  58. raftServer.java:422)
  59. [14:50:34 WARN]: at net.minecraft.server.v1_12_R1.MinecraftServer.l(Minec
  60. raftServer.java:383)
  61. [14:50:34 WARN]: at net.minecraft.server.v1_12_R1.MinecraftServer.a(Minec
  62. raftServer.java:338)
  63. [14:50:34 WARN]: at net.minecraft.server.v1_12_R1.DedicatedServer.init(De
  64. dicatedServer.java:272)
  65. [14:50:34 WARN]: at net.minecraft.server.v1_12_R1.MinecraftServer.run(Min
  66. ecraftServer.java:545)
  67. [14:50:34 WARN]: at java.lang.Thread.run(Unknown Source)
  68. [14:50:34 WARN]: Caused by: java.net.UnknownHostException: localhost
  69. [14:50:34 WARN]: at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Me
  70. thod)
  71. [14:50:34 WARN]: at java.net.InetAddress$2.lookupAllHostAddr(Unknown Sour
  72. ce)
  73. [14:50:34 WARN]: at java.net.InetAddress.getAddressesFromNameService(Unkn
  74. own Source)
  75. [14:50:34 WARN]: at java.net.InetAddress.getAllByName0(Unknown Source)
  76. [14:50:34 WARN]: at java.net.InetAddress.getAllByName(Unknown Source)
  77. [14:50:34 WARN]: at java.net.InetAddress.getAllByName(Unknown Source)
  78. [14:50:34 WARN]: at com.mysql.jdbc.StandardSocketFactory.connect(Standard
  79. SocketFactory.java:188)
  80. [14:50:34 WARN]: at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300)
  81. [14:50:34 WARN]: ... 27 more
  82. [14:50:34 INFO]: Pompei ON
  83. [14:50:34 INFO]: Server permissions file permissions.yml is empty, ignoring it
  84. [14:50:34 INFO]: Done (2,213s)! For help, type "help" or "?"
  85. [14:51:27 INFO]: UUID of player _LP_ is 50527029-1908-4e1a-b43f-fde071b672e3
  86. [14:51:28 ERROR]: Could not pass event PlayerJoinEvent to Callisto v1.0
  87. org.bukkit.event.EventException: null
  88. at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
  89. va:306) ~[spigot.jar:git-Spigot-2cf50f0-2b93d83]
  90. at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
  91. a:62) ~[spigot.jar:git-Spigot-2cf50f0-2b93d83]
  92. at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
  93. ava:500) [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  94. at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
  95. ava:485) [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  96. at net.minecraft.server.v1_12_R1.PlayerList.onPlayerJoin(PlayerList.java
  97. :346) [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  98. at net.minecraft.server.v1_12_R1.PlayerList.a(PlayerList.java:166) [spig
  99. ot.jar:git-Spigot-2cf50f0-2b93d83]
  100. at net.minecraft.server.v1_12_R1.LoginListener.b(LoginListener.java:159)
  101. [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  102. at net.minecraft.server.v1_12_R1.LoginListener.e(LoginListener.java:57)
  103. [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  104. at net.minecraft.server.v1_12_R1.NetworkManager.a(NetworkManager.java:23
  105. 3) [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  106. at net.minecraft.server.v1_12_R1.ServerConnection.c(ServerConnection.jav
  107. a:140) [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  108. at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:
  109. 845) [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  110. at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:
  111. 406) [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  112. at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:
  113. 679) [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  114. at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.jav
  115. a:577) [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  116. at java.lang.Thread.run(Unknown Source) [?:1.8.0_131]
  117. Caused by: java.lang.NullPointerException
  118. at Main.BanSystem.PlayerInfos.update(PlayerInfos.java:23) ~[?:?]
  119. at BanSystem.Listeners.PlayerJoin.onJoin(PlayerJoin.java:18) ~[?:?]
  120. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
  121. _131]
  122. at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
  123. _131]
  124. at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
  125. .8.0_131]
  126. at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131]
  127. at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
  128. va:302) ~[spigot.jar:git-Spigot-2cf50f0-2b93d83]
  129. ... 14 more
  130. [14:51:28 INFO]: _LP_[/127.0.0.1:49789] logged in with entity id 56 at ([world]2
  131.  
  132. Erreur 2 quand je me connect au serveur
  133. [15:02:54 INFO]: UUID of player _LP_ is 50527029-1908-4e1a-b43f-fde071b672e3
  134. [15:02:54 ERROR]: Could not pass event PlayerJoinEvent to Callisto v1.0
  135. org.bukkit.event.EventException: null
  136. at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
  137. va:306) ~[spigot.jar:git-Spigot-2cf50f0-2b93d83]
  138. at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
  139. a:62) ~[spigot.jar:git-Spigot-2cf50f0-2b93d83]
  140. at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
  141. ava:500) [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  142. at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
  143. ava:485) [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  144. at net.minecraft.server.v1_12_R1.PlayerList.onPlayerJoin(PlayerList.java
  145. :346) [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  146. at net.minecraft.server.v1_12_R1.PlayerList.a(PlayerList.java:166) [spig
  147. ot.jar:git-Spigot-2cf50f0-2b93d83]
  148. at net.minecraft.server.v1_12_R1.LoginListener.b(LoginListener.java:159)
  149. [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  150. at net.minecraft.server.v1_12_R1.LoginListener.e(LoginListener.java:57)
  151. [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  152. at net.minecraft.server.v1_12_R1.NetworkManager.a(NetworkManager.java:23
  153. 3) [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  154. at net.minecraft.server.v1_12_R1.ServerConnection.c(ServerConnection.jav
  155. a:140) [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  156. at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:
  157. 845) [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  158. at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:
  159. 406) [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  160. at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:
  161. 679) [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  162. at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.jav
  163. a:577) [spigot.jar:git-Spigot-2cf50f0-2b93d83]
  164. at java.lang.Thread.run(Unknown Source) [?:1.8.0_131]
  165. Caused by: java.lang.NullPointerException
  166. at Main.BanSystem.PlayerInfos.update(PlayerInfos.java:23) ~[?:?]
  167. at BanSystem.Listeners.PlayerJoin.onJoin(PlayerJoin.java:18) ~[?:?]
  168. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
  169. _131]
  170. at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
  171. _131]
  172. at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
  173. .8.0_131]
  174. at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131]
  175. at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
  176. va:302) ~[spigot.jar:git-Spigot-2cf50f0-2b93d83]
  177. ... 14 more
  178. [15:02:54 INFO]: _LP_[/127.0.0.1:49883] logged in with entity id 7821 at ([world
  179. ]270.73017764386225, 34.0, 594.6756096101622)
  180.  
  181. classe MAIN :
  182.  
  183. package Main;
  184.  
  185.  
  186. import org.bukkit.Bukkit;
  187. import org.bukkit.plugin.java.JavaPlugin;
  188.  
  189. import BanSystem.Listeners.PlayerJoin;
  190. import Main.BanSystem.MySQL;
  191.  
  192. public class Main extends JavaPlugin {
  193.  
  194. private static Main instance;
  195. public MySQL mysql = new MySQL();
  196.  
  197.  
  198. @Override
  199. public void onEnable(){
  200. instance = this;
  201. mysql.connect("localhost ", 3306, "Callisto", "root", "");
  202. System.out.println("Pompei ON");
  203.  
  204. Bukkit.getPluginManager().registerEvents(new PlayerJoin(), this);
  205.  
  206. }
  207.  
  208. @Override
  209. public void onDisable() {
  210. System.out.println("Pompei OFF");
  211. mysql.disconnect();
  212.  
  213. }
  214.  
  215. /**
  216. * Récupérer cette class dans les autres
  217. * @return Main
  218. */
  219.  
  220. public static Main getInstance(){
  221. return instance;
  222. }
  223. }
  224.  
  225. classe MySQL :
  226.  
  227. package Main.BanSystem;
  228.  
  229. import java.sql.Connection;
  230. import java.sql.DriverManager;
  231. import java.sql.SQLException;
  232.  
  233. public class MySQL {
  234.  
  235. private Connection conn;
  236.  
  237. public void connect(String host, int port, String database, String user, String password){
  238. if(!isConnected()){
  239. try {
  240. conn = DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database, user, password);
  241. System.out.println("[BanSystem] Connexion etablie avec la bdd");
  242. } catch (SQLException e) {
  243. e.printStackTrace();
  244. }
  245. }
  246. }
  247.  
  248. public void disconnect(){
  249. if(isConnected()){
  250. try {
  251. conn.close();
  252. } catch (SQLException e) {
  253. e.printStackTrace();
  254. }
  255. }
  256. }
  257.  
  258. public boolean isConnected(){
  259. try {
  260. if((conn == null) || (conn.isClosed()) || conn.isValid(5)){
  261. return false;
  262. }
  263. return true;
  264. } catch (SQLException e) {
  265. e.printStackTrace();
  266. }
  267. return false;
  268. }
  269.  
  270. /**
  271. * Récupérer la connection
  272. * @return Connection
  273. */
  274. public Connection getConnection() {
  275. return conn;
  276. }
  277.  
  278. }
  279.  
  280.  
  281. Classe PlayerJoin :
  282.  
  283. package BanSystem.Listeners;
  284.  
  285. import org.bukkit.entity.Player;
  286. import org.bukkit.event.EventHandler;
  287. import org.bukkit.event.Listener;
  288. import org.bukkit.event.player.PlayerJoinEvent;
  289.  
  290. import Main.BanSystem.PlayerInfos;
  291.  
  292.  
  293. public class PlayerJoin implements Listener{
  294.  
  295. @EventHandler
  296. public void onJoin(PlayerJoinEvent e){
  297. Player player = e.getPlayer();
  298. PlayerInfos playerinfos = new PlayerInfos();
  299.  
  300. playerinfos.update(player);
  301.  
  302. }
  303.  
  304. }
  305.  
  306. Classe PlayerInfos :
  307.  
  308. package Main.BanSystem;
  309.  
  310. import org.bukkit.entity.Player;
  311. import java.sql.PreparedStatement;
  312. import java.sql.ResultSet;
  313. import java.sql.SQLException;
  314. import java.util.UUID;
  315.  
  316. import Main.Main;
  317.  
  318. public class PlayerInfos {
  319.  
  320. private Main main = Main.getInstance();
  321.  
  322. /**
  323. * Actualiser/créer les informations du joueur
  324. * @param player
  325. */
  326.  
  327.  
  328. public void update(Player player){
  329. try {
  330. PreparedStatement sts = main.mysql.getConnection().prepareStatement("SELECT player_name FROM player_infos WHERE player_uuid=?" );
  331. sts.setString(1, player.getUniqueId().toString());
  332. ResultSet rs = sts.executeQuery();
  333.  
  334. if(rs.next()){
  335. PreparedStatement update = main.mysql.getConnection().prepareStatement("UPDATE player_infos SET player_name=? WHERE player_uuid=?");
  336. update.setString(1, player.getName());
  337. update.setString(2, player.getUniqueId().toString());
  338. update.executeUpdate();
  339. update.close();
  340. System.out.println("Update : " + player.getName() + " , " + player.getUniqueId().toString()); //
  341. } else {
  342. PreparedStatement insert = main.mysql.getConnection().prepareStatement("INSERT INTO player_infos (player_uuid, player_name) VALUES (?, ?)");
  343. insert.setString(1, player.getUniqueId().toString());
  344. insert.setString(2, player.getName());
  345. insert.executeUpdate();
  346. insert.close();
  347. System.out.println("Insertion : " + player.getName() + " , " + player.getUniqueId().toString()); //
  348. }
  349. } catch (SQLException e) {
  350. e.printStackTrace();
  351. }
  352.  
  353.  
  354.  
  355.  
  356. }
  357.  
  358. /**
  359. * Vérifie si le joueur a des informations dans la table
  360. * @param playerName
  361. * @return true/false
  362. */
  363.  
  364. public boolean exist(String playerName){
  365. try {
  366. PreparedStatement sts = main.mysql.getConnection().prepareStatement("SELECT * FROM players_infos WHERE player_name?");
  367. sts.setString(1, playerName);
  368. ResultSet rs = sts.executeQuery();
  369. return rs.next();
  370. } catch (SQLException e) {
  371. e.printStackTrace();
  372. }
  373. return false;
  374. }
  375.  
  376. /**
  377. * Récupérer l'UUID dun joueur avec son pseudo
  378. * @param playerName
  379. * @return UUID
  380. *
  381. */
  382.  
  383.  
  384. public UUID getUUID(String playerName){
  385. try {
  386. PreparedStatement sts = Main.getInstance().mysql.getConnection().prepareStatement("SELECT player_uuid FROM player_infos WHERE player_name=?");
  387. sts.setString(1, playerName);
  388. ResultSet rs = sts.executeQuery();
  389.  
  390. if(rs.next()){
  391. return UUID.fromString(rs.getString("player_uuid"));
  392. }
  393. } catch (SQLException e) {
  394. e.printStackTrace();
  395. }
  396. throw new NullPointerException("Le joueur na pas dinformations dans la table");
  397. }
  398.  
  399. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement