Fixed issue #164 'Disable Worlds doesent work'. Option useFastGazeCheck enabled by default. Small refactoring
parent
4205e04371
commit
b4e5850ca8
|
@ -4,7 +4,7 @@
|
|||
|
||||
<groupId>com.lishid</groupId>
|
||||
<artifactId>orebfuscator</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>4.3.2-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Orebfuscator4</name>
|
||||
|
|
|
@ -96,7 +96,7 @@ public class Orebfuscator extends JavaPlugin {
|
|||
}
|
||||
|
||||
configManager.load();
|
||||
|
||||
|
||||
ObfuscatedDataCache.resetCacheFolder();
|
||||
|
||||
nms.setMaxLoadedCacheFiles(config.getMaxLoadedCacheFiles());
|
||||
|
|
|
@ -18,9 +18,10 @@ package com.lishid.orebfuscator.commands;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import com.lishid.orebfuscator.config.WorldConfig;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -150,20 +151,13 @@ public class OrebfuscatorCommandExecutor {
|
|||
|
||||
Orebfuscator.message(sender, "Initial Obfuscation Radius: " + Orebfuscator.config.getInitialRadius());
|
||||
Orebfuscator.message(sender, "Update Radius: " + Orebfuscator.config.getUpdateRadius());
|
||||
|
||||
String worlds = "";
|
||||
|
||||
for(String name : Orebfuscator.config.getWorlds().keySet()) {
|
||||
if(worlds.length() > 0) {
|
||||
name += ", ";
|
||||
}
|
||||
|
||||
worlds += name;
|
||||
}
|
||||
|
||||
Orebfuscator.message(sender, "Worlds: " + (worlds.equals("") ? "None" : worlds));
|
||||
Orebfuscator.message(sender, "Use worlds as: " + (Orebfuscator.config.getDefaultWorld().isEnabled() ? "Blacklist" : "Whitelist"));
|
||||
|
||||
Orebfuscator.message(sender, "World by Default: " + (Orebfuscator.config.getDefaultWorld().isEnabled() ? "Enabled" : "Disabled"));
|
||||
|
||||
String worldNames = Orebfuscator.config.getWorldNames();
|
||||
|
||||
Orebfuscator.message(sender, "Worlds in List: " + (worldNames.equals("") ? "None" : worldNames));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public class ConfigManager {
|
|||
break;
|
||||
}
|
||||
|
||||
WorldConfig cfg = this.orebfuscatorConfig.getWorlds().get(world.getName().toLowerCase());
|
||||
WorldConfig cfg = this.orebfuscatorConfig.getWorld(world.getName());
|
||||
|
||||
if(cfg == null) {
|
||||
return baseCfg;
|
||||
|
@ -130,8 +130,8 @@ public class ConfigManager {
|
|||
|
||||
this.orebfuscatorConfig.setProximityHiderEnabled();
|
||||
|
||||
logger.info(Globals.LogPrefix + "Proximity Hider is " + (this.orebfuscatorConfig.isProximityHiderEnabled() ? "Enabled": "Disabled"));
|
||||
|
||||
this.logger.info(Globals.LogPrefix + "Proximity Hider is " + (this.orebfuscatorConfig.isProximityHiderEnabled() ? "Enabled": "Disabled"));
|
||||
|
||||
save();
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ package com.lishid.orebfuscator.config;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import com.lishid.orebfuscator.utils.Globals;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.lishid.orebfuscator.Orebfuscator;
|
||||
|
@ -199,10 +200,24 @@ public class OrebfuscatorConfig {
|
|||
this.netherWorld = value;
|
||||
}
|
||||
|
||||
public Map<String, WorldConfig> getWorlds() {
|
||||
return this.worlds;
|
||||
public String getWorldNames() {
|
||||
String worldNames = "";
|
||||
|
||||
for(WorldConfig world : this.worlds.values()) {
|
||||
if(worldNames.length() > 0) {
|
||||
worldNames += ", ";
|
||||
}
|
||||
|
||||
worldNames += world.getName();
|
||||
}
|
||||
|
||||
return worldNames;
|
||||
}
|
||||
|
||||
|
||||
public WorldConfig getWorld(String name) {
|
||||
return this.worlds.get(name.toLowerCase());
|
||||
}
|
||||
|
||||
public void setWorlds(Map<String, WorldConfig> value) {
|
||||
this.worlds = value;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ProximityHiderConfig {
|
|||
this.y = 255;
|
||||
this.useSpecialBlock = true;
|
||||
this.obfuscateAboveY = false;
|
||||
this.useFastGazeCheck = false;
|
||||
this.useFastGazeCheck = true;
|
||||
this.proximityHiderBlockIds = defaultProximityHiderBlockIds;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
|
||||
public class WorldConfig {
|
||||
private String name;
|
||||
private Boolean enabled;
|
||||
private Boolean darknessHideBlocks;
|
||||
private Boolean antiTexturePackAndFreecam;
|
||||
|
@ -107,6 +108,14 @@ public class WorldConfig {
|
|||
public boolean isInitialized() {
|
||||
return this.initialized;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
public Boolean isEnabled() {
|
||||
return this.enabled;
|
||||
|
@ -218,10 +227,6 @@ public class WorldConfig {
|
|||
return this.randomBlocks;
|
||||
}
|
||||
|
||||
public Integer[] getRandomBlocks2() {
|
||||
return this.randomBlocks2;
|
||||
}
|
||||
|
||||
public void setRandomBlocks(Integer[] values) {
|
||||
this.randomBlocks = values;
|
||||
this.randomBlocks2 = values;
|
||||
|
@ -279,10 +284,6 @@ public class WorldConfig {
|
|||
public ProximityHiderConfig getProximityHiderConfig() {
|
||||
return this.proximityHiderConfig;
|
||||
}
|
||||
|
||||
public void setProximityHiderConfig(ProximityHiderConfig value) {
|
||||
this.proximityHiderConfig = value;
|
||||
}
|
||||
|
||||
// Helper methods
|
||||
|
||||
|
|
|
@ -5,13 +5,7 @@
|
|||
|
||||
package com.lishid.orebfuscator.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
@ -63,7 +57,7 @@ public class WorldReader {
|
|||
this.endWorld = readWorldByType(keys, WorldType.TheEnd, this.defaultWorld);
|
||||
this.netherWorld = readWorldByType(keys, WorldType.Nether, this.defaultWorld);
|
||||
|
||||
this.worlds = new WeakHashMap<String, WorldConfig>();
|
||||
this.worlds = new HashMap<String, WorldConfig>();
|
||||
|
||||
for(String key : keys) {
|
||||
readWorldsByName("Worlds." + key);
|
||||
|
@ -105,6 +99,8 @@ public class WorldReader {
|
|||
}
|
||||
|
||||
world = readWorld(worldPath, world, worldType, worldType == WorldType.Default);
|
||||
|
||||
this.logger.log(Level.INFO, Globals.LogPrefix + "World type '" + worldType + "' has been read.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -124,6 +120,8 @@ public class WorldReader {
|
|||
world = createNetherWorld(createPath("Worlds", "Nether", getConfig()));
|
||||
break;
|
||||
}
|
||||
|
||||
this.logger.log(Level.WARNING, Globals.LogPrefix + "World type '" + worldType + "' has been created.");
|
||||
}
|
||||
|
||||
world.init(baseWorld);
|
||||
|
@ -142,7 +140,12 @@ public class WorldReader {
|
|||
String key = name.toLowerCase();
|
||||
|
||||
if(!this.worlds.containsKey(key)) {
|
||||
this.worlds.put(key, readWorld(worldPath, null, WorldType.Default, false));
|
||||
WorldConfig world = readWorld(worldPath, null, WorldType.Default, false);
|
||||
world.setName(name);
|
||||
|
||||
this.worlds.put(key, world);
|
||||
|
||||
this.logger.log(Level.INFO, Globals.LogPrefix + "World name '" + name + "' has been read.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue