forked from Grasscutters/Grasscutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/development' into development
- Loading branch information
Showing
11 changed files
with
190 additions
and
173 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# This can also be replaced with another IP address. | ||
REMOTE_HOST = "localhost" | ||
USE_SSL = True | ||
REMOTE_HOST = "127.0.0.1" | ||
REMOTE_PORT = 443 |
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
33 changes: 33 additions & 0 deletions
33
src/main/java/emu/grasscutter/command/commands/ListCommand.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,33 @@ | ||
package emu.grasscutter.command.commands; | ||
|
||
import emu.grasscutter.Grasscutter; | ||
import emu.grasscutter.command.Command; | ||
import emu.grasscutter.command.CommandHandler; | ||
import emu.grasscutter.game.GenshinPlayer; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Command(label = "list", description = "List online players") | ||
public class ListCommand implements CommandHandler { | ||
|
||
@Override | ||
public void execute(GenshinPlayer sender, List<String> args) { | ||
Map<Integer, GenshinPlayer> playersMap = Grasscutter.getGameServer().getPlayers(); | ||
|
||
CommandHandler.sendMessage(sender, String.format("There are %s player(s) online:", playersMap.size())); | ||
|
||
if (playersMap.size() != 0) { | ||
StringBuilder playerSet = new StringBuilder(); | ||
|
||
for (Map.Entry<Integer, GenshinPlayer> entry : playersMap.entrySet()) { | ||
playerSet.append(entry.getValue().getNickname()); | ||
playerSet.append(", "); | ||
} | ||
|
||
String players = playerSet.toString(); | ||
|
||
CommandHandler.sendMessage(sender, players.substring(0, players.length() - 2)); | ||
} | ||
} | ||
} |
Oops, something went wrong.