Преглед изворни кода

renamed /recipe to stop overwriting the vanilla command, renamed IllegalStringLocationException to IllegalLocationStringException

Kajetan Johannes Hammerle пре 6 година
родитељ
комит
6b6290020a

+ 4 - 5
src/main/java/me/km/api/Location.java

@@ -3,9 +3,8 @@ package me.km.api;
 import java.util.Objects;
 import java.util.regex.PatternSyntaxException;
 import me.hammerle.code.Script;
-import me.hammerle.exceptions.HoldCodeException;
 import me.km.dimensions.ModDimensions;
-import me.km.exception.IllegalStringLocationException;
+import me.km.exception.IllegalLocationStringException;
 import net.minecraft.block.state.IBlockState;
 import net.minecraft.entity.Entity;
 import net.minecraft.util.math.BlockPos;
@@ -57,7 +56,7 @@ public class Location
         this(ent.world, ent.posX, ent.posY, ent.posZ, ent.rotationYaw, ent.rotationPitch);
     }
     
-    public Location(Script sc, String location) throws IllegalStringLocationException
+    public Location(Script sc, String location) throws IllegalLocationStringException
     {
         try
         {
@@ -82,11 +81,11 @@ public class Location
                 this.pitch = 0;
                 return;
             }
-            throw new IllegalStringLocationException(location);
+            throw new IllegalLocationStringException(location);
         }
         catch(PatternSyntaxException | NumberFormatException ex)
         {
-            throw new IllegalStringLocationException(location);
+            throw new IllegalLocationStringException(location);
         }
     }
 

+ 2 - 2
src/main/java/me/km/exception/IllegalStringLocationException.java → src/main/java/me/km/exception/IllegalLocationStringException.java

@@ -2,9 +2,9 @@ package me.km.exception;
 
 import me.hammerle.exceptions.IllegalStringException;
 
-public class IllegalStringLocationException extends IllegalStringException
+public class IllegalLocationStringException extends IllegalStringException
 {
-    public IllegalStringLocationException(String s) 
+    public IllegalLocationStringException(String s) 
     {
         super(s);
     }

+ 2 - 3
src/main/java/me/km/jobsystem/CommandRecipe.java

@@ -15,11 +15,10 @@ public class CommandRecipe extends ModuleCommand
 {   
     public CommandRecipe(Module m) 
     {
-        super("recipe", m);
+        super("recipes", m);
         super.setDescription("Zeigt deine Rezepte");
-        super.setUsage("/recipe [player]");
+        super.setUsage("/recipes [player]");
         super.setPermission(Permissions.RECIPE);
-        super.addAlias("recipes");
     }
 
     @Override

+ 18 - 18
src/main/java/me/km/snuviscript/MinecraftFunctions.java

@@ -7,7 +7,7 @@ import me.km.api.Utils;
 import me.km.environment.EnvironmentAPI;
 import me.km.exception.EntityNotFoundException;
 import me.km.exception.IllegalItemStackStringException;
-import me.km.exception.IllegalStringLocationException;
+import me.km.exception.IllegalLocationStringException;
 import me.km.exception.PlayerNotFoundException;
 import me.km.utils.NBTUtils;
 import me.km.plots.ProtectionBank;
@@ -996,7 +996,7 @@ public class MinecraftFunctions implements ISnuviLogger
         }
     }
     
-    private static Fraction getItemAmountChest(Object[] args) throws IllegalStringLocationException, IllegalItemStackStringException
+    private static Fraction getItemAmountChest(Object[] args) throws IllegalLocationStringException, IllegalItemStackStringException
     {       
         Location l = (Location) args[0];
         TileEntity te = l.getWorld().getTileEntity(l.getBlockPos());
@@ -1007,7 +1007,7 @@ public class MinecraftFunctions implements ISnuviLogger
         return new Fraction(InventoryUtils.searchInventoryFor(((TileEntityChest) te), (ItemStack) args[2], (boolean) args[1]));
     }
     
-    private static ItemStack addItemAmountChest(Object[] args) throws IllegalStringLocationException, IllegalItemStackStringException
+    private static ItemStack addItemAmountChest(Object[] args) throws IllegalLocationStringException, IllegalItemStackStringException
     {       
         Location l = (Location) args[0];
         ItemStack stack = ((ItemStack) args[1]);
@@ -1020,7 +1020,7 @@ public class MinecraftFunctions implements ISnuviLogger
         return stack;
     }
     
-    private static ItemStack removeItemAmountChest(Object[] args) throws IllegalStringLocationException, IllegalItemStackStringException
+    private static ItemStack removeItemAmountChest(Object[] args) throws IllegalLocationStringException, IllegalItemStackStringException
     {       
         Location l = (Location) args[0];
         ItemStack stack = ((ItemStack) args[1]);
@@ -1033,7 +1033,7 @@ public class MinecraftFunctions implements ISnuviLogger
         return stack;
     }
     
-    private static Object getCoordOfLocation(Object[] args) throws IllegalStringLocationException
+    private static Object getCoordOfLocation(Object[] args) throws IllegalLocationStringException
     {
         Location l = (Location) args[0];
         switch(args[1].toString())
@@ -1057,7 +1057,7 @@ public class MinecraftFunctions implements ISnuviLogger
         }
     }
     
-    private static void cloneBlock(Object[] args) throws IllegalStringLocationException
+    private static void cloneBlock(Object[] args) throws IllegalLocationStringException
     {
         Location l = (Location) args[1];
         IBlockState state = getBlockState((Location) args[0]);
@@ -1071,7 +1071,7 @@ public class MinecraftFunctions implements ISnuviLogger
         return stack;
     }
     
