TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unlinkreddit.java
Seth 81df3103b6
Some updates
- Added Reddit flair sync
- Removed magical saddle because the stacking potato does the same thing
- Some internal improvements
- Fixed bug where if a service throws an error while starting or stopping it breaks the entire plugin
2020-08-04 15:16:11 -07:00

42 lines
1.3 KiB
Java

package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank;
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 = "Unlink your reddit account", usage = "/<command>")
public class Command_unlinkreddit extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!plugin.rd.enabled)
{
msg("The reddit system is currently disabled.", ChatColor.RED);
return true;
}
PlayerData data = getData(playerSender);
if (data.getRedditUsername() == null)
{
msg("You don't have a reddit account linked.", ChatColor.RED);
return true;
}
plugin.rd.removeFlair(data.getRedditUsername());
data.setRedditUsername(null);
plugin.pl.save(data);
msg("Successfully unlinked your reddit account. If you had a flair, it was removed.", ChatColor.GREEN);
return true;
}
}