-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
153 changed files
with
4,173 additions
and
1,594 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
cardshifter-api/src/main/java/com/cardshifter/api/CardshifterConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.cardshifter.api; | ||
|
||
public class CardshifterConstants { | ||
|
||
public static final String VANILLA = "VANILLA"; | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...cardshifter/server/abstr/CardMessage.java → ...om/cardshifter/api/abstr/CardMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.cardshifter.server.abstr; | ||
package com.cardshifter.api.abstr; | ||
|
||
|
||
|
||
|
4 changes: 2 additions & 2 deletions
4
...dshifter/server/abstr/RequestMessage.java → ...cardshifter/api/abstr/RequestMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
cardshifter-api/src/main/java/com/cardshifter/api/both/ChatMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.cardshifter.api.both; | ||
|
||
import com.cardshifter.api.messages.Message; | ||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
|
||
|
||
public class ChatMessage extends Message { | ||
|
||
private final int chatId; | ||
private final String message; | ||
private final String from; | ||
|
||
@JsonCreator | ||
ChatMessage() { | ||
this(0, "", ""); | ||
} | ||
|
||
public ChatMessage(int chatId, String from, String message) { | ||
super("chat"); | ||
this.chatId = chatId; | ||
this.from = from; | ||
this.message = message; | ||
} | ||
|
||
public int getChatId() { | ||
return chatId; | ||
} | ||
|
||
public String getFrom() { | ||
return from; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ChatMessage [chatId=" + chatId + ", message=" + message | ||
+ ", from=" + from + "]"; | ||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
cardshifter-api/src/main/java/com/cardshifter/api/both/InviteRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.cardshifter.api.both; | ||
|
||
import com.cardshifter.api.messages.Message; | ||
|
||
public class InviteRequest extends Message { | ||
|
||
private final int id; | ||
private final String name; | ||
|
||
InviteRequest() { | ||
this(0, ""); | ||
} | ||
public InviteRequest(int id, String name) { | ||
super("inviteRequest"); | ||
this.id = id; | ||
this.name = name; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
cardshifter-api/src/main/java/com/cardshifter/api/both/InviteResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.cardshifter.api.both; | ||
|
||
import com.cardshifter.api.messages.Message; | ||
|
||
public class InviteResponse extends Message { | ||
|
||
private final int inviteId; | ||
private final boolean accepted; | ||
|
||
InviteResponse() { | ||
this(0, false); | ||
} | ||
|
||
public InviteResponse(int inviteId, boolean accepted) { | ||
super("inviteResponse"); | ||
this.inviteId = inviteId; | ||
this.accepted = accepted; | ||
} | ||
|
||
public int getInviteId() { | ||
return inviteId; | ||
} | ||
|
||
public boolean isAccepted() { | ||
return accepted; | ||
} | ||
|
||
} |
14 changes: 5 additions & 9 deletions
14
...shifter/server/incoming/LoginMessage.java → ...ardshifter/api/incoming/LoginMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,22 @@ | ||
package com.cardshifter.server.incoming; | ||
package com.cardshifter.api.incoming; | ||
|
||
import com.cardshifter.server.messages.Message; | ||
import com.cardshifter.api.messages.Message; | ||
|
||
public class LoginMessage extends Message { | ||
|
||
private String username; | ||
private final String username; | ||
|
||
LoginMessage() { | ||
super("login"); | ||
this(""); | ||
} | ||
|
||
public LoginMessage(String username) { | ||
this(); | ||
super("login"); | ||
this.username = username; | ||
} | ||
|
||
public String getUsername() { | ||
return username; | ||
} | ||
|
||
public void setUsername(String username) { | ||
this.username = username; | ||
} | ||
|
||
} |
4 changes: 2 additions & 2 deletions
4
...erver/incoming/RequestTargetsMessage.java → ...r/api/incoming/RequestTargetsMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
cardshifter-api/src/main/java/com/cardshifter/api/incoming/ServerQueryMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.cardshifter.api.incoming; | ||
|
||
import com.cardshifter.api.messages.Message; | ||
|
||
public class ServerQueryMessage extends Message { | ||
|
||
public enum Request { | ||
USERS; | ||
} | ||
|
||
private final Request request; | ||
|
||
ServerQueryMessage() { | ||
this(Request.USERS); | ||
} | ||
public ServerQueryMessage(Request request) { | ||
super("query"); | ||
this.request = request; | ||
} | ||
|
||
public Request getRequest() { | ||
return request; | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
cardshifter-api/src/main/java/com/cardshifter/api/incoming/StartGameRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.cardshifter.api.incoming; | ||
|
||
import com.cardshifter.api.messages.Message; | ||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
|
||
public class StartGameRequest extends Message { | ||
|
||
private final int opponent; | ||
private final String gameType; | ||
|
||
@JsonCreator | ||
StartGameRequest() { | ||
this(-1, ""); | ||
} | ||
|
||
public StartGameRequest(int opponent, String gameType) { | ||
super("startgame"); | ||
this.opponent = opponent; | ||
this.gameType = gameType; | ||
} | ||
|
||
public int getOpponent() { | ||
return opponent; | ||
} | ||
|
||
public String getGameType() { | ||
return gameType; | ||
} | ||
|
||
} |
54 changes: 54 additions & 0 deletions
54
cardshifter-api/src/main/java/com/cardshifter/api/incoming/UseAbilityMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.cardshifter.api.incoming; | ||
|
||
import java.util.Arrays; | ||
|
||
import com.cardshifter.api.abstr.CardMessage; | ||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
|
||
|
||
public class UseAbilityMessage extends CardMessage { | ||
|
||
private final int id; | ||
private final String action; | ||
private final int gameId; | ||
private final int[] targets; | ||
|
||
@JsonCreator | ||
UseAbilityMessage() { | ||
this(0, 0, "", new int[]{}); | ||
} | ||
public UseAbilityMessage(int gameId, int id, String action, int[] targets) { | ||
super("use"); | ||
this.id = id; | ||
this.action = action; | ||
this.gameId = gameId; | ||
this.targets = Arrays.copyOf(targets, targets.length); | ||
} | ||
|
||
public UseAbilityMessage(int gameid, int entity, String action, int target) { | ||
this(gameid, entity, action, new int[]{ target }); | ||
} | ||
|
||
public String getAction() { | ||
return action; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public int getGameId() { | ||
return gameId; | ||
} | ||
|
||
public int[] getTargets() { | ||
return Arrays.copyOf(targets, targets.length); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "UseAbilityMessage [id=" + id + ", action=" + action | ||
+ ", gameId=" + gameId + ", targets=" + Arrays.toString(targets) + "]"; | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
.../cardshifter/server/messages/Message.java → ...com/cardshifter/api/messages/Message.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.