Guest User

Untitled

a guest
May 15th, 2019
71
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package de.mineship.listener;
  2. /*
  3. Developed by Clara Josephine Liebe
  4. » at 15.05.2019 • 14:09
  5. */
  6.  
  7. import de.mineship.MineShip;
  8. import de.mineship.util.Data;
  9. import de.mineship.util.LocationAPI;
  10. import org.bukkit.Bukkit;
  11. import org.bukkit.Material;
  12. import org.bukkit.entity.Player;
  13. import org.bukkit.event.EventHandler;
  14. import org.bukkit.event.Listener;
  15. import org.bukkit.event.inventory.InventoryClickEvent;
  16. import org.bukkit.event.player.PlayerJoinEvent;
  17. import org.bukkit.inventory.Inventory;
  18. import org.bukkit.inventory.ItemStack;
  19. import org.bukkit.inventory.meta.ItemMeta;
  20.  
  21. public class PlayerHandler implements Listener {
  22.  
  23. int setup = 0;
  24.  
  25. private Inventory gender = Bukkit.createInventory(null, 9*3, "§aWähle dein Geschlecht");
  26.  
  27. @EventHandler
  28. public void onJoin(PlayerJoinEvent e) {
  29. Player p = e.getPlayer();
  30.  
  31. if(!p.hasPlayedBefore()){
  32.  
  33. ItemStack placeholder = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 15);
  34. ItemMeta placeholderMeta = placeholder.getItemMeta();
  35. placeholderMeta.setDisplayName(" ");
  36. placeholder.setItemMeta(placeholderMeta);
  37.  
  38. for(int index = 0; index < gender.getSize(); index++) {
  39. gender.setItem(index, placeholder);
  40. }
  41.  
  42. ItemStack m = new ItemStack(Material.NETHER_STAR);
  43. ItemMeta mmeta = m.getItemMeta();
  44. mmeta.setDisplayName("§aMännlich");
  45. m.setItemMeta(mmeta);
  46.  
  47. ItemStack w = new ItemStack(Material.NETHER_STAR);
  48. ItemMeta wmeta = w.getItemMeta();
  49. wmeta.setDisplayName("§cWeiblich");
  50. w.setItemMeta(wmeta);
  51.  
  52.  
  53.  
  54. }
  55.  
  56. e.setJoinMessage(null);
  57. p.getInventory().clear();
  58. p.setHealth(1);
  59. p.setFoodLevel(20);
  60. e.setJoinMessage(Data.prefix + "§c" + p.getName() + " §cflirtet nun mit !");
  61.  
  62.  
  63. p.sendTitle("§c§lMineShip §c♥", "§cFinde deinen Partner !");
  64.  
  65.  
  66. p.teleport(LocationAPI.getLocation("Spawn"));
  67.  
  68. p.sendMessage(" ");
  69. p.sendMessage(" ");
  70. p.sendMessage(" ");
  71. p.sendMessage(" ");
  72. p.sendMessage(" ");
  73. p.sendMessage(" ");
  74. p.sendMessage(" ");
  75. p.sendMessage(" ");
  76. p.sendMessage(" ");
  77. p.sendMessage(" ");
  78. p.sendMessage(" ");
  79. p.sendMessage(" ");
  80. p.sendMessage(" ");
  81. p.sendMessage(" ");
  82. p.sendMessage(" ");
  83. p.sendMessage(" ");
  84. p.sendMessage(" ");
  85. p.sendMessage(" ");
  86. p.sendMessage(" ");
  87. p.sendMessage(" ");
  88. p.sendMessage(" ");
  89. p.sendMessage(" ");
  90. p.sendMessage(" ");
  91. p.sendMessage(" ");
  92. p.sendMessage(" ");
  93. p.sendMessage(" ");
  94. p.sendMessage(" ");
  95. p.sendMessage(" ");
  96. p.sendMessage(" ");
  97. p.sendMessage(" ");
  98. p.sendMessage(" ");
  99. p.sendMessage(" ");
  100. p.sendMessage(" ");
  101. p.sendMessage(" ");
  102. p.sendMessage(" ");
  103. p.sendMessage(" ");
  104. p.sendMessage(" ");
  105. p.sendMessage(" ");
  106. p.sendMessage(" ");
  107. p.sendMessage(" ");
  108. p.sendMessage(" ");
  109. p.sendMessage(" ");
  110. p.sendMessage(" ");
  111. p.sendMessage(" ");
  112. p.sendMessage(" ");
  113. p.sendMessage(" ");
  114. p.sendMessage(" ");
  115. p.sendMessage(" ");
  116. p.sendMessage(" ");
  117. p.sendMessage(" ");
  118. p.sendMessage(" ");
  119. p.sendMessage(" ");
  120. p.sendMessage(" ");
  121. p.sendMessage(" ");
  122. p.sendMessage(" ");
  123. p.sendMessage(" ");
  124. p.sendMessage(" ");
  125. p.sendMessage(" ");
  126. p.sendMessage(" ");
  127. p.sendMessage(" ");
  128. p.sendMessage(" ");
  129. p.sendMessage(" ");
  130. p.sendMessage(" ");
  131. p.sendMessage(" ");
  132. p.sendMessage("§cViel Spaß beim flirten ! ♥");
  133.  
  134. }
  135.  
  136.  
  137.  
  138. @EventHandler
  139. public void onClick(InventoryClickEvent e){
  140.  
  141. if(e.getInventory().getName().equalsIgnoreCase("§aWähle dein Geschlecht")){
  142.  
  143. setup = 1;
  144.  
  145. e.setCancelled(true);
  146.  
  147. if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§aMännlich")){
  148. MineShip.mysql.update("INSERT INTO Mineship(GENDER) VALUES ('Männlich')");
  149. }else
  150. if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§cWeiblich")){
  151. MineShip.mysql.update("INSERT INTO Mineship(GENDER) VALUES ('Weiblich')");
  152. }
  153.  
  154. }
  155.  
  156. }
  157.  
  158. }
RAW Paste Data