Setting a players location while offline?

Discussion in 'Spigot Plugin Development' started by Gorobetz, Jun 5, 2017.

  1. Currently my friends server is suffering a problem with broken chunks, where if a player goes in them they are kicked and when they log on they are kicked also. I can fix this manually, but that is painful to do over and over. So....
    Code (Text):

    public class AntiKick extends JavaPlugin implements Listener {
    @Override
    public void onEnable(){
        Bukkit.getPluginManager().registerEvents(this, this);
    }
    @EventHandler
    public void onPlayerJoin(PlayerLoginEvent e){
        if(e.getResult().equals(Result.KICK_OTHER)){
            Player p = e.getPlayer();
            OfflinePlayer pl = e.getPlayer();
            Location loc = pl.getBedSpawnLocation();
            //Set the location of the player to here.
        }
    }
    }
     
    How do I set the players location for when they log on to their bed location?
     
    #1 Gorobetz, Jun 5, 2017
    Last edited: Jun 5, 2017
  2. just tp them to that location when they join back? Using player join event.
     
  3. Save their UUID into some sort of list when they're kicked, check PlayerLoginEvent for their UUID, and if the list contains it, tp them to your location.
     
  4. But I only want this to happen for someone who got kicked for... "other"
     
  5. ok yeah Ill try that then, but I generally try to avoid lists....
     
  6. Any reason as to why you generally try to avoid lists?
     
  7. Cause generics are scary :O ??? Duh....
     
  8. why? tell us a valid reason why then we will.
     
  9. I dunno they just never work. Whenever I use a hashmap or any list iI get internal errors
     
  10. Not risking code with errors won't take you to knowledge.
     
  11. I feel if you can't manage to learn how to use a List/Hashmap, you should learn Java basics. Plenty of good tutorials online on how to use conventions, and avoid pesky errors. Goodluck. PM me for further help.
     
    • Agree Agree x 1
    • Winner Winner x 1
    • Informative Informative x 1
  12. Ok yeah thanks didn't actually know how that would work.
     
  13. I know how to use a hashmap for the most pary, usually there is a small error no one has a clue about, for example, I had one that saved a long and a players UUID. Whenever I tried getting the long I would get an internal error which you probably couldn't solve yourself.