forked from SteamWar/SteamWar
Cleanup SchematicSystem
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* 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(libs.nms15)
|
||||
compileOnly(libs.worldedit15)
|
||||
}
|
||||
-143
@@ -1,143 +0,0 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.schematicsystem.autocheck;
|
||||
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class AutoChecker15 implements AutoChecker.IAutoChecker {
|
||||
|
||||
public AutoChecker.BlockScanResult scan(Clipboard clipboard) {
|
||||
AutoChecker.BlockScanResult result = new AutoChecker.BlockScanResult();
|
||||
BlockVector3 min = clipboard.getMinimumPoint();
|
||||
BlockVector3 max = clipboard.getMaximumPoint();
|
||||
for(int x = min.getBlockX(); x <= max.getBlockX(); x++){
|
||||
for(int y = min.getBlockY(); y <= max.getBlockY(); y++) {
|
||||
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
|
||||
final BaseBlock block = clipboard.getFullBlock(BlockVector3.at(x, y, z));
|
||||
final Material material = Material.matchMaterial(block.getBlockType().getId());
|
||||
if(material == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
result.getBlockCounts().merge(material, 1, Integer::sum);
|
||||
|
||||
if(AutoCheckerItems.impl.getInventoryMaterials().contains(material)) {
|
||||
checkInventory(result, block, material, new BlockPos(x, y, z));
|
||||
}
|
||||
|
||||
if(x == min.getBlockX() || x == max.getBlockX() || y == max.getBlockY() || z == min.getBlockZ() || z == max.getBlockZ()) {
|
||||
result.getDesignBlocks().computeIfAbsent(material, m -> new ArrayList<>()).add(new BlockPos(x, y, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static final Map<Material, Set<Material>> itemsInInv = new EnumMap<>(Material.class);
|
||||
|
||||
static {
|
||||
itemsInInv.put(Material.BUCKET, EnumSet.of(Material.DISPENSER));
|
||||
itemsInInv.put(Material.TNT, EnumSet.of(
|
||||
Material.CHEST, Material.BARREL, Material.SHULKER_BOX, Material.BLACK_SHULKER_BOX,
|
||||
Material.BLUE_SHULKER_BOX, Material.BROWN_SHULKER_BOX, Material.CYAN_SHULKER_BOX,
|
||||
Material.GRAY_SHULKER_BOX, Material.GREEN_SHULKER_BOX, Material.LIGHT_BLUE_SHULKER_BOX,
|
||||
Material.LIGHT_GRAY_SHULKER_BOX, Material.LIME_SHULKER_BOX, Material.MAGENTA_SHULKER_BOX,
|
||||
Material.ORANGE_SHULKER_BOX, Material.PINK_SHULKER_BOX, Material.PURPLE_SHULKER_BOX,
|
||||
Material.RED_SHULKER_BOX, Material.WHITE_SHULKER_BOX, Material.YELLOW_SHULKER_BOX
|
||||
));
|
||||
itemsInInv.put(Material.FIRE_CHARGE, EnumSet.of(Material.DISPENSER));
|
||||
itemsInInv.put(Material.ARROW, EnumSet.of(Material.DISPENSER));
|
||||
AutoCheckerItems.impl.getAllowedMaterialsInInventory().forEach(material -> itemsInInv.put(material, AutoCheckerItems.impl.getInventoryMaterials()));
|
||||
}
|
||||
|
||||
private void checkInventory(AutoChecker.BlockScanResult result, BaseBlock block, Material material, BlockPos pos) {
|
||||
CompoundTag nbt = block.getNbtData();
|
||||
if(nbt == null) {
|
||||
result.getDefunctNbt().add(pos);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(material == Material.JUKEBOX && nbt.getValue().containsKey("RecordItem")){
|
||||
result.getRecords().add(pos);
|
||||
return;
|
||||
}
|
||||
|
||||
List<CompoundTag> items = nbt.getList("Items", CompoundTag.class);
|
||||
if(items.isEmpty())
|
||||
return; //Leeres Inventar
|
||||
|
||||
int counter = 0;
|
||||
for(CompoundTag item : items){
|
||||
if(!item.containsKey("id")){
|
||||
result.getDefunctNbt().add(pos);
|
||||
continue;
|
||||
}
|
||||
|
||||
Material itemType = Material.matchMaterial(item.getString("id"));
|
||||
if(itemType == null) //Leere Slots
|
||||
continue;
|
||||
|
||||
if (!itemsInInv.getOrDefault(itemType, EnumSet.noneOf(Material.class)).contains(material)) {
|
||||
result.getForbiddenItems().computeIfAbsent(pos, blockVector3 -> new HashSet<>()).add(itemType);
|
||||
} else if(material == Material.DISPENSER && (itemType == Material.ARROW || itemType == Material.FIRE_CHARGE)) {
|
||||
counter += Core.getVersion() >= 21 ? item.getInt("count") : item.getByte("Count");
|
||||
}
|
||||
if (item.containsKey("tag")) {
|
||||
result.getForbiddenNbt().computeIfAbsent(pos, blockVector3 -> new HashSet<>()).add(itemType);
|
||||
}
|
||||
}
|
||||
result.getDispenserItems().put(pos, counter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AutoCheckerResult check(Clipboard clipboard, GameModeConfig<Material, String> type) {
|
||||
return AutoCheckerResult.builder()
|
||||
.type(type)
|
||||
.height(clipboard.getDimensions().getBlockY())
|
||||
.width(clipboard.getDimensions().getBlockX())
|
||||
.depth(clipboard.getDimensions().getBlockZ())
|
||||
.blockScanResult(scan(clipboard))
|
||||
.entities(clipboard.getEntities().stream().map(Entity::getLocation).map(blockVector3 -> new BlockPos(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ())).collect(Collectors.toList()))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AutoCheckerResult sizeCheck(Clipboard clipboard, GameModeConfig<Material, String> type) {
|
||||
return AutoCheckerResult.builder()
|
||||
.type(type)
|
||||
.height(clipboard.getDimensions().getBlockY())
|
||||
.width(clipboard.getDimensions().getBlockX())
|
||||
.depth(clipboard.getDimensions().getBlockZ())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
-96
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
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.LEATHER_HORSE_ARMOR,
|
||||
Material.HONEY_BOTTLE,
|
||||
Material.LILAC,
|
||||
Material.ROSE_BUSH,
|
||||
Material.PEONY,
|
||||
Material.TALL_GRASS,
|
||||
Material.LARGE_FERN);
|
||||
|
||||
@Override
|
||||
public Set<Material> getInventoryMaterials() {
|
||||
return INVENTORY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Material> getAllowedMaterialsInInventory() {
|
||||
return FLOWERS;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
}
|
||||
-81
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
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,
|
||||
Material.LILAC,
|
||||
Material.ROSE_BUSH,
|
||||
Material.PEONY,
|
||||
Material.TALL_GRASS,
|
||||
Material.LARGE_FERN,
|
||||
// 16-stackable Items
|
||||
Material.HONEY_BOTTLE,
|
||||
// Non-stackable items
|
||||
Material.DIAMOND_HORSE_ARMOR,
|
||||
Material.IRON_HORSE_ARMOR,
|
||||
Material.GOLDEN_HORSE_ARMOR,
|
||||
Material.LEATHER_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;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* 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_19", "default"))
|
||||
compileOnly(project(":SchematicSystem:SchematicSystem_15", "default"))
|
||||
|
||||
compileOnly(libs.spigotapi)
|
||||
|
||||
compileOnly(libs.nms19)
|
||||
compileOnly(libs.fawe18)
|
||||
}
|
||||
-82
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.schematicsystem.autocheck;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class AutoCheckerItems20 extends AutoCheckerItems19 {
|
||||
|
||||
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,
|
||||
Material.LILAC,
|
||||
Material.ROSE_BUSH,
|
||||
Material.PEONY,
|
||||
Material.TALL_GRASS,
|
||||
Material.LARGE_FERN,
|
||||
Material.TORCHFLOWER,
|
||||
// 16-stackable Items
|
||||
Material.HONEY_BOTTLE,
|
||||
// Non-stackable items
|
||||
Material.DIAMOND_HORSE_ARMOR,
|
||||
Material.IRON_HORSE_ARMOR,
|
||||
Material.GOLDEN_HORSE_ARMOR,
|
||||
Material.LEATHER_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;
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* 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(libs.paperapi21) {
|
||||
attributes {
|
||||
// Very Hacky, but it works
|
||||
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 21)
|
||||
}
|
||||
}
|
||||
|
||||
compileOnly(libs.nms21)
|
||||
compileOnly(libs.fawe21)
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* 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(libs.nms8)
|
||||
compileOnly(libs.worldedit12)
|
||||
}
|
||||
-175
@@ -1,175 +0,0 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.schematicsystem.autocheck;
|
||||
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class AutoChecker8 implements AutoChecker.IAutoChecker {
|
||||
private static final int DISPENSER = Material.DISPENSER.getId();
|
||||
private static final int JUKEBOX = Material.JUKEBOX.getId();
|
||||
private static final int CHEST = Material.CHEST.getId();
|
||||
private static final Set<Integer> INVENTORY = new HashSet<>();
|
||||
private static final Set<Material> FLOWERS;
|
||||
|
||||
static{
|
||||
INVENTORY.add(CHEST);
|
||||
INVENTORY.add(Material.TRAPPED_CHEST.getId());
|
||||
INVENTORY.add(Material.HOPPER.getId());
|
||||
INVENTORY.add(Material.FURNACE.getId());
|
||||
INVENTORY.add(Material.BURNING_FURNACE.getId());
|
||||
INVENTORY.add(JUKEBOX); //RecordItem
|
||||
INVENTORY.add(DISPENSER);
|
||||
INVENTORY.add(Material.DROPPER.getId());
|
||||
INVENTORY.add(Material.ANVIL.getId());
|
||||
INVENTORY.add(Material.BREWING_STAND.getId());
|
||||
for(int i = 219; i <= 234; i++) {
|
||||
INVENTORY.add(i); // ShulkerBoxes
|
||||
}
|
||||
|
||||
Set<Material> flowers = new HashSet<>();
|
||||
flowers.add(Material.YELLOW_FLOWER);
|
||||
flowers.add(Material.RED_ROSE);
|
||||
flowers.add(Material.DOUBLE_PLANT);
|
||||
flowers.add(Material.DIAMOND_BARDING);
|
||||
flowers.add(Material.IRON_BARDING);
|
||||
flowers.add(Material.GOLD_BARDING);
|
||||
FLOWERS = flowers;
|
||||
}
|
||||
|
||||
public void scan(AutoChecker.BlockScanResult result, Clipboard clipboard) {
|
||||
Region region = clipboard.getRegion();
|
||||
Vector min = region.getMinimumPoint();
|
||||
Vector max = region.getMaximumPoint();
|
||||
|
||||
for(int x = min.getBlockX(); x <= max.getBlockX(); x++){
|
||||
for(int y = min.getBlockY(); y <= max.getBlockY(); y++){
|
||||
for(int z = min.getBlockZ(); z <= max.getBlockZ(); z++){
|
||||
final BaseBlock block = clipboard.getBlock(new Vector(x, y, z));
|
||||
final int blockId = block.getId();
|
||||
final Material material = Material.getMaterial(blockId);
|
||||
|
||||
result.getBlockCounts().merge(material, 1, Integer::sum);
|
||||
|
||||
if(INVENTORY.contains(blockId)){
|
||||
checkInventory(result, block, blockId, new BlockPos(x, y, z));
|
||||
}
|
||||
|
||||
if(x == 0 || x == max.getBlockX() - 1 || y == max.getBlockY() - 1 || z == 0 || z == max.getBlockZ() - 1) {
|
||||
result.getDesignBlocks().computeIfAbsent(material, m -> new ArrayList<>()).add(new BlockPos(x, y, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final Map<Material, EnumSet<Material>> itemsInInv = new EnumMap<>(Material.class);
|
||||
|
||||
static {
|
||||
itemsInInv.put(Material.BUCKET, EnumSet.of(Material.DISPENSER));
|
||||
itemsInInv.put(Material.TNT, EnumSet.of(Material.CHEST));
|
||||
itemsInInv.put(Material.FIREBALL, EnumSet.of(Material.DISPENSER));
|
||||
itemsInInv.put(Material.ARROW, EnumSet.of(Material.DISPENSER));
|
||||
FLOWERS.forEach(material -> itemsInInv.put(material, INVENTORY.stream().map(Material::getMaterial).collect(Collectors.toCollection(() -> EnumSet.noneOf(Material.class)))));
|
||||
}
|
||||
|
||||
private static void checkInventory(AutoChecker.BlockScanResult result, BaseBlock block, int blockId, BlockPos pos) {
|
||||
CompoundTag nbt = block.getNbtData();
|
||||
if(nbt == null){
|
||||
result.getDefunctNbt().add(pos);
|
||||
return;
|
||||
}
|
||||
|
||||
if(blockId == JUKEBOX && nbt.getValue().containsKey("RecordItem")){
|
||||
result.getRecords().add(pos);
|
||||
return;
|
||||
}
|
||||
|
||||
List<CompoundTag> items = nbt.getList("Items", CompoundTag.class);
|
||||
if(items.isEmpty())
|
||||
return; //Leeres Inventar
|
||||
|
||||
int counter = 0;
|
||||
for(CompoundTag item : items){
|
||||
if(!item.containsKey("id")){
|
||||
result.getDefunctNbt().add(pos);
|
||||
continue;
|
||||
}
|
||||
|
||||
String materialName = item.getString("id");
|
||||
if(materialName.contains(":"))
|
||||
materialName = materialName.split(":")[1];
|
||||
materialName = materialName.toUpperCase().replace("SHOVEL", "SPADE");
|
||||
Material itemType = Material.getMaterial(materialName);
|
||||
if(itemType == null && item.getString("id").equals("minecraft:fire_charge"))
|
||||
itemType = Material.FIREBALL;
|
||||
if(itemType == null) //Leere Slots
|
||||
continue;
|
||||
|
||||
|
||||
if(!itemsInInv.getOrDefault(itemType, EnumSet.noneOf(Material.class)).contains(Material.getMaterial(blockId))) {
|
||||
result.getForbiddenItems().computeIfAbsent(pos, blockPos -> new HashSet<>()).add(Material.getMaterial(blockId));
|
||||
} else if(blockId == DISPENSER && (itemType.equals(Material.FIREBALL) || itemType.equals(Material.ARROW))) {
|
||||
counter += item.getByte("Count");
|
||||
}
|
||||
if(item.containsKey("tag")) {
|
||||
result.getForbiddenNbt().computeIfAbsent(pos, blockPos -> new HashSet<>()).add(Material.getMaterial(blockId));
|
||||
}
|
||||
}
|
||||
|
||||
result.getDispenserItems().put(pos, counter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AutoCheckerResult check(Clipboard clipboard, GameModeConfig<Material, String> type) {
|
||||
AutoChecker.BlockScanResult blockScanResult = new AutoChecker.BlockScanResult();
|
||||
scan(blockScanResult, clipboard);
|
||||
|
||||
return AutoCheckerResult.builder()
|
||||
.type(type)
|
||||
.height(clipboard.getDimensions().getBlockY())
|
||||
.width(clipboard.getDimensions().getBlockX())
|
||||
.depth(clipboard.getDimensions().getBlockZ())
|
||||
.blockScanResult(blockScanResult)
|
||||
.entities(clipboard.getEntities().stream().map(Entity::getLocation).map(blockVector3 -> new BlockPos(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ())).collect(Collectors.toList()))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AutoCheckerResult sizeCheck(Clipboard clipboard, GameModeConfig<Material, String> type) {
|
||||
return AutoCheckerResult.builder()
|
||||
.type(type)
|
||||
.height(clipboard.getDimensions().getBlockY())
|
||||
.width(clipboard.getDimensions().getBlockX())
|
||||
.depth(clipboard.getDimensions().getBlockZ())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.schematicsystem.commands.schematiccommand;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.schematicsystem.autocheck.AutoCheckerResult;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class SchematicCommand8 implements SchematicCommand.ISchematicCommand {
|
||||
|
||||
@Override
|
||||
public Clipboard fixClipboard(Clipboard clipboard, AutoCheckerResult result, GameModeConfig<Material, String> type) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createCopy(EditSession editSession, Clipboard clipboard) throws WorldEditException {
|
||||
Operations.complete(new ForwardExtentCopy(editSession, clipboard.getRegion(), clipboard, clipboard.getMinimumPoint()));
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* 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(libs.classindex)
|
||||
annotationProcessor(libs.classindex)
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
|
||||
compileOnly(libs.spigotapi)
|
||||
compileOnly(libs.worldedit15)
|
||||
}
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.schematicsystem.autocheck;
|
||||
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import de.steamwar.core.VersionDependent;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.schematicsystem.SchematicSystem;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class AutoChecker {
|
||||
|
||||
public static AutoCheckerResult check(Clipboard clipboard, GameModeConfig<Material, String> type) {
|
||||
return impl.check(clipboard, type);
|
||||
}
|
||||
|
||||
public static AutoCheckerResult sizeCheck(Clipboard clipboard, GameModeConfig<Material, String> type) {
|
||||
return impl.sizeCheck(clipboard, type);
|
||||
}
|
||||
|
||||
private static final IAutoChecker impl = VersionDependent.getVersionImpl(SchematicSystem.getInstance());
|
||||
|
||||
public interface IAutoChecker {
|
||||
AutoCheckerResult check(Clipboard clipboard, GameModeConfig<Material, String> type);
|
||||
AutoCheckerResult sizeCheck(Clipboard clipboard, GameModeConfig<Material, String> type);
|
||||
}
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
public static class BlockScanResult {
|
||||
private final Map<Material, Integer> blockCounts = new EnumMap<>(Material.class);
|
||||
private final List<BlockPos> defunctNbt = new ArrayList<>();
|
||||
private final List<BlockPos> records = new ArrayList<>();
|
||||
private final Map<Material, List<BlockPos>> designBlocks = new EnumMap<>(Material.class);
|
||||
private final Map<BlockPos, Integer> dispenserItems = new HashMap<>();
|
||||
private final Map<BlockPos, Integer> windChargeCount = new HashMap<>();
|
||||
private final Map<BlockPos, Set<Material>> forbiddenItems = new HashMap<>();
|
||||
private final Map<BlockPos, Set<Material>> forbiddenNbt = new HashMap<>();
|
||||
}
|
||||
}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
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();
|
||||
}
|
||||
-156
@@ -1,156 +0,0 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.schematicsystem.commands.schematiccommand;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import de.steamwar.command.AbstractSWCommand;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.core.VersionDependent;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.schematicsystem.SchematicSystem;
|
||||
import de.steamwar.schematicsystem.autocheck.AutoCheckerResult;
|
||||
import de.steamwar.sql.*;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandHelp.*;
|
||||
import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.togglePublic;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Linked
|
||||
public class SchematicCommand extends SWCommand {
|
||||
|
||||
public SchematicCommand() {
|
||||
super("schematic", new String[] {"schem", "/schem", "/schematic"});
|
||||
}
|
||||
|
||||
@Register("help")
|
||||
public void pagedHelp(Player player, HelpPage page) {
|
||||
printHelpPage(player, page);
|
||||
}
|
||||
|
||||
@Register
|
||||
public void genericHelp(Player player, String... args) {
|
||||
printHelpMainPage(player);
|
||||
}
|
||||
|
||||
@Register(value = "togglepublic", noTabComplete = true)
|
||||
public void togglePublicMode(Player player) {
|
||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||
if (!user.hasPerm(UserPerm.MODERATION)) {
|
||||
genericHelp(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (togglePublic(player)) {
|
||||
SchematicSystem.MESSAGE.send("COMMAND_PUBLIC_ON", player);
|
||||
} else {
|
||||
SchematicSystem.MESSAGE.send("COMMAND_PUBLIC_OFF", player);
|
||||
}
|
||||
}
|
||||
|
||||
@Mapper("publicMapper")
|
||||
public TypeMapper<SchematicNode> publicNodeTypeMapper() {
|
||||
return SchematicMapper.publicNodeTypeMapper();
|
||||
}
|
||||
|
||||
@Mapper("memberMapper")
|
||||
public static TypeMapper<NodeMember> nodeMemberTypeMapper() {
|
||||
return SchematicMapper.nodeMemberTypeMapper();
|
||||
}
|
||||
|
||||
@Mapper("dirMapper")
|
||||
public static TypeMapper<SchematicNode> dirNodeTypeMapper() {
|
||||
return SchematicMapper.dirNodeTypeMapper();
|
||||
}
|
||||
|
||||
@Mapper("publicDirMapper")
|
||||
public static TypeMapper<SchematicNode> publicDirNodeTypeMapper() {
|
||||
return SchematicMapper.publicDirNodeTypeMapper();
|
||||
}
|
||||
|
||||
@Mapper("dirStringMapper")
|
||||
public static TypeMapper<String> stringTabMapper() {
|
||||
return SchematicMapper.stringTabMapper();
|
||||
}
|
||||
|
||||
@Mapper("stringMapper")
|
||||
public static TypeMapper<String> stringMapper() {
|
||||
return SchematicMapper.stringMapper();
|
||||
}
|
||||
|
||||
@ClassMapper(SchematicType.class)
|
||||
public static TypeMapper<SchematicType> typeTypeMapper() {
|
||||
return SchematicMapper.typeTypeMapper();
|
||||
}
|
||||
|
||||
@AbstractSWCommand.ClassMapper(value = SchematicNode.class, local = true)
|
||||
public static TypeMapper<SchematicNode> nodeTypeMapper() {
|
||||
return SchematicMapper.nodeTypeMapper();
|
||||
}
|
||||
|
||||
@ClassMapper(value = GameModeConfig.class, local = true)
|
||||
public static TypeMapper<GameModeConfig<Material, String>> gameModeConfigTypeMapper() {
|
||||
return SchematicMapper.gameModeConfigTypeMapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sendMessage(CommandSender sender, String message, Object[] args) {
|
||||
SchematicSystem.MESSAGE.send(message, sender, args);
|
||||
}
|
||||
|
||||
@Validator(value = "isSchemValidator", local = true)
|
||||
public static TypeValidator<SchematicNode> isSchemValidator() {
|
||||
return SchematicValidator.isSchemValidator();
|
||||
}
|
||||
|
||||
@Validator(value = "isDirValidator", local = true)
|
||||
public static TypeValidator<SchematicNode> isDirValidator() {
|
||||
return SchematicValidator.isDirValidator();
|
||||
}
|
||||
|
||||
@Validator(value = "isOwnerValidator", local = true)
|
||||
public static TypeValidator<SchematicNode> isOwnerValidator() {
|
||||
return SchematicValidator.isOwnerValidator();
|
||||
}
|
||||
|
||||
@Validator(value = "isOwnerSchematicValidator", local = true)
|
||||
public static TypeValidator<SchematicNode> isOwnerSchematicValidator() {
|
||||
return SchematicValidator.isOwnerSchematicValidator();
|
||||
}
|
||||
|
||||
public enum Extend {
|
||||
AUSFAHREN,
|
||||
NORMAL
|
||||
}
|
||||
|
||||
public static final ISchematicCommand impl = VersionDependent.getVersionImpl(SchematicSystem.getInstance());
|
||||
|
||||
public interface ISchematicCommand {
|
||||
Clipboard fixClipboard(Clipboard clipboard, AutoCheckerResult result, GameModeConfig<Material, String> type) throws Exception;
|
||||
void createCopy(EditSession editSession, Clipboard clipboard) throws WorldEditException;
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
steamwar.java
|
||||
alias(libs.plugins.shadow)
|
||||
}
|
||||
|
||||
@@ -26,11 +27,16 @@ tasks.build {
|
||||
finalizedBy(tasks.shadowJar)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":SchematicSystem:SchematicSystem_Core"))
|
||||
implementation(project(":SchematicSystem:SchematicSystem_8"))
|
||||
implementation(project(":SchematicSystem:SchematicSystem_15"))
|
||||
implementation(project(":SchematicSystem:SchematicSystem_19"))
|
||||
implementation(project(":SchematicSystem:SchematicSystem_20"))
|
||||
implementation(project(":SchematicSystem:SchematicSystem_21"))
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(libs.classindex)
|
||||
annotationProcessor(libs.classindex)
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
|
||||
compileOnly(libs.paperapi21)
|
||||
compileOnly(libs.worldedit15)
|
||||
}
|
||||
|
||||
+31
-16
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||
* 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
|
||||
@@ -26,12 +26,30 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class AutoChecker21 implements AutoChecker.IAutoChecker {
|
||||
public class AutoChecker {
|
||||
|
||||
public static final AutoChecker impl = new AutoChecker();
|
||||
|
||||
public AutoCheckerResult check(Clipboard clipboard, GameModeConfig<Material, String> type) {
|
||||
return AutoCheckerResult.builder().type(type).height(clipboard.getDimensions().getBlockY()).width(clipboard.getDimensions().getBlockX())
|
||||
.depth(clipboard.getDimensions().getBlockZ()).blockScanResult(scan(clipboard, type))
|
||||
.entities(clipboard.getEntities().stream().map(Entity::getLocation)
|
||||
.map(blockVector3 -> new BlockPos(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ()))
|
||||
.collect(Collectors.toList()))
|
||||
.build();
|
||||
}
|
||||
|
||||
public AutoCheckerResult sizeCheck(Clipboard clipboard, GameModeConfig<Material, String> type) {
|
||||
return AutoCheckerResult.builder().type(type).height(clipboard.getDimensions().getBlockY()).width(clipboard.getDimensions().getBlockX())
|
||||
.depth(clipboard.getDimensions().getBlockZ()).build();
|
||||
}
|
||||
|
||||
public AutoChecker.BlockScanResult scan(Clipboard clipboard, GameModeConfig<Material, String> type) {
|
||||
AutoChecker.BlockScanResult result = new AutoChecker.BlockScanResult();
|
||||
@@ -119,19 +137,16 @@ public class AutoChecker21 implements AutoChecker.IAutoChecker {
|
||||
result.getWindChargeCount().put(pos, windChargeCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AutoCheckerResult check(Clipboard clipboard, GameModeConfig<Material, String> type) {
|
||||
return AutoCheckerResult.builder().type(type).height(clipboard.getDimensions().getBlockY()).width(clipboard.getDimensions().getBlockX())
|
||||
.depth(clipboard.getDimensions().getBlockZ()).blockScanResult(scan(clipboard, type))
|
||||
.entities(clipboard.getEntities().stream().map(Entity::getLocation)
|
||||
.map(blockVector3 -> new BlockPos(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ()))
|
||||
.collect(Collectors.toList()))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AutoCheckerResult sizeCheck(Clipboard clipboard, GameModeConfig<Material, String> type) {
|
||||
return AutoCheckerResult.builder().type(type).height(clipboard.getDimensions().getBlockY()).width(clipboard.getDimensions().getBlockX())
|
||||
.depth(clipboard.getDimensions().getBlockZ()).build();
|
||||
@Getter
|
||||
@ToString
|
||||
public static class BlockScanResult {
|
||||
private final Map<Material, Integer> blockCounts = new EnumMap<>(Material.class);
|
||||
private final List<BlockPos> defunctNbt = new ArrayList<>();
|
||||
private final List<BlockPos> records = new ArrayList<>();
|
||||
private final Map<Material, List<BlockPos>> designBlocks = new EnumMap<>(Material.class);
|
||||
private final Map<BlockPos, Integer> dispenserItems = new HashMap<>();
|
||||
private final Map<BlockPos, Integer> windChargeCount = new HashMap<>();
|
||||
private final Map<BlockPos, Set<Material>> forbiddenItems = new HashMap<>();
|
||||
private final Map<BlockPos, Set<Material>> forbiddenNbt = new HashMap<>();
|
||||
}
|
||||
}
|
||||
+13
-11
@@ -3,16 +3,18 @@
|
||||
*
|
||||
* 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 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.
|
||||
* 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/>.
|
||||
* 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;
|
||||
@@ -22,7 +24,9 @@ import org.bukkit.Material;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class AutoCheckerItems21 implements AutoCheckerItems {
|
||||
public class AutoCheckerItems {
|
||||
|
||||
public static final AutoCheckerItems impl = new 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,
|
||||
@@ -37,12 +41,10 @@ public class AutoCheckerItems21 implements AutoCheckerItems {
|
||||
Material.GOLDEN_HORSE_ARMOR, Material.LEATHER_HORSE_ARMOR, Material.HONEY_BOTTLE, Material.LILAC, Material.ROSE_BUSH, Material.PEONY,
|
||||
Material.TALL_GRASS, Material.LARGE_FERN);
|
||||
|
||||
@Override
|
||||
public Set<Material> getInventoryMaterials() {
|
||||
return INVENTORY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Material> getAllowedMaterialsInInventory() {
|
||||
return FLOWERS;
|
||||
}
|
||||
+1
-1
@@ -244,7 +244,7 @@ public class GUI {
|
||||
Clipboard finalClipboard = clipboard;
|
||||
List<SchematicType> types = SchematicType.values().parallelStream()
|
||||
.filter(SchematicType::isAssignable)
|
||||
.filter(type -> finalClipboard == null || SchematicSystem.getGameModeConfig(type) == null || AutoChecker.sizeCheck(finalClipboard, SchematicSystem.getGameModeConfig(type)).fastOk())
|
||||
.filter(type -> finalClipboard == null || SchematicSystem.getGameModeConfig(type) == null || AutoChecker.impl.sizeCheck(finalClipboard, SchematicSystem.getGameModeConfig(type)).fastOk())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<SWListInv.SWListEntry<SchematicType>> items = types.stream()
|
||||
+122
-8
@@ -31,27 +31,142 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import de.steamwar.command.AbstractSWCommand;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.schematicsystem.SchematicSystem;
|
||||
import de.steamwar.schematicsystem.autocheck.AutoCheckerResult;
|
||||
import de.steamwar.schematicsystem.autocheck.BlockPos;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import de.steamwar.sql.*;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SchematicCommand15 implements SchematicCommand.ISchematicCommand {
|
||||
import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandHelp.*;
|
||||
import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.togglePublic;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Linked
|
||||
public class SchematicCommand extends SWCommand {
|
||||
|
||||
public SchematicCommand() {
|
||||
super("schematic", new String[] {"schem", "/schem", "/schematic"});
|
||||
}
|
||||
|
||||
@Register("help")
|
||||
public void pagedHelp(Player player, HelpPage page) {
|
||||
printHelpPage(player, page);
|
||||
}
|
||||
|
||||
@Register
|
||||
public void genericHelp(Player player, String... args) {
|
||||
printHelpMainPage(player);
|
||||
}
|
||||
|
||||
@Register(value = "togglepublic", noTabComplete = true)
|
||||
public void togglePublicMode(Player player) {
|
||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||
if (!user.hasPerm(UserPerm.MODERATION)) {
|
||||
genericHelp(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (togglePublic(player)) {
|
||||
SchematicSystem.MESSAGE.send("COMMAND_PUBLIC_ON", player);
|
||||
} else {
|
||||
SchematicSystem.MESSAGE.send("COMMAND_PUBLIC_OFF", player);
|
||||
}
|
||||
}
|
||||
|
||||
@Mapper("publicMapper")
|
||||
public TypeMapper<SchematicNode> publicNodeTypeMapper() {
|
||||
return SchematicMapper.publicNodeTypeMapper();
|
||||
}
|
||||
|
||||
@Mapper("memberMapper")
|
||||
public static TypeMapper<NodeMember> nodeMemberTypeMapper() {
|
||||
return SchematicMapper.nodeMemberTypeMapper();
|
||||
}
|
||||
|
||||
@Mapper("dirMapper")
|
||||
public static TypeMapper<SchematicNode> dirNodeTypeMapper() {
|
||||
return SchematicMapper.dirNodeTypeMapper();
|
||||
}
|
||||
|
||||
@Mapper("publicDirMapper")
|
||||
public static TypeMapper<SchematicNode> publicDirNodeTypeMapper() {
|
||||
return SchematicMapper.publicDirNodeTypeMapper();
|
||||
}
|
||||
|
||||
@Mapper("dirStringMapper")
|
||||
public static TypeMapper<String> stringTabMapper() {
|
||||
return SchematicMapper.stringTabMapper();
|
||||
}
|
||||
|
||||
@Mapper("stringMapper")
|
||||
public static TypeMapper<String> stringMapper() {
|
||||
return SchematicMapper.stringMapper();
|
||||
}
|
||||
|
||||
@ClassMapper(SchematicType.class)
|
||||
public static TypeMapper<SchematicType> typeTypeMapper() {
|
||||
return SchematicMapper.typeTypeMapper();
|
||||
}
|
||||
|
||||
@AbstractSWCommand.ClassMapper(value = SchematicNode.class, local = true)
|
||||
public static TypeMapper<SchematicNode> nodeTypeMapper() {
|
||||
return SchematicMapper.nodeTypeMapper();
|
||||
}
|
||||
|
||||
@ClassMapper(value = GameModeConfig.class, local = true)
|
||||
public static TypeMapper<GameModeConfig<Material, String>> gameModeConfigTypeMapper() {
|
||||
return SchematicMapper.gameModeConfigTypeMapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sendMessage(CommandSender sender, String message, Object[] args) {
|
||||
SchematicSystem.MESSAGE.send(message, sender, args);
|
||||
}
|
||||
|
||||
@Validator(value = "isSchemValidator", local = true)
|
||||
public static TypeValidator<SchematicNode> isSchemValidator() {
|
||||
return SchematicValidator.isSchemValidator();
|
||||
}
|
||||
|
||||
@Validator(value = "isDirValidator", local = true)
|
||||
public static TypeValidator<SchematicNode> isDirValidator() {
|
||||
return SchematicValidator.isDirValidator();
|
||||
}
|
||||
|
||||
@Validator(value = "isOwnerValidator", local = true)
|
||||
public static TypeValidator<SchematicNode> isOwnerValidator() {
|
||||
return SchematicValidator.isOwnerValidator();
|
||||
}
|
||||
|
||||
@Validator(value = "isOwnerSchematicValidator", local = true)
|
||||
public static TypeValidator<SchematicNode> isOwnerSchematicValidator() {
|
||||
return SchematicValidator.isOwnerSchematicValidator();
|
||||
}
|
||||
|
||||
public enum Extend {
|
||||
AUSFAHREN,
|
||||
NORMAL
|
||||
}
|
||||
|
||||
private static final Function<CompoundTag, Integer> getCount = item -> Core.getVersion() >= 21 ? item.getInt("count") : item.getByte("Count");
|
||||
private static final BiFunction<CompoundTag, Integer, CompoundTag> setCount = (item, count) -> Core.getVersion() >= 21 ?
|
||||
item.createBuilder().putInt("count", count).build() :
|
||||
item.createBuilder().putByte("Count", count.byteValue()).build();
|
||||
|
||||
@Override
|
||||
public Clipboard fixClipboard(Clipboard clipboard, AutoCheckerResult result, GameModeConfig<Material, String> type) throws Exception {
|
||||
public static Clipboard fixClipboard(Clipboard clipboard, AutoCheckerResult result, GameModeConfig<Material, String> type) throws Exception {
|
||||
for (BlockPos blockPos : result.getBlockScanResult().getRecords()) {
|
||||
BlockVector3 vector = BlockVector3.at(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
clipboard.setBlock(vector, clipboard.getFullBlock(vector).toBaseBlock(new CompoundTag(Collections.emptyMap())));
|
||||
@@ -149,8 +264,7 @@ public class SchematicCommand15 implements SchematicCommand.ISchematicCommand {
|
||||
return clipboard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createCopy(EditSession editSession, Clipboard clipboard) throws WorldEditException {
|
||||
public static void createCopy(EditSession editSession, Clipboard clipboard) throws WorldEditException {
|
||||
Operations.complete(new ForwardExtentCopy(editSession, clipboard.getRegion(), clipboard, clipboard.getMinimumPoint()));
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -20,7 +20,6 @@
|
||||
package de.steamwar.schematicsystem.commands.schematiccommand;
|
||||
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.inventory.SWInventory;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.network.NetworkSender;
|
||||
@@ -312,7 +311,7 @@ public class SchematicCommandUtils {
|
||||
}
|
||||
|
||||
public static void check(Player player, Clipboard clipboard, GameModeConfig<Material, String> type, String schemName, boolean gui) {
|
||||
AutoCheckerResult result = AutoChecker.check(clipboard, type);
|
||||
AutoCheckerResult result = AutoChecker.impl.check(clipboard, type);
|
||||
if(!result.isOk()) {
|
||||
result.sendErrorMessage(player, schemName);
|
||||
} else {
|
||||
@@ -462,7 +461,7 @@ public class SchematicCommandUtils {
|
||||
|
||||
AutoCheckerResult result = null;
|
||||
try {
|
||||
result = AutoChecker.check(new SchematicData(node).load(), checkSchemType);
|
||||
result = AutoChecker.impl.check(new SchematicData(node).load(), checkSchemType);
|
||||
} catch (IOException e) {
|
||||
SchematicSystem.MESSAGE.send("UTIL_LOAD_ERROR", player);
|
||||
SchematicSystem.getInstance().getLogger().throwing(SchematicCommandUtils.class.getName(), "changeType", e);
|
||||
+1
-5
@@ -20,12 +20,8 @@
|
||||
package de.steamwar.schematicsystem.commands.schematiccommand;
|
||||
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.schematicsystem.SchematicSystem;
|
||||
import de.steamwar.sql.NodeMember;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.*;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
+2
@@ -23,8 +23,10 @@ import de.steamwar.command.AbstractValidator;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@UtilityClass
|
||||
public class SchematicValidator {
|
||||
|
||||
private static boolean nodeNullCheck(AbstractValidator.MessageSender messageSender, SchematicNode node) {
|
||||
+5
-7
@@ -28,22 +28,20 @@ import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import de.steamwar.command.AbstractSWCommand;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.schematicsystem.SchematicSystem;
|
||||
import de.steamwar.schematicsystem.autocheck.AutoChecker;
|
||||
import de.steamwar.schematicsystem.autocheck.AutoCheckerResult;
|
||||
import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommand;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.sql.SchematicData;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommand.impl;
|
||||
import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommandUtils.check;
|
||||
|
||||
@AbstractSWCommand.PartOf(SchematicCommand.class)
|
||||
@@ -77,7 +75,7 @@ public class CheckPart extends SWCommand {
|
||||
Clipboard clipboard = new BlockArrayClipboard(WorldEdit.getInstance().getSessionManager().findByName(player.getName()).getSelection(new BukkitWorld(player.getWorld())));
|
||||
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(player.getWorld()), -1);
|
||||
|
||||
impl.createCopy(editSession, clipboard);
|
||||
SchematicCommand.createCopy(editSession, clipboard);
|
||||
|
||||
check(player, clipboard, type, "selection", false);
|
||||
} catch (IncompleteRegionException e) {
|
||||
@@ -100,15 +98,15 @@ public class CheckPart extends SWCommand {
|
||||
SchematicSystem.MESSAGE.send("COMMAND_CHECK_CLIPBOARD_EMPTY", player);
|
||||
return;
|
||||
}
|
||||
AutoCheckerResult result = AutoChecker.check(clipboard, type);
|
||||
AutoCheckerResult result = AutoChecker.impl.check(clipboard, type);
|
||||
if(result.isOk()) {
|
||||
SchematicSystem.MESSAGE.send("COMMAND_FIX_OK", player);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
clipboard = impl.fixClipboard(clipboard, result, type);
|
||||
clipboard = SchematicCommand.fixClipboard(clipboard, result, type);
|
||||
WorldEdit.getInstance().getSessionManager().get(new BukkitPlayer(player)).setClipboard(new ClipboardHolder(clipboard));
|
||||
AutoCheckerResult after = AutoChecker.check(clipboard, type);
|
||||
AutoCheckerResult after = AutoChecker.impl.check(clipboard, type);
|
||||
if(after.isOk()) {
|
||||
SchematicSystem.MESSAGE.send("COMMAND_FIX_DONE", player);
|
||||
} else {
|
||||
+1
-1
@@ -63,7 +63,7 @@ public class ModifyPart extends SWCommand {
|
||||
|
||||
SchematicType.values().parallelStream()
|
||||
.filter(SchematicType::isAssignable)
|
||||
.filter(type -> SchematicSystem.getGameModeConfig(type) == null || AutoChecker.sizeCheck(clipboard, SchematicSystem.getGameModeConfig(type)).fastOk())
|
||||
.filter(type -> SchematicSystem.getGameModeConfig(type) == null || AutoChecker.impl.sizeCheck(clipboard, SchematicSystem.getGameModeConfig(type)).fastOk())
|
||||
.forEach(type -> {
|
||||
TextComponent component = new TextComponent(type.name() + " ");
|
||||
component.setColor(ChatColor.GRAY);
|
||||
+1
-9
@@ -214,15 +214,7 @@ include("MissileWars")
|
||||
|
||||
include("Realtime")
|
||||
|
||||
include(
|
||||
"SchematicSystem",
|
||||
"SchematicSystem:SchematicSystem_8",
|
||||
"SchematicSystem:SchematicSystem_15",
|
||||
"SchematicSystem:SchematicSystem_19",
|
||||
"SchematicSystem:SchematicSystem_20",
|
||||
"SchematicSystem:SchematicSystem_21",
|
||||
"SchematicSystem:SchematicSystem_Core"
|
||||
)
|
||||
include("SchematicSystem")
|
||||
|
||||
include(
|
||||
"SpigotCore",
|
||||
|
||||
Reference in New Issue
Block a user