mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-18 06:10:16 +00:00
Reformat
This commit is contained in:
@@ -20,7 +20,6 @@ package com.dfsek.terra.bukkit;
|
||||
import com.dfsek.tectonic.api.TypeRegistry;
|
||||
import com.dfsek.tectonic.api.depth.DepthTracker;
|
||||
import com.dfsek.tectonic.api.exception.LoadException;
|
||||
|
||||
import io.papermc.paper.registry.RegistryAccess;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
@@ -50,10 +50,8 @@ import com.dfsek.terra.bukkit.world.BukkitAdapter;
|
||||
|
||||
public class TerraBukkitPlugin extends JavaPlugin {
|
||||
private static final Logger logger = LoggerFactory.getLogger(TerraBukkitPlugin.class);
|
||||
|
||||
private PlatformImpl platform;
|
||||
private final Map<String, com.dfsek.terra.api.world.chunk.generation.ChunkGenerator> generatorMap = new HashMap<>();
|
||||
|
||||
private PlatformImpl platform;
|
||||
private AsyncScheduler asyncScheduler = this.getServer().getAsyncScheduler();
|
||||
|
||||
private GlobalRegionScheduler globalRegionScheduler = this.getServer().getGlobalRegionScheduler();
|
||||
|
||||
@@ -19,6 +19,11 @@ public final class MultiverseGeneratorPluginHook implements GeneratorPlugin {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
public static void register(Platform platform) {
|
||||
MultiverseCoreApi.get().getGeneratorProvider()
|
||||
.registerGeneratorPlugin(new MultiverseGeneratorPluginHook(platform));
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Collection<String> suggestIds(@Nullable String s) {
|
||||
return platform.getConfigRegistry().entries().stream()
|
||||
@@ -46,9 +51,4 @@ public final class MultiverseGeneratorPluginHook implements GeneratorPlugin {
|
||||
public @NotNull String getPluginName() {
|
||||
return "Terra";
|
||||
}
|
||||
|
||||
public static void register(Platform platform) {
|
||||
MultiverseCoreApi.get().getGeneratorProvider()
|
||||
.registerGeneratorPlugin(new MultiverseGeneratorPluginHook(platform));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,26 +69,26 @@ public class CommonListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onWolfSpawn(CreatureSpawnEvent event) {
|
||||
if (!(event.getEntity() instanceof Wolf wolf)) {
|
||||
if(!(event.getEntity() instanceof Wolf wolf)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Doesn't apply if variant has already been applied
|
||||
if (wolf.getVariant() != Variant.PALE) {
|
||||
if(wolf.getVariant() != Variant.PALE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!WOLF_VARIANT_SPAWN_REASONS.contains(event.getSpawnReason())) {
|
||||
if(!WOLF_VARIANT_SPAWN_REASONS.contains(event.getSpawnReason())) {
|
||||
return;
|
||||
}
|
||||
|
||||
World world = wolf.getWorld();
|
||||
if (!(world.getGenerator() instanceof BukkitChunkGeneratorWrapper wrapper)) {
|
||||
if(!(world.getGenerator() instanceof BukkitChunkGeneratorWrapper wrapper)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ConfigPack pack = platform.getConfigRegistry().get(wrapper.getPack().getRegistryKey()).orElse(null);
|
||||
if (pack == null) {
|
||||
if(pack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.dfsek.terra.bukkit.nms;
|
||||
|
||||
import com.dfsek.terra.bukkit.TerraBukkitPlugin;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.dfsek.terra.bukkit.BukkitAddon;
|
||||
import com.dfsek.terra.bukkit.PlatformImpl;
|
||||
import com.dfsek.terra.bukkit.TerraBukkitPlugin;
|
||||
import com.dfsek.terra.bukkit.util.VersionUtil;
|
||||
|
||||
|
||||
@@ -18,7 +16,7 @@ public interface Initializer {
|
||||
Logger logger = LoggerFactory.getLogger(Initializer.class);
|
||||
|
||||
PlatformImpl platform = constructPlatform(plugin);
|
||||
if (platform == null) {
|
||||
if(platform == null) {
|
||||
logger.error("NMS bindings for version {} do not exist. Support for this version is limited.", NMS);
|
||||
logger.error("This is usually due to running Terra on an unsupported Minecraft version.");
|
||||
String bypassKey = "IKnowThereAreNoNMSBindingsFor" + NMS + "ButIWillProceedAnyway";
|
||||
@@ -48,7 +46,7 @@ public interface Initializer {
|
||||
private static PlatformImpl constructPlatform(TerraBukkitPlugin plugin) {
|
||||
try {
|
||||
String packageVersion = NMS;
|
||||
if (NMS.equals("v1_21_5") || NMS.equals("v1_21_6")) {
|
||||
if(NMS.equals("v1_21_5") || NMS.equals("v1_21_6")) {
|
||||
packageVersion = "v1_21_7";
|
||||
}
|
||||
|
||||
|
||||
@@ -5,4 +5,5 @@ import org.bukkit.NamespacedKey;
|
||||
import com.dfsek.terra.api.properties.Properties;
|
||||
|
||||
|
||||
public record BukkitBiomeInfo(NamespacedKey biomeKey) implements Properties {}
|
||||
public record BukkitBiomeInfo(NamespacedKey biomeKey) implements Properties {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user