CommandCoords.java 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package me.km.commands;
  2. import me.km.api.Utils;
  3. import me.km.api.GlobalText;
  4. import me.km.api.Module;
  5. import me.km.api.ModuleCommand;
  6. import me.km.permissions.Permissions;
  7. import net.minecraft.command.ICommandSender;
  8. import net.minecraft.entity.player.EntityPlayer;
  9. import net.minecraft.util.math.BlockPos;
  10. import net.minecraft.util.text.TextComponentString;
  11. import net.minecraft.world.World;
  12. import net.minecraftforge.common.DimensionManager;
  13. public class CommandCoords extends ModuleCommand
  14. {
  15. public CommandCoords(Module m)
  16. {
  17. super("coords", m);
  18. super.setDescription("Ändert den Typ eines Spawners");
  19. super.setUsage("/coords");
  20. super.setPermission(Permissions.COORDS);
  21. }
  22. @Override
  23. public boolean execute(ICommandSender cs, String[] arg)
  24. {
  25. if(!(cs instanceof EntityPlayer))
  26. {
  27. this.getModule().send(cs, GlobalText.onlyPlayer());
  28. return true;
  29. }
  30. EntityPlayer p = (EntityPlayer) cs;
  31. World w = cs.getEntityWorld();
  32. BlockPos pos = Utils.getPlayerTarget(p);
  33. if(w.isAirBlock(pos))
  34. {
  35. this.getModule().send(cs, "Du musst auf einen Block gerichtet sein.");
  36. return true;
  37. }
  38. Module m = this.getModule();
  39. cs.sendMessage(new TextComponentString(GlobalText.Spacer()));
  40. m.send(cs, "Block: " + w.getBlockState(pos).getBlock());
  41. m.send(cs, "Welt: " + w.getWorldInfo().getWorldName());
  42. m.send(cs, "Dimension: " + p.dimension);
  43. m.send(cs, "Dimension: " + DimensionManager.getProviderType(p.dimension).getName());
  44. m.send(cs, "Koordinaten: " + pos.getX() + " | " + pos.getY() + " | " + pos.getZ());
  45. m.send(cs, "Material-Data: " + w.getBlockState(pos));
  46. return true;
  47. }
  48. }