-    private static void dropItem(Object[] args) throws IllegalStringLocationException, IllegalItemStackStringException
+    private static void dropItem(Object[] args) throws IllegalLocationStringException, IllegalItemStackStringException
     {
         Location l = (Location) args[0];
         World w = l.getWorld();
@@ -1112,7 +1112,7 @@ public class MinecraftFunctions implements ISnuviLogger
         throw new HoldCodeException();
     }
     
-    private static void setBlock(Object[] args, Script qd) throws IllegalStringLocationException, IllegalItemStackStringException
+    private static void setBlock(Object[] args, Script qd) throws IllegalLocationStringException, IllegalItemStackStringException
     {           
         Location l = (Location) args[0];
         ItemStack stack = (ItemStack) args[1];
@@ -1120,7 +1120,7 @@ public class MinecraftFunctions implements ISnuviLogger
         qd.incLoopCounter();
     }
     
-    private static void setBlockWithData(Object[] args, Script qd) throws IllegalStringLocationException
+    private static void setBlockWithData(Object[] args, Script qd) throws IllegalLocationStringException
     {           
         Location l = (Location) args[0];
         if(args.length >= 4)
@@ -1139,26 +1139,26 @@ public class MinecraftFunctions implements ISnuviLogger
         ((EntityPlayer) args[0]).inventory.dropAllItems();
     }
     
-    private static void playSound(Object[] args) throws IllegalStringLocationException
+    private static void playSound(Object[] args) throws IllegalLocationStringException
     {
         Location l = ((Location) args[0]);
         Vec3d v = l.getPos();
         EffectUtils.playSound((WorldServer) l.getWorld(), SoundEvent.REGISTRY.getObject(new ResourceLocation(args[1].toString())), SoundCategory.MASTER, v.x, v.y, v.z);
     }
     
-    private static void playSoundPlayer(Object[] args) throws IllegalStringLocationException
+    private static void playSoundPlayer(Object[] args) throws IllegalLocationStringException
     {
         EffectUtils.playSound((EntityPlayerMP) args[0], SoundEvent.REGISTRY.getObject(new ResourceLocation(args[1].toString())), SoundCategory.MASTER);
     }
     
-    private static void playParticle(Object[] args) throws IllegalStringLocationException
+    private static void playParticle(Object[] args) throws IllegalLocationStringException
     {
         Location l = ((Location) args[0]);
         EffectUtils.spawnParticle((WorldServer) l.getWorld(), EnumParticleTypes.getByName(args[1].toString()),
                 l.getX() + 0.5, l.getY() + 0.5, l.getZ() + 0.5, ScriptUtils.getInt(args[2]));
     }
     
-    private static void setEntityEquip(Object[] args) throws IllegalStringLocationException, EntityNotFoundException, IllegalItemStackStringException
+    private static void setEntityEquip(Object[] args) throws IllegalLocationStringException, EntityNotFoundException, IllegalItemStackStringException
     {
         EntityLivingBase liv = (EntityLivingBase) args[0];  
         ItemStack stack = ((ItemStack) args[2]).copy();
@@ -1184,7 +1184,7 @@ public class MinecraftFunctions implements ISnuviLogger
         }
     }  
 
-    private static ItemStack getEntityEquip(Object[] args) throws IllegalStringLocationException, EntityNotFoundException
+    private static ItemStack getEntityEquip(Object[] args) throws IllegalLocationStringException, EntityNotFoundException
     {
         EntityLivingBase liv = (EntityLivingBase) args[0];        
         switch(args[1].toString())
@@ -1219,7 +1219,7 @@ public class MinecraftFunctions implements ISnuviLogger
     }
     
     @SuppressWarnings("unchecked")
-    private static void removeEntities(Object[] args) throws IllegalStringLocationException
+    private static void removeEntities(Object[] args) throws IllegalLocationStringException
     {
         Class<? extends Entity> c = (Class<? extends Entity>) getClass(args[0].toString());
         if(c == Entity.class)
@@ -1233,7 +1233,7 @@ public class MinecraftFunctions implements ISnuviLogger
         });
     } 
     
-    private static void setSign(Object[] args) throws IllegalStringLocationException
+    private static void setSign(Object[] args) throws IllegalLocationStringException
     {
         Location l = (Location) args[0];
         TileEntitySign sign = (TileEntitySign) l.getWorld().getTileEntity(l.getBlockPos());
@@ -1241,7 +1241,7 @@ public class MinecraftFunctions implements ISnuviLogger
     }
     
     @SuppressWarnings("")
-    private static String getSign(Object[] args) throws IllegalStringLocationException
+    private static String getSign(Object[] args) throws IllegalLocationStringException
     {
         Location l = (Location) args[0];
         TileEntitySign sign = (TileEntitySign) l.getWorld().getTileEntity(l.getBlockPos());
@@ -1254,7 +1254,7 @@ public class MinecraftFunctions implements ISnuviLogger
         return state.isFullBlock() && state.isOpaqueCube();
     }
 
-    private static void spawnItemFrame(Object[] args) throws IllegalStringLocationException, IllegalItemStackStringException
+    private static void spawnItemFrame(Object[] args) throws IllegalLocationStringException, IllegalItemStackStringException
     {
         Location l = ((Location) args[0]);
         EntityItemFrame frame = new EntityItemFrame(l.getWorld(), l.getBlockPos(), EnumFacing.byName(args[1].toString()));