Added half-functional /me recode

This commit is contained in:
nossr50 2010-12-01 07:17:59 -08:00
parent a9bc2a0b31
commit 91a9e1350b
3 changed files with 31 additions and 7 deletions

View File

@ -25,8 +25,7 @@ public class vMinecraft extends Plugin {
etc.getLoader().addListener(PluginLoader.Hook.IGNITE, listener, this, PluginListener.Priority.HIGH);
etc.getLoader().addListener(PluginLoader.Hook.DAMAGE, listener, this, PluginListener.Priority.MEDIUM);
etc.getLoader().addListener(PluginLoader.Hook.EXPLODE, listener, this, PluginListener.Priority.HIGH);
if(etc.getInstance().isHealthEnabled()){
etc.getLoader().addListener(PluginLoader.Hook.HEALTH_CHANGE, listener, this, PluginListener.Priority.MEDIUM);
}
}
}

View File

@ -361,6 +361,20 @@ public class vMinecraftChat {
}
return false;
}
//=====================================================================
//Function: emote
//Input: Player player: The player talking
// String message: The message to apply the effect to
//Output: boolean: If this feature is enabled
//Use: /me but with our custom colors applied
//=====================================================================
public static boolean emote(Player player, String[] message)
{
String[] msg = wordWrap("* " + getName(player) + Colors.White + message);
for(String str: msg)
gmsg(str);
return true;
}
//=====================================================================
@ -385,7 +399,7 @@ public class vMinecraftChat {
//Loop through looking for a color code
for(int x = 0; x< msg.length(); x++)
{
//If the char is a ^ or §
//If the char is a ^ or <EFBFBD>
if(msg.charAt(x) == '^' || msg.charAt(x) == Colors.White.charAt(0))
{
if(x != msg.length() - 1)
@ -451,7 +465,7 @@ public class vMinecraftChat {
//Loop through looking for a color code
for(int x = 0; x< message.length(); x++)
{
//If the char is a ^ or '§'
//If the char is a ^ or '<EFBFBD>'
if(message.charAt(x) == '^' || message.charAt(x) == Colors.White.charAt(0))
{
if(x != message.length() - 1)

View File

@ -42,9 +42,21 @@ public class vMinecraftCommands{
cl.register("/suicide", "suicide", "kill yourself... you loser");
cl.register("/a", "adminChatToggle", "toggle admin chat for every message");
cl.register("/modify", "modifySplit");
cl.register("/me", "me");
cl.registerAlias("/playerlist", "/who");
cl.registerAlias("/suicide", "/wrists");
cl.registerAlias("/clearinventory", "/ci");
}
//=====================================================================
//Function: me (/me)
//Input: Player player: The player using the command
//Output: int: Exit Code
//Use: The player uses this to emote, but now its colorful.
//=====================================================================
public static int me(Player player, String[] args)
{
vMinecraftChat.emote(player, args);
return EXIT_SUCCESS;
}
//=====================================================================
//Function: adminChatToggle (/a)
@ -53,8 +65,7 @@ public class vMinecraftCommands{
//Use: Toggles the player into admin chat. Every message they
// send will be piped to admin chat.
//=====================================================================
public static int adminChatToggle(Player player)
public static int adminChatToggle(Player player, String[] args)
{
if(vMinecraftSettings.getInstance().adminChatToggle())
{