Skip to content

Commit

Permalink
add skins (with floodgate/geyser support) an bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
Badbird5907 committed Jul 22, 2021
1 parent e6a462c commit bda7465
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
12 changes: 11 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>net.badbird5907</groupId>
<artifactId>AntiCombatLog</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<packaging>jar</packaging>

<name>AntiCombatLog</name>
Expand Down Expand Up @@ -65,6 +65,10 @@
<id>everything</id>
<url>https://repo.citizensnpcs.co/</url>
</repository>
<repository>
<id>opencollab-snapshot</id>
<url>https://repo.opencollab.dev/maven-snapshots/</url>
</repository>
</repositories>

<dependencies>
Expand All @@ -86,5 +90,11 @@
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.geysermc.floodgate</groupId>
<artifactId>api</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bda7465

Please sign in to comment.