PlayerRespawnEvent Help!

Discussion in 'Plugin Development' started by bjsnow, Jun 8, 2013.

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

    bjsnow

    Once they respawn they get the Internal server error.
    Is it my plugin? Or another one on the server?
    Code:
    @EventHandler(priority = EventPriority.HIGHEST)
           
            public void onPlayerInteract(final PlayerRespawnEvent event) {
                final Player player = event.getPlayer();
                
                if(getConfig().getBoolean("randomrespawn") == true) {
            
                    
                    
                    Random r = new Random();
                                    int Low = 1;
                                    int High = 15;
                                    int R = r.nextInt(High - Low) + Low;
    
                                    if(player.getWorld().getName().equals(getConfig().getString("W1"))) {
                              
                                            String xa = getConfig().getString("SpawnW1" + R +".x");
                                            
                                            String ya = getConfig().getString("SpawnW1" + R +".y");
                                            String za = getConfig().getString("SpawnW1" + R + ".z");
                                            double xda = Double.parseDouble(xa);
                                            double yda = Double.parseDouble(ya);
                                            double zda = Double.parseDouble(za);
                                            Location Lobby = new Location(Bukkit.getWorld("world"), xda,
                                                            yda, zda);
                                            event.setRespawnLocation(Lobby);
                                   
                }else if(player.getWorld().getName().equals(getConfig().getString("W2"))) {
                      
                                            String x = getConfig().getString("SpawnW2" + R +".x");
                                            
                                            String y = getConfig().getString("SpawnW2" + R +".y");
                                            String z = getConfig().getString("SpawnW2" + R + ".z");
                                            double xd = Double.parseDouble(x);
                                            double yd = Double.parseDouble(y);
                                            double zd = Double.parseDouble(z);
                                            Location Lobby = new Location(Bukkit.getWorld("world2"), xd,
                                                            yd, zd);
                }
    }
    }
    
    Config

    Code:
    randomrespawn: true
    W1: world
    W2: world2
    
     
  2. Offline

    TheUpdater

    that shall work =/ from my look

    have you registerd events?
     
  3. Offline

    bjsnow

    Code:
    @Override
        public void onEnable() {
            PluginManager pm = this.getServer().getPluginManager();
            pm.registerEvents(this, this);
            System.out.println("MultiSpawn Revamped 1.0.0.0A has been enabled!");
    
    }
    
     
  4. Offline

    Drkmaster83

    Post the full stack trace?
     
Thread Status:
Not open for further replies.

Share This Page