Răsfoiți Sursa

merged entity and playerdata for effects to complete new data system, changes for herbs

Kajetan Johannes Hammerle 7 ani în urmă
părinte
comite
009fe2ce1d
65 a modificat fișierele cu 1466 adăugiri și 595 ștergeri
  1. 10 0
      src/main/java/me/km/ClientEvents.java
  2. 28 0
      src/main/java/me/km/ClientProxy.java
  3. 13 0
      src/main/java/me/km/CommonProxy.java
  4. 9 10
      src/main/java/me/km/KajetansMod.java
  5. 0 46
      src/main/java/me/km/api/Utils.java
  6. 65 0
      src/main/java/me/km/data/DataManager.java
  7. 849 0
      src/main/java/me/km/data/EntityData.java
  8. 41 0
      src/main/java/me/km/data/EntityDataEvents.java
  9. 10 8
      src/main/java/me/km/effects/ActiveEffectBase.java
  10. 1 63
      src/main/java/me/km/effects/EffectUtils.java
  11. 1 1
      src/main/java/me/km/effects/active/ArcaneShot.java
  12. 13 22
      src/main/java/me/km/effects/active/AreaDamage.java
  13. 4 2
      src/main/java/me/km/effects/active/ArmorBoost.java
  14. 4 2
      src/main/java/me/km/effects/active/ArmorPasser.java
  15. 7 7
      src/main/java/me/km/effects/active/CallBack.java
  16. 1 1
      src/main/java/me/km/effects/active/ClusterBomb.java
  17. 4 2
      src/main/java/me/km/effects/active/ConstantPower.java
  18. 1 1
      src/main/java/me/km/effects/active/Doomed.java
  19. 4 2
      src/main/java/me/km/effects/active/DragonSkin.java
  20. 4 2
      src/main/java/me/km/effects/active/FallImmunity.java
  21. 4 2
      src/main/java/me/km/effects/active/GrapplingHook.java
  22. 5 14
      src/main/java/me/km/effects/active/Gravity.java
  23. 1 1
      src/main/java/me/km/effects/active/Harvest.java
  24. 4 2
      src/main/java/me/km/effects/active/Ignorance.java
  25. 4 3
      src/main/java/me/km/effects/active/ImpactPunch.java
  26. 5 9
      src/main/java/me/km/effects/active/LifeSteal.java
  27. 1 1
      src/main/java/me/km/effects/active/NailTrap.java
  28. 1 1
      src/main/java/me/km/effects/active/NetTrap.java
  29. 4 2
      src/main/java/me/km/effects/active/PoisonedBlade.java
  30. 4 3
      src/main/java/me/km/effects/active/PowerAttack.java
  31. 1 1
      src/main/java/me/km/effects/active/RapidFire.java
  32. 7 3
      src/main/java/me/km/effects/active/Shadow.java
  33. 4 2
      src/main/java/me/km/effects/active/ShadowHit.java
  34. 13 13
      src/main/java/me/km/effects/active/Shield.java
  35. 1 5
      src/main/java/me/km/effects/active/Silence.java
  36. 1 1
      src/main/java/me/km/effects/active/SilencePunch.java
  37. 1 1
      src/main/java/me/km/effects/active/SmokeBomb.java
  38. 1 1
      src/main/java/me/km/effects/active/TeleportBlock.java
  39. 4 2
      src/main/java/me/km/effects/active/Thorns.java
  40. 1 1
      src/main/java/me/km/effects/active/VineTrap.java
  41. 1 1
      src/main/java/me/km/effects/active/WarCall.java
  42. 16 15
      src/main/java/me/km/effects/passive/ArrowEffects.java
  43. 19 6
      src/main/java/me/km/effects/passive/BlockBreakEffects.java
  44. 101 89
      src/main/java/me/km/effects/passive/EntityDamageEffects.java
  45. 17 11
      src/main/java/me/km/events/CustomEventCaller.java
  46. 1 1
      src/main/java/me/km/inventory/TeleportContainer.java
  47. 2 2
      src/main/java/me/km/items/ItemScroll.java
  48. 2 2
      src/main/java/me/km/items/ItemWand.java
  49. 5 2
      src/main/java/me/km/items/ModItems.java
  50. 18 0
      src/main/java/me/km/items/herbs/ItemAquaHerb.java
  51. 18 0
      src/main/java/me/km/items/herbs/ItemGoldHerb.java
  52. 2 1
      src/main/java/me/km/items/herbs/ItemHerbs.java
  53. 7 12
      src/main/java/me/km/items/herbs/ItemSpecialHerb.java
  54. 22 1
      src/main/java/me/km/networking/ModPacketHandler.java
  55. 4 4
      src/main/java/me/km/networking/SeasonUpdate.java
  56. 11 2
      src/main/java/me/km/networking/StatusDisplay.java
  57. 34 12
      src/main/java/me/km/networking/StatusDisplayGui.java
  58. 0 132
      src/main/java/me/km/playerbank/PlayerData.java
  59. 0 1
      src/main/java/me/km/playerbank/PlayerLogInOut.java
  60. 4 24
      src/main/java/me/km/playerbank/PlayerManager.java
  61. 5 4
      src/main/java/me/km/scheduler/SnuviScheduler.java
  62. 12 3
      src/main/java/me/km/scrolls/CommandScroll.java
  63. 3 3
      src/main/java/me/km/snuviscript/MinecraftFunctions.java
  64. 2 29
      src/main/java/me/km/utils/ReflectionUtils.java
  65. 24 1
      src/main/resources/assets/km/lang/en_US.lang

+ 10 - 0
src/main/java/me/km/ClientEvents.java

@@ -15,6 +15,7 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent;
 import net.minecraftforge.client.event.RenderGameOverlayEvent;
 import net.minecraftforge.event.entity.player.ItemTooltipEvent;
 import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.gameevent.TickEvent;
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
 
@@ -37,6 +38,15 @@ public class ClientEvents
         }
     }
 
+    @SubscribeEvent
+    public void onClientTick(TickEvent.ClientTickEvent e)
+    {
+        if(e.phase == TickEvent.Phase.END)
+        {
+            StatusDisplayGui.INSTANCE.tick();
+        }  
+    }
+    
     @SubscribeEvent
     public void onRenderGui(RenderGameOverlayEvent.Pre e)
     {

+ 28 - 0
src/main/java/me/km/ClientProxy.java

@@ -1,6 +1,7 @@
 package me.km;
 
 import java.awt.Color;
+import java.lang.reflect.Field;
 import me.km.blocks.ModBlocks;
 import me.km.blocks.TileEntityCauldron;
 import me.km.entities.ModEntities;
@@ -9,6 +10,8 @@ import me.km.items.ModItems;
 import me.km.items.ModelCylinder;
 import me.km.items.ModelHat;
 import me.km.networking.KeyManager;
+import me.km.utils.ReflectionUtils;
+import static me.km.utils.ReflectionUtils.getFinalStaticField;
 import net.minecraft.block.Block;
 import net.minecraft.block.state.IBlockState;
 import net.minecraft.client.Minecraft;
@@ -20,11 +23,14 @@ import net.minecraft.client.renderer.color.BlockColors;
 import net.minecraft.client.renderer.color.ItemColors;
 import net.minecraft.client.renderer.color.IBlockColor;
 import net.minecraft.client.renderer.entity.Render;
+import net.minecraft.client.resources.FoliageColorReloadListener;
+import net.minecraft.client.resources.GrassColorReloadListener;
 import net.minecraft.entity.Entity;
 import net.minecraft.init.Blocks;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
 import net.minecraft.server.MinecraftServer;
+import net.minecraft.util.ResourceLocation;
 import net.minecraft.util.math.BlockPos;
 import net.minecraft.world.ColorizerFoliage;
 import net.minecraft.world.IBlockAccess;
@@ -130,4 +136,26 @@ public class ClientProxy extends CommonProxy
     {
         return STRAW_HAT;
     }
+    
+    // -------------------------------------------------------------------------
+    // rendering stuff
+    // -------------------------------------------------------------------------
+    
+    @SideOnly(Side.CLIENT)
+    private final static Field LOC_FOLIAGE_PNG = ReflectionUtils.getFinalStaticField(FoliageColorReloadListener.class, "field_130079_a", "LOC_FOLIAGE_PNG");   
+    
+    @Override
+    public void setFoliage(ResourceLocation loc)
+    {
+        ReflectionUtils.setFieldValue(null, LOC_FOLIAGE_PNG, loc);
+    }
+    
+    @SideOnly(Side.CLIENT)
+    private final static Field LOC_GRASS_PNG = getFinalStaticField(GrassColorReloadListener.class, "field_130078_a", "LOC_GRASS_PNG");   
+    
+    @Override
+    public void setGrass(ResourceLocation loc)
+    {
+        ReflectionUtils.setFieldValue(null, LOC_GRASS_PNG, loc);
+    }
 }

+ 13 - 0
src/main/java/me/km/CommonProxy.java

@@ -10,6 +10,7 @@ import net.minecraft.entity.Entity;
 import net.minecraft.item.Item;
 import net.minecraft.server.MinecraftServer;
 import net.minecraft.server.dedicated.DedicatedServer;
+import net.minecraft.util.ResourceLocation;
 import net.minecraftforge.common.MinecraftForge;
 import net.minecraftforge.fluids.IFluidBlock;
 import net.minecraftforge.fml.relauncher.Side;
@@ -65,4 +66,16 @@ public class CommonProxy
     {
         return null;
     }
+    
+    // -------------------------------------------------------------------------
+    // rendering stuff
+    // -------------------------------------------------------------------------
+
+    public void setFoliage(ResourceLocation loc)
+    {
+    }
+    
+    public void setGrass(ResourceLocation loc)
+    {
+    }
 }

+ 9 - 10
src/main/java/me/km/KajetansMod.java

@@ -4,14 +4,13 @@ import me.km.capabilities.CapabilitiesEvents;
 import me.km.api.Module;
 import me.km.api.SimpleConfig;
 import me.km.api.CommandOverloader;
-import me.km.api.Utils;
 import me.km.blockprotections.BlockProtectionBank;
 import me.km.capabilities.DamageUtils;
 import me.km.chatmanager.ChatManager;
+import me.km.data.DataManager;
 import me.km.databank.DataBank;
 import me.km.dimensions.ModWorldGeneration;
 import me.km.dimensions.WorldData;
-import me.km.effects.EffectUtils;
 import me.km.jobsystem.JobAPI;
 import me.km.networking.ModPacketHandler;
 import me.km.permissions.PermissionManager;
@@ -58,7 +57,7 @@ public class KajetansMod
     public static Module environment;
     public static ScriptModule scripts;
     public static JobAPI jobs;
-    public static EffectUtils effects;
+    public static DataManager data;
     public static SkillManager skills;
     public static Module scrolls;
     public static ScoreboardAPI scoreboard;
@@ -69,7 +68,7 @@ public class KajetansMod
 
     public static final String MODID = "km";
     public static final String NAME = "Kajetans Mod";
-    public static final String VERSION = "0.0.16";
+    public static final String VERSION = "0.0.17";
 
     @Mod.Instance(MODID)
     public static KajetansMod instance;
@@ -94,7 +93,7 @@ public class KajetansMod
         DamageUtils.init();
         CapabilitiesEvents.init();
         
-        net.minecraftforge.common.MinecraftForge.EVENT_BUS.register(new Object()
+        /*net.minecraftforge.common.MinecraftForge.EVENT_BUS.register(new Object()
             {
                 @net.minecraftforge.fml.common.eventhandler.SubscribeEvent
                 public void wusi2(net.minecraftforge.event.ServerChatEvent e) 
@@ -133,7 +132,7 @@ public class KajetansMod
                         ex.printStackTrace();
                     }
                 }
-            });
+            });*/
     }
     
     @Mod.EventHandler
@@ -243,15 +242,15 @@ public class KajetansMod
         jobs.registerCommands(e, "me.km.jobsystem");      
         jobs.registerEvents("me.km.jobsystem"); 
 
-        // Effectsystem
-        effects = new EffectUtils("Effects", "Effects", TextFormatting.BLUE);
-        effects.registerCommands(e, "me.km.effects"); 
-        effects.registerEvents("me.km.effects.passive"); 
+        // DataManager
+        data = new DataManager("DataManager", "Data", TextFormatting.GRAY);
+        data.registerEvents("me.km.data"); 
 
         // Skills
         skills = new SkillManager("SkillSystem", "Skills", TextFormatting.BLUE);
         skills.registerCommands(e, "me.km.skills"); 
         skills.registerEvents("me.km.skills");
+        skills.registerEvents("me.km.effects.passive");
 
         // Scrollsystem
         scrolls = new Module("Scrolls", "Scrolls", TextFormatting.BLUE);

+ 0 - 46
src/main/java/me/km/api/Utils.java

@@ -457,52 +457,6 @@ public class Utils
         teleportEntity(ent, new Location(ent2));
     }
     
