mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Renaming the plugin from vminecraftPlugin to vMinecraft
This commit is contained in:
parent
4a328146c9
commit
6f973cb9b4
@ -4,7 +4,7 @@
|
|||||||
// run
|
// run
|
||||||
//Author: nossr50, TrapAlice, cerevisiae
|
//Author: nossr50, TrapAlice, cerevisiae
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
public class vminecraftAnnouncements {
|
public class vMinecraftAnnouncements {
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Function: onCommand
|
//Function: onCommand
|
||||||
@ -20,30 +20,30 @@ public class vminecraftAnnouncements {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//Only run if the global message feature is enabled
|
//Only run if the global message feature is enabled
|
||||||
if(vminecraftSettings.getInstance().globalmessages())
|
if(vMinecraftSettings.getInstance().globalmessages())
|
||||||
{
|
{
|
||||||
//Global messages that should only parse when a command can be successful
|
//Global messages that should only parse when a command can be successful
|
||||||
if(split[0].equalsIgnoreCase("/kick")) {
|
if(split[0].equalsIgnoreCase("/kick")) {
|
||||||
Player playerTarget = etc.getServer().matchPlayer(split[1]);
|
Player playerTarget = etc.getServer().matchPlayer(split[1]);
|
||||||
if (playerTarget != null && !playerTarget.hasControlOver(player)) {
|
if (playerTarget != null && !playerTarget.hasControlOver(player)) {
|
||||||
vminecraftChat.gmsg(player.getColor()+player.getName()+Colors.Blue+" has kicked "+Colors.Red+playerTarget.getColor()+playerTarget.getName());
|
vMinecraftChat.gmsg(player.getColor()+player.getName()+Colors.Blue+" has kicked "+Colors.Red+playerTarget.getColor()+playerTarget.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(split[0].equalsIgnoreCase("/ban")) {
|
if(split[0].equalsIgnoreCase("/ban")) {
|
||||||
Player playerTarget = etc.getServer().matchPlayer(split[1]);
|
Player playerTarget = etc.getServer().matchPlayer(split[1]);
|
||||||
if (playerTarget != null && !playerTarget.hasControlOver(player)) {
|
if (playerTarget != null && !playerTarget.hasControlOver(player)) {
|
||||||
vminecraftChat.gmsg(player.getColor()+player.getName()+Colors.Blue+" has banned "+Colors.Red+playerTarget.getColor()+playerTarget.getName());
|
vMinecraftChat.gmsg(player.getColor()+player.getName()+Colors.Blue+" has banned "+Colors.Red+playerTarget.getColor()+playerTarget.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(split[0].equalsIgnoreCase("/ipban")) {
|
if(split[0].equalsIgnoreCase("/ipban")) {
|
||||||
Player playerTarget = etc.getServer().matchPlayer(split[1]);
|
Player playerTarget = etc.getServer().matchPlayer(split[1]);
|
||||||
if (playerTarget != null && !playerTarget.hasControlOver(player)) {
|
if (playerTarget != null && !playerTarget.hasControlOver(player)) {
|
||||||
vminecraftChat.gmsg(player.getColor()+player.getName()+Colors.Blue+" has IP banned "+Colors.Red+playerTarget.getColor()+playerTarget.getName());
|
vMinecraftChat.gmsg(player.getColor()+player.getName()+Colors.Blue+" has IP banned "+Colors.Red+playerTarget.getColor()+playerTarget.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(split[0].equalsIgnoreCase("/time")) {
|
if(split[0].equalsIgnoreCase("/time")) {
|
||||||
if (split.length <= 2) {
|
if (split.length <= 2) {
|
||||||
vminecraftChat.gmsg(Colors.Blue+"Time changes thanks to "+player.getColor()+player.getName());
|
vMinecraftChat.gmsg(Colors.Blue+"Time changes thanks to "+player.getColor()+player.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import java.util.logging.Logger;
|
|||||||
//Use: Encapsulates all chat commands added by this mod
|
//Use: Encapsulates all chat commands added by this mod
|
||||||
//Author: nossr50, TrapAlice, cerevisiae
|
//Author: nossr50, TrapAlice, cerevisiae
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
public class vminecraftChat {
|
public class vMinecraftChat {
|
||||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -79,7 +79,7 @@ public class vminecraftChat {
|
|||||||
//and their following color codes
|
//and their following color codes
|
||||||
for(int x = 0; x<str.length(); x++)
|
for(int x = 0; x<str.length(); x++)
|
||||||
{
|
{
|
||||||
if(str.charAt(x) == '<EFBFBD>')
|
if(str.charAt(x) == '§')
|
||||||
x++;
|
x++;
|
||||||
else if("i;,.:|!".indexOf(str.charAt(x)) != -1)
|
else if("i;,.:|!".indexOf(str.charAt(x)) != -1)
|
||||||
length+=2;
|
length+=2;
|
||||||
@ -273,7 +273,7 @@ public class vminecraftChat {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public static boolean adminChatToggle(Player player, String message){
|
public static boolean adminChatToggle(Player player, String message){
|
||||||
if(vminecraftSettings.getInstance().isAdminToggled(player.getName())) {
|
if(vMinecraftSettings.getInstance().isAdminToggled(player.getName())) {
|
||||||
String adminchat = Colors.DarkPurple + "{" + getName(player)
|
String adminchat = Colors.DarkPurple + "{" + getName(player)
|
||||||
+ Colors.DarkPurple +"}" + Colors.White + " ";
|
+ Colors.DarkPurple +"}" + Colors.White + " ";
|
||||||
String[] msg = wordWrap(adminchat + message.substring(1, message.length()));
|
String[] msg = wordWrap(adminchat + message.substring(1, message.length()));
|
||||||
@ -304,7 +304,7 @@ public class vminecraftChat {
|
|||||||
//Format the name
|
//Format the name
|
||||||
String playerName = Colors.White + "<" + getName(player)
|
String playerName = Colors.White + "<" + getName(player)
|
||||||
+ Colors.White + "> ";
|
+ Colors.White + "> ";
|
||||||
if(vminecraftSettings.getInstance().greentext()) {
|
if(vMinecraftSettings.getInstance().greentext()) {
|
||||||
//Log the chat
|
//Log the chat
|
||||||
log.log(Level.INFO, "<"+player.getName()+"> " +message);
|
log.log(Level.INFO, "<"+player.getName()+"> " +message);
|
||||||
|
|
||||||
@ -331,7 +331,7 @@ public class vminecraftChat {
|
|||||||
//Format the name
|
//Format the name
|
||||||
String playerName = Colors.White + "<"
|
String playerName = Colors.White + "<"
|
||||||
+ getName(player) + Colors.White +"> ";
|
+ getName(player) + Colors.White +"> ";
|
||||||
if (vminecraftSettings.getInstance().FFF()) {
|
if (vMinecraftSettings.getInstance().FFF()) {
|
||||||
log.log(Level.INFO, "<"+player.getName()+"> "+message);
|
log.log(Level.INFO, "<"+player.getName()+"> "+message);
|
||||||
|
|
||||||
//Get the multi line array
|
//Get the multi line array
|
||||||
@ -357,7 +357,7 @@ public class vminecraftChat {
|
|||||||
//Format the name
|
//Format the name
|
||||||
String playerName = Colors.White + "<"
|
String playerName = Colors.White + "<"
|
||||||
+ getName(player) + Colors.White +"> ";
|
+ getName(player) + Colors.White +"> ";
|
||||||
if(vminecraftSettings.getInstance().quakeColors()) {
|
if(vMinecraftSettings.getInstance().quakeColors()) {
|
||||||
|
|
||||||
//Log the chat
|
//Log the chat
|
||||||
log.log(Level.INFO, "<"+player.getName()+"> "+message);
|
log.log(Level.INFO, "<"+player.getName()+"> "+message);
|
||||||
@ -401,15 +401,15 @@ public class vminecraftChat {
|
|||||||
for(int x = 0; x< msg.length(); x++)
|
for(int x = 0; x< msg.length(); x++)
|
||||||
{
|
{
|
||||||
//If the char is a ^ or <EFBFBD>
|
//If the char is a ^ or <EFBFBD>
|
||||||
if(msg.charAt(x) == '^' || msg.charAt(x) == '<EFBFBD>')
|
if(msg.charAt(x) == '^' || msg.charAt(x) == '§')
|
||||||
{
|
{
|
||||||
if(x != msg.length() - 1)
|
if(x != msg.length() - 1)
|
||||||
{
|
{
|
||||||
//If the following character is a color code
|
//If the following character is a color code
|
||||||
if(vminecraftChat.colorChange(msg.charAt(x+1)) != null)
|
if(vMinecraftChat.colorChange(msg.charAt(x+1)) != null)
|
||||||
{
|
{
|
||||||
//Set the most recent color to the new color
|
//Set the most recent color to the new color
|
||||||
recentColor = vminecraftChat.colorChange(msg.charAt(x+1));
|
recentColor = vMinecraftChat.colorChange(msg.charAt(x+1));
|
||||||
//Add the color
|
//Add the color
|
||||||
temp += recentColor;
|
temp += recentColor;
|
||||||
//Skip these chars
|
//Skip these chars
|
||||||
@ -465,15 +465,15 @@ public class vminecraftChat {
|
|||||||
for(int x = 0; x< message.length(); x++)
|
for(int x = 0; x< message.length(); x++)
|
||||||
{
|
{
|
||||||
//If the char is a ^ or <EFBFBD>
|
//If the char is a ^ or <EFBFBD>
|
||||||
if(message.charAt(x) == '^' || message.charAt(x) == '<EFBFBD>')
|
if(message.charAt(x) == '^' || message.charAt(x) == '§')
|
||||||
{
|
{
|
||||||
if(x != message.length() - 1)
|
if(x != message.length() - 1)
|
||||||
{
|
{
|
||||||
//If the following character is a color code
|
//If the following character is a color code
|
||||||
if(vminecraftChat.colorChange(message.charAt(x+1)) != null)
|
if(vMinecraftChat.colorChange(message.charAt(x+1)) != null)
|
||||||
{
|
{
|
||||||
//Set the most recent color to the new color
|
//Set the most recent color to the new color
|
||||||
color = vminecraftChat.colorChange(message.charAt(x+1));
|
color = vMinecraftChat.colorChange(message.charAt(x+1));
|
||||||
//Add the color
|
//Add the color
|
||||||
temp += color;
|
temp += color;
|
||||||
//Skip these chars
|
//Skip these chars
|
||||||
|
@ -5,18 +5,18 @@ import java.util.logging.Level;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Class: vminecraftCommands
|
//Class: vMinecraftCommands
|
||||||
//Use: Encapsulates all commands added by this mod
|
//Use: Encapsulates all commands added by this mod
|
||||||
//Author: nos, trapalice, cerevisiae
|
//Author: nos, trapalice, cerevisiae
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
public class vminecraftCommands{
|
public class vMinecraftCommands{
|
||||||
//Log output
|
//Log output
|
||||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||||
static final int EXIT_FAIL = 0,
|
static final int EXIT_FAIL = 0,
|
||||||
EXIT_SUCCESS = 1,
|
EXIT_SUCCESS = 1,
|
||||||
EXIT_CONTINUE = 2;
|
EXIT_CONTINUE = 2;
|
||||||
|
|
||||||
//The list of commands for vminecraft
|
//The list of commands for vMinecraft
|
||||||
public static commandList cl = new commandList();
|
public static commandList cl = new commandList();
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -56,16 +56,16 @@ public class vminecraftCommands{
|
|||||||
|
|
||||||
public static int adminChatToggle(Player player)
|
public static int adminChatToggle(Player player)
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ public class vminecraftCommands{
|
|||||||
//=====================================================================
|
//=====================================================================
|
||||||
public static int heal(Player player, String[] args)
|
public static int heal(Player player, String[] args)
|
||||||
{
|
{
|
||||||
if(vminecraftSettings.getInstance().cmdHeal())
|
if(vMinecraftSettings.getInstance().cmdHeal())
|
||||||
{
|
{
|
||||||
//If a target wasn't specified, heal the user.
|
//If a target wasn't specified, heal the user.
|
||||||
if (args.length < 1){
|
if (args.length < 1){
|
||||||
@ -94,11 +94,11 @@ public class vminecraftCommands{
|
|||||||
|
|
||||||
if (playerTarget != null){
|
if (playerTarget != null){
|
||||||
playerTarget.setHealth(20);
|
playerTarget.setHealth(20);
|
||||||
player.sendMessage(Colors.Blue + "You have healed " + vminecraftChat.getName(playerTarget));
|
player.sendMessage(Colors.Blue + "You have healed " + vMinecraftChat.getName(playerTarget));
|
||||||
playerTarget.sendMessage(Colors.Blue + "You have been healed by " + vminecraftChat.getName(player));
|
playerTarget.sendMessage(Colors.Blue + "You have been healed by " + vMinecraftChat.getName(player));
|
||||||
}
|
}
|
||||||
else if (playerTarget == null){
|
else if (playerTarget == null){
|
||||||
vminecraftChat.gmsg(Colors.Rose + "Couldn't find that player");
|
vMinecraftChat.gmsg(Colors.Rose + "Couldn't find that player");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
@ -115,7 +115,7 @@ public class vminecraftCommands{
|
|||||||
//=====================================================================
|
//=====================================================================
|
||||||
public static int suicide(Player player, String[] args)
|
public static int suicide(Player player, String[] args)
|
||||||
{
|
{
|
||||||
if(vminecraftSettings.getInstance().cmdSuicide())
|
if(vMinecraftSettings.getInstance().cmdSuicide())
|
||||||
{
|
{
|
||||||
//Set your health to 0. Not much to it.
|
//Set your health to 0. Not much to it.
|
||||||
player.setHealth(0);
|
player.setHealth(0);
|
||||||
@ -135,7 +135,7 @@ public class vminecraftCommands{
|
|||||||
public static int teleport(Player player, String[] args)
|
public static int teleport(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//Get if the command is enabled
|
//Get if the command is enabled
|
||||||
if(vminecraftSettings.getInstance().cmdTp())
|
if(vMinecraftSettings.getInstance().cmdTp())
|
||||||
{
|
{
|
||||||
//Make sure a player has been specified and return an error if not
|
//Make sure a player has been specified and return an error if not
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
@ -182,7 +182,7 @@ public class vminecraftCommands{
|
|||||||
public static int masstp(Player player, String[] args)
|
public static int masstp(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//If the command is enabled
|
//If the command is enabled
|
||||||
if(vminecraftSettings.getInstance().cmdMasstp()) {
|
if(vMinecraftSettings.getInstance().cmdMasstp()) {
|
||||||
//Go through all players and move them to the user
|
//Go through all players and move them to the user
|
||||||
for (Player p : etc.getServer().getPlayerList()) {
|
for (Player p : etc.getServer().getPlayerList()) {
|
||||||
if (!p.hasControlOver(player)) {
|
if (!p.hasControlOver(player)) {
|
||||||
@ -208,7 +208,7 @@ public class vminecraftCommands{
|
|||||||
public static int tphere(Player player, String[] args)
|
public static int tphere(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//Check if the command is enabled.
|
//Check if the command is enabled.
|
||||||
if (vminecraftSettings.getInstance().cmdTphere()) {
|
if (vMinecraftSettings.getInstance().cmdTphere()) {
|
||||||
//Make sure a player is specified
|
//Make sure a player is specified
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
player.sendMessage(Colors.Rose + "Correct usage is: /tphere [player]");
|
player.sendMessage(Colors.Rose + "Correct usage is: /tphere [player]");
|
||||||
@ -241,11 +241,11 @@ public class vminecraftCommands{
|
|||||||
//Input: Player player: The player using the command
|
//Input: Player player: The player using the command
|
||||||
// String[] args: Ignored
|
// String[] args: Ignored
|
||||||
//Output: int: Exit Code
|
//Output: int: Exit Code
|
||||||
//Use: Reloads the settings for vminecraft
|
//Use: Reloads the settings for vMinecraft
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
public static int reload(Player player, String[] args)
|
public static int reload(Player player, String[] args)
|
||||||
{
|
{
|
||||||
vminecraftSettings.getInstance().loadSettings();
|
vMinecraftSettings.getInstance().loadSettings();
|
||||||
return EXIT_FAIL;
|
return EXIT_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,12 +259,12 @@ public class vminecraftCommands{
|
|||||||
public static int rules(Player player, String[] args)
|
public static int rules(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//If the rules exist
|
//If the rules exist
|
||||||
if(vminecraftSettings.getInstance().cmdRules()
|
if(vMinecraftSettings.getInstance().cmdRules()
|
||||||
&& vminecraftSettings.getInstance().getRules().length > 0) {
|
&& vMinecraftSettings.getInstance().getRules().length > 0) {
|
||||||
|
|
||||||
//Apply QuakeCode Colors to the rules
|
//Apply QuakeCode Colors to the rules
|
||||||
String[] rules = vminecraftChat.applyColors(
|
String[] rules = vMinecraftChat.applyColors(
|
||||||
vminecraftSettings.getInstance().getRules());
|
vMinecraftSettings.getInstance().getRules());
|
||||||
//Display them
|
//Display them
|
||||||
for (String str : rules ) {
|
for (String str : rules ) {
|
||||||
if(!str.isEmpty())
|
if(!str.isEmpty())
|
||||||
@ -287,11 +287,11 @@ public class vminecraftCommands{
|
|||||||
public static int fabulous(Player player, String[] args)
|
public static int fabulous(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//If the command is enabled
|
//If the command is enabled
|
||||||
if(vminecraftSettings.getInstance().cmdFabulous()) {
|
if(vMinecraftSettings.getInstance().cmdFabulous()) {
|
||||||
|
|
||||||
//Format the name
|
//Format the name
|
||||||
String playerName = Colors.White + "<"
|
String playerName = Colors.White + "<"
|
||||||
+ vminecraftChat.getName(player) + Colors.White +"> ";
|
+ vMinecraftChat.getName(player) + Colors.White +"> ";
|
||||||
//Make sure a message has been specified
|
//Make sure a message has been specified
|
||||||
if (args.length < 1) {return EXIT_FAIL;}
|
if (args.length < 1) {return EXIT_FAIL;}
|
||||||
String str = " ";
|
String str = " ";
|
||||||
@ -303,17 +303,17 @@ 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);
|
String[] message = vMinecraftChat.wordWrap(playerName + str);
|
||||||
|
|
||||||
//Output the message
|
//Output the message
|
||||||
for(String msg: message)
|
for(String msg: message)
|
||||||
{
|
{
|
||||||
if (msg.contains(playerName))
|
if (msg.contains(playerName))
|
||||||
vminecraftChat.gmsg( playerName
|
vMinecraftChat.gmsg( playerName
|
||||||
+ vminecraftChat.rainbow(
|
+ vMinecraftChat.rainbow(
|
||||||
msg.substring(playerName.length())));
|
msg.substring(playerName.length())));
|
||||||
else
|
else
|
||||||
vminecraftChat.gmsg(vminecraftChat.rainbow(msg));
|
vMinecraftChat.gmsg(vMinecraftChat.rainbow(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
@ -331,7 +331,7 @@ public class vminecraftCommands{
|
|||||||
public static int whois(Player player, String[] args)
|
public static int whois(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//If the command is enabled
|
//If the command is enabled
|
||||||
if (vminecraftSettings.getInstance().cmdWhoIs()) {
|
if (vMinecraftSettings.getInstance().cmdWhoIs()) {
|
||||||
//If a player is specified
|
//If a player is specified
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
player.sendMessage(Colors.Rose + "Usage is /whois [player]");
|
player.sendMessage(Colors.Rose + "Usage is /whois [player]");
|
||||||
@ -350,7 +350,7 @@ public class vminecraftCommands{
|
|||||||
|
|
||||||
//Displaying the information
|
//Displaying the information
|
||||||
player.sendMessage(Colors.Blue + "Whois results for " +
|
player.sendMessage(Colors.Blue + "Whois results for " +
|
||||||
vminecraftChat.getName(playerTarget));
|
vMinecraftChat.getName(playerTarget));
|
||||||
//Group
|
//Group
|
||||||
for(String group: playerTarget.getGroups())
|
for(String group: playerTarget.getGroups())
|
||||||
player.sendMessage(Colors.Blue + "Groups: " + group);
|
player.sendMessage(Colors.Blue + "Groups: " + group);
|
||||||
@ -383,7 +383,7 @@ public class vminecraftCommands{
|
|||||||
public static int who(Player player, String[] args)
|
public static int who(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//If the command is enabled
|
//If the command is enabled
|
||||||
if (vminecraftSettings.getInstance().cmdWho()) {
|
if (vMinecraftSettings.getInstance().cmdWho()) {
|
||||||
//Loop through all players counting them and adding to the list
|
//Loop through all players counting them and adding to the list
|
||||||
int count=0;
|
int count=0;
|
||||||
String tempList = "";
|
String tempList = "";
|
||||||
@ -391,9 +391,9 @@ public class vminecraftCommands{
|
|||||||
{
|
{
|
||||||
if(p != null){
|
if(p != null){
|
||||||
if(count == 0)
|
if(count == 0)
|
||||||
tempList += vminecraftChat.getName(p);
|
tempList += vMinecraftChat.getName(p);
|
||||||
else
|
else
|
||||||
tempList += Colors.White + ", " + vminecraftChat.getName(p);
|
tempList += Colors.White + ", " + vMinecraftChat.getName(p);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -406,7 +406,7 @@ public class vminecraftCommands{
|
|||||||
}
|
}
|
||||||
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 ("
|
String[] tempOut = vMinecraftChat.wordWrap(Colors.Rose + "Player List ("
|
||||||
+ count + "/" + maxPlayers +"): " + tempList);
|
+ count + "/" + maxPlayers +"): " + tempList);
|
||||||
for(String msg: tempOut)
|
for(String msg: tempOut)
|
||||||
player.sendMessage( msg );
|
player.sendMessage( msg );
|
||||||
@ -426,13 +426,13 @@ public class vminecraftCommands{
|
|||||||
public static int say(Player player, String[] args)
|
public static int say(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//If the command is enabled
|
//If the command is enabled
|
||||||
if (vminecraftSettings.getInstance().cmdSay()) {
|
if (vMinecraftSettings.getInstance().cmdSay()) {
|
||||||
//Make sure a message is supplied or output an error
|
//Make sure a message is supplied or output an error
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
player.sendMessage(Colors.Rose + "Usage is /say [message]");
|
player.sendMessage(Colors.Rose + "Usage is /say [message]");
|
||||||
}
|
}
|
||||||
//Display the message globally
|
//Display the message globally
|
||||||
vminecraftChat.gmsg(Colors.Yellow + etc.combineSplit(0, args, " "));
|
vMinecraftChat.gmsg(Colors.Yellow + etc.combineSplit(0, args, " "));
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
return EXIT_FAIL;
|
return EXIT_FAIL;
|
||||||
@ -448,18 +448,18 @@ public class vminecraftCommands{
|
|||||||
public static int slay(Player player, String[] args)
|
public static int slay(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//Check if the command is enabled
|
//Check if the command is enabled
|
||||||
if(vminecraftSettings.getInstance().cmdEzModo()) {
|
if(vMinecraftSettings.getInstance().cmdEzModo()) {
|
||||||
//Get the player by name
|
//Get the player by name
|
||||||
Player playerTarget = etc.getServer().matchPlayer(args[0]);
|
Player playerTarget = etc.getServer().matchPlayer(args[0]);
|
||||||
//If the player doesn't exist don't run
|
//If the player doesn't exist don't run
|
||||||
if(playerTarget == null)
|
if(playerTarget == null)
|
||||||
return EXIT_FAIL;
|
return EXIT_FAIL;
|
||||||
//If the player isn't invulnerable kill them
|
//If the player isn't invulnerable kill them
|
||||||
if (!vminecraftSettings.getInstance().isEzModo(playerTarget.getName())) {
|
if (!vMinecraftSettings.getInstance().isEzModo(playerTarget.getName())) {
|
||||||
playerTarget.setHealth(0);
|
playerTarget.setHealth(0);
|
||||||
vminecraftChat.gmsg(vminecraftChat.getName(player)
|
vMinecraftChat.gmsg(vMinecraftChat.getName(player)
|
||||||
+ Colors.LightBlue + " has slain "
|
+ Colors.LightBlue + " has slain "
|
||||||
+ vminecraftChat.getName(playerTarget));
|
+ vMinecraftChat.getName(playerTarget));
|
||||||
//Otherwise output error to the user
|
//Otherwise output error to the user
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(Colors.Rose + "That player is currently in ezmodo! Hahahaha");
|
player.sendMessage(Colors.Rose + "That player is currently in ezmodo! Hahahaha");
|
||||||
@ -479,19 +479,19 @@ public class vminecraftCommands{
|
|||||||
public static int invuln(Player player, String[] args)
|
public static int invuln(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//If the command is enabled
|
//If the command is enabled
|
||||||
if (vminecraftSettings.getInstance().cmdEzModo()) {
|
if (vMinecraftSettings.getInstance().cmdEzModo()) {
|
||||||
//If the player is already invulnerable, turn ezmodo off.
|
//If the player is already invulnerable, turn ezmodo off.
|
||||||
if (vminecraftSettings.getInstance().isEzModo(player.getName())) {
|
if (vMinecraftSettings.getInstance().isEzModo(player.getName())) {
|
||||||
player.sendMessage(Colors.Red + "ezmodo = off");
|
player.sendMessage(Colors.Red + "ezmodo = off");
|
||||||
vminecraftSettings.getInstance().removeEzModo(player.getName());
|
vMinecraftSettings.getInstance().removeEzModo(player.getName());
|
||||||
//Otherwise make them invulnerable
|
//Otherwise make them invulnerable
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(Colors.LightBlue + "eh- maji? ezmodo!?");
|
player.sendMessage(Colors.LightBlue + "eh- maji? ezmodo!?");
|
||||||
player.sendMessage(Colors.Rose + "kimo-i");
|
player.sendMessage(Colors.Rose + "kimo-i");
|
||||||
player.sendMessage(Colors.LightBlue + "Easy Mode ga yurusareru no wa shougakusei made dayo ne");
|
player.sendMessage(Colors.LightBlue + "Easy Mode ga yurusareru no wa shougakusei made dayo ne");
|
||||||
player.sendMessage(Colors.Red + "**Laughter**");
|
player.sendMessage(Colors.Red + "**Laughter**");
|
||||||
vminecraftSettings.getInstance().addEzModo(player.getName());
|
vMinecraftSettings.getInstance().addEzModo(player.getName());
|
||||||
player.setHealth(vminecraftSettings.getInstance().ezModoHealth());
|
player.setHealth(vMinecraftSettings.getInstance().ezModoHealth());
|
||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -508,8 +508,8 @@ public class vminecraftCommands{
|
|||||||
public static int ezlist(Player player, String[] args)
|
public static int ezlist(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//If the feature is enabled list the players
|
//If the feature is enabled list the players
|
||||||
if(vminecraftSettings.getInstance().cmdEzModo()) {
|
if(vMinecraftSettings.getInstance().cmdEzModo()) {
|
||||||
player.sendMessage("Ezmodo: " + vminecraftSettings.getInstance().ezModoList());
|
player.sendMessage("Ezmodo: " + vMinecraftSettings.getInstance().ezModoList());
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
return EXIT_FAIL;
|
return EXIT_FAIL;
|
||||||
@ -761,7 +761,7 @@ class commandList {
|
|||||||
|
|
||||||
Method m;
|
Method m;
|
||||||
try {
|
try {
|
||||||
m = vminecraftCommands.class.getMethod(function, Player.class, String[].class);
|
m = vMinecraftCommands.class.getMethod(function, Player.class, String[].class);
|
||||||
m.setAccessible(true);
|
m.setAccessible(true);
|
||||||
return (Integer) m.invoke(null, player, arg);
|
return (Integer) m.invoke(null, player, arg);
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Class: vminecraftListener
|
//Class: vMinecraftListener
|
||||||
//Use: The listener to catch incoming chat and commands
|
//Use: The listener to catch incoming chat and commands
|
||||||
//Author: nossr50, TrapAlice, cerevisiae
|
//Author: nossr50, TrapAlice, cerevisiae
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
public class vminecraftListener extends PluginListener {
|
public class vMinecraftListener extends PluginListener {
|
||||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Function: disable
|
//Function: disable
|
||||||
//Input: None
|
//Input: None
|
||||||
//Output: None
|
//Output: None
|
||||||
//Use: Disables vminecraft, but why would you want to do that? ;)
|
//Use: Disables vMinecraft, but why would you want to do that? ;)
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
public void disable() {
|
public void disable() {
|
||||||
log.log(Level.INFO, "vminecraft disabled");
|
log.log(Level.INFO, "vMinecraft disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -30,20 +30,20 @@ public class vminecraftListener extends PluginListener {
|
|||||||
|
|
||||||
//Quote (Greentext)
|
//Quote (Greentext)
|
||||||
if (message.startsWith("@"))
|
if (message.startsWith("@"))
|
||||||
return vminecraftChat.adminChat(player, message);
|
return vMinecraftChat.adminChat(player, message);
|
||||||
if (vminecraftSettings.getInstance().isAdminToggled(player.getName()))
|
if (vMinecraftSettings.getInstance().isAdminToggled(player.getName()))
|
||||||
return vminecraftChat.adminChatToggle(player, message);
|
return vMinecraftChat.adminChatToggle(player, message);
|
||||||
|
|
||||||
else if (message.startsWith(">"))
|
else if (message.startsWith(">"))
|
||||||
return vminecraftChat.quote(player, message);
|
return vMinecraftChat.quote(player, message);
|
||||||
|
|
||||||
//Rage (FFF)
|
//Rage (FFF)
|
||||||
else if (message.startsWith("FFF"))
|
else if (message.startsWith("FFF"))
|
||||||
return vminecraftChat.rage(player, message);
|
return vMinecraftChat.rage(player, message);
|
||||||
|
|
||||||
//Send through quakeColors otherwise
|
//Send through quakeColors otherwise
|
||||||
else
|
else
|
||||||
return vminecraftChat.quakeColors(player, message);
|
return vMinecraftChat.quakeColors(player, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -61,7 +61,7 @@ public class vminecraftListener extends PluginListener {
|
|||||||
System.arraycopy(split, 1, args, 0, args.length);
|
System.arraycopy(split, 1, args, 0, args.length);
|
||||||
|
|
||||||
//Return the results of the command
|
//Return the results of the command
|
||||||
int exitCode = vminecraftCommands.cl.call(split[0], player, args);
|
int exitCode = vMinecraftCommands.cl.call(split[0], player, args);
|
||||||
if(exitCode == 0)
|
if(exitCode == 0)
|
||||||
return false;
|
return false;
|
||||||
else if(exitCode == 1)
|
else if(exitCode == 1)
|
||||||
@ -81,12 +81,12 @@ public class vminecraftListener extends PluginListener {
|
|||||||
//Use: Checks for exploits and runs the commands
|
//Use: Checks for exploits and runs the commands
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
public boolean onHealthChange(Player player,int oldValue,int newValue){
|
public boolean onHealthChange(Player player,int oldValue,int newValue){
|
||||||
if (player.getHealth() != vminecraftSettings.getInstance().ezModoHealth() && vminecraftSettings.getInstance().isEzModo(player.getName())) {
|
if (player.getHealth() != vMinecraftSettings.getInstance().ezModoHealth() && vMinecraftSettings.getInstance().isEzModo(player.getName())) {
|
||||||
player.setHealth(vminecraftSettings.getInstance().ezModoHealth());
|
player.setHealth(vMinecraftSettings.getInstance().ezModoHealth());
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (vminecraftSettings.getInstance().globalmessages() && player.getHealth() < 1) {
|
else if (vMinecraftSettings.getInstance().globalmessages() && player.getHealth() < 1) {
|
||||||
vminecraftChat.gmsg(Colors.Gray + player.getName() + " " + vminecraftSettings.randomDeathMsg());
|
vMinecraftChat.gmsg(Colors.Gray + player.getName() + " " + vMinecraftSettings.randomDeathMsg());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,10 @@ import java.util.logging.Logger;
|
|||||||
//Use: Controls the settings for vminecraft
|
//Use: Controls the settings for vminecraft
|
||||||
//Author: nossr50, TrapAlice, cerevisiae
|
//Author: nossr50, TrapAlice, cerevisiae
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
public class vminecraftSettings {
|
public class vMinecraftSettings {
|
||||||
//private final static Object syncLock = new Object();
|
//private final static Object syncLock = new Object();
|
||||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||||
private static volatile vminecraftSettings instance;
|
private static volatile vMinecraftSettings instance;
|
||||||
|
|
||||||
|
|
||||||
//The feature settings
|
//The feature settings
|
||||||
@ -32,9 +32,9 @@ public class vminecraftSettings {
|
|||||||
cmdWho = false,
|
cmdWho = false,
|
||||||
stopFire = false,
|
stopFire = false,
|
||||||
stopTnt = false,
|
stopTnt = false,
|
||||||
cmdHeal = false,
|
cmdHeal = false,
|
||||||
cmdSuicide = false,
|
cmdSuicide = false,
|
||||||
cmdAdminToggle = false,
|
cmdAdminToggle = false,
|
||||||
cmdEzModo = false;
|
cmdEzModo = false;
|
||||||
//An array of players currently in ezmodo
|
//An array of players currently in ezmodo
|
||||||
static ArrayList<String> ezModo = new ArrayList<String>();
|
static ArrayList<String> ezModo = new ArrayList<String>();
|
||||||
@ -78,8 +78,8 @@ public class vminecraftSettings {
|
|||||||
writer.write("cmdSay=true\r\n");
|
writer.write("cmdSay=true\r\n");
|
||||||
writer.write("cmdTp=true\r\n");
|
writer.write("cmdTp=true\r\n");
|
||||||
writer.write("cmdRules=true\r\n");
|
writer.write("cmdRules=true\r\n");
|
||||||
writer.write("cmdSuicide=true\r\n");
|
writer.write("cmdSuicide=true\r\n");
|
||||||
writer.write("cmdAdminToggle=true\r\n");
|
writer.write("cmdAdminToggle=true\r\n");
|
||||||
writer.write("globalmessages=true\r\n");
|
writer.write("globalmessages=true\r\n");
|
||||||
writer.write("FFF=true\r\n");
|
writer.write("FFF=true\r\n");
|
||||||
writer.write("adminchat=true\r\n");
|
writer.write("adminchat=true\r\n");
|
||||||
@ -89,10 +89,10 @@ public class vminecraftSettings {
|
|||||||
writer.write("#The health ezmodo people will have while in ezmodo. Don't set to 0\r\n");
|
writer.write("#The health ezmodo people will have while in ezmodo. Don't set to 0\r\n");
|
||||||
writer.write("ezHealth=30\r\n");
|
writer.write("ezHealth=30\r\n");
|
||||||
writer.write("stopFire=false\r\n");
|
writer.write("stopFire=false\r\n");
|
||||||
writer.write("stopTnt=false\r\n");
|
writer.write("stopTnt=false\r\n");
|
||||||
writer.write("rules=Rules@#1: No griefing@#2: No griefing\r\n");
|
writer.write("rules=Rules@#1: No griefing@#2: No griefing\r\n");
|
||||||
writer.write("#Death messages, seperate them by comma. All death messages start with the player name and a space.\r\n");
|
writer.write("#Death messages, seperate them by comma. All death messages start with the player name and a space.\r\n");
|
||||||
writer.write("deathMessages=is no more,died horribly,went peacefully\r\n");
|
writer.write("deathMessages=is no more,died horribly,went peacefully\r\n");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.SEVERE, "Exception while creating " + location, e);
|
log.log(Level.SEVERE, "Exception while creating " + location, e);
|
||||||
} finally {
|
} finally {
|
||||||
@ -130,18 +130,19 @@ public class vminecraftSettings {
|
|||||||
cmdTphere = properties.getBoolean("cmdTphere",true);
|
cmdTphere = properties.getBoolean("cmdTphere",true);
|
||||||
cmdSuicide = properties.getBoolean("cmdSuicide", true);
|
cmdSuicide = properties.getBoolean("cmdSuicide", true);
|
||||||
cmdHeal = properties.getBoolean("cmdHeal",true);
|
cmdHeal = properties.getBoolean("cmdHeal",true);
|
||||||
cmdAdminToggle = properties.getBoolean("cmdAdminToggle", true);
|
cmdAdminToggle = properties.getBoolean("cmdAdminToggle", true);
|
||||||
globalmessages = properties.getBoolean("globalmessages",true);
|
globalmessages = properties.getBoolean("globalmessages",true);
|
||||||
cmdSay = properties.getBoolean("cmdSay",true);
|
cmdSay = properties.getBoolean("cmdSay",true);
|
||||||
cmdEzModo = properties.getBoolean("cmdEzModo",true);
|
cmdEzModo = properties.getBoolean("cmdEzModo",true);
|
||||||
stopFire = properties.getBoolean("stopFire",true);
|
stopFire = properties.getBoolean("stopFire",true);
|
||||||
stopTnt = properties.getBoolean("stopTNT",true);
|
stopTnt = properties.getBoolean("stopTNT",true);
|
||||||
rules = properties.getString("rules", "").split("@");
|
rules = properties.getString("rules", "").split("@");
|
||||||
deathMessages = properties.getString("deathmessages", "").split(",");
|
deathMessages = properties.getString("deathmessages", "").split(",");
|
||||||
|
|
||||||
String[] tempEz = properties.getString("ezModo").split(",");
|
String[] tempEz = properties.getString("ezModo").split(",");
|
||||||
ezModo = new ArrayList<String>();
|
ezModo = new ArrayList<String>();
|
||||||
for(int i = 0; i < tempEz.length; i++)
|
for(String ezName : tempEz)
|
||||||
ezModo.add(tempEz[i]);
|
ezModo.add(ezName);
|
||||||
|
|
||||||
ezHealth = properties.getInt("ezHealth");
|
ezHealth = properties.getInt("ezHealth");
|
||||||
|
|
||||||
@ -208,9 +209,9 @@ public class vminecraftSettings {
|
|||||||
//Output: vminecraftSettings: The instance of the settings
|
//Output: vminecraftSettings: The instance of the settings
|
||||||
//Use: Returns the instance of the settings
|
//Use: Returns the instance of the settings
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
public static vminecraftSettings getInstance() {
|
public static vMinecraftSettings getInstance() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = new vminecraftSettings();
|
instance = new vMinecraftSettings();
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user