Run formatter
This commit is contained in:
parent
61c44a831b
commit
08258fd6ef
606 changed files with 13464 additions and 22975 deletions
|
@ -6,90 +6,78 @@ import WayofTime.bloodmagic.api.util.helper.BindableHelper;
|
|||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import com.google.common.base.Strings;
|
||||
import net.minecraft.command.*;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.PlayerNotFoundException;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
|
||||
public class SubCommandBind extends CommandBase
|
||||
{
|
||||
public class SubCommandBind extends CommandBase {
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return "bind";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage(ICommandSender commandSender)
|
||||
{
|
||||
public String getUsage(ICommandSender commandSender) {
|
||||
return TextHelper.localizeEffect("commands.bind.usage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRequiredPermissionLevel()
|
||||
{
|
||||
public int getRequiredPermissionLevel() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(MinecraftServer server, ICommandSender commandSender, String[] args) throws CommandException
|
||||
{
|
||||
public void execute(MinecraftServer server, ICommandSender commandSender, String[] args) throws CommandException {
|
||||
if (commandSender.getEntityWorld().isRemote)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
EntityPlayer player = CommandBase.getCommandSenderAsPlayer(commandSender);
|
||||
String playerName = player.getName();
|
||||
String uuid = PlayerHelper.getUUIDFromPlayer(player).toString();
|
||||
ItemStack held = player.getHeldItemMainhand();
|
||||
boolean bind = true;
|
||||
|
||||
if (held.getItem() instanceof IBindable)
|
||||
{
|
||||
if (args.length > 0)
|
||||
{
|
||||
if (held.getItem() instanceof IBindable) {
|
||||
if (args.length > 0) {
|
||||
|
||||
if (args[0].equalsIgnoreCase("help"))
|
||||
return;
|
||||
|
||||
if (isBoolean(args[0]))
|
||||
{
|
||||
if (isBoolean(args[0])) {
|
||||
bind = Boolean.parseBoolean(args[0]);
|
||||
|
||||
if (args.length > 2)
|
||||
playerName = args[1];
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
playerName = args[0];
|
||||
uuid = PlayerHelper.getUUIDFromPlayer(CommandBase.getPlayer(server, commandSender, playerName)).toString();
|
||||
}
|
||||
}
|
||||
|
||||
if (bind)
|
||||
{
|
||||
if (bind) {
|
||||
BindableHelper.setItemOwnerName(held, playerName);
|
||||
BindableHelper.setItemOwnerUUID(held, uuid);
|
||||
commandSender.sendMessage(new TextComponentTranslation("commands.bind.success"));
|
||||
} else
|
||||
{
|
||||
if (!Strings.isNullOrEmpty(((IBindable) held.getItem()).getOwnerUUID(held)))
|
||||
{
|
||||
} else {
|
||||
if (!Strings.isNullOrEmpty(((IBindable) held.getItem()).getOwnerUUID(held))) {
|
||||
held.getTagCompound().removeTag(Constants.NBT.OWNER_UUID);
|
||||
held.getTagCompound().removeTag(Constants.NBT.OWNER_NAME);
|
||||
commandSender.sendMessage(new TextComponentTranslation("commands.bind.remove.success"));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (PlayerNotFoundException e)
|
||||
{
|
||||
} catch (PlayerNotFoundException e) {
|
||||
commandSender.sendMessage(new TextComponentTranslation(TextHelper.localizeEffect("commands.error.404")));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isBoolean(String string)
|
||||
{
|
||||
private boolean isBoolean(String string) {
|
||||
return string.equalsIgnoreCase("true") || string.equalsIgnoreCase("false");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue