Merge pull request 'SchematicSystem: Add music disks to auto checker' (#59) from SchematicSystem/Allow-music-disks into main

Reviewed-on: SteamWar/SteamWar#59
Reviewed-by: Chaoscaot <max@chaoscaot.de>
This commit is contained in:
2025-05-29 14:37:49 +02:00
7 changed files with 236 additions and 53 deletions
@@ -31,57 +31,6 @@ import java.util.*;
import java.util.stream.Collectors;
public class AutoChecker15 implements AutoChecker.IAutoChecker {
private static final Set<Material> INVENTORY = EnumSet.of(
Material.BARREL,
Material.BLAST_FURNACE,
Material.BREWING_STAND,
Material.CAMPFIRE,
Material.CHEST,
Material.DISPENSER,
Material.DROPPER,
Material.FURNACE,
Material.HOPPER,
Material.JUKEBOX,
Material.SHULKER_BOX,
Material.WHITE_SHULKER_BOX,
Material.ORANGE_SHULKER_BOX,
Material.MAGENTA_SHULKER_BOX,
Material.LIGHT_BLUE_SHULKER_BOX,
Material.YELLOW_SHULKER_BOX,
Material.LIME_SHULKER_BOX,
Material.PINK_SHULKER_BOX,
Material.GRAY_SHULKER_BOX,
Material.LIGHT_GRAY_SHULKER_BOX,
Material.CYAN_SHULKER_BOX,
Material.PURPLE_SHULKER_BOX,
Material.BLUE_SHULKER_BOX,
Material.BROWN_SHULKER_BOX,
Material.GREEN_SHULKER_BOX,
Material.RED_SHULKER_BOX,
Material.BLACK_SHULKER_BOX,
Material.SMOKER,
Material.TRAPPED_CHEST);
private static final Set<Material> FLOWERS = EnumSet.of(
Material.CORNFLOWER,
Material.POPPY,
Material.FERN,
Material.DANDELION,
Material.BLUE_ORCHID,
Material.ALLIUM,
Material.AZURE_BLUET,
Material.RED_TULIP,
Material.ORANGE_TULIP,
Material.WHITE_TULIP,
Material.PINK_TULIP,
Material.OXEYE_DAISY,
Material.LILY_OF_THE_VALLEY,
Material.WITHER_ROSE,
Material.SUNFLOWER,
Material.DIAMOND_HORSE_ARMOR,
Material.IRON_HORSE_ARMOR,
Material.GOLDEN_HORSE_ARMOR,
Material.HONEY_BOTTLE);
public AutoChecker.BlockScanResult scan(Clipboard clipboard) {
AutoChecker.BlockScanResult result = new AutoChecker.BlockScanResult();
@@ -98,7 +47,7 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker {
result.getBlockCounts().merge(material, 1, Integer::sum);
if(INVENTORY.contains(material)) {
if(AutoCheckerItems.impl.getInventoryMaterials().contains(material)) {
checkInventory(result, block, material, new BlockPos(x, y, z));
}
@@ -125,7 +74,7 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker {
));
itemsInInv.put(Material.FIRE_CHARGE, EnumSet.of(Material.DISPENSER));
itemsInInv.put(Material.ARROW, EnumSet.of(Material.DISPENSER));
FLOWERS.forEach(material -> itemsInInv.put(material, INVENTORY));
AutoCheckerItems.impl.getAllowedMaterialsInInventory().forEach(material -> itemsInInv.put(material, AutoCheckerItems.impl.getInventoryMaterials()));
}
private void checkInventory(AutoChecker.BlockScanResult result, BaseBlock block, Material material, BlockPos pos) {
@@ -0,0 +1,90 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.schematicsystem.autocheck;
import org.bukkit.Material;
import java.util.EnumSet;
import java.util.Set;
public class AutoCheckerItems15 implements AutoCheckerItems {
private static final Set<Material> INVENTORY = EnumSet.of(
Material.BARREL,
Material.BLAST_FURNACE,
Material.BREWING_STAND,
Material.CAMPFIRE,
Material.CHEST,
Material.DISPENSER,
Material.DROPPER,
Material.FURNACE,
Material.HOPPER,
Material.JUKEBOX,
Material.SHULKER_BOX,
Material.WHITE_SHULKER_BOX,
Material.ORANGE_SHULKER_BOX,
Material.MAGENTA_SHULKER_BOX,
Material.LIGHT_BLUE_SHULKER_BOX,
Material.YELLOW_SHULKER_BOX,
Material.LIME_SHULKER_BOX,
Material.PINK_SHULKER_BOX,
Material.GRAY_SHULKER_BOX,
Material.LIGHT_GRAY_SHULKER_BOX,
Material.CYAN_SHULKER_BOX,
Material.PURPLE_SHULKER_BOX,
Material.BLUE_SHULKER_BOX,
Material.BROWN_SHULKER_BOX,
Material.GREEN_SHULKER_BOX,
Material.RED_SHULKER_BOX,
Material.BLACK_SHULKER_BOX,
Material.SMOKER,
Material.TRAPPED_CHEST);
private static final Set<Material> FLOWERS = EnumSet.of(
Material.CORNFLOWER,
Material.POPPY,
Material.FERN,
Material.DANDELION,
Material.BLUE_ORCHID,
Material.ALLIUM,
Material.AZURE_BLUET,
Material.RED_TULIP,
Material.ORANGE_TULIP,
Material.WHITE_TULIP,
Material.PINK_TULIP,
Material.OXEYE_DAISY,
Material.LILY_OF_THE_VALLEY,
Material.WITHER_ROSE,
Material.SUNFLOWER,
Material.DIAMOND_HORSE_ARMOR,
Material.IRON_HORSE_ARMOR,
Material.GOLDEN_HORSE_ARMOR,
Material.HONEY_BOTTLE);
@Override
public Set<Material> getInventoryMaterials() {
return INVENTORY;
}
@Override
public Set<Material> getAllowedMaterialsInInventory() {
return FLOWERS;
}
}
@@ -0,0 +1,33 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
plugins {
steamwar.java
}
dependencies {
compileOnly(project(":SpigotCore", "default"))
compileOnly(project(":SchematicSystem:SchematicSystem_Core", "default"))
compileOnly(project(":SchematicSystem:SchematicSystem_15", "default"))
compileOnly(libs.spigotapi)
compileOnly(libs.nms19)
compileOnly(libs.fawe18)
}
@@ -0,0 +1,75 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.schematicsystem.autocheck;
import org.bukkit.Material;
import java.util.EnumSet;
import java.util.Set;
public class AutoCheckerItems19 extends AutoCheckerItems15 {
private static final Set<Material> ALLOWED_ITEMS_IN_INVENTORY = EnumSet.of(
// 64-stackable Items
Material.CORNFLOWER,
Material.POPPY,
Material.FERN,
Material.DANDELION,
Material.BLUE_ORCHID,
Material.ALLIUM,
Material.AZURE_BLUET,
Material.RED_TULIP,
Material.ORANGE_TULIP,
Material.WHITE_TULIP,
Material.PINK_TULIP,
Material.OXEYE_DAISY,
Material.LILY_OF_THE_VALLEY,
Material.WITHER_ROSE,
Material.SUNFLOWER,
// 16-stackable Items
Material.HONEY_BOTTLE,
// Non-stackable items
Material.DIAMOND_HORSE_ARMOR,
Material.IRON_HORSE_ARMOR,
Material.GOLDEN_HORSE_ARMOR,
// Disks
Material.MUSIC_DISC_11,
Material.MUSIC_DISC_13,
Material.MUSIC_DISC_CAT,
Material.MUSIC_DISC_BLOCKS,
Material.MUSIC_DISC_CHIRP,
Material.MUSIC_DISC_FAR,
Material.MUSIC_DISC_MALL,
Material.MUSIC_DISC_MELLOHI,
Material.MUSIC_DISC_STAL,
Material.MUSIC_DISC_STRAD,
Material.MUSIC_DISC_WAIT,
Material.MUSIC_DISC_WARD,
Material.MUSIC_DISC_OTHERSIDE,
Material.MUSIC_DISC_PIGSTEP,
Material.MUSIC_DISC_RELIC,
Material.MUSIC_DISC_5
);
@Override
public Set<Material> getAllowedMaterialsInInventory() {
return ALLOWED_ITEMS_IN_INVENTORY;
}
}
@@ -0,0 +1,34 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.schematicsystem.autocheck;
import de.steamwar.core.VersionDependent;
import de.steamwar.schematicsystem.SchematicSystem;
import org.bukkit.Material;
import java.util.Set;
public interface AutoCheckerItems {
AutoCheckerItems impl = VersionDependent.getVersionImpl(SchematicSystem.getInstance());
Set<Material> getInventoryMaterials();
Set<Material> getAllowedMaterialsInInventory();
}
+1
View File
@@ -30,4 +30,5 @@ dependencies {
implementation(project(":SchematicSystem:SchematicSystem_Core"))
implementation(project(":SchematicSystem:SchematicSystem_8"))
implementation(project(":SchematicSystem:SchematicSystem_15"))
implementation(project(":SchematicSystem:SchematicSystem_19"))
}
+1
View File
@@ -218,6 +218,7 @@ include(
"SchematicSystem",
"SchematicSystem:SchematicSystem_8",
"SchematicSystem:SchematicSystem_15",
"SchematicSystem:SchematicSystem_19",
"SchematicSystem:SchematicSystem_Core"
)