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


Java EntityPlayerMP.sendMessage方法代码示例

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


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

示例1: onMessage

import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
@Override
public IMessage onMessage(TeleportRequest message, MessageContext ctx) {
    EntityPlayerMP player = ctx.getServerHandler().player;
    if(Perms.isOP(player) == false){
        Main.LOGGER.info(player.getName() + " tried to teleport, but was denied to do so!");
        return null;
    }
    new RunInServerThread(new Runnable() {
        @Override
        public void run() {
            Entity e = FMLCommonHandler.instance().getMinecraftServerInstance().getEntityFromUuid(message.uuid);
            if(e == null){
                player.sendMessage(new TextComponentString(TextFormatting.RED + "Woops! This tile entity no longer exists!"));
                return;
            }
            Teleport.teleportPlayer(player, e.dimension, e.posX, e.posY, e.posZ);
        }
    });
    return null;
}
 
开发者ID:TerminatorNL,项目名称:LagGoggles,代码行数:21,代码来源:TeleportRequestHandler.java

示例2: handleOpenRequest

import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
@SideOnly(Side.SERVER)
public static void handleOpenRequest(BlockPos pos, EntityPlayerMP player) {
    TileEntity te = player.world.getTileEntity(pos);
    if (te instanceof ScriptyBlock.TEScriptyBlock) {
        ScriptyBlock.TEScriptyBlock scriptyBlock = (ScriptyBlock.TEScriptyBlock) te;
        if (scriptyBlock.getOwner() != null && scriptyBlock.getOwner().isEntityEqual(player)) {
            player.sendMessage(new TextComponentString(scriptyBlock.getOwner().getName() + " is already using this Scripty block.").setStyle(new Style().setColor(TextFormatting.RED)));
            return;
        }
        scriptyBlock.setOwner(player);
        sendContentMessage(player, pos, scriptyBlock.getContent(), scriptyBlock.getLanguage(), scriptyBlock.isParsing());
    }
}
 
开发者ID:ScriptyMod,项目名称:Scripty,代码行数:14,代码来源:ScriptyNetworkHandler.java

示例3: execute

import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
	World world = sender.getEntityWorld();
	if (!world.isRemote) {
		EntityPlayerMP player = getCommandSenderAsPlayer(sender);

		if (args.length <= 0) {
			player.sendMessage(new TextComponentString("[ISH] /gm <gamemode>"));
			return;
		}
		if (args[0].equals("0") || args[0].equals("s") || args[0].equals("survival")) {
			player.setGameType(GameType.SURVIVAL);
			player.sendMessage(new TextComponentString("[ISH] Gamemode changed: SURVIVAL"));
		} else if (args[0].equals("1") || args[0].equals("c") || args[0].equals("creative")) {
			player.setGameType(GameType.CREATIVE);
			player.sendMessage(new TextComponentString("[ISH] Gamemode changed: CREATIVE"));
		} else if (args[0].equals("2") || args[0].equals("a") || args[0].equals("adventure")) {
			player.setGameType(GameType.ADVENTURE);
			player.sendMessage(new TextComponentString("[ISH] Gamemode changed: ADVENTURE"));
		} else if (args[0].equals("3") || args[0].equals("sp") || args[0].equals("spectator")) {
			player.setGameType(GameType.SPECTATOR);
			player.sendMessage(new TextComponentString("[ISH] Gamemode changed: SPECTATOR"));
		} else {
			player.sendMessage(new TextComponentString("[ISH] /gm <gamemode>"));
		}
	}
}
 
开发者ID:IvanSteklow,项目名称:VanillaExtras,代码行数:28,代码来源:GamemodeCmd.java

示例4: teleportPlayer

import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
public static void teleportPlayer(EntityPlayerMP player, int dim, double x, double y, double z){
    new RunInServerThread(new Runnable() {
        @Override
        public void run() {
            if(player.dimension != dim) {
                teleportPlayerToDimension(player, dim, x, y, z);
            }else{
                player.setPositionAndUpdate(x,y,z);
            }
            player.sendMessage(new TextComponentString(TextFormatting.GREEN + "Teleported to: " + TextFormatting.GRAY + " Dim: " + dim + TextFormatting.WHITE + ", " + (int) x + ", " +  (int) y + ", " + (int) z));
        }
    });
}
 
开发者ID:TerminatorNL,项目名称:LagGoggles,代码行数:14,代码来源:Teleport.java

示例5: sendChatToServer

