mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-23 18:45:31 +01:00
commit
897127976a
@ -1,5 +1,6 @@
|
||||
package com.Acrobot.ChestShop.Listeners.Player;
|
||||
|
||||
import com.Acrobot.Breeze.Utils.NameUtil;
|
||||
import com.Acrobot.ChestShop.ChestShop;
|
||||
import com.Acrobot.ChestShop.UUIDs.NameManager;
|
||||
import com.Acrobot.ChestShop.UUIDs.PlayerDTO;
|
||||
@ -9,6 +10,8 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Acrobot
|
||||
*/
|
||||
@ -21,6 +24,15 @@ public class PlayerConnect implements Listener {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(ChestShop.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String playerName = NameUtil.stripUsername(playerDTO.getName());
|
||||
UUID uuid = NameManager.getUUID(playerName);
|
||||
|
||||
if (uuid != null && !playerDTO.getUniqueId().equals(uuid)) {
|
||||
Bukkit.getPlayer(playerDTO.getUniqueId()).kickPlayer("[ChestShop]" +
|
||||
"Unfortunately, this username was already used by " +
|
||||
"another player.");
|
||||
}
|
||||
|
||||
NameManager.storeUsername(playerDTO);
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user