From a191a8b9a2414b31c47edbeea5d7ee9f49837419 Mon Sep 17 00:00:00 2001 From: bushtail Date: Fri, 5 May 2023 22:01:28 -0400 Subject: [PATCH] Craftify --- .../src/main/kotlin/Craftify/plugin.kt | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 plugin-playground/src/main/kotlin/Craftify/plugin.kt diff --git a/plugin-playground/src/main/kotlin/Craftify/plugin.kt b/plugin-playground/src/main/kotlin/Craftify/plugin.kt new file mode 100644 index 0000000..b1d4b07 --- /dev/null +++ b/plugin-playground/src/main/kotlin/Craftify/plugin.kt @@ -0,0 +1,25 @@ +package Craftify + +import plugin.Plugin +import plugin.annotations.PluginMeta +import plugin.api.API +import plugin.api.FontColor +import plugin.api.FontType +import plugin.api.TextModifier +import rt4.Fonts +import rt4.Player +import java.awt.Color + +@PluginMeta( + author = "bushtail", + description = "Add nameplates above players heads.", + version = 1.0 +) +class plugin : Plugin() { + override fun PlayerOverheadDraw(player: Player?, screenX: Int, screenY: Int) { + if (player == null) return + val width = Fonts.p11Full.getStringWidth(player.username) + API.DrawRect(screenX - width / 2, screenY - 12, width, 14, FontColor.fromColor(Color.BLACK).colorCode) + API.DrawText(FontType.SMALL, FontColor.fromColor(Color.WHITE), TextModifier.CENTER, player.username.toString(), screenX, screenY) + } +} \ No newline at end of file