mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-03 14:38:56 +00:00
Added a new command '/townychat reload'.
This commit is contained in:
1 parent
94fa4859db
commit
12a0e8395a
4 files changed
+75
-4
No files matched your search
+2
-1
@@ -82,4 +82,5 @@ v0.15:
|
||||
- Updated for the new Bukkit Event system.
|
||||
v0.16:
|
||||
- Lowered event priorities to HIGH to allow other plugins the chance to beat us to the event and cancel.
|
||||
- Fixed Op's with no default mode set using local chat. It will now try global, then world, then local in it's search order.
|
||||
- Fixed Op's with no default mode set using local chat. It will now try global, then world, then local in it's search order.
|
||||
- Added a new command '/townychat reload'.
|
||||
@@ -11,6 +11,7 @@ import org.dynmap.DynmapAPI;
|
||||
|
||||
import com.ensifera.animosity.craftirc.CraftIRC;
|
||||
import com.palmergames.bukkit.TownyChat.CraftIRCHandler;
|
||||
import com.palmergames.bukkit.TownyChat.Command.TownyChatCommand;
|
||||
import com.palmergames.bukkit.TownyChat.channels.ChannelsHolder;
|
||||
import com.palmergames.bukkit.TownyChat.config.ConfigurationHandler;
|
||||
import com.palmergames.bukkit.TownyChat.event.TownyPlayerHighestListener;
|
||||
@@ -28,10 +29,10 @@ import com.palmergames.bukkit.towny.Towny;
|
||||
|
||||
public class Chat extends JavaPlugin {
|
||||
|
||||
private Logger logger = Logger.getLogger("com.palmergames.bukkit.TownyChat");
|
||||
private Logger logger;
|
||||
private TownyPlayerHighestListener TownyPlayerListener;
|
||||
private ChannelsHolder channels = new ChannelsHolder(this);
|
||||
private ConfigurationHandler configuration = new ConfigurationHandler(this);
|
||||
private ChannelsHolder channels;
|
||||
private ConfigurationHandler configuration;
|
||||
|
||||
protected PluginManager pm;
|
||||
private Towny towny = null;
|
||||
@@ -44,6 +45,9 @@ public class Chat extends JavaPlugin {
|
||||
public void onEnable() {
|
||||
|
||||
pm = getServer().getPluginManager();
|
||||
logger = Logger.getLogger("com.palmergames.bukkit.TownyChat");
|
||||
configuration = new ConfigurationHandler(this);
|
||||
channels = new ChannelsHolder(this);
|
||||
|
||||
checkPlugins();
|
||||
|
||||
@@ -62,6 +66,8 @@ public class Chat extends JavaPlugin {
|
||||
pm.disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
getCommand("townychat").setExecutor(new TownyChatCommand(this));
|
||||
|
||||
}
|
||||
|
||||
@@ -72,6 +78,7 @@ public class Chat extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
unregisterPermissions();
|
||||
// reset any handles
|
||||
towny = null;
|
||||
pm = null;
|
||||
@@ -119,6 +126,13 @@ public class Chat extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterPermissions() {
|
||||
// Register all Permissions.
|
||||
for (String perm : getChannelsHandler().getAllPermissions()) {
|
||||
pm.removePermission(new Permission(perm, new HashMap<String, Boolean>()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getRootPath() {
|
||||
return getTowny().getDataFolder().getPath();
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.palmergames.bukkit.TownyChat.Command;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.palmergames.bukkit.TownyChat.Chat;
|
||||
import com.palmergames.bukkit.towny.TownyMessaging;
|
||||
|
||||
/**
|
||||
* @author ElgarL
|
||||
*
|
||||
*/
|
||||
public class TownyChatCommand implements CommandExecutor {
|
||||
|
||||
private Chat plugin;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public TownyChatCommand(Chat instance) {
|
||||
// TODO Auto-generated constructor stub
|
||||
this.plugin = instance;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.bukkit.command.CommandExecutor#onCommand(org.bukkit.command.CommandSender, org.bukkit.command.Command, java.lang.String, java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
|
||||
if (label.equalsIgnoreCase("townychat")) {
|
||||
|
||||
if (args.length != 1) {
|
||||
TownyMessaging.sendErrorMsg(sender, "[TownyChat] Error: Invalid command!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("reload")) {
|
||||
plugin.onDisable();
|
||||
plugin.onEnable();
|
||||
TownyMessaging.sendMsg(sender, "[TownyChat] Settings reloaded!");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
TownyMessaging.sendErrorMsg(sender, "[TownyChat] Error: unrecognised command format!");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,3 +9,7 @@ description: >
|
||||
softdepend: [Towny]
|
||||
|
||||
commands:
|
||||
townychat:
|
||||
aliases: []
|
||||
usage: /townychat reload
|
||||
permission: townychat.reload
|
||||
Reference in new issue
Block a user