13
0

Show Invalid SchematicTypes in changeType GUI #142

Zusammengeführt
Chaoscaot hat 1 Commits von types_list nach master 2023-02-03 17:39:18 +01:00 zusammengeführt
3 geänderte Dateien mit 53 neuen und 2 gelöschten Zeilen
Nur Änderungen aus Commit 271b38c775 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -1,3 +1,22 @@
#
# This file is a part of the SteamWar software.
#
# Copyright (C) 2023 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/>.
#
PREFIX=§eSchematic§8» §7 PREFIX=§eSchematic§8» §7
ON=§aon ON=§aon
OFF=§coff OFF=§coff
@ -193,6 +212,8 @@ GUI_INFO_DELETE=§cDelete
GUI_INFO_MEMBER_FROM=§7Owner §e{0} GUI_INFO_MEMBER_FROM=§7Owner §e{0}
GUI_INFO_MEMBER_REMOVE=§cRemove access GUI_INFO_MEMBER_REMOVE=§cRemove access
GUI_CHANGE_TYPE=Change type GUI_CHANGE_TYPE=Change type
GUI_CHANGE_TYPE_NOT_POSSIBLE=§cThe Schematic is too big
GUI_CHANGE_TYPE_NOT_POSSIBLE_COLOR=§7{0}
GUI_DELETE_OWN_DELETED=Schematic §e{0} §7deleted GUI_DELETE_OWN_DELETED=Schematic §e{0} §7deleted
GUI_DELETE_OWN_TITLE=Delete {0} GUI_DELETE_OWN_TITLE=Delete {0}
GUI_DELETE_MEMBER_TITLE=Remove {0} GUI_DELETE_MEMBER_TITLE=Remove {0}

Datei anzeigen

@ -1,3 +1,22 @@
#
# This file is a part of the SteamWar software.
#
# Copyright (C) 2023 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/>.
#
ON=§aAn ON=§aAn
OFF=§cAus OFF=§cAus
CHANGE=§7Zum Ändern CHANGE=§7Zum Ändern
@ -174,6 +193,7 @@ GUI_INFO_DELETE=§cLöschen
GUI_INFO_MEMBER_FROM=§7von §e{0} GUI_INFO_MEMBER_FROM=§7von §e{0}
GUI_INFO_MEMBER_REMOVE=§cZugriff entfernen GUI_INFO_MEMBER_REMOVE=§cZugriff entfernen
GUI_CHANGE_TYPE=Typ ändern GUI_CHANGE_TYPE=Typ ändern
GUI_CHANGE_TYPE_NOT_POSSIBLE=§cDie Schematic ist zu groß
GUI_DELETE_OWN_DELETED=Schematic §e{0} §7gelöscht GUI_DELETE_OWN_DELETED=Schematic §e{0} §7gelöscht
GUI_DELETE_OWN_TITLE={0} löschen GUI_DELETE_OWN_TITLE={0} löschen
GUI_DELETE_MEMBER_TITLE={0} entfernen GUI_DELETE_MEMBER_TITLE={0} entfernen

Datei anzeigen

@ -221,13 +221,23 @@ public class GUI {
} catch (IOException ignored) { } } catch (IOException ignored) { }
Clipboard finalClipboard = clipboard; Clipboard finalClipboard = clipboard;
List<SWListInv.SWListEntry<SchematicType>> types = SchematicType.values().parallelStream() List<SchematicType> types = SchematicType.values().parallelStream()
.filter(SchematicType::isAssignable) .filter(SchematicType::isAssignable)
.filter(type -> finalClipboard == null || CheckSchemType.get(type) == null || AutoChecker.sizeCheck(finalClipboard, CheckSchemType.get(type)).fastOk()) .filter(type -> finalClipboard == null || CheckSchemType.get(type) == null || AutoChecker.sizeCheck(finalClipboard, CheckSchemType.get(type)).fastOk())
.collect(Collectors.toList());
List<SWListInv.SWListEntry<SchematicType>> items = types.stream()
.map(type -> new SWListInv.SWListEntry<>(new SWItem(SWItem.getMaterial(type.getMaterial()), type.name(), Collections.emptyList(), type.fightType(), null), type)) .map(type -> new SWListInv.SWListEntry<>(new SWItem(SWItem.getMaterial(type.getMaterial()), type.name(), Collections.emptyList(), type.fightType(), null), type))
.collect(Collectors.toList()); .collect(Collectors.toList());
SWListInv<SchematicType> inv = new SWListInv<>(p, SchematicSystem.MESSAGE.parse("GUI_CHANGE_TYPE", p), types, (clickType, schematicType) -> { items.addAll(SchematicType.values().stream()
.filter(SchematicType::isAssignable)
.filter(type -> !types.contains(type))
.map(type -> new SWListInv.SWListEntry<>(new SWItem(SWItem.getMaterial(type.getMaterial()), SchematicSystem.MESSAGE.parse("GUI_CHANGE_TYPE_NOT_POSSIBLE_COLOR", p, type.name()), Collections.singletonList(SchematicSystem.MESSAGE.parse("GUI_CHANGE_TYPE_NOT_POSSIBLE", p)), false, null), (SchematicType) null))
.collect(Collectors.toList()));
SWListInv<SchematicType> inv = new SWListInv<>(p, SchematicSystem.MESSAGE.parse("GUI_CHANGE_TYPE", p), items, (clickType, schematicType) -> {
if(schematicType == null) return;
p.closeInventory(); p.closeInventory();
SchematicCommandUtils.changeType(p, schem, schematicType, null); SchematicCommandUtils.changeType(p, schem, schematicType, null);
}); });