Home Hey, I want to run a command as a chicken
Post
Cancel

Hey, I want to run a command as a chicken

Today I write about the strangest email I have ever received in my inbox and how that lead to a week’s worth of programming.

It’s a nice Friday evening. I’m relaxing at my computer science friend’s house, solving a card puzzle that they created and thinking about the salmon they’re going to cook for me. I take a quick peek at my phone to check the time and I see a new e-mail notification on my phone. The email subject is [JorelAli/1.13-Command-API] Support changing sender entity via /execute (#2) and I decide to read the email right there and then.

This project is freaking awesome! I’ve been hunting for something that did exactly this - and got lucky on a google search that led me here.

I have been hunting for a way to run Spigot commands within functions and /execute. This project lets me do exactly that - because commands registered in this way are accessible to those vanilla mechanics.

However - though I can run my commands with /execute, the context of the command returned via the CommandExecutor is still the original sender of the command - not the “as” entity.

For example, I’d like to be able to do:

/execute as @e[type=chicken,limit=1] run myplugincommand

And I should be able to somehow get the chicken entity in my handler for the event. Spigot prior to 1.12.2 used to do this via the ProxyCommandSender - perhaps it would be possible to make use of this too?

Would like your thoughts on this - I’m inclined to hook this up myself and submit a pull request but it would help to have your input.

You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread

I stare in shock at the main example.

For example, I’d like to be able to do:

/execute as @e[type=chicken,limit=1] run myplugincommand

As far as I am concerned, I just received an email from a developer who would like my API to handle running commands as a chicken. Now, I’ve been playing Minecraft for over 8 years now and I must say that I’ve never heard of running a command as chicken, or in fact, anything else other than a player, a command block or the console.

After discussing with my computer science friends and writing a quick reply to the issue on GitHub, I decide to dismiss this request in my mind and deal with it when I arrive at a computer. I enjoy a wholesome meal of salmon, rice and vegetables, whilst discussing computer-related stories and the puzzle we were trying to solve.

After arriving home, I sit at my computer and begin work on this mysterious request. I discuss with this developer my views on why their method is invalid and I suggest a workaround solution to it. They agree that its a valid workaround, but inform me that they would like to see their method implemented at a later date. I implement the workaround for the API, receive more bugs to fix and manage to iron them all out. Now, I would probably not recommend staying up until 4am to fix bugs found by another developer, but it was the most programming fun I have had in ages.

Three days later, I receive another email from another developer. I must say, I’ve never seen anyone get so straight to the point before.

With the /execute as run you can change the command sender in vanilla. This doesn’t work in this API.

It was followed with a huge array of examples and a link to a wiki page explaining those examples. I check my timetable which reveals that I my next lecture was at 3pm the following day. “Time to pull another all-nighter”, I think to myself. Instead, however, I write what seemed like a hodge-podge essay on why their request could not actually be fulfilled due to constraints with how the Bukkit Minecraft servers were implemented. Over time, more developers begin to chip in, stating their opinions on why certain features should or should not be implemented. Eventually, I manage to create a compromise on what features I would implement and what features I would not and manage to implement the ultimate feature into my API - running a command as a chicken, as requested by the first developer.

This whole experience was the first time I’ve ever really used GitHub’s issues and I really got to experience collaboration on a whole new level. I felt like a superstar that was getting in touch with adoring fans and by discussing and attending to their requests (regardless of how ridiculous they seemed), it pushed my thinking and programming skills to the max in order to solve the issues as coherently and accurately possible.

To think that all of this started because someone wanted to run commands in Minecraft as a chicken.

This post is licensed under CC BY 4.0 by the author.

How not to fix an android battery

Return of the CommandAPI