SecondAmendment Posted March 25, 2017 Posted March 25, 2017 How can I detect using an event when a command gets triggered by the player (Clientside Only). I've looked through the list of events available in forge and can't find such an event. Quote
TheMasterGabriel Posted March 25, 2017 Posted March 25, 2017 You can listen for CommandEvent, which gets called whenever a command is about to be executed. There is no event atm that gets called after a command is executed, at least I don't think. If there is, I couldn't find it. Quote
SecondAmendment Posted March 25, 2017 Author Posted March 25, 2017 So no way of checking if a command gets sent client side Quote
TheMasterGabriel Posted March 25, 2017 Posted March 25, 2017 (edited) On 3/25/2017 at 1:32 AM, SecondAmendment said: So no way of checking if a command gets sent client side Expand If you mean "executed by the player", you can just check if the ICommandSender is an instanceof EntityPlayerMP using CommandEvent#getSender. If you actually mean client-side, check if it was sent by EntityPlayerSP. However, basically every single vanilla command is sent from the server (hence the EntityPlayerMP). The only exception is when chat messages are sent from a GUI. Edited March 25, 2017 by TheMasterGabriel Quote
SecondAmendment Posted March 25, 2017 Author Posted March 25, 2017 (edited) So lets say i go on a server and lets say that I made a command called /modinfo and I want it to present information as a result to the client on a server that doesnt use the mod. Would it work? Edited March 25, 2017 by SecondAmendment Quote
TheMasterGabriel Posted March 25, 2017 Posted March 25, 2017 If you are making a client-side only mod, register your commands with ClientCommandHandler instead of the typical way. All those commands are client-side and are sent from EntityPlayerSP. Quote
SecondAmendment Posted March 25, 2017 Author Posted March 25, 2017 Its not 100% clientside, just partially Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.