本文整理汇总了Java中org.bukkit.block.DoubleChest.getRightSide方法的典型用法代码示例。如果您正苦于以下问题:Java DoubleChest.getRightSide方法的具体用法?Java DoubleChest.getRightSide怎么用?Java DoubleChest.getRightSide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.block.DoubleChest
的用法示例。
在下文中一共展示了DoubleChest.getRightSide方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeShop
import org.bukkit.block.DoubleChest; //导入方法依赖的package包/类
/** Remove a shop
* @param shop Shop to remove
* @param removeFromDatabase Whether the shop should also be removed from the database
* @param callback Callback that - if succeeded - returns null
*/
public void removeShop(Shop shop, boolean removeFromDatabase, Callback<Void> callback) {
plugin.debug("Removing shop (#" + shop.getID() + ")");
InventoryHolder ih = shop.getInventoryHolder();
if (ih instanceof DoubleChest) {
DoubleChest dc = (DoubleChest) ih;
Chest r = (Chest) dc.getRightSide();
Chest l = (Chest) dc.getLeftSide();
shopLocation.remove(r.getLocation());
shopLocation.remove(l.getLocation());
} else {
shopLocation.remove(shop.getLocation());
}
shop.removeItem();
shop.removeHologram();
if (removeFromDatabase) {
plugin.getShopDatabase().removeShop(shop, callback);
} else {
if (callback != null) callback.callSyncResult(null);
}
}
示例2: remove
import org.bukkit.block.DoubleChest; //导入方法依赖的package包/类
private void remove(final Shop shop, final Block b, final Player p) {
if (shop.getInventoryHolder() instanceof DoubleChest) {
DoubleChest dc = (DoubleChest) shop.getInventoryHolder();
final Chest l = (Chest) dc.getLeftSide();
final Chest r = (Chest) dc.getRightSide();
Location loc = (b.getLocation().equals(l.getLocation()) ? r.getLocation() : l.getLocation());
final Shop newShop = new Shop(shop.getID(), plugin, shop.getVendor(), shop.getProduct(), loc, shop.getBuyPrice(), shop.getSellPrice(), shop.getShopType());
shopUtils.removeShop(shop, true, new Callback<Void>(plugin) {
@Override
public void onResult(Void result) {
newShop.create(true);
shopUtils.addShop(newShop, true);
}
});
} else {
shopUtils.removeShop(shop, true);
plugin.debug(String.format("%s broke %s's shop (#%d)", p.getName(), shop.getVendor().getName(), shop.getID()));
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_REMOVED));
}
}
示例3: onItemMove
import org.bukkit.block.DoubleChest; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onItemMove(InventoryMoveItemEvent e) {
if (config.hopper_protection) {
if ((e.getSource().getType().equals(InventoryType.CHEST)) && (!e.getInitiator().getType().equals(InventoryType.PLAYER))) {
if (e.getSource().getHolder() instanceof DoubleChest) {
DoubleChest dc = (DoubleChest) e.getSource().getHolder();
Chest r = (Chest) dc.getRightSide();
Chest l = (Chest) dc.getLeftSide();
if (shopUtils.isShop(r.getLocation()) || shopUtils.isShop(l.getLocation())) e.setCancelled(true);
} else if (e.getSource().getHolder() instanceof Chest) {
Chest c = (Chest) e.getSource().getHolder();
if (shopUtils.isShop(c.getLocation())) e.setCancelled(true);
}
}
}
}
示例4: addShop
import org.bukkit.block.DoubleChest; //导入方法依赖的package包/类
/**
* Add a shop
* @param shop Shop to add
* @param addToDatabase Whether the shop should also be added to the database
* @param callback Callback that - if succeeded - returns the ID the shop had or was given (as {@code int})
*/
public void addShop(Shop shop, boolean addToDatabase, Callback<Integer> callback) {
InventoryHolder ih = shop.getInventoryHolder();
plugin.debug("Adding shop... (#" + shop.getID() + ")");
if (ih instanceof DoubleChest) {
DoubleChest dc = (DoubleChest) ih;
Chest r = (Chest) dc.getRightSide();
Chest l = (Chest) dc.getLeftSide();
plugin.debug("Added shop as double chest. (#" + shop.getID() + ")");
shopLocation.put(r.getLocation(), shop);
shopLocation.put(l.getLocation(), shop);
} else {
plugin.debug("Added shop as single chest. (#" + shop.getID() + ")");
shopLocation.put(shop.getLocation(), shop);
}
if (addToDatabase) {
plugin.getShopDatabase().addShop(shop, callback);
} else {
if (callback != null) callback.callSyncResult(shop.getID());
}
}
示例5: createHologram
import org.bukkit.block.DoubleChest; //导入方法依赖的package包/类
/**
* Creates the hologram of the shop
*/
private void createHologram() {
plugin.debug("Creating hologram (#" + id + ")");
InventoryHolder ih = getInventoryHolder();
if (ih == null) return;
Chest[] chests = new Chest[2];
boolean doubleChest;
if (ih instanceof DoubleChest) {
DoubleChest dc = (DoubleChest) ih;
Chest r = (Chest) dc.getRightSide();
Chest l = (Chest) dc.getLeftSide();
chests[0] = r;
chests[1] = l;
doubleChest = true;
} else {
chests[0] = (Chest) ih;
doubleChest = false;
}
String[] holoText = getHologramText();
Location holoLocation = getHologramLocation(doubleChest, chests);
hologram = new Hologram(plugin, holoText, holoLocation);
}