-    public static float getRealDamage(EntityLivingBase ent, DamageSource ds, float d)
-    {
-        if(!ent.isEntityInvulnerable(ds))
-        {
-            if(d <= 0)
-            {
-                return 0;
-            }
-            // Armor from applyArmorCalculations
-            d = getDamagerAfterArmor(ent, ds, d);
-            // Potion / Enchantment from applyPotionDamageCalculations
-            if(!ds.isDamageAbsolute())
-            {
-                if(ent.isPotionActive(MobEffects.RESISTANCE) && ds != DamageSource.OUT_OF_WORLD)
-                {
-                    int i = (ent.getActivePotionEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
-                    d = (d * (25 - i)) / 25;
-                }
-                if(d <= 0)
-                {
-                    return 0;
-                }
-                else
-                {
-                    int k = EnchantmentHelper.getEnchantmentModifierDamage(ent.getArmorInventoryList(), ds);
-                    if(k > 0)
-                    {
-                        d = CombatRules.getDamageAfterMagicAbsorb(d, k);
-                    }
-                }
-            }
-            d = Math.max(d - ent.getAbsorptionAmount(), 0);
-            return d;
-        }
-        return 0;
-    }
-    
-    public static float getDamagerAfterArmor(EntityLivingBase ent, DamageSource ds, float d)
-    {
-        if(!ds.isUnblockable())
-        {
-            return CombatRules.getDamageAfterAbsorb(d, ent.getTotalArmorValue(), (float) ent.getEntityAttribute(SharedMonsterAttributes.ARMOR_TOUGHNESS).getAttributeValue());
-        }
-        return d;
-    }
-    
     // -------------------------------------------------------------------------
     // Entities aus Umgebung
     // -------------------------------------------------------------------------

+ 65 - 0
src/main/java/me/km/data/DataManager.java

@@ -0,0 +1,65 @@
+package me.km.data;
+
+import java.util.HashMap;
+import me.km.api.Module;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.text.TextFormatting;
+
+public class DataManager extends Module
+{
+    private final EntityData fallback;
+    private final HashMap<Integer, EntityData> entityData;
+    
+    public DataManager(String mname, String prefix, TextFormatting color) 
+    {
+        super(mname, prefix, color);
+        entityData = new HashMap<>();
+        fallback = new EntityData(null);
+    }
+    
+    public EntityData get(Entity ent)
+    {
+        if(ent == null)
+        {
+            return fallback;
+        }
+        return entityData.getOrDefault(ent.getEntityId(), fallback);
+    }
+    
+    public EntityData getOrCreate(Entity ent)
+    {
+        EntityData data = entityData.getOrDefault(ent.getEntityId(), null);
+        if(data == null)
+        {
+            return add(ent);
+        }
+        return data;
+    }
+    
+    public EntityData add(Entity ent)
+    {
+        EntityData data = new EntityData(ent);
+        entityData.put(ent.getEntityId(), data);
+        return data;
+    }
+    
+    public void onEntityDeath(Entity ent)
+    {
+        EntityData data = entityData.get(ent.getEntityId());
+        if(data != null && data.onEntityDeath())
+        {
+            entityData.remove(ent.getEntityId());
+        }
+    }
+    
+    public void onPlayerLogOut(EntityPlayer p)
+    {
+        entityData.remove(p.getEntityId());
+    }
+    
+    public void tick()
+    {
+        entityData.values().forEach(data -> data.tick());
+    }
+}

+ 849 - 0
src/main/java/me/km/data/EntityData.java

@@ -0,0 +1,849 @@
+package me.km.data;
+
+import java.util.HashMap;
+import me.km.api.Location;
+import me.km.networking.ModPacketHandler;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayerMP;
+
+public class EntityData 
+{
+    private Entity ent;
+    private boolean isLiving;
+    private boolean isPlayer;
+    
+    public EntityData(Entity ent)
+    {
+        this.ent = ent;
+        this.isLiving = ent instanceof EntityLivingBase;
+        this.isPlayer = ent instanceof EntityPlayerMP;
+    }
+
+    public boolean onEntityDeath()
+    {
+        return true;
+    }
+
+    public void tick()
+    {
+        tickLessHeal();
+        tickAttackBoost();
+        tickArmorBoost();
+        tickMagicArmorBoost();
+        tickReflection();
+        tickArmorBypass();
+        tickCallBack();
+        tickDoomed();
+        tickPoisonBlade();
+        tickArrowImmunity();
+        tickFallImmunity();
+        tickSilence();
+        tickShadow();
+        tickCooldown();
+        tickGravity();
+        tickIgnorance();
+        tickGoldBonus();
+        tickAquaAffinity();
+    }
+    
+    public boolean isPlayerData()
+    {
+        return isPlayer;
+    }
+    
+    public boolean isLivingData()
+    {
+        return isLiving;
+    }
+    
+    private void sendStatus(boolean add, byte id, String text)
+    {
+        if(isPlayer)
+        {
+            if(add)
+            {
+                ModPacketHandler.addStatus((EntityPlayerMP) ent, id, text);
+            }
+            else
+            {
+                ModPacketHandler.removeStatus((EntityPlayerMP) ent, id);
+            }
+        }
+    }
+    
+    private void sendTimedStatus(boolean add, byte id, int time, String text)
+    {
+        if(isPlayer)
+        {
+            if(add)
+            {
+                ModPacketHandler.addTimedStatus((EntityPlayerMP) ent, id, text, time);
+            }
+            else
+            {
+                ModPacketHandler.removeStatus((EntityPlayerMP) ent, id);
+            }
+        }
+    }
+    
+    // -------------------------------------------------------------------------
+    // this is used for cooldown
+    // -------------------------------------------------------------------------
+    
+    private HashMap<String, Integer> cooldowns = new HashMap<>();
+    
+    public void addCoolDown(String name, int time)
+    {
+        cooldowns.put(name, time);
+    }
+    
+    public boolean hasCooldown(String name)
+    {
+        return cooldowns.get(name) != null;
+    }
+    
+    public void tickCooldown()
+    {
+        cooldowns.entrySet().removeIf(e -> 
+        {
+            int i = e.getValue() - 1;
+            if(i <= 0)
+            {
+                return true;
+            }
+            e.setValue(i);
+            return false;
+        });
+    }
+
+    // -------------------------------------------------------------------------
+    // this is used for teleportation on hit
+    // -------------------------------------------------------------------------
+    
+    private Entity teleportEnt = null;
+    
+    public void setHitTeleport(Entity goal)
+    {
+        teleportEnt = goal;
+    }
+    
+    public boolean hasTeleportEntity()
+    {
+        return teleportEnt != null;
+    }
+    
+    public Entity getTeleportEntity()
+    {
+        return teleportEnt;
+    }
+    
+    // -------------------------------------------------------------------------
+    // rapid fire storage
+    // -------------------------------------------------------------------------
+    
+    private EntityLivingBase healEntOnHit = null;
+    
+    public void setOnHitHealEntity(EntityLivingBase goal)
+    {
+        healEntOnHit = goal;
+    }
+    
+    public boolean hasOnHitHealEntity()
+    {
+        return healEntOnHit != null;
+    }
+    
+    public EntityLivingBase getOnHitHealEntity()
+    {
+        return healEntOnHit;
+    }
+    
+    // -------------------------------------------------------------------------
+    // heal by dealed damage
+    // -------------------------------------------------------------------------
+    
+    private EntityLivingBase healByDamage = null;
+    
+    public void setHealByDamageEntity(EntityLivingBase goal)
+    {
+        healByDamage = goal;
+    }
+    
+    public boolean hasHealByDamageEntity()
+    {
+        return healByDamage != null;
+    }
+    
+    public EntityLivingBase getHealByDamageEntity()
+    {
+        return healByDamage;
+    }
+    
+    // -------------------------------------------------------------------------
+    // this is used for cluster bombs
+    // -------------------------------------------------------------------------
+    
+    private int clusterPower = 0;
+    
+    public void setClusterBomb(int power)
+    {
+        clusterPower = power;
+    }
+    
+    public int getClusterPower()
+    {
+        return clusterPower;
+    }
+    
+    // -------------------------------------------------------------------------
+    // grappling hook
+    // -------------------------------------------------------------------------
+    
+    private boolean arrowHook = false;
+    
+    public void setArrowHook(boolean hook)
+    {
+        arrowHook = hook;
+        sendStatus(hasArrowHook(), (byte) 1, "§a#entitydata.grapplingHook");
+    }
+    
+    public boolean hasArrowHook()
+    {
+        return arrowHook;
+    }
+    
+    // -------------------------------------------------------------------------
+    // shadow hit
+    // -------------------------------------------------------------------------
+    
+    private boolean shadowHit = false;
+    
+    public void setShadowHit(boolean hit)
+    {
+        shadowHit = hit;
+        sendStatus(hasShadowHit(), (byte) 2, "§a#entitydata.shadowHit");
+    }
+    
+    public boolean hasShadowHit()
+    {
+        return shadowHit;
+    }
+    
+    // -------------------------------------------------------------------------
+    // smoke bomb
+    // -------------------------------------------------------------------------
+    
+    private boolean smokeBomb = false;
+    
+    public void setSmokeBomb(boolean bomb)
+    {
+        smokeBomb = bomb;
+    }
+    
+    public boolean isSmokeBomb()
+    {
+        return smokeBomb;
+    }
+    
+    // -------------------------------------------------------------------------
+    // power attack
+    // -------------------------------------------------------------------------
+    
+    private float powerAttack = 0;
+    
+    public void setPowerAttack(float power)
+    {
+        this.powerAttack = power;
+        sendStatus(hasPowerAttack(), (byte) 3, "§a+" + Math.round(power * 100 - 100) + "% #entitydata.powerAttack");
+    }
+
+    public float getPowerAttack()
+    {
+        return powerAttack;
+    }
+    
+    public boolean hasPowerAttack()
+    {
+        return powerAttack > 0;
+    }
+    
+    // -------------------------------------------------------------------------
+    // impact punch
+    // -------------------------------------------------------------------------
+    
+    private float impactPunch = 0;
+    
+    public void setImpactPunch(float power)
+    {
+        this.impactPunch = power;
+        sendStatus(hasImpactPunch(), (byte) 4, "§a+" + Math.round(power * 100 - 100) + "% #entitydata.impactPunch");
+    }
+
+    public float getImpactPunch()
+    {
+        return impactPunch;
+    }
+    
+    public boolean hasImpactPunch()
+    {
+        return impactPunch > 0;
+    }
+    
+    // -------------------------------------------------------------------------
+    // less heal
+    // -------------------------------------------------------------------------
+    
+    private int lessHealTime = 0;
+    private float lessHeal = 0;
+    
+    public void setLessHeal(int time, float lessHeal)
+    {
+        this.lessHealTime = time;
+        this.lessHeal = lessHeal;
+        sendTimedStatus(hasImpactPunch(), (byte) 5, time, "§c-" + Math.round(100 - lessHeal * 100) + "% #entitydata.lessHeal");
+    }
+
+    public float getLessHeal()
+    {
+        return lessHeal;
+    }
+    
+    public boolean hasLessHeal()
+    {
+        return lessHeal > 0;
+    }
+    
+    private void tickLessHeal()
+    {
+        if(lessHealTime != Integer.MAX_VALUE && lessHealTime > 0)
+        {
+            lessHealTime--;
+            if(lessHealTime <= 0)
+            {
+                setLessHeal(0, 0);
+            }
+        }
+    }
+
+    // -------------------------------------------------------------------------
+    // attack boost
+    // -------------------------------------------------------------------------
+    
+    private int attackBoostTime = 0;
+    private float attackBoost = 0;
+    
+    public void setAttackBoost(int time, float attackBoost)
+    {
+        this.attackBoostTime = time;
+        this.attackBoost = attackBoost;
+        sendTimedStatus(hasAttackBoost(), (byte) 6, time, "§a+" + Math.round(attackBoost * 100 - 100) + "% #entitydata.attackBoost");
+    }
+
+    public float getAttackBoost()
+    {
+        return attackBoost;
+    }
+    
+    public boolean hasAttackBoost()
+    {
+        return attackBoost > 0;
+    }
+    
+    private void tickAttackBoost()
+    {
+        if(attackBoostTime != Integer.MAX_VALUE && attackBoostTime > 0)
+        {
+            attackBoostTime--;
+            if(attackBoostTime <= 0)
+            {
+                setAttackBoost(0, 0);
+            }
+        }
+    }
+    
+    // -------------------------------------------------------------------------
+    // armor boost
+    // -------------------------------------------------------------------------
+    
+    private int armorBoostTime = 0;
+    private float armorBoost = 0;
+    
+    public void setArmorBoost(int time, float armorBoost)
+    {
+        this.armorBoostTime = time;
+        this.armorBoost = armorBoost;
+        sendTimedStatus(hasArmorBoost(), (byte) 7, time, "§a+" + Math.round(armorBoost * 100 - 100) + "% #entitydata.armorBoost");
+    }
+
+    public float getArmorBoost()
+    {
+        return armorBoost;
+    }
+    
+    public boolean hasArmorBoost()
+    {
+        return armorBoost > 0;
+    }
+    
+    private void tickArmorBoost()
+    {
+        if(armorBoostTime != Integer.MAX_VALUE && armorBoostTime > 0)
+        {
+            armorBoostTime--;
+            if(armorBoostTime <= 0)
+            {
+                setArmorBoost(0, 0);
+            }
+        }
+    }
+    
+    // -------------------------------------------------------------------------
+    // magic armor boost
+    // -------------------------------------------------------------------------
+    
+    private int magicArmorBoostTime = 0;
+    private float magicArmorBoost = 0;
+    
+    public void setMagicArmorBoost(int time, float magicArmorBoost)
+    {
+        this.magicArmorBoostTime = time;
+        this.magicArmorBoost = magicArmorBoost;
+        sendTimedStatus(hasMagicArmorBoost(), (byte) 8, time, "§a+" + Math.round(magicArmorBoost * 100 - 100) + "% #entitydata.magicArmorBoost");
+    }
+
+    public float getMagicArmorBoost()
+    {
+        return magicArmorBoost;
+    }
+    
+    public boolean hasMagicArmorBoost()
+    {
+        return magicArmorBoost > 0;
+    }
+    
+    private void tickMagicArmorBoost()
+    {
+        if(magicArmorBoostTime != Integer.MAX_VALUE && magicArmorBoostTime > 0)
+        {
+            magicArmorBoostTime--;
+            if(magicArmorBoostTime <= 0)
+            {
+                setMagicArmorBoost(0, 0);
+            }
+        }
+    }
+    
+    // -------------------------------------------------------------------------
+    // physical reflect
+    // -------------------------------------------------------------------------
+    
+    private int reflectionTime = 0;
+    private float reflection = 0;
+    
+    public void setReflection(int time, float reflection)
+    {
+        this.reflectionTime = time;
+        this.reflection = reflection;
+        sendTimedStatus(hasReflection(), (byte) 9, time, "§a+" + Math.round(reflection * 100) + "% #entitydata.reflection");
+    }
+
+    public float getReflection()
+    {
+        return reflection;
+    }
+    
+    public boolean hasReflection()
+    {
+        return reflection > 0;
+    }
+    
+    private void tickReflection()
+    {
+        if(reflectionTime != Integer.MAX_VALUE && reflectionTime > 0)
+        {
+            reflectionTime--;
+            if(reflectionTime <= 0)
+            {
+                setReflection(0, 0);
+            }
+        }
+    }
+    
+    // -------------------------------------------------------------------------
+    // armor bypass on attacked entity
+    // -------------------------------------------------------------------------
+    
+    private int armorBypassTime = 0;
+    private float armorBypass = 0;
+    
+    public void setArmorBypass(int time, float armorBypass)
+    {
+        this.armorBypassTime = time;
+        this.armorBypass = armorBypass;
+        sendTimedStatus(hasArmorBypass(), (byte) 10, time, "§a+" + Math.round(armorBypass * 100) + "% #entitydata.armorBypass");
+    }
+
+    public float getArmorBypass()
+    {
+        return armorBypass;
+    }
+    
+    public boolean hasArmorBypass()
+    {
+        return armorBypass > 0;
+    }
+    
+    private void tickArmorBypass()
+    {
+        if(armorBypassTime != Integer.MAX_VALUE && armorBypassTime > 0)
+        {
+            armorBypassTime--;
+            if(armorBypassTime <= 0)
+            {
+                setArmorBypass(0, 0);
+            }
+        }
+    }
+    
+    // -------------------------------------------------------------------------
+    // location call back
+    // -------------------------------------------------------------------------
+    
+    private Location callBack = null;
+    private int callBackTime = 0;
+    
+    public void setCallBack(int time, Location loc)
+    {
+        this.callBackTime = time;
+        this.callBack = loc;
+        sendTimedStatus(time > 0, (byte) 11, time, "§a#entitydata.callback");
+    }
+
+    public Location getCallBack()
+    {
+        return callBack;
+    }
+    
+    private void tickCallBack()
+    {
+        if(callBackTime != Integer.MAX_VALUE && callBackTime > 0)
+        {
+            callBackTime--;
+            if(callBackTime <= 0)
+            {
+                setCallBack(0, null);
+            }
+        }
+    }
+    
+    // -------------------------------------------------------------------------
+    // doomed
+    // -------------------------------------------------------------------------
+    
+    private int doomedTime = 0;
+    
+    public void setDoomed(int time)
+    {
+        this.doomedTime = time;
+        sendTimedStatus(isDoomed(), (byte) 12, time, "§c#entitydata.doomed");
+    }
+    
+    public boolean isDoomed()
+    {
+        return doomedTime > 0;
+    }
+
+    private void tickDoomed()
+    {
+        if(doomedTime != Integer.MAX_VALUE && doomedTime > 0)
+        {
+            doomedTime--;
+            if(doomedTime <= 0)
+            {
+                setDoomed(0);
+            }
+        }
+    }
+    
+    // -------------------------------------------------------------------------
+    // poison blade
+    // -------------------------------------------------------------------------
+    
+    private int poisonBladeTime = 0;
+    
+    public void setPoisonBlade(int time)
+    {
+        this.poisonBladeTime = time;
+        sendTimedStatus(hasPoisonBlade(), (byte) 13, time, "§a#entitydata.poisonBlade");
+    }
+    
+    public boolean hasPoisonBlade()
+    {
+        return poisonBladeTime > 0;
+    }
+
+    private void tickPoisonBlade()
+    {
+        if(poisonBladeTime != Integer.MAX_VALUE && poisonBladeTime > 0)
+        {
+            poisonBladeTime--;
+            if(poisonBladeTime <= 0)
+            {
+                setPoisonBlade(0);
+            }
+        }
+    }
+    
+    // -------------------------------------------------------------------------
+    // arrow immunity
+    // -------------------------------------------------------------------------
+    
+    private int arrowImmunityTime = 0;
+    
+    public void setArrowImmunity(int time)
+    {
+        this.arrowImmunityTime = time;
+        sendTimedStatus(hasArrowImmunity(), (byte) 14, time, "§a#entitydata.arrowImmunity");
+    }
+    
+    public boolean hasArrowImmunity()
+    {
+        return arrowImmunityTime > 0;
+    }
+
+    private void tickArrowImmunity()
+    {
+        if(arrowImmunityTime != Integer.MAX_VALUE && arrowImmunityTime > 0)
+        {
+            arrowImmunityTime--;
+            if(arrowImmunityTime <= 0)
+            {
+                setArrowImmunity(0);
+            }
+        }
+    }
+    
+    // -------------------------------------------------------------------------
+    // fall immunity
+    // -------------------------------------------------------------------------
+    
+    private int fallImmunityTime = 0;
+    
+    public void setFallImmunity(int time)
+    {
+        this.fallImmunityTime = time;
+        sendTimedStatus(hasFallImmunity(), (byte) 15, time, "§a#entitydata.fallImmunity");
+    }
+    
+    public boolean hasFallImmunity()
+    {
+        return fallImmunityTime > 0;
+    }
+
+    private void tickFallImmunity()
+    {
+        if(fallImmunityTime != Integer.MAX_VALUE && fallImmunityTime > 0)
+        {
+            fallImmunityTime--;
+            if(fallImmunityTime <= 0)
+            {
+                setFallImmunity(0);
+            }
+        }
+    }
+    
+    // -------------------------------------------------------------------------
+    // silence
+    // -------------------------------------------------------------------------
+    
+    private int silenceTime = 0;
+    
+    public void setSilenceTime(int time)
+    {
+        if(hasIgnorance())
+        {
+            return;
+        }
+        this.silenceTime = time;
+        sendTimedStatus(isSilenced(), (byte) 16, time, "§c#entitydata.silence");
+    }
+    
+    public boolean isSilenced()
+    {
+        return silenceTime > 0;
+    }
+
+    private void tickSilence()
+    {
+        if(silenceTime != Integer.MAX_VALUE && silenceTime > 0)
+        {
+            silenceTime--;
+            if(silenceTime <= 0)
+            {
+                setSilenceTime(0);
+            }
+        }
+    }
+    
+    // -------------------------------------------------------------------------
+    // shadow
+    // -------------------------------------------------------------------------
+    
+    private int shadowTime = 0;
+    
+    public void setShadow(int time)
+    {
+        this.shadowTime = time;
+        sendTimedStatus(isShadow(), (byte) 17, time, "§a#entitydata.shadow");
+    }
+    
+    public boolean isShadow()
+    {
+        return shadowTime > 0;
+    }
+
+    private void tickShadow()
+    {
+        if(shadowTime != Integer.MAX_VALUE && shadowTime > 0)
+        {
+            shadowTime--;
+            if(shadowTime <= 0)
+            {
+                setShadow(0);
+            }
+        }
+    }
+    
+    // -------------------------------------------------------------------------
+    // gravity
+    // -------------------------------------------------------------------------
+    
+    private int gravityTime = 0;
+    
+    public void setGravity(int time)
+    {
+        this.gravityTime = time;
+        if(time == 0)
+        {
+            ent.setNoGravity(false);
+        }
+        else
+        {
+            ent.setNoGravity(true);
+        }
+        sendTimedStatus(time > 0, (byte) 18, time, "§a#entitydata.gravity");
+    }
+    
+    public boolean hasGravity()
+    {
+        return gravityTime > 0;
+    }
+
+    private void tickGravity()
+    {
+        if(gravityTime != Integer.MAX_VALUE && gravityTime > 0)
+        {
+            gravityTime--;
+            if(gravityTime <= 0)
+            {
+                setGravity(0);
+            }
+        }
+    }
+    
+    // -------------------------------------------------------------------------
+    // ignorance
+    // -------------------------------------------------------------------------
+    
+    private int ignoranceTime = 0;
+    
+    public void setIgnorance(int time)
+    {
+        this.ignoranceTime = time;
+        sendTimedStatus(time > 0, (byte) 19, time, "§a#entitydata.ignorance");
+    }
+    
+    public boolean hasIgnorance()
+    {
+        return ignoranceTime > 0;
+    }
+
+    private void tickIgnorance()
+    {
+        if(ignoranceTime != Integer.MAX_VALUE && ignoranceTime > 0)
+        {
+            ignoranceTime--;
+            if(ignoranceTime <= 0)
+            {
+                setIgnorance(0);
+            }
+        }
+    }
+    
+    // -------------------------------------------------------------------------
+    // gold
+    // -------------------------------------------------------------------------
+    
+    private int goldTime = 0;
+    private float goldBonus = 0;
+    
+    public void setGoldBonus(int time, float bonus)
+    {
+        this.goldTime = time;
+        this.goldBonus = bonus;
+        sendTimedStatus(hasGoldBonus(), (byte) 20, time, "§a+" + Math.round(goldBonus * 100 - 100) + "% #entitydata.goldBonus");
+    }
+    
+    public boolean hasGoldBonus()
+    {
+        return goldTime > 0;
+    }
+    
+    public float getGoldBonus()
+    {
+        return goldBonus;
+    }
+
+    private void tickGoldBonus()
+    {
+        if(goldTime != Integer.MAX_VALUE && goldTime > 0)
+        {
+            goldTime--;
+            if(goldTime <= 0)
+            {
+                setGoldBonus(0, 0);
+            }
+        }
+    }
+    
+    // -------------------------------------------------------------------------
+    // aqua affinity
+    // -------------------------------------------------------------------------
+    
+    private int aquaAffinityTime = 0;
+    
+    public void setAquaAffinity(int time)
+    {
+        this.aquaAffinityTime = time;
+        sendTimedStatus(time > 0, (byte) 21, time, "§a#entitydata.aquaAffinity");
+    }
+    
+    public boolean hasAquaAffinity()
+    {
+        return aquaAffinityTime > 0;
+    }
+    
+    private void tickAquaAffinity()
+    {
+        if(aquaAffinityTime != Integer.MAX_VALUE && aquaAffinityTime > 0)
+        {
+            aquaAffinityTime--;
+            if(aquaAffinityTime <= 0)
+            {
+                setAquaAffinity(0);
+            }
+        }
+    }
+}
+

+ 41 - 0
src/main/java/me/km/data/EntityDataEvents.java

@@ -0,0 +1,41 @@
+package me.km.data;
+
+import me.km.KajetansMod;
+import me.km.api.Module;
+import me.km.api.ModuleListener;
+import net.minecraftforge.event.entity.living.LivingDeathEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.gameevent.PlayerEvent;
+import net.minecraftforge.fml.common.gameevent.TickEvent;
+
+public class EntityDataEvents extends ModuleListener
+{
+    private DataManager data;
+    
+    public EntityDataEvents(Module m) 
+    {
+        super(m);
+        data = KajetansMod.data;
+    }
+
+    @SubscribeEvent(receiveCanceled = false)
+    public void onLivingDeath(LivingDeathEvent e)
+    {        
+        data.onEntityDeath(e.getEntityLiving());
+    } 
+    
+    @SubscribeEvent
+    public void tickServer(TickEvent.ServerTickEvent e) 
+    {       
+        if(e.phase == TickEvent.Phase.END)
+        {
+            data.tick();
+        }
+    }
+    
+    @SubscribeEvent
+    public void onPlayerLogOut(PlayerEvent.PlayerLoggedOutEvent e)
+    {        
+        data.onPlayerLogOut(e.player);
+    }
+}

+ 10 - 8
src/main/java/me/km/effects/ActiveEffectBase.java

@@ -1,6 +1,7 @@
 package me.km.effects;
 
 import me.km.KajetansMod;
+import me.km.data.EntityData;
 import me.km.environment.EnvironmentAPI;
 import me.km.snuviscript.ScriptEvents;
 import net.minecraft.entity.player.EntityPlayerMP;
@@ -9,16 +10,17 @@ public abstract class ActiveEffectBase
 {
     public final boolean run(EntityPlayerMP p, int power, int mana, int cooldown, EffectCause cause)
     {
+        EntityData data = KajetansMod.data.getOrCreate(p);
         if(cause != EffectCause.NOTHING)
         {
-            if(KajetansMod.playerbank.getData(p).hasData("shadow"))
+            if(data.isShadow())
             {
                 p.setInvisible(false);
-                KajetansMod.playerbank.getData(p).removeData("shadow");
+                data.setShadow(0);
             } 
-            if(KajetansMod.playerbank.getData(p).hasData("silence"))
+            if(data.isSilenced())
             {
-                KajetansMod.effects.send(p, "Du kannst gerade keine Skills nutzen.");
+                KajetansMod.skills.send(p, "Du kannst gerade keine Skills nutzen.");
                 return false;
             }
         }
@@ -42,14 +44,14 @@ public abstract class ActiveEffectBase
             return executeEffect(p, power);
         }
         // cooldown check
-        if(!KajetansMod.playerbank.getData(p).hasData(name))
+        if(!data.hasCooldown(name))
         {
             if(mana > 0)
             {
                 int currentMana = EnvironmentAPI.getMana(p);
                 if(currentMana < mana)
                 {
-                    KajetansMod.effects.send(p, "Du hast zu wenig Mana. (§a" + mana + "§r/§c" + mana + "§r)");
+                    KajetansMod.skills.send(p, "Du hast zu wenig Mana. (§a" + mana + "§r/§c" + mana + "§r)");
                     return false;
                 }
             }  
@@ -57,7 +59,7 @@ public abstract class ActiveEffectBase
             {
                 if(cooldown > 0)
                 {
-                    KajetansMod.playerbank.getData(p).addTimedData(name, cooldown);
+                    data.addCoolDown(name, cooldown);
                 }
                 if(mana >= 0)
                 {
@@ -67,7 +69,7 @@ public abstract class ActiveEffectBase
             }
             return false;
         }
-        KajetansMod.effects.send(p, "Der Cooldown läuft noch.");
+        KajetansMod.skills.send(p, "Der Cooldown läuft noch.");
         return false;
     }
     

+ 1 - 63
src/main/java/me/km/effects/EffectUtils.java

@@ -1,10 +1,8 @@
 package me.km.effects;
 
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.stream.Collectors;
 import me.km.KajetansMod;
-import me.km.api.Module;
 import me.km.api.Utils;
 import me.km.entities.EntityItemProjectile;
 import me.km.jobsystem.JobAPI;
@@ -28,71 +26,11 @@ import net.minecraft.util.SoundCategory;
 import net.minecraft.util.SoundEvent;
 import net.minecraft.util.math.BlockPos;
 import net.minecraft.util.math.Vec3d;
-import net.minecraft.util.text.TextFormatting;
 import net.minecraft.world.World;
 import net.minecraft.world.WorldServer;
 
-public class EffectUtils extends Module
+public class EffectUtils
 {
-    private final HashMap<Integer, EntityData> entityData;
-    
-    public EffectUtils(String mname, String prefix, TextFormatting color) 
-    {
-        super(mname, prefix, color);
-        entityData = new HashMap<>();
-    }
-    
-    // -----------------------------------------------------------------------------------
-    // Entity-Data
-    // -----------------------------------------------------------------------------------
-    
-    private class EntityData
-    {
-        private final String s;
-        private final Object data;
-        
-        public EntityData(String s, Object data)
-        {
-            this.s = s;
-            this.data = data;
-        }
-    }
-    
-    public void addEntityData(Entity ent, String key, Object data)
-    {
-        entityData.put(ent.getEntityId(), new EntityData(key, data));
-        removeInvalidData(ent);
-    }
-    
-    public void addEntityData(Entity ent, String key)
-    {
-        addEntityData(ent, key, true);
-    }
-    
-    private void removeInvalidData(Entity ent)
-    {
-        if(ent.isDead)
-        {
-            entityData.remove(ent.getEntityId());
-            return;
-        }
-        KajetansMod.scheduler.scheduleTask(() -> removeInvalidData(ent), 100);
-    }
-    
-    public Object getEntityData(Entity ent, String key)
-    {
-        EntityData data = entityData.get(ent.getEntityId());
-        if(data == null)
-        {
-            return null;
-        }
-        if(data.s.equals(key))
-        {
-            return data.data;
-        }
-        return null;
-    }
-    
     // -----------------------------------------------------------------------------------
     // Entity-Level
     // -----------------------------------------------------------------------------------

+ 1 - 1
src/main/java/me/km/effects/active/ArcaneShot.java

@@ -14,7 +14,7 @@ public class ArcaneShot extends ActiveEffectBase
         EntityArrow arrow = EffectUtils.launchProjectile(p, EntityArrow.class, power / 4f, null);
         arrow.setDamage(0.1);
         arrow.pickupStatus = EntityArrow.PickupStatus.DISALLOWED;
-        KajetansMod.effects.addEntityData(p, "arcaneshot");
+        KajetansMod.data.getOrCreate(arrow).setHitTeleport(p);
         return true;
     }
 }

+ 13 - 22
src/main/java/me/km/effects/active/AreaDamage.java

@@ -13,34 +13,25 @@ public class AreaDamage extends ActiveEffectBase
     @Override
     protected boolean executeEffect(EntityPlayerMP p, int power) 
     {       
-        if(!KajetansMod.playerbank.getData(p).hasData("aoe"))
+        for(int i = 0; i < power; i++)
         {
-            // just adding a bit to time to make sure the last call works
-            KajetansMod.playerbank.getData(p).addGoodTimedData("aoe", true, power * 20 + 3, "AOE Schaden", 61);
-            for(int i = 0; i < power; i++)
-            {
-                KajetansMod.scheduler.scheduleTask(() -> attack(p), i * 20);
-            }
-            return true;
+            KajetansMod.scheduler.scheduleTask(() -> attack(p), i * 20);
         }
-        return false;
+        return true;
     } 
     
     private void attack(EntityPlayerMP p)
     {
-        if(KajetansMod.playerbank.getData(p).hasData("aoe"))
+        WorldServer w = p.getServerWorld();
+        EffectUtils.spawnParticleCircle(w, p, EnumParticleTypes.FLAME, 5, 12);
+        EffectUtils.spawnParticleCircle(w, p, EnumParticleTypes.FLAME, 4, 12);
+        EffectUtils.spawnParticleCircle(w, p, EnumParticleTypes.FLAME, 3, 12);
+        EffectUtils.spawnParticleCircle(w, p, EnumParticleTypes.FLAME, 2, 12);
+        EffectUtils.spawnParticleCircle(w, p, EnumParticleTypes.FLAME, 1, 12);
+        DamageSource ds = DamageSource.causePlayerDamage(p);
+        EffectUtils.getEntsOfNotGuild(p, 5).stream().forEach((m) -> 
         {
-            WorldServer w = p.getServerWorld();
-            EffectUtils.spawnParticleCircle(w, p, EnumParticleTypes.FLAME, 5, 12);
-            EffectUtils.spawnParticleCircle(w, p, EnumParticleTypes.FLAME, 4, 12);
-            EffectUtils.spawnParticleCircle(w, p, EnumParticleTypes.FLAME, 3, 12);
-            EffectUtils.spawnParticleCircle(w, p, EnumParticleTypes.FLAME, 2, 12);
-            EffectUtils.spawnParticleCircle(w, p, EnumParticleTypes.FLAME, 1, 12);
-            DamageSource ds = DamageSource.causePlayerDamage(p);
-            EffectUtils.getEntsOfNotGuild(p, 5).stream().forEach((m) -> 
-            {
-                m.attackEntityFrom(ds, 2);   
-            });
-        }
+            m.attackEntityFrom(ds, 2);   
+        });
     }
 }

