Hey fellas! So, to make it as short as possible here, I need to know how to determine if a command being executed is from "/execute" or not from the scope of the execute method in the command interface implementation. For example, if, let's say, popbob were to run the command "/summon tnt", and then if some other random player ran the command, "/execute popbob ~ ~ ~ summon tnt", from the scope accessible by the "execute" method of the summon command class, I need to be able to tell the difference between the one that was actually run by popbob and the one that was run by popbob as a result of another player making them use this command through the execute command. Now, this isn't really pertinent information needed to answer the above question, so if you are not interested then please skip past this paragraph, but I'm always open to answer the question of "why on earth do you want this?" First, for context, I play Minecraft with my friends on my own Minecraft server. HOWEVER, they do not really trust me completely with hosting a Minecraft server because they believe me to be a "little troll" (which they're not wrong btw). So the agreement I have with them is that every single one of us gets to have operator, that way we are not only all as close to equal as possible, but also so that we can check on each other independently. To make sure that each of us stays operator, and also so that we each don't actually abuse operator against other players too much, I disabled commands like /stop, /ban, /kick, and /deop for players, making it so these commands can only be executed on the server. However, I would come to find out that they would also seem to be "little trolls", and they would constantly do things like spawning in Tsar Bombs, using the open inventory command to make sure I wouldn't be able to pull the item from them, and blasting the entire server to smithereens. Now, I still don't want to take away their operator status, but when they're using commands to kill me constantly as well as demolishing everything in sight with nuclear bombs, it's kind of hard to actually stop them. So, in response, I created an item that was so powerful, anybody who had it would be completely unstoppable by any immediate means what-so-ever. This includes things like complete immunity to all forms of harm, including every single potion effect, the /kill command, the void, HBM nuclear explosions, the Avaritia Sword of The Cosmos, etc., and on top of that, it would provide protection from other nuisances they would try to use, like opening another player's inventory, the teleport command, and the gamemode command. But that's not the only insane thing the item provides, as it also allows players to fly at infinite speeds, create nuclear explosions, annihilate entire biomes, and kill any player no matter what, even if they have the Avaritia infinity armor. So, with all that being said, it's pretty clear that should one of my friends get their hands on this item, I would probably be f****d. The only way to get rid of the item from their inventory would be to manually use an inventory editor after either kicking them off the server or stopping it entirely. In an effort to ensure that nobody but me is able to control who has this item, I overwrote a bunch of commands to do nothing if my code detects that they're trying to spawn in the god item. However, there is one major caveat, that being that they could just use the execute command to make me run the give command, thus my code would determine that I am running the give command and proceed with the operation. I DON'T WANT THIS AT ALL, but I also don't want to restrict their freedoms by disabling the execute command. Hence, that's why I need to know how to detect a command being run by "/execute" or not.
By
Jackson Perr · Posted 12 hours ago 12 hr
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.