// Path: src/main/java/com/github/mmonkey/destinations/persistence/cache/PlayerCache.java
// public class PlayerCache {
// 
//     public static final PlayerCache instance = new PlayerCache();
// 
//     private final Map<Player, PlayerEntity> cache = new ConcurrentHashMap<>();
//     private final Map<Player, ResourceBundle> resourceCache = new ConcurrentHashMap<>();
// 
//     /**
//      * Get the PlayerEntity for this Player from the cache
//      *
//      * @param player Player
//      * @return PlayerEntity
//      */
//     public PlayerEntity get(Player player) {
//         if (!cache.containsKey(player)) {
//             PlayerEntity playerEntity = PlayerUtil.getPlayerEntity(player);
//             cache.put(player, playerEntity);
//         }
//         return cache.get(player);
//     }
// 
//     /**
//      * Set the PlayerEntity for this Player in the cache
//      *
//      * @param player       Player
//      * @param playerEntity PlayerEntity
//      */
//     public void set(Player player, PlayerEntity playerEntity) {
//         cache.put(player, playerEntity);
//     }
// 
//     /**
//      * Get the ResourceBundle for this player from the cache
//      *
//      * @param player Player
//      * @return ResourceBundle
//      */
//     public ResourceBundle getResourceCache(Player player) {
//         if (!resourceCache.containsKey(player)) {
//             ResourceBundle resourceBundle = ResourceBundle.getBundle("lang/messages", player.getLocale());
//             resourceCache.put(player, resourceBundle);
//         }
//         return resourceCache.get(player);
//     }
// 
// }


import com.github.mmonkey.destinations.persistence.cache.PlayerCache;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.format.TextColors;
import java.util.ResourceBundle;
package com.github.mmonkey.destinations.utilities;



public class MessagesUtil {

    /**
     * Get the message associated with this key, for this player's locale
     *
     * @param player Player
     * @param key    String
     * @param args   String.format args
     * @return Text formatting of message
     */
    public static Text get(Player player, String key, Object... args) {
// Path: src/main/java/com/github/mmonkey/destinations/persistence/cache/PlayerCache.java
// public class PlayerCache {
// 
//     public static final PlayerCache instance = new PlayerCache();
// 
//     private final Map<Player, PlayerEntity> cache = new ConcurrentHashMap<>();
//     private final Map<Player, ResourceBundle> resourceCache = new ConcurrentHashMap<>();
// 
//     /**
//      * Get the PlayerEntity for this Player from the cache
//      *
//      * @param player Player
//      * @return PlayerEntity
//      */
//     public PlayerEntity get(Player player) {
//         if (!cache.containsKey(player)) {
//             PlayerEntity playerEntity = PlayerUtil.getPlayerEntity(player);
//             cache.put(player, playerEntity);
//         }
//         return cache.get(player);
//     }
// 
//     /**
//      * Set the PlayerEntity for this Player in the cache
//      *
//      * @param player       Player
//      * @param playerEntity PlayerEntity
//      */
//     public void set(Player player, PlayerEntity playerEntity) {
//         cache.put(player, playerEntity);
//     }
// 
//     /**
//      * Get the ResourceBundle for this player from the cache
//      *
//      * @param player Player
//      * @return ResourceBundle
//      */
//     public ResourceBundle getResourceCache(Player player) {
//         if (!resourceCache.containsKey(player)) {
//             ResourceBundle resourceBundle = ResourceBundle.getBundle("lang/messages", player.getLocale());
//             resourceCache.put(player, resourceBundle);
//         }
//         return resourceCache.get(player);
//     }
// 
// }


// Path: src/main/java/com/github/mmonkey/destinations/utilities/MessagesUtil.java
import com.github.mmonkey.destinations.persistence.cache.PlayerCache;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.format.TextColors;
import java.util.ResourceBundle;

package com.github.mmonkey.destinations.utilities;



public class MessagesUtil {

    /**
     * Get the message associated with this key, for this player's locale
     *
     * @param player Player
     * @param key    String
     * @param args   String.format args
     * @return Text formatting of message
     */
    public static Text get(Player player, String key, Object... args) {
        ResourceBundle messages = PlayerCache.instance.getResourceCache(player);