#Command framework

1 messages · Page 1 of 1 (latest)

prime mountain
#

I have designed a command framework for making creation commands faster. than rather losting time registering them thru plugin.yml, configuring all their permission, child permissions, etc. So for working i created the next structure of code:

Command contains the fields-getters-setters (name, alias, permission, description and usage)

SingleCommand representing a simple command, like does the CommandExecutor from Bukkit

ParentCommand representing a group of associated commands, meaning that they can contain SingleCommand or SingleCommand.

#

I face some issues with it, because when getting the outputs on sub commands. They seem to be not including their parent informaiton, meaning that if the father is /faction, when doing display to console i cant access to faction name, alias, etc

#

@steep sigil i wish you could help me to fix it

#

Here you can see what i mean. If you see carefully, the output is /points aa. Is not putting first the "factioN"

steep sigil
#

how are you registering them?

prime mountain
#

right

#

I have the next structure

#

I sent before

#

let me find it

#

plugin here

#

Command for testing the framework

#

Sub command associated to faction

steep sigil
#

what is CommandAPI

prime mountain
#

Argument associated to Faction

prime mountain
#

I can send it via paste

#

?paste

sacred whaleBOT
prime mountain
steep sigil
#

you're registeringa new Base command for each one

#

that's why its not showing up under /factions

#

at least that's what i appears. you have abstracted all of this stuff to the point where most people are not going to bother sifting through it, unfortunately

prime mountain
#

what?

#

I creating only 2 BaseCommand one for handling faction and the other for heal

steep sigil
#

can i see parent command

prime mountain
#

yeah

steep sigil
#

base command

prime mountain
#

ok

steep sigil
#

you have so many abstractions

prime mountain
#

Really thanks man for trying to give a hand, i have been 12 hours. Some of then losting recoding it and other debugging

steep sigil
#

your register for the sub args/sub commands .. its just adding "children", but where does it do anything with them

#

nvm i see

#

can i see PointsList

prime mountain
#

yes ofc

steep sigil
#

ugh, more abstraction

#

man this is a pain

#

why are you doing so much

prime mountain
#

why?

steep sigil
#

you have your shit scattered across like 20 files just to register a command

#

for what reason

prime mountain
#

Luckperms does the same

steep sigil
#

hah

#

what happens when you do /factions list

prime mountain
#

works perfect

steep sigil
#

wait, what

prime mountain
#

the issue is only when using sub commands

steep sigil
#

oh lol

prime mountain
#

meaning that when do /faction points, gives thelp which is okay

steep sigil
#

can i see points

prime mountain
#

ye

#

want to do call?

#

so its faster?

steep sigil
#

no

prime mountain
#

ok np

steep sigil
#

so you should be able to do /factions points list?

#

or am i not understanding that

prime mountain
#

let say if do: /faction points noneRegistered - shouws the invalid argument message wrong

#

Because appears as: "invalid usage /points noneRegistered" rather than "invalid usage /faction points noneRegistered"

steep sigil
#

well you do have points as a "ParentCommand"

prime mountain
#

Yes

steep sigil
#

and you're upset that its treating it like one

prime mountain
#

he?

#

what you mean i struggled

steep sigil
#

the feedback is coming from the points command because its coded as a parent command

#

which im assuming are top level

prime mountain
#

wait i wil ltranslate that phrase

#

i dont catch where you trying to go meaning that phrase

#

I just want to know or fix, why i cant get the sub command parent data from a sub command do i explain?

steep sigil
#

i know man, i dont think i can help you. im not an expert enough to dig through all of your different abstractions. i am sorry about that

prime mountain
#

This is what i debug

#

Its pretty simple what happens just is wrongly code the ParentCommand class

steep sigil
#

i agree

#

that's what i was saying

prime mountain
#

ok

#

have you seen the cap?

steep sigil
#

parent command means top leve command

prime mountain
#

yeah

steep sigil
#

so that's why points thinkgs its top level

#

that much makes sense

prime mountain
#

the problem is that when sending details about errors i need to access to the whole command sequence. Do i explain?

#

So if an error ocurre inside points, i would have to get access to faction, for example for getting its name or usage. Do i explain now?

steep sigil
#

yes. points should probably not be parent command

prime mountain
#

why not?

steep sigil
#

because it isnt one

#

its clearly a child command of factions

prime mountain
#

yes it child of factions, but points contains his own childs too, so ends up in a father ¿?

#

Isnt it

steep sigil
#

yes, but in what class are you actually registering the command with bukkit?

#

ParentCommand?

prime mountain
#

Inside base command its parse the plain command from Bukkit, by extending BukkitCommand

steep sigil
#

so this probably finds /factions

#

and then calls execute on factions

#

bro i dunno, im sorry

prime mountain
#

na

#

Its perfect

#

i was really confuse too, the first time when seen luckperms cmds structure

#

you are struggling as me right now

steep sigil
#

just use cloud

#

its worth the learn

#

it handles things you've never even though of yet

prime mountain
#

😬

#

will try but cant adjust to 3d party really well

#

its based on annotations i cant support them

steep sigil
#

its not based on annotations.

#

its just a way to do it