Reworking Techhider HiddenBlock configuration for usage in 1.14 and 1.15
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
e352862c5e
Commit
45abf6a5c0
@ -6,13 +6,12 @@ import de.steamwar.sql.Team;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Collections;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class Config {
|
public class Config {
|
||||||
@ -99,9 +98,9 @@ public class Config {
|
|||||||
public static final String LeaderDefault;
|
public static final String LeaderDefault;
|
||||||
|
|
||||||
//tech hider parameter
|
//tech hider parameter
|
||||||
public static final List<Integer> HiddenBlocks;
|
public static final Set<Integer> HiddenBlocks;
|
||||||
public static final List<String> HiddenBlockTags;
|
public static final Set<String> HiddenBlockTags;
|
||||||
public static final List<String> HiddenBlockEntities;
|
public static final Set<String> HiddenBlockEntities;
|
||||||
public static final int ObfuscateWith;
|
public static final int ObfuscateWith;
|
||||||
public static final String ObfuscateWithTag;
|
public static final String ObfuscateWithTag;
|
||||||
|
|
||||||
@ -177,9 +176,23 @@ public class Config {
|
|||||||
MemberDefault = config.getString("Kits.MemberDefault");
|
MemberDefault = config.getString("Kits.MemberDefault");
|
||||||
LeaderDefault = config.getString("Kits.LeaderDefault");
|
LeaderDefault = config.getString("Kits.LeaderDefault");
|
||||||
|
|
||||||
HiddenBlocks = Collections.unmodifiableList(config.getIntegerList("Techhider.HiddenBlocks"));
|
ConfigurationSection techhiderConfig = config.getConfigurationSection("Techhider.HiddenBlocks");
|
||||||
HiddenBlockTags = config.getStringList("Techhider.HiddenBlockTags");
|
Set<Integer> blocks = new HashSet<>();
|
||||||
HiddenBlockEntities = Collections.unmodifiableList(config.getStringList("Techhider.HiddenBlockEntities"));
|
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");
|
ObfuscateWith = config.getInt("Techhider.ObfuscateWith");
|
||||||
ObfuscateWithTag = config.getString("Techhider.ObfuscateWithTag");
|
ObfuscateWithTag = config.getString("Techhider.ObfuscateWithTag");
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren