mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-12-01 06:23:22 +01:00
f1ee558e3a
- Switched from YamlConfiguration to BreezeConfiguration (from ChestShop 4) - Fixed getDouble() - Instead of checking for Admin Shops, we just pass in a new AdminShop Container - Created events for shop creation, protection checks and protection creation - Expanded string data value parsing, for example - you can use "Ocelot Monster" on the sign - Collected all external plugin wrappers in a single folder - Instead of using statics, now we use objects - Fixed enchantments for armour - Made config more readable - Added a setting for removing empty shops - Switched from System.out to logger - Also, switched from ugly file logging to Java's native one (FileHandler) - Added an option to tax transactions even when SERVER_ECONOMY_ACCOUNT is empty - Changed the Container interface
38 lines
1.1 KiB
Java
38 lines
1.1 KiB
Java
package com.Acrobot.ChestShop.Plugins;
|
|
|
|
import com.Acrobot.ChestShop.Config.Config;
|
|
import com.Acrobot.ChestShop.Config.Property;
|
|
import com.Acrobot.ChestShop.Events.ShopCreatedEvent;
|
|
import com.herocraftonline.heroes.characters.Hero;
|
|
import com.herocraftonline.heroes.characters.classes.HeroClass;
|
|
import org.bukkit.event.EventHandler;
|
|
import org.bukkit.event.Listener;
|
|
|
|
/**
|
|
* @author Acrobot
|
|
*/
|
|
public class Heroes implements Listener {
|
|
private com.herocraftonline.heroes.Heroes heroes;
|
|
|
|
public Heroes(com.herocraftonline.heroes.Heroes heroes) {
|
|
this.heroes = heroes;
|
|
}
|
|
|
|
@EventHandler
|
|
public void shopCreated(ShopCreatedEvent event) {
|
|
double heroExp = Config.getDouble(Property.HEROES_EXP);
|
|
|
|
if (heroExp == 0) {
|
|
return;
|
|
}
|
|
|
|
Hero hero = heroes.getCharacterManager().getHero(event.getPlayer());
|
|
|
|
if (hero.hasParty()) {
|
|
hero.getParty().gainExp(heroExp, HeroClass.ExperienceType.EXTERNAL, event.getPlayer().getLocation());
|
|
} else {
|
|
hero.gainExp(heroExp, HeroClass.ExperienceType.EXTERNAL);
|
|
}
|
|
}
|
|
}
|