From b4f8ab5816916762de2f552d3db1e932d34e6ba4 Mon Sep 17 00:00:00 2001 From: filoghost Date: Sat, 10 Apr 2021 14:14:16 +0200 Subject: [PATCH] Updated Power Ups (markdown) --- Power Ups.md => Power-Ups.md | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) rename Power Ups.md => Power-Ups.md (53%) diff --git a/Power Ups.md b/Power-Ups.md similarity index 53% rename from Power Ups.md rename to Power-Ups.md index 1bd6eab..f9fd970 100644 --- a/Power Ups.md +++ b/Power-Ups.md @@ -1,6 +1,6 @@ ![](http://i.imgur.com/tDR0TcA.jpg) -Also check [this example plugin](https://github.com/filoghost/HolographicDisplays/blob/master/Example_PowerUps/src/com/gmail/filoghost/test/PowerUps.java) to learn how to create power ups. +Also check [this example plugin](https://github.com/filoghost/HolographicDisplays/blob/master/Example/PowerUps/src/main/java/com/gmail/filoghost/example/powerups/PowerUps.java) to learn how to create power ups. A power up is very simple, is made of a hologram with two lines. You can assign a PickupHandler to the floating item, that is triggered when a player picks it up. @@ -17,23 +17,19 @@ final Hologram hologram = HologramsAPI.createHologram(this, where.add(0.0, 0.6, hologram.appendTextLine(text); ItemLine itemLine = hologram.appendItemLine(icon); -itemLine.setPickupHandler(new PickupHandler() { +itemLine.setPickupHandler((Player player) -> { + + // Play a sound + player.playSound(player.getLocation(), Sound.LEVEL_UP, 1F, 2F); - @Override - public void onPickup(Player player) { - - // Play a sound - player.playSound(player.getLocation(), Sound.LEVEL_UP, 1F, 2F); - - // Play an effect - player.playEffect(floatingItem.getLocation(), Effect.MOBSPAWNER_FLAMES, null); - - // 1 minute of fire resistance - player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 60 * 20, 0)); - - // Delete the hologram - hologram.delete(); - - } + // Play an effect + player.playEffect(hologram.getLocation(), Effect.MOBSPAWNER_FLAMES, null); + + // 1 minute of fire resistance + player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 60 * 20, 0)); + + // Delete the hologram + hologram.delete(); + }); ``` \ No newline at end of file