From e34b7c5d900c9981eafb969e0945bf6b0ed58227 Mon Sep 17 00:00:00 2001 From: George <26337405+Spazzinq@users.noreply.github.com> Date: Fri, 20 Sep 2024 12:34:22 -0400 Subject: [PATCH] Drop support for WE 6 --- .../spazzinq/flightcontrol/FlightControl.java | 4 +- .../flightcontrol/manager/HookManager.java | 7 +--- VersionOld/build.gradle | 7 ---- .../multiversion/legacy/WorldGuard6Hook.java | 40 ------------------- 4 files changed, 4 insertions(+), 54 deletions(-) delete mode 100644 VersionOld/src/main/java/org/spazzinq/flightcontrol/multiversion/legacy/WorldGuard6Hook.java diff --git a/FlightControl/src/main/java/org/spazzinq/flightcontrol/FlightControl.java b/FlightControl/src/main/java/org/spazzinq/flightcontrol/FlightControl.java index c2b6d86b..ab10ecd6 100644 --- a/FlightControl/src/main/java/org/spazzinq/flightcontrol/FlightControl.java +++ b/FlightControl/src/main/java/org/spazzinq/flightcontrol/FlightControl.java @@ -82,7 +82,7 @@ public void onEnable() { private void registerManagers() { boolean isNewSpigotAPI = true; - for (int i = 8; i < 13; i++) { + for (int i = 13; i < 21; i++) { if (getServer().getBukkitVersion().contains("1." + i)) { isNewSpigotAPI = false; break; @@ -96,7 +96,7 @@ private void registerManagers() { updateManager = new UpdateManager(); checkManager = new CheckManager(); - hookManager = new HookManager(isNewSpigotAPI); + hookManager = new HookManager(); particle = isNewSpigotAPI ? new ParticleNewAPI() : new ParticleOldAPI(); flightManager = new FlightManager(); diff --git a/FlightControl/src/main/java/org/spazzinq/flightcontrol/manager/HookManager.java b/FlightControl/src/main/java/org/spazzinq/flightcontrol/manager/HookManager.java index a5940875..e56aa04e 100644 --- a/FlightControl/src/main/java/org/spazzinq/flightcontrol/manager/HookManager.java +++ b/FlightControl/src/main/java/org/spazzinq/flightcontrol/manager/HookManager.java @@ -12,7 +12,6 @@ import org.spazzinq.flightcontrol.multiversion.WorldGuardGenericHook; import org.spazzinq.flightcontrol.multiversion.current.FactionsUUIDHook; import org.spazzinq.flightcontrol.multiversion.current.WorldGuard7Hook; -import org.spazzinq.flightcontrol.multiversion.legacy.WorldGuard6Hook; import org.spazzinq.flightcontrol.placeholder.ClipPlaceholder; import java.util.ArrayList; @@ -20,7 +19,6 @@ public class HookManager { private final FlightControl pl; private final PluginManager pm; - private final boolean isNewSpigotAPI; @Getter private String hookedMsg; private final ArrayList hooked = new ArrayList<>(); @@ -29,9 +27,8 @@ public class HookManager { @Getter private WorldGuardGenericHook worldGuardHook = new WorldGuardGenericHook(); @Getter private FactionsGenericHook factionsHook = new FactionsGenericHook(); - public HookManager(boolean isNewSpigotAPI) { + public HookManager() { pl = FlightControl.getInstance(); - this.isNewSpigotAPI = isNewSpigotAPI; pm = pl.getServer().getPluginManager(); } @@ -40,7 +37,7 @@ public void loadHooks() { loadPlaceholderHooks(); if (pluginLoading("WorldGuard")) { - worldGuardHook = isNewSpigotAPI ? new WorldGuard7Hook() : new WorldGuard6Hook(); + worldGuardHook = new WorldGuard7Hook(); } printLoadedHooks(); diff --git a/VersionOld/build.gradle b/VersionOld/build.gradle index 34236ec8..97c1fb9c 100644 --- a/VersionOld/build.gradle +++ b/VersionOld/build.gradle @@ -3,11 +3,4 @@ dependencies { implementation project(':Multiversion') compileOnly('org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT') { exclude(group: "*") } - compileOnly ('com.sk89q.worldguard:worldguard-legacy:6.1.3-SNAPSHOT') { - exclude group: 'com.google.code.gson' - exclude group: 'com.google.guava' - exclude group: 'junit' - exclude group: 'org.yaml' - exclude group: 'maven' - } } \ No newline at end of file diff --git a/VersionOld/src/main/java/org/spazzinq/flightcontrol/multiversion/legacy/WorldGuard6Hook.java b/VersionOld/src/main/java/org/spazzinq/flightcontrol/multiversion/legacy/WorldGuard6Hook.java deleted file mode 100644 index 4a2636e3..00000000 --- a/VersionOld/src/main/java/org/spazzinq/flightcontrol/multiversion/legacy/WorldGuard6Hook.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is part of FlightControl, which is licensed under the MIT License. - * Copyright (c) 2024 George Fang - */ - -package org.spazzinq.flightcontrol.multiversion.legacy; - -import com.sk89q.worldguard.bukkit.WGBukkit; -import com.sk89q.worldguard.protection.regions.ProtectedRegion; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.spazzinq.flightcontrol.multiversion.WorldGuardGenericHook; - -import java.util.Iterator; - -public class WorldGuard6Hook extends WorldGuardGenericHook { - public boolean isMember(Player p) { - ProtectedRegion region = getRegion(p.getLocation()); - - return region != null && region.hasMembersOrOwners() && region.isMember(WGBukkit.getPlugin().wrapPlayer(p)); - } - - public boolean isOwner(Player p) { - ProtectedRegion region = getRegion(p.getLocation()); - - return region != null && region.hasMembersOrOwners() && region.isOwner(WGBukkit.getPlugin().wrapPlayer(p)); - } - - @Override protected ProtectedRegion getRegion(Location l) { - ProtectedRegion region = null; - Iterator iter = WGBukkit.getRegionManager(l.getWorld()) - .getApplicableRegions(l).iterator(); - - if (iter.hasNext()) { - region = iter.next(); - } - - return region; - } -}