fix: make findalts use the ip from the current player list first but if not found then use the one from the database
This commit is contained in:
@@ -1 +1 @@
|
||||
3196
|
||||
3197
|
||||
@@ -8,6 +8,7 @@ import me.chayapak1.chomens_bot.command.CommandContext;
|
||||
import me.chayapak1.chomens_bot.command.CommandException;
|
||||
import me.chayapak1.chomens_bot.command.TrustLevel;
|
||||
import me.chayapak1.chomens_bot.data.chat.ChatPacketType;
|
||||
import me.chayapak1.chomens_bot.data.player.PlayerEntry;
|
||||
import me.chayapak1.chomens_bot.plugins.DatabasePlugin;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
@@ -49,7 +50,12 @@ public class FindAltsCommand extends Command {
|
||||
final String player = context.getString(true, true);
|
||||
|
||||
DatabasePlugin.EXECUTOR_SERVICE.submit(() -> {
|
||||
final String ipFromUsername = bot.playersDatabase.getPlayerIP(player);
|
||||
final PlayerEntry playerInTheServer = bot.players.getEntry(player);
|
||||
|
||||
final String ipFromUsername;
|
||||
|
||||
if (playerInTheServer == null || playerInTheServer.ip == null) ipFromUsername = bot.playersDatabase.getPlayerIP(player);
|
||||
else ipFromUsername = playerInTheServer.ip;
|
||||
|
||||
if (ipFromUsername == null) {
|
||||
context.sendOutput(handle(bot, player, player, allServer));
|
||||
|
||||
Reference in New Issue
Block a user