+ 4 - 2
src/main/java/me/km/effects/active/ArmorBoost.java

@@ -1,6 +1,7 @@
 package me.km.effects.active;
 
 import me.km.KajetansMod;
+import me.km.data.EntityData;
 import me.km.effects.ActiveEffectBase;
 import net.minecraft.entity.player.EntityPlayerMP;
 
@@ -9,9 +10,10 @@ public class ArmorBoost extends ActiveEffectBase
     @Override
     protected boolean executeEffect(EntityPlayerMP p, int power) 
     {
-        if(!KajetansMod.playerbank.getData(p).hasData("armorboost"))
+        EntityData data = KajetansMod.data.getOrCreate(p);
+        if(!data.hasArmorBoost())
         {
-            KajetansMod.playerbank.getData(p).addGoodTimedData("armorboost", 1.2f, power * 20, " + 20 % Armor", 200);
+            data.setArmorBoost(power * 20, 1.2f);
             return true;
         }
         return false;

+ 4 - 2
src/main/java/me/km/effects/active/ArmorPasser.java

@@ -1,6 +1,7 @@
 package me.km.effects.active;
 
 import me.km.KajetansMod;
+import me.km.data.EntityData;
 import me.km.effects.ActiveEffectBase;
 import net.minecraft.entity.player.EntityPlayerMP;
 
@@ -9,9 +10,10 @@ public class ArmorPasser extends ActiveEffectBase
     @Override
     protected boolean executeEffect(EntityPlayerMP p, int power) 
     {
-        if(!KajetansMod.playerbank.getData(p).hasData("armorpasser"))
+        EntityData data = KajetansMod.data.getOrCreate(p);
+        if(!data.hasArmorBypass())
         {
-            KajetansMod.playerbank.getData(p).addGoodTimedData("armorpasser", true, power * 40, " + 35% Stich", 64);
+            data.setArmorBypass(power * 40, 0.35f);
             return true;
         }
         return false;

+ 7 - 7
src/main/java/me/km/effects/active/CallBack.java

@@ -3,8 +3,8 @@ package me.km.effects.active;
 import me.km.KajetansMod;
 import me.km.api.Location;
 import me.km.api.Utils;
+import me.km.data.EntityData;
 import me.km.effects.ActiveEffectBase;
-import me.km.playerbank.PlayerData;
 import net.minecraft.entity.player.EntityPlayerMP;
 
 public class CallBack extends ActiveEffectBase
@@ -12,16 +12,16 @@ public class CallBack extends ActiveEffectBase
     @Override
     protected boolean executeEffect(EntityPlayerMP p, int power) 
     {
-        PlayerData data = KajetansMod.playerbank.getData(p);
-        if(data.hasData("callback"))
+        EntityData data = KajetansMod.data.getOrCreate(p);
+        Location loc = data.getCallBack();
+        if(loc != null)
         {
             p.fallDistance = 0;
-            Utils.teleportEntity(p, data.getData("callback", Location.class));
-            data.removeData("callback");
+            Utils.teleportEntity(p, loc);
+            data.setCallBack(0, null);
             return true;
         }
-        Location l = new Location(p);
-        data.addGoodTimedData("callback", l, 100 * power, "R: §r" + ((int) p.posX) + "§7:§r" + ((int) p.posY) + "§7:§r" + ((int) p.posZ), 51);
+        data.setCallBack(100 * power, new Location(p));
         return true;
     }
 }

+ 1 - 1
src/main/java/me/km/effects/active/ClusterBomb.java

@@ -14,7 +14,7 @@ public class ClusterBomb extends ActiveEffectBase
         EntityArrow arrow = EffectUtils.launchProjectile(p, EntityArrow.class, power / 4f, null);
         arrow.setDamage(0.1);
         arrow.pickupStatus = EntityArrow.PickupStatus.DISALLOWED;
-        KajetansMod.effects.addEntityData(p, "clusterbomb", power);
+        KajetansMod.data.getOrCreate(arrow).setClusterBomb(power);
         return true;
     }
 }

+ 4 - 2
src/main/java/me/km/effects/active/ConstantPower.java

@@ -1,6 +1,7 @@
 package me.km.effects.active;
 
 import me.km.KajetansMod;
+import me.km.data.EntityData;
 import me.km.effects.ActiveEffectBase;
 import net.minecraft.entity.player.EntityPlayerMP;
 
@@ -9,9 +10,10 @@ public class ConstantPower extends ActiveEffectBase
     @Override
     protected boolean executeEffect(EntityPlayerMP p, int power) 
     {
-        if(!KajetansMod.playerbank.getData(p).hasData("cpower"))
+        EntityData data = KajetansMod.data.getOrCreate(p);
+        if(!data.hasAttackBoost())
         {
-            KajetansMod.playerbank.getData(p).addGoodTimedData("cpower", 1.3d, power * 20, " + 30 % Schaden", 62);
+            data.setAttackBoost(power * 20, 1.3f);
             return true;
         }
         return false;

+ 1 - 1
src/main/java/me/km/effects/active/Doomed.java

@@ -19,7 +19,7 @@ public class Doomed extends ActiveEffectBase
         }
         EffectUtils.jumpTo(p, p2);
         int duration = 20 * power;
-        KajetansMod.playerbank.getData(p2).addBadTimedData("doomed", p, duration, "Todgeweiht", 52);
+        KajetansMod.data.getOrCreate(p2).setDoomed(power);
         KajetansMod.scheduler.scheduleTask(() -> 
         {
             p2.attackEntityFrom(DamageSource.causePlayerDamage(p), power);

+ 4 - 2
src/main/java/me/km/effects/active/DragonSkin.java

@@ -1,6 +1,7 @@
 package me.km.effects.active;
 
 import me.km.KajetansMod;
+import me.km.data.EntityData;
 import me.km.effects.ActiveEffectBase;
 import net.minecraft.entity.player.EntityPlayerMP;
 
@@ -9,9 +10,10 @@ public class DragonSkin extends ActiveEffectBase
     @Override
     protected boolean executeEffect(EntityPlayerMP p, int power) 
     {
-        if(!KajetansMod.playerbank.getData(p).hasData("dragonskin"))
+        EntityData data = KajetansMod.data.getOrCreate(p);
+        if(!data.hasArrowImmunity())
         {
-            KajetansMod.playerbank.getData(p).addGoodTimedData("dragonskin", true, power * 20, "Dragon Skin", 202);
+            data.setArrowImmunity(power * 20);
             return true;
         }
         return false;

+ 4 - 2
src/main/java/me/km/effects/active/FallImmunity.java

@@ -1,6 +1,7 @@
 package me.km.effects.active;
 
 import me.km.KajetansMod;
+import me.km.data.EntityData;
 import me.km.effects.ActiveEffectBase;
 import net.minecraft.entity.player.EntityPlayerMP;
 
@@ -9,9 +10,10 @@ public class FallImmunity extends ActiveEffectBase
     @Override
     protected boolean executeEffect(EntityPlayerMP p, int power) 
     {
-        if(!KajetansMod.playerbank.getData(p).hasData("fallimmunity"))
+        EntityData data = KajetansMod.data.getOrCreate(p);
+        if(!data.hasFallImmunity())
         {
-            KajetansMod.playerbank.getData(p).addGoodTimedData("fallimmunity", 0, 40 * power, "Fallschaden", 53);
+            data.setFallImmunity(power * 40);
             return true;
         }
         return true;

+ 4 - 2
src/main/java/me/km/effects/active/GrapplingHook.java

@@ -1,6 +1,7 @@
 package me.km.effects.active;
 
 import me.km.KajetansMod;
+import me.km.data.EntityData;
 import me.km.effects.ActiveEffectBase;
 import net.minecraft.entity.player.EntityPlayerMP;
 
@@ -9,9 +10,10 @@ public class GrapplingHook extends ActiveEffectBase
     @Override
     protected boolean executeEffect(EntityPlayerMP p, int power) 
     {
-        if(!KajetansMod.playerbank.getData(p).hasData("grapplinghook"))
+        EntityData data = KajetansMod.data.getOrCreate(p);
+        if(!data.hasArrowHook())
         {
-            KajetansMod.playerbank.getData(p).addGoodData("grapplinghook", 0, "Pfeilhaken", 54);
+            data.setArrowHook(true);
             return true;
         }
         return false;

+ 5 - 14
src/main/java/me/km/effects/active/Gravity.java

@@ -1,8 +1,8 @@
 package me.km.effects.active;
 
 import me.km.KajetansMod;
+import me.km.data.EntityData;
 import me.km.effects.ActiveEffectBase;
-import me.km.playerbank.PlayerData;
 import net.minecraft.entity.player.EntityPlayerMP;
 
 public class Gravity extends ActiveEffectBase
@@ -10,22 +10,13 @@ public class Gravity extends ActiveEffectBase
     @Override
     protected boolean executeEffect(EntityPlayerMP p, int power) 
     {
-        PlayerData data = KajetansMod.playerbank.getData(p);
-        Integer id = data.getData("gravity", Integer.class);
-        if(id != null)
+        EntityData data = KajetansMod.data.get(p);
+        if(data.hasGravity())
         {
-            KajetansMod.scheduler.cancelTask(id);
-            p.setNoGravity(false);
-            data.removeData("gravity");
+            data.setGravity(0);
             return true;
         }
-        power *= 100;
-        p.setNoGravity(true);
-        int cancel = KajetansMod.scheduler.scheduleTask(() -> 
-        {
-            p.setNoGravity(false);
-        }, power);
-        data.addGoodTimedData("gravity", cancel, power, "Schwerelos", 59);
+        data.setGravity(power * 100);
         return true;
     }
 }

+ 1 - 1
src/main/java/me/km/effects/active/Harvest.java

@@ -34,7 +34,7 @@ public class Harvest extends ActiveEffectBase
                 }
             }
         }
-        KajetansMod.effects.send(p, "Die Pflanzen in deiner Umgebung wurden geerntet!");
+        KajetansMod.skills.send(p, "Die Pflanzen in deiner Umgebung wurden geerntet!");
         return true;
     }
 }

+ 4 - 2
src/main/java/me/km/effects/active/Ignorance.java

@@ -1,6 +1,7 @@
 package me.km.effects.active;
 
 import me.km.KajetansMod;
+import me.km.data.EntityData;
 import me.km.effects.ActiveEffectBase;
 import net.minecraft.entity.player.EntityPlayerMP;
 
@@ -9,9 +10,10 @@ public class Ignorance extends ActiveEffectBase
     @Override
     protected boolean executeEffect(EntityPlayerMP p, int power) 
     {
-        if(!KajetansMod.playerbank.getData(p).hasData("ignorance"))
+        EntityData data = KajetansMod.data.getOrCreate(p);
+        if(!data.hasIgnorance())
         {
-            KajetansMod.playerbank.getData(p).addGoodTimedData("ignorance", true, power * 60, "Ignorance", 204);
+            data.setIgnorance(power * 60);
             return true;
         }
         return false;

+ 4 - 3
src/main/java/me/km/effects/active/ImpactPunch.java

@@ -1,6 +1,7 @@
 package me.km.effects.active;
 
 import me.km.KajetansMod;
+import me.km.data.EntityData;
 import me.km.effects.ActiveEffectBase;
 import net.minecraft.entity.player.EntityPlayerMP;
 
@@ -9,10 +10,10 @@ public class ImpactPunch extends ActiveEffectBase
     @Override
     protected boolean executeEffect(EntityPlayerMP p, int power) 
     {
-        if(!KajetansMod.playerbank.getData(p).hasData("impactpunch"))
+        EntityData data = KajetansMod.data.getOrCreate(p);
+        if(!data.hasImpactPunch())
         {
-            double d = power / 10d;
-            KajetansMod.playerbank.getData(p).addGoodData("impactpunch", d + 1, " + " + (d * 100) + "% Schaden", 60);
+            data.setImpactPunch(1 + power / 10f);
             return true;
         }
         return false;

+ 5 - 9
src/main/java/me/km/effects/active/LifeSteal.java

@@ -2,6 +2,7 @@ package me.km.effects.active;
 
 import me.km.KajetansMod;
 import me.km.api.Utils;
+import me.km.data.EntityData;
 import me.km.effects.ActiveEffectBase;
 import net.minecraft.entity.EntityLivingBase;
 import net.minecraft.entity.player.EntityPlayerMP;
@@ -17,15 +18,10 @@ public class LifeSteal extends ActiveEffectBase
         {
             return false;
         }
-        DamageSource ds = DamageSource.causePlayerDamage(p);
-        float real = Utils.getRealDamage(liv, ds, power);
-        liv.attackEntityFrom(ds, power);
-        p.heal(real);
-        if(liv instanceof EntityPlayerMP)
-        {
-            KajetansMod.playerbank.getData((EntityPlayerMP) liv)
-                    .addBadTimedData("lessheal", true, 100, " - 50% Heilung", 63);
-        }
+        EntityData data = KajetansMod.data.getOrCreate(liv);
+        data.setLessHeal(100, 0.5f);
+        data.setHealByDamageEntity(p);
+        liv.attackEntityFrom(DamageSource.causePlayerDamage(p), power);
         return true;
     }
 }

