本文整理匯總了Java中org.bukkit.block.Sign.getLocation方法的典型用法代碼示例。如果您正苦於以下問題:Java Sign.getLocation方法的具體用法?Java Sign.getLocation怎麽用?Java Sign.getLocation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.block.Sign
的用法示例。
在下文中一共展示了Sign.getLocation方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onSelect
import org.bukkit.block.Sign; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onSelect(PlayerInteractEvent event) {
if (event.getClickedBlock().getState() instanceof Sign && event.getPlayer().equals(player) &&
event.getAction() == Action.RIGHT_CLICK_BLOCK) {
Optional<SignRegistry> opRegistry = backend.getSignRegistry(gameName);
if (opRegistry.isPresent()) {
Sign sign = (Sign) event.getClickedBlock().getState();
GameLocation location = new GameLocation(sign.getLocation(), true);
opRegistry.get().put(location.toString(), new MutableMinigameSign(name, gameName,
location, command,
Arrays.asList(sign.getLines())));
event.getPlayer().sendMessage(ChatColor.YELLOW + "Sign " + name + " has been created!");
} else {
event.getPlayer().sendMessage(ChatColor.RED +
"There was an error getting the sign registry for this game.");
}
HandlerList.unregisterAll(this);
}
}
示例2: SignHandle
import org.bukkit.block.Sign; //導入方法依賴的package包/類
public SignHandle(Sign sign, Navigator.Connector connector) {
this.location = sign.getLocation();
this.material = sign.getMaterialData();
this.connector = connector;
hoverEntities = CacheUtils.newCache(
description -> new NMSHacks.FakeArmorStand(this.location.getWorld(), description.toLegacyText())
);
connector.startObserving(observer);
paint();
logger.fine("Created " + this);
}
示例3: isJoinSign
import org.bukkit.block.Sign; //導入方法依賴的package包/類
/**
* Checks whether the given Sign is properly configured to be an JoinSign or
* not.
*
* @param sign
* The Sign for which the check should be done.
* @return True if the signs.yml contains a correct value for the given Sign
* instance.
*/
public static boolean isJoinSign(Sign sign) {
FileConfiguration fileConfiguration = SignConfiguration.getSignConfiguration();
Location signPosition = sign.getLocation();
Set<String> signs = ConfigFactory.getKeysUnderPath("signs", false, fileConfiguration);
if (signs != null) {
for (String signString : signs) {
String path = "signs." + signString;
String game = ConfigFactory.getString(path, "game", fileConfiguration);
for (String gameName : GetGames.getGameNames(PluginLoader.getInstance().getConfig())) {
if (game.trim().equalsIgnoreCase(gameName.trim())) {
int x = ConfigFactory.getInt(path, "x", fileConfiguration);
int y = ConfigFactory.getInt(path, "y", fileConfiguration);
int z = ConfigFactory.getInt(path, "z", fileConfiguration);
String world = ConfigFactory.getString(path, "world", fileConfiguration);
Location signLocation = new Location(Bukkit.getWorld(world), x, y, z);
if (signPosition.getBlockX() == x && signPosition.getBlockY() == y
&& signPosition.getBlockZ() == z) {
if (signLocation.getBlock().getState() instanceof Sign) {
return true;
}
}
}
}
}
}
return false;
}
示例4: buySkull
import org.bukkit.block.Sign; //導入方法依賴的package包/類
public static void buySkull(BPPlayer bpPlayer, Sign sign, String[] lines)
{
Player player = bpPlayer.getPlayer();
String typeName = ChatColor.stripColor(lines[3]);
SkullType skullType = SkullType.parse(typeName);
boolean vip = skullType == null || skullType.isVip();
if(!vip || player.hasPermission("Breakpoint.vip"))
{
Location bLoc = sign.getLocation();
String nameColored = lines[3];
int cost = SkullType.getCost(skullType);
int exHours = 1;
if(bLoc.equals(bpPlayer.getShopItemLocation()))
{
int money = bpPlayer.getMoney();
if (money >= cost)
{
bpPlayer.addMoney(-cost, false, false);
BPSkull bpSkull = new BPSkull(skullType != null ? skullType.name() : typeName, exHours * 60);
InventoryMenuManager.saveLobbyMenu(bpPlayer);
processBoughtItem(bpPlayer, bpSkull, player.hasPermission("Breakpoint.vip"));
InventoryMenuManager.showLobbyMenu(bpPlayer);
bpPlayer.getStatistics().increaseBought();
Achievement.checkBought(bpPlayer);
player.sendMessage(MessageType.SHOP_PURCHASE_ARMOR_SUCCESS.getTranslation().getValue(nameColored, cost));
}
else
player.sendMessage(MessageType.SHOP_PURCHASE_NOTENOUGHEMERALDS.getTranslation().getValue());
bpPlayer.setShopItemLocation(null);
}
else
{
if(!bpPlayer.hasSpaceInLobbyInventory())
{
player.sendMessage(MessageType.SHOP_PURCHASE_NOINVENTORYSPACE.getTranslation().getValue());
return;
}
bpPlayer.setShopItemLocation(bLoc);
player.sendMessage(MessageType.SHOP_PURCHASE_ARMOR_QUESTION.getTranslation().getValue(lines[3], cost, exHours));
}
}
else
player.sendMessage(MessageType.SHOP_PURCHASE_VIPSONLY.getTranslation().getValue());
}