mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-29 22:13:22 +01:00
Fix issue when Color codes did not work in opened Panels and Titles (#110)
These text element colors were not translated correctly. Now it should work.
This commit is contained in:
parent
c702dd492b
commit
d60f20e394
@ -1,6 +1,7 @@
|
|||||||
package world.bentobox.challenges.panel.admin;
|
package world.bentobox.challenges.panel.admin;
|
||||||
|
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
@ -275,7 +276,7 @@ public class EditLevelGUI extends CommonGUI
|
|||||||
private PanelItem createChallengeIcon(Challenge challenge)
|
private PanelItem createChallengeIcon(Challenge challenge)
|
||||||
{
|
{
|
||||||
return new PanelItemBuilder().
|
return new PanelItemBuilder().
|
||||||
name(challenge.getFriendlyName()).
|
name(ChatColor.translateAlternateColorCodes('&', challenge.getFriendlyName())).
|
||||||
description(GuiUtils.stringSplit(
|
description(GuiUtils.stringSplit(
|
||||||
challenge.getDescription(),
|
challenge.getDescription(),
|
||||||
this.addon.getChallengesSettings().getLoreLineLength())).
|
this.addon.getChallengesSettings().getLoreLineLength())).
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package world.bentobox.challenges.panel.admin;
|
package world.bentobox.challenges.panel.admin;
|
||||||
|
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -133,7 +134,7 @@ public class ListChallengesGUI extends CommonGUI
|
|||||||
private PanelItem createChallengeIcon(Challenge challenge)
|
private PanelItem createChallengeIcon(Challenge challenge)
|
||||||
{
|
{
|
||||||
PanelItemBuilder itemBuilder = new PanelItemBuilder().
|
PanelItemBuilder itemBuilder = new PanelItemBuilder().
|
||||||
name(challenge.getFriendlyName()).
|
name(ChatColor.translateAlternateColorCodes('&', challenge.getFriendlyName())).
|
||||||
description(GuiUtils.stringSplit(this.generateChallengeDescription(challenge, this.user.getPlayer()),
|
description(GuiUtils.stringSplit(this.generateChallengeDescription(challenge, this.user.getPlayer()),
|
||||||
this.addon.getChallengesSettings().getLoreLineLength())).
|
this.addon.getChallengesSettings().getLoreLineLength())).
|
||||||
icon(challenge.getIcon()).
|
icon(challenge.getIcon()).
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package world.bentobox.challenges.panel.admin;
|
package world.bentobox.challenges.panel.admin;
|
||||||
|
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -133,7 +134,7 @@ public class ListLevelsGUI extends CommonGUI
|
|||||||
private PanelItem createLevelIcon(ChallengeLevel challengeLevel)
|
private PanelItem createLevelIcon(ChallengeLevel challengeLevel)
|
||||||
{
|
{
|
||||||
PanelItemBuilder itemBuilder = new PanelItemBuilder().
|
PanelItemBuilder itemBuilder = new PanelItemBuilder().
|
||||||
name(challengeLevel.getFriendlyName()).
|
name(ChatColor.translateAlternateColorCodes('&', challengeLevel.getFriendlyName())).
|
||||||
description(GuiUtils.stringSplit(
|
description(GuiUtils.stringSplit(
|
||||||
this.generateLevelDescription(challengeLevel, this.user.getPlayer()),
|
this.generateLevelDescription(challengeLevel, this.user.getPlayer()),
|
||||||
this.addon.getChallengesSettings().getLoreLineLength())).
|
this.addon.getChallengesSettings().getLoreLineLength())).
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package world.bentobox.challenges.panel.user;
|
package world.bentobox.challenges.panel.user;
|
||||||
|
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -349,7 +350,9 @@ public class ChallengesGUI extends CommonGUI
|
|||||||
{
|
{
|
||||||
return new PanelItemBuilder().
|
return new PanelItemBuilder().
|
||||||
icon(challenge.getIcon()).
|
icon(challenge.getIcon()).
|
||||||
name(challenge.getFriendlyName().isEmpty() ? challenge.getUniqueId() : challenge.getFriendlyName()).
|
name(challenge.getFriendlyName().isEmpty() ?
|
||||||
|
challenge.getUniqueId() :
|
||||||
|
ChatColor.translateAlternateColorCodes('&', challenge.getFriendlyName())).
|
||||||
description(GuiUtils.stringSplit(this.generateChallengeDescription(challenge, this.user.getPlayer()),
|
description(GuiUtils.stringSplit(this.generateChallengeDescription(challenge, this.user.getPlayer()),
|
||||||
this.addon.getChallengesSettings().getLoreLineLength())).
|
this.addon.getChallengesSettings().getLoreLineLength())).
|
||||||
clickHandler((panel, user1, clickType, slot) -> {
|
clickHandler((panel, user1, clickType, slot) -> {
|
||||||
@ -440,7 +443,7 @@ public class ChallengesGUI extends CommonGUI
|
|||||||
|
|
||||||
return new PanelItemBuilder().
|
return new PanelItemBuilder().
|
||||||
icon(icon).
|
icon(icon).
|
||||||
name(name).
|
name(ChatColor.translateAlternateColorCodes('&', name)).
|
||||||
description(description).
|
description(description).
|
||||||
glow(glow).
|
glow(glow).
|
||||||
clickHandler(clickHandler).
|
clickHandler(clickHandler).
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package world.bentobox.challenges.panel.util;
|
package world.bentobox.challenges.panel.util;
|
||||||
|
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -144,7 +145,7 @@ public class SelectChallengeGUI
|
|||||||
|
|
||||||
|
|
||||||
return new PanelItemBuilder().
|
return new PanelItemBuilder().
|
||||||
name(challenge.getFriendlyName()).
|
name(ChatColor.translateAlternateColorCodes('&', challenge.getFriendlyName())).
|
||||||
description(GuiUtils.stringSplit(description, this.lineLength)).
|
description(GuiUtils.stringSplit(description, this.lineLength)).
|
||||||
icon(challenge.getIcon()).
|
icon(challenge.getIcon()).
|
||||||
clickHandler((panel, user1, clickType, slot) -> {
|
clickHandler((panel, user1, clickType, slot) -> {
|
||||||
|
@ -4,10 +4,7 @@
|
|||||||
package world.bentobox.challenges.tasks;
|
package world.bentobox.challenges.tasks;
|
||||||
|
|
||||||
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.*;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@ -1027,7 +1024,7 @@ public class TryToComplete
|
|||||||
outputMessage = outputMessage.replace("[rewardText]", challenge.getRewardText());
|
outputMessage = outputMessage.replace("[rewardText]", challenge.getRewardText());
|
||||||
}
|
}
|
||||||
|
|
||||||
return outputMessage;
|
return ChatColor.translateAlternateColorCodes('&', outputMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1047,7 +1044,7 @@ public class TryToComplete
|
|||||||
outputMessage = outputMessage.replace("[rewardText]", level.getRewardText());
|
outputMessage = outputMessage.replace("[rewardText]", level.getRewardText());
|
||||||
}
|
}
|
||||||
|
|
||||||
return outputMessage;
|
return ChatColor.translateAlternateColorCodes('&', outputMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user