Pull upstream changes into fork branch (#41)
* v92.7 changes * v92.9 changes Co-authored-by: Jgunishka <53265225+Jgunishka@users.noreply.github.com>
This commit is contained in:
parent
99a4ca29b8
commit
36f600fe1a
@ -202,6 +202,11 @@ public class GameChatAction implements V086Action, V086GameEventHandler
|
||||
user1.getGame().announce("User not found!", user1);
|
||||
return;
|
||||
}
|
||||
|
||||
if(user.getGame() != user1.getGame()) {
|
||||
user1.getGame().announce("User not in this game!", user1);
|
||||
return;
|
||||
}
|
||||
|
||||
if(user == clientHandler.getUser()){
|
||||
user1.getGame().announce("You can't private message yourself!", user1);
|
||||
@ -245,11 +250,11 @@ public class GameChatAction implements V086Action, V086GameEventHandler
|
||||
|
||||
//user1.getServer().announce("TO: <" + user.getName() + ">(" + user.getID() + ") <" + clientHandler.getUser().getName() + "> (" + clientHandler.getUser().getID() + "): " + m, false, user1);
|
||||
//user.getServer().announce("<" + clientHandler.getUser().getName() + "> (" + clientHandler.getUser().getID() + "): " + m, false, user);
|
||||
if(user1.getGame() != null && user1.getGame() == user.getGame()){
|
||||
if(user1.getGame() != null){
|
||||
user1.getGame().announce("TO: <" + user.getName() + ">(" + user.getID() + ") <" + clientHandler.getUser().getName() + "> (" + clientHandler.getUser().getID() + "): " + m, user1);
|
||||
}
|
||||
|
||||
if(user.getGame() != null && user.getGame() == user1.getGame()){
|
||||
if(user.getGame() != null){
|
||||
user.getGame().announce("<" + clientHandler.getUser().getName() + "> (" + clientHandler.getUser().getID() + "): " + m, user);
|
||||
}
|
||||
return;
|
||||
@ -272,6 +277,11 @@ public class GameChatAction implements V086Action, V086GameEventHandler
|
||||
user1.getGame().announce("User not found!", user1);
|
||||
return;
|
||||
}
|
||||
|
||||
if(user.getGame() != user1.getGame()) {
|
||||
user1.getGame().announce("User not in this game!", user1);
|
||||
return;
|
||||
}
|
||||
|
||||
if(user == clientHandler.getUser()){
|
||||
user1.getGame().announce("You can't private message yourself!", user1);
|
||||
@ -313,11 +323,11 @@ public class GameChatAction implements V086Action, V086GameEventHandler
|
||||
//user1.getServer().announce("TO: <" + user.getName() + ">(" + user.getID() + ") <" + clientHandler.getUser().getName() + "> (" + clientHandler.getUser().getID() + "): " + m, false, user1);
|
||||
//user.getServer().announce("<" + clientHandler.getUser().getName() + "> (" + clientHandler.getUser().getID() + "): " + m, false, user);
|
||||
|
||||
if(user1.getGame() != null && user1.getGame() == user.getGame()){
|
||||
if(user1.getGame() != null){
|
||||
user1.getGame().announce("TO: <" + user.getName() + ">(" + user.getID() + ") <" + clientHandler.getUser().getName() + "> (" + clientHandler.getUser().getID() + "): " + m, user1);
|
||||
}
|
||||
|
||||
if(user.getGame() != null && user.getGame() == user1.getGame()){
|
||||
if(user.getGame() != null){
|
||||
user.getGame().announce("<" + clientHandler.getUser().getName() + "> (" + clientHandler.getUser().getID() + "): " + m, user);
|
||||
}
|
||||
return;
|
||||
|
@ -148,6 +148,7 @@ public class GameOwnerCommandAction implements V086Action
|
||||
else
|
||||
{
|
||||
log.warn("GameOwner Command Denied: Not game owner: " + game + ": " + user + ": " + chat); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
game.announce("GameOwner Command Error: You are not an owner!", user);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public abstract class Chat extends V086Message
|
||||
public int getBodyLength()
|
||||
{
|
||||
//return (charset.encode(userName).remaining() + charset.encode(message).remaining() + 2);
|
||||
return (userName.length() + message.length() + 2);
|
||||
return (getNumBytes(userName) + getNumBytes(message) + 2);
|
||||
}
|
||||
|
||||
public void writeBodyTo(ByteBuffer buffer)
|
||||
|
@ -65,7 +65,7 @@ public class ConnectionRejected extends V086Message
|
||||
public int getBodyLength()
|
||||
{
|
||||
//return (charset.encode(userName).remaining() + charset.encode(message).remaining() + 4);
|
||||
return (userName.length() + message.length() + 4);
|
||||
return (getNumBytes(userName) + getNumBytes(message) + 4);
|
||||
}
|
||||
|
||||
public void writeBodyTo(ByteBuffer buffer)
|
||||
|
@ -72,7 +72,7 @@ public abstract class CreateGame extends V086Message
|
||||
public int getBodyLength()
|
||||
{
|
||||
//return (charset.encode(userName).remaining() + charset.encode(romName).remaining() + charset.encode(clientType).remaining() + 7);
|
||||
return (userName.length() + romName.length() + clientType.length() + 7);
|
||||
return (getNumBytes(userName) + getNumBytes(romName) + getNumBytes(clientType) + 7);
|
||||
}
|
||||
|
||||
public void writeBodyTo(ByteBuffer buffer)
|
||||
|
@ -42,7 +42,7 @@ public abstract class GameChat extends V086Message
|
||||
public int getBodyLength()
|
||||
{
|
||||
//return (charset.encode(userName).remaining() + charset.encode(message).remaining() + 2);
|
||||
return (userName.length() + message.length() + 2);
|
||||
return (getNumBytes(userName) + getNumBytes(message) + 2);
|
||||
}
|
||||
|
||||
public void writeBodyTo(ByteBuffer buffer)
|
||||
|
@ -55,7 +55,7 @@ public class InformationMessage extends V086Message
|
||||
public int getBodyLength()
|
||||
{
|
||||
//return (charset.encode(source).remaining() + charset.encode(message).remaining() + 2);
|
||||
return (source.length() + message.length() + 2);
|
||||
return (getNumBytes(source) + getNumBytes(message) + 2);
|
||||
}
|
||||
|
||||
public void writeBodyTo(ByteBuffer buffer)
|
||||
|
@ -82,7 +82,7 @@ public abstract class JoinGame extends V086Message
|
||||
public int getBodyLength()
|
||||
{
|
||||
//return (charset.encode(userName).remaining() + 13);
|
||||
return (userName.length() + 13);
|
||||
return (getNumBytes(userName) + 13);
|
||||
}
|
||||
|
||||
public void writeBodyTo(ByteBuffer buffer)
|
||||
|
@ -48,7 +48,7 @@ public abstract class PlayerDrop extends V086Message
|
||||
public int getBodyLength()
|
||||
{
|
||||
//return (charset.encode(userName).remaining() + 2);
|
||||
return (userName.length() + 2);
|
||||
return (getNumBytes(userName) + 2);
|
||||
}
|
||||
|
||||
public void writeBodyTo(ByteBuffer buffer)
|
||||
|
@ -165,7 +165,7 @@ public class PlayerInformation extends V086Message
|
||||
public int getLength()
|
||||
{
|
||||
//return (charset.encode(userName).remaining() + 2);
|
||||
return (userName.length() + 8);
|
||||
return (getNumBytes(userName) + 8);
|
||||
}
|
||||
|
||||
public void writeTo(ByteBuffer buffer)
|
||||
|
@ -55,7 +55,7 @@ public abstract class Quit extends V086Message
|
||||
public int getBodyLength()
|
||||
{
|
||||
//return (charset.encode(userName).remaining() + charset.encode(message).remaining() + 4);
|
||||
return (userName.length() + message.length() + 4);
|
||||
return (getNumBytes(userName) + getNumBytes(message) + 4);
|
||||
}
|
||||
|
||||
public void writeBodyTo(ByteBuffer buffer)
|
||||
|
@ -43,7 +43,7 @@ public abstract class QuitGame extends V086Message
|
||||
public int getBodyLength()
|
||||
{
|
||||
//return (charset.encode(userName).remaining() + 3);
|
||||
return (userName.length() + 3);
|
||||
return (getNumBytes(userName) + 3);
|
||||
}
|
||||
|
||||
public void writeBodyTo(ByteBuffer buffer)
|
||||
|
@ -233,7 +233,7 @@ public class ServerStatus extends V086Message
|
||||
public int getLength()
|
||||
{
|
||||
//return (charset.encode(userName).remaining() + 9);
|
||||
return (userName.length() + 9);
|
||||
return (getNumBytes(userName) + 9);
|
||||
}
|
||||
|
||||
public void writeTo(ByteBuffer buffer)
|
||||
@ -318,7 +318,7 @@ public class ServerStatus extends V086Message
|
||||
public int getLength()
|
||||
{
|
||||
//return (charset.encode(romName).remaining() + 1 + 4 + charset.encode(clientType).remaining() + 1 + charset.encode(userName).remaining() + 1 + charset.encode(players).remaining() + 1 + 1);
|
||||
return (romName.length() + 1 + 4 + clientType.length() + 1 + userName.length() + 1 + players.length() + 1 + 1);
|
||||
return (getNumBytes(romName) + 1 + 4 + getNumBytes(clientType) + 1 + getNumBytes(userName) + 1 + getNumBytes(players) + 1 + 1);
|
||||
}
|
||||
|
||||
public void writeTo(ByteBuffer buffer)
|
||||
|
@ -40,7 +40,7 @@ public class UserInformation extends V086Message
|
||||
public int getBodyLength()
|
||||
{
|
||||
//return (charset.encode(userName).remaining() + charset.encode(clientType).remaining() + 3);
|
||||
return (userName.length() + clientType.length() + 3);
|
||||
return (getNumBytes(userName) + getNumBytes(clientType) + 3);
|
||||
}
|
||||
|
||||
public String getUserName()
|
||||
|
@ -75,7 +75,7 @@ public class UserJoined extends V086Message
|
||||
public int getBodyLength()
|
||||
{
|
||||
//return (charset.encode(userName).remaining() + 8);
|
||||
return (userName.length() + 8);
|
||||
return (getNumBytes(userName) + 8);
|
||||
}
|
||||
|
||||
public void writeBodyTo(ByteBuffer buffer)
|
||||
|
@ -39,6 +39,12 @@ public abstract class V086Message extends ByteBufferMessage
|
||||
return (getBodyLength() + 1);
|
||||
//return (getBodyLength() + 5);
|
||||
}
|
||||
|
||||
/** Gets the number of bytes to represent the string in the charset defined in emulinker.cfg **/
|
||||
protected static int getNumBytes(String s)
|
||||
{
|
||||
return s.getBytes(charset).length;
|
||||
}
|
||||
|
||||
public abstract int getBodyLength();
|
||||
|
||||
|
@ -535,6 +535,12 @@ public final class KailleraUserImpl implements KailleraUser, Executable
|
||||
public synchronized KailleraGame createGame(String romName) throws CreateGameException, FloodException
|
||||
{
|
||||
updateLastActivity();
|
||||
|
||||
if (server.getUser(getID()) == null)
|
||||
{
|
||||
log.error(this + " create game failed: User don't exists!");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (getStatus() == KailleraUser.STATUS_PLAYING)
|
||||
{
|
||||
@ -664,8 +670,9 @@ public final class KailleraUserImpl implements KailleraUser, Executable
|
||||
|
||||
if (status == KailleraUser.STATUS_PLAYING)
|
||||
{
|
||||
game.drop(this, playerNumber);
|
||||
//first set STATUS_IDLE and then call game.drop, otherwise if someone quit game whitout drop - game status will not change to STATUS_WAITING
|
||||
setStatus(KailleraUser.STATUS_IDLE);
|
||||
game.drop(this, playerNumber);
|
||||
}
|
||||
|
||||
game.quit(this, playerNumber);
|
||||
|
@ -13,9 +13,9 @@ public final class KailleraServerReleaseInfo implements ReleaseInfo
|
||||
|
||||
private final int majorVersion = 0;
|
||||
private final int minorVersion = 92;
|
||||
private final int buildNumber = 4;
|
||||
private final int buildNumber = 9;
|
||||
|
||||
private final String releaseDate = "05-06-2021";
|
||||
private final String releaseDate = "08-22-2021";
|
||||
private final String licenseInfo = "Usage of this sofware is subject to the terms found in the included license";
|
||||
private final String website = "https://www.EmuLinker.org";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user