Merge pull request 'Add Itemstack in SWInventory' (#91) from itemstack_in_swinv into master
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
a212883351
@ -28,11 +28,9 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class SWInventory implements Listener {
|
||||
|
||||
@ -55,9 +53,13 @@ public class SWInventory implements Listener {
|
||||
callbacks.put(-1, c);
|
||||
}
|
||||
|
||||
public void setItem(int pos, ItemStack itemStack, InvCallback c){
|
||||
inventory.setItem(pos, itemStack);
|
||||
callbacks.put(pos, c);
|
||||
}
|
||||
|
||||
public void setItem(int pos, SWItem item){
|
||||
inventory.setItem(pos, item.getItemStack());
|
||||
callbacks.put(pos, item.getCallback());
|
||||
setItem(pos, item.getItemStack(), item.getCallback());
|
||||
}
|
||||
|
||||
public void setItem(int pos, Material m, String name, InvCallback c){
|
||||
@ -91,9 +93,10 @@ public class SWInventory implements Listener {
|
||||
if(!player.equals(e.getWhoClicked()))
|
||||
return;
|
||||
|
||||
e.setCancelled(true);
|
||||
if(callbacks.containsKey(e.getRawSlot()) && callbacks.get(e.getRawSlot()) != null)
|
||||
if(callbacks.containsKey(e.getRawSlot()) && callbacks.get(e.getRawSlot()) != null) {
|
||||
e.setCancelled(true);
|
||||
callbacks.get(e.getRawSlot()).clicked(e.getClick());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren