Advertisement
Guest User

Untitled

a guest
Mar 17th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 61.74 KB | None | 0 0
  1. MAIN @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  2.  
  3.  
  4. package g2p_drop;
  5. import java.util.logging.Logger;
  6. import org.bukkit.Bukkit;
  7. import org.bukkit.Server;
  8. import org.bukkit.event.EventHandler;
  9. import org.bukkit.event.Listener;
  10. import org.bukkit.event.player.PlayerJoinEvent;
  11. import org.bukkit.plugin.Plugin;
  12. import org.bukkit.plugin.java.JavaPlugin;
  13. import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
  14. public class Main extends JavaPlugin implements Listener{
  15. int number;
  16. Server server = this.getServer();
  17. public static Main instance;
  18. public static Main plugin;
  19. public final Logger logger = Logger.getLogger("Minecraft");
  20. public final BlockBreakListener d = new BlockBreakListener(this);
  21. public void onEnable(){
  22. MySQL.stworzBaze();
  23. MySQL.stworzTabele("drop_surowce", "wegiel", "diament", "emerald", "zelazo", "zloto", "redstone", "dirt", "piasek");
  24. MySQL.stworzTabele2("drop_lvl", "lvl", "exp");
  25. server.getPluginManager().registerEvents(d, this);
  26. Bukkit.getPluginManager().registerEvents(new DropCommand(), this);
  27. instance = this;
  28. getCommand("drop").setExecutor(new DropCommand());
  29. this.logger.info("G2P_DROP - Inicjalizacja");
  30. Bukkit.getPluginManager().registerEvents(this, this);
  31. }
  32. public static Main getInst(){
  33. return instance;
  34. }
  35. public void onDisable(){
  36. }
  37. @EventHandler
  38. public void onPlayerFirstJoin(PlayerJoinEvent event){
  39. if(!event.getPlayer().hasPlayedBefore()) {
  40. MySQL.dodajRekord(event.getPlayer().getName(), "drop_surowce", 0,0,0,0,0,0,0,0);
  41. MySQL.dodajRekord2(event.getPlayer().getName(), "drop_lvl", 1,0);
  42. }
  43. }
  44. public WorldGuardPlugin getWorldGuard() {
  45. Plugin plugin = getServer().getPluginManager().getPlugin("WorldGuard");
  46. if (plugin == null || !(plugin instanceof WorldGuardPlugin)) {
  47. return null;
  48. }
  49. return (WorldGuardPlugin) plugin;
  50. }
  51. }
  52.  
  53.  
  54. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  55.  
  56.  
  57. MySQL @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  58.  
  59. package g2p_drop;
  60.  
  61. import java.sql.Connection;
  62. import java.sql.DriverManager;
  63. import java.sql.ResultSet;
  64. import java.sql.SQLException;
  65. import java.sql.Statement;
  66.  
  67.  
  68. public class MySQL {
  69. public static String url= "jdbc:mysql://mysql.sored.pl/";
  70. public static String baza = "kacan1999_g2p_db";
  71. public static String login = "kacan1999";
  72. public static String password = "oB0MrRvlz0";
  73.  
  74.  
  75. public static void stworzBaze() {
  76. try {
  77. Connection conn = DriverManager.getConnection(url, login, password);
  78. System.out.println("[MySQL] Polaczenie pomyslne!");
  79. Statement st = conn.createStatement();
  80. try {
  81. st.executeUpdate("CREATE DATABASE "+baza);
  82. conn.close();
  83. System.out.println("[MySQL] Baza utworzona");
  84. } catch (SQLException e) {
  85. }
  86. } catch (SQLException e) {
  87. System.out.println("[MySQL] Nie udalo sie polczyc!");
  88. }
  89. }
  90.  
  91. public static void stworzTabele(String Tabelka, String rekord, String rekord2, String rekord3, String rekord4, String rekord5, String rekord6, String rekord7, String rekord8) {
  92. try {
  93. Connection conn = DriverManager.getConnection(url+baza, login, password);
  94. Statement st = conn.createStatement();
  95. try {
  96. String nowa_tabela = "CREATE TABLE "+Tabelka+"(nick CHAR(16), "+rekord+" CHAR(30), "+rekord2+" CHAR(16), "+rekord3+" CHAR(16), "+rekord4+" CHAR(16), "+rekord5+" CHAR(16), "+rekord6+" CHAR(16), "+rekord7+" CHAR(16), "+rekord8+" CHAR(16)) DEFAULT CHARSET=cp1250 collate cp1250_polish_ci";
  97. st.executeUpdate(nowa_tabela);
  98. conn.close();
  99. System.out.println("[MySQL] Baza utworzona");
  100. } catch (SQLException e) {
  101. }
  102. } catch (SQLException e) {
  103. System.out.println("[MySQL] Nie udalo sie polczyc!");
  104.  
  105. }
  106.  
  107. }
  108. public static void stworzTabele2(String Tabelka, String rekord, String rekord2) {
  109. try {
  110. Connection conn = DriverManager.getConnection(url+baza, login, password);
  111. Statement st = conn.createStatement();
  112. try {
  113. String nowa_tabela = "CREATE TABLE "+Tabelka+"(nick CHAR(16), "+rekord+" CHAR(30), "+rekord2+" CHAR(16)) DEFAULT CHARSET=cp1250 collate cp1250_polish_ci";
  114. st.executeUpdate(nowa_tabela);
  115. conn.close();
  116. System.out.println("[MySQL] Baza utworzona");
  117. } catch (SQLException e) {
  118. }
  119. } catch (SQLException e) {
  120. System.out.println("[MySQL] Nie udalo sie polczyc!");
  121.  
  122. }
  123.  
  124. }
  125. public static void dodajRekord(String player, String Tabelka, int rekord, int rekord2, int rekord3,int rekord4, int rekord5, int rekord6, int rekord7, int rekord8) {
  126. try {
  127. Connection conn = DriverManager.getConnection(url+baza, login, password);
  128. Statement st = conn.createStatement();
  129. try {
  130. String nick = player;
  131. st.executeUpdate("INSERT "+Tabelka+" VALUES ('"+nick+"' , '"+rekord+"', '"+rekord2+"', '"+rekord3+"', '"+rekord4+"', '"+rekord5+"', '"+rekord6+"', '"+rekord7+"', '"+rekord8+"')");
  132. conn.close();
  133. } catch (SQLException e) {
  134. }
  135. } catch (SQLException e) {
  136. }
  137. }
  138. public static void dodajRekord2(String player, String Tabelka, int rekord, int rekord2) {
  139. try {
  140. Connection conn = DriverManager.getConnection(url+baza, login, password);
  141. Statement st = conn.createStatement();
  142. try {
  143. String nick = player;
  144. st.executeUpdate("INSERT "+Tabelka+" VALUES ('"+nick+"' , '"+rekord+"', '"+rekord2+"')");
  145. conn.close();
  146. } catch (SQLException e) {
  147. }
  148. } catch (SQLException e) {
  149. }
  150. }
  151.  
  152.  
  153. public static void aktualizujRekord(String p,int ilosc, String Tabelka, String rekord) {
  154. try {
  155. Connection conn = DriverManager.getConnection(url+baza, login, password);
  156. Statement st = conn.createStatement();
  157. Statement st2 = conn.createStatement();
  158. String nick_do_aktualizacji = p;
  159. int pkt_do_aktualizacji = ilosc;
  160. try {
  161. ResultSet rs = st.executeQuery("SELECT * FROM "+Tabelka+" WHERE nick='"+nick_do_aktualizacji+"'");
  162. int sumaPkt=0;
  163. while(rs.next()){
  164. int _pkt = rs.getInt(rekord);
  165. sumaPkt = _pkt+pkt_do_aktualizacji;
  166.  
  167. }
  168. try {
  169. rs = st.executeQuery("SELECT * FROM "+Tabelka+" WHERE nick='"+nick_do_aktualizacji+"'");
  170. st.executeUpdate("UPDATE "+Tabelka+" SET "+rekord+"='"+sumaPkt+"' WHERE nick='"+nick_do_aktualizacji+"'");
  171. st.close();
  172. st2.close();
  173. conn.close();
  174. }
  175. catch (SQLException e) {
  176. }
  177. } catch (SQLException e) {
  178. e.printStackTrace();
  179. }
  180. conn.close();
  181. } catch (SQLException e) {
  182. }
  183. }
  184. public static void aktualizujRekord2(String p,int ilosc, String Tabelka, String rekord) {
  185. try {
  186. Connection conn = DriverManager.getConnection(url+baza, login, password);
  187. Statement st = conn.createStatement();
  188. Statement st2 = conn.createStatement();
  189. String nick_do_aktualizacji = p;
  190. int pkt_do_aktualizacji = ilosc;
  191. try {
  192. ResultSet rs = st.executeQuery("SELECT * FROM "+Tabelka+" WHERE nick='"+nick_do_aktualizacji+"'");
  193. int sumaPkt=0;
  194. while(rs.next()){
  195. int _pkt = rs.getInt(rekord);
  196. sumaPkt = _pkt+pkt_do_aktualizacji;
  197.  
  198. }
  199. try {
  200. rs = st.executeQuery("SELECT * FROM "+Tabelka+" WHERE nick='"+nick_do_aktualizacji+"'");
  201. st.executeUpdate("UPDATE "+Tabelka+" SET "+rekord+"='"+sumaPkt+"' WHERE nick='"+nick_do_aktualizacji+"'");
  202. st.close();
  203. st2.close();
  204. conn.close();
  205. }
  206. catch (SQLException e) {
  207. }
  208. } catch (SQLException e) {
  209. e.printStackTrace();
  210. }
  211. conn.close();
  212. } catch (SQLException e) {
  213. }
  214. }
  215. public static int WczytajRekordCoins(String player, String Tabelka, String rekord) {
  216. try {
  217. Connection conn = DriverManager.getConnection(url+baza, login, password);
  218. Statement st = conn.createStatement();
  219. String nick_do_wczytania = player;
  220. try {
  221. ResultSet rs = st.executeQuery("SELECT * FROM "+Tabelka+" WHERE nick='"+nick_do_wczytania+"'");
  222. while(rs.next()){
  223. int _pkt = rs.getInt(rekord);
  224. return _pkt;
  225. }
  226. } catch (SQLException e) {
  227. }
  228. conn.close();
  229. } catch (SQLException e) {
  230. }
  231. return 0;
  232. }
  233. public static int WczytajRekordLVL(String player, String Tabelka, String rekord) {
  234. try {
  235. Connection conn = DriverManager.getConnection(url+baza, login, password);
  236. Statement st = conn.createStatement();
  237. String nick_do_wczytania = player;
  238. try {
  239. ResultSet rs = st.executeQuery("SELECT * FROM "+Tabelka+" WHERE nick='"+nick_do_wczytania+"'");
  240. while(rs.next()){
  241. int _pkt = rs.getInt(rekord);
  242. return _pkt;
  243. }
  244. } catch (SQLException e) {
  245. }
  246. conn.close();
  247. } catch (SQLException e) {
  248. }
  249. return 0;
  250. }
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274. public static void zaladuj_MySQL(){
  275. stworzBaze();
  276. stworzTabele("drop_surowce", "wegiel", "diament", "emerald", "zelazo", "zloto", "redstone", "dirt", "piasek");
  277. }
  278. }
  279.  
  280. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  281.  
  282. BlockBreakListener @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  283.  
  284. package g2p_drop;
  285. import java.util.HashMap;
  286. import java.util.Random;
  287. import net.minecraft.server.v1_7_R4.PacketPlayOutWorldParticles;
  288. import org.apache.commons.lang.Validate;
  289. import org.bukkit.Bukkit;
  290. import org.bukkit.GameMode;
  291. import org.bukkit.Location;
  292. import org.bukkit.Material;
  293. import org.bukkit.Sound;
  294. import org.bukkit.block.Block;
  295. import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
  296. import org.bukkit.enchantments.Enchantment;
  297. import org.bukkit.entity.Player;
  298. import org.bukkit.event.EventHandler;
  299. import org.bukkit.event.Listener;
  300. import org.bukkit.event.block.BlockBreakEvent;
  301. import org.bukkit.inventory.ItemStack;
  302. import org.bukkit.inventory.PlayerInventory;
  303. public class BlockBreakListener implements Listener{
  304. public BlockBreakListener(Main instance) {}
  305. Random rand = new Random ();
  306. public double getRandomDouble(double min, double max) throws IllegalArgumentException{
  307. Validate.isTrue(max > min, "Max nie moze byc mniejszy niz min");
  308. return (rand.nextDouble() * (max - min) + min);
  309. }
  310. public boolean getChance(double chance){
  311. return (chance >= 100 || (chance >= getRandomDouble(0, 100)));
  312. }
  313. public Location getLoc() {
  314. return loc;
  315. }
  316. public void setLoc(Location loc){
  317. this.loc = loc;
  318. }
  319. private Location loc;
  320. HashMap<Integer, ItemStack> leftOver = new HashMap<Integer, ItemStack>();
  321. @EventHandler
  322. public void onBreak(BlockBreakEvent e){
  323. Player p = e.getPlayer();
  324. Block b = e.getBlock();
  325. PlayerInventory pinv = p.getInventory();
  326. if(b.getType() == Material.STONE || b.getType() == Material.COBBLESTONE){
  327. if(Main.getInst().getWorldGuard().canBuild(e.getPlayer(), e.getBlock()) == true){
  328. if(p.getGameMode() == GameMode.SURVIVAL){
  329. if(p.getItemInHand().getType() == Material.WOOD_PICKAXE || p.getItemInHand().getType() == Material.STONE_PICKAXE || p.getItemInHand().getType() == Material.GOLD_PICKAXE || p.getItemInHand().getType() == Material.IRON_PICKAXE || p.getItemInHand().getType() == Material.DIAMOND_PICKAXE){
  330. p.giveExp(1);
  331.  
  332.  
  333. if(p.getItemInHand().getItemMeta().getEnchants().containsKey(Enchantment.LOOT_BONUS_BLOCKS)){
  334. if(p.getItemInHand().getItemMeta().getEnchantLevel(Enchantment.LOOT_BONUS_BLOCKS) == 3){
  335. if(getChance(1.95)){
  336. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  337. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  338. pinv.addItem(new ItemStack(Material.COAL));
  339. p.sendMessage(" " + "§6§l»» §9Trafiles na: §0Wegiel!");
  340. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "wegiel");
  341. MySQL.aktualizujRekord2(p.getName(), 2, "drop_lvl", "exp");
  342. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  343. loc.getZ();
  344. loc.getY();
  345. loc.getX();
  346. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  347.  
  348. @SuppressWarnings("deprecation")
  349. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  350. for (int j = 0; j < onlinePlayers.length; j++) {
  351. Player p1 = onlinePlayers[j];
  352. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  353. }
  354. }
  355. if(getChance(1.56)){
  356. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  357. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  358. pinv.addItem(new ItemStack(Material.IRON_INGOT));
  359. p.sendMessage(" " + "§6§l»» §9Trafiles na: §7Zelazo!");
  360. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "zelazo");
  361. MySQL.aktualizujRekord2(p.getName(), 3, "drop_lvl", "exp");
  362. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  363. loc.getZ();
  364. loc.getY();
  365. loc.getX();
  366. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  367.  
  368. @SuppressWarnings("deprecation")
  369. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  370. for (int j = 0; j < onlinePlayers.length; j++) {
  371. Player p1 = onlinePlayers[j];
  372. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  373. }
  374. }
  375. if(getChance(1.3)){
  376. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  377. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  378. pinv.addItem(new ItemStack(Material.GOLD_INGOT));
  379. p.sendMessage(" " + "§6§l»» §9Trafiles na: §6Zloto!");
  380. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "zloto");
  381. MySQL.aktualizujRekord2(p.getName(), 4, "drop_lvl", "exp");
  382. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  383. loc.getZ();
  384. loc.getY();
  385. loc.getX();
  386. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  387.  
  388. @SuppressWarnings("deprecation")
  389. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  390. for (int j = 0; j < onlinePlayers.length; j++) {
  391. Player p1 = onlinePlayers[j];
  392. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  393. }
  394. }
  395. if(getChance(0.65)){
  396. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  397. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  398. pinv.addItem(new ItemStack(Material.EMERALD));
  399. p.sendMessage(" " + "§6§l»» §9Trafiles na: §2Emerald!");
  400. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "emerald");
  401. MySQL.aktualizujRekord2(p.getName(), 5, "drop_lvl", "exp");
  402. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  403. loc.getZ();
  404. loc.getY();
  405. loc.getX();
  406. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  407.  
  408. @SuppressWarnings("deprecation")
  409. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  410. for (int j = 0; j < onlinePlayers.length; j++) {
  411. Player p1 = onlinePlayers[j];
  412. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  413. }
  414. }
  415. if(getChance(1.95)){
  416. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  417. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  418. pinv.addItem(new ItemStack(Material.DIRT));
  419. p.sendMessage(" " + "§6§l»» §9Trafiles na: §5Dirt!");
  420. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "dirt");
  421. MySQL.aktualizujRekord2(p.getName(), 1, "drop_lvl", "exp");
  422. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  423. loc.getZ();
  424. loc.getY();
  425. loc.getX();
  426. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  427.  
  428. @SuppressWarnings("deprecation")
  429. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  430. for (int j = 0; j < onlinePlayers.length; j++) {
  431. Player p1 = onlinePlayers[j];
  432. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  433. }
  434. }
  435. if(getChance(1.17)){
  436. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  437. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  438. pinv.addItem(new ItemStack(Material.REDSTONE));
  439. p.sendMessage(" " + "§6§l»» §9Trafiles na: §4Redstone!");
  440. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "redstone");
  441. MySQL.aktualizujRekord2(p.getName(), 3, "drop_lvl", "exp");
  442. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  443. loc.getZ();
  444. loc.getY();
  445. loc.getX();
  446. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  447.  
  448. @SuppressWarnings("deprecation")
  449. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  450. for (int j = 0; j < onlinePlayers.length; j++) {
  451. Player p1 = onlinePlayers[j];
  452. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  453. }
  454. }
  455. if(getChance(0.39)){
  456. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  457. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  458. pinv.addItem(new ItemStack(Material.DIAMOND));
  459. p.sendMessage(" " + "§6§l»» §9Trafiles na: §bDiament!!");
  460. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "diament");
  461. MySQL.aktualizujRekord2(p.getName(), 6, "drop_lvl", "exp");
  462. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  463. loc.getZ();
  464. loc.getY();
  465. loc.getX();
  466. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  467.  
  468. @SuppressWarnings("deprecation")
  469. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  470. for (int j = 0; j < onlinePlayers.length; j++) {
  471. Player p1 = onlinePlayers[j];
  472. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  473. }
  474. }
  475. if(getChance(2.08)){
  476. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  477. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  478. pinv.addItem(new ItemStack(Material.SAND));
  479. p.sendMessage(" " + "§6§l»» §9Trafiles na: §ePiasek!");
  480. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "piasek");
  481. MySQL.aktualizujRekord2(p.getName(), 1, "drop_lvl", "exp");
  482. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  483. loc.getZ();
  484. loc.getY();
  485. loc.getX();
  486. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  487.  
  488. @SuppressWarnings("deprecation")
  489. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  490. for (int j = 0; j < onlinePlayers.length; j++) {
  491. Player p1 = onlinePlayers[j];
  492. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  493. }
  494. }
  495. }
  496. else;
  497. if(p.getItemInHand().getItemMeta().getEnchantLevel(Enchantment.LOOT_BONUS_BLOCKS) == 2){
  498. if(getChance(1.8)){
  499. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  500. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  501. pinv.addItem(new ItemStack(Material.COAL));
  502. p.sendMessage(" " + "§6§l»» §9Trafiles na: §0Wegiel!");
  503. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "wegiel");
  504. MySQL.aktualizujRekord2(p.getName(), 2, "drop_lvl", "exp");
  505. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  506. loc.getZ();
  507. loc.getY();
  508. loc.getX();
  509. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  510.  
  511. @SuppressWarnings("deprecation")
  512. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  513. for (int j = 0; j < onlinePlayers.length; j++) {
  514. Player p1 = onlinePlayers[j];
  515. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  516. }
  517. }
  518. if(getChance(1.44)){
  519. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  520. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  521. pinv.addItem(new ItemStack(Material.IRON_INGOT));
  522. p.sendMessage(" " + "§6§l»» §9Trafiles na: §7Zelazo!");
  523. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "zelazo");
  524. MySQL.aktualizujRekord2(p.getName(), 3, "drop_lvl", "exp");
  525. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  526. loc.getZ();
  527. loc.getY();
  528. loc.getX();
  529. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  530.  
  531. @SuppressWarnings("deprecation")
  532. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  533. for (int j = 0; j < onlinePlayers.length; j++) {
  534. Player p1 = onlinePlayers[j];
  535. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  536. }
  537. }
  538. if(getChance(1.2)){
  539. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  540. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  541. pinv.addItem(new ItemStack(Material.GOLD_INGOT));
  542. p.sendMessage(" " + "§6§l»» §9Trafiles na: §6Zloto!");
  543. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "zloto");
  544. MySQL.aktualizujRekord2(p.getName(), 4, "drop_lvl", "exp");
  545. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  546. loc.getZ();
  547. loc.getY();
  548. loc.getX();
  549. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  550.  
  551. @SuppressWarnings("deprecation")
  552. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  553. for (int j = 0; j < onlinePlayers.length; j++) {
  554. Player p1 = onlinePlayers[j];
  555. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  556. }
  557. }
  558. if(getChance(0.6)){
  559. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  560. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  561. pinv.addItem(new ItemStack(Material.EMERALD));
  562. p.sendMessage(" " + "§6§l»» §9Trafiles na: §2Emerald!");
  563. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "emerald");
  564. MySQL.aktualizujRekord2(p.getName(), 5, "drop_lvl", "exp");
  565. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  566. loc.getZ();
  567. loc.getY();
  568. loc.getX();
  569. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  570.  
  571. @SuppressWarnings("deprecation")
  572. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  573. for (int j = 0; j < onlinePlayers.length; j++) {
  574. Player p1 = onlinePlayers[j];
  575. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  576. }
  577. }
  578. if(getChance(1.8)){
  579. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  580. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  581. pinv.addItem(new ItemStack(Material.DIRT));
  582. p.sendMessage(" " + "§6§l»» §9Trafiles na: §5Dirt!");
  583. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "dirt");
  584. MySQL.aktualizujRekord2(p.getName(), 1, "drop_lvl", "exp");
  585. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  586. loc.getZ();
  587. loc.getY();
  588. loc.getX();
  589. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  590.  
  591. @SuppressWarnings("deprecation")
  592. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  593. for (int j = 0; j < onlinePlayers.length; j++) {
  594. Player p1 = onlinePlayers[j];
  595. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  596. }
  597. }
  598. if(getChance(1.08)){
  599. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  600. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  601. pinv.addItem(new ItemStack(Material.REDSTONE));
  602. p.sendMessage(" " + "§6§l»» §9Trafiles n-: §4Redstone!");
  603. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "redstone");
  604. MySQL.aktualizujRekord2(p.getName(), 3, "drop_lvl", "exp");
  605. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  606. loc.getZ();
  607. loc.getY();
  608. loc.getX();
  609. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  610.  
  611. @SuppressWarnings("deprecation")
  612. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  613. for (int j = 0; j < onlinePlayers.length; j++) {
  614. Player p1 = onlinePlayers[j];
  615. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  616. }
  617. }
  618. if(getChance(0.36)){
  619. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  620. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  621. pinv.addItem(new ItemStack(Material.DIAMOND));
  622. p.sendMessage(" " + "§6§l»» §9Trafiles na: §bDiament!!");
  623. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "diament");
  624. MySQL.aktualizujRekord2(p.getName(), 6, "drop_lvl", "exp");
  625. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  626. loc.getZ();
  627. loc.getY();
  628. loc.getX();
  629. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  630.  
  631. @SuppressWarnings("deprecation")
  632. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  633. for (int j = 0; j < onlinePlayers.length; j++) {
  634. Player p1 = onlinePlayers[j];
  635. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  636. }
  637. }
  638. if(getChance(1.92)){
  639. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  640. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  641. pinv.addItem(new ItemStack(Material.SAND));
  642. p.sendMessage(" " + "§6§l»» §9Trafiles na: §ePiasek!");
  643. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "piasek");
  644. MySQL.aktualizujRekord2(p.getName(), 1, "drop_lvl", "exp");
  645. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  646. loc.getZ();
  647. loc.getY();
  648. loc.getX();
  649. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  650.  
  651. @SuppressWarnings("deprecation")
  652. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  653. for (int j = 0; j < onlinePlayers.length; j++) {
  654. Player p1 = onlinePlayers[j];
  655. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  656. }
  657. }
  658. }
  659. else;
  660. if(p.getItemInHand().getItemMeta().getEnchantLevel(Enchantment.LOOT_BONUS_BLOCKS) == 1){
  661. if(getChance(1.65)){
  662. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  663. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  664. pinv.addItem(new ItemStack(Material.COAL));
  665. p.sendMessage(" " + "§6§l»» §9Trafiles na: §0Wegiel!");
  666. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "wegiel");
  667. MySQL.aktualizujRekord2(p.getName(), 2, "drop_lvl", "exp");
  668. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  669. loc.getZ();
  670. loc.getY();
  671. loc.getX();
  672. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  673.  
  674. @SuppressWarnings("deprecation")
  675. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  676. for (int j = 0; j < onlinePlayers.length; j++) {
  677. Player p1 = onlinePlayers[j];
  678. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  679. }
  680. }
  681. if(getChance(1.32)){
  682. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  683. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  684. pinv.addItem(new ItemStack(Material.IRON_INGOT));
  685. p.sendMessage(" " + "§6§l»» §9Trafiles na: §7Zelazo!");
  686. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "zelazo");
  687. MySQL.aktualizujRekord2(p.getName(), 3, "drop_lvl", "exp");
  688. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  689. loc.getZ();
  690. loc.getY();
  691. loc.getX();
  692. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  693.  
  694. @SuppressWarnings("deprecation")
  695. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  696. for (int j = 0; j < onlinePlayers.length; j++) {
  697. Player p1 = onlinePlayers[j];
  698. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  699. }
  700. }
  701. if(getChance(1.1)){
  702. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  703. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  704. pinv.addItem(new ItemStack(Material.GOLD_INGOT));
  705. p.sendMessage(" " + "§6§l»» §9Trafiles na: §6Zloto!");
  706. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "zloto");
  707. MySQL.aktualizujRekord2(p.getName(), 4, "drop_lvl", "exp");
  708. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  709. loc.getZ();
  710. loc.getY();
  711. loc.getX();
  712. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  713.  
  714. @SuppressWarnings("deprecation")
  715. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  716. for (int j = 0; j < onlinePlayers.length; j++) {
  717. Player p1 = onlinePlayers[j];
  718. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  719. }
  720. }
  721. if(getChance(0.55)){
  722. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  723. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  724. pinv.addItem(new ItemStack(Material.EMERALD));
  725. p.sendMessage(" " + "§6§l»» §9Trafiles na: §2Emerald!");
  726. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "emerald");
  727. MySQL.aktualizujRekord2(p.getName(), 5, "drop_lvl", "exp");
  728. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  729. loc.getZ();
  730. loc.getY();
  731. loc.getX();
  732. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  733.  
  734. @SuppressWarnings("deprecation")
  735. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  736. for (int j = 0; j < onlinePlayers.length; j++) {
  737. Player p1 = onlinePlayers[j];
  738. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  739. }
  740. }
  741. if(getChance(1.65)){
  742. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  743. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  744. pinv.addItem(new ItemStack(Material.DIRT));
  745. p.sendMessage(" " + "§6§l»» §9Trafiles na: §5Dirt!");
  746. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "dirt");
  747. MySQL.aktualizujRekord2(p.getName(), 1, "drop_lvl", "exp");
  748. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  749. loc.getZ();
  750. loc.getY();
  751. loc.getX();
  752. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  753.  
  754. @SuppressWarnings("deprecation")
  755. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  756. for (int j = 0; j < onlinePlayers.length; j++) {
  757. Player p1 = onlinePlayers[j];
  758. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  759. }
  760. }
  761. if(getChance(0.99)){
  762. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  763. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  764. pinv.addItem(new ItemStack(Material.REDSTONE));
  765. p.sendMessage(" " + "§6§l»» §9Trafiles na: §4Redstone!");
  766. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "redstone");
  767. MySQL.aktualizujRekord2(p.getName(), 3, "drop_lvl", "exp");
  768. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  769. loc.getZ();
  770. loc.getY();
  771. loc.getX();
  772. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  773.  
  774. @SuppressWarnings("deprecation")
  775. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  776. for (int j = 0; j < onlinePlayers.length; j++) {
  777. Player p1 = onlinePlayers[j];
  778. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  779. }
  780. }
  781. if(getChance(0.33)){
  782. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  783. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  784. pinv.addItem(new ItemStack(Material.DIAMOND));
  785. p.sendMessage(" " + "§6§l»» §9Trafiles na: §bDiament!!");
  786. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "diament");
  787. MySQL.aktualizujRekord2(p.getName(), 6, "drop_lvl", "exp");
  788. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  789. loc.getZ();
  790. loc.getY();
  791. loc.getX();
  792. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  793.  
  794. @SuppressWarnings("deprecation")
  795. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  796. for (int j = 0; j < onlinePlayers.length; j++) {
  797. Player p1 = onlinePlayers[j];
  798. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  799. }
  800. }
  801. if(getChance(1.76)){
  802. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  803. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  804. pinv.addItem(new ItemStack(Material.SAND));
  805. p.sendMessage(" " + "§6§l»» §9Trafiles na: §ePiasek!");
  806. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "piasek");
  807. MySQL.aktualizujRekord2(p.getName(), 1, "drop_lvl", "exp");
  808. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  809. loc.getZ();
  810. loc.getY();
  811. loc.getX();
  812. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  813.  
  814. @SuppressWarnings("deprecation")
  815. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  816. for (int j = 0; j < onlinePlayers.length; j++) {
  817. Player p1 = onlinePlayers[j];
  818. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  819. }
  820. }
  821. }}
  822. else;
  823. if(!(p.getItemInHand().getItemMeta().getEnchants().containsKey(Enchantment.LOOT_BONUS_BLOCKS))){
  824. if(getChance(1.5)){
  825. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  826. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  827. pinv.addItem(new ItemStack(Material.COAL));
  828. p.sendMessage(" " + "§6§l»» §9Trafiles na: §0Wegiel!");
  829. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "wegiel");
  830. MySQL.aktualizujRekord2(p.getName(), 2, "drop_lvl", "exp");
  831. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  832. loc.getZ();
  833. loc.getY();
  834. loc.getX();
  835. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  836.  
  837. @SuppressWarnings("deprecation")
  838. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  839. for (int j = 0; j < onlinePlayers.length; j++) {
  840. Player p1 = onlinePlayers[j];
  841. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  842. }
  843. }
  844. if(getChance(1.2)){
  845. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  846. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  847. pinv.addItem(new ItemStack(Material.IRON_INGOT));
  848. p.sendMessage(" " + "§6§l»» §9Trafiles na: §7Zelazo!");
  849. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "zelazo");
  850. MySQL.aktualizujRekord2(p.getName(), 3, "drop_lvl", "exp");
  851. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  852. loc.getZ();
  853. loc.getY();
  854. loc.getX();
  855. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  856.  
  857. @SuppressWarnings("deprecation")
  858. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  859. for (int j = 0; j < onlinePlayers.length; j++) {
  860. Player p1 = onlinePlayers[j];
  861. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  862. }
  863. }
  864. if(getChance(1.0)){
  865. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  866. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  867. pinv.addItem(new ItemStack(Material.GOLD_INGOT));
  868. p.sendMessage(" " + "§6§l»» §9Trafiles na: §6Zloto!");
  869. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "zloto");
  870. MySQL.aktualizujRekord2(p.getName(), 4, "drop_lvl", "exp");
  871. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  872. loc.getZ();
  873. loc.getY();
  874. loc.getX();
  875. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  876.  
  877. @SuppressWarnings("deprecation")
  878. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  879. for (int j = 0; j < onlinePlayers.length; j++) {
  880. Player p1 = onlinePlayers[j];
  881. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  882. }
  883. }
  884. if(getChance(0.5)){
  885. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  886. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  887. pinv.addItem(new ItemStack(Material.EMERALD));
  888. p.sendMessage(" " + "§6§l»» §9Trafiles na: §2Emerald!");
  889. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "emerald");
  890. MySQL.aktualizujRekord2(p.getName(), 5, "drop_lvl", "exp");
  891. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  892. loc.getZ();
  893. loc.getY();
  894. loc.getX();
  895. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  896.  
  897. @SuppressWarnings("deprecation")
  898. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  899. for (int j = 0; j < onlinePlayers.length; j++) {
  900. Player p1 = onlinePlayers[j];
  901. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  902. }
  903. }
  904. if(getChance(1.5)){
  905. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  906. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  907. pinv.addItem(new ItemStack(Material.DIRT));
  908. p.sendMessage(" " + "§6§l»» §9Trafiles na: §5Dirt!");
  909. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "dirt");
  910. MySQL.aktualizujRekord2(p.getName(), 1, "drop_lvl", "exp");
  911. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  912. loc.getZ();
  913. loc.getY();
  914. loc.getX();
  915. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  916.  
  917. @SuppressWarnings("deprecation")
  918. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  919. for (int j = 0; j < onlinePlayers.length; j++) {
  920. Player p1 = onlinePlayers[j];
  921. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  922. }
  923. }
  924. if(getChance(0.9)){
  925. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  926. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  927. pinv.addItem(new ItemStack(Material.REDSTONE));
  928. p.sendMessage(" " + "§6§l»» §9Trafiles na: §4Redstone!");
  929. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "redstone");
  930. MySQL.aktualizujRekord2(p.getName(), 3, "drop_lvl", "exp");
  931. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  932. loc.getZ();
  933. loc.getY();
  934. loc.getX();
  935. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  936.  
  937. @SuppressWarnings("deprecation")
  938. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  939. for (int j = 0; j < onlinePlayers.length; j++) {
  940. Player p1 = onlinePlayers[j];
  941. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  942. }
  943. }
  944. if(getChance(0.3)){
  945. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  946. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  947. pinv.addItem(new ItemStack(Material.DIAMOND));
  948. p.sendMessage(" " + "§6§l»» §9Trafiles na: §bDiament!!");
  949. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "diament");
  950. MySQL.aktualizujRekord2(p.getName(), 6, "drop_lvl", "exp");
  951. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  952. loc.getZ();
  953. loc.getY();
  954. loc.getX();
  955. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  956.  
  957. @SuppressWarnings("deprecation")
  958. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  959. for (int j = 0; j < onlinePlayers.length; j++) {
  960. Player p1 = onlinePlayers[j];
  961. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  962. }
  963. }
  964. if(getChance(1.6)){
  965. p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
  966. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
  967. pinv.addItem(new ItemStack(Material.SAND));
  968. p.sendMessage(" " + "§6§l»» §9Trafiles na: §ePiasek!");
  969. MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "piasek");
  970. MySQL.aktualizujRekord2(p.getName(), 1, "drop_lvl", "exp");
  971. setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
  972. loc.getZ();
  973. loc.getY();
  974. loc.getX();
  975. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
  976.  
  977. @SuppressWarnings("deprecation")
  978. Player[] onlinePlayers = Bukkit.getOnlinePlayers();
  979. for (int j = 0; j < onlinePlayers.length; j++) {
  980. Player p1 = onlinePlayers[j];
  981. ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
  982. }
  983. }
  984. }
  985. }
  986. }
  987. }
  988. return;
  989. }
  990.  
  991. }
  992.  
  993.  
  994. }
  995.  
  996. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  997.  
  998. DropCommand @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  999.  
  1000. package g2p_drop;
  1001.  
  1002. import java.util.Arrays;
  1003.  
  1004. import org.bukkit.Bukkit;
  1005. import org.bukkit.Material;
  1006. import org.bukkit.command.Command;
  1007. import org.bukkit.command.CommandExecutor;
  1008. import org.bukkit.command.CommandSender;
  1009. import org.bukkit.entity.Player;
  1010. import org.bukkit.event.EventHandler;
  1011. import org.bukkit.event.Listener;
  1012. import org.bukkit.event.inventory.InventoryClickEvent;
  1013. import org.bukkit.inventory.Inventory;
  1014. import org.bukkit.inventory.InventoryHolder;
  1015. import org.bukkit.inventory.ItemStack;
  1016. import org.bukkit.inventory.meta.ItemMeta;
  1017.  
  1018. public class DropCommand implements Listener, CommandExecutor{
  1019.  
  1020. public static Inventory drop = Bukkit.createInventory(null, 18, "§4§lDrop z kamienia i bruku");{
  1021. }
  1022.  
  1023.  
  1024. @EventHandler
  1025. public void onClick(InventoryClickEvent e){
  1026. Inventory i = e.getInventory();
  1027. if(i == null){
  1028. return;
  1029. }
  1030. if(i !=null){
  1031. if(!i.getName().equals(drop.getTitle())){
  1032. return;
  1033. }
  1034. if (e.getCurrentItem() == null){
  1035. return;
  1036. }else{
  1037. if(e.getCurrentItem().getItemMeta() == null){
  1038. return;
  1039. }
  1040. }
  1041. }
  1042. if(e.getWhoClicked() instanceof Player){
  1043. Player p = (Player) e.getWhoClicked();
  1044. ItemStack wegiel = new ItemStack(Material.COAL, 0);{
  1045. ItemMeta im = wegiel.getItemMeta();
  1046. im.setDisplayName("§8Wegiel");
  1047. im.setLore(Arrays.asList("§7Szansa: §e1.5%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(p.getName(), "drop_surowce", "wegiel"))));
  1048. wegiel.setItemMeta(im);
  1049. }
  1050. ItemStack diamond = new ItemStack(Material.DIAMOND, 0);{
  1051. ItemMeta im = diamond.getItemMeta();
  1052. im.setDisplayName("§bDiament");
  1053. im.setLore(Arrays.asList("§7Szansa: §e0.3%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(p.getName(), "drop_surowce", "diament"))));
  1054. diamond.setItemMeta(im);
  1055. }
  1056. ItemStack emerald = new ItemStack(Material.EMERALD, 0);{
  1057. ItemMeta im = emerald.getItemMeta();
  1058. im.setDisplayName("§2Emerald");
  1059. im.setLore(Arrays.asList("§7Szansa: §e0.5%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(p.getName(), "drop_surowce", "emerald"))));
  1060. emerald.setItemMeta(im);
  1061. }
  1062. ItemStack zelazo = new ItemStack(Material.IRON_INGOT, 0);{
  1063. ItemMeta im = zelazo.getItemMeta();
  1064. im.setDisplayName("§7Zelazo");
  1065. im.setLore(Arrays.asList("§7Szansa: §e1.2%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(p.getName(), "drop_surowce", "zelazo"))));
  1066. zelazo.setItemMeta(im);
  1067. }
  1068. ItemStack zloto = new ItemStack(Material.GOLD_INGOT, 0);{
  1069. ItemMeta im = zloto.getItemMeta();
  1070. im.setDisplayName("§6Zloto");
  1071. im.setLore(Arrays.asList("§7Szansa: §e1.0%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(p.getName(), "drop_surowce", "zloto"))));
  1072. zloto.setItemMeta(im);
  1073. }
  1074. ItemStack redstone = new ItemStack(Material.REDSTONE, 0);{
  1075. ItemMeta im = redstone.getItemMeta();
  1076. im.setDisplayName("§4Redstone");
  1077. im.setLore(Arrays.asList("§7Szansa: §e0.9%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(p.getName(), "drop_surowce", "redstone"))));
  1078. redstone.setItemMeta(im);
  1079. }
  1080. ItemStack dirt = new ItemStack(Material.DIRT, 0);{
  1081. ItemMeta im = dirt.getItemMeta();
  1082. im.setDisplayName("§5Dirt");
  1083. im.setLore(Arrays.asList("§7Szansa: §e1.5%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(p.getName(), "drop_surowce", "dirt"))));
  1084. dirt.setItemMeta(im);
  1085. }
  1086. ItemStack sand = new ItemStack(Material.SAND, 0);{
  1087. ItemMeta im = sand.getItemMeta();
  1088. im.setDisplayName("§ePiasek");
  1089. im.setLore(Arrays.asList("§7Szansa: §e1.6%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(p.getName(), "drop_surowce", "piasek"))));
  1090. sand.setItemMeta(im);
  1091. }
  1092. ItemStack exp = new ItemStack(Material.EXP_BOTTLE, 0);{
  1093. ItemMeta im = exp.getItemMeta();
  1094. im.setDisplayName("§f");
  1095. im.setLore(Arrays.asList("§aIlosc zdobywanego doswiadczenia: §c1", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(p.getName(), "Statystyki_Cobblestone", "Ilosc"))));
  1096. exp.setItemMeta(im);
  1097. }
  1098. ItemStack cobbl = new ItemStack(Material.COBBLESTONE, 0);{
  1099. ItemMeta im = cobbl.getItemMeta();
  1100. im.setDisplayName("§f");
  1101. im.setLore(Arrays.asList("§2Wydobyty kamien oraz bruk: §c" + (MySQL.WczytajRekordCoins(p.getName(), "Statystyki_Cobblestone", "Ilosc"))));
  1102. exp.setItemMeta(im);
  1103. }
  1104. ItemStack steve = new ItemStack(Material.SKULL, 0);{
  1105. ItemMeta im = steve.getItemMeta();
  1106. im.setDisplayName("§f");
  1107. im.setLore(Arrays.asList("" + MySQL.WczytajRekordLVL(p.getName(), "drop_lvl", "exp"), "" + (MySQL.WczytajRekordLVL(p.getName(), "drop_lvl", "lvl"))));
  1108. exp.setItemMeta(im);
  1109. }
  1110. if(e.getCurrentItem().getItemMeta() != null){
  1111. if(e.getCurrentItem().equals(wegiel)){
  1112. e.setCancelled(true);
  1113. Inventory Inventory;
  1114. ((Player) p).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) p, 9, "§4§lDrop z kamienia i bruku"));
  1115. Inventory.setItem(0, wegiel);
  1116. Inventory.setItem(1, diamond);
  1117. Inventory.setItem(2, emerald);
  1118. Inventory.setItem(3, zelazo);
  1119. Inventory.setItem(4, zloto);
  1120. Inventory.setItem(5, redstone);
  1121. Inventory.setItem(6, dirt);
  1122. Inventory.setItem(7, sand);
  1123. Inventory.setItem(8, exp);
  1124. Inventory.setItem(9, cobbl);
  1125. Inventory.setItem(17, steve);
  1126. }
  1127. if(e.getCurrentItem().equals(diamond)){
  1128. e.setCancelled(true);
  1129. Inventory Inventory;
  1130. ((Player) p).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) p, 9, "§4§lDrop z kamienia i bruku"));
  1131. Inventory.setItem(0, wegiel);
  1132. Inventory.setItem(1, diamond);
  1133. Inventory.setItem(2, emerald);
  1134. Inventory.setItem(3, zelazo);
  1135. Inventory.setItem(4, zloto);
  1136. Inventory.setItem(5, redstone);
  1137. Inventory.setItem(6, dirt);
  1138. Inventory.setItem(7, sand);
  1139. Inventory.setItem(8, exp);
  1140. Inventory.setItem(9, cobbl);
  1141. Inventory.setItem(17, steve);
  1142. }
  1143. if(e.getCurrentItem().equals(emerald)){
  1144. e.setCancelled(true);
  1145. Inventory Inventory;
  1146. ((Player) p).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) p, 9, "§4§lDrop z kamienia i bruku"));
  1147. Inventory.setItem(0, wegiel);
  1148. Inventory.setItem(1, diamond);
  1149. Inventory.setItem(2, emerald);
  1150. Inventory.setItem(3, zelazo);
  1151. Inventory.setItem(4, zloto);
  1152. Inventory.setItem(5, redstone);
  1153. Inventory.setItem(6, dirt);
  1154. Inventory.setItem(7, sand);
  1155. Inventory.setItem(8, exp);
  1156. Inventory.setItem(9, cobbl);
  1157. Inventory.setItem(17, steve);
  1158. }
  1159. if(e.getCurrentItem().equals(exp)){
  1160. e.setCancelled(true);
  1161. Inventory Inventory;
  1162. ((Player) p).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) p, 9, "§4§lDrop z kamienia i bruku"));
  1163. Inventory.setItem(0, wegiel);
  1164. Inventory.setItem(1, diamond);
  1165. Inventory.setItem(2, emerald);
  1166. Inventory.setItem(3, zelazo);
  1167. Inventory.setItem(4, zloto);
  1168. Inventory.setItem(5, redstone);
  1169. Inventory.setItem(6, dirt);
  1170. Inventory.setItem(7, sand);
  1171. Inventory.setItem(8, exp);
  1172. Inventory.setItem(9, cobbl);
  1173. Inventory.setItem(17, steve);
  1174. }
  1175. if(e.getCurrentItem().equals(sand)){
  1176. e.setCancelled(true);
  1177. Inventory Inventory;
  1178. ((Player) p).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) p, 9, "§4§lDrop z kamienia i bruku"));
  1179. Inventory.setItem(0, wegiel);
  1180. Inventory.setItem(1, diamond);
  1181. Inventory.setItem(2, emerald);
  1182. Inventory.setItem(3, zelazo);
  1183. Inventory.setItem(4, zloto);
  1184. Inventory.setItem(5, redstone);
  1185. Inventory.setItem(6, dirt);
  1186. Inventory.setItem(7, sand);
  1187. Inventory.setItem(8, exp);
  1188. Inventory.setItem(9, cobbl);
  1189. Inventory.setItem(17, steve);
  1190. }
  1191. if(e.getCurrentItem().equals(dirt)){
  1192. e.setCancelled(true);
  1193. Inventory Inventory;
  1194. ((Player) p).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) p, 9, "§4§lDrop z kamienia i bruku"));
  1195. Inventory.setItem(0, wegiel);
  1196. Inventory.setItem(1, diamond);
  1197. Inventory.setItem(2, emerald);
  1198. Inventory.setItem(3, zelazo);
  1199. Inventory.setItem(4, zloto);
  1200. Inventory.setItem(5, redstone);
  1201. Inventory.setItem(6, dirt);
  1202. Inventory.setItem(7, sand);
  1203. Inventory.setItem(8, exp);
  1204. Inventory.setItem(9, cobbl);
  1205. Inventory.setItem(17, steve);
  1206. }
  1207. if(e.getCurrentItem().equals(zelazo)){
  1208. e.setCancelled(true);
  1209. Inventory Inventory;
  1210. ((Player) p).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) p, 9, "§4§lDrop z kamienia i bruku"));
  1211. Inventory.setItem(0, wegiel);
  1212. Inventory.setItem(1, diamond);
  1213. Inventory.setItem(2, emerald);
  1214. Inventory.setItem(3, zelazo);
  1215. Inventory.setItem(4, zloto);
  1216. Inventory.setItem(5, redstone);
  1217. Inventory.setItem(6, dirt);
  1218. Inventory.setItem(7, sand);
  1219. Inventory.setItem(8, exp);
  1220. Inventory.setItem(9, cobbl);
  1221. Inventory.setItem(17, steve);
  1222. }
  1223. if(e.getCurrentItem().equals(zloto)){
  1224. e.setCancelled(true);
  1225. Inventory Inventory;
  1226. ((Player) p).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) p, 9, "§4§lDrop z kamienia i bruku"));
  1227. Inventory.setItem(0, wegiel);
  1228. Inventory.setItem(1, diamond);
  1229. Inventory.setItem(2, emerald);
  1230. Inventory.setItem(3, zelazo);
  1231. Inventory.setItem(4, zloto);
  1232. Inventory.setItem(5, redstone);
  1233. Inventory.setItem(6, dirt);
  1234. Inventory.setItem(7, sand);
  1235. Inventory.setItem(8, exp);
  1236. Inventory.setItem(9, cobbl);
  1237. Inventory.setItem(17, steve);
  1238. }
  1239. if(e.getCurrentItem().equals(redstone)){
  1240. e.setCancelled(true);
  1241. Inventory Inventory;
  1242. ((Player) p).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) p, 9, "§4§lDrop z kamienia i bruku"));
  1243. Inventory.setItem(0, wegiel);
  1244. Inventory.setItem(1, diamond);
  1245. Inventory.setItem(2, emerald);
  1246. Inventory.setItem(3, zelazo);
  1247. Inventory.setItem(4, zloto);
  1248. Inventory.setItem(5, redstone);
  1249. Inventory.setItem(6, dirt);
  1250. Inventory.setItem(7, sand);
  1251. Inventory.setItem(8, exp);
  1252. Inventory.setItem(9, cobbl);
  1253. Inventory.setItem(17, steve);
  1254. }
  1255. }
  1256. }
  1257. }
  1258. @Override
  1259. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  1260. if(cmd.getName().equalsIgnoreCase("drop")){
  1261. ItemStack wegiel = new ItemStack(Material.COAL, 0);{
  1262. ItemMeta im = wegiel.getItemMeta();
  1263. im.setDisplayName("§8Wegiel");
  1264. im.setLore(Arrays.asList("§7Szansa: §e1.5%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "drop_surowce", "wegiel"))));
  1265. wegiel.setItemMeta(im);
  1266. }
  1267. ItemStack diamond = new ItemStack(Material.DIAMOND, 0);{
  1268. ItemMeta im = diamond.getItemMeta();
  1269. im.setDisplayName("§bDiament");
  1270. im.setLore(Arrays.asList("§7Szansa: §e0.3%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "drop_surowce", "diament"))));
  1271. diamond.setItemMeta(im);
  1272. }
  1273. ItemStack emerald = new ItemStack(Material.EMERALD, 0);{
  1274. ItemMeta im = emerald.getItemMeta();
  1275. im.setDisplayName("§2Emerald");
  1276. im.setLore(Arrays.asList("§7Szansa: §e0.5%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "drop_surowce", "emerald"))));
  1277. emerald.setItemMeta(im);
  1278. }
  1279. ItemStack zelazo = new ItemStack(Material.IRON_INGOT, 0);{
  1280. ItemMeta im = zelazo.getItemMeta();
  1281. im.setDisplayName("§7Zelazo");
  1282. im.setLore(Arrays.asList("§7Szansa: §e1.2%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "drop_surowce", "zelazo"))));
  1283. zelazo.setItemMeta(im);
  1284. }
  1285. ItemStack zloto = new ItemStack(Material.GOLD_INGOT, 0);{
  1286. ItemMeta im = zloto.getItemMeta();
  1287. im.setDisplayName("§6Zloto");
  1288. im.setLore(Arrays.asList("§7Szansa: §e1.0%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "drop_surowce", "zloto"))));
  1289. zloto.setItemMeta(im);
  1290. }
  1291. ItemStack redstone = new ItemStack(Material.REDSTONE, 0);{
  1292. ItemMeta im = redstone.getItemMeta();
  1293. im.setDisplayName("§4Redstone");
  1294. im.setLore(Arrays.asList("§7Szansa: §e0.9%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "drop_surowce", "redstone"))));
  1295. redstone.setItemMeta(im);
  1296. }
  1297. ItemStack dirt = new ItemStack(Material.DIRT, 0);{
  1298. ItemMeta im = dirt.getItemMeta();
  1299. im.setDisplayName("§5Dirt");
  1300. im.setLore(Arrays.asList("§7Szansa: §e1.5%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "drop_surowce", "dirt"))));
  1301. dirt.setItemMeta(im);
  1302. }
  1303. ItemStack sand = new ItemStack(Material.SAND, 0);{
  1304. ItemMeta im = sand.getItemMeta();
  1305. im.setDisplayName("§ePiasek");
  1306. im.setLore(Arrays.asList("§7Szansa: §e1.6%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "drop_surowce", "piasek"))));
  1307. sand.setItemMeta(im);
  1308. }
  1309. ItemStack exp = new ItemStack(Material.EXP_BOTTLE, 0);{
  1310. ItemMeta im = exp.getItemMeta();
  1311. im.setDisplayName("§f");
  1312. im.setLore(Arrays.asList("§aIlosc zdobywanego doswiadczenia: §c1", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "Statystyki_Cobblestone", "Ilosc"))));
  1313. exp.setItemMeta(im);
  1314. }
  1315. ItemStack cobbl = new ItemStack(Material.COBBLESTONE, 0);{
  1316. ItemMeta im = cobbl.getItemMeta();
  1317. im.setDisplayName("§f");
  1318. im.setLore(Arrays.asList("§2Wydobyty kamien oraz bruk: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "Statystyki_Cobblestone", "Ilosc"))));
  1319. exp.setItemMeta(im);
  1320. }
  1321. ItemStack steve = new ItemStack(Material.SKULL_ITEM, 0, (byte)3);{
  1322. ItemMeta im = steve.getItemMeta();
  1323. im.setDisplayName("§f");
  1324. im.setLore(Arrays.asList("" + MySQL.WczytajRekordLVL(sender.getName(), "drop_lvl", "exp"), "" + (MySQL.WczytajRekordLVL(sender.getName(), "drop_lvl", "lvl"))));
  1325. exp.setItemMeta(im);
  1326. }
  1327. Inventory Inventory;
  1328. ((Player) sender).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) sender, 18, "§4§lDrop z kamienia i bruku"));
  1329. Inventory.setItem(0, wegiel);
  1330. Inventory.setItem(1, diamond);
  1331. Inventory.setItem(2, emerald);
  1332. Inventory.setItem(3, zelazo);
  1333. Inventory.setItem(4, zloto);
  1334. Inventory.setItem(5, redstone);
  1335. Inventory.setItem(6, dirt);
  1336. Inventory.setItem(7, sand);
  1337. Inventory.setItem(8, exp);
  1338. Inventory.setItem(9, cobbl);
  1339. Inventory.setItem(17, steve);
  1340.  
  1341. }
  1342.  
  1343. return false;
  1344. }
  1345. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement