Removed hard coded default colors. Gonna add them in locale files instead.

This commit is contained in:
Poslovitch 2017-08-18 17:14:50 +02:00
parent 4943c89c42
commit b22c509f3a
9 changed files with 203 additions and 202 deletions

View File

@ -322,6 +322,7 @@ public abstract class AbstractCommand implements CommandExecutor, TabCompleter {
this.errorResponse = errorResponse;
}
}
// These methods below just neaten up the code in the commands so "plugin." isn't always used
/**
* @return PlayersManager

View File

@ -61,7 +61,7 @@ public class IslandCommand extends AbstractCommand {
// Basic permission check to even use /island
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "island.create")) {
return new CanUseResp(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
return new CanUseResp(getLocale(sender).get("general.errors.no-permission"));
}
return new CanUseResp(true);
@ -90,35 +90,35 @@ public class IslandCommand extends AbstractCommand {
@Override
public void execute(CommandSender sender, String[] args) {
Util.sendMessage(sender, ChatColor.GOLD + "About " + ChatColor.GREEN + plugin.getDescription().getName() + ChatColor.GOLD + " v" + ChatColor.AQUA + plugin.getDescription().getVersion() + ChatColor.GOLD + ":");
Util.sendMessage(sender, ChatColor.GOLD + "Copyright (c) 2017 tastybento, Poslovitch");
Util.sendMessage(sender, ChatColor.GOLD + "All rights reserved.");
Util.sendMessage(sender, ChatColor.GOLD + "");
Util.sendMessage(sender, ChatColor.GOLD + "Redistribution and use in source and binary forms, with or without");
Util.sendMessage(sender, ChatColor.GOLD + "modification, are permitted provided that the following conditions are met:");
Util.sendMessage(sender, "About " + plugin.getDescription().getName() + " v" + plugin.getDescription().getVersion() + ":");
Util.sendMessage(sender, "Copyright (c) 2017 tastybento, Poslovitch");
Util.sendMessage(sender, "All rights reserved.");
Util.sendMessage(sender, "");
Util.sendMessage(sender, "Redistribution and use in source and binary forms, with or without");
Util.sendMessage(sender, "modification, are permitted provided that the following conditions are met:");
Util.sendMessage(sender, ChatColor.GOLD + " * Redistributions of source code must retain the above copyright notice,");
Util.sendMessage(sender, ChatColor.GOLD + " this list of conditions and the following disclaimer.");
Util.sendMessage(sender, " * Redistributions of source code must retain the above copyright notice,");
Util.sendMessage(sender, " this list of conditions and the following disclaimer.");
Util.sendMessage(sender, ChatColor.GOLD + " * Redistributions in binary form must reproduce the above copyright");
Util.sendMessage(sender, ChatColor.GOLD + " notice, this list of conditions and the following disclaimer in the");
Util.sendMessage(sender, ChatColor.GOLD + " documentation and/or other materials provided with the distribution.");
Util.sendMessage(sender, " * Redistributions in binary form must reproduce the above copyright");
Util.sendMessage(sender, " notice, this list of conditions and the following disclaimer in the");
Util.sendMessage(sender, " documentation and/or other materials provided with the distribution.");
Util.sendMessage(sender, ChatColor.GOLD + " * Neither the name of the BSkyBlock team nor the names of its");
Util.sendMessage(sender, ChatColor.GOLD + " contributors may be used to endorse or promote products derived from");
Util.sendMessage(sender, ChatColor.GOLD + " this software without specific prior written permission.");
Util.sendMessage(sender, " * Neither the name of the BSkyBlock team nor the names of its");
Util.sendMessage(sender, " contributors may be used to endorse or promote products derived from");
Util.sendMessage(sender, " this software without specific prior written permission.");
Util.sendMessage(sender, ChatColor.GOLD + "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"");
Util.sendMessage(sender, ChatColor.GOLD + "AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE");
Util.sendMessage(sender, ChatColor.GOLD + "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE");
Util.sendMessage(sender, ChatColor.GOLD + "ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE");
Util.sendMessage(sender, ChatColor.GOLD + "LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR");
Util.sendMessage(sender, ChatColor.GOLD + "CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF");
Util.sendMessage(sender, ChatColor.GOLD + "SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS");
Util.sendMessage(sender, ChatColor.GOLD + "INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN");
Util.sendMessage(sender, ChatColor.GOLD + "CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)");
Util.sendMessage(sender, ChatColor.GOLD + "ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE");
Util.sendMessage(sender, ChatColor.GOLD + "POSSIBILITY OF SUCH DAMAGE. ");
Util.sendMessage(sender, "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"");
Util.sendMessage(sender, "AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE");
Util.sendMessage(sender, "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE");
Util.sendMessage(sender, "ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE");
Util.sendMessage(sender, "LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR");
Util.sendMessage(sender, "CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF");
Util.sendMessage(sender, "SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS");
Util.sendMessage(sender, "INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN");
Util.sendMessage(sender, "CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)");
Util.sendMessage(sender, "ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE");
Util.sendMessage(sender, "POSSIBILITY OF SUCH DAMAGE. ");
}
@Override
@ -333,15 +333,15 @@ public class IslandCommand extends AbstractCommand {
@Override
public CanUseResp canUse(CommandSender sender) {
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "island.name")) {
return new CanUseResp(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
return new CanUseResp(getLocale(sender).get("general.errors.no-permission"));
}
if (!getIslands().hasIsland(playerUUID)) {
return new CanUseResp(ChatColor.RED + getLocale(sender).get("general.errors.no-island"));
return new CanUseResp(getLocale(sender).get("general.errors.no-island"));
}
if (!getIslands().isOwner(playerUUID)) {
return new CanUseResp(ChatColor.RED + getLocale(sender).get("general.errors.not-leader"));
return new CanUseResp(getLocale(sender).get("general.errors.not-leader"));
}
return new CanUseResp(true);
@ -361,11 +361,11 @@ public class IslandCommand extends AbstractCommand {
// Check if the name isn't too short or too long
if (name.length() < Settings.nameMinLength) {
Util.sendMessage(player, ChatColor.RED + getLocale(sender).get("general.errors.too-short").replace("[length]", String.valueOf(Settings.nameMinLength)));
Util.sendMessage(player, getLocale(sender).get("general.errors.too-short").replace("[length]", String.valueOf(Settings.nameMinLength)));
return;
}
if (name.length() > Settings.nameMaxLength) {
Util.sendMessage(player, ChatColor.RED + getLocale(sender).get("general.errors.too-long").replace("[length]", String.valueOf(Settings.nameMaxLength)));
Util.sendMessage(player, getLocale(sender).get("general.errors.too-long").replace("[length]", String.valueOf(Settings.nameMaxLength)));
return;
}
@ -374,7 +374,7 @@ public class IslandCommand extends AbstractCommand {
getIslands().getIsland(player.getUniqueId()).setName(ChatColor.translateAlternateColorCodes('&', name));
else getIslands().getIsland(playerUUID).setName(name);
Util.sendMessage(player, ChatColor.GREEN + getLocale(sender).get("general.success"));
Util.sendMessage(player, getLocale(sender).get("general.success"));
}
@Override
@ -394,15 +394,15 @@ public class IslandCommand extends AbstractCommand {
@Override
public CanUseResp canUse(CommandSender sender) {
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "island.name")) {
return new CanUseResp(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
return new CanUseResp(getLocale(sender).get("general.errors.no-permission"));
}
if (!getIslands().hasIsland(playerUUID)) {
return new CanUseResp(ChatColor.RED + getLocale(sender).get("general.errors.no-island"));
return new CanUseResp(getLocale(sender).get("general.errors.no-island"));
}
if (!getIslands().isOwner(playerUUID)) {
return new CanUseResp(ChatColor.RED + getLocale(sender).get("general.errors.not-leader"));
return new CanUseResp(getLocale(sender).get("general.errors.not-leader"));
}
return new CanUseResp(true);
@ -412,7 +412,7 @@ public class IslandCommand extends AbstractCommand {
public void execute(CommandSender sender, String[] args) {
// Resets the island name
getIslands().getIsland(playerUUID).setName(null);
Util.sendMessage(player, ChatColor.GREEN + getLocale(sender).get("general.success"));
Util.sendMessage(player, getLocale(sender).get("general.success"));
}
@Override
@ -432,7 +432,7 @@ public class IslandCommand extends AbstractCommand {
@Override
public CanUseResp canUse(CommandSender sender) {
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "team.create")) {
return new CanUseResp(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
return new CanUseResp(getLocale(sender).get("general.errors.no-permission"));
}
if (!inTeam) {
@ -469,12 +469,12 @@ public class IslandCommand extends AbstractCommand {
if (maxSize < 1) maxSize = 1;
}
if (teamMembers.size() < maxSize) {
Util.sendMessage(player, ChatColor.GREEN + getLocale(sender).get("invite.youCanInvite").replace("[number]", String.valueOf(maxSize - teamMembers.size())));
Util.sendMessage(player, getLocale(sender).get("invite.youCanInvite").replace("[number]", String.valueOf(maxSize - teamMembers.size())));
} else {
Util.sendMessage(player, ChatColor.RED + getLocale(sender).get("invite.error.YourIslandIsFull"));
Util.sendMessage(player, getLocale(sender).get("invite.error.YourIslandIsFull"));
}
}
Util.sendMessage(player, ChatColor.YELLOW + getLocale(sender).get("team.listingMembers"));
Util.sendMessage(player, getLocale(sender).get("team.listingMembers"));
// Display members in the list
for (UUID m : teamMembers) {
if (teamLeaderUUID.equals(m)) {
@ -505,15 +505,15 @@ public class IslandCommand extends AbstractCommand {
@Override
public CanUseResp canUse(CommandSender sender) {
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "team.create")) {
return new CanUseResp(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
return new CanUseResp(getLocale(sender).get("general.errors.no-permission"));
}
// Player issuing the command must have an island
if (!getPlayers().hasIsland(playerUUID)) {
// If the player is in a team, they are not the leader
if (getPlayers().inTeam(playerUUID)) {
return new CanUseResp(ChatColor.RED + getLocale(sender).get("general.errors.not-leader"));
return new CanUseResp(getLocale(sender).get("general.errors.not-leader"));
}
return new CanUseResp(ChatColor.RED + getLocale(sender).get("invite.error.YouMustHaveIslandToInvite"));
return new CanUseResp(getLocale(sender).get("invite.error.YouMustHaveIslandToInvite"));
}
return new CanUseResp(true);
}
@ -525,9 +525,9 @@ public class IslandCommand extends AbstractCommand {
//TODO
if (inviteList.containsKey(playerUUID)) {
OfflinePlayer inviter = plugin.getServer().getOfflinePlayer(inviteList.get(playerUUID));
Util.sendMessage(player, ChatColor.GREEN + getLocale(sender).get("invite.nameHasInvitedYou").replace("[name]", inviter.getName()));
Util.sendMessage(player, getLocale(sender).get("invite.nameHasInvitedYou").replace("[name]", inviter.getName()));
} else {
Util.sendMessage(player, ChatColor.RED + getLocale(sender).get("island.help.Invite"));
Util.sendMessage(player, getLocale(sender).get("island.help.Invite"));
}
return;
}
@ -536,25 +536,25 @@ public class IslandCommand extends AbstractCommand {
@SuppressWarnings("deprecation")
Player invitedPlayer = plugin.getServer().getPlayer(args[0]);
if (invitedPlayer == null) {
Util.sendMessage(player, ChatColor.RED + getLocale(sender).get("general.errors.offline-player"));
Util.sendMessage(player, getLocale(sender).get("general.errors.offline-player"));
return;
}
UUID invitedPlayerUUID = invitedPlayer.getUniqueId();
// Player cannot invite themselves
if (playerUUID.equals(invitedPlayerUUID)) {
Util.sendMessage(player, ChatColor.RED + getLocale(sender).get("invite.error.YouCannotInviteYourself"));
Util.sendMessage(player, getLocale(sender).get("invite.error.YouCannotInviteYourself"));
return;
}
// Check if this player can be invited to this island, or
// whether they are still on cooldown
long time = getPlayers().getInviteCoolDownTime(invitedPlayerUUID, getIslands().getIslandLocation(playerUUID));
if (time > 0 && !player.isOp()) {
Util.sendMessage(player, ChatColor.RED + getLocale(sender).get("invite.error.CoolDown").replace("[time]", String.valueOf(time)));
Util.sendMessage(player, getLocale(sender).get("invite.error.CoolDown").replace("[time]", String.valueOf(time)));
return;
}
// Player cannot invite someone already on a team
if (getPlayers().inTeam(invitedPlayerUUID)) {
Util.sendMessage(player, ChatColor.RED + getLocale(sender).get("invite.error.ThatPlayerIsAlreadyInATeam"));
Util.sendMessage(player, getLocale(sender).get("invite.error.ThatPlayerIsAlreadyInATeam"));
return;
}
// Check if player has space on their team
@ -585,21 +585,21 @@ public class IslandCommand extends AbstractCommand {
// Players can only have one invite one at a time - interesting
if (inviteList.containsValue(playerUUID)) {
inviteList.inverse().remove(playerUUID);
Util.sendMessage(player, ChatColor.YELLOW + getLocale(sender).get("invite.removingInvite"));
Util.sendMessage(player, getLocale(sender).get("invite.removingInvite"));
}
// Put the invited player (key) onto the list with inviter (value)
// If someone else has invited a player, then this invite will overwrite the previous invite!
inviteList.put(invitedPlayerUUID, playerUUID);
Util.sendMessage(player, ChatColor.GREEN + getLocale(sender).get("invite.inviteSentTo").replace("[name]", args[0]));
Util.sendMessage(player, getLocale(sender).get("invite.inviteSentTo").replace("[name]", args[0]));
// Send message to online player
Util.sendMessage(Bukkit.getPlayer(invitedPlayerUUID), getLocale(invitedPlayerUUID).get("invite.nameHasInvitedYou").replace("[name]", player.getName()));
Util.sendMessage(Bukkit.getPlayer(invitedPlayerUUID),
ChatColor.WHITE + "/" + label + " [accept/reject]" + ChatColor.YELLOW + " " + getLocale(invitedPlayerUUID).get("invite.toAcceptOrReject"));
"/" + label + " [accept/reject]" + " " + getLocale(invitedPlayerUUID).get("invite.toAcceptOrReject"));
if (getPlayers().hasIsland(invitedPlayerUUID)) {
Util.sendMessage(Bukkit.getPlayer(invitedPlayerUUID), ChatColor.RED + getLocale(invitedPlayerUUID).get("invite.warningYouWillLoseIsland"));
Util.sendMessage(Bukkit.getPlayer(invitedPlayerUUID), getLocale(invitedPlayerUUID).get("invite.warningYouWillLoseIsland"));
}
} else {
Util.sendMessage(player, ChatColor.RED + getLocale(sender).get("invite.error.YourIslandIsFull"));
Util.sendMessage(player, getLocale(sender).get("invite.error.YourIslandIsFull"));
}
}
}
@ -625,7 +625,7 @@ public class IslandCommand extends AbstractCommand {
@Override
public CanUseResp canUse(CommandSender sender) {
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "team.create")) {
return new CanUseResp(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
return new CanUseResp(getLocale(sender).get("general.errors.no-permission"));
}
return new CanUseResp(true);
@ -638,11 +638,11 @@ public class IslandCommand extends AbstractCommand {
Player invitee = plugin.getServer().getPlayer(inviteList.inverse().get(playerUUID));
if (invitee != null) {
inviteList.inverse().remove(playerUUID);
Util.sendMessage(invitee, ChatColor.RED + getLocale(invitee.getUniqueId()).get("invite.nameHasUninvitedYou").replace("[name]", player.getName()));
Util.sendMessage(player, ChatColor.GREEN + getLocale(sender).get("general.success"));
Util.sendMessage(invitee, getLocale(invitee.getUniqueId()).get("invite.nameHasUninvitedYou").replace("[name]", player.getName()));
Util.sendMessage(player, getLocale(sender).get("general.success"));
}
} else {
Util.sendMessage(player, ChatColor.RED + getLocale(sender).get("island.help.invite"));
Util.sendMessage(player, getLocale(sender).get("island.help.invite"));
}
}
@ -663,7 +663,7 @@ public class IslandCommand extends AbstractCommand {
@Override
public CanUseResp canUse(CommandSender sender) {
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "team.join")) {
return new CanUseResp(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
return new CanUseResp(getLocale(sender).get("general.errors.no-permission"));
}
return new CanUseResp(true);
@ -675,19 +675,19 @@ public class IslandCommand extends AbstractCommand {
if (getPlayers().inTeam(playerUUID)) {
// Team leaders cannot leave
if (teamLeaderUUID != null && teamLeaderUUID.equals(playerUUID)) {
Util.sendMessage(player, ChatColor.YELLOW + getLocale(sender).get("leave.errorYouAreTheLeader"));
Util.sendMessage(player, getLocale(sender).get("leave.errorYouAreTheLeader"));
return;
}
// Check for confirmation
if (Settings.leaveConfirmation && !leavingPlayers.contains(playerUUID)) {
leavingPlayers.add(playerUUID);
Util.sendMessage(player, ChatColor.RED + getLocale(sender).get("leave.Warning"));
Util.sendMessage(player, getLocale(sender).get("leave.Warning"));
plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
// If the player is still on the list, remove them and cancel the leave
if (leavingPlayers.contains(playerUUID)) {
leavingPlayers.remove(playerUUID);
Util.sendMessage(player, ChatColor.RED + getLocale(sender).get("leave.Canceled"));
Util.sendMessage(player, getLocale(sender).get("leave.Canceled"));
}
}, Settings.leaveConfirmWait * 20L);
@ -697,7 +697,7 @@ public class IslandCommand extends AbstractCommand {
leavingPlayers.remove(playerUUID);
// Remove from team
if (!getIslands().setLeaveTeam(playerUUID)) {
//Util.sendMessage(player, ChatColor.RED + getLocale(playerUUID).get("leaveerrorYouCannotLeaveIsland);
//Util.sendMessage(player, getLocale(playerUUID).get("leaveerrorYouCannotLeaveIsland);
// If this is canceled, fail silently
return;
}
@ -705,14 +705,14 @@ public class IslandCommand extends AbstractCommand {
// cannot join again before the cool down ends
getPlayers().startInviteCoolDownTimer(playerUUID, getIslands().getIslandLocation(teamLeaderUUID));
Util.sendMessage(player, ChatColor.YELLOW + getLocale(sender).get("leave.youHaveLeftTheIsland"));
Util.sendMessage(player, getLocale(sender).get("leave.youHaveLeftTheIsland"));
// Tell the leader if they are online
if (plugin.getServer().getPlayer(teamLeaderUUID) != null) {
Player leader = plugin.getServer().getPlayer(teamLeaderUUID);
Util.sendMessage(leader, ChatColor.RED + getLocale(teamLeaderUUID).get("leave.nameHasLeftYourIsland").replace("[name]", player.getName()));
Util.sendMessage(leader, getLocale(teamLeaderUUID).get("leave.nameHasLeftYourIsland").replace("[name]", player.getName()));
} else {
// TODO: Leave them a message
//plugin.getMessages().setMessage(teamLeader, ChatColor.RED + plugin.myLocale(teamLeader).leavenameHasLeftYourIsland.replace("[name]", player.getName()));
//plugin.getMessages().setMessage(teamLeader, plugin.myLocale(teamLeader).leavenameHasLeftYourIsland.replace("[name]", player.getName()));
}
// Clear all player variables and save
@ -721,10 +721,10 @@ public class IslandCommand extends AbstractCommand {
player.teleport(player.getWorld().getSpawnLocation());
}
} else {
Util.sendMessage(player, ChatColor.RED + getLocale(sender).get("leave.errorYouCannotLeaveIsland"));
Util.sendMessage(player, getLocale(sender).get("leave.errorYouCannotLeaveIsland"));
}
} else {
Util.sendMessage(player, ChatColor.RED + getLocale(sender).get("leave.errorYouMustBeInWorld"));
Util.sendMessage(player, getLocale(sender).get("leave.errorYouMustBeInWorld"));
}
}
@ -745,7 +745,7 @@ public class IslandCommand extends AbstractCommand {
@Override
public CanUseResp canUse(CommandSender sender) {
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "team.create")) {
return new CanUseResp(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
return new CanUseResp(getLocale(sender).get("general.errors.no-permission"));
}
return new CanUseResp(true);
@ -773,7 +773,7 @@ public class IslandCommand extends AbstractCommand {
@Override
public CanUseResp canUse(CommandSender sender) {
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "team.join")) {
return new CanUseResp(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
return new CanUseResp(getLocale(sender).get("general.errors.no-permission"));
}
return new CanUseResp(true);
@ -783,18 +783,18 @@ public class IslandCommand extends AbstractCommand {
public void execute(CommandSender sender, String[] args) {
// Check if player has been invited
if (!inviteList.containsKey(playerUUID)) {
Util.sendMessage(player, ChatColor.RED + getLocale(sender).get("invite.error.NoOneInvitedYou"));
Util.sendMessage(player, getLocale(sender).get("invite.error.NoOneInvitedYou"));
return;
}
// Check if player is already in a team
if (getPlayers().inTeam(playerUUID)) {
Util.sendMessage(player, ChatColor.RED + getLocale(sender).get("invite.error.YouAreAlreadyOnATeam"));
Util.sendMessage(player, getLocale(sender).get("invite.error.YouAreAlreadyOnATeam"));
return;
}
// Get the team leader
UUID prospectiveTeamLeaderUUID = inviteList.get(playerUUID);
if (!getIslands().hasIsland(prospectiveTeamLeaderUUID)) {
Util.sendMessage(player, ChatColor.RED + getLocale(sender).get("invite.error.InvalidInvite"));
Util.sendMessage(player, getLocale(sender).get("invite.error.InvalidInvite"));
inviteList.remove(playerUUID);
return;
}
@ -835,11 +835,11 @@ public class IslandCommand extends AbstractCommand {
// Fire event so add-ons can run commands, etc.
plugin.getServer().getPluginManager().callEvent(new PlayerAcceptInviteEvent(player));
Util.sendMessage(player, ChatColor.GREEN + getLocale(sender).get("invite.youHaveJoinedAnIsland").replace("[label]", Settings.ISLANDCOMMAND));
Util.sendMessage(player, getLocale(sender).get("invite.youHaveJoinedAnIsland").replace("[label]", Settings.ISLANDCOMMAND));
if (plugin.getServer().getPlayer(inviteList.get(playerUUID)) != null) {
Util.sendMessage(plugin.getServer().getPlayer(inviteList.get(playerUUID)),
ChatColor.GREEN + getLocale(sender).get("invite.hasJoinedYourIsland").replace("[name]", player.getName()));
getLocale(sender).get("invite.hasJoinedYourIsland").replace("[name]", player.getName()));
}
getIslands().save(false);
if (DEBUG)
@ -863,7 +863,7 @@ public class IslandCommand extends AbstractCommand {
@Override
public CanUseResp canUse(CommandSender sender) {
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "team.join")) {
return new CanUseResp(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
return new CanUseResp(getLocale(sender).get("general.errors.no-permission"));
}
return new CanUseResp(true);
@ -873,18 +873,18 @@ public class IslandCommand extends AbstractCommand {
public void execute(CommandSender sender, String[] args) {
// Reject /island reject
if (inviteList.containsKey(player.getUniqueId())) {
Util.sendMessage(player, ChatColor.YELLOW + getLocale(playerUUID).get("reject.youHaveRejectedInvitation"));
Util.sendMessage(player, getLocale(playerUUID).get("reject.youHaveRejectedInvitation"));
// If the player is online still then tell them directly
// about the rejection
if (Bukkit.getPlayer(inviteList.get(player.getUniqueId())) != null) {
Util.sendMessage(Bukkit.getPlayer(inviteList.get(playerUUID)),
ChatColor.RED + getLocale(playerUUID).get("reject.nameHasRejectedInvite").replace("[name]", player.getName()));
getLocale(playerUUID).get("reject.nameHasRejectedInvite").replace("[name]", player.getName()));
}
// Remove this player from the global invite list
inviteList.remove(player.getUniqueId());
} else {
// Someone typed /island reject and had not been invited
Util.sendMessage(player, ChatColor.RED + getLocale(playerUUID).get("reject.youHaveNotBeenInvited"));
Util.sendMessage(player, getLocale(playerUUID).get("reject.youHaveNotBeenInvited"));
}
}
@ -905,7 +905,7 @@ public class IslandCommand extends AbstractCommand {
@Override
public CanUseResp canUse(CommandSender sender) {
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "team.create")) {
return new CanUseResp(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
return new CanUseResp(getLocale(sender).get("general.errors.no-permission"));
}
return new CanUseResp(true);
@ -916,23 +916,23 @@ public class IslandCommand extends AbstractCommand {
plugin.getLogger().info("DEBUG: arg[0] = " + args[0]);
UUID targetPlayer = getPlayers().getUUID(args[0]);
if (targetPlayer == null) {
Util.sendMessage(player, ChatColor.RED + getLocale(playerUUID).get("general.errors.unknown-player"));
Util.sendMessage(player, getLocale(playerUUID).get("general.errors.unknown-player"));
return;
}
if (!getPlayers().inTeam(playerUUID)) {
Util.sendMessage(player, ChatColor.RED + getLocale(playerUUID).get("makeleader.errorYouMustBeInTeam"));
Util.sendMessage(player, getLocale(playerUUID).get("makeleader.errorYouMustBeInTeam"));
return;
}
if (!teamLeaderUUID.equals(playerUUID)) {
Util.sendMessage(player, ChatColor.RED + getLocale(playerUUID).get("makeleader.errorNotYourIsland"));
Util.sendMessage(player, getLocale(playerUUID).get("makeleader.errorNotYourIsland"));
return;
}
if (targetPlayer.equals(playerUUID)) {
Util.sendMessage(player, ChatColor.RED + getLocale(playerUUID).get("makeleader.errorGeneralError"));
Util.sendMessage(player, getLocale(playerUUID).get("makeleader.errorGeneralError"));
return;
}
if (!teamMembers.contains(targetPlayer)) {
Util.sendMessage(player, ChatColor.RED + getLocale(playerUUID).get("makeleader.errorThatPlayerIsNotInTeam"));
Util.sendMessage(player, getLocale(playerUUID).get("makeleader.errorThatPlayerIsNotInTeam"));
return;
}
// targetPlayer is the new leader
@ -948,7 +948,7 @@ public class IslandCommand extends AbstractCommand {
} else {
// Online
Util.sendMessage(plugin.getServer().getPlayer(targetPlayer), ChatColor.GREEN + getLocale(targetPlayer).get("makeLeader.youAreNowTheOwner"));
Util.sendMessage(plugin.getServer().getPlayer(targetPlayer), getLocale(targetPlayer).get("makeLeader.youAreNowTheOwner"));
// Check if new leader has a lower range permission than the island size
boolean hasARangePerm = false;
int range = Settings.islandProtectionRange;
@ -987,8 +987,8 @@ public class IslandCommand extends AbstractCommand {
// Range can go up or down
if (range != islandByOwner.getProtectionRange()) {
Util.sendMessage(player, ChatColor.GOLD + getLocale(targetPlayer).get("admin.SetRangeUpdated").replace("[number]", String.valueOf(range)));
Util.sendMessage(target, ChatColor.GOLD + getLocale(targetPlayer).get("admin.SetRangeUpdated").replace("[number]", String.valueOf(range)));
Util.sendMessage(player, getLocale(targetPlayer).get("admin.SetRangeUpdated").replace("[number]", String.valueOf(range)));
Util.sendMessage(target, getLocale(targetPlayer).get("admin.SetRangeUpdated").replace("[number]", String.valueOf(range)));
plugin.getLogger().info(
"Makeleader: Island protection range changed from " + islandByOwner.getProtectionRange() + " to "
+ range + " for " + player.getName() + " due to permission.");
@ -1305,11 +1305,11 @@ public class IslandCommand extends AbstractCommand {
@Override
public CanUseResp canUse(CommandSender sender) {
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "island.lock")) {
return new CanUseResp(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
return new CanUseResp(getLocale(sender).get("general.errors.no-permission"));
}
if (!getIslands().hasIsland(playerUUID)) {
return new CanUseResp(ChatColor.RED + getLocale(sender).get("general.errors.no-island"));
return new CanUseResp(getLocale(sender).get("general.errors.no-island"));
}
return new CanUseResp(true);
@ -1324,7 +1324,7 @@ public class IslandCommand extends AbstractCommand {
// TODO: send offline messages
island.setLocked(true);
} else {
Util.sendMessage(player, ChatColor.GREEN + getLocale(sender).get("island.lock.unlocking"));
Util.sendMessage(player, getLocale(sender).get("island.lock.unlocking"));
// TODO: send offline messages
island.setLocked(false);
}

View File

@ -78,7 +78,7 @@ public class JoinLeaveListener implements Listener {
&& !VaultHelper.hasPerm(player, Settings.PERMPREFIX + "mod.bypassprotect")) {
if (DEBUG)
plugin.getLogger().info("DEBUG: No bypass - teleporting");
Util.sendMessage(player, ChatColor.RED + plugin.getLocale(player.getUniqueId()).get("locked.islandlocked"));
Util.sendMessage(player, plugin.getLocale(player.getUniqueId()).get("locked.islandlocked"));
plugin.getIslands().homeTeleport(player);
}
}

View File

@ -118,7 +118,7 @@ public class NetherPortals implements Listener {
if (DEBUG)
plugin.getLogger().info("DEBUG: Portal use not allowed");
if (!event.getPlayer().isOp() && !VaultHelper.hasPerm(event.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
Util.sendMessage(event.getPlayer(), ChatColor.RED + plugin.getLocale(event.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(event.getPlayer(), plugin.getLocale(event.getPlayer().getUniqueId()).get("island.protected"));
event.setCancelled(true);
return;
}
@ -140,7 +140,7 @@ public class NetherPortals implements Listener {
// end_place.getBlock().getType(),end_place.getBlock().getData());
return;
} else {
Util.sendMessage(event.getPlayer(), ChatColor.RED + plugin.getLocale(event.getPlayer().getUniqueId()).get("warps.error.NotSafe"));
Util.sendMessage(event.getPlayer(), plugin.getLocale(event.getPlayer().getUniqueId()).get("warps.error.NotSafe"));
plugin.getIslands().homeTeleport(event.getPlayer());
return;
}
@ -230,7 +230,7 @@ public class NetherPortals implements Listener {
} else {
plugin.getLogger().severe("Cannot teleport player to nether because there is no nether schematic");
event.setCancelled(true);
Util.sendMessage(event.getPlayer(), ChatColor.RED + plugin.getLocale(event.getPlayer().getUniqueId()).get("warps.error.NotSafe"));
Util.sendMessage(event.getPlayer(), plugin.getLocale(event.getPlayer().getUniqueId()).get("warps.error.NotSafe"));
return;
}
}

View File

@ -124,7 +124,7 @@ public class IslandGuard implements Listener {
return;
}
// Elsewhere - not allowed
Util.sendMessage(event.getWhoClicked(), ChatColor.RED + plugin.getLocale(event.getWhoClicked().getUniqueId()).get("island.protected"));
Util.sendMessage(event.getWhoClicked(), plugin.getLocale(event.getWhoClicked().getUniqueId()).get("island.protected"));
event.setCancelled(true);
}
}
@ -187,7 +187,7 @@ public class IslandGuard implements Listener {
return;
}
// Not allowed
Util.sendMessage(p, ChatColor.RED + plugin.getLocale(p.getUniqueId()).get("island.protected"));
Util.sendMessage(p, plugin.getLocale(p.getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
@ -232,7 +232,7 @@ public class IslandGuard implements Listener {
if (!islandTo.getMembers().contains(player.getUniqueId()) && !player.isOp()
&& !VaultHelper.hasPerm(player, Settings.PERMPREFIX + "mod.bypassprotect")
&& !VaultHelper.hasPerm(player, Settings.PERMPREFIX + "mod.bypasslock")) {
Util.sendMessage(player, ChatColor.RED + plugin.getLocale(player.getUniqueId()).get("lock.islandlocked"));
Util.sendMessage(player, plugin.getLocale(player.getUniqueId()).get("lock.islandlocked"));
// Get the vector away from this island
Vector v = e.getVehicle().getLocation().toVector().subtract(islandTo.getCenter().toVector()).normalize().multiply(new Vector(1.2,0,1.2));
if (DEBUG)
@ -346,7 +346,7 @@ public class IslandGuard implements Listener {
if (!islandTo.getMembers().contains(e.getPlayer().getUniqueId()) && !e.getPlayer().isOp()
&& !VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")
&& !VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypasslock")) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("lock.islandlocked"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("lock.islandlocked"));
// Get the vector away from this island
if (e.getPlayer().isInsideVehicle()) {
@ -370,7 +370,7 @@ public class IslandGuard implements Listener {
if (islandTo != null && islandFrom == null && (islandTo.getOwner() != null || islandTo.isSpawn())) {
// Entering
if (islandTo.isLocked() || plugin.getPlayers().isBanned(islandTo.getOwner(),e.getPlayer().getUniqueId())) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("lock.islandlocked"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("lock.islandlocked"));
}
if (islandTo.isSpawn()) {
if (!plugin.getLocale(e.getPlayer().getUniqueId()).get("lock.enteringspawn").isEmpty()) {
@ -688,7 +688,7 @@ public class IslandGuard implements Listener {
return;
}
// Everyone else - not allowed
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
@ -859,7 +859,7 @@ public class IslandGuard implements Listener {
return;
}
// Else not allowed
Util.sendMessage(attacker, ChatColor.RED + plugin.getLocale(attacker.getUniqueId()).get("island.protected"));
Util.sendMessage(attacker, plugin.getLocale(attacker.getUniqueId()).get("island.protected"));
if (flamingArrow)
e.getEntity().setFireTicks(0);
if (projectile)
@ -890,7 +890,7 @@ public class IslandGuard implements Listener {
return;
}
// Not allowed
Util.sendMessage(attacker, ChatColor.RED + plugin.getLocale(attacker.getUniqueId()).get("island.protected"));
Util.sendMessage(attacker, plugin.getLocale(attacker.getUniqueId()).get("island.protected"));
if (flamingArrow)
e.getEntity().setFireTicks(0);
if (projectile)
@ -908,7 +908,7 @@ public class IslandGuard implements Listener {
if (DEBUG)
plugin.getLogger().info("DEBUG: Mobs not allowed to be hurt. Blocking");
// Else not allowed
Util.sendMessage(attacker, ChatColor.RED + plugin.getLocale(attacker.getUniqueId()).get("island.protected"));
Util.sendMessage(attacker, plugin.getLocale(attacker.getUniqueId()).get("island.protected"));
if (flamingArrow)
e.getEntity().setFireTicks(0);
if (projectile)
@ -927,7 +927,7 @@ public class IslandGuard implements Listener {
// Players being hurt PvP
if (e.getEntity() instanceof Player) {
if (!pvp) {
Util.sendMessage(attacker, ChatColor.RED + plugin.getLocale(attacker.getUniqueId()).get("targetInPVPArea"));
Util.sendMessage(attacker, plugin.getLocale(attacker.getUniqueId()).get("targetInPVPArea"));
if (flamingArrow)
e.getEntity().setFireTicks(0);
if (projectile)
@ -967,7 +967,7 @@ public class IslandGuard implements Listener {
// Outside of island protection zone
if (island == null) {
if (!Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
return;
@ -989,7 +989,7 @@ public class IslandGuard implements Listener {
int count = island.getTileEntityCount(e.getBlock().getType(),e.getBlock().getWorld());
//plugin.getLogger().info("DEBUG: count is "+ count);
if (Settings.limitedBlocks.get(type) <= count) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + (plugin.getLocale(e.getPlayer().getUniqueId()).get("moblimits.entity").replace("[entity]",
Util.sendMessage(e.getPlayer(), (plugin.getLocale(e.getPlayer().getUniqueId()).get("moblimits.entity").replace("[entity]",
Util.prettifyText(type))).replace("[number]", String.valueOf(Settings.limitedBlocks.get(type))));
e.setCancelled(true);
}
@ -997,7 +997,7 @@ public class IslandGuard implements Listener {
}
} else {
// Visitor
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
@ -1026,7 +1026,7 @@ public class IslandGuard implements Listener {
Island island = plugin.getIslands().getProtectedIslandAt(e.getBlock().getLocation());
if (island == null) {
if (!Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
return;
@ -1048,7 +1048,7 @@ public class IslandGuard implements Listener {
if (Settings.limitedBlocks.containsKey(type) && Settings.limitedBlocks.get(type) > -1) {
int count = island.getTileEntityCount(e.getBlock().getType(),e.getBlock().getWorld());
if (Settings.limitedBlocks.get(type) <= count) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + (plugin.getLocale(e.getPlayer().getUniqueId()).get("moblimits.entity").replace("[entity]",
Util.sendMessage(e.getPlayer(), (plugin.getLocale(e.getPlayer().getUniqueId()).get("moblimits.entity").replace("[entity]",
Util.prettifyText(type))).replace("[number]", String.valueOf(Settings.limitedBlocks.get(type))));
e.setCancelled(true);
return;
@ -1058,7 +1058,7 @@ public class IslandGuard implements Listener {
return;
}
// Outside of protection area or visitor
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
@ -1077,7 +1077,7 @@ public class IslandGuard implements Listener {
if (Util.inWorld(e.getPlayer())) {
if (e.getEntity() != null && e.getEntity().getType().equals(EntityType.LEASH_HITCH)) {
if (!actionAllowed(e.getPlayer(), e.getBlock().getLocation(), SettingsFlag.LEASH)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
@ -1105,7 +1105,7 @@ public class IslandGuard implements Listener {
// Outside of island protection zone
if (island == null) {
if (!Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
return;
@ -1119,7 +1119,7 @@ public class IslandGuard implements Listener {
// Convert from EntityType to Material via string - ugh
int count = island.getTileEntityCount(Material.valueOf(type),e.getEntity().getWorld());
if (Settings.limitedBlocks.get(type) <= count) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + (plugin.getLocale(e.getPlayer().getUniqueId()).get("moblimits.entity").replace("[entity]",
Util.sendMessage(e.getPlayer(), (plugin.getLocale(e.getPlayer().getUniqueId()).get("moblimits.entity").replace("[entity]",
Util.prettifyText(type))).replace("[number]", String.valueOf(Settings.limitedBlocks.get(type))));
e.setCancelled(true);
}
@ -1127,7 +1127,7 @@ public class IslandGuard implements Listener {
}
} else {
// Visitor
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
@ -1145,7 +1145,7 @@ public class IslandGuard implements Listener {
return;
}
// Not allowed
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
@ -1198,7 +1198,7 @@ public class IslandGuard implements Listener {
return;
}
// Not allowed
Util.sendMessage(p, ChatColor.RED + plugin.getLocale(p.getUniqueId()).get("island.protected"));
Util.sendMessage(p, plugin.getLocale(p.getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
@ -1220,7 +1220,7 @@ public class IslandGuard implements Listener {
if (actionAllowed(player, e.getEntity().getLocation(),SettingsFlag.LEASH)) {
return;
}
Util.sendMessage(player, ChatColor.RED + plugin.getLocale(player.getUniqueId()).get("island.protected"));
Util.sendMessage(player, plugin.getLocale(player.getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
@ -1243,7 +1243,7 @@ public class IslandGuard implements Listener {
if (actionAllowed(player, e.getEntity().getLocation(),SettingsFlag.LEASH)) {
return;
}
Util.sendMessage(player, ChatColor.RED + plugin.getLocale(player.getUniqueId()).get("island.protected"));
Util.sendMessage(player, plugin.getLocale(player.getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
@ -1317,7 +1317,7 @@ public class IslandGuard implements Listener {
e.setCancelled(true);
e.getPlayer().getItemInHand().setType(Material.BUCKET);
e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.valueOf("FIZZ"), 1F, 2F);
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("biome.set").replace("[biome]", "Nether"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("biome.set").replace("[biome]", "Nether"));
}
} else {
if (Util.playerIsHolding(e.getPlayer(), Material.WATER_BUCKET)) {
@ -1328,14 +1328,14 @@ public class IslandGuard implements Listener {
e.getPlayer().getInventory().setItemInOffHand(new ItemStack(Material.BUCKET));
}
e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.ENTITY_CREEPER_PRIMED, 1F, 2F);
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("biome.set").replace("[biome]", "Nether"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("biome.set").replace("[biome]", "Nether"));
}
}
}
return;
}
// Not allowed
Util.sendMessage(p, ChatColor.RED + plugin.getLocale(p.getUniqueId()).get("island.protected"));
Util.sendMessage(p, plugin.getLocale(p.getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
@ -1400,7 +1400,7 @@ public class IslandGuard implements Listener {
}
}
// Not allowed
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
@ -1416,7 +1416,7 @@ public class IslandGuard implements Listener {
return;
}
// Not allowed
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
@ -1479,7 +1479,7 @@ public class IslandGuard implements Listener {
plugin.getLogger().info("DEBUG: fire found");
if (island != null) {
if (!island.getFlag(SettingsFlag.FIRE_EXTINGUISH)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1489,7 +1489,7 @@ public class IslandGuard implements Listener {
plugin.getLogger().info("DEBUG: extinguishing is allowed");
continue;
} else {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1507,11 +1507,11 @@ public class IslandGuard implements Listener {
if (e.getClickedBlock().getType().toString().contains("SHULKER_BOX")) {
if (island == null) {
if (!Settings.defaultWorldSettings.get(SettingsFlag.OPEN_CHESTS)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
} else if (!island.getFlag(SettingsFlag.OPEN_CHESTS)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
return;
@ -1520,11 +1520,11 @@ public class IslandGuard implements Listener {
if (e.getMaterial() != null && e.getMaterial().equals(Material.FIREWORK)) {
if (island == null) {
if (!Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
} else if (!island.getFlag(SettingsFlag.PLACE_BLOCKS)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
return;
@ -1543,13 +1543,13 @@ public class IslandGuard implements Listener {
if (Settings.defaultWorldSettings.get(SettingsFlag.DOOR)) {
return;
} else {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
}
if (!island.getFlag(SettingsFlag.DOOR)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1564,13 +1564,13 @@ public class IslandGuard implements Listener {
if (Settings.defaultWorldSettings.get(SettingsFlag.GATE)) {
return;
} else {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
}
if (!island.getFlag(SettingsFlag.GATE)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1588,13 +1588,13 @@ public class IslandGuard implements Listener {
if (Settings.defaultWorldSettings.get(SettingsFlag.OPEN_CHESTS)) {
return;
} else {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
}
if (!island.getFlag(SettingsFlag.OPEN_CHESTS)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1604,13 +1604,13 @@ public class IslandGuard implements Listener {
if (Settings.defaultWorldSettings.get(SettingsFlag.CROP_TRAMPLE)) {
return;
} else {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
}
if (!island.getFlag(SettingsFlag.CROP_TRAMPLE)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1621,13 +1621,13 @@ public class IslandGuard implements Listener {
if (Settings.defaultWorldSettings.get(SettingsFlag.BREWING)) {
return;
} else {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
}
if (!island.getFlag(SettingsFlag.BREWING)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1643,13 +1643,13 @@ public class IslandGuard implements Listener {
if (Settings.defaultWorldSettings.get(SettingsFlag.REDSTONE)) {
return;
} else {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
}
if (!island.getFlag(SettingsFlag.REDSTONE)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1659,13 +1659,13 @@ public class IslandGuard implements Listener {
if (Settings.defaultWorldSettings.get(SettingsFlag.ENCHANTING)) {
return;
} else {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
}
if (!island.getFlag(SettingsFlag.ENCHANTING)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1676,13 +1676,13 @@ public class IslandGuard implements Listener {
if (Settings.defaultWorldSettings.get(SettingsFlag.FURNACE)) {
return;
} else {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
}
if (!island.getFlag(SettingsFlag.FURNACE)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1703,7 +1703,7 @@ public class IslandGuard implements Listener {
} else {
if (DEBUG)
plugin.getLogger().info("DEBUG: Jukebox not allowed");
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1711,7 +1711,7 @@ public class IslandGuard implements Listener {
if (!island.getFlag(SettingsFlag.MUSIC)) {
if (DEBUG)
plugin.getLogger().info("DEBUG: Jukebox not allowed");
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1726,13 +1726,13 @@ public class IslandGuard implements Listener {
if (Settings.defaultWorldSettings.get(SettingsFlag.LEVER)) {
return;
} else {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
}
if (!island.getFlag(SettingsFlag.LEVER)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1744,13 +1744,13 @@ public class IslandGuard implements Listener {
if (Settings.defaultWorldSettings.get(SettingsFlag.CRAFTING)) {
return;
} else {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
}
if (!island.getFlag(SettingsFlag.CRAFTING)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1760,13 +1760,13 @@ public class IslandGuard implements Listener {
if (Settings.defaultWorldSettings.get(SettingsFlag.ANVIL)) {
return;
} else {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
}
if (!island.getFlag(SettingsFlag.ANVIL)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1778,7 +1778,7 @@ public class IslandGuard implements Listener {
// If they are not on an island, it's protected
if (island == null) {
if (!Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
return;
@ -1787,7 +1787,7 @@ public class IslandGuard implements Listener {
if (e.getMaterial() == Material.MINECART || e.getMaterial() == Material.STORAGE_MINECART || e.getMaterial() == Material.HOPPER_MINECART
|| e.getMaterial() == Material.EXPLOSIVE_MINECART || e.getMaterial() == Material.POWERED_MINECART) {
e.setCancelled(true);
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.getPlayer().updateInventory();
return;
}
@ -1797,13 +1797,13 @@ public class IslandGuard implements Listener {
if (Settings.defaultWorldSettings.get(SettingsFlag.BEACON)) {
return;
} else {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
}
if (!island.getFlag(SettingsFlag.BEACON)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1813,14 +1813,14 @@ public class IslandGuard implements Listener {
if (Settings.defaultWorldSettings.get(SettingsFlag.BREAK_BLOCKS)) {
return;
} else {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.getPlayer().setFoodLevel(e.getPlayer().getFoodLevel() - 2);
e.setCancelled(true);
return;
}
}
if (!island.getFlag(SettingsFlag.BREAK_BLOCKS)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.getPlayer().setFoodLevel(e.getPlayer().getFoodLevel() - 2);
e.setCancelled(true);
return;
@ -1831,13 +1831,13 @@ public class IslandGuard implements Listener {
if (Settings.defaultWorldSettings.get(SettingsFlag.BREAK_BLOCKS)) {
return;
} else {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
}
if (!island.getFlag(SettingsFlag.BREAK_BLOCKS)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1847,13 +1847,13 @@ public class IslandGuard implements Listener {
if (Settings.defaultWorldSettings.get(SettingsFlag.BREAK_BLOCKS)) {
return;
} else {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
}
if (!island.getFlag(SettingsFlag.BREAK_BLOCKS)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1861,7 +1861,7 @@ public class IslandGuard implements Listener {
case BED_BLOCK:
if (e.getPlayer().getWorld().getEnvironment().equals(Environment.NETHER)) {
// Prevent explosions
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -1881,7 +1881,7 @@ public class IslandGuard implements Listener {
|| e.getMaterial() == Material.TRAPPED_CHEST || e.getMaterial() == Material.IRON_DOOR) {
if ((island == null && Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS))
|| (island !=null && !island.getFlag(SettingsFlag.PLACE_BLOCKS))) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
e.getPlayer().updateInventory();
}
@ -1889,13 +1889,13 @@ public class IslandGuard implements Listener {
// Trying to put a boat on non-liquid
if ((island == null && Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS))
|| (island !=null && !island.getFlag(SettingsFlag.PLACE_BLOCKS))) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
} else if (e.getMaterial().equals(Material.ENDER_PEARL)) {
if ((island == null && Settings.defaultWorldSettings.get(SettingsFlag.THROW_ENDERPEARLS))
|| (island !=null && !island.getFlag(SettingsFlag.THROW_ENDERPEARLS))) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
} else if (e.getMaterial().equals(Material.FLINT_AND_STEEL)) {
@ -1906,7 +1906,7 @@ public class IslandGuard implements Listener {
//return;
}
if (!actionAllowed(e.getPlayer(), e.getClickedBlock().getLocation(), SettingsFlag.FIRE)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
@ -1914,7 +1914,7 @@ public class IslandGuard implements Listener {
if (DEBUG)
plugin.getLogger().info("DEBUG: allowMonsterEggs = " + island.getFlag(SettingsFlag.SPAWN_EGGS));
if (!actionAllowed(e.getPlayer(),e.getClickedBlock().getLocation(),SettingsFlag.SPAWN_EGGS)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
} else if (e.getMaterial().equals(Material.POTION) && e.getItem().getDurability() != 0) {
@ -1940,7 +1940,7 @@ public class IslandGuard implements Listener {
}
}
// Not allowed
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
} catch (Exception ex) {
@ -1964,7 +1964,7 @@ public class IslandGuard implements Listener {
if (Util.inWorld(player) || player.getWorld().equals(IslandWorld.getNetherWorld())) {
if (event.getRecipe().getResult().getType() == Material.ENDER_CHEST) {
if (!(player.hasPermission(Settings.PERMPREFIX + "craft.enderchest"))) {
Util.sendMessage(player, ChatColor.RED + plugin.getLocale(player.getUniqueId()).get("general.errors.no-permission"));
Util.sendMessage(player, plugin.getLocale(player.getUniqueId()).get("general.errors.no-permission"));
event.setCancelled(true);
}
}
@ -1987,7 +1987,7 @@ public class IslandGuard implements Listener {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (event.getClickedBlock().getType() == Material.ENDER_CHEST) {
if (!(event.getPlayer().hasPermission(Settings.PERMPREFIX + "craft.enderchest"))) {
Util.sendMessage(player, ChatColor.RED + plugin.getLocale(player.getUniqueId()).get("general.errors.no-permission"));
Util.sendMessage(player, plugin.getLocale(player.getUniqueId()).get("general.errors.no-permission"));
event.setCancelled(true);
}
}
@ -2032,7 +2032,7 @@ public class IslandGuard implements Listener {
plugin.getLogger().info("DEBUG: villager trading is " + island.getFlag(SettingsFlag.VILLAGER_TRADING));
}
if ((!island.getFlag(SettingsFlag.VILLAGER_TRADING) && !island.getMembers().contains(p.getUniqueId()))) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -2040,7 +2040,7 @@ public class IslandGuard implements Listener {
}
// Handle name tags and dyes
if (Util.playerIsHolding(p, Material.NAME_TAG) || Util.playerIsHolding(p, Material.INK_SACK)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
e.getPlayer().updateInventory();
return;
@ -2048,13 +2048,13 @@ public class IslandGuard implements Listener {
// Handle cookies (to animals)
if (Util.playerIsHolding(p, Material.COOKIE) && e.getRightClicked() instanceof Animals) {
if (island == null && !Settings.defaultWorldSettings.get(SettingsFlag.HURT_ANIMALS)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
if (island != null) {
if ((!island.getFlag(SettingsFlag.HURT_ANIMALS) && !island.getMembers().contains(p.getUniqueId()))) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -2066,13 +2066,13 @@ public class IslandGuard implements Listener {
Material type = item.getType();
if (type == Material.EGG || type == Material.WHEAT || type == Material.CARROT_ITEM || type == Material.SEEDS) {
if (island == null && !Settings.defaultWorldSettings.get(SettingsFlag.BREEDING)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
if (island != null) {
if ((!island.getFlag(SettingsFlag.BREEDING) && !island.getMembers().contains(p.getUniqueId()))) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -2103,23 +2103,23 @@ public class IslandGuard implements Listener {
case HORSE:
//plugin.getLogger().info("Horse riding");
if (island == null && !Settings.defaultWorldSettings.get(SettingsFlag.MOUNT_RIDING)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
if (island != null && !island.getFlag(SettingsFlag.MOUNT_RIDING)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
break;
case ITEM_FRAME:
// This is to place items in an item frame
if (island == null && !Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
if (island != null) {
if (!island.getFlag(SettingsFlag.PLACE_BLOCKS)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
@ -2129,12 +2129,12 @@ public class IslandGuard implements Listener {
case MINECART_HOPPER:
//plugin.getLogger().info("Minecarts");
if (island == null && !Settings.defaultWorldSettings.get(SettingsFlag.OPEN_CHESTS)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
if (island != null) {
if (!island.getFlag(SettingsFlag.OPEN_CHESTS)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
@ -2299,7 +2299,7 @@ public class IslandGuard implements Listener {
// Block action
UUID playerUUID = e.getPlayer().getUniqueId();
if (!onPlate.containsKey(playerUUID)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(playerUUID).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(playerUUID).get("island.protected"));
Vector v = e.getPlayer().getLocation().toVector();
onPlate.put(playerUUID, new Vector(v.getBlockX(), v.getBlockY(), v.getBlockZ()));
}
@ -2366,7 +2366,7 @@ public class IslandGuard implements Listener {
}
if (!island.getFlag(SettingsFlag.THROW_EGGS)) {
e.setHatching(false);
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
//e.getPlayer().updateInventory();
}
}
@ -2449,7 +2449,7 @@ public class IslandGuard implements Listener {
// Only say it once a second
// Debounce event (it can be called twice for the same action)
if (!tntBlocks.contains(e.getBlock().getLocation())) {
Util.sendMessage(shooter, ChatColor.RED + plugin.getLocale(shooter.getUniqueId()).get("island.protected"));
Util.sendMessage(shooter, plugin.getLocale(shooter.getUniqueId()).get("island.protected"));
tntBlocks.add(e.getBlock().getLocation());
plugin.getServer().getScheduler().runTaskLater(plugin, () -> tntBlocks.remove(e.getBlock().getLocation()), 20L);
}
@ -2555,7 +2555,7 @@ public class IslandGuard implements Listener {
continue;
}
// Not allowed
Util.sendMessage(attacker, ChatColor.RED + plugin.getLocale(attacker.getUniqueId()).get("island.protected"));
Util.sendMessage(attacker, plugin.getLocale(attacker.getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -2568,7 +2568,7 @@ public class IslandGuard implements Listener {
}
if (DEBUG)
plugin.getLogger().info("DEBUG: Mobs not allowed to be hurt. Blocking");
Util.sendMessage(attacker, ChatColor.RED + plugin.getLocale(attacker.getUniqueId()).get("island.protected"));
Util.sendMessage(attacker, plugin.getLocale(attacker.getUniqueId()).get("island.protected"));
e.setCancelled(true);
return;
}
@ -2584,7 +2584,7 @@ public class IslandGuard implements Listener {
if (entity instanceof Player) {
if (!pvp) {
if (DEBUG) plugin.getLogger().info("DEBUG: PVP not allowed");
Util.sendMessage(attacker, ChatColor.RED + plugin.getLocale(attacker.getUniqueId()).get("targetInPVPArea"));
Util.sendMessage(attacker, plugin.getLocale(attacker.getUniqueId()).get("targetInPVPArea"));
e.setCancelled(true);
return;
}

View File

@ -79,7 +79,7 @@ public class IslandGuard1_8 implements Listener {
return;
}
e.setCancelled(true);
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
}
}
@ -156,7 +156,7 @@ public class IslandGuard1_8 implements Listener {
int count = island.getTileEntityCount(Material.ARMOR_STAND,e.getPlayer().getWorld());
//plugin.getLogger().info("1.8 " + "DEBUG: count is " + count + " limit is " + Settings.limitedBlocks.get("ARMOR_STAND"));
if (Settings.limitedBlocks.get("ARMOR_STAND") <= count) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + (plugin.getLocale(e.getPlayer().getUniqueId()).get("moblimits.entity").replace("[entity]",
Util.sendMessage(e.getPlayer(), (plugin.getLocale(e.getPlayer().getUniqueId()).get("moblimits.entity").replace("[entity]",
Util.prettifyText(Material.ARMOR_STAND.toString()))).replace("[number]", String.valueOf(Settings.limitedBlocks.get("ARMOR_STAND"))));
e.setCancelled(true);
return;
@ -166,7 +166,7 @@ public class IslandGuard1_8 implements Listener {
}
// plugin.getLogger().info("1.8 " + "DEBUG: stand place cancelled");
e.setCancelled(true);
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.getPlayer().updateInventory();
}
}
@ -204,7 +204,7 @@ public class IslandGuard1_8 implements Listener {
if (island != null && island.getFlag(SettingsFlag.BREAK_BLOCKS)) {
return;
}
Util.sendMessage(p, ChatColor.RED + plugin.getLocale(p.getUniqueId()).get("island.protected"));
Util.sendMessage(p, plugin.getLocale(p.getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}

View File

@ -126,7 +126,7 @@ public class IslandGuard1_9 implements Listener {
}
}
e.setCancelled(true);
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
}
}
@ -161,7 +161,7 @@ public class IslandGuard1_9 implements Listener {
int count = island.getTileEntityCount(Material.END_CRYSTAL,e.getPlayer().getWorld());
//plugin.getLogger().info("1.9 " +"DEBUG: count is " + count + " limit is " + Settings.limitedBlocks.get("ARMOR_STAND"));
if (Settings.limitedBlocks.get("END_CRYSTAL") <= count) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + (plugin.getLocale(e.getPlayer().getUniqueId()).get("moblimits.entity").replace("[entity]",
Util.sendMessage(e.getPlayer(), (plugin.getLocale(e.getPlayer().getUniqueId()).get("moblimits.entity").replace("[entity]",
Util.prettifyText(Material.END_CRYSTAL.toString()))).replace("[number]", String.valueOf(Settings.limitedBlocks.get("END_CRYSTAL"))));
e.setCancelled(true);
return;
@ -171,7 +171,7 @@ public class IslandGuard1_9 implements Listener {
}
// plugin.getLogger().info("1.9 " +"DEBUG: stand place cancelled");
e.setCancelled(true);
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.getPlayer().updateInventory();
}
}
@ -242,7 +242,7 @@ public class IslandGuard1_9 implements Listener {
}
return;
}
Util.sendMessage(p, ChatColor.RED + plugin.getLocale(p.getUniqueId()).get("island.protected"));
Util.sendMessage(p, plugin.getLocale(p.getUniqueId()).get("island.protected"));
e.setCancelled(true);
}

View File

@ -91,7 +91,7 @@ public class VisitorGuard implements Listener {
|| plugin.getIslands().locationIsOnIsland(e.getPlayer(), e.getItemDrop().getLocation())) {
return;
}
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
@ -114,7 +114,7 @@ public class VisitorGuard implements Listener {
//plugin.getLogger().info(Settings.visitorCommandBlockList.toString());
String[] args = e.getMessage().substring(1).toLowerCase().split(" ");
if (Settings.visitorBannedCommands.contains(args[0])) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}

View File

@ -233,7 +233,7 @@ public class SafeSpotTeleport {
if (!failureMessage.isEmpty()) {
Util.sendMessage(entity, failureMessage);
} else {
Util.sendMessage(entity, ChatColor.RED + "Warp not safe");
Util.sendMessage(entity, "Warp not safe");
}
}
});