πŸ“ƒ
Wiki
  • πŸŒ‹Plugins
  • Overview
    • πŸ’‘High Quality Products
  • products
    • πŸ›οΈUltimateBedwars
      • ✨Features
      • πŸͺΆInstallation
      • πŸ“œConfiguration
      • πŸ›οΈArena
      • πŸ–±οΈCommand & Permissions
      • πŸŽ‰Party
      • πŸ–₯️For Developers
    • 🌡UltimateOneBlock
      • ✨Features
      • πŸͺΆInstallation
      • πŸ“œConfiguration
      • πŸ•‘Phase
      • πŸ§žβ€β™‚οΈGenerators
      • πŸ–±οΈCommand & Permissions
      • πŸ–₯️For Developers
    • ⛏️UltimateGuilds
      • ✨Features
      • πŸͺΆInstallation
      • πŸ“œConfiguration
      • πŸ–±οΈCommand & Permissions
      • πŸ–₯️For Developers
    • πŸ“œPlayerDataHistory
      • ✨Features
      • πŸͺΆInstallation
      • πŸ“œConfiguration
      • πŸ•ΈοΈWeb Panel
      • πŸ–±οΈCommand & Permissions
    • βš”οΈUltimateTournament
      • ✨Features
      • πŸͺΆInstallation
      • πŸ’‘Placeholders
      • πŸ“œConfiguration
      • 🀺Tournament
      • πŸ–±οΈCommand & Permissions
    • 🏒BasementLib
      • ✨Features
      • πŸ“œConfiguration
    • πŸ“‘Minedock
      • ✨Features
      • πŸͺΆInstallation
      • πŸ“œConfiguration
      • πŸ–₯️For Developers
    • πŸŽ’UltimateMatchmaking
      • ✨Features
Powered by GitBook
On this page
  • Lobby & Game
  • Game Only
  • Cosmetics API

Was this helpful?

  1. products
  2. UltimateBedwars

For Developers

Lobby & Game

Obtain LeaderBoard RBucket

String leaderboardName = "bedwars_wins_daily";
RBucket<LeaderBoard> redisBoard = Basement.rclient().getBucket(leaderboardName);

if (redisBoard.isExists()) {
    LeaderBoard board = redisBoard.get();|
    ...   
}

Obtain Statistic Class

UUID uniqueId = null;
Statistics stats = Basement.rclient().getLiveObjectService().get(Statistics.class, uniqueId.toString());
if (stats == null) {
    System.out.println("Statistics not found");
    return;
}

int wins = statistics.get(StatsScope.SOLO, StatsType.WIN);
...

Obtain UserData Class

UUID uniqueId = null;
UserData userData = Basement.rclient().getLiveObjectService().get(UserData.class, uniqueId.toString());
if (userData == null) {
    System.out.println("UserData not found");
    return;
}

int level = userData.getLevel();
...

Obtain SharedBedwarsMatch Class

SharedBedwarsMatch match = Basement.redis().redissonClient().getLiveObjectService().get(SharedBedwarsMatch.class, statistics.getMatch());
if (match == null) {
    System.out.println("Match not found");
    return;
}

boolean isPrivateGame = match.getHost() != null;
match.spectate("Username");
...

Game Only

Obtain MatchPlayer Class

Player player = null;
MatchPlayer matchPlayer = MatchPlayer.get(player.getUniqueId());

Statistics statistics = matchPlayer.getStatistics();
Arena arena = matchPlayer.getArena();

matchPlayer.resetStats(); // Reset stats for the current game
...

Cosmetics API

Create custom cosmetics with easy API

Add your cosmetic class to the avaible one

CosmeticsInstance.COSMETICS.put(, Type.YOUR_TYPE, "cosmetic_id", new YourCustomCosmeticsClass());

PlayerCosmetics class is an utility class to manage cosmetics for players:

@Getter
@RequiredArgsConstructor
public class PlayerCosmetics {

    private final UUID uuid;

    private final Table<Type, String, Boolean> cosmetics = HashBasedTable.create();

    public void addCosmetic(Type type, String cosmetic, boolean equipped) {
        if (equipped) equipCosmetic(type, cosmetic);
        else this.cosmetics.put(type, cosmetic, false);
    }

    public void equipCosmetic(Type type, String cosmetic) {
        String key;
        if ((key = getEquippedCosmetic(type)) != null) {
            this.cosmetics.put(type, key, false);
        }
        this.cosmetics.put(type, cosmetic, true);
    }

    public void unequipCosmetic(Type type, String key) {
        this.cosmetics.put(type, key, false);
    }

    public boolean hasEquippedCosmetic(Type type, String key) {
        return this.cosmetics.get(type, key);
    }

    public boolean hasCosmetic(String cosmetic) {
        return this.cosmetics.containsColumn(cosmetic);
    }

    public boolean hasCosmetic(Type type) {
        return this.cosmetics.containsRow(type);
    }

    public @Nullable String getEquippedCosmetic(Type type) {
        return this.cosmetics.row(type).entrySet().stream()
                .filter(Map.Entry::getValue)
                .map(Map.Entry::getKey)
                .findFirst()
                .orElse(null);
    }
}

Cosmetic Example

public class LightningBolt extends KillEffect {

    public LightningBolt() {
        super("lightning_bolt");
    }

    @Override
    public String getDisplayName() {
        return "Lightning Bolt";
    }

    @Override
    public void play(Location victimPosition, Location killerPosition) {
        victimPosition.getWorld().strikeLightningEffect(victimPosition);
    }

}

PreviousPartyNextUltimateOneBlock

Last updated 5 months ago

Was this helpful?

Implements one of those Abstract Class

πŸ›οΈ
πŸ–₯️