Guest User

Untitled

a guest
Jun 18th, 2013
73
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package net.ixios.mc;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.OfflinePlayer;
  5. import org.bukkit.command.Command;
  6. import org.bukkit.command.CommandSender;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.plugin.java.JavaPlugin;
  9. import org.bukkit.scoreboard.Scoreboard;
  10. import org.bukkit.scoreboard.ScoreboardManager;
  11. import org.bukkit.scoreboard.Team;
  12.  
  13.  
  14. public class Main extends JavaPlugin{
  15. public ScoreboardManager manager;
  16. public Scoreboard board;
  17. public Team redTeam;
  18. public Team blueTeam;
  19.  
  20. public void onEnable(){
  21. manager = Bukkit.getScoreboardManager();
  22. board = manager.getNewScoreboard();
  23. redTeam = board.registerNewTeam("red");
  24. blueTeam = board.registerNewTeam("blue");
  25. redTeam.setAllowFriendlyFire(true);
  26. blueTeam.setAllowFriendlyFire(true);
  27. redTeam.setCanSeeFriendlyInvisibles(true);
  28. blueTeam.setCanSeeFriendlyInvisibles(true);
  29. redTeam.setDisplayName("Red");
  30. blueTeam.setDisplayName("Blue");
  31. }
  32. public boolean onCommand(CommandSender sender, Command cmd, String label,
  33. String[] args) {
  34. if(cmd.getName().equalsIgnoreCase("add")){
  35. Player p = (Player)sender;
  36. p.setScoreboard(board);
  37. redTeam.addPlayer(p);
  38. for(OfflinePlayer op : redTeam.getPlayers()){
  39. String s = op.getName();
  40. p.sendMessage(s);
  41. }
  42. }
  43. return false;
  44. }
  45. }
RAW Paste Data