Merge pull request #43 from VideoGameSmash12/development

Consistency fixes (across 46 commands), additional CoreProtect integration (/dispfill and /setlever), and a critical bugfix (/setlever) (FS-162)
This commit is contained in:
Ryan 2021-04-10 12:56:32 +01:00 committed by GitHub
commit 09930c2d9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 111 additions and 99 deletions

View File

@ -246,7 +246,7 @@ public class LoginProcess extends FreedomService
FLog.info(noteMessage); FLog.info(noteMessage);
for (Player p : server.getOnlinePlayers()) for (Player p : server.getOnlinePlayers())
{ {
if (plugin.al.isAdminImpostor(p)) if (plugin.al.isAdmin(p))
{ {
notice.send(p); notice.send(p);
} }

View File

@ -137,7 +137,7 @@ public class Command_adminworld extends FreedomCommand
{ {
return noPerms(); return noPerms();
} }
sender.sendMessage(ex.getMessage()); msg(ex.getMessage());
return true; return true;
} }

View File

@ -19,7 +19,7 @@ public class Command_adventure extends FreedomCommand
{ {
if (isConsole()) if (isConsole())
{ {
sender.sendMessage("When used from the console, you must define a target player."); msg("When used from the console, you must define a target player.");
return true; return true;
} }
@ -46,7 +46,7 @@ public class Command_adventure extends FreedomCommand
if (player == null) if (player == null)
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }

View File

@ -72,8 +72,8 @@ public class Command_banip extends FreedomCommand
{ {
// Broadcast // Broadcast
FLog.info(ChatColor.RED + sender.getName() + " - Banned the IP " + ip); FLog.info(ChatColor.RED + sender.getName() + " - Banned the IP " + ip);
String message = ChatColor.RED + sender.getName() + " - Banned " + (plugin.al.isAdmin(player) ? "the IP " + ip : "an IP"); String message = sender.getName() + " - Banned " + (plugin.al.isAdmin(player) ? "the IP " + ip : "an IP");
player.sendMessage(message); msg(player, message, ChatColor.RED);
} }
} }

View File

@ -92,7 +92,7 @@ public class Command_blockedit extends FreedomCommand
final Player player2 = getPlayer(args[0]); final Player player2 = getPlayer(args[0]);
if (player2 == null) if (player2 == null)
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }

View File

@ -93,7 +93,7 @@ public class Command_blockpvp extends FreedomCommand
final Player p = getPlayer(args[0]); final Player p = getPlayer(args[0]);
if (p == null) if (p == null)
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }

View File

@ -42,14 +42,14 @@ public class Command_cage extends FreedomCommand
Player player = getPlayer(args[0]); Player player = getPlayer(args[0]);
if (player == null) if (player == null)
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }
final FPlayer fPlayer = plugin.pl.getPlayer(player); final FPlayer fPlayer = plugin.pl.getPlayer(player);
if (fPlayer.getCageData().isCaged()) if (fPlayer.getCageData().isCaged())
{ {
sender.sendMessage(ChatColor.RED + "That player is already caged."); msg("That player is already caged.", ChatColor.RED);
return true; return true;
} }
@ -80,7 +80,7 @@ public class Command_cage extends FreedomCommand
outerMaterial = Material.matchMaterial(args[2]); outerMaterial = Material.matchMaterial(args[2]);
break; break;
} }
sender.sendMessage(ChatColor.RED + "Invalid block!"); msg("Invalid block!", ChatColor.RED);
break; break;
} }
} }

View File

@ -23,7 +23,7 @@ public class Command_cartsit extends FreedomCommand
if (targetPlayer == null) if (targetPlayer == null)
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }
} }
@ -32,7 +32,7 @@ public class Command_cartsit extends FreedomCommand
{ {
if (targetPlayer == null) if (targetPlayer == null)
{ {
sender.sendMessage("When used from the console, you must define a target player: /cartsit <player>"); msg("When used from the console, you must define a target player: /cartsit <player>");
return true; return true;
} }
} }

View File

@ -20,7 +20,7 @@ public class Command_clearchat extends FreedomCommand
{ {
for (int i = 0; i < 100; i++) for (int i = 0; i < 100; i++)
{ {
player.sendMessage(""); msg(player, "");
} }
} }
} }

View File

@ -52,7 +52,7 @@ public class Command_clearinventory extends FreedomCommand
player.getInventory().clear(); player.getInventory().clear();
msg("Cleared " + player.getName() + "'s inventory."); msg("Cleared " + player.getName() + "'s inventory.");
player.sendMessage(sender.getName() + " has cleared your inventory."); msg(player, sender.getName() + " has cleared your inventory.");
} }
} }
else else

