This commit is contained in:
2025-08-04 23:10:57 -07:00
parent b24433805f
commit c78c3a755b
9 changed files with 46 additions and 46 deletions

View File

@@ -2,7 +2,7 @@ import org.sayandev.plugin.StickyNoteModules
plugins {
java
kotlin("jvm") version "2.2.0"
kotlin("jvm") version "2.1.21"
id("xyz.jpenilla.run-paper") version "2.3.1"
id("de.eldoria.plugin-yml.bukkit") version "0.7.1"
id("org.sayandev.stickynote.project")
@@ -28,7 +28,7 @@ repositories {
}
dependencies {
compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT")
compileOnly("io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT")
compileOnly("xyz.lncvrt:galaxyapi:1.0.6")
}
@@ -79,8 +79,7 @@ tasks {
expand(
"version" to project.version as String,
"slug" to slug,
"name" to rootProject.name,
"description" to project.description
"name" to rootProject.name
)
}
}

Binary file not shown.

2
gradlew vendored
View File

@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.

View File

@@ -12,8 +12,7 @@ import org.bukkit.potion.PotionEffect
import org.bukkit.potion.PotionEffectType
import org.sayandev.stickynote.loader.bukkit.StickyNoteBukkitLoader
import xyz.lncvrt.galaxyapi.utils.MessageFormat
import xyz.lncvrt.galaxylobby.command.DiscordCommand
import xyz.lncvrt.galaxylobby.command.WebsiteCommand
import xyz.lncvrt.galaxylobby.command.*
import xyz.lncvrt.galaxylobby.event.*
import java.util.*
@@ -32,7 +31,7 @@ class GalaxyLobbyPlugin : JavaPlugin() {
val pluginManager = server.pluginManager
pluginManager.registerEvents(InventoryClickListener(), this)
pluginManager.registerEvents(PlayerAdvancementCriterionGrantListener(), this)
pluginManager.registerEvents(PlayerGameModeChangeListener(this), this)
pluginManager.registerEvents(PlayerGameModeChangeListener(), this)
pluginManager.registerEvents(PlayerInteractListener(this), this)
pluginManager.registerEvents(PlayerItemDamageListener(), this)
pluginManager.registerEvents(PlayerItemHeldListener(), this)
@@ -40,7 +39,7 @@ class GalaxyLobbyPlugin : JavaPlugin() {
pluginManager.registerEvents(PlayerMoveListener(this), this)
pluginManager.registerEvents(PlayerSwapHandItemsListener(), this)
pluginManager.registerEvents(PlayerToggleFlightListener(), this)
pluginManager.registerEvents(ProjectileLaunchListener(), this)
pluginManager.registerEvents(PlayerElytraBoostListener(), this)
}
internal fun resetPlayer(player: Player, teleport: Boolean, setGamemode: Boolean) {
@@ -68,7 +67,7 @@ class GalaxyLobbyPlugin : JavaPlugin() {
fireworkItem.setItemMeta(fireworkMeta)
player.inventory.setItem(7, fireworkItem)
player.health = player.getAttribute(Attribute.GENERIC_MAX_HEALTH)?.value ?: 20.0
player.health = player.getAttribute(Attribute.MAX_HEALTH)?.value ?: 20.0
player.foodLevel = 20
player.saturation = 20f
player.clearActivePotionEffects()

View File

@@ -0,0 +1,33 @@
package xyz.lncvrt.galaxylobby.event
import com.destroystokyo.paper.event.player.PlayerElytraBoostEvent
import net.kyori.adventure.text.minimessage.MiniMessage
import org.bukkit.Material
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.inventory.ItemStack
import org.sayandev.stickynote.bukkit.plugin
import xyz.lncvrt.galaxyapi.utils.MessageFormat
class PlayerElytraBoostListener() : Listener {
@EventHandler
fun onPlayerElytraBoostEvent(event: PlayerElytraBoostEvent) {
plugin.server.scheduler.runTaskLater(plugin, Runnable {
val player = event.player
val fireworkItem = ItemStack(Material.FIREWORK_ROCKET)
val fireworkMeta = fireworkItem.itemMeta
fireworkMeta.displayName(
MiniMessage.miniMessage().deserialize(
MessageFormat.setPrimaryColor(
"<italic:false>Elytra ${
MessageFormat.setSecondaryColor("(Fly around the lobby!)")
}</italic>"
)
)
)
fireworkItem.setItemMeta(fireworkMeta)
player.inventory.setItem(7, fireworkItem)
player.setCooldown(fireworkItem.type, 20)
}, 1)
}
}

View File

@@ -4,9 +4,8 @@ import org.bukkit.GameMode
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerGameModeChangeEvent
import xyz.lncvrt.galaxylobby.GalaxyLobbyPlugin
class PlayerGameModeChangeListener(val plugin: GalaxyLobbyPlugin) : Listener {
class PlayerGameModeChangeListener() : Listener {
@EventHandler
fun onPlayerGameModeChangeEvent(event: PlayerGameModeChangeEvent) {
val player = event.getPlayer()

View File

@@ -13,7 +13,7 @@ import xyz.lncvrt.galaxylobby.GalaxyLobbyPlugin
class PlayerInteractListener(val plugin: GalaxyLobbyPlugin) : Listener {
@EventHandler
fun onPlayerInteractEvent(event: PlayerInteractEvent) {
if (event.getAction() !== Action.RIGHT_CLICK_AIR && event.getAction() !== Action.RIGHT_CLICK_BLOCK) {
if (event.action !== Action.RIGHT_CLICK_AIR && event.action !== Action.RIGHT_CLICK_BLOCK) {
return
}
@@ -32,6 +32,6 @@ class PlayerInteractListener(val plugin: GalaxyLobbyPlugin) : Listener {
"[Server Selector (Right Click)]" -> CommandHelper().executeAsConsole("dmenu open serverselector ${player.name}")
}
playerCooldowns.put(name, currentTime)
playerCooldowns[name] = currentTime
}
}

View File

@@ -31,8 +31,7 @@ class PlayerMoveListener(val plugin: GalaxyLobbyPlugin) : Listener {
@EventHandler
fun onPlayerMoveLaunchPad(event: PlayerMoveEvent) {
val player = event.getPlayer()
val world: World? = plugin.server.getWorld("world")
if (world == null) return
val world: World = plugin.server.getWorld("world") ?: return
val playerBlock = world.getBlockAt(player.location)
val playerId = player.uniqueId
@@ -44,7 +43,7 @@ class PlayerMoveListener(val plugin: GalaxyLobbyPlugin) : Listener {
}
if (playerBlock.type === Material.MANGROVE_PRESSURE_PLATE) {
plugin.jumpPadCooldowns.put(playerId, currentTime)
plugin.jumpPadCooldowns[playerId] = currentTime
if (player.gameMode == GameMode.ADVENTURE && player.inventory.heldItemSlot == 7) {
player.velocity = Vector(0, 1, 0)

View File

@@ -1,29 +0,0 @@
package xyz.lncvrt.galaxylobby.event
import net.kyori.adventure.text.minimessage.MiniMessage
import org.bukkit.Material
import org.bukkit.entity.Firework
import org.bukkit.entity.Player
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.entity.ProjectileLaunchEvent
import org.bukkit.inventory.ItemStack
import xyz.lncvrt.galaxyapi.utils.MessageFormat
class ProjectileLaunchListener() : Listener {
@EventHandler
fun onProjectileLaunchEvent(event: ProjectileLaunchEvent) {
val firework = event.getEntity()
val player = firework.shooter
if (firework is Firework) {
if (player is Player) {
val fireworkItem = ItemStack(Material.FIREWORK_ROCKET)
val fireworkMeta = fireworkItem.itemMeta
fireworkMeta.displayName(MiniMessage.miniMessage().deserialize(MessageFormat.setPrimaryColor("<italic:false>Elytra ${MessageFormat.setSecondaryColor("(Fly around the lobby!)")}</italic>")))
fireworkItem.setItemMeta(fireworkMeta)
player.inventory.setItem(7, fireworkItem)
player.setCooldown(fireworkItem.type, 20)
}
}
}
}