Skip to content

Commit

Permalink
further abstracting NoLaggAPI, added option default
Browse files Browse the repository at this point in the history
  • Loading branch information
trichner committed Mar 30, 2014
1 parent fb49803 commit 6600f04
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
4 changes: 1 addition & 3 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions src/ch/k42/metropolis/generator/MetropolisGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}

Expand Down Expand Up @@ -93,8 +92,6 @@ public Long getWorldSeed() {
return worldSeed;
}

public boolean isNoLaggEnabled() { return noLaggEnabled; }

@Override
public List<BlockPopulator> getDefaultPopulators(World world) {
List<BlockPopulator> populators = new ArrayList<BlockPopulator>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
11 changes: 8 additions & 3 deletions src/ch/k42/metropolis/minions/NoLaggAPI.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -18,9 +19,13 @@ public class NoLaggAPI {
* @param chunk bukkit chunk to be relit
*/
public static final void relightChunk(Chunk chunk) {
List<IntVector2> 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<IntVector2> lightchunk = new ArrayList<>();
lightchunk.add(new IntVector2(chunk));
LightingService.schedule(chunk.getWorld(), lightchunk);
}
}

}
3 changes: 2 additions & 1 deletion src/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
buildHeight: 65 # The level of the streets
noLaggRelighting: false # If the NoLagg plugin should be used to reduce lighting bugs
4 changes: 2 additions & 2 deletions src/plugin.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 6600f04

Please sign in to comment.