Custom Classes Plugin Help

Hello guys, it has been a while since I have logged on, been away, anyway back to the question. In an earlier post I posted about how to learn how to code plugins etc. I have recently realised the first sponge API is available, which means I can start to code my dream server plugins.

I have basic coding knowledge, but I don’t know where to start, although not knowing everything on he his subject I am very dedicated to getting this completed. The plugin general idea I have is my own classes system, where the player can choose a certain class, get special traits for that class and simply fit into my project rpg server.

I have a plugin in mind, and I know it may be difficult to handle:

  • It must have a simple access classes, easy for players to select their classes, preferably in a chest look alike menu.
  • It must show a list of the classes special abilities/traits when the player’s mouse hovers over the icon for the class.
  • I was thinking of basic classes to start, such as a warrior, an archer and possibly a Mage later on.
  • It would be nice if the player is able to change with certain requirement later in the game, although this isn’t needed.

All in all the plugin must be a chest menu containing different icons which when clicked assigns the chosen class to the player, giving them the special traits the class has.

I have traits/abilities in mind such as:

  • Damage increase using a sword or axe with the warrior.
  • Fire arrows (not the enchantment) for the archer for the cost of 2 arrows, (basic idea)
  • Cobweb arrows for the archer (when the arrow hits the floor it spawns cobwebs in a radius of 1-2) could cost 3 arrows.
  • Teleport spell for the Mage, (cast it by right clicking) (change between spells by left clicking).
  • Fireball spell for the Mage, (summons a fireball by right clicking where the player is facing)

This is the basic idea, I just need to know how to start, by the way I am using eclipse to code my plugins, any help would be very much appreciated

I would love to know how to start this plugin, how to make the traits, and most importantly how to organise and add a menu for the player to select their class.

Thanks a lot for the help, and great work from the developers!!!

Note: I forgot to mention, for the Mage class I would preferably like to have a mana bar, which will increase/decrease to replace the cost of the spells (colour blue) and possibly a green bar to represent energy which would act as mana for the archers, warriors and other classes. How would I go about doing this?

Danielfrogs

Things I always do when I start a new plugin:

  1. what commands are available to the players?
  2. what commands are available for staff?
  3. am I going to save data on a per-player base?
    3.1. what kind of database?
  4. customizable config file, or hardcoded options (non-changeable)?

After you’ve decided all of those things, sit down and write(/type) down what each trait level/rank/class will have, and what levels they’ll be at. As well as the requirements to rank up to the next level inside the class.


Now, I don’t want to spoonfeed you code, and it seems you already have your ideas, so here’s what I can help you with:

Last I checked, the inventory section of the API isn’t finished, and that’s what you need for the chestGUI (“chest look alike menu”).

By classes you mean ranks for players right? Not actual Java classes. (although you could organize your info that way).

Get everything organized before-hand, or you’ll just end up confusing yourself later on.

If you have a question, look it up before asking. Chances are someone else has already asked it.

And lastly, my personal motto: “1 minute of coding for every 10 minutes of research”. :slight_smile:

3 Likes

Thanks for your reply @octoshrimpy. And yes by classes I mean classes the player will choose, not Java classes. I will sit down and type a detailed plan, and if I need help I’m sure I can ask on the forums. Thanks a lot!!

1 Like

I’ve been working on developing a plugin that matches a lot of what you have in mind: KraftRPG and lately after SpongeAPI is further along (still working on parts of SpongeAPI for completeness. Let me know what you think!

Hello @gabizou I Love the idea you have, its great! I wanted to code my own plugins, so I can use them on my project rpg server, I like the skills section, allowing the player to choose his/her own skills. I would do this in my plugin later on down the lines, but just want a working basic one to start. Maybe we could work together on the ideas, not to work on each others plugins, but to just give ideas and advice, this would help me out a lot as I am sort of new to this. Let me know below!

Hello again all, I have completed the plan @octoshrimpy told me to do, and I now know my ideas, although as for the special spells & abilities for each class, is it possible for he player to choose these in the game by going to buy them from an npc with in game money, but to also start with starter abilities.

Any ideas would help, and does anyone know when the inventory GUI is available to use?

Thanks guys,
danielfrogs

In order to save yourself from confusion and a loss of time, find your major parts of your plugin, and divide them into packages, then keep dividing them into classes and etc. Break larger problems into smaller ones in a logical order, and try not to jump in between two completely different areas of the code. I made this mistake plenty of times myself, and heck I still do. From What I can tell you have a: Database section, Inventory Section, Combat Section, and Ability Section. It seems like your combat system will be primarily if not all event based, so do some research on events. I would also recommend familiarizing yourself with databases if you did not already.

1 Like

You could very well customize the NPC’s inventory for sale and place an NBT item, that when clicked gives the player a certain ability, but I am not sure if those features are implemented in the api yet.

Thank @Moonseeker12 when you say organise all the parts into different packages, do you mean having those parts in 1 package and have various Java Classes in that 1 package?

And because nothing I need is in the API yet, what could I currently start on? Is there any way to make custom mana/energy bars later on?

Sorry for all those questions, but thanks a lot for your help!!!

danielfrogs

For example have this:
com.danielfrogs.rpgclasses.database
(And have these example classes under it)

  • write
  • read
  • initialize
  • close
  • etc
    Those are just crude examples, feel free to order the classes however you feel best and most logical for your application.

In terms of what you can start on just think about what you want to do and practice writing it in pseudo code, or placeholder code that acts as notes for you to implement in the future, if you cannot write it with the current API. Also yes you can manipulate various bars such as the xp bar, Boss Health bar, oxygen bar, etc to fulfill the mana bar idea.