diff --git a/.gitignore b/.gitignore index b63da45..5b7098d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,12 @@ .gradle build/ +target/ !gradle/wrapper/gradle-wrapper.jar !**/src/main/**/build/ !**/src/test/**/build/ ### IntelliJ IDEA ### -.idea/modules.xml -.idea/jarRepositories.xml -.idea/compiler.xml -.idea/libraries/ +.idea *.iws *.iml *.ipr diff --git a/api/src/main/java/net/momirealms/customnameplates/api/mechanic/background/BackGround.java b/api/src/main/java/net/momirealms/customnameplates/api/mechanic/background/BackGround.java index e071ab4..ec78ed7 100644 --- a/api/src/main/java/net/momirealms/customnameplates/api/mechanic/background/BackGround.java +++ b/api/src/main/java/net/momirealms/customnameplates/api/mechanic/background/BackGround.java @@ -40,7 +40,8 @@ public class BackGround { ConfiguredChar offset_128, ConfiguredChar right, int leftMargin, - int rightMargin + int rightMargin, + boolean removeShadow ) { this.left = left; this.offset_1 = offset_1; diff --git a/api/src/main/java/net/momirealms/customnameplates/api/mechanic/placeholder/BackGroundText.java b/api/src/main/java/net/momirealms/customnameplates/api/mechanic/placeholder/BackGroundText.java index 1838f27..340f562 100644 --- a/api/src/main/java/net/momirealms/customnameplates/api/mechanic/placeholder/BackGroundText.java +++ b/api/src/main/java/net/momirealms/customnameplates/api/mechanic/placeholder/BackGroundText.java @@ -26,13 +26,15 @@ public class BackGroundText { private String text; private BackGround backGround; + private boolean removeShadow; private BackGroundText() { } - public BackGroundText(String text, BackGround backGround) { + public BackGroundText(String text, BackGround backGround, boolean removeShadow) { this.text = text; this.backGround = backGround; + this.removeShadow = removeShadow; } public String getText() { @@ -46,7 +48,8 @@ public class BackGroundText { public String getValue(OfflinePlayer player) { String parsed = PlaceholderAPI.setPlaceholders(player, text); int parsedWidth = FontUtils.getTextWidth(parsed); - return FontUtils.surroundNameplateFont(backGround.getBackGroundImage(parsedWidth)) + parsed; + String bg = FontUtils.surroundNameplateFont(backGround.getBackGroundImage(parsedWidth)); + return (removeShadow ? "<#FFFEFD>" + bg + "" : bg)+ parsed; } public static Builder builder() { @@ -75,6 +78,11 @@ public class BackGroundText { return this; } + public Builder removeShadow(boolean remove) { + text.removeShadow = remove; + return this; + } + public BackGroundText build() { return text; } diff --git a/build.gradle.kts b/build.gradle.kts index 3db5b32..752909a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ plugins { allprojects { - version = "2.3.0.0-beta-1" + version = "2.3.0.0-beta-2" apply() apply(plugin = "java") diff --git a/gradle.properties b/gradle.properties index e69de29..7b26f39 100644 --- a/gradle.properties +++ b/gradle.properties @@ -0,0 +1,8 @@ +systemProp.socks.proxyHost=127.0.0.1 +systemProp.socks.proxyPort=7890 + +systemProp.http.proxyHost=127.0.0.1 +systemProp.http.proxyPort=7890 + +systemProp.https.proxyHost=127.0.0.1 +systemProp.https.proxyPort=7890 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 744c64d..dd1f248 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists + diff --git a/paper/src/main/java/net/momirealms/customnameplates/paper/CustomNameplatesPluginImpl.java b/paper/src/main/java/net/momirealms/customnameplates/paper/CustomNameplatesPluginImpl.java index 74d4d7c..984a5a6 100644 --- a/paper/src/main/java/net/momirealms/customnameplates/paper/CustomNameplatesPluginImpl.java +++ b/paper/src/main/java/net/momirealms/customnameplates/paper/CustomNameplatesPluginImpl.java @@ -17,6 +17,7 @@ package net.momirealms.customnameplates.paper; +import me.clip.placeholderapi.PlaceholderAPI; import net.momirealms.customnameplates.api.CustomNameplatesPlugin; import net.momirealms.customnameplates.api.event.CustomNameplatesReloadEvent; import net.momirealms.customnameplates.api.util.LogUtils; @@ -43,11 +44,16 @@ import net.momirealms.customnameplates.paper.setting.CNLocale; import net.momirealms.customnameplates.paper.storage.StorageManagerImpl; import net.momirealms.customnameplates.paper.util.ReflectionUtils; import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; import java.io.File; import java.util.TimeZone; -public class CustomNameplatesPluginImpl extends CustomNameplatesPlugin { +public class CustomNameplatesPluginImpl extends CustomNameplatesPlugin implements Listener { private CoolDownManager coolDownManager; private PacketManager packetManager; @@ -83,6 +89,7 @@ public class CustomNameplatesPluginImpl extends CustomNameplatesPlugin { if (!outDated) this.getAdventure().sendConsoleMessage("[CustomNameplates] You are using the latest version."); else this.getAdventure().sendConsoleMessage("[CustomNameplates] Update is available: https://polymart.org/resource/2543"); }); + this.getServer().getPluginManager().registerEvents((VersionManagerImpl) versionManager, this); } @Override @@ -101,6 +108,7 @@ public class CustomNameplatesPluginImpl extends CustomNameplatesPlugin { ((WidthManagerImpl) this.widthManager).unload(); ((StorageManagerImpl) this.storageManager).disable(); ((AdventureManagerImpl) this.adventureManager).close(); + HandlerList.unregisterAll((VersionManagerImpl) versionManager); } @Override diff --git a/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/font/WidthManagerImpl.java b/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/font/WidthManagerImpl.java index deae4ae..d84e59b 100644 --- a/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/font/WidthManagerImpl.java +++ b/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/font/WidthManagerImpl.java @@ -36,6 +36,7 @@ import net.momirealms.customnameplates.api.mechanic.character.ConfiguredChar; import net.momirealms.customnameplates.api.mechanic.font.FontData; import net.momirealms.customnameplates.api.mechanic.font.OffsetFont; import net.momirealms.customnameplates.api.mechanic.nameplate.Nameplate; +import net.momirealms.customnameplates.api.mechanic.placeholder.DescentText; import net.momirealms.customnameplates.api.util.LogUtils; import net.momirealms.customnameplates.common.Key; import net.momirealms.customnameplates.common.Tuple; @@ -126,6 +127,37 @@ public class WidthManagerImpl implements WidthManager { registerFontData( Key.of(CNConfig.namespace, CNConfig.font), fontData ); + + ArrayList ascentTexts = new ArrayList<>(); + ArrayList ascentUnicodes = new ArrayList<>(); + for (DescentText descentText : plugin.getPlaceholderManager().getDescentTexts()) { + if (descentText.isUnicode()) { + ascentUnicodes.add(descentText.getAscent()); + } else { + ascentTexts.add(descentText.getAscent()); + } + } + ascentTexts.removeAll(ascentUnicodes); + + for (int ascent : ascentTexts) { + FontData descentFont = new FontData(8); + descentFont.overrideWith(NONLATIN_EUROPEAN_DATA); + descentFont.overrideWith(ACCENTED_DATA); + descentFont.overrideWith(ASCII_DATA); + registerFontData( + Key.of(CNConfig.namespace, "ascent_" + ascent), descentFont + ); + } + for (int ascent : ascentUnicodes) { + FontData descentFont = new FontData(8); + descentFont.overrideWith(UNICODE_DATA); + descentFont.overrideWith(NONLATIN_EUROPEAN_DATA); + descentFont.overrideWith(ACCENTED_DATA); + descentFont.overrideWith(ASCII_DATA); + registerFontData( + Key.of(CNConfig.namespace, "ascent_" + ascent), descentFont + ); + } } private void loadUserConfigs() { diff --git a/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/image/ImageManagerImpl.java b/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/image/ImageManagerImpl.java index c245318..28dd81b 100644 --- a/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/image/ImageManagerImpl.java +++ b/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/image/ImageManagerImpl.java @@ -23,6 +23,7 @@ import net.momirealms.customnameplates.api.mechanic.character.CharacterArranger; import net.momirealms.customnameplates.api.mechanic.character.ConfiguredChar; import net.momirealms.customnameplates.api.util.LogUtils; import net.momirealms.customnameplates.paper.setting.CNConfig; +import net.momirealms.customnameplates.paper.util.ImageUtils; import org.bukkit.configuration.file.YamlConfiguration; import org.jetbrains.annotations.NotNull; @@ -91,6 +92,11 @@ public class ImageManagerImpl implements ImageManager { LogUtils.warn("Found duplicated image: " + key); } } + + File[] pgFiles = imgFolder.listFiles(file -> file.getName().endsWith(".png")); + for (File pg : pgFiles) { + ImageUtils.removeImageShadow(pg); + } } @Override diff --git a/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/misc/VersionManagerImpl.java b/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/misc/VersionManagerImpl.java index 18f7490..37ea0fe 100644 --- a/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/misc/VersionManagerImpl.java +++ b/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/misc/VersionManagerImpl.java @@ -17,9 +17,15 @@ package net.momirealms.customnameplates.paper.mechanic.misc; +import me.clip.placeholderapi.PlaceholderAPI; import net.momirealms.customnameplates.api.manager.VersionManager; import net.momirealms.customnameplates.api.util.LogUtils; import net.momirealms.customnameplates.paper.CustomNameplatesPluginImpl; +import net.momirealms.customnameplates.paper.adventure.AdventureManagerImpl; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; import java.io.BufferedReader; import java.io.InputStream; @@ -31,7 +37,7 @@ import java.util.concurrent.CompletableFuture; /** * This class implements the VersionManager interface and is responsible for managing version-related information. */ -public class VersionManagerImpl implements VersionManager { +public class VersionManagerImpl implements VersionManager, Listener { private final boolean isNewerThan1_19; private final boolean isNewerThan1_19_R2; @@ -224,4 +230,14 @@ public class VersionManagerImpl implements VersionManager { } return newVS.length > currentVS.length; } + + @EventHandler + public void onJoin(PlayerJoinEvent event) { + final Player player = event.getPlayer(); + if (player.isOp()) { + if (!PlaceholderAPI.isRegistered("player")) { + AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, "You haven't installed Player Expansion yet. Click HERE to download."); + } + } + } } \ No newline at end of file diff --git a/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/pack/ResourcePackManagerImpl.java b/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/pack/ResourcePackManagerImpl.java index e4519c4..4eabccf 100644 --- a/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/pack/ResourcePackManagerImpl.java +++ b/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/pack/ResourcePackManagerImpl.java @@ -32,6 +32,9 @@ import net.momirealms.customnameplates.api.util.LogUtils; import net.momirealms.customnameplates.paper.setting.CNConfig; import net.momirealms.customnameplates.paper.util.ConfigUtils; import org.bukkit.Bukkit; +import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.plugin.Plugin; import org.codehaus.plexus.util.FileUtils; import javax.imageio.ImageIO; @@ -235,6 +238,8 @@ public class ResourcePackManagerImpl implements ResourcePackManager { } } + ascentTexts.removeAll(ascentUnicodes); + for (int ascent : ascentTexts) { String line; StringBuilder sb = new StringBuilder(); @@ -313,20 +318,41 @@ public class ResourcePackManagerImpl implements ResourcePackManager { } private void copyResourcePackToHookedPlugins(File resourcePackFolder) { - if (CNConfig.copyPackIA) { - try { - FileUtils.copyDirectory(new File(resourcePackFolder, "assets"), new File(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("ItemsAdder")).getDataFolder() + File.separator + "contents" + File.separator + "nameplates" + File.separator + "resourcepack" + File.separator + "assets") ); - } catch (IOException e) { - e.printStackTrace(); + Plugin ia = Bukkit.getPluginManager().getPlugin("ItemsAdder"); + if (ia != null) { + File file = new File(ia.getDataFolder(), "config.yml"); + YamlConfiguration iaConfig = YamlConfiguration.loadConfiguration(file); + List folders = iaConfig.getStringList("resource-pack.zip.merge_other_plugins_resourcepacks_folders"); + boolean changed = false; + if (CNConfig.copyPackIA) { + if (!folders.contains("CustomNameplates/ResourcePack")) { + folders.add("CustomNameplates/ResourcePack"); + iaConfig.set("resource-pack.zip.merge_other_plugins_resourcepacks_folders", folders); + changed = true; + } + } else { + if (folders.contains("CustomNameplates/ResourcePack")) { + folders.remove("CustomNameplates/ResourcePack"); + iaConfig.set("resource-pack.zip.merge_other_plugins_resourcepacks_folders", folders); + changed = true; + } + } + if (changed) { + try { + iaConfig.save(file); + } catch (IOException e) { + e.printStackTrace(); + } + } } - } - if (CNConfig.copyPackOraxen) { - try { - FileUtils.copyDirectory(new File(resourcePackFolder, "assets"), new File(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("Oraxen")).getDataFolder() + File.separator + "pack" + File.separator + "assets")); - } catch (IOException e) { - e.printStackTrace(); - } - } + +// if (CNConfig.copyPackOraxen) { +// try { +// FileUtils.copyDirectory(new File(resourcePackFolder, "assets"), new File(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("Oraxen")).getDataFolder() + File.separator + "pack" + File.separator + "assets")); +// } catch (IOException e) { +// e.printStackTrace(); +// } +// } } private List getNameplates(File texturesFolder) { diff --git a/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/placeholder/PlaceholderManagerImpl.java b/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/placeholder/PlaceholderManagerImpl.java index cc0913c..d54fc75 100644 --- a/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/placeholder/PlaceholderManagerImpl.java +++ b/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/placeholder/PlaceholderManagerImpl.java @@ -193,6 +193,7 @@ public class PlaceholderManagerImpl implements PlaceholderManager { BackGroundText.builder() .background(Objects.requireNonNull(plugin.getBackGroundManager().getBackGround(innerSection.getString("background")))) .text(innerSection.getString("text", "")) + .removeShadow(innerSection.getBoolean("remove-shadow")) .build() ); } @@ -228,7 +229,7 @@ public class PlaceholderManagerImpl implements PlaceholderManager { DescentText.builder() .descent(innerSection.getInt("descent", 0)) .text(innerSection.getString("text", "")) - .unicode(unicode) + .unicode(unicode || innerSection.getBoolean("is-unicode")) .build() ); } diff --git a/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/team/TeamManagerImpl.java b/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/team/TeamManagerImpl.java index e4e89fe..1f3cd97 100644 --- a/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/team/TeamManagerImpl.java +++ b/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/team/TeamManagerImpl.java @@ -23,16 +23,14 @@ import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; import net.momirealms.customnameplates.api.CustomNameplatesPlugin; import net.momirealms.customnameplates.api.manager.TeamManager; +import net.momirealms.customnameplates.api.util.LogUtils; import net.momirealms.customnameplates.common.message.MessageType; import net.momirealms.customnameplates.common.team.TeamCollisionRule; import net.momirealms.customnameplates.common.team.TeamColor; import net.momirealms.customnameplates.common.team.TeamTagVisibility; import net.momirealms.customnameplates.paper.mechanic.misc.PacketManager; import net.momirealms.customnameplates.paper.mechanic.team.packet.*; -import net.momirealms.customnameplates.paper.mechanic.team.provider.CMIProvider; -import net.momirealms.customnameplates.paper.mechanic.team.provider.DefaultProvider; -import net.momirealms.customnameplates.paper.mechanic.team.provider.TABProvider; -import net.momirealms.customnameplates.paper.mechanic.team.provider.TeamProvider; +import net.momirealms.customnameplates.paper.mechanic.team.provider.*; import net.momirealms.customnameplates.paper.setting.CNConfig; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -57,9 +55,14 @@ public class TeamManagerImpl implements TeamManager, PluginMessageListener { @Override public void createTeam(Player player) { if (CNConfig.disableTeamManage) return; + String team = teamProvider.getTeam(player); + if (team == null) { + LogUtils.warn("Failed to get player " + player.getName() + "'s team."); + return; + } PacketContainer createOwner = teamPacketAdaptor.getTeamCreatePacket( TeamCreate.builder() - .teamName(teamProvider.getTeam(player)) + .teamName(team) .color(TeamColor.WHITE) .display("") .prefix("") @@ -72,9 +75,10 @@ public class TeamManagerImpl implements TeamManager, PluginMessageListener { for (Player online : Bukkit.getOnlinePlayers()) { PacketManager.getInstance().send(online, createOwner); if (online == player) continue; + String onlineTeam = teamProvider.getTeam(online); PacketContainer createOther = teamPacketAdaptor.getTeamCreatePacket( TeamCreate.builder() - .teamName(teamProvider.getTeam(online)) + .teamName(onlineTeam) .color(TeamColor.WHITE) .display("") .prefix("") @@ -91,9 +95,10 @@ public class TeamManagerImpl implements TeamManager, PluginMessageListener { @Override public void removeTeam(Player player) { if (CNConfig.disableTeamManage) return; + String team = teamProvider.getTeam(player); PacketContainer packet = teamPacketAdaptor.getTeamRemovePacket( TeamRemove.builder() - .teamName(teamProvider.getTeam(player)) + .teamName(team) .build() ); for (Player online : Bukkit.getOnlinePlayers()) { @@ -105,6 +110,7 @@ public class TeamManagerImpl implements TeamManager, PluginMessageListener { @Override public void updateTeam(Player owner, Player viewer, String prefix, String suffix, TeamColor color, TeamTagVisibility visibility) { if (CNConfig.disableTeamManage) return; + String team = teamProvider.getTeam(owner); if (color == TeamColor.NONE || color == TeamColor.CUSTOM) color = TeamColor.WHITE; if (plugin.getNameplateManager().isProxyMode()) { @@ -120,7 +126,7 @@ public class TeamManagerImpl implements TeamManager, PluginMessageListener { } else { PacketContainer packet = teamPacketAdaptor.getTeamUpdatePacket( TeamUpdate.builder() - .teamName(teamProvider.getTeam(owner)) + .teamName(team) .color(color) .display("") .prefix(prefix) @@ -148,6 +154,8 @@ public class TeamManagerImpl implements TeamManager, PluginMessageListener { teamProvider = new TABProvider(); } else if (CNConfig.cmiTeam) { teamProvider = new CMIProvider(); + } else if (CNConfig.unknownTeam) { + teamProvider = new UnknownProvider(); } else { teamProvider = new DefaultProvider(); } diff --git a/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/team/provider/CMIProvider.java b/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/team/provider/CMIProvider.java index eedbe79..7061c0d 100644 --- a/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/team/provider/CMIProvider.java +++ b/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/team/provider/CMIProvider.java @@ -26,7 +26,7 @@ public class CMIProvider implements TeamProvider { @Override public String getTeam(Player player) { Team team = CMI.getInstance().getSB().getPlayerTeam(player); - if (team == null) return player.getName(); + if (team == null) return null; return team.getName(); } } diff --git a/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/team/provider/UnknownProvider.java b/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/team/provider/UnknownProvider.java new file mode 100644 index 0000000..f847546 --- /dev/null +++ b/paper/src/main/java/net/momirealms/customnameplates/paper/mechanic/team/provider/UnknownProvider.java @@ -0,0 +1,36 @@ +/* + * 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.paper.mechanic.team.provider; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.scoreboard.Scoreboard; +import org.bukkit.scoreboard.Team; + +public class UnknownProvider implements TeamProvider { + + @Override + public String getTeam(Player player) { + Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard(); + Team team = scoreboard.getPlayerTeam(player); + if (team == null) { + return null; + } + return team.getName(); + } +} diff --git a/paper/src/main/java/net/momirealms/customnameplates/paper/setting/CNConfig.java b/paper/src/main/java/net/momirealms/customnameplates/paper/setting/CNConfig.java index b224212..30b8a16 100644 --- a/paper/src/main/java/net/momirealms/customnameplates/paper/setting/CNConfig.java +++ b/paper/src/main/java/net/momirealms/customnameplates/paper/setting/CNConfig.java @@ -79,6 +79,7 @@ public class CNConfig { public static boolean textEffects; public static boolean disableTeamManage; public static boolean velocitab; + public static boolean unknownTeam; public static void load() { try { @@ -128,6 +129,7 @@ public class CNConfig { tabTeam = integrationSection.getBoolean("team.TAB", false); cmiTeam = integrationSection.getBoolean("team.CMI", false); velocitab = integrationSection.getBoolean("team.Velocitab", false); + unknownTeam = integrationSection.getBoolean("team.unknown", false); } ConfigurationSection packSection = config.getConfigurationSection("resource-pack"); diff --git a/paper/src/main/java/net/momirealms/customnameplates/paper/util/ImageUtils.java b/paper/src/main/java/net/momirealms/customnameplates/paper/util/ImageUtils.java new file mode 100644 index 0000000..3da9114 --- /dev/null +++ b/paper/src/main/java/net/momirealms/customnameplates/paper/util/ImageUtils.java @@ -0,0 +1,36 @@ +package net.momirealms.customnameplates.paper.util; + +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; + +public class ImageUtils { + + public static void removeImageShadow(File file) { + try { + BufferedImage inputImage = ImageIO.read(file); + + int width = inputImage.getWidth(); + int height = inputImage.getHeight(); + BufferedImage outputImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); + int[] pixels = new int[width * height]; + inputImage.getRGB(0, 0, width, height, pixels, 0, width); + for (int i = 0; i < pixels.length; i++) { + int alpha = (pixels[i] >> 24) & 0xFF; + int red = (pixels[i] >> 16) & 0xFF; + int green = (pixels[i] >> 8) & 0xFF; + int blue = pixels[i] & 0xFF; + if (alpha > 0) { + alpha = 254; + } + int newPixel = (alpha << 24) | (red << 16) | (green << 8) | blue; + pixels[i] = newPixel; + } + outputImage.setRGB(0, 0, width, height, pixels, 0, width); + ImageIO.write(outputImage, "png", file); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/paper/src/main/resources/config.yml b/paper/src/main/resources/config.yml index 7a17417..ecb5dbb 100644 --- a/paper/src/main/resources/config.yml +++ b/paper/src/main/resources/config.yml @@ -23,13 +23,14 @@ modules: actionbars: true images: true -# Integrations +# Integrations (Please read the wiki) # https://mo-mi.gitbook.io/xiaomomi-plugins/plugin-wiki/customnameplates/compatibility integrations: resource-pack: ItemsAdder: false Oraxen: false team: + unknown: false TAB: false CMI: false Velocitab: false diff --git a/paper/src/main/resources/configs/custom-placeholders.yml b/paper/src/main/resources/configs/custom-placeholders.yml index c24e90c..b0bdc19 100644 --- a/paper/src/main/resources/configs/custom-placeholders.yml +++ b/paper/src/main/resources/configs/custom-placeholders.yml @@ -136,36 +136,30 @@ static-text: # Note: If you want to make an image lower, edit the y position/ascent in that plugin instead of # using descent text or descent unicode because they are designed for characters descent-text: - name: - text: "%player_name%" - descent: 0 - player: - text: "%player_name%" - descent: 5 - position: - text: "Your Position: %player_x%, %player_y%, %player_z%" + location: + text: "Your Location: [X: %player_x%, Y: %player_y%, Z: %player_z%]" descent: 5 + is-unicode: false time: text: "Time: %nameplates_time%" descent: 5 + is-unicode: false weather: text: "Weather: %nameplates_conditional_weather%" descent: 5 - region: - text: "Region: %worldguard_region%" - descent: 5 + is-unicode: false update: text: "A newer version of CustomNameplates is available!" descent: 3 + is-unicode: false money: text: "%vault_eco_balance%" descent: 13 - -# %nameplates_unicode_{0}% -descent-unicode: + is-unicode: false hello: - text: "Hello 여보세요 你好 こんにちは" + text: "Hello 여보세요 你好 こんにちは, Thanks for using CustomNameplates" descent: 5 + is-unicode: true # %nameplates_switch_{0}% switch-text: diff --git a/paper/src/main/resources/contents/images/bell.png b/paper/src/main/resources/contents/images/bell.png index 54ff717..a91cd58 100644 Binary files a/paper/src/main/resources/contents/images/bell.png and b/paper/src/main/resources/contents/images/bell.png differ diff --git a/paper/src/main/resources/contents/images/bell.yml b/paper/src/main/resources/contents/images/bell.yml index de05b65..e079064 100644 --- a/paper/src/main/resources/contents/images/bell.yml +++ b/paper/src/main/resources/contents/images/bell.yml @@ -1,4 +1,4 @@ image: bell height: 10 -ascent: 7 +ascent: 6 width: 10 diff --git a/paper/src/main/resources/contents/images/bubble.png b/paper/src/main/resources/contents/images/bubble.png index d09b6aa..a9df3bf 100644 Binary files a/paper/src/main/resources/contents/images/bubble.png and b/paper/src/main/resources/contents/images/bubble.png differ diff --git a/paper/src/main/resources/contents/images/bubble.yml b/paper/src/main/resources/contents/images/bubble.yml index 476fc04..5fe2085 100644 --- a/paper/src/main/resources/contents/images/bubble.yml +++ b/paper/src/main/resources/contents/images/bubble.yml @@ -1,4 +1,4 @@ image: bubble height: 10 -ascent: 5 +ascent: 4 width: 10 diff --git a/paper/src/main/resources/contents/images/clock.png b/paper/src/main/resources/contents/images/clock.png index 1e98239..e10860c 100644 Binary files a/paper/src/main/resources/contents/images/clock.png and b/paper/src/main/resources/contents/images/clock.png differ diff --git a/paper/src/main/resources/contents/images/clock.yml b/paper/src/main/resources/contents/images/clock.yml index d4e8383..c8845b8 100644 --- a/paper/src/main/resources/contents/images/clock.yml +++ b/paper/src/main/resources/contents/images/clock.yml @@ -1,4 +1,4 @@ image: clock height: 10 -ascent: 5 +ascent: 4 width: 10 diff --git a/paper/src/main/resources/contents/images/coin.png b/paper/src/main/resources/contents/images/coin.png index 5e7c063..ed355a6 100644 Binary files a/paper/src/main/resources/contents/images/coin.png and b/paper/src/main/resources/contents/images/coin.png differ diff --git a/paper/src/main/resources/contents/images/coin.yml b/paper/src/main/resources/contents/images/coin.yml index cb9126f..0293a5a 100644 --- a/paper/src/main/resources/contents/images/coin.yml +++ b/paper/src/main/resources/contents/images/coin.yml @@ -1,4 +1,4 @@ image: coin height: 10 -ascent: -2 +ascent: -3 width: 10 diff --git a/paper/src/main/resources/contents/images/compass.png b/paper/src/main/resources/contents/images/compass.png index 3eb72b4..9a00282 100644 Binary files a/paper/src/main/resources/contents/images/compass.png and b/paper/src/main/resources/contents/images/compass.png differ diff --git a/paper/src/main/resources/contents/images/compass.yml b/paper/src/main/resources/contents/images/compass.yml index 35f1f51..78bcc91 100644 --- a/paper/src/main/resources/contents/images/compass.yml +++ b/paper/src/main/resources/contents/images/compass.yml @@ -1,4 +1,4 @@ image: compass height: 10 -ascent: 5 +ascent: 4 width: 10 diff --git a/paper/src/main/resources/contents/images/stamina_0.png b/paper/src/main/resources/contents/images/stamina_0.png index 58ceda8..82ddd05 100644 Binary files a/paper/src/main/resources/contents/images/stamina_0.png and b/paper/src/main/resources/contents/images/stamina_0.png differ diff --git a/paper/src/main/resources/contents/images/stamina_0.yml b/paper/src/main/resources/contents/images/stamina_0.yml index 799ba3e..d42f253 100644 --- a/paper/src/main/resources/contents/images/stamina_0.yml +++ b/paper/src/main/resources/contents/images/stamina_0.yml @@ -1,4 +1,4 @@ image: stamina_0 height: 9 -ascent: -15 +ascent: -16 width: 9 diff --git a/paper/src/main/resources/contents/images/stamina_1.png b/paper/src/main/resources/contents/images/stamina_1.png index c4a6482..764a1d9 100644 Binary files a/paper/src/main/resources/contents/images/stamina_1.png and b/paper/src/main/resources/contents/images/stamina_1.png differ diff --git a/paper/src/main/resources/contents/images/stamina_1.yml b/paper/src/main/resources/contents/images/stamina_1.yml index 3cc8403..54d67f5 100644 --- a/paper/src/main/resources/contents/images/stamina_1.yml +++ b/paper/src/main/resources/contents/images/stamina_1.yml @@ -1,4 +1,4 @@ image: stamina_1 height: 9 -ascent: -15 +ascent: -16 width: 9 diff --git a/paper/src/main/resources/contents/images/stamina_2.png b/paper/src/main/resources/contents/images/stamina_2.png index 2dc2968..05c47f4 100644 Binary files a/paper/src/main/resources/contents/images/stamina_2.png and b/paper/src/main/resources/contents/images/stamina_2.png differ diff --git a/paper/src/main/resources/contents/images/stamina_2.yml b/paper/src/main/resources/contents/images/stamina_2.yml index 27dd24a..da57ae0 100644 --- a/paper/src/main/resources/contents/images/stamina_2.yml +++ b/paper/src/main/resources/contents/images/stamina_2.yml @@ -1,4 +1,4 @@ image: stamina_2 height: 9 -ascent: -15 +ascent: -16 width: 9 diff --git a/paper/src/main/resources/contents/images/weather.png b/paper/src/main/resources/contents/images/weather.png index f55e78a..d76cbb5 100644 Binary files a/paper/src/main/resources/contents/images/weather.png and b/paper/src/main/resources/contents/images/weather.png differ diff --git a/paper/src/main/resources/contents/images/weather.yml b/paper/src/main/resources/contents/images/weather.yml index 8d2eed7..d13066d 100644 --- a/paper/src/main/resources/contents/images/weather.yml +++ b/paper/src/main/resources/contents/images/weather.yml @@ -1,4 +1,4 @@ image: weather height: 10 -ascent: 5 +ascent: 4 width: 10