1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Fixed XP duplication

This commit is contained in:
TheBusyBiscuit 2017-01-21 08:30:41 +01:00
parent 73210d0a99
commit 485319a2f9

View File

@ -158,23 +158,23 @@ public class XPCollector extends SlimefunItem {
if (n instanceof ExperienceOrb) { if (n instanceof ExperienceOrb) {
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return; if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
if (!n.isValid()) return; if (n.isValid()) {
int xp = getEXP(b) + ((ExperienceOrb) n).getExperience();
int xp = getEXP(b) + ((ExperienceOrb) n).getExperience();
ChargableBlock.addCharge(b, -getEnergyConsumption());
ChargableBlock.addCharge(b, -getEnergyConsumption()); n.remove();
n.remove();
int withdrawn = 0;
int withdrawn = 0; for (int level = 0; level < getEXP(b); level = level + 10) {
for (int level = 0; level < getEXP(b); level = level + 10) { if (fits(b, new CustomItem(Material.EXP_BOTTLE, "&aFlask of Knowledge", 0))) {
if (fits(b, new CustomItem(Material.EXP_BOTTLE, "&aFlask of Knowledge", 0))) { withdrawn = withdrawn + 10;
withdrawn = withdrawn + 10; pushItems(b, new CustomItem(Material.EXP_BOTTLE, "&aFlask of Knowledge", 0));
pushItems(b, new CustomItem(Material.EXP_BOTTLE, "&aFlask of Knowledge", 0)); }
} }
BlockStorage.addBlockInfo(b, "stored-exp", String.valueOf(xp - withdrawn));
return;
} }
BlockStorage.addBlockInfo(b, "stored-exp", String.valueOf(xp - withdrawn));
return;
} }
} }
} }