mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-04 14:38:58 +00:00
Added a new command '/townychat reload'.
This commit is contained in:
1 parent
94fa4859db
commit
12a0e8395a
4 files changed
+74
-3
No files matched your search
@@ -83,3 +83,4 @@ v0.15:
|
|||||||
v0.16:
|
v0.16:
|
||||||
- Lowered event priorities to HIGH to allow other plugins the chance to beat us to the event and cancel.
|
- 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.ensifera.animosity.craftirc.CraftIRC;
|
||||||
import com.palmergames.bukkit.TownyChat.CraftIRCHandler;
|
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.channels.ChannelsHolder;
|
||||||
import com.palmergames.bukkit.TownyChat.config.ConfigurationHandler;
|
import com.palmergames.bukkit.TownyChat.config.ConfigurationHandler;
|
||||||
import com.palmergames.bukkit.TownyChat.event.TownyPlayerHighestListener;
|
import com.palmergames.bukkit.TownyChat.event.TownyPlayerHighestListener;
|
||||||
@@ -28,10 +29,10 @@ import com.palmergames.bukkit.towny.Towny;
|
|||||||
|
|
||||||
public class Chat extends JavaPlugin {
|
public class Chat extends JavaPlugin {
|
||||||
|
|
||||||
private Logger logger = Logger.getLogger("com.palmergames.bukkit.TownyChat");
|
private Logger logger;
|
||||||
private TownyPlayerHighestListener TownyPlayerListener;
|
private TownyPlayerHighestListener TownyPlayerListener;
|
||||||
private ChannelsHolder channels = new ChannelsHolder(this);
|
private ChannelsHolder channels;
|
||||||
private ConfigurationHandler configuration = new ConfigurationHandler(this);
|
private ConfigurationHandler configuration;
|
||||||
|
|
||||||
protected PluginManager pm;
|
protected PluginManager pm;
|
||||||
private Towny towny = null;
|
private Towny towny = null;
|
||||||
@@ -44,6 +45,9 @@ public class Chat extends JavaPlugin {
|
|||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
|
||||||
pm = getServer().getPluginManager();
|
pm = getServer().getPluginManager();
|
||||||
|
logger = Logger.getLogger("com.palmergames.bukkit.TownyChat");
|
||||||
|
configuration = new ConfigurationHandler(this);
|
||||||
|
channels = new ChannelsHolder(this);
|
||||||
|
|
||||||
checkPlugins();
|
checkPlugins();
|
||||||
|
|
||||||
@@ -63,6 +67,8 @@ public class Chat extends JavaPlugin {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCommand("townychat").setExecutor(new TownyChatCommand(this));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean load() {
|
private boolean load() {
|
||||||
@@ -72,6 +78,7 @@ public class Chat extends JavaPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
unregisterPermissions();
|
||||||
// reset any handles
|
// reset any handles
|
||||||
towny = null;
|
towny = null;
|
||||||
pm = 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() {
|
public String getRootPath() {
|
||||||
return getTowny().getDataFolder().getPath();
|
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]
|
softdepend: [Towny]
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
townychat:
|
||||||
|
aliases: []
|
||||||
|
usage: /townychat reload
|
||||||
|
permission: townychat.reload
|
||||||
Reference in new issue
Block a user