Search in sources :

Example 1 with ConfigurationManager

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");
}
Also used : ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager)

Example 2 with ConfigurationManager

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");
}
Also used : ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager)

Example 3 with ConfigurationManager

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;
}
Also used : PlayerDataManager(com.github.sirblobman.api.configuration.PlayerDataManager) InventoryPickupItemEvent(org.bukkit.event.inventory.InventoryPickupItemEvent) Item(org.bukkit.entity.Item) WorldXYZ(com.github.sirblobman.api.object.WorldXYZ) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager) ExpansionListener(com.github.sirblobman.combatlogx.api.expansion.ExpansionListener) ItemSpawnEvent(org.bukkit.event.entity.ItemSpawnEvent) Player(org.bukkit.entity.Player) EntityPickupItemEvent(org.bukkit.event.entity.EntityPickupItemEvent) EventHandler(org.bukkit.event.EventHandler) EntityDeathEvent(org.bukkit.event.entity.EntityDeathEvent) IDeathListener(com.github.sirblobman.combatlogx.api.listener.IDeathListener) QueryPickupEvent(combatlogx.expansion.loot.protection.event.QueryPickupEvent) Location(org.bukkit.Location) Replacer(com.github.sirblobman.api.language.Replacer) World(org.bukkit.World) Map(java.util.Map) PlayerInventory(org.bukkit.inventory.PlayerInventory) ProtectedItem(combatlogx.expansion.loot.protection.object.ProtectedItem) EntityDamageEvent(org.bukkit.event.entity.EntityDamageEvent) Bukkit(org.bukkit.Bukkit) DamageCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause) PlayerPunishEvent(com.github.sirblobman.combatlogx.api.event.PlayerPunishEvent) Entity(org.bukkit.entity.Entity) PlayerUntagEvent(com.github.sirblobman.combatlogx.api.event.PlayerUntagEvent) ExpiringMap(net.jodah.expiringmap.ExpiringMap) Set(java.util.Set) UUID(java.util.UUID) LivingEntity(org.bukkit.entity.LivingEntity) Expansion(com.github.sirblobman.combatlogx.api.expansion.Expansion) ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) ItemStack(org.bukkit.inventory.ItemStack) TimeUnit(java.util.concurrent.TimeUnit) UntagReason(com.github.sirblobman.combatlogx.api.object.UntagReason) List(java.util.List) EventPriority(org.bukkit.event.EventPriority) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) Collections(java.util.Collections) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) Entity(org.bukkit.entity.Entity) LivingEntity(org.bukkit.entity.LivingEntity) Player(org.bukkit.entity.Player) ProtectedItem(combatlogx.expansion.loot.protection.object.ProtectedItem) PlayerInventory(org.bukkit.inventory.PlayerInventory) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) World(org.bukkit.World) LivingEntity(org.bukkit.entity.LivingEntity) DamageCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause) UUID(java.util.UUID) ItemStack(org.bukkit.inventory.ItemStack) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager) EntityDamageEvent(org.bukkit.event.entity.EntityDamageEvent) Location(org.bukkit.Location)

Example 4 with ConfigurationManager

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");
}
Also used : ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager)

Example 5 with ConfigurationManager

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");
}
Also used : ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager)

Aggregations

ConfigurationManager (com.github.sirblobman.api.configuration.ConfigurationManager)116 YamlConfiguration (org.bukkit.configuration.file.YamlConfiguration)61 Expansion (com.github.sirblobman.combatlogx.api.expansion.Expansion)21 ICombatLogX (com.github.sirblobman.combatlogx.api.ICombatLogX)10 PlayerDataManager (com.github.sirblobman.api.configuration.PlayerDataManager)6 LanguageManager (com.github.sirblobman.api.language.LanguageManager)6 Player (org.bukkit.entity.Player)6 ICombatManager (com.github.sirblobman.combatlogx.api.manager.ICombatManager)5 EventHandler (org.bukkit.event.EventHandler)5 Entity (org.bukkit.entity.Entity)4 LoggerExpansion (combatlogx.expansion.logger.LoggerExpansion)3 MobTaggerExpansion (combatlogx.expansion.mob.tagger.MobTaggerExpansion)3 LivingEntity (org.bukkit.entity.LivingEntity)3 PluginManager (org.bukkit.plugin.PluginManager)3 ExpansionManager (com.github.sirblobman.combatlogx.api.expansion.ExpansionManager)2 IDeathListener (com.github.sirblobman.combatlogx.api.listener.IDeathListener)2 ScoreboardExpansion (combatlogx.expansion.scoreboard.ScoreboardExpansion)2 SimpleDateFormat (java.text.SimpleDateFormat)2 Date (java.util.Date)2 World (org.bukkit.World)2