Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualShippou

Posted 11 December 2012 - 12:42 PM

Stack Trace: ( Points To Line 273 )
13:30:29 [INFO] RLS0812 issued server command: /mc_web item withdraw
13:30:29 [INFO] STONE 99 STONE|99
13:30:29 [INFO] GRASS 2 GRASS|2
13:30:29 [INFO] SAND 67 SAND|67
13:30:29 [SEVERE] null
org.bukkit.command.CommandException: Unhandled exception executing command 'mc_w
eb' in plugin MC_Web v1.0E-8
		at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46)
		at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:18
6)
		at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:5
02)
		at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.
java:985)
		at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:903)
		at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:858)
		at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:44)
		at net.minecraft.server.NetworkManager.b(NetworkManager.java:290)
		at net.minecraft.server.NetServerHandler.d(NetServerHandler.java:113)
		at net.minecraft.server.ServerConnection.b(SourceFile:39)
		at net.minecraft.server.DedicatedServerConnection.b(SourceFile:30)
		at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:595)
		at net.minecraft.server.DedicatedServer.r(DedicatedServer.java:222)
		at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:493)
		at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:426)
		at net.minecraft.server.ThreadServerApplication.run(SourceFile:856)
Caused by: java.lang.NullPointerException
		at Me.RLS0812.MC_Web.Main.onCommand(Main.java:273)
		at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
		... 15 more
13:30:32 [INFO] RLS0812 lost connection: disconnect.quitting
13:30:32 [INFO] Connection reset


Source Code:

package Me.RLS0812.MC_Web;


import java.io.BufferedReader
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.util.Random;
import com.iCo6.system.Account;
import com.iCo6.system.Accounts;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin{
	// Import Money
	boolean Imoney;
	// Export Money
	boolean Emoney;
	// Maximum Money Per Day
	int Mmoney; // Not Used In Plugin - Server Side Use Only
	// Money Name
	String Money_Name;
	// Import Items
	boolean Iitems;
	// Export Items
	boolean Eitems;
	// Maximum Items Per Day
	int Mitems; // Not Used In Plugin - Server Side Use Only
	// Banned Player Deletion
	boolean Bplayer;
	public void onEnable(){
		File file = new File("MC_Web");
		if (!file.exists()){
			System.out.println("\n** MC_Web First Time Set Up **");
			file.mkdir();
			File file1 = new File ("MC_Web/Users");
			file1.mkdir();
			File cfg = new File ("MC_Web/MC_Web.config");
			try {
				cfg.createNewFile();
				FileWriter fileWritter = new FileWriter("MC_Web/MC_Web.config",true);
				BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
				bufferWritter.write("Allow_Money_Export=true\n");
				bufferWritter.write("Allow_Money_Import=true\n");
				bufferWritter.write("Max_Money_Per_Day=-1\n");
				bufferWritter.write("Money_Name=Gold\n");
				bufferWritter.write("Allow_Material_Export=true\n");
				bufferWritter.write("Allow_Material_Import=true\n");
				bufferWritter.write("Max_Material_Per_Day=-1\n");
				bufferWritter.write("Auto_Delete_Banned_Player_Account=false\n");
				bufferWritter.close();
			}
			catch (IOException e) {
				System.out.println("\n** MC_Web Error Creating Config File **");
			}}
			System.out.println("\n** MC_Web Loading Config **");
			File cfg = new File ("MC_Web/MC_Web.config");
			if (!cfg.exists()){
				System.out.println("\n** MC_Web Error Finding Config File - Creatinng New Config File **");
				try {
					cfg.createNewFile();
					FileWriter fileWritter = new FileWriter("MC_Web/MC_Web.config",true);
					BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
					bufferWritter.write("Allow_Money_Export=true\n");
					bufferWritter.write("Allow_Money_Import=true\n");
					bufferWritter.write("Max_Money_Per_Day=-1\n");
					bufferWritter.write("Money_Name=Gold\n");
					bufferWritter.write("Allow_Material_Export=true\n");
					bufferWritter.write("Allow_Material_Import=true\n");
					bufferWritter.write("Max_Material_Per_Day=-1\n");
					bufferWritter.write("Auto_Delete_Banned_Player_Account=false\n");
					bufferWritter.close();
			}
				catch (IOException e) {
					System.out.println("\n** MC_Web Error Creating New Config File **");
				}}
			  
				try{
					  FileInputStream fstream = new FileInputStream("MC_Web/MC_Web.config");
					  DataInputStream is = new DataInputStream(fstream);
					  BufferedReader br = new BufferedReader(new InputStreamReader(is));
					  String Line;
					  int x = 0;
					  // If you add config lines, change X and case
					  while (x != 8)	{
						  Line = br.readLine().trim();
						  String[] Temp = Line.split("=");
						  switch(x){
						  case 0:Imoney = Boolean.parseBoolean(Temp[1]);break;
						  case 1:Emoney = Boolean.parseBoolean(Temp[1]);break;
						  case 2:Mmoney = Integer.parseInt(Temp[1]);break;
						  case 3:Money_Name = Temp[1];break;
						  case 4:Iitems = Boolean.parseBoolean(Temp[1]);break;
						  case 5:Eitems = Boolean.parseBoolean(Temp[1]);break;
						  case 6:Mitems = Integer.parseInt(Temp[1]);break;
						  case 7:Bplayer = Boolean.parseBoolean(Temp[1]);break;
						  default:System.out.println("\n** MC_Web Error - Extra Config Lines **\n ** Line " + (x+1) + ": " + Line + " **");
						  }
						  x += 1;
						  }
					  is.close();
					  br.close();
						}
				catch (Exception e){
					  System.out.println(e + "\n");
					  System.out.println("\n** MC_Web Error Setting Configurations From File  **");
					  }}
	public void onDisable(){}
// #### Book Mark 1 ####
	// TODO Deposit $ - Withdraw $
	// TODO Banned Player Deletion
	public void error(Player x){
		x.sendMessage(ChatColor.GOLD + "** MC_Web Help **");
		x.sendMessage(ChatColor.GOLD + "@ Account Create <Password_Here> <NickName_Here>");
		x.sendMessage(ChatColor.GOLD + "This will create an account for you");
		x.sendMessage(ChatColor.GOLD + "@ Account Reset <Password_Here>");
		x.sendMessage(ChatColor.GOLD + "This will reset your password");
		x.sendMessage(ChatColor.GOLD + "@ Item Deposit");
		x.sendMessage(ChatColor.GOLD + "This will deposit all the same type of items as in your hand,\n from your inventory to your 'in box' ");
		x.sendMessage(ChatColor.GOLD + "@ Item Withdraw");
		x.sendMessage(ChatColor.GOLD + "This will deposit all items from your 'out box', to your inventory");
		x.sendMessage(ChatColor.GOLD + "@ Money Deposit <Ammount_Here>");
		x.sendMessage(ChatColor.GOLD + "This will deposit money into your account ");
		x.sendMessage(ChatColor.GOLD + "@ Money Withdraw <Ammount_Here>");
		x.sendMessage(ChatColor.GOLD + "This will withdraw money from your account");
	}
	public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
	  
		if (sender instanceof Player) {
		if (cmd.getName().equalsIgnoreCase("mc_web")){
			   Player pl = (Player) sender;
			   String Name = pl.getName();
			   Account account = new Accounts().get(Name);
			Double Money = account.getHoldings().getBalance();
			DecimalFormat Trun = new DecimalFormat("0.00");
			   if (args.length < 2  ){
				   error(pl);
			   }
// Account Creation
			   else if ( args[0].equalsIgnoreCase("account") && args[1].equalsIgnoreCase("create") ){
				   if ( args.length < 3 || args.length < 4){
					   error(pl);
				   }
				   else{
				   File file = new File("MC_Web/Users/" + Name);
				   if (file.exists() ){
					   pl.sendMessage(ChatColor.AQUA + "Error - Account '" + Name + "' allready exists");
				   }
				   else{
					   file.mkdir();
					   String Temp = "MC_Web/Users/" + Name;
					   File file1 = new File(Temp + "/Blarg.acc");
					   File file2 = new File(Temp + "/Account.acc");
					   File file3 = new File(Temp + "/In.box");
					   File file4 = new File(Temp + "/Out.box");
					   try{
						   file1.createNewFile();
						   file2.createNewFile();
						   FileWriter fileWritter1 = new FileWriter("MC_Web/Users/" + Name +"/Account.acc",false);
						   BufferedWriter bufferWritter1 = new BufferedWriter(fileWritter1);
						   bufferWritter1.write("0.0");
						   bufferWritter1.close();
						   file3.createNewFile();
						   file4.createNewFile();
						   FileWriter fileWritter = new FileWriter(Temp + "/Blarg.acc",true);
						   BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
						   bufferWritter.write(args[3] + "\n");
						   bufferWritter.write(args[2] + "\n");
						   Random rand = new Random();
						   bufferWritter.write("" + rand.nextInt(999999999) + "\n"); // User Number
						   bufferWritter.close();
						   pl.sendMessage(ChatColor.GOLD + "Account Created");
						   pl.sendMessage(ChatColor.GOLD + "Username: " + Name);
						   pl.sendMessage(ChatColor.GOLD + "Password: " + args[2]);
						   pl.sendMessage(ChatColor.GOLD + "Nickname: " + args[3]);
						   System.out.println("\n ** MC_Web User Account Created '" + Name + " '");
					   }
					   catch (IOException e) {
						   pl.sendMessage(ChatColor.AQUA + "Error - Account Failed To Create");
						   System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Create");
					   }}}}
// Password Reset
			   else if(args[0].equalsIgnoreCase("account") && args[1].equalsIgnoreCase("reset")){
				   if ( args.length < 3 ){
					   error(pl);
				   }
				   else{
					   boolean pf = true;
					   String pnn = "not_me";
					   String pwr = args[2];
					Random rand = new Random();
					   String pwn = "" + rand.nextInt(999999999);
					   try{
						 FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name +"/Blarg.acc");
						DataInputStream is = new DataInputStream(fstream);
						BufferedReader br = new BufferedReader(new InputStreamReader(is));
						pnn = br.readLine();
						is.close();
						br.close();
					   }
					   catch (IOException e){
						   pl.sendMessage(ChatColor.AQUA + "Error - Account Failed To Reset");
						   System.out.println(e);
						   System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Reset - Failure Type 1");
						   pf = false;
					   }
					   try{
						   if (pf){
							   FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Blarg.acc",false);
								  BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
								  bufferWritter.write(pnn +"\n");
								  bufferWritter.write(pwr +"\n");
								  bufferWritter.write(pwn +"\n"); // User Number
								  bufferWritter.close();
								  pl.sendMessage(ChatColor.GOLD + "Account Updated");
								  System.out.println("\n ** MC_Web User Account Updated '" + Name + " '");
						   }
					   }
					   catch (IOException e){
						   pl.sendMessage(ChatColor.AQUA + "Error - Account Failed To Reset");
						   System.out.println(e);
						   System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Reset - Failure Type 2");
					   }}}
// Item Deposit
			   else if(args[0].equalsIgnoreCase("item") && args[1].equalsIgnoreCase("deposit") ){
				   if (Eitems == true){
				   ItemStack It[] = pl.getInventory().getContents();
				   ItemStack Ih  = pl.getItemInHand();
				   String Mih = "" + Ih.getType(); // Deposit Type
				   int Amm = 0; // Deposit Amount
				   if (Ih.getType() != Material.AIR){
					   for (int i = 0; i < It.length; i++){
						   if ( It[i] != null  ){
							   if ( Ih.getType() == It[i].getType()){
							   Amm += It[i].getAmount();
							   pl.getInventory().setItem( i , new ItemStack(Material.AIR, 0) );
								}}}
					   try{
						   FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/In.box",true);
						   BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
						   bufferWritter.write(Mih + "|" + Amm + "\n");
						   bufferWritter.close();
						   pl.sendMessage(ChatColor.GOLD + "Items Deposited");
					   }
					   catch (IOException e){
						   pl.sendMessage(ChatColor.AQUA + "Error - Deposit Failed");
						   System.out.println(e);
						   System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Deposit Items");
					   }}
				   else{
					   pl.sendMessage(ChatColor.AQUA + "Error - You must be hoding something.");
				   }}
				   else{
					   pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to deposit items");
				   }}
// Item Withdraw
			   else if (args[0].equalsIgnoreCase("item") && args[1].equalsIgnoreCase("withdraw") ){
				   if (Iitems == true){
				   try{
					 FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name + "/Out.box");
					DataInputStream is = new DataInputStream(fstream);
					BufferedReader br = new BufferedReader(new InputStreamReader(is));
					String Line;
					while ( ( Line = br.readLine().trim() ) != null )	{ // This throws NULL POINTER after done with file
					  String[] Temp = Line.split("\\|");
					  System.out.println(Temp[0] + " " + Temp[1] + " " + Line);
					  ItemStack item = new ItemStack(Material.getMaterial(Temp[0]),Integer.parseInt(Temp[1]));
					  pl.getLocation().getWorld().dropItemNaturally(pl.getLocation(), item);
					  
					}
					  is.close();
					  br.close();
					FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Out.box",false);
					BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
					bufferWritter.write("");
					bufferWritter.close();
					pl.sendMessage(ChatColor.GOLD + "Items Withdrawn");
				   }
				   catch (IOException e){
						pl.sendMessage(ChatColor.AQUA + "Error - Item Withdraw");
						System.out.println(e);
						System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Withdraw Items");
					}}
				   else{
					   pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to withdraw items");
				   }}
// Money Deposit
			   else if ( args[0].equalsIgnoreCase("money") && args[1].equalsIgnoreCase("deposit") ){
				   if (args.length < 3  ){
						  error(pl);
					  }
				   else{
					   if(Emoney == true){
						   double Mon = 0.;
						   double Bal = 0.;
						   boolean pf = true;
						   try{
							 Mon = Double.valueOf(args[2]).doubleValue();
							 FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name +"/Account.acc");
							   DataInputStream is = new DataInputStream(fstream);
							   BufferedReader br = new BufferedReader(new InputStreamReader(is));
							   Bal = Double.valueOf(br.readLine()).doubleValue();
							   is.close();
							   br.close();
							   }
						   catch (Exception e){
							   pf = false;
							   pl.sendMessage(ChatColor.AQUA + "Error - Invalad Number Conversion");
						   }
						   if ( pf ){
						   int Enough_Money = Double.compare(Mon,Money);
						   if (Enough_Money < 0 ) {
							   try{
								   Bal += Mon;
								   FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Account.acc",false);
										 BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
										 bufferWritter.write(Bal +"\n");
								bufferWritter.close();
								account.getHoldings().subtract(Mon);
								   pl.sendMessage(ChatColor.GOLD + ""+ Mon + " " + Money_Name + " has been deposited");
									 pl.sendMessage(ChatColor.GOLD + "Account balance is now " + Trun.format(Bal) + " " + Money_Name);
							   }
							   catch (IOException e){
									  pl.sendMessage(ChatColor.AQUA + "Error - Making Deposit");
									  System.out.println("\n ** MC_Web Error - '" + Name + "' deposit failed");
								  }}
						   else{
							   pl.sendMessage(ChatColor.AQUA + "Too Much To Deposit: " + Trun.format(Mon) + " " + Money_Name);
							   }}
						   }
					   else{
						   pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to deposit money");
					   }}}
// Money Withdraw  
			   else if ( args[0].equalsIgnoreCase("money") && args[1].equalsIgnoreCase("withdraw") ){
				   if (args.length < 3  ){
						  error(pl);
					  }
				   else{
					   if(Imoney == true){
						   double Mon = 0.;
						   double Bal = 0.;
						   boolean pf = true;
						   try{
							   Mon = Double.valueOf(args[2]).doubleValue();
							   FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name +"/Account.acc");
							   DataInputStream is = new DataInputStream(fstream);
							   BufferedReader br = new BufferedReader(new InputStreamReader(is));
							   Bal = Double.valueOf(br.readLine().trim() ).doubleValue();
							   is.close();
							   br.close();
							  
						   }
						   catch (Exception e){
							   pf = false;
							   pl.sendMessage(ChatColor.AQUA + "Error - Invalad Number Conversion");
						   }
						   if ( pf ){
							   int Enough_Money = Double.compare(Bal,Mon);
							   if (Enough_Money > 0  ){
								   try{
										  Bal -= Mon;
										  FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Account.acc",false);
												BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
												bufferWritter.write(Bal +"\n");
									   bufferWritter.close();
									   account.getHoldings().add(Mon);
									   pl.sendMessage(ChatColor.GOLD + ""+ Mon + " " + Money_Name + " has been withdrawn");
									  pl.sendMessage(ChatColor.GOLD + "Account balance is now " + Trun.format(Bal) + " " + Money_Name);
									  }
									  catch (IOException e){
											 pl.sendMessage(ChatColor.AQUA + "Error - Making Withdraw");
											 System.out.println("\n ** MC_Web Error - '" + Name + "' withdraw failed");
							   }}
							   else{
								   pl.sendMessage(ChatColor.AQUA + "Too Much To Withdraw: " + Trun.format(Mon) + " " + Money_Name);
							   }
						   }}
					   else{
						   pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to withdraw money");
					   }}}
// Catch
			   else{
				   error(pl);
			   }}}
		return true;
	}}

#4Shippou

Posted 11 December 2012 - 12:37 PM

Stack Trace: ( Line 273 )
13:30:29 [INFO] RLS0812 issued server command: /mc_web item withdraw
13:30:29 [INFO] STONE 99 STONE|99
13:30:29 [INFO] GRASS 2 GRASS|2
13:30:29 [INFO] SAND 67 SAND|67
13:30:29 [SEVERE] null
org.bukkit.command.CommandException: Unhandled exception executing command 'mc_w
eb' in plugin MC_Web v1.0E-8
		at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46)
		at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:18
6)
		at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:5
02)
		at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.
java:985)
		at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:903)
		at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:858)
		at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:44)
		at net.minecraft.server.NetworkManager.b(NetworkManager.java:290)
		at net.minecraft.server.NetServerHandler.d(NetServerHandler.java:113)
		at net.minecraft.server.ServerConnection.b(SourceFile:39)
		at net.minecraft.server.DedicatedServerConnection.b(SourceFile:30)
		at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:595)
		at net.minecraft.server.DedicatedServer.r(DedicatedServer.java:222)
		at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:493)
		at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:426)
		at net.minecraft.server.ThreadServerApplication.run(SourceFile:856)
Caused by: java.lang.NullPointerException
		at Me.RLS0812.MC_Web.Main.onCommand(Main.java:273)
		at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
		... 15 more
13:30:32 [INFO] RLS0812 lost connection: disconnect.quitting
13:30:32 [INFO] Connection reset


Source Code:

package Me.RLS0812.MC_Web;


