Java Code Examples for org.bukkit.Material#GHAST_TEAR

The following examples show how to use org.bukkit.Material#GHAST_TEAR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GunGizmo.java    From ProjectAres with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void run() {
    for(Item item : Bukkit.getWorlds().get(0).getEntitiesByClass(Item.class)) {
        if(item.getItemStack().getType() != Material.GHAST_TEAR) continue;
        UUID skip = Gizmos.gunGizmo.items.get(item);

        for(Entity entity : item.getNearbyEntities(0.5d, 0.5d, 0.5d)) {
            if(entity instanceof Player && !entity.getUniqueId().equals(skip)) {
                Player player = (Player) entity;
                if(player.hasPermission("gizmo.immunity")) continue;
                player.damage(0d, item);
                Gizmos.gunGizmo.gifts.add(player.getUniqueId());
                item.remove();
                break;
            }
        }

        if(item.getTicksLived() >= 6000) item.remove();
    }
}
 
Example 2
Source File: UHPluginListener.java    From KTP with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler
public void onEntityDeath(EntityDeathEvent ev) {
	if (ev.getEntity() instanceof Ghast) {
		Bukkit.getLogger().info("Modifying drops for Ghast");
		List<ItemStack> drops = new ArrayList<ItemStack>(ev.getDrops());
		ev.getDrops().clear();
		for (ItemStack i : drops) {
			if (i.getType() == Material.GHAST_TEAR) {
				Bukkit.getLogger().info("Added "+i.getAmount()+" ghast tear(s)");
				ev.getDrops().add(new ItemStack(Material.GOLD_INGOT,i.getAmount()));
			} else {
				Bukkit.getLogger().info("Added "+i.getAmount()+" "+i.getType().toString());
				ev.getDrops().add(i);
			}
		}
	}
}
 
Example 3
Source File: Gizmos.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST)
public void openMenu(final PlayerInteractEvent event) {
    if(event.getAction() == Action.PHYSICAL) return;

    Player player = event.getPlayer();
    if(player.getItemInHand().getType() == Material.GHAST_TEAR) {
        GizmoUtils.openMenu(event.getPlayer());
        purchasingMap.put(event.getPlayer(), null);
    }
}
 
Example 4
Source File: Utils.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
public static ItemStack getGhastTear(Player player, int count) {
    ItemStack raindrops = new ItemStack(Material.GHAST_TEAR);
    ItemMeta meta = raindrops.getItemMeta();
    meta.setDisplayName(ChatColor.AQUA + "Raindrops" + ChatColor.DARK_PURPLE + " | " + ChatColor.WHITE + String.format("%,d", count));
    raindrops.setItemMeta(meta);

    return raindrops;
}
 
Example 5
Source File: GhastTearDropsModule.java    From UHC with MIT License 5 votes vote down vote up
@EventHandler
public void on(EntityDeathEvent event) {
    if (isEnabled() || event.getEntity().getType() != EntityType.GHAST) return;

    for (final ItemStack drop : event.getDrops()) {
        if (drop.getType() == Material.GHAST_TEAR) {
            drop.setType(Material.GOLD_INGOT);
        }
    }
}
 
Example 6
Source File: GhastEvent.java    From SkyWarsReloaded with GNU General Public License v3.0 5 votes vote down vote up
public GhastEvent(GameMap map, boolean b) {
	this.gMap = map;
	this.enabled = b;
	File dataDirectory = SkyWarsReloaded.get().getDataFolder();
       File mapDataDirectory = new File(dataDirectory, "mapsData");

       if (!mapDataDirectory.exists() && !mapDataDirectory.mkdirs()) {
       	return;
       }
       
       File mapFile = new File(mapDataDirectory, gMap.getName() + ".yml");
    if (mapFile.exists()) {
    	eventName = "GhastEvent";
    	slot = 17;
   		material = new ItemStack(Material.GHAST_TEAR, 1);
        FileConfiguration fc = YamlConfiguration.loadConfiguration(mapFile);
        this.min = fc.getInt("events." + eventName + ".minStart");
        this.max = fc.getInt("events." + eventName + ".maxStart");
        this.length = fc.getInt("events." + eventName + ".length");
        this.chance = fc.getInt("events." + eventName + ".chance");
        this.title = fc.getString("events." + eventName + ".title");
        this.subtitle = fc.getString("events." + eventName + ".subtitle");
        this.startMessage = fc.getString("events." + eventName + ".startMessage");
        this.endMessage = fc.getString("events." + eventName + ".endMessage");
        this.announceEvent = fc.getBoolean("events." + eventName + ".announceTimer");
        this.repeatable = fc.getBoolean("events." + eventName + ".repeatable");
    }
}
 
Example 7
Source File: UHPluginListener.java    From KTP with GNU General Public License v3.0 4 votes vote down vote up
@EventHandler
public void onPlayerPickupItem(PlayerPickupItemEvent ev) {
	if (ev.getItem().getItemStack().getType() == Material.GHAST_TEAR && ev.getPlayer().getGameMode().equals(GameMode.SURVIVAL)) ev.setCancelled(true);
	p.updatePlayerListName(ev.getPlayer());
}