Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2015
1,791
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. static ArrayList<String> DisplayName = new ArrayList<String>();
  2. static ArrayList<String> CoolText = new ArrayList<String>();
  3.  
  4.  
  5. @EventHandler
  6. public void JoinEvent(PlayerJoinEvent e) {
  7.  
  8. final Player player = e.getPlayer();
  9.  
  10. //IMPORTANT, this is what starts it from the beginning. Why this isn't in the run event is because when a player disconnects and when they join back it starts from the beginning.
  11. DisplayName.clear();
  12. DisplayName.add("1");
  13.  
  14. CoolText.clear();
  15. CoolText.add("1");
  16.  
  17. //Puting the scoreboard allows it to update at the same time as the changing text does.
  18. //Put all the variables in the run so it can update.
  19. BukkitScheduler Scheduler = Bukkit.getServer().getScheduler();
  20. Scheduler.scheduleSyncRepeatingTask(this, new Runnable() {
  21. @Override
  22. public void run() {
  23. //This is how you get the players group with pex.
  24. // Example: final String group = PermissionsEx.getUser(player).getGroups()[0].getName();
  25.  
  26. final ScoreboardManager manager = Bukkit.getScoreboardManager();
  27. final org.bukkit.scoreboard.Scoreboard board = manager.getNewScoreboard();
  28.  
  29. final Objective objective = board.registerNewObjective("Scoreboard", "dummy");
  30. objective.setDisplaySlot(DisplaySlot.SIDEBAR);
  31. //Set up your scoreboard
  32. //If you want the text to be changing, do NOT add it here, add it below around Changing Text
  33. Score spacer = objective.getScore(" ");
  34. spacer.setScore(15);
  35.  
  36.  
  37. Score player2 = objective.getScore("§c§lYour username§f:");
  38. player2.setScore(14);
  39.  
  40. Score playerr = objective.getScore("§f§l"+player.getName());
  41. playerr.setScore(13);
  42.  
  43. Score spacer3 = objective.getScore("§b ");
  44. spacer3.setScore(12);
  45.  
  46. //
  47.  
  48. Score spacer4 = objective.getScore("§c ");
  49. spacer4.setScore(10);
  50.  
  51. //Changing Text
  52. //Changing Text
  53. //Changing Text
  54. //Changing Text
  55. //Changing Text
  56. //Changing Text
  57.  
  58. Integer i = DisplayName.size();
  59. //Beginning it starts here and goes on through it until i == 3
  60. if(i == 1) {
  61. objective.setDisplayName("§aThis");
  62. DisplayName.add("A");
  63. }
  64. if(i == 2) {
  65. objective.setDisplayName("§bIs");
  66. DisplayName.add("B");
  67. }
  68. if(i == 3) {
  69. objective.setDisplayName("§cChanging!");
  70. DisplayName.add("C");
  71. }
  72. if(i == 3) {
  73. //Make sure you have this, this starts it over from the beginning.
  74. DisplayName.clear();
  75. DisplayName.add("1");
  76. }
  77.  
  78. Integer ct = CoolText.size();
  79. //
  80. if(ct == 1) {
  81. Score ctt = objective.getScore("§cThis");
  82. ctt.setScore(11);
  83. CoolText.add("A");
  84. }
  85. if(ct == 2) {
  86. Score ctt = objective.getScore("§bIs");
  87. ctt.setScore(11);
  88. CoolText.add("B");
  89. }
  90. if(ct == 3) {
  91. Score ctt = objective.getScore("§cAlso");
  92. ctt.setScore(11);
  93. CoolText.add("C");
  94. }
  95. if(ct == 4) {
  96. Score ctt = objective.getScore("§eChanging!");
  97. ctt.setScore(11);
  98. CoolText.add("D");
  99. }
  100. if(ct == 4) {
  101. CoolText.clear();
  102. CoolText.add("1");
  103. }
  104. player.setScoreboard(board);
  105. }
  106. //1Second = 20ticks, update time is set every 1 second.
  107. }, 0, 20);
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement