forked from SteamWar/SteamWar
Add RegionConfig
This commit is contained in:
@@ -19,8 +19,8 @@
|
||||
|
||||
package de.steamwar.bausystem.features.xray;
|
||||
|
||||
import de.steamwar.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.Reflection;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.features.techhider.TechHiderCommand;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
@@ -34,8 +34,6 @@ import de.steamwar.techhider.TechHider;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -43,7 +41,6 @@ import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
@@ -70,24 +67,14 @@ public class XrayCommand extends SWCommand implements Listener, ScoreboardElemen
|
||||
}
|
||||
|
||||
Optional<TechHider> techHider = techHiders.computeIfAbsent(region, rg -> {
|
||||
File file = rg.getGameModeConfig().orElse(null);
|
||||
if (file == null) {
|
||||
if (!region.getGameModeConfig().getTechhider().isActive()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
FileConfiguration config = YamlConfiguration.loadConfiguration(file);
|
||||
if (!config.getBoolean("Techhider.Active", false)) {
|
||||
Set<Material> blocks = new HashSet<>(Arrays.asList(Material.END_STONE, Material.IRON_BLOCK));
|
||||
xrayedBlocks.put(region, blocks);
|
||||
return Optional.of(createXray(rg, blocks));
|
||||
}
|
||||
|
||||
hidden.put(rg, new HashSet<>());
|
||||
|
||||
String obfuscateWith = config.getString("Techhider.ObfuscateWith", "end_stone");
|
||||
|
||||
Set<Material> blocks = new HashSet<>(Arrays.asList(Material.getMaterial(obfuscateWith.toUpperCase())));
|
||||
if (obfuscateWith.equals("end_stone")) blocks.add(Material.END_STONE_BRICKS);
|
||||
Set<Material> blocks = new HashSet<>(Arrays.asList(region.getGameModeConfig().getTechhider().getObfuscateWith()));
|
||||
if (blocks.contains(Material.END_STONE)) blocks.add(Material.END_STONE_BRICKS);
|
||||
xrayedBlocks.put(region, blocks);
|
||||
return Optional.of(createXray(rg, blocks));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user