diff --git a/build.gradle b/build.gradle index 28e5724..8640f0c 100644 --- a/build.gradle +++ b/build.gradle @@ -4,37 +4,39 @@ plugins { } group = 'net.momirealms' -version = '2.2.0.4-hotfix' +version = '2.2.0.5' repositories { mavenCentral() maven {name = "aliyun-repo"; url = "https://maven.aliyun.com/repository/public/"} maven {name = 'papermc-repo'; url = 'https://papermc.io/repo/repository/maven-public/'} maven {name = 'sonatype'; url = 'https://oss.sonatype.org/content/groups/public/'} - maven {name = "sonatype-oss-snapshots1"; url = "https://s01.oss.sonatype.org/content/repositories/snapshots/"} maven {name = "dmulloy2-repo"; url = "https://repo.dmulloy2.net/repository/public/"} maven {name = "clip-repo"; url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'} maven {name = "jitpack"; url = 'https://jitpack.io'} maven {name = "codecrafter47-repo"; url = 'https://nexus.codecrafter47.de/content/repositories/public/'} + maven {name = "opencollab-snapshot-repo"; url = 'https://repo.opencollab.dev/main/'} } dependencies { compileOnly fileTree(dir:'libs',includes:['*.jar']) - compileOnly ('io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT') + compileOnly ('io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT') compileOnly ('me.clip:placeholderapi:2.11.3') compileOnly ('com.zaxxer:HikariCP:5.0.1') compileOnly ('commons-io:commons-io:2.11.0') compileOnly ('dev.dejvokep:boosted-yaml:1.3') + compileOnly ('org.geysermc.geyser:api:2.1.0-SNAPSHOT') + compileOnly ('org.geysermc.floodgate:api:2.0-SNAPSHOT') compileOnly ('net.md-5:bungeecord-api:1.19-R0.1-SNAPSHOT') compileOnly ('com.github.LoneDev6:api-itemsadder:3.2.3c') - implementation ('net.kyori:adventure-api:4.13.0') + implementation ('net.kyori:adventure-api:4.13.1') implementation ('net.kyori:adventure-platform-bukkit:4.3.0') - implementation ('net.kyori:adventure-text-minimessage:4.13.0') - implementation ('net.kyori:adventure-text-serializer-gson:4.13.0') + implementation ('net.kyori:adventure-text-minimessage:4.13.1') + implementation ('net.kyori:adventure-text-serializer-gson:4.13.1') implementation ("org.bstats:bstats-bukkit:3.0.1") } -def targetJavaVersion = 16 +def targetJavaVersion = 17 java { def javaVersion = JavaVersion.toVersion(targetJavaVersion) sourceCompatibility = javaVersion @@ -45,9 +47,8 @@ java { } tasks.withType(JavaCompile).configureEach { - if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { - options.release = targetJavaVersion - } + options.release = targetJavaVersion + options.encoding = "UTF-8" } processResources { @@ -59,10 +60,6 @@ processResources { } } -tasks.withType(JavaCompile) { - options.encoding = "UTF-8" -} - shadowJar { relocate ('net.kyori', 'net.momirealms.customnameplates.libs.net.kyori') relocate ('org.bstats', 'net.momirealms.customnameplates.libs.org.bstats') diff --git a/src/main/java/net/momirealms/customnameplates/api/CustomNameplatesAPI.java b/src/main/java/net/momirealms/customnameplates/api/CustomNameplatesAPI.java index f083f5b..7fbf950 100644 --- a/src/main/java/net/momirealms/customnameplates/api/CustomNameplatesAPI.java +++ b/src/main/java/net/momirealms/customnameplates/api/CustomNameplatesAPI.java @@ -35,6 +35,11 @@ public class CustomNameplatesAPI { api = this; } + public static CustomNameplatesAPI getInstance() { + return api; + } + + @Deprecated public static CustomNameplatesAPI getAPI() { return api; } diff --git a/src/main/java/net/momirealms/customnameplates/command/AbstractSubCommand.java b/src/main/java/net/momirealms/customnameplates/command/AbstractSubCommand.java index 8521053..c9a3c03 100644 --- a/src/main/java/net/momirealms/customnameplates/command/AbstractSubCommand.java +++ b/src/main/java/net/momirealms/customnameplates/command/AbstractSubCommand.java @@ -98,12 +98,12 @@ public abstract class AbstractSubCommand { protected boolean notExist(CommandSender commandSender, String type, String value) { if (type.equals("nameplate")) { - if (!CustomNameplatesAPI.getAPI().doesNameplateExist(value)) { + if (!CustomNameplatesAPI.getInstance().doesNameplateExist(value)) { AdventureUtils.sendMessage(commandSender, MessageManager.prefix + MessageManager.np_not_exist); return true; } } else if (type.equals("bubble")) { - if (!CustomNameplatesAPI.getAPI().doesBubbleExist(value)) { + if (!CustomNameplatesAPI.getInstance().doesBubbleExist(value)) { AdventureUtils.sendMessage(commandSender, MessageManager.prefix + MessageManager.bb_not_exist); return true; } diff --git a/src/main/java/net/momirealms/customnameplates/command/subcmd/BubblesEquipCommand.java b/src/main/java/net/momirealms/customnameplates/command/subcmd/BubblesEquipCommand.java index f5b47e9..953240d 100644 --- a/src/main/java/net/momirealms/customnameplates/command/subcmd/BubblesEquipCommand.java +++ b/src/main/java/net/momirealms/customnameplates/command/subcmd/BubblesEquipCommand.java @@ -43,7 +43,7 @@ public class BubblesEquipCommand extends AbstractSubCommand { AdventureUtils.playerMessage((Player) sender, MessageManager.prefix + MessageManager.bb_notAvailable); return true; } - CustomNameplatesAPI.getAPI().equipBubble((Player) sender, args.get(0)); + CustomNameplatesAPI.getInstance().equipBubble((Player) sender, args.get(0)); AdventureUtils.playerMessage((Player) sender, MessageManager.prefix + MessageManager.bb_equip.replace("{Bubble}", CustomNameplates.getInstance().getChatBubblesManager().getBubbleConfig(args.get(0)).display_name())); return true; } diff --git a/src/main/java/net/momirealms/customnameplates/command/subcmd/BubblesForceEquipCommand.java b/src/main/java/net/momirealms/customnameplates/command/subcmd/BubblesForceEquipCommand.java index 963fab3..e023295 100644 --- a/src/main/java/net/momirealms/customnameplates/command/subcmd/BubblesForceEquipCommand.java +++ b/src/main/java/net/momirealms/customnameplates/command/subcmd/BubblesForceEquipCommand.java @@ -42,7 +42,7 @@ public class BubblesForceEquipCommand extends AbstractSubCommand { return true; Player player = Bukkit.getPlayer(args.get(0)); - CustomNameplatesAPI.getAPI().equipBubble(player, args.get(1)); + CustomNameplatesAPI.getInstance().equipBubble(player, args.get(1)); AdventureUtils.sendMessage(sender, MessageManager.prefix + MessageManager.bb_force_equip.replace("{Bubble}", CustomNameplates.getInstance().getChatBubblesManager().getBubbleConfig(args.get(1)).display_name()).replace("{Player}", args.get(0))); return true; } diff --git a/src/main/java/net/momirealms/customnameplates/command/subcmd/BubblesForceUnequipCommand.java b/src/main/java/net/momirealms/customnameplates/command/subcmd/BubblesForceUnequipCommand.java index 395a166..24de2b9 100644 --- a/src/main/java/net/momirealms/customnameplates/command/subcmd/BubblesForceUnequipCommand.java +++ b/src/main/java/net/momirealms/customnameplates/command/subcmd/BubblesForceUnequipCommand.java @@ -40,7 +40,7 @@ public class BubblesForceUnequipCommand extends AbstractSubCommand { if (lackArgs(sender, 1, args.size()) || playerNotOnline(sender, args.get(0))) return true; Player player = Bukkit.getPlayer(args.get(0)); - CustomNameplatesAPI.getAPI().unEquipBubble(player); + CustomNameplatesAPI.getInstance().unEquipBubble(player); AdventureUtils.sendMessage(sender,MessageManager.prefix + MessageManager.bb_force_unEquip.replace("{Player}", args.get(0))); return true; } diff --git a/src/main/java/net/momirealms/customnameplates/command/subcmd/BubblesUnequipCommand.java b/src/main/java/net/momirealms/customnameplates/command/subcmd/BubblesUnequipCommand.java index 392d01f..d1d6e8c 100644 --- a/src/main/java/net/momirealms/customnameplates/command/subcmd/BubblesUnequipCommand.java +++ b/src/main/java/net/momirealms/customnameplates/command/subcmd/BubblesUnequipCommand.java @@ -38,7 +38,7 @@ public class BubblesUnequipCommand extends AbstractSubCommand { public boolean onCommand(CommandSender sender, List args) { if (noConsoleExecute(sender)) return true; Player player = (Player) sender; - CustomNameplatesAPI.getAPI().unEquipBubble(player); + CustomNameplatesAPI.getInstance().unEquipBubble(player); AdventureUtils.playerMessage(player, MessageManager.prefix + MessageManager.bb_unEquip); return true; } diff --git a/src/main/java/net/momirealms/customnameplates/command/subcmd/NameplatesEquipCommand.java b/src/main/java/net/momirealms/customnameplates/command/subcmd/NameplatesEquipCommand.java index 2ae83a1..ddcfc14 100644 --- a/src/main/java/net/momirealms/customnameplates/command/subcmd/NameplatesEquipCommand.java +++ b/src/main/java/net/momirealms/customnameplates/command/subcmd/NameplatesEquipCommand.java @@ -43,7 +43,7 @@ public class NameplatesEquipCommand extends AbstractSubCommand { return true; } Player player = (Player) sender; - CustomNameplatesAPI.getAPI().equipNameplate(player, args.get(0)); + CustomNameplatesAPI.getInstance().equipNameplate(player, args.get(0)); AdventureUtils.sendMessage(sender, MessageManager.prefix + MessageManager.np_equip.replace("{Nameplate}", CustomNameplates.getInstance().getNameplateManager().getNameplateConfig(args.get(0)).display_name())); return true; } diff --git a/src/main/java/net/momirealms/customnameplates/command/subcmd/NameplatesForceEquipCommand.java b/src/main/java/net/momirealms/customnameplates/command/subcmd/NameplatesForceEquipCommand.java index 6c941eb..77bd195 100644 --- a/src/main/java/net/momirealms/customnameplates/command/subcmd/NameplatesForceEquipCommand.java +++ b/src/main/java/net/momirealms/customnameplates/command/subcmd/NameplatesForceEquipCommand.java @@ -40,7 +40,7 @@ public class NameplatesForceEquipCommand extends AbstractSubCommand { public boolean onCommand(CommandSender sender, List args) { if (lackArgs(sender, 2, args.size()) || playerNotOnline(sender, args.get(0)) || notExist(sender, "nameplate", args.get(1))) return true; Player player = Bukkit.getPlayer(args.get(0)); - CustomNameplatesAPI.getAPI().equipNameplate(player, args.get(1)); + CustomNameplatesAPI.getInstance().equipNameplate(player, args.get(1)); AdventureUtils.sendMessage(sender, MessageManager.prefix + MessageManager.np_force_equip.replace("{Nameplate}", CustomNameplates.getInstance().getNameplateManager().getNameplateConfig(args.get(1)).display_name()).replace("{Player}", args.get(0))); return true; } diff --git a/src/main/java/net/momirealms/customnameplates/command/subcmd/NameplatesForceUnequipCommand.java b/src/main/java/net/momirealms/customnameplates/command/subcmd/NameplatesForceUnequipCommand.java index b83a5fd..c092cf4 100644 --- a/src/main/java/net/momirealms/customnameplates/command/subcmd/NameplatesForceUnequipCommand.java +++ b/src/main/java/net/momirealms/customnameplates/command/subcmd/NameplatesForceUnequipCommand.java @@ -40,7 +40,7 @@ public class NameplatesForceUnequipCommand extends AbstractSubCommand { if (lackArgs(sender, 1, args.size()) || playerNotOnline(sender, args.get(0))) return true; Player player = Bukkit.getPlayer(args.get(0)); - CustomNameplatesAPI.getAPI().unEquipNameplate(player); + CustomNameplatesAPI.getInstance().unEquipNameplate(player); AdventureUtils.sendMessage(sender, MessageManager.prefix + MessageManager.np_force_unEquip.replace("{Player}", args.get(0))); return true; } diff --git a/src/main/java/net/momirealms/customnameplates/command/subcmd/NameplatesUnequipCommand.java b/src/main/java/net/momirealms/customnameplates/command/subcmd/NameplatesUnequipCommand.java index c59a0fd..7a580fa 100644 --- a/src/main/java/net/momirealms/customnameplates/command/subcmd/NameplatesUnequipCommand.java +++ b/src/main/java/net/momirealms/customnameplates/command/subcmd/NameplatesUnequipCommand.java @@ -38,7 +38,7 @@ public class NameplatesUnequipCommand extends AbstractSubCommand { public boolean onCommand(CommandSender sender, List args) { if (noConsoleExecute(sender)) return true; Player player = (Player) sender; - CustomNameplatesAPI.getAPI().unEquipNameplate(player); + CustomNameplatesAPI.getInstance().unEquipNameplate(player); AdventureUtils.playerMessage(player, MessageManager.prefix + MessageManager.np_unEquip); return true; } diff --git a/src/main/java/net/momirealms/customnameplates/helper/LibraryLoader.java b/src/main/java/net/momirealms/customnameplates/helper/LibraryLoader.java index d974f59..42e3bc5 100644 --- a/src/main/java/net/momirealms/customnameplates/helper/LibraryLoader.java +++ b/src/main/java/net/momirealms/customnameplates/helper/LibraryLoader.java @@ -28,7 +28,7 @@ package net.momirealms.customnameplates.helper; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; import net.momirealms.customnameplates.CustomNameplates; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import java.io.File; import java.io.InputStream; diff --git a/src/main/java/net/momirealms/customnameplates/manager/ActionBarManager.java b/src/main/java/net/momirealms/customnameplates/manager/ActionBarManager.java index 956b185..575e3fd 100644 --- a/src/main/java/net/momirealms/customnameplates/manager/ActionBarManager.java +++ b/src/main/java/net/momirealms/customnameplates/manager/ActionBarManager.java @@ -144,14 +144,19 @@ public class ActionBarManager extends Function { if ((overlay != null && overlay || position != null && position == 2)) { ActionBarTask actionBarTask = getActionBarTask(event.getPlayer().getUniqueId()); if (actionBarTask != null) { - Component component = GsonComponentSerializer.gson().deserialize(packet.getStrings().read(0)); - if (component instanceof ScoreComponent scoreComponent) { - if (scoreComponent.name().equals("nameplates") && scoreComponent.objective().equals("actionbar")) { - return; + String json = packet.getStrings().read(0); + if (json != null && !json.equals("")) { + Component component = GsonComponentSerializer.gson().deserialize(json); + if (component instanceof ScoreComponent scoreComponent) { + if (scoreComponent.name().equals("nameplates") && scoreComponent.objective().equals("actionbar")) { + return; + } } + event.setCancelled(true); + actionBarTask.setOtherText(AdventureUtils.getMiniMessageFormat(component), System.currentTimeMillis()); + } else { + event.setCancelled(true); } - event.setCancelled(true); - actionBarTask.setOtherText(AdventureUtils.getMiniMessageFormat(component), System.currentTimeMillis()); } } } diff --git a/src/main/java/net/momirealms/customnameplates/manager/FontManager.java b/src/main/java/net/momirealms/customnameplates/manager/FontManager.java index 57eb467..6abf2a3 100644 --- a/src/main/java/net/momirealms/customnameplates/manager/FontManager.java +++ b/src/main/java/net/momirealms/customnameplates/manager/FontManager.java @@ -27,7 +27,7 @@ import net.momirealms.customnameplates.object.font.OffsetFont; import net.momirealms.customnameplates.object.font.ThinASCIIWidth; import net.momirealms.customnameplates.utils.AdventureUtils; import net.momirealms.customnameplates.utils.ConfigUtils; -import org.apache.commons.lang.StringEscapeUtils; +import org.apache.commons.lang3.StringEscapeUtils; import org.bukkit.configuration.file.YamlConfiguration; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/net/momirealms/customnameplates/manager/NameplateManager.java b/src/main/java/net/momirealms/customnameplates/manager/NameplateManager.java index 57cae05..a04dab4 100644 --- a/src/main/java/net/momirealms/customnameplates/manager/NameplateManager.java +++ b/src/main/java/net/momirealms/customnameplates/manager/NameplateManager.java @@ -242,10 +242,10 @@ public class NameplateManager extends Function { String current = getEquippedNameplate(player); if (!nameplate.equals(current)) { plugin.getDataManager().equipNameplate(player, nameplate); - CustomNameplatesAPI.getAPI().updateNameplateTeam(player); + CustomNameplatesAPI.getInstance().updateNameplateTeam(player); Bukkit.getScheduler().runTaskLater(CustomNameplates.getInstance(), ()-> { plugin.getDataManager().equipNameplate(player, current); - CustomNameplatesAPI.getAPI().updateNameplateTeam(player); + CustomNameplatesAPI.getInstance().updateNameplateTeam(player); },this.getPreview_time() * 20); } showPlayerArmorStandTags(player); diff --git a/src/main/java/net/momirealms/customnameplates/manager/ResourceManager.java b/src/main/java/net/momirealms/customnameplates/manager/ResourceManager.java index 128990d..138a656 100644 --- a/src/main/java/net/momirealms/customnameplates/manager/ResourceManager.java +++ b/src/main/java/net/momirealms/customnameplates/manager/ResourceManager.java @@ -20,9 +20,6 @@ package net.momirealms.customnameplates.manager; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; -import io.th0rgal.oraxen.config.Settings; -import io.th0rgal.oraxen.utils.VirtualFile; -import io.th0rgal.oraxen.utils.ZipUtils; import net.momirealms.customnameplates.CustomNameplates; import net.momirealms.customnameplates.object.SimpleChar; import net.momirealms.customnameplates.object.background.BackGroundConfig; @@ -31,20 +28,14 @@ import net.momirealms.customnameplates.object.font.OffsetFont; import net.momirealms.customnameplates.object.nameplate.NameplateConfig; import net.momirealms.customnameplates.utils.AdventureUtils; import org.apache.commons.io.FileUtils; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.bukkit.Bukkit; import java.io.*; -import java.math.BigInteger; import java.nio.charset.StandardCharsets; -import java.nio.file.attribute.FileTime; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import java.util.Objects; -import java.util.zip.Deflater; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; public class ResourceManager { @@ -300,6 +291,7 @@ public class ResourceManager { return Character.toString(ch); } + @SuppressWarnings("ResultOfMethodCallIgnored") private void saveSplit(String texture_folder_path) { try { plugin.saveResource("space_split.png", false); diff --git a/src/main/java/net/momirealms/customnameplates/object/actionbar/ActionBarConfig.java b/src/main/java/net/momirealms/customnameplates/object/actionbar/ActionBarConfig.java index ddcdb3b..01dac96 100644 --- a/src/main/java/net/momirealms/customnameplates/object/actionbar/ActionBarConfig.java +++ b/src/main/java/net/momirealms/customnameplates/object/actionbar/ActionBarConfig.java @@ -19,27 +19,6 @@ package net.momirealms.customnameplates.object.actionbar; import net.momirealms.customnameplates.object.requirements.Requirement; -public class ActionBarConfig { +public record ActionBarConfig(int interval, String[] texts, Requirement[] conditions) { - private final int interval; - private final String[] texts; - private final Requirement[] conditions; - - public ActionBarConfig(int interval, String[] texts, Requirement[] conditions) { - this.texts = texts; - this.conditions = conditions; - this.interval = interval; - } - - public String[] getTexts() { - return texts; - } - - public Requirement[] getConditions() { - return conditions; - } - - public int getInterval() { - return interval; - } } diff --git a/src/main/java/net/momirealms/customnameplates/object/actionbar/ActionBarSender.java b/src/main/java/net/momirealms/customnameplates/object/actionbar/ActionBarSender.java index ecd9b94..af438d2 100644 --- a/src/main/java/net/momirealms/customnameplates/object/actionbar/ActionBarSender.java +++ b/src/main/java/net/momirealms/customnameplates/object/actionbar/ActionBarSender.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customnameplates.object.actionbar; import net.kyori.adventure.text.Component; diff --git a/src/main/java/net/momirealms/customnameplates/object/actionbar/ActionBarTask.java b/src/main/java/net/momirealms/customnameplates/object/actionbar/ActionBarTask.java index c4707c3..abc85c9 100644 --- a/src/main/java/net/momirealms/customnameplates/object/actionbar/ActionBarTask.java +++ b/src/main/java/net/momirealms/customnameplates/object/actionbar/ActionBarTask.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customnameplates.object.actionbar; import net.momirealms.customnameplates.CustomNameplates; @@ -18,9 +35,9 @@ public class ActionBarTask { for (int i = 0; i < configs.length; i++) { ActionBarConfig actionBarConfig = configs[i]; this.actionBarSenders[i] = new ActionBarSender( - actionBarConfig.getInterval(), - actionBarConfig.getTexts(), - actionBarConfig.getConditions(), + actionBarConfig.interval(), + actionBarConfig.texts(), + actionBarConfig.conditions(), player ); } diff --git a/src/main/java/net/momirealms/customnameplates/object/bossbar/BossBarConfig.java b/src/main/java/net/momirealms/customnameplates/object/bossbar/BossBarConfig.java index 844cc0b..478c0b8 100644 --- a/src/main/java/net/momirealms/customnameplates/object/bossbar/BossBarConfig.java +++ b/src/main/java/net/momirealms/customnameplates/object/bossbar/BossBarConfig.java @@ -20,39 +20,6 @@ package net.momirealms.customnameplates.object.bossbar; import net.momirealms.customnameplates.object.requirements.Requirement; import org.bukkit.boss.BarColor; -public class BossBarConfig { +public record BossBarConfig(String[] texts, Overlay overlay, BarColor color, int interval, Requirement[] conditions) { - private final String[] texts; - private final int interval; - private final Overlay overlay; - private final BarColor color; - private final Requirement[] conditions; - - public BossBarConfig(String[] texts, Overlay overlay, BarColor color, int interval, Requirement[] conditions) { - this.texts = texts; - this.overlay = overlay; - this.color = color; - this.interval = interval; - this.conditions = conditions; - } - - public String[] getTexts() { - return texts; - } - - public int getInterval() { - return interval; - } - - public Overlay getOverlay() { - return overlay; - } - - public BarColor getColor() { - return color; - } - - public Requirement[] getConditions() { - return conditions; - } } diff --git a/src/main/java/net/momirealms/customnameplates/object/bossbar/BossBarSender.java b/src/main/java/net/momirealms/customnameplates/object/bossbar/BossBarSender.java index 2496cf2..1cad1e1 100644 --- a/src/main/java/net/momirealms/customnameplates/object/bossbar/BossBarSender.java +++ b/src/main/java/net/momirealms/customnameplates/object/bossbar/BossBarSender.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customnameplates.object.bossbar; import com.comphenix.protocol.PacketType; diff --git a/src/main/java/net/momirealms/customnameplates/object/bossbar/BossBarTask.java b/src/main/java/net/momirealms/customnameplates/object/bossbar/BossBarTask.java index 3ebcc01..10e68d5 100644 --- a/src/main/java/net/momirealms/customnameplates/object/bossbar/BossBarTask.java +++ b/src/main/java/net/momirealms/customnameplates/object/bossbar/BossBarTask.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customnameplates.object.bossbar; import net.momirealms.customnameplates.CustomNameplates; @@ -9,19 +26,17 @@ public class BossBarTask { private BukkitTask timerTask; private final BossBarSender[] bossBarSenders; - private final Player player; public BossBarTask(Player player, BossBarConfig[] configs) { this.bossBarSenders = new BossBarSender[configs.length]; - this.player = player; for (int i = 0; i < configs.length; i++) { BossBarConfig bossBarConfig = configs[i]; this.bossBarSenders[i] = new BossBarSender( - bossBarConfig.getInterval(), - bossBarConfig.getTexts(), - bossBarConfig.getConditions(), - bossBarConfig.getOverlay(), - bossBarConfig.getColor(), + bossBarConfig.interval(), + bossBarConfig.texts(), + bossBarConfig.conditions(), + bossBarConfig.overlay(), + bossBarConfig.color(), player ); } diff --git a/src/main/java/net/momirealms/customnameplates/object/nameplate/mode/AbstractNameplateTag.java b/src/main/java/net/momirealms/customnameplates/object/nameplate/mode/AbstractNameplateTag.java index f11be04..5087f0e 100644 --- a/src/main/java/net/momirealms/customnameplates/object/nameplate/mode/AbstractNameplateTag.java +++ b/src/main/java/net/momirealms/customnameplates/object/nameplate/mode/AbstractNameplateTag.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customnameplates.object.nameplate.mode; import net.momirealms.customnameplates.CustomNameplates; diff --git a/src/main/java/net/momirealms/customnameplates/object/nameplate/mode/DisplayMode.java b/src/main/java/net/momirealms/customnameplates/object/nameplate/mode/DisplayMode.java index dd23690..f602be0 100644 --- a/src/main/java/net/momirealms/customnameplates/object/nameplate/mode/DisplayMode.java +++ b/src/main/java/net/momirealms/customnameplates/object/nameplate/mode/DisplayMode.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customnameplates.object.nameplate.mode; public enum DisplayMode { diff --git a/src/main/java/net/momirealms/customnameplates/object/requirements/TimeImpl.java b/src/main/java/net/momirealms/customnameplates/object/requirements/TimeImpl.java index 38f0397..e93cf29 100644 --- a/src/main/java/net/momirealms/customnameplates/object/requirements/TimeImpl.java +++ b/src/main/java/net/momirealms/customnameplates/object/requirements/TimeImpl.java @@ -17,7 +17,7 @@ package net.momirealms.customnameplates.object.requirements; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.bukkit.entity.Player; import java.util.List; diff --git a/src/main/java/net/momirealms/customnameplates/object/requirements/YPosImpl.java b/src/main/java/net/momirealms/customnameplates/object/requirements/YPosImpl.java index d944f17..a916859 100644 --- a/src/main/java/net/momirealms/customnameplates/object/requirements/YPosImpl.java +++ b/src/main/java/net/momirealms/customnameplates/object/requirements/YPosImpl.java @@ -17,7 +17,7 @@ package net.momirealms.customnameplates.object.requirements; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.bukkit.entity.Player; import java.util.List; diff --git a/src/main/java/net/momirealms/customnameplates/object/team/TeamNameInterface.java b/src/main/java/net/momirealms/customnameplates/object/team/TeamNameInterface.java index 4ac44e7..4e201e8 100644 --- a/src/main/java/net/momirealms/customnameplates/object/team/TeamNameInterface.java +++ b/src/main/java/net/momirealms/customnameplates/object/team/TeamNameInterface.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customnameplates.object.team; import org.bukkit.entity.Player; diff --git a/src/main/java/net/momirealms/customnameplates/object/team/name/PlayerNameTeamImpl.java b/src/main/java/net/momirealms/customnameplates/object/team/name/PlayerNameTeamImpl.java index f77558b..fc70d8d 100644 --- a/src/main/java/net/momirealms/customnameplates/object/team/name/PlayerNameTeamImpl.java +++ b/src/main/java/net/momirealms/customnameplates/object/team/name/PlayerNameTeamImpl.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customnameplates.object.team.name; import com.comphenix.protocol.PacketType; diff --git a/src/main/java/net/momirealms/customnameplates/object/team/name/TABBungeeCordImpl.java b/src/main/java/net/momirealms/customnameplates/object/team/name/TABBungeeCordImpl.java index 579f028..2131b45 100644 --- a/src/main/java/net/momirealms/customnameplates/object/team/name/TABBungeeCordImpl.java +++ b/src/main/java/net/momirealms/customnameplates/object/team/name/TABBungeeCordImpl.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customnameplates.object.team.name; import com.google.common.io.ByteArrayDataInput; diff --git a/src/main/java/net/momirealms/customnameplates/utils/ArmorStandUtils.java b/src/main/java/net/momirealms/customnameplates/utils/ArmorStandUtils.java index 0353e2c..de73bc9 100644 --- a/src/main/java/net/momirealms/customnameplates/utils/ArmorStandUtils.java +++ b/src/main/java/net/momirealms/customnameplates/utils/ArmorStandUtils.java @@ -41,13 +41,9 @@ public class ArmorStandUtils { sendSpawnPacket(player, id); sendMetaPacket(player, id, component); for (int i = 1; i < duration * 20 - 1; i++){ - Bukkit.getScheduler().runTaskLater(CustomNameplates.getInstance(), ()->{ - sendTeleportPacket(player, id); - }, i); + Bukkit.getScheduler().runTaskLater(CustomNameplates.getInstance(), ()-> sendTeleportPacket(player, id), i); } - Bukkit.getScheduler().runTaskLater(CustomNameplates.getInstance(), ()->{ - sendDestroyPacket(player, id); - }, duration * 20L); + Bukkit.getScheduler().runTaskLater(CustomNameplates.getInstance(), ()-> sendDestroyPacket(player, id), duration * 20L); } public static void sendSpawnPacket(Player player, int id) {