Add a config value to set their gamemode to. Also, eject them.
This commit is contained in:
		| @@ -22,6 +22,7 @@ Done | |||||||
| * Config value ``jailing.jail.deleteInventory`` is now used | * Config value ``jailing.jail.deleteInventory`` is now used | ||||||
| * Config value ``jailing.release.backToPreviousPosition`` is now used | * Config value ``jailing.release.backToPreviousPosition`` is now used | ||||||
| * Config value ``jailing.release.restorePreviousGameMode`` 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) | [Jail 3.0 JavaDoc](http://ci.graywolf336.com/job/Jail/javadoc) | ||||||
| ==== | ==== | ||||||
| @@ -1,5 +1,6 @@ | |||||||
| package com.graywolf336.jail; | package com.graywolf336.jail; | ||||||
|  |  | ||||||
|  | import org.bukkit.GameMode; | ||||||
| import org.bukkit.entity.Player; | import org.bukkit.entity.Player; | ||||||
|  |  | ||||||
| import com.graywolf336.jail.beans.Cell; | import com.graywolf336.jail.beans.Cell; | ||||||
| @@ -122,5 +123,15 @@ public class PrisonerManager { | |||||||
| 		if(pl.getConfig().getBoolean(Settings.RESTOREPREVIOUSGAMEMODE.getPath(), false)) { | 		if(pl.getConfig().getBoolean(Settings.RESTOREPREVIOUSGAMEMODE.getPath(), false)) { | ||||||
| 			prisoner.setPreviousGameMode(player.getGameMode()); | 			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(); | ||||||
|  |     	} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ public enum Settings { | |||||||
| 	DEFAULTJAIL("jailing.jail.defaultJail"), | 	DEFAULTJAIL("jailing.jail.defaultJail"), | ||||||
| 	DELETEINVENTORY("jailing.jail.deleteInventory"), | 	DELETEINVENTORY("jailing.jail.deleteInventory"), | ||||||
| 	JAILDEFAULTTIME("jailing.jail.defaultTime"), | 	JAILDEFAULTTIME("jailing.jail.defaultTime"), | ||||||
|  | 	JAILEDGAMEMODE("jailing.jail.gameMode"), | ||||||
| 	LOGJAILING("jailing.jail.logToConsole"), | 	LOGJAILING("jailing.jail.logToConsole"), | ||||||
| 	RELEASETOPREVIOUSPOSITION("jailing.release.backToPreviousPosition"), | 	RELEASETOPREVIOUSPOSITION("jailing.release.backToPreviousPosition"), | ||||||
| 	RESTOREPREVIOUSGAMEMODE("jailing.release.restorePreviousGameMode"), | 	RESTOREPREVIOUSGAMEMODE("jailing.release.restorePreviousGameMode"), | ||||||
|   | |||||||
| @@ -22,6 +22,7 @@ jailing: | |||||||
|     defaultJail: nearest #the jail nearest to the player |     defaultJail: nearest #the jail nearest to the player | ||||||
|     defaultTime: 30m #default the time to 30 minutes, if no time |     defaultTime: 30m #default the time to 30 minutes, if no time | ||||||
|     deleteInventory: false |     deleteInventory: false | ||||||
|  |     gameMode: adventure | ||||||
|     logToConsole: true |     logToConsole: true | ||||||
|     logToProfile: false |     logToProfile: false | ||||||
|     storeInventory: true |     storeInventory: true | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 graywolf336
					graywolf336