Velocity punishment is a punishment plugin designed for
velocity.
Please not that this plugin is in its development stage at the moment and has not been release fully yet.
- Download the latest version of the plugin
- Put the downloaded file into the
plugins
folder of your server. - (Re-)Start the server.
Replace {version}
with the current version, e.g. 1.0.0. Note that the artifacts are not yet published.
legend:
- <arg> means the argument is required
- [arg] means the argument is optional
- player as argument name means the a player name OR uuid is required
- reason means a reason with legacy color codes
- duration as argument name means a duration
- /ban <player> [reason] bans a player permanently for the given or the default reason
- /mute <player> [reason] mutes a player permanently for the given or the default reason
- /punishment <playerinfo> <player> shows information about a player's punishments
- /punishment <cancel|change|info|remove> <punishment id> cancels/removes, changes or shows information about the given punishment(must be a uuid)
- /tempban [reason] bans a player for the given duration for the given or the default reason
- /tempmute [reason] mutes a player for the given duration for the given or the default reason
- /unban unbans the given player
- /unmute unmutes the given player
To be parsed by PunishmentDuration#parse(String)
, a string must follow this scheme:
[0-9][s, m, h, d]
s - second(s)
m - minute(s)
h - hour(s)
d - day(s)
These value can be composed, all of them can be omitted.
Example: 1d12h15m30s means a duration of 1 day, 12 hours, 15 minutes and 30 seconds.
repositories {
mavenCentral()
}
depenencies {
implementation("de.jvstvshd.punishment.velocity:api:{version}")
}
repositories {
mavenCentral()
}
dependencies {
implementation 'de.jvstvshd.punishment.velocity:api:{version}'
}
<dependencies>
<dependency>
<groupId>de.jvstvshd.punishment.velocity</groupId>
<artifactId>api</artifactId>
<version>{version}</version>
</dependency>
</dependencies>
If the plugin is used, you can obtain an instance of the api using the following snippet:
try {
VelocityPunishment api = (VelocityPunishment) server.getPluginManager().getPlugin("velocity-punishment").orElseThrow().getInstance().orElseThrow();
} catch(NoSuchElementException e) {
logger.error("Punishment API is not available");
}
All punishments are imposed via the punishment manager (obtainable via VelocityPunishment#getPunishmentManager). For example, banning a player could be done this way:
PunishmentManager punishmentManager = api.getPunishmentManager();
//temporary ban:
Ban temporaryBan = punishmentManager.createBan(uuid, Component.text("You are banned from this server.").color(NamedTextColor.RED), PunishmentDuration.parse("1d"));//1d equals 1 day, the duration is relative to the current time until the punishment is imposed.
//permanent ban:
Ban permanentBan = punishmentManager.createPermanentBan(uuid2, Component.text("You are banned permanently from this server").color(NamedTextColor.RED))
//To finally punish the player, use Punishment#punish which will return a CompletableFuture with the punishment was imposed
temporaryBan.punish().whenCompleteAsync((ban,throwable) -> {
if (throwable != null) {
logger.error("Error punishing player", throwable);
return;
}
logger.info("The player was successfully banned. Punishment id: " + ban.getPunishmentUuid());
});
Muting a player is similar, just replace 'ban' with 'mute'.