diff --git a/Dockerfile b/Dockerfile index 5de6ef4b2..db1288909 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,7 @@ RUN ./gradlew build pluginJar --no-daemon # 4. Launch a minecraft server with jdk17 and plugin FROM amazoncorretto:17 # Change to the current plugin version present in build.gradle -ENV PLUGIN_VERSION=6.36.1 +ENV PLUGIN_VERSION=6.37.0 # Change to the server version you want to test. ENV SERVER_VERSION=spigot-1.18.jar # Port of the Minecraft Server. diff --git a/blockball-api/src/main/java/com/github/shynixn/blockball/api/business/proxy/PluginProxy.kt b/blockball-api/src/main/java/com/github/shynixn/blockball/api/business/proxy/PluginProxy.kt index d3fa5118a..391041309 100644 --- a/blockball-api/src/main/java/com/github/shynixn/blockball/api/business/proxy/PluginProxy.kt +++ b/blockball-api/src/main/java/com/github/shynixn/blockball/api/business/proxy/PluginProxy.kt @@ -43,11 +43,6 @@ interface PluginProxy { */ fun sendConsoleMessage(message: String) - /** - * Sets the motd of the server. - */ - fun setMotd(message: String) - /** * Shutdowns the server. */ diff --git a/blockball-api/src/main/java/com/github/shynixn/blockball/api/business/service/ScreenMessageService.kt b/blockball-api/src/main/java/com/github/shynixn/blockball/api/business/service/ScreenMessageService.kt index dd8fff2e3..110a6d3fe 100644 --- a/blockball-api/src/main/java/com/github/shynixn/blockball/api/business/service/ScreenMessageService.kt +++ b/blockball-api/src/main/java/com/github/shynixn/blockball/api/business/service/ScreenMessageService.kt @@ -32,10 +32,10 @@ interface ScreenMessageService { * Sets the [title] of the given [player] [P] for the amount of [stay] ticks. Optionally shows a [subTitle] and displays * a [fadeIn] and [fadeOut] effect in ticks. */ - fun

setTitle(player: P, title: String, subTitle: String = "", fadeIn: Int = 20, stay: Int = 60, fadeOut: Int = 20) + fun

setTitle(player: P, title: String, subTitle: String = "", fadeIn: Int, stay: Int, fadeOut: Int) /** * Sets the [message] for the given [player] at the actionbar. */ fun

