Skip to content

Commit

Permalink
Merge branch 'master' into clear-data-command
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachesMLG authored Dec 28, 2024
2 parents 5903cdb + 645852a commit 114850c
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 31 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected].1
- uses: actions/[email protected].2
- uses: gradle/wrapper-validation-action@v3
- name: Set up JDK 17
uses: actions/setup-java@v4.4.0
uses: actions/setup-java@v4.6.0
with:
distribution: temurin
java-version: 17
Expand All @@ -25,7 +25,7 @@ jobs:
- name: Build with Gradle
run: ./gradlew build
- name: Upload artifacts
uses: "actions/upload-artifact@v4.4.1"
uses: "actions/upload-artifact@v4.5.0"
with:
name: "IridiumSkyblock"
path: "build/libs/IridiumSkyblock-*.jar"
Expand Down
12 changes: 6 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
java
`maven-publish`
id("com.github.johnrengelman.shadow") version "8.1.1"
id("io.github.goooler.shadow") version "8.1.8"
id("net.minecrell.plugin-yml.bukkit") version "0.6.0"
}

Expand All @@ -22,21 +22,21 @@ repositories {

dependencies {
// Dependencies that we want to shade in
implementation("org.jetbrains:annotations:25.0.0")
implementation("org.jetbrains:annotations:26.0.1")
implementation("com.j256.ormlite:ormlite-core:6.1")
implementation("com.j256.ormlite:ormlite-jdbc:6.1")
implementation("com.iridium:IridiumTeams:2.5.9")
implementation("com.iridium:IridiumTeams:2.5.9.8")
implementation("commons-lang:commons-lang:2.6")

// Other dependencies that are not required or already available at runtime
compileOnly("org.projectlombok:lombok:1.18.34")
compileOnly("org.spigotmc:spigot-api:1.21.1-R0.1-SNAPSHOT")
compileOnly("org.projectlombok:lombok:1.18.36")
compileOnly("org.spigotmc:spigot-api:1.21.4-R0.1-SNAPSHOT")
compileOnly("com.github.MilkBowl:VaultAPI:1.7.1")
compileOnly("net.ess3:EssentialsXSpawn:2.16.1")
compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.2.13-SNAPSHOT")

// Enable lombok annotation processing
annotationProcessor("org.projectlombok:lombok:1.18.34")
annotationProcessor("org.projectlombok:lombok:1.18.36")
}

bukkit {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 1 addition & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
23 changes: 12 additions & 11 deletions src/main/java/com/iridium/iridiumskyblock/configs/Schematics.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.iridium.iridiumskyblock.configs;

import com.cryptomorin.xseries.XBiome;
import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XSound;
import com.cryptomorin.xseries.reflection.XReflection;
Expand All @@ -20,27 +21,27 @@ public class Schematics {

public Map<String, SchematicConfig> schematics = ImmutableMap.<String, SchematicConfig>builder()
.put("desert", new SchematicConfig(new Item(XMaterial.PLAYER_HEAD, 11, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNGY0OTNkZDgwNjUzM2Q5ZDIwZTg0OTUzOTU0MzY1ZjRkMzY5NzA5Y2ViYzlkZGVmMDIyZDFmZDQwZDg2YTY4ZiJ9fX0=", 1, "&9&lDesert Island", Arrays.asList("&7A starter desert island.", "", "&9&l[!] &7Costs $1000")),
new Schematics.Cost(0, new HashMap<>()), 1, -0.5, 89, -0.5, 90, new SchematicWorld(Biome.DESERT,
new Schematics.Cost(0, new HashMap<>()), 1, -0.5, 89, -0.5, 90, new SchematicWorld(XBiome.DESERT,
"desert.schem", 90.0, true
), new SchematicWorld(XReflection.supports(16) ? Biome.NETHER_WASTES : Biome.valueOf("NETHER"),
), new SchematicWorld(XBiome.NETHER_WASTES,
"desert_nether.schem", 90.0, true
), new SchematicWorld(Biome.THE_END,
), new SchematicWorld(XBiome.THE_END,
"desert_end.schem", 90.0, true
)))
.put("jungle", new SchematicConfig(new Item(XMaterial.PLAYER_HEAD, 13, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjgzYWRmNDU2MGRlNDc0MTQwNDA5M2FjNjFjMzNmYjU1NmIzZDllZTUxNDBmNjIwMzYyNTg5ZmRkZWRlZmEyZCJ9fX0=", 1, "&9&lJungle Island", Arrays.asList("&7A starter jungle island.", "", "&9&l[!] &7Costs $1000")),
new Schematics.Cost(0, new HashMap<>()), 1, 1.5, 83, 1.5, 90, new SchematicWorld(Biome.JUNGLE,
new Schematics.Cost(0, new HashMap<>()), 1, 1.5, 83, 1.5, 90, new SchematicWorld(XBiome.JUNGLE,
"jungle.schem", 90.0, true
), new SchematicWorld(XReflection.supports(16) ? Biome.NETHER_WASTES : Biome.valueOf("NETHER"),
), new SchematicWorld(XBiome.NETHER_WASTES,
"jungle_nether.schem", 90.0, true
), new SchematicWorld(Biome.THE_END,
), new SchematicWorld(XBiome.THE_END,
"jungle_end.schem", 90.0, true
)))
.put("mushroom", new SchematicConfig(new Item(XMaterial.PLAYER_HEAD, 15, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWE0NWQxYjQxN2NiZGRjMjE3NjdiMDYwNDRlODk5YjI2NmJmNzhhNjZlMjE4NzZiZTNjMDUxNWFiNTVkNzEifX19", 1, "&9&lMushroom Island", Arrays.asList("&7A starter mushroom island.", "", "&9&l[!] &7Costs $1000")),
new Schematics.Cost(0, new HashMap<>()), 1, 0.5, 89, -0.5, 90, new SchematicWorld(Biome.MUSHROOM_FIELDS,
new Schematics.Cost(0, new HashMap<>()), 1, 0.5, 89, -0.5, 90, new SchematicWorld(XBiome.MUSHROOM_FIELDS,
"mushroom.schem", 90.0, true
), new SchematicWorld(XReflection.supports(16) ? Biome.NETHER_WASTES : Biome.valueOf("NETHER"),
), new SchematicWorld(XBiome.NETHER_WASTES,
"mushroom_nether.schem", 90.0, true
), new SchematicWorld(Biome.THE_END,
), new SchematicWorld(XBiome.THE_END,
"mushroom_end.schem", 90.0, true
)))
.build();
Expand Down Expand Up @@ -68,12 +69,12 @@ public static class SchematicConfig {

@NoArgsConstructor
public static class SchematicWorld {
public Biome biome;
public XBiome biome;
public String schematicID;
public Double islandHeight;
public Boolean ignoreAirBlocks;

public SchematicWorld(Biome biome, String schematicID, Double islandHeight, Boolean ignoreAirBlocks) {
public SchematicWorld(XBiome biome, String schematicID, Double islandHeight, Boolean ignoreAirBlocks) {
this.biome = biome;
this.schematicID = schematicID;
this.islandHeight = islandHeight;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void buy(Player player, Biomes.BiomeItem biomeItem) {
XBiome biome = biomeItem.biome;
User user = IridiumSkyblock.getInstance().getUserManager().getUser(player);
Optional<Island> island = user.getIsland();
Optional<XBiome> biomeOptional = XBiome.matchXBiome(biomeItem.biome.toString());
Optional<XBiome> biomeOptional = XBiome.of(biomeItem.biome.toString());

if (!canPurchase(player, biomeItem)) {
IridiumSkyblock.getInstance().getBiomes().failSound.play(player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import java.io.File;
import java.sql.SQLException;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.CompletableFuture;

@Getter
Expand Down Expand Up @@ -50,6 +52,11 @@ public void init() throws SQLException {
String databaseURL = getDatabaseURL(sqlConfig);

DataPersisterManager.registerDataPersisters(XMaterialType.getSingleton());
DataPersisterManager.registerDataPersisters(XEntityTypeType.getSingleton());
DataPersisterManager.registerDataPersisters(XPotionType.getSingleton());
DataPersisterManager.registerDataPersisters(XEnchantmentType.getSingleton());
DataPersisterManager.registerDataPersisters(XBiomeType.getSingleton());

DataPersisterManager.registerDataPersisters(LocationType.getSingleton());
DataPersisterManager.registerDataPersisters(InventoryType.getSingleton());
DataPersisterManager.registerDataPersisters(LocalDateTimeType.getSingleton());
Expand Down Expand Up @@ -77,6 +84,14 @@ public void init() throws SQLException {
this.teamMissionTableManager = new ForeignIslandTableManager<>(teamMission -> getDatabaseKey(teamMission.getTeamID(), teamMission.getMissionName()), connectionSource, TeamMission.class);
this.teamRewardsTableManager = new ForeignIslandTableManager<>(teamRewards -> getDatabaseKey(teamRewards.getId()), connectionSource, TeamReward.class);
this.teamSettingsTableManager = new ForeignIslandTableManager<>(teamSetting -> getDatabaseKey(teamSetting.getTeamID(), teamSetting.getSetting()), connectionSource, TeamSetting.class);

// We need to clear out null values
for(TeamBlock teamBlock : teamBlockTableManager.getEntries()) {
if(teamBlock.getXMaterial() == null) teamBlockTableManager.delete(teamBlock);
}
for(TeamSpawners teamSpawners : teamSpawnerTableManager.getEntries()) {
if(teamSpawners.getEntityType() == null) teamSpawnerTableManager.delete(teamSpawners);
}
}

private String getDatabaseKey(Object... params) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void createWorld(World.Environment environment, String name) {
}

public void setIslandBiome(@NotNull Island island, @NotNull XBiome biome) {
World.Environment dimension = biome.getEnvironment();
World.Environment dimension = biome.getEnvironment().get();
World world = getWorld(dimension);

if (world == null) return;
Expand Down Expand Up @@ -253,9 +253,9 @@ public CompletableFuture<Void> generateIsland(Island island, Schematics.Schemati
deleteIslandBlocks(island).join();
clearEntities(island);
IridiumSkyblock.getInstance().getSchematicManager().pasteSchematic(island, schematicConfig).join();
setIslandBiome(island, XBiome.matchXBiome(schematicConfig.overworld.biome));
setIslandBiome(island, XBiome.matchXBiome(schematicConfig.nether.biome));
setIslandBiome(island, XBiome.matchXBiome(schematicConfig.end.biome));
setIslandBiome(island, schematicConfig.overworld.biome);
setIslandBiome(island, schematicConfig.nether.biome);
setIslandBiome(island, schematicConfig.end.biome);
});
}

Expand Down Expand Up @@ -662,6 +662,16 @@ public void deleteTeamMission(TeamMission teamMission) {
IridiumSkyblock.getInstance().getDatabaseManager().getTeamMissionTableManager().delete(teamMission);
}

@Override
public void deleteTeamMissionData(TeamMission teamMission) {
MissionData missionData = IridiumSkyblock.getInstance().getMissions().missions.get(teamMission.getMissionName()).getMissionData().get(teamMission.getMissionLevel());

for (int i = 0; i < missionData.getMissions().size(); i++) {
Optional<TeamMissionData> data = IridiumSkyblock.getInstance().getDatabaseManager().getTeamMissionDataTableManager().getEntry(new TeamMissionData(teamMission, i));
data.ifPresent(teamMissionData -> IridiumSkyblock.getInstance().getDatabaseManager().getTeamMissionDataTableManager().delete(teamMissionData));
}
}

@Override
public List<TeamReward> getTeamRewards(Island island) {
return IridiumSkyblock.getInstance().getDatabaseManager().getTeamRewardsTableManager().getEntries(island);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public List<Placeholder> getPlaceholders(Island island) {
.orElse(IridiumSkyblock.getInstance().getMessages().nullPlaceholder)),
new Placeholder("island_create", () -> island.getCreateTime().format(DateTimeFormatter.ofPattern(IridiumSkyblock.getInstance().getConfiguration().dateTimeFormat))),
new Placeholder("island_description", island::getDescription),
new Placeholder("island_value", () -> String.valueOf(IridiumSkyblock.getInstance().getTeamManager().getTeamValue(island))),
new Placeholder("island_value", () -> formatDouble(IridiumSkyblock.getInstance().getTeamManager().getTeamValue(island))),
new Placeholder("island_level", () -> String.valueOf(island.getLevel())),
new Placeholder("island_experience", String.valueOf(island.getExperience())),
new Placeholder("island_experienceToLevelUp", String.valueOf(IridiumSkyblock.getInstance().getIslandManager().getTeamExperienceForNextLevel(island))),
Expand Down Expand Up @@ -87,7 +87,7 @@ public List<Placeholder> getPlaceholders(Island island) {
}

for (BankItem bankItem : IridiumSkyblock.getInstance().getBankItemList()) {
placeholderList.add(new Placeholder("island_bank_" + bankItem.getName().toLowerCase(), () -> String.valueOf(IridiumSkyblock.getInstance().getTeamManager().getTeamBank(island, bankItem.getName()).getNumber())));
placeholderList.add(new Placeholder("island_bank_" + bankItem.getName().toLowerCase(), () -> formatDouble(IridiumSkyblock.getInstance().getTeamManager().getTeamBank(island, bankItem.getName()).getNumber())));
}
for (XMaterial xMaterial : XMaterial.values()) {
placeholderList.add(new Placeholder("island_" + xMaterial.name().toLowerCase() + "_amount", () -> String.valueOf(IridiumSkyblock.getInstance().getTeamManager().getTeamBlock(island, xMaterial).getAmount())));
Expand All @@ -99,8 +99,11 @@ public List<Placeholder> getPlaceholders(Island island) {
});
}

private List<Placeholder> initializeDefaultPlaceholders() {
private String formatDouble(double value) {
return IridiumSkyblock.getInstance().getConfiguration().numberFormatter.format(value);
}

private List<Placeholder> initializeDefaultPlaceholders() {
List<Placeholder> placeholderList = new ArrayList<>(Arrays.asList(
new Placeholder("island_name", IridiumSkyblock.getInstance().getMessages().nullPlaceholder),
new Placeholder("island_owner", IridiumSkyblock.getInstance().getMessages().nullPlaceholder),
Expand Down

0 comments on commit 114850c

Please sign in to comment.