Upstream, generics, formatting

This commit is contained in:
MattBDev
2019-06-11 16:07:43 -04:00
parent e2c2205dac
commit cd88e513a8
126 changed files with 2488 additions and 3091 deletions

View File

@ -19,10 +19,13 @@
package com.sk89q.worldedit.scripting;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.DisallowedItemException;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.UnknownItemException;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.command.InsufficientArgumentsException;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.input.ParserContext;
@ -56,7 +59,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
/**
* Get an edit session. Every subsequent call returns a new edit session.
* Usually you only need to use one edit session.
*
*
* @return an edit session
*/
public EditSession remember() {
@ -71,7 +74,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
/**
* Get the player.
*
*
* @return the calling player
*/
public Player getPlayer() {
@ -80,7 +83,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
/**
* Get the player's session.
*
*
* @return a session
*/
public LocalSession getSession() {
@ -89,7 +92,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
/**
* Get the configuration for WorldEdit.
*
*
* @return the configuration
*/
public LocalConfiguration getConfiguration() {
@ -98,7 +101,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
/**
* Get a list of edit sessions that have been created.
*
*
* @return a list of created {@code EditSession}s
*/
public List<EditSession> getEditSessions() {
@ -107,7 +110,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
/**
* Print a regular message to the user.
*
*
* @param message a message
*/
public void print(String message) {
@ -116,7 +119,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
/**
* Print an error message to the user.
*
*
* @param message a message
*/
public void error(String message) {
@ -125,7 +128,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
/**
* Print an raw message to the user.
*
*
* @param message a message
*/
public void printRaw(String message) {
@ -184,8 +187,8 @@ public class CraftScriptContext extends CraftScriptEnvironment {
*
* @param list the input
* @return pattern
* @throws UnknownItemException
* @throws DisallowedItemException
* @throws UnknownItemException
* @throws DisallowedItemException
*/
public Pattern getBlockPattern(String list) throws WorldEditException {
ParserContext context = new ParserContext();
@ -201,8 +204,8 @@ public class CraftScriptContext extends CraftScriptEnvironment {
* @param list a list
* @param allBlocksAllowed true if all blocks are allowed
* @return set
* @throws UnknownItemException
* @throws DisallowedItemException
* @throws UnknownItemException
* @throws DisallowedItemException
*/
public Set<BaseBlock> getBlocks(String list, boolean allBlocksAllowed) throws WorldEditException {
ParserContext context = new ParserContext();
@ -219,15 +222,15 @@ public class CraftScriptContext extends CraftScriptEnvironment {
* directory traversal exploits by checking the root directory and the file
* directory. On success, a {@code java.io.File} object will be
* returned.
*
*
* <p>Use this method if you need to read a file from a directory.</p>
*
*
* @param folder sub-directory to look in
* @param filename filename (user-submitted)
* @param defaultExt default extension to append if there is none
* @param exts list of extensions for file open dialog, null for no filter
* @return a file
* @throws FilenameException
* @throws FilenameException
*/
public File getSafeOpenFile(String folder, String filename, String defaultExt, String... exts) throws FilenameException {
File dir = controller.getWorkingDirectoryFile(folder);
@ -240,15 +243,15 @@ public class CraftScriptContext extends CraftScriptEnvironment {
* directory traversal exploits by checking the root directory and the file
* directory. On success, a {@code java.io.File} object will be
* returned.
*
*
* <p>Use this method if you need to read a file from a directory.</p>
*
*
* @param folder sub-directory to look in
* @param filename filename (user-submitted)
* @param defaultExt default extension to append if there is none
* @param exts list of extensions for file save dialog, null for no filter
* @return a file
* @throws FilenameException
* @throws FilenameException
*/
public File getSafeSaveFile(String folder, String filename, String defaultExt, String... exts) throws FilenameException {
File dir = controller.getWorkingDirectoryFile(folder);

View File

@ -19,6 +19,14 @@
package com.sk89q.worldedit.scripting.java;
import com.sk89q.worldedit.scripting.RhinoContextFactory;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.ImporterTopLevel;
import org.mozilla.javascript.JavaScriptException;
import org.mozilla.javascript.RhinoException;
import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.ScriptableObject;
import java.io.IOException;
import java.io.Reader;
@ -30,14 +38,6 @@ import javax.script.ScriptEngineFactory;
import javax.script.ScriptException;
import javax.script.SimpleBindings;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.ImporterTopLevel;
import org.mozilla.javascript.JavaScriptException;
import org.mozilla.javascript.RhinoException;
import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.ScriptableObject;
import com.sk89q.worldedit.scripting.RhinoContextFactory;
public class RhinoScriptEngine extends AbstractScriptEngine {
private ScriptEngineFactory factory;
private Context cx;