Skip to content

Instantly share code, notes, and snippets.

@ZeroErrors
Created June 23, 2026 23:21
Show Gist options
  • Select an option

  • Save ZeroErrors/158e5070b4fb3800c920cafef0b6d7e8 to your computer and use it in GitHub Desktop.

Select an option

Save ZeroErrors/158e5070b4fb3800c920cafef0b6d7e8 to your computer and use it in GitHub Desktop.
package dev.zero.example;
import com.hypixel.hytale.server.core.entity.entities.player.hud.CustomUIHud;
import com.hypixel.hytale.server.core.ui.builder.UICommandBuilder;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import javax.annotation.Nonnull;
public class WelcomeHud extends CustomUIHud {
public WelcomeHud(@Nonnull PlayerRef playerRef) {
super(playerRef, "Welcome");
}
@Override
protected void build(@Nonnull UICommandBuilder commandBuilder) {
commandBuilder.appendInline(null, """
Group #Welcome {
Anchor: (Horizontal: 40, Top: 80, Height: 64);
Padding: (Horizontal: 20, Vertical: 12);
Background: #000000(0.5);
LayoutMode: CenterMiddle;
Label #WelcomeLabel {
Text: "Welcome!";
Style: (RenderBold: true, FontSize: 22, TextColor: #d92a2a);
}
}""");
}
}
package dev.zero.example;
import com.hypixel.hytale.server.core.event.events.player.PlayerReadyEvent;
import com.hypixel.hytale.server.core.plugin.JavaPlugin;
import com.hypixel.hytale.server.core.plugin.JavaPluginInit;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import javax.annotation.Nonnull;
import java.util.logging.Level;
public class WelcomePlugin extends JavaPlugin {
public WelcomePlugin(@Nonnull JavaPluginInit init) {
super(init);
}
@Override
protected void setup() {
getEventRegistry().registerGlobal(PlayerReadyEvent.class, event -> {
var ref = event.getPlayerRef();
var playerRef = ref.getStore().getComponent(ref, PlayerRef.getComponentType());
event.getPlayer().getHudManager().addCustomHud(playerRef, new WelcomeHud(playerRef));
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment