mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
Moved everything that could be moved from PlayerProfile to McMMOPlayer
PlayerProfile now only store stored (flatfile or MySQL) data
This commit is contained in:
parent
f8b4412049
commit
c0b7f8a323
@ -2,7 +2,7 @@ package com.gmail.nossr50.api;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
@ -10,38 +10,38 @@ public final class AbilityAPI {
|
|||||||
private AbilityAPI() {}
|
private AbilityAPI() {}
|
||||||
|
|
||||||
public static boolean berserkEnabled(Player player) {
|
public static boolean berserkEnabled(Player player) {
|
||||||
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.BERSERK);
|
return UserManager.getPlayer(player).getAbilityMode(AbilityType.BERSERK);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean gigaDrillBreakerEnabled(Player player) {
|
public static boolean gigaDrillBreakerEnabled(Player player) {
|
||||||
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.GIGA_DRILL_BREAKER);
|
return UserManager.getPlayer(player).getAbilityMode(AbilityType.GIGA_DRILL_BREAKER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean greenTerraEnabled(Player player) {
|
public static boolean greenTerraEnabled(Player player) {
|
||||||
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.GREEN_TERRA);
|
return UserManager.getPlayer(player).getAbilityMode(AbilityType.GREEN_TERRA);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean serratedStrikesEnabled(Player player) {
|
public static boolean serratedStrikesEnabled(Player player) {
|
||||||
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.SERRATED_STRIKES);
|
return UserManager.getPlayer(player).getAbilityMode(AbilityType.SERRATED_STRIKES);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean skullSplitterEnabled(Player player) {
|
public static boolean skullSplitterEnabled(Player player) {
|
||||||
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.SKULL_SPLITTER);
|
return UserManager.getPlayer(player).getAbilityMode(AbilityType.SKULL_SPLITTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean superBreakerEnabled(Player player) {
|
public static boolean superBreakerEnabled(Player player) {
|
||||||
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.SUPER_BREAKER);
|
return UserManager.getPlayer(player).getAbilityMode(AbilityType.SUPER_BREAKER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean treeFellerEnabled(Player player) {
|
public static boolean treeFellerEnabled(Player player) {
|
||||||
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.TREE_FELLER);
|
return UserManager.getPlayer(player).getAbilityMode(AbilityType.TREE_FELLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAnyAbilityEnabled(Player player) {
|
public static boolean isAnyAbilityEnabled(Player player) {
|
||||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
for (AbilityType ability : AbilityType.values()) {
|
for (AbilityType ability : AbilityType.values()) {
|
||||||
if (profile.getAbilityMode(ability)) {
|
if (mcMMOPlayer.getAbilityMode(ability)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import com.gmail.nossr50.util.player.UserManager;
|
|||||||
public class McabilityCommand implements CommandExecutor {
|
public class McabilityCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
PlayerProfile profile;
|
McMMOPlayer mcMMOPlayer;
|
||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -23,16 +23,16 @@ public class McabilityCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
profile = UserManager.getPlayer((Player) sender).getProfile();
|
mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||||
|
|
||||||
if (profile.getAbilityUse()) {
|
if (mcMMOPlayer.getAbilityUse()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Ability.On"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Ability.On"));
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.toggleAbilityUse();
|
mcMMOPlayer.toggleAbilityUse();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
@ -41,12 +41,12 @@ public class McabilityCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(args[0]);
|
mcMMOPlayer = UserManager.getPlayer(args[0]);
|
||||||
|
|
||||||
if (mcMMOPlayer == null) {
|
if (mcMMOPlayer == null) {
|
||||||
profile = new PlayerProfile(args[0], false);
|
PlayerProfile playerProfile = new PlayerProfile(args[0], false);
|
||||||
|
|
||||||
if (!profile.isLoaded()) {
|
if (!playerProfile.isLoaded()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -56,21 +56,20 @@ public class McabilityCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
profile = mcMMOPlayer.getProfile();
|
|
||||||
|
|
||||||
if (!player.isOnline()) {
|
if (!player.isOnline()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile.getAbilityUse()) {
|
if (mcMMOPlayer.getAbilityUse()) {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
|
player.sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Ability.On"));
|
player.sendMessage(LocaleLoader.getString("Commands.Ability.On"));
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.toggleAbilityUse();
|
mcMMOPlayer.toggleAbilityUse();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -14,7 +14,7 @@ import com.gmail.nossr50.util.player.UserManager;
|
|||||||
public class McgodCommand implements CommandExecutor {
|
public class McgodCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
PlayerProfile profile;
|
McMMOPlayer mcMMOPlayer;
|
||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -27,21 +27,21 @@ public class McgodCommand implements CommandExecutor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
profile = UserManager.getPlayer((Player) sender).getProfile();
|
mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||||
|
|
||||||
if (profile == null) {
|
if (mcMMOPlayer == null) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile.getGodMode()) {
|
if (mcMMOPlayer.getGodMode()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Disabled"));
|
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Disabled"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Enabled"));
|
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.toggleGodMode();
|
mcMMOPlayer.toggleGodMode();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
@ -50,12 +50,12 @@ public class McgodCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(args[0]);
|
mcMMOPlayer = UserManager.getPlayer(args[0]);
|
||||||
|
|
||||||
if (mcMMOPlayer == null) {
|
if (mcMMOPlayer == null) {
|
||||||
profile = new PlayerProfile(args[0], false);
|
PlayerProfile playerProfile = new PlayerProfile(args[0], false);
|
||||||
|
|
||||||
if (!profile.isLoaded()) {
|
if (!playerProfile.isLoaded()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -64,7 +64,6 @@ public class McgodCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
profile = mcMMOPlayer.getProfile();
|
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
|
|
||||||
if (!player.isOnline()) {
|
if (!player.isOnline()) {
|
||||||
@ -72,14 +71,14 @@ public class McgodCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile.getGodMode()) {
|
if (mcMMOPlayer.getGodMode()) {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Disabled"));
|
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Disabled"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Enabled"));
|
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.toggleGodMode();
|
mcMMOPlayer.toggleGodMode();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -5,7 +5,7 @@ import org.bukkit.command.CommandExecutor;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
@ -14,16 +14,16 @@ public class McnotifyCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
PlayerProfile profile = UserManager.getPlayer((Player) sender).getProfile();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||||
|
|
||||||
if (profile.useChatNotifications()) {
|
if (mcMMOPlayer.useChatNotifications()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Notifications.Off"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Notifications.Off"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Notifications.On"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Notifications.On"));
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.toggleChatNotifications();
|
mcMMOPlayer.toggleChatNotifications();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -14,7 +14,7 @@ import com.gmail.nossr50.util.player.UserManager;
|
|||||||
public class McrefreshCommand implements CommandExecutor {
|
public class McrefreshCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
PlayerProfile profile;
|
McMMOPlayer mcMMOPlayer;
|
||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -27,12 +27,12 @@ public class McrefreshCommand implements CommandExecutor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
profile = UserManager.getPlayer(sender.getName()).getProfile();
|
mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
||||||
|
|
||||||
profile.setRecentlyHurt(0);
|
mcMMOPlayer.setRecentlyHurt(0);
|
||||||
profile.resetCooldowns();
|
mcMMOPlayer.getProfile().resetCooldowns();
|
||||||
profile.resetToolPrepMode();
|
mcMMOPlayer.resetToolPrepMode();
|
||||||
profile.resetAbilityMode();
|
mcMMOPlayer.resetAbilityMode();
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
|
sender.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
|
||||||
return true;
|
return true;
|
||||||
@ -43,12 +43,12 @@ public class McrefreshCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(args[0]);
|
mcMMOPlayer = UserManager.getPlayer(args[0]);
|
||||||
|
|
||||||
if (mcMMOPlayer == null) {
|
if (mcMMOPlayer == null) {
|
||||||
profile = new PlayerProfile(args[0], false);
|
PlayerProfile playerProfile = new PlayerProfile(args[0], false);
|
||||||
|
|
||||||
if (!profile.isLoaded()) {
|
if (!playerProfile.isLoaded()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ public class McrefreshCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
profile = mcMMOPlayer.getProfile();
|
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
|
|
||||||
if (!player.isOnline()) {
|
if (!player.isOnline()) {
|
||||||
@ -64,10 +64,10 @@ public class McrefreshCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.setRecentlyHurt(0);
|
mcMMOPlayer.setRecentlyHurt(0);
|
||||||
profile.resetCooldowns();
|
mcMMOPlayer.getProfile().resetCooldowns();
|
||||||
profile.resetToolPrepMode();
|
mcMMOPlayer.resetToolPrepMode();
|
||||||
profile.resetAbilityMode();
|
mcMMOPlayer.resetAbilityMode();
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
|
player.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrefresh.Success", args[0]));
|
sender.sendMessage(LocaleLoader.getString("Commands.mcrefresh.Success", args[0]));
|
||||||
|
@ -9,7 +9,6 @@ import org.bukkit.entity.Player;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|
||||||
import com.gmail.nossr50.events.party.McMMOPartyTeleportEvent;
|
import com.gmail.nossr50.events.party.McMMOPartyTeleportEvent;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
@ -21,7 +20,6 @@ import com.gmail.nossr50.util.player.UserManager;
|
|||||||
public class PtpCommand implements CommandExecutor {
|
public class PtpCommand implements CommandExecutor {
|
||||||
private Player player;
|
private Player player;
|
||||||
private McMMOPlayer mcMMOPlayer;
|
private McMMOPlayer mcMMOPlayer;
|
||||||
private PlayerProfile playerProfile;
|
|
||||||
|
|
||||||
private Player target;
|
private Player target;
|
||||||
private McMMOPlayer mcMMOTarget;
|
private McMMOPlayer mcMMOTarget;
|
||||||
@ -34,10 +32,6 @@ public class PtpCommand implements CommandExecutor {
|
|||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
player = (Player) sender;
|
|
||||||
mcMMOPlayer = UserManager.getPlayer(player);
|
|
||||||
playerProfile = mcMMOPlayer.getProfile();
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("toggle")) {
|
if (args[0].equalsIgnoreCase("toggle")) {
|
||||||
if (!Permissions.partyTeleportToggle(sender)) {
|
if (!Permissions.partyTeleportToggle(sender)) {
|
||||||
sender.sendMessage(command.getPermissionMessage());
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
@ -56,8 +50,9 @@ public class PtpCommand implements CommandExecutor {
|
|||||||
return acceptAnyTeleportRequest();
|
return acceptAnyTeleportRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
player = (Player) sender;
|
||||||
int ptpCooldown = Config.getInstance().getPTPCommandCooldown();
|
int ptpCooldown = Config.getInstance().getPTPCommandCooldown();
|
||||||
long recentlyHurt = playerProfile.getRecentlyHurt() * Misc.TIME_CONVERSION_FACTOR;
|
long recentlyHurt = UserManager.getPlayer(player).getRecentlyHurt() * Misc.TIME_CONVERSION_FACTOR;
|
||||||
|
|
||||||
if (System.currentTimeMillis() - recentlyHurt >= (ptpCooldown * Misc.TIME_CONVERSION_FACTOR)) {
|
if (System.currentTimeMillis() - recentlyHurt >= (ptpCooldown * Misc.TIME_CONVERSION_FACTOR)) {
|
||||||
player.sendMessage(LocaleLoader.getString("Party.Teleport.Hurt", ptpCooldown));
|
player.sendMessage(LocaleLoader.getString("Party.Teleport.Hurt", ptpCooldown));
|
||||||
@ -94,6 +89,7 @@ public class PtpCommand implements CommandExecutor {
|
|||||||
player.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
|
player.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
|
||||||
|
|
||||||
int ptpRequestExpire = Config.getInstance().getPTPCommandTimeout();
|
int ptpRequestExpire = Config.getInstance().getPTPCommandTimeout();
|
||||||
|
|
||||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request1", player.getName()));
|
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request1", player.getName()));
|
||||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request2", ptpRequestExpire));
|
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request2", ptpRequestExpire));
|
||||||
return true;
|
return true;
|
||||||
@ -203,8 +199,8 @@ public class PtpCommand implements CommandExecutor {
|
|||||||
|
|
||||||
private boolean handlePartyTeleportEvent(Player player, Player target) {
|
private boolean handlePartyTeleportEvent(Player player, Player target) {
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(player, target, mcMMOPlayer.getParty().getName());
|
McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(player, target, mcMMOPlayer.getParty().getName());
|
||||||
|
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
@ -214,7 +210,7 @@ public class PtpCommand implements CommandExecutor {
|
|||||||
player.teleport(target);
|
player.teleport(target);
|
||||||
player.sendMessage(LocaleLoader.getString("Party.Teleport.Player", target.getName()));
|
player.sendMessage(LocaleLoader.getString("Party.Teleport.Player", target.getName()));
|
||||||
target.sendMessage(LocaleLoader.getString("Party.Teleport.Target", player.getName()));
|
target.sendMessage(LocaleLoader.getString("Party.Teleport.Target", player.getName()));
|
||||||
mcMMOPlayer.getProfile().actualizeRecentlyHurt();
|
mcMMOPlayer.actualizeRecentlyHurt();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,9 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.mods.CustomTool;
|
import com.gmail.nossr50.datatypes.mods.CustomTool;
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||||
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
|
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
|
||||||
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
|
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
@ -49,8 +51,9 @@ public class McMMOPlayer {
|
|||||||
*/
|
*/
|
||||||
private Map<SkillType, SkillManager> skillManagers = new HashMap<SkillType, SkillManager>();
|
private Map<SkillType, SkillManager> skillManagers = new HashMap<SkillType, SkillManager>();
|
||||||
|
|
||||||
private Party party;
|
private Party party;
|
||||||
private Party invite;
|
private Party invite;
|
||||||
|
private int itemShareModifier;
|
||||||
|
|
||||||
private Player ptpRequest;
|
private Player ptpRequest;
|
||||||
private boolean ptpEnabled = true;
|
private boolean ptpEnabled = true;
|
||||||
@ -59,8 +62,20 @@ public class McMMOPlayer {
|
|||||||
|
|
||||||
private boolean partyChatMode;
|
private boolean partyChatMode;
|
||||||
private boolean adminChatMode;
|
private boolean adminChatMode;
|
||||||
|
private boolean displaySkillNotifications = true;
|
||||||
|
|
||||||
private int itemShareModifier;
|
private boolean abilityUse = true;
|
||||||
|
private boolean placedAnvil;
|
||||||
|
private boolean placedSalvageAnvil;
|
||||||
|
private boolean godMode;
|
||||||
|
|
||||||
|
private Map<AbilityType, Boolean> abilityMode = new HashMap<AbilityType, Boolean>();
|
||||||
|
private Map<AbilityType, Boolean> abilityInformed = new HashMap<AbilityType, Boolean>();
|
||||||
|
private Map<ToolType, Boolean> toolPreparationMode = new HashMap<ToolType, Boolean>();
|
||||||
|
private Map<ToolType, Integer> toolATS = new HashMap<ToolType, Integer>();
|
||||||
|
|
||||||
|
private int recentlyHurt;
|
||||||
|
private int respawnATS;
|
||||||
|
|
||||||
public McMMOPlayer(Player player) {
|
public McMMOPlayer(Player player) {
|
||||||
String playerName = player.getName();
|
String playerName = player.getName();
|
||||||
@ -88,6 +103,16 @@ public class McMMOPlayer {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
mcMMO.p.getPluginLoader().disablePlugin(mcMMO.p);
|
mcMMO.p.getPluginLoader().disablePlugin(mcMMO.p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (AbilityType abilityType : AbilityType.values()) {
|
||||||
|
abilityMode.put(abilityType, false);
|
||||||
|
abilityInformed.put(abilityType, true); // This is intended
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ToolType toolType : ToolType.values()) {
|
||||||
|
toolPreparationMode.put(toolType, false);
|
||||||
|
toolATS.put(toolType, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AcrobaticsManager getAcrobaticsManager() {
|
public AcrobaticsManager getAcrobaticsManager() {
|
||||||
@ -134,6 +159,198 @@ public class McMMOPlayer {
|
|||||||
return (UnarmedManager) skillManagers.get(SkillType.UNARMED);
|
return (UnarmedManager) skillManagers.get(SkillType.UNARMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Abilities
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the mode of all abilities.
|
||||||
|
*/
|
||||||
|
public void resetAbilityMode() {
|
||||||
|
for (AbilityType ability : AbilityType.values()) {
|
||||||
|
setAbilityMode(ability, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the mode of an ability.
|
||||||
|
*
|
||||||
|
* @param ability The ability to check
|
||||||
|
* @return true if the ability is enabled, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean getAbilityMode(AbilityType ability) {
|
||||||
|
return abilityMode.get(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the mode of an ability.
|
||||||
|
*
|
||||||
|
* @param ability The ability to check
|
||||||
|
* @param bool True if the ability is active, false otherwise
|
||||||
|
*/
|
||||||
|
public void setAbilityMode(AbilityType ability, boolean bool) {
|
||||||
|
abilityMode.put(ability, bool);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the informed state of an ability
|
||||||
|
*
|
||||||
|
* @param ability The ability to check
|
||||||
|
* @return true if the ability is informed, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean getAbilityInformed(AbilityType ability) {
|
||||||
|
return abilityInformed.get(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the informed state of an ability.
|
||||||
|
*
|
||||||
|
* @param ability The ability to check
|
||||||
|
* @param bool True if the ability is informed, false otherwise
|
||||||
|
*/
|
||||||
|
public void setAbilityInformed(AbilityType ability, boolean bool) {
|
||||||
|
abilityInformed.put(ability, bool);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current prep mode of a tool.
|
||||||
|
*
|
||||||
|
* @param tool Tool to get the mode for
|
||||||
|
* @return true if the tool is prepped, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean getToolPreparationMode(ToolType tool) {
|
||||||
|
return toolPreparationMode.get(tool);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getAbilityUse() {
|
||||||
|
return abilityUse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toggleAbilityUse() {
|
||||||
|
abilityUse = !abilityUse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Tools
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the prep modes of all tools.
|
||||||
|
*/
|
||||||
|
public void resetToolPrepMode() {
|
||||||
|
for (ToolType tool : ToolType.values()) {
|
||||||
|
setToolPreparationMode(tool, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current prep mode of a tool.
|
||||||
|
*
|
||||||
|
* @param tool Tool to set the mode for
|
||||||
|
* @param bool true if the tool should be prepped, false otherwise
|
||||||
|
*/
|
||||||
|
public void setToolPreparationMode(ToolType tool, boolean bool) {
|
||||||
|
toolPreparationMode.put(tool, bool);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current prep ATS of a tool.
|
||||||
|
*
|
||||||
|
* @param tool Tool to get the ATS for
|
||||||
|
* @return the ATS for the tool
|
||||||
|
*/
|
||||||
|
public long getToolPreparationATS(ToolType tool) {
|
||||||
|
return toolATS.get(tool);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current prep ATS of a tool.
|
||||||
|
*
|
||||||
|
* @param tool Tool to set the ATS for
|
||||||
|
* @param ATS the ATS of the tool
|
||||||
|
*/
|
||||||
|
public void setToolPreparationATS(ToolType tool, long ATS) {
|
||||||
|
int startTime = (int) (ATS / Misc.TIME_CONVERSION_FACTOR);
|
||||||
|
|
||||||
|
toolATS.put(tool, startTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Recently Hurt
|
||||||
|
*/
|
||||||
|
|
||||||
|
public int getRecentlyHurt() {
|
||||||
|
return recentlyHurt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecentlyHurt(int value) {
|
||||||
|
recentlyHurt = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actualizeRecentlyHurt() {
|
||||||
|
recentlyHurt = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exploit Prevention
|
||||||
|
*/
|
||||||
|
|
||||||
|
public int getRespawnATS() {
|
||||||
|
return respawnATS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actualizeRespawnATS() {
|
||||||
|
respawnATS = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Repair Anvil Placement
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void togglePlacedAnvil() {
|
||||||
|
placedAnvil = !placedAnvil;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getPlacedAnvil() {
|
||||||
|
return placedAnvil;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Salvage Anvil Placement
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void togglePlacedSalvageAnvil() {
|
||||||
|
placedSalvageAnvil = !placedSalvageAnvil;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getPlacedSalvageAnvil() {
|
||||||
|
return placedSalvageAnvil;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* God Mode
|
||||||
|
*/
|
||||||
|
|
||||||
|
public boolean getGodMode() {
|
||||||
|
return godMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toggleGodMode() {
|
||||||
|
godMode = !godMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Skill notifications
|
||||||
|
*/
|
||||||
|
|
||||||
|
public boolean useChatNotifications() {
|
||||||
|
return displaySkillNotifications;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toggleChatNotifications() {
|
||||||
|
displaySkillNotifications = !displaySkillNotifications;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the power level of this player.
|
* Gets the power level of this player.
|
||||||
*
|
*
|
||||||
@ -223,7 +440,9 @@ public class McMMOPlayer {
|
|||||||
SkillUtils.xpCheckSkill(skillType, player, profile);
|
SkillUtils.xpCheckSkill(skillType, player, profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Players & Profiles
|
/*
|
||||||
|
* Players & Profiles
|
||||||
|
*/
|
||||||
|
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
return player;
|
return player;
|
||||||
@ -237,7 +456,9 @@ public class McMMOPlayer {
|
|||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Party Stuff
|
/*
|
||||||
|
* Party Stuff
|
||||||
|
*/
|
||||||
|
|
||||||
public void setPartyInvite(Party invite) {
|
public void setPartyInvite(Party invite) {
|
||||||
this.invite = invite;
|
this.invite = invite;
|
||||||
@ -339,6 +560,10 @@ public class McMMOPlayer {
|
|||||||
itemShareModifier = modifier;
|
itemShareModifier = modifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chat modes
|
||||||
|
*/
|
||||||
|
|
||||||
public boolean getAdminChatMode() {
|
public boolean getAdminChatMode() {
|
||||||
return adminChatMode;
|
return adminChatMode;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import java.io.FileReader;
|
|||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -14,7 +15,6 @@ import com.gmail.nossr50.config.spout.SpoutConfig;
|
|||||||
import com.gmail.nossr50.database.DatabaseManager;
|
import com.gmail.nossr50.database.DatabaseManager;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
|
||||||
import com.gmail.nossr50.datatypes.spout.huds.HudType;
|
import com.gmail.nossr50.datatypes.spout.huds.HudType;
|
||||||
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
|
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
|
||||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||||
@ -28,51 +28,14 @@ public class PlayerProfile {
|
|||||||
private McMMOHud spoutHud;
|
private McMMOHud spoutHud;
|
||||||
private HudType hudType;
|
private HudType hudType;
|
||||||
|
|
||||||
// Toggles
|
|
||||||
private boolean loaded;
|
|
||||||
private boolean godMode;
|
|
||||||
|
|
||||||
private boolean placedAnvil;
|
|
||||||
private boolean placedSalvageAnvil;
|
|
||||||
|
|
||||||
private boolean hoePreparationMode;
|
|
||||||
private boolean shovelPreparationMode;
|
|
||||||
private boolean swordsPreparationMode;
|
|
||||||
private boolean fistsPreparationMode;
|
|
||||||
private boolean pickaxePreparationMode;
|
|
||||||
private boolean axePreparationMode;
|
|
||||||
|
|
||||||
private boolean greenTerraMode;
|
|
||||||
private boolean treeFellerMode;
|
|
||||||
private boolean superBreakerMode;
|
|
||||||
private boolean gigaDrillBreakerMode;
|
|
||||||
private boolean serratedStrikesMode;
|
|
||||||
private boolean skullSplitterMode;
|
|
||||||
private boolean berserkMode;
|
|
||||||
|
|
||||||
private boolean greenTerraInformed = true;
|
|
||||||
private boolean berserkInformed = true;
|
|
||||||
private boolean skullSplitterInformed = true;
|
|
||||||
private boolean gigaDrillBreakerInformed = true;
|
|
||||||
private boolean superBreakerInformed = true;
|
|
||||||
private boolean blastMiningInformed = true;
|
|
||||||
private boolean serratedStrikesInformed = true;
|
|
||||||
private boolean treeFellerInformed = true;
|
|
||||||
|
|
||||||
private boolean abilityUse = true;
|
|
||||||
private boolean displaySkillNotifications = true;
|
|
||||||
|
|
||||||
// Timestamps
|
|
||||||
private int recentlyHurt;
|
|
||||||
private int respawnATS;
|
|
||||||
|
|
||||||
// mySQL Stuff
|
// mySQL Stuff
|
||||||
private int userId;
|
private int userId;
|
||||||
|
|
||||||
private HashMap<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skills and Levels
|
private boolean loaded;
|
||||||
private HashMap<SkillType, Integer> skillsXp = new HashMap<SkillType, Integer>(); // Skills and Xp
|
|
||||||
private HashMap<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>();
|
private Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skills and Levels
|
||||||
private HashMap<ToolType, Integer> toolATS = new HashMap<ToolType, Integer>();
|
private Map<SkillType, Integer> skillsXp = new HashMap<SkillType, Integer>(); // Skills and Xp
|
||||||
|
private Map<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>();
|
||||||
|
|
||||||
private final static String location = mcMMO.getUsersFilePath();
|
private final static String location = mcMMO.getUsersFilePath();
|
||||||
|
|
||||||
@ -565,42 +528,6 @@ public class PlayerProfile {
|
|||||||
return loaded;
|
return loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* God Mode
|
|
||||||
*/
|
|
||||||
|
|
||||||
public boolean getGodMode() {
|
|
||||||
return godMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void toggleGodMode() {
|
|
||||||
godMode = !godMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Repair Anvil Placement
|
|
||||||
*/
|
|
||||||
|
|
||||||
public void togglePlacedAnvil() {
|
|
||||||
placedAnvil = !placedAnvil;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getPlacedAnvil() {
|
|
||||||
return placedAnvil;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Salvage Anvil Placement
|
|
||||||
*/
|
|
||||||
|
|
||||||
public void togglePlacedSalvageAnvil() {
|
|
||||||
placedSalvageAnvil = !placedSalvageAnvil;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getPlacedSalvageAnvil() {
|
|
||||||
return placedSalvageAnvil;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* HUD Stuff
|
* HUD Stuff
|
||||||
*/
|
*/
|
||||||
@ -621,315 +548,6 @@ public class PlayerProfile {
|
|||||||
this.hudType = hudType;
|
this.hudType = hudType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Tools
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset the prep modes of all tools.
|
|
||||||
*/
|
|
||||||
public void resetToolPrepMode() {
|
|
||||||
for (ToolType tool : ToolType.values()) {
|
|
||||||
setToolPreparationMode(tool, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the current prep mode of a tool.
|
|
||||||
*
|
|
||||||
* @param tool Tool to get the mode for
|
|
||||||
* @return true if the tool is prepped, false otherwise
|
|
||||||
*/
|
|
||||||
public boolean getToolPreparationMode(ToolType tool) {
|
|
||||||
switch (tool) {
|
|
||||||
case AXE:
|
|
||||||
return axePreparationMode;
|
|
||||||
|
|
||||||
case FISTS:
|
|
||||||
return fistsPreparationMode;
|
|
||||||
|
|
||||||
case HOE:
|
|
||||||
return hoePreparationMode;
|
|
||||||
|
|
||||||
case PICKAXE:
|
|
||||||
return pickaxePreparationMode;
|
|
||||||
|
|
||||||
case SHOVEL:
|
|
||||||
return shovelPreparationMode;
|
|
||||||
|
|
||||||
case SWORD:
|
|
||||||
return swordsPreparationMode;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the current prep mode of a tool.
|
|
||||||
*
|
|
||||||
* @param tool Tool to set the mode for
|
|
||||||
* @param bool true if the tool should be prepped, false otherwise
|
|
||||||
*/
|
|
||||||
public void setToolPreparationMode(ToolType tool, boolean bool) {
|
|
||||||
switch (tool) {
|
|
||||||
case AXE:
|
|
||||||
axePreparationMode = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FISTS:
|
|
||||||
fistsPreparationMode = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HOE:
|
|
||||||
hoePreparationMode = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PICKAXE:
|
|
||||||
pickaxePreparationMode = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SHOVEL:
|
|
||||||
shovelPreparationMode = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SWORD:
|
|
||||||
swordsPreparationMode = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the current prep ATS of a tool.
|
|
||||||
*
|
|
||||||
* @param tool Tool to get the ATS for
|
|
||||||
* @return the ATS for the tool
|
|
||||||
*/
|
|
||||||
public long getToolPreparationATS(ToolType tool) {
|
|
||||||
return toolATS.get(tool);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the current prep ATS of a tool.
|
|
||||||
*
|
|
||||||
* @param tool Tool to set the ATS for
|
|
||||||
* @param ATS the ATS of the tool
|
|
||||||
*/
|
|
||||||
public void setToolPreparationATS(ToolType tool, long ATS) {
|
|
||||||
int startTime = (int) (ATS / Misc.TIME_CONVERSION_FACTOR);
|
|
||||||
|
|
||||||
toolATS.put(tool, startTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Abilities
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset the prep modes of all tools.
|
|
||||||
*/
|
|
||||||
public void resetAbilityMode() {
|
|
||||||
for (AbilityType ability : AbilityType.values()) {
|
|
||||||
setAbilityMode(ability, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the mode of an ability.
|
|
||||||
*
|
|
||||||
* @param ability The ability to check
|
|
||||||
* @return true if the ability is enabled, false otherwise
|
|
||||||
*/
|
|
||||||
public boolean getAbilityMode(AbilityType ability) {
|
|
||||||
switch (ability) {
|
|
||||||
case BERSERK:
|
|
||||||
return berserkMode;
|
|
||||||
|
|
||||||
case SUPER_BREAKER:
|
|
||||||
return superBreakerMode;
|
|
||||||
|
|
||||||
case GIGA_DRILL_BREAKER:
|
|
||||||
return gigaDrillBreakerMode;
|
|
||||||
|
|
||||||
case GREEN_TERRA:
|
|
||||||
return greenTerraMode;
|
|
||||||
|
|
||||||
case SKULL_SPLITTER:
|
|
||||||
return skullSplitterMode;
|
|
||||||
|
|
||||||
case TREE_FELLER:
|
|
||||||
return treeFellerMode;
|
|
||||||
|
|
||||||
case SERRATED_STRIKES:
|
|
||||||
return serratedStrikesMode;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the mode of an ability.
|
|
||||||
*
|
|
||||||
* @param ability The ability to check
|
|
||||||
* @param bool True if the ability is active, false otherwise
|
|
||||||
*/
|
|
||||||
public void setAbilityMode(AbilityType ability, boolean bool) {
|
|
||||||
switch (ability) {
|
|
||||||
case BERSERK:
|
|
||||||
berserkMode = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SUPER_BREAKER:
|
|
||||||
superBreakerMode = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GIGA_DRILL_BREAKER:
|
|
||||||
gigaDrillBreakerMode = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GREEN_TERRA:
|
|
||||||
greenTerraMode = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SKULL_SPLITTER:
|
|
||||||
skullSplitterMode = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TREE_FELLER:
|
|
||||||
treeFellerMode = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SERRATED_STRIKES:
|
|
||||||
serratedStrikesMode = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the informed state of an ability
|
|
||||||
*
|
|
||||||
* @param ability The ability to check
|
|
||||||
* @return true if the ability is informed, false otherwise
|
|
||||||
*/
|
|
||||||
public boolean getAbilityInformed(AbilityType ability) {
|
|
||||||
switch (ability) {
|
|
||||||
case BERSERK:
|
|
||||||
return berserkInformed;
|
|
||||||
|
|
||||||
case BLAST_MINING:
|
|
||||||
return blastMiningInformed;
|
|
||||||
|
|
||||||
case SUPER_BREAKER:
|
|
||||||
return superBreakerInformed;
|
|
||||||
|
|
||||||
case GIGA_DRILL_BREAKER:
|
|
||||||
return gigaDrillBreakerInformed;
|
|
||||||
|
|
||||||
case GREEN_TERRA:
|
|
||||||
return greenTerraInformed;
|
|
||||||
|
|
||||||
case SKULL_SPLITTER:
|
|
||||||
return skullSplitterInformed;
|
|
||||||
|
|
||||||
case TREE_FELLER:
|
|
||||||
return treeFellerInformed;
|
|
||||||
|
|
||||||
case SERRATED_STRIKES:
|
|
||||||
return serratedStrikesInformed;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the informed state of an ability.
|
|
||||||
*
|
|
||||||
* @param ability The ability to check
|
|
||||||
* @param bool True if the ability is informed, false otherwise
|
|
||||||
*/
|
|
||||||
public void setAbilityInformed(AbilityType ability, boolean bool) {
|
|
||||||
switch (ability) {
|
|
||||||
case BERSERK:
|
|
||||||
berserkInformed = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BLAST_MINING:
|
|
||||||
blastMiningInformed = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SUPER_BREAKER:
|
|
||||||
superBreakerInformed = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GIGA_DRILL_BREAKER:
|
|
||||||
gigaDrillBreakerInformed = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GREEN_TERRA:
|
|
||||||
greenTerraInformed = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SKULL_SPLITTER:
|
|
||||||
skullSplitterInformed = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TREE_FELLER:
|
|
||||||
treeFellerInformed = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SERRATED_STRIKES:
|
|
||||||
serratedStrikesInformed = bool;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getAbilityUse() {
|
|
||||||
return abilityUse;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void toggleAbilityUse() {
|
|
||||||
abilityUse = !abilityUse;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Recently Hurt
|
|
||||||
*/
|
|
||||||
|
|
||||||
public int getRecentlyHurt() {
|
|
||||||
return recentlyHurt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRecentlyHurt(int value) {
|
|
||||||
recentlyHurt = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void actualizeRecentlyHurt() {
|
|
||||||
recentlyHurt = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ability Notifications
|
|
||||||
*/
|
|
||||||
|
|
||||||
public boolean useChatNotifications() {
|
|
||||||
return displaySkillNotifications;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void toggleChatNotifications() {
|
|
||||||
displaySkillNotifications = !displaySkillNotifications;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cooldowns
|
* Cooldowns
|
||||||
*/
|
*/
|
||||||
@ -965,18 +583,6 @@ public class PlayerProfile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Exploit Prevention
|
|
||||||
*/
|
|
||||||
|
|
||||||
public int getRespawnATS() {
|
|
||||||
return respawnATS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void actualizeRespawnATS() {
|
|
||||||
respawnATS = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Xp Functions
|
* Xp Functions
|
||||||
*/
|
*/
|
||||||
|
@ -23,7 +23,6 @@ import com.gmail.nossr50.config.AdvancedConfig;
|
|||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.config.HiddenConfig;
|
import com.gmail.nossr50.config.HiddenConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||||
@ -145,7 +144,6 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
|
||||||
BlockState blockState = event.getBlock().getState();
|
BlockState blockState = event.getBlock().getState();
|
||||||
|
|
||||||
ItemStack heldItem = player.getItemInHand();
|
ItemStack heldItem = player.getItemInHand();
|
||||||
@ -156,7 +154,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
/* Green Terra */
|
/* Green Terra */
|
||||||
if (herbalismManager.canActivateAbility()) {
|
if (herbalismManager.canActivateAbility()) {
|
||||||
SkillUtils.abilityCheck(player, SkillType.HERBALISM);
|
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.HERBALISM);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -180,14 +178,14 @@ public class BlockListener implements Listener {
|
|||||||
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
|
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
|
||||||
miningManager.miningBlockCheck(blockState);
|
miningManager.miningBlockCheck(blockState);
|
||||||
|
|
||||||
if (profile.getAbilityMode(AbilityType.SUPER_BREAKER)) {
|
if (mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER)) {
|
||||||
miningManager.miningBlockCheck(blockState);
|
miningManager.miningBlockCheck(blockState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WOOD CUTTING */
|
/* WOOD CUTTING */
|
||||||
else if (BlockUtils.isLog(blockState) && Permissions.skillEnabled(player, SkillType.WOODCUTTING) && !mcMMO.placeStore.isTrue(blockState)) {
|
else if (BlockUtils.isLog(blockState) && Permissions.skillEnabled(player, SkillType.WOODCUTTING) && !mcMMO.placeStore.isTrue(blockState)) {
|
||||||
if (profile.getAbilityMode(AbilityType.TREE_FELLER) && Permissions.treeFeller(player) && ItemUtils.isAxe(heldItem)) {
|
if (mcMMOPlayer.getAbilityMode(AbilityType.TREE_FELLER) && Permissions.treeFeller(player) && ItemUtils.isAxe(heldItem)) {
|
||||||
Woodcutting.beginTreeFeller(blockState, player);
|
Woodcutting.beginTreeFeller(blockState, player);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -207,7 +205,7 @@ public class BlockListener implements Listener {
|
|||||||
ExcavationManager excavationManager = UserManager.getPlayer(player).getExcavationManager();
|
ExcavationManager excavationManager = UserManager.getPlayer(player).getExcavationManager();
|
||||||
excavationManager.excavationBlockCheck(blockState);
|
excavationManager.excavationBlockCheck(blockState);
|
||||||
|
|
||||||
if (profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
|
if (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
|
||||||
excavationManager.gigaDrillBreaker(blockState);
|
excavationManager.gigaDrillBreaker(blockState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -271,7 +269,7 @@ public class BlockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
BlockState blockState = event.getBlock().getState();
|
BlockState blockState = event.getBlock().getState();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -283,30 +281,30 @@ public class BlockListener implements Listener {
|
|||||||
ItemStack heldItem = player.getItemInHand();
|
ItemStack heldItem = player.getItemInHand();
|
||||||
|
|
||||||
if (HiddenConfig.getInstance().useEnchantmentBuffs()) {
|
if (HiddenConfig.getInstance().useEnchantmentBuffs()) {
|
||||||
if ((ItemUtils.isPickaxe(heldItem) && !profile.getAbilityMode(AbilityType.SUPER_BREAKER)) || (ItemUtils.isShovel(heldItem) && !profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER))) {
|
if ((ItemUtils.isPickaxe(heldItem) && !mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER)) || (ItemUtils.isShovel(heldItem) && !mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER))) {
|
||||||
SkillUtils.removeAbilityBuff(heldItem);
|
SkillUtils.removeAbilityBuff(heldItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ((profile.getAbilityMode(AbilityType.SUPER_BREAKER) && !BlockUtils.affectedBySuperBreaker(blockState)) || (profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && !BlockUtils.affectedByGigaDrillBreaker(blockState))) {
|
if ((mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER) && !BlockUtils.affectedBySuperBreaker(blockState)) || (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && !BlockUtils.affectedByGigaDrillBreaker(blockState))) {
|
||||||
SkillUtils.handleAbilitySpeedDecrease(player);
|
SkillUtils.handleAbilitySpeedDecrease(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile.getToolPreparationMode(ToolType.HOE) && ItemUtils.isHoe(heldItem) && (BlockUtils.affectedByGreenTerra(blockState) || BlockUtils.canMakeMossy(blockState)) && Permissions.greenTerra(player)) {
|
if (mcMMOPlayer.getToolPreparationMode(ToolType.HOE) && ItemUtils.isHoe(heldItem) && (BlockUtils.affectedByGreenTerra(blockState) || BlockUtils.canMakeMossy(blockState)) && Permissions.greenTerra(player)) {
|
||||||
SkillUtils.abilityCheck(player, SkillType.HERBALISM);
|
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.HERBALISM);
|
||||||
}
|
}
|
||||||
else if (profile.getToolPreparationMode(ToolType.AXE) && ItemUtils.isAxe(heldItem) && BlockUtils.isLog(blockState) && Permissions.treeFeller(player)) {
|
else if (mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && ItemUtils.isAxe(heldItem) && BlockUtils.isLog(blockState) && Permissions.treeFeller(player)) {
|
||||||
SkillUtils.abilityCheck(player, SkillType.WOODCUTTING);
|
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.WOODCUTTING);
|
||||||
}
|
}
|
||||||
else if (profile.getToolPreparationMode(ToolType.PICKAXE) && ItemUtils.isPickaxe(heldItem) && BlockUtils.affectedBySuperBreaker(blockState) && Permissions.superBreaker(player)) {
|
else if (mcMMOPlayer.getToolPreparationMode(ToolType.PICKAXE) && ItemUtils.isPickaxe(heldItem) && BlockUtils.affectedBySuperBreaker(blockState) && Permissions.superBreaker(player)) {
|
||||||
SkillUtils.abilityCheck(player, SkillType.MINING);
|
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.MINING);
|
||||||
}
|
}
|
||||||
else if (profile.getToolPreparationMode(ToolType.SHOVEL) && ItemUtils.isShovel(heldItem) && BlockUtils.affectedByGigaDrillBreaker(blockState) && Permissions.gigaDrillBreaker(player)) {
|
else if (mcMMOPlayer.getToolPreparationMode(ToolType.SHOVEL) && ItemUtils.isShovel(heldItem) && BlockUtils.affectedByGigaDrillBreaker(blockState) && Permissions.gigaDrillBreaker(player)) {
|
||||||
SkillUtils.abilityCheck(player, SkillType.EXCAVATION);
|
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.EXCAVATION);
|
||||||
}
|
}
|
||||||
else if (profile.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW || BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
|
else if (mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW || BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
|
||||||
SkillUtils.abilityCheck(player, SkillType.UNARMED);
|
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.UNARMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,7 +313,7 @@ public class BlockListener implements Listener {
|
|||||||
*
|
*
|
||||||
* We don't need to check permissions here because they've already been checked for the ability to even activate.
|
* We don't need to check permissions here because they've already been checked for the ability to even activate.
|
||||||
*/
|
*/
|
||||||
if (profile.getAbilityMode(AbilityType.TREE_FELLER) && BlockUtils.isLog(blockState)) {
|
if (mcMMOPlayer.getAbilityMode(AbilityType.TREE_FELLER) && BlockUtils.isLog(blockState)) {
|
||||||
player.playSound(blockState.getLocation(), Sound.FIZZ, Misc.FIZZ_VOLUME, Misc.FIZZ_PITCH);
|
player.playSound(blockState.getLocation(), Sound.FIZZ, Misc.FIZZ_VOLUME, Misc.FIZZ_PITCH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -338,7 +336,6 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
|
||||||
ItemStack heldItem = player.getItemInHand();
|
ItemStack heldItem = player.getItemInHand();
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
BlockState blockState = block.getState();
|
BlockState blockState = block.getState();
|
||||||
@ -354,7 +351,7 @@ public class BlockListener implements Listener {
|
|||||||
blockState.update(true);
|
blockState.update(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (profile.getAbilityMode(AbilityType.BERSERK)) {
|
else if (mcMMOPlayer.getAbilityMode(AbilityType.BERSERK)) {
|
||||||
if (SkillUtils.triggerCheck(player, block, AbilityType.BERSERK)) {
|
if (SkillUtils.triggerCheck(player, block, AbilityType.BERSERK)) {
|
||||||
if (heldItem.getType() == Material.AIR) {
|
if (heldItem.getType() == Material.AIR) {
|
||||||
plugin.getServer().getPluginManager().callEvent(new FakePlayerAnimationEvent(player));
|
plugin.getServer().getPluginManager().callEvent(new FakePlayerAnimationEvent(player));
|
||||||
@ -370,7 +367,7 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((profile.getSkillLevel(SkillType.WOODCUTTING) >= AdvancedConfig.getInstance().getLeafBlowUnlockLevel()) && BlockUtils.isLeaves(blockState)) {
|
else if ((mcMMOPlayer.getProfile().getSkillLevel(SkillType.WOODCUTTING) >= AdvancedConfig.getInstance().getLeafBlowUnlockLevel()) && BlockUtils.isLeaves(blockState)) {
|
||||||
if (SkillUtils.triggerCheck(player, block, AbilityType.LEAF_BLOWER)) {
|
if (SkillUtils.triggerCheck(player, block, AbilityType.LEAF_BLOWER)) {
|
||||||
if (Config.getInstance().getWoodcuttingRequiresTool()) {
|
if (Config.getInstance().getWoodcuttingRequiresTool()) {
|
||||||
if (ItemUtils.isAxe(heldItem)) {
|
if (ItemUtils.isAxe(heldItem)) {
|
||||||
|
@ -28,7 +28,6 @@ import org.bukkit.event.entity.FoodLevelChangeEvent;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|
||||||
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
||||||
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
@ -161,10 +160,9 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
|
||||||
|
|
||||||
/* Check for invincibility */
|
/* Check for invincibility */
|
||||||
if (profile.getGodMode()) {
|
if (mcMMOPlayer.getGodMode()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -201,7 +199,7 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event.getDamage() >= 1) {
|
if (event.getDamage() >= 1) {
|
||||||
profile.actualizeRecentlyHurt();
|
mcMMOPlayer.actualizeRecentlyHurt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (livingEntity instanceof Tameable) {
|
else if (livingEntity instanceof Tameable) {
|
||||||
|
@ -30,7 +30,6 @@ import com.gmail.nossr50.chat.ChatManager;
|
|||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
@ -101,10 +100,9 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
|
||||||
|
|
||||||
if (profile.getGodMode() && !Permissions.mcgod(player)) {
|
if (mcMMOPlayer.getGodMode() && !Permissions.mcgod(player)) {
|
||||||
profile.toggleGodMode();
|
mcMMOPlayer.toggleGodMode();
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Forbidden"));
|
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Forbidden"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +126,7 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UserManager.addUser(player).getProfile().actualizeRespawnATS();
|
UserManager.addUser(player).actualizeRespawnATS();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,9 +138,9 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onPlayerDropItemEvent(PlayerDropItemEvent event) {
|
public void onPlayerDropItemEvent(PlayerDropItemEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if (playerProfile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) || playerProfile.getAbilityMode(AbilityType.SUPER_BREAKER)) {
|
if (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) || mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -261,7 +259,7 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UserManager.getPlayer(player).getProfile().actualizeRespawnATS();
|
UserManager.getPlayer(player).actualizeRespawnATS();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,7 +3,7 @@ package com.gmail.nossr50.runnables.skills;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
@ -20,14 +20,14 @@ public class SkillMonitorTask implements Runnable {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MONITOR SKILLS
|
* MONITOR SKILLS
|
||||||
*/
|
*/
|
||||||
for (SkillType skill : SkillType.values()) {
|
for (SkillType skill : SkillType.values()) {
|
||||||
if (skill.getTool() != null && skill.getAbility() != null) {
|
if (skill.getTool() != null && skill.getAbility() != null) {
|
||||||
SkillUtils.monitorSkill(player, profile, curTime, skill);
|
SkillUtils.monitorSkill(mcMMOPlayer, curTime, skill);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ public class SkillMonitorTask implements Runnable {
|
|||||||
*/
|
*/
|
||||||
for (AbilityType ability : AbilityType.values()) {
|
for (AbilityType ability : AbilityType.values()) {
|
||||||
if (ability.getCooldown() > 0) {
|
if (ability.getCooldown() > 0) {
|
||||||
SkillUtils.watchCooldown(player, profile, ability);
|
SkillUtils.watchCooldown(mcMMOPlayer, ability);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import org.bukkit.entity.LightningStrike;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
@ -52,14 +51,12 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(player, skill, Acrobatics.dodgeMaxChance, Acrobatics.dodgeMaxBonusLevel)) {
|
if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(player, skill, Acrobatics.dodgeMaxChance, Acrobatics.dodgeMaxBonusLevel)) {
|
||||||
ParticleEffectUtils.playDodgeEffect(player);
|
ParticleEffectUtils.playDodgeEffect(player);
|
||||||
|
|
||||||
PlayerProfile playerProfile = getProfile();
|
if (mcMMOPlayer.useChatNotifications()) {
|
||||||
|
|
||||||
if (playerProfile.useChatNotifications()) {
|
|
||||||
player.sendMessage(LocaleLoader.getString("Acrobatics.Combat.Proc"));
|
player.sendMessage(LocaleLoader.getString("Acrobatics.Combat.Proc"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Why do we check respawn cooldown here?
|
// Why do we check respawn cooldown here?
|
||||||
if (System.currentTimeMillis() >= playerProfile.getRespawnATS() + Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS) {
|
if (System.currentTimeMillis() >= mcMMOPlayer.getRespawnATS() + Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS) {
|
||||||
applyXpGain(damage * Acrobatics.dodgeXpModifier);
|
applyXpGain(damage * Acrobatics.dodgeXpModifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,11 +86,11 @@ public class ArcheryManager extends SkillManager {
|
|||||||
defender.teleport(dazedLocation);
|
defender.teleport(dazedLocation);
|
||||||
defender.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 20 * 10, 10));
|
defender.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 20 * 10, 10));
|
||||||
|
|
||||||
if (UserManager.getPlayer(defender).getProfile().useChatNotifications()) {
|
if (UserManager.getPlayer(defender).useChatNotifications()) {
|
||||||
defender.sendMessage(LocaleLoader.getString("Combat.TouchedFuzzy"));
|
defender.sendMessage(LocaleLoader.getString("Combat.TouchedFuzzy"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getProfile().useChatNotifications()) {
|
if (mcMMOPlayer.useChatNotifications()) {
|
||||||
attacker.sendMessage(LocaleLoader.getString("Combat.TargetDazed"));
|
attacker.sendMessage(LocaleLoader.getString("Combat.TargetDazed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,11 +41,11 @@ public class AxesManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseSkullSplitter(LivingEntity target) {
|
public boolean canUseSkullSplitter(LivingEntity target) {
|
||||||
return target.isValid() && getProfile().getAbilityMode(AbilityType.SKULL_SPLITTER) && Permissions.skullSplitter(getPlayer());
|
return target.isValid() && mcMMOPlayer.getAbilityMode(AbilityType.SKULL_SPLITTER) && Permissions.skullSplitter(getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canActivateAbility() {
|
public boolean canActivateAbility() {
|
||||||
return getProfile().getToolPreparationMode(ToolType.AXE) && Permissions.skullSplitter(getPlayer());
|
return mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && Permissions.skullSplitter(getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -118,14 +118,14 @@ public class AxesManager extends SkillManager {
|
|||||||
ParticleEffectUtils.playGreaterImpactEffect(target);
|
ParticleEffectUtils.playGreaterImpactEffect(target);
|
||||||
target.setVelocity(player.getLocation().getDirection().normalize().multiply(Axes.greaterImpactKnockbackMultiplier));
|
target.setVelocity(player.getLocation().getDirection().normalize().multiply(Axes.greaterImpactKnockbackMultiplier));
|
||||||
|
|
||||||
if (getProfile().useChatNotifications()) {
|
if (mcMMOPlayer.useChatNotifications()) {
|
||||||
player.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Proc"));
|
player.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Proc"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target instanceof Player) {
|
if (target instanceof Player) {
|
||||||
Player defender = (Player) target;
|
Player defender = (Player) target;
|
||||||
|
|
||||||
if (UserManager.getPlayer(defender).getProfile().useChatNotifications()) {
|
if (UserManager.getPlayer(defender).useChatNotifications()) {
|
||||||
defender.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Struck"));
|
defender.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Struck"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ import com.gmail.nossr50.config.Config;
|
|||||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||||
@ -30,7 +29,6 @@ import com.gmail.nossr50.util.Misc;
|
|||||||
import com.gmail.nossr50.util.ModUtils;
|
import com.gmail.nossr50.util.ModUtils;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
|
|
||||||
public class HerbalismManager extends SkillManager {
|
public class HerbalismManager extends SkillManager {
|
||||||
@ -62,15 +60,15 @@ public class HerbalismManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canGreenTerraBlock(BlockState blockState) {
|
public boolean canGreenTerraBlock(BlockState blockState) {
|
||||||
return getProfile().getAbilityMode(AbilityType.GREEN_TERRA) && BlockUtils.canMakeMossy(blockState);
|
return mcMMOPlayer.getAbilityMode(AbilityType.GREEN_TERRA) && BlockUtils.canMakeMossy(blockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canActivateAbility() {
|
public boolean canActivateAbility() {
|
||||||
return getProfile().getToolPreparationMode(ToolType.HOE) && Permissions.greenTerra(getPlayer());
|
return mcMMOPlayer.getToolPreparationMode(ToolType.HOE) && Permissions.greenTerra(getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canGreenTerraPlant() {
|
public boolean canGreenTerraPlant() {
|
||||||
return getProfile().getAbilityMode(AbilityType.GREEN_TERRA);
|
return mcMMOPlayer.getAbilityMode(AbilityType.GREEN_TERRA);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -288,9 +286,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();
|
if (mcMMOPlayer.getAbilityMode(AbilityType.GREEN_TERRA)) {
|
||||||
|
|
||||||
if (playerProfile.getAbilityMode(AbilityType.GREEN_TERRA)) {
|
|
||||||
playerInventory.removeItem(seed);
|
playerInventory.removeItem(seed);
|
||||||
player.updateInventory(); // Needed until replacement available
|
player.updateInventory(); // Needed until replacement available
|
||||||
|
|
||||||
|
@ -86,7 +86,6 @@ public class MiningManager extends SkillManager{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerProfile profile = getProfile();
|
|
||||||
TNTPrimed tnt = player.getWorld().spawn(targetBlock.getLocation(), TNTPrimed.class);
|
TNTPrimed tnt = player.getWorld().spawn(targetBlock.getLocation(), TNTPrimed.class);
|
||||||
|
|
||||||
SkillUtils.sendSkillMessage(player, AbilityType.BLAST_MINING.getAbilityPlayer(player));
|
SkillUtils.sendSkillMessage(player, AbilityType.BLAST_MINING.getAbilityPlayer(player));
|
||||||
@ -97,8 +96,8 @@ public class MiningManager extends SkillManager{
|
|||||||
targetBlock.setData((byte) 0x0);
|
targetBlock.setData((byte) 0x0);
|
||||||
targetBlock.setType(Material.AIR);
|
targetBlock.setType(Material.AIR);
|
||||||
|
|
||||||
profile.setSkillDATS(AbilityType.BLAST_MINING, System.currentTimeMillis());
|
getProfile().setSkillDATS(AbilityType.BLAST_MINING, System.currentTimeMillis());
|
||||||
profile.setAbilityInformed(AbilityType.BLAST_MINING, false);
|
mcMMOPlayer.setAbilityInformed(AbilityType.BLAST_MINING, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -204,9 +204,9 @@ public class Repair {
|
|||||||
* @param anvilID The item ID of the anvil block
|
* @param anvilID The item ID of the anvil block
|
||||||
*/
|
*/
|
||||||
public static void placedAnvilCheck(Player player, int anvilID) {
|
public static void placedAnvilCheck(Player player, int anvilID) {
|
||||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if (!profile.getPlacedAnvil()) {
|
if (!mcMMOPlayer.getPlacedAnvil()) {
|
||||||
if (mcMMO.spoutEnabled) {
|
if (mcMMO.spoutEnabled) {
|
||||||
SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
|
SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ public class Repair {
|
|||||||
}
|
}
|
||||||
|
|
||||||
player.playSound(player.getLocation(), Sound.ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
player.playSound(player.getLocation(), Sound.ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
||||||
profile.togglePlacedAnvil();
|
mcMMOPlayer.togglePlacedAnvil();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import org.getspout.spoutapi.player.SpoutPlayer;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
@ -59,9 +59,9 @@ public class Salvage {
|
|||||||
* @param anvilID The item ID of the anvil block
|
* @param anvilID The item ID of the anvil block
|
||||||
*/
|
*/
|
||||||
public static void placedAnvilCheck(final Player player, final int anvilID) {
|
public static void placedAnvilCheck(final Player player, final int anvilID) {
|
||||||
final PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if (!profile.getPlacedSalvageAnvil()) {
|
if (!mcMMOPlayer.getPlacedSalvageAnvil()) {
|
||||||
if (mcMMO.spoutEnabled) {
|
if (mcMMO.spoutEnabled) {
|
||||||
final SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
|
final SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ public class Salvage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
player.playSound(player.getLocation(), Sound.ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
player.playSound(player.getLocation(), Sound.ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
||||||
profile.togglePlacedSalvageAnvil();
|
mcMMOPlayer.togglePlacedSalvageAnvil();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,14 +34,14 @@ public class SwordsManager extends SkillManager {
|
|||||||
BleedTimerTask.add(target, Swords.bleedBaseTicks);
|
BleedTimerTask.add(target, Swords.bleedBaseTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getProfile().useChatNotifications()) {
|
if (mcMMOPlayer.useChatNotifications()) {
|
||||||
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding"));
|
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target instanceof Player) {
|
if (target instanceof Player) {
|
||||||
Player defender = (Player) target;
|
Player defender = (Player) target;
|
||||||
|
|
||||||
if (UserManager.getPlayer(defender).getProfile().useChatNotifications()) {
|
if (UserManager.getPlayer(defender).useChatNotifications()) {
|
||||||
defender.sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding.Started"));
|
defender.sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding.Started"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ public class TamingManager extends SkillManager {
|
|||||||
* @param livingEntity The entity to examine
|
* @param livingEntity The entity to examine
|
||||||
*/
|
*/
|
||||||
public void beastLore(LivingEntity livingEntity) {
|
public void beastLore(LivingEntity livingEntity) {
|
||||||
BeastLoreEventHandler eventHandler = new BeastLoreEventHandler(mcMMOPlayer.getPlayer(), livingEntity);
|
BeastLoreEventHandler eventHandler = new BeastLoreEventHandler(getPlayer(), livingEntity);
|
||||||
eventHandler.sendInspectMessage();
|
eventHandler.sendInspectMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,11 +119,11 @@ public class TamingManager extends SkillManager {
|
|||||||
* @param summonAmount The amount of material needed to summon the entity
|
* @param summonAmount The amount of material needed to summon the entity
|
||||||
*/
|
*/
|
||||||
private void callOfTheWild(EntityType type, int summonAmount) {
|
private void callOfTheWild(EntityType type, int summonAmount) {
|
||||||
if (!Permissions.callOfTheWild(mcMMOPlayer.getPlayer())) {
|
if (!Permissions.callOfTheWild(getPlayer())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CallOfTheWildEventHandler eventHandler = new CallOfTheWildEventHandler(mcMMOPlayer.getPlayer(), type, summonAmount);
|
CallOfTheWildEventHandler eventHandler = new CallOfTheWildEventHandler(getPlayer(), type, summonAmount);
|
||||||
|
|
||||||
ItemStack inHand = eventHandler.inHand;
|
ItemStack inHand = eventHandler.inHand;
|
||||||
int inHandAmount = inHand.getAmount();
|
int inHandAmount = inHand.getAmount();
|
||||||
|
@ -6,7 +6,6 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.metrics.MetricsManager;
|
import com.gmail.nossr50.metrics.MetricsManager;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@ -27,10 +26,9 @@ public final class ChimaeraWing {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
|
||||||
Block block = player.getLocation().getBlock();
|
Block block = player.getLocation().getBlock();
|
||||||
int amount = inHand.getAmount();
|
int amount = inHand.getAmount();
|
||||||
long recentlyHurt = profile.getRecentlyHurt() * Misc.TIME_CONVERSION_FACTOR;
|
long recentlyHurt = UserManager.getPlayer(player).getRecentlyHurt() * Misc.TIME_CONVERSION_FACTOR;
|
||||||
|
|
||||||
if (Permissions.chimaeraWing(player) && inHand.getTypeId() == Config.getInstance().getChimaeraItemId()) {
|
if (Permissions.chimaeraWing(player) && inHand.getTypeId() == Config.getInstance().getChimaeraItemId()) {
|
||||||
if (SkillUtils.cooldownOver(recentlyHurt, 60, player) && amount >= Config.getInstance().getChimaeraCost()) {
|
if (SkillUtils.cooldownOver(recentlyHurt, 60, player) && amount >= Config.getInstance().getChimaeraCost()) {
|
||||||
|
@ -21,7 +21,6 @@ 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;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||||
@ -90,11 +89,10 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Permissions.skillEnabled(player, SkillType.SWORDS)) {
|
if (Permissions.skillEnabled(player, SkillType.SWORDS)) {
|
||||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
|
||||||
boolean canSerratedStrike = Permissions.serratedStrikes(player); // So we don't have to check the same permission twice
|
boolean canSerratedStrike = Permissions.serratedStrikes(player); // So we don't have to check the same permission twice
|
||||||
|
|
||||||
if (profile.getToolPreparationMode(ToolType.SWORD) && canSerratedStrike) {
|
if (mcMMOPlayer.getToolPreparationMode(ToolType.SWORD) && canSerratedStrike) {
|
||||||
SkillUtils.abilityCheck(player, SkillType.SWORDS);
|
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.SWORDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
SwordsManager swordsManager = mcMMOPlayer.getSwordsManager();
|
SwordsManager swordsManager = mcMMOPlayer.getSwordsManager();
|
||||||
@ -103,7 +101,7 @@ public final class CombatUtils {
|
|||||||
swordsManager.bleedCheck(target);
|
swordsManager.bleedCheck(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile.getAbilityMode(AbilityType.SERRATED_STRIKES) && canSerratedStrike) {
|
if (mcMMOPlayer.getAbilityMode(AbilityType.SERRATED_STRIKES) && canSerratedStrike) {
|
||||||
swordsManager.serratedStrikes(target, event.getDamage());
|
swordsManager.serratedStrikes(target, event.getDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +117,7 @@ public final class CombatUtils {
|
|||||||
AxesManager axesManager = mcMMOPlayer.getAxesManager();
|
AxesManager axesManager = mcMMOPlayer.getAxesManager();
|
||||||
|
|
||||||
if (axesManager.canActivateAbility()) {
|
if (axesManager.canActivateAbility()) {
|
||||||
SkillUtils.abilityCheck(player, SkillType.AXES);
|
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.AXES);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (axesManager.canUseAxeMastery()) {
|
if (axesManager.canUseAxeMastery()) {
|
||||||
@ -155,12 +153,10 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Permissions.skillEnabled(player, SkillType.UNARMED)) {
|
if (Permissions.skillEnabled(player, SkillType.UNARMED)) {
|
||||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
|
||||||
|
|
||||||
boolean canBerserk = Permissions.berserk(player); // So we don't have to check the same permission twice
|
boolean canBerserk = Permissions.berserk(player); // So we don't have to check the same permission twice
|
||||||
|
|
||||||
if (profile.getToolPreparationMode(ToolType.FISTS) && canBerserk) {
|
if (mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && canBerserk) {
|
||||||
SkillUtils.abilityCheck(player, SkillType.UNARMED);
|
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.UNARMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager();
|
UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager();
|
||||||
@ -169,7 +165,7 @@ public final class CombatUtils {
|
|||||||
event.setDamage(unarmedManager.ironArmCheck(event.getDamage()));
|
event.setDamage(unarmedManager.ironArmCheck(event.getDamage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile.getAbilityMode(AbilityType.BERSERK) && canBerserk) {
|
if (mcMMOPlayer.getAbilityMode(AbilityType.BERSERK) && canBerserk) {
|
||||||
event.setDamage(unarmedManager.berserkDamage(event.getDamage()));
|
event.setDamage(unarmedManager.berserkDamage(event.getDamage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,7 +446,7 @@ public final class CombatUtils {
|
|||||||
|
|
||||||
Player defender = (Player) target;
|
Player defender = (Player) target;
|
||||||
|
|
||||||
if (System.currentTimeMillis() >= UserManager.getPlayer(defender).getProfile().getRespawnATS() + 5) {
|
if (System.currentTimeMillis() >= UserManager.getPlayer(defender).getRespawnATS() + 5) {
|
||||||
baseXP = 20 * Config.getInstance().getPlayerVersusPlayerXP();
|
baseXP = 20 * Config.getInstance().getPlayerVersusPlayerXP();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -538,7 +534,7 @@ public final class CombatUtils {
|
|||||||
if (entity instanceof Player) {
|
if (entity instanceof Player) {
|
||||||
Player defender = (Player) entity;
|
Player defender = (Player) entity;
|
||||||
|
|
||||||
if (!defender.getWorld().getPVP() || defender == player || UserManager.getPlayer(defender).getProfile().getGodMode()) {
|
if (!defender.getWorld().getPVP() || defender == player || UserManager.getPlayer(defender).getGodMode()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import com.gmail.nossr50.config.AdvancedConfig;
|
|||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.config.HiddenConfig;
|
import com.gmail.nossr50.config.HiddenConfig;
|
||||||
import com.gmail.nossr50.config.spout.SpoutConfig;
|
import com.gmail.nossr50.config.spout.SpoutConfig;
|
||||||
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
@ -87,17 +88,18 @@ public class SkillUtils {
|
|||||||
/**
|
/**
|
||||||
* Sends a message to the player when the cooldown expires.
|
* Sends a message to the player when the cooldown expires.
|
||||||
*
|
*
|
||||||
* @param player The player to send a message to
|
* @param mcMMOPlayer The player to send a message to
|
||||||
* @param profile The profile of the player
|
|
||||||
* @param ability The ability to watch cooldowns for
|
* @param ability The ability to watch cooldowns for
|
||||||
*/
|
*/
|
||||||
public static void watchCooldown(Player player, PlayerProfile profile, AbilityType ability) {
|
public static void watchCooldown(McMMOPlayer mcMMOPlayer, AbilityType ability) {
|
||||||
if (player == null || profile == null || ability == null) {
|
if (mcMMOPlayer == null || ability == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!profile.getAbilityInformed(ability) && cooldownOver(profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
profile.setAbilityInformed(ability, true);
|
|
||||||
|
if (!mcMMOPlayer.getAbilityInformed(ability) && cooldownOver(mcMMOPlayer.getProfile().getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
|
||||||
|
mcMMOPlayer.setAbilityInformed(ability, true);
|
||||||
player.sendMessage(ability.getAbilityRefresh());
|
player.sendMessage(ability.getAbilityRefresh());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,7 +115,7 @@ public class SkillUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
AbilityType ability = skill.getAbility();
|
AbilityType ability = skill.getAbility();
|
||||||
ToolType tool = skill.getTool();
|
ToolType tool = skill.getTool();
|
||||||
ItemStack inHand = player.getItemInHand();
|
ItemStack inHand = player.getItemInHand();
|
||||||
@ -122,29 +124,26 @@ public class SkillUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if any abilities are active */
|
if (!mcMMOPlayer.getAbilityUse()) {
|
||||||
if (profile == null) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!profile.getAbilityUse()) {
|
for (AbilityType abilityType : AbilityType.values()) {
|
||||||
return;
|
if (mcMMOPlayer.getAbilityMode(abilityType)) {
|
||||||
}
|
|
||||||
|
|
||||||
for (AbilityType x : AbilityType.values()) {
|
|
||||||
if (profile.getAbilityMode(x)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlayerProfile playerProfile = mcMMOPlayer.getProfile();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Woodcutting & Axes need to be treated differently.
|
* Woodcutting & Axes need to be treated differently.
|
||||||
* Basically the tool always needs to ready and we check to see if the cooldown is over when the user takes action
|
* Basically the tool always needs to ready and we check to see if the cooldown is over when the user takes action
|
||||||
*/
|
*/
|
||||||
if (ability.getPermissions(player) && tool.inHand(inHand) && !profile.getToolPreparationMode(tool)) {
|
if (ability.getPermissions(player) && tool.inHand(inHand) && !mcMMOPlayer.getToolPreparationMode(tool)) {
|
||||||
if (skill != SkillType.WOODCUTTING && skill != SkillType.AXES) {
|
if (skill != SkillType.WOODCUTTING && skill != SkillType.AXES) {
|
||||||
if (!profile.getAbilityMode(ability) && !cooldownOver(profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
|
if (!mcMMOPlayer.getAbilityMode(ability) && !cooldownOver(playerProfile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.TooTired", calculateTimeLeft(profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)));
|
player.sendMessage(LocaleLoader.getString("Skills.TooTired", calculateTimeLeft(playerProfile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,39 +152,36 @@ public class SkillUtils {
|
|||||||
player.sendMessage(tool.getRaiseTool());
|
player.sendMessage(tool.getRaiseTool());
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.setToolPreparationATS(tool, System.currentTimeMillis());
|
mcMMOPlayer.setToolPreparationATS(tool, System.currentTimeMillis());
|
||||||
profile.setToolPreparationMode(tool, true);
|
mcMMOPlayer.setToolPreparationMode(tool, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Monitors various things relating to skill abilities.
|
* Monitors various things relating to skill abilities.
|
||||||
*
|
*
|
||||||
* @param player The player using the skill
|
* @param mcMMOPlayer The player using the skill
|
||||||
* @param profile The profile of the player
|
* @param profile The profile of the player
|
||||||
* @param curTime The current system time
|
* @param curTime The current system time
|
||||||
* @param skill The skill being monitored
|
* @param skill The skill being monitored
|
||||||
*/
|
*/
|
||||||
public static void monitorSkill(Player player, PlayerProfile profile, long curTime, SkillType skill) {
|
public static void monitorSkill(McMMOPlayer mcMMOPlayer, long curTime, SkillType skill) {
|
||||||
final int FOUR_SECONDS = 4000;
|
final int FOUR_SECONDS = 4000;
|
||||||
|
|
||||||
ToolType tool = skill.getTool();
|
ToolType tool = skill.getTool();
|
||||||
AbilityType ability = skill.getAbility();
|
|
||||||
|
|
||||||
if (profile == null) {
|
if (mcMMOPlayer.getToolPreparationMode(tool) && curTime - (mcMMOPlayer.getToolPreparationATS(tool) * Misc.TIME_CONVERSION_FACTOR) >= FOUR_SECONDS) {
|
||||||
return;
|
mcMMOPlayer.setToolPreparationMode(tool, false);
|
||||||
}
|
|
||||||
|
|
||||||
if (profile.getToolPreparationMode(tool) && curTime - (profile.getToolPreparationATS(tool) * Misc.TIME_CONVERSION_FACTOR) >= FOUR_SECONDS) {
|
|
||||||
profile.setToolPreparationMode(tool, false);
|
|
||||||
|
|
||||||
if (Config.getInstance().getAbilityMessagesEnabled()) {
|
if (Config.getInstance().getAbilityMessagesEnabled()) {
|
||||||
player.sendMessage(tool.getLowerTool());
|
mcMMOPlayer.getPlayer().sendMessage(tool.getLowerTool());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AbilityType ability = skill.getAbility();
|
||||||
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
|
|
||||||
if (ability.getPermissions(player)) {
|
if (ability.getPermissions(player)) {
|
||||||
if (profile.getAbilityMode(ability) && (profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR) <= curTime) {
|
if (mcMMOPlayer.getAbilityMode(ability) && (mcMMOPlayer.getProfile().getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR) <= curTime) {
|
||||||
if (ability == AbilityType.BERSERK) {
|
if (ability == AbilityType.BERSERK) {
|
||||||
player.setCanPickupItems(true);
|
player.setCanPickupItems(true);
|
||||||
}
|
}
|
||||||
@ -193,12 +189,12 @@ public class SkillUtils {
|
|||||||
handleAbilitySpeedDecrease(player);
|
handleAbilitySpeedDecrease(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.setAbilityMode(ability, false);
|
mcMMOPlayer.setAbilityMode(ability, false);
|
||||||
profile.setAbilityInformed(ability, false);
|
mcMMOPlayer.setAbilityInformed(ability, false);
|
||||||
|
|
||||||
ParticleEffectUtils.playAbilityDisabledEffect(player);
|
ParticleEffectUtils.playAbilityDisabledEffect(player);
|
||||||
|
|
||||||
if (profile.useChatNotifications()) {
|
if (mcMMOPlayer.useChatNotifications()) {
|
||||||
player.sendMessage(ability.getAbilityOff());
|
player.sendMessage(ability.getAbilityOff());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,40 +364,42 @@ public class SkillUtils {
|
|||||||
/**
|
/**
|
||||||
* Check to see if an ability can be activated.
|
* Check to see if an ability can be activated.
|
||||||
*
|
*
|
||||||
* @param player The player activating the ability
|
* @param mcMMOPlayer The player activating the ability
|
||||||
* @param type The skill the ability is based on
|
* @param type The skill the ability is based on
|
||||||
*/
|
*/
|
||||||
public static void abilityCheck(Player player, SkillType type) {
|
public static void abilityCheck(McMMOPlayer mcMMOPlayer, SkillType type) {
|
||||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
|
||||||
ToolType tool = type.getTool();
|
ToolType tool = type.getTool();
|
||||||
AbilityType ability = type.getAbility();
|
AbilityType ability = type.getAbility();
|
||||||
|
|
||||||
profile.setToolPreparationMode(tool, false);
|
mcMMOPlayer.setToolPreparationMode(tool, false);
|
||||||
|
|
||||||
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
|
PlayerProfile playerProfile = mcMMOPlayer.getProfile();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Axes and Woodcutting are odd because they share the same tool.
|
* Axes and Woodcutting are odd because they share the same tool.
|
||||||
* We show them the too tired message when they take action.
|
* We show them the too tired message when they take action.
|
||||||
*/
|
*/
|
||||||
if (type == SkillType.WOODCUTTING || type == SkillType.AXES) {
|
if (type == SkillType.WOODCUTTING || type == SkillType.AXES) {
|
||||||
if (!profile.getAbilityMode(ability) && !cooldownOver(profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
|
if (!mcMMOPlayer.getAbilityMode(ability) && !cooldownOver(playerProfile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.TooTired", calculateTimeLeft(profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)));
|
player.sendMessage(LocaleLoader.getString("Skills.TooTired", calculateTimeLeft(playerProfile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!profile.getAbilityMode(ability) && cooldownOver(profile.getSkillDATS(ability), ability.getCooldown(), player)) {
|
if (!mcMMOPlayer.getAbilityMode(ability) && cooldownOver(playerProfile.getSkillDATS(ability), ability.getCooldown(), player)) {
|
||||||
int ticks = PerksUtils.handleActivationPerks(player, 2 + (profile.getSkillLevel(type) / AdvancedConfig.getInstance().getAbilityLength()), ability.getMaxTicks());
|
int ticks = PerksUtils.handleActivationPerks(player, 2 + (playerProfile.getSkillLevel(type) / AdvancedConfig.getInstance().getAbilityLength()), ability.getMaxTicks());
|
||||||
|
|
||||||
ParticleEffectUtils.playAbilityEnabledEffect(player);
|
ParticleEffectUtils.playAbilityEnabledEffect(player);
|
||||||
|
|
||||||
if (profile.useChatNotifications()) {
|
if (mcMMOPlayer.useChatNotifications()) {
|
||||||
player.sendMessage(ability.getAbilityOn());
|
player.sendMessage(ability.getAbilityOn());
|
||||||
}
|
}
|
||||||
|
|
||||||
SkillUtils.sendSkillMessage(player, ability.getAbilityPlayer(player));
|
SkillUtils.sendSkillMessage(player, ability.getAbilityPlayer(player));
|
||||||
|
|
||||||
profile.setSkillDATS(ability, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR));
|
playerProfile.setSkillDATS(ability, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR));
|
||||||
profile.setAbilityMode(ability, true);
|
mcMMOPlayer.setAbilityMode(ability, true);
|
||||||
|
|
||||||
if (ability == AbilityType.BERSERK) {
|
if (ability == AbilityType.BERSERK) {
|
||||||
player.setCanPickupItems(false);
|
player.setCanPickupItems(false);
|
||||||
@ -514,14 +512,14 @@ public class SkillUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
int ticks = 0;
|
int ticks = 0;
|
||||||
|
|
||||||
if (profile.getAbilityMode(AbilityType.SUPER_BREAKER)) {
|
if (mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER)) {
|
||||||
ticks = ((int) (profile.getSkillDATS(AbilityType.SUPER_BREAKER) - System.currentTimeMillis())) / Misc.TIME_CONVERSION_FACTOR;
|
ticks = ((int) (mcMMOPlayer.getProfile().getSkillDATS(AbilityType.SUPER_BREAKER) - System.currentTimeMillis())) / Misc.TIME_CONVERSION_FACTOR;
|
||||||
}
|
}
|
||||||
else if (profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
|
else if (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
|
||||||
ticks = ((int) (profile.getSkillDATS(AbilityType.GIGA_DRILL_BREAKER) - System.currentTimeMillis())) / Misc.TIME_CONVERSION_FACTOR;
|
ticks = ((int) (mcMMOPlayer.getProfile().getSkillDATS(AbilityType.GIGA_DRILL_BREAKER) - System.currentTimeMillis())) / Misc.TIME_CONVERSION_FACTOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
PotionEffect abilityBuff = new PotionEffect(PotionEffectType.FAST_DIGGING, duration + ticks, amplifier + 10);
|
PotionEffect abilityBuff = new PotionEffect(PotionEffectType.FAST_DIGGING, duration + ticks, amplifier + 10);
|
||||||
|
Loading…
Reference in New Issue
Block a user