Search in sources :

Example 1 with NoSuchLocationException

use of io.github.nucleuspowered.nucleus.api.exceptions.NoSuchLocationException in project Nucleus by NucleusPowered.

the class JailHandler method jailPlayer.

@Override
public boolean jailPlayer(User victim, String jail, CommandSource jailer, String reason) throws NoSuchLocationException {
    Preconditions.checkNotNull(victim);
    Preconditions.checkNotNull(jail);
    Preconditions.checkNotNull(jailer);
    Preconditions.checkNotNull(reason);
    NamedLocation location = getJail(jail).orElseThrow(NoSuchLocationException::new);
    return jailPlayer(victim, new JailData(Util.getUUID(jailer), location.getName(), reason, victim.getPlayer().map(Locatable::getLocation).orElse(null)));
}
Also used : NamedLocation(io.github.nucleuspowered.nucleus.api.nucleusdata.NamedLocation) JailData(io.github.nucleuspowered.nucleus.modules.jail.data.JailData) NoSuchLocationException(io.github.nucleuspowered.nucleus.api.exceptions.NoSuchLocationException)

Aggregations

NoSuchLocationException (io.github.nucleuspowered.nucleus.api.exceptions.NoSuchLocationException)1 NamedLocation (io.github.nucleuspowered.nucleus.api.nucleusdata.NamedLocation)1 JailData (io.github.nucleuspowered.nucleus.modules.jail.data.JailData)1