Renaming the plugin from vminecraftPlugin to vMinecraft

This commit is contained in:
cerevisiae 2010-11-30 22:41:30 -06:00
parent 4a328146c9
commit 6f973cb9b4
5 changed files with 97 additions and 96 deletions

View File

@ -4,7 +4,7 @@
// run
//Author: nossr50, TrapAlice, cerevisiae
//=====================================================================
public class vminecraftAnnouncements {
public class vMinecraftAnnouncements {
//=====================================================================
//Function: onCommand
@ -20,30 +20,30 @@ public class vminecraftAnnouncements {
return false;
}
//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
if(split[0].equalsIgnoreCase("/kick")) {
Player playerTarget = etc.getServer().matchPlayer(split[1]);
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")) {
Player playerTarget = etc.getServer().matchPlayer(split[1]);
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")) {
Player playerTarget = etc.getServer().matchPlayer(split[1]);
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.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());
}
}
}

View File

@ -7,7 +7,7 @@ import java.util.logging.Logger;
//Use: Encapsulates all chat commands added by this mod
//Author: nossr50, TrapAlice, cerevisiae
//=====================================================================
public class vminecraftChat {
public class vMinecraftChat {
protected static final Logger log = Logger.getLogger("Minecraft");
//=====================================================================
@ -79,7 +79,7 @@ public class vminecraftChat {
//and their following color codes
for(int x = 0; x<str.length(); x++)
{
if(str.charAt(x) == '<EFBFBD>')
if(str.charAt(x) == '§')
x++;
else if("i;,.:|!".indexOf(str.charAt(x)) != -1)
length+=2;
@ -273,7 +273,7 @@ public class vminecraftChat {
return false;
}
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)
+ Colors.DarkPurple +"}" + Colors.White + " ";
String[] msg = wordWrap(adminchat + message.substring(1, message.length()));
@ -304,7 +304,7 @@ public class vminecraftChat {
//Format the name
String playerName = Colors.White + "<" + getName(player)
+ Colors.White + "> ";
if(vminecraftSettings.getInstance().greentext()) {
if(vMinecraftSettings.getInstance().greentext()) {
//Log the chat
log.log(Level.INFO, "<"+player.getName()+"> " +message);
@ -331,7 +331,7 @@ public class vminecraftChat {
//Format the name
String playerName = Colors.White + "<"
+ getName(player) + Colors.White +"> ";
if (vminecraftSettings.getInstance().FFF()) {
if (vMinecraftSettings.getInstance().FFF()) {
log.log(Level.INFO, "<"+player.getName()+"> "+message);
//Get the multi line array
@ -357,7 +357,7 @@ public class vminecraftChat {
//Format the name
String playerName = Colors.White + "<"
+ getName(player) + Colors.White +"> ";
if(vminecraftSettings.getInstance().quakeColors()) {
if(vMinecraftSettings.getInstance().quakeColors()) {
//Log the chat
log.log(Level.INFO, "<"+player.getName()+"> "+message);
@ -401,15 +401,15 @@ public class vminecraftChat {
for(int x = 0; x< msg.length(); x++)
{
//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 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
recentColor = vminecraftChat.colorChange(msg.charAt(x+1));
recentColor = vMinecraftChat.colorChange(msg.charAt(x+1));
//Add the color
temp += recentColor;
//Skip these chars
@ -465,15 +465,15 @@ public class vminecraftChat {
for(int x = 0; x< message.length(); x++)
{
//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 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
color = vminecraftChat.colorChange(message.charAt(x+1));
color = vMinecraftChat.colorChange(message.charAt(x+1));
//Add the color
temp += color;
//Skip these chars

View File

@ -5,18 +5,18 @@ import java.util.logging.Level;
import java.util.logging.Logger;
//=====================================================================
//Class: vminecraftCommands
//Class: vMinecraftCommands
//Use: Encapsulates all commands added by this mod
//Author: nos, trapalice, cerevisiae
//=====================================================================
public class vminecraftCommands{
public class vMinecraftCommands{
//Log output
protected static final Logger log = Logger.getLogger("Minecraft");
static final int EXIT_FAIL = 0,
EXIT_SUCCESS = 1,
EXIT_CONTINUE = 2;
//The list of commands for vminecraft
//The list of commands for vMinecraft
public static commandList cl = new commandList();
//=====================================================================
@ -56,16 +56,16 @@ public class vminecraftCommands{
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 (vminecraftSettings.getInstance().isAdminToggled(player.getName())) {
if (vMinecraftSettings.getInstance().isAdminToggled(player.getName())) {
player.sendMessage(Colors.Red + "Admin Chat Toggle = off");
vminecraftSettings.getInstance().removeAdminToggled(player.getName());
vMinecraftSettings.getInstance().removeAdminToggled(player.getName());
//Otherwise include them
} else {
player.sendMessage(Colors.Blue + "Admin Chat Toggled on");
vminecraftSettings.getInstance().addAdminToggled(player.getName());
vMinecraftSettings.getInstance().addAdminToggled(player.getName());
}
return EXIT_SUCCESS;
}
@ -81,7 +81,7 @@ public class vminecraftCommands{
//=====================================================================
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 (args.length < 1){
@ -94,11 +94,11 @@ public class vminecraftCommands{
if (playerTarget != null){
playerTarget.setHealth(20);
player.sendMessage(Colors.Blue + "You have healed " + vminecraftChat.getName(playerTarget));
playerTarget.sendMessage(Colors.Blue + "You have been healed by " + vminecraftChat.getName(player));
player.sendMessage(Colors.Blue + "You have healed " + vMinecraftChat.getName(playerTarget));
playerTarget.sendMessage(Colors.Blue + "You have been healed by " + vMinecraftChat.getName(player));
}
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;
@ -115,7 +115,7 @@ public class vminecraftCommands{
//=====================================================================
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.
player.setHealth(0);
@ -135,7 +135,7 @@ public class vminecraftCommands{
public static int teleport(Player player, String[] args)
{
//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
if (args.length < 1) {
@ -182,7 +182,7 @@ public class vminecraftCommands{
public static int masstp(Player player, String[] args)
{
//If the command is enabled
if(vminecraftSettings.getInstance().cmdMasstp()) {
if(vMinecraftSettings.getInstance().cmdMasstp()) {
//Go through all players and move them to the user
for (Player p : etc.getServer().getPlayerList()) {
if (!p.hasControlOver(player)) {
@ -208,7 +208,7 @@ public class vminecraftCommands{
public static int tphere(Player player, String[] args)
{
//Check if the command is enabled.
if (vminecraftSettings.getInstance().cmdTphere()) {
if (vMinecraftSettings.getInstance().cmdTphere()) {
//Make sure a player is specified
if (args.length < 1) {
player.sendMessage(Colors.Rose + "Correct usage is: /tphere [player]");
@ -241,11 +241,11 @@ public class vminecraftCommands{
//Input: Player player: The player using the command
// String[] args: Ignored
//Output: int: Exit Code
//Use: Reloads the settings for vminecraft
//Use: Reloads the settings for vMinecraft
//=====================================================================
public static int reload(Player player, String[] args)
{
vminecraftSettings.getInstance().loadSettings();
vMinecraftSettings.getInstance().loadSettings();
return EXIT_FAIL;
}
@ -259,12 +259,12 @@ public class vminecraftCommands{
public static int rules(Player player, String[] args)
{
//If the rules exist
if(vminecraftSettings.getInstance().cmdRules()
&& vminecraftSettings.getInstance().getRules().length > 0) {
if(vMinecraftSettings.getInstance().cmdRules()
&& vMinecraftSettings.getInstance().getRules().length > 0) {
//Apply QuakeCode Colors to the rules
String[] rules = vminecraftChat.applyColors(
vminecraftSettings.getInstance().getRules());
String[] rules = vMinecraftChat.applyColors(
vMinecraftSettings.getInstance().getRules());
//Display them
for (String str : rules ) {
if(!str.isEmpty())
@ -287,11 +287,11 @@ public class vminecraftCommands{
public static int fabulous(Player player, String[] args)
{
//If the command is enabled
if(vminecraftSettings.getInstance().cmdFabulous()) {
if(vMinecraftSettings.getInstance().cmdFabulous()) {
//Format the name
String playerName = Colors.White + "<"
+ vminecraftChat.getName(player) + Colors.White +"> ";
+ vMinecraftChat.getName(player) + Colors.White +"> ";
//Make sure a message has been specified
if (args.length < 1) {return EXIT_FAIL;}
String str = " ";
@ -303,17 +303,17 @@ public class vminecraftCommands{
log.log(Level.INFO, player.getName()+" fabulously said \""+ str+"\"");
//Prepend the player name and cut into lines.
String[] message = vminecraftChat.wordWrap(playerName + str);
String[] message = vMinecraftChat.wordWrap(playerName + str);
//Output the message
for(String msg: message)
{
if (msg.contains(playerName))
vminecraftChat.gmsg( playerName
+ vminecraftChat.rainbow(
vMinecraftChat.gmsg( playerName
+ vMinecraftChat.rainbow(
msg.substring(playerName.length())));
else
vminecraftChat.gmsg(vminecraftChat.rainbow(msg));
vMinecraftChat.gmsg(vMinecraftChat.rainbow(msg));
}
return EXIT_SUCCESS;
@ -331,7 +331,7 @@ public class vminecraftCommands{
public static int whois(Player player, String[] args)
{
//If the command is enabled
if (vminecraftSettings.getInstance().cmdWhoIs()) {
if (vMinecraftSettings.getInstance().cmdWhoIs()) {
//If a player is specified
if (args.length < 1)
player.sendMessage(Colors.Rose + "Usage is /whois [player]");
@ -350,7 +350,7 @@ public class vminecraftCommands{
//Displaying the information
player.sendMessage(Colors.Blue + "Whois results for " +
vminecraftChat.getName(playerTarget));
vMinecraftChat.getName(playerTarget));
//Group
for(String group: playerTarget.getGroups())
player.sendMessage(Colors.Blue + "Groups: " + group);
@ -383,7 +383,7 @@ public class vminecraftCommands{
public static int who(Player player, String[] args)
{
//If the command is enabled
if (vminecraftSettings.getInstance().cmdWho()) {
if (vMinecraftSettings.getInstance().cmdWho()) {
//Loop through all players counting them and adding to the list
int count=0;
String tempList = "";
@ -391,9 +391,9 @@ public class vminecraftCommands{
{
if(p != null){
if(count == 0)
tempList += vminecraftChat.getName(p);
tempList += vMinecraftChat.getName(p);
else
tempList += Colors.White + ", " + vminecraftChat.getName(p);
tempList += Colors.White + ", " + vMinecraftChat.getName(p);
count++;
}
}
@ -406,7 +406,7 @@ public class vminecraftCommands{
}
int maxPlayers = server.getInt("max-players");
//Output the player list
String[] tempOut = vminecraftChat.wordWrap(Colors.Rose + "Player List ("
String[] tempOut = vMinecraftChat.wordWrap(Colors.Rose + "Player List ("
+ count + "/" + maxPlayers +"): " + tempList);
for(String msg: tempOut)
player.sendMessage( msg );
@ -426,13 +426,13 @@ public class vminecraftCommands{
public static int say(Player player, String[] args)
{
//If the command is enabled
if (vminecraftSettings.getInstance().cmdSay()) {
if (vMinecraftSettings.getInstance().cmdSay()) {
//Make sure a message is supplied or output an error
if (args.length < 1) {
player.sendMessage(Colors.Rose + "Usage is /say [message]");
}
//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_FAIL;
@ -448,18 +448,18 @@ public class vminecraftCommands{
public static int slay(Player player, String[] args)
{
//Check if the command is enabled
if(vminecraftSettings.getInstance().cmdEzModo()) {
if(vMinecraftSettings.getInstance().cmdEzModo()) {
//Get the player by name
Player playerTarget = etc.getServer().matchPlayer(args[0]);
//If the player doesn't exist don't run
if(playerTarget == null)
return EXIT_FAIL;
//If the player isn't invulnerable kill them
if (!vminecraftSettings.getInstance().isEzModo(playerTarget.getName())) {
if (!vMinecraftSettings.getInstance().isEzModo(playerTarget.getName())) {
playerTarget.setHealth(0);
vminecraftChat.gmsg(vminecraftChat.getName(player)
vMinecraftChat.gmsg(vMinecraftChat.getName(player)
+ Colors.LightBlue + " has slain "
+ vminecraftChat.getName(playerTarget));
+ vMinecraftChat.getName(playerTarget));
//Otherwise output error to the user
} else {
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)
{
//If the command is enabled
if (vminecraftSettings.getInstance().cmdEzModo()) {
if (vMinecraftSettings.getInstance().cmdEzModo()) {
//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");
vminecraftSettings.getInstance().removeEzModo(player.getName());
vMinecraftSettings.getInstance().removeEzModo(player.getName());
//Otherwise make them invulnerable
} else {
player.sendMessage(Colors.LightBlue + "eh- maji? ezmodo!?");
player.sendMessage(Colors.Rose + "kimo-i");
player.sendMessage(Colors.LightBlue + "Easy Mode ga yurusareru no wa shougakusei made dayo ne");
player.sendMessage(Colors.Red + "**Laughter**");
vminecraftSettings.getInstance().addEzModo(player.getName());
player.setHealth(vminecraftSettings.getInstance().ezModoHealth());
vMinecraftSettings.getInstance().addEzModo(player.getName());
player.setHealth(vMinecraftSettings.getInstance().ezModoHealth());
}
return EXIT_SUCCESS;
}
@ -508,8 +508,8 @@ public class vminecraftCommands{
public static int ezlist(Player player, String[] args)
{
//If the feature is enabled list the players
if(vminecraftSettings.getInstance().cmdEzModo()) {
player.sendMessage("Ezmodo: " + vminecraftSettings.getInstance().ezModoList());
if(vMinecraftSettings.getInstance().cmdEzModo()) {
player.sendMessage("Ezmodo: " + vMinecraftSettings.getInstance().ezModoList());
return EXIT_SUCCESS;
}
return EXIT_FAIL;
@ -761,7 +761,7 @@ class commandList {
Method m;
try {
m = vminecraftCommands.class.getMethod(function, Player.class, String[].class);
m = vMinecraftCommands.class.getMethod(function, Player.class, String[].class);
m.setAccessible(true);
return (Integer) m.invoke(null, player, arg);
} catch (SecurityException e) {

View File

@ -1,21 +1,21 @@
import java.util.logging.Level;
import java.util.logging.Logger;
//=====================================================================
//Class: vminecraftListener
//Class: vMinecraftListener
//Use: The listener to catch incoming chat and commands
//Author: nossr50, TrapAlice, cerevisiae
//=====================================================================
public class vminecraftListener extends PluginListener {
public class vMinecraftListener extends PluginListener {
protected static final Logger log = Logger.getLogger("Minecraft");
//=====================================================================
//Function: disable
//Input: 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() {
log.log(Level.INFO, "vminecraft disabled");
log.log(Level.INFO, "vMinecraft disabled");
}
//=====================================================================
@ -30,20 +30,20 @@ public class vminecraftListener extends PluginListener {
//Quote (Greentext)
if (message.startsWith("@"))
return vminecraftChat.adminChat(player, message);
if (vminecraftSettings.getInstance().isAdminToggled(player.getName()))
return vminecraftChat.adminChatToggle(player, message);
return vMinecraftChat.adminChat(player, message);
if (vMinecraftSettings.getInstance().isAdminToggled(player.getName()))
return vMinecraftChat.adminChatToggle(player, message);
else if (message.startsWith(">"))
return vminecraftChat.quote(player, message);
return vMinecraftChat.quote(player, message);
//Rage (FFF)
else if (message.startsWith("FFF"))
return vminecraftChat.rage(player, message);
return vMinecraftChat.rage(player, message);
//Send through quakeColors otherwise
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);
//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)
return false;
else if(exitCode == 1)
@ -81,12 +81,12 @@ public class vminecraftListener extends PluginListener {
//Use: Checks for exploits and runs the commands
//=====================================================================
public boolean onHealthChange(Player player,int oldValue,int newValue){
if (player.getHealth() != vminecraftSettings.getInstance().ezModoHealth() && vminecraftSettings.getInstance().isEzModo(player.getName())) {
player.setHealth(vminecraftSettings.getInstance().ezModoHealth());
if (player.getHealth() != vMinecraftSettings.getInstance().ezModoHealth() && vMinecraftSettings.getInstance().isEzModo(player.getName())) {
player.setHealth(vMinecraftSettings.getInstance().ezModoHealth());
}
else if (vminecraftSettings.getInstance().globalmessages() && player.getHealth() < 1) {
vminecraftChat.gmsg(Colors.Gray + player.getName() + " " + vminecraftSettings.randomDeathMsg());
else if (vMinecraftSettings.getInstance().globalmessages() && player.getHealth() < 1) {
vMinecraftChat.gmsg(Colors.Gray + player.getName() + " " + vMinecraftSettings.randomDeathMsg());
}
return false;
}

View File

@ -7,10 +7,10 @@ import java.util.logging.Logger;
//Use: Controls the settings for vminecraft
//Author: nossr50, TrapAlice, cerevisiae
//=====================================================================
public class vminecraftSettings {
public class vMinecraftSettings {
//private final static Object syncLock = new Object();
protected static final Logger log = Logger.getLogger("Minecraft");
private static volatile vminecraftSettings instance;
private static volatile vMinecraftSettings instance;
//The feature settings
@ -138,10 +138,11 @@ public class vminecraftSettings {
stopTnt = properties.getBoolean("stopTNT",true);
rules = properties.getString("rules", "").split("@");
deathMessages = properties.getString("deathmessages", "").split(",");
String[] tempEz = properties.getString("ezModo").split(",");
ezModo = new ArrayList<String>();
for(int i = 0; i < tempEz.length; i++)
ezModo.add(tempEz[i]);
for(String ezName : tempEz)
ezModo.add(ezName);
ezHealth = properties.getInt("ezHealth");
@ -208,9 +209,9 @@ public class vminecraftSettings {
//Output: vminecraftSettings: The instance of the settings
//Use: Returns the instance of the settings
//=====================================================================
public static vminecraftSettings getInstance() {
public static vMinecraftSettings getInstance() {
if (instance == null) {
instance = new vminecraftSettings();
instance = new vMinecraftSettings();
}
return instance;
}