View File

@ -43,7 +43,7 @@ public class Command_commandlist extends FreedomCommand
Collections.sort(commands); Collections.sort(commands);
sender.sendMessage(StringUtils.join(commands, ", ")); msg(StringUtils.join(commands, ", "));
return true; return true;
} }

View File

@ -19,7 +19,7 @@ public class Command_creative extends FreedomCommand
{ {
if (isConsole()) if (isConsole())
{ {
sender.sendMessage("When used from the console, you must define a target player."); msg("When used from the console, you must define a target player.");
return true; return true;
} }
@ -46,7 +46,7 @@ public class Command_creative extends FreedomCommand
if (player == null) if (player == null)
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }

View File

@ -39,7 +39,7 @@ public class Command_deop extends FreedomCommand
{ {
matchedPlayerNames.add(player.getName()); matchedPlayerNames.add(player.getName());
player.setOp(false); player.setOp(false);
player.sendMessage(FreedomCommand.YOU_ARE_NOT_OP); msg(player, YOU_ARE_NOT_OP);
plugin.rm.updateDisplay(player); plugin.rm.updateDisplay(player);
} }
} }

View File

@ -19,7 +19,7 @@ public class Command_deopall extends FreedomCommand
for (Player player : server.getOnlinePlayers()) for (Player player : server.getOnlinePlayers())
{ {
player.setOp(false); player.setOp(false);
player.sendMessage(FreedomCommand.YOU_ARE_NOT_OP); msg(player, YOU_ARE_NOT_OP);
plugin.rm.updateDisplay(player); plugin.rm.updateDisplay(player);
} }

View File

@ -43,7 +43,7 @@ public class Command_dispfill extends FreedomCommand
} }
catch (NumberFormatException ex) catch (NumberFormatException ex)
{ {
sender.sendMessage("Invalid radius."); msg("Invalid radius.");
return true; return true;
} }
@ -60,7 +60,7 @@ public class Command_dispfill extends FreedomCommand
} }
else else
{ {
sender.sendMessage("Skipping invalid item: " + searchItem); msg("Skipping invalid item: " + searchItem);
} }
} }
@ -80,7 +80,8 @@ public class Command_dispfill extends FreedomCommand
{ {
if (targetBlock.getType().equals(Material.DISPENSER)) if (targetBlock.getType().equals(Material.DISPENSER))
{ {
sender.sendMessage("Filling dispenser @ " + FUtil.formatLocation(targetBlock.getLocation())); msg("Filling dispenser @ " + FUtil.formatLocation(targetBlock.getLocation()));
plugin.cpb.getCoreProtectAPI().logContainerTransaction(sender.getName(), targetBlock.getLocation());
setDispenserContents(targetBlock, itemsArray); setDispenserContents(targetBlock, itemsArray);
affected++; affected++;
} }
@ -89,7 +90,7 @@ public class Command_dispfill extends FreedomCommand
} }
} }
sender.sendMessage("Done. " + affected + " dispenser(s) filled."); msg("Done. " + affected + " dispenser(s) filled.");
} }
else else
{ {

View File

@ -36,7 +36,7 @@ public class Command_doom extends FreedomCommand
if (player == null) if (player == null)
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }

View File

@ -23,7 +23,7 @@ public class Command_gcmd extends FreedomCommand
if (player == null) if (player == null)
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }

View File

@ -138,7 +138,7 @@ public class Command_hubworld extends FreedomCommand
{ {
return noPerms(); return noPerms();
} }
sender.sendMessage(ex.getMessage()); msg(ex.getMessage());
return true; return true;
} }

View File

@ -39,7 +39,7 @@ public class Command_inspect extends FreedomCommand
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
sender.sendMessage(ChatColor.RED + "Invalid number"); msg("Invalid number", ChatColor.RED);
} }
} }
@ -48,19 +48,19 @@ public class Command_inspect extends FreedomCommand
{ {
if (pageIndex < 1 || pageIndex > paged.getPageCount()) if (pageIndex < 1 || pageIndex > paged.getPageCount())
{ {
sender.sendMessage(ChatColor.RED + "Not a valid page number"); msg("Not a valid page number", ChatColor.RED);
return true; return true;
} }
sender.sendMessage("---- " + net.md_5.bungee.api.ChatColor.of("#30ade4") + "Block Inspector" + ChatColor.WHITE + " ---- "); msg("---- " + net.md_5.bungee.api.ChatColor.of("#30ade4") + "Block Inspector" + ChatColor.WHITE + " ---- ", ChatColor.WHITE);
List<String> page = paged.getPage(pageIndex); List<String> page = paged.getPage(pageIndex);
for (String entries : page) for (String entries : page)
{ {
sender.sendMessage(entries); msg(entries);
} }
sender.sendMessage("Page " + pageIndex + "/" + paged.getPageCount() + " | To index through the pages, type " + net.md_5.bungee.api.ChatColor.of("#30ade4") + "/ins history <page>"); msg("Page " + pageIndex + "/" + paged.getPageCount() + " | To index through the pages, type " + net.md_5.bungee.api.ChatColor.of("#30ade4") + "/ins history <page>", ChatColor.WHITE);
return true; return true;
} }
} }

View File

@ -141,13 +141,13 @@ public class Command_list extends FreedomCommand
.append(StringUtils.join(n, ChatColor.WHITE + ", ")); .append(StringUtils.join(n, ChatColor.WHITE + ", "));
if (senderIsConsole) if (senderIsConsole)
{ {
sender.sendMessage(ChatColor.stripColor(onlineStats.toString())); msg(ChatColor.stripColor(onlineStats.toString()));
sender.sendMessage(ChatColor.stripColor(onlineUsers.toString())); msg(ChatColor.stripColor(onlineUsers.toString()));
} }
else else
{ {
sender.sendMessage(onlineStats.toString()); msg(onlineStats.toString());
sender.sendMessage(onlineUsers.toString()); msg(onlineUsers.toString());
} }
n.clear(); n.clear();
return true; return true;

View File

@ -53,7 +53,7 @@ public class Command_lockup extends FreedomCommand
if (player == null) if (player == null)
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }
@ -70,7 +70,7 @@ public class Command_lockup extends FreedomCommand
if (player == null) if (player == null)
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }

View File

@ -54,7 +54,7 @@ public class Command_manageshop extends FreedomCommand
Player player = getPlayer(args[3]); Player player = getPlayer(args[3]);
if (player != null) if (player != null)
{ {
player.sendMessage(ChatColor.GREEN + sender.getName() + " gave you " + amount + " coins. Your new balance is " + playerData.getCoins()); msg(player, sender.getName() + " gave you " + amount + " coins. Your new balance is " + playerData.getCoins(), ChatColor.GREEN);
} }
} }
else else
@ -64,7 +64,7 @@ public class Command_manageshop extends FreedomCommand
PlayerData playerData = plugin.pl.getData(player); PlayerData playerData = plugin.pl.getData(player);
playerData.setCoins(playerData.getCoins() + amount); playerData.setCoins(playerData.getCoins() + amount);
plugin.pl.save(playerData); plugin.pl.save(playerData);
player.sendMessage(ChatColor.GREEN + sender.getName() + " gave you " + amount + " coins. Your new balance is " + playerData.getCoins()); msg(player, sender.getName() + " gave you " + amount + " coins. Your new balance is " + playerData.getCoins(), ChatColor.GREEN);
} }
msg("Successfully added " + amount + " coins to all online players.", ChatColor.GREEN); msg("Successfully added " + amount + " coins to all online players.", ChatColor.GREEN);
} }
@ -97,7 +97,7 @@ public class Command_manageshop extends FreedomCommand
Player player = getPlayer(args[3]); Player player = getPlayer(args[3]);
if (player != null) if (player != null)
{ {
player.sendMessage(ChatColor.RED + sender.getName() + " took " + amount + " coins from you. Your new balance is " + playerData.getCoins()); msg(player, sender.getName() + " took " + amount + " coins from you. Your new balance is " + playerData.getCoins(), ChatColor.RED);
} }
} }
else else
@ -111,7 +111,7 @@ public class Command_manageshop extends FreedomCommand
playerData.setCoins(0); playerData.setCoins(0);
} }
plugin.pl.save(playerData); plugin.pl.save(playerData);
player.sendMessage(ChatColor.RED + sender.getName() + " took " + amount + " coins from you. Your new balance is " + playerData.getCoins()); msg(player, sender.getName() + " took " + amount + " coins from you. Your new balance is " + playerData.getCoins(), ChatColor.RED);
} }
msg("Successfully took " + amount + " coins from all online players.", ChatColor.GREEN); msg("Successfully took " + amount + " coins from all online players.", ChatColor.GREEN);
} }
@ -138,7 +138,7 @@ public class Command_manageshop extends FreedomCommand
Player player = getPlayer(args[3]); Player player = getPlayer(args[3]);
if (player != null) if (player != null)
{ {
player.sendMessage(ChatColor.GREEN + sender.getName() + " set your coin balance to " + amount); msg(player, sender.getName() + " set your coin balance to " + amount, ChatColor.GREEN);
} }
return true; return true;
} }
@ -183,7 +183,7 @@ public class Command_manageshop extends FreedomCommand
Player player = getPlayer(args[3]); Player player = getPlayer(args[3]);
if (player != null) if (player != null)
{ {
player.sendMessage(ChatColor.GREEN + sender.getName() + " gave the " + item.getName() + " to you"); msg(player, sender.getName() + " gave the " + item.getName() + " to you", ChatColor.GREEN);
} }
return true; return true;
} }
@ -208,7 +208,7 @@ public class Command_manageshop extends FreedomCommand
Player player = getPlayer(args[3]); Player player = getPlayer(args[3]);
if (player != null) if (player != null)
{ {
player.sendMessage(ChatColor.RED + sender.getName() + " took the " + item.getName() + " from you"); msg(player, sender.getName() + " took the " + item.getName() + " from you", ChatColor.RED);
} }
return true; return true;
} }

