Laborus - a completely customizable job plugin

Laborus

a Minecraft job plugin for Sponge

  1. Features
  2. How to use
  3. Configuration
  4. Jobs
    1. Actions
    2. Boni
    3. Ability
  5. Commands
  6. Translation
  7. Contribution

Features

  • Jobs in Minecraft
  • reward the placing and destroying of Blocks, the using of items and the killing and taming of mobs
  • Job Abilities that eg. allow you to destroy blocks faster for 3 minutes every two hours
  • anti replace farming system that blocks the rewarding of the placing and destroying of blocks on the same spot so the economy isn’t as easily exploidable
  • only allow doing the actions (eg. destroying of a block) after a specific level
  • Job Boni like special or multiple drops or repairing of items
  • completly configurable and translatable

A full lists of all possible actions, boni and abilities you can find in the Configuration section.

How to use

To use this plugin you need a Sponge Server that is supporting the SpongeApi Version 4.0.
If you have a Server like this you only need to place the pluginfile into the mods folder.
When you have done this and you have started and stopped the server the default configuration file will automaticly be added, but you still need to add the jobs you want to have to this file due to the missing of jobs in the default configuration.
Some ready configuration files you can find in the jobs folder in this repo. These files you can just copy and paste into the configuration folder of the plugin and link them in the configuration file (de.lergin.sponge.jobs.conf) like this:

jobs: {
  miner: "miner.conf"
  woodcutter: "woodcutter.conf"
}

Commands

/jobs addXP [player]

This command adds the given amount of xp to the xp of the job.

Permission: laborus.commands.addXp

Permission for player arg: laborus.commands.addXp.outher_player

/jobs change <join|leave>

Joins or leaves the job. A job that is joined can give more xp for actions and special boni. The amount of jobs that can be joined can be limited.

Permission: none / can be set in the config

/jobs toggle

Activates or deactivates the job system for the player that executes this command.

Permission: laborus.commands.toggle

/jobs ability

Starts the ability of the job.

Permission: laborus.commands.ability

Configuration

Jobs

General settings
Name Description Default value
name the display name of the job “”
description a description of the job “”
use_default_level does the job uses the default levels true
level the levels of the job
see Level
[]
bonus a list of jobBoni []
ability the ability of this job
ACTION_NAME
-> needs to be replaced by the name of the action
the settings for the action {}

Actions

Settings for JobItems
Name Description Default value
xp the amount of xp the player gets if he does the action with this item 0.0
needLevel the level the player needs to have to do this action 0
Possible actions:
Name Description info
destroyBlocks for the destruction of blocks
placeBlocks placing of blocks
killEntities killing of entities can’t be canceled -> no needLevel
damageEntities damaging of entities
useItems interaction with the item in the hand (right and left click)
tameEntities when an entity is tamed

Boni

Settings
Name Description Default value
probability the probability the boni will be used at an action 0.05
sendMessage should a message be send to the player if the boni is rewarded false
message the message that will be send if sendMessage is true “”
condition.minLevel the min. level the player need to have to get this boni Integer.MIN_VALUE
condition.maxLevel the max. level the player is allowed to have to get this boni Integer.MAX_VALUE
condition.onlySelected only reward the boni if the job is selected true
condition.actions only reward if the action that starts this boni is in this list.
A comma separated list of actionNames within []
[] -> all actions will start the boni
condition.items only reward if the item that starts this boni is in this list.
A comma separated list of itemNames within []
[] -> all items will start the boni
Possible actions:
Name Works with Jobactions Description special config settings
multiDrop destroyBlocks, placeBlocks drops the item of the action another time itemMultiplier -> amount of items that should be droped extra
ep all drops some ep (not job xp) minEp -> minimum of ep droped
maxEp -> maximum of ep droped
itemRepair all, needs an item in the hand slot with durability repairs the item by a given percentage minPercentage -> minimum the item gets repaired
maxPercentage -> maximum the item gets repaired
itemDrop all drops an extra item itemType -> the itemType of the item
amount -> the amount of items that should be droped

Ability

Settings
Name Description Default value
name the name of the ability none
coolDown amount of seconds between uses 60
Possible abilities:
Name Desctription special config settings
effect adds a potion effect to the player amplifier -> effect level
duration -> amount of seconds the effect holds on
type -> potion type
particles -> should the particles not be hidden
ambience -> the ambience setting of a effect

Commands

Translations

Contribution

2 Likes
A couple of notes on the plugin
  • Rather than returning CommandResult.empty() on fail (especially with no message!), it’s a good idea to throw CommandException.
  • You don’t have to construct an array manually for CommandSpec.Builder#arguments, it’s a varargs; just put in all the CommandElements normally.
  • Use a PaginationList in InfoCommand rather than just repeatedly calling Player#sendMessage; it allows them to scroll through pages via clicking, doesn’t spam their chat, and adds a bit of helpful formatting.
  • If JobCommand implements CommandExecutor without implementing execute, then you can eliminate both the need for private classes and the getExecutor function.
  • Make sure to override toContainer on your immutable manipulator as well.
  • If JobDataManipulatorBuilder also extends AbstractDataBuilder, it adds auto-versioning - simply change the public method build to a protected method buildContent, and use the current version number in the call to super() in the constructor. Then, whenever you change the content version, update that number and register a DataContentUpdater, and the data will get updated automatically when first accessed.
  • Perhaps you could implement multi-currency support?
  • Noticing this in EffectAbility specifically, but might be other places - instead of calling orElse(new ArrayList<>()), call orElseGet(ArrayList::new) - this way, a new ArrayList won’t get created every single time the method is run.
  • In ItemRepair, you might also wanna test whether or not the durability is already 0, i.e. fully repaired.
  • In most of your listeners, the first thing in the top-level if statement, checking if the cause wrapper such as EntityDamageSource is in the Cause, is useless if you already are using annotated arguments. If you meant to check the name as well, you can add a @Named annotation to the EntityDamageSource argument.


Other than that, nice job.
1 Like

Tables don’t work here :confused:

1 Like

Completely is spelled wrong in the title. Sorry for being nitpicky :smile: .

2 Likes

I completly agree with you :thinking::sweat_smile:

Thanks for the feedback @pie_flavor, i will look into it when i have some more time left :slight_smile: Also thanks to @Inscrutable for fixing my spelling error…

1 Like