mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-16 17:16:11 +00:00
BlockRegistry, MaskRegistry, PatternRegistry -> *Factory
'Registry' will need to be used for the block, entity, item, and so on registries.
This commit is contained in:
parent
65f451279c
commit
7463fdef79
@ -27,13 +27,13 @@ import com.sk89q.worldedit.event.extent.EditSessionEvent;
|
||||
import com.sk89q.worldedit.event.platform.BlockInteractEvent;
|
||||
import com.sk89q.worldedit.event.platform.InputType;
|
||||
import com.sk89q.worldedit.event.platform.PlayerInputEvent;
|
||||
import com.sk89q.worldedit.extension.factory.BlockFactory;
|
||||
import com.sk89q.worldedit.extension.factory.MaskFactory;
|
||||
import com.sk89q.worldedit.extension.factory.PatternFactory;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformManager;
|
||||
import com.sk89q.worldedit.extension.registry.BlockRegistry;
|
||||
import com.sk89q.worldedit.extension.registry.MaskRegistry;
|
||||
import com.sk89q.worldedit.extension.registry.PatternRegistry;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.function.mask.Masks;
|
||||
import com.sk89q.worldedit.function.pattern.Patterns;
|
||||
@ -84,9 +84,9 @@ public class WorldEdit {
|
||||
private final EditSessionFactory editSessionFactory = new EditSessionFactory.EditSessionFactoryImpl(eventBus);
|
||||
private final SessionManager sessions = new SessionManager(this);
|
||||
|
||||
private final BlockRegistry blockRegistry = new BlockRegistry(this);
|
||||
private final MaskRegistry maskRegistry = new MaskRegistry(this);
|
||||
private final PatternRegistry patternRegistry = new PatternRegistry(this);
|
||||
private final BlockFactory blockFactory = new BlockFactory(this);
|
||||
private final MaskFactory maskFactory = new MaskFactory(this);
|
||||
private final PatternFactory patternFactory = new PatternFactory(this);
|
||||
|
||||
static {
|
||||
WorldEditPrefixHandler.register("com.sk89q.worldedit");
|
||||
@ -132,33 +132,33 @@ public class WorldEdit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the block registry from which new {@link BaseBlock}s can be
|
||||
* Get the block factory from which new {@link BaseBlock}s can be
|
||||
* constructed.
|
||||
*
|
||||
* @return the block registry
|
||||
* @return the block factory
|
||||
*/
|
||||
public BlockRegistry getBlockRegistry() {
|
||||
return blockRegistry;
|
||||
public BlockFactory getBlockFactory() {
|
||||
return blockFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mask registry from which new {@link com.sk89q.worldedit.function.mask.Mask}s
|
||||
* Get the mask factory from which new {@link com.sk89q.worldedit.function.mask.Mask}s
|
||||
* can be constructed.
|
||||
*
|
||||
* @return the mask registry
|
||||
* @return the mask factory
|
||||
*/
|
||||
public MaskRegistry getMaskRegistry() {
|
||||
return maskRegistry;
|
||||
public MaskFactory getMaskFactory() {
|
||||
return maskFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pattern registry from which new {@link com.sk89q.worldedit.function.pattern.Pattern}s
|
||||
* Get the pattern factory from which new {@link com.sk89q.worldedit.function.pattern.Pattern}s
|
||||
* can be constructed.
|
||||
*
|
||||
* @return the pattern registry
|
||||
* @return the pattern factory
|
||||
*/
|
||||
public PatternRegistry getPatternRegistry() {
|
||||
return patternRegistry;
|
||||
public PatternFactory getPatternFactory() {
|
||||
return patternFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -211,7 +211,7 @@ public class WorldEdit {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getBlockRegistry()} and {@link BlockRegistry#parseFromInput(String, ParserContext)}
|
||||
* @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromInput(String, ParserContext)}
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
@ -220,7 +220,7 @@ public class WorldEdit {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getBlockRegistry()} and {@link BlockRegistry#parseFromInput(String, ParserContext)}
|
||||
* @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromInput(String, ParserContext)}
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
@ -231,11 +231,11 @@ public class WorldEdit {
|
||||
context.setSession(getSession(player));
|
||||
context.setRestricted(!allAllowed);
|
||||
context.setPreferringWildcard(allowNoData);
|
||||
return getBlockRegistry().parseFromInput(arg, context);
|
||||
return getBlockFactory().parseFromInput(arg, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getBlockRegistry()} and {@link BlockRegistry#parseFromInput(String, ParserContext)}
|
||||
* @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromInput(String, ParserContext)}
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
@ -244,7 +244,7 @@ public class WorldEdit {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getBlockRegistry()} and {@link BlockRegistry#parseFromListInput(String, ParserContext)}
|
||||
* @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromListInput(String, ParserContext)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
@ -258,7 +258,7 @@ public class WorldEdit {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getBlockRegistry()} and {@link BlockRegistry#parseFromInput(String, ParserContext)}
|
||||
* @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromInput(String, ParserContext)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
@ -267,7 +267,7 @@ public class WorldEdit {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getBlockRegistry()} and {@link BlockRegistry#parseFromListInput(String, ParserContext)}
|
||||
* @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromListInput(String, ParserContext)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
@ -276,7 +276,7 @@ public class WorldEdit {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getBlockRegistry()} and {@link BlockRegistry#parseFromListInput(String, ParserContext)}
|
||||
* @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromListInput(String, ParserContext)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
@ -290,7 +290,7 @@ public class WorldEdit {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getPatternRegistry()} and {@link BlockRegistry#parseFromInput(String, ParserContext)}
|
||||
* @deprecated Use {@link #getPatternFactory()} and {@link BlockFactory#parseFromInput(String, ParserContext)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
@ -299,11 +299,11 @@ public class WorldEdit {
|
||||
context.setActor(player);
|
||||
context.setWorld(player.getWorld());
|
||||
context.setSession(getSession(player));
|
||||
return Patterns.wrap(getPatternRegistry().parseFromInput(input, context));
|
||||
return Patterns.wrap(getPatternFactory().parseFromInput(input, context));
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getMaskRegistry()} ()} and {@link MaskRegistry#parseFromInput(String, ParserContext)}
|
||||
* @deprecated Use {@link #getMaskFactory()} ()} and {@link MaskFactory#parseFromInput(String, ParserContext)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
@ -312,7 +312,7 @@ public class WorldEdit {
|
||||
context.setActor(player);
|
||||
context.setWorld(player.getWorld());
|
||||
context.setSession(session);
|
||||
return Masks.wrap(getMaskRegistry().parseFromInput(input, context));
|
||||
return Masks.wrap(getMaskFactory().parseFromInput(input, context));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,13 +17,13 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.extension.registry;
|
||||
package com.sk89q.worldedit.extension.factory;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.internal.registry.AbstractRegistry;
|
||||
import com.sk89q.worldedit.internal.registry.AbstractFactory;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@ -33,16 +33,16 @@ import java.util.Set;
|
||||
* new blocks from input.
|
||||
* </p>
|
||||
* Instances of this class can be taken from
|
||||
* {@link WorldEdit#getBlockRegistry()}.
|
||||
* {@link WorldEdit#getBlockFactory()}.
|
||||
*/
|
||||
public class BlockRegistry extends AbstractRegistry<BaseBlock> {
|
||||
public class BlockFactory extends AbstractFactory<BaseBlock> {
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
* @param worldEdit the WorldEdit instance.
|
||||
*/
|
||||
public BlockRegistry(WorldEdit worldEdit) {
|
||||
public BlockFactory(WorldEdit worldEdit) {
|
||||
super(worldEdit);
|
||||
|
||||
parsers.add(new DefaultBlockParser(worldEdit));
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.extension.registry;
|
||||
package com.sk89q.worldedit.extension.factory;
|
||||
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.*;
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.extension.registry;
|
||||
package com.sk89q.worldedit.extension.factory;
|
||||
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
@ -135,7 +135,7 @@ class DefaultMaskParser extends InputParser<Mask> {
|
||||
ParserContext tempContext = new ParserContext(context);
|
||||
tempContext.setRestricted(false);
|
||||
tempContext.setPreferringWildcard(true);
|
||||
return new BlockMask(extent, worldEdit.getBlockRegistry().parseFromListInput(component, tempContext));
|
||||
return new BlockMask(extent, worldEdit.getBlockFactory().parseFromListInput(component, tempContext));
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.extension.registry;
|
||||
package com.sk89q.worldedit.extension.factory;
|
||||
|
||||
import com.sk89q.worldedit.EmptyClipboardException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
@ -17,27 +17,27 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.extension.registry;
|
||||
package com.sk89q.worldedit.extension.factory;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.internal.registry.AbstractRegistry;
|
||||
import com.sk89q.worldedit.internal.registry.AbstractFactory;
|
||||
|
||||
/**
|
||||
* A registry of known {@link Mask}s. Provides methods to instantiate
|
||||
* new masks from input.
|
||||
* </p>
|
||||
* Instances of this class can be taken from
|
||||
* {@link WorldEdit#getMaskRegistry()}.
|
||||
* {@link WorldEdit#getMaskFactory()}.
|
||||
*/
|
||||
public final class MaskRegistry extends AbstractRegistry<Mask> {
|
||||
public final class MaskFactory extends AbstractFactory<Mask> {
|
||||
|
||||
/**
|
||||
* Create a new mask registry.
|
||||
*
|
||||
* @param worldEdit the WorldEdit instance
|
||||
*/
|
||||
public MaskRegistry(WorldEdit worldEdit) {
|
||||
public MaskFactory(WorldEdit worldEdit) {
|
||||
super(worldEdit);
|
||||
|
||||
parsers.add(new DefaultMaskParser(worldEdit));
|
@ -17,27 +17,27 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.extension.registry;
|
||||
package com.sk89q.worldedit.extension.factory;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.internal.registry.AbstractRegistry;
|
||||
import com.sk89q.worldedit.internal.registry.AbstractFactory;
|
||||
|
||||
/**
|
||||
* A registry of known {@link Pattern}s. Provides methods to instantiate
|
||||
* new patterns from input.
|
||||
* </p>
|
||||
* Instances of this class can be taken from
|
||||
* {@link WorldEdit#getPatternRegistry()}.
|
||||
* {@link WorldEdit#getPatternFactory()}.
|
||||
*/
|
||||
public final class PatternRegistry extends AbstractRegistry<Pattern> {
|
||||
public final class PatternFactory extends AbstractFactory<Pattern> {
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
* @param worldEdit the WorldEdit instance
|
||||
*/
|
||||
public PatternRegistry(WorldEdit worldEdit) {
|
||||
public PatternFactory(WorldEdit worldEdit) {
|
||||
super(worldEdit);
|
||||
|
||||
parsers.add(new HashTagPatternParser(worldEdit));
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.extension.registry;
|
||||
package com.sk89q.worldedit.extension.factory;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
@ -36,7 +36,7 @@ class RandomPatternParser extends InputParser<Pattern> {
|
||||
|
||||
@Override
|
||||
public Pattern parseFromInput(String input, ParserContext context) throws InputParseException {
|
||||
BlockRegistry blockRegistry = worldEdit.getBlockRegistry();
|
||||
BlockFactory blockRegistry = worldEdit.getBlockFactory();
|
||||
RandomPattern randomPattern = new RandomPattern();
|
||||
|
||||
for (String token : input.split(",")) {
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.extension.registry;
|
||||
package com.sk89q.worldedit.extension.factory;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
@ -37,7 +37,7 @@ class SingleBlockPatternParser extends InputParser<Pattern> {
|
||||
String[] items = input.split(",");
|
||||
|
||||
if (items.length == 1) {
|
||||
return new BlockPattern(worldEdit.getBlockRegistry().parseFromInput(items[0], context));
|
||||
return new BlockPattern(worldEdit.getBlockFactory().parseFromInput(items[0], context));
|
||||
} else {
|
||||
return null;
|
||||
}
|
@ -20,8 +20,8 @@
|
||||
package com.sk89q.worldedit.extension.input;
|
||||
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.extension.factory.MaskFactory;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.registry.MaskRegistry;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
@ -29,7 +29,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Contains contextual information that may be useful when constructing
|
||||
* objects from a registry (such as {@link MaskRegistry}).
|
||||
* objects from a registry (such as {@link MaskFactory}).
|
||||
* </p>
|
||||
* By default, {@link #isRestricted()} will return true.
|
||||
*/
|
||||
|
@ -178,7 +178,7 @@ public class WorldEditBinding extends BindingHelper {
|
||||
}
|
||||
parserContext.setSession(worldEdit.getSessionManager().get(actor));
|
||||
try {
|
||||
return worldEdit.getBlockRegistry().parseFromInput(context.next(), parserContext);
|
||||
return worldEdit.getBlockFactory().parseFromInput(context.next(), parserContext);
|
||||
} catch (NoMatchException e) {
|
||||
throw new ParameterException(e.getMessage(), e);
|
||||
}
|
||||
@ -207,7 +207,7 @@ public class WorldEditBinding extends BindingHelper {
|
||||
}
|
||||
parserContext.setSession(worldEdit.getSessionManager().get(actor));
|
||||
try {
|
||||
return worldEdit.getPatternRegistry().parseFromInput(context.next(), parserContext);
|
||||
return worldEdit.getPatternFactory().parseFromInput(context.next(), parserContext);
|
||||
} catch (NoMatchException e) {
|
||||
throw new ParameterException(e.getMessage(), e);
|
||||
}
|
||||
@ -236,7 +236,7 @@ public class WorldEditBinding extends BindingHelper {
|
||||
}
|
||||
parserContext.setSession(worldEdit.getSessionManager().get(actor));
|
||||
try {
|
||||
return worldEdit.getMaskRegistry().parseFromInput(context.next(), parserContext);
|
||||
return worldEdit.getMaskFactory().parseFromInput(context.next(), parserContext);
|
||||
} catch (NoMatchException e) {
|
||||
throw new ParameterException(e.getMessage(), e);
|
||||
}
|
||||
|
@ -30,22 +30,22 @@ import java.util.List;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* An abstract implementation of a registry for internal usage.
|
||||
* An abstract implementation of a factory for internal usage.
|
||||
*
|
||||
* @param <E> the element that the registry returns
|
||||
* @param <E> the element that the factory returns
|
||||
*/
|
||||
@SuppressWarnings("ProtectedField")
|
||||
public abstract class AbstractRegistry<E> {
|
||||
public abstract class AbstractFactory<E> {
|
||||
|
||||
protected final WorldEdit worldEdit;
|
||||
protected final List<InputParser<E>> parsers = new ArrayList<InputParser<E>>();
|
||||
|
||||
/**
|
||||
* Create a new registry.
|
||||
* Create a new factory.
|
||||
*
|
||||
* @param worldEdit the WorldEdit instance
|
||||
*/
|
||||
protected AbstractRegistry(WorldEdit worldEdit) {
|
||||
protected AbstractFactory(WorldEdit worldEdit) {
|
||||
checkNotNull(worldEdit);
|
||||
this.worldEdit = worldEdit;
|
||||
}
|
@ -24,7 +24,7 @@ import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
|
||||
/**
|
||||
* Input parser interface for {@link AbstractRegistry}.
|
||||
* Input parser interface for {@link AbstractFactory}.
|
||||
*
|
||||
* @param <E> the element
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user