How would I do this?

Discussion in 'Plugin Development' started by jasonderlo22, Jul 12, 2013.

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

    jasonderlo22

    OK, so if I wanted there to be a lobby and a map how would I do the following: If There are two worlds, The lobby and another map like I just said and If I wanted for the people to be in the lobby for 1 minute and the map for 4 minutes how would I do this so it was always happening like as in a loop.

    Thanks, jasonderlo22

    If that makes scene

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

    Mycrowut

  3. Offline

    jasonderlo22


    This didn't really help much. I mean after an amount of time it teleports you to another world. Although the timer bit did help. Thanks:)

    Bump

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

    chasechocolate

    jasonderlo22 use schedulers:
    Code:java
    1. new BukkitRunnable(){
    2. @Override
    3. public void run(){
    4. //Teleport to other world
    5. }
    6. }.runTaskTimer(plugin, 4800L, 4800L); //240 seconds in 4 minutes, 20 ticks in 1 second, 240 * 20 = 4800 ticks
     
  5. Offline

    jasonderlo22

    @chasechocolateits it said on 'plugin': plugin can't be resolved to a variable
     
  6. Offline

    xTrollxDudex

    jasonderlo22
    You create the plugin variable
    At the top of the class, put
    Code:java
    1. <main class name> plugin;
    2. public <this class's name>(<main class name> plugin){
    3. this.plugin = plugin;
    4. }

    Unless this happens to be in the main class, put in "this" in the place of plugin
     
  7. Offline

    jasonderlo22

    Ok thanks, But what method would I use to teleport them to a different world ?
     
  8. Offline

    xTrollxDudex

    jasonderlo22
    Code:java
    1. String world = player.getServer.getWorld("<world name>");
    2. player.teleport(new Location(World world, <x coords>, <y coords>, <z coords>);
     
    jasonderlo22 likes this.
  9. Offline

    jasonderlo22

    xTrollxDudex Ahh thanks so much would, I have to use multiverse or is that fine. so my code now would be
    Code:java
    1.  
    2. new BukkitRunnable(){
    3. public void run(){
    4. String world = player.getServer.getWorld("<world name>");
    5. player.teleport(new Location(World world, <x coords>, <y coords>, <z coords>);
    6.  
    7.  
    8. }
    9. }.runTaskTimer(this, 4800L, 4800L);
     
  10. If I were you I would go study some java first, then take a look trough the bukkit docs, then follow some tutorials and make a basic plugin without copy-pasting. Then we will be able to help you, my young padawan.
     
    jasonderlo22 and Rprrr like this.
  11. Offline

    jasonderlo22

    I only copy and pasted that part
     
  12. Offline

    xTrollxDudex

    jasonderlo22
    *facepalm* he means that you should've filled in some stuff. The stuff <in here> should be customized by you.
     
    jasonderlo22 likes this.
  13. Offline

    jasonderlo22

    I don't know the cords Atm :)
     
  14. Offline

    xTrollxDudex

    jasonderlo22 likes this.
  15. Offline

    jasonderlo22

    xTrollxDudex

    Yeah, It was just an example too see if I did it right. Also i have added some code and when I try the commands on the server it says invalid plugin.yml. This is my yml:

    Code:
     name: PotWars
    main: me.jasonderlo22.PotWars.main
    version: 1.0
    Description: Killer command tells who killed you.
    commands:
      killer:
          description: This is a command that will tell you your Killer!
          usage: /killer [player]
          permission: PotWars.basic
          permission-message: You don't have <permission>
          
     
  16. Offline

    xTrollxDudex

    jasonderlo22
    Show me the stack trace in the console(the errors) and the package declaration (the entire first line) of your main class.

    Remember you cannot use tab in the plugin.yml and you might want to remove that space before the name of the plugin.

    Otherwise, is "main" really the name of the class that extends JavaPlgin? Please use proper packages. {top-level domain}.{domain}.{plugin-name}.{class name}. Note plugin-name is entirely lowercase and the class name can have captital letters if you want
     
  17. Offline

    SnipsRevival

    xTrollxDudex likes this.
  18. Offline

    xTrollxDudex

  19. Offline

    SnipsRevival

    xTrollxDudex That's the advantage of being in a community of Bukkit's size; some may spot things that others miss.
     
  20. Offline

    xTrollxDudex

    SnipsRevival
    Actually it's being in a community of smart people and one stupid person (me)

    Edit: actually, I'm not stupid but I'm a trol :p
     
Thread Status:
Not open for further replies.

Share This Page