Guest User

source2

a guest
Jan 20th, 2013
36
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. plugin.yml
  2. name: CommandRequest
  3. main: org.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.  
  13. config.yml
  14. commandRequest:
  15. commands:
  16. - /tp $p 0 64 0
  17. - /gamemode $p creative
  18. welcomeMessage: $p has registered!
  19.  
  20.  
  21. package org.terrorsquad.commandRequest;
  22.  
  23. import java.util.*;
  24. import org.bukkit.command.*;
  25. import org.bukkit.entity.Player;
  26. import org.bukkit.event.*;
  27. import org.bukkit.event.player.PlayerJoinEvent;
  28. import org.bukkit.configuration.file.FileConfiguration;
  29. import org.bukkit.plugin.java.JavaPlugin;
  30.  
  31. public class commandRequest extends JavaPlugin {
  32. public List<String> commands;
  33. public String prefix = "§f[§aTerrorSquad§f]§3";
  34. public static String commandfix;
  35. public void onEnable(){
  36. // TODO Insert logic to be performed when the plugin is enabled
  37. this.saveDefaultConfig();
  38. commands = getConfig().getStringList("CommandRequest.commands");
  39. }
  40. @Override
  41. public void onDisable() {
  42. // TODO Insert logic to be performed when the plugin is disabled
  43. }
  44. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
  45. if(cmd.getName().equalsIgnoreCase("fconfirm")){ // If the player typed /fconfirm then do the following...
  46. if (!(sender instanceof Player)) {
  47. sender.sendMessage("This command can only be run by a player.");
  48. } else {
  49. getLogger().info("running command");
  50. Player player = (Player) sender;
  51. sender.sendMessage(new StringBuilder().append(prefix).append("Attempting to confirm you with the forums...").toString());
  52. getLogger().info("forloop");
  53. String command;
  54. for (int i=0;i<commands.size();i++) {
  55. command = commands.get(i);
  56. getLogger().info("forloop1");
  57. commandfix = command.replace("$p", sender.getName());
  58. commandfix = commandfix.replace("/", "");
  59. getLogger().info(commandfix);
  60. getServer().dispatchCommand(getServer().getConsoleSender(), commandfix);
  61.  
  62. }
  63. }
  64. return true;
  65. }
  66. return false;
  67. }
  68. }
RAW Paste Data