Skip to content

Commit 2c22529

Browse files
authored
Use MultiversePortalsApi instead of getting portal plugin object (#289)
* Use MultiversePortalsApi instead of getting portal plugin object * Do it in a non api-breaking way
1 parent 5bd8966 commit 2c22529

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main/java/org/mvplugins/multiverse/netherportals/MultiverseNetherPortals.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.logging.Level;
99

1010
import com.dumptruckman.minecraft.util.Logging;
11+
import org.jetbrains.annotations.ApiStatus;
1112
import org.mvplugins.multiverse.core.MultiverseCoreApi;
1213
import org.mvplugins.multiverse.core.config.CoreConfig;
1314
import org.mvplugins.multiverse.core.module.MultiverseModule;
@@ -23,7 +24,7 @@
2324
import org.mvplugins.multiverse.core.command.MVCommandManager;
2425
import org.mvplugins.multiverse.external.jakarta.inject.Inject;
2526
import org.mvplugins.multiverse.external.jakarta.inject.Provider;
26-
import org.mvplugins.multiverse.portals.MultiversePortals;
27+
import org.mvplugins.multiverse.portals.MultiversePortalsApi;
2728
import org.mvplugins.multiverse.portals.utils.PortalManager;
2829

2930
public class MultiverseNetherPortals extends MultiverseModule {
@@ -286,9 +287,8 @@ public boolean isHandledByNetherPortals(Location l) {
286287
if (multiversePortals != null) {
287288
// Catch errors which could occur if classes aren't present or are missing methods.
288289
try {
289-
MultiversePortals portals = (MultiversePortals) multiversePortals;
290-
PortalManager portalManager = portals.getServiceLocator().getActiveService(PortalManager.class);
291-
if (portalManager != null && portalManager.isPortal(l)) {
290+
PortalManager portalManager = MultiversePortalsApi.get().getPortalManager();
291+
if (portalManager.isPortal(l)) {
292292
return false;
293293
}
294294
} catch (Throwable t) {
@@ -298,6 +298,7 @@ public boolean isHandledByNetherPortals(Location l) {
298298
return true;
299299
}
300300

301+
@ApiStatus.Internal
301302
public void setPortals(Plugin multiversePortals) {
302303
this.multiversePortals = multiversePortals;
303304
}

0 commit comments

Comments
 (0)