π₯οΈ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
Implements one of those Abstract Class
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);
}
}
Last updated
Was this helpful?