Ban a variety of item actions, including crafting a configured item, placing and breaking, picking up and more
Donations
Creating plugins for Sponge takes time and effort. If you enjoy the hard work I’ve put into to this please feel free to get my a cup of coffee. It is much appreciated.
Why do you not inject anything? Relying on static Sponge calls isn’t a very good way to get dependencies.
Rather than doing tab-completion yourself, and just using String for the command arguments, why not use the types you’re trying to get? e.g. GenericArguments.catalogedElement(key, ItemType.class)GenericArguments.world(key)GenericArguments.bool(key). This also saves you the trouble of parsing them, and the worry that you might do something wrong.
All the stuff you’re doing with Help can be done in setExtendedDescription(Text), which is a multiline Text that shows when you hover over it in the default /help menu. Retracted, they’re subcommands and Sponge subcommand help menus suck.
Also on the topic of commands: I’m confused as to why you’re specifying all arguments as optional, and saying that they didn’t type the command correctly if they were left out (which is the opposite of optional).
You can use anything implementing Translatable, including CatalogTypes such as ItemType, directly in Text.of(), and it will use the type’s display name (and localized, too!)
If the CommandSource is doing something wrong, it’s recommended to throw a CommandException instead of using CommandResult.empty().
If there’s nothing in their main hand, why not allow them to use the item in their off hand?
CMDWhatsThis.java:48 confuses the hell out of me. Internally, it’s stored as a byte. You then get it as an object, call toString(), and then parse an int out of it. Why not just use .getByte(query)?
While using the PaginationService technically follows the same route, why not just use PaginationList.builder()?
Rather than iterating over a list of Text and sending each one, why not just use CommandSource#sendMessages? And for that matter, why not send a paginated list to the source even if they’re not a player? While you can’t technically click the ‘forward’ and ‘back’ buttons in a command prompt, it’s just as easy to type /page next and etc.
Don’t just put @First, put @Root. Otherwise, the listener will trip even if the player was only slightly related, but was the only player involved.
Why do you create an ItemStack from the ItemStackSnapshot? I’d think it’d be the other way around, on other events - you’re not concerned with a live stack, you’re concerned with what the stack was at a specific moment.
Example:
/sban set world minecraft:stone
/sban set minecraft:wool:5
/sban set global minecraft:diamond --craft --break --drop --modify --pickup --place --use