1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

ItemInfo command update

This commit is contained in:
Zrips 2021-11-29 17:11:28 +02:00
parent dd955ec79e
commit a527158cff
3 changed files with 30 additions and 24 deletions

View File

@ -39,8 +39,8 @@ public class blockinfo implements Cmd {
RawMessage rm = new RawMessage(); RawMessage rm = new RawMessage();
rm.addText(Jobs.getLanguage().getMessage("general.info.separator") + "\n"); rm.addText(Jobs.getLanguage().getMessage("general.info.separator") + "\n");
rm.addText(Jobs.getLanguage().getMessage("command.blockinfo.output.material", "%blockname%", block.getType().name()) + "\n"); rm.addText(Jobs.getLanguage().getMessage("command.blockinfo.output.material", "%blockname%", CMIMaterial.get(block).getName()) + "\n");
rm.addSuggestion(block.getType().name()); rm.addSuggestion(CMIMaterial.get(block).getName());
if (Version.isCurrentEqualOrLower(Version.v1_13_R2)) { if (Version.isCurrentEqualOrLower(Version.v1_13_R2)) {
rm.addText(Jobs.getLanguage().getMessage("command.blockinfo.output.id", "%blockid%", block.getType().getId()) + "\n"); rm.addText(Jobs.getLanguage().getMessage("command.blockinfo.output.id", "%blockid%", block.getType().getId()) + "\n");

View File

@ -2,7 +2,6 @@ package com.gamingmesh.jobs.commands.list;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.EnchantmentTarget;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -10,6 +9,8 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import net.Zrips.CMILib.Items.CMIItemStack; import net.Zrips.CMILib.Items.CMIItemStack;
import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.RawMessages.RawMessage;
import net.Zrips.CMILib.Version.Version; import net.Zrips.CMILib.Version.Version;
public class iteminfo implements Cmd { public class iteminfo implements Cmd {
@ -32,32 +33,36 @@ public class iteminfo implements Cmd {
if (iih == null || iih.getType() == Material.AIR) if (iih == null || iih.getType() == Material.AIR)
return true; return true;
boolean tool = false; CMIItemStack ci = new CMIItemStack(iih);
if (EnchantmentTarget.TOOL.includes(iih) ||
EnchantmentTarget.WEAPON.includes(iih) ||
EnchantmentTarget.ARMOR.includes(iih) ||
EnchantmentTarget.BOW.includes(iih) ||
EnchantmentTarget.FISHING_ROD.includes(iih))
tool = true;
byte data = (Version.isCurrentEqualOrHigher(Version.v1_13_R1) ? 0 : iih.getData().getData()); byte data = (Version.isCurrentEqualOrHigher(Version.v1_13_R1) ? 0 : iih.getData().getData());
String dataString = data == 0 ? "" : "-" + data; String dataString = data == 0 ? "" : "-" + data;
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator")); RawMessage rm = new RawMessage();
sender.sendMessage(Jobs.getLanguage().getMessage("command.iteminfo.output.name", "%itemname%", iih.getType().name())); rm.addText(Jobs.getLanguage().getMessage("general.info.separator") + "\n");
if (Version.isCurrentEqualOrLower(Version.v1_13_R2))
sender.sendMessage(Jobs.getLanguage().getMessage("command.iteminfo.output.id", "%itemid%", iih.getType().getId())); rm.addText(Jobs.getLanguage().getMessage("command.iteminfo.output.material", "%itemname%", CMIMaterial.get(iih).getName()) + "\n");
if (!tool) rm.addSuggestion(CMIMaterial.get(iih).getName());
sender.sendMessage(Jobs.getLanguage().getMessage("command.iteminfo.output.data", "%itemdata%", data));
if (Version.isCurrentEqualOrLower(Version.v1_13_R2)) {
rm.addText(Jobs.getLanguage().getMessage("command.iteminfo.output.id", "%blockid%", iih.getType().getId()) + "\n");
rm.addSuggestion(String.valueOf(iih.getType().getId()));
}
if (ci.getMaxDurability() == 0 && Version.isCurrentEqualOrLower(Version.v1_13_R2)) {
rm.addText(Jobs.getLanguage().getMessage("command.iteminfo.output.data", "%itemdata%", data) + "\n");
rm.addSuggestion(String.valueOf(data));
}
if (Version.isCurrentEqualOrHigher(Version.v1_14_R1)) if (Version.isCurrentEqualOrHigher(Version.v1_14_R1))
sender.sendMessage(Jobs.getLanguage().getMessage("command.iteminfo.output.usage", "%first%", "", rm.addText(Jobs.getLanguage().getMessage("command.iteminfo.output.use", "%usage%", iih.getType().name() + dataString) + "\n");
"%second%", iih.getType().name() + dataString));
else else
sender.sendMessage(Jobs.getLanguage().getMessage("command.iteminfo.output.usage", "%first%", iih.getType().getId() + dataString, rm.addText(Jobs.getLanguage().getMessage("command.iteminfo.output.deprecated", "%first%", iih.getType().getId() + dataString, "%second%", iih.getType().name() + dataString) + "\n");
"%second%", iih.getType().name() + dataString)); rm.addSuggestion(iih.getType().name() + dataString);
rm.addText(Jobs.getLanguage().getMessage("general.info.separator"));
rm.show(sender);
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
return true; return true;
} }
} }

View File

@ -271,7 +271,7 @@ public class LanguageManager {
c.get("command.blockinfo.help.info", "Shows information for the block you are looking at."); c.get("command.blockinfo.help.info", "Shows information for the block you are looking at.");
c.get("command.blockinfo.help.args", ""); c.get("command.blockinfo.help.args", "");
c.get("command.blockinfo.output.material", " &eBlock material: &6%blockname%"); c.get("command.blockinfo.output.material", " &eBlock name: &6%blockname%");
c.get("command.blockinfo.output.id", " &eBlock id: &6%blockid%"); c.get("command.blockinfo.output.id", " &eBlock id: &6%blockid%");
c.get("command.blockinfo.output.state", " &eBlock sate: &6%blockdata%"); c.get("command.blockinfo.output.state", " &eBlock sate: &6%blockdata%");
c.get("command.blockinfo.output.deprecated", " &eUsage: &6%first% &eor &6%second%"); c.get("command.blockinfo.output.deprecated", " &eUsage: &6%first% &eor &6%second%");
@ -279,10 +279,11 @@ public class LanguageManager {
c.get("command.iteminfo.help.info", "Shows information for the item you are holding."); c.get("command.iteminfo.help.info", "Shows information for the item you are holding.");
c.get("command.iteminfo.help.args", ""); c.get("command.iteminfo.help.args", "");
c.get("command.iteminfo.output.name", " &eItem name: &6%itemname%"); c.get("command.iteminfo.output.material", " &eItem name: &6%itemname%");
c.get("command.iteminfo.output.id", " &eItem id: &6%itemid%"); c.get("command.iteminfo.output.id", " &eItem id: &6%itemid%");
c.get("command.iteminfo.output.data", " &eItem data: &6%itemdata%"); c.get("command.iteminfo.output.data", " &eItem data: &6%itemdata%");
c.get("command.iteminfo.output.usage", " &eUsage: &6%first% &eor &6%second%"); c.get("command.iteminfo.output.deprecated", " &eUsage: &6%first% &eor &6%second%");
c.get("command.iteminfo.output.use", " &eConfig file usage: &6%usage%");
c.get("command.placeholders.help.info", "List out all placeholders"); c.get("command.placeholders.help.info", "List out all placeholders");
c.get("command.placeholders.help.args", "(parse) (placeholder)"); c.get("command.placeholders.help.args", "(parse) (placeholder)");