Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ players:
| `<result-from />` | Uses the result from a round with a matching id - useful to stop repeating veto deciders | `id="map-name"` | N/A |
| `<veto>` | Represents a veto round | `id="veto"` | **Required:** `<decider>`, `<options>`, `<order>` |
| `<decider>` | Which team vetoes first | N/A | A round |
| `<options>` | What vetos should there be | `name` on the child element - what name should be displayed in the veto | Round(s) |
| `<order>` | The veto order (ban, pick, etc.). The last element is enacted by the system (not by a team and so should not have the who attribute). | `ban-until="3"` (ban until 3 maps are left), `starting-team="2"` (the team who lost the decider starts), `time="30"` - the time in seconds that each team has to veto | If no attributes are present, `<pick />` and `<ban />` |
| `<options>` | What vetos should there be | `name` on the child element - what name should be displayed in the veto | At least 2 rounds |
| `<order>` | The veto order (ban, pick, etc.), with one element per option and at least one pick. The last element is enacted by the system (not by a team and so should not have a `team` attribute). | `ban-until="3"` (ban until 3 maps are left), `starting-team="2"` (the team who lost the decider starts), `time="30"` - the time in seconds that each team has to veto | If no attributes are present, `<pick />` and `<ban />` |
| `<pick />` | A pick in the veto | `team="0"` - the team that gets to pick a map (zero is random map picked), `insert="back"` - whether the map should be added to the front or back of the maps to be played | N/A |
| `<ban />` | A ban in the veto | `team="0"` - the team that gets to ban a map (zero is random map banned), `insert="back"` - whether the map should be added to the front or back of the maps to be played | N/A |

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ tasks {
expand(
mapOf(
"description" to description,
"apiVersion" to "1.21.11",
"apiVersion" to "26.2",
"mainClass" to "dev.pgm.events.EventsPlugin",
"version" to version,
"commitHash" to commitHash.get(),
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repositories {
}

dependencies {
implementation("com.gradleup.shadow:com.gradleup.shadow.gradle.plugin:9.4.2")
implementation("com.diffplug.gradle.spotless:com.diffplug.gradle.spotless.gradle.plugin:8.6.0")
implementation("de.skuzzle.restrictimports:de.skuzzle.restrictimports.gradle.plugin:3.0.0")
implementation("com.gradleup.shadow:com.gradleup.shadow.gradle.plugin:9.6.1")
implementation("com.diffplug.spotless:com.diffplug.spotless.gradle.plugin:8.10.4")
implementation("de.skuzzle.restrictimports:de.skuzzle.restrictimports.gradle.plugin:3.0.2")
}
25 changes: 17 additions & 8 deletions buildSrc/src/main/kotlin/buildlogic.java-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import de.skuzzle.restrictimports.gradle.RestrictImports

plugins {
`java-library`
id("com.diffplug.spotless")
Expand All @@ -6,7 +8,7 @@ plugins {

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
languageVersion = JavaLanguageVersion.of(25)
}
}

Expand All @@ -21,14 +23,14 @@ repositories {

dependencies {
// Annotations
api("org.jspecify:jspecify:1.0.0")
api("org.jspecify:jspecify:1.0.1")
compileOnly("org.jetbrains:annotations:26.1.0")
compileOnly("org.incendo:cloud-annotations:2.0.0")

// Provided dependencies
compileOnly("dev.pgm.paper:paper-api:1.8_1.21.11-SNAPSHOT")
compileOnly("dev.pgm.paper:paper-api:1.8_26.2-SNAPSHOT")
compileOnly("tc.oc.pgm:core:0.16-SNAPSHOT") { isTransitive = false }
compileOnly("net.kyori:adventure-api:4.26.1")
compileOnly("net.kyori:adventure-api:5.2.0")
compileOnly("com.google.guava:guava:17.0")
}

Expand All @@ -50,17 +52,24 @@ spotless {
removeUnusedImports()
trimTrailingWhitespace()
formatAnnotations()
palantirJavaFormat("2.93.0").style("GOOGLE").formatJavadoc(true)
palantirJavaFormat("2.102.0").style("GOOGLE").formatJavadoc(true)
}
}

restrictImports {
group {
tasks {
// Bypass inability to have two groups with same base packages inside the import restriction plugin
val restrictJavaxAnnotations = register<RestrictImports>("restrictJavaxAnnotations") {
group = "verification"
reason = "Use org.jspecify.annotations to add annotations, or org.jetbrains.annotations if needed"
bannedImports = listOf("javax.annotation.**")
}
group {
val restrictAsserts = register<RestrictImports>("restrictAsserts") {
group = "verification"
reason = "Use tc.oc.pgm.util.Assert to add assertions"
bannedImports = listOf("com.google.common.base.Preconditions.**", "java.util.Objects.requireNonNull")
}
// Enforce the import restrictions
check {
dependsOn(restrictJavaxAnnotations, restrictAsserts)
}
}
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
//org.gradle.configuration-cache=true
# https://github.com/diffplug/spotless/issues/2850
org.gradle.configuration-cache=false
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.1-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
Expand Down
4 changes: 2 additions & 2 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 43 additions & 13 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions samples/formats/bo3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<match>Limbo II</match>
<match>Golden Drought II</match>
</options>
<order ban-until="2" starting-team="2"/>
</veto>
<match>Boom</match><!-- Tiebreaker -->
</format>
1 change: 1 addition & 0 deletions samples/formats/group.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<match>Facility TE</match>
<match>Dwyer Hill</match>
</options>
<order ban-until="2" starting-team="2"/>
</veto>
<match>Boom</match><!-- Tiebreaker -->
</format>
13 changes: 1 addition & 12 deletions src/main/java/dev/pgm/events/api/events/TournamentEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

import dev.pgm.events.format.TournamentFormat;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

public class TournamentEvent extends Event {
public abstract class TournamentEvent extends Event {

private static final HandlerList handlers = new HandlerList();
private final TournamentFormat tournamentFormat;

public TournamentEvent(TournamentFormat tournamentFormat) {
Expand All @@ -16,13 +14,4 @@ public TournamentEvent(TournamentFormat tournamentFormat) {
public TournamentFormat format() {
return tournamentFormat;
}

public static HandlerList getHandlerList() {
return handlers;
}

@Override
public HandlerList getHandlers() {
return handlers;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,33 @@
import dev.pgm.events.format.TournamentFormat;
import dev.pgm.events.team.TournamentTeam;
import java.util.Optional;
import org.bukkit.event.HandlerList;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
public class TournamentFinishedEvent extends TournamentEvent {

private final Optional<TournamentTeam> winningTeam;
private static final HandlerList HANDLER_LIST = new HandlerList();

private final @Nullable TournamentTeam winningTeam;

public TournamentFinishedEvent(
TournamentFormat tournamentFormat, Optional<TournamentTeam> winningTeam) {
TournamentFormat tournamentFormat, @Nullable TournamentTeam winningTeam) {
super(tournamentFormat);
this.winningTeam = winningTeam;
}

public Optional<TournamentTeam> winningTeam() {
return winningTeam;
return Optional.ofNullable(winningTeam);
}

@Override
public HandlerList getHandlers() {
return HANDLER_LIST;
}

public static HandlerList getHandlerList() {
return HANDLER_LIST;
}
}
14 changes: 14 additions & 0 deletions src/main/java/dev/pgm/events/api/events/TournamentStartEvent.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
package dev.pgm.events.api.events;

import dev.pgm.events.format.TournamentFormat;
import org.bukkit.event.HandlerList;
import org.jspecify.annotations.NullMarked;

@NullMarked
public class TournamentStartEvent extends TournamentEvent {

private static final HandlerList HANDLER_LIST = new HandlerList();

public TournamentStartEvent(TournamentFormat tournamentFormat) {
super(tournamentFormat);
}

@Override
public HandlerList getHandlers() {
return HANDLER_LIST;
}

public static HandlerList getHandlerList() {
return HANDLER_LIST;
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package dev.pgm.events.api.teams;

import static net.kyori.adventure.text.Component.text;

import com.google.common.collect.Maps;
import dev.pgm.events.EventsPlugin;
import dev.pgm.events.team.TournamentTeam;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.Bukkit;
import tc.oc.pgm.util.Audience;
Expand Down Expand Up @@ -55,8 +56,8 @@ public void reload() {
teams.forEach(x -> teamMap.put(x.getName(), x));
Bukkit.getOnlinePlayers().stream()
.filter(x -> x.hasPermission("events.staff"))
.forEach(x -> Audience.get(x)
.sendMessage(Component.text("Teams reloaded!", NamedTextColor.AQUA)));
.forEach(
x -> Audience.get(x).sendMessage(text("Teams reloaded!", NamedTextColor.AQUA)));
});
});
}
Expand Down
Loading
Loading