mirror of
https://github.com/YouHaveTrouble/YardWatch.git
synced 2026-05-11 22:16:58 +00:00
Upgrade Java version and refactor WorldGuardProtection class
The Java version in pom.xml has been updated from 1.8 to 17. Also, the WorldGuardProtection.java class has been refactored for cleaner code. Specifically, a condition check and player definition are now combined into a single line to improve readability and efficiency.
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<description>Implementation of YardWatchAPI for common protection plugins</description>
|
<description>Implementation of YardWatchAPI for common protection plugins</description>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>17</java.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<url>https://youhavetrouble.me</url>
|
<url>https://youhavetrouble.me</url>
|
||||||
@@ -81,6 +81,12 @@
|
|||||||
<groupId>com.sk89q.worldguard</groupId>
|
<groupId>com.sk89q.worldguard</groupId>
|
||||||
<artifactId>worldguard-bukkit</artifactId>
|
<artifactId>worldguard-bukkit</artifactId>
|
||||||
<version>7.0.4-SNAPSHOT</version>
|
<version>7.0.4-SNAPSHOT</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.bstats</groupId>
|
||||||
|
<artifactId>bstats-bukkit</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -81,8 +81,7 @@ public class WorldGuardProtection implements Protection {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canDamage(Entity attacker, Entity target) {
|
public boolean canDamage(Entity attacker, Entity target) {
|
||||||
if (!isEnabled()) return true;
|
if (!isEnabled()) return true;
|
||||||
if (!(attacker instanceof Player)) return true;
|
if (!(attacker instanceof Player player)) return true;
|
||||||
Player player = (Player) attacker;
|
|
||||||
com.sk89q.worldedit.util.Location wgLocation = BukkitAdapter.adapt(target.getLocation());
|
com.sk89q.worldedit.util.Location wgLocation = BukkitAdapter.adapt(target.getLocation());
|
||||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player, true);
|
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player, true);
|
||||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||||
|
|||||||
Reference in New Issue
Block a user