Permalink
Browse files

Commit missed diffs

  • Loading branch information...
PseudoKnight committed Aug 8, 2018
1 parent 0ccb963 commit ce6290d88cf4439ae7cba6bd4aa5819041ef756c
@@ -1,5 +1,7 @@
package com.laytonsmith.abstraction;
import com.laytonsmith.abstraction.blocks.MCBlockData;
import com.laytonsmith.abstraction.blocks.MCMaterial;
import com.laytonsmith.abstraction.enums.MCInstrument;
import com.laytonsmith.abstraction.enums.MCParticle;
import com.laytonsmith.abstraction.enums.MCSound;
@@ -109,7 +111,9 @@
String getHost();
void sendBlockChange(MCLocation loc, int material, byte data);
void sendBlockChange(MCLocation loc, MCMaterial material, byte data);
void sendBlockChange(MCLocation loc, MCBlockData data);
void sendSignTextChange(MCLocation loc, String[] lines);
@@ -109,7 +109,6 @@
import org.bukkit.entity.ComplexEntityPart;
import org.bukkit.entity.ComplexLivingEntity;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.Hanging;
import org.bukkit.entity.HumanEntity;
@@ -24,7 +24,6 @@
import com.laytonsmith.abstraction.enums.MCParticle;
import com.laytonsmith.abstraction.enums.MCSound;
import com.laytonsmith.abstraction.enums.MCSoundCategory;
import com.laytonsmith.abstraction.enums.MCVersion;
import com.laytonsmith.abstraction.enums.MCWeather;
import com.laytonsmith.abstraction.enums.bukkit.BukkitMCInstrument;
import com.laytonsmith.abstraction.enums.bukkit.BukkitMCSound;
@@ -9,7 +9,6 @@
import com.laytonsmith.abstraction.MCPlayer;
import com.laytonsmith.abstraction.MCTravelAgent;
import com.laytonsmith.abstraction.MCWorld;
import com.laytonsmith.abstraction.StaticLayer;
import com.laytonsmith.abstraction.blocks.MCBlock;
import com.laytonsmith.abstraction.blocks.MCBlockFace;
import com.laytonsmith.abstraction.bukkit.BukkitConvertor;
@@ -19,7 +18,6 @@
import com.laytonsmith.abstraction.bukkit.BukkitMCTravelAgent;
import com.laytonsmith.abstraction.bukkit.BukkitMCWorld;
import com.laytonsmith.abstraction.bukkit.blocks.BukkitMCBlock;
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCEntity;
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCFishHook;
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCHumanEntity;
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer;
@@ -658,7 +656,7 @@ public MCPlayer getEntity() {
@Override
public MCEntity getKiller() {
return StaticLayer.GetCorrectEntity(new BukkitMCEntity(pde.getEntity().getKiller()));
return BukkitConvertor.BukkitGetCorrectEntity(pde.getEntity().getKiller());
}
@Override
@@ -9,7 +9,7 @@
import com.laytonsmith.abstraction.bukkit.blocks.BukkitMCBlock;
import com.laytonsmith.abstraction.enums.MCCollisionType;
import com.laytonsmith.abstraction.events.MCVehicleBlockCollideEvent;
import com.laytonsmith.abstraction.events.MCVehicleEnitityCollideEvent;
import com.laytonsmith.abstraction.events.MCVehicleEntityCollideEvent;
import com.laytonsmith.abstraction.events.MCVehicleEnterExitEvent;
import com.laytonsmith.abstraction.events.MCVehicleEvent;
import com.laytonsmith.abstraction.events.MCVehicleMoveEvent;
@@ -28,7 +28,7 @@
@abstraction(type = Implementation.Type.BUKKIT)
public static class BukkitMCVehicleEntityCollideEvent extends BukkitMCVehicleEvent
implements MCVehicleEnitityCollideEvent {
implements MCVehicleEntityCollideEvent {
VehicleEntityCollisionEvent vec;
@@ -8,6 +8,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -16,8 +17,8 @@
public abstract class MCEntityType<Concrete> extends DynamicEnum<MCEntityType.MCVanillaEntityType, Concrete> {
// To be filled by the implementer
protected static Map<String, MCEntityType> mappings;
protected static Map<MCVanillaEntityType, MCEntityType> vanilla;
protected static final Map<String, MCEntityType> MAP = new HashMap<>();
protected static final Map<MCVanillaEntityType, MCEntityType> VANILLA_MAP = new HashMap<>();
@SuppressWarnings("checkstyle:staticvariablename") // Fixing this violation might break dependents.
public static MCEntityType NULL = null;
@@ -45,21 +46,15 @@ public MCVanillaEntityType getAbstracted() {
}
public static MCEntityType valueOf(String test) throws IllegalArgumentException {
if(mappings == null) {
return null;
}
MCEntityType ret = mappings.get(test);
MCEntityType ret = MAP.get(test);
if(ret == null) {
throw new IllegalArgumentException("Unknown entity type: " + test);
}
return ret;
}
public static MCEntityType valueOfVanillaType(MCVanillaEntityType type) {
if(vanilla == null) {
return null;
}
return vanilla.get(type);
return VANILLA_MAP.get(type);
}
/**
@@ -73,7 +68,7 @@ public static MCEntityType valueOfVanillaType(MCVanillaEntityType type) {
}
return dummy;
}
return mappings.keySet();
return MAP.keySet();
}
/**
@@ -102,7 +97,7 @@ public boolean isSpawnable() {
}
return dummy;
}
return mappings.values();
return MAP.values();
}
@MEnum("VanillaEntityType")
@@ -6,15 +6,15 @@
public enum MCInventoryType {
BREWING,
CHEST,
CRAFTING(false), // bukkit doesn't allow opening
CREATIVE(false), // bukkit doesn't allow opening
CRAFTING(false),
CREATIVE(false),
DISPENSER,
DROPPER,
ENCHANTING(false), // non-functional
ENDER_CHEST,
FURNACE,
HOPPER,
MERCHANT(false), // doesn't open
MERCHANT(false),
PLAYER,
WORKBENCH,
ANVIL,
@@ -15,21 +15,20 @@
import com.laytonsmith.core.constructs.Target;
import org.bukkit.entity.EntityType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class BukkitMCEntityType extends MCEntityType<EntityType> {
protected static final Map<EntityType, MCEntityType> BUKKIT_MAP = new HashMap<>();
public BukkitMCEntityType(EntityType concreteType, MCVanillaEntityType abstractedType) {
super(abstractedType, concreteType);
}
// This way we don't take up extra memory on non-bukkit implementations
public static void build() {
vanilla = new HashMap<>();
mappings = new HashMap<>();
NULL = new BukkitMCEntityType(EntityType.UNKNOWN, MCVanillaEntityType.UNKNOWN);
ArrayList<EntityType> counted = new ArrayList<>();
for(MCVanillaEntityType v : MCVanillaEntityType.values()) {
if(v.existsInCurrent()) {
EntityType type;
@@ -41,14 +40,15 @@ public static void build() {
}
BukkitMCEntityType wrapper = new BukkitMCEntityType(type, v);
wrapper.setWrapperClass();
vanilla.put(v, wrapper);
mappings.put(v.name(), wrapper);
counted.add(type);
VANILLA_MAP.put(v, wrapper);
MAP.put(v.name(), wrapper);
BUKKIT_MAP.put(type, wrapper);
}
}
for(EntityType b : EntityType.values()) {
if(!counted.contains(b)) {
mappings.put(b.name(), new BukkitMCEntityType(b, MCVanillaEntityType.UNKNOWN));
if(!BUKKIT_MAP.containsKey(b)) {
MAP.put(b.name(), new BukkitMCEntityType(b, MCVanillaEntityType.UNKNOWN));
BUKKIT_MAP.put(b, new BukkitMCEntityType(b, MCVanillaEntityType.UNKNOWN));
}
}
}
@@ -73,10 +73,9 @@ public boolean isSpawnable() {
}
public static BukkitMCEntityType valueOfConcrete(EntityType test) {
for(MCEntityType t : mappings.values()) {
if(((BukkitMCEntityType) t).getConcrete().equals(test)) {
return (BukkitMCEntityType) t;
}
MCEntityType type = BUKKIT_MAP.get(test);
if(type != null) {
return (BukkitMCEntityType) type;
}
return (BukkitMCEntityType) NULL;
}
@@ -2,7 +2,7 @@
import com.laytonsmith.abstraction.MCEntity;
public interface MCVehicleEnitityCollideEvent extends MCVehicleCollideEvent {
public interface MCVehicleEntityCollideEvent extends MCVehicleCollideEvent {
MCEntity getEntity();
@@ -873,7 +873,7 @@ public MCItemMeta itemMeta(Construct c, MCMaterial mat, Target t) throws ConfigR
throw new CREFormatException(ex.getMessage(), t, ex);
}
} else {
throw new CREFormatException("An array was expected but recieved " + c + " instead.", t);
throw new CREFormatException("An array was expected but received " + c + " instead.", t);
}
return meta;
}
@@ -1326,7 +1326,7 @@ public Construct recipe(MCRecipe r, Target t) {
public MCRecipe recipe(Construct c, Target t) {
if(!(c instanceof CArray)) {
throw new CRECastException("Expected array but recieved " + c.getCType().name(), t);
throw new CRECastException("Expected array but received " + c.getCType().name(), t);
}
CArray recipe = (CArray) c;
@@ -16,7 +16,6 @@
import com.laytonsmith.abstraction.MCPlayer;
import com.laytonsmith.abstraction.MCPlugin;
import com.laytonsmith.abstraction.MCServer;
import com.laytonsmith.abstraction.entities.MCVehicle;
import com.laytonsmith.abstraction.MCWorld;
import com.laytonsmith.abstraction.StaticLayer;
import com.laytonsmith.annotations.typeof;
@@ -68,7 +67,6 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -860,26 +858,6 @@ public static MCLivingEntity getLivingByUUID(UUID id, Target t) {
return (MCLivingEntity) ent;
}
/**
* Returns all vehicles from all maps.
*
* @return
*/
public static List<MCVehicle> getVehicles() {
List<MCVehicle> vehicles = new ArrayList<MCVehicle>();
for(MCWorld w : Static.getServer().getWorlds()) {
for(MCEntity e : w.getEntities()) {
MCEntity entity = StaticLayer.GetCorrectEntity(e);
if(entity instanceof MCVehicle) {
vehicles.add((MCVehicle) entity);
}
}
}
return vehicles;
}
/**
* Returns the world with the specified name. If it does not exist, a ConfigRuntimeException is thrown.
*
@@ -1185,7 +1163,6 @@ public static void AssertPlayerNonNull(MCPlayer p, Target t) throws ConfigRuntim
if(p == null) {
throw new CREPlayerOfflineException("No player was specified!", t);
}
assert p != null;
}
public static long msToTicks(long ms) {
@@ -437,7 +437,7 @@ public Construct exec(Target t, Environment environment, Construct... args) thro
if(args[1] instanceof CArray) {
l = ObjectGenerator.GetGenerator().location((CArray) args[1], e.getWorld(), t);
} else {
throw new CREFormatException("An array was expected but recieved " + args[1], t);
throw new CREFormatException("An array was expected but received " + args[1], t);
}
return CBoolean.get(e.teleport(l));
}
@@ -1380,7 +1380,7 @@ public Construct exec(Target t,
float pitch = 1;
if(!(args[1] instanceof CArray)) {
throw new CREFormatException("An array was expected but recieved " + args[1], t);
throw new CREFormatException("An array was expected but received " + args[1], t);
}
CArray sa = (CArray) args[1];
@@ -1499,7 +1499,7 @@ public Construct exec(Target t,
float pitch = 1;
if(!(args[1] instanceof CArray)) {
throw new CREFormatException("An array was expected but recieved " + args[1], t);
throw new CREFormatException("An array was expected but received " + args[1], t);
}
CArray sa = (CArray) args[1];
@@ -1699,7 +1699,7 @@ public Construct exec(Target t, com.laytonsmith.core.environments.Environment en
throws ConfigRuntimeException {
MCWorld w = null;
MCPlayer pl = environment.getEnv(CommandHelperEnvironment.class).GetPlayer();
if(pl instanceof MCPlayer) {
if(pl != null) {
w = pl.getWorld();
}
MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], w, t);
@@ -1753,7 +1753,7 @@ public Construct exec(Target t, com.laytonsmith.core.environments.Environment en
throws ConfigRuntimeException {
MCWorld w = null;
MCPlayer pl = environment.getEnv(CommandHelperEnvironment.class).GetPlayer();
if(pl instanceof MCPlayer) {
if(pl != null) {
w = pl.getWorld();
}
MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], w, t);
@@ -1841,7 +1841,7 @@ public Construct exec(Target t, com.laytonsmith.core.environments.Environment en
throws ConfigRuntimeException {
MCWorld w = null;
MCPlayer pl = environment.getEnv(CommandHelperEnvironment.class).GetPlayer();
if(pl instanceof MCPlayer) {
if(pl != null) {
w = pl.getWorld();
}
MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], w, t);
@@ -359,14 +359,14 @@ public Construct exec(Target t, Environment environment, Construct... args) thro
if(args[2] instanceof CArray) {
color = (CArray) args[2];
} else {
throw new CREFormatException("Expected an array but recieved " + args[2] + " instead.", t);
throw new CREFormatException("Expected an array but received " + args[2] + " instead.", t);
}
} else {
slot = Static.getInt32(args[0], t);
if(args[1] instanceof CArray) {
color = (CArray) args[1];
} else {
throw new CREFormatException("Expected an array but recieved " + args[1] + " instead.", t);
throw new CREFormatException("Expected an array but received " + args[1] + " instead.", t);
}
}
Static.AssertPlayerNonNull(p, t);
@@ -259,7 +259,8 @@ public Construct exec(Target t, Environment env, Construct... args) throws Confi
try {
e = MCEffect.valueOf(preEff.toUpperCase());
} catch (IllegalArgumentException ex) {
throw new CREFormatException("The effect type " + args[1].val() + " is not valid", t);
CHLog.GetLogger().e(CHLog.Tags.GENERAL, "The effect type " + args[1].val() + " is not valid", t);
return CVoid.VOID;
}
if(e.equals(MCEffect.STEP_SOUND)) {
MCMaterial mat = StaticLayer.GetConvertor().getMaterial(data);
@@ -348,7 +349,7 @@ public Construct exec(Target t, Environment env, Construct... args) throws Cance
throw new CRERangeException(this.getName() + " expects the index to be between -1 and 16 (inclusive)", t);
}
ArrayList<Construct> retVals = new ArrayList<Construct>();
ArrayList<Construct> retVals = new ArrayList<>();
if(index == 0 || index == -1) {
//Server name
@@ -597,7 +597,7 @@ public Construct exec(Target t, Environment environment, Construct... args) thro
int age = Static.getInt32(args[1], t);
boolean lock = false;
if(args.length == 3) {
lock = (boolean) Static.getBoolean(args[2], t);
lock = Static.getBoolean(args[2], t);
}
MCLivingEntity ent = Static.getLivingEntity(args[0], t);
if(ent == null) {
Oops, something went wrong.

0 comments on commit ce6290d

Please sign in to comment.