summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java9
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsDependancyChecker.java68
-rw-r--r--Essentials/src/com/earth2me/essentials/IEssentials.java2
-rw-r--r--Essentials/src/messages.properties5
-rw-r--r--Essentials/src/messages_da.properties5
-rw-r--r--Essentials/src/messages_de.properties5
-rw-r--r--Essentials/src/messages_en.properties5
-rw-r--r--Essentials/src/messages_fr.properties5
-rw-r--r--Essentials/src/messages_nl.properties5
-rw-r--r--EssentialsProtect/build.xml9
-rw-r--r--EssentialsProtect/nbproject/project.properties174
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java12
12 files changed, 193 insertions, 111 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index 450a7e2af..901344f0c 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -50,6 +50,7 @@ public class Essentials extends JavaPlugin implements IEssentials
private EssentialsEntityListener entityListener;
private JailPlayerListener jailPlayerListener;
private TNTExplodeListener tntListener;
+ private EssentialsDependancyChecker essDep;
private static Essentials instance = null;
private Spawn spawn;
private Jail jail;
@@ -116,6 +117,7 @@ public class Essentials extends JavaPlugin implements IEssentials
confList.add(worth);
reload();
backup = new Backup(this);
+ essDep = new EssentialsDependancyChecker(this);
PluginManager pm = getServer().getPluginManager();
for (Plugin plugin : pm.getPlugins())
@@ -183,7 +185,6 @@ public class Essentials extends JavaPlugin implements IEssentials
if (settings.isNetherEnabled() && getServer().getWorlds().size() < 2)
{
- logger.log(Level.WARNING, "Old nether is disabled until multiworld support in bukkit is fixed.");
getServer().createWorld(settings.getNetherName(), World.Environment.NETHER);
}
@@ -757,4 +758,10 @@ public class Essentials extends JavaPlugin implements IEssentials
{
return tntListener;
}
+
+ public EssentialsDependancyChecker getDependancyChecker()
+ {
+ return essDep;
+ }
+
}
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsDependancyChecker.java b/Essentials/src/com/earth2me/essentials/EssentialsDependancyChecker.java
new file mode 100644
index 000000000..a46c7f6e7
--- /dev/null
+++ b/Essentials/src/com/earth2me/essentials/EssentialsDependancyChecker.java
@@ -0,0 +1,68 @@
+package com.earth2me.essentials;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+
+public class EssentialsDependancyChecker
+{
+ private static final Logger logger = Logger.getLogger("Minecraft");
+ final Essentials ess;
+
+ public EssentialsDependancyChecker(Essentials ess)
+ {
+ this.ess = ess;
+ }
+
+ public void checkProtectDependancies()
+ {
+ final String dependancyLocation = "http://mirrors.ibiblio.org/pub/mirrors/maven2/c3p0/c3p0/0.9.1.2/c3p0-0.9.1.2.jar";
+ File dependancyFile = new File("lib/c3p0-0.9.1.2.jar");
+ if (!dependancyFile.exists())
+ {
+ logger.log(Level.INFO, Util.i18n("dependancyNotFound"));
+ try
+ {
+ URL url = new URL(dependancyLocation);
+ BufferedInputStream inStream = new BufferedInputStream(url.openStream());
+ FileOutputStream fos = new FileOutputStream(dependancyFile);
+ BufferedOutputStream outStream = new BufferedOutputStream(fos, 1024);
+
+ byte[] buffer = new byte[1024];
+ int len = 0;
+
+ while ((len = inStream.read(buffer)) > 0)
+ {
+ outStream.write(buffer, 0, len);
+ }
+ outStream.close();
+ fos.close();
+ inStream.close();
+ logger.log(Level.INFO, Util.format("dependancyDownloaded", dependancyFile.getName()));
+
+ }
+ catch (MalformedURLException ex)
+ {
+ logger.log(Level.SEVERE, Util.i18n("urlMalformed"), ex);
+ }
+ catch (FileNotFoundException ex)
+ {
+ logger.log(Level.SEVERE, Util.i18n("dependancyException"), ex);
+ }
+ catch (IOException ex)
+ {
+ logger.log(Level.SEVERE, Util.i18n("dependancyException"), ex);
+ }
+ }
+ }
+}
diff --git a/Essentials/src/com/earth2me/essentials/IEssentials.java b/Essentials/src/com/earth2me/essentials/IEssentials.java
index ef099860b..10d3f16de 100644
--- a/Essentials/src/com/earth2me/essentials/IEssentials.java
+++ b/Essentials/src/com/earth2me/essentials/IEssentials.java
@@ -69,4 +69,6 @@ public interface IEssentials
List<String> getBannedIps();
TNTExplodeListener getTNTListener();
+
+ EssentialsDependancyChecker getDependancyChecker();
}
diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties
index 261c2237e..e962e575b 100644
--- a/Essentials/src/messages.properties
+++ b/Essentials/src/messages.properties
@@ -305,4 +305,7 @@ timePattern = (?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:
msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2}
kits = \u00a77Kits: {0}
loadWarpError = Failed to load warp {0}
-invalidSignLine = Line {0} on sign is invalid. \ No newline at end of file
+invalidSignLine = Line {0} on sign is invalid.
+dependancyNotFound = [Essentials] A required dependancy was not found, downloading now.
+dependancyDownloaded = [Essentials] Dependancy {0} downloaded successfully.
+dependancyException = [Essentials] An error occured when trying to download a dependacy \ No newline at end of file
diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties
index 1d78bed71..a286b1506 100644
--- a/Essentials/src/messages_da.properties
+++ b/Essentials/src/messages_da.properties
@@ -307,4 +307,7 @@ timePattern = (?:([0-9]+)\\s*[a\u00e5y][a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\
msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2}
kits = \u00a77Pakker: {0}
loadWarpError = Kunne ikke indl\u00e6se warp {0}
-invalidSignLine = Linje {0} p\u00e5 skilt er ugyldig. \ No newline at end of file
+invalidSignLine = Linje {0} p\u00e5 skilt er ugyldig.
+dependancyNotFound = [Essentials] A required dependancy was not found, downloading now.
+dependancyDownloaded = [Essentials] Dependancy {0} downloaded successfully.
+dependancyException = [Essentials] An error occured when trying to download a dependacy \ No newline at end of file
diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties
index 65d666c67..c714b2028 100644
--- a/Essentials/src/messages_de.properties
+++ b/Essentials/src/messages_de.properties
@@ -305,4 +305,7 @@ timePattern = (?:([0-9]+)\\s*[yj][a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?
msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2}
kits = \u00a77Ausr\u00fcstungen: {0}
loadWarpError = Fehler beim Laden von Warp-Punkt {0}
-invalidSignLine = Die Zeile {0} auf dem Schild ist falsch. \ No newline at end of file
+invalidSignLine = Die Zeile {0} auf dem Schild ist falsch.
+dependancyNotFound = [Essentials] A required dependancy was not found, downloading now.
+dependancyDownloaded = [Essentials] Dependancy {0} downloaded successfully.
+dependancyException = [Essentials] An error occured when trying to download a dependacy \ No newline at end of file
diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties
index 261c2237e..e962e575b 100644
--- a/Essentials/src/messages_en.properties
+++ b/Essentials/src/messages_en.properties
@@ -305,4 +305,7 @@ timePattern = (?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:
msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2}
kits = \u00a77Kits: {0}
loadWarpError = Failed to load warp {0}
-invalidSignLine = Line {0} on sign is invalid. \ No newline at end of file
+invalidSignLine = Line {0} on sign is invalid.
+dependancyNotFound = [Essentials] A required dependancy was not found, downloading now.
+dependancyDownloaded = [Essentials] Dependancy {0} downloaded successfully.
+dependancyException = [Essentials] An error occured when trying to download a dependacy \ No newline at end of file
diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties
index 704e951f2..240b05e59 100644
--- a/Essentials/src/messages_fr.properties
+++ b/Essentials/src/messages_fr.properties
@@ -302,4 +302,7 @@ timePattern = (?:([0-9]+)\\s*[ya][a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?
msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2}
kits = \u00a77Kits:{0}
loadWarpError = Echec du chargement du warp {0}
-invalidSignLine = Ligne {0} du panneau est invalide. \ No newline at end of file
+invalidSignLine = Ligne {0} du panneau est invalide.
+dependancyNotFound = [Essentials] A required dependancy was not found, downloading now.
+dependancyDownloaded = [Essentials] Dependancy {0} downloaded successfully.
+dependancyException = [Essentials] An error occured when trying to download a dependacy \ No newline at end of file
diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties
index 80340c4c4..d4c3a5077 100644
--- a/Essentials/src/messages_nl.properties
+++ b/Essentials/src/messages_nl.properties
@@ -306,4 +306,7 @@ timePattern = (?:([0-9]+)\\s*[yj][a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[oa][a-z]*[,\\s]
msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2}
kits = \u00a77Kits: {0}
loadWarpError = Fout bij het laden van warp {0}
-invalidSignLine = Regel {0} op het bordje is ongeldig. \ No newline at end of file
+invalidSignLine = Regel {0} op het bordje is ongeldig.
+dependancyNotFound = [Essentials] A required dependancy was not found, downloading now.
+dependancyDownloaded = [Essentials] Dependancy {0} downloaded successfully.
+dependancyException = [Essentials] An error occured when trying to download a dependacy \ No newline at end of file
diff --git a/EssentialsProtect/build.xml b/EssentialsProtect/build.xml
index 8516489bd..f2341984f 100644
--- a/EssentialsProtect/build.xml
+++ b/EssentialsProtect/build.xml
@@ -73,13 +73,4 @@
-->
- <target name="-post-jar">
- <jar jarfile="${dist.dir}/EssentialsProtect.jar">
- <zipfileset src="${dist.jar}" excludes="META-INF/*" />
- <zipfileset src="../lib/c3p0-0.9.1.2.jar" excludes="META-INF/*" />
- <manifest>
- <attribute name="Classpath" value="Essentials.jar"/>
- </manifest>
- </jar>
- </target>
</project>
diff --git a/EssentialsProtect/nbproject/project.properties b/EssentialsProtect/nbproject/project.properties
index 8a31b4c4f..7658c2076 100644
--- a/EssentialsProtect/nbproject/project.properties
+++ b/EssentialsProtect/nbproject/project.properties
@@ -1,87 +1,87 @@
-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=EssentialsProtect
-application.vendor=devhome
-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}/original-EssentialsProtect.jar
-dist.javadoc.dir=${dist.dir}/javadoc
-endorsed.classpath=
-excludes=
-file.reference.c3p0-0.9.1.2.jar=..\\lib\\c3p0-0.9.1.2.jar
-file.reference.craftbukkit-0.0.1-SNAPSHOT.jar=..\\lib\\craftbukkit-0.0.1-SNAPSHOT.jar
-includes=**
-jar.archive.disabled=${jnlp.enabled}
-jar.compress=false
-jar.index=${jnlp.enabled}
-javac.classpath=\
- ${reference.Essentials.jar}:\
- ${file.reference.craftbukkit-0.0.1-SNAPSHOT.jar}:\
- ${file.reference.c3p0-0.9.1.2.jar}
-# Space-separated list of extra javac options
-javac.compilerargs=
-javac.deprecation=false
-javac.processorpath=\
- ${javac.classpath}
-javac.source=1.5
-javac.target=1.5
-javac.test.classpath=\
- ${javac.classpath}:\
- ${build.classes.dir}:\
- ${libs.junit.classpath}:\
- ${libs.junit_4.classpath}
-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=
-jnlp.codebase.type=no.codebase
-jnlp.descriptor=application
-jnlp.enabled=false
-jnlp.mixed.code=defaut
-jnlp.offline-allowed=false
-jnlp.signed=false
-manifest.file=manifest.mf
-meta.inf.dir=${src.dir}/META-INF
-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
+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=EssentialsProtect
+application.vendor=devhome
+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}/EssentialsProtect.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+endorsed.classpath=
+excludes=
+file.reference.c3p0-0.9.1.2.jar=..\\lib\\c3p0-0.9.1.2.jar
+file.reference.craftbukkit-0.0.1-SNAPSHOT.jar=..\\lib\\craftbukkit-0.0.1-SNAPSHOT.jar
+includes=**
+jar.archive.disabled=${jnlp.enabled}
+jar.compress=false
+jar.index=${jnlp.enabled}
+javac.classpath=\
+ ${reference.Essentials.jar}:\
+ ${file.reference.craftbukkit-0.0.1-SNAPSHOT.jar}:\
+ ${file.reference.c3p0-0.9.1.2.jar}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.processorpath=\
+ ${javac.classpath}
+javac.source=1.5
+javac.target=1.5
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}:\
+ ${libs.junit.classpath}:\
+ ${libs.junit_4.classpath}
+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=
+jnlp.codebase.type=no.codebase
+jnlp.descriptor=application
+jnlp.enabled=false
+jnlp.mixed.code=defaut
+jnlp.offline-allowed=false
+jnlp.signed=false
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+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
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
index bdcb167b8..7a7772ea6 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
@@ -50,14 +50,10 @@ public class EssentialsProtect extends JavaPlugin implements IConf
public void onEnable()
{
- ess = Essentials.getStatic();
- PluginManager pm = this.getServer().getPluginManager();
- Essentials ess = (Essentials)pm.getPlugin("Essentials");
- if (!ess.isEnabled())
- {
- pm.enablePlugin(ess);
- }
+ PluginManager pm = this.getServer().getPluginManager();
+ ess = Essentials.getStatic();
+ ess.getDependancyChecker().checkProtectDependancies();
instance = this;
reloadConfig();
@@ -77,7 +73,7 @@ public class EssentialsProtect extends JavaPlugin implements IConf
pm.registerEvent(Type.LIGHTNING_STRIKE, weatherListener, Priority.Highest, this);
pm.registerEvent(Type.THUNDER_CHANGE, weatherListener, Priority.Highest, this);
pm.registerEvent(Type.WEATHER_CHANGE, weatherListener, Priority.Highest, this);
-
+
if (!this.getDescription().getVersion().equals(Essentials.getStatic().getDescription().getVersion()))
{
logger.log(Level.WARNING, "Version mismatch! Please update all Essentials jars to the same version.");