Private warp help

Discussion in 'Plugin Development' started by lcpvp, Mar 30, 2013.

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

    lcpvp

    I want players to be able to set warps, warp to those warps, delete the warps, and list them. I have this so far. The /delwarp command doesnt work, so I need help with all this:
    How to list the warps
    How to delete the warps
    How to add a 10 second delay before teleport if anyone is within 10 blocks of player
    How to kill player if they try to warp while in air for more than 1 second
    How to make the player immune from damage and unable to attack for 5 seconds after warping
    How to cancel warp if player moves within 10 seconds if the player is in 10 blocks.
    Code:java
    1.  
    2. if(commandLabel.equalsIgnoreCase("setwarp")){
    3. if(args.length == 0){
    4. player.sendMessage(ChatColor.GOLD + "Please name your warp!");
    5. } else if(args.length == 1){
    6. int warpAmount = getConfig().getInt(player.getName() + ".Number-Of-Warps");
    7. if(player.hasPermission("g.warp5")){
    8. if(warpAmount == 5){
    9. player.sendMessage("You have reached your warp maxium!");
    10. return false;
    11. }
    12. }
    13. Location warp = player.getLocation();
    14. getConfig().set(player.getName() + "." + args[0] + ".X", warp.getX());
    15. getConfig().set(player.getName() + "." + args[0] + ".Y", warp.getY());
    16. getConfig().set(player.getName() + "." + args[0] + ".Z", warp.getZ());
    17. getConfig().set(player.getName() + "." + args[0] + ".World", warp.getWorld().getName());
    18. getConfig().set(player.getName() + "." + args[0] + ".Pitch", warp.getPitch());
    19. getConfig().set(player.getName() + "." + args[0] + ".Yaw", warp.getYaw());
    20. saveConfig();
    21. player.sendMessage(ChatColor.GOLD + "Warp " + ChatColor.GRAY + args[0] + ChatColor.GOLD + " has been set!");
    22. }
    23. }else if(commandLabel.equalsIgnoreCase("go")){
    24. if(args.length == 0){
    25. player.sendMessage(ChatColor.GRAY + "------" + ChatColor.GOLD + "Warp Help" + ChatColor.GRAY + "------");
    26. player.sendMessage(ChatColor.GRAY + "/go [warp] - " + ChatColor.GOLD + "Teleports you to private warp.");
    27. player.sendMessage(ChatColor.GRAY + "/setwarp [warp] - " + ChatColor.GOLD + "Sets a warp to current location");
    28. player.sendMessage(ChatColor.GRAY + "/delwarp [warp] - " + ChatColor.GOLD + "Deletes a warp.");
    29. player.sendMessage(ChatColor.GRAY + "/listwarp - " + ChatColor.GOLD + "Lists current warps.");
    30. } else if(args.length == 1){
    31. if(!getConfig().contains(player.getName() + "." + args[0])){
    32. player.sendMessage(ChatColor.GREEN + "No warp named " + args[0] + " is set");
    33. }
    34. World w = player.getServer().getWorld(getConfig().getString(player.getName() + "." + args[0] + ".World"));
    35. Double x = getConfig().getDouble(player.getName() + "." + args[0] + ".X");
    36. Double y = getConfig().getDouble(player.getName() + "." + args[0] + ".Y");
    37. Double z = getConfig().getDouble(player.getName() + "." + args[0] + ".Z");
    38. float Yaw = getConfig().getInt(player.getName() + "." + args[0] + ".Yaw");
    39. float Pitch = getConfig().getInt(player.getName() + "." + args[0] + ".Pitch");
    40. Location PersonalWarp = new Location(w, x, y, z, Yaw, Pitch);
    41.  
    42. player.teleport(PersonalWarp);
    43. player.sendMessage(ChatColor.GOLD + "You can't attack for 10 seconds.");
    44. }
    45. }else if(commandLabel.equalsIgnoreCase("listwarp")){
    46. if(args.length == 0){
    47. if(!getConfig().contains(player.getName() + ".")){
    48. player.sendMessage(ChatColor.GRAY + "-----" + ChatColor.GOLD + "Your Warps" + ChatColor.GRAY + "-----");
    49. }
    50.  
    51. }else if(commandLabel.equalsIgnoreCase("delwarp")){
    52. if(args.length == 0){
    53. player.sendMessage(ChatColor.GOLD + "Specify a warp first!");
    54. } else if(args.length == 1){
    55. if(!getConfig().contains(player.getName() + "." + args[0])){
    56. getConfig().set(player.getName() + "." + args[0], args[0] == null);
    57. saveConfig();
    58. player.sendMessage(ChatColor.GRAY + args[0] + ChatColor.GOLD + " deleted successfully.");
    59. }
    60. }
    61. }
    62.  


    Any code to make this would help, I have been trying and can't figure it out.

    Thanks what about for the other stuff i need help with?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Aug 16, 2018
  2. Offline

    RainoBoy97

    You are checking if the config does not contain the warp, then trying to delete it.
     
  3. Offline

    lcpvp

    What to do instead?
     
  4. Offline

    RainoBoy97

    Remove the !
     
  5. Offline

    microgeek

    [​IMG]
    You have made countless help threads that can be solved with even basic use of logic or beginner Java knowledge, please learn Java before trying to deploy a program written in it.
     
Thread Status:
Not open for further replies.

Share This Page