glerp
This commit is contained in:
@ -112,10 +112,9 @@ public abstract class MCommand<T extends MPlugin>
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! validCall(this.sender, this.args))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( ! validCall(this.sender, this.args)) return;
|
||||
|
||||
if ( ! this.isEnabled()) return;
|
||||
|
||||
perform();
|
||||
}
|
||||
@ -136,7 +135,6 @@ public abstract class MCommand<T extends MPlugin>
|
||||
/**
|
||||
* In this method we validate that all prerequisites to perform this command has been met.
|
||||
*/
|
||||
|
||||
// TODO: There should be a boolean for silence
|
||||
public boolean validCall(CommandSender sender, List<String> args)
|
||||
{
|
||||
@ -158,6 +156,11 @@ public abstract class MCommand<T extends MPlugin>
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean validSenderType(CommandSender sender, boolean informSenderIfNot)
|
||||
{
|
||||
if (this.senderMustBePlayer && ! (sender instanceof Player))
|
||||
|
@ -34,6 +34,9 @@ public abstract class MPlugin extends JavaPlugin
|
||||
// Persist related
|
||||
public Gson gson;
|
||||
private Integer saveTask = null;
|
||||
private boolean autoSave = true;
|
||||
public boolean getAutoSave() {return this.autoSave;}
|
||||
public void setAutoSave(boolean val) {this.autoSave = val;}
|
||||
|
||||
// Listeners
|
||||
private MPluginSecretPlayerListener mPluginSecretPlayerListener;
|
||||
@ -229,12 +232,12 @@ public abstract class MPlugin extends JavaPlugin
|
||||
// -------------------------------------------- //
|
||||
// HOOKS
|
||||
// -------------------------------------------- //
|
||||
public void preSaveTask()
|
||||
public void preAutoSave()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void postSaveTask()
|
||||
public void postAutoSave()
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -12,8 +12,9 @@ public class SaveTask implements Runnable
|
||||
|
||||
public void run()
|
||||
{
|
||||
p.preSaveTask();
|
||||
if ( ! p.getAutoSave()) return;
|
||||
p.preAutoSave();
|
||||
EM.saveAllToDisc();
|
||||
p.postSaveTask();
|
||||
p.postAutoSave();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user