setActionBar(player: P, message: String) -} \ No newline at end of file +} diff --git a/blockball-api/src/main/java/com/github/shynixn/blockball/api/persistence/entity/BungeeCordGame.kt b/blockball-api/src/main/java/com/github/shynixn/blockball/api/persistence/entity/BungeeCordGame.kt index d165e66d8..e0b17ccba 100644 --- a/blockball-api/src/main/java/com/github/shynixn/blockball/api/persistence/entity/BungeeCordGame.kt +++ b/blockball-api/src/main/java/com/github/shynixn/blockball/api/persistence/entity/BungeeCordGame.kt @@ -27,4 +27,6 @@ package com.github.shynixn.blockball.api.persistence.entity * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -interface BungeeCordGame : MiniGame \ No newline at end of file +interface BungeeCordGame : MiniGame { + var modt: String +} diff --git a/blockball-api/src/main/java/com/github/shynixn/blockball/api/persistence/entity/MatchTimeMeta.kt b/blockball-api/src/main/java/com/github/shynixn/blockball/api/persistence/entity/MatchTimeMeta.kt index 3d989dca3..3a4b32385 100644 --- a/blockball-api/src/main/java/com/github/shynixn/blockball/api/persistence/entity/MatchTimeMeta.kt +++ b/blockball-api/src/main/java/com/github/shynixn/blockball/api/persistence/entity/MatchTimeMeta.kt @@ -2,33 +2,6 @@ package com.github.shynixn.blockball.api.persistence.entity import com.github.shynixn.blockball.api.business.enumeration.MatchTimeCloseType -/** - * Created by Shynixn 2020. - *

- * Version 1.5 - *

- * MIT License - *

- * Copyright (c) 2020 by Shynixn - *

- * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - *

- * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - *

- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ interface MatchTimeMeta { /** * Should the goals of the teams be switched when this match time gets enabled? @@ -62,4 +35,10 @@ interface MatchTimeMeta { * SubTitle of the message getting played when this match time starts. */ var startMessageSubTitle: String -} \ No newline at end of file + + var startMessageFadeIn : Int + + var startMessageStay : Int + + var startMessageFadeOut : Int +} diff --git a/blockball-api/src/main/java/com/github/shynixn/blockball/api/persistence/entity/TeamMeta.kt b/blockball-api/src/main/java/com/github/shynixn/blockball/api/persistence/entity/TeamMeta.kt index 638760ce6..426f58049 100644 --- a/blockball-api/src/main/java/com/github/shynixn/blockball/api/persistence/entity/TeamMeta.kt +++ b/blockball-api/src/main/java/com/github/shynixn/blockball/api/persistence/entity/TeamMeta.kt @@ -46,18 +46,36 @@ interface TeamMeta { /** Subtitle of the message getting played when a player scores a goal. */ var scoreMessageSubTitle: String + var scoreMessageFadeIn : Int + + var scoreMessageStay : Int + + var scoreMessageFadeOut : Int + /** Title of the message getting played when this team wins a match. */ var winMessageTitle: String /** Subtitle of the message getting played when this team wins a match. */ var winMessageSubTitle: String + var winMessageFadeIn : Int + + var winMessageStay : Int + + var winMessageFadeOut : Int + /** Title of the message getting played when the match ends in a draw.*/ var drawMessageTitle: String /** Subtitle of the message getting played when the match ends in a draw. */ var drawMessageSubTitle: String + var drawMessageFadeIn : Int + + var drawMessageStay : Int + + var drawMessageFadeOut : Int + /** Message getting played when a player joins a match.*/ var joinMessage: String diff --git a/blockball-bukkit-plugin/build.gradle.kts b/blockball-bukkit-plugin/build.gradle.kts index be777a4b4..fcaeba302 100644 --- a/blockball-bukkit-plugin/build.gradle.kts +++ b/blockball-bukkit-plugin/build.gradle.kts @@ -87,7 +87,7 @@ tasks.register("pluginJarLatest", ShadowJar::class.java) { dependsOn("relocatePluginJar") from(zipTree(File("./build/libs/" + (tasks.getByName("relocatePluginJar") as Jar).archiveName))) archiveName = "${baseName}-${version}-latest.${extension}" - // destinationDir = File("C:\\temp\\plugins") + // destinationDir = File("C:\\temp\\plugins") exclude("com/github/shynixn/mcutils/**") exclude("org/**") @@ -110,8 +110,8 @@ dependencies { implementation(project(":blockball-bukkit-api")) implementation(project(":blockball-core")) - implementation("com.github.shynixn.mcutils:common:1.0.37") - implementation("com.github.shynixn.mcutils:packet:1.0.52") + implementation("com.github.shynixn.mcutils:common:1.0.40") + implementation("com.github.shynixn.mcutils:packet:1.0.61") implementation("com.github.shynixn.org.bstats:bstats-bukkit:1.7") implementation("org.slf4j:slf4j-jdk14:1.7.25") diff --git a/blockball-bukkit-plugin/src/main/java/com/github/shynixn/blockball/bukkit/BlockBallPlugin.kt b/blockball-bukkit-plugin/src/main/java/com/github/shynixn/blockball/bukkit/BlockBallPlugin.kt index f8bc749fa..ef856d42f 100644 --- a/blockball-bukkit-plugin/src/main/java/com/github/shynixn/blockball/bukkit/BlockBallPlugin.kt +++ b/blockball-bukkit-plugin/src/main/java/com/github/shynixn/blockball/bukkit/BlockBallPlugin.kt @@ -14,7 +14,7 @@ import com.github.shynixn.blockball.core.logic.business.extension.translateChatC import com.github.shynixn.mcutils.common.Version import com.github.shynixn.mcutils.packet.api.PacketInType import com.github.shynixn.mcutils.packet.api.PacketService -import com.github.shynixn.mcutils.packet.impl.PacketServiceImpl +import com.github.shynixn.mcutils.packet.impl.service.PacketServiceImpl import com.google.inject.Guice import com.google.inject.Injector import org.apache.commons.io.IOUtils @@ -273,29 +273,6 @@ class BlockBallPlugin : JavaPlugin(), PluginProxy { return this.serverVersion!! } - /** - * Sets the motd of the server. - */ - override fun setMotd(message: String) { - val builder = java.lang.StringBuilder("[") - builder.append((message.replace("[", "").replace("]", ""))) - builder.append(ChatColor.RESET.toString()) - builder.append("]") - - val minecraftServerClazz = try { - findClazz("net.minecraft.server.MinecraftServer") - } catch (e: Exception) { - findClazz("net.minecraft.server.VERSION.MinecraftServer") - } - - val craftServerClazz = findClazz("org.bukkit.craftbukkit.VERSION.CraftServer") - val setModtMethod = minecraftServerClazz.getDeclaredMethod("setMotd", String::class.java) - val getServerConsoleMethod = craftServerClazz.getDeclaredMethod("getServer") - - val console = getServerConsoleMethod.invoke(Bukkit.getServer()) - setModtMethod.invoke(console, builder.toString().translateChatColors()) - } - /** * Shutdowns the server. */ diff --git a/blockball-bukkit-plugin/src/main/java/com/github/shynixn/blockball/bukkit/logic/business/listener/BungeeCordgameListener.kt b/blockball-bukkit-plugin/src/main/java/com/github/shynixn/blockball/bukkit/logic/business/listener/BungeeCordgameListener.kt index bb8a4133c..ecb2586c0 100644 --- a/blockball-bukkit-plugin/src/main/java/com/github/shynixn/blockball/bukkit/logic/business/listener/BungeeCordgameListener.kt +++ b/blockball-bukkit-plugin/src/main/java/com/github/shynixn/blockball/bukkit/logic/business/listener/BungeeCordgameListener.kt @@ -2,6 +2,7 @@ package com.github.shynixn.blockball.bukkit.logic.business.listener import com.github.shynixn.blockball.api.business.enumeration.GameType import com.github.shynixn.blockball.api.business.service.* +import com.github.shynixn.blockball.api.persistence.entity.BungeeCordGame import com.github.shynixn.blockball.bukkit.logic.business.extension.toPosition import com.github.shynixn.blockball.core.logic.business.extension.sync import com.google.inject.Inject @@ -11,6 +12,7 @@ import org.bukkit.event.Listener import org.bukkit.event.block.Action import org.bukkit.event.player.PlayerInteractEvent import org.bukkit.event.player.PlayerJoinEvent +import org.bukkit.event.server.ServerListPingEvent /** * Created by Shynixn 2018. @@ -67,6 +69,17 @@ class BungeeCordgameListener @Inject constructor( } } + @EventHandler + fun onPingServerEven(event: ServerListPingEvent) { + val game = gameService.getAllGames().find { p -> p.arena.gameType == GameType.BUNGEE } + + if (game != null && game is BungeeCordGame) { + if (game.modt.isNotBlank()) { + event.motd = game.modt + } + } + } + /** * Handles click on signs to create new server signs or to connect players to the server * written on the sign. @@ -94,4 +107,4 @@ class BungeeCordgameListener @Inject constructor( rightClickManageService.executeWatchers(event.player, event.clickedBlock!!.location) } -} \ No newline at end of file +} diff --git a/blockball-bukkit-plugin/src/main/java/com/github/shynixn/blockball/bukkit/logic/business/proxy/BallDesignEntity.kt b/blockball-bukkit-plugin/src/main/java/com/github/shynixn/blockball/bukkit/logic/business/proxy/BallDesignEntity.kt index e48bce70b..fb73eb0b8 100644 --- a/blockball-bukkit-plugin/src/main/java/com/github/shynixn/blockball/bukkit/logic/business/proxy/BallDesignEntity.kt +++ b/blockball-bukkit-plugin/src/main/java/com/github/shynixn/blockball/bukkit/logic/business/proxy/BallDesignEntity.kt @@ -66,8 +66,15 @@ class BallDesignEntity(val entityId: Int) { val item = Item().also { it.typeName = "PLAYER_HEAD,397" it.durability = 3 - it.nbt = "{SkullOwner:{Id:[I;1,1,1,1],Name:\"FootBall\",Properties:{textures:[{Value:\"${encodingSkinUrl}\"}]}}}" } + + if (ball.meta.itemNbt != null && !ball.meta.itemNbt.isNullOrEmpty()) { + item.nbt = ball.meta.itemNbt + } else { + item.nbt = + "{SkullOwner:{Id:[I;1,1,1,1],Name:\"FootBall\",Properties:{textures:[{Value:\"${encodingSkinUrl}\"}]}}}" + } + val stack = itemService.toItemStack(item) packetService.sendPacketOutEntityEquipment(player, PacketOutEntityEquipment().also { diff --git a/blockball-bukkit-plugin/src/main/resources/lang/de_de.properties b/blockball-bukkit-plugin/src/main/resources/lang/de_de.properties deleted file mode 100644 index f9294b24c..000000000 --- a/blockball-bukkit-plugin/src/main/resources/lang/de_de.properties +++ /dev/null @@ -1,61 +0,0 @@ -translator=Shynixn -arenaDisplayName=Spielfeld %1$1d -joinSignLine1=&lBlockBall -joinSignLine2= -joinSignLine3= -joinSignLine4=/ -leaveSignLine1=&lBlockBall -leaveSignLine2= -leaveSignLine3=&fVerlassen -leaveSignLine4=/ -joinHubGamePromptTitle=Klicke auf ein Team um dem Match beizutreten. -joinHubGamePromptTeamRed=[] -joinHubGamePromptTeamBlue=[] -waitingForMorePlayersMessage=&aWarte auf &c&a weitere(n) Spieler... -bungeeCordKickMessage=Dieser Server ist schon voll. -scoreboardTitle=&aBlockBall -scoreBoardLine1= -scoreBoardLine2=&6Zeit: -scoreBoardLine3=