use of com.github.sirblobman.api.configuration.ConfigurationManager in project CombatLogX by SirBlobman.
the class LootProtectionExpansion method reloadConfig.
@Override
public void reloadConfig() {
ConfigurationManager configurationManager = getConfigurationManager();
configurationManager.reload("config.yml");
}
use of com.github.sirblobman.api.configuration.ConfigurationManager in project CombatLogX by SirBlobman.
the class LootProtectionExpansion method onLoad.
@Override
public void onLoad() {
ConfigurationManager configurationManager = getConfigurationManager();
configurationManager.saveDefault("config.yml");
}
use of com.github.sirblobman.api.configuration.ConfigurationManager in project CombatLogX by SirBlobman.
the class ListenerLootProtection method checkVoidKill.
private boolean checkVoidKill(EntityDeathEvent e) {
LivingEntity entity = e.getEntity();
EntityDamageEvent lastDamageEvent = entity.getLastDamageCause();
if (lastDamageEvent == null) {
return false;
}
DamageCause lastDamageCause = lastDamageEvent.getCause();
if (lastDamageCause != DamageCause.VOID) {
return false;
}
ConfigurationManager configurationManager = getExpansionConfigurationManager();
YamlConfiguration configuration = configurationManager.get("config.yml");
if (configuration.getBoolean("return-void-items", true)) {
UUID entityId = entity.getUniqueId();
UUID enemyId = this.enemyMap.get(entityId);
if (enemyId == null) {
return true;
}
Entity enemy = Bukkit.getEntity(enemyId);
if (!(enemy instanceof Player)) {
return true;
}
Player enemyPlayer = (Player) enemy;
World enemyWorld = enemy.getWorld();
Location enemyLocation = enemy.getLocation();
List<ItemStack> dropList = e.getDrops();
ItemStack[] dropArray = dropList.toArray(new ItemStack[0]);
PlayerInventory enemyInventory = enemyPlayer.getInventory();
Map<Integer, ItemStack> leftoverDrops = enemyInventory.addItem(dropArray);
leftoverDrops.forEach((slot, drop) -> enemyWorld.dropItem(enemyLocation, drop, itemEntity -> {
ProtectedItem protectedItem = new ProtectedItem(enemyLocation, drop);
protectedItem.setItemUUID(itemEntity.getUniqueId());
protectedItem.setOwnerUUID(enemyId);
this.protectedItemMap.put(protectedItem.getItemUUID(), protectedItem);
}));
dropList.clear();
return true;
}
return false;
}
use of com.github.sirblobman.api.configuration.ConfigurationManager in project CombatLogX by SirBlobman.
the class MobTaggerExpansion method onLoad.
@Override
public void onLoad() {
ConfigurationManager configurationManager = getConfigurationManager();
configurationManager.saveDefault("config.yml");
}
use of com.github.sirblobman.api.configuration.ConfigurationManager in project CombatLogX by SirBlobman.
the class NewbieHelperExpansion method onLoad.
@Override
public void onLoad() {
ConfigurationManager configurationManager = getConfigurationManager();
configurationManager.saveDefault("config.yml");
}
Aggregations