- Added a way to completely customize the soccer ball through the API. More ways will be built into the plugin in the future, but for now, this gives administrators the ability to code something custom. This API also allows for there to be multiple entities associated with the soccer ball.
Code (Text):
public interface SoccerBallEntity {
/**
* LobbyGames soccer ball size from config
* @param size
*/
public void setSize(int size);
/**
* Used for spawning and respawning.
* The game will also respawn the ball when if an entity with a UUID in the UUID set is killed
* @param loc
*/
public void spawn(Location loc);
public void teleport(Location loc);
public void remove();
public boolean isValid();
public boolean containsUUID(UUID u);
public Location getLocation();
public World getWorld();
/**
* In some advanced use cases, the ball may need a manual check for when a player punches it (ex. block displays).
* This is initialized by the Soccer game during its initialization
* @param consumer
*/
public void setClickConsumer(Consumer<Player> consumer);
}
Example for how the Slime is implemented with this interface:
Code (Text):
public class SlimeSoccerBall implements SoccerBallEntity {
public boolean containsUUID(UUID u) {
return slime.getUniqueId().equals(u);
}
public Location getLocation() {
return slime.getLocation();
}
public World getWorld() {
return slime.getWorld();
}
public void setSize(int size) {
this.size = size;
if (slime != null) slime.setSize(size);
}
public void setClickConsumer(Consumer<Player> consumer) {
// some use cases (ex. block displays) may require a manual way to detect when the player punches the ball
}
}
The custom soccer ball entity can be used via Soccer::setSoccerBallEntity or via the constructor
Soccer(LobbyGames plugin, Arena arena, Player p1, SoccerBallEntity ballEntity).
- Set all armor stands spawned by the plugin to have NoAI, this might help with preventing interference from other plugins.