Kajetan Johannes Hammerle 8 лет назад
Родитель
Сommit
2c5241d5d0
32 измененных файлов с 1148 добавлено и 404 удалено
  1. 5 4
      src/main/java/me/km/KajetansMod.java
  2. 5 0
      src/main/java/me/km/api/Location.java
  3. 39 0
      src/main/java/me/km/api/TitleAPI.java
  4. 19 0
      src/main/java/me/km/api/Utils.java
  5. 26 0
      src/main/java/me/km/chatmanager/ChatListener.java
  6. 123 0
      src/main/java/me/km/chatmanager/ChatManager.java
  7. 32 0
      src/main/java/me/km/chatmanager/CommandColor.java
  8. 68 0
      src/main/java/me/km/chatmanager/CommandFakeRank.java
  9. 70 0
      src/main/java/me/km/chatmanager/CommandNickName.java
  10. 29 0
      src/main/java/me/km/chatmanager/Rank.java
  11. 10 7
      src/main/java/me/km/commands/CommandBack.java
  12. 32 30
      src/main/java/me/km/commands/CommandBed.java
  13. 19 20
      src/main/java/me/km/commands/CommandBook.java
  14. 25 24
      src/main/java/me/km/commands/CommandEnchant.java
  15. 18 17
      src/main/java/me/km/commands/CommandFeed.java
  16. 14 16
      src/main/java/me/km/commands/CommandGrow.java
  17. 23 28
      src/main/java/me/km/commands/CommandItemInfo.java
  18. 0 1
      src/main/java/me/km/commands/CommandKick.java
  19. 8 7
      src/main/java/me/km/commands/CommandMemory.java
  20. 22 20
      src/main/java/me/km/commands/CommandMsg.java
  21. 18 18
      src/main/java/me/km/commands/CommandPosition.java
  22. 38 43
      src/main/java/me/km/commands/CommandPotion.java
  23. 22 19
      src/main/java/me/km/commands/CommandSeen.java
  24. 19 18
      src/main/java/me/km/commands/CommandSpeed.java
  25. 19 17
      src/main/java/me/km/commands/CommandTeleportAccept.java
  26. 15 37
      src/main/java/me/km/commands/CommandTime.java
  27. 23 16
      src/main/java/me/km/commands/CommandTop.java
  28. 27 24
      src/main/java/me/km/commands/CommandTpPos.java
  29. 18 16
      src/main/java/me/km/commands/CommandUser.java
  30. 23 21
      src/main/java/me/km/commands/CommandWarp.java
  31. 336 0
      src/main/java/me/km/nms/NmsUtilities.java
  32. 3 1
      src/main/java/me/km/permissions/Permissions.java

+ 5 - 4
src/main/java/me/km/KajetansMod.java

@@ -3,6 +3,7 @@ package me.km;
 import me.km.api.Module;
 import me.km.api.Module;
 import me.km.api.SimpleConfig;
 import me.km.api.SimpleConfig;
 import me.km.blocks.ModBlocks;
 import me.km.blocks.ModBlocks;
+import me.km.chatmanager.ChatManager;
 import me.km.databank.DataBank;
 import me.km.databank.DataBank;
 import me.km.entities.ModEntities;
 import me.km.entities.ModEntities;
 import me.km.fluids.ModFluids;
 import me.km.fluids.ModFluids;
@@ -31,7 +32,7 @@ public class KajetansMod
     public static SnuviScheduler scheduler;
     public static SnuviScheduler scheduler;
     public static PlayerManager playerbank;
     public static PlayerManager playerbank;
     public static Module generalCommands;
     public static Module generalCommands;
-    //public static ChatManager chatManager;
+    public static ChatManager chatManager;
     //public static Module afkManager;
     //public static Module afkManager;
     //public static Module plots;
     //public static Module plots;
     //public static Module blocks;
     //public static Module blocks;
@@ -98,9 +99,9 @@ public class KajetansMod
         generalCommands.registerCommands(e, "me.km.commands");
         generalCommands.registerCommands(e, "me.km.commands");
         
         
         // Chatmanager
         // Chatmanager
-        /*chatManager = new ChatManager("ChatManager", "Chat", TextFormatting.BLUE);
-        chatManager.registerCommands(e, "me.kt.chatmanager");
-        chatManager.registerEvents("me.kt.chatmanager");*/
+        chatManager = new ChatManager("ChatManager", "Chat", TextFormatting.BLUE);
+        chatManager.registerCommands(e, "me.km.chatmanager");
+        chatManager.registerEvents("me.km.chatmanager");
         
         
         // AFK-Manager
         // AFK-Manager
         /*afkManager = new Module("AfkManager", "AFK", TextFormatting.GRAY);
         /*afkManager = new Module("AfkManager", "AFK", TextFormatting.GRAY);

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

@@ -25,6 +25,11 @@ public class Location
     {
     {
         this(w, pos, 0, 0);
         this(w, pos, 0, 0);
     }
     }
+    
+    public Location(World w, BlockPos pos)
+    {
+        this(w, new Vec3d(pos.getX(), pos.getY(), pos.getZ()));
+    }
 
 
     public World getWorld() 
     public World getWorld() 
     {
     {

+ 39 - 0
src/main/java/me/km/api/TitleAPI.java

@@ -0,0 +1,39 @@
+package me.km.api;
+
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.network.play.server.SPacketTitle;
+import net.minecraft.util.text.TextComponentString;
+
+public class TitleAPI 
+{
+    public static void setTitleTime(EntityPlayerMP p, int fadeIn, int stay, int fadeOut)
+    {
+        p.connection.sendPacket(new SPacketTitle(fadeIn, stay, fadeOut));
+    }
+    
+    public static void clearTitle(EntityPlayerMP p)
+    {
+        p.connection.sendPacket(new SPacketTitle(SPacketTitle.Type.CLEAR, null));
+        p.connection.sendPacket(new SPacketTitle(SPacketTitle.Type.RESET, null));
+    }
+    
+    public static void resetTitle(EntityPlayerMP p)
+    {
+        p.connection.sendPacket(new SPacketTitle(SPacketTitle.Type.RESET, null));
+    }
+    
+    private static void setTitle(SPacketTitle.Type a, EntityPlayerMP p, String s)
+    {
+        p.connection.sendPacket(new SPacketTitle(a, new TextComponentString(s)));
+    }
+    
+    public static void setTitle(EntityPlayerMP p, String s)
+    {
+        setTitle(SPacketTitle.Type.TITLE, p, s);
+    }
+    
+    public static void setSubTitle(EntityPlayerMP p, String s)
+    {
+        setTitle(SPacketTitle.Type.SUBTITLE, p, s);
+    }
+}

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

@@ -1,5 +1,6 @@
 package me.km.api;
 package me.km.api;
 
 
+import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collection;
@@ -20,6 +21,7 @@ import net.minecraft.block.state.IBlockState;
 import net.minecraft.entity.player.EntityPlayerMP;
 import net.minecraft.entity.player.EntityPlayerMP;
 import net.minecraft.init.Blocks;
 import net.minecraft.init.Blocks;
 import net.minecraft.init.Items;
 import net.minecraft.init.Items;
+import net.minecraft.init.MobEffects;
 import net.minecraft.item.Item;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemAxe;
 import net.minecraft.item.ItemAxe;
 import net.minecraft.item.ItemHoe;
 import net.minecraft.item.ItemHoe;
@@ -32,9 +34,26 @@ import net.minecraft.util.math.Vec3i;
 import net.minecraft.world.World;
 import net.minecraft.world.World;
 import net.minecraft.item.ItemStack;
 import net.minecraft.item.ItemStack;
 import net.minecraft.item.ItemSword;
 import net.minecraft.item.ItemSword;
+import net.minecraft.potion.Potion;
 
 
 public class Utils 
 public class Utils 
 {    
 {    
+    // -------------------------------------------------------------------------
+    // Potions
+    // -------------------------------------------------------------------------
+    
+    public static Potion getPotion(String name)
+    {
+        try
+        {
+            return (Potion) MobEffects.class.getField(name).get(null);
+        }
+        catch(NoSuchFieldException | SecurityException | IllegalAccessException | IllegalArgumentException ex)
+        {
+            return null;
+        }
+    }
+    
     // -------------------------------------------------------------------------
     // -------------------------------------------------------------------------
     // Befehle für Werkzeuge
     // Befehle für Werkzeuge
     // -------------------------------------------------------------------------
     // -------------------------------------------------------------------------

+ 26 - 0
src/main/java/me/km/chatmanager/ChatListener.java

@@ -0,0 +1,26 @@
+package me.km.chatmanager;
+
+import me.kt.KajetansTools;
+import me.kt.api.Module;
+import me.kt.api.ModuleListener;
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.player.AsyncPlayerChatEvent;
+
+public class ChatListener extends ModuleListener
+{
+    public ChatListener(Module m) 
+    {
+        super(m);
+    }
+    
+    @EventHandler(priority = EventPriority.LOW)
+    public void onChatEvent(AsyncPlayerChatEvent e)
+    {
+        Player p = e.getPlayer();
+        e.setMessage(ChatColor.RESET + ChatManager.colorMessage(e.getMessage(), p));
+        e.setFormat(KajetansTools.chatManager.getFullName(p) + ChatColor.DARK_BLUE + " | " + "%2$s");    
+    }
+}

+ 123 - 0
src/main/java/me/km/chatmanager/ChatManager.java

@@ -0,0 +1,123 @@
+package me.km.chatmanager;
+
+import me.km.api.Module;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import me.km.permissions.Permission;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.text.TextFormatting;
+
+public class ChatManager extends Module
+{    
+    private final ArrayList<List<Rank>> ranks;
+    private final HashMap<UUID, String> fakeRank;
+
+    public ChatManager(String mname, String prefix, TextFormatting color) 
+    {
+        super(mname, prefix, color);
+        ranks = new ArrayList<>();
+        ranks.add(Arrays.asList(new Rank("geist", "§8Geist")));
+        fakeRank = new HashMap<>(); 
+    }
+
+    // -------------------------------------------------------------------------
+    // Ränge registrieren und abrufen
+    // -------------------------------------------------------------------------
+    
+    public void registerRank(String perm, int group, String name)
+    {
+        List<Rank> list;
+        if(ranks.size() > group)
+        {
+            list = ranks.get(group);
+        }
+        else
+        {
+            list = new ArrayList<>();
+            ranks.add(list);
+        }
+        list.add(new Rank(perm, name));
+    }
+    
+    public ArrayList<String> getRanks(EntityPlayer p)
+    {
+        // TODO
+        /*ArrayList<String> list = ranks.stream().skip(1)
+                .map(l -> 
+                {
+                    for(Rank r : l)
+                    {
+                        if(false)
+                        {
+                            return r.getName();
+                        }
+                    }
+                    return null;
+                })
+                .filter(s -> s != null)
+                .collect(Collectors.toCollection(ArrayList::new));
+        if(list.isEmpty())
+        {
+            list.add(ranks.get(0).get(0).getName());        
+        }
+        return list;*/
+        return new ArrayList<>();
+    }
+    
+    public void clearRanks()
+    {
+        ranks.clear();
+        ranks.add(Arrays.asList(new Rank("geist", "§8Geist")));
+    }
+    
+    public String getFullName(EntityPlayer p)
+    {
+        String fake = fakeRank.get(p.getUniqueID());
+        if(fake != null)
+        {
+            return fake + " " + p.getDisplayName();
+        }
+        return getRanks(p).stream().collect(Collectors.joining("§r][", "[", "§r] " + p.getDisplayName()));
+    }
+    
+    // -------------------------------------------------------------------------
+    // Fakeranks
+    // -------------------------------------------------------------------------
+    
+    public void addFakeRank(EntityPlayer p, String rank)
+    {
+        fakeRank.put(p.getUniqueID(), rank);
+    }
+    
+    public String getFakeRank(EntityPlayer p)
+    {
+        return fakeRank.get(p.getUniqueID());
+    }
+
+    public void removeFakeRank(EntityPlayer p)
+    {
+        fakeRank.remove(p.getUniqueID());
+    }
+    
+    // -------------------------------------------------------------------------
+    // Text färben
+    // -------------------------------------------------------------------------
+    
+    public static String colorMessage(String text, ICommandSender cs) 
+    {
+        text = text.replace("&k", "");
+        if(Permission.hasPermission(cs, Permissions.USE_COLOR))
+        {
+            text = text.replace("&", "§");
+            return text;
+        }
+        text = text.replaceAll("&.", "");
+        return text;
+    }
+}

