#Command framework help

1 messages · Page 1 of 1 (latest)

median flower
#

How would i design someting like this:

public class FactionCommand {

  private Faction core;

  // Setting the base command
  @CommandMeta(name="faction", aliases={"f"})
  public void faction(CommandInfo command) {
    Sender sender = command.getSender();
    // bla bla   
  }

  @CommandMeta(name="list", permission="faction.list.command", usage="&7/&f{command} {name}")
  public void list(CommandInfo command) {
    Sender sender = command.getSender();
    this.core.getFactions().foreach(faction -> sender.sendMessage(faction));   
  }
}```
#

I just know that i will need to use an annotation processor

bright hemlock
#

if you don't know how to properly process annotations your in way above your head

median flower
#

I know how to process annotation more or less

#

But my issue is that i dont know how to identify which is an executor (called faction here), an argument (called list here) and sub commands

#

In this case a sub command isnt shown

fleet zealot
#

use reflections

#

Create your own custom annotations in Java!
Thanks to Mailgun for sponsoring this video! Head to https://mailgun.com/john to try Mailgun today.

Complete Java course: https://codingwithjohn.thinkific.com/courses/java-for-beginners

Annotations are a really cool part of the Java language. Many developers know how to use annotations, but not so ma...

▶ Play video
crisp epoch
#

use cloud

#

👍

#

that is my sole contribution to this discussion

fleet zealot
#

acf 🥺

bright hemlock
#

Use lamp 🔦

fleet zealot
#

only when dark

median flower
#

Bruh

#

I know how anottation works

#

But i dont know how to make identifications

#

To now when the method is a executor, argument or a sub command

#

I dont know if i do it via annotation or what

bright hemlock
#

its just another annotation

#

you can just process them in a specific order within a class first look for command if multiple you're safe to throw an error

#

than if no error move down to subcommands etc

#

I reccomend doing this in some sort of markup interface that way there are less error possabilities