Advertisement
skyshiny

TitleShow

Jul 6th, 2014
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. if(cmd.getName().equalsIgnoreCase("titleshow")) {
  2. if(!sender.hasPermission("titleshow.titleshow")) {
  3. sender.sendMessage("§cYou don't have permission to perform this command.");
  4. return true;
  5. }
  6. Player p = null;
  7. try {
  8. p = sender.getServer().getPlayer(args[0]);
  9. } catch(Exception ex) {
  10. sender.sendMessage("§cThe player could not be found.");
  11. return true;
  12. }
  13. if(args.length<2) {
  14. sender.sendMessage("§cWrong syntax: /titleshow <Player> <Message>");
  15. return true;
  16. }
  17. String name = p.getName();
  18. String msg = "";
  19. for(int c = 1; c < args.length; c++) {
  20. msg+=args[c]+" ";
  21. }
  22. String titleCmd = Title.getTitleCommand(name, msg); // Title-class not important, exception is thrown above
  23. getServer().dispatchCommand(getServer().getConsoleSender(), "/title " + name + " title {text:\"\"}");
  24. getServer().dispatchCommand(getServer().getConsoleSender(), titleCmd);
  25. sender.sendMessage("§eThe message has been sent successfully.");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement