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

View File

@ -146,8 +146,8 @@ public class WarpSignsManager {
}
/**
* Lists all the known warps
* @param world
* Lists all the known warps for this world
* @param world - world
*
* @return UUID set of warps
*/
@ -343,7 +343,7 @@ public class WarpSignsManager {
* @param owner - owner of the warp
*/
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
if (warpSpot == null) {
user.sendMessage("warps.error.NotReadyYet");
@ -379,7 +379,7 @@ public class WarpSignsManager {
}
} else {
// Warp has been removed
user.sendMessage("warps.error.DoesNotExist");
user.sendMessage("warps.error.does-not-exist");
addon.getWarpSignsManager().removeWarp(warpSpot);
return;
}

View File

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