From 52eebdf769309a6ef4e5b19d91c7772ebfa140f5 Mon Sep 17 00:00:00 2001 From: Peridot Date: Fri, 20 Jan 2023 20:05:52 +0100 Subject: [PATCH 01/14] Add BungeeCord support --- README.md | 3 +- build.gradle | 4 ++ .../spaceis/plugin/bukkit/BukkitMessages.java | 13 +++++ ...Command.java => BukkitSpaceIsCommand.java} | 18 ++++--- .../plugin/bukkit/BukkitSpaceIsPlugin.java | 7 ++- .../pl/spaceis/plugin/bukkit/Messages.java | 31 ----------- bungee/build.gradle | 4 ++ .../plugin/bungee/BungeeCommandsTask.java | 28 ++++++++++ .../plugin/bungee/BungeeConfigLoader.java | 35 +++++++++++++ .../spaceis/plugin/bungee/BungeeMessages.java | 15 ++++++ .../plugin/bungee/BungeeResourceLoader.java | 27 ++++++++++ .../plugin/bungee/BungeeSpaceIsCommand.java | 49 ++++++++++++++++++ .../plugin/bungee/BungeeSpaceIsLogger.java | 29 +++++++++++ .../plugin/bungee/BungeeSpaceIsPlugin.java | 51 +++++++++++++++++++ .../java/pl/spaceis/plugin/config/Config.java | 5 +- .../spaceis/plugin/config/ConfigLoader.java | 4 +- .../pl/spaceis/plugin/config/Messages.java | 30 +++++++++++ .../plugin/resource/ResourceLoader.java | 47 +++++++++++++++++ .../resource/ResourceLoaderException.java | 32 ++++++++++++ settings.gradle | 1 + 20 files changed, 389 insertions(+), 44 deletions(-) create mode 100644 bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitMessages.java rename bukkit/src/main/java/pl/spaceis/plugin/bukkit/{SpaceIsCommand.java => BukkitSpaceIsCommand.java} (69%) delete mode 100644 bukkit/src/main/java/pl/spaceis/plugin/bukkit/Messages.java create mode 100644 bungee/build.gradle create mode 100644 bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeCommandsTask.java create mode 100644 bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeConfigLoader.java create mode 100644 bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java create mode 100644 bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeResourceLoader.java create mode 100644 bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java create mode 100644 bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsLogger.java create mode 100644 bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsPlugin.java create mode 100644 common/src/main/java/pl/spaceis/plugin/config/Messages.java create mode 100644 common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java create mode 100644 common/src/main/java/pl/spaceis/plugin/resource/ResourceLoaderException.java diff --git a/README.md b/README.md index d43f958..ae7e6bf 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ Plugin łączący serwer Minecraft z itemshopem stworzonym na [SpaceIs.pl](https Wspierane (przetestowane przez autorów) wersje Minecrafta — od 1.8 do 1.19.3 Plugin przeznaczony dla platform: -- pochodnych Bukkita (Spigot, Paper, itp.) +- Bukkit/Spigot/Paper/... - 1.8 do 1.19.3 +- BungeeCord/WaterFall - 1.19+ Autor pluginu: [Kamilkime](https://github.com/Kamilkime) diff --git a/build.gradle b/build.gradle index ca0e382..78694fc 100644 --- a/build.gradle +++ b/build.gradle @@ -26,6 +26,10 @@ allprojects { name = 'spigotmc-repo' url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' } + maven { + name = 'sonatype-repo' + url = 'https://oss.sonatype.org/content/repositories/snapshots' + } } shadowJar { diff --git a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitMessages.java b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitMessages.java new file mode 100644 index 0000000..d2ebbd4 --- /dev/null +++ b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitMessages.java @@ -0,0 +1,13 @@ +package pl.spaceis.plugin.bukkit; + +import org.bukkit.ChatColor; +import pl.spaceis.plugin.config.Messages; + +public class BukkitMessages extends Messages { + + @Override + protected String color(final String message) { + return ChatColor.translateAlternateColorCodes('&', message); + } + +} diff --git a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/SpaceIsCommand.java b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java similarity index 69% rename from bukkit/src/main/java/pl/spaceis/plugin/bukkit/SpaceIsCommand.java rename to bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java index 0881d6b..d696021 100644 --- a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/SpaceIsCommand.java +++ b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java @@ -25,33 +25,37 @@ import org.bukkit.command.CommandSender; import pl.spaceis.plugin.config.Config; import pl.spaceis.plugin.config.EmptyConfigFieldException; +import pl.spaceis.plugin.config.Messages; +import pl.spaceis.plugin.resource.ResourceLoaderException; -public class SpaceIsCommand implements CommandExecutor { +public class BukkitSpaceIsCommand implements CommandExecutor { private static final Set RELOAD_ARGS = new HashSet<>(Arrays.asList("rl", "reload")); private final Config config; + private final Messages messages; - public SpaceIsCommand(final Config config) { + public BukkitSpaceIsCommand(final Config config, Messages messages) { this.config = config; + this.messages = messages; } @Override public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { if (!sender.hasPermission("spaceis.reload")) { - sender.sendMessage(Messages.NO_PERMISSION); + sender.sendMessage(this.messages.noPermission); return true; } if (args.length != 1 || !RELOAD_ARGS.contains(args[0].toLowerCase(Locale.ROOT))) { - sender.sendMessage(Messages.CORRECT_SYNTAX); + sender.sendMessage(this.messages.correctSyntax); return true; } try { this.config.loadValues(); - sender.sendMessage(Messages.CONFIG_RELOAD_SUCCESS); - } catch (final EmptyConfigFieldException exception) { - sender.sendMessage(Messages.CONFIG_RELOAD_ERROR + exception.getMessage()); + sender.sendMessage(this.messages.configReloadSuccess); + } catch (final ResourceLoaderException | EmptyConfigFieldException exception) { + sender.sendMessage(this.messages.configReloadError + exception.getMessage()); } return true; diff --git a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsPlugin.java b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsPlugin.java index e51d068..e0c9fa6 100644 --- a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsPlugin.java +++ b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsPlugin.java @@ -22,7 +22,9 @@ import pl.spaceis.plugin.config.Config; import pl.spaceis.plugin.config.ConfigLoader; import pl.spaceis.plugin.config.EmptyConfigFieldException; +import pl.spaceis.plugin.config.Messages; import pl.spaceis.plugin.logger.SpaceIsLogger; +import pl.spaceis.plugin.resource.ResourceLoaderException; public class BukkitSpaceIsPlugin extends JavaPlugin { @@ -34,6 +36,7 @@ public void onEnable() { final SpaceIsLogger logger = new BukkitSpaceIsLogger(this.getLogger()); final ConfigLoader configLoader = new BukkitConfigLoader(this); final Config config = new Config(configLoader); + final Messages messages = new BukkitMessages(); Bukkit.getScheduler().runTaskTimerAsynchronously( this, @@ -42,8 +45,8 @@ public void onEnable() { config.taskInterval.getSeconds() * 20L ); - this.getCommand("spaceis").setExecutor(new SpaceIsCommand(config)); - } catch (final EmptyConfigFieldException exception) { + this.getCommand("spaceis").setExecutor(new BukkitSpaceIsCommand(config, messages)); + } catch (final ResourceLoaderException | EmptyConfigFieldException exception) { this.getLogger().severe(exception.getMessage()); Bukkit.getPluginManager().disablePlugin(this); } diff --git a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/Messages.java b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/Messages.java deleted file mode 100644 index 60bb6cc..0000000 --- a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/Messages.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2023 Kamil Trysiński - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package pl.spaceis.plugin.bukkit; - -import org.bukkit.ChatColor; - -public final class Messages { - - public static final String PREFIX = ChatColor.DARK_GRAY + "[SpaceIs]"; - public static final String CORRECT_SYNTAX = PREFIX + ChatColor.RED + " Poprawne użycie:" + ChatColor.GRAY + " /spaceis reload"; - public static final String NO_PERMISSION = PREFIX + ChatColor.RED + " Brak uprawnień"; - public static final String CONFIG_RELOAD_ERROR = PREFIX + ChatColor.RED + " Błąd podczas ładowania konfiguracji:" + ChatColor.GRAY; - public static final String CONFIG_RELOAD_SUCCESS = PREFIX + ChatColor.GREEN + " Konfiguracja załadowana poprawnie"; - - private Messages() {} - -} diff --git a/bungee/build.gradle b/bungee/build.gradle new file mode 100644 index 0000000..28a1f01 --- /dev/null +++ b/bungee/build.gradle @@ -0,0 +1,4 @@ +dependencies { + implementation project(':common') + compileOnly 'net.md-5:bungeecord-api:1.19-R0.1-SNAPSHOT' +} diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeCommandsTask.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeCommandsTask.java new file mode 100644 index 0000000..646660b --- /dev/null +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeCommandsTask.java @@ -0,0 +1,28 @@ +package pl.spaceis.plugin.bungee; + +import net.md_5.bungee.api.ProxyServer; +import okhttp3.OkHttpClient; +import pl.spaceis.plugin.command.CommandsTask; +import pl.spaceis.plugin.config.Config; +import pl.spaceis.plugin.logger.SpaceIsLogger; + +public class BungeeCommandsTask extends CommandsTask { + + private final ProxyServer proxy; + + public BungeeCommandsTask(final OkHttpClient httpClient, final Config config, final SpaceIsLogger logger) { + super(httpClient, config, logger); + this.proxy = ProxyServer.getInstance(); + } + + @Override + public boolean isPlayerOnline(final String playerName) { + return this.proxy.getPlayer(playerName) != null; + } + + @Override + public void executeCommand(final String command) { + this.proxy.getPluginManager().dispatchCommand(this.proxy.getConsole(), command); + } + +} diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeConfigLoader.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeConfigLoader.java new file mode 100644 index 0000000..20398f7 --- /dev/null +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeConfigLoader.java @@ -0,0 +1,35 @@ +package pl.spaceis.plugin.bungee; + +import net.md_5.bungee.config.Configuration; +import pl.spaceis.plugin.config.ConfigLoader; +import pl.spaceis.plugin.resource.ResourceLoader; +import pl.spaceis.plugin.resource.ResourceLoaderException; + +public class BungeeConfigLoader implements ConfigLoader { + + private final ResourceLoader resourceLoader; + private final String configFileName; + private Configuration configFile; + + public BungeeConfigLoader(final ResourceLoader resourceLoader, final String configFileName) { + this.resourceLoader = resourceLoader; + this.configFileName = configFileName; + } + + @Override + public void reloadConfig() throws ResourceLoaderException { + this.resourceLoader.saveDefault(this.configFileName); + this.configFile = this.resourceLoader.load(this.configFileName); + } + + @Override + public boolean getBoolean(final String key) { + return this.configFile.getBoolean(key); + } + + @Override + public String getString(final String key) { + return this.configFile.getString(key); + } + +} diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java new file mode 100644 index 0000000..8fa58d2 --- /dev/null +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java @@ -0,0 +1,15 @@ +package pl.spaceis.plugin.bungee; + +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.TextComponent; +import pl.spaceis.plugin.config.Messages; + +public class BungeeMessages extends Messages { + + @Override + protected BaseComponent color(final String message) { + return new TextComponent(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', message))); + } + +} diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeResourceLoader.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeResourceLoader.java new file mode 100644 index 0000000..e2fb4a8 --- /dev/null +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeResourceLoader.java @@ -0,0 +1,27 @@ +package pl.spaceis.plugin.bungee; + +import java.io.File; +import java.nio.file.Path; +import net.md_5.bungee.config.Configuration; +import net.md_5.bungee.config.ConfigurationProvider; +import net.md_5.bungee.config.YamlConfiguration; +import pl.spaceis.plugin.resource.ResourceLoader; +import pl.spaceis.plugin.resource.ResourceLoaderException; +import pl.spaceis.plugin.resource.ResourceLoaderException.Reason; + +public class BungeeResourceLoader extends ResourceLoader { + + public BungeeResourceLoader(final Class loadingClass, final File dataFolder) { + super(loadingClass, dataFolder.toPath()); + } + + @Override + public Configuration loadResource(final Path resourcePath) throws ResourceLoaderException { + try { + return ConfigurationProvider.getProvider(YamlConfiguration.class).load(resourcePath.toFile()); + } catch (final Exception exception) { + throw new ResourceLoaderException(Reason.FILE_NOT_LOADED, resourcePath.getFileName().toString(), exception); + } + } + +} \ No newline at end of file diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java new file mode 100644 index 0000000..23133bd --- /dev/null +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java @@ -0,0 +1,49 @@ +package pl.spaceis.plugin.bungee; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Locale; +import java.util.Set; +import net.md_5.bungee.api.CommandSender; +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.plugin.Command; +import pl.spaceis.plugin.config.Config; +import pl.spaceis.plugin.config.EmptyConfigFieldException; +import pl.spaceis.plugin.config.Messages; +import pl.spaceis.plugin.resource.ResourceLoaderException; + +public class BungeeSpaceIsCommand extends Command { + + private static final Set RELOAD_ARGS = new HashSet<>(Arrays.asList("rl", "reload")); + private final Config config; + private final Messages messages; + + public BungeeSpaceIsCommand(final Config config, final Messages messages) { + super("spaceis"); + this.config = config; + this.messages = messages; + } + + @Override + public void execute(final CommandSender sender, final String[] args) { + if (!sender.hasPermission("spaceis.reload")) { + sender.sendMessage(this.messages.noPermission); + return; + } + + if (args.length != 1 || !RELOAD_ARGS.contains(args[0].toLowerCase(Locale.ROOT))) { + sender.sendMessage(this.messages.correctSyntax); + return; + } + + try { + this.config.loadValues(); + sender.sendMessage(this.messages.configReloadSuccess); + } catch (final ResourceLoaderException | EmptyConfigFieldException exception) { + BaseComponent errorMessage = this.messages.configReloadError.duplicate(); + errorMessage.addExtra(exception.getMessage()); + sender.sendMessage(errorMessage); + } + } + +} diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsLogger.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsLogger.java new file mode 100644 index 0000000..a657284 --- /dev/null +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsLogger.java @@ -0,0 +1,29 @@ +package pl.spaceis.plugin.bungee; + +import java.util.logging.Logger; +import pl.spaceis.plugin.logger.SpaceIsLogger; + +public class BungeeSpaceIsLogger implements SpaceIsLogger { + + private final Logger logger; + + public BungeeSpaceIsLogger(final Logger logger) { + this.logger = logger; + } + + @Override + public void info(final String message) { + this.logger.info(message); + } + + @Override + public void error(final String message) { + this.logger.severe(message); + } + + @Override + public void debug(final String message) { + this.logger.info(String.format("[DEBUG] %s", message)); + } + +} diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsPlugin.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsPlugin.java new file mode 100644 index 0000000..d2a5c05 --- /dev/null +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsPlugin.java @@ -0,0 +1,51 @@ +package pl.spaceis.plugin.bungee; + +import java.util.concurrent.TimeUnit; +import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.plugin.Plugin; +import net.md_5.bungee.config.Configuration; +import okhttp3.OkHttpClient; +import pl.spaceis.plugin.config.Config; +import pl.spaceis.plugin.config.ConfigLoader; +import pl.spaceis.plugin.config.EmptyConfigFieldException; +import pl.spaceis.plugin.config.Messages; +import pl.spaceis.plugin.logger.SpaceIsLogger; +import pl.spaceis.plugin.resource.ResourceLoader; +import pl.spaceis.plugin.resource.ResourceLoaderException; + +public class BungeeSpaceIsPlugin extends Plugin { + + private final OkHttpClient httpClient = new OkHttpClient.Builder().build(); + + @Override + public void onEnable() { + final ResourceLoader resourceLoader = new BungeeResourceLoader(this.getClass(), this.getDataFolder()); + try { + final SpaceIsLogger logger = new BungeeSpaceIsLogger(this.getLogger()); + final ConfigLoader configLoader = new BungeeConfigLoader(resourceLoader,"config.yml"); + final Config config = new Config(configLoader); + final Messages messages = new BungeeMessages(); + + ProxyServer.getInstance().getScheduler().schedule( + this, + new BungeeCommandsTask(this.httpClient, config, logger), + 0L, + config.taskInterval.getSeconds(), + TimeUnit.SECONDS + ); + + ProxyServer.getInstance().getPluginManager().registerCommand(this, new BungeeSpaceIsCommand(config, messages)); + } catch (final ResourceLoaderException | EmptyConfigFieldException exception) { + this.getLogger().severe(exception.getMessage()); + ProxyServer.getInstance().getScheduler().cancel(this); + } + } + + @Override + public void onDisable() { + ProxyServer.getInstance().getScheduler().cancel(this); + this.httpClient.dispatcher().executorService().shutdown(); + } + +} diff --git a/common/src/main/java/pl/spaceis/plugin/config/Config.java b/common/src/main/java/pl/spaceis/plugin/config/Config.java index 2083b75..54f2d1f 100644 --- a/common/src/main/java/pl/spaceis/plugin/config/Config.java +++ b/common/src/main/java/pl/spaceis/plugin/config/Config.java @@ -18,6 +18,7 @@ import java.time.Duration; import java.time.temporal.ChronoUnit; +import pl.spaceis.plugin.resource.ResourceLoaderException; public class Config { @@ -31,7 +32,7 @@ public class Config { public final Duration taskInterval = Duration.of(60, ChronoUnit.SECONDS); - public Config(final ConfigLoader configLoader) throws EmptyConfigFieldException { + public Config(final ConfigLoader configLoader) throws ResourceLoaderException, EmptyConfigFieldException { this.configLoader = configLoader; this.loadValues(); } @@ -56,7 +57,7 @@ public boolean isDebugEnabled() { return this.debug; } - public void loadValues() throws EmptyConfigFieldException { + public void loadValues() throws ResourceLoaderException, EmptyConfigFieldException { this.configLoader.reloadConfig(); this.serverKey = this.configLoader.getString("serverKey"); diff --git a/common/src/main/java/pl/spaceis/plugin/config/ConfigLoader.java b/common/src/main/java/pl/spaceis/plugin/config/ConfigLoader.java index da27509..68cb56e 100644 --- a/common/src/main/java/pl/spaceis/plugin/config/ConfigLoader.java +++ b/common/src/main/java/pl/spaceis/plugin/config/ConfigLoader.java @@ -16,9 +16,11 @@ package pl.spaceis.plugin.config; +import pl.spaceis.plugin.resource.ResourceLoaderException; + public interface ConfigLoader { - void reloadConfig(); + void reloadConfig() throws ResourceLoaderException; boolean getBoolean(final String key); diff --git a/common/src/main/java/pl/spaceis/plugin/config/Messages.java b/common/src/main/java/pl/spaceis/plugin/config/Messages.java new file mode 100644 index 0000000..0801392 --- /dev/null +++ b/common/src/main/java/pl/spaceis/plugin/config/Messages.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2023 Kamil Trysiński + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package pl.spaceis.plugin.config; + +public abstract class Messages { + + public static final String PREFIX = "&8[SpaceIs]"; + + public final T correctSyntax = this.color(PREFIX + " &cPoprawne użycie: &7/spaceis reload"); + public final T noPermission = this.color(PREFIX + " &cBrak uprawnień"); + public final T configReloadError = this.color(PREFIX + " &cBłąd podczas ładowania konfiguracji: &7"); + public final T configReloadSuccess = this.color(PREFIX + " &aKonfiguracja załadowana poprawnie"); + + protected abstract T color(final String message); + +} diff --git a/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java new file mode 100644 index 0000000..140a760 --- /dev/null +++ b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java @@ -0,0 +1,47 @@ +package pl.spaceis.plugin.resource; + +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Objects; +import pl.spaceis.plugin.resource.ResourceLoaderException.Reason; + +public abstract class ResourceLoader { + + private final Class loadingClass; + private final Path dataDirectory; + + protected ResourceLoader(final Class loadingClass, final Path dataDirectory) { + this.loadingClass = loadingClass; + this.dataDirectory = dataDirectory; + } + + protected abstract T loadResource(final Path resourcePath) throws ResourceLoaderException; + + public boolean saveDefault(final String resourceName) throws ResourceLoaderException { + if (!Files.exists(this.dataDirectory)) { + try { + Files.createDirectories(this.dataDirectory); + } catch (final Exception exception) { + throw new ResourceLoaderException(Reason.DIRECTORY_NOT_CREATED, resourceName, exception); + } + } + + final Path resourcePath = this.dataDirectory.resolve(resourceName); + if (!Files.exists(resourcePath)) { + try (final InputStream in = this.loadingClass.getClassLoader().getResourceAsStream(resourceName)) { + Files.copy(Objects.requireNonNull(in), resourcePath); + return true; + } catch (final Exception exception) { + throw new ResourceLoaderException(Reason.DEFAULT_FILE_NOT_SAVED, resourceName, exception); + } + } + + return false; + } + + public T load(final String resourceName) throws ResourceLoaderException { + return this.loadResource(this.dataDirectory.resolve(resourceName)); + } + +} \ No newline at end of file diff --git a/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoaderException.java b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoaderException.java new file mode 100644 index 0000000..1984b91 --- /dev/null +++ b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoaderException.java @@ -0,0 +1,32 @@ +package pl.spaceis.plugin.resource; + +public class ResourceLoaderException extends Exception { + + private final Reason reason; + + public ResourceLoaderException(final Reason reason, final String fileName, final Throwable cause) { + super(reason.getMessage(fileName), cause); + this.reason = reason; + } + + public Reason getReason() { + return this.reason; + } + + public enum Reason { + DIRECTORY_NOT_CREATED("Nie udało się utworzyć folderu pluginu"), + DEFAULT_FILE_NOT_SAVED("Nie udało się zapisać domyślnego pliku %s"), + FILE_NOT_LOADED("Nie udało się otworzyć pliku %s"); + + private final String message; + + Reason(final String message) { + this.message = message; + } + + public String getMessage(final String fileName) { + return String.format(this.message, fileName); + } + } + +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 6bd9c1d..2d421bf 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,3 +2,4 @@ rootProject.name = 'spaceis-plugin' include 'common' include 'bukkit' +include 'bungee' From 9532b961aca04aa3f3bc45ec926f61f5a89c1055 Mon Sep 17 00:00:00 2001 From: Peridot Date: Fri, 20 Jan 2023 20:12:03 +0100 Subject: [PATCH 02/14] dots --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ae7e6bf..d81eafd 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,6 @@ Wspierane (przetestowane przez autorów) wersje Minecrafta — od 1.8 do 1.19.3 Plugin przeznaczony dla platform: - Bukkit/Spigot/Paper/... - 1.8 do 1.19.3 -- BungeeCord/WaterFall - 1.19+ +- BungeeCord/WaterFall/.. - 1.19+ Autor pluginu: [Kamilkime](https://github.com/Kamilkime) From 917ebbaf4ab87966b26d5c68416ca6195423d282 Mon Sep 17 00:00:00 2001 From: Peridot Date: Fri, 20 Jan 2023 23:36:27 +0100 Subject: [PATCH 03/14] Add missing `bungee.yml`, change author and bump to 1.2 --- build.gradle | 3 ++- bukkit/src/main/resources/plugin.yml | 4 ++-- bungee/src/main/resources/bungee.yml | 6 ++++++ .../main/java/pl/spaceis/plugin/request/SpaceIsRequest.java | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 bungee/src/main/resources/bungee.yml diff --git a/build.gradle b/build.gradle index 78694fc..4259544 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ allprojects { apply plugin: 'com.github.johnrengelman.shadow' group = 'pl.spaceis.plugin' - version = '1.1' + version = '1.2' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -45,4 +45,5 @@ allprojects { dependencies { implementation project(':bukkit') + implementation project(':bungee') } diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index 569524f..b9d9e05 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -1,10 +1,10 @@ name: "SpaceIsPlugin" -version: "1.1" +version: "1.2" api-version: "1.13" main: "pl.spaceis.plugin.bukkit.BukkitSpaceIsPlugin" description: "Wykonuj komendy ze swojego sklepu SpaceIs" website: "https://spaceis.pl/" -author: "Kamilkime" +author: "SpaceIs-plugin Contributors" commands: spaceis: diff --git a/bungee/src/main/resources/bungee.yml b/bungee/src/main/resources/bungee.yml new file mode 100644 index 0000000..8748e17 --- /dev/null +++ b/bungee/src/main/resources/bungee.yml @@ -0,0 +1,6 @@ +name: "SpaceIsPlugin" +version: "1.2" +main: "pl.spaceis.plugin.bungee.BungeeSpaceIsPlugin" +description: "Wykonuj komendy ze swojego sklepu SpaceIs" +website: "https://spaceis.pl/" +author: "SpaceIs-plugin Contributors" \ No newline at end of file diff --git a/common/src/main/java/pl/spaceis/plugin/request/SpaceIsRequest.java b/common/src/main/java/pl/spaceis/plugin/request/SpaceIsRequest.java index 82d19ae..062326d 100644 --- a/common/src/main/java/pl/spaceis/plugin/request/SpaceIsRequest.java +++ b/common/src/main/java/pl/spaceis/plugin/request/SpaceIsRequest.java @@ -52,7 +52,7 @@ protected Request preparePostRequest(final String url, final String apiKey, fina private Request.Builder prepareRequestBuilder(final String url, final String apiKey, final String serverKey) { return new Request.Builder() .url(url) - .header("User-Agent", "SpaceIsPlugin/1.1") + .header("User-Agent", "SpaceIsPlugin/1.2") .header("Authorization", "Bearer " + apiKey) .header("Content-Type", "application/json") .header("Accept", "application/json") From d104e009848e5e606a8820e093d1b9b5dce00054 Mon Sep 17 00:00:00 2001 From: Peridot Date: Mon, 6 Feb 2023 21:54:25 +0100 Subject: [PATCH 04/14] Improve readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d81eafd..46101b9 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Plugin łączący serwer Minecraft z itemshopem stworzonym na [SpaceIs.pl](https Wspierane (przetestowane przez autorów) wersje Minecrafta — od 1.8 do 1.19.3 Plugin przeznaczony dla platform: -- Bukkit/Spigot/Paper/... - 1.8 do 1.19.3 -- BungeeCord/WaterFall/.. - 1.19+ +- pochodnych Bukkita (Spigot, Paper, itp.) +- pochodnych BungeeCord (WaterFall itp.) - 1.19+ -Autor pluginu: [Kamilkime](https://github.com/Kamilkime) +Autorzy pluginu: [Contributors](https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors) From 598b1ba917517163394b74e9cb22446f1e06f57f Mon Sep 17 00:00:00 2001 From: Peridot Date: Mon, 6 Feb 2023 21:55:00 +0100 Subject: [PATCH 05/14] SpaceIsCommand interface --- .../spaceis/plugin/bukkit/BukkitMessages.java | 5 +++ .../plugin/bukkit/BukkitSpaceIsCommand.java | 38 +++++++++------- .../spaceis/plugin/bungee/BungeeMessages.java | 7 +++ .../plugin/bungee/BungeeSpaceIsCommand.java | 24 +++++++++- .../plugin/command/SpaceIsCommand.java | 45 +++++++++++++++++++ .../pl/spaceis/plugin/config/Messages.java | 2 + 6 files changed, 102 insertions(+), 19 deletions(-) create mode 100644 common/src/main/java/pl/spaceis/plugin/command/SpaceIsCommand.java diff --git a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitMessages.java b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitMessages.java index d2ebbd4..e43fca4 100644 --- a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitMessages.java +++ b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitMessages.java @@ -10,4 +10,9 @@ protected String color(final String message) { return ChatColor.translateAlternateColorCodes('&', message); } + @Override + public String appendMessage(final String message, final String append) { + return message + append; + } + } diff --git a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java index d696021..7069068 100644 --- a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java +++ b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java @@ -23,14 +23,14 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; +import pl.spaceis.plugin.command.SpaceIsCommand; import pl.spaceis.plugin.config.Config; import pl.spaceis.plugin.config.EmptyConfigFieldException; import pl.spaceis.plugin.config.Messages; import pl.spaceis.plugin.resource.ResourceLoaderException; -public class BukkitSpaceIsCommand implements CommandExecutor { +public class BukkitSpaceIsCommand implements CommandExecutor, SpaceIsCommand { - private static final Set RELOAD_ARGS = new HashSet<>(Arrays.asList("rl", "reload")); private final Config config; private final Messages messages; @@ -41,24 +41,28 @@ public BukkitSpaceIsCommand(final Config config, Messages messages) { @Override public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { - if (!sender.hasPermission("spaceis.reload")) { - sender.sendMessage(this.messages.noPermission); - return true; - } + this.execute(sender, args); + return true; + } - if (args.length != 1 || !RELOAD_ARGS.contains(args[0].toLowerCase(Locale.ROOT))) { - sender.sendMessage(this.messages.correctSyntax); - return true; - } + @Override + public void sendMessage(final CommandSender sender, final String message) { + sender.sendMessage(message); + } - try { - this.config.loadValues(); - sender.sendMessage(this.messages.configReloadSuccess); - } catch (final ResourceLoaderException | EmptyConfigFieldException exception) { - sender.sendMessage(this.messages.configReloadError + exception.getMessage()); - } + @Override + public boolean hasPermission(final CommandSender sender, final String permission) { + return sender.hasPermission(permission); + } - return true; + @Override + public Config getConfig() { + return this.config; + } + + @Override + public Messages getMessages() { + return this.messages; } } diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java index 8fa58d2..750b290 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java @@ -12,4 +12,11 @@ protected BaseComponent color(final String message) { return new TextComponent(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', message))); } + @Override + public BaseComponent appendMessage(final BaseComponent message, final String append) { + BaseComponent finalMessage = message.duplicate(); + finalMessage.addExtra(append); + return finalMessage; + } + } diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java index 23133bd..d7fe02e 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java @@ -7,14 +7,14 @@ import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.plugin.Command; +import pl.spaceis.plugin.command.SpaceIsCommand; import pl.spaceis.plugin.config.Config; import pl.spaceis.plugin.config.EmptyConfigFieldException; import pl.spaceis.plugin.config.Messages; import pl.spaceis.plugin.resource.ResourceLoaderException; -public class BungeeSpaceIsCommand extends Command { +public class BungeeSpaceIsCommand extends Command implements SpaceIsCommand { - private static final Set RELOAD_ARGS = new HashSet<>(Arrays.asList("rl", "reload")); private final Config config; private final Messages messages; @@ -46,4 +46,24 @@ public void execute(final CommandSender sender, final String[] args) { } } + @Override + public void sendMessage(final CommandSender sender, final BaseComponent message) { + sender.sendMessage(message); + } + + @Override + public boolean hasPermission(final CommandSender sender, final String permission) { + return sender.hasPermission(permission); + } + + @Override + public Config getConfig() { + return this.config; + } + + @Override + public Messages getMessages() { + return this.messages; + } + } diff --git a/common/src/main/java/pl/spaceis/plugin/command/SpaceIsCommand.java b/common/src/main/java/pl/spaceis/plugin/command/SpaceIsCommand.java new file mode 100644 index 0000000..d9b059d --- /dev/null +++ b/common/src/main/java/pl/spaceis/plugin/command/SpaceIsCommand.java @@ -0,0 +1,45 @@ +package pl.spaceis.plugin.command; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Locale; +import java.util.Set; +import pl.spaceis.plugin.config.Config; +import pl.spaceis.plugin.config.EmptyConfigFieldException; +import pl.spaceis.plugin.config.Messages; +import pl.spaceis.plugin.resource.ResourceLoaderException; + +public interface SpaceIsCommand { + + Set RELOAD_ARGS = Collections.unmodifiableSet(new HashSet<>(Arrays.asList("rl", "reload"))); + + default void execute(final S sender, final String[] args) { + if (!this.hasPermission(sender, "spaceis.reload")) { + this.sendMessage(sender, this.getMessages().noPermission); + return; + } + + if (args.length != 1 || !RELOAD_ARGS.contains(args[0].toLowerCase(Locale.ROOT))) { + this.sendMessage(sender, this.getMessages().correctSyntax); + return; + } + + try { + this.getConfig().loadValues(); + this.sendMessage(sender, this.getMessages().configReloadSuccess); + } catch (final ResourceLoaderException | EmptyConfigFieldException exception) { + M message = this.getMessages().appendMessage(this.getMessages().configReloadError, exception.getMessage()); + this.sendMessage(sender, message); + } + } + + void sendMessage(final S sender, final M message); + + boolean hasPermission(final S sender, final String permission); + + Config getConfig(); + + Messages getMessages(); + +} diff --git a/common/src/main/java/pl/spaceis/plugin/config/Messages.java b/common/src/main/java/pl/spaceis/plugin/config/Messages.java index 0801392..c3083a0 100644 --- a/common/src/main/java/pl/spaceis/plugin/config/Messages.java +++ b/common/src/main/java/pl/spaceis/plugin/config/Messages.java @@ -27,4 +27,6 @@ public abstract class Messages { protected abstract T color(final String message); + public abstract T appendMessage(T message, String append); + } From 7088d1de75d18cd7772505a9ce68941af6b6538a Mon Sep 17 00:00:00 2001 From: Peridot Date: Mon, 6 Feb 2023 21:56:25 +0100 Subject: [PATCH 06/14] chamgves --- .../java/pl/spaceis/plugin/bungee/BungeeResourceLoader.java | 2 +- .../main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsPlugin.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeResourceLoader.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeResourceLoader.java index e2fb4a8..6d7a4b6 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeResourceLoader.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeResourceLoader.java @@ -24,4 +24,4 @@ public Configuration loadResource(final Path resourcePath) throws ResourceLoader } } -} \ No newline at end of file +} diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsPlugin.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsPlugin.java index d2a5c05..a248ac3 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsPlugin.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsPlugin.java @@ -23,7 +23,7 @@ public void onEnable() { final ResourceLoader resourceLoader = new BungeeResourceLoader(this.getClass(), this.getDataFolder()); try { final SpaceIsLogger logger = new BungeeSpaceIsLogger(this.getLogger()); - final ConfigLoader configLoader = new BungeeConfigLoader(resourceLoader,"config.yml"); + final ConfigLoader configLoader = new BungeeConfigLoader(resourceLoader, "config.yml"); final Config config = new Config(configLoader); final Messages messages = new BungeeMessages(); From e35d2a9ca313e33e5475be6bb6232d4cbc517ec5 Mon Sep 17 00:00:00 2001 From: Peridot Date: Mon, 6 Feb 2023 22:03:59 +0100 Subject: [PATCH 07/14] Update license --- .../spaceis/plugin/bukkit/BukkitMessages.java | 17 ++++++++++++++++ .../plugin/bukkit/BukkitSpaceIsCommand.java | 9 ++------- .../plugin/bukkit/BukkitSpaceIsPlugin.java | 3 ++- .../plugin/bungee/BungeeCommandsTask.java | 17 ++++++++++++++++ .../plugin/bungee/BungeeConfigLoader.java | 17 ++++++++++++++++ .../spaceis/plugin/bungee/BungeeMessages.java | 17 ++++++++++++++++ .../plugin/bungee/BungeeResourceLoader.java | 17 ++++++++++++++++ .../plugin/bungee/BungeeSpaceIsCommand.java | 20 ++++++++++++++++--- .../plugin/bungee/BungeeSpaceIsLogger.java | 17 ++++++++++++++++ .../plugin/bungee/BungeeSpaceIsPlugin.java | 17 ++++++++++++++++ .../plugin/command/SpaceIsCommand.java | 17 ++++++++++++++++ .../java/pl/spaceis/plugin/config/Config.java | 3 ++- .../spaceis/plugin/config/ConfigLoader.java | 3 ++- .../pl/spaceis/plugin/config/Messages.java | 3 ++- .../plugin/request/SpaceIsRequest.java | 3 ++- .../plugin/resource/ResourceLoader.java | 17 ++++++++++++++++ .../resource/ResourceLoaderException.java | 17 ++++++++++++++++ 17 files changed, 199 insertions(+), 15 deletions(-) diff --git a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitMessages.java b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitMessages.java index e43fca4..501fb1f 100644 --- a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitMessages.java +++ b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitMessages.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 SpaceIs-plugin Contributors + * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package pl.spaceis.plugin.bukkit; import org.bukkit.ChatColor; diff --git a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java index 7069068..3f61b4a 100644 --- a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java +++ b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java @@ -1,5 +1,6 @@ /* - * Copyright (C) 2023 Kamil Trysiński + * Copyright (C) 2022 SpaceIs-plugin Contributors + * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,18 +17,12 @@ package pl.spaceis.plugin.bukkit; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Locale; -import java.util.Set; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import pl.spaceis.plugin.command.SpaceIsCommand; import pl.spaceis.plugin.config.Config; -import pl.spaceis.plugin.config.EmptyConfigFieldException; import pl.spaceis.plugin.config.Messages; -import pl.spaceis.plugin.resource.ResourceLoaderException; public class BukkitSpaceIsCommand implements CommandExecutor, SpaceIsCommand { diff --git a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsPlugin.java b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsPlugin.java index e0c9fa6..d46bcd3 100644 --- a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsPlugin.java +++ b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsPlugin.java @@ -1,5 +1,6 @@ /* - * Copyright (C) 2022 Kamil Trysiński + * Copyright (C) 2022 SpaceIs-plugin Contributors + * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeCommandsTask.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeCommandsTask.java index 646660b..7141c95 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeCommandsTask.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeCommandsTask.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 SpaceIs-plugin Contributors + * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package pl.spaceis.plugin.bungee; import net.md_5.bungee.api.ProxyServer; diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeConfigLoader.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeConfigLoader.java index 20398f7..8b8e6f5 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeConfigLoader.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeConfigLoader.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 SpaceIs-plugin Contributors + * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package pl.spaceis.plugin.bungee; import net.md_5.bungee.config.Configuration; diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java index 750b290..a5fc51f 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 SpaceIs-plugin Contributors + * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package pl.spaceis.plugin.bungee; import net.md_5.bungee.api.ChatColor; diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeResourceLoader.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeResourceLoader.java index 6d7a4b6..5cfdf03 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeResourceLoader.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeResourceLoader.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 SpaceIs-plugin Contributors + * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package pl.spaceis.plugin.bungee; import java.io.File; diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java index d7fe02e..e50c053 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java @@ -1,9 +1,23 @@ +/* + * Copyright (C) 2022 SpaceIs-plugin Contributors + * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package pl.spaceis.plugin.bungee; -import java.util.Arrays; -import java.util.HashSet; import java.util.Locale; -import java.util.Set; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.plugin.Command; diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsLogger.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsLogger.java index a657284..540b6f2 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsLogger.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsLogger.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 SpaceIs-plugin Contributors + * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package pl.spaceis.plugin.bungee; import java.util.logging.Logger; diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsPlugin.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsPlugin.java index a248ac3..e0f88ef 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsPlugin.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsPlugin.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 SpaceIs-plugin Contributors + * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package pl.spaceis.plugin.bungee; import java.util.concurrent.TimeUnit; diff --git a/common/src/main/java/pl/spaceis/plugin/command/SpaceIsCommand.java b/common/src/main/java/pl/spaceis/plugin/command/SpaceIsCommand.java index d9b059d..ef3f9c6 100644 --- a/common/src/main/java/pl/spaceis/plugin/command/SpaceIsCommand.java +++ b/common/src/main/java/pl/spaceis/plugin/command/SpaceIsCommand.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 SpaceIs-plugin Contributors + * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package pl.spaceis.plugin.command; import java.util.Arrays; diff --git a/common/src/main/java/pl/spaceis/plugin/config/Config.java b/common/src/main/java/pl/spaceis/plugin/config/Config.java index 54f2d1f..aacdbb8 100644 --- a/common/src/main/java/pl/spaceis/plugin/config/Config.java +++ b/common/src/main/java/pl/spaceis/plugin/config/Config.java @@ -1,5 +1,6 @@ /* - * Copyright (C) 2022 Kamil Trysiński + * Copyright (C) 2022 SpaceIs-plugin Contributors + * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/src/main/java/pl/spaceis/plugin/config/ConfigLoader.java b/common/src/main/java/pl/spaceis/plugin/config/ConfigLoader.java index 68cb56e..aaa1f1a 100644 --- a/common/src/main/java/pl/spaceis/plugin/config/ConfigLoader.java +++ b/common/src/main/java/pl/spaceis/plugin/config/ConfigLoader.java @@ -1,5 +1,6 @@ /* - * Copyright (C) 2023 Kamil Trysiński + * Copyright (C) 2022 SpaceIs-plugin Contributors + * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/src/main/java/pl/spaceis/plugin/config/Messages.java b/common/src/main/java/pl/spaceis/plugin/config/Messages.java index c3083a0..87f0800 100644 --- a/common/src/main/java/pl/spaceis/plugin/config/Messages.java +++ b/common/src/main/java/pl/spaceis/plugin/config/Messages.java @@ -1,5 +1,6 @@ /* - * Copyright (C) 2023 Kamil Trysiński + * Copyright (C) 2022 SpaceIs-plugin Contributors + * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/src/main/java/pl/spaceis/plugin/request/SpaceIsRequest.java b/common/src/main/java/pl/spaceis/plugin/request/SpaceIsRequest.java index 062326d..85d395d 100644 --- a/common/src/main/java/pl/spaceis/plugin/request/SpaceIsRequest.java +++ b/common/src/main/java/pl/spaceis/plugin/request/SpaceIsRequest.java @@ -1,5 +1,6 @@ /* - * Copyright (C) 2022 Kamil Trysiński + * Copyright (C) 2022 SpaceIs-plugin Contributors + * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java index 140a760..552b667 100644 --- a/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java +++ b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 SpaceIs-plugin Contributors + * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package pl.spaceis.plugin.resource; import java.io.InputStream; diff --git a/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoaderException.java b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoaderException.java index 1984b91..359645d 100644 --- a/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoaderException.java +++ b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoaderException.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 SpaceIs-plugin Contributors + * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package pl.spaceis.plugin.resource; public class ResourceLoaderException extends Exception { From 0601429c496b5199a0e25cf34b19e8997bf20dbc Mon Sep 17 00:00:00 2001 From: Peridot Date: Mon, 6 Feb 2023 22:04:53 +0100 Subject: [PATCH 08/14] 2023 --- .../src/main/java/pl/spaceis/plugin/bukkit/BukkitMessages.java | 2 +- .../java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java | 2 +- .../main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsPlugin.java | 2 +- .../main/java/pl/spaceis/plugin/bungee/BungeeCommandsTask.java | 2 +- .../main/java/pl/spaceis/plugin/bungee/BungeeConfigLoader.java | 2 +- .../src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java | 2 +- .../java/pl/spaceis/plugin/bungee/BungeeResourceLoader.java | 2 +- .../java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java | 2 +- .../main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsLogger.java | 2 +- .../main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsPlugin.java | 2 +- .../src/main/java/pl/spaceis/plugin/command/SpaceIsCommand.java | 2 +- common/src/main/java/pl/spaceis/plugin/config/Config.java | 2 +- common/src/main/java/pl/spaceis/plugin/config/ConfigLoader.java | 2 +- common/src/main/java/pl/spaceis/plugin/config/Messages.java | 2 +- .../src/main/java/pl/spaceis/plugin/request/SpaceIsRequest.java | 2 +- .../main/java/pl/spaceis/plugin/resource/ResourceLoader.java | 2 +- .../pl/spaceis/plugin/resource/ResourceLoaderException.java | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitMessages.java b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitMessages.java index 501fb1f..a677ecc 100644 --- a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitMessages.java +++ b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitMessages.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 SpaceIs-plugin Contributors + * Copyright (C) 2023 SpaceIs-plugin Contributors * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java index 3f61b4a..1afd96f 100644 --- a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java +++ b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 SpaceIs-plugin Contributors + * Copyright (C) 2023 SpaceIs-plugin Contributors * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsPlugin.java b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsPlugin.java index d46bcd3..6690525 100644 --- a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsPlugin.java +++ b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsPlugin.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 SpaceIs-plugin Contributors + * Copyright (C) 2023 SpaceIs-plugin Contributors * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeCommandsTask.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeCommandsTask.java index 7141c95..9e39415 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeCommandsTask.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeCommandsTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 SpaceIs-plugin Contributors + * Copyright (C) 2023 SpaceIs-plugin Contributors * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeConfigLoader.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeConfigLoader.java index 8b8e6f5..67b9285 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeConfigLoader.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeConfigLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 SpaceIs-plugin Contributors + * Copyright (C) 2023 SpaceIs-plugin Contributors * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java index a5fc51f..a417f75 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 SpaceIs-plugin Contributors + * Copyright (C) 2023 SpaceIs-plugin Contributors * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeResourceLoader.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeResourceLoader.java index 5cfdf03..69dfe6f 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeResourceLoader.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeResourceLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 SpaceIs-plugin Contributors + * Copyright (C) 2023 SpaceIs-plugin Contributors * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java index e50c053..f63c3dc 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 SpaceIs-plugin Contributors + * Copyright (C) 2023 SpaceIs-plugin Contributors * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsLogger.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsLogger.java index 540b6f2..6fce8cd 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsLogger.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsLogger.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 SpaceIs-plugin Contributors + * Copyright (C) 2023 SpaceIs-plugin Contributors * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsPlugin.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsPlugin.java index e0f88ef..94f110b 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsPlugin.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsPlugin.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 SpaceIs-plugin Contributors + * Copyright (C) 2023 SpaceIs-plugin Contributors * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/common/src/main/java/pl/spaceis/plugin/command/SpaceIsCommand.java b/common/src/main/java/pl/spaceis/plugin/command/SpaceIsCommand.java index ef3f9c6..fd54d17 100644 --- a/common/src/main/java/pl/spaceis/plugin/command/SpaceIsCommand.java +++ b/common/src/main/java/pl/spaceis/plugin/command/SpaceIsCommand.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 SpaceIs-plugin Contributors + * Copyright (C) 2023 SpaceIs-plugin Contributors * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/common/src/main/java/pl/spaceis/plugin/config/Config.java b/common/src/main/java/pl/spaceis/plugin/config/Config.java index aacdbb8..98bd897 100644 --- a/common/src/main/java/pl/spaceis/plugin/config/Config.java +++ b/common/src/main/java/pl/spaceis/plugin/config/Config.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 SpaceIs-plugin Contributors + * Copyright (C) 2023 SpaceIs-plugin Contributors * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/common/src/main/java/pl/spaceis/plugin/config/ConfigLoader.java b/common/src/main/java/pl/spaceis/plugin/config/ConfigLoader.java index aaa1f1a..fe1ab94 100644 --- a/common/src/main/java/pl/spaceis/plugin/config/ConfigLoader.java +++ b/common/src/main/java/pl/spaceis/plugin/config/ConfigLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 SpaceIs-plugin Contributors + * Copyright (C) 2023 SpaceIs-plugin Contributors * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/common/src/main/java/pl/spaceis/plugin/config/Messages.java b/common/src/main/java/pl/spaceis/plugin/config/Messages.java index 87f0800..9ec9b37 100644 --- a/common/src/main/java/pl/spaceis/plugin/config/Messages.java +++ b/common/src/main/java/pl/spaceis/plugin/config/Messages.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 SpaceIs-plugin Contributors + * Copyright (C) 2023 SpaceIs-plugin Contributors * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/common/src/main/java/pl/spaceis/plugin/request/SpaceIsRequest.java b/common/src/main/java/pl/spaceis/plugin/request/SpaceIsRequest.java index 85d395d..86306a3 100644 --- a/common/src/main/java/pl/spaceis/plugin/request/SpaceIsRequest.java +++ b/common/src/main/java/pl/spaceis/plugin/request/SpaceIsRequest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 SpaceIs-plugin Contributors + * Copyright (C) 2023 SpaceIs-plugin Contributors * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java index 552b667..0b57d2f 100644 --- a/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java +++ b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 SpaceIs-plugin Contributors + * Copyright (C) 2023 SpaceIs-plugin Contributors * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoaderException.java b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoaderException.java index 359645d..b14c34a 100644 --- a/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoaderException.java +++ b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoaderException.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 SpaceIs-plugin Contributors + * Copyright (C) 2023 SpaceIs-plugin Contributors * https://github.com/SpaceCodePoland/spaceis-plugin/graphs/contributors * * Licensed under the Apache License, Version 2.0 (the "License"); From 636e86528830604b434f7ec36dce6d65b45ce11b Mon Sep 17 00:00:00 2001 From: Peridot Date: Mon, 6 Feb 2023 22:06:04 +0100 Subject: [PATCH 09/14] empty line --- .../main/java/pl/spaceis/plugin/resource/ResourceLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java index 0b57d2f..55b8fde 100644 --- a/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java +++ b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java @@ -61,4 +61,4 @@ public T load(final String resourceName) throws ResourceLoaderException { return this.loadResource(this.dataDirectory.resolve(resourceName)); } -} \ No newline at end of file +} From 7fb3122bdd2728874c35a9da3d90385a8cc39eb4 Mon Sep 17 00:00:00 2001 From: Peridot Date: Mon, 6 Feb 2023 22:07:41 +0100 Subject: [PATCH 10/14] empty line --- .../main/java/pl/spaceis/plugin/resource/ResourceLoader.java | 1 + .../pl/spaceis/plugin/resource/ResourceLoaderException.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java index 55b8fde..3689866 100644 --- a/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java +++ b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java @@ -62,3 +62,4 @@ public T load(final String resourceName) throws ResourceLoaderException { } } + diff --git a/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoaderException.java b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoaderException.java index b14c34a..b9d54f9 100644 --- a/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoaderException.java +++ b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoaderException.java @@ -46,4 +46,4 @@ public String getMessage(final String fileName) { } } -} \ No newline at end of file +} From 812669755a31b49d9aab45716bf444468871444e Mon Sep 17 00:00:00 2001 From: Peridot Date: Mon, 6 Feb 2023 22:08:19 +0100 Subject: [PATCH 11/14] s --- .../src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java | 1 - 1 file changed, 1 deletion(-) diff --git a/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java index 3689866..55b8fde 100644 --- a/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java +++ b/common/src/main/java/pl/spaceis/plugin/resource/ResourceLoader.java @@ -62,4 +62,3 @@ public T load(final String resourceName) throws ResourceLoaderException { } } - From aeae4a724db0f9f8611d014d669d6fbbf2ee117e Mon Sep 17 00:00:00 2001 From: Peridot Date: Mon, 6 Feb 2023 22:10:21 +0100 Subject: [PATCH 12/14] variable --- .../src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java index a417f75..4cffef5 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeMessages.java @@ -26,7 +26,8 @@ public class BungeeMessages extends Messages { @Override protected BaseComponent color(final String message) { - return new TextComponent(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', message))); + String coloredMessage = ChatColor.translateAlternateColorCodes('&', message); + return new TextComponent(TextComponent.fromLegacyText(coloredMessage)); } @Override From aae4211d325d3e641dec44ee56ed4935167de299 Mon Sep 17 00:00:00 2001 From: Peridot Date: Mon, 6 Feb 2023 23:46:10 +0100 Subject: [PATCH 13/14] lol --- .../plugin/bukkit/BukkitSpaceIsCommand.java | 2 +- .../plugin/bungee/BungeeSpaceIsCommand.java | 24 ++----------------- .../plugin/command/SpaceIsCommand.java | 2 +- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java index 1afd96f..1df1234 100644 --- a/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java +++ b/bukkit/src/main/java/pl/spaceis/plugin/bukkit/BukkitSpaceIsCommand.java @@ -36,7 +36,7 @@ public BukkitSpaceIsCommand(final Config config, Messages messages) { @Override public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { - this.execute(sender, args); + this.executeCommand(sender, args); return true; } diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java index f63c3dc..e2959cb 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java @@ -17,15 +17,12 @@ package pl.spaceis.plugin.bungee; -import java.util.Locale; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.plugin.Command; import pl.spaceis.plugin.command.SpaceIsCommand; import pl.spaceis.plugin.config.Config; -import pl.spaceis.plugin.config.EmptyConfigFieldException; import pl.spaceis.plugin.config.Messages; -import pl.spaceis.plugin.resource.ResourceLoaderException; public class BungeeSpaceIsCommand extends Command implements SpaceIsCommand { @@ -39,25 +36,8 @@ public BungeeSpaceIsCommand(final Config config, final Messages m } @Override - public void execute(final CommandSender sender, final String[] args) { - if (!sender.hasPermission("spaceis.reload")) { - sender.sendMessage(this.messages.noPermission); - return; - } - - if (args.length != 1 || !RELOAD_ARGS.contains(args[0].toLowerCase(Locale.ROOT))) { - sender.sendMessage(this.messages.correctSyntax); - return; - } - - try { - this.config.loadValues(); - sender.sendMessage(this.messages.configReloadSuccess); - } catch (final ResourceLoaderException | EmptyConfigFieldException exception) { - BaseComponent errorMessage = this.messages.configReloadError.duplicate(); - errorMessage.addExtra(exception.getMessage()); - sender.sendMessage(errorMessage); - } + public void execute(CommandSender sender, String[] args) { + this.executeCommand(sender, args); } @Override diff --git a/common/src/main/java/pl/spaceis/plugin/command/SpaceIsCommand.java b/common/src/main/java/pl/spaceis/plugin/command/SpaceIsCommand.java index fd54d17..ed7f8bd 100644 --- a/common/src/main/java/pl/spaceis/plugin/command/SpaceIsCommand.java +++ b/common/src/main/java/pl/spaceis/plugin/command/SpaceIsCommand.java @@ -31,7 +31,7 @@ public interface SpaceIsCommand { Set RELOAD_ARGS = Collections.unmodifiableSet(new HashSet<>(Arrays.asList("rl", "reload"))); - default void execute(final S sender, final String[] args) { + default void executeCommand(final S sender, final String[] args) { if (!this.hasPermission(sender, "spaceis.reload")) { this.sendMessage(sender, this.getMessages().noPermission); return; From f277e69647e6d07160701d40b15f105a08058025 Mon Sep 17 00:00:00 2001 From: Peridot Date: Mon, 6 Feb 2023 23:46:30 +0100 Subject: [PATCH 14/14] add missing final --- .../java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java index e2959cb..a6b4d38 100644 --- a/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java +++ b/bungee/src/main/java/pl/spaceis/plugin/bungee/BungeeSpaceIsCommand.java @@ -36,7 +36,7 @@ public BungeeSpaceIsCommand(final Config config, final Messages m } @Override - public void execute(CommandSender sender, String[] args) { + public void execute(final CommandSender sender, final String[] args) { this.executeCommand(sender, args); }