mirror of
https://github.com/tanyaofei/minecraft-fakeplayer.git
synced 2025-09-14 11:16:46 +08:00
Redesign UUID generate strategy
This commit is contained in:
parent
19af3f9692
commit
d60177c0c3
@ -9,6 +9,7 @@ import io.github.hello09x.fakeplayer.core.Main;
|
||||
import io.github.hello09x.fakeplayer.core.config.Config;
|
||||
import io.github.hello09x.fakeplayer.core.constant.MetadataKeys;
|
||||
import io.github.hello09x.fakeplayer.core.manager.FakeplayerManager;
|
||||
import io.github.hello09x.fakeplayer.core.repository.FakePlayerProfileRepository;
|
||||
import io.github.hello09x.fakeplayer.core.repository.UsedIdRepository;
|
||||
import io.github.hello09x.fakeplayer.core.util.InternalAddressGenerator;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -39,12 +40,14 @@ public class FakeplayerListener implements Listener {
|
||||
|
||||
private final FakeplayerManager manager;
|
||||
private final UsedIdRepository usedIdRepository;
|
||||
private final FakePlayerProfileRepository profileRepository;
|
||||
private final Config config;
|
||||
|
||||
@Inject
|
||||
public FakeplayerListener(FakeplayerManager manager, UsedIdRepository usedIdRepository, Config config) {
|
||||
public FakeplayerListener(FakeplayerManager manager, UsedIdRepository usedIdRepository, FakePlayerProfileRepository profileRepository, Config config) {
|
||||
this.manager = manager;
|
||||
this.usedIdRepository = usedIdRepository;
|
||||
this.profileRepository = profileRepository;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@ -59,7 +62,7 @@ public class FakeplayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (usedIdRepository.contains(player.getUniqueId())) {
|
||||
if (usedIdRepository.contains(player.getUniqueId()) || profileRepository.existsByUUID(player.getUniqueId())) {
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, textOfChildren(
|
||||
translatable("fakeplayer.listener.login.deny-used-uuid", RED),
|
||||
newline(),
|
||||
|
@ -33,7 +33,7 @@ public class FakePlayerProfileRepository {
|
||||
|
||||
public boolean existsByUUID(@NotNull UUID uuid) {
|
||||
var sql = "SELECT EXISTS(SELECT 1 FROM fake_player_profile WHERE uuid = ?)";
|
||||
return Boolean.TRUE.equals(jdbc.queryForObject(sql, new BooleanRowMapper()));
|
||||
return Boolean.TRUE.equals(jdbc.queryForObject(sql, new BooleanRowMapper(), uuid.toString()));
|
||||
}
|
||||
|
||||
public @Nullable UUID selectUUIDByName(@NotNull String name) {
|
||||
|
Loading…
Reference in New Issue
Block a user