• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ClientChatReceivedEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.minecraftforge.client.event.ClientChatReceivedEvent的典型用法代码示例。如果您正苦于以下问题:Java ClientChatReceivedEvent类的具体用法?Java ClientChatReceivedEvent怎么用?Java ClientChatReceivedEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ClientChatReceivedEvent类属于net.minecraftforge.client.event包,在下文中一共展示了ClientChatReceivedEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onClientChat

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
@SubscribeEvent
public void onClientChat(ClientChatReceivedEvent event) {
    String message = ( event.getMessage().getUnformattedText() );
     if (message.contains(search.get()) && !message.startsWith(MC.getSession().getUsername() )) {
         String append;
         switch (mode.get().toUpperCase()) {
             case "REPLY":
                 append = "/w ";
                 break;
             case "CHAT":
             default:
                 append = Strings.EMPTY;
                 break;
         }
         getLocalPlayer().sendChatMessage(append + reply.get());
     }
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:18,代码来源:AutoReply.java


示例2: messageReceived

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
@SubscribeEvent
public void messageReceived(ClientChatReceivedEvent e) {
	// we got a chat message, let checks whether it's from HiddenOre
	String msg = e.getMessage().getUnformattedText();
	Matcher matcher = hiddenOreRegex.matcher(msg);

	if (matcher.matches()) {
		// confirmed a HiddenOre message
		String item = matcher.group(2);
		// because I suck with regex
		if (item.endsWith(" nearby")) {
			item = item.substring(0, item.length() - " nearby".length());
		}
		String amount = matcher.group(1);
		Biome biome = OreLogger.instance.mc.theWorld.getBiome(OreLogger.instance.mc.thePlayer.getPosition());
		// send to aggregator
		hoManager.logBreak(cachedBlockPos.getY(), item, amount, biome, cachedItem);
	}
}
 
开发者ID:Maxopoly,项目名称:OreLogger,代码行数:20,代码来源:Listener.java


示例3: trueJoin

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
/**
 * Fired when the IP message is picked up and
 * {@link Server#getServer()} returns {@link Server#NONE},
 * meaning a server has been joined and the server is identified.
 * 
 * @param server The server joined.
 */
public static void trueJoin(Server server) {
	if (AllChat.track) {
		// Set to false to avoid comodification
		AllChat.track = false;
		
		// Cycle through each tracked event and feed it
		// back to the server that was joined
		for (ClientChatReceivedEvent event : AllChat.tracked) 
			server.onChat(event);
		
		// Clear the tracked messages.
		AllChat.tracked.clear();
	}
	AllRender.removeSkins();
	
	server.onJoin();
}
 
开发者ID:NomNuggetNom,项目名称:mcpvp-mod,代码行数:25,代码来源:AllJoin.java


示例4: onChat

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
public static void onChat(ClientChatReceivedEvent event) {
	String message = event.message.getUnformattedText();

	ChatTracker.checkAll(message);
	ChatTrigger.checkAll(message);
	
	if (message.matches(CoreHG.MSG_WELCOME))
		StateHG.state = StateHG.WAIT;
	
	if (message.matches(CoreHG.MSG_VULNERABLE))
		StateHG.state = StateHG.PLAY;
	
	if (message.startsWith("\00A7r\u00A7b" + Main.mc.thePlayer.getDisplayName())) {
		if (Vars.getInt("hg:kills") == -1)
			Vars.put("hg:kills", "" + 1);
		else
			Vars.put("hg:kills", "" + (Vars.getInt("hg:kills") + 1));
	}
}
 
开发者ID:NomNuggetNom,项目名称:mcpvp-mod,代码行数:20,代码来源:ChatHG.java


示例5: relatedChatEventHandler

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
public static void relatedChatEventHandler(ClientChatReceivedEvent event) {
	System.out.println("Passing chat event to server location parser");

	// We know that the message isn't null
	String message = event.message.getUnformattedText();

	/*
	 * Let's check if the message is a whereami response via checking if it
	 * starts with the correct string
	 */
	if (message.startsWith("You are currently on server")) {
		// Debug message output used here
		System.out.println("Processed user location");

		// Cancel the event so the user doesn't see the response
		event.setCanceled(true);
		// Save the server detected
		setServer(message.split(" ")[5]);

		// Now, we will remove this status, because it's served the purpose
		// it was meant to
		ChatListener.currentStatus.remove(ChatStatus.WHEREAMI);
	}
}
 
开发者ID:CircularChicken,项目名称:Picklr,代码行数:25,代码来源:ServerLocationUtils.java


示例6: getUnformattedText

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
public static String getUnformattedText(ClientChatReceivedEvent event) {
    String msg = "";
    try {
        Object component = null;
        switch (Autotip.MC_VERSION) {
            case V1_8:
            case V1_8_8:
            case V1_8_9:
                component = getField(ClientChatReceivedEvent.class, "message").get(event);
                break;
            case V1_9:
            case V1_9_4:
            case V1_10:
            case V1_10_2:
            case V1_11:
            case V1_11_2:
                component = getMethod(ClientChatReceivedEvent.class, "getMessage")
                        .invoke(event);
                break;
        }
        // Original method name: getUnformattedText
        msg = (String) getMethod(component.getClass(), "func_150260_c").invoke(component);
    } catch (InvocationTargetException | IllegalAccessException e) {
        e.printStackTrace();
    }
    return msg;
}
 
开发者ID:Semx11,项目名称:Autotip,代码行数:28,代码来源:UniversalUtil.java


示例7: onChatReceive

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
@SubscribeEvent
public void onChatReceive(ClientChatReceivedEvent event) {
	//IndexOutOfBoundException when it's a broadcast message.. this will fix it
	String username = !event.message.getUnformattedText().isEmpty() ? event.message.getSiblings().get(0).getUnformattedText().trim() : "";
	if (RewiMod.mutedPlayers.getMuted().contains(username)) {
		event.setCanceled(true);
	}

	if(Minecraft.getMinecraft() != null && Minecraft.getMinecraft().getCurrentServerData() != null) {
		if (Minecraft.getMinecraft().getCurrentServerData().serverIP.endsWith("rewinside.tv")) {
			for (String badWord : RewiMod.badWords) {
				if (event.message.getUnformattedText().contains(badWord)) {
					if (!username.equals(Minecraft.getMinecraft().thePlayer.getName())) {
						Minecraft.getMinecraft().thePlayer.sendChatMessage("/chatreport " + username);
						break;
					}
				}
			}

			if (event.message.getUnformattedText().contains(RewiMod.CHATLOG_URL)) {
				try {
					Desktop.getDesktop().browse(new URI("https://rewinside.tv/wpbt/IssueAdd/1/?issueType=bug"));
					Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(RewiMod.CHATLOG_URL + event.message.getUnformattedText().split("/")[3]), null);
				} catch (IOException | URISyntaxException e) {
					e.printStackTrace();
				}
			}
		}
	}
}
 
