Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Line endings

  • Loading branch information...
commit cf9a069537def1072f6a0d61858a3151781eb5b0 1 parent 6bde155
@LadyCailin LadyCailin authored
View
86 CHANGELOG.txt
@@ -1,44 +1,44 @@
-3.1.2:
-- Added exception handling, and fixed more bugs with command matching and
-optional variables. Also added more advanced permission syntax for commands.
-- Added functions: set_display_name, reset_display_name, try, array_index_exists,
-is_array, is_boolean, is_double, is_integer, is_null, is_string, substr, to_lower,
-to_upper, length, throw
-- Newlines are now handled in an expected manner in all functions. The escape
-sequence '\n' has been added, which allows for newlines to be embedded in a
-string in a script.
--Command labels can now be used to specify what groups have permission to run this
-command
-
-3.1.1:
--Fixed a bug where no argument functions in the root of the command would give a
-compile error.
-
-3.1.0:
-- Added several new functions, including eval, set_ploc, time, nano_time, break,
-continue, get_worlds, pworld, pinfo, and kick. Also, reorganized the source code,
-and made it so that if one command would cause a compiler error, the entire script
-won't be affected, but just the one command. Also, concatenation automatically
-happens now, the g() function is no longer necessary. Debug mode now outputs what
-real command is being run, if debug mode is on. It is now possible to define
-the location of your config file, in the preferences.txt file. See the upgrade
-notices (on the wiki) for information about upgrading your scripts from
-3.0.2 to 3.1.0.
-
-3.0.2:
-- Added new functions to allow scripts to interact with the environment around
- the player.
-
-3.0.1:
-- Added several new functions, including a foreach loop, and the g function.
- See the upgrade notices (on the wiki) for information about upgrading your
- scripts from 3.0.0 to 3.0.1.
-
-3.0.0:
-- Completly reworked the engine. Essentially a new plugin.
-
-2.0.1:
-- Updated to work again.
-
-2.0:
+3.1.2:
+- Added exception handling, and fixed more bugs with command matching and
+optional variables. Also added more advanced permission syntax for commands.
+- Added functions: set_display_name, reset_display_name, try, array_index_exists,
+is_array, is_boolean, is_double, is_integer, is_null, is_string, substr, to_lower,
+to_upper, length, throw
+- Newlines are now handled in an expected manner in all functions. The escape
+sequence '\n' has been added, which allows for newlines to be embedded in a
+string in a script.
+-Command labels can now be used to specify what groups have permission to run this
+command
+
+3.1.1:
+-Fixed a bug where no argument functions in the root of the command would give a
+compile error.
+
+3.1.0:
+- Added several new functions, including eval, set_ploc, time, nano_time, break,
+continue, get_worlds, pworld, pinfo, and kick. Also, reorganized the source code,
+and made it so that if one command would cause a compiler error, the entire script
+won't be affected, but just the one command. Also, concatenation automatically
+happens now, the g() function is no longer necessary. Debug mode now outputs what
+real command is being run, if debug mode is on. It is now possible to define
+the location of your config file, in the preferences.txt file. See the upgrade
+notices (on the wiki) for information about upgrading your scripts from
+3.0.2 to 3.1.0.
+
+3.0.2:
+- Added new functions to allow scripts to interact with the environment around
+ the player.
+
+3.0.1:
+- Added several new functions, including a foreach loop, and the g function.
+ See the upgrade notices (on the wiki) for information about upgrading your
+ scripts from 3.0.0 to 3.0.1.
+
+3.0.0:
+- Completly reworked the engine. Essentially a new plugin.
+
+2.0.1:
+- Updated to work again.
+
+2.0:
- Updated for Bukkit.
View
42 LICENSE.txt
@@ -1,21 +1,21 @@
-The MIT License (MIT)
-
-Copyright (c) 2012 Layton Smith, sk89q, Deaygo,
-t3hk0d3, zml2008, EntityReborn, and albatrossen
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+The MIT License (MIT)
+
+Copyright (c) 2012 Layton Smith, sk89q, Deaygo,
+t3hk0d3, zml2008, EntityReborn, and albatrossen
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
64 src/main/assembly/default.xml
@@ -1,33 +1,33 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<assembly
- xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
- <includeBaseDirectory>false</includeBaseDirectory>
- <formats>
- <format>tar.gz</format>
- <format>tar.bz2</format>
- <format>zip</format>
- </formats>
- <files>
- <file>
- <source>${project.build.directory}/${artifactId}-${project.version}.jar</source>
- <destName>CommandHelper.jar</destName>
- <outputDirectory>/</outputDirectory>
- <filtered>false</filtered>
- </file>
- <file>
- <source>README.html</source>
- <outputDirectory>/</outputDirectory>
- <filtered>true</filtered>
- </file>
- </files>
- <fileSets>
- <fileSet>
- <includes>
- <include>CHANGELOG.txt</include>
- <include>LICENSE.txt</include>
- </includes>
- </fileSet>
- </fileSets>
+<?xml version="1.0" encoding="UTF-8"?>
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>tar.gz</format>
+ <format>tar.bz2</format>
+ <format>zip</format>
+ </formats>
+ <files>
+ <file>
+ <source>${project.build.directory}/${artifactId}-${project.version}.jar</source>
+ <destName>CommandHelper.jar</destName>
+ <outputDirectory>/</outputDirectory>
+ <filtered>false</filtered>
+ </file>
+ <file>
+ <source>README.html</source>
+ <outputDirectory>/</outputDirectory>
+ <filtered>true</filtered>
+ </file>
+ </files>
+ <fileSets>
+ <fileSet>
+ <includes>
+ <include>CHANGELOG.txt</include>
+ <include>LICENSE.txt</include>
+ </includes>
+ </fileSet>
+ </fileSets>
</assembly>
View
344 src/main/java/com/laytonsmith/PureUtilities/ClassDiscovery.java
@@ -1,172 +1,172 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.laytonsmith.PureUtilities;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.security.CodeSource;
-import java.util.*;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Pattern;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-public final class ClassDiscovery {
-
- private ClassDiscovery(){}
-
- /**
- * Adds a jar or file path location to be scanned by the default call to GetClassesWithinPackageHierarchy.
- * This is useful if an external library wishes to be considered by the scanner.
- * @param url
- */
- public static void InstallDiscoveryLocation(String url){
- additionalURLs.add(url);
- }
-
- /**
- * Clears the class cache.
- * Upon the first call to the rather expensive GetClassesWithinPackageHierarchy(String) method,
- * the returned classes are cached instead of being regenerated. This method is automatically
- * called if a new discovery location is installed, but if new classes are being generated
- * dynamically, this cache will become stale, and you should clear the cache for a particular url.
- */
- public static void InvalidateCache(String url){
- classCache.remove(url);
- }
-
- /**
- * Equivalent to InvalidateCache(null);
- */
- public static void InvalidateCache(){
- InvalidateCache(null);
- }
-
- /**
- * There's no need to rescan the project every time GetClassesWithinPackageHierarchy is called,
- * unless we add a new discovery location, or code is being generated on the fly or something crazy
- * like that, so let's cache unless told otherwise.
- */
- private static Map<String, Class[]> classCache = new HashMap<String, Class[]>();
-
- private static List<String> additionalURLs = new ArrayList<String>();
-
- public static Class[] GetClassesWithinPackageHierarchy(){
- List<Class> classes = new ArrayList<Class>();
- classes.addAll(Arrays.asList(GetClassesWithinPackageHierarchy(null)));
- for(String url : additionalURLs){
- classes.addAll(Arrays.asList(GetClassesWithinPackageHierarchy(url)));
- }
- return classes.toArray(new Class[classes.size()]);
- }
- /**
- * Gets all the classes in the specified location. The url can point to a jar, or a
- * file system location. If null, the current binary is used.
- * @param url
- * @return
- */
- public static Class[] GetClassesWithinPackageHierarchy(String url){
- if(classCache.containsKey(url)){
- return classCache.get(url);
- }
- String originalURL = url;
- if(url == null){
- url = ClassDiscovery.class.getResource(ClassDiscovery.class.getSimpleName() + ".class").toString();
- }
- List<String> classNameList = new ArrayList<String>();
- if(url.startsWith("file:")){
- //We are running from the file system
- //First, get the "root" of the class structure. We assume it's
- //the root of this class
- String fileName = Pattern.quote(ClassDiscovery.class.getCanonicalName().replace(".", "/"));
- fileName = fileName/*.replaceAll("\\\\Q", "").replaceAll("\\\\E", "")*/ + ".class";
- String root = url.replaceAll("file:" + (TermColors.SYSTEM==TermColors.SYS.WINDOWS?"/":""), "").replaceAll(fileName, "");
- //System.out.println(root);
- //Ok, now we have the "root" of the known class structure. Let's recursively
- //go through everything and pull out the files
- List<File> fileList = new ArrayList<File>();
- descend(new File(root), fileList);
- //Now, we have all the class files in the package. But, it's the absolute path
- //to all of them. We have to first remove the "front" part
- for(File f : fileList){
- classNameList.add(f.getAbsolutePath().replaceFirst(Pattern.quote(new File(root).getAbsolutePath() + File.separator), ""));
- }
-
- } else if(url.startsWith("jar:")) {
- //We are running from a jar
- CodeSource src = ClassDiscovery.class.getProtectionDomain().getCodeSource();
- if (src != null) {
- ZipInputStream zip = null;
- try {
- URL jar = src.getLocation();
- zip = new ZipInputStream(jar.openStream());
- ZipEntry ze;
- while((ze = zip.getNextEntry()) != null){
- classNameList.add(ze.getName());
- }
- } catch (IOException ex) {
- Logger.getLogger(ClassDiscovery.class.getName()).log(Level.SEVERE, null, ex);
- } finally {
- try {
- zip.close();
- } catch (IOException ex) {
- Logger.getLogger(ClassDiscovery.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
-
-
- }
- }
- //Ok, now we need to go through the list, and throw out entries
- //that are anonymously named (they end in $\d.class) because they
- //are inaccessible anyways
- List<Class> files = new ArrayList<Class>();
- for(String s : classNameList){
- //Don't consider anonymous inner classes
- if(!s.matches(".*\\$(?:\\d)*\\.class") && s.endsWith(".class")){
- //Now, replace any \ with / and replace / with ., and remove the .class,
- //and forName it.
- String className = s.replaceAll("\\.class", "").replaceAll("\\\\", "/").replaceAll("[/]", ".");
- try {
- //Don't initialize it, so we don't have to deal with ExceptionInInitializer errors
- Class c = Class.forName(className, false, ClassDiscovery.class.getClassLoader());
- files.add(c);
- } catch (ClassNotFoundException ex) {
- //It can't be loaded? O.o Oh well.
- } catch (NoClassDefFoundError ex){
- //Must have been an external library
- }
- }
- }
- //Put the results in the cache
- Class[] ret = files.toArray(new Class[files.size()]);
- classCache.put(originalURL, ret);
- return ret;
- }
-
- public static Class[] GetClassesWithAnnotation(Class annotation){
- List<Class> classes = new ArrayList<Class>();
- for(Class c : GetClassesWithinPackageHierarchy()){
- if(c.getAnnotation(annotation) != null){
- classes.add(c);
- }
- }
- return classes.toArray(new Class[classes.size()]);
- }
-
- private static void descend(File start, List<File> fileList){
- if(start.isFile()){
- if(start.getName().endsWith(".class")){
- fileList.add(start);
- }
- } else {
- for(File child : start.listFiles()){
- descend(child, fileList);
- }
- }
- }
-}
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.laytonsmith.PureUtilities;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.security.CodeSource;
+import java.util.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Pattern;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+public final class ClassDiscovery {
+
+ private ClassDiscovery(){}
+
+ /**
+ * Adds a jar or file path location to be scanned by the default call to GetClassesWithinPackageHierarchy.
+ * This is useful if an external library wishes to be considered by the scanner.
+ * @param url
+ */
+ public static void InstallDiscoveryLocation(String url){
+ additionalURLs.add(url);
+ }
+
+ /**
+ * Clears the class cache.
+ * Upon the first call to the rather expensive GetClassesWithinPackageHierarchy(String) method,
+ * the returned classes are cached instead of being regenerated. This method is automatically
+ * called if a new discovery location is installed, but if new classes are being generated
+ * dynamically, this cache will become stale, and you should clear the cache for a particular url.
+ */
+ public static void InvalidateCache(String url){
+ classCache.remove(url);
+ }
+
+ /**
+ * Equivalent to InvalidateCache(null);
+ */
+ public static void InvalidateCache(){
+ InvalidateCache(null);
+ }
+
+ /**
+ * There's no need to rescan the project every time GetClassesWithinPackageHierarchy is called,
+ * unless we add a new discovery location, or code is being generated on the fly or something crazy
+ * like that, so let's cache unless told otherwise.
+ */
+ private static Map<String, Class[]> classCache = new HashMap<String, Class[]>();
+
+ private static List<String> additionalURLs = new ArrayList<String>();
+
+ public static Class[] GetClassesWithinPackageHierarchy(){
+ List<Class> classes = new ArrayList<Class>();
+ classes.addAll(Arrays.asList(GetClassesWithinPackageHierarchy(null)));
+ for(String url : additionalURLs){
+ classes.addAll(Arrays.asList(GetClassesWithinPackageHierarchy(url)));
+ }
+ return classes.toArray(new Class[classes.size()]);
+ }
+ /**
+ * Gets all the classes in the specified location. The url can point to a jar, or a
+ * file system location. If null, the current binary is used.
+ * @param url
+ * @return
+ */
+ public static Class[] GetClassesWithinPackageHierarchy(String url){
+ if(classCache.containsKey(url)){
+ return classCache.get(url);
+ }
+ String originalURL = url;
+ if(url == null){
+ url = ClassDiscovery.class.getResource(ClassDiscovery.class.getSimpleName() + ".class").toString();
+ }
+ List<String> classNameList = new ArrayList<String>();
+ if(url.startsWith("file:")){
+ //We are running from the file system
+ //First, get the "root" of the class structure. We assume it's
+ //the root of this class
+ String fileName = Pattern.quote(ClassDiscovery.class.getCanonicalName().replace(".", "/"));
+ fileName = fileName/*.replaceAll("\\\\Q", "").replaceAll("\\\\E", "")*/ + ".class";
+ String root = url.replaceAll("file:" + (TermColors.SYSTEM==TermColors.SYS.WINDOWS?"/":""), "").replaceAll(fileName, "");
+ //System.out.println(root);
+ //Ok, now we have the "root" of the known class structure. Let's recursively
+ //go through everything and pull out the files
+ List<File> fileList = new ArrayList<File>();
+ descend(new File(root), fileList);
+ //Now, we have all the class files in the package. But, it's the absolute path
+ //to all of them. We have to first remove the "front" part
+ for(File f : fileList){
+ classNameList.add(f.getAbsolutePath().replaceFirst(Pattern.quote(new File(root).getAbsolutePath() + File.separator), ""));
+ }
+
+ } else if(url.startsWith("jar:")) {
+ //We are running from a jar
+ CodeSource src = ClassDiscovery.class.getProtectionDomain().getCodeSource();
+ if (src != null) {
+ ZipInputStream zip = null;
+ try {
+ URL jar = src.getLocation();
+ zip = new ZipInputStream(jar.openStream());
+ ZipEntry ze;
+ while((ze = zip.getNextEntry()) != null){
+ classNameList.add(ze.getName());
+ }
+ } catch (IOException ex) {
+ Logger.getLogger(ClassDiscovery.class.getName()).log(Level.SEVERE, null, ex);
+ } finally {
+ try {
+ zip.close();
+ } catch (IOException ex) {
+ Logger.getLogger(ClassDiscovery.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+
+ }
+ }
+ //Ok, now we need to go through the list, and throw out entries
+ //that are anonymously named (they end in $\d.class) because they
+ //are inaccessible anyways
+ List<Class> files = new ArrayList<Class>();
+ for(String s : classNameList){
+ //Don't consider anonymous inner classes
+ if(!s.matches(".*\\$(?:\\d)*\\.class") && s.endsWith(".class")){
+ //Now, replace any \ with / and replace / with ., and remove the .class,
+ //and forName it.
+ String className = s.replaceAll("\\.class", "").replaceAll("\\\\", "/").replaceAll("[/]", ".");
+ try {
+ //Don't initialize it, so we don't have to deal with ExceptionInInitializer errors
+ Class c = Class.forName(className, false, ClassDiscovery.class.getClassLoader());
+ files.add(c);
+ } catch (ClassNotFoundException ex) {
+ //It can't be loaded? O.o Oh well.
+ } catch (NoClassDefFoundError ex){
+ //Must have been an external library
+ }
+ }
+ }
+ //Put the results in the cache
+ Class[] ret = files.toArray(new Class[files.size()]);
+ classCache.put(originalURL, ret);
+ return ret;
+ }
+
+ public static Class[] GetClassesWithAnnotation(Class annotation){
+ List<Class> classes = new ArrayList<Class>();
+ for(Class c : GetClassesWithinPackageHierarchy()){
+ if(c.getAnnotation(annotation) != null){
+ classes.add(c);
+ }
+ }
+ return classes.toArray(new Class[classes.size()]);
+ }
+
+ private static void descend(File start, List<File> fileList){
+ if(start.isFile()){
+ if(start.getName().endsWith(".class")){
+ fileList.add(start);
+ }
+ } else {
+ for(File child : start.listFiles()){
+ descend(child, fileList);
+ }
+ }
+ }
+}
View
20 src/main/java/com/laytonsmith/PureUtilities/LineCallback.java
@@ -1,10 +1,10 @@
-
-package com.laytonsmith.PureUtilities;
-
-/**
- *
- * @author layton
- */
-public interface LineCallback {
- public void run(String line);
-}
+
+package com.laytonsmith.PureUtilities;
+
+/**
+ *
+ * @author layton
+ */
+public interface LineCallback {
+ public void run(String line);
+}
View
174 src/main/java/com/laytonsmith/PureUtilities/Persistance.java
@@ -1,87 +1,87 @@
-
-package com.laytonsmith.PureUtilities;
-
-import java.io.PrintStream;
-import java.util.List;
-import java.util.Map;
-
-/**
- *
- * @author Layton
- */
-public interface Persistance {
- /**
- * Loads the database from disk. This is automatically called when setValue or getValue is called.
- * @throws Exception
- */
- public void load() throws Exception;
-
- /**
- * Causes the database to be saved to disk
- * @throws IOException
- */
- public void save() throws Exception;
-
- /**
- * Adds or modifies the value of the key. Typically, this convention should be followed:
- * <pre>
- * key1.key2.key3...
- * </pre>
- * To make this usage easier, the function automatically namespaces the values for you. A sample
- * usage might be:
- * <pre>
- * setValue(new String[]{"playerName", "value"}, value);
- * </pre>
- *
- * When using namespaces in this way, the isNamespaceSet function becomes available to you.
- * Since plugin values are global, you can use this to interact with other plugins. Caution should
- * be used when interacting with other plugin's values though.
- * @param key The key for this particular value
- * @param value The value to store. If value is null, the key is simply removed.
- * @return The object that was in this key, or null if the value did not exist.
- */
- public String setValue(String[] key, String value);
-
- /**
- * Returns the value of a particular key
- * @param key
- * @return
- */
- public String getValue(String[] key);
-
- /**
- * Checks to see if a particular key is set. Unlike isNamespaceSet, this requires that
- * the exact key be specified to see if it exists.
- * @param key
- * @return
- */
- public boolean isKeySet(String[] key);
-
- /**
- * Returns whether or not a particular namespace value is set. For instance, if the
- * value plugin.myPlugin.players.playerName.data is set, then the call to
- * <code>isNamespaceSet(new String[]{"plugin", "myPlugin"})</code> would return
- * <code>true</code>
- * @param partialKey
- * @return
- */
- public boolean isNamespaceSet(String[] partialKey);
-
- /**
- * Returns all the matched namespace entries.
- * @param partialKey The partial name of the keys you wish to return
- * @return An ArrayList of Map.Entries.
- */
- public List<Map.Entry<String, Object>> getNamespaceValues(String[] partialKey);
-
- /**
- * Prints all of the stored values to the specified stream.
- */
- public void printValues(PrintStream out);
-
- /**
- * Clears out all of the data from this persistance object. For the love
- * of God, don't call this from anywhere but the data manager!
- */
- public void clearAllData();
-}
+
+package com.laytonsmith.PureUtilities;
+
+import java.io.PrintStream;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * @author Layton
+ */
+public interface Persistance {
+ /**
+ * Loads the database from disk. This is automatically called when setValue or getValue is called.
+ * @throws Exception
+ */
+ public void load() throws Exception;
+
+ /**
+ * Causes the database to be saved to disk
+ * @throws IOException
+ */
+ public void save() throws Exception;
+
+ /**
+ * Adds or modifies the value of the key. Typically, this convention should be followed:
+ * <pre>
+ * key1.key2.key3...
+ * </pre>
+ * To make this usage easier, the function automatically namespaces the values for you. A sample
+ * usage might be:
+ * <pre>
+ * setValue(new String[]{"playerName", "value"}, value);
+ * </pre>
+ *
+ * When using namespaces in this way, the isNamespaceSet function becomes available to you.
+ * Since plugin values are global, you can use this to interact with other plugins. Caution should
+ * be used when interacting with other plugin's values though.
+ * @param key The key for this particular value
+ * @param value The value to store. If value is null, the key is simply removed.
+ * @return The object that was in this key, or null if the value did not exist.
+ */
+ public String setValue(String[] key, String value);
+
+ /**
+ * Returns the value of a particular key
+ * @param key
+ * @return
+ */
+ public String getValue(String[] key);
+
+ /**
+ * Checks to see if a particular key is set. Unlike isNamespaceSet, this requires that
+ * the exact key be specified to see if it exists.
+ * @param key
+ * @return
+ */
+ public boolean isKeySet(String[] key);
+
+ /**
+ * Returns whether or not a particular namespace value is set. For instance, if the
+ * value plugin.myPlugin.players.playerName.data is set, then the call to
+ * <code>isNamespaceSet(new String[]{"plugin", "myPlugin"})</code> would return
+ * <code>true</code>
+ * @param partialKey
+ * @return
+ */
+ public boolean isNamespaceSet(String[] partialKey);
+
+ /**
+ * Returns all the matched namespace entries.
+ * @param partialKey The partial name of the keys you wish to return
+ * @return An ArrayList of Map.Entries.
+ */
+ public List<Map.Entry<String, Object>> getNamespaceValues(String[] partialKey);
+
+ /**
+ * Prints all of the stored values to the specified stream.
+ */
+ public void printValues(PrintStream out);
+
+ /**
+ * Clears out all of the data from this persistance object. For the love
+ * of God, don't call this from anywhere but the data manager!
+ */
+ public void clearAllData();
+}
View
44 wepif.yml
@@ -1,25 +1,25 @@
-#
-# WEPIF Configuration File
-#
-# This file handles permissions configuration for every plugin using WEPIF
-#
-# About editing this file:
-# - DO NOT USE TABS. You MUST use spaces or Bukkit will complain. If
-# you use an editor like Notepad++ (recommended for Windows users), you
-# must configure it to "replace tabs with spaces." In Notepad++, this can
-# be changed in Settings > Preferences > Language Menu.
-# - Don't get rid of the indents. They are indented so some entries are
-# in categories (like "enforce-single-session" is in the "protection"
-# category.
-# - If you want to check the format of this file before putting it
-# into WEPIF, paste it into http://yaml-online-parser.appspot.com/
-# and see if it gives "ERROR:".
-# - Lines starting with # are comments and so they are ignored.
-#
-# About Configuration Permissions
-# - See http://wiki.sk89q.com/wiki/WorldEdit/Permissions/Bukkit
-# - Now with multiworld support (see example)
-
+#
+# WEPIF Configuration File
+#
+# This file handles permissions configuration for every plugin using WEPIF
+#
+# About editing this file:
+# - DO NOT USE TABS. You MUST use spaces or Bukkit will complain. If
+# you use an editor like Notepad++ (recommended for Windows users), you
+# must configure it to "replace tabs with spaces." In Notepad++, this can
+# be changed in Settings > Preferences > Language Menu.
+# - Don't get rid of the indents. They are indented so some entries are
+# in categories (like "enforce-single-session" is in the "protection"
+# category.
+# - If you want to check the format of this file before putting it
+# into WEPIF, paste it into http://yaml-online-parser.appspot.com/
+# and see if it gives "ERROR:".
+# - Lines starting with # are comments and so they are ignored.
+#
+# About Configuration Permissions
+# - See http://wiki.sk89q.com/wiki/WorldEdit/Permissions/Bukkit
+# - Now with multiworld support (see example)
+
ignore-nijiperms-bridges: true
resolvers:
Please sign in to comment.
Something went wrong with that request. Please try again.