Jump to content

How to create a client side command?


Is.M.L

Recommended Posts

I want to add a few client side commands to the client side mod I'm doing, and I wanted to know how to do it. Just to contextualize, I need a command /rain [on|false] that will set a feature to automatically send /weather off command whenever it rains (if the player sets /rain off) or do nothing (if the player sets /rain on). The other commands will work as aliases to long commands (for exemple /nether will warp you to the nether by issuing /warp nether, /bed will teleport you to your bed by issuing /home bed, etc).

In short, all I need is a way to handle commands on client side, consuming them and never issuing them to the server.

Link to comment
Share on other sites

4 hours ago, diesieben07 said:

You can add client-side commands using ClientCommandHandler. Note that you probably want to implement IClientCommand on your command class. 

I know I'm being lazy by asking this, and that I could "try and error" the whole thing, but since I don't have access to a PC right now, sorry for the question, but how do I implement IClientCommand properly? Could you give me an example where the /nether command translates to a /warp nether command? (client gets /nether, handles it and issues a true command /warp nether instead)

Link to comment
Share on other sites

If you are an admin on the server you could also just install a server side only mod. Clients could still connect to your server without the mod and you could do a lot more stuff without having to go through vanilla commands.

 

Kinda like bukkit but better and more awesome.

Here could be your advertisement!

Link to comment
Share on other sites

2 minutes ago, Is.M.L said:

I know I'm being lazy by asking this, and that I could "try and error" the whole thing, but since I don't have access to a PC right now, sorry for the question, but how do I implement IClientCommand properly? Could you give me an example where the /nether command translates to a /warp nether command? (client gets /nether, handles it and issues a true command /warp nether instead)

There is a warp command? What does it do? Or are you playing on a bukkit server? Cause some bukkit servers don't allow clients with forge to join.

  • Like 1

Here could be your advertisement!

Link to comment
Share on other sites

19 minutes ago, Jacky2611 said:

There is a warp command? What does it do? Or are you playing on a bukkit server? Cause some bukkit servers don't allow clients with forge to join.

I'm not an admin, and no, no bukkit. The server is forge modded. I just create these commands to enhance my own gameplay, and if they work, my friends' gameplay. I just want to know the correct way to implement and handle IClientCommand

Link to comment
Share on other sites

  • 2 weeks later...
On 22/07/2017 at 9:17 AM, diesieben07 said:

It's an interface. You implement it on your command class. You know Java, right?

Yes, I do. I know how to implement an interface, that's not my point. I know how to implement Map<K, V> properly, but I also could implement it wrong. The interface doesn't care, as long as the methods are implemented and return the expected value type (or even if they thrown an exception every time, that's still considered an implementation of the interface); there is no enforcing contract on what the method should actually do. I was asking how to implement IClientCommand properly.

Thanks for the help, nonetheless. I gave up on this particular project, as I took a break from gaming shortly after asking this, only now I'm returning.

Link to comment
Share on other sites

  • 2 months later...
1 minute ago, herrwasserfall said:

Where can I find the Javadocs for forge?

In the class itself. 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

On 7/21/2017 at 4:58 PM, Is.M.L said:

I know I'm being lazy by asking this, and that I could "try and error" the whole thing

Yes, sorry it is too lazy to ask this. Why ask other people to go to their PC, open up their IDE, find the interface class, then type it up for you here?

 

People asking questions here don't seem to understand that the people answering here have to work -- DO RESEARCH -- to come up with the answers. It is only fair to ask others to work for you when (a) you just need an initial hint (which diesieben07 already gave you), (b) you've tried yourself (c) the answer might also be interesting to that person. 

 

And the "whole try and error" approach is what people should be doing to learn.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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