forked from SteamWar/SteamWar
Add RegionConfig
This commit is contained in:
+2
-12
@@ -69,26 +69,16 @@ public class TechHiderCommand extends SWCommand implements Listener, ScoreboardE
|
||||
}
|
||||
|
||||
Optional<TechHider> techHider = techHiders.computeIfAbsent(region, rg -> {
|
||||
File file = rg.getGameModeConfig().orElse(null);
|
||||
if (file == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
FileConfiguration config = YamlConfiguration.loadConfiguration(file);
|
||||
if (!config.getBoolean("Techhider.Active", false)) {
|
||||
if (!region.getGameModeConfig().getTechhider().isActive()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
hidden.put(rg, new HashSet<>());
|
||||
|
||||
String obfuscateWith = config.getString("Techhider.ObfuscateWith", "end_stone");
|
||||
Set<String> hiddenBlocks = Collections.unmodifiableSet(new HashSet<>(config.getStringList("Techhider.HiddenBlocks")));
|
||||
Set<String> hiddenBlockEntities = Collections.unmodifiableSet(new HashSet<>(config.getStringList("Techhider.HiddenBlockEntities")));
|
||||
|
||||
TechHider current = new TechHider((p, cX, cY) -> {
|
||||
if (rg.getBuildArea().isChunkOutside(cX, cY)) return true;
|
||||
return !hidden.get(rg).contains(p);
|
||||
}, Material.valueOf(obfuscateWith.toUpperCase()), hiddenBlocks.stream().map(String::toUpperCase).map(Material::valueOf).collect(Collectors.toSet()), hiddenBlockEntities);
|
||||
}, region.getGameModeConfig().getTechhider().getObfuscateWith(), region.getGameModeConfig().getTechhider().getHiddenBlocks(), region.getGameModeConfig().getTechhider().getHiddenBlockEntities());
|
||||
current.enable();
|
||||
|
||||
return Optional.of(current);
|
||||
|
||||
Reference in New Issue
Block a user