mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
Merge pull request #2493 from spjspj/master
Add confirmation dialog to server.console
This commit is contained in:
commit
08b2708f3d
1 changed files with 25 additions and 12 deletions
|
|
@ -32,6 +32,7 @@ import java.lang.reflect.UndeclaredThrowableException;
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
import mage.MageException;
|
import mage.MageException;
|
||||||
import mage.cards.decks.DeckCardLists;
|
import mage.cards.decks.DeckCardLists;
|
||||||
import mage.cards.decks.InvalidDeckException;
|
import mage.cards.decks.InvalidDeckException;
|
||||||
|
|
@ -1432,10 +1433,13 @@ public class SessionImpl implements Session {
|
||||||
@Override
|
@Override
|
||||||
public boolean endUserSession(String userSessionId) {
|
public boolean endUserSession(String userSessionId) {
|
||||||
try {
|
try {
|
||||||
|
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to mute userSessionId " + userSessionId + "?", "WARNING",
|
||||||
|
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
server.endUserSession(sessionId, userSessionId);
|
server.endUserSession(sessionId, userSessionId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (MageException ex) {
|
} catch (MageException ex) {
|
||||||
handleMageException(ex);
|
handleMageException(ex);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
|
@ -1447,10 +1451,13 @@ public class SessionImpl implements Session {
|
||||||
@Override
|
@Override
|
||||||
public boolean muteUserChat(String userName, long durationMinutes) {
|
public boolean muteUserChat(String userName, long durationMinutes) {
|
||||||
try {
|
try {
|
||||||
|
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to mute user " + userName + " for " + durationMinutes + " minutes?", "WARNING",
|
||||||
|
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
server.muteUser(sessionId, userName, durationMinutes);
|
server.muteUser(sessionId, userName, durationMinutes);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (MageException ex) {
|
} catch (MageException ex) {
|
||||||
handleMageException(ex);
|
handleMageException(ex);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
|
@ -1462,10 +1469,13 @@ public class SessionImpl implements Session {
|
||||||
@Override
|
@Override
|
||||||
public boolean toggleActivation(String userName) {
|
public boolean toggleActivation(String userName) {
|
||||||
try {
|
try {
|
||||||
|
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to activate/deactivate user: " + userName + " for?", "WARNING",
|
||||||
|
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
server.toggleActivation(sessionId, userName);
|
server.toggleActivation(sessionId, userName);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (MageException ex) {
|
} catch (MageException ex) {
|
||||||
handleMageException(ex);
|
handleMageException(ex);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
|
@ -1477,10 +1487,13 @@ public class SessionImpl implements Session {
|
||||||
@Override
|
@Override
|
||||||
public boolean lockUser(String userName, long durationMinute) {
|
public boolean lockUser(String userName, long durationMinute) {
|
||||||
try {
|
try {
|
||||||
|
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to lock user: " + userName + " for " + durationMinute + " minutes?", "WARNING",
|
||||||
|
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
server.lockUser(sessionId, userName, durationMinute);
|
server.lockUser(sessionId, userName, durationMinute);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (MageException ex) {
|
} catch (MageException ex) {
|
||||||
handleMageException(ex);
|
handleMageException(ex);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue