mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-11 21:43:54 +00:00
More discord stuff
This commit is contained in:
@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
@ -49,6 +50,10 @@ public class Command_doom extends FreedomCommand
|
||||
admin.setActive(false);
|
||||
plugin.al.save();
|
||||
plugin.al.updateTables();
|
||||
if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
|
||||
{
|
||||
plugin.dc.syncRoles(admin);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove from whitelist
|
||||
|
@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.Arrays;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.pravian.aero.util.Ips;
|
||||
@ -12,7 +13,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Manage my admin entry", usage = "/<command> [-o <admin>] <clearips | clearip <ip> | setlogin <message> | clearlogin | setacformat <format> | clearacformat> | oldtags | logstick>")
|
||||
@CommandParameters(description = "Manage my admin entry", usage = "/<command> [-o <admin>] <clearips | clearip <ip> | setlogin <message> | clearlogin | setacformat <format> | clearacformat> | oldtags | logstick | syncroles>")
|
||||
public class Command_myadmin extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -206,6 +207,34 @@ public class Command_myadmin extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
case "syncroles":
|
||||
{
|
||||
if (plugin.dc.enabled)
|
||||
{
|
||||
if (!ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
|
||||
{
|
||||
msg("Role syncing is not enabled.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
boolean synced = plugin.dc.syncRoles(target);
|
||||
if (target.getDiscordID() == null)
|
||||
{
|
||||
msg("Please run /linkdiscord first!", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
if (synced)
|
||||
{
|
||||
msg("Successfully synced your roles.", ChatColor.GREEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("Failed to sync your roles, please check the console.", ChatColor.RED);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
|
@ -47,6 +47,11 @@ public class Command_report extends FreedomCommand
|
||||
String report = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
||||
plugin.cm.reportAction(playerSender, player, report);
|
||||
|
||||
if (plugin.dc.enabled)
|
||||
{
|
||||
plugin.dc.sendReport(playerSender, player, report);
|
||||
}
|
||||
|
||||
msg(ChatColor.GREEN + "Thank you, your report has been successfully logged.");
|
||||
|
||||
return true;
|
||||
|
@ -6,8 +6,10 @@ import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilder;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.pravian.aero.util.Ips;
|
||||
@ -108,6 +110,11 @@ public class Command_saconfig extends FreedomCommand
|
||||
plugin.rm.updateDisplay(player);
|
||||
}
|
||||
|
||||
if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
|
||||
{
|
||||
plugin.dc.syncRoles(admin);
|
||||
}
|
||||
|
||||
msg("Set " + admin.getName() + "'s rank to " + rank.getName());
|
||||
return true;
|
||||
}
|
||||
@ -206,6 +213,21 @@ public class Command_saconfig extends FreedomCommand
|
||||
{
|
||||
plugin.rm.updateDisplay(player);
|
||||
}
|
||||
|
||||
// Attempt to find discord account
|
||||
if (plugin.mbl.isMasterBuilder(player))
|
||||
{
|
||||
MasterBuilder masterBuilder = plugin.mbl.getMasterBuilder(player);
|
||||
admin.setDiscordID(plugin.mbl.getMasterBuilder(player).getDiscordID());
|
||||
}
|
||||
else if (plugin.pv.getVerificationPlayer(admin.getName()) != null)
|
||||
{
|
||||
VPlayer vPlayer = plugin.pv.getVerificationPlayer(admin.getName());
|
||||
if (vPlayer.getDiscordId() != null)
|
||||
{
|
||||
admin.setDiscordID(vPlayer.getDiscordId());
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Existing admin
|
||||
{
|
||||
@ -248,12 +270,32 @@ public class Command_saconfig extends FreedomCommand
|
||||
admin.setActive(true);
|
||||
admin.setLastLogin(new Date());
|
||||
|
||||
// Attempt to find discord account
|
||||
if (plugin.mbl.isMasterBuilder(player))
|
||||
{
|
||||
MasterBuilder masterBuilder = plugin.mbl.getMasterBuilder(player);
|
||||
admin.setDiscordID(plugin.mbl.getMasterBuilder(player).getDiscordID());
|
||||
}
|
||||
else if (plugin.pv.getVerificationPlayer(admin.getName()) != null)
|
||||
{
|
||||
VPlayer vPlayer = plugin.pv.getVerificationPlayer(admin.getName());
|
||||
if (vPlayer.getDiscordId() != null)
|
||||
{
|
||||
admin.setDiscordID(vPlayer.getDiscordId());
|
||||
}
|
||||
}
|
||||
|
||||
plugin.al.save();
|
||||
plugin.al.updateTables();
|
||||
if (player != null)
|
||||
{
|
||||
plugin.rm.updateDisplay(player);
|
||||
}
|
||||
|
||||
if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
|
||||
{
|
||||
plugin.dc.syncRoles(admin);
|
||||
}
|
||||
}
|
||||
|
||||
if (player != null)
|
||||
@ -302,6 +344,12 @@ public class Command_saconfig extends FreedomCommand
|
||||
{
|
||||
plugin.rm.updateDisplay(player);
|
||||
}
|
||||
|
||||
if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
|
||||
{
|
||||
plugin.dc.syncRoles(admin);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user