+ 32 - 0
src/main/java/me/km/chatmanager/CommandColor.java

@@ -0,0 +1,32 @@
+package me.km.chatmanager;
+
+import me.km.api.Module;
+import me.km.api.ModuleCommand;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
+
+public class CommandColor extends ModuleCommand
+{
+    public CommandColor(Module m) 
+    {
+        super("color", m);
+        super.setDescription("Zeigt dir die möglichen Farben");
+        super.setUsage("/color");
+        super.setPermission(Permissions.COLOR);
+    }
+
+    @Override
+    public boolean execute(ICommandSender cs, String[] arg) 
+    {
+        Module m = this.getModule();
+        m.send(cs, "§9Verfügbare Farbcodes:");
+        m.send(cs, "  §0&0  §1&1  §2&2  §3&3  §4&4  §5&5  §6&6  §7&7");
+        m.send(cs, "  §8&8  §9&9  §a&a  §b&b  §c&c  §d&d  §e&e  §f&f");
+        m.send(cs, "§9Sonstiges:");
+        m.send(cs, "  §l&l (fett)");
+        m.send(cs, "  §m&m (durchgestrichen)");
+        m.send(cs, "  §n&n (unterstrichen)");
+        m.send(cs, "  §o&o (kursiv)");
+        return true;
+    }
+}

+ 68 - 0
src/main/java/me/km/chatmanager/CommandFakeRank.java

@@ -0,0 +1,68 @@
+package me.km.chatmanager;
+
+import me.kt.KajetansTools;
+import me.kt.api.GlobalText;
+import me.kt.api.Module;
+import me.kt.api.ModuleCommand;
+import me.kt.api.Utils;
+import me.kt.exceptions.PlayerNotFoundException;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+public class CommandFakeRank extends ModuleCommand
+{
+    public CommandFakeRank(Module m) 
+    {
+        super("fakerank", m);
+        this.setDescription("Gibt einem Spieler einen falschen Rang");
+        this.setUsage("/fakerank <rank/clear> [player]");
+        this.setPermission("kt.fakerank");
+    }
+
+    @Override
+    public boolean execute(CommandSender cs, String string, String[] arg) 
+    {
+        if(arg.length < 1)
+        {
+            return false;
+        }
+        Player affectedPlayer;
+        try
+        {
+            affectedPlayer = Utils.getPlayerByName(arg[1]);                   
+        }
+        catch(PlayerNotFoundException ex)
+        {
+            this.getModule().send(cs, GlobalText.cantFindPlayer(arg[1]));
+            return true;
+        }
+        catch(IndexOutOfBoundsException ex)
+        {
+            if(!(cs instanceof Player))
+            {
+                this.getModule().send(cs, GlobalText.missingParameter());
+                return true;
+            }
+            affectedPlayer = (Player) cs;
+        }
+        
+        if(arg[0].equals("clear"))
+        {
+            KajetansTools.chatManager.removeFakeRank(affectedPlayer);
+            this.getModule().send(affectedPlayer, "Du hast keinen falschen Rang mehr.");
+            if(!cs.equals(affectedPlayer))
+            {
+                this.getModule().send(cs, affectedPlayer.getName() + " hat keinen falschen Rang mehr.");
+            }
+            return true;
+        }
+        String rank = ChatManager.colorMessage(arg[0], cs);
+        KajetansTools.chatManager.addFakeRank(affectedPlayer, rank);
+        this.getModule().send(affectedPlayer, "Du hast nun den falschen Rang '" + rank + "§r'.");
+        if(!cs.equals(affectedPlayer))
+        {
+            this.getModule().send(cs, affectedPlayer.getName() + " hat nun den falschen Rang '" + rank + "§r'.");
+        }
+        return true;
+    }
+}

+ 70 - 0
src/main/java/me/km/chatmanager/CommandNickName.java

@@ -0,0 +1,70 @@
+package me.km.chatmanager;
+
+import me.kt.api.GlobalText;
+import me.kt.api.Module;
+import me.kt.api.ModuleCommand;
+import me.kt.api.Utils;
+import me.kt.exceptions.PlayerNotFoundException;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+public class CommandNickName extends ModuleCommand
+{
+    public CommandNickName(Module m) 
+    {
+        super("nickname", m);
+        this.setDescription("Gibt einem Spieler einen Nickname");
+        this.setUsage("/nickname <nick/clear> [player]");
+        this.setPermission("kt.nickname");
+    }
+
+    @Override
+    public boolean execute(CommandSender cs, String string, String[] arg) 
+    {
+        if(arg.length < 1)
+        {
+            return false;
+        }
+        Player affectedPlayer;
+        try
+        {
+            affectedPlayer = Utils.getPlayerByName(arg[1]);                   
+        }
+        catch(PlayerNotFoundException ex)
+        {
+            this.getModule().send(cs, GlobalText.cantFindPlayer(arg[1]));
+            return true;
+        }
+        catch(IndexOutOfBoundsException ex)
+        {
+            if(!(cs instanceof Player))
+            {
+                this.getModule().send(cs, GlobalText.missingParameter());
+                return true;
+            }
+            affectedPlayer = (Player) cs;
+        }
+        
+        if(arg[0].equals("clear") || arg[0].equals("off"))
+        {
+            affectedPlayer.setDisplayName(affectedPlayer.getName());
+            affectedPlayer.setPlayerListName(affectedPlayer.getName());
+            affectedPlayer.setCustomName(affectedPlayer.getName());
+            this.getModule().send(affectedPlayer, "Du hast keinen Nicknamen mehr.");
+            if(!cs.equals(affectedPlayer))
+            {
+                this.getModule().send(cs, affectedPlayer.getName() + " hat keinen Nicknamen mehr.");
+            }
+            return true;
+        }
+        affectedPlayer.setDisplayName(arg[0]);
+        affectedPlayer.setPlayerListName(arg[0]);
+        affectedPlayer.setCustomName(arg[0]);
+        this.getModule().send(affectedPlayer, "Du hast nun den Nicknamen '" + arg[0] + "'.");
+        if(!cs.equals(affectedPlayer))
+        {
+            this.getModule().send(cs, affectedPlayer.getName() + " hat nun den Nicknamen '" + arg[0] + "'.");
+        }
+        return true;
+    }
+}

+ 29 - 0
src/main/java/me/km/chatmanager/Rank.java

@@ -0,0 +1,29 @@
+package me.km.chatmanager;
+
+public class Rank 
+{
+    private final String perm;
+    private final String name;
+    
+    public Rank(String perm, String name)
+    {
+        this.perm = perm;
+        this.name = name;
+    }
+    
+    public String getPermission()
+    {
+        return "kt.rank." + perm;
+    }
+    
+    public String getName()
+    {
+        return name;
+    }
+
+    @Override
+    public String toString() 
+    {
+        return "[perm: " + perm + ", name: " + name + "]";
+    }
+}

+ 10 - 7
src/main/java/me/km/commands/CommandBack.java

@@ -1,30 +1,33 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.km.KajetansTools;
+import me.km.KajetansMod;
 import me.km.api.GlobalText;
 import me.km.api.GlobalText;
 import me.km.api.Module;
 import me.km.api.Module;
 import me.km.api.ModuleCommand;
 import me.km.api.ModuleCommand;
+import me.km.permissions.Permissions;
 import me.km.playerbank.TeleportEvent;
 import me.km.playerbank.TeleportEvent;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
 
 
 public class CommandBack extends ModuleCommand
 public class CommandBack extends ModuleCommand
 {
 {
     public CommandBack(Module m) 
     public CommandBack(Module m) 
     {
     {
         super("back", m);
         super("back", m);
-        this.setDescription("Teleportiert dich zu deiner letzten Position");
-        this.setUsage("/back");
-        this.setPermission("kt.back");
+        super.setDescription("Teleportiert dich zu deiner letzten Position");
+        super.setUsage("/back");
+        super.setPermission(Permissions.BACK);
     }
     }
 
 
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
-        if(!(cs instanceof Player))
+        if(!(cs instanceof EntityPlayer))
         {
         {
             this.getModule().send(cs, GlobalText.onlyPlayer());
             this.getModule().send(cs, GlobalText.onlyPlayer());
             return true;
             return true;
         }
         }
-        Player p = (Player) cs;    
+        EntityPlayer p = (EntityPlayer) cs;    
         Location l = KajetansTools.playerbank.getEvent(TeleportEvent.class).getLastLocation(p);
         Location l = KajetansTools.playerbank.getEvent(TeleportEvent.class).getLastLocation(p);
         if(l != null)
         if(l != null)
         {
         {

+ 32 - 30
src/main/java/me/km/commands/CommandBed.java

@@ -1,65 +1,67 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.kt.KajetansTools;
-import me.kt.api.GlobalText;
-import me.kt.api.Module;
-import me.kt.api.ModuleCommand;
-import me.kt.playerbank.PlayerBank;
-import java.util.UUID;
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
+import me.km.api.GlobalText;
+import me.km.api.Module;
+import me.km.api.ModuleCommand;
+import me.km.api.Location;
+import me.km.api.Utils;
+import me.km.exception.PlayerNotFoundException;
+import me.km.permissions.Permission;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.math.BlockPos;
 
 
 public class CommandBed extends ModuleCommand
 public class CommandBed extends ModuleCommand
 {
 {
     public CommandBed(Module m) 
     public CommandBed(Module m) 
     {
     {
         super("bed", m);
         super("bed", m);
-        this.setDescription("Teleportiert einen Spieler zu einem Bett");
-        this.setUsage("/bed [player]");
-        this.setPermission("kt.bed");
+        super.setDescription("Teleportiert einen Spieler zu einem Bett");
+        super.setUsage("/bed [player]");
+        super.setPermission(Permissions.BED);
     }
     }
 
 
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
-        if(!(cs instanceof Player))
+        if(!(cs instanceof EntityPlayer))
         {
         {
             this.getModule().send(cs, GlobalText.onlyPlayer());
             this.getModule().send(cs, GlobalText.onlyPlayer());
             return true;
             return true;
         }
         }
-        Player p = (Player) cs;
+        EntityPlayer p = (EntityPlayer) cs;
         
         
-        Location l; 
-        if(arg.length == 0 || !p.hasPermission("kt.bed.other"))
+        if(arg.length == 0 || !Permission.hasPermission(cs, Permissions.BED_OTHER))
         {
         {
-            l = p.getBedSpawnLocation();
-            if(l == null)
+            BlockPos pos = p.getBedLocation(p.dimension);
+            if(pos == null)
             {
             {
                 this.getModule().send(cs, "Du hast keinen Bettspawn gesetzt.");
                 this.getModule().send(cs, "Du hast keinen Bettspawn gesetzt.");
                 return true;
                 return true;
             }
             }
-            p.teleport(l.add(1.5, 0.57, 1.5));
+            Utils.teleportEntity(p, new Location(p.getEntityWorld(), pos));
             this.getModule().send(cs, "Du wurdest zu deinem Bett teleportiert.");
             this.getModule().send(cs, "Du wurdest zu deinem Bett teleportiert.");
             return true;
             return true;
         }
         }
 
 
-        String uuid = KajetansTools.playerbank.getDataBank(PlayerBank.class).getUUID(arg[0]);
-        if(uuid == null)
+        EntityPlayer affectedPlayer;
+        try
+        {
+            affectedPlayer = Utils.getPlayerByName(arg[0]);    
+        }
+        catch(PlayerNotFoundException ex)
         {
         {
             this.getModule().send(cs, GlobalText.cantFindPlayer(arg[0]));
             this.getModule().send(cs, GlobalText.cantFindPlayer(arg[0]));
             return true;
             return true;
-        }
-        OfflinePlayer affectedPlayer = Bukkit.getOfflinePlayer(UUID.fromString(uuid));  
-        l = affectedPlayer.getBedSpawnLocation();
-        if(l == null)
+        } 
+        BlockPos pos = p.getBedLocation(p.dimension);
+        if(pos == null)
         {
         {
             this.getModule().send(cs, affectedPlayer.getName() + " hat keinen Bettspawn gesetzt.");
             this.getModule().send(cs, affectedPlayer.getName() + " hat keinen Bettspawn gesetzt.");
             return true;
             return true;
-        } 
-        p.teleport(l.add(1.5, 0.57, 1.5));
+        }
+        Utils.teleportEntity(p, new Location(p.getEntityWorld(), pos));
         this.getModule().send(cs, "Du wurdest zum Bett von " + affectedPlayer.getName() + " teleportiert.");
         this.getModule().send(cs, "Du wurdest zum Bett von " + affectedPlayer.getName() + " teleportiert.");
         return true;
         return true;
     }
     }

+ 19 - 20
src/main/java/me/km/commands/CommandBook.java

@@ -1,46 +1,45 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.kt.api.Utils;
-import me.kt.api.GlobalText;
-import me.kt.api.Module;
-import me.kt.api.ModuleCommand;
-import me.kt.chatmanager.ChatManager;
-import org.bukkit.Material;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.BookMeta;
+import me.km.api.GlobalText;
+import me.km.api.Module;
+import me.km.api.ModuleCommand;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
 
 
 public class CommandBook extends ModuleCommand
 public class CommandBook extends ModuleCommand
 {
 {
     public CommandBook(Module m) 
     public CommandBook(Module m) 
     {
     {
         super("book", m);
         super("book", m);
-        this.setDescription("Diverse Befehle für Bücher");
-        this.setUsage("/book für die Hilfe");
-        this.setPermission("kt.book");
+        super.setDescription("Diverse Befehle für Bücher");
+        super.setUsage("/book für die Hilfe");
+        super.setPermission(Permissions.BOOK);
     }
     }
 
 
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
-        if(!(cs instanceof Player))
+        if(!(cs instanceof EntityPlayer))
         {
         {
             this.getModule().send(cs, GlobalText.onlyPlayer());
             this.getModule().send(cs, GlobalText.onlyPlayer());
             return true;
             return true;
         }
         }
         Module m = this.getModule();
         Module m = this.getModule();
-        Player p = (Player) cs;
+        EntityPlayer p = (EntityPlayer) cs;
         
         
         if(arg.length >= 1)
         if(arg.length >= 1)
         {
         {
-            ItemStack stack = p.getInventory().getItemInMainHand();
-            if(stack.getType() != Material.WRITTEN_BOOK)
+            ItemStack stack = p.getHeldItemMainhand();
+            if(stack.getItem() != Items.WRITTEN_BOOK)
             {
             {
                 m.send(cs, "Du hast kein signiertes Buch in der Hand.");
                 m.send(cs, "Du hast kein signiertes Buch in der Hand.");
                 return true;
                 return true;
             }
             }
-            BookMeta bmeta = (BookMeta) stack.getItemMeta();
+            // TODO
+            /*BookMeta bmeta = (BookMeta) stack.getItemMeta();
             
             
             switch(arg[0])
             switch(arg[0])
             {
             {
@@ -65,7 +64,7 @@ public class CommandBook extends ModuleCommand
                     p.updateInventory();
                     p.updateInventory();
                     return true;
                     return true;
                 }
                 }
-            }
+            }*/
         }
         }
         
         
         m.send(cs, "/book ...");
         m.send(cs, "/book ...");

+ 25 - 24
src/main/java/me/km/commands/CommandEnchant.java

@@ -1,41 +1,41 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.kt.api.GlobalText;
-import me.kt.api.Module;
-import me.kt.api.ModuleCommand;
-import me.kt.api.SimpleTabCompleter;
+import me.km.api.GlobalText;
+import me.km.api.Module;
 import java.util.Arrays;
 import java.util.Arrays;
-import java.util.stream.Collectors;
-import org.bukkit.Material;
-import org.bukkit.command.CommandSender;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
+import me.km.api.ModuleTabCommand;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
 
 
-public class CommandEnchant extends ModuleCommand
+public class CommandEnchant extends ModuleTabCommand
 {
 {
     public CommandEnchant(Module m) 
     public CommandEnchant(Module m) 
     {
     {
-        super("enchant", m);
-        this.setDescription("Erzeugt Custom-Enchants");
-        this.setUsage("/enchant <enchant> <level>");
-        this.setPermission("kt.enchant");       
+        super("enchant", m, Arrays.asList(new String[]
+        {
+            "WUSI"
+        }), 0);  
+        super.setDescription("Erzeugt Custom-Enchants");
+        super.setUsage("/enchant <enchant> <level>");
+        super.setPermission(Permissions.ENCHANT);       
         
         
-        m.registerTabCompleter("enchant", new SimpleTabCompleter(
-            Arrays.asList(Enchantment.values()).stream().map(n -> n.getName()).collect(Collectors.toList()), 1));
+        //m.registerTabCompleter("enchant", new SimpleTabCompleter(
+        //    Arrays.asList(Enchantment.values()).stream().map(n -> n.getName()).collect(Collectors.toList()), 1));
     }
     }
 
 
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
-        if(!(cs instanceof Player))
+        if(!(cs instanceof EntityPlayer))
         {
         {
             this.getModule().send(cs, GlobalText.onlyPlayer());
             this.getModule().send(cs, GlobalText.onlyPlayer());
             return true;
             return true;
         }
         }
-        Player p = (Player) cs;
-        ItemStack hand = p.getInventory().getItemInMainHand();
-        if(hand.getType() == Material.AIR)
+        EntityPlayer p = (EntityPlayer) cs;
+        ItemStack hand = p.getHeldItemMainhand();
+        if(hand == ItemStack.EMPTY)
         {
         {
             this.getModule().send(cs, "Du musst ein Item in der Hand halten.");
             this.getModule().send(cs, "Du musst ein Item in der Hand halten.");
             return true;
             return true;
@@ -44,7 +44,8 @@ public class CommandEnchant extends ModuleCommand
         {
         {
             return false;
             return false;
         }
         }
-        Enchantment ench = Enchantment.getByName(arg[0]);
+        // TODO
+        /*Enchantment ench = Enchantment.getByName(arg[0]);
         if(ench == null)
         if(ench == null)
         {
         {
             this.getModule().send(cs, "Das gegebene Enchantment existiert nicht.");
             this.getModule().send(cs, "Das gegebene Enchantment existiert nicht.");
@@ -65,7 +66,7 @@ public class CommandEnchant extends ModuleCommand
         catch(NumberFormatException ex)
         catch(NumberFormatException ex)
         {
         {
             this.getModule().send(cs, GlobalText.noPositiveNaturalNumber());            
             this.getModule().send(cs, GlobalText.noPositiveNaturalNumber());            
-        }
+        }*/
         return true;
         return true;
     }
     }
 }
 }

+ 18 - 17
src/main/java/me/km/commands/CommandFeed.java

@@ -1,27 +1,28 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.kt.api.Utils;
-import me.kt.api.GlobalText;
-import me.kt.api.Module;
-import me.kt.api.ModuleCommand;
-import me.kt.exceptions.PlayerNotFoundException;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
+import me.km.api.Utils;
+import me.km.api.GlobalText;
+import me.km.api.Module;
+import me.km.api.ModuleCommand;
+import me.km.exception.PlayerNotFoundException;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
 
 
 public class CommandFeed extends ModuleCommand
 public class CommandFeed extends ModuleCommand
 {
 {
     public CommandFeed(Module m) 
     public CommandFeed(Module m) 
     {
     {
         super("feed", m);
         super("feed", m);
-        this.setDescription("Sättigt den Hunger eines Spielers");
-        this.setUsage("/feed [player]");
-        this.setPermission("kt.feed");
+        super.setDescription("Sättigt den Hunger eines Spielers");
+        super.setUsage("/feed [player]");
+        super.setPermission(Permissions.FEED);
     }
     }
 
 
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
-        Player affectedPlayer;
+        EntityPlayer affectedPlayer;
         Module m = this.getModule();
         Module m = this.getModule();
         try
         try
         {
         {
@@ -36,17 +37,17 @@ public class CommandFeed extends ModuleCommand
         }
         }
         catch(IndexOutOfBoundsException ex)
         catch(IndexOutOfBoundsException ex)
         {
         {
-            if(!(cs instanceof Player))
+            if(!(cs instanceof EntityPlayer))
             {
             {
                 m.send(cs, GlobalText.missingParameter());
                 m.send(cs, GlobalText.missingParameter());
                 return true;
                 return true;
             }     
             }     
-            affectedPlayer = (Player) cs;
+            affectedPlayer = (EntityPlayer) cs;
             m.send(affectedPlayer, "Dein Hunger wurde gesättigt.");
             m.send(affectedPlayer, "Dein Hunger wurde gesättigt.");
         }
         }
-        affectedPlayer.setFoodLevel(20);
-        affectedPlayer.setExhaustion(16);
-        affectedPlayer.setSaturation(16);
+        affectedPlayer.getFoodStats().setFoodLevel(20);
+        affectedPlayer.getFoodStats().addExhaustion(16);
+        affectedPlayer.getFoodStats().setFoodSaturationLevel(16);
         return true;
         return true;
     }
     }
 }
 }

+ 14 - 16
src/main/java/me/km/commands/CommandGrow.java

@@ -1,34 +1,32 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.kt.api.GlobalText;
-import me.kt.api.Module;
-import me.kt.api.ModuleCommand;
-import org.bukkit.CropState;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockState;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.material.Crops;
+import me.km.api.GlobalText;
+import me.km.api.Module;
+import me.km.api.ModuleCommand;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
 
 
 public class CommandGrow extends ModuleCommand
 public class CommandGrow extends ModuleCommand
 {
 {
     public CommandGrow(Module m) 
     public CommandGrow(Module m) 
     {
     {
         super("grow", m);
         super("grow", m);
-        this.setDescription("Lässt die Pflanzen in deiner Umgebung wachsen");
-        this.setUsage("/grow");
-        this.setPermission("kt.grow");
+        super.setDescription("Lässt die Pflanzen in deiner Umgebung wachsen");
+        super.setUsage("/grow");
+        super.setPermission(Permissions.GROW);
     }
     }
 
 
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
-        if(!(cs instanceof Player))
+        if(!(cs instanceof EntityPlayer))
         {
         {
             this.getModule().send(cs, GlobalText.onlyPlayer());
             this.getModule().send(cs, GlobalText.onlyPlayer());
             return true;
             return true;
         }
         }
-        Block l = ((Player) cs).getLocation().getBlock();
+        // TODO
+        /*Block l = ((EntityPlayer) cs).getLocation().getBlock();
         Block b;
         Block b;
         for(int x = -3; x < 4; x++)
         for(int x = -3; x < 4; x++)
         {
         {
@@ -52,7 +50,7 @@ public class CommandGrow extends ModuleCommand
                 }
                 }
             }
             }
         }
         }
-        this.getModule().send(cs, "Die Pflanzen in deiner Umgebung sind gewachsen.");
+        this.getModule().send(cs, "Die Pflanzen in deiner Umgebung sind gewachsen.");*/
         return true;
         return true;
     }
     }
 }
 }

+ 23 - 28
src/main/java/me/km/commands/CommandItemInfo.java

@@ -1,52 +1,47 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.kt.api.GlobalText;
-import me.kt.api.Module;
-import me.kt.api.ModuleCommand;
-import me.kt.nms.NmsUtilities;
-import org.bukkit.Material;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
+import me.km.api.GlobalText;
+import me.km.api.Module;
+import me.km.api.ModuleCommand;
+import me.km.nms.NmsUtilities;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.text.ITextComponent;
+import net.minecraft.util.text.TextComponentString;
 
 
 public class CommandItemInfo extends ModuleCommand
 public class CommandItemInfo extends ModuleCommand
 {
 {
     public CommandItemInfo(Module m) 
     public CommandItemInfo(Module m) 
     {
     {
         super("iteminfo", m);
         super("iteminfo", m);
-        this.setDescription("Gibt Information über ein Item aus");
-        this.setUsage("/iteminfo");
-        this.setPermission("kt.iteminfo");
+        super.setDescription("Gibt Information über ein Item aus");
+        super.setUsage("/iteminfo");
+        super.setPermission(Permissions.ITEMINFO);
     }
     }
 
 
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
-        if(!(cs instanceof Player))
+        if(!(cs instanceof EntityPlayerMP))
         {
         {
             this.getModule().send(cs, GlobalText.onlyPlayer());
             this.getModule().send(cs, GlobalText.onlyPlayer());
             return true;
             return true;
         }
         }
         Module m = this.getModule();
         Module m = this.getModule();
-        Player p = (Player) cs;
-        ItemStack stack = p.getInventory().getItemInMainHand();
-        if(stack == null || stack.getType() == Material.AIR)
+        EntityPlayerMP p = (EntityPlayerMP) cs;
+        ItemStack stack = p.getHeldItemMainhand();
+        if(stack == null || stack == ItemStack.EMPTY)
         {
         {
             m.send(cs, "Du musst ein Item in der Hand halten.");
             m.send(cs, "Du musst ein Item in der Hand halten.");
             return true;
             return true;
         }
         }
-        cs.sendMessage(GlobalText.Spacer());
-        m.send(cs, "DV: §6" + stack.getDurability());
-        m.send(cs, "Spigotname: §6" + stack.getType().toString().toLowerCase());
-        m.send(cs, "Mojangname: §6" + NmsUtilities.getStackType(stack));
-        try
-        {
-            m.send(cs, "Meta: §6" + stack.getItemMeta().toString());
-        }
-        catch(java.lang.NullPointerException ex)
-        {
-            m.send(cs, "Meta: §cFehler beim Lesen");
-        }
+        cs.sendMessage(new TextComponentString(GlobalText.Spacer()));
+        m.send(cs, "DV: §6" + stack.getItemDamage());
+        m.send(cs, "Meta: §6" + stack.getMetadata());
+        m.send(cs, "Item: §6" + stack.getItem());
         NmsUtilities.sendCopyableText(p, NmsUtilities.getNbtString(stack).replace("\"", "'"));
         NmsUtilities.sendCopyableText(p, NmsUtilities.getNbtString(stack).replace("\"", "'"));
         return true;
         return true;
     }
     }

+ 0 - 1
src/main/java/me/km/commands/CommandKick.java

@@ -7,7 +7,6 @@ import me.km.api.ModuleCommand;
 import me.km.exception.PlayerNotFoundException;
 import me.km.exception.PlayerNotFoundException;
 import me.km.permissions.Permissions;
 import me.km.permissions.Permissions;
 import net.minecraft.command.ICommandSender;
 import net.minecraft.command.ICommandSender;
-import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.entity.player.EntityPlayerMP;
 import net.minecraft.entity.player.EntityPlayerMP;
 
 
 public class CommandKick extends ModuleCommand
 public class CommandKick extends ModuleCommand

+ 8 - 7
src/main/java/me/km/commands/CommandMemory.java

@@ -1,21 +1,22 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.kt.api.Module;
-import me.kt.api.ModuleCommand;
-import org.bukkit.command.CommandSender;
+import me.km.api.Module;
+import me.km.api.ModuleCommand;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
 
 
 public class CommandMemory extends ModuleCommand
 public class CommandMemory extends ModuleCommand
 {
 {
     public CommandMemory(Module m) 
     public CommandMemory(Module m) 
     {
     {
         super("memory", m);
         super("memory", m);
-        this.setDescription("Gibt RAM Information aus");
-        this.setUsage("/memory");
-        this.setPermission("kt.memory");
+        super.setDescription("Gibt RAM Information aus");
+        super.setUsage("/memory");
+        super.setPermission(Permissions.MEMORY);
     }
     }
 
 
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
         Runtime runtime = Runtime.getRuntime();
         Runtime runtime = Runtime.getRuntime();
         long allocatedMemory = runtime.totalMemory() / 1048576;
         long allocatedMemory = runtime.totalMemory() / 1048576;

+ 22 - 20
src/main/java/me/km/commands/CommandMsg.java

@@ -1,15 +1,17 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.kt.api.Utils;
-import me.kt.api.GlobalText;
-import me.kt.api.Module;
-import me.kt.api.ModuleCommand;
-import me.kt.chatmanager.ChatManager;
-import me.kt.exceptions.PlayerNotFoundException;
+import me.km.api.Utils;
+import me.km.api.GlobalText;
+import me.km.api.Module;
+import me.km.api.ModuleCommand;
+import me.km.chatmanager.ChatManager;
+import me.km.exception.PlayerNotFoundException;
 import java.util.HashMap;
 import java.util.HashMap;
-import org.bukkit.Bukkit;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
+import me.km.KajetansMod;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.text.TextComponentString;
 
 
 public class CommandMsg extends ModuleCommand
 public class CommandMsg extends ModuleCommand
 {
 {
@@ -18,15 +20,15 @@ public class CommandMsg extends ModuleCommand
     public CommandMsg(Module m) 
     public CommandMsg(Module m) 
     {
     {
         super("msg", m);
         super("msg", m);
-        this.setDescription("Schreibt dem Spieler eine Privatnachricht");
-        this.setUsage("/msg <player> <message> oder /r <message>");
-        this.setPermission("kt.msg");
+        super.setDescription("Schreibt dem Spieler eine Privatnachricht");
+        super.setUsage("/msg <player> <message> oder /r <message>");
+        super.setPermission(Permissions.MSG);
         
         
         answer = new HashMap<>();
         answer = new HashMap<>();
     }
     }
 
 
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
         if(!string.equalsIgnoreCase("r"))
         if(!string.equalsIgnoreCase("r"))
         {
         {
@@ -34,7 +36,7 @@ public class CommandMsg extends ModuleCommand
             {
             {
                 return false;
                 return false;
             }
             }
-            Player affectedPlayer;
+            EntityPlayer affectedPlayer;
             try
             try
             {
             {
                 affectedPlayer = Utils.getPlayerByName(arg[0]);                   
                 affectedPlayer = Utils.getPlayerByName(arg[0]);                   
@@ -45,8 +47,8 @@ public class CommandMsg extends ModuleCommand
                 return true;
                 return true;
             }
             }
             String message = ChatManager.colorMessage(Utils.connectSpaces(arg, 1), cs);
             String message = ChatManager.colorMessage(Utils.connectSpaces(arg, 1), cs);
-            cs.sendMessage("§6[ -> §c" + affectedPlayer.getName() + "§6] §r" + message);
-            affectedPlayer.sendMessage("§6[§c" + cs.getName()+ "§6] §r" + message);
+            cs.sendMessage(new TextComponentString("§6[ -> §c" + affectedPlayer.getName() + "§6] §r" + message));
+            affectedPlayer.sendMessage(new TextComponentString("§6[§c" + cs.getName()+ "§6] §r" + message));
             answer.put(cs.getName(), affectedPlayer.getName());
             answer.put(cs.getName(), affectedPlayer.getName());
             answer.put(affectedPlayer.getName(), cs.getName());
             answer.put(affectedPlayer.getName(), cs.getName());
             return true;
             return true;
@@ -61,10 +63,10 @@ public class CommandMsg extends ModuleCommand
             this.getModule().send(cs, "Du hast niemanden, dem du antworten könntest.");
             this.getModule().send(cs, "Du hast niemanden, dem du antworten könntest.");
             return true;
             return true;
         }
         }
-        CommandSender previous;
+        ICommandSender previous;
         if(s.equals("CONSOLE"))
         if(s.equals("CONSOLE"))
         {
         {
-            previous = Bukkit.getConsoleSender();
+            previous = KajetansMod.server;
         }
         }
         else
         else
         {
         {
@@ -80,8 +82,8 @@ public class CommandMsg extends ModuleCommand
         }
         }
         
         
         String message = ChatManager.colorMessage(Utils.connectSpaces(arg, 0), cs);
         String message = ChatManager.colorMessage(Utils.connectSpaces(arg, 0), cs);
-        cs.sendMessage("§6[ -> §c" + previous.getName()+ "§6] §r" + message);
-        previous.sendMessage("§6[§c" + cs.getName()+ "§6] §r" + message);
+        cs.sendMessage(new TextComponentString("§6[ -> §c" + previous.getName()+ "§6] §r" + message));
+        previous.sendMessage(new TextComponentString("§6[§c" + cs.getName()+ "§6] §r" + message));
         answer.put(cs.getName(), previous.getName());
         answer.put(cs.getName(), previous.getName());
         answer.put(previous.getName(), cs.getName());
         answer.put(previous.getName(), cs.getName());
         return true;  
         return true;  

+ 18 - 18
src/main/java/me/km/commands/CommandPosition.java

@@ -1,39 +1,39 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.kt.api.Utils;
-import me.kt.api.GlobalText;
-import me.kt.api.Module;
-import me.kt.api.ModuleCommand;
-import org.bukkit.Location;
-import org.bukkit.block.Block;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
+import me.km.api.Utils;
+import me.km.api.GlobalText;
+import me.km.api.Module;
+import me.km.api.ModuleCommand;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.math.BlockPos;
 
 
 public class CommandPosition extends ModuleCommand
 public class CommandPosition extends ModuleCommand
 {
 {
     public CommandPosition(Module m) 
     public CommandPosition(Module m) 
     {
     {
         super("position", m);
         super("position", m);
-        this.setDescription("Zeigt deine Position an");
-        this.setUsage("/position");
-        this.setPermission("kt.position");
+        super.setDescription("Zeigt deine Position an");
+        super.setUsage("/position");
+        super.setPermission(Permissions.POSITION);
     }
     }
 
 
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
-        if(!(cs instanceof Player))
+        if(!(cs instanceof EntityPlayer))
         {
         {
             this.getModule().send(cs, GlobalText.onlyPlayer());
             this.getModule().send(cs, GlobalText.onlyPlayer());
             return true;
             return true;
         }
         }
-        Player p = (Player) cs;
+        EntityPlayer p = (EntityPlayer) cs;
         Module m = this.getModule();
         Module m = this.getModule();
-        m.send(cs, "Welt: " + p.getWorld().getName());
-        Location l = p.getLocation();
+        m.send(cs, "Welt: " + p.getEntityWorld().getWorldInfo().getWorldName());
+        BlockPos l = p.getPosition();
         m.send(cs, "Koordinaten: " + l.getX() + " | " + l.getY() + " | " + l.getZ());
         m.send(cs, "Koordinaten: " + l.getX() + " | " + l.getY() + " | " + l.getZ());
-        m.send(cs, "Yaw: " + l.getYaw());
-        m.send(cs, "Pitch: " + l.getPitch());
+        m.send(cs, "Yaw: " + p.rotationYaw);
+        m.send(cs, "Pitch: " + p.rotationPitch);
         return true;
         return true;
     }
     }
 }
 }

+ 38 - 43
src/main/java/me/km/commands/CommandPotion.java

@@ -1,48 +1,50 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.kt.api.GlobalText;
-import me.kt.api.Module;
-import me.kt.api.ModuleCommand;
-import me.kt.api.SimpleTabCompleter;
+import java.util.ArrayList;
+import me.km.api.GlobalText;
+import me.km.api.Module;
 import java.util.Arrays;
 import java.util.Arrays;
-import org.bukkit.Material;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.PotionMeta;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
+import me.km.api.ModuleTabCommand;
+import me.km.api.Utils;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.potion.PotionUtils;
 
 
-public class CommandPotion extends ModuleCommand
+public class CommandPotion extends ModuleTabCommand
 {
 {
     public CommandPotion(Module m) 
     public CommandPotion(Module m) 
     {
     {
-        super("potion", m);
-        this.setDescription("Erzeugt Custom-Potions");
-        this.setUsage("/potion [clear] [effect] [duration] [amplifier]");
-        this.setPermission("kt.potion");
-        
-        m.registerTabCompleter("potion", new SimpleTabCompleter(Arrays.asList(new String[]{
-            "ABSORPTION", "BLINDNESS", "CONFUSION", "DAMAGE_RESISTANCE", "FAST_DIGGING",
-            "FIRE_RESISTANCE", "GLOWING", "HARM", "HEAL", "HEALTH_BOOST", "HUNGER",
-            "INCREASE_DAMAGE", "INVISIBILITY", "JUMP", "LEVITATION", "LUCK", "POISON",
-            "REGENERATION", "SATURATION", "SLOW", "SLOW_DIGGING", "SPEED", "UNLUCK",
-            "WATER_BREATHING", "WEAKNESS", "WITHER"}), 1));
+        super("potion", m, Arrays.asList(new String[]
+        {
+            "SPEED", "SLOWNESS", "HASTE", "MINING_FATIGUE", "STRENGTH", "INSTANT_HEALTH",
+            "INSTANT_DAMAGE", "JUMP_BOOST", "NAUSEA", "REGENERATION", "RESISTANCE",
+            "FIRE_RESISTANCE", "WATER_BREATHING", "INVISIBILITY", "BLINDNESS",
+            "NIGHT_VISION", "HUNGER", "WEAKNESS" ,"POISON", "WITHER", "HEALTH_BOOST",
+            "ABSORPTION", "SATURATION", "GLOWING", "LEVITATION", "LUCK", "UNLUCK"
+        }), 0);  
+        super.setDescription("Erzeugt Custom-Potions");
+        super.setUsage("/potion [effect] [duration] [amplifier]");
+        super.setPermission(Permissions.POTION);
     }
     }
 
 
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
-        if(!(cs instanceof Player))
+        if(!(cs instanceof EntityPlayer))
         {
         {
             this.getModule().send(cs, GlobalText.onlyPlayer());
             this.getModule().send(cs, GlobalText.onlyPlayer());
             return true;
             return true;
         }
         }
-        Player p = (Player) cs;
-        ItemStack hand = p.getInventory().getItemInMainHand();
-        if(hand.getType() != Material.SPLASH_POTION &&
-           hand.getType() != Material.POTION &&
-           hand.getType() != Material.LINGERING_POTION)
+        EntityPlayer p = (EntityPlayer) cs;
+        ItemStack hand = p.getHeldItemMainhand();
+        if(hand.getItem() != Items.SPLASH_POTION &&
+           hand.getItem() != Items.POTIONITEM &&
+           hand.getItem() != Items.LINGERING_POTION)
         {
         {
             this.getModule().send(cs, "Du musst einen Trank in der Hand halten.");
             this.getModule().send(cs, "Du musst einen Trank in der Hand halten.");
             return true;
             return true;
@@ -51,18 +53,13 @@ public class CommandPotion extends ModuleCommand
         {
         {
             return false;
             return false;
         }
         }
-        PotionMeta meta = (PotionMeta) hand.getItemMeta();
-        if(arg[0].equals("clear"))
-        {
-            meta.clearCustomEffects();
-            hand.setItemMeta(meta);
-            p.getInventory().setItemInMainHand(hand);
-            this.getModule().send(cs, "Alle Custom-Effekte wurden entfernt");
-            return true;
-        }
+
         try
         try
         {
         {
-            meta.addCustomEffect(new PotionEffect(PotionEffectType.getByName(arg[0].toUpperCase()), Integer.parseInt(arg[1]), Integer.parseInt(arg[2])), true);
+            NBTTagCompound com = hand.getTagCompound();
+            ArrayList<PotionEffect> list = new ArrayList<>();
+            list.add(new PotionEffect(Utils.getPotion(arg[0]), Integer.parseInt(arg[1]), Integer.parseInt(arg[2])));
+            PotionUtils.addCustomPotionEffectToList(com, list);
             this.getModule().send(cs, "Der Effekt wurde hinzugefügt.");
             this.getModule().send(cs, "Der Effekt wurde hinzugefügt.");
         }
         }
         catch(NumberFormatException ex)
         catch(NumberFormatException ex)
@@ -70,7 +67,7 @@ public class CommandPotion extends ModuleCommand
             this.getModule().send(cs, GlobalText.noIntegerNumber());
             this.getModule().send(cs, GlobalText.noIntegerNumber());
             return true;
             return true;
         }
         }
-        catch(IllegalArgumentException ex)
+        catch(NullPointerException ex)
         {
         {
             this.getModule().send(cs, "Der gegebene Potion-Effect existiert nicht.");
             this.getModule().send(cs, "Der gegebene Potion-Effect existiert nicht.");
             return true;
             return true;
@@ -79,8 +76,6 @@ public class CommandPotion extends ModuleCommand
         {
         {
             return false;
             return false;
         }
         }
-        hand.setItemMeta(meta);
-        p.getInventory().setItemInMainHand(hand);
         return true;
         return true;
     }
     }
 }
 }

+ 22 - 19
src/main/java/me/km/commands/CommandSeen.java

@@ -1,48 +1,51 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.kt.KajetansTools;
-import me.kt.api.Utils;
-import me.kt.api.Module;
-import me.kt.api.ModuleCommand;
-import me.kt.playerbank.PlayerBank;
-import me.kt.exceptions.PlayerNotFoundException;
+import java.io.File;
+import me.km.KajetansMod;
+import me.km.api.Utils;
+import me.km.api.Module;
+import me.km.api.ModuleCommand;
+import me.km.exception.PlayerNotFoundException;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Date;
-import java.util.UUID;
-import org.bukkit.Bukkit;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
 
 
 public class CommandSeen extends ModuleCommand
 public class CommandSeen extends ModuleCommand
 {
 {
     public CommandSeen(Module m) 
     public CommandSeen(Module m) 
     {
     {
         super("seen", m);
         super("seen", m);
-        this.setDescription("Zeigt wann ein Spieler zuletzt online war");
-        this.setUsage("/seen <player>");
-        this.setPermission("kt.seen");
+        super.setDescription("Zeigt wann ein Spieler zuletzt online war");
+        super.setUsage("/seen <player>");
+        super.setPermission(Permissions.SEEN);
     }
     }
 
 
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
         try
         try
         {
         {
-            Player p = Utils.getPlayerByName(arg[0]);  
+            EntityPlayer p = Utils.getPlayerByName(arg[0]);  
             this.getModule().send(cs, p.getName() + " ist gerade online.");
             this.getModule().send(cs, p.getName() + " ist gerade online.");
             return true;
             return true;
         }
         }
         catch(PlayerNotFoundException ex)
         catch(PlayerNotFoundException ex)
         {
         {
-            String uuid = KajetansTools.playerbank.getDataBank(PlayerBank.class).getUUID(arg[0]);
+            String uuid = KajetansMod.playerbank.getDataBank().getUUID(arg[0]);
             if(uuid == null)
             if(uuid == null)
             {
             {
                 this.getModule().send(cs, arg[0] + " war noch nie auf dem Server.");
                 this.getModule().send(cs, arg[0] + " war noch nie auf dem Server.");
                 return true;
                 return true;
             }
             }
-            OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(UUID.fromString(uuid));           
-            Date date = new Date(offPlayer.getLastPlayed());
+            File f = new File("./saves/world/playerdata/" + uuid + ".dat"); 
+            if(!f.exists())
+            {
+                this.getModule().send(cs, "Die Spielerdaten wurden nicht gefunden.");
+                return true;
+            }
+            Date date = new Date(f.lastModified());
             SimpleDateFormat ft = new SimpleDateFormat ("dd.MM.yyyy 'um' HH:mm:ss");
             SimpleDateFormat ft = new SimpleDateFormat ("dd.MM.yyyy 'um' HH:mm:ss");
             this.getModule().send(cs, arg[0] + " war zuletzt am " + ft.format(date) + " online.");
             this.getModule().send(cs, arg[0] + " war zuletzt am " + ft.format(date) + " online.");
             return true;
             return true;

+ 19 - 18
src/main/java/me/km/commands/CommandSpeed.java

@@ -1,25 +1,26 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.kt.api.Utils;
-import me.kt.api.GlobalText;
-import me.kt.api.Module;
-import me.kt.api.ModuleCommand;
-import me.kt.exceptions.PlayerNotFoundException;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
+import me.km.api.Utils;
+import me.km.api.GlobalText;
+import me.km.api.Module;
+import me.km.api.ModuleCommand;
+import me.km.exception.PlayerNotFoundException;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
 
 
 public class CommandSpeed extends ModuleCommand
 public class CommandSpeed extends ModuleCommand
 {
 {
     public CommandSpeed(Module m) 
     public CommandSpeed(Module m) 
     {
     {
         super("speed", m);
         super("speed", m);
-        this.setDescription("Setzt das Tempo eines Spielers");
-        this.setUsage("/speed <1-10> [player]");
-        this.setPermission("kt.speed");
+        super.setDescription("Setzt das Tempo eines Spielers");
+        super.setUsage("/speed <1-10> [player]");
+        super.setPermission(Permissions.SPEED);
     }
     }
 
 
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
         if(arg.length == 0)
         if(arg.length == 0)
         {
         {
@@ -46,12 +47,12 @@ public class CommandSpeed extends ModuleCommand
         }     
         }     
         float f = i / 20f;
         float f = i / 20f;
         
         
-        Player affectedPlayer;
+        EntityPlayer affectedPlayer;
         try
         try
         {
         {
             affectedPlayer = Utils.getPlayerByName(arg[1]);  
             affectedPlayer = Utils.getPlayerByName(arg[1]);  
-            affectedPlayer.setFlySpeed(f);
-            affectedPlayer.setWalkSpeed(f * 2);
+            affectedPlayer.capabilities.setFlySpeed(f);
+            affectedPlayer.capabilities.setPlayerWalkSpeed(f * 2);
             this.getModule().send(affectedPlayer, "Du hast nun Tempo " + i + ".");
             this.getModule().send(affectedPlayer, "Du hast nun Tempo " + i + ".");
             this.getModule().send(cs, affectedPlayer.getName() + " hat nun Tempo " + i + ".");
             this.getModule().send(cs, affectedPlayer.getName() + " hat nun Tempo " + i + ".");
         }
         }
@@ -62,14 +63,14 @@ public class CommandSpeed extends ModuleCommand
         }
         }
         catch(IndexOutOfBoundsException ex)
         catch(IndexOutOfBoundsException ex)
         {
         {
-            if(!(cs instanceof Player))
+            if(!(cs instanceof EntityPlayer))
             {
             {
                 this.getModule().send(cs, GlobalText.missingParameter());
                 this.getModule().send(cs, GlobalText.missingParameter());
                 return true;
                 return true;
             }     
             }     
-            affectedPlayer = (Player) cs;
-            affectedPlayer.setFlySpeed(f);
-            affectedPlayer.setWalkSpeed(f * 2);
+            affectedPlayer = (EntityPlayer) cs;
+            affectedPlayer.capabilities.setFlySpeed(f);
+            affectedPlayer.capabilities.setPlayerWalkSpeed(f * 2);
             this.getModule().send(affectedPlayer, "Du hast nun Tempo " + i + ".");
             this.getModule().send(affectedPlayer, "Du hast nun Tempo " + i + ".");
         } 
         } 
         return true;
         return true;

+ 19 - 17
src/main/java/me/km/commands/CommandTeleportAccept.java

@@ -1,13 +1,15 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.kt.api.GlobalText;
-import me.kt.api.Module;
-import me.kt.api.ModuleCommand;
+import me.km.api.GlobalText;
+import me.km.api.Module;
+import me.km.api.ModuleCommand;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.UUID;
 import java.util.UUID;
-import org.bukkit.Bukkit;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
+import me.km.KajetansMod;
+import me.km.api.Utils;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
 
 
 public class CommandTeleportAccept extends ModuleCommand
 public class CommandTeleportAccept extends ModuleCommand
 {
 {
@@ -16,36 +18,36 @@ public class CommandTeleportAccept extends ModuleCommand
     public CommandTeleportAccept(Module m) 
     public CommandTeleportAccept(Module m) 
     {
     {
         super("teleportaccept", m);
         super("teleportaccept", m);
-        this.setDescription("Akzeptiert eine Teleportanfrage");
-        this.setUsage("/teleportaccept");
-        this.setPermission("kt.teleportaccept");
+        super.setDescription("Akzeptiert eine Teleportanfrage");
+        super.setUsage("/teleportaccept");
+        super.setPermission(Permissions.TELEPORT_ACCEPT);
         
         
         tpaccept = new HashMap<>();
         tpaccept = new HashMap<>();
     }
     }
 
 
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
-        if(!(cs instanceof Player))
+        if(!(cs instanceof EntityPlayer))
         {
         {
             this.getModule().send(cs, GlobalText.onlyPlayer());
             this.getModule().send(cs, GlobalText.onlyPlayer());
             return true;
             return true;
         }
         }
-        Player p = (Player) cs;
-        if(!tpaccept.containsKey(p.getUniqueId()))
+        EntityPlayer p = (EntityPlayer) cs;
+        if(!tpaccept.containsKey(p.getUniqueID()))
         {
         {
             this.getModule().send(cs, "Du hast keine ausstehenden Teleportanfragen.");
             this.getModule().send(cs, "Du hast keine ausstehenden Teleportanfragen.");
             return true;
             return true;
         }
         }
-        Player affectedPlayer = Bukkit.getPlayer(tpaccept.get(p.getUniqueId()));
+        EntityPlayer affectedPlayer = KajetansMod.server.getPlayerList().getPlayerByUUID(tpaccept.get(p.getUniqueID()));
         if(affectedPlayer == null)
         if(affectedPlayer == null)
         {
         {
             this.getModule().send(cs, "Der Spieler ist nicht mehr online.");
             this.getModule().send(cs, "Der Spieler ist nicht mehr online.");
-            tpaccept.remove(p.getUniqueId());
+            tpaccept.remove(p.getUniqueID());
             return true;
             return true;
         }            
         }            
-        tpaccept.remove(p.getUniqueId());
-        affectedPlayer.teleport(p);
+        tpaccept.remove(p.getUniqueID());
+        Utils.teleportEntity(affectedPlayer, p);
         this.getModule().send(affectedPlayer, "Du wurdest zu " + p.getName() + " teleportiert.");
         this.getModule().send(affectedPlayer, "Du wurdest zu " + p.getName() + " teleportiert.");
         this.getModule().send(p, affectedPlayer.getName() + " hat sich zu dir teleportiert.");
         this.getModule().send(p, affectedPlayer.getName() + " hat sich zu dir teleportiert.");
         return true;
         return true;

+ 15 - 37
src/main/java/me/km/commands/CommandTime.java

@@ -1,63 +1,41 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.kt.api.GlobalText;
-import me.kt.api.Module;
-import me.kt.api.ModuleCommand;
-import org.bukkit.Bukkit;
-import org.bukkit.World;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
+import me.km.api.GlobalText;
+import me.km.api.Module;
+import me.km.api.ModuleCommand;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
 
 
 public class CommandTime extends ModuleCommand
 public class CommandTime extends ModuleCommand
 {
 {
     public CommandTime(Module m) 
     public CommandTime(Module m) 
     {
     {
         super("time", m);
         super("time", m);
-        this.setDescription("Setzt die Tageszeit in einer Welt");
-        this.setUsage("/time <day|night|ticks_as_number> [world]");
-        this.setPermission("kt.time");
+        super.setDescription("Setzt die Tageszeit in einer Welt");
+        super.setUsage("/time <day|night|ticks_as_number>");
+        super.setPermission(Permissions.TIME);
     }
     }
 
 
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
         if(arg.length == 0)
         if(arg.length == 0)
         {
         {
             return false;
             return false;
         }
         }
         
         
-        World w;
-        if(arg.length < 2)
-        {
-            if(cs instanceof Player)
-            {
-                w = ((Player) cs).getWorld();
-            }
-            else
-            {
-                this.getModule().send(cs, GlobalText.missingParameter());
-                return true;
-            }
-        }
-        else
-        {
-            w = Bukkit.getWorld(arg[1]);
-            if(w == null)
-            {
-                this.getModule().send(cs, "Die angegebene Welt wurde nicht gefunden.");
-                return true;
-            }
-        }
-        
+        World w = ((EntityPlayer) cs).getEntityWorld();
         if(arg[0].equals("day"))
         if(arg[0].equals("day"))
         {
         {
-            w.setTime(0);
+            w.setWorldTime(0);
             this.getModule().send(cs, "Die Tageszeit wurde auf 0 gesetzt.");
             this.getModule().send(cs, "Die Tageszeit wurde auf 0 gesetzt.");
             return true;
             return true;
         }
         }
         else if(arg[0].equals("night"))
         else if(arg[0].equals("night"))
         {
         {
-            w.setTime(14000);
+            w.setWorldTime(14000);
             this.getModule().send(cs, "Die Tageszeit wurde auf 14000 gesetzt.");
             this.getModule().send(cs, "Die Tageszeit wurde auf 14000 gesetzt.");
             return true;
             return true;
         }
         }
@@ -69,7 +47,7 @@ public class CommandTime extends ModuleCommand
                 this.getModule().send(cs, GlobalText.noNaturalNumber());
                 this.getModule().send(cs, GlobalText.noNaturalNumber());
                 return true;
                 return true;
             }
             }
-            w.setTime(time);
+            w.setWorldTime(time);
             this.getModule().send(cs, "Die Tageszeit wurde auf " + arg[0] + " gesetzt.");
             this.getModule().send(cs, "Die Tageszeit wurde auf " + arg[0] + " gesetzt.");
             return true;
             return true;
         }
         }

+ 23 - 16
src/main/java/me/km/commands/CommandTop.java

@@ -1,28 +1,32 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.kt.api.Utils;
-import me.kt.api.GlobalText;
-import me.kt.api.Module;
-import me.kt.api.ModuleCommand;
-import me.kt.playerbank.PlayerBank;
-import me.kt.exceptions.PlayerNotFoundException;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
+import me.km.api.Utils;
+import me.km.api.GlobalText;
+import me.km.api.Location;
+import me.km.api.Module;
+import me.km.api.ModuleCommand;
+import me.km.playerbank.PlayerBank;
+import me.km.exception.PlayerNotFoundException;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.math.Vec3d;
+import net.minecraft.world.World;
 
 
 public class CommandTop extends ModuleCommand
 public class CommandTop extends ModuleCommand
 {
 {
     public CommandTop(Module m) 
     public CommandTop(Module m) 
     {
     {
         super("top", m);
         super("top", m);
-        this.setDescription("Teleportiert einen Spieler nach oben");
-        this.setUsage("/top [player]");
-        this.setPermission("kt.top");
+        super.setDescription("Teleportiert einen Spieler nach oben");
+        super.setUsage("/top [player]");
+        super.setPermission(Permissions.TOP);
     }
     }
 
 
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
-        Player affectedPlayer;
+        EntityPlayer affectedPlayer;
         try
         try
         {
         {
             affectedPlayer = Utils.getPlayerByName(arg[0]); 
             affectedPlayer = Utils.getPlayerByName(arg[0]); 
@@ -34,14 +38,17 @@ public class CommandTop extends ModuleCommand
         }
         }
         catch(IndexOutOfBoundsException ex)
         catch(IndexOutOfBoundsException ex)
         {
         {
-            if(!(cs instanceof Player))
+            if(!(cs instanceof EntityPlayer))
             {
             {
                 this.getModule().send(cs, GlobalText.missingParameter());
                 this.getModule().send(cs, GlobalText.missingParameter());
                 return true;
                 return true;
             }     
             }     
-            affectedPlayer = (Player) cs;
+            affectedPlayer = (EntityPlayer) cs;
         }
         }
-        affectedPlayer.teleport(affectedPlayer.getWorld().getHighestBlockAt(affectedPlayer.getLocation()).getLocation().add(0.5, 0, 0.5));
+        World w = affectedPlayer.getEntityWorld();
+        Vec3d v = affectedPlayer.getPositionVector();
+        v = v.addVector(0, w.getHeight((int) v.xCoord, (int) v.zCoord) - v.yCoord, 0);
+        Utils.teleportEntity(affectedPlayer, new Location(w, v));
         this.getModule().send(cs, "Du wurdest nach oben teleportiert.");
         this.getModule().send(cs, "Du wurdest nach oben teleportiert.");
         if(!cs.equals(affectedPlayer))
         if(!cs.equals(affectedPlayer))
         {
         {

+ 27 - 24
src/main/java/me/km/commands/CommandTpPos.java

@@ -1,34 +1,35 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.kt.api.Utils;
-import me.kt.api.GlobalText;
-import me.kt.api.Module;
-import me.kt.api.ModuleCommand;
-import me.kt.exceptions.PlayerNotFoundException;
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.World;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
+import me.km.permissions.Permissions;
+import me.km.api.Utils;
+import me.km.api.GlobalText;
+import me.km.api.Location;
+import me.km.api.Module;
+import me.km.api.ModuleCommand;
+import me.km.exception.PlayerNotFoundException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.math.Vec3d;
+import net.minecraft.world.World;
 
 
 public class CommandTpPos extends ModuleCommand
 public class CommandTpPos extends ModuleCommand
 {
 {
     public CommandTpPos(Module m) 
     public CommandTpPos(Module m) 
     {
     {
         super("tppos", m);
         super("tppos", m);
-        this.setDescription("Teleportiert einen Spieler zu Koordinaten");
-        this.setUsage("/tppos <x> <y> <z> [world] [player]");
-        this.setPermission("kt.tppos");
+        super.setDescription("Teleportiert einen Spieler zu Koordinaten");
+        super.setUsage("/tppos <x> <y> <z> [world] [player]");
+        super.setPermission(Permissions.TP_POS);
     }
     }
 
 
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
         if(arg.length < 3)
         if(arg.length < 3)
         {
         {
             return false;
             return false;
         }
         }
-        Player affectedPlayer;  
+        EntityPlayer affectedPlayer;  
         try
         try
         {
         {
             affectedPlayer = Utils.getPlayerByName(arg[4]);                   
             affectedPlayer = Utils.getPlayerByName(arg[4]);                   
@@ -40,28 +41,30 @@ public class CommandTpPos extends ModuleCommand
         }   
         }   
         catch(IndexOutOfBoundsException ex)
         catch(IndexOutOfBoundsException ex)
         {
         {
-            if(!(cs instanceof Player))
+            if(!(cs instanceof EntityPlayer))
             {
             {
                 this.getModule().send(cs, GlobalText.missingParameter());
                 this.getModule().send(cs, GlobalText.missingParameter());
                 return true;
                 return true;
             }
             }
-            affectedPlayer = (Player) cs;
+            affectedPlayer = (EntityPlayer) cs;
         } 
         } 
         
         
         try
         try
         {
         {
             World w;
             World w;
-            if(arg.length >= 4 && Bukkit.getWorld(arg[3]) != null)
+            // TODO
+            /*if(arg.length >= 4 && Bukkit.getWorld(arg[3]) != null)
             {
             {
                 w = Bukkit.getWorld(arg[3]);
                 w = Bukkit.getWorld(arg[3]);
             }
             }
             else
             else
-            {
-                w = affectedPlayer.getWorld();
-            }
-            Location l = new Location(w, Double.parseDouble(arg[0]), Double.parseDouble(arg[1]), Double.parseDouble(arg[2]));
-            affectedPlayer.teleport(l);
-            String s = " zu " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ() + " teleportiert.";
+            {*/
+                w = affectedPlayer.getEntityWorld();
+            //}
+            Vec3d v = new Vec3d(Double.parseDouble(arg[0]), Double.parseDouble(arg[1]), Double.parseDouble(arg[2]));
+            Location l = new Location(w, v);
+            Utils.teleportEntity(affectedPlayer, l);
+            String s = " zu " + v.xCoord + ", " + v.yCoord + ", " + v.zCoord + " teleportiert.";
             this.getModule().send(affectedPlayer, "Du wurdest" + s);
             this.getModule().send(affectedPlayer, "Du wurdest" + s);
             if(!cs.equals(affectedPlayer))
             if(!cs.equals(affectedPlayer))
             {
             {

+ 18 - 16
src/main/java/me/km/commands/CommandUser.java

@@ -1,25 +1,26 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.kt.KajetansTools;
-import me.kt.api.GlobalText;
-import me.kt.api.Module;
-import me.kt.api.ModuleCommand;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
+import com.mojang.authlib.GameProfile;
+import me.km.KajetansMod;
+import me.km.api.GlobalText;
+import me.km.api.Module;
+import me.km.api.ModuleCommand;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.util.text.TextComponentString;
 
 
 public class CommandUser extends ModuleCommand
 public class CommandUser extends ModuleCommand
 {
 {
     public CommandUser(Module m) 
     public CommandUser(Module m) 
     {
     {
         super("user", m);
         super("user", m);
-        this.setDescription("Gibt Informationen über einen Spieler");
-        this.setUsage("/user <name>");
-        this.setPermission("kt.user");
+        super.setDescription("Gibt Informationen über einen Spieler");
+        super.setUsage("/user <name>");
+        super.setPermission(Permissions.USER);
     }
     }
 
 
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
         if(arg.length < 1)
         if(arg.length < 1)
         {
         {
@@ -27,23 +28,24 @@ public class CommandUser extends ModuleCommand
         }
         }
         
         
         Module m = this.getModule();
         Module m = this.getModule();
-        OfflinePlayer op = KajetansTools.playerbank.getDataBank().getOfflinePlayer(arg[0]);
+        GameProfile op = KajetansMod.playerbank.getDataBank().getOfflinePlayer(arg[0]);
         if(op == null)
         if(op == null)
         {
         {
             m.send(cs, GlobalText.cantFindPlayer(arg[0]));
             m.send(cs, GlobalText.cantFindPlayer(arg[0]));
             return true;
             return true;
         }
         }
         
         
-        cs.sendMessage(GlobalText.Spacer());
+        cs.sendMessage(new TextComponentString(GlobalText.Spacer()));
         m.send(cs, op.getName());
         m.send(cs, op.getName());
-        m.sendHelpListElement(cs, "UUID", op.getUniqueId().toString());
-        m.sendHelpListElement(cs, "Gebannt", String.valueOf(op.isBanned()));
+        m.sendHelpListElement(cs, "UUID", op.getId().toString());
+        // TODO
+        /*m.sendHelpListElement(cs, "Gebannt", String.valueOf(op.));
         m.sendHelpListElement(cs, "Whitelisted", String.valueOf(op.isWhitelisted()));
         m.sendHelpListElement(cs, "Whitelisted", String.valueOf(op.isWhitelisted()));
         if(op.isOnline())
         if(op.isOnline())
         {
         {
             Player p = op.getPlayer();
             Player p = op.getPlayer();
             m.sendHelpListElement(cs, "IP", p.getAddress().getAddress().toString().substring(1));
             m.sendHelpListElement(cs, "IP", p.getAddress().getAddress().toString().substring(1));
-        }
+        }*/
         return true;
         return true;
     }
     }
 }
 }

+ 23 - 21
src/main/java/me/km/commands/CommandWarp.java

@@ -1,34 +1,36 @@
 package me.km.commands;
 package me.km.commands;
 
 
-import me.kt.api.GlobalText;
-import me.kt.api.Module;
-import me.kt.api.ModuleCommand;
-import me.kt.api.SimpleConfig;
-import me.kt.api.Utils;
-import me.kt.exceptions.PlayerNotFoundException;
+import me.km.api.GlobalText;
+import me.km.api.Module;
+import me.km.api.ModuleCommand;
+import me.km.api.SimpleConfig;
+import me.km.api.Utils;
+import me.km.exception.PlayerNotFoundException;
 import java.util.List;
 import java.util.List;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
-import org.bukkit.Location;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
+import me.km.api.Location;
+import me.km.permissions.Permissions;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+
 
 
 public class CommandWarp extends ModuleCommand
 public class CommandWarp extends ModuleCommand
 {
 {
     public CommandWarp(Module m) 
     public CommandWarp(Module m) 
     {
     {
         super("warp", m);
         super("warp", m);
-        this.setDescription("Teleportiert einen Spieler zum Warp");
-        this.setUsage("/warp <warpname> [player]");
-        this.setPermission("kt.warp");
+        super.setDescription("Teleportiert einen Spieler zum Warp");
+        super.setUsage("/warp <warpname> [player]");
+        super.setPermission(Permissions.WARP);
     }
     }
 
 
     public List<String> getWarps()
     public List<String> getWarps()
     {
     {
-        return SimpleConfig.getFiles("warp").stream().map(w -> w.getName().replace(".yml", "")).collect(Collectors.toList());
+        return SimpleConfig.getFiles("warp").stream().map(w -> w.getName().substring(0, w.getName().length() - 6)).collect(Collectors.toList());
     }
     }
     
     
     @Override
     @Override
-    public boolean execute(CommandSender cs, String string, String[] arg) 
+    public boolean execute(ICommandSender cs, String[] arg) 
     {
     {
         if(arg.length < 1)
         if(arg.length < 1)
         {
         {
@@ -37,18 +39,18 @@ public class CommandWarp extends ModuleCommand
             return true;
             return true;
         }
         }
         
         
-        Location l = Utils.getWarp(arg[0]);
+        Location l = Utils.getWarp(this.getModule(), arg[0]);
         if(l == null)
         if(l == null)
         {
         {
             this.getModule().send(cs, "Der Warp existiert nicht bzw. seine Welt.");
             this.getModule().send(cs, "Der Warp existiert nicht bzw. seine Welt.");
             return true;
             return true;
         }
         }
         
         
-        Player affectedPlayer;
+        EntityPlayer affectedPlayer;
         try
         try
         {
         {
-            affectedPlayer = Utils.getPlayerByName(arg[1]);    
-            affectedPlayer.teleport(l);
+            affectedPlayer = Utils.getPlayerByName(arg[1]);  
+            Utils.teleportEntity(affectedPlayer, l);
             this.getModule().send(affectedPlayer, "Du wurdest zum Warp " + arg[0] + " teleportiert.");
             this.getModule().send(affectedPlayer, "Du wurdest zum Warp " + arg[0] + " teleportiert.");
             this.getModule().send(cs, affectedPlayer.getName() + " wurde zum Warp " + arg[0] + " teleportiert.");
             this.getModule().send(cs, affectedPlayer.getName() + " wurde zum Warp " + arg[0] + " teleportiert.");
         }
         }
@@ -59,13 +61,13 @@ public class CommandWarp extends ModuleCommand
         }
         }
         catch(IndexOutOfBoundsException ex)
         catch(IndexOutOfBoundsException ex)
         {
         {
-            if(!(cs instanceof Player))
+            if(!(cs instanceof EntityPlayer))
             {
             {
                 this.getModule().send(cs, GlobalText.missingParameter());
                 this.getModule().send(cs, GlobalText.missingParameter());
                 return true;
                 return true;
             }     
             }     
-            affectedPlayer = (Player) cs;
-            affectedPlayer.teleport(l);
+            affectedPlayer = (EntityPlayer) cs;
+            Utils.teleportEntity(affectedPlayer, l);
             this.getModule().send(cs, "Du wurdest zum Warp " + arg[0] + " teleportiert.");
             this.getModule().send(cs, "Du wurdest zum Warp " + arg[0] + " teleportiert.");
         }
         }
         return true;
         return true;

+ 336 - 0
src/main/java/me/km/nms/NmsUtilities.java

@@ -0,0 +1,336 @@
+package me.km.nms;
+
+import java.util.List;
+import me.km.api.Location;
+import me.km.exception.IllegalItemStackStringException;
+import me.km.exception.IllegalStringException;
+import net.minecraft.block.Block;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.ai.attributes.AttributeModifier;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.init.Blocks;
+import net.minecraft.inventory.EntityEquipmentSlot;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.JsonToNBT;
+import net.minecraft.nbt.NBTException;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.play.server.SPacketChat;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.Vec3d;
+import net.minecraft.util.text.TextComponentString;
+import net.minecraft.world.World;
+import net.minecraft.world.chunk.storage.AnvilChunkLoader;
+
+public class NmsUtilities 
+{
+    // -----------------------------------------------------------------------------------
+    // Entity Tools
+    // -----------------------------------------------------------------------------------
+    
+    public static List<Entity> getCollidingEntities(Entity e, double x, double y, double z)
+    {
+        return e.getEntityWorld().getEntitiesWithinAABBExcludingEntity(e, e.getCollisionBoundingBox().expand(x, y, z));
+    }
+    
+    public static List<Entity> getCollidingEntities(Entity e)
+    {
+        return getCollidingEntities(e, 0, 0, 0);
+    }   
+
+    /*public static void walkTo(org.bukkit.entity.Entity e, org.bukkit.Location l, double speed, double radius)
+    {
+        EntityCreature el = ((CraftCreature) e).getHandle();
+        el.goalSelector.a(1, new PathfinderGoalWalkToLocation(el, l, speed, radius));
+    }
+    
+    public static void canDestroyBlocks(org.bukkit.entity.LivingEntity e)
+    {
+        EntityCreature el = ((CraftCreature) e).getHandle();
+        el.goalSelector.a(1, new PathfinderGoalDestroyBlock(el));
+    }*/
+    
+    public static String getNbtString(Entity ent)
+    {
+        NBTTagCompound tag = new NBTTagCompound();
+        ent.writeToNBTAtomically(tag);
+        return tag.toString();
+    }
+    
+    public static Entity getEntityFromNbtString(String s, Location l)
+    {
+        try
+        {
+            NBTTagCompound nbt = JsonToNBT.getTagFromJson(s);
+            Vec3d v = l.getPos();
+            Entity ent = AnvilChunkLoader.readWorldEntityPos(nbt, l.getWorld(), v.xCoord, v.yCoord, v.zCoord, true);
+            if(ent == null)
+            {
+                return null;
+            }
+            else
+            {
+                ent.setLocationAndAngles(v.xCoord, v.yCoord, v.zCoord, ent.rotationYaw, ent.rotationPitch);
+                if(ent instanceof EntityLiving)
+                {
+                    ((EntityLiving) ent).onInitialSpawn(ent.getEntityWorld().getDifficultyForLocation(new BlockPos(ent)), null);
+                }
+            }  
+            return ent;
+        }
+        catch(NBTException ex)
+        {
+            throw new IllegalStringException(s);
+        }
+    }
+    
+    // -------------------------------------------------------------------------
+    // Block Tools
+    // -------------------------------------------------------------------------
+    
+    @SuppressWarnings(value = {"unchecked", "deprecation"})
+    public static void setBlockWithData(World w, BlockPos pos, int dv, Block block, String data)
+    {
+        NBTTagCompound nbttagcompound = new NBTTagCompound();
+        boolean flag = false;
+
+        if (data != null && block.hasTileEntity()) 
+        {
+            try 
+            {
+                nbttagcompound = JsonToNBT.getTagFromJson(data);
+                flag = true;
+            } 
+            catch(NBTException ex) 
+            {
+                throw new IllegalStringException(data);
+            }
+        }
+
+        TileEntity tileentity = w.getTileEntity(pos);
+        if (tileentity != null) 
+        {
+            if (tileentity instanceof IInventory) 
+            {
+                ((IInventory) tileentity).clear();
+            }
+            w.setBlockState(pos, Blocks.AIR.getDefaultState(), block == Blocks.AIR ? 2 : 4);
+        }
+
+        IBlockState iblockdata = block.getStateFromMeta(dv);
+        if(w.setBlockState(pos, iblockdata, 2)) 
+        {
+            if (flag) 
+            {
+                TileEntity tileentity1 = w.getTileEntity(pos);
+                if (tileentity1 != null) 
+                {
+                    nbttagcompound.setInteger("x", pos.getX());
+                    nbttagcompound.setInteger("y", pos.getY());
+                    nbttagcompound.setInteger("z", pos.getZ());
+                    tileentity1.readFromNBT(nbttagcompound);
+                }
+            }
+            w.notifyNeighborsRespectDebug(pos, iblockdata.getBlock(), false);
+        }
+    }
+   
+    // -------------------------------------------------------------------------
+    // ItemStack Tools
+    // -------------------------------------------------------------------------
+    
+    public enum Attribute
+    {
+        /**
+         * Wert von 0 bis 30;
+         */
+        ARMOR("generic.armor"),
+        /**
+         * Wert von 0 bis 20;
+         */
+        ARMOR_TOUGHNESS("generic.armorToughness"),
+        /**
+         * Wert von 0 bis 1.7E308;
+         */
+        ATTACK_DAMAGE("generic.attackDamage"),
+        /**
+         * Wert von 0 bis 1;
+         */
+        KNOCKBACK_RESISTANCE("generic.knockbackResistance"),
+        /**
+         * Wert von 0 bis 1.7E308;
+         */
+        MAX_HEALTH("generic.maxHealth"),
+        /**
+         * Wert von 0 bis 1.7E308;
+         */
+        MOVEMENT_SPEED("generic.movementSpeed"),
+        /**
+         * Wert von 0 bis 1024;
+         */
+        ATTACK_SPEED("generic.attackSpeed"),
+        /**
+         * Wert von -1024 bis 1024;
+         */
+        LUCK("generic.luck");
+        
+        private final String name;
+        
+        Attribute(String name)
+        {
+            this.name = name;
+        } 
+        
+        public String getName()
+        {
+            return name;
+        }
+    }
+    
+    public enum Operation
+    {
+        ADD, MUL, MUL_CHANGED
+    }
+    
+    public static void addAttribute(ItemStack stack, Attribute a, EntityEquipmentSlot slot, double amount, Operation op)
+    {
+        stack.addAttributeModifier(a.getName(), new AttributeModifier("modifier", amount, op.ordinal()), slot);      
+    }
+    
+    public static String getNbtString(ItemStack stack)
+    {
+        if(stack == null)
+        {
+            return "null";
+        }
+        return stack.writeToNBT(new NBTTagCompound()).toString();
+    }
+    
+    public static ItemStack getStackFromNbtString(String s) throws IllegalItemStackStringException
+    {
+        try
+        {
+            NBTTagCompound c = JsonToNBT.getTagFromJson(s);
+            return new ItemStack(c);
+        }
+        catch(NBTException ex)
+        {
+            throw new IllegalItemStackStringException(s);
+        }
+    }
+    
+    // -------------------------------------------------------------------------
+    // NBT Tools
+    // -------------------------------------------------------------------------  
+    
+    public static String highlightNbtSyntax(String text)
+    {
+        StringBuilder sb = new StringBuilder(text);
+        int counter = 0;
+        for(char c : text.toCharArray())
+        {
+            switch(c)
+            {
+                case '}':
+                    sb.replace(counter, counter + 1, "§c} §r");
+                    counter += 6;
+                    continue;
+                case '{':
+                    sb.replace(counter, counter + 1, "§c{§r");
+                    counter += 5;
+                    continue;
+                case ']':
+                    sb.replace(counter, counter + 1, "§c] §r");
+                    counter += 6;
+                    continue;
+                case '[':
+                    sb.replace(counter, counter + 1, "§c[§r");
+                    counter += 5;
+                    continue;
+                case ',':
+                    sb.replace(counter, counter + 1, "§6, §r");
+                    counter += 6;
+                    continue;
+                case '"':
+                    sb.replace(counter, counter + 1, "§a\"");
+                    counter += 3;
+                    continue;
+                case ':':
+                    sb.replace(counter, counter + 1, "§8:");
+                    counter += 3;
+                    continue;
+                case '0':
+                    sb.replace(counter, counter + 1, "§50");
+                    counter += 3;
+                    continue;
+                case '1':
+                    sb.replace(counter, counter + 1, "§51");
+                    counter += 3;
+                    continue;
+                case '2':
+                    sb.replace(counter, counter + 1, "§52");
+                    counter += 3;
+                    continue;
+                case '3':
+                    sb.replace(counter, counter + 1, "§53");
+                    counter += 3;
+                    continue;
+                case '4':
+                    sb.replace(counter, counter + 1, "§54");
+                    counter += 3;
+                    continue;
+                case '5':
+                    sb.replace(counter, counter + 1, "§55");
+                    counter += 3;
+                    continue;
+                case '6':
+                    sb.replace(counter, counter + 1, "§56");
+                    counter += 3;
+                    continue;
+                case '7':
+                    sb.replace(counter, counter + 1, "§57");
+                    counter += 3;
+                    continue;
+                case '8':
+                    sb.replace(counter, counter + 1, "§58");
+                    counter += 3;
+                    continue;
+                case '9':
+                    sb.replace(counter, counter + 1, "§59");
+                    counter += 3;
+                    continue;
+                default:
+                    counter++;
+            }
+        }
+        return sb.toString();
+    }    
+    
+    // -------------------------------------------------------------------------
+    // Copy Tools
+    // -------------------------------------------------------------------------
+    
+    public static void sendCopyableText(EntityPlayerMP p, String s)
+    {
+        s = s.replaceAll("\\{", "(");
+        s = s.replaceAll("\\}", ")");
+        s = s.replaceAll(" ", "%20");
+        s = s.replaceAll("\"", "'");
+        SPacketChat packet = new SPacketChat(new TextComponentString(
+                "[{\"text\":\"Hier drücken zum Kopieren.\",\"color\":\"red\",\"bold\":\"true\",\"clickEvent\":" +
+                "{\"action\":\"open_url\",\"value\":\"http://ts.hammerle.me/showtext.php/?text=" + s + "\"}}]"), (byte) 0);
+        p.connection.sendPacket(packet);
+    } 
+    
+    // -------------------------------------------------------------------------
+    // Action-Bar
+    // -------------------------------------------------------------------------
+    
+    public static void sendActionBar(EntityPlayerMP p, String message) 
+    {
+        p.connection.sendPacket(new SPacketChat(new TextComponentString(message), (byte) 2));
+    }
+}

+ 3 - 1
src/main/java/me/km/permissions/Permissions.java

@@ -6,5 +6,7 @@ public enum Permissions
     SILENT, SIGN, SET_WARP, DEL_WARP, FLY, FLY_OTHER, GAMEMODE, GAMEMODE_OTHER, GOD, MORE,
     SILENT, SIGN, SET_WARP, DEL_WARP, FLY, FLY_OTHER, GAMEMODE, GAMEMODE_OTHER, GOD, MORE,
     LASTSEEN, HOME, HOME_OTHER, DEL_HOME, KILL, KILL_OTHER, HAT, LIST, REPAIR, PVP,
     LASTSEEN, HOME, HOME_OTHER, DEL_HOME, KILL, KILL_OTHER, HAT, LIST, REPAIR, PVP,
     PVP_OTHER, LIGHTUPDATE, LAG, COORDS, INVSEE, SET_HOME, KICK, ADD_USER, ENDERCHEST,
     PVP_OTHER, LIGHTUPDATE, LAG, COORDS, INVSEE, SET_HOME, KICK, ADD_USER, ENDERCHEST,
-    EXP, SAY, BAN
+    EXP, SAY, BAN, BACK, BED, BED_OTHER, POTION, MSG, ANSWER, ITEMINFO, FEED, MEMORY,
+    POSITION, SEEN, TIME, TOP, TP_POS, USER, WARP, BOOK, GROW, ENCHANT, SPEED,
+    TELEPORT_ACCEPT, COLOR, USE_COLOR
 }
 }