Persistent-Nicknames sets DisplayName as null, causing other plugins to crash #1


  • Defect
  • Accepted
Open
Assigned to _ForgeUser8894689
  • _ForgeUser7414863 created this issue Dec 30, 2013

    Description:

    Using Persistent-Nicknames causes some other plugins to crash or produce errors for players who do not have a nickname set by Persistent-Nicknames.

    Reproduction:

    1. Use Persistent-Nicknames with a plugin that uses display names (I use CommandBook).
    2. Log in with a user that does not have a nickname set.
    3. Observe other plugins producing errors.

    Details:

    I reproduce here the code from your player login handler:

      @EventHandler(priority=EventPriority.NORMAL)
      public void renameOnLogin(PlayerLoginEvent event)
      {
        Player player = event.getPlayer();
        player.setDisplayName(getConfig().getString("nicknames." + player.getName()));
      }
    

    If a player does not have a nickname defined in the config file, then getConfig().getString() returns null. The null value is stored by CraftBukkit and returned by getDisplayName(). Other plugins are not expecting a null value here, and this results in undefined behaviour.

    A display name should NEVER be set to null. I consider it a Bukkit bug that setDisplayName() allows you to do this.

  • _ForgeUser7414863 added the tags New Defect Dec 30, 2013
  • _ForgeUser8894689 posted a comment Jan 2, 2014
    http://www.filedropper.com/showdownload.php/nick is an updated file (if you want it) That should fix most of the issues. I'll add something to check if a player has a nickname and not perform the rename now.
  • _ForgeUser8894689 removed a tag New Jan 3, 2014
  • _ForgeUser8894689 added a tag Fixed Jan 3, 2014
  • _ForgeUser8894689 closed issue Jan 3, 2014
  • _ForgeUser8894689 removed a tag Fixed Jan 8, 2014
  • _ForgeUser8894689 added a tag New Jan 8, 2014
  • _ForgeUser8894689 reopened issue Jan 8, 2014
  • _ForgeUser8894689 removed a tag New Jan 8, 2014
  • _ForgeUser8894689 added a tag Verified Jan 8, 2014
  • _ForgeUser8894689 closed issue Jan 8, 2014
  • _ForgeUser8894689 removed a tag Verified Jan 8, 2014
  • _ForgeUser8894689 added a tag New Jan 8, 2014
  • _ForgeUser8894689 reopened issue Jan 8, 2014
  • _ForgeUser8894689 removed a tag New Jan 8, 2014
  • _ForgeUser8894689 added a tag Accepted Jan 8, 2014
  • _ForgeUser7414863 posted a comment Jun 9, 2014

    Update: Bukkit have fixed this on their end.

    https://bukkit.atlassian.net/browse/BUKKIT-5254


To post a comment, please login or register a new account.