From bda7465a858ff83faa3189359cca027e10b1de74 Mon Sep 17 00:00:00 2001 From: Badbird-5907 Date: Thu, 22 Jul 2021 11:11:50 -0400 Subject: [PATCH] add skins (with floodgate/geyser support) an bump version --- pom.xml | 12 +++++++++++- .../net/badbird5907/anticombatlog/AntiCombatLog.java | 2 +- .../anticombatlog/manager/NPCManager.java | 9 +++++++++ .../badbird5907/anticombatlog/object/HoloTrait.java | 3 +-- src/main/resources/plugin.yml | 2 ++ 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 23a1494..a92e4b7 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.badbird5907 AntiCombatLog - 1.0.0 + 1.0.1 jar AntiCombatLog @@ -65,6 +65,10 @@ everything https://repo.citizensnpcs.co/ + + opencollab-snapshot + https://repo.opencollab.dev/maven-snapshots/ + @@ -86,5 +90,11 @@ jar provided + + org.geysermc.floodgate + api + 2.0-SNAPSHOT + provided + diff --git a/src/main/java/net/badbird5907/anticombatlog/AntiCombatLog.java b/src/main/java/net/badbird5907/anticombatlog/AntiCombatLog.java index a4d4477..4514f27 100644 --- a/src/main/java/net/badbird5907/anticombatlog/AntiCombatLog.java +++ b/src/main/java/net/badbird5907/anticombatlog/AntiCombatLog.java @@ -66,7 +66,7 @@ public void onEnable() { if (!this.getDescription().getVersion().equalsIgnoreCase(version)){ getLogger().info("There a new update available! Download at https://badbird5907.xyz/anticombatlog"); }else{ - getLogger().info("There is no new update available!"); + //just dont say anything } }); } diff --git a/src/main/java/net/badbird5907/anticombatlog/manager/NPCManager.java b/src/main/java/net/badbird5907/anticombatlog/manager/NPCManager.java index 450967a..8ddf9f3 100644 --- a/src/main/java/net/badbird5907/anticombatlog/manager/NPCManager.java +++ b/src/main/java/net/badbird5907/anticombatlog/manager/NPCManager.java @@ -10,11 +10,14 @@ import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.trait.trait.Equipment; import net.citizensnpcs.api.trait.trait.Inventory; +import net.citizensnpcs.trait.SkinTrait; +import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.geysermc.floodgate.api.FloodgateApi; import java.util.Arrays; import java.util.Map; @@ -53,6 +56,12 @@ public static void spawn(Player player,int i){ npc.getTrait(Equipment.class).set(Equipment.EquipmentSlot.HAND,player.getInventory().getItemInMainHand()); //TODO multi version npc.getTrait(Equipment.class).set(Equipment.EquipmentSlot.OFF_HAND,player.getInventory().getItemInOffHand()); npc.getTrait(Inventory.class).setContents(player.getInventory().getContents()); + if (Bukkit.getPluginManager().isPluginEnabled("Floodgate")) { + if (!FloodgateApi.getInstance().isFloodgatePlayer(player.getUniqueId())) ;//to prevent problems with floodgate/geyser players + npc.getOrAddTrait(SkinTrait.class).setSkinName(player.getName()); + }else{ + npc.getOrAddTrait(SkinTrait.class).setSkinName(player.getName()); + } npcs.put(player.getUniqueId(),new Triplet<>(i,npc,player.getName())); npc.spawn(player.getLocation()); } diff --git a/src/main/java/net/badbird5907/anticombatlog/object/HoloTrait.java b/src/main/java/net/badbird5907/anticombatlog/object/HoloTrait.java index 2d8230b..8f6d04e 100644 --- a/src/main/java/net/badbird5907/anticombatlog/object/HoloTrait.java +++ b/src/main/java/net/badbird5907/anticombatlog/object/HoloTrait.java @@ -62,7 +62,7 @@ public void clear() { private NPC createHologram(String line, double heightOffset) { NPC hologramNPC = this.registry.createNPC(EntityType.ARMOR_STAND, line); hologramNPC.addTrait(new ClickRedirectTrait(this.npc)); - ArmorStandTrait trait = (ArmorStandTrait)hologramNPC.getOrAddTrait(ArmorStandTrait.class); + ArmorStandTrait trait = hologramNPC.getOrAddTrait(ArmorStandTrait.class); trait.setVisible(false); trait.setSmall(true); trait.setMarker(true); @@ -137,7 +137,6 @@ public void onSpawn() { String line = (String)this.lines.get(i); this.hologramNPCs.add(this.createHologram(Placeholders.replace(line, (CommandSender)null, this.npc), this.getHeight(i))); } - } public void removeLine(int idx) { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index da43a64..c14348a 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -3,6 +3,8 @@ version: ${project.version} main: net.badbird5907.anticombatlog.AntiCombatLog api-version: 1.17 depend: [ Citizens ] +softdepend: + - Floodgate commands: anticombatlog: description: main command