Only interaction with the jail stick manager when enabled. Closes #30
This commit is contained in:
parent
34acf4bbaa
commit
57e304f7c4
@ -105,13 +105,10 @@ public class JailMain extends JavaPlugin {
|
|||||||
plm.registerEvents(this.mpl, this);
|
plm.registerEvents(this.mpl, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getConfig().getBoolean(Settings.JAILSTICKENABLED.getPath())) {
|
|
||||||
jsm = new JailStickManager(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
jt = new JailTimer(this);
|
jt = new JailTimer(this);
|
||||||
sbm = new ScoreBoardManager(this);
|
sbm = new ScoreBoardManager(this);
|
||||||
reloadJailPayManager();
|
reloadJailPayManager();
|
||||||
|
reloadJailSticks();
|
||||||
reloadUpdateCheck();
|
reloadUpdateCheck();
|
||||||
|
|
||||||
new JailsAPI(this);
|
new JailsAPI(this);
|
||||||
@ -201,8 +198,11 @@ public class JailMain extends JavaPlugin {
|
|||||||
/** Reloads the Jail Sticks, so the new ones can be loaded from the config. */
|
/** Reloads the Jail Sticks, so the new ones can be loaded from the config. */
|
||||||
public void reloadJailSticks() {
|
public void reloadJailSticks() {
|
||||||
if(getConfig().getBoolean(Settings.JAILSTICKENABLED.getPath())) {
|
if(getConfig().getBoolean(Settings.JAILSTICKENABLED.getPath())) {
|
||||||
|
if(this.jsm != null) {
|
||||||
this.jsm.removeAllStickUsers();
|
this.jsm.removeAllStickUsers();
|
||||||
this.jsm = null;
|
this.jsm = null;
|
||||||
|
}
|
||||||
|
|
||||||
this.jsm = new JailStickManager(this);
|
this.jsm = new JailStickManager(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,6 +214,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled=true)
|
@EventHandler(ignoreCancelled=true)
|
||||||
public void jailStickHandling(EntityDamageByEntityEvent event) {
|
public void jailStickHandling(EntityDamageByEntityEvent event) {
|
||||||
|
if(pl.getConfig().getBoolean(Settings.JAILSTICKENABLED.getPath())) {
|
||||||
//If the damager and the entity getting damage is not a player,
|
//If the damager and the entity getting damage is not a player,
|
||||||
//we don't want to handle it in this method
|
//we don't want to handle it in this method
|
||||||
if(!(event.getDamager() instanceof Player) || !(event.getEntity() instanceof Player)) return;
|
if(!(event.getDamager() instanceof Player) || !(event.getEntity() instanceof Player)) return;
|
||||||
@ -279,4 +280,5 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user