clean up if/else formatting

This commit is contained in:
nossr50 2024-05-19 14:09:00 -07:00
parent 7266563ca9
commit d0ab2bdb2f
107 changed files with 526 additions and 1038 deletions

View File

@ -1143,14 +1143,10 @@ public final class ExperienceAPI {
* @param blockStates the blocks to reward XP for
* @param mcMMOPlayer the target player
*/
public static void addXpFromBlocks(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer)
{
for(BlockState bs : blockStates)
{
for(PrimarySkillType skillType : PrimarySkillType.values())
{
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
{
public static void addXpFromBlocks(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer) {
for(BlockState bs : blockStates) {
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);
}
}
@ -1163,12 +1159,9 @@ public final class ExperienceAPI {
* @param mcMMOPlayer the target player
* @param skillType target primary skill
*/
public static void addXpFromBlocksBySkill(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType)
{
for(BlockState bs : blockStates)
{
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
{
public static void addXpFromBlocksBySkill(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) {
for(BlockState bs : blockStates) {
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0) {
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 mcMMOPlayer The target player
*/
public static void addXpFromBlock(BlockState blockState, McMMOPlayer mcMMOPlayer)
{
for(PrimarySkillType skillType : PrimarySkillType.values())
{
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
{
public static void addXpFromBlock(BlockState blockState, McMMOPlayer mcMMOPlayer) {
for(PrimarySkillType skillType : PrimarySkillType.values()) {
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0) {
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 skillType target primary skill
*/
public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType)
{
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
{
public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) {
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0) {
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
}
}

View File

@ -109,8 +109,7 @@ public final class PartyAPI {
if (party == null) {
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
} 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());
return;
}
@ -124,8 +123,7 @@ public final class PartyAPI {
* 0 or less for no size limit
* @return the max party size on this server
*/
public static int getMaxPartySize()
{
public static int getMaxPartySize() {
return mcMMO.p.getGeneralConfig().getPartyMaxSize();
}

View File

@ -200,14 +200,11 @@ public class McImportCommand implements CommandExecutor {
String skillName = "UNIDENTIFIED";
if (materialName.contains("ORE")) {
skillName = "Mining";
}
else if (materialName.contains("LOG") || materialName.contains("LEAVES")) {
} else if (materialName.contains("LOG") || materialName.contains("LEAVES")) {
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";
}
else if (materialName.contains("DIRT") || materialName.contains("SAND")) {
} else if (materialName.contains("DIRT") || materialName.contains("SAND")) {
skillName = "Excavation";
}
@ -222,8 +219,7 @@ public class McImportCommand implements CommandExecutor {
if (skillName.equals("Mining")) {
skillContents.add(" " + " " + "Smelting_XP_Gain: 9");
}
else if (skillName.equals("Woodcutting")) {
} else if (skillName.equals("Woodcutting")) {
skillContents.add(" " + " " + "Is_Log: " + materialName.contains("LOG"));
}
}
@ -239,20 +235,15 @@ public class McImportCommand implements CommandExecutor {
String toolType = "UNIDENTIFIED";
if (materialName.contains("PICKAXE")) {
toolType = "Pickaxes";
}
else if (materialName.contains("AXE")) {
} else if (materialName.contains("AXE")) {
toolType = "Axes";
}
else if (materialName.contains("BOW")) {
} else if (materialName.contains("BOW")) {
toolType = "Bows";
}
else if (materialName.contains("HOE")) {
} else if (materialName.contains("HOE")) {
toolType = "Hoes";
}
else if (materialName.contains("SHOVEL") || materialName.contains("SPADE")) {
} else if (materialName.contains("SHOVEL") || materialName.contains("SPADE")) {
toolType = "Shovels";
}
else if (materialName.contains("SWORD")) {
} else if (materialName.contains("SWORD")) {
toolType = "Swords";
}
@ -279,14 +270,11 @@ public class McImportCommand implements CommandExecutor {
String toolType = "UNIDENTIFIED";
if (materialName.contains("BOOT") || materialName.contains("SHOE")) {
toolType = "Boots";
}
else if (materialName.contains("CHESTPLATE") || materialName.contains("CHEST")) {
} else if (materialName.contains("CHESTPLATE") || materialName.contains("CHEST")) {
toolType = "Chestplates";
}
else if (materialName.contains("HELM") || materialName.contains("HAT")) {
} else if (materialName.contains("HELM") || materialName.contains("HAT")) {
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";
}

View File

@ -37,16 +37,14 @@ public class XprateCommand implements TabExecutor {
if (mcMMO.p.isXPEventEnabled()) {
if (mcMMO.p.getAdvancedConfig().useTitlesForXPEvent())
{
if (mcMMO.p.getAdvancedConfig().useTitlesForXPEvent()) {
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
LocaleLoader.getString("Commands.Event.Stop"),
LocaleLoader.getString("Commands.Event.Stop.Subtitle"),
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.Subtitle"));
}
@ -72,34 +70,29 @@ public class XprateCommand implements TabExecutor {
if (CommandUtils.shouldDisableToggle(args[1])) {
mcMMO.p.setXPEventEnabled(false);
}
else if (CommandUtils.shouldEnableToggle(args[1])) {
} else if (CommandUtils.shouldEnableToggle(args[1])) {
mcMMO.p.setXPEventEnabled(true);
}
else {
} else {
return false;
}
int newXpRate = Integer.parseInt(args[0]);
if (newXpRate < 0)
{
if (newXpRate < 0) {
sender.sendMessage(ChatColor.RED+LocaleLoader.getString("Commands.NegativeNumberWarn"));
return true;
}
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
if (mcMMO.p.getAdvancedConfig().useTitlesForXPEvent())
{
if (mcMMO.p.getAdvancedConfig().useTitlesForXPEvent()) {
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
LocaleLoader.getString("Commands.Event.Start"),
LocaleLoader.getString("Commands.Event.XP", newXpRate),
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.XP", newXpRate));
}

View File

@ -30,8 +30,7 @@ public class AddxpCommand extends ExperienceCommand {
return;
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
}
else {
} else {
profile.addXp(skill, value);
profile.scheduleAsyncSave();
}

View File

@ -49,15 +49,13 @@ public abstract class ExperienceCommand implements TabExecutor {
skill = null;
}
if (skill != null && SkillTools.isChildSkill(skill))
{
if (skill != null && SkillTools.isChildSkill(skill)) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
return true;
}
//Profile not loaded
if (UserManager.getPlayer(sender.getName()) == null)
{
if (UserManager.getPlayer(sender.getName()) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
@ -82,8 +80,7 @@ public abstract class ExperienceCommand implements TabExecutor {
skill = null;
}
if (skill != null && SkillTools.isChildSkill(skill))
{
if (skill != null && SkillTools.isChildSkill(skill)) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
return true;
}
@ -110,8 +107,7 @@ public abstract class ExperienceCommand implements TabExecutor {
}
editValues(null, profile, skill, value, isSilent(args));
}
else {
} else {
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) {
if (skill == null) {
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));
}
}
@ -174,8 +169,7 @@ public abstract class ExperienceCommand implements TabExecutor {
if (player != null) {
handlePlayerMessageAll(player, value, isSilent);
}
}
else {
} else {
handleCommand(player, profile, skill, value);
if (player != null) {

View File

@ -48,8 +48,7 @@ public class SkillresetCommand implements TabExecutor {
if (args[0].equalsIgnoreCase("all")) {
skill = null;
}
else {
} else {
skill = mcMMO.p.getSkillTools().matchSkill(args[0]);
}
@ -68,8 +67,7 @@ public class SkillresetCommand implements TabExecutor {
if (args[1].equalsIgnoreCase("all")) {
skill = null;
}
else {
} else {
skill = mcMMO.p.getSkillTools().matchSkill(args[1]);
}
@ -93,8 +91,7 @@ public class SkillresetCommand implements TabExecutor {
}
editValues(null, profile, skill);
}
else {
} else {
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) {
if (skill == null) {
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));
}
}
@ -171,8 +167,7 @@ public class SkillresetCommand implements TabExecutor {
if (player != null) {
handlePlayerMessageAll(player);
}
}
else {
} else {
handleCommand(player, profile, skill);
if (player != null) {

View File

@ -12,8 +12,7 @@ import org.jetbrains.annotations.NotNull;
public class PartyChangePasswordCommand implements CommandExecutor {
@Override
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"));
return true;
}

View File

@ -90,8 +90,7 @@ public class PartyCommand implements TabExecutor {
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (mcMMOPlayer == null)
{
if (mcMMOPlayer == null) {
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
@ -207,8 +206,7 @@ public class PartyCommand implements TabExecutor {
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Not Loaded
if (mcMMOPlayer == null)
{
if (mcMMOPlayer == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return ImmutableList.of();
}

View File

@ -19,8 +19,7 @@ public class PartyCreateCommand implements CommandExecutor {
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}

View File

@ -23,8 +23,7 @@ public class PartyInfoCommand implements CommandExecutor {
switch (args.length) {
case 0:
case 1:
if (UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
@ -70,8 +69,7 @@ public class PartyInfoCommand implements CommandExecutor {
if (isUnlockedFeature(party, partyFeature)) {
unlockedPartyFeatures.add(partyFeature.getLocaleString());
}
else {
} else {
lockedPartyFeatures.add(partyFeature.getFeatureLockedLocaleString());
}
}

View File

@ -20,8 +20,7 @@ import java.util.Locale;
public class PartyItemShareCommand implements CommandExecutor {
@Override
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"));
return true;
}
@ -50,11 +49,9 @@ public class PartyItemShareCommand implements CommandExecutor {
if (CommandUtils.shouldEnableToggle(args[2])) {
toggle = true;
}
else if (CommandUtils.shouldDisableToggle(args[2])) {
} else if (CommandUtils.shouldDisableToggle(args[2])) {
toggle = false;
}
else {
} else {
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
return true;
}

View File

@ -34,8 +34,7 @@ public class PartyJoinCommand implements CommandExecutor {
Player player = (Player) sender;
if (UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
@ -62,8 +61,7 @@ public class PartyJoinCommand implements CommandExecutor {
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()));
return true;
}

View File

@ -18,8 +18,7 @@ public class PartyLockCommand implements CommandExecutor {
case 1:
if (args[0].equalsIgnoreCase("lock")) {
togglePartyLock(sender, true);
}
else if (args[0].equalsIgnoreCase("unlock")) {
} else if (args[0].equalsIgnoreCase("unlock")) {
togglePartyLock(sender, false);
}
@ -33,11 +32,9 @@ public class PartyLockCommand implements CommandExecutor {
if (CommandUtils.shouldEnableToggle(args[1])) {
togglePartyLock(sender, true);
}
else if (CommandUtils.shouldDisableToggle(args[1])) {
} else if (CommandUtils.shouldDisableToggle(args[1])) {
togglePartyLock(sender, false);
}
else {
} else {
sendUsageStrings(sender);
}
@ -55,8 +52,7 @@ public class PartyLockCommand implements CommandExecutor {
}
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"));
return;
}

View File

@ -30,20 +30,15 @@ public enum PartySubcommandType {
if (commandName.equalsIgnoreCase("?")) {
return HELP;
}
else if (commandName.equalsIgnoreCase("q") || commandName.equalsIgnoreCase("leave")) {
} else if (commandName.equalsIgnoreCase("q") || commandName.equalsIgnoreCase("leave")) {
return QUIT;
}
else if (commandName.equalsIgnoreCase("leader")) {
} else if (commandName.equalsIgnoreCase("leader")) {
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;
}
else if (commandName.equalsIgnoreCase("shareitem") || commandName.equalsIgnoreCase("shareitems")) {
} else if (commandName.equalsIgnoreCase("shareitem") || commandName.equalsIgnoreCase("shareitems")) {
return ITEMSHARE;
}
else if (commandName.equalsIgnoreCase("ally")) {
} else if (commandName.equalsIgnoreCase("ally")) {
return ALLIANCE;
}

View File

@ -17,8 +17,7 @@ import org.jetbrains.annotations.NotNull;
public class PartyXpShareCommand implements CommandExecutor {
@Override
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"));
return true;
}

View File

@ -37,8 +37,7 @@ public class PartyAllianceCommand implements TabExecutor {
return true;
}
if (UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}

View File

@ -21,8 +21,7 @@ public class PtpAcceptAnyCommand implements CommandExecutor {
if (ptpRecord.isConfirmRequired()) {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
}
else {
} else {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Enabled"));
}

View File

@ -21,8 +21,7 @@ public class PtpAcceptCommand implements CommandExecutor {
return true;
}
if (UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
@ -56,8 +55,7 @@ public class PtpAcceptCommand implements CommandExecutor {
if (!Permissions.partyTeleportWorld(target, targetWorld)) {
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
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()));
return true;
}

View File

@ -45,8 +45,7 @@ public class PtpCommand implements TabExecutor {
Player player = (Player) sender;
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return true;
}
@ -59,8 +58,7 @@ public class PtpCommand implements TabExecutor {
return true;
}
if (UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
@ -171,8 +169,7 @@ public class PtpCommand implements TabExecutor {
if (!Permissions.partyTeleportWorld(target, targetWorld)) {
player.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
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()));
return;
}
@ -228,14 +225,12 @@ public class PtpCommand implements TabExecutor {
}
protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) {
if (UserManager.getPlayer(targetPlayer) == null)
{
if (UserManager.getPlayer(targetPlayer) == null) {
targetPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return;
}
if (UserManager.getPlayer(teleportingPlayer) == null)
{
if (UserManager.getPlayer(teleportingPlayer) == null) {
teleportingPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return;
}
@ -250,8 +245,7 @@ public class PtpCommand implements TabExecutor {
if (warmup > 0) {
teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup));
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(teleportingPlayer, new TeleportationWarmup(mcMMOPlayer, mcMMOTarget), 20 * warmup);
}
else {
} else {
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
}
}

View File

@ -21,8 +21,7 @@ public class PtpToggleCommand implements CommandExecutor {
if (ptpRecord.isEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled"));
}
else {
} else {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Enabled"));
}

View File

@ -85,8 +85,7 @@ public class McrankCommand implements TabExecutor {
if (sender instanceof Player) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
if (mcMMOPlayer == null)
{
if (mcMMOPlayer == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return;
}

View File

@ -54,8 +54,7 @@ public class AcrobaticsCommand extends SkillCommand {
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName("Roll");
if (abstractSubSkill != null)
{
if (abstractSubSkill != null) {
String[] rollStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.ACROBATICS_ROLL);
messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, rollStrings[0])

View File

@ -26,15 +26,12 @@ public class MmoInfoCommand implements TabExecutor {
/*
* 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())
return false;
if (Permissions.mmoinfo(player))
{
if (args[0].equalsIgnoreCase( "???"))
{
if (Permissions.mmoinfo(player)) {
if (args[0].equalsIgnoreCase( "???")) {
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", "???"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
@ -57,8 +54,7 @@ public class MmoInfoCommand implements TabExecutor {
}
public SubSkillType matchSubSkill(String name) {
for(SubSkillType subSkillType : SubSkillType.values())
{
for(SubSkillType subSkillType : SubSkillType.values()) {
if (subSkillType.getNiceNameNoSpaces(subSkillType).equalsIgnoreCase(name)
|| subSkillType.name().equalsIgnoreCase(name))
return subSkillType;
@ -74,8 +70,7 @@ public class MmoInfoCommand implements TabExecutor {
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.SubSkillHeader", subSkillType.getLocaleName()));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));

View File

@ -88,8 +88,7 @@ public abstract class SkillCommand implements TabExecutor {
TextComponentFactory.sendPlayerSubSkillList(player, subskillTextComponents);
/*for(TextComponent tc : subskillTextComponents)
{
/*for(TextComponent tc : subskillTextComponents) {
player.spigot().sendMessage(new TextComponent[]{tc, new TextComponent(": TESTING")});
}*/
@ -149,8 +148,7 @@ public abstract class SkillCommand implements TabExecutor {
// send header
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName));
if (!SkillTools.isChildSkill(skill))
{
if (!SkillTools.isChildSkill(skill)) {
/*
* NON-CHILD SKILLS
*/
@ -175,10 +173,8 @@ public abstract class SkillCommand implements TabExecutor {
StringBuilder parentMessage = new StringBuilder();
for(int i = 0; i < parentList.size(); i++)
{
if (i+1 < parentList.size())
{
for(int i = 0; i < parentList.size(); i++) {
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(ChatColor.GRAY).append(", ");
} else {
@ -237,11 +233,9 @@ public abstract class SkillCommand implements TabExecutor {
int length;
if (abilityLengthCap <= 0)
{
if (abilityLengthCap <= 0) {
length = 2 + (int) (skillValue / abilityLengthVar);
}
else {
} else {
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) };
}
protected String getStatMessage(SubSkillType subSkillType, String... vars)
{
protected String getStatMessage(SubSkillType subSkillType, String... 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 statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription();
if (isCustom)
return LocaleLoader.getString(templateKey, LocaleLoader.getString(statDescriptionKey, vars));
else
{
else {
String[] mergedList = NotificationManager.addItemToFirstPositionOfArray(LocaleLoader.getString(statDescriptionKey), vars);
return LocaleLoader.getString(templateKey, mergedList);
}

View File

@ -77,8 +77,7 @@ public class SkillGuideCommand implements CommandExecutor {
while (allStrings.size() < 9) {
if (pageIndexStart + allStrings.size() > guide.size()) {
allStrings.add("");
}
else {
} else {
allStrings.add(guide.get(pageIndexStart + (allStrings.size() - 1)));
}
}

View File

@ -101,8 +101,7 @@ public class SwordsCommand extends SkillCommand {
+ (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,
String.valueOf(mmoPlayer.getSwordsManager().getStabDamage())));
}

View File

@ -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 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
*/
/*public ChatColor getJSONStatHoverDetailsColor()
{
/*public ChatColor getJSONStatHoverDetailsColor() {
String keyLocation = "Style.JSON.Hover.Details.Header.Color";
return getChatColorFromKey(keyLocation);
}
public boolean isJSONDetailsHeaderBold()
{
public boolean isJSONDetailsHeaderBold() {
return config.getBoolean("Style.JSON.Hover.Details.Header.Bold");
}
public boolean isJSONDetailsHeaderItalic()
{
public boolean isJSONDetailsHeaderItalic() {
return config.getBoolean("Style.JSON.Hover.Details.Header.Italics");
}
public boolean isJSONDetailsHeaderUnderlined()
{
public boolean isJSONDetailsHeaderUnderlined() {
return config.getBoolean("Style.JSON.Hover.Details.Header.Underlined");
}
public ChatColor getJSONStatHoverDescriptionColor()
{
public ChatColor getJSONStatHoverDescriptionColor() {
String keyLocation = "Style.JSON.Hover.Details.Description.Color";
return getChatColorFromKey(keyLocation);
}
public boolean isJSONDetailsDescriptionBold()
{
public boolean isJSONDetailsDescriptionBold() {
return config.getBoolean("Style.JSON.Hover.Details.Description.Bold");
}
public boolean isJSONDetailsDescriptionItalic()
{
public boolean isJSONDetailsDescriptionItalic() {
return config.getBoolean("Style.JSON.Hover.Details.Description.Italics");
}
public boolean isJSONDetailsDescriptionUnderlined()
{
public boolean isJSONDetailsDescriptionUnderlined() {
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"));
}*/
private ChatColor getChatColorFromKey(String keyLocation) {
@ -580,22 +570,19 @@ public class AdvancedConfig extends BukkitConfig {
return ChatColor.WHITE;
}
/*public boolean isJSONStatHoverElementBold(StatType statType, boolean isPrefix)
{
/*public boolean isJSONStatHoverElementBold(StatType statType, boolean isPrefix) {
String keyAddress = isPrefix ? "Prefix" : "Value";
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Bold";
return config.getBoolean(keyLocation);
}
public boolean isJSONStatHoverElementItalic(StatType statType, boolean isPrefix)
{
public boolean isJSONStatHoverElementItalic(StatType statType, boolean isPrefix) {
String keyAddress = isPrefix ? "Prefix" : "Value";
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Italics";
return config.getBoolean(keyLocation);
}
public boolean isJSONStatHoverElementUnderlined(StatType statType, boolean isPrefix)
{
public boolean isJSONStatHoverElementUnderlined(StatType statType, boolean isPrefix) {
String keyAddress = isPrefix ? "Prefix" : "Value";
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Underline";
return config.getBoolean(keyLocation);

View File

@ -152,8 +152,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
// If they're still around, rewrite them to the file.
if (!powerless) {
writer.append(line).append("\r\n");
}
else {
} else {
purgedUsers++;
}
}

View File

@ -14,8 +14,7 @@ public enum DatabaseType {
if (typeName.equalsIgnoreCase("file")) {
return FLATFILE;
}
else if (typeName.equalsIgnoreCase("mysql")) {
} else if (typeName.equalsIgnoreCase("mysql")) {
return SQL;
}

View File

@ -33,8 +33,7 @@ public class SkillXpGain implements Delayed {
public int compareTo(SkillXpGain other) {
if (this.expiryTime < other.expiryTime) {
return -1;
}
else if (this.expiryTime > other.expiryTime) {
} else if (this.expiryTime > other.expiryTime) {
return 1;
}
return 0;

View File

@ -8,10 +8,8 @@ public class McMMOUrl {
public static final String urlSpigot = "https://spigot.mcmmo.org";
public static final String urlTranslate = "https://translate.mcmmo.org/";
public static String getUrl(McMMOWebLinks webLinks)
{
switch(webLinks)
{
public static String getUrl(McMMOWebLinks webLinks) {
switch(webLinks) {
case WIKI:
return urlWiki;
case PATREON:

View File

@ -11,20 +11,16 @@ public enum McMMOWebLinks {
HELP_TRANSLATE,
WIKI;
public String getUrl()
{
public String getUrl() {
return McMMOUrl.getUrl(this);
}
public String getNiceTitle()
{
public String getNiceTitle() {
return StringUtils.getCapitalized(toString());
}
public String getLocaleDescription()
{
switch (this)
{
public String getLocaleDescription() {
switch (this) {
case WEBSITE:
return LocaleLoader.getString( "JSON.URL.Website");
case DISCORD:

View File

@ -8,8 +8,7 @@ import org.bukkit.metadata.FixedMetadataValue;
*/
public class OldName extends FixedMetadataValue {
public OldName(String oldName, mcMMO plugin)
{
public OldName(String oldName, mcMMO plugin) {
super(plugin, oldName);
}

View File

@ -15,17 +15,13 @@ public enum ItemShareType {
public static ItemShareType getShareType(ItemStack itemStack) {
if (ItemUtils.isMobDrop(itemStack)) {
return LOOT;
}
else if (ItemUtils.isMiningDrop(itemStack)) {
} else if (ItemUtils.isMiningDrop(itemStack)) {
return MINING;
}
else if (ItemUtils.isHerbalismDrop(itemStack)) {
} else if (ItemUtils.isHerbalismDrop(itemStack)) {
return HERBALISM;
}
else if (ItemUtils.isWoodcuttingDrop(itemStack)) {
} else if (ItemUtils.isWoodcuttingDrop(itemStack)) {
return WOODCUTTING;
}
else if (ItemUtils.isMiscDrop(itemStack)) {
} else if (ItemUtils.isMiscDrop(itemStack)) {
return MISC;
}

View File

@ -85,12 +85,10 @@ public class Party {
return onlineMembers;
}
public List<Player> getVisibleMembers(Player player)
{
public List<Player> getVisibleMembers(Player player) {
ArrayList<Player> visibleMembers = new ArrayList<>();
for(Player p : onlineMembers)
{
for(Player p : onlineMembers) {
if (player.canSee(p))
visibleMembers.add(p);
}

View File

@ -14,8 +14,7 @@ public enum ShareMode {
catch (IllegalArgumentException ex) {
if (string.equalsIgnoreCase("even")) {
return EQUAL;
}
else if (CommandUtils.shouldDisableToggle(string)) {
} else if (CommandUtils.shouldDisableToggle(string)) {
return NONE;
}

View File

@ -250,8 +250,7 @@ public class McMMOPlayer implements Identified {
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
if (hasReachedPowerLevelCap()) {
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.PowerLevel", String.valueOf(mcMMO.p.getGeneralConfig().getPowerLevelCap()));
@ -272,19 +271,16 @@ public class McMMOPlayer implements Identified {
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);
}
public void updateXPBar(PrimarySkillType primarySkillType, Plugin plugin)
{
public void updateXPBar(PrimarySkillType primarySkillType, Plugin plugin) {
//XP BAR UPDATES
experienceBarManager.updateExperienceBar(primarySkillType, plugin);
}
public double getProgressInCurrentSkillLevel(PrimarySkillType primarySkillType)
{
public double getProgressInCurrentSkillLevel(PrimarySkillType primarySkillType) {
if (SkillTools.isChildSkill(primarySkillType)) {
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
//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);
//Inform the player they are not yet skilled enough
@ -941,8 +936,7 @@ public class McMMOPlayer implements Identified {
int ticks;
//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());
} else {
ticks = PerksUtils.handleActivationPerks(player, 2 + (getSkillLevel(primarySkillType) / abilityLengthVar), superAbilityType.getMaxLength());

View File

@ -135,8 +135,7 @@ public class PlayerProfile {
+ " resulted in failure. "+saveAttempts+" have been made so far.");
}
if (saveAttempts < 10)
{
if (saveAttempts < 10) {
saveAttempts++;
//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) {
skillsXp.put(parentSkill, skillsXp.get(parentSkill) + dividedXP);
}
}
else {
} else {
skillsXp.put(skill, skillsXp.get(skill) + xp);
}
}

View File

@ -9,11 +9,9 @@ public enum ModConfigType {
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")) {
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;
}
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;
}

View File

@ -128,18 +128,15 @@ public enum SubSkillType {
* If our SubSkillType has more than 1 rank define it
* @param numRanks The number of ranks our SubSkillType has
*/
SubSkillType(int numRanks)
{
SubSkillType(int numRanks) {
this.numRanks = numRanks;
}
SubSkillType()
{
SubSkillType() {
this.numRanks = 0;
}
public int getNumRanks()
{
public int getNumRanks() {
return numRanks;
}
@ -170,8 +167,7 @@ public enum SubSkillType {
* Get the string representation of the permission node for this subskill
* @return the permission node for this subskill
*/
public String getPermissionNodeAddress()
{
public String getPermissionNodeAddress() {
//TODO: This could be optimized
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
*/
String subskillNameWithoutPrefix = subSkillName.substring(subStringIndex);
if (subskillNameWithoutPrefix.contains("_"))
{
if (subskillNameWithoutPrefix.contains("_")) {
String[] splitStrings = subskillNameWithoutPrefix.split("_");
for(String string : splitStrings)
{
for(String string : splitStrings) {
endResult.append(StringUtils.getCapitalized(string));
}
} else {
@ -228,8 +222,7 @@ public enum SubSkillType {
* Returns the name of the parent skill from the Locale file
* @return The parent skill as defined in the locale
*/
public String getParentNiceNameLocale()
{
public String getParentNiceNameLocale() {
return LocaleLoader.getString(StringUtils.getCapitalized(getParentSkill().toString())+".SkillName");
}
@ -238,8 +231,7 @@ public enum SubSkillType {
* @param subSkillType target subskill
* @return the "nice" name without spaces
*/
public String getNiceNameNoSpaces(SubSkillType subSkillType)
{
public String getNiceNameNoSpaces(SubSkillType subSkillType) {
return getConfigName(subSkillType.toString());
}
@ -263,18 +255,15 @@ public enum SubSkillType {
return subStringIndex;
}
public String getLocaleKeyRoot()
{
public String getLocaleKeyRoot() {
return StringUtils.getCapitalized(getParentSkill().toString())+".SubSkill."+getConfigName(toString());
}
public String getLocaleName()
{
public String getLocaleName() {
return getFromLocaleSubAddress(".Name");
}
public String getLocaleDescription()
{
public String getLocaleDescription() {
return getFromLocaleSubAddress(".Description");
}
@ -284,13 +273,11 @@ public enum SubSkillType {
public String getLocaleStatExtraDescription() { return getFromLocaleSubAddress(".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);
}
public String getCustomLocaleStat(String... vars)
{
public String getCustomLocaleStat(String... vars) {
return LocaleLoader.getString("Ability.Generic.Template.Custom", (Object[]) vars);
}
@ -298,8 +285,7 @@ public enum SubSkillType {
return LocaleLoader.getString(getLocaleKeyRoot() + s);
}
private String getLocaleKeyFromSubAddress(String s)
{
private String getLocaleKeyFromSubAddress(String s) {
return getLocaleKeyRoot() + s;
}
}

View File

@ -18,8 +18,7 @@ public abstract class AbstractSubSkill implements SubSkill, Interaction, Rank, S
protected String configKeyPrimary;
protected SubSkillType subSkillType;
public AbstractSubSkill(String configKeySubSkill, String configKeyPrimary, SubSkillType subSkillType)
{
public AbstractSubSkill(String configKeySubSkill, String configKeyPrimary, SubSkillType subSkillType) {
this.configKeySubSkill = configKeySubSkill;
this.configKeyPrimary = configKeyPrimary;
this.subSkillType = subSkillType;

View File

@ -156,8 +156,7 @@ public class Roll extends AcrobaticsSubSkill {
//Advanced
//Lucky Notice
if (isLucky)
{
if (isLucky) {
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.JWrapper.Perks.Header")));
componentBuilder.append(Component.newline());
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.JWrapper.Perks.Lucky", "33")));
@ -219,8 +218,7 @@ public class Roll extends AcrobaticsSubSkill {
addFallLocation(mmoPlayer);
return modifiedDamage;
}
else if (!isFatal(mmoPlayer, damage)) {
} else if (!isFatal(mmoPlayer, damage)) {
//if (!SkillUtils.cooldownExpired((long) mmoPlayer.getTeleportATS(), Config.getInstance().getXPAfterTeleportCooldown())) {
if (!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, damage, false), XPGainReason.PVE);
@ -248,8 +246,7 @@ public class Roll extends AcrobaticsSubSkill {
if (!isFatal(mmoPlayer, modifiedDamage)
//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");
SoundManager.sendCategorizedSound(mmoPlayer.getPlayer(), mmoPlayer.getPlayer().getLocation(), SoundType.ROLL_ACTIVATED, SoundCategory.PLAYERS,0.5F);
if (!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
@ -257,8 +254,7 @@ public class Roll extends AcrobaticsSubSkill {
addFallLocation(mmoPlayer);
return modifiedDamage;
}
else if (!isFatal(mmoPlayer, damage)) {
} else if (!isFatal(mmoPlayer, damage)) {
if (!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, damage, false), XPGainReason.PVE);
@ -292,8 +288,7 @@ public class Roll extends AcrobaticsSubSkill {
return true;
}
if (mmoPlayer.getAcrobaticsManager().hasFallenInLocationBefore(getBlockLocation(mmoPlayer)))
{
if (mmoPlayer.getAcrobaticsManager().hasFallenInLocationBefore(getBlockLocation(mmoPlayer))) {
if (mmoPlayer.isDebugMode()) {
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
*/
@Override
public Double[] getStats(McMMOPlayer mmoPlayer)
{
public Double[] getStats(McMMOPlayer mmoPlayer) {
double playerChanceRoll = ProbabilityUtil.getSubSkillProbability(subSkillType, mmoPlayer).getValue();
double playerChanceGrace = playerChanceRoll * 2;

View File

@ -18,8 +18,7 @@ abstract public class McMMOScoreboardEvent extends Event {
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.targetBoard = targetBoard;
this.currentBoard = currentBoard;

View File

@ -47,8 +47,7 @@ public class BlockListener implements Listener {
}
@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
if (event.isCancelled()) {
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 (blockCount <= 1) {
for(Item item : event.getItems())
{
for(Item item : event.getItems()) {
ItemStack is = new ItemStack(item.getItemStack());
if (is.getAmount() <= 0)
@ -186,8 +184,7 @@ public class BlockListener implements Listener {
* @param event The event to watch
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityBlockFormEvent(EntityBlockFormEvent event)
{
public void onEntityBlockFormEvent(EntityBlockFormEvent event) {
/* WORLD BLACKLIST CHECK */
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
return;
@ -207,8 +204,7 @@ public class BlockListener implements Listener {
* Does not monitor stuff like a falling block replacing a liquid
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockFormEvent(BlockFormEvent event)
{
public void onBlockFormEvent(BlockFormEvent event) {
World world = event.getBlock().getWorld();
/* WORLD BLACKLIST CHECK */
@ -266,8 +262,7 @@ public class BlockListener implements Listener {
if (blockState.getType() == Repair.anvilMaterial && mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.REPAIR)) {
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();
}
}
@ -334,8 +329,7 @@ public class BlockListener implements Listener {
}
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer())) {
BlockUtils.cleanupBlockMetadata(block);
return;
@ -411,8 +405,7 @@ public class BlockListener implements Listener {
WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager();
if (woodcuttingManager.canUseTreeFeller(heldItem)) {
woodcuttingManager.processTreeFeller(blockState);
}
else {
} else {
//Check for XP
woodcuttingManager.processWoodcuttingBlockXP(blockState);
@ -422,7 +415,10 @@ public class BlockListener implements Listener {
}
/* 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.excavationBlockCheck(blockState);
@ -450,8 +446,7 @@ public class BlockListener implements Listener {
return;
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
return;
}
@ -463,8 +458,7 @@ public class BlockListener implements Listener {
}
//Profile not loaded
if (UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
return;
}
@ -478,8 +472,7 @@ public class BlockListener implements Listener {
if (herbalismManager.processHylianLuck(blockState)) {
blockState.update(true);
event.setCancelled(true);
}
else if (blockState.getType() == Material.FLOWER_POT) {
} else if (blockState.getType() == Material.FLOWER_POT) {
blockState.setType(Material.AIR);
blockState.update(true);
event.setCancelled(true);
@ -513,8 +506,7 @@ public class BlockListener implements Listener {
return;
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
return;
}
@ -529,8 +521,7 @@ public class BlockListener implements Listener {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Profile not loaded
if (mcMMOPlayer == null)
{
if (mcMMOPlayer == null) {
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)) {
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);
}
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);
}
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);
}
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())
|| blockState.getType() == Material.SNOW
|| BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
@ -596,8 +583,7 @@ public class BlockListener implements Listener {
return;
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
return;
}
@ -615,8 +601,7 @@ public class BlockListener implements Listener {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Profile not loaded
if (UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
return;
}
@ -633,14 +618,12 @@ public class BlockListener implements Listener {
if (mcMMOPlayer.getHerbalismManager().processGreenTerraBlockConversion(blockState)) {
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 (EventUtils.simulateBlockBreak(block, player) && mcMMOPlayer.getUnarmedManager().blockCrackerCheck(blockState)) {
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);
if (blockState.getType().getKey().getKey().contains("glass")) {
@ -649,8 +632,7 @@ public class BlockListener implements Listener {
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);
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
}
@ -662,8 +644,7 @@ public class BlockListener implements Listener {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Profile not loaded
if (UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
return;
}
@ -680,23 +661,19 @@ public class BlockListener implements Listener {
//TODO: Convert into locale strings
private void debugStickDump(Player player, BlockState blockState) {
//Profile not loaded
if (UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
return;
}
if (UserManager.getPlayer(player).isDebugMode())
{
if (UserManager.getPlayer(player).isDebugMode()) {
if (mcMMO.getUserBlockTracker().isIneligible(blockState))
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");
UserManager.getPlayer(player).getExcavationManager().printExcavationDebug(player, blockState);
}
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (WorldGuardManager.getInstance().hasMainFlag(player))
player.sendMessage("[mcMMO DEBUG] World Guard main flag is permitted for this player in this region");
else

View File

@ -81,14 +81,12 @@ public class EntityListener implements Listener {
return;
//It's rare but targets can be null sometimes
if (event.getTarget() == null)
{
if (event.getTarget() == null) {
return;
}
//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 (!hasMobFlag(MobMetaFlagType.EXPLOITED_ENDERMEN, enderman)) {
@ -104,8 +102,7 @@ public class EntityListener implements Listener {
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
return;
if (event.getEntity() instanceof Player player)
{
if (event.getEntity() instanceof Player player) {
Entity projectile = event.getProjectile();
//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()))
return;
if (event.getEntity().getShooter() instanceof Player player)
{
if (event.getEntity().getShooter() instanceof Player player) {
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded()) {
@ -212,15 +208,13 @@ public class EntityListener implements Listener {
entity.setMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, MetadataConstants.MCMMO_METADATA_VALUE);
TravelingBlockMetaCleanup metaCleanupTask = new TravelingBlockMetaCleanup(entity, pluginRef);
mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(entity, metaCleanupTask, 20, 20*60); //6000 ticks is 5 minutes
}
else if (isTracked) {
} else if (isTracked) {
BlockUtils.setUnnaturalBlock(block);
entity.removeMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, pluginRef);
}
} else if ((block.getType() == Material.REDSTONE_ORE || block.getType().getKey().getKey().equalsIgnoreCase("deepslate_redstone_ore"))) {
//Redstone ore fire this event and should be ignored
}
else {
} else {
if (mcMMO.getUserBlockTracker().isIneligible(block)) {
mcMMO.getUserBlockTracker().setEligible(block);
}
@ -265,8 +259,7 @@ public class EntityListener implements Listener {
Entity defender = event.getEntity();
Entity attacker = event.getDamager();
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (attacker instanceof Player) {
if (!WorldGuardManager.getInstance().hasMainFlag((Player) attacker)) {
@ -324,8 +317,7 @@ public class EntityListener implements Listener {
if (animalTamer != null && ((OfflinePlayer) animalTamer).isOnline()) {
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)) {
return;
}
@ -496,11 +488,9 @@ public class EntityListener implements Listener {
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 */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -576,11 +566,9 @@ public class EntityListener implements Listener {
else if (livingEntity instanceof Tameable pet) {
AnimalTamer owner = pet.getOwner();
if (owner instanceof Player player)
{
if (owner instanceof Player player) {
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -591,8 +579,7 @@ public class EntityListener implements Listener {
Wolf wolf = (Wolf) pet;
//Profile not loaded
if (UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
return;
}
@ -784,14 +771,12 @@ public class EntityListener implements Listener {
}
//Profile not loaded
if (UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
return;
}
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -830,15 +815,13 @@ public class EntityListener implements Listener {
}
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
//Profile not loaded
if (UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
return;
}
@ -869,14 +852,12 @@ public class EntityListener implements Listener {
}
//Profile not loaded
if (UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
return;
}
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -993,8 +974,7 @@ public class EntityListener implements Listener {
Player player = (Player) event.getOwner();
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -1011,8 +991,7 @@ public class EntityListener implements Listener {
flagMetadata(MobMetaFlagType.PLAYER_TAMED_MOB, livingEntity);
//Profile not loaded
if (UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
return;
}
@ -1039,8 +1018,7 @@ public class EntityListener implements Listener {
}
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}

View File

@ -33,8 +33,7 @@ public class InteractionManager {
* Registers subskills with the Interaction registration
* @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
if (!subSkillList.contains(abstractSubSkill))
subSkillList.add(abstractSubSkill);
@ -62,8 +61,7 @@ public class InteractionManager {
* @param name name of subskill, not case sensitive
* @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));
}
@ -73,13 +71,11 @@ public class InteractionManager {
* @param plugin instance of mcMMO plugin
* @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)
return;
for(Interaction interaction : interactRegister.get(curInteractType))
{
for(Interaction interaction : interactRegister.get(curInteractType)) {
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
* @return the unique collection of all registered Interaction classes
*/
public static ArrayList<AbstractSubSkill> getSubSkillList()
{
public static ArrayList<AbstractSubSkill> getSubSkillList() {
return subSkillList;
}
public static boolean hasSubSkill(String name)
{
public static boolean hasSubSkill(String name) {
return getAbstractByName(name) != null;
}
public static boolean hasSubSkill(SubSkillType subSkillType)
{
public static boolean hasSubSkill(SubSkillType subSkillType) {
return hasSubSkill(subSkillType.getNiceNameNoSpaces(subSkillType));
}

View File

@ -131,8 +131,7 @@ public class InventoryListener implements Listener {
if (furnaceBlock instanceof Furnace) {
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -142,8 +141,7 @@ public class InventoryListener implements Listener {
}
//Profile not loaded
if (UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
return;
}
@ -196,8 +194,7 @@ public class InventoryListener implements Listener {
// TODO: Investigate why this WG check is all the way down here?
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -239,8 +236,7 @@ public class InventoryListener implements Listener {
return;
default:
}
}
else if (slot == InventoryType.SlotType.FUEL) {
} else if (slot == InventoryType.SlotType.FUEL) {
boolean emptyClicked = AlchemyPotionBrewer.isEmpty(clicked);
if (AlchemyPotionBrewer.isEmpty(cursor)) {
@ -250,8 +246,7 @@ public class InventoryListener implements Listener {
}
AlchemyPotionBrewer.scheduleCheck(stand);
}
else if (emptyClicked) {
} else if (emptyClicked) {
if (AlchemyPotionBrewer.isValidIngredientByPlayer(player, cursor)) {
int amount = cursor.getAmount();
@ -262,8 +257,7 @@ public class InventoryListener implements Listener {
AlchemyPotionBrewer.scheduleUpdate(inventory);
AlchemyPotionBrewer.scheduleCheck(stand);
}
else if (click == ClickType.RIGHT) {
} else if (click == ClickType.RIGHT) {
event.setCancelled(true);
ItemStack one = cursor.clone();
@ -323,8 +317,7 @@ public class InventoryListener implements Listener {
Player player = (Player) whoClicked;
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
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.
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onBrew(BrewEvent event)
{
public void onBrew(BrewEvent event) {
/* WORLD BLACKLIST CHECK */
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
return;
@ -460,8 +452,7 @@ public class InventoryListener implements Listener {
Player player = (Player) whoClicked;
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}

View File

@ -87,8 +87,7 @@ public class PlayerListener implements Listener {
Player player = event.getPlayer();
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -98,8 +97,7 @@ public class PlayerListener implements Listener {
}
//Profile not loaded
if (UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
return;
}
@ -183,8 +181,7 @@ public class PlayerListener implements Listener {
Player killer = killedPlayer.getKiller();
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(killedPlayer))
return;
}
@ -227,8 +224,7 @@ public class PlayerListener implements Listener {
}
//Profile not loaded
if (UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
return;
}
@ -254,8 +250,7 @@ public class PlayerListener implements Listener {
return;
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
return;
}
@ -287,8 +282,7 @@ public class PlayerListener implements Listener {
Player player = event.getPlayer();
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -298,8 +292,7 @@ public class PlayerListener implements Listener {
}
//Profile not loaded
if (UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
return;
}
@ -373,8 +366,7 @@ public class PlayerListener implements Listener {
Player player = event.getPlayer();
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -384,8 +376,7 @@ public class PlayerListener implements Listener {
}
//Profile not loaded
if (UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
return;
}
@ -393,20 +384,16 @@ public class PlayerListener implements Listener {
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
//Track the hook
if (ExperienceConfig.getInstance().isFishingExploitingPrevented())
{
if (event.getHook().getMetadata(MetadataConstants.METADATA_KEY_FISH_HOOK_REF).size() == 0)
{
if (ExperienceConfig.getInstance().isFishingExploitingPrevented()) {
if (event.getHook().getMetadata(MetadataConstants.METADATA_KEY_FISH_HOOK_REF).size() == 0) {
fishingManager.setFishHookReference(event.getHook());
}
//Spam Fishing
if (event.getState() == PlayerFishEvent.State.CAUGHT_FISH && fishingManager.isFishingTooOften())
{
if (event.getState() == PlayerFishEvent.State.CAUGHT_FISH && fishingManager.isFishingTooOften()) {
event.setExpToDrop(0);
if (caught instanceof Item caughtItem)
{
if (caught instanceof Item caughtItem) {
caughtItem.remove();
}
@ -489,12 +476,10 @@ public class PlayerListener implements Listener {
return;
}
if (event.getEntity() instanceof Player player)
{
if (event.getEntity() instanceof Player player) {
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -618,8 +603,7 @@ public class PlayerListener implements Listener {
}
//Profile not loaded
if (UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
return;
}
@ -640,8 +624,7 @@ public class PlayerListener implements Listener {
Player player = event.getPlayer();
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -665,8 +648,7 @@ public class PlayerListener implements Listener {
}
//Profile not loaded
if (UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
return;
}
@ -715,8 +697,7 @@ public class PlayerListener implements Listener {
else if (miningManager.canDetonate()) {
if (type == Material.TNT) {
event.setCancelled(true); // Don't detonate the TNT if they're too close
}
else {
} else {
miningManager.remoteDetonation();
}
}
@ -770,19 +751,19 @@ public class PlayerListener implements Listener {
Player player = event.getPlayer();
/* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
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;
}
//Profile not loaded
if (UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
return;
}
@ -793,13 +774,10 @@ public class PlayerListener implements Listener {
ItemStack heldItem = player.getInventory().getItemInMainHand();
//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()
&& (heldItem.getType() == Material.FISHING_ROD || player.getInventory().getItemInOffHand().getType() == Material.FISHING_ROD))
{
if (player.isInsideVehicle() && (player.getVehicle() instanceof Minecart || player.getVehicle() instanceof PoweredMinecart))
{
&& (heldItem.getType() == Material.FISHING_ROD || player.getInventory().getItemInOffHand().getType() == Material.FISHING_ROD)) {
if (player.isInsideVehicle() && (player.getVehicle() instanceof Minecart || player.getVehicle() instanceof PoweredMinecart)) {
player.getVehicle().eject();
}
@ -924,11 +902,9 @@ public class PlayerListener implements Listener {
if (type == mcMMO.p.getGeneralConfig().getTamingCOTWMaterial(CallOfTheWildType.WOLF.getConfigEntityTypeEntry())) {
tamingManager.summonWolf();
}
else if (type == mcMMO.p.getGeneralConfig().getTamingCOTWMaterial(CallOfTheWildType.CAT.getConfigEntityTypeEntry())) {
} else if (type == mcMMO.p.getGeneralConfig().getTamingCOTWMaterial(CallOfTheWildType.CAT.getConfigEntityTypeEntry())) {
tamingManager.summonOcelot();
}
else if (type == mcMMO.p.getGeneralConfig().getTamingCOTWMaterial(CallOfTheWildType.HORSE.getConfigEntityTypeEntry())) {
} else if (type == mcMMO.p.getGeneralConfig().getTamingCOTWMaterial(CallOfTheWildType.HORSE.getConfigEntityTypeEntry())) {
tamingManager.summonHorse();
}
@ -1028,8 +1004,7 @@ public class PlayerListener implements Listener {
if (event.getHand() == EquipmentSlot.OFF_HAND) {
itemInHand = event.getPlayer().getInventory().getItemInOffHand();
}
else {
} else {
itemInHand = event.getPlayer().getInventory().getItemInMainHand();
}

View File

@ -24,8 +24,7 @@ public class SelfListener implements Listener {
//Used in task scheduling and other things
private final mcMMO plugin;
public SelfListener(mcMMO plugin)
{
public SelfListener(mcMMO plugin) {
this.plugin = plugin;
}
@ -42,8 +41,7 @@ public class SelfListener implements Listener {
if (player.isOnline()) {
//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;
//Send player skill unlock notifications
UserManager.getPlayer(player).processUnlockNotifications(plugin, event.getSkill(), previousLevelGained);
@ -96,12 +94,9 @@ public class SelfListener implements Listener {
if (event.getXpGainReason() == XPGainReason.PVE ||
event.getXpGainReason() == XPGainReason.PVP ||
event.getXpGainReason() == XPGainReason.SHARED_PVE ||
event.getXpGainReason() == XPGainReason.SHARED_PVP)
{
if (WorldGuardUtils.isWorldGuardLoaded())
{
if (!WorldGuardManager.getInstance().hasXPFlag(player))
{
event.getXpGainReason() == XPGainReason.SHARED_PVP) {
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasXPFlag(player)) {
event.setRawXpGained(0);
event.setCancelled(true);
@ -112,19 +107,16 @@ public class SelfListener implements Listener {
}
}
if (event.getXpGainReason() == XPGainReason.COMMAND)
{
if (event.getXpGainReason() == XPGainReason.COMMAND) {
return;
}
if (ExperienceConfig.getInstance().isEarlyGameBoostEnabled())
{
if (ExperienceConfig.getInstance().isEarlyGameBoostEnabled()) {
int earlyGameBonusXP = 0;
//Give some bonus XP for low levels
if (PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType))
{
if (PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType)) {
earlyGameBonusXP += (mcMMOPlayer.getXpToLevel(primarySkillType) * 0.05);
event.setRawXpGained(event.getRawXpGained() + earlyGameBonusXP);
}
@ -167,12 +159,10 @@ public class SelfListener implements Listener {
* 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 (guaranteedMinimum <= 0 || newValue > guaranteedMinimum)
{
if (guaranteedMinimum <= 0 || newValue > guaranteedMinimum) {
if (newValue > 0) {
event.setRawXpGained(newValue);
}
else {
} else {
event.setCancelled(true);
}
} else {

View File

@ -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);
}
@ -229,8 +228,7 @@ public class mcMMO extends JavaPlugin {
//Check for the newer API and tell them what to do if its missing
checkForOutdatedAPI();
if (serverAPIOutdated)
{
if (serverAPIOutdated) {
foliaLib
.getImpl()
.runTimer(
@ -238,8 +236,7 @@ public class mcMMO extends JavaPlugin {
20, 20*60*30
);
if (platformManager.getServerSoftware() == ServerSoftwareType.CRAFT_BUKKIT)
{
if (platformManager.getServerSoftware() == ServerSoftwareType.CRAFT_BUKKIT) {
foliaLib
.getImpl()
.runTimer(
@ -295,8 +292,7 @@ public class mcMMO extends JavaPlugin {
if (!(t instanceof ExceptionInInitializerError)) {
t.printStackTrace();
}
else {
} else {
getLogger().info("Please do not replace the mcMMO jar while the server is running.");
}
@ -350,8 +346,7 @@ public class mcMMO extends JavaPlugin {
}
@Override
public void onLoad()
{
public void onLoad() {
if (getServer().getPluginManager().getPlugin("WorldGuard") != null) {
WorldGuardManager.getInstance().registerFlags();
}
@ -638,8 +633,7 @@ public class mcMMO extends JavaPlugin {
InteractionManager.initMaps(); //Init maps
if (CoreSkillsConfig.getInstance().isPrimarySkillEnabled(PrimarySkillType.ACROBATICS))
{
if (CoreSkillsConfig.getInstance().isPrimarySkillEnabled(PrimarySkillType.ACROBATICS)) {
LogUtils.debug(mcMMO.p.getLogger(), "Enabling Acrobatics Skills");
//TODO: Should do this differently
@ -674,8 +668,7 @@ public class mcMMO extends JavaPlugin {
if (purgeIntervalTicks == 0) {
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);
}
@ -698,8 +691,7 @@ public class mcMMO extends JavaPlugin {
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));
}
}

View File

@ -51,8 +51,7 @@ public final class ShareHandler {
for (Player member : nearMembers) {
//Profile not loaded
if (UserManager.getPlayer(member) == null)
{
if (UserManager.getPlayer(member) == null) {
continue;
}
@ -115,8 +114,7 @@ public final class ShareHandler {
McMMOPlayer mcMMOMember = UserManager.getPlayer(member);
//Profile not loaded
if (UserManager.getPlayer(member) == null)
{
if (UserManager.getPlayer(member) == null) {
continue;
}
@ -161,11 +159,9 @@ public final class ShareHandler {
public static XPGainReason getSharedXpGainReason(XPGainReason xpGainReason) {
if (xpGainReason == XPGainReason.PVE) {
return XPGainReason.SHARED_PVE;
}
else if (xpGainReason == XPGainReason.PVP) {
} else if (xpGainReason == XPGainReason.PVP) {
return XPGainReason.SHARED_PVP;
}
else {
} else {
return xpGainReason;
}
}

View File

@ -51,13 +51,11 @@ public class CleanBackupsTask extends CancellableRunnable {
if (isPast24Hours(date) && mcMMO.p.getGeneralConfig().getKeepLast24Hours()) {
// Keep all files from the last 24 hours
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
savedDays.add(dayOfWeek);
continue;
}
else {
} else {
List<Integer> savedWeeks = savedYearsWeeks.computeIfAbsent(year, k -> new ArrayList<>());
if (!savedWeeks.contains(weekOfYear) && mcMMO.p.getGeneralConfig().getKeepWeeklyPastMonth()) {

View File

@ -64,8 +64,7 @@ public class McrankCommandDisplayTask extends CancellableRunnable {
public void displayBoard() {
if (sender.getName().equalsIgnoreCase(playerName)) {
ScoreboardManager.showPlayerRankScoreboard((Player) sender, skills);
}
else {
} else {
ScoreboardManager.showPlayerRankScoreboardOthers((Player) sender, playerName, skills);
}
}

View File

@ -54,16 +54,13 @@ public class MctopCommandDisplayTask extends CancellableRunnable {
if (skill == null) {
if (sender instanceof Player) {
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
}
else {
} else {
sender.sendMessage(ChatColor.stripColor(LocaleLoader.getString("Commands.PowerLevel.Leaderboard")));
}
}
else {
} else {
if (sender instanceof Player) {
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))));
}
}
@ -76,8 +73,7 @@ public class MctopCommandDisplayTask extends CancellableRunnable {
// 12. Playername - skill value
if (sender instanceof Player) {
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));
}
@ -88,8 +84,7 @@ public class MctopCommandDisplayTask extends CancellableRunnable {
private void displayBoard() {
if (skill == null) {
ScoreboardManager.showTopPowerScoreboard((Player) sender, page, userStats);
}
else {
} else {
ScoreboardManager.showTopScoreboard((Player) sender, skill, page, userStats);
}
}

View File

@ -11,10 +11,8 @@ public class NotifySquelchReminderTask extends CancellableRunnable {
@Override
public void run() {
for (Player player : Bukkit.getOnlinePlayers()) {
if (UserManager.getPlayer(player) != null)
{
if (!UserManager.getPlayer(player).useChatNotifications())
{
if (UserManager.getPlayer(player) != null) {
if (!UserManager.getPlayer(player).useChatNotifications()) {
player.sendMessage(LocaleLoader.getString("Reminder.Squelched"));
}
}

View File

@ -44,8 +44,7 @@ public class FormulaConversionTask extends CancellableRunnable {
editValues(profile);
// Since this is a temporary profile, we save it here.
profile.scheduleAsyncSave();
}
else {
} else {
profile = mcMMOPlayer.getProfile();
editValues(profile);
}

View File

@ -60,8 +60,7 @@ public class TeleportationWarmup extends CancellableRunnable {
if (!Permissions.partyTeleportWorld(targetPlayer, targetWorld)) {
teleportingPlayer.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
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()));
return;
}

View File

@ -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
if (attempt >= 3)
{
if (attempt >= 3) {
//Log the error
mcMMO.p.getLogger().severe(LocaleLoader.getString("Profile.Loading.FailureNotice",
player.getName(), String.valueOf(attempt)));

View File

@ -9,8 +9,7 @@ public class BleedContainer {
public LivingEntity target;
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.bleedTicks = bleedTicks;
this.bleedRank = bleedRank;

View File

@ -10,8 +10,7 @@ public class ExperienceBarHideTask extends CancellableRunnable {
public final PrimarySkillType primarySkillType;
public final ExperienceBarManager experienceBarManagerRef;
public ExperienceBarHideTask(ExperienceBarManager experienceBarManagerRef, McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType)
{
public ExperienceBarHideTask(ExperienceBarManager experienceBarManagerRef, McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType) {
this.experienceBarManagerRef = experienceBarManagerRef;
this.mcMMOPlayer = mcMMOPlayer;
this.primarySkillType = primarySkillType;

View File

@ -16,8 +16,7 @@ public class SkillUnlockNotificationTask extends CancellableRunnable {
* @param subSkillType the subskill that they just unlocked
* @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.subSkillType = subSkillType;
this.rank = rank;

View File

@ -39,23 +39,19 @@ public class AcrobaticsManager extends SkillManager {
private long rollXPIntervalLengthen = (1000 * 10); //10 Seconds
private final BlockLocationHistory fallLocationMap;
public boolean hasFallenInLocationBefore(Location location)
{
public boolean hasFallenInLocationBefore(Location location) {
return fallLocationMap.contains(location);
}
public void addLocationToFallMap(Location location)
{
public void addLocationToFallMap(Location location) {
fallLocationMap.add(location);
}
public boolean canGainRollXP()
{
public boolean canGainRollXP() {
if (!ExperienceConfig.getInstance().isAcrobaticsExploitingPrevented())
return true;
if (System.currentTimeMillis() >= rollXPCooldown)
{
if (System.currentTimeMillis() >= rollXPCooldown) {
rollXPCooldown = System.currentTimeMillis() + rollXPInterval;
rollXPIntervalLengthen = (1000 * 10); //5 Seconds
return true;

View File

@ -93,8 +93,7 @@ public final class AlchemyPotionBrewer {
if (!isEmpty(ingredient) && isValidIngredientByPlayer(player, ingredient)) {
if (ingredient.getAmount() <= 1) {
inventory.setIngredient(null);
}
else {
} else {
ingredient.setAmount(ingredient.getAmount() - 1);
inventory.setIngredient(ingredient);
}
@ -237,8 +236,7 @@ public final class AlchemyPotionBrewer {
if (click.isLeftClick()) {
success = transferItems(view, fromSlot);
}
else if (click.isRightClick()) {
} else if (click.isRightClick()) {
success = transferOneItem(view, fromSlot);
}
@ -258,13 +256,11 @@ public final class AlchemyPotionBrewer {
if (!emptyTo && fromAmount >= from.getType().getMaxStackSize()) {
return false;
}
else if (emptyTo || from.isSimilar(to)) {
} else if (emptyTo || from.isSimilar(to)) {
if (emptyTo) {
to = from.clone();
to.setAmount(1);
}
else {
} else {
to.setAmount(to.getAmount() + 1);
}
@ -287,14 +283,12 @@ public final class AlchemyPotionBrewer {
if (isEmpty(from)) {
return false;
}
else if (isEmpty(to)) {
} else if (isEmpty(to)) {
view.setItem(Alchemy.INGREDIENT_SLOT, from);
view.setItem(fromSlot, null);
return true;
}
else if (from.isSimilar(to)) {
} else if (from.isSimilar(to)) {
int fromAmount = from.getAmount();
int toAmount = to.getAmount();
int maxSize = to.getType().getMaxStackSize();

View File

@ -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 newDamage = oldDamage + (oldDamage * damageBonusPercent);
return Math.min(newDamage, (oldDamage + Archery.skillShotMaxBonusDamage));

View File

@ -43,8 +43,7 @@ public class Axes {
* @param player The target player
* @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;
}
}

View File

@ -101,8 +101,7 @@ public class AxesManager extends SkillManager {
}
damage = (damage * Axes.criticalHitPVPModifier) - damage;
}
else {
} else {
damage = (damage * Axes.criticalHitPVEModifier) - damage;
}

View File

@ -88,8 +88,7 @@ public class CrossbowsManager extends SkillManager {
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 newDamage = oldDamage + (oldDamage * damageBonusPercent);
return Math.min(newDamage, (oldDamage + mcMMO.p.getAdvancedConfig().getPoweredShotDamageMax()));

View File

@ -91,8 +91,7 @@ public class ExcavationManager extends SkillManager {
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)) {
List<ExcavationTreasure> treasures = Excavation.getTreasures(blockState);

View File

@ -101,8 +101,7 @@ public class FishingManager extends SkillManager {
// fishingRodCastTimestamp = System.currentTimeMillis();
// }
public void setFishHookReference(FishHook fishHook)
{
public void setFishHookReference(FishHook fishHook) {
if (fishHook.getMetadata(MetadataConstants.METADATA_KEY_FISH_HOOK_REF).size() > 0)
return;
@ -113,14 +112,12 @@ public class FishingManager extends SkillManager {
}
public boolean isFishingTooOften()
{
public boolean isFishingTooOften() {
long currentTime = System.currentTimeMillis();
long fishHookSpawnCD = fishHookSpawnTimestamp + 1000;
boolean hasFished = (currentTime < fishHookSpawnCD);
if (hasFished && (lastWarned + (1000) < currentTime))
{
if (hasFished && (lastWarned + (1000) < currentTime)) {
getPlayer().sendMessage(LocaleLoader.getString("Fishing.Scared"));
lastWarned = System.currentTimeMillis();
}
@ -134,8 +131,7 @@ public class FishingManager extends SkillManager {
if (this.sameTarget) {
fishCaughtCounter++;
}
else {
} else {
fishCaughtCounter = 1;
}
@ -520,8 +516,7 @@ public class FishingManager extends SkillManager {
if (FishingTreasureConfig.getInstance().getInventoryStealStacks()) {
inventory.setItem(slot, null);
}
else {
} else {
inventory.setItem(slot, (drop.getAmount() > 1) ? new ItemStack(drop.getType(), drop.getAmount() - 1) : null);
drop.setAmount(1);
}
@ -575,8 +570,7 @@ public class FishingManager extends SkillManager {
if (getPlayer().getInventory().getItemInMainHand().getType() == Material.FISHING_ROD) {
luck = getPlayer().getInventory().getItemInMainHand().getEnchantmentLevel(
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
luck = getPlayer().getInventory().getItemInOffHand().getEnchantmentLevel(
mcMMO.p.getEnchantmentMapper().getLuckOfTheSea());

View File

@ -845,11 +845,9 @@ public class HerbalismManager extends SkillManager {
if (greenTerra || greenThumbStage > 2) {
finalAge = 2;
}
else if (greenThumbStage == 2) {
} else if (greenThumbStage == 2) {
finalAge = 1;
}
else {
} else {
finalAge = 0;
}
break;
@ -858,8 +856,7 @@ public class HerbalismManager extends SkillManager {
if (getGreenThumbStage(greenTerra) >= 2) {
finalAge = 1;
}
else {
} else {
finalAge = 0;
}
break;

View File

@ -62,8 +62,7 @@ public class BlastMining {
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)
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();
}*/
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)
return RankUtils.getRankUnlockLevel(SubSkillType.MINING_BLAST_MINING, i+1);
}
@ -102,8 +100,7 @@ public class BlastMining {
return false;
}
if (UserManager.getPlayer(defender) == null)
{
if (UserManager.getPlayer(defender) == null) {
return false;
}

View File

@ -387,8 +387,7 @@ public class RepairManager extends SkillManager {
item.addUnsafeEnchantment(enchantment, enchantLevel - 1);
downgraded = true;
}
}
else {
} else {
item.removeEnchantment(enchantment);
}
}
@ -397,11 +396,9 @@ public class RepairManager extends SkillManager {
if (newEnchants.isEmpty()) {
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");
}
else {
} else {
NotificationManager.sendPlayerInformationChatOnly(getPlayer(), "Repair.Arcane.Perfect");
}
}

View File

@ -235,8 +235,7 @@ public class SalvageManager extends SkillManager {
|| ProbabilityUtil.isStaticSkillRNGSuccessful(
PrimarySkillType.SALVAGE, mmoPlayer, getExtractFullEnchantChance())) {
enchantMeta.addStoredEnchant(enchant.getKey(), enchantLevel, true);
}
else if (enchantLevel > 1
} else if (enchantLevel > 1
&& Salvage.arcaneSalvageDowngrades
&& ProbabilityUtil.isStaticSkillRNGSuccessful(
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");
return null;
} else if (downgraded)
{
} else if (downgraded) {
NotificationManager.sendPlayerInformationChatOnly(player, "Salvage.Skills.ArcanePartial");
}

View File

@ -36,8 +36,7 @@ public class SmeltingManager extends SkillManager {
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)) {
case 1 -> 2;
case 2 -> 3;

View File

@ -108,20 +108,17 @@ public class SwordsManager extends SkillManager {
return RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE);
}
public double getStabDamage()
{
public double getStabDamage() {
int rank = RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_STAB);
if (rank > 0)
{
if (rank > 0) {
return (1.0D + (rank * 1.5));
}
return 0;
}
public int getToolTier(@NotNull ItemStack itemStack)
{
public int getToolTier(@NotNull ItemStack itemStack) {
if (ItemUtils.isNetheriteTool(itemStack))
return 5;
if (ItemUtils.isDiamondTool(itemStack))

View File

@ -279,10 +279,8 @@ public class TamingManager extends SkillManager {
}
public void attackTarget(LivingEntity target) {
if (target instanceof Tameable tameable)
{
if (tameable.getOwner() == getPlayer())
{
if (target instanceof Tameable tameable) {
if (tameable.getOwner() == getPlayer()) {
return;
}
}

View File

@ -19,8 +19,7 @@ public class Unarmed {
int amount = itemDrop.getAmount();
boolean grabbedItem = false;
for(int i = 0; i <= storageContents.length-1; i++)
{
for(int i = 0; i <= storageContents.length-1; i++) {
if (amount <= 0)
break;
@ -28,18 +27,14 @@ public class Unarmed {
continue;
//EMPTY SLOT!
if (storageContents[i] == null)
{
if (storageContents[i] == null) {
player.getInventory().setItem(i, itemDrop);
amount = 0;
grabbedItem = true;
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 (amount + storageContents[i].getAmount() <= storageContents[i].getMaxStackSize())
{
if (amount + storageContents[i].getAmount() <= storageContents[i].getMaxStackSize()) {
ItemStack modifiedAmount = storageContents[i];
modifiedAmount.setAmount(amount + storageContents[i].getAmount());
@ -68,8 +63,7 @@ public class Unarmed {
event.setCancelled(true);
if (grabbedItem)
{
if (grabbedItem) {
SoundManager.sendSound(player, player.getLocation(), SoundType.POP);
player.updateInventory();
}

View File

@ -191,8 +191,7 @@ public class WoodcuttingManager extends SkillManager {
return;
}
}
}
else {
} else {
// Cover DOWN
processTreeFellerTargetBlock(blockState.getBlock().getRelative(BlockFace.DOWN).getState(), futureCenterBlocks, treeFellerBlocks);
// Search in a cube
@ -282,8 +281,7 @@ public class WoodcuttingManager extends SkillManager {
treeFellerBlocks.add(blockState);
futureCenterBlocks.add(blockState);
return true;
}
else if (BlockUtils.isNonWoodPartOfTree(blockState)) {
} else if (BlockUtils.isNonWoodPartOfTree(blockState)) {
treeFellerBlocks.add(blockState);
return false;
}

View File

@ -113,8 +113,7 @@ public final class ChimaeraWing {
if (warmup > 0) {
NotificationManager.sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Teleport.Commencing", String.valueOf(warmup));
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new ChimaeraWingWarmup(mcMMOPlayer), 20 * warmup);
}
else {
} else {
chimaeraExecuteTeleport();
}
}
@ -125,14 +124,12 @@ public final class ChimaeraWing {
if (mcMMO.p.getGeneralConfig().getChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) {
// player.teleport(player.getBedSpawnLocation());
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, player.getBedSpawnLocation());
}
else {
} else {
Location spawnLocation = player.getWorld().getSpawnLocation();
if (spawnLocation.getBlock().getType() == Material.AIR) {
// player.teleport(spawnLocation);
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, spawnLocation);
}
else {
} else {
// player.teleport(player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
}

View File

@ -93,8 +93,7 @@ public final class EventUtils {
* @param entity target 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);
}
@ -111,8 +110,7 @@ public final class EventUtils {
* @param entityDamageEvent
* @return
*/
public static boolean isRealPlayerDamaged(@NotNull EntityDamageEvent entityDamageEvent)
{
public static boolean isRealPlayerDamaged(@NotNull EntityDamageEvent entityDamageEvent) {
//Make sure the damage is above 0
double damage = entityDamageEvent.getFinalDamage();
@ -143,8 +141,7 @@ public final class EventUtils {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (mcMMOPlayer == null)
{
if (mcMMOPlayer == null) {
return true;
}

View File

@ -121,8 +121,7 @@ public final class HardcoreManager {
if (totalLevelsStolen > 0) {
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));
}
else {
} else {
NotificationManager.sendPlayerInformation(killer, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Killer.Failure", victim.getName());
NotificationManager.sendPlayerInformation(victim, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Victim.Failure", killer.getName());
}

View File

@ -59,8 +59,7 @@ public class MaterialMapStore {
private final @NotNull HashMap<String, Integer> tierValue;
public MaterialMapStore()
{
public MaterialMapStore() {
abilityBlackList = new HashSet<>();
toolBlackList = new HashSet<>();
mossyWhiteList = new HashSet<>();
@ -133,8 +132,7 @@ public class MaterialMapStore {
fillTierMap();
}
public boolean isMultiBlockPlant(@NotNull Material material)
{
public boolean isMultiBlockPlant(@NotNull Material material) {
return multiBlockPlant.contains(material.getKey().getKey());
}
@ -142,38 +140,31 @@ public class MaterialMapStore {
return multiBlockHangingPlant.contains(material.getKey().getKey());
}
public boolean isAbilityActivationBlackListed(@NotNull Material material)
{
public boolean isAbilityActivationBlackListed(@NotNull Material material) {
return abilityBlackList.contains(material.getKey().getKey());
}
public boolean isToolActivationBlackListed(@NotNull Material material)
{
public boolean isToolActivationBlackListed(@NotNull Material material) {
return toolBlackList.contains(material.getKey().getKey());
}
public boolean isMossyWhiteListed(@NotNull Material material)
{
public boolean isMossyWhiteListed(@NotNull Material material) {
return mossyWhiteList.contains(material.getKey().getKey());
}
public boolean isTreeFellerDestructible(@NotNull Material material)
{
public boolean isTreeFellerDestructible(@NotNull Material material) {
return treeFellerDestructibleWhiteList.contains(material.getKey().getKey());
}
public boolean isHerbalismAbilityWhiteListed(@NotNull Material material)
{
public boolean isHerbalismAbilityWhiteListed(@NotNull Material material) {
return herbalismAbilityBlackList.contains(material.getKey().getKey());
}
public boolean isBlockCrackerWhiteListed(@NotNull Material material)
{
public boolean isBlockCrackerWhiteListed(@NotNull Material material) {
return blockCrackerWhiteList.contains(material.getKey().getKey());
}
public boolean isShroomyWhiteListed(@NotNull Material material)
{
public boolean isShroomyWhiteListed(@NotNull Material material) {
return canMakeShroomyWhiteList.contains(material.getKey().getKey());
}
@ -993,8 +984,7 @@ public class MaterialMapStore {
return foodItemWhiteList.contains(material.getKey().getKey());
}
private void fillMultiBlockPlantSet()
{
private void fillMultiBlockPlantSet() {
//Multi-Block Plants
multiBlockPlant.add("cactus");
multiBlockPlant.add("chorus_plant");
@ -1014,30 +1004,26 @@ public class MaterialMapStore {
multiBlockHangingPlant.add("cave_vines_plant");
}
private void fillShroomyWhiteList()
{
private void fillShroomyWhiteList() {
canMakeShroomyWhiteList.add("dirt");
canMakeShroomyWhiteList.add("grass_block");
canMakeShroomyWhiteList.add("dirt_path");
}
private void fillBlockCrackerWhiteList()
{
private void fillBlockCrackerWhiteList() {
blockCrackerWhiteList.add("stone_bricks");
blockCrackerWhiteList.add("infested_stone_bricks");
}
private void fillHerbalismAbilityBlackList()
{
private void fillHerbalismAbilityBlackList() {
herbalismAbilityBlackList.add("dirt");
herbalismAbilityBlackList.add("grass_block");
herbalismAbilityBlackList.add("dirt_path");
herbalismAbilityBlackList.add("farmland");
}
private void fillTreeFellerDestructibleWhiteList()
{
private void fillTreeFellerDestructibleWhiteList() {
treeFellerDestructibleWhiteList.add("oak_leaves");
treeFellerDestructibleWhiteList.add("cherry_leaves");
treeFellerDestructibleWhiteList.add("acacia_leaves");
@ -1055,8 +1041,7 @@ public class MaterialMapStore {
treeFellerDestructibleWhiteList.add("red_mushroom_block");
}
private void fillMossyWhiteList()
{
private void fillMossyWhiteList() {
mossyWhiteList.add("cobblestone");
mossyWhiteList.add("dirt");
mossyWhiteList.add("grass_path");
@ -1064,8 +1049,7 @@ public class MaterialMapStore {
mossyWhiteList.add("cobblestone_wall");
}
private void fillAbilityBlackList()
{
private void fillAbilityBlackList() {
abilityBlackList.add("warped_fence_gate");
abilityBlackList.add("crimson_fence_gate");
abilityBlackList.add("warped_pressure_plate");
@ -1192,8 +1176,7 @@ public class MaterialMapStore {
abilityBlackList.add("respawn_anchor");
}
private void fillToolBlackList()
{
private void fillToolBlackList() {
toolBlackList.add("chiseled_bookshelf");
toolBlackList.add("black_bed");
toolBlackList.add("blue_bed");
@ -1371,8 +1354,7 @@ public class MaterialMapStore {
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));
}
}

View File

@ -75,8 +75,7 @@ public final class MobHealthbarUtils {
if (updateName) {
target.setMetadata(MetadataConstants.METADATA_KEY_CUSTOM_NAME, new FixedMetadataValue(mcMMO.p, oldName));
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_NAME_VISIBILITY, new FixedMetadataValue(mcMMO.p, false));
}
@ -106,20 +105,15 @@ public final class MobHealthbarUtils {
if (healthPercentage >= 85) {
color = ChatColor.DARK_GREEN;
}
else if (healthPercentage >= 70) {
} else if (healthPercentage >= 70) {
color = ChatColor.GREEN;
}
else if (healthPercentage >= 55) {
} else if (healthPercentage >= 55) {
color = ChatColor.GOLD;
}
else if (healthPercentage >= 40) {
} else if (healthPercentage >= 40) {
color = ChatColor.YELLOW;
}
else if (healthPercentage >= 25) {
} else if (healthPercentage >= 25) {
color = ChatColor.RED;
}
else if (healthPercentage >= 0) {
} else if (healthPercentage >= 0) {
color = ChatColor.DARK_RED;
}

View File

@ -215,8 +215,7 @@ public class ModManager {
catch (Exception e) {
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
customEntity = customEntityClassMap.get(entity.getClass().getName());
}
else {
} else {
e.printStackTrace();
}
}
@ -256,8 +255,7 @@ public class ModManager {
catch (Exception e) {
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
className = entity.getClass().getName();
}
else {
} else {
e.printStackTrace();
}
}

View File

@ -118,8 +118,7 @@ public class BitSetChunkStore implements ChunkStore {
return world.getMinHeight();
}
private static int getWorldMax(@NotNull UUID worldUid)
{
private static int getWorldMax(@NotNull UUID 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?
@ -181,8 +180,7 @@ public class BitSetChunkStore implements ChunkStore {
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
// 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
// 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();
@ -207,13 +205,12 @@ public class BitSetChunkStore implements ChunkStore {
inputStream.mark(2);
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
if (inputStream.markSupported())
if (inputStream.markSupported()) {
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.
PushbackInputStream pushbackInputStream = new PushbackInputStream(inputStream, 2);
pushbackInputStream.unread((magicNumber) & 0xFF);
@ -221,9 +218,8 @@ public class BitSetChunkStore implements ChunkStore {
inputStream = new DataInputStream(pushbackInputStream);
}
return new LegacyDeserializationInputStream(inputStream).readLegacyChunkStore();
}
else if (magicNumber == STREAM_MAGIC) // Pure bytes format
{
} else if (magicNumber == STREAM_MAGIC) {
// Pure bytes format
return BitSetChunkStore.deserialize(inputStream);
}
throw new IOException("Bad Data Format");
@ -238,8 +234,7 @@ public class BitSetChunkStore implements ChunkStore {
// Handles loading the old serialized class
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 int cx;
@ -270,8 +265,7 @@ public class BitSetChunkStore implements ChunkStore {
worldMax = store[0][0].length;
}
public @NotNull BitSetChunkStore convert()
{
public @NotNull BitSetChunkStore convert() {
int currentWorldMin = getWorldMin(worldUid);
int currentWorldMax = getWorldMax(worldUid);

View File

@ -21,8 +21,7 @@ public class HashChunkManager implements ChunkManager {
@Override
public synchronized void closeAll() {
// Save all dirty chunkstores
for (ChunkStore chunkStore : chunkMap.values())
{
for (ChunkStore chunkStore : chunkMap.values()) {
if (!chunkStore.isDirty())
continue;
World world = Bukkit.getWorld(chunkStore.getWorldId());
@ -113,8 +112,8 @@ public class HashChunkManager implements ChunkManager {
CoordinateKey regionKey = toRegionKey(world.getUID(), cx, cz);
HashSet<CoordinateKey> chunkKeys = chunkUsageMap.get(regionKey);
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);
regionMap.remove(regionKey).close();
}
@ -224,8 +223,7 @@ public class HashChunkManager implements ChunkManager {
ChunkStore cStore = chunkMap.computeIfAbsent(chunkKey, k -> {
// Load from file
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);
return loaded;
}

View File

@ -181,8 +181,7 @@ public class McMMOSimpleRegionFile {
int end = start + chunkNumSegments[index];
// If we are writing, assert we don't write over any in-use segments
if (inUse)
{
if (inUse) {
int nextSetBit = segments.nextSetBit(start);
if (nextSetBit != -1 && nextSetBit < end)
throw new IllegalStateException("Attempting to overwrite an in-use segment");

View File

@ -265,8 +265,7 @@ public final class CommandUtils {
if (matches.size() == 1) {
partialName = matches.get(0);
}
}
else {
} else {
Player player = mcMMO.p.getServer().getPlayer(partialName);
if (player != null) {

View File

@ -28,8 +28,7 @@ public class ExperienceBarManager {
private HashSet<PrimarySkillType> alwaysVisible;
private HashSet<PrimarySkillType> disabledBars;
public ExperienceBarManager(McMMOPlayer mcMMOPlayer)
{
public ExperienceBarManager(McMMOPlayer mcMMOPlayer) {
this.mcMMOPlayer = mcMMOPlayer;
init();
}
@ -44,8 +43,7 @@ public class ExperienceBarManager {
disabledBars = new HashSet<>();
}
public void updateExperienceBar(PrimarySkillType primarySkillType, Plugin plugin)
{
public void updateExperienceBar(PrimarySkillType primarySkillType, Plugin plugin) {
if (disabledBars.contains(primarySkillType)
|| !ExperienceConfig.getInstance().isExperienceBarsEnabled()
|| !ExperienceConfig.getInstance().isExperienceBarEnabled(primarySkillType))
@ -65,8 +63,7 @@ public class ExperienceBarManager {
experienceBarWrapper.showExperienceBar();
//Setup Hide Bar Task
if (experienceBarHideTaskHashMap.get(primarySkillType) != null)
{
if (experienceBarHideTaskHashMap.get(primarySkillType) != null) {
experienceBarHideTaskHashMap.get(primarySkillType).cancel();
}
@ -82,14 +79,12 @@ public class ExperienceBarManager {
experienceBarHideTaskHashMap.put(primarySkillType, experienceBarHideTask);
}
public void hideExperienceBar(PrimarySkillType primarySkillType)
{
public void hideExperienceBar(PrimarySkillType primarySkillType) {
if (experienceBars.containsKey(primarySkillType))
experienceBars.get(primarySkillType).hideExperienceBar();
}
public void clearTask(PrimarySkillType primarySkillType)
{
public void clearTask(PrimarySkillType primarySkillType) {
experienceBarHideTaskHashMap.remove(primarySkillType);
}

View File

@ -29,8 +29,7 @@ public class ExperienceBarWrapper {
protected String niceSkillName;
protected String title;
public ExperienceBarWrapper(PrimarySkillType primarySkillType, McMMOPlayer mcMMOPlayer)
{
public ExperienceBarWrapper(PrimarySkillType primarySkillType, McMMOPlayer mcMMOPlayer) {
this.mcMMOPlayer = mcMMOPlayer;
this.primarySkillType = primarySkillType;
title = "";
@ -43,8 +42,7 @@ public class ExperienceBarWrapper {
initBar();
}
private void initBar()
{
private void initBar() {
title = getTitleTemplate();
createBossBar();
}
@ -115,8 +113,7 @@ public class ExperienceBarWrapper {
}
//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();
lastLevelUpdated = getLevel();
}
@ -134,23 +131,19 @@ public class ExperienceBarWrapper {
return bossBar.isVisible();
}
public void hideExperienceBar()
{
public void hideExperienceBar() {
bossBar.setVisible(false);
}
public void showExperienceBar()
{
public void showExperienceBar() {
bossBar.setVisible(true);
}
/*public NamespacedKey getKey()
{
/*public NamespacedKey getKey() {
return bossBar
}*/
private void createBossBar()
{
private void createBossBar() {
bossBar = mcMMOPlayer.getPlayer().getServer().createBossBar(
title,
ExperienceConfig.getInstance().getExperienceBarColor(primarySkillType),

View File

@ -135,8 +135,7 @@ public class FormulaManager {
* @param formulaType target formulaType
*/
private int processXPToNextLevel(int level, FormulaType formulaType) {
if (mcMMO.isRetroModeEnabled())
{
if (mcMMO.isRetroModeEnabled()) {
return processXPRetroToNextLevel(level, formulaType);
} else {
return processStandardXPToNextLevel(level, formulaType);

View File

@ -80,15 +80,12 @@ public class PlatformManager {
return ServerSoftwareType.CRAFT_BUKKIT;
}
public ServerSoftwareType getServerSoftware()
{
public ServerSoftwareType getServerSoftware() {
return platform.getServerSoftwareType();
}
public String getServerSoftwareStr()
{
switch(getServerSoftware())
{
public String getServerSoftwareStr() {
switch(getServerSoftware()) {
case PAPER:
return "Paper";
case SPIGOT:

View File

@ -43,8 +43,7 @@ public class NotificationManager {
* @param notificationType notifications defined type
* @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())
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)
return false;
else
@ -77,13 +75,11 @@ public class NotificationManager {
* @param values values to be injected into the locale string
*/
public static void sendNearbyPlayersInformation(Player targetPlayer, NotificationType notificationType, String key,
String... values)
{
String... 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())
return;
@ -91,8 +87,7 @@ public class NotificationManager {
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())
return;
@ -102,8 +97,7 @@ public class NotificationManager {
}
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key,
String... values)
{
String... values) {
if (UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
return;
@ -156,8 +150,7 @@ public class NotificationManager {
* @param newLevel new level of that skill
*/
public static void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkillType skillName,
int levelsGained, int newLevel)
{
int levelsGained, int newLevel) {
if (!mcMMOPlayer.useChatNotifications())
return;
@ -176,16 +169,13 @@ public class NotificationManager {
sendNotification(mcMMOPlayer.getPlayer(), customEvent);
}
public static void broadcastTitle(Server server, String title, String subtitle, int i1, int i2, int i3)
{
for(Player player : server.getOnlinePlayers())
{
public static void broadcastTitle(Server server, String title, String subtitle, int i1, int i2, int i3) {
for(Player player : server.getOnlinePlayers()) {
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())
return;
@ -208,10 +198,8 @@ public class NotificationManager {
if (!mcMMO.p.getGeneralConfig().adminNotifications())
return;
for(Player player : Bukkit.getServer().getOnlinePlayers())
{
if (player.isOp() || Permissions.adminChat(player))
{
for(Player player : Bukkit.getServer().getOnlinePlayers()) {
if (player.isOp() || Permissions.adminChat(player)) {
player.sendMessage(LocaleLoader.getString("Notifications.Admin.Format.Others", msg));
}
}
@ -241,15 +229,13 @@ public class NotificationManager {
*/
String senderName = LocaleLoader.getString("Server.ConsoleName");
if (commandSender instanceof Player)
{
if (commandSender instanceof Player) {
senderName = ((Player) commandSender).getDisplayName()
+ ChatColor.RESET + "-" + ((Player) commandSender).getUniqueId();
}
//Send the notification
switch(sensitiveCommandType)
{
switch(sensitiveCommandType) {
case XPRATE_MODIFY:
sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.Start.Others",
addItemToFirstPositionOfArray(senderName, args)));

View File

@ -30,8 +30,7 @@ public class PlayerLevelUtils {
// }
// }
public int getEarlyGameCutoff(PrimarySkillType primarySkillType)
{
public int getEarlyGameCutoff(PrimarySkillType primarySkillType) {
return 1;
}

View File

@ -84,13 +84,11 @@ public final class UserManager {
mcMMO.p.getLogger().info("Saving mcMMOPlayers... (" + trackedSyncData.size() + ")");
for (McMMOPlayer playerData : trackedSyncData) {
try
{
try {
LogUtils.debug(mcMMO.p.getLogger(), "Saving data for player: "+playerData.getPlayerName());
playerData.getProfile().save(true);
}
catch (Exception e)
{
catch (Exception e) {
mcMMO.p.getLogger().warning("Could not save mcMMO player data for player: " + playerData.getPlayerName());
}
}

View File

@ -155,8 +155,7 @@ public class ScoreboardManager {
private static String formatAbility(ChatColor color, String abilityName) {
if (mcMMO.p.getGeneralConfig().getShowAbilityNames()) {
return getShortenedName(color + abilityName);
}
else {
} else {
return color + LocaleLoader.getString("Scoreboard.Misc.Ability");
}
}
@ -553,8 +552,7 @@ public class ScoreboardManager {
public static void changeScoreboard(ScoreboardWrapper wrapper, int displayTime) {
if (displayTime == -1) {
wrapper.showBoardWithNoRevert();
}
else {
} else {
wrapper.showBoardAndScheduleRevert(displayTime * Misc.TICK_CONVERSION_FACTOR);
}
}

View File

@ -112,8 +112,7 @@ public class ScoreboardWrapper {
// Stop updating if it's no longer something displaying cooldowns
if (isBoardShown() && (isSkillScoreboard() || isCooldownScoreboard())) {
doSidebarUpdateSoon();
}
else {
} else {
stopCooldownUpdating();
}
}
@ -179,8 +178,7 @@ public class ScoreboardWrapper {
if (mcMMO.p.getServer().getScoreboardManager() != null)
this.oldBoard = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard();
}
}
else {
} else {
this.oldBoard = previousBoard;
}
}
@ -231,8 +229,7 @@ public class ScoreboardWrapper {
if (!tippedKeep) {
tippedKeep = true;
player.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Tip.Keep"));
}
else if (!tippedClear) {
} else if (!tippedClear) {
tippedClear = true;
player.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Tip.Clear"));
profile.increaseTipsShown();
@ -257,8 +254,7 @@ public class ScoreboardWrapper {
//Modify the player based on the event
event.getTargetPlayer().setScoreboard(event.getTargetBoard());
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!)");
}
}
@ -493,8 +489,7 @@ public class ScoreboardWrapper {
sidebarObjective.getScore(ScoreboardManager.LABEL_CURRENT_XP).setScore(currentXP);
sidebarObjective.getScore(ScoreboardManager.LABEL_REMAINING_XP).setScore(mcMMOPlayer.getXpToLevel(targetSkill) - currentXP);
}
else {
} else {
for (PrimarySkillType parentSkill : mcMMO.p.getSkillTools().getChildSkillParents(targetSkill)) {
sidebarObjective.getScore(ScoreboardManager.skillLabels.get(parentSkill)).setScore(mcMMOPlayer.getSkillLevel(parentSkill));
}
@ -516,8 +511,7 @@ public class ScoreboardWrapper {
cooldownBM.setScore(secondsBM);
stopUpdating = (secondsSB == 0 && secondsBM == 0);
}
else {
} else {
SuperAbilityType ability = mcMMO.p.getSkillTools().getSuperAbility(targetSkill);
Score cooldown = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(ability));
int seconds = Math.max(mcMMOPlayer.calculateTimeRemaining(ability), 0);
@ -529,8 +523,7 @@ public class ScoreboardWrapper {
if (stopUpdating) {
stopCooldownUpdating();
}
else {
} else {
startCooldownUpdating();
}
}
@ -551,8 +544,7 @@ public class ScoreboardWrapper {
if (anyCooldownsActive) {
startCooldownUpdating();
}
else {
} else {
stopCooldownUpdating();
}
break;
@ -563,11 +555,9 @@ public class ScoreboardWrapper {
if (targetProfile != null) {
newProfile = targetProfile; // offline
}
else if (targetPlayer == null) {
} else if (targetPlayer == null) {
newProfile = mcMMOPlayer.getProfile(); // self
}
else {
} else {
newProfile = UserManager.getPlayer(targetPlayer).getProfile(); // online
}

View File

@ -77,8 +77,7 @@ public final class CombatUtils {
}
//Add Stab Damage
if (swordsManager.canUseStab())
{
if (swordsManager.canUseStab()) {
boostedDamage += (swordsManager.getStabDamage() * mcMMOPlayer.getAttackStrength());
}
@ -86,8 +85,7 @@ public final class CombatUtils {
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());
}
@ -264,8 +262,7 @@ public final class CombatUtils {
if (axesManager.canImpact(target)) {
axesManager.impactCheck(target);
}
else if (axesManager.canGreaterImpact(target)) {
} else if (axesManager.canGreaterImpact(target)) {
boostedDamage+=axesManager.greaterImpact(target);
}
@ -277,8 +274,7 @@ public final class CombatUtils {
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());
}
@ -320,8 +316,7 @@ public final class CombatUtils {
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());
}
@ -394,8 +389,7 @@ public final class CombatUtils {
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);
}
@ -494,8 +488,7 @@ public final class CombatUtils {
processSwordCombat(target, player, event);
}
}
else if (ItemUtils.isAxe(heldItem)) {
} else if (ItemUtils.isAxe(heldItem)) {
if (!mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.AXES, target)) {
return;
}
@ -503,8 +496,7 @@ public final class CombatUtils {
if (mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.AXES)) {
processAxeCombat(target, player, event);
}
}
else if (ItemUtils.isUnarmed(heldItem)) {
} else if (ItemUtils.isUnarmed(heldItem)) {
if (!mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.UNARMED, target)) {
return;
}
@ -512,8 +504,7 @@ public final class CombatUtils {
if (mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.UNARMED)) {
processUnarmedCombat(target, player, event);
}
}
else if (ItemUtils.isTrident(heldItem)) {
} else if (ItemUtils.isTrident(heldItem)) {
if (!mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.TRIDENTS, target)) {
return;
}
@ -521,8 +512,7 @@ public final class CombatUtils {
if (mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.TRIDENTS)) {
processTridentCombatMelee(target, player, event);
}
}
else if (ItemUtils.isMace(heldItem)) {
} else if (ItemUtils.isMace(heldItem)) {
if (!mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.MACES, target)) {
return;
}
@ -543,8 +533,7 @@ public final class CombatUtils {
processTamingCombat(target, master, wolf, event);
}
}
}
else if (painSource instanceof Trident trident) {
} else if (painSource instanceof Trident trident) {
ProjectileSource projectileSource = trident.getShooter();
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();
boolean isCrossbow = arrow.isShotFromCrossbow();
if (projectileSource instanceof Player player) {
@ -590,8 +578,7 @@ public final class CombatUtils {
* This cleans up names from displaying in chat as hearts
* @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);
if (metadataValue.size() <= 0)
@ -887,37 +874,27 @@ public final class CombatUtils {
&& SkillUtils.cooldownExpired(mcMMOPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)) {
baseXP = 20 * ExperienceConfig.getInstance().getPlayerVersusPlayerXP();
}
}
else {
} else {
if (mcMMO.getModManager().isCustomEntity(target)) {
baseXP = mcMMO.getModManager().getEntity(target).getXpMultiplier();
}
else if (target instanceof Animals) {
} else if (target instanceof Animals) {
EntityType type = target.getType();
baseXP = ExperienceConfig.getInstance().getAnimalsXP(type);
}
else if (target instanceof Monster)
{
} else if (target instanceof Monster) {
EntityType type = target.getType();
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
}
else {
} else {
EntityType type = target.getType();
if (ExperienceConfig.getInstance().hasCombatXP(type)) {
if (type == EntityType.IRON_GOLEM)
{
if (type == EntityType.IRON_GOLEM) {
if (!((IronGolem) target).isPlayerCreated()) {
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
}
}
else
{
} else {
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
}
}
else
{
} else {
baseXP = 1.0;
mcMMO.getModManager().addCustomEntity(target);
}
@ -1036,22 +1013,17 @@ public final class CombatUtils {
if (ItemUtils.isWoodTool(inHand)) {
tier = 1;
}
else if (ItemUtils.isStoneTool(inHand)) {
} else if (ItemUtils.isStoneTool(inHand)) {
tier = 2;
}
else if (ItemUtils.isIronTool(inHand)) {
} else if (ItemUtils.isIronTool(inHand)) {
tier = 3;
}
else if (ItemUtils.isGoldTool(inHand)) {
} else if (ItemUtils.isGoldTool(inHand)) {
tier = 1;
}
else if (ItemUtils.isDiamondTool(inHand)) {
} else if (ItemUtils.isDiamondTool(inHand)) {
tier = 4;
} else if (ItemUtils.isNetheriteTool(inHand)) {
tier = 5;
}
else if (mcMMO.getModManager().isCustomTool(inHand)) {
} else if (mcMMO.getModManager().isCustomTool(inHand)) {
tier = mcMMO.getModManager().getTool(inHand).getTier();
}

View File

@ -19,11 +19,9 @@ public final class PerksUtils {
public static int handleCooldownPerks(Player player, int cooldown) {
if (Permissions.halvedCooldowns(player)) {
cooldown *= 0.5;
}
else if (Permissions.thirdedCooldowns(player)) {
} else if (Permissions.thirdedCooldowns(player)) {
cooldown *= (2.0 / 3.0);
}
else if (Permissions.quarteredCooldowns(player)) {
} else if (Permissions.quarteredCooldowns(player)) {
cooldown *= 0.75;
}
@ -37,11 +35,9 @@ public final class PerksUtils {
if (Permissions.twelveSecondActivationBoost(player)) {
ticks += 12;
}
else if (Permissions.eightSecondActivationBoost(player)) {
} else if (Permissions.eightSecondActivationBoost(player)) {
ticks += 8;
}
else if (Permissions.fourSecondActivationBoost(player)) {
} else if (Permissions.fourSecondActivationBoost(player)) {
ticks += 4;
}
@ -59,26 +55,19 @@ public final class PerksUtils {
}
modifier = ExperienceConfig.getInstance().getCustomXpPerkBoost();
}
else if (Permissions.quadrupleXp(player, skill)) {
} else if (Permissions.quadrupleXp(player, skill)) {
modifier = 4;
}
else if (Permissions.tripleXp(player, skill)) {
} else if (Permissions.tripleXp(player, skill)) {
modifier = 3;
}
else if (Permissions.doubleAndOneHalfXp(player, skill)) {
} else if (Permissions.doubleAndOneHalfXp(player, skill)) {
modifier = 2.5;
}
else if (Permissions.doubleXp(player, skill)) {
} else if (Permissions.doubleXp(player, skill)) {
modifier = 2;
}
else if (Permissions.oneAndOneHalfXp(player, skill)) {
} else if (Permissions.oneAndOneHalfXp(player, skill)) {
modifier = 1.5;
}
else if (Permissions.oneAndAQuarterXp(player, skill)) {
} else if (Permissions.oneAndAQuarterXp(player, skill)) {
modifier = 1.25;
}
else if (Permissions.oneAndOneTenthXp(player, skill)) {
} else if (Permissions.oneAndOneTenthXp(player, skill)) {
modifier = 1.1;
}

Some files were not shown because too many files have changed in this diff Show More