Skip to content

Commit da79966

Browse files
author
TheProgramSrc
committed
Change Log:
• Working on Emergency Stop System
1 parent 6d71a29 commit da79966

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>xyz.theprogramsrc</groupId>
88
<artifactId>SuperCoreAPI</artifactId>
9-
<version>3.2.4</version>
9+
<version>3.2.5</version>
1010
<packaging>jar</packaging>
1111

1212
<name>SuperCoreAPI</name>

src/main/java/xyz/theprogramsrc/supercoreapi/spigot/SpigotPlugin.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,24 @@ public void onLoad() {
4141
long current = System.currentTimeMillis();
4242
this.emergencyStop = false;
4343
new xyz.theprogramsrc.Base();
44-
this.log("Loading plugin &3v"+this.getPluginVersion());
4544
this.disableHooks = new ArrayList<>();
4645
this.serverFolder = Utils.folder(new File("."));
4746
this.firstStart = !this.getDataFolder().exists();
4847
Utils.folder(this.getDataFolder());
4948
this.onPluginLoad();
50-
if(this.emergencyStop) return;
49+
if(this.emergencyStop) {
50+
setEnabled(false);
51+
return;
52+
}
5153
this.log("Loaded plugin in " + (System.currentTimeMillis() - current) + "ms");
5254
}
5355

5456
@Override
5557
public void onEnable() {
56-
if(this.emergencyStop) return;
57-
this.log("Enabling plugin &3v" + this.getPluginVersion());
58+
if(this.emergencyStop) {
59+
setEnabled(false);
60+
return;
61+
}
5862
this.settingsStorage = new SettingsStorage(this);
5963
this.translationsFolder = Utils.folder(new File(this.getDataFolder(), "translations/"));
6064
this.translationManager = new TranslationManager(this);
@@ -66,6 +70,10 @@ public void onEnable() {
6670
this.dependencyManager = new DependencyManager(this, pluginClassLoader);
6771
this.dependencyManager.loadDependencies(Dependencies.get());
6872
this.onPluginEnable();
73+
if(this.emergencyStop) {
74+
setEnabled(false);
75+
return;
76+
}
6977
this.log("Enabled plugin");
7078
if(this.isFirstStart()){
7179
if(this.isPaid()){
@@ -80,8 +88,9 @@ public void onEnable() {
8088

8189
@Override
8290
public void onDisable() {
83-
if(this.emergencyStop) return;
84-
this.log("Disabling plugin &3v" + this.getPluginVersion());
91+
if(this.emergencyStop) {
92+
return;
93+
}
8594
this.getDisableHooks().forEach(Runnable::run);
8695
this.onPluginDisable();
8796
this.log("Disabled plugin");
@@ -225,4 +234,8 @@ public void emergencyStop() {
225234
this.emergencyStop = true;
226235
this.getServer().getPluginManager().disablePlugin(this);
227236
}
237+
238+
public boolean isEmergencyStop() {
239+
return emergencyStop;
240+
}
228241
}

0 commit comments

Comments
 (0)