+ 1 - 1
src/main/java/me/km/effects/active/NailTrap.java

@@ -13,7 +13,7 @@ public class NailTrap extends ActiveEffectBase
     {
         Location l = new Location(p);
         l.round();
-        KajetansMod.effects.getEvent(TrapEffects.class).addNailTraps(l, KajetansMod.playerbank.getGuildId(p));
+        KajetansMod.skills.getEvent(TrapEffects.class).addNailTraps(l, KajetansMod.playerbank.getGuildId(p));
         KajetansMod.skills.send(p, "Du hast 9 Trittnagelfallen platziert.");
         return true;
     }

+ 1 - 1
src/main/java/me/km/effects/active/NetTrap.java

@@ -13,7 +13,7 @@ public class NetTrap extends ActiveEffectBase
     {
         Location l = new Location(p);
         l.round();
-        KajetansMod.effects.getEvent(TrapEffects.class).addNetTrap(l, KajetansMod.playerbank.getGuildId(p));
+        KajetansMod.skills.getEvent(TrapEffects.class).addNetTrap(l, KajetansMod.playerbank.getGuildId(p));
         KajetansMod.skills.send(p, "Du hast eine Netzfalle platziert.");
         return true;
     }

+ 4 - 2
src/main/java/me/km/effects/active/PoisonedBlade.java

@@ -1,6 +1,7 @@
 package me.km.effects.active;
 
 import me.km.KajetansMod;
+import me.km.data.EntityData;
 import me.km.effects.ActiveEffectBase;
 import net.minecraft.entity.player.EntityPlayerMP;
 
@@ -9,9 +10,10 @@ public class PoisonedBlade extends ActiveEffectBase
     @Override
     protected boolean executeEffect(EntityPlayerMP p, int power) 
     {
-        if(!KajetansMod.playerbank.getData(p).hasData("poisonedblade"))
+        EntityData data = KajetansMod.data.getOrCreate(p);
+        if(!data.hasPoisonBlade())
         {
-            KajetansMod.playerbank.getData(p).addGoodTimedData("poisonedblade", 0, 60 * power, "Gift", 55);
+            data.setPoisonBlade(60 * power);
             return true;
         }
         return true;

+ 4 - 3
src/main/java/me/km/effects/active/PowerAttack.java

@@ -1,6 +1,7 @@
 package me.km.effects.active;
 
 import me.km.KajetansMod;
+import me.km.data.EntityData;
 import me.km.effects.ActiveEffectBase;
 import net.minecraft.entity.player.EntityPlayerMP;
 
@@ -9,10 +10,10 @@ public class PowerAttack extends ActiveEffectBase
     @Override
     protected boolean executeEffect(EntityPlayerMP p, int power) 
     {
-        if(!KajetansMod.playerbank.getData(p).hasData("powerattack"))
+        EntityData data = KajetansMod.data.getOrCreate(p);
+        if(!data.hasPowerAttack())
         {
-            double d = power / 20d;
-            KajetansMod.playerbank.getData(p).addGoodData("powerattack", d + 1, " + " + (d * 100) + "% Schaden", 56);
+            data.setPowerAttack(1 + power / 20f);
             return true;
         }
         return false;

+ 1 - 1
src/main/java/me/km/effects/active/RapidFire.java

@@ -22,7 +22,7 @@ public class RapidFire extends ActiveEffectBase
     private void shoot(EntityPlayerMP p, int power)
     {
         EntityArrow arrow = EffectUtils.launchProjectile(p, EntityArrow.class, power / 4f, p);
-        KajetansMod.effects.addEntityData(p, "rapidfire");
+        KajetansMod.data.getOrCreate(arrow).setOnHitHealEntity(p);
         arrow.pickupStatus = EntityArrow.PickupStatus.DISALLOWED;
     }
 }

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

@@ -3,6 +3,7 @@ package me.km.effects.active;
 import me.km.KajetansMod;
 import me.km.effects.ActiveEffectBase;
 import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.init.MobEffects;
 
 public class Shadow extends ActiveEffectBase
 {  
@@ -11,11 +12,14 @@ public class Shadow extends ActiveEffectBase
     {
         int duration = power * 80;
         p.setInvisible(true);
-        KajetansMod.playerbank.getData(p).addGoodTimedData("shadow", 0, duration, "Schatten", 57);
+        KajetansMod.data.getOrCreate(p).setShadow(duration);
         KajetansMod.scheduler.scheduleTask(() -> 
         {
-            p.setInvisible(false);
-        }, duration);
+            if(!p.isPotionActive(MobEffects.INVISIBILITY))
+            {
+                p.setInvisible(false);
+            }
+        }, duration + 2);
         return true;
     }
 }

+ 4 - 2
src/main/java/me/km/effects/active/ShadowHit.java

@@ -1,6 +1,7 @@
 package me.km.effects.active;
 
 import me.km.KajetansMod;
+import me.km.data.EntityData;
 import me.km.effects.ActiveEffectBase;
 import net.minecraft.entity.player.EntityPlayerMP;
 
@@ -9,9 +10,10 @@ public class ShadowHit extends ActiveEffectBase
     @Override
     protected boolean executeEffect(EntityPlayerMP p, int power) 
     {
-        if(!KajetansMod.playerbank.getData(p).hasData("shadowhit"))
+        EntityData data = KajetansMod.data.getOrCreate(p);
+        if(!data.hasShadowHit())
         {
-            KajetansMod.playerbank.getData(p).addGoodData("shadowhit", 0, "Schattenhieb", 58);
+            data.setShadowHit(true);
             return true;
         }
         return false;

+ 13 - 13
src/main/java/me/km/effects/active/Shield.java

@@ -1,7 +1,7 @@
 package me.km.effects.active;
 
 import me.km.KajetansMod;
-import me.km.api.GlobalText;
+import me.km.data.EntityData;
 import me.km.effects.ActiveEffectBase;
 import me.km.effects.EffectUtils;
 import net.minecraft.entity.player.EntityPlayerMP;
@@ -11,20 +11,20 @@ public class Shield extends ActiveEffectBase
     @Override
     protected boolean executeEffect(EntityPlayerMP p, int power) 
     {
-        if(!KajetansMod.playerbank.getData(p).hasData("armorboost"))
+        EntityData data = KajetansMod.data.getOrCreate(p);
+        if(!data.hasArmorBoost())
         {
-            KajetansMod.playerbank.getData(p).addGoodTimedData("armorboost", 1.4f, 200, " + 40 % Armor", 200);
-        }
-        try
-        {
-            EffectUtils.getPlayersOfGuild(p, power + 2).stream()
-                    .filter(pl -> !KajetansMod.playerbank.getData((EntityPlayerMP) pl).hasData("armorboost"))
-                    .forEach(pl -> KajetansMod.playerbank.getData((EntityPlayerMP) pl).addGoodTimedData("armorboost", 1.4f, 200, " + 40 % Armor", 200));
-        }
-        catch(ClassCastException ex)
-        {
-            System.out.println(GlobalText.shouldNotHappen());
+            data.setArmorBoost(200, 1.4f);
         }
+        EffectUtils.getPlayersOfGuild(p, power + 2).stream()
+                .forEach(pl -> 
+                {
+                    EntityData dataPlayer = KajetansMod.data.getOrCreate(pl);
+                    if(!dataPlayer.hasArmorBoost())
+                    {
+                        dataPlayer.setArmorBoost(200, 1.4f);
+                    }
+                });
         return true;
     }
 }

+ 1 - 5
src/main/java/me/km/effects/active/Silence.java

@@ -15,11 +15,7 @@ public class Silence extends ActiveEffectBase
         {
             return false;
         }
-        if(KajetansMod.playerbank.getData(affectedPlayer).hasData("ignorance"))
-        {
-            return true;
-        }
-        KajetansMod.playerbank.getData(affectedPlayer).addBadTimedData("silence", 0, 60 * power, "Silence", 50);
+        KajetansMod.data.getOrCreate(affectedPlayer).setSilenceTime(60 * power);
         return true;
     }
 }

+ 1 - 1
src/main/java/me/km/effects/active/SilencePunch.java

@@ -19,7 +19,7 @@ public class SilencePunch extends ActiveEffectBase
         }
         power *= 20;
         EffectUtils.addPotionTo(p, MobEffects.NAUSEA, power, 0);
-        KajetansMod.playerbank.getData(affectedPlayer).addBadTimedData("silence", 0, power, "Silence", 50);
+        KajetansMod.data.getOrCreate(affectedPlayer).setSilenceTime(power);
         return true;
     }
 }

+ 1 - 1
src/main/java/me/km/effects/active/SmokeBomb.java

@@ -12,7 +12,7 @@ public class SmokeBomb extends ActiveEffectBase
     protected boolean executeEffect(EntityPlayerMP p, int power) 
     {
         EntitySnowball ball = EffectUtils.launchProjectile(p, EntitySnowball.class, power / 4f, p);
-        KajetansMod.effects.addEntityData(ball, "smokebomb");
+        KajetansMod.data.getOrCreate(p).setSmokeBomb(true);
         return false;
     }
 }

+ 1 - 1
src/main/java/me/km/effects/active/TeleportBlock.java

@@ -25,7 +25,7 @@ public class TeleportBlock extends ActiveEffectBase
                 }
                 if(w.isAirBlock(b.add(x, 0, y)))
                 {
-                    KajetansMod.effects.getEvent(BlockClickEffects.class).registerTeleportBlock(new Location(w, b.add(x, 0, y)), p, 60 * power);
+                    KajetansMod.skills.getEvent(BlockClickEffects.class).registerTeleportBlock(new Location(w, b.add(x, 0, y)), p, 60 * power);
                     return true;
                 }
             }

+ 4 - 2
src/main/java/me/km/effects/active/Thorns.java

@@ -1,6 +1,7 @@
 package me.km.effects.active;
 
 import me.km.KajetansMod;
+import me.km.data.EntityData;
 import me.km.effects.ActiveEffectBase;
 import net.minecraft.entity.player.EntityPlayerMP;
 
@@ -9,9 +10,10 @@ public class Thorns extends ActiveEffectBase
     @Override
     protected boolean executeEffect(EntityPlayerMP p, int power) 
     {
-        if(!KajetansMod.playerbank.getData(p).hasData("thorns"))
+        EntityData data = KajetansMod.data.getOrCreate(p);
+        if(!data.hasReflection())
         {
-            KajetansMod.playerbank.getData(p).addGoodTimedData("thorns", 0.3f, power * 20, "30% Thorns", 203);
+            data.setReflection(power * 20, 0.3f);
             return true;
         }
         return false;

+ 1 - 1
src/main/java/me/km/effects/active/VineTrap.java

@@ -17,7 +17,7 @@ public class VineTrap extends ActiveEffectBase
     {
         int i = KajetansMod.playerbank.getGuildId(p);
         
-        TrapEffects e = KajetansMod.effects.getEvent(TrapEffects.class);
+        TrapEffects e = KajetansMod.skills.getEvent(TrapEffects.class);
         BlockPos l = Utils.getPlayerTarget(p, power + 7).add(0, 1, 0);
         
         World w = p.world;

+ 1 - 1
src/main/java/me/km/effects/active/WarCall.java

@@ -19,7 +19,7 @@ public class WarCall extends ActiveEffectBase
             EffectUtils.getPlayersOfGuild(p, power + 2).forEach(pl -> 
             {
                 EffectUtils.addPotionTo(p, MobEffects.FIRE_RESISTANCE, 300, 0);
-                KajetansMod.playerbank.getData((EntityPlayerMP) pl).addGoodTimedData("magicarmorboost", 1.2f, 300, " + 20 % Magic Armor", 201);
+                KajetansMod.data.getOrCreate(pl).setMagicArmorBoost(300, 1.2f);
             });
         }
         catch(ClassCastException ex)

+ 16 - 15
src/main/java/me/km/effects/passive/ArrowEffects.java

@@ -5,6 +5,7 @@ import me.km.api.Location;
 import me.km.api.Module;
 import me.km.api.ModuleListener;
 import me.km.api.Utils;
+import me.km.data.EntityData;
 import me.km.effects.Effect;
 import me.km.effects.EffectBlockChanger;
 import me.km.effects.EffectUtils;
@@ -63,21 +64,21 @@ public class ArrowEffects extends ModuleListener
     @SubscribeEvent(receiveCanceled = false, priority = EventPriority.LOW)
     public void handleHurtShots(LivingHurtEvent e)
     {        
-        EntityLivingBase ent = e.getEntityLiving();
-        if(!KajetansMod.worldManager.getWorldPreferences(ent.world).skills)
+        EntityLivingBase liv = e.getEntityLiving();
+        if(!KajetansMod.worldManager.getWorldPreferences(liv.world).skills)
         {
             return;
         }
-        EntityPlayer p = Utils.getDamager(e.getSource());
-        if(p != null)
+        EntityData data = KajetansMod.data.get(e.getSource().getImmediateSource());
+        if(data != null)
         {
-            if(KajetansMod.effects.getEntityData(ent, "arcaneshot") != null)
+            if(data.hasTeleportEntity())
             {
-                Utils.teleportEntity(ent, p);
+                Utils.teleportEntity(liv, data.getTeleportEntity());
             }
-            else if(KajetansMod.effects.getEntityData(ent, "rapidfire") != null)
+            if(data.hasOnHitHealEntity())
             {
-                p.heal(2);
+                data.getOnHitHealEntity().heal(2);
             }
         }
     }
@@ -91,7 +92,7 @@ public class ArrowEffects extends ModuleListener
             return;
         }
         Entity ent = e.getSource().getImmediateSource();
-        if(ent instanceof EntityArrow && KajetansMod.playerbank.getData((EntityPlayerMP) liv).hasData("dragonskin"))
+        if(ent instanceof EntityArrow && KajetansMod.data.get(liv).hasArrowImmunity())
         {
             e.setCanceled(true);
             Utils.scaleVelocity(ent, -0.1);
@@ -107,11 +108,11 @@ public class ArrowEffects extends ModuleListener
         }
         EntityPlayerMP p = (EntityPlayerMP) player;
         WorldServer w = p.getServerWorld();
-        Integer fromList = (Integer) KajetansMod.effects.getEntityData(p, "clusterbomb");
-        if(fromList != null)
+        int clusterPower = KajetansMod.data.get(arrow).getClusterPower();
+        if(clusterPower > 0)
         {
-            int power = fromList * 600;
-            int damage = fromList * 3;
+            int power = clusterPower * 600;
+            int damage = clusterPower * 3;
             EffectUtils.spawnParticle(w, EnumParticleTypes.EXPLOSION_LARGE, arrow, 1);
             EffectUtils.spawnParticleCircle(w, arrow, EnumParticleTypes.EXPLOSION_LARGE, 3, 9);
             DamageSource ds = DamageSource.causePlayerDamage(p);
@@ -122,7 +123,7 @@ public class ArrowEffects extends ModuleListener
             });
             arrow.setDead();
         }
-        else if(KajetansMod.effects.getEntityData(p, "grapplinghook") != null)
+        else if(KajetansMod.data.get(p).hasArrowHook())
         {
             EffectBlockChanger list = new EffectBlockChanger(w);
             BlockPos pos = arrow.getPosition();
@@ -163,7 +164,7 @@ public class ArrowEffects extends ModuleListener
     {       
         EntityThrowable pro = e.getEntityThrowable();
         if(!(pro instanceof EntitySnowball) || !(pro.getThrower() instanceof EntityPlayerMP) ||
-            KajetansMod.effects.getEntityData(pro, "smokebomb") == null || 
+            !KajetansMod.data.get(pro).isSmokeBomb() || 
             !KajetansMod.worldManager.getWorldPreferences(pro.world).skills)
         {
             return;

+ 19 - 6
src/main/java/me/km/effects/passive/BlockBreakEffects.java

@@ -10,6 +10,7 @@ import me.km.utils.ItemStackBuilder;
 import net.minecraft.block.Block;
 import net.minecraft.block.BlockCrops;
 import net.minecraft.block.BlockFalling;
+import net.minecraft.block.material.Material;
 import net.minecraft.block.state.IBlockState;
 import net.minecraft.enchantment.EnchantmentHelper;
 import net.minecraft.entity.player.EntityPlayer;
@@ -130,15 +131,27 @@ public class BlockBreakEffects extends ModuleListener
     public void onBlockDamage(PlayerEvent.BreakSpeed e)
     {       
         EntityPlayer p = e.getEntityPlayer();
-        if(KajetansMod.worldManager.getWorldPreferences(p.world).skills &&
-            KajetansMod.jobs.isPreferedMaterial(p, e.getState().getBlock()))
+        if(KajetansMod.worldManager.getWorldPreferences(p.world).skills)
         {
-            // Speed up with prefered blocks of current job
-            int digging = EffectUtils.getEffectLevel(p, Effect.FAST_DIGGING);
-            if(digging >= 1)
+            float speed = e.getOriginalSpeed();
+            
+            if(KajetansMod.jobs.isPreferedMaterial(p, e.getState().getBlock()))
             {
-                e.setNewSpeed(e.getOriginalSpeed() * (1 + (digging / 5)));
+                // Speed up with prefered blocks of current job
+                int digging = EffectUtils.getEffectLevel(p, Effect.FAST_DIGGING);
+                if(digging >= 1)
+                {
+                    speed *= (1 + (digging / 5));
+                }
+            }
+            
+            if(p.isInsideOfMaterial(Material.WATER) && !EnchantmentHelper.getAquaAffinityModifier(p) &&
+                    KajetansMod.data.get(p).hasAquaAffinity())
+            {
+                speed *= 2;
             }
+            
+            e.setNewSpeed(speed);
         }
     }
 }

+ 101 - 89
src/main/java/me/km/effects/passive/EntityDamageEffects.java

@@ -5,10 +5,10 @@ import me.km.api.Module;
 import me.km.api.ModuleListener;
 import me.km.api.Utils;
 import me.km.capabilities.DamageUtils;
+import me.km.data.EntityData;
 import me.km.effects.Effect;
 import me.km.effects.EffectUtils;
 import me.km.events.PlayerHurtEvent;
-import me.km.playerbank.PlayerData;
 import me.km.utils.ReflectionUtils;
 import net.minecraft.entity.Entity;
 import net.minecraft.entity.EntityLivingBase;
@@ -47,22 +47,21 @@ public class EntityDamageEffects extends ModuleListener
             e.setAmount(e.getAmount() / (reducer + 1));
         }
         
-        PlayerData data = KajetansMod.playerbank.getData(p);
-        if(data.hasData("shadow"))
+        EntityData data = KajetansMod.data.get(p);
+        if(data.isShadow())
         {
             p.setInvisible(false);
-            data.removeData("shadow");
+            data.setShadow(0);
         } 
         
-        DamageSource cause = e.getSource();
-        
+        DamageSource cause = e.getSource();       
         if(cause.isMagicDamage() && EffectUtils.getEffectLevel(p, Effect.NO_POISON) >= 1)
         {
             e.setCanceled(true);
         } 
         else if(cause == DamageSource.FALL)
         {
-            if(data.hasData("fallimmunity"))
+            if(data.hasFallImmunity())
             {
                 e.setCanceled(true);
                 return;
@@ -122,126 +121,140 @@ public class EntityDamageEffects extends ModuleListener
         }
         
         EntityLivingBase ent = e.getEntityLiving();
-        PlayerData data = KajetansMod.playerbank.getData(p);
-
-        if(data.removeData("shadowhit"))
+        
+        EntityData data = KajetansMod.data.get(p);
+        if(data.hasShadowHit())
         {
+            data.setShadowHit(false);
             EffectUtils.addPotionTo(p, MobEffects.SPEED, 40, 1);
             EffectUtils.addPotionTo(p, MobEffects.INVISIBILITY, 40, 0);
         }
         
-        if(ent instanceof EntityPlayerMP)
+        EntityData victimData = KajetansMod.data.get(ent);
+        if(victimData.isDoomed() && !p.equals(ent))
         {
-            EntityPlayerMP victim = (EntityPlayerMP) ent;
-            EntityPlayer damager = KajetansMod.playerbank.getData(victim).getData("doomed", EntityPlayer.class);
-            if(damager != null && damager.equals(p))
-            {
-                damageBonus *= 1.2f;
-            }
+            damageBonus *= 1.2f;
         }
         
-        if(data.hasData("poisonedblade"))
+        if(data.hasPoisonBlade())
         {
             EffectUtils.addPotionTo(ent, MobEffects.POISON, 80, 1);
         }
         
-        if(data.hasData("armorpasser"))
-        {
-            float reduced = e.getAmount() - Utils.getDamagerAfterArmor(ent, e.getSource(), e.getAmount());
-            e.setAmount(e.getAmount() + reduced * 0.35f);
-        }
-        
-        double powerAttack = data.getDouble("powerattack");
-        if(powerAttack != 0)
+        double powerAttack = data.getPowerAttack();
+        if(powerAttack > 0)
         {
             damageBonus *= powerAttack;
-            data.removeData("powerattack");
+            data.setPowerAttack(0);
         }
-        powerAttack = data.getDouble("cpower");
-        if(powerAttack != 0)
+        
+        powerAttack = data.getAttackBoost();
+        if(powerAttack > 0)
         {
             damageBonus *= powerAttack;
         }
-        powerAttack = data.getDouble("impactpunch");
-        if(powerAttack != 0)
+        
+        powerAttack = data.getImpactPunch();
+        if(powerAttack > 0)
         {
             damageBonus *= powerAttack;
             EffectUtils.addPotionTo(ent, MobEffects.SLOWNESS, (int) (powerAttack * 20), 1);
-            data.removeData("impactpunch");
+            data.setImpactPunch(0);
         }
         
         e.setAmount(e.getAmount() * damageBonus);
     }
     
-    @SubscribeEvent(priority = EventPriority.LOWEST)
-    public void newDamageSystem(LivingHurtEvent e)
-    {         
-        // ---------------------------------------------------------------------
-        // injection of new damage system
-        // ---------------------------------------------------------------------
-        if(!e.isCanceled())
+    private float getRealDamage(float damageAmount, DamageSource ds, EntityLivingBase liv)
+    {
+        if(ds != DamageSource.LAVA && ds != DamageSource.IN_WALL && ds != DamageSource.CRAMMING && ds != DamageSource.DROWN)
         {
-            e.setCanceled(true);
-
-            float damageAmount = e.getAmount();
-            DamageSource ds = e.getSource();
-            EntityLivingBase liv = e.getEntityLiving();
-
-            if(ds != DamageSource.LAVA && ds != DamageSource.IN_WALL && ds != DamageSource.CRAMMING && ds != DamageSource.DROWN)
+            EntityData data = KajetansMod.data.get(liv);
+            EntityData attackerData = KajetansMod.data.get(ds.getImmediateSource());
+            
+            if(ds.isMagicDamage() && !ds.isDamageAbsolute()) // Magic Damage
             {
-                if(ds.isMagicDamage() && !ds.isDamageAbsolute())
+                ReflectionUtils.damageArmor(liv, damageAmount);
+                int armor = DamageUtils.getMagicDefense(liv);
+                if(data.isPlayerData())
                 {
-                    ReflectionUtils.damageArmor(liv, damageAmount);
-                    int armor = DamageUtils.getMagicDefense(liv);
-                    if(liv instanceof EntityPlayerMP)
+                    float f = data.getMagicArmorBoost();
+                    if(f != 0)
                     {
-                        Float f = KajetansMod.playerbank.getData((EntityPlayerMP) liv).getData("magicarmorboost", Float.class);
-                        if(f != null)
-                        {
-                            armor = Math.round(armor * f);
-                        }
+                        armor = Math.round(armor * f);
                     }
-                    damageAmount = CombatRules.getDamageAfterAbsorb(damageAmount, armor, 0);
                 }
-                else
+                damageAmount = CombatRules.getDamageAfterAbsorb(damageAmount, armor, 0);
+            }
+            else
+            {
+                if(!ds.isUnblockable())
                 {
-                    if(!ds.isUnblockable())
+                    ReflectionUtils.damageArmor(liv, damageAmount);
+                    int armor = liv.getTotalArmorValue();
+                    if(data.isPlayerData())
                     {
-                        ReflectionUtils.damageArmor(liv, damageAmount);
-                        int armor = liv.getTotalArmorValue();
-                        Float thorns = null;
-                        if(liv instanceof EntityPlayerMP)
+                        float f = data.getArmorBoost();
+                        if(f != 0)
                         {
-                            Float f = KajetansMod.playerbank.getData((EntityPlayerMP) liv).getData("armorboost", Float.class);
-                            thorns = KajetansMod.playerbank.getData((EntityPlayerMP) liv).getData("thorns", Float.class);
-                            if(f != null)
-                            {
-                                armor = Math.round(armor * f);
-                            }
+                            armor = Math.round(armor * f);
                         }
-                        damageAmount = CombatRules.getDamageAfterAbsorb(damageAmount, armor, 
-                                (float) liv.getEntityAttribute(SharedMonsterAttributes.ARMOR_TOUGHNESS).getAttributeValue());
-                        // physical damage - doing thorns here
-                        if(thorns != null)
+                    }
+                    float oldDamageAmount = damageAmount;
+                    damageAmount = CombatRules.getDamageAfterAbsorb(damageAmount, armor, 
+                            (float) liv.getEntityAttribute(SharedMonsterAttributes.ARMOR_TOUGHNESS).getAttributeValue());
+                    
+                    oldDamageAmount -= damageAmount;
+                    
+                    // armor passing with difference
+                    if(oldDamageAmount > 0 && attackerData.hasArmorBypass())
+                    {
+                        damageAmount += oldDamageAmount * attackerData.getArmorBypass();
+                    }
+                    // physical damage - doing reflection here
+                    if(data.hasReflection() && data.isPlayerData())
+                    {
+                        Entity ent = ds.getImmediateSource();
+                        if(ent != null)
                         {
-                            Entity ent = ds.getImmediateSource();
-                            if(ent != null)
-                            {
-                                DamageSource reflect = DamageSource.causePlayerDamage((EntityPlayerMP) liv);
-                                reflect.setMagicDamage();
-                                ent.attackEntityFrom(reflect, thorns * damageAmount);
-                            }
+                            DamageSource reflect = DamageSource.causePlayerDamage((EntityPlayerMP) liv);
+                            reflect.setMagicDamage();
+                            ent.attackEntityFrom(reflect, data.getReflection() * damageAmount);
                         }
-                        // end of thorns
                     }
-                }           
-                damageAmount = ReflectionUtils.applyPotionDamageCalculations(liv, ds, damageAmount);
-            }
-            else
+                    // end of reflection
+                }
+            }           
+            damageAmount = ReflectionUtils.applyPotionDamageCalculations(liv, ds, damageAmount);
+            
+            // heal by dealed damage
+            if(data.hasHealByDamageEntity())
             {
-                damageAmount = liv.getMaxHealth() / 10;
+                data.getHealByDamageEntity().heal(damageAmount);
+                data.setHealByDamageEntity(null);
             }
+        }
+        else
+        {
+            damageAmount = liv.getMaxHealth() / 10;
+        }
+        return damageAmount;
+    }
+    
+    @SubscribeEvent(priority = EventPriority.LOWEST)
+    public void newDamageSystem(LivingHurtEvent e)
+    {         
+        // ---------------------------------------------------------------------
+        // injection of new damage system
+        // ---------------------------------------------------------------------
+        if(!e.isCanceled())
+        {
+            e.setCanceled(true);
+
+            DamageSource ds = e.getSource();
+            EntityLivingBase liv = e.getEntityLiving();
 
+            float damageAmount = getRealDamage(e.getAmount(), ds, liv);
             float f = damageAmount;
             damageAmount = Math.max(damageAmount - liv.getAbsorptionAmount(), 0.0F);
             liv.setAbsorptionAmount(liv.getAbsorptionAmount() - (f - damageAmount));
@@ -301,11 +314,10 @@ public class EntityDamageEffects extends ModuleListener
         {
             return;
         } 
-        EntityPlayerMP p = (EntityPlayerMP) ent;
-        PlayerData data = KajetansMod.playerbank.getData(p);
-        if(data.hasData("lessheal"))
+        float f = KajetansMod.data.get(ent).getLessHeal();
+        if(f > 0)
         {
-            e.setAmount(e.getAmount() / 2);
+            e.setAmount(e.getAmount() * f);
         }
     }
 }

+ 17 - 11
src/main/java/me/km/events/CustomEventCaller.java

