Advertisement
Camer047

Untitled

Dec 1st, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. package me.Camer047;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.Location;
  5. import org.bukkit.Material;
  6. import org.bukkit.block.Block;
  7. import org.bukkit.command.Command;
  8. import org.bukkit.command.CommandSender;
  9. import org.bukkit.entity.Player;
  10. import org.bukkit.plugin.java.JavaPlugin;
  11.  
  12. public class DefenceClass extends JavaPlugin {
  13.  
  14. @Override
  15. public void onEnable() {
  16. new ListenerClass(this);
  17. }
  18.  
  19. @Override
  20. public void onDisable() {
  21.  
  22. }
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29. //Unused command boolean
  30. //
  31. // public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  32. //
  33. // if (cmd.getName().equalsIgnoreCase("BLANK") && sender instanceof Player) {
  34. //
  35. // Player player = (Player) sender;
  36. //
  37. // return true;
  38. //
  39. // }
  40. //
  41. // return false;
  42. // }
  43.  
  44.  
  45.  
  46.  
  47. public void chestTimer() {
  48. //Teaching the array how to count
  49. final int[] array = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 , 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60};
  50. //Import bukkit schedular
  51. Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
  52. public void run(){
  53. //Create var 't' t uses above counting sequence
  54. for(int t : array){
  55. //After we get to 60,
  56. if(t == 60){
  57. //we spawn a chest with all random junk in it
  58.  
  59. Location loc = Bukkit.getServer().getWorld("Survival").getSpawnLocation();
  60. Block block = loc.getBlock();
  61. loc.getBlock().setType(Material.CHEST);
  62. Chest chest = (Chest)block.getState();
  63. Inventory inv = chest.getInventory();
  64.  
  65.  
  66.  
  67.  
  68.  
  69. }
  70. break;
  71. }
  72. }
  73. }, 0, 20);
  74.  
  75.  
  76. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement