mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
2.1.225
This commit is contained in:
parent
06160c6d04
commit
a54590576f
@ -1,3 +1,8 @@
|
|||||||
|
Version 2.1.225
|
||||||
|
Fixed various bugs with ability text
|
||||||
|
Updated Adventure dependencies
|
||||||
|
Added new API McMMOPlayerNotificationEvent.getPlayer
|
||||||
|
|
||||||
Version 2.1.224
|
Version 2.1.224
|
||||||
Updated to a new build of ACF to fix NoSuchFieldException locale
|
Updated to a new build of ACF to fix NoSuchFieldException locale
|
||||||
Improved Folia Support (Thanks HSGamer)
|
Improved Folia Support (Thanks HSGamer)
|
||||||
|
79
pom.xml
79
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||||
<artifactId>mcMMO</artifactId>
|
<artifactId>mcMMO</artifactId>
|
||||||
<version>2.1.225-SNAPSHOT</version>
|
<version>2.1.225</version>
|
||||||
<name>mcMMO</name>
|
<name>mcMMO</name>
|
||||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||||
<scm>
|
<scm>
|
||||||
@ -150,21 +150,20 @@
|
|||||||
<include>net.kyori:examination-api</include>
|
<include>net.kyori:examination-api</include>
|
||||||
<include>net.kyori:examination-string</include>
|
<include>net.kyori:examination-string</include>
|
||||||
<include>net.kyori:adventure-text-serializer-legacy</include>
|
<include>net.kyori:adventure-text-serializer-legacy</include>
|
||||||
|
<include>net.kyori:adventure-text-serializer-gson</include>
|
||||||
|
<include>net.kyori:adventure-text-serializer-json</include>
|
||||||
<include>net.kyori:adventure-text-serializer-bungeecord</include>
|
<include>net.kyori:adventure-text-serializer-bungeecord</include>
|
||||||
<include>net.kyori:adventure-text-serializer-craftbukkit</include>
|
<include>net.kyori:adventure-text-serializer-craftbukkit</include>
|
||||||
<include>net.kyori:adventure-text-serializer-gson-legacy-impl</include>
|
<include>net.kyori:adventure-text-serializer-gson-legacy-impl</include>
|
||||||
|
<include>net.kyori:adventure-text-serializer-json-legacy-impl</include>
|
||||||
<include>co.aikar:acf-bukkit</include>
|
<include>co.aikar:acf-bukkit</include>
|
||||||
<include>com.tcoded:FoliaLib</include>
|
<include>com.tcoded:FoliaLib</include>
|
||||||
</includes>
|
</includes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
<relocations>
|
<relocations>
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>net.kyori.examination</pattern>
|
<pattern>net.kyori</pattern>
|
||||||
<shadedPattern>com.gmail.nossr50.mcmmo.kyori.examination</shadedPattern>
|
<shadedPattern>com.gmail.nossr50.mcmmo.kyori</shadedPattern>
|
||||||
</relocation>
|
|
||||||
<relocation>
|
|
||||||
<pattern>net.kyori.adventure</pattern>
|
|
||||||
<shadedPattern>com.gmail.nossr50.mcmmo.kyori.adventure</shadedPattern>
|
|
||||||
</relocation>
|
</relocation>
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>co.aikar.commands</pattern>
|
<pattern>co.aikar.commands</pattern>
|
||||||
@ -269,41 +268,65 @@
|
|||||||
<artifactId>acf-bukkit</artifactId> <!-- Don't forget to replace this -->
|
<artifactId>acf-bukkit</artifactId> <!-- Don't forget to replace this -->
|
||||||
<version>0.5.1-SNAPSHOT</version> <!-- Replace this as well -->
|
<version>0.5.1-SNAPSHOT</version> <!-- Replace this as well -->
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- adventure-api, adventure-text-serializer-gson, adventure-platform-bukkit-->
|
<dependency>
|
||||||
|
<groupId>net.kyori</groupId>
|
||||||
|
<artifactId>adventure-text-serializer-bungeecord</artifactId>
|
||||||
|
<version>4.3.1</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-text-serializer-gson</artifactId>
|
<artifactId>adventure-text-serializer-gson</artifactId>
|
||||||
<version>4.13.0</version>
|
<version>4.14.0</version>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.kyori</groupId>
|
|
||||||
<artifactId>adventure-api</artifactId>
|
|
||||||
<version>4.13.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.kyori</groupId>
|
|
||||||
<artifactId>adventure-nbt</artifactId>
|
|
||||||
<version>4.13.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.kyori</groupId>
|
|
||||||
<artifactId>adventure-key</artifactId>
|
|
||||||
<version>4.13.0</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-text-serializer-gson-legacy-impl</artifactId>
|
<artifactId>adventure-text-serializer-gson-legacy-impl</artifactId>
|
||||||
<version>4.13.0</version>
|
<version>4.14.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-platform-bukkit</artifactId>
|
<artifactId>adventure-text-serializer-json</artifactId>
|
||||||
<version>4.3.0</version>
|
<version>4.14.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.kyori</groupId>
|
||||||
|
<artifactId>adventure-text-serializer-json-legacy-impl</artifactId>
|
||||||
|
<version>4.14.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.kyori</groupId>
|
||||||
|
<artifactId>adventure-api</artifactId>
|
||||||
|
<version>4.14.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.kyori</groupId>
|
||||||
|
<artifactId>adventure-nbt</artifactId>
|
||||||
|
<version>4.14.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.kyori</groupId>
|
||||||
|
<artifactId>adventure-key</artifactId>
|
||||||
|
<version>4.14.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-platform-api</artifactId>
|
<artifactId>adventure-platform-api</artifactId>
|
||||||
<version>4.3.0</version>
|
<version>4.3.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.kyori</groupId>
|
||||||
|
<artifactId>adventure-platform-bukkit</artifactId>
|
||||||
|
<version>4.3.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.kyori</groupId>
|
||||||
|
<artifactId>adventure-platform-facet</artifactId>
|
||||||
|
<version>4.3.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.kyori</groupId>
|
||||||
|
<artifactId>adventure-platform-viaversion</artifactId>
|
||||||
|
<version>4.3.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven.scm</groupId>
|
<groupId>org.apache.maven.scm</groupId>
|
||||||
|
@ -27,8 +27,13 @@ public class McMMOPlayerNotificationEvent extends Event implements Cancellable {
|
|||||||
protected Component notificationTextComponent;
|
protected Component notificationTextComponent;
|
||||||
protected final NotificationType notificationType;
|
protected final NotificationType notificationType;
|
||||||
|
|
||||||
public McMMOPlayerNotificationEvent(Player who, NotificationType notificationType, Component notificationTextComponent, McMMOMessageType chatMessageType, boolean isMessageAlsoBeingSentToChat) {
|
protected final Player player;
|
||||||
|
|
||||||
|
public McMMOPlayerNotificationEvent(Player player, NotificationType notificationType,
|
||||||
|
Component notificationTextComponent, McMMOMessageType chatMessageType,
|
||||||
|
boolean isMessageAlsoBeingSentToChat) {
|
||||||
super(false);
|
super(false);
|
||||||
|
this.player = player;
|
||||||
this.notificationType = notificationType;
|
this.notificationType = notificationType;
|
||||||
this.notificationTextComponent = notificationTextComponent;
|
this.notificationTextComponent = notificationTextComponent;
|
||||||
this.chatMessageType = chatMessageType;
|
this.chatMessageType = chatMessageType;
|
||||||
@ -48,6 +53,10 @@ public class McMMOPlayerNotificationEvent extends Event implements Cancellable {
|
|||||||
isMessageAlsoBeingSentToChat = messageAlsoBeingSentToChat;
|
isMessageAlsoBeingSentToChat = messageAlsoBeingSentToChat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Player getPlayer() {
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
|
||||||
public Component getNotificationTextComponent() {
|
public Component getNotificationTextComponent() {
|
||||||
return notificationTextComponent;
|
return notificationTextComponent;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ import com.gmail.nossr50.util.sounds.SoundType;
|
|||||||
import com.gmail.nossr50.util.text.McMMOMessageType;
|
import com.gmail.nossr50.util.text.McMMOMessageType;
|
||||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||||
import net.kyori.adventure.audience.Audience;
|
import net.kyori.adventure.audience.Audience;
|
||||||
import net.kyori.adventure.audience.MessageType;
|
|
||||||
import net.kyori.adventure.identity.Identity;
|
import net.kyori.adventure.identity.Identity;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.event.HoverEvent;
|
import net.kyori.adventure.text.event.HoverEvent;
|
||||||
@ -49,7 +48,9 @@ public class NotificationManager {
|
|||||||
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
McMMOMessageType destination = mcMMO.p.getAdvancedConfig().doesNotificationUseActionBar(notificationType) ? McMMOMessageType.ACTION_BAR : McMMOMessageType.SYSTEM;
|
McMMOMessageType destination
|
||||||
|
= mcMMO.p.getAdvancedConfig().doesNotificationUseActionBar(notificationType)
|
||||||
|
? McMMOMessageType.ACTION_BAR : McMMOMessageType.SYSTEM;
|
||||||
|
|
||||||
Component message = TextComponentFactory.getNotificationTextComponentFromLocale(key);
|
Component message = TextComponentFactory.getNotificationTextComponentFromLocale(key);
|
||||||
McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(player, notificationType, destination, message);
|
McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(player, notificationType, destination, message);
|
||||||
@ -75,7 +76,8 @@ public class NotificationManager {
|
|||||||
* @param key Locale Key for the string to use with this event
|
* @param key Locale Key for the string to use with this event
|
||||||
* @param values values to be injected into the locale string
|
* @param values values to be injected into the locale string
|
||||||
*/
|
*/
|
||||||
public static void sendNearbyPlayersInformation(Player targetPlayer, NotificationType notificationType, String key, String... values)
|
public static void sendNearbyPlayersInformation(Player targetPlayer, NotificationType notificationType, String key,
|
||||||
|
String... values)
|
||||||
{
|
{
|
||||||
sendPlayerInformation(targetPlayer, notificationType, key, values);
|
sendPlayerInformation(targetPlayer, notificationType, key, values);
|
||||||
}
|
}
|
||||||
@ -99,7 +101,8 @@ public class NotificationManager {
|
|||||||
player.sendMessage(prefixFormattedMessage);
|
player.sendMessage(prefixFormattedMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key, String... values)
|
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key,
|
||||||
|
String... values)
|
||||||
{
|
{
|
||||||
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||||
return;
|
return;
|
||||||
@ -119,24 +122,28 @@ public class NotificationManager {
|
|||||||
final Audience audience = mcMMO.getAudiences().player(player);
|
final Audience audience = mcMMO.getAudiences().player(player);
|
||||||
|
|
||||||
//If the message is being sent to the action bar we need to check if the copy if a copy is sent to the chat system
|
//If the message is being sent to the action bar we need to check if the copy if a copy is sent to the chat system
|
||||||
|
Component notificationTextComponent = customEvent.getNotificationTextComponent();
|
||||||
if(customEvent.getChatMessageType() == McMMOMessageType.ACTION_BAR)
|
if(customEvent.getChatMessageType() == McMMOMessageType.ACTION_BAR)
|
||||||
{
|
{
|
||||||
audience.sendActionBar(customEvent.getNotificationTextComponent());
|
audience.sendActionBar(notificationTextComponent);
|
||||||
|
|
||||||
if(customEvent.isMessageAlsoBeingSentToChat())
|
if(customEvent.isMessageAlsoBeingSentToChat())
|
||||||
{
|
{
|
||||||
//Send copy to chat system
|
//Send copy to chat system
|
||||||
audience.sendMessage(Identity.nil(), customEvent.getNotificationTextComponent(), MessageType.SYSTEM);
|
audience.sendMessage(notificationTextComponent);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
audience.sendMessage(Identity.nil(), customEvent.getNotificationTextComponent(), MessageType.SYSTEM);
|
audience.sendMessage(notificationTextComponent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static McMMOPlayerNotificationEvent checkNotificationEvent(Player player, NotificationType notificationType, McMMOMessageType destination, Component message) {
|
private static McMMOPlayerNotificationEvent checkNotificationEvent(Player player, NotificationType notificationType,
|
||||||
|
McMMOMessageType destination,
|
||||||
|
Component message) {
|
||||||
//Init event
|
//Init event
|
||||||
McMMOPlayerNotificationEvent customEvent = new McMMOPlayerNotificationEvent(player,
|
McMMOPlayerNotificationEvent customEvent = new McMMOPlayerNotificationEvent(player,
|
||||||
notificationType, message, destination, mcMMO.p.getAdvancedConfig().doesNotificationSendCopyToChat(notificationType));
|
notificationType, message, destination,
|
||||||
|
mcMMO.p.getAdvancedConfig().doesNotificationSendCopyToChat(notificationType));
|
||||||
|
|
||||||
//Call event
|
//Call event
|
||||||
Bukkit.getServer().getPluginManager().callEvent(customEvent);
|
Bukkit.getServer().getPluginManager().callEvent(customEvent);
|
||||||
@ -149,15 +156,23 @@ public class NotificationManager {
|
|||||||
* @param skillName skill that leveled up
|
* @param skillName skill that leveled up
|
||||||
* @param newLevel new level of that skill
|
* @param newLevel new level of that skill
|
||||||
*/
|
*/
|
||||||
public static void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkillType skillName, int levelsGained, int newLevel)
|
public static void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkillType skillName,
|
||||||
|
int levelsGained, int newLevel)
|
||||||
{
|
{
|
||||||
if(!mcMMOPlayer.useChatNotifications())
|
if(!mcMMOPlayer.useChatNotifications())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
McMMOMessageType destination = mcMMO.p.getAdvancedConfig().doesNotificationUseActionBar(NotificationType.LEVEL_UP_MESSAGE) ? McMMOMessageType.ACTION_BAR : McMMOMessageType.SYSTEM;
|
McMMOMessageType destination
|
||||||
|
= mcMMO.p.getAdvancedConfig().doesNotificationUseActionBar(NotificationType.LEVEL_UP_MESSAGE)
|
||||||
|
? McMMOMessageType.ACTION_BAR : McMMOMessageType.SYSTEM;
|
||||||
|
|
||||||
Component levelUpTextComponent = TextComponentFactory.getNotificationLevelUpTextComponent(skillName, levelsGained, newLevel);
|
Component levelUpTextComponent = TextComponentFactory.getNotificationLevelUpTextComponent(
|
||||||
McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(mcMMOPlayer.getPlayer(), NotificationType.LEVEL_UP_MESSAGE, destination, levelUpTextComponent);
|
skillName, levelsGained, newLevel);
|
||||||
|
McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(
|
||||||
|
mcMMOPlayer.getPlayer(),
|
||||||
|
NotificationType.LEVEL_UP_MESSAGE,
|
||||||
|
destination,
|
||||||
|
levelUpTextComponent);
|
||||||
|
|
||||||
sendNotification(mcMMOPlayer.getPlayer(), customEvent);
|
sendNotification(mcMMOPlayer.getPlayer(), customEvent);
|
||||||
}
|
}
|
||||||
@ -176,17 +191,12 @@ public class NotificationManager {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//CHAT MESSAGE
|
//CHAT MESSAGE
|
||||||
mcMMO.getAudiences().player(mcMMOPlayer.getPlayer()).sendMessage(Identity.nil(), TextComponentFactory.getSubSkillUnlockedNotificationComponents(mcMMOPlayer.getPlayer(), subSkillType));
|
mcMMO.getAudiences().player(mcMMOPlayer.getPlayer()).sendMessage(Identity.nil(),
|
||||||
|
TextComponentFactory.getSubSkillUnlockedNotificationComponents(mcMMOPlayer.getPlayer(), subSkillType));
|
||||||
|
|
||||||
//Unlock Sound Effect
|
//Unlock Sound Effect
|
||||||
SoundManager.sendCategorizedSound(mcMMOPlayer.getPlayer(), mcMMOPlayer.getPlayer().getLocation(), SoundType.SKILL_UNLOCKED, SoundCategory.MASTER);
|
SoundManager.sendCategorizedSound(mcMMOPlayer.getPlayer(), mcMMOPlayer.getPlayer().getLocation(),
|
||||||
|
SoundType.SKILL_UNLOCKED, SoundCategory.MASTER);
|
||||||
//ACTION BAR MESSAGE
|
|
||||||
/*if(mcMMO.p.getAdvancedConfig().doesNotificationUseActionBar(NotificationType.SUBSKILL_UNLOCKED))
|
|
||||||
mcMMOPlayer.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(LocaleLoader.getString("JSON.SkillUnlockMessage",
|
|
||||||
subSkillType.getLocaleName(),
|
|
||||||
String.valueOf(RankUtils.getRank(mcMMOPlayer.getPlayer(),
|
|
||||||
subSkillType)))));*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,7 +235,8 @@ public class NotificationManager {
|
|||||||
* @param commandSender the command user
|
* @param commandSender the command user
|
||||||
* @param sensitiveCommandType type of command issued
|
* @param sensitiveCommandType type of command issued
|
||||||
*/
|
*/
|
||||||
public static void processSensitiveCommandNotification(CommandSender commandSender, SensitiveCommandType sensitiveCommandType, String... args) {
|
public static void processSensitiveCommandNotification(CommandSender commandSender,
|
||||||
|
SensitiveCommandType sensitiveCommandType, String... args) {
|
||||||
/*
|
/*
|
||||||
* Determine the 'identity' of the one who executed the command to pass as a parameters
|
* Determine the 'identity' of the one who executed the command to pass as a parameters
|
||||||
*/
|
*/
|
||||||
@ -233,19 +244,26 @@ public class NotificationManager {
|
|||||||
|
|
||||||
if(commandSender instanceof Player)
|
if(commandSender instanceof Player)
|
||||||
{
|
{
|
||||||
senderName = ((Player) commandSender).getDisplayName() + ChatColor.RESET + "-" + ((Player) commandSender).getUniqueId();
|
senderName = ((Player) commandSender).getDisplayName()
|
||||||
|
+ ChatColor.RESET + "-" + ((Player) commandSender).getUniqueId();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Send the notification
|
//Send the notification
|
||||||
switch(sensitiveCommandType)
|
switch(sensitiveCommandType)
|
||||||
{
|
{
|
||||||
case XPRATE_MODIFY:
|
case XPRATE_MODIFY:
|
||||||
sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.Start.Others", addItemToFirstPositionOfArray(senderName, args)));
|
sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.Start.Others",
|
||||||
sendAdminCommandConfirmation(commandSender, LocaleLoader.getString("Notifications.Admin.XPRate.Start.Self", args));
|
addItemToFirstPositionOfArray(senderName, args)));
|
||||||
|
sendAdminCommandConfirmation(
|
||||||
|
commandSender, LocaleLoader.getString("Notifications.Admin.XPRate.Start.Self", args));
|
||||||
break;
|
break;
|
||||||
case XPRATE_END:
|
case XPRATE_END:
|
||||||
sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.End.Others", addItemToFirstPositionOfArray(senderName, args)));
|
sendAdminNotification(
|
||||||
sendAdminCommandConfirmation(commandSender, LocaleLoader.getString("Notifications.Admin.XPRate.End.Self", args));
|
LocaleLoader.getString(
|
||||||
|
"Notifications.Admin.XPRate.End.Others",
|
||||||
|
addItemToFirstPositionOfArray(senderName, args)));
|
||||||
|
sendAdminCommandConfirmation(commandSender,
|
||||||
|
LocaleLoader.getString("Notifications.Admin.XPRate.End.Self", args));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,8 +284,6 @@ public class NotificationManager {
|
|||||||
return newArray;
|
return newArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Remove the code duplication, am lazy atm
|
|
||||||
//TODO: Fix broadcasts being skipped for situations where a player skips over the milestone like with the addlevels command
|
|
||||||
public static void processLevelUpBroadcasting(@NotNull McMMOPlayer mmoPlayer, @NotNull PrimarySkillType primarySkillType, int level) {
|
public static void processLevelUpBroadcasting(@NotNull McMMOPlayer mmoPlayer, @NotNull PrimarySkillType primarySkillType, int level) {
|
||||||
if(level <= 0)
|
if(level <= 0)
|
||||||
return;
|
return;
|
||||||
@ -290,13 +306,22 @@ public class NotificationManager {
|
|||||||
.append(Component.newline())
|
.append(Component.newline())
|
||||||
.append(Component.text(LocalDate.now().toString()))
|
.append(Component.text(LocalDate.now().toString()))
|
||||||
.append(Component.newline())
|
.append(Component.newline())
|
||||||
.append(Component.text(mcMMO.p.getSkillTools().getLocalizedSkillName(primarySkillType)+" reached level "+level)).color(TextColor.fromHexString(HEX_BEIGE_COLOR))
|
.append(Component.text(
|
||||||
|
mcMMO.p.getSkillTools().getLocalizedSkillName(primarySkillType)
|
||||||
|
+ " reached level "+level)).color(TextColor.fromHexString(HEX_BEIGE_COLOR))
|
||||||
.asHoverEvent();
|
.asHoverEvent();
|
||||||
|
|
||||||
String localeMessage = LocaleLoader.getString("Broadcasts.LevelUpMilestone", mmoPlayer.getPlayer().getDisplayName(), level, mcMMO.p.getSkillTools().getLocalizedSkillName(primarySkillType));
|
String localeMessage = LocaleLoader.getString(
|
||||||
Component message = LegacyComponentSerializer.legacySection().deserialize(localeMessage).hoverEvent(levelMilestoneHover);
|
"Broadcasts.LevelUpMilestone", mmoPlayer.getPlayer().getDisplayName(), level,
|
||||||
|
mcMMO.p.getSkillTools().getLocalizedSkillName(primarySkillType));
|
||||||
|
Component component = LegacyComponentSerializer
|
||||||
|
.legacySection()
|
||||||
|
.deserialize(localeMessage)
|
||||||
|
.hoverEvent(levelMilestoneHover);
|
||||||
|
|
||||||
mcMMO.p.getFoliaLib().getImpl().runNextTick(t -> audience.sendMessage(Identity.nil(), message));
|
// TODO: Update system msg API
|
||||||
|
mcMMO.p.getFoliaLib().getImpl().runNextTick(
|
||||||
|
t -> audience.sendMessage(component));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -331,7 +356,7 @@ public class NotificationManager {
|
|||||||
String localeMessage = LocaleLoader.getString("Broadcasts.PowerLevelUpMilestone", mmoPlayer.getPlayer().getDisplayName(), powerLevel);
|
String localeMessage = LocaleLoader.getString("Broadcasts.PowerLevelUpMilestone", mmoPlayer.getPlayer().getDisplayName(), powerLevel);
|
||||||
Component message = LegacyComponentSerializer.legacySection().deserialize(localeMessage).hoverEvent(levelMilestoneHover);
|
Component message = LegacyComponentSerializer.legacySection().deserialize(localeMessage).hoverEvent(levelMilestoneHover);
|
||||||
|
|
||||||
mcMMO.p.getFoliaLib().getImpl().runNextTick(t -> audience.sendMessage(Identity.nil(), message));
|
mcMMO.p.getFoliaLib().getImpl().runNextTick(t -> audience.sendMessage(message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -291,30 +291,12 @@ public class RankUtils {
|
|||||||
subSkillRanks.computeIfAbsent(s, k -> new HashMap<>());
|
subSkillRanks.computeIfAbsent(s, k -> new HashMap<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* public static int getSubSkillUnlockRequirement(SubSkillType subSkillType)
|
|
||||||
{
|
|
||||||
String skillName = subSkillType.toString();
|
|
||||||
int numRanks = subSkillType.getNumRanks();
|
|
||||||
|
|
||||||
if(subSkillRanks == null)
|
|
||||||
subSkillRanks = new HashMap<>();
|
|
||||||
|
|
||||||
if(numRanks == 0)
|
|
||||||
return -1; //-1 Means the skill doesn't have ranks
|
|
||||||
|
|
||||||
if(subSkillRanks.get(skillName) == null && numRanks > 0)
|
|
||||||
addRanks(subSkillType);
|
|
||||||
|
|
||||||
return subSkillRanks.get(subSkillType.toString()).get(1);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the unlock level for a specific rank in a subskill
|
* Gets the unlock level for a specific rank in a subskill
|
||||||
* @param subSkillType The target subskill
|
* @param subSkillType The target subskill
|
||||||
* @param rank The target rank
|
* @param rank The target rank
|
||||||
* @return The level at which this rank unlocks
|
* @return The level at which this rank unlocks
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public static int getRankUnlockLevel(SubSkillType subSkillType, int rank)
|
public static int getRankUnlockLevel(SubSkillType subSkillType, int rank)
|
||||||
{
|
{
|
||||||
return RankConfig.getInstance().getSubSkillUnlockLevel(subSkillType, rank);
|
return RankConfig.getInstance().getSubSkillUnlockLevel(subSkillType, rank);
|
||||||
|
@ -12,8 +12,6 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import net.kyori.adventure.audience.Audience;
|
import net.kyori.adventure.audience.Audience;
|
||||||
import net.kyori.adventure.audience.MessageType;
|
|
||||||
import net.kyori.adventure.identity.Identity;
|
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
import net.kyori.adventure.text.TextComponent;
|
||||||
import net.kyori.adventure.text.event.ClickEvent;
|
import net.kyori.adventure.text.event.ClickEvent;
|
||||||
@ -35,41 +33,37 @@ public class TextComponentFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a text component using strings from a locale and supports passing an undefined number of variables to the LocaleLoader
|
* Makes a text component using strings from a locale and supports passing an undefined number of variables to the LocaleLoader
|
||||||
|
*
|
||||||
* @param localeKey target locale string address
|
* @param localeKey target locale string address
|
||||||
* @param values vars to be passed to the locale loader
|
* @param values vars to be passed to the locale loader
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static TextComponent getNotificationMultipleValues(String localeKey, String... values)
|
public static TextComponent getNotificationMultipleValues(String localeKey, String... values) {
|
||||||
{
|
|
||||||
String preColoredString = LocaleLoader.getString(localeKey, (Object[]) values);
|
String preColoredString = LocaleLoader.getString(localeKey, (Object[]) values);
|
||||||
return Component.text(preColoredString);
|
return Component.text(preColoredString);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Component getNotificationTextComponentFromLocale(String localeKey)
|
public static Component getNotificationTextComponentFromLocale(String localeKey) {
|
||||||
{
|
|
||||||
return getNotificationTextComponent(LocaleLoader.getString(localeKey));
|
return getNotificationTextComponent(LocaleLoader.getString(localeKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Component getNotificationLevelUpTextComponent(PrimarySkillType skill, int levelsGained, int currentLevel)
|
public static Component getNotificationLevelUpTextComponent(PrimarySkillType skill, int levelsGained, int currentLevel) {
|
||||||
{
|
return Component.text(LocaleLoader.getString("Overhaul.Levelup", LocaleLoader.getString("Overhaul.Name." + StringUtils.getCapitalized(skill.toString())), levelsGained, currentLevel));
|
||||||
return Component.text(LocaleLoader.getString("Overhaul.Levelup", LocaleLoader.getString("Overhaul.Name."+ StringUtils.getCapitalized(skill.toString())), levelsGained, currentLevel));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TextComponent getNotificationTextComponent(String text)
|
private static TextComponent getNotificationTextComponent(String text) {
|
||||||
{
|
|
||||||
//textComponent.setColor(getNotificationColor(notificationType));
|
//textComponent.setColor(getNotificationColor(notificationType));
|
||||||
return Component.text(text);
|
return Component.text(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendPlayerSubSkillWikiLink(Player player, String subskillformatted)
|
public static void sendPlayerSubSkillWikiLink(Player player, String subskillformatted) {
|
||||||
{
|
if (!mcMMO.p.getGeneralConfig().getUrlLinksEnabled())
|
||||||
if(!mcMMO.p.getGeneralConfig().getUrlLinksEnabled())
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TextComponent.Builder wikiLinkComponent = Component.text().content(LocaleLoader.getString("Overhaul.mcMMO.MmoInfo.Wiki"));
|
TextComponent.Builder wikiLinkComponent = Component.text().content(LocaleLoader.getString("Overhaul.mcMMO.MmoInfo.Wiki"));
|
||||||
wikiLinkComponent.decoration(TextDecoration.UNDERLINED, true);
|
wikiLinkComponent.decoration(TextDecoration.UNDERLINED, true);
|
||||||
|
|
||||||
String wikiUrl = "https://wiki.mcmmo.org/"+subskillformatted;
|
String wikiUrl = "https://wiki.mcmmo.org/" + subskillformatted;
|
||||||
|
|
||||||
wikiLinkComponent.clickEvent(ClickEvent.openUrl(wikiUrl));
|
wikiLinkComponent.clickEvent(ClickEvent.openUrl(wikiUrl));
|
||||||
|
|
||||||
@ -77,18 +71,19 @@ public class TextComponentFactory {
|
|||||||
|
|
||||||
wikiLinkComponent.hoverEvent(HoverEvent.showText(componentBuilder.build()));
|
wikiLinkComponent.hoverEvent(HoverEvent.showText(componentBuilder.build()));
|
||||||
|
|
||||||
mcMMO.getAudiences().player(player).sendMessage(Identity.nil(), wikiLinkComponent, MessageType.SYSTEM);
|
mcMMO.getAudiences().player(player).sendMessage(wikiLinkComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendPlayerUrlHeader(Player player) {
|
public static void sendPlayerUrlHeader(Player player) {
|
||||||
TextComponent prefix = Component.text(LocaleLoader.getString("Overhaul.mcMMO.Url.Wrap.Prefix") + " ");
|
TextComponent prefix = Component.text(LocaleLoader.getString("Overhaul.mcMMO.Url.Wrap.Prefix") + " ");
|
||||||
/*prefix.setColor(ChatColor.DARK_AQUA);*/
|
/*prefix.setColor(ChatColor.DARK_AQUA);*/
|
||||||
TextComponent suffix = Component.text(" "+LocaleLoader.getString("Overhaul.mcMMO.Url.Wrap.Suffix"));
|
TextComponent suffix = Component.text(" " + LocaleLoader.getString("Overhaul.mcMMO.Url.Wrap.Suffix"));
|
||||||
/*suffix.setColor(ChatColor.DARK_AQUA);*/
|
/*suffix.setColor(ChatColor.DARK_AQUA);*/
|
||||||
|
|
||||||
TextComponent emptySpace = Component.space();
|
TextComponent emptySpace = Component.space();
|
||||||
|
|
||||||
mcMMO.getAudiences().player(player).sendMessage(Identity.nil(),TextComponent.ofChildren(
|
// TODO: Update system msg API
|
||||||
|
mcMMO.getAudiences().player(player).sendMessage(Component.textOfChildren(
|
||||||
prefix,
|
prefix,
|
||||||
getWebLinkTextComponent(McMMOWebLinks.WEBSITE),
|
getWebLinkTextComponent(McMMOWebLinks.WEBSITE),
|
||||||
emptySpace,
|
emptySpace,
|
||||||
@ -102,7 +97,7 @@ public class TextComponentFactory {
|
|||||||
emptySpace,
|
emptySpace,
|
||||||
getWebLinkTextComponent(McMMOWebLinks.HELP_TRANSLATE),
|
getWebLinkTextComponent(McMMOWebLinks.HELP_TRANSLATE),
|
||||||
suffix
|
suffix
|
||||||
), MessageType.SYSTEM);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -129,17 +124,15 @@ public class TextComponentFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Send each group
|
//Send each group
|
||||||
for(Component curLine : individualLinesToSend) {
|
for (Component curLine : individualLinesToSend) {
|
||||||
audience.sendMessage(Identity.nil(), curLine);
|
audience.sendMessage(curLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Component getWebLinkTextComponent(McMMOWebLinks webLinks)
|
private static Component getWebLinkTextComponent(McMMOWebLinks webLinks) {
|
||||||
{
|
|
||||||
TextComponent.Builder webTextComponent;
|
TextComponent.Builder webTextComponent;
|
||||||
|
|
||||||
switch(webLinks)
|
switch (webLinks) {
|
||||||
{
|
|
||||||
case WEBSITE:
|
case WEBSITE:
|
||||||
webTextComponent = Component.text().content(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
|
webTextComponent = Component.text().content(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
|
||||||
TextUtils.addChildWebComponent(webTextComponent, "Web");
|
TextUtils.addChildWebComponent(webTextComponent, "Web");
|
||||||
@ -180,12 +173,10 @@ public class TextComponentFactory {
|
|||||||
return webTextComponent.build();
|
return webTextComponent.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Component getUrlHoverEvent(McMMOWebLinks webLinks)
|
private static Component getUrlHoverEvent(McMMOWebLinks webLinks) {
|
||||||
{
|
|
||||||
TextComponent.Builder componentBuilder = Component.text().content(webLinks.getNiceTitle());
|
TextComponent.Builder componentBuilder = Component.text().content(webLinks.getNiceTitle());
|
||||||
|
|
||||||
switch(webLinks)
|
switch (webLinks) {
|
||||||
{
|
|
||||||
case WEBSITE:
|
case WEBSITE:
|
||||||
addUrlHeaderHover(webLinks, componentBuilder);
|
addUrlHeaderHover(webLinks, componentBuilder);
|
||||||
componentBuilder.append(Component.newline()).append(Component.newline());
|
componentBuilder.append(Component.newline()).append(Component.newline());
|
||||||
@ -234,13 +225,11 @@ public class TextComponentFactory {
|
|||||||
componentBuilder.append(Component.text(webLinks.getUrl(), NamedTextColor.GRAY, TextDecoration.ITALIC));
|
componentBuilder.append(Component.text(webLinks.getUrl(), NamedTextColor.GRAY, TextDecoration.ITALIC));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ClickEvent getUrlClickEvent(String url)
|
private static ClickEvent getUrlClickEvent(String url) {
|
||||||
{
|
|
||||||
return ClickEvent.openUrl(url);
|
return ClickEvent.openUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Component getSubSkillTextComponent(Player player, SubSkillType subSkillType)
|
private static Component getSubSkillTextComponent(Player player, SubSkillType subSkillType) {
|
||||||
{
|
|
||||||
//Get skill name
|
//Get skill name
|
||||||
String skillName = subSkillType.getLocaleName();
|
String skillName = subSkillType.getLocaleName();
|
||||||
|
|
||||||
@ -257,8 +246,7 @@ public class TextComponentFactory {
|
|||||||
return textComponent.build();
|
return textComponent.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TextComponent getSubSkillTextComponent(Player player, AbstractSubSkill abstractSubSkill)
|
private static TextComponent getSubSkillTextComponent(Player player, AbstractSubSkill abstractSubSkill) {
|
||||||
{
|
|
||||||
//String key = abstractSubSkill.getConfigKeyName();
|
//String key = abstractSubSkill.getConfigKeyName();
|
||||||
String skillName = abstractSubSkill.getNiceName();
|
String skillName = abstractSubSkill.getNiceName();
|
||||||
|
|
||||||
@ -297,35 +285,27 @@ public class TextComponentFactory {
|
|||||||
return textComponent;
|
return textComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Component getSubSkillHoverComponent(Player player, AbstractSubSkill abstractSubSkill)
|
private static Component getSubSkillHoverComponent(Player player, AbstractSubSkill abstractSubSkill) {
|
||||||
{
|
|
||||||
return getSubSkillHoverEventJSON(abstractSubSkill, player);
|
return getSubSkillHoverEventJSON(abstractSubSkill, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Component getSubSkillHoverComponent(Player player, SubSkillType subSkillType)
|
private static Component getSubSkillHoverComponent(Player player, SubSkillType subSkillType) {
|
||||||
{
|
|
||||||
return getSubSkillHoverEventJSON(subSkillType, player);
|
return getSubSkillHoverEventJSON(subSkillType, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for the skill in the new skill system (Deriving from AbstractSubSkill)
|
* Used for the skill in the new skill system (Deriving from AbstractSubSkill)
|
||||||
|
*
|
||||||
* @param abstractSubSkill this subskill
|
* @param abstractSubSkill this subskill
|
||||||
* @param player the player who owns this subskill
|
* @param player the player who owns this subskill
|
||||||
* @return the hover basecomponent object for this subskill
|
* @return the hover basecomponent object for this subskill
|
||||||
*/
|
*/
|
||||||
private static Component getSubSkillHoverEventJSON(AbstractSubSkill abstractSubSkill, Player player)
|
private static Component getSubSkillHoverEventJSON(AbstractSubSkill abstractSubSkill, Player player) {
|
||||||
{
|
|
||||||
String skillName = abstractSubSkill.getNiceName();
|
String skillName = abstractSubSkill.getNiceName();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hover Event BaseComponent color table
|
* Hover Event BaseComponent color table
|
||||||
*/
|
*/
|
||||||
TextColor ccSubSkillHeader = NamedTextColor.GOLD;
|
|
||||||
TextColor ccRank = NamedTextColor.BLUE;
|
|
||||||
TextColor ccCurRank = NamedTextColor.GREEN;
|
|
||||||
TextColor ccPossessive = NamedTextColor.WHITE;
|
|
||||||
//ChatColor ccDescriptionHeader = ChatColor.DARK_PURPLE;
|
|
||||||
//ChatColor ccDescription = ChatColor.WHITE;
|
|
||||||
TextColor ccLocked = NamedTextColor.DARK_GRAY;
|
TextColor ccLocked = NamedTextColor.DARK_GRAY;
|
||||||
TextColor ccLevelRequirement = NamedTextColor.BLUE;
|
TextColor ccLevelRequirement = NamedTextColor.BLUE;
|
||||||
TextColor ccLevelRequired = NamedTextColor.RED;
|
TextColor ccLevelRequired = NamedTextColor.RED;
|
||||||
@ -335,8 +315,7 @@ public class TextComponentFactory {
|
|||||||
//SubSkillType Name
|
//SubSkillType Name
|
||||||
TextComponent.Builder componentBuilder = setupSkillComponentNameStyle(player, skillName, subSkillType, RankUtils.hasUnlockedSubskill(player, abstractSubSkill));
|
TextComponent.Builder componentBuilder = setupSkillComponentNameStyle(player, skillName, subSkillType, RankUtils.hasUnlockedSubskill(player, abstractSubSkill));
|
||||||
|
|
||||||
if(!RankUtils.hasUnlockedSubskill(player, abstractSubSkill))
|
if (!RankUtils.hasUnlockedSubskill(player, abstractSubSkill)) {
|
||||||
{
|
|
||||||
//Skill is not unlocked yet
|
//Skill is not unlocked yet
|
||||||
addLocked(abstractSubSkill, ccLocked, ccLevelRequirement, ccLevelRequired, componentBuilder);
|
addLocked(abstractSubSkill, ccLocked, ccLevelRequirement, ccLevelRequired, componentBuilder);
|
||||||
} else {
|
} else {
|
||||||
@ -346,12 +325,11 @@ public class TextComponentFactory {
|
|||||||
int curRank = RankUtils.getRank(player, abstractSubSkill);
|
int curRank = RankUtils.getRank(player, abstractSubSkill);
|
||||||
int nextRank = 0;
|
int nextRank = 0;
|
||||||
|
|
||||||
if(curRank < abstractSubSkill.getNumRanks() && abstractSubSkill.getNumRanks() > 0)
|
if (curRank < abstractSubSkill.getNumRanks() && abstractSubSkill.getNumRanks() > 0) {
|
||||||
{
|
nextRank = RankUtils.getRankUnlockLevel(abstractSubSkill, curRank + 1);
|
||||||
nextRank = RankUtils.getRankUnlockLevel(abstractSubSkill, curRank+1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addRanked(ccRank, ccCurRank, ccPossessive, ccCurRank, componentBuilder, abstractSubSkill.getNumRanks(), RankUtils.getRank(player, abstractSubSkill), nextRank);
|
addRanked(componentBuilder, abstractSubSkill.getNumRanks(), RankUtils.getRank(player, abstractSubSkill), nextRank);
|
||||||
|
|
||||||
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.DescriptionHeader")));
|
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.DescriptionHeader")));
|
||||||
componentBuilder.append(Component.newline()).append(Component.text(abstractSubSkill.getDescription())).append(Component.newline());
|
componentBuilder.append(Component.newline()).append(Component.text(abstractSubSkill.getDescription())).append(Component.newline());
|
||||||
@ -386,17 +364,14 @@ public class TextComponentFactory {
|
|||||||
return componentBuilder;
|
return componentBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addRanked(TextColor ccRank, TextColor ccCurRank, TextColor ccPossessive, TextColor ccNumRanks, TextComponent.Builder componentBuilder, int numRanks, int rank, int nextRank) {
|
private static void addRanked(TextComponent.Builder componentBuilder, int numRanks, int rank, int nextRank) {
|
||||||
if (numRanks > 0) {
|
if (numRanks > 0) {
|
||||||
//Rank: x
|
//Rank: x
|
||||||
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.Hover.Rank", String.valueOf(rank)))).append(Component.newline());
|
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.Hover.Rank", String.valueOf(rank)))).append(Component.newline());
|
||||||
|
|
||||||
//Next Rank: x
|
//Next Rank: x
|
||||||
if(nextRank > rank)
|
if (nextRank > rank)
|
||||||
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.Hover.NextRank", String.valueOf(nextRank)))).append(Component.newline());
|
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.Hover.NextRank", String.valueOf(nextRank)))).append(Component.newline());
|
||||||
|
|
||||||
/*componentBuilder.append(" " + LocaleLoader.getString("JSON.RankPossesive") + " ").color(ccPossessive);
|
|
||||||
componentBuilder.append(String.valueOf(numRanks)).color(ccNumRanks);*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -418,18 +393,12 @@ public class TextComponentFactory {
|
|||||||
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.LevelRequirement") + ": ", ccLevelRequirement));
|
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.LevelRequirement") + ": ", ccLevelRequirement));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
private static Component getSubSkillHoverEventJSON(SubSkillType subSkillType, Player player) {
|
||||||
private static Component getSubSkillHoverEventJSON(SubSkillType subSkillType, Player player)
|
|
||||||
{
|
|
||||||
String skillName = subSkillType.getLocaleName();
|
String skillName = subSkillType.getLocaleName();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hover Event BaseComponent color table
|
* Hover Event BaseComponent color table
|
||||||
*/
|
*/
|
||||||
TextColor ccSubSkillHeader = NamedTextColor.GOLD;
|
|
||||||
TextColor ccRank = NamedTextColor.BLUE;
|
|
||||||
TextColor ccCurRank = NamedTextColor.GREEN;
|
|
||||||
TextColor ccPossessive = NamedTextColor.WHITE;
|
|
||||||
TextColor ccDescriptionHeader = NamedTextColor.DARK_PURPLE;
|
TextColor ccDescriptionHeader = NamedTextColor.DARK_PURPLE;
|
||||||
TextColor ccDescription = NamedTextColor.DARK_GRAY;
|
TextColor ccDescription = NamedTextColor.DARK_GRAY;
|
||||||
TextColor ccLocked = NamedTextColor.DARK_GRAY;
|
TextColor ccLocked = NamedTextColor.DARK_GRAY;
|
||||||
@ -439,26 +408,23 @@ public class TextComponentFactory {
|
|||||||
//SubSkillType Name
|
//SubSkillType Name
|
||||||
TextComponent.Builder componentBuilder = setupSkillComponentNameStyle(player, skillName, subSkillType, RankUtils.hasUnlockedSubskill(player, subSkillType));
|
TextComponent.Builder componentBuilder = setupSkillComponentNameStyle(player, skillName, subSkillType, RankUtils.hasUnlockedSubskill(player, subSkillType));
|
||||||
|
|
||||||
if(!RankUtils.hasUnlockedSubskill(player, subSkillType))
|
if (!RankUtils.hasUnlockedSubskill(player, subSkillType)) {
|
||||||
{
|
|
||||||
//Skill is not unlocked yet
|
//Skill is not unlocked yet
|
||||||
addLocked(subSkillType, ccLocked, ccLevelRequirement, ccLevelRequired, componentBuilder);
|
addLocked(subSkillType, ccLocked, ccLevelRequirement, ccLevelRequired, componentBuilder);
|
||||||
} else {
|
} else {
|
||||||
//addSubSkillTypeToHoverEventJSON(subSkillType, componentBuilder);
|
//addSubSkillTypeToHoverEventJSON(subSkillType, componentBuilder);
|
||||||
|
|
||||||
//RANK
|
//RANK
|
||||||
if(subSkillType.getNumRanks() > 0)
|
if (subSkillType.getNumRanks() > 0) {
|
||||||
{
|
|
||||||
int curRank = RankUtils.getRank(player, subSkillType);
|
int curRank = RankUtils.getRank(player, subSkillType);
|
||||||
int nextRank = 0;
|
int nextRank = 0;
|
||||||
|
|
||||||
if(curRank < subSkillType.getNumRanks())
|
if (curRank < subSkillType.getNumRanks()) {
|
||||||
{
|
nextRank = RankUtils.getRankUnlockLevel(subSkillType, curRank + 1);
|
||||||
nextRank = RankUtils.getRankUnlockLevel(subSkillType, curRank+1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addRanked(ccRank, ccCurRank, ccPossessive, ccCurRank, componentBuilder, subSkillType.getNumRanks(), RankUtils.getRank(player, subSkillType), nextRank);
|
addRanked(componentBuilder, subSkillType.getNumRanks(),
|
||||||
|
RankUtils.getRank(player, subSkillType), nextRank);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentBuilder.append(Component.newline());
|
componentBuilder.append(Component.newline());
|
||||||
@ -472,55 +438,52 @@ public class TextComponentFactory {
|
|||||||
return componentBuilder.build();
|
return componentBuilder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addSubSkillTypeToHoverEventJSON(AbstractSubSkill abstractSubSkill, TextComponent.Builder componentBuilder)
|
private static void addSubSkillTypeToHoverEventJSON(AbstractSubSkill abstractSubSkill,
|
||||||
{
|
TextComponent.Builder componentBuilder) {
|
||||||
if(abstractSubSkill.isSuperAbility())
|
if (abstractSubSkill.isSuperAbility()) {
|
||||||
{
|
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.Type.SuperAbility"),
|
||||||
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.Type.SuperAbility"), NamedTextColor.LIGHT_PURPLE, TextDecoration.BOLD));
|
NamedTextColor.LIGHT_PURPLE, TextDecoration.BOLD));
|
||||||
} else if(abstractSubSkill.isActiveUse())
|
} else if (abstractSubSkill.isActiveUse()) {
|
||||||
{
|
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.Type.Active"),
|
||||||
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.Type.Active"), NamedTextColor.DARK_RED, TextDecoration.BOLD));
|
NamedTextColor.DARK_RED, TextDecoration.BOLD));
|
||||||
} else {
|
} else {
|
||||||
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.Type.Passive"), NamedTextColor.GREEN, TextDecoration.BOLD));
|
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.Type.Passive"),
|
||||||
|
NamedTextColor.GREEN, TextDecoration.BOLD));
|
||||||
}
|
}
|
||||||
|
|
||||||
componentBuilder.append(Component.newline());
|
componentBuilder.append(Component.newline());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void getSubSkillTextComponents(Player player, List<Component> textComponents, PrimarySkillType parentSkill) {
|
public static void getSubSkillTextComponents(Player player, List<Component> textComponents,
|
||||||
for(SubSkillType subSkillType : SubSkillType.values())
|
PrimarySkillType parentSkill) {
|
||||||
{
|
for (SubSkillType subSkillType : SubSkillType.values()) {
|
||||||
if(subSkillType.getParentSkill() == parentSkill)
|
if (subSkillType.getParentSkill() == parentSkill) {
|
||||||
{
|
|
||||||
//TODO: Hacky rewrite later
|
//TODO: Hacky rewrite later
|
||||||
//Only some versions of MC have this skill
|
//Only some versions of MC have this skill
|
||||||
if(subSkillType == SubSkillType.FISHING_MASTER_ANGLER && mcMMO.getCompatibilityManager().getMasterAnglerCompatibilityLayer() == null)
|
if (subSkillType == SubSkillType.FISHING_MASTER_ANGLER
|
||||||
|
&& mcMMO.getCompatibilityManager().getMasterAnglerCompatibilityLayer() == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(Permissions.isSubSkillEnabled(player, subSkillType))
|
if (Permissions.isSubSkillEnabled(player, subSkillType)) {
|
||||||
{
|
if (!InteractionManager.hasSubSkill(subSkillType))
|
||||||
if(!InteractionManager.hasSubSkill(subSkillType))
|
|
||||||
textComponents.add(TextComponentFactory.getSubSkillTextComponent(player, subSkillType));
|
textComponents.add(TextComponentFactory.getSubSkillTextComponent(player, subSkillType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NEW SKILL SYSTEM */
|
/* NEW SKILL SYSTEM */
|
||||||
for(AbstractSubSkill abstractSubSkill : InteractionManager.getSubSkillList())
|
for (AbstractSubSkill abstractSubSkill : InteractionManager.getSubSkillList()) {
|
||||||
{
|
if (abstractSubSkill.getPrimarySkill() == parentSkill) {
|
||||||
if(abstractSubSkill.getPrimarySkill() == parentSkill)
|
if (Permissions.isSubSkillEnabled(player, abstractSubSkill))
|
||||||
{
|
|
||||||
if(Permissions.isSubSkillEnabled(player, abstractSubSkill))
|
|
||||||
textComponents.add(TextComponentFactory.getSubSkillTextComponent(player, abstractSubSkill));
|
textComponents.add(TextComponentFactory.getSubSkillTextComponent(player, abstractSubSkill));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TextComponent getSubSkillUnlockedNotificationComponents(Player player, SubSkillType subSkillType)
|
public static TextComponent getSubSkillUnlockedNotificationComponents(Player player, SubSkillType subSkillType) {
|
||||||
{
|
|
||||||
TextComponent.Builder unlockMessage = Component.text().content(LocaleLoader.getString("JSON.SkillUnlockMessage", subSkillType.getLocaleName(), RankUtils.getRank(player, subSkillType)));
|
TextComponent.Builder unlockMessage = Component.text().content(LocaleLoader.getString("JSON.SkillUnlockMessage", subSkillType.getLocaleName(), RankUtils.getRank(player, subSkillType)));
|
||||||
unlockMessage.hoverEvent(HoverEvent.showText(getSubSkillHoverComponent(player, subSkillType)));
|
unlockMessage.hoverEvent(HoverEvent.showText(getSubSkillHoverComponent(player, subSkillType)));
|
||||||
unlockMessage.clickEvent(ClickEvent.runCommand("/"+subSkillType.getParentSkill().toString().toLowerCase(Locale.ENGLISH)));
|
unlockMessage.clickEvent(ClickEvent.runCommand("/" + subSkillType.getParentSkill().toString().toLowerCase(Locale.ENGLISH)));
|
||||||
return unlockMessage.build();
|
return unlockMessage.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user