CommandTemperature.java 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. package me.km.environment;
  2. import me.km.api.GlobalText;
  3. import me.km.api.Module;
  4. import me.km.api.ModuleCommand;
  5. import me.km.permissions.Permissions;
  6. import net.minecraft.command.ICommandSender;
  7. import net.minecraft.entity.player.EntityPlayer;
  8. public class CommandTemperature extends ModuleCommand
  9. {
  10. public CommandTemperature(Module m)
  11. {
  12. super("temperature", m);
  13. super.setDescription("Zeigt dir die aktuelle Temperatur an");
  14. super.setUsage("/temperature");
  15. super.setPermission(Permissions.TEMPERATURE);
  16. super.addAlias("temp");
  17. }
  18. @Override
  19. public boolean execute(ICommandSender cs, String[] arg)
  20. {
  21. if(!(cs instanceof EntityPlayer))
  22. {
  23. this.getModule().send(cs, GlobalText.onlyPlayer());
  24. return true;
  25. }
  26. EntityPlayer p = (EntityPlayer) cs;
  27. this.getModule().send(cs, "Die Temperatur beträgt hier " + EnvironmentAPI.getTemperature(p.getEntityWorld(), p.getPosition()) + "°C.");
  28. return true;
  29. }
  30. }