Skip to content

Commit

Permalink
Merge pull request #304 from TinyTank800/master
Browse files Browse the repository at this point in the history
Fix for %cp-material-slot% and legacy ids.
  • Loading branch information
rockyhawk64 authored Apr 6, 2024
2 parents 6138ef1 + 6c55817 commit 68591c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public String cpPlaceholders(Panel panel, PanelPosition position, Player p, Stri
material = p.getOpenInventory().getTopInventory().getItem((int)Double.parseDouble(matNumber)).getType().toString();
if (plugin.legacy.LOCAL_VERSION.lessThanOrEqualTo(MinecraftVersions.v1_12)) {
//add the ID to the end if it is legacy (eg, material:id)
material = material + ":" + p.getOpenInventory().getTopInventory().getItem((int)Double.parseDouble(matNumber)).getType().getId();
material = material + ":" + p.getOpenInventory().getTopInventory().getItem((int)Double.parseDouble(matNumber)).getData().getData();
}
} catch (NullPointerException er) {
material = "AIR";
Expand Down
14 changes: 11 additions & 3 deletions src/me/rockyhawk/commandpanels/openwithitem/UtilsOpenWithItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,18 @@ public void onBlockPlace(BlockPlaceEvent e)
}

Player p = e.getPlayer();
if(plugin.hotbar.itemCheckExecute(e.getPlayer().getInventory().getItemInMainHand(),p,false,false)){
e.setCancelled(true);
p.updateInventory();
if(Bukkit.getVersion().contains("1.8")){
if(plugin.hotbar.itemCheckExecute(e.getPlayer().getItemInHand(),p,false,false)){
e.setCancelled(true);
p.updateInventory();
}
}else{
if(plugin.hotbar.itemCheckExecute(e.getPlayer().getInventory().getItemInMainHand(),p,false,false)){
e.setCancelled(true);
p.updateInventory();
}
}

}
@EventHandler
public void onWorldChange(PlayerChangedWorldEvent e){
Expand Down

0 comments on commit 68591c7

Please sign in to comment.