From 6600f04dbfb833efe320fa512d7c1753a11d27de Mon Sep 17 00:00:00 2001 From: trichner Date: Sun, 30 Mar 2014 15:13:33 +0200 Subject: [PATCH] further abstracting NoLaggAPI, added option default --- .idea/copyright/profiles_settings.xml | 4 +--- .../k42/metropolis/generator/MetropolisGenerator.java | 3 --- .../grid/urbanGrid/parcel/ClipboardParcel.java | 2 +- src/ch/k42/metropolis/minions/NoLaggAPI.java | 11 ++++++++--- src/config.yml | 3 ++- src/plugin.yml | 4 ++-- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml index 3572571..e7bedf3 100644 --- a/.idea/copyright/profiles_settings.xml +++ b/.idea/copyright/profiles_settings.xml @@ -1,5 +1,3 @@ - - - + \ No newline at end of file diff --git a/src/ch/k42/metropolis/generator/MetropolisGenerator.java b/src/ch/k42/metropolis/generator/MetropolisGenerator.java index 474c070..bdaba87 100644 --- a/src/ch/k42/metropolis/generator/MetropolisGenerator.java +++ b/src/ch/k42/metropolis/generator/MetropolisGenerator.java @@ -57,7 +57,6 @@ public MetropolisGenerator(MetropolisPlugin plugin, String worldName, ClipboardP this.clipboardProvider = clipboardProvider; this.plugin = plugin; this.worldName = worldName; - this.noLaggEnabled = Bukkit.getServer().getPluginManager().isPluginEnabled("NoLagg"); plugin.getLogger().info("Running MetropolisGenerator."); } @@ -93,8 +92,6 @@ public Long getWorldSeed() { return worldSeed; } - public boolean isNoLaggEnabled() { return noLaggEnabled; } - @Override public List getDefaultPopulators(World world) { List populators = new ArrayList(); diff --git a/src/ch/k42/metropolis/grid/urbanGrid/parcel/ClipboardParcel.java b/src/ch/k42/metropolis/grid/urbanGrid/parcel/ClipboardParcel.java index 84217ee..8d5f3a5 100644 --- a/src/ch/k42/metropolis/grid/urbanGrid/parcel/ClipboardParcel.java +++ b/src/ch/k42/metropolis/grid/urbanGrid/parcel/ClipboardParcel.java @@ -79,7 +79,7 @@ public void postPopulate(MetropolisGenerator generator, Chunk chunk) { generator.getDecayProvider().destroyChunks(chunkX, chunkZ, chunkSizeX, chunkSizeZ, clipboard.getBottom(Constants.BUILD_HEIGHT), clipboard.getSize().Y, clipboard.getConfig().getDecayOption()); //NoLagg Lighting Fix - if (generator.isNoLaggEnabled() && PluginConfig.getNoLaggRelighting()) { + if (PluginConfig.getNoLaggRelighting()) { NoLaggAPI.relightChunk(chunk); } diff --git a/src/ch/k42/metropolis/minions/NoLaggAPI.java b/src/ch/k42/metropolis/minions/NoLaggAPI.java index d59dca5..49942b7 100644 --- a/src/ch/k42/metropolis/minions/NoLaggAPI.java +++ b/src/ch/k42/metropolis/minions/NoLaggAPI.java @@ -1,5 +1,6 @@ package ch.k42.metropolis.minions; +import org.bukkit.Bukkit; import org.bukkit.Chunk; import com.bergerkiller.bukkit.common.bases.IntVector2; import com.bergerkiller.bukkit.nolagg.lighting.LightingService; @@ -18,9 +19,13 @@ public class NoLaggAPI { * @param chunk bukkit chunk to be relit */ public static final void relightChunk(Chunk chunk) { - List lightchunk = new ArrayList<>(); - lightchunk.add(new IntVector2(chunk)); - LightingService.schedule(chunk.getWorld(), lightchunk); + if(!Bukkit.getServer().getPluginManager().isPluginEnabled("NoLagg")){ + Minions.w("Unable to fix light, NoLagg plugin not found."); + }else { + List lightchunk = new ArrayList<>(); + lightchunk.add(new IntVector2(chunk)); + LightingService.schedule(chunk.getWorld(), lightchunk); + } } } diff --git a/src/config.yml b/src/config.yml index 56d10ac..c6ef61e 100644 --- a/src/config.yml +++ b/src/config.yml @@ -13,4 +13,5 @@ generator: blockSize: 14 # after what size the generator stops to partition space with roads inbetween sigmaCut: 6 # the number of standart deviations the probability of a partition of a space has from the mean of size/2 cloneRadius: 7 # the number of chunks in which placing checks for duplicates, distance is measured with the infinity norm - buildHeight: 65 # The level of the streets \ No newline at end of file + buildHeight: 65 # The level of the streets + noLaggRelighting: false # If the NoLagg plugin should be used to reduce lighting bugs \ No newline at end of file diff --git a/src/plugin.yml b/src/plugin.yml index aee0e44..ae0bd72 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,11 +1,11 @@ name: Metropolis main: ch.k42.metropolis.plugin.MetropolisPlugin -version: 0.1.4 +version: 0.1.5 load: startup authors: [AthmosPrime, trichner, spaceribs] website: k42.ch description: Metropolis (1927) -softdepend: [WorldEdit, NoLagg] +softdepend: [WorldEdit] loadbefore: [Multiverse-Core, dimension-door, multiworld] database: true prefix: Metropolis