org.bukkit.event.player.PlayerLocaleChangeEvent Java Examples

The following examples show how to use org.bukkit.event.player.PlayerLocaleChangeEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocaleUseLoader.java    From ProtocolSupport with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler
public void onLocaleChange(PlayerLocaleChangeEvent event) {
	if (TranslationAPI.isBuiltInLoaderEnabled()) {
		String locale = event.getLocale();
		if (TranslationAPI.getBuiltInTranslations().contains(locale) && !TranslationAPI.isTranslationRegistered(locale)) {
			Bukkit.getScheduler().runTaskAsynchronously(ProtocolSupport.getInstance(), () -> TranslationAPI.loadBuiltTranslation(locale));
		}
	}
}
 
Example #2
Source File: TeamPicker.java    From CardinalPGM with MIT License 5 votes vote down vote up
@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());
        }
    }
}
 
Example #3
Source File: SpectatorTools.java    From CardinalPGM with MIT License 5 votes vote down vote up
@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());
        }
    }
}
 
Example #4
Source File: PickerMatchModule.java    From PGM with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventHandler
public void handleLocaleChange(final PlayerLocaleChangeEvent event) {
  refreshKit(match.getPlayer(event.getPlayer()));
}
 
Example #5
Source File: PickerMatchModule.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventHandler
public void handleLocaleChange(final PlayerLocaleChangeEvent event) {
    final MatchPlayer player = getMatch().getPlayer(event.getPlayer());
    if(player != null) refreshKit(player);
}
 
Example #6
Source File: LocaleListener.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR)
public void onLocaleChange(PlayerLocaleChangeEvent event) {
    userService.update(userStore.getUser(event.getPlayer()), (UserDoc.Locale) event::getNewLocale);
}
 
Example #7
Source File: TitleRespawn.java    From CardinalPGM with MIT License 4 votes vote down vote up
@EventHandler
public void onLocaleChange(PlayerLocaleChangeEvent event) {
    if (isDeadUUID(event.getPlayer().getUniqueId()) && deadPlayers.get(event.getPlayer().getUniqueId()) != 0) sendTitle(event.getPlayer());
}
 
Example #8
Source File: HeaderModule.java    From CardinalPGM with MIT License 4 votes vote down vote up
@EventHandler
public void onLangChange(PlayerLocaleChangeEvent event) {
    updatePlayer(event.getPlayer(), event.getNewLocale(), HeaderPart.NONE);
}