.
This commit is contained in:
parent
855050c2d1
commit
77decae10c
74 changed files with 1190 additions and 861 deletions
23
minigame/extraction/BUILD
Normal file
23
minigame/extraction/BUILD
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
load("@rules_jvm_external//:defs.bzl", "artifact")
|
||||
load("@rules_java//java:java_binary.bzl", "java_binary")
|
||||
|
||||
java_binary(
|
||||
name = "_plugin",
|
||||
srcs = glob(["site/lab0x13/scrow/**/*.java"]),
|
||||
create_executable = False,
|
||||
resources = glob(["resources/**"]),
|
||||
resource_strip_prefix = "minigame/extraction/resources",
|
||||
deps = [
|
||||
"//core/bukkit:api",
|
||||
"//core/configurator:lib",
|
||||
artifact("io.papermc.paper:paper-api"),
|
||||
],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "plugin",
|
||||
srcs = [":_plugin_deploy.jar"],
|
||||
outs = ["plugin.jar"],
|
||||
cmd = "cp $< $@",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
6
minigame/extraction/resources/plugin.yml
Normal file
6
minigame/extraction/resources/plugin.yml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
name: "Extraction"
|
||||
version: "0"
|
||||
depend: [ "CoreBukkit", "Configurator" ]
|
||||
main: "site.lab0x13.scrow.extraction.ExtractionPlugin"
|
||||
api-version: "26.2"
|
||||
author: "Kento2"
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package site.lab0x13.scrow.extraction;
|
||||
|
||||
import de.kentoj.scrow.bukkit.minigame.Minigame;
|
||||
import de.kentoj.scrow.bukkit.minigame.PlayerManager;
|
||||
import de.kentoj.scrow.bukkit.minigame.phaseflow.LinearPhaseFlow;
|
||||
import de.kentoj.scrowlib.convention.ScrowMessageStyle;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class ExtractionGame implements Minigame {
|
||||
|
||||
private final ScrowMessageStyle style = new ScrowMessageStyle("PotatoRun", TextColor.color(0x8D7726));
|
||||
private final PlayerManager playerManager = new PlayerManager(this);
|
||||
private final LinearPhaseFlow phaseFlow = new LinearPhaseFlow("potatoRun.root");
|
||||
|
||||
@Override
|
||||
public int minParticipants() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int maxParticipants() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> start() {
|
||||
return phaseFlow.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScrowMessageStyle style() {
|
||||
return style;
|
||||
}
|
||||
|
||||
public PlayerManager playerManager() {
|
||||
return playerManager;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package site.lab0x13.scrow.extraction;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import site.lab0x13.scrow.configurator.configfile.ConfigFile;
|
||||
import site.lab0x13.scrow.configurator.configfile.ConfigFileRegistry;
|
||||
import site.lab0x13.scrow.extraction.config.ExtractionConfig;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ExtractionPlugin extends JavaPlugin {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(ExtractionPlugin.class);
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
log.info("loading");
|
||||
var cfg = ConfigFile.of(this.getDataPath().resolve("config.json"));
|
||||
ConfigFileRegistry.get().register(cfg);
|
||||
cfg.registerStorable("arenas", ExtractionConfig.arenas);
|
||||
try {
|
||||
cfg.load();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
log.info("loaded");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package site.lab0x13.scrow.extraction.config;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import site.lab0x13.scrow.configurator.storable.Storable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record ArenaConfig(
|
||||
List<Storable<Location>> spawnLocations
|
||||
) {
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package site.lab0x13.scrow.extraction.config;
|
||||
|
||||
import site.lab0x13.scrow.configurator.storable.complex.ComplexStorable;
|
||||
import site.lab0x13.scrow.configurator.storable.complex.FieldReader;
|
||||
import site.lab0x13.scrow.configurator.storable.complex.FieldRegistry;
|
||||
import site.lab0x13.scrow.configurator.storable.impl.list.ListStorable;
|
||||
import site.lab0x13.scrow.configurator.storable.impl.location.LocationStorable;
|
||||
|
||||
public class ArenaConfigStorable extends ComplexStorable<ArenaConfig> {
|
||||
|
||||
@Override
|
||||
protected void registerFields(FieldRegistry<ArenaConfig> registry) {
|
||||
registry.registerField("spawnLocations", new ListStorable<>(LocationStorable::new), ArenaConfig::spawnLocations);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ArenaConfig construct(FieldReader<ArenaConfig> reader) {
|
||||
return new ArenaConfig(reader.read("spawnLocations"));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package site.lab0x13.scrow.extraction.config;
|
||||
|
||||
import site.lab0x13.scrow.configurator.storable.impl.list.ListStorable;
|
||||
|
||||
public final class ExtractionConfig {
|
||||
private ExtractionConfig() {
|
||||
}
|
||||
|
||||
public static final ListStorable<ArenaConfigStorable> arenas = new ListStorable<>(ArenaConfigStorable::new);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue