1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 04:25:15 +01:00

Now the dying shulkers will add income

This commit is contained in:
montlikadani 2020-05-24 14:05:40 +02:00
parent db6b2bc929
commit 554eb6c941
3 changed files with 34 additions and 4 deletions

View File

@ -708,8 +708,6 @@ public class Jobs extends JavaPlugin {
// register economy
Bukkit.getScheduler().runTask(this, new HookEconomyTask(this));
// all loaded properly.
dao.loadBlockProtection();
getExplore().load();

View File

@ -1015,12 +1015,16 @@ public class JobsPlayer {
int i = 0;
while (i <= job.getQuests().size()) {
++i;
List<String> currentQuests = new ArrayList<>(g.keySet());
Quest q = job.getNextQuest(currentQuests, getJobProgression(job).getLevel());
if (q == null)
continue;
QuestProgression qp = new QuestProgression(q);
g.put(qp.getQuest().getConfigName().toLowerCase(), qp);
if (qp.getQuest() != null)
g.put(qp.getQuest().getConfigName().toLowerCase(), qp);
if (g.size() >= job.getMaxDailyQuests())
break;
}

View File

@ -594,13 +594,19 @@ public class JobsPaymentListener implements Listener {
// Checking if item is been repaired, not crafted. Combining 2 items
ItemStack[] sourceItems = event.getInventory().getContents();
// For dye check
List<ItemStack> DyeStack = new ArrayList<>();
int y = -1;
CMIMaterial first = null;
CMIMaterial second = null;
CMIMaterial third = null;
boolean leather = false;
boolean shulker = false;
for (ItemStack s : sourceItems) {
if (s == null)
continue;
@ -611,6 +617,7 @@ public class JobsPaymentListener implements Listener {
CMIMaterial mat = CMIMaterial.get(s);
if (mat != CMIMaterial.NONE) {
y++;
if (y == 0)
first = mat;
if (y == 1)
@ -627,6 +634,25 @@ public class JobsPaymentListener implements Listener {
case LEATHER_HORSE_ARMOR:
leather = true;
break;
case SHULKER_BOX:
case BLACK_SHULKER_BOX:
case BLUE_SHULKER_BOX:
case BROWN_SHULKER_BOX:
case CYAN_SHULKER_BOX:
case GRAY_SHULKER_BOX:
case GREEN_SHULKER_BOX:
case LIGHT_BLUE_SHULKER_BOX:
case LIGHT_GRAY_SHULKER_BOX:
case LIME_SHULKER_BOX:
case MAGENTA_SHULKER_BOX:
case ORANGE_SHULKER_BOX:
case PINK_SHULKER_BOX:
case PURPLE_SHULKER_BOX:
case RED_SHULKER_BOX:
case WHITE_SHULKER_BOX:
case YELLOW_SHULKER_BOX:
shulker = true;
break;
default:
break;
}
@ -645,11 +671,13 @@ public class JobsPaymentListener implements Listener {
// Check Dyes
if (y >= 2) {
if ((third != null && third.isDye() || second != null && second.isDye() || first != null && first.isDye()) && leather) {
if ((third != null && third.isDye() || second != null && second.isDye() || first != null && first.isDye())
&& (leather || shulker)) {
Jobs.action(jPlayer, new ItemActionInfo(sourceItems[0], ActionType.DYE));
for (ItemStack OneDye : DyeStack) {
Jobs.action(jPlayer, new ItemActionInfo(OneDye, ActionType.DYE));
}
return;
}
}