Search in sources :

Example 1 with CompassMeta

use of org.bukkit.inventory.meta.CompassMeta in project CompassTracker by hyperdefined.

the class GameManager method setHuntersLodestones.

/**
 * This will set all hunters in the game's lodestone. Only used for 1.16 and above.
 */
public void setHuntersLodestones() {
    for (Player player : gameHunters) {
        for (ItemStack item : player.getInventory().getContents()) {
            if (item != null) {
                if (item.getType() == Material.COMPASS) {
                    ItemMeta itemMeta = item.getItemMeta();
                    if (itemMeta.getDisplayName().equalsIgnoreCase("Tracking Compass")) {
                        CompassMeta compassMeta = (CompassMeta) itemMeta;
                        compassMeta.setLodestoneTracked(false);
                        compassMeta.setLodestone(getSpeedrunnerLocation(player.getWorld()));
                        item.setItemMeta(compassMeta);
                    }
                }
            }
        }
    }
}
Also used : Player(org.bukkit.entity.Player) CompassMeta(org.bukkit.inventory.meta.CompassMeta) ItemStack(org.bukkit.inventory.ItemStack) ItemMeta(org.bukkit.inventory.meta.ItemMeta)

Example 2 with CompassMeta

use of org.bukkit.inventory.meta.CompassMeta in project Denizen-For-Bukkit by DenizenScript.

the class ItemLodestoneLocation method adjust.

@Override
public void adjust(Mechanism mechanism) {
    // -->
    if (mechanism.matches("lodestone_location")) {
        CompassMeta meta = (CompassMeta) item.getItemMeta();
        if (mechanism.hasValue() && mechanism.requireObject(LocationTag.class)) {
            meta.setLodestone(mechanism.valueAsType(LocationTag.class).clone());
        } else {
            meta.setLodestone(null);
        }
        item.setItemMeta(meta);
    }
}
Also used : LocationTag(com.denizenscript.denizen.objects.LocationTag) CompassMeta(org.bukkit.inventory.meta.CompassMeta)

Example 3 with CompassMeta

use of org.bukkit.inventory.meta.CompassMeta in project MagicPlugin by elBukkit.

the class CompatibilityUtils method setCompassTarget.

@Override
public boolean setCompassTarget(ItemMeta meta, Location targetLocation, boolean trackLocation) {
    if (meta == null || !(meta instanceof CompassMeta)) {
        return false;
    }
    CompassMeta compassMeta = (CompassMeta) meta;
    compassMeta.setLodestoneTracked(trackLocation);
    compassMeta.setLodestone(targetLocation);
    return true;
}
Also used : CompassMeta(org.bukkit.inventory.meta.CompassMeta)

Example 4 with CompassMeta

use of org.bukkit.inventory.meta.CompassMeta in project MagicPlugin by elBukkit.

the class CompatibilityUtils method setCompassTarget.

@Override
public boolean setCompassTarget(ItemMeta meta, Location targetLocation, boolean trackLocation) {
    if (meta == null || !(meta instanceof CompassMeta)) {
        return false;
    }
    CompassMeta compassMeta = (CompassMeta) meta;
    compassMeta.setLodestoneTracked(trackLocation);
    compassMeta.setLodestone(targetLocation);
    return true;
}
Also used : CompassMeta(org.bukkit.inventory.meta.CompassMeta)

Example 5 with CompassMeta

use of org.bukkit.inventory.meta.CompassMeta in project MagicPlugin by elBukkit.

the class CompatibilityUtils method setCompassTarget.

@Override
public boolean setCompassTarget(ItemMeta meta, Location targetLocation, boolean trackLocation) {
    if (meta == null || !(meta instanceof CompassMeta)) {
        return false;
    }
    CompassMeta compassMeta = (CompassMeta) meta;
    compassMeta.setLodestoneTracked(trackLocation);
    compassMeta.setLodestone(targetLocation);
    return true;
}
Also used : CompassMeta(org.bukkit.inventory.meta.CompassMeta)

Aggregations

CompassMeta (org.bukkit.inventory.meta.CompassMeta)15 ItemStack (org.bukkit.inventory.ItemStack)3 LocationTag (com.denizenscript.denizen.objects.LocationTag)2 Location (org.bukkit.Location)2 Player (org.bukkit.entity.Player)2 ItemMeta (org.bukkit.inventory.meta.ItemMeta)2 XMaterial (com.loohp.interactivechat.libs.com.cryptomorin.xseries.XMaterial)1 JSONObject (com.loohp.interactivechat.libs.org.json.simple.JSONObject)1 JSONParser (com.loohp.interactivechat.libs.org.json.simple.parser.JSONParser)1 ParseException (com.loohp.interactivechat.libs.org.json.simple.parser.ParseException)1 ICPlayer (com.loohp.interactivechat.objectholders.ICPlayer)1 OfflineICPlayer (com.loohp.interactivechat.objectholders.OfflineICPlayer)1 BannerAssetResult (com.loohp.interactivechatdiscordsrvaddon.graphics.BannerGraphics.BannerAssetResult)1 ModelOverrideType (com.loohp.interactivechatdiscordsrvaddon.resources.models.ModelOverride.ModelOverrideType)1 GeneratedTextureResource (com.loohp.interactivechatdiscordsrvaddon.resources.textures.GeneratedTextureResource)1 TextureResource (com.loohp.interactivechatdiscordsrvaddon.resources.textures.TextureResource)1 SpawnEggTintData (com.loohp.interactivechatdiscordsrvaddon.utils.TintUtils.SpawnEggTintData)1 TintIndexData (com.loohp.interactivechatdiscordsrvaddon.utils.TintUtils.TintIndexData)1 FlaggableRecipeChoice (haveric.recipeManager.recipes.FlaggableRecipeChoice)1 ItemResult (haveric.recipeManager.recipes.ItemResult)1