Resource in spigotmc.org & dev.bukkit.org
A simple jails system Bukkit plugin aimed for most Minecraft versions.
It lets you manage jails, jail offline players, and sentence time will be over when prisoners have been online for the required time.
/setjail <jail name>/ Adds a new jail location where the command is executed./deljail <jail name>/ Removes a jail location from the jails list./modjail <jail name> releaselocation set/ Sets the location where the command is executed to be the "release location" of the jail. This is where players will be put when they are released from that specific jail. This is optional. If not provided, the player will be released to wherever they were before imprisonment./modjail <jail name> releaselocation clear/ Clears the "release location" of the jail./jails/ Prints a list of available jails./jail <player> <jail> <time> [reason]/ Sends a player to the provided jail, and won't be teleported back until the time provided has passed. Time format matches inputs in the format of2d15h7m12s. The command optionally takes an imprisonment reason./jail info <player>/ Will print out in the chat some information about the jailed player stored in the player data file./unjail <player> [teleport]/ Releases an imprisoned player, (optionally) teleporting them back to the- location they were when jailed.
/jailtime <player> (add|subtract|set) <time>/ Increase, reduce, or set the sentence time of a prisoner./betterjails/ Prints the version of the plugin./betterjails reload/ Reloads files into memory./betterjails save/ Saves files from memory.
All permissions default to operators only unless otherwise noted.
betterjails.jail/ Lets the user execute the/jailcommand.betterjails.jail.exempt/ The user with this permission cannot be jailed by others (unless offline, but it runs check when joining).betterjails.jails/ Lets the user execute the/jailscommand.betterjails.unjail/ Lets the user execute the/unjailcommand.betterjails.setjail/ Lets the user execute the/setjailcommand.betterjails.modjail/ Lets the user execute the/modjailcommand.betterjails.deljail/ Lets the user execute the/deljailcommand.betterjails.jailtime/ Lets the user execute the/jailtimecommand.betterjails.receivebroadcast/ Prints in the user's chat when a player has been jailed/unjailed.betterjails.betterjails/ Lets the user execute the/betterjailscommand. Permission defaults to true for all users.betterjails.betterjails.reload/ Lets the user execute the/betterjails reloadcommand.betterjails.betterjails.save/ Lets the user execute the/betterjails savecommand.
backupLocation: Coordinates of an unjail backup location, just in case the prisoner's last location is found corrupt.
offlineTime: Whether the prisoner has to be online for sentence time to count.
Value: Boolean (true or false)
changeGroup: Whether the player's group should be changed when jailed.
Requires Vault!
Value: Boolean (true or false)
prisonerGroup:
If changeGroup is set to true, the group name to which the player should be moved when jailed.
Value: String (group name)
autoSaveTimeInMinutes: The time interval in minutes between each time when data files get saved. Set to 0 to disable the autosaving feature.
Value: Integer (a whole number, c'mon...)
messages: Various messages that pop up when doing commands.
This is pretty straight-forward.
All of this is inside subcommands.yml.
The commands under as-prisoner will be executed as if the prisoner performed them, and the ones
under as-console will be executed as if they were sent from the console.
All the commands under on-jail will be executed when the player is sent to jail; and the ones
under on-release will be executed when the player gets released from jail.
All the commands will only be performed when the player is online. If they are jailed/released while offline, they will be executed when they get online.
BetterJails now ships with a developer API! Plugin developers can now interact with B.J., listen to specific events, create jails, release prisoners and much more.
The BetterJails interface is the heart of the API, in there you can access all the other interfaces you need to work with B.J.:
- A
PrisonerManagerin which you can retrieve prisoners, jail players and release prisoners - A
JailManagerin which you can create and delete jails - An
EventBuswhere you can subscribe (or "listen") to certain events dispatched throughout the functioning of the plugin.
You can get an instance of the BetterJails interface through the services manager as follows:
public class MyPlugin extends JavaPlugin {
private BetterJails betterJails;
public BetterJails getBetterJails() {
return this.betterJails;
}
@Override
public void onEnable() {
this.betterJails = getServer().getServicesManager().load(BetterJails.class);
}
}Don't forget to add "BetterJails" as depend/softdepend to your plugin.yml :)
The API is published in Maven Central Repository and snapshots are published to OSS Sonatype Snapshots repository. Importing the BetterJails API to your project depends on how you build your plugin.
If you are using Maven, all you have to do is add the dependency itself that will be pulled from Central
<dependency>
<groupId>io.github.emilyy-dev</groupId>
<artifactId>betterjails-api</artifactId>
<version>1.6</version>
<scope>provided</scope>
</dependency>Same principle applies if you are using Gradle to build your plugin, but you need to specify the mavenCentral() repo:
repositories {
mavenCentral()
}
dependencies {
compileOnly 'io.github.emilyy-dev:betterjails-api:1.6'
}repositories {
mavenCentral()
}
dependencies {
compileOnly("io.github.emilyy-dev:betterjails-api:1.6")
}If you want to manually add the API dependency to your classpath, you can obtain the jar by downloading it from here.
You can compile this plugin by cloning the repository and running ./gradlew build in the root
directory of the project, you can find the final jar in ./betterjails/build/libs/betterjails-1.6.jar.