Advertisement
Guest User

ItemSpawn

a guest
Nov 4th, 2014
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.99 KB | None | 0 0
  1. package de.mpgc.botbattle;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.Location;
  5. import org.bukkit.Material;
  6. import org.bukkit.World;
  7. import org.bukkit.enchantments.Enchantment;
  8. import org.bukkit.inventory.ItemStack;
  9. import org.bukkit.inventory.meta.ItemMeta;
  10. import org.bukkit.plugin.Plugin;
  11. import org.bukkit.scheduler.BukkitRunnable;
  12. import org.bukkit.scheduler.BukkitTask;
  13.  
  14. public abstract class ItemSpawn implements Plugin {
  15.    
  16.       static BotMain plugin;
  17.      
  18.       public static BotMain getInstance() {
  19.           return plugin;
  20.           }
  21.      
  22.         public static boolean isGameActive = false;
  23.  
  24.     public static void onItemSpawn() {
  25.         Bukkit.getServer().getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() {
  26.             public void run() {
  27.                 if (BotMain.isStarted = true) {
  28.                     double x = MainCmd.cfg.getInt("arenen.item.1.x");
  29.                     double y = MainCmd.cfg.getInt("arenen.item.1.y");
  30.                     double z = MainCmd.cfg.getInt("arenen.item.1.z");
  31.                     World w = Bukkit.getWorld(MainCmd.cfg.getString("arenen.item.1.world"));
  32.                    
  33.                     ItemStack Schraube = new ItemStack(Material.BRICK, 4);
  34.                     ItemMeta SchraubeMeta = Schraube.getItemMeta();
  35.                     SchraubeMeta.setDisplayName("§bSchraube");
  36.                     Schraube.setItemMeta(SchraubeMeta);
  37.                    
  38.                     Bukkit.getWorld(MainCmd.cfg.getString("arenen.item.1.world")).dropItemNaturally(new Location(w, x ,y , z), Schraube);
  39.                     Bukkit.getWorld(MainCmd.cfg.getString("arenen.item.2.world")).dropItemNaturally(new Location(w, x ,y , z), Schraube);
  40.                     if (MainCmd.cfg.getString("arenen.item.3") != null) {
  41.                          Bukkit.getWorld(MainCmd.cfg.getString("arenen.item.3.world")).dropItemNaturally(new Location(w, x ,y , z), Schraube);
  42.                        
  43.                     }
  44.                     if (MainCmd.cfg.getString("arenen.item.4") != null) {
  45.                          Bukkit.getWorld(MainCmd.cfg.getString("arenen.item.4.world")).dropItemNaturally(new Location(w, x ,y , z), Schraube);
  46.                        
  47.                     }
  48.                    
  49.                     try {
  50.                         Thread.sleep(1000);
  51.                     } catch (InterruptedException e) {
  52.                        
  53.                         e.printStackTrace();
  54.                     }
  55.                    
  56.                     ItemStack Mutter = new ItemStack(Material.IRON_BARDING, 1);
  57.                     ItemMeta MutterMeta = Mutter.getItemMeta();
  58.                     MutterMeta.setDisplayName("§eMutter");
  59.                     Mutter.setItemMeta(MutterMeta);
  60.                    
  61.                     Bukkit.getWorld(MainCmd.cfg.getString("arenen.item.1.world")).dropItemNaturally(new Location(w, x ,y , z), Mutter);
  62.                     Bukkit.getWorld(MainCmd.cfg.getString("arenen.item.2.world")).dropItemNaturally(new Location(w, x ,y , z), Mutter);
  63.                     if (MainCmd.cfg.getString("arenen.item.3") != null) {
  64.                         Bukkit.getWorld(MainCmd.cfg.getString("arenen.item.3.world")).dropItemNaturally(new Location(w, x ,y , z), Mutter);
  65.                     }
  66.                     if (MainCmd.cfg.getString("arenen.item.3") != null) {
  67.                         Bukkit.getWorld(MainCmd.cfg.getString("arenen.item.4.world")).dropItemNaturally(new Location(w, x ,y , z), Mutter);
  68.                     }
  69.                    
  70.                     try {
  71.                         Thread.sleep(2000);
  72.                     } catch (InterruptedException e) {
  73.                         e.printStackTrace();
  74.                     }
  75.                     ItemStack Zahnrad = new ItemStack(Material.GOLD_BARDING, 1);
  76.                     ItemMeta ZahnradMeta = Zahnrad.getItemMeta();
  77.                     ZahnradMeta.setDisplayName("§aZahnrad");
  78.                     Zahnrad.setItemMeta(ZahnradMeta);
  79.                    
  80.                     Bukkit.getWorld(MainCmd.cfg.getString("arenen.item.1.world")).dropItemNaturally(new Location(w, x ,y , z), Zahnrad);
  81.                     Bukkit.getWorld(MainCmd.cfg.getString("arenen.item.2.world")).dropItemNaturally(new Location(w, x ,y , z), Zahnrad);
  82.                     if (MainCmd.cfg.getString("arenen.item.3") != null) {
  83.                         Bukkit.getWorld(MainCmd.cfg.getString("arenen.item.3.world")).dropItemNaturally(new Location(w, x ,y , z), Zahnrad);
  84.                     }
  85.                     if (MainCmd.cfg.getString("arenen.item.4") != null) {
  86.                         Bukkit.getWorld(MainCmd.cfg.getString("arenen.item.4.world")).dropItemNaturally(new Location(w, x ,y , z), Zahnrad);
  87.                     }
  88.                     if (isGameActive = false) {
  89.                     }
  90.                    
  91.                 }
  92.                
  93.             }
  94.  
  95.         }, 20L, 10);
  96.     }
  97.  
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement