mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-12-23 03:14:56 +00:00
morle 😢
This commit is contained in:
parent
c8d686238c
commit
b1882a2a10
15 changed files with 1922 additions and 2081 deletions
|
@ -16,7 +16,7 @@ import me.StevenLawson.TotalFreedomMod.httpd.HTTPDManager;
|
||||||
import me.StevenLawson.TotalFreedomMod.listener.*;
|
import me.StevenLawson.TotalFreedomMod.listener.*;
|
||||||
import me.StevenLawson.TotalFreedomMod.player.HeartBeat;
|
import me.StevenLawson.TotalFreedomMod.player.HeartBeat;
|
||||||
import me.StevenLawson.TotalFreedomMod.player.PlayerList;
|
import me.StevenLawson.TotalFreedomMod.player.PlayerList;
|
||||||
import me.StevenLawson.TotalFreedomMod.player.UUIDManager;
|
import me.StevenLawson.TotalFreedomMod.manager.UUIDManager;
|
||||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||||
import me.StevenLawson.TotalFreedomMod.world.AdminWorld;
|
import me.StevenLawson.TotalFreedomMod.world.AdminWorld;
|
||||||
import me.StevenLawson.TotalFreedomMod.world.FlatlandsWorld;
|
import me.StevenLawson.TotalFreedomMod.world.FlatlandsWorld;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -5,8 +5,8 @@ import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import me.StevenLawson.TotalFreedomMod.ban.Ban.BanType;
|
import me.StevenLawson.TotalFreedomMod.ban.Ban.BanType;
|
||||||
import me.StevenLawson.TotalFreedomMod.config.Configuration;
|
import me.StevenLawson.TotalFreedomMod.config.Configuration;
|
||||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||||
import me.StevenLawson.TotalFreedomMod.player.UUIDManager;
|
import me.StevenLawson.TotalFreedomMod.manager.UUIDManager;
|
||||||
import me.StevenLawson.TotalFreedomMod.player.UUIDManager.TFM_UuidResolver;
|
import me.StevenLawson.TotalFreedomMod.manager.UUIDManager.TFM_UuidResolver;
|
||||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.ban.BanManager;
|
import me.StevenLawson.TotalFreedomMod.ban.BanManager;
|
||||||
import me.StevenLawson.TotalFreedomMod.player.PlayerData;
|
import me.StevenLawson.TotalFreedomMod.player.PlayerData;
|
||||||
import me.StevenLawson.TotalFreedomMod.player.UUIDManager;
|
import me.StevenLawson.TotalFreedomMod.manager.UUIDManager;
|
||||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import me.StevenLawson.TotalFreedomMod.ban.BanManager;
|
||||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||||
import me.StevenLawson.TotalFreedomMod.player.Player;
|
import me.StevenLawson.TotalFreedomMod.player.Player;
|
||||||
import me.StevenLawson.TotalFreedomMod.player.PlayerList;
|
import me.StevenLawson.TotalFreedomMod.player.PlayerList;
|
||||||
import me.StevenLawson.TotalFreedomMod.player.UUIDManager;
|
import me.StevenLawson.TotalFreedomMod.manager.UUIDManager;
|
||||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package me.StevenLawson.TotalFreedomMod.commands;
|
||||||
import me.StevenLawson.TotalFreedomMod.ban.Ban;
|
import me.StevenLawson.TotalFreedomMod.ban.Ban;
|
||||||
import me.StevenLawson.TotalFreedomMod.ban.BanManager;
|
import me.StevenLawson.TotalFreedomMod.ban.BanManager;
|
||||||
import me.StevenLawson.TotalFreedomMod.bridge.WorldEditBridge;
|
import me.StevenLawson.TotalFreedomMod.bridge.WorldEditBridge;
|
||||||
import me.StevenLawson.TotalFreedomMod.player.UUIDManager;
|
import me.StevenLawson.TotalFreedomMod.manager.UUIDManager;
|
||||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||||
import me.StevenLawson.TotalFreedomMod.world.RollbackManager;
|
import me.StevenLawson.TotalFreedomMod.world.RollbackManager;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
|
@ -14,6 +14,7 @@ public class Command_myadmin extends FreedomCommand {
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel,
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel,
|
||||||
String[] args, boolean senderIsConsole) {
|
String[] args, boolean senderIsConsole) {
|
||||||
|
|
||||||
final UUID uuid = sender_p.getUniqueId(); // Get the sender's uuid as a variable.
|
final UUID uuid = sender_p.getUniqueId(); // Get the sender's uuid as a variable.
|
||||||
|
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
|
|
|
@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.ban.Ban;
|
import me.StevenLawson.TotalFreedomMod.ban.Ban;
|
||||||
import me.StevenLawson.TotalFreedomMod.ban.BanManager;
|
import me.StevenLawson.TotalFreedomMod.ban.BanManager;
|
||||||
import me.StevenLawson.TotalFreedomMod.player.UUIDManager;
|
import me.StevenLawson.TotalFreedomMod.manager.UUIDManager;
|
||||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
|
@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.ban.Ban;
|
import me.StevenLawson.TotalFreedomMod.ban.Ban;
|
||||||
import me.StevenLawson.TotalFreedomMod.ban.BanManager;
|
import me.StevenLawson.TotalFreedomMod.ban.BanManager;
|
||||||
import me.StevenLawson.TotalFreedomMod.player.UUIDManager;
|
import me.StevenLawson.TotalFreedomMod.manager.UUIDManager;
|
||||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
|
@ -3,110 +3,112 @@ package me.StevenLawson.TotalFreedomMod.commands;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class Commands {
|
public class Commands {
|
||||||
public static void registerCommands(JavaPlugin plugin) {
|
|
||||||
plugin.getCommand("adminmode").setExecutor(new Command_adminmode());
|
public static void registerCommands(JavaPlugin plugin) {
|
||||||
plugin.getCommand("adminworld").setExecutor(new Command_adminworld());
|
plugin.getCommand("adminmode").setExecutor(new Command_adminmode());
|
||||||
plugin.getCommand("blockcmd").setExecutor(new Command_blockcmd());
|
plugin.getCommand("adminworld").setExecutor(new Command_adminworld());
|
||||||
plugin.getCommand("cage").setExecutor(new Command_cage());
|
plugin.getCommand("blockcmd").setExecutor(new Command_blockcmd());
|
||||||
plugin.getCommand("cake").setExecutor(new Command_cake());
|
plugin.getCommand("cage").setExecutor(new Command_cage());
|
||||||
plugin.getCommand("cartsit").setExecutor(new Command_cartsit());
|
plugin.getCommand("cake").setExecutor(new Command_cake());
|
||||||
plugin.getCommand("cbtool").setExecutor(new Command_cbtool());
|
plugin.getCommand("cartsit").setExecutor(new Command_cartsit());
|
||||||
plugin.getCommand("cmdlist").setExecutor(new Command_cmdlist());
|
plugin.getCommand("cbtool").setExecutor(new Command_cbtool());
|
||||||
plugin.getCommand("cmdspy").setExecutor(new Command_cmdspy());
|
plugin.getCommand("cmdlist").setExecutor(new Command_cmdlist());
|
||||||
plugin.getCommand("colorme").setExecutor(new Command_colorme());
|
plugin.getCommand("cmdspy").setExecutor(new Command_cmdspy());
|
||||||
plugin.getCommand("creative").setExecutor(new Command_creative());
|
plugin.getCommand("colorme").setExecutor(new Command_colorme());
|
||||||
plugin.getCommand("csay").setExecutor(new Command_csay());
|
plugin.getCommand("creative").setExecutor(new Command_creative());
|
||||||
plugin.getCommand("deafen").setExecutor(new Command_deafen());
|
plugin.getCommand("csay").setExecutor(new Command_csay());
|
||||||
plugin.getCommand("debug").setExecutor(new Command_debug());
|
plugin.getCommand("deafen").setExecutor(new Command_deafen());
|
||||||
plugin.getCommand("denick").setExecutor(new Command_denick());
|
plugin.getCommand("debug").setExecutor(new Command_debug());
|
||||||
plugin.getCommand("deop").setExecutor(new Command_deop());
|
plugin.getCommand("denick").setExecutor(new Command_denick());
|
||||||
plugin.getCommand("deopall").setExecutor(new Command_deopall());
|
plugin.getCommand("deop").setExecutor(new Command_deop());
|
||||||
plugin.getCommand("dispfill").setExecutor(new Command_dispfill());
|
plugin.getCommand("deopall").setExecutor(new Command_deopall());
|
||||||
plugin.getCommand("doom").setExecutor(new Command_doom());
|
plugin.getCommand("dispfill").setExecutor(new Command_dispfill());
|
||||||
plugin.getCommand("enchant").setExecutor(new Command_enchant());
|
plugin.getCommand("doom").setExecutor(new Command_doom());
|
||||||
plugin.getCommand("ender").setExecutor(new Command_ender());
|
plugin.getCommand("enchant").setExecutor(new Command_enchant());
|
||||||
plugin.getCommand("expel").setExecutor(new Command_expel());
|
plugin.getCommand("ender").setExecutor(new Command_ender());
|
||||||
plugin.getCommand("findip").setExecutor(new Command_findip());
|
plugin.getCommand("expel").setExecutor(new Command_expel());
|
||||||
plugin.getCommand("flatlands").setExecutor(new Command_flatlands());
|
plugin.getCommand("findip").setExecutor(new Command_findip());
|
||||||
plugin.getCommand("fr").setExecutor(new Command_fr());
|
plugin.getCommand("flatlands").setExecutor(new Command_flatlands());
|
||||||
plugin.getCommand("fuckoff").setExecutor(new Command_fuckoff());
|
plugin.getCommand("fr").setExecutor(new Command_fr());
|
||||||
plugin.getCommand("gadmin").setExecutor(new Command_gadmin());
|
plugin.getCommand("fuckoff").setExecutor(new Command_fuckoff());
|
||||||
plugin.getCommand("gcmd").setExecutor(new Command_gcmd());
|
plugin.getCommand("gadmin").setExecutor(new Command_gadmin());
|
||||||
plugin.getCommand("glist").setExecutor(new Command_glist());
|
plugin.getCommand("gcmd").setExecutor(new Command_gcmd());
|
||||||
plugin.getCommand("gtfo").setExecutor(new Command_gtfo());
|
plugin.getCommand("glist").setExecutor(new Command_glist());
|
||||||
plugin.getCommand("halt").setExecutor(new Command_halt());
|
plugin.getCommand("gtfo").setExecutor(new Command_gtfo());
|
||||||
plugin.getCommand("health").setExecutor(new Command_health());
|
plugin.getCommand("halt").setExecutor(new Command_halt());
|
||||||
plugin.getCommand("invis").setExecutor(new Command_invis());
|
plugin.getCommand("health").setExecutor(new Command_health());
|
||||||
plugin.getCommand("jumppads").setExecutor(new Command_jumppads());
|
plugin.getCommand("invis").setExecutor(new Command_invis());
|
||||||
plugin.getCommand("kicknoob").setExecutor(new Command_kicknoob());
|
plugin.getCommand("jumppads").setExecutor(new Command_jumppads());
|
||||||
plugin.getCommand("landmine").setExecutor(new Command_landmine());
|
plugin.getCommand("kicknoob").setExecutor(new Command_kicknoob());
|
||||||
plugin.getCommand("lastcmd").setExecutor(new Command_lastcmd());
|
plugin.getCommand("landmine").setExecutor(new Command_landmine());
|
||||||
plugin.getCommand("list").setExecutor(new Command_list());
|
plugin.getCommand("lastcmd").setExecutor(new Command_lastcmd());
|
||||||
plugin.getCommand("localspawn").setExecutor(new Command_localspawn());
|
plugin.getCommand("list").setExecutor(new Command_list());
|
||||||
plugin.getCommand("lockup").setExecutor(new Command_lockup());
|
plugin.getCommand("localspawn").setExecutor(new Command_localspawn());
|
||||||
plugin.getCommand("logs").setExecutor(new Command_logs());
|
plugin.getCommand("lockup").setExecutor(new Command_lockup());
|
||||||
plugin.getCommand("moblimiter").setExecutor(new Command_moblimiter());
|
plugin.getCommand("logs").setExecutor(new Command_logs());
|
||||||
plugin.getCommand("mp").setExecutor(new Command_mp());
|
plugin.getCommand("moblimiter").setExecutor(new Command_moblimiter());
|
||||||
plugin.getCommand("mp44").setExecutor(new Command_mp44());
|
plugin.getCommand("mp").setExecutor(new Command_mp());
|
||||||
plugin.getCommand("myadmin").setExecutor(new Command_myadmin());
|
plugin.getCommand("mp44").setExecutor(new Command_mp44());
|
||||||
plugin.getCommand("nether").setExecutor(new Command_nether());
|
plugin.getCommand("myadmin").setExecutor(new Command_myadmin());
|
||||||
plugin.getCommand("nf").setExecutor(new Command_nf());
|
plugin.getCommand("nether").setExecutor(new Command_nether());
|
||||||
plugin.getCommand("nickclean").setExecutor(new Command_nickclean());
|
plugin.getCommand("nf").setExecutor(new Command_nf());
|
||||||
plugin.getCommand("nicknyan").setExecutor(new Command_nicknyan());
|
plugin.getCommand("nickclean").setExecutor(new Command_nickclean());
|
||||||
plugin.getCommand("o").setExecutor(new Command_o());
|
plugin.getCommand("nicknyan").setExecutor(new Command_nicknyan());
|
||||||
plugin.getCommand("onlinemode").setExecutor(new Command_onlinemode());
|
plugin.getCommand("o").setExecutor(new Command_o());
|
||||||
plugin.getCommand("op").setExecutor(new Command_op());
|
plugin.getCommand("onlinemode").setExecutor(new Command_onlinemode());
|
||||||
plugin.getCommand("opall").setExecutor(new Command_opall());
|
plugin.getCommand("op").setExecutor(new Command_op());
|
||||||
plugin.getCommand("opme").setExecutor(new Command_opme());
|
plugin.getCommand("opall").setExecutor(new Command_opall());
|
||||||
plugin.getCommand("ops").setExecutor(new Command_ops());
|
plugin.getCommand("opme").setExecutor(new Command_opme());
|
||||||
plugin.getCommand("orbit").setExecutor(new Command_orbit());
|
plugin.getCommand("ops").setExecutor(new Command_ops());
|
||||||
plugin.getCommand("overlord").setExecutor(new Command_overlord());
|
plugin.getCommand("orbit").setExecutor(new Command_orbit());
|
||||||
plugin.getCommand("permban").setExecutor(new Command_permban());
|
plugin.getCommand("overlord").setExecutor(new Command_overlord());
|
||||||
plugin.getCommand("plugincontrol").setExecutor(new Command_plugincontrol());
|
plugin.getCommand("permban").setExecutor(new Command_permban());
|
||||||
plugin.getCommand("potion").setExecutor(new Command_potion());
|
plugin.getCommand("plugincontrol").setExecutor(new Command_plugincontrol());
|
||||||
plugin.getCommand("premium").setExecutor(new Command_premium());
|
plugin.getCommand("potion").setExecutor(new Command_potion());
|
||||||
plugin.getCommand("protectarea").setExecutor(new Command_protectarea());
|
plugin.getCommand("premium").setExecutor(new Command_premium());
|
||||||
plugin.getCommand("purgeall").setExecutor(new Command_purgeall());
|
plugin.getCommand("protectarea").setExecutor(new Command_protectarea());
|
||||||
plugin.getCommand("qdeop").setExecutor(new Command_qdeop());
|
plugin.getCommand("purgeall").setExecutor(new Command_purgeall());
|
||||||
plugin.getCommand("qop").setExecutor(new Command_qop());
|
plugin.getCommand("qdeop").setExecutor(new Command_qdeop());
|
||||||
plugin.getCommand("radar").setExecutor(new Command_radar());
|
plugin.getCommand("qop").setExecutor(new Command_qop());
|
||||||
plugin.getCommand("rank").setExecutor(new Command_rank());
|
plugin.getCommand("radar").setExecutor(new Command_radar());
|
||||||
plugin.getCommand("rawsay").setExecutor(new Command_rawsay());
|
plugin.getCommand("rank").setExecutor(new Command_rank());
|
||||||
plugin.getCommand("rd").setExecutor(new Command_rd());
|
plugin.getCommand("rawsay").setExecutor(new Command_rawsay());
|
||||||
plugin.getCommand("report").setExecutor(new Command_report());
|
plugin.getCommand("rd").setExecutor(new Command_rd());
|
||||||
plugin.getCommand("ro").setExecutor(new Command_ro());
|
plugin.getCommand("report").setExecutor(new Command_report());
|
||||||
plugin.getCommand("rollback").setExecutor(new Command_rollback());
|
plugin.getCommand("ro").setExecutor(new Command_ro());
|
||||||
plugin.getCommand("saconfig").setExecutor(new Command_saconfig());
|
plugin.getCommand("rollback").setExecutor(new Command_rollback());
|
||||||
plugin.getCommand("say").setExecutor(new Command_say());
|
plugin.getCommand("saconfig").setExecutor(new Command_saconfig());
|
||||||
plugin.getCommand("setl").setExecutor(new Command_setl());
|
plugin.getCommand("say").setExecutor(new Command_say());
|
||||||
plugin.getCommand("setlevel").setExecutor(new Command_setlevel());
|
plugin.getCommand("setl").setExecutor(new Command_setl());
|
||||||
plugin.getCommand("setlever").setExecutor(new Command_setlever());
|
plugin.getCommand("setlevel").setExecutor(new Command_setlevel());
|
||||||
plugin.getCommand("setspawnworld").setExecutor(new Command_setspawnworld());
|
plugin.getCommand("setlever").setExecutor(new Command_setlever());
|
||||||
plugin.getCommand("smite").setExecutor(new Command_smite());
|
plugin.getCommand("setspawnworld").setExecutor(new Command_setspawnworld());
|
||||||
plugin.getCommand("spectator").setExecutor(new Command_spectator());
|
plugin.getCommand("smite").setExecutor(new Command_smite());
|
||||||
plugin.getCommand("status").setExecutor(new Command_status());
|
plugin.getCommand("spectator").setExecutor(new Command_spectator());
|
||||||
plugin.getCommand("stfu").setExecutor(new Command_stfu());
|
plugin.getCommand("status").setExecutor(new Command_status());
|
||||||
plugin.getCommand("stop").setExecutor(new Command_stop());
|
plugin.getCommand("stfu").setExecutor(new Command_stfu());
|
||||||
plugin.getCommand("survival").setExecutor(new Command_survival());
|
plugin.getCommand("stop").setExecutor(new Command_stop());
|
||||||
plugin.getCommand("tag").setExecutor(new Command_tag());
|
plugin.getCommand("survival").setExecutor(new Command_survival());
|
||||||
plugin.getCommand("tagnyan").setExecutor(new Command_tagnyan());
|
plugin.getCommand("tag").setExecutor(new Command_tag());
|
||||||
plugin.getCommand("tban").setExecutor(new Command_tban());
|
plugin.getCommand("tagnyan").setExecutor(new Command_tagnyan());
|
||||||
plugin.getCommand("tempban").setExecutor(new Command_tempban());
|
plugin.getCommand("tban").setExecutor(new Command_tban());
|
||||||
plugin.getCommand("tfbanlist").setExecutor(new Command_tfbanlist());
|
plugin.getCommand("tempban").setExecutor(new Command_tempban());
|
||||||
plugin.getCommand("tfipbanlist").setExecutor(new Command_tfipbanlist());
|
plugin.getCommand("tfbanlist").setExecutor(new Command_tfbanlist());
|
||||||
plugin.getCommand("tfm").setExecutor(new Command_tfm());
|
plugin.getCommand("tfipbanlist").setExecutor(new Command_tfipbanlist());
|
||||||
plugin.getCommand("toggle").setExecutor(new Command_toggle());
|
plugin.getCommand("tfm").setExecutor(new Command_tfm());
|
||||||
plugin.getCommand("tossmob").setExecutor(new Command_tossmob());
|
plugin.getCommand("toggle").setExecutor(new Command_toggle());
|
||||||
plugin.getCommand("trail").setExecutor(new Command_trail());
|
plugin.getCommand("tossmob").setExecutor(new Command_tossmob());
|
||||||
plugin.getCommand("updatetfm").setExecutor(new Command_updatetfm());
|
plugin.getCommand("trail").setExecutor(new Command_trail());
|
||||||
plugin.getCommand("uuid").setExecutor(new Command_uuid());
|
plugin.getCommand("updatetfm").setExecutor(new Command_updatetfm());
|
||||||
plugin.getCommand("warn").setExecutor(new Command_warn());
|
plugin.getCommand("uuid").setExecutor(new Command_uuid());
|
||||||
plugin.getCommand("whitelist").setExecutor(new Command_whitelist());
|
plugin.getCommand("warn").setExecutor(new Command_warn());
|
||||||
plugin.getCommand("whohas").setExecutor(new Command_whohas());
|
plugin.getCommand("whitelist").setExecutor(new Command_whitelist());
|
||||||
plugin.getCommand("wildcard").setExecutor(new Command_wildcard());
|
plugin.getCommand("whohas").setExecutor(new Command_whohas());
|
||||||
plugin.getCommand("wipeflatlands").setExecutor(new Command_wipeflatlands());
|
plugin.getCommand("wildcard").setExecutor(new Command_wildcard());
|
||||||
plugin.getCommand("wipeuserdata").setExecutor(new Command_wipeuserdata());
|
plugin.getCommand("wipeflatlands").setExecutor(new Command_wipeflatlands());
|
||||||
plugin.getCommand("whoami").setExecutor(new Command_whoami());
|
plugin.getCommand("wipeuserdata").setExecutor(new Command_wipeuserdata());
|
||||||
plugin.getCommand("resetplayer").setExecutor(new Command_resetplayer());
|
plugin.getCommand("whoami").setExecutor(new Command_whoami());
|
||||||
}
|
plugin.getCommand("resetplayer").setExecutor(new Command_resetplayer());
|
||||||
|
plugin.getCommand("vanish").setExecutor(new Command_vanish());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
package me.StevenLawson.TotalFreedomMod.discord.bridge;
|
package me.StevenLawson.TotalFreedomMod.discord.bridge;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import me.StevenLawson.TotalFreedomMod.Log;
|
import me.StevenLawson.TotalFreedomMod.Log;
|
||||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||||
import me.StevenLawson.TotalFreedomMod.config.MainConfig;
|
import me.StevenLawson.TotalFreedomMod.config.MainConfig;
|
||||||
import me.StevenLawson.TotalFreedomMod.discord.command.DiscordCommandManager;
|
import me.StevenLawson.TotalFreedomMod.discord.command.DiscordCommandManager;
|
||||||
import me.StevenLawson.TotalFreedomMod.player.PlayerRank;
|
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||||
import net.md_5.bungee.api.chat.BaseComponent;
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
import net.md_5.bungee.api.chat.HoverEvent;
|
import net.md_5.bungee.api.chat.HoverEvent;
|
||||||
|
@ -21,222 +25,234 @@ import org.javacord.api.entity.message.MessageAuthor;
|
||||||
import org.javacord.api.entity.server.Server;
|
import org.javacord.api.entity.server.Server;
|
||||||
import org.javacord.api.entity.user.User;
|
import org.javacord.api.entity.user.User;
|
||||||
import org.javacord.api.event.message.MessageCreateEvent;
|
import org.javacord.api.event.message.MessageCreateEvent;
|
||||||
import org.javacord.api.event.message.MessageEvent;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
public class DiscordBridge {
|
public class DiscordBridge {
|
||||||
private static DiscordApi DISCORD_API;
|
|
||||||
private static TextChannel CHANNEL;
|
|
||||||
private static TextChannel ADMIN_CHANNEL;
|
|
||||||
public static DiscordCommandManager COMMAND_MANAGER;
|
|
||||||
|
|
||||||
private static void onMessageCreateEvent(MessageCreateEvent message) {
|
private static DiscordApi DISCORD_API;
|
||||||
boolean isAdmin = false;
|
private static TextChannel CHANNEL;
|
||||||
|
private static TextChannel ADMIN_CHANNEL;
|
||||||
|
public static DiscordCommandManager COMMAND_MANAGER;
|
||||||
|
|
||||||
|
private static void onMessageCreateEvent(MessageCreateEvent message) {
|
||||||
|
boolean isAdmin = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
isAdmin = message.getChannel().getIdAsString()
|
||||||
|
.equalsIgnoreCase(ADMIN_CHANNEL.getIdAsString());
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
|
||||||
|
String content = message.getMessage().getReadableContent();
|
||||||
|
String prefix = MainConfig.getString(ConfigurationEntry.DISCORD_PREFIX);
|
||||||
|
MessageAuthor author = message.getMessage().getAuthor();
|
||||||
|
|
||||||
|
if (author.isBotUser() || !message.isServerMessage()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Optional<Server> server = message.getServer();
|
||||||
|
Optional<User> user = author.asUser();
|
||||||
|
|
||||||
|
if (prefix == null) {
|
||||||
|
Log.severe("Bot prefix does not exist. Stopping bot...");
|
||||||
|
stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!server.isPresent()) {
|
||||||
|
Log.warning(
|
||||||
|
"Discord server wasn't present in message, this may be a sign you've not properly configured the intents for your bot.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!user.isPresent()) {
|
||||||
|
Log.warning(
|
||||||
|
"Unable to get user of message author. This may be a sign you've not properly configured the intents for your bot.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (content.toLowerCase().startsWith(prefix)) {
|
||||||
|
COMMAND_MANAGER.parse(content, user.get(), server.get(), message.getChannel(), prefix);
|
||||||
|
} else {
|
||||||
|
Optional<Message> referenced = message.getMessage().getReferencedMessage();
|
||||||
|
|
||||||
|
String reply = "";
|
||||||
|
if (referenced.isPresent()) {
|
||||||
|
Message replyingTo = referenced.get();
|
||||||
|
reply = String.format(
|
||||||
|
ChatColor.GRAY + "┌ " + ChatColor.YELLOW + "%s" + ChatColor.GRAY + " %s\n"
|
||||||
|
+ ChatColor.WHITE, replyingTo.getAuthor().getDiscriminatedName(),
|
||||||
|
replyingTo.getReadableContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
String format = MainConfig.getString(
|
||||||
|
(isAdmin) ? ConfigurationEntry.DISCORD_ADMIN_FORMAT : ConfigurationEntry.DISCORD_FORMAT);
|
||||||
|
format = format.replace("{TAG}", author.getDiscriminatedName());
|
||||||
|
format = format.replace("{USERNAME}", author.getName());
|
||||||
|
BaseComponent[] components = TextComponent.fromLegacyText(
|
||||||
|
ChatColor.translateAlternateColorCodes('&', String.format(format, content)));
|
||||||
|
TextComponent component = new TextComponent(reply);
|
||||||
|
|
||||||
|
component.addExtra(Utilities.fromBaseComponents(components));
|
||||||
|
|
||||||
|
if (message.getMessageAttachments().size() > 0) {
|
||||||
|
int i = 0;
|
||||||
|
for (MessageAttachment messageAttachment : message.getMessageAttachments()) {
|
||||||
|
String url = messageAttachment.getProxyUrl().toString();
|
||||||
|
ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL, url);
|
||||||
|
TextComponent warningComponent = new TextComponent(
|
||||||
|
"WARNING: By clicking on this text, your client will open:\n\n");
|
||||||
|
warningComponent.setColor(net.md_5.bungee.api.ChatColor.RED);
|
||||||
|
warningComponent.setBold(true);
|
||||||
|
TextComponent urlComponent = new TextComponent(url);
|
||||||
|
urlComponent.setColor(net.md_5.bungee.api.ChatColor.DARK_AQUA);
|
||||||
|
urlComponent.setUnderlined(true);
|
||||||
|
urlComponent.setBold(false);
|
||||||
|
warningComponent.addExtra(urlComponent);
|
||||||
|
HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||||
|
new BaseComponent[]{warningComponent});
|
||||||
|
TextComponent mediaComponent = new TextComponent(
|
||||||
|
(i == 0 && content.isEmpty()) ? "[Media]" : " [Media]");
|
||||||
|
mediaComponent.setColor(net.md_5.bungee.api.ChatColor.YELLOW);
|
||||||
|
mediaComponent.setClickEvent(clickEvent);
|
||||||
|
mediaComponent.setHoverEvent(hoverEvent);
|
||||||
|
component.addExtra(mediaComponent);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isAdmin) {
|
||||||
|
for (org.bukkit.entity.Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
if (AdminList.isSuperAdmin(player)) {
|
||||||
|
player.spigot().sendMessage(component);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Bukkit.spigot().broadcast(component);
|
||||||
|
}
|
||||||
|
Log.info(component.toPlainText());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void load() {
|
||||||
|
|
||||||
|
if (Boolean.FALSE.equals(MainConfig.getBoolean(ConfigurationEntry.DISCORD_IS_ENABLED))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
DISCORD_API = new DiscordApiBuilder()
|
||||||
|
.setToken(MainConfig.getString(ConfigurationEntry.DISCORD_TOKEN))
|
||||||
|
.login()
|
||||||
|
.join();
|
||||||
|
|
||||||
|
Optional<TextChannel> channelFuture = DISCORD_API.getTextChannelById(
|
||||||
|
MainConfig.getString(ConfigurationEntry.DISCORD_CHANNEL));
|
||||||
|
Optional<TextChannel> adminChannelFuture = DISCORD_API.getTextChannelById(
|
||||||
|
MainConfig.getString(ConfigurationEntry.DISCORD_ADMIN_CHANNEL));
|
||||||
|
|
||||||
|
if (!channelFuture.isPresent()) {
|
||||||
|
Log.warning("TFM 4.3 Reloaded could not find your channel, stopping!");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CHANNEL = channelFuture.get();
|
||||||
|
adminChannelFuture.ifPresent(textChannel -> ADMIN_CHANNEL = textChannel);
|
||||||
|
COMMAND_MANAGER = new DiscordCommandManager();
|
||||||
|
COMMAND_MANAGER.init();
|
||||||
|
|
||||||
|
CHANNEL.addMessageCreateListener(DiscordBridge::onMessageCreateEvent);
|
||||||
|
if (adminChannelFuture.isPresent()) {
|
||||||
|
ADMIN_CHANNEL.addMessageCreateListener(DiscordBridge::onMessageCreateEvent);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.warning(
|
||||||
|
"Uh oh! It looks like TFM 4.3 Reloaded Discord couldn't start! Please check you have defined the bot's token & channel and also given it the correct permissions! (Read Messages and Send Messages)");
|
||||||
|
Log.warning("If you've already set that up however, you may to read the exception below.");
|
||||||
|
Log.warning(
|
||||||
|
"If this is a bug with TFM 4.3 Reloaded, please report it at https://github.com/TheDeus-Group/TFM-4.3-Reloaded/issues or https://code.cat.casa/TheDeus-Group/TFM-4.3-Reloaded/issues");
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.info("TFM 4.3 Reloaded Discord started.");
|
||||||
|
|
||||||
|
transmitMessage("**Server has started**");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String sanitizeMessage(String message) {
|
||||||
|
Pattern colors = Pattern.compile("§.", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
|
||||||
|
Pattern pings = Pattern.compile("@", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
|
||||||
|
|
||||||
|
if (message.length() > 2000) {
|
||||||
|
message = message.substring(0, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
return message.replaceAll(colors.pattern(), "").replaceAll(pings.pattern(), "@\u200B");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void transmitMessage(String message) {
|
||||||
|
transmitMessage(message, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void transmitMessage(String message, boolean disconnectAfterwards) {
|
||||||
|
if (CHANNEL == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!disconnectAfterwards) {
|
||||||
|
CHANNEL.sendMessage(sanitizeMessage(message));
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
CHANNEL.sendMessage(sanitizeMessage(message)).get();
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
CountDownLatch shutdownWaiter = new CountDownLatch(1);
|
||||||
|
|
||||||
|
Thread t = new Thread(() -> {
|
||||||
|
DISCORD_API.addLostConnectionListener(lostConnectionEvent -> shutdownWaiter.countDown());
|
||||||
|
DISCORD_API.disconnect();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
isAdmin = message.getChannel().getIdAsString().equalsIgnoreCase(ADMIN_CHANNEL.getIdAsString());
|
shutdownWaiter.await(30, TimeUnit.SECONDS);
|
||||||
} catch (Exception ignored) {}
|
} catch (InterruptedException ignored) {
|
||||||
|
|
||||||
String content = message.getMessage().getReadableContent();
|
|
||||||
String prefix = MainConfig.getString(ConfigurationEntry.DISCORD_PREFIX);
|
|
||||||
MessageAuthor author = message.getMessage().getAuthor();
|
|
||||||
|
|
||||||
if (author.isBotUser() || !message.isServerMessage()) return;
|
|
||||||
Optional<Server> server = message.getServer();
|
|
||||||
Optional<User> user = author.asUser();
|
|
||||||
|
|
||||||
if(prefix == null) {
|
|
||||||
Log.severe("Bot prefix does not exist. Stopping bot...");
|
|
||||||
stop();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
t.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!server.isPresent()) {
|
public static void transmitAdminMessage(String message) {
|
||||||
Log.warning("Discord server wasn't present in message, this may be a sign you've not properly configured the intents for your bot.");
|
transmitAdminMessage(message, false);
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(!user.isPresent()) {
|
public static void transmitAdminMessage(String message, boolean disconnectAfterwards) {
|
||||||
Log.warning("Unable to get user of message author. This may be a sign you've not properly configured the intents for your bot.");
|
if (ADMIN_CHANNEL == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!disconnectAfterwards) {
|
||||||
|
ADMIN_CHANNEL.sendMessage(sanitizeMessage(message));
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
ADMIN_CHANNEL.sendMessage(sanitizeMessage(message)).get();
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
DISCORD_API.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (content.toLowerCase().startsWith(prefix)) {
|
public static void stop() {
|
||||||
COMMAND_MANAGER.parse(content, user.get(), server.get(), message.getChannel(), prefix);
|
|
||||||
} else {
|
|
||||||
Optional<Message> referenced = message.getMessage().getReferencedMessage();
|
|
||||||
|
|
||||||
String reply = "";
|
if (Boolean.FALSE.equals(MainConfig.getBoolean(ConfigurationEntry.DISCORD_IS_ENABLED))) {
|
||||||
if(referenced.isPresent()) {
|
return;
|
||||||
Message replyingTo = referenced.get();
|
|
||||||
reply = String.format(ChatColor.GRAY + "┌ " + ChatColor.YELLOW + "%s" + ChatColor.GRAY + " %s\n" + ChatColor.WHITE, replyingTo.getAuthor().getDiscriminatedName(), replyingTo.getReadableContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
String format = MainConfig.getString((isAdmin) ? ConfigurationEntry.DISCORD_ADMIN_FORMAT : ConfigurationEntry.DISCORD_FORMAT);
|
|
||||||
format = format.replace("{TAG}", author.getDiscriminatedName());
|
|
||||||
format = format.replace("{USERNAME}", author.getName());
|
|
||||||
BaseComponent[] components = TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', String.format(format, content)));
|
|
||||||
TextComponent component = new TextComponent(reply);
|
|
||||||
|
|
||||||
for (BaseComponent baseComponent : components) {
|
|
||||||
component.addExtra(baseComponent);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(message.getMessageAttachments().size() > 0) {
|
|
||||||
int i = 0;
|
|
||||||
for (MessageAttachment messageAttachment : message.getMessageAttachments()) {
|
|
||||||
String url = messageAttachment.getProxyUrl().toString();
|
|
||||||
ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL, url);
|
|
||||||
TextComponent warningComponent = new TextComponent("WARNING: By clicking on this text, your client will open:\n\n");
|
|
||||||
warningComponent.setColor(net.md_5.bungee.api.ChatColor.RED);
|
|
||||||
warningComponent.setBold(true);
|
|
||||||
TextComponent urlComponent = new TextComponent(url);
|
|
||||||
urlComponent.setColor(net.md_5.bungee.api.ChatColor.DARK_AQUA);
|
|
||||||
urlComponent.setUnderlined(true);
|
|
||||||
urlComponent.setBold(false);
|
|
||||||
warningComponent.addExtra(urlComponent);
|
|
||||||
HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new BaseComponent[]{warningComponent});
|
|
||||||
TextComponent mediaComponent = new TextComponent((i == 0 && content.isEmpty()) ? "[Media]" : " [Media]");
|
|
||||||
mediaComponent.setColor(net.md_5.bungee.api.ChatColor.YELLOW);
|
|
||||||
mediaComponent.setClickEvent(clickEvent);
|
|
||||||
mediaComponent.setHoverEvent(hoverEvent);
|
|
||||||
component.addExtra(mediaComponent);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isAdmin) {
|
|
||||||
for (org.bukkit.entity.Player player : Bukkit.getOnlinePlayers())
|
|
||||||
{
|
|
||||||
if (AdminList.isSuperAdmin(player))
|
|
||||||
{
|
|
||||||
player.spigot().sendMessage(component);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Bukkit.spigot().broadcast(component);
|
|
||||||
}
|
|
||||||
Log.info(component.toPlainText());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void load() {
|
transmitMessage("**Server has stopped**", true);
|
||||||
|
|
||||||
if (Boolean.FALSE.equals(MainConfig.getBoolean(ConfigurationEntry.DISCORD_IS_ENABLED))) {
|
Log.info("TFM 4.3 Reloaded Discord stopped.");
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
public static String fullySanitizeDiscordMessage(String message) {
|
||||||
DISCORD_API = new DiscordApiBuilder()
|
String partiallySanitized = sanitizeMessage(message);
|
||||||
.setToken(MainConfig.getString(ConfigurationEntry.DISCORD_TOKEN))
|
return partiallySanitized.replaceAll("([`_~*|\\\\])", "\\\\$1");
|
||||||
.login()
|
}
|
||||||
.join();
|
|
||||||
|
|
||||||
Optional<TextChannel> channelFuture = DISCORD_API.getTextChannelById(MainConfig.getString(ConfigurationEntry.DISCORD_CHANNEL));
|
|
||||||
Optional<TextChannel> adminChannelFuture = DISCORD_API.getTextChannelById(MainConfig.getString(ConfigurationEntry.DISCORD_ADMIN_CHANNEL));
|
|
||||||
|
|
||||||
if (!channelFuture.isPresent()) {
|
|
||||||
Log.warning("TFM 4.3 Reloaded could not find your channel, stopping!");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CHANNEL = channelFuture.get();
|
|
||||||
adminChannelFuture.ifPresent(textChannel -> ADMIN_CHANNEL = textChannel);
|
|
||||||
COMMAND_MANAGER = new DiscordCommandManager();
|
|
||||||
COMMAND_MANAGER.init();
|
|
||||||
|
|
||||||
CHANNEL.addMessageCreateListener(DiscordBridge::onMessageCreateEvent);
|
|
||||||
if (adminChannelFuture.isPresent()) {
|
|
||||||
ADMIN_CHANNEL.addMessageCreateListener(DiscordBridge::onMessageCreateEvent);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.warning("Uh oh! It looks like TFM 4.3 Reloaded Discord couldn't start! Please check you have defined the bot's token & channel and also given it the correct permissions! (Read Messages and Send Messages)");
|
|
||||||
Log.warning("If you've already set that up however, you may to read the exception below.");
|
|
||||||
Log.warning("If this is a bug with TFM 4.3 Reloaded, please report it at https://github.com/TheDeus-Group/TFM-4.3-Reloaded/issues or https://code.cat.casa/TheDeus-Group/TFM-4.3-Reloaded/issues");
|
|
||||||
e.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.info("TFM 4.3 Reloaded Discord started.");
|
|
||||||
|
|
||||||
transmitMessage("**Server has started**");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String sanitizeMessage(String message) {
|
|
||||||
Pattern colors = Pattern.compile("§.", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
|
|
||||||
Pattern pings = Pattern.compile("@", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
|
|
||||||
|
|
||||||
if (message.length() > 2000) {
|
|
||||||
message = message.substring(0, 2000);
|
|
||||||
}
|
|
||||||
|
|
||||||
return message.replaceAll(colors.pattern(), "").replaceAll(pings.pattern(), "@\u200B");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void transmitMessage(String message) {
|
|
||||||
transmitMessage(message, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void transmitMessage(String message, boolean disconnectAfterwards) {
|
|
||||||
if (CHANNEL == null) return;
|
|
||||||
if (!disconnectAfterwards) {
|
|
||||||
CHANNEL.sendMessage(sanitizeMessage(message));
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
CHANNEL.sendMessage(sanitizeMessage(message)).get();
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
CountDownLatch shutdownWaiter = new CountDownLatch(1);
|
|
||||||
|
|
||||||
Thread t = new Thread(() -> {
|
|
||||||
DISCORD_API.addLostConnectionListener(lostConnectionEvent -> shutdownWaiter.countDown());
|
|
||||||
DISCORD_API.disconnect();
|
|
||||||
|
|
||||||
try {
|
|
||||||
shutdownWaiter.await(30, TimeUnit.SECONDS);
|
|
||||||
} catch (InterruptedException ignored) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
t.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void transmitAdminMessage(String message) {
|
|
||||||
transmitAdminMessage(message, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void transmitAdminMessage(String message, boolean disconnectAfterwards) {
|
|
||||||
if (ADMIN_CHANNEL == null) return;
|
|
||||||
if (!disconnectAfterwards) {
|
|
||||||
ADMIN_CHANNEL.sendMessage(sanitizeMessage(message));
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
ADMIN_CHANNEL.sendMessage(sanitizeMessage(message)).get();
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
DISCORD_API.disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void stop() {
|
|
||||||
|
|
||||||
if (Boolean.FALSE.equals(MainConfig.getBoolean(ConfigurationEntry.DISCORD_IS_ENABLED))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
transmitMessage("**Server has stopped**", true);
|
|
||||||
|
|
||||||
Log.info("TFM 4.3 Reloaded Discord stopped.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String fullySanitizeDiscordMessage(String message)
|
|
||||||
{
|
|
||||||
String partiallySanitized = sanitizeMessage(message);
|
|
||||||
return partiallySanitized.replaceAll("([`_~*|\\\\])", "\\\\$1");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,9 @@ public class PlayerListener implements Listener {
|
||||||
"I love FreedomForever!", "I'm here to collect my cupcake.", "Do you have any cupcakes?",
|
"I love FreedomForever!", "I'm here to collect my cupcake.", "Do you have any cupcakes?",
|
||||||
"I like pineapple pizza.", "Do you have any pineapple pizza?",
|
"I like pineapple pizza.", "Do you have any pineapple pizza?",
|
||||||
"I dislike Cherry Pepsi Max.",
|
"I dislike Cherry Pepsi Max.",
|
||||||
"Guys, did you know my father is getting milk? He hasn't been back for hours, I'm worried...");
|
"Guys, did you know my father is getting milk? He hasn't been back for hours, I'm worried...",
|
||||||
|
"My wife's boyfriend is a nice guy.", "My wife's boyfriend got me a new Switch!",
|
||||||
|
"My wife's boyfriend got me a new PS5!");
|
||||||
public static final int MSG_PER_HEARTBEAT = 10;
|
public static final int MSG_PER_HEARTBEAT = 10;
|
||||||
public static final int DEFAULT_PORT = 25565;
|
public static final int DEFAULT_PORT = 25565;
|
||||||
public static final int MAX_XY_COORD = 30000000;
|
public static final int MAX_XY_COORD = 30000000;
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package me.StevenLawson.TotalFreedomMod.player;
|
package me.StevenLawson.TotalFreedomMod.player;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.bridge.EssentialsBridge;
|
import me.StevenLawson.TotalFreedomMod.bridge.EssentialsBridge;
|
||||||
import me.StevenLawson.TotalFreedomMod.commands.AdminLevel;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.manager.UUIDManager;
|
||||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.google.common.collect.Sets;
|
||||||
import me.StevenLawson.TotalFreedomMod.Log;
|
import me.StevenLawson.TotalFreedomMod.Log;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import me.StevenLawson.TotalFreedomMod.config.Configuration;
|
import me.StevenLawson.TotalFreedomMod.config.Configuration;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.manager.UUIDManager;
|
||||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue