Skip to content

Commit 2cbe030

Browse files
author
magiclu550
committed
[commit] #1071 fix stop with npe
1 parent b3d611f commit 2cbe030

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

JPLS/src/main/java/cn/jsmod2/api/server/Smod2Server.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,12 @@ public void setMaxPlayers(int maxPlayers) {
132132
}
133133

134134
public List<Player> getPlayers() {
135+
return getPlayers("");
136+
}
137+
138+
public List<Player> getPlayers(String filter){
135139
GetPlayerPacket playerPacket = new GetPlayerPacket();
140+
playerPacket.filter = filter;
136141
return playerPacket.send();
137142
}
138143

JPLS/src/main/java/cn/jsmod2/core/protocol/CommandSendPacket.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package cn.jsmod2.core.protocol;
22

3-
import cn.jsmod2.core.protocol.GetPacket;
4-
import cn.jsmod2.core.protocol.SetPacket;
53
import cn.jsmod2.core.utils.Utils;
64

75
import java.util.List;

JPLS/src/main/java/cn/jsmod2/network/protocol/server/GetPlayerPacket.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ public class GetPlayerPacket extends GetServerPacket {
88

99
public static final int ID = 0x63;
1010

11+
public String filter = "";
12+
1113

1214
public GetPlayerPacket() {
1315
super(ID, Player.class);
@@ -16,6 +18,6 @@ public GetPlayerPacket() {
1618
@Override
1719
@SuppressWarnings("unchecked")
1820
public List<Player> send() {
19-
return (List<Player>)requester.with("field","players").get().getProtocolArray(false);
21+
return (List<Player>)requester.with("field","players").with("filter",filter).get().getProtocolArray(false);
2022
}
2123
}

0 commit comments

Comments
 (0)