use of io.github.nucleuspowered.nucleus.modules.jail.handlers.JailHandler in project Nucleus by NucleusPowered.
the class JailModule method performEnableTasks.
@Override
public void performEnableTasks() {
createSeenModule(CheckJailCommand.class, (c, u) -> {
// If we have a ban service, then check for a ban.
JailHandler jh = Nucleus.getNucleus().getInternalServiceManager().getService(JailHandler.class).get();
if (jh.isPlayerJailed(u)) {
JailData jd = jh.getPlayerJailDataInternal(u).get();
Text.Builder m;
if (jd.getRemainingTime().isPresent()) {
m = NucleusPlugin.getNucleus().getMessageProvider().getTextMessageWithFormat("seen.isjailed.temp", Util.getTimeToNow(jd.getEndTimestamp().get())).toBuilder();
} else {
m = NucleusPlugin.getNucleus().getMessageProvider().getTextMessageWithFormat("seen.isjailed.perm").toBuilder();
}
return Lists.newArrayList(m.onClick(TextActions.runCommand("/checkjail " + u.getName())).onHover(TextActions.showText(NucleusPlugin.getNucleus().getMessageProvider().getTextMessageWithFormat("standard.clicktoseemore"))).build(), NucleusPlugin.getNucleus().getMessageProvider().getTextMessageWithFormat("standard.reason", jd.getReason()));
}
return Lists.newArrayList(NucleusPlugin.getNucleus().getMessageProvider().getTextMessageWithFormat("seen.notjailed"));
});
}
use of io.github.nucleuspowered.nucleus.modules.jail.handlers.JailHandler in project Nucleus by NucleusPowered.
the class JailModule method performPreTasks.
@Override
protected void performPreTasks() throws Exception {
try {
Nucleus nucleus = Nucleus.getNucleus();
JailHandler jh = new JailHandler(nucleus);
Sponge.getServiceManager().setProvider(nucleus, NucleusJailService.class, jh);
serviceManager.registerService(JailHandler.class, jh);
// Context
Sponge.getServiceManager().provide(PermissionService.class).ifPresent(x -> x.registerContextCalculator(jh));
} catch (Exception ex) {
Nucleus.getNucleus().getLogger().warn("Could not load the jail module for the reason below.");
ex.printStackTrace();
throw ex;
}
}
Aggregations