All Projects → randombyte-developer → Holograms

randombyte-developer / Holograms

Licence: gpl-2.0
A Sponge plugin

Programming Languages

kotlin
9241 projects

Labels

Projects that are alternatives of or similar to Holograms

sponge
sponge is a website crawler and links downloader command-line tool
Stars: ✭ 37 (+428.57%)
Mutual labels:  sponge
MinecraftDeveloperGuide
📝Minecraft developer Chinese guide,我的世界开发者中文指南
Stars: ✭ 1,307 (+18571.43%)
Mutual labels:  sponge
NT-RPG
A new rpg plugin for Sponge & Spigot
Stars: ✭ 21 (+200%)
Mutual labels:  sponge
PacketGate
Sponge library to manipulate incoming and outgoing Packets.
Stars: ✭ 22 (+214.29%)
Mutual labels:  sponge
Lantern
An open-source Minecraft server that implements the SpongeAPI.
Stars: ✭ 111 (+1485.71%)
Mutual labels:  sponge
SkyClaims
SkyClaims is an Island plugin that integrates with GriefDefender for SpongeAPI.
Stars: ✭ 16 (+128.57%)
Mutual labels:  sponge
McTester
An integration testing framework for Minecraft
Stars: ✭ 39 (+457.14%)
Mutual labels:  sponge
Minecraftdeveloperguide
📝Minecraft developer Chinese guide,我的世界开发者中文指南
Stars: ✭ 574 (+8100%)
Mutual labels:  sponge
UniverseGuard2
An easy to use world protection plugin for Sponge
Stars: ✭ 17 (+142.86%)
Mutual labels:  sponge
TotalEconomy
All in one economy plugin for Minecraft and Sponge.
Stars: ✭ 32 (+357.14%)
Mutual labels:  sponge
Flint
A Minecraft minigame engine.
Stars: ✭ 22 (+214.29%)
Mutual labels:  sponge
guardiansponge
🔱 Guardian - An extensive AntiCheat plugin for Sponge.
Stars: ✭ 20 (+185.71%)
Mutual labels:  sponge
Netherboard
Scoreboard API for your Minecraft Sponge and Bukkit Plugins.
Stars: ✭ 56 (+700%)
Mutual labels:  sponge
Osmium
Abstraction layer for Bukkit, Sponge and BungeeCord that allows for development on all platforms simultaneously.
Stars: ✭ 34 (+385.71%)
Mutual labels:  sponge
Spongevanilla
The SpongeAPI implementation for Vanilla Minecraft.
Stars: ✭ 254 (+3528.57%)
Mutual labels:  sponge
Sledgehammer
Smashes the stupid out of the client & server.
Stars: ✭ 13 (+85.71%)
Mutual labels:  sponge
Maintenance
Enable maintenance mode on your Minecraft server
Stars: ✭ 122 (+1642.86%)
Mutual labels:  sponge
Minecraftdev
Plugin for IntelliJ IDEA that gives special support for Minecraft modding projects.
Stars: ✭ 645 (+9114.29%)
Mutual labels:  sponge
Viaversion
Allows the connection of newer clients to older server versions for Minecraft servers.
Stars: ✭ 463 (+6514.29%)
Mutual labels:  sponge
Bukkit2Sponge
An implementation of SpongeAPI for Bukkit servers (Glowstone, Spigot)
Stars: ✭ 17 (+142.86%)
Mutual labels:  sponge

Ore page

How to use the Holograms-API

Setup the dependency

Add jitpack as a repository and the API as a dependency.

Gradle example:

repositories {
    maven { url "https://jitpack.io" }
}
dependencies {
    compile "com.github.randombyte-developer.holograms:holograms-api:v2.1.1"
}

That dependency only contains this one file.

How to use in code

Although everything is documented in theHologramService.kt it may not be clear how to use that Service written in Kotlin from a plugin written in Java. Basically, the fields prefixed with var like text and location have a getter and a setter method automatically generated to be used from the Java side.

Here is an example:

Optional<HologramsService> hologramsServiceOptional = Sponge.getServiceManager().provide(HologramsService.class);
HologramsService hologramsService = hologramsServiceOptional.orElseThrow(
        () -> new RuntimeException("HologramsAPI not available! Is the plugin 'holograms' installed?"));

// Creating a Hologram
Optional<HologramsService.Hologram> hologramOptional = hologramsService
        .createHologram(player.getLocation(), Text.of(TextColors.GREEN, "Example text"));
if (!hologramOptional.isPresent()) {
    player.sendMessage(Text.of("Hologram couldn't be spawned!"));
    return CommandResult.success();
}

// Modifying the Hologram
Hologram hologram = hologramOptional.get();

hologram.setText(Text.of("New text"));

Location<World> newLocation = hologram.getLocation().add(0.0, 5.0, 0.0);
hologram.setLocation(newLocation);

// Finding the Hologram by UUID
// Both UUIDs are saved somewhere (e.g. in a config file)
UUID hologramUuid = hologram.getUuid();
UUID worldUuid = hologram.getWorldUuid();

Optional<World> worldOptional = Sponge.getServer().getWorld(worldUuid);
if (!worldOptional.isPresent()) {
    player.sendMessage(Text.of("Couldn't find world!"));
    return CommandResult.success();
}
World world = worldOptional.get();
Optional<? extends Hologram> loadedHologramOptional = hologramsService.getHologram(world, hologramUuid);
if (!loadedHologramOptional.isPresent()) {
    player.sendMessage(Text.of("Couldn't find Hologram!"));
    return CommandResult.success();
}
Hologram loadedHologram = loadedHologramOptional.get();
loadedHologram.setText(Text.of("This Hologram was found!"));

// Removing the Hologram
loadedHologram.remove();

If you have questions, please ask me!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].