-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loot table pause feature and getting rid of library loading system in…
… new versions of the game
- Loading branch information
Showing
4 changed files
with
167 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 33 additions & 12 deletions
45
NovaCore-Spigot/src/main/java/net/zeeraa/novacore/spigot/librarymanagement/LibraryEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,40 @@ | ||
package net.zeeraa.novacore.spigot.librarymanagement; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
public class LibraryEntry { | ||
private String className; | ||
private String libraryName; | ||
private String className; | ||
private String libraryName; | ||
@Nullable | ||
private LibraryLoadCondition loadCondition; | ||
|
||
public LibraryEntry(String className, String libraryName) { | ||
this(className, libraryName, null); | ||
} | ||
|
||
public LibraryEntry(String className, String libraryName, @Nullable LibraryLoadCondition loadCondition) { | ||
this.className = className; | ||
this.libraryName = libraryName; | ||
this.loadCondition = loadCondition; | ||
} | ||
|
||
public LibraryEntry(String className, String libraryName) { | ||
this.className = className; | ||
this.libraryName = libraryName; | ||
} | ||
public String getClassName() { | ||
return className; | ||
} | ||
|
||
public String getClassName() { | ||
return className; | ||
} | ||
public String getLibraryName() { | ||
return libraryName; | ||
} | ||
|
||
public String getLibraryName() { | ||
return libraryName; | ||
} | ||
@Nullable | ||
public LibraryLoadCondition getLoadCondition() { | ||
return loadCondition; | ||
} | ||
|
||
public boolean shouldLoad() { | ||
if(loadCondition != null) { | ||
return loadCondition.shouldLoad(); | ||
} | ||
return true; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...igot/src/main/java/net/zeeraa/novacore/spigot/librarymanagement/LibraryLoadCondition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package net.zeeraa.novacore.spigot.librarymanagement; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.function.Supplier; | ||
|
||
public class LibraryLoadCondition { | ||
private List<Supplier<Boolean>> dontLoadIf; | ||
|
||
public LibraryLoadCondition() { | ||
dontLoadIf = new ArrayList<>(); | ||
} | ||
|
||
public void addPreventLoadCondition(Supplier<Boolean> condition) { | ||
this.dontLoadIf.add(condition); | ||
} | ||
|
||
public boolean shouldLoad() { | ||
if (dontLoadIf.stream().anyMatch(s -> s.get())) { | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters