diff --git a/plugin.yml b/plugin.yml index 74893bf8..6aacfac3 100644 --- a/plugin.yml +++ b/plugin.yml @@ -36,6 +36,6 @@ commands: usage: / ... aliases: tpr buyregion: - description: Buy a buyable region - usage: / [info] + description: Buy a buyable region + usage: / [info] \ No newline at end of file diff --git a/src/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java b/src/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java index 02ddc8ae..78c904ad 100644 --- a/src/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java +++ b/src/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java @@ -38,10 +38,10 @@ import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.config.Configuration; -import com.nijiko.iConomy.configuration.PropertyHandler; import com.nijikokun.bukkit.iConomy.iConomy; import com.sk89q.bukkit.migration.PermissionsResolverManager; import com.sk89q.bukkit.migration.PermissionsResolverServerListener; +import com.sk89q.worldguard.bukkit.WorldGuardServerListener; import com.sk89q.worldedit.Vector; import com.sk89q.worldguard.LocalPlayer; import com.sk89q.worldguard.TickSyncDelayLoggerFilter; @@ -69,6 +69,8 @@ public class WorldGuardPlugin extends JavaPlugin { new WorldGuardBlockListener(this); private final WorldGuardEntityListener entityListener = new WorldGuardEntityListener(this); + private final WorldGuardServerListener serverListener = + new WorldGuardServerListener(this); private PermissionsResolverServerListener permsListener; private PermissionsResolverManager perms; @@ -199,23 +201,15 @@ private void registerEvents() { registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal); registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal); registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal); - + + this.getServer().getPluginManager().registerEvent(Event.Type.PLUGIN_ENABLE, serverListener, Priority.Monitor, this); + permsListener.register(this); // 25 equals about 1s real time this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new TimedFlagsTimer(this), 25*5, 25*5); } - - /** - * Check if iConomy is enabled on this server - */ - public void onPluginEnabled(PluginEvent event) { - if(event.getPlugin().getDescription().getName().equals("iConomy")) { - this.iConomy = (iConomy)event.getPlugin(); - logger.info("WorldGuard: Attached to iConomy."); - } - } /** * Register an event. diff --git a/src/com/sk89q/worldguard/bukkit/WorldGuardServerListener.java b/src/com/sk89q/worldguard/bukkit/WorldGuardServerListener.java new file mode 100644 index 00000000..aa87c20c --- /dev/null +++ b/src/com/sk89q/worldguard/bukkit/WorldGuardServerListener.java @@ -0,0 +1,54 @@ +// $Id$ +/* + * WorldGuard + * Copyright (C) 2010 sk89q + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +package com.sk89q.worldguard.bukkit; + +import org.bukkit.event.server.PluginEvent; +import org.bukkit.event.server.ServerListener; + +import com.nijiko.iConomy.configuration.PropertyHandler; +import com.nijikokun.bukkit.iConomy.iConomy; +import com.sk89q.worldguard.bukkit.WorldGuardPlugin; + +/** + * + * @author DarkLiKally + */ +public class WorldGuardServerListener extends ServerListener { + /** + * Plugin. + */ + private WorldGuardPlugin plugin; + + /** + * Construct the object; + * + * @param plugin + */ + public WorldGuardServerListener(WorldGuardPlugin plugin) { + this.plugin = plugin; + } + + @Override + public void onPluginEnabled(PluginEvent event) { + if(event.getPlugin().getDescription().getName().equals("iConomy")) { + WorldGuardPlugin.iConomy = (iConomy)event.getPlugin(); + } + } +} \ No newline at end of file diff --git a/src/com/sk89q/worldguard/bukkit/commands/CommandBuyRegion.java b/src/com/sk89q/worldguard/bukkit/commands/CommandBuyRegion.java index 6bcb2862..3954f7f0 100644 --- a/src/com/sk89q/worldguard/bukkit/commands/CommandBuyRegion.java +++ b/src/com/sk89q/worldguard/bukkit/commands/CommandBuyRegion.java @@ -18,11 +18,7 @@ */ package com.sk89q.worldguard.bukkit.commands; -import static com.sk89q.worldguard.bukkit.BukkitUtil.matchSinglePlayer; - import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player;