import java.io.BufferedReader
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.util.Random;
import com.iCo6.system.Account;
import com.iCo6.system.Accounts;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin{
	// Import Money
	boolean Imoney;
	// Export Money
	boolean Emoney;
	// Maximum Money Per Day
	int Mmoney; // Not Used In Plugin - Server Side Use Only
	// Money Name
	String Money_Name;
	// Import Items
	boolean Iitems;
	// Export Items
	boolean Eitems;
	// Maximum Items Per Day
	int Mitems; // Not Used In Plugin - Server Side Use Only
	// Banned Player Deletion
	boolean Bplayer;
	public void onEnable(){
		File file = new File("MC_Web");
		if (!file.exists()){
			System.out.println("\n** MC_Web First Time Set Up **");
			file.mkdir();
			File file1 = new File ("MC_Web/Users");
			file1.mkdir();
			File cfg = new File ("MC_Web/MC_Web.config");
			try {
				cfg.createNewFile();
				FileWriter fileWritter = new FileWriter("MC_Web/MC_Web.config",true);
				BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
				bufferWritter.write("Allow_Money_Export=true\n");
				bufferWritter.write("Allow_Money_Import=true\n");
				bufferWritter.write("Max_Money_Per_Day=-1\n");
				bufferWritter.write("Money_Name=Gold\n");
				bufferWritter.write("Allow_Material_Export=true\n");
				bufferWritter.write("Allow_Material_Import=true\n");
				bufferWritter.write("Max_Material_Per_Day=-1\n");
				bufferWritter.write("Auto_Delete_Banned_Player_Account=false\n");
				bufferWritter.close();
			}
			catch (IOException e) {
				System.out.println("\n** MC_Web Error Creating Config File **");
			}}
			System.out.println("\n** MC_Web Loading Config **");
			File cfg = new File ("MC_Web/MC_Web.config");
			if (!cfg.exists()){
				System.out.println("\n** MC_Web Error Finding Config File - Creatinng New Config File **");
				try {
					cfg.createNewFile();
					FileWriter fileWritter = new FileWriter("MC_Web/MC_Web.config",true);
					BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
					bufferWritter.write("Allow_Money_Export=true\n");
					bufferWritter.write("Allow_Money_Import=true\n");
					bufferWritter.write("Max_Money_Per_Day=-1\n");
					bufferWritter.write("Money_Name=Gold\n");
					bufferWritter.write("Allow_Material_Export=true\n");
					bufferWritter.write("Allow_Material_Import=true\n");
					bufferWritter.write("Max_Material_Per_Day=-1\n");
					bufferWritter.write("Auto_Delete_Banned_Player_Account=false\n");
					bufferWritter.close();
			}
				catch (IOException e) {
					System.out.println("\n** MC_Web Error Creating New Config File **");
				}}
			  
				try{
					  FileInputStream fstream = new FileInputStream("MC_Web/MC_Web.config");
					  DataInputStream is = new DataInputStream(fstream);
					  BufferedReader br = new BufferedReader(new InputStreamReader(is));
					  String Line;
					  int x = 0;
					  // If you add config lines, change X and case
					  while (x != 8)	{
						  Line = br.readLine().trim();
						  String[] Temp = Line.split("=");
						  switch(x){
						  case 0:Imoney = Boolean.parseBoolean(Temp[1]);break;
						  case 1:Emoney = Boolean.parseBoolean(Temp[1]);break;
						  case 2:Mmoney = Integer.parseInt(Temp[1]);break;
						  case 3:Money_Name = Temp[1];break;
						  case 4:Iitems = Boolean.parseBoolean(Temp[1]);break;
						  case 5:Eitems = Boolean.parseBoolean(Temp[1]);break;
						  case 6:Mitems = Integer.parseInt(Temp[1]);break;
						  case 7:Bplayer = Boolean.parseBoolean(Temp[1]);break;
						  default:System.out.println("\n** MC_Web Error - Extra Config Lines **\n ** Line " + (x+1) + ": " + Line + " **");
						  }
						  x += 1;
						  }
					  is.close();
					  br.close();
						}
				catch (Exception e){
					  System.out.println(e + "\n");
					  System.out.println("\n** MC_Web Error Setting Configurations From File  **");
					  }}
	public void onDisable(){}
// #### Book Mark 1 ####
	// TODO Deposit $ - Withdraw $
	// TODO Banned Player Deletion
	public void error(Player x){
		x.sendMessage(ChatColor.GOLD + "** MC_Web Help **");
		x.sendMessage(ChatColor.GOLD + "@ Account Create <Password_Here> <NickName_Here>");
		x.sendMessage(ChatColor.GOLD + "This will create an account for you");
		x.sendMessage(ChatColor.GOLD + "@ Account Reset <Password_Here>");
		x.sendMessage(ChatColor.GOLD + "This will reset your password");
		x.sendMessage(ChatColor.GOLD + "@ Item Deposit");
		x.sendMessage(ChatColor.GOLD + "This will deposit all the same type of items as in your hand,\n from your inventory to your 'in box' ");
		x.sendMessage(ChatColor.GOLD + "@ Item Withdraw");
		x.sendMessage(ChatColor.GOLD + "This will deposit all items from your 'out box', to your inventory");
		x.sendMessage(ChatColor.GOLD + "@ Money Deposit <Ammount_Here>");
		x.sendMessage(ChatColor.GOLD + "This will deposit money into your account ");
		x.sendMessage(ChatColor.GOLD + "@ Money Withdraw <Ammount_Here>");
		x.sendMessage(ChatColor.GOLD + "This will withdraw money from your account");
	}
	public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
	  
		if (sender instanceof Player) {
		if (cmd.getName().equalsIgnoreCase("mc_web")){
			   Player pl = (Player) sender;
			   String Name = pl.getName();
			   Account account = new Accounts().get(Name);
			Double Money = account.getHoldings().getBalance();
			DecimalFormat Trun = new DecimalFormat("0.00");
			   if (args.length < 2  ){
				   error(pl);
			   }
// Account Creation
			   else if ( args[0].equalsIgnoreCase("account") && args[1].equalsIgnoreCase("create") ){
				   if ( args.length < 3 || args.length < 4){
					   error(pl);
				   }
				   else{
				   File file = new File("MC_Web/Users/" + Name);
				   if (file.exists() ){
					   pl.sendMessage(ChatColor.AQUA + "Error - Account '" + Name + "' allready exists");
				   }
				   else{
					   file.mkdir();
					   String Temp = "MC_Web/Users/" + Name;
					   File file1 = new File(Temp + "/Blarg.acc");
					   File file2 = new File(Temp + "/Account.acc");
					   File file3 = new File(Temp + "/In.box");
					   File file4 = new File(Temp + "/Out.box");
					   try{
						   file1.createNewFile();
						   file2.createNewFile();
						   FileWriter fileWritter1 = new FileWriter("MC_Web/Users/" + Name +"/Account.acc",false);
						   BufferedWriter bufferWritter1 = new BufferedWriter(fileWritter1);
						   bufferWritter1.write("0.0");
						   bufferWritter1.close();
						   file3.createNewFile();
						   file4.createNewFile();
						   FileWriter fileWritter = new FileWriter(Temp + "/Blarg.acc",true);
						   BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
						   bufferWritter.write(args[3] + "\n");
						   bufferWritter.write(args[2] + "\n");
						   Random rand = new Random();
						   bufferWritter.write("" + rand.nextInt(999999999) + "\n"); // User Number
						   bufferWritter.close();
						   pl.sendMessage(ChatColor.GOLD + "Account Created");
						   pl.sendMessage(ChatColor.GOLD + "Username: " + Name);
						   pl.sendMessage(ChatColor.GOLD + "Password: " + args[2]);
						   pl.sendMessage(ChatColor.GOLD + "Nickname: " + args[3]);
						   System.out.println("\n ** MC_Web User Account Created '" + Name + " '");
					   }
					   catch (IOException e) {
						   pl.sendMessage(ChatColor.AQUA + "Error - Account Failed To Create");
						   System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Create");
					   }}}}
// Password Reset
			   else if(args[0].equalsIgnoreCase("account") && args[1].equalsIgnoreCase("reset")){
				   if ( args.length < 3 ){
					   error(pl);
				   }
				   else{
					   boolean pf = true;
					   String pnn = "not_me";
					   String pwr = args[2];
					Random rand = new Random();
					   String pwn = "" + rand.nextInt(999999999);
					   try{
						 FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name +"/Blarg.acc");
						DataInputStream is = new DataInputStream(fstream);
						BufferedReader br = new BufferedReader(new InputStreamReader(is));
						pnn = br.readLine();
						is.close();
						br.close();
					   }
					   catch (IOException e){
						   pl.sendMessage(ChatColor.AQUA + "Error - Account Failed To Reset");
						   System.out.println(e);
						   System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Reset - Failure Type 1");
						   pf = false;
					   }
					   try{
						   if (pf){
							   FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Blarg.acc",false);
								  BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
								  bufferWritter.write(pnn +"\n");
								  bufferWritter.write(pwr +"\n");
								  bufferWritter.write(pwn +"\n"); // User Number
								  bufferWritter.close();
								  pl.sendMessage(ChatColor.GOLD + "Account Updated");
								  System.out.println("\n ** MC_Web User Account Updated '" + Name + " '");
						   }
					   }
					   catch (IOException e){
						   pl.sendMessage(ChatColor.AQUA + "Error - Account Failed To Reset");
						   System.out.println(e);
						   System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Reset - Failure Type 2");
					   }}}
// Item Deposit
			   else if(args[0].equalsIgnoreCase("item") && args[1].equalsIgnoreCase("deposit") ){
				   if (Eitems == true){
				   ItemStack It[] = pl.getInventory().getContents();
				   ItemStack Ih  = pl.getItemInHand();
				   String Mih = "" + Ih.getType(); // Deposit Type
				   int Amm = 0; // Deposit Amount
				   if (Ih.getType() != Material.AIR){
					   for (int i = 0; i < It.length; i++){
						   if ( It[i] != null  ){
							   if ( Ih.getType() == It[i].getType()){
							   Amm += It[i].getAmount();
							   pl.getInventory().setItem( i , new ItemStack(Material.AIR, 0) );
								}}}
					   try{
						   FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/In.box",true);
						   BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
						   bufferWritter.write(Mih + "|" + Amm + "\n");
						   bufferWritter.close();
						   pl.sendMessage(ChatColor.GOLD + "Items Deposited");
					   }
					   catch (IOException e){
						   pl.sendMessage(ChatColor.AQUA + "Error - Deposit Failed");
						   System.out.println(e);
						   System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Deposit Items");
					   }}
				   else{
					   pl.sendMessage(ChatColor.AQUA + "Error - You must be hoding something.");
				   }}
				   else{
					   pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to deposit items");
				   }}
// Item Withdraw
			   else if (args[0].equalsIgnoreCase("item") && args[1].equalsIgnoreCase("withdraw") ){
				   if (Iitems == true){
				   try{
					 FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name + "/Out.box");
					DataInputStream is = new DataInputStream(fstream);
					BufferedReader br = new BufferedReader(new InputStreamReader(is));
					String Line;
					while ( ( Line = br.readLine().trim() ) != null )	{ // This throws NULL POINTER after done with file
					  String[] Temp = Line.split("\\|");
					  System.out.println(Temp[0] + " " + Temp[1] + " " + Line);
					  ItemStack item = new ItemStack(Material.getMaterial(Temp[0]),Integer.parseInt(Temp[1]));
					  pl.getLocation().getWorld().dropItemNaturally(pl.getLocation(), item);
					  
					}
					  is.close();
					  br.close();
					FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Out.box",false);
					BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
					bufferWritter.write("");
					bufferWritter.close();
					pl.sendMessage(ChatColor.GOLD + "Items Withdrawn");
				   }
				   catch (IOException e){
						pl.sendMessage(ChatColor.AQUA + "Error - Item Withdraw");
						System.out.println(e);
						System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Withdraw Items");
					}}
				   else{
					   pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to withdraw items");
				   }}
// Money Deposit
			   else if ( args[0].equalsIgnoreCase("money") && args[1].equalsIgnoreCase("deposit") ){
				   if (args.length < 3  ){
						  error(pl);
					  }
				   else{
					   if(Emoney == true){
						   double Mon = 0.;
						   double Bal = 0.;
						   boolean pf = true;
						   try{
							 Mon = Double.valueOf(args[2]).doubleValue();
							 FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name +"/Account.acc");
							   DataInputStream is = new DataInputStream(fstream);
							   BufferedReader br = new BufferedReader(new InputStreamReader(is));
							   Bal = Double.valueOf(br.readLine()).doubleValue();
							   is.close();
							   br.close();
							   }
						   catch (Exception e){
							   pf = false;
							   pl.sendMessage(ChatColor.AQUA + "Error - Invalad Number Conversion");
						   }
						   if ( pf ){
						   int Enough_Money = Double.compare(Mon,Money);
						   if (Enough_Money < 0 ) {
							   try{
								   Bal += Mon;
								   FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Account.acc",false);
										 BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
										 bufferWritter.write(Bal +"\n");
								bufferWritter.close();
								account.getHoldings().subtract(Mon);
								   pl.sendMessage(ChatColor.GOLD + ""+ Mon + " " + Money_Name + " has been deposited");
									 pl.sendMessage(ChatColor.GOLD + "Account balance is now " + Trun.format(Bal) + " " + Money_Name);
							   }
							   catch (IOException e){
									  pl.sendMessage(ChatColor.AQUA + "Error - Making Deposit");
									  System.out.println("\n ** MC_Web Error - '" + Name + "' deposit failed");
								  }}
						   else{
							   pl.sendMessage(ChatColor.AQUA + "Too Much To Deposit: " + Trun.format(Mon) + " " + Money_Name);
							   }}
						   }
					   else{
						   pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to deposit money");
					   }}}
