Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void onLoad() {
public void onEnable() {
initializeDependencyInjection(new MultiverseSignPortalsPluginBinder(this));
Logging.setDebugLevel(serviceLocator.getActiveService(CoreConfig.class).getGlobalDebug());
registerEvents(SignPortalsListener.class);
registerDynamicListeners(SignPortalsListener.class);

Logging.config("Version %s (API v%s) Enabled - By %s",
this.getDescription().getVersion(), getVersionAsNumber(), StringFormatter.joinAnd(this.getDescription().getAuthors()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.bukkit.plugin.PluginManager;
import org.mvplugins.multiverse.core.destination.DestinationInstance;
import org.mvplugins.multiverse.core.destination.DestinationsProvider;
import org.mvplugins.multiverse.core.dynamiclistener.annotations.EventMethod;
import org.mvplugins.multiverse.core.teleportation.AsyncSafetyTeleporter;
import org.mvplugins.multiverse.external.jakarta.inject.Inject;
import org.mvplugins.multiverse.external.jetbrains.annotations.NotNull;
Expand All @@ -30,15 +31,14 @@
import org.bukkit.block.Sign;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockRedstoneEvent;
import org.bukkit.event.block.SignChangeEvent;

import static org.mvplugins.multiverse.core.permissions.PermissionUtils.hasPermission;

@Service
public class MVSPBlockListener implements SignPortalsListener {
final class MVSPBlockListener implements SignPortalsListener {
private final String CREATE_PERM = "multiverse.signportal.create";
private final MultiverseSignPortals plugin;
private final PortalDetector pd;
Expand All @@ -58,7 +58,7 @@ public MVSPBlockListener(@NotNull MultiverseSignPortals plugin,
pluginManager.addPermission(new Permission(CREATE_PERM, PermissionDefault.OP));
}

@EventHandler
@EventMethod
public void onSignChange(SignChangeEvent event) {
if (event.isCancelled()) {
return;
Expand All @@ -71,7 +71,7 @@ public void onSignChange(SignChangeEvent event) {
}
}

@EventHandler
@EventMethod
public void redstonePower(BlockRedstoneEvent event) {
if (event.getNewCurrent() <= 0) {
return;
Expand Down Expand Up @@ -140,7 +140,7 @@ private Block getNearbySign(Block block, boolean torch) {
return null;
}

@EventHandler
@EventMethod
public void onBlockBreak(BlockBreakEvent event) {
if (event.isCancelled()) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.bukkit.plugin.PluginManager;
import org.mvplugins.multiverse.core.destination.DestinationInstance;
import org.mvplugins.multiverse.core.destination.DestinationsProvider;
import org.mvplugins.multiverse.core.dynamiclistener.annotations.EventMethod;
import org.mvplugins.multiverse.core.teleportation.AsyncSafetyTeleporter;
import org.mvplugins.multiverse.external.jakarta.inject.Inject;
import org.mvplugins.multiverse.external.jetbrains.annotations.NotNull;
Expand All @@ -25,15 +26,14 @@
import org.bukkit.ChatColor;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPortalEvent;

import static org.mvplugins.multiverse.core.permissions.PermissionUtils.hasPermission;

@Service
public class MVSPPlayerListener implements SignPortalsListener {
final class MVSPPlayerListener implements SignPortalsListener {

private static final String USE_PERMISSION = "multiverse.signportal.use";
private static final String VALIDATE_PERMISSION = "multiverse.signportal.validate";
Expand All @@ -57,7 +57,7 @@ public class MVSPPlayerListener implements SignPortalsListener {
* Called when the portal is ready to take the player to the destination.
* @param event The Portal event.
*/
@EventHandler
@EventMethod
public void playerPortal(PlayerPortalEvent event) {
if (event.isCancelled()) {
return;
Expand Down Expand Up @@ -94,7 +94,7 @@ public void playerPortal(PlayerPortalEvent event) {
* Called when a player clicks on anything.
* @param event The Interact event.
*/
@EventHandler
@EventMethod
public void playerInteract(PlayerInteractEvent event) {
// The event must not be canceled...
if (event.isCancelled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

package org.mvplugins.multiverse.signportals.listeners;

import org.mvplugins.multiverse.core.dynamiclistener.annotations.EventMethod;
import org.mvplugins.multiverse.external.jakarta.inject.Inject;
import org.mvplugins.multiverse.external.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
import org.mvplugins.multiverse.signportals.MultiverseSignPortals;
import org.bukkit.event.EventHandler;
import org.bukkit.event.server.PluginEnableEvent;

@Service
public class MVSPPluginListener implements SignPortalsListener {
final class MVSPPluginListener implements SignPortalsListener {

private final MultiverseSignPortals plugin;

Expand All @@ -28,7 +28,7 @@ public class MVSPPluginListener implements SignPortalsListener {
* This method is fired when any plugin enables.
* @param event The PluginEnable event.
*/
@EventHandler
@EventMethod
public void onPluginEnable(PluginEnableEvent event) {
if (event.getPlugin().getDescription().getName().equals("Multiverse-Core")) {
// this.plugin.setCore(((MultiverseCore) plugin.getServer().getPluginManager().getPlugin("Multiverse-Core")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.bukkit.ChatColor;
import org.mvplugins.multiverse.core.destination.DestinationInstance;
import org.mvplugins.multiverse.core.destination.DestinationsProvider;
import org.mvplugins.multiverse.core.dynamiclistener.annotations.EventMethod;
import org.mvplugins.multiverse.core.event.MVDebugModeEvent;
import org.mvplugins.multiverse.core.event.MVDumpsDebugInfoEvent;
import org.mvplugins.multiverse.core.event.MVPlayerTouchedPortalEvent;
Expand All @@ -20,13 +21,12 @@
import org.mvplugins.multiverse.signportals.MultiverseSignPortals;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.mvplugins.multiverse.signportals.exceptions.MoreThanOneSignFoundException;
import org.mvplugins.multiverse.signportals.exceptions.NoMultiverseSignFoundException;
import org.mvplugins.multiverse.signportals.utils.PortalDetector;

@Service
public class MVSPVersionListener implements SignPortalsListener {
final class MVSPVersionListener implements SignPortalsListener {
private final MultiverseSignPortals plugin;
private final PortalDetector detector;
private final DestinationsProvider destinationsProvider;
Expand All @@ -44,7 +44,7 @@ public class MVSPVersionListener implements SignPortalsListener {
* This method is called when Multiverse-Core wants to know what version we are.
* @param event The Version event.
*/
@EventHandler
@EventMethod
public void versionEvent(MVDumpsDebugInfoEvent event) {
event.appendDebugInfo(this.plugin.getVersionInfo());
}
Expand All @@ -54,7 +54,7 @@ public void versionEvent(MVDumpsDebugInfoEvent event) {
* It's used to handle the intriquite messiness of priority between MV plugins.
* @param event The PTP event.
*/
@EventHandler
@EventMethod
public void portalTouchEvent(MVPlayerTouchedPortalEvent event) {
Logging.finer("Found The TouchedPortal event.");
Player p = event.getPlayer();
Expand Down Expand Up @@ -85,7 +85,7 @@ public void portalTouchEvent(MVPlayerTouchedPortalEvent event) {
}
}

@EventHandler
@EventMethod
public void debugModeChange(MVDebugModeEvent event) {
Logging.setDebugLevel(event.getLevel());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.mvplugins.multiverse.signportals.listeners;

import org.bukkit.event.Listener;
import org.jvnet.hk2.annotations.Contract;
import org.mvplugins.multiverse.core.dynamiclistener.DynamicListener;

@Contract
public interface SignPortalsListener extends Listener {
public sealed interface SignPortalsListener extends DynamicListener permits MVSPBlockListener, MVSPPlayerListener, MVSPPluginListener, MVSPVersionListener {
}
Loading