mirror of
https://github.com/YouHaveTrouble/YardWatch.git
synced 2026-05-12 14:36: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:
@@ -81,8 +81,7 @@ public class WorldGuardProtection implements Protection {
|
||||
@Override
|
||||
public boolean canDamage(Entity attacker, Entity target) {
|
||||
if (!isEnabled()) return true;
|
||||
if (!(attacker instanceof Player)) return true;
|
||||
Player player = (Player) attacker;
|
||||
if (!(attacker instanceof Player player)) return true;
|
||||
com.sk89q.worldedit.util.Location wgLocation = BukkitAdapter.adapt(target.getLocation());
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player, true);
|
||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
|
||||
Reference in New Issue
Block a user