Revert "Upstream, generics, formatting"

This reverts commit cd88e513a8.
This commit is contained in:
NotMyFault
2019-06-12 15:45:41 +02:00
parent 6f9fa018b2
commit ec001b8d3b
126 changed files with 3093 additions and 2490 deletions

View File

@ -19,13 +19,10 @@
package com.sk89q.worldedit.scripting;
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.*;
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.command.InsufficientArgumentsException;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.input.ParserContext;
@ -59,7 +56,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() {
@ -74,7 +71,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
/**
* Get the player.
*
*
* @return the calling player
*/
public Player getPlayer() {
@ -83,7 +80,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
/**
* Get the player's session.
*
*
* @return a session
*/
public LocalSession getSession() {
@ -92,7 +89,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
/**
* Get the configuration for WorldEdit.
*
*
* @return the configuration
*/
public LocalConfiguration getConfiguration() {
@ -101,7 +98,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() {
@ -110,7 +107,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
/**
* Print a regular message to the user.
*
*
* @param message a message
*/
public void print(String message) {
@ -119,7 +116,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
/**
* Print an error message to the user.
*
*
* @param message a message
*/
public void error(String message) {
@ -128,7 +125,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
/**
* Print an raw message to the user.
*
*
* @param message a message
*/
public void printRaw(String message) {
@ -187,8 +184,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();
@ -204,8 +201,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();
@ -222,15 +219,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);
@ -243,15 +240,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,14 +19,6 @@
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;
@ -38,6 +30,14 @@ 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;