// Money Withdraw  
			   else if ( args[0].equalsIgnoreCase("money") && args[1].equalsIgnoreCase("withdraw") ){
				   if (args.length < 3  ){
						  error(pl);
					  }
				   else{
					   if(Imoney == true){
						   double Mon = 0.;
						   double Bal = 0.;
						   boolean pf = true;
						   try{
							   Mon = Double.valueOf(args[2]).doubleValue();
							   FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name +"/Account.acc");
							   DataInputStream is = new DataInputStream(fstream);
							   BufferedReader br = new BufferedReader(new InputStreamReader(is));
							   Bal = Double.valueOf(br.readLine().trim() ).doubleValue();
							   is.close();
							   br.close();
							  
						   }
						   catch (Exception e){
							   pf = false;
							   pl.sendMessage(ChatColor.AQUA + "Error - Invalad Number Conversion");
						   }
						   if ( pf ){
							   int Enough_Money = Double.compare(Bal,Mon);
							   if (Enough_Money > 0  ){
								   try{
										  Bal -= Mon;
										  FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Account.acc",false);
												BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
												bufferWritter.write(Bal +"\n");
									   bufferWritter.close();
									   account.getHoldings().add(Mon);
									   pl.sendMessage(ChatColor.GOLD + ""+ Mon + " " + Money_Name + " has been withdrawn");
									  pl.sendMessage(ChatColor.GOLD + "Account balance is now " + Trun.format(Bal) + " " + Money_Name);
									  }
									  catch (IOException e){
											 pl.sendMessage(ChatColor.AQUA + "Error - Making Withdraw");
											 System.out.println("\n ** MC_Web Error - '" + Name + "' withdraw failed");
							   }}
							   else{
								   pl.sendMessage(ChatColor.AQUA + "Too Much To Withdraw: " + Trun.format(Mon) + " " + Money_Name);
							   }
						   }}
					   else{
						   pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to withdraw money");
					   }}}
// Catch
			   else{
				   error(pl);
			   }}}
		return true;
	}}

#3Shippou

Posted 11 December 2012 - 12:36 PM

Stack Trace: ( Line 273 )
13:30:29 [INFO] RLS0812 issued server command: /mc_web item withdraw
13:30:29 [INFO] STONE 99 STONE|99
13:30:29 [INFO] GRASS 2 GRASS|2
13:30:29 [INFO] SAND 67 SAND|67
13:30:29 [SEVERE] null
org.bukkit.command.CommandException: Unhandled exception executing command 'mc_w
eb' in plugin MC_Web v1.0E-8
		at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46)
		at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:18
6)
		at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:5
02)
		at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.
java:985)
		at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:903)
		at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:858)
		at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:44)
		at net.minecraft.server.NetworkManager.b(NetworkManager.java:290)
		at net.minecraft.server.NetServerHandler.d(NetServerHandler.java:113)
		at net.minecraft.server.ServerConnection.b(SourceFile:39)
		at net.minecraft.server.DedicatedServerConnection.b(SourceFile:30)
		at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:595)
		at net.minecraft.server.DedicatedServer.r(DedicatedServer.java:222)
		at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:493)
		at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:426)
		at net.minecraft.server.ThreadServerApplication.run(SourceFile:856)
Caused by: java.lang.NullPointerException
		at Me.RLS0812.MC_Web.Main.onCommand(Main.java:273)
		at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
		... 15 more
13:30:32 [INFO] RLS0812 lost connection: disconnect.quitting
13:30:32 [INFO] Connection reset


Source Code:

package Me.RLS0812.MC_Web;

import java.io.BufferedReader
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.util.Random;
import com.iCo6.system.Account;
import com.iCo6.system.Accounts;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin{
	// Import Money
	boolean Imoney;
	// Export Money
	boolean Emoney;
	// Maximum Money Per Day
	int Mmoney; // Not Used In Plugin - Server Side Use Only
	// Money Name
	String Money_Name;
	// Import Items
	boolean Iitems;
	// Export Items
	boolean Eitems;
	// Maximum Items Per Day
	int Mitems; // Not Used In Plugin - Server Side Use Only
	// Banned Player Deletion
	boolean Bplayer;
	public void onEnable(){
		File file = new File("MC_Web");
		if (!file.exists()){
			System.out.println("\n** MC_Web First Time Set Up **");
			file.mkdir();
			File file1 = new File ("MC_Web/Users");
			file1.mkdir();
			File cfg = new File ("MC_Web/MC_Web.config");
			try {
				cfg.createNewFile();
				FileWriter fileWritter = new FileWriter("MC_Web/MC_Web.config",true);
				BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
				bufferWritter.write("Allow_Money_Export=true\n");
				bufferWritter.write("Allow_Money_Import=true\n");
				bufferWritter.write("Max_Money_Per_Day=-1\n");
				bufferWritter.write("Money_Name=Gold\n");
				bufferWritter.write("Allow_Material_Export=true\n");
				bufferWritter.write("Allow_Material_Import=true\n");
				bufferWritter.write("Max_Material_Per_Day=-1\n");
				bufferWritter.write("Auto_Delete_Banned_Player_Account=false\n");
				bufferWritter.close();
			}
			catch (IOException e) {
				System.out.println("\n** MC_Web Error Creating Config File **");
			}}
			System.out.println("\n** MC_Web Loading Config **");
			File cfg = new File ("MC_Web/MC_Web.config");
			if (!cfg.exists()){
				System.out.println("\n** MC_Web Error Finding Config File - Creatinng New Config File **");
				try {
					cfg.createNewFile();
					FileWriter fileWritter = new FileWriter("MC_Web/MC_Web.config",true);
					BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
					bufferWritter.write("Allow_Money_Export=true\n");
					bufferWritter.write("Allow_Money_Import=true\n");
					bufferWritter.write("Max_Money_Per_Day=-1\n");
					bufferWritter.write("Money_Name=Gold\n");
					bufferWritter.write("Allow_Material_Export=true\n");
					bufferWritter.write("Allow_Material_Import=true\n");
					bufferWritter.write("Max_Material_Per_Day=-1\n");
					bufferWritter.write("Auto_Delete_Banned_Player_Account=false\n");
					bufferWritter.close();
			}
				catch (IOException e) {
					System.out.println("\n** MC_Web Error Creating New Config File **");
				}}
			  
				try{
					  FileInputStream fstream = new FileInputStream("MC_Web/MC_Web.config");
					  DataInputStream is = new DataInputStream(fstream);
					  BufferedReader br = new BufferedReader(new InputStreamReader(is));
					  String Line;
					  int x = 0;
					  // If you add config lines, change X and case
					  while (x != 8)	{
						  Line = br.readLine().trim();
						  String[] Temp = Line.split("=");
						  switch(x){
						  case 0:Imoney = Boolean.parseBoolean(Temp[1]);break;
						  case 1:Emoney = Boolean.parseBoolean(Temp[1]);break;
						  case 2:Mmoney = Integer.parseInt(Temp[1]);break;
						  case 3:Money_Name = Temp[1];break;
						  case 4:Iitems = Boolean.parseBoolean(Temp[1]);break;
						  case 5:Eitems = Boolean.parseBoolean(Temp[1]);break;
						  case 6:Mitems = Integer.parseInt(Temp[1]);break;
						  case 7:Bplayer = Boolean.parseBoolean(Temp[1]);break;
						  default:System.out.println("\n** MC_Web Error - Extra Config Lines **\n ** Line " + (x+1) + ": " + Line + " **");
						  }
						  x += 1;
						  }
					  is.close();
					  br.close();
						}
				catch (Exception e){
					  System.out.println(e + "\n");
					  System.out.println("\n** MC_Web Error Setting Configurations From File  **");
					  }}
	public void onDisable(){}
// #### Book Mark 1 ####
	// TODO Deposit $ - Withdraw $
	// TODO Banned Player Deletion
	public void error(Player x){
		x.sendMessage(ChatColor.GOLD + "** MC_Web Help **");
		x.sendMessage(ChatColor.GOLD + "@ Account Create <Password_Here> <NickName_Here>");
		x.sendMessage(ChatColor.GOLD + "This will create an account for you");
		x.sendMessage(ChatColor.GOLD + "@ Account Reset <Password_Here>");
		x.sendMessage(ChatColor.GOLD + "This will reset your password");
		x.sendMessage(ChatColor.GOLD + "@ Item Deposit");
		x.sendMessage(ChatColor.GOLD + "This will deposit all the same type of items as in your hand,\n from your inventory to your 'in box' ");
		x.sendMessage(ChatColor.GOLD + "@ Item Withdraw");
		x.sendMessage(ChatColor.GOLD + "This will deposit all items from your 'out box', to your inventory");
		x.sendMessage(ChatColor.GOLD + "@ Money Deposit <Ammount_Here>");
		x.sendMessage(ChatColor.GOLD + "This will deposit money into your account ");
		x.sendMessage(ChatColor.GOLD + "@ Money Withdraw <Ammount_Here>");
		x.sendMessage(ChatColor.GOLD + "This will withdraw money from your account");
	}
	public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
	  
		if (sender instanceof Player) {
		if (cmd.getName().equalsIgnoreCase("mc_web")){
			   Player pl = (Player) sender;
			   String Name = pl.getName();
			   Account account = new Accounts().get(Name);
			Double Money = account.getHoldings().getBalance();
			DecimalFormat Trun = new DecimalFormat("0.00");
			   if (args.length < 2  ){
				   error(pl);
			   }
// Account Creation
			   else if ( args[0].equalsIgnoreCase("account") && args[1].equalsIgnoreCase("create") ){
				   if ( args.length < 3 || args.length < 4){
					   error(pl);
				   }
				   else{
				   File file = new File("MC_Web/Users/" + Name);
				   if (file.exists() ){
					   pl.sendMessage(ChatColor.AQUA + "Error - Account '" + Name + "' allready exists");
				   }
				   else{
					   file.mkdir();
					   String Temp = "MC_Web/Users/" + Name;
					   File file1 = new File(Temp + "/Blarg.acc");
					   File file2 = new File(Temp + "/Account.acc");
					   File file3 = new File(Temp + "/In.box");
					   File file4 = new File(Temp + "/Out.box");
					   try{
						   file1.createNewFile();
						   file2.createNewFile();
						   FileWriter fileWritter1 = new FileWriter("MC_Web/Users/" + Name +"/Account.acc",false);
						   BufferedWriter bufferWritter1 = new BufferedWriter(fileWritter1);
						   bufferWritter1.write("0.0");
						   bufferWritter1.close();
						   file3.createNewFile();
						   file4.createNewFile();
						   FileWriter fileWritter = new FileWriter(Temp + "/Blarg.acc",true);
						   BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
						   bufferWritter.write(args[3] + "\n");
						   bufferWritter.write(args[2] + "\n");
						   Random rand = new Random();
						   bufferWritter.write("" + rand.nextInt(999999999) + "\n"); // User Number
						   bufferWritter.close();
						   pl.sendMessage(ChatColor.GOLD + "Account Created");
						   pl.sendMessage(ChatColor.GOLD + "Username: " + Name);
						   pl.sendMessage(ChatColor.GOLD + "Password: " + args[2]);
						   pl.sendMessage(ChatColor.GOLD + "Nickname: " + args[3]);
						   System.out.println("\n ** MC_Web User Account Created '" + Name + " '");
					   }
					   catch (IOException e) {
						   pl.sendMessage(ChatColor.AQUA + "Error - Account Failed To Create");
						   System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Create");
					   }}}}
// Password Reset
			   else if(args[0].equalsIgnoreCase("account") && args[1].equalsIgnoreCase("reset")){
				   if ( args.length < 3 ){
					   error(pl);
				   }
				   else{
					   boolean pf = true;
					   String pnn = "not_me";
					   String pwr = args[2];
					Random rand = new Random();
					   String pwn = "" + rand.nextInt(999999999);
					   try{
						 FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name +"/Blarg.acc");
						DataInputStream is = new DataInputStream(fstream);
						BufferedReader br = new BufferedReader(new InputStreamReader(is));
						pnn = br.readLine();
						is.close();
						br.close();
					   }
					   catch (IOException e){
						   pl.sendMessage(ChatColor.AQUA + "Error - Account Failed To Reset");
						   System.out.println(e);
						   System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Reset - Failure Type 1");
						   pf = false;
					   }
					   try{
						   if (pf){
							   FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Blarg.acc",false);
								  BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
								  bufferWritter.write(pnn +"\n");
								  bufferWritter.write(pwr +"\n");
								  bufferWritter.write(pwn +"\n"); // User Number
								  bufferWritter.close();
								  pl.sendMessage(ChatColor.GOLD + "Account Updated");
								  System.out.println("\n ** MC_Web User Account Updated '" + Name + " '");
						   }
					   }
					   catch (IOException e){
						   pl.sendMessage(ChatColor.AQUA + "Error - Account Failed To Reset");
						   System.out.println(e);
						   System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Reset - Failure Type 2");
					   }}}
// Item Deposit
			   else if(args[0].equalsIgnoreCase("item") && args[1].equalsIgnoreCase("deposit") ){
				   if (Eitems == true){
				   ItemStack It[] = pl.getInventory().getContents();
				   ItemStack Ih  = pl.getItemInHand();
				   String Mih = "" + Ih.getType(); // Deposit Type
				   int Amm = 0; // Deposit Amount
				   if (Ih.getType() != Material.AIR){
					   for (int i = 0; i < It.length; i++){
						   if ( It[i] != null  ){
							   if ( Ih.getType() == It[i].getType()){
							   Amm += It[i].getAmount();
							   pl.getInventory().setItem( i , new ItemStack(Material.AIR, 0) );
								}}}
					   try{
						   FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/In.box",true);
						   BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
						   bufferWritter.write(Mih + "|" + Amm + "\n");
						   bufferWritter.close();
						   pl.sendMessage(ChatColor.GOLD + "Items Deposited");
					   }
					   catch (IOException e){
						   pl.sendMessage(ChatColor.AQUA + "Error - Deposit Failed");
						   System.out.println(e);
						   System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Deposit Items");
					   }}
				   else{
					   pl.sendMessage(ChatColor.AQUA + "Error - You must be hoding something.");
				   }}
				   else{
					   pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to deposit items");
				   }}
// Item Withdraw
			   else if (args[0].equalsIgnoreCase("item") && args[1].equalsIgnoreCase("withdraw") ){
				   if (Iitems == true){
				   try{
					 FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name + "/Out.box");
					DataInputStream is = new DataInputStream(fstream);
					BufferedReader br = new BufferedReader(new InputStreamReader(is));
					String Line;
					while ( ( Line = br.readLine().trim() ) != null )	{ // This throws NULL POINTER after done with file
					  String[] Temp = Line.split("\\|");
					  System.out.println(Temp[0] + " " + Temp[1] + " " + Line);
					  ItemStack item = new ItemStack(Material.getMaterial(Temp[0]),Integer.parseInt(Temp[1]));
					  pl.getLocation().getWorld().dropItemNaturally(pl.getLocation(), item);
					  
					}
					  is.close();
					  br.close();
					FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Out.box",false);
					BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
					bufferWritter.write("");
					bufferWritter.close();
					pl.sendMessage(ChatColor.GOLD + "Items Withdrawn");
				   }
				   catch (IOException e){
						pl.sendMessage(ChatColor.AQUA + "Error - Item Withdraw");
						System.out.println(e);
						System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Withdraw Items");
					}}
				   else{
					   pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to withdraw items");
				   }}
// Money Deposit
			   else if ( args[0].equalsIgnoreCase("money") && args[1].equalsIgnoreCase("deposit") ){
				   if (args.length < 3  ){
						  error(pl);
					  }
				   else{
					   if(Emoney == true){
						   double Mon = 0.;
						   double Bal = 0.;
						   boolean pf = true;
						   try{
							 Mon = Double.valueOf(args[2]).doubleValue();
							 FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name +"/Account.acc");
							   DataInputStream is = new DataInputStream(fstream);
							   BufferedReader br = new BufferedReader(new InputStreamReader(is));
							   Bal = Double.valueOf(br.readLine()).doubleValue();
							   is.close();
							   br.close();
							   }
						   catch (Exception e){
							   pf = false;
							   pl.sendMessage(ChatColor.AQUA + "Error - Invalad Number Conversion");
						   }
						   if ( pf ){
						   int Enough_Money = Double.compare(Mon,Money);
						   if (Enough_Money < 0 ) {
							   try{
								   Bal += Mon;
								   FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Account.acc",false);
										 BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
										 bufferWritter.write(Bal +"\n");
								bufferWritter.close();
								account.getHoldings().subtract(Mon);
								   pl.sendMessage(ChatColor.GOLD + ""+ Mon + " " + Money_Name + " has been deposited");
									 pl.sendMessage(ChatColor.GOLD + "Account balance is now " + Trun.format(Bal) + " " + Money_Name);
							   }
							   catch (IOException e){
									  pl.sendMessage(ChatColor.AQUA + "Error - Making Deposit");
									  System.out.println("\n ** MC_Web Error - '" + Name + "' deposit failed");
								  }}
						   else{
							   pl.sendMessage(ChatColor.AQUA + "Too Much To Deposit: " + Trun.format(Mon) + " " + Money_Name);
							   }}
						   }
					   else{
						   pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to deposit money");
					   }}}
// Money Withdraw  
			   else if ( args[0].equalsIgnoreCase("money") && args[1].equalsIgnoreCase("withdraw") ){
				   if (args.length < 3  ){
						  error(pl);
					  }
				   else{
					   if(Imoney == true){
						   double Mon = 0.;
						   double Bal = 0.;
						   boolean pf = true;
						   try{
							   Mon = Double.valueOf(args[2]).doubleValue();
							   FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name +"/Account.acc");
							   DataInputStream is = new DataInputStream(fstream);
							   BufferedReader br = new BufferedReader(new InputStreamReader(is));
							   Bal = Double.valueOf(br.readLine().trim() ).doubleValue();
							   is.close();
							   br.close();
							  
						   }
						   catch (Exception e){
							   pf = false;
							   pl.sendMessage(ChatColor.AQUA + "Error - Invalad Number Conversion");
						   }
						   if ( pf ){
							   int Enough_Money = Double.compare(Bal,Mon);
							   if (Enough_Money > 0  ){
								   try{
										  Bal -= Mon;
										  FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Account.acc",false);
												BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
												bufferWritter.write(Bal +"\n");
									   bufferWritter.close();
									   account.getHoldings().add(Mon);
									   pl.sendMessage(ChatColor.GOLD + ""+ Mon + " " + Money_Name + " has been withdrawn");
									  pl.sendMessage(ChatColor.GOLD + "Account balance is now " + Trun.format(Bal) + " " + Money_Name);
									  }
									  catch (IOException e){
											 pl.sendMessage(ChatColor.AQUA + "Error - Making Withdraw");
											 System.out.println("\n ** MC_Web Error - '" + Name + "' withdraw failed");
							   }}
							   else{
								   pl.sendMessage(ChatColor.AQUA + "Too Much To Withdraw: " + Trun.format(Mon) + " " + Money_Name);
							   }
						   }}
					   else{
						   pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to withdraw money");
					   }}}
// Catch
			   else{
				   error(pl);
			   }}}
		return true;
	}}

#2Shippou

Posted 11 December 2012 - 12:34 PM

Stack Trace: ( Line 273 )
13:30:29 [INFO] RLS0812 issued server command: /mc_web item withdraw
13:30:29 [INFO] STONE 99 STONE|99
13:30:29 [INFO] GRASS 2 GRASS|2
13:30:29 [INFO] SAND 67 SAND|67
13:30:29 [SEVERE] null
org.bukkit.command.CommandException: Unhandled exception executing command 'mc_w
eb' in plugin MC_Web v1.0E-8
	    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46)
	    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:18
6)
	    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:5
02)
	    at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.
java:985)
	    at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:903)
	    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:858)
	    at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:44)
	    at net.minecraft.server.NetworkManager.b(NetworkManager.java:290)
	    at net.minecraft.server.NetServerHandler.d(NetServerHandler.java:113)
	    at net.minecraft.server.ServerConnection.b(SourceFile:39)
	    at net.minecraft.server.DedicatedServerConnection.b(SourceFile:30)
	    at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:595)
	    at net.minecraft.server.DedicatedServer.r(DedicatedServer.java:222)
	    at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:493)
	    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:426)
	    at net.minecraft.server.ThreadServerApplication.run(SourceFile:856)
Caused by: java.lang.NullPointerException
	    at Me.RLS0812.MC_Web.Main.onCommand(Main.java:273)
	    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
	    ... 15 more
13:30:32 [INFO] RLS0812 lost connection: disconnect.quitting
13:30:32 [INFO] Connection reset


Source Code:

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.util.Random;
import com.iCo6.system.Account;
import com.iCo6.system.Accounts;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin{
    // Import Money
    boolean Imoney;
    // Export Money
    boolean Emoney;
    // Maximum Money Per Day
    int Mmoney; // Not Used In Plugin - Server Side Use Only
    // Money Name
    String Money_Name;
    // Import Items
    boolean Iitems;
    // Export Items
    boolean Eitems;
    // Maximum Items Per Day
    int Mitems; // Not Used In Plugin - Server Side Use Only
    // Banned Player Deletion
    boolean Bplayer;
    public void onEnable(){
	    File file = new File("MC_Web");
	    if (!file.exists()){
		    System.out.println("\n** MC_Web First Time Set Up **");
		    file.mkdir();
		    File file1 = new File ("MC_Web/Users");
		    file1.mkdir();
		    File cfg = new File ("MC_Web/MC_Web.config");
		    try {
			    cfg.createNewFile();
			    FileWriter fileWritter = new FileWriter("MC_Web/MC_Web.config",true);
			    BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
			    bufferWritter.write("Allow_Money_Export=true\n");
			    bufferWritter.write("Allow_Money_Import=true\n");
			    bufferWritter.write("Max_Money_Per_Day=-1\n");
			    bufferWritter.write("Money_Name=Gold\n");
			    bufferWritter.write("Allow_Material_Export=true\n");
			    bufferWritter.write("Allow_Material_Import=true\n");
			    bufferWritter.write("Max_Material_Per_Day=-1\n");
			    bufferWritter.write("Auto_Delete_Banned_Player_Account=false\n");
			    bufferWritter.close();
		    }
		    catch (IOException e) {
			    System.out.println("\n** MC_Web Error Creating Config File **");
		    }}
		    System.out.println("\n** MC_Web Loading Config **");
		    File cfg = new File ("MC_Web/MC_Web.config");
		    if (!cfg.exists()){
			    System.out.println("\n** MC_Web Error Finding Config File - Creatinng New Config File **");
			    try {
				    cfg.createNewFile();
				    FileWriter fileWritter = new FileWriter("MC_Web/MC_Web.config",true);
				    BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
				    bufferWritter.write("Allow_Money_Export=true\n");
				    bufferWritter.write("Allow_Money_Import=true\n");
				    bufferWritter.write("Max_Money_Per_Day=-1\n");
				    bufferWritter.write("Money_Name=Gold\n");
				    bufferWritter.write("Allow_Material_Export=true\n");
				    bufferWritter.write("Allow_Material_Import=true\n");
				    bufferWritter.write("Max_Material_Per_Day=-1\n");
				    bufferWritter.write("Auto_Delete_Banned_Player_Account=false\n");
				    bufferWritter.close();
		    }
			    catch (IOException e) {
				    System.out.println("\n** MC_Web Error Creating New Config File **");
			    }}
			   
			    try{
					  FileInputStream fstream = new FileInputStream("MC_Web/MC_Web.config");
					  DataInputStream is = new DataInputStream(fstream);
					  BufferedReader br = new BufferedReader(new InputStreamReader(is));
					  String Line;
					  int x = 0;
					  // If you add config lines, change X and case
					  while (x != 8)    {
						  Line = br.readLine().trim();
						  String[] Temp = Line.split("=");
						  switch(x){
						  case 0:Imoney = Boolean.parseBoolean(Temp[1]);break;
						  case 1:Emoney = Boolean.parseBoolean(Temp[1]);break;
						  case 2:Mmoney = Integer.parseInt(Temp[1]);break;
						  case 3:Money_Name = Temp[1];break;
						  case 4:Iitems = Boolean.parseBoolean(Temp[1]);break;
						  case 5:Eitems = Boolean.parseBoolean(Temp[1]);break;
						  case 6:Mitems = Integer.parseInt(Temp[1]);break;
						  case 7:Bplayer = Boolean.parseBoolean(Temp[1]);break;
						  default:System.out.println("\n** MC_Web Error - Extra Config Lines **\n ** Line " + (x+1) + ": " + Line + " **");
						  }
						  x += 1;
						  }
					  is.close();
					  br.close();
					    }
			    catch (Exception e){
					  System.out.println(e + "\n");
					  System.out.println("\n** MC_Web Error Setting Configurations From File  **");
					  }}
    public void onDisable(){}
// #### Book Mark 1 ####
    // TODO Deposit $ - Withdraw $
    // TODO Banned Player Deletion
    public void error(Player x){
	    x.sendMessage(ChatColor.GOLD + "** MC_Web Help **");
	    x.sendMessage(ChatColor.GOLD + "@ Account Create <Password_Here> <NickName_Here>");
	    x.sendMessage(ChatColor.GOLD + "This will create an account for you");
	    x.sendMessage(ChatColor.GOLD + "@ Account Reset <Password_Here>");
	    x.sendMessage(ChatColor.GOLD + "This will reset your password");
	    x.sendMessage(ChatColor.GOLD + "@ Item Deposit");
	    x.sendMessage(ChatColor.GOLD + "This will deposit all the same type of items as in your hand,\n from your inventory to your 'in box' ");
	    x.sendMessage(ChatColor.GOLD + "@ Item Withdraw");
	    x.sendMessage(ChatColor.GOLD + "This will deposit all items from your 'out box', to your inventory");
	    x.sendMessage(ChatColor.GOLD + "@ Money Deposit <Ammount_Here>");
	    x.sendMessage(ChatColor.GOLD + "This will deposit money into your account ");
	    x.sendMessage(ChatColor.GOLD + "@ Money Withdraw <Ammount_Here>");
	    x.sendMessage(ChatColor.GOLD + "This will withdraw money from your account");
    }
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
	   
	    if (sender instanceof Player) {
	    if (cmd.getName().equalsIgnoreCase("mc_web")){
			   Player pl = (Player) sender;
			   String Name = pl.getName();
			   Account account = new Accounts().get(Name);
		    Double Money = account.getHoldings().getBalance();
		    DecimalFormat Trun = new DecimalFormat("0.00");
			   if (args.length < 2  ){
				   error(pl);
			   }
// Account Creation
			   else if ( args[0].equalsIgnoreCase("account") && args[1].equalsIgnoreCase("create") ){
				   if ( args.length < 3 || args.length < 4){
					   error(pl);
				   }
				   else{
				   File file = new File("MC_Web/Users/" + Name);
				   if (file.exists() ){
					   pl.sendMessage(ChatColor.AQUA + "Error - Account '" + Name + "' allready exists");
				   }
				   else{
					   file.mkdir();
					   String Temp = "MC_Web/Users/" + Name;
					   File file1 = new File(Temp + "/Blarg.acc");
					   File file2 = new File(Temp + "/Account.acc");
					   File file3 = new File(Temp + "/In.box");
					   File file4 = new File(Temp + "/Out.box");
					   try{
						   file1.createNewFile();
						   file2.createNewFile();
						   FileWriter fileWritter1 = new FileWriter("MC_Web/Users/" + Name +"/Account.acc",false);
						   BufferedWriter bufferWritter1 = new BufferedWriter(fileWritter1);
						   bufferWritter1.write("0.0");
						   bufferWritter1.close();
						   file3.createNewFile();
						   file4.createNewFile();
						   FileWriter fileWritter = new FileWriter(Temp + "/Blarg.acc",true);
						   BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
						   bufferWritter.write(args[3] + "\n");
						   bufferWritter.write(args[2] + "\n");
						   Random rand = new Random();
						   bufferWritter.write("" + rand.nextInt(999999999) + "\n"); // User Number
						   bufferWritter.close();
						   pl.sendMessage(ChatColor.GOLD + "Account Created");
						   pl.sendMessage(ChatColor.GOLD + "Username: " + Name);
						   pl.sendMessage(ChatColor.GOLD + "Password: " + args[2]);
						   pl.sendMessage(ChatColor.GOLD + "Nickname: " + args[3]);
						   System.out.println("\n ** MC_Web User Account Created '" + Name + " '");
					   }
					   catch (IOException e) {
						   pl.sendMessage(ChatColor.AQUA + "Error - Account Failed To Create");
						   System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Create");
					   }}}}
// Password Reset
			   else if(args[0].equalsIgnoreCase("account") && args[1].equalsIgnoreCase("reset")){
				   if ( args.length < 3 ){
					   error(pl);
				   }
				   else{
					   boolean pf = true;
					   String pnn = "not_me";
					   String pwr = args[2];
				    Random rand = new Random();
					   String pwn = "" + rand.nextInt(999999999);
					   try{
						 FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name +"/Blarg.acc");
					    DataInputStream is = new DataInputStream(fstream);
					    BufferedReader br = new BufferedReader(new InputStreamReader(is));
					    pnn = br.readLine();
					    is.close();
					    br.close();
					   }
					   catch (IOException e){
						   pl.sendMessage(ChatColor.AQUA + "Error - Account Failed To Reset");
						   System.out.println(e);
						   System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Reset - Failure Type 1");
						   pf = false;
					   }
					   try{
						   if (pf){
							   FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Blarg.acc",false);
								  BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
								  bufferWritter.write(pnn +"\n");
								  bufferWritter.write(pwr +"\n");
								  bufferWritter.write(pwn +"\n"); // User Number
								  bufferWritter.close();
								  pl.sendMessage(ChatColor.GOLD + "Account Updated");
								  System.out.println("\n ** MC_Web User Account Updated '" + Name + " '");
						   }
					   }
					   catch (IOException e){
						   pl.sendMessage(ChatColor.AQUA + "Error - Account Failed To Reset");
						   System.out.println(e);
						   System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Reset - Failure Type 2");
					   }}}
// Item Deposit
			   else if(args[0].equalsIgnoreCase("item") && args[1].equalsIgnoreCase("deposit") ){
				   if (Eitems == true){
				   ItemStack It[] = pl.getInventory().getContents();
				   ItemStack Ih  = pl.getItemInHand();
				   String Mih = "" + Ih.getType(); // Deposit Type
				   int Amm = 0; // Deposit Amount
				   if (Ih.getType() != Material.AIR){
					   for (int i = 0; i < It.length; i++){
						   if ( It[i] != null  ){
							   if ( Ih.getType() == It[i].getType()){
							   Amm += It[i].getAmount();
							   pl.getInventory().setItem( i , new ItemStack(Material.AIR, 0) );
							    }}}
					   try{
						   FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/In.box",true);
						   BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
						   bufferWritter.write(Mih + "|" + Amm + "\n");
						   bufferWritter.close();
						   pl.sendMessage(ChatColor.GOLD + "Items Deposited");
					   }
					   catch (IOException e){
						   pl.sendMessage(ChatColor.AQUA + "Error - Deposit Failed");
						   System.out.println(e);
						   System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Deposit Items");
					   }}
				   else{
					   pl.sendMessage(ChatColor.AQUA + "Error - You must be hoding something.");
				   }}
				   else{
					   pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to deposit items");
				   }}
// Item Withdraw
			   else if (args[0].equalsIgnoreCase("item") && args[1].equalsIgnoreCase("withdraw") ){
				   if (Iitems == true){
				   try{
					 FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name + "/Out.box");
				    DataInputStream is = new DataInputStream(fstream);
				    BufferedReader br = new BufferedReader(new InputStreamReader(is));
				    String Line;
				    while ( ( Line = br.readLine().trim() ) != null )    { // This throws NULL POINTER after done with file
					  String[] Temp = Line.split("\\|");
					  System.out.println(Temp[0] + " " + Temp[1] + " " + Line);
					  ItemStack item = new ItemStack(Material.getMaterial(Temp[0]),Integer.parseInt(Temp[1]));
					  pl.getLocation().getWorld().dropItemNaturally(pl.getLocation(), item);
					   
				    }
					  is.close();
					  br.close();
				    FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Out.box",false);
				    BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
				    bufferWritter.write("");
				    bufferWritter.close();
				    pl.sendMessage(ChatColor.GOLD + "Items Withdrawn");
				   }
				   catch (IOException e){
					    pl.sendMessage(ChatColor.AQUA + "Error - Item Withdraw");
					    System.out.println(e);
					    System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Withdraw Items");
				    }}
				   else{
					   pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to withdraw items");
				   }}
// Money Deposit
			   else if ( args[0].equalsIgnoreCase("money") && args[1].equalsIgnoreCase("deposit") ){
				   if (args.length < 3  ){
						  error(pl);
					  }
				   else{
					   if(Emoney == true){
						   double Mon = 0.;
						   double Bal = 0.;
						   boolean pf = true;
						   try{
							 Mon = Double.valueOf(args[2]).doubleValue();
							 FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name +"/Account.acc");
							   DataInputStream is = new DataInputStream(fstream);
							   BufferedReader br = new BufferedReader(new InputStreamReader(is));
							   Bal = Double.valueOf(br.readLine()).doubleValue();
							   is.close();
							   br.close();
							   }
						   catch (Exception e){
							   pf = false;
							   pl.sendMessage(ChatColor.AQUA + "Error - Invalad Number Conversion");
						   }
						   if ( pf ){
						   int Enough_Money = Double.compare(Mon,Money);
						   if (Enough_Money < 0 ) {
							   try{
								   Bal += Mon;
								   FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Account.acc",false);
										 BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
										 bufferWritter.write(Bal +"\n");
							    bufferWritter.close();
							    account.getHoldings().subtract(Mon);
								   pl.sendMessage(ChatColor.GOLD + ""+ Mon + " " + Money_Name + " has been deposited");
									 pl.sendMessage(ChatColor.GOLD + "Account balance is now " + Trun.format(Bal) + " " + Money_Name);
							   }
							   catch (IOException e){
									  pl.sendMessage(ChatColor.AQUA + "Error - Making Deposit");
									  System.out.println("\n ** MC_Web Error - '" + Name + "' deposit failed");
								  }}
						   else{
							   pl.sendMessage(ChatColor.AQUA + "Too Much To Deposit: " + Trun.format(Mon) + " " + Money_Name);
							   }}
						   }
					   else{
						   pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to deposit money");
					   }}}
// Money Withdraw   
			   else if ( args[0].equalsIgnoreCase("money") && args[1].equalsIgnoreCase("withdraw") ){
				   if (args.length < 3  ){
						  error(pl);
					  }
				   else{
					   if(Imoney == true){
						   double Mon = 0.;
						   double Bal = 0.;
						   boolean pf = true;
						   try{
							   Mon = Double.valueOf(args[2]).doubleValue();
							   FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name +"/Account.acc");
							   DataInputStream is = new DataInputStream(fstream);
							   BufferedReader br = new BufferedReader(new InputStreamReader(is));
							   Bal = Double.valueOf(br.readLine().trim() ).doubleValue();
							   is.close();
							   br.close();
							  
						   }
						   catch (Exception e){
							   pf = false;
							   pl.sendMessage(ChatColor.AQUA + "Error - Invalad Number Conversion");
						   }
						   if ( pf ){
							   int Enough_Money = Double.compare(Bal,Mon);
							   if (Enough_Money > 0  ){
								   try{
										  Bal -= Mon;
										  FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Account.acc",false);
											    BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
											    bufferWritter.write(Bal +"\n");
									   bufferWritter.close();
									   account.getHoldings().add(Mon);
									   pl.sendMessage(ChatColor.GOLD + ""+ Mon + " " + Money_Name + " has been withdrawn");
									  pl.sendMessage(ChatColor.GOLD + "Account balance is now " + Trun.format(Bal) + " " + Money_Name);
									  }
									  catch (IOException e){
											 pl.sendMessage(ChatColor.AQUA + "Error - Making Withdraw");
											 System.out.println("\n ** MC_Web Error - '" + Name + "' withdraw failed");
							   }}
							   else{
								   pl.sendMessage(ChatColor.AQUA + "Too Much To Withdraw: " + Trun.format(Mon) + " " + Money_Name);
							   }
						   }}
					   else{
						   pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to withdraw money");
					   }}}
// Catch
			   else{
				   error(pl);
			   }}}
	    return true;
    }}

#1Shippou

Posted 11 December 2012 - 12:32 PM

Stack Trace: Line 273
[source lang="bash"]13:30:29 [INFO] RLS0812 issued server command: /mc_web item withdraw13:30:29 [INFO] STONE 99 STONE|9913:30:29 [INFO] GRASS 2 GRASS|213:30:29 [INFO] SAND 67 SAND|6713:30:29 [SEVERE] nullorg.bukkit.command.CommandException: Unhandled exception executing command 'mc_web' in plugin MC_Web v1.0E-8 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:186) at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:502) at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:985) at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:903) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:858) at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:44) at net.minecraft.server.NetworkManager.b(NetworkManager.java:290) at net.minecraft.server.NetServerHandler.d(NetServerHandler.java:113) at net.minecraft.server.ServerConnection.b(SourceFile:39) at net.minecraft.server.DedicatedServerConnection.b(SourceFile:30) at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:595) at net.minecraft.server.DedicatedServer.r(DedicatedServer.java:222) at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:493) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:426) at net.minecraft.server.ThreadServerApplication.run(SourceFile:856)Caused by: java.lang.NullPointerException at Me.RLS0812.MC_Web.Main.onCommand(Main.java:273) at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ... 15 more13:30:32 [INFO] RLS0812 lost connection: disconnect.quitting13:30:32 [INFO] Connection reset>[/source]

Source Code:

