Functions, use.

Discussion in 'Plugin Development' started by Przemek_, Dec 4, 2011.

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

    Przemek_

    Hi!
    I'm learning to create plugins to bukkit.
    Suppose I want to know what function (example usage), I set the time (eg day / night), weather. Or how to throw a player from the server.
    I would like to apologize for my incorrect English, but I am a young Pole, and I know some words, so I used the Google Translator.
     
  2. Offline

    CptSausage

    You should learn to use the bukkit documentation.
    Let's take your 'set time' as an example. You would like to set the time on the server:

    Search the documentation for a server class.
    If you found it, look for the next keywords. You would like to set the time on the server.
    Maybe there is something like a Server.setTime(XXX);

    Hm no. But there is a function / method called: getWorld()
    It seems like the server class can't set the time, because it doesn't know in which world.

    getWorld() returns an object / class called 'World'. So let's click on this one. Maybe World has something like a World.setTime(XXX);

    Oh yes there is something. World.setFullTime(long time); Looks like the method I need, but how to use it? My plugin is not the server. I can't use the getWorld() function.

    So let's have a look at the 'Plugin' class. Maybe we can get the server.
    *click on plugin*

    Yes there is something. It's called getServer() :D yay!
    So we can change the time with:

    Code:java
    1. getServer().getWorld("MyWorldName").setFullTime(123);


    ----
    This is how you can find what you need. :)
     
  3. Offline

    Przemek_

    Very thanks. I don't know a bukkit documentation. Very thanks.
    Sorry, but I don't know find in bukkit documentation.
    Suppose, like how to find a kick?
     
Thread Status:
Not open for further replies.

Share This Page