mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-18 04:21:31 +02:00
EXPIRIMENTAL Essentials Iconomy Bridge for iConomy 5.0. This has reverse compatability and is tested but unsure of 5.0 API, needs testing but no 5.0 API plugins yet!
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1324 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
74
EssentialsiConomyBridge5/build.xml
Normal file
74
EssentialsiConomyBridge5/build.xml
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- You may freely edit this file. See commented blocks below for -->
|
||||||
|
<!-- some examples of how to customize the build. -->
|
||||||
|
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||||
|
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||||
|
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||||
|
<!-- the Compile on Save feature is turned off for the project. -->
|
||||||
|
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||||
|
<!-- in the project's Project Properties dialog box.-->
|
||||||
|
<project name="EssentialsiConomyBridge5" default="default" basedir=".">
|
||||||
|
<description>Builds, tests, and runs the project EssentialsiConomyBridge5.</description>
|
||||||
|
<import file="nbproject/build-impl.xml"/>
|
||||||
|
<!--
|
||||||
|
|
||||||
|
There exist several targets which are by default empty and which can be
|
||||||
|
used for execution of your tasks. These targets are usually executed
|
||||||
|
before and after some main targets. They are:
|
||||||
|
|
||||||
|
-pre-init: called before initialization of project properties
|
||||||
|
-post-init: called after initialization of project properties
|
||||||
|
-pre-compile: called before javac compilation
|
||||||
|
-post-compile: called after javac compilation
|
||||||
|
-pre-compile-single: called before javac compilation of single file
|
||||||
|
-post-compile-single: called after javac compilation of single file
|
||||||
|
-pre-compile-test: called before javac compilation of JUnit tests
|
||||||
|
-post-compile-test: called after javac compilation of JUnit tests
|
||||||
|
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||||
|
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||||
|
-pre-jar: called before JAR building
|
||||||
|
-post-jar: called after JAR building
|
||||||
|
-post-clean: called after cleaning build products
|
||||||
|
|
||||||
|
(Targets beginning with '-' are not intended to be called on their own.)
|
||||||
|
|
||||||
|
Example of inserting an obfuscator after compilation could look like this:
|
||||||
|
|
||||||
|
<target name="-post-compile">
|
||||||
|
<obfuscate>
|
||||||
|
<fileset dir="${build.classes.dir}"/>
|
||||||
|
</obfuscate>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
For list of available properties check the imported
|
||||||
|
nbproject/build-impl.xml file.
|
||||||
|
|
||||||
|
|
||||||
|
Another way to customize the build is by overriding existing main targets.
|
||||||
|
The targets of interest are:
|
||||||
|
|
||||||
|
-init-macrodef-javac: defines macro for javac compilation
|
||||||
|
-init-macrodef-junit: defines macro for junit execution
|
||||||
|
-init-macrodef-debug: defines macro for class debugging
|
||||||
|
-init-macrodef-java: defines macro for class execution
|
||||||
|
-do-jar-with-manifest: JAR building (if you are using a manifest)
|
||||||
|
-do-jar-without-manifest: JAR building (if you are not using a manifest)
|
||||||
|
run: execution of project
|
||||||
|
-javadoc-build: Javadoc generation
|
||||||
|
test-report: JUnit report generation
|
||||||
|
|
||||||
|
An example of overriding the target for project execution could look like this:
|
||||||
|
|
||||||
|
<target name="run" depends="EssentialsiConomyBridge5-impl.jar">
|
||||||
|
<exec dir="bin" executable="launcher.exe">
|
||||||
|
<arg file="${dist.jar}"/>
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
Notice that the overridden target depends on the jar target and not only on
|
||||||
|
the compile target as the regular run target does. Again, for a list of available
|
||||||
|
properties which you can use, check the target you are overriding in the
|
||||||
|
nbproject/build-impl.xml file.
|
||||||
|
|
||||||
|
-->
|
||||||
|
</project>
|
3
EssentialsiConomyBridge5/manifest.mf
Normal file
3
EssentialsiConomyBridge5/manifest.mf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
X-COMMENT: Main-Class will be added automatically by build
|
||||||
|
|
1080
EssentialsiConomyBridge5/nbproject/build-impl.xml
Normal file
1080
EssentialsiConomyBridge5/nbproject/build-impl.xml
Normal file
File diff suppressed because it is too large
Load Diff
8
EssentialsiConomyBridge5/nbproject/genfiles.properties
Normal file
8
EssentialsiConomyBridge5/nbproject/genfiles.properties
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
build.xml.data.CRC32=301314e9
|
||||||
|
build.xml.script.CRC32=7a4c0fa9
|
||||||
|
build.xml.stylesheet.CRC32=28e38971@1.43.1.45
|
||||||
|
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||||
|
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||||
|
nbproject/build-impl.xml.data.CRC32=301314e9
|
||||||
|
nbproject/build-impl.xml.script.CRC32=82405830
|
||||||
|
nbproject/build-impl.xml.stylesheet.CRC32=0c01fd8e@1.43.1.45
|
78
EssentialsiConomyBridge5/nbproject/project.properties
Normal file
78
EssentialsiConomyBridge5/nbproject/project.properties
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
annotation.processing.enabled=true
|
||||||
|
annotation.processing.enabled.in.editor=false
|
||||||
|
annotation.processing.run.all.processors=true
|
||||||
|
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||||
|
application.title=EssentialsiConomyBridge5
|
||||||
|
application.vendor=schlex
|
||||||
|
build.classes.dir=${build.dir}/classes
|
||||||
|
build.classes.excludes=**/*.java,**/*.form
|
||||||
|
# This directory is removed when the project is cleaned:
|
||||||
|
build.dir=build
|
||||||
|
build.generated.dir=${build.dir}/generated
|
||||||
|
build.generated.sources.dir=${build.dir}/generated-sources
|
||||||
|
# Only compile against the classpath explicitly listed here:
|
||||||
|
build.sysclasspath=ignore
|
||||||
|
build.test.classes.dir=${build.dir}/test/classes
|
||||||
|
build.test.results.dir=${build.dir}/test/results
|
||||||
|
# Uncomment to specify the preferred debugger connection transport:
|
||||||
|
#debug.transport=dt_socket
|
||||||
|
debug.classpath=\
|
||||||
|
${run.classpath}
|
||||||
|
debug.test.classpath=\
|
||||||
|
${run.test.classpath}
|
||||||
|
# This directory is removed when the project is cleaned:
|
||||||
|
dist.dir=dist
|
||||||
|
dist.jar=${dist.dir}/EssentialsiConomyBridge5.jar
|
||||||
|
dist.javadoc.dir=${dist.dir}/javadoc
|
||||||
|
endorsed.classpath=
|
||||||
|
excludes=
|
||||||
|
file.reference.bukkit-0.0.1-SNAPSHOT.jar=../lib/bukkit-0.0.1-SNAPSHOT.jar
|
||||||
|
file.reference.Essentials.jar=..\\Essentials\\dist\\Essentials.jar
|
||||||
|
file.reference.Essentials.jar=../lib/bukkit-0.0.1-SNAPSHOT.jar
|
||||||
|
includes=**
|
||||||
|
jar.compress=false
|
||||||
|
javac.classpath=\
|
||||||
|
${reference.Essentials.jar}:\
|
||||||
|
${file.reference.bukkit-0.0.1-SNAPSHOT.jar}
|
||||||
|
javac.compilerargs=
|
||||||
|
javac.deprecation=false
|
||||||
|
javac.processorpath=\
|
||||||
|
${javac.classpath}
|
||||||
|
javac.source=1.6
|
||||||
|
javac.target=1.6
|
||||||
|
javac.test.classpath=\
|
||||||
|
${javac.classpath}:\
|
||||||
|
${build.classes.dir}
|
||||||
|
javac.test.processorpath=\
|
||||||
|
${javac.test.classpath}
|
||||||
|
javadoc.additionalparam=
|
||||||
|
javadoc.author=false
|
||||||
|
javadoc.encoding=${source.encoding}
|
||||||
|
javadoc.noindex=false
|
||||||
|
javadoc.nonavbar=false
|
||||||
|
javadoc.notree=false
|
||||||
|
javadoc.private=false
|
||||||
|
javadoc.splitindex=true
|
||||||
|
javadoc.use=true
|
||||||
|
javadoc.version=false
|
||||||
|
javadoc.windowtitle=
|
||||||
|
main.class=
|
||||||
|
manifest.file=manifest.mf
|
||||||
|
meta.inf.dir=${src.dir}/META-INF
|
||||||
|
mkdist.disabled=false
|
||||||
|
platform.active=default_platform
|
||||||
|
project.Essentials=../Essentials
|
||||||
|
reference.Essentials.jar=${project.Essentials}/dist/Essentials.jar
|
||||||
|
run.classpath=\
|
||||||
|
${javac.classpath}:\
|
||||||
|
${build.classes.dir}
|
||||||
|
# Space-separated list of JVM arguments used when running the project
|
||||||
|
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
|
||||||
|
# or test-sys-prop.name=value to set system properties for unit tests):
|
||||||
|
run.jvmargs=
|
||||||
|
run.test.classpath=\
|
||||||
|
${javac.test.classpath}:\
|
||||||
|
${build.test.classes.dir}
|
||||||
|
source.encoding=UTF-8
|
||||||
|
src.dir=src
|
||||||
|
test.src.dir=test
|
28
EssentialsiConomyBridge5/nbproject/project.xml
Normal file
28
EssentialsiConomyBridge5/nbproject/project.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||||
|
<type>org.netbeans.modules.java.j2seproject</type>
|
||||||
|
<configuration>
|
||||||
|
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||||
|
<name>EssentialsiConomyBridge5</name>
|
||||||
|
<source-roots>
|
||||||
|
<root id="src.dir"/>
|
||||||
|
</source-roots>
|
||||||
|
<test-roots>
|
||||||
|
<root id="test.src.dir"/>
|
||||||
|
</test-roots>
|
||||||
|
</data>
|
||||||
|
<libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
|
||||||
|
<definitions>../lib/nblibraries.properties</definitions>
|
||||||
|
</libraries>
|
||||||
|
<references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
|
||||||
|
<reference>
|
||||||
|
<foreign-project>Essentials</foreign-project>
|
||||||
|
<artifact-type>jar</artifact-type>
|
||||||
|
<script>build.xml</script>
|
||||||
|
<target>jar</target>
|
||||||
|
<clean-target>clean</clean-target>
|
||||||
|
<id>jar</id>
|
||||||
|
</reference>
|
||||||
|
</references>
|
||||||
|
</configuration>
|
||||||
|
</project>
|
@@ -0,0 +1,53 @@
|
|||||||
|
|
||||||
|
package com.nijiko.coelho.iConomy;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.api.Economy;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class banks
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public int count(String name){
|
||||||
|
int count=0;
|
||||||
|
int breaker = 0;
|
||||||
|
for (int ctr = 1; breaker != 1; ctr++)
|
||||||
|
{
|
||||||
|
if (ctr == 1)
|
||||||
|
{
|
||||||
|
if (Economy.accountExist(name + "-bank"))
|
||||||
|
{
|
||||||
|
count = count + 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
breaker = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Economy.accountExist(name + "-bank" + Integer.toString(ctr)) && ctr != 1)
|
||||||
|
{
|
||||||
|
count = count + 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
breaker = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@@ -0,0 +1,26 @@
|
|||||||
|
package com.nijiko.coelho.iConomy;
|
||||||
|
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
|
||||||
|
public class existCheck
|
||||||
|
{
|
||||||
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
|
//We have to make sure the user exists!
|
||||||
|
|
||||||
|
public static boolean exist(String name)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (name == null)
|
||||||
|
{
|
||||||
|
logger.info("Essentials iConomy Bridge - Whatever plugin is calling for users that are null is BROKEN!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (Bukkit.getServer().getPlayer(name) != null)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,105 @@
|
|||||||
|
package com.nijiko.coelho.iConomy;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.Essentials;
|
||||||
|
import com.earth2me.essentials.api.Economy;
|
||||||
|
import com.nijiko.coelho.iConomy.system.Account;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import com.nijiko.coelho.iConomy.system.Bank;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is not iConomy and I take NO credit for iConomy!
|
||||||
|
* This is FayConomy, a iConomy Essentials Eco bridge!
|
||||||
|
* @author Xeology
|
||||||
|
*/
|
||||||
|
public class iConomy extends JavaPlugin
|
||||||
|
{
|
||||||
|
public static Bank Bank=null;
|
||||||
|
public static boolean Banking = true;
|
||||||
|
public static boolean BankingMultiple = true;
|
||||||
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnable()
|
||||||
|
{
|
||||||
|
Bank=new Bank("hello");
|
||||||
|
PluginManager pm = this.getServer().getPluginManager();
|
||||||
|
Plugin p = pm.getPlugin("Essentials");
|
||||||
|
if (p != null)
|
||||||
|
{
|
||||||
|
if (!pm.isPluginEnabled(p))
|
||||||
|
{
|
||||||
|
pm.enablePlugin(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String version = this.getDescription().getDescription().replaceAll(".*: ", "");
|
||||||
|
if (!version.equals(Essentials.getStatic().getDescription().getVersion()))
|
||||||
|
{
|
||||||
|
logger.log(Level.WARNING, "Version mismatch! Please update all Essentials jars to the same version.");
|
||||||
|
}
|
||||||
|
Essentials.getStatic().setIConomyFallback(false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
logger.info("Loaded " + this.getDescription().getDescription() + " by " + Essentials.AUTHORS);
|
||||||
|
logger.info("Make sure you don't have iConomy installed, if you use this.");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Fake bank
|
||||||
|
public static Bank getBank()
|
||||||
|
{
|
||||||
|
return Bank;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String format(String account)
|
||||||
|
{
|
||||||
|
return getAccount(account).getHoldings().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String format(String bank, String account)
|
||||||
|
{
|
||||||
|
return (new Bank(bank)).getAccount(account).getHoldings().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String format(double amount)
|
||||||
|
{
|
||||||
|
return Economy.format(amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Account getAccount(String name)
|
||||||
|
{
|
||||||
|
Account Account = null;
|
||||||
|
Account = new Account(name);
|
||||||
|
if (!existCheck.exist(name))
|
||||||
|
{
|
||||||
|
if (!Economy.accountExist(name))
|
||||||
|
{
|
||||||
|
Economy.newAccount(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Account;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean hasAccount(String name)
|
||||||
|
{
|
||||||
|
if (!existCheck.exist(name))
|
||||||
|
{
|
||||||
|
if (!Economy.accountExist(name))
|
||||||
|
{
|
||||||
|
Economy.newAccount(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,212 @@
|
|||||||
|
package com.nijiko.coelho.iConomy.system;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.api.Economy;
|
||||||
|
import com.nijiko.coelho.iConomy.existCheck;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|
||||||
|
public class Account
|
||||||
|
{
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public Holdings getHoldings()
|
||||||
|
{
|
||||||
|
return new Holdings(name, this.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Essentials does not support hidden accounts.
|
||||||
|
* @return false
|
||||||
|
*/
|
||||||
|
public boolean setHidden(boolean hidden)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Simply set the account variable type?
|
||||||
|
public Account(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getBalance()
|
||||||
|
{
|
||||||
|
if (!existCheck.exist(name))
|
||||||
|
{
|
||||||
|
if (Economy.accountExist(name))
|
||||||
|
{
|
||||||
|
return Economy.getMoney(name);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return Economy.getMoney(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBalance(double bal)
|
||||||
|
{
|
||||||
|
if (!existCheck.exist(name))
|
||||||
|
{
|
||||||
|
if (Economy.accountExist(name))
|
||||||
|
{
|
||||||
|
Economy.setMoney(name, bal);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Economy.setMoney(name, bal);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(double money)
|
||||||
|
{
|
||||||
|
if (!existCheck.exist(name))
|
||||||
|
{
|
||||||
|
if (Economy.accountExist(name))
|
||||||
|
{
|
||||||
|
Economy.add(name, money);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Economy.add(name, money);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void divide(double money)
|
||||||
|
{
|
||||||
|
if (!existCheck.exist(name))
|
||||||
|
{
|
||||||
|
if (Economy.accountExist(name))
|
||||||
|
{
|
||||||
|
Economy.divide(name, money);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Economy.divide(name, money);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Bank> withBanks()
|
||||||
|
{
|
||||||
|
ArrayList<Bank> banks = new ArrayList<Bank>();
|
||||||
|
if (Economy.accountExist(name + "-bank"))
|
||||||
|
{
|
||||||
|
Bank bank = new Bank("EcoBanks");
|
||||||
|
banks.add(bank);
|
||||||
|
return banks;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Bank> getBankAccounts()
|
||||||
|
{
|
||||||
|
ArrayList<Bank> banks = new ArrayList<Bank>();
|
||||||
|
int breaker = 0;
|
||||||
|
Bank bank;
|
||||||
|
for (int ctr = 1; breaker != 1; ctr++)
|
||||||
|
{
|
||||||
|
if (ctr == 1)
|
||||||
|
{
|
||||||
|
if (Economy.accountExist(name + "-bank"))
|
||||||
|
{
|
||||||
|
bank = new Bank(name + "-bank");
|
||||||
|
banks.add(bank);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
breaker = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Economy.accountExist(name + "-bank" + Integer.toString(ctr)) && ctr != 1)
|
||||||
|
{
|
||||||
|
bank = new Bank(name + "-bank" + Integer.toString(ctr));
|
||||||
|
banks.add(bank);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
breaker = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void multiply(double money)
|
||||||
|
{
|
||||||
|
if (!existCheck.exist(name))
|
||||||
|
{
|
||||||
|
if (Economy.accountExist(name))
|
||||||
|
{
|
||||||
|
Economy.multiply(name, money);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Economy.multiply(name, money);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void subtract(double money)
|
||||||
|
{
|
||||||
|
if (!existCheck.exist(name))
|
||||||
|
{
|
||||||
|
if (Economy.accountExist(name))
|
||||||
|
{
|
||||||
|
Economy.subtract(name, money);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Economy.subtract(name, money);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetBalance()
|
||||||
|
{
|
||||||
|
this.setBalance(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasEnough(double amount)
|
||||||
|
{
|
||||||
|
return amount <= this.getBalance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasOver(double amount)
|
||||||
|
{
|
||||||
|
return amount < this.getBalance();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Essentials does not support hidden accounts.
|
||||||
|
* @return false
|
||||||
|
*/
|
||||||
|
public boolean isHidden()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNegative()
|
||||||
|
{
|
||||||
|
return this.getBalance() < 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bank getMainBank()
|
||||||
|
{
|
||||||
|
Bank bank = null;
|
||||||
|
if (!Economy.accountExist(name + "-bank"))
|
||||||
|
{
|
||||||
|
Economy.newAccount(name + "-bank");
|
||||||
|
bank = new Bank(name + "-bank");
|
||||||
|
return bank;
|
||||||
|
}
|
||||||
|
bank = new Bank(name + "-bank");
|
||||||
|
return bank;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Because some plugins like to use depricated methods I must save
|
||||||
|
* admins' log from the overflow of dumb
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public void save()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
;
|
||||||
|
}
|
@@ -0,0 +1,73 @@
|
|||||||
|
package com.nijiko.coelho.iConomy.system;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.api.Economy;
|
||||||
|
import com.nijiko.coelho.iConomy.existCheck;
|
||||||
|
|
||||||
|
|
||||||
|
public class Bank
|
||||||
|
{
|
||||||
|
private String id = null;
|
||||||
|
private String name = null;
|
||||||
|
|
||||||
|
public Bank(String name)
|
||||||
|
{
|
||||||
|
this.id = name;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
//The fake formatter
|
||||||
|
|
||||||
|
public String format(double amount)
|
||||||
|
{
|
||||||
|
return Economy.format(amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Fake currency!
|
||||||
|
public String getCurrency()
|
||||||
|
{
|
||||||
|
return Economy.getCurrency();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Fake "does player have an account?" but essentials eco doesnt need to make one, so TRUE, unless its an NPC.
|
||||||
|
public boolean hasAccount(String account)
|
||||||
|
{
|
||||||
|
if (!existCheck.exist(account))
|
||||||
|
{
|
||||||
|
if (!Economy.accountExist(account))
|
||||||
|
{
|
||||||
|
Economy.newAccount(account);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//simply switches the name to an account type?
|
||||||
|
public Account getAccount(String name)
|
||||||
|
{
|
||||||
|
Account Account = null;
|
||||||
|
Account = new Account(name);
|
||||||
|
hasAccount(name);
|
||||||
|
return Account;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Fake remove account
|
||||||
|
public void removeAccount(String name)
|
||||||
|
{
|
||||||
|
if (!existCheck.exist(name))
|
||||||
|
{
|
||||||
|
if (Economy.accountExist(name))
|
||||||
|
{
|
||||||
|
Economy.removeAccount(name);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Economy.setMoney(name, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createAccount(String account)
|
||||||
|
{
|
||||||
|
if (!Economy.accountExist(account))
|
||||||
|
{
|
||||||
|
Economy.newAccount(account);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,47 @@
|
|||||||
|
package com.nijiko.coelho.iConomy.system;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.api.Economy;
|
||||||
|
|
||||||
|
|
||||||
|
public class BankAccount
|
||||||
|
{
|
||||||
|
private String BankName;
|
||||||
|
private String BankId;
|
||||||
|
private String AccountName;
|
||||||
|
|
||||||
|
public BankAccount(String BankName, String BankId, String AccountName)
|
||||||
|
{
|
||||||
|
this.BankName = BankName;
|
||||||
|
this.BankId = BankId;
|
||||||
|
this.AccountName = AccountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBankName()
|
||||||
|
{
|
||||||
|
return this.BankName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBankId()
|
||||||
|
{
|
||||||
|
return this.BankId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getAccountName(String AccountName)
|
||||||
|
{
|
||||||
|
this.AccountName = AccountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Holdings getHoldings()
|
||||||
|
{
|
||||||
|
return new Holdings(this.BankId, this.AccountName, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void remove(String name)
|
||||||
|
{
|
||||||
|
if (Economy.accountExist(BankId))
|
||||||
|
{
|
||||||
|
Economy.removeAccount(BankId);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,128 @@
|
|||||||
|
package com.nijiko.coelho.iConomy.system;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.api.Economy;
|
||||||
|
import com.nijiko.coelho.iConomy.existCheck;
|
||||||
|
|
||||||
|
|
||||||
|
public class Holdings
|
||||||
|
{
|
||||||
|
private String name = "";
|
||||||
|
private boolean bank = false;
|
||||||
|
private String bankId = null;
|
||||||
|
|
||||||
|
public Holdings(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Holdings(String id, String name)
|
||||||
|
{
|
||||||
|
this.bankId = id;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Holdings(String id, String name, boolean bank)
|
||||||
|
{
|
||||||
|
this.bank = bank;
|
||||||
|
this.bankId = id;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double get()
|
||||||
|
{
|
||||||
|
if (!existCheck.exist(name))
|
||||||
|
{
|
||||||
|
if (Economy.accountExist(name))
|
||||||
|
{
|
||||||
|
return Economy.getMoney(name);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return Economy.getMoney(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(double bal)
|
||||||
|
{
|
||||||
|
if (!existCheck.exist(name))
|
||||||
|
{
|
||||||
|
if (Economy.accountExist(name))
|
||||||
|
{
|
||||||
|
Economy.setMoney(name, bal);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Economy.setMoney(name, bal);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(double money)
|
||||||
|
{
|
||||||
|
if (!existCheck.exist(name))
|
||||||
|
{
|
||||||
|
if (Economy.accountExist(name))
|
||||||
|
{
|
||||||
|
Economy.add(name, money);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Economy.add(name, money);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void divide(double money)
|
||||||
|
{
|
||||||
|
if (!existCheck.exist(name))
|
||||||
|
{
|
||||||
|
if (Economy.accountExist(name))
|
||||||
|
{
|
||||||
|
Economy.divide(name, money);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Economy.divide(name, money);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void multiply(double money)
|
||||||
|
{
|
||||||
|
if (!existCheck.exist(name))
|
||||||
|
{
|
||||||
|
if (Economy.accountExist(name))
|
||||||
|
{
|
||||||
|
Economy.multiply(name, money);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Economy.multiply(name, money);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void subtract(double money)
|
||||||
|
{
|
||||||
|
if (!existCheck.exist(name))
|
||||||
|
{
|
||||||
|
if (Economy.accountExist(name))
|
||||||
|
{
|
||||||
|
Economy.subtract(name, money);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Economy.subtract(name, money);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
this.set(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasEnough(double amount)
|
||||||
|
{
|
||||||
|
return amount <= this.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasOver(double amount)
|
||||||
|
{
|
||||||
|
return amount < this.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNegative()
|
||||||
|
{
|
||||||
|
return this.get() < 0.0;
|
||||||
|
}
|
||||||
|
}
|
6
EssentialsiConomyBridge5/src/plugin.yml
Normal file
6
EssentialsiConomyBridge5/src/plugin.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
name: iConomy
|
||||||
|
version: 5.0
|
||||||
|
main: com.nijiko.coelho.iConomy.iConomy
|
||||||
|
website: http://www.earth2me.net:8001/
|
||||||
|
description: "Essentials iConomy Bridge version: TeamCity"
|
||||||
|
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology]
|
Reference in New Issue
Block a user