Add ScoreboardItem
Dieser Commit ist enthalten in:
Ursprung
3ce4a9b4d3
Commit
52f07bac6e
@ -40,15 +40,20 @@ import java.util.function.Predicate;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
public enum LinkageType {
|
public enum LinkageType {
|
||||||
|
|
||||||
|
// NORMAL
|
||||||
COMMAND(-1, false, SWCommand.class::isAssignableFrom),
|
COMMAND(-1, false, SWCommand.class::isAssignableFrom),
|
||||||
ENABLE_LINK(0, false, Enable.class::isAssignableFrom, o -> ((Enable) o).enable()),
|
ENABLE_LINK(0, false, Enable.class::isAssignableFrom, o -> ((Enable) o).enable()),
|
||||||
DISABLE_LINK(0, true, Disable.class::isAssignableFrom, o -> ((Disable) o).disable()),
|
DISABLE_LINK(0, true, Disable.class::isAssignableFrom, o -> ((Disable) o).disable()),
|
||||||
PLAIN(1, false, clazz -> true),
|
PLAIN(1, false, clazz -> true),
|
||||||
LISTENER(2, false, Listener.class::isAssignableFrom, o -> Bukkit.getPluginManager().registerEvents((Listener) o, BauSystem.getInstance())),
|
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)),
|
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)),
|
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)),
|
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;
|
private final int order;
|
||||||
|
|
||||||
|
37
BauSystem_Main/src/de/steamwar/bausystem/linkage/ScoreboardItem.java
Normale Datei
37
BauSystem_Main/src/de/steamwar/bausystem/linkage/ScoreboardItem.java
Normale Datei
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren