mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-27 02:49:11 +00:00
3.6.39
This commit is contained in:
@@ -49,6 +49,7 @@ tasks {
|
||||
from(zipTree(project(":compatibility-itemsadder-r2").tasks.jar.get().archiveFile))
|
||||
from(zipTree(project(":compatibility-crucible-r1").tasks.jar.get().archiveFile))
|
||||
from(zipTree(project(":compatibility-craftengine-r1").tasks.jar.get().archiveFile))
|
||||
from(zipTree(project(":plugin:j21").tasks.jar.get().archiveFile))
|
||||
archiveFileName = "CustomCrops-${rootProject.properties["project_version"]}.jar"
|
||||
destinationDirectory.set(file("$rootDir/target"))
|
||||
relocate("net.kyori", "net.momirealms.customcrops.libraries")
|
||||
|
||||
23
plugin/j21/build.gradle.kts
Normal file
23
plugin/j21/build.gradle.kts
Normal file
@@ -0,0 +1,23 @@
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":api"))
|
||||
compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT")
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
options.encoding = "UTF-8"
|
||||
options.release.set(21)
|
||||
dependsOn(tasks.clean)
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package net.momirealms.customcrops.bukkit.j21;
|
||||
|
||||
import net.momirealms.customcrops.api.core.world.ExplosionIndicator;
|
||||
import org.bukkit.ExplosionResult;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
|
||||
public class ModernExplosionIndicator implements ExplosionIndicator {
|
||||
|
||||
public ModernExplosionIndicator() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDestroyBlocks(EntityExplodeEvent event) {
|
||||
return event.getExplosionResult() == ExplosionResult.DESTROY || event.getExplosionResult() == ExplosionResult.DESTROY_WITH_DECAY;
|
||||
}
|
||||
}
|
||||
@@ -294,8 +294,10 @@ public class BukkitConfigManager extends ConfigManager {
|
||||
@Override
|
||||
public void registerCropConfig(CropConfig config) {
|
||||
Registries.CROP.register(config.id(), config);
|
||||
Registries.SEED_TO_CROP.register(config.seed(), config);
|
||||
Registries.ITEMS.register(config.seed(), BuiltInItemMechanics.SEED.mechanic());
|
||||
for (String seed : config.seeds()) {
|
||||
Registries.SEED_TO_CROP.register(seed, config);
|
||||
Registries.ITEMS.register(seed, BuiltInItemMechanics.SEED.mechanic());
|
||||
}
|
||||
for (DeathCondition condition : config.deathConditions()) {
|
||||
String deadStage = condition.deathStage();
|
||||
if (deadStage != null) {
|
||||
|
||||
@@ -41,10 +41,7 @@ import net.momirealms.customcrops.common.util.Pair;
|
||||
import net.momirealms.customcrops.common.util.TriFunction;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Configuration types for various mechanics.
|
||||
@@ -206,7 +203,7 @@ public class ConfigType {
|
||||
|
||||
CropConfig config = CropConfig.builder()
|
||||
.id(id)
|
||||
.seed(section.getString("seed"))
|
||||
.seed(getAsStringList(section.get("seed")))
|
||||
.rotation(section.getBoolean("random-rotation", false))
|
||||
.maxPoints(section.getInt("max-points", 1))
|
||||
.ignoreRandomTick(section.getBoolean("ignore-random-tick", false))
|
||||
@@ -336,4 +333,20 @@ public class ConfigType {
|
||||
public boolean parse(ConfigManager manager, String id, Section section) {
|
||||
return argumentConsumer.apply(manager, id, section);
|
||||
}
|
||||
|
||||
private static List<String> getAsStringList(Object o) {
|
||||
List<String> list = new ArrayList<>();
|
||||
if (o instanceof List<?>) {
|
||||
for (Object object : (List<?>) o) {
|
||||
list.add(object.toString());
|
||||
}
|
||||
} else if (o instanceof String) {
|
||||
list.add((String) o);
|
||||
} else {
|
||||
if (o != null) {
|
||||
list.add(o.toString());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,6 @@ import java.util.*;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
public class BukkitItemManager extends AbstractItemManager {
|
||||
|
||||
private final BukkitCustomCropsPlugin plugin;
|
||||
private CustomItemProvider provider;
|
||||
private AbstractCustomEventListener eventListener;
|
||||
|
||||
Reference in New Issue
Block a user