Add a config value to set their gamemode to. Also, eject them.

This commit is contained in:
graywolf336 2013-12-25 23:20:52 -06:00
parent 23e7aa15a3
commit c35b3b04f0
4 changed files with 14 additions and 0 deletions

View File

@ -22,6 +22,7 @@ Done
* Config value ``jailing.jail.deleteInventory`` is now used
* Config value ``jailing.release.backToPreviousPosition`` is now used
* Config value ``jailing.release.restorePreviousGameMode`` is now used
* Config value ``jailing.jail.gameMode`` is now used
[Jail 3.0 JavaDoc](http://ci.graywolf336.com/job/Jail/javadoc)
====

View File

@ -1,5 +1,6 @@
package com.graywolf336.jail;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import com.graywolf336.jail.beans.Cell;
@ -122,5 +123,15 @@ public class PrisonerManager {
if(pl.getConfig().getBoolean(Settings.RESTOREPREVIOUSGAMEMODE.getPath(), false)) {
prisoner.setPreviousGameMode(player.getGameMode());
}
//Set their gamemode to the one in the config, if we get a null value
//from the parsing then we set theirs to adventure
player.setGameMode(GameMode.valueOf(pl.getConfig().getString(Settings.JAILEDGAMEMODE.getPath(), "ADVENTURE")));
//only eject them if they're inside a vehicle and also eject anyone else on top of them
if(player.isInsideVehicle()) {
player.eject();
player.getVehicle().eject();
}
}
}

View File

@ -6,6 +6,7 @@ public enum Settings {
DEFAULTJAIL("jailing.jail.defaultJail"),
DELETEINVENTORY("jailing.jail.deleteInventory"),
JAILDEFAULTTIME("jailing.jail.defaultTime"),
JAILEDGAMEMODE("jailing.jail.gameMode"),
LOGJAILING("jailing.jail.logToConsole"),
RELEASETOPREVIOUSPOSITION("jailing.release.backToPreviousPosition"),
RESTOREPREVIOUSGAMEMODE("jailing.release.restorePreviousGameMode"),

View File

@ -22,6 +22,7 @@ jailing:
defaultJail: nearest #the jail nearest to the player
defaultTime: 30m #default the time to 30 minutes, if no time
deleteInventory: false
gameMode: adventure
logToConsole: true
logToProfile: false
storeInventory: true