Scoreboard Reload

Discussion in 'Plugin Development' started by nyanneko0113, Aug 16, 2020.

Thread Status:
Not open for further replies.
  1. Offline

    nyanneko0113

    Help Scoreboard reload

    Code:

    Code:
    public class StartEndCommand implements CommandExecutor {
    
         ScoreboardAPI sc = new ScoreboardAPI();
    
        int counttime = ScoreboardAPI.counttime;
        int gametime = ScoreboardAPI.gametime;
    
          private Main instance;
          public StartEndCommand(Main instance) {
            this.instance = instance;
          }
    
        public boolean onCommand(CommandSender send, Command cmd, String label, String[] args) {
            if (cmd.getName().equalsIgnoreCase("start")) {
                final BukkitTask run = new BukkitRunnable() {
                    public void run() {
                        for (Player player : Bukkit.getOnlinePlayers()) {
                            if (counttime >= 0) {
                            player.sendMessage("Start" + String.valueOf(counttime) + "");
                            player.playSound(player.getLocation(), Sound.WOOD_CLICK, 50, 50);
                            counttime--;
                            }
                            else if (counttime <= 1) {
                                player.playSound(player.getLocation(), Sound.CREEPER_HISS, 50, 50);
                                sc.game.setDisplaySlot(DisplaySlot.SIDEBAR);
                                sc.game.getScore(String.valueOf(gametime)).setScore(10);
                                player.setScoreboard(sc.board);
                                gametime--;
                            }
                            else if (gametime == 0) {
                                player.sendMessage("Game End!!");
                                this.cancel();
                            }
                        }
                    }
                }.runTaskTimer(instance, 0L, 20L);
            }
            return false;
        }
    }
    Scoreboard
    Code:
    public class ScoreboardAPI {
        ScoreboardManager manager = Bukkit.getScoreboardManager();
        public Scoreboard board = manager.getMainScoreboard();;
        public Objective game = board.getObjective("Bedwars");;
    
         public static int counttime = 10;
         public static int gametime = 300;
     

    Attached Files:

    • why.PNG
      why.PNG
      File size:
      13.4 KB
      Views:
      2
    Last edited: Aug 16, 2020
  2. Offline

    Tim_M

    Help Not Scoreboard reload?
    You could use some extra words to explain it better...
     
  3. Offline

    pietermantel

    He probably means that, while the code is intended to change a scoreboard value, it does not change anything.
     
  4. Offline

    nyanneko0113

    Sorry, Edited Help Scoreboard reload
     
Thread Status:
Not open for further replies.

Share This Page