started big events
This commit is contained in:
9
event/build.gradle
Normal file
9
event/build.gradle
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
dependencies {
|
||||||
|
implementation project(':common')
|
||||||
|
implementation project(':core')
|
||||||
|
|
||||||
|
compileOnly 'io.papermc.paper:paper-api:1.21.10-R0.1-SNAPSHOT'
|
||||||
|
compileOnly 'org.geysermc.floodgate:api:2.2.4-SNAPSHOT'
|
||||||
|
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
|
||||||
|
implementation 'com.sparkjava:spark-core:2.9.4'
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package eu.mhsl.craftattack.spawn.event.appliances.deathrun;
|
||||||
|
|
||||||
|
import eu.mhsl.craftattack.spawn.core.appliance.Appliance;
|
||||||
|
import eu.mhsl.craftattack.spawn.event.appliances.eventController.Event;
|
||||||
|
|
||||||
|
public class Deathrun extends Appliance implements Event {
|
||||||
|
@Override
|
||||||
|
public String displayName() {
|
||||||
|
return "Deathrun";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package eu.mhsl.craftattack.spawn.event.appliances.eventController;
|
||||||
|
|
||||||
|
public interface Event {
|
||||||
|
String displayName();
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package eu.mhsl.craftattack.spawn.event.appliances.eventController;
|
||||||
|
|
||||||
|
import eu.mhsl.craftattack.spawn.core.appliance.Appliance;
|
||||||
|
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceCommand;
|
||||||
|
import eu.mhsl.craftattack.spawn.event.appliances.eventController.commands.EventCommand;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class EventController extends Appliance {
|
||||||
|
@Override
|
||||||
|
protected @NotNull List<ApplianceCommand<?>> commands() {
|
||||||
|
return List.of(
|
||||||
|
new EventCommand()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package eu.mhsl.craftattack.spawn.event.appliances.eventController.commands;
|
||||||
|
|
||||||
|
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceCommand;
|
||||||
|
import eu.mhsl.craftattack.spawn.event.appliances.eventController.EventController;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class EventCommand extends ApplianceCommand<EventController> {
|
||||||
|
public EventCommand() {
|
||||||
|
super("event");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void execute(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
|
if(args.length == 0) throw new Error("No argument selected!");
|
||||||
|
|
||||||
|
switch(args[0]) {
|
||||||
|
case "select": {
|
||||||
|
sender.sendMessage("select");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "start": {
|
||||||
|
sender.sendMessage("start");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "pause": {
|
||||||
|
sender.sendMessage("pause");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "resume": {
|
||||||
|
sender.sendMessage("resume");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "stop": {
|
||||||
|
sender.sendMessage("stop");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: throw new Error("No such option: '%s' !".formatted(args[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
|
if(args.length == 1) return List.of("select", "start", "pause", "resume", "stop");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,4 +4,5 @@ include 'core'
|
|||||||
include 'craftattack'
|
include 'craftattack'
|
||||||
include 'common'
|
include 'common'
|
||||||
include 'varo'
|
include 'varo'
|
||||||
|
include 'event'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user