Solved Help with changing scoreboard value of entity

Discussion in 'Spigot Plugin Development' started by MCrafterzz, Aug 5, 2018.

  1. Hello I'm quite new to spigot and need some help. I successfully created a new scoreboard objective when enabling the plugin so now I need to assign values. I would like to set the score of a entity right after creation.
    This is what I have so far (in the entity creation methoud):
    Code (Java):
    ArmorStand armorStand = (ArmorStand) event.getPlayer().getWorld()
                        .spawnEntity(event.getBlockPlaced().getLocation().add(0.5, -0.7, 0.5), EntityType.ARMOR_STAND);
                armorStand.setHelmet(new ItemStack(block));
                ScoreboardManager scoreboardManager = Bukkit.getScoreboardManager();
    *** Is where I don't now what to enter. Should I get the armorstands uuid? Thx for any help.
  2. I would rather go with a set tag of the entity rather than uuid. For players it is the name so I cannot imagine this to use uuids for other entities.

    You may want to add debug messages for Scoreboard#getEntries()
  3. What value should I ender to set the scoreboard of that specific entity?
  4. I guess the uuid, just set it as tag. But please note that I did not work with this too much
  5. Try this;
    Code (Java):
    ScoreboardManager scoreboardManager = Bukkit.getScoreboardManager();
    Score skor = scoreboardManager.getMainScoreboard().getObjective("Time").getScore(armorStand);
  6. it says armorstand is not a offline player but using the uuid as a string seems to work