當前位置: 首頁>>代碼示例>>Java>>正文


Java PlayerEvent.NameFormat方法代碼示例

本文整理匯總了Java中net.minecraftforge.event.entity.player.PlayerEvent.NameFormat方法的典型用法代碼示例。如果您正苦於以下問題:Java PlayerEvent.NameFormat方法的具體用法?Java PlayerEvent.NameFormat怎麽用?Java PlayerEvent.NameFormat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.event.entity.player.PlayerEvent的用法示例。


在下文中一共展示了PlayerEvent.NameFormat方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: playerName

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void playerName(PlayerEvent.NameFormat event) {
	if(Minecraft.getMinecraft().player != null && WeaponsCapability.get(event.getEntityPlayer()).isDisguised()) {
		String username=WeaponsCapability.get(event.getEntityPlayer()).getDisguiseType().substring(2);
		
		if(TF2Util.isOnSameTeam(Minecraft.getMinecraft().player, event.getEntityPlayer())) {
			event.setDisplayname(event.getDisplayname()+" ["+username+"]");
		}
		else {
			if(WeaponsCapability.get(event.getEntityPlayer()).getDisguiseType().startsWith("M:")) {
				if(event.getEntityPlayer().getCapability(TF2weapons.WEAPONS_CAP, null).entityDisguise != null){
					event.setDisplayname(TextFormatting.RESET+event.getEntityPlayer().getCapability(TF2weapons.WEAPONS_CAP, null).entityDisguise.getDisplayName().getFormattedText());
				}
				else
					event.setDisplayname(TextFormatting.RESET+I18n.format("entity."+username+".name"));
				
			}
			else
				event.setDisplayname(ScorePlayerTeam.formatPlayerName(Minecraft.getMinecraft().world.getScoreboard().getPlayersTeam(username), username));
		}
	}
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:23,代碼來源:TF2EventsClient.java

示例2: nameFormatEvent

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void nameFormatEvent(PlayerEvent.NameFormat event)
{
    try
    {
        if (D3Core.isDebug()) update();
        if (perks.has(event.getUsername()))
        {
            JsonObject perk = perks.getAsJsonObject(event.getUsername());
            if (perk.has("displayname")) event.setDisplayname(perk.get("displayname").getAsString());
            doHat(perk, event.getEntityPlayer());
        }
    }
    catch (Exception e)
    {
        if (D3Core.isDebug()) e.printStackTrace();
    }
}
 
開發者ID:DoubleDoorDevelopment,項目名稱:D3Core,代碼行數:19,代碼來源:DevPerks.java

示例3: overrideDisplayName

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void overrideDisplayName(PlayerEvent.NameFormat event){
	EntityPlayer player = event.getEntityPlayer();
	ExtendedPlayer ePlayer = ExtendedPlayerProvider.getExtendedPlayer(player);
	if(ePlayer !=null && ePlayer.getPlayerDisguiseUUID() !=null)
       {
		event.setDisplayname(ProfileUtil.getUsername(ePlayer.getPlayerDisguiseUUID()));
       }
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:10,代碼來源:DisguiseHandler.java

示例4: aprilFools

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public static void aprilFools(PlayerEvent.NameFormat event)
{
    if (D3Core.isAprilFools())
    {
        event.setDisplayname("§k" + event.getDisplayname());
    }
}
 
開發者ID:DoubleDoorDevelopment,項目名稱:D3Core,代碼行數:9,代碼來源:EventHandler.java

示例5: onNameFormat

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onNameFormat(PlayerEvent.NameFormat event)
{
    if(event.username.equals("robin4002"))
    {
        event.displayname = "[MFF]robin4002";
    }
}
 
開發者ID:FFMT,項目名稱:ModTutoriel17,代碼行數:9,代碼來源:PlayerEventHandler.java

示例6: getPlayerDisplayName

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
public static String getPlayerDisplayName(EntityPlayer player, String username)
{
    PlayerEvent.NameFormat event = new PlayerEvent.NameFormat(player, username);
    MinecraftForge.EVENT_BUS.post(event);
    return event.getDisplayname();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:7,代碼來源:ForgeEventFactory.java

示例7: getPlayerDisplayName

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
public static String getPlayerDisplayName(EntityPlayer player, String username)
{
    PlayerEvent.NameFormat event = new PlayerEvent.NameFormat(player, username);
    MinecraftForge.EVENT_BUS.post(event);
    return event.displayname;
}
 
開發者ID:SchrodingersSpy,項目名稱:TRHS_Club_Mod_2016,代碼行數:7,代碼來源:ForgeEventFactory.java

示例8: PlayerNameFormatting

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void PlayerNameFormatting(PlayerEvent.NameFormat event)
{
    if (this.usernamePropsRegistry.containsKey(event.getUsername()))
        event.setDisplayname(this.usernamePropsRegistry.get(event.getUsername()).get("nickname"));
}
 
開發者ID:Wehavecookies56,項目名稱:Kingdom-Keys-Re-Coded,代碼行數:7,代碼來源:UsernameHandler.java

示例9: getKillDisplayName

import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void getKillDisplayName(PlayerEvent.NameFormat nameEvt) {
  if (nameEvt.getUsername() != null && nameEvt.getUsername().startsWith(USERNAME)) {
    nameEvt.setDisplayname(getLocalizedName());
  }
}
 
開發者ID:SleepyTrousers,項目名稱:EnderIO,代碼行數:7,代碼來源:BlockKillerJoe.java


注:本文中的net.minecraftforge.event.entity.player.PlayerEvent.NameFormat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。