Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.thecobix.openwsk.util;
- import java.util.ArrayList;
- import org.bukkit.Bukkit;
- import org.bukkit.entity.Player;
- import de.zerostepz.arcademod.communiction.messages.ArcadePlayWSFightEvent;
- import de.zerostepz.arcademod.communiction.messages.ArcadePlayWSFightEvent.EventType;
- import de.zerostepz.gamod.comunication.ArcadeComunicator.ArcadePhase;
- import de.zerostepz.gamod.comunication.ArcadeMessage;
- import de.zerostepz.gamod.comunication.ComunicationAPI;
- import de.zerostepz.gamod.comunication.MessageCallback;
- import de.zerostepz.gamod.comunication.ResponsibleArcadeMessage;
- import net.thecobix.openwsk.team.PlayerRole;
- import net.thecobix.openwsk.team.Team;
- import net.thecobix.openwsk.team.TeamPlayer;
- public class ArcadeModUtil {
- public static MessageCallback<ResponsibleArcadeMessage> sendMessage(Player p, ArcadeMessage message) {
- if(ComunicationAPI.getInstance().getComunicator().isUsingArcadeMod(p) && ComunicationAPI.getInstance().getComunicator().getPhase(p) == ArcadePhase.PLAY) {
- return ComunicationAPI.getInstance().getComunicator().sendMessage(p, message);
- }
- return null;
- }
- public static void resetAll() {
- for(Player p : Bukkit.getOnlinePlayers()) {
- sendMessage(p, new ArcadePlayWSFightEvent(EventType.RESET_ALL, 0));
- }
- }
- public static void updateTeamScoreboard(Team t) {
- ArrayList<String> out = new ArrayList<>();
- for(TeamPlayer tp : t.getTeamMembers()) {
- out.add(tp.getPlayerName()+";"+PlayerRole.getLocalizedName(tp.getRole()));
- }
- for(TeamPlayer tp : t.getTeamMembers()) {
- Player p = Bukkit.getPlayerExact(tp.getPlayerName());
- if(p != null) {
- sendMessage(p, new ArcadePlayWSFightEvent(EventType.RESET_PLAYERROLES, 0));
- for(String d : out) {
- sendMessage(p, new ArcadePlayWSFightEvent(EventType.UPDATE_PLAYER_ROLE, d));
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement