Skip to content

Commit

Permalink
v4.2.4 Changelog:
Browse files Browse the repository at this point in the history
+ Added a list to save the last errors
  • Loading branch information
TheProgramSrc committed Sep 2, 2020
1 parent e5bbd4c commit 5bcfa02
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v4.2.4 Changelog:
```
+ Added a list to save the last errors
```

## v4.2.3 Changelog:
```
+ Added method to build an Exception into a String
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>xyz.theprogramsrc</groupId>
<artifactId>SuperCoreAPI</artifactId>
<version>4.2.3</version>
<version>4.2.4</version>
<packaging>jar</packaging>

<name>SuperCoreAPI</name>
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/xyz/theprogramsrc/supercoreapi/SuperPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import xyz.theprogramsrc.supercoreapi.global.translations.TranslationPack;

import java.io.File;
import java.util.LinkedList;
import java.util.List;

/**
Expand Down Expand Up @@ -169,4 +170,17 @@ default void registerLogFilter(LogsFilter logsFilter){
* @return the plugin data storage
*/
PluginDataStorage getPluginDataStorage();

/**
* Gets the last errors
*/
LinkedList<Exception> getLastErrors();

default Exception getLastError(){
if(getLastErrors().isEmpty()){
return null;
}else{
return getLastErrors().getLast();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

public abstract class BungeePlugin extends Plugin implements SuperPlugin<Plugin> {

private boolean firstStart, emergencyStop;
private List<Runnable> disableHooks;
private LinkedList<Exception> errors;
private File translationsFolder;

private Settings settings;
private TranslationManager translationManager;
private DependencyManager dependencyManager;

private PluginDataStorage pluginDataStorage;

private BungeeTasks bungeeTasks;

public static BungeePlugin i;
Expand All @@ -43,6 +43,7 @@ public abstract class BungeePlugin extends Plugin implements SuperPlugin<Plugin>
public void onLoad() {
long start = System.currentTimeMillis();
i = this;
this.errors = new LinkedList<>();
this.emergencyStop = false;
new xyz.theprogramsrc.supercoreapi.Base(this);
this.log("Loading plugin &3v"+this.getPluginVersion());
Expand Down Expand Up @@ -204,4 +205,16 @@ public PluginDataStorage getPluginDataStorage() {
public BungeeTasks getBungeeTasks() {
return bungeeTasks;
}

@Override
public LinkedList<Exception> getLastErrors() {
return new LinkedList<>(this.errors);
}

/**
* Add an error to the Error List
*/
public void addError(Exception e){
this.errors.add(e);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@
import xyz.theprogramsrc.supercoreapi.spigot.utils.tasks.SpigotTasks;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.*;

public abstract class SpigotPlugin extends JavaPlugin implements SuperPlugin<JavaPlugin> {

Expand All @@ -50,10 +47,13 @@ public abstract class SpigotPlugin extends JavaPlugin implements SuperPlugin<Jav

private PluginDataStorage pluginDataStorage;

private LinkedList<Exception> errors;

@Override
public void onLoad() {
long current = System.currentTimeMillis();
i = this;
this.errors = new LinkedList<>();
this.emergencyStop = false;
new xyz.theprogramsrc.supercoreapi.Base(this);
this.disableHooks = new ArrayList<>();
Expand Down Expand Up @@ -311,4 +311,15 @@ public HashMap<String, CustomRecipe> getRecipes(){
return this.recipeCreator.getRecipes();
}

@Override
public LinkedList<Exception> getLastErrors() {
return new LinkedList<>(this.errors);
}

/**
* Add an error to the Error List
*/
public void addError(Exception e){
this.errors.add(e);
}
}

0 comments on commit 5bcfa02

Please sign in to comment.