generated from devcordde/PluginJamGradle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3757d83
commit 437eea2
Showing
11 changed files
with
200 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package club.devcord.gamejam; | ||
|
||
import net.kyori.adventure.key.Key; | ||
import net.kyori.adventure.sound.Sound; | ||
import net.kyori.adventure.text.Component; | ||
import net.kyori.adventure.text.format.NamedTextColor; | ||
import org.bukkit.Location; | ||
import org.bukkit.Material; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.player.PlayerInteractEvent; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.bukkit.inventory.meta.ItemMeta; | ||
|
||
public class SantasBellRinger implements Listener { | ||
|
||
public static final ItemStack THE_BELL; | ||
|
||
static { | ||
THE_BELL = new ItemStack(Material.IRON_SWORD); | ||
ItemMeta itemMeta = THE_BELL.getItemMeta(); | ||
itemMeta.setCustomModelData(17); | ||
itemMeta.displayName(Component.text("Santa's Bell").color(NamedTextColor.DARK_GREEN)); | ||
THE_BELL.setItemMeta(itemMeta); | ||
} | ||
|
||
@EventHandler | ||
public void ringRingSantaRingRing(PlayerInteractEvent event) { | ||
if (event.getPlayer().getInventory().getItemInMainHand().isSimilar(THE_BELL)) { | ||
Sound sound = Sound.sound(Key.key("minecraft:item.santabell"), Sound.Source.MASTER, 1, 1); | ||
Location loc = event.getPlayer().getLocation(); | ||
event.getPlayer().getWorld().playSound(sound, loc.x(), loc.y(), loc.z()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/club/devcord/gamejam/level/eyes/EndListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package club.devcord.gamejam.level.eyes; | ||
|
||
import club.devcord.gamejam.Team; | ||
import club.devcord.gamejam.level.LevelPipeline; | ||
import club.devcord.gamejam.level.thejump.TheJumpLevel; | ||
import net.kyori.adventure.text.minimessage.MiniMessage; | ||
import org.bukkit.Material; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.player.PlayerInteractEvent; | ||
import org.bukkit.inventory.ItemStack; | ||
|
||
public class EndListener implements Listener { | ||
|
||
private final Team team; | ||
private final LevelPipeline levelPipeline; | ||
|
||
public EndListener(Team team, LevelPipeline levelPipeline) { | ||
this.team = team; | ||
this.levelPipeline = levelPipeline; | ||
} | ||
|
||
@EventHandler | ||
public void onEnderEyePlace(PlayerInteractEvent event) { | ||
if (!team.players().contains(event.getPlayer())) return; | ||
|
||
if (event.getMaterial() == Material.ENDER_EYE && event.getClickedBlock() != null && event.getClickedBlock().getType() == Material.END_PORTAL_FRAME) { | ||
var thropy = new ItemStack(Material.DIAMOND_HOE); | ||
var meta = thropy.getItemMeta(); | ||
meta.displayName(MiniMessage.miniMessage().deserialize("<rainbow>You are a Bug survivor")); | ||
meta.setCustomModelData(85); | ||
thropy.setItemMeta(meta); | ||
team.players().forEach(player -> { | ||
player.getInventory().addItem(thropy); | ||
player.getInventory().remove(TheJumpLevel.THE_EYE); | ||
}); | ||
|
||
levelPipeline.next(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.