diff --git a/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageType.java b/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageType.java index 32f2d4ae..44836e8b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageType.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageType.java @@ -40,15 +40,20 @@ import java.util.function.Predicate; @AllArgsConstructor @Getter public enum LinkageType { + + // NORMAL COMMAND(-1, false, SWCommand.class::isAssignableFrom), ENABLE_LINK(0, false, Enable.class::isAssignableFrom, o -> ((Enable) o).enable()), DISABLE_LINK(0, true, Disable.class::isAssignableFrom, o -> ((Disable) o).disable()), PLAIN(1, false, clazz -> true), LISTENER(2, false, Listener.class::isAssignableFrom, o -> Bukkit.getPluginManager().registerEvents((Listener) o, BauSystem.getInstance())), UNLINK_LISTENER(2, true, Listener.class::isAssignableFrom, o -> HandlerList.unregisterAll((Listener) o)), + + // SPECIFIC GUI_ITEM(3, false, GuiItem.class::isAssignableFrom, o -> BauGUI.addItem((GuiItem) o)), SCRIPT_COMMAND(4, false, SpecialCommand.class::isAssignableFrom, o -> ScriptExecutor.SPECIAL_COMMANDS.add((SpecialCommand) o)), - CONFIG_CONVERTER(5, false, ConfigConverter.class::isAssignableFrom, o -> ConfigUpdater.addConfigConverter((ConfigConverter) o)); + CONFIG_CONVERTER(5, false, ConfigConverter.class::isAssignableFrom, o -> ConfigUpdater.addConfigConverter((ConfigConverter) o)), + SCOREBOARD(6, false, ScoreboardItem.class::isAssignableFrom, o -> {}); private final int order; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/linkage/ScoreboardItem.java b/BauSystem_Main/src/de/steamwar/bausystem/linkage/ScoreboardItem.java new file mode 100644 index 00000000..946c18f2 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/linkage/ScoreboardItem.java @@ -0,0 +1,37 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2021 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.linkage; + +import de.steamwar.bausystem.region.Region; +import org.bukkit.entity.Player; + +public interface ScoreboardItem { + + /** + * Returns one Scoreboard line. If {@code null} result will be ignored. + * If return value contains {@code '?'} it will be replaced to the color + * code of the current {@link Region}. + * + * @param player the player to create the scoreboard line for + * @param region the region the player is in + * @return the String to send, can be {@code null} + */ + String getString(Player player, Region region); +}