if( -> if (

This commit is contained in:
nossr50 2024-05-12 14:13:34 -07:00
parent 435a6fde34
commit 291effdbc8
163 changed files with 1116 additions and 1116 deletions

View File

@ -83,8 +83,8 @@ public final class AbilityAPI {
}
public static boolean isBleeding(LivingEntity entity) {
if(entity.isValid()) {
if(entity.hasMetadata(MetadataConstants.METADATA_KEY_RUPTURE)) {
if (entity.isValid()) {
if (entity.hasMetadata(MetadataConstants.METADATA_KEY_RUPTURE)) {
return true;
}
}

View File

@ -516,7 +516,7 @@ public final class ExperienceAPI {
}
public static float getOfflineXPRaw(@NotNull OfflinePlayer offlinePlayer, @NotNull PrimarySkillType skillType) throws InvalidPlayerException, UnsupportedOperationException {
if(SkillTools.isChildSkill(skillType))
if (SkillTools.isChildSkill(skillType))
throw new UnsupportedOperationException();
return getOfflineProfile(offlinePlayer).getSkillXpLevelRaw(skillType);
@ -1149,7 +1149,7 @@ public final class ExperienceAPI {
{
for(PrimarySkillType skillType : PrimarySkillType.values())
{
if(ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
{
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
}
@ -1167,7 +1167,7 @@ public final class ExperienceAPI {
{
for(BlockState bs : blockStates)
{
if(ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
{
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
}
@ -1183,7 +1183,7 @@ public final class ExperienceAPI {
{
for(PrimarySkillType skillType : PrimarySkillType.values())
{
if(ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
{
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
}
@ -1198,7 +1198,7 @@ public final class ExperienceAPI {
*/
public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType)
{
if(ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
{
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
}

View File

@ -50,7 +50,7 @@ public final class PartyAPI {
* @return true if the player is in a party, false otherwise
*/
public static boolean inParty(Player player) {
if(!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
if (!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
return false;
return UserManager.getPlayer(player).inParty();
@ -94,14 +94,14 @@ public final class PartyAPI {
*/
@Deprecated
public static void addToParty(Player player, String partyName) {
if(!mcMMO.p.getPartyConfig().isPartyEnabled()) {
if (!mcMMO.p.getPartyConfig().isPartyEnabled()) {
return;
}
//Check if player profile is loaded
final McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(mmoPlayer == null)
if (mmoPlayer == null)
return;
Party party = mcMMO.p.getPartyManager().getParty(partyName);
@ -109,7 +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;
@ -140,7 +140,7 @@ public final class PartyAPI {
*/
public static void addToParty(Player player, String partyName, boolean bypassLimit) {
//Check if player profile is loaded
if(!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
if (!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
return;
Party party = mcMMO.p.getPartyManager().getParty(partyName);
@ -161,7 +161,7 @@ public final class PartyAPI {
*/
public static void removeFromParty(Player player) {
//Check if player profile is loaded
if(!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
if (!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
return;
mcMMO.p.getPartyManager().removeFromParty(UserManager.getPlayer(player));
@ -176,7 +176,7 @@ public final class PartyAPI {
* @return the leader of the party
*/
public static @Nullable String getPartyLeader(String partyName) {
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
if (!mcMMO.p.getPartyConfig().isPartyEnabled())
return null;
return mcMMO.p.getPartyManager().getPartyLeaderName(partyName);
@ -192,7 +192,7 @@ public final class PartyAPI {
*/
@Deprecated
public static void setPartyLeader(String partyName, String playerName) {
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
if (!mcMMO.p.getPartyConfig().isPartyEnabled())
return;
mcMMO.p.getPartyManager().setPartyLeader(mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(), mcMMO.p.getPartyManager().getParty(partyName));
@ -208,7 +208,7 @@ public final class PartyAPI {
*/
@Deprecated
public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
if(!mcMMO.p.getPartyConfig().isPartyEnabled()) {
if (!mcMMO.p.getPartyConfig().isPartyEnabled()) {
return null;
}
@ -230,7 +230,7 @@ public final class PartyAPI {
*/
@Deprecated
public static LinkedHashSet<String> getMembers(Player player) {
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
if (!mcMMO.p.getPartyConfig().isPartyEnabled())
return null;
return (LinkedHashSet<String>) mcMMO.p.getPartyManager().getAllMembers(player).values();
@ -245,7 +245,7 @@ public final class PartyAPI {
* @return all the player names and uuids in the player's party
*/
public static LinkedHashMap<UUID, String> getMembersMap(Player player) {
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
if (!mcMMO.p.getPartyConfig().isPartyEnabled())
return null;
return mcMMO.p.getPartyManager().getAllMembers(player);
@ -260,7 +260,7 @@ public final class PartyAPI {
* @return all online players in this party
*/
public static List<Player> getOnlineMembers(String partyName) {
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
if (!mcMMO.p.getPartyConfig().isPartyEnabled())
return null;
return mcMMO.p.getPartyManager().getOnlineMembers(partyName);

View File

@ -125,7 +125,7 @@ public class ChatManager {
* @param targetChatChannel target chat channel
*/
public void setOrToggleChatChannel(@NotNull McMMOPlayer mmoPlayer, @NotNull ChatChannel targetChatChannel) {
if(targetChatChannel == mmoPlayer.getChatChannel()) {
if (targetChatChannel == mmoPlayer.getChatChannel()) {
//Disabled message
mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Chat.Channel.Off", StringUtils.getCapitalized(targetChatChannel.toString())));
mmoPlayer.setChatMode(ChatChannel.NONE);
@ -144,7 +144,7 @@ public class ChatManager {
StringBuilder stringBuilder = new StringBuilder();
for(int i = 0; i < args.length; i++) {
if(i + 1 >= args.length) {
if (i + 1 >= args.length) {
stringBuilder.append(args[i]);
} else {
stringBuilder.append(args[i]).append(" ");
@ -162,12 +162,12 @@ public class ChatManager {
public boolean isMessageAllowed(@NotNull McMMOPlayer mmoPlayer) {
switch (mmoPlayer.getChatChannel()) {
case ADMIN:
if(mmoPlayer.getPlayer().isOp() || Permissions.adminChat(mmoPlayer.getPlayer())) {
if (mmoPlayer.getPlayer().isOp() || Permissions.adminChat(mmoPlayer.getPlayer())) {
return true;
}
break;
case PARTY:
if(mmoPlayer.getParty() != null && Permissions.partyChat(mmoPlayer.getPlayer())) {
if (mmoPlayer.getParty() != null && Permissions.partyChat(mmoPlayer.getPlayer())) {
return true;
}
break;
@ -206,7 +206,7 @@ public class ChatManager {
* @return true if the chat channel is enabled
*/
public boolean isChatChannelEnabled(@NotNull ChatChannel chatChannel) {
if(!isChatEnabled) {
if (!isChatEnabled) {
return false;
} else {
switch(chatChannel) {

View File

@ -20,12 +20,12 @@ public class SamePartyPredicate<T extends CommandSender> implements Predicate<T>
@Override
public boolean test(T t) {
//Include the console in the audience
if(t instanceof ConsoleCommandSender) {
if (t instanceof ConsoleCommandSender) {
return false; //Party audiences are special, we exclude console from them to avoid double messaging since we send a more verbose version to consoles
} else {
if(t instanceof Player player) {
if (t instanceof Player player) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if(mcMMOPlayer != null) {
if (mcMMOPlayer != null) {
return mcMMOPlayer.getParty() == party;
}
}

View File

@ -48,15 +48,15 @@ public abstract class AbstractPlayerAuthor implements Author {
*/
protected @NotNull String getSanitizedName(@NotNull ChatChannel chatChannel, boolean useDisplayName) {
//Already in cache
if(sanitizedNameCache.containsKey(chatChannel)) {
if (sanitizedNameCache.containsKey(chatChannel)) {
//Update cache
if(useDisplayName && hasPlayerDisplayNameChanged()) {
if (useDisplayName && hasPlayerDisplayNameChanged()) {
updateLastKnownDisplayName();
updateSanitizedNameCache(chatChannel, true);
}
} else {
//Update last known display name
if(useDisplayName && hasPlayerDisplayNameChanged()) {
if (useDisplayName && hasPlayerDisplayNameChanged()) {
updateLastKnownDisplayName();
}
@ -76,7 +76,7 @@ public abstract class AbstractPlayerAuthor implements Author {
* @param useDisplayName whether to use this authors display name
*/
private void updateSanitizedNameCache(@NotNull ChatChannel chatChannel, boolean useDisplayName) {
if(useDisplayName) {
if (useDisplayName) {
sanitizedNameCache.put(chatChannel, TextUtils.sanitizeForSerializer(player.getDisplayName()));
} else {
//No need to sanitize a basic String

View File

@ -57,7 +57,7 @@ public class AdminChatMailer extends AbstractChatMailer {
* @return the styled string, based on a locale entry
*/
public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor) {
if(canColor) {
if (canColor) {
return LocaleLoader.getTextComponent("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), message);
} else {
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), message));
@ -83,7 +83,7 @@ public class AdminChatMailer extends AbstractChatMailer {
McMMOChatEvent chatEvent = new McMMOAdminChatEvent(pluginRef, chatMessage, isAsync);
Bukkit.getPluginManager().callEvent(chatEvent);
if(!chatEvent.isCancelled()) {
if (!chatEvent.isCancelled()) {
sendMail(chatMessage);
}
}

View File

@ -36,7 +36,7 @@ public class PartyChatMailer extends AbstractChatMailer {
McMMOChatEvent chatEvent = new McMMOPartyChatEvent(pluginRef, chatMessage, party, isAsync);
Bukkit.getPluginManager().callEvent(chatEvent);
if(!chatEvent.isCancelled()) {
if (!chatEvent.isCancelled()) {
sendMail(chatMessage);
}
}
@ -60,14 +60,14 @@ public class PartyChatMailer extends AbstractChatMailer {
* @return the styled string, based on a locale entry
*/
public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor, boolean isLeader) {
if(canColor) {
if(isLeader) {
if (canColor) {
if (isLeader) {
return LocaleLoader.getTextComponent("Chat.Style.Party.Leader", author.getAuthoredName(ChatChannel.PARTY), message);
} else {
return LocaleLoader.getTextComponent("Chat.Style.Party", author.getAuthoredName(ChatChannel.PARTY), message);
}
} else {
if(isLeader) {
if (isLeader) {
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Party.Leader", author.getAuthoredName(ChatChannel.PARTY), message));
} else {
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Party", author.getAuthoredName(ChatChannel.PARTY), message));

View File

@ -52,7 +52,7 @@ public class PartyChatMessage extends AbstractChatMessage {
messagePartyChatSpies(spyMessage);
//Console message
if(ChatConfig.getInstance().isConsoleIncludedInAudience(ChatChannel.PARTY))
if (ChatConfig.getInstance().isConsoleIncludedInAudience(ChatChannel.PARTY))
mcMMO.p.getChatManager().sendConsoleMessage(author, spyMessage);
}
@ -67,11 +67,11 @@ public class PartyChatMessage extends AbstractChatMessage {
Player player = mcMMOPlayer.getPlayer();
//Check for toggled players
if(mcMMOPlayer.isPartyChatSpying()) {
if (mcMMOPlayer.isPartyChatSpying()) {
Party adminParty = mcMMOPlayer.getParty();
//Only message admins not part of this party
if(adminParty == null || adminParty != getParty()) {
if (adminParty == null || adminParty != getParty()) {
//TODO: Hacky, rewrite later
Audience audience = mcMMO.getAudiences().player(player);
audience.sendMessage(spyMessage);

View File

@ -47,7 +47,7 @@ public class CommandManager {
}
private void registerSkillCommands() {
if(mcMMO.p.getGeneralConfig().isMasterySystemEnabled()) {
if (mcMMO.p.getGeneralConfig().isMasterySystemEnabled()) {
bukkitCommandManager.registerCommand(new PowerLevelCommand(pluginRef));
}
}
@ -56,11 +56,11 @@ public class CommandManager {
* Registers chat commands if the chat system is enabled
*/
private void registerChatCommands() {
if(ChatConfig.getInstance().isChatEnabled()) {
if(ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.ADMIN)) {
if (ChatConfig.getInstance().isChatEnabled()) {
if (ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.ADMIN)) {
bukkitCommandManager.registerCommand(new AdminChatCommand(pluginRef));
}
if(pluginRef.getPartyConfig().isPartyEnabled() && ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.PARTY)) {
if (pluginRef.getPartyConfig().isPartyEnabled() && ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.PARTY)) {
bukkitCommandManager.registerCommand(new PartyChatCommand(pluginRef));
}
}
@ -75,7 +75,7 @@ public class CommandManager {
bukkitCommandManager.getCommandConditions().addCondition(POWER_LEVEL_CONDITION, (context) -> {
BukkitCommandIssuer issuer = context.getIssuer();
if(issuer.getIssuer() instanceof Player) {
if (issuer.getIssuer() instanceof Player) {
validateLoadedData(issuer.getPlayer());
} else {
throw new ConditionFailedException(LocaleLoader.getString("Commands.NoConsole"));
@ -88,7 +88,7 @@ public class CommandManager {
bukkitCommandManager.getCommandConditions().addCondition(ADMIN_CONDITION, (context) -> {
BukkitCommandIssuer issuer = context.getIssuer();
if(issuer.getIssuer() instanceof Player) {
if (issuer.getIssuer() instanceof Player) {
validateLoadedData(issuer.getPlayer());
validateAdmin(issuer.getPlayer());
}
@ -97,7 +97,7 @@ public class CommandManager {
bukkitCommandManager.getCommandConditions().addCondition(MMO_DATA_LOADED, (context) -> {
BukkitCommandIssuer bukkitCommandIssuer = context.getIssuer();
if(bukkitCommandIssuer.getIssuer() instanceof Player) {
if (bukkitCommandIssuer.getIssuer() instanceof Player) {
validateLoadedData(bukkitCommandIssuer.getPlayer());
}
});
@ -105,7 +105,7 @@ public class CommandManager {
bukkitCommandManager.getCommandConditions().addCondition(PARTY_CONDITION, (context) -> {
BukkitCommandIssuer bukkitCommandIssuer = context.getIssuer();
if(bukkitCommandIssuer.getIssuer() instanceof Player) {
if (bukkitCommandIssuer.getIssuer() instanceof Player) {
validateLoadedData(bukkitCommandIssuer.getPlayer());
validatePlayerParty(bukkitCommandIssuer.getPlayer());
//TODO: Is there even a point in validating permission? look into this later
@ -115,20 +115,20 @@ public class CommandManager {
}
private void validatePermission(@NotNull String permissionNode, @NotNull Permissible permissible) {
if(!permissible.hasPermission(permissionNode)) {
if (!permissible.hasPermission(permissionNode)) {
throw new ConditionFailedException(LocaleLoader.getString("mcMMO.NoPermission"));
}
}
public void validateAdmin(@NotNull Player player) {
if(!player.isOp() && !Permissions.adminChat(player)) {
if (!player.isOp() && !Permissions.adminChat(player)) {
throw new ConditionFailedException("You are lacking the correct permissions to use this command.");
}
}
public void validateLoadedData(@NotNull Player player) {
if(UserManager.getPlayer(player) == null) {
if (UserManager.getPlayer(player) == null) {
throw new ConditionFailedException(LocaleLoader.getString("Profile.PendingLoad"));
}
}
@ -136,7 +136,7 @@ public class CommandManager {
public void validatePlayerParty(@NotNull Player player) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(!pluginRef.getPartyConfig().isPartyEnabled() || mmoPlayer.getParty() == null) {
if (!pluginRef.getPartyConfig().isPartyEnabled() || mmoPlayer.getParty() == null) {
throw new ConditionFailedException(LocaleLoader.getString("Commands.Party.None"));
}
}

View File

@ -72,7 +72,7 @@ public class McmmoCommand implements CommandExecutor {
private void displayOtherCommands(CommandSender sender) {
//Don't show them this category if they have none of the permissions
if(!Permissions.skillreset(sender) && !Permissions.mmoedit(sender) && !Permissions.adminChat(sender) && !Permissions.mcgod(sender))
if (!Permissions.skillreset(sender) && !Permissions.mmoedit(sender) && !Permissions.adminChat(sender) && !Permissions.mcgod(sender))
return;
sender.sendMessage(LocaleLoader.getString("Commands.Other"));

View File

@ -23,12 +23,12 @@ public class McscoreboardCommand implements TabExecutor {
return true;
}
if(!mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
if (!mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
sender.sendMessage(LocaleLoader.getString("Scoreboard.Disabled"));
return true;
}
if(!ScoreboardManager.isPlayerBoardSetup(sender.getName())) {
if (!ScoreboardManager.isPlayerBoardSetup(sender.getName())) {
sender.sendMessage(LocaleLoader.getString("Scoreboard.NotSetupYet"));
return true;
}

View File

@ -37,7 +37,7 @@ 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"),
@ -45,7 +45,7 @@ public class XprateCommand implements TabExecutor {
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"));
@ -82,7 +82,7 @@ public class XprateCommand implements TabExecutor {
int newXpRate = Integer.parseInt(args[0]);
if(newXpRate < 0)
if (newXpRate < 0)
{
sender.sendMessage(ChatColor.RED+LocaleLoader.getString("Commands.NegativeNumberWarn"));
return true;
@ -90,7 +90,7 @@ public class XprateCommand implements TabExecutor {
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
if(mcMMO.p.getAdvancedConfig().useTitlesForXPEvent())
if (mcMMO.p.getAdvancedConfig().useTitlesForXPEvent())
{
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
LocaleLoader.getString("Commands.Event.Start"),
@ -98,7 +98,7 @@ public class XprateCommand implements TabExecutor {
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

@ -17,8 +17,8 @@
//public class DropTreasureCommand implements CommandExecutor {
// @Override
// public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
// if(sender instanceof Player) {
// if(!sender.isOp()) {
// if (sender instanceof Player) {
// if (!sender.isOp()) {
// sender.sendMessage("This command is for Operators only");
// return false;
// }
@ -27,13 +27,13 @@
// Location location = player.getLocation();
// McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
//
// if(mmoPlayer == null) {
// if (mmoPlayer == null) {
// //TODO: Localize
// player.sendMessage("Your player data is not loaded yet");
// return false;
// }
//
// if(args.length == 0) {
// if (args.length == 0) {
// mcMMO.p.getLogger().info(player.toString() +" is dropping all mcMMO treasures via admin command at location "+location.toString());
// for(Rarity rarity : FishingTreasureConfig.getInstance().fishingRewards.keySet()) {
// for(FishingTreasure fishingTreasure : FishingTreasureConfig.getInstance().fishingRewards.get(rarity)) {

View File

@ -13,7 +13,7 @@ public class PlayerDebugCommand implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if(sender instanceof Player) {
if (sender instanceof Player) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
mcMMOPlayer.toggleDebugMode(); //Toggle debug mode
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.Mmodebug.Toggle", String.valueOf(mcMMOPlayer.isDebugMode()));

View File

@ -25,9 +25,9 @@ public class AdminChatCommand extends BaseCommand {
@Default @Conditions(CommandManager.ADMIN_CONDITION)
public void processCommand(String[] args) {
BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer();
if(args == null || args.length == 0) {
if (args == null || args.length == 0) {
//Process with no arguments
if(bukkitCommandIssuer.isPlayer()) {
if (bukkitCommandIssuer.isPlayer()) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
pluginRef.getChatManager().setOrToggleChatChannel(mmoPlayer, ChatChannel.ADMIN);
} else {
@ -35,10 +35,10 @@ public class AdminChatCommand extends BaseCommand {
mcMMO.p.getLogger().info("You cannot switch chat channels as console, please provide full arguments.");
}
} else {
if(bukkitCommandIssuer.isPlayer()) {
if (bukkitCommandIssuer.isPlayer()) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
if(mmoPlayer == null)
if (mmoPlayer == null)
return;
//Message contains the original command so it needs to be passed to this method to trim it

View File

@ -30,9 +30,9 @@ public class PartyChatCommand extends BaseCommand {
public void processCommand(String[] args) {
BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer();
if(args == null || args.length == 0) {
if (args == null || args.length == 0) {
//Process with no arguments
if(bukkitCommandIssuer.isPlayer()) {
if (bukkitCommandIssuer.isPlayer()) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
pluginRef.getChatManager().setOrToggleChatChannel(mmoPlayer, ChatChannel.PARTY);
} else {
@ -45,7 +45,7 @@ public class PartyChatCommand extends BaseCommand {
/*
* Player Logic
*/
if(bukkitCommandIssuer.getIssuer() instanceof Player) {
if (bukkitCommandIssuer.getIssuer() instanceof Player) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
processCommandArgsPlayer(mmoPlayer, args);
/*
@ -72,14 +72,14 @@ public class PartyChatCommand extends BaseCommand {
* @param args command arguments
*/
private void processCommandArgsConsole(@NotNull String[] args) {
if(args.length <= 1) {
if (args.length <= 1) {
//Only specific a party and not the message
mcMMO.p.getLogger().severe("You need to specify a party name and then write a message afterwards.");
} else {
//Grab party
Party targetParty = mcMMO.p.getPartyManager().getParty(args[0]);
if(targetParty != null) {
if (targetParty != null) {
pluginRef.getChatManager().processConsoleMessage(StringUtils.buildStringAfterNthElement(args, 1), targetParty);
} else {
mcMMO.p.getLogger().severe("A party with that name doesn't exist!");

View File

@ -28,7 +28,7 @@ public class ConvertDatabaseCommand implements CommandExecutor {
}
DatabaseManager oldDatabase = DatabaseManagerFactory.createDatabaseManager(previousType, mcMMO.getUsersFilePath(), mcMMO.p.getLogger(), mcMMO.p.getPurgeTime(), mcMMO.p.getAdvancedConfig().getStartingLevel());
if(oldDatabase == null) {
if (oldDatabase == null) {
sender.sendMessage("Unable to load the old database! Check your log for errors.");
return true;
}

View File

@ -35,7 +35,7 @@ public class AddlevelsCommand extends ExperienceCommand {
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(mmoPlayer == null) {
if (mmoPlayer == null) {
EventUtils.tryLevelChangeEvent(player, skill, value, xpRemoved, true, XPGainReason.COMMAND);
} else {
EventUtils.tryLevelChangeEvent(mmoPlayer, skill, value, xpRemoved, true, XPGainReason.COMMAND);
@ -45,7 +45,7 @@ public class AddlevelsCommand extends ExperienceCommand {
@Override
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
if(isSilent)
if (isSilent)
return;
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", value));
@ -53,7 +53,7 @@ public class AddlevelsCommand extends ExperienceCommand {
@Override
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
if(isSilent)
if (isSilent)
return;
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));

View File

@ -26,7 +26,7 @@ public class AddxpCommand extends ExperienceCommand {
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
if (player != null) {
//Check if player profile is loaded
if(UserManager.getPlayer(player) == null)
if (UserManager.getPlayer(player) == null)
return;
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
@ -39,7 +39,7 @@ public class AddxpCommand extends ExperienceCommand {
@Override
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
if(isSilent)
if (isSilent)
return;
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", value));
@ -47,7 +47,7 @@ public class AddxpCommand extends ExperienceCommand {
@Override
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
if(isSilent)
if (isSilent)
return;
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));

View File

@ -24,16 +24,16 @@ public abstract class ExperienceCommand implements TabExecutor {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
PrimarySkillType skill;
if(args.length < 2) {
if (args.length < 2) {
return false;
} else {
if(args.length == 2 && !isSilent(args) || args.length == 3 && isSilent(args)) {
if (args.length == 2 && !isSilent(args) || args.length == 3 && isSilent(args)) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
if (!permissionsCheckSelf(sender)) {
if(command.getPermissionMessage() != null)
if (command.getPermissionMessage() != null)
sender.sendMessage(command.getPermissionMessage());
sender.sendMessage("(mcMMO) No permission!");
return true;
@ -56,7 +56,7 @@ public abstract class ExperienceCommand implements TabExecutor {
}
//Profile not loaded
if(UserManager.getPlayer(sender.getName()) == null)
if (UserManager.getPlayer(sender.getName()) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
@ -65,7 +65,7 @@ public abstract class ExperienceCommand implements TabExecutor {
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill, Integer.parseInt(args[1]), isSilent(args));
return true;
} else if((args.length == 3 && !isSilent(args))
} else if ((args.length == 3 && !isSilent(args))
|| (args.length == 4 && isSilent(args))) {
if (!permissionsCheckOthers(sender)) {
sender.sendMessage(command.getPermissionMessage());
@ -104,7 +104,7 @@ public abstract class ExperienceCommand implements TabExecutor {
//Check loading by name
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
if(CommandUtils.unloadedProfile(sender, profile)) {
if (CommandUtils.unloadedProfile(sender, profile)) {
return true;
}
}
@ -126,7 +126,7 @@ public abstract class ExperienceCommand implements TabExecutor {
private boolean isSilent(String[] args) {
int length = args.length;
if(length == 0)
if (length == 0)
return false;
return args[length-1].equalsIgnoreCase("-s");

View File

@ -41,7 +41,7 @@ public class MmoeditCommand extends ExperienceCommand {
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(mmoPlayer != null) {
if (mmoPlayer != null) {
EventUtils.tryLevelEditEvent(mmoPlayer, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
} else {
EventUtils.tryLevelEditEvent(player, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
@ -51,7 +51,7 @@ public class MmoeditCommand extends ExperienceCommand {
@Override
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
if(isSilent)
if (isSilent)
return;
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", value));
@ -59,7 +59,7 @@ public class MmoeditCommand extends ExperienceCommand {
@Override
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
if(isSilent)
if (isSilent)
return;
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), value));

View File

@ -87,7 +87,7 @@ public class SkillresetCommand implements TabExecutor {
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
//Check if it was present in DB
if(CommandUtils.unloadedProfile(sender, profile)) {
if (CommandUtils.unloadedProfile(sender, profile)) {
return true;
}
}

View File

@ -12,7 +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,7 +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,7 +207,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,7 +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,7 +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;

View File

@ -20,7 +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;

View File

@ -34,7 +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,7 +62,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

@ -55,7 +55,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

@ -17,7 +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,7 +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,7 +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;

View File

@ -45,21 +45,21 @@ 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))
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return true;
}
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(player.getWorld()))
if (WorldBlacklist.isWorldBlacklisted(player.getWorld()))
return true;
if (!UserManager.hasPlayerDataKey(player)) {
return true;
}
if(UserManager.getPlayer((Player) sender) == null)
if (UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
@ -228,13 +228,13 @@ 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;

View File

@ -85,7 +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

@ -24,22 +24,22 @@ public class XPBarCommand implements TabExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if(sender instanceof Player) {
if (sender instanceof Player) {
McMMOPlayer mmoPlayer = UserManager.getPlayer((Player) sender);
if(mmoPlayer == null) {
if (mmoPlayer == null) {
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mmoPlayer.getPlayer(), "Profile.PendingLoad");
return false;
}
if(args.length == 0) {
if (args.length == 0) {
return false;
} else if(args.length < 2) {
} else if (args.length < 2) {
String option = args[0];
if(option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString())) {
if (option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString())) {
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(ExperienceBarManager.XPBarSettingTarget.RESET, null);
return true;
} else if(option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.DISABLE.toString())) {
} else if (option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.DISABLE.toString())) {
mmoPlayer.getExperienceBarManager().disableAllBars();
return true;
} else {
@ -50,7 +50,7 @@ public class XPBarCommand implements TabExecutor {
} else if (args.length == 2) {
String skillName = args[1];
if(SkillUtils.isSkill(skillName)) {
if (SkillUtils.isSkill(skillName)) {
PrimarySkillType targetSkill = mcMMO.p.getSkillTools().matchSkill(skillName);
@ -58,7 +58,7 @@ public class XPBarCommand implements TabExecutor {
String option = args[0].toLowerCase();
ExperienceBarManager.XPBarSettingTarget settingTarget = getSettingTarget(option);
if(settingTarget != null && settingTarget != ExperienceBarManager.XPBarSettingTarget.RESET) {
if (settingTarget != null && settingTarget != ExperienceBarManager.XPBarSettingTarget.RESET) {
//Change setting
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(settingTarget, targetSkill);
return true;
@ -103,7 +103,7 @@ public class XPBarCommand implements TabExecutor {
return StringUtil.copyPartialMatches(args[0], options, new ArrayList<>(ExperienceBarManager.XPBarSettingTarget.values().length));
case 2:
if(!args[0].equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString()))
if (!args[0].equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString()))
return StringUtil.copyPartialMatches(args[1], mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES, new ArrayList<>(mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES.size()));
default:
return ImmutableList.of();

View File

@ -54,7 +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);

View File

@ -76,7 +76,7 @@ public class ArcheryCommand extends SkillCommand {
messages.add(getStatMessage(SubSkillType.ARCHERY_SKILL_SHOT, skillShotBonus));
}
if(Permissions.canUseSubSkill(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) {
if (Permissions.canUseSubSkill(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) {
messages.add(getStatMessage(SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK, 1000))));
}

View File

@ -95,7 +95,7 @@ public class AxesCommand extends SkillCommand {
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : ""));
}
if(Permissions.canUseSubSkill(player, SubSkillType.AXES_AXES_LIMIT_BREAK)) {
if (Permissions.canUseSubSkill(player, SubSkillType.AXES_AXES_LIMIT_BREAK)) {
messages.add(getStatMessage(SubSkillType.AXES_AXES_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.AXES_AXES_LIMIT_BREAK, 1000))));
}

View File

@ -54,7 +54,7 @@ public class CrossbowsCommand extends SkillCommand {
String.valueOf(mmoPlayer.getCrossbowsManager().getTrickShotMaxBounceCount())));
}
if(Permissions.canUseSubSkill(player, CROSSBOWS_CROSSBOWS_LIMIT_BREAK)) {
if (Permissions.canUseSubSkill(player, CROSSBOWS_CROSSBOWS_LIMIT_BREAK)) {
messages.add(getStatMessage(CROSSBOWS_CROSSBOWS_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, CROSSBOWS_CROSSBOWS_LIMIT_BREAK, 1000))));
}

View File

@ -53,7 +53,7 @@ public class ExcavationCommand extends SkillCommand {
//messages.add(LocaleLoader.getString("Excavation.Effect.Length", gigaDrillBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : ""));
}
if(Permissions.canUseSubSkill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
if (Permissions.canUseSubSkill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
messages.add(getStatMessage(false, false, SubSkillType.EXCAVATION_ARCHAEOLOGY,
percent.format(excavationManager.getArchaelogyExperienceOrbChance() / 100.0D)));
messages.add(getStatMessage(true, false, SubSkillType.EXCAVATION_ARCHAEOLOGY,

View File

@ -72,7 +72,7 @@ public class FishingCommand extends SkillCommand {
}
}
if(totalEnchantChance >= 1)
if (totalEnchantChance >= 1)
magicChance = percent.format(totalEnchantChance / 100.0);
else
magicChance = percent.format(0);

View File

@ -31,7 +31,7 @@
// protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
// List<String> messages = new ArrayList<>();
//
// if(SkillUtils.canUseSubskill(player, MACES_MACES_LIMIT_BREAK)) {
// if (SkillUtils.canUseSubskill(player, MACES_MACES_LIMIT_BREAK)) {
// messages.add(getStatMessage(MACES_MACES_LIMIT_BREAK,
// String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, MACES_MACES_LIMIT_BREAK, 1000))));
// }

View File

@ -111,7 +111,7 @@ public class MiningCommand extends SkillCommand {
//messages.add(LocaleLoader.getString("Mining.Effect.DropChance", doubleDropChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
}
if(canTripleDrop) {
if (canTripleDrop) {
messages.add(getStatMessage(SubSkillType.MINING_MOTHER_LODE, tripleDropChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", tripleDropChanceLucky) : ""));
}

View File

@ -26,14 +26,14 @@ 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())
if (args == null || args.length < 1 || args[0] == null || args[0].isEmpty())
return false;
if(Permissions.mmoinfo(player))
if (Permissions.mmoinfo(player))
{
if(args[0].equalsIgnoreCase( "???"))
if (args[0].equalsIgnoreCase( "???"))
{
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", "???"));
@ -59,7 +59,7 @@ public class MmoInfoCommand implements TabExecutor {
public SubSkillType matchSubSkill(String name) {
for(SubSkillType subSkillType : SubSkillType.values())
{
if(subSkillType.getNiceNameNoSpaces(subSkillType).equalsIgnoreCase(name)
if (subSkillType.getNiceNameNoSpaces(subSkillType).equalsIgnoreCase(name)
|| subSkillType.name().equalsIgnoreCase(name))
return subSkillType;
}

View File

@ -149,7 +149,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
@ -177,7 +177,7 @@ public abstract class SkillCommand implements TabExecutor {
for(int i = 0; i < parentList.size(); i++)
{
if(i+1 < parentList.size())
if (i+1 < parentList.size())
{
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", mcMMO.p.getSkillTools().getLocalizedSkillName(parentList.get(i)), mcMMOPlayer.getSkillLevel(parentList.get(i))));
parentMessage.append(ChatColor.GRAY).append(", ");
@ -237,7 +237,7 @@ public abstract class SkillCommand implements TabExecutor {
int length;
if(abilityLengthCap <= 0)
if (abilityLengthCap <= 0)
{
length = 2 + (int) (skillValue / abilityLengthVar);
}
@ -264,7 +264,7 @@ public abstract class SkillCommand implements TabExecutor {
String templateKey = isCustom ? "Ability.Generic.Template.Custom" : "Ability.Generic.Template";
String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription();
if(isCustom)
if (isCustom)
return LocaleLoader.getString(templateKey, LocaleLoader.getString(statDescriptionKey, vars));
else
{
@ -274,7 +274,7 @@ public abstract class SkillCommand implements TabExecutor {
}
protected String getLimitBreakDescriptionParameter() {
if(mcMMO.p.getAdvancedConfig().canApplyLimitBreakPVE()) {
if (mcMMO.p.getAdvancedConfig().canApplyLimitBreakPVE()) {
return "(PVP/PVE)";
} else {
return "(PVP)";

View File

@ -101,13 +101,13 @@ 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())));
}
if(SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) {
if (SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) {
messages.add(getStatMessage(SubSkillType.SWORDS_SWORDS_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK, 1000))));
}

View File

@ -31,12 +31,12 @@ public class TridentsCommand extends SkillCommand {
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>();
if(SkillUtils.canUseSubskill(player, TRIDENTS_TRIDENTS_LIMIT_BREAK)) {
if (SkillUtils.canUseSubskill(player, TRIDENTS_TRIDENTS_LIMIT_BREAK)) {
messages.add(getStatMessage(TRIDENTS_TRIDENTS_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, TRIDENTS_TRIDENTS_LIMIT_BREAK, 1000))));
}
if(SkillUtils.canUseSubskill(player, TRIDENTS_IMPALE)) {
if (SkillUtils.canUseSubskill(player, TRIDENTS_IMPALE)) {
messages.add(getStatMessage(TRIDENTS_IMPALE,
String.valueOf(mmoPlayer.getTridentsManager().impaleDamageBonus())));
}

View File

@ -113,7 +113,7 @@ public class UnarmedCommand extends SkillCommand {
//messages.add(LocaleLoader.getString("Unarmed.Ability.Chance.IronGrip", ironGripChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", ironGripChanceLucky) : ""));
}
if(Permissions.canUseSubSkill(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) {
if (Permissions.canUseSubSkill(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) {
messages.add(getStatMessage(SubSkillType.UNARMED_UNARMED_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK, 1000))));
}

View File

@ -40,7 +40,7 @@ public class WoodcuttingCommand extends SkillCommand {
}
//Clean Cuts
if(canTripleDrop) {
if (canTripleDrop) {
String[] tripleDropStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.WOODCUTTING_CLEAN_CUTS);
tripleDropChance = tripleDropStrings[0];
tripleDropChanceLucky = tripleDropStrings[1];
@ -80,7 +80,7 @@ public class WoodcuttingCommand extends SkillCommand {
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
}
if(canTripleDrop) {
if (canTripleDrop) {
messages.add(getStatMessage(SubSkillType.WOODCUTTING_CLEAN_CUTS, tripleDropChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", tripleDropChanceLucky) : ""));
}
@ -89,7 +89,7 @@ public class WoodcuttingCommand extends SkillCommand {
if (canKnockOnWood) {
String lootNote;
if(RankUtils.hasReachedRank(2, player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
if (RankUtils.hasReachedRank(2, player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
lootNote = LocaleLoader.getString("Woodcutting.SubSkill.KnockOnWood.Loot.Rank2");
} else {
lootNote = LocaleLoader.getString("Woodcutting.SubSkill.KnockOnWood.Loot.Normal");

View File

@ -52,7 +52,7 @@ public abstract class BukkitConfig {
try {
config.save(configFile);
if(copyDefaults && !savedDefaults) {
if (copyDefaults && !savedDefaults) {
copyMissingDefaultsFromResource();
savedDefaults = true;
}
@ -84,7 +84,7 @@ public abstract class BukkitConfig {
YamlConfiguration saveDefaultConfigToDisk() {
LogUtils.debug(mcMMO.p.getLogger(), "Copying default config to disk: " + fileName + " to defaults/" + fileName);
try(InputStream inputStream = mcMMO.p.getResource(fileName)) {
if(inputStream == null) {
if (inputStream == null) {
mcMMO.p.getLogger().severe("Unable to copy default config: " + fileName);
return null;
}

View File

@ -73,7 +73,7 @@ public class WorldBlacklist {
closeRead(fileReader);
}
if(blacklist.size() > 0)
if (blacklist.size() > 0)
plugin.getLogger().info(blacklist.size() + " entries in mcMMO World Blacklist");
}

View File

@ -195,10 +195,10 @@ public class PotionConfig extends LegacyConfigLoader {
PotionUtil.setBasePotionType(potionMeta, potionType, extended, upgraded);
// // Use the name of the potion to indicate upgrade status if not set in PotionData
// if(convertPotionConfigName(key).toUpperCase().contains("STRONG"))
// if (convertPotionConfigName(key).toUpperCase().contains("STRONG"))
// upgraded = true;
//
// if(convertPotionConfigName(key).toUpperCase().contains("LONG"))
// if (convertPotionConfigName(key).toUpperCase().contains("LONG"))
// extended = true;
List<String> lore = new ArrayList<>();

View File

@ -20,7 +20,7 @@ public class RepairConfigManager {
repairables.addAll(mainRepairConfig.getLoadedRepairables());
for (String fileName : dataFolder.list()) {
if(fileName.equals(REPAIR_VANILLA_YML))
if (fileName.equals(REPAIR_VANILLA_YML))
continue;
if (!pattern.matcher(fileName).matches()) {

View File

@ -21,7 +21,7 @@ public class SalvageConfigManager {
salvageables.addAll(mainSalvageConfig.getLoadedSalvageables());
for (String fileName : dataFolder.list()) {
if(fileName.equals(SALVAGE_VANILLA_YML))
if (fileName.equals(SALVAGE_VANILLA_YML))
continue;
if (!pattern.matcher(fileName).matches()) {

View File

@ -50,7 +50,7 @@ public class FishingTreasureConfig extends BukkitConfig {
List<String> reason = new ArrayList<>();
ConfigurationSection enchantment_drop_rates = config.getConfigurationSection("Enchantment_Drop_Rates");
if(enchantment_drop_rates != null) {
if (enchantment_drop_rates != null) {
for (String tier : enchantment_drop_rates.getKeys(false)) {
double totalEnchantDropRate = 0;
double totalItemDropRate = 0;

View File

@ -33,7 +33,7 @@ public class FlatFileDataProcessor {
assert !lineData.isEmpty();
//Make sure the data line is "correct"
if(lineData.charAt(lineData.length() - 1) != ':') {
if (lineData.charAt(lineData.length() - 1) != ':') {
// Length checks depend on last rawSplitData being ':'
// We add it here if it is missing
lineData = lineData.concat(":");
@ -48,9 +48,9 @@ public class FlatFileDataProcessor {
boolean anyBadData = false;
//This is the minimum size of the split array needed to be considered proper data
if(splitDataLine.length < getMinimumSplitDataLength()) {
if (splitDataLine.length < getMinimumSplitDataLength()) {
//Data is considered junk
if(!corruptDataFound) {
if (!corruptDataFound) {
logger.severe("Some corrupt data was found in mcmmo.users and has been repaired, it is possible that some player data has been lost in this process.");
corruptDataFound = true;
}
@ -59,9 +59,9 @@ public class FlatFileDataProcessor {
builder.appendFlag(FlatFileDataFlag.CORRUPTED_OR_UNRECOGNIZABLE);
//TODO: This block here is probably pointless
if(splitDataLine.length >= 10 //The value here is kind of arbitrary, it shouldn't be too low to avoid false positives, but also we aren't really going to correctly identify when player data has been corrupted or not with 100% accuracy ever
if (splitDataLine.length >= 10 //The value here is kind of arbitrary, it shouldn't be too low to avoid false positives, but also we aren't really going to correctly identify when player data has been corrupted or not with 100% accuracy ever
&& splitDataLine[0] != null && !splitDataLine[0].isEmpty()) {
if(splitDataLine[0].length() <= 16 && splitDataLine[0].length() >= 3) {
if (splitDataLine[0].length() <= 16 && splitDataLine[0].length() >= 3) {
logger.severe("Not enough data found to recover corrupted player data for user: "+splitDataLine[0]);
registerData(builder.appendFlag(FlatFileDataFlag.TOO_INCOMPLETE));
return;
@ -81,14 +81,14 @@ public class FlatFileDataProcessor {
String name = splitDataLine[USERNAME_INDEX];
String strOfUUID = splitDataLine[UUID_INDEX];
if(name.isEmpty()) {
if (name.isEmpty()) {
reportBadDataLine("No name found for data", "[MISSING NAME]", lineData);
builder.appendFlag(FlatFileDataFlag.MISSING_NAME);
anyBadData = true;
badDataValues[USERNAME_INDEX] = true;
}
if(strOfUUID.isEmpty() || strOfUUID.equalsIgnoreCase("NULL")) {
if (strOfUUID.isEmpty() || strOfUUID.equalsIgnoreCase("NULL")) {
invalidUUID = true;
badDataValues[UUID_INDEX] = true;
reportBadDataLine("Empty/null UUID for user", "Empty/null", lineData);
@ -110,20 +110,20 @@ public class FlatFileDataProcessor {
}
//Duplicate UUID is no good, reject them
if(!invalidUUID && uuid != null && uuids.contains(uuid)) {
if (!invalidUUID && uuid != null && uuids.contains(uuid)) {
registerData(builder.appendFlag(FlatFileDataFlag.DUPLICATE_UUID));
return;
}
uuids.add(uuid);
if(names.contains(name)) {
if (names.contains(name)) {
builder.appendFlag(FlatFileDataFlag.DUPLICATE_NAME);
anyBadData = true;
badDataValues[USERNAME_INDEX] = true;
}
if(!name.isEmpty())
if (!name.isEmpty())
names.add(name);
//Make sure the data is up to date schema wise, if it isn't we adjust it to the correct size and flag it for repair
@ -136,9 +136,9 @@ public class FlatFileDataProcessor {
//Check each data for bad values
for(int i = 0; i < DATA_ENTRY_COUNT; i++) {
if(shouldNotBeEmpty(splitDataLine[i], i)) {
if (shouldNotBeEmpty(splitDataLine[i], i)) {
if(i == OVERHAUL_LAST_LOGIN) {
if (i == OVERHAUL_LAST_LOGIN) {
builder.appendFlag(FlatFileDataFlag.LAST_LOGIN_SCHEMA_UPGRADE);
}
@ -149,13 +149,13 @@ public class FlatFileDataProcessor {
boolean isCorrectType = isOfExpectedType(splitDataLine[i], getExpectedValueType(i));
if(!isCorrectType) {
if (!isCorrectType) {
anyBadData = true;
badDataValues[i] = true;
}
}
if(anyBadData) {
if (anyBadData) {
builder.appendFlag(FlatFileDataFlag.BAD_VALUES);
builder.appendBadDataValues(badDataValues);
}
@ -166,7 +166,7 @@ public class FlatFileDataProcessor {
public @NotNull String[] isDataSchemaUpToDate(@NotNull String[] splitDataLine, @NotNull FlatFileDataBuilder builder, boolean[] badDataValues) {
assert splitDataLine.length <= DATA_ENTRY_COUNT; //should NEVER be higher
if(splitDataLine.length < DATA_ENTRY_COUNT) {
if (splitDataLine.length < DATA_ENTRY_COUNT) {
int oldLength = splitDataLine.length;
splitDataLine = Arrays.copyOf(splitDataLine, DATA_ENTRY_COUNT);
int newLength = splitDataLine.length;
@ -184,7 +184,7 @@ public class FlatFileDataProcessor {
public boolean shouldNotBeEmpty(@Nullable String data, int index) {
if(getExpectedValueType(index) == ExpectedType.IGNORED) {
if (getExpectedValueType(index) == ExpectedType.IGNORED) {
return false;
} else {
return data == null || data.isEmpty();
@ -248,7 +248,7 @@ public class FlatFileDataProcessor {
FlatFileDataContainer flatFileDataContainer = builder.build();
flatFileDataContainers.add(flatFileDataContainer);
if(flatFileDataContainer.getDataFlags() != null)
if (flatFileDataContainer.getDataFlags() != null)
flatFileDataFlags.addAll(flatFileDataContainer.getDataFlags());
}
@ -295,7 +295,7 @@ public class FlatFileDataProcessor {
for(FlatFileDataContainer dataContainer : flatFileDataContainers) {
String[] splitData = FlatFileDataUtil.getPreparedSaveDataLine(dataContainer);
if(splitData == null)
if (splitData == null)
continue;
//We add a trailing : as it is needed for some reason (is it?)

View File

@ -101,15 +101,15 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
this.startingLevel = startingLevel;
this.testing = testing;
if(!usersFile.exists()) {
if (!usersFile.exists()) {
initEmptyDB();
}
if(!testing) {
if (!testing) {
List<FlatFileDataFlag> flatFileDataFlags = checkFileHealthAndStructure();
if(flatFileDataFlags != null) {
if(!flatFileDataFlags.isEmpty()) {
if (flatFileDataFlags != null) {
if (!flatFileDataFlags.isEmpty()) {
logger.info("Detected "+flatFileDataFlags.size() + " data entries which need correction.");
}
}
@ -222,7 +222,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
if (lastPlayed == -1) {
OfflinePlayer player = mcMMO.p.getServer().getOfflinePlayer(uuid);
if(player.getLastPlayed() != 0) {
if (player.getLastPlayed() != 0) {
lastPlayed = player.getLastPlayed();
rewrite = true;
}
@ -246,7 +246,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
out = new FileWriter(usersFilePath);
out.write(writer.toString());
if(testing) {
if (testing) {
System.out.println(writer);
}
}
@ -354,15 +354,15 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
boolean wroteUser = false;
// While not at the end of the file
while ((line = in.readLine()) != null) {
if(line.startsWith("#")) {
if (line.startsWith("#")) {
writer.append(line).append("\r\n");
continue;
}
//Check for incomplete or corrupted data
if(!line.contains(":")) {
if (!line.contains(":")) {
if(!corruptDataFound) {
if (!corruptDataFound) {
logger.severe("mcMMO found some unexpected or corrupted data in mcmmo.users and is removing it, it is possible some data has been lost.");
corruptDataFound = true;
}
@ -373,9 +373,9 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
String[] splitData = line.split(":");
//This would be rare, but check the splitData for having enough entries to contain a UUID
if(splitData.length < UUID_INDEX) { //UUID have been in mcMMO DB for a very long time so any user without
if (splitData.length < UUID_INDEX) { //UUID have been in mcMMO DB for a very long time so any user without
if(!corruptDataFound) {
if (!corruptDataFound) {
logger.severe("mcMMO found some unexpected or corrupted data in mcmmo.users and is removing it, it is possible some data has been lost.");
corruptDataFound = true;
}
@ -397,7 +397,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
/*
* If we couldn't find the user in the DB we need to add him
*/
if(!wroteUser) {
if (!wroteUser) {
writeUserToLine(profile, writer);
}
@ -498,7 +498,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
public @NotNull List<PlayerStat> readLeaderboard(@Nullable PrimarySkillType primarySkillType, int pageNumber, int statsPerPage) throws InvalidSkillException {
//Fix for a plugin that people are using that is throwing SQL errors
if(primarySkillType != null && SkillTools.isChildSkill(primarySkillType)) {
if (primarySkillType != null && SkillTools.isChildSkill(primarySkillType)) {
logger.severe("A plugin hooking into mcMMO is being naughty with our database commands, update all plugins that hook into mcMMO and contact their devs!");
throw new InvalidSkillException("A plugin hooking into mcMMO that you are using is attempting to read leaderboard skills for child skills, child skills do not have leaderboards! This is NOT an mcMMO error!");
}
@ -572,11 +572,11 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
private @NotNull UserQuery getUserQuery(@Nullable UUID uuid, @Nullable String playerName) throws NullPointerException {
boolean hasName = playerName != null && !playerName.equalsIgnoreCase("null");
if(hasName && uuid != null) {
if (hasName && uuid != null) {
return new UserQueryFull(playerName, uuid);
} else if (uuid != null) {
return new UserQueryUUIDImpl(uuid);
} else if(hasName) {
} else if (hasName) {
return new UserQueryNameImpl(playerName);
} else {
throw new NullPointerException("Both name and UUID cannot be null, at least one must be non-null!");
@ -610,7 +610,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
while ((line = in.readLine()) != null) {
if(line.startsWith("#")) {
if (line.startsWith("#")) {
continue;
}
@ -620,12 +620,12 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
/* Don't read corrupt data */
if(rawSplitData.length < (USERNAME_INDEX + 1)) {
if (rawSplitData.length < (USERNAME_INDEX + 1)) {
continue;
}
// we found the player
if(playerName.equalsIgnoreCase(rawSplitData[USERNAME_INDEX])) {
if (playerName.equalsIgnoreCase(rawSplitData[USERNAME_INDEX])) {
return loadFromLine(rawSplitData);
}
}
@ -660,24 +660,24 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
String line;
while ((line = in.readLine()) != null) {
if(line.startsWith("#")) {
if (line.startsWith("#")) {
continue;
}
// Find if the line contains the player we want.
String[] rawSplitData = line.split(":");
/* Don't read corrupt data */
if(rawSplitData.length < (UUID_INDEX + 1)) {
if (rawSplitData.length < (UUID_INDEX + 1)) {
continue;
}
try {
UUID fromDataUUID = UUID.fromString(rawSplitData[UUID_INDEX]);
if(fromDataUUID.equals(uuid)) {
if (fromDataUUID.equals(uuid)) {
return loadFromLine(rawSplitData);
}
} catch (Exception e) {
if(testing) {
if (testing) {
e.printStackTrace();
}
}
@ -716,20 +716,20 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
String line;
while ((line = in.readLine()) != null) {
if(line.startsWith("#")) {
if (line.startsWith("#")) {
continue;
}
// Find if the line contains the player we want.
String[] rawSplitData = line.split(":");
/* Don't read corrupt data */
if(rawSplitData.length < (UUID_INDEX + 1)) {
if (rawSplitData.length < (UUID_INDEX + 1)) {
continue;
}
try {
UUID fromDataUUID = UUID.fromString(rawSplitData[UUID_INDEX]);
if(fromDataUUID.equals(uuid)) {
if (fromDataUUID.equals(uuid)) {
//Matched UUID, now check if name matches
String dbPlayerName = rawSplitData[USERNAME_INDEX];
@ -746,7 +746,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
return loadFromLine(rawSplitData);
}
} catch (Exception e) {
if(testing) {
if (testing) {
e.printStackTrace();
}
}
@ -774,7 +774,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
}
private @NotNull PlayerProfile grabUnloadedProfile(@NotNull UUID uuid, @Nullable String playerName) {
if(playerName == null) {
if (playerName == null) {
playerName = ""; //No name for you boy!
}
@ -793,7 +793,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
String line;
while ((line = in.readLine()) != null) {
if(line.startsWith("#")) {
if (line.startsWith("#")) {
continue;
}
@ -1014,7 +1014,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
while ((line = in.readLine()) != null) {
if(line.startsWith("#"))
if (line.startsWith("#"))
continue;
String[] data = line.split(":");
@ -1145,12 +1145,12 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
//Analyze the data
while ((currentLine = bufferedReader.readLine()) != null) {
//Commented lines
if(currentLine.startsWith("#") && dbCommentDate == null) { //The first commented line in the file is likely to be our note about when the file was created
if (currentLine.startsWith("#") && dbCommentDate == null) { //The first commented line in the file is likely to be our note about when the file was created
dbCommentDate = currentLine;
continue;
}
if(currentLine.isEmpty())
if (currentLine.isEmpty())
continue;
//TODO: We are never passing empty lines, should we remove the flag for them?
@ -1158,12 +1158,12 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
}
//Only update the file if needed
if(!dataProcessor.getFlatFileDataFlags().isEmpty()) {
if (!dataProcessor.getFlatFileDataFlags().isEmpty()) {
flagsFound = new ArrayList<>(dataProcessor.getFlatFileDataFlags());
logger.info("Updating FlatFile Database...");
fileWriter = new FileWriter(usersFilePath);
//Write data to file
if(dbCommentDate != null)
if (dbCommentDate != null)
fileWriter.write(dbCommentDate + "\r\n");
fileWriter.write(dataProcessor.processDataForSave().toString());
@ -1176,7 +1176,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
}
}
if(flagsFound == null || flagsFound.isEmpty()) {
if (flagsFound == null || flagsFound.isEmpty()) {
return null;
} else {
return flagsFound;
@ -1184,7 +1184,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
}
private void closeResources(BufferedReader bufferedReader, FileWriter fileWriter) {
if(bufferedReader != null) {
if (bufferedReader != null) {
try {
bufferedReader.close();
}

View File

@ -59,7 +59,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
this.h2 = h2;
String connectionString = getConnectionString(h2);
if(!h2 && mcMMO.p.getGeneralConfig().getMySQLPublicKeyRetrieval()) {
if (!h2 && mcMMO.p.getGeneralConfig().getMySQLPublicKeyRetrieval()) {
connectionString+=
"&allowPublicKeyRetrieval=true";
}
@ -140,7 +140,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
String connectionString = "jdbc:mysql://" + mcMMO.p.getGeneralConfig().getMySQLServerName()
+ ":" + mcMMO.p.getGeneralConfig().getMySQLServerPort() + "/" + mcMMO.p.getGeneralConfig().getMySQLDatabaseName();
if(!mcMMO.getCompatibilityManager().getMinecraftGameVersion().isAtLeast(1, 17, 0) //Temporary hack for SQL and 1.17 support
if (!mcMMO.getCompatibilityManager().getMinecraftGameVersion().isAtLeast(1, 17, 0) //Temporary hack for SQL and 1.17 support
&& mcMMO.p.getGeneralConfig().getMySQLSSL())
connectionString +=
"?verifyServerCertificate=false"+
@ -247,7 +247,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
}
if (success) {
if(uuid != null)
if (uuid != null)
cleanupUser(uuid);
Misc.profileCleanup(playerName);
@ -400,7 +400,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
List<PlayerStat> stats = new ArrayList<>();
//Fix for a plugin that people are using that is throwing SQL errors
if(skill != null && SkillTools.isChildSkill(skill)) {
if (skill != null && SkillTools.isChildSkill(skill)) {
logger.severe("A plugin hooking into mcMMO is being naughty with our database commands, update all plugins that hook into mcMMO and contact their devs!");
throw new InvalidSkillException("A plugin hooking into mcMMO that you are using is attempting to read leaderboard skills for child skills, child skills do not have leaderboards! This is NOT an mcMMO error!");
}
@ -631,7 +631,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
}
private PlayerProfile loadPlayerFromDB(@Nullable UUID uuid, @Nullable String playerName) throws RuntimeException {
if(uuid == null && playerName == null) {
if (uuid == null && playerName == null) {
throw new RuntimeException("Error looking up player, both UUID and playerName are null and one must not be.");
}

View File

@ -28,7 +28,7 @@ public class FlatFileDataBuilder {
}
public @NotNull FlatFileDataContainer build() {
if(dataFlags.contains(FlatFileDataFlag.BAD_VALUES)) {
if (dataFlags.contains(FlatFileDataFlag.BAD_VALUES)) {
return new BadCategorizedFlatFileData(uniqueProcessingId, dataFlags, splitStringData, badDataValues);
}

View File

@ -10,14 +10,14 @@ import static com.gmail.nossr50.database.FlatFileDatabaseManager.*;
public class FlatFileDataUtil {
public static @Nullable String[] getPreparedSaveDataLine(@NotNull FlatFileDataContainer dataContainer) {
if(dataContainer.getDataFlags() == null) {
if (dataContainer.getDataFlags() == null) {
return dataContainer.getSplitData();
}
//Data of this type is not salvageable
//TODO: Test that we ignore the things we are supposed to ignore
//TODO: Should we even keep track of the bad data or just not even build data containers for it? Making containers for it is only really useful for debugging.. well I suppose operations are typically async so it shouldn't matter
if(dataContainer.getDataFlags().contains(FlatFileDataFlag.CORRUPTED_OR_UNRECOGNIZABLE)
if (dataContainer.getDataFlags().contains(FlatFileDataFlag.CORRUPTED_OR_UNRECOGNIZABLE)
|| dataContainer.getDataFlags().contains(FlatFileDataFlag.DUPLICATE_UUID) //For now we will not try to fix any issues with UUIDs
|| dataContainer.getDataFlags().contains(FlatFileDataFlag.BAD_UUID_DATA) //For now we will not try to fix any issues with UUIDs
|| dataContainer.getDataFlags().contains(FlatFileDataFlag.TOO_INCOMPLETE)) {
@ -29,7 +29,7 @@ public class FlatFileDataUtil {
/*
* First fix the bad data values if they exist
*/
if(dataContainer instanceof BadCategorizedFlatFileData badData) {
if (dataContainer instanceof BadCategorizedFlatFileData badData) {
splitData = repairBadData(dataContainer.getSplitData(), badData.getBadDataIndexes());
} else {
splitData = dataContainer.getSplitData();
@ -42,7 +42,7 @@ public class FlatFileDataUtil {
public static @NotNull String[] repairBadData(@NotNull String[] splitData, boolean[] badDataValues) {
for(int i = 0; i < FlatFileDatabaseManager.DATA_ENTRY_COUNT; i++) {
if(badDataValues[i]) {
if (badDataValues[i]) {
//This data value was marked as bad so we zero initialize it
splitData[i] = getZeroInitialisedData(i, 0);
}

View File

@ -25,56 +25,56 @@ public class LevelUpBroadcastPredicate<T extends CommandSender> implements Predi
Player broadcastingPlayer = (Player) broadcaster; //Always a player no need to check cast
//Broadcaster should be online
if(!broadcastingPlayer.isOnline()) {
if (!broadcastingPlayer.isOnline()) {
return false;
}
McMMOPlayer mmoBroadcastingPlayer = UserManager.getPlayer(broadcastingPlayer);
if(mmoBroadcastingPlayer == null) {
if (mmoBroadcastingPlayer == null) {
//This should never be null, but just in case...
mcMMO.p.getLogger().severe("McMMOPlayer was null for broadcaster in LevelUpBroadcastPredicate when it should never be null!");
return false;
}
if(t instanceof Player listeningPlayer) {
if (t instanceof Player listeningPlayer) {
//Party Member Check
if(mcMMO.p.getGeneralConfig().isLevelUpBroadcastsPartyMembersOnly()) {
if (mcMMO.p.getGeneralConfig().isLevelUpBroadcastsPartyMembersOnly()) {
McMMOPlayer mmoListeningPlayer = UserManager.getPlayer(listeningPlayer);
if(mmoListeningPlayer == null) {
if (mmoListeningPlayer == null) {
return false; //No profile so therefor no party
}
Party playerWhoLeveledParty = mmoBroadcastingPlayer.getParty();
Party broadcastRecipientParty = mmoListeningPlayer.getParty();
if(playerWhoLeveledParty == null || broadcastRecipientParty == null) {
if (playerWhoLeveledParty == null || broadcastRecipientParty == null) {
return false; //No party on either player when being in the same party is required
}
if(!playerWhoLeveledParty.equals(broadcastRecipientParty)) {
if (!playerWhoLeveledParty.equals(broadcastRecipientParty)) {
return false; //Not in the same party when it is required
}
}
//Same world check
if(isLevelUpBroadcastsSameWorldOnly()) {
if(!mmoBroadcastingPlayer.getPlayer().getWorld().equals(listeningPlayer.getWorld())) {
if (isLevelUpBroadcastsSameWorldOnly()) {
if (!mmoBroadcastingPlayer.getPlayer().getWorld().equals(listeningPlayer.getWorld())) {
return false; //Not in the same world when its required
}
//Distance checks
if(mcMMO.p.getGeneralConfig().shouldLevelUpBroadcastsRestrictDistance()) {
if(!Misc.isNear(mmoBroadcastingPlayer.getPlayer().getLocation(), listeningPlayer.getLocation(), mcMMO.p.getGeneralConfig().getLevelUpBroadcastRadius())) {
if (mcMMO.p.getGeneralConfig().shouldLevelUpBroadcastsRestrictDistance()) {
if (!Misc.isNear(mmoBroadcastingPlayer.getPlayer().getLocation(), listeningPlayer.getLocation(), mcMMO.p.getGeneralConfig().getLevelUpBroadcastRadius())) {
return false;
}
}
}
//Visibility checks
if(!listeningPlayer.canSee(mmoBroadcastingPlayer.getPlayer()) && listeningPlayer != mmoBroadcastingPlayer.getPlayer()) {
if (!listeningPlayer.canSee(mmoBroadcastingPlayer.getPlayer()) && listeningPlayer != mmoBroadcastingPlayer.getPlayer()) {
return false; //Player who leveled should be invisible to this player so don't send the message
}

View File

@ -25,56 +25,56 @@ public class PowerLevelUpBroadcastPredicate<T extends CommandSender> implements
Player broadcastingPlayer = (Player) broadcaster; //Always a player no need to check cast
//Broadcaster should be online
if(!broadcastingPlayer.isOnline()) {
if (!broadcastingPlayer.isOnline()) {
return false;
}
McMMOPlayer mmoBroadcastingPlayer = UserManager.getPlayer(broadcastingPlayer);
if(mmoBroadcastingPlayer == null) {
if (mmoBroadcastingPlayer == null) {
//This should never be null, but just in case...
mcMMO.p.getLogger().severe("McMMOPlayer was null for broadcaster in LevelUpBroadcastPredicate when it should never be null!");
return false;
}
if(t instanceof Player listeningPlayer) {
if (t instanceof Player listeningPlayer) {
//Party Member Check
if(mcMMO.p.getGeneralConfig().isPowerLevelUpBroadcastsPartyMembersOnly()) {
if (mcMMO.p.getGeneralConfig().isPowerLevelUpBroadcastsPartyMembersOnly()) {
McMMOPlayer mmoListeningPlayer = UserManager.getPlayer(listeningPlayer);
if(mmoListeningPlayer == null) {
if (mmoListeningPlayer == null) {
return false; //No profile so therefor no party
}
Party playerWhoLeveledParty = mmoBroadcastingPlayer.getParty();
Party broadcastRecipientParty = mmoListeningPlayer.getParty();
if(playerWhoLeveledParty == null || broadcastRecipientParty == null) {
if (playerWhoLeveledParty == null || broadcastRecipientParty == null) {
return false; //No party on either player when being in the same party is required
}
if(!playerWhoLeveledParty.equals(broadcastRecipientParty)) {
if (!playerWhoLeveledParty.equals(broadcastRecipientParty)) {
return false; //Not in the same party when it is required
}
}
//Same world check
if(isPowerLevelUpBroadcastsSameWorldOnly()) {
if(!mmoBroadcastingPlayer.getPlayer().getWorld().equals(listeningPlayer.getWorld())) {
if (isPowerLevelUpBroadcastsSameWorldOnly()) {
if (!mmoBroadcastingPlayer.getPlayer().getWorld().equals(listeningPlayer.getWorld())) {
return false; //Not in the same world when its required
}
//Distance checks
if(mcMMO.p.getGeneralConfig().shouldPowerLevelUpBroadcastsRestrictDistance()) {
if(!Misc.isNear(mmoBroadcastingPlayer.getPlayer().getLocation(), listeningPlayer.getLocation(), mcMMO.p.getGeneralConfig().getPowerLevelUpBroadcastRadius())) {
if (mcMMO.p.getGeneralConfig().shouldPowerLevelUpBroadcastsRestrictDistance()) {
if (!Misc.isNear(mmoBroadcastingPlayer.getPlayer().getLocation(), listeningPlayer.getLocation(), mcMMO.p.getGeneralConfig().getPowerLevelUpBroadcastRadius())) {
return false;
}
}
}
//Visibility checks
if(!listeningPlayer.canSee(mmoBroadcastingPlayer.getPlayer()) && listeningPlayer != mmoBroadcastingPlayer.getPlayer()) {
if (!listeningPlayer.canSee(mmoBroadcastingPlayer.getPlayer()) && listeningPlayer != mmoBroadcastingPlayer.getPlayer()) {
return false; //Player who leveled should be invisible to this player so don't send the message
}

View File

@ -91,7 +91,7 @@ public class Party {
for(Player p : onlineMembers)
{
if(player.canSee(p))
if (player.canSee(p))
visibleMembers.add(p);
}
@ -347,7 +347,7 @@ public class Party {
for(UUID playerUUID : members.keySet()) {
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(playerUUID);
if(offlinePlayer.isOnline() && player.canSee((Player) offlinePlayer)) {
if (offlinePlayer.isOnline() && player.canSee((Player) offlinePlayer)) {
ChatColor onlineColor = leader.getUniqueId().equals(playerUUID) ? ChatColor.GOLD : ChatColor.GREEN;
coloredNames.add(onlineColor + offlinePlayer.getName());
} else {
@ -361,7 +361,7 @@ public class Party {
private void buildChatMessage(@NotNull StringBuilder stringBuilder, String @NotNull [] names) {
for(int i = 0; i < names.length; i++) {
if(i + 1 >= names.length) {
if (i + 1 >= names.length) {
stringBuilder
.append(names[i]);
} else {

View File

@ -157,7 +157,7 @@ public class McMMOPlayer implements Identified {
this.chatChannel = ChatChannel.NONE;
if(ChatConfig.getInstance().isSpyingAutomatic() && Permissions.adminChatSpy(getPlayer())) {
if (ChatConfig.getInstance().isSpyingAutomatic() && Permissions.adminChatSpy(getPlayer())) {
chatSpy = true;
}
}
@ -253,20 +253,20 @@ public class McMMOPlayer implements Identified {
public void processPostXpEvent(PrimarySkillType primarySkillType, Plugin plugin, XPGainSource xpGainSource)
{
//Check if they've reached the power level cap just now
if(hasReachedPowerLevelCap()) {
if (hasReachedPowerLevelCap()) {
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.PowerLevel", String.valueOf(mcMMO.p.getGeneralConfig().getPowerLevelCap()));
} else if(hasReachedLevelCap(primarySkillType)) {
} else if (hasReachedLevelCap(primarySkillType)) {
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.Skill",
String.valueOf(mcMMO.p.getSkillTools().getLevelCap(primarySkillType)),
mcMMO.p.getSkillTools().getLocalizedSkillName(primarySkillType));
}
//Updates from Party sources
if(xpGainSource == XPGainSource.PARTY_MEMBERS && !ExperienceConfig.getInstance().isPartyExperienceBarsEnabled())
if (xpGainSource == XPGainSource.PARTY_MEMBERS && !ExperienceConfig.getInstance().isPartyExperienceBarsEnabled())
return;
//Updates from passive sources (Alchemy, Smelting, etc...)
if(xpGainSource == XPGainSource.PASSIVE && !ExperienceConfig.getInstance().isPassiveGainsExperienceBarsEnabled())
if (xpGainSource == XPGainSource.PASSIVE && !ExperienceConfig.getInstance().isPassiveGainsExperienceBarsEnabled())
return;
updateXPBar(primarySkillType, plugin);
@ -285,7 +285,7 @@ public class McMMOPlayer implements Identified {
public double getProgressInCurrentSkillLevel(PrimarySkillType primarySkillType)
{
if(SkillTools.isChildSkill(primarySkillType)) {
if (SkillTools.isChildSkill(primarySkillType)) {
return 1.0D;
}
@ -602,7 +602,7 @@ public class McMMOPlayer implements Identified {
* @return
*/
public boolean hasReachedLevelCap(PrimarySkillType primarySkillType) {
if(hasReachedPowerLevelCap())
if (hasReachedPowerLevelCap())
return true;
return getSkillLevel(primarySkillType) >= mcMMO.p.getSkillTools().getLevelCap(primarySkillType);
@ -624,7 +624,7 @@ public class McMMOPlayer implements Identified {
* @param xp Experience amount to process
*/
public void beginXpGain(PrimarySkillType skill, float xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
if(xp <= 0) {
if (xp <= 0) {
return;
}
@ -656,7 +656,7 @@ public class McMMOPlayer implements Identified {
* @param xp Experience amount to process
*/
public void beginUnsharedXpGain(PrimarySkillType skill, float xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
if(player.getGameMode() == GameMode.CREATIVE)
if (player.getGameMode() == GameMode.CREATIVE)
return;
applyXpGain(skill, modifyXpGain(skill, xp), xpGainReason, xpGainSource);
@ -709,7 +709,7 @@ public class McMMOPlayer implements Identified {
* @param primarySkillType The skill to check
*/
private void checkXp(PrimarySkillType primarySkillType, XPGainReason xpGainReason, XPGainSource xpGainSource) {
if(hasReachedLevelCap(primarySkillType))
if (hasReachedLevelCap(primarySkillType))
return;
if (getSkillXpLevelRaw(primarySkillType) < getXpToLevel(primarySkillType)) {
@ -906,7 +906,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);
@ -941,7 +941,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 {
@ -1024,7 +1024,7 @@ public class McMMOPlayer implements Identified {
* IF THE TOOL IS AN AXE
*
*/
if(tool == ToolType.AXE) {
if (tool == ToolType.AXE) {
processAxeToolMessages();
} else {
NotificationManager.sendPlayerInformation(player, NotificationType.TOOL, tool.getRaiseTool());
@ -1045,20 +1045,20 @@ public class McMMOPlayer implements Identified {
/*
* IF BOTH TREE FELLER & SKULL SPLITTER ARE ON CD
*/
if(isAbilityOnCooldown(SuperAbilityType.TREE_FELLER) && isAbilityOnCooldown(SuperAbilityType.SKULL_SPLITTER)) {
if (isAbilityOnCooldown(SuperAbilityType.TREE_FELLER) && isAbilityOnCooldown(SuperAbilityType.SKULL_SPLITTER)) {
tooTiredMultiple(PrimarySkillType.WOODCUTTING, SubSkillType.WOODCUTTING_TREE_FELLER, SuperAbilityType.TREE_FELLER, SubSkillType.AXES_SKULL_SPLITTER, SuperAbilityType.SKULL_SPLITTER);
/*
* IF TREE FELLER IS ON CD
* AND PLAYER IS LOOKING AT TREE
*/
} else if(isAbilityOnCooldown(SuperAbilityType.TREE_FELLER)
} else if (isAbilityOnCooldown(SuperAbilityType.TREE_FELLER)
&& BlockUtils.isPartOfTree(rayCast)) {
raiseToolWithCooldowns(SubSkillType.WOODCUTTING_TREE_FELLER, SuperAbilityType.TREE_FELLER);
/*
* IF SKULL SPLITTER IS ON CD
*/
} else if(isAbilityOnCooldown(SuperAbilityType.SKULL_SPLITTER)) {
} else if (isAbilityOnCooldown(SuperAbilityType.SKULL_SPLITTER)) {
raiseToolWithCooldowns(SubSkillType.AXES_SKULL_SPLITTER, SuperAbilityType.SKULL_SPLITTER);
} else {
NotificationManager.sendPlayerInformation(player, NotificationType.TOOL, ToolType.AXE.getRaiseTool());
@ -1156,7 +1156,7 @@ public class McMMOPlayer implements Identified {
*/
public void logout(boolean syncSave) {
Player thisPlayer = getPlayer();
if(getPlayer().hasMetadata(MetadataConstants.METADATA_KEY_RUPTURE)) {
if (getPlayer().hasMetadata(MetadataConstants.METADATA_KEY_RUPTURE)) {
RuptureTaskMeta ruptureTaskMeta = (RuptureTaskMeta) getPlayer().getMetadata(MetadataConstants.METADATA_KEY_RUPTURE).get(0);
//Punish a logout
@ -1175,7 +1175,7 @@ public class McMMOPlayer implements Identified {
UserManager.remove(thisPlayer);
if(mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
if (mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
ScoreboardManager.teardownPlayer(thisPlayer);
if (inParty()) {

View File

@ -100,7 +100,7 @@ public class PlayerProfile {
loaded = true;
if(lastLogin != null)
if (lastLogin != null)
this.lastLogin = lastLogin;
}
@ -130,17 +130,17 @@ public class PlayerProfile {
if (changed) {
mcMMO.p.getLogger().severe("PlayerProfile saving failed for player: " + playerName + " " + uuid);
if(saveAttempts > 0) {
if (saveAttempts > 0) {
mcMMO.p.getLogger().severe("Attempted to save profile for player "+getPlayerName()
+ " 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
if(mcMMO.isServerShutdownExecuted() || useSync)
if (mcMMO.isServerShutdownExecuted() || useSync)
mcMMO.p.getFoliaLib().getImpl().runNextTick(new PlayerProfileSaveTask(this, true));
else
scheduleAsyncSave();
@ -271,7 +271,7 @@ public class PlayerProfile {
}
public int getSkillXpLevel(PrimarySkillType skill) {
if(SkillTools.isChildSkill(skill)) {
if (SkillTools.isChildSkill(skill)) {
return 0;
}
@ -339,7 +339,7 @@ public class PlayerProfile {
markProfileDirty();
//Don't allow levels to be negative
if(level < 0)
if (level < 0)
level = 0;
skills.put(skill, level);
@ -424,7 +424,7 @@ public class PlayerProfile {
* @return the total amount of Xp until next level
*/
public int getXpToLevel(PrimarySkillType primarySkillType) {
if(SkillTools.isChildSkill(primarySkillType)) {
if (SkillTools.isChildSkill(primarySkillType)) {
return 0;
}

View File

@ -37,7 +37,7 @@ public enum MaterialType {
return Material.DIAMOND;
case NETHERITE:
if(Material.getMaterial("NETHERITE_SCRAP") != null)
if (Material.getMaterial("NETHERITE_SCRAP") != null)
return Material.getMaterial("NETHERITE_SCRAP");
else
return Material.DIAMOND;

View File

@ -201,7 +201,7 @@ 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("_");

View File

@ -64,7 +64,7 @@ public enum PotionStage {
stage++;
} else if (!potionMeta.getCustomEffects().isEmpty()) {
for (PotionEffect effect : potionMeta.getCustomEffects()){
if(effect.getAmplifier() > 0){
if (effect.getAmplifier() > 0){
stage++;
break;
}

View File

@ -61,7 +61,7 @@ public class Roll extends AcrobaticsSubSkill {
EntityDamageEvent entityDamageEvent = (EntityDamageEvent) event;
//Make sure a real player was damaged in this event
if(!EventUtils.isRealPlayerDamaged(entityDamageEvent))
if (!EventUtils.isRealPlayerDamaged(entityDamageEvent))
return false;
if (entityDamageEvent.getCause() == EntityDamageEvent.DamageCause.FALL) {//Grab the player
@ -81,7 +81,7 @@ public class Roll extends AcrobaticsSubSkill {
entityDamageEvent.setCancelled(true);
return true;
}
} else if(mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(mmoPlayer.getPlayer(), PrimarySkillType.ACROBATICS)) {
} else if (mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(mmoPlayer.getPlayer(), PrimarySkillType.ACROBATICS)) {
//Give XP Anyways
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, ((EntityDamageEvent) event).getFinalDamage(), false), XPGainReason.PVE);
}
@ -156,7 +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());
@ -213,7 +213,7 @@ public class Roll extends AcrobaticsSubSkill {
//mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text"));
//if (!SkillUtils.cooldownExpired((long) mcMMOmmoPlayer.getPlayer().getTeleportATS(), Config.getInstance().getXPAfterTeleportCooldown())) {
if(!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
if (!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, damage, true), XPGainReason.PVE);
//}
@ -222,7 +222,7 @@ public class Roll extends AcrobaticsSubSkill {
}
else if (!isFatal(mmoPlayer, damage)) {
//if (!SkillUtils.cooldownExpired((long) mmoPlayer.getTeleportATS(), Config.getInstance().getXPAfterTeleportCooldown())) {
if(!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
if (!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, damage, false), XPGainReason.PVE);
//}
}
@ -252,14 +252,14 @@ public class Roll extends AcrobaticsSubSkill {
{
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())
if (!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, damage, true), XPGainReason.PVE);
addFallLocation(mmoPlayer);
return modifiedDamage;
}
else if (!isFatal(mmoPlayer, damage)) {
if(!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
if (!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, damage, false), XPGainReason.PVE);
addFallLocation(mmoPlayer);
@ -286,15 +286,15 @@ public class Roll extends AcrobaticsSubSkill {
}
if (ItemUtils.hasItemInEitherHand(mmoPlayer.getPlayer(), Material.ENDER_PEARL) || mmoPlayer.getPlayer().isInsideVehicle()) {
if(mmoPlayer.isDebugMode()) {
if (mmoPlayer.isDebugMode()) {
mmoPlayer.getPlayer().sendMessage("Acrobatics XP Prevented: Ender Pearl or Inside Vehicle");
}
return true;
}
if(mmoPlayer.getAcrobaticsManager().hasFallenInLocationBefore(getBlockLocation(mmoPlayer)))
if (mmoPlayer.getAcrobaticsManager().hasFallenInLocationBefore(getBlockLocation(mmoPlayer)))
{
if(mmoPlayer.isDebugMode()) {
if (mmoPlayer.isDebugMode()) {
mmoPlayer.getPlayer().sendMessage("Acrobatics XP Prevented: Fallen in location before");
}

View File

@ -36,7 +36,7 @@ public class TamingSummon {
entityType = EntityType.HORSE;
break;
case CAT:
if(shouldSpawnCatInsteadOfOcelot()) {
if (shouldSpawnCatInsteadOfOcelot()) {
//Server is on 1.14 or above
entityType = EntityType.CAT;
} else {

View File

@ -30,7 +30,7 @@ public class FishingTreasureBook extends FishingTreasure {
LogUtils.debug(mcMMO.p.getLogger(), "Registering enchantments for Fishing Book...");
for(Enchantment enchantment : Enchantment.values()) {
if(isEnchantAllowed(enchantment)) {
if (isEnchantAllowed(enchantment)) {
addAllLegalEnchants(enchantment);
}
}
@ -66,9 +66,9 @@ public class FishingTreasureBook extends FishingTreasure {
}
private boolean isEnchantAllowed(@NotNull Enchantment enchantment) {
if(whiteListedEnchantments != null && !whiteListedEnchantments.isEmpty()) {
if (whiteListedEnchantments != null && !whiteListedEnchantments.isEmpty()) {
return whiteListedEnchantments.contains(enchantment);
} else if(blackListedEnchantments != null && !blackListedEnchantments.isEmpty()) {
} else if (blackListedEnchantments != null && !blackListedEnchantments.isEmpty()) {
return !blackListedEnchantments.contains(enchantment);
} else {
return true;

View File

@ -12,7 +12,7 @@ public enum Rarity {
COMMON;
public static @NotNull Rarity getRarity(@NotNull String string) {
if(string.equalsIgnoreCase("Records")) {
if (string.equalsIgnoreCase("Records")) {
mcMMO.p.getLogger().severe("Entries in fishing treasures have Records set as rarity, however Records was renamed to Mythic. Please update your treasures to read MYTHIC instead of RECORDS for rarity, or delete the config file to regenerate a new one.");
return Rarity.MYTHIC; //People that copy paste their configs will have Records interpretted as Mythic
}

View File

@ -30,7 +30,7 @@ public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements
super(player);
this.skill = skill;
if(UserManager.getPlayer(player) != null) {
if (UserManager.getPlayer(player) != null) {
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
} else {
this.skillLevel = 0;

View File

@ -50,8 +50,8 @@ public class BlockListener implements Listener {
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))
if (event.isCancelled()) {
if (event.getBlock().hasMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS))
event.getBlock().removeMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS, plugin);
return;
}
@ -59,7 +59,7 @@ public class BlockListener implements Listener {
int tileEntityTolerance = 1;
// beetroot hotfix, potentially other plants may need this fix
if(event.getBlockState().getType() == Material.BEETROOTS)
if (event.getBlockState().getType() == Material.BEETROOTS)
tileEntityTolerance = 2;
//Track how many "things" are being dropped
@ -72,34 +72,34 @@ public class BlockListener implements Listener {
uniqueMaterials.add(item.getItemStack().getType());
//Count blocks as a second failsafe
if(item.getItemStack().getType().isBlock())
if (item.getItemStack().getType().isBlock())
blockCount++;
}
if(uniqueMaterials.size() > tileEntityTolerance) {
if (uniqueMaterials.size() > tileEntityTolerance) {
//Too many things are dropping, assume tile entities might be duped
//Technically this would also prevent something like coal from being bonus dropped if you placed a TE above a coal ore when mining it but that's pretty edge case and this is a good solution for now
dontRewardTE = true;
}
//If there are more than one block in the item list we can't really trust it and will back out of rewarding bonus drops
if(blockCount <= 1) {
if (blockCount <= 1) {
for(Item item : event.getItems())
{
ItemStack is = new ItemStack(item.getItemStack());
if(is.getAmount() <= 0)
if (is.getAmount() <= 0)
continue;
//TODO: Ignore this abomination its rewritten in 2.2
if(!mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.MINING, is.getType())
if (!mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.MINING, is.getType())
&& !mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.HERBALISM, is.getType())
&& !mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.WOODCUTTING, is.getType()))
continue;
//If we suspect TEs might be duped only reward block
if(dontRewardTE) {
if(!is.getType().isBlock()) {
if (dontRewardTE) {
if (!is.getType().isBlock()) {
continue;
}
}
@ -115,7 +115,7 @@ public class BlockListener implements Listener {
}
}
if(event.getBlock().hasMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS))
if (event.getBlock().hasMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS))
event.getBlock().removeMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS, plugin);
}
@ -127,10 +127,10 @@ public class BlockListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
return;
if(!ExperienceConfig.getInstance().isPistonCheatingPrevented()) {
if (!ExperienceConfig.getInstance().isPistonCheatingPrevented()) {
return;
}
@ -155,10 +155,10 @@ public class BlockListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
return;
if(!ExperienceConfig.getInstance().isPistonCheatingPrevented()) {
if (!ExperienceConfig.getInstance().isPistonCheatingPrevented()) {
return;
}
@ -167,12 +167,12 @@ public class BlockListener implements Listener {
Block movedBlock = event.getBlock().getRelative(direction);
//Spigot makes bad things happen in its API
if(BlockUtils.isWithinWorldBounds(movedBlock)) {
if (BlockUtils.isWithinWorldBounds(movedBlock)) {
BlockUtils.setUnnaturalBlock(movedBlock);
}
for (Block block : event.getBlocks()) {
if(BlockUtils.isWithinWorldBounds(block) && BlockUtils.isWithinWorldBounds(block.getRelative(direction))) {
if (BlockUtils.isWithinWorldBounds(block) && BlockUtils.isWithinWorldBounds(block.getRelative(direction))) {
Block relativeBlock = block.getRelative(direction);
BlockUtils.setUnnaturalBlock(relativeBlock);
}
@ -189,15 +189,15 @@ public class BlockListener implements Listener {
public void onEntityBlockFormEvent(EntityBlockFormEvent event)
{
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
return;
BlockState blockState = event.getNewState();
if(ExperienceConfig.getInstance().isSnowExploitPrevented() && BlockUtils.shouldBeWatched(blockState)) {
if (ExperienceConfig.getInstance().isSnowExploitPrevented() && BlockUtils.shouldBeWatched(blockState)) {
Block block = blockState.getBlock();
if(BlockUtils.isWithinWorldBounds(block)) {
if (BlockUtils.isWithinWorldBounds(block)) {
BlockUtils.setUnnaturalBlock(block);
}
}
@ -212,15 +212,15 @@ public class BlockListener implements Listener {
World world = event.getBlock().getWorld();
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(world))
if (WorldBlacklist.isWorldBlacklisted(world))
return;
if(ExperienceConfig.getInstance().preventStoneLavaFarming()) {
if (ExperienceConfig.getInstance().preventStoneLavaFarming()) {
BlockState newState = event.getNewState();
if(newState.getType() != Material.OBSIDIAN && ExperienceConfig.getInstance().doesBlockGiveSkillXP(PrimarySkillType.MINING, newState.getBlockData())) {
if (newState.getType() != Material.OBSIDIAN && ExperienceConfig.getInstance().doesBlockGiveSkillXP(PrimarySkillType.MINING, newState.getBlockData())) {
Block block = newState.getBlock();
if(BlockUtils.isWithinWorldBounds(block)) {
if (BlockUtils.isWithinWorldBounds(block)) {
BlockUtils.setUnnaturalBlock(block);
}
}
@ -241,11 +241,11 @@ public class BlockListener implements Listener {
// if (!Tag.LOGS.isTagged(event.getBlockReplacedState().getType()) || !Tag.LOGS.isTagged(event.getBlockPlaced().getType()))
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(block.getWorld())) {
if (WorldBlacklist.isWorldBlacklisted(block.getWorld())) {
return;
}
if(BlockUtils.isWithinWorldBounds(block)) {
if (BlockUtils.isWithinWorldBounds(block)) {
//NOTE: BlockMultiPlace has its own logic so don't handle anything that would overlap
if (!(event instanceof BlockMultiPlaceEvent)) {
BlockUtils.setUnnaturalBlock(block);
@ -261,7 +261,7 @@ public class BlockListener implements Listener {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if(mcMMOPlayer == null)
if (mcMMOPlayer == null)
return;
if (blockState.getType() == Repair.anvilMaterial && mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.REPAIR)) {
@ -284,10 +284,10 @@ public class BlockListener implements Listener {
Block block = blockState.getBlock();
/* Check if the blocks placed should be monitored so they do not give out XP in the future */
if(BlockUtils.isWithinWorldBounds(block)) {
if (BlockUtils.isWithinWorldBounds(block)) {
//Updated: 10/5/2021
//Note: For some reason Azalea trees trigger this event but no other tree does (as of 10/5/2021) but if this changes in the future we may need to update this
if(BlockUtils.isPartOfTree(event.getBlockPlaced())) {
if (BlockUtils.isPartOfTree(event.getBlockPlaced())) {
return;
}
@ -305,11 +305,11 @@ public class BlockListener implements Listener {
World world = block.getWorld();
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(world))
if (WorldBlacklist.isWorldBlacklisted(world))
return;
// Minecraft is dumb, the events still throw when a plant "grows" higher than the max block height. Even though no new block is created
if(BlockUtils.isWithinWorldBounds(block)) {
if (BlockUtils.isWithinWorldBounds(block)) {
mcMMO.getPlaceStore().setFalse(block);
}
}
@ -328,15 +328,15 @@ public class BlockListener implements Listener {
return;
}
if(WorldBlacklist.isWorldBlacklisted(block.getWorld())) {
if (WorldBlacklist.isWorldBlacklisted(block.getWorld())) {
BlockUtils.cleanupBlockMetadata(block);
return;
}
/* WORLD GUARD MAIN FLAG CHECK */
if(WorldGuardUtils.isWorldGuardLoaded())
if (WorldGuardUtils.isWorldGuardLoaded())
{
if(!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer())) {
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer())) {
BlockUtils.cleanupBlockMetadata(block);
return;
}
@ -364,7 +364,7 @@ public class BlockListener implements Listener {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Check if profile is loaded
if(mcMMOPlayer == null) {
if (mcMMOPlayer == null) {
/* Remove metadata from placed watched blocks */
BlockUtils.cleanupBlockMetadata(block);
@ -442,17 +442,17 @@ public class BlockListener implements Listener {
*/
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockBreakHigher(BlockBreakEvent event) {
if(event instanceof FakeEvent)
if (event instanceof FakeEvent)
return;
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
return;
/* WORLD GUARD MAIN FLAG CHECK */
if(WorldGuardUtils.isWorldGuardLoaded())
if (WorldGuardUtils.isWorldGuardLoaded())
{
if(!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
return;
}
@ -463,7 +463,7 @@ public class BlockListener implements Listener {
}
//Profile not loaded
if(UserManager.getPlayer(player) == null)
if (UserManager.getPlayer(player) == null)
{
return;
}
@ -509,13 +509,13 @@ public class BlockListener implements Listener {
BlockState blockState = event.getBlock().getState();
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
return;
/* WORLD GUARD MAIN FLAG CHECK */
if(WorldGuardUtils.isWorldGuardLoaded())
if (WorldGuardUtils.isWorldGuardLoaded())
{
if(!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
return;
}
@ -529,7 +529,7 @@ public class BlockListener implements Listener {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Profile not loaded
if(mcMMOPlayer == null)
if (mcMMOPlayer == null)
{
return;
}
@ -560,11 +560,11 @@ public class BlockListener implements Listener {
|| BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.UNARMED);
if(mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK)) {
if (mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK)) {
if (SuperAbilityType.BERSERK.blockCheck(blockState) && EventUtils.simulateBlockBreak(blockState.getBlock(), player)) {
event.setInstaBreak(true);
if(blockState.getType().getKey().getKey().contains("glass")) {
if (blockState.getType().getKey().getKey().contains("glass")) {
SoundManager.worldSendSound(player.getWorld(), blockState.getLocation(), SoundType.GLASS);
} else {
SoundManager.sendSound(player, blockState.getLocation(), SoundType.POP);
@ -592,13 +592,13 @@ public class BlockListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockDamageHigher(BlockDamageEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
return;
/* WORLD GUARD MAIN FLAG CHECK */
if(WorldGuardUtils.isWorldGuardLoaded())
if (WorldGuardUtils.isWorldGuardLoaded())
{
if(!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
return;
}
@ -615,7 +615,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;
}
@ -643,7 +643,7 @@ public class BlockListener implements Listener {
else if (!event.getInstaBreak() && SuperAbilityType.BERSERK.blockCheck(blockState) && EventUtils.simulateBlockBreak(block, player)) {
event.setInstaBreak(true);
if(blockState.getType().getKey().getKey().contains("glass")) {
if (blockState.getType().getKey().getKey().contains("glass")) {
SoundManager.worldSendSound(player.getWorld(), block.getLocation(), SoundType.GLASS);
} else {
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
@ -662,7 +662,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,14 +680,14 @@ 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.getPlaceStore().isTrue(blockState))
if (mcMMO.getPlaceStore().isTrue(blockState))
player.sendMessage("[mcMMO DEBUG] This block is not natural and does not reward treasures/XP");
else
{
@ -695,24 +695,24 @@ public class BlockListener implements Listener {
UserManager.getPlayer(player).getExcavationManager().printExcavationDebug(player, blockState);
}
if(WorldGuardUtils.isWorldGuardLoaded())
if (WorldGuardUtils.isWorldGuardLoaded())
{
if(WorldGuardManager.getInstance().hasMainFlag(player))
if (WorldGuardManager.getInstance().hasMainFlag(player))
player.sendMessage("[mcMMO DEBUG] World Guard main flag is permitted for this player in this region");
else
player.sendMessage("[mcMMO DEBUG] World Guard main flag is DENIED for this player in this region");
if(WorldGuardManager.getInstance().hasXPFlag(player))
if (WorldGuardManager.getInstance().hasXPFlag(player))
player.sendMessage("[mcMMO DEBUG] World Guard xp flag is permitted for this player in this region");
else
player.sendMessage("[mcMMO DEBUG] World Guard xp flag is not permitted for this player in this region");
}
if(blockState instanceof Furnace || blockState instanceof BrewingStand) {
if(ContainerMetadataUtils.isContainerOwned(blockState)) {
if (blockState instanceof Furnace || blockState instanceof BrewingStand) {
if (ContainerMetadataUtils.isContainerOwned(blockState)) {
player.sendMessage("[mcMMO DEBUG] This container has a registered owner");
final OfflinePlayer furnacePlayer = ContainerMetadataUtils.getContainerOwner(blockState);
if(furnacePlayer != null) {
if (furnacePlayer != null) {
player.sendMessage("[mcMMO DEBUG] This container is owned by player "+furnacePlayer.getName());
}
}
@ -720,7 +720,7 @@ public class BlockListener implements Listener {
player.sendMessage("[mcMMO DEBUG] This container does not have a registered owner");
}
if(ExperienceConfig.getInstance().isExperienceBarsEnabled())
if (ExperienceConfig.getInstance().isExperienceBarsEnabled())
player.sendMessage("[mcMMO DEBUG] XP bars are enabled, however you should check per-skill settings to make sure those are enabled.");
player.sendMessage(ChatColor.RED+"You can turn this debug info off by typing "+ChatColor.GOLD+"/mmodebug");

View File

@ -63,12 +63,12 @@ public class EntityListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void onEntityTransform(EntityTransformEvent event) {
if(event.getEntity() instanceof LivingEntity livingEntity) {
if (event.getEntity() instanceof LivingEntity livingEntity) {
//Transfer metadata keys from mob-spawned mobs to new mobs
if(hasMobFlags(livingEntity)) {
if (hasMobFlags(livingEntity)) {
for(Entity entity : event.getTransformedEntities()) {
if(entity instanceof LivingEntity transformedEntity) {
if (entity instanceof LivingEntity transformedEntity) {
addMobFlags(livingEntity, transformedEntity);
}
}
@ -78,21 +78,21 @@ public class EntityListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityTargetEntity(EntityTargetLivingEntityEvent event) {
if(!ExperienceConfig.getInstance().isEndermanEndermiteFarmingPrevented())
if (!ExperienceConfig.getInstance().isEndermanEndermiteFarmingPrevented())
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 (event.getEntity() instanceof Enderman enderman) {
if(!hasMobFlag(MobMetaFlagType.EXPLOITED_ENDERMEN, enderman)) {
if (!hasMobFlag(MobMetaFlagType.EXPLOITED_ENDERMEN, enderman)) {
flagMetadata(MobMetaFlagType.EXPLOITED_ENDERMEN, enderman);
}
}
@ -102,10 +102,10 @@ public class EntityListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = false)
public void onEntityShootBow(EntityShootBowEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
return;
if(event.getEntity() instanceof Player player)
if (event.getEntity() instanceof Player player)
{
Entity projectile = event.getProjectile();
@ -135,35 +135,35 @@ public class EntityListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onProjectileLaunch(ProjectileLaunchEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
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()) {
if(!WorldGuardManager.getInstance().hasMainFlag(player))
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
if(event.getEntity() instanceof Arrow arrow) {
if (event.getEntity() instanceof Arrow arrow) {
// Delayed metadata cleanup in case other cleanup hooks fail
CombatUtils.delayArrowMetaCleanup(arrow);
// If fired from an item with multi-shot, we need to track
if(ItemUtils.doesPlayerHaveEnchantmentInHands(player, "multishot")) {
if (ItemUtils.doesPlayerHaveEnchantmentInHands(player, "multishot")) {
arrow.setMetadata(MetadataConstants.METADATA_KEY_MULTI_SHOT_ARROW, MetadataConstants.MCMMO_METADATA_VALUE);
}
if(!arrow.hasMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE))
if (!arrow.hasMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE))
arrow.setMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE, new FixedMetadataValue(pluginRef, 1.0));
if(!arrow.hasMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE))
if (!arrow.hasMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE))
arrow.setMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE, new FixedMetadataValue(pluginRef, arrow.getLocation()));
//Check both hands
if(ItemUtils.doesPlayerHaveEnchantmentInHands(player, "piercing")) {
if (ItemUtils.doesPlayerHaveEnchantmentInHands(player, "piercing")) {
return;
}
@ -183,7 +183,7 @@ public class EntityListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
return;
Block block = event.getBlock();
@ -232,16 +232,16 @@ public class EntityListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityCombustByEntityEvent(EntityCombustByEntityEvent event) {
//Prevent players from setting fire to each other if they are in the same party
if(event.getEntity() instanceof Player defender) {
if (event.getEntity() instanceof Player defender) {
if(event.getCombuster() instanceof Projectile projectile) {
if(projectile.getShooter() instanceof Player attacker) {
if(checkIfInPartyOrSamePlayer(event, defender, attacker)) {
if (event.getCombuster() instanceof Projectile projectile) {
if (projectile.getShooter() instanceof Player attacker) {
if (checkIfInPartyOrSamePlayer(event, defender, attacker)) {
event.setCancelled(true);
}
}
} else if(event.getCombuster() instanceof Player attacker) {
if(checkIfInPartyOrSamePlayer(event, defender, attacker)) {
} else if (event.getCombuster() instanceof Player attacker) {
if (checkIfInPartyOrSamePlayer(event, defender, attacker)) {
event.setCancelled(true);
}
}
@ -266,18 +266,18 @@ public class EntityListener implements Listener {
Entity defender = event.getEntity();
Entity attacker = event.getDamager();
if(WorldGuardUtils.isWorldGuardLoaded())
if (WorldGuardUtils.isWorldGuardLoaded())
{
if(attacker instanceof Player) {
if (attacker instanceof Player) {
if(!WorldGuardManager.getInstance().hasMainFlag((Player) attacker)) {
if (!WorldGuardManager.getInstance().hasMainFlag((Player) attacker)) {
return;
}
} else if(attacker instanceof Projectile projectile) {
} else if (attacker instanceof Projectile projectile) {
if(projectile.getShooter() instanceof Player) {
if(!WorldGuardManager.getInstance().hasMainFlag((Player) projectile.getShooter())) {
if (projectile.getShooter() instanceof Player) {
if (!WorldGuardManager.getInstance().hasMainFlag((Player) projectile.getShooter())) {
return;
}
}
@ -286,7 +286,7 @@ public class EntityListener implements Listener {
}
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld())) {
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld())) {
return;
}
@ -335,8 +335,8 @@ public class EntityListener implements Listener {
//Friendly fire checks
if (defender instanceof Player defendingPlayer) {
//If the attacker is a Player or a projectile belonging to a player
if(attacker instanceof Projectile projectile) {
if(projectile.getShooter() instanceof Player attackingPlayer && !attackingPlayer.equals(defendingPlayer)) {
if (attacker instanceof Projectile projectile) {
if (projectile.getShooter() instanceof Player attackingPlayer && !attackingPlayer.equals(defendingPlayer)) {
//Check for friendly fire and cancel the event
if (checkIfInPartyOrSamePlayer(event, defendingPlayer, attackingPlayer)) {
return;
@ -362,9 +362,9 @@ public class EntityListener implements Listener {
}
//Required setup for processCombatAttack
if(attacker instanceof Projectile) {
if (attacker instanceof Projectile) {
ProjectileSource shooter = ((Projectile) attacker).getShooter();
if(shooter instanceof LivingEntity) {
if (shooter instanceof LivingEntity) {
attacker = (LivingEntity) shooter;
}
}
@ -378,8 +378,8 @@ public class EntityListener implements Listener {
* Surprising this kind of thing
*
*/
if(mcMMO.isProjectKorraEnabled()) {
if(event.getFinalDamage() == 0) {
if (mcMMO.isProjectKorraEnabled()) {
if (event.getFinalDamage() == 0) {
return;
}
}
@ -390,22 +390,22 @@ public class EntityListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = false)
public void onEntityDamageMonitor(EntityDamageByEntityEvent entityDamageEvent) {
if(entityDamageEvent.getEntity() instanceof LivingEntity livingEntity) {
if (entityDamageEvent.getEntity() instanceof LivingEntity livingEntity) {
if(entityDamageEvent.getFinalDamage() >= livingEntity.getHealth()) {
if (entityDamageEvent.getFinalDamage() >= livingEntity.getHealth()) {
//This sets entity names back to whatever they are supposed to be
CombatUtils.fixNames(livingEntity);
}
}
if(entityDamageEvent.getDamager() instanceof Arrow arrow) {
if (entityDamageEvent.getDamager() instanceof Arrow arrow) {
CombatUtils.delayArrowMetaCleanup(arrow);
}
if(entityDamageEvent.getEntity() instanceof Player player && entityDamageEvent.getDamager() instanceof Player) {
if (entityDamageEvent.getEntity() instanceof Player player && entityDamageEvent.getDamager() instanceof Player) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(mmoPlayer != null) {
if(mmoPlayer.isDebugMode()) {
if (mmoPlayer != null) {
if (mmoPlayer.isDebugMode()) {
player.sendMessage(ChatColor.GOLD + "(mmodebug start of combat report) EntityDamageByEntityEvent DEBUG Info:");
player.sendMessage("You are being damaged by another player in this event");
player.sendMessage("Raw Damage: " + entityDamageEvent.getDamage());
@ -419,7 +419,7 @@ public class EntityListener implements Listener {
player.sendMessage("Final damage: " + entityDamageEvent.getFinalDamage());
if(entityDamageEvent.isCancelled()) {
if (entityDamageEvent.isCancelled()) {
player.sendMessage("Event was cancelled, which means no damage should be done.");
}
@ -428,10 +428,10 @@ public class EntityListener implements Listener {
}
}
if(entityDamageEvent.getDamager() instanceof Player player && entityDamageEvent.getEntity() instanceof Player otherPlayer) {
if (entityDamageEvent.getDamager() instanceof Player player && entityDamageEvent.getEntity() instanceof Player otherPlayer) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(mmoPlayer != null) {
if(mmoPlayer.isDebugMode()) {
if (mmoPlayer != null) {
if (mmoPlayer.isDebugMode()) {
player.sendMessage(ChatColor.GOLD + "(mmodebug start of combat report) EntityDamageByEntityEvent DEBUG Info:");
player.sendMessage("You are dealing damage to another player in this event");
player.sendMessage("Raw Damage: " + entityDamageEvent.getDamage());
@ -445,7 +445,7 @@ public class EntityListener implements Listener {
player.sendMessage("Target players max health: "+otherPlayer.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
player.sendMessage("Target players current health: "+otherPlayer.getHealth());
if(entityDamageEvent.isCancelled()) {
if (entityDamageEvent.isCancelled()) {
player.sendMessage("Event was cancelled, which means no damage should be done.");
}
@ -461,7 +461,7 @@ public class EntityListener implements Listener {
return true;
}
if(!pluginRef.isPartySystemEnabled()) {
if (!pluginRef.isPartySystemEnabled()) {
return false;
}
@ -470,7 +470,7 @@ public class EntityListener implements Listener {
}
//Party Friendly Fire
if(!mcMMO.p.getGeneralConfig().getPartyFriendlyFire())
if (!mcMMO.p.getGeneralConfig().getPartyFriendlyFire())
if ((mcMMO.p.getPartyManager().inSameParty(defendingPlayer, attackingPlayer)
|| mcMMO.p.getPartyManager().areAllies(defendingPlayer, attackingPlayer))
&& !(Permissions.friendlyFire(attackingPlayer)
@ -490,19 +490,19 @@ public class EntityListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityDamage(EntityDamageEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
return;
if(event.getEntity().hasMetadata(MetadataConstants.METADATA_KEY_EXPLOSION_FROM_RUPTURE)) {
if (event.getEntity().hasMetadata(MetadataConstants.METADATA_KEY_EXPLOSION_FROM_RUPTURE)) {
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))
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
}
@ -559,7 +559,7 @@ public class EntityListener implements Listener {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Profile not loaded
if(mcMMOPlayer == null)
if (mcMMOPlayer == null)
return;
/* Check for invincibility */
@ -577,12 +577,12 @@ 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))
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
}
@ -592,7 +592,7 @@ public class EntityListener implements Listener {
Wolf wolf = (Wolf) pet;
//Profile not loaded
if(UserManager.getPlayer(player) == null)
if (UserManager.getPlayer(player) == null)
{
return;
}
@ -679,12 +679,12 @@ public class EntityListener implements Listener {
public void onEntityDeath(EntityDeathEvent event) {
LivingEntity entity = event.getEntity();
if(mcMMO.getTransientEntityTracker().isTransientSummon(entity)) {
if (mcMMO.getTransientEntityTracker().isTransientSummon(entity)) {
mcMMO.getTransientEntityTracker().removeSummon(entity, null, false);
}
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld())) {
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld())) {
return;
}
@ -704,7 +704,7 @@ public class EntityListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void onCreatureSpawn(CreatureSpawnEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
return;
LivingEntity livingEntity = event.getEntity();
@ -732,7 +732,7 @@ public class EntityListener implements Listener {
flagMetadata(mobMetaFlagType, livingEntity);
for(Entity passenger : livingEntity.getPassengers()) {
if(passenger != null) {
if (passenger != null) {
flagMetadata(mobMetaFlagType, livingEntity);
}
}
@ -740,8 +740,8 @@ public class EntityListener implements Listener {
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onEntityBreed(EntityBreedEvent event) {
if(ExperienceConfig.getInstance().isCOTWBreedingPrevented()) {
if(hasMobFlag(MobMetaFlagType.COTW_SUMMONED_MOB, event.getFather()) || hasMobFlag(MobMetaFlagType.COTW_SUMMONED_MOB, event.getMother())) {
if (ExperienceConfig.getInstance().isCOTWBreedingPrevented()) {
if (hasMobFlag(MobMetaFlagType.COTW_SUMMONED_MOB, event.getFather()) || hasMobFlag(MobMetaFlagType.COTW_SUMMONED_MOB, event.getMother())) {
event.setCancelled(true);
Animals mom = (Animals) event.getMother();
Animals father = (Animals) event.getFather();
@ -751,7 +751,7 @@ public class EntityListener implements Listener {
father.setLoveModeTicks(0);
//Inform the player
if(event.getBreeder() instanceof Player player) {
if (event.getBreeder() instanceof Player player) {
NotificationManager.sendPlayerInformationChatOnly(player, "Taming.Summon.COTW.BreedingDisallowed");
}
}
@ -767,7 +767,7 @@ public class EntityListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onExplosionPrime(ExplosionPrimeEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
return;
Entity entity = event.getEntity();
@ -785,15 +785,15 @@ 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))
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -813,7 +813,7 @@ public class EntityListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEnitityExplode(EntityExplodeEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
return;
Entity entity = event.getEntity();
@ -831,14 +831,14 @@ public class EntityListener implements Listener {
}
/* WORLD GUARD MAIN FLAG CHECK */
if(WorldGuardUtils.isWorldGuardLoaded())
if (WorldGuardUtils.isWorldGuardLoaded())
{
if(!WorldGuardManager.getInstance().hasMainFlag(player))
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
//Profile not loaded
if(UserManager.getPlayer(player) == null)
if (UserManager.getPlayer(player) == null)
{
return;
}
@ -860,7 +860,7 @@ public class EntityListener implements Listener {
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onFoodLevelChange(FoodLevelChangeEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
return;
Entity entity = event.getEntity();
@ -870,15 +870,15 @@ 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))
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -898,9 +898,9 @@ public class EntityListener implements Listener {
//The main hand is used over the off hand if they both have food, so check the main hand first
Material foodInHand;
if(mcMMO.getMaterialMapStore().isFood(player.getInventory().getItemInMainHand().getType())) {
if (mcMMO.getMaterialMapStore().isFood(player.getInventory().getItemInMainHand().getType())) {
foodInHand = player.getInventory().getItemInMainHand().getType();
} else if(mcMMO.getMaterialMapStore().isFood(player.getInventory().getItemInOffHand().getType())) {
} else if (mcMMO.getMaterialMapStore().isFood(player.getInventory().getItemInOffHand().getType())) {
foodInHand = player.getInventory().getItemInOffHand().getType();
} else {
return; //Not Food
@ -913,7 +913,7 @@ public class EntityListener implements Listener {
*/
//Hacky 1.17 support
if(foodInHand.getKey().getKey().equalsIgnoreCase("glow_berries")) {
if (foodInHand.getKey().getKey().equalsIgnoreCase("glow_berries")) {
if (Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_FARMERS_DIET)) {
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(newFoodLevel));
}
@ -984,7 +984,7 @@ public class EntityListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityTame(EntityTameEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
return;
if (event instanceof FakeEntityTameEvent) {
@ -994,9 +994,9 @@ 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))
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -1012,7 +1012,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;
}
@ -1029,7 +1029,7 @@ public class EntityListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityTarget(EntityTargetEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
return;
Entity entity = event.getEntity();
@ -1040,9 +1040,9 @@ public class EntityListener implements Listener {
}
/* WORLD GUARD MAIN FLAG CHECK */
if(WorldGuardUtils.isWorldGuardLoaded())
if (WorldGuardUtils.isWorldGuardLoaded())
{
if(!WorldGuardManager.getInstance().hasMainFlag(player))
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -1068,7 +1068,7 @@ public class EntityListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPotionSplash(PotionSplashEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
return;
ItemMeta meta = event.getPotion().getItem().getItemMeta();
@ -1095,8 +1095,8 @@ public class EntityListener implements Listener {
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
return;
if(event.getEntity() instanceof Arrow arrow) {
if(arrow.isShotFromCrossbow()) {
if (event.getEntity() instanceof Arrow arrow) {
if (arrow.isShotFromCrossbow()) {
Crossbows.processCrossbows(event, pluginRef, arrow);
}
}

View File

@ -19,13 +19,13 @@ public class InteractionManager {
public static void initMaps() {
/* INIT MAPS */
if(interactRegister == null)
if (interactRegister == null)
interactRegister = new HashMap<>();
if(subSkillList == null)
if (subSkillList == null)
subSkillList = new ArrayList<>();
if(subSkillNameMap == null)
if (subSkillNameMap == null)
subSkillNameMap = new HashMap<>();
}
@ -36,7 +36,7 @@ public class InteractionManager {
public static void registerSubSkill(AbstractSubSkill abstractSubSkill)
{
//Store a unique copy of each subskill
if(!subSkillList.contains(abstractSubSkill))
if (!subSkillList.contains(abstractSubSkill))
subSkillList.add(abstractSubSkill);
//Init ArrayList
@ -75,7 +75,7 @@ public class InteractionManager {
*/
public static void processEvent(Event event, mcMMO plugin, InteractType curInteractType)
{
if(interactRegister.get(curInteractType) == null)
if (interactRegister.get(curInteractType) == null)
return;
for(Interaction interaction : interactRegister.get(curInteractType))

View File

@ -42,7 +42,7 @@ public class InventoryListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onFurnaceBurnEvent(FurnaceBurnEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
return;
Block furnaceBlock = event.getBlock();
@ -57,7 +57,7 @@ public class InventoryListener implements Listener {
OfflinePlayer offlinePlayer = ContainerMetadataUtils.getContainerOwner(furnace);
Player player;
if(offlinePlayer != null && offlinePlayer.isOnline() && offlinePlayer instanceof Player) {
if (offlinePlayer != null && offlinePlayer.isOnline() && offlinePlayer instanceof Player) {
player = (Player) offlinePlayer;
if (!Permissions.isSubSkillEnabled(player, SubSkillType.SMELTING_FUEL_EFFICIENCY)) {
@ -66,10 +66,10 @@ public class InventoryListener implements Listener {
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(mmoPlayer != null) {
if (mmoPlayer != null) {
boolean debugMode = mmoPlayer.isDebugMode();
if(debugMode) {
if (debugMode) {
player.sendMessage("FURNACE FUEL EFFICIENCY DEBUG REPORT");
player.sendMessage("Furnace - "+furnace.hashCode());
player.sendMessage("Furnace Type: "+furnaceBlock.getType());
@ -78,7 +78,7 @@ public class InventoryListener implements Listener {
event.setBurnTime(mmoPlayer.getSmeltingManager().fuelEfficiency(event.getBurnTime()));
if(debugMode) {
if (debugMode) {
player.sendMessage("New Furnace Burn Length (after applying fuel efficiency) "+event.getBurnTime());
player.sendMessage("");
}
@ -89,7 +89,7 @@ public class InventoryListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onFurnaceSmeltEvent(FurnaceSmeltEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
return;
BlockState blockState = event.getBlock().getState(); //Furnaces can only be cast from a BlockState not a Block
@ -99,15 +99,15 @@ public class InventoryListener implements Listener {
return;
}
if(blockState instanceof Furnace furnace) {
if (blockState instanceof Furnace furnace) {
OfflinePlayer offlinePlayer = ContainerMetadataUtils.getContainerOwner(furnace);
if(offlinePlayer != null) {
if (offlinePlayer != null) {
McMMOPlayer offlineProfile = UserManager.getOfflinePlayer(offlinePlayer);
//Profile doesn't exist
if(offlineProfile != null) {
if (offlineProfile != null) {
//Process smelting
offlineProfile.getSmeltingManager().smeltProcessing(event, furnace);
}
@ -118,7 +118,7 @@ public class InventoryListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onFurnaceExtractEvent(FurnaceExtractEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
return;
BlockState furnaceBlock = event.getBlock().getState();
@ -129,11 +129,11 @@ public class InventoryListener implements Listener {
Player player = event.getPlayer();
if(furnaceBlock instanceof Furnace) {
if (furnaceBlock instanceof Furnace) {
/* WORLD GUARD MAIN FLAG CHECK */
if(WorldGuardUtils.isWorldGuardLoaded())
if (WorldGuardUtils.isWorldGuardLoaded())
{
if(!WorldGuardManager.getInstance().hasMainFlag(player))
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -142,7 +142,7 @@ public class InventoryListener implements Listener {
}
//Profile not loaded
if(UserManager.getPlayer(player) == null)
if (UserManager.getPlayer(player) == null)
{
return;
}
@ -156,11 +156,11 @@ public class InventoryListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onInventoryClickEventNormal(InventoryClickEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getWhoClicked().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getWhoClicked().getWorld()))
return;
//We should never care to do processing if the player clicks outside the window
// if(isOutsideWindowClick(event))
// if (isOutsideWindowClick(event))
// return;
Inventory inventory = event.getInventory();
@ -168,12 +168,12 @@ public class InventoryListener implements Listener {
Player player = ((Player) event.getWhoClicked()).getPlayer();
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(event.getInventory() instanceof FurnaceInventory furnaceInventory) {
if (event.getInventory() instanceof FurnaceInventory furnaceInventory) {
//Switch owners
ContainerMetadataUtils.processContainerOwnership(furnaceInventory.getHolder(), player);
}
if(event.getInventory() instanceof BrewerInventory brewerInventory) {
if (event.getInventory() instanceof BrewerInventory brewerInventory) {
// switch owners
ContainerMetadataUtils.processContainerOwnership(brewerInventory.getHolder(), player);
}
@ -196,9 +196,9 @@ 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))
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -291,7 +291,7 @@ public class InventoryListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onInventoryDragEvent(InventoryDragEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getWhoClicked().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getWhoClicked().getWorld()))
return;
Inventory inventory = event.getInventory();
@ -323,9 +323,9 @@ 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))
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -345,7 +345,7 @@ public class InventoryListener implements Listener {
public void onBrew(BrewEvent event)
{
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
return;
if (event instanceof FakeBrewEvent)
@ -361,7 +361,7 @@ public class InventoryListener implements Listener {
// @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
// public void onBrewStart(BrewingStartEvent event) {
// /* WORLD BLACKLIST CHECK */
// if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
// if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
// return;
//
// if (event instanceof FakeEvent)
@ -372,8 +372,8 @@ public class InventoryListener implements Listener {
public void onInventoryMoveItemEvent(InventoryMoveItemEvent event) {
/* WORLD BLACKLIST CHECK */
if(event.getSource().getLocation() != null)
if(WorldBlacklist.isWorldBlacklisted(event.getSource().getLocation().getWorld()))
if (event.getSource().getLocation() != null)
if (WorldBlacklist.isWorldBlacklisted(event.getSource().getLocation().getWorld()))
return;
final Inventory inventory = event.getDestination();
@ -416,19 +416,19 @@ public class InventoryListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onInventoryClickEvent(InventoryClickEvent event) {
if(event.getCurrentItem() == null) {
if (event.getCurrentItem() == null) {
return;
}
SkillUtils.removeAbilityBuff(event.getCurrentItem());
if (event.getAction() == InventoryAction.HOTBAR_SWAP) {
if(isOutsideWindowClick(event))
if (isOutsideWindowClick(event))
return;
PlayerInventory playerInventory = event.getWhoClicked().getInventory();
if(playerInventory.getItem(event.getHotbarButton()) != null)
if (playerInventory.getItem(event.getHotbarButton()) != null)
SkillUtils.removeAbilityBuff(playerInventory.getItem(event.getHotbarButton()));
}
}
@ -441,7 +441,7 @@ public class InventoryListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onCraftItem(CraftItemEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getWhoClicked().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getWhoClicked().getWorld()))
return;
final HumanEntity whoClicked = event.getWhoClicked();
@ -460,9 +460,9 @@ 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))
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}

View File

@ -71,13 +71,13 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerTeleport(PlayerTeleportEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld())) {
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld())) {
//Remove scoreboards
if(mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
if (mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
ScoreboardManager.teardownPlayer(event.getPlayer());
}
return;
} else if(WorldBlacklist.isWorldBlacklisted(event.getFrom().getWorld()) && mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
} else if (WorldBlacklist.isWorldBlacklisted(event.getFrom().getWorld()) && mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
//This only fires if they are travelling to a non-blacklisted world from a blacklisted world
//Setup scoreboards
@ -87,9 +87,9 @@ 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))
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -98,7 +98,7 @@ public class PlayerListener implements Listener {
}
//Profile not loaded
if(UserManager.getPlayer(player) == null)
if (UserManager.getPlayer(player) == null)
{
return;
}
@ -164,7 +164,7 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerDeathMonitor(PlayerDeathEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
return;
boolean statLossEnabled = HardcoreManager.isStatLossEnabled();
@ -183,9 +183,9 @@ 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))
if (!WorldGuardManager.getInstance().hasMainFlag(killedPlayer))
return;
}
@ -227,7 +227,7 @@ public class PlayerListener implements Listener {
}
//Profile not loaded
if(UserManager.getPlayer(player) == null)
if (UserManager.getPlayer(player) == null)
{
return;
}
@ -250,13 +250,13 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerDropItem(PlayerDropItemEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
return;
/* WORLD GUARD MAIN FLAG CHECK */
if(WorldGuardUtils.isWorldGuardLoaded())
if (WorldGuardUtils.isWorldGuardLoaded())
{
if(!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
return;
}
@ -281,15 +281,15 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerFishHighest(PlayerFishEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
return;
Player player = event.getPlayer();
/* WORLD GUARD MAIN FLAG CHECK */
if(WorldGuardUtils.isWorldGuardLoaded())
if (WorldGuardUtils.isWorldGuardLoaded())
{
if(!WorldGuardManager.getInstance().hasMainFlag(player))
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -298,7 +298,7 @@ public class PlayerListener implements Listener {
}
//Profile not loaded
if(UserManager.getPlayer(player) == null)
if (UserManager.getPlayer(player) == null)
{
return;
}
@ -308,7 +308,7 @@ public class PlayerListener implements Listener {
switch (event.getState()) {
case CAUGHT_FISH:
//TODO Update to new API once available! Waiting for case CAUGHT_TREASURE
if(event.getCaught() != null) {
if (event.getCaught() != null) {
Item fishingCatch = (Item) event.getCaught();
if (mcMMO.p.getGeneralConfig().getFishingOverrideTreasures() &&
@ -329,7 +329,7 @@ public class PlayerListener implements Listener {
if (Permissions.vanillaXpBoost(player, PrimarySkillType.FISHING)) {
//Don't modify XP below vanilla values
if(fishingManager.handleVanillaXpBoost(event.getExpToDrop()) > 1)
if (fishingManager.handleVanillaXpBoost(event.getExpToDrop()) > 1)
event.setExpToDrop(fishingManager.handleVanillaXpBoost(event.getExpToDrop()));
}
}
@ -367,15 +367,15 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerFishMonitor(PlayerFishEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
return;
Player player = event.getPlayer();
/* WORLD GUARD MAIN FLAG CHECK */
if(WorldGuardUtils.isWorldGuardLoaded())
if (WorldGuardUtils.isWorldGuardLoaded())
{
if(!WorldGuardManager.getInstance().hasMainFlag(player))
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -384,7 +384,7 @@ public class PlayerListener implements Listener {
}
//Profile not loaded
if(UserManager.getPlayer(player) == null)
if (UserManager.getPlayer(player) == null)
{
return;
}
@ -393,19 +393,19 @@ public class PlayerListener implements Listener {
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
//Track the hook
if(ExperienceConfig.getInstance().isFishingExploitingPrevented())
if (ExperienceConfig.getInstance().isFishingExploitingPrevented())
{
if(event.getHook().getMetadata(MetadataConstants.METADATA_KEY_FISH_HOOK_REF).size() == 0)
if (event.getHook().getMetadata(MetadataConstants.METADATA_KEY_FISH_HOOK_REF).size() == 0)
{
fishingManager.setFishHookReference(event.getHook());
}
//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();
}
@ -421,19 +421,19 @@ public class PlayerListener implements Listener {
ItemStack inHand = player.getInventory().getItemInMainHand();
//Grab lure level
if(inHand != null
if (inHand != null
&& inHand.getItemMeta() != null
&& inHand.getType().getKey().getKey().equalsIgnoreCase("fishing_rod")) {
if(inHand.getItemMeta().hasEnchants()) {
if (inHand.getItemMeta().hasEnchants()) {
for(Enchantment enchantment : inHand.getItemMeta().getEnchants().keySet()) {
if(enchantment.toString().toLowerCase().contains("lure")) {
if (enchantment.toString().toLowerCase().contains("lure")) {
lureLevel = inHand.getEnchantmentLevel(enchantment);
}
}
}
// Prevent any potential odd behavior by only processing if no offhand fishing rod is present
if(!player.getInventory().getItemInOffHand().getType().getKey().getKey().equalsIgnoreCase("fishing_rod")) {
if (!player.getInventory().getItemInOffHand().getType().getKey().getKey().equalsIgnoreCase("fishing_rod")) {
// In case of offhand fishing rod, don't process anything
fishingManager.masterAngler(event.getHook(), lureLevel);
fishingManager.setFishingTarget();
@ -442,8 +442,8 @@ public class PlayerListener implements Listener {
}
return;
case CAUGHT_FISH:
if(caught instanceof Item) {
if(ExperienceConfig.getInstance().isFishingExploitingPrevented()) {
if (caught instanceof Item) {
if (ExperienceConfig.getInstance().isFishingExploitingPrevented()) {
fishingManager.processExploiting(event.getHook().getLocation().toVector());
@ -482,20 +482,20 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerPickupItem(EntityPickupItemEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
return;
if(Misc.isNPCEntityExcludingVillagers(event.getEntity())) {
if (Misc.isNPCEntityExcludingVillagers(event.getEntity())) {
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))
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -505,7 +505,7 @@ public class PlayerListener implements Listener {
//Profile not loaded
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if(mcMMOPlayer == null) {
if (mcMMOPlayer == null) {
return;
}
@ -513,7 +513,7 @@ public class PlayerListener implements Listener {
ItemStack dropStack = drop.getItemStack();
//Remove tracking
if(drop.hasMetadata(MetadataConstants.METADATA_KEY_TRACKED_ARROW)) {
if (drop.hasMetadata(MetadataConstants.METADATA_KEY_TRACKED_ARROW)) {
drop.removeMetadata(MetadataConstants.METADATA_KEY_TRACKED_ARROW, mcMMO.p);
}
@ -566,7 +566,7 @@ public class PlayerListener implements Listener {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Profile not loaded
if(mcMMOPlayer == null) {
if (mcMMOPlayer == null) {
return;
}
@ -618,7 +618,7 @@ public class PlayerListener implements Listener {
}
//Profile not loaded
if(UserManager.getPlayer(player) == null)
if (UserManager.getPlayer(player) == null)
{
return;
}
@ -634,28 +634,28 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerInteractLowest(PlayerInteractEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
return;
Player player = event.getPlayer();
/* WORLD GUARD MAIN FLAG CHECK */
if(WorldGuardUtils.isWorldGuardLoaded())
if (WorldGuardUtils.isWorldGuardLoaded())
{
if(!WorldGuardManager.getInstance().hasMainFlag(player))
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
if(event.getClickedBlock() == null)
if (event.getClickedBlock() == null)
return;
Block clickedBlock = event.getClickedBlock();
Material clickedBlockType = clickedBlock.getType();
//The blacklist contains interactable blocks so its a convenient filter
if(clickedBlockType == Repair.anvilMaterial || clickedBlockType == Salvage.anvilMaterial) {
if (clickedBlockType == Repair.anvilMaterial || clickedBlockType == Salvage.anvilMaterial) {
event.setUseItemInHand(Event.Result.ALLOW);
if(!event.getPlayer().isSneaking() && mcMMO.getMaterialMapStore().isToolActivationBlackListed(clickedBlockType)) {
if (!event.getPlayer().isSneaking() && mcMMO.getMaterialMapStore().isToolActivationBlackListed(clickedBlockType)) {
event.setUseInteractedBlock(Event.Result.DENY);
}
}
@ -665,7 +665,7 @@ public class PlayerListener implements Listener {
}
//Profile not loaded
if(UserManager.getPlayer(player) == null)
if (UserManager.getPlayer(player) == null)
{
return;
}
@ -764,15 +764,15 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerInteractMonitor(PlayerInteractEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
return;
Player player = event.getPlayer();
/* WORLD GUARD MAIN FLAG CHECK */
if(WorldGuardUtils.isWorldGuardLoaded())
if (WorldGuardUtils.isWorldGuardLoaded())
{
if(!WorldGuardManager.getInstance().hasMainFlag(player))
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
@ -781,7 +781,7 @@ public class PlayerListener implements Listener {
}
//Profile not loaded
if(UserManager.getPlayer(player) == null)
if (UserManager.getPlayer(player) == null)
{
return;
}
@ -793,12 +793,12 @@ 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()
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))
if (player.isInsideVehicle() && (player.getVehicle() instanceof Minecart || player.getVehicle() instanceof PoweredMinecart))
{
player.getVehicle().eject();
}
@ -809,12 +809,12 @@ public class PlayerListener implements Listener {
switch (event.getAction()) {
case RIGHT_CLICK_BLOCK:
if(player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isInsideVehicle() && !player.isSneaking()) {
if (player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isInsideVehicle() && !player.isSneaking()) {
break;
}
//Hmm
if(event.getClickedBlock() == null)
if (event.getClickedBlock() == null)
return;
Block block = event.getClickedBlock();
@ -841,7 +841,7 @@ public class PlayerListener implements Listener {
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
// FakePlayerAnimationEvent fakeSwing = new FakePlayerAnimationEvent(event.getPlayer(), PlayerAnimationType.ARM_SWING); //PlayerAnimationEvent compat
if(!event.isCancelled() || event.useInteractedBlock() != Event.Result.DENY) {
if (!event.isCancelled() || event.useInteractedBlock() != Event.Result.DENY) {
//TODO: Is this code to set false from bone meal even needed? I'll have to double check later.
if (heldItem.getType() == Material.BONE_MEAL) {
switch (blockState.getType().toString()) {
@ -859,7 +859,7 @@ public class PlayerListener implements Listener {
if (herbalismManager.canGreenThumbBlock(blockState)) {
//call event for Green Thumb Block
if(!EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_GREEN_THUMB, block).isCancelled()) {
if (!EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_GREEN_THUMB, block).isCancelled()) {
// Bukkit.getPluginManager().callEvent(fakeSwing);
player.getInventory().getItemInMainHand().setAmount(heldItem.getAmount() - 1);
player.updateInventory();
@ -870,7 +870,7 @@ public class PlayerListener implements Listener {
}
/* SHROOM THUMB CHECK */
else if (herbalismManager.canUseShroomThumb(blockState)) {
if(!EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_SHROOM_THUMB, block).isCancelled()) {
if (!EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_SHROOM_THUMB, block).isCancelled()) {
// Bukkit.getPluginManager().callEvent(fakeSwing);
event.setCancelled(true);
if (herbalismManager.processShroomThumb(blockState)
@ -885,7 +885,7 @@ public class PlayerListener implements Listener {
break;
case RIGHT_CLICK_AIR:
if(player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isInsideVehicle() && !player.isSneaking()) {
if (player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isInsideVehicle() && !player.isSneaking()) {
break;
}
@ -960,9 +960,9 @@ public class PlayerListener implements Listener {
return;
}
if(plugin.getChatManager().isChatChannelEnabled(mcMMOPlayer.getChatChannel())) {
if(mcMMOPlayer.getChatChannel() != ChatChannel.NONE) {
if(plugin.getChatManager().isMessageAllowed(mcMMOPlayer)) {
if (plugin.getChatManager().isChatChannelEnabled(mcMMOPlayer.getChatChannel())) {
if (mcMMOPlayer.getChatChannel() != ChatChannel.NONE) {
if (plugin.getChatManager().isMessageAllowed(mcMMOPlayer)) {
//If the message is allowed we cancel this event to avoid double sending messages
plugin.getChatManager().processPlayerMessage(mcMMOPlayer, event.getMessage(), event.isAsynchronous());
event.setCancelled(true);

View File

@ -37,10 +37,10 @@ public class SelfListener implements Listener {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//TODO: Handle proper validation at the event level
if(mcMMOPlayer == null || !mcMMOPlayer.getProfile().isLoaded())
if (mcMMOPlayer == null || !mcMMOPlayer.getProfile().isLoaded())
return;
if(player.isOnline()) {
if (player.isOnline()) {
//Players can gain multiple levels especially during xprate events
for(int i = 0; i < event.getLevelsGained(); i++)
{
@ -52,7 +52,7 @@ public class SelfListener implements Listener {
//Reset the delay timer
RankUtils.resetUnlockDelayTimer();
if(mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
if (mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
ScoreboardManager.handleLevelUp(player, skill);
}
}
@ -61,8 +61,8 @@ public class SelfListener implements Listener {
public void onPlayerXp(McMMOPlayerXpGainEvent event) {
Player player = event.getPlayer();
if(player.isOnline()) {
if(mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
if (player.isOnline()) {
if (mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
ScoreboardManager.handleXp(player, event.getSkill());
}
}
@ -70,8 +70,8 @@ public class SelfListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onAbility(McMMOPlayerAbilityActivateEvent event) {
Player player = event.getPlayer();
if(player.isOnline()) {
if(mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
if (player.isOnline()) {
if (mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
ScoreboardManager.cooldownUpdate(event.getPlayer(), event.getSkill());
}
}
@ -82,30 +82,30 @@ public class SelfListener implements Listener {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//TODO: Handle proper validation at the event level
if(mcMMOPlayer == null || !mcMMOPlayer.getProfile().isLoaded())
if (mcMMOPlayer == null || !mcMMOPlayer.getProfile().isLoaded())
return;
PrimarySkillType primarySkillType = event.getSkill();
if(mcMMOPlayer.isDebugMode()) {
if (mcMMOPlayer.isDebugMode()) {
mcMMOPlayer.getPlayer().sendMessage(event.getSkill().toString() + " XP Gained");
mcMMOPlayer.getPlayer().sendMessage("Incoming Raw XP: "+event.getRawXpGained());
}
//WorldGuard XP Check
if(event.getXpGainReason() == XPGainReason.PVE ||
if (event.getXpGainReason() == XPGainReason.PVE ||
event.getXpGainReason() == XPGainReason.PVP ||
event.getXpGainReason() == XPGainReason.SHARED_PVE ||
event.getXpGainReason() == XPGainReason.SHARED_PVP)
{
if(WorldGuardUtils.isWorldGuardLoaded())
if (WorldGuardUtils.isWorldGuardLoaded())
{
if(!WorldGuardManager.getInstance().hasXPFlag(player))
if (!WorldGuardManager.getInstance().hasXPFlag(player))
{
event.setRawXpGained(0);
event.setCancelled(true);
if(mcMMOPlayer.isDebugMode()) {
if (mcMMOPlayer.isDebugMode()) {
mcMMOPlayer.getPlayer().sendMessage("No WG XP Flag - New Raw XP: "+event.getRawXpGained());
}
}
@ -117,13 +117,13 @@ public class SelfListener implements Listener {
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);
@ -133,7 +133,7 @@ public class SelfListener implements Listener {
int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(primarySkillType);
if (threshold <= 0 || !ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
if(mcMMOPlayer.isDebugMode()) {
if (mcMMOPlayer.isDebugMode()) {
mcMMOPlayer.getPlayer().sendMessage("Final Raw XP: "+event.getRawXpGained());
}
// Diminished returns is turned off
@ -167,7 +167,7 @@ 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);
@ -181,7 +181,7 @@ public class SelfListener implements Listener {
}
if(mcMMOPlayer.isDebugMode()) {
if (mcMMOPlayer.isDebugMode()) {
mcMMOPlayer.getPlayer().sendMessage("Final Raw XP: "+event.getRawXpGained());
}
}

View File

@ -26,7 +26,7 @@ public class WorldListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onStructureGrow(StructureGrowEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getWorld()))
return;
// Using 50 ms later as I do not know of a way to run one tick later (safely)
@ -45,7 +45,7 @@ public class WorldListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onWorldUnload(WorldUnloadEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getWorld()))
return;
mcMMO.getPlaceStore().unloadWorld(event.getWorld());
@ -59,7 +59,7 @@ public class WorldListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onChunkUnload(ChunkUnloadEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getWorld()))
if (WorldBlacklist.isWorldBlacklisted(event.getWorld()))
return;
Chunk chunk = event.getChunk();

View File

@ -380,7 +380,7 @@ public final class LocaleLoader {
* @return The message with the hex color codes translated to Minecraft color codes
*/
public static String translateHexColorCodes(String messageWithHex) {
if(messageWithHex == null) {
if (messageWithHex == null) {
return null;
}

View File

@ -207,7 +207,7 @@ public class mcMMO extends JavaPlugin {
checkModConfigs();
}
if(projectKorraEnabled) {
if (projectKorraEnabled) {
getLogger().info("ProjectKorra was detected, this can cause some issues with weakness potions and combat skills for mcMMO");
}
@ -228,7 +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()
@ -237,7 +237,7 @@ public class mcMMO extends JavaPlugin {
20, 20*60*30
);
if(platformManager.getServerSoftware() == ServerSoftwareType.CRAFT_BUKKIT)
if (platformManager.getServerSoftware() == ServerSoftwareType.CRAFT_BUKKIT)
{
foliaLib
.getImpl()
@ -280,11 +280,11 @@ public class mcMMO extends JavaPlugin {
//If anonymous statistics are enabled then use them
Metrics metrics;
if(generalConfig.getIsMetricsEnabled()) {
if (generalConfig.getIsMetricsEnabled()) {
metrics = new Metrics(this, 3894);
metrics.addCustomChart(new SimplePie("version", () -> getDescription().getVersion()));
if(generalConfig.getIsRetroMode())
if (generalConfig.getIsRetroMode())
metrics.addCustomChart(new SimplePie("leveling_system", () -> "Retro"));
else
metrics.addCustomChart(new SimplePie("leveling_system", () -> "Standard"));
@ -323,7 +323,7 @@ public class mcMMO extends JavaPlugin {
transientEntityTracker = new TransientEntityTracker();
setServerShutdown(false); //Reset flag, used to make decisions about async saves
if(Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
new PapiExpansion().register();
}
}
@ -351,7 +351,7 @@ public class mcMMO extends JavaPlugin {
@Override
public void onLoad()
{
if(getServer().getPluginManager().getPlugin("WorldGuard") != null) {
if (getServer().getPluginManager().getPlugin("WorldGuard") != null) {
WorldGuardManager.getInstance().registerFlags();
}
@ -372,11 +372,11 @@ public class mcMMO extends JavaPlugin {
UserManager.saveAll(); // Make sure to save player information if the server shuts down
UserManager.clearAll();
Alchemy.finishAllBrews(); // Finish all partially complete AlchemyBrewTasks to prevent vanilla brewing continuation on restart
if(partyConfig.isPartyEnabled())
if (partyConfig.isPartyEnabled())
getPartyManager().saveParties(); // Save our parties
//TODO: Needed?
if(generalConfig.getScoreboardsEnabled())
if (generalConfig.getScoreboardsEnabled())
ScoreboardManager.teardownAll();
formulaManager.saveFormula();
@ -615,7 +615,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");
@ -657,7 +657,7 @@ public class mcMMO extends JavaPlugin {
}
// Automatically remove old members from parties
if(partyConfig.isPartyEnabled()) {
if (partyConfig.isPartyEnabled()) {
long kickIntervalTicks = generalConfig.getAutoPartyKickInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
if (kickIntervalTicks == 0) {
@ -675,7 +675,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

@ -243,7 +243,7 @@ public final class PartyManager {
}
final McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(mmoPlayer == null)
if (mmoPlayer == null)
return null;
return mmoPlayer.getParty();

View File

@ -51,7 +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,7 +115,7 @@ public final class ShareHandler {
McMMOPlayer mcMMOMember = UserManager.getPlayer(member);
//Profile not loaded
if(UserManager.getPlayer(member) == null)
if (UserManager.getPlayer(member) == null)
{
continue;
}

View File

@ -17,7 +17,7 @@ public class MobDodgeMetaCleanup extends CancellableRunnable {
@Override
public void run() {
if(!mob.isValid() || mob.getTarget() == null) {
if (!mob.isValid() || mob.getTarget() == null) {
mob.removeMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER, pluginRef);
this.cancel();
} else if (!mob.hasMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER)) {

View File

@ -19,7 +19,7 @@ public class SaveTimerTask extends CancellableRunnable {
count++;
}
if(mcMMO.p.getPartyConfig().isPartyEnabled())
if (mcMMO.p.getPartyConfig().isPartyEnabled())
mcMMO.p.getPartyManager().saveParties();
}
}

View File

@ -17,7 +17,7 @@ public class TravelingBlockMetaCleanup extends CancellableRunnable {
@Override
public void run() {
if(!entity.isValid()) {
if (!entity.isValid()) {
entity.removeMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, pluginRef);
this.cancel();
} else if (!entity.hasMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK)) {

View File

@ -45,14 +45,14 @@ public class MctopCommandDisplayTask extends CancellableRunnable {
if (sender instanceof Player) {
((Player) sender).removeMetadata(MetadataConstants.METADATA_KEY_DATABASE_COMMAND, mcMMO.p);
}
if(sender instanceof Player)
if (sender instanceof Player)
sender.sendMessage(LocaleLoader.getString("Commands.mctop.Tip"));
}
private void displayChat() {
if (skill == null) {
if(sender instanceof Player) {
if (sender instanceof Player) {
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
}
else {
@ -60,7 +60,7 @@ public class MctopCommandDisplayTask extends CancellableRunnable {
}
}
else {
if(sender instanceof Player) {
if (sender instanceof Player) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));
}
else {
@ -74,7 +74,7 @@ public class MctopCommandDisplayTask extends CancellableRunnable {
// Format:
// 01. Playername - skill value
// 12. Playername - skill value
if(sender instanceof Player) {
if (sender instanceof Player) {
sender.sendMessage(String.format("%2d. %s%s - %s%s", place, ChatColor.GREEN, stat.name, ChatColor.WHITE, stat.statVal));
}
else {

View File

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

View File

@ -44,7 +44,7 @@ public class PlayerProfileLoadingTask extends CancellableRunnable {
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(player);
if(!profile.isLoaded()) {
if (!profile.isLoaded()) {
LogUtils.debug(mcMMO.p.getLogger(), "Creating new data for player: "+player.getName());
//Profile isn't loaded so add as new user
profile = mcMMO.getDatabaseManager().newUser(player);

View File

@ -62,7 +62,7 @@ public class AbilityDisableTask extends CancellableRunnable {
if (mcMMO.p.getAdvancedConfig().sendAbilityNotificationToOtherPlayers()) {
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff());
}
if(!mcMMO.isServerShutdownExecuted()) {
if (!mcMMO.isServerShutdownExecuted()) {
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new AbilityCooldownTask(mcMMOPlayer, ability), (long) PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
}
}

View File

@ -40,7 +40,7 @@ public class AwardCombatXpTask extends CancellableRunnable {
damage += health;
}
if(ExperienceConfig.getInstance().useCombatHPCeiling()) {
if (ExperienceConfig.getInstance().useCombatHPCeiling()) {
damage = Math.min(damage, ExperienceConfig.getInstance().getCombatHPCeiling());
}

View File

@ -43,7 +43,7 @@
//// debugMessage+="RemainingTicks=["+containerEntry.getValue().bleedTicks+"], ";
//
// if (containerEntry.getValue().bleedTicks <= 0 || !target.isValid()) {
// if(target instanceof Player)
// if (target instanceof Player)
// {
// NotificationManager.sendPlayerInformation((Player) target, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding.Stopped");
// }
@ -96,7 +96,7 @@
//
//// debugMessage+="FullArmor=["+String.valueOf(armorCount > 3)+"], ";
//
// if(armorCount > 3)
// if (armorCount > 3)
// {
// damage = damage * .75;
// }
@ -104,13 +104,13 @@
//// debugMessage+="AfterRankAndArmorChecks["+damage+"], ";
//
// //Weapons below Diamond get damage cut in half
// if(toolTier < 4)
// if (toolTier < 4)
// damage = damage / 2;
//
//// debugMessage+="AfterDiamondCheck=["+String.valueOf(damage)+"], ";
//
// //Wood weapons get damage cut in half again
// if(toolTier < 2)
// if (toolTier < 2)
// damage = damage / 2;
//
//// debugMessage+="AfterWoodenCheck=["+String.valueOf(damage)+"], ";
@ -129,7 +129,7 @@
//
//// debugMessage+="TargetHealthAfterDMG=["+String.valueOf(target.getHealth())+"], ";
//
// if(victimHealthAftermath <= 0 || victimHealth != victimHealthAftermath)
// if (victimHealthAftermath <= 0 || victimHealth != victimHealthAftermath)
// {
// //Play Bleed Sound
// SoundManager.worldSendSound(target.getWorld(), target.getLocation(), SoundType.BLEED);
@ -187,7 +187,7 @@
// throw new IllegalStateException("Cannot add bleed task async!");
// }
//
// if(isIterating) {
// if (isIterating) {
// //Used to throw an error here, but in reality all we are really doing is preventing concurrency issues from other plugins being naughty and its not really needed
// //I'm not really a fan of silent errors, but I'm sick of seeing people using crazy enchantments come in and report this "bug"
// return;
@ -195,7 +195,7 @@
//
//// if (isIterating) throw new IllegalStateException("Cannot add task while iterating timers!");
//
// if(toolTier < 4)
// if (toolTier < 4)
// ticks = Math.max(1, (ticks / 3));
//
// ticks+=1;

View File

@ -35,7 +35,7 @@ public class DelayedCropReplant extends CancellableRunnable {
public DelayedCropReplant(BlockBreakEvent blockBreakEvent, BlockState cropState, int desiredCropAge, boolean wasImmaturePlant) {
BlockData cropData = cropState.getBlockData();
if(cropData instanceof Directional cropDir) {
if (cropData instanceof Directional cropDir) {
cropFace = cropDir.getFacing();
}
@ -56,13 +56,13 @@ public class DelayedCropReplant extends CancellableRunnable {
//Remove the metadata marking the block as recently replanted
mcMMO.p.getFoliaLib().getImpl().runAtLocationLater(blockBreakEvent.getBlock().getLocation(), new markPlantAsOld(blockBreakEvent.getBlock().getLocation()), 10);
if(blockBreakEvent.isCancelled()) {
if (blockBreakEvent.isCancelled()) {
wasImmaturePlant = true;
}
//Two kinds of air in Minecraft
if(currentState.getType().equals(cropMaterial) || currentState.getType().equals(Material.AIR) || currentState.getType().equals(Material.CAVE_AIR)) {
// if(currentState.getBlock().getRelative(BlockFace.DOWN))
if (currentState.getType().equals(cropMaterial) || currentState.getType().equals(Material.AIR) || currentState.getType().equals(Material.CAVE_AIR)) {
// if (currentState.getBlock().getRelative(BlockFace.DOWN))
//The space is not currently occupied by a block so we can fill it
cropBlock.setType(cropMaterial);
@ -74,19 +74,19 @@ public class DelayedCropReplant extends CancellableRunnable {
int age = 0;
//Crop age should always be 0 if the plant was immature
if(!wasImmaturePlant) {
if (!wasImmaturePlant) {
age = desiredCropAge;
//Otherwise make the plant the desired age
}
if(newData instanceof Directional) {
if (newData instanceof Directional) {
//Cocoa Version
Directional directional = (Directional) newState.getBlockData();
directional.setFacing(cropFace);
newState.setBlockData(directional);
if(newData instanceof Cocoa) {
if (newData instanceof Cocoa) {
plantAnchorType = PlantAnchorType.COCOA;
}
}
@ -119,7 +119,7 @@ public class DelayedCropReplant extends CancellableRunnable {
this.plantBlock = plantBlock;
this.plantAnchorType = plantAnchorType;
if(plantFace != null) {
if (plantFace != null) {
this.plantFace = plantFace;
}
}
@ -140,8 +140,8 @@ public class DelayedCropReplant extends CancellableRunnable {
private void checkPlantIntegrity(@NotNull BlockFace blockFace) {
Block neighbor = plantBlock.getRelative(blockFace);
if(plantAnchorType == PlantAnchorType.COCOA) {
if(!neighbor.getType().toString().toLowerCase().contains("jungle")) {
if (plantAnchorType == PlantAnchorType.COCOA) {
if (!neighbor.getType().toString().toLowerCase().contains("jungle")) {
plantBlock.breakNaturally();
}
} else {
@ -171,7 +171,7 @@ public class DelayedCropReplant extends CancellableRunnable {
@Override
public void run() {
Block cropBlock = cropLoc.getBlock();
if(cropBlock.getMetadata(MetadataConstants.METADATA_KEY_REPLANT).size() > 0)
if (cropBlock.getMetadata(MetadataConstants.METADATA_KEY_REPLANT).size() > 0)
cropBlock.setMetadata(MetadataConstants.METADATA_KEY_REPLANT, new RecentlyReplantedCropMeta(mcMMO.p, false));
}
}

View File

@ -30,7 +30,7 @@ public class ExperienceBarHideTask extends CancellableRunnable {
*/
@Override
public void run() {
if(experienceBarManagerRef == null || mcMMOPlayer == null)
if (experienceBarManagerRef == null || mcMMOPlayer == null)
return;
experienceBarManagerRef.hideExperienceBar(primarySkillType);

View File

@ -42,15 +42,15 @@ public class RuptureTask extends CancellableRunnable {
@Override
public void run() {
//Check validity
if(targetEntity.isValid()) {
if (targetEntity.isValid()) {
ruptureTick += 1; //Advance rupture tick by 1.
damageTickTracker += 1; //Increment damage tick tracker
//TODO: Clean this code up, applyRupture() is a confusing name for something that returns boolean
//Rupture hasn't ended yet
if(ruptureTick < expireTick) {
if (ruptureTick < expireTick) {
//Is it time to damage?
if(damageTickTracker >= DAMAGE_TICK_INTERVAL) {
if (damageTickTracker >= DAMAGE_TICK_INTERVAL) {
damageTickTracker = 0; //Reset timer
if (applyRupture()) return;
@ -58,7 +58,7 @@ public class RuptureTask extends CancellableRunnable {
playAnimation();
}
} else {
if(!applyRupture()) {
if (!applyRupture()) {
playAnimation();
}
@ -71,7 +71,7 @@ public class RuptureTask extends CancellableRunnable {
}
private void playAnimation() {
if(animationTick >= ANIMATION_TICK_INTERVAL) {
if (animationTick >= ANIMATION_TICK_INTERVAL) {
ParticleEffectUtils.playBleedEffect(targetEntity); //Animate
animationTick = 0;
} else {
@ -114,7 +114,7 @@ public class RuptureTask extends CancellableRunnable {
//
// ParticleEffectUtils.playGreaterImpactEffect(targetEntity); //Animate
//
// if(ruptureSource.getPlayer() != null && ruptureSource.getPlayer().isValid()) {
// if (ruptureSource.getPlayer() != null && ruptureSource.getPlayer().isValid()) {
// targetEntity.damage(getExplosionDamage(), ruptureSource.getPlayer());
// } else {
// targetEntity.damage(getExplosionDamage(), null);
@ -129,10 +129,10 @@ public class RuptureTask extends CancellableRunnable {
private double calculateAdjustedTickDamage() {
double tickDamage = pureTickDamage;
if(targetEntity.getHealth() <= tickDamage) {
if (targetEntity.getHealth() <= tickDamage) {
tickDamage = targetEntity.getHealth() - 0.01;
if(tickDamage <= 0) {
if (tickDamage <= 0) {
tickDamage = 0;
}
}

View File

@ -51,10 +51,10 @@ public class AcrobaticsManager extends SkillManager {
public boolean canGainRollXP()
{
if(!ExperienceConfig.getInstance().isAcrobaticsExploitingPrevented())
if (!ExperienceConfig.getInstance().isAcrobaticsExploitingPrevented())
return true;
if(System.currentTimeMillis() >= rollXPCooldown)
if (System.currentTimeMillis() >= rollXPCooldown)
{
rollXPCooldown = System.currentTimeMillis() + rollXPInterval;
rollXPIntervalLengthen = (1000 * 10); //5 Seconds
@ -67,10 +67,10 @@ public class AcrobaticsManager extends SkillManager {
}
public boolean canDodge(Entity damager) {
if(getPlayer().isBlocking())
if (getPlayer().isBlocking())
return false;
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ACROBATICS_DODGE))
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ACROBATICS_DODGE))
return false;
if (Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ACROBATICS_DODGE)) {
@ -103,14 +103,14 @@ public class AcrobaticsManager extends SkillManager {
}
if (SkillUtils.cooldownExpired(mmoPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)) {
if(attacker instanceof Mob mob) {
if (attacker instanceof Mob mob) {
//Check to see how many dodge XP rewards this mob has handed out
if(mob.hasMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER) && ExperienceConfig.getInstance().isAcrobaticsExploitingPrevented()) {
if (mob.hasMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER) && ExperienceConfig.getInstance().isAcrobaticsExploitingPrevented()) {
//If Dodge XP has been handed out 5 times then consider it being exploited
MetadataValue metadataValue = mob.getMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER).get(0);
int count = metadataValue.asInt();
if(count <= 5) {
if (count <= 5) {
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVE);
mob.setMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER, new FixedMetadataValue(mcMMO.p, count + 1));
MobDodgeMetaCleanup metaCleanupTask = new MobDodgeMetaCleanup(mob, mcMMO.p);

View File

@ -85,7 +85,7 @@ public final class AlchemyPotionBrewer {
}
private static void removeIngredient(BrewerInventory inventory, Player player) {
if(inventory.getIngredient() == null)
if (inventory.getIngredient() == null)
return;
ItemStack ingredient = inventory.getIngredient().clone();
@ -137,7 +137,7 @@ public final class AlchemyPotionBrewer {
}
private static List<ItemStack> getValidIngredients(@Nullable McMMOPlayer mmoPlayer) {
if(mmoPlayer == null) {
if (mmoPlayer == null) {
return mcMMO.p.getPotionConfig().getIngredients(1);
}
@ -202,7 +202,7 @@ public final class AlchemyPotionBrewer {
// Update the brewing inventory with the new potions
for (int i = 0; i < 3; i++) {
if(outputList.get(i) != null) {
if (outputList.get(i) != null) {
inventory.setItem(i, outputList.get(i));
}
}

View File

@ -27,21 +27,21 @@ public class ArcheryManager extends SkillManager {
}
public boolean canDaze(LivingEntity target) {
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_DAZE))
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_DAZE))
return false;
return target instanceof Player && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ARCHERY_DAZE);
}
public boolean canSkillShot() {
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_SKILL_SHOT))
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_SKILL_SHOT))
return false;
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ARCHERY_SKILL_SHOT);
}
public boolean canRetrieveArrows() {
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_ARROW_RETRIEVAL))
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_ARROW_RETRIEVAL))
return false;
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ARCHERY_ARROW_RETRIEVAL);
@ -55,13 +55,13 @@ public class ArcheryManager extends SkillManager {
*/
public static double distanceXpBonusMultiplier(LivingEntity target, Entity arrow) {
//Hacky Fix - some plugins spawn arrows and assign them to players after the ProjectileLaunchEvent fires
if(!arrow.hasMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE))
if (!arrow.hasMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE))
return 1;
Location firedLocation = (Location) arrow.getMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE).get(0).value();
Location targetLocation = target.getLocation();
if(firedLocation == null || firedLocation.getWorld() == null)
if (firedLocation == null || firedLocation.getWorld() == null)
return 1;
if (firedLocation.getWorld() != targetLocation.getWorld()) {
@ -77,7 +77,7 @@ public class ArcheryManager extends SkillManager {
* @param target The {@link LivingEntity} damaged by the arrow
*/
public void retrieveArrows(LivingEntity target, Projectile projectile) {
if(projectile.hasMetadata(MetadataConstants.METADATA_KEY_TRACKED_ARROW)) {
if (projectile.hasMetadata(MetadataConstants.METADATA_KEY_TRACKED_ARROW)) {
Archery.incrementTrackerValue(target);
projectile.removeMetadata(MetadataConstants.METADATA_KEY_TRACKED_ARROW, mcMMO.p); //Only 1 entity per projectile
}

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