mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Created a wrapper for Player.sendMessage() That automatically applies Quake Colors and Word Wrap
This commit is contained in:
parent
bf1381213e
commit
f129b36849
@ -47,7 +47,8 @@ public class vMinecraftCommands{
|
|||||||
cl.registerAlias("/suicide", "/wrists");
|
cl.registerAlias("/suicide", "/wrists");
|
||||||
cl.registerAlias("/clearinventory", "/ci");
|
cl.registerAlias("/clearinventory", "/ci");
|
||||||
}
|
}
|
||||||
//=====================================================================
|
|
||||||
|
//=====================================================================
|
||||||
//Function: me (/me)
|
//Function: me (/me)
|
||||||
//Input: Player player: The player using the command
|
//Input: Player player: The player using the command
|
||||||
//Output: int: Exit Code
|
//Output: int: Exit Code
|
||||||
@ -60,6 +61,7 @@ public class vMinecraftCommands{
|
|||||||
vMinecraftChat.emote(player, str);
|
vMinecraftChat.emote(player, str);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Function: adminChatToggle (/a)
|
//Function: adminChatToggle (/a)
|
||||||
//Input: Player player: The player using the command
|
//Input: Player player: The player using the command
|
||||||
@ -68,22 +70,22 @@ public class vMinecraftCommands{
|
|||||||
// send will be piped to admin chat.
|
// send will be piped to admin chat.
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
public static int adminChatToggle(Player player, String[] args)
|
public static int adminChatToggle(Player player, String[] args)
|
||||||
{
|
{
|
||||||
if(vMinecraftSettings.getInstance().adminChatToggle())
|
if(vMinecraftSettings.getInstance().adminChatToggle())
|
||||||
{
|
{
|
||||||
//If the player is already toggled for admin chat, remove them
|
//If the player is already toggled for admin chat, remove them
|
||||||
if (vMinecraftSettings.getInstance().isAdminToggled(player.getName())) {
|
if (vMinecraftSettings.getInstance().isAdminToggled(player.getName())) {
|
||||||
player.sendMessage(Colors.Red + "Admin Chat Toggle = off");
|
player.sendMessage(Colors.Red + "Admin Chat Toggle = off");
|
||||||
vMinecraftSettings.getInstance().removeAdminToggled(player.getName());
|
vMinecraftSettings.getInstance().removeAdminToggled(player.getName());
|
||||||
//Otherwise include them
|
//Otherwise include them
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(Colors.Blue + "Admin Chat Toggled on");
|
player.sendMessage(Colors.Blue + "Admin Chat Toggled on");
|
||||||
vMinecraftSettings.getInstance().addAdminToggled(player.getName());
|
vMinecraftSettings.getInstance().addAdminToggled(player.getName());
|
||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
return EXIT_FAIL;
|
return EXIT_FAIL;
|
||||||
}
|
}
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Function: heal (/heal)
|
//Function: heal (/heal)
|
||||||
//Input: Player player: The player using the command
|
//Input: Player player: The player using the command
|
||||||
@ -316,18 +318,7 @@ public class vMinecraftCommands{
|
|||||||
log.log(Level.INFO, player.getName()+" fabulously said \""+ str+"\"");
|
log.log(Level.INFO, player.getName()+" fabulously said \""+ str+"\"");
|
||||||
|
|
||||||
//Prepend the player name and cut into lines.
|
//Prepend the player name and cut into lines.
|
||||||
String[] message = vMinecraftChat.wordWrap(playerName + str);
|
vMinecraftChat.gmsg(playerName + vMinecraftChat.rainbow(str));
|
||||||
|
|
||||||
//Output the message
|
|
||||||
for(String msg: message)
|
|
||||||
{
|
|
||||||
if (msg.contains(playerName))
|
|
||||||
vMinecraftChat.gmsg( playerName
|
|
||||||
+ vMinecraftChat.rainbow(
|
|
||||||
msg.substring(playerName.length())));
|
|
||||||
else
|
|
||||||
vMinecraftChat.gmsg(vMinecraftChat.rainbow(msg));
|
|
||||||
}
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -418,11 +409,10 @@ public class vMinecraftCommands{
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
int maxPlayers = server.getInt("max-players");
|
int maxPlayers = server.getInt("max-players");
|
||||||
|
|
||||||
//Output the player list
|
//Output the player list
|
||||||
String[] tempOut = vMinecraftChat.wordWrap(Colors.Rose + "Player List ("
|
vMinecraftChat.sendMessage(player, Colors.Rose + "Player List ("
|
||||||
+ count + "/" + maxPlayers +"): " + tempList);
|
+ count + "/" + maxPlayers +"): " + tempList);
|
||||||
for(String msg: tempOut)
|
|
||||||
player.sendMessage( msg );
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user