12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package me.km.commands;
- import me.km.api.GlobalText;
- import me.km.api.Module;
- import me.km.api.ModuleCommand;
- 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.Blocks;
- import net.minecraft.util.math.BlockPos;
- public class CommandSetBed extends ModuleCommand
- {
- public CommandSetBed(Module m)
- {
- super("setbed", m);
- super.setDescription("Setzt deinen Bettspawn");
- super.setUsage("/setbed");
- super.setPermission(Permissions.SET_BED);
- }
- @Override
- public boolean execute(ICommandSender cs, String[] arg)
- {
- if(!(cs instanceof EntityPlayer))
- {
- this.getModule().send(cs, GlobalText.onlyPlayer());
- return true;
- }
- EntityPlayer p = (EntityPlayer) cs;
- BlockPos pos = Utils.getPlayerTarget(p);
- if(p.world.getBlockState(pos).getBlock() != Blocks.BED)
- {
- this.getModule().send(cs, "Du musst auf ein Bett gerichtet sein.");
- return true;
- }
- p.setSpawnPoint(pos, false);
- p.bedLocation = pos;
- this.getModule().send(cs, "Dein Bett-Spawn wurde gesetzt.");
- return true;
- }
- }
|