Skip to content

Commit

Permalink
Temporarily build against Folia
Browse files Browse the repository at this point in the history
Plugin will not run on Paper or Spigot in this state. The plan is to get things working on Folia, and then switch back to the Spigot API and replace the Folia-specific calls with reflection.
  • Loading branch information
rutgerkok committed Apr 11, 2023
1 parent 7d9007e commit 8c44559
Show file tree
Hide file tree
Showing 18 changed files with 335 additions and 191 deletions.
266 changes: 129 additions & 137 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,143 +1,135 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>nl.rutgerkok</groupId>
<artifactId>blocklocker</artifactId>
<version>1.12.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>BlockLocker</name>
<url>https://github.com/rutgerkok/BlockLocker</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.jupiter.version>5.3.1</junit.jupiter.version>
</properties>

<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>rutger-repo</id>
<url>https://rutgerkok.nl/repo</url>
</repository>
<repository>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>nl.rutgerkok</groupId>
<artifactId>blocklocker</artifactId>
<version>1.12.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>BlockLocker</name>
<url>https://github.com/rutgerkok/BlockLocker</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.jupiter.version>5.3.1</junit.jupiter.version>
</properties>
<repositories>
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<repository>
<id>rutger-repo</id>
<url>https://rutgerkok.nl/repo</url>
</repository>
<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion> <!-- Don't pull in an outdated version of JUnit -->
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Third party plugins -->
<dependency>
<groupId>com.palmergames</groupId>
<artifactId>towny</artifactId>
<version>0.96.7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.massivecraft</groupId>
<artifactId>MassiveCore</artifactId>
<version>2.7.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.massivecraft</groupId>
<artifactId>Factions</artifactId>
<version>2.7.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.218</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.glaremasters</groupId>
<artifactId>guilds</artifactId>
<version>3.5.3.5-RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.sacredlabyrinth.phaed.simpleclans</groupId>
<artifactId>SimpleClans</artifactId>
<version>2.15.1</version>
<scope>provided</scope>
</dependency>

<!-- Tests -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.23.0</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<!-- Define filtering for the inclusion of plugin.yml, so we can utilize
</repositories>
<dependencies>
<dependency>
<groupId>dev.folia</groupId>
<artifactId>folia-api</artifactId>
<version>1.19.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<!-- Don't pull in an outdated version of JUnit -->
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Third party plugins -->
<dependency>
<groupId>com.palmergames</groupId>
<artifactId>towny</artifactId>
<version>0.96.7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.massivecraft</groupId>
<artifactId>MassiveCore</artifactId>
<version>2.7.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.massivecraft</groupId>
<artifactId>Factions</artifactId>
<version>2.7.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.218</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.glaremasters</groupId>
<artifactId>guilds</artifactId>
<version>3.5.3.5-RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.sacredlabyrinth.phaed.simpleclans</groupId>
<artifactId>SimpleClans</artifactId>
<version>2.15.1</version>
<scope>provided</scope>
</dependency>
<!-- Tests -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.23.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Define filtering for the inclusion of plugin.yml, so we can utilize
the pom.xml version in it -->
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<includes>
<include>*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
</plugins>
</build>

<distributionManagement>
<repository>
<id>codemc-releases</id>
<url>https://repo.codemc.io/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<includes>
<include>*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>codemc-releases</id>
<url>https://repo.codemc.io/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>
3 changes: 1 addition & 2 deletions src/main/java/nl/rutgerkok/blocklocker/BlockLockerAPIv2.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package nl.rutgerkok.blocklocker;

import java.util.Date;
import java.util.UUID;
import java.util.Optional;
import java.util.UUID;

import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
Expand Down Expand Up @@ -31,7 +31,6 @@ public final class BlockLockerAPIv2 {
* The block.
* @return The owner, or empty if the block is not protected.
*/
@SuppressWarnings("deprecation")
public static Optional<OfflinePlayer> getOwner(Block block) {
Optional<Protection> protection = getPlugin().getProtectionFinder().findProtection(block);
if (!protection.isPresent()) {
Expand Down
23 changes: 21 additions & 2 deletions src/main/java/nl/rutgerkok/blocklocker/BlockLockerPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.logging.Logger;

import org.bukkit.block.Block;
import org.bukkit.event.Event;

import nl.rutgerkok.blocklocker.group.CombinedGroupSystem;
Expand Down Expand Up @@ -103,18 +104,36 @@ public interface BlockLockerPlugin {
/**
* Runs a task the next tick on the server thread.
*
* @param block
* Used to run the task in the region of the block (when using the
* Folia server).
* @param runnable
* The task.
*/
void runLater(Runnable runnable);
void runLater(Block block, Runnable runnable);

/**
* Runs a task in the given amount of ticks on the server thread.
*
* @param block
* Used to run the task in the region of the block (when using the
* Folia server).
* @param runnable
* The task.
* @param ticks
* In how many ticks the method needs to run.
*/
void runLater(Runnable runnable, int ticks);
void runLater(Block block, Runnable runnable, int ticks);

/**
* Runs a task on the server thread. On Folia, this thread only controls things
* that don't belong to a specific region, like weather and time.
*
* @param runnable
* The task.
* @param ticks
* In how many ticks the method needs to run.
*/
void runLaterGlobally(Runnable runnable, int ticks);

}
Loading

0 comments on commit 8c44559

Please sign in to comment.