forked from External/mage
playertype, enum singleton
This commit is contained in:
parent
b19170f34f
commit
211d433ea9
50 changed files with 642 additions and 675 deletions
|
|
@ -27,30 +27,27 @@
|
|||
*/
|
||||
package mage.server.draft;
|
||||
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.game.draft.DraftCube;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.game.draft.DraftCube;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CubeFactory {
|
||||
public enum CubeFactory {
|
||||
|
||||
private static final CubeFactory INSTANCE = new CubeFactory();
|
||||
instance;
|
||||
private static final Logger logger = Logger.getLogger(CubeFactory.class);
|
||||
|
||||
private final Map<String, Class> draftCubes = new LinkedHashMap<>();
|
||||
|
||||
public static CubeFactory getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private CubeFactory() {}
|
||||
|
||||
public DraftCube createDraftCube(String draftCubeName) {
|
||||
|
||||
|
|
|
|||
|
|
@ -28,12 +28,6 @@
|
|||
|
||||
package mage.server.draft;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import mage.MageException;
|
||||
import mage.game.draft.Draft;
|
||||
import mage.game.draft.DraftPlayer;
|
||||
|
|
@ -48,6 +42,13 @@ import mage.server.util.ThreadExecutor;
|
|||
import mage.view.DraftPickView;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -152,7 +153,7 @@ public class DraftController {
|
|||
private synchronized void checkStart() {
|
||||
if (!draft.isStarted() && allJoined()) {
|
||||
draft.setStarted();
|
||||
ThreadExecutor.getInstance().getCallExecutor().execute(this::startDraft);
|
||||
ThreadExecutor.instance.getCallExecutor().execute(this::startDraft);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,14 +28,6 @@
|
|||
|
||||
package mage.server.draft;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import mage.game.draft.Draft;
|
||||
import mage.interfaces.callback.ClientCallback;
|
||||
import mage.server.User;
|
||||
|
|
@ -46,6 +38,14 @@ import mage.view.DraftPickView;
|
|||
import mage.view.DraftView;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
|
@ -60,7 +60,7 @@ public class DraftSession {
|
|||
protected UUID markedCard;
|
||||
|
||||
private ScheduledFuture<?> futureTimeout;
|
||||
protected static final ScheduledExecutorService timeoutExecutor = ThreadExecutor.getInstance().getTimeoutExecutor();
|
||||
protected static final ScheduledExecutorService timeoutExecutor = ThreadExecutor.instance.getTimeoutExecutor();
|
||||
|
||||
public DraftSession(Draft draft, UUID userId, UUID playerId) {
|
||||
this.userId = userId;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue