From 880c6f50668f91726d836daa6220268f2ca68084 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Tue, 25 Nov 2025 16:37:19 +0100 Subject: [PATCH] Remove TypeGenerator --- .../worldedit/types/TypeGenerator.java | 93 ------------------- 1 file changed, 93 deletions(-) delete mode 100644 BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/types/TypeGenerator.java diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/types/TypeGenerator.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/types/TypeGenerator.java deleted file mode 100644 index 02038f18..00000000 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/types/TypeGenerator.java +++ /dev/null @@ -1,93 +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 . - */ - -package de.steamwar.bausystem.features.worldedit.types; - -import com.google.common.collect.Sets; -import de.steamwar.bausystem.shared.Pair; -import de.steamwar.linkage.Linked; -import de.steamwar.linkage.api.Enable; -import org.bukkit.Material; - -import java.util.*; -import java.util.stream.Collectors; - -@Linked -public class TypeGenerator implements Enable { - - public static void main(String[] args) { - new TypeGenerator().enable(); - } - - @Override - public void enable() { - List materials = Arrays.stream(Material.values()) - .filter(material -> !material.isLegacy()) - .filter(Material::isBlock) - .sorted(Comparator.comparingInt(value -> value.name().length())) - .collect(Collectors.toList()); - - Map, Double> equalityMap = new HashMap<>(); - for (int i = 0; i < materials.size(); i++) { - Material first = materials.get(i); - String[] firstNameSplit = first.name().split("_"); - for (int j = i + 1; j < materials.size(); j++) { - Material second = materials.get(j); - String[] secondNameSplit = second.name().split("_"); - double equality = equality(secondNameSplit, firstNameSplit); - if (equality == 0) continue; - equalityMap.put(new Pair<>(first, second), equality); - } - } - - Map>> reverseEqualityMap = new HashMap<>(); - for (Map.Entry, Double> entry : equalityMap.entrySet()) { - reverseEqualityMap.computeIfAbsent(entry.getValue(), key -> new ArrayList<>()) - .add(entry.getKey()); - } - - List keys = reverseEqualityMap.keySet() - .stream() - .sorted(Comparator.comparingDouble(a -> -a)) - .collect(Collectors.toList()); - - for (int i = 0; i <= keys.size() - 1; i++) { - double key = keys.get(i); - List> list = reverseEqualityMap.get(key); - list.forEach(System.out::println); - break; - } - } - - private double equality(String[] first, String[] second) { - int equality = 0; - int divisor = 0; - Set firstSet = Sets.newHashSet(first); - Set secondSet = Sets.newHashSet(second); - for (int i = 0; i < first.length; i++) { - if (secondSet.contains(first[i])) equality += first[i].length(); - divisor += first[i].length(); - } - for (int i = 0; i < second.length; i++) { - if (firstSet.contains(second[i])) equality += second[i].length(); - divisor += second[i].length(); - } - return equality / (double) divisor; - } -}