Send the unjail message and also execute the commands on releasing

This commit is contained in:
graywolf336 2013-12-31 13:25:06 -06:00
parent 0ceef58e73
commit 506ab26858
3 changed files with 11 additions and 0 deletions

View File

@ -28,6 +28,7 @@ Done
* Config value ``jailing.during.maxFoodLevel`` is now used in one part * Config value ``jailing.during.maxFoodLevel`` is now used in one part
* Config value ``jailing.during.minFoodLevel`` is now used in one part * Config value ``jailing.during.minFoodLevel`` is now used in one part
* Config value ``jailing.release.teleport`` is used in unjailing * Config value ``jailing.release.teleport`` is used in unjailing
* Config value ``jailing.release.commands`` 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)
==== ====

View File

@ -351,5 +351,14 @@ public class PrisonerManager {
pl.getJailIO().removePrisoner(jail, prisoner); pl.getJailIO().removePrisoner(jail, prisoner);
jail.removePrisoner(prisoner); jail.removePrisoner(prisoner);
} }
//Get the commands to execute prisoners are unjailed
//replace all of the %p% so that the commands can have a player name in them
for(String command : pl.getConfig().getStringList(Settings.COMMANDSONRELEASE.getPath())) {
command = command.replaceAll("%p%", player.getName());
pl.getServer().dispatchCommand(pl.getServer().getConsoleSender(), command);
}
player.sendMessage(pl.getJailIO().getLanguageString(LangString.UNJAILED));
} }
} }

View File

@ -3,6 +3,7 @@ package com.graywolf336.jail.enums;
public enum Settings { public enum Settings {
BROADCASTJAILING("jailing.jail.broadcastJailing"), BROADCASTJAILING("jailing.jail.broadcastJailing"),
COMMANDSONJAIL("jailing.jail.commands"), COMMANDSONJAIL("jailing.jail.commands"),
COMMANDSONRELEASE("jailing.release.commands"),
DEBUG("system.debug"), DEBUG("system.debug"),
DEFAULTJAIL("jailing.jail.defaultJail"), DEFAULTJAIL("jailing.jail.defaultJail"),
DELETEINVENTORY("jailing.jail.deleteInventory"), DELETEINVENTORY("jailing.jail.deleteInventory"),