From ecb97fd5c1b2d40cd67568a242d38de3fdf087b1 Mon Sep 17 00:00:00 2001 From: Eric Stokes Date: Sun, 22 Jan 2012 21:44:43 -0700 Subject: [PATCH] Migrate to the new event system --- .../MultiverseCore/MultiverseCore.java | 30 +----- .../MultiverseCore/commands/HelpCommand.java | 2 - .../listeners/MVEntityListener.java | 28 ++++-- .../listeners/MVPlayerListener.java | 94 +++++++++++++++---- .../listeners/MVPluginListener.java | 16 ++-- .../listeners/MVPortalAdjustListener.java | 55 ----------- .../listeners/MVWeatherListener.java | 29 ++++-- .../listeners/MultiverseCoreListener.java | 51 ++++------ .../MultiverseCore/utils/PermissionTools.java | 4 +- 9 files changed, 148 insertions(+), 161 deletions(-) delete mode 100644 src/main/java/com/onarandombox/MultiverseCore/listeners/MVPortalAdjustListener.java diff --git a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java index 164dcf06..ce0c5f73 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java @@ -25,7 +25,6 @@ import com.onarandombox.MultiverseCore.event.MVVersionEvent; import com.onarandombox.MultiverseCore.listeners.MVEntityListener; import com.onarandombox.MultiverseCore.listeners.MVPlayerListener; import com.onarandombox.MultiverseCore.listeners.MVPluginListener; -import com.onarandombox.MultiverseCore.listeners.MVPortalAdjustListener; import com.onarandombox.MultiverseCore.listeners.MVWeatherListener; import com.onarandombox.MultiverseCore.utils.AnchorManager; import com.onarandombox.MultiverseCore.utils.DebugLog; @@ -44,8 +43,6 @@ import org.bukkit.configuration.Configuration; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.Event.Priority; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; @@ -156,7 +153,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { // Setup the block/player/entity listener. private MVPlayerListener playerListener = new MVPlayerListener(this); - private MVPortalAdjustListener portalAdjustListener = new MVPortalAdjustListener(this); private MVEntityListener entityListener = new MVEntityListener(this); private MVPluginListener pluginListener = new MVPluginListener(this); @@ -319,28 +315,10 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { */ private void registerEvents() { PluginManager pm = getServer().getPluginManager(); - pm.registerEvent(Event.Type.PLAYER_TELEPORT, this.playerListener, Priority.Highest, this); // Cancel Teleports if needed. - pm.registerEvent(Event.Type.PLAYER_JOIN, this.playerListener, Priority.Normal, this); // To create the Player Session - pm.registerEvent(Event.Type.PLAYER_QUIT, this.playerListener, Priority.Normal, this); // To remove Player Sessions - pm.registerEvent(Event.Type.PLAYER_RESPAWN, this.playerListener, Priority.Low, this); // Let plugins which specialize in (re)spawning carry more weight. - pm.registerEvent(Event.Type.PLAYER_LOGIN, this.playerListener, Priority.Low, this); // Let plugins which specialize in (re)spawning carry more weight. - pm.registerEvent(Event.Type.PLAYER_CHAT, this.playerListener, Priority.Normal, this); // To prepend the world name - pm.registerEvent(Event.Type.PLAYER_PORTAL, this.playerListener, Priority.High, this); - // We want this high to have it go last, so it can cancel if needbe. - - pm.registerEvent(Event.Type.PLAYER_PORTAL, this.portalAdjustListener, Priority.Lowest, this); // To handle portal correction - pm.registerEvent(Event.Type.PLAYER_CHANGED_WORLD, this.playerListener, Priority.Monitor, this); // To switch gamemode - - pm.registerEvent(Event.Type.ENTITY_REGAIN_HEALTH, this.entityListener, Priority.Normal, this); - pm.registerEvent(Event.Type.ENTITY_DAMAGE, this.entityListener, Priority.Normal, this); // To Allow/Disallow fake PVP - pm.registerEvent(Event.Type.CREATURE_SPAWN, this.entityListener, Priority.Normal, this); // To prevent all or certain animals/monsters from spawning. - pm.registerEvent(Event.Type.FOOD_LEVEL_CHANGE, this.entityListener, Priority.Normal, this); - - pm.registerEvent(Event.Type.PLUGIN_ENABLE, this.pluginListener, Priority.Monitor, this); - pm.registerEvent(Event.Type.PLUGIN_DISABLE, this.pluginListener, Priority.Monitor, this); - - pm.registerEvent(Event.Type.WEATHER_CHANGE, this.weatherListener, Priority.Normal, this); - pm.registerEvent(Event.Type.THUNDER_CHANGE, this.weatherListener, Priority.Normal, this); + pm.registerEvents(this.playerListener, this); + pm.registerEvents(this.entityListener, this); + pm.registerEvents(this.pluginListener, this); + pm.registerEvents(this.weatherListener, this); } /** diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/HelpCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/HelpCommand.java index 656345fd..90913026 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/HelpCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/HelpCommand.java @@ -5,8 +5,6 @@ * with this project. * ******************************************************************************/ -// TODO maybe remove this comment...? -// This file is no longer licensed under that silly CC license. I have blanked it out and will start implementaiton of my own in a few days. For now there is no help. package com.onarandombox.MultiverseCore.commands; import com.onarandombox.MultiverseCore.MultiverseCore; diff --git a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVEntityListener.java b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVEntityListener.java index f393bbde..95ff0008 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVEntityListener.java +++ b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVEntityListener.java @@ -18,9 +18,10 @@ import org.bukkit.entity.Monster; import org.bukkit.entity.Player; import org.bukkit.entity.Slime; import org.bukkit.entity.Squid; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; -import org.bukkit.event.entity.EntityListener; import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.FoodLevelChangeEvent; @@ -29,9 +30,9 @@ import java.util.List; import java.util.logging.Level; /** - * Multiverse's {@link EntityListener}. + * Multiverse's Entity {@link Listener}. */ -public class MVEntityListener extends EntityListener { +public class MVEntityListener implements Listener { private MultiverseCore plugin; private MVWorldManager worldManager; @@ -41,8 +42,12 @@ public class MVEntityListener extends EntityListener { this.worldManager = plugin.getMVWorldManager(); } - @Override - public void onFoodLevelChange(FoodLevelChangeEvent event) { + /** + * This method is called when an entity's food level goes higher or lower. + * @param event The Event that was fired. + */ + @EventHandler + public void foodLevelChange(FoodLevelChangeEvent event) { if (event.isCancelled()) { return; } @@ -58,9 +63,12 @@ public class MVEntityListener extends EntityListener { } } - - @Override - public void onEntityRegainHealth(EntityRegainHealthEvent event) { + /** + * This method is called when an entity's health goes up or down. + * @param event The Event that was fired. + */ + @EventHandler + public void entityRegainHealth(EntityRegainHealthEvent event) { if (event.isCancelled()) { return; } @@ -75,8 +83,8 @@ public class MVEntityListener extends EntityListener { * Handle Animal/Monster Spawn settings, seems like a more concrete method than using CraftBukkit. * @param event The event. */ - @Override - public void onCreatureSpawn(CreatureSpawnEvent event) { + @EventHandler + public void creatureSpawn(CreatureSpawnEvent event) { // Check to see if the Creature is spawned by a plugin, we don't want to prevent this behaviour. if (event.getSpawnReason() == SpawnReason.CUSTOM) { diff --git a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java index 810553b5..ad62c4d4 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java +++ b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java @@ -12,14 +12,18 @@ import com.onarandombox.MultiverseCore.api.MVWorldManager; import com.onarandombox.MultiverseCore.api.MultiverseWorld; import com.onarandombox.MultiverseCore.event.MVRespawnEvent; import com.onarandombox.MultiverseCore.utils.PermissionTools; +import com.onarandombox.MultiverseCore.utils.SafeTTeleporter; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerChangedWorldEvent; import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerListener; import org.bukkit.event.player.PlayerPortalEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerRespawnEvent; @@ -28,9 +32,9 @@ import org.bukkit.event.player.PlayerTeleportEvent; import java.util.logging.Level; /** - * Multiverse's {@link PlayerListener}. + * Multiverse's {@link Listener} for players. */ -public class MVPlayerListener extends PlayerListener { +public class MVPlayerListener implements Listener { private MultiverseCore plugin; private MVWorldManager worldManager; private PermissionTools pt; @@ -41,9 +45,12 @@ public class MVPlayerListener extends PlayerListener { worldManager = plugin.getMVWorldManager(); pt = new PermissionTools(plugin); } - - @Override - public void onPlayerChat(PlayerChatEvent event) { + /** + * This method is called when a player wants to chat. + * @param event The Event that was fired. + */ + @EventHandler + public void playerChat(PlayerChatEvent event) { if (event.isCancelled()) { return; } @@ -66,8 +73,12 @@ public class MVPlayerListener extends PlayerListener { } } - @Override - public void onPlayerRespawn(PlayerRespawnEvent event) { + /** + * This method is called when a player respawns. + * @param event The Event that was fired. + */ + @EventHandler(priority = EventPriority.LOW) + public void playerRespawn(PlayerRespawnEvent event) { World world = event.getPlayer().getWorld(); MultiverseWorld mvWorld = this.worldManager.getMVWorld(world.getName()); // If it's not a World MV manages we stop. @@ -108,8 +119,12 @@ public class MVPlayerListener extends PlayerListener { return w.getSpawnLocation(); } - @Override - public void onPlayerJoin(PlayerJoinEvent event) { + /** + * This method is called when a player joins the server. + * @param event The Event that was fired. + */ + @EventHandler + public void playerJoin(PlayerJoinEvent event) { Player p = event.getPlayer(); if (!p.hasPlayedBefore()) { this.plugin.log(Level.FINE, "Player joined first!"); @@ -125,19 +140,31 @@ public class MVPlayerListener extends PlayerListener { this.handleGameMode(event.getPlayer(), event.getPlayer().getWorld()); } - @Override - public void onPlayerChangedWorld(PlayerChangedWorldEvent event) { + /** + * This method is called when a player changes worlds. + * @param event The Event that was fired. + */ + @EventHandler(priority = EventPriority.MONITOR) + public void playerChangedWorld(PlayerChangedWorldEvent event) { // Permissions now determine whether or not to handle a gamemode. this.handleGameMode(event.getPlayer(), event.getPlayer().getWorld()); } - @Override - public void onPlayerQuit(PlayerQuitEvent event) { + /** + * This method is called when a player quits the game. + * @param event The Event that was fired. + */ + @EventHandler + public void playerQuit(PlayerQuitEvent event) { this.plugin.removePlayerSession(event.getPlayer()); } - @Override - public void onPlayerTeleport(PlayerTeleportEvent event) { + /** + * This method is called when a player teleports anywhere. + * @param event The Event that was fired. + */ + @EventHandler(priority = EventPriority.HIGHEST) + public void playerTeleport(PlayerTeleportEvent event) { this.plugin.log(Level.FINEST, "Got teleport event for player '" + event.getPlayer().getName() + "' with cause '" + event.getCause() + "'"); if (event.isCancelled()) { @@ -183,8 +210,39 @@ public class MVPlayerListener extends PlayerListener { } } - @Override - public void onPlayerPortal(PlayerPortalEvent event) { + /** + * This method is called to adjust the portal location to the actual portal location (and not + * right outside of it. + * @param event The Event that was fired. + */ + @EventHandler(priority = EventPriority.LOWEST) + public void playerPortalCheck(PlayerPortalEvent event) { + this.plugin.log(Level.FINE, "CALLING CORE-ADJUST!!!"); + if (event.isCancelled() || event.getFrom() == null) { + return; + } + + // REMEMBER! getTo MAY be NULL HERE!!! + // If the player was actually outside of the portal, adjust the from location + if (event.getFrom().getWorld().getBlockAt(event.getFrom()).getType() != Material.PORTAL) { + Location newloc = SafeTTeleporter.findPortalBlockNextTo(event.getFrom()); + // TODO: Fix this. Currently, we only check for PORTAL blocks. I'll have to figure out what + // TODO: we want to do here. + if (newloc != null) { + event.setFrom(newloc); + } + } + // Wait for the adjust, then return! + if (event.getTo() == null) { + return; + } + } + /** + * This method is called when a player actually portals via a vanilla style portal. + * @param event The Event that was fired. + */ + @EventHandler(priority = EventPriority.HIGH) + public void playerPortal(PlayerPortalEvent event) { if (event.isCancelled() || (event.getFrom() == null)) { return; } diff --git a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPluginListener.java b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPluginListener.java index 84e34c84..567429e4 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPluginListener.java +++ b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPluginListener.java @@ -9,17 +9,19 @@ package com.onarandombox.MultiverseCore.listeners; import com.fernferret.allpay.AllPay; import com.onarandombox.MultiverseCore.MultiverseCore; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; import org.bukkit.event.server.PluginDisableEvent; import org.bukkit.event.server.PluginEnableEvent; -import org.bukkit.event.server.ServerListener; import java.util.Arrays; import java.util.logging.Level; /** - * Multiverse's {@link ServerListener}. + * Multiverse's Plugin {@link Listener}. */ -public class MVPluginListener extends ServerListener { +public class MVPluginListener implements Listener { private MultiverseCore plugin; @@ -31,8 +33,8 @@ public class MVPluginListener extends ServerListener { * Keep an eye out for Plugins which we can utilize. * @param event The event. */ - @Override - public void onPluginEnable(PluginEnableEvent event) { + @EventHandler(priority = EventPriority.MONITOR) + public void pluginEnable(PluginEnableEvent event) { // Let AllPay handle all econ plugin loadings, only go for econ plugins we support if (Arrays.asList(AllPay.validEconPlugins).contains(event.getPlugin().getDescription().getName())) { this.plugin.setBank(this.plugin.getBanker().loadEconPlugin()); @@ -48,8 +50,8 @@ public class MVPluginListener extends ServerListener { * We'll check if any of the plugins we rely on decide to Disable themselves. * @param event The event. */ - @Override - public void onPluginDisable(PluginDisableEvent event) { + @EventHandler(priority = EventPriority.MONITOR) + public void pluginDisable(PluginDisableEvent event) { // TODO: Disable econ when it disables. } diff --git a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPortalAdjustListener.java b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPortalAdjustListener.java deleted file mode 100644 index 0dfc20b2..00000000 --- a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPortalAdjustListener.java +++ /dev/null @@ -1,55 +0,0 @@ -/****************************************************************************** - * Multiverse 2 Copyright (c) the Multiverse Team 2012. * - * Multiverse 2 is licensed under the BSD License. * - * For more information please check the README.md file included * - * with this project. * - ******************************************************************************/ - -package com.onarandombox.MultiverseCore.listeners; - -import com.onarandombox.MultiverseCore.MultiverseCore; -import com.onarandombox.MultiverseCore.utils.SafeTTeleporter; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.event.Event.Type; -import org.bukkit.event.player.PlayerListener; -import org.bukkit.event.player.PlayerPortalEvent; - -import java.util.logging.Level; - -/** - * Multiverse's second {@link PlayerListener}. - *

- * Used to double-monitor {@link Type#PLAYER_PORTAL}. - */ -public class MVPortalAdjustListener extends PlayerListener { - - private MultiverseCore plugin; - - public MVPortalAdjustListener(MultiverseCore core) { - this.plugin = core; - } - - @Override - public void onPlayerPortal(PlayerPortalEvent event) { - this.plugin.log(Level.FINE, "CALLING CORE-ADJUST!!!"); - if (event.isCancelled() || event.getFrom() == null) { - return; - } - - // REMEMBER! getTo MAY be NULL HERE!!! - // If the player was actually outside of the portal, adjust the from location - if (event.getFrom().getWorld().getBlockAt(event.getFrom()).getType() != Material.PORTAL) { - Location newloc = SafeTTeleporter.findPortalBlockNextTo(event.getFrom()); - // TODO: Fix this. Currently, we only check for PORTAL blocks. I'll have to figure out what - // TODO: we want to do here. - if (newloc != null) { - event.setFrom(newloc); - } - } - // Wait for the adjust, then return! - if (event.getTo() == null) { - return; - } - } -} diff --git a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVWeatherListener.java b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVWeatherListener.java index d6a0ad81..358803e1 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVWeatherListener.java +++ b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVWeatherListener.java @@ -9,22 +9,30 @@ package com.onarandombox.MultiverseCore.listeners; import com.onarandombox.MultiverseCore.MultiverseCore; import com.onarandombox.MultiverseCore.api.MultiverseWorld; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; import org.bukkit.event.weather.ThunderChangeEvent; import org.bukkit.event.weather.WeatherChangeEvent; -import org.bukkit.event.weather.WeatherListener; /** - * Multiverse's {@link WeatherListener}. + * Multiverse's Weather {@link Listener}. */ -public class MVWeatherListener extends WeatherListener { +public class MVWeatherListener implements Listener { private MultiverseCore plugin; public MVWeatherListener(MultiverseCore plugin) { this.plugin = plugin; } - @Override - public void onWeatherChange(WeatherChangeEvent event) { + /** + * This method is called when the weather changes. + * @param event The Event that was fired. + */ + @EventHandler + public void weatherChange(WeatherChangeEvent event) { + if (event.isCancelled()) { + return; + } MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(event.getWorld().getName()); if (world != null) { // If it's going to start raining and we have weather disabled @@ -32,8 +40,15 @@ public class MVWeatherListener extends WeatherListener { } } - @Override - public void onThunderChange(ThunderChangeEvent event) { + /** + * This method is called when a big storm is going to start. + * @param event The Event that was fired. + */ + @EventHandler + public void thunderChange(ThunderChangeEvent event) { + if (event.isCancelled()) { + return; + } MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(event.getWorld().getName()); if (world != null) { // If it's going to start raining and we have weather disabled diff --git a/src/main/java/com/onarandombox/MultiverseCore/listeners/MultiverseCoreListener.java b/src/main/java/com/onarandombox/MultiverseCore/listeners/MultiverseCoreListener.java index e81e9539..fa1adf67 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/listeners/MultiverseCoreListener.java +++ b/src/main/java/com/onarandombox/MultiverseCore/listeners/MultiverseCoreListener.java @@ -7,9 +7,6 @@ package com.onarandombox.MultiverseCore.listeners; -import org.bukkit.event.CustomEventListener; -import org.bukkit.event.Event; - import com.onarandombox.MultiverseCore.event.MVConfigReloadEvent; import com.onarandombox.MultiverseCore.event.MVPlayerTouchedPortalEvent; import com.onarandombox.MultiverseCore.event.MVRespawnEvent; @@ -17,80 +14,66 @@ import com.onarandombox.MultiverseCore.event.MVTeleportEvent; import com.onarandombox.MultiverseCore.event.MVVersionEvent; import com.onarandombox.MultiverseCore.event.MVWorldDeleteEvent; import com.onarandombox.MultiverseCore.event.MVWorldPropertyChangeEvent; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; /** * Subclasses of this listener can be used to conveniently listen to MultiverseCore-events. */ -public abstract class MultiverseCoreListener extends CustomEventListener { - /** - * {@inheritDoc} - */ - @Override - public final void onCustomEvent(Event event) { - if (event.getEventName().equals("MVConfigReload") && event instanceof MVConfigReloadEvent) { - onMVConfigReload((MVConfigReloadEvent) event); - } else if (event.getEventName().equals("MVPlayerTouchedPortalEvent") && event instanceof MVPlayerTouchedPortalEvent) { - onPlayerTouchedPortal((MVPlayerTouchedPortalEvent) event); - } else if (event.getEventName().equals("MVRespawn") && event instanceof MVRespawnEvent) { - onPlayerRespawn((MVRespawnEvent) event); - } else if (event.getEventName().equals("SafeTTeleporter") && event instanceof MVTeleportEvent) { - onPlayerTeleport((MVTeleportEvent) event); - } else if (event.getEventName().equals("MVVersionEvent") && event instanceof MVVersionEvent) { - onVersionRequest((MVVersionEvent) event); - } else if (event.getEventName().equals("MVWorldDeleteEvent") && event instanceof MVWorldDeleteEvent) { - onWorldDelete((MVWorldDeleteEvent) event); - } else if (event.getEventName().equals("MVWorldPropertyChange") && event instanceof MVWorldPropertyChangeEvent) { - onWorldPropertyChange((MVWorldPropertyChangeEvent) event); - } - } - +public abstract class MultiverseCoreListener implements Listener { /** * Called when a {@link MVWorldPropertyChangeEvent} is fired. * @param event The event. */ - public void onWorldPropertyChange(MVWorldPropertyChangeEvent event) { + @EventHandler + public void worldPropertyChange(MVWorldPropertyChangeEvent event) { } /** * Called when a {@link MVWorldDeleteEvent} is fired. * @param event The event. */ - public void onWorldDelete(MVWorldDeleteEvent event) { + @EventHandler + public void worldDelete(MVWorldDeleteEvent event) { } /** * Called when a {@link MVVersionEvent} is fired. * @param event The event. */ - public void onVersionRequest(MVVersionEvent event) { + @EventHandler + public void versionRequest(MVVersionEvent event) { } /** * Called when a {@link MVTeleportEvent} is fired. * @param event The event. */ - public void onPlayerTeleport(MVTeleportEvent event) { + @EventHandler + public void playerTeleport(MVTeleportEvent event) { } /** * Called when a {@link MVRespawnEvent} is fired. * @param event The event. */ - public void onPlayerRespawn(MVRespawnEvent event) { + @EventHandler + public void playerRespawn(MVRespawnEvent event) { } /** * Called when a {@link MVPlayerTouchedPortalEvent} is fired. * @param event The event. */ - public void onPlayerTouchedPortal(MVPlayerTouchedPortalEvent event) { + @EventHandler + public void playerTouchedPortal(MVPlayerTouchedPortalEvent event) { } /** * Called when a {@link MVConfigReloadEvent} is fired. * @param event The event. */ - public void onMVConfigReload(MVConfigReloadEvent event) { + @EventHandler + public void configReload(MVConfigReloadEvent event) { } - } diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/PermissionTools.java b/src/main/java/com/onarandombox/MultiverseCore/utils/PermissionTools.java index 5c5712c9..2be0c287 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/PermissionTools.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/PermissionTools.java @@ -128,7 +128,7 @@ public class PermissionTools { // If the toWorld isn't controlled by MV, // We don't care. - if(toWorld == null) { + if (toWorld == null) { return true; } @@ -148,7 +148,7 @@ public class PermissionTools { if (!bank.hasEnough(teleporterPlayer, toWorld.getPrice(), toWorld.getCurrency(), errString)) { return false; } else if (pay) { - bank.pay(teleporterPlayer, toWorld.getPrice(), toWorld.getCurrency()); + bank.give(teleporterPlayer, toWorld.getPrice(), toWorld.getCurrency()); } } return true;