當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。