Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
e8deab3
Bump Lamp (command framework) to version `3.1.7` (#37)
Tofpu Oct 29, 2023
09040e5
Allow offline player data to be reset (#40)
Tofpu Oct 29, 2023
c35d27d
Add JetBrains to `thank you` section
Tofpu Oct 29, 2023
0e19bcc
Sort session leaderboard (#42)
Tofpu Dec 22, 2023
1a3ac77
Bump the next release of sb2 to 1.1.3
Tofpu Dec 22, 2023
df8f0c7
Remove empty directories, and rename `speedbridge-spigot-plugin` to j…
Tofpu Jan 23, 2024
a73af54
Make sure player is online before teleporting them to the lobby
Tofpu Feb 23, 2024
3e1225a
Bump patch version to 1.1.4
Tofpu Feb 23, 2024
f7f1e74
Allow admins to change a player's selected block type via command
Tofpu Mar 12, 2024
dd2482a
Bump toolbar (formally umbrella) version to add support for 1.20.4
Tofpu Dec 21, 2023
f67c347
Relocate spigot-related dependency to the appropriate module
Tofpu Apr 17, 2024
39fee3f
Add more materials support to `admin set selectedBlockType` subcommand
Tofpu Apr 17, 2024
885dc6c
Relocate repositories and remove unneeded dependencies
Tofpu Apr 17, 2024
e210c9f
Fix `lobby missing` message sent to non-opped player on join
Tofpu Apr 17, 2024
429249a
Send error message if provided block material matches with what the p…
Tofpu Apr 17, 2024
ed19567
Let `randomJoin` subcommand optionally accept a target player
Tofpu Apr 17, 2024
b5a2ac3
Abort game if player world changes while in a game
Tofpu Apr 17, 2024
255357c
Fix IllegalArgumentException exception when running `randomJoin` subc…
Tofpu Apr 17, 2024
91e03d1
Use newer umbrella dependency (`toolbar`)
Tofpu Apr 17, 2024
90e8adc
Exclude sender from autocompletion of online players
Tofpu Apr 17, 2024
7a40c6d
Bump Lamp version to `3.2.1` from `3.1.7`
Tofpu Apr 17, 2024
f475e83
Reformat code
Tofpu Apr 17, 2024
395d627
Prevent player from crafting while in a game
Tofpu Apr 17, 2024
c471660
Add optional target argument to a couple of commands
Tofpu Apr 17, 2024
1e562fd
Remove debug console logs
Tofpu Apr 17, 2024
8b98655
Change `setup` to `setup create` for creating setups to make other se…
Tofpu Apr 21, 2024
1767c4a
Merge branch 'v1-spigot' into dev/v1-spigot-dev
Tofpu May 6, 2024
7152689
Lock `sb randomjoin` behind a permission node
Tofpu May 6, 2024
9a637b5
Lock `sb islands` behind a permission node
Tofpu May 6, 2024
e2b45bb
Allow admins to change a player's selected block type via command
Tofpu Mar 12, 2024
b35c0ef
Bump toolbar (formally umbrella) version to add support for 1.20.4
Tofpu Dec 21, 2023
b0ad084
Relocate spigot-related dependency to the appropriate module
Tofpu Apr 17, 2024
f40aedf
Add more materials support to `admin set selectedBlockType` subcommand
Tofpu Apr 17, 2024
b75d398
Relocate repositories and remove unneeded dependencies
Tofpu Apr 17, 2024
b90edd5
Fix `lobby missing` message sent to non-opped player on join
Tofpu Apr 17, 2024
d106b9b
Send error message if provided block material matches with what the p…
Tofpu Apr 17, 2024
7c661d3
Let `randomJoin` subcommand optionally accept a target player
Tofpu Apr 17, 2024
1afc303
Abort game if player world changes while in a game
Tofpu Apr 17, 2024
e52c756
Fix IllegalArgumentException exception when running `randomJoin` subc…
Tofpu Apr 17, 2024
b826eed
Use newer umbrella dependency (`toolbar`)
Tofpu Apr 17, 2024
bb3af36
Exclude sender from autocompletion of online players
Tofpu Apr 17, 2024
6aacaa3
Bump Lamp version to `3.2.1` from `3.1.7`
Tofpu Apr 17, 2024
d94d1a7
Reformat code
Tofpu Apr 17, 2024
0dca31e
Prevent player from crafting while in a game
Tofpu Apr 17, 2024
25807b1
Add optional target argument to a couple of commands
Tofpu Apr 17, 2024
156ddba
Remove debug console logs
Tofpu Apr 17, 2024
d9f64d7
Change `setup` to `setup create` for creating setups to make other se…
Tofpu Apr 21, 2024
7d3474a
Lock `sb randomjoin` behind a permission node
Tofpu May 6, 2024
3da99ee
Lock `sb islands` behind a permission node
Tofpu May 6, 2024
0be3ece
Change `sb admin set selectedBlockType` to `sb player set block`
Tofpu May 6, 2024
ac05aa7
Change `sb reset <player>` to `sb player reset <player>`
Tofpu May 6, 2024
df0665b
Overhaul the help system to be more descriptive
Tofpu May 24, 2024
05e4423
Add a config option for not clearing player's inventory on join
Tofpu Jun 1, 2024
5a08c3d
Abort game if player world changes while in a game
Tofpu Apr 17, 2024
cc781a6
Fix merge conflicts
Tofpu Jun 27, 2024
7f7516a
Add preview images
Tofpu Jun 27, 2024
0be7be2
Overhaul the help system to be more descriptive
Tofpu May 24, 2024
404cec4
Relocate setup related commands to a new internal setup command class
Tofpu Aug 14, 2024
e056567
Revert command breaking changes involving user commands
Tofpu Aug 14, 2024
43bda31
Register brigadier for sb commands
Tofpu Aug 14, 2024
4cc16ad
Fix extra wrong method?
Tofpu May 24, 2024
c3b84d8
Fix toolbar dependency not loading
Tofpu Aug 14, 2024
fca9a94
Add PAPI support for all messages
Tofpu Aug 14, 2024
3135755
Remove unnecessary comments
Tofpu Aug 15, 2024
36adcf0
Add `general.check-for-updates` option to config.yml
Tofpu Aug 15, 2024
2972861
Avoid sending update notification to operators on join when check-for…
Tofpu Aug 15, 2024
9326421
Allow name and score to be retrieved separately from the leaderboard …
Tofpu Aug 21, 2024
f1fbdeb
Fix PAPI placeholder not being replaced for certain messages
Tofpu Aug 22, 2024
64f0d90
Remove check for @Nullable annotation on GameIsland parameter
Tofpu Aug 23, 2024
e7688b3
Fix older versions of PAPI not being avialable
Tofpu Oct 19, 2024
2a8ef6c
Use latest version of MultiWorldEdit to support 1.12.x
Tofpu Oct 26, 2024
f0a8279
Use v4 of actions/upload-artifact
Tofpu Oct 26, 2024
6a5813f
Fix workflow using old spigot jar path
Tofpu Oct 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/automatic-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
arguments: shadowJar

- name: Uploading
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: SpeedBridge-2
path: ${{ github.workspace }}/speedbridge2-spigot-plugin/build/libs/*.jar
path: ${{ github.workspace }}/spigot/build/libs/*.jar
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ buildNumber.properties

# Common working directory
run/
run-*/
demo
dep.txt
memory
Expand Down
28 changes: 0 additions & 28 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,6 @@ allprojects {
group = "io.tofpu.speedbridge2"
version = "1.1.4-" + "git rev-parse --short=8 HEAD".runCommand(rootDir)

repositories {
mavenLocal()
mavenCentral()

maven("https://jitpack.io")
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
maven("https://maven.enginehub.org/repo/")
maven("https://oss.sonatype.org/content/groups/public/")
maven("https://repo.codemc.org/repository/maven-public/")
maven("https://libraries.minecraft.net")
}

dependencies {
compileOnly("org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT")

implementation("com.github.Revxrsal.Lamp:common:3.1.7")

implementation("net.kyori:adventure-api:4.10.1")
implementation("net.kyori:adventure-text-minimessage:4.10.1")

implementation("com.github.tofpu:DynamicClass:1.1") {
exclude("com.google.guava", "guava")
}

testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
}

publishing {
publications {
create<MavenPublication>("maven") {
Expand Down
Binary file added image/screenshots/bridging.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/screenshots/scored.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 32 additions & 9 deletions spigot/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,29 @@ plugins {
id("xyz.jpenilla.run-paper") version "2.0.1"
}

repositories {
mavenLocal()
mavenCentral()

maven("https://jitpack.io")
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
maven("https://maven.enginehub.org/repo/")
maven("https://oss.sonatype.org/content/groups/public/")
maven("https://repo.codemc.org/repository/maven-public/")
maven("https://libraries.minecraft.net")
}

dependencies {
compileOnly("org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT")

compileOnly("org.xerial:sqlite-jdbc:3.36.0.3")
compileOnly("com.sk89q:worldedit:6.0.0-SNAPSHOT")

implementation("com.github.Revxrsal.Lamp:bukkit:3.1.7")
implementation("com.github.Revxrsal.Lamp:common:3.2.1")
implementation("com.github.Revxrsal.Lamp:bukkit:3.2.1")

implementation("net.kyori:adventure-api:4.10.1")
implementation("net.kyori:adventure-text-minimessage:4.10.1")
implementation("net.kyori:adventure-platform-bukkit:4.0.1")

implementation("com.github.tofpu:DynamicClass:1.1") {
Expand All @@ -20,22 +38,25 @@ dependencies {

implementation("org.bstats:bstats-bukkit:3.0.0")

compileOnly("me.clip:placeholderapi:2.10.10")
compileOnly("me.clip:placeholderapi:2.11.6")

implementation("com.github.ben-manes.caffeine:caffeine:2.9.3")

implementation("com.github.cryptomorin:XSeries:8.7.1")
implementation("com.github.tofpu.MultiWorldEdit:multiworldedit-api:0eb85d6cbd") {
implementation("com.github.tofpu.MultiWorldEdit:multiworldedit-api:8930fd3caa") {
exclude("de.schlichtherle", "truezip")
exclude("rhino", "js")
exclude("com.sk89q", "worldedit")
}

implementation("com.github.tofpu:umbrella:1.20-support-SNAPSHOT")
implementation("com.github.Tofpu:toolbar:v1-SNAPSHOT")
implementation("com.github.Tofpu:dynamicclass:1.3") {
exclude("com.google.guava", "guava")
}
}

tasks {
named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
shadowJar {
archiveName = "Speedbridge2-${version}-all.jar"

dependencies {
Expand All @@ -56,8 +77,10 @@ tasks {
}

runServer {
minecraftVersion("1.8.8")
// pluginJars(project.file("libs/worldedit-bukkit-7.2.15.jar"))
pluginJars(project.file("libs/worldedit-bukkit-6.1.jar"))
// minecraftVersion("1.8.8")
// pluginJars(project.file("libs/worldedit-bukkit-6.1.jar"))
// minecraftVersion("1.20.4")
minecraftVersion("1.19.4")
pluginJars(project.file("libs/worldedit-bukkit-7.3.0.jar"))
}
}
}
56 changes: 28 additions & 28 deletions spigot/src/main/java/io/tofpu/speedbridge2/SpeedBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import io.tofpu.dynamicclass.DynamicClass;
import io.tofpu.multiworldedit.MultiWorldEditAPI;
import io.tofpu.speedbridge2.command.CommandManager;
import io.tofpu.speedbridge2.command.subcommand.HelpCommandGenerator;
import io.tofpu.speedbridge2.model.blockmenu.BlockMenuManager;
import io.tofpu.speedbridge2.model.common.Message;
import io.tofpu.speedbridge2.model.common.PluginExecutor;
Expand Down Expand Up @@ -50,6 +49,13 @@ public SpeedBridge(final JavaPlugin javaPlugin) {
this.leaderboard = new Leaderboard(playerService);
}

public static BukkitAudiences getAdventure() {
if (adventure == null) {
throw new IllegalStateException("Tried to access Adventure when the plugin was disabled!");
}
return adventure;
}

public void load() {
// reset the world, in-case it does exist
arenaManager.resetWorld();
Expand Down Expand Up @@ -84,7 +90,7 @@ public void enable() {

if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
ExpansionHandler.INSTANCE.load();

log("Hooking into PlaceholderAPI...");
new PluginExpansion(javaPlugin, playerService);
}
Expand Down Expand Up @@ -133,25 +139,26 @@ public void enable() {
log("Loading the messages...");
Message.load(javaPlugin.getDataFolder());

log("Generating `/sb help` message...");
HelpCommandGenerator.generateHelpCommand(javaPlugin);

log("Checking for an update...");
UpdateChecker.init(javaPlugin, 100619)
.requestUpdateCheck()
.whenComplete((updateResult, throwable) -> {
if (throwable != null) {
log("Couldn't check for an update...");
return;
}

if (updateResult.requiresUpdate()) {
log("You're using an outdated version of SpeedBridge!");
log("You can download the latest version at https://www.spigotmc.org/resources/.100619/");
} else {
log("You're using the latest version!");
}
});
if (ConfigurationManager.INSTANCE.getGeneralCategory().shouldCheckForUpdates()) {
log("Checking for an update...");
UpdateChecker.init(javaPlugin, 100619)
.requestUpdateCheck()
.whenComplete((updateResult, throwable) -> {
if (throwable != null) {
log("Couldn't check for an update...");
return;
}

if (updateResult.requiresUpdate()) {
log("You're using an outdated version of SpeedBridge!");
log("You can download the latest version at https://www.spigotmc.org/resources/.100619/");
} else {
log("You're using the latest version!");
}
});
} else {
log("Not checking for an update as it was explicitly disabled in the config.");
}
}

public void shutdown() {
Expand All @@ -177,11 +184,4 @@ public void shutdown() {
private void log(final String content) {
javaPlugin.getLogger().info(content);
}

public static BukkitAudiences getAdventure() {
if(adventure == null) {
throw new IllegalStateException("Tried to access Adventure when the plugin was disabled!");
}
return adventure;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import io.tofpu.dynamicclass.DynamicClass;
import io.tofpu.speedbridge2.command.condition.AbstractCommandConditionWrapper;
import io.tofpu.speedbridge2.command.condition.LampConditionRegistry;
import io.tofpu.speedbridge2.command.condition.annotation.OptionalPermission;
import io.tofpu.speedbridge2.command.context.AbstractLampContext;
import io.tofpu.speedbridge2.command.context.LampContextRegistry;
import io.tofpu.speedbridge2.command.help.HelpGenerator;
import io.tofpu.speedbridge2.command.parser.AbstractLampParser;
import io.tofpu.speedbridge2.command.parser.LampParseRegistry;
import io.tofpu.speedbridge2.command.subcommand.CommandCompletion;
Expand All @@ -19,6 +21,7 @@
import io.tofpu.speedbridge2.model.player.object.BridgePlayer;
import io.tofpu.speedbridge2.model.player.object.CommonBridgePlayer;
import io.tofpu.speedbridge2.model.player.object.SenderBridgePlayer;
import org.bukkit.Material;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import revxrsal.commands.bukkit.BukkitCommandActor;
Expand All @@ -29,7 +32,10 @@

import java.util.UUID;

import static io.tofpu.speedbridge2.model.common.util.BridgeUtil.log;

public final class CommandManager {
private static final HelpGenerator helpGenerator = new HelpGenerator();
private static BukkitCommandHandler commandHandler;

public static void load(final @NotNull Plugin plugin,
Expand Down Expand Up @@ -84,16 +90,25 @@ public boolean isCustomType(final Class<?> type) {
constructTabCompleter(islandService);
constructCommandConditions();

commandHandler.register(new SpeedBridgeCommand(playerService, islandService));
commandHandler.registerAnnotationReplacer(OptionalPermission.class, OptionalPermission.AnnotationReplacerImpl.INSTANCE);
commandHandler.registerPermissionReader(OptionalPermission.PermissionReaderImpl.INSTANCE);

commandHandler.accept(new SpeedBridgeCommand(helpGenerator, playerService, islandService));
commandHandler.register(new SpeedBridgeDebugCommand(arenaManager));

log("Generating `/sb help` message...");
helpGenerator.generate(plugin, commandHandler);

commandHandler.registerBrigadier();
}

private static void constructTabCompleter(final @NotNull IslandService islandService) {
BridgeUtil.debug("Constructing tab completer...");

commandHandler.getAutoCompleter()
.registerParameterSuggestions(Island.class,
new CommandCompletion(islandService)::islands);
CommandCompletion commandCompletion = new CommandCompletion(islandService);
commandHandler.getAutoCompleter().registerParameterSuggestions(Island.class, commandCompletion::islands);
commandHandler.getAutoCompleter().registerParameterSuggestions(Material.class, commandCompletion::materials);
commandHandler.getAutoCompleter().registerParameterSuggestions(BridgePlayer.class, commandCompletion::players);
}

private static void constructContext() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public abstract class AbstractCommandConditionWrapper implements CommandConditio
private final Class<? extends Annotation> type;

public AbstractCommandConditionWrapper(final Class<? extends Annotation> type,
final LampConditionRegistry registry) {
final LampConditionRegistry registry) {
this.type = type;
registry.register(type, this);
}
Expand All @@ -35,8 +35,8 @@ public final void test(
}

abstract void execute(@NotNull CommandActor actor,
@NotNull ExecutableCommand command,
@NotNull @Unmodifiable List<String> arguments);
@NotNull ExecutableCommand command,
@NotNull @Unmodifiable List<String> arguments);

public Class<? extends Annotation> getType() {
return type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@

@AutoRegister
public final class LampConditionRegistry extends AbstractLampRegistry<Class<?
extends Annotation>, AbstractCommandConditionWrapper> {}
extends Annotation>, AbstractCommandConditionWrapper> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.tofpu.speedbridge2.command.condition.annotation;

import io.tofpu.speedbridge2.util.material.MaterialCategory;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
public @interface MaterialType {
MaterialCategory category();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package io.tofpu.speedbridge2.command.condition.annotation;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import revxrsal.commands.annotation.Optional;
import revxrsal.commands.annotation.dynamic.AnnotationReplacer;
import revxrsal.commands.annotation.dynamic.Annotations;
import revxrsal.commands.bukkit.BukkitCommandActor;
import revxrsal.commands.command.CommandPermission;
import revxrsal.commands.command.trait.CommandAnnotationHolder;
import revxrsal.commands.process.PermissionReader;

import java.lang.annotation.*;
import java.lang.reflect.AnnotatedElement;
import java.util.Collection;

import static revxrsal.commands.util.Collections.linkedListOf;

@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
public @interface OptionalPermission {
String value();

enum AnnotationReplacerImpl implements AnnotationReplacer<OptionalPermission> {
INSTANCE;

@Override
public Collection<Annotation> replaceAnnotations(@NotNull AnnotatedElement element, @NotNull OptionalPermission annotation) {
Optional optional = Annotations.create(Optional.class);
return linkedListOf(optional, annotation);
}
}

enum PermissionReaderImpl implements PermissionReader {
INSTANCE {
@Override
public @Nullable CommandPermission getPermission(@NotNull CommandAnnotationHolder command) {
OptionalPermission annotation = command.getAnnotation(OptionalPermission.class);
if (annotation == null) return null;
return actor -> {
BukkitCommandActor playerActor = (BukkitCommandActor) actor;
return playerActor.requirePlayer().hasPermission(annotation.value());
};
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface RestrictConsole {}
public @interface RestrictConsole {
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface RestrictDummyModel {}
public @interface RestrictDummyModel {
}
Loading