Separate Names for Armor Stands

Discussion in 'Plugin Development' started by MrGriefer_, Nov 17, 2016.

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

    MrGriefer_

    Hey,

    I'm working on a new mini game that got kits that could be selected through Armor Stands but I'm trying to make one of the kits cost money. So if a player buys the kit the Armor Stand will change name to: {kit} - Bought
    But how could I make it so other players that didn't bought the kit will have their Armor Stand named to: {kit} - Amount ?
     
  2. Offline

    A5H73Y

    I'm not entirely understanding, do you mean displaying armor stands in an inventory, or a placed physical armor stand?
    Either way it would be per-player, rather than making things static if that's what you're trying.
    So if you're going the inventory route, on retrieval of the items, you would check the config to see if they've purchased the item, making the text display differently depending on the outcome.
     
  3. Offline

    MrGriefer_

    Placed armor stand not inventory armor stand
     
  4. Offline

    MrGriefer_

    Something similar like Mineplex kits when someone buys a kit it will change the entity name to green and red for players who didn't bought the kit.
     
  5. Offline

    MrGriefer_

  6. Offline

    MordorKing78

    You're looking for custom names per player?
     
  7. Offline

    MrGriefer_

    Yes
     
  8. Offline

    Jakeeeee

    By using packets and only sending it to the player. I have a hologram library (all you have to do is paste the following 2 classes in your project) if you want to use it: (If you do not want the armor stands to be invisible just modify the code when it builds the entity)
    Hologram class: http://pastebin.com/6WtfdFSh
    Reflection: http://pastebin.com/sjLcC953
    Example:
    Code:
        @EventHandler
        public void onPlayerChat(AsyncPlayerChatEvent e) {
    
           
    ArrayList<String> messages = new ArrayList(Arrays.asList(ChatColor.AQUA + "A","B", "Line 3"));
    
            Hologram hg = new Hologram(messages, e.getPlayer().getLocation());
            hg.build().sendHologram(e.getPlayer());
            getServer().getScheduler().runTaskLater(this, new Runnable(){
    
                public void run(){
    
                    hg.addLine("Line 4").rebuild().sendHologram(e.getPlayer());
    
                }
    
            }, 100);
        }
     
    Last edited: Nov 22, 2016
  9. Offline

    MrGriefer_

    Thank you for the library, but I'm getting an error in the console:

    HTML:
    [16:30:10] [Server thread/WARN]: java.lang.NoSuchMethodException: net.minecraft.server.v1_10_R1.EntityArmorStand.setGravity(boolean)
    [16:30:10] [Server thread/WARN]:     at java.lang.Class.getMethod(Unknown Source)
    [16:30:10] [Server thread/WARN]:     at timebomb.scoreboard.Hologram.build(Hologram.java:119)
    [16:30:10] [Server thread/WARN]:     at timebomb.Core.onCommand(Core.java:85)
    [16:30:10] [Server thread/WARN]:     at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
    [16:30:10] [Server thread/WARN]:     at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:140)
    [16:30:10] [Server thread/WARN]:     at org.bukkit.craftbukkit.v1_10_R1.CraftServer.dispatchCommand(CraftServer.java:646)
    [16:30:10] [Server thread/WARN]:     at net.minecraft.server.v1_10_R1.PlayerConnection.handleCommand(PlayerConnection.java:1351)
    [16:30:10] [Server thread/WARN]:     at net.minecraft.server.v1_10_R1.PlayerConnection.a(PlayerConnection.java:1186)
    [16:30:10] [Server thread/WARN]:     at net.minecraft.server.v1_10_R1.PacketPlayInChat.a(PacketPlayInChat.java:45)
    [16:30:10] [Server thread/WARN]:     at net.minecraft.server.v1_10_R1.PacketPlayInChat.a(PacketPlayInChat.java:1)
    [16:30:10] [Server thread/WARN]:     at net.minecraft.server.v1_10_R1.PlayerConnectionUtils$1.run(SourceFile:13)
    [16:30:10] [Server thread/WARN]:     at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    [16:30:10] [Server thread/WARN]:     at java.util.concurrent.FutureTask.run(Unknown Source)
    [16:30:10] [Server thread/WARN]:     at net.minecraft.server.v1_10_R1.SystemUtils.a(SourceFile:45)
    [16:30:10] [Server thread/WARN]:     at net.minecraft.server.v1_10_R1.MinecraftServer.D(MinecraftServer.java:732)
    [16:30:10] [Server thread/WARN]:     at net.minecraft.server.v1_10_R1.DedicatedServer.D(DedicatedServer.java:400)
    [16:30:10] [Server thread/WARN]:     at net.minecraft.server.v1_10_R1.MinecraftServer.C(MinecraftServer.java:668)
    [16:30:10] [Server thread/WARN]:     at net.minecraft.server.v1_10_R1.MinecraftServer.run(MinecraftServer.java:567)
    [16:30:10] [Server thread/WARN]:     at java.lang.Thread.run(Unknown Source)
    My server is on 1.10.2. When I remove line that says
    PHP:
    entityStand.getClass().getMethod("setGravity"boolean.class).invoke(entityStandfalse);
    no errors appear.
     
Thread Status:
Not open for further replies.

Share This Page