mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-01-20 21:21:50 +01:00
Rename Blacklist to Materials. Since the item filter supports whitelists now the name didn't fit any longer
This commit is contained in:
parent
de92966b89
commit
0070d5bb84
30
pom.xml
30
pom.xml
@ -71,21 +71,27 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.15.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- PCGF Plugin Lib -->
|
||||
<dependency>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>PluginLib</artifactId>
|
||||
<version>1.0.20-SNAPSHOT</version>
|
||||
<version>1.0.21-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- BadRabbit -->
|
||||
<dependency>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>BadRabbit</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<classifier>Bukkit</classifier>
|
||||
<artifactId>BadRabbit-Bukkit</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<!-- Lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.10</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@ -117,6 +123,20 @@
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Resolve lombok -->
|
||||
<plugin>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok-maven-plugin</artifactId>
|
||||
<version>1.18.10.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>delombok</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- Bundle the API into the JAR -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -132,8 +132,8 @@ ItemFilter:
|
||||
Enable: false
|
||||
# Changes the filter mode, either blacklist (only not listed materials are allowed) or whitelist (only listed materials are allowed)
|
||||
Mode: blacklist
|
||||
# List off items not allowed in the backpack. Can be name or id (id only for MC versions older than 1.13!).
|
||||
Blacklist: []
|
||||
# List off materials that should be filtered. Can be name or id (id only for MC versions older than 1.13!).
|
||||
Materials: []
|
||||
|
||||
# This settings allow control over how the plugin behave in different worlds
|
||||
WorldSettings:
|
||||
@ -181,4 +181,4 @@ Misc:
|
||||
UseBungeeCord: false
|
||||
|
||||
# Config file version. Don't touch it!
|
||||
Version: 23
|
||||
Version: 24
|
@ -37,7 +37,7 @@
|
||||
|
||||
public class Config extends Configuration implements DatabaseConnectionConfiguration
|
||||
{
|
||||
private static final int CONFIG_VERSION = 23, UPGRADE_THRESHOLD = CONFIG_VERSION, PRE_V2_VERSION = 20;
|
||||
private static final int CONFIG_VERSION = 24, UPGRADE_THRESHOLD = CONFIG_VERSION, PRE_V2_VERSION = 20;
|
||||
|
||||
public Config(JavaPlugin plugin)
|
||||
{
|
||||
@ -61,7 +61,9 @@ protected void doUpgrade(@NotNull YamlFileManager oldConfig)
|
||||
}
|
||||
else
|
||||
{
|
||||
super.doUpgrade(oldConfig);
|
||||
Map<String, String> remappedKeys = new HashMap<>();
|
||||
if(oldConfig.getVersion() <= 23) remappedKeys.put("ItemFilter.Materials", "ItemFilter.Blacklist");
|
||||
doUpgrade(oldConfig, remappedKeys);
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +129,7 @@ public boolean getUseUUIDSeparators()
|
||||
|
||||
public String getUnCacheStrategie()
|
||||
{
|
||||
return getConfigE().getString("Database.Cache.UnCache.Strategie", "interval").toLowerCase(Locale.ROOT);
|
||||
return getConfigE().getString("Database.Cache.UnCache.Strategie", "interval").toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
public long getUnCacheInterval()
|
||||
@ -288,13 +290,13 @@ public boolean isItemFilterEnabled()
|
||||
return isItemFilterEnabledNoShulker() || getConfigE().getBoolean("Shulkerboxes.PreventInBackpack", true);
|
||||
}
|
||||
|
||||
public Collection<MinecraftMaterial> getItemFilterBlacklist()
|
||||
public Collection<MinecraftMaterial> getItemFilterMaterials()
|
||||
{
|
||||
if(!isItemFilterEnabledNoShulker()) return new LinkedList<>();
|
||||
List<String> stringBlacklist = getConfigE().getStringList("ItemFilter.Blacklist", new LinkedList<>());
|
||||
if(isItemFilterModeWhitelist()) stringBlacklist.add("air");
|
||||
List<String> stringMaterialList = getConfigE().getStringList("ItemFilter.Materials", new LinkedList<>());
|
||||
if(isItemFilterModeWhitelist()) stringMaterialList.add("air");
|
||||
Collection<MinecraftMaterial> blacklist = new LinkedList<>();
|
||||
for(String item : stringBlacklist)
|
||||
for(String item : stringMaterialList)
|
||||
{
|
||||
MinecraftMaterial mat = MinecraftMaterial.fromInput(item);
|
||||
if(mat != null) blacklist.add(mat);
|
||||
|
@ -41,7 +41,7 @@ public class ItemFilter extends MinepacksListener implements at.pcgamingfreaks.M
|
||||
public final Message messageNotAllowedInBackpack;
|
||||
public final ItemNameResolver itemNameResolver;
|
||||
private final boolean whitelistMode;
|
||||
private final Collection<MinecraftMaterial> blockedMaterials = new HashSet<>();
|
||||
private final Collection<MinecraftMaterial> filteredMaterials = new HashSet<>();
|
||||
|
||||
public ItemFilter(final Minepacks plugin)
|
||||
{
|
||||
@ -52,10 +52,10 @@ public ItemFilter(final Minepacks plugin)
|
||||
{
|
||||
for(Material mat : DisableShulkerboxes.SHULKER_BOX_MATERIALS)
|
||||
{
|
||||
blockedMaterials.add(new MinecraftMaterial(mat, (short) -1));
|
||||
filteredMaterials.add(new MinecraftMaterial(mat, (short) -1));
|
||||
}
|
||||
}
|
||||
blockedMaterials.addAll(plugin.getConfiguration().getItemFilterBlacklist());
|
||||
filteredMaterials.addAll(plugin.getConfiguration().getItemFilterMaterials());
|
||||
|
||||
messageNotAllowedInBackpack = plugin.getLanguage().getMessage("Ingame.NotAllowedInBackpack").replaceAll("\\{ItemName}", "%s");
|
||||
|
||||
@ -83,7 +83,7 @@ public ItemFilter(final Minepacks plugin)
|
||||
@Override
|
||||
public boolean isItemBlocked(ItemStack item)
|
||||
{
|
||||
return whitelistMode ^ blockedMaterials.contains(new MinecraftMaterial(item));
|
||||
return whitelistMode ^ filteredMaterials.contains(new MinecraftMaterial(item));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
|
@ -19,5 +19,5 @@
|
||||
|
||||
public class MagicValues
|
||||
{
|
||||
public static final String MIN_PCGF_PLUGIN_LIB_VERSION = "1.0.19-SNAPSHOT";
|
||||
public static final String MIN_PCGF_PLUGIN_LIB_VERSION = "1.0.21-SNAPSHOT";
|
||||
}
|
Loading…
Reference in New Issue
Block a user