mirror of
https://github.com/shansen/EggCatcher.git
synced 2024-11-22 10:05:18 +01:00
Added DeleteVillagerInventoryOnCatch option.
This commit is contained in:
parent
bf1ce3d38a
commit
faa261de24
@ -64,9 +64,14 @@ public class EggCatcher extends JavaPlugin {
|
||||
|
||||
public void CheckConfigurationFile() {
|
||||
double configVersion = this.getConfig().getDouble("ConfigVersion", 0.0);
|
||||
if (configVersion == 2.2) {
|
||||
if (configVersion == 2.5) {
|
||||
//
|
||||
this.saveConfig();
|
||||
} else if (configVersion == 2.2) {
|
||||
this.getConfig().set("DeleteVillagerInventoryOnCatch", false);
|
||||
|
||||
this.getConfig().set("ConfigVersion", 2.5);
|
||||
this.saveConfig();
|
||||
} else if (configVersion == 2.0) {
|
||||
this.getConfig().set("CatchChance.Endermite", 100.0);
|
||||
this.getConfig().set("VaultCost.Endermite", 0);
|
||||
|
@ -57,6 +57,7 @@ public class EggCatcherEntityListener implements Listener {
|
||||
private final String vaultTargetBankAccount;
|
||||
private final boolean spawnChickenOnFail;
|
||||
private final boolean spawnChickenOnSuccess;
|
||||
private final boolean deleteVillagerInventoryOnCatch;
|
||||
FileConfiguration config;
|
||||
JavaPlugin plugin;
|
||||
|
||||
@ -81,6 +82,7 @@ public class EggCatcherEntityListener implements Listener {
|
||||
this.spawnChickenOnFail = this.config.getBoolean("SpawnChickenOnFail", true);
|
||||
this.spawnChickenOnSuccess = this.config.getBoolean("SpawnChickenOnSuccess", false);
|
||||
this.vaultTargetBankAccount = this.config.getString("VaultTargetBankAccount", "");
|
||||
this.deleteVillagerInventoryOnCatch = this.config.getBoolean("DeleteVillagerInventoryOnCatch", false);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
@ -279,7 +281,8 @@ public class EggCatcherEntityListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
if(entity instanceof InventoryHolder){
|
||||
if((entity instanceof Villager && !this.deleteVillagerInventoryOnCatch) ||
|
||||
(!(entity instanceof Villager) && entity instanceof InventoryHolder)) {
|
||||
|
||||
ItemStack[] items = ((InventoryHolder) entity).getInventory().getContents();
|
||||
|
||||
|
@ -13,6 +13,7 @@ PreventCatchingShearedSheeps: true
|
||||
SpawnChickenOnSuccess: false
|
||||
SpawnChickenOnFail: true
|
||||
VaultTargetBankAccount: ""
|
||||
DeleteVillagerInventoryOnCatch: false
|
||||
CatchChance:
|
||||
Pig: 100.0
|
||||
Sheep: 100.0
|
||||
@ -137,4 +138,4 @@ Messages:
|
||||
CatchChanceFail: "You failed to catch this mob!"
|
||||
CatchChanceSuccess: ""
|
||||
HealthPercentageFail: "The mob has more than %s percent health left and cannot be caught!"
|
||||
ConfigVersion: 2.2
|
||||
ConfigVersion: 2.5
|
Loading…
Reference in New Issue
Block a user