Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.86 KB | None | 0 0
  1. package net.thecobix.openwsk.util;
  2.  
  3. import java.util.ArrayList;
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.entity.Player;
  7.  
  8. import de.zerostepz.arcademod.communiction.messages.ArcadePlayWSFightEvent;
  9. import de.zerostepz.arcademod.communiction.messages.ArcadePlayWSFightEvent.EventType;
  10. import de.zerostepz.gamod.comunication.ArcadeComunicator.ArcadePhase;
  11. import de.zerostepz.gamod.comunication.ArcadeMessage;
  12. import de.zerostepz.gamod.comunication.ComunicationAPI;
  13. import de.zerostepz.gamod.comunication.MessageCallback;
  14. import de.zerostepz.gamod.comunication.ResponsibleArcadeMessage;
  15. import net.thecobix.openwsk.team.PlayerRole;
  16. import net.thecobix.openwsk.team.Team;
  17. import net.thecobix.openwsk.team.TeamPlayer;
  18.  
  19. public class ArcadeModUtil {
  20.  
  21.     public static MessageCallback<ResponsibleArcadeMessage> sendMessage(Player p, ArcadeMessage message) {
  22.     if(ComunicationAPI.getInstance().getComunicator().isUsingArcadeMod(p) && ComunicationAPI.getInstance().getComunicator().getPhase(p) == ArcadePhase.PLAY) {
  23.         return ComunicationAPI.getInstance().getComunicator().sendMessage(p, message);
  24.     }
  25.     return null;
  26.     }
  27.    
  28.     public static void resetAll() {
  29.     for(Player p : Bukkit.getOnlinePlayers()) {
  30.         sendMessage(p, new ArcadePlayWSFightEvent(EventType.RESET_ALL, 0));
  31.     }
  32.     }
  33.    
  34.     public static void updateTeamScoreboard(Team t) {
  35.     ArrayList<String> out = new ArrayList<>();
  36.     for(TeamPlayer tp : t.getTeamMembers()) {
  37.         out.add(tp.getPlayerName()+";"+PlayerRole.getLocalizedName(tp.getRole()));
  38.     }
  39.     for(TeamPlayer tp : t.getTeamMembers()) {
  40.         Player p = Bukkit.getPlayerExact(tp.getPlayerName());
  41.         if(p != null) {
  42.         sendMessage(p, new ArcadePlayWSFightEvent(EventType.RESET_PLAYERROLES, 0));
  43.         for(String d : out) {
  44.             sendMessage(p, new ArcadePlayWSFightEvent(EventType.UPDATE_PLAYER_ROLE, d));
  45.         }
  46.         }
  47.     }
  48.     }
  49.    
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement