Fixed potential NPEs and added @Nonnull and @Nullable annotations
This commit is contained in:
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.WorldHandler;
|
||||
@@ -191,11 +192,13 @@ public abstract class CommandBuilder implements ICommandBuilderSyntax
|
||||
return this.get(index, ArgumentType.LONG);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
protected CoordinateInt getNodeAsCoordinateInt(int index)
|
||||
{
|
||||
return this.get(index, ArgumentType.COORDINATE_INT);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
protected CoordinateDouble getNodeAsCoordinateDouble(int index)
|
||||
{
|
||||
return this.get(index, ArgumentType.COORDINATE_DOUBLE);
|
||||
@@ -207,6 +210,7 @@ public abstract class CommandBuilder implements ICommandBuilderSyntax
|
||||
return this.get(index, ArgumentType.RESOURCE_LOCATION);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
protected TargetSelector getNodeAsTargetSelector(int index)
|
||||
{
|
||||
return this.get(index, ArgumentType.TARGET_SELECTOR);
|
||||
|
||||
@@ -3,6 +3,8 @@ package exopandora.worldhandler.builder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import exopandora.worldhandler.util.NBTHelper;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
@@ -46,6 +48,7 @@ public abstract class CommandBuilderNBT extends CommandBuilder implements IComma
|
||||
return super.toActualCommand();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected CompoundNBT buildNBT()
|
||||
{
|
||||
CompoundNBT nbt = new CompoundNBT();
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
|
||||
@@ -77,7 +77,7 @@ public class BuilderAdvancement extends CommandBuilder
|
||||
|
||||
public BuilderAdvancement getBuilder(EnumActionType action, EnumMode mode)
|
||||
{
|
||||
return new BuilderAdvancement(action, this.getPlayer(), mode, (mode != null && !mode.equals(EnumMode.EVERYTHING)) ? this.getAdvancement() : null);
|
||||
return new BuilderAdvancement(action, this.getPlayer(), mode, !EnumMode.EVERYTHING.equals(mode) ? this.getAdvancement() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package exopandora.worldhandler.builder.impl;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
@@ -59,16 +60,19 @@ public class BuilderClone extends BuilderDoubleBlockPos
|
||||
this.setNode(8, z);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public CoordinateInt getXCoordiante()
|
||||
{
|
||||
return this.getNodeAsCoordinateInt(6);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public CoordinateInt getYCoordiante()
|
||||
{
|
||||
return this.getNodeAsCoordinateInt(7);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public CoordinateInt getZCoordiante()
|
||||
{
|
||||
return this.getNodeAsCoordinateInt(8);
|
||||
@@ -99,6 +103,7 @@ public class BuilderClone extends BuilderDoubleBlockPos
|
||||
this.setNode(9, mask != null ? mask.toString() : null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public EnumMask getMask()
|
||||
{
|
||||
return EnumHelper.valueOf(this.getNodeAsString(9), EnumMask.class);
|
||||
|
||||
@@ -4,10 +4,10 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
import exopandora.worldhandler.builder.types.CoordinateInt;
|
||||
import exopandora.worldhandler.builder.types.TargetSelector;
|
||||
import exopandora.worldhandler.util.EnumHelper;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -57,6 +57,7 @@ public class BuilderData extends BuilderBlockPos
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public EnumMode getMode()
|
||||
{
|
||||
return EnumHelper.valueOf(this.getNodeAsString(0), EnumMode.class);
|
||||
@@ -79,6 +80,7 @@ public class BuilderData extends BuilderBlockPos
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public EnumTarget getTarget()
|
||||
{
|
||||
return EnumHelper.valueOf(this.getNodeAsString(1), EnumTarget.class);
|
||||
@@ -254,6 +256,7 @@ public class BuilderData extends BuilderBlockPos
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public CoordinateInt getXCoordinate()
|
||||
{
|
||||
this.ensureTarget(EnumTarget.BLOCK);
|
||||
@@ -261,6 +264,7 @@ public class BuilderData extends BuilderBlockPos
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public CoordinateInt getYCoordinate()
|
||||
{
|
||||
this.ensureTarget(EnumTarget.BLOCK);
|
||||
@@ -268,6 +272,7 @@ public class BuilderData extends BuilderBlockPos
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public CoordinateInt getZCoordinate()
|
||||
{
|
||||
this.ensureTarget(EnumTarget.BLOCK);
|
||||
@@ -275,6 +280,7 @@ public class BuilderData extends BuilderBlockPos
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public BlockPos getBlockPos()
|
||||
{
|
||||
this.ensureTarget(EnumTarget.BLOCK);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package exopandora.worldhandler.builder.impl;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import exopandora.worldhandler.builder.CommandBuilder;
|
||||
import exopandora.worldhandler.builder.types.CoordinateInt;
|
||||
import exopandora.worldhandler.util.BlockHelper;
|
||||
@@ -53,16 +55,19 @@ public abstract class BuilderDoubleBlockPos extends CommandBuilder
|
||||
this.setNode(2, z);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public CoordinateInt getX1Coordiante()
|
||||
{
|
||||
return this.getNodeAsCoordinateInt(0);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public CoordinateInt getY1Coordiante()
|
||||
{
|
||||
return this.getNodeAsCoordinateInt(1);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public CoordinateInt getZ1Coordiante()
|
||||
{
|
||||
return this.getNodeAsCoordinateInt(2);
|
||||
@@ -125,16 +130,19 @@ public abstract class BuilderDoubleBlockPos extends CommandBuilder
|
||||
this.setNode(5, z);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public CoordinateInt getX2Coordiante()
|
||||
{
|
||||
return this.getNodeAsCoordinateInt(3);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public CoordinateInt getY2Coordiante()
|
||||
{
|
||||
return this.getNodeAsCoordinateInt(4);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public CoordinateInt getZ2Coordiante()
|
||||
{
|
||||
return this.getNodeAsCoordinateInt(5);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package exopandora.worldhandler.builder.impl;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.CommandBuilder;
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
@@ -11,9 +13,10 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class BuilderEnchantment extends CommandBuilder
|
||||
{
|
||||
public void getPlayer(String player)
|
||||
@Nullable
|
||||
public String getPlayer()
|
||||
{
|
||||
this.getNodeAsString(0);
|
||||
return this.getNodeAsString(0);
|
||||
}
|
||||
|
||||
public void setPlayer(String player)
|
||||
@@ -21,6 +24,7 @@ public class BuilderEnchantment extends CommandBuilder
|
||||
this.setNode(0, player);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ResourceLocation getEnchantment()
|
||||
{
|
||||
return this.getNodeAsResourceLocation(1);
|
||||
|
||||
@@ -28,6 +28,7 @@ public class BuilderExecute extends CommandBuilder
|
||||
this.setNode(1, target);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getTarget()
|
||||
{
|
||||
return this.getNodeAsString(1);
|
||||
@@ -56,6 +57,7 @@ public class BuilderExecute extends CommandBuilder
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getCommand()
|
||||
{
|
||||
return this.getNodeAsString(3);
|
||||
|
||||
@@ -41,6 +41,7 @@ public class BuilderExperience extends CommandBuilder
|
||||
this.setNode(1, player);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getPlayer()
|
||||
{
|
||||
return this.getNodeAsString(1);
|
||||
@@ -51,6 +52,7 @@ public class BuilderExperience extends CommandBuilder
|
||||
this.setNode(2, level);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public int getLevel()
|
||||
{
|
||||
return this.getNodeAsInt(2);
|
||||
|
||||
@@ -11,7 +11,7 @@ public class BuilderGamemode extends CommandBuilder
|
||||
{
|
||||
public BuilderGamemode()
|
||||
{
|
||||
|
||||
super();
|
||||
}
|
||||
|
||||
public BuilderGamemode(EnumGamemode mode)
|
||||
|
||||
@@ -35,6 +35,7 @@ public class BuilderGive extends CommandBuilderNBT
|
||||
this.setNode(0, username);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getPlayer()
|
||||
{
|
||||
return this.getNodeAsString(0);
|
||||
@@ -74,9 +75,17 @@ public class BuilderGive extends CommandBuilderNBT
|
||||
this.setNode(1, this.itemResourceLocation);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public CompoundNBT getNBT()
|
||||
{
|
||||
return this.getNodeAsItemResourceLocation(1).getNBT();
|
||||
ItemResourceLocation item = this.getItem();
|
||||
|
||||
if(item != null)
|
||||
{
|
||||
return item.getNBT();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package exopandora.worldhandler.builder.impl;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.CommandBuilder;
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
@@ -21,6 +23,7 @@ public class BuilderPlayer extends CommandBuilder
|
||||
this.setNode(0, player);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getPlayer()
|
||||
{
|
||||
return this.getNodeAsString(0);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package exopandora.worldhandler.builder.impl;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.CommandBuilder;
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
@@ -21,6 +23,7 @@ public class BuilderPlayerReason extends CommandBuilder
|
||||
this.setNode(0, player);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getPlayer()
|
||||
{
|
||||
return this.getNodeAsString(0);
|
||||
@@ -31,6 +34,7 @@ public class BuilderPlayerReason extends CommandBuilder
|
||||
this.setNode(1, reason);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getReason()
|
||||
{
|
||||
return this.getNodeAsString(1);
|
||||
|
||||
@@ -52,6 +52,7 @@ public class BuilderPotionEffect extends CommandBuilder
|
||||
this.setNode(1, player);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getPlayer()
|
||||
{
|
||||
return this.getNodeAsString(1);
|
||||
@@ -80,6 +81,7 @@ public class BuilderPotionEffect extends CommandBuilder
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ResourceLocation getEffect()
|
||||
{
|
||||
return this.getNodeAsResourceLocation(2);
|
||||
|
||||
@@ -37,6 +37,7 @@ public class BuilderScoreboardObjectives extends BuilderScoreboard
|
||||
this.init();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public EnumMode getMode()
|
||||
{
|
||||
return EnumHelper.valueOf(this.getNodeAsString(1), EnumMode.class);
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package exopandora.worldhandler.builder.impl;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.lang3.RegExUtils;
|
||||
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
import exopandora.worldhandler.util.EnumHelper;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -18,9 +23,10 @@ public class BuilderScoreboardPlayers extends BuilderScoreboard
|
||||
this.setNode(0, "players");
|
||||
}
|
||||
|
||||
public String getMode()
|
||||
@Nullable
|
||||
public EnumMode getMode()
|
||||
{
|
||||
return this.getNodeAsString(1);
|
||||
return EnumHelper.valueOf(this.getNodeAsString(1), EnumMode.class);
|
||||
}
|
||||
|
||||
public void setMode(String mode)
|
||||
@@ -47,6 +53,7 @@ public class BuilderScoreboardPlayers extends BuilderScoreboard
|
||||
this.setNode(2, player);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getPlayer()
|
||||
{
|
||||
return this.getNodeAsString(2);
|
||||
@@ -54,20 +61,16 @@ public class BuilderScoreboardPlayers extends BuilderScoreboard
|
||||
|
||||
public void setObjective(String name)
|
||||
{
|
||||
String mode = this.getMode();
|
||||
String objective = name != null ? name.replaceAll(" ", "_") : null;
|
||||
|
||||
if(mode != null)
|
||||
if(this.getMode() != null)
|
||||
{
|
||||
this.setNode(3, objective);
|
||||
this.setNode(3, RegExUtils.replaceAll(name, " ", "_"));
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getObjective()
|
||||
{
|
||||
String mode = this.getMode();
|
||||
|
||||
if(mode != null)
|
||||
if(this.getMode() != null)
|
||||
{
|
||||
return this.getNodeAsString(3);
|
||||
}
|
||||
@@ -82,7 +85,7 @@ public class BuilderScoreboardPlayers extends BuilderScoreboard
|
||||
|
||||
public int getPoints()
|
||||
{
|
||||
if(this.getMode() != null && !this.getMode().equals("enable"))
|
||||
if(!EnumMode.ENABLE.equals(this.getMode()))
|
||||
{
|
||||
return this.getNodeAsInt(4);
|
||||
}
|
||||
@@ -111,7 +114,6 @@ public class BuilderScoreboardPlayers extends BuilderScoreboard
|
||||
syntax.addRequired("score", ArgumentType.INT, 0);
|
||||
|
||||
return syntax;
|
||||
|
||||
}
|
||||
|
||||
public BuilderScoreboardPlayers getBuilderForPoints(EnumMode mode)
|
||||
|
||||
@@ -472,6 +472,11 @@ public class BuilderSummon extends CommandBuilderNBT
|
||||
{
|
||||
String name = ResourceHelper.stripToResourceLocation(entityName);
|
||||
|
||||
if(name == null || name.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
for(EntityType<?> type : ForgeRegistries.ENTITIES.getValues())
|
||||
{
|
||||
if(type.isSummonable() && entityName.equalsIgnoreCase(I18n.format(type.getTranslationKey())))
|
||||
@@ -482,116 +487,111 @@ public class BuilderSummon extends CommandBuilderNBT
|
||||
|
||||
String entity = name.replaceAll("_", "");
|
||||
|
||||
if(entity.equalsIgnoreCase("RedCow"))
|
||||
if("RedCow".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.MOOSHROOM.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("ChickenJockey"))
|
||||
else if("ChickenJockey".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.CHICKEN.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("Pigman") || entity.equalsIgnoreCase("ZombiePig") || entity.equalsIgnoreCase("ZombiePigman"))
|
||||
else if("Pigman".equalsIgnoreCase(entity) || "ZombiePig".equalsIgnoreCase(entity) || "ZombiePigman".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.PIGLIN.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("Wither"))
|
||||
else if("Wither".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.WITHER.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("Dog"))
|
||||
else if("Dog".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.WOLF.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("Dragon"))
|
||||
else if("Dragon".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.ENDER_DRAGON.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("SnowMan"))
|
||||
else if("SnowMan".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.SNOW_GOLEM.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("Horse") || entity.equalsIgnoreCase("ZombieHorse") || entity.equalsIgnoreCase("SkeletonHorse"))
|
||||
else if("Horse".equalsIgnoreCase(entity) || "ZombieHorse".equalsIgnoreCase(entity) || "SkeletonHorse".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.HORSE.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("LavaCube")|| entity.equalsIgnoreCase("MagmaSlime") || entity.equalsIgnoreCase("MagmaCube"))
|
||||
else if("LavaCube".equalsIgnoreCase(entity)|| "MagmaSlime".equalsIgnoreCase(entity) || "MagmaCube".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.MAGMA_CUBE.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("SpiderJockey"))
|
||||
else if("SpiderJockey".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.SPIDER.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("IronGolem"))
|
||||
else if("IronGolem".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.IRON_GOLEM.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("Ozelot") || entity.equals("Ocelot"))
|
||||
else if("Ozelot".equalsIgnoreCase(entity) || entity.equals("Ocelot"))
|
||||
{
|
||||
return EntityType.OCELOT.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("Kitty") || entity.equalsIgnoreCase("Kitten"))
|
||||
else if("Kitty".equalsIgnoreCase(entity) || "Kitten".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.CAT.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("TESTIFICATE") || entity.equalsIgnoreCase("Blacksmith") || entity.equalsIgnoreCase("Farmer") || entity.equalsIgnoreCase("Fisherman") || entity.equalsIgnoreCase("Shepherd") || entity.equalsIgnoreCase("Fletcher") || entity.equalsIgnoreCase("Librarian") || entity.equalsIgnoreCase("Cleric") || entity.equalsIgnoreCase("Priest") || entity.equalsIgnoreCase("Armorer") || entity.equalsIgnoreCase("WeaponSmith") || entity.equalsIgnoreCase("ToolSmith") || entity.equalsIgnoreCase("Butcher") || entity.equalsIgnoreCase("Leatherworker") || entity.equalsIgnoreCase("Carthographer") || entity.equalsIgnoreCase("Nitwit"))
|
||||
else if("TESTIFICATE".equalsIgnoreCase(entity) || "Blacksmith".equalsIgnoreCase(entity) || "Farmer".equalsIgnoreCase(entity) || "Fisherman".equalsIgnoreCase(entity) || "Shepherd".equalsIgnoreCase(entity) || "Fletcher".equalsIgnoreCase(entity) || "Librarian".equalsIgnoreCase(entity) || "Cleric".equalsIgnoreCase(entity) || "Priest".equalsIgnoreCase(entity) || "Armorer".equalsIgnoreCase(entity) || "WeaponSmith".equalsIgnoreCase(entity) || "ToolSmith".equalsIgnoreCase(entity) || "Butcher".equalsIgnoreCase(entity) || "Leatherworker".equalsIgnoreCase(entity) || "Carthographer".equalsIgnoreCase(entity) || "Nitwit".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.VILLAGER.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("Octopus") || entity.equalsIgnoreCase("Kraken"))
|
||||
else if("Octopus".equalsIgnoreCase(entity) || "Kraken".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.SQUID.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("Exwife"))
|
||||
else if("Exwife".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.GHAST.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("TNTMinecart"))
|
||||
else if("TNTMinecart".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.TNT_MINECART.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("Minecart"))
|
||||
else if("Minecart".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.MINECART.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("HopperMinecart"))
|
||||
else if("HopperMinecart".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.HOPPER_MINECART.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("ChestMinecart"))
|
||||
else if("ChestMinecart".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.CHEST_MINECART.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("SpawnerMinecart"))
|
||||
else if("SpawnerMinecart".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.SPAWNER_MINECART.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("FurnaceMinecart"))
|
||||
else if("FurnaceMinecart".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.FURNACE_MINECART.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("CommandBlockMinecart") || entity.equalsIgnoreCase("MinecartCommand") || entity.equalsIgnoreCase("CommandMinecart"))
|
||||
else if("CommandBlockMinecart".equalsIgnoreCase(entity) || "MinecartCommand".equalsIgnoreCase(entity) || "CommandMinecart".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.COMMAND_BLOCK_MINECART.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("Wizard"))
|
||||
else if("Wizard".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.EVOKER.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("Johnny"))
|
||||
else if("Johnny".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.VINDICATOR.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("BabyZombie"))
|
||||
else if("BabyZombie".equalsIgnoreCase(entity))
|
||||
{
|
||||
return EntityType.ZOMBIE.getRegistryName();
|
||||
}
|
||||
|
||||
if(entity == null || entity.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return ResourceHelper.stringToResourceLocation(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package exopandora.worldhandler.builder.impl;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.CommandBuilder;
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
@@ -11,7 +13,7 @@ public class BuilderTag extends CommandBuilder
|
||||
{
|
||||
public BuilderTag()
|
||||
{
|
||||
|
||||
super();
|
||||
}
|
||||
|
||||
public BuilderTag(String player, EnumMode mode, String name)
|
||||
@@ -26,6 +28,7 @@ public class BuilderTag extends CommandBuilder
|
||||
this.setNode(0, player);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getPlayer()
|
||||
{
|
||||
return this.getNodeAsString(0);
|
||||
@@ -44,6 +47,7 @@ public class BuilderTag extends CommandBuilder
|
||||
this.setNode(2, name);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getName()
|
||||
{
|
||||
return this.getNodeAsString(2);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package exopandora.worldhandler.builder.impl;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.CommandBuilder;
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
@@ -27,6 +29,7 @@ public class BuilderTrigger extends CommandBuilder
|
||||
this.setNode(0, name != null ? name.replaceAll(" ", "_") : null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getObjective()
|
||||
{
|
||||
return this.getNodeAsString(0);
|
||||
@@ -40,6 +43,7 @@ public class BuilderTrigger extends CommandBuilder
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public EnumMode getMode()
|
||||
{
|
||||
return EnumHelper.valueOf(this.getNodeAsString(1), EnumMode.class);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package exopandora.worldhandler.builder.impl;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.CommandBuilder;
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.CommandSyntax.Argument;
|
||||
@@ -91,6 +93,7 @@ public class BuilderUsercontent extends CommandBuilder
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String get(int index)
|
||||
{
|
||||
if(index < this.syntax.getArguments().size() && index >= 0)
|
||||
|
||||
@@ -11,7 +11,7 @@ public class BuilderWeather extends CommandBuilder
|
||||
{
|
||||
public BuilderWeather()
|
||||
{
|
||||
|
||||
super();
|
||||
}
|
||||
|
||||
public BuilderWeather(EnumWeather weather)
|
||||
|
||||
@@ -13,7 +13,7 @@ public class BuilderWhitelist extends CommandBuilder
|
||||
{
|
||||
public BuilderWhitelist()
|
||||
{
|
||||
|
||||
super();
|
||||
}
|
||||
|
||||
public BuilderWhitelist(EnumMode mode)
|
||||
@@ -37,6 +37,7 @@ public class BuilderWhitelist extends CommandBuilder
|
||||
this.setNode(1, player);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getPlayer()
|
||||
{
|
||||
return this.getNodeAsString(1);
|
||||
|
||||
@@ -48,7 +48,6 @@ public enum ArgumentType
|
||||
return (T) this.parser.apply(object);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public <T> T parseOfDefault(String object, T def)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -2,8 +2,6 @@ package exopandora.worldhandler.builder.types;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -50,7 +48,6 @@ public abstract class Coordinate<T extends Number> implements ICoordinate<T>
|
||||
return this.type.format(this.value, this.zero());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static <S extends Number, U extends Coordinate<S>> U parse(U coordiante, String input, Function<String, S> parser)
|
||||
{
|
||||
for(EnumType type : EnumType.values())
|
||||
|
||||
Reference in New Issue
Block a user