View File

@ -48,12 +48,12 @@ public class Command_manuallyverify extends FreedomCommand
FUtil.adminAction(sender.getName(), "Manually verifying player " + player.getName(), false); FUtil.adminAction(sender.getName(), "Manually verifying player " + player.getName(), false);
player.setOp(true); player.setOp(true);
player.sendMessage(YOU_ARE_OP); msg(player, YOU_ARE_OP);
if (plugin.pl.getPlayer(player).getFreezeData().isFrozen()) if (plugin.pl.getPlayer(player).getFreezeData().isFrozen())
{ {
plugin.pl.getPlayer(player).getFreezeData().setFrozen(false); plugin.pl.getPlayer(player).getFreezeData().setFrozen(false);
player.sendMessage(ChatColor.GRAY + "You have been unfrozen."); msg(player, "You have been unfrozen.");
} }
plugin.pl.verify(player, null); plugin.pl.verify(player, null);

View File

@ -138,7 +138,7 @@ public class Command_masterbuilderworld extends FreedomCommand
{ {
return noPerms(); return noPerms();
} }
sender.sendMessage(ex.getMessage()); msg(ex.getMessage());
return true; return true;
} }

View File

@ -129,7 +129,7 @@ public class Command_mbconfig extends FreedomCommand
plugin.pl.verify(player, null); plugin.pl.verify(player, null);
plugin.rm.updateDisplay(player); plugin.rm.updateDisplay(player);
player.setOp(true); player.setOp(true);
player.sendMessage(YOU_ARE_OP); msg(player, YOU_ARE_OP);
} }
} }
else if (!data.isMasterBuilder()) else if (!data.isMasterBuilder())

View File

@ -65,7 +65,7 @@ public class Command_moblimiter extends FreedomCommand
if (ConfigEntry.MOB_LIMITER_ENABLED.getBoolean()) if (ConfigEntry.MOB_LIMITER_ENABLED.getBoolean())
{ {
sender.sendMessage("Moblimiter enabled. Maximum mobcount set to: " + ConfigEntry.MOB_LIMITER_MAX.getInteger() + "."); msg("Moblimiter enabled. Maximum mobcount set to: " + ConfigEntry.MOB_LIMITER_MAX.getInteger() + ".");
msg("Dragon: " + (ConfigEntry.MOB_LIMITER_DISABLE_DRAGON.getBoolean() ? "disabled" : "enabled") + "."); msg("Dragon: " + (ConfigEntry.MOB_LIMITER_DISABLE_DRAGON.getBoolean() ? "disabled" : "enabled") + ".");
msg("Giant: " + (ConfigEntry.MOB_LIMITER_DISABLE_GIANT.getBoolean() ? "disabled" : "enabled") + "."); msg("Giant: " + (ConfigEntry.MOB_LIMITER_DISABLE_GIANT.getBoolean() ? "disabled" : "enabled") + ".");

View File

@ -45,7 +45,7 @@ public class Command_mp44 extends FreedomCommand
{ {
playerdata.disarmMP44(); playerdata.disarmMP44();
sender.sendMessage(ChatColor.GREEN + "mp44 Disarmed."); msg("mp44 Disarmed.", ChatColor.GREEN);
} }
return true; return true;

View File

@ -109,7 +109,7 @@ public class Command_mute extends FreedomCommand
final Player player = getPlayer(args[0]); final Player player = getPlayer(args[0]);
if (player == null) if (player == null)
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }

View File

@ -7,7 +7,6 @@ import java.util.regex.Pattern;
import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.rank.Rank;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -81,7 +80,7 @@ public class Command_nickfilter extends FreedomCommand
if (player == null || !plugin.al.isVanished(player.getName()) && !plugin.al.isAdmin(sender)) if (player == null || !plugin.al.isVanished(player.getName()) && !plugin.al.isAdmin(sender))
{ {
sender.sendMessage(ChatColor.GRAY + "Can't find player by nickname: " + displayName); msg("Can't find player by nickname: " + displayName);
return true; return true;
} }
} }
@ -101,7 +100,7 @@ public class Command_nickfilter extends FreedomCommand
if (!nickMatched) if (!nickMatched)
{ {
sender.sendMessage("No nicknames replaced in command."); msg("No nicknames replaced in command.");
return true; return true;
} }
@ -113,7 +112,7 @@ public class Command_nickfilter extends FreedomCommand
return true; return true;
} }
sender.sendMessage("Sending command: \"" + newCommand + "\"."); msg("Sending command: \"" + newCommand + "\".");
server.dispatchCommand(sender, newCommand); server.dispatchCommand(sender, newCommand);
return true; return true;

View File

@ -40,7 +40,7 @@ public class Command_op extends FreedomCommand
{ {
matchedPlayerNames.add(player.getName()); matchedPlayerNames.add(player.getName());
player.setOp(true); player.setOp(true);
player.sendMessage(FreedomCommand.YOU_ARE_OP); msg(player, YOU_ARE_OP);
plugin.rm.updateDisplay(player); plugin.rm.updateDisplay(player);
} }
} }

View File

@ -21,7 +21,7 @@ public class Command_opall extends FreedomCommand
if (!player.isOp()) if (!player.isOp())
{ {
player.setOp(true); player.setOp(true);
player.sendMessage(FreedomCommand.YOU_ARE_OP); msg(player, YOU_ARE_OP);
plugin.rm.updateDisplay(player); plugin.rm.updateDisplay(player);
} }
} }

View File

@ -16,7 +16,7 @@ public class Command_opme extends FreedomCommand
{ {
FUtil.adminAction(sender.getName(), "Opping " + sender.getName(), false); FUtil.adminAction(sender.getName(), "Opping " + sender.getName(), false);
sender.setOp(true); sender.setOp(true);
sender.sendMessage(FreedomCommand.YOU_ARE_OP); msg(YOU_ARE_OP);
plugin.rm.updateDisplay(playerSender); plugin.rm.updateDisplay(playerSender);
return true; return true;
} }

View File

@ -106,7 +106,7 @@ public class Command_potion extends FreedomCommand
{ {
if (!plugin.al.isAdmin(sender) && !getPlayer(args[4]).equals(getPlayer(sender.getName()))) if (!plugin.al.isAdmin(sender) && !getPlayer(args[4]).equals(getPlayer(sender.getName())))
{ {
sender.sendMessage(ChatColor.RED + "Only admins can apply potion effects to other players."); msg("Only admins can apply potion effects to other players.", ChatColor.RED);
return true; return true;
} }
@ -114,7 +114,7 @@ public class Command_potion extends FreedomCommand
if (target == null || plugin.al.isVanished(target.getName()) && !plugin.al.isAdmin(sender)) if (target == null || plugin.al.isVanished(target.getName()) && !plugin.al.isAdmin(sender))
{ {
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED); msg(PLAYER_NOT_FOUND);
return true; return true;
} }
} }
@ -122,7 +122,7 @@ public class Command_potion extends FreedomCommand
{ {
if (senderIsConsole) if (senderIsConsole)
{ {
sender.sendMessage("You must specify a target player when using this command from the console."); msg("You must specify a target player when using this command from the console.");
return true; return true;
} }
} }
@ -130,7 +130,7 @@ public class Command_potion extends FreedomCommand
PotionEffectType potion_effect_type = PotionEffectType.getByName(args[1]); PotionEffectType potion_effect_type = PotionEffectType.getByName(args[1]);
if (potion_effect_type == null) if (potion_effect_type == null)
{ {
sender.sendMessage(ChatColor.AQUA + "Invalid potion effect type."); msg("Invalid potion effect type.", ChatColor.AQUA);
return true; return true;
} }

View File

@ -39,7 +39,7 @@ public class Command_rank extends FreedomCommand
if (player == null) if (player == null)
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }

View File

@ -52,7 +52,7 @@ public class Command_ride extends FreedomCommand
} }
msg("Request accepted."); msg("Request accepted.");
requester.sendMessage(ChatColor.GRAY + "Your request has been accepted."); msg(requester, "Your request has been accepted.");
if (requester.getWorld() != playerSender.getWorld()) if (requester.getWorld() != playerSender.getWorld())
{ {
@ -80,7 +80,7 @@ public class Command_ride extends FreedomCommand
} }
msg("Request denied."); msg("Request denied.");
RIDE_REQUESTS.remove(playerSender); RIDE_REQUESTS.remove(playerSender);
requester.sendMessage(ChatColor.GRAY + "Your request has been denied."); msg(requester, "Your request has been denied.");
return true; return true;
} }
@ -123,10 +123,10 @@ public class Command_ride extends FreedomCommand
if (playerData.getRideMode().equals("ask") && !FUtil.isExecutive(playerSender.getName())) if (playerData.getRideMode().equals("ask") && !FUtil.isExecutive(playerSender.getName()))
{ {
msg("Sent a request to the player.", ChatColor.GREEN); msg("Sent a request to the player.", ChatColor.GREEN);
player.sendMessage(ChatColor.AQUA + sender.getName() + " has requested to ride you."); msg(player, sender.getName() + " has requested to ride you.", ChatColor.AQUA);
player.sendMessage(ChatColor.AQUA + "Type " + ChatColor.GREEN + "/ride accept" + ChatColor.AQUA + " to allow the player to ride you."); msg(player, "Type " + ChatColor.GREEN + "/ride accept" + ChatColor.AQUA + " to allow the player to ride you.", ChatColor.AQUA);
player.sendMessage(ChatColor.AQUA + "Type " + ChatColor.RED + "/ride deny" + ChatColor.AQUA + " to deny the player permission."); msg(player, "Type " + ChatColor.RED + "/ride deny" + ChatColor.AQUA + " to deny the player permission.", ChatColor.AQUA);
player.sendMessage(ChatColor.AQUA + "Request will expire in 30 seconds."); msg(player, "Request will expire in 30 seconds.", ChatColor.AQUA);
RIDE_REQUESTS.put(player, playerSender); RIDE_REQUESTS.put(player, playerSender);
new BukkitRunnable() new BukkitRunnable()
@ -139,8 +139,8 @@ public class Command_ride extends FreedomCommand
} }
RIDE_REQUESTS.remove(player); RIDE_REQUESTS.remove(player);
playerSender.sendMessage(ChatColor.RED + "It has been 30 seconds and " + player.getName() + " has not accepted your request."); msg(playerSender, "It has been 30 seconds and " + player.getName() + " has not accepted your request.", ChatColor.RED);
player.sendMessage(ChatColor.RED + "Request expired."); msg(player, "Request expired.", ChatColor.RED);
} }
}.runTaskLater(plugin, 20 * 30); }.runTaskLater(plugin, 20 * 30);
return true; return true;

View File

@ -243,7 +243,7 @@ public class Command_saconfig extends FreedomCommand
if (!player.isOp()) if (!player.isOp())
{ {
player.setOp(true); player.setOp(true);
player.sendMessage(YOU_ARE_OP); msg(player, YOU_ARE_OP);
} }
return true; return true;
} }

View File

@ -38,7 +38,7 @@ public class Command_scare extends FreedomCommand
} }
msg("Scared " + player.getName()); msg("Scared " + player.getName());
player.sendMessage(ChatColor.RED + "ZING"); msg(player, "ZING", ChatColor.RED);
player.spawnParticle(Particle.MOB_APPEARANCE, player.getLocation(), 4); player.spawnParticle(Particle.MOB_APPEARANCE, player.getLocation(), 4);
for (int i = 0; i < 10; ++i) for (int i = 0; i < 10; ++i)

View File

@ -1,6 +1,7 @@
package me.totalfreedom.totalfreedommod.command; package me.totalfreedom.totalfreedommod.command;
import java.util.List; import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -39,6 +40,12 @@ public class Command_setlever extends FreedomCommand
return true; return true;
} }
if (x > 29999998 || x < -29999998 || y > 29999998 || y < -29999998 || z > 29999998 || z < -29999998)
{
msg("Coordinates cannot be larger than 29999998 or smaller than -29999998 blocks.");
return true;
}
World world = null; World world = null;
final String needleWorldName = args[3].trim(); final String needleWorldName = args[3].trim();
final List<World> worlds = server.getWorlds(); final List<World> worlds = server.getWorlds();
@ -72,6 +79,8 @@ public class Command_setlever extends FreedomCommand
caster.setPowered(leverOn); caster.setPowered(leverOn);
state.setBlockData(data); state.setBlockData(data);
state.update(); state.update();
plugin.cpb.getCoreProtectAPI().logInteraction(sender.getName(), leverLocation);
} }
else else
{ {

View File

@ -21,7 +21,7 @@ public class Command_setplayerlimit extends FreedomCommand
Player player = Bukkit.getPlayer(args[0]); Player player = Bukkit.getPlayer(args[0]);
if (player == null) if (player == null)
{ {
sender.sendMessage(PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }

View File

@ -55,7 +55,7 @@ public class Command_settotalvotes extends FreedomCommand
if (player != null) if (player != null)
{ {
player.sendMessage(ChatColor.GREEN + sender.getName() + " has set your total votes to " + votes); msg(player, sender.getName() + " has set your total votes to " + votes, ChatColor.GREEN);
} }
return true; return true;

View File

@ -44,7 +44,7 @@ public class Command_smite extends FreedomCommand
} }
else else
{ {
sender.sendMessage(ChatColor.GRAY + "Smitten " + player.getName() + " quietly."); sender.sendMessage("Smitten " + player.getName() + " quietly.");
} }
// Deop // Deop
@ -112,7 +112,7 @@ public class Command_smite extends FreedomCommand
if (player == null) if (player == null)
{ {
msg(FreedomCommand.PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }

View File

@ -18,7 +18,7 @@ public class Command_spectator extends FreedomCommand
{ {
if (isConsole()) if (isConsole())
{ {
sender.sendMessage("When used from the console, you must define a target player."); msg("When used from the console, you must define a target player.");
return true; return true;
} }
@ -31,7 +31,7 @@ public class Command_spectator extends FreedomCommand
if (player == null) if (player == null)
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }

View File

@ -19,7 +19,7 @@ public class Command_survival extends FreedomCommand
{ {
if (isConsole()) if (isConsole())
{ {
sender.sendMessage("When used from the console, you must define a target player."); msg("When used from the console, you must define a target player.");
return true; return true;
} }
@ -46,7 +46,7 @@ public class Command_survival extends FreedomCommand
if (player == null) if (player == null)
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }

View File

@ -24,7 +24,7 @@ public class Command_unblockcmd extends FreedomCommand
Player player = getPlayer(args[0]); Player player = getPlayer(args[0]);
if (player == null) if (player == null)
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }

View File

@ -25,7 +25,7 @@ public class Command_uncage extends FreedomCommand
Player player = getPlayer(args[0]); Player player = getPlayer(args[0]);
if (player == null) if (player == null)
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }

View File

@ -37,7 +37,7 @@ public class Command_unmute extends FreedomCommand
final Player player = getPlayer(args[0]); final Player player = getPlayer(args[0]);
if (player == null) if (player == null)
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;
} }

View File

@ -54,12 +54,12 @@ public class Command_verifynoadmin extends FreedomCommand
plugin.rm.updateDisplay(player); plugin.rm.updateDisplay(player);
FUtil.adminAction(sender.getName(), "Verified " + player.getName() + ", without admin permissions.", true); FUtil.adminAction(sender.getName(), "Verified " + player.getName() + ", without admin permissions.", true);
player.setOp(true); player.setOp(true);
player.sendMessage(YOU_ARE_OP); msg(player, YOU_ARE_OP);
final FPlayer fPlayer = plugin.pl.getPlayer(player); final FPlayer fPlayer = plugin.pl.getPlayer(player);
if (fPlayer.getFreezeData().isFrozen()) if (fPlayer.getFreezeData().isFrozen())
{ {
fPlayer.getFreezeData().setFrozen(false); fPlayer.getFreezeData().setFrozen(false);
player.sendMessage(ChatColor.GRAY + "You have been unfrozen."); msg(player, "You have been unfrozen.");
} }
msg("Verified " + player.getName() + " but didn't give them admin permissions", ChatColor.GREEN); msg("Verified " + player.getName() + " but didn't give them admin permissions", ChatColor.GREEN);
} }

View File

