Guest User

Untitled

a guest
Dec 14th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. package org.tespia;
  2.  
  3. import java.sql.ResultSet;
  4.  
  5. import org.bukkit.entity.Player;
  6. import org.bukkit.event.player.PlayerListener;
  7. import org.bukkit.event.player.PlayerLoginEvent;
  8. import lib.PatPeter.SQLibrary.*;
  9.  
  10. public class ForumBridgePlayerListener extends PlayerListener {
  11.  
  12. private ForumBridge plugin;
  13. private MySQL mysql;
  14. private ResultSet rs;
  15. private String groups;
  16. private Player player;
  17. private String sqlStatement;
  18.  
  19. private String memberPerm;
  20. private Integer memberGroupID;
  21. private String donatorPerm;
  22. private Integer donatorGroupID;
  23.  
  24. public ForumBridgePlayerListener(ForumBridge instance, String memberPerm, Integer memberGroupID, String donatorPerm, Integer donatorGroupID)
  25. {
  26. this.plugin = instance;
  27.  
  28. this.memberPerm = memberPerm;
  29. this.memberGroupID = memberGroupID;
  30. this.donatorPerm = donatorPerm;
  31. this.donatorGroupID = donatorGroupID;
  32.  
  33. try
  34. {
  35. this.mysql = new MySQL(plugin.getServer().getLogger(),"[ForumBridge]","mysql.tespia.org","3306","vbcraft_forum","tespia_sql","starchaser");
  36. this.mysql.open();
  37. }
  38. catch (Exception e)
  39. {
  40. plugin.getServer().broadcastMessage(e.getMessage());
  41. }
  42.  
  43.  
  44. }
  45.  
  46. public void onPlayerLogin(PlayerLoginEvent event)
  47. {
  48. this.player = event.getPlayer();
  49. this.sqlStatement = ("SELECT secondary_group_ids FROM xf_user WHERE LOWER(username) = \"" + this.player.getName().toLowerCase() + "\";");
  50.  
  51. try
  52. {
  53. this.rs = this.mysql.query(this.sqlStatement);
  54. this.groups = rs.getString("secondary_group_ids");
  55. System.out.println("SQL GOOD");
  56. }
  57. catch (Exception e)
  58. {
  59. e.printStackTrace();
  60. }
  61.  
  62. //if (groups.contains(this.donatorGroupID.toString()))
  63. //{
  64. // plugin.getServer().broadcastMessage("GORUP ASDS");
  65. //}
  66. }
  67.  
  68. }
Add Comment
Please, Sign In to add comment