mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-31 03:25:28 +02:00
NotificationManager now uses a getter in mcMMO
This commit is contained in:
@@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.items.ChimaeraWingWarmup;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
@@ -48,7 +47,7 @@ public final class ChimaeraWing {
|
||||
}
|
||||
|
||||
if (!Permissions.chimaeraWing(player)) {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission");
|
||||
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -65,7 +64,7 @@ public final class ChimaeraWing {
|
||||
int amount = inHand.getAmount();
|
||||
|
||||
if (amount < mcMMO.getConfigManager().getConfigItems().getChimaeraWingUseCost()) {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Item.ChimaeraWing.NotEnough",
|
||||
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Item.ChimaeraWing.NotEnough",
|
||||
String.valueOf(mcMMO.getConfigManager().getConfigItems().getChimaeraWingUseCost() - amount), "Item.ChimaeraWing.Name");
|
||||
return;
|
||||
}
|
||||
@@ -77,7 +76,7 @@ public final class ChimaeraWing {
|
||||
int timeRemaining = SkillUtils.calculateTimeLeft(lastTeleport * Misc.TIME_CONVERSION_FACTOR, cooldown, player);
|
||||
|
||||
if (timeRemaining > 0) {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.ABILITY_COOLDOWN, "Item.Generic.Wait", String.valueOf(timeRemaining));
|
||||
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.ABILITY_COOLDOWN, "Item.Generic.Wait", String.valueOf(timeRemaining));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -89,7 +88,7 @@ public final class ChimaeraWing {
|
||||
int timeRemaining = SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, hurtCooldown, player);
|
||||
|
||||
if (timeRemaining > 0) {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Item.Injured.Wait", String.valueOf(timeRemaining));
|
||||
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Item.Injured.Wait", String.valueOf(timeRemaining));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -99,7 +98,7 @@ public final class ChimaeraWing {
|
||||
if (mcMMO.getConfigManager().getConfigItems().isPreventUndergroundUse()) {
|
||||
if (location.getY() < player.getWorld().getHighestBlockYAt(location)) {
|
||||
player.getInventory().setItemInMainHand(new ItemStack(getChimaeraWing(amount - mcMMO.getConfigManager().getConfigItems().getChimaeraWingUseCost())));
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Item.ChimaeraWing.Fail");
|
||||
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Item.ChimaeraWing.Fail");
|
||||
player.updateInventory();
|
||||
player.setVelocity(new Vector(0, 0.5D, 0));
|
||||
CombatUtils.dealDamage(player, Misc.getRandom().nextInt((int) (player.getHealth() - 10)));
|
||||
@@ -113,7 +112,7 @@ public final class ChimaeraWing {
|
||||
long warmup = mcMMO.getConfigManager().getConfigItems().getChimaeraWingWarmup();
|
||||
|
||||
if (warmup > 0) {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Teleport.Commencing", String.valueOf(warmup));
|
||||
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Teleport.Commencing", String.valueOf(warmup));
|
||||
new ChimaeraWingWarmup(mcMMOPlayer).runTaskLater(mcMMO.p, 20 * warmup);
|
||||
} else {
|
||||
chimaeraExecuteTeleport();
|
||||
@@ -143,7 +142,7 @@ public final class ChimaeraWing {
|
||||
SoundManager.sendSound(player, location, SoundType.CHIMAERA_WING);
|
||||
}
|
||||
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Item.ChimaeraWing.Pass");
|
||||
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Item.ChimaeraWing.Pass");
|
||||
}
|
||||
|
||||
public static ItemStack getChimaeraWing(int amount) {
|
||||
|
@@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -56,7 +55,7 @@ public final class HardcoreManager {
|
||||
return;
|
||||
}
|
||||
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.HARDCORE_MODE, "Hardcore.DeathStatLoss.PlayerDeath", String.valueOf(totalLevelsLost));
|
||||
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.HARDCORE_MODE, "Hardcore.DeathStatLoss.PlayerDeath", String.valueOf(totalLevelsLost));
|
||||
}
|
||||
|
||||
public static void invokeVampirism(Player killer, Player victim) {
|
||||
@@ -105,11 +104,11 @@ public final class HardcoreManager {
|
||||
}
|
||||
|
||||
if (totalLevelsStolen > 0) {
|
||||
NotificationManager.sendPlayerInformation(killer, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Killer.Success", String.valueOf(totalLevelsStolen), victim.getName());
|
||||
NotificationManager.sendPlayerInformation(victim, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Victim.Success", killer.getName(), String.valueOf(totalLevelsStolen));
|
||||
mcMMO.getNotificationManager().sendPlayerInformation(killer, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Killer.Success", String.valueOf(totalLevelsStolen), victim.getName());
|
||||
mcMMO.getNotificationManager().sendPlayerInformation(victim, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Victim.Success", killer.getName(), String.valueOf(totalLevelsStolen));
|
||||
} else {
|
||||
NotificationManager.sendPlayerInformation(killer, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Killer.Failure", victim.getName());
|
||||
NotificationManager.sendPlayerInformation(victim, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Victim.Failure", killer.getName());
|
||||
mcMMO.getNotificationManager().sendPlayerInformation(killer, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Killer.Failure", victim.getName());
|
||||
mcMMO.getNotificationManager().sendPlayerInformation(victim, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Victim.Failure", killer.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -31,7 +31,7 @@ public class NotificationManager {
|
||||
* @param notificationType notifications defined type
|
||||
* @param key the locale key for the notifications defined message
|
||||
*/
|
||||
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key) {
|
||||
public void sendPlayerInformation(Player player, NotificationType notificationType, String key) {
|
||||
if (UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||
return;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class NotificationManager {
|
||||
}
|
||||
|
||||
|
||||
public static boolean doesPlayerUseNotifications(Player player) {
|
||||
public boolean doesPlayerUseNotifications(Player player) {
|
||||
if (UserManager.getPlayer(player) == null)
|
||||
return false;
|
||||
else
|
||||
@@ -60,12 +60,12 @@ public class NotificationManager {
|
||||
* @param key Locale Key for the string to use with this event
|
||||
* @param values values to be injected into the locale string
|
||||
*/
|
||||
public static void sendNearbyPlayersInformation(Player targetPlayer, NotificationType notificationType, String key, String... values)
|
||||
public void sendNearbyPlayersInformation(Player targetPlayer, NotificationType notificationType, String key, String... values)
|
||||
{
|
||||
sendPlayerInformation(targetPlayer, notificationType, key, values);
|
||||
}
|
||||
|
||||
public static void sendPlayerInformationChatOnly(Player player, String key, String... values)
|
||||
public void sendPlayerInformationChatOnly(Player player, String key, String... values)
|
||||
{
|
||||
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||
return;
|
||||
@@ -74,7 +74,7 @@ public class NotificationManager {
|
||||
player.sendMessage(preColoredString);
|
||||
}
|
||||
|
||||
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key, String... values)
|
||||
public void sendPlayerInformation(Player player, NotificationType notificationType, String key, String... values)
|
||||
{
|
||||
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||
return;
|
||||
@@ -87,7 +87,7 @@ public class NotificationManager {
|
||||
sendNotification(player, customEvent);
|
||||
}
|
||||
|
||||
private static void sendNotification(Player player, McMMOPlayerNotificationEvent customEvent) {
|
||||
private void sendNotification(Player player, McMMOPlayerNotificationEvent customEvent) {
|
||||
if (customEvent.isCancelled())
|
||||
return;
|
||||
|
||||
@@ -104,7 +104,7 @@ public class NotificationManager {
|
||||
}
|
||||
}
|
||||
|
||||
private static McMMOPlayerNotificationEvent checkNotificationEvent(Player player, NotificationType notificationType, ChatMessageType destination, TextComponent message) {
|
||||
private McMMOPlayerNotificationEvent checkNotificationEvent(Player player, NotificationType notificationType, ChatMessageType destination, TextComponent message) {
|
||||
//Init event
|
||||
McMMOPlayerNotificationEvent customEvent = new McMMOPlayerNotificationEvent(player,
|
||||
notificationType, message, destination, AdvancedConfig.getInstance().doesNotificationSendCopyToChat(notificationType));
|
||||
@@ -121,7 +121,7 @@ public class NotificationManager {
|
||||
* @param skillName skill that leveled up
|
||||
* @param newLevel new level of that skill
|
||||
*/
|
||||
public static void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkillType skillName, int levelsGained, int newLevel) {
|
||||
public void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkillType skillName, int levelsGained, int newLevel) {
|
||||
if (!mcMMOPlayer.useChatNotifications())
|
||||
return;
|
||||
|
||||
@@ -133,13 +133,13 @@ public class NotificationManager {
|
||||
sendNotification(mcMMOPlayer.getPlayer(), customEvent);
|
||||
}
|
||||
|
||||
public static void broadcastTitle(Server server, String title, String subtitle, int i1, int i2, int i3) {
|
||||
public void broadcastTitle(Server server, String title, String subtitle, int i1, int i2, int i3) {
|
||||
for (Player player : server.getOnlinePlayers()) {
|
||||
player.sendTitle(title, subtitle, i1, i2, i3);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendPlayerUnlockNotification(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType) {
|
||||
public void sendPlayerUnlockNotification(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType) {
|
||||
if (!mcMMOPlayer.useChatNotifications())
|
||||
return;
|
||||
|
||||
@@ -163,7 +163,7 @@ public class NotificationManager {
|
||||
*
|
||||
* @param msg message fetched from locale
|
||||
*/
|
||||
private static void sendAdminNotification(String msg) {
|
||||
private void sendAdminNotification(String msg) {
|
||||
//If its not enabled exit
|
||||
if (!mcMMO.getConfigManager().getConfigAdmin().isSendAdminNotifications())
|
||||
return;
|
||||
@@ -184,7 +184,7 @@ public class NotificationManager {
|
||||
* @param commandSender target command sender
|
||||
* @param msg message fetched from locale
|
||||
*/
|
||||
private static void sendAdminCommandConfirmation(CommandSender commandSender, String msg) {
|
||||
private void sendAdminCommandConfirmation(CommandSender commandSender, String msg) {
|
||||
commandSender.sendMessage(LocaleLoader.getString("Notifications.Admin.Format.Self", msg));
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ public class NotificationManager {
|
||||
* @param commandSender the command user
|
||||
* @param sensitiveCommandType type of command issued
|
||||
*/
|
||||
public static void processSensitiveCommandNotification(CommandSender commandSender, SensitiveCommandType sensitiveCommandType, String... args) {
|
||||
public void processSensitiveCommandNotification(CommandSender commandSender, SensitiveCommandType sensitiveCommandType, String... args) {
|
||||
/*
|
||||
* Determine the 'identity' of the one who executed the command to pass as a parameters
|
||||
*/
|
||||
@@ -225,7 +225,7 @@ public class NotificationManager {
|
||||
* @param existingArray the existing array to be copied to the new array at position [0]+1 relative to their original index
|
||||
* @return the new array combining itemToAdd at the start and existing array elements following while retaining their order
|
||||
*/
|
||||
public static String[] addItemToFirstPositionOfArray(String itemToAdd, String... existingArray) {
|
||||
public String[] addItemToFirstPositionOfArray(String itemToAdd, String... existingArray) {
|
||||
String[] newArray = new String[existingArray.length + 1];
|
||||
newArray[0] = itemToAdd;
|
||||
|
||||
|
@@ -21,7 +21,6 @@ import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
import com.gmail.nossr50.skills.unarmed.Unarmed;
|
||||
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
||||
import com.gmail.nossr50.util.*;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.bukkit.GameMode;
|
||||
@@ -519,7 +518,7 @@ public final class CombatUtils {
|
||||
switch (type) {
|
||||
case SWORDS:
|
||||
if (entity instanceof Player) {
|
||||
NotificationManager.sendPlayerInformation((Player) entity, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.SS.Struck");
|
||||
mcMMO.getNotificationManager().sendPlayerInformation((Player) entity, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.SS.Struck");
|
||||
}
|
||||
|
||||
UserManager.getPlayer(attacker).getSwordsManager().ruptureCheck(target);
|
||||
@@ -527,7 +526,7 @@ public final class CombatUtils {
|
||||
|
||||
case AXES:
|
||||
if (entity instanceof Player) {
|
||||
NotificationManager.sendPlayerInformation((Player) entity, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.SS.Struck");
|
||||
mcMMO.getNotificationManager().sendPlayerInformation((Player) entity, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.SS.Struck");
|
||||
}
|
||||
|
||||
break;
|
||||
|
@@ -12,7 +12,6 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@@ -118,7 +117,7 @@ public class SkillUtils {
|
||||
|
||||
for (Player otherPlayer : player.getWorld().getPlayers()) {
|
||||
if (otherPlayer != player && Misc.isNear(location, otherPlayer.getLocation(), Misc.SKILL_MESSAGE_MAX_SENDING_DISTANCE)) {
|
||||
NotificationManager.sendNearbyPlayersInformation(otherPlayer, notificationType, key, player.getName());
|
||||
mcMMO.getNotificationManager().sendNearbyPlayersInformation(otherPlayer, notificationType, key, player.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user