Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 25.36 KB | None | 0 0
  1. package com.bsoft.b1ruk;
  2.  
  3. import com.gmail.filoghost.holographicdisplays.api.Hologram;
  4. import com.gmail.filoghost.holographicdisplays.api.HologramsAPI;
  5. import java.io.File;
  6. import java.io.FileOutputStream;
  7. import java.io.InputStream;
  8. import java.io.OutputStream;
  9. import java.util.logging.Logger;
  10. import org.bukkit.Bukkit;
  11. import org.bukkit.ChatColor;
  12. import org.bukkit.Location;
  13. import org.bukkit.Material;
  14. import org.bukkit.World;
  15. import org.bukkit.block.Block;
  16. import org.bukkit.command.Command;
  17. import org.bukkit.command.CommandSender;
  18. import org.bukkit.configuration.file.FileConfiguration;
  19. import org.bukkit.configuration.file.YamlConfiguration;
  20. import org.bukkit.entity.Entity;
  21. import org.bukkit.entity.Player;
  22. import org.bukkit.event.EventHandler;
  23. import org.bukkit.event.Listener;
  24. import org.bukkit.event.block.Action;
  25. import org.bukkit.event.player.PlayerInteractEvent;
  26. import org.bukkit.inventory.ItemStack;
  27. import org.bukkit.plugin.Plugin;
  28. import org.bukkit.plugin.java.JavaPlugin;
  29. import org.bukkit.util.Vector;
  30.  
  31.  
  32. public class TreasureCCase extends JavaPlugin implements Listener{
  33.  
  34.     Logger log = getLogger();
  35.    
  36.     File configFile;
  37.     FileConfiguration config;
  38.    
  39. public void onEnable(){
  40.    
  41.     if (!Bukkit.getPluginManager().isPluginEnabled("HolographicDisplays")) {
  42.     log.info("+------------------+");
  43.     log.info("");
  44.     log.info("HolographicDisplays not installed on this server! Disabling plugin..");
  45.     log.info("");
  46.     log.info("+------------------+");
  47.         this.setEnabled(false);
  48.         return;
  49.     }
  50.    
  51.     if (!Bukkit.getPluginManager().isPluginEnabled("PlayEffect")) {
  52.     log.info("+------------------+");
  53.     log.info("");
  54.     log.info("PlayEffect not installed on this server! Disabling plugin..");
  55.     log.info("");
  56.     log.info("+------------------+");
  57.         this.setEnabled(false);
  58.         return;
  59.     }
  60.    
  61.     log.info("+------------------+");
  62.     log.info("");
  63.     log.info("TreasureCCase enabled!");
  64.     log.info("");
  65.     log.info("+------------------+");
  66.    
  67.     ConfigLoad();
  68.  
  69.     Bukkit.getPluginManager().registerEvents(this, this);
  70.    
  71.         configFile = new File(getDataFolder(), "config.yml");
  72.        
  73.         try {
  74.             firstRun();
  75.         } catch (Exception e) {
  76.             e.printStackTrace();
  77.         }
  78.  
  79.         config = new YamlConfiguration();  
  80. }
  81.  
  82. public void onDisable(){
  83.     log.info("+------------------+");
  84.     log.info("");
  85.     log.info("TreasureCCase disabled!");
  86.     log.info("");
  87.     log.info("+------------------+");
  88. }
  89.  
  90. private void firstRun() throws Exception {
  91.         if(!configFile.exists()){
  92.             configFile.getParentFile().mkdirs();
  93.             copy(getResource("config.yml"), configFile);
  94.         }
  95.     }
  96.  
  97. private void copy(InputStream in, File file) {
  98.         try {
  99.             OutputStream out = new FileOutputStream(file);
  100.             byte[] buf = new byte[1024];
  101.             int len;
  102.             while((len=in.read(buf))>0){
  103.                 out.write(buf,0,len);
  104.             }
  105.             out.close();
  106.             in.close();
  107.         } catch (Exception e) {
  108.             e.printStackTrace();
  109.         }
  110.     }
  111.  
  112. String reloadcommand_succes;
  113. String reloadcommand_notperm;
  114. String mychestscommand_succeshave;
  115. String mychestscommand_succesnohave;
  116. String mychestscommand_notperm;
  117. String nohavechestsmessage;
  118. String nothavepermmessage;
  119.  
  120. public void ConfigLoad(){    
  121.    
  122. reloadcommand_succes = this.getConfig().getString("messages.reloadcommand.succes").replace("&", "§");
  123. reloadcommand_notperm = this.getConfig().getString("messages.reloadcommand.notperm").replace("&", "§");        
  124. mychestscommand_succeshave = this.getConfig().getString("messages.mychestscommand.succeshave").replace("&", "§");
  125. mychestscommand_succesnohave = this.getConfig().getString("messages.mychestscommand.succesnohave").replace("&", "§");
  126. mychestscommand_notperm = this.getConfig().getString("messages.mychestscommand.notperm").replace("&", "§");        
  127. nohavechestsmessage = this.getConfig().getString("messages.messages.nothavechests").replace("&", "§");
  128. nothavepermmessage = this.getConfig().getString("messages.messages.notperm").replace("&", "§");
  129.  
  130. }
  131.  
  132. // CODE //
  133.  
  134. boolean schedulework = false;
  135.  
  136. Player timer_player;
  137. Block timer_block;
  138. World timer_world;
  139.  
  140. int timer_player_x;
  141. int timer_player_y;
  142. int timer_player_z;
  143.  
  144. Player chestowner;
  145. boolean chestmode = false;
  146.  
  147. Location LOC;
  148.  
  149. Material blockc1;
  150. Material blockc2;
  151. Material blockc3;
  152. Material blockc4;
  153. Material blockc5;
  154. Material blockc6;
  155. Material blockc7;
  156. Material blockc8;
  157. Material blockc9;
  158.  
  159.  
  160. @Override
  161. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
  162.     if(cmd.getName().equalsIgnoreCase("tccb")){
  163.             if(args.length == 0){
  164.                 sender.sendMessage(ChatColor.GOLD + "+-----------------------------+");
  165.                 sender.sendMessage(ChatColor.GREEN + "TreasureCCase");
  166.                 sender.sendMessage(ChatColor.GREEN + "Версия 1.0");
  167.                 sender.sendMessage(ChatColor.GREEN + "Автор " + ChatColor.BOLD + "B1ruk");
  168.                 sender.sendMessage(ChatColor.GREEN + "Помощь по плагину " + ChatColor.GRAY + "/tccb help");
  169.                 sender.sendMessage(ChatColor.GOLD + "+-----------------------------+");    
  170.             }else{
  171.                 if (args[0].equalsIgnoreCase("reload")) {
  172.                     if(sender.hasPermission("tccb.reload")) {
  173.                         sender.sendMessage(reloadcommand_succes);
  174.                     }else{
  175.                         sender.sendMessage(reloadcommand_notperm);
  176.                     }
  177.                 }
  178.                
  179.                 if (args[0].equalsIgnoreCase("mychests")) {
  180.                     if(sender.hasPermission("tccb.mychests")) {
  181.                         int mychests = this.getConfig().getInt("data." + sender + ".chests");
  182.                         if(mychests == 0){
  183.                         sender.sendMessage(mychestscommand_succesnohave);    
  184.                         }else{
  185.                         sender.sendMessage(mychestscommand_succeshave + mychests);
  186.                         }
  187.                     }else{
  188.                         sender.sendMessage(mychestscommand_notperm);
  189.                     }
  190.                 }
  191.                
  192.                 if (args[0].equalsIgnoreCase("open")) {
  193.                     if(sender.hasPermission("tccb.open")) {
  194.                         int mychests = this.getConfig().getInt("data." + sender + ".chests");
  195.                         if(mychests < 0){
  196.                            sender.sendMessage(nohavechestsmessage);
  197.                         }else{
  198.                        
  199.             if(schedulework != true){
  200.             if(chestmode == false){
  201.             mychests--;
  202.             this.getConfig().set("data." + sender + ".chests", mychests);
  203.             this.saveConfig();
  204.             Player player = (Player) sender;
  205.             Location location = player.getLocation();
  206.             LOC = location;
  207.             int x = location.getBlockX();
  208.             int y = location.getBlockY();
  209.             int z = location.getBlockZ();
  210.             timer_player_x = x;
  211.             timer_player_y = y;
  212.             timer_player_z = z;
  213.             timer_world = player.getWorld();
  214.             timer_player = player;
  215.            
  216.                     Block block1 = timer_player.getWorld().getBlockAt(timer_player_x, timer_player_y-1, timer_player_z);
  217.                     Block block2 = timer_player.getWorld().getBlockAt(timer_player_x+1, timer_player_y-1, timer_player_z);
  218.                     Block block3 = timer_player.getWorld().getBlockAt(timer_player_x-1, timer_player_y-1, timer_player_z);
  219.                     Block block4 = timer_player.getWorld().getBlockAt(timer_player_x+1, timer_player_y-1, timer_player_z+1);
  220.                     Block block5 = timer_player.getWorld().getBlockAt(timer_player_x-1, timer_player_y-1, timer_player_z+1);
  221.                     Block block6 = timer_player.getWorld().getBlockAt(timer_player_x+1, timer_player_y-1, timer_player_z-1);
  222.                     Block block7 = timer_player.getWorld().getBlockAt(timer_player_x-1, timer_player_y-1, timer_player_z-1);
  223.                     Block block8 = timer_player.getWorld().getBlockAt(timer_player_x, timer_player_y-1, timer_player_z+1);
  224.                     Block block9 = timer_player.getWorld().getBlockAt(timer_player_x, timer_player_y-1, timer_player_z-1);
  225.                    
  226.                     blockc1 = block1.getType();
  227.                     blockc2 = block2.getType();
  228.                     blockc3 = block3.getType();
  229.                     blockc4 = block4.getType();
  230.                     blockc5 = block5.getType();
  231.                     blockc6 = block6.getType();
  232.                     blockc7 = block7.getType();
  233.                     blockc8 = block8.getType();
  234.                     blockc9 = block9.getType();
  235.            
  236.             timer();
  237.             }else{
  238.             if(chestowner == sender){
  239.             sender.sendMessage("Сначала откройте предыдущий сундук!");
  240.             }else{
  241.             sender.sendMessage("Дождитесь когда " + chestowner.getName() + " откроет сундук!");    
  242.             }    
  243.             }
  244.             }else{
  245.             sender.sendMessage("Кто-то открывает этот кейс С:");  
  246.             }
  247.             }
  248.                     }else{
  249.                        
  250.                     }
  251.                 }
  252.             }
  253.            
  254.            
  255.            
  256.             return true;
  257.         }
  258.     return false;
  259. }
  260.  
  261. Hologram hologram;
  262.  
  263. @EventHandler
  264. public void onRightClick(PlayerInteractEvent event){
  265. Player player = event.getPlayer();
  266. if(chestmode == true){
  267. if(chestowner == player){
  268. Location loc = event.getClickedBlock().getLocation();
  269. int x = loc.getBlockX();
  270. int y = loc.getBlockY();
  271. int z = loc.getBlockZ();    
  272. if(x == timer_player_x && y == timer_player_y && z == timer_player_z){
  273. if(event.getAction() == Action.RIGHT_CLICK_BLOCK){
  274. Block block = event.getClickedBlock();
  275. if (block.getType() == Material.ENDER_CHEST){
  276. event.setCancelled(true);
  277. chestmode = false;
  278. chestowner = null;
  279.  
  280. Location tLoc = new Location(player.getWorld(), timer_player_x, timer_player_y, timer_player_z);
  281.  
  282. Plugin plugin = this;
  283. Location where = tLoc;
  284. hologram = HologramsAPI.createHologram(plugin, where);
  285. hologram.appendTextLine("A hologram line");
  286. hologram.teleport(tLoc.add(0.5, 2.0, 0.5));
  287.  
  288. timer2();
  289. String mcworld = timer_world.getName();
  290. Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:ENDER_CHEST loc:" + mcworld + "," + timer_player_x + "," + timer_player_y + "," + timer_player_z);
  291. Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe sound type:ANVIL_LAND loc:" + mcworld + "," + timer_player_x + "," + timer_player_y + "," + timer_player_z);
  292. timer_world.getBlockAt(new Location(timer_world, timer_player_x, timer_player_y, timer_player_z)).setType(Material.AIR);
  293.  
  294.                     int change_y = timer_player_y-1;
  295.                     int change_x = timer_player_x;
  296.                     int change_z = timer_player_z;
  297.  
  298.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:REDSTONE_LAMP_ON loc:" + mcworld + "," + timer_player_x + "," + change_y + "," + timer_player_z);
  299.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x, timer_player_y-1, timer_player_z)).setType(Material.REDSTONE_LAMP_ON);
  300.  
  301.                     change_y = timer_player_y-1;
  302.                     change_x = timer_player_x+1;
  303.                     change_z = timer_player_z;
  304.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:STAINED_CLAY loc:" + mcworld + "," + change_x + "," + change_y + "," + change_z);
  305.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x+1, timer_player_y-1, timer_player_z)).setType(Material.STAINED_CLAY);
  306.                
  307.                     change_x = timer_player_x-1;
  308.                     change_z = timer_player_z;
  309.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:STAINED_CLAY loc:" + mcworld + "," + change_x + "," + change_y + "," + change_z);
  310.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x-1, timer_player_y-1, timer_player_z)).setType(Material.STAINED_CLAY);
  311.                
  312.                     change_x = timer_player_x+1;
  313.                     change_z = timer_player_z+1;
  314.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:STAINED_CLAY loc:" + mcworld + "," + change_x + "," + change_y + "," + change_z);
  315.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x+1, timer_player_y-1, timer_player_z+1)).setType(Material.STAINED_CLAY);
  316.                
  317.                     change_x = timer_player_x-1;
  318.                     change_z = timer_player_z+1;
  319.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:STAINED_CLAY loc:" + mcworld + "," + change_x + "," + change_y + "," + change_z);
  320.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x-1, timer_player_y-1, timer_player_z+1)).setType(Material.STAINED_CLAY);
  321.                
  322.                     change_x = timer_player_x+1;
  323.                     change_z = timer_player_z-1;
  324.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:STAINED_CLAY loc:" + mcworld + "," + change_x + "," + change_y + "," + change_z);
  325.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x+1, timer_player_y-1, timer_player_z-1)).setType(Material.STAINED_CLAY);
  326.                
  327.                     change_x = timer_player_x-1;
  328.                     change_z = timer_player_z-1;
  329.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:STAINED_CLAY loc:" + mcworld + "," + change_x + "," + change_y + "," + change_z);
  330.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x-1, timer_player_y-1, timer_player_z-1)).setType(Material.STAINED_CLAY);
  331.                
  332.                     change_x = timer_player_x;
  333.                     change_z = timer_player_z+1;
  334.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:STAINED_CLAY loc:" + mcworld + "," + change_x + "," + change_y + "," + change_z);
  335.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x, timer_player_y-1, timer_player_z+1)).setType(Material.STAINED_CLAY);
  336.                
  337.                     change_x = timer_player_x;
  338.                     change_z = timer_player_z-1;
  339.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:STAINED_CLAY loc:" + mcworld + "," + change_x + "," + change_y + "," + change_z);
  340.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x, timer_player_y-1, timer_player_z-1)).setType(Material.STAINED_CLAY);
  341.  
  342. }
  343. }
  344. }
  345. }else{
  346. Location loc = event.getClickedBlock().getLocation();
  347. int x = loc.getBlockX();
  348. int y = loc.getBlockY();
  349. int z = loc.getBlockZ();    
  350. if(x == timer_player_x && y == timer_player_y && z == timer_player_z){  
  351. Vector unitVector = new Vector(player.getLocation().getDirection().getX(), -0.1, player.getLocation().getDirection().getZ());
  352. unitVector = unitVector.normalize();            
  353. player.setVelocity(unitVector.multiply(-2));
  354. event.setCancelled(true);
  355. }
  356. }
  357. }
  358.  
  359. }  
  360.  
  361.  
  362.  
  363.  
  364. int countdown = 31;
  365. int count;
  366.  
  367. public void timer() {
  368.     count = Bukkit.getScheduler().scheduleSyncRepeatingTask(
  369.         (Plugin) this,
  370.         new Runnable() {
  371.  
  372.             @Override
  373.             public void run() {
  374.                
  375.                
  376.                 String mcworld = timer_world.getName();
  377.                
  378.                 if (countdown == 31){
  379.                    
  380.                    
  381.                    
  382.                     schedulework = true;
  383.                     Location Loc = new Location(timer_world, timer_player_x, timer_player_y-1, timer_player_z);
  384.                     int change_y = timer_player_y-1;
  385.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:SEA_LANTERN loc:" + mcworld + "," + timer_player_x + "," + change_y + "," + timer_player_z);
  386.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x, timer_player_y-1, timer_player_z)).setType(Material.SEA_LANTERN);  
  387.                     chestowner = timer_player;
  388.                     chestmode = true;
  389.                 }
  390.                
  391.                 if (countdown == 26) {
  392.                     int change_y = timer_player_y-1;
  393.                     int change_x = timer_player_x+1;
  394.                     int change_z = timer_player_z;
  395.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:QUARTZ_BLOCK loc:" + mcworld + "," + change_x + "," + change_y + "," + change_z);
  396.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x+1, timer_player_y-1, timer_player_z)).setType(Material.QUARTZ_BLOCK);
  397.                
  398.                     change_x = timer_player_x-1;
  399.                     change_z = timer_player_z;
  400.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:QUARTZ_BLOCK loc:" + mcworld + "," + change_x + "," + change_y + "," + change_z);
  401.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x-1, timer_player_y-1, timer_player_z)).setType(Material.QUARTZ_BLOCK);
  402.                
  403.                     change_x = timer_player_x+1;
  404.                     change_z = timer_player_z+1;
  405.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:QUARTZ_BLOCK loc:" + mcworld + "," + change_x + "," + change_y + "," + change_z);
  406.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x+1, timer_player_y-1, timer_player_z+1)).setType(Material.QUARTZ_BLOCK);
  407.                
  408.                     change_x = timer_player_x-1;
  409.                     change_z = timer_player_z+1;
  410.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:QUARTZ_BLOCK loc:" + mcworld + "," + change_x + "," + change_y + "," + change_z);
  411.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x-1, timer_player_y-1, timer_player_z+1)).setType(Material.QUARTZ_BLOCK);
  412.                
  413.                     change_x = timer_player_x+1;
  414.                     change_z = timer_player_z-1;
  415.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:QUARTZ_BLOCK loc:" + mcworld + "," + change_x + "," + change_y + "," + change_z);
  416.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x+1, timer_player_y-1, timer_player_z-1)).setType(Material.QUARTZ_BLOCK);
  417.                
  418.                     change_x = timer_player_x-1;
  419.                     change_z = timer_player_z-1;
  420.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:QUARTZ_BLOCK loc:" + mcworld + "," + change_x + "," + change_y + "," + change_z);
  421.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x-1, timer_player_y-1, timer_player_z-1)).setType(Material.QUARTZ_BLOCK);
  422.                
  423.                     change_x = timer_player_x;
  424.                     change_z = timer_player_z+1;
  425.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:QUARTZ_BLOCK loc:" + mcworld + "," + change_x + "," + change_y + "," + change_z);
  426.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x, timer_player_y-1, timer_player_z+1)).setType(Material.QUARTZ_BLOCK);
  427.                
  428.                     change_x = timer_player_x;
  429.                     change_z = timer_player_z-1;
  430.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:QUARTZ_BLOCK loc:" + mcworld + "," + change_x + "," + change_y + "," + change_z);
  431.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x, timer_player_y-1, timer_player_z-1)).setType(Material.QUARTZ_BLOCK);
  432.                 }
  433.                
  434.                 if (countdown == 10){
  435.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe signal loc:" + mcworld + "," + timer_player_x + "," + timer_player_y + "," + timer_player_z);
  436.                 }
  437.                
  438.                 if (countdown == 9){
  439.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe signal loc:" + mcworld + "," + timer_player_x + "," + timer_player_y + "," + timer_player_z);
  440.                 }
  441.                
  442.                 if (countdown == 8){
  443.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe signal loc:" + mcworld + "," + timer_player_x + "," + timer_player_y + "," + timer_player_z);
  444.                 }
  445.                
  446.                 if (countdown == 7){
  447.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe signal loc:" + mcworld + "," + timer_player_x + "," + timer_player_y + "," + timer_player_z);
  448.                 }
  449.                
  450.                 if (countdown == 6){
  451.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe signal loc:" + mcworld + "," + timer_player_x + "," + timer_player_y + "," + timer_player_z);
  452.                 }
  453.                
  454.                 if (countdown == 5){
  455.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe sound type:ANVIL_LAND loc:" + mcworld + "," + timer_player_x + "," + timer_player_y + "," + timer_player_z);
  456.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe blockcracksound item:ENDER_CHEST loc:" + mcworld + "," + timer_player_x + "," + timer_player_y + "," + timer_player_z);
  457.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x, timer_player_y, timer_player_z)).setType(Material.ENDER_CHEST);  
  458.                 }
  459.                
  460.                
  461.                
  462.                
  463.                 if (countdown < 0){
  464.                     Bukkit.getScheduler().cancelTask(count);  
  465.                     halttimer();
  466.                 }else{
  467.                     countdown--;
  468.                 }
  469.            }
  470.  
  471.        },
  472.        2,
  473.        2);
  474. }
  475.  
  476. public void halttimer(){
  477. Bukkit.getScheduler().cancelTask(count);
  478. countdown = 31;
  479. }
  480.  
  481. int countdown2 = 30;
  482. int count2;
  483. public void timer2() {
  484.     count2 = Bukkit.getScheduler().scheduleSyncRepeatingTask(
  485.         (Plugin) this,
  486.         new Runnable() {
  487.  
  488.             @Override
  489.             public void run() {
  490.                
  491.                
  492.                 String mcworld = timer_world.getName();
  493.                
  494.                 if (countdown2 == 1){
  495.                     schedulework = false;
  496.                     chestmode = false;
  497.                     chestowner = null;
  498.                    
  499.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe hugeexplosion loc:" + mcworld + "," + timer_player_x + "," + timer_player_y + "," + timer_player_z);
  500.                     Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pe sound type:explode loc:" + mcworld + "," + timer_player_x + "," + timer_player_y + "," + timer_player_z);
  501.                
  502.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x, timer_player_y-1, timer_player_z)).setType(blockc1);
  503.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x+1, timer_player_y-1, timer_player_z)).setType(blockc2);
  504.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x-1, timer_player_y-1, timer_player_z)).setType(blockc3);  
  505.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x+1, timer_player_y-1, timer_player_z+1)).setType(blockc4);  
  506.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x-1, timer_player_y-1, timer_player_z+1)).setType(blockc5);  
  507.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x+1, timer_player_y-1, timer_player_z-1)).setType(blockc6);  
  508.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x-1, timer_player_y-1, timer_player_z-1)).setType(blockc7);  
  509.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x, timer_player_y-1, timer_player_z+1)).setType(blockc8);
  510.                     timer_world.getBlockAt(new Location(timer_world, timer_player_x, timer_player_y-1, timer_player_z-1)).setType(blockc9);  
  511.                    
  512.                 }
  513.  
  514.                 if (countdown2 < 0){
  515.                     Bukkit.getScheduler().cancelTask(count2);  
  516.                     halttimer2();
  517.                     hologram.delete();
  518.                 }else{
  519.                     countdown2--;
  520.                 }
  521.            }
  522.  
  523.        },
  524.        2,
  525.        2);
  526. }
  527.  
  528. public void halttimer2(){
  529. Bukkit.getScheduler().cancelTask(count2);
  530. countdown2 = 30;
  531. }
  532.    
  533. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement