public double withdraw ( double amount , String world , String currencyName , Cause cause , String causeReason ) { BalanceTable balanceTable ; double result = getBalance ( world , currencyName ) - format ( amount ) ; if ( ! Common . getInstance ( ) . getWorldGroupManager ( ) . worldGroupExist ( world ) ) { world = Common . getInstance ( ) . getWorldGroupManager ( ) . getWorldGroupName ( world ) ; } Currency currency = Common . getInstance ( ) . getCurrencyManager ( ) . getCurrency ( currencyName ) ; if ( currency != null ) { if ( ! hasInfiniteMoney ( ) ) { result = Common . getInstance ( ) . getStorageHandler ( ) . getStorageEngine ( ) . setBalance ( this , result , currency , world ) ; Common . getInstance ( ) . writeLog ( LogInfo . WITHDRAW , cause , causeReason , this , amount , currency , world ) ; Common . getInstance ( ) . getServerCaller ( ) . throwEvent ( new EconomyChangeEvent ( this . getAccountName ( ) , result ) ) ; } else { result = Double . MAX_VALUE ; } } return format ( result ) ; }
withdraw a certain amount of money in the account