n must be positive Exception

Discussion in 'Plugin Development' started by Gopaintman, Jan 22, 2014.

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

    Gopaintman

    So I'm attempting to teleport a player, and always the server will crash and throw this "n must be positive" error, that causes a null error. Any ideas?
     
  2. Offline

    RawCode

    what about code and stacktrace?
     
  3. Offline

    werter318

    are you putting a negative number in a rng?
     
  4. Offline

    Gopaintman

    All I'm doing is teleporting a player.
     
  5. Offline

    werter318

  6. Offline

    Miffy

    You must have something else than just a teleport. Show us the class and the stacktrace.
     
  7. Offline

    Gopaintman

    werter318


    Code:java
    1. final PlayerInfo playerInfo = loadPlayerInfo(playerName);
    2. Location next;
    3. if(hasOrphan()){
    4. getServer().broadcastMessage("1");
    5. next = getNextOrphan();
    6. }else{
    7. getServer().broadcastMessage("0");
    8. next = getNextCastleLocation();
    9. }
    10. if(WorldEditHandler.loadSchematic(Main.getMainInstance().castleSchem, Main.getMainInstance().getCastleWorld(), next)){
    11. playerInfo.setIslandLocation(next);
    12. savePlayerInfo(playerInfo);
    13. sender.sendMessage(ChatColor.GREEN + "Castle successfully created!");
    14. getServer().getPlayer(playerName).teleport(next);
    15. createBorders(next.getBlockX(), next.getBlockZ(), true, Main.getMainInstance().getCastleWorld());
    16. setLastLocation(next);
    17. WorldGuardHandler.protectIsland(sender, next, playerName);
    18.  
    19.  
    20.  
    21. }else{
    22. sender.sendMessage(ChatColor.RED + "Castle could not be created! Contact an administrator!");
    23. }
     
Thread Status:
Not open for further replies.

Share This Page