Skip to content

Commit

Permalink
FIX can't place player heads
Browse files Browse the repository at this point in the history
  • Loading branch information
Relluem94 committed Jul 21, 2023
1 parent f966499 commit 9623ddb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>de.relluem94</groupId>
<artifactId>relluessentials</artifactId>
<name>RelluEssentials</name>
<version>4.1</version>
<version>4.1.3</version>
<url>https://github.com/Relluem94s/RelluEssentials</url>
<scm>
<connection>scm:git:git@github.com:Relluem94s/RelluEssentials.git</connection>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<groupId>de.relluem94</groupId>
<artifactId>relluessentials</artifactId>
<name>RelluEssentials</name>
<version>4.1.2</version>
<version>4.1.3</version>
<url>https://github.com/Relluem94s/RelluEssentials</url>
<properties>
<plugin.apiVersion>1.19</plugin.apiVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class BetterNPC implements Listener {
@EventHandler
public void onNPCPlacement(PlayerInteractEvent e) {
if (e.getHand() != null && e.getHand().equals(EquipmentSlot.HAND)) {
if((e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR) && (e.getItem() != null && new WorldSelector().almostEquals(e.getItem()))){
if((e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR) && (e.getItem() != null && new WorldSelector().equalsName(e.getItem()))){
Worlds.openWorldMenu(e.getPlayer());
e.setCancelled(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,28 @@ public boolean equalsExact(ItemStack compare) {
return item.hasItemMeta() && item.getItemMeta().equals(compare.getItemMeta());
}

/**
*
* @param compare
* @return boolean
*/
public boolean equalsName(ItemStack compare) {
ItemStack item = this.getCustomItem();
if (item == null || compare == null) {
return false;
}

if (item.getType() != compare.getType()) {
return false;
}

if (item.hasItemMeta() != compare.hasItemMeta()) {
return false;
}

return item.getItemMeta().getDisplayName().equals(compare.getItemMeta().getDisplayName()) ;
}

/**
*
* @param compare
Expand Down

0 comments on commit 9623ddb

Please sign in to comment.