Solved Player variable

Discussion in 'Plugin Development' started by glassbillen, Feb 10, 2014.

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

    glassbillen

    Hi, i need help making player variable and color variable to my config to the pluginet, like &S = Sender and &T for target player and the normal color codes like &1 = blue. :)
     
  2. Offline

    phildachil

    What do you have so far?
     
  3. Offline

    glassbillen

    phildachil i havent got any code to my request, but do you want my main class?
     
  4. Offline

    jacklin213

    For color codes use , ChatColor.translateAlternativeColorCodes('&', string)
     
  5. Offline

    glassbillen

    jacklin213 where should i put the code ounder onCommand or enable or something like that?
     
  6. Offline

    zack6849

    Lets say you have that stored in a config file, in a variable named message
    Code:
    String message = this.getConfig().getString("message");
    message = ChatColor.translateAlternativeColorCodes('&', message).replaceAll("&S", sender.getName()).replaceAll("&T", target.getName());
    
     
  7. Offline

    glassbillen

    zack6849 help

    Code:java
    1. @Override
    2. public void onEnable() {
    3. getLogger().info("EmotionCraft has been enabled!");
    4. File file = new File(getDataFolder() + File.separator + "config.yml");
    5.  
    6. if (!file.exists()) {
    7. this.getLogger().info("Generating Config.yml...");
    8.  
    9. this.getConfig().addDefault("HugReciever", "You have been huged by ");
    10. this.getConfig().addDefault("HugSender", " huged");
    11. this.getConfig().addDefault("KissReciever", "You have been kissed by ");
    12. this.getConfig().addDefault("KissSender", " kissed");
    13. this.getConfig().addDefault("SorryReciever", " is sorry!");
    14. this.getConfig().addDefault("SorrySender", " apologized!");
    15. this.getConfig().addDefault("MakeOutReciever", " tried to make out with you!");
    16. this.getConfig().addDefault("MakeOutSender", "You made out with ");
    17. this.getConfig().addDefault("ComfortReciever", " trying to comfort you!");
    18. this.getConfig().addDefault("ComfortSender", " must be happy now :)");
    19. this.getConfig().addDefault("SlapReciever", " slaped you!");
    20. this.getConfig().addDefault("SlapSender", " slaped!");
    21. this.getConfig().options().copyDefaults(true);
    22. this.saveConfig();
    23. this.getLogger().info("Generated Config.yml complete!");
    24.  
    25. }
    26. }
    27.  
    28.  

    where should i put and i got red underline ounder it when i past ounder generating config

    help?

    omg :( there is no one there?

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

Share This Page