@ -19,7 +19,6 @@ import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
public class DiscordToAdminChatListener extends ListenerAdapter public class DiscordToAdminChatListener extends ListenerAdapter
{ {
@ -39,7 +38,7 @@ public class DiscordToAdminChatListener extends ListenerAdapter
Member member = event.getMember(); Member member = event.getMember();
String tag = dtml.getDisplay(member); String tag = dtml.getDisplay(member);
Message msg = event.getMessage(); Message msg = event.getMessage();
String mediamessage = ChatColor.YELLOW + " [Media]"; String mediamessage = ChatColor.YELLOW + "[Media]";
StringBuilder logmessage = new StringBuilder(ChatColor.DARK_GRAY + "[" + ChatColor.DARK_AQUA + "Discord" + ChatColor.DARK_GRAY + "] " + ChatColor.RESET); StringBuilder logmessage = new StringBuilder(ChatColor.DARK_GRAY + "[" + ChatColor.DARK_AQUA + "Discord" + ChatColor.DARK_GRAY + "] " + ChatColor.RESET);
String lm = ChatColor.DARK_RED + member.getEffectiveName() + " " String lm = ChatColor.DARK_RED + member.getEffectiveName() + " "
@ -65,10 +64,10 @@ public class DiscordToAdminChatListener extends ListenerAdapter
String format = admin.getAcFormat(); String format = admin.getAcFormat();
if (!Strings.isNullOrEmpty(format)) if (!Strings.isNullOrEmpty(format))
{ {
Displayable display = TotalFreedomMod.getPlugin().rm.getDisplay(player); Displayable display = getDisplay(member);
net.md_5.bungee.api.ChatColor color = getColor(display); net.md_5.bungee.api.ChatColor color = getColor(display);
String m = format.replace("%name%", member.getEffectiveName()) String m = format.replace("%name%", member.getEffectiveName())
.replace("%rank%", getDisplay(member)) .replace("%rank%", display.getAbbr())
.replace("%rankcolor%", color.toString()) .replace("%rankcolor%", color.toString())
.replace("%msg%", FUtil.colorize(msg.getContentDisplay())); .replace("%msg%", FUtil.colorize(msg.getContentDisplay()));
builder.append(FUtil.colorize(m)); builder.append(FUtil.colorize(m));
@ -88,6 +87,10 @@ public class DiscordToAdminChatListener extends ListenerAdapter
{ {
TextComponent text = new TextComponent(mediamessage); TextComponent text = new TextComponent(mediamessage);
text.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, attachment.getUrl())); text.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, attachment.getUrl()));
if (!msg.getContentDisplay().isEmpty())
{
builder.append(" ");
}
builder.append(text); builder.append(text);
} }
} }
@ -98,43 +101,43 @@ public class DiscordToAdminChatListener extends ListenerAdapter
} }
// Needed to display tags in custom AC messages // Needed to display tags in custom AC messages
public String getDisplay(Member member) public Displayable getDisplay(Member member)
{ {
Guild server = Discord.bot.getGuildById(ConfigEntry.DISCORD_SERVER_ID.getString()); Guild server = Discord.bot.getGuildById(ConfigEntry.DISCORD_SERVER_ID.getString());
// Server Owner // Server Owner
if (member.getRoles().contains(server.getRoleById(ConfigEntry.DISCORD_SERVER_OWNER_ROLE_ID.getString()))) if (member.getRoles().contains(server.getRoleById(ConfigEntry.DISCORD_SERVER_OWNER_ROLE_ID.getString())))
{ {
return Title.OWNER.getAbbr(); return Title.OWNER;
} }
// Developers // Developers
else if (member.getRoles().contains(server.getRoleById(ConfigEntry.DISCORD_DEVELOPER_ROLE_ID.getString()))) else if (member.getRoles().contains(server.getRoleById(ConfigEntry.DISCORD_DEVELOPER_ROLE_ID.getString())))
{ {
return Title.DEVELOPER.getAbbr(); return Title.DEVELOPER;
} }
// Executives // Executives
else if (member.getRoles().contains(server.getRoleById(ConfigEntry.DISCORD_EXECUTIVE_ROLE_ID.getString()))) else if (member.getRoles().contains(server.getRoleById(ConfigEntry.DISCORD_EXECUTIVE_ROLE_ID.getString())))
{ {
return Title.EXECUTIVE.getAbbr(); return Title.EXECUTIVE;
} }
// Senior Admins // Senior Admins
else if (member.getRoles().contains(server.getRoleById(ConfigEntry.DISCORD_SENIOR_ADMIN_ROLE_ID.getString()))) else if (member.getRoles().contains(server.getRoleById(ConfigEntry.DISCORD_SENIOR_ADMIN_ROLE_ID.getString())))
{ {
return Rank.SENIOR_ADMIN.getAbbr(); return Rank.SENIOR_ADMIN;
} }
// Admins // Admins
else if (member.getRoles().contains(server.getRoleById(ConfigEntry.DISCORD_NEW_ADMIN_ROLE_ID.getString()))) else if (member.getRoles().contains(server.getRoleById(ConfigEntry.DISCORD_NEW_ADMIN_ROLE_ID.getString())))
{ {
return Rank.ADMIN.getAbbr(); return Rank.ADMIN;
} }
// Master Builders // Master Builders
else if (member.getRoles().contains(server.getRoleById(ConfigEntry.DISCORD_MASTER_BUILDER_ROLE_ID.getString()))) else if (member.getRoles().contains(server.getRoleById(ConfigEntry.DISCORD_MASTER_BUILDER_ROLE_ID.getString())))
{ {
return Title.MASTER_BUILDER.getAbbr(); return Title.MASTER_BUILDER;
} }
// OP, returning null breaks? // OP, returning null breaks?
else else
{ {
return Rank.OP.getAbbr(); return Rank.OP;
} }
} }
} }