Reworking Techhider HiddenBlock configuration for usage in 1.14 and 1.15 #88
@ -6,13 +6,12 @@ import de.steamwar.sql.Team;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class Config {
|
||||
@ -99,9 +98,9 @@ public class Config {
|
||||
public static final String LeaderDefault;
|
||||
|
||||
//tech hider parameter
|
||||
public static final List<Integer> HiddenBlocks;
|
||||
public static final List<String> HiddenBlockTags;
|
||||
public static final List<String> HiddenBlockEntities;
|
||||
public static final Set<Integer> HiddenBlocks;
|
||||
public static final Set<String> HiddenBlockTags;
|
||||
public static final Set<String> HiddenBlockEntities;
|
||||
public static final int ObfuscateWith;
|
||||
public static final String ObfuscateWithTag;
|
||||
|
||||
@ -177,9 +176,23 @@ public class Config {
|
||||
MemberDefault = config.getString("Kits.MemberDefault");
|
||||
LeaderDefault = config.getString("Kits.LeaderDefault");
|
||||
|
||||
HiddenBlocks = Collections.unmodifiableList(config.getIntegerList("Techhider.HiddenBlocks"));
|
||||
HiddenBlockTags = config.getStringList("Techhider.HiddenBlockTags");
|
||||
HiddenBlockEntities = Collections.unmodifiableList(config.getStringList("Techhider.HiddenBlockEntities"));
|
||||
ConfigurationSection techhiderConfig = config.getConfigurationSection("Techhider.HiddenBlocks");
|
||||
Set<Integer> blocks = new HashSet<>();
|
||||
Set<String> blockTags = new HashSet<>();
|
||||
for(String key : techhiderConfig.getKeys(false)){
|
||||
blockTags.add(key);
|
||||
if(techhiderConfig.isInt(key))
|
||||
blocks.add(techhiderConfig.getInt(key));
|
||||
else{
|
||||
List<Integer> minmax = techhiderConfig.getIntegerList(key); // Entry 0: Minimum, Entry 1: Maximum
|
||||
for(int i = minmax.get(0); i <= minmax.get(1); i++)
|
||||
blocks.add(i);
|
||||
}
|
||||
|
||||
}
|
||||
HiddenBlocks = Collections.unmodifiableSet(blocks);
|
||||
HiddenBlockTags = Collections.unmodifiableSet(blockTags);
|
||||
HiddenBlockEntities = Collections.unmodifiableSet(new HashSet<>(config.getStringList("Techhider.HiddenBlockEntities")));
|
||||
ObfuscateWith = config.getInt("Techhider.ObfuscateWith");
|
||||
ObfuscateWithTag = config.getString("Techhider.ObfuscateWithTag");
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren