JitseB / NPCLib

(Minecraft) NPCLib – Basic non-player character library.
MIT License
197 stars 49 forks source link

Feature/remove per player hologram #112

Closed RealGatt closed 4 years ago

RealGatt commented 4 years ago

This PR adds two new methods.


    /**
     *
     * @param targetPlayer The target player
     * @return object instance
     * @author Gatt
     */
    NPC removePlayerLines(Player targetPlayer);
    /**
     *
     * @param targetPlayer The target player
     * @param update whether or not to update the hologram
     * @return object instance
     * @author Gatt
     */
    NPC removePlayerLines(Player targetPlayer, boolean update);

Allows for the removal of player-specific lines, as requested in the Discord.

JitseB commented 4 years ago

What's the need to have a method for this built in? Setting the new lines equal to an empty list does the job just as well by the looks of it.

RealGatt commented 4 years ago

Due to the way that player-specific lines are grabbed, if you were to set a player's lines to an empty list, it would display nothing for that users' hologram. See the getPlayerLines(Player player) method.

Currently there is no way of actually removing player-specific lines, which allows it to effectively be reset to the holograms' original lines.

JitseB commented 4 years ago

Merging PR!