mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-30 10:51:20 +01:00
RaC support
This commit is contained in:
parent
42b9cbd205
commit
4466118c4c
BIN
lib/RacesAndClasses.jar
Normal file
BIN
lib/RacesAndClasses.jar
Normal file
Binary file not shown.
7
pom.xml
7
pom.xml
@ -187,6 +187,13 @@
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/MythicMobs.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.tobiyas</groupId>
|
||||
<artifactId>RacesAndClasses</artifactId>
|
||||
<version>1.2.6</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/RacesAndClasses.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.endlesscode</groupId>
|
||||
<artifactId>rpginventory</artifactId>
|
||||
|
@ -17,13 +17,14 @@ public interface RPGHandler {
|
||||
HEROES("Heroes", HeroesHook.class),
|
||||
SKILLAPI("SkillAPI", SkillAPIHook.class),
|
||||
RPGPLAYERLEVELING("RPGPlayerLeveling", RPGPlayerLevelingHook.class),
|
||||
RACESANDCLASSES("RacesAndClasses", RacesAndClassesHook.class),
|
||||
BATTLELEVELS("BattleLevels", BattleLevelsHook.class),
|
||||
MCMMO("mcMMO", McMMOHook.class),
|
||||
MCRPG("McRPG", McRPGHook.class),
|
||||
SKILLS("Skills", SkillsHook.class);
|
||||
|
||||
private Class<? extends RPGHandler> pluginClass;
|
||||
private String name;
|
||||
private final Class<? extends RPGHandler> pluginClass;
|
||||
private final String name;
|
||||
|
||||
private PluginEnum(String name, Class<? extends RPGHandler> pluginClass) {
|
||||
this.pluginClass = pluginClass;
|
||||
|
@ -0,0 +1,86 @@
|
||||
package net.Indyuce.mmoitems.comp.rpg;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import de.tobiyas.racesandclasses.eventprocessing.events.leveling.LevelDownEvent;
|
||||
import de.tobiyas.racesandclasses.eventprocessing.events.leveling.LevelUpEvent;
|
||||
import de.tobiyas.racesandclasses.playermanagement.player.RaCPlayer;
|
||||
import de.tobiyas.racesandclasses.playermanagement.player.RaCPlayerManager;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||
import net.Indyuce.mmoitems.api.player.RPGPlayer;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
|
||||
public class RacesAndClassesHook implements RPGHandler, Listener {
|
||||
public RacesAndClassesHook() {
|
||||
Bukkit.getPluginManager().registerEvents(this, MMOItems.plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshStats(PlayerData data) {
|
||||
RaCPlayer info = ((RacePlayer) data.getRPG()).info;
|
||||
info.getManaManager().removeMaxManaBonus("MMOItems");
|
||||
info.getManaManager().addMaxManaBonus("MMOItems", data.getStats().getStat(ItemStat.MAX_MANA));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RPGPlayer getInfo(PlayerData data) {
|
||||
return new RacePlayer(data);
|
||||
}
|
||||
|
||||
/*
|
||||
* update the player's inventory whenever he levels up since it could change its
|
||||
* current stat requirements
|
||||
*/
|
||||
@EventHandler
|
||||
public void a(LevelUpEvent event) {
|
||||
PlayerData.get(event.getPlayer()).scheduleDelayedInventoryUpdate();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void b(LevelDownEvent event) {
|
||||
PlayerData.get(event.getPlayer()).scheduleDelayedInventoryUpdate();
|
||||
}
|
||||
|
||||
public class RacePlayer extends RPGPlayer {
|
||||
private final RaCPlayer info;
|
||||
|
||||
public RacePlayer(PlayerData playerData) {
|
||||
super(playerData);
|
||||
|
||||
info = RaCPlayerManager.get().getPlayer(playerData.getUniqueId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel() {
|
||||
return info.getCurrentLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClassName() {
|
||||
return info.getclass().getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMana() {
|
||||
return info.getCurrentMana();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getStamina() {
|
||||
return info.getPlayer().getFoodLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMana(double value) {
|
||||
info.getManaManager().fillMana(value - info.getManaManager().getCurrentMana());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStamina(double value) {
|
||||
info.getPlayer().setFoodLevel((int) value);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user