-Make /saconfig clean a "Telnet Senior" command only.

-Move some TwitterBot stuff around.
This commit is contained in:
StevenLawson 2013-09-27 08:46:42 -04:00
parent 1e79b90249
commit 9f889efa76
5 changed files with 44 additions and 40 deletions

View File

@ -1,5 +1,5 @@
#Tue, 24 Sep 2013 20:09:17 -0400 #Fri, 27 Sep 2013 08:45:15 -0400
program.VERSION=3.2 program.VERSION=3.2
program.BUILDNUM=611 program.BUILDNUM=613
program.BUILDDATE=09/24/2013 08\:09 PM program.BUILDDATE=09/27/2013 08\:45 AM

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit! #Build Number for ANT. Do not edit!
#Tue Sep 24 20:09:17 EDT 2013 #Fri Sep 27 08:45:15 EDT 2013
build.number=612 build.number=614

View File

@ -27,7 +27,7 @@ public class Command_saconfig extends TFM_Command
} }
else else
{ {
if (sender instanceof Player && !TFM_SuperadminList.isSeniorAdmin(sender)) if (!TFM_SuperadminList.isSeniorAdmin(sender, true))
{ {
playerMsg(TotalFreedomMod.MSG_NO_PERMS); playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;
@ -151,43 +151,11 @@ public class Command_saconfig extends TFM_Command
TFM_Util.adminAction(sender.getName(), "Removing " + targetName + " from the superadmin list", true); TFM_Util.adminAction(sender.getName(), "Removing " + targetName + " from the superadmin list", true);
TFM_SuperadminList.removeSuperadmin(targetName); TFM_SuperadminList.removeSuperadmin(targetName);
if (!TFM_ConfigEntry.TWITTERBOT_ENABLED.getBoolean())
{
return true;
}
// Twitterbot // Twitterbot
TFM_TwitterHandler twitterbot = TFM_TwitterHandler.getInstance(); if (TFM_ConfigEntry.TWITTERBOT_ENABLED.getBoolean())
String reply = twitterbot.delTwitter(targetName);
if ("ok".equals(reply))
{ {
TFM_Util.adminAction(sender.getName(), "Removing " + targetName + " from TwitterBot", true); TFM_TwitterHandler.getInstance().delTwitterVerbose(targetName, sender);
} }
else if ("disabled".equals(reply))
{
TFM_Util.playerMsg(sender, "Warning: Could not check if player has a twitter handle!");
TFM_Util.playerMsg(sender, "TwitterBot has been temporarily disabled, please wait until it gets re-enabled", ChatColor.RED);
}
else if ("failed".equals(reply))
{
TFM_Util.playerMsg(sender, "Warning: Could not check if player has a twitter handle!");
TFM_Util.playerMsg(sender, "There was a problem querying the database, please let a developer know.", ChatColor.RED);
}
else if ("false".equals(reply))
{
TFM_Util.playerMsg(sender, "Warning: Could not check if player has a twitter handle!");
TFM_Util.playerMsg(sender, "There was a problem with the database, please let a developer know.", ChatColor.RED);
}
else if ("cannotauth".equals(reply))
{
TFM_Util.playerMsg(sender, "Warning: Could not check if player has a twitter handle!");
TFM_Util.playerMsg(sender, "The database password is incorrect, please let a developer know.", ChatColor.RED);
}
else if ("notfound".equals(reply))
{
TFM_Util.playerMsg(sender, targetName + " did not have a twitter handle registered to their name.", ChatColor.GREEN);
}
} }
else else
{ {

View File

@ -428,6 +428,7 @@ public class TFM_SuperadminList
superadmin.setActivated(false); superadmin.setActivated(false);
Command_logs.deactivateSuperadmin(superadmin); Command_logs.deactivateSuperadmin(superadmin);
TFM_TwitterHandler.getInstance().delTwitter(superadmin.getName());
} }
} }
} }

View File

@ -4,6 +4,8 @@ import java.io.BufferedReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
public class TFM_TwitterHandler public class TFM_TwitterHandler
{ {
@ -30,6 +32,39 @@ public class TFM_TwitterHandler
return request("action=deltwitter&player=" + player); return request("action=deltwitter&player=" + player);
} }
public void delTwitterVerbose(String targetName, CommandSender sender)
{
final String reply = delTwitter(targetName);
if ("ok".equals(reply))
{
TFM_Util.adminAction(sender.getName(), "Removing " + targetName + " from TwitterBot", true);
}
else if ("disabled".equals(reply))
{
TFM_Util.playerMsg(sender, "Warning: Could not check if player has a twitter handle!");
TFM_Util.playerMsg(sender, "TwitterBot has been temporarily disabled, please wait until it gets re-enabled", ChatColor.RED);
}
else if ("failed".equals(reply))
{
TFM_Util.playerMsg(sender, "Warning: Could not check if player has a twitter handle!");
TFM_Util.playerMsg(sender, "There was a problem querying the database, please let a developer know.", ChatColor.RED);
}
else if ("false".equals(reply))
{
TFM_Util.playerMsg(sender, "Warning: Could not check if player has a twitter handle!");
TFM_Util.playerMsg(sender, "There was a problem with the database, please let a developer know.", ChatColor.RED);
}
else if ("cannotauth".equals(reply))
{
TFM_Util.playerMsg(sender, "Warning: Could not check if player has a twitter handle!");
TFM_Util.playerMsg(sender, "The database password is incorrect, please let a developer know.", ChatColor.RED);
}
else if ("notfound".equals(reply))
{
TFM_Util.playerMsg(sender, targetName + " did not have a twitter handle registered to their name.", ChatColor.GREEN);
}
}
public String isEnabled() public String isEnabled()
{ {
return request("action=getstatus"); return request("action=getstatus");