mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Cleaning up a bit.
This commit is contained in:
parent
45c6c20ccd
commit
a82cc9609b
@ -7,7 +7,6 @@ import java.util.Set;
|
|||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
@ -54,7 +53,7 @@ public class McMMOPlayer {
|
|||||||
* we make sure that all class inheriting from SkillManager are instanced.
|
* we make sure that all class inheriting from SkillManager are instanced.
|
||||||
* Which solution is better, I let you decide. - bm01
|
* Which solution is better, I let you decide. - bm01
|
||||||
*/
|
*/
|
||||||
private Map<SkillType, SkillManager> skillManagers = new HashMap<SkillType, SkillManager>();
|
private final Map<SkillType, SkillManager> skillManagers = new HashMap<SkillType, SkillManager>();
|
||||||
|
|
||||||
private Party party;
|
private Party party;
|
||||||
private Party invite;
|
private Party invite;
|
||||||
@ -76,11 +75,11 @@ public class McMMOPlayer {
|
|||||||
private int lastSalvageClick;
|
private int lastSalvageClick;
|
||||||
private boolean godMode;
|
private boolean godMode;
|
||||||
|
|
||||||
private Map<AbilityType, Boolean> abilityMode = new HashMap<AbilityType, Boolean>();
|
private final Map<AbilityType, Boolean> abilityMode = new HashMap<AbilityType, Boolean>();
|
||||||
private Map<AbilityType, Boolean> abilityInformed = new HashMap<AbilityType, Boolean>();
|
private final Map<AbilityType, Boolean> abilityInformed = new HashMap<AbilityType, Boolean>();
|
||||||
|
|
||||||
private Map<ToolType, Boolean> toolMode = new HashMap<ToolType, Boolean>();
|
private final Map<ToolType, Boolean> toolMode = new HashMap<ToolType, Boolean>();
|
||||||
private Map<ToolType, Integer> toolATS = new HashMap<ToolType, Integer>();
|
private final Map<ToolType, Integer> toolATS = new HashMap<ToolType, Integer>();
|
||||||
|
|
||||||
private int recentlyHurt;
|
private int recentlyHurt;
|
||||||
private int respawnATS;
|
private int respawnATS;
|
||||||
@ -202,10 +201,10 @@ public class McMMOPlayer {
|
|||||||
* Set the mode of an ability.
|
* Set the mode of an ability.
|
||||||
*
|
*
|
||||||
* @param ability The ability to check
|
* @param ability The ability to check
|
||||||
* @param bool True if the ability is active, false otherwise
|
* @param isActive True if the ability is active, false otherwise
|
||||||
*/
|
*/
|
||||||
public void setAbilityMode(AbilityType ability, boolean bool) {
|
public void setAbilityMode(AbilityType ability, boolean isActive) {
|
||||||
abilityMode.put(ability, bool);
|
abilityMode.put(ability, isActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -222,10 +221,10 @@ public class McMMOPlayer {
|
|||||||
* Set the informed state of an ability.
|
* Set the informed state of an ability.
|
||||||
*
|
*
|
||||||
* @param ability The ability to check
|
* @param ability The ability to check
|
||||||
* @param bool True if the ability is informed, false otherwise
|
* @param isInformed True if the ability is informed, false otherwise
|
||||||
*/
|
*/
|
||||||
public void setAbilityInformed(AbilityType ability, boolean bool) {
|
public void setAbilityInformed(AbilityType ability, boolean isInformed) {
|
||||||
abilityInformed.put(ability, bool);
|
abilityInformed.put(ability, isInformed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -263,10 +262,10 @@ public class McMMOPlayer {
|
|||||||
* Set the current prep mode of a tool.
|
* Set the current prep mode of a tool.
|
||||||
*
|
*
|
||||||
* @param tool Tool to set the mode for
|
* @param tool Tool to set the mode for
|
||||||
* @param bool true if the tool should be prepped, false otherwise
|
* @param isPrepared true if the tool should be prepped, false otherwise
|
||||||
*/
|
*/
|
||||||
public void setToolPreparationMode(ToolType tool, boolean bool) {
|
public void setToolPreparationMode(ToolType tool, boolean isPrepared) {
|
||||||
toolMode.put(tool, bool);
|
toolMode.put(tool, isPrepared);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -332,7 +331,7 @@ public class McMMOPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void actualizeTeleportCommenceLocation(Player player) {
|
public void actualizeTeleportCommenceLocation(Player player) {
|
||||||
setTeleportCommenceLocation(player.getLocation());
|
teleportCommence = player.getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -500,6 +499,10 @@ public class McMMOPlayer {
|
|||||||
* @param xp Experience amount to add
|
* @param xp Experience amount to add
|
||||||
*/
|
*/
|
||||||
public void applyXpGain(SkillType skillType, float xp) {
|
public void applyXpGain(SkillType skillType, float xp) {
|
||||||
|
if (!Permissions.skillEnabled(player, skillType)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (skillType.isChildSkill()) {
|
if (skillType.isChildSkill()) {
|
||||||
Set<SkillType> parentSkills = FamilyTree.getParents(skillType);
|
Set<SkillType> parentSkills = FamilyTree.getParents(skillType);
|
||||||
|
|
||||||
@ -510,10 +513,6 @@ public class McMMOPlayer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Permissions.skillEnabled(player, skillType)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
McMMOPlayerXpGainEvent event = new McMMOPlayerXpGainEvent(player, skillType, xp);
|
McMMOPlayerXpGainEvent event = new McMMOPlayerXpGainEvent(player, skillType, xp);
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
@ -529,7 +528,7 @@ public class McMMOPlayer {
|
|||||||
spoutHud.setLastGained(skillType);
|
spoutHud.setLastGained(skillType);
|
||||||
}
|
}
|
||||||
|
|
||||||
isUsingUnarmed = skillType == SkillType.UNARMED;
|
isUsingUnarmed = (skillType == SkillType.UNARMED);
|
||||||
SkillUtils.xpCheckSkill(skillType, player, profile);
|
SkillUtils.xpCheckSkill(skillType, player, profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -562,11 +561,7 @@ public class McMMOPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPartyInvite() {
|
public boolean hasPartyInvite() {
|
||||||
if (invite != null) {
|
return (invite != null);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParty(Party party) {
|
public void setParty(Party party) {
|
||||||
@ -578,11 +573,7 @@ public class McMMOPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean inParty() {
|
public boolean inParty() {
|
||||||
if (party != null) {
|
return (party != null);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeParty() {
|
public void removeParty() {
|
||||||
@ -610,11 +601,7 @@ public class McMMOPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPtpRequest() {
|
public boolean hasPtpRequest() {
|
||||||
if (ptpRequest != null) {
|
return (ptpRequest != null);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePtpRequest() {
|
public void removePtpRequest() {
|
||||||
@ -646,11 +633,7 @@ public class McMMOPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setItemShareModifier(int modifier) {
|
public void setItemShareModifier(int modifier) {
|
||||||
if (modifier < 10) {
|
itemShareModifier = Math.max(10, modifier);
|
||||||
modifier = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
itemShareModifier = modifier;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -693,15 +676,14 @@ public class McMMOPlayer {
|
|||||||
* @return Modified experience
|
* @return Modified experience
|
||||||
*/
|
*/
|
||||||
private float modifyXpGain(SkillType skillType, float xp) {
|
private float modifyXpGain(SkillType skillType, float xp) {
|
||||||
if (player.getGameMode() == GameMode.CREATIVE || (skillType.getMaxLevel() < profile.getSkillLevel(skillType) + 1) || (Config.getInstance().getPowerLevelCap() < getPowerLevel() + 1)) {
|
if (player.getGameMode() == GameMode.CREATIVE || (skillType.getMaxLevel() <= profile.getSkillLevel(skillType)) || (Config.getInstance().getPowerLevelCap() <= getPowerLevel())) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
xp = (float) (xp / skillType.getXpModifier() * Config.getInstance().getExperienceGainsGlobalMultiplier());
|
xp = (float) (xp / skillType.getXpModifier() * Config.getInstance().getExperienceGainsGlobalMultiplier());
|
||||||
|
|
||||||
if (Config.getInstance().getToolModsEnabled()) {
|
if (Config.getInstance().getToolModsEnabled()) {
|
||||||
ItemStack item = player.getItemInHand();
|
CustomTool tool = ModUtils.getToolFromItemStack(player.getItemInHand());
|
||||||
CustomTool tool = ModUtils.getToolFromItemStack(item);
|
|
||||||
|
|
||||||
if (tool != null) {
|
if (tool != null) {
|
||||||
xp *= tool.getXpMultiplier();
|
xp *= tool.getXpMultiplier();
|
||||||
|
Loading…
Reference in New Issue
Block a user