Skip to content

Commit 94da6dd

Browse files
committed
Fix the path to the main class + correct the event priority
1 parent 2fddf5c commit 94da6dd

File tree

6 files changed

+16
-6
lines changed

6 files changed

+16
-6
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ McCombatLevel
44
Bukkit plugin that creates and displays a combat level for mcMMO.
55

66
See http://dev.bukkit.org/bukkit-plugins/mccombatlevel/
7+
8+
http://www.curse.com/bukkit-plugins/minecraft/mccombatlevel

src/main/java/com/gmail/mrphpfan/mccombatlevel/McCombatLevel.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ public int calculateLevel(McMMOPlayer mcMMOPlayer) {
146146
} catch (Exception ex) {
147147
getLogger().log(Level.WARNING, "Exception occured falling back", ex);
148148
if (levelCalculator instanceof DefaultCalculator) {
149+
//nulling the calculator, because event the default replacer created an exception
149150
levelCalculator = null;
150151
}
151152

src/main/java/com/gmail/mrphpfan/mccombatlevel/PlayerListener.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public void onPlayerLogout(PlayerQuitEvent event) {
5050
plugin.removeCachedLevels(event.getPlayer());
5151
}
5252

53-
@EventHandler(ignoreCancelled = true)
53+
//set it to low in order to update the level before other plugins want to get that value
54+
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
5455
public void onPlayerLevelUp(McMMOPlayerLevelUpEvent event) {
5556
SkillType skill = event.getSkill();
5657

@@ -64,7 +65,7 @@ public void onPlayerLevelUp(McMMOPlayerLevelUpEvent event) {
6465

6566
//some chat plugins listen and change stuff on the default priority. In order
6667
//to see these changes we need an higher priority.
67-
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
68+
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
6869
public void onChat(AsyncPlayerChatEvent event) {
6970
if (!plugin.isPrefixEnabled()) {
7071
//check if prefix is enabled

src/main/java/com/gmail/mrphpfan/mccombatlevel/calculator/DefaultCalculator.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
public class DefaultCalculator implements LevelCalculator {
99

10+
//max of 1000 level
11+
private static final int MAX_LEVEL = 1000;
12+
1013
@Override
1114
public int calculateLevel(McMMOPlayer mcMMOPlayer) {
1215
int swords = getLevel(mcMMOPlayer, SkillType.SWORDS);
@@ -22,7 +25,10 @@ public int calculateLevel(McMMOPlayer mcMMOPlayer) {
2225

2326
private int getLevel(McMMOPlayer mcMMOPlayer, SkillType skillType) {
2427
int skillLevel = mcMMOPlayer.getSkillLevel(skillType);
25-
//max of 1000 level
26-
return skillLevel <= 1000 ? skillLevel : 1000;
28+
if (skillLevel <= MAX_LEVEL) {
29+
return skillLevel;
30+
}
31+
32+
return MAX_LEVEL;
2733
}
2834
}

src/main/java/com/gmail/mrphpfan/mccombatlevel/calculator/JavaScriptCalculator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public int calculateLevel(McMMOPlayer mcMMOPlayer) {
3333
throw new RuntimeException("Formula doesn't returned a number");
3434
}
3535
} catch (ScriptException ex) {
36-
throw new RuntimeException("Combat level cannot be calculated", ex);
36+
throw new RuntimeException("Combat level cannot be calculated", ex.getCause());
3737
}
3838
}
3939

src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: ${project.name}
2-
main: com.gmail.mrphpfan.McCombatLevel
2+
main: ${project.groupId}.${project.artifactId}.${project.name}
33
version: ${project.version}
44

55
# meta informations for plugin managers and auto updaters

0 commit comments

Comments
 (0)