开发者ID:CreepPlaysDE,项目名称:RewiMod,代码行数:31,代码来源:ChatHandler.java


示例8: onEvent

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
@SubscribeEvent
public void onEvent(ClientChatReceivedEvent evt) {
  ITextComponent message = evt.getMessage();
  String txt = message.getUnformattedText();
  WolTestEnvironment.instance.getPacketDispatcher().sendToServer(
      new ClientChatReceivedMessage(txt));
}
 
开发者ID:wizards-of-lua,项目名称:wizards-of-lua,代码行数:8,代码来源:ClientSideEventHandler.java


示例9: clientReceivedChat

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
@SubscribeEvent
public void clientReceivedChat(ClientChatReceivedEvent e) {
    ChatComponentTranslation a = (ChatComponentTranslation)e.message;
    for(String disable : Util.CHAT_DISABLE_KEYS) {
        if(a.getKey().contains(disable)) {
            e.setCanceled(true);
            return;
        }
    }
}
 
开发者ID:jackey8616,项目名称:Age-of-Kingdom,代码行数:11,代码来源:EventManager.java


示例10: onChatEvent

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
@SubscribeEvent
public void onChatEvent(ClientChatReceivedEvent event) {
	if (Config.translateChat)
		if (!event.isCanceled())
			try {
				String message = getFallback().containsTranslateKey(event.message.getUnformattedText()) ? StatCollector.translateToFallback(event.message.getUnformattedText()) :event.message.getUnformattedText();
				event.message = new ChatComponentText(translateToLocal(message, "en"));
			} catch (Exception e) {
				e.printStackTrace();
			}
}
 
开发者ID:austinv11,项目名称:CollectiveFramework,代码行数:12,代码来源:MinecraftTranslator.java


