Moved EpicSpawners to its own module

This commit is contained in:
OmerBenGera 2021-12-25 21:01:51 +02:00
parent 16fcc386ff
commit d94e7fa640
5 changed files with 26 additions and 24 deletions

View File

@ -0,0 +1,13 @@
group 'Hook_EpicSpawners'
dependencies {
compileOnly "com.songoda:EpicSpawners-6:latest"
compileOnly "org.spigotmc:v1_8_R3-Taco:latest"
compileOnly project(":API")
compileOnly parent
}
if (project.hasProperty('hook.compile_epicspawners') &&
!Boolean.valueOf(project.findProperty("hook.compile_epicspawners").toString())) {
project.tasks.all { task -> task.enabled = false }
}

View File

@ -17,7 +17,7 @@ public final class TickableProvider_EpicSpawners implements TickableProvider {
@Override
public void tick(Chunk[] chunks) {
if(EpicSpawners.getInstance().getSpawnerManager() == null)
if (EpicSpawners.getInstance().getSpawnerManager() == null)
return;
List<Long> chunkList = Stream.of(chunks).map(chunk -> pair(chunk.getX(), chunk.getZ())).collect(Collectors.toList());
@ -28,7 +28,7 @@ public final class TickableProvider_EpicSpawners implements TickableProvider {
Location location = spawner.getLocation();
TickDelay tickDelay = spawnerDelays.get(location);
if(tickDelay == null) {
if (tickDelay == null) {
spawnerDelays.put(location, new TickDelay(spawner.updateDelay()));
return;
}
@ -42,15 +42,15 @@ public final class TickableProvider_EpicSpawners implements TickableProvider {
});
}
private long pair(int x, int z){
return (x & 4294967295L) | (z & 4294967295L) << 32;
private long pair(int x, int z) {
return (x & 0xFFFFFFFFL) | (z & 0xFFFFFFFFL) << 32;
}
private static final class TickDelay{
private static final class TickDelay {
private int delay;
TickDelay(int delay){
TickDelay(int delay) {
this.delay = delay;
}

View File

@ -56,9 +56,6 @@ dependencies {
// Spigot jars
compileOnly "org.spigotmc:v1_8_R3:latest"
compileOnly 'org.spigotmc:v1_16_R3-Tuinity:latest'
// Plugin Hooks
compileOnly "com.songoda:EpicSpawners-6:latest"
}
jar {

View File

@ -1,14 +1,10 @@
/*
* This file was generated by the Gradle 'init' task.
*
* The settings file is used to specify which projects to include in your build.
*
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user manual at https://docs.gradle.org/6.0/userguide/multi_project_builds.html
*/
rootProject.name = 'WildLoaders'
include 'API'
include 'Hook_MassiveFactions'
include 'Hook_FactionsUUID'
include 'Hook_FactionsX'
include 'Hook_SuperiorSkyblock'
include 'Hook_EpicSpawners'
include 'v1_7_R4'
include 'v1_8_R3'
include 'v1_12_R1'
@ -16,8 +12,4 @@ include 'v1_15_R1'
include 'v1_16_R3'
include 'v1_17_R1'
include 'v1_18_R1'
include 'Hook_MassiveFactions'
include 'Hook_FactionsUUID'
include 'Hook_FactionsX'
include 'Hook_SuperiorSkyblock'

View File

@ -4,7 +4,6 @@ import com.bgsoftware.wildloaders.WildLoadersPlugin;
import com.bgsoftware.wildloaders.api.hooks.ClaimsProvider;
import com.bgsoftware.wildloaders.api.hooks.TickableProvider;
import com.bgsoftware.wildloaders.api.managers.ProvidersManager;
import com.bgsoftware.wildloaders.hooks.TickableProvider_EpicSpawners;
import com.bgsoftware.wildloaders.utils.threads.Executor;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
@ -56,7 +55,8 @@ public final class ProvidersHandler implements ProvidersManager {
private void loadTickableProviders() {
// Loading the tickable providers
if (Bukkit.getPluginManager().isPluginEnabled("EpicSpawners")) {
addTickableProvider(new TickableProvider_EpicSpawners());
Optional<TickableProvider> tickableProvider = createInstance("TickableProvider_EpicSpawners");
tickableProvider.ifPresent(this::addTickableProvider);
}
}