Teleport when spawned

Discussion in 'Plugin Development' started by Poppi, Jan 15, 2013.

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

    Poppi

    1.4.6 ro1
     
  2. Offline

    Miner_Fil

    :eek: I got a error

    I might be able to recreate it and then post it, And it will work

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

    Poppi

    what was the errror?
     
  4. Offline

    Miner_Fil

    Poppy, I have decompiled your code and i see the errors so in every class where it says ChatColor.<Color> + ChatColor.BOLD + Remove The ChatColor.BOLD + or it wont work

    I am editing the files and i will post it, Without any bugs

    Its So MESSY omg can't see it good

    Well i won't be able to fix it and i get a heck of error messages

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  5. Offline

    Poppi

    thats alright. I can live with the reloading part since it'll be a private plugin :)

    btw do you know how to teleport when I respawn since everything Ive tried so far has failed?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  6. Offline

    Miner_Fil

    you mean like specified location?

    Code:
    Location loc = player.getLocation();
    loc.setX(1111);
    loc.setY(64);
    loc.setZ(2222);
    player.teleport(loc);
    Is for specified location

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  7. Offline

    Poppi

    I know that, but It wont do it when I respawn, it does it as I die
     
  8. Offline

    Miner_Fil

    Code:
    public void onPlayerRespawn(PlayerRespawnEvent event){
    Player p = event.getPlayer();
    Location loc = p.getLocation();
    loc.setX(1111);
    loc.setY(5);
    loc.setZ(1111);
    }
    Try that
     
  9. Offline

    Poppi

    I will in the morning, right now I need some sleep. I'll message you if it worked or not
     
  10. Offline

    fireblast709

    event.setRespawnLocation(location); in PlayerRespawnEvent
     
    Miner_Fil likes this.
  11. Offline

    Poppi

    doesnt work

    doesnt work

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  12. Offline

    fireblast709

    it does work, you just implement it incorrectly
     
  13. Offline

    Poppi

    for some reason I get a nullpointerexception from it
     
  14. Offline

    fireblast709

    then don't feed it a null Location :p
     
  15. Offline

    Poppi

    Code:
    @EventHandler
        public void onPlayerRespawn(final PlayerRespawnEvent event) {
            if (joined.contains(event.getPlayer())) {
                plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
                    @Override
                    public void run() {
                        //    event.setRespawnLocation(arena1);
                        if (Bukkit.getServer().getWorld("ArenaPVP") != null) {
                        event.getPlayer().teleport(arena1);
                        }
                    }
     
                }, 60L);
     
  16. Offline

    fireblast709

    Code:
    @EventHandler
    public void onPlayerRespawn(final PlayerRespawnEvent event) 
    {
        if (joined.contains(event.getPlayer())) 
        {
            // MAKE SURE arena1 IS NOT NULL
            // AND THE WORLD EXISTS :3
            event.setRespawnLocation(arena1);
        }
    }
     
  17. Offline

    Poppi

    is there a easy way to do that?
     
  18. Offline

    fireblast709

    its 8 lines (using C++ format, so the {} are on new lines). And you want it simpler?
     
  19. Offline

    Poppi

    Im not sure how to check if the arena1 isnt null
     
  20. Offline

    fireblast709

    well you should initialize it obviously. It doesn't sound healthy for your plugin if arena1 is null
     
Thread Status:
Not open for further replies.

Share This Page