[source lang="java"]package Me.RLS0812.MC_Web;import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.DataInputStream;import java.io.File;import java.io.FileInputStream;import java.io.FileWriter;import java.io.IOException;import java.io.InputStreamReader;import java.text.DecimalFormat;import java.util.Random;import com.iCo6.system.Account;import com.iCo6.system.Accounts;import org.bukkit.ChatColor;import org.bukkit.Material;import org.bukkit.command.Command;import org.bukkit.command.CommandSender;import org.bukkit.entity.Player;import org.bukkit.inventory.ItemStack;import org.bukkit.plugin.java.JavaPlugin;public class Main extends JavaPlugin{ // Import Money boolean Imoney; // Export Money boolean Emoney; // Maximum Money Per Day int Mmoney; // Not Used In Plugin - Server Side Use Only // Money Name String Money_Name; // Import Items boolean Iitems; // Export Items boolean Eitems; // Maximum Items Per Day int Mitems; // Not Used In Plugin - Server Side Use Only // Banned Player Deletion boolean Bplayer; public void onEnable(){ File file = new File("MC_Web"); if (!file.exists()){ System.out.println("\n** MC_Web First Time Set Up **"); file.mkdir(); File file1 = new File ("MC_Web/Users"); file1.mkdir(); File cfg = new File ("MC_Web/MC_Web.config"); try { cfg.createNewFile(); FileWriter fileWritter = new FileWriter("MC_Web/MC_Web.config",true); BufferedWriter bufferWritter = new BufferedWriter(fileWritter); bufferWritter.write("Allow_Money_Export=true\n"); bufferWritter.write("Allow_Money_Import=true\n"); bufferWritter.write("Max_Money_Per_Day=-1\n"); bufferWritter.write("Money_Name=Gold\n"); bufferWritter.write("Allow_Material_Export=true\n"); bufferWritter.write("Allow_Material_Import=true\n"); bufferWritter.write("Max_Material_Per_Day=-1\n"); bufferWritter.write("Auto_Delete_Banned_Player_Account=false\n"); bufferWritter.close(); } catch (IOException e) { System.out.println("\n** MC_Web Error Creating Config File **"); }} System.out.println("\n** MC_Web Loading Config **"); File cfg = new File ("MC_Web/MC_Web.config"); if (!cfg.exists()){ System.out.println("\n** MC_Web Error Finding Config File - Creatinng New Config File **"); try { cfg.createNewFile(); FileWriter fileWritter = new FileWriter("MC_Web/MC_Web.config",true); BufferedWriter bufferWritter = new BufferedWriter(fileWritter); bufferWritter.write("Allow_Money_Export=true\n"); bufferWritter.write("Allow_Money_Import=true\n"); bufferWritter.write("Max_Money_Per_Day=-1\n"); bufferWritter.write("Money_Name=Gold\n"); bufferWritter.write("Allow_Material_Export=true\n"); bufferWritter.write("Allow_Material_Import=true\n"); bufferWritter.write("Max_Material_Per_Day=-1\n"); bufferWritter.write("Auto_Delete_Banned_Player_Account=false\n"); bufferWritter.close(); } catch (IOException e) { System.out.println("\n** MC_Web Error Creating New Config File **"); }} try{ FileInputStream fstream = new FileInputStream("MC_Web/MC_Web.config"); DataInputStream is = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String Line; int x = 0; // If you add config lines, change X and case while (x != 8) { Line = br.readLine().trim(); String[] Temp = Line.split("="); switch(x){ case 0:Imoney = Boolean.parseBoolean(Temp[1]);break; case 1:Emoney = Boolean.parseBoolean(Temp[1]);break; case 2:Mmoney = Integer.parseInt(Temp[1]);break; case 3:Money_Name = Temp[1];break; case 4:Iitems = Boolean.parseBoolean(Temp[1]);break; case 5:Eitems = Boolean.parseBoolean(Temp[1]);break; case 6:Mitems = Integer.parseInt(Temp[1]);break; case 7:Bplayer = Boolean.parseBoolean(Temp[1]);break; default:System.out.println("\n** MC_Web Error - Extra Config Lines **\n ** Line " + (x+1) + ": " + Line + " **"); } x += 1; } is.close(); br.close(); } catch (Exception e){ System.out.println(e + "\n"); System.out.println("\n** MC_Web Error Setting Configurations From File **"); }} public void onDisable(){}// #### Book Mark 1 #### // TODO Deposit $ - Withdraw $ // TODO Banned Player Deletion public void error(Player x){ x.sendMessage(ChatColor.GOLD + "** MC_Web Help **"); x.sendMessage(ChatColor.GOLD + "@ Account Create <Password_Here> <NickName_Here>"); x.sendMessage(ChatColor.GOLD + "This will create an account for you"); x.sendMessage(ChatColor.GOLD + "@ Account Reset <Password_Here>"); x.sendMessage(ChatColor.GOLD + "This will reset your password"); x.sendMessage(ChatColor.GOLD + "@ Item Deposit"); x.sendMessage(ChatColor.GOLD + "This will deposit all the same type of items as in your hand,\n from your inventory to your 'in box' "); x.sendMessage(ChatColor.GOLD + "@ Item Withdraw"); x.sendMessage(ChatColor.GOLD + "This will deposit all items from your 'out box', to your inventory"); x.sendMessage(ChatColor.GOLD + "@ Money Deposit <Ammount_Here>"); x.sendMessage(ChatColor.GOLD + "This will deposit money into your account "); x.sendMessage(ChatColor.GOLD + "@ Money Withdraw <Ammount_Here>"); x.sendMessage(ChatColor.GOLD + "This will withdraw money from your account"); } public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (sender instanceof Player) { if (cmd.getName().equalsIgnoreCase("mc_web")){ Player pl = (Player) sender; String Name = pl.getName(); Account account = new Accounts().get(Name); Double Money = account.getHoldings().getBalance(); DecimalFormat Trun = new DecimalFormat("0.00"); if (args.length < 2 ){ error(pl); }// Account Creation else if ( args[0].equalsIgnoreCase("account") && args[1].equalsIgnoreCase("create") ){ if ( args.length < 3 || args.length < 4){ error(pl); } else{ File file = new File("MC_Web/Users/" + Name); if (file.exists() ){ pl.sendMessage(ChatColor.AQUA + "Error - Account '" + Name + "' allready exists"); } else{ file.mkdir(); String Temp = "MC_Web/Users/" + Name; File file1 = new File(Temp + "/Blarg.acc"); File file2 = new File(Temp + "/Account.acc"); File file3 = new File(Temp + "/In.box"); File file4 = new File(Temp + "/Out.box"); try{ file1.createNewFile(); file2.createNewFile(); FileWriter fileWritter1 = new FileWriter("MC_Web/Users/" + Name +"/Account.acc",false); BufferedWriter bufferWritter1 = new BufferedWriter(fileWritter1); bufferWritter1.write("0.0"); bufferWritter1.close(); file3.createNewFile(); file4.createNewFile(); FileWriter fileWritter = new FileWriter(Temp + "/Blarg.acc",true); BufferedWriter bufferWritter = new BufferedWriter(fileWritter); bufferWritter.write(args[3] + "\n"); bufferWritter.write(args[2] + "\n"); Random rand = new Random(); bufferWritter.write("" + rand.nextInt(999999999) + "\n"); // User Number bufferWritter.close(); pl.sendMessage(ChatColor.GOLD + "Account Created"); pl.sendMessage(ChatColor.GOLD + "Username: " + Name); pl.sendMessage(ChatColor.GOLD + "Password: " + args[2]); pl.sendMessage(ChatColor.GOLD + "Nickname: " + args[3]); System.out.println("\n ** MC_Web User Account Created '" + Name + " '"); } catch (IOException e) { pl.sendMessage(ChatColor.AQUA + "Error - Account Failed To Create"); System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Create"); }}}}// Password Reset else if(args[0].equalsIgnoreCase("account") && args[1].equalsIgnoreCase("reset")){ if ( args.length < 3 ){ error(pl); } else{ boolean pf = true; String pnn = "not_me"; String pwr = args[2]; Random rand = new Random(); String pwn = "" + rand.nextInt(999999999); try{ FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name +"/Blarg.acc"); DataInputStream is = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(is)); pnn = br.readLine(); is.close(); br.close(); } catch (IOException e){ pl.sendMessage(ChatColor.AQUA + "Error - Account Failed To Reset"); System.out.println(e); System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Reset - Failure Type 1"); pf = false; } try{ if (pf){ FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Blarg.acc",false); BufferedWriter bufferWritter = new BufferedWriter(fileWritter); bufferWritter.write(pnn +"\n"); bufferWritter.write(pwr +"\n"); bufferWritter.write(pwn +"\n"); // User Number bufferWritter.close(); pl.sendMessage(ChatColor.GOLD + "Account Updated"); System.out.println("\n ** MC_Web User Account Updated '" + Name + " '"); } } catch (IOException e){ pl.sendMessage(ChatColor.AQUA + "Error - Account Failed To Reset"); System.out.println(e); System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Reset - Failure Type 2"); }}} // Item Deposit else if(args[0].equalsIgnoreCase("item") && args[1].equalsIgnoreCase("deposit") ){ if (Eitems == true){ ItemStack It[] = pl.getInventory().getContents(); ItemStack Ih = pl.getItemInHand(); String Mih = "" + Ih.getType(); // Deposit Type int Amm = 0; // Deposit Amount if (Ih.getType() != Material.AIR){ for (int i = 0; i < It.length; i++){ if ( It[i] != null ){ if ( Ih.getType() == It[i].getType()){ Amm += It[i].getAmount(); pl.getInventory().setItem( i , new ItemStack(Material.AIR, 0) ); }}} try{ FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/In.box",true); BufferedWriter bufferWritter = new BufferedWriter(fileWritter); bufferWritter.write(Mih + "|" + Amm + "\n"); bufferWritter.close(); pl.sendMessage(ChatColor.GOLD + "Items Deposited"); } catch (IOException e){ pl.sendMessage(ChatColor.AQUA + "Error - Deposit Failed"); System.out.println(e); System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Deposit Items"); }} else{ pl.sendMessage(ChatColor.AQUA + "Error - You must be hoding something."); }} else{ pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to deposit items"); }}// Item Withdraw else if (args[0].equalsIgnoreCase("item") && args[1].equalsIgnoreCase("withdraw") ){ if (Iitems == true){ try{ FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name + "/Out.box"); DataInputStream is = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String Line; while ( ( Line = br.readLine().trim() ) != null ) { // This throws NULL POINTER after done with file String[] Temp = Line.split("\\|"); System.out.println(Temp[0] + " " + Temp[1] + " " + Line); ItemStack item = new ItemStack(Material.getMaterial(Temp[0]),Integer.parseInt(Temp[1])); pl.getLocation().getWorld().dropItemNaturally(pl.getLocation(), item); } is.close(); br.close(); FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Out.box",false); BufferedWriter bufferWritter = new BufferedWriter(fileWritter); bufferWritter.write(""); bufferWritter.close(); pl.sendMessage(ChatColor.GOLD + "Items Withdrawn"); } catch (IOException e){ pl.sendMessage(ChatColor.AQUA + "Error - Item Withdraw"); System.out.println(e); System.out.println("\n ** MC_Web Error - Account '" + Name + "' Failed To Withdraw Items"); }} else{ pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to withdraw items"); }}// Money Deposit else if ( args[0].equalsIgnoreCase("money") && args[1].equalsIgnoreCase("deposit") ){ if (args.length < 3 ){ error(pl); } else{ if(Emoney == true){ double Mon = 0.; double Bal = 0.; boolean pf = true; try{ Mon = Double.valueOf(args[2]).doubleValue(); FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name +"/Account.acc"); DataInputStream is = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(is)); Bal = Double.valueOf(br.readLine()).doubleValue(); is.close(); br.close(); } catch (Exception e){ pf = false; pl.sendMessage(ChatColor.AQUA + "Error - Invalad Number Conversion"); } if ( pf ){ int Enough_Money = Double.compare(Mon,Money); if (Enough_Money < 0 ) { try{ Bal += Mon; FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Account.acc",false); BufferedWriter bufferWritter = new BufferedWriter(fileWritter); bufferWritter.write(Bal +"\n"); bufferWritter.close(); account.getHoldings().subtract(Mon); pl.sendMessage(ChatColor.GOLD + ""+ Mon + " " + Money_Name + " has been deposited"); pl.sendMessage(ChatColor.GOLD + "Account balance is now " + Trun.format(Bal) + " " + Money_Name); } catch (IOException e){ pl.sendMessage(ChatColor.AQUA + "Error - Making Deposit"); System.out.println("\n ** MC_Web Error - '" + Name + "' deposit failed"); }} else{ pl.sendMessage(ChatColor.AQUA + "Too Much To Deposit: " + Trun.format(Mon) + " " + Money_Name); }} } else{ pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to deposit money"); }}}// Money Withdraw else if ( args[0].equalsIgnoreCase("money") && args[1].equalsIgnoreCase("withdraw") ){ if (args.length < 3 ){ error(pl); } else{ if(Imoney == true){ double Mon = 0.; double Bal = 0.; boolean pf = true; try{ Mon = Double.valueOf(args[2]).doubleValue(); FileInputStream fstream = new FileInputStream("MC_Web/Users/" + Name +"/Account.acc"); DataInputStream is = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(is)); Bal = Double.valueOf(br.readLine().trim() ).doubleValue(); is.close(); br.close(); } catch (Exception e){ pf = false; pl.sendMessage(ChatColor.AQUA + "Error - Invalad Number Conversion"); } if ( pf ){ int Enough_Money = Double.compare(Bal,Mon); if (Enough_Money > 0 ){ try{ Bal -= Mon; FileWriter fileWritter = new FileWriter("MC_Web/Users/" + Name +"/Account.acc",false); BufferedWriter bufferWritter = new BufferedWriter(fileWritter); bufferWritter.write(Bal +"\n"); bufferWritter.close(); account.getHoldings().add(Mon); pl.sendMessage(ChatColor.GOLD + ""+ Mon + " " + Money_Name + " has been withdrawn"); pl.sendMessage(ChatColor.GOLD + "Account balance is now " + Trun.format(Bal) + " " + Money_Name); } catch (IOException e){ pl.sendMessage(ChatColor.AQUA + "Error - Making Withdraw"); System.out.println("\n ** MC_Web Error - '" + Name + "' withdraw failed"); }} else{ pl.sendMessage(ChatColor.AQUA + "Too Much To Withdraw: " + Trun.format(Mon) + " " + Money_Name); } }} else{ pl.sendMessage(ChatColor.AQUA + "Error - You are not allowed to withdraw money"); }}}// Catch else{ error(pl); }}} return true; }}[/source]

PARTNERS