This page helps you to understand how to use our SpooferAPI on different platforms. We offer a abstract layer for Spigot, BungeeCord & Velocity.
Usage
To get started using our api, import our library via either gradle or maven.
Create a `libs` folder in your current working directory with our plugin inside of it.
Don't forget to add our plugin as dependency inside your plugin.yml / bungee-plugin.yml / velocity-plugin.json.
The name of the plugin will always be HalosPlayerSpoofer for all platforms
You can get the instance of a fake player from all platform.
importcom.halos.spoofer.shared.core.player.FakePlayer;importcom.halos.spoofer.shared.core.account.type.UsernameAccount;importcom.halos.spoofer.shared.core.account.type.UUIDAccount;importjava.util.UUID;importcom.halos.spoofer.shared.core.profile.Profile;var player = (FakePlayer) null;player.account(); // can be null; either a UsernameAccount or UUIDAccountString name =player.profile().name(); // name of fake playerUUID uniqueId =player.profile().uniqueId(); // uuid of fake playerProfile.Texture= texture =player.profile().texture(); // skin texture of fake playerlong joinedAt =player.joinedAt(); // join time stamplong expiresAt =player.expiresAt(); // when the player will leave the serverboolean chatter =player.chatter(); // if the player can chatFakePlayerMetadata metadata =player.metadata(); // metadata for fake player// use metadata to store different values// caution: metadata will be saved. For example the Vote & Rank Module utilizes this.// so clear keys on the destroy event to prevent many filesboolean createdByFluctuation =metadata.has(MetadataKey.FLUCTUATION); // check if player is created by fluctuationmetadata.put("rank","default"); // store a propertymetadata.getOrDefault("rank","default") // retrieve a property
Spigot
We provide several events, that are called when a fake player is created on the current server
importcom.halos.spoofer.api.spigot.event.FakePlayerCreatedEvent;importcom.halos.spoofer.api.spigot.event.FakePlayerDestroyEvent;importcom.halos.spoofer.api.spigot.event.FakePlayerLoginEvent;// This event is called after a fake player is created & joined the server.var playerCreatedEvent = (FakePlayerCreatedEvent) null;// This event is called before a fake player gets destroyed.var playerDestroyEvent = (FakePlayerDestroyEvent) null;// This event is called before a fake player logs in.var playerLoginEvent = (FakePlayerLoginEvent) null;playerCreatedEvent.fakePlayer(); // get the fake playerplayerCreatedEvent.player(); // get the bukkit playerplayerDestroyEvent.fakePlayer(); // get the fake playerplayerDestroyEvent.player(); // get the bukkit playerplayerLoginEvent.fakePlayer(); // get the fake player
importcom.halos.spoofer.api.spigot.SpigotSpooferAPI;importcom.halos.spoofer.shared.core.player.FakePlayer;var api =SpigotSpooferAPI.get(); // access the spigot spoofer apiapi.isFakePlayer("username");api.isFakePlayer(UUID.randomUUID());api.isFakePlayer(Bukkit.getPlayer("username"));// careful: all find methods return optionals with FakePlayerFakePlayer fakePlayer =api.find("username").orElseThrow();FakePlayer fakePlayer =api.find(UUID.randomUUID().orElseThrow());FakePlayer fakePlayer =api.find(Bukkit.getPlayer("username").orElseThrow());CompletableFuture<FakePlayer> future = api.createFakePlayer(new Profile("username", UUID.randomUUID(), new Profile.Texture("value", "signature")));
CompletableFuture<FakePlayer> future = api.createFakePlayer(new UsernameAccount("rexlManu")); // this fetches the profile from a profile fetcher type
CompletableFuture<FakePlayer> future = api.createFakePlayer(new UUIDAccount(UUID.randomUUID())); // this fetches the profile from a profile fetcher type
// future will fail with a FakePlayerNotFoundException if player can't be foundCompletableFuture<Void> future =api.removeFakePlayer(UUID.randomUUID());CompletableFuture<Void> future =api.removeFakePlayer("username");CompletableFuture<Void> future =api.removeFakePlayer(Bukkit.getPlayer("username"));CompletableFuture<Void> future =api.removeFakePlayer(fakePlayer);
BungeeCord / Velocity
Both platforms provide a similar api like spigot with the exception of creating / removing fake players. When creating a fake player on spigot, the fake player will also be created on the proxy.
importcom.halos.spoofer.api.bungee.event.FakePlayerCreatedEvent;importcom.halos.spoofer.api.bungee.event.FakePlayerDestroyEvent;importcom.halos.spoofer.api.velocity.event.FakePlayerCreatedEvent;importcom.halos.spoofer.api.velocity.event.FakePlayerDestroyEvent;// all events give access to fakePlayer via FakePlayerEvent#fakePlayer() // and FakePlayerCreatedEvent#player() for velocity// or proxied player instance on bungeecordimportcom.halos.spoofer.api.velocity.VelocitySpooferAPI;importcom.halos.spoofer.api.bungee.BungeeSpooferAPI;// both apis are called similar like the spigot variant exempt the creation / removing methods.// the native platforms give access to get fake players by ProxiedPlayer or Player from velocity