JD Decompiler
Appearance
Original author(s) | Emmanuel Dupuy |
---|---|
Stable release | JD-Core 0.7.1 JD-GUI 1.4.0 JD-Eclipse 0.1.5 JD-IntelliJ 0.6 |
Written in | C++, Java |
Platform | Cross-platform |
Available in | English |
Type | Software engineering |
License | GNU GPL 3 |
Website | jd |
JD (Java Decompiler) is a Decompiler for the Java programming language. JD is provided as a GUI tool as well as in the form of plug-ins for the Eclipse (JD-Eclipse) and IntelliJ IDEA (JD-IntelliJ) integrated development environments.
JD supports most versions of Java from 1.1.8 through 1.7.0 as well as JRockit 90_150, Jikes 1.2.2, Eclipse Java Compiler and Apache Harmony and is thus often used where formerly the popular JAD was operated.[citation needed]
package com.loreupdate.Util;
import java.text.DecimalFormat; import java.util.List; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta;
public class LoreUtil {
public static ItemMeta newItemLore(ItemStack itemStack, Double upleave) { ItemMeta itemMeta = itemStack.getItemMeta(); List<String> lore = itemMeta.getLore(); for (int i = 0; i < lore.size(); i++) { if (((String)lore.get(i)).contains("攻击力")) { String newLore = updateLore((String)lore.get(i), upleave); lore.remove(i); lore.add(i, newLore); } if (((String)lore.get(i)).contains("生命值")) { String newlore = updateheal((String)lore.get(i), upleave); lore.remove(i); lore.add(i, newlore); } } itemMeta.setLore(lore); return itemMeta; } private static String updateheal(String s, Double upleave) { int begin = s.indexOf(": ") + 2; String health = s.substring(begin); double nowhealth = Double.valueOf(health).doubleValue() * upleave.doubleValue(); int endHealth = Integer.parseInt(new DecimalFormat("0").format(nowhealth)); return "§2生命值: " + endHealth; } private static String updateLore(String temp, Double upleave) { int begin = temp.indexOf("+") + 1; int end = temp.indexOf("-"); String attactBeg = temp.substring(begin, end); String attactEnd = temp.substring(end + 1, temp.length()); double beg = Double.valueOf(attactBeg).doubleValue() * upleave.doubleValue(); double aend = Double.valueOf(attactEnd).doubleValue() * upleave.doubleValue(); int newbeg = Integer.parseInt(new DecimalFormat("0").format(beg)); int newaend = Integer.parseInt(new DecimalFormat("0").format(aend)); String newAttact = "§2攻击力 +" + newbeg + "-" + newaend; return newAttact; } public static String updateLeave(ItemStack itemStack) { ItemMeta itemMeta = itemStack.getItemMeta(); int begin = 0; if (!itemMeta.getDisplayName().contains("强化")) { return "Leave1"; } if (itemMeta.getDisplayName().contains("强化")) { begin = itemMeta.getDisplayName().indexOf("+") + 1; } String x = itemMeta.getDisplayName().substring(begin, itemMeta.getDisplayName().length() - 1); int le = Integer.parseInt(x) + 1; return "Leave" + le; } public static String updateName(String disName, String leave) { int begin = 0; String nlv = leave.substring(leave.indexOf("ve") + 2); int lv = Integer.parseInt(nlv); if (!disName.contains("强化")) { return disName + "[强化: +1]"; } if (disName.contains("强化")) { begin = disName.indexOf("+") + 1; } String x = disName.substring(begin, disName.length() - 1); int le = Integer.parseInt(x) + 1; String nowlv = String.valueOf(le); if (le <= 10) { return replaceIndex(begin, disName, nowlv); } return replaceIndexe(begin, disName, nowlv); } public static String replaceIndex(int index, String res, String str) { return res.substring(0, index) + str + res.substring(index + 1); } public static Integer updateLeave(String leave) { String nlv = leave.substring(leave.indexOf("ve") + 2); int lv = Integer.parseInt(nlv); return Integer.valueOf(lv); } private static String replaceIndexe(int index, String res, String str) { return res.substring(0, index) + str + res.substring(index + 2); }
}