3 Commits

Author SHA1 Message Date
ad310ddb9c Allows a sneaking player to see information about a silent stargate (0.9.1.2)
Some checks failed
EpicKnarvik97/Stargate/pipeline/head There was a failure building this commit
2021-11-10 22:54:20 +01:00
3db630f60e Updates version and changelog
Some checks failed
EpicKnarvik97/Stargate/pipeline/head There was a failure building this commit
2021-11-09 22:51:11 +01:00
7a03f49fb1 Translates the & character to make sure portal signs are colored on all servers 2021-11-09 22:47:38 +01:00
5 changed files with 37 additions and 16 deletions

View File

@ -388,6 +388,14 @@ portalInfoServer=Server: %server%
# Changes
#### \[Version 0.9.1.2] EpicKnarvik97 fork
- Allows a sneaking player to see information about a silent stargate with no sign
#### \[Version 0.9.1.1] EpicKnarvik97 fork
- Makes sure to translate the `&` character to fix a bug causing portal signs to not be colored on some servers
#### \[Version 0.9.1.0] EpicKnarvik97 fork
- Rewrites config loading as a part of the changes required to implement config commands

View File

@ -4,7 +4,7 @@
<groupId>net.knarcraft</groupId>
<artifactId>Stargate</artifactId>
<version>0.9.1.0</version>
<version>0.9.1.2</version>
<licenses>
<license>

View File

@ -317,7 +317,7 @@ public class PlayerEventListener implements Listener {
}
//Display portal information as a portal without a sign does not display any
if (portal.getOptions().hasNoSign() && !portal.getOptions().isSilent()) {
if (portal.getOptions().hasNoSign() && (!portal.getOptions().isSilent() || player.isSneaking())) {
MessageSender sender = Stargate.getMessageSender();
sender.sendSuccessMessage(player, ChatColor.GOLD + Stargate.getString("portalInfoTitle"));
sender.sendSuccessMessage(player, Stargate.replaceVars(Stargate.getString("portalInfoName"),

View File

@ -81,8 +81,7 @@ public class PortalSignDrawer {
private void drawSign(Sign sign) {
//Clear sign
clearSign(sign);
setLine(sign, 0, highlightColor + "-" + mainColor +
portal.getName() + highlightColor + "-");
setLine(sign, 0, highlightColor + "-" + mainColor + fixColor(portal.getName()) + highlightColor + "-");
if (!portal.getPortalActivator().isActive()) {
//Default sign text
@ -123,7 +122,7 @@ public class PortalSignDrawer {
return;
}
clearSign(sign);
sign.setLine(0, portal.getName());
sign.setLine(0, fixColor(portal.getName()));
sign.update();
}
@ -173,10 +172,10 @@ public class PortalSignDrawer {
boolean green = PermissionHelper.isFree(portal.getActivePlayer(), portal, destination);
ChatColor nameColor = (green ? freeColor : highlightColor);
setLine(sign, signLineIndex, nameColor + ">" + (green ? freeColor : mainColor) +
portal.getDestinationName() + nameColor + "<");
fixColor(portal.getDestinationName()) + nameColor + "<");
} else {
setLine(sign, signLineIndex, highlightColor + ">" + mainColor + portal.getDestinationName() +
highlightColor + "<");
setLine(sign, signLineIndex, highlightColor + ">" + mainColor +
fixColor(portal.getDestinationName()) + highlightColor + "<");
}
}
@ -205,9 +204,9 @@ public class PortalSignDrawer {
if (freeGatesGreen) {
Portal destination = PortalHandler.getByName(destinationName, portal.getNetwork());
boolean green = PermissionHelper.isFree(portal.getActivePlayer(), portal, destination);
setLine(sign, signLineIndex, (green ? freeColor : mainColor) + destinationName);
setLine(sign, signLineIndex, (green ? freeColor : mainColor) + fixColor(destinationName));
} else {
setLine(sign, signLineIndex, mainColor + destinationName);
setLine(sign, signLineIndex, mainColor + fixColor(destinationName));
}
}
@ -218,8 +217,10 @@ public class PortalSignDrawer {
*/
private void drawBungeeSign(Sign sign) {
setLine(sign, 1, Stargate.getString("bungeeSign"));
setLine(sign, 2, highlightColor + ">" + mainColor + portal.getDestinationName() + highlightColor + "<");
setLine(sign, 3, highlightColor + "[" + mainColor + portal.getNetwork() + highlightColor + "]");
setLine(sign, 2, highlightColor + ">" + mainColor + fixColor(portal.getDestinationName()) +
highlightColor + "<");
setLine(sign, 3, highlightColor + "[" + mainColor + fixColor(portal.getNetwork()) +
highlightColor + "]");
}
/**
@ -233,7 +234,8 @@ public class PortalSignDrawer {
setLine(sign, 1, Stargate.getString("signRightClick"));
setLine(sign, 2, Stargate.getString("signToUse"));
if (!portal.getOptions().isNoNetwork()) {
setLine(sign, 3, highlightColor + "(" + mainColor + portal.getNetwork() + highlightColor + ")");
setLine(sign, 3, highlightColor + "(" + mainColor + fixColor(portal.getNetwork()) +
highlightColor + ")");
} else {
setLine(sign, 3, "");
}
@ -247,12 +249,13 @@ public class PortalSignDrawer {
private void drawFixedSign(Sign sign) {
String destinationName = portal.getOptions().isRandom() ? Stargate.getString("signRandom") :
portal.getDestinationName();
setLine(sign, 1, highlightColor + ">" + mainColor + destinationName + highlightColor + "<");
setLine(sign, 1, highlightColor + ">" + mainColor + fixColor(destinationName) + highlightColor + "<");
if (portal.getOptions().isNoNetwork()) {
setLine(sign, 2, "");
} else {
setLine(sign, 2, highlightColor + "(" + mainColor + portal.getNetwork() + highlightColor + ")");
setLine(sign, 2, highlightColor + "(" + mainColor + fixColor(portal.getNetwork()) +
highlightColor + ")");
}
Portal destination = PortalHandler.getByName(portal.getDestinationName(), portal.getNetwork());
if (destination == null && !portal.getOptions().isRandom()) {
@ -277,4 +280,14 @@ public class PortalSignDrawer {
Stargate.logInfo(String.format("Gate layout on line %d does not exist [%s]", lineIndex, gateName));
}
/**
* Fixes coloring of signs as the & character isn't translated on all servers
*
* @param text <p>The text to fix the coloring of</p>
* @return <p>The text with the coloring fixed</p>
*/
private String fixColor(String text) {
return ChatColor.translateAlternateColorCodes('&', text);
}
}

View File

@ -1,6 +1,6 @@
name: Stargate
main: net.knarcraft.stargate.Stargate
version: 0.9.1.0
version: 0.9.1.2
description: Stargate mod for Bukkit Revived
author: EpicKnarvik97
authors: [ Drakia, PseudoKnight, EpicKnarvik97 ]