Skip to content

Commit 4caa2e2

Browse files
committed
Added: ignoreMobXPDrops to config
1 parent 28ee627 commit 4caa2e2

File tree

3 files changed

+33
-19
lines changed

3 files changed

+33
-19
lines changed

src/main/java/us/thezircon/play/autopickup/listeners/EntityDeathEventListener.java

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,6 @@ public void run() {
6262
}
6363
}
6464

65-
66-
67-
// Mend Items & Give Player XP
68-
int xp = e.getDroppedExp();
69-
player.giveExp(xp); // Give player XP
70-
71-
// Mend
72-
mend(player.getInventory().getItemInMainHand(), xp);
73-
mend(player.getInventory().getItemInOffHand(), xp);
74-
ItemStack armor[] = player.getInventory().getArmorContents();
75-
for (ItemStack i : armor)
76-
{
77-
try {
78-
mend(i, xp);
79-
} catch (NullPointerException ignored) {}
80-
}
81-
e.setDroppedExp(0); // Remove default XP
82-
8365
// Drops
8466
Iterator<ItemStack> iter = e.getDrops().iterator();
8567
while (iter.hasNext()) {
@@ -119,5 +101,22 @@ public void run() {
119101
}
120102
e.getDrops().clear();
121103

104+
// Mend Items & Give Player XP
105+
if (!PLUGIN.getConfig().getBoolean("ignoreMobXPDrops")) {
106+
int xp = e.getDroppedExp();
107+
player.giveExp(xp); // Give player XP
108+
109+
// Mend
110+
mend(player.getInventory().getItemInMainHand(), xp);
111+
mend(player.getInventory().getItemInOffHand(), xp);
112+
ItemStack armor[] = player.getInventory().getArmorContents();
113+
for (ItemStack i : armor) {
114+
try {
115+
mend(i, xp);
116+
} catch (NullPointerException ignored) {
117+
}
118+
}
119+
e.setDroppedExp(0); // Remove default XP
120+
}
122121
}
123122
}

src/main/java/us/thezircon/play/autopickup/utils/VersionChk.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,23 @@ public static void checkVersion(String name, int id) throws Exception { //https:
8989

9090
// Config Version:
9191
double configVersion = PLUGIN.getConfig().getDouble("ConfigVersion");
92+
if (configVersion<=1.2) {
93+
PLUGIN.getConfig().set("ConfigVersion", 1.3);
94+
PLUGIN.getBlacklistConf().set("doAutoSmeltBlacklist", false);
95+
PLUGIN.getBlacklistConf().set("AutoSmeltBlacklist", Arrays.asList("OAK_LOG"));
96+
97+
File conf = new File(PLUGIN.getDataFolder(), "config.yml");
98+
File fileBlacklist = new File(PLUGIN.getDataFolder(), "blacklist.yml");
99+
100+
PLUGIN.getConfig().save(conf);
101+
PLUGIN.getBlacklistConf().save(fileBlacklist);
102+
}
92103
if (configVersion<=1.3) {
93104
PLUGIN.getConfig().set("ConfigVersion", 1.4);
94105
PLUGIN.getBlacklistConf().set("doAutoSmeltBlacklist", false);
95106
PLUGIN.getBlacklistConf().set("AutoSmeltBlacklist", Arrays.asList("OAK_LOG"));
96107
PLUGIN.getConfig().set("usingSilkSpawnerPlugin", true);
108+
PLUGIN.getConfig().set("ignoreMobXPDrops", false);
97109

98110
File conf = new File(PLUGIN.getDataFolder(), "config.yml");
99111
File fileBlacklist = new File(PLUGIN.getDataFolder(), "blacklist.yml");

src/main/resources/config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ doAutoEnableMSG: true
3434
msgEnabledJoinMSG: "&7Auto pickup has been automatically&a enabled&7."
3535
doEnabledOnJoinMSG: true
3636

37-
#reload Config Message
37+
#Reload Config Message
3838
msgReload: "&cReloaded Config"
3939

4040
#Fully Inventory Message
@@ -52,6 +52,9 @@ voidOnFullInv: false
5252
#If set to true AutoPickup will ignore XP drop calculations from when using a silk spawner plugin.
5353
usingSilkSpawnerPlugin: true
5454

55+
#If set to true mobs will naturally drop XP
56+
ignoreMobXPDrops: false
57+
5558
#Plase does not have permission
5659
msgNoperms: "&cYou don't have permission to use this command"
5760

0 commit comments

Comments
 (0)