Advertisement
Guest User

Untitled

a guest
Feb 17th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  2. Player p = (Player) sender;
  3. if(cmd.getName().equalsIgnoreCase("note")) {
  4. if(args.length == 0) {
  5. sender.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.DARK_RED + "Team" + ChatColor.GOLD + "Elite" + ChatColor.DARK_GRAY + "]" + ChatColor.RED + " Not enough arguments! Correct usage for this command is /note <note>");
  6. } else {
  7. StringBuilder sb = new StringBuilder();
  8. for(int i=0; i<args.length; i++) {
  9. sb.append(args[i]).append(" ");
  10. }
  11. //String note = sb.toString();
  12. Location location = p.getLocation();
  13. signUpdate(location);
  14. }
  15. }
  16. return true;
  17. }
  18.  
  19. @SuppressWarnings("deprecation")
  20. public void signUpdate(Location loc) {
  21. World world = loc.getWorld();
  22. Block block = world.getBlockAt(loc);
  23. if(block.getTypeId() == Material.SIGN_POST.getId() || block.getTypeId() == Material.WALL_SIGN.getId()) {
  24. Sign s = (Sign) block.getState();
  25. s.setLine(0, ChatColor.RED + "" + ChatColor.BOLD + "[NOTE]");
  26. s.update(true);
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement