Jump to content

[1.7] Execute command


VoidCatz

Recommended Posts

Hey,

I tried to make an simple item, that executes a command when you right click. The command is stored as NBT data. It is for mapmakers, so it's only obtainable through the /give with NBT data tags. The item should work like a portable command block. Everyone can use it, even if he doesn't have the necessary rights to execute the command manually. But the only one who is able to create and hand out these items is the admin because he is the only one that can use the /give command. Now to my problem. I  overrode the onItemRightClick() method. Here is my code:  https://gist.github.com/VoidCatz/3be9f4b44d1334c20e67 (Gist) The problem is that the command is executed twice when I right click. The other problem is that non-op players can't execute op commands. How can I solve these problems?

Edit 1: The execute twice issue works now... I had to test if(!world.isClient()) To solve the other issue I will have to look into the abstract class CommandBlockLogic... I hate obfuscated code...

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.