import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
public static void sendChatToServer(String message)
{
	MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
	for (EntityPlayerMP aPlayerEntityList : server.getPlayerList().getPlayers())
	{
		EntityPlayerMP player = aPlayerEntityList;
		player.sendMessage(new TextComponentString(message));
	}
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:10,代码来源:ChatUtil.java

示例6: execute

import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    EntityPlayerMP player = getCommandSenderAsPlayer(sender);
    ItemStack held = player.getHeldItemMainhand();
    if(held.isEmpty()) {
        held = player.getHeldItemOffhand();
    }
    if(held.isEmpty()) {
        player.sendMessage(new TextComponentTranslation("command.modularmachinery.hand.empty"));
        return;
    }
    Item i = held.getItem();
    StringBuilder sb = new StringBuilder();
    sb.append(i.getRegistryName().toString());
    if(i.getHasSubtypes()) {
        sb.append("@").append(held.getItemDamage());
    }
    NBTTagCompound cmp = held.serializeNBT();
    if(cmp.hasKey("tag")) {
        String json = NBTJsonSerializer.serializeNBT(cmp.getTag("tag"));
        if(!json.isEmpty()) {
            sb.append(" (with nbt: ").append(json).append(" )");
        }
    }

    String str = sb.toString();
    player.sendMessage(new TextComponentString(str));
    ModularMachinery.NET_CHANNEL.sendTo(new PktCopyToClipboard(str), player);

    int burn = TileEntityFurnace.getItemBurnTime(held);
    if(burn > 0) {
        player.sendMessage(new TextComponentString("Fuel BurnTime: " + burn));
    }
}
 
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:35,代码来源:CommandHand.java

示例7: execute

import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    EntityPlayerMP player = getCommandSenderAsPlayer(sender);
    player.sendMessage(new TextComponentString("Testing Machines:"));
    MachineRegistry.getRegistry().loadMachines(player);
    player.sendMessage(new TextComponentString(""));
    player.sendMessage(new TextComponentString("Testing Recipes:"));
    RecipeRegistry.getRegistry().loadRecipes(player);
}
 
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:10,代码来源:CommandSyntax.java

示例8: execute

import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
	World world = sender.getEntityWorld();
	if (!world.isRemote) {

		EntityPlayerMP player = getCommandSenderAsPlayer(sender);

		if (args.length <= 0) {
			player.sendMessage(new TextComponentString("[ISH] Usage:"));
			player.sendMessage(new TextComponentString("[ISH] /ish killa (killall) - kill all mobs and drops"));
			player.sendMessage(new TextComponentString("[ISH] /ish heal (healme) - heal player"));
			player.sendMessage(
					new TextComponentString("[ISH] /ish oheart (oneheart) - set minimal health and hunger"));
			return;
		}
		if (args[0].equals("killa") || args[0].equals("killall")) {
			server.commandManager.executeCommand(server.getServer(), "/kill @e[type=!Player]");
		} else if (args[0].equals("heal") || args[0].equals("healme")) {
			player.setHealth(player.getMaxHealth());
			player.getFoodStats().setFoodLevel(20);
		} else if (args[0].equals("oheart") || args[0].equals("oneheart")) {
			player.setHealth(1.0f);
			player.getFoodStats().setFoodLevel(1);
		} else if (args[0].equals("help") || args[0].equals("?")) {
			player.sendMessage(new TextComponentString("[ISH] Usage:"));
			player.sendMessage(new TextComponentString("[ISH] /ish killa (killall) - kill all mobs and drops"));
			player.sendMessage(new TextComponentString("[ISH] /ish heal (healme) - heal player"));
			player.sendMessage(
					new TextComponentString("[ISH] /ish oheart (oneheart) - set minimal health and hunger"));
		} else if (args[0].equals("out")) {
			if (args[1].equals("0")) {
				server.commandManager.executeCommand(player.getCommandSenderEntity(),
						"/gamerule commandBlockOutput false");
			} else if (args[1].equals("1")) {
				server.commandManager.executeCommand(player.getCommandSenderEntity(),
						"/gamerule commandBlockOutput true");
			}
		} else {
			player.sendMessage(new TextComponentString("[ISH] Wrong usage! Usage:"));
			player.sendMessage(new TextComponentString("[ISH] /ish killa (killall) - kill all mobs and drops"));
			player.sendMessage(new TextComponentString("[ISH] /ish heal (healme) - heal player"));
			player.sendMessage(
					new TextComponentString("[ISH] /ish oheart (oneheart) - set minimal health and hunger"));
		}
	}
}
 
开发者ID:IvanSteklow,项目名称:VanillaExtras,代码行数:47,代码来源:MainCmd.java


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