Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6e39e89fd | ||
|
|
7d38d7db15 |
@@ -90,7 +90,17 @@ public class PlayerUtils {
|
||||
profile.write(PLAYER_NAME_KEY, onlinePlayer.getDisplayName());
|
||||
}
|
||||
|
||||
return profile.read(PLAYER_NAME_KEY);
|
||||
String saved = profile.read(PLAYER_NAME_KEY);
|
||||
|
||||
if (saved.equals(PLAYER_NAME_KEY.getDefaultValue())) {
|
||||
String name = player.getName();
|
||||
if (name != null) {
|
||||
profile.write(PLAYER_NAME_KEY, player.getName());
|
||||
return player.getName();
|
||||
}
|
||||
}
|
||||
|
||||
return saved;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,7 @@ class DataListener : Listener {
|
||||
|
||||
@EventHandler
|
||||
fun onJoin(event: PlayerJoinEvent) {
|
||||
(Eco.getHandler().playerProfileHandler as EcoPlayerProfileHandler).unloadPlayer(event.player.uniqueId)
|
||||
(Eco.getHandler().playerProfileHandler as EcoPlayerProfileHandler).unloadPlayerBlocking(event.player.uniqueId)
|
||||
PlayerUtils.updateSavedDisplayName(event.player)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.willfp.eco.core.data.keys.PersistentDataKey
|
||||
import com.willfp.eco.internal.data.EcoPlayerProfile
|
||||
import com.willfp.eco.spigot.EcoSpigotPlugin
|
||||
import org.bukkit.Bukkit
|
||||
import java.util.UUID
|
||||
import java.util.*
|
||||
|
||||
class EcoPlayerProfileHandler(
|
||||
private val plugin: EcoSpigotPlugin
|
||||
@@ -37,6 +37,11 @@ class EcoPlayerProfileHandler(
|
||||
loaded.remove(uuid)
|
||||
}
|
||||
|
||||
fun unloadPlayerBlocking(uuid: UUID) {
|
||||
handler.saveAllBlocking(listOf(uuid))
|
||||
loaded.remove(uuid)
|
||||
}
|
||||
|
||||
override fun savePlayer(uuid: UUID) {
|
||||
handler.savePlayer(uuid)
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
version = 6.13.2
|
||||
version = 6.13.3
|
||||
plugin-name = eco
|
||||
Reference in New Issue
Block a user