Skip to content

Commit

Permalink
backwards mcmmo compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
milkwalk committed Feb 3, 2019
1 parent 8387573 commit 9a71c84
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ Updated version of XPBoost spigot plugin.

Download avaliable on https://www.spigotmc.org/resources/xp-boost.13537/

## Minecraft versions
XPBoost is compatible with the following minecraft versions

- 1.8.8
- 1.9
- 1.10
- 1.11
-



## Maven
You will need to have Dubcat public repository added to your `pom.xml` under `<repositories>`
Expand Down
17 changes: 15 additions & 2 deletions src/cz/dubcat/xpboost/support/McMMO.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cz.dubcat.xpboost.support;

import java.lang.reflect.InvocationTargetException;
import java.util.UUID;

import org.bukkit.entity.Player;
Expand Down Expand Up @@ -32,8 +33,20 @@ public McMMO(XPBoostMain plugin) {
public void gainXp(McMMOPlayerXpGainEvent event) {
Player player = event.getPlayer();
UUID id = player.getUniqueId();
String enumSkillname = event.getSkill().name();
String skillName = event.getSkill().getName();
String enumSkillname = null;
String skillName = null;
try {
Object skillType = event.getClass().getMethod("getSkill").invoke(event);
skillName = (String) skillType.getClass().getMethod("getName").invoke(skillType);
enumSkillname = (String) skillType.getClass().getMethod("name").invoke(skillType);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException
| SecurityException e) {
e.printStackTrace();
return;
}
if(enumSkillname == null || skillName == null) {
return;
}
int exp = (int) event.getRawXpGained();
int expnew = 0;
if (expbug) {
Expand Down

0 comments on commit 9a71c84

Please sign in to comment.