mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 11:45:51 +00:00
Merge pull request #448 from dpkirchner/master
Don't consume XP until we are about to unlock the requested research.
This commit is contained in:
commit
5dd53540ee
@ -672,11 +672,15 @@ public class SlimefunGuide {
|
||||
|
||||
@Override
|
||||
public void run(final Player p) {
|
||||
if (!Research.isResearching(p)) {
|
||||
if (research.canUnlock(p)) {
|
||||
if (research.hasUnlocked(p))
|
||||
openCategory(p, category, true, selected_page, experimental);
|
||||
else {
|
||||
if (!(p.getGameMode() == GameMode.CREATIVE && Research.creative_research)) {
|
||||
p.setLevel(p.getLevel() - research.getCost());
|
||||
}
|
||||
|
||||
if (research.hasUnlocked(p)) openCategory(p, category, true, selected_page, experimental);
|
||||
else if (!Research.isResearching(p)) {
|
||||
if (p.getGameMode() == GameMode.CREATIVE) {
|
||||
research.unlock(p, true);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {
|
||||
@ -686,8 +690,7 @@ public class SlimefunGuide {
|
||||
openCategory(p, category, survival, selected_page, experimental);
|
||||
}
|
||||
}, 1L);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
research.unlock(p, false);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {
|
||||
|
||||
@ -698,8 +701,8 @@ public class SlimefunGuide {
|
||||
}, 103L);
|
||||
}
|
||||
}
|
||||
} else Messages.local.sendTranslation(p, "messages.not-enough-xp", true);
|
||||
}
|
||||
else Messages.local.sendTranslation(p, "messages.not-enough-xp", true);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -859,18 +862,19 @@ public class SlimefunGuide {
|
||||
|
||||
@Override
|
||||
public boolean onClick(final Player p, int slot, ItemStack item, ClickAction action) {
|
||||
if (!Research.isResearching(p)) {
|
||||
if (research.canUnlock(p)) {
|
||||
if (research.hasUnlocked(p))
|
||||
openCategory(p, category, true, selected_page, experimental);
|
||||
else {
|
||||
if (!(p.getGameMode() == GameMode.CREATIVE && Research.creative_research)) {
|
||||
p.setLevel(p.getLevel() - research.getCost());
|
||||
}
|
||||
|
||||
if (research.hasUnlocked(p)) openCategory(p, category, true, selected_page, experimental);
|
||||
else if (!Research.isResearching(p)) {
|
||||
if (p.getGameMode() == GameMode.CREATIVE) {
|
||||
research.unlock(p, Research.creative_research);
|
||||
openCategory(p, category, survival, selected_page, experimental);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
research.unlock(p, false);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {
|
||||
|
||||
@ -881,8 +885,8 @@ public class SlimefunGuide {
|
||||
}, 103L);
|
||||
}
|
||||
}
|
||||
} else Messages.local.sendTranslation(p, "messages.not-enough-xp", true);
|
||||
}
|
||||
else Messages.local.sendTranslation(p, "messages.not-enough-xp", true);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user