Fixed locale messages.

This commit is contained in:
tastybento 2018-08-04 16:26:45 -07:00
parent 4d44b5141c
commit fd895262c5
3 changed files with 13 additions and 19 deletions

View File

@ -4,6 +4,7 @@
########################################################################################### ###########################################################################################
warps: warps:
deactivate: "&cOld warp sign deactivated!"
success: "&ASuccess!" success: "&ASuccess!"
sign-removed: "&CWarp sign removed!" sign-removed: "&CWarp sign removed!"
title: "Warp Signs" title: "Warp Signs"
@ -13,6 +14,7 @@ warps:
warpToPlayersSign: "&6Warping to [player]'s sign" warpToPlayersSign: "&6Warping to [player]'s sign"
warpTip: "&6Place a warp sign with [Welcome] on the top" warpTip: "&6Place a warp sign with [Welcome] on the top"
error: error:
does-not-exist: "&cOh snap! That warp no longer exists!"
no-remove: "&CYou cannot remove that sign!" no-remove: "&CYou cannot remove that sign!"
not-enough-level: "&CYour island level is not high enough!" not-enough-level: "&CYour island level is not high enough!"
no-permission: "&CYou do not have permission to do that!" no-permission: "&CYou do not have permission to do that!"

View File

@ -146,8 +146,8 @@ public class WarpSignsManager {
} }
/** /**
* Lists all the known warps * Lists all the known warps for this world
* @param world * @param world - world
* *
* @return UUID set of warps * @return UUID set of warps
*/ */
@ -343,7 +343,7 @@ public class WarpSignsManager {
* @param owner - owner of the warp * @param owner - owner of the warp
*/ */
public void warpPlayer(World world, User user, UUID owner) { public void warpPlayer(World world, User user, UUID owner) {
final Location warpSpot = addon.getWarpSignsManager().getWarp(world, owner); final Location warpSpot = getWarp(world, owner);
// Check if the warp spot is safe // Check if the warp spot is safe
if (warpSpot == null) { if (warpSpot == null) {
user.sendMessage("warps.error.NotReadyYet"); user.sendMessage("warps.error.NotReadyYet");
@ -379,7 +379,7 @@ public class WarpSignsManager {
} }
} else { } else {
// Warp has been removed // Warp has been removed
user.sendMessage("warps.error.DoesNotExist"); user.sendMessage("warps.error.does-not-exist");
addon.getWarpSignsManager().removeWarp(warpSpot); addon.getWarpSignsManager().removeWarp(warpSpot);
return; return;
} }

View File

@ -49,30 +49,22 @@ public class WarpCommand extends CompositeCommand {
public boolean execute(User user, String label, List<String> args) { public boolean execute(User user, String label, List<String> args) {
if (args.size() == 1) { if (args.size() == 1) {
// Warp somewhere command // Warp somewhere command
final Set<UUID> warpList = plugin.getWarpSignsManager().listWarps(getWorld()); Set<UUID> warpList = plugin.getWarpSignsManager().listWarps(getWorld());
if (warpList.isEmpty()) { if (warpList.isEmpty()) {
user.sendMessage("warps.errorNoWarpsYet"); user.sendMessage("warps.error.no-warps-yet");
user.sendMessage("warps.warpTip"); user.sendMessage("warps.warpTip");
return true; return true;
} else { } else {
// Check if this is part of a name // Check if this is part of a name
UUID foundWarp = null; UUID foundWarp = warpList.stream().filter(u -> getPlayers().getName(u).toLowerCase().equals(args.get(0).toLowerCase())
for (UUID warp : warpList) { || getPlayers().getName(u).toLowerCase().startsWith(args.get(0).toLowerCase())).findFirst().orElse(null);
if (warp == null)
continue;
if (getPlayers().getName(warp).toLowerCase().equals(args.get(0).toLowerCase())) {
foundWarp = warp;
break;
} else if (getPlayers().getName(warp).toLowerCase().startsWith(args.get(0).toLowerCase())) {
foundWarp = warp;
}
}
if (foundWarp == null) { if (foundWarp == null) {
user.sendMessage("warps.error.DoesNotExist"); user.sendMessage("warps.error.does-not-exist");
return true; return false;
} else { } else {
// Warp exists! // Warp exists!
plugin.getWarpSignsManager().warpPlayer(getWorld(), user, foundWarp); plugin.getWarpSignsManager().warpPlayer(getWorld(), user, foundWarp);
return true;
} }
} }
} }