本文整理汇总了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);
}
示例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);
}
}
}
示例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();
}
示例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();
}
示例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;
}
示例6: setPlayer
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void setPlayer(EntityPlayer player) {
playerUUID = player.getUniqueID();
playerName = player.getName();
// playerProfile = updateGameprofile(player.getGameProfile());
}
示例7: getPlayerName
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static String getPlayerName(EntityPlayer ent) {
//return ent.username;
return ent.getName();
}
示例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;
}
示例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
}
示例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;
}