Skip to content

Commit

Permalink
error fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dueris committed May 24, 2024
1 parent d8a3142 commit 9a445f4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ public void registerConditions() {
if (entity instanceof CraftPlayer player) {
ServerPlayer p = player.getHandle();
ServerPlayerGameMode interactionManager = p.gameMode;
boolean isMining = Boolean.TRUE.equals(Reflector.accessField("isDestroyingBlock", ServerPlayerGameMode.class, interactionManager, boolean.class));
boolean isMining = Boolean.TRUE.equals(Reflector.accessField("isDestroyingBlock", ServerPlayerGameMode.class, interactionManager, Boolean.class));
if (!isMining) {
return false;
}
Expand Down
20 changes: 12 additions & 8 deletions origins/src/main/java/me/dueris/genesismc/util/KeybindUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,19 @@ public void drop(PlayerDropItemEvent e) {
public void onTransfer(InventoryClickEvent e) {
if (e.getClick().isKeyboardClick()) {
if (e.getView().getTopInventory().getType() == InventoryType.CRAFTING) return;
if (e.getView().getBottomInventory().getItem(e.getHotbarButton()) != null) {
ItemStack transferred = e.getView().getBottomInventory().getItem(e.getHotbarButton());
if (transferred == null) return;
if (transferred.isSimilar(getPrimaryTrigger((Player) e.getWhoClicked()))) {
e.setCancelled(true);
}
if (transferred.isSimilar(getSecondaryTrigger((Player) e.getWhoClicked()))) {
e.setCancelled(true);
try {
if (e.getView().getBottomInventory().getItem(e.getHotbarButton()) != null) {
ItemStack transferred = e.getView().getBottomInventory().getItem(e.getHotbarButton());
if (transferred == null) return;
if (transferred.isSimilar(getPrimaryTrigger((Player) e.getWhoClicked()))) {
e.setCancelled(true);
}
if (transferred.isSimilar(getSecondaryTrigger((Player) e.getWhoClicked()))) {
e.setCancelled(true);
}
}
} catch (Throwable t) {
// Silence
}

return;
Expand Down

0 comments on commit 9a445f4

Please sign in to comment.