mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
clean up if/else formatting
This commit is contained in:
parent
7266563ca9
commit
d0ab2bdb2f
@ -1143,14 +1143,10 @@ public final class ExperienceAPI {
|
|||||||
* @param blockStates the blocks to reward XP for
|
* @param blockStates the blocks to reward XP for
|
||||||
* @param mcMMOPlayer the target player
|
* @param mcMMOPlayer the target player
|
||||||
*/
|
*/
|
||||||
public static void addXpFromBlocks(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer)
|
public static void addXpFromBlocks(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer) {
|
||||||
{
|
for(BlockState bs : blockStates) {
|
||||||
for(BlockState bs : blockStates)
|
for(PrimarySkillType skillType : PrimarySkillType.values()) {
|
||||||
{
|
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0) {
|
||||||
for(PrimarySkillType skillType : PrimarySkillType.values())
|
|
||||||
{
|
|
||||||
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
|
|
||||||
{
|
|
||||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1163,12 +1159,9 @@ public final class ExperienceAPI {
|
|||||||
* @param mcMMOPlayer the target player
|
* @param mcMMOPlayer the target player
|
||||||
* @param skillType target primary skill
|
* @param skillType target primary skill
|
||||||
*/
|
*/
|
||||||
public static void addXpFromBlocksBySkill(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType)
|
public static void addXpFromBlocksBySkill(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) {
|
||||||
{
|
for(BlockState bs : blockStates) {
|
||||||
for(BlockState bs : blockStates)
|
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0) {
|
||||||
{
|
|
||||||
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
|
|
||||||
{
|
|
||||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1179,12 +1172,9 @@ public final class ExperienceAPI {
|
|||||||
* @param blockState The target blockstate
|
* @param blockState The target blockstate
|
||||||
* @param mcMMOPlayer The target player
|
* @param mcMMOPlayer The target player
|
||||||
*/
|
*/
|
||||||
public static void addXpFromBlock(BlockState blockState, McMMOPlayer mcMMOPlayer)
|
public static void addXpFromBlock(BlockState blockState, McMMOPlayer mcMMOPlayer) {
|
||||||
{
|
for(PrimarySkillType skillType : PrimarySkillType.values()) {
|
||||||
for(PrimarySkillType skillType : PrimarySkillType.values())
|
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0) {
|
||||||
{
|
|
||||||
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
|
|
||||||
{
|
|
||||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1196,10 +1186,8 @@ public final class ExperienceAPI {
|
|||||||
* @param mcMMOPlayer The target player
|
* @param mcMMOPlayer The target player
|
||||||
* @param skillType target primary skill
|
* @param skillType target primary skill
|
||||||
*/
|
*/
|
||||||
public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType)
|
public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) {
|
||||||
{
|
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0) {
|
||||||
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
|
|
||||||
{
|
|
||||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,8 +109,7 @@ public final class PartyAPI {
|
|||||||
if (party == null) {
|
if (party == null) {
|
||||||
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
|
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
|
||||||
} else {
|
} else {
|
||||||
if (mcMMO.p.getPartyManager().isPartyFull(player, party))
|
if (mcMMO.p.getPartyManager().isPartyFull(player, party)) {
|
||||||
{
|
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString());
|
NotificationManager.sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -124,8 +123,7 @@ public final class PartyAPI {
|
|||||||
* 0 or less for no size limit
|
* 0 or less for no size limit
|
||||||
* @return the max party size on this server
|
* @return the max party size on this server
|
||||||
*/
|
*/
|
||||||
public static int getMaxPartySize()
|
public static int getMaxPartySize() {
|
||||||
{
|
|
||||||
return mcMMO.p.getGeneralConfig().getPartyMaxSize();
|
return mcMMO.p.getGeneralConfig().getPartyMaxSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,14 +200,11 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
String skillName = "UNIDENTIFIED";
|
String skillName = "UNIDENTIFIED";
|
||||||
if (materialName.contains("ORE")) {
|
if (materialName.contains("ORE")) {
|
||||||
skillName = "Mining";
|
skillName = "Mining";
|
||||||
}
|
} else if (materialName.contains("LOG") || materialName.contains("LEAVES")) {
|
||||||
else if (materialName.contains("LOG") || materialName.contains("LEAVES")) {
|
|
||||||
skillName = "Woodcutting";
|
skillName = "Woodcutting";
|
||||||
}
|
} else if (materialName.contains("GRASS") || materialName.contains("SHORT_GRASS") || materialName.contains("FLOWER") || materialName.contains("CROP")) {
|
||||||
else if (materialName.contains("GRASS") || materialName.contains("SHORT_GRASS") || materialName.contains("FLOWER") || materialName.contains("CROP")) {
|
|
||||||
skillName = "Herbalism";
|
skillName = "Herbalism";
|
||||||
}
|
} else if (materialName.contains("DIRT") || materialName.contains("SAND")) {
|
||||||
else if (materialName.contains("DIRT") || materialName.contains("SAND")) {
|
|
||||||
skillName = "Excavation";
|
skillName = "Excavation";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,8 +219,7 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (skillName.equals("Mining")) {
|
if (skillName.equals("Mining")) {
|
||||||
skillContents.add(" " + " " + "Smelting_XP_Gain: 9");
|
skillContents.add(" " + " " + "Smelting_XP_Gain: 9");
|
||||||
}
|
} else if (skillName.equals("Woodcutting")) {
|
||||||
else if (skillName.equals("Woodcutting")) {
|
|
||||||
skillContents.add(" " + " " + "Is_Log: " + materialName.contains("LOG"));
|
skillContents.add(" " + " " + "Is_Log: " + materialName.contains("LOG"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -239,20 +235,15 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
String toolType = "UNIDENTIFIED";
|
String toolType = "UNIDENTIFIED";
|
||||||
if (materialName.contains("PICKAXE")) {
|
if (materialName.contains("PICKAXE")) {
|
||||||
toolType = "Pickaxes";
|
toolType = "Pickaxes";
|
||||||
}
|
} else if (materialName.contains("AXE")) {
|
||||||
else if (materialName.contains("AXE")) {
|
|
||||||
toolType = "Axes";
|
toolType = "Axes";
|
||||||
}
|
} else if (materialName.contains("BOW")) {
|
||||||
else if (materialName.contains("BOW")) {
|
|
||||||
toolType = "Bows";
|
toolType = "Bows";
|
||||||
}
|
} else if (materialName.contains("HOE")) {
|
||||||
else if (materialName.contains("HOE")) {
|
|
||||||
toolType = "Hoes";
|
toolType = "Hoes";
|
||||||
}
|
} else if (materialName.contains("SHOVEL") || materialName.contains("SPADE")) {
|
||||||
else if (materialName.contains("SHOVEL") || materialName.contains("SPADE")) {
|
|
||||||
toolType = "Shovels";
|
toolType = "Shovels";
|
||||||
}
|
} else if (materialName.contains("SWORD")) {
|
||||||
else if (materialName.contains("SWORD")) {
|
|
||||||
toolType = "Swords";
|
toolType = "Swords";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,14 +270,11 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
String toolType = "UNIDENTIFIED";
|
String toolType = "UNIDENTIFIED";
|
||||||
if (materialName.contains("BOOT") || materialName.contains("SHOE")) {
|
if (materialName.contains("BOOT") || materialName.contains("SHOE")) {
|
||||||
toolType = "Boots";
|
toolType = "Boots";
|
||||||
}
|
} else if (materialName.contains("CHESTPLATE") || materialName.contains("CHEST")) {
|
||||||
else if (materialName.contains("CHESTPLATE") || materialName.contains("CHEST")) {
|
|
||||||
toolType = "Chestplates";
|
toolType = "Chestplates";
|
||||||
}
|
} else if (materialName.contains("HELM") || materialName.contains("HAT")) {
|
||||||
else if (materialName.contains("HELM") || materialName.contains("HAT")) {
|
|
||||||
toolType = "Helmets";
|
toolType = "Helmets";
|
||||||
}
|
} else if (materialName.contains("LEGGINGS") || materialName.contains("LEGS") || materialName.contains("PANTS")) {
|
||||||
else if (materialName.contains("LEGGINGS") || materialName.contains("LEGS") || materialName.contains("PANTS")) {
|
|
||||||
toolType = "Leggings";
|
toolType = "Leggings";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,16 +37,14 @@ public class XprateCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (mcMMO.p.isXPEventEnabled()) {
|
if (mcMMO.p.isXPEventEnabled()) {
|
||||||
|
|
||||||
if (mcMMO.p.getAdvancedConfig().useTitlesForXPEvent())
|
if (mcMMO.p.getAdvancedConfig().useTitlesForXPEvent()) {
|
||||||
{
|
|
||||||
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
||||||
LocaleLoader.getString("Commands.Event.Stop"),
|
LocaleLoader.getString("Commands.Event.Stop"),
|
||||||
LocaleLoader.getString("Commands.Event.Stop.Subtitle"),
|
LocaleLoader.getString("Commands.Event.Stop.Subtitle"),
|
||||||
10, 10*20, 20);
|
10, 10*20, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mcMMO.p.getGeneralConfig().broadcastEventMessages())
|
if (mcMMO.p.getGeneralConfig().broadcastEventMessages()) {
|
||||||
{
|
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop"));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop"));
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle"));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle"));
|
||||||
}
|
}
|
||||||
@ -72,34 +70,29 @@ public class XprateCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (CommandUtils.shouldDisableToggle(args[1])) {
|
if (CommandUtils.shouldDisableToggle(args[1])) {
|
||||||
mcMMO.p.setXPEventEnabled(false);
|
mcMMO.p.setXPEventEnabled(false);
|
||||||
}
|
} else if (CommandUtils.shouldEnableToggle(args[1])) {
|
||||||
else if (CommandUtils.shouldEnableToggle(args[1])) {
|
|
||||||
mcMMO.p.setXPEventEnabled(true);
|
mcMMO.p.setXPEventEnabled(true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int newXpRate = Integer.parseInt(args[0]);
|
int newXpRate = Integer.parseInt(args[0]);
|
||||||
|
|
||||||
if (newXpRate < 0)
|
if (newXpRate < 0) {
|
||||||
{
|
|
||||||
sender.sendMessage(ChatColor.RED+LocaleLoader.getString("Commands.NegativeNumberWarn"));
|
sender.sendMessage(ChatColor.RED+LocaleLoader.getString("Commands.NegativeNumberWarn"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
|
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
|
||||||
|
|
||||||
if (mcMMO.p.getAdvancedConfig().useTitlesForXPEvent())
|
if (mcMMO.p.getAdvancedConfig().useTitlesForXPEvent()) {
|
||||||
{
|
|
||||||
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
||||||
LocaleLoader.getString("Commands.Event.Start"),
|
LocaleLoader.getString("Commands.Event.Start"),
|
||||||
LocaleLoader.getString("Commands.Event.XP", newXpRate),
|
LocaleLoader.getString("Commands.Event.XP", newXpRate),
|
||||||
10, 10*20, 20);
|
10, 10*20, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mcMMO.p.getGeneralConfig().broadcastEventMessages())
|
if (mcMMO.p.getGeneralConfig().broadcastEventMessages()) {
|
||||||
{
|
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start"));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start"));
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,7 @@ public class AddxpCommand extends ExperienceCommand {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
|
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
profile.addXp(skill, value);
|
profile.addXp(skill, value);
|
||||||
profile.scheduleAsyncSave();
|
profile.scheduleAsyncSave();
|
||||||
}
|
}
|
||||||
|
@ -49,15 +49,13 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
skill = null;
|
skill = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill != null && SkillTools.isChildSkill(skill))
|
if (skill != null && SkillTools.isChildSkill(skill)) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(sender.getName()) == null)
|
if (UserManager.getPlayer(sender.getName()) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -82,8 +80,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
skill = null;
|
skill = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill != null && SkillTools.isChildSkill(skill))
|
if (skill != null && SkillTools.isChildSkill(skill)) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -110,8 +107,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
editValues(null, profile, skill, value, isSilent(args));
|
editValues(null, profile, skill, value, isSilent(args));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill, value, isSilent(args));
|
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill, value, isSilent(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,8 +155,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) {
|
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) {
|
||||||
if (skill == null) {
|
if (skill == null) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), playerName));
|
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), playerName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -174,8 +169,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
if (player != null) {
|
if (player != null) {
|
||||||
handlePlayerMessageAll(player, value, isSilent);
|
handlePlayerMessageAll(player, value, isSilent);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
handleCommand(player, profile, skill, value);
|
handleCommand(player, profile, skill, value);
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
@ -48,8 +48,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (args[0].equalsIgnoreCase("all")) {
|
if (args[0].equalsIgnoreCase("all")) {
|
||||||
skill = null;
|
skill = null;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
skill = mcMMO.p.getSkillTools().matchSkill(args[0]);
|
skill = mcMMO.p.getSkillTools().matchSkill(args[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,8 +67,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (args[1].equalsIgnoreCase("all")) {
|
if (args[1].equalsIgnoreCase("all")) {
|
||||||
skill = null;
|
skill = null;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
skill = mcMMO.p.getSkillTools().matchSkill(args[1]);
|
skill = mcMMO.p.getSkillTools().matchSkill(args[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,8 +91,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
editValues(null, profile, skill);
|
editValues(null, profile, skill);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill);
|
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,8 +153,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) {
|
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) {
|
||||||
if (skill == null) {
|
if (skill == null) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), playerName));
|
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), playerName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,8 +167,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
if (player != null) {
|
if (player != null) {
|
||||||
handlePlayerMessageAll(player);
|
handlePlayerMessageAll(player);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
handleCommand(player, profile, skill);
|
handleCommand(player, profile, skill);
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
@ -12,8 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class PartyChangePasswordCommand implements CommandExecutor {
|
public class PartyChangePasswordCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if (UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -90,8 +90,7 @@ public class PartyCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
if (mcMMOPlayer == null)
|
if (mcMMOPlayer == null) {
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -207,8 +206,7 @@ public class PartyCommand implements TabExecutor {
|
|||||||
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
//Not Loaded
|
//Not Loaded
|
||||||
if (mcMMOPlayer == null)
|
if (mcMMOPlayer == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,7 @@ public class PartyCreateCommand implements CommandExecutor {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,7 @@ public class PartyInfoCommand implements CommandExecutor {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
if (UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -70,8 +69,7 @@ public class PartyInfoCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (isUnlockedFeature(party, partyFeature)) {
|
if (isUnlockedFeature(party, partyFeature)) {
|
||||||
unlockedPartyFeatures.add(partyFeature.getLocaleString());
|
unlockedPartyFeatures.add(partyFeature.getLocaleString());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
lockedPartyFeatures.add(partyFeature.getFeatureLockedLocaleString());
|
lockedPartyFeatures.add(partyFeature.getFeatureLockedLocaleString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,7 @@ import java.util.Locale;
|
|||||||
public class PartyItemShareCommand implements CommandExecutor {
|
public class PartyItemShareCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if (UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -50,11 +49,9 @@ public class PartyItemShareCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (CommandUtils.shouldEnableToggle(args[2])) {
|
if (CommandUtils.shouldEnableToggle(args[2])) {
|
||||||
toggle = true;
|
toggle = true;
|
||||||
}
|
} else if (CommandUtils.shouldDisableToggle(args[2])) {
|
||||||
else if (CommandUtils.shouldDisableToggle(args[2])) {
|
|
||||||
toggle = false;
|
toggle = false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,7 @@ public class PartyJoinCommand implements CommandExecutor {
|
|||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if (UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -62,8 +61,7 @@ public class PartyJoinCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mcMMO.p.getPartyManager().isPartyFull(player, targetParty))
|
if (mcMMO.p.getPartyManager().isPartyFull(player, targetParty)) {
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull", targetParty.toString()));
|
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull", targetParty.toString()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,7 @@ public class PartyLockCommand implements CommandExecutor {
|
|||||||
case 1:
|
case 1:
|
||||||
if (args[0].equalsIgnoreCase("lock")) {
|
if (args[0].equalsIgnoreCase("lock")) {
|
||||||
togglePartyLock(sender, true);
|
togglePartyLock(sender, true);
|
||||||
}
|
} else if (args[0].equalsIgnoreCase("unlock")) {
|
||||||
else if (args[0].equalsIgnoreCase("unlock")) {
|
|
||||||
togglePartyLock(sender, false);
|
togglePartyLock(sender, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,11 +32,9 @@ public class PartyLockCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (CommandUtils.shouldEnableToggle(args[1])) {
|
if (CommandUtils.shouldEnableToggle(args[1])) {
|
||||||
togglePartyLock(sender, true);
|
togglePartyLock(sender, true);
|
||||||
}
|
} else if (CommandUtils.shouldDisableToggle(args[1])) {
|
||||||
else if (CommandUtils.shouldDisableToggle(args[1])) {
|
|
||||||
togglePartyLock(sender, false);
|
togglePartyLock(sender, false);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sendUsageStrings(sender);
|
sendUsageStrings(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,8 +52,7 @@ public class PartyLockCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void togglePartyLock(CommandSender sender, boolean lock) {
|
private void togglePartyLock(CommandSender sender, boolean lock) {
|
||||||
if (UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -30,20 +30,15 @@ public enum PartySubcommandType {
|
|||||||
|
|
||||||
if (commandName.equalsIgnoreCase("?")) {
|
if (commandName.equalsIgnoreCase("?")) {
|
||||||
return HELP;
|
return HELP;
|
||||||
}
|
} else if (commandName.equalsIgnoreCase("q") || commandName.equalsIgnoreCase("leave")) {
|
||||||
else if (commandName.equalsIgnoreCase("q") || commandName.equalsIgnoreCase("leave")) {
|
|
||||||
return QUIT;
|
return QUIT;
|
||||||
}
|
} else if (commandName.equalsIgnoreCase("leader")) {
|
||||||
else if (commandName.equalsIgnoreCase("leader")) {
|
|
||||||
return OWNER;
|
return OWNER;
|
||||||
}
|
} else if (commandName.equalsIgnoreCase("xpshare") || commandName.equalsIgnoreCase("shareexp") || commandName.equalsIgnoreCase("sharexp")) {
|
||||||
else if (commandName.equalsIgnoreCase("xpshare") || commandName.equalsIgnoreCase("shareexp") || commandName.equalsIgnoreCase("sharexp")) {
|
|
||||||
return XPSHARE;
|
return XPSHARE;
|
||||||
}
|
} else if (commandName.equalsIgnoreCase("shareitem") || commandName.equalsIgnoreCase("shareitems")) {
|
||||||
else if (commandName.equalsIgnoreCase("shareitem") || commandName.equalsIgnoreCase("shareitems")) {
|
|
||||||
return ITEMSHARE;
|
return ITEMSHARE;
|
||||||
}
|
} else if (commandName.equalsIgnoreCase("ally")) {
|
||||||
else if (commandName.equalsIgnoreCase("ally")) {
|
|
||||||
return ALLIANCE;
|
return ALLIANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,8 +17,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class PartyXpShareCommand implements CommandExecutor {
|
public class PartyXpShareCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if (UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,7 @@ public class PartyAllianceCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,7 @@ public class PtpAcceptAnyCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (ptpRecord.isConfirmRequired()) {
|
if (ptpRecord.isConfirmRequired()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
|
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Enabled"));
|
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,7 @@ public class PtpAcceptCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -56,8 +55,7 @@ public class PtpAcceptCommand implements CommandExecutor {
|
|||||||
if (!Permissions.partyTeleportWorld(target, targetWorld)) {
|
if (!Permissions.partyTeleportWorld(target, targetWorld)) {
|
||||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(target, playerWorld)) {
|
||||||
else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(target, playerWorld)) {
|
|
||||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", playerWorld.getName()));
|
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", playerWorld.getName()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -45,8 +45,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -59,8 +58,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -171,8 +169,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
if (!Permissions.partyTeleportWorld(target, targetWorld)) {
|
if (!Permissions.partyTeleportWorld(target, targetWorld)) {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
player.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
||||||
return;
|
return;
|
||||||
}
|
} else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(player, targetWorld)) {
|
||||||
else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(player, targetWorld)) {
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
player.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -228,14 +225,12 @@ public class PtpCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) {
|
protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) {
|
||||||
if (UserManager.getPlayer(targetPlayer) == null)
|
if (UserManager.getPlayer(targetPlayer) == null) {
|
||||||
{
|
|
||||||
targetPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
targetPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UserManager.getPlayer(teleportingPlayer) == null)
|
if (UserManager.getPlayer(teleportingPlayer) == null) {
|
||||||
{
|
|
||||||
teleportingPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
teleportingPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -250,8 +245,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
if (warmup > 0) {
|
if (warmup > 0) {
|
||||||
teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup));
|
teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup));
|
||||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(teleportingPlayer, new TeleportationWarmup(mcMMOPlayer, mcMMOTarget), 20 * warmup);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(teleportingPlayer, new TeleportationWarmup(mcMMOPlayer, mcMMOTarget), 20 * warmup);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
|
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,7 @@ public class PtpToggleCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (ptpRecord.isEnabled()) {
|
if (ptpRecord.isEnabled()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled"));
|
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled"));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Enabled"));
|
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,8 +85,7 @@ public class McrankCommand implements TabExecutor {
|
|||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
||||||
|
|
||||||
if (mcMMOPlayer == null)
|
if (mcMMOPlayer == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -54,8 +54,7 @@ public class AcrobaticsCommand extends SkillCommand {
|
|||||||
|
|
||||||
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName("Roll");
|
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName("Roll");
|
||||||
|
|
||||||
if (abstractSubSkill != null)
|
if (abstractSubSkill != null) {
|
||||||
{
|
|
||||||
String[] rollStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.ACROBATICS_ROLL);
|
String[] rollStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.ACROBATICS_ROLL);
|
||||||
|
|
||||||
messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, rollStrings[0])
|
messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, rollStrings[0])
|
||||||
|
@ -26,15 +26,12 @@ public class MmoInfoCommand implements TabExecutor {
|
|||||||
/*
|
/*
|
||||||
* Only allow players to use this command
|
* Only allow players to use this command
|
||||||
*/
|
*/
|
||||||
if (commandSender instanceof Player player)
|
if (commandSender instanceof Player player) {
|
||||||
{
|
|
||||||
if (args == null || args.length < 1 || args[0] == null || args[0].isEmpty())
|
if (args == null || args.length < 1 || args[0] == null || args[0].isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (Permissions.mmoinfo(player))
|
if (Permissions.mmoinfo(player)) {
|
||||||
{
|
if (args[0].equalsIgnoreCase( "???")) {
|
||||||
if (args[0].equalsIgnoreCase( "???"))
|
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", "???"));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", "???"));
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
|
||||||
@ -57,8 +54,7 @@ public class MmoInfoCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SubSkillType matchSubSkill(String name) {
|
public SubSkillType matchSubSkill(String name) {
|
||||||
for(SubSkillType subSkillType : SubSkillType.values())
|
for(SubSkillType subSkillType : SubSkillType.values()) {
|
||||||
{
|
|
||||||
if (subSkillType.getNiceNameNoSpaces(subSkillType).equalsIgnoreCase(name)
|
if (subSkillType.getNiceNameNoSpaces(subSkillType).equalsIgnoreCase(name)
|
||||||
|| subSkillType.name().equalsIgnoreCase(name))
|
|| subSkillType.name().equalsIgnoreCase(name))
|
||||||
return subSkillType;
|
return subSkillType;
|
||||||
@ -74,8 +70,7 @@ public class MmoInfoCommand implements TabExecutor {
|
|||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayInfo(Player player, SubSkillType subSkillType)
|
private void displayInfo(Player player, SubSkillType subSkillType) {
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", subSkillType.getLocaleName()));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", subSkillType.getLocaleName()));
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
|
||||||
|
@ -88,8 +88,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
TextComponentFactory.sendPlayerSubSkillList(player, subskillTextComponents);
|
TextComponentFactory.sendPlayerSubSkillList(player, subskillTextComponents);
|
||||||
|
|
||||||
/*for(TextComponent tc : subskillTextComponents)
|
/*for(TextComponent tc : subskillTextComponents) {
|
||||||
{
|
|
||||||
player.spigot().sendMessage(new TextComponent[]{tc, new TextComponent(": TESTING")});
|
player.spigot().sendMessage(new TextComponent[]{tc, new TextComponent(": TESTING")});
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
@ -149,8 +148,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
// send header
|
// send header
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName));
|
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName));
|
||||||
|
|
||||||
if (!SkillTools.isChildSkill(skill))
|
if (!SkillTools.isChildSkill(skill)) {
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* NON-CHILD SKILLS
|
* NON-CHILD SKILLS
|
||||||
*/
|
*/
|
||||||
@ -175,10 +173,8 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
StringBuilder parentMessage = new StringBuilder();
|
StringBuilder parentMessage = new StringBuilder();
|
||||||
|
|
||||||
for(int i = 0; i < parentList.size(); i++)
|
for(int i = 0; i < parentList.size(); i++) {
|
||||||
{
|
if (i+1 < parentList.size()) {
|
||||||
if (i+1 < parentList.size())
|
|
||||||
{
|
|
||||||
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", mcMMO.p.getSkillTools().getLocalizedSkillName(parentList.get(i)), mcMMOPlayer.getSkillLevel(parentList.get(i))));
|
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", mcMMO.p.getSkillTools().getLocalizedSkillName(parentList.get(i)), mcMMOPlayer.getSkillLevel(parentList.get(i))));
|
||||||
parentMessage.append(ChatColor.GRAY).append(", ");
|
parentMessage.append(ChatColor.GRAY).append(", ");
|
||||||
} else {
|
} else {
|
||||||
@ -237,11 +233,9 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
int length;
|
int length;
|
||||||
|
|
||||||
if (abilityLengthCap <= 0)
|
if (abilityLengthCap <= 0) {
|
||||||
{
|
|
||||||
length = 2 + (int) (skillValue / abilityLengthVar);
|
length = 2 + (int) (skillValue / abilityLengthVar);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
length = 2 + (int) (Math.min(abilityLengthCap, skillValue) / abilityLengthVar);
|
length = 2 + (int) (Math.min(abilityLengthCap, skillValue) / abilityLengthVar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,20 +248,17 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
return new String[] { String.valueOf(length), String.valueOf(enduranceLength) };
|
return new String[] { String.valueOf(length), String.valueOf(enduranceLength) };
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getStatMessage(SubSkillType subSkillType, String... vars)
|
protected String getStatMessage(SubSkillType subSkillType, String... vars) {
|
||||||
{
|
|
||||||
return getStatMessage(false, false, subSkillType, vars);
|
return getStatMessage(false, false, subSkillType, vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getStatMessage(boolean isExtra, boolean isCustom, SubSkillType subSkillType, String... vars)
|
protected String getStatMessage(boolean isExtra, boolean isCustom, SubSkillType subSkillType, String... vars) {
|
||||||
{
|
|
||||||
String templateKey = isCustom ? "Ability.Generic.Template.Custom" : "Ability.Generic.Template";
|
String templateKey = isCustom ? "Ability.Generic.Template.Custom" : "Ability.Generic.Template";
|
||||||
String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription();
|
String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription();
|
||||||
|
|
||||||
if (isCustom)
|
if (isCustom)
|
||||||
return LocaleLoader.getString(templateKey, LocaleLoader.getString(statDescriptionKey, vars));
|
return LocaleLoader.getString(templateKey, LocaleLoader.getString(statDescriptionKey, vars));
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
String[] mergedList = NotificationManager.addItemToFirstPositionOfArray(LocaleLoader.getString(statDescriptionKey), vars);
|
String[] mergedList = NotificationManager.addItemToFirstPositionOfArray(LocaleLoader.getString(statDescriptionKey), vars);
|
||||||
return LocaleLoader.getString(templateKey, mergedList);
|
return LocaleLoader.getString(templateKey, mergedList);
|
||||||
}
|
}
|
||||||
|
@ -77,8 +77,7 @@ public class SkillGuideCommand implements CommandExecutor {
|
|||||||
while (allStrings.size() < 9) {
|
while (allStrings.size() < 9) {
|
||||||
if (pageIndexStart + allStrings.size() > guide.size()) {
|
if (pageIndexStart + allStrings.size() > guide.size()) {
|
||||||
allStrings.add("");
|
allStrings.add("");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
allStrings.add(guide.get(pageIndexStart + (allStrings.size() - 1)));
|
allStrings.add(guide.get(pageIndexStart + (allStrings.size() - 1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,8 +101,7 @@ public class SwordsCommand extends SkillCommand {
|
|||||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", serratedStrikesLengthEndurance) : ""));
|
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", serratedStrikesLengthEndurance) : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_STAB))
|
if (SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_STAB)) {
|
||||||
{
|
|
||||||
messages.add(getStatMessage(SubSkillType.SWORDS_STAB,
|
messages.add(getStatMessage(SubSkillType.SWORDS_STAB,
|
||||||
String.valueOf(mmoPlayer.getSwordsManager().getStabDamage())));
|
String.valueOf(mmoPlayer.getSwordsManager().getStabDamage())));
|
||||||
}
|
}
|
||||||
|
@ -504,8 +504,7 @@ public class AdvancedConfig extends BukkitConfig {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*public ChatColor getJSONStatHoverElementColor(StatType statType, boolean isPrefix)
|
/*public ChatColor getJSONStatHoverElementColor(StatType statType, boolean isPrefix) {
|
||||||
{
|
|
||||||
String keyAddress = isPrefix ? "Prefix" : "Value";
|
String keyAddress = isPrefix ? "Prefix" : "Value";
|
||||||
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Color";
|
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Color";
|
||||||
|
|
||||||
@ -517,50 +516,41 @@ public class AdvancedConfig extends BukkitConfig {
|
|||||||
*
|
*
|
||||||
* @return the ChatColor for this element
|
* @return the ChatColor for this element
|
||||||
*/
|
*/
|
||||||
/*public ChatColor getJSONStatHoverDetailsColor()
|
/*public ChatColor getJSONStatHoverDetailsColor() {
|
||||||
{
|
|
||||||
String keyLocation = "Style.JSON.Hover.Details.Header.Color";
|
String keyLocation = "Style.JSON.Hover.Details.Header.Color";
|
||||||
return getChatColorFromKey(keyLocation);
|
return getChatColorFromKey(keyLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJSONDetailsHeaderBold()
|
public boolean isJSONDetailsHeaderBold() {
|
||||||
{
|
|
||||||
return config.getBoolean("Style.JSON.Hover.Details.Header.Bold");
|
return config.getBoolean("Style.JSON.Hover.Details.Header.Bold");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJSONDetailsHeaderItalic()
|
public boolean isJSONDetailsHeaderItalic() {
|
||||||
{
|
|
||||||
return config.getBoolean("Style.JSON.Hover.Details.Header.Italics");
|
return config.getBoolean("Style.JSON.Hover.Details.Header.Italics");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJSONDetailsHeaderUnderlined()
|
public boolean isJSONDetailsHeaderUnderlined() {
|
||||||
{
|
|
||||||
return config.getBoolean("Style.JSON.Hover.Details.Header.Underlined");
|
return config.getBoolean("Style.JSON.Hover.Details.Header.Underlined");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChatColor getJSONStatHoverDescriptionColor()
|
public ChatColor getJSONStatHoverDescriptionColor() {
|
||||||
{
|
|
||||||
String keyLocation = "Style.JSON.Hover.Details.Description.Color";
|
String keyLocation = "Style.JSON.Hover.Details.Description.Color";
|
||||||
return getChatColorFromKey(keyLocation);
|
return getChatColorFromKey(keyLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJSONDetailsDescriptionBold()
|
public boolean isJSONDetailsDescriptionBold() {
|
||||||
{
|
|
||||||
return config.getBoolean("Style.JSON.Hover.Details.Description.Bold");
|
return config.getBoolean("Style.JSON.Hover.Details.Description.Bold");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJSONDetailsDescriptionItalic()
|
public boolean isJSONDetailsDescriptionItalic() {
|
||||||
{
|
|
||||||
return config.getBoolean("Style.JSON.Hover.Details.Description.Italics");
|
return config.getBoolean("Style.JSON.Hover.Details.Description.Italics");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJSONDetailsDescriptionUnderlined()
|
public boolean isJSONDetailsDescriptionUnderlined() {
|
||||||
{
|
|
||||||
return config.getBoolean("Style.JSON.Hover.Details.Description.Underlined");
|
return config.getBoolean("Style.JSON.Hover.Details.Description.Underlined");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChatColor getJSONActionBarColor(NotificationType notificationType)
|
public ChatColor getJSONActionBarColor(NotificationType notificationType) {
|
||||||
{
|
|
||||||
return getChatColor(config.getString("Style.JSON.Notification."+notificationType.toString()+".Color"));
|
return getChatColor(config.getString("Style.JSON.Notification."+notificationType.toString()+".Color"));
|
||||||
}*/
|
}*/
|
||||||
private ChatColor getChatColorFromKey(String keyLocation) {
|
private ChatColor getChatColorFromKey(String keyLocation) {
|
||||||
@ -580,22 +570,19 @@ public class AdvancedConfig extends BukkitConfig {
|
|||||||
return ChatColor.WHITE;
|
return ChatColor.WHITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public boolean isJSONStatHoverElementBold(StatType statType, boolean isPrefix)
|
/*public boolean isJSONStatHoverElementBold(StatType statType, boolean isPrefix) {
|
||||||
{
|
|
||||||
String keyAddress = isPrefix ? "Prefix" : "Value";
|
String keyAddress = isPrefix ? "Prefix" : "Value";
|
||||||
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Bold";
|
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Bold";
|
||||||
return config.getBoolean(keyLocation);
|
return config.getBoolean(keyLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJSONStatHoverElementItalic(StatType statType, boolean isPrefix)
|
public boolean isJSONStatHoverElementItalic(StatType statType, boolean isPrefix) {
|
||||||
{
|
|
||||||
String keyAddress = isPrefix ? "Prefix" : "Value";
|
String keyAddress = isPrefix ? "Prefix" : "Value";
|
||||||
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Italics";
|
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Italics";
|
||||||
return config.getBoolean(keyLocation);
|
return config.getBoolean(keyLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJSONStatHoverElementUnderlined(StatType statType, boolean isPrefix)
|
public boolean isJSONStatHoverElementUnderlined(StatType statType, boolean isPrefix) {
|
||||||
{
|
|
||||||
String keyAddress = isPrefix ? "Prefix" : "Value";
|
String keyAddress = isPrefix ? "Prefix" : "Value";
|
||||||
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Underline";
|
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Underline";
|
||||||
return config.getBoolean(keyLocation);
|
return config.getBoolean(keyLocation);
|
||||||
|
@ -152,8 +152,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
// If they're still around, rewrite them to the file.
|
// If they're still around, rewrite them to the file.
|
||||||
if (!powerless) {
|
if (!powerless) {
|
||||||
writer.append(line).append("\r\n");
|
writer.append(line).append("\r\n");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
purgedUsers++;
|
purgedUsers++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,7 @@ public enum DatabaseType {
|
|||||||
|
|
||||||
if (typeName.equalsIgnoreCase("file")) {
|
if (typeName.equalsIgnoreCase("file")) {
|
||||||
return FLATFILE;
|
return FLATFILE;
|
||||||
}
|
} else if (typeName.equalsIgnoreCase("mysql")) {
|
||||||
else if (typeName.equalsIgnoreCase("mysql")) {
|
|
||||||
return SQL;
|
return SQL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,8 +33,7 @@ public class SkillXpGain implements Delayed {
|
|||||||
public int compareTo(SkillXpGain other) {
|
public int compareTo(SkillXpGain other) {
|
||||||
if (this.expiryTime < other.expiryTime) {
|
if (this.expiryTime < other.expiryTime) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
} else if (this.expiryTime > other.expiryTime) {
|
||||||
else if (this.expiryTime > other.expiryTime) {
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -8,10 +8,8 @@ public class McMMOUrl {
|
|||||||
public static final String urlSpigot = "https://spigot.mcmmo.org";
|
public static final String urlSpigot = "https://spigot.mcmmo.org";
|
||||||
public static final String urlTranslate = "https://translate.mcmmo.org/";
|
public static final String urlTranslate = "https://translate.mcmmo.org/";
|
||||||
|
|
||||||
public static String getUrl(McMMOWebLinks webLinks)
|
public static String getUrl(McMMOWebLinks webLinks) {
|
||||||
{
|
switch(webLinks) {
|
||||||
switch(webLinks)
|
|
||||||
{
|
|
||||||
case WIKI:
|
case WIKI:
|
||||||
return urlWiki;
|
return urlWiki;
|
||||||
case PATREON:
|
case PATREON:
|
||||||
|
@ -11,20 +11,16 @@ public enum McMMOWebLinks {
|
|||||||
HELP_TRANSLATE,
|
HELP_TRANSLATE,
|
||||||
WIKI;
|
WIKI;
|
||||||
|
|
||||||
public String getUrl()
|
public String getUrl() {
|
||||||
{
|
|
||||||
return McMMOUrl.getUrl(this);
|
return McMMOUrl.getUrl(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNiceTitle()
|
public String getNiceTitle() {
|
||||||
{
|
|
||||||
return StringUtils.getCapitalized(toString());
|
return StringUtils.getCapitalized(toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLocaleDescription()
|
public String getLocaleDescription() {
|
||||||
{
|
switch (this) {
|
||||||
switch (this)
|
|
||||||
{
|
|
||||||
case WEBSITE:
|
case WEBSITE:
|
||||||
return LocaleLoader.getString( "JSON.URL.Website");
|
return LocaleLoader.getString( "JSON.URL.Website");
|
||||||
case DISCORD:
|
case DISCORD:
|
||||||
|
@ -8,8 +8,7 @@ import org.bukkit.metadata.FixedMetadataValue;
|
|||||||
*/
|
*/
|
||||||
public class OldName extends FixedMetadataValue {
|
public class OldName extends FixedMetadataValue {
|
||||||
|
|
||||||
public OldName(String oldName, mcMMO plugin)
|
public OldName(String oldName, mcMMO plugin) {
|
||||||
{
|
|
||||||
super(plugin, oldName);
|
super(plugin, oldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,17 +15,13 @@ public enum ItemShareType {
|
|||||||
public static ItemShareType getShareType(ItemStack itemStack) {
|
public static ItemShareType getShareType(ItemStack itemStack) {
|
||||||
if (ItemUtils.isMobDrop(itemStack)) {
|
if (ItemUtils.isMobDrop(itemStack)) {
|
||||||
return LOOT;
|
return LOOT;
|
||||||
}
|
} else if (ItemUtils.isMiningDrop(itemStack)) {
|
||||||
else if (ItemUtils.isMiningDrop(itemStack)) {
|
|
||||||
return MINING;
|
return MINING;
|
||||||
}
|
} else if (ItemUtils.isHerbalismDrop(itemStack)) {
|
||||||
else if (ItemUtils.isHerbalismDrop(itemStack)) {
|
|
||||||
return HERBALISM;
|
return HERBALISM;
|
||||||
}
|
} else if (ItemUtils.isWoodcuttingDrop(itemStack)) {
|
||||||
else if (ItemUtils.isWoodcuttingDrop(itemStack)) {
|
|
||||||
return WOODCUTTING;
|
return WOODCUTTING;
|
||||||
}
|
} else if (ItemUtils.isMiscDrop(itemStack)) {
|
||||||
else if (ItemUtils.isMiscDrop(itemStack)) {
|
|
||||||
return MISC;
|
return MISC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,12 +85,10 @@ public class Party {
|
|||||||
return onlineMembers;
|
return onlineMembers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Player> getVisibleMembers(Player player)
|
public List<Player> getVisibleMembers(Player player) {
|
||||||
{
|
|
||||||
ArrayList<Player> visibleMembers = new ArrayList<>();
|
ArrayList<Player> visibleMembers = new ArrayList<>();
|
||||||
|
|
||||||
for(Player p : onlineMembers)
|
for(Player p : onlineMembers) {
|
||||||
{
|
|
||||||
if (player.canSee(p))
|
if (player.canSee(p))
|
||||||
visibleMembers.add(p);
|
visibleMembers.add(p);
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,7 @@ public enum ShareMode {
|
|||||||
catch (IllegalArgumentException ex) {
|
catch (IllegalArgumentException ex) {
|
||||||
if (string.equalsIgnoreCase("even")) {
|
if (string.equalsIgnoreCase("even")) {
|
||||||
return EQUAL;
|
return EQUAL;
|
||||||
}
|
} else if (CommandUtils.shouldDisableToggle(string)) {
|
||||||
else if (CommandUtils.shouldDisableToggle(string)) {
|
|
||||||
return NONE;
|
return NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,8 +250,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
this.lastSkillShownScoreboard = primarySkillType;
|
this.lastSkillShownScoreboard = primarySkillType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processPostXpEvent(PrimarySkillType primarySkillType, Plugin plugin, XPGainSource xpGainSource)
|
public void processPostXpEvent(PrimarySkillType primarySkillType, Plugin plugin, XPGainSource xpGainSource) {
|
||||||
{
|
|
||||||
//Check if they've reached the power level cap just now
|
//Check if they've reached the power level cap just now
|
||||||
if (hasReachedPowerLevelCap()) {
|
if (hasReachedPowerLevelCap()) {
|
||||||
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.PowerLevel", String.valueOf(mcMMO.p.getGeneralConfig().getPowerLevelCap()));
|
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.PowerLevel", String.valueOf(mcMMO.p.getGeneralConfig().getPowerLevelCap()));
|
||||||
@ -272,19 +271,16 @@ public class McMMOPlayer implements Identified {
|
|||||||
updateXPBar(primarySkillType, plugin);
|
updateXPBar(primarySkillType, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processUnlockNotifications(mcMMO plugin, PrimarySkillType primarySkillType, int skillLevel)
|
public void processUnlockNotifications(mcMMO plugin, PrimarySkillType primarySkillType, int skillLevel) {
|
||||||
{
|
|
||||||
RankUtils.executeSkillUnlockNotifications(plugin, this, primarySkillType, skillLevel);
|
RankUtils.executeSkillUnlockNotifications(plugin, this, primarySkillType, skillLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateXPBar(PrimarySkillType primarySkillType, Plugin plugin)
|
public void updateXPBar(PrimarySkillType primarySkillType, Plugin plugin) {
|
||||||
{
|
|
||||||
//XP BAR UPDATES
|
//XP BAR UPDATES
|
||||||
experienceBarManager.updateExperienceBar(primarySkillType, plugin);
|
experienceBarManager.updateExperienceBar(primarySkillType, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getProgressInCurrentSkillLevel(PrimarySkillType primarySkillType)
|
public double getProgressInCurrentSkillLevel(PrimarySkillType primarySkillType) {
|
||||||
{
|
|
||||||
if (SkillTools.isChildSkill(primarySkillType)) {
|
if (SkillTools.isChildSkill(primarySkillType)) {
|
||||||
return 1.0D;
|
return 1.0D;
|
||||||
}
|
}
|
||||||
@ -906,8 +902,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
|
|
||||||
//TODO: This is hacky and temporary solution until skills are move to the new system
|
//TODO: This is hacky and temporary solution until skills are move to the new system
|
||||||
//Potential problems with this include skills with two super abilities (ie mining)
|
//Potential problems with this include skills with two super abilities (ie mining)
|
||||||
if (!RankUtils.hasUnlockedSubskill(player, subSkillType))
|
if (!RankUtils.hasUnlockedSubskill(player, subSkillType)) {
|
||||||
{
|
|
||||||
int diff = RankUtils.getSuperAbilityUnlockRequirement(superAbilityType) - getSkillLevel(primarySkillType);
|
int diff = RankUtils.getSuperAbilityUnlockRequirement(superAbilityType) - getSkillLevel(primarySkillType);
|
||||||
|
|
||||||
//Inform the player they are not yet skilled enough
|
//Inform the player they are not yet skilled enough
|
||||||
@ -941,8 +936,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
int ticks;
|
int ticks;
|
||||||
|
|
||||||
//Ability cap of 0 or below means no cap
|
//Ability cap of 0 or below means no cap
|
||||||
if (abilityLengthCap > 0)
|
if (abilityLengthCap > 0) {
|
||||||
{
|
|
||||||
ticks = PerksUtils.handleActivationPerks(player, 2 + (Math.min(abilityLengthCap, getSkillLevel(primarySkillType)) / abilityLengthVar), superAbilityType.getMaxLength());
|
ticks = PerksUtils.handleActivationPerks(player, 2 + (Math.min(abilityLengthCap, getSkillLevel(primarySkillType)) / abilityLengthVar), superAbilityType.getMaxLength());
|
||||||
} else {
|
} else {
|
||||||
ticks = PerksUtils.handleActivationPerks(player, 2 + (getSkillLevel(primarySkillType) / abilityLengthVar), superAbilityType.getMaxLength());
|
ticks = PerksUtils.handleActivationPerks(player, 2 + (getSkillLevel(primarySkillType) / abilityLengthVar), superAbilityType.getMaxLength());
|
||||||
|
@ -135,8 +135,7 @@ public class PlayerProfile {
|
|||||||
+ " resulted in failure. "+saveAttempts+" have been made so far.");
|
+ " resulted in failure. "+saveAttempts+" have been made so far.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saveAttempts < 10)
|
if (saveAttempts < 10) {
|
||||||
{
|
|
||||||
saveAttempts++;
|
saveAttempts++;
|
||||||
|
|
||||||
//Back out of async saving if we detect a server shutdown, this is not always going to be caught
|
//Back out of async saving if we detect a server shutdown, this is not always going to be caught
|
||||||
@ -372,8 +371,7 @@ public class PlayerProfile {
|
|||||||
for (PrimarySkillType parentSkill : parentSkills) {
|
for (PrimarySkillType parentSkill : parentSkills) {
|
||||||
skillsXp.put(parentSkill, skillsXp.get(parentSkill) + dividedXP);
|
skillsXp.put(parentSkill, skillsXp.get(parentSkill) + dividedXP);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
skillsXp.put(skill, skillsXp.get(skill) + xp);
|
skillsXp.put(skill, skillsXp.get(skill) + xp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,11 +9,9 @@ public enum ModConfigType {
|
|||||||
public static ModConfigType getModConfigType(String materialName) {
|
public static ModConfigType getModConfigType(String materialName) {
|
||||||
if (materialName.contains("HELM") || (materialName.contains("CHEST") && !materialName.contains("CHESTNUT")) || materialName.contains("LEGS") || materialName.contains("LEGGINGS") || materialName.contains("BOOT")) {
|
if (materialName.contains("HELM") || (materialName.contains("CHEST") && !materialName.contains("CHESTNUT")) || materialName.contains("LEGS") || materialName.contains("LEGGINGS") || materialName.contains("BOOT")) {
|
||||||
return ARMOR;
|
return ARMOR;
|
||||||
}
|
} else if (materialName.contains("PICKAXE") || materialName.contains("AXE") || (materialName.contains("BOW") && !materialName.contains("BOWL")) || materialName.contains("HOE") || materialName.contains("SHOVEL") || materialName.contains("SWORD")) {
|
||||||
else if (materialName.contains("PICKAXE") || materialName.contains("AXE") || (materialName.contains("BOW") && !materialName.contains("BOWL")) || materialName.contains("HOE") || materialName.contains("SHOVEL") || materialName.contains("SWORD")) {
|
|
||||||
return TOOLS;
|
return TOOLS;
|
||||||
}
|
} else if (materialName.contains("LOG") || materialName.contains("LEAVES") || materialName.contains("FLOWER") || materialName.contains("PLANT") || materialName.contains("CROP") || materialName.contains("ORE") || materialName.contains("DIRT") || materialName.contains("SAND") || materialName.contains("GRASS")) {
|
||||||
else if (materialName.contains("LOG") || materialName.contains("LEAVES") || materialName.contains("FLOWER") || materialName.contains("PLANT") || materialName.contains("CROP") || materialName.contains("ORE") || materialName.contains("DIRT") || materialName.contains("SAND") || materialName.contains("GRASS")) {
|
|
||||||
return BLOCKS;
|
return BLOCKS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,18 +128,15 @@ public enum SubSkillType {
|
|||||||
* If our SubSkillType has more than 1 rank define it
|
* If our SubSkillType has more than 1 rank define it
|
||||||
* @param numRanks The number of ranks our SubSkillType has
|
* @param numRanks The number of ranks our SubSkillType has
|
||||||
*/
|
*/
|
||||||
SubSkillType(int numRanks)
|
SubSkillType(int numRanks) {
|
||||||
{
|
|
||||||
this.numRanks = numRanks;
|
this.numRanks = numRanks;
|
||||||
}
|
}
|
||||||
|
|
||||||
SubSkillType()
|
SubSkillType() {
|
||||||
{
|
|
||||||
this.numRanks = 0;
|
this.numRanks = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNumRanks()
|
public int getNumRanks() {
|
||||||
{
|
|
||||||
return numRanks;
|
return numRanks;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,8 +167,7 @@ public enum SubSkillType {
|
|||||||
* Get the string representation of the permission node for this subskill
|
* Get the string representation of the permission node for this subskill
|
||||||
* @return the permission node for this subskill
|
* @return the permission node for this subskill
|
||||||
*/
|
*/
|
||||||
public String getPermissionNodeAddress()
|
public String getPermissionNodeAddress() {
|
||||||
{
|
|
||||||
//TODO: This could be optimized
|
//TODO: This could be optimized
|
||||||
return "mcmmo.ability." + getParentSkill().toString().toLowerCase(Locale.ENGLISH) + "." + getConfigName(toString()).toLowerCase(Locale.ENGLISH);
|
return "mcmmo.ability." + getParentSkill().toString().toLowerCase(Locale.ENGLISH) + "." + getConfigName(toString()).toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
@ -201,12 +197,10 @@ public enum SubSkillType {
|
|||||||
* Split the string up so we can capitalize each part
|
* Split the string up so we can capitalize each part
|
||||||
*/
|
*/
|
||||||
String subskillNameWithoutPrefix = subSkillName.substring(subStringIndex);
|
String subskillNameWithoutPrefix = subSkillName.substring(subStringIndex);
|
||||||
if (subskillNameWithoutPrefix.contains("_"))
|
if (subskillNameWithoutPrefix.contains("_")) {
|
||||||
{
|
|
||||||
String[] splitStrings = subskillNameWithoutPrefix.split("_");
|
String[] splitStrings = subskillNameWithoutPrefix.split("_");
|
||||||
|
|
||||||
for(String string : splitStrings)
|
for(String string : splitStrings) {
|
||||||
{
|
|
||||||
endResult.append(StringUtils.getCapitalized(string));
|
endResult.append(StringUtils.getCapitalized(string));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -228,8 +222,7 @@ public enum SubSkillType {
|
|||||||
* Returns the name of the parent skill from the Locale file
|
* Returns the name of the parent skill from the Locale file
|
||||||
* @return The parent skill as defined in the locale
|
* @return The parent skill as defined in the locale
|
||||||
*/
|
*/
|
||||||
public String getParentNiceNameLocale()
|
public String getParentNiceNameLocale() {
|
||||||
{
|
|
||||||
return LocaleLoader.getString(StringUtils.getCapitalized(getParentSkill().toString())+".SkillName");
|
return LocaleLoader.getString(StringUtils.getCapitalized(getParentSkill().toString())+".SkillName");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,8 +231,7 @@ public enum SubSkillType {
|
|||||||
* @param subSkillType target subskill
|
* @param subSkillType target subskill
|
||||||
* @return the "nice" name without spaces
|
* @return the "nice" name without spaces
|
||||||
*/
|
*/
|
||||||
public String getNiceNameNoSpaces(SubSkillType subSkillType)
|
public String getNiceNameNoSpaces(SubSkillType subSkillType) {
|
||||||
{
|
|
||||||
return getConfigName(subSkillType.toString());
|
return getConfigName(subSkillType.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,18 +255,15 @@ public enum SubSkillType {
|
|||||||
return subStringIndex;
|
return subStringIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLocaleKeyRoot()
|
public String getLocaleKeyRoot() {
|
||||||
{
|
|
||||||
return StringUtils.getCapitalized(getParentSkill().toString())+".SubSkill."+getConfigName(toString());
|
return StringUtils.getCapitalized(getParentSkill().toString())+".SubSkill."+getConfigName(toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLocaleName()
|
public String getLocaleName() {
|
||||||
{
|
|
||||||
return getFromLocaleSubAddress(".Name");
|
return getFromLocaleSubAddress(".Name");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLocaleDescription()
|
public String getLocaleDescription() {
|
||||||
{
|
|
||||||
return getFromLocaleSubAddress(".Description");
|
return getFromLocaleSubAddress(".Description");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,13 +273,11 @@ public enum SubSkillType {
|
|||||||
public String getLocaleStatExtraDescription() { return getFromLocaleSubAddress(".Stat.Extra"); }
|
public String getLocaleStatExtraDescription() { return getFromLocaleSubAddress(".Stat.Extra"); }
|
||||||
public String getLocaleKeyStatExtraDescription() { return getLocaleKeyFromSubAddress(".Stat.Extra"); }
|
public String getLocaleKeyStatExtraDescription() { return getLocaleKeyFromSubAddress(".Stat.Extra"); }
|
||||||
|
|
||||||
public String getLocaleStat(String... vars)
|
public String getLocaleStat(String... vars) {
|
||||||
{
|
|
||||||
return LocaleLoader.getString("Ability.Generic.Template", (Object[]) vars);
|
return LocaleLoader.getString("Ability.Generic.Template", (Object[]) vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCustomLocaleStat(String... vars)
|
public String getCustomLocaleStat(String... vars) {
|
||||||
{
|
|
||||||
return LocaleLoader.getString("Ability.Generic.Template.Custom", (Object[]) vars);
|
return LocaleLoader.getString("Ability.Generic.Template.Custom", (Object[]) vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,8 +285,7 @@ public enum SubSkillType {
|
|||||||
return LocaleLoader.getString(getLocaleKeyRoot() + s);
|
return LocaleLoader.getString(getLocaleKeyRoot() + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getLocaleKeyFromSubAddress(String s)
|
private String getLocaleKeyFromSubAddress(String s) {
|
||||||
{
|
|
||||||
return getLocaleKeyRoot() + s;
|
return getLocaleKeyRoot() + s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,7 @@ public abstract class AbstractSubSkill implements SubSkill, Interaction, Rank, S
|
|||||||
protected String configKeyPrimary;
|
protected String configKeyPrimary;
|
||||||
protected SubSkillType subSkillType;
|
protected SubSkillType subSkillType;
|
||||||
|
|
||||||
public AbstractSubSkill(String configKeySubSkill, String configKeyPrimary, SubSkillType subSkillType)
|
public AbstractSubSkill(String configKeySubSkill, String configKeyPrimary, SubSkillType subSkillType) {
|
||||||
{
|
|
||||||
this.configKeySubSkill = configKeySubSkill;
|
this.configKeySubSkill = configKeySubSkill;
|
||||||
this.configKeyPrimary = configKeyPrimary;
|
this.configKeyPrimary = configKeyPrimary;
|
||||||
this.subSkillType = subSkillType;
|
this.subSkillType = subSkillType;
|
||||||
|
@ -156,8 +156,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
//Advanced
|
//Advanced
|
||||||
|
|
||||||
//Lucky Notice
|
//Lucky Notice
|
||||||
if (isLucky)
|
if (isLucky) {
|
||||||
{
|
|
||||||
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.JWrapper.Perks.Header")));
|
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.JWrapper.Perks.Header")));
|
||||||
componentBuilder.append(Component.newline());
|
componentBuilder.append(Component.newline());
|
||||||
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.JWrapper.Perks.Lucky", "33")));
|
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.JWrapper.Perks.Lucky", "33")));
|
||||||
@ -219,8 +218,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
|
|
||||||
addFallLocation(mmoPlayer);
|
addFallLocation(mmoPlayer);
|
||||||
return modifiedDamage;
|
return modifiedDamage;
|
||||||
}
|
} else if (!isFatal(mmoPlayer, damage)) {
|
||||||
else if (!isFatal(mmoPlayer, damage)) {
|
|
||||||
//if (!SkillUtils.cooldownExpired((long) mmoPlayer.getTeleportATS(), Config.getInstance().getXPAfterTeleportCooldown())) {
|
//if (!SkillUtils.cooldownExpired((long) mmoPlayer.getTeleportATS(), Config.getInstance().getXPAfterTeleportCooldown())) {
|
||||||
if (!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
|
if (!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
|
||||||
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, damage, false), XPGainReason.PVE);
|
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, damage, false), XPGainReason.PVE);
|
||||||
@ -248,8 +246,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
|
|
||||||
if (!isFatal(mmoPlayer, modifiedDamage)
|
if (!isFatal(mmoPlayer, modifiedDamage)
|
||||||
//TODO: Graceful isn't sending out an event
|
//TODO: Graceful isn't sending out an event
|
||||||
&& ProbabilityUtil.isStaticSkillRNGSuccessful(PrimarySkillType.ACROBATICS, mmoPlayer, gracefulProbability))
|
&& ProbabilityUtil.isStaticSkillRNGSuccessful(PrimarySkillType.ACROBATICS, mmoPlayer, gracefulProbability)) {
|
||||||
{
|
|
||||||
NotificationManager.sendPlayerInformation(mmoPlayer.getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Acrobatics.Ability.Proc");
|
NotificationManager.sendPlayerInformation(mmoPlayer.getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Acrobatics.Ability.Proc");
|
||||||
SoundManager.sendCategorizedSound(mmoPlayer.getPlayer(), mmoPlayer.getPlayer().getLocation(), SoundType.ROLL_ACTIVATED, SoundCategory.PLAYERS,0.5F);
|
SoundManager.sendCategorizedSound(mmoPlayer.getPlayer(), mmoPlayer.getPlayer().getLocation(), SoundType.ROLL_ACTIVATED, SoundCategory.PLAYERS,0.5F);
|
||||||
if (!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
|
if (!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
|
||||||
@ -257,8 +254,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
|
|
||||||
addFallLocation(mmoPlayer);
|
addFallLocation(mmoPlayer);
|
||||||
return modifiedDamage;
|
return modifiedDamage;
|
||||||
}
|
} else if (!isFatal(mmoPlayer, damage)) {
|
||||||
else if (!isFatal(mmoPlayer, damage)) {
|
|
||||||
if (!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
|
if (!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
|
||||||
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, damage, false), XPGainReason.PVE);
|
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, damage, false), XPGainReason.PVE);
|
||||||
|
|
||||||
@ -292,8 +288,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mmoPlayer.getAcrobaticsManager().hasFallenInLocationBefore(getBlockLocation(mmoPlayer)))
|
if (mmoPlayer.getAcrobaticsManager().hasFallenInLocationBefore(getBlockLocation(mmoPlayer))) {
|
||||||
{
|
|
||||||
if (mmoPlayer.isDebugMode()) {
|
if (mmoPlayer.isDebugMode()) {
|
||||||
mmoPlayer.getPlayer().sendMessage("Acrobatics XP Prevented: Fallen in location before");
|
mmoPlayer.getPlayer().sendMessage("Acrobatics XP Prevented: Fallen in location before");
|
||||||
}
|
}
|
||||||
@ -369,8 +364,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
* @return stat array for target player for this skill
|
* @return stat array for target player for this skill
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Double[] getStats(McMMOPlayer mmoPlayer)
|
public Double[] getStats(McMMOPlayer mmoPlayer) {
|
||||||
{
|
|
||||||
double playerChanceRoll = ProbabilityUtil.getSubSkillProbability(subSkillType, mmoPlayer).getValue();
|
double playerChanceRoll = ProbabilityUtil.getSubSkillProbability(subSkillType, mmoPlayer).getValue();
|
||||||
double playerChanceGrace = playerChanceRoll * 2;
|
double playerChanceGrace = playerChanceRoll * 2;
|
||||||
|
|
||||||
|
@ -18,8 +18,7 @@ abstract public class McMMOScoreboardEvent extends Event {
|
|||||||
|
|
||||||
private final ScoreboardEventReason scoreboardEventReason;
|
private final ScoreboardEventReason scoreboardEventReason;
|
||||||
|
|
||||||
public McMMOScoreboardEvent(Scoreboard targetBoard, Scoreboard currentBoard, Player targetPlayer, ScoreboardEventReason scoreboardEventReason)
|
public McMMOScoreboardEvent(Scoreboard targetBoard, Scoreboard currentBoard, Player targetPlayer, ScoreboardEventReason scoreboardEventReason) {
|
||||||
{
|
|
||||||
this.scoreboardEventReason = scoreboardEventReason;
|
this.scoreboardEventReason = scoreboardEventReason;
|
||||||
this.targetBoard = targetBoard;
|
this.targetBoard = targetBoard;
|
||||||
this.currentBoard = currentBoard;
|
this.currentBoard = currentBoard;
|
||||||
|
@ -47,8 +47,7 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
|
||||||
public void onBlockDropItemEvent(BlockDropItemEvent event)
|
public void onBlockDropItemEvent(BlockDropItemEvent event) {
|
||||||
{
|
|
||||||
//Make sure we clean up metadata on these blocks
|
//Make sure we clean up metadata on these blocks
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
if (event.getBlock().hasMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS))
|
if (event.getBlock().hasMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS))
|
||||||
@ -84,8 +83,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
//If there are more than one block in the item list we can't really trust it and will back out of rewarding bonus drops
|
//If there are more than one block in the item list we can't really trust it and will back out of rewarding bonus drops
|
||||||
if (blockCount <= 1) {
|
if (blockCount <= 1) {
|
||||||
for(Item item : event.getItems())
|
for(Item item : event.getItems()) {
|
||||||
{
|
|
||||||
ItemStack is = new ItemStack(item.getItemStack());
|
ItemStack is = new ItemStack(item.getItemStack());
|
||||||
|
|
||||||
if (is.getAmount() <= 0)
|
if (is.getAmount() <= 0)
|
||||||
@ -186,8 +184,7 @@ public class BlockListener implements Listener {
|
|||||||
* @param event The event to watch
|
* @param event The event to watch
|
||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onEntityBlockFormEvent(EntityBlockFormEvent event)
|
public void onEntityBlockFormEvent(EntityBlockFormEvent event) {
|
||||||
{
|
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||||
return;
|
return;
|
||||||
@ -207,8 +204,7 @@ public class BlockListener implements Listener {
|
|||||||
* Does not monitor stuff like a falling block replacing a liquid
|
* Does not monitor stuff like a falling block replacing a liquid
|
||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockFormEvent(BlockFormEvent event)
|
public void onBlockFormEvent(BlockFormEvent event) {
|
||||||
{
|
|
||||||
World world = event.getBlock().getWorld();
|
World world = event.getBlock().getWorld();
|
||||||
|
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
@ -266,8 +262,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
if (blockState.getType() == Repair.anvilMaterial && mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.REPAIR)) {
|
if (blockState.getType() == Repair.anvilMaterial && mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.REPAIR)) {
|
||||||
mcMMOPlayer.getRepairManager().placedAnvilCheck();
|
mcMMOPlayer.getRepairManager().placedAnvilCheck();
|
||||||
}
|
} else if (blockState.getType() == Salvage.anvilMaterial && mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.SALVAGE)) {
|
||||||
else if (blockState.getType() == Salvage.anvilMaterial && mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.SALVAGE)) {
|
|
||||||
mcMMOPlayer.getSalvageManager().placedAnvilCheck();
|
mcMMOPlayer.getSalvageManager().placedAnvilCheck();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -334,8 +329,7 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer())) {
|
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer())) {
|
||||||
BlockUtils.cleanupBlockMetadata(block);
|
BlockUtils.cleanupBlockMetadata(block);
|
||||||
return;
|
return;
|
||||||
@ -411,8 +405,7 @@ public class BlockListener implements Listener {
|
|||||||
WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager();
|
WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager();
|
||||||
if (woodcuttingManager.canUseTreeFeller(heldItem)) {
|
if (woodcuttingManager.canUseTreeFeller(heldItem)) {
|
||||||
woodcuttingManager.processTreeFeller(blockState);
|
woodcuttingManager.processTreeFeller(blockState);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
//Check for XP
|
//Check for XP
|
||||||
woodcuttingManager.processWoodcuttingBlockXP(blockState);
|
woodcuttingManager.processWoodcuttingBlockXP(blockState);
|
||||||
|
|
||||||
@ -422,7 +415,10 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* EXCAVATION */
|
/* EXCAVATION */
|
||||||
else if (BlockUtils.affectedByGigaDrillBreaker(blockState) && ItemUtils.isShovel(heldItem) && mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.EXCAVATION) && !mcMMO.getUserBlockTracker().isIneligible(blockState)) {
|
else if (BlockUtils.affectedByGigaDrillBreaker(blockState)
|
||||||
|
&& ItemUtils.isShovel(heldItem)
|
||||||
|
&& mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.EXCAVATION)
|
||||||
|
&& !mcMMO.getUserBlockTracker().isIneligible(blockState)) {
|
||||||
ExcavationManager excavationManager = mcMMOPlayer.getExcavationManager();
|
ExcavationManager excavationManager = mcMMOPlayer.getExcavationManager();
|
||||||
excavationManager.excavationBlockCheck(blockState);
|
excavationManager.excavationBlockCheck(blockState);
|
||||||
|
|
||||||
@ -450,8 +446,7 @@ public class BlockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -463,8 +458,7 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,8 +472,7 @@ public class BlockListener implements Listener {
|
|||||||
if (herbalismManager.processHylianLuck(blockState)) {
|
if (herbalismManager.processHylianLuck(blockState)) {
|
||||||
blockState.update(true);
|
blockState.update(true);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
} else if (blockState.getType() == Material.FLOWER_POT) {
|
||||||
else if (blockState.getType() == Material.FLOWER_POT) {
|
|
||||||
blockState.setType(Material.AIR);
|
blockState.setType(Material.AIR);
|
||||||
blockState.update(true);
|
blockState.update(true);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -513,8 +506,7 @@ public class BlockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -529,8 +521,7 @@ public class BlockListener implements Listener {
|
|||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (mcMMOPlayer == null)
|
if (mcMMOPlayer == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,17 +535,13 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
if (mcMMOPlayer.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)) {
|
||||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.HERBALISM);
|
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.HERBALISM);
|
||||||
}
|
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && ItemUtils.isAxe(heldItem) && BlockUtils.hasWoodcuttingXP(blockState) && Permissions.treeFeller(player)) {
|
||||||
else if (mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && ItemUtils.isAxe(heldItem) && BlockUtils.hasWoodcuttingXP(blockState) && Permissions.treeFeller(player)) {
|
|
||||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.WOODCUTTING);
|
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.WOODCUTTING);
|
||||||
}
|
} else if (mcMMOPlayer.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)) {
|
|
||||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.MINING);
|
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.MINING);
|
||||||
}
|
} else if (mcMMOPlayer.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)) {
|
|
||||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.EXCAVATION);
|
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.EXCAVATION);
|
||||||
}
|
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState)
|
||||||
else if (mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState)
|
|
||||||
|| mcMMO.getMaterialMapStore().isGlass(blockState.getType())
|
|| mcMMO.getMaterialMapStore().isGlass(blockState.getType())
|
||||||
|| blockState.getType() == Material.SNOW
|
|| blockState.getType() == Material.SNOW
|
||||||
|| BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
|
|| BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
|
||||||
@ -596,8 +583,7 @@ public class BlockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -615,8 +601,7 @@ public class BlockListener implements Listener {
|
|||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -633,14 +618,12 @@ public class BlockListener implements Listener {
|
|||||||
if (mcMMOPlayer.getHerbalismManager().processGreenTerraBlockConversion(blockState)) {
|
if (mcMMOPlayer.getHerbalismManager().processGreenTerraBlockConversion(blockState)) {
|
||||||
blockState.update(true);
|
blockState.update(true);
|
||||||
}
|
}
|
||||||
}
|
} else if (mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK) && (heldItem.getType() == Material.AIR || mcMMO.p.getGeneralConfig().getUnarmedItemsAsUnarmed())) {
|
||||||
else if (mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK) && (heldItem.getType() == Material.AIR || mcMMO.p.getGeneralConfig().getUnarmedItemsAsUnarmed())) {
|
|
||||||
if (mcMMOPlayer.getUnarmedManager().canUseBlockCracker() && BlockUtils.affectedByBlockCracker(blockState)) {
|
if (mcMMOPlayer.getUnarmedManager().canUseBlockCracker() && BlockUtils.affectedByBlockCracker(blockState)) {
|
||||||
if (EventUtils.simulateBlockBreak(block, player) && mcMMOPlayer.getUnarmedManager().blockCrackerCheck(blockState)) {
|
if (EventUtils.simulateBlockBreak(block, player) && mcMMOPlayer.getUnarmedManager().blockCrackerCheck(blockState)) {
|
||||||
blockState.update();
|
blockState.update();
|
||||||
}
|
}
|
||||||
}
|
} else if (!event.getInstaBreak() && SuperAbilityType.BERSERK.blockCheck(blockState) && EventUtils.simulateBlockBreak(block, player)) {
|
||||||
else if (!event.getInstaBreak() && SuperAbilityType.BERSERK.blockCheck(blockState) && EventUtils.simulateBlockBreak(block, player)) {
|
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
|
|
||||||
if (blockState.getType().getKey().getKey().contains("glass")) {
|
if (blockState.getType().getKey().getKey().contains("glass")) {
|
||||||
@ -649,8 +632,7 @@ public class BlockListener implements Listener {
|
|||||||
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
|
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (mcMMOPlayer.getWoodcuttingManager().canUseLeafBlower(heldItem) && BlockUtils.isNonWoodPartOfTree(blockState) && EventUtils.simulateBlockBreak(block, player)) {
|
||||||
else if (mcMMOPlayer.getWoodcuttingManager().canUseLeafBlower(heldItem) && BlockUtils.isNonWoodPartOfTree(blockState) && EventUtils.simulateBlockBreak(block, player)) {
|
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
|
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
|
||||||
}
|
}
|
||||||
@ -662,8 +644,7 @@ public class BlockListener implements Listener {
|
|||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -680,23 +661,19 @@ public class BlockListener implements Listener {
|
|||||||
//TODO: Convert into locale strings
|
//TODO: Convert into locale strings
|
||||||
private void debugStickDump(Player player, BlockState blockState) {
|
private void debugStickDump(Player player, BlockState blockState) {
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UserManager.getPlayer(player).isDebugMode())
|
if (UserManager.getPlayer(player).isDebugMode()) {
|
||||||
{
|
|
||||||
if (mcMMO.getUserBlockTracker().isIneligible(blockState))
|
if (mcMMO.getUserBlockTracker().isIneligible(blockState))
|
||||||
player.sendMessage("[mcMMO DEBUG] This block is not natural and does not reward treasures/XP");
|
player.sendMessage("[mcMMO DEBUG] This block is not natural and does not reward treasures/XP");
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
player.sendMessage("[mcMMO DEBUG] This block is considered natural by mcMMO");
|
player.sendMessage("[mcMMO DEBUG] This block is considered natural by mcMMO");
|
||||||
UserManager.getPlayer(player).getExcavationManager().printExcavationDebug(player, blockState);
|
UserManager.getPlayer(player).getExcavationManager().printExcavationDebug(player, blockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (WorldGuardManager.getInstance().hasMainFlag(player))
|
if (WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
player.sendMessage("[mcMMO DEBUG] World Guard main flag is permitted for this player in this region");
|
player.sendMessage("[mcMMO DEBUG] World Guard main flag is permitted for this player in this region");
|
||||||
else
|
else
|
||||||
|
@ -81,14 +81,12 @@ public class EntityListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//It's rare but targets can be null sometimes
|
//It's rare but targets can be null sometimes
|
||||||
if (event.getTarget() == null)
|
if (event.getTarget() == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Prevent entities from giving XP if they target endermite
|
//Prevent entities from giving XP if they target endermite
|
||||||
if (event.getTarget() instanceof Endermite)
|
if (event.getTarget() instanceof Endermite) {
|
||||||
{
|
|
||||||
if (event.getEntity() instanceof Enderman enderman) {
|
if (event.getEntity() instanceof Enderman enderman) {
|
||||||
|
|
||||||
if (!hasMobFlag(MobMetaFlagType.EXPLOITED_ENDERMEN, enderman)) {
|
if (!hasMobFlag(MobMetaFlagType.EXPLOITED_ENDERMEN, enderman)) {
|
||||||
@ -104,8 +102,7 @@ public class EntityListener implements Listener {
|
|||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.getEntity() instanceof Player player)
|
if (event.getEntity() instanceof Player player) {
|
||||||
{
|
|
||||||
Entity projectile = event.getProjectile();
|
Entity projectile = event.getProjectile();
|
||||||
|
|
||||||
//Should be noted that there are API changes regarding Arrow from 1.13.2 to current versions of the game
|
//Should be noted that there are API changes regarding Arrow from 1.13.2 to current versions of the game
|
||||||
@ -137,8 +134,7 @@ public class EntityListener implements Listener {
|
|||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.getEntity().getShooter() instanceof Player player)
|
if (event.getEntity().getShooter() instanceof Player player) {
|
||||||
{
|
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
@ -212,15 +208,13 @@ public class EntityListener implements Listener {
|
|||||||
entity.setMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, MetadataConstants.MCMMO_METADATA_VALUE);
|
entity.setMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, MetadataConstants.MCMMO_METADATA_VALUE);
|
||||||
TravelingBlockMetaCleanup metaCleanupTask = new TravelingBlockMetaCleanup(entity, pluginRef);
|
TravelingBlockMetaCleanup metaCleanupTask = new TravelingBlockMetaCleanup(entity, pluginRef);
|
||||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(entity, metaCleanupTask, 20, 20*60); //6000 ticks is 5 minutes
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(entity, metaCleanupTask, 20, 20*60); //6000 ticks is 5 minutes
|
||||||
}
|
} else if (isTracked) {
|
||||||
else if (isTracked) {
|
|
||||||
BlockUtils.setUnnaturalBlock(block);
|
BlockUtils.setUnnaturalBlock(block);
|
||||||
entity.removeMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, pluginRef);
|
entity.removeMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, pluginRef);
|
||||||
}
|
}
|
||||||
} else if ((block.getType() == Material.REDSTONE_ORE || block.getType().getKey().getKey().equalsIgnoreCase("deepslate_redstone_ore"))) {
|
} else if ((block.getType() == Material.REDSTONE_ORE || block.getType().getKey().getKey().equalsIgnoreCase("deepslate_redstone_ore"))) {
|
||||||
//Redstone ore fire this event and should be ignored
|
//Redstone ore fire this event and should be ignored
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (mcMMO.getUserBlockTracker().isIneligible(block)) {
|
if (mcMMO.getUserBlockTracker().isIneligible(block)) {
|
||||||
mcMMO.getUserBlockTracker().setEligible(block);
|
mcMMO.getUserBlockTracker().setEligible(block);
|
||||||
}
|
}
|
||||||
@ -265,8 +259,7 @@ public class EntityListener implements Listener {
|
|||||||
Entity defender = event.getEntity();
|
Entity defender = event.getEntity();
|
||||||
Entity attacker = event.getDamager();
|
Entity attacker = event.getDamager();
|
||||||
|
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (attacker instanceof Player) {
|
if (attacker instanceof Player) {
|
||||||
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag((Player) attacker)) {
|
if (!WorldGuardManager.getInstance().hasMainFlag((Player) attacker)) {
|
||||||
@ -324,8 +317,7 @@ public class EntityListener implements Listener {
|
|||||||
if (animalTamer != null && ((OfflinePlayer) animalTamer).isOnline()) {
|
if (animalTamer != null && ((OfflinePlayer) animalTamer).isOnline()) {
|
||||||
attacker = (Entity) animalTamer;
|
attacker = (Entity) animalTamer;
|
||||||
}
|
}
|
||||||
}
|
} else if (attacker instanceof TNTPrimed && defender instanceof Player) {
|
||||||
else if (attacker instanceof TNTPrimed && defender instanceof Player) {
|
|
||||||
if (BlastMining.processBlastMiningExplosion(event, (TNTPrimed) attacker, (Player) defender)) {
|
if (BlastMining.processBlastMiningExplosion(event, (TNTPrimed) attacker, (Player) defender)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -496,11 +488,9 @@ public class EntityListener implements Listener {
|
|||||||
event.getEntity().removeMetadata(MetadataConstants.METADATA_KEY_EXPLOSION_FROM_RUPTURE, mcMMO.p);
|
event.getEntity().removeMetadata(MetadataConstants.METADATA_KEY_EXPLOSION_FROM_RUPTURE, mcMMO.p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getEntity() instanceof Player player)
|
if (event.getEntity() instanceof Player player) {
|
||||||
{
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -576,11 +566,9 @@ public class EntityListener implements Listener {
|
|||||||
else if (livingEntity instanceof Tameable pet) {
|
else if (livingEntity instanceof Tameable pet) {
|
||||||
AnimalTamer owner = pet.getOwner();
|
AnimalTamer owner = pet.getOwner();
|
||||||
|
|
||||||
if (owner instanceof Player player)
|
if (owner instanceof Player player) {
|
||||||
{
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -591,8 +579,7 @@ public class EntityListener implements Listener {
|
|||||||
Wolf wolf = (Wolf) pet;
|
Wolf wolf = (Wolf) pet;
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -784,14 +771,12 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -830,15 +815,13 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -869,14 +852,12 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -993,8 +974,7 @@ public class EntityListener implements Listener {
|
|||||||
Player player = (Player) event.getOwner();
|
Player player = (Player) event.getOwner();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1011,8 +991,7 @@ public class EntityListener implements Listener {
|
|||||||
flagMetadata(MobMetaFlagType.PLAYER_TAMED_MOB, livingEntity);
|
flagMetadata(MobMetaFlagType.PLAYER_TAMED_MOB, livingEntity);
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1039,8 +1018,7 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,7 @@ public class InteractionManager {
|
|||||||
* Registers subskills with the Interaction registration
|
* Registers subskills with the Interaction registration
|
||||||
* @param abstractSubSkill the target subskill to register
|
* @param abstractSubSkill the target subskill to register
|
||||||
*/
|
*/
|
||||||
public static void registerSubSkill(AbstractSubSkill abstractSubSkill)
|
public static void registerSubSkill(AbstractSubSkill abstractSubSkill) {
|
||||||
{
|
|
||||||
//Store a unique copy of each subskill
|
//Store a unique copy of each subskill
|
||||||
if (!subSkillList.contains(abstractSubSkill))
|
if (!subSkillList.contains(abstractSubSkill))
|
||||||
subSkillList.add(abstractSubSkill);
|
subSkillList.add(abstractSubSkill);
|
||||||
@ -62,8 +61,7 @@ public class InteractionManager {
|
|||||||
* @param name name of subskill, not case sensitive
|
* @param name name of subskill, not case sensitive
|
||||||
* @return null if the subskill is not registered
|
* @return null if the subskill is not registered
|
||||||
*/
|
*/
|
||||||
public static AbstractSubSkill getAbstractByName(String name)
|
public static AbstractSubSkill getAbstractByName(String name) {
|
||||||
{
|
|
||||||
return subSkillNameMap.get(name.toLowerCase(Locale.ENGLISH));
|
return subSkillNameMap.get(name.toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,13 +71,11 @@ public class InteractionManager {
|
|||||||
* @param plugin instance of mcMMO plugin
|
* @param plugin instance of mcMMO plugin
|
||||||
* @param curInteractType the associated interaction type
|
* @param curInteractType the associated interaction type
|
||||||
*/
|
*/
|
||||||
public static void processEvent(Event event, mcMMO plugin, InteractType curInteractType)
|
public static void processEvent(Event event, mcMMO plugin, InteractType curInteractType) {
|
||||||
{
|
|
||||||
if (interactRegister.get(curInteractType) == null)
|
if (interactRegister.get(curInteractType) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(Interaction interaction : interactRegister.get(curInteractType))
|
for(Interaction interaction : interactRegister.get(curInteractType)) {
|
||||||
{
|
|
||||||
interaction.doInteraction(event, plugin);
|
interaction.doInteraction(event, plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,18 +85,15 @@ public class InteractionManager {
|
|||||||
* Interactions are extensions of abstract classes that represent modifying behaviours in Minecraft through events
|
* Interactions are extensions of abstract classes that represent modifying behaviours in Minecraft through events
|
||||||
* @return the unique collection of all registered Interaction classes
|
* @return the unique collection of all registered Interaction classes
|
||||||
*/
|
*/
|
||||||
public static ArrayList<AbstractSubSkill> getSubSkillList()
|
public static ArrayList<AbstractSubSkill> getSubSkillList() {
|
||||||
{
|
|
||||||
return subSkillList;
|
return subSkillList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasSubSkill(String name)
|
public static boolean hasSubSkill(String name) {
|
||||||
{
|
|
||||||
return getAbstractByName(name) != null;
|
return getAbstractByName(name) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasSubSkill(SubSkillType subSkillType)
|
public static boolean hasSubSkill(SubSkillType subSkillType) {
|
||||||
{
|
|
||||||
return hasSubSkill(subSkillType.getNiceNameNoSpaces(subSkillType));
|
return hasSubSkill(subSkillType.getNiceNameNoSpaces(subSkillType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,8 +131,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
if (furnaceBlock instanceof Furnace) {
|
if (furnaceBlock instanceof Furnace) {
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -142,8 +141,7 @@ public class InventoryListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,8 +194,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
// TODO: Investigate why this WG check is all the way down here?
|
// TODO: Investigate why this WG check is all the way down here?
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -239,8 +236,7 @@ public class InventoryListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
} else if (slot == InventoryType.SlotType.FUEL) {
|
||||||
else if (slot == InventoryType.SlotType.FUEL) {
|
|
||||||
boolean emptyClicked = AlchemyPotionBrewer.isEmpty(clicked);
|
boolean emptyClicked = AlchemyPotionBrewer.isEmpty(clicked);
|
||||||
|
|
||||||
if (AlchemyPotionBrewer.isEmpty(cursor)) {
|
if (AlchemyPotionBrewer.isEmpty(cursor)) {
|
||||||
@ -250,8 +246,7 @@ public class InventoryListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AlchemyPotionBrewer.scheduleCheck(stand);
|
AlchemyPotionBrewer.scheduleCheck(stand);
|
||||||
}
|
} else if (emptyClicked) {
|
||||||
else if (emptyClicked) {
|
|
||||||
if (AlchemyPotionBrewer.isValidIngredientByPlayer(player, cursor)) {
|
if (AlchemyPotionBrewer.isValidIngredientByPlayer(player, cursor)) {
|
||||||
int amount = cursor.getAmount();
|
int amount = cursor.getAmount();
|
||||||
|
|
||||||
@ -262,8 +257,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
AlchemyPotionBrewer.scheduleUpdate(inventory);
|
AlchemyPotionBrewer.scheduleUpdate(inventory);
|
||||||
AlchemyPotionBrewer.scheduleCheck(stand);
|
AlchemyPotionBrewer.scheduleCheck(stand);
|
||||||
}
|
} else if (click == ClickType.RIGHT) {
|
||||||
else if (click == ClickType.RIGHT) {
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
ItemStack one = cursor.clone();
|
ItemStack one = cursor.clone();
|
||||||
@ -323,8 +317,7 @@ public class InventoryListener implements Listener {
|
|||||||
Player player = (Player) whoClicked;
|
Player player = (Player) whoClicked;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -342,8 +335,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
// Apparently sometimes vanilla brewing beats our task listener to the actual brew. We handle this by cancelling the vanilla event and finishing our brew ourselves.
|
// Apparently sometimes vanilla brewing beats our task listener to the actual brew. We handle this by cancelling the vanilla event and finishing our brew ourselves.
|
||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void onBrew(BrewEvent event)
|
public void onBrew(BrewEvent event) {
|
||||||
{
|
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||||
return;
|
return;
|
||||||
@ -460,8 +452,7 @@ public class InventoryListener implements Listener {
|
|||||||
Player player = (Player) whoClicked;
|
Player player = (Player) whoClicked;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -87,8 +87,7 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -98,8 +97,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,8 +181,7 @@ public class PlayerListener implements Listener {
|
|||||||
Player killer = killedPlayer.getKiller();
|
Player killer = killedPlayer.getKiller();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(killedPlayer))
|
if (!WorldGuardManager.getInstance().hasMainFlag(killedPlayer))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -227,8 +224,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,8 +250,7 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -287,8 +282,7 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -298,8 +292,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,8 +366,7 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -384,8 +376,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,20 +384,16 @@ public class PlayerListener implements Listener {
|
|||||||
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
|
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
|
||||||
|
|
||||||
//Track the hook
|
//Track the hook
|
||||||
if (ExperienceConfig.getInstance().isFishingExploitingPrevented())
|
if (ExperienceConfig.getInstance().isFishingExploitingPrevented()) {
|
||||||
{
|
if (event.getHook().getMetadata(MetadataConstants.METADATA_KEY_FISH_HOOK_REF).size() == 0) {
|
||||||
if (event.getHook().getMetadata(MetadataConstants.METADATA_KEY_FISH_HOOK_REF).size() == 0)
|
|
||||||
{
|
|
||||||
fishingManager.setFishHookReference(event.getHook());
|
fishingManager.setFishHookReference(event.getHook());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Spam Fishing
|
//Spam Fishing
|
||||||
if (event.getState() == PlayerFishEvent.State.CAUGHT_FISH && fishingManager.isFishingTooOften())
|
if (event.getState() == PlayerFishEvent.State.CAUGHT_FISH && fishingManager.isFishingTooOften()) {
|
||||||
{
|
|
||||||
event.setExpToDrop(0);
|
event.setExpToDrop(0);
|
||||||
|
|
||||||
if (caught instanceof Item caughtItem)
|
if (caught instanceof Item caughtItem) {
|
||||||
{
|
|
||||||
caughtItem.remove();
|
caughtItem.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,12 +476,10 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getEntity() instanceof Player player)
|
if (event.getEntity() instanceof Player player) {
|
||||||
{
|
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -618,8 +603,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -640,8 +624,7 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -665,8 +648,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -715,8 +697,7 @@ public class PlayerListener implements Listener {
|
|||||||
else if (miningManager.canDetonate()) {
|
else if (miningManager.canDetonate()) {
|
||||||
if (type == Material.TNT) {
|
if (type == Material.TNT) {
|
||||||
event.setCancelled(true); // Don't detonate the TNT if they're too close
|
event.setCancelled(true); // Don't detonate the TNT if they're too close
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
miningManager.remoteDetonation();
|
miningManager.remoteDetonation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -770,19 +751,19 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getHand() != EquipmentSlot.HAND || !UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
|
if (event.getHand() != EquipmentSlot.HAND
|
||||||
|
|| !UserManager.hasPlayerDataKey(player)
|
||||||
|
|| player.getGameMode() == GameMode.CREATIVE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -793,13 +774,10 @@ public class PlayerListener implements Listener {
|
|||||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
//Spam Fishing Detection
|
//Spam Fishing Detection
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR)
|
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) {
|
||||||
{
|
|
||||||
if (ExperienceConfig.getInstance().isFishingExploitingPrevented()
|
if (ExperienceConfig.getInstance().isFishingExploitingPrevented()
|
||||||
&& (heldItem.getType() == Material.FISHING_ROD || player.getInventory().getItemInOffHand().getType() == Material.FISHING_ROD))
|
&& (heldItem.getType() == Material.FISHING_ROD || player.getInventory().getItemInOffHand().getType() == Material.FISHING_ROD)) {
|
||||||
{
|
if (player.isInsideVehicle() && (player.getVehicle() instanceof Minecart || player.getVehicle() instanceof PoweredMinecart)) {
|
||||||
if (player.isInsideVehicle() && (player.getVehicle() instanceof Minecart || player.getVehicle() instanceof PoweredMinecart))
|
|
||||||
{
|
|
||||||
player.getVehicle().eject();
|
player.getVehicle().eject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -924,11 +902,9 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
if (type == mcMMO.p.getGeneralConfig().getTamingCOTWMaterial(CallOfTheWildType.WOLF.getConfigEntityTypeEntry())) {
|
if (type == mcMMO.p.getGeneralConfig().getTamingCOTWMaterial(CallOfTheWildType.WOLF.getConfigEntityTypeEntry())) {
|
||||||
tamingManager.summonWolf();
|
tamingManager.summonWolf();
|
||||||
}
|
} else if (type == mcMMO.p.getGeneralConfig().getTamingCOTWMaterial(CallOfTheWildType.CAT.getConfigEntityTypeEntry())) {
|
||||||
else if (type == mcMMO.p.getGeneralConfig().getTamingCOTWMaterial(CallOfTheWildType.CAT.getConfigEntityTypeEntry())) {
|
|
||||||
tamingManager.summonOcelot();
|
tamingManager.summonOcelot();
|
||||||
}
|
} else if (type == mcMMO.p.getGeneralConfig().getTamingCOTWMaterial(CallOfTheWildType.HORSE.getConfigEntityTypeEntry())) {
|
||||||
else if (type == mcMMO.p.getGeneralConfig().getTamingCOTWMaterial(CallOfTheWildType.HORSE.getConfigEntityTypeEntry())) {
|
|
||||||
tamingManager.summonHorse();
|
tamingManager.summonHorse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1028,8 +1004,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
if (event.getHand() == EquipmentSlot.OFF_HAND) {
|
if (event.getHand() == EquipmentSlot.OFF_HAND) {
|
||||||
itemInHand = event.getPlayer().getInventory().getItemInOffHand();
|
itemInHand = event.getPlayer().getInventory().getItemInOffHand();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
itemInHand = event.getPlayer().getInventory().getItemInMainHand();
|
itemInHand = event.getPlayer().getInventory().getItemInMainHand();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,8 +24,7 @@ public class SelfListener implements Listener {
|
|||||||
//Used in task scheduling and other things
|
//Used in task scheduling and other things
|
||||||
private final mcMMO plugin;
|
private final mcMMO plugin;
|
||||||
|
|
||||||
public SelfListener(mcMMO plugin)
|
public SelfListener(mcMMO plugin) {
|
||||||
{
|
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,8 +41,7 @@ public class SelfListener implements Listener {
|
|||||||
|
|
||||||
if (player.isOnline()) {
|
if (player.isOnline()) {
|
||||||
//Players can gain multiple levels especially during xprate events
|
//Players can gain multiple levels especially during xprate events
|
||||||
for(int i = 0; i < event.getLevelsGained(); i++)
|
for(int i = 0; i < event.getLevelsGained(); i++) {
|
||||||
{
|
|
||||||
int previousLevelGained = event.getSkillLevel() - i;
|
int previousLevelGained = event.getSkillLevel() - i;
|
||||||
//Send player skill unlock notifications
|
//Send player skill unlock notifications
|
||||||
UserManager.getPlayer(player).processUnlockNotifications(plugin, event.getSkill(), previousLevelGained);
|
UserManager.getPlayer(player).processUnlockNotifications(plugin, event.getSkill(), previousLevelGained);
|
||||||
@ -96,12 +94,9 @@ public class SelfListener implements Listener {
|
|||||||
if (event.getXpGainReason() == XPGainReason.PVE ||
|
if (event.getXpGainReason() == XPGainReason.PVE ||
|
||||||
event.getXpGainReason() == XPGainReason.PVP ||
|
event.getXpGainReason() == XPGainReason.PVP ||
|
||||||
event.getXpGainReason() == XPGainReason.SHARED_PVE ||
|
event.getXpGainReason() == XPGainReason.SHARED_PVE ||
|
||||||
event.getXpGainReason() == XPGainReason.SHARED_PVP)
|
event.getXpGainReason() == XPGainReason.SHARED_PVP) {
|
||||||
{
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
if (WorldGuardUtils.isWorldGuardLoaded())
|
if (!WorldGuardManager.getInstance().hasXPFlag(player)) {
|
||||||
{
|
|
||||||
if (!WorldGuardManager.getInstance().hasXPFlag(player))
|
|
||||||
{
|
|
||||||
event.setRawXpGained(0);
|
event.setRawXpGained(0);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
@ -112,19 +107,16 @@ public class SelfListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getXpGainReason() == XPGainReason.COMMAND)
|
if (event.getXpGainReason() == XPGainReason.COMMAND) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ExperienceConfig.getInstance().isEarlyGameBoostEnabled())
|
if (ExperienceConfig.getInstance().isEarlyGameBoostEnabled()) {
|
||||||
{
|
|
||||||
|
|
||||||
int earlyGameBonusXP = 0;
|
int earlyGameBonusXP = 0;
|
||||||
|
|
||||||
//Give some bonus XP for low levels
|
//Give some bonus XP for low levels
|
||||||
if (PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType))
|
if (PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType)) {
|
||||||
{
|
|
||||||
earlyGameBonusXP += (mcMMOPlayer.getXpToLevel(primarySkillType) * 0.05);
|
earlyGameBonusXP += (mcMMOPlayer.getXpToLevel(primarySkillType) * 0.05);
|
||||||
event.setRawXpGained(event.getRawXpGained() + earlyGameBonusXP);
|
event.setRawXpGained(event.getRawXpGained() + earlyGameBonusXP);
|
||||||
}
|
}
|
||||||
@ -167,12 +159,10 @@ public class SelfListener implements Listener {
|
|||||||
* Make sure players get a guaranteed minimum of XP
|
* Make sure players get a guaranteed minimum of XP
|
||||||
*/
|
*/
|
||||||
//If there is no guaranteed minimum proceed, otherwise only proceed if newValue would be higher than our guaranteed minimum
|
//If there is no guaranteed minimum proceed, otherwise only proceed if newValue would be higher than our guaranteed minimum
|
||||||
if (guaranteedMinimum <= 0 || newValue > guaranteedMinimum)
|
if (guaranteedMinimum <= 0 || newValue > guaranteedMinimum) {
|
||||||
{
|
|
||||||
if (newValue > 0) {
|
if (newValue > 0) {
|
||||||
event.setRawXpGained(newValue);
|
event.setRawXpGained(newValue);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -148,8 +148,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected mcMMO(JavaPluginLoader loader, PluginDescriptionFile description, File dataFolder, File file)
|
protected mcMMO(JavaPluginLoader loader, PluginDescriptionFile description, File dataFolder, File file) {
|
||||||
{
|
|
||||||
super(loader, description, dataFolder, file);
|
super(loader, description, dataFolder, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,8 +228,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
//Check for the newer API and tell them what to do if its missing
|
//Check for the newer API and tell them what to do if its missing
|
||||||
checkForOutdatedAPI();
|
checkForOutdatedAPI();
|
||||||
|
|
||||||
if (serverAPIOutdated)
|
if (serverAPIOutdated) {
|
||||||
{
|
|
||||||
foliaLib
|
foliaLib
|
||||||
.getImpl()
|
.getImpl()
|
||||||
.runTimer(
|
.runTimer(
|
||||||
@ -238,8 +236,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
20, 20*60*30
|
20, 20*60*30
|
||||||
);
|
);
|
||||||
|
|
||||||
if (platformManager.getServerSoftware() == ServerSoftwareType.CRAFT_BUKKIT)
|
if (platformManager.getServerSoftware() == ServerSoftwareType.CRAFT_BUKKIT) {
|
||||||
{
|
|
||||||
foliaLib
|
foliaLib
|
||||||
.getImpl()
|
.getImpl()
|
||||||
.runTimer(
|
.runTimer(
|
||||||
@ -295,8 +292,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
if (!(t instanceof ExceptionInInitializerError)) {
|
if (!(t instanceof ExceptionInInitializerError)) {
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
getLogger().info("Please do not replace the mcMMO jar while the server is running.");
|
getLogger().info("Please do not replace the mcMMO jar while the server is running.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,8 +346,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad()
|
public void onLoad() {
|
||||||
{
|
|
||||||
if (getServer().getPluginManager().getPlugin("WorldGuard") != null) {
|
if (getServer().getPluginManager().getPlugin("WorldGuard") != null) {
|
||||||
WorldGuardManager.getInstance().registerFlags();
|
WorldGuardManager.getInstance().registerFlags();
|
||||||
}
|
}
|
||||||
@ -638,8 +633,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
InteractionManager.initMaps(); //Init maps
|
InteractionManager.initMaps(); //Init maps
|
||||||
|
|
||||||
if (CoreSkillsConfig.getInstance().isPrimarySkillEnabled(PrimarySkillType.ACROBATICS))
|
if (CoreSkillsConfig.getInstance().isPrimarySkillEnabled(PrimarySkillType.ACROBATICS)) {
|
||||||
{
|
|
||||||
LogUtils.debug(mcMMO.p.getLogger(), "Enabling Acrobatics Skills");
|
LogUtils.debug(mcMMO.p.getLogger(), "Enabling Acrobatics Skills");
|
||||||
|
|
||||||
//TODO: Should do this differently
|
//TODO: Should do this differently
|
||||||
@ -674,8 +668,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
if (purgeIntervalTicks == 0) {
|
if (purgeIntervalTicks == 0) {
|
||||||
getFoliaLib().getImpl().runLaterAsync(new UserPurgeTask(), 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
getFoliaLib().getImpl().runLaterAsync(new UserPurgeTask(), 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
||||||
}
|
} else if (purgeIntervalTicks > 0) {
|
||||||
else if (purgeIntervalTicks > 0) {
|
|
||||||
getFoliaLib().getImpl().runTimerAsync(new UserPurgeTask(), purgeIntervalTicks, purgeIntervalTicks);
|
getFoliaLib().getImpl().runTimerAsync(new UserPurgeTask(), purgeIntervalTicks, purgeIntervalTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -698,8 +691,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
getFoliaLib().getImpl().runTimer(new ClearRegisteredXPGainTask(), 60, 60);
|
getFoliaLib().getImpl().runTimer(new ClearRegisteredXPGainTask(), 60, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mcMMO.p.getAdvancedConfig().allowPlayerTips())
|
if (mcMMO.p.getAdvancedConfig().allowPlayerTips()) {
|
||||||
{
|
|
||||||
getFoliaLib().getImpl().runTimer(new NotifySquelchReminderTask(), 60, ((20 * 60) * 60));
|
getFoliaLib().getImpl().runTimer(new NotifySquelchReminderTask(), 60, ((20 * 60) * 60));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,7 @@ public final class ShareHandler {
|
|||||||
|
|
||||||
for (Player member : nearMembers) {
|
for (Player member : nearMembers) {
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(member) == null)
|
if (UserManager.getPlayer(member) == null) {
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,8 +114,7 @@ public final class ShareHandler {
|
|||||||
McMMOPlayer mcMMOMember = UserManager.getPlayer(member);
|
McMMOPlayer mcMMOMember = UserManager.getPlayer(member);
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if (UserManager.getPlayer(member) == null)
|
if (UserManager.getPlayer(member) == null) {
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,11 +159,9 @@ public final class ShareHandler {
|
|||||||
public static XPGainReason getSharedXpGainReason(XPGainReason xpGainReason) {
|
public static XPGainReason getSharedXpGainReason(XPGainReason xpGainReason) {
|
||||||
if (xpGainReason == XPGainReason.PVE) {
|
if (xpGainReason == XPGainReason.PVE) {
|
||||||
return XPGainReason.SHARED_PVE;
|
return XPGainReason.SHARED_PVE;
|
||||||
}
|
} else if (xpGainReason == XPGainReason.PVP) {
|
||||||
else if (xpGainReason == XPGainReason.PVP) {
|
|
||||||
return XPGainReason.SHARED_PVP;
|
return XPGainReason.SHARED_PVP;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return xpGainReason;
|
return xpGainReason;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,13 +51,11 @@ public class CleanBackupsTask extends CancellableRunnable {
|
|||||||
if (isPast24Hours(date) && mcMMO.p.getGeneralConfig().getKeepLast24Hours()) {
|
if (isPast24Hours(date) && mcMMO.p.getGeneralConfig().getKeepLast24Hours()) {
|
||||||
// Keep all files from the last 24 hours
|
// Keep all files from the last 24 hours
|
||||||
continue;
|
continue;
|
||||||
}
|
} else if (isLastWeek(date) && !savedDays.contains(dayOfWeek) && mcMMO.p.getGeneralConfig().getKeepDailyLastWeek()) {
|
||||||
else if (isLastWeek(date) && !savedDays.contains(dayOfWeek) && mcMMO.p.getGeneralConfig().getKeepDailyLastWeek()) {
|
|
||||||
// Keep daily backups of the past week
|
// Keep daily backups of the past week
|
||||||
savedDays.add(dayOfWeek);
|
savedDays.add(dayOfWeek);
|
||||||
continue;
|
continue;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
List<Integer> savedWeeks = savedYearsWeeks.computeIfAbsent(year, k -> new ArrayList<>());
|
List<Integer> savedWeeks = savedYearsWeeks.computeIfAbsent(year, k -> new ArrayList<>());
|
||||||
|
|
||||||
if (!savedWeeks.contains(weekOfYear) && mcMMO.p.getGeneralConfig().getKeepWeeklyPastMonth()) {
|
if (!savedWeeks.contains(weekOfYear) && mcMMO.p.getGeneralConfig().getKeepWeeklyPastMonth()) {
|
||||||
|
@ -64,8 +64,7 @@ public class McrankCommandDisplayTask extends CancellableRunnable {
|
|||||||
public void displayBoard() {
|
public void displayBoard() {
|
||||||
if (sender.getName().equalsIgnoreCase(playerName)) {
|
if (sender.getName().equalsIgnoreCase(playerName)) {
|
||||||
ScoreboardManager.showPlayerRankScoreboard((Player) sender, skills);
|
ScoreboardManager.showPlayerRankScoreboard((Player) sender, skills);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ScoreboardManager.showPlayerRankScoreboardOthers((Player) sender, playerName, skills);
|
ScoreboardManager.showPlayerRankScoreboardOthers((Player) sender, playerName, skills);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,16 +54,13 @@ public class MctopCommandDisplayTask extends CancellableRunnable {
|
|||||||
if (skill == null) {
|
if (skill == null) {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
|
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sender.sendMessage(ChatColor.stripColor(LocaleLoader.getString("Commands.PowerLevel.Leaderboard")));
|
sender.sendMessage(ChatColor.stripColor(LocaleLoader.getString("Commands.PowerLevel.Leaderboard")));
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));
|
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sender.sendMessage(ChatColor.stripColor(LocaleLoader.getString("Commands.Skill.Leaderboard", mcMMO.p.getSkillTools().getLocalizedSkillName(skill))));
|
sender.sendMessage(ChatColor.stripColor(LocaleLoader.getString("Commands.Skill.Leaderboard", mcMMO.p.getSkillTools().getLocalizedSkillName(skill))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,8 +73,7 @@ public class MctopCommandDisplayTask extends CancellableRunnable {
|
|||||||
// 12. Playername - skill value
|
// 12. Playername - skill value
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
sender.sendMessage(String.format("%2d. %s%s - %s%s", place, ChatColor.GREEN, stat.name, ChatColor.WHITE, stat.statVal));
|
sender.sendMessage(String.format("%2d. %s%s - %s%s", place, ChatColor.GREEN, stat.name, ChatColor.WHITE, stat.statVal));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sender.sendMessage(String.format("%2d. %s - %s", place, stat.name, stat.statVal));
|
sender.sendMessage(String.format("%2d. %s - %s", place, stat.name, stat.statVal));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,8 +84,7 @@ public class MctopCommandDisplayTask extends CancellableRunnable {
|
|||||||
private void displayBoard() {
|
private void displayBoard() {
|
||||||
if (skill == null) {
|
if (skill == null) {
|
||||||
ScoreboardManager.showTopPowerScoreboard((Player) sender, page, userStats);
|
ScoreboardManager.showTopPowerScoreboard((Player) sender, page, userStats);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ScoreboardManager.showTopScoreboard((Player) sender, skill, page, userStats);
|
ScoreboardManager.showTopScoreboard((Player) sender, skill, page, userStats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,8 @@ public class NotifySquelchReminderTask extends CancellableRunnable {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
if (UserManager.getPlayer(player) != null)
|
if (UserManager.getPlayer(player) != null) {
|
||||||
{
|
if (!UserManager.getPlayer(player).useChatNotifications()) {
|
||||||
if (!UserManager.getPlayer(player).useChatNotifications())
|
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Reminder.Squelched"));
|
player.sendMessage(LocaleLoader.getString("Reminder.Squelched"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,7 @@ public class FormulaConversionTask extends CancellableRunnable {
|
|||||||
editValues(profile);
|
editValues(profile);
|
||||||
// Since this is a temporary profile, we save it here.
|
// Since this is a temporary profile, we save it here.
|
||||||
profile.scheduleAsyncSave();
|
profile.scheduleAsyncSave();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
profile = mcMMOPlayer.getProfile();
|
profile = mcMMOPlayer.getProfile();
|
||||||
editValues(profile);
|
editValues(profile);
|
||||||
}
|
}
|
||||||
|
@ -60,8 +60,7 @@ public class TeleportationWarmup extends CancellableRunnable {
|
|||||||
if (!Permissions.partyTeleportWorld(targetPlayer, targetWorld)) {
|
if (!Permissions.partyTeleportWorld(targetPlayer, targetWorld)) {
|
||||||
teleportingPlayer.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
teleportingPlayer.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
||||||
return;
|
return;
|
||||||
}
|
} else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(teleportingPlayer, targetWorld)) {
|
||||||
else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(teleportingPlayer, targetWorld)) {
|
|
||||||
teleportingPlayer.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
teleportingPlayer.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -58,8 +58,7 @@ public class PlayerProfileLoadingTask extends CancellableRunnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Print errors to console/logs if we're failing at least 2 times in a row to load the profile
|
// Print errors to console/logs if we're failing at least 2 times in a row to load the profile
|
||||||
if (attempt >= 3)
|
if (attempt >= 3) {
|
||||||
{
|
|
||||||
//Log the error
|
//Log the error
|
||||||
mcMMO.p.getLogger().severe(LocaleLoader.getString("Profile.Loading.FailureNotice",
|
mcMMO.p.getLogger().severe(LocaleLoader.getString("Profile.Loading.FailureNotice",
|
||||||
player.getName(), String.valueOf(attempt)));
|
player.getName(), String.valueOf(attempt)));
|
||||||
|
@ -9,8 +9,7 @@ public class BleedContainer {
|
|||||||
public LivingEntity target;
|
public LivingEntity target;
|
||||||
public LivingEntity damageSource;
|
public LivingEntity damageSource;
|
||||||
|
|
||||||
public BleedContainer(LivingEntity target, int bleedTicks, int bleedRank, int toolTier, LivingEntity damageSource)
|
public BleedContainer(LivingEntity target, int bleedTicks, int bleedRank, int toolTier, LivingEntity damageSource) {
|
||||||
{
|
|
||||||
this.target = target;
|
this.target = target;
|
||||||
this.bleedTicks = bleedTicks;
|
this.bleedTicks = bleedTicks;
|
||||||
this.bleedRank = bleedRank;
|
this.bleedRank = bleedRank;
|
||||||
|
@ -10,8 +10,7 @@ public class ExperienceBarHideTask extends CancellableRunnable {
|
|||||||
public final PrimarySkillType primarySkillType;
|
public final PrimarySkillType primarySkillType;
|
||||||
public final ExperienceBarManager experienceBarManagerRef;
|
public final ExperienceBarManager experienceBarManagerRef;
|
||||||
|
|
||||||
public ExperienceBarHideTask(ExperienceBarManager experienceBarManagerRef, McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType)
|
public ExperienceBarHideTask(ExperienceBarManager experienceBarManagerRef, McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType) {
|
||||||
{
|
|
||||||
this.experienceBarManagerRef = experienceBarManagerRef;
|
this.experienceBarManagerRef = experienceBarManagerRef;
|
||||||
this.mcMMOPlayer = mcMMOPlayer;
|
this.mcMMOPlayer = mcMMOPlayer;
|
||||||
this.primarySkillType = primarySkillType;
|
this.primarySkillType = primarySkillType;
|
||||||
|
@ -16,8 +16,7 @@ public class SkillUnlockNotificationTask extends CancellableRunnable {
|
|||||||
* @param subSkillType the subskill that they just unlocked
|
* @param subSkillType the subskill that they just unlocked
|
||||||
* @param rank the rank of the subskill
|
* @param rank the rank of the subskill
|
||||||
*/
|
*/
|
||||||
public SkillUnlockNotificationTask(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType, int rank)
|
public SkillUnlockNotificationTask(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType, int rank) {
|
||||||
{
|
|
||||||
this.mcMMOPlayer = mcMMOPlayer;
|
this.mcMMOPlayer = mcMMOPlayer;
|
||||||
this.subSkillType = subSkillType;
|
this.subSkillType = subSkillType;
|
||||||
this.rank = rank;
|
this.rank = rank;
|
||||||
|
@ -39,23 +39,19 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
private long rollXPIntervalLengthen = (1000 * 10); //10 Seconds
|
private long rollXPIntervalLengthen = (1000 * 10); //10 Seconds
|
||||||
private final BlockLocationHistory fallLocationMap;
|
private final BlockLocationHistory fallLocationMap;
|
||||||
|
|
||||||
public boolean hasFallenInLocationBefore(Location location)
|
public boolean hasFallenInLocationBefore(Location location) {
|
||||||
{
|
|
||||||
return fallLocationMap.contains(location);
|
return fallLocationMap.contains(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addLocationToFallMap(Location location)
|
public void addLocationToFallMap(Location location) {
|
||||||
{
|
|
||||||
fallLocationMap.add(location);
|
fallLocationMap.add(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canGainRollXP()
|
public boolean canGainRollXP() {
|
||||||
{
|
|
||||||
if (!ExperienceConfig.getInstance().isAcrobaticsExploitingPrevented())
|
if (!ExperienceConfig.getInstance().isAcrobaticsExploitingPrevented())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (System.currentTimeMillis() >= rollXPCooldown)
|
if (System.currentTimeMillis() >= rollXPCooldown) {
|
||||||
{
|
|
||||||
rollXPCooldown = System.currentTimeMillis() + rollXPInterval;
|
rollXPCooldown = System.currentTimeMillis() + rollXPInterval;
|
||||||
rollXPIntervalLengthen = (1000 * 10); //5 Seconds
|
rollXPIntervalLengthen = (1000 * 10); //5 Seconds
|
||||||
return true;
|
return true;
|
||||||
|
@ -93,8 +93,7 @@ public final class AlchemyPotionBrewer {
|
|||||||
if (!isEmpty(ingredient) && isValidIngredientByPlayer(player, ingredient)) {
|
if (!isEmpty(ingredient) && isValidIngredientByPlayer(player, ingredient)) {
|
||||||
if (ingredient.getAmount() <= 1) {
|
if (ingredient.getAmount() <= 1) {
|
||||||
inventory.setIngredient(null);
|
inventory.setIngredient(null);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ingredient.setAmount(ingredient.getAmount() - 1);
|
ingredient.setAmount(ingredient.getAmount() - 1);
|
||||||
inventory.setIngredient(ingredient);
|
inventory.setIngredient(ingredient);
|
||||||
}
|
}
|
||||||
@ -237,8 +236,7 @@ public final class AlchemyPotionBrewer {
|
|||||||
|
|
||||||
if (click.isLeftClick()) {
|
if (click.isLeftClick()) {
|
||||||
success = transferItems(view, fromSlot);
|
success = transferItems(view, fromSlot);
|
||||||
}
|
} else if (click.isRightClick()) {
|
||||||
else if (click.isRightClick()) {
|
|
||||||
success = transferOneItem(view, fromSlot);
|
success = transferOneItem(view, fromSlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,13 +256,11 @@ public final class AlchemyPotionBrewer {
|
|||||||
|
|
||||||
if (!emptyTo && fromAmount >= from.getType().getMaxStackSize()) {
|
if (!emptyTo && fromAmount >= from.getType().getMaxStackSize()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (emptyTo || from.isSimilar(to)) {
|
||||||
else if (emptyTo || from.isSimilar(to)) {
|
|
||||||
if (emptyTo) {
|
if (emptyTo) {
|
||||||
to = from.clone();
|
to = from.clone();
|
||||||
to.setAmount(1);
|
to.setAmount(1);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
to.setAmount(to.getAmount() + 1);
|
to.setAmount(to.getAmount() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,14 +283,12 @@ public final class AlchemyPotionBrewer {
|
|||||||
|
|
||||||
if (isEmpty(from)) {
|
if (isEmpty(from)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (isEmpty(to)) {
|
||||||
else if (isEmpty(to)) {
|
|
||||||
view.setItem(Alchemy.INGREDIENT_SLOT, from);
|
view.setItem(Alchemy.INGREDIENT_SLOT, from);
|
||||||
view.setItem(fromSlot, null);
|
view.setItem(fromSlot, null);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (from.isSimilar(to)) {
|
||||||
else if (from.isSimilar(to)) {
|
|
||||||
int fromAmount = from.getAmount();
|
int fromAmount = from.getAmount();
|
||||||
int toAmount = to.getAmount();
|
int toAmount = to.getAmount();
|
||||||
int maxSize = to.getType().getMaxStackSize();
|
int maxSize = to.getType().getMaxStackSize();
|
||||||
|
@ -64,8 +64,7 @@ public class Archery {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getSkillShotBonusDamage(Player player, double oldDamage)
|
public static double getSkillShotBonusDamage(Player player, double oldDamage) {
|
||||||
{
|
|
||||||
double damageBonusPercent = getDamageBonusPercent(player);
|
double damageBonusPercent = getDamageBonusPercent(player);
|
||||||
double newDamage = oldDamage + (oldDamage * damageBonusPercent);
|
double newDamage = oldDamage + (oldDamage * damageBonusPercent);
|
||||||
return Math.min(newDamage, (oldDamage + Archery.skillShotMaxBonusDamage));
|
return Math.min(newDamage, (oldDamage + Archery.skillShotMaxBonusDamage));
|
||||||
|
@ -43,8 +43,7 @@ public class Axes {
|
|||||||
* @param player The target player
|
* @param player The target player
|
||||||
* @return The axe mastery bonus damage which will be added to their attack
|
* @return The axe mastery bonus damage which will be added to their attack
|
||||||
*/
|
*/
|
||||||
public static double getAxeMasteryBonusDamage(Player player)
|
public static double getAxeMasteryBonusDamage(Player player) {
|
||||||
{
|
|
||||||
return RankUtils.getRank(player, SubSkillType.AXES_AXE_MASTERY) * Axes.axeMasteryRankDamageMultiplier;
|
return RankUtils.getRank(player, SubSkillType.AXES_AXE_MASTERY) * Axes.axeMasteryRankDamageMultiplier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,8 +101,7 @@ public class AxesManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
damage = (damage * Axes.criticalHitPVPModifier) - damage;
|
damage = (damage * Axes.criticalHitPVPModifier) - damage;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
damage = (damage * Axes.criticalHitPVEModifier) - damage;
|
damage = (damage * Axes.criticalHitPVEModifier) - damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,8 +88,7 @@ public class CrossbowsManager extends SkillManager {
|
|||||||
return RankUtils.getRank(mmoPlayer, SubSkillType.CROSSBOWS_TRICK_SHOT);
|
return RankUtils.getRank(mmoPlayer, SubSkillType.CROSSBOWS_TRICK_SHOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getPoweredShotBonusDamage(Player player, double oldDamage)
|
public double getPoweredShotBonusDamage(Player player, double oldDamage) {
|
||||||
{
|
|
||||||
double damageBonusPercent = getDamageBonusPercent(player);
|
double damageBonusPercent = getDamageBonusPercent(player);
|
||||||
double newDamage = oldDamage + (oldDamage * damageBonusPercent);
|
double newDamage = oldDamage + (oldDamage * damageBonusPercent);
|
||||||
return Math.min(newDamage, (oldDamage + mcMMO.p.getAdvancedConfig().getPoweredShotDamageMax()));
|
return Math.min(newDamage, (oldDamage + mcMMO.p.getAdvancedConfig().getPoweredShotDamageMax()));
|
||||||
|
@ -91,8 +91,7 @@ public class ExcavationManager extends SkillManager {
|
|||||||
return RankUtils.getRank(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY);
|
return RankUtils.getRank(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printExcavationDebug(Player player, BlockState blockState)
|
public void printExcavationDebug(Player player, BlockState blockState) {
|
||||||
{
|
|
||||||
if (Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
|
if (Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
|
||||||
List<ExcavationTreasure> treasures = Excavation.getTreasures(blockState);
|
List<ExcavationTreasure> treasures = Excavation.getTreasures(blockState);
|
||||||
|
|
||||||
|
@ -101,8 +101,7 @@ public class FishingManager extends SkillManager {
|
|||||||
// fishingRodCastTimestamp = System.currentTimeMillis();
|
// fishingRodCastTimestamp = System.currentTimeMillis();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public void setFishHookReference(FishHook fishHook)
|
public void setFishHookReference(FishHook fishHook) {
|
||||||
{
|
|
||||||
if (fishHook.getMetadata(MetadataConstants.METADATA_KEY_FISH_HOOK_REF).size() > 0)
|
if (fishHook.getMetadata(MetadataConstants.METADATA_KEY_FISH_HOOK_REF).size() > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -113,14 +112,12 @@ public class FishingManager extends SkillManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFishingTooOften()
|
public boolean isFishingTooOften() {
|
||||||
{
|
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
long fishHookSpawnCD = fishHookSpawnTimestamp + 1000;
|
long fishHookSpawnCD = fishHookSpawnTimestamp + 1000;
|
||||||
boolean hasFished = (currentTime < fishHookSpawnCD);
|
boolean hasFished = (currentTime < fishHookSpawnCD);
|
||||||
|
|
||||||
if (hasFished && (lastWarned + (1000) < currentTime))
|
if (hasFished && (lastWarned + (1000) < currentTime)) {
|
||||||
{
|
|
||||||
getPlayer().sendMessage(LocaleLoader.getString("Fishing.Scared"));
|
getPlayer().sendMessage(LocaleLoader.getString("Fishing.Scared"));
|
||||||
lastWarned = System.currentTimeMillis();
|
lastWarned = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
@ -134,8 +131,7 @@ public class FishingManager extends SkillManager {
|
|||||||
|
|
||||||
if (this.sameTarget) {
|
if (this.sameTarget) {
|
||||||
fishCaughtCounter++;
|
fishCaughtCounter++;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
fishCaughtCounter = 1;
|
fishCaughtCounter = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,8 +516,7 @@ public class FishingManager extends SkillManager {
|
|||||||
|
|
||||||
if (FishingTreasureConfig.getInstance().getInventoryStealStacks()) {
|
if (FishingTreasureConfig.getInstance().getInventoryStealStacks()) {
|
||||||
inventory.setItem(slot, null);
|
inventory.setItem(slot, null);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
inventory.setItem(slot, (drop.getAmount() > 1) ? new ItemStack(drop.getType(), drop.getAmount() - 1) : null);
|
inventory.setItem(slot, (drop.getAmount() > 1) ? new ItemStack(drop.getType(), drop.getAmount() - 1) : null);
|
||||||
drop.setAmount(1);
|
drop.setAmount(1);
|
||||||
}
|
}
|
||||||
@ -575,8 +570,7 @@ public class FishingManager extends SkillManager {
|
|||||||
if (getPlayer().getInventory().getItemInMainHand().getType() == Material.FISHING_ROD) {
|
if (getPlayer().getInventory().getItemInMainHand().getType() == Material.FISHING_ROD) {
|
||||||
luck = getPlayer().getInventory().getItemInMainHand().getEnchantmentLevel(
|
luck = getPlayer().getInventory().getItemInMainHand().getEnchantmentLevel(
|
||||||
mcMMO.p.getEnchantmentMapper().getLuckOfTheSea());
|
mcMMO.p.getEnchantmentMapper().getLuckOfTheSea());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// We know something was caught, so if the rod wasn't in the main hand it must be in the offhand
|
// We know something was caught, so if the rod wasn't in the main hand it must be in the offhand
|
||||||
luck = getPlayer().getInventory().getItemInOffHand().getEnchantmentLevel(
|
luck = getPlayer().getInventory().getItemInOffHand().getEnchantmentLevel(
|
||||||
mcMMO.p.getEnchantmentMapper().getLuckOfTheSea());
|
mcMMO.p.getEnchantmentMapper().getLuckOfTheSea());
|
||||||
|
@ -845,11 +845,9 @@ public class HerbalismManager extends SkillManager {
|
|||||||
|
|
||||||
if (greenTerra || greenThumbStage > 2) {
|
if (greenTerra || greenThumbStage > 2) {
|
||||||
finalAge = 2;
|
finalAge = 2;
|
||||||
}
|
} else if (greenThumbStage == 2) {
|
||||||
else if (greenThumbStage == 2) {
|
|
||||||
finalAge = 1;
|
finalAge = 1;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
finalAge = 0;
|
finalAge = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -858,8 +856,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
|
|
||||||
if (getGreenThumbStage(greenTerra) >= 2) {
|
if (getGreenThumbStage(greenTerra) >= 2) {
|
||||||
finalAge = 1;
|
finalAge = 1;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
finalAge = 0;
|
finalAge = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -62,8 +62,7 @@ public class BlastMining {
|
|||||||
return tier == Tier.EIGHT ? tier.getLevel() : tierList.get(tierList.indexOf(tier) - 1).getLevel();
|
return tier == Tier.EIGHT ? tier.getLevel() : tierList.get(tierList.indexOf(tier) - 1).getLevel();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
for(int i = 0; i < SubSkillType.MINING_BLAST_MINING.getNumRanks()-1; i++)
|
for(int i = 0; i < SubSkillType.MINING_BLAST_MINING.getNumRanks()-1; i++) {
|
||||||
{
|
|
||||||
if (getBlastDamageDecrease(i+1) > 0)
|
if (getBlastDamageDecrease(i+1) > 0)
|
||||||
return RankUtils.getRankUnlockLevel(SubSkillType.MINING_BLAST_MINING, i+1);
|
return RankUtils.getRankUnlockLevel(SubSkillType.MINING_BLAST_MINING, i+1);
|
||||||
}
|
}
|
||||||
@ -81,8 +80,7 @@ public class BlastMining {
|
|||||||
return tier == Tier.EIGHT ? tier.getLevel() : tierList.get(tierList.indexOf(tier) - 1).getLevel();
|
return tier == Tier.EIGHT ? tier.getLevel() : tierList.get(tierList.indexOf(tier) - 1).getLevel();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
for(int i = 0; i < SubSkillType.MINING_BLAST_MINING.getNumRanks()-1; i++)
|
for(int i = 0; i < SubSkillType.MINING_BLAST_MINING.getNumRanks()-1; i++) {
|
||||||
{
|
|
||||||
if (getBlastRadiusModifier(i+1) > 0)
|
if (getBlastRadiusModifier(i+1) > 0)
|
||||||
return RankUtils.getRankUnlockLevel(SubSkillType.MINING_BLAST_MINING, i+1);
|
return RankUtils.getRankUnlockLevel(SubSkillType.MINING_BLAST_MINING, i+1);
|
||||||
}
|
}
|
||||||
@ -102,8 +100,7 @@ public class BlastMining {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UserManager.getPlayer(defender) == null)
|
if (UserManager.getPlayer(defender) == null) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,8 +387,7 @@ public class RepairManager extends SkillManager {
|
|||||||
item.addUnsafeEnchantment(enchantment, enchantLevel - 1);
|
item.addUnsafeEnchantment(enchantment, enchantLevel - 1);
|
||||||
downgraded = true;
|
downgraded = true;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
item.removeEnchantment(enchantment);
|
item.removeEnchantment(enchantment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -397,11 +396,9 @@ public class RepairManager extends SkillManager {
|
|||||||
|
|
||||||
if (newEnchants.isEmpty()) {
|
if (newEnchants.isEmpty()) {
|
||||||
NotificationManager.sendPlayerInformationChatOnly(getPlayer(), "Repair.Arcane.Fail");
|
NotificationManager.sendPlayerInformationChatOnly(getPlayer(), "Repair.Arcane.Fail");
|
||||||
}
|
} else if (downgraded || newEnchants.size() < enchants.size()) {
|
||||||
else if (downgraded || newEnchants.size() < enchants.size()) {
|
|
||||||
NotificationManager.sendPlayerInformationChatOnly(getPlayer(), "Repair.Arcane.Downgrade");
|
NotificationManager.sendPlayerInformationChatOnly(getPlayer(), "Repair.Arcane.Downgrade");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
NotificationManager.sendPlayerInformationChatOnly(getPlayer(), "Repair.Arcane.Perfect");
|
NotificationManager.sendPlayerInformationChatOnly(getPlayer(), "Repair.Arcane.Perfect");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,8 +235,7 @@ public class SalvageManager extends SkillManager {
|
|||||||
|| ProbabilityUtil.isStaticSkillRNGSuccessful(
|
|| ProbabilityUtil.isStaticSkillRNGSuccessful(
|
||||||
PrimarySkillType.SALVAGE, mmoPlayer, getExtractFullEnchantChance())) {
|
PrimarySkillType.SALVAGE, mmoPlayer, getExtractFullEnchantChance())) {
|
||||||
enchantMeta.addStoredEnchant(enchant.getKey(), enchantLevel, true);
|
enchantMeta.addStoredEnchant(enchant.getKey(), enchantLevel, true);
|
||||||
}
|
} else if (enchantLevel > 1
|
||||||
else if (enchantLevel > 1
|
|
||||||
&& Salvage.arcaneSalvageDowngrades
|
&& Salvage.arcaneSalvageDowngrades
|
||||||
&& ProbabilityUtil.isStaticSkillRNGSuccessful(
|
&& ProbabilityUtil.isStaticSkillRNGSuccessful(
|
||||||
PrimarySkillType.SALVAGE, mmoPlayer, getExtractPartialEnchantChance())) {
|
PrimarySkillType.SALVAGE, mmoPlayer, getExtractPartialEnchantChance())) {
|
||||||
@ -247,12 +246,10 @@ public class SalvageManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (failedAllEnchants(arcaneFailureCount, enchants.entrySet().size()))
|
if (failedAllEnchants(arcaneFailureCount, enchants.entrySet().size())) {
|
||||||
{
|
|
||||||
NotificationManager.sendPlayerInformationChatOnly(player, "Salvage.Skills.ArcaneFailed");
|
NotificationManager.sendPlayerInformationChatOnly(player, "Salvage.Skills.ArcaneFailed");
|
||||||
return null;
|
return null;
|
||||||
} else if (downgraded)
|
} else if (downgraded) {
|
||||||
{
|
|
||||||
NotificationManager.sendPlayerInformationChatOnly(player, "Salvage.Skills.ArcanePartial");
|
NotificationManager.sendPlayerInformationChatOnly(player, "Salvage.Skills.ArcanePartial");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,8 +36,7 @@ public class SmeltingManager extends SkillManager {
|
|||||||
return Math.min(Short.MAX_VALUE, Math.max(1, burnTime * getFuelEfficiencyMultiplier()));
|
return Math.min(Short.MAX_VALUE, Math.max(1, burnTime * getFuelEfficiencyMultiplier()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFuelEfficiencyMultiplier()
|
public int getFuelEfficiencyMultiplier() {
|
||||||
{
|
|
||||||
return switch (RankUtils.getRank(getPlayer(), SubSkillType.SMELTING_FUEL_EFFICIENCY)) {
|
return switch (RankUtils.getRank(getPlayer(), SubSkillType.SMELTING_FUEL_EFFICIENCY)) {
|
||||||
case 1 -> 2;
|
case 1 -> 2;
|
||||||
case 2 -> 3;
|
case 2 -> 3;
|
||||||
|
@ -108,20 +108,17 @@ public class SwordsManager extends SkillManager {
|
|||||||
return RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE);
|
return RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getStabDamage()
|
public double getStabDamage() {
|
||||||
{
|
|
||||||
int rank = RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_STAB);
|
int rank = RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_STAB);
|
||||||
|
|
||||||
if (rank > 0)
|
if (rank > 0) {
|
||||||
{
|
|
||||||
return (1.0D + (rank * 1.5));
|
return (1.0D + (rank * 1.5));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getToolTier(@NotNull ItemStack itemStack)
|
public int getToolTier(@NotNull ItemStack itemStack) {
|
||||||
{
|
|
||||||
if (ItemUtils.isNetheriteTool(itemStack))
|
if (ItemUtils.isNetheriteTool(itemStack))
|
||||||
return 5;
|
return 5;
|
||||||
if (ItemUtils.isDiamondTool(itemStack))
|
if (ItemUtils.isDiamondTool(itemStack))
|
||||||
|
@ -279,10 +279,8 @@ public class TamingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void attackTarget(LivingEntity target) {
|
public void attackTarget(LivingEntity target) {
|
||||||
if (target instanceof Tameable tameable)
|
if (target instanceof Tameable tameable) {
|
||||||
{
|
if (tameable.getOwner() == getPlayer()) {
|
||||||
if (tameable.getOwner() == getPlayer())
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,7 @@ public class Unarmed {
|
|||||||
int amount = itemDrop.getAmount();
|
int amount = itemDrop.getAmount();
|
||||||
boolean grabbedItem = false;
|
boolean grabbedItem = false;
|
||||||
|
|
||||||
for(int i = 0; i <= storageContents.length-1; i++)
|
for(int i = 0; i <= storageContents.length-1; i++) {
|
||||||
{
|
|
||||||
if (amount <= 0)
|
if (amount <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -28,18 +27,14 @@ public class Unarmed {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
//EMPTY SLOT!
|
//EMPTY SLOT!
|
||||||
if (storageContents[i] == null)
|
if (storageContents[i] == null) {
|
||||||
{
|
|
||||||
player.getInventory().setItem(i, itemDrop);
|
player.getInventory().setItem(i, itemDrop);
|
||||||
amount = 0;
|
amount = 0;
|
||||||
grabbedItem = true;
|
grabbedItem = true;
|
||||||
break;
|
break;
|
||||||
}
|
} else if (itemDrop.isSimilar(storageContents[i]) && storageContents[i].getAmount() < storageContents[i].getMaxStackSize()) {
|
||||||
else if (itemDrop.isSimilar(storageContents[i]) && storageContents[i].getAmount() < storageContents[i].getMaxStackSize())
|
|
||||||
{
|
|
||||||
//If we can fit this whole itemstack into this item
|
//If we can fit this whole itemstack into this item
|
||||||
if (amount + storageContents[i].getAmount() <= storageContents[i].getMaxStackSize())
|
if (amount + storageContents[i].getAmount() <= storageContents[i].getMaxStackSize()) {
|
||||||
{
|
|
||||||
ItemStack modifiedAmount = storageContents[i];
|
ItemStack modifiedAmount = storageContents[i];
|
||||||
modifiedAmount.setAmount(amount + storageContents[i].getAmount());
|
modifiedAmount.setAmount(amount + storageContents[i].getAmount());
|
||||||
|
|
||||||
@ -68,8 +63,7 @@ public class Unarmed {
|
|||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
if (grabbedItem)
|
if (grabbedItem) {
|
||||||
{
|
|
||||||
SoundManager.sendSound(player, player.getLocation(), SoundType.POP);
|
SoundManager.sendSound(player, player.getLocation(), SoundType.POP);
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
}
|
}
|
||||||
|
@ -191,8 +191,7 @@ public class WoodcuttingManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Cover DOWN
|
// Cover DOWN
|
||||||
processTreeFellerTargetBlock(blockState.getBlock().getRelative(BlockFace.DOWN).getState(), futureCenterBlocks, treeFellerBlocks);
|
processTreeFellerTargetBlock(blockState.getBlock().getRelative(BlockFace.DOWN).getState(), futureCenterBlocks, treeFellerBlocks);
|
||||||
// Search in a cube
|
// Search in a cube
|
||||||
@ -282,8 +281,7 @@ public class WoodcuttingManager extends SkillManager {
|
|||||||
treeFellerBlocks.add(blockState);
|
treeFellerBlocks.add(blockState);
|
||||||
futureCenterBlocks.add(blockState);
|
futureCenterBlocks.add(blockState);
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (BlockUtils.isNonWoodPartOfTree(blockState)) {
|
||||||
else if (BlockUtils.isNonWoodPartOfTree(blockState)) {
|
|
||||||
treeFellerBlocks.add(blockState);
|
treeFellerBlocks.add(blockState);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -113,8 +113,7 @@ public final class ChimaeraWing {
|
|||||||
if (warmup > 0) {
|
if (warmup > 0) {
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Teleport.Commencing", String.valueOf(warmup));
|
NotificationManager.sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Teleport.Commencing", String.valueOf(warmup));
|
||||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new ChimaeraWingWarmup(mcMMOPlayer), 20 * warmup);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new ChimaeraWingWarmup(mcMMOPlayer), 20 * warmup);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
chimaeraExecuteTeleport();
|
chimaeraExecuteTeleport();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,14 +124,12 @@ public final class ChimaeraWing {
|
|||||||
if (mcMMO.p.getGeneralConfig().getChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) {
|
if (mcMMO.p.getGeneralConfig().getChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) {
|
||||||
// player.teleport(player.getBedSpawnLocation());
|
// player.teleport(player.getBedSpawnLocation());
|
||||||
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, player.getBedSpawnLocation());
|
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, player.getBedSpawnLocation());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Location spawnLocation = player.getWorld().getSpawnLocation();
|
Location spawnLocation = player.getWorld().getSpawnLocation();
|
||||||
if (spawnLocation.getBlock().getType() == Material.AIR) {
|
if (spawnLocation.getBlock().getType() == Material.AIR) {
|
||||||
// player.teleport(spawnLocation);
|
// player.teleport(spawnLocation);
|
||||||
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, spawnLocation);
|
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, spawnLocation);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// player.teleport(player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
|
// player.teleport(player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
|
||||||
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
|
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
|
||||||
}
|
}
|
||||||
|
@ -93,8 +93,7 @@ public final class EventUtils {
|
|||||||
* @param entity target entity
|
* @param entity target entity
|
||||||
* @return the associated McMMOPlayer for this entity
|
* @return the associated McMMOPlayer for this entity
|
||||||
*/
|
*/
|
||||||
public static McMMOPlayer getMcMMOPlayer(@NotNull Entity entity)
|
public static McMMOPlayer getMcMMOPlayer(@NotNull Entity entity) {
|
||||||
{
|
|
||||||
return UserManager.getPlayer((Player)entity);
|
return UserManager.getPlayer((Player)entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,8 +110,7 @@ public final class EventUtils {
|
|||||||
* @param entityDamageEvent
|
* @param entityDamageEvent
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean isRealPlayerDamaged(@NotNull EntityDamageEvent entityDamageEvent)
|
public static boolean isRealPlayerDamaged(@NotNull EntityDamageEvent entityDamageEvent) {
|
||||||
{
|
|
||||||
//Make sure the damage is above 0
|
//Make sure the damage is above 0
|
||||||
double damage = entityDamageEvent.getFinalDamage();
|
double damage = entityDamageEvent.getFinalDamage();
|
||||||
|
|
||||||
@ -143,8 +141,7 @@ public final class EventUtils {
|
|||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if (mcMMOPlayer == null)
|
if (mcMMOPlayer == null) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,8 +121,7 @@ public final class HardcoreManager {
|
|||||||
if (totalLevelsStolen > 0) {
|
if (totalLevelsStolen > 0) {
|
||||||
NotificationManager.sendPlayerInformation(killer, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Killer.Success", String.valueOf(totalLevelsStolen), victim.getName());
|
NotificationManager.sendPlayerInformation(killer, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Killer.Success", String.valueOf(totalLevelsStolen), victim.getName());
|
||||||
NotificationManager.sendPlayerInformation(victim, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Victim.Success", killer.getName(), String.valueOf(totalLevelsStolen));
|
NotificationManager.sendPlayerInformation(victim, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Victim.Success", killer.getName(), String.valueOf(totalLevelsStolen));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
NotificationManager.sendPlayerInformation(killer, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Killer.Failure", victim.getName());
|
NotificationManager.sendPlayerInformation(killer, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Killer.Failure", victim.getName());
|
||||||
NotificationManager.sendPlayerInformation(victim, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Victim.Failure", killer.getName());
|
NotificationManager.sendPlayerInformation(victim, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Victim.Failure", killer.getName());
|
||||||
}
|
}
|
||||||
|
@ -59,8 +59,7 @@ public class MaterialMapStore {
|
|||||||
private final @NotNull HashMap<String, Integer> tierValue;
|
private final @NotNull HashMap<String, Integer> tierValue;
|
||||||
|
|
||||||
|
|
||||||
public MaterialMapStore()
|
public MaterialMapStore() {
|
||||||
{
|
|
||||||
abilityBlackList = new HashSet<>();
|
abilityBlackList = new HashSet<>();
|
||||||
toolBlackList = new HashSet<>();
|
toolBlackList = new HashSet<>();
|
||||||
mossyWhiteList = new HashSet<>();
|
mossyWhiteList = new HashSet<>();
|
||||||
@ -133,8 +132,7 @@ public class MaterialMapStore {
|
|||||||
fillTierMap();
|
fillTierMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMultiBlockPlant(@NotNull Material material)
|
public boolean isMultiBlockPlant(@NotNull Material material) {
|
||||||
{
|
|
||||||
return multiBlockPlant.contains(material.getKey().getKey());
|
return multiBlockPlant.contains(material.getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,38 +140,31 @@ public class MaterialMapStore {
|
|||||||
return multiBlockHangingPlant.contains(material.getKey().getKey());
|
return multiBlockHangingPlant.contains(material.getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAbilityActivationBlackListed(@NotNull Material material)
|
public boolean isAbilityActivationBlackListed(@NotNull Material material) {
|
||||||
{
|
|
||||||
return abilityBlackList.contains(material.getKey().getKey());
|
return abilityBlackList.contains(material.getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isToolActivationBlackListed(@NotNull Material material)
|
public boolean isToolActivationBlackListed(@NotNull Material material) {
|
||||||
{
|
|
||||||
return toolBlackList.contains(material.getKey().getKey());
|
return toolBlackList.contains(material.getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMossyWhiteListed(@NotNull Material material)
|
public boolean isMossyWhiteListed(@NotNull Material material) {
|
||||||
{
|
|
||||||
return mossyWhiteList.contains(material.getKey().getKey());
|
return mossyWhiteList.contains(material.getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTreeFellerDestructible(@NotNull Material material)
|
public boolean isTreeFellerDestructible(@NotNull Material material) {
|
||||||
{
|
|
||||||
return treeFellerDestructibleWhiteList.contains(material.getKey().getKey());
|
return treeFellerDestructibleWhiteList.contains(material.getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHerbalismAbilityWhiteListed(@NotNull Material material)
|
public boolean isHerbalismAbilityWhiteListed(@NotNull Material material) {
|
||||||
{
|
|
||||||
return herbalismAbilityBlackList.contains(material.getKey().getKey());
|
return herbalismAbilityBlackList.contains(material.getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBlockCrackerWhiteListed(@NotNull Material material)
|
public boolean isBlockCrackerWhiteListed(@NotNull Material material) {
|
||||||
{
|
|
||||||
return blockCrackerWhiteList.contains(material.getKey().getKey());
|
return blockCrackerWhiteList.contains(material.getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShroomyWhiteListed(@NotNull Material material)
|
public boolean isShroomyWhiteListed(@NotNull Material material) {
|
||||||
{
|
|
||||||
return canMakeShroomyWhiteList.contains(material.getKey().getKey());
|
return canMakeShroomyWhiteList.contains(material.getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -993,8 +984,7 @@ public class MaterialMapStore {
|
|||||||
return foodItemWhiteList.contains(material.getKey().getKey());
|
return foodItemWhiteList.contains(material.getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillMultiBlockPlantSet()
|
private void fillMultiBlockPlantSet() {
|
||||||
{
|
|
||||||
//Multi-Block Plants
|
//Multi-Block Plants
|
||||||
multiBlockPlant.add("cactus");
|
multiBlockPlant.add("cactus");
|
||||||
multiBlockPlant.add("chorus_plant");
|
multiBlockPlant.add("chorus_plant");
|
||||||
@ -1014,30 +1004,26 @@ public class MaterialMapStore {
|
|||||||
multiBlockHangingPlant.add("cave_vines_plant");
|
multiBlockHangingPlant.add("cave_vines_plant");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillShroomyWhiteList()
|
private void fillShroomyWhiteList() {
|
||||||
{
|
|
||||||
canMakeShroomyWhiteList.add("dirt");
|
canMakeShroomyWhiteList.add("dirt");
|
||||||
canMakeShroomyWhiteList.add("grass_block");
|
canMakeShroomyWhiteList.add("grass_block");
|
||||||
canMakeShroomyWhiteList.add("dirt_path");
|
canMakeShroomyWhiteList.add("dirt_path");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillBlockCrackerWhiteList()
|
private void fillBlockCrackerWhiteList() {
|
||||||
{
|
|
||||||
blockCrackerWhiteList.add("stone_bricks");
|
blockCrackerWhiteList.add("stone_bricks");
|
||||||
blockCrackerWhiteList.add("infested_stone_bricks");
|
blockCrackerWhiteList.add("infested_stone_bricks");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillHerbalismAbilityBlackList()
|
private void fillHerbalismAbilityBlackList() {
|
||||||
{
|
|
||||||
herbalismAbilityBlackList.add("dirt");
|
herbalismAbilityBlackList.add("dirt");
|
||||||
herbalismAbilityBlackList.add("grass_block");
|
herbalismAbilityBlackList.add("grass_block");
|
||||||
herbalismAbilityBlackList.add("dirt_path");
|
herbalismAbilityBlackList.add("dirt_path");
|
||||||
herbalismAbilityBlackList.add("farmland");
|
herbalismAbilityBlackList.add("farmland");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillTreeFellerDestructibleWhiteList()
|
private void fillTreeFellerDestructibleWhiteList() {
|
||||||
{
|
|
||||||
treeFellerDestructibleWhiteList.add("oak_leaves");
|
treeFellerDestructibleWhiteList.add("oak_leaves");
|
||||||
treeFellerDestructibleWhiteList.add("cherry_leaves");
|
treeFellerDestructibleWhiteList.add("cherry_leaves");
|
||||||
treeFellerDestructibleWhiteList.add("acacia_leaves");
|
treeFellerDestructibleWhiteList.add("acacia_leaves");
|
||||||
@ -1055,8 +1041,7 @@ public class MaterialMapStore {
|
|||||||
treeFellerDestructibleWhiteList.add("red_mushroom_block");
|
treeFellerDestructibleWhiteList.add("red_mushroom_block");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillMossyWhiteList()
|
private void fillMossyWhiteList() {
|
||||||
{
|
|
||||||
mossyWhiteList.add("cobblestone");
|
mossyWhiteList.add("cobblestone");
|
||||||
mossyWhiteList.add("dirt");
|
mossyWhiteList.add("dirt");
|
||||||
mossyWhiteList.add("grass_path");
|
mossyWhiteList.add("grass_path");
|
||||||
@ -1064,8 +1049,7 @@ public class MaterialMapStore {
|
|||||||
mossyWhiteList.add("cobblestone_wall");
|
mossyWhiteList.add("cobblestone_wall");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillAbilityBlackList()
|
private void fillAbilityBlackList() {
|
||||||
{
|
|
||||||
abilityBlackList.add("warped_fence_gate");
|
abilityBlackList.add("warped_fence_gate");
|
||||||
abilityBlackList.add("crimson_fence_gate");
|
abilityBlackList.add("crimson_fence_gate");
|
||||||
abilityBlackList.add("warped_pressure_plate");
|
abilityBlackList.add("warped_pressure_plate");
|
||||||
@ -1192,8 +1176,7 @@ public class MaterialMapStore {
|
|||||||
abilityBlackList.add("respawn_anchor");
|
abilityBlackList.add("respawn_anchor");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillToolBlackList()
|
private void fillToolBlackList() {
|
||||||
{
|
|
||||||
toolBlackList.add("chiseled_bookshelf");
|
toolBlackList.add("chiseled_bookshelf");
|
||||||
toolBlackList.add("black_bed");
|
toolBlackList.add("black_bed");
|
||||||
toolBlackList.add("blue_bed");
|
toolBlackList.add("blue_bed");
|
||||||
@ -1371,8 +1354,7 @@ public class MaterialMapStore {
|
|||||||
return tierValue.getOrDefault(id, 1); //1 for unknown items
|
return tierValue.getOrDefault(id, 1); //1 for unknown items
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addToHashSet(@NotNull String string, @NotNull HashSet<String> stringHashSet)
|
private void addToHashSet(@NotNull String string, @NotNull HashSet<String> stringHashSet) {
|
||||||
{
|
|
||||||
stringHashSet.add(string.toLowerCase(Locale.ENGLISH));
|
stringHashSet.add(string.toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,8 +75,7 @@ public final class MobHealthbarUtils {
|
|||||||
if (updateName) {
|
if (updateName) {
|
||||||
target.setMetadata(MetadataConstants.METADATA_KEY_CUSTOM_NAME, new FixedMetadataValue(mcMMO.p, oldName));
|
target.setMetadata(MetadataConstants.METADATA_KEY_CUSTOM_NAME, new FixedMetadataValue(mcMMO.p, oldName));
|
||||||
target.setMetadata(MetadataConstants.METADATA_KEY_NAME_VISIBILITY, new FixedMetadataValue(mcMMO.p, oldNameVisible));
|
target.setMetadata(MetadataConstants.METADATA_KEY_NAME_VISIBILITY, new FixedMetadataValue(mcMMO.p, oldNameVisible));
|
||||||
}
|
} else if (!target.hasMetadata(MetadataConstants.METADATA_KEY_CUSTOM_NAME)) {
|
||||||
else if (!target.hasMetadata(MetadataConstants.METADATA_KEY_CUSTOM_NAME)) {
|
|
||||||
target.setMetadata(MetadataConstants.METADATA_KEY_CUSTOM_NAME, new FixedMetadataValue(mcMMO.p, ""));
|
target.setMetadata(MetadataConstants.METADATA_KEY_CUSTOM_NAME, new FixedMetadataValue(mcMMO.p, ""));
|
||||||
target.setMetadata(MetadataConstants.METADATA_KEY_NAME_VISIBILITY, new FixedMetadataValue(mcMMO.p, false));
|
target.setMetadata(MetadataConstants.METADATA_KEY_NAME_VISIBILITY, new FixedMetadataValue(mcMMO.p, false));
|
||||||
}
|
}
|
||||||
@ -106,20 +105,15 @@ public final class MobHealthbarUtils {
|
|||||||
|
|
||||||
if (healthPercentage >= 85) {
|
if (healthPercentage >= 85) {
|
||||||
color = ChatColor.DARK_GREEN;
|
color = ChatColor.DARK_GREEN;
|
||||||
}
|
} else if (healthPercentage >= 70) {
|
||||||
else if (healthPercentage >= 70) {
|
|
||||||
color = ChatColor.GREEN;
|
color = ChatColor.GREEN;
|
||||||
}
|
} else if (healthPercentage >= 55) {
|
||||||
else if (healthPercentage >= 55) {
|
|
||||||
color = ChatColor.GOLD;
|
color = ChatColor.GOLD;
|
||||||
}
|
} else if (healthPercentage >= 40) {
|
||||||
else if (healthPercentage >= 40) {
|
|
||||||
color = ChatColor.YELLOW;
|
color = ChatColor.YELLOW;
|
||||||
}
|
} else if (healthPercentage >= 25) {
|
||||||
else if (healthPercentage >= 25) {
|
|
||||||
color = ChatColor.RED;
|
color = ChatColor.RED;
|
||||||
}
|
} else if (healthPercentage >= 0) {
|
||||||
else if (healthPercentage >= 0) {
|
|
||||||
color = ChatColor.DARK_RED;
|
color = ChatColor.DARK_RED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,8 +215,7 @@ public class ModManager {
|
|||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
|
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
|
||||||
customEntity = customEntityClassMap.get(entity.getClass().getName());
|
customEntity = customEntityClassMap.get(entity.getClass().getName());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -256,8 +255,7 @@ public class ModManager {
|
|||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
|
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
|
||||||
className = entity.getClass().getName();
|
className = entity.getClass().getName();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,8 +118,7 @@ public class BitSetChunkStore implements ChunkStore {
|
|||||||
return world.getMinHeight();
|
return world.getMinHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getWorldMax(@NotNull UUID worldUid)
|
private static int getWorldMax(@NotNull UUID worldUid) {
|
||||||
{
|
|
||||||
World world = Bukkit.getWorld(worldUid);
|
World world = Bukkit.getWorld(worldUid);
|
||||||
|
|
||||||
// Not sure how this case could come up, but might as well handle it gracefully. Loading a chunkstore for an unloaded world?
|
// Not sure how this case could come up, but might as well handle it gracefully. Loading a chunkstore for an unloaded world?
|
||||||
@ -181,8 +180,7 @@ public class BitSetChunkStore implements ChunkStore {
|
|||||||
if (currentWorldMin > worldMin)
|
if (currentWorldMin > worldMin)
|
||||||
stored = stored.get(currentWorldMin, stored.length()); // Because BitSet's aren't fixed size, a "substring" operation is equivalent to a left shift
|
stored = stored.get(currentWorldMin, stored.length()); // Because BitSet's aren't fixed size, a "substring" operation is equivalent to a left shift
|
||||||
// Right shift store if world min has expanded
|
// Right shift store if world min has expanded
|
||||||
if (currentWorldMin < worldMin)
|
if (currentWorldMin < worldMin) {
|
||||||
{
|
|
||||||
int offset = (worldMin - currentWorldMin) * 16 * 16; // We are adding this many bits to the front
|
int offset = (worldMin - currentWorldMin) * 16 * 16; // We are adding this many bits to the front
|
||||||
// This isn't the most efficient way to do this, however, its a rare case to occur, and in the grand scheme of things, the small performance we could gain would cost us significant reduced readability of the code
|
// This isn't the most efficient way to do this, however, its a rare case to occur, and in the grand scheme of things, the small performance we could gain would cost us significant reduced readability of the code
|
||||||
BitSet shifted = new BitSet();
|
BitSet shifted = new BitSet();
|
||||||
@ -207,13 +205,12 @@ public class BitSetChunkStore implements ChunkStore {
|
|||||||
inputStream.mark(2);
|
inputStream.mark(2);
|
||||||
short magicNumber = inputStream.readShort();
|
short magicNumber = inputStream.readShort();
|
||||||
|
|
||||||
if (magicNumber == ObjectStreamConstants.STREAM_MAGIC) // Java serializable, use legacy serialization
|
// Java serializable, use legacy serialization
|
||||||
{
|
if (magicNumber == ObjectStreamConstants.STREAM_MAGIC) {
|
||||||
// "Un-read" the magic number for Serializables, they need it to still be in the stream
|
// "Un-read" the magic number for Serializables, they need it to still be in the stream
|
||||||
if (inputStream.markSupported())
|
if (inputStream.markSupported()) {
|
||||||
inputStream.reset(); // Pretend we never read those bytes
|
inputStream.reset(); // Pretend we never read those bytes
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
// Creates a new stream with the two magic number bytes and then the rest of the original stream... Java is so dumb. I just wanted to look at two bytes.
|
// Creates a new stream with the two magic number bytes and then the rest of the original stream... Java is so dumb. I just wanted to look at two bytes.
|
||||||
PushbackInputStream pushbackInputStream = new PushbackInputStream(inputStream, 2);
|
PushbackInputStream pushbackInputStream = new PushbackInputStream(inputStream, 2);
|
||||||
pushbackInputStream.unread((magicNumber) & 0xFF);
|
pushbackInputStream.unread((magicNumber) & 0xFF);
|
||||||
@ -221,9 +218,8 @@ public class BitSetChunkStore implements ChunkStore {
|
|||||||
inputStream = new DataInputStream(pushbackInputStream);
|
inputStream = new DataInputStream(pushbackInputStream);
|
||||||
}
|
}
|
||||||
return new LegacyDeserializationInputStream(inputStream).readLegacyChunkStore();
|
return new LegacyDeserializationInputStream(inputStream).readLegacyChunkStore();
|
||||||
}
|
} else if (magicNumber == STREAM_MAGIC) {
|
||||||
else if (magicNumber == STREAM_MAGIC) // Pure bytes format
|
// Pure bytes format
|
||||||
{
|
|
||||||
return BitSetChunkStore.deserialize(inputStream);
|
return BitSetChunkStore.deserialize(inputStream);
|
||||||
}
|
}
|
||||||
throw new IOException("Bad Data Format");
|
throw new IOException("Bad Data Format");
|
||||||
@ -238,8 +234,7 @@ public class BitSetChunkStore implements ChunkStore {
|
|||||||
|
|
||||||
// Handles loading the old serialized class
|
// Handles loading the old serialized class
|
||||||
private static class LegacyDeserializationInputStream extends ObjectInputStream {
|
private static class LegacyDeserializationInputStream extends ObjectInputStream {
|
||||||
private static class LegacyChunkStoreDeserializer implements Serializable
|
private static class LegacyChunkStoreDeserializer implements Serializable {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = -1L;
|
private static final long serialVersionUID = -1L;
|
||||||
|
|
||||||
private int cx;
|
private int cx;
|
||||||
@ -270,8 +265,7 @@ public class BitSetChunkStore implements ChunkStore {
|
|||||||
worldMax = store[0][0].length;
|
worldMax = store[0][0].length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull BitSetChunkStore convert()
|
public @NotNull BitSetChunkStore convert() {
|
||||||
{
|
|
||||||
int currentWorldMin = getWorldMin(worldUid);
|
int currentWorldMin = getWorldMin(worldUid);
|
||||||
int currentWorldMax = getWorldMax(worldUid);
|
int currentWorldMax = getWorldMax(worldUid);
|
||||||
|
|
||||||
|
@ -21,8 +21,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
@Override
|
@Override
|
||||||
public synchronized void closeAll() {
|
public synchronized void closeAll() {
|
||||||
// Save all dirty chunkstores
|
// Save all dirty chunkstores
|
||||||
for (ChunkStore chunkStore : chunkMap.values())
|
for (ChunkStore chunkStore : chunkMap.values()) {
|
||||||
{
|
|
||||||
if (!chunkStore.isDirty())
|
if (!chunkStore.isDirty())
|
||||||
continue;
|
continue;
|
||||||
World world = Bukkit.getWorld(chunkStore.getWorldId());
|
World world = Bukkit.getWorld(chunkStore.getWorldId());
|
||||||
@ -113,8 +112,8 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
CoordinateKey regionKey = toRegionKey(world.getUID(), cx, cz);
|
CoordinateKey regionKey = toRegionKey(world.getUID(), cx, cz);
|
||||||
HashSet<CoordinateKey> chunkKeys = chunkUsageMap.get(regionKey);
|
HashSet<CoordinateKey> chunkKeys = chunkUsageMap.get(regionKey);
|
||||||
chunkKeys.remove(chunkKey); // remove from region file in-use set
|
chunkKeys.remove(chunkKey); // remove from region file in-use set
|
||||||
if (chunkKeys.isEmpty()) // If it was last chunk in region, close the region file and remove it from memory
|
// If it was last chunk in region, close the region file and remove it from memory
|
||||||
{
|
if (chunkKeys.isEmpty()) {
|
||||||
chunkUsageMap.remove(regionKey);
|
chunkUsageMap.remove(regionKey);
|
||||||
regionMap.remove(regionKey).close();
|
regionMap.remove(regionKey).close();
|
||||||
}
|
}
|
||||||
@ -224,8 +223,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
ChunkStore cStore = chunkMap.computeIfAbsent(chunkKey, k -> {
|
ChunkStore cStore = chunkMap.computeIfAbsent(chunkKey, k -> {
|
||||||
// Load from file
|
// Load from file
|
||||||
ChunkStore loaded = loadChunk(chunkKey.x, chunkKey.z, world);
|
ChunkStore loaded = loadChunk(chunkKey.x, chunkKey.z, world);
|
||||||
if (loaded != null)
|
if (loaded != null) {
|
||||||
{
|
|
||||||
chunkUsageMap.computeIfAbsent(toRegionKey(chunkKey.worldID, chunkKey.x, chunkKey.z), j -> new HashSet<>()).add(chunkKey);
|
chunkUsageMap.computeIfAbsent(toRegionKey(chunkKey.worldID, chunkKey.x, chunkKey.z), j -> new HashSet<>()).add(chunkKey);
|
||||||
return loaded;
|
return loaded;
|
||||||
}
|
}
|
||||||
|
@ -181,8 +181,7 @@ public class McMMOSimpleRegionFile {
|
|||||||
int end = start + chunkNumSegments[index];
|
int end = start + chunkNumSegments[index];
|
||||||
|
|
||||||
// If we are writing, assert we don't write over any in-use segments
|
// If we are writing, assert we don't write over any in-use segments
|
||||||
if (inUse)
|
if (inUse) {
|
||||||
{
|
|
||||||
int nextSetBit = segments.nextSetBit(start);
|
int nextSetBit = segments.nextSetBit(start);
|
||||||
if (nextSetBit != -1 && nextSetBit < end)
|
if (nextSetBit != -1 && nextSetBit < end)
|
||||||
throw new IllegalStateException("Attempting to overwrite an in-use segment");
|
throw new IllegalStateException("Attempting to overwrite an in-use segment");
|
||||||
|
@ -265,8 +265,7 @@ public final class CommandUtils {
|
|||||||
if (matches.size() == 1) {
|
if (matches.size() == 1) {
|
||||||
partialName = matches.get(0);
|
partialName = matches.get(0);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Player player = mcMMO.p.getServer().getPlayer(partialName);
|
Player player = mcMMO.p.getServer().getPlayer(partialName);
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
@ -28,8 +28,7 @@ public class ExperienceBarManager {
|
|||||||
private HashSet<PrimarySkillType> alwaysVisible;
|
private HashSet<PrimarySkillType> alwaysVisible;
|
||||||
private HashSet<PrimarySkillType> disabledBars;
|
private HashSet<PrimarySkillType> disabledBars;
|
||||||
|
|
||||||
public ExperienceBarManager(McMMOPlayer mcMMOPlayer)
|
public ExperienceBarManager(McMMOPlayer mcMMOPlayer) {
|
||||||
{
|
|
||||||
this.mcMMOPlayer = mcMMOPlayer;
|
this.mcMMOPlayer = mcMMOPlayer;
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@ -44,8 +43,7 @@ public class ExperienceBarManager {
|
|||||||
disabledBars = new HashSet<>();
|
disabledBars = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateExperienceBar(PrimarySkillType primarySkillType, Plugin plugin)
|
public void updateExperienceBar(PrimarySkillType primarySkillType, Plugin plugin) {
|
||||||
{
|
|
||||||
if (disabledBars.contains(primarySkillType)
|
if (disabledBars.contains(primarySkillType)
|
||||||
|| !ExperienceConfig.getInstance().isExperienceBarsEnabled()
|
|| !ExperienceConfig.getInstance().isExperienceBarsEnabled()
|
||||||
|| !ExperienceConfig.getInstance().isExperienceBarEnabled(primarySkillType))
|
|| !ExperienceConfig.getInstance().isExperienceBarEnabled(primarySkillType))
|
||||||
@ -65,8 +63,7 @@ public class ExperienceBarManager {
|
|||||||
experienceBarWrapper.showExperienceBar();
|
experienceBarWrapper.showExperienceBar();
|
||||||
|
|
||||||
//Setup Hide Bar Task
|
//Setup Hide Bar Task
|
||||||
if (experienceBarHideTaskHashMap.get(primarySkillType) != null)
|
if (experienceBarHideTaskHashMap.get(primarySkillType) != null) {
|
||||||
{
|
|
||||||
experienceBarHideTaskHashMap.get(primarySkillType).cancel();
|
experienceBarHideTaskHashMap.get(primarySkillType).cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,14 +79,12 @@ public class ExperienceBarManager {
|
|||||||
experienceBarHideTaskHashMap.put(primarySkillType, experienceBarHideTask);
|
experienceBarHideTaskHashMap.put(primarySkillType, experienceBarHideTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideExperienceBar(PrimarySkillType primarySkillType)
|
public void hideExperienceBar(PrimarySkillType primarySkillType) {
|
||||||
{
|
|
||||||
if (experienceBars.containsKey(primarySkillType))
|
if (experienceBars.containsKey(primarySkillType))
|
||||||
experienceBars.get(primarySkillType).hideExperienceBar();
|
experienceBars.get(primarySkillType).hideExperienceBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearTask(PrimarySkillType primarySkillType)
|
public void clearTask(PrimarySkillType primarySkillType) {
|
||||||
{
|
|
||||||
experienceBarHideTaskHashMap.remove(primarySkillType);
|
experienceBarHideTaskHashMap.remove(primarySkillType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,8 +29,7 @@ public class ExperienceBarWrapper {
|
|||||||
protected String niceSkillName;
|
protected String niceSkillName;
|
||||||
protected String title;
|
protected String title;
|
||||||
|
|
||||||
public ExperienceBarWrapper(PrimarySkillType primarySkillType, McMMOPlayer mcMMOPlayer)
|
public ExperienceBarWrapper(PrimarySkillType primarySkillType, McMMOPlayer mcMMOPlayer) {
|
||||||
{
|
|
||||||
this.mcMMOPlayer = mcMMOPlayer;
|
this.mcMMOPlayer = mcMMOPlayer;
|
||||||
this.primarySkillType = primarySkillType;
|
this.primarySkillType = primarySkillType;
|
||||||
title = "";
|
title = "";
|
||||||
@ -43,8 +42,7 @@ public class ExperienceBarWrapper {
|
|||||||
initBar();
|
initBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initBar()
|
private void initBar() {
|
||||||
{
|
|
||||||
title = getTitleTemplate();
|
title = getTitleTemplate();
|
||||||
createBossBar();
|
createBossBar();
|
||||||
}
|
}
|
||||||
@ -115,8 +113,7 @@ public class ExperienceBarWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Every time progress updates we need to check for a title update
|
//Every time progress updates we need to check for a title update
|
||||||
if (getLevel() != lastLevelUpdated || ExperienceConfig.getInstance().getDoExperienceBarsAlwaysUpdateTitle())
|
if (getLevel() != lastLevelUpdated || ExperienceConfig.getInstance().getDoExperienceBarsAlwaysUpdateTitle()) {
|
||||||
{
|
|
||||||
updateTitle();
|
updateTitle();
|
||||||
lastLevelUpdated = getLevel();
|
lastLevelUpdated = getLevel();
|
||||||
}
|
}
|
||||||
@ -134,23 +131,19 @@ public class ExperienceBarWrapper {
|
|||||||
return bossBar.isVisible();
|
return bossBar.isVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideExperienceBar()
|
public void hideExperienceBar() {
|
||||||
{
|
|
||||||
bossBar.setVisible(false);
|
bossBar.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showExperienceBar()
|
public void showExperienceBar() {
|
||||||
{
|
|
||||||
bossBar.setVisible(true);
|
bossBar.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public NamespacedKey getKey()
|
/*public NamespacedKey getKey() {
|
||||||
{
|
|
||||||
return bossBar
|
return bossBar
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
private void createBossBar()
|
private void createBossBar() {
|
||||||
{
|
|
||||||
bossBar = mcMMOPlayer.getPlayer().getServer().createBossBar(
|
bossBar = mcMMOPlayer.getPlayer().getServer().createBossBar(
|
||||||
title,
|
title,
|
||||||
ExperienceConfig.getInstance().getExperienceBarColor(primarySkillType),
|
ExperienceConfig.getInstance().getExperienceBarColor(primarySkillType),
|
||||||
|
@ -135,8 +135,7 @@ public class FormulaManager {
|
|||||||
* @param formulaType target formulaType
|
* @param formulaType target formulaType
|
||||||
*/
|
*/
|
||||||
private int processXPToNextLevel(int level, FormulaType formulaType) {
|
private int processXPToNextLevel(int level, FormulaType formulaType) {
|
||||||
if (mcMMO.isRetroModeEnabled())
|
if (mcMMO.isRetroModeEnabled()) {
|
||||||
{
|
|
||||||
return processXPRetroToNextLevel(level, formulaType);
|
return processXPRetroToNextLevel(level, formulaType);
|
||||||
} else {
|
} else {
|
||||||
return processStandardXPToNextLevel(level, formulaType);
|
return processStandardXPToNextLevel(level, formulaType);
|
||||||
|
@ -80,15 +80,12 @@ public class PlatformManager {
|
|||||||
return ServerSoftwareType.CRAFT_BUKKIT;
|
return ServerSoftwareType.CRAFT_BUKKIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServerSoftwareType getServerSoftware()
|
public ServerSoftwareType getServerSoftware() {
|
||||||
{
|
|
||||||
return platform.getServerSoftwareType();
|
return platform.getServerSoftwareType();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getServerSoftwareStr()
|
public String getServerSoftwareStr() {
|
||||||
{
|
switch(getServerSoftware()) {
|
||||||
switch(getServerSoftware())
|
|
||||||
{
|
|
||||||
case PAPER:
|
case PAPER:
|
||||||
return "Paper";
|
return "Paper";
|
||||||
case SPIGOT:
|
case SPIGOT:
|
||||||
|
@ -43,8 +43,7 @@ public class NotificationManager {
|
|||||||
* @param notificationType notifications defined type
|
* @param notificationType notifications defined type
|
||||||
* @param key the locale key for the notifications defined message
|
* @param key the locale key for the notifications defined message
|
||||||
*/
|
*/
|
||||||
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key)
|
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key) {
|
||||||
{
|
|
||||||
if (UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
if (UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -59,8 +58,7 @@ public class NotificationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static boolean doesPlayerUseNotifications(Player player)
|
public static boolean doesPlayerUseNotifications(Player player) {
|
||||||
{
|
|
||||||
if (UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
@ -77,13 +75,11 @@ public class NotificationManager {
|
|||||||
* @param values values to be injected into the locale string
|
* @param values values to be injected into the locale string
|
||||||
*/
|
*/
|
||||||
public static void sendNearbyPlayersInformation(Player targetPlayer, NotificationType notificationType, String key,
|
public static void sendNearbyPlayersInformation(Player targetPlayer, NotificationType notificationType, String key,
|
||||||
String... values)
|
String... values) {
|
||||||
{
|
|
||||||
sendPlayerInformation(targetPlayer, notificationType, key, values);
|
sendPlayerInformation(targetPlayer, notificationType, key, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendPlayerInformationChatOnly(Player player, String key, String... values)
|
public static void sendPlayerInformationChatOnly(Player player, String key, String... values) {
|
||||||
{
|
|
||||||
if (UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
if (UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -91,8 +87,7 @@ public class NotificationManager {
|
|||||||
player.sendMessage(preColoredString);
|
player.sendMessage(preColoredString);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendPlayerInformationChatOnlyPrefixed(Player player, String key, String... values)
|
public static void sendPlayerInformationChatOnlyPrefixed(Player player, String key, String... values) {
|
||||||
{
|
|
||||||
if (UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
if (UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -102,8 +97,7 @@ public class NotificationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key,
|
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key,
|
||||||
String... values)
|
String... values) {
|
||||||
{
|
|
||||||
if (UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
if (UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -156,8 +150,7 @@ public class NotificationManager {
|
|||||||
* @param newLevel new level of that skill
|
* @param newLevel new level of that skill
|
||||||
*/
|
*/
|
||||||
public static void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkillType skillName,
|
public static void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkillType skillName,
|
||||||
int levelsGained, int newLevel)
|
int levelsGained, int newLevel) {
|
||||||
{
|
|
||||||
if (!mcMMOPlayer.useChatNotifications())
|
if (!mcMMOPlayer.useChatNotifications())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -176,16 +169,13 @@ public class NotificationManager {
|
|||||||
sendNotification(mcMMOPlayer.getPlayer(), customEvent);
|
sendNotification(mcMMOPlayer.getPlayer(), customEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void broadcastTitle(Server server, String title, String subtitle, int i1, int i2, int i3)
|
public static void broadcastTitle(Server server, String title, String subtitle, int i1, int i2, int i3) {
|
||||||
{
|
for(Player player : server.getOnlinePlayers()) {
|
||||||
for(Player player : server.getOnlinePlayers())
|
|
||||||
{
|
|
||||||
player.sendTitle(title, subtitle, i1, i2, i3);
|
player.sendTitle(title, subtitle, i1, i2, i3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendPlayerUnlockNotification(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType)
|
public static void sendPlayerUnlockNotification(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType) {
|
||||||
{
|
|
||||||
if (!mcMMOPlayer.useChatNotifications())
|
if (!mcMMOPlayer.useChatNotifications())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -208,10 +198,8 @@ public class NotificationManager {
|
|||||||
if (!mcMMO.p.getGeneralConfig().adminNotifications())
|
if (!mcMMO.p.getGeneralConfig().adminNotifications())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(Player player : Bukkit.getServer().getOnlinePlayers())
|
for(Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
{
|
if (player.isOp() || Permissions.adminChat(player)) {
|
||||||
if (player.isOp() || Permissions.adminChat(player))
|
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Notifications.Admin.Format.Others", msg));
|
player.sendMessage(LocaleLoader.getString("Notifications.Admin.Format.Others", msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,15 +229,13 @@ public class NotificationManager {
|
|||||||
*/
|
*/
|
||||||
String senderName = LocaleLoader.getString("Server.ConsoleName");
|
String senderName = LocaleLoader.getString("Server.ConsoleName");
|
||||||
|
|
||||||
if (commandSender instanceof Player)
|
if (commandSender instanceof Player) {
|
||||||
{
|
|
||||||
senderName = ((Player) commandSender).getDisplayName()
|
senderName = ((Player) commandSender).getDisplayName()
|
||||||
+ ChatColor.RESET + "-" + ((Player) commandSender).getUniqueId();
|
+ ChatColor.RESET + "-" + ((Player) commandSender).getUniqueId();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Send the notification
|
//Send the notification
|
||||||
switch(sensitiveCommandType)
|
switch(sensitiveCommandType) {
|
||||||
{
|
|
||||||
case XPRATE_MODIFY:
|
case XPRATE_MODIFY:
|
||||||
sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.Start.Others",
|
sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.Start.Others",
|
||||||
addItemToFirstPositionOfArray(senderName, args)));
|
addItemToFirstPositionOfArray(senderName, args)));
|
||||||
|
@ -30,8 +30,7 @@ public class PlayerLevelUtils {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public int getEarlyGameCutoff(PrimarySkillType primarySkillType)
|
public int getEarlyGameCutoff(PrimarySkillType primarySkillType) {
|
||||||
{
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,13 +84,11 @@ public final class UserManager {
|
|||||||
mcMMO.p.getLogger().info("Saving mcMMOPlayers... (" + trackedSyncData.size() + ")");
|
mcMMO.p.getLogger().info("Saving mcMMOPlayers... (" + trackedSyncData.size() + ")");
|
||||||
|
|
||||||
for (McMMOPlayer playerData : trackedSyncData) {
|
for (McMMOPlayer playerData : trackedSyncData) {
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
LogUtils.debug(mcMMO.p.getLogger(), "Saving data for player: "+playerData.getPlayerName());
|
LogUtils.debug(mcMMO.p.getLogger(), "Saving data for player: "+playerData.getPlayerName());
|
||||||
playerData.getProfile().save(true);
|
playerData.getProfile().save(true);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
mcMMO.p.getLogger().warning("Could not save mcMMO player data for player: " + playerData.getPlayerName());
|
mcMMO.p.getLogger().warning("Could not save mcMMO player data for player: " + playerData.getPlayerName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,8 +155,7 @@ public class ScoreboardManager {
|
|||||||
private static String formatAbility(ChatColor color, String abilityName) {
|
private static String formatAbility(ChatColor color, String abilityName) {
|
||||||
if (mcMMO.p.getGeneralConfig().getShowAbilityNames()) {
|
if (mcMMO.p.getGeneralConfig().getShowAbilityNames()) {
|
||||||
return getShortenedName(color + abilityName);
|
return getShortenedName(color + abilityName);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return color + LocaleLoader.getString("Scoreboard.Misc.Ability");
|
return color + LocaleLoader.getString("Scoreboard.Misc.Ability");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -553,8 +552,7 @@ public class ScoreboardManager {
|
|||||||
public static void changeScoreboard(ScoreboardWrapper wrapper, int displayTime) {
|
public static void changeScoreboard(ScoreboardWrapper wrapper, int displayTime) {
|
||||||
if (displayTime == -1) {
|
if (displayTime == -1) {
|
||||||
wrapper.showBoardWithNoRevert();
|
wrapper.showBoardWithNoRevert();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
wrapper.showBoardAndScheduleRevert(displayTime * Misc.TICK_CONVERSION_FACTOR);
|
wrapper.showBoardAndScheduleRevert(displayTime * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,8 +112,7 @@ public class ScoreboardWrapper {
|
|||||||
// Stop updating if it's no longer something displaying cooldowns
|
// Stop updating if it's no longer something displaying cooldowns
|
||||||
if (isBoardShown() && (isSkillScoreboard() || isCooldownScoreboard())) {
|
if (isBoardShown() && (isSkillScoreboard() || isCooldownScoreboard())) {
|
||||||
doSidebarUpdateSoon();
|
doSidebarUpdateSoon();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
stopCooldownUpdating();
|
stopCooldownUpdating();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,8 +178,7 @@ public class ScoreboardWrapper {
|
|||||||
if (mcMMO.p.getServer().getScoreboardManager() != null)
|
if (mcMMO.p.getServer().getScoreboardManager() != null)
|
||||||
this.oldBoard = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard();
|
this.oldBoard = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.oldBoard = previousBoard;
|
this.oldBoard = previousBoard;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -231,8 +229,7 @@ public class ScoreboardWrapper {
|
|||||||
if (!tippedKeep) {
|
if (!tippedKeep) {
|
||||||
tippedKeep = true;
|
tippedKeep = true;
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Tip.Keep"));
|
player.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Tip.Keep"));
|
||||||
}
|
} else if (!tippedClear) {
|
||||||
else if (!tippedClear) {
|
|
||||||
tippedClear = true;
|
tippedClear = true;
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Tip.Clear"));
|
player.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Tip.Clear"));
|
||||||
profile.increaseTipsShown();
|
profile.increaseTipsShown();
|
||||||
@ -257,8 +254,7 @@ public class ScoreboardWrapper {
|
|||||||
//Modify the player based on the event
|
//Modify the player based on the event
|
||||||
event.getTargetPlayer().setScoreboard(event.getTargetBoard());
|
event.getTargetPlayer().setScoreboard(event.getTargetBoard());
|
||||||
oldBoard = null;
|
oldBoard = null;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
LogUtils.debug(mcMMO.p.getLogger(), "Not reverting targetBoard for " + playerName + " - targetBoard was changed by another plugin (Consider disabling the mcMMO scoreboards if you don't want them!)");
|
LogUtils.debug(mcMMO.p.getLogger(), "Not reverting targetBoard for " + playerName + " - targetBoard was changed by another plugin (Consider disabling the mcMMO scoreboards if you don't want them!)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -493,8 +489,7 @@ public class ScoreboardWrapper {
|
|||||||
|
|
||||||
sidebarObjective.getScore(ScoreboardManager.LABEL_CURRENT_XP).setScore(currentXP);
|
sidebarObjective.getScore(ScoreboardManager.LABEL_CURRENT_XP).setScore(currentXP);
|
||||||
sidebarObjective.getScore(ScoreboardManager.LABEL_REMAINING_XP).setScore(mcMMOPlayer.getXpToLevel(targetSkill) - currentXP);
|
sidebarObjective.getScore(ScoreboardManager.LABEL_REMAINING_XP).setScore(mcMMOPlayer.getXpToLevel(targetSkill) - currentXP);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
for (PrimarySkillType parentSkill : mcMMO.p.getSkillTools().getChildSkillParents(targetSkill)) {
|
for (PrimarySkillType parentSkill : mcMMO.p.getSkillTools().getChildSkillParents(targetSkill)) {
|
||||||
sidebarObjective.getScore(ScoreboardManager.skillLabels.get(parentSkill)).setScore(mcMMOPlayer.getSkillLevel(parentSkill));
|
sidebarObjective.getScore(ScoreboardManager.skillLabels.get(parentSkill)).setScore(mcMMOPlayer.getSkillLevel(parentSkill));
|
||||||
}
|
}
|
||||||
@ -516,8 +511,7 @@ public class ScoreboardWrapper {
|
|||||||
cooldownBM.setScore(secondsBM);
|
cooldownBM.setScore(secondsBM);
|
||||||
|
|
||||||
stopUpdating = (secondsSB == 0 && secondsBM == 0);
|
stopUpdating = (secondsSB == 0 && secondsBM == 0);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
SuperAbilityType ability = mcMMO.p.getSkillTools().getSuperAbility(targetSkill);
|
SuperAbilityType ability = mcMMO.p.getSkillTools().getSuperAbility(targetSkill);
|
||||||
Score cooldown = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(ability));
|
Score cooldown = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(ability));
|
||||||
int seconds = Math.max(mcMMOPlayer.calculateTimeRemaining(ability), 0);
|
int seconds = Math.max(mcMMOPlayer.calculateTimeRemaining(ability), 0);
|
||||||
@ -529,8 +523,7 @@ public class ScoreboardWrapper {
|
|||||||
|
|
||||||
if (stopUpdating) {
|
if (stopUpdating) {
|
||||||
stopCooldownUpdating();
|
stopCooldownUpdating();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
startCooldownUpdating();
|
startCooldownUpdating();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -551,8 +544,7 @@ public class ScoreboardWrapper {
|
|||||||
|
|
||||||
if (anyCooldownsActive) {
|
if (anyCooldownsActive) {
|
||||||
startCooldownUpdating();
|
startCooldownUpdating();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
stopCooldownUpdating();
|
stopCooldownUpdating();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -563,11 +555,9 @@ public class ScoreboardWrapper {
|
|||||||
|
|
||||||
if (targetProfile != null) {
|
if (targetProfile != null) {
|
||||||
newProfile = targetProfile; // offline
|
newProfile = targetProfile; // offline
|
||||||
}
|
} else if (targetPlayer == null) {
|
||||||
else if (targetPlayer == null) {
|
|
||||||
newProfile = mcMMOPlayer.getProfile(); // self
|
newProfile = mcMMOPlayer.getProfile(); // self
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
newProfile = UserManager.getPlayer(targetPlayer).getProfile(); // online
|
newProfile = UserManager.getPlayer(targetPlayer).getProfile(); // online
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,8 +77,7 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Add Stab Damage
|
//Add Stab Damage
|
||||||
if (swordsManager.canUseStab())
|
if (swordsManager.canUseStab()) {
|
||||||
{
|
|
||||||
boostedDamage += (swordsManager.getStabDamage() * mcMMOPlayer.getAttackStrength());
|
boostedDamage += (swordsManager.getStabDamage() * mcMMOPlayer.getAttackStrength());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,8 +85,7 @@ public final class CombatUtils {
|
|||||||
swordsManager.serratedStrikes(target, event.getDamage());
|
swordsManager.serratedStrikes(target, event.getDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canUseLimitBreak(player, target, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK))
|
if (canUseLimitBreak(player, target, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) {
|
||||||
{
|
|
||||||
boostedDamage += (getLimitBreakDamage(player, target, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
boostedDamage += (getLimitBreakDamage(player, target, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,8 +262,7 @@ public final class CombatUtils {
|
|||||||
|
|
||||||
if (axesManager.canImpact(target)) {
|
if (axesManager.canImpact(target)) {
|
||||||
axesManager.impactCheck(target);
|
axesManager.impactCheck(target);
|
||||||
}
|
} else if (axesManager.canGreaterImpact(target)) {
|
||||||
else if (axesManager.canGreaterImpact(target)) {
|
|
||||||
boostedDamage+=axesManager.greaterImpact(target);
|
boostedDamage+=axesManager.greaterImpact(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,8 +274,7 @@ public final class CombatUtils {
|
|||||||
boostedDamage+=(axesManager.criticalHit(target, boostedDamage) * mcMMOPlayer.getAttackStrength());
|
boostedDamage+=(axesManager.criticalHit(target, boostedDamage) * mcMMOPlayer.getAttackStrength());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canUseLimitBreak(player, target, SubSkillType.AXES_AXES_LIMIT_BREAK))
|
if (canUseLimitBreak(player, target, SubSkillType.AXES_AXES_LIMIT_BREAK)) {
|
||||||
{
|
|
||||||
boostedDamage+=(getLimitBreakDamage(player, target, SubSkillType.AXES_AXES_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
boostedDamage+=(getLimitBreakDamage(player, target, SubSkillType.AXES_AXES_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,8 +316,7 @@ public final class CombatUtils {
|
|||||||
unarmedManager.disarmCheck((Player) target);
|
unarmedManager.disarmCheck((Player) target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canUseLimitBreak(player, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK))
|
if (canUseLimitBreak(player, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) {
|
||||||
{
|
|
||||||
boostedDamage+=(getLimitBreakDamage(player, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
boostedDamage+=(getLimitBreakDamage(player, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,8 +389,7 @@ public final class CombatUtils {
|
|||||||
archeryManager.retrieveArrows(target, arrow);
|
archeryManager.retrieveArrows(target, arrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canUseLimitBreak(player, target, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK))
|
if (canUseLimitBreak(player, target, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) {
|
||||||
{
|
|
||||||
boostedDamage+=getLimitBreakDamage(player, target, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK);
|
boostedDamage+=getLimitBreakDamage(player, target, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,8 +488,7 @@ public final class CombatUtils {
|
|||||||
processSwordCombat(target, player, event);
|
processSwordCombat(target, player, event);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
} else if (ItemUtils.isAxe(heldItem)) {
|
||||||
else if (ItemUtils.isAxe(heldItem)) {
|
|
||||||
if (!mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.AXES, target)) {
|
if (!mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.AXES, target)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -503,8 +496,7 @@ public final class CombatUtils {
|
|||||||
if (mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.AXES)) {
|
if (mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.AXES)) {
|
||||||
processAxeCombat(target, player, event);
|
processAxeCombat(target, player, event);
|
||||||
}
|
}
|
||||||
}
|
} else if (ItemUtils.isUnarmed(heldItem)) {
|
||||||
else if (ItemUtils.isUnarmed(heldItem)) {
|
|
||||||
if (!mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.UNARMED, target)) {
|
if (!mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.UNARMED, target)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -512,8 +504,7 @@ public final class CombatUtils {
|
|||||||
if (mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.UNARMED)) {
|
if (mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.UNARMED)) {
|
||||||
processUnarmedCombat(target, player, event);
|
processUnarmedCombat(target, player, event);
|
||||||
}
|
}
|
||||||
}
|
} else if (ItemUtils.isTrident(heldItem)) {
|
||||||
else if (ItemUtils.isTrident(heldItem)) {
|
|
||||||
if (!mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.TRIDENTS, target)) {
|
if (!mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.TRIDENTS, target)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -521,8 +512,7 @@ public final class CombatUtils {
|
|||||||
if (mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.TRIDENTS)) {
|
if (mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.TRIDENTS)) {
|
||||||
processTridentCombatMelee(target, player, event);
|
processTridentCombatMelee(target, player, event);
|
||||||
}
|
}
|
||||||
}
|
} else if (ItemUtils.isMace(heldItem)) {
|
||||||
else if (ItemUtils.isMace(heldItem)) {
|
|
||||||
if (!mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.MACES, target)) {
|
if (!mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.MACES, target)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -543,8 +533,7 @@ public final class CombatUtils {
|
|||||||
processTamingCombat(target, master, wolf, event);
|
processTamingCombat(target, master, wolf, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (painSource instanceof Trident trident) {
|
||||||
else if (painSource instanceof Trident trident) {
|
|
||||||
ProjectileSource projectileSource = trident.getShooter();
|
ProjectileSource projectileSource = trident.getShooter();
|
||||||
|
|
||||||
if (projectileSource instanceof Player player) {
|
if (projectileSource instanceof Player player) {
|
||||||
@ -554,8 +543,7 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (painSource instanceof Arrow arrow) {
|
||||||
else if (painSource instanceof Arrow arrow) {
|
|
||||||
ProjectileSource projectileSource = arrow.getShooter();
|
ProjectileSource projectileSource = arrow.getShooter();
|
||||||
boolean isCrossbow = arrow.isShotFromCrossbow();
|
boolean isCrossbow = arrow.isShotFromCrossbow();
|
||||||
if (projectileSource instanceof Player player) {
|
if (projectileSource instanceof Player player) {
|
||||||
@ -590,8 +578,7 @@ public final class CombatUtils {
|
|||||||
* This cleans up names from displaying in chat as hearts
|
* This cleans up names from displaying in chat as hearts
|
||||||
* @param entity target entity
|
* @param entity target entity
|
||||||
*/
|
*/
|
||||||
public static void fixNames(@NotNull LivingEntity entity)
|
public static void fixNames(@NotNull LivingEntity entity) {
|
||||||
{
|
|
||||||
List<MetadataValue> metadataValue = entity.getMetadata(MetadataConstants.METADATA_KEY_OLD_NAME_KEY);
|
List<MetadataValue> metadataValue = entity.getMetadata(MetadataConstants.METADATA_KEY_OLD_NAME_KEY);
|
||||||
|
|
||||||
if (metadataValue.size() <= 0)
|
if (metadataValue.size() <= 0)
|
||||||
@ -887,37 +874,27 @@ public final class CombatUtils {
|
|||||||
&& SkillUtils.cooldownExpired(mcMMOPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)) {
|
&& SkillUtils.cooldownExpired(mcMMOPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)) {
|
||||||
baseXP = 20 * ExperienceConfig.getInstance().getPlayerVersusPlayerXP();
|
baseXP = 20 * ExperienceConfig.getInstance().getPlayerVersusPlayerXP();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (mcMMO.getModManager().isCustomEntity(target)) {
|
if (mcMMO.getModManager().isCustomEntity(target)) {
|
||||||
baseXP = mcMMO.getModManager().getEntity(target).getXpMultiplier();
|
baseXP = mcMMO.getModManager().getEntity(target).getXpMultiplier();
|
||||||
}
|
} else if (target instanceof Animals) {
|
||||||
else if (target instanceof Animals) {
|
|
||||||
EntityType type = target.getType();
|
EntityType type = target.getType();
|
||||||
baseXP = ExperienceConfig.getInstance().getAnimalsXP(type);
|
baseXP = ExperienceConfig.getInstance().getAnimalsXP(type);
|
||||||
}
|
} else if (target instanceof Monster) {
|
||||||
else if (target instanceof Monster)
|
|
||||||
{
|
|
||||||
EntityType type = target.getType();
|
EntityType type = target.getType();
|
||||||
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
|
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
EntityType type = target.getType();
|
EntityType type = target.getType();
|
||||||
|
|
||||||
if (ExperienceConfig.getInstance().hasCombatXP(type)) {
|
if (ExperienceConfig.getInstance().hasCombatXP(type)) {
|
||||||
if (type == EntityType.IRON_GOLEM)
|
if (type == EntityType.IRON_GOLEM) {
|
||||||
{
|
|
||||||
if (!((IronGolem) target).isPlayerCreated()) {
|
if (!((IronGolem) target).isPlayerCreated()) {
|
||||||
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
|
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
|
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
baseXP = 1.0;
|
baseXP = 1.0;
|
||||||
mcMMO.getModManager().addCustomEntity(target);
|
mcMMO.getModManager().addCustomEntity(target);
|
||||||
}
|
}
|
||||||
@ -1036,22 +1013,17 @@ public final class CombatUtils {
|
|||||||
|
|
||||||
if (ItemUtils.isWoodTool(inHand)) {
|
if (ItemUtils.isWoodTool(inHand)) {
|
||||||
tier = 1;
|
tier = 1;
|
||||||
}
|
} else if (ItemUtils.isStoneTool(inHand)) {
|
||||||
else if (ItemUtils.isStoneTool(inHand)) {
|
|
||||||
tier = 2;
|
tier = 2;
|
||||||
}
|
} else if (ItemUtils.isIronTool(inHand)) {
|
||||||
else if (ItemUtils.isIronTool(inHand)) {
|
|
||||||
tier = 3;
|
tier = 3;
|
||||||
}
|
} else if (ItemUtils.isGoldTool(inHand)) {
|
||||||
else if (ItemUtils.isGoldTool(inHand)) {
|
|
||||||
tier = 1;
|
tier = 1;
|
||||||
}
|
} else if (ItemUtils.isDiamondTool(inHand)) {
|
||||||
else if (ItemUtils.isDiamondTool(inHand)) {
|
|
||||||
tier = 4;
|
tier = 4;
|
||||||
} else if (ItemUtils.isNetheriteTool(inHand)) {
|
} else if (ItemUtils.isNetheriteTool(inHand)) {
|
||||||
tier = 5;
|
tier = 5;
|
||||||
}
|
} else if (mcMMO.getModManager().isCustomTool(inHand)) {
|
||||||
else if (mcMMO.getModManager().isCustomTool(inHand)) {
|
|
||||||
tier = mcMMO.getModManager().getTool(inHand).getTier();
|
tier = mcMMO.getModManager().getTool(inHand).getTier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,11 +19,9 @@ public final class PerksUtils {
|
|||||||
public static int handleCooldownPerks(Player player, int cooldown) {
|
public static int handleCooldownPerks(Player player, int cooldown) {
|
||||||
if (Permissions.halvedCooldowns(player)) {
|
if (Permissions.halvedCooldowns(player)) {
|
||||||
cooldown *= 0.5;
|
cooldown *= 0.5;
|
||||||
}
|
} else if (Permissions.thirdedCooldowns(player)) {
|
||||||
else if (Permissions.thirdedCooldowns(player)) {
|
|
||||||
cooldown *= (2.0 / 3.0);
|
cooldown *= (2.0 / 3.0);
|
||||||
}
|
} else if (Permissions.quarteredCooldowns(player)) {
|
||||||
else if (Permissions.quarteredCooldowns(player)) {
|
|
||||||
cooldown *= 0.75;
|
cooldown *= 0.75;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,11 +35,9 @@ public final class PerksUtils {
|
|||||||
|
|
||||||
if (Permissions.twelveSecondActivationBoost(player)) {
|
if (Permissions.twelveSecondActivationBoost(player)) {
|
||||||
ticks += 12;
|
ticks += 12;
|
||||||
}
|
} else if (Permissions.eightSecondActivationBoost(player)) {
|
||||||
else if (Permissions.eightSecondActivationBoost(player)) {
|
|
||||||
ticks += 8;
|
ticks += 8;
|
||||||
}
|
} else if (Permissions.fourSecondActivationBoost(player)) {
|
||||||
else if (Permissions.fourSecondActivationBoost(player)) {
|
|
||||||
ticks += 4;
|
ticks += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,26 +55,19 @@ public final class PerksUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
modifier = ExperienceConfig.getInstance().getCustomXpPerkBoost();
|
modifier = ExperienceConfig.getInstance().getCustomXpPerkBoost();
|
||||||
}
|
} else if (Permissions.quadrupleXp(player, skill)) {
|
||||||
else if (Permissions.quadrupleXp(player, skill)) {
|
|
||||||
modifier = 4;
|
modifier = 4;
|
||||||
}
|
} else if (Permissions.tripleXp(player, skill)) {
|
||||||
else if (Permissions.tripleXp(player, skill)) {
|
|
||||||
modifier = 3;
|
modifier = 3;
|
||||||
}
|
} else if (Permissions.doubleAndOneHalfXp(player, skill)) {
|
||||||
else if (Permissions.doubleAndOneHalfXp(player, skill)) {
|
|
||||||
modifier = 2.5;
|
modifier = 2.5;
|
||||||
}
|
} else if (Permissions.doubleXp(player, skill)) {
|
||||||
else if (Permissions.doubleXp(player, skill)) {
|
|
||||||
modifier = 2;
|
modifier = 2;
|
||||||
}
|
} else if (Permissions.oneAndOneHalfXp(player, skill)) {
|
||||||
else if (Permissions.oneAndOneHalfXp(player, skill)) {
|
|
||||||
modifier = 1.5;
|
modifier = 1.5;
|
||||||
}
|
} else if (Permissions.oneAndAQuarterXp(player, skill)) {
|
||||||
else if (Permissions.oneAndAQuarterXp(player, skill)) {
|
|
||||||
modifier = 1.25;
|
modifier = 1.25;
|
||||||
}
|
} else if (Permissions.oneAndOneTenthXp(player, skill)) {
|
||||||
else if (Permissions.oneAndOneTenthXp(player, skill)) {
|
|
||||||
modifier = 1.1;
|
modifier = 1.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user