Decided I dislike var-args and money transactions should have an optional freetext message.
This commit is contained in:
parent
813661877d
commit
8465250061
@ -99,83 +99,119 @@ public class Money
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// MODIFY
|
// MOVE
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
// MOVE
|
public static boolean move(Object from, Object to, Object by, double amount, Collection<String> categories, String message)
|
||||||
|
{
|
||||||
|
if (disabled()) return false;
|
||||||
|
return mixin.move(accountId(from), accountId(to), accountId(by), amount, categories, message);
|
||||||
|
}
|
||||||
|
public static boolean move(Object from, Object to, Object by, double amount, String category, String message)
|
||||||
|
{
|
||||||
|
if (disabled()) return false;
|
||||||
|
return mixin.move(accountId(from), accountId(to), accountId(by), amount, category, message);
|
||||||
|
}
|
||||||
public static boolean move(Object from, Object to, Object by, double amount, Collection<String> categories)
|
public static boolean move(Object from, Object to, Object by, double amount, Collection<String> categories)
|
||||||
{
|
{
|
||||||
if (disabled()) return false;
|
if (disabled()) return false;
|
||||||
return mixin.move(accountId(from), accountId(to), accountId(by), amount, categories);
|
return mixin.move(accountId(from), accountId(to), accountId(by), amount, categories);
|
||||||
}
|
}
|
||||||
|
public static boolean move(Object from, Object to, Object by, double amount, String category)
|
||||||
public static boolean move(Object from, Object to, Object by, double amount, String... categories)
|
|
||||||
{
|
{
|
||||||
if (disabled()) return false;
|
if (disabled()) return false;
|
||||||
return mixin.move(accountId(from), accountId(to), accountId(by), amount, categories);
|
return mixin.move(accountId(from), accountId(to), accountId(by), amount, category);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean move(Object from, Object to, Object by, double amount)
|
public static boolean move(Object from, Object to, Object by, double amount)
|
||||||
{
|
{
|
||||||
if (disabled()) return false;
|
if (disabled()) return false;
|
||||||
return mixin.move(accountId(from), accountId(to), accountId(by), amount);
|
return mixin.move(accountId(from), accountId(to), accountId(by), amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
// SPAWN
|
// SPAWN
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public static boolean spawn(Object to, Object by, double amount, Collection<String> categories, String message)
|
||||||
|
{
|
||||||
|
if (disabled()) return false;
|
||||||
|
return mixin.spawn(accountId(to), accountId(by), amount, categories, message);
|
||||||
|
}
|
||||||
|
public static boolean spawn(Object to, Object by, double amount, String category, String message)
|
||||||
|
{
|
||||||
|
if (disabled()) return false;
|
||||||
|
return mixin.spawn(accountId(to), accountId(by), amount, category, message);
|
||||||
|
}
|
||||||
public static boolean spawn(Object to, Object by, double amount, Collection<String> categories)
|
public static boolean spawn(Object to, Object by, double amount, Collection<String> categories)
|
||||||
{
|
{
|
||||||
if (disabled()) return false;
|
if (disabled()) return false;
|
||||||
return mixin.spawn(accountId(to), accountId(by), amount, categories);
|
return mixin.spawn(accountId(to), accountId(by), amount, categories);
|
||||||
}
|
}
|
||||||
|
public static boolean spawn(Object to, Object by, double amount, String category)
|
||||||
public static boolean spawn(Object to, Object by, double amount, String... categories)
|
|
||||||
{
|
{
|
||||||
if (disabled()) return false;
|
if (disabled()) return false;
|
||||||
return mixin.spawn(accountId(to), accountId(by), amount, categories);
|
return mixin.spawn(accountId(to), accountId(by), amount, category);
|
||||||
}
|
}
|
||||||
|
public static boolean spawn(Object to, Object by, double amount)
|
||||||
public static boolean spawn(Object toId, Object by, double amount)
|
|
||||||
{
|
{
|
||||||
if (disabled()) return false;
|
if (disabled()) return false;
|
||||||
return mixin.spawn(accountId(toId), accountId(by), amount);
|
return mixin.spawn(accountId(to), accountId(by), amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
// DESPAWN
|
// DESPAWN
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public static boolean despawn(Object from, Object by, double amount, Collection<String> categories, String message)
|
||||||
|
{
|
||||||
|
if (disabled()) return false;
|
||||||
|
return mixin.despawn(accountId(from), accountId(by), amount, categories, message);
|
||||||
|
}
|
||||||
|
public static boolean despawn(Object from, Object by, double amount, String category, String message)
|
||||||
|
{
|
||||||
|
if (disabled()) return false;
|
||||||
|
return mixin.despawn(accountId(from), accountId(by), amount, category, message);
|
||||||
|
}
|
||||||
public static boolean despawn(Object from, Object by, double amount, Collection<String> categories)
|
public static boolean despawn(Object from, Object by, double amount, Collection<String> categories)
|
||||||
{
|
{
|
||||||
if (disabled()) return false;
|
if (disabled()) return false;
|
||||||
return mixin.despawn(accountId(from), accountId(by), amount, categories);
|
return mixin.despawn(accountId(from), accountId(by), amount, categories);
|
||||||
}
|
}
|
||||||
|
public static boolean despawn(Object from, Object by, double amount, String category)
|
||||||
public static boolean despawn(Object from, Object by, double amount, String... categories)
|
|
||||||
{
|
{
|
||||||
if (disabled()) return false;
|
if (disabled()) return false;
|
||||||
return mixin.despawn(accountId(from), accountId(by), amount, categories);
|
return mixin.despawn(accountId(from), accountId(by), amount, category);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean despawn(Object from, Object by, double amount)
|
public static boolean despawn(Object from, Object by, double amount)
|
||||||
{
|
{
|
||||||
if (disabled()) return false;
|
if (disabled()) return false;
|
||||||
return mixin.despawn(accountId(from), accountId(by), amount);
|
return mixin.despawn(accountId(from), accountId(by), amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
// SET
|
// SET
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public static boolean set(Object account, Object by, double amount, Collection<String> categories, String message)
|
||||||
|
{
|
||||||
|
if (disabled()) return false;
|
||||||
|
return mixin.set(accountId(account), accountId(by), amount, categories, message);
|
||||||
|
}
|
||||||
|
public static boolean set(Object account, Object by, double amount, String category, String message)
|
||||||
|
{
|
||||||
|
if (disabled()) return false;
|
||||||
|
return mixin.set(accountId(account), accountId(by), amount, category, message);
|
||||||
|
}
|
||||||
public static boolean set(Object account, Object by, double amount, Collection<String> categories)
|
public static boolean set(Object account, Object by, double amount, Collection<String> categories)
|
||||||
{
|
{
|
||||||
if (disabled()) return false;
|
if (disabled()) return false;
|
||||||
return mixin.set(accountId(account), accountId(by), amount, categories);
|
return mixin.set(accountId(account), accountId(by), amount, categories);
|
||||||
}
|
}
|
||||||
|
public static boolean set(Object account, Object by, double amount, String category)
|
||||||
public static boolean set(Object account, Object by, double amount, String... categories)
|
|
||||||
{
|
{
|
||||||
if (disabled()) return false;
|
if (disabled()) return false;
|
||||||
return mixin.set(accountId(account), accountId(by), amount, categories);
|
return mixin.set(accountId(account), accountId(by), amount, category);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean set(Object account, Object by, double amount)
|
public static boolean set(Object account, Object by, double amount)
|
||||||
{
|
{
|
||||||
if (disabled()) return false;
|
if (disabled()) return false;
|
||||||
|
@ -36,20 +36,28 @@ public interface MoneyMixin
|
|||||||
// MODIFY
|
// MODIFY
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public boolean move(String fromId, String toId, String byId, double amount, Collection<String> categories, String message);
|
||||||
|
public boolean move(String fromId, String toId, String byId, double amount, String category, String message);
|
||||||
public boolean move(String fromId, String toId, String byId, double amount, Collection<String> categories);
|
public boolean move(String fromId, String toId, String byId, double amount, Collection<String> categories);
|
||||||
public boolean move(String fromId, String toId, String byId, double amount, String... categories);
|
public boolean move(String fromId, String toId, String byId, double amount, String category);
|
||||||
public boolean move(String fromId, String toId, String byId, double amount);
|
public boolean move(String fromId, String toId, String byId, double amount);
|
||||||
|
|
||||||
|
public boolean spawn(String toId, String byId, double amount, Collection<String> categories, String message);
|
||||||
|
public boolean spawn(String toId, String byId, double amount, String category, String message);
|
||||||
public boolean spawn(String toId, String byId, double amount, Collection<String> categories);
|
public boolean spawn(String toId, String byId, double amount, Collection<String> categories);
|
||||||
public boolean spawn(String toId, String byId, double amount, String... categories);
|
public boolean spawn(String toId, String byId, double amount, String category);
|
||||||
public boolean spawn(String toId, String byId, double amount);
|
public boolean spawn(String toId, String byId, double amount);
|
||||||
|
|
||||||
|
public boolean despawn(String fromId, String byId, double amount, Collection<String> categories, String message);
|
||||||
|
public boolean despawn(String fromId, String byId, double amount, String category, String message);
|
||||||
public boolean despawn(String fromId, String byId, double amount, Collection<String> categories);
|
public boolean despawn(String fromId, String byId, double amount, Collection<String> categories);
|
||||||
public boolean despawn(String fromId, String byId, double amount, String... categories);
|
public boolean despawn(String fromId, String byId, double amount, String category);
|
||||||
public boolean despawn(String fromId, String byId, double amount);
|
public boolean despawn(String fromId, String byId, double amount);
|
||||||
|
|
||||||
|
public boolean set(String accountId, String byId, double amount, Collection<String> categories, String message);
|
||||||
|
public boolean set(String accountId, String byId, double amount, String category, String message);
|
||||||
public boolean set(String accountId, String byId, double amount, Collection<String> categories);
|
public boolean set(String accountId, String byId, double amount, Collection<String> categories);
|
||||||
public boolean set(String accountId, String byId, double amount, String... categories);
|
public boolean set(String accountId, String byId, double amount, String category);
|
||||||
public boolean set(String accountId, String byId, double amount);
|
public boolean set(String accountId, String byId, double amount);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,81 +7,102 @@ import java.util.Collection;
|
|||||||
public abstract class MoneyMixinAbstract implements MoneyMixin
|
public abstract class MoneyMixinAbstract implements MoneyMixin
|
||||||
{
|
{
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// MODIFY
|
// MOVE
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
// MOVE
|
|
||||||
|
|
||||||
// this is the abstract one
|
// this is the abstract one
|
||||||
/*
|
// public boolean move(String fromId, String toId, String byId, double amount, Collection<String> categories, String message);
|
||||||
|
|
||||||
|
public boolean move(String fromId, String toId, String byId, double amount, String category, String message)
|
||||||
|
{
|
||||||
|
return this.move(fromId, toId, byId, amount, Arrays.asList(category), message);
|
||||||
|
}
|
||||||
public boolean move(String fromId, String toId, String byId, double amount, Collection<String> categories)
|
public boolean move(String fromId, String toId, String byId, double amount, Collection<String> categories)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
return this.move(fromId, toId, byId, amount, categories, null);
|
||||||
return false;
|
}
|
||||||
}*/
|
public boolean move(String fromId, String toId, String byId, double amount, String category)
|
||||||
|
{
|
||||||
public boolean move(String fromId, String toId, String byId, double amount, String... categories)
|
return this.move(fromId, toId, byId, amount, Arrays.asList(category), null);
|
||||||
{
|
|
||||||
return this.move(fromId, toId, byId, amount, Arrays.asList(categories));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean move(String fromId, String toId, String byId, double amount)
|
public boolean move(String fromId, String toId, String byId, double amount)
|
||||||
{
|
{
|
||||||
return this.move(fromId, toId, byId, amount, new ArrayList<String>());
|
return this.move(fromId, toId, byId, amount, new ArrayList<String>(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
// SPAWN
|
// SPAWN
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public boolean spawn(String toId, String byId, double amount, Collection<String> categories, String message)
|
||||||
|
{
|
||||||
|
return this.move(null, toId, byId, amount, categories, message);
|
||||||
|
}
|
||||||
|
public boolean spawn(String toId, String byId, double amount, String category, String message)
|
||||||
|
{
|
||||||
|
return this.move(null, toId, byId, amount, category, message);
|
||||||
|
}
|
||||||
public boolean spawn(String toId, String byId, double amount, Collection<String> categories)
|
public boolean spawn(String toId, String byId, double amount, Collection<String> categories)
|
||||||
{
|
{
|
||||||
// Based on Move
|
|
||||||
return this.move(null, toId, byId, amount, categories);
|
return this.move(null, toId, byId, amount, categories);
|
||||||
}
|
}
|
||||||
|
public boolean spawn(String toId, String byId, double amount, String category)
|
||||||
public boolean spawn(String toId, String byId, double amount, String... categories)
|
|
||||||
{
|
{
|
||||||
return this.spawn(toId, byId, amount, Arrays.asList(categories));
|
return this.move(null, toId, byId, amount, category);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean spawn(String toId, String byId, double amount)
|
public boolean spawn(String toId, String byId, double amount)
|
||||||
{
|
{
|
||||||
return this.spawn(toId, byId, amount, new ArrayList<String>());
|
return this.move(null, toId, byId, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
// DESPAWN
|
// DESPAWN
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public boolean despawn(String fromId, String byId, double amount, Collection<String> categories, String message)
|
||||||
|
{
|
||||||
|
return this.move(fromId, null, byId, amount, categories, message);
|
||||||
|
}
|
||||||
|
public boolean despawn(String fromId, String byId, double amount, String category, String message)
|
||||||
|
{
|
||||||
|
return this.move(fromId, null, byId, amount, category, message);
|
||||||
|
}
|
||||||
public boolean despawn(String fromId, String byId, double amount, Collection<String> categories)
|
public boolean despawn(String fromId, String byId, double amount, Collection<String> categories)
|
||||||
{
|
{
|
||||||
// Based on Move
|
|
||||||
return this.move(fromId, null, byId, amount, categories);
|
return this.move(fromId, null, byId, amount, categories);
|
||||||
}
|
}
|
||||||
|
public boolean despawn(String fromId, String byId, double amount, String category)
|
||||||
public boolean despawn(String fromId, String byId, double amount, String... categories)
|
|
||||||
{
|
{
|
||||||
return this.despawn(fromId, byId, amount, Arrays.asList(categories));
|
return this.move(fromId, null, byId, amount, category);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean despawn(String fromId, String byId, double amount)
|
public boolean despawn(String fromId, String byId, double amount)
|
||||||
{
|
{
|
||||||
return this.despawn(fromId, byId, amount, new ArrayList<String>());
|
return this.move(fromId, null, byId, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
// SET
|
// SET
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public boolean set(String accountId, String byId, double amount, Collection<String> categories, String message)
|
||||||
|
{
|
||||||
|
return this.move(null, accountId, byId, amount - this.get(accountId), categories, message);
|
||||||
|
}
|
||||||
|
public boolean set(String accountId, String byId, double amount, String category, String message)
|
||||||
|
{
|
||||||
|
return this.move(null, accountId, byId, amount - this.get(accountId), category, message);
|
||||||
|
}
|
||||||
public boolean set(String accountId, String byId, double amount, Collection<String> categories)
|
public boolean set(String accountId, String byId, double amount, Collection<String> categories)
|
||||||
{
|
{
|
||||||
// Based on Move
|
|
||||||
return this.move(null, accountId, byId, amount - this.get(accountId), categories);
|
return this.move(null, accountId, byId, amount - this.get(accountId), categories);
|
||||||
}
|
}
|
||||||
|
public boolean set(String accountId, String byId, double amount, String category)
|
||||||
public boolean set(String accountId, String byId, double amount, String... categories)
|
|
||||||
{
|
{
|
||||||
return this.set(accountId, byId, amount, Arrays.asList(categories));
|
return this.move(null, accountId, byId, amount - this.get(accountId), category);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean set(String accountId, String byId, double amount)
|
public boolean set(String accountId, String byId, double amount)
|
||||||
{
|
{
|
||||||
return this.set(accountId, byId, amount, new ArrayList<String>());
|
return this.move(null, accountId, byId, amount - this.get(accountId));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -11,6 +11,7 @@ import com.massivecraft.mcore.util.MUtil;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
|
|
||||||
public class MoneyMixinVault extends MoneyMixinAbstract
|
public class MoneyMixinVault extends MoneyMixinAbstract
|
||||||
@ -117,7 +118,7 @@ public class MoneyMixinVault extends MoneyMixinAbstract
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean move(String fromId, String toId, String byId, double amount, Collection<String> categories)
|
public boolean move(String fromId, String toId, String byId, double amount, Collection<String> categories, String message)
|
||||||
{
|
{
|
||||||
// Ensure positive direction
|
// Ensure positive direction
|
||||||
if (amount < 0)
|
if (amount < 0)
|
||||||
@ -176,4 +177,6 @@ public class MoneyMixinVault extends MoneyMixinAbstract
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user