Java 类org.bukkit.event.player.PlayerLocaleChangeEvent 实例源码

项目:Cardinal-Plus    文件:TeamPicker.java   
@EventHandler
public void onPlayerLocaleChange(PlayerLocaleChangeEvent event) {
    for (ItemStack item : event.getPlayer().getInventory().getContents()) {
        if (item != null) {
            if (item.getType().equals(Material.LEATHER_HELMET)) {
                if (item.hasItemMeta()) {
                    if (item.getItemMeta().hasDisplayName()) {
                        ItemMeta meta = item.getItemMeta();

                        StringBuilder name = new StringBuilder();
                        name.append(ChatColor.GREEN);
                        name.append(ChatColor.BOLD);

                        StringBuilder lore = new StringBuilder();
                        lore.append(ChatColor.DARK_PURPLE);
                        lore.append(new LocalizedChatMessage(ChatConstant.UI_TEAM_JOIN_TIP).getMessage(event.getPlayer().getLocale()));

                        if (item.getItemMeta().getDisplayName().equals(ChatColor.GREEN + "" + ChatColor.BOLD + new LocalizedChatMessage(ChatConstant.UI_TEAM_SELECTION).getMessage(event.getOldLocale()))) {
                            name.append(new LocalizedChatMessage(ChatConstant.UI_TEAM_SELECTION).getMessage(event.getNewLocale()));
                            meta.setDisplayName(name.toString());
                            meta.setLore(Arrays.asList(lore.toString()));
                        } else if (item.getItemMeta().getDisplayName().equals(ChatColor.GREEN + "" + ChatColor.BOLD + new LocalizedChatMessage(ChatConstant.UI_TEAM_CLASS_SELECTION).getMessage(event.getOldLocale()))) {
                            name.append(new LocalizedChatMessage(ChatConstant.UI_TEAM_CLASS_SELECTION).getMessage(event.getNewLocale()));
                            meta.setDisplayName(name.toString());
                            meta.setLore(Arrays.asList(lore.toString()));
                        }
                        item.setItemMeta(meta);
                    }
                }
            }
        }
    }
}
项目:CardinalPGM    文件:TeamPicker.java   
@EventHandler
public void onPlayerLocaleChange(PlayerLocaleChangeEvent event) {
    ItemStack oldItem = getTeamPicker(event.getOldLocale() != null ? event.getOldLocale() : "en_US");
    ItemStack newItem = getTeamPicker(event.getNewLocale());
    for (ItemStack item : event.getPlayer().getInventory().getContents()) {
        if (item != null && item.equals(oldItem)) {
            item.setItemMeta(newItem.getItemMeta());
        }
    }
}
项目:CardinalPGM    文件:SpectatorTools.java   
@EventHandler
public void onPlayerLocaleChange(PlayerLocaleChangeEvent event) {
    ItemStack oldItem = getSpectatorItem(event.getOldLocale() != null ? event.getOldLocale() : "en_US");
    ItemStack newItem = getSpectatorItem(event.getNewLocale());
    for (ItemStack item : event.getPlayer().getInventory().getContents()) {
        if (item != null && item.isSimilar(oldItem)) {
            item.setItemMeta(newItem.getItemMeta());
        }
    }
}
项目:ProjectAres    文件:PickerMatchModule.java   
@EventHandler
public void handleLocaleChange(final PlayerLocaleChangeEvent event) {
    final MatchPlayer player = getMatch().getPlayer(event.getPlayer());
    if(player != null) refreshKit(player);
}
项目:ProjectAres    文件:LocaleListener.java   
@EventHandler(priority = EventPriority.MONITOR)
public void onLocaleChange(PlayerLocaleChangeEvent event) {
    userService.update(userStore.getUser(event.getPlayer()), (UserDoc.Locale) event::getNewLocale);
}
项目:AntiLaby    文件:EventsPost18.java   
@EventHandler
public void onChangeLocale(PlayerLocaleChangeEvent event) {
    if (!AntiLaby.getInstance().loadedFeatures.contains(PluginFeature.PROTOCOL_LIB))
        LanguageManager.INSTANCE.setLanguageForPlayer(event.getPlayer(), event.getLocale());
}
项目:Cardinal-Plus    文件:HeaderModule.java   
@EventHandler
public void onLangChange(PlayerLocaleChangeEvent event) {
    updatePlayer(event.getPlayer(), event.getNewLocale());
}
项目:CardinalPGM    文件:TitleRespawn.java   
@EventHandler
public void onLocaleChange(PlayerLocaleChangeEvent event) {
    if (isDeadUUID(event.getPlayer().getUniqueId()) && deadPlayers.get(event.getPlayer().getUniqueId()) != 0) sendTitle(event.getPlayer());
}
项目:CardinalPGM    文件:HeaderModule.java   
@EventHandler
public void onLangChange(PlayerLocaleChangeEvent event) {
    updatePlayer(event.getPlayer(), event.getNewLocale(), HeaderPart.NONE);
}