Making a warp plugin with warps saved in config.

Discussion in 'Plugin Development' started by Taizzz, Aug 19, 2013.

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

    Taizzz

    Hey!

    I'm trying to make a warp plugin which involves saving warp locations to a config, along with the player who set that warp. The warps are to be private, so only the player who set them can access them.

    I've built the frame of the plugin, but I don't have much of an idea of where to come from here, I might be taking a completely wrong approach already, I don't know.

    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd,
    2. String commandLabel, String args[]) {
    3. Player player = (Player) sender;
    4. if (commandLabel.equalsIgnoreCase("go")) {
    5. if (args.length == 0) {
    6. player.sendMessage(ChatColor.RED + "Invalid /go usage.");
    7. player.sendMessage(ChatColor.GRAY + "/go set [WarpName] - Create a warp.");
    8. player.sendMessage(ChatColor.GRAY + "/go delete [WarpName] - Delete a warp.");
    9. player.sendMessage(ChatColor.GRAY + "/go [WarpName] - Warp.");
    10. player.sendMessage(ChatColor.GRAY + "/go list - List your warps.");
    11. } else {
    12. if (args[0].equalsIgnoreCase("set")) {
    13. if (args.length == 2) { // if "/go set [warpname]"
    14. Location location = player.getLocation();
    15. player.sendMessage(ChatColor.GRAY + "Warp \""+ args[1] + "\" has been set!");
    16.  
    17. //Setting location + player into warp config.
    18.  
    19.  
    20. } else {
    21. player.sendMessage(ChatColor.GRAY + "Usage: /go set [WarpName]");
    22. }
    23. } else if (args[0].equalsIgnoreCase("del")) {
    24.  
    25.  
    26. //Removing the warp from the config.
    27.  
    28.  
    29. } else if (args[0].equalsIgnoreCase("list")) {
    30.  
    31. //Printing out warps to player.
    32.  
    33. }
    34.  
    35. }
    36. }
    37. return false;
    38. }
     
  2. Offline

    EcMiner

Thread Status:
Not open for further replies.

Share This Page