فهرست منبع

Grobe Fertigstellung von SnuviScript

Kajetan Johannes Hammerle 7 سال پیش
والد
کامیت
53f81ebde4
27فایلهای تغییر یافته به همراه586 افزوده شده و 664 حذف شده
  1. 1 1
      src/main/java/me/km/afk/CommandAFK.java
  2. 29 0
      src/main/java/me/km/api/Location.java
  3. 2 2
      src/main/java/me/km/api/ModuleCommand.java
  4. 56 4
      src/main/java/me/km/api/Utils.java
  5. 4 4
      src/main/java/me/km/blockprotections/BlockProtection.java
  6. 8 8
      src/main/java/me/km/blockprotections/CommandBlock.java
  7. 1 1
      src/main/java/me/km/blockprotections/SemiProtections.java
  8. 1 1
      src/main/java/me/km/chatmanager/ChatManager.java
  9. 1 1
      src/main/java/me/km/commands/CommandBed.java
  10. 1 1
      src/main/java/me/km/commands/CommandFly.java
  11. 1 1
      src/main/java/me/km/commands/CommandGameMode.java
  12. 1 1
      src/main/java/me/km/commands/CommandHome.java
  13. 1 1
      src/main/java/me/km/commands/CommandKill.java
  14. 1 1
      src/main/java/me/km/commands/CommandPvP.java
  15. 2 2
      src/main/java/me/km/effects/ActiveEffectBase.java
  16. 3 7
      src/main/java/me/km/effects/EffectUtils.java
  17. 2 2
      src/main/java/me/km/permissions/Permission.java
  18. 2 11
      src/main/java/me/km/playerbank/PlayerLogInOut.java
  19. 16 16
      src/main/java/me/km/plots/CommandPlot.java
  20. 3 3
      src/main/java/me/km/plots/ProtectionBlockAction.java
  21. 1 1
      src/main/java/me/km/plots/ProtectionBucketUse.java
  22. 5 6
      src/main/java/me/km/plots/ProtectionEntity.java
  23. 3 3
      src/main/java/me/km/plots/ProtectionInteract.java
  24. 2 2
      src/main/java/me/km/plots/ProtectionMarkPlot.java
  25. 16 2
      src/main/java/me/km/snuviscript/QuestInventoryHolder.java
  26. 76 55
      src/main/java/me/km/snuviscript/QuestParser.java
  27. 347 527
      src/main/java/me/km/snuviscript/QuestsEvents.java

+ 1 - 1
src/main/java/me/km/afk/CommandAFK.java

@@ -27,7 +27,7 @@ public class CommandAFK extends ModuleCommand
         EntityPlayer affectedPlayer;
         try
         {
-            if(!Permission.hasPermission(cs, Permissions.AFK))
+            if(!Permission.has(cs, Permissions.AFK))
             {
                 throw new IndexOutOfBoundsException();
             }   

+ 29 - 0
src/main/java/me/km/api/Location.java

@@ -1,5 +1,6 @@
 package me.km.api;
 
+import java.util.Objects;
 import net.minecraft.block.state.IBlockState;
 import net.minecraft.entity.Entity;
 import net.minecraft.util.math.BlockPos;
@@ -41,6 +42,34 @@ public class Location
         this(ent.world, ent.getPositionVector(), ent.rotationYaw, ent.rotationPitch);
     }
     
+    public static Location rounded(Entity ent)
+    {
+        return new Location(ent.world, ent.getPosition());
+    }
+
+    @Override
+    public int hashCode() 
+    {
+        int hash = 5;
+        hash = 73 * hash + Objects.hashCode(this.w);
+        hash = 73 * hash + Objects.hashCode(this.pos);
+        hash = 73 * hash + Float.floatToIntBits(this.yaw);
+        hash = 73 * hash + Float.floatToIntBits(this.pitch);
+        return hash;
+    }
+    
+    @Override
+    public boolean equals(Object obj) 
+    {
+        if(obj.getClass() == Location.class)
+        {
+            Location l = (Location) obj;
+            Vec3d v = l.getPos();
+            return l.getWorld().equals(w) && v.equals(pos) && yaw == l.yaw && pitch == l.pitch;
+        }
+        return false;
+    }
+    
     public Location add(double x, double y, double z)
     {
         pos = pos.addVector(x, y, z);

+ 2 - 2
src/main/java/me/km/api/ModuleCommand.java

@@ -70,7 +70,7 @@ public abstract class ModuleCommand extends CommandBase
     @Override
     public void execute(MinecraftServer server, ICommandSender cs, String[] args) throws CommandException
     {
-        if(!Permission.hasPermission(cs, this))
+        if(!Permission.has(cs, this))
         {
             m.sendWarning(cs, "Du hast keine Rechte für diesen Command.");
             return;
@@ -84,7 +84,7 @@ public abstract class ModuleCommand extends CommandBase
     @Override
     public boolean checkPermission(MinecraftServer server, ICommandSender cs) 
     {
-        if(Permission.hasPermission(cs, this))
+        if(Permission.has(cs, this))
         {
             return true;
         }  

+ 56 - 4
src/main/java/me/km/api/Utils.java

@@ -1,5 +1,6 @@
 package me.km.api;
 
+import java.io.File;
 import me.km.utils.ItemStackBuilder;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -20,7 +21,11 @@ import net.minecraft.block.BlockPistonMoving;
 import net.minecraft.block.BlockTrapDoor;
 import net.minecraft.block.properties.IProperty;
 import net.minecraft.block.state.IBlockState;
+import net.minecraft.entity.IProjectile;
 import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.entity.projectile.EntityArrow;
+import net.minecraft.entity.projectile.EntityFireball;
+import net.minecraft.entity.projectile.EntityThrowable;
 import net.minecraft.init.Blocks;
 import net.minecraft.init.Items;
 import net.minecraft.init.MobEffects;
@@ -36,11 +41,17 @@ import net.minecraft.world.World;
 import net.minecraft.item.ItemStack;
 import net.minecraft.item.ItemSword; 
 import net.minecraft.potion.Potion;
+import net.minecraft.util.DamageSource;
 import net.minecraft.util.math.RayTraceResult;
 import net.minecraft.world.WorldServer;
 
 public class Utils 
 {    
+    public static boolean hasPlayedBefore(EntityPlayer p)
+    {
+        return new File("./saves/world/playerdata/" + p.getUniqueID() + ".dat").exists();
+    }
+    
     public static <T extends Comparable<T>> T getStateValue(IBlockState state, IProperty<T> property)
     {
         try
@@ -295,10 +306,51 @@ public class Utils
     // Inventory-Tools
     // -------------------------------------------------------------------------
 
-    /*public static int getLowestStackAmount(CraftingInventory inv)
+    public static EntityPlayer getPlayerFromProjectile(Entity ent)
+    {
+        if(ent instanceof EntityArrow)
+        {
+            EntityArrow arrow = (EntityArrow) ent;
+            if(arrow.shootingEntity instanceof EntityPlayer)
+            {
+                return (EntityPlayer) arrow.shootingEntity;
+            }
+            return null;
+        }
+        else if(ent instanceof EntityThrowable)
+        {
+            EntityThrowable thrown = (EntityThrowable) ent;
+            if(thrown.getThrower() instanceof EntityPlayer)
+            {
+                return (EntityPlayer) thrown.getThrower();
+            }
+            return null;
+        }
+        else if(ent instanceof EntityFireball)
+        {
+            EntityFireball fire = (EntityFireball) ent;
+            if(fire.shootingEntity instanceof EntityPlayer)
+            {
+                return (EntityPlayer) fire.shootingEntity;
+            }
+            return null;
+        }
+        return null;
+    }
+    
+    public static EntityPlayer getDamager(DamageSource ds)
     {
-        return Arrays.stream(inv.getMatrix()).filter(s -> s != null && s.getType() != Material.AIR).mapToInt(s -> s.getAmount()).min().orElse(0);
-    }*/
+        Entity ent = ds.getSourceOfDamage();
+        if(ent == null)
+        {
+            return null;
+        }
+        if(ent instanceof EntityPlayer)
+        {
+            return (EntityPlayer) ent;
+        }
+        return getPlayerFromProjectile(ent);
+    }
 
     // -------------------------------------------------------------------------
     // Entities
@@ -396,7 +448,7 @@ public class Utils
                 .orElse(null);
     }
     
-    public static boolean doesIntersect(AxisAlignedBB bound, Vec3d start, Vec3d unit)
+    private static boolean doesIntersect(AxisAlignedBB bound, Vec3d start, Vec3d unit)
     {
         double lowerX = Double.NEGATIVE_INFINITY;
         double upperX = Double.POSITIVE_INFINITY;

+ 4 - 4
src/main/java/me/km/blockprotections/BlockProtection.java

@@ -49,7 +49,7 @@ public class BlockProtection extends ModuleListener
         if(b == Blocks.CHEST || b == Blocks.TRAPPED_CHEST)
         {
             BlockPos otherChest = Utils.getSameNearbyBlock(w, e.getPos(), b);
-            if(otherChest != null && !bank.hasAccess(otherChest, w, p.getGameProfile(), true) && !Permission.hasPermission(p, Permissions.BLOCK_BYPASS))
+            if(otherChest != null && !bank.hasAccess(otherChest, w, p.getGameProfile(), true) && !Permission.has(p, Permissions.BLOCK_BYPASS))
             {
                 this.getModule().send(p, "Du darfst diesen Block hier nicht setzen");
                 e.setCanceled(true);
@@ -63,7 +63,7 @@ public class BlockProtection extends ModuleListener
             BlockPos pos = e.getPos().add(0, 1, 0);
             if(w.getBlockState(pos).getBlock() instanceof BlockContainer)
             {
-                if(!bank.hasAccess(pos, w, p, true) && !Permission.hasPermission(p, Permissions.BLOCK_BYPASS))
+                if(!bank.hasAccess(pos, w, p, true) && !Permission.has(p, Permissions.BLOCK_BYPASS))
                 {
                     this.getModule().send(p, "Du darfst diesen Block hier nicht setzen");
                     e.setCanceled(true);
@@ -93,7 +93,7 @@ public class BlockProtection extends ModuleListener
             {
                 return;
             }       
-            if(bank.hasAccess(pos, w, p, false) || Permission.hasPermission(p, Permissions.BLOCK_BYPASS))
+            if(bank.hasAccess(pos, w, p, false) || Permission.has(p, Permissions.BLOCK_BYPASS))
             {
                 bank.removeBlock(pos, w, p);
                 return;
@@ -121,7 +121,7 @@ public class BlockProtection extends ModuleListener
         {
             pos = pos.add(0, -1, 0);
         }
-        if(bank.hasAccess(pos, e.getWorld(), p, true) || Permission.hasPermission(p, Permissions.BLOCK_BYPASS))
+        if(bank.hasAccess(pos, e.getWorld(), p, true) || Permission.has(p, Permissions.BLOCK_BYPASS))
         {
             return;
         }  

+ 8 - 8
src/main/java/me/km/blockprotections/CommandBlock.java

@@ -48,7 +48,7 @@ public class CommandBlock extends ModuleCommand
         Module m = this.getModule();
         EntityPlayerMP p = (EntityPlayerMP) cs;
         World w = p.getEntityWorld();
-        if(!KajetansMod.worldManager.getWorldPreferences(w).blockProtection && !Permission.hasPermission(cs, Permissions.BLOCK_BYPASS))
+        if(!KajetansMod.worldManager.getWorldPreferences(w).blockProtection && !Permission.has(cs, Permissions.BLOCK_BYPASS))
         {
             m.send(cs, "Du darfst hier keine Blöcke schützen.");
             return true;
@@ -58,7 +58,7 @@ public class CommandBlock extends ModuleCommand
             BlockPos pos = Utils.getPlayerTarget(p);  
             IBlockState state = w.getBlockState(pos);
             Block b = state.getBlock();
-            if(!Utils.shouldBeProtected(b) && !Permission.hasPermission(cs, Permissions.BLOCK_ALL))
+            if(!Utils.shouldBeProtected(b) && !Permission.has(cs, Permissions.BLOCK_ALL))
             {
                 m.send(cs, "Du kannst diesen Block nicht bearbeiten.");
                 m.send(cs, "Du bist auf folgenden Block gerichtet: " + b.toString());
@@ -73,7 +73,7 @@ public class CommandBlock extends ModuleCommand
                 case "protect":  
                 {
                     String name = null;
-                    if(arg.length >= 2 && Permission.hasPermission(cs, Permissions.BLOCK_OTHER))
+                    if(arg.length >= 2 && Permission.has(cs, Permissions.BLOCK_OTHER))
                     {
                         name = arg[1];
                     }
@@ -96,7 +96,7 @@ public class CommandBlock extends ModuleCommand
                         this.getModule().send(p, "Der Block ist nicht gesichert.");
                         return true;
                     }
-                    if(!bank.hasAccess(pos, w, p, false) && !Permission.hasPermission(cs, Permissions.BLOCK_BYPASS))
+                    if(!bank.hasAccess(pos, w, p, false) && !Permission.has(cs, Permissions.BLOCK_BYPASS))
                     {
                         m.send(cs, "Du hast keinen Zugriff auf diesen Block.");
                         return true;
@@ -127,7 +127,7 @@ public class CommandBlock extends ModuleCommand
                             this.getModule().send(p, "Der Block ist nicht gesichert.");
                             return true;
                         }
-                        if(!bank.hasAccess(pos, w, p, false) && !Permission.hasPermission(cs, Permissions.BLOCK_BYPASS))
+                        if(!bank.hasAccess(pos, w, p, false) && !Permission.has(cs, Permissions.BLOCK_BYPASS))
                         {
                             m.send(cs, "Du hast keinen Zugriff auf diesen Block.");
                             return true;
@@ -160,7 +160,7 @@ public class CommandBlock extends ModuleCommand
                             this.getModule().send(p, "Der Block ist nicht gesichert.");
                             return true;
                         }
-                        if(!bank.hasAccess(pos, w, p, true) && !Permission.hasPermission(cs, Permissions.BLOCK_BYPASS))
+                        if(!bank.hasAccess(pos, w, p, true) && !Permission.has(cs, Permissions.BLOCK_BYPASS))
                         {
                             m.send(cs, "Du hast keinen Zugriff auf diesen Block.");
                             return true;
@@ -186,7 +186,7 @@ public class CommandBlock extends ModuleCommand
                 }
                 case "clear":
                 {
-                    if(Permission.hasPermission(cs, Permissions.BLOCK_CLEAR))
+                    if(Permission.has(cs, Permissions.BLOCK_CLEAR))
                     {
                         //TODO
                         this.getModule().send(cs, GlobalText.notImplementedYet());
@@ -243,7 +243,7 @@ public class CommandBlock extends ModuleCommand
         m.sendHelpListElement(cs, "info", "Gibt Information über den Block");
         m.sendHelpListElement(cs, "share <player>", "Teilt eine Block-Protection mit einem Spieler");
         m.sendHelpListElement(cs, "kick <player>", "Kickt einen Spieler von einer Block-Protection");
-        if(Permission.hasPermission(cs, Permissions.BLOCK_CLEAR))
+        if(Permission.has(cs, Permissions.BLOCK_CLEAR))
         {
             m.sendHelpListElement(cs, "clear", "Entfernt ungültige Block-Protections auf jeden Block");
         }

+ 1 - 1
src/main/java/me/km/blockprotections/SemiProtections.java

@@ -26,7 +26,7 @@ public class SemiProtections extends ModuleListener
     public void onBlockBreak(BlockEvent.BreakEvent e)
     {
         EntityPlayer p = e.getPlayer();
-        if(Permission.hasPermission(p, Permissions.BLOCK_BYPASS) && p.isCreative())
+        if(Permission.has(p, Permissions.BLOCK_BYPASS) && p.isCreative())
         {
             return;
         }

+ 1 - 1
src/main/java/me/km/chatmanager/ChatManager.java

@@ -153,7 +153,7 @@ public class ChatManager extends Module
     public static String colorMessage(String text, ICommandSender cs) 
     {
         text = text.replace("&k", "");
-        if(Permission.hasPermission(cs, Permissions.USE_COLOR))
+        if(Permission.has(cs, Permissions.USE_COLOR))
         {
             text = text.replace("&", "§");
             return text;

+ 1 - 1
src/main/java/me/km/commands/CommandBed.java

@@ -32,7 +32,7 @@ public class CommandBed extends ModuleCommand
         }
         EntityPlayer p = (EntityPlayer) cs;
         
-        if(arg.length == 0 || !Permission.hasPermission(cs, Permissions.BED_OTHER))
+        if(arg.length == 0 || !Permission.has(cs, Permissions.BED_OTHER))
         {
             BlockPos pos = p.getBedLocation(p.dimension);
             if(pos == null)

+ 1 - 1
src/main/java/me/km/commands/CommandFly.java

@@ -26,7 +26,7 @@ public class CommandFly extends ModuleCommand
         EntityPlayer affectedPlayer;
         try
         {
-            if(arg.length >= 1 && !Permission.hasPermission(cs, Permissions.FLY_OTHER))
+            if(arg.length >= 1 && !Permission.has(cs, Permissions.FLY_OTHER))
             {
                 this.getModule().send(cs, "Du darfst nur deinen eigenen Fly setzen.");
                 return true;

+ 1 - 1
src/main/java/me/km/commands/CommandGameMode.java

@@ -32,7 +32,7 @@ public class CommandGameMode extends ModuleCommand
         EntityPlayer affectedPlayer;
         try
         {
-            if(arg.length >= 2 && !Permission.hasPermission(cs, Permissions.GAMEMODE_OTHER))
+            if(arg.length >= 2 && !Permission.has(cs, Permissions.GAMEMODE_OTHER))
             {
                 this.getModule().send(cs, "Du darfst nur deinen eigenen GameMode setzen.");
                 return true;

+ 1 - 1
src/main/java/me/km/commands/CommandHome.java

@@ -40,7 +40,7 @@ public class CommandHome extends ModuleCommand
         if(arg.length >= 1)
         {
             homename = arg[0];          
-            if(arg[0].contains(":") && Permission.hasPermission(cs, Permissions.HOME_OTHER))
+            if(arg[0].contains(":") && Permission.has(cs, Permissions.HOME_OTHER))
             {               
                 String[] split = homename.split(":");
                 String uuid = KajetansMod.playerbank.getDataBank().getUUID(split[0]);

+ 1 - 1
src/main/java/me/km/commands/CommandKill.java

@@ -23,7 +23,7 @@ public class CommandKill extends ModuleCommand
     @Override
     public boolean execute(ICommandSender cs, String[] arg) 
     {
-        if(arg.length == 0 || !Permission.hasPermission(cs, Permissions.KILL_OTHER))
+        if(arg.length == 0 || !Permission.has(cs, Permissions.KILL_OTHER))
         {
             if(!(cs instanceof EntityPlayer))
             {

+ 1 - 1
src/main/java/me/km/commands/CommandPvP.java

@@ -28,7 +28,7 @@ public class CommandPvP extends ModuleCommand
         EntityPlayer affectedPlayer;
         try
         {
-            if(!Permission.hasPermission(cs, Permissions.PVP_OTHER))
+            if(!Permission.has(cs, Permissions.PVP_OTHER))
             {
                 throw new IndexOutOfBoundsException();
             }

+ 2 - 2
src/main/java/me/km/effects/ActiveEffectBase.java

@@ -2,6 +2,7 @@ package me.km.effects;
 
 import me.km.KajetansMod;
 import me.km.environment.EnvironmentAPI;
+import me.km.snuviscript.QuestsEvents;
 import net.minecraft.entity.player.EntityPlayer;
 
 public abstract class ActiveEffectBase 
@@ -31,8 +32,7 @@ public abstract class ActiveEffectBase
         int manaCost = getManaCost(manaFactor);
         // Effect-Event-Start
         PlayerUsesEffectEvent e = new PlayerUsesEffectEvent(p, power, manaCost, cause, this.getClass());
-        // TODO send pseudo event to SnuviScript
-        //Bukkit.getPluginManager().callEvent(e); 
+        KajetansMod.quest.getEvent(QuestsEvents.class).useEffectEvent(e);
         if(e.isCanceled())
         {
             return false;

+ 3 - 7
src/main/java/me/km/effects/EffectUtils.java

@@ -5,13 +5,12 @@ import java.util.stream.Collectors;
 import me.km.KajetansMod;
 import me.km.api.Module;
 import me.km.api.Utils;
+import me.km.jobsystem.JobAPI;
 import net.minecraft.entity.EntityAreaEffectCloud;
-import net.minecraft.entity.EntityLiving;
 import net.minecraft.entity.EntityLivingBase;
 import net.minecraft.entity.passive.EntityAnimal;
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.init.MobEffects;
 import net.minecraft.init.SoundEvents;
 import net.minecraft.network.play.server.SPacketParticles;
 import net.minecraft.network.play.server.SPacketSoundEffect;
@@ -26,7 +25,6 @@ import net.minecraft.util.math.Vec3d;
 import net.minecraft.util.text.TextFormatting;
 import net.minecraft.world.World;
 import net.minecraft.world.WorldServer;
-import scala.remote;
 
 public class EffectUtils extends Module
 {
@@ -43,10 +41,8 @@ public class EffectUtils extends Module
      */
     public static int getEffectLevel(EntityPlayer p, Effect eff)
     {
-        // TODO
-        return 0;
-        /*JobAPI job = KajetansMod.jobs;
-        return eff.getSkills().stream().mapToInt(s -> job.getSkillLevel(p, s)).max().orElse(0);*/
+        JobAPI job = KajetansMod.jobs;
+        return eff.getSkills().stream().mapToInt(s -> job.getSkillLevel(p, s)).max().orElse(0);
     }
     
     @SuppressWarnings(value = "unchecked")

+ 2 - 2
src/main/java/me/km/permissions/Permission.java

@@ -5,12 +5,12 @@ import net.minecraft.command.ICommandSender;
 
 public class Permission 
 {
-    public static boolean hasPermission(ICommandSender cs, ICommand command)
+    public static boolean has(ICommandSender cs, ICommand command)
     {
         return true;
     }
     
-    public static boolean hasPermission(ICommandSender cs, Permissions perm)
+    public static boolean has(ICommandSender cs, Permissions perm)
     {
         return true;
     }

+ 2 - 11
src/main/java/me/km/playerbank/PlayerLogInOut.java

@@ -1,23 +1,14 @@
 package me.km.playerbank;
 
-import java.io.File;
 import me.km.KajetansMod;
 import me.km.api.Module;
 import me.km.api.ModuleListener;
 import me.km.api.Utils;
-import me.km.commands.CommandSilent;
 import me.km.commands.CommandTeleportAccept;
-import me.km.permissions.Permission;
-import me.km.permissions.Permissions;
-import net.minecraft.entity.Entity;
 import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.server.management.PlayerList;
-import net.minecraftforge.event.entity.EntityJoinWorldEvent;
 import net.minecraftforge.fml.common.eventhandler.EventPriority;
 import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
 import net.minecraftforge.fml.common.gameevent.PlayerEvent;
-import net.minecraftforge.fml.common.network.FMLNetworkEvent.ServerConnectionFromClientEvent;
 
 public class PlayerLogInOut extends ModuleListener
 {
@@ -31,8 +22,7 @@ public class PlayerLogInOut extends ModuleListener
     {
         EntityPlayer p = e.player;
         
-        File file = new File("./saves/world/playerdata/" + p.getUniqueID() + ".dat");
-        if(!file.exists()) // first join
+        if(Utils.hasPlayedBefore(p)) // first join
         {
             Utils.teleportEntity(p, Utils.getSpawn());
         }
@@ -58,6 +48,7 @@ public class PlayerLogInOut extends ModuleListener
         }      
     }
     
+    // TODO
     /*@SubscribeEvent(priority = EventPriority.LOW)
     public void silentJoin(PlayerLoginEvent e)
     {

+ 16 - 16
src/main/java/me/km/plots/CommandPlot.java

@@ -51,7 +51,7 @@ public class CommandPlot extends ModuleCommand
                 case "create":
                 case "add":
                 {
-                    if(!Permission.hasPermission(cs, Permissions.PLOT_CREATE))
+                    if(!Permission.has(cs, Permissions.PLOT_CREATE))
                     {
                         break;
                     }
@@ -80,7 +80,7 @@ public class CommandPlot extends ModuleCommand
                 case "create3d":
                 case "add3d":
                 {
-                    if(!Permission.hasPermission(cs, Permissions.PLOT_CREATE))
+                    if(!Permission.has(cs, Permissions.PLOT_CREATE))
                     {
                         break;
                     }
@@ -109,7 +109,7 @@ public class CommandPlot extends ModuleCommand
                 case "e":
                 case "expand":
                 {
-                    if(!Permission.hasPermission(cs, Permissions.PLOT_CREATE) || arg.length < 2)
+                    if(!Permission.has(cs, Permissions.PLOT_CREATE) || arg.length < 2)
                     {
                         break;
                     }
@@ -218,7 +218,7 @@ public class CommandPlot extends ModuleCommand
                 }
                 case "name":
                 {
-                    if(!Permission.hasPermission(cs, Permissions.PLOT_CREATE) || arg.length < 2)
+                    if(!Permission.has(cs, Permissions.PLOT_CREATE) || arg.length < 2)
                     {
                         break;
                     }
@@ -248,7 +248,7 @@ public class CommandPlot extends ModuleCommand
                 case "i":
                 case "info":
                 {
-                    if(Permission.hasPermission(cs, Permissions.PLOT_INFO))
+                    if(Permission.has(cs, Permissions.PLOT_INFO))
                     {
                         if(!(cs instanceof EntityPlayer))
                         {
@@ -265,7 +265,7 @@ public class CommandPlot extends ModuleCommand
                 case "remove":
                 case "delete":
                 {
-                    if(Permission.hasPermission(cs, Permissions.PLOT_CREATE))
+                    if(Permission.has(cs, Permissions.PLOT_CREATE))
                     {
                         Integer id;
                         if(arg.length >= 2)
@@ -302,7 +302,7 @@ public class CommandPlot extends ModuleCommand
                 case "at":
                 case "addtag":
                 {
-                    if(Permission.hasPermission(cs, Permissions.PLOT_TAG) && arg.length >= 2)
+                    if(Permission.has(cs, Permissions.PLOT_TAG) && arg.length >= 2)
                     {
                         Integer id;
                         if(arg.length >= 3)
@@ -339,7 +339,7 @@ public class CommandPlot extends ModuleCommand
                 case "rt":
                 case "removetag":
                 {
-                    if(Permission.hasPermission(cs, Permissions.PLOT_TAG) && arg.length >= 2)
+                    if(Permission.has(cs, Permissions.PLOT_TAG) && arg.length >= 2)
                     {
                         Integer id;
                         if(arg.length >= 3)
@@ -375,7 +375,7 @@ public class CommandPlot extends ModuleCommand
                 }
                 case "share":
                 {
-                    if(Permission.hasPermission(cs, Permissions.PLOT_SHARE) && arg.length >= 2)
+                    if(Permission.has(cs, Permissions.PLOT_SHARE) && arg.length >= 2)
                     {
                         Integer id;
                         if(arg.length >= 3)
@@ -417,7 +417,7 @@ public class CommandPlot extends ModuleCommand
                 }
                 case "kick":
                 {
-                    if(Permission.hasPermission(cs, Permissions.PLOT_SHARE) && arg.length >= 2)
+                    if(Permission.has(cs, Permissions.PLOT_SHARE) && arg.length >= 2)
                     {
                         Integer id;
                         if(arg.length >= 3)
@@ -459,7 +459,7 @@ public class CommandPlot extends ModuleCommand
                 }
                 case "sign":
                 {
-                    if(Permission.hasPermission(cs, Permissions.PLOT_SIGN) && arg.length >= 3)
+                    if(Permission.has(cs, Permissions.PLOT_SIGN) && arg.length >= 3)
                     {
                         // TODO
                         this.getModule().send(cs, GlobalText.notImplementedYet());
@@ -519,11 +519,11 @@ public class CommandPlot extends ModuleCommand
         }
         // Help Menu
         m.send(cs, "/plot ...");
-        if(Permission.hasPermission(cs, Permissions.PLOT_INFO))
+        if(Permission.has(cs, Permissions.PLOT_INFO))
         {
             m.sendHelpListElement(cs, "info", "Gibt Infos über die aktuelle Position");
         }
-        if(Permission.hasPermission(cs, Permissions.PLOT_CREATE))
+        if(Permission.has(cs, Permissions.PLOT_CREATE))
         {
             m.sendHelpListElement(cs, "create [player]", "Erstellt ein Plot (30 - 255)");
             m.sendHelpListElement(cs, "create3D [player]", "Erstellt ein Plot");
@@ -531,17 +531,17 @@ public class CommandPlot extends ModuleCommand
             m.sendHelpListElement(cs, "expand <blocks>", "Erweitert die aktuelle Auswahl");
             m.sendHelpListElement(cs, "name [id] <name>", "Gibt einem Plot einen Namen");
         }
-        if(Permission.hasPermission(cs, Permissions.PLOT_TAG))
+        if(Permission.has(cs, Permissions.PLOT_TAG))
         {
             m.sendHelpListElement(cs, "addtag <tag> [id]", "Fügt einen Tag hinzu");
             m.sendHelpListElement(cs, "removetag <tag> [id]", "Entfernt einen Tag");
         }
-        if(Permission.hasPermission(cs, Permissions.PLOT_SHARE))
+        if(Permission.has(cs, Permissions.PLOT_SHARE))
         {
             m.sendHelpListElement(cs, "share <player> [id]", "Fügt einen Spieler hinzu");
             m.sendHelpListElement(cs, "kick <player> [id]", "Entfernt einen Spieler");
         }
-        if(Permission.hasPermission(cs, Permissions.PLOT_SIGN))
+        if(Permission.has(cs, Permissions.PLOT_SIGN))
         {
             m.sendHelpListElement(cs, "sign <price> <id>", "Ändert ein Schild zum Verkaufsschild");
         }

+ 3 - 3
src/main/java/me/km/plots/ProtectionBlockAction.java

@@ -25,7 +25,7 @@ public class ProtectionBlockAction extends Protection
     public void onBlockPlace(BlockEvent.PlaceEvent e)
     {
         EntityPlayer p = e.getPlayer();
-        if(Permission.hasPermission(p, Permissions.PLOT_BYPASS))
+        if(Permission.has(p, Permissions.PLOT_BYPASS))
         {
             return;
         }     
@@ -43,12 +43,12 @@ public class ProtectionBlockAction extends Protection
     public void onBlockBreak(BlockEvent.BreakEvent e)
     {
         EntityPlayer p = e.getPlayer();
-        if(Permission.hasPermission(p, Permissions.PLOT_MARK) && p.getHeldItemMainhand().getItem() == Items.WOODEN_SWORD && p.isCreative())
+        if(Permission.has(p, Permissions.PLOT_MARK) && p.getHeldItemMainhand().getItem() == Items.WOODEN_SWORD && p.isCreative())
         {
             e.setCanceled(true);
             return;
         }
-        if(Permission.hasPermission(p, Permissions.PLOT_BYPASS))
+        if(Permission.has(p, Permissions.PLOT_BYPASS))
         {
             return;
         }

+ 1 - 1
src/main/java/me/km/plots/ProtectionBucketUse.java

@@ -22,7 +22,7 @@ public class ProtectionBucketUse extends Protection
     {
         EntityPlayer p = e.getEntityPlayer(); 
         RayTraceResult ray = e.getTarget();
-        if(ray == null || Permission.hasPermission(p, Permissions.PLOT_BYPASS))
+        if(ray == null || Permission.has(p, Permissions.PLOT_BYPASS))
         {
             return;
         }

+ 5 - 6
src/main/java/me/km/plots/ProtectionEntity.java

@@ -1,9 +1,9 @@
 package me.km.plots;
 
 import me.km.api.Module;
+import me.km.api.Utils;
 import me.km.permissions.Permission;
 import me.km.permissions.Permissions;
-import net.minecraft.entity.Entity;
 import net.minecraft.entity.EntityLivingBase;
 import net.minecraft.entity.passive.EntityAnimal;
 import net.minecraft.entity.player.EntityPlayer;
@@ -40,11 +40,10 @@ public class ProtectionEntity extends Protection
         
         if(e.getSource().getSourceOfDamage() != null)
         {
-            Entity source = e.getSource().getSourceOfDamage();
-            if(source instanceof EntityPlayer)
+            EntityPlayer p = Utils.getDamager(e.getSource());
+            if(p != null)
             {
-                EntityPlayer p = (EntityPlayer) source;
-                if(Permission.hasPermission(p, Permissions.PLOT_BYPASS) || this.getProtectionBank().canBuild(w, pos, p))
+                if(Permission.has(p, Permissions.PLOT_BYPASS) || this.getProtectionBank().canBuild(w, pos, p))
                 {
                     return;
                 }
@@ -61,7 +60,7 @@ public class ProtectionEntity extends Protection
         {
             EntityPotion potion = (EntityPotion) e.getEntityThrowable();
             EntityLivingBase ent = potion.getThrower();
-            if(ent instanceof EntityPlayer && !Permission.hasPermission(ent, Permissions.PLOT_BYPASS) &&
+            if(ent instanceof EntityPlayer && !Permission.has(ent, Permissions.PLOT_BYPASS) &&
                 !this.getProtectionBank().canBuild(potion.world, potion.getPosition(), (EntityPlayer) ent))
             {
                 e.setCanceled(true);

+ 3 - 3
src/main/java/me/km/plots/ProtectionInteract.java

@@ -21,7 +21,7 @@ public class ProtectionInteract extends Protection
     public void onPlayerInteract(PlayerInteractEvent.LeftClickBlock e) 
     {
         EntityPlayer p = e.getEntityPlayer();
-        if(Permission.hasPermission(p, Permissions.PLOT_BYPASS))
+        if(Permission.has(p, Permissions.PLOT_BYPASS))
         {
             return;
         }  
@@ -36,7 +36,7 @@ public class ProtectionInteract extends Protection
     public void onPlayerInteract(PlayerInteractEvent.RightClickBlock e) 
     {
         EntityPlayer p = e.getEntityPlayer();
-        if(Permission.hasPermission(p, Permissions.PLOT_BYPASS))
+        if(Permission.has(p, Permissions.PLOT_BYPASS))
         {
             return;
         }    
@@ -57,7 +57,7 @@ public class ProtectionInteract extends Protection
     public void protectFromInteract(PlayerInteractEvent.EntityInteract e)
     {      
         EntityPlayer p = e.getEntityPlayer();
-        if(Permission.hasPermission(p, Permissions.PLOT_BYPASS) || 
+        if(Permission.has(p, Permissions.PLOT_BYPASS) || 
             this.getProtectionBank().canBuild(e.getWorld(), e.getTarget().getPosition(), p))
         {
             return;

+ 2 - 2
src/main/java/me/km/plots/ProtectionMarkPlot.java

@@ -33,7 +33,7 @@ public class ProtectionMarkPlot extends Protection
             return;
         }
         EntityPlayer p = e.getEntityPlayer();
-        if(Permission.hasPermission(p, Permissions.PLOT_MARK) && p.getHeldItemMainhand().getItem() == Items.WOODEN_SWORD && p.isCreative())
+        if(Permission.has(p, Permissions.PLOT_MARK) && p.getHeldItemMainhand().getItem() == Items.WOODEN_SWORD && p.isCreative())
         {
             BlockPos pos = e.getPos();
             coord2.put(p.getUniqueID(), pos);
@@ -50,7 +50,7 @@ public class ProtectionMarkPlot extends Protection
             return;
         }
         EntityPlayer p = e.getEntityPlayer();
-        if(Permission.hasPermission(p, Permissions.PLOT_MARK) && p.getHeldItemMainhand().getItem() == Items.WOODEN_SWORD && p.isCreative())
+        if(Permission.has(p, Permissions.PLOT_MARK) && p.getHeldItemMainhand().getItem() == Items.WOODEN_SWORD && p.isCreative())
         {
             BlockPos pos = e.getPos();
             coord1.put(p.getUniqueID(), pos);

+ 16 - 2
src/main/java/me/km/snuviscript/QuestInventoryHolder.java

@@ -1,5 +1,6 @@
 package me.km.snuviscript;
 
+import me.km.KajetansMod;
 import me.km.inventory.CustomContainer;
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.inventory.ClickType;
@@ -7,16 +8,29 @@ import net.minecraft.inventory.ClickType;
 public class QuestInventoryHolder extends CustomContainer
 {
     private final QuestData qd;
+    private final QuestsEvents e;
+    private final SnuviInventory inv;
 
     public QuestInventoryHolder(SnuviInventory inv, EntityPlayer p, QuestData qd) 
     {
         super(inv, p);
         this.qd = qd;
+        this.inv = inv;
+        this.e = KajetansMod.quest.getEvent(QuestsEvents.class);
     }
 
     @Override
-    public boolean noClicking(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) 
+    public boolean noClicking(int slot, int dragType, ClickType click, EntityPlayer p) 
     {
-        return false;
+        return e.QuestClickInventory(qd, inv, slot, click, p);
+    }
+
+    @Override
+    public void onContainerClosed(EntityPlayer p) 
+    {
+        if(!e.QuestCloseInventory(qd, inv, p))
+        {
+            super.onContainerClosed(p);
+        }
     }
 }

+ 76 - 55
src/main/java/me/km/snuviscript/QuestParser.java

@@ -60,14 +60,17 @@ import net.minecraft.entity.passive.EntityVillager;
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.entity.player.EntityPlayerMP;
 import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.entity.projectile.EntityPotion;
 import net.minecraft.inventory.EntityEquipmentSlot;
 import net.minecraft.inventory.IInventory;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.play.server.SPacketSpawnPosition;
+import net.minecraft.potion.PotionUtils;
 import net.minecraft.tileentity.TileEntity;
 import net.minecraft.tileentity.TileEntityChest;
 import net.minecraft.tileentity.TileEntitySign;
+import net.minecraft.util.DamageSource;
 import net.minecraft.util.EnumFacing;
 import net.minecraft.util.EnumParticleTypes;
 import net.minecraft.util.SoundCategory;
@@ -162,8 +165,8 @@ public class QuestParser
                 // TODO Utils.shootItemWithEvent((EntityPlayer) args[0], ((ItemStack) args[5]).clone(), QuestUtils.getDouble(args[1]), QuestUtils.getDouble(args[2]), QuestUtils.getDouble(args[3]), QuestUtils.getDouble(args[4])));
         registerConsumer(list, "player.shootprojectile", (args, qd) -> nothing());
                 // TODO Utils.shootProjectile(((EntityPlayer) args[0]), (Class<? extends Projectile>) getClass("org.bukkit.entity." + args[1]), QuestUtils.getDouble(args[2])));
-        registerConsumer(list, "player.respawn", (args, qd) ->     
-                ((EntityPlayer) args[0]).respawnPlayer());
+        registerConsumer(list, "player.respawn", (args, qd) -> nothing()
+                /* TODO ((EntityPlayerMP) args[0]).respawnPlayer()*/);
         registerConsumer(list, "player.inventorytolist", (args, qd) -> 
                 qd.setVar(args[0], ((EntityPlayer) args[1]).inventory.mainInventory));    
         registerFunction(list, "player.getamount", (args, qd) ->                            
@@ -492,7 +495,7 @@ public class QuestParser
         registerConsumer(list, "entity.setname", (args, qd) -> 
                 nameEntity(args)); 
         registerConsumer(list, "entity.throw", (args, qd) -> 
-                ((Entity) args[0]).setVelocity(QuestUtils.getDouble(args[1]), QuestUtils.getDouble(args[2]), QuestUtils.getDouble(args[3])));
+                throwEntity(args));
         registerConsumer(list, "entity.teleport", (args, qd) -> 
                 Utils.teleportEntity((Entity) args[0], (Location) args[1]));  
         registerConsumer(list, "entity.setequip", (args, qd) -> 
@@ -1320,7 +1323,7 @@ public class QuestParser
             return;
         }
         EntityPlayer p = qd.getPlayers().get(0);
-        if(Permission.hasPermission(p, Permissions.SCRIPT_ERROR))
+        if(Permission.has(p, Permissions.SCRIPT_ERROR))
         {
             qd.loadNewCode(args[0].toString(), p);
             return;
@@ -1411,27 +1414,35 @@ public class QuestParser
         throw new HoldCodeException();
     }   
     
+    private void throwEntity(Object[] args)
+    {
+        Entity ent = (Entity) args[0];
+        ent.motionX = QuestUtils.getDouble(args[1]);
+        ent.motionY = QuestUtils.getDouble(args[2]);
+        ent.motionZ = QuestUtils.getDouble(args[3]);
+    }
+    
     private void damageEntity(Object[] args)
     {
         if(args.length >= 4)
         {
-            ((EntityLivingBase) args[0]).damage(QuestUtils.getDouble(args[1]), (Entity) args[2]);
+            ((EntityLivingBase) args[0]).attackEntityFrom(DamageSource.causeMobDamage((EntityLivingBase) args[2]), QuestUtils.getFloat(args[1]));
             return;
         }
-        ((EntityLivingBase) args[0]).damage(QuestUtils.getDouble(args[1]));
+        ((EntityLivingBase) args[0]).attackEntityFrom(DamageSource.GENERIC, QuestUtils.getFloat(args[1]));
     }
     
     private boolean isBetween(Object[] args)
     {
-        Location l1 = (Location) args[0];
-        Location l2 = (Location) args[1];
-        Location l3 = (Location) args[2];
-        return l1.getX() >= Math.min(l2.getX(), l3.getX()) &&
-                l1.getX() <= Math.max(l2.getX(), l3.getX()) &&
-                l1.getY() >= Math.min(l2.getY(), l3.getY()) &&
-                l1.getY() <= Math.max(l2.getY(), l3.getY()) &&
-                l1.getZ() >= Math.min(l2.getZ(), l3.getZ()) &&
-                l1.getZ() <= Math.max(l2.getZ(), l3.getZ());
+        Vec3d l1 = ((Location) args[0]).getPos();
+        Vec3d l2 = ((Location) args[1]).getPos();
+        Vec3d l3 = ((Location) args[2]).getPos();
+        return l1.xCoord >= Math.min(l2.xCoord, l3.xCoord) &&
+                l1.xCoord <= Math.max(l2.xCoord, l3.xCoord) &&
+                l1.yCoord >= Math.min(l2.yCoord, l3.yCoord) &&
+                l1.yCoord <= Math.max(l2.yCoord, l3.yCoord) &&
+                l1.zCoord >= Math.min(l2.zCoord, l3.zCoord) &&
+                l1.zCoord <= Math.max(l2.zCoord, l3.zCoord);
     }
     
     private Number increaseVar(Object var, QuestData qd, int value)
@@ -1445,13 +1456,15 @@ public class QuestParser
     {
         Location l1 = (Location) args[0];
         Location l2 = (Location) args[1];
-        KajetansMod.plots.getDataBank(ProtectionBank.class).addPlot(Math.min(l1.getBlockX(), l2.getBlockX()),
-                    Math.min(l1.getBlockY(), l2.getBlockY()),
-                    Math.min(l1.getBlockZ(), l2.getBlockZ()),
-                    Math.max(l1.getBlockX(), l2.getBlockX()),
-                    Math.max(l1.getBlockY(), l2.getBlockY()),
-                    Math.max(l1.getBlockZ(), l2.getBlockZ()),
-                    l1.getWorld().getName(), null, args[2].toString()); 
+        BlockPos pos1 = l1.getBlockPos();
+        BlockPos pos2 = l2.getBlockPos();
+        KajetansMod.plots.getDataBank(ProtectionBank.class).addPlot(Math.min(pos1.getX(), pos2.getX()),
+                    Math.min(pos1.getY(), pos2.getY()),
+                    Math.min(pos1.getZ(), pos2.getZ()),
+                    Math.max(pos1.getX(), pos2.getX()),
+                    Math.max(pos1.getY(), pos2.getY()),
+                    Math.max(pos1.getZ(), pos2.getZ()),
+                    ModDimensions.getWorldName(l1.getWorld()), null, args[2].toString()); 
     }
     
     private boolean isEqual(Object[] args)
@@ -1466,7 +1479,7 @@ public class QuestParser
         }
         else if(args[1] instanceof ItemStack && args[0] instanceof ItemStack)
         {
-            return ((ItemStack) args[0]).isSimilar((ItemStack) args[0]);
+            return InventoryUtils.doItemStacksMatch((ItemStack) args[0], (ItemStack) args[1]);
         }
         else if(args[1] instanceof Number && args[0] instanceof Number)
         {
@@ -1476,9 +1489,11 @@ public class QuestParser
         {
             Location l = (Location) args[0];
             Location l2 = (Location) args[1];
-            return l.getBlockX() == l2.getBlockX() &&
-                    l.getBlockY() == l2.getBlockY() &&
-                    l.getBlockZ() == l2.getBlockZ();
+            BlockPos pos1 = l.getBlockPos();
+            BlockPos pos2 = l2.getBlockPos();
+            return pos1.getX() == pos2.getX() &&
+                    pos1.getY() == pos2.getY() &&
+                    pos1.getZ() == pos2.getZ() && l.getWorld().equals(l2.getWorld());
         }
         return args[0].equals(args[1]);
     }
@@ -1498,19 +1513,22 @@ public class QuestParser
         }
     }
     
-    private Inventory newInventory(Location l, QuestData qd, String s)
+    private SnuviInventory newInventory(Location l, QuestData qd, String s)
     {
-        Inventory inv = ((InventoryHolder) l.getBlock().getState()).getInventory();
-        int size = inv.getSize();
+        TileEntityChest chest = (TileEntityChest) l.getWorld().getTileEntity(l.getBlockPos());
+        int size = chest.getSizeInventory();
         if(size % 9 != 0)
         {
             size /= 9;
             size++;
             size *= 9;
         }
-        Inventory inv2 = Bukkit.createInventory(new QuestInventoryHolder(qd.getId(), qd.getNewId()), size, s); 
-        inv2.setContents(inv.getContents());
-        return inv2;
+        SnuviInventory inv = new SnuviInventory(s, size, qd.getNewId()); 
+        for(int i = 0; i < chest.getSizeInventory(); i++)
+        {
+            inv.setInventorySlotContents(i, chest.getStackInSlot(i).copy());
+        }
+        return inv;
     }
     
     private void split(Object[] args, QuestData qd)
@@ -1539,7 +1557,7 @@ public class QuestParser
     private String getName(Object[] args)
     {
         Object o = args[0];
-        if(o instanceof Player)
+        if(o instanceof EntityPlayer)
         {
             return ((EntityPlayer) o).getName();
         }
@@ -1549,22 +1567,21 @@ public class QuestParser
     private String getUuid(Object[] args)
     {
         Object o = args[0];
-        if(o instanceof Player)
+        if(o instanceof EntityPlayer)
         {
-            return ((EntityPlayer) o).getUniqueId().toString();
+            return ((EntityPlayer) o).getUniqueID().toString();
         }
         return KajetansMod.playerbank.getDataBank().getUUID(o.toString());
     }
     
     private String getPotionType(Object[] args)
     {
-        PotionMeta meta = (PotionMeta) ((SplashPotion) args[0]).getItem().getItemMeta();
-        return meta.getBasePotionData().getType().toString();
+        return PotionUtils.getPotionFromItem(((EntityPotion) args[0]).getPotion()).toString();
     }
     
     private void setTag(Object[] args)
     {
-        if(args[0] instanceof Player)
+        if(args[0] instanceof EntityPlayer)
         {
             KajetansMod.playerbank.getDataBank().setTag((EntityPlayer) args[0], args[1].toString(), QuestUtils.getInt(args[2]));
             return;
@@ -1574,7 +1591,7 @@ public class QuestParser
     
     private int getTag(Object[] args)
     {
-        if(args[0] instanceof Player)
+        if(args[0] instanceof EntityPlayer)
         {
             return KajetansMod.playerbank.getDataBank().getTag((EntityPlayer) args[0], args[1].toString());
         }
@@ -1583,9 +1600,9 @@ public class QuestParser
     
     private void setGlobalVar(Object[] args)
     {
-        if(args[0] instanceof Player)
+        if(args[0] instanceof EntityPlayer)
         {
-            KajetansMod.quest.getDataBank(QuestBank.class).setVar(args[2].toString(), args[1].toString(), ((EntityPlayer) args[0]).getUniqueId().toString());
+            KajetansMod.quest.getDataBank(QuestBank.class).setVar(args[2].toString(), args[1].toString(), ((EntityPlayer) args[0]).getUniqueID().toString());
             return;
         }
         KajetansMod.quest.getDataBank(QuestBank.class).setVar(args[2].toString(), args[1].toString(), KajetansMod.playerbank.getDataBank().getUUID(args[0].toString()));
@@ -1593,9 +1610,9 @@ public class QuestParser
     
     private Object getGlobalVar(Object[] args)
     {
-        if(args[0] instanceof Player)
+        if(args[0] instanceof EntityPlayer)
         {
-            return KajetansMod.quest.getDataBank(QuestBank.class).getVar(args[1].toString(), ((EntityPlayer) args[0]).getUniqueId().toString());
+            return KajetansMod.quest.getDataBank(QuestBank.class).getVar(args[1].toString(), ((EntityPlayer) args[0]).getUniqueID().toString());
         }
         return KajetansMod.quest.getDataBank(QuestBank.class).getVar(args[1].toString(), KajetansMod.playerbank.getDataBank().getUUID(args[0].toString()));
     }
@@ -1629,7 +1646,8 @@ public class QuestParser
     
     private void registerEnchantmentRecipe(Object[] args)
     {
-        Enchantment e = Enchantment.getByName(args[0].toString());
+        // TODO
+        /*Enchantment e = Enchantment.getByName(args[0].toString());
         if(e == null)
         {
             throw new IllegalStringException(args[0].toString());
@@ -1639,22 +1657,24 @@ public class QuestParser
         {
             stacks[i] = (ItemStack) args[i + 3];
         }
-        KajetansMod.customs.registerEnchantmentRecipe(e, QuestUtils.getInt(args[1]), QuestUtils.getInt(args[2]), stacks);
+        KajetansMod.customs.registerEnchantmentRecipe(e, QuestUtils.getInt(args[1]), QuestUtils.getInt(args[2]), stacks);*/
     }
     
     private void registerShapelessRecipe(Object[] args)
     {
-        ItemStack[] stacks = new ItemStack[args.length - 1];
+        // TODO
+        /*ItemStack[] stacks = new ItemStack[args.length - 1];
         for(int i = 0; i < stacks.length; i++)
         {
             stacks[i] = (ItemStack) args[i + 1];
         }
-        KajetansMod.customs.registerShapelessRecipe((ItemStack) args[0], stacks);
+        KajetansMod.customs.registerShapelessRecipe((ItemStack) args[0], stacks);*/
     }
     
     private void registerShapedRecipe(Object[] args)
     {
-        int counter = 0;
+        // TODO
+        /*int counter = 0;
         while(args[counter + 1].getClass() == String.class)
         {
             counter++;
@@ -1670,7 +1690,7 @@ public class QuestParser
         {
             stacks[i] = (ItemStack) args[i + 1 + counter];
         }
-        KajetansMod.customs.registerShapedRecipe((ItemStack) args[0], s, stacks);
+        KajetansMod.customs.registerShapedRecipe((ItemStack) args[0], s, stacks);*/
     }
     
     // -------------------------------------------------------------------------    
@@ -1749,18 +1769,18 @@ public class QuestParser
                     qd.getPlayers().forEach(p -> c.accept(p));
                     break;
                 case "online":
-                    Bukkit.getOnlinePlayers().forEach(p -> c.accept(p));
+                    KajetansMod.server.getPlayerList().getPlayers().forEach(p -> c.accept(p));
                     break;
                 case "dev":
                     if(qd.isScript())
                     {
-                        Bukkit.getOnlinePlayers().stream().filter(p -> p.hasPermission("kt.quest.error")).forEach(p -> c.accept(p));
+                        KajetansMod.server.getPlayerList().getPlayers().stream().filter(p -> Permission.has(p, Permissions.SCRIPT_ERROR)).forEach(p -> c.accept(p));
                         return;
                     }
-                    qd.getPlayers().stream().filter(p -> p.hasPermission("kt.quest.error")).forEach(p -> c.accept(p));
+                    qd.getPlayers().stream().filter(p ->  Permission.has(p, Permissions.SCRIPT_ERROR)).forEach(p -> c.accept(p));
                     break;
                 case "server":
-                    c.accept(Bukkit.getConsoleSender());
+                    c.accept(KajetansMod.server);
                     break;
                 default:
                     c.accept(Utils.getPlayerByName(group.toString()));
@@ -1773,7 +1793,8 @@ public class QuestParser
     
     private void sendMessageToGroup(Object group, QuestData qd, String message)
     {
-        doForGroup(group, qd, p -> p.sendMessage(message));
+        TextComponentString comp = new TextComponentString(message);
+        doForGroup(group, qd, p -> p.sendMessage(comp));
     }
     
     public void sendMessageWithSuffix(QuestData qd, String message)
@@ -1794,7 +1815,7 @@ public class QuestParser
     {
         Module m = KajetansMod.quest;
         String warnMessage = "§4" + message;
-        Bukkit.getOnlinePlayers().stream().filter(p -> p.hasPermission("kt.quest.error")).forEach(p -> m.send(p, warnMessage));
+        KajetansMod.server.getPlayerList().getPlayers().stream().filter(p -> Permission.has(p, Permissions.SCRIPT_ERROR)).forEach(p -> m.send(p, warnMessage));
     }
     
     private void sendToDevsWithList(QuestData qd, String message)

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 347 - 527
src/main/java/me/km/snuviscript/QuestsEvents.java


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است