Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class onBreakingEvent implements Listener {
- private Main instance;
- public onBreakingEvent(Main instance) {
- this.instance = instance;
- }
- ScoreboardAPI sc = new ScoreboardAPI();
- @EventHandler
- public void BreakingEvent(BlockBreakEvent e) {
- Player player = e.getPlayer();
- World world = player.getWorld();
- Location loc = e.getBlock().getLocation();
- FileConfiguration config = instance.getConfig();
- Location red = new Location(world, 120, 95, 152);
- Location red1 = new Location(world, config.getDouble("nexus.red.x"), config.getDouble("nexus.red.y"), config.getDouble("nexus.red.z"));
- Location blue = new Location(world, config.getDouble("nexus.blue.x"), config.getDouble("nexus.blue.y"), config.getDouble("nexus.blue.z"));
- Location yellow = new Location(world, config.getDouble("nexus.yellow.x"), config.getDouble("nexus.yellow.y"), config.getDouble("nexus.yellow.z"));
- Location green = new Location(world, config.getDouble("nexus.green.x"), config.getDouble("nexus.green.y"), config.getDouble("nexus.green.z"));
- if (e.getBlock().getType() == Material.ENDER_STONE) {
- player.sendMessage(String.valueOf(loc.equals(red)));
- if (loc.equals(red)) {
- e.setCancelled(true);
- player.sendMessage("2");
- for (Player p: Bukkit.getOnlinePlayers()) {
- player.sendMessage("3");
- if (sc.redcore <= 0) {
- world.getBlockAt(red).setType(Material.BEDROCK);
- p.sendMessage("終了");
- }
- else {
- sc.redcore--;
- sc.anni.getScoreboard().resetScores(ChatColor.RED + "赤: " + String.valueOf(sc.redcore+1));
- sc.anni.getScore((ChatColor.RED + "赤: " + String.valueOf(sc.redcore))).setScore(4);
- p.sendMessage(ChatColor.RED + "Coreが破壊されました 残り:" + String.valueOf(sc.redcore));
- }
- }
- }
- else if (loc.equals(blue)) {
- for (Player p: Bukkit.getOnlinePlayers()) {
- if (sc.bluecore <= 0) {
- world.getBlockAt(blue).setType(Material.BEDROCK);
- p.sendMessage("終了");
- }
- else {
- sc.bluecore--;
- sc.anni.getScoreboard().resetScores(ChatColor.BLUE + "青: " + String.valueOf(sc.bluecore+1));
- sc.anni.getScore((ChatColor.BLUE + "赤: " + String.valueOf(sc.bluecore))).setScore(3);
- p.sendMessage(ChatColor.BLUE + "Coreが破壊されました 残り:" + String.valueOf(sc.bluecore));
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement