Advertisement
Guest User

Continue if u want

a guest
Nov 25th, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.21 KB | None | 0 0
  1. public class Main extends JavaPlugin implements Listener {
  2.  
  3.     public void onEnable(){
  4.         loadconfigs();
  5.         getServer().getPluginManager().registerEvents(this, this);
  6.     }
  7.    
  8.     public void onDisable(){
  9.        
  10.     }
  11.    
  12.    
  13.     public void loadconfigs(){
  14.         this.getConfig().addDefault("######Hello#####",1);
  15.         this.getConfig().options().copyDefaults(true);
  16.         this.saveConfig();
  17.     }
  18.    
  19.     @EventHandler
  20.     public void onplayerjoinevent(PlayerJoinEvent e){
  21.         Player p = e.getPlayer();
  22.         p.performCommand(this.getConfig().getString(p.getDisplayName()+".command.waiting"));
  23.         this.getConfig().set(p.getDisplayName()+".command.waiting", "");
  24.     }
  25.    
  26.    
  27.     @SuppressWarnings("deprecation")
  28.     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  29.         String target = args[1];
  30.         Player target2 = sender.getServer().getPlayer(args[1]);
  31.         if(label.equalsIgnoreCase("qc")){
  32.             if(args[0].equalsIgnoreCase("use")){
  33.                 if(target2.hasPlayedBefore() && target2.isOnline()){
  34.                     target2.performCommand(args[2]);
  35.             }else if(label.equalsIgnoreCase("add")){
  36.                 this.getConfig().addDefault(target+".command.waiting", args[2]);
  37.                 this.saveConfig();
  38.                 this.reloadConfig();
  39.             }
  40.             }
  41.         }
  42.         return false;
  43.        
  44.     }
  45.    
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement