Merge master

This commit is contained in:
nossr50
2019-04-04 19:20:24 -07:00
10 changed files with 332 additions and 201 deletions

View File

@ -497,6 +497,10 @@ public class AdvancedConfig extends ConfigValidated {
/* GENERAL */
public int getStartingLevel() { return getIntValue(SKILLS, GENERAL, STARTING_LEVEL); }
public boolean allowPlayerTips() {
return config.getBoolean("Feedback.PlayerTips", true);
}
/**
* This returns the maximum level at which superabilities will stop lengthening from scaling alongside skill level.
* It returns a different value depending on whether or not the server is in retro mode

View File

@ -18,6 +18,7 @@ import com.gmail.nossr50.listeners.*;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.runnables.SaveTimerTask;
import com.gmail.nossr50.runnables.backups.CleanBackupsTask;
import com.gmail.nossr50.runnables.commands.NotifySquelchReminderTask;
import com.gmail.nossr50.runnables.database.UserPurgeTask;
import com.gmail.nossr50.runnables.party.PartyAutoKickTask;
import com.gmail.nossr50.runnables.player.ClearRegisteredXPGainTask;
@ -592,6 +593,11 @@ public class mcMMO extends JavaPlugin {
if (ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
new ClearRegisteredXPGainTask().runTaskTimer(this, 60, 60);
}
if(AdvancedConfig.getInstance().allowPlayerTips())
{
new NotifySquelchReminderTask().runTaskTimer(this, 60, ((20 * 60) * 60));
}
}
/*private void checkModConfigs() {

View File

@ -0,0 +1,23 @@
package com.gmail.nossr50.runnables.commands;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
public class NotifySquelchReminderTask extends BukkitRunnable {
@Override
public void run() {
for (Player player : Bukkit.getOnlinePlayers()) {
if(UserManager.getPlayer(player) != null)
{
if(!UserManager.getPlayer(player).useChatNotifications())
{
player.sendMessage(LocaleLoader.getString("Reminder.Squelched"));
}
}
}
}
}

View File

@ -43,7 +43,7 @@ public class MiningManager extends SkillManager {
Player player = getPlayer();
return canUseBlastMining() && player.isSneaking()
&& ItemUtils.isPickaxe(getPlayer().getInventory().getItemInMainHand())
&& (ItemUtils.isPickaxe(getPlayer().getInventory().getItemInMainHand()) || player.getInventory().getItemInMainHand().getType() == Config.getInstance().getDetonatorItem())
&& Permissions.remoteDetonation(player);
}

View File

@ -8,10 +8,7 @@ import com.google.common.collect.ImmutableSet;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.NPC;
import org.bukkit.entity.Player;
import org.bukkit.entity.*;
import org.bukkit.inventory.ItemStack;
import java.util.Collection;
@ -43,7 +40,10 @@ public final class Misc {
private Misc() {}
public static boolean isNPCEntity(Entity entity) {
return (entity == null || entity.hasMetadata("NPC") || entity instanceof NPC || entity.getClass().getName().equalsIgnoreCase("cofh.entity.PlayerFake"));
return (entity == null
|| (entity.hasMetadata("NPC") && !(entity instanceof Villager))
|| (entity instanceof NPC && !(entity instanceof Villager))
|| entity.getClass().getName().equalsIgnoreCase("cofh.entity.PlayerFake"));
}
/**

View File

@ -28,6 +28,9 @@ public class NotificationManager {
*/
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key)
{
if(!UserManager.getPlayer(player).useChatNotifications())
return;
ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
TextComponent message = TextComponentFactory.getNotificationTextComponentFromLocale(key, notificationType);
@ -57,8 +60,10 @@ public class NotificationManager {
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key, String... values)
{
ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
if(!UserManager.getPlayer(player).useChatNotifications())
return;
ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
TextComponent message = TextComponentFactory.getNotificationMultipleValues(key, notificationType, values);
McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(player, notificationType, destination, message);
@ -103,6 +108,9 @@ public class NotificationManager {
*/
public static void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkillType skillName, int levelsGained, int newLevel)
{
if(!UserManager.getPlayer(mcMMOPlayer.getPlayer()).useChatNotifications())
return;
ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(NotificationType.LEVEL_UP_MESSAGE) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
TextComponent levelUpTextComponent = TextComponentFactory.getNotificationLevelUpTextComponent(skillName, levelsGained, newLevel);
@ -121,6 +129,9 @@ public class NotificationManager {
public static void sendPlayerUnlockNotification(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType)
{
if(!UserManager.getPlayer(mcMMOPlayer.getPlayer()).useChatNotifications())
return;
//CHAT MESSAGE
mcMMOPlayer.getPlayer().spigot().sendMessage(TextComponentFactory.getSubSkillUnlockedNotificationComponents(mcMMOPlayer.getPlayer(), subSkillType));