Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MAIN @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- package g2p_drop;
- import java.util.logging.Logger;
- import org.bukkit.Bukkit;
- import org.bukkit.Server;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.player.PlayerJoinEvent;
- import org.bukkit.plugin.Plugin;
- import org.bukkit.plugin.java.JavaPlugin;
- import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
- public class Main extends JavaPlugin implements Listener{
- int number;
- Server server = this.getServer();
- public static Main instance;
- public static Main plugin;
- public final Logger logger = Logger.getLogger("Minecraft");
- public final BlockBreakListener d = new BlockBreakListener(this);
- public void onEnable(){
- MySQL.stworzBaze();
- MySQL.stworzTabele("drop_surowce", "wegiel", "diament", "emerald", "zelazo", "zloto", "redstone", "dirt", "piasek");
- MySQL.stworzTabele2("drop_lvl", "lvl", "exp");
- server.getPluginManager().registerEvents(d, this);
- Bukkit.getPluginManager().registerEvents(new DropCommand(), this);
- instance = this;
- getCommand("drop").setExecutor(new DropCommand());
- this.logger.info("G2P_DROP - Inicjalizacja");
- Bukkit.getPluginManager().registerEvents(this, this);
- }
- public static Main getInst(){
- return instance;
- }
- public void onDisable(){
- }
- @EventHandler
- public void onPlayerFirstJoin(PlayerJoinEvent event){
- if(!event.getPlayer().hasPlayedBefore()) {
- MySQL.dodajRekord(event.getPlayer().getName(), "drop_surowce", 0,0,0,0,0,0,0,0);
- MySQL.dodajRekord2(event.getPlayer().getName(), "drop_lvl", 1,0);
- }
- }
- public WorldGuardPlugin getWorldGuard() {
- Plugin plugin = getServer().getPluginManager().getPlugin("WorldGuard");
- if (plugin == null || !(plugin instanceof WorldGuardPlugin)) {
- return null;
- }
- return (WorldGuardPlugin) plugin;
- }
- }
- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- MySQL @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- package g2p_drop;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.sql.Statement;
- public class MySQL {
- public static String url= "jdbc:mysql://mysql.sored.pl/";
- public static String baza = "kacan1999_g2p_db";
- public static String login = "kacan1999";
- public static String password = "oB0MrRvlz0";
- public static void stworzBaze() {
- try {
- Connection conn = DriverManager.getConnection(url, login, password);
- System.out.println("[MySQL] Polaczenie pomyslne!");
- Statement st = conn.createStatement();
- try {
- st.executeUpdate("CREATE DATABASE "+baza);
- conn.close();
- System.out.println("[MySQL] Baza utworzona");
- } catch (SQLException e) {
- }
- } catch (SQLException e) {
- System.out.println("[MySQL] Nie udalo sie polczyc!");
- }
- }
- public static void stworzTabele(String Tabelka, String rekord, String rekord2, String rekord3, String rekord4, String rekord5, String rekord6, String rekord7, String rekord8) {
- try {
- Connection conn = DriverManager.getConnection(url+baza, login, password);
- Statement st = conn.createStatement();
- try {
- 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";
- st.executeUpdate(nowa_tabela);
- conn.close();
- System.out.println("[MySQL] Baza utworzona");
- } catch (SQLException e) {
- }
- } catch (SQLException e) {
- System.out.println("[MySQL] Nie udalo sie polczyc!");
- }
- }
- public static void stworzTabele2(String Tabelka, String rekord, String rekord2) {
- try {
- Connection conn = DriverManager.getConnection(url+baza, login, password);
- Statement st = conn.createStatement();
- try {
- String nowa_tabela = "CREATE TABLE "+Tabelka+"(nick CHAR(16), "+rekord+" CHAR(30), "+rekord2+" CHAR(16)) DEFAULT CHARSET=cp1250 collate cp1250_polish_ci";
- st.executeUpdate(nowa_tabela);
- conn.close();
- System.out.println("[MySQL] Baza utworzona");
- } catch (SQLException e) {
- }
- } catch (SQLException e) {
- System.out.println("[MySQL] Nie udalo sie polczyc!");
- }
- }
- public static void dodajRekord(String player, String Tabelka, int rekord, int rekord2, int rekord3,int rekord4, int rekord5, int rekord6, int rekord7, int rekord8) {
- try {
- Connection conn = DriverManager.getConnection(url+baza, login, password);
- Statement st = conn.createStatement();
- try {
- String nick = player;
- st.executeUpdate("INSERT "+Tabelka+" VALUES ('"+nick+"' , '"+rekord+"', '"+rekord2+"', '"+rekord3+"', '"+rekord4+"', '"+rekord5+"', '"+rekord6+"', '"+rekord7+"', '"+rekord8+"')");
- conn.close();
- } catch (SQLException e) {
- }
- } catch (SQLException e) {
- }
- }
- public static void dodajRekord2(String player, String Tabelka, int rekord, int rekord2) {
- try {
- Connection conn = DriverManager.getConnection(url+baza, login, password);
- Statement st = conn.createStatement();
- try {
- String nick = player;
- st.executeUpdate("INSERT "+Tabelka+" VALUES ('"+nick+"' , '"+rekord+"', '"+rekord2+"')");
- conn.close();
- } catch (SQLException e) {
- }
- } catch (SQLException e) {
- }
- }
- public static void aktualizujRekord(String p,int ilosc, String Tabelka, String rekord) {
- try {
- Connection conn = DriverManager.getConnection(url+baza, login, password);
- Statement st = conn.createStatement();
- Statement st2 = conn.createStatement();
- String nick_do_aktualizacji = p;
- int pkt_do_aktualizacji = ilosc;
- try {
- ResultSet rs = st.executeQuery("SELECT * FROM "+Tabelka+" WHERE nick='"+nick_do_aktualizacji+"'");
- int sumaPkt=0;
- while(rs.next()){
- int _pkt = rs.getInt(rekord);
- sumaPkt = _pkt+pkt_do_aktualizacji;
- }
- try {
- rs = st.executeQuery("SELECT * FROM "+Tabelka+" WHERE nick='"+nick_do_aktualizacji+"'");
- st.executeUpdate("UPDATE "+Tabelka+" SET "+rekord+"='"+sumaPkt+"' WHERE nick='"+nick_do_aktualizacji+"'");
- st.close();
- st2.close();
- conn.close();
- }
- catch (SQLException e) {
- }
- } catch (SQLException e) {
- e.printStackTrace();
- }
- conn.close();
- } catch (SQLException e) {
- }
- }
- public static void aktualizujRekord2(String p,int ilosc, String Tabelka, String rekord) {
- try {
- Connection conn = DriverManager.getConnection(url+baza, login, password);
- Statement st = conn.createStatement();
- Statement st2 = conn.createStatement();
- String nick_do_aktualizacji = p;
- int pkt_do_aktualizacji = ilosc;
- try {
- ResultSet rs = st.executeQuery("SELECT * FROM "+Tabelka+" WHERE nick='"+nick_do_aktualizacji+"'");
- int sumaPkt=0;
- while(rs.next()){
- int _pkt = rs.getInt(rekord);
- sumaPkt = _pkt+pkt_do_aktualizacji;
- }
- try {
- rs = st.executeQuery("SELECT * FROM "+Tabelka+" WHERE nick='"+nick_do_aktualizacji+"'");
- st.executeUpdate("UPDATE "+Tabelka+" SET "+rekord+"='"+sumaPkt+"' WHERE nick='"+nick_do_aktualizacji+"'");
- st.close();
- st2.close();
- conn.close();
- }
- catch (SQLException e) {
- }
- } catch (SQLException e) {
- e.printStackTrace();
- }
- conn.close();
- } catch (SQLException e) {
- }
- }
- public static int WczytajRekordCoins(String player, String Tabelka, String rekord) {
- try {
- Connection conn = DriverManager.getConnection(url+baza, login, password);
- Statement st = conn.createStatement();
- String nick_do_wczytania = player;
- try {
- ResultSet rs = st.executeQuery("SELECT * FROM "+Tabelka+" WHERE nick='"+nick_do_wczytania+"'");
- while(rs.next()){
- int _pkt = rs.getInt(rekord);
- return _pkt;
- }
- } catch (SQLException e) {
- }
- conn.close();
- } catch (SQLException e) {
- }
- return 0;
- }
- public static int WczytajRekordLVL(String player, String Tabelka, String rekord) {
- try {
- Connection conn = DriverManager.getConnection(url+baza, login, password);
- Statement st = conn.createStatement();
- String nick_do_wczytania = player;
- try {
- ResultSet rs = st.executeQuery("SELECT * FROM "+Tabelka+" WHERE nick='"+nick_do_wczytania+"'");
- while(rs.next()){
- int _pkt = rs.getInt(rekord);
- return _pkt;
- }
- } catch (SQLException e) {
- }
- conn.close();
- } catch (SQLException e) {
- }
- return 0;
- }
- public static void zaladuj_MySQL(){
- stworzBaze();
- stworzTabele("drop_surowce", "wegiel", "diament", "emerald", "zelazo", "zloto", "redstone", "dirt", "piasek");
- }
- }
- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- BlockBreakListener @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- package g2p_drop;
- import java.util.HashMap;
- import java.util.Random;
- import net.minecraft.server.v1_7_R4.PacketPlayOutWorldParticles;
- import org.apache.commons.lang.Validate;
- import org.bukkit.Bukkit;
- import org.bukkit.GameMode;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.Sound;
- import org.bukkit.block.Block;
- import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
- import org.bukkit.enchantments.Enchantment;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.BlockBreakEvent;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.PlayerInventory;
- public class BlockBreakListener implements Listener{
- public BlockBreakListener(Main instance) {}
- Random rand = new Random ();
- public double getRandomDouble(double min, double max) throws IllegalArgumentException{
- Validate.isTrue(max > min, "Max nie moze byc mniejszy niz min");
- return (rand.nextDouble() * (max - min) + min);
- }
- public boolean getChance(double chance){
- return (chance >= 100 || (chance >= getRandomDouble(0, 100)));
- }
- public Location getLoc() {
- return loc;
- }
- public void setLoc(Location loc){
- this.loc = loc;
- }
- private Location loc;
- HashMap<Integer, ItemStack> leftOver = new HashMap<Integer, ItemStack>();
- @EventHandler
- public void onBreak(BlockBreakEvent e){
- Player p = e.getPlayer();
- Block b = e.getBlock();
- PlayerInventory pinv = p.getInventory();
- if(b.getType() == Material.STONE || b.getType() == Material.COBBLESTONE){
- if(Main.getInst().getWorldGuard().canBuild(e.getPlayer(), e.getBlock()) == true){
- if(p.getGameMode() == GameMode.SURVIVAL){
- 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){
- p.giveExp(1);
- if(p.getItemInHand().getItemMeta().getEnchants().containsKey(Enchantment.LOOT_BONUS_BLOCKS)){
- if(p.getItemInHand().getItemMeta().getEnchantLevel(Enchantment.LOOT_BONUS_BLOCKS) == 3){
- if(getChance(1.95)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.COAL));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §0Wegiel!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "wegiel");
- MySQL.aktualizujRekord2(p.getName(), 2, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(1.56)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.IRON_INGOT));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §7Zelazo!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "zelazo");
- MySQL.aktualizujRekord2(p.getName(), 3, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(1.3)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.GOLD_INGOT));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §6Zloto!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "zloto");
- MySQL.aktualizujRekord2(p.getName(), 4, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(0.65)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.EMERALD));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §2Emerald!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "emerald");
- MySQL.aktualizujRekord2(p.getName(), 5, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(1.95)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.DIRT));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §5Dirt!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "dirt");
- MySQL.aktualizujRekord2(p.getName(), 1, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(1.17)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.REDSTONE));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §4Redstone!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "redstone");
- MySQL.aktualizujRekord2(p.getName(), 3, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(0.39)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.DIAMOND));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §bDiament!!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "diament");
- MySQL.aktualizujRekord2(p.getName(), 6, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(2.08)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.SAND));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §ePiasek!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "piasek");
- MySQL.aktualizujRekord2(p.getName(), 1, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- }
- else;
- if(p.getItemInHand().getItemMeta().getEnchantLevel(Enchantment.LOOT_BONUS_BLOCKS) == 2){
- if(getChance(1.8)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.COAL));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §0Wegiel!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "wegiel");
- MySQL.aktualizujRekord2(p.getName(), 2, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(1.44)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.IRON_INGOT));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §7Zelazo!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "zelazo");
- MySQL.aktualizujRekord2(p.getName(), 3, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(1.2)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.GOLD_INGOT));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §6Zloto!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "zloto");
- MySQL.aktualizujRekord2(p.getName(), 4, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(0.6)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.EMERALD));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §2Emerald!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "emerald");
- MySQL.aktualizujRekord2(p.getName(), 5, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(1.8)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.DIRT));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §5Dirt!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "dirt");
- MySQL.aktualizujRekord2(p.getName(), 1, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(1.08)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.REDSTONE));
- p.sendMessage(" " + "§6§l»» §9Trafiles n-: §4Redstone!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "redstone");
- MySQL.aktualizujRekord2(p.getName(), 3, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(0.36)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.DIAMOND));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §bDiament!!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "diament");
- MySQL.aktualizujRekord2(p.getName(), 6, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(1.92)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.SAND));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §ePiasek!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "piasek");
- MySQL.aktualizujRekord2(p.getName(), 1, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- }
- else;
- if(p.getItemInHand().getItemMeta().getEnchantLevel(Enchantment.LOOT_BONUS_BLOCKS) == 1){
- if(getChance(1.65)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.COAL));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §0Wegiel!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "wegiel");
- MySQL.aktualizujRekord2(p.getName(), 2, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(1.32)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.IRON_INGOT));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §7Zelazo!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "zelazo");
- MySQL.aktualizujRekord2(p.getName(), 3, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(1.1)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.GOLD_INGOT));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §6Zloto!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "zloto");
- MySQL.aktualizujRekord2(p.getName(), 4, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(0.55)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.EMERALD));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §2Emerald!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "emerald");
- MySQL.aktualizujRekord2(p.getName(), 5, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(1.65)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.DIRT));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §5Dirt!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "dirt");
- MySQL.aktualizujRekord2(p.getName(), 1, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(0.99)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.REDSTONE));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §4Redstone!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "redstone");
- MySQL.aktualizujRekord2(p.getName(), 3, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(0.33)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.DIAMOND));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §bDiament!!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "diament");
- MySQL.aktualizujRekord2(p.getName(), 6, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(1.76)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.SAND));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §ePiasek!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "piasek");
- MySQL.aktualizujRekord2(p.getName(), 1, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- }}
- else;
- if(!(p.getItemInHand().getItemMeta().getEnchants().containsKey(Enchantment.LOOT_BONUS_BLOCKS))){
- if(getChance(1.5)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.COAL));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §0Wegiel!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "wegiel");
- MySQL.aktualizujRekord2(p.getName(), 2, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(1.2)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.IRON_INGOT));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §7Zelazo!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "zelazo");
- MySQL.aktualizujRekord2(p.getName(), 3, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(1.0)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.GOLD_INGOT));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §6Zloto!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "zloto");
- MySQL.aktualizujRekord2(p.getName(), 4, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(0.5)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.EMERALD));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §2Emerald!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "emerald");
- MySQL.aktualizujRekord2(p.getName(), 5, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(1.5)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.DIRT));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §5Dirt!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "dirt");
- MySQL.aktualizujRekord2(p.getName(), 1, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(0.9)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.REDSTONE));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §4Redstone!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "redstone");
- MySQL.aktualizujRekord2(p.getName(), 3, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(0.3)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.DIAMOND));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §bDiament!!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "diament");
- MySQL.aktualizujRekord2(p.getName(), 6, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- if(getChance(1.6)){
- p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
- p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1, 1);
- pinv.addItem(new ItemStack(Material.SAND));
- p.sendMessage(" " + "§6§l»» §9Trafiles na: §ePiasek!");
- MySQL.aktualizujRekord(p.getName(), 1, "drop_surowce", "piasek");
- MySQL.aktualizujRekord2(p.getName(), 1, "drop_lvl", "exp");
- setLoc(e.getBlock().getLocation().add(0.5,1.2,0.5));
- loc.getZ();
- loc.getY();
- loc.getX();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager", (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0.2F, 0.2F, 0.2F, 0.2F, 3);
- @SuppressWarnings("deprecation")
- Player[] onlinePlayers = Bukkit.getOnlinePlayers();
- for (int j = 0; j < onlinePlayers.length; j++) {
- Player p1 = onlinePlayers[j];
- ((CraftPlayer)p1).getHandle().playerConnection.sendPacket(packet);
- }
- }
- }
- }
- }
- }
- return;
- }
- }
- }
- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- DropCommand @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- package g2p_drop;
- import java.util.Arrays;
- import org.bukkit.Bukkit;
- import org.bukkit.Material;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.inventory.InventoryClickEvent;
- import org.bukkit.inventory.Inventory;
- import org.bukkit.inventory.InventoryHolder;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.ItemMeta;
- public class DropCommand implements Listener, CommandExecutor{
- public static Inventory drop = Bukkit.createInventory(null, 18, "§4§lDrop z kamienia i bruku");{
- }
- @EventHandler
- public void onClick(InventoryClickEvent e){
- Inventory i = e.getInventory();
- if(i == null){
- return;
- }
- if(i !=null){
- if(!i.getName().equals(drop.getTitle())){
- return;
- }
- if (e.getCurrentItem() == null){
- return;
- }else{
- if(e.getCurrentItem().getItemMeta() == null){
- return;
- }
- }
- }
- if(e.getWhoClicked() instanceof Player){
- Player p = (Player) e.getWhoClicked();
- ItemStack wegiel = new ItemStack(Material.COAL, 0);{
- ItemMeta im = wegiel.getItemMeta();
- im.setDisplayName("§8Wegiel");
- im.setLore(Arrays.asList("§7Szansa: §e1.5%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(p.getName(), "drop_surowce", "wegiel"))));
- wegiel.setItemMeta(im);
- }
- ItemStack diamond = new ItemStack(Material.DIAMOND, 0);{
- ItemMeta im = diamond.getItemMeta();
- im.setDisplayName("§bDiament");
- im.setLore(Arrays.asList("§7Szansa: §e0.3%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(p.getName(), "drop_surowce", "diament"))));
- diamond.setItemMeta(im);
- }
- ItemStack emerald = new ItemStack(Material.EMERALD, 0);{
- ItemMeta im = emerald.getItemMeta();
- im.setDisplayName("§2Emerald");
- im.setLore(Arrays.asList("§7Szansa: §e0.5%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(p.getName(), "drop_surowce", "emerald"))));
- emerald.setItemMeta(im);
- }
- ItemStack zelazo = new ItemStack(Material.IRON_INGOT, 0);{
- ItemMeta im = zelazo.getItemMeta();
- im.setDisplayName("§7Zelazo");
- im.setLore(Arrays.asList("§7Szansa: §e1.2%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(p.getName(), "drop_surowce", "zelazo"))));
- zelazo.setItemMeta(im);
- }
- ItemStack zloto = new ItemStack(Material.GOLD_INGOT, 0);{
- ItemMeta im = zloto.getItemMeta();
- im.setDisplayName("§6Zloto");
- im.setLore(Arrays.asList("§7Szansa: §e1.0%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(p.getName(), "drop_surowce", "zloto"))));
- zloto.setItemMeta(im);
- }
- ItemStack redstone = new ItemStack(Material.REDSTONE, 0);{
- ItemMeta im = redstone.getItemMeta();
- im.setDisplayName("§4Redstone");
- im.setLore(Arrays.asList("§7Szansa: §e0.9%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(p.getName(), "drop_surowce", "redstone"))));
- redstone.setItemMeta(im);
- }
- ItemStack dirt = new ItemStack(Material.DIRT, 0);{
- ItemMeta im = dirt.getItemMeta();
- im.setDisplayName("§5Dirt");
- im.setLore(Arrays.asList("§7Szansa: §e1.5%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(p.getName(), "drop_surowce", "dirt"))));
- dirt.setItemMeta(im);
- }
- ItemStack sand = new ItemStack(Material.SAND, 0);{
- ItemMeta im = sand.getItemMeta();
- im.setDisplayName("§ePiasek");
- im.setLore(Arrays.asList("§7Szansa: §e1.6%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(p.getName(), "drop_surowce", "piasek"))));
- sand.setItemMeta(im);
- }
- ItemStack exp = new ItemStack(Material.EXP_BOTTLE, 0);{
- ItemMeta im = exp.getItemMeta();
- im.setDisplayName("§f");
- im.setLore(Arrays.asList("§aIlosc zdobywanego doswiadczenia: §c1", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(p.getName(), "Statystyki_Cobblestone", "Ilosc"))));
- exp.setItemMeta(im);
- }
- ItemStack cobbl = new ItemStack(Material.COBBLESTONE, 0);{
- ItemMeta im = cobbl.getItemMeta();
- im.setDisplayName("§f");
- im.setLore(Arrays.asList("§2Wydobyty kamien oraz bruk: §c" + (MySQL.WczytajRekordCoins(p.getName(), "Statystyki_Cobblestone", "Ilosc"))));
- exp.setItemMeta(im);
- }
- ItemStack steve = new ItemStack(Material.SKULL, 0);{
- ItemMeta im = steve.getItemMeta();
- im.setDisplayName("§f");
- im.setLore(Arrays.asList("" + MySQL.WczytajRekordLVL(p.getName(), "drop_lvl", "exp"), "" + (MySQL.WczytajRekordLVL(p.getName(), "drop_lvl", "lvl"))));
- exp.setItemMeta(im);
- }
- if(e.getCurrentItem().getItemMeta() != null){
- if(e.getCurrentItem().equals(wegiel)){
- e.setCancelled(true);
- Inventory Inventory;
- ((Player) p).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) p, 9, "§4§lDrop z kamienia i bruku"));
- Inventory.setItem(0, wegiel);
- Inventory.setItem(1, diamond);
- Inventory.setItem(2, emerald);
- Inventory.setItem(3, zelazo);
- Inventory.setItem(4, zloto);
- Inventory.setItem(5, redstone);
- Inventory.setItem(6, dirt);
- Inventory.setItem(7, sand);
- Inventory.setItem(8, exp);
- Inventory.setItem(9, cobbl);
- Inventory.setItem(17, steve);
- }
- if(e.getCurrentItem().equals(diamond)){
- e.setCancelled(true);
- Inventory Inventory;
- ((Player) p).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) p, 9, "§4§lDrop z kamienia i bruku"));
- Inventory.setItem(0, wegiel);
- Inventory.setItem(1, diamond);
- Inventory.setItem(2, emerald);
- Inventory.setItem(3, zelazo);
- Inventory.setItem(4, zloto);
- Inventory.setItem(5, redstone);
- Inventory.setItem(6, dirt);
- Inventory.setItem(7, sand);
- Inventory.setItem(8, exp);
- Inventory.setItem(9, cobbl);
- Inventory.setItem(17, steve);
- }
- if(e.getCurrentItem().equals(emerald)){
- e.setCancelled(true);
- Inventory Inventory;
- ((Player) p).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) p, 9, "§4§lDrop z kamienia i bruku"));
- Inventory.setItem(0, wegiel);
- Inventory.setItem(1, diamond);
- Inventory.setItem(2, emerald);
- Inventory.setItem(3, zelazo);
- Inventory.setItem(4, zloto);
- Inventory.setItem(5, redstone);
- Inventory.setItem(6, dirt);
- Inventory.setItem(7, sand);
- Inventory.setItem(8, exp);
- Inventory.setItem(9, cobbl);
- Inventory.setItem(17, steve);
- }
- if(e.getCurrentItem().equals(exp)){
- e.setCancelled(true);
- Inventory Inventory;
- ((Player) p).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) p, 9, "§4§lDrop z kamienia i bruku"));
- Inventory.setItem(0, wegiel);
- Inventory.setItem(1, diamond);
- Inventory.setItem(2, emerald);
- Inventory.setItem(3, zelazo);
- Inventory.setItem(4, zloto);
- Inventory.setItem(5, redstone);
- Inventory.setItem(6, dirt);
- Inventory.setItem(7, sand);
- Inventory.setItem(8, exp);
- Inventory.setItem(9, cobbl);
- Inventory.setItem(17, steve);
- }
- if(e.getCurrentItem().equals(sand)){
- e.setCancelled(true);
- Inventory Inventory;
- ((Player) p).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) p, 9, "§4§lDrop z kamienia i bruku"));
- Inventory.setItem(0, wegiel);
- Inventory.setItem(1, diamond);
- Inventory.setItem(2, emerald);
- Inventory.setItem(3, zelazo);
- Inventory.setItem(4, zloto);
- Inventory.setItem(5, redstone);
- Inventory.setItem(6, dirt);
- Inventory.setItem(7, sand);
- Inventory.setItem(8, exp);
- Inventory.setItem(9, cobbl);
- Inventory.setItem(17, steve);
- }
- if(e.getCurrentItem().equals(dirt)){
- e.setCancelled(true);
- Inventory Inventory;
- ((Player) p).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) p, 9, "§4§lDrop z kamienia i bruku"));
- Inventory.setItem(0, wegiel);
- Inventory.setItem(1, diamond);
- Inventory.setItem(2, emerald);
- Inventory.setItem(3, zelazo);
- Inventory.setItem(4, zloto);
- Inventory.setItem(5, redstone);
- Inventory.setItem(6, dirt);
- Inventory.setItem(7, sand);
- Inventory.setItem(8, exp);
- Inventory.setItem(9, cobbl);
- Inventory.setItem(17, steve);
- }
- if(e.getCurrentItem().equals(zelazo)){
- e.setCancelled(true);
- Inventory Inventory;
- ((Player) p).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) p, 9, "§4§lDrop z kamienia i bruku"));
- Inventory.setItem(0, wegiel);
- Inventory.setItem(1, diamond);
- Inventory.setItem(2, emerald);
- Inventory.setItem(3, zelazo);
- Inventory.setItem(4, zloto);
- Inventory.setItem(5, redstone);
- Inventory.setItem(6, dirt);
- Inventory.setItem(7, sand);
- Inventory.setItem(8, exp);
- Inventory.setItem(9, cobbl);
- Inventory.setItem(17, steve);
- }
- if(e.getCurrentItem().equals(zloto)){
- e.setCancelled(true);
- Inventory Inventory;
- ((Player) p).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) p, 9, "§4§lDrop z kamienia i bruku"));
- Inventory.setItem(0, wegiel);
- Inventory.setItem(1, diamond);
- Inventory.setItem(2, emerald);
- Inventory.setItem(3, zelazo);
- Inventory.setItem(4, zloto);
- Inventory.setItem(5, redstone);
- Inventory.setItem(6, dirt);
- Inventory.setItem(7, sand);
- Inventory.setItem(8, exp);
- Inventory.setItem(9, cobbl);
- Inventory.setItem(17, steve);
- }
- if(e.getCurrentItem().equals(redstone)){
- e.setCancelled(true);
- Inventory Inventory;
- ((Player) p).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) p, 9, "§4§lDrop z kamienia i bruku"));
- Inventory.setItem(0, wegiel);
- Inventory.setItem(1, diamond);
- Inventory.setItem(2, emerald);
- Inventory.setItem(3, zelazo);
- Inventory.setItem(4, zloto);
- Inventory.setItem(5, redstone);
- Inventory.setItem(6, dirt);
- Inventory.setItem(7, sand);
- Inventory.setItem(8, exp);
- Inventory.setItem(9, cobbl);
- Inventory.setItem(17, steve);
- }
- }
- }
- }
- @Override
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- if(cmd.getName().equalsIgnoreCase("drop")){
- ItemStack wegiel = new ItemStack(Material.COAL, 0);{
- ItemMeta im = wegiel.getItemMeta();
- im.setDisplayName("§8Wegiel");
- im.setLore(Arrays.asList("§7Szansa: §e1.5%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "drop_surowce", "wegiel"))));
- wegiel.setItemMeta(im);
- }
- ItemStack diamond = new ItemStack(Material.DIAMOND, 0);{
- ItemMeta im = diamond.getItemMeta();
- im.setDisplayName("§bDiament");
- im.setLore(Arrays.asList("§7Szansa: §e0.3%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "drop_surowce", "diament"))));
- diamond.setItemMeta(im);
- }
- ItemStack emerald = new ItemStack(Material.EMERALD, 0);{
- ItemMeta im = emerald.getItemMeta();
- im.setDisplayName("§2Emerald");
- im.setLore(Arrays.asList("§7Szansa: §e0.5%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "drop_surowce", "emerald"))));
- emerald.setItemMeta(im);
- }
- ItemStack zelazo = new ItemStack(Material.IRON_INGOT, 0);{
- ItemMeta im = zelazo.getItemMeta();
- im.setDisplayName("§7Zelazo");
- im.setLore(Arrays.asList("§7Szansa: §e1.2%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "drop_surowce", "zelazo"))));
- zelazo.setItemMeta(im);
- }
- ItemStack zloto = new ItemStack(Material.GOLD_INGOT, 0);{
- ItemMeta im = zloto.getItemMeta();
- im.setDisplayName("§6Zloto");
- im.setLore(Arrays.asList("§7Szansa: §e1.0%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "drop_surowce", "zloto"))));
- zloto.setItemMeta(im);
- }
- ItemStack redstone = new ItemStack(Material.REDSTONE, 0);{
- ItemMeta im = redstone.getItemMeta();
- im.setDisplayName("§4Redstone");
- im.setLore(Arrays.asList("§7Szansa: §e0.9%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "drop_surowce", "redstone"))));
- redstone.setItemMeta(im);
- }
- ItemStack dirt = new ItemStack(Material.DIRT, 0);{
- ItemMeta im = dirt.getItemMeta();
- im.setDisplayName("§5Dirt");
- im.setLore(Arrays.asList("§7Szansa: §e1.5%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "drop_surowce", "dirt"))));
- dirt.setItemMeta(im);
- }
- ItemStack sand = new ItemStack(Material.SAND, 0);{
- ItemMeta im = sand.getItemMeta();
- im.setDisplayName("§ePiasek");
- im.setLore(Arrays.asList("§7Szansa: §e1.6%", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "drop_surowce", "piasek"))));
- sand.setItemMeta(im);
- }
- ItemStack exp = new ItemStack(Material.EXP_BOTTLE, 0);{
- ItemMeta im = exp.getItemMeta();
- im.setDisplayName("§f");
- im.setLore(Arrays.asList("§aIlosc zdobywanego doswiadczenia: §c1", "§aDo tej pory zdobyles: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "Statystyki_Cobblestone", "Ilosc"))));
- exp.setItemMeta(im);
- }
- ItemStack cobbl = new ItemStack(Material.COBBLESTONE, 0);{
- ItemMeta im = cobbl.getItemMeta();
- im.setDisplayName("§f");
- im.setLore(Arrays.asList("§2Wydobyty kamien oraz bruk: §c" + (MySQL.WczytajRekordCoins(sender.getName(), "Statystyki_Cobblestone", "Ilosc"))));
- exp.setItemMeta(im);
- }
- ItemStack steve = new ItemStack(Material.SKULL_ITEM, 0, (byte)3);{
- ItemMeta im = steve.getItemMeta();
- im.setDisplayName("§f");
- im.setLore(Arrays.asList("" + MySQL.WczytajRekordLVL(sender.getName(), "drop_lvl", "exp"), "" + (MySQL.WczytajRekordLVL(sender.getName(), "drop_lvl", "lvl"))));
- exp.setItemMeta(im);
- }
- Inventory Inventory;
- ((Player) sender).getPlayer().openInventory(Inventory = Bukkit.createInventory((InventoryHolder) sender, 18, "§4§lDrop z kamienia i bruku"));
- Inventory.setItem(0, wegiel);
- Inventory.setItem(1, diamond);
- Inventory.setItem(2, emerald);
- Inventory.setItem(3, zelazo);
- Inventory.setItem(4, zloto);
- Inventory.setItem(5, redstone);
- Inventory.setItem(6, dirt);
- Inventory.setItem(7, sand);
- Inventory.setItem(8, exp);
- Inventory.setItem(9, cobbl);
- Inventory.setItem(17, steve);
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement