Solved Editing /spectator's hotbar

Discussion in 'Spigot Plugin Development' started by Sirenum, Jan 28, 2020.

  1. Bit of a weird question, but I couldn't find any conclusive responses in regards to my query.

    I am trying to edit the spectator mode hotbar, and when a command is run,
    I want this:
    [​IMG]

    To essentially be this:
    [​IMG]

    Is this even possible, and what steps would I need to do to make this happen?

    Code (Java):
     /**
         * Permission check comes with the command.
         * @param p
         */

        public void enableCMSMode(Player p) {
            if(!isCMS.contains(p.getUniqueId())) {
                isCMS.add(p.getUniqueId());
                p.setGameMode(GameMode.SPECTATOR);
                clearArmor(p);
                p.getInventory().clear();
                p.getInventory().addItem(createItem(Material.RED_WOOL,1,"&fTeleport to &cRed's &fFlag")); //This could be changed to flag location. So if it is dropped, it will go to the flag.
                p.getInventory().addItem(createItem(Material.BLUE_WOOL,1,"&fTeleport to &9Blue's &fFlag"));//This could be changed to flag location. So if it is dropped, it will go to the flag.
                p.getInventory().addItem(createItem(Material.RED_BANNER,1,"&fTeleport to &cRed's &fFlag holder"));
                p.getInventory().addItem(createItem(Material.BLUE_BANNER,1,"&fTeleport to &9Blue's &fFlag Holder"));
                p.getInventory().addItem(createItem(Material.RED_STAINED_GLASS,1, "&fHealth info for &cRed's &fFlag holder")); //Display name, Amount of steak, and health (in Dec)
                p.getInventory().addItem(createItem(Material.BLUE_STAINED_GLASS,1, "&fHealth Info for &9Blue's &fFlag holder.")); //Display name, Amount of steak, and health (in Dec)
                p.setFlySpeed(0.5f);
                p.sendMessage(color("You have been set into &cCMS &fmode."));
            }else {
                p.getInventory().clear();
                setArmor(p);
                p.setFallDistance(0);
                p.setGameMode(GameMode.SURVIVAL);
                p.sendMessage(color("You are no longer in &cCMS &fmode."));
                p.setFlySpeed(0.1f);
                isCMS.remove(p.getUniqueId());

            }
        }

    Thanks.
     
  2. Unfortunately this isn't possible because the spectator mode is handled on the client side and doesn't allow this.
     
    • Informative Informative x 2
  3. Fuck.

    Thanks for the reply though!