🔥Update to latest paper version
🔨Add possibility to kick an offline or online player from the game. 🍗Add Saturation effect. 🎙️Change VoiceChat to Simple Voice Chat. 😨Werewolf one shot player now.
This commit is contained in:
@@ -1,13 +1,19 @@
|
||||
plugins {
|
||||
kotlin("jvm") version "2.2.0-Beta1"
|
||||
id("com.gradleup.shadow") version "8.3.0"
|
||||
id("xyz.jpenilla.run-paper") version "2.3.1"
|
||||
id("io.papermc.paperweight.userdev") version "2.0.0-beta.16"
|
||||
id("com.gradleup.shadow") version "9.2.2"
|
||||
id("xyz.jpenilla.run-paper") version "3.0.2"
|
||||
id("io.papermc.paperweight.userdev") version "2.0.0-beta.19"
|
||||
}
|
||||
|
||||
group = "fr.azur"
|
||||
version = "1.0-SNAPSHOT"
|
||||
|
||||
val minecraftVersion: String by project
|
||||
val paperVersion: String by project
|
||||
val skinRestorerVersion: String by project
|
||||
val voiceChatVersion: String by project
|
||||
val voiceChatApiVersion: String by project
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
@@ -20,16 +26,17 @@ repositories {
|
||||
maven("https://repo.codemc.org/repository/maven-public/") {
|
||||
name = "codemc"
|
||||
}
|
||||
maven("https://repo.plasmoverse.com/releases")
|
||||
maven("https://repo.plasmoverse.com/snapshots")
|
||||
maven("https://maven.maxhenkel.de/repository/public") {
|
||||
name = "svc"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
paperweight.paperDevBundle("1.21.4-R0.1-SNAPSHOT")
|
||||
paperweight.paperDevBundle("$minecraftVersion-$paperVersion")
|
||||
|
||||
|
||||
compileOnly("net.skinsrestorer:skinsrestorer-api:15.6.3")
|
||||
compileOnly("su.plo.voice.api:server:2.1.4")
|
||||
implementation("net.skinsrestorer:skinsrestorer-api:$skinRestorerVersion")
|
||||
implementation("de.maxhenkel.voicechat:voicechat-api:$voiceChatApiVersion")
|
||||
|
||||
implementation(kotlin("stdlib-jdk8"))
|
||||
}
|
||||
@@ -42,10 +49,10 @@ kotlin {
|
||||
tasks {
|
||||
runServer {
|
||||
downloadPlugins {
|
||||
modrinth("plasmo-voice", "spigot-2.1.4")
|
||||
modrinth("skinsrestorer", "15.6.3")
|
||||
modrinth("plasmo-voice", "bukkit-$voiceChatVersion")
|
||||
modrinth("skinsrestorer", skinRestorerVersion)
|
||||
}
|
||||
minecraftVersion("1.21.4")
|
||||
minecraftVersion(minecraftVersion)
|
||||
}
|
||||
build {
|
||||
dependsOn("shadowJar")
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
paperVersion=R0.1-SNAPSHOT
|
||||
minecraftVersion=1.21.8
|
||||
skinRestorerVersion=15.8.2
|
||||
voiceChatApiVersion=2.6.0
|
||||
voiceChatVersion=2.6.6
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1 +1 @@
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
package fr.azur.tcoww
|
||||
|
||||
import de.maxhenkel.voicechat.api.BukkitVoicechatService
|
||||
import fr.azur.tcoww.events.GameEvent
|
||||
import fr.azur.tcoww.events.ToolsEvents
|
||||
import fr.azur.tcoww.plasmovoice.addon.PlasmoAddon
|
||||
import fr.azur.tcoww.roles.*
|
||||
import fr.azur.tcoww.utils.Skin
|
||||
import fr.azur.tcoww.voicechat.VoiceChatPlugin
|
||||
import net.skinsrestorer.api.SkinsRestorer
|
||||
import net.skinsrestorer.api.SkinsRestorerProvider
|
||||
import org.bukkit.plugin.java.JavaPlugin
|
||||
import su.plo.voice.api.server.PlasmoVoiceServer
|
||||
|
||||
class Tcoww : JavaPlugin() {
|
||||
private lateinit var skinsRestorer: SkinsRestorer
|
||||
private lateinit var skinManager: Skin
|
||||
val plasmoAddon = PlasmoAddon()
|
||||
|
||||
override fun onEnable() {
|
||||
saveResource("config.yml", false)
|
||||
saveDefaultConfig()
|
||||
|
||||
PlasmoVoiceServer.getAddonsLoader().load(plasmoAddon)
|
||||
|
||||
skinsRestorer = SkinsRestorerProvider.get()
|
||||
skinManager = Skin(this, skinsRestorer)
|
||||
|
||||
server.pluginManager.registerEvents(ToolsEvents(this), this)
|
||||
server.pluginManager.registerEvents(GameEvent(this, skinManager), this)
|
||||
|
||||
val vcservice = server.servicesManager.load(BukkitVoicechatService::class.java)
|
||||
vcservice?.registerPlugin(VoiceChatPlugin())
|
||||
|
||||
registerRoles()
|
||||
}
|
||||
|
||||
@@ -34,10 +34,9 @@ class Tcoww : JavaPlugin() {
|
||||
|
||||
}
|
||||
|
||||
fun reload(withPlasmoAddon: Boolean) {
|
||||
fun reload() {
|
||||
this.reloadConfig()
|
||||
skinManager.reloadSkin()
|
||||
if (withPlasmoAddon) plasmoAddon.onConfigLoaded()
|
||||
}
|
||||
|
||||
private fun registerRoles() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package fr.azur.tcoww
|
||||
|
||||
import fr.azur.tcoww.commands.Exclude
|
||||
import fr.azur.tcoww.commands.Power
|
||||
import fr.azur.tcoww.commands.GameCommand
|
||||
import fr.azur.tcoww.commands.ReloadCommands
|
||||
@@ -19,6 +20,7 @@ class TcowwBootstrap : PluginBootstrap {
|
||||
commands.registrar().register(GameCommand().root.build())
|
||||
commands.registrar().register(Vote().root.build())
|
||||
commands.registrar().register(ReloadCommands().root.build())
|
||||
commands.registrar().register(Exclude().root.build())
|
||||
}
|
||||
}
|
||||
}
|
||||
40
src/main/kotlin/fr/azur/tcoww/commands/Exclude.kt
Normal file
40
src/main/kotlin/fr/azur/tcoww/commands/Exclude.kt
Normal file
@@ -0,0 +1,40 @@
|
||||
package fr.azur.tcoww.commands
|
||||
|
||||
import com.mojang.brigadier.Command
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder
|
||||
import fr.azur.tcoww.game.Game
|
||||
import io.papermc.paper.command.brigadier.CommandSourceStack
|
||||
import io.papermc.paper.command.brigadier.Commands
|
||||
import io.papermc.paper.command.brigadier.argument.ArgumentTypes
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.PlayerProfileListResolver
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.GameMode
|
||||
|
||||
class Exclude {
|
||||
val root: LiteralArgumentBuilder<CommandSourceStack> = Commands.literal("exclude")
|
||||
.requires { sender ->
|
||||
sender.sender.isOp
|
||||
}.then(
|
||||
Commands.literal("start")
|
||||
.then(
|
||||
Commands.argument("players", ArgumentTypes.playerProfiles()).executes { ctx ->
|
||||
val targetResolver = ctx.getArgument("players", PlayerProfileListResolver::class.java)
|
||||
val target = targetResolver.resolve(ctx.source).first()
|
||||
val uuid = target.id
|
||||
if (uuid != null) {
|
||||
val player = Bukkit.getPlayer(uuid)
|
||||
if (player != null) {
|
||||
val game = Game.current ?: return@executes Command.SINGLE_SUCCESS
|
||||
player.gameMode = GameMode.SPECTATOR
|
||||
player.isInvulnerable = false
|
||||
game.playersMutable.remove(player)
|
||||
}
|
||||
|
||||
}
|
||||
Command.SINGLE_SUCCESS
|
||||
}
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
@@ -62,15 +62,15 @@ class Tools {
|
||||
}
|
||||
)
|
||||
).then(
|
||||
Commands.literal("reload").executes { ctx ->
|
||||
Commands.literal("reload").executes {
|
||||
val plugin = Bukkit.getPluginManager().getPlugin("tcoww") as Tcoww
|
||||
plugin.reload(true)
|
||||
plugin.reload()
|
||||
Command.SINGLE_SUCCESS
|
||||
}
|
||||
).then(
|
||||
Commands.literal("customitem").then(
|
||||
Commands.argument("item", StringArgumentType.greedyString())
|
||||
.suggests { ctx, builder ->
|
||||
.suggests { _, builder ->
|
||||
CustomItems.entries.forEach {
|
||||
builder.suggest(it.name)
|
||||
}
|
||||
|
||||
@@ -282,8 +282,7 @@ class GameEvent(val plugin: Plugin, val skinUtils: Skin) : Listener {
|
||||
current.wwcankill
|
||||
) {
|
||||
current.wwcankill = false
|
||||
target.addPotionEffect(PotionEffect(PotionEffectType.WITHER, 1200, 10))
|
||||
target.addPotionEffect(PotionEffect(PotionEffectType.POISON, 1200, 10))
|
||||
target.health = 0.0
|
||||
target.persistentDataContainer.set(NamespacedKey("tcoww", "insomie"), PersistentDataType.BOOLEAN, true)
|
||||
if (target.isSleeping) target.wakeup(false)
|
||||
}
|
||||
@@ -303,15 +302,6 @@ class GameEvent(val plugin: Plugin, val skinUtils: Skin) : Listener {
|
||||
false
|
||||
)
|
||||
)
|
||||
event.player.addPotionEffect(
|
||||
PotionEffect(
|
||||
PotionEffectType.SATURATION,
|
||||
PotionEffect.INFINITE_DURATION,
|
||||
1,
|
||||
false,
|
||||
false
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@EventHandler(
|
||||
@@ -319,7 +309,6 @@ class GameEvent(val plugin: Plugin, val skinUtils: Skin) : Listener {
|
||||
ignoreCancelled = true
|
||||
)
|
||||
fun endSleep(event: PlayerBedLeaveEvent) {
|
||||
event.player.removePotionEffect(PotionEffectType.SATURATION)
|
||||
event.player.removePotionEffect(PotionEffectType.REGENERATION)
|
||||
}
|
||||
|
||||
@@ -385,7 +374,7 @@ class GameEvent(val plugin: Plugin, val skinUtils: Skin) : Listener {
|
||||
speedatr.addModifier(
|
||||
AttributeModifier(
|
||||
NamespacedKey("tcoww", "wwtranform"),
|
||||
0.1,
|
||||
0.05,
|
||||
AttributeModifier.Operation.ADD_NUMBER
|
||||
)
|
||||
)
|
||||
|
||||
@@ -12,6 +12,8 @@ import org.bukkit.World
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.persistence.PersistentDataType
|
||||
import org.bukkit.plugin.Plugin
|
||||
import org.bukkit.potion.PotionEffect
|
||||
import org.bukkit.potion.PotionEffectType
|
||||
import org.bukkit.scheduler.BukkitTask
|
||||
import kotlin.math.ceil
|
||||
|
||||
@@ -29,6 +31,15 @@ class Game(var plugin: Plugin, val world: World, val players: Iterable<Player>,
|
||||
player.teleport(plugin.config.getLocation("spawnLocation")!!)
|
||||
player.inventory.clear()
|
||||
player.health = 20.0
|
||||
player.addPotionEffect(
|
||||
PotionEffect(
|
||||
PotionEffectType.SATURATION,
|
||||
PotionEffect.INFINITE_DURATION,
|
||||
1,
|
||||
false,
|
||||
false
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
assignRoles()
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
package fr.azur.tcoww.plasmovoice.addon
|
||||
|
||||
import su.plo.voice.api.addon.AddonInitializer
|
||||
import su.plo.voice.api.addon.InjectPlasmoVoice
|
||||
import su.plo.voice.api.addon.annotation.Addon
|
||||
import su.plo.voice.api.event.EventSubscribe
|
||||
import su.plo.voice.api.server.PlasmoVoiceServer
|
||||
import su.plo.voice.api.server.event.player.PlayerInfoCreateEvent
|
||||
|
||||
|
||||
@Addon(
|
||||
id = "tcoww",
|
||||
name = "The court of werewolf",
|
||||
version = "1.0.0",
|
||||
authors = ["Azur"]
|
||||
)
|
||||
class PlasmoAddon : AddonInitializer {
|
||||
@InjectPlasmoVoice
|
||||
private lateinit var voiceServer: PlasmoVoiceServer
|
||||
|
||||
override fun onAddonInitialize() {
|
||||
onConfigLoaded()
|
||||
}
|
||||
|
||||
override fun onAddonShutdown() {
|
||||
|
||||
}
|
||||
|
||||
fun onConfigLoaded() {
|
||||
|
||||
}
|
||||
|
||||
@EventSubscribe
|
||||
fun onPlayerInfoCreate(event: PlayerInfoCreateEvent) {
|
||||
event.voicePlayerInfo.playerNick = "..."
|
||||
}
|
||||
}
|
||||
14
src/main/kotlin/fr/azur/tcoww/voicechat/VoiceChatPlugin.kt
Normal file
14
src/main/kotlin/fr/azur/tcoww/voicechat/VoiceChatPlugin.kt
Normal file
@@ -0,0 +1,14 @@
|
||||
package fr.azur.tcoww.voicechat
|
||||
|
||||
import de.maxhenkel.voicechat.api.VoicechatPlugin
|
||||
import de.maxhenkel.voicechat.api.events.EventRegistration
|
||||
|
||||
class VoiceChatPlugin: VoicechatPlugin {
|
||||
override fun getPluginId(): String {
|
||||
return "tcow"
|
||||
}
|
||||
|
||||
override fun registerEvents(registration: EventRegistration) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,6 @@ dependencies:
|
||||
load: BEFORE
|
||||
required: true
|
||||
join-classpath: true
|
||||
PlasmoVoice:
|
||||
voicechat:
|
||||
load: BEFORE
|
||||
required: true
|
||||
Reference in New Issue
Block a user