Merge pull request #304 from TinyTank800/master

Fix for %cp-material-slot% and legacy ids.
This commit is contained in:
RockyHawk 2024-04-06 15:52:06 +11:00 committed by GitHub
commit 68591c7a11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 4 deletions

View File

@ -191,7 +191,7 @@ public class Placeholders {
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";

View File

@ -77,10 +77,18 @@ public class UtilsOpenWithItem implements Listener {
}
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){