diff --git a/TODO b/TODO deleted file mode 100644 index c402ee16b..000000000 --- a/TODO +++ /dev/null @@ -1,28 +0,0 @@ -Bukkit TODO --Create Groups Plugin for the Groups system --Split vMinecraft hMod into smaller plugins for bukkit - -vAdmin for the new admin mod and admin features - -vGuilds for the guild and party system (noss) - -vGroups for the groups system (Cere) --Finish up the hMod planned features --Include updatr support with the new plugins --Port as many of vMinecrafts features as possible - -vChat TODO -High Priority - -Rewrite wordWrap() (cere?) - -Rainbow (Possibly xmas as well) crashing clients when entering the second line. My guess is it is a color code being inserted at the end. - -Medium Priority - -Ignore - -Default Chat Color - -Settings file - -Chat channels - -Nicknames - -Suffix - -Prefix - -Low Priority - -Fix bug where xmas/rainbow don't continue on the second line - -Fix bug where ^x & ^r are inserted to the end of the message when using xmas/rainbow - \ No newline at end of file diff --git a/hMod/TODO b/hMod/TODO deleted file mode 100644 index 58b7499a5..000000000 --- a/hMod/TODO +++ /dev/null @@ -1,71 +0,0 @@ -vMinecraft v1 Todo: - + Add permission toggle for using colors - + Guilds - + Party Leaders - + Ability to ban the use of certain colors as default chat/prefix color/suffix color - + More complex fire antigrief - + matchPlayer taking into account nicknames and prefixes and suffixes - + Add [] around player tags - + Modify setNick to not allow players to copy other's - + Fix ^^ in chat causing error message - nicknames and account names. Also disallow Notch as a nick :P - + Make death messages accurately report damage type - + Aliasing Commands (Global Aliases and Personal Aliases) - + Write a way to add and remove commands from players and groups - -vMinecraft v2 Updates! - +Add in a sort of rap sheet file for storing and retrieving - information on bans and kicks. - + More Complex Antigriefs Working on this... that is in the future! - + Different types of /slay - * /slay fire to burn them to death - * /slay drown to drown them - * /slay boil to burn them with lava - + Time manipulation - * Have time changes not be instant but move the sky faster - to get to the time entered - * Loop through specific times of the day and then rewind - ex: Sunrise to sunset, mid-morning to noon - + Track Chest Inventory - + Probations. - * When a player connects it will automatically kick them and inform them - how much longer they are probated for. - -DONE - + Brackets with group prefix colors in chat - + Party system - + Party Chat - + Fix death messages - + Added /freeze command to stop players from moving - + Quick recode of /me to use the new getName function - + Promote and Demote (ASAP) DIBS - + Simple Fire Antigrief - + /prefix - + /a to toggle admin chat - + Code was organized - + Aliasing was added - + Playerlist is now colorful and awesome - + Random death messages - + Suicide command - + Heal Command - + Colored Prefixes - + Color Codes only removed when actual colors are specified - * Allows use of ^ for emotes and whatever else they - might be needed for. - + Multi Line color fix - * Now we can have color on multiple lines without - crashing the client - * Also does not cut words in half - + vminecraft Help - * Specialized help message for vminecraft - ? /vhelp? - + Recode Messaging - * Reply Feature - * Personal Muting - + Allow players to nickname themselves or others - + Allow players to set suffixes - + ^r for rainbow color code - + Finish work on the flat file system - + Disabled /modify - -Notes: Let's try to to finish as much of this list as possible tomorrow and push for a b8 release soon :P diff --git a/hMod/vChat.java b/hMod/vChat.java deleted file mode 100644 index 4145c11be..000000000 --- a/hMod/vChat.java +++ /dev/null @@ -1,690 +0,0 @@ -import java.util.ArrayList; -import java.util.logging.Level; -import java.util.logging.Logger; - -//===================================================================== -//Class: vMinecraftChat -//Use: Encapsulates all chat commands added by this mod -//Author: nossr50, TrapAlice, cerevisiae -//===================================================================== -public class vChat { - protected static final Logger log = Logger.getLogger("Minecraft"); - protected static final int lineLength = 312; - //The array of colors to use - protected static final String[] rainbow = new String[] { - Colors.Red, - Colors.Rose, - Colors.Gold, - Colors.Yellow, - Colors.LightGreen, - Colors.Green, - Colors.LightBlue, - Colors.Blue, - Colors.Navy, - Colors.DarkPurple, - Colors.Purple, - Colors.LightPurple}; - protected static final String[] xmas = new String[] { - Colors.Red, - Colors.Red, - Colors.White, - Colors.White, - Colors.Green, - Colors.Green, - }; - - //===================================================================== - //Function: gmsg - //Input: Player sender: The player sending the message - // String msg: The message to be broadcast to all players - //Output: None - //Use: Outputs a message to everybody - //===================================================================== - public static void gmsg(Player sender, String msg){ - if(sender != null && sender.isMuted()) - sender.sendMessage(Colors.Red + "You have been muted."); - - for (Player receiver : etc.getServer().getPlayerList()) { - - if (receiver == null) return; - - if(vUsers.getProfile(receiver) == null) return; - - //Check if the person has the sender ignored - if(sender != null) - if(vUsers.getProfile(receiver).isIgnored(sender)) - return; - - String[] message = applyColors(wordWrap(msg)); - for(String out : message) - receiver.sendMessage(out); - } - } - - //===================================================================== - //Function: gmsg - //Input: String msg: The message to be broadcast to all players - //Output: None - //Use: Outputs a message to everybody - //===================================================================== - public static void gmsg(String msg){gmsg(null, msg);} - - //===================================================================== - //Function: sendMessage - //Input: Player sender: The player sending the message - // Player receiver: The player receiving the message - // String msg: The message to be broadcast to all players - //Output: None - //Use: Outputs a message to everybody - //===================================================================== - public static void sendMessage(Player sender, Player receiver, String msg){ - if(sender != null && sender.isMuted()) - sender.sendMessage(Colors.Red + "You have been muted."); - - //Check if the receiver has the sender ignored - if(vUsers.getProfile(receiver) == null) - return; - - if(sender != null) - if(vUsers.getProfile(receiver).isIgnored(sender)) - { - sendMessage(sender, sender, Colors.Rose + receiver.getName() - + " has you on their ignore list."); - return; - } - String[] message = applyColors(wordWrap(msg)); - for(String out : message) - receiver.sendMessage(out); - //Tell them if they are - } - - //===================================================================== - //Function: sendMessage - //Input: Player receiver: The player receiving the message - // String msg: The message to be broadcast to all players - //Output: None - //Use: Outputs a message to everybody - //===================================================================== - public static void sendMessage(Player receiver, String msg) - { - sendMessage(null, receiver, msg); - } - - //===================================================================== - //Function: wordWrap - //Input: String msg: The message to be wrapped - //Output: String[]: The array of substrings - //Use: Cuts the message apart into whole words short enough to fit - // on one line - //===================================================================== - public static String[] wordWrap(String msg){ - //Split each word apart - ArrayList split = new ArrayList(); - for(String in : msg.split(" ")) - split.add(in); - - //Create an arraylist for the output - ArrayList out = new ArrayList(); - //While i is less than the length of the array of words - while(!split.isEmpty()){ - int len = 0; - - //Create an arraylist to hold individual words - ArrayList words = new ArrayList(); - - //Loop through the words finding their length and increasing - //j, the end point for the sub string - while(!split.isEmpty() && split.get(0) != null && len <= lineLength) - { - int wordLength = msgLength(split.get(0)) + 4; - - //If a word is too long for a line - if(wordLength > lineLength) - { - String[] tempArray = wordCut(len, split.remove(0)); - words.add(tempArray[0]); - split.add(tempArray[1]); - } - - //If the word is not too long to fit - len += wordLength; - if( len < lineLength) - words.add(split.remove(0)); - } - //Merge them and add them to the output array. - out.add( etc.combineSplit(0, - words.toArray(new String[words.size()]), " ") + " " ); - } - //Convert to an array and return - return out.toArray(new String[out.size()]); - } - - //===================================================================== - //Function: msgLength - //Input: String str: The string to find the length of - //Output: int: The length on the screen of a string - //Use: Finds the length on the screen of a string. Ignores colors. - //===================================================================== - public static int msgLength(String str){ - int length = 0; - //Loop through all the characters, skipping any color characters - //and their following color codes - for(int x = 0; x 0) - length += len; - else - x++; - x++; - } - if(x > str.length()) - x = str.length(); - //Add the substring to the output after cutting it - output[0] = str.substring(0, x); - //Add the last of the string to the output. - output[1] = str.substring(x); - return output; - } - - //===================================================================== - //Function: charLength - //Input: char x: The character to find the length of. - //Output: int: The length of the character - //Use: Finds the visual length of the character on the screen. - //===================================================================== - private static int charLength(char x) - { - if("i.:,;|!".indexOf(x) != -1) - return 2; - else if("l'".indexOf(x) != -1) - return 3; - else if("tI[]".indexOf(x) != -1) - return 4; - else if("fk{}<>\"*()".indexOf(x) != -1) - return 5; - else if("abcdeghjmnopqrsuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ1234567890\\/#?$%-=_+&^".indexOf(x) != -1) - return 6; - else if("@~".indexOf(x) != -1) - return 7; - else if(x==' ') - return 4; - else - return -1; - } - - //===================================================================== - //Function: rainbow - //Input: String msg: The string to colorify - //Output: String: The rainbowed result - //Use: Rainbowifies a string; - //===================================================================== - public static String rainbow(String msg){ - String temp = ""; - int counter=0; - //Loop through the message applying the colors - for(int x=0; x " + message); - return true; - } - return false; - } - public static boolean partyChat(Player player, String message){ - if(vConfig.getInstance().partyChat()){ - //Cut off the ! prefix - if(message.startsWith("!")) - message = message.substring(1, message.length()); - if(vUsers.getProfile(player).inParty()){ - String partychat = Colors.Green + "(" + getName(player) + Colors.Green + ") "; - for (Player p: etc.getServer().getPlayerList()){ - if (p != null){ - if (vUsers.getProfile(p).inParty() && (vUsers.getProfile(p).getParty().equals(vUsers.getProfile(player).getParty()))){ - sendMessage(player, p, partychat + Colors.Green + message); - } - } - } - return true; - } - } - return false; - - } - - //===================================================================== - //Function: quote - //Input: Player player: The player talking - // String message: The message to apply the effect to - //Output: boolean: If this feature is enabled - //Use: Displays a message as a quote - //===================================================================== - public static boolean quote(Player player, String message) - { - //Format the name - String playerName = vmc.getInstance().getGroupPrefix(player) + "<" + getName(player) - + vmc.getInstance().getGroupPrefix(player) + "> "; - if(vConfig.getInstance().greentext()) { - //Log the chat - log.log(Level.INFO, "<"+player.getName()+"> " + message); - - //Output the message - gmsg(player, playerName + Colors.LightGreen + message); - return true; - } - return false; - } - - //===================================================================== - //Function: rage - //Input: Player player: The player talking - // String message: The message to apply the effect to - //Output: boolean: If this feature is enabled - //Use: Displays a message in red - //===================================================================== - public static boolean rage(Player player, String message) - { - //Format the name - String playerName = vmc.getInstance().getGroupPrefix(player) + "<" - + getName(player) + vmc.getInstance().getGroupPrefix(player) +"> "; - if (vConfig.getInstance().FFF()) { - log.log(Level.INFO, "<"+player.getName()+"> "+message); - - //Output the message - gmsg(player, playerName + Colors.Red + message); - return true; - } - return false; - } - - //===================================================================== - //Function: quakeColors - //Input: Player player: The player talking - // String message: The message to apply the effect to - //Output: boolean: If this feature is enabled - //Use: Displays a message in red - //===================================================================== - public static boolean quakeColors(Player player, String message) - { - //Format the name - String playerName = vmc.getInstance().getGroupPrefix(player) + "<" - + getName(player) + vmc.getInstance().getGroupPrefix(player) +"> "; - if(vConfig.getInstance().quakeColors()) { - - String color = vUsers.getProfile(player).getColor(); - //Log the chat - log.log(Level.INFO, "<"+player.getName()+"> " + message); - - //Output the message - gmsg(player, playerName + color + message); - - //Loop through the string finding the color codes and inserting them - return true; - } - 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) - { - gmsg(player, "* " + getName(player) + " " + Colors.White + message); - return true; - } - - - //===================================================================== - //Function: applyColors - //Input: String[] message: The lines to be colored - //Output: String[]: The lines, but colorful - //Use: Colors each line - //===================================================================== - public static String[] applyColors(String[] message) - { - if(message != null && message[0] != null && !message[0].isEmpty()){ - //The color to start the line with - String recentColor = Colors.White; - - //Go through each line - int counter = 0; - int i = 0; - boolean taste = false; - boolean xmasparty = false; - - for(String msg: message) - { - //Start the line with the most recent color - String temp = ""; - if(!recentColor.equals("^r") && recentColor != null) - temp += recentColor; - - //Loop through looking for a color code - for(int x = 0; x< msg.length(); x++) - { - //If the char is a ^ or � - if(taste || msg.charAt(x) == '^' - || msg.charAt(x) == Colors.Red.charAt(0)) - { - if(x != msg.length() - 1) - { - //If the following character is a color code - if(vChat.colorChange(msg.charAt(x+1)) != null) - { - //Set the most recent color to the new color - recentColor = vChat.colorChange(msg.charAt(x+1)); - - //If the color specified is rainbow - if(taste || recentColor.equals("^r")) - { - //Skip the quake code for rainbow - if(recentColor.equals("^r")) - { - x += 2; - } - - //Taste keeps it going with rainbow if there - //are more lines - taste = true; - //Loop through the message applying the colors - while(x < msg.length() && msg.charAt(x) != '^' - && msg.charAt(x) != Colors.Red.charAt(0)) - { - temp += rainbow[i] + msg.charAt(x); - - if(msg.charAt(x) != ' ') i++; - if(i == rainbow.length) i = 0; - x++; - } - - //If it reached another color instead of the end - if(x < msg.length() && msg.charAt(x) == '^' - || x < msg.length() - && msg.charAt(x) == Colors.Red.charAt(0) ) - { - taste = false; - i = 0; - x--; - } - } - if(xmasparty || recentColor.equals("^x")) - { - //Skip the quake code for xmas - if(recentColor.equals("^x")) - { - x += 2; - } - - //Taste keeps it going with xmas if there - //are more lines - xmasparty = true; - //Loop through the message applying the colors - while(x < msg.length() && msg.charAt(x) != '^' - && msg.charAt(x) != Colors.Red.charAt(0)) - { - temp += xmas[i] + msg.charAt(x); - - if(msg.charAt(x) != ' ') i++; - if(i == xmas.length) i = 0; - x++; - } - - //If it reached another color instead of the end - if(x < msg.length() && msg.charAt(x) == '^' - || x < msg.length() - && msg.charAt(x) == Colors.Red.charAt(0) ) - { - xmasparty = false; - i = 0; - x--; - } - } - else - - { - //Add the color - temp += recentColor; - //Skip these chars - x++; - } - - //Otherwise ignore it. - } else { - temp += msg.charAt(x); - } - //Insert the character - } else { - temp += msg.charAt(x); - } - } else { - temp += msg.charAt(x); - } - } - //Replace the message with the colorful message - message[counter] = temp; - counter++; - } - } - return message; - } -} \ No newline at end of file diff --git a/hMod/vCom.java b/hMod/vCom.java deleted file mode 100644 index 41967bbf2..000000000 --- a/hMod/vCom.java +++ /dev/null @@ -1,2375 +0,0 @@ -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.HashMap; -import java.util.List; - -//===================================================================== -//Class: vMinecraftCommands -//Use: Encapsulates all commands added by this mod -//Author: nos, trapalice, cerevisiae -//===================================================================== - -//===================================================================== -//Class: commandList -//Use: The list of commands that will be checked for -//Author: cerevisiae -//===================================================================== -public class vCom{ -private static HashMap hidden = new HashMap(); - - //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 - public static commandList cl = new commandList(); - - //===================================================================== - //Function: loadCommands - //Input: None - //Output: None - //Use: Imports all the commands into the command list - //===================================================================== - public static void loadCommands(){ - //If we had commands we would add them here. - - //register: Registers a function for use with a command - //String: The command that will be used - //String: The name of the function that will be called when - // the command is used - //String(Optional): The help menu description - - //Administrative - cl.register("/prefix", "prefix", "Set your name color and prefix"); - cl.register("/rprefix", "removeTag", "Remove your name color and prefix"); - cl.register("/nick", "nickName", "Set your display name"); - cl.register("/rnick", "removeNick", "Reset your display name to your account name"); - cl.register("/suffix", "suffix", "Set your suffix"); - cl.register("/rsuffix", "removeSuffix", "Remove your suffix"); - cl.register("/vminecraft", "vminecrafthelp"); - cl.register("/reload", "reload"); - cl.register("/whois", "whois", "/whois [user]"); - cl.register("/say", "say"); - cl.register("/a", "adminChatToggle", "Toggle admin chat for every message"); - cl.register("/rules", "rules", "Displays the rules"); - cl.register("/who", "who"); - cl.register("/promote", "promote", "Promote a player one rank"); - cl.register("/demote", "demote", "Demote a player one rank"); - cl.register("/hide", "hide", "Turn invisible"); - cl.register("/silent", "silent", "Turn off global messages for yourself"); - - //Party - cl.register("/party", "party"); - cl.register("/pquit", "partyquit"); - cl.register("/p", "partyChatToggle", "Toggles party chat on or off"); - - //Movement - cl.register("/freeze", "freeze"); - cl.register("/tp", "teleport"); - cl.register("/tphere", "tphere"); - cl.register("/tpback", "tpback"); - cl.register("/masstp", "masstp", "Teleports those with lower permissions to you"); - cl.register("/myspawn", "myspawn"); - - //Health - cl.register("/ezmodo", "invuln", "Toggle invulnerability"); - cl.register("/ezlist", "ezlist", "List invulnerable players"); - cl.register("/heal", "heal", "heal yourself or other players"); - cl.register("/suicide", "suicide", "Kill yourself... you loser"); - cl.register("/slay", "slay", "Kill target player"); - - //Social - cl.register("/colors", "colors", "Set your default chat color: /colors "); - cl.register("/me", "me"); - cl.register("/fabulous", "fabulous", "makes text SUUUPER"); - cl.register("/msg", "message", "Send a message to a player /msg [Player] [Message]"); - cl.register("/reply", "reply", "Reply to a player /reply [Message], Alias: /r"); - cl.register("/ignore", "addIgnored", "Adds a user to your ignore list"); - cl.register("/unignore", "removeIgnored", "Removes a user from your ignore list"); - cl.register("/ignorelist", "ignoreList", "Lists the players you have ignored"); - - //registerAlias: Runs the second command when the first command is called - //String: The command that this will be called by - //String: The message that will be called when the first is entered - // Can be modified with %# to have it insert a player - // argument into that position. - // EX: Aliased command is - // cl.registerAlias("/test", "/i %0 100") - // Player uses /test wood - // The %0 will be replaced with wood for this instance - // and Player will be given 100 wood. - cl.registerAlias("/playerlist", "/who"); - cl.registerAlias("/vhelp", "/vminecraft"); - cl.registerAlias("/r", "/reply"); - cl.registerAlias("/t", "/msg"); - cl.registerAlias("/tell", "/msg"); - cl.registerAlias("/wrists", "/suicide"); - cl.registerAlias("/kill", "/suicide"); - cl.registerAlias("/ci", "/clearinventory"); - - //registerMessage: Displays a message whenever a command is used - //String: The command it will run on - //String: What will be displayed - // %p is the player calling the command - // %# is the argument number of the command. - // %#p is an argument number that will be required to be - // an online player - //String: The color the message will be - //int: The number of arguments required for the message to appear - //boolean: If the message should only display for admins - cl.registerMessage("/kick", "%p has kicked %0p", Colors.DarkPurple, 1, false); - cl.registerMessage("/ban", "%p has banned %0p", Colors.DarkPurple, 1, false); - cl.registerMessage("/ipban", "%p has IP banned %0p", Colors.DarkPurple, 1, false); - cl.registerMessage("/time", "Time change thanks to %p", Colors.DarkPurple, 1, true); - cl.registerMessage("/hide", "%p has turned invisible", Colors.DarkPurple, 0, true); - cl.registerMessage("/slay", "%p has slain %0p", Colors.DarkPurple, 1, false); - cl.registerMessage("/heal", "%p has healed %0p", Colors.DarkPurple, 1, false); - } - //===================================================================== - //Function: vminecrafthelp (/vhelp or /vminecraft) - //Input: Player player: The player using the command - //Output: int: Exit Code - //Use: Displays the current status of most vMinecraft settings - // and provides some useful tips. - //===================================================================== - public static int vminecrafthelp(Player player, String[] args){ - vChat.sendMessage(player, player, Colors.Yellow - + "Chat Settings"); - vChat.sendMessage(player, player, Colors.DarkPurple - + "Admin Chat: " + vConfig.getInstance() - .adminchat()); - vChat.sendMessage(player, player, Colors.DarkPurple - + "FFF turns red: " + vConfig.getInstance() - .FFF()); - vChat.sendMessage(player, player, Colors.DarkPurple - + "Greentext After >: " + vConfig.getInstance() - .greentext()); - vChat.sendMessage(player, player, Colors.DarkPurple - + "Quake Color Script: " + vConfig.getInstance() - .quakeColors()); - vChat.sendMessage(player, player, Colors.Yellow - + "Enabled Commands are TRUE, disabled are FALSE"); - vChat.sendMessage(player, player, Colors.DarkPurple - + "Command /ezmodo: " + vConfig.getInstance() - .cmdEzModo()); - vChat.sendMessage(player, player, Colors.DarkPurple - + "Command /fabulous: " + vConfig.getInstance() - .cmdFabulous()); - vChat.sendMessage(player, player, Colors.DarkPurple - + "Command /rules: " + vConfig.getInstance() - .cmdRules()); - vChat.sendMessage(player, player, Colors.DarkPurple - + "Command /heal: " + vConfig.getInstance() - .cmdHeal()); - vChat.sendMessage(player, player, Colors.DarkPurple - + "Command /masstp: " + vConfig.getInstance() - .cmdMasstp()); - vChat.sendMessage(player, player, Colors.DarkPurple - + "Command /say: " + vConfig.getInstance() - .cmdSay()); - vChat.sendMessage(player, player, Colors.DarkPurple - + "Command /suicide: " + vConfig.getInstance() - .cmdSuicide()); - vChat.sendMessage(player, player, Colors.DarkPurple - + "Command /whois: " + vConfig.getInstance() - .cmdWhoIs()); - vChat.sendMessage(player, player, Colors.DarkPurple - + "Command /tp won't work on higher ranked players: " - + vConfig.getInstance().cmdTp()); - vChat.sendMessage(player, player, Colors.DarkPurple - + "Command /tphere won't work on higher ranked players: " - + vConfig.getInstance().cmdTphere()); - vChat.sendMessage(player, player, Colors.Yellow - + "Other Settings"); - vChat.sendMessage(player, player, Colors.DarkPurple - + "Command /who: " + vConfig.getInstance() - .cmdWho()); - vChat.sendMessage(player, player, Colors.DarkPurple - + "COLORED PLAYER LIST IS DEPENDENT ON /who BEING TRUE!"); - vChat.sendMessage(player, player, Colors.DarkPurple - + "Global Messages: " + vConfig.getInstance() - .globalmessages()); - return EXIT_SUCCESS; - } - public void onDisconnect(Player player){ - if(hidden.containsKey(player.getName())) - hidden.remove(player.getName()); - if(vConfig.getInstance().isEzModo(player.getName())) - vConfig.getInstance().removeEzModo(player.getName()); - } - - public void run() - { - for (Player InvisiblePlayer : hidden.values()) - { - for (Player p : etc.getServer().getPlayerList()) - { - if (vmc.getDistance(InvisiblePlayer, p) <= vConfig.range && p.getUser() != InvisiblePlayer.getUser()) - { - p.getUser().a.b(new dv(InvisiblePlayer.getUser().g)); - } - } - } - } - public static int silent(Player player, String[] args){ - if(player.canUseCommand("/silent")){ - if(!vUsers.getProfile(player).isSilent()){ - vUsers.getProfile(player).setSilent(); - player.sendMessage(Colors.DarkPurple + "You are now silent... shh"); - return EXIT_SUCCESS; - } - if(vUsers.getProfile(player).isSilent()){ - vUsers.getProfile(player).disableSilent(); - player.sendMessage(Colors.DarkPurple + "You are no longer silent"); - return EXIT_SUCCESS; - } - return EXIT_FAIL; - } - return EXIT_FAIL; - } - //Will make a player disappear or reappear - //Big thanks to the Vanish Plugins author: nodren - public static int hide(Player player, String[] args){ - if (player.canUseCommand("/hide")){ - if(hidden.get(player.getName()) != null) { - hidden.remove(player.getName()); - player.sendMessage(Colors.DarkPurple + "You are no longer invisible"); - hidden.remove(player.getName()); - updateInvisibleForAll(); - vmc.sendNotInvisible(player); - log.log(Level.INFO, player.getName() + " reappeared"); - player.sendMessage(Colors.Rose + "You have reappeared!"); - return EXIT_SUCCESS; - } - hidden.put(player.getName(), player); - player.sendMessage(Colors.DarkPurple + "You are now invisible"); - vmc.sendInvisible(player); - log.log(Level.INFO, player.getName() + " went invisible"); - return EXIT_SUCCESS; - } - return EXIT_FAIL; - } - public static void updateInvisibleForAll() - { - List playerList = etc.getServer().getPlayerList(); - for (Player InvisiblePlayer : hidden.values()) - { - for (Player p : playerList) - { - if(p != null){ - if (vmc.getDistance(InvisiblePlayer, p) <= vConfig.range && p.getUser() != InvisiblePlayer.getUser()) - { - p.getUser().a.b(new dv(InvisiblePlayer.getUser().g)); - } - } - } - } - } - public static int party(Player player, String[] args){ - if(!vUsers.getProfile(player).inParty() && args.length == 0){ - player.sendMessage(Colors.Red + "Correct usage is /party [partyname]"); - return EXIT_SUCCESS; - } - if((vUsers.getProfile(player).inParty()) && (args.length > 0)){ - player.sendMessage(Colors.Red + "You are already in a party, use /pquit to leave it"); - return EXIT_SUCCESS; - } - if(vUsers.getProfile(player).inParty()){ - player.sendMessage(Colors.Green + "Party Members: " + vmc.getInstance().getPartyMembers(player)); - return EXIT_SUCCESS; - } - if(args[0] != null) { - vUsers.getProfile(player).setParty(args[0]); - player.sendMessage(Colors.DarkPurple + "Party set to " + args[0]); - vmc.informPartyMembers(player); - return EXIT_SUCCESS; - } else { - player.sendMessage(Colors.Red + "Correct usage is /party [partyname]"); - return EXIT_SUCCESS; - } - } - public static int partyquit(Player player, String[] args){ - if(vUsers.getProfile(player).inParty()){ - vmc.informPartyMembersQuit(player); - vUsers.getProfile(player).removeParty(); - player.sendMessage(Colors.LightGreen + "Party successfully removed"); - return EXIT_SUCCESS; - } else { - player.sendMessage(Colors.Red + "You are not in a party"); - return EXIT_SUCCESS; - } - } - public static int tpback(Player player, String[] args){ - if(player.canUseCommand("/tpback")){ - String tpxyz = vUsers.getProfile(player).getTpxyz(); - String tpxyz2[] = tpxyz.split(","); - double x = Double.parseDouble(tpxyz2[0]); - double y = Double.parseDouble(tpxyz2[1]); - double z = Double.parseDouble(tpxyz2[2]); - player.teleportTo(x, y, z, 0, 0); - String cx = Double.toString(etc.getServer().getSpawnLocation().x); - String cy = Double.toString(etc.getServer().getSpawnLocation().y); - String cz = Double.toString(etc.getServer().getSpawnLocation().z); - String cxyz = cx + "," + cy + "," + cz; - vUsers.getProfile(player).setTpback(cxyz); - player.sendMessage(Colors.Rose + "/tpback data reset to spawn"); - return EXIT_SUCCESS; - } - return EXIT_SUCCESS; - } - //===================================================================== - //Function: myspawn (/myspawn) - //Input: Player player: The player using the command - //Output: int: Exit Code - //Use: Returns a player to their home but with penalties - //===================================================================== - public static int myspawn(Player player, String[] args){ - if(player.canUseCommand("/myspawn") && vConfig.getInstance().playerspawn()) - { - player.sendMessage(Colors.DarkPurple + "Returned to myspawn"); - player.sendMessage(Colors.Red + "Penalty: Inventory Cleared"); - player.setHealth(20); - Warp home = null; - home = etc.getDataSource().getHome(player.getName()); - player.teleportTo(home.Location); - Inventory inv = player.getInventory(); - inv.clearContents(); - inv.update(); - return EXIT_SUCCESS; - } - return EXIT_FAIL; - } - public static int freeze(Player player, String[] args){ - if(player.canUseCommand("/freeze") && vConfig.getInstance().freeze()){ - if (args.length < 1){ - player.sendMessage(Colors.Rose + "Usage is /freeze [Player]"); - return EXIT_SUCCESS; - } - Player other = etc.getServer().matchPlayer(args[0]); - if (other == null) - { - player.sendMessage(Colors.Rose + "The player you specified could not be found"); - return EXIT_SUCCESS; - } - if(player != other && other.hasControlOver(player)){ - player.sendMessage(Colors.Rose + "The player you specified has a higher rank than you"); - return EXIT_SUCCESS; - } - if(vConfig.getInstance().isFrozen(other.getName())){ - vConfig.getInstance().removeFrozen(other.getName()); - if(!vUsers.getProfile(player).isSilent()) - vChat.gmsg(player.getName() + Colors.Blue + " has unfrozen " + other.getName()); - return EXIT_SUCCESS; - } else { - vConfig.getInstance().addFrozen(other.getName()); - if(!vUsers.getProfile(player).isSilent()) - vChat.gmsg(player.getName() + Colors.Blue + " has frozen " + other.getName()); - return EXIT_SUCCESS; - } - } - return EXIT_SUCCESS; - } - //===================================================================== - //Function: prefix (/prefix) - //Input: Player player: The player using the command - // String[] args: The color and the prefix - //Output: int: Exit Code - //Use: Changes your name color and prefix - //===================================================================== - public static int prefix(Player player, String[] args){ - - //if the player can prefix others - if(player.canUseCommand("/prefixother") && vConfig.getInstance().prefix()){ - - //Check if there are enough arguments - if(args.length < 2){ - vChat.sendMessage(player, player, Colors.Rose + "Usage is /prefix [Player] [Color Code] "); - player.sendMessage(Colors.DarkPurple + "Example: /prefix " + player.getName() + " e ^0[^a<3^0]"); - vChat.sendMessage(player, player, Colors.DarkPurple + "This would produce a name like... " + Colors.Black + "[" + Colors.LightGreen + "<3" + Colors.Black + "]" + Colors.Yellow + player.getName()); - return EXIT_SUCCESS; - } - - //Check if the player exists - Player other = etc.getServer().matchPlayer(args[0]); - if(other == null) - { - vChat.sendMessage(player, player, Colors.Rose - + "The player you specified could not be found"); - return EXIT_SUCCESS; - } - - //Check if they are a higher rank than the other person - if(player != other && other.hasControlOver(player)) - { - vChat.sendMessage(player, player, Colors.Rose - + "The player you specified is a higher rank than you."); - return EXIT_SUCCESS; - } - - //Check if the prefix is too long - if(vChat.msgLength(args[1]) > 60) - { - vChat.sendMessage(player, player, Colors.Rose - + "The prefix you entered was too long."); - return EXIT_SUCCESS; - } - if(args.length >= 2 && args[0] != null) - { - other.setPrefix(args[1]); - player.sendMessage(Colors.Rose + "Name color changed"); - FlatFileSource ffs = new FlatFileSource(); - ffs.modifyPlayer(other); - } - - if(args.length >= 3 && args[1] != null) - { - vUsers.players.findProfile(other).setTag(args[2]); - player.sendMessage(Colors.LightGreen + "Prefix changed"); - log.log(Level.INFO, player + " changed their prefix to " + args[2]); - } - return EXIT_SUCCESS; - } - //If the player can set their prefix - if(!player.canUseCommand("/prefix")&& vConfig.getInstance().prefix()){ - return EXIT_FAIL; - } - - //Check if there are enough arguments - if(args.length < 1){ - vChat.sendMessage(player, player, Colors.Rose + "Usage is /prefix [Color Code] "); - player.sendMessage(Colors.DarkPurple + "Example: /prefix e ^0[^a<3^0]"); - vChat.sendMessage(player, player, Colors.DarkPurple + "This would produce a name like... " + Colors.Black + "[" + Colors.LightGreen + "<3" + Colors.Black + "]" + Colors.Yellow + player.getName()); - return EXIT_SUCCESS; - } - //Name color - if(args.length >= 1 && args[0] != null){ - player.setPrefix(args[0]); - player.sendMessage(Colors.Rose + "Name color changed"); - } - //Prefix - if(args.length >= 2 && args[1] != null){ - //Check if the prefix is too long - if(vChat.msgLength(args[1]) > 60) - { - vChat.sendMessage(player, player, Colors.Rose - + "The prefix you entered was too long."); - return EXIT_SUCCESS; - } - vUsers.players.findProfile(player).setTag(args[1]); - player.sendMessage(Colors.LightGreen + "Prefix changed"); - } - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: removeTag (/rprefix) - //Input: Player player: The player using the command - // String[] args: Ignored - //Output: int: Exit Code - //Use: Removes your prefix - //===================================================================== - public static int removeTag(Player player, String[] args){ - - //if the player can suffix others - if(player.canUseCommand("/prefixother")&& vConfig.getInstance().prefix()){ - if(args.length < 1){ - vChat.sendMessage(player, player, Colors.Rose - + "Usage is /rprefix [Player]"); - return EXIT_SUCCESS; - } - - //Check if the player exists - Player other = etc.getServer().matchPlayer(args[0]); - if(other == null) - { - vChat.sendMessage(player, player, Colors.Rose - + "The player you specified could not be found"); - return EXIT_SUCCESS; - } - - //Check if they are a higher rank than the other person - if(player != other && other.hasControlOver(player)) - { - vChat.sendMessage(player, player, Colors.Rose - + "The player you specified is a higher rank than you."); - return EXIT_SUCCESS; - } - - vUsers.getProfile(other).setTag(""); - player.sendMessage(Colors.LightGreen + "Prefix Removed"); - - return EXIT_SUCCESS; - } - - //Check if the player can set their own prefix. - if(!player.canUseCommand("/prefix")&& vConfig.getInstance().prefix()){ - return EXIT_FAIL; - } - if(args.length < 1){ - vChat.sendMessage(player, player, Colors.Rose - + "Usage is /rprefix"); - return EXIT_SUCCESS; - } - vUsers.getProfile(player).setTag(""); - player.sendMessage(Colors.LightGreen + "Prefix Removed"); - - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: nickName (/nick) - //Input: Player player: The player using the command - // String[] args: The color and the prefix - //Output: int: Exit Code - //Use: Changes your name - //===================================================================== - public static int nickName(Player player, String[] args){ - - //if the player can nickname others - if(player.canUseCommand("/nickother") && vConfig.getInstance().nick()){ - if(args.length < 2){ - vChat.sendMessage(player, player, Colors.Rose - + "Usage is /nick [Player] [Name]"); - return EXIT_SUCCESS; - } - - //Check if the nickname is too long - if(vChat.msgLength(args[1]) > 85) - { - vChat.sendMessage(player, player, Colors.Rose - + "The nick you entered was too long."); - return EXIT_SUCCESS; - } - - //Check if the player exists - Player other = etc.getServer().matchPlayer(args[0]); - if(other == null) - { - vChat.sendMessage(player, player, Colors.Rose - + "The player you specified could not be found"); - return EXIT_SUCCESS; - } - - //Check if they are a higher rank than the other person - if(player != other && other.hasControlOver(player)) - { - vChat.sendMessage(player, player, Colors.Rose - + "The player you specified is a higher rank than you."); - return EXIT_SUCCESS; - } - - vUsers.getProfile(other).setNick(args[1]); - player.sendMessage(Colors.LightGreen + "Nickname Set"); - - return EXIT_SUCCESS; - } - - //Make sure they can nickname themselves - if(!player.canUseCommand("/nick")){ - return EXIT_FAIL; - } - - //Check if the nickname is too long - if(vChat.msgLength(args[1]) > 85) - { - vChat.sendMessage(player, player, Colors.Rose - + "The nick you entered was too long."); - return EXIT_SUCCESS; - } - - if(args.length < 1){ - vChat.sendMessage(player, player, Colors.Rose - + "Usage is /nick [Name]"); - return EXIT_SUCCESS; - } - vUsers.getProfile(player).setNick(args[0]); - player.sendMessage(Colors.LightGreen + "Nickname Set"); - - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: removeNick (/rnick) - //Input: Player player: The player using the command - // String[] args: Ignored - //Output: int: Exit Code - //Use: Removes your nick - //===================================================================== - public static int removeNick(Player player, String[] args){ - - //if the player can nick others - if(player.canUseCommand("/nickother")&& vConfig.getInstance().nick()){ - if(args.length < 1){ - vChat.sendMessage(player, player, Colors.Rose - + "Usage is /rnick [Player]"); - return EXIT_SUCCESS; - } - - //Check if the player exists - Player other = etc.getServer().matchPlayer(args[0]); - if(other == null) - { - vChat.sendMessage(player, player, Colors.Rose - + "The player you specified could not be found"); - return EXIT_SUCCESS; - } - - //Check if they are a higher rank than the other person - if(player != other && other.hasControlOver(player)) - { - vChat.sendMessage(player, player, Colors.Rose - + "The player you specified is a higher rank than you."); - return EXIT_SUCCESS; - } - - vUsers.getProfile(other).setNick(""); - player.sendMessage(Colors.LightGreen + "Nickname Removed"); - - return EXIT_SUCCESS; - } - - //Check if the player can set their own nick. - if(!player.canUseCommand("/nick")&& vConfig.getInstance().nick()){ - return EXIT_FAIL; - } - if(args.length < 1){ - vChat.sendMessage(player, player, Colors.Rose - + "Usage is /rnick"); - return EXIT_SUCCESS; - } - vUsers.getProfile(player).setNick(""); - player.sendMessage(Colors.LightGreen + "Nickname Removed"); - - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: suffix (/suffix) - //Input: Player player: The player using the command - // String[] args: The color and the suffix - //Output: int: Exit Code - //Use: Changes your suffix - //===================================================================== - public static int suffix(Player player, String[] args){ - - //if the player can suffix others - if(player.canUseCommand("/suffixother")&& vConfig.getInstance().suffix()){ - if(args.length < 2){ - vChat.sendMessage(player, player, Colors.Rose - + "Usage is /suffix [Player] [Name]"); - return EXIT_SUCCESS; - } - - //Check if the suffix is too long - if(vChat.msgLength(args[1]) > 60) - { - vChat.sendMessage(player, player, Colors.Rose - + "The suffix you entered was too long."); - return EXIT_SUCCESS; - } - - //Check if the player exists - Player other = etc.getServer().matchPlayer(args[0]); - if(other == null) - { - vChat.sendMessage(player, player, Colors.Rose - + "The player you specified could not be found"); - return EXIT_SUCCESS; - } - - //Check if they are a higher rank than the other person - if(player != other && other.hasControlOver(player)) - { - vChat.sendMessage(player, player, Colors.Rose - + "The player you specified is a higher rank than you."); - return EXIT_SUCCESS; - } - vUsers.getProfile(other).setSuffix(args[1]); - player.sendMessage(Colors.LightGreen + "Suffix Set"); - - return EXIT_SUCCESS; - } - - //Check if the player can set their own suffix. - if(!player.canUseCommand("/suffix")&& vConfig.getInstance().suffix()){ - return EXIT_FAIL; - } - if(args.length < 1){ - vChat.sendMessage(player, player, Colors.Rose - + "Usage is /suffix [Suffix]"); - return EXIT_SUCCESS; - } - - //Check if the suffix is too long - if(vChat.msgLength(args[1]) > 60) - { - vChat.sendMessage(player, player, Colors.Rose - + "The suffix you entered was too long."); - return EXIT_SUCCESS; - } - vUsers.getProfile(player).setSuffix(args[0]); - player.sendMessage(Colors.LightGreen + "Suffix Set"); - - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: removeSuffix (/rsuffix) - //Input: Player player: The player using the command - // String[] args: Ignored - //Output: int: Exit Code - //Use: Removes your suffix - //===================================================================== - public static int removeSuffix(Player player, String[] args){ - - //if the player can suffix others - if(player.canUseCommand("/suffixother")&& vConfig.getInstance().suffix()){ - if(args.length < 1){ - vChat.sendMessage(player, player, Colors.Rose - + "Usage is /rsuffix [Player]"); - return EXIT_SUCCESS; - } - - //Check if the player exists - Player other = etc.getServer().matchPlayer(args[0]); - if(other == null) - { - vChat.sendMessage(player, player, Colors.Rose - + "The player you specified could not be found"); - return EXIT_SUCCESS; - } - - //Check if they are a higher rank than the other person - if(player != other && other.hasControlOver(player)) - { - vChat.sendMessage(player, player, Colors.Rose - + "The player you specified is a higher rank than you."); - return EXIT_SUCCESS; - } - vUsers.getProfile(other).setSuffix(""); - player.sendMessage(Colors.LightGreen + "Suffix Removed"); - - return EXIT_SUCCESS; - } - - //Check if the player can set their own suffix. - if(!player.canUseCommand("/suffix")&& vConfig.getInstance().suffix()){ - return EXIT_FAIL; - } - if(args.length < 1){ - vChat.sendMessage(player, player, Colors.Rose - + "Usage is /rsuffix"); - return EXIT_SUCCESS; - } - vUsers.getProfile(player).setSuffix(""); - player.sendMessage(Colors.LightGreen + "Suffix Removed"); - - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: colors (/colors) - //Input: Player player: The player using the command - //Output: int: Exit Code - //Use: Displays a list of all colors and color codes - //===================================================================== - public static int colors(Player player, String[] args){ - if(args.length > 0&& vConfig.getInstance().colors()) - { - vUsers.getProfile(player).setColor(args[0]); - vChat.sendMessage(player, player, "^" + args[0].charAt(0) - + "Default chat color set."); - } else { - player.sendMessage(Colors.Rose + "You use these color codes like in quake or MW2."); - player.sendMessage(Colors.Rose + "^4 would make text " + Colors.Red - + "red" + Colors.Rose + ", ^a would make it " + Colors.LightGreen - + "light green" + Colors.Rose + "."); - vChat.sendMessage(player, player, - Colors.Black + "0" - + Colors.Navy + "1" - + Colors.Green + "2" - + Colors.Blue + "3" - + Colors.Red + "4" - + Colors.Purple + "5" - + Colors.Gold + "6" - + Colors.LightGray + "7" - + Colors.Gray + "8" - + Colors.DarkPurple + "9" - + Colors.LightGreen + "A" - + Colors.LightBlue + "B" - + Colors.Rose + "C" - + Colors.LightPurple + "D" - + Colors.Yellow + "E" - + Colors.White + "F" - + "^r" + "[R]ainbow"); - } - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: me (/me) - //Input: Player player: The player using the command - // String[] args: Will contain the message the player sends - //Output: int: Exit Code - //Use: The player uses this to emote, but now its colorful. - //===================================================================== - public static int me(Player player, String[] args) - { - String str = etc.combineSplit(0, args, " "); - if (args.length < 1) return EXIT_FAIL; - vChat.emote(player, str); - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: message (/msg, /w, /whisper) - //Input: Player player: The player using the command - // String[] args: Will contain the target player name and - // message the player sends - //Output: int: Exit Code - //Use: Send a message to a player - //===================================================================== - public static int message(Player player, String[] args) - { - - //Make sure a player is specified - if (args.length < 2) { - vChat.sendMessage(player, player, Colors.Rose - + "Usage is /msg [player] [message]"); - return EXIT_SUCCESS; - } - - //Make sure the player exists - Player toPlayer = etc.getServer().matchPlayer(args[0]); - if (toPlayer == null || args.length < 1) { - vChat.sendMessage(player, player, Colors.Rose - + "No player by the name of " + args[0] + " could be found."); - return EXIT_SUCCESS; - } - - String msg = etc.combineSplit(1, args, " "); - //Send the message to the targeted player and the sender - vChat.sendMessage(player, toPlayer, - Colors.LightGreen + "[From:" + vChat.getName(player) - + Colors.LightGreen + "] " + msg); - vChat.sendMessage(player, player, - Colors.LightGreen + "[To:" + vChat.getName(toPlayer) - + Colors.LightGreen + "] " + msg); - //Set the last massager for each player - vUsers.getProfile(player).setMessage(toPlayer); - vUsers.getProfile(toPlayer).setMessage(player); - - //Display the message to the log - log.log(Level.INFO, player.getName() + " whispered to " + toPlayer.getName() - + ": " + msg); - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: reply (/r, /reply) - //Input: Player player: The player using the command - // String[] args: Will contain the message the player sends - //Output: int: Exit Code - //Use: Send a message to a player - //===================================================================== - public static int reply(Player player, String[] args) - { - //If the profile exists for the player - if(vUsers.getProfile(player) == null ) { - vChat.sendMessage(player, player, - Colors.Rose + "The person you last message has logged off"); - return EXIT_SUCCESS; - } - - //Make sure a message is specified - if (args.length < 1) { - vChat.sendMessage(player, player, - Colors.Rose + "Usage is /reply [Message]"); - return EXIT_SUCCESS; - } - - //Make sure the player they're talking to is online - Player toPlayer = vUsers.getProfile(player).getMessage(); - if (toPlayer == null) { - vChat.sendMessage(player, player, - Colors.Rose + "The person you last message has logged off"); - return EXIT_SUCCESS; - } - - String msg = etc.combineSplit(0, args, " "); - - //Send the message to the targeted player and the sender - vChat.sendMessage(player, toPlayer, - Colors.LightGreen + "[From:" + vChat.getName(player) - + Colors.LightGreen + "] " + msg); - vChat.sendMessage(player, player, - Colors.LightGreen + "[To:" + vChat.getName(toPlayer) - + Colors.LightGreen + "] " + msg); - - //Set the last messager for each player - vUsers.getProfile(player).setMessage(toPlayer); - vUsers.getProfile(toPlayer).setMessage(player); - - //Display the message to the log - log.log(Level.INFO, player.getName() + " whispered to " + toPlayer.getName() - + ": " + msg); - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: addIgnored (/ignore) - //Input: Player player: The player using the command - // String[] args: The name of the player to ignore - //Output: int: Exit Code - //Use: Adds a player to the ignore list - //===================================================================== - public static int addIgnored(Player player, String[] args) - { - //Make sure the player gave you a user to ignore - if(args.length < 1 && vConfig.getInstance().ignore()) - { - vChat.sendMessage(player, player, - Colors.Rose + "Usage: /ignore [Player]"); - return EXIT_SUCCESS; - } - - //Find the player and make sure they exist - Player ignore = etc.getServer().matchPlayer(args[0]); - if(ignore == null&& vConfig.getInstance().ignore()) - { - vChat.sendMessage(player, player, Colors.Rose - + "The person you tried to ignore is not logged in."); - return EXIT_SUCCESS; - } - - if(!player.hasControlOver(ignore)&& vConfig.getInstance().ignore()) - { - vChat.sendMessage(player, player, Colors.Rose - + "You can't ignore someone a higher rank than you."); - return EXIT_SUCCESS; - } - - //Don't let the player ignore themselves - if(ignore.getName().equalsIgnoreCase(player.getName())) - { - vChat.sendMessage(player, player, - Colors.Rose + "You cannot ignore yourself"); - return EXIT_SUCCESS; - } - - //Attempt to ignore the player and report accordingly - if(vUsers.getProfile(player).addIgnore(ignore)) - vChat.sendMessage(player, player, Colors.Rose - + ignore.getName() + " has been successfuly ignored."); - else - vChat.sendMessage(player, player, Colors.Rose - + "You are already ignoring " + ignore.getName()); - - - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: removeIgnored (/unignore) - //Input: Player player: The player using the command - // String[] args: The name of the player to stop ignoring - //Output: int: Exit Code - //Use: Removes a player from the ignore list - //===================================================================== - public static int removeIgnored(Player player, String[] args) - { - //Make sure the player gave you a user to ignore - if(args.length < 1&& vConfig.getInstance().ignore()) - { - vChat.sendMessage(player, player, - Colors.Rose + "Usage: /unignore [Player]"); - return EXIT_SUCCESS; - } - - //Find the player and make sure they exist - Player ignore = etc.getServer().matchPlayer(args[0]); - if(ignore == null&& vConfig.getInstance().ignore()) - { - vChat.sendMessage(player, player, - Colors.Rose + "The person you tried to unignore is not logged in."); - return EXIT_SUCCESS; - } - - //Attempt to ignore the player and report accordingly - if(vUsers.getProfile(player).removeIgnore(ignore)) - vChat.sendMessage(player, player, - Colors.Rose + ignore.getName()+ " has been successfuly " + - "unignored."); - else - vChat.sendMessage(player, player, - Colors.Rose + "You are not currently ignoring " + ignore.getName()); - - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: ignoreList (/ignorelist) - //Input: Player player: The player using the command - // String[] args: Ignored - //Output: int: Exit Code - //Use: Lists the player you have ignored - //===================================================================== - public static int ignoreList(Player player, String[] args) - { - if (vConfig.getInstance().ignore()){ - //Get the ignore list - String[] list = vUsers.getProfile(player).listIgnore(); - - //Find the last page number - int lastPage = (int)list.length / 5; - if((int)list.length % 5 > 0) - lastPage++; - - //Find the page number the player wants displayed - int page = 0; - if(args.length > 0 && Integer.valueOf(args[0]) > 0 - && Integer.valueOf(args[0]) <= lastPage) - page = Integer.valueOf(args[0]) - 1; - - //Display the header - vChat.sendMessage(player, player, - Colors.Rose + "Ignore List [" + page + "/" - + lastPage + "]"); - - //Display up to 5 people - for(int i = 0; i < 5 && i + (page * 5) < list.length; i++) - vChat.sendMessage(player, player, - Colors.Rose + list[i+ (page * 5)]); - - return EXIT_SUCCESS; - } - return EXIT_FAIL; - } - //Party chat toggle - public static int partyChatToggle(Player player, String[] args) - { - //Check if party chat is even enabled befor executing anymore code - if(!vConfig.getInstance().partyChat()) return EXIT_FAIL; - //Check if the player is admin toggled, and if so remove them from that array - if(vConfig.getInstance().isAdminToggled(player.getName())){ - vConfig.getInstance().removeAdminToggled(player.getName()); - } - - //If the player is already toggled for party chat, remove them - if (vConfig.getInstance().isPartyToggled(player.getName())) { - player.sendMessage(Colors.Red + "Party Chat Toggle = off"); - vConfig.getInstance().removePartyToggled(player.getName()); - //Otherwise include them - } else { - player.sendMessage(Colors.Blue + "Party Chat Toggled on"); - vConfig.getInstance().addPartyToggled(player.getName()); - } - return EXIT_SUCCESS; - } - //===================================================================== - //Function: adminChatToggle (/a) - //Input: Player player: The player using the command - // String[] args: Ignored - //Output: int: Exit Code - //Use: Toggles the player into admin chat. Every message they - // send will be piped to admin chat. - //===================================================================== - public static int adminChatToggle(Player player, String[] args) - { - //Check if the player is party toggled, and if so remove them from that array - if(vConfig.getInstance().isPartyToggled(player.getName())){ - vConfig.getInstance().removePartyToggled(player.getName()); - } - //Make sure the user has access to the command - if(!player.canUseCommand("/a")) return EXIT_FAIL; - - if(!vConfig.getInstance().adminChatToggle()) return EXIT_FAIL; - - //If the player is already toggled for admin chat, remove them - if (vConfig.getInstance().isAdminToggled(player.getName())) { - player.sendMessage(Colors.Red + "Admin Chat Toggle = off"); - vConfig.getInstance().removeAdminToggled(player.getName()); - //Otherwise include them - } else { - player.sendMessage(Colors.Blue + "Admin Chat Toggled on"); - vConfig.getInstance().addAdminToggled(player.getName()); - } - return EXIT_SUCCESS; - } - //===================================================================== - //Function: heal (/heal) - //Input: Player player: The player using the command - // String[] args: The arguments for the command. Should be a - // player name or blank - //Output: int: Exit Code - //Use: Heals yourself or a specified player. - //===================================================================== - public static int heal(Player player, String[] args) - { - //Make sure the user has access to the command - if(!player.canUseCommand("/heal")) return EXIT_FAIL; - - if(!vConfig.getInstance().cmdHeal()) return EXIT_FAIL; - - //If a target wasn't specified, heal the user. - if (args.length < 1){ - player.setHealth(20); - player.sendMessage("Your health is restored"); - return EXIT_SUCCESS; - } - - //If a target was specified, try to find them and then heal them - //Otherwise report the error - Player playerTarget = etc.getServer().matchPlayer(args[0]); - if (playerTarget == null){ - player.sendMessage(Colors.Rose - + "Couldn't find that player"); - return EXIT_SUCCESS; - } - playerTarget.setHealth(20); - player.sendMessage(Colors.Blue + "You have healed " - + vChat.getName(playerTarget)); - playerTarget.sendMessage(Colors.Blue - + "You have been healed by " - + vChat.getName(player)); - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: suicide (/suicide, /wrists) - //Input: Player player: The player using the command - // String[] args: Ignored - //Output: int: Exit Code - //Use: Kills yourself - //===================================================================== - public static int suicide(Player player, String[] args) - { - //Make sure the user has access to the command - if(!player.canUseCommand("/suicide")) return EXIT_FAIL; - - if(!vConfig.getInstance().cmdSuicide()) return EXIT_FAIL; - - //Set your health to 0. Not much to it. - player.setHealth(0); - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: teleport (/tp) - //Input: Player player: The player using the command - // String[] args: The arguments for the command. Should be a - // player name - //Output: int: Exit Code - //Use: Teleports the user to another player - //===================================================================== - public static int teleport(Player player, String[] args) - { - //Make sure the user has access to the command - if(!player.canUseCommand("/tp")) return EXIT_FAIL; - //Get if the command is enabled - if(!vConfig.getInstance().cmdTp())return EXIT_FAIL; - - //Make sure a player has been specified and return an error if not - if (args.length < 1) { - player.sendMessage(Colors.Rose + "Correct usage is: /tp [player]"); - return EXIT_SUCCESS; - } - - //Find the player by name - Player playerTarget = etc.getServer().matchPlayer(args[0]); - - //Target player isn't found - if(playerTarget == null) - player.sendMessage(Colors.Rose + "Can't find user " - + args[0] + "."); - //If it's you, return witty message - else if (player.getName().equalsIgnoreCase(args[0])) - player.sendMessage(Colors.Rose + "You're already here!"); - - //If the player is higher rank than you, inform the user - else if (!player.hasControlOver(playerTarget)) - player.sendMessage(Colors.Red + - "That player has higher permissions than you."); - - //If the player exists transport the user to the player - else { - //Storing their previous location for tpback - double x = player.getLocation().x; - double y = player.getLocation().y; - double z = player.getLocation().z; - String x2 = Double.toString(x); - String y2 = Double.toString(y); - String z2 = Double.toString(z); - String xyz = x2+","+y2+","+z2; - vUsers.getProfile(player).setTpback(xyz); - if(player.canUseCommand("/tpback")){ - player.sendMessage(Colors.DarkPurple + "Your previous location has been stored"); - player.sendMessage(Colors.DarkPurple + "Use /tpback to return"); - } - if(!vUsers.getProfile(player).isSilent()){ - vChat.gmsg( player, vChat.getName(player) - + Colors.LightBlue + " has teleported to " - + vChat.getName(playerTarget)); - } - log.log(Level.INFO, player.getName() + " teleported to " + - playerTarget.getName()); - - player.teleportTo(playerTarget); - - } - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: masstp (/masstp) - //Input: Player player: The player using the command - // String[] args: Should be empty or is ignored - //Output: int: Exit Code - //Use: Teleports all players to the user - //===================================================================== - public static int masstp(Player player, String[] args) - { - //Make sure the user has access to the command - if(!player.canUseCommand("/masstp")) return EXIT_FAIL; - - //If the command is enabled - if(!vConfig.getInstance().cmdMasstp())return EXIT_FAIL; - - //Go through all players and move them to the user - for (Player p : etc.getServer().getPlayerList()) { - if (!p.hasControlOver(player)) { - p.teleportTo(player); - double x = player.getLocation().x; - double y = player.getLocation().y; - double z = player.getLocation().z; - String x2 = Double.toString(x); - String y2 = Double.toString(y); - String z2 = Double.toString(z); - String xyz = x2+","+y2+","+z2; - vUsers.getProfile(p).setTpback(xyz); - if(p.canUseCommand("/tpback")) - { - p.sendMessage(Colors.DarkPurple + "Your previous location has been stored"); - p.sendMessage(Colors.DarkPurple + "Use /tpback to return"); - } - } - } - //Inform the user that the command has executed successfully - player.sendMessage(Colors.Blue + "Summoning successful."); - - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: tphere (/tphere) - //Input: Player player: The player using the command - // String[] args: The arguments for the command. Should be a - // player name - //Output: int: Exit Code - //Use: Teleports the user to another player - //===================================================================== - public static int tphere(Player player, String[] args) - { - //Make sure the user has access to the command - if(!player.canUseCommand("/tphere")) return EXIT_FAIL; - - //Check if the command is enabled. - if (!vConfig.getInstance().cmdTphere())return EXIT_FAIL; - - //Make sure a player is specified - if (args.length < 1) { - player.sendMessage(Colors.Rose + "Correct usage" + - " is: /tphere [player]"); - return EXIT_SUCCESS; - } - - //Get the player by name - Player playerTarget = etc.getServer().matchPlayer(args[0]); - - //If the target doesn't exist - if(playerTarget == null) - player.sendMessage(Colors.Rose + "Can't find user " - + args[0] + "."); - //If the player has a higher rank than the user, return error - else if (!player.hasControlOver(playerTarget)) - player.sendMessage(Colors.Red + "That player has higher" + - " permissions than you."); - //If the user teleports themselves, mock them - else if (player.getName().equalsIgnoreCase(args[0])) - player.sendMessage(Colors.Rose + "Wow look at that! You" + - " teleported yourself to yourself!"); - //If the target exists, teleport them to the user - else { - log.log(Level.INFO, player.getName() + " teleported " - + playerTarget.getName() + " to their self."); - playerTarget.teleportTo(player); - double x = player.getLocation().x; - double y = player.getLocation().y; - double z = player.getLocation().z; - String x2 = Double.toString(x); - String y2 = Double.toString(y); - String z2 = Double.toString(z); - String xyz = x2+","+y2+","+z2; - vUsers.getProfile(playerTarget).setTpback(xyz); - if(playerTarget.canUseCommand("/tpback")) - { - playerTarget.sendMessage(Colors.DarkPurple + "Your previous location has been stored"); - playerTarget.sendMessage(Colors.DarkPurple + "Use /tpback to return"); - } - } - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: reload (/reload) - //Input: Player player: The player using the command - // String[] args: Ignored - //Output: int: Exit Code - //Use: Reloads the settings for vMinecraft - //===================================================================== - public static int reload(Player player, String[] args) - { - //Make sure the user has access to the command - if(!player.canUseCommand("/reload")) return EXIT_FAIL; - vConfig.getInstance().loadSettings(); - return EXIT_FAIL; - } - - //===================================================================== - //Function: rules (/rules) - //Input: Player player: The player using the command - // String[] args: Ignored - //Output: int: Exit Code - //Use: Lists the rules - //===================================================================== - public static int rules(Player player, String[] args) - { - //If the rules exist - if(!vConfig.getInstance().cmdRules() - && vConfig.getInstance().getRules().length > 0 - && !vConfig.getInstance().getRules()[0].isEmpty()) { - return EXIT_FAIL; - } - - //Apply QuakeCode Colors to the rules - String[] rules = vChat.applyColors( - vConfig.getInstance().getRules()); - //Display them - for (String str : rules ) { - if(!str.isEmpty()) - player.sendMessage(Colors.Blue + str); - else - player.sendMessage(Colors.Blue - + "!!!The Rules Have Not Been Set!!!"); - } - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: fabulous (/fabulous) - //Input: Player player: The player using the command - // String[] args: The message to apply the effect to - //Output: int: Exit Code - //Use: Makes the text rainbow colored - //===================================================================== - public static int fabulous(Player player, String[] args) - { - //If the command is enabled - if(!vConfig.getInstance().cmdFabulous()) return EXIT_FAIL; - - //Make sure a message has been specified - if (args.length < 1) { - player.sendMessage(Colors.Rose + "Usage /fabulous [Message]"); - return EXIT_SUCCESS; - } - - //Format the name - String playerName = Colors.White + "<" - + vChat.getName(player) + Colors.White +"> "; - - //Merge the message again - String str = etc.combineSplit(0, args, " "); - - //Output for server - log.log(Level.INFO, player.getName()+" fabulously said \""+ str+"\""); - - //Prepend the player name and cut into lines. - vChat.gmsg(player, playerName + vChat.rainbow(str)); - - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: whois (/whois) - //Input: Player player: The player using the command - // String[] args: The player to find info on - //Output: int: Exit Code - //Use: Displays information about the player specified - //===================================================================== - public static int whois(Player player, String[] args) - { - //Make sure the user has access to the command - if(!player.canUseCommand("/whois")) return EXIT_FAIL; - - //If the command is enabled - if (!vConfig.getInstance().cmdWhoIs()) return EXIT_FAIL; - - //If a player is specified - if (args.length < 1) - { - player.sendMessage(Colors.Rose + "Usage is /whois [player]"); - return EXIT_SUCCESS; - } - - //Get the player by name - Player playerTarget = etc.getServer().matchPlayer(args[0]); - - //If the player exists - if (playerTarget == null){ - player.sendMessage(Colors.Rose+"Player not found."); - return EXIT_SUCCESS; - } - - //Displaying the information - player.sendMessage(Colors.Blue + "Whois results for " + - vChat.getName(playerTarget)); - //Group - for(String group: playerTarget.getGroups()) - player.sendMessage(Colors.Blue + "Groups: " + group); - - //Only let admins see this info - if(player.isAdmin()) - { - //Admin - player.sendMessage(Colors.Blue+"Admin: " + - String.valueOf(playerTarget.isAdmin())); - //IP - player.sendMessage(Colors.Blue+"IP: " + playerTarget.getIP()); - //Restrictions - player.sendMessage(Colors.Blue+"Can ignore restrictions: " + - String.valueOf(playerTarget.canIgnoreRestrictions())); - } - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: who (/who) - //Input: Player player: The player using the command - // String[] args: Ignored - //Output: int: Exit Code - //Use: Displays the connected players - //===================================================================== - public static int who(Player player, String[] args) - { - //If the command is enabled - if (!vConfig.getInstance().cmdWho()) return EXIT_FAIL; - - //Loop through all players counting them and adding to the list - int count=0; - String tempList = ""; - for( Player p : etc.getServer().getPlayerList()) - { - if(p != null){ - if(count == 0) - tempList += vChat.getName(p); - else - tempList += Colors.White + ", " + vChat.getName(p); - count++; - } - } - //Get the max players from the config - PropertiesFile server = new PropertiesFile("server.properties"); - try { - server.load(); - } catch (IOException e) { - e.printStackTrace(); - } - int maxPlayers = server.getInt("max-players"); - - //Output the player list - vChat.sendMessage(player, player, Colors.Rose + "Player List (" - + count + "/" + maxPlayers +"): " + tempList); - - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: say (/say) - //Input: Player player: The player using the command - // String[] args: The message to apply the effect to - //Output: int: Exit Code - //Use: Announces the message to all players - //===================================================================== - public static int say(Player player, String[] args) - { - //Make sure the user has access to the command - if(!player.canUseCommand("/say")) return EXIT_FAIL; - - //Check if the command is enabled - if (!vConfig.getInstance().cmdSay()) return EXIT_FAIL; - - //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 - vChat.gmsg(player, Colors.Yellow - + etc.combineSplit(0, args, " ")); - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: slay (/slay) - //Input: Player player: The player using the command - // String[] args: The target for the command - //Output: int: Exit Code - //Use: Kill the target player - //===================================================================== - public static int slay(Player player, String[] args) - { - //Make sure the user has access to the command - if(!player.canUseCommand("/slay")) return EXIT_FAIL; - - //Check if the command is enabled - if(!vConfig.getInstance().cmdEzModo()) return EXIT_FAIL; - - //Get the player by name - Player playerTarget = etc.getServer().matchPlayer(args[0]); - - //If the player doesn't exist don't run - if(playerTarget == null) - { - player.sendMessage(Colors.Rose + "Usage is /slay [Player]"); - return EXIT_SUCCESS; - } - - //If the player isn't invulnerable kill them - if (vConfig.getInstance() - .isEzModo(playerTarget.getName())) { - player.sendMessage(Colors.Rose + "That player is currently in" + - " ezmodo! Hahahaha"); - } - - playerTarget.setHealth(0); - //Otherwise output error to the user - - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: invuln (/ezmodo) - //Input: Player player: The player using the command - // String[] args: The target for the command - //Output: int: Exit Code - //Use: Kill the target player - //===================================================================== - public static int invuln(Player player, String[] args) - { - //Make sure the user has access to the command - if(!player.canUseCommand("/ezmodo")) return EXIT_FAIL; - - //If the command is enabled - if (!vConfig.getInstance().cmdEzModo()) return EXIT_FAIL; - - //If the player is already invulnerable, turn ezmodo off. - if (vConfig.getInstance().isEzModo(player.getName())) { - player.sendMessage(Colors.Red + "ezmodo = off"); - vConfig.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**"); - vConfig.getInstance().addEzModo(player.getName()); - } - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: ezlist (/ezlist) - //Input: Player player: The player using the command - // String[] args: Ignored - //Output: int: Exit Code - //Use: List all invulnerable players - //===================================================================== - public static int ezlist(Player player, String[] args) - { - //Make sure the user has access to the command - if(!player.canUseCommand("/ezmodo")) return EXIT_FAIL; - //If the feature is enabled list the players - if(!vConfig.getInstance().cmdEzModo()) return EXIT_FAIL; - - player.sendMessage("Ezmodo: " + vConfig.getInstance().ezModoList()); - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: modify (/modify) - //Input: Player player: The player using the command - // String[] args: Player, Command, Arguments - //Output: int: Exit Code - //Use: Display help for modifying features of players - //===================================================================== - /* - public static int modify(Player player, String[] args) - { - if(player.canUseCommand("/prefixother")) - vChat.sendMessage(player, player, "/prefix [Player]" + - " [Color] (Tag) - Set a players prefix and tag."); - else if(player.canUseCommand("/prefix")) - vChat.sendMessage(player, player, "/prefix [Color]" + - " (Tag) - Set your prefix and tag."); - - if(player.canUseCommand("/nickother")) - vChat.sendMessage(player, player, "/nick [Player]" + - " [Nickname] - Set a players nickname."); - else if(player.canUseCommand("/nick")) - vChat.sendMessage(player, player, "/nick [Nick]" + - " - Set your nickname."); - - if(player.canUseCommand("/suffixother")) - vChat.sendMessage(player, player, "/suffix [Player]" + - " [Suffix] - Set a players suffix."); - else if(player.canUseCommand("/suffix")) - vChat.sendMessage(player, player, "/suffix [Suffix]" + - " - Set your suffix."); - - if(player.canUseCommand("/suffixother")) - vChat.sendMessage(player, player, "/suffix [Player]" + - " [Suffix] - Set a players suffix."); - else if(player.canUseCommand("/suffix")) - vChat.sendMessage(player, player, "/suffix [Suffix]" + - " - Set your suffix."); - - if(player.canUseCommand("/vranks")) - { - vChat.sendMessage(player, player, "/promote [Player]" + - " - Promotes a player one rank"); - vChat.sendMessage(player, player, "/demote [Player]" + - " - Demotes a player one rank"); - } - return EXIT_SUCCESS; - } - - * - */ - //===================================================================== - //Function: promote (/promote) - //Input: Player player: The player using the command - // String[] args: Player to promote - //Output: int: Exit Code - //Use: Attempt to promote a player one rank - //===================================================================== - public static int promote(Player player, String[] args) - { - //Check if they can promote - if(!player.canUseCommand("/promote")) return EXIT_FAIL; - - //Check if they specified a player - if(args.length < 1) - { - vChat.sendMessage(player, Colors.Rose + "Usage: /promote [Player] (Rank)"); - return EXIT_SUCCESS; - } - - //Try to find the player - Player target = etc.getServer().matchPlayer(args[0]); - if(target == null) - { - vChat.sendMessage(player, Colors.Rose + "The player specified could not be found"); - return EXIT_SUCCESS; - } - - //Get the list of ranks - String[] ranks = vConfig.getInstance().getRanks(); - - //Find the targets current rank number - String[] tarGroups = target.getGroups(); - int tarRank = 0, - tarPos = 0; - boolean leave = false; - for(String rank : ranks) - { - for(String group : tarGroups) - { - if(rank.equalsIgnoreCase(group)) - { - leave = true; - break; - } - else - tarPos++; - } - if(leave) - break; - tarRank++; - tarPos = 0; - } - if(!leave) - { - tarRank = 0; - tarPos = 0; - if(tarGroups != null) - { - String[] tempGroups = new String[tarGroups.length + 1]; - System.arraycopy(tarGroups, 0, tempGroups, 1, tarGroups.length); - tarGroups = tempGroups; - } else - tarGroups = new String[1]; - } - - leave = false; - //Get the player's rank - String[] myGroups = player.getGroups(); - int myRank = 0; - - for(String rank : ranks) - { - for(String group : myGroups) - if(rank.equalsIgnoreCase(group)) - { - - leave = true; - break; - } - if(leave) - break; - myRank++; - } - if(!leave) - myRank = 0; - - //Make sure they're not promoting to their rank or higher but only if they can't use /spromote - if(!player.canUseCommand("/spromote") && - myRank <= tarRank + 1){ - vChat.sendMessage(player, Colors.Rose + "You cannot promote someone to" + - " your rank or higher."); - return EXIT_SUCCESS; - } - //If a rank is specified - if (args.length == 2) - { - //Assign designated rank to a variable - String[] newgroup = new String[1]; - newgroup[0] = args[1]; - //Reset some variables for reuse - leave = false; - tarRank = 0; - //Find what rank newgroup is if any - for(String rank : ranks) - { - for(String group : newgroup) - if(rank.equalsIgnoreCase(group)) - { - - leave = true; - break; - } - if(leave) - break; - tarRank++; - } - if(!leave) - tarRank = 0; - - //Make sure you're not promoting someone to above your rank (only if you can't use /spromote) - if(!player.canUseCommand("/spromote") && - myRank <= tarRank + 1){ - vChat.sendMessage(player, Colors.Rose + "You cannot promote someone to" + - " your rank or higher."); - return EXIT_SUCCESS; - } - target.setGroups(newgroup); - } - if(args.length < 2) - { - tarGroups[tarPos] = ranks[tarRank + 1]; - target.setGroups(tarGroups); - } - //Make sure the player is in the files - FlatFileSource ffs = new FlatFileSource(); - if(!ffs.doesPlayerExist(target.getName())) - { - vChat.sendMessage(player, Colors.Rose + "Adding player."); - ffs.addPlayer(target); - } - else - { - ffs.modifyPlayer(target); - } - //Check what kind of promotion happened before sending off any message - if(args.length == 1){ - vChat.sendMessage(player, Colors.Rose + target.getName() - + " has been promoted to " + ranks[tarRank + 1] + "."); - vChat.sendMessage(target, Colors.Rose + "You have been promoted to " - + ranks[tarRank + 1] + "."); - if(!vUsers.getProfile(player).isSilent()) - vChat.gmsg(Colors.DarkPurple + player.getName() + " has promoted " + target.getName() + " to " + ranks[tarRank + 1]); - } - if(args.length == 2){ - if(!vUsers.getProfile(player).isSilent()) - vChat.gmsg(Colors.DarkPurple + player.getName() + " has promoted " + target.getName() + " to " + args[1]); - } - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: demote (/demote) - //Input: Player player: The player using the command - // String[] args: Player to promote - //Output: int: Exit Code - //Use: Attempt to promote a player one rank - //===================================================================== - public static int demote(Player player, String[] args) - { - //Check if they can demote - if(!player.canUseCommand("/demote")) return EXIT_FAIL; - - //Check if they specified a player - if(args.length < 1) - { - vChat.sendMessage(player, Colors.Rose + "Usage: /demote [Player] (Rank)"); - return EXIT_SUCCESS; - } - - //Try to find the player - Player target = etc.getServer().matchPlayer(args[0]); - if(target == null) - { - vChat.sendMessage(player, Colors.Rose + "The player specified could not be found"); - return EXIT_SUCCESS; - } - - //Get the list of ranks - String[] ranks = vConfig.getInstance().getRanks(); - - //Find the targets current rank number - String[] tarGroups = target.getGroups(); - int tarRank = 0, - tarPos = 0; - boolean leave = false; - for(String rank : ranks) - { - for(String group : tarGroups) - { - if(rank.equalsIgnoreCase(group)) - { - leave = true; - break; - } - else - tarPos++; - } - if(leave) - break; - tarRank++; - tarPos = 0; - } - if(!leave) - { - tarRank = 0; - tarPos = 0; - if(tarGroups != null) - { - String[] tempGroups = new String[tarGroups.length + 1]; - System.arraycopy(tarGroups, 0, tempGroups, 1, tarGroups.length); - tarGroups = tempGroups; - } else - tarGroups = new String[1]; - } - - leave = false; - //Get the player's rank - String[] myGroups = player.getGroups(); - int myRank = 0; - - for(String rank : ranks) - { - for(String group : myGroups) - if(rank.equalsIgnoreCase(group)) - { - leave = true; - break; - } - if(leave) - break; - myRank++; - } - if(!leave) - { - myRank = 0; - } - - //Make sure they're not demoting to their rank or higher - if(myRank <= tarRank) - { - vChat.sendMessage(player, Colors.Rose + "You cannot demote someone who is" + - " your rank or higher."); - return EXIT_SUCCESS; - } - - if(tarRank - 1 < 0) - { - vChat.sendMessage(player, Colors.Rose + target.getName() + " is already the" + - " lowest rank."); - return EXIT_SUCCESS; - - } - - tarGroups[tarPos] = ranks[tarRank - 1]; - target.setGroups(tarGroups); - - //Make sure the player is in the files - FlatFileSource ffs = new FlatFileSource(); - if(!ffs.doesPlayerExist(target.getName())) - { - vChat.sendMessage(player, Colors.Rose + "Adding player."); - ffs.addPlayer(target); - } - else - { - ffs.modifyPlayer(target); - } - - vChat.sendMessage(player, Colors.Rose + target.getName() - + " has been demoted to " + ranks[tarRank - 1] + "."); - vChat.sendMessage(target, Colors.Rose + "You have been demoted to " - + ranks[tarRank - 1] + "."); - if(!vUsers.getProfile(player).isSilent()) - vChat.gmsg(Colors.DarkPurple + player.getName() + " has demoted " + target.getName() + " to " + ranks[tarRank - 1]); - - return EXIT_SUCCESS; - } -} -class commandList { - ArrayList commands; - protected static final Logger log = Logger.getLogger("Minecraft"); - static final int EXIT_FAIL = 0, - EXIT_SUCCESS = 1, - EXIT_CONTINUE = 2; - - //===================================================================== - //Function: commandList - //Input: None - //Output: None - //Use: Initialize the array of commands - //===================================================================== - public commandList(){ - commands = new ArrayList(); - } - - //===================================================================== - //Function: register - //Input: String name: The name of the command - // String func: The function to be called - //Output: boolean: Whether the command was input successfully or not - //Use: Registers a command to the command list for checking later - //===================================================================== - public boolean register(String name, String func) - { - //Check to make sure the command doesn't already exist - for(command temp : commands) - if(temp.getName().equalsIgnoreCase(name)) - return false; - - //Add the new function to the list - commands.add(new command(name, func)); - - //exit successfully - return true; - } - - //===================================================================== - //Function: register - //Input: String name: The name of the command - // String func: The function to be called - // String info: The information for the command to put in help - //Output: boolean: Whether the command was input successfully or not - //Use: Registers a command to the command list for checking later - //===================================================================== - public boolean register(String name, String func, String info){ - //Add to the /help list - etc.getInstance().addCommand(name, info); - - //Finish registering - return register(name, func); - } - - //===================================================================== - //Function: register - //Input: String name: The name of the command - // String func: The function to be called - //Output: boolean: Whether the command was input successfully or not - //Use: Registers a command to the command list for checking later - //===================================================================== - public boolean registerAlias(String name, String com) - { - //Check to make sure the command doesn't already exist - for(command temp : commands) - if(temp.getName().equalsIgnoreCase(name)) - return false; - - //Add the new function to the list - commands.add(new commandRef(name, com)); - - //exit successfully - return true; - } - - //===================================================================== - //Function: registerMessage - //Input: String name: The name of the command - // String msg: The message to be displayed - // boolean admin: If the message is displayed to admins only - //Output: boolean: Whether the command was input successfully or not - //Use: Registers a command to the command list for checking later - //===================================================================== - public boolean registerMessage(String name, String msg, String clr, int args, boolean admin) - { - //Check to make sure the command doesn't already exist - for(command temp : commands) - if(temp.getName().equalsIgnoreCase(name)) - return false; - - //Add the new function to the list - commands.add(new commandAnnounce(name, msg, clr, args, admin)); - - //exit successfully - return true; - } - - //===================================================================== - //Function: call - //Input: String name: The name of the command to be run - // Player player: The player calling the command - // String[] arg: The arguments being input for the command - //Output: boolean: If the command was called successfully - //Use: Attempts to call a command - //===================================================================== - public int call(String name, Player player, String[] arg){ - //Search for the command - for(command cmd : commands) - { - //When found - if(cmd.getName().equalsIgnoreCase(name)) - { - try { - //Call the command and return results - return cmd.call(player, arg); - } catch (SecurityException e) { - log.log(Level.SEVERE, "Exception while running command", e); - } catch (IllegalArgumentException e) { - log.log(Level.SEVERE, "The Command Entered Doesn't Exist", e); - return EXIT_FAIL; - } - } - } - - //Something went wrong - return EXIT_FAIL; - } - - //===================================================================== - //Function: toString - //Input: None - //Output: String: A string representation of the aliases in the list - //Use: Displays all the aliases in thel ist - //===================================================================== - public String toString() - { - String temp = ""; - int i = 0; - for(command comm : commands) - { - temp += comm.toString(); - if(i < commands.size() - 1) - temp +=","; - } - return temp; - } - - - - //===================================================================== - //Class: command - //Use: The specific command - //Author: cerevisiae - //===================================================================== - private class command - { - private String commandName; - private String function; - - //===================================================================== - //Function: command - //Input: None - //Output: None - //Use: Initialize the command - //===================================================================== - public command(String name, String func){ - commandName = name; - function = func; - } - - - //===================================================================== - //Function: getName - //Input: None - //Output: String: The command name - //Use: Returns the command name - //===================================================================== - public String getName(){return commandName;} - - - //===================================================================== - //Function: call - //Input: String[] arg: The arguments for the command - //Output: boolean: If the command was called successfully - //Use: Attempts to call the command - //===================================================================== - int call(Player player, String[] arg) - { - - Method m; - try { - m = vCom.class.getMethod(function, Player.class, String[].class); - m.setAccessible(true); - return (Integer) m.invoke(null, player, arg); - } catch (SecurityException e) { - e.printStackTrace(); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - } catch (IllegalArgumentException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - e.printStackTrace(); - } - return 1; - } - - //===================================================================== - //Function: toString - //Input: None - //Output: String: null - //Use: Returns null - //===================================================================== - public String toString() { return null; } - } - - //===================================================================== - //Class: commandRef - //Use: A command referencing another command - //Author: cerevisiae - //===================================================================== - private class commandRef extends command - { - private String reference; - private String[] args; - - //===================================================================== - //Function: command - //Input: String name: The command name - // String com: The command to run - //Output: None - //Use: Initialize the command - //===================================================================== - public commandRef(String name, String com){ - super(name, ""); - - //Get the reference name - String[]temp = com.split(" "); - reference = temp[0]; - - //Get the arguments - args = new String[temp.length - 1]; - System.arraycopy(temp, 1, args, 0, temp.length - 1); - } - - - //===================================================================== - //Function: call - //Input: String[] arg: The arguments for the command - //Output: boolean: If the command was called successfully - //Use: Attempts to call the command - //===================================================================== - int call(Player player, String[] arg) - { - String[] temp = new String[0]; - int lastSet = 0, - argCount = 0; - - //If there are args set with the function - if(args != null && args.length > 0) { - temp = new String[args.length]; - System.arraycopy(args, 0, temp, 0, args.length); - //Insert the arguments into the pre-set arguments - for(String argument : temp) - { - if(argument.startsWith("%") && argument.length() > 1) - { - int argNum = Integer.parseInt(argument.substring(1)); - if( argNum < arg.length ) - { - temp[lastSet] = arg[argNum]; - argCount++; - } - } - lastSet++; - } - } - - //If there are args being input - if(arg.length > 0) { - //Append the rest of the arguments to the argument array - if(lastSet < temp.length + arg.length - argCount) - { - String[] temp2 = new String[temp.length + arg.length - argCount]; - System.arraycopy(temp, 0, temp2, 0, temp.length); - System.arraycopy(arg, argCount, temp2, - temp.length, arg.length - argCount); - temp = temp2; - } - - log.log(Level.INFO, reference + " " + etc.combineSplit(0, temp, " ")); - //Call the referenced command - player.command(reference + " " + etc.combineSplit(0, temp, " ")); - } else - player.command(reference); - return EXIT_SUCCESS; - } - - //===================================================================== - //Function: toString - //Input: None - //Output: String: A string representation of this command. - // command@referencedcommand arg1 arg2 argn - //Use: Returns the string representation of the alias - //===================================================================== - public String toString() - { - String temp = getName(); - temp += '@'; - temp += reference; - temp += etc.combineSplit(0, args, " "); - return temp; - } - } - - //===================================================================== - //Class: commandAnnounce - //Use: Announces when a command is used - //Author: cerevisiae - //===================================================================== - private class commandAnnounce extends command - { - private String message; - private boolean admin; - private int minArgs; - private String color; - - //===================================================================== - //Function: commandAnnounce - //Input: String name: The command name - // String msg: The message to announce - //Output: None - //Use: Initialize the command - //===================================================================== - public commandAnnounce(String name, String msg, String clr, int args, boolean admn){ - super(name, ""); - message = msg; - admin = admn; - minArgs = args; - color = clr; - } - - - //===================================================================== - //Function: call - //Input: String[] arg: The arguments for the command - //Output: boolean: If the command was called successfully - //Use: Attempts to call the command - //===================================================================== - int call(Player player, String[] arg) - { - //Make sure the player can use the command first - if(!player.canUseCommand(super.commandName)) return EXIT_FAIL; - - //Make sure the command is long enough to fire - if(minArgs < arg.length) - return EXIT_FAIL; - - if(vConfig.getInstance().globalmessages()) - { - //Split up the message - String[] temp = message.split(" "); - - //Insert the arguments into the message - int i = 0; - for(String argument : temp) - { - if(argument.startsWith("%") && argument.length() > 1) - { - char position = argument.charAt(1); - //Replace %p with the player name - if(position == 'p') - temp[i] = vChat.getName(player) + color; - else if( Character.isDigit(position) && Character.getNumericValue(position) < arg.length ) - { - //If the argument is specified to be a player insert it if the - //player is found or exit if they aren't - if(argument.length() > 2 && argument.charAt(2) == 'p') - { - Player targetName = etc.getServer().matchPlayer(arg[Character.getNumericValue(position)]); - if(targetName != null) - temp[i] = vChat.getName(targetName) + color; - else - return EXIT_FAIL; - } - //Replace %# with the argument at position # - else - temp[i] = arg[Character.getNumericValue(position)]; - } - } - i++; - } - message = etc.combineSplit(0, temp, " "); - - //If it's an admin message only - if(admin) - { - for (Player p: etc.getServer().getPlayerList()) { - //If p is not null - if (p != null) { - //And if p is an admin or has access to adminchat send message - if (p.isAdmin() && !vUsers.getProfile(player).isSilent()) { - vChat.sendMessage(player, p, color + message); - } - } - } - } else if(!vUsers.getProfile(player).isSilent()) - vChat.gmsg(player, message); - } - return EXIT_FAIL; - } - - //===================================================================== - //Function: toString - //Input: None - //Output: String: null - //Use: Returns null - //===================================================================== - public String toString() { return null; } - } -} \ No newline at end of file diff --git a/hMod/vConfig.java b/hMod/vConfig.java deleted file mode 100644 index cc6503218..000000000 --- a/hMod/vConfig.java +++ /dev/null @@ -1,315 +0,0 @@ -import java.io.*; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.logging.Level; -import java.util.logging.Logger; -//===================================================================== -//Class: vminecraftSettings -//Use: Controls the settings for vminecraft -//Author: nossr50, TrapAlice, cerevisiae -//===================================================================== -public class vConfig { - //private final static Object syncLock = new Object(); - protected static final Logger log = Logger.getLogger("Minecraft"); - private static volatile vConfig instance; - static int range; - - - //The feature settings - static boolean toggle = true, - adminChat = false, - groupcoloredbrackets = false, - partyChat = false, - greentext = false, - FFF = false, - quakeColors = false, - prefix = false, - suffix = false, - ignore = false, - colors = false, - nick = false, - playerspawn = false, - freeze = false, - lavaspread = false, - colorsrequirepermission = false, - cmdFabulous = false, - cmdPromote = false, - cmdDemote = false, - cmdWhoIs = false, - cmdRules = false, - cmdMasstp = false, - cmdTp = false, - cmdTphere = false, - globalmessages = false, - cmdSay = false, - cmdWho = false, - stopFire = false, - cmdHeal = false, - cmdSuicide = false, - cmdAdminToggle = false, - cmdEzModo = false; - //An array of players currently in ezmodo - static ArrayList ezModo = new ArrayList(); - //An array of players currently frozen - static ArrayList frozenplayers = new ArrayList(); - //An array of players currently toggled for admin chat - static ArrayList adminChatList = new ArrayList(); - //An array of player currently toggled for party chat - static ArrayList partyChatList = new ArrayList(); - //An array of blocks that won't catch on fire - static public ArrayList fireblockan; - - - private PropertiesFile properties; - String file = "vminecraft.properties"; - public String rules[] = new String[0]; - public static String deathMessages[] = new String[0]; - public static String ranks[] = new String[0]; - - - //===================================================================== - //Function: loadSettings - //Input: None - //Output: None - //Use: Loads the settings from the properties - //===================================================================== - public void loadSettings() - { - File theDir = new File("vminecraft.properties"); - if(!theDir.exists()){ - String location = "vminecraft.properties"; - properties = new PropertiesFile("vminecraft.properties"); - FileWriter writer = null; - try { - writer = new FileWriter(location); - writer.append("#This plugin is modular\r\n"); - writer.append("#Turn any features you don't want to false and they won't be running\r\n"); - writer.append("#If you edit this file and save it, then use /reload it will reload the settings\r\n"); - writer.append("#Chat Options\r\n"); - writer.append("#Group prefix colors apply to player brackets\r\n"); - writer.append("groupcoloredbrackets=true\r\n"); - writer.append("#Allows the use of color codes following ^ symbol\r\n"); - writer.append("ColoredChat=true\r\n"); - writer.append("#Require per player permission for quakecolors\r\n"); - writer.append("colorsrequirepermissions=false\r\n"); - writer.append("#use /coloruse to give players permission if this is enabled\r\n"); - writer.append("#Text following a > will be colored green to mimic quoting of popular internet message boards\r\n"); - writer.append("QuotesAreGreen=true\r\n"); - writer.append("#Turns any chat message starting with FFF automagically blood red\r\n"); - writer.append("FFF=true\r\n"); - writer.append("\r\n"); - writer.append("#Admin Settings\r\n"); - writer.append("#Enables or disables players spawning to their home location\r\n"); - writer.append("playerspawn=true\r\n"); - writer.append("#Enables or disables the admin only chat\r\n"); - writer.append("adminchat=true\r\n"); - writer.append("#Lets non admins use admin chat if they have the /adminchat command permission\r\n"); - writer.append("/adminchat=true\r\n"); - writer.append("#Enables overriding of regular /tp and /tphere to make it so you can only teleport to players with lower permissions, and only bring players of lower permissions to you\r\n"); - writer.append("/tp=true\r\n"); - writer.append("/tphere=true\r\n"); - writer.append("#Mass Tp uses the same concept, anyone with this command only brings those with lower permissions to themselves\r\n"); - writer.append("/masstp=true\r\n"); - writer.append("\r\n"); - writer.append("#Server Settings\r\n"); - writer.append("#Enables or Disables the following commands, give groups/users permissions to use these commands for them to work\r\n"); - writer.append("/fabulous=true\r\n"); - writer.append("/prefix=true\r\n"); - writer.append("/freeze=true\r\n"); - writer.append("/suffix=true\r\n"); - writer.append("/ignore=true\r\n"); - writer.append("/colors=true\r\n"); - writer.append("/whois=true\r\n"); - writer.append("/nick=true\r\n"); - writer.append("/who=true\r\n"); - writer.append("/promote=true\r\n"); - writer.append("/demote=true\r\n"); - writer.append("/say=true\r\n"); - writer.append("/rules=true\r\n"); - writer.append("/suicide=true\r\n"); - writer.append("/ezmodo=true\r\n"); - writer.append("#Global Messages\r\n"); - writer.append("#Enable or Disable sending announcements about sensitive commands to the entire server\r\n"); - writer.append("globalmessages=true\r\n"); - writer.append("#Adding player names to this list will have them start off in ezmodo\r\n"); - writer.append("ezModo=\r\n"); - writer.append("#Stop fire from spreading\r\n"); - writer.append("stopFire=false\r\n"); - writer.append("#Stop lava from spreading fire"); - writer.append("lavaspread=false"); - writer.append("#Blocks disabled from fire"); - writer.append("fireblocks="); - writer.append("\r\n"); - writer.append("#Organize your player ranks from lowest to highest.\r\n"); - writer.append("ranks=\r\n"); - writer.append("#Write the rules to be shown when /rules is used here, it works just like the MOTD does\r\n"); - writer.append("rules=Rules@#1: No griefing@#2: No griefing\r\n"); - writer.append("#The Random Death messages, seperate them by comma. All death messages start with the player name and a space.\r\n"); - writer.append("deathMessages=is no more,died horribly,went peacefully\r\n"); - writer.append("#Enable whether or not players can toggle party chat"); - writer.append("partychat=true"); - writer.append("hiddendistance=1024"); - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while creating " + location, e); - } finally { - try { - if (writer != null) { - writer.close(); - } - } catch (IOException e) { - log.log(Level.SEVERE, "Exception while closing writer for " + location, e); - } - } - - } else { - properties = new PropertiesFile("vminecraft.properties"); - try { - properties.load(); - } catch (IOException e) { - log.log(Level.SEVERE, "Exception while loading vminecraft.properties", e); - } - } - - try { - groupcoloredbrackets = properties.getBoolean("groupcoloredbrackets",true); - adminChat = properties.getBoolean("adminchat",true); - partyChat = properties.getBoolean("partychat",true); - playerspawn = properties.getBoolean("playerspawn",true); - greentext = properties.getBoolean("QuotesAreGreen",true); - FFF = properties.getBoolean("FFF",true); - quakeColors = properties.getBoolean("ColoredChat",true); - colorsrequirepermission = properties.getBoolean("colorsrequirepermission",true); - prefix = properties.getBoolean("prefix",true); - suffix = properties.getBoolean("suffix",true); - ignore = properties.getBoolean("ignore",true); - colors = properties.getBoolean("colors",true); - nick = properties.getBoolean("nick",true); - freeze = properties.getBoolean("/freeze",true); - cmdFabulous = properties.getBoolean("/fabulous",true); - cmdPromote = properties.getBoolean("/promote",true); - cmdDemote = properties.getBoolean("/demote",true); - cmdWhoIs = properties.getBoolean("/whois",true); - cmdWho = properties.getBoolean("/who",true); - cmdRules = properties.getBoolean("/rules",true); - cmdTp = properties.getBoolean("/tp",true); - cmdMasstp = properties.getBoolean("/masstp",true); - cmdTphere = properties.getBoolean("/tphere",true); - cmdSuicide = properties.getBoolean("/suicide", true); - cmdHeal = properties.getBoolean("/heal",true); - cmdAdminToggle = properties.getBoolean("/adminchat", true); - globalmessages = properties.getBoolean("globalmessages",true); - cmdSay = properties.getBoolean("/say",true); - cmdEzModo = properties.getBoolean("/ezmodo",true); - stopFire = properties.getBoolean("stopFire",true); - lavaspread = properties.getBoolean("lavaspread",true); - rules = properties.getString("rules", "").split("@"); - deathMessages = properties.getString("deathmessages", "").split(","); - String[] tempEz = properties.getString("ezModo").split(","); - String[] fireblocks = properties.getString("fireblocks").split(","); - fireblockan = new ArrayList(); - for(String str : fireblocks) - { - if(!str.isEmpty()) - fireblockan.add(Integer.parseInt(str)); - } - ezModo = new ArrayList(); - ezModo.addAll(Arrays.asList(tempEz)); - ranks = properties.getString("ranks").split(","); - range = properties.getInt("hiddendistance",1024); - log.log(Level.INFO, "vminecraft plugin successfully loaded"); - } - catch (Exception e) - { - log.log(Level.SEVERE, "vminecraft Error: ERROR LOADING PROPERTIES FILE {0}", e); - } - } - - //===================================================================== - //Function: adminchat, greentext, FFF, quakeColors, cmdFabulous, - // cmdPromote, cmdDemote, cmdWhoIs, cmdTp, cmdTphere, cmdSay - // cmdRules, globalmessages, cmdMasstp, cmdEzModo - //Input: None - //Output: Boolan: If the feature is enabled - //Use: Returns if the feature is enabled - //===================================================================== - public boolean adminchat() {return adminChat;} - public boolean groupcoloredbrackets(){return groupcoloredbrackets;} - public boolean partyChat() {return partyChat;} - public boolean adminChatToggle() {return cmdAdminToggle;} - public boolean greentext() {return greentext;} - public boolean FFF() {return FFF;} - public boolean quakeColors() {return quakeColors;} - public boolean prefix() {return prefix;} - public boolean suffix() {return suffix;} - public boolean ignore() {return ignore;} - public boolean colors() {return colors;} - public boolean nick() {return nick;} - public boolean playerspawn() {return playerspawn;} - public boolean colorsreq() {return colorsrequirepermission;} - public boolean freeze() {return freeze;} - public boolean cmdFabulous() {return cmdFabulous;} - public boolean cmdPromote() {return cmdPromote;} - public boolean cmdDemote() {return cmdDemote;} - public boolean cmdWhoIs() {return cmdWhoIs;} - public boolean cmdTp() {return cmdTp;} - public boolean cmdTphere() {return cmdTphere;} - public boolean cmdSay() {return cmdSay;} - public boolean cmdRules() {return cmdRules;} - public boolean globalmessages() {return globalmessages;} - public boolean cmdMasstp() {return cmdMasstp;} - public boolean cmdWho() {return cmdWho;} - public boolean stopFire() {return stopFire;} - public boolean lavaSpread() {return lavaspread;} - public boolean cmdSuicide() {return cmdSuicide;} - public boolean cmdHeal() {return cmdHeal;} - public ArrayList getFireBlockIds() {return fireblockan;} - public String[] getRanks() {return ranks;} - - //EzModo methods - public boolean cmdEzModo() {return cmdEzModo;} - public boolean isEzModo(String playerName) {return ezModo.contains(playerName);} - public boolean isFrozen(String playerName) {return frozenplayers.contains(playerName);} - public boolean isAdminToggled(String playerName) {return adminChatList.contains(playerName);} - public boolean isPartyToggled(String playerName) {return partyChatList.contains(playerName);} - public void removeEzModo(String playerName) {ezModo.remove(ezModo.indexOf(playerName));} - public void removePartyToggled(String playerName) {partyChatList.remove(partyChatList.indexOf(playerName));} - public void removeAdminToggled(String playerName) {adminChatList.remove(adminChatList.indexOf(playerName));} - public void addEzModo(String playerName) {ezModo.add(playerName);} - public void addPartyToggled(String playerName) {partyChatList.add(playerName);} - public void addAdminToggled(String playerName) {adminChatList.add(playerName);} - public void addFrozen(String playerName) {frozenplayers.add(playerName);} - public void removeFrozen (String playerName) {frozenplayers.remove(frozenplayers.indexOf(playerName));} - public String ezModoList() {return ezModo.toString();} - - //Random death message method - public static String randomDeathMsg() { - if (deathMessages == null) { - return "died"; - } - return deathMessages[ (int) (Math.random() * deathMessages.length)]; - } - - //===================================================================== - //Function: getInstance - //Input: None - //Output: vminecraftSettings: The instance of the settings - //Use: Returns the instance of the settings - //===================================================================== - public static vConfig getInstance() { - if (instance == null) { - instance = new vConfig(); - } - return instance; - } - - //===================================================================== - //Function: getRules - //Input: None - //Output: String[]: The list of rules - //Use: Gets the array containing the rules - //===================================================================== - public String[] getRules() { - return rules; - } - -} \ No newline at end of file diff --git a/hMod/vListener.java b/hMod/vListener.java deleted file mode 100644 index d9fbfb1a8..000000000 --- a/hMod/vListener.java +++ /dev/null @@ -1,212 +0,0 @@ -import java.util.logging.Level; -import java.util.logging.Logger; -//===================================================================== -//Class: vMinecraftListener -//Use: The listener to catch incoming chat and commands -//Author: nossr50, TrapAlice, cerevisiae -//===================================================================== -public class vListener extends PluginListener { - protected static final Logger log = Logger.getLogger("Minecraft"); - //On console stuff - public boolean onConsoleCommand(String[] split) { - String server = Colors.LightGreen + "[Server]" + Colors.DarkPurple; - if(split[0].equalsIgnoreCase("say")) - { - if(split.length > 1){ - String args = " " + etc.combineSplit(1, split, " "); - vChat.gmsg(server + " " + args); - log.log(Level.INFO, "[Server] " + args); - return true; - } - return false; - } - if(split[0].equalsIgnoreCase("stop")){ - vChat.gmsg(server + " shutting down the server"); - log.log(Level.INFO, "[Server] " + "shutting down the server"); - } - return false; - } - - //===================================================================== - //Function: disable - //Input: None - //Output: None - //Use: Disables vMinecraft, but why would you want to do that? ;) - //===================================================================== - public void disable() { - log.log(Level.INFO, "vMinecraft disabled"); - } - public void onPlayerMove(Player player, Location from, Location to) { - if(vConfig.getInstance().isFrozen(player.getName())){ - player.teleportTo(from); - } - vCom.updateInvisibleForAll(); - } - - //===================================================================== - //Function: onChat - //Input: Player player: The player calling the command - // String message: The message to color - //Output: boolean: If the user has access to the command - // and it is enabled - //Use: Checks for quote, rage, and colors - //===================================================================== - - public boolean onChat(Player player, String message){ - - if (message.startsWith("@") || - vConfig.getInstance().isAdminToggled(player.getName())) - return vChat.adminChat(player, message); - //PartyChat - if((message.startsWith("!")) || - vConfig.getInstance().isPartyToggled(player.getName())) - return vChat.partyChat(player, message); - //Quote (Greentext) - else if (message.startsWith(">")) - return vChat.quote(player, message); - //Rage (FFF) - else if (message.startsWith("FFF")) - return vChat.rage(player, message); - //Send through quakeColors otherwise - else - return vChat.quakeColors(player, message); - } - - //===================================================================== - //Function: onCommand - //Input: Player player: The player calling the command - // String[] split: The arguments - //Output: boolean: If the user has access to the command - // and it is enabled - //Use: Checks for exploits and runs the commands - //===================================================================== - public boolean onCommand(Player player, String[] split) { - - //Copy the arguments into their own array. - String[] args = new String[split.length - 1]; - System.arraycopy(split, 1, args, 0, args.length); - - //Return the results of the command - int exitCode = vCom.cl.call(split[0], player, args); - if(exitCode == 0) - return false; - else if(exitCode == 1) - return true; - else - return false; - - } - - //===================================================================== - //Function: onHealthChange - //Input: Player player: The player calling the command - // int oldValue: The old health value; - // int newValue: The new health value - //Output: boolean: If the user has access to the command - // and it is enabled - //Use: Checks for exploits and runs the commands - //===================================================================== - public boolean onHealthChange(Player player,int oldValue,int newValue){ - - //Sets a player as dead - if (player.getHealth() < 1){ - vUsers.getProfile(player).isDead(true); - } - if (player.getHealth() > 1 && vUsers.getProfile(player).isDead()){ - if(vConfig.getInstance().playerspawn()) - { - Warp home = null; - if (etc.getDataSource().getHome(player.getName()) != null){ - home = etc.getDataSource().getHome(player.getName()); - player.teleportTo(home.Location); - player.sendMessage(Colors.DarkPurple + "Return here with /myspawn"); - player.sendMessage(Colors.DarkPurple + "The penalty for returning is the loss of inventory"); - } - if(player.canUseCommand("/sethome")) - player.sendMessage(Colors.DarkPurple + "Set your own spawn with /sethome"); - } - vUsers.getProfile(player).isDead(false); - if(!vUsers.getProfile(player).isSilent()) - vChat.gmsg(Colors.Gray + player.getName() + " " + vConfig.randomDeathMsg()); - } - return false; - } - - public void onLogin(Player player){ - vChat.sendMessage(player, player, Colors.Rose + "There are currently " + etc.getServer().getPlayerList().size() + " players online."); - vUsers.addUser(player); - } - - public void onDisconnect(Player player){ - vUsers.removeUser(player); - } - - public boolean onIgnite(Block block, Player player) { - - if(vConfig.getInstance().stopFire()){ - //There are 3 ways fire can spread - //1 = lava, 2 = lighter, 3 = spread (other fire blocks) - //Stop lava from spreading - if(block.getStatus() == 1 && vConfig.getInstance().lavaSpread()){ - return true; - } - //Stop fire from spreading fire - if (block.getStatus() == 3 && vConfig.getInstance().stopFire()){ - return true; - } - //Checking to see if any of the blocks fire is trying to spread to is on the "fireblockan" list - if (block.getStatus() == 3){ - int x, - y, - z; - x = block.getX(); - y = block.getY(); - z = block.getZ(); - //Finding out the blockid of the current blocks fire is trying to spread to - int blockid = etc.getServer().getBlockIdAt(x, y, z); - //Check to see the blockid doesn't match anything on the list - for(x = 0; x >= vConfig.fireblockan.size(); x++){ - if (vConfig.fireblockan.get(x) == blockid){ - return true; - } - } - - } - //Stop players without permission from being able to set fires - if(block.getStatus() == 2 && !player.canUseCommand("/flint")){ - return true; - } - } - return false; - } - - public boolean onDamage(PluginLoader.DamageType type, BaseEntity attacker, BaseEntity defender, int amount) { - //Invincibility for EzModo players - //This also checks if the defender is a player - if(defender.isPlayer()){ - Player dplayer = defender.getPlayer(); - if(vConfig.getInstance().isEzModo(dplayer.getName())){ - return true; - } - //So far we've checked if the defender is a player, next we check if the attacker is one - if(attacker != null && attacker.isPlayer()){ - //If the attacker is not null and is a player we assign the attacker to a new player variable - Player aplayer = attacker.getPlayer(); - //Then we preceed to check if they are in the same party, the code for this is stored elsewhere - if(vUsers.getProfile(dplayer).inParty()){ - //If they are in the same party we tell onDamage to return true stopping the damage code from executing - if(aplayer != null && vmc.inSameParty(aplayer, dplayer)){ - return true; - //if they aren't we tell it to return false, making the damage happen - } else{ - return false; - } - } - else { - return false; - } - } - } - return false; - } -} diff --git a/hMod/vMinecraft.java b/hMod/vMinecraft.java deleted file mode 100644 index 39c44b909..000000000 --- a/hMod/vMinecraft.java +++ /dev/null @@ -1,37 +0,0 @@ -import java.util.logging.Logger; - -//===================================================================== -//Class: vMinecraftPlugin -//Use: Starts the plugin -//Author: nossr50, TrapAlice, cerevisiae -//===================================================================== -public class vMinecraft extends Plugin { - static final vListener listener = new vListener(); - protected static final Logger log = Logger.getLogger("Minecraft"); - - public void enable() { - vConfig.getInstance().loadSettings(); - vUsers.getInstance().loadUsers(); - vCom.loadCommands(); - vUpdatr.getInstance().createUpdatrFile(); - } - - public void disable() { - //And remove the commands here. - } - - public void initialize() { - //Here we add the hook we're going to use. In this case it's the arm swing event. - etc.getLoader().addListener(PluginLoader.Hook.SERVERCOMMAND, listener, this, PluginListener.Priority.CRITICAL); - etc.getLoader().addListener(PluginLoader.Hook.CHAT, listener, this, PluginListener.Priority.MEDIUM); - etc.getLoader().addListener(PluginLoader.Hook.LOGIN, listener, this, PluginListener.Priority.MEDIUM); - etc.getLoader().addListener(PluginLoader.Hook.COMMAND, listener, this, PluginListener.Priority.HIGH); - 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); - etc.getLoader().addListener(PluginLoader.Hook.LIQUID_DESTROY, listener, this, PluginListener.Priority.MEDIUM); - etc.getLoader().addListener(PluginLoader.Hook.HEALTH_CHANGE, listener, this, PluginListener.Priority.MEDIUM); - etc.getLoader().addListener(PluginLoader.Hook.PLAYER_MOVE, listener, this, PluginListener.Priority.MEDIUM); - } - } - diff --git a/hMod/vUpdatr.java b/hMod/vUpdatr.java deleted file mode 100644 index 04bf3b781..000000000 --- a/hMod/vUpdatr.java +++ /dev/null @@ -1,48 +0,0 @@ -//Thanks to Yogoda for the code! -import java.io.*; -import java.util.logging.*; -public class vUpdatr { - - static final String pluginName = "vMinecraft"; - static final String version = "0.1"; - static final String updatrUrl = "http://dl.dropbox.com/u/18212134/vMinecraft.updatr"; - static final String updatrFileUrl = "http://dl.dropbox.com/u/18212134/vMinecraft.jar"; - static final String updatrNotes = "Added Updatr support!"; - private static volatile vUpdatr instance; - - public static Logger logger = Logger.getLogger("Minecraft"); - - public void createUpdatrFile(){ - - try { - - File updatrDir = new File("Updatr"); - - //create Updatr directory if it does not exsits already - if(updatrDir.exists()){ - - File updatrFile = new File("Updatr" + File.separator + pluginName + ".updatr"); - - //Updatr file does not exist, create it - if(!updatrFile.exists()){ - updatrFile.createNewFile(); - BufferedWriter writer = new BufferedWriter(new FileWriter(updatrFile)); - writer.write("name = " + pluginName); writer.newLine(); - writer.write("version = " + version); writer.newLine(); - writer.write("url = " + updatrUrl); writer.newLine(); - writer.write("file = " + updatrFileUrl); writer.newLine(); - writer.write("notes = " + updatrNotes); writer.newLine(); - writer.close(); - } - } - } catch (IOException e) { - vUpdatr.logger.log(Level.SEVERE, null, e); - } - } -public static vUpdatr getInstance(){ - if (instance == null){ - instance = new vUpdatr(); - } - return instance; -} -} \ No newline at end of file diff --git a/hMod/vUsers.java b/hMod/vUsers.java deleted file mode 100644 index a9f33cbf5..000000000 --- a/hMod/vUsers.java +++ /dev/null @@ -1,633 +0,0 @@ -import java.io.*; -import java.util.ArrayList; -import java.util.logging.Level; -import java.util.logging.Logger; - - -//===================================================================== -//Class: PlayerList -//Use: Encapsulates the player list -//Author: cerevisiae -//===================================================================== -public class vUsers { - private static volatile vUsers instance; - protected static final Logger log = Logger.getLogger("Minecraft"); - private PropertiesFile properties; - String location = "vminecraft.users"; - - public static PlayerList players = new PlayerList(); - - - public void loadUsers(){ - File theDir = new File(location); - if(!theDir.exists()){ - properties = new PropertiesFile(location); - FileWriter writer = null; - try { - writer = new FileWriter(location); - writer.write("#Storage place for user information\r\n"); - writer.write("#username:nickname:suffix:tag:ignore,list,names:alias,commands,here\r\n"); - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while creating " + location, e); - } finally { - try { - if (writer != null) { - writer.close(); - } - } catch (IOException e) { - log.log(Level.SEVERE, "Exception while closing writer for " + location, e); - } - } - - } else { - properties = new PropertiesFile(location); - try { - properties.load(); - } catch (IOException e) { - log.log(Level.SEVERE, "Exception while loading " + location, e); - } - } - } - - //===================================================================== - //Function: addUser - //Input: Player player: The player to create a profile for - //Output: none - //Use: Loads the profile for the specified player - //===================================================================== - public static void addUser(Player player){ - players.addPlayer(player); - } - - //===================================================================== - //Function: removeUser - //Input: Player player: The player to stop following - //Output: none - //Use: Creates the player profile - //===================================================================== - public static void removeUser(Player player){ - players.removePlayer(player); - } - - //===================================================================== - //Function: getProfile - //Input: Player player: The player to find the profile for - //Output: PlayerList.PlayerProfile: The profile - //Use: Gets the player profile - //===================================================================== - public static PlayerList.PlayerProfile getProfile(Player player){ - return players.findProfile(player); - } - - public static vUsers getInstance() { - if (instance == null) { - instance = new vUsers(); - } - return instance; - } - public static void getRow(){ - - } -} -class PlayerList -{ - protected static final Logger log = Logger.getLogger("Minecraft"); - ArrayList players; - - //===================================================================== - //Function: PlayerList - //Input: Player player: The player to create a profile object for - //Output: none - //Use: Initializes the ArrayList - //===================================================================== - public PlayerList() { players = new ArrayList(); } - - //===================================================================== - //Function: addPlayer - //Input: Player player: The player to add - //Output: None - //Use: Add a profile of the specified player - //===================================================================== - public void addPlayer(Player player) - { - players.add(new PlayerProfile(player)); - } - - //===================================================================== - //Function: removePlayer - //Input: Player player: The player to remove - //Output: None - //Use: Remove the profile of the specified player - //===================================================================== - public void removePlayer(Player player) - { - players.remove(findProfile(player)); - } - - //===================================================================== - //Function: findProfile - //Input: Player player: The player to find's profile - //Output: PlayerProfile: The profile of the specified player - //Use: Get the profile for the specified player - //===================================================================== - public PlayerProfile findProfile(Player player) - { - for(PlayerProfile ply : players) - { - if(ply.isPlayer(player)) - return ply; - } - return null; - } - - //===================================================================== - //Class: PlayerProfile - //Use: Encapsulates all commands for player options - //Author: cerevisiae - //===================================================================== - class PlayerProfile - { - protected final Logger log = Logger.getLogger("Minecraft"); - private String playerName, - lastMessage, - nickName, - tag, - suffix, - party, - tpxyz; - - private boolean dead, - silent; - - char defaultColor; - - String location = "vminecraft.users"; - - private ArrayList ignoreList; - private commandList aliasList; - - static final int EXIT_FAIL = 0, - EXIT_SUCCESS = 1, - EXIT_CONTINUE = 2; - - //===================================================================== - //Function: PlayerProfile - //Input: Player player: The player to create a profile object for - //Output: none - //Use: Loads settings for the player or creates them if they don't - // exist. - //===================================================================== - public PlayerProfile(Player player) - { - //Declare things - playerName = player.getName(); - tag = new String(); - nickName = new String(); - suffix = new String(); - tpxyz = new String(); - party = new String(); - party = null; - defaultColor = 'f'; - ignoreList = new ArrayList(); - aliasList = new commandList(); - dead = false; - - //Try to load the player and if they aren't found, append them - if(!load()) - addPlayer(); - } - - public boolean load() - { - try { - //Open the user file - FileReader file = new FileReader(location); - BufferedReader in = new BufferedReader(file); - String line = ""; - while((line = in.readLine()) != null) - { - //Find if the line contains the player we want. - String[] character = line.split(":"); - if(!character[0].equals(playerName)){continue;} - - //Get the tag - if(character.length > 1) - tag = character[1]; - //Get the nickname - if(character.length > 2) - nickName = character[2]; - //Get the suffix - if(character.length > 3) - suffix = character[3]; - //Get the color - if(character.length > 4) - defaultColor = character[4].charAt(0); - //Ignore previously ignored players - if(character.length > 5) - { - String[] ignores = character[5].split(","); - if(ignores.length > 0) - { - for(String ignore : ignores) - ignoreList.add(ignore); - } - } - //Register the aliases - if(character.length > 6) - { - String[] allAliases = character[6].split(","); - if(allAliases.length > 0) - { - for(String singleAlias : allAliases) - { - String[] parts = singleAlias.split("@"); - if(parts.length > 1) - { - aliasList.registerAlias(parts[0], parts[1]); - } - } - } - } - //XYZ TP Back value - //Not sure if declaring a double this way will work or not - if(character.length > 7) - { - tpxyz = character[7]; - } - in.close(); - return true; - } - in.close(); - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while reading " - + location + " (Are you sure you formatted it correctly?)", e); - } - return false; - } - - //===================================================================== - // Function: save - // Input: none - // Output: None - // Use: Writes current values of PlayerProfile to disk - // Call this function to save current values - //===================================================================== - public void save() - { - try { - //Open the file - FileReader file = new FileReader(location); - BufferedReader in = new BufferedReader(file); - StringBuilder writer = new StringBuilder(); - String line = ""; - - //While not at the end of the file - while((line = in.readLine()) != null) - { - //Read the line in and copy it to the output it's not the player - //we want to edit - if(!line.split(":")[0].equalsIgnoreCase(playerName)) - { - writer.append(line).append("\r\n"); - - //Otherwise write the new player information - } else { - writer.append(playerName + ":"); - writer.append(tag + ":"); - writer.append(nickName + ":"); - writer.append(suffix + ":"); - writer.append(defaultColor + ":"); - - int i = 0; - for(String ignore : ignoreList) - { - writer.append(ignore); - if(i < ignoreList.size() - 1) - writer.append(","); - } - writer.append(":"); - writer.append(aliasList.toString()); - writer.append(tpxyz.toString()); - writer.append("\r\n"); - } - } - in.close(); - - - //Write the new file - FileWriter out = new FileWriter(location); - out.write(writer.toString()); - out.close(); - - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while writing to " + location + " (Are you sure you formatted it correctly?)", e); - } - } - - public void addPlayer() - { - try { - //Open the file to write the player - FileWriter file = new FileWriter(location, true); - BufferedWriter out = new BufferedWriter(file); - - //Add the player to the end - out.append(playerName + ":"); - out.append(tag + ":"); - out.append(nickName + ":"); - out.append(suffix + ":"); - out.append(defaultColor + ":"); - - - int i = 0; - for(String ignore : ignoreList) - { - out.append(ignore); - if(i < ignoreList.size() - 1) - out.append(","); - } - out.append(":"); - out.append(tpxyz + ":"); - - out.append(aliasList.toString()); - out.newLine(); - out.close(); - - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while writing to " + location + " (Are you sure you formatted it correctly?)", e); - } - } - - //===================================================================== - //Function: isPlayer - //Input: None - //Output: Player: The player this profile belongs to - //Use: Finds if this profile belongs to a specified player - //===================================================================== - public boolean isPlayer(Player player) - { - return player.getName().equals(playerName); - } - - //===================================================================== - //Function: isIgnored - //Input: Player player: Checks if a player is ignored - //Output: boolean: If they're ignored - //Use: Finds if the specified player is in the ignore list - //===================================================================== - public boolean isIgnored(Player player){ - return ignoreList.contains(player.getName()); - } - - //===================================================================== - //Function: addIgnore - //Input: Player name: The player to ignore - //Output: boolean: If the player was successfully ignored - //Use: Ignores a player. - //===================================================================== - public boolean addIgnore(Player name) - { - if(!ignoreList.contains(name)) - { - ignoreList.add(name.getName()); - save(); - return true; - } - return false; - } - - //===================================================================== - //Function: removeIgnore - //Input: Player name: The player to unignore - //Output: boolean: If the player was successfully unignored - //Use: Stops ignoring a player. - //===================================================================== - public boolean removeIgnore(Player name) - { - if(ignoreList.contains(name.getName())) - { - ignoreList.remove(name.getName()); - save(); - return true; - } - return false; - } - - //===================================================================== - //Function: removeIgnore - //Input: Player name: The player to unignore - //Output: boolean: If the player was successfully unignored - //Use: Stops ignoring a player. - //===================================================================== - public String[] listIgnore() - { - return ignoreList.toArray(new String[ignoreList.size()]); - } - - //===================================================================== - //Function: addAlias - //Input: String command: The command to try to call - // String[] args: The arguments for the command - //Output: None - //Use: Adds a command - //===================================================================== - public void addAlias(String name, String callCommand) - { - aliasList.registerAlias(name, callCommand); - save(); - } - - //===================================================================== - //Function: callAlias - //Input: String command: The command to try to call - // Player player: Checks if a player is ignored - // String[] args: The arguments for the command - //Output: int: Exit code - //Use: Attempts to call a command - //===================================================================== - public int callAlias(String command, Player player, String[] args) - { - try - { - //Attemt to call the function - return aliasList.call(command, player, args); - } - catch (Throwable e) - { - //The function wasn't found, returns fail - return EXIT_FAIL; - } - } - - //===================================================================== - //Function: setTag - //Input: String newTag: The tag to set for the player - //Output: None - //Use: Sets a player tag - //===================================================================== - public void setTag(String newTag) - { - tag = newTag; - save(); - } - //===================================================================== - //Function: setTpback - //Input: None - //Output: None - //Use: Sets a player's tpback xyz coordinates - //===================================================================== - public void setTpback(String newtpback) - { - tpxyz = newtpback; - save(); - } - //===================================================================== - //Function: getTpxyz - //Input: None - //Output: Double: The player's tpback x coords - //Use: Gets the x value of tpback - //===================================================================== - public String getTpxyz() - { - return tpxyz; - } - //Function: getTag - //Input: None - //Output: String: The player tag - //Use: Gets a player tag - //===================================================================== - public String getTag() { return tag; } - - //===================================================================== - //Function: setNick - //Input: String newTag: The nickname to set for the player - //Output: None - //Use: Sets a player nickname - //===================================================================== - public void setNick(String newNick) - { - nickName = newNick; - save(); - } - - public void setSilent(){ - silent = true; - } - public void disableSilent(){ - silent = false; - } - public boolean isSilent(){ - return silent; - } - //Store the player's party - public void setParty(String newParty) - { - party = newParty; - save(); - } - //Retrieve the player's party - public String getParty() {return party;} - //Remove party - public void removeParty() { - party = null; - save(); - } - //Retrieve whether or not the player is in a party - public boolean inParty() { - if(party != null){ - return true; - } else { - return false; - } - } - - //===================================================================== - //Function: getNick - //Input: None - //Output: String: The player nickname - //Use: Gets a player nickname - //===================================================================== - public String getNick() { return nickName; } - - //===================================================================== - //Function: setSuffix - //Input: String newTag: The suffix to set for the player - //Output: None - //Use: Sets a player suffix - //===================================================================== - public void setSuffix(String newSuffix) - { - suffix = newSuffix; - save(); - } - - //===================================================================== - //Function: getSuffix - //Input: None - //Output: String: The player suffix - //Use: Gets a player suffix - //===================================================================== - public String getSuffix() { return suffix; } - - //===================================================================== - //Function: setColor - //Input: String newTag: The color to set for the player - //Output: None - //Use: Sets a player color - //===================================================================== - public void setColor(String newColor) - { - defaultColor = newColor.charAt(0); - save(); - } - - //===================================================================== - //Function: getColor - //Input: None - //Output: String: The player color - //Use: Gets a player color - //===================================================================== - public String getColor() {return vChat.colorChange(defaultColor);} - - //===================================================================== - //Function: setMessage - //Input: String newName: The name of the player they last messaged - // or recieved a message from. - //Output: None - //Use: Sets a player tag - //===================================================================== - public void setMessage(Player newName){ lastMessage = newName.getName(); } - - //===================================================================== - //Function: getMessage - //Input: None - //Output: String: The player name - //Use: Gets the name of the player they last messaged or recieved - // a message from. - //===================================================================== - public Player getMessage() - { - if(lastMessage != null) - return etc.getServer().matchPlayer(lastMessage); - return null; - } - - //===================================================================== - //Function: isDead - //Input: None - //Output: boolean: If the player is dead or not - //Use: Gets the player is dead or not. - //===================================================================== - public boolean isDead() {return dead;} - - //===================================================================== - //Function: isDead - //Input: boolean isded: if the player is dead or not. - //Output: None - //Use: Sets if the player is dead or not - //===================================================================== - public void isDead(boolean isded){dead = isded;} - } -} - - diff --git a/hMod/vmc.java b/hMod/vmc.java deleted file mode 100644 index fa9acd66d..000000000 --- a/hMod/vmc.java +++ /dev/null @@ -1,115 +0,0 @@ -import java.io.*; -import java.lang.String; -import java.util.ArrayList; -import java.util.logging.Level; -import java.util.logging.Logger; -public class vmc { -private static volatile vmc instance; -protected static final Logger log = Logger.getLogger("Minecraft"); -private PropertiesFile properties; -String location = "groups.txt"; - //Check if two players are in the same party - public static boolean inSameParty(Player playera, Player playerb){ - if(vUsers.getProfile(playera).getParty().equals(vUsers.getProfile(playerb).getParty())){ - return true; - } else { - return false; - } - } - //Get the distance between two players - public static double getDistance(Player player1, Player player2) - { - return Math.sqrt(Math.pow(player1.getX() - player2.getX(), 2) + Math.pow(player1.getY() - player2.getY(), 2) - + Math.pow(player1.getZ() - player2.getZ(), 2)); - } - //Send the "invisibility" toggle to players near the hidden player - public static void sendInvisible(Player player){ - for (Player p : etc.getServer().getPlayerList()) - { - if (getDistance(player, p) <= vConfig.range && p.getUser() != player.getUser()) - { - p.getUser().a.b(new dv(player.getUser().g)); - } - } - } - //Send "visibility" toggle to invisible players turning them back to normal - public static void sendNotInvisible(Player player){ - for (Player p : etc.getServer().getPlayerList()) - { - if (getDistance(player, p) < vConfig.range && p.getUser() != player.getUser()) - { - p.getUser().a.b(new d(player.getUser())); - } - } - } - public String[] getPartyMembers(Player player){ - int x = 0; - String partyarray[] = null; - ArrayList partymembers = new ArrayList(); - for(Player p : etc.getServer().getPlayerList()){ - if(vmc.inSameParty(player, p) && p != null){ - partymembers.add(p.getName()); - x++; - } - } - partymembers.toArray(partyarray); - return partyarray; - } - public static void informPartyMembers(Player player){ - int x = 0; - for(Player p : etc.getServer().getPlayerList()){ - if(vmc.inSameParty(player, p) && !p.getName().equals(player.getName())){ - p.sendMessage(vUsers.getProfile(player).getTag() + player.getName() + Colors.Green + " has joined your party"); - x++; - } - } - } - public static void informPartyMembersQuit(Player player){ - int x = 0; - for(Player p : etc.getServer().getPlayerList()){ - if(vmc.inSameParty(player, p) && !p.getName().equals(player.getName())){ - p.sendMessage(vUsers.getProfile(player).getTag() + player.getName() + Colors.Green + " has left your party"); - x++; - } - } - } - public String getGroupPrefix(Player player){ - String groups[] = player.getGroups(); - String groupline[] = null; - String prefix = Colors.White; - int x = 0; - if(groups.length == 0 || groups == null) - return prefix; - if(vConfig.getInstance().groupcoloredbrackets()){ - //Read the file - properties = new PropertiesFile(location); - try { - properties.load(); - } catch (IOException e) { - log.log(Level.SEVERE, "Exception while loading " + location, e); - } - //Grab the line with the same group as the player - for(String herp : groups){ - if(herp != null) - x++; - } - if(x > 0) - groupline = properties.getString(groups[0]).split(":"); - //Check if the prefix is null or not - if(!groupline[0].isEmpty() && groupline != null) - { - //vChat.colorChange(groupline[0].charAt(0)); - prefix = groupline[0]; - prefix = vChat.colorChange(prefix.charAt(0)); - } - } - return prefix; - } - - public static vmc getInstance() { - if (instance == null) { - instance = new vmc(); - } - return instance; - } -} diff --git a/mcMMO/com/gmail/nossr50/mcMMO.java b/mcMMO/com/gmail/nossr50/mcMMO.java index e74ce68f1..3b04027cf 100644 --- a/mcMMO/com/gmail/nossr50/mcMMO.java +++ b/mcMMO/com/gmail/nossr50/mcMMO.java @@ -10,12 +10,9 @@ import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.party.Party; import com.gmail.nossr50.skills.*; import com.nijikokun.bukkit.Permissions.Permissions; -import com.nijiko.permissions.PermissionHandler; import org.bukkit.ChatColor; import org.bukkit.Location; -import org.bukkit.plugin.Plugin; - import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -49,13 +46,13 @@ public class mcMMO extends JavaPlugin * Donate via paypal to nossr50@gmail.com (A million thanks to anyone that does!) */ - public static String maindirectory = "plugins/mcMMO/"; + public static String maindirectory = "plugins + File.separator + mcMMO"; File file = new File(maindirectory + File.separator + "config.yml"); public static final Logger log = Logger.getLogger("Minecraft"); private final mcPlayerListener playerListener = new mcPlayerListener(this); private final mcBlockListener blockListener = new mcBlockListener(this); private final mcEntityListener entityListener = new mcEntityListener(this); - public static PermissionHandler permissionHandler; + public static mcPermissions permissionHandler = new mcPermissions(); private Permissions permissions; private Timer mcMMO_Timer = new Timer(true); //BLEED AND REGENERATION @@ -71,9 +68,9 @@ public class mcMMO extends JavaPlugin public void onEnable() { - //new File(maindirectory).mkdir(); + new File(maindirectory).mkdir(); - setupPermissions(); + mcPermissions.initialize(getServer()); config.configCheck(); if(!LoadProperties.useMySQL) @@ -121,25 +118,6 @@ public class mcMMO extends JavaPlugin //mcMMO_SpellTimer.schedule(new mcTimerSpells(this), (long)0, (long)(100)); } - private void setupPermissions() - { - if (permissionHandler != null) - { - return; - } - - Plugin permissionsPlugin = this.getServer().getPluginManager().getPlugin("Permissions"); - - if (permissionsPlugin == null) - { - //log.log(Level.INFO, "[mcMMO] Permission system not detected, defaulting to OP"); - return; - } - - permissionHandler = ((Permissions) permissionsPlugin).getHandler(); - //log.log(Level.INFO, "[mcMMO] Found and will use plugin "+((Permissions)permissionsPlugin).getDescription().getFullName()); - } - public boolean inSameParty(Player playera, Player playerb){ if(Users.getProfile(playera).inParty() && Users.getProfile(playerb).inParty()){ if(Users.getProfile(playera).getParty().equals(Users.getProfile(playerb).getParty())){ diff --git a/mcMMO/com/gmail/nossr50/mcPermissions.java b/mcMMO/com/gmail/nossr50/mcPermissions.java index 4143cf03d..65f255917 100644 --- a/mcMMO/com/gmail/nossr50/mcPermissions.java +++ b/mcMMO/com/gmail/nossr50/mcPermissions.java @@ -1,6 +1,5 @@ package com.gmail.nossr50; -import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Server; @@ -15,39 +14,39 @@ import com.nijikokun.bukkit.Permissions.Permissions; public class mcPermissions { - private enum PermissionType { - PEX, PERMISSIONS, BUKKIT - } - - private static PermissionType permissionType; - private static Object PHandle; - public static boolean permissionsEnabled = false; private static volatile mcPermissions instance; + + private enum PermissionType { + PEX, PERMISSIONS, BUKKIT + } + + private static PermissionType permissionType; + private static Object PHandle; + public static boolean permissionsEnabled = false; public static void initialize(Server server) { - Plugin PEXtest = server.getPluginManager().getPlugin("PermissionsEx"); - Plugin test = server.getPluginManager().getPlugin("Permissions"); Logger log = Logger.getLogger("Minecraft"); - if (PEXtest != null) { - PHandle = (PermissionManager) PermissionsEx.getPermissionManager(); - permissionType = PermissionType.PEX; - permissionsEnabled = true; - log.log(Level.INFO, "[mcMMO] PermissionsEx enabled."); - } else if (test != null) { - PHandle = (PermissionHandler) ((Permissions) test).getHandler(); - permissionType = PermissionType.PERMISSIONS; - permissionsEnabled = true; - log.log(Level.INFO, "[mcMMO] Permissions "+test.getDescription().getVersion()+" enabled."); - } else - { - log.log(Level.SEVERE, "[mcMMO] Permissions isn't loaded, there are no restrictions."); - /* - permissionType = PermissionType.BUKKIT; - permissionsEnabled = true; - log.info("[mcMMO] Using Bukkit Permissions.") - */ - } + + if(permissionsEnabled && permissionType != PermissionType.PERMISSIONS) return; + + Plugin PEXtest = server.getPluginManager().getPlugin("PermissionsEx"); + Plugin test = server.getPluginManager().getPlugin("Permissions"); + if(PEXtest != null) { + PHandle = (PermissionManager) PermissionsEx.getPermissionManager(); + permissionType = PermissionType.PEX; + permissionsEnabled = true; + log.info("[mcMMO] PermissionsEx found, using PermissionsEx."); + } else if(test != null) { + PHandle = (PermissionHandler) ((Permissions) test).getHandler(); + permissionType = PermissionType.PERMISSIONS; + permissionsEnabled = true; + log.info("[mcMMO] Permissions version "+test.getDescription().getVersion()+" found, using Permissions."); + } else { + permissionType = PermissionType.BUKKIT; + permissionsEnabled = true; + log.info("[mcMMO] Using Bukkit Permissions."); + } } public static boolean getEnabled() @@ -55,19 +54,20 @@ public class mcPermissions return permissionsEnabled; } - private static boolean permission(Player player, String string) + private static boolean permission(Player player, String permission) { - switch (permissionType) { - case PEX: - return ((PermissionManager) PHandle).has(player, string); - case PERMISSIONS: - return ((PermissionHandler) PHandle).has(player, string); - case BUKKIT: - //return player.hasPermission(string); - default: - return true; - } - } + if(!permissionsEnabled) return player.isOp(); + switch(permissionType) { + case PEX: + return ((PermissionManager) PHandle).has(player, permission); + case PERMISSIONS: + return ((PermissionHandler) PHandle).has(player, permission); + case BUKKIT: + return player.hasPermission(permission); + default: + return true; + } + } public boolean admin(Player player){ if (permissionsEnabled) { return permission(player, "mcmmo.admin"); diff --git a/mcMMO/plugin.yml b/mcMMO/plugin.yml index 79a1e80d4..bc7e566fa 100644 --- a/mcMMO/plugin.yml +++ b/mcMMO/plugin.yml @@ -63,4 +63,167 @@ commands: a: description: Toggle Admin chat or send admin chat messages sorcery: - description: Detailed skill info \ No newline at end of file + description: Detailed skill info +permissions: + mcmmo.*: + description: Implies all mcmmo permissions. + children: + mcmmo.admin: true + mcmmo.tools.*: true + mcmmo.ability.*: true + mcmmo.item.*: true + mcmmo.tools.*: true + mcmmo.regeneration: true + mcmmo.motd: true + mcmmo.commands.*: true + mcmmo.chat.*: true + mcmmo.skills.*: true + mcmmo.admin: + default: op + + mcmmo.tools.*: + description: Implies all mcmmo.tools permissions. + children: + mcmmo.tools.mcrefresh: true + mcmmo.tools.mmoedit: true + mcmmo.tools.mcgod: true + mcmmo.tools.mcrefresh: + default: op + mcmmo.tools.mmoedit: + default: op + mcmmo.tools.mcgod: + default: op + + mcmmo.ability.*: + description: Implies all mcmmo.ability permissions. + children: + mcmmo.ability.herbalism: true + mcmmo.ability.excavation: true + mcmmo.ability.unarmed: true + mcmmo.ability.mining: true + mcmmo.ability.axes: true + mcmmo.ability.swords: true + mcmmo.ability.woodcutting: true + mcmmo.ability.herbalism: + default: true + mcmmo.ability.excavation: + default: true + mcmmo.ability.unarmed: + default: true + mcmmo.ability.mining: + default: true + mcmmo.ability.axes: + default: true + mcmmo.ability.swords: + default: true + mcmmo.ability.woodcutting: + default: true + + mcmmo.item.*: + description: Implies all mcmmo.item permissions. + children: + mcmmo.item.chimaerawing: true + mcmmo.item.chimaerawing: + default: true + + mcmmo.regeneration: + default: true + + mcmmo.motd: + default: true + + mcmmo.commands.*: + description: Implies all mcmmo.commands permissions. + children: + mcmmo.commands.ability: true + mcmmo.commands.myspawn: true + mcmmo.commands.setmyspawn: true + mcmmo.commands.ptp: true + mcmmo.commands.whois: true + mcmmo.commands.party: true + mcmmo.commands.ability: + default: true + mcmmo.commands.myspawn: + default: true + mcmmo.commands.setmyspawn: + default: true + mcmmo.commands.ptp: + default: true + mcmmo.commands.whois: + default: true + mcmmo.commands.party: + default: true + + mcmmo.chat.*: + description: Implies all mcmmo.chat permissions. (Warning, contains adminchat) + children: + mcmmo.chat.adminchat: true + mcmmo.chat.partychat: true + mcmmo.chat.adminchat: + default: op + mcmmo.chat.partychat: + default: true + + mcmmo.skills.*: + description: Implies all mcmmo.skills permissions. + children: + mcmmo.skills.sorcery.*: true + mcmmo.skills.curative.*: true + mcmmo.skills.taming: true + mcmmo.skills.mining: true + mcmmo.skills.woodcutting: true + mcmmo.skills.repair: true + mcmmo.skills.unarmed: true + mcmmo.skills.archery: true + mcmmo.skills.herbalism: true + mcmmo.skills.excavation: true + mcmmo.skills.swords: true + mcmmo.skills.axes: true + mcmmo.skills.acrobatics: true + mcmmo.skills.sorcery.*: + description: Implies all mcmmo.skills.sorcery permissions. + children: + mcmmo.skills.sorcery: true + mcmmo.skills.sorcery.water: true + mcmmo.skills.sorcery.water.thunder: true + mcmmo.skills.curative.*: + description: Implies all mcmmo.skills.curative permissions. + children: + mcmmo.skills.curative: true + mcmmo.skills.curative.heal.other: true + mcmmo.skills.curative.heal.self: true + + mcmmo.skills.sorcery: + default: true + mcmmo.skills.sorcery.water: + default: true + mcmmo.skills.sorcery.water.thunder: + default: true + mcmmo.skills.curative: + default: true + mcmmo.skills.curative.heal.other: + default: true + mcmmo.skills.curative.heal.self: + default: true + mcmmo.skills.taming: + default: true + mcmmo.skills.mining: + default: true + mcmmo.skills.woodcutting: + default: true + mcmmo.skills.repair: + default: true + mcmmo.skills.unarmed: + default: true + mcmmo.skills.archery: + default: true + mcmmo.skills.herbalism: + default: true + mcmmo.skills.excavation: + default: true + mcmmo.skills.swords: + default: true + mcmmo.skills.axes: + default: true + mcmmo.skills.acrobatics: + default: true \ No newline at end of file diff --git a/vChat/com/bukkit/nossr50/vChat/vChat.java b/vChat/com/bukkit/nossr50/vChat/vChat.java deleted file mode 100644 index d92f08d48..000000000 --- a/vChat/com/bukkit/nossr50/vChat/vChat.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.bukkit.nossr50.vChat; - -import java.io.File; -import java.util.HashMap; -import org.bukkit.entity.Player; -import org.bukkit.Server; -import org.bukkit.event.Event.Priority; -import org.bukkit.event.Event; -import org.bukkit.plugin.PluginDescriptionFile; -import org.bukkit.plugin.PluginLoader; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.plugin.PluginManager; - -/** - * vChat for Bukkit - * - * @author nossr50 - * @author cerevisae - */ -public class vChat extends JavaPlugin { - private final vPlayerListener playerListener = new vPlayerListener(this); - private final HashMap debugees = new HashMap(); - - public vChat(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) { - super(pluginLoader, instance, desc, folder, plugin, cLoader); - } - public void onEnable() { - PluginManager pm = getServer().getPluginManager(); - pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Normal, this); - pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this); - pm.registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this); - PluginDescriptionFile pdfFile = this.getDescription(); - System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" ); - //Load the users file - vUsers.getInstance().loadUsers(); - } - public void onDisable() { - System.out.println("vChat Disabled!"); - } -} - - diff --git a/vChat/com/bukkit/nossr50/vChat/vPlayerListener.java b/vChat/com/bukkit/nossr50/vChat/vPlayerListener.java deleted file mode 100644 index 41ae278af..000000000 --- a/vChat/com/bukkit/nossr50/vChat/vPlayerListener.java +++ /dev/null @@ -1,537 +0,0 @@ -package com.bukkit.nossr50.vChat; - -import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerChatEvent; -import org.bukkit.event.player.PlayerEvent; -import org.bukkit.event.player.PlayerListener; -import org.bukkit.ChatColor; -import java.util.ArrayList; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** -* Handle events for all Player related events -* @author nossr50 -*/ -public class vPlayerListener extends PlayerListener { - private final vChat plugin; - protected static final Logger log = Logger.getLogger("Minecraft"); - //The length of a text box line in pixels - protected static final int lineLength = 312; - //Characters we will split the line at - protected static final String lineSplit = "/- "; - - public vPlayerListener(vChat instance) { - plugin = instance; - } - public void onPlayerJoin(PlayerEvent event) { - Player player = event.getPlayer(); - vUsers.addUser(player); - } - //Special Color Codes - protected static final String[] rainbow = new String[] { - ChatColor.DARK_RED.toString(), - ChatColor.RED.toString(), - ChatColor.GOLD.toString(), - ChatColor.YELLOW.toString(), - ChatColor.GREEN.toString(), - ChatColor.DARK_GREEN.toString(), - ChatColor.BLUE.toString(), - ChatColor.DARK_BLUE.toString(), - ChatColor.AQUA.toString(), - ChatColor.DARK_AQUA.toString(), - ChatColor.DARK_PURPLE.toString(), - ChatColor.LIGHT_PURPLE.toString() - }; - protected static final String[] xmas = new String[] { - ChatColor.DARK_RED.toString(), - ChatColor.DARK_RED.toString(), - ChatColor.WHITE.toString(), - ChatColor.WHITE.toString(), - ChatColor.DARK_GREEN.toString(), - ChatColor.DARK_GREEN.toString(), - }; - - public void onPlayerChat(PlayerChatEvent event) { - Player player = event.getPlayer(); - String message = event.getMessage(); - String split[] = event.getMessage().split(" "); - event.setCancelled(true); - Player[] players = plugin.getServer().getOnlinePlayers(); - //Quotes - if(split[0].startsWith(">")) - quote(player, message, players); - else{ - quakeColors(player, message, players); - } - } - //===================================================================== - //Function: quakeColors - //Input: Player player: The player talking - // String message: The message to apply the effect to - //Output: boolean: If this feature is enabled - //Use: Displays a message in red - //===================================================================== - public static void quakeColors(Player player, String message, Player[] players) - { - //Format the name - String playerName = "<" - + player.getName() + "> "; - - //String color = vUsers.getProfile(player).getColor(); - //Log the chat - log.log(Level.INFO, "<"+player.getName()+"> " + message); - - //Output the message - gmsg(player, playerName + message, players); - - //Loop through the string finding the color codes and inserting them - } - //===================================================================== - //Function: gmsg - //Input: Player sender: The player sending the message - // String msg: The message to be broadcast to all players - //Output: None - //Use: Outputs a message to everybody - //===================================================================== - public static void gmsg(Player sender, String msg, Player[] players){ - /* Disabled for now - if(sender != null && sender.isMuted()) - sender.sendMessage(ChatColor.DARK_RED + "You have been muted."); - */ - - for (Player receiver : players) { - - if (receiver == null) return; - - //if(vUsers.getProfile(receiver) == null) return; - - //Check if the person has the sender ignored - /* Disabled for now - if(sender != null) - if(vUsers.getProfile(receiver).isIgnored(sender)) - return; - */ - String[] message = applyColors(wordWrap(msg)); - for(String out : message) - receiver.sendMessage(out); - } - } - //===================================================================== - //Function: gmsg - //Input: String msg: The message to be broadcast to all players - //Output: None - //Use: Outputs a message to everybody - //===================================================================== - public static void gmsg(String msg){gmsg(null, msg, null);} - public static void gmsg(Player player, String msg){gmsg(player, msg, null);} - //===================================================================== - //Function: wordWrap - //Input: String msg: The message to be wrapped - //Output: String[]: The array of substrings - //Use: Cuts the message apart into whole words short enough to fit - // on one line - //===================================================================== - public static String[] wordWrap(String msg){ - //Split each word apart - ArrayList split = new ArrayList(); - for(String in : msg.split(" ")) - split.add(in); - - //Create an arraylist for the output - ArrayList out = new ArrayList(); - //While i is less than the length of the array of words - while(!split.isEmpty()){ - int len = 0; - - //Create an arraylist to hold individual words - ArrayList words = new ArrayList(); - - //Loop through the words finding their length and increasing - //j, the end point for the sub string - while(!split.isEmpty() && split.get(0) != null && len <= lineLength) - { - int wordLength = msgLength(split.get(0)) + 4; - - //If a word is too long for a line - if(wordLength > lineLength) - { - String[] tempArray = wordCut(len, split.remove(0)); - words.add(tempArray[0]); - split.add(tempArray[1]); - } - - //If the word is not too long to fit - len += wordLength; - if( len < lineLength) - words.add(split.remove(0)); - } - //Merge them and add them to the output array. - out.add(combineSplit(words.toArray(new String[words.size()]), " ") + " " ); - } - //Convert to an array and return - return out.toArray(new String[out.size()]); - } - - //CombineSplit - public static String combineSplit(String[] array, String merge) { - String out = ""; - for(String word : array) - out += word + merge; - return out; - } - - //===================================================================== - //Function: msgLength - //Input: String str: The string to find the length of - //Output: int: The length on the screen of a string - //Use: Finds the length on the screen of a string. Ignores colors. - //===================================================================== - public static int msgLength(String str){ - int length = 0; - //Loop through all the characters, skipping any color characters - //and their following color codes - for(int x = 0; x 0) - length += len; - else - x++; - x++; - } - if(x > str.length()) - x = str.length(); - //Add the substring to the output after cutting it - output[0] = str.substring(0, x); - //Add the last of the string to the output. - output[1] = str.substring(x); - return output; - } - - private static int charLength(char x) - { - if("i.:,;|!".indexOf(x) != -1) - return 2; - else if("l'".indexOf(x) != -1) - return 3; - else if("tI[]".indexOf(x) != -1) - return 4; - else if("fk{}<>\"*()".indexOf(x) != -1) - return 5; - else if("abcdeghjmnopqrsuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ1234567890\\/#?$%-=_+&^".indexOf(x) != -1) - return 6; - else if("@~".indexOf(x) != -1) - return 7; - else if(x==' ') - return 4; - else - return -1; - } - - //===================================================================== - //Function: rainbow - //Input: String msg: The string to colorify - //Output: String: The rainbowed result - //Use: Rainbowifies a string; - //===================================================================== - public static String rainbow(String msg){ - String temp = ""; - int counter=0; - //Loop through the message applying the colors - for(int x=0; x "; - //Log the chat - log.log(Level.INFO, "<"+player.getName()+"> " + message); - //Output the message - gmsg(player, playerName + ChatColor.GREEN + message, players); - } - - //===================================================================== - //Function: applyColors - //Input: String[] message: The lines to be colored - //Output: String[]: The lines, but colorful - //Use: Colors each line - //===================================================================== - public static String[] applyColors(String[] message) - { - if(message != null && message[0] != null && !message[0].isEmpty()){ - //The color to start the line with - String recentColor = ChatColor.WHITE.toString(); - - //Go through each line - int counter = 0; - int i = 0; - boolean taste = false; - boolean xmasparty = false; - - for(String msg: message) - { - //Start the line with the most recent color - String temp = ""; - if(!recentColor.equals("^r") && !recentColor.equals("^x") && recentColor != null) - temp += recentColor; - - //Loop through looking for a color code - for(int x = 0; x< msg.length(); x++) - { - //If the char is a ^ or - if(taste || msg.charAt(x) == '^' - || msg.charAt(x) == ChatColor.DARK_RED.toString().charAt(0)) - { - if(x != msg.length() - 1) - { - //If the following character is a color code - if(colorChange(msg.charAt(x+1)) != null) - { - //Set the most recent color to the new color - recentColor = colorChange(msg.charAt(x+1)); - - //If the color specified is rainbow - if(taste || recentColor.equals("^r")) - { - //Skip the quake code for rainbow - if(recentColor.equals("^r")) - { - x += 2; - } - - //Taste keeps it going with rainbow if there - //are more lines - taste = true; - //Loop through the message applying the colors - while(x < msg.length() && msg.charAt(x) != '^' - && msg.charAt(x) != ChatColor.DARK_RED.toString().charAt(0)) - { - temp += rainbow[i] + msg.charAt(x); - if(msg.charAt(x) != ' ') i++; - if(i == rainbow.length) i = 0; - x++; - } - - //If it reached another color instead of the end - if(x < msg.length() && msg.charAt(x) == '^' - /* Not sure what this check is for - * || x < msg.length() && msg.charAt(x) == ChatColor.DARK_RED.toString().charAt(0)*/) - { - taste = false; - i = 0; - x--; - } - } - if(xmasparty || recentColor.equals("^x")) - { - //Skip the quake code for xmas - if(recentColor.equals("^x")) - { - x += 2; - } - - //xmasparty keeps it going with xmas if there - //are more lines - xmasparty = true; - //Loop through the message applying the colors - while(x < msg.length() && msg.charAt(x) != '^' - && msg.charAt(x) != ChatColor.DARK_RED.toString().charAt(0)) - { - temp += xmas[i] + msg.charAt(x); - - if(msg.charAt(x) != ' ') i++; - if(i == xmas.length) i = 0; - x++; - } - - //If it reached another color instead of the end - if(x < msg.length() && msg.charAt(x) == '^' - || x < msg.length() - && msg.charAt(x) == ChatColor.DARK_RED.toString().charAt(0) ) - { - xmasparty = false; - i = 0; - x--; - } - } - else - - { - //Add the color - temp += recentColor; - //Skip these chars - x++; - } - - //Otherwise ignore it. - } else { - temp += msg.charAt(x); - } - //Insert the character - } else { - temp += msg.charAt(x); - } - } else { - temp += msg.charAt(x); - } - } - //Replace the message with the colorful message - message[counter] = temp; - counter++; - } - } - return message; - } -} diff --git a/vChat/com/bukkit/nossr50/vChat/vUsers.java b/vChat/com/bukkit/nossr50/vChat/vUsers.java deleted file mode 100644 index 6d6016517..000000000 --- a/vChat/com/bukkit/nossr50/vChat/vUsers.java +++ /dev/null @@ -1,552 +0,0 @@ -package com.bukkit.nossr50.vChat; - -import java.io.*; -import java.util.ArrayList; -import java.util.Properties; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.bukkit.entity.*; - -public class vUsers { - private static volatile vUsers instance; - protected static final Logger log = Logger.getLogger("Minecraft"); - String location = "vChat.users"; - public static PlayerList players = new PlayerList(); - private Properties properties = new Properties(); - - //To load - public void load() throws IOException { - properties.load(new FileInputStream(location)); - } - //To save - public void save() { - try { - properties.store(new FileOutputStream(location), null); - }catch(IOException ex) { - } - } - - - public void loadUsers(){ - File theDir = new File(location); - if(!theDir.exists()){ - //properties = new PropertiesFile(location); - FileWriter writer = null; - try { - writer = new FileWriter(location); - writer.write("#Storage place for user information\r\n"); - writer.write("#username:nickname:suffix:tag:ignore,list,names:alias,commands,here\r\n"); - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while creating " + location, e); - } finally { - try { - if (writer != null) { - writer.close(); - } - } catch (IOException e) { - log.log(Level.SEVERE, "Exception while closing writer for " + location, e); - } - } - - } else { - //properties = new PropertiesFile(location); - try { - load(); - } catch (IOException e) { - log.log(Level.SEVERE, "Exception while loading " + location, e); - } - } - } - - //===================================================================== - //Function: addUser - //Input: Player player: The player to create a profile for - //Output: none - //Use: Loads the profile for the specified player - //===================================================================== - public static void addUser(Player player){ - players.addPlayer(player); - } - - //===================================================================== - //Function: removeUser - //Input: Player player: The player to stop following - //Output: none - //Use: Creates the player profile - //===================================================================== - public static void removeUser(Player player){ - players.removePlayer(player); - } - - //===================================================================== - //Function: getProfile - //Input: Player player: The player to find the profile for - //Output: PlayerList.PlayerProfile: The profile - //Use: Gets the player profile - //===================================================================== - public static PlayerList.PlayerProfile getProfile(Player player){ - return players.findProfile(player); - } - - public static vUsers getInstance() { - if (instance == null) { - instance = new vUsers(); - } - return instance; - } - public static void getRow(){ - - } -} -class PlayerList -{ - protected static final Logger log = Logger.getLogger("Minecraft"); - ArrayList players; - - //===================================================================== - //Function: PlayerList - //Input: Player player: The player to create a profile object for - //Output: none - //Use: Initializes the ArrayList - //===================================================================== - public PlayerList() { players = new ArrayList(); } - - //===================================================================== - //Function: addPlayer - //Input: Player player: The player to add - //Output: None - //Use: Add a profile of the specified player - //===================================================================== - public void addPlayer(Player player) - { - players.add(new PlayerProfile(player)); - } - - //===================================================================== - //Function: removePlayer - //Input: Player player: The player to remove - //Output: None - //Use: Remove the profile of the specified player - //===================================================================== - public void removePlayer(Player player) - { - players.remove(findProfile(player)); - } - - //===================================================================== - //Function: findProfile - //Input: Player player: The player to find's profile - //Output: PlayerProfile: The profile of the specified player - //Use: Get the profile for the specified player - //===================================================================== - public PlayerProfile findProfile(Player player) - { - for(PlayerProfile ply : players) - { - if(ply.isPlayer(player)) - return ply; - } - return null; - } - - //===================================================================== - //Class: PlayerProfile - //Use: Encapsulates all commands for player options - //Author: cerevisiae - //===================================================================== - class PlayerProfile - { - protected final Logger log = Logger.getLogger("Minecraft"); - private String playerName, - lastMessage, - nickName, - tag, - suffix, - party; - - private boolean dead, - silent; - - char defaultColor; - - String location = "vChat.users"; - - private ArrayList ignoreList; - //private commandList aliasList; - - static final int EXIT_FAIL = 0, - EXIT_SUCCESS = 1, - EXIT_CONTINUE = 2; - - //===================================================================== - //Function: PlayerProfile - //Input: Player player: The player to create a profile object for - //Output: none - //Use: Loads settings for the player or creates them if they don't - // exist. - //===================================================================== - public PlayerProfile(Player player) - { - //Declare things - playerName = player.getName(); - tag = new String(); - nickName = new String(); - suffix = new String(); - party = new String(); - party = null; - defaultColor = 'f'; - ignoreList = new ArrayList(); - dead = false; - - //Try to load the player and if they aren't found, append them - if(!load()) - addPlayer(); - } - - public boolean load() - { - try { - //Open the user file - FileReader file = new FileReader(location); - BufferedReader in = new BufferedReader(file); - String line = ""; - while((line = in.readLine()) != null) - { - //Find if the line contains the player we want. - String[] character = line.split(":"); - if(!character[0].equals(playerName)){continue;} - - //Get the tag - if(character.length > 1) - tag = character[1]; - //Get the nickname - if(character.length > 2) - nickName = character[2]; - //Get the suffix - if(character.length > 3) - suffix = character[3]; - //Get the color - if(character.length > 4) - defaultColor = character[4].charAt(0); - //Ignore previously ignored players - if(character.length > 5) - { - String[] ignores = character[5].split(","); - if(ignores.length > 0) - { - for(String ignore : ignores) - ignoreList.add(ignore); - } - } - in.close(); - return true; - } - in.close(); - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while reading " - + location + " (Are you sure you formatted it correctly?)", e); - } - return false; - } - - //===================================================================== - // Function: save - // Input: none - // Output: None - // Use: Writes current values of PlayerProfile to disk - // Call this function to save current values - //===================================================================== - public void save() - { - try { - //Open the file - FileReader file = new FileReader(location); - BufferedReader in = new BufferedReader(file); - StringBuilder writer = new StringBuilder(); - String line = ""; - - //While not at the end of the file - while((line = in.readLine()) != null) - { - //Read the line in and copy it to the output it's not the player - //we want to edit - if(!line.split(":")[0].equalsIgnoreCase(playerName)) - { - writer.append(line).append("\r\n"); - - //Otherwise write the new player information - } else { - writer.append(playerName + ":"); - writer.append(tag + ":"); - writer.append(nickName + ":"); - writer.append(suffix + ":"); - writer.append(defaultColor + ":"); - - int i = 0; - for(String ignore : ignoreList) - { - writer.append(ignore); - if(i < ignoreList.size() - 1) - writer.append(","); - } - writer.append("\r\n"); - } - } - in.close(); - //Write the new file - FileWriter out = new FileWriter(location); - out.write(writer.toString()); - out.close(); - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while writing to " + location + " (Are you sure you formatted it correctly?)", e); - } - } - public void addPlayer() - { - try { - //Open the file to write the player - FileWriter file = new FileWriter(location, true); - BufferedWriter out = new BufferedWriter(file); - - //Add the player to the end - out.append(playerName + ":"); - out.append(tag + ":"); - out.append(nickName + ":"); - out.append(suffix + ":"); - out.append(defaultColor + ":"); - - - int i = 0; - for(String ignore : ignoreList) - { - out.append(ignore); - if(i < ignoreList.size() - 1) - out.append(","); - } - out.newLine(); - out.close(); - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while writing to " + location + " (Are you sure you formatted it correctly?)", e); - } - } - - //===================================================================== - //Function: isPlayer - //Input: None - //Output: Player: The player this profile belongs to - //Use: Finds if this profile belongs to a specified player - //===================================================================== - public boolean isPlayer(Player player) - { - return player.getName().equals(playerName); - } - - //===================================================================== - //Function: isIgnored - //Input: Player player: Checks if a player is ignored - //Output: boolean: If they're ignored - //Use: Finds if the specified player is in the ignore list - //===================================================================== - public boolean isIgnored(Player player){ - return ignoreList.contains(player.getName()); - } - - //===================================================================== - //Function: addIgnore - //Input: Player name: The player to ignore - //Output: boolean: If the player was successfully ignored - //Use: Ignores a player. - //===================================================================== - public boolean addIgnore(Player name) - { - if(!ignoreList.contains(name)) - { - ignoreList.add(name.getName()); - save(); - return true; - } - return false; - } - - //===================================================================== - //Function: removeIgnore - //Input: Player name: The player to unignore - //Output: boolean: If the player was successfully unignored - //Use: Stops ignoring a player. - //===================================================================== - public boolean removeIgnore(Player name) - { - if(ignoreList.contains(name.getName())) - { - ignoreList.remove(name.getName()); - save(); - return true; - } - return false; - } - - //===================================================================== - //Function: removeIgnore - //Input: Player name: The player to unignore - //Output: boolean: If the player was successfully unignored - //Use: Stops ignoring a player. - //===================================================================== - public String[] listIgnore() - { - return ignoreList.toArray(new String[ignoreList.size()]); - } - - //===================================================================== - //Function: setTag - //Input: String newTag: The tag to set for the player - //Output: None - //Use: Sets a player tag - //===================================================================== - public void setTag(String newTag) - { - tag = newTag; - save(); - } - //===================================================================== - //Function: getTag - //Input: None - //Output: String: The player tag - //Use: Gets a player tag - //===================================================================== - public String getTag() { return tag; } - - //===================================================================== - //Function: setNick - //Input: String newTag: The nickname to set for the player - //Output: None - //Use: Sets a player nickname - //===================================================================== - public void setNick(String newNick) - { - nickName = newNick; - save(); - } - - public void setSilent(){ - silent = true; - } - public void disableSilent(){ - silent = false; - } - public boolean isSilent(){ - return silent; - } - //Store the player's party - public void setParty(String newParty) - { - party = newParty; - save(); - } - //Retrieve the player's party - public String getParty() {return party;} - //Remove party - public void removeParty() { - party = null; - save(); - } - //Retrieve whether or not the player is in a party - public boolean inParty() { - if(party != null){ - return true; - } else { - return false; - } - } - - //===================================================================== - //Function: getNick - //Input: None - //Output: String: The player nickname - //Use: Gets a player nickname - //===================================================================== - public String getNick() { return nickName; } - - //===================================================================== - //Function: setSuffix - //Input: String newTag: The suffix to set for the player - //Output: None - //Use: Sets a player suffix - //===================================================================== - public void setSuffix(String newSuffix) - { - suffix = newSuffix; - save(); - } - - //===================================================================== - //Function: getSuffix - //Input: None - //Output: String: The player suffix - //Use: Gets a player suffix - //===================================================================== - public String getSuffix() { return suffix; } - - //===================================================================== - //Function: setColor - //Input: String newTag: The color to set for the player - //Output: None - //Use: Sets a player color - //===================================================================== - public void setColor(String newColor) - { - defaultColor = newColor.charAt(0); - save(); - } - - //===================================================================== - //Function: getColor - //Input: None - //Output: String: The player color - //Use: Gets a player color - //===================================================================== - public String getColor() {return vPlayerListener.colorChange(defaultColor);} - - //===================================================================== - //Function: setMessage - //Input: String newName: The name of the player they last messaged - // or recieved a message from. - //Output: None - //Use: Sets a player tag - //===================================================================== - public void setMessage(Player newName){ lastMessage = newName.getName(); } - - //===================================================================== - //Function: getMessage - //Input: None - //Output: String: The player name - //Use: Gets the name of the player they last messaged or recieved - // a message from. - //===================================================================== - public Player getMessage() - { - //if(lastMessage != null) - //We need the bukkit equivalent of this - //return matchPlayer(lastMessage); - return null; - } - - //===================================================================== - //Function: isDead - //Input: None - //Output: boolean: If the player is dead or not - //Use: Gets the player is dead or not. - //===================================================================== - public boolean isDead() {return dead;} - - //===================================================================== - //Function: isDead - //Input: boolean isded: if the player is dead or not. - //Output: None - //Use: Sets if the player is dead or not - //===================================================================== - public void isDead(boolean isded){dead = isded;} - } -} - - - diff --git a/vChat/com/gmail/nossr50/vChat/vChat.java b/vChat/com/gmail/nossr50/vChat/vChat.java deleted file mode 100644 index f97054b9c..000000000 --- a/vChat/com/gmail/nossr50/vChat/vChat.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gmail.nossr50.vChat; - -import java.io.File; -import java.util.HashMap; -import org.bukkit.entity.Player; -import org.bukkit.Server; -import org.bukkit.event.Event.Priority; -import org.bukkit.event.Event; -import org.bukkit.plugin.PluginDescriptionFile; -import org.bukkit.plugin.PluginLoader; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.plugin.PluginManager; - -/** - * vChat for Bukkit - * - * @author nossr50 - * @author cerevisae - */ -public class vChat extends JavaPlugin { - private final vPlayerListener playerListener = new vPlayerListener(this); - private final HashMap debugees = new HashMap(); - - public void onEnable() { - PluginManager pm = getServer().getPluginManager(); - pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Normal, this); - pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener, Priority.Normal, this); - pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this); - PluginDescriptionFile pdfFile = this.getDescription(); - System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" ); - //Load the users file - vUsers.getInstance().loadUsers(); - } - public void onDisable() { - System.out.println("vChat Disabled!"); - } -} \ No newline at end of file diff --git a/vChat/com/gmail/nossr50/vChat/vPlayerListener.java b/vChat/com/gmail/nossr50/vChat/vPlayerListener.java deleted file mode 100644 index 68b44f8cd..000000000 --- a/vChat/com/gmail/nossr50/vChat/vPlayerListener.java +++ /dev/null @@ -1,707 +0,0 @@ -package com.gmail.nossr50.vChat; - -import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerChatEvent; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerListener; -import org.bukkit.plugin.Plugin; -import org.bukkit.ChatColor; -import java.util.ArrayList; -import java.util.logging.Level; -import java.util.logging.Logger; -import com.gmail.nossr50.mcConfig; -import com.gmail.nossr50.mcMMO; - -/** -* Handle events for all Player related events -* @author nossr50 -*/ -public class vPlayerListener extends PlayerListener { - private final vChat plugin; - protected static final Logger log = Logger.getLogger("Minecraft"); - //The length of a text box line in pixels - protected static final int lineLength = 312; - //Characters we will split the line at - protected static final String lineSplit = "/- "; - - public vPlayerListener(vChat instance) { - plugin = instance; - } - public void onPlayerJoin(PlayerJoinEvent event) { - Player player = event.getPlayer(); - vUsers.addUser(player); - player.sendMessage(ChatColor.YELLOW+"This server is running vChat"); - player.sendMessage(ChatColor.YELLOW+"Type /color or /prefix to do some thangs"); - player.sendMessage(ChatColor.DARK_AQUA+"Currently running in Linux"); - player.sendMessage(ChatColor.DARK_AQUA+"Steam community: vminecraft"); - } - public Boolean isPlayer(String playername){ - for(Player derp : plugin.getServer().getOnlinePlayers()){ - if(derp.getName().toLowerCase().equals(playername.toLowerCase())){ - return true; - } - } - return false; - } - //Special Color Codes - protected static final String[] rainbow = new String[] { - ChatColor.DARK_RED.toString(), - ChatColor.RED.toString(), - ChatColor.GOLD.toString(), - ChatColor.YELLOW.toString(), - ChatColor.GREEN.toString(), - ChatColor.DARK_GREEN.toString(), - ChatColor.BLUE.toString(), - ChatColor.DARK_BLUE.toString(), - ChatColor.AQUA.toString(), - ChatColor.DARK_AQUA.toString(), - ChatColor.DARK_PURPLE.toString(), - ChatColor.LIGHT_PURPLE.toString() - }; - protected static final String[] xmas = new String[] { - ChatColor.DARK_RED.toString(), - ChatColor.DARK_RED.toString(), - ChatColor.WHITE.toString(), - ChatColor.WHITE.toString(), - ChatColor.DARK_GREEN.toString(), - ChatColor.DARK_GREEN.toString(), - }; - - public void onPlayerChat(PlayerChatEvent event) { - Player player = event.getPlayer(); - String message = event.getMessage(); - String split[] = event.getMessage().split(" "); - Player[] players = plugin.getServer().getOnlinePlayers(); - Plugin tester = plugin.getServer().getPluginManager().getPlugin("mcMMO"); - if (tester == null) { - } else { - try { - mcMMO plugin = (mcMMO)tester; - if (plugin.isPartyChatToggled(player) || plugin.isAdminChatToggled(player)) { - return; - } else { - if(split[0].startsWith(">")) - quote(player, message, players); - else{ - quakeColors(player, message, players); - } - } - } catch (ClassCastException ex) { - player.sendMessage("There's a plugin disguised as mcMMO! It's not the one I was expecting!"); - } - } - event.setCancelled(true); - } - public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { - Player player = event.getPlayer(); - String message = event.getMessage(); - String split[] = event.getMessage().split(" "); - /* - * COLORS - */ - if(split[0].equalsIgnoreCase("/color")){ - event.setCancelled(true); - if(split.length > 1) - { - vUsers.getProfile(player).setColor(split[1]); - player.sendMessage(ChatColor.RED - + "Default chat color set."); - } else { - player.sendMessage(ChatColor.RED + "You use these color codes like in quake or MW2."); - player.sendMessage(ChatColor.RED + "^4 would make text " + ChatColor.DARK_RED - + "red" + ChatColor.RED + ", ^a would make it " + ChatColor.GREEN - + "light green" + ChatColor.RED + "."); - player.sendMessage( - ChatColor.BLACK + "0" - + ChatColor.DARK_BLUE + "1" - + ChatColor.DARK_GREEN + "2" - + ChatColor.DARK_AQUA + "3" - + ChatColor.DARK_RED + "4" - + ChatColor.DARK_PURPLE + "5" - + ChatColor.GOLD + "6" - + ChatColor.GRAY + "7" - + ChatColor.DARK_GRAY + "8" - + ChatColor.BLUE + "9" - + ChatColor.GREEN + "A" - + ChatColor.AQUA + "B" - + ChatColor.RED + "C" - + ChatColor.LIGHT_PURPLE + "D" - + ChatColor.YELLOW + "E" - + ChatColor.WHITE + "F"); - //+ "^r" + "[R]ainbow") - } - event.setCancelled(true); - } - /* - * PREFIX - */ - if(split[0].equalsIgnoreCase("/prefix")){ - event.setCancelled(true); - if(split.length < 3 && player.isOp()){ - player.sendMessage( ChatColor.RED + "Usage is /prefix [Player] [Color Code] "); - player.sendMessage(ChatColor.RED + "Example: /prefix " + player.getName() + " e ^0[^a<3^0]"); - player.sendMessage( ChatColor.RED + "This would produce a name like... " + ChatColor.BLACK + "[" + ChatColor.GREEN + "<3" +ChatColor.BLACK + "]" + ChatColor.YELLOW + player.getName()); - return; - } - - if(player.isOp()){ - //Check if the player exists - Player other = plugin.getServer().getPlayer(split[1]); - if(other == null) - { - player.sendMessage( ChatColor.RED - + "The player you specified could not be found"); - return; - } - - if(split.length >= 3 && split[2] != null) - { - vUsers.getProfile(other).setPrefix(split[2]); - player.sendMessage(ChatColor.RED + "Name color changed"); - } - if(split.length >= 4 && msgLength(split[3]) > 60) - { - player.sendMessage( ChatColor.RED - + "The prefix you entered was too long."); - return; - } - if(split.length >= 4 && split[3] != null) - { - vUsers.players.findProfile(other).setTag(split[3]); - player.sendMessage(ChatColor.GREEN + "Prefix changed"); - log.log(Level.INFO, player + " changed their prefix to " + split[3]); - } - return; - } - if(split.length < 2){ - player.sendMessage( ChatColor.RED + "Usage is /prefix [Color Code] "); - player.sendMessage(ChatColor.RED + "Example: /prefix " + player.getName() + " e ^0[^a<3^0]"); - player.sendMessage( ChatColor.RED + "This would produce a name like... " + ChatColor.BLACK + "[" + ChatColor.GREEN + "<3" + ChatColor.BLACK + "]" + ChatColor.YELLOW + player.getName()); - return; - } - //Name color - if(split.length >= 2 && split[1] != null){ - vUsers.getProfile(player).setPrefix(split[1]); - player.sendMessage(ChatColor.RED + "Name color changed"); - } - //Prefix - if(split.length >= 3 && split[2] != null){ - //Check if the prefix is too long - if(msgLength(split[1]) > 60) - { - player.sendMessage( ChatColor.RED - + "The prefix you entered was too long."); - return; - } - vUsers.players.findProfile(player).setTag(split[2]); - player.sendMessage(ChatColor.GREEN + "Prefix changed"); - } - } - /* - * SUFFIX - */ - if(split[0].equalsIgnoreCase("/suffix")){ - event.setCancelled(true); - } - if(split[0].equalsIgnoreCase("/rprefix")){ - - if(!player.isOp()){ - player.sendMessage("Op Only"); - } - if(split.length < 2){ - player.sendMessage("Usage is /rprefix "); - return; - } - if(isPlayer(split[1])){ - Player target = plugin.getServer().getPlayer(split[1]); - vUsers.getProfile(target).setPrefix(""); - vUsers.getProfile(target).setTag(""); - } - } - } - //===================================================================== - //Function: quakeColors - //Input: Player player: The player talking - // String message: The message to apply the effect to - //Output: boolean: If this feature is enabled - //Use: Displays a message in red - //===================================================================== - public static void quakeColors(Player player, String message, Player[] players) - { - //Format the name - String playerName = "<" - //Insert their tag - + vUsers.getProfile(player).getTag() - //Color their name - + colorChange(vUsers.getProfile(player).getPrefix().charAt(0)) - //Insert their name - + player.getName() +ChatColor.WHITE+ "> "; - - String color = vUsers.getProfile(player).getColor(); - //Log the chat - log.log(Level.INFO, "<"+player.getName()+"> " + message); - - //Output the message - gmsg(player, playerName + color + message, players); - - //Loop through the string finding the color codes and inserting them - } - //===================================================================== - //Function: gmsg - //Input: Player sender: The player sending the message - // String msg: The message to be broadcast to all players - //Output: None - //Use: Outputs a message to everybody - //===================================================================== - public static void gmsg(Player sender, String msg, Player[] players){ - /* Disabled for now - if(sender != null && sender.isMuted()) - sender.sendMessage(ChatColor.DARK_RED + "You have been muted."); - */ - - for (Player receiver : players) { - - if (receiver == null) return; - - //if(vUsers.getProfile(receiver) == null) return; - - //Check if the person has the sender ignored - /* Disabled for now - if(sender != null) - if(vUsers.getProfile(receiver).isIgnored(sender)) - return; - */ - String[] message = applyColors(wordWrap(msg)); - for(String out : message) - receiver.sendMessage(out); - } - } - //===================================================================== - //Function: gmsg - //Input: String msg: The message to be broadcast to all players - //Output: None - //Use: Outputs a message to everybody - //===================================================================== - public static void gmsg(String msg){gmsg(null, msg, null);} - public static void gmsg(Player player, String msg){gmsg(player, msg, null);} - //===================================================================== - //Function: wordWrap - //Input: String msg: The message to be wrapped - //Output: String[]: The array of substrings - //Use: Cuts the message apart into whole words short enough to fit - // on one line - //===================================================================== - public static String[] wordWrap(String msg){ - //Split each word apart - ArrayList split = new ArrayList(); - for(String in : msg.split(" ")) - split.add(in); - - //Create an arraylist for the output - ArrayList out = new ArrayList(); - //While i is less than the length of the array of words - while(!split.isEmpty()){ - int len = 0; - - //Create an arraylist to hold individual words - ArrayList words = new ArrayList(); - - //Loop through the words finding their length and increasing - //j, the end point for the sub string - while(!split.isEmpty() && split.get(0) != null && len <= lineLength) - { - int wordLength = msgLength(split.get(0)) + 4; - - //If a word is too long for a line - if(wordLength > lineLength) - { - String[] tempArray = wordCut(len, split.remove(0)); - words.add(tempArray[0]); - split.add(tempArray[1]); - } - - //If the word is not too long to fit - len += wordLength; - if( len < lineLength) - words.add(split.remove(0)); - } - //Merge them and add them to the output array. - out.add(combineSplit(words.toArray(new String[words.size()]), " ") + " " ); - } - //Convert to an array and return - return out.toArray(new String[out.size()]); - } - - //CombineSplit - public static String combineSplit(String[] array, String merge) { - String out = ""; - for(String word : array) - out += word + merge; - return out; - } - - //===================================================================== - //Function: msgLength - //Input: String str: The string to find the length of - //Output: int: The length on the screen of a string - //Use: Finds the length on the screen of a string. Ignores colors. - //===================================================================== - public static int msgLength(String str){ - int length = 0; - //Loop through all the characters, skipping any color characters - //and their following color codes - for(int x = 0; x 0) - length += len; - else - x++; - x++; - } - if(x > str.length()) - x = str.length(); - //Add the substring to the output after cutting it - output[0] = str.substring(0, x); - //Add the last of the string to the output. - output[1] = str.substring(x); - return output; - } - - private static int charLength(char x) - { - if("i.:,;|!".indexOf(x) != -1) - return 2; - else if("l'".indexOf(x) != -1) - return 3; - else if("tI[]".indexOf(x) != -1) - return 4; - else if("fk{}<>\"*()".indexOf(x) != -1) - return 5; - else if("abcdeghjmnopqrsuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ1234567890\\/#?$%-=_+&^".indexOf(x) != -1) - return 6; - else if("@~".indexOf(x) != -1) - return 7; - else if(x==' ') - return 4; - else - return -1; - } - - //===================================================================== - //Function: rainbow - //Input: String msg: The string to colorify - //Output: String: The rainbowed result - //Use: Rainbowifies a string; - //===================================================================== - public static String rainbow(String msg){ - String temp = ""; - int counter=0; - //Loop through the message applying the colors - for(int x=0; x "; - //Log the chat - log.log(Level.INFO, "<"+player.getName()+"> " + message); - //Output the message - gmsg(player, playerName + ChatColor.GREEN + message, players); - } - - //===================================================================== - //Function: applyColors - //Input: String[] message: The lines to be colored - //Output: String[]: The lines, but colorful - //Use: Colors each line - //===================================================================== - public static String[] applyColors(String[] message) - { - if(message != null && message[0] != null && !message[0].isEmpty()){ - //The color to start the line with - String recentColor = ChatColor.WHITE.toString(); - - //Go through each line - int counter = 0; - int i = 0; - boolean taste = false; - boolean xmasparty = false; - - for(String msg: message) - { - //Start the line with the most recent color - String temp = ""; - if(!recentColor.equals("^r") && !recentColor.equals("^x") && recentColor != null) - temp += recentColor; - - //Loop through looking for a color code - for(int x = 0; x< msg.length(); x++) - { - //If the char is a ^ or - if(taste || msg.charAt(x) == '^' - || msg.charAt(x) == ChatColor.DARK_RED.toString().charAt(0)) - { - if(x != msg.length() - 1) - { - //If the following character is a color code - if(colorChange(msg.charAt(x+1)) != null) - { - //Set the most recent color to the new color - recentColor = colorChange(msg.charAt(x+1)); - - //If the color specified is rainbow - if(taste || recentColor.equals("^r")) - { - /* - //Skip the quake code for rainbow - if(recentColor.equals("^r")) - { - x += 2; - } - - //Taste keeps it going with rainbow if there - //are more lines - taste = true; - //Loop through the message applying the colors - while(x < msg.length() && msg.charAt(x) != '^' - && msg.charAt(x) != ChatColor.DARK_RED.toString().charAt(0)) - { - temp += rainbow[i] + msg.charAt(x); - if(msg.charAt(x) != ' ') i++; - if(i == rainbow.length) i = 0; - x++; - } - - //If it reached another color instead of the end - if(x < msg.length() && msg.charAt(x) == '^') - { - taste = false; - i = 0; - x--; - } - */ - } - if(xmasparty || recentColor.equals("^x")) - { - /* - //Skip the quake code for xmas - if(recentColor.equals("^x")) - { - x += 2; - } - - //xmasparty keeps it going with xmas if there - //are more lines - xmasparty = true; - //Loop through the message applying the colors - while(x < msg.length() && msg.charAt(x) != '^' - && msg.charAt(x) != ChatColor.DARK_RED.toString().charAt(0)) - { - temp += xmas[i] + msg.charAt(x); - - if(msg.charAt(x) != ' ') i++; - if(i == xmas.length) i = 0; - x++; - } - - //If it reached another color instead of the end - if(x < msg.length() && msg.charAt(x) == '^' - || x < msg.length() - && msg.charAt(x) == ChatColor.DARK_RED.toString().charAt(0) ) - { - xmasparty = false; - i = 0; - x--; - } - */ - } - else - - { - //Add the color - temp += recentColor; - //Skip these chars - x++; - } - - //Otherwise ignore it. - } else { - temp += msg.charAt(x); - } - //Insert the character - } else { - temp += msg.charAt(x); - } - } else { - temp += msg.charAt(x); - } - } - //Replace the message with the colorful message - message[counter] = temp; - counter++; - } - } - return message; - } -} diff --git a/vChat/com/gmail/nossr50/vChat/vUsers.java b/vChat/com/gmail/nossr50/vChat/vUsers.java deleted file mode 100644 index 3d2ec54bb..000000000 --- a/vChat/com/gmail/nossr50/vChat/vUsers.java +++ /dev/null @@ -1,570 +0,0 @@ -package com.gmail.nossr50.vChat; - -import java.io.*; -import java.util.ArrayList; -import java.util.Properties; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.bukkit.entity.*; - -public class vUsers { - private static volatile vUsers instance; - protected static final Logger log = Logger.getLogger("Minecraft"); - String location = "vChat.users"; - public static PlayerList players = new PlayerList(); - private Properties properties = new Properties(); - - //To load - public void load() throws IOException { - properties.load(new FileInputStream(location)); - } - //To save - public void save() { - try { - properties.store(new FileOutputStream(location), null); - }catch(IOException ex) { - } - } - - - public void loadUsers(){ - File theDir = new File(location); - if(!theDir.exists()){ - //properties = new PropertiesFile(location); - FileWriter writer = null; - try { - writer = new FileWriter(location); - writer.write("#Storage place for user information\r\n"); - writer.write("#username:nickname:suffix:tag:ignore,list,names:alias,commands,here\r\n"); - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while creating " + location, e); - } finally { - try { - if (writer != null) { - writer.close(); - } - } catch (IOException e) { - log.log(Level.SEVERE, "Exception while closing writer for " + location, e); - } - } - - } else { - //properties = new PropertiesFile(location); - try { - load(); - } catch (IOException e) { - log.log(Level.SEVERE, "Exception while loading " + location, e); - } - } - } - - //===================================================================== - //Function: addUser - //Input: Player player: The player to create a profile for - //Output: none - //Use: Loads the profile for the specified player - //===================================================================== - public static void addUser(Player player){ - players.addPlayer(player); - } - - //===================================================================== - //Function: removeUser - //Input: Player player: The player to stop following - //Output: none - //Use: Creates the player profile - //===================================================================== - public static void removeUser(Player player){ - players.removePlayer(player); - } - - //===================================================================== - //Function: getProfile - //Input: Player player: The player to find the profile for - //Output: PlayerList.PlayerProfile: The profile - //Use: Gets the player profile - //===================================================================== - public static PlayerList.PlayerProfile getProfile(Player player){ - return players.findProfile(player); - } - - public static vUsers getInstance() { - if (instance == null) { - instance = new vUsers(); - } - return instance; - } - public static void getRow(){ - - } -} -class PlayerList -{ - protected static final Logger log = Logger.getLogger("Minecraft"); - ArrayList players; - - //===================================================================== - //Function: PlayerList - //Input: Player player: The player to create a profile object for - //Output: none - //Use: Initializes the ArrayList - //===================================================================== - public PlayerList() { players = new ArrayList(); } - - //===================================================================== - //Function: addPlayer - //Input: Player player: The player to add - //Output: None - //Use: Add a profile of the specified player - //===================================================================== - public void addPlayer(Player player) - { - players.add(new PlayerProfile(player)); - } - - //===================================================================== - //Function: removePlayer - //Input: Player player: The player to remove - //Output: None - //Use: Remove the profile of the specified player - //===================================================================== - public void removePlayer(Player player) - { - players.remove(findProfile(player)); - } - - //===================================================================== - //Function: findProfile - //Input: Player player: The player to find's profile - //Output: PlayerProfile: The profile of the specified player - //Use: Get the profile for the specified player - //===================================================================== - public PlayerProfile findProfile(Player player) - { - for(PlayerProfile ply : players) - { - if(ply.isPlayer(player)) - return ply; - } - return null; - } - - //===================================================================== - //Class: PlayerProfile - //Use: Encapsulates all commands for player options - //Author: cerevisiae - //===================================================================== - class PlayerProfile - { - protected final Logger log = Logger.getLogger("Minecraft"); - private String playerName, - lastMessage, - nickName, - tag, - suffix, - prefix, - party; - - private boolean dead, - silent; - - char defaultColor; - - String location = "vChat.users"; - - private ArrayList ignoreList; - //private commandList aliasList; - - static final int EXIT_FAIL = 0, - EXIT_SUCCESS = 1, - EXIT_CONTINUE = 2; - - //===================================================================== - //Function: PlayerProfile - //Input: Player player: The player to create a profile object for - //Output: none - //Use: Loads settings for the player or creates them if they don't - // exist. - //===================================================================== - public PlayerProfile(Player player) - { - //Declare things - playerName = player.getName(); - tag = new String(); - nickName = new String(); - suffix = new String(); - prefix = new String(); - party = new String(); - party = null; - defaultColor = 'f'; - ignoreList = new ArrayList(); - dead = false; - - //Try to load the player and if they aren't found, append them - if(!load()) - addPlayer(); - } - - public boolean load() - { - try { - //Open the user file - FileReader file = new FileReader(location); - BufferedReader in = new BufferedReader(file); - String line = ""; - while((line = in.readLine()) != null) - { - //Find if the line contains the player we want. - String[] character = line.split(":"); - if(!character[0].equals(playerName)){continue;} - - //Get the tag - if(character.length > 1) - tag = character[1]; - //Get the nickname - if(character.length > 2) - nickName = character[2]; - //Get the suffix - if(character.length > 3) - suffix = character[3]; - //Get the color - if(character.length > 4) - defaultColor = character[4].charAt(0); - //Ignore previously ignored players - if(character.length > 5) - { - String[] ignores = character[5].split(","); - if(ignores.length > 0) - { - for(String ignore : ignores) - ignoreList.add(ignore); - } - } - in.close(); - return true; - } - in.close(); - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while reading " - + location + " (Are you sure you formatted it correctly?)", e); - } - return false; - } - - //===================================================================== - // Function: save - // Input: none - // Output: None - // Use: Writes current values of PlayerProfile to disk - // Call this function to save current values - //===================================================================== - public void save() - { - try { - //Open the file - FileReader file = new FileReader(location); - BufferedReader in = new BufferedReader(file); - StringBuilder writer = new StringBuilder(); - String line = ""; - - //While not at the end of the file - while((line = in.readLine()) != null) - { - //Read the line in and copy it to the output it's not the player - //we want to edit - if(!line.split(":")[0].equalsIgnoreCase(playerName)) - { - writer.append(line).append("\r\n"); - - //Otherwise write the new player information - } else { - writer.append(playerName + ":"); - writer.append(tag + ":"); - writer.append(nickName + ":"); - writer.append(suffix + ":"); - writer.append(defaultColor + ":"); - writer.append(prefix + ":"); - - int i = 0; - for(String ignore : ignoreList) - { - writer.append(ignore); - if(i < ignoreList.size() - 1) - writer.append(","); - } - writer.append("\r\n"); - } - } - in.close(); - //Write the new file - FileWriter out = new FileWriter(location); - out.write(writer.toString()); - out.close(); - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while writing to " + location + " (Are you sure you formatted it correctly?)", e); - } - } - public void addPlayer() - { - try { - //Open the file to write the player - FileWriter file = new FileWriter(location, true); - BufferedWriter out = new BufferedWriter(file); - - //Add the player to the end - out.append(playerName + ":"); - out.append("" + ":"); - out.append(nickName + ":"); - out.append(suffix + ":"); - out.append("f" + ":"); - out.append("f" + ":"); - - - int i = 0; - for(String ignore : ignoreList) - { - out.append(ignore); - if(i < ignoreList.size() - 1) - out.append(","); - } - out.newLine(); - out.close(); - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while writing to " + location + " (Are you sure you formatted it correctly?)", e); - } - } - - //===================================================================== - //Function: isPlayer - //Input: None - //Output: Player: The player this profile belongs to - //Use: Finds if this profile belongs to a specified player - //===================================================================== - public boolean isPlayer(Player player) - { - return player.getName().equals(playerName); - } - - //===================================================================== - //Function: isIgnored - //Input: Player player: Checks if a player is ignored - //Output: boolean: If they're ignored - //Use: Finds if the specified player is in the ignore list - //===================================================================== - public boolean isIgnored(Player player){ - return ignoreList.contains(player.getName()); - } - - //===================================================================== - //Function: addIgnore - //Input: Player name: The player to ignore - //Output: boolean: If the player was successfully ignored - //Use: Ignores a player. - //===================================================================== - public boolean addIgnore(Player name) - { - if(!ignoreList.contains(name)) - { - ignoreList.add(name.getName()); - save(); - return true; - } - return false; - } - - //===================================================================== - //Function: removeIgnore - //Input: Player name: The player to unignore - //Output: boolean: If the player was successfully unignored - //Use: Stops ignoring a player. - //===================================================================== - public boolean removeIgnore(Player name) - { - if(ignoreList.contains(name.getName())) - { - ignoreList.remove(name.getName()); - save(); - return true; - } - return false; - } - - //===================================================================== - //Function: removeIgnore - //Input: Player name: The player to unignore - //Output: boolean: If the player was successfully unignored - //Use: Stops ignoring a player. - //===================================================================== - public String[] listIgnore() - { - return ignoreList.toArray(new String[ignoreList.size()]); - } - - //===================================================================== - //Function: setTag - //Input: String newTag: The tag to set for the player - //Output: None - //Use: Sets a player tag - //===================================================================== - public void setTag(String newTag) - { - tag = newTag; - save(); - } - //===================================================================== - //Function: getTag - //Input: None - //Output: String: The player tag - //Use: Gets a player tag - //===================================================================== - public String getTag() { return tag; } - - //===================================================================== - //Function: setNick - //Input: String newTag: The nickname to set for the player - //Output: None - //Use: Sets a player nickname - //===================================================================== - public void setNick(String newNick) - { - nickName = newNick; - save(); - } - - public void setSilent(){ - silent = true; - } - public void disableSilent(){ - silent = false; - } - public boolean isSilent(){ - return silent; - } - //Store the player's party - public void setParty(String newParty) - { - party = newParty; - save(); - } - //Retrieve the player's party - public String getParty() {return party;} - //Remove party - public void removeParty() { - party = null; - save(); - } - //Retrieve whether or not the player is in a party - public boolean inParty() { - if(party != null){ - return true; - } else { - return false; - } - } - - //===================================================================== - //Function: getNick - //Input: None - //Output: String: The player nickname - //Use: Gets a player nickname - //===================================================================== - public String getNick() { return nickName; } - - //===================================================================== - //Function: setSuffix - //Input: String newTag: The suffix to set for the player - //Output: None - //Use: Sets a player suffix - //===================================================================== - public void setSuffix(String newSuffix) - { - suffix = newSuffix; - save(); - } - - //===================================================================== - //Function: getSuffix - //Input: None - //Output: String: The player suffix - //Use: Gets a player suffix - //===================================================================== - public String getSuffix() { return suffix; } - - public void setPrefix(String newPrefix) - { - prefix = newPrefix; - save(); - } - - public String getPrefix() { - if(prefix != null && !prefix.equals("") && !prefix.equals("null")){ - return prefix; - } else { - return "f"; - } - } - - //===================================================================== - //Function: setColor - //Input: String newTag: The color to set for the player - //Output: None - //Use: Sets a player color - //===================================================================== - public void setColor(String newColor) - { - defaultColor = newColor.charAt(0); - save(); - } - - //===================================================================== - //Function: getColor - //Input: None - //Output: String: The player color - //Use: Gets a player color - //===================================================================== - public String getColor() {return vPlayerListener.colorChange(defaultColor);} - - //===================================================================== - //Function: setMessage - //Input: String newName: The name of the player they last messaged - // or recieved a message from. - //Output: None - //Use: Sets a player tag - //===================================================================== - public void setMessage(Player newName){ lastMessage = newName.getName(); } - - //===================================================================== - //Function: getMessage - //Input: None - //Output: String: The player name - //Use: Gets the name of the player they last messaged or recieved - // a message from. - //===================================================================== - public Player getMessage() - { - //if(lastMessage != null) - //We need the bukkit equivalent of this - //return matchPlayer(lastMessage); - return null; - } - - //===================================================================== - //Function: isDead - //Input: None - //Output: boolean: If the player is dead or not - //Use: Gets the player is dead or not. - //===================================================================== - public boolean isDead() {return dead;} - - //===================================================================== - //Function: isDead - //Input: boolean isded: if the player is dead or not. - //Output: None - //Use: Sets if the player is dead or not - //===================================================================== - public void isDead(boolean isded){dead = isded;} - } -} - - - diff --git a/vChat/plugin.yml b/vChat/plugin.yml deleted file mode 100644 index e7935da25..000000000 --- a/vChat/plugin.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: vChat -main: com.gmail.nossr50.vChat.vChat -version: 1.0 \ No newline at end of file diff --git a/vPlayersOnline/com/bukkit/nossr50/vPlayersOnline/vBlockListener.java b/vPlayersOnline/com/bukkit/nossr50/vPlayersOnline/vBlockListener.java deleted file mode 100644 index 02e016bef..000000000 --- a/vPlayersOnline/com/bukkit/nossr50/vPlayersOnline/vBlockListener.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.bukkit.nossr50.vPlayersOnline; - - -import org.bukkit.Material; -import org.bukkit.event.block.BlockCanBuildEvent; -import org.bukkit.event.block.BlockListener; -import org.bukkit.event.block.BlockPhysicsEvent; - -/** - * vPlayersOnline block listener - * @author nossr50 - */ -public class vBlockListener extends BlockListener { - private final vPlayersOnline plugin; - - public vBlockListener(final vPlayersOnline plugin) { - this.plugin = plugin; - } - - //put all Block related code here -} - diff --git a/vPlayersOnline/com/bukkit/nossr50/vPlayersOnline/vPlayerListener.java b/vPlayersOnline/com/bukkit/nossr50/vPlayersOnline/vPlayerListener.java deleted file mode 100644 index 95dbb8e7e..000000000 --- a/vPlayersOnline/com/bukkit/nossr50/vPlayersOnline/vPlayerListener.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.bukkit.nossr50.vPlayersOnline; - -import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerChatEvent; -import org.bukkit.event.player.PlayerEvent; -import org.bukkit.event.player.PlayerListener; -import org.bukkit.ChatColor; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Handle events for all Player related events - * @author nossr50 - */ -public class vPlayerListener extends PlayerListener { - private final vPlayersOnline plugin; - protected static final Logger log = Logger.getLogger("Minecraft"); - - public vPlayerListener(vPlayersOnline instance) { - plugin = instance; - } - //Function to count the players - public int playerCount(){ - Player players[] = plugin.getServer().getOnlinePlayers(); - int x = 0; - for(Player hurrdurr: players){ - x++; - } - return x; - } - - //Message to be sent when a player joins - public void onPlayerJoin(PlayerEvent event) { - Player player = event.getPlayer(); - //English Version - player.sendMessage(ChatColor.GREEN + "There are " + playerCount() + " players online."); - } - //Message to be sent when a player uses /list - public void onPlayerCommand(PlayerChatEvent event) { - String[] split = event.getMessage().split(" "); - Player player = event.getPlayer(); - if(split[0].equalsIgnoreCase("/list") || split[0].equalsIgnoreCase("/who")){ - event.setCancelled(true); - String tempList = ""; - int x = 0; - for(Player p : plugin.getServer().getOnlinePlayers()) - { - if(p != null && x+1 == playerCount()){ - tempList+= p.getName(); - x++; - } - if(p != null && x < playerCount()){ - tempList+= p.getName() +", "; - x++; - } - } - //Output the player list - player.sendMessage(ChatColor.RED + "Player List ("+ChatColor.WHITE + tempList +ChatColor.RED+")"); - player.sendMessage(ChatColor.RED + "Total Players: " + ChatColor.GREEN + playerCount()); - } - } -} diff --git a/vPlayersOnline/com/bukkit/nossr50/vPlayersOnline/vPlayersOnline.java b/vPlayersOnline/com/bukkit/nossr50/vPlayersOnline/vPlayersOnline.java deleted file mode 100644 index 771fa99ef..000000000 --- a/vPlayersOnline/com/bukkit/nossr50/vPlayersOnline/vPlayersOnline.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.bukkit.nossr50.vPlayersOnline; - -import java.io.File; -import java.util.HashMap; -import org.bukkit.event.player.*; -import org.bukkit.Server; -import org.bukkit.event.Event.Priority; -import org.bukkit.event.Event; -import org.bukkit.plugin.PluginDescriptionFile; -import org.bukkit.plugin.PluginLoader; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.plugin.PluginManager; -import org.bukkit.entity.Player; - -/** - * vPlayersOnline for Bukkit - * - * @author nossr50 - */ -public class vPlayersOnline extends JavaPlugin { - private final vPlayerListener playerListener = new vPlayerListener(this); - private final vBlockListener blockListener = new vBlockListener(this); - private final HashMap debugees = new HashMap(); - private final String name = "vPlayersOnline"; - - public vPlayersOnline(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) { - super(pluginLoader, instance, desc, folder, plugin, cLoader); - } - - - - public void onEnable() { - PluginManager pm = getServer().getPluginManager(); - pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this); - pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this); - pm.registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this); - //Displays a message when plugin is loaded - PluginDescriptionFile pdfFile = this.getDescription(); - System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" ); - } - public void onDisable() { - System.out.println("vPlayersOnline disabled."); - } -} diff --git a/vPlayersOnline/com/gmail/nossr50/vPlayersOnline/Config.java b/vPlayersOnline/com/gmail/nossr50/vPlayersOnline/Config.java deleted file mode 100644 index 783744ee2..000000000 --- a/vPlayersOnline/com/gmail/nossr50/vPlayersOnline/Config.java +++ /dev/null @@ -1,78 +0,0 @@ - -package com.gmail.nossr50.vPlayersOnline; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.util.Properties; - -/** - * - * @author Mark Tolley - */ -class Config -{ - public static String name; - private static final String CONFIG_FILE = "plugins/vPlayersOnline/vplayersonline.properties"; - - public static Properties loadConfig() { - Properties config = defaultConfig(); - - try { - config.load(new FileReader(CONFIG_FILE)); - } - catch (FileNotFoundException e) { - System.out.println(name + ": Creating configuration file..."); - config = defaultConfig(); - writeConfig(); - } - catch (IOException e) { - System.out.println(name + "s: An error occured reading configuration, using defaults."); - config = defaultConfig(); - } - - return config; - } - - private static void writeConfig() { - File f = new File(CONFIG_FILE); - if (f.getParentFile().mkdirs()) { - try { - FileWriter fw = new FileWriter(f); - fw.write("# vPlayersOnline configuration file\r\n"); - fw.write("# \r\n"); - fw.write("# Color codes:\r\n"); - fw.write("# &0 black\r\n"); - fw.write("# &1 dark blue &9 blue\r\n"); - fw.write("# &2 dark green &a green\r\n"); - fw.write("# &3 dark aqua &b aqua\r\n"); - fw.write("# &4 dark red &c red\r\n"); - fw.write("# &5 dark pink &d pink\r\n"); - fw.write("# &6 dark yellow &e yellow\r\n"); - fw.write("# &7 light grey &f white\r\n"); - fw.write("# &8 dark grey\r\n"); - fw.write("\r\n"); - fw.write("PlayersOnline = &aThere are %d players online\r\n"); - fw.write("PlayerList = &cPlayer List &f(%s)\r\n"); - fw.write("TotalPlayers = &cTotal Players: &a%d\r\n"); - fw.write("#1POnline = &aThere is 1 player online.\r\n"); - fw.write("1POnline = &cNo one else is online.\r\n"); - fw.close(); - } - catch (IOException e) { - e.printStackTrace(); - } - } - } - - private static Properties defaultConfig() { - Properties config = new Properties(); - config.setProperty("PlayersOnline", "&aThere are %d players online"); - config.setProperty("PlayerList", "&cPlayer List &f(%s)"); - config.setProperty("TotalPlayers", "&cTotal Players: &a%d"); - config.setProperty("1POnline", "&cNo one else is online."); - return config; - } -} diff --git a/vPlayersOnline/com/gmail/nossr50/vPlayersOnline/vPlayerListener.java b/vPlayersOnline/com/gmail/nossr50/vPlayersOnline/vPlayerListener.java deleted file mode 100644 index 31e1cedd3..000000000 --- a/vPlayersOnline/com/gmail/nossr50/vPlayersOnline/vPlayerListener.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.gmail.nossr50.vPlayersOnline; - -import java.util.Properties; -import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerChatEvent; -import org.bukkit.event.player.PlayerEvent; -import org.bukkit.event.player.PlayerListener; -import org.bukkit.ChatColor; - -/** - * Handle events for all Player related events - * @author nossr50 - */ -public class vPlayerListener extends PlayerListener { - private final vPlayersOnline plugin; - private final String PlayersOnline; - private final String PlayerList; - private final String TotalPlayers; - private final String _1POnline; - - public vPlayerListener(vPlayersOnline instance, Properties config) { - plugin = instance; - PlayersOnline = parseColors(config.getProperty("PlayersOnline")); - PlayerList = parseColors(config.getProperty("PlayerList")); - TotalPlayers = parseColors(config.getProperty("TotalPlayers")); - _1POnline = parseColors(config.getProperty("1POnline")); - } - - //Function to count the players - private int playerCount(){ - Player players[] = plugin.getServer().getOnlinePlayers(); - return players.length; - } - - private static String parseColors(String str) { - final StringBuilder sb = new StringBuilder(); - - for (int i = 0; i < str.length(); ++i) { - char c = str.charAt(i); - - if (c == '&') { - char next = str.charAt(i+1); - if (next == '&') { - // literal & - ++i; - } else { - try { - int color = Integer.parseInt(String.valueOf(next), 16); - sb.append(ChatColor.getByCode(color)); - ++i; - continue; - } catch (NumberFormatException e) {} - } - } - - sb.append(c); - } - - return sb.toString(); - } - - //Message to be sent when a player joins - @Override - public void onPlayerJoin(PlayerEvent event) { - Player player = event.getPlayer(); - int count = playerCount(); - - if (count == 1) { - player.sendMessage(_1POnline); - } else { - player.sendMessage(String.format(PlayersOnline, count)); - } - } - - //Message to be sent when a player uses /list - @Override - public void onPlayerCommandPreprocess(PlayerChatEvent event) { - String[] split = event.getMessage().split(" "); - Player player = event.getPlayer(); - if(split[0].equalsIgnoreCase("/list") || split[0].equalsIgnoreCase("/who")){ - event.setCancelled(true); - - int count = playerCount(); - String tempList = ""; - int x = 0; - for(Player p : plugin.getServer().getOnlinePlayers()) - { - if(p != null && x+1 >= count){ - tempList+= p.getName(); - x++; - } - if(p != null && x < count){ - tempList+= p.getName() +", "; - x++; - } - } - //Output the player list - player.sendMessage(String.format(PlayerList, tempList)); - player.sendMessage(String.format(TotalPlayers, count)); - } - } - -} diff --git a/vPlayersOnline/com/gmail/nossr50/vPlayersOnline/vPlayersOnline.java b/vPlayersOnline/com/gmail/nossr50/vPlayersOnline/vPlayersOnline.java deleted file mode 100644 index 10b30a69a..000000000 --- a/vPlayersOnline/com/gmail/nossr50/vPlayersOnline/vPlayersOnline.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.gmail.nossr50.vPlayersOnline; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.util.Properties; -import org.bukkit.event.Event.Priority; -import org.bukkit.event.Event; -import org.bukkit.plugin.PluginDescriptionFile; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.plugin.PluginManager; - -/** - * vPlayersOnline for Bukkit - * - * @author nossr50 - */ -public class vPlayersOnline extends JavaPlugin { - private PluginDescriptionFile pdfFile; - - private vPlayerListener playerListener; - - public void onLoad() { - - } - - public void onEnable() { - pdfFile = this.getDescription(); - Config.name = pdfFile.getName(); - - Properties config = Config.loadConfig(); - playerListener = new vPlayerListener(this, config); - - PluginManager pm = getServer().getPluginManager(); - pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this); - pm.registerEvent(Event.Type.PLAYER_DROP_ITEM, playerListener, Priority.Normal, this); - pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this); - pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener, Priority.Normal, this); - - //Displays a message when plugin is loaded - System.out.println(Config.name + " version " + pdfFile.getVersion() + " is enabled!"); - } - public void onDisable() { - System.out.println(Config.name + " disabled."); - } -} diff --git a/vPlayersOnline/plugin.yml b/vPlayersOnline/plugin.yml deleted file mode 100644 index 8f0b3ddce..000000000 --- a/vPlayersOnline/plugin.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: vPlayersOnline -main: com.gmail.nossr50.vPlayersOnline.vPlayersOnline -version: 1.5 \ No newline at end of file diff --git a/vStopFire/com/bukkit/nossr50/vStopFire/vBlockListener.java b/vStopFire/com/bukkit/nossr50/vStopFire/vBlockListener.java deleted file mode 100644 index 832f02892..000000000 --- a/vStopFire/com/bukkit/nossr50/vStopFire/vBlockListener.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.bukkit.nossr50.vStopFire; - -import org.bukkit.Material; -import org.bukkit.event.block.BlockCanBuildEvent; -import org.bukkit.event.block.BlockIgniteEvent; -import org.bukkit.event.block.BlockListener; -import org.bukkit.event.block.BlockPhysicsEvent; -import org.bukkit.block.Block; - -/** - * vStopFire block listener - * @author nossr50 - */ -public class vBlockListener extends BlockListener { - private final vStopFire plugin; - - public vBlockListener(final vStopFire plugin) { - this.plugin = plugin; - } - //This should stop fire from spreading but still allow players to light stuff up with flint and steel - public void onBlockIgnite(BlockIgniteEvent event) { - String cause = event.getCause().toString(); - if(cause.equals("SPREAD")) - event.setCancelled(true); - if(!cause.equals("FLINT_AND_STEEL")) - event.setCancelled(true); - } -} diff --git a/vStopFire/com/bukkit/nossr50/vStopFire/vPlayerListener.java b/vStopFire/com/bukkit/nossr50/vStopFire/vPlayerListener.java deleted file mode 100644 index 02030198b..000000000 --- a/vStopFire/com/bukkit/nossr50/vStopFire/vPlayerListener.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.bukkit.nossr50.vStopFire; - -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerChatEvent; -import org.bukkit.event.player.PlayerEvent; -import org.bukkit.event.player.PlayerListener; -import org.bukkit.event.player.PlayerMoveEvent; - -/** - * Handle events for all Player related events - * @author nossr50 - */ -public class vPlayerListener extends PlayerListener { - private final vStopFire plugin; - - public vPlayerListener(vStopFire instance) { - plugin = instance; - } - - - //Insert Player related code here -} - diff --git a/vStopFire/com/bukkit/nossr50/vStopFire/vStopFire.java b/vStopFire/com/bukkit/nossr50/vStopFire/vStopFire.java deleted file mode 100644 index 5c8e94f67..000000000 --- a/vStopFire/com/bukkit/nossr50/vStopFire/vStopFire.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.bukkit.nossr50.vStopFire; - -import java.io.File; -import org.bukkit.Server; -import org.bukkit.event.Event.Priority; -import org.bukkit.event.Event; -import org.bukkit.plugin.PluginDescriptionFile; -import org.bukkit.plugin.PluginLoader; -import org.bukkit.plugin.java.JavaPlugin; - -/** - * vStopFire for Bukkit - * - * @author nossr50 - */ -public class vStopFire extends JavaPlugin { - private final vPlayerListener playerListener = new vPlayerListener(this); - private final vBlockListener blockListener = new vBlockListener(this); - private final String name = "vStopFire"; - - public void onEnable() { - getServer().getPluginManager().registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Priority.Normal, this); - PluginDescriptionFile pdfFile = this.getDescription(); - System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" ); - } - public void onDisable() { - System.out.println("vStopFire disabled!"); - } -} diff --git a/vStopFire/plugin.yml b/vStopFire/plugin.yml deleted file mode 100644 index 1d9d1f7be..000000000 --- a/vStopFire/plugin.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: vStopFire -main: com.bukkit.nossr50.vStopFire.vStopFire -version: 1.1 \ No newline at end of file diff --git a/woolplus/com/gmail/nossr50/woolplus/wBlockListener.java b/woolplus/com/gmail/nossr50/woolplus/wBlockListener.java deleted file mode 100644 index 393ea16d1..000000000 --- a/woolplus/com/gmail/nossr50/woolplus/wBlockListener.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.gmail.nossr50.woolplus; -import org.bukkit.Material; -import org.bukkit.event.block.BlockListener; - -public class wBlockListener extends BlockListener { - private final woolplus plugin; - - public wBlockListener(final woolplus plugin) { - this.plugin = plugin; - } -} \ No newline at end of file diff --git a/woolplus/com/gmail/nossr50/woolplus/wPlayerListener.java b/woolplus/com/gmail/nossr50/woolplus/wPlayerListener.java deleted file mode 100644 index 92ef19889..000000000 --- a/woolplus/com/gmail/nossr50/woolplus/wPlayerListener.java +++ /dev/null @@ -1,306 +0,0 @@ -package com.gmail.nossr50.woolplus; - -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerChatEvent; -import org.bukkit.event.player.PlayerEvent; -import org.bukkit.event.player.PlayerItemEvent; -import org.bukkit.event.player.PlayerListener; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.material.MaterialData; - -public class wPlayerListener extends PlayerListener { - private final woolplus plugin; - - public wPlayerListener(woolplus instance) { - plugin = instance; - } - public void onPlayerItem(PlayerItemEvent event) { - Player player = event.getPlayer(); - ItemStack item = event.getPlayer().getItemInHand(); - Block block = event.getBlockClicked(); - if(block != null && item != null && isDye(item) && isWool(block)){ - dyeWool(block, item, player); - } - } - public boolean isDye(ItemStack item){ - int type = item.getTypeId(); - if(type == 351 || type == 352){ - return true; - } else { - return false; - } - } - public boolean isWool(Block block){ - int type = block.getTypeId(); - if(type == 35){ - return true; - } else { - return false; - } - } - public boolean isBoneMeal(ItemStack item){ - int type = item.getTypeId(); - short durability = item.getDurability(); - if(type == 351 && durability == 15){ - return true; - } else { - return false; - } - } - public void consumeDye(short type, Player player){ - ItemStack[] inventory = player.getInventory().getContents(); - for (ItemStack x : inventory){ - if(x.getTypeId() == 351 && x.getDurability() == type){ - if(x.getAmount() == 1){ - x.setAmount(0); - x.setTypeId(0); - } - if(x.getAmount() > 1) - x.setAmount(x.getAmount() - 1); - player.getInventory().setContents(inventory); - } - } - player.updateInventory(); - } - public boolean isLightColoredWool(byte wool){ - if(wool == 4 || wool == 5 || wool == 6 || wool == 9 || wool == 2 || wool == 3){ - return true; - } else { - return false; - } - } - public void dyeWool(Block block, ItemStack item, Player player){ - MaterialData mdye = item.getData(); - byte dye = mdye.getData(); - byte wool = block.getData(); - short durability = item.getDurability(); - /* - * WOOL LIGHTENING - */ - //Black dyes everything you know! - if(durability == 0 && wool != 15){ - block.setData((byte) 15); - consumeDye(item.getDurability(), player); - return; - } - //BLACK -> GRAY - if(wool == 15 && isBoneMeal(item)){ - block.setData((byte) 7); - consumeDye(item.getDurability(), player); - return; - } - //GRAY -> LGRAY - if(wool == 7 && isBoneMeal(item)){ - block.setData((byte) 8); - consumeDye(item.getDurability(), player); - return; - } - //BROWN -> GRAY - if(wool == 12 && isBoneMeal(item)){ - block.setData((byte) 7); - consumeDye(item.getDurability(), player); - return; - } - //LGRAY -> WHITE - if(wool == 8 && isBoneMeal(item)){ - block.setData((byte) 0); - consumeDye(item.getDurability(), player); - return; - } - //RED (14) -> PINK (6) - if(wool == 14 && isBoneMeal(item)){ - block.setData((byte) 6); - consumeDye(item.getDurability(), player); - return; - } - //GREEN13 -> LIME5 - if(wool == 13 && isBoneMeal(item)){ - block.setData((byte) 5); - consumeDye(item.getDurability(), player); - return; - } - //BLUE11 -> CYAN9 - if(wool == 11 && isBoneMeal(item)){ - block.setData((byte) 9); - consumeDye(item.getDurability(), player); - return; - } - //CYAN9 -> LIGHT BLUE3 - if(wool == 9 && isBoneMeal(item)){ - block.setData((byte) 3); - consumeDye(item.getDurability(), player); - return; - } - //PURPLE10 -> MAGENTA2 - if(wool == 10 && isBoneMeal(item)){ - block.setData((byte) 2); - consumeDye(item.getDurability(), player); - return; - } - /* - * WOOL COMBINATIONS - */ - //Red + Yellow = Orange - //If wool is red, dye is yellow - if(wool == 14 && durability == 11){ - block.setData((byte) 1); - consumeDye(item.getDurability(), player); - return; - } - //If wool is yellow, dye is red - if(wool == 4 && durability == 1){ - block.setData((byte) 1); - consumeDye(item.getDurability(), player); - return; - } - //Lapis + Green = Cyan - //if wool is Lapis/Blue, dye is green - if(wool == 11 && durability == 2){ - block.setData((byte) 9); - consumeDye(item.getDurability(), player); - return; - } - //if wool is Green, dye is lapis - if(wool == 13 && durability == 4){ - block.setData((byte) 9); - consumeDye(item.getDurability(), player); - return; - } - //Red + Lapis = Purple - //if wool is Red, dye is Lapis - if(wool == 14 && durability == 4){ - block.setData((byte) 10); - consumeDye(item.getDurability(), player); - return; - } - //if wool is Lapis/Blue, dye is red - if(wool == 11 && durability == 1){ - block.setData((byte) 10); - consumeDye(item.getDurability(), player); - return; - } - //Purple + Pink = Magenta - //if wool is Purple, dye is pink - if(wool == 10 && durability == 9){ - block.setData((byte) 2); - consumeDye(item.getDurability(), player); - return; - } - //if wool is pink, dye is purple - if(wool == 6 && durability == 5){ - block.setData((byte) 2); - consumeDye(item.getDurability(), player); - return; - } - /* - * REGULAR DYE SECTION - */ - if(wool == 0){ - //orange - if(durability == 14){ - block.setData((byte) 1); - consumeDye(item.getDurability(), player); - return; - } - //magenta - if (durability == 13){ - block.setData((byte) 2); - consumeDye(item.getDurability(), player); - return; - } - //light blue - if(durability == 12){ - block.setData((byte) 3); - consumeDye(item.getDurability(), player); - return; - } - //yellow - if(durability == 11){ - block.setData((byte) 4); - consumeDye(item.getDurability(), player); - return; - } - //lime - if(durability == 10){ - block.setData((byte) 5); - consumeDye(item.getDurability(), player); - return; - } - //pink - if(durability == 9){ - block.setData((byte) 6); - consumeDye(item.getDurability(), player); - return; - } - //gray - if(durability == 8){ - block.setData((byte) 7); - consumeDye(item.getDurability(), player); - return; - } - //light gray - if(durability == 7){ - block.setData((byte) 8); - consumeDye(item.getDurability(), player); - return; - } - //cyan - if(durability == 6){ - block.setData((byte) 9); - consumeDye(item.getDurability(), player); - return; - } - //purple - if(durability == 5){ - block.setData((byte) 10); - consumeDye(item.getDurability(), player); - return; - } - //lapis or blue - if(durability == 4){ - block.setData((byte) 11); - consumeDye(item.getDurability(), player); - return; - } - //coco or brown - if(durability == 3){ - block.setData((byte) 12); - consumeDye(item.getDurability(), player); - return; - } - //green - if(durability == 2){ - block.setData((byte) 13); - consumeDye(item.getDurability(), player); - return; - } - //red - if(durability == 1){ - block.setData((byte) 14); - consumeDye(item.getDurability(), player); - return; - } - } - /* - * BROWN CONVERSION - */ - if(!isBoneMeal(item) && durability != 0 && wool != 12){ - block.setData((byte) 12); - consumeDye(item.getDurability(), player); - return; - } - if(isBoneMeal(item) && wool != 0 && !isLightColoredWool(wool)){ - block.setData((byte) 7); - consumeDye(item.getDurability(), player); - return; - } - if(isBoneMeal(item) && wool != 0 && isLightColoredWool(wool)){ - block.setData((byte) 0); - consumeDye(item.getDurability(), player); - return; - } - } -} diff --git a/woolplus/com/gmail/nossr50/woolplus/woolplus.java b/woolplus/com/gmail/nossr50/woolplus/woolplus.java deleted file mode 100644 index b0156bb34..000000000 --- a/woolplus/com/gmail/nossr50/woolplus/woolplus.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.gmail.nossr50.woolplus; - -import java.io.File; -import org.bukkit.Server; -import org.bukkit.event.Event.Priority; -import org.bukkit.event.Event; -import org.bukkit.plugin.PluginDescriptionFile; -import org.bukkit.plugin.PluginLoader; -import org.bukkit.plugin.java.JavaPlugin; - -/** - * Wool Plus for Bukkit - * - * @author nossr50 - */ -public class woolplus extends JavaPlugin { - private final wPlayerListener playerListener = new wPlayerListener(this); - private final wBlockListener blockListener = new wBlockListener(this); - private final String name = "Wool Plus"; - - public void onEnable() { - getServer().getPluginManager().registerEvent(Event.Type.PLAYER_ITEM, playerListener, Priority.Normal, this); - PluginDescriptionFile pdfFile = this.getDescription(); - System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" ); - } - public void onDisable() { - System.out.println("Wool Plus disabled!"); - } -} \ No newline at end of file diff --git a/woolplus/plugin.yml b/woolplus/plugin.yml deleted file mode 100644 index 38d657dce..000000000 --- a/woolplus/plugin.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: woolplus -main: com.gmail.nossr50.woolplus.woolplus -version: 1.2 \ No newline at end of file