From 01c8701b68986ccfa83e902515716838d6829311 Mon Sep 17 00:00:00 2001 From: Onyx Date: Tue, 1 Dec 2015 20:55:30 +0000 Subject: - Fixed all of the bugs mentioned on github - Added new config options - Rabbits paw now increases the chance of spawning hearts, rather than itself spawning some - Hearts now have a much lower chance to spawn by default - You can no longer increase your health past 20 hearts (aka double the default health) - The guide now also shows the total number of pages on each tab - A new luck stat has been added to the Curse API - Cleaned up the code a bit (removed unused methods, imports etc) - The displayer's info now has a purple solid color background; the text also has a much closer shadow and now shrinks in height as well as in width when too big - I have modified the potion list to use Mithion's code, credits have been given --- .../commands/JewelrycraftCommands.java | 178 ++++++++++----------- 1 file changed, 83 insertions(+), 95 deletions(-) (limited to 'src/main/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java') diff --git a/src/main/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java b/src/main/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java index ebf7d8b..cc5f216 100644 --- a/src/main/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java +++ b/src/main/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java @@ -1,95 +1,83 @@ -/** - * - */ -package darkknight.jewelrycraft.commands; - -/** - * @author Sorin - * - */ -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import net.minecraft.command.CommandBase; -import net.minecraft.command.ICommandSender; -import net.minecraft.command.WrongUsageException; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IChatComponent; -import darkknight.jewelrycraft.JewelrycraftMod; -import darkknight.jewelrycraft.api.Curse; -import darkknight.jewelrycraft.events.EntityEventHandler; -import darkknight.jewelrycraft.network.PacketRequestPlayerInfo; -import darkknight.jewelrycraft.util.JewelryNBT; -import darkknight.jewelrycraft.util.JewelrycraftUtil; -import darkknight.jewelrycraft.util.PlayerUtils; - -public class JewelrycraftCommands extends CommandBase -{ - private List aliases; - - public JewelrycraftCommands() - { - this.aliases = new ArrayList(); - this.aliases.add("jw"); - this.aliases.add("jewelry"); - } - - @Override - public String getCommandName() - { - return "jewelrycraft"; - } - - @Override - public String getCommandUsage(ICommandSender var1) - { - return "/jewelrycraft [points]"; - } - - @Override - public List getCommandAliases() - { - return aliases; - } - - @Override - public void processCommand(ICommandSender commandSender, String[] astring) - { - if (astring.length == 0 || astring[0].equals("help")) throw new WrongUsageException(getCommandUsage(commandSender)); - if (astring[0].equals("getCursePoints")){ - EntityPlayerMP entityplayermp = getPlayer(commandSender, astring[1]); - commandSender.addChatMessage(new ChatComponentTranslation(Integer.toString(JewelrycraftUtil.getCursePoints(entityplayermp)))); - }else if (astring[0].equals("addCursePoints")){ - int points = CommandBase.parseIntWithMin(commandSender, astring[2], 0); - EntityPlayerMP entityplayermp = getPlayer(commandSender, astring[1]); - JewelrycraftUtil.addCursePoints(entityplayermp, points); - }else if (astring[0].equals("setCursePoints")){ - int points = CommandBase.parseIntWithMin(commandSender, astring[2], 0); - EntityPlayerMP entityplayermp = getPlayer(commandSender, astring[1]); - JewelrycraftUtil.addCursePoints(entityplayermp, points - JewelrycraftUtil.getCursePoints(entityplayermp)); - } - } - - @Override - public List addTabCompletionOptions(ICommandSender icommandsender, String[] astring) - { - final List MATCHES = new LinkedList(); - final String ARG_LC = astring[astring.length - 1].toLowerCase(); - if (astring.length == 1){ - if ("addCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("addCursePoints"); - if ("getCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("getCursePoints"); - if ("setCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("setCursePoints"); - }else if (astring.length == 2){ - for(String un: MinecraftServer.getServer().getAllUsernames()) - if (un.toLowerCase().startsWith(ARG_LC)) MATCHES.add(un); - } - return MATCHES.isEmpty() ? null : MATCHES; - } -} +/** + * + */ +package darkknight.jewelrycraft.commands; + +/** + * @author Sorin + * + */ +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import darkknight.jewelrycraft.util.JewelrycraftUtil; +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatComponentTranslation; + +public class JewelrycraftCommands extends CommandBase +{ + private List aliases; + + public JewelrycraftCommands() + { + this.aliases = new ArrayList(); + this.aliases.add("jw"); + this.aliases.add("jewelry"); + } + + @Override + public String getCommandName() + { + return "jewelrycraft"; + } + + @Override + public String getCommandUsage(ICommandSender var1) + { + return "/jewelrycraft [points]"; + } + + @Override + public List getCommandAliases() + { + return aliases; + } + + @Override + public void processCommand(ICommandSender commandSender, String[] astring) + { + if (astring.length == 0 || astring[0].equals("help")) throw new WrongUsageException(getCommandUsage(commandSender)); + if (astring[0].equals("getCursePoints")){ + EntityPlayerMP entityplayermp = getPlayer(commandSender, astring[1]); + commandSender.addChatMessage(new ChatComponentTranslation(Integer.toString(JewelrycraftUtil.getCursePoints(entityplayermp)))); + }else if (astring[0].equals("addCursePoints")){ + int points = CommandBase.parseIntWithMin(commandSender, astring[2], 0); + EntityPlayerMP entityplayermp = getPlayer(commandSender, astring[1]); + JewelrycraftUtil.addCursePoints(entityplayermp, points); + }else if (astring[0].equals("setCursePoints")){ + int points = CommandBase.parseIntWithMin(commandSender, astring[2], 0); + EntityPlayerMP entityplayermp = getPlayer(commandSender, astring[1]); + JewelrycraftUtil.addCursePoints(entityplayermp, points - JewelrycraftUtil.getCursePoints(entityplayermp)); + } + } + + @Override + public List addTabCompletionOptions(ICommandSender icommandsender, String[] astring) + { + final List MATCHES = new LinkedList(); + final String ARG_LC = astring[astring.length - 1].toLowerCase(); + if (astring.length == 1){ + if ("addCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("addCursePoints"); + if ("getCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("getCursePoints"); + if ("setCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("setCursePoints"); + }else if (astring.length == 2){ + for(String un: MinecraftServer.getServer().getAllUsernames()) + if (un.toLowerCase().startsWith(ARG_LC)) MATCHES.add(un); + } + return MATCHES.isEmpty() ? null : MATCHES; + } +} -- cgit v1.2.3