remove Towny support, breaks too often due to frequency of changes, and

users don't understand how it works.
This commit is contained in:
Sleaker 2012-06-11 21:02:53 -07:00
parent f7421d5ff5
commit 595e343b59
2 changed files with 0 additions and 246 deletions

View File

@ -29,7 +29,6 @@ import net.milkbowl.vault.chat.plugins.Chat_DroxPerms;
import net.milkbowl.vault.chat.plugins.Chat_GroupManager;
import net.milkbowl.vault.chat.plugins.Chat_Permissions3;
import net.milkbowl.vault.chat.plugins.Chat_PermissionsEx;
import net.milkbowl.vault.chat.plugins.Chat_Towny;
import net.milkbowl.vault.chat.plugins.Chat_bPermissions;
import net.milkbowl.vault.chat.plugins.Chat_bPermissions2;
import net.milkbowl.vault.chat.plugins.Chat_iChat;
@ -255,17 +254,6 @@ public class Vault extends JavaPlugin {
} catch (Exception e) {
log.severe(String.format("There was an error hooking %s - check to make sure you're using a compatible version!", "iChat"));
}
try {
//Try to load Towny Chat
if (packageExists("com.palmergames.bukkit.towny.Towny")) {
Chat townChat = new Chat_Towny(this, perms);
sm.register(Chat.class, townChat, this, ServicePriority.Lowest);
log.info(String.format("[%s][Chat] Towny found: %s", getDescription().getName(), townChat.isEnabled() ? "Loaded" : "Waiting"));
}
} catch (Exception e) {
log.severe(String.format("There was an error hooking %s - check to make sure you're using a compatible version!", "Towny Chat"));
}
}
/**

View File

@ -1,234 +0,0 @@
/* This file is part of Vault.
Vault is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Vault 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with Vault. If not, see <http://www.gnu.org/licenses/>.
*/
package net.milkbowl.vault.chat.plugins;
import java.util.logging.Logger;
import net.milkbowl.vault.Vault;
import net.milkbowl.vault.chat.Chat;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.Bukkit;
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.plugin.Plugin;
import com.palmergames.bukkit.towny.Towny;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.TownyUniverse;
public class Chat_Towny extends Chat {
private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "Towny";
private Towny towny;
private Vault plugin;
public Chat_Towny(Vault plugin, Permission perms) {
super(perms);
this.plugin = plugin;
Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(this), plugin);
// Load Plugin in case it was loaded before
if (towny == null) {
Plugin p = plugin.getServer().getPluginManager().getPlugin("Towny");
if (p != null) {
towny = (Towny) p;
log.info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), "Towny"));
}
}
}
public class PermissionServerListener implements Listener {
Chat_Towny chat = null;
public PermissionServerListener(Chat_Towny chat) {
this.chat = chat;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (this.chat.towny == null) {
Plugin towny = plugin.getServer().getPluginManager().getPlugin("Towny");
if (chat != null) {
this.chat.towny = (Towny) towny;
log.info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), "Towny"));
}
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) {
if (this.chat.towny != null) {
if (event.getPlugin().getDescription().getName().equals("Towny")) {
this.chat.towny = null;
log.info(String.format("[%s][Chat] %s un-hooked.", plugin.getDescription().getName(), "Towny"));
}
}
}
}
@Override
public String getName() {
return name;
}
@Override
public boolean isEnabled() {
return towny != null;
}
@Override
public String getPlayerPrefix(String world, String player) {
try {
Resident r = TownyUniverse.getDataSource().getResident(player);
return r.getTitle();
} catch (NotRegisteredException e) {
}
return "";
}
@Override
public void setPlayerPrefix(String world, String player, String prefix) {
throw new UnsupportedOperationException("Towny does not support altering prefixes");
}
@Override
public String getPlayerSuffix(String world, String player) {
try {
Resident r = TownyUniverse.getDataSource().getResident(player);
return r.getSurname();
} catch (NotRegisteredException e) {
}
return "";
}
@Override
public void setPlayerSuffix(String world, String player, String suffix) {
throw new UnsupportedOperationException("Towny does not support altering suffixes");
}
@Override
public String getGroupPrefix(String world, String group) {
try {
return TownyUniverse.getDataSource().getTown(group).getTag();
} catch (NotRegisteredException e) {
}
return "";
}
@Override
public void setGroupPrefix(String world, String group, String prefix) {
throw new UnsupportedOperationException("Towny does not support altering prefixes");
}
@Override
public String getGroupSuffix(String world, String group) {
throw new UnsupportedOperationException("Towny does not support group/town suffixes");
}
@Override
public void setGroupSuffix(String world, String group, String suffix) {
throw new UnsupportedOperationException("Towny does not support altering suffixes");
}
@Override
public int getPlayerInfoInteger(String world, String player, String node, int defaultValue) {
throw new UnsupportedOperationException("Towny does not support info nodes");
}
@Override
public void setPlayerInfoInteger(String world, String player, String node, int value) {
throw new UnsupportedOperationException("Towny does not support info nodes");
}
@Override
public int getGroupInfoInteger(String world, String group, String node, int defaultValue) {
throw new UnsupportedOperationException("Towny does not support info nodes");
}
@Override
public void setGroupInfoInteger(String world, String group, String node, int value) {
throw new UnsupportedOperationException("Towny does not support info nodes");
}
@Override
public double getPlayerInfoDouble(String world, String player, String node, double defaultValue) {
throw new UnsupportedOperationException("Towny does not support info nodes");
}
@Override
public void setPlayerInfoDouble(String world, String player, String node, double value) {
throw new UnsupportedOperationException("Towny does not support info nodes");
}
@Override
public double getGroupInfoDouble(String world, String group, String node, double defaultValue) {
throw new UnsupportedOperationException("Towny does not support info nodes");
}
@Override
public void setGroupInfoDouble(String world, String group, String node, double value) {
throw new UnsupportedOperationException("Towny does not support info nodes");
}
@Override
public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue) {
throw new UnsupportedOperationException("Towny does not support info nodes");
}
@Override
public void setPlayerInfoBoolean(String world, String player, String node, boolean value) {
throw new UnsupportedOperationException("Towny does not support info nodes");
}
@Override
public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue) {
throw new UnsupportedOperationException("Towny does not support info nodes");
}
@Override
public void setGroupInfoBoolean(String world, String group, String node, boolean value) {
throw new UnsupportedOperationException("Towny does not support info nodes");
}
@Override
public String getPlayerInfoString(String world, String player, String node, String defaultValue) {
throw new UnsupportedOperationException("Towny does not support info nodes");
}
@Override
public void setPlayerInfoString(String world, String player, String node, String value) {
throw new UnsupportedOperationException("Towny does not support info nodes");
}
@Override
public String getGroupInfoString(String world, String group, String node, String defaultValue) {
throw new UnsupportedOperationException("Towny does not support info nodes");
}
@Override
public void setGroupInfoString(String world, String group, String node, String value) {
throw new UnsupportedOperationException("Towny does not support info nodes");
}
}