how do i get the content of a chat message in minecraft? - java

I am coding a forge minecraft 1.12.2 mod and I need to know how do I get the contents of a chat message that someone sends in chat.
I am using the ServerChatEvent event to sence messages but I do not know how to get the actual content of the message itself.

To get the message you can use :
event.getMessage();
Also, if you want the full message (with style/actions/...) you can use :
event.getComponent()
More informations:
Javadoc
Few examples

Related

How to get TradeCaptureReport (AE) message when using quickfixj?

I am sending a Trade capture report request with 35 = AD. I am getting an acknowledge message back with 35=AQ(TradeCaptureReportRequestAck) with 750 =0 and another acknowledge message 35=AQ with 750=1. However I am not getting any 35=AE(TradeCaptureReport) messages even though there are trades booked on ICE.
I am using quickfixj.
You need to read the ICE FIX Trade Capture interface documentation.
If you don't see any AE messages in your message log, then they're not being sent to you. If you get an AQ/750=0 followed by a AQ/750=1 with no AEs in between, that means you've successfully received a TCR set of size 0.
I am quite familiar with the ICE FIX Trade Capture API. Their documentation is pretty good; please review it to make sure you understand how requests are honored.
As Grant pointed out it is important to differentiate between message received in log file and message received in your application. If the latter is not happening although you are seeing the messages in your log then you need to look at your MessageCracker implementation.

MQ Message shows different in different client application

when we connect the MQ using MQ Explorer we are getting different message and when we connect from RFH Util we are getting different message.
From java we can see the message is coming as com.ibm.jms.JMSMessage.
MQ Explorer:
enter image description here
RFH Util:
enter image description here
RFH Util is giving correct value.
My question is, if we use our java code how we can get the correct value? currently we are getting the wrong value in java.
Expected is "!" but in MQ Explorer and java we are getting is "|".
Messages are coming from : Mainframe -> MQ -> java
it can be an encryption problem,
if (message instanceof TextMessage) {
TextMessage aTextMessage = (TextMessage) message;
System.out.println(aTextMessage.getText());
Your problem is likely due to data conversion rather than encryption. Are both of your clients connecting from the same machine? You should check how the data conversion is being done. You may also wish to review the MQ knowledge center.
Hi we are able to resolve the issue, from the screenshots we understood that java is expecting EBSIDIC character set, so we change the corrector set to EBSIDIC (“037”) from Mainframe and it resolve the issue.
Mainframe changes : FUNCTION DISPLAY-OF (WS-AREA, 037)
Earlier it was FUNCTION DISPLAY-OF (WS-AREA, 500)
Thanks.

How can I switch between 2 groups of handlers in netty

I am trying to write a client server application that communicate using Message Objects(Message Class is defined in my application). there is a scenario in which i want to transfer file between them. First I must send a message to client to notify it about specific file information and after that the file itself is going to be written to channel.
The problem is how can I handle this scenario in client?
Is it a good solution to remove Message handler after receiving message and replace it with a byte array handler?
what are the alternatives?
Sure you can just modify the pipeline on the fly. We do something similar in our portunification example[1].
[1] https://github.com/netty/netty/blob/4.0/example/src/main/java/io/netty/example/portunification/PortUnificationServerHandler.java

Query a remote server using QuickFix/J in Java to get position of an instrument

I'm building a client for trading with a remote server using FIX protocol and QuickFix/J API.
I can send order, receive price updates, cancel orders etc...
I'm asked now to "query API for current position of an instrument".
So let's say I can submit an order for buying an instrument, and it doesn't get executed, I would like to receive from the server some information like "you are LONG on intrument X with quantity Y etc".
Is it possible using QuickFix/J API?
I have written a method like this
static void positionReport() throws SessionNotFound{
quickfix.fix50.PositionReport order = new quickfix.fix50.PositionReport();
SessionID sessionId = (SessionID) initiator.getSessions().get(0);
order.set(new Account("1005390"));
order.set(new SecurityID("4663789"));
order.set(new SecurityExchange("XETR"));
order.set(new Symbol("SAP"));
Session.sendToTarget(order, sessionId);
}
which sends FIX messages like this
8=FIX.4.29=9835=AP34=4949=HIQ6_ORDER52=20140324-
15:54:10.14256=HIQFIX1=100539048=466378955=SAP207=XETR10=199
and receives messages like this:
8=FIX.4.29=9935=334=6949=HIQFIX52=20140324-15:54:10.89156=HIQ6_ORDER45=4958=Invalid
MsgType372=AP373=1110=242
As you can see I get "Invalid message" error
Check your counterparty's documentation.
FIX is a fairly "dumb" protocol. It just provides a communication infrastructure. The default message definitions are best thought of as a list of suggested messages that you can use. Even if one message type is supported by two counterparties, it's possible that each of the two counterparties could use it in totally different ways.
Most connection providers only use a subset of these messages. You should check their documentation to see if they support the PositionRequest message, and to see how they want you to set the fields in it.
No you cannot do that using Quickfix, unless and until the counterparty is modelled to give you FIX acknowledgements to your specific liking. That is why you can add your customized FIX fields to the FIX XML config file.
373 tag says 11 -> 11 = Invalid MsgType
58 confirms it for you again.
Check your FIX XML config and check if your message is complete and if your counterparty allows the messages of type AP.

How to choose what source of stream needs to be processed in Storm?

I'm struggling with one thing in Storm.
So the whole idea is:
Send a request to the storm (probably to DRPC Server). The request will tell Storm what is the source of streams. For example: Image that I have two files 1 - '/var/log/syslog' and 2- ' /var/log/udev' . I want to be able to send the request to the "Storm" to tell it what file to process.
What I don't understand:
When I said send request to the "Storm", - Where should I send it? ( I assume that DRPC server controls what source needs to be send to topology. But how to implement DRPC server? Is there some class like DRPCServer server = new DRPCServer()? And how to tell Spout to look at the DRPCServer?Or is the request needs to be send directly to the Spout? if So how to make it start using specified source? I mean do I need to send request to the open() method?
Not DRPCServer, its DRPCClient
DRPCClient client = new DRPCClient("drpc-host", 3772);
I think you will be really interested after seeing this
UPDATE:
And for more information you can always check the storm-starter project in github by nathanmarz and especially BasicDRPCTopologyand ReachTopology

Categories

Resources