Don't activate abilities when a player is in creative mode.

This commit is contained in:
TfT_02 2013-03-25 23:15:09 +01:00
parent 3ae9956df9
commit 94b560ba01
4 changed files with 19 additions and 5 deletions

View File

@ -21,6 +21,7 @@ Version 1.4.04-dev
= Fixed bug which caused an NPE when trying to join the party of a non-existing player or when ptp to a non-existing player = Fixed bug which caused an NPE when trying to join the party of a non-existing player or when ptp to a non-existing player
! Changed config node name for the skill experience modifiers from "Experience.Formula.Multiplier.[Skill]" to "Experience.Formula.Modifier.[Skill]" ! Changed config node name for the skill experience modifiers from "Experience.Formula.Multiplier.[Skill]" to "Experience.Formula.Modifier.[Skill]"
! Updated localization files ! Updated localization files
! mcMMO abilities can no longer be activated while in Creative mode
- Removed deprecated functions from API classes. - Removed deprecated functions from API classes.
- Removed functions for getting the PlayerProfile - using API classes is preferred, but if not the McMMOPlayer should be used instead - Removed functions for getting the PlayerProfile - using API classes is preferred, but if not the McMMOPlayer should be used instead
- Removed Ender Dragon, Wither, and Witch from granting combat experience and related configuration options - Removed Ender Dragon, Wither, and Witch from granting combat experience and related configuration options

View File

@ -2,6 +2,7 @@ package com.gmail.nossr50.listeners;
import java.util.List; import java.util.List;
import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -135,6 +136,10 @@ public class BlockListener implements Listener {
return; return;
} }
if (player.getGameMode() == GameMode.CREATIVE) {
return;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
BlockState blockState = event.getBlock().getState(); BlockState blockState = event.getBlock().getState();
ItemStack heldItem = player.getItemInHand(); ItemStack heldItem = player.getItemInHand();
@ -208,6 +213,10 @@ public class BlockListener implements Listener {
return; return;
} }
if (player.getGameMode() == GameMode.CREATIVE) {
return;
}
BlockState blockState = event.getBlock().getState(); BlockState blockState = event.getBlock().getState();
ItemStack heldItem = player.getItemInHand(); ItemStack heldItem = player.getItemInHand();

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.listeners; package com.gmail.nossr50.listeners;
import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
@ -274,6 +275,10 @@ public class PlayerListener implements Listener {
return; return;
} }
if (player.getGameMode() == GameMode.CREATIVE) {
return;
}
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
ItemStack heldItem = player.getItemInHand(); ItemStack heldItem = player.getItemInHand();
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
@ -333,6 +338,10 @@ public class PlayerListener implements Listener {
return; return;
} }
if (player.getGameMode() == GameMode.CREATIVE) {
return;
}
ItemStack heldItem = player.getItemInHand(); ItemStack heldItem = player.getItemInHand();
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.skills.repair;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -175,10 +174,6 @@ public class RepairManager extends SkillManager {
public void handleSalvage(Location location, ItemStack item) { public void handleSalvage(Location location, ItemStack item) {
Player player = getPlayer(); Player player = getPlayer();
if (player.getGameMode() != GameMode.SURVIVAL) {
return;
}
if (getSkillLevel() < Repair.salvageUnlockLevel) { if (getSkillLevel() < Repair.salvageUnlockLevel) {
player.sendMessage(LocaleLoader.getString("Repair.Skills.AdeptSalvage")); player.sendMessage(LocaleLoader.getString("Repair.Skills.AdeptSalvage"));
return; return;