mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
OPs can now have persistent tags (#108)
* new high end piece of software
- refactor all the shit to isEnabled
- idk debug
- gotta keep the messages consistent
- worldedit 🅱️ roke
- lockup description
- add /nh as an alias for namehistory
- yo /setl actually checks for w/e now cool
- gtfo and unban now are less bugs
- /whitelist is no longer written in tfm43 code and in beta
- l a m b a d a in help
- enable the bridges
- i worked on a converter for the login messages but then seth already made it work so fuck me i wasted an hour of my life
* whitelist
* i enabled them for testing
* OPs can now have persistent tags!
* Summary (required)
This commit is contained in:
parent
9c2f181ab9
commit
941bbc8da3
@ -52,7 +52,7 @@ public class AutoKick extends FreedomService
|
||||
private void autoKickCheck()
|
||||
{
|
||||
final boolean doAwayKickCheck
|
||||
= plugin.esb.isEssentialsEnabled()
|
||||
= plugin.esb.isEnabled()
|
||||
&& ((server.getOnlinePlayers().size() / server.getMaxPlayers()) > autoKickThreshold);
|
||||
|
||||
if (!doAwayKickCheck)
|
||||
|
@ -177,5 +177,4 @@ public class ChatManager extends FreedomService
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class Fuckoff extends FreedomService
|
||||
{
|
||||
|
||||
public Fuckoff(TotalFreedomMod plugin)
|
||||
{
|
||||
super(plugin);
|
||||
@ -64,5 +63,4 @@ public class Fuckoff extends FreedomService
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -122,7 +122,6 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
|
||||
acFormat = cs.getString("acformat", null);
|
||||
oldTags = cs.getBoolean("oldtags", false);
|
||||
logStick = cs.getBoolean("logstick", false);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -194,8 +194,6 @@ public class AdminList extends FreedomService
|
||||
}
|
||||
return admin;
|
||||
}
|
||||
|
||||
// Impostor
|
||||
}
|
||||
|
||||
// Admin by ip
|
||||
|
@ -1,26 +1,26 @@
|
||||
package me.totalfreedom.totalfreedommod.bridge;
|
||||
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.command.Command_vanish;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import com.earth2me.essentials.Essentials;
|
||||
import com.earth2me.essentials.User;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.command.Command_vanish;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class EssentialsBridge extends FreedomService
|
||||
{
|
||||
@ -221,20 +221,10 @@ public class EssentialsBridge extends FreedomService
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEssentialsEnabled()
|
||||
public boolean isEnabled()
|
||||
{
|
||||
try
|
||||
{
|
||||
Essentials essentials = getEssentialsPlugin();
|
||||
if (essentials != null)
|
||||
{
|
||||
return essentials.isEnabled();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
return false;
|
||||
final Essentials ess = getEssentialsPlugin();
|
||||
|
||||
return ess != null && ess.isEnabled();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package me.totalfreedom.totalfreedommod.bridge;
|
||||
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
@ -159,21 +158,4 @@ public class WorldEditBridge extends FreedomService
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isWorldEditEnabled()
|
||||
{
|
||||
try
|
||||
{
|
||||
WorldEditPlugin worldedit = getWorldEditPlugin();
|
||||
if (worldedit != null)
|
||||
{
|
||||
return worldedit.isEnabled();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ public class WorldEditListener extends PluginListener<TotalFreedomMod>
|
||||
event.getMaxVector(),
|
||||
event.getWorld().getName()))
|
||||
{
|
||||
|
||||
player.sendMessage(ChatColor.RED + "The region that you selected contained a protected area. Selection cleared.");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
@ -69,20 +69,10 @@ public class WorldGuardBridge extends FreedomService
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isPluginEnabled()
|
||||
public boolean isEnabled()
|
||||
{
|
||||
try
|
||||
{
|
||||
WorldGuardPlugin wg = getWorldGuardPlugin();
|
||||
if (wg != null)
|
||||
{
|
||||
return wg.isEnabled();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
return false;
|
||||
final WorldGuardPlugin wg = getWorldGuardPlugin();
|
||||
|
||||
return wg != null && wg.isEnabled();
|
||||
}
|
||||
}
|
@ -29,7 +29,7 @@ public class Command_debug extends FreedomCommand
|
||||
|
||||
if (className.equalsIgnoreCase("_"))
|
||||
{
|
||||
className = "me.StevenLawson.TotalFreedomMod.TotalFreedomMod";
|
||||
className = "me.totalfreedom.totalfreedommod.TotalFreedomMod";
|
||||
}
|
||||
|
||||
setStaticValue(className, fieldName, newValue);
|
||||
|
@ -14,7 +14,7 @@ public class Command_denick extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!plugin.esb.isEssentialsEnabled())
|
||||
if (!plugin.esb.isEnabled())
|
||||
{
|
||||
msg("Essentials is not enabled on this server.");
|
||||
return true;
|
||||
|
@ -18,7 +18,7 @@ public class Command_disguisetoggle extends FreedomCommand
|
||||
{
|
||||
if (!plugin.ldb.isEnabled())
|
||||
{
|
||||
msg(ChatColor.RED + "LibsDisguises is not enabled.");
|
||||
msg("LibsDisguises is not enabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -104,12 +103,9 @@ public class Command_gtfo extends FreedomCommand
|
||||
{
|
||||
// Undo WorldEdits
|
||||
try
|
||||
{
|
||||
if (plugin.web.isWorldEditEnabled())
|
||||
{
|
||||
plugin.web.undo(player, 15);
|
||||
}
|
||||
}
|
||||
catch (NoClassDefFoundError | NullPointerException ex)
|
||||
{
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Kick a player.", usage = "/<command> <player> [reason]", aliases = "k")
|
||||
public class Command_kick extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
protected boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
@ -25,6 +24,7 @@ public class Command_kick extends FreedomCommand
|
||||
}
|
||||
|
||||
Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
msg(PLAYER_NOT_FOUND);
|
||||
@ -57,5 +57,4 @@ public class Command_kick extends FreedomCommand
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
|
||||
import java.util.Random;
|
||||
|
||||
@CommandPermissions(level = Rank.NON_OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Link your discord account to your minecraft account", usage = "/<command>")
|
||||
@CommandParameters(description = "Link your Discord account to your Minecraft account", usage = "/<command>")
|
||||
public class Command_linkdiscord extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -21,7 +21,7 @@ public class Command_linkdiscord extends FreedomCommand
|
||||
{
|
||||
if (!plugin.dc.enabled)
|
||||
{
|
||||
msg("The discord verification system is currently disabled.", ChatColor.RED);
|
||||
msg("The Discord verification system is currently disabled.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ public class Command_linkdiscord extends FreedomCommand
|
||||
Admin admin = plugin.al.getAdmin(playerSender);
|
||||
if (admin.getDiscordID() != null)
|
||||
{
|
||||
msg("Your minecraft account is already linked to a discord account.", ChatColor.RED);
|
||||
msg("Your Minecraft account is already linked to a Discord account.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ public class Command_linkdiscord extends FreedomCommand
|
||||
VPlayer data = plugin.pv.getVerificationPlayer(playerSender);
|
||||
if (data.getDiscordId() != null)
|
||||
{
|
||||
msg("Your minecraft account is already linked to a discord account.", ChatColor.RED);
|
||||
msg("Your Minecraft account is already linked to a Discord account.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Teleport to the spawn point for the current world.", usage = "/<command>", aliases = "worldspawn,gotospawn")
|
||||
public class Command_localspawn extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
@ -10,7 +10,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@CommandParameters(description = "Block target's minecraft input. This is evil, and I never should have wrote it.", usage = "/<command> <all | purge | <<partialname> on | off>>")
|
||||
@CommandParameters(description = "Block a player's Minecraft input. This is evil, and I never should have wrote it.", usage = "/<command> <all | purge | <<partialname> on | off>>")
|
||||
public class Command_lockup extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -83,7 +83,6 @@ public class Command_lockup extends FreedomCommand
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.pravian.aero.util.ChatUtils;
|
||||
import net.pravian.aero.util.Ips;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -222,5 +221,4 @@ public class Command_myadmin extends FreedomCommand
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,10 +7,9 @@ import org.bukkit.entity.Player;
|
||||
import me.totalfreedom.totalfreedommod.util.History;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Check name history of username.", usage = "/<command> <username>")
|
||||
@CommandParameters(description = "Check name history of username.", usage = "/<command> <username>", aliases = "nh")
|
||||
public class Command_namehistory extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
@ -2,43 +2,45 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.pravian.aero.util.Ips;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Manage your verification", usage = "/<command> <enable | disable | clearips | status> <discord | forum>", aliases = "playerverification,pv")
|
||||
@CommandParameters(description = "Manage your verification", usage = "/<command> <<enable | disable | clearips | status> <discord | forum> | settag <tag> | cleartag>", aliases = "playerverification,pv")
|
||||
public class Command_playerverify extends FreedomCommand
|
||||
{
|
||||
@Override
|
||||
protected boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
VPlayer target = plugin.pv.getVerificationPlayer(playerSender);
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("clearips"))
|
||||
{
|
||||
VPlayer data = plugin.pv.getVerificationPlayer(playerSender);
|
||||
int cleared = 0;
|
||||
for (String ip : data.getIps())
|
||||
for (String ip : target.getIps())
|
||||
{
|
||||
if (!ip.equals(Ips.getIp(playerSender)))
|
||||
{
|
||||
data.removeIp(ip);
|
||||
target.removeIp(ip);
|
||||
cleared++;
|
||||
}
|
||||
}
|
||||
|
||||
msg("Cleared all IP's except your current IP \"" + Ips.getIp(playerSender) + "\"");
|
||||
msg("Cleared " + cleared + " IP's.");
|
||||
plugin.pv.saveVerificationData(data);
|
||||
plugin.pv.saveVerificationData(target);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length < 2)
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -48,6 +50,23 @@ public class Command_playerverify extends FreedomCommand
|
||||
msg("This command is only for OP's.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args[0])
|
||||
{
|
||||
case "cleartag":
|
||||
{
|
||||
msg("Cleared personal default tag");
|
||||
target.setTag(null);
|
||||
plugin.pv.saveVerificationData(target);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (args[0].toLowerCase())
|
||||
{
|
||||
case "enable":
|
||||
@ -56,7 +75,7 @@ public class Command_playerverify extends FreedomCommand
|
||||
case "discord":
|
||||
if (!plugin.dc.enabled)
|
||||
{
|
||||
msg("The discord verification system is currently disabled.", ChatColor.RED);
|
||||
msg("The Discord verification system is currently disabled.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
VPlayer data = plugin.pv.getVerificationPlayer(playerSender);
|
||||
@ -67,14 +86,15 @@ public class Command_playerverify extends FreedomCommand
|
||||
}
|
||||
data.setDiscordEnabled(true);
|
||||
plugin.pv.saveVerificationData(data);
|
||||
msg("Enabled discord verification. Please type /linkdiscord to link a discord account.", ChatColor.GREEN);
|
||||
msg("Enabled Discord verification. Please type /linkdiscord to link a Discord account.", ChatColor.GREEN);
|
||||
return true;
|
||||
case "forum":
|
||||
msg("TODO. This will be enabled in a later update. Please use discord verification instead.");
|
||||
msg("TODO. This will be enabled in a later update. Please use Discord verification instead.");
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
case "disable":
|
||||
switch (args[1].toLowerCase())
|
||||
{
|
||||
@ -87,7 +107,7 @@ public class Command_playerverify extends FreedomCommand
|
||||
}
|
||||
data.setDiscordEnabled(false);
|
||||
plugin.pv.saveVerificationData(data);
|
||||
msg("Disabled discord verification.", ChatColor.GREEN);
|
||||
msg("Disabled Discord verification.", ChatColor.GREEN);
|
||||
return true;
|
||||
case "forum":
|
||||
msg("TODO. Forum verification will be enabled in a later update.");
|
||||
@ -95,15 +115,15 @@ public class Command_playerverify extends FreedomCommand
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
case "status":
|
||||
switch (args[1].toLowerCase())
|
||||
{
|
||||
case "discord":
|
||||
VPlayer data = plugin.pv.getVerificationPlayer(playerSender);
|
||||
boolean enabled = data.getDiscordEnabled();
|
||||
boolean specified = data.getDiscordId() != null;
|
||||
boolean enabled = target.getDiscordEnabled();
|
||||
boolean specified = target.getDiscordId() != null;
|
||||
msg(ChatColor.GRAY + "Discord Verification Enabled: " + (enabled ? ChatColor.GREEN + "true" : ChatColor.RED + "false"));
|
||||
msg(ChatColor.GRAY + "Discord ID: " + (specified ? ChatColor.GREEN + data.getDiscordId() : ChatColor.RED + "not set"));
|
||||
msg(ChatColor.GRAY + "Discord ID: " + (specified ? ChatColor.GREEN + target.getDiscordId() : ChatColor.RED + "not set"));
|
||||
return true;
|
||||
case "forum":
|
||||
msg("TODO. Forum verification will be enabled in a later update.");
|
||||
@ -111,6 +131,16 @@ public class Command_playerverify extends FreedomCommand
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
case "settag":
|
||||
{
|
||||
String tag = StringUtils.join(args, " ", 1, args.length);
|
||||
target.setTag(tag);
|
||||
msg("Your default tag is now: " + FUtil.colorize(target.getTag()));
|
||||
plugin.pv.saveVerificationData(target);
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -14,11 +14,6 @@ public class Command_setlimit extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!plugin.web.isWorldEditEnabled())
|
||||
{
|
||||
msg("WorldEdit is not enabled on this server.");
|
||||
return true;
|
||||
}
|
||||
int amount = 100000;
|
||||
if (args.length > 0)
|
||||
{
|
||||
@ -32,10 +27,23 @@ public class Command_setlimit extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
}
|
||||
FUtil.adminAction(sender.getName(), "Setting everyone's WorldEdit block modification limit to " + amount + ".", true);
|
||||
boolean success = false;
|
||||
for (final Player player : server.getOnlinePlayers())
|
||||
{
|
||||
try
|
||||
{
|
||||
plugin.web.setLimit(player, amount);
|
||||
success = true;
|
||||
}
|
||||
catch (NoClassDefFoundError | NullPointerException ex)
|
||||
{
|
||||
msg("WorldEdit is not enabled on this server.");
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
if (success)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Setting everyone's WorldEdit block modification limit to " + amount + ".", true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -2,17 +2,16 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Go to a random place in the current world you are in", usage = "/<command>", aliases = "tpr")
|
||||
public class Command_tprandom extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
@ -47,12 +47,9 @@ public class Command_unban extends FreedomCommand
|
||||
{
|
||||
// Redo WorldEdits
|
||||
try
|
||||
{
|
||||
if (plugin.web.isWorldEditEnabled())
|
||||
{
|
||||
plugin.web.redo(player, 15);
|
||||
}
|
||||
}
|
||||
catch (NoClassDefFoundError | NullPointerException ex)
|
||||
{
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Unlink your discord account to your minecraft account", usage = "/<command>")
|
||||
@CommandParameters(description = "Unlink your Discord account to your Minecraft account", usage = "/<command>")
|
||||
public class Command_unlinkdiscord extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -18,7 +18,7 @@ public class Command_unlinkdiscord extends FreedomCommand
|
||||
{
|
||||
if (!plugin.dc.enabled)
|
||||
{
|
||||
msg("The discord verification system is currently disabled.", ChatColor.RED);
|
||||
msg("The Discord verification system is currently disabled.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -27,11 +27,11 @@ public class Command_unlinkdiscord extends FreedomCommand
|
||||
Admin admin = plugin.al.getAdmin(playerSender);
|
||||
if (admin.getDiscordID() == null)
|
||||
{
|
||||
msg("Your Minecraft account is not linked to a discord account.", ChatColor.RED);
|
||||
msg("Your Minecraft account is not linked to a Discord account.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
admin.setDiscordID(null);
|
||||
msg("Your Minecraft account has been successfully unlinked from the discord account.", ChatColor.GREEN);
|
||||
msg("Your Minecraft account has been successfully unlinked from the Discord account.", ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -39,12 +39,12 @@ public class Command_unlinkdiscord extends FreedomCommand
|
||||
VPlayer data = plugin.pv.getVerificationPlayer(playerSender);
|
||||
if (data.getDiscordId() == null)
|
||||
{
|
||||
msg("Your Minecraft account is not linked to a discord account.", ChatColor.RED);
|
||||
msg("Your Minecraft account is not linked to a Discord account.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
data.setDiscordId(null);
|
||||
data.setDiscordEnabled(false);
|
||||
msg("Your Minecraft account has been successfully unlinked from the discord account.", ChatColor.GREEN);
|
||||
msg("Your Minecraft account has been successfully unlinked from the Discord account.", ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -27,13 +27,13 @@ public class Command_verify extends FreedomCommand
|
||||
|
||||
if (!plugin.dc.enabled)
|
||||
{
|
||||
msg("The discord verification system is currently disabled", ChatColor.RED);
|
||||
msg("The Discord verification system is currently disabled", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!plugin.al.isAdminImpostor(playerSender) && !plugin.pv.isPlayerImpostor(playerSender))
|
||||
{
|
||||
msg("You are not an imposter, therefore you do not need to verify.", ChatColor.RED);
|
||||
msg("You are not an impostor, therefore you do not need to verify.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ public class Command_verify extends FreedomCommand
|
||||
Admin admin = plugin.al.getEntryByName(playerSender.getName());
|
||||
if (admin.getDiscordID() == null)
|
||||
{
|
||||
msg("You do not have a discord account linked to your minecraft account, please verify the manual way.", ChatColor.RED);
|
||||
msg("You do not have a Discord account linked to your Minecraft account, please verify the manual way.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
discordId = admin.getDiscordID();
|
||||
@ -55,7 +55,7 @@ public class Command_verify extends FreedomCommand
|
||||
{
|
||||
if (plugin.pv.getVerificationPlayer(playerSender).getDiscordId() == null)
|
||||
{
|
||||
msg("You do not have a discord account linked to your minecraft account, please verify the manual way.", ChatColor.RED);
|
||||
msg("You do not have a Discord account linked to your Minecraft account, please verify the manual way.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
discordId = plugin.pv.getVerificationPlayer(playerSender).getDiscordId();
|
||||
@ -71,7 +71,7 @@ public class Command_verify extends FreedomCommand
|
||||
code += random.nextInt(10);
|
||||
}
|
||||
Discord.VERIFY_CODES.add(code);
|
||||
Discord.bot.getUserById(discordId).openPrivateChannel().complete().sendMessage("A user with the ip `" + Ips.getIp(playerSender) + "` has sent a verification request. Please run the following in-game command: `/verify " + code + "`").complete();
|
||||
Discord.bot.getUserById(discordId).openPrivateChannel().complete().sendMessage("A user with the IP `" + Ips.getIp(playerSender) + "` has sent a verification request. Please run the following in-game command: `/verify " + code + "`").complete();
|
||||
msg("A verification code has been sent to your account, please copy the code and run /verify <code>", ChatColor.GREEN);
|
||||
}
|
||||
else
|
||||
@ -88,7 +88,7 @@ public class Command_verify extends FreedomCommand
|
||||
{
|
||||
Admin admin = plugin.al.getEntryByName(playerSender.getName());
|
||||
Discord.VERIFY_CODES.remove(code);
|
||||
FUtil.bcastMsg(playerSender.getName() + " has verified themself!", ChatColor.GOLD);
|
||||
FUtil.bcastMsg(playerSender.getName() + " has verified!", ChatColor.GOLD);
|
||||
FUtil.adminAction(ConfigEntry.SERVER_NAME.getString(), "Readding " + admin.getName() + " to the admin list", true);
|
||||
if (playerSender != null)
|
||||
{
|
||||
@ -144,11 +144,13 @@ public class Command_verify extends FreedomCommand
|
||||
else
|
||||
{
|
||||
final FPlayer fPlayer = plugin.pl.getPlayer(playerSender);
|
||||
FUtil.bcastMsg(playerSender.getName() + " has verified themself!", ChatColor.GOLD);
|
||||
FUtil.bcastMsg(playerSender.getName() + " has verified!", ChatColor.GOLD);
|
||||
if (playerSender != null)
|
||||
{
|
||||
plugin.rm.updateDisplay(playerSender);
|
||||
}
|
||||
playerSender.setOp(true);
|
||||
msg(YOU_ARE_OP);
|
||||
if (fPlayer.getFreezeData().isFrozen())
|
||||
{
|
||||
fPlayer.getFreezeData().setFrozen(false);
|
||||
|
@ -12,7 +12,6 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Manage the whitelist.", usage = "/<command> <on | off | list | count | add <player> | remove <player> | addall | purge>")
|
||||
public class Command_whitelist extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
@ -24,6 +23,11 @@ public class Command_whitelist extends FreedomCommand
|
||||
// list
|
||||
if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
if (server.getWhitelistedPlayers().isEmpty())
|
||||
{
|
||||
msg("There are no whitelisted players.");
|
||||
return true;
|
||||
}
|
||||
msg("Whitelisted players: " + FUtil.playerListToNames(server.getWhitelistedPlayers()));
|
||||
return true;
|
||||
}
|
||||
@ -51,20 +55,16 @@ public class Command_whitelist extends FreedomCommand
|
||||
msg("Online whitelisted players: " + onlineWPs);
|
||||
msg("Offline whitelisted players: " + offlineWPs);
|
||||
msg("Total whitelisted players: " + totalWPs);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// all commands past this line are superadmin-only
|
||||
if (!(senderIsConsole || plugin.al.isAdmin(sender)))
|
||||
{
|
||||
return noPerms();
|
||||
}
|
||||
// Commands below are restricted to admins
|
||||
checkRank(Rank.SUPER_ADMIN);
|
||||
|
||||
// on
|
||||
if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Turning the whitelist on.", true);
|
||||
FUtil.adminAction(sender.getName(), "Turning the whitelist on", true);
|
||||
server.setWhitelist(true);
|
||||
return true;
|
||||
}
|
||||
@ -72,7 +72,7 @@ public class Command_whitelist extends FreedomCommand
|
||||
// off
|
||||
if (args[0].equalsIgnoreCase("off"))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Turning the whitelist off.", true);
|
||||
FUtil.adminAction(sender.getName(), "Turning the whitelist off", true);
|
||||
server.setWhitelist(false);
|
||||
return true;
|
||||
}
|
||||
@ -94,7 +94,7 @@ public class Command_whitelist extends FreedomCommand
|
||||
player = DepreciationAggregator.getOfflinePlayer(server, search_name);
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Adding " + player.getName() + " to the whitelist.", false);
|
||||
FUtil.adminAction(sender.getName(), "Adding " + player.getName() + " to the whitelist", false);
|
||||
player.setWhitelisted(true);
|
||||
return true;
|
||||
}
|
||||
@ -118,7 +118,7 @@ public class Command_whitelist extends FreedomCommand
|
||||
|
||||
if (player.isWhitelisted())
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Removing " + player.getName() + " from the whitelist.", false);
|
||||
FUtil.adminAction(sender.getName(), "Removing " + player.getName() + " from the whitelist", false);
|
||||
player.setWhitelisted(false);
|
||||
return true;
|
||||
}
|
||||
@ -127,13 +127,12 @@ public class Command_whitelist extends FreedomCommand
|
||||
msg("That player is not whitelisted");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// addall
|
||||
if (args[0].equalsIgnoreCase("addall"))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Adding all online players to the whitelist.", false);
|
||||
FUtil.adminAction(sender.getName(), "Adding all online players to the whitelist", false);
|
||||
int counter = 0;
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
@ -148,25 +147,17 @@ public class Command_whitelist extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
// all commands past this line are console/telnet only
|
||||
if (!senderIsConsole)
|
||||
{
|
||||
noPerms();
|
||||
return true;
|
||||
}
|
||||
// Telnet only
|
||||
checkConsole();
|
||||
checkRank(Rank.TELNET_ADMIN);
|
||||
|
||||
// purge
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
// FUtil.adminAction(sender.getName(), "Removing all players from the whitelist.", false);
|
||||
// msg("Removed " + plugin.si.purgeWhitelist() + " players from the whitelist.");
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Whitelist purging is temporarily disabled.", true);
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Removing all players from the whitelist", false);
|
||||
msg("Removed " + plugin.si.purgeWhitelist() + " players from the whitelist.");
|
||||
return true;
|
||||
}
|
||||
|
||||
// none of the commands were executed
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class Command_wipeflatlands extends FreedomCommand
|
||||
|
||||
FUtil.bcastMsg("Server is going offline for flatlands wipe.", ChatColor.GRAY);
|
||||
|
||||
if (plugin.wgb.isPluginEnabled())
|
||||
if (plugin.wgb.isEnabled())
|
||||
{
|
||||
plugin.wgb.wipeRegions(plugin.wm.flatlands.getWorld());
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public class Command_wiperegions extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!plugin.wgb.isPluginEnabled())
|
||||
if (!plugin.wgb.isEnabled())
|
||||
{
|
||||
msg("WorldGuard is not enabled.");
|
||||
return true;
|
||||
|
@ -20,7 +20,7 @@ public class Command_wipeuserdata extends FreedomCommand
|
||||
{
|
||||
if (!server.getPluginManager().isPluginEnabled("Essentials"))
|
||||
{
|
||||
msg("Essentials is not enabled on this server");
|
||||
msg("Essentials is not enabled on this server.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class Command_wipewarps extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!plugin.esb.isEssentialsEnabled())
|
||||
if (!plugin.esb.isEnabled())
|
||||
{
|
||||
msg("Essentials is not enabled on this server.");
|
||||
return true;
|
||||
|
@ -7,8 +7,6 @@ import java.util.List;
|
||||
|
||||
public enum ConfigEntry
|
||||
{
|
||||
|
||||
|
||||
FORCE_IP_ENABLED(Boolean.class, "forceip.enabled"),
|
||||
FORCE_IP_PORT(Integer.class, "forceip.port"),
|
||||
FORCE_IP_KICKMSG(String.class, "forceip.kickmsg"),
|
||||
|
@ -12,7 +12,6 @@ public class MessageListener extends ListenerAdapter
|
||||
{
|
||||
if (!event.getAuthor().getId().equals(Discord.bot.getSelfUser().getId()))
|
||||
{
|
||||
|
||||
// Handle link code
|
||||
if (event.getMessage().getContentRaw().matches("[0-9][0-9][0-9][0-9][0-9]"))
|
||||
{
|
||||
|
@ -56,12 +56,7 @@ public class Module_help extends HTTPDModule
|
||||
pluginName = ((PluginIdentifiableCommand) command).getPlugin().getName();
|
||||
}
|
||||
|
||||
List<Command> pluginCommands = commandsByPlugin.get(pluginName);
|
||||
if (pluginCommands == null)
|
||||
{
|
||||
pluginCommands = Lists.newArrayList();
|
||||
commandsByPlugin.put(pluginName, pluginCommands);
|
||||
}
|
||||
List<Command> pluginCommands = commandsByPlugin.computeIfAbsent(pluginName, k -> Lists.newArrayList());
|
||||
|
||||
pluginCommands.add(command);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public class Module_logfile extends HTTPDModule
|
||||
|
||||
public String title()
|
||||
{
|
||||
return "TotalFreedomMod :: Logfiles";
|
||||
return "TotalFreedomMod :: Log Files";
|
||||
}
|
||||
|
||||
public String body() throws ResponseOverrideException
|
||||
|
@ -1,11 +1,12 @@
|
||||
package me.totalfreedom.totalfreedommod.httpd.module;
|
||||
|
||||
import java.io.File;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentList;
|
||||
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
|
||||
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD;
|
||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentList;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class Module_punishments extends HTTPDModule
|
||||
{
|
||||
|
@ -56,11 +56,6 @@ public class PlayerData implements ConfigLoadable, ConfigSavable, Validatable
|
||||
cs.set("last_join", lastJoinUnix);
|
||||
}
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
|
||||
public List<String> getIps()
|
||||
{
|
||||
return Collections.unmodifiableList(ips);
|
||||
|
@ -32,6 +32,9 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
|
||||
@Getter
|
||||
@Setter
|
||||
private Boolean forumEnabled = false;
|
||||
@Getter
|
||||
@Setter
|
||||
private String tag = null;
|
||||
|
||||
public VPlayer(String name)
|
||||
{
|
||||
@ -53,6 +56,7 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
|
||||
forumUsername = cs.getString("forumUsername", null);
|
||||
discordEnabled = cs.getBoolean("discordEnabled", false);
|
||||
forumEnabled = cs.getBoolean("forumEnabled", false);
|
||||
tag = cs.getString("tag", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -64,6 +68,7 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
|
||||
cs.set("forumUsername", forumUsername);
|
||||
cs.set("discordEnabled", discordEnabled);
|
||||
cs.set("forumEnabled", forumEnabled);
|
||||
cs.set("tag", tag);
|
||||
cs.set("ips", Lists.newArrayList(ips));
|
||||
}
|
||||
|
||||
@ -85,7 +90,6 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
|
||||
@Override
|
||||
public boolean isValid()
|
||||
{
|
||||
return name != null
|
||||
&& !ips.isEmpty();
|
||||
return name != null && !ips.isEmpty();
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.pravian.aero.util.ChatUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -150,6 +151,7 @@ public class RankManager extends FreedomService
|
||||
final Player player = event.getPlayer();
|
||||
//plugin.pl.getData(player);
|
||||
final FPlayer fPlayer = plugin.pl.getPlayer(player);
|
||||
VPlayer target = plugin.pv.getVerificationPlayer(player);
|
||||
|
||||
// Unban admins
|
||||
boolean isAdmin = plugin.al.isAdmin(player);
|
||||
@ -169,8 +171,8 @@ public class RankManager extends FreedomService
|
||||
}
|
||||
|
||||
// Handle impostors
|
||||
Boolean isImposter = plugin.al.isAdminImpostor(player) || plugin.pv.isPlayerImpostor(player) || plugin.mbl.isMasterBuilderImpostor(player);
|
||||
if (isImposter)
|
||||
boolean isImpostor = plugin.al.isAdminImpostor(player) || plugin.pv.isPlayerImpostor(player) || plugin.mbl.isMasterBuilderImpostor(player);
|
||||
if (isImpostor)
|
||||
{
|
||||
FUtil.bcastMsg(ChatColor.AQUA + player.getName() + " is " + Rank.IMPOSTOR.getColoredLoginMessage());
|
||||
if (plugin.al.isAdminImpostor(player))
|
||||
@ -230,5 +232,13 @@ public class RankManager extends FreedomService
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (!plugin.pv.isPlayerImpostor(player) && target.getDiscordEnabled())
|
||||
{
|
||||
if (target.getTag() != null)
|
||||
{
|
||||
plugin.pl.getPlayer(player).setTag(FUtil.colorize(target.getTag()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,17 @@
|
||||
package me.totalfreedom.totalfreedommod.util;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class DepreciationAggregator
|
||||
{
|
||||
|
||||
public static Block getTargetBlock(LivingEntity entity, HashSet<Material> transparent, int maxDistance)
|
||||
{
|
||||
return entity.getTargetBlock(transparent, maxDistance);
|
||||
|
Loading…
Reference in New Issue
Block a user