Skip to content

Commit

Permalink
Fixes bug where warp sign text wasn't showing in chat response
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Jul 1, 2019
1 parent 4621772 commit 43bc506
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 72 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>world.bentobox</groupId>
<artifactId>warps</artifactId>
<version>1.5.1-SNAPSHOT</version>
<version>1.5.2-SNAPSHOT</version>

<name>WelcomeWarpSigns</name>
<description>WelcomeWarpSigns is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like ASkyBlock or AcidIsland.</description>
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/world/bentobox/warps/WarpSignsListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void onSignBreak(BlockBreakEvent e) {
if (s == null) {
return;
}
if (s.getLine(0).equalsIgnoreCase(ChatColor.GREEN + addon.getConfig().getString("welcomeLine"))) {
if (s.getLine(0).equalsIgnoreCase(ChatColor.GREEN + addon.getSettings().getWelcomeLine())) {
// Do a quick check to see if this sign location is in
// the list of warp signs
Map<UUID, Location> list = addon.getWarpSignsManager().getWarpMap(b.getWorld());
Expand Down Expand Up @@ -93,7 +93,7 @@ public void onSignWarpCreate(SignChangeEvent e) {
String title = e.getLine(0);
User user = User.getInstance(e.getPlayer());
// Check if someone is changing their own sign
if (title.equalsIgnoreCase(addon.getConfig().getString("welcomeLine"))) {
if (title.equalsIgnoreCase(addon.getSettings().getWelcomeLine())) {
// Welcome sign detected - check permissions
if (!(user.hasPermission(addon.getPermPrefix(b.getWorld()) + ".island.addwarp"))) {
user.sendMessage("warps.error.no-permission");
Expand All @@ -113,7 +113,7 @@ public void onSignWarpCreate(SignChangeEvent e) {
// Check that the player is on their island
if (!(plugin.getIslands().userIsOnIsland(b.getWorld(), user))) {
user.sendMessage("warps.error.not-on-island");
e.setLine(0, ChatColor.RED + addon.getConfig().getString("welcomeLine"));
e.setLine(0, ChatColor.RED + addon.getSettings().getWelcomeLine());
return;
}
// Check if the player already has a sign
Expand All @@ -132,8 +132,8 @@ public void onSignWarpCreate(SignChangeEvent e) {
// The block is still a sign
Sign oldSign = (Sign) oldSignBlock.getState();
if (oldSign != null) {
if (oldSign.getLine(0).equalsIgnoreCase(ChatColor.GREEN + addon.getConfig().getString("welcomeLine"))) {
oldSign.setLine(0, ChatColor.RED + addon.getConfig().getString("welcomeLine"));
if (oldSign.getLine(0).equalsIgnoreCase(ChatColor.GREEN + addon.getSettings().getWelcomeLine())) {
oldSign.setLine(0, ChatColor.RED + addon.getSettings().getWelcomeLine());
oldSign.update(true, false);
user.sendMessage("warps.deactivate");
addon.getWarpSignsManager().removeWarp(oldSignBlock.getWorld(), user.getUniqueId());
Expand All @@ -151,13 +151,13 @@ public void onSignWarpCreate(SignChangeEvent e) {
private void addSign(SignChangeEvent e, User user, Block b) {
if (addon.getWarpSignsManager().addWarp(user.getUniqueId(), b.getLocation())) {
user.sendMessage("warps.success");
e.setLine(0, ChatColor.GREEN + addon.getConfig().getString("welcomeLine"));
e.setLine(0, ChatColor.GREEN + addon.getSettings().getWelcomeLine());
for (int i = 1; i<4; i++) {
e.setLine(i, ChatColor.translateAlternateColorCodes('&', e.getLine(i)));
}
} else {
user.sendMessage("warps.error.duplicate");
e.setLine(0, ChatColor.RED + addon.getConfig().getString("welcomeLine"));
e.setLine(0, ChatColor.RED + addon.getSettings().getWelcomeLine());
for (int i = 1; i<4; i++) {
e.setLine(i, ChatColor.translateAlternateColorCodes('&', e.getLine(i)));
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/world/bentobox/warps/WarpSignsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ private void popSign(Location loc) {
if (b.getType().name().contains("SIGN")) {
Sign s = (Sign) b.getState();
if (s != null) {
if (s.getLine(0).equalsIgnoreCase(ChatColor.GREEN + addon.getConfig().getString("welcomeLine"))) {
s.setLine(0, ChatColor.RED + addon.getConfig().getString("welcomeLine"));
if (s.getLine(0).equalsIgnoreCase(ChatColor.GREEN + addon.getSettings().getWelcomeLine())) {
s.setLine(0, ChatColor.RED + addon.getSettings().getWelcomeLine());
s.update(true, false);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/world/bentobox/warps/commands/WarpCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public class WarpCommand extends CompositeCommand {

private Warp addon;

public WarpCommand(Warp plugin, CompositeCommand bsbIslandCmd) {
public WarpCommand(Warp addon, CompositeCommand bsbIslandCmd) {
super(bsbIslandCmd, "warp");
this.addon = plugin;
this.addon = addon;
}

@Override
Expand All @@ -40,7 +40,7 @@ public boolean execute(User user, String label, List<String> args) {
Set<UUID> warpList = addon.getWarpSignsManager().listWarps(getWorld());
if (warpList.isEmpty()) {
user.sendMessage("warps.error.no-warps-yet");
user.sendMessage("warps.warpTip", "[text]", getAddon().getConfig().getString("welcomeLine", "[WELCOME]"));
user.sendMessage("warps.warpTip", "[text]", addon.getSettings().getWelcomeLine());
return true;
} else {
// Check if this is part of a name
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/world/bentobox/warps/commands/WarpsCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/
public class WarpsCommand extends CompositeCommand {

private Warp plugin;
private Warp addon;

public WarpsCommand(Warp plugin, CompositeCommand bsbIslandCmd) {
public WarpsCommand(Warp addon, CompositeCommand bsbIslandCmd) {
super(bsbIslandCmd, "warps");
this.plugin = plugin;
this.addon = addon;
}

/* (non-Javadoc)
Expand All @@ -37,11 +37,11 @@ public void setup() {
*/
@Override
public boolean execute(User user, String label, List<String> args) {
if (plugin.getWarpSignsManager().listWarps(getWorld()).isEmpty()) {
if (addon.getWarpSignsManager().listWarps(getWorld()).isEmpty()) {
user.sendMessage("warps.error.no-warps-yet");
user.sendMessage("warps.warpTip", "[text]", getAddon().getConfig().getString("welcomeLine", "[WELCOME]"));
user.sendMessage("warps.warpTip", "[text]", addon.getSettings().getWelcomeLine());
} else {
plugin.getWarpPanelManager().showWarpPanel(getWorld(), user,0);
addon.getWarpPanelManager().showWarpPanel(getWorld(), user,0);
}
return true;
}
Expand Down

0 comments on commit 43bc506

Please sign in to comment.