Solved 3 messages in 1 in log

Discussion in 'Plugin Development' started by German121314, Aug 7, 2013.

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

    German121314

    Hi everyone! i have the next problem: When plugin starts it tells me:

    *Loaded recipe: GRASS_BLOCK
    *Loaded recipe: MOSSY_COBBLE
    *Loaded recipe: ICE

    here's the code:

    Code:java
    1. if(this.getConfig().getBoolean("GRASS_BLOCK") == true)
    2. {
    3. ItemStack item = new ItemStack(Material.GRASS); // Create Grass block
    4. ShapelessRecipe grassblock = new ShapelessRecipe(item);
    5. grassblock.addIngredient( Material.SEEDS); // and # - is the material
    6. grassblock.addIngredient( Material.DIRT);
    7. getServer().addRecipe(grassblock);
    8. log.info("Loaded recipe: GRASS_BLOCK");
    9. }
    10.  
    11.  
    12. if(this.getConfig().getBoolean("MOSSY_COBBLE") == true)
    13. {
    14. ItemStack item = new ItemStack(Material.MOSSY_COBBLESTONE); // Create Grass block
    15. ShapelessRecipe mossy = new ShapelessRecipe(item);
    16. mossy.addIngredient( Material.COBBLESTONE); // and # - is the material
    17. mossy.addIngredient( Material.VINE);
    18. getServer().addRecipe(mossy);
    19.  
    20. log.info(''Loaded recipe: MOSSY_COBBLE");
    21. }
    22. if(this.getConfig().getBoolean("ICE") == true)
    23. {
    24. ItemStack item = new ItemStack(Material.ICE,32);
    25. ItemStack item2 = new ItemStack(Material.BUCKET,1);
    26. ShapedRecipe ice = new ShapedRecipe(item);
    27. ice.shape("AAA","ABA","AAA");
    28. ice.setIngredient('B',Material.WATER_BUCKET);
    29. ice.setIngredient('A',Material.SNOW_BALL);
    30. getServer().addRecipe(ice);
    31.  
    32. log.info("Loaded recipe: ICE")
    33. }



    But i want the following:


    *Loaded recipes: GRASS_BLOCK, MOSSY_COBBLE, ICE
     
  2. append the messages to a string builder or a simple string, and then log the collected messages once at the end
     
  3. Offline

    evilguy4000

    German121314
    Make it so that if the config output says true that the only then its added to the string and then it will be ouputted to that string message (or log message) ;)
     
  4. Offline

    German121314

    log.info(System.out.println(message.toString());)

    gives me an error. Help me to end the code!

    log.info(message);

    gives an error to. It tells that required String but found StringBuilder.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  5. Offline

    Tarestudio

    German121314 likes this.
  6. then give him a string
    log.info(message.toString());
     
    German121314 likes this.
  7. Offline

    German121314

    ok than, thanks a lot!
     
Thread Status:
Not open for further replies.

Share This Page