Bug fixes and improvements (#16)

* Bug fixes and improvements

* Re-add Marco's name

* Actually make the logfile page load.
This commit is contained in:
Seth
2018-01-01 19:46:35 -07:00
committed by Lemon
parent 059bf14d90
commit 3f360a4d5e
12 changed files with 138 additions and 20 deletions
@@ -38,12 +38,14 @@ public class Command_doom extends FreedomCommand
final String ip = player.getAddress().getAddress().getHostAddress().trim();
// Remove from superadmin
// Remove from admin
Admin admin = getAdmin(player);
if (admin != null)
{
FUtil.adminAction(sender.getName(), "Removing " + player.getName() + " from the superadmin list", true);
plugin.al.removeAdmin(admin);
FUtil.adminAction(sender.getName(), "Removing " + player.getName() + " from the admin list", true);
admin.setActive(false);
plugin.al.save();
plugin.al.updateTables();
}
// Remove from whitelist
@@ -89,7 +89,8 @@ public class Command_gtfo extends FreedomCommand
// Broadcast
final StringBuilder bcast = new StringBuilder()
.append(ChatColor.RED)
.append("Banning: ")
.append(sender.getName())
.append(" - Banning ")
.append(player.getName())
.append(", IP: ")
.append(ip);
@@ -38,7 +38,7 @@ public class Command_opall extends FreedomCommand
player.setOp(true);
player.sendMessage(FreedomCommand.YOU_ARE_OP);
if (doSetGamemode && !plugin.al.isAdmin(player))
if (doSetGamemode && !player.getGameMode().equals(GameMode.SPECTATOR))
{
player.setGameMode(targetGamemode);
}
@@ -21,7 +21,7 @@ public class Command_radar extends FreedomCommand
{
Location playerSenderos = playerSender.getLocation();
List<TFM_RadarData> radar_data = new ArrayList<>();
List<RadarData> radar_data = new ArrayList<>();
for (Player player : playerSenderos.getWorld().getPlayers())
{
@@ -29,7 +29,7 @@ public class Command_radar extends FreedomCommand
{
try
{
radar_data.add(new TFM_RadarData(player, playerSenderos.distance(player.getLocation()), player.getLocation()));
radar_data.add(new RadarData(player, playerSenderos.distance(player.getLocation()), player.getLocation()));
}
catch (IllegalArgumentException ex)
{
@@ -43,7 +43,7 @@ public class Command_radar extends FreedomCommand
return true;
}
Collections.sort(radar_data, new TFM_RadarData());
Collections.sort(radar_data, new RadarData());
msg("People nearby in " + playerSenderos.getWorld().getName() + ":", ChatColor.YELLOW);
@@ -59,7 +59,7 @@ public class Command_radar extends FreedomCommand
}
}
for (TFM_RadarData i : radar_data)
for (RadarData i : radar_data)
{
msg(String.format("%s - %d",
i.player.getName(),
@@ -74,26 +74,26 @@ public class Command_radar extends FreedomCommand
return true;
}
private class TFM_RadarData implements Comparator<TFM_RadarData>
private class RadarData implements Comparator<RadarData>
{
public Player player;
public double distance;
public Location location;
public TFM_RadarData(Player player, double distance, Location location)
public RadarData(Player player, double distance, Location location)
{
this.player = player;
this.distance = distance;
this.location = location;
}
public TFM_RadarData()
public RadarData()
{
}
@Override
public int compare(TFM_RadarData t1, TFM_RadarData t2)
public int compare(RadarData t1, RadarData t2)
{
if (t1.distance > t2.distance)
{
@@ -29,7 +29,7 @@ public class Command_saconfig extends FreedomCommand
{
case "list":
{
msg("Superadmins: " + StringUtils.join(plugin.al.getAdminNames(), ", "), ChatColor.GOLD);
msg("Admins: " + StringUtils.join(plugin.al.getAdminNames(), ", "), ChatColor.GOLD);
return true;
}
@@ -41,7 +41,7 @@ public class Command_saconfig extends FreedomCommand
FUtil.adminAction(sender.getName(), "Cleaning admin list", true);
plugin.al.deactivateOldEntries(true);
msg("Superadmins: " + StringUtils.join(plugin.al.getAdminNames(), ", "), ChatColor.GOLD);
msg("Admins: " + StringUtils.join(plugin.al.getAdminNames(), ", "), ChatColor.GOLD);
return true;
}
@@ -124,7 +124,7 @@ public class Command_saconfig extends FreedomCommand
if (admin == null)
{
msg("Superadmin not found: " + args[1]);
msg("Admin not found: " + args[1]);
}
else
{
@@ -220,7 +220,7 @@ public class Command_saconfig extends FreedomCommand
if (admin == null)
{
msg("Superadmin not found: " + args[1]);
msg("Admin not found: " + args[1]);
return true;
}
@@ -65,7 +65,7 @@ public class Command_verify extends FreedomCommand
{
plugin.dc.VERIFY_CODES.remove(code);
FUtil.bcastMsg(playerSender.getName() + " has verified themself!", ChatColor.GOLD);
FUtil.adminAction(ConfigEntry.SERVER_NAME.getString(), "Readding " + admin.getName() + " to the staff list", true);
FUtil.adminAction(ConfigEntry.SERVER_NAME.getString(), "Readding " + admin.getName() + " to the admin list", true);
if (playerSender != null)
{
admin.setName(playerSender.getName());