当前位置: 首页>>代码示例>>Java>>正文


Java EntityPlayer.getName方法代码示例

本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.getName方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.getName方法的具体用法?Java EntityPlayer.getName怎么用?Java EntityPlayer.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.player.EntityPlayer的用法示例。


在下文中一共展示了EntityPlayer.getName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: canPlayerAccess

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static boolean canPlayerAccess(ItemStack stack, EntityPlayer player) {

        if (!SecurityHelper.isSecure(stack)) {
            return true;
        }
        String name = player.getName();
        ISecurable.AccessMode access = SecurityHelper.getAccess(stack);
        if (access.isPublic() || (CoreProps.enableOpSecureAccess && CoreUtils.isOp(name))) {
            return true;
        }
        GameProfile profile = SecurityHelper.getOwner(stack);
        UUID ownerID = profile.getId();
        if (SecurityHelper.isDefaultUUID(ownerID)) {
            return true;
        }
        UUID otherID = SecurityHelper.getID(player);
        return ownerID.equals(otherID) || access.isFriendsOnly() && RegistrySocial.playerHasAccess(name, profile);
    }
 
开发者ID:ImbaKnugel,项目名称:Whoosh,代码行数:19,代码来源:ItemTransporter.java

示例2: onMouseClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@EventTarget
private void onMouseClick(MouseEvent event) {
    if (event.key == 2 && this.mc.objectMouseOver != null && this.mc.objectMouseOver.entityHit != null && this.mc.objectMouseOver.entityHit instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer)Minecraft.getMinecraft().objectMouseOver.entityHit;
        String name = player.getName();
        if (FriendManager.isFriend(name)) {
            FriendManager.removeFriend(name);
            ChatUtils.sendClientMessage("Removed: " + name);
        } else {
            FriendManager.addFriend(name, name);
            ChatUtils.sendClientMessage("Added: " + name);
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:15,代码来源:MiddleClickFriend.java

示例3: EntityDrone

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public EntityDrone(World world, EntityPlayer player) {
    this(world);
    playerUUID = player.getGameProfile().getId().toString();
    playerName = player.getName();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:6,代码来源:EntityDrone.java

示例4: setupPlacement

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void setupPlacement(EntityPlayer player, int side) {
    setSide(side ^ 1);
    setRotation(Rotation.getSidedRotation(player, side) ^ 2);
    owner = player.getName();
}
 
开发者ID:TheCBProject,项目名称:WirelessRedstone,代码行数:6,代码来源:WirelessPart.java

示例5: executeCommand

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean executeCommand(final EntityPlayer playerIn)
{
    ICommandSender icommandsender = new ICommandSender()
    {
        public String getName()
        {
            return playerIn.getName();
        }
        public IChatComponent getDisplayName()
        {
            return playerIn.getDisplayName();
        }
        public void addChatMessage(IChatComponent component)
        {
        }
        public boolean canCommandSenderUseCommand(int permLevel, String commandName)
        {
            return permLevel <= 2;
        }
        public BlockPos getPosition()
        {
            return TileEntitySign.this.pos;
        }
        public Vec3 getPositionVector()
        {
            return new Vec3((double)TileEntitySign.this.pos.getX() + 0.5D, (double)TileEntitySign.this.pos.getY() + 0.5D, (double)TileEntitySign.this.pos.getZ() + 0.5D);
        }
        public World getEntityWorld()
        {
            return playerIn.getEntityWorld();
        }
        public Entity getCommandSenderEntity()
        {
            return playerIn;
        }
        public boolean sendCommandFeedback()
        {
            return false;
        }
        public void setCommandStat(CommandResultStats.Type type, int amount)
        {
            TileEntitySign.this.stats.func_179672_a(this, type, amount);
        }
    };

    for (int i = 0; i < this.signText.length; ++i)
    {
        ChatStyle chatstyle = this.signText[i] == null ? null : this.signText[i].getChatStyle();

        if (chatstyle != null && chatstyle.getChatClickEvent() != null)
        {
            ClickEvent clickevent = chatstyle.getChatClickEvent();

            if (clickevent.getAction() == ClickEvent.Action.RUN_COMMAND)
            {
                MinecraftServer.getServer().getCommandManager().executeCommand(icommandsender, clickevent.getValue());
            }
        }
    }

    return true;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:63,代码来源:TileEntitySign.java

示例6: setPlayer

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void setPlayer(EntityPlayer player) {
        playerUUID = player.getUniqueID();
        playerName = player.getName();
//        playerProfile = updateGameprofile(player.getGameProfile());
    }
 
开发者ID:CreeperShift,项目名称:WirelessCharger,代码行数:6,代码来源:TilePersonalCharger.java

示例7: getPlayerName

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static String getPlayerName(EntityPlayer ent) {
    //return ent.username;
    return ent.getName();
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:5,代码来源:ZWrapper.java

示例8: executeCommand

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean executeCommand(final EntityPlayer playerIn)
{
    ICommandSender icommandsender = new ICommandSender()
    {
        public String getName()
        {
            return playerIn.getName();
        }
        public ITextComponent getDisplayName()
        {
            return playerIn.getDisplayName();
        }
        public void addChatMessage(ITextComponent component)
        {
        }
        public boolean canCommandSenderUseCommand(int permLevel, String commandName)
        {
            return permLevel <= 2;
        }
        public BlockPos getPosition()
        {
            return TileEntitySign.this.pos;
        }
        public Vec3d getPositionVector()
        {
            return new Vec3d((double)TileEntitySign.this.pos.getX() + 0.5D, (double)TileEntitySign.this.pos.getY() + 0.5D, (double)TileEntitySign.this.pos.getZ() + 0.5D);
        }
        public World getEntityWorld()
        {
            return playerIn.getEntityWorld();
        }
        public Entity getCommandSenderEntity()
        {
            return playerIn;
        }
        public boolean sendCommandFeedback()
        {
            return false;
        }
        public void setCommandStat(CommandResultStats.Type type, int amount)
        {
            if (TileEntitySign.this.world != null && !TileEntitySign.this.world.isRemote)
            {
                TileEntitySign.this.stats.setCommandStatForSender(TileEntitySign.this.world.getMinecraftServer(), this, type, amount);
            }
        }
        public MinecraftServer getServer()
        {
            return playerIn.getServer();
        }
    };

    for (ITextComponent itextcomponent : this.signText)
    {
        Style style = itextcomponent == null ? null : itextcomponent.getStyle();

        if (style != null && style.getClickEvent() != null)
        {
            ClickEvent clickevent = style.getClickEvent();

            if (clickevent.getAction() == ClickEvent.Action.RUN_COMMAND)
            {
                playerIn.getServer().getCommandManager().executeCommand(icommandsender, clickevent.getValue());
            }
        }
    }

    return true;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:70,代码来源:TileEntitySign.java

示例9: addFaction

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private static void addFaction(EntityPlayer player, Chunk chunk)
{
	_Territory territory  = new _Territory(player.worldObj.provider.getDimension(), player.getName() + "'s Group");

	Main.console("[TERRITORY HANDLER] Added a new faction in dimension " + territory.getDimensionID() +
			". Core chunk pos: X " + chunk.xPosition + " / Z " + chunk.zPosition);

	territory.addMember(player);	// Adding them to the faction
	territory.setLeader(player);	// And then declaring them leader

	territory.addChunk(chunk);		// Adding the core chunk first
	territory.setUpkeepPaid(true);	// Starting out paid

	factions.add(territory);	// And making that known

	// SFX
	Main.startFireworks(player);

	Main.sendMessageToPlayer(player, "New faction successfully founded and territory claimed! Faction name: " + territory.getFactionName());

	SaveHandler.saveFactionsToFile();	// Saving, just to make sure
}
 
开发者ID:Domochevsky,项目名称:minecraft-territorialdealings,代码行数:23,代码来源:TerritoryHandler.java

示例10: startFactionInChunk

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static _FactionSaveData startFactionInChunk(World world, EntityPlayer player, Chunk chunk) 
{
	// Safeties
	if (player == null) { return null; }	// Who're you?
	if (world == null) { return null; }		// Where are you?
	if (chunk == null) { return null; }		// What're you trying to do?
	
	UUID playerID = getIDFromPlayer(player);
	
	Main.console("Starting a new faction for player " + player.getName() + " (ID " + playerID + ")...");
	
	// Step 1, create the faction
	_FactionSaveData faction = new _FactionSaveData(UUID.randomUUID(), world.provider.getDimension(), player.getName() + "'s faction");
	
	// Step 1.1, claiming the first chunk
	faction.addChunk(chunk.getChunkCoordIntPair());
	
	// Step 2, add the player both as member and leader
	_PlayerSaveData playerData;
	
	if (saveData.getPlayerMap().containsKey(playerID))
	{
		// Is already known, so we can use their profile
		Main.console("...player is known, using their profile...");
		
		playerData = saveData.getPlayerMap().get(playerID);
	}
	else
	{
		// Is not yet known, so adding them now
		Main.console("...player is not known, making a new profile...");
		
		playerData = new _PlayerSaveData(playerID);
		saveData.getPlayerMap().put(playerID, playerData);
	}
	
	Main.console("...adding player as member and leader...");

	ArrayList<UUID> memberships = playerData.getMemberList();	// Get...
	memberships.add(faction.getID());							// ..set...
	playerData.setMemberList(memberships);						// ...return
	
	playerData.setLeadership(faction.getID());					// You're the leader now.
	
	
	// Step 3, make the faction known
	saveData.getFactionMap().put(faction.getID(), faction);
	
	Main.console("...done.");
	
	// Step 4, handing the new faction back
	return faction;
}
 
开发者ID:Domochevsky,项目名称:minecraft-territorialdealings,代码行数:54,代码来源:TerritoryHandler.java


注:本文中的net.minecraft.entity.player.EntityPlayer.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。