Advertisement
Guest User

Untitled

a guest
Sep 18th, 2020
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.11 KB | None | 0 0
  1. public class onBreakingEvent implements Listener {
  2.  
  3. private Main instance;
  4. public onBreakingEvent(Main instance) {
  5. this.instance = instance;
  6. }
  7.  
  8. ScoreboardAPI sc = new ScoreboardAPI();
  9.  
  10. @EventHandler
  11. public void BreakingEvent(BlockBreakEvent e) {
  12. Player player = e.getPlayer();
  13. World world = player.getWorld();
  14. Location loc = e.getBlock().getLocation();
  15.  
  16. FileConfiguration config = instance.getConfig();
  17.  
  18. Location red = new Location(world, 120, 95, 152);
  19. Location red1 = new Location(world, config.getDouble("nexus.red.x"), config.getDouble("nexus.red.y"), config.getDouble("nexus.red.z"));
  20. Location blue = new Location(world, config.getDouble("nexus.blue.x"), config.getDouble("nexus.blue.y"), config.getDouble("nexus.blue.z"));
  21. Location yellow = new Location(world, config.getDouble("nexus.yellow.x"), config.getDouble("nexus.yellow.y"), config.getDouble("nexus.yellow.z"));
  22. Location green = new Location(world, config.getDouble("nexus.green.x"), config.getDouble("nexus.green.y"), config.getDouble("nexus.green.z"));
  23.  
  24. if (e.getBlock().getType() == Material.ENDER_STONE) {
  25. player.sendMessage(String.valueOf(loc.equals(red)));
  26. if (loc.equals(red)) {
  27. e.setCancelled(true);
  28. player.sendMessage("2");
  29. for (Player p: Bukkit.getOnlinePlayers()) {
  30. player.sendMessage("3");
  31. if (sc.redcore <= 0) {
  32. world.getBlockAt(red).setType(Material.BEDROCK);
  33. p.sendMessage("終了");
  34. }
  35. else {
  36. sc.redcore--;
  37. sc.anni.getScoreboard().resetScores(ChatColor.RED + "赤: " + String.valueOf(sc.redcore+1));
  38. sc.anni.getScore((ChatColor.RED + "赤: " + String.valueOf(sc.redcore))).setScore(4);
  39. p.sendMessage(ChatColor.RED + "Coreが破壊されました 残り:" + String.valueOf(sc.redcore));
  40. }
  41. }
  42. }
  43. else if (loc.equals(blue)) {
  44. for (Player p: Bukkit.getOnlinePlayers()) {
  45. if (sc.bluecore <= 0) {
  46. world.getBlockAt(blue).setType(Material.BEDROCK);
  47. p.sendMessage("終了");
  48. }
  49. else {
  50. sc.bluecore--;
  51. sc.anni.getScoreboard().resetScores(ChatColor.BLUE + "青: " + String.valueOf(sc.bluecore+1));
  52. sc.anni.getScore((ChatColor.BLUE + "赤: " + String.valueOf(sc.bluecore))).setScore(3);
  53. p.sendMessage(ChatColor.BLUE + "Coreが破壊されました 残り:" + String.valueOf(sc.bluecore));
  54. }
  55. }
  56. }
  57.  
  58. }
  59. }
  60. }
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement