Implement the usage of Scoreboards, make the language configurable.

Closes #15
This commit is contained in:
graywolf336
2014-03-13 12:59:47 -05:00
parent 6ce05dbe7d
commit ec1e91cda2
9 changed files with 178 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import com.graywolf336.jail.beans.Jail;
import com.graywolf336.jail.beans.Prisoner;
import com.graywolf336.jail.command.CommandHandler;
import com.graywolf336.jail.command.JailHandler;
import com.graywolf336.jail.enums.Settings;
@ -33,6 +34,7 @@ public class JailMain extends JavaPlugin {
private JailStickManager jsm;
private JailTimer jt;
private PrisonerManager pm;
private ScoreBoardManager sbm;
private boolean debug = false;
public void onEnable() {
@ -79,6 +81,7 @@ public class JailMain extends JavaPlugin {
}
jt = new JailTimer(this);
sbm = new ScoreBoardManager(this);
getLogger().info("Completed enablement.");
}
@ -96,6 +99,7 @@ public class JailMain extends JavaPlugin {
io.closeConnection();
jt = null;
sbm = null;
cmdHand = null;
pm = null;
jm = null;
@ -140,6 +144,23 @@ public class JailMain extends JavaPlugin {
return true;//Always return true here, that way we can handle the help and command usage ourself.
}
/** Reloads the scoreboard manager class, useful when something is changed int he config about it. */
public void reloadScoreBoardManager() {
this.sbm.removeAllScoreboards();
this.sbm = null;
this.sbm = new ScoreBoardManager(this);
if(getConfig().getBoolean(Settings.SCOREBOARDENABLED.getPath())) {
for(Jail j : jm.getJails()) {
for(Prisoner p : j.getAllPrisoners()) {
if(getServer().getPlayerExact(p.getName()) != null) {
this.sbm.addScoreBoard(getServer().getPlayerExact(p.getName()), p);
}
}
}
}
}
/** Gets the {@link HandCuffManager} instance. */
public HandCuffManager getHandCuffManager() {
return this.hcm;
@ -165,6 +186,11 @@ public class JailMain extends JavaPlugin {
return this.jsm;
}
/** Gets the {@link ScoreBoardManager} instance. */
public ScoreBoardManager getScoreBoardManager() {
return this.sbm;
}
/** Returns if the plugin is in debug state or not. */
public boolean inDebug() {
return this.debug;