TagAPI Help EDIT: Not Solved

Discussion in 'Plugin Development' started by bjsnow, Oct 14, 2012.

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

    bjsnow

    Not Solved D:


    Code:
    package com.bj.ColoredTags;
    
    import org.bukkit.ChatColor;
    import org.bukkit.GameMode;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.kitteh.tag.PlayerReceiveNameTagEvent;
    import java.util.logging.Logger;
    import org.bukkit.event.Listener;
    import sun.security.krb5.Config;
    
    
    
       
     public class ColoredTags extends JavaPlugin implements Listener 
        {
        public static Config plugin;
        public final Logger logger = Logger.getLogger("Minecraft");
         
         
         
         
            @Override
            public void onEnable()
            {
                //
                PluginDescriptionFile p = this.getDescription();
                this.logger.info(p.getName() + " V" + p.getVersion() + " Has Been Enabled!");
            getConfig().options().copyDefaults(true);       
            saveConfig();       
            
            }
         
            @Override
            public void onDisable()
            {
                //
            }
         
            
        
        
        @EventHandler
        public void join(PlayerJoinEvent e) {
            Player p = e.getPlayer();
      
            
            
        
        
        
        
    }
      @EventHandler
        public void onNameTag(PlayerReceiveNameTagEvent event) {
           
          String string1 = getConfig().getString("player");
       
               
                if (event.getPlayer().getName().equals(string1)) {
                       
                           
                           
                       
                event.setTag(ChatColor.valueOf(getConfig().getString("color")) + string1);
                }
       
        }
     
    
       
          
      
         
                    
                
            
            
     }
     
    
    config:

    Code:
    # Defaul Configuration File For ColoredTags A-0.0.1.0 Always Use ChatColor.COLOR for Color configuration :)
    player: bjsnow
    name: bjsno
    color: RED 
    
    The Name Tag Of Bjsnow dosent change....
     
  2. Offline

    Devil0s

  3. Offline

    Hoolean Retired Staff

    Two things!

    1. Code:
      public class ColoredTags extends JavaPlugin
      should be
      Code:
      public class ColoredTags extends JavaPlugin implements Listener
    2. Change this:
      Code:
      @EventHandler
          public void onNameTag(PlayerReceiveNameTagEvent event) {
             
            Integer int1 = plugin.getConfig().getString("player");
         
                 
                  if (event.getPlayer().getName().equals(int1)) {
                         
                             
                             
                         
                  event.setTag(getConfig().getString("color") + ("name"));
                  }
         
          }
      to this
      Code:
      @EventHandler
          public void onNameTag(PlayerReceiveNameTagEvent event) {
             
            String string1 = plugin.getConfig().getString("player");
         
                 
                  if (event.getPlayer().getName().equals(string1)) {
                         
                             
                             
                         
                  event.setTag(ChatColor.valueOf(getConfig().getString("color")) + string1);
                  }
         
          }
      and change your config to
      Code:
      Color = RED


      Do you know java? There were a lot of errors in that...
     
    bjsnow likes this.
  4. Offline

    bjsnow

    Yes I Did..

    MrBluebear3
    I Was Just experimenting and I copied the code I wrote 2 days ago -,- Facepalm

    Thanks MrBlueBear3 But Theres an error in your code xD

    Code:
    @EventHandler
        public void onNameTag(PlayerReceiveNameTagEvent event) {
       
          String string1 = plugin.getConfig().getString("player");
     
           
                if (event.getPlayer().getName().equals(string1)) {
                   
                       
                       
                   
                event.setTag(ChatColor.valueOf(getConfig().getString("color")) + string1);
                }
     
        }
    
    should be:

    Code:
    @EventHandler
        public void onNameTag(PlayerReceiveNameTagEvent event) {
       
          String string1 = getConfig().getString("player");
     
           
                if (event.getPlayer().getName().equals(string1)) {
                   
                       
                       
                   
                event.setTag(ChatColor.valueOf(getConfig().getString("color")) + string1);
                }
     
        }
    
    :D

    EDIT: Your Fix Dosent Work DAMMM it

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
Thread Status:
Not open for further replies.

Share This Page