Skip to content

Commit

Permalink
Add bedrock bypass
Browse files Browse the repository at this point in the history
  • Loading branch information
SrBedrock committed Jun 27, 2024
1 parent bbbbddc commit 3ae07c9
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 2 deletions.
90 changes: 90 additions & 0 deletions dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.gpaddons</groupId>
<artifactId>gpclaimexpiration</artifactId>
<name>GPClaimExpiration</name>
<version>1.0.6-SNAPSHOT</version>
<description>Automatic expiration of GP claims.</description>
<developers>
<developer>
<name>Jikoo</name>
</developer>
</developers>
<build>
<defaultGoal>clean package</defaultGoal>
<resources>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>*.yml</include>
</includes>
</resource>
</resources>
<finalName>${project.name}</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<relocations>
<relocation>
<pattern>com.github.jikoo.planarwrappers</pattern>
<shadedPattern>com.github.gpaddons.gpclaimexpiration.planarwrappers</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>24.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.TechFortress</groupId>
<artifactId>GriefPrevention</artifactId>
<version>3562a238dd</version>
<scope>provided</scope>
</dependency>
</dependencies>
<properties>
<maven.compiler.target>17</maven.compiler.target>
<project.api-version>1.16</project.api-version>
<maven.compiler.source>17</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.github.gpaddons</groupId>
<artifactId>gpclaimexpiration</artifactId>
<version>1.0.1-SNAPSHOT</version>
<version>1.0.7-SNAPSHOT</version>
<name>GPClaimExpiration</name>
<description>Automatic expiration of GP claims.</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.github.gpaddons.util.lang.Lang;
import com.github.gpaddons.util.lang.MessageReplacement;
import me.ryanhamshire.GriefPrevention.Claim;
import me.ryanhamshire.GriefPrevention.CustomLogEntryTypes;
import me.ryanhamshire.GriefPrevention.GriefPrevention;
import me.ryanhamshire.GriefPrevention.PlayerData;
import org.bukkit.OfflinePlayer;
Expand All @@ -20,6 +21,7 @@
import java.util.Map;
import java.util.Optional;
import java.util.TreeMap;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import java.util.stream.Collectors;
Expand All @@ -41,6 +43,8 @@ public void onEnable()
// Load configured claim durations.
loadAreaDurations();

getLogger().warning(String.format("Claim expiration durations loaded. Shortest duration is %d", getShortestClaimExpiration()));

// Unregister existing listeners.
HandlerList.unregisterAll(this);

Expand Down Expand Up @@ -128,7 +132,15 @@ public boolean isExempt(@NotNull OfflinePlayer player)
{
if (player.isOnline()) return true;

PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId());
UUID uuid = player.getUniqueId();

if (uuid.toString().startsWith("00000000-0000-0000")) {
GriefPrevention.AddLogEntry(String.format("[GPClaimExpiration] %s is exempt from expiration due to bedrock.",
uuid), CustomLogEntryTypes.Debug, true);
return true;
}

PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(uuid);

if (exceedsConfigInt("expiration.bypass.claim_blocks", playerData::getAccruedClaimBlocks)) return true;

Expand Down

0 comments on commit 3ae07c9

Please sign in to comment.