Protect some of the constructors since we don't need more than one.
This commit is contained in:
parent
9ecfb92252
commit
3570a4b0ee
@ -30,7 +30,7 @@ public class HandCuffManager {
|
||||
private HashMap<UUID, Location> locs;
|
||||
|
||||
/** Constructs a new HandCuff Manager, for handling all the handcuffing. */
|
||||
public HandCuffManager() {
|
||||
protected HandCuffManager() {
|
||||
this.handcuffed = new HashMap<UUID, Long>();
|
||||
this.locs = new HashMap<UUID, Location>();
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class JailIO {
|
||||
private int storage; //0 = flatfile, 1 = sqlite, 2 = mysql
|
||||
private String prefix;
|
||||
|
||||
public JailIO(JailMain plugin) {
|
||||
protected JailIO(JailMain plugin) {
|
||||
this.pl = plugin;
|
||||
|
||||
String st = pl.getConfig().getString("storage.type", "flatfile");
|
||||
@ -60,7 +60,7 @@ public class JailIO {
|
||||
|
||||
/** Loads the language file from disk, if there is none then we save the default one. */
|
||||
@SuppressWarnings("deprecation")
|
||||
public void loadLanguage() {
|
||||
protected void loadLanguage() {
|
||||
String language = pl.getConfig().getString(Settings.LANGUAGE.getPath());
|
||||
boolean save = false;
|
||||
File langFile = new File(pl.getDataFolder(), language + ".yml");
|
||||
@ -97,7 +97,7 @@ public class JailIO {
|
||||
}
|
||||
|
||||
/** Prepares the storage engine to be used, returns true if everything went good. */
|
||||
public boolean prepareStorage(boolean doInitialCreations) {
|
||||
protected boolean prepareStorage(boolean doInitialCreations) {
|
||||
switch(storage) {
|
||||
case 1:
|
||||
try {
|
||||
@ -161,7 +161,7 @@ public class JailIO {
|
||||
*
|
||||
* @return The connection for the sql database.
|
||||
*/
|
||||
public Connection getConnection() {
|
||||
private Connection getConnection() {
|
||||
switch(storage) {
|
||||
case 1:
|
||||
case 2:
|
||||
@ -181,7 +181,7 @@ public class JailIO {
|
||||
}
|
||||
|
||||
/** Closes the sql connection. */
|
||||
public void closeConnection() {
|
||||
protected void closeConnection() {
|
||||
switch(storage) {
|
||||
case 1:
|
||||
case 2:
|
||||
@ -386,7 +386,7 @@ public class JailIO {
|
||||
/**
|
||||
* Loads the jails, this should <strong>only</strong> be called after {@link #prepareStorage(boolean)}.
|
||||
*/
|
||||
public void loadJails() {
|
||||
protected void loadJails() {
|
||||
switch(storage) {
|
||||
case 1:
|
||||
case 2:
|
||||
@ -721,7 +721,7 @@ public class JailIO {
|
||||
*
|
||||
* @param j The jail to save.
|
||||
*/
|
||||
public void saveJail(Jail j) {
|
||||
protected void saveJail(Jail j) {
|
||||
if(j.isEnabled()) {
|
||||
switch(storage) {
|
||||
case 1:
|
||||
@ -1010,7 +1010,7 @@ public class JailIO {
|
||||
* @param j the jail which the prisoner is in.
|
||||
* @param p the prisoner data
|
||||
*/
|
||||
public void removePrisoner(Jail j, Prisoner p) {
|
||||
protected void removePrisoner(Jail j, Prisoner p) {
|
||||
this.removePrisoner(j, null, p);
|
||||
}
|
||||
|
||||
@ -1021,7 +1021,7 @@ public class JailIO {
|
||||
* @param c the cell which the prisoner is in, null if none
|
||||
* @param p the prisoner data
|
||||
*/
|
||||
public void removePrisoner(Jail j, Cell c, Prisoner p) {
|
||||
protected void removePrisoner(Jail j, Cell c, Prisoner p) {
|
||||
switch(storage) {
|
||||
case 1:
|
||||
case 2:
|
||||
@ -1107,7 +1107,7 @@ public class JailIO {
|
||||
*
|
||||
* @param j the jail instance to remove.
|
||||
*/
|
||||
public void removeJail(Jail j) {
|
||||
protected void removeJail(Jail j) {
|
||||
String name = j.getName();
|
||||
|
||||
switch(storage) {
|
||||
|
@ -192,9 +192,20 @@ public class JailMain extends JavaPlugin {
|
||||
|
||||
return true;//Always return true here, that way we can handle the help and command usage ourself.
|
||||
}
|
||||
|
||||
public void reloadEverything() throws Exception {
|
||||
reloadConfig();
|
||||
getJailIO().loadLanguage();
|
||||
getJailIO().loadJails();
|
||||
reloadScoreBoardManager();
|
||||
reloadJailSticks();
|
||||
reloadJailPayManager();
|
||||
reloadJailVoteManager();
|
||||
reloadUpdateCheck();
|
||||
}
|
||||
|
||||
/** Reloads the scoreboard manager class, useful when something is changed int he config about it. */
|
||||
public void reloadScoreBoardManager() {
|
||||
private void reloadScoreBoardManager() {
|
||||
this.sbm.removeAllScoreboards();
|
||||
this.sbm = null;
|
||||
this.sbm = new ScoreBoardManager(this);
|
||||
@ -211,7 +222,7 @@ public class JailMain extends JavaPlugin {
|
||||
}
|
||||
|
||||
/** Reloads the Jail Sticks, so the new ones can be loaded from the config. */
|
||||
public void reloadJailSticks() {
|
||||
private void reloadJailSticks() {
|
||||
if(getConfig().getBoolean(Settings.JAILSTICKENABLED.getPath())) {
|
||||
if(this.jsm != null) {
|
||||
this.jsm.removeAllStickUsers();
|
||||
@ -223,7 +234,7 @@ public class JailMain extends JavaPlugin {
|
||||
}
|
||||
|
||||
/** Reloads the {@link JailPayManager}. */
|
||||
public void reloadJailPayManager() {
|
||||
private void reloadJailPayManager() {
|
||||
this.jpm = null;
|
||||
|
||||
if(getConfig().getBoolean(Settings.JAILPAYENABLED.getPath())) {
|
||||
@ -237,7 +248,7 @@ public class JailMain extends JavaPlugin {
|
||||
}
|
||||
|
||||
/** Reloads the {@link JailVoteManager}. */
|
||||
public void reloadJailVoteManager() throws Exception {
|
||||
private void reloadJailVoteManager() throws Exception {
|
||||
if(this.jvm != null) {
|
||||
for(Integer i : this.jvm.getRunningTasks().values()) {
|
||||
this.getServer().getScheduler().cancelTask(i);
|
||||
@ -252,7 +263,7 @@ public class JailMain extends JavaPlugin {
|
||||
}
|
||||
|
||||
/** Reloads the update checker, in case they changed a setting about it. */
|
||||
public void reloadUpdateCheck() {
|
||||
private void reloadUpdateCheck() {
|
||||
getServer().getScheduler().cancelTask(updateCheckTask);
|
||||
update = new Update(this);
|
||||
if(getConfig().getBoolean(Settings.UPDATENOTIFICATIONS.getPath())) {
|
||||
|
@ -47,7 +47,7 @@ public class JailManager {
|
||||
private JailCreationSteps jcs;
|
||||
private CellCreationSteps ccs;
|
||||
|
||||
public JailManager(JailMain plugin) {
|
||||
protected JailManager(JailMain plugin) {
|
||||
this.plugin = plugin;
|
||||
this.jails = new HashMap<String, Jail>();
|
||||
this.jailCreators = new HashMap<String, CreationPlayer>();
|
||||
|
@ -16,7 +16,7 @@ public class JailPayManager {
|
||||
private Material item;
|
||||
private boolean infinite, timed;
|
||||
|
||||
public JailPayManager(JailMain plugin) {
|
||||
protected JailPayManager(JailMain plugin) {
|
||||
this.item = Material.getMaterial(plugin.getConfig().getString(Settings.JAILPAYITEM.getPath().toUpperCase()));
|
||||
if(this.item == null) this.item = Material.AIR;
|
||||
|
||||
|
@ -21,7 +21,7 @@ public class JailStickManager {
|
||||
private ArrayList<UUID> stickers;
|
||||
private HashMap<Material, Stick> sticks;
|
||||
|
||||
public JailStickManager(JailMain plugin) {
|
||||
protected JailStickManager(JailMain plugin) {
|
||||
this.stickers = new ArrayList<UUID>();
|
||||
this.sticks = new HashMap<Material, Stick>();
|
||||
|
||||
|
@ -27,7 +27,7 @@ public class JailTimer {
|
||||
private Long lastTime;
|
||||
private Long afkTime = 0L;
|
||||
|
||||
public JailTimer(JailMain plugin) {
|
||||
protected JailTimer(JailMain plugin) {
|
||||
this.pl = plugin;
|
||||
try {
|
||||
afkTime = Util.getTime(pl.getConfig().getString(Settings.MAXAFKTIME.getPath()));
|
||||
|
@ -32,7 +32,7 @@ public class JailVoteManager {
|
||||
*
|
||||
* @throws Exception When it can't load the time correctly
|
||||
*/
|
||||
public JailVoteManager(JailMain plugin) throws Exception {
|
||||
protected JailVoteManager(JailMain plugin) throws Exception {
|
||||
this.pl = plugin;
|
||||
this.votes = new HashMap<String, JailVote>();
|
||||
this.tasks = new HashMap<String, Integer>();
|
||||
|
@ -15,7 +15,7 @@ package com.graywolf336.jail;
|
||||
public class JailsAPI {
|
||||
private static JailMain pl;
|
||||
|
||||
public JailsAPI(JailMain plugin) {
|
||||
protected JailsAPI(JailMain plugin) {
|
||||
pl = plugin;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class PrisonerManager {
|
||||
private JailMain pl;
|
||||
private ArrayList<Prisoner> releases;
|
||||
|
||||
public PrisonerManager(JailMain plugin) {
|
||||
protected PrisonerManager(JailMain plugin) {
|
||||
this.pl = plugin;
|
||||
this.releases = new ArrayList<Prisoner>();
|
||||
|
||||
|
@ -20,7 +20,7 @@ public class ScoreBoardManager {
|
||||
private HashMap<UUID, Scoreboard> boards;
|
||||
private OfflinePlayer time;
|
||||
|
||||
public ScoreBoardManager(JailMain plugin) {
|
||||
protected ScoreBoardManager(JailMain plugin) {
|
||||
this.pl = plugin;
|
||||
this.man = plugin.getServer().getScoreboardManager();
|
||||
this.boards = new HashMap<UUID, Scoreboard>();
|
||||
|
@ -28,7 +28,7 @@ public class Update {
|
||||
// The url for the new file and file version
|
||||
private String fileUrl = "", version = "";
|
||||
|
||||
public Update(JailMain plugin) {
|
||||
protected Update(JailMain plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
@ -19,15 +19,7 @@ import com.graywolf336.jail.enums.Lang;
|
||||
public class JailReloadCommand implements Command {
|
||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||
try {
|
||||
jm.getPlugin().reloadConfig();
|
||||
jm.getPlugin().getJailIO().loadLanguage();
|
||||
jm.getPlugin().getJailIO().loadJails();
|
||||
jm.getPlugin().reloadScoreBoardManager();
|
||||
jm.getPlugin().reloadJailSticks();
|
||||
jm.getPlugin().reloadJailPayManager();
|
||||
jm.getPlugin().reloadJailVoteManager();
|
||||
jm.getPlugin().reloadUpdateCheck();
|
||||
|
||||
jm.getPlugin().reloadEverything();
|
||||
sender.sendMessage(Lang.PLUGINRELOADED.get());
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
Loading…
Reference in New Issue
Block a user