Restructure PaperSpigot as a new set of modules

Allows us much greater control over the Spigot portion of the code
and makes us more "proper"
Credit to @Dmck2b for originally passing the idea along a while back
This commit is contained in:
Zach Brown 2014-07-21 15:46:54 -05:00
parent a6efcbe993
commit 7b0c576798
226 changed files with 18467 additions and 85 deletions

View file

@ -0,0 +1,38 @@
From 5cf86c73f80228e42649a23cbf0799ce2b62a9f2 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Mon, 21 Jul 2014 15:35:46 -0500
Subject: [PATCH] POM changes
diff --git a/pom.xml b/pom.xml
index 0c9f243..8bf91d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,18 +1,18 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>org.spigotmc</groupId>
- <artifactId>spigot-api</artifactId>
+ <groupId>org.github.paperspigot</groupId>
+ <artifactId>paperspigot-api</artifactId>
<version>1.7.10-R0.1-SNAPSHOT</version>
- <name>Spigot-API</name>
- <url>http://www.spigotmc.org</url>
+ <name>PaperSpigot-API</name>
+ <url>https://github.com/PaperSpigot/Spigot</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<parent>
- <groupId>org.spigotmc</groupId>
- <artifactId>spigot-parent</artifactId>
+ <groupId>org.github.paperspigot</groupId>
+ <artifactId>paperspigot-parent</artifactId>
<version>dev-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
--
1.9.1

View file

@ -0,0 +1,90 @@
From 5db35d30b2c5deb83eae1e6b2f9f9e60dba9a31e Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Mon, 19 May 2014 22:51:45 -0500
Subject: [PATCH] Add float methods to configs
diff --git a/src/main/java/org/bukkit/configuration/ConfigurationSection.java b/src/main/java/org/bukkit/configuration/ConfigurationSection.java
index 1bd7fb5..9afc1dc 100644
--- a/src/main/java/org/bukkit/configuration/ConfigurationSection.java
+++ b/src/main/java/org/bukkit/configuration/ConfigurationSection.java
@@ -355,6 +355,48 @@ public interface ConfigurationSection {
*/
public boolean isDouble(String path);
+ // PaperSpigot start - Add getFloat
+ /**
+ * Gets the requested float by path.
+ * <p>
+ * If the float does not exist but a default value has been specified,
+ * this will return the default value. If the float does not exist and no
+ * default value was specified, this will return 0.
+ *
+ * @param path Path of the float to get.
+ * @return Requested float.
+ */
+ public float getFloat(String path);
+
+ /**
+ * Gets the requested float by path, returning a default value if not
+ * found.
+ * <p>
+ * If the float does not exist then the specified default value will
+ * returned regardless of if a default has been identified in the root
+ * {@link Configuration}.
+ *
+ * @param path Path of the float to get.
+ * @param def The default value to return if the path is not found or is
+ * not a float.
+ * @return Requested float.
+ */
+ public float getFloat(String path, float def);
+
+ /**
+ * Checks if the specified path is a float.
+ * <p>
+ * If the path exists but is not a float, this will return false. If the
+ * path does not exist, this will return false. If the path does not exist
+ * but a default value has been specified, this will check if that default
+ * value is a gloat and return appropriately.
+ *
+ * @param path Path of the float to check.
+ * @return Whether or not the specified path is a float.
+ */
+ public boolean isFloat(String path);
+ // PaperSpigot end
+
/**
* Gets the requested long by path.
* <p>
diff --git a/src/main/java/org/bukkit/configuration/MemorySection.java b/src/main/java/org/bukkit/configuration/MemorySection.java
index f180bf5..0e2b26a 100644
--- a/src/main/java/org/bukkit/configuration/MemorySection.java
+++ b/src/main/java/org/bukkit/configuration/MemorySection.java
@@ -336,6 +336,23 @@ public class MemorySection implements ConfigurationSection {
return val instanceof Double;
}
+ // PaperSpigot start - Add getFloat
+ public float getFloat(String path) {
+ Object def = getDefault(path);
+ return getFloat(path, (def instanceof Float) ? toFloat(def) : 0);
+ }
+
+ public float getFloat(String path, float def) {
+ Object val = get(path, def);
+ return (val instanceof Float) ? toFloat(val) : def;
+ }
+
+ public boolean isFloat(String path) {
+ Object val = get(path);
+ return val instanceof Float;
+ }
+ // PaperSpigot end
+
public long getLong(String path) {
Object def = getDefault(path);
return getLong(path, (def instanceof Number) ? toLong(def) : 0);
--
1.9.1