mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
* Added some missing static SessionHandler usages.
This commit is contained in:
parent
4990bf7de5
commit
f6ef3db9b9
2 changed files with 43 additions and 34 deletions
|
|
@ -1,6 +1,11 @@
|
|||
package mage.client;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.game.match.MatchOptions;
|
||||
import mage.game.tournament.TournamentOptions;
|
||||
|
|
@ -11,11 +16,6 @@ import mage.remote.Session;
|
|||
import mage.remote.SessionImpl;
|
||||
import mage.view.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by IGOUDT on 15-9-2016.
|
||||
*/
|
||||
|
|
@ -45,7 +45,7 @@ public class SessionHandler {
|
|||
}
|
||||
|
||||
public static boolean connect(Connection connection) {
|
||||
return session.connect(connection);
|
||||
return session.connect(connection);
|
||||
}
|
||||
|
||||
public static boolean stopConnecting() {
|
||||
|
|
@ -61,7 +61,7 @@ public class SessionHandler {
|
|||
}
|
||||
|
||||
public static void quitTournament(UUID tournamentId) {
|
||||
session.quitTournament(tournamentId);
|
||||
session.quitTournament(tournamentId);
|
||||
}
|
||||
|
||||
public static void quitDraft(UUID tournamentId) {
|
||||
|
|
@ -77,7 +77,7 @@ public class SessionHandler {
|
|||
}
|
||||
|
||||
public static void removeTable(UUID roomId, UUID tableId) {
|
||||
session.removeTable(roomId, tableId);
|
||||
session.removeTable(roomId, tableId);
|
||||
}
|
||||
|
||||
public static void stopReplay(UUID gameId) {
|
||||
|
|
@ -85,7 +85,7 @@ public class SessionHandler {
|
|||
}
|
||||
|
||||
public static void sendPlayerUUID(UUID gameId, UUID id) {
|
||||
session.sendPlayerUUID(gameId, id);
|
||||
session.sendPlayerUUID(gameId, id);
|
||||
}
|
||||
|
||||
public static void sendPlayerBoolean(UUID gameId, boolean b) {
|
||||
|
|
@ -101,7 +101,7 @@ public class SessionHandler {
|
|||
}
|
||||
|
||||
public static void sendPlayerInteger(UUID gameId, int data) {
|
||||
session.sendPlayerInteger(gameId, data);
|
||||
session.sendPlayerInteger(gameId, data);
|
||||
}
|
||||
|
||||
public static void sendPlayerString(UUID gameId, String data) {
|
||||
|
|
@ -109,7 +109,7 @@ public class SessionHandler {
|
|||
}
|
||||
|
||||
public static boolean sendFeedback(String title, String type, String message, String email) {
|
||||
return session.sendFeedback(title, type, message, email);
|
||||
return session.sendFeedback(title, type, message, email);
|
||||
}
|
||||
|
||||
public static void swapSeats(UUID roomId, UUID tableId, int row, int targetrow) {
|
||||
|
|
@ -121,11 +121,11 @@ public class SessionHandler {
|
|||
}
|
||||
|
||||
public static void updatePreferencesForServer(UserData userData) {
|
||||
session.updatePreferencesForServer(userData);
|
||||
session.updatePreferencesForServer(userData);
|
||||
}
|
||||
|
||||
public static boolean isTableOwner(UUID roomId, UUID tableId) {
|
||||
return session.isTableOwner(roomId, tableId);
|
||||
return session.isTableOwner(roomId, tableId);
|
||||
}
|
||||
|
||||
public static UUID getTableChatId(UUID tableId) {
|
||||
|
|
@ -133,7 +133,7 @@ public class SessionHandler {
|
|||
}
|
||||
|
||||
public static boolean startTournament(UUID roomId, UUID tableId) {
|
||||
return session.startTournament(roomId, tableId);
|
||||
return session.startTournament(roomId, tableId);
|
||||
}
|
||||
|
||||
public static boolean startMatch(UUID roomId, UUID tableId) {
|
||||
|
|
@ -153,7 +153,7 @@ public class SessionHandler {
|
|||
}
|
||||
|
||||
public static void watchTournamentTable(UUID tableId) {
|
||||
session.watchTournamentTable(tableId);
|
||||
session.watchTournamentTable(tableId);
|
||||
}
|
||||
|
||||
public static boolean joinTournament(UUID tournamentId) {
|
||||
|
|
@ -161,7 +161,7 @@ public class SessionHandler {
|
|||
}
|
||||
|
||||
public static UUID getTournamentChatId(UUID tournamentId) {
|
||||
return session.getTournamentChatId(tournamentId);
|
||||
return session.getTournamentChatId(tournamentId);
|
||||
}
|
||||
|
||||
public static TournamentView getTournament(UUID tournamentId) {
|
||||
|
|
@ -175,7 +175,7 @@ public class SessionHandler {
|
|||
}
|
||||
|
||||
public static String getUserName() {
|
||||
return session.getUserName();
|
||||
return session.getUserName();
|
||||
}
|
||||
|
||||
public static boolean watchGame(UUID gameId) {
|
||||
|
|
@ -195,7 +195,7 @@ public class SessionHandler {
|
|||
}
|
||||
|
||||
public static boolean isTestMode() {
|
||||
return session.isTestMode();
|
||||
return session.isTestMode();
|
||||
}
|
||||
|
||||
public static void cheat(UUID gameId, UUID playerId, DeckCardLists deckCardLists) {
|
||||
|
|
@ -203,7 +203,7 @@ public class SessionHandler {
|
|||
}
|
||||
|
||||
public static String getSessionId() {
|
||||
return session.getSessionId();
|
||||
return session.getSessionId();
|
||||
}
|
||||
|
||||
public static List<TournamentTypeView> getTournamentTypes() {
|
||||
|
|
@ -215,7 +215,7 @@ public class SessionHandler {
|
|||
}
|
||||
|
||||
public static String[] getDeckTypes() {
|
||||
return session.getDeckTypes();
|
||||
return session.getDeckTypes();
|
||||
}
|
||||
|
||||
public static String[] getDraftCubes() {
|
||||
|
|
@ -239,7 +239,7 @@ public class SessionHandler {
|
|||
}
|
||||
|
||||
public static List<GameTypeView> getGameTypes() {
|
||||
return session.getGameTypes();
|
||||
return session.getGameTypes();
|
||||
}
|
||||
|
||||
public static boolean joinDraft(UUID draftId) {
|
||||
|
|
@ -294,7 +294,7 @@ public class SessionHandler {
|
|||
}
|
||||
|
||||
public static List<String> getServerMessages() {
|
||||
return session.getServerMessages();
|
||||
return session.getServerMessages();
|
||||
}
|
||||
|
||||
public static boolean joinChat(UUID chatId) {
|
||||
|
|
@ -302,10 +302,15 @@ public class SessionHandler {
|
|||
}
|
||||
|
||||
public static boolean leaveChat(UUID chatId) {
|
||||
return session.leaveChat(chatId);
|
||||
return session.leaveChat(chatId);
|
||||
}
|
||||
|
||||
public static boolean sendChatMessage(UUID chatId, String text) {
|
||||
return session.sendChatMessage(chatId, text);
|
||||
}
|
||||
|
||||
public static boolean sendPlayerManaType(UUID gameId, UUID playerId, ManaType data) {
|
||||
return session.sendPlayerManaType(gameId, playerId, data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
changedFontGrave = false;
|
||||
}
|
||||
graveLabel.setText(Integer.toString(graveCards));
|
||||
graveLabel.setToolTipText("Card Types: " + qtyCardTypes(player.getGraveyard()));
|
||||
graveLabel.setToolTipText("Card Types: " + qtyCardTypes(player.getGraveyard()));
|
||||
|
||||
int exileCards = player.getExile().size();
|
||||
if (exileCards > 99) {
|
||||
|
|
@ -402,7 +402,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
avatar.setObserver(new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
session.sendPlayerUUID(gameId, playerId);
|
||||
SessionHandler.sendPlayerUUID(gameId, playerId);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -531,7 +531,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
btnPlayer.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
session.sendPlayerUUID(gameId, playerId);
|
||||
SessionHandler.sendPlayerUUID(gameId, playerId);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -847,7 +847,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
private void btnManaActionPerformed(ManaType manaType) {
|
||||
session.sendPlayerManaType(gameId, player.getPlayerId(), manaType);
|
||||
SessionHandler.sendPlayerManaType(gameId, player.getPlayerId(), manaType);
|
||||
}
|
||||
|
||||
private void btnGraveActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
|
|
@ -868,23 +868,27 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
|
||||
private void btnCheatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheatActionPerformed
|
||||
DckDeckImporter deckImporter = new DckDeckImporter();
|
||||
session.cheat(gameId, playerId, deckImporter.importDeck("cheat.dck"));
|
||||
SessionHandler.cheat(gameId, playerId, deckImporter.importDeck("cheat.dck"));
|
||||
}
|
||||
|
||||
public PlayerView getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
private int qtyCardTypes(mage.view.CardsView cardsView){
|
||||
Set<String> cardTypesPresent = new LinkedHashSet<String>() {};
|
||||
for (CardView card : cardsView.values()){
|
||||
private int qtyCardTypes(mage.view.CardsView cardsView) {
|
||||
Set<String> cardTypesPresent = new LinkedHashSet<String>() {
|
||||
};
|
||||
for (CardView card : cardsView.values()) {
|
||||
List<CardType> cardTypes = card.getCardTypes();
|
||||
for (CardType cardType : cardTypes){
|
||||
for (CardType cardType : cardTypes) {
|
||||
cardTypesPresent.add(cardType.toString());
|
||||
}
|
||||
}
|
||||
if (cardTypesPresent.isEmpty()) return 0;
|
||||
else return cardTypesPresent.size();
|
||||
if (cardTypesPresent.isEmpty()) {
|
||||
return 0;
|
||||
} else {
|
||||
return cardTypesPresent.size();
|
||||
}
|
||||
}
|
||||
|
||||
private HoverButton avatar;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue