Compact our checks.

This commit is contained in:
GJ 2013-04-04 07:42:33 -04:00
parent 4c44b72f78
commit 9463e210b8
3 changed files with 5 additions and 25 deletions

View File

@ -650,11 +650,7 @@ public class McMMOPlayer {
* @return Modified experience * @return Modified experience
*/ */
private int modifyXpGain(SkillType skillType, int xp) { private int modifyXpGain(SkillType skillType, int xp) {
if (player.getGameMode() == GameMode.CREATIVE) { if (player.getGameMode() == GameMode.CREATIVE || (skillType.getMaxLevel() < profile.getSkillLevel(skillType) + 1) || (Config.getInstance().getPowerLevelCap() < getPowerLevel() + 1)) {
return 0;
}
if ((skillType.getMaxLevel() < profile.getSkillLevel(skillType) + 1) || (Config.getInstance().getPowerLevelCap() < getPowerLevel() + 1)) {
return 0; return 0;
} }

View File

@ -131,11 +131,7 @@ public class BlockListener implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (Misc.isNPCEntity(player)) { if (Misc.isNPCEntity(player) || player.getGameMode() == GameMode.CREATIVE) {
return;
}
if (player.getGameMode() == GameMode.CREATIVE) {
return; return;
} }
@ -208,11 +204,7 @@ public class BlockListener implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (Misc.isNPCEntity(player)) { if (Misc.isNPCEntity(player) || player.getGameMode() == GameMode.CREATIVE) {
return;
}
if (player.getGameMode() == GameMode.CREATIVE) {
return; return;
} }

View File

@ -279,11 +279,7 @@ public class PlayerListener implements Listener {
public void onPlayerInteractLowest(PlayerInteractEvent event) { public void onPlayerInteractLowest(PlayerInteractEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (Misc.isNPCEntity(player)) { if (Misc.isNPCEntity(player) || player.getGameMode() == GameMode.CREATIVE) {
return;
}
if (player.getGameMode() == GameMode.CREATIVE) {
return; return;
} }
@ -342,11 +338,7 @@ public class PlayerListener implements Listener {
public void onPlayerInteract(PlayerInteractEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (Misc.isNPCEntity(player)) { if (Misc.isNPCEntity(player) || player.getGameMode() == GameMode.CREATIVE) {
return;
}
if (player.getGameMode() == GameMode.CREATIVE) {
return; return;
} }