use of com.plotsquared.bukkit.player.BukkitPlayer in project PlotSquared by IntellectualSites.
the class BukkitInventoryUtil method setItemChecked.
@Override
public boolean setItemChecked(PlotInventory inv, int index, PlotItemStack item) {
BukkitPlayer bp = (BukkitPlayer) inv.getPlayer();
InventoryView opened = bp.player.getOpenInventory();
ItemStack stack = getItem(item);
if (stack == null) {
return false;
}
if (!inv.isOpen()) {
return true;
}
opened.setItem(index, stack);
bp.player.updateInventory();
return true;
}
use of com.plotsquared.bukkit.player.BukkitPlayer in project PlotSquared by IntellectualSites.
the class BukkitInventoryUtil method isOpen.
// #getTitle is needed for Spigot compatibility
@SuppressWarnings("deprecation")
@Override
public boolean isOpen(PlotInventory plotInventory) {
if (!plotInventory.isOpen()) {
return false;
}
BukkitPlayer bp = (BukkitPlayer) plotInventory.getPlayer();
InventoryView opened = bp.player.getOpenInventory();
if (plotInventory.isOpen()) {
if (opened.getType() == InventoryType.CRAFTING) {
opened.getTitle();
}
}
return false;
}
use of com.plotsquared.bukkit.player.BukkitPlayer in project PlotSquared by IntellectualSites.
the class PlaceholderFormatter method format.
@Override
public void format(@NonNull final ChatContext context) {
final PlotPlayer<?> recipient = context.getRecipient();
if (recipient instanceof BukkitPlayer) {
if (context.isRawOutput()) {
context.setMessage(context.getMessage().replace('%', '\u2010'));
} else {
final Player player = ((BukkitPlayer) recipient).player;
context.setMessage(PlaceholderAPI.setPlaceholders(player, context.getMessage()));
}
}
}
use of com.plotsquared.bukkit.player.BukkitPlayer in project PlotSquared by IntellectualSites.
the class BukkitInventoryUtil method getItems.
@Override
public PlotItemStack[] getItems(PlotPlayer<?> player) {
BukkitPlayer bp = (BukkitPlayer) player;
PlayerInventory inv = bp.player.getInventory();
return IntStream.range(0, 36).mapToObj(i -> getItem(inv.getItem(i))).toArray(PlotItemStack[]::new);
}
use of com.plotsquared.bukkit.player.BukkitPlayer in project PlotSquared by IntellectualSites.
the class BukkitInventoryUtil method close.
@Override
public void close(PlotInventory inv) {
if (!inv.isOpen()) {
return;
}
BukkitPlayer bp = (BukkitPlayer) inv.getPlayer();
bp.player.closeInventory();
}
Aggregations