Advertisement
lelesape

COMMANDS

Sep 12th, 2019
1,676
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. package lele.SimpleBroadCaster.comandos;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.command.Command;
  6. import org.bukkit.command.CommandExecutor;
  7. import org.bukkit.command.CommandSender;
  8. import org.bukkit.configuration.file.FileConfiguration;
  9. import org.bukkit.entity.Player;
  10.  
  11. import lele.SimpleBroadCaster.SimpleBroadcaster;
  12.  
  13. public class MainCommand implements CommandExecutor{
  14.  
  15. private SimpleBroadcaster plugin;
  16.  
  17. public MainCommand(SimpleBroadcaster plugin){
  18. this.plugin = plugin;
  19. }
  20.  
  21. FileConfiguration messages = plugin.getMessages();
  22. String prefix = "messages.prefix";
  23.  
  24.  
  25. public boolean onCommand(CommandSender sender, Command comando, String label, String[] args) {
  26. if(comando.getName().equalsIgnoreCase("sbc")) {
  27. if(!( sender instanceof Player)) {
  28. if(args[0].equalsIgnoreCase("version")) {
  29. Bukkit.getConsoleSender().sendMessage(messages.getString(prefix)+ChatColor.YELLOW+" Plugin version: "+plugin.version);
  30. }else if(args[0].equalsIgnoreCase("reload")){
  31. Bukkit.getConsoleSender().sendMessage(messages.getString(prefix)+ChatColor.YELLOW+" YMLs reloaded");
  32. //how to reload messages and config
  33. }
  34. return true;
  35. }else {
  36. Player jugador = (Player) sender;
  37. jugador.sendMessage("test2");
  38. return true;
  39. }
  40. }
  41.  
  42. return false;
  43. }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement