Guest User

yeah

a guest
Jan 20th, 2013
112
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. plugin.yml:
  2. name: CommandRequest
  3. main: net.terrorsquad.commandRequest.CommandRequest
  4. version: 1.0
  5. commands:
  6.    fconfirm:
  7.       description: Confirm your forum account.
  8.       usage: /fconfirm <secretkey>
  9.       permission: commandrequest.fconfirm
  10.       permission-message: You don't have permission to fconfirm.
  11.  
  12. ===EOF===
  13.  
  14. config.yml:
  15. commandRequest:
  16. commands:
  17.  - /tp $p 0 64 0
  18.  - /pay $p 170
  19.  - /gamemode $p adventure
  20. welcomeMessage: $p has registered!
  21. ===EOF===
  22.  
  23. /src/org/terrorsquad/commandRequest/commandRequest.java
  24. package org.terrorsquad.commandRequest;
  25.  
  26. import java.util.*;
  27. import org.bukkit.command.*;
  28. import org.bukkit.entity.Player;
  29. import org.bukkit.event.*;
  30. import org.bukkit.event.player.PlayerJoinEvent;
  31. import org.bukkit.configuration.file.FileConfiguration;
  32. import org.bukkit.plugin.java.JavaPlugin;
  33.  
  34. public class commandRequest extends JavaPlugin {
  35.     public List<String> commands;
  36.    public void onEnable(){
  37.        // TODO Insert logic to be performed when the plugin is enabled
  38.         this.saveDefaultConfig();
  39.         commands = getConfig().getStringList("CommandRequest.commands");
  40.    }
  41.    @Override
  42.    public void onDisable() {
  43.        // TODO Insert logic to be performed when the plugin is disabled
  44.    }
  45.    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
  46.         if(cmd.getName().equalsIgnoreCase("fconfirm")){ // If the player typed /fconfirm then do the following...
  47.             if (!(sender instanceof Player)) {
  48.                 sender.sendMessage("This command can only be run by a player.");
  49.             } else {
  50.                 Player player = (Player) sender;
  51.                 sender.sendMessage("Attempting to confirm you with the forums...");
  52.                     for(String command : commands){
  53.                         getServer().dispatchCommand(getServer().getConsoleSender(), command);
  54.                     }
  55.  
  56.                 }
  57.                 return true;
  58.             }
  59.             return false;
  60.         }
  61.     }
RAW Paste Data