Bukkit 4 Beginners | Tut. 2 - Loggers and Plugin.yml

Discussion in 'Resources' started by MineStein, May 5, 2014.

?

Was this tutorial helpful?

  1. Yes

    40.0%
  2. No

    60.0%
  3. Confusing

    0 vote(s)
    0.0%
Thread Status:
Not open for further replies.
  1. Offline

    MineStein

    Welcome back everyone! Tutorial 2 in Bukkit 4 Beginners! As promised in last tutorial, I said we shall be doing Loggers and our plugin.yml!

    Previous Lesson

    We were left with this code:
    Code:java
    1. package me.MineStein.BukkitTut;
    2.  
    3. import org.bukkit.plugin.java.JavaPlugin;
    4.  
    5. public class Core extends JavaPlugin{
    6.  
    7. public void onEnable(){
    8.  
    9. }
    10.  
    11. public void onDisable(){
    12.  
    13. }
    14.  
    15. }
    16.  


    Now we will be adding Loggers to let our console know we enabled and disabled the plugin!

    You can use loggers in two ways

    First way:
    Code:java
    1. Bukkit.getServer().getLogger().<LoggerType>("<Message>")


    Second way:
    Code:java
    1. getLogger().<LoggerType>("<Message>")


    They both achieve the same goal, and will give off a code somewhat like this:
    Code:
    [<LoggerType]<Message>
    So here is how we will be using it inside our plugin
    Code:java
    1. package me.MineStein.BukkitTut;
    2.  
    3. import org.bukkit.Bukkit;
    4. import org.bukkit.plugin.java.JavaPlugin;
    5.  
    6. public class Core extends JavaPlugin{
    7.  
    8. public void onEnable(){
    9. Bukkit.getServer().getLogger().info("BukkitTut enabled!");
    10. }
    11.  
    12. public void onDisable(){
    13. Bukkit.getServer().getLogger().info("BukkitTut disabled!");
    14. }
    15.  
    16. }
    17.  


    This is our code so far, no more coding for now.

    Now we need to create our plugin.yml (It is essential!)

    1) Right click on "src"
    2) Create a new file
    3) Name it "plugin.yml"

    This is the formatting:

    Code:
    name: BukkitTut
    author: MineStein:
    main: me.MineStein.BukkitTut.Core
    version: 1.0
    commands:
     
    permissions:
    Next time, we will create a command, learn about colors, and learn events!

    Next Lesson (Link Coming Soon)
     
  2. Offline

    ampayne2

    Enable and disable messages have been sent automatically in console for a while now ;)
     
    Onlineids likes this.
  3. Offline

    xTrollxDudex

    MineStein
    Don't make a new post for every "lesson". Reserve comments from the first post and edit later.
     
  4. Offline

    MineStein

    xTrollxDudex Thank you for the tip :D

    ampayne2 This is the practice I tend to follow, it is just nice to make sure. Thanks for the opinion :D

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

    Alshain01

    No, there are Enabling and Disabling messages. These occur at the start of the process. Sometimes you want to know when it finishes, especially true if your doing some long task like upgrading a previous versions database schema to the latest, which may involve time consuming data conversions.
     
  6. Offline

    Garris0n

    You'll know when it finishes because the next enable message will print :p

    Database conversions also don't seem very relevant to a tutorial in which people with no Java knowledge copy-paste onEnable methods into an IDE.
     
  7. Offline

    BungeeTheCookie

    MineStein
    To prevent you from wasting your time, I don't think these tutorials are necessary on the bukkit Forums.
     
  8. Offline

    MineStein

Thread Status:
Not open for further replies.

Share This Page