@@ -20,11 +20,14 @@ public class CustomEventCaller
     @SubscribeEvent
     public void onPlayerMove(TickEvent.PlayerTickEvent e)
     {      
-        EntityPlayer p = e.player;
-        if(p.lastTickPosX != p.posX || p.lastTickPosY != p.posY || p.lastTickPosZ != p.posZ)
+        if(e.phase == TickEvent.Phase.END)
         {
-            MinecraftForge.EVENT_BUS.post(new PlayerMoveEvent(p));
-        }  
+            EntityPlayer p = e.player;
+            if(p.lastTickPosX != p.posX || p.lastTickPosY != p.posY || p.lastTickPosZ != p.posZ)
+            {
+                MinecraftForge.EVENT_BUS.post(new PlayerMoveEvent(p));
+            }  
+        }
     } 
     
     @SubscribeEvent
@@ -53,15 +56,18 @@ public class CustomEventCaller
     @SubscribeEvent
     public void tickServer(TickEvent.ServerTickEvent e) 
     {       
-        ARROWS.removeIf(arrow -> 
+        if(e.phase == TickEvent.Phase.END)
         {
-            if(ReflectionUtils.getArrowTimeInGround(arrow) >= 1)
+            ARROWS.removeIf(arrow -> 
             {
-                MinecraftForge.EVENT_BUS.post(new ArrowHitGroundEvent(arrow));
-                return true;
-            }
-            return false;
-        });
+                if(ReflectionUtils.getArrowTimeInGround(arrow) >= 1)
+                {
+                    MinecraftForge.EVENT_BUS.post(new ArrowHitGroundEvent(arrow));
+                    return true;
+                }
+                return false;
+            });
+        }
     }
     
     @SubscribeEvent

+ 1 - 1
src/main/java/me/km/inventory/TeleportContainer.java

@@ -39,7 +39,7 @@ public class TeleportContainer extends CustomContainer
         {
             return true;
         }
-        Module m = KajetansMod.effects;
+        Module m = KajetansMod.skills;
         EntityPlayer p2 = players.get(slotId);
         m.send(p, "Die Anfrage wurde an '" + p2.getName() + "' geschickt.");
         m.send(p2, p.getName() + " möchte sich zu dir teleportieren.");

+ 2 - 2
src/main/java/me/km/items/ItemScroll.java

@@ -55,7 +55,7 @@ public class ItemScroll extends ItemBase
             KajetansMod.scrolls.send(p, "Die Schriftrolle ist korrupt.");
             return new ActionResult(EnumActionResult.FAIL, stack);
         }
-        if(eff.getEffectInstance().run((EntityPlayerMP) p, com.getInteger("effect_level"), 0, 20, EffectCause.WAND))
+        if(eff.getEffectInstance().run((EntityPlayerMP) p, com.getInteger("effect_level"), 0, 20, EffectCause.SCROLL))
         {
             if(!p.isCreative())
             {
@@ -75,7 +75,7 @@ public class ItemScroll extends ItemBase
         String s = com.getString("effect_name");
         if(!s.isEmpty())
         {
-            lore.set(0, s + " " + Utils.intToRoman(com.getInteger("effect_id")));
+            lore.set(0, s + " " + Utils.intToRoman(com.getInteger("effect_level")));
         }
     }
     

+ 2 - 2
src/main/java/me/km/items/ItemWand.java

@@ -43,14 +43,14 @@ public class ItemWand extends ItemWeapon
         
         if(!KajetansMod.worldManager.getWorldPreferences(w).scrolls)
         {
-            KajetansMod.effects.send(p, GlobalText.noScrolls());
+            KajetansMod.skills.send(p, GlobalText.noScrolls());
             return new ActionResult(EnumActionResult.FAIL, p.getHeldItem(hand));
         }
         
         int wand = EffectUtils.getEffectLevel(p, Effect.USE_WAND);
         if(wand < 1)
         {
-            KajetansMod.effects.send(p, "Du kannst keine Zauberstäbe benutzen.");
+            KajetansMod.skills.send(p, "Du kannst keine Zauberstäbe benutzen.");
             return new ActionResult(EnumActionResult.FAIL, p.getHeldItem(hand));
         }
         

+ 5 - 2
src/main/java/me/km/items/ModItems.java

@@ -1,9 +1,12 @@
 package me.km.items;
 
+import me.km.items.herbs.ItemHerbs;
 import me.km.items.noglint.ItemNoGlintPotion;
 import me.km.KajetansMod;
 import me.km.blocks.EnumMetals;
 import me.km.blocks.ModBlocks;
+import me.km.items.herbs.ItemAquaHerb;
+import me.km.items.herbs.ItemGoldHerb;
 import me.km.items.noglint.ItemNoGlintLingeringPotion;
 import me.km.items.noglint.ItemNoGlintSplashPotion;
 import me.km.sounds.Sounds;
@@ -340,8 +343,8 @@ public class ModItems
         herbStrong = register(r, new ItemHerbs("herb_strong", "herbStrong", new PotionEffect(MobEffects.SPEED, 6000, 1)));
         herbShadow = register(r, new ItemHerbs("herb_shadow", "herbShadow", new PotionEffect(MobEffects.NIGHT_VISION, 3600, 0)));
         herbXp = register(r, new ItemHerbs("herb_xp", "herbXp"));
-        herbSea = register(r, new ItemSpecialHerbs("herb_sea", "herbSea", "Aqua Affinity", 6000));
-        herbGold = register(r, new ItemSpecialHerbs("herb_gold", "herbGold", "+50% Gold", 12000));
+        herbSea = register(r, new ItemAquaHerb("herb_sea", "herbSea"));
+        herbGold = register(r, new ItemGoldHerb("herb_gold", "herbGold"));
         herbBreathing = register(r, new ItemHerbs("herb_breathing", "herbBreathing", new PotionEffect(MobEffects.WATER_BREATHING, 2400, 0)));
         herbFire = register(r, new ItemHerbs("herb_fire", "herbFire", new PotionEffect(MobEffects.FIRE_RESISTANCE, 2400, 0)));
         

+ 18 - 0
src/main/java/me/km/items/herbs/ItemAquaHerb.java

@@ -0,0 +1,18 @@
+package me.km.items.herbs;
+
+import me.km.KajetansMod;
+import net.minecraft.entity.player.EntityPlayerMP;
+
+public class ItemAquaHerb extends ItemSpecialHerb
+{
+    public ItemAquaHerb(String name, String local) 
+    {
+        super(name, local);
+    }
+
+    @Override
+    public void onHerbFinish(EntityPlayerMP p) 
+    {
+        KajetansMod.data.getOrCreate(p).setAquaAffinity(6000);
+    }
+}

+ 18 - 0
src/main/java/me/km/items/herbs/ItemGoldHerb.java

@@ -0,0 +1,18 @@
+package me.km.items.herbs;
+
+import me.km.KajetansMod;
+import net.minecraft.entity.player.EntityPlayerMP;
+
+public class ItemGoldHerb extends ItemSpecialHerb
+{
+    public ItemGoldHerb(String name, String local) 
+    {
+        super(name, local);
+    }
+
+    @Override
+    public void onHerbFinish(EntityPlayerMP p) 
+    {
+        KajetansMod.data.getOrCreate(p).setGoldBonus(12000, 1.5f);
+    }
+}

+ 2 - 1
src/main/java/me/km/items/ItemHerbs.java → src/main/java/me/km/items/herbs/ItemHerbs.java

@@ -1,5 +1,6 @@
-package me.km.items;
+package me.km.items.herbs;
 
+import me.km.items.ItemFood;
 import net.minecraft.item.ItemStack;
 import net.minecraft.potion.PotionEffect;
 

+ 7 - 12
src/main/java/me/km/items/ItemSpecialHerbs.java → src/main/java/me/km/items/herbs/ItemSpecialHerb.java

@@ -1,6 +1,5 @@
-package me.km.items;
+package me.km.items.herbs;
 
-import me.km.KajetansMod;
 import net.minecraft.advancements.CriteriaTriggers;
 import net.minecraft.entity.EntityLivingBase;
 import net.minecraft.entity.player.EntityPlayer;
@@ -11,20 +10,15 @@ import net.minecraft.stats.StatList;
 import net.minecraft.util.SoundCategory;
 import net.minecraft.world.World;
 
-public class ItemSpecialHerbs extends ItemHerbs
+public abstract class ItemSpecialHerb extends ItemHerbs
 {
-    private String effect;
-    private int time;
-    
-    public ItemSpecialHerbs(String name, String local, String effect, int time) 
+    public ItemSpecialHerb(String name, String local) 
     {
         super(name, local);
-        this.effect = effect;
-        this.time = time;
     }
 
     @Override
-    public ItemStack onItemUseFinish(ItemStack stack, World w, EntityLivingBase liv)
+    public final ItemStack onItemUseFinish(ItemStack stack, World w, EntityLivingBase liv)
     {
         if(liv instanceof EntityPlayer)
         {
@@ -39,12 +33,13 @@ public class ItemSpecialHerbs extends ItemHerbs
                 CriteriaTriggers.CONSUME_ITEM.trigger((EntityPlayerMP) p, stack);
                 if(!w.isRemote)
                 {
-                    // change id
-                    KajetansMod.playerbank.getData((EntityPlayerMP) p).addGoodTimedData(effect, true, time, effect, 300);
+                    onHerbFinish((EntityPlayerMP) p);
                 }
             }
         }
         stack.shrink(1);
         return stack;
     }
+    
+    public abstract void onHerbFinish(EntityPlayerMP p);
 }

+ 22 - 1
src/main/java/me/km/networking/ModPacketHandler.java

@@ -23,9 +23,10 @@ public class ModPacketHandler
         INSTANCE.registerMessage(CustomInventory.Handler.class, CustomInventory.class, id++, Side.CLIENT);
         INSTANCE.registerMessage(CampFireInventory.Handler.class, CampFireInventory.class, id++, Side.CLIENT);
         INSTANCE.registerMessage(SeasonUpdate.Handler.class, SeasonUpdate.class, id++, Side.CLIENT);
+        INSTANCE.registerMessage(StatusDisplay.Handler.class, StatusDisplay.class, id++, Side.CLIENT);
     }
     
-    public static void sendStats(EntityPlayerMP p, byte action, byte index, String text)
+    public static void sendToDisplay(EntityPlayerMP p, byte action, byte index, String text)
     {
         INSTANCE.sendTo(new PlayerDisplay(action, index, text), p);
     }
@@ -66,4 +67,24 @@ public class ModPacketHandler
     {
         INSTANCE.sendTo(new SeasonUpdate(season), p);
     }
+    
+    public static void addStatus(EntityPlayerMP p, byte index, String text)
+    {
+        INSTANCE.sendTo(new StatusDisplay((byte) 1, index, text), p);
+    }
+    
+    public static void addTimedStatus(EntityPlayerMP p, byte index, String text, int time)
+    {
+        INSTANCE.sendTo(new StatusDisplay((byte) 1, index, time, text), p);
+    }
+    
+    public static void removeStatus(EntityPlayerMP p, byte index)
+    {
+        INSTANCE.sendTo(new StatusDisplay((byte) 2, index, ""), p);
+    }
+    
+    public static void clearStatus(EntityPlayerMP p)
+    {
+        INSTANCE.sendTo(new StatusDisplay((byte) 3, (byte) 0, ""), p);
+    }
 }

+ 4 - 4
src/main/java/me/km/networking/SeasonUpdate.java

@@ -43,12 +43,12 @@ public class SeasonUpdate implements IMessage
             switch(message.season)
             {
                 case 0:
-                    ReflectionUtils.setFoliage(new ResourceLocation("textures/colormap/foliage.png"));
-                    ReflectionUtils.setGrass(new ResourceLocation("textures/colormap/grass.png"));
+                    KajetansMod.proxy.setFoliage(new ResourceLocation("textures/colormap/foliage.png"));
+                    KajetansMod.proxy.setGrass(new ResourceLocation("textures/colormap/grass.png"));
                     break;
                 case 1:
-                    ReflectionUtils.setFoliage(new ResourceLocation(KajetansMod.MODID, "textures/colormap/foliage.png"));
-                    ReflectionUtils.setGrass(new ResourceLocation(KajetansMod.MODID, "textures/colormap/grass.png"));
+                    KajetansMod.proxy.setFoliage(new ResourceLocation(KajetansMod.MODID, "textures/colormap/foliage.png"));
+                    KajetansMod.proxy.setGrass(new ResourceLocation(KajetansMod.MODID, "textures/colormap/grass.png"));
                     break;
             }
             Minecraft.getMinecraft().addScheduledTask(() -> 

+ 11 - 2
src/main/java/me/km/networking/StatusDisplay.java

@@ -13,6 +13,7 @@ public class StatusDisplay implements IMessage
     // 3 - clear
     private byte action;
     private byte index;
+    private int time;
     private String text;
     
     public StatusDisplay() 
@@ -22,10 +23,11 @@ public class StatusDisplay implements IMessage
         text = "";
     }
     
-    public StatusDisplay(byte action, byte index, String text) 
+    public StatusDisplay(byte action, byte index, int time, String text) 
     {
         this.action = action;
         this.index = index;
+        this.time = time;
         if(text.length() > 32)
         {
             this.text = text.substring(0, 32);
@@ -36,11 +38,17 @@ public class StatusDisplay implements IMessage
         }
     }
     
+    public StatusDisplay(byte action, byte index, String text) 
+    {
+        this(action, index, Integer.MAX_VALUE, text);
+    }
+    
     @Override
     public void fromBytes(ByteBuf buf) 
     {
         action = buf.readByte();
         index = buf.readByte();
+        time = buf.readInt();
         int length = buf.readInt();
         text = buf.readBytes(length).toString(StandardCharsets.UTF_8);
     }
