Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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.

8 minutes ago, SecondAmendment said:

So no way of checking if a command gets sent client side

 
 

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 by TheMasterGabriel

  • Author

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 by SecondAmendment

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.