reload event or something

Discussion in 'Plugin Development' started by TheDeathMachine, Apr 27, 2013.

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

    TheDeathMachine

    hello,
    I'm making an ffa plugin. And as soon as the server is reloaded the players in the game should be teleported to an leavepoint.

    Is there a reload event or something equal to that?
     
  2. Offline

    georgeamare

    TheDeathMachine
    I think reloading the server activates the onDisable() , and there you should put the code. ( I think )

    Make a command : /setspawn leave
    That will get the location where the player is . And then at onDisable() add a teleport code to that location . \
    I think this is how it works , but im not sure.
     
  3. Offline

    TheDeathMachine

    georgeamare will try

    georgeamare i connot use player in OnDisable

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

    georgeamare

  5. Offline

    TheDeathMachine

  6. Offline

    willeb96

    Put this in your main class:

    public void onDisable() {
    for (Player player : getServer().getOnlinePlayers()) {
    player.teleport(leavePoint);
    }
    }
     
  7. Offline

    TheDeathMachine

    willeb96

    I have this:
    Code:
        public void onDisable(){
            System.out.println("HFFA Disabled");
                for (Player player : getServer().getOnlinePlayers()) {
                player.teleport(
                       
                        String path = "LeavePoint";
                       
                        World world = Bukkit.getWorld(getConfig().getString(path+ ".world"));
                       
                        double x = getConfig().getDouble(path + ".x");
                        double y = getConfig().getDouble(path + ".y");
                        double z = getConfig().getDouble(path + ".z");
                        float yaw = getConfig().getInt(path + ".yaw");
                        float pitch = getConfig().getInt(path + ".pitch");
                     
                        player.teleport(new Location(world, x, y, z, yaw, pitch));
                }
        }
    but it does not know string and path
     
  8. Offline

    georgeamare

    TheDeathMachine
    Have you stored the location correctly in the config file ?
     
  9. Offline

    TheDeathMachine

    georgeamare yes, bit it gives red underlines under the String and Path
     
  10. Offline

    willeb96

    Store the leave point in a variable somewhere instead of loading it from the config for every player.
     
  11. Offline

    Sagacious_Zed Bukkit Docs

    Then you should read the error that your IDE is reporting. It will tell you what you are doing wrong.
     
  12. Offline

    mikeaaaa

    PHP:
    p.chat("/reload");
    or
    Bukkit.getServer().reload();
    Like that?
     
Thread Status:
Not open for further replies.

Share This Page