Timer for Login

Discussion in 'Plugin Development' started by WingedMLGPro, Jun 24, 2015.

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


    Hey Everyone,
    I am making a UHC plugin and i want it so if a player quits the server it stores there items and location and they have five mins to join, else they become a spectator.
    BUT i have no idea how i would go about doing this!

  2. Offline


    You can have a map where the player's inventory clone is stored and therefore the items in it, and location as well and when they join back if the map contains them set their inv to the one in the map and their location to the one i n the map.
    Hint an example would be:
    Map<String,ObjectWithPlayerInfoSeeAbove> ...
    and the ObjectWithPlayerInfoSeeAbove (lol) is a custom object to hold the inventory clone and location,
    Now if the hashmap does not contain the player, make them a spectator.

    About timing, you need to evaluate the situation and judge upon selecting a repeating task or creating new task s upon disconnect. That has to be judged based on the server's traffic :p
  3. Offline


    maybe try this
    public void onEnable(){
    public int place;
    public void ThaName(PlayerQuitEvent e){
    Player ep = (Player) e.getPlayer();
    i gould finish because i was in school i will edit this when i come home i hope.... sorry
  4. Offline


    Isn't the player's inventory saved anyway?
  5. Offline


    @567legodude Hmm, i dunno, ill test when i go, and i think the location might save aswell...
  6. Offline


    @WingedMLGPro Well, when you log off, your last inventory and location are saved. So you shouldn't have to worry about that too much.
  7. Offline


    @567legodude Ok, But i dont know how to do the 5 min timer :/
  8. Offline


    @WingedMLGPro Add the player in an arraylist. Use a runnable for remove player from the arraylist after the time you set. When they join, if they are not in the list, clear the inventory
  9. Offline


Thread Status:
Not open for further replies.

Share This Page