diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/dev/CreateKitCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/dev/CreateKitCommand.java new file mode 100644 index 00000000..2f0fc185 --- /dev/null +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/dev/CreateKitCommand.java @@ -0,0 +1,63 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2026 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.dev; + +import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.io.IOException; + +@Linked +public class CreateKitCommand extends SWCommand { + public CreateKitCommand() { + super("createkit"); + if (System.getProperty("user.name").equals("minecraft")) { + unregister(); + } + } + + @Register + public void onCommand(Player player, String name) { + YamlConfiguration yaml = new YamlConfiguration(); + + yaml.set("Items", player.getInventory().getContents()); + yaml.set("Armor", player.getInventory().getArmorContents()); + yaml.set("Effects", player.getActivePotionEffects()); + yaml.set("LeaderAllowed", true); + yaml.set("MemberAllowed", true); + yaml.set("EnterStage", 0); + yaml.set("TNT", true); + + YamlConfiguration kits = new YamlConfiguration(); + + kits.set("Kits." + name, yaml); + + try { + kits.save(new File("new.kits.yaml")); + + player.sendMessage("Kit created!"); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +}