use of org.bukkit.craftbukkit.v1_8_R3.inventory in project PublicCrafters by BananaPuncher714.
the class ContainerManager_v1_8_R3 method getLocation.
public Location getLocation(Inventory inventory) {
if (inventory == null) {
return null;
}
if (!(inventory instanceof CraftInventory)) {
return null;
}
try {
Field ic = CraftInventory.class.getDeclaredField("inventory");
ic.setAccessible(true);
Object crafting = ic.get(inventory);
if (crafting instanceof CustomInventoryCrafting) {
CustomInventoryCrafting table = (CustomInventoryCrafting) crafting;
return table.getLocation();
}
} catch (Exception exception) {
exception.printStackTrace();
}
return null;
}
use of org.bukkit.craftbukkit.v1_8_R3.inventory in project FireAPI by FireBlade-Serv.
the class EventsAT method onRightClick.
@EventHandler
public void onRightClick(PlayerInteractEvent e) {
final Player p = e.getPlayer();
final Action a = e.getAction();
FirePlayer fp = new FirePlayer(p, this.api);
ItemStack adminStick = new ItemStack(Material.STICK);
ItemMeta adminStickMeta = adminStick.getItemMeta();
adminStickMeta.setDisplayName(ChatColor.DARK_BLUE + "AdminStick");
adminStick.setItemMeta(adminStickMeta);
if (fp.hasRankAndSup(Rank.MODÉRATEUR)) {
if (a.equals(Action.RIGHT_CLICK_AIR) || a.equals(Action.RIGHT_CLICK_BLOCK)) {
if (p.getInventory().getItemInHand().equals(adminStick)) {
Inventory i1 = Bukkit.createInventory(null, 27, ChatColor.GOLD + "AdminTools");
i1.setItem(1, generateItem(Material.STONE_AXE, ChatColor.DARK_RED + "Gamemode Survie"));
i1.setItem(3, generateItem(Material.GRASS, ChatColor.DARK_GREEN + "Gamemode Créatif"));
i1.setItem(5, generateItem(Material.IRON_SWORD, ChatColor.GOLD + "Gamemode Aventure"));
i1.setItem(7, generateItem(Material.GLASS, ChatColor.GRAY + "Gamemode Spectateur"));
i1.setItem(9, adminToolsLogo("_goldocelot_"));
i1.setItem(13, generateItem(Material.PAPER, ChatColor.WHITE + "Ouvrir l'AdminList"));
i1.setItem(19, generatePotItem(PotionType.INVISIBILITY, ChatColor.WHITE + "Activer/Desactiver le vanish"));
i1.setItem(21, generatePotItem(PotionType.INSTANT_HEAL, ChatColor.LIGHT_PURPLE + "Se heal"));
i1.setItem(23, generateItem(Material.COOKED_BEEF, ChatColor.GREEN + "Se feed"));
i1.setItem(25, generatePotItem(PotionType.SPEED, ChatColor.BLUE + "Activer/Desactiver le fly speed"));
p.openInventory(i1);
}
}
}
}
use of org.bukkit.craftbukkit.v1_8_R3.inventory in project FireAPI by FireBlade-Serv.
the class EventsAT method createInventory.
public static void createInventory(Player p, int page) {
Inventory inv = Bukkit.createInventory(null, 54, ChatColor.WHITE + "AdminList");
for (int i = 0; i < 45; i++) {
Player target;
try {
target = pCo.get(0);
inv.setItem(i, generateSkull(target.getName()));
pCo.remove(target);
} catch (IndexOutOfBoundsException ex) {
break;
}
}
int pMod = pCo.size() % 45;
int pa = pCo.size() / 45;
if (pMod != 0) {
pa++;
}
if (pa == 0 && page == 1) {
inv.setItem(46, generateItem(Material.HOPPER, ChatColor.DARK_GREEN + "Rechercher"));
inv.setItem(49, adminToolsLogo("Glowstoner"));
p.openInventory(inv);
} else if (page == 1) {
inv.setItem(53, generateItem(Material.PAPER, ChatColor.AQUA + "Suivant"));
inv.setItem(46, generateItem(Material.HOPPER, ChatColor.DARK_GREEN + "Rechercher"));
inv.setItem(49, adminToolsLogo("Glowstoner"));
p.openInventory(inv);
} else if (page == pa) {
inv.setItem(45, generateItem(Material.PAPER, ChatColor.AQUA + "Précédent"));
inv.setItem(46, generateItem(Material.HOPPER, ChatColor.DARK_GREEN + "Rechercher"));
inv.setItem(49, adminToolsLogo("Glowstoner"));
p.openInventory(inv);
} else {
inv.setItem(53, generateItem(Material.PAPER, ChatColor.AQUA + "Suivant"));
inv.setItem(46, generateItem(Material.HOPPER, ChatColor.DARK_GREEN + "Rechercher"));
inv.setItem(49, adminToolsLogo("Glowstoner"));
inv.setItem(45, generateItem(Material.PAPER, ChatColor.AQUA + "Précédent"));
p.openInventory(inv);
}
}
use of org.bukkit.craftbukkit.v1_8_R3.inventory in project Atlas by funkemunky.
the class BlockBox1_8_R3 method getCollisionBox.
@Override
public CollisionBox getCollisionBox(Block block) {
final net.minecraft.server.v1_8_R3.World world = ((org.bukkit.craftbukkit.v1_8_R3.CraftWorld) block.getWorld()).getHandle();
final int x = block.getX(), y = block.getY(), z = block.getZ();
final AxisAlignedBB collide = BlockBoxManager.cbox.copy().offset(x, y, z).toAxisAlignedBB();
List<AxisAlignedBB> boxes = new ArrayList<>();
net.minecraft.server.v1_8_R3.Block vblock = CraftMagicNumbers.getBlock(block);
net.minecraft.server.v1_8_R3.BlockPosition blockPos = new net.minecraft.server.v1_8_R3.BlockPosition(x, y, z);
vblock.a(world, blockPos, vblock.getBlockData(), collide, boxes, null);
if (boxes.size() == 0) {
AxisAlignedBB box = vblock.a(world, blockPos, vblock.getBlockData());
if (box != null) {
return new SimpleCollisionBox(box.a, box.b, box.c, box.d, box.e, box.f);
} else
return NoCollisionBox.INSTANCE;
} else if (boxes.size() == 1) {
AxisAlignedBB box = boxes.get(0);
return new SimpleCollisionBox(box.a, box.b, box.c, box.d, box.e, box.f);
} else {
ComplexCollisionBox complexBox = new ComplexCollisionBox();
for (AxisAlignedBB box : boxes) {
complexBox.add(new SimpleCollisionBox(box.a, box.b, box.c, box.d, box.e, box.f));
}
return complexBox;
}
}
use of org.bukkit.craftbukkit.v1_8_R3.inventory in project Denizen-For-Bukkit by DenizenScript.
the class ImprovedOfflinePlayer_v1_8_R3 method getEnderChest.
@Override
public Inventory getEnderChest() {
if (offlineEnderChests.containsKey(getUniqueId())) {
return offlineEnderChests.get(getUniqueId());
}
InventoryEnderChest endchest = new InventoryEnderChest();
endchest.a(((CompoundTag_v1_8_R3) this.compound).toNMSTag().getList("EnderItems", 10));
Inventory inv = new CraftInventory(endchest);
offlineEnderChests.put(getUniqueId(), inv);
return inv;
}
Aggregations