示例11: clientChatReceived

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
@SubscribeEvent
public void clientChatReceived(ClientChatReceivedEvent e) {
	Iterator<Blocker> blocksIterator = blocks.iterator();
	while (blocksIterator.hasNext()) {
		Blocker block = blocksIterator.next();
		if (!block.accept(e.getMessage()))
			e.setCanceled(true);
		if (block.isDone())
			blocksIterator.remove();
	}
}
 
开发者ID:Earthcomputer,项目名称:Easy-Editors,代码行数:12,代码来源:ChatBlocker.java


示例12: checkSplit

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
public static void checkSplit(ClientChatReceivedEvent event) {
	if (Main.secondChat.shouldSplit(event) 
			&& !Server.getServer().equals(Server.CTF)
			&& !Server.getServer().equals(Server.HS)) {
		Main.secondChat.printChatMessage(event.message);
		event.setCanceled(true);
	}
}
 
开发者ID:NomNuggetNom,项目名称:mcpvp-mod,代码行数:9,代码来源:AllChat.java


示例13: addLinks

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
/**
 * Re-adds link click events to any links in chat. Links
 * must start with <code>http://</code> to be added properly.
 * @param event The event to add links to.
 */
public static void addLinks(ClientChatReceivedEvent event) {
	if (!event.message.getUnformattedText().matches(".*" + RE_URL + ".*")) return;
	
	Matcher urlMatcher = URL_PATTERN.matcher(event.message.getUnformattedText());
	while (urlMatcher.find()) {
		event.message.getChatStyle().setChatClickEvent(
				new ClickEvent(ClickEvent.Action.OPEN_URL, urlMatcher.group()));
	}

}
 
开发者ID:NomNuggetNom,项目名称:mcpvp-mod,代码行数:16,代码来源:AllChat.java


示例14: onChat

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
public static void onChat(ClientChatReceivedEvent event) {
	String message = event.message.getUnformattedText();
	handleAll(event);
	if (event.isCanceled()) return;

	switch (MessageType.getType(message)) {
	case ALERT: filterAlerts(event);
	case STATS: filterAlerts(event); event.setCanceled(ConfigCTFChat.chatHistory);
	case NONE:		
		
		// The chat section has a number of lines depending on the state.
		// If we have more than that number, remove the first.
		if (chatBlock.size() == StateCTF.getState().chatLines()) {
			chatBlock.remove(0);
		}

		// Does our new chat equal the old?
		if (!oldChat.equals(chatBlock)) {
			// Does it contain our message?
			if (!oldChat.contains(message)) {
				// It's a new message!
				handleMessages(event);
				oldChat.add(message);
			} else {
				// Set it canceled based on config settings.
				event.setCanceled(ConfigCTFChat.chatHistory);
			}
		}
		// Index the chat message.
		chatBlock.add(message);
		
	}
}
 
开发者ID:NomNuggetNom,项目名称:mcpvp-mod,代码行数:34,代码来源:ChatCTF.java


示例15: handleMessages

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
/**
 * Handles repeated messages, e.g. players talking,
 * class selected, kills, and more. Does NOT include
 * stats or team info.
 * @param event The chat event to handle.
 */
public static void handleMessages(ClientChatReceivedEvent event) {
	String message = event.message.getUnformattedText();

	ChatTracker.checkAll(message);
	ChatTrigger.checkAll(message);
	
	// TODO: Move to Var system.
	if (message.matches(msgFreeDay)) {
		InfoCTF.freeDay = true;
	}
	
	if (message.matches(reHeadshot)) {
		StatsCTF.headshots++;
		Medal.add("headshot");
	}
	
	if (Main.secondChat.shouldSplit(event)) {
		Main.secondChat.printChatMessage(event.message);
		event.setCanceled(true);
	}
	
	// Medic calling.
	if (message.matches(reMedic)) {		
		if (StateCTF.getState() == StateCTF.PLAY) {
			for (String string : ConfigCTFChat.medicClasses) {
				if (KitCTF.getKit(Main.mc.thePlayer).toString().toLowerCase().equals(string.toLowerCase()) || InfoCTF.chosenClass.toLowerCase().equals(string.toLowerCase())) {
					String formatted = event.message.getUnformattedText().replaceAll("\u00A7(.)", "\u00A7$1\u00A7l");
					event.message = new ChatComponentText(formatted);
				}
			}
		}
	}
}
 
开发者ID:NomNuggetNom,项目名称:mcpvp-mod,代码行数:40,代码来源:ChatCTF.java


示例16: filterAlerts

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
/**
 * Handles all in-game notifications, such as the
 * flag being stolen.
 * @param event The chat event to handle.
 */
public static void filterAlerts(ClientChatReceivedEvent event) {
	String message = event.message.getUnformattedText();
	
	// Sometimes messages are repeated: this prevents the repetition of alerts.
	if (message.equals(lastAlert)) return;
	
	ChatTracker.checkAll(message);
	ChatTrigger.checkAll(message);

	// Recovered flags.
	if (message.matches(reAction) && message.replaceAll(reAction, "$2").equals("recovered")) {			
		if (message.replaceAll(reAction, "$1").equals(Main.mc.thePlayer.getDisplayName())) {
			StatsCTF.recovers++;
		}
		
	// Captured flag.
	} else if (message.matches(reAction) && message.replaceAll(reAction, "$2").equals("captured")) {
		// Game check to avoid messy notifications on game winning cap.
		if (StateCTF.getState() == StateCTF.PLAY) {

			if (message.replaceAll(reAction, "$1").equals(Main.mc.thePlayer.getDisplayName())) {
				Medal.add(new Medal("flagcap"));
			}
		}
	}
	
	if (message.matches(reAction) 
			|| message.matches(reGameOver)
			|| message.matches(reStreak)
			|| message.matches(reCompass)) {
			lastAlert = message;
			//event.setCanceled(true);
	}
}
 
开发者ID:NomNuggetNom,项目名称:mcpvp-mod,代码行数:40,代码来源:ChatCTF.java


示例17: handleAll

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
public static void handleAll(ClientChatReceivedEvent event) {
	// Removal of messages that appear in split chat.
	for (Object chatLine : Main.secondChat.getMessages()) {
		
		// The chat message in the second chat.
		String oldMessage = ((ChatLine)chatLine).func_151461_a().getUnformattedText();
		if (oldMessage.equals(event.message.getUnformattedText())) {
			event.setCanceled(true);
		}
	}
}
 
开发者ID:NomNuggetNom,项目名称:mcpvp-mod,代码行数:12,代码来源:ChatCTF.java


示例18: onChat

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
public static void onChat(ClientChatReceivedEvent event) {
	String message = event.message.getUnformattedText();

	ChatTrigger.checkAll(message);
	ChatTracker.checkAll(message);
	
	if (message.matches(CoreSmash.MSG_GAME_OVER))
			StateSmash.state = StateSmash.POST;
}
 
开发者ID:NomNuggetNom,项目名称:mcpvp-mod,代码行数:10,代码来源:ChatSmash.java


示例19: check

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
/**
 * Consults the list of messages to ignore and sets the event to cancelled if it finds a match.
 * @param event The event to check.
 */
public void check(ClientChatReceivedEvent event) {
	for (String string : this.ignore) {
		if (event.message.getUnformattedText().equals(string) 
				|| event.message.getUnformattedText().matches(string)) {
			event.setCanceled(true);
			Main.l("Auto-removed \"%s\" via IgnoreResult \"%s\"", event.message.getUnformattedText(), this);
			this.ignore.remove(string);
			return;
		}
	}
}
 
开发者ID:NomNuggetNom,项目名称:mcpvp-mod,代码行数:16,代码来源:IgnoreResult.java


示例20: checkAll

import net.minecraftforge.client.event.ClientChatReceivedEvent; //导入依赖的package包/类
/**
 * Cycles through every IgnoreResult and runs check(event).
 * @param event The event to check.
 */
public static void checkAll(ClientChatReceivedEvent event) {
	Main.start("ignore");
	for (int i = ignoreResults.size()-1; i > 0; i--) {
		ignoreResults.get(i).check(event);
		
		// Remove empty additions to prevent lag.
		if (ignoreResults.get(i).ignore.size() == 0)
			ignoreResults.remove(i);
	}
	Main.end();
}
 
开发者ID:NomNuggetNom,项目名称:mcpvp-mod,代码行数:16,代码来源:IgnoreResult.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IRenameSupport类代码示例发布时间:2022-05-21
下一篇:
Java UpgradeRequest类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap