Skip to content

Instantly share code, notes, and snippets.

@mooman219
Created June 23, 2013 23:23
Show Gist options
  • Save mooman219/5846908 to your computer and use it in GitHub Desktop.
Save mooman219/5846908 to your computer and use it in GitHub Desktop.
public void a(Packet102WindowClick packet102windowclick) {
...
// TODO check on updates
Container oldContainer = player.activeContainer; // Cow
if (packet102windowclick.shift != 5) {
if (click == ClickType.NUMBER_KEY) {
event = new InventoryClickEvent(inventory, type, packet102windowclick.slot, click, action, packet102windowclick.button);
} else {
event = new InventoryClickEvent(inventory, type, packet102windowclick.slot, click, action);
}
org.bukkit.inventory.Inventory top = inventory.getTopInventory();
if (packet102windowclick.slot == 0 && top instanceof CraftingInventory) {
org.bukkit.inventory.Recipe recipe = ((CraftingInventory) top).getRecipe();
if (recipe != null) {
if (click == ClickType.NUMBER_KEY) {
event = new CraftItemEvent(recipe, inventory, type, packet102windowclick.slot, click, action, packet102windowclick.button);
} else {
event = new CraftItemEvent(recipe, inventory, type, packet102windowclick.slot, click, action);
}
}
}
server.getPluginManager().callEvent(event);
// Cow
if(!oldContainer.equals(this.player.activeContainer)) {
event.setResult(Result.DENY);
}
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment