From 94ded124a279cafec77041b9e3a742caaec76a0e Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 4 Sep 2021 22:05:05 +0200 Subject: [PATCH] Sign Color Signed-off-by: Chaoscaot --- .../features/world/SignListener.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/world/SignListener.java diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignListener.java new file mode 100644 index 00000000..36058c83 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignListener.java @@ -0,0 +1,42 @@ +/* + * 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.features.world; + +import de.steamwar.bausystem.linkage.LinkageType; +import de.steamwar.bausystem.linkage.Linked; +import org.bukkit.ChatColor; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.SignChangeEvent; + +@Linked(LinkageType.LISTENER) +public class SignListener implements Listener { + + @EventHandler + public void onSignChange(SignChangeEvent event) { + for (int i = 0; i <= 3; ++i) { + String line = event.getLine(i); + if (line == null) + continue; + line = ChatColor.translateAlternateColorCodes('&', line); + event.setLine(i, line); + } + } +} -- 2.39.5