@@ -50,6 +58,7 @@ public class StatusDisplay implements IMessage
     {
         buf.writeByte(action);
         buf.writeByte(index);
+        buf.writeInt(time);
         byte[] b = text.getBytes(StandardCharsets.UTF_8);
         buf.writeInt(b.length);
         buf.writeBytes(b);
@@ -63,7 +72,7 @@ public class StatusDisplay implements IMessage
             switch(message.action)
             {
                 case 1:
-                    StatusDisplayGui.INSTANCE.add(message.index, message.text);
+                    StatusDisplayGui.INSTANCE.add(message.index, message.time, message.text);
                     break;
                 case 2:
                     StatusDisplayGui.INSTANCE.remove(message.index);

+ 34 - 12
src/main/java/me/km/networking/StatusDisplayGui.java

@@ -25,13 +25,15 @@ public class StatusDisplayGui extends Gui
         public LineData(int time, String text)
         {
             this.time = time;
-            this.text = text;
-        }
-        
-        public LineData(String text)
-        {
-            this.time = Integer.MAX_VALUE;
-            this.text = text;
+            int index = text.indexOf('#');
+            if(index != -1)
+            {
+                this.text = text.substring(0, index) + I18n.translateToLocal(text.substring(index + 1));
+            }
+            else
+            {
+                this.text = text;
+            }
         }
         
         public String getText()
@@ -41,7 +43,11 @@ public class StatusDisplayGui extends Gui
         
         public String getTimeText()
         {
-            return String.valueOf(time / 20);
+            if(time == Integer.MAX_VALUE)
+            {
+                return "";
+            }
+            return (time / 20) + "s ";
         }
         
         public int getTimeWidth()
@@ -51,7 +57,7 @@ public class StatusDisplayGui extends Gui
         
         public int getTextWidth()
         {
-            return mc.fontRenderer.getStringWidth(text);
+            return mc.fontRenderer.getStringWidth(getText());
         }
 
         @Override
@@ -70,9 +76,25 @@ public class StatusDisplayGui extends Gui
         this.strings = new TreeMap<>(); 
     }
     
-    public void add(int i, String s)
+    public void tick()
+    {
+        strings.entrySet().removeIf(e -> 
+        {
+            if(e.getValue().time < Integer.MAX_VALUE)
+            {
+                e.getValue().time--;
+                if(e.getValue().time < 0)
+                {
+                    return true;
+                }
+            }
+            return false;
+        });
+    }
+    
+    public void add(int i, int time, String s)
     {
-        strings.put(i, new LineData(s));
+        strings.put(i, new LineData(time, s));
     }
     
     public void remove(int i)
@@ -96,7 +118,7 @@ public class StatusDisplayGui extends Gui
         LinkedList<LineData> list = new LinkedList<>(strings.values());
         collection.forEach(effect -> 
         {
-            StringBuilder sb = new StringBuilder("s ");
+            StringBuilder sb = new StringBuilder();
             if(effect.getPotion().isBadEffect())
             {
                 sb.append(TextFormatting.RED);

+ 0 - 132
src/main/java/me/km/playerbank/PlayerData.java

@@ -1,132 +0,0 @@
-package me.km.playerbank;
-
-import java.util.HashMap;
-import me.km.KajetansMod;
-import me.km.scoreboard.PlayerScoreboard;
-import net.minecraft.entity.player.EntityPlayerMP;
-
-public class PlayerData
-{
-    private class DataContainer
-    {
-        protected int taskId;
-        protected Object o;
-        protected int entry;
-        
-        public DataContainer(int taskId, Object o, int entry)
-        {
-            this.taskId = taskId;
-            this.o = o;
-            this.entry = entry;
-        }
-    }
-    
-    private final HashMap<String, DataContainer> data;
-    private final PlayerScoreboard sb;
-    
-    public PlayerData(EntityPlayerMP p)
-    {
-        data = new HashMap<>();
-        sb = KajetansMod.scoreboard.getScoreboard(p);
-    }
-    
-    public boolean removeData(String s)
-    {
-        DataContainer d = data.remove(s);
-        if(d != null)
-        {
-            if(d.entry != -1)
-            {
-                sb.removeText(d.entry);
-            }
-            if(d.taskId != -1)
-            {
-                KajetansMod.scheduler.cancelTask(d.taskId);
-            }
-            return true;
-        }
-        return false;
-    }
-    
-    private void addTimedData(String s, Object o, int ticks, String text, int id)
-    {
-        if(id != -1 && text != null)
-        {
-            sb.addText(id, text);
-        }
-        data.put(s, new DataContainer(KajetansMod.scheduler.scheduleTask(() -> removeData(s), ticks), o, id));
-    }
-    
-    public void addGoodTimedData(String s, Object o, int ticks, String text, int id)
-    {
-        addTimedData(s, o, ticks, "§2" + text, id);
-    }
-    
-    public void addBadTimedData(String s, Object o, int ticks, String text, int id)
-    {
-        addTimedData(s, o, ticks, "§4" + text, id);
-    }
-    
-    public void addTimedData(String s, Object o, int ticks)
-    {
-        addTimedData(s, o, ticks, null, -1);
-    }
-    
-    public void addTimedData(String s, int ticks)
-    {
-        addTimedData(s, 0, ticks);
-    }
-    
-    private void addData(String s, Object o, String text, int id)
-    {
-        if(id != -1 && text != null)
-        {
-            sb.addText(id, text);
-        }
-        data.put(s, new DataContainer(-1, o, id));
-    }
-    
-    public void addGoodData(String s, Object o, String text, int id)
-    {
-        addData(s, o, "§2" + text, id);
-    }
-    
-    public void addBadData(String s, Object o, String text, int id)
-    {
-        addData(s, o, "§4" + text, id);
-    }
-    
-    public void addData(String s, Object o)
-    {
-        addData(s, o, null, -1);
-    }
-    
-    public void addData(String s)
-    {
-        addData(s, 0);
-    }
-    
-    public boolean hasData(String s)
-    {
-        return data.containsKey(s);
-    }
-
-    public <T> T getData(String s, Class<T> c)
-    {
-        try
-        {
-            return (T) data.get(s).o;
-        }
-        catch(NullPointerException | ClassCastException ex)
-        {
-            return null;
-        }
-    }
-    
-    public double getDouble(String s)
-    {
-        Number d = getData(s, Number.class);
-        return d == null ? 0 : d.doubleValue();
-    }
-    
-}

+ 0 - 1
src/main/java/me/km/playerbank/PlayerLogInOut.java

@@ -72,7 +72,6 @@ public class PlayerLogInOut extends ModuleListener
     {      
         EntityPlayer p = e.getEntityPlayer();
         KajetansMod.generalCommands.getCommand(CommandTeleportAccept.class).tpaccept.remove(p.getUniqueID());
-        KajetansMod.playerbank.removeData(p);
     }
     
     @SubscribeEvent

+ 4 - 24
src/main/java/me/km/playerbank/PlayerManager.java

@@ -6,20 +6,17 @@ import java.util.UUID;
 import me.km.api.Location;
 import me.km.api.Module;
 import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
 import net.minecraft.util.text.TextFormatting;
 
 public class PlayerManager extends Module
 {
-    private final HashMap<UUID, PlayerData> data;
-    private final HashMap<UUID, Location> back;
+    private final HashMap<UUID, Location> backLocation;
     private final PlayerBank bank;
     
     public PlayerManager(String mname, String prefix, TextFormatting color, Connection c) 
     {
         super(mname, prefix, color);
-        data = new HashMap<>();
-        back = new HashMap<>();
+        backLocation = new HashMap<>();
         bank = new PlayerBank(this, c);
         super.setDataBank(bank);
     }
@@ -31,29 +28,12 @@ public class PlayerManager extends Module
     
     public Location saveLocation(EntityPlayer p)
     {
-        return back.put(p.getUniqueID(), new Location(p.world, p.getPositionVector()));
+        return backLocation.put(p.getUniqueID(), new Location(p.world, p.getPositionVector()));
     }
     
     public Location getLastLocation(EntityPlayer p)
     {
-        return back.get(p.getUniqueID());
-    }
-    
-    public PlayerData getData(EntityPlayerMP p)
-    {
-        PlayerData pd = data.get(p.getUniqueID());
-        if(pd == null)
-        {
-            pd = new PlayerData(p);
-            data.put(p.getUniqueID(), pd);
-            return pd;
-        }
-        return pd;
-    }
-    
-    public void removeData(EntityPlayer p)
-    {
-        data.remove(p.getUniqueID());
+        return backLocation.get(p.getUniqueID());
     }
     
     public int getGuildId(EntityPlayer p) 

+ 5 - 4
src/main/java/me/km/scheduler/SnuviScheduler.java

@@ -3,6 +3,7 @@ package me.km.scheduler;
 import java.util.ArrayList;
 import java.util.ConcurrentModificationException;
 import java.util.HashMap;
+import java.util.LinkedList;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
@@ -17,8 +18,8 @@ public class SnuviScheduler extends Module implements ISnuviScheduler
 {
     private boolean checker;
     private int counter;
-    private final ArrayList<SnuviTask> addQueue;
-    private final ArrayList<Integer> removeQueue;
+    private final LinkedList<SnuviTask> addQueue;
+    private final LinkedList<Integer> removeQueue;
     private final HashMap<Integer, SnuviTask> tasks;
     
     public SnuviScheduler(String mname, String prefix, TextFormatting color)
@@ -26,8 +27,8 @@ public class SnuviScheduler extends Module implements ISnuviScheduler
         super(mname, prefix, color);
         counter = 0;
         tasks = new HashMap<>();
-        addQueue = new ArrayList<>();
-        removeQueue = new ArrayList<>();
+        addQueue = new LinkedList<>();
+        removeQueue = new LinkedList<>();
     }
     
     public void cancelTask(int id)

+ 12 - 3
src/main/java/me/km/scrolls/CommandScroll.java

@@ -40,9 +40,18 @@ public class CommandScroll extends ModuleTabCommand
             return true;
         }
         EntityPlayer p = (EntityPlayer) cs;
-        Effect eff = Effect.valueOf(arg[0]);
-        if(eff == null || !eff.isActive())
-        { 
+        Effect eff;
+        try
+        {
+            eff = Effect.valueOf(arg[0]);
+            if(!eff.isActive())
+            { 
+                this.getModule().send(cs, "Dieser aktive Effekt existiert nicht.");
+                return true;
+            }
+        }
+        catch(IllegalArgumentException ex)
+        {
             this.getModule().send(cs, "Dieser aktive Effekt existiert nicht.");
             return true;
         }

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

@@ -631,7 +631,7 @@ public class MinecraftFunctions implements ISnuviLogger
         parser.registerConsumer("display.remove", (args, qd) ->  
                 removeFromDisplay(args, qd));
         parser.registerConsumer("display.reset", (args, qd) ->  
-                doForGroup(args[0], qd, p -> ModPacketHandler.sendStats((EntityPlayerMP) p, (byte) 3, (byte) -1, "")));
+                doForGroup(args[0], qd, p -> ModPacketHandler.sendToDisplay((EntityPlayerMP) p, (byte) 3, (byte) -1, "")));
 
         // -------------------------------------------------------------  
         // Effect-Bibliothek   
@@ -1178,13 +1178,13 @@ public class MinecraftFunctions implements ISnuviLogger
     {
         byte id = (byte) ScriptUtils.getInt(args[1]);
         String message = ScriptUtils.connect(args, 2);
-        doForGroup(args[0], qd, p -> ModPacketHandler.sendStats((EntityPlayerMP) p, (byte) 1, id, message));
+        doForGroup(args[0], qd, p -> ModPacketHandler.sendToDisplay((EntityPlayerMP) p, (byte) 1, id, message));
     }
     
     private static void removeFromDisplay(Object[] args, Script qd) throws PlayerNotFoundException
     {
         byte id = (byte) ScriptUtils.getInt(args[1]);
-        doForGroup(args[0], qd, p -> ModPacketHandler.sendStats((EntityPlayerMP) p, (byte) 2, id, ""));
+        doForGroup(args[0], qd, p -> ModPacketHandler.sendToDisplay((EntityPlayerMP) p, (byte) 2, id, ""));
     }
 
     private static void sendToActionBar(Object[] args, Script qd) throws PlayerNotFoundException

+ 2 - 29
src/main/java/me/km/utils/ReflectionUtils.java

@@ -9,8 +9,6 @@ import java.util.Random;
 import java.util.UUID;
 import net.minecraft.block.Block;
 import net.minecraft.block.material.Material;
-import net.minecraft.client.resources.FoliageColorReloadListener;
-import net.minecraft.client.resources.GrassColorReloadListener;
 import net.minecraft.entity.Entity;
 import net.minecraft.entity.EntityLivingBase;
 import net.minecraft.entity.item.EntityItem;
@@ -21,11 +19,8 @@ import net.minecraft.entity.projectile.EntityArrow;
 import net.minecraft.server.management.PlayerList;
 import net.minecraft.util.DamageSource;
 import net.minecraft.util.FoodStats;
-import net.minecraft.util.ResourceLocation;
 import net.minecraft.world.Explosion;
 import net.minecraftforge.fml.relauncher.ReflectionHelper;
-import net.minecraftforge.fml.relauncher.Side;
-import net.minecraftforge.fml.relauncher.SideOnly;
 
 public class ReflectionUtils 
 {    
@@ -59,7 +54,7 @@ public class ReflectionUtils
         return null;
     }
     
-    private static Field getFinalStaticField(Class c, String... field)
+    public static Field getFinalStaticField(Class c, String... field)
     {
         try
         {
@@ -157,7 +152,7 @@ public class ReflectionUtils
         }
     }
     
-    private static void setFieldValue(Object o, Field f, Object value)
+    public static void setFieldValue(Object o, Field f, Object value)
     {
         try
         {
@@ -339,26 +334,4 @@ public class ReflectionUtils
         {
         }
     }
-    
-    // -------------------------------------------------------------------------
-    // rendering stuff
-    // -------------------------------------------------------------------------
-    
-    @SideOnly(Side.CLIENT)
-    private final static Field LOC_FOLIAGE_PNG = getFinalStaticField(FoliageColorReloadListener.class, "field_130079_a", "LOC_FOLIAGE_PNG");   
-    
-    @SideOnly(Side.CLIENT)
-    public static void setFoliage(ResourceLocation loc)
-    {
-        setFieldValue(null, LOC_FOLIAGE_PNG, loc);
-    }
-    
-    @SideOnly(Side.CLIENT)
-    private final static Field LOC_GRASS_PNG = getFinalStaticField(GrassColorReloadListener.class, "field_130078_a", "LOC_GRASS_PNG");   
-    
-    @SideOnly(Side.CLIENT)
-    public static void setGrass(ResourceLocation loc)
-    {
-        setFieldValue(null, LOC_GRASS_PNG, loc);
-    }
 }

+ 24 - 1
src/main/resources/assets/km/lang/en_US.lang

@@ -174,4 +174,27 @@ key.function.5=Function Key 5
 key.function.6=Function Key 6
 key.function.7=Function Key 7
 key.function.8=Function Key 8
-key.function.9=Function Key 9
+key.function.9=Function Key 9
+
+entitydata.grapplingHook=Grappling Hook
+entitydata.shadowHit=Shadow Hit
+entitydata.powerAttack=Damage on next Attack
+entitydata.impactPunch=Impact Punch
+entitydata.lessHeal=Heal
+entitydata.attackBoost=Damage
+entitydata.armorBoost=Armor
+entitydata.magicArmorBoost=Magic Armor
+entitydata.reflection=Reflection
+entitydata.armorBypass=Armor Bypass
+entitydata.callback=Callback
+entitydata.doomed=Doomed
+entitydata.poisonBlade=Poisoned Blade
+entitydata.arrowImmunity=Arrow Immunity
+entitydata.fallImmunity=Fall Immunity
+entitydata.silence=Silence
+entitydata.shadow=Shadow
+entitydata.gravity=Gravity
+entitydata.ignorance=Ignorance
+entitydata.goldBonus=Gold
+entitydata.aquaAffinity=Aqua Affinity
+