Many changes for TFM 5.0

Refractoring
Reworked /saconfig
Reworked part of the command system
Removed unused config sections
Refractored part of the config
Fixed bugs with admin list
Actually allow CONSOLE to have senior perms
This commit is contained in:
JeromSar 2016-03-02 20:28:01 +01:00
parent 19ced05110
commit 055973aa37
143 changed files with 939 additions and 954 deletions

18
pom.xml
View File

@ -48,12 +48,6 @@
</repositories>
<dependencies>
<dependency>
<groupId>net.pravian</groupId>
<artifactId>Aero</artifactId>
<version>2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
@ -65,11 +59,19 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.7-R0.1-SNAPSHOT</version>
<version>1.9-R0.1-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/Spigot-1.9.jar</systemPath>
</dependency>
<dependency>
<groupId>net.pravian</groupId>
<artifactId>aero</artifactId>
<version>2.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/Aero-2.0.jar</systemPath>
</dependency>
<dependency>
<groupId>net.totalfreedom</groupId>
<artifactId>bukkittelnet</artifactId>
@ -176,7 +178,7 @@
<configuration>
<outputFileName>TotalFreedomMod.jar</outputFileName>
<compilerVersion>1.7</compilerVersion>
<source>1.6</source>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>

View File

@ -26,7 +26,7 @@ public class EntityWiper extends FreedomService
private static final long WIPE_RATE = 5 * 20L;
//
private final List<Class<? extends Entity>> wipables = new ArrayList<Class<? extends Entity>>();
private final List<Class<? extends Entity>> wipables = new ArrayList<>();
//
private BukkitTask wipeTask;

View File

@ -14,8 +14,8 @@ import java.util.List;
import java.util.Random;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.banning.Ban;
import me.totalfreedom.totalfreedommod.commands.Command_trail;
import me.totalfreedom.totalfreedommod.commands.FreedomCommand;
import me.totalfreedom.totalfreedommod.command.Command_trail;
import me.totalfreedom.totalfreedommod.command.FreedomCommand;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.config.MainConfig;
import me.totalfreedom.totalfreedommod.player.FPlayer;
@ -162,7 +162,7 @@ public class FrontDoor extends FreedomService
event.setCancelled(true);
final FreedomCommand dispatcher = FreedomCommand.getCommand(command);
final FreedomCommand dispatcher = FreedomCommand.getFrom(command);
if (dispatcher == null)
{
@ -530,7 +530,7 @@ public class FrontDoor extends FreedomService
if (!allowDevs)
{
List<Player> allowedPlayers = new ArrayList<Player>();
List<Player> allowedPlayers = new ArrayList<>();
for (Player player : players)
{
if (!FUtil.DEVELOPERS.contains(player.getName()))

View File

@ -12,7 +12,7 @@ import org.bukkit.World;
public class GameRuleHandler extends FreedomService
{
private final Map<GameRule, Boolean> rules = new EnumMap<GameRule, Boolean>(GameRule.class);
private final Map<GameRule, Boolean> rules = new EnumMap<>(GameRule.class);
public GameRuleHandler(TotalFreedomMod plugin)
{

View File

@ -1,6 +1,8 @@
package me.totalfreedom.totalfreedommod;
import java.util.regex.Pattern;
import lombok.Getter;
import lombok.Setter;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FSync;
import me.totalfreedom.totalfreedommod.util.FUtil;
@ -15,9 +17,14 @@ import org.bukkit.scheduler.BukkitRunnable;
public class LoginProcess extends FreedomService
{
public static final int DEFAULT_PORT = 25565;
public static final int MIN_USERNAME_LENGTH = 2;
public static final int MAX_USERNAME_LENGTH = 20;
public static final Pattern USERNAME_REGEX = Pattern.compile("^[\\w\\d_]{3,20}$");
//
@Getter
@Setter
private boolean lockdownEnabled = false;
public LoginProcess(TotalFreedomMod plugin)
{
@ -71,7 +78,7 @@ public class LoginProcess extends FreedomService
final String ip = event.getAddress().getHostAddress().trim();
// Check username length
if (username.length() < 3 || username.length() > TotalFreedomMod.MAX_USERNAME_LENGTH)
if (username.length() < MIN_USERNAME_LENGTH || username.length() > MAX_USERNAME_LENGTH)
{
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Your username is an invalid length (must be between 3 and 20 characters long).");
return;
@ -154,7 +161,7 @@ public class LoginProcess extends FreedomService
}
// Lockdown mode
if (TotalFreedomMod.lockdownEnabled)
if (lockdownEnabled)
{
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Server is currently in lockdown mode.");
return;
@ -186,7 +193,7 @@ public class LoginProcess extends FreedomService
player.sendMessage(ChatColor.RED + "Server is currently closed to non-superadmins.");
}
if (TotalFreedomMod.lockdownEnabled)
if (lockdownEnabled)
{
FUtil.playerMsg(player, "Warning: Server is currenty in lockdown-mode, new players will not be able to join!", ChatColor.RED);
}

View File

@ -26,7 +26,7 @@ import org.bukkit.util.Vector;
public class ProtectArea extends FreedomService
{
public static final String DATA_FILENAME = "protectedareas.dat";
public static final double MAX_RADIUS = 50.0;
//
private final Map<String, SerializableProtectedRegion> areas = Maps.newHashMap();
@ -44,7 +44,7 @@ public class ProtectArea extends FreedomService
return;
}
File input = new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.PROTECTED_AREA_FILENAME);
File input = new File(TotalFreedomMod.plugin.getDataFolder(), DATA_FILENAME);
try
{
if (input.exists())
@ -76,7 +76,7 @@ public class ProtectArea extends FreedomService
{
try
{
FileOutputStream fos = new FileOutputStream(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.PROTECTED_AREA_FILENAME));
FileOutputStream fos = new FileOutputStream(new File(TotalFreedomMod.plugin.getDataFolder(), DATA_FILENAME));
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(areas);
oos.close();

View File

@ -61,8 +61,8 @@ public class ServerPing extends FreedomService
.replace("%mcversion%", plugin.si.getVersion())));
return;
}
// Colorful MOTD
// Colorful MOTD
final StringBuilder motd = new StringBuilder();
for (String word : ConfigEntry.SERVER_MOTD.getString().replace("%mcversion%", plugin.si.getVersion()).split(" "))

View File

@ -25,6 +25,7 @@ import org.json.simple.JSONValue;
public class ServiceChecker extends FreedomService
{
public static final long SERVICE_CHECKER_RATE = 120L;
@Getter
private final Map<String, ServiceStatus> services = Maps.newHashMap();
@ -69,7 +70,7 @@ public class ServiceChecker extends FreedomService
return;
}
task = getUpdateRunnable().runTaskTimerAsynchronously(TotalFreedomMod.plugin, 40L, TotalFreedomMod.SERVICE_CHECKER_RATE * 20L);
task = getUpdateRunnable().runTaskTimerAsynchronously(TotalFreedomMod.plugin, 40L, SERVICE_CHECKER_RATE * 20L);
}
@Override
@ -165,7 +166,7 @@ public class ServiceChecker extends FreedomService
public List<ServiceStatus> getAllStatuses()
{
List<ServiceStatus> servicesList = new ArrayList<ServiceStatus>();
List<ServiceStatus> servicesList = new ArrayList<>();
for (String key : services.keySet())
{
servicesList.add(services.get(key));

View File

@ -8,10 +8,6 @@ import me.totalfreedom.totalfreedommod.fun.ItemFun;
import me.totalfreedom.totalfreedommod.blocking.InteractBlocker;
import me.totalfreedom.totalfreedommod.blocking.EventBlocker;
import me.totalfreedom.totalfreedommod.blocking.BlockBlocker;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import me.totalfreedom.totalfreedommod.admin.AdminList;
import me.totalfreedom.totalfreedommod.banning.BanManager;
import me.totalfreedom.totalfreedommod.bridge.BukkitTelnetBridge;
@ -19,7 +15,7 @@ import me.totalfreedom.totalfreedommod.bridge.EssentialsBridge;
import me.totalfreedom.totalfreedommod.bridge.WorldEditBridge;
import me.totalfreedom.totalfreedommod.caging.Cager;
import me.totalfreedom.totalfreedommod.blocking.command.CommandBlocker;
import me.totalfreedom.totalfreedommod.commands.CommandLoader;
import me.totalfreedom.totalfreedommod.command.CommandLoader;
import me.totalfreedom.totalfreedommod.freeze.Freezer;
import me.totalfreedom.totalfreedommod.fun.Landminer;
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
@ -29,6 +25,10 @@ import me.totalfreedom.totalfreedommod.rollback.RollbackManager;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.world.WorldManager;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import net.pravian.aero.component.service.ServiceManager;
import net.pravian.aero.plugin.AeroPlugin;
import org.bukkit.scheduler.BukkitRunnable;
@ -37,15 +37,7 @@ import org.mcstats.Metrics;
public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
{
public static final long SERVICE_CHECKER_RATE = 120L;
public static final int MAX_USERNAME_LENGTH = 20;
//
public static final String CONFIG_FILENAME = "config.yml";
public static final String SUPERADMIN_FILENAME = "superadmin.yml";
public static final String PERMBAN_FILENAME = "permban.yml";
public static final String UUID_FILENAME = "uuids.db";
public static final String PROTECTED_AREA_FILENAME = "protectedareas.dat";
public static final String SAVED_FLAGS_FILENAME = "savedflags.dat";
//
public static final BuildProperties build = new BuildProperties();
//
@ -54,8 +46,6 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
public static String pluginName;
public static String pluginVersion;
//
public static boolean lockdownEnabled = false;
//
// Services
public ServiceManager<TotalFreedomMod> services;
public ServerInterface si;
@ -134,12 +124,12 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
FUtil.deleteFolder(new File("./_deleteme"));
// Create backups
FUtil.createBackups(CONFIG_FILENAME, true);
FUtil.createBackups(SUPERADMIN_FILENAME);
FUtil.createBackups(PERMBAN_FILENAME);
FUtil.createBackups(TotalFreedomMod.CONFIG_FILENAME, true);
FUtil.createBackups(AdminList.CONFIG_FILENAME);
FUtil.createBackups(PermbanList.CONFIG_FILENAME);
// Start services and bridgess
services = new ServiceManager<TotalFreedomMod>(plugin);
services = new ServiceManager<>(plugin);
si = services.registerService(ServerInterface.class);
wm = services.registerService(WorldManager.class);
al = services.registerService(AdminList.class);
@ -176,7 +166,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
services.start();
// Register bridges
bridges = new ServiceManager<TotalFreedomMod>(plugin);
bridges = new ServiceManager<>(plugin);
btb = bridges.registerService(BukkitTelnetBridge.class);
esb = bridges.registerService(EssentialsBridge.class);
web = bridges.registerService(WorldEditBridge.class);

View File

@ -95,8 +95,8 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
cs.set("active", activated);
cs.set("rank", rank.toString());
cs.set("ips", Lists.newArrayList(ips));
cs.set("last_login", lastLogin);
cs.set("login_message", null);
cs.set("last_login", FUtil.dateToString(lastLogin));
cs.set("login_message", loginMessage);
}
public boolean isAtLeast(PlayerRank pRank)

View File

@ -10,7 +10,8 @@ import java.util.concurrent.TimeUnit;
import lombok.Getter;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.commands.Command_logs;
import me.totalfreedom.totalfreedommod.command.Command_logs;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FLog;
@ -20,6 +21,7 @@ import net.pravian.aero.util.Ips;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -29,6 +31,8 @@ import org.bukkit.plugin.ServicePriority;
public class AdminList extends FreedomService
{
public static final String CONFIG_FILENAME = "admins.yml";
@Getter
private final Map<String, Admin> allAdmins = Maps.newHashMap(); // Includes disabled admins
// Only active admins below
@ -37,14 +41,13 @@ public class AdminList extends FreedomService
private final Map<String, Admin> nameTable = Maps.newHashMap();
private final Map<String, Admin> ipTable = Maps.newHashMap();
//
private int cleanThreshold = 24 * 7; // 1 Week in hours
private final YamlConfig config;
public AdminList(TotalFreedomMod plugin)
{
super(plugin);
this.config = new YamlConfig(TotalFreedomMod.plugin, TotalFreedomMod.SUPERADMIN_FILENAME, true);
this.config = new YamlConfig(TotalFreedomMod.plugin, CONFIG_FILENAME, true);
}
@Override
@ -75,8 +78,15 @@ public class AdminList extends FreedomService
allAdmins.clear();
for (String key : config.getKeys(false))
{
ConfigurationSection section = config.getConfigurationSection(key);
if (section == null)
{
logger.warning("Invalid admin list format: " + key);
continue;
}
Admin admin = new Admin(key);
admin.loadFrom(config.getConfigurationSection(key));
admin.loadFrom(section);
if (!admin.isValid())
{
@ -239,6 +249,12 @@ public class AdminList extends FreedomService
public boolean addAdmin(Admin admin, boolean overwrite)
{
if (!admin.isValid())
{
logger.warning("Could not add admin: " + admin.getConfigKey() + " Admin is missing details!");
return false;
}
final String key = admin.getConfigKey();
if (!overwrite && allAdmins.containsKey(key))
@ -259,9 +275,8 @@ public class AdminList extends FreedomService
public boolean removeAdmin(Admin admin)
{
// Remove admin, update views
if (allAdmins.remove(admin.getName().toLowerCase()) == null)
if (allAdmins.remove(admin.getConfigKey()) == null)
{
return false;
}
@ -316,20 +331,19 @@ public class AdminList extends FreedomService
final Player player = event.getPlayer();
final FPlayer fPlayer = plugin.pl.getPlayer(player);
boolean isAdmin = plugin.al.isAdmin(player);
if (isAdmin)
if (plugin.al.isAdmin(player))
{
// Verify strict IP match
if (!plugin.al.isIdentityMatched(player))
{
fPlayer.setSuperadminIdVerified(false);
FUtil.bcastMsg("Warning: " + player.getName() + " is an admin, but is using an account not registered to one of their ip-list.", ChatColor.RED);
}
else
if (plugin.al.isIdentityMatched(player))
{
fPlayer.setSuperadminIdVerified(true);
plugin.al.updateLastLogin(player);
}
else
{
fPlayer.setSuperadminIdVerified(false);
FUtil.bcastMsg("Warning: " + player.getName() + " is an admin, but is using an account not registered to one of their ip-list.", ChatColor.RED);
}
}
}
@ -419,7 +433,7 @@ public class AdminList extends FreedomService
final Date lastLogin = admin.getLastLogin();
final long lastLoginHours = TimeUnit.HOURS.convert(new Date().getTime() - lastLogin.getTime(), TimeUnit.MILLISECONDS);
if (lastLoginHours < cleanThreshold)
if (lastLoginHours < ConfigEntry.ADMINLIST_CLEAN_THESHOLD_HOURS.getInteger())
{
continue;
}

View File

@ -17,6 +17,7 @@ import org.bukkit.event.player.PlayerLoginEvent;
public class PermbanList extends FreedomService
{
public static final String CONFIG_FILENAME = "permbans.yml";
@Getter
private final Set<String> permbannedNames = Sets.newHashSet();
@ -34,7 +35,7 @@ public class PermbanList extends FreedomService
permbannedNames.clear();
permbannedIps.clear();
final YamlConfig config = new YamlConfig(TotalFreedomMod.plugin, TotalFreedomMod.PERMBAN_FILENAME, true);
final YamlConfig config = new YamlConfig(TotalFreedomMod.plugin, CONFIG_FILENAME, true);
config.load();
for (String name : config.getKeys(false))

View File

@ -12,9 +12,6 @@ import org.bukkit.plugin.Plugin;
public class WorldEditBridge extends FreedomService
{
private static WorldEditPlugin worldEditPlugin = null;
public WorldEditBridge(TotalFreedomMod plugin)
{
super(plugin);
@ -32,8 +29,8 @@ public class WorldEditBridge extends FreedomService
private WorldEditPlugin getWorldEditPlugin()
{
if (worldEditPlugin == null)
{
WorldEditPlugin worldEditPlugin = null;
try
{
Plugin we = Bukkit.getServer().getPluginManager().getPlugin("WorldEdit");
@ -49,43 +46,47 @@ public class WorldEditBridge extends FreedomService
{
FLog.severe(ex);
}
}
return worldEditPlugin;
}
private LocalSession getPlayerSession(Player player)
{
final WorldEditPlugin wep = getWorldEditPlugin();
if (wep == null)
{
return null;
}
try
{
final WorldEditPlugin wep = getWorldEditPlugin();
if (wep != null)
{
return wep.getSession(player);
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
return null;
}
}
private BukkitPlayer getBukkitPlayer(Player player)
{
final WorldEditPlugin wep = getWorldEditPlugin();
if (wep == null)
{
return null;
}
try
{
final WorldEditPlugin wep = getWorldEditPlugin();
if (wep != null)
{
return wep.wrapPlayer(player);
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
return null;
}
}
public void undo(Player player, int count)
{

View File

@ -15,7 +15,7 @@ public class CageData
private final FPlayer fPlayer;
//
private final List<BlockData> cageHistory = new ArrayList<BlockData>();
private final List<BlockData> cageHistory = new ArrayList<>();
//
@Getter
private boolean caged = false;

View File

@ -0,0 +1,11 @@
package me.totalfreedom.totalfreedommod.command;
public class CommandFailException extends RuntimeException {
private static final long serialVersionUID = -92333791173123L;
public CommandFailException(String message) {
super(message);
}
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import lombok.Getter;
import me.totalfreedom.totalfreedommod.FreedomService;
@ -17,7 +17,7 @@ public class CommandLoader extends FreedomService
{
super(plugin);
handler = new SimpleCommandHandler<TotalFreedomMod>(plugin);
handler = new SimpleCommandHandler<>(plugin);
}
@Override
@ -26,7 +26,9 @@ public class CommandLoader extends FreedomService
handler.clearCommands();
handler.setExecutorFactory(new FreedomCommandExecutor.FreedomExecutorFactory());
handler.setCommandClassPrefix("Command_");
handler.setPermissionMessage(ChatColor.YELLOW + "You do not have permission to use this command.");
handler.setPermissionMessage(ChatColor.RED + "You do not have permission to use this command.");
handler.setOnlyConsoleMessage(ChatColor.RED + "This command can only be used from the console.");
handler.setOnlyPlayerMessage(ChatColor.RED + "This command can only be used by players.");
handler.loadFrom(FreedomCommand.class.getPackage());
handler.registerAll("TotalFreedomMod", true);

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;
@ -23,13 +23,13 @@ public class Command_adminchat extends FreedomCommand
{
if (senderIsConsole)
{
playerMsg("Only in-game players can toggle AdminChat.");
msg("Only in-game players can toggle AdminChat.");
return true;
}
FPlayer userinfo = plugin.pl.getPlayer(playerSender);
userinfo.setAdminChat(!userinfo.inAdminChat());
playerMsg("Toggled Admin Chat " + (userinfo.inAdminChat() ? "on" : "off") + ".");
msg("Toggled Admin Chat " + (userinfo.inAdminChat() ? "on" : "off") + ".");
}
else
{

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;
@ -73,19 +73,19 @@ public class Command_adminworld extends FreedomCommand
if (adminWorld == null || playerSender.getWorld() == adminWorld)
{
playerMsg("Going to the main world.");
msg("Going to the main world.");
playerSender.teleport(server.getWorlds().get(0).getSpawnLocation());
}
else
{
if (plugin.wm.adminworld.canAccessWorld(playerSender))
{
playerMsg("Going to the AdminWorld.");
msg("Going to the AdminWorld.");
plugin.wm.adminworld.sendToWorld(playerSender);
}
else
{
playerMsg("You don't have permission to access the AdminWorld.");
msg("You don't have permission to access the AdminWorld.");
}
}
@ -97,7 +97,7 @@ public class Command_adminworld extends FreedomCommand
{
if ("list".equalsIgnoreCase(args[1]))
{
playerMsg("AdminWorld guest list: " + plugin.wm.adminworld.guestListToString());
msg("AdminWorld guest list: " + plugin.wm.adminworld.guestListToString());
}
else if ("purge".equalsIgnoreCase(args[1]))
{
@ -130,7 +130,7 @@ public class Command_adminworld extends FreedomCommand
}
else
{
playerMsg("Could not add player to guest list.");
msg("Could not add player to guest list.");
}
}
else if ("remove".equals(args[1]))
@ -142,7 +142,7 @@ public class Command_adminworld extends FreedomCommand
}
else
{
playerMsg("Can't find guest entry for: " + args[2]);
msg("Can't find guest entry for: " + args[2]);
}
}
else
@ -163,11 +163,11 @@ public class Command_adminworld extends FreedomCommand
if (timeOfDay != null)
{
plugin.wm.adminworld.setTimeOfDay(timeOfDay);
playerMsg("AdminWorld time set to: " + timeOfDay.name());
msg("AdminWorld time set to: " + timeOfDay.name());
}
else
{
playerMsg("Invalid time of day. Can be: sunrise, noon, sunset, midnight");
msg("Invalid time of day. Can be: sunrise, noon, sunset, midnight");
}
}
else
@ -187,11 +187,11 @@ public class Command_adminworld extends FreedomCommand
if (weatherMode != null)
{
plugin.wm.adminworld.setWeatherMode(weatherMode);
playerMsg("AdminWorld weather set to: " + weatherMode.name());
msg("AdminWorld weather set to: " + weatherMode.name());
}
else
{
playerMsg("Invalid weather mode. Can be: off, rain, storm");
msg("Invalid weather mode. Can be: off, rain, storm");
}
}
else

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;
@ -33,7 +33,7 @@ public class Command_blockcmd extends FreedomCommand
playerdata.setCommandsBlocked(false);
}
}
playerMsg("Unblocked commands for " + counter + " players.");
msg("Unblocked commands for " + counter + " players.");
return true;
}
@ -41,13 +41,13 @@ public class Command_blockcmd extends FreedomCommand
if (player == null)
{
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
if (isAdmin(sender))
{
playerMsg(player.getName() + " is a Superadmin, and cannot have their commands blocked.");
msg(player.getName() + " is a Superadmin, and cannot have their commands blocked.");
return true;
}
@ -56,7 +56,7 @@ public class Command_blockcmd extends FreedomCommand
playerdata.setCommandsBlocked(!playerdata.allCommandsBlocked());
FUtil.adminAction(sender.getName(), (playerdata.allCommandsBlocked() ? "B" : "Unb") + "locking all commands for " + player.getName(), true);
playerMsg((playerdata.allCommandsBlocked() ? "B" : "Unb") + "locked all commands.");
msg((playerdata.allCommandsBlocked() ? "B" : "Unb") + "locked all commands.");
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.Random;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import org.bukkit.command.Command;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.List;
@ -32,7 +32,7 @@ public class Command_cbtool extends FreedomCommand
if ("targetblock".equalsIgnoreCase(args[0]) && sender instanceof Player)
{
Block targetBlock = DepreciationAggregator.getTargetBlock(playerSender, null, 100);
playerMsg("Your target block: " + targetBlock.getLocation().toString());
msg("Your target block: " + targetBlock.getLocation().toString());
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;
@ -17,7 +17,7 @@ public class Command_cmdspy extends FreedomCommand
FPlayer playerdata = plugin.pl.getPlayer(playerSender);
playerdata.setCommandSpy(!playerdata.cmdspyEnabled());
playerMsg("CommandSpy " + (playerdata.cmdspyEnabled() ? "enabled." : "disabled."));
msg("CommandSpy " + (playerdata.cmdspyEnabled() ? "enabled." : "disabled."));
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.Iterator;
@ -25,7 +25,7 @@ public class Command_colorme extends FreedomCommand
if ("list".equalsIgnoreCase(args[0]))
{
playerMsg("Colors: " + StringUtils.join(FUtil.CHAT_COLOR_NAMES.keySet(), ", "));
msg("Colors: " + StringUtils.join(FUtil.CHAT_COLOR_NAMES.keySet(), ", "));
return true;
}
@ -44,7 +44,7 @@ public class Command_colorme extends FreedomCommand
if (color == null)
{
playerMsg("Invalid color: " + needle + " - Use \"/colorme list\" to list colors.");
msg("Invalid color: " + needle + " - Use \"/colorme list\" to list colors.");
return true;
}
@ -52,7 +52,7 @@ public class Command_colorme extends FreedomCommand
plugin.esb.setNickname(sender.getName(), newNick);
playerMsg("Your nickname is now: " + newNick);
msg("Your nickname is now: " + newNick);
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
@ -21,7 +21,7 @@ public class Command_commandlist extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
List<String> commands = new ArrayList<String>();
List<String> commands = new ArrayList<>();
for (Plugin targetPlugin : server.getPluginManager().getPlugins())
{

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;
@ -50,7 +50,7 @@ public class Command_creative extends FreedomCommand
if (!(senderIsConsole || isAdmin(sender)))
{
playerMsg("Only superadmins can change other user's gamemode.");
msg("Only superadmins can change other user's gamemode.");
return true;
}
@ -64,8 +64,8 @@ public class Command_creative extends FreedomCommand
}
playerMsg("Setting " + player.getName() + " to game mode 'Creative'.");
playerMsg(player, sender.getName() + " set your game mode to 'Creative'.");
msg("Setting " + player.getName() + " to game mode 'Creative'.");
msg(player, sender.getName() + " set your game mode to 'Creative'.");
player.setGameMode(GameMode.CREATIVE);
return true;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.Random;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.lang.reflect.Field;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
@ -38,7 +38,7 @@ public class Command_dispfill extends FreedomCommand
return true;
}
final List<ItemStack> items = new ArrayList<ItemStack>();
final List<ItemStack> items = new ArrayList<>();
final String[] itemsRaw = StringUtils.split(args[1], ",");
for (final String searchItem : itemsRaw)

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.admin.Admin;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FLog;
@ -25,7 +25,7 @@ public class Command_enchant extends FreedomCommand
if (itemInHand == null)
{
playerMsg("You are holding an invalid item.");
msg("You are holding an invalid item.");
return true;
}
@ -45,11 +45,11 @@ public class Command_enchant extends FreedomCommand
if (has_enchantments)
{
playerMsg(possible_ench.toString());
msg(possible_ench.toString());
}
else
{
playerMsg("The held item has no enchantments.");
msg("The held item has no enchantments.");
}
}
else if (args[0].equalsIgnoreCase("addall"))
@ -69,7 +69,7 @@ public class Command_enchant extends FreedomCommand
}
}
playerMsg("Added all possible enchantments for this item.");
msg("Added all possible enchantments for this item.");
}
else if (args[0].equalsIgnoreCase("reset"))
{
@ -78,7 +78,7 @@ public class Command_enchant extends FreedomCommand
itemInHand.removeEnchantment(ench);
}
playerMsg("Removed all enchantments.");
msg("Removed all enchantments.");
}
else
{
@ -99,7 +99,7 @@ public class Command_enchant extends FreedomCommand
if (ench == null)
{
playerMsg(args[1] + " is an invalid enchantment for the held item. Type \"/enchant list\" for valid enchantments for this item.");
msg(args[1] + " is an invalid enchantment for the held item. Type \"/enchant list\" for valid enchantments for this item.");
return true;
}
@ -109,18 +109,18 @@ public class Command_enchant extends FreedomCommand
{
itemInHand.addEnchantment(ench, ench.getMaxLevel());
playerMsg("Added enchantment: " + ench.getName());
msg("Added enchantment: " + ench.getName());
}
else
{
playerMsg("Can't use this enchantment on held item.");
msg("Can't use this enchantment on held item.");
}
}
else if (args[0].equals("remove"))
{
itemInHand.removeEnchantment(ench);
playerMsg("Removed enchantment: " + ench.getName());
msg("Removed enchantment: " + ench.getName());
}
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;
@ -15,7 +15,7 @@ public class Command_entitywipe extends FreedomCommand
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
FUtil.adminAction(sender.getName(), "Removing all server entities.", true);
playerMsg((plugin.ew.wipeEntities(true, true)) + " entities removed.");
msg((plugin.ew.wipeEntities(true, true)) + " entities removed.");
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
@ -44,7 +44,7 @@ public class Command_expel extends FreedomCommand
}
}
List<String> pushedPlayers = new ArrayList<String>();
List<String> pushedPlayers = new ArrayList<>();
final Vector senderPos = playerSender.getLocation().toVector();
final List<Player> players = playerSender.getWorld().getPlayers();
@ -78,11 +78,11 @@ public class Command_expel extends FreedomCommand
if (pushedPlayers.isEmpty())
{
playerMsg("No players pushed.");
msg("No players pushed.");
}
else
{
playerMsg("Pushed " + pushedPlayers.size() + " players: " + StringUtils.join(pushedPlayers, ", "));
msg("Pushed " + pushedPlayers.size() + " players: " + StringUtils.join(pushedPlayers, ", "));
}
return true;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import org.apache.commons.lang3.StringUtils;
@ -24,11 +24,11 @@ public class Command_findip extends FreedomCommand
if (player == null)
{
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
playerMsg("Player IPs: " + StringUtils.join(plugin.pl.getData(player).getIps(), ", "));
msg("Player IPs: " + StringUtils.join(plugin.pl.getData(player).getIps(), ", "));
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
@ -20,7 +20,7 @@ public class Command_flatlands extends FreedomCommand
}
else
{
playerMsg("Flatlands is currently disabled.");
msg("Flatlands is currently disabled.");
}
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;
@ -24,18 +24,18 @@ public class Command_freeze extends FreedomCommand
if (!allFrozen)
{
FUtil.adminAction(sender.getName(), "Disabling global player freeze", true);
playerMsg("Players are now free to move.");
msg("Players are now free to move.");
return true;
}
FUtil.adminAction(sender.getName(), "Disabling global player freeze", true);
playerMsg("Players are now unfrozen.");
msg("Players are now unfrozen.");
for (Player player : server.getOnlinePlayers())
{
if (!isAdmin(player))
{
playerMsg(player, "You have been frozen due to rulebreakers, you will be unfrozen soon.", ChatColor.RED);
msg(player, "You have been frozen due to rulebreakers, you will be unfrozen soon.", ChatColor.RED);
}
}
return true;
@ -52,15 +52,15 @@ public class Command_freeze extends FreedomCommand
if (player == null)
{
playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
return true;
}
final FreezeData fd = plugin.pl.getPlayer(player).getFreezeData();
fd.setFrozen(!fd.isFrozen());
playerMsg(player.getName() + " has been " + (fd.isFrozen() ? "frozen" : "unfrozen") + ".");
playerMsg(player, "You have been " + (fd.isFrozen() ? "frozen" : "unfrozen") + ".", ChatColor.AQUA);
msg(player.getName() + " has been " + (fd.isFrozen() ? "frozen" : "unfrozen") + ".");
msg(player, "You have been " + (fd.isFrozen() ? "frozen" : "unfrozen") + ".", ChatColor.AQUA);
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;
@ -43,7 +43,7 @@ public class Command_fuckoff extends FreedomCommand
player.setFuckoff(radius);
}
playerMsg("Fuckoff " + (player.isFuckOff() ? ("enabled. Radius: " + player.getFuckoffRadius() + ".") : "disabled."));
msg("Fuckoff " + (player.isFuckOff() ? ("enabled. Radius: " + player.getFuckoffRadius() + ".") : "disabled."));
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.nio.charset.StandardCharsets;
@ -73,7 +73,7 @@ public class Command_gadmin extends FreedomCommand
final GadminMode mode = GadminMode.findMode(args[0].toLowerCase());
if (mode == null)
{
playerMsg("Invalid mode: " + args[0], ChatColor.RED);
msg("Invalid mode: " + args[0], ChatColor.RED);
return true;
}
@ -81,7 +81,7 @@ public class Command_gadmin extends FreedomCommand
if (mode == GadminMode.LIST)
{
playerMsg("[ Real Name ] : [ Display Name ] - Hash:");
msg("[ Real Name ] : [ Display Name ] - Hash:");
while (it.hasNext())
{
final Player player = it.next();
@ -112,7 +112,7 @@ public class Command_gadmin extends FreedomCommand
if (target == null)
{
playerMsg("Invalid player hash: " + args[1], ChatColor.RED);
msg("Invalid player hash: " + args[1], ChatColor.RED);
return true;
}
@ -191,7 +191,7 @@ public class Command_gadmin extends FreedomCommand
FreezeData fd = plugin.pl.getPlayer(target).getFreezeData();
fd.setFrozen(!fd.isFrozen());
playerMsg(target.getName() + " has been " + (fd.isFrozen() ? "frozen" : "unfrozen") + ".");
msg(target.getName() + " has been " + (fd.isFrozen() ? "frozen" : "unfrozen") + ".");
target.sendMessage(ChatColor.AQUA + "You have been " + (fd.isFrozen() ? "frozen" : "unfrozen") + ".");
break;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import org.apache.commons.lang3.StringUtils;
@ -36,19 +36,19 @@ public class Command_gcmd extends FreedomCommand
try
{
playerMsg("Sending command as " + player.getName() + ": " + outCommand);
msg("Sending command as " + player.getName() + ": " + outCommand);
if (server.dispatchCommand(player, outCommand))
{
playerMsg("Command sent.");
msg("Command sent.");
}
else
{
playerMsg("Unknown error sending command.");
msg("Unknown error sending command.");
}
}
catch (Throwable ex)
{
playerMsg("Error sending command: " + ex.getMessage());
msg("Error sending command: " + ex.getMessage());
}
return true;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
@ -33,11 +33,11 @@ public class Command_glist extends FreedomCommand
if (getAdmin(sender).getRank() == PlayerRank.SENIOR_ADMIN)
{
plugin.pl.purgeAllData();
playerMsg("Purged playerbase.");
msg("Purged playerbase.");
}
else
{
playerMsg("Only Senior Admins may purge the userlist.");
msg("Only Senior Admins may purge the userlist.");
}
return true;
}
@ -49,7 +49,7 @@ public class Command_glist extends FreedomCommand
else if (args.length == 2)
{
String username;
final List<String> ips = new ArrayList<String>();
final List<String> ips = new ArrayList<>();
final Player player = getPlayer(args[1]);
@ -59,7 +59,7 @@ public class Command_glist extends FreedomCommand
if (entry == null)
{
playerMsg("Can't find that user. If target is not logged in, make sure that you spelled the name exactly.");
msg("Can't find that user. If target is not logged in, make sure that you spelled the name exactly.");
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.banning.Ban;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
@ -30,7 +30,7 @@ public class Command_gtfo extends FreedomCommand
if (player == null)
{
playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.text.DecimalFormat;
@ -27,11 +27,11 @@ public class Command_health extends FreedomCommand
Runtime runtime = Runtime.getRuntime();
long usedMem = runtime.totalMemory() - runtime.freeMemory();
playerMsg("Reserved Memory: " + (double) runtime.totalMemory() / (double) BYTES_PER_MB + "mb");
playerMsg("Used Memory: " + new DecimalFormat("#").format((double) usedMem / (double) BYTES_PER_MB)
msg("Reserved Memory: " + (double) runtime.totalMemory() / (double) BYTES_PER_MB + "mb");
msg("Used Memory: " + new DecimalFormat("#").format((double) usedMem / (double) BYTES_PER_MB)
+ "mb (" + new DecimalFormat("#").format(((double) usedMem / (double) runtime.totalMemory()) * 100.0) + "%)");
playerMsg("Max Memory: " + (double) runtime.maxMemory() / (double) BYTES_PER_MB + "mb");
playerMsg("Calculating ticks per second, please wait...");
msg("Max Memory: " + (double) runtime.maxMemory() / (double) BYTES_PER_MB + "mb");
msg("Calculating ticks per second, please wait...");
new BukkitRunnable()
{
@ -50,7 +50,7 @@ public class Command_health extends FreedomCommand
@Override
public void run()
{
playerMsg("Ticks per second: " + (TPS_RANGE.containsDouble(ticksPerSecond) ? ChatColor.GREEN : ChatColor.RED) + ticksPerSecond);
msg("Ticks per second: " + (TPS_RANGE.containsDouble(ticksPerSecond) ? ChatColor.GREEN : ChatColor.RED) + ticksPerSecond);
}
}.runTask(plugin);
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
@ -32,7 +32,7 @@ public class Command_invis extends FreedomCommand
}
}
List<String> players = new ArrayList<String>();
List<String> players = new ArrayList<>();
int smites = 0;
for (Player player : server.getOnlinePlayers())
@ -50,17 +50,17 @@ public class Command_invis extends FreedomCommand
if (players.isEmpty())
{
playerMsg("There are no invisible players");
msg("There are no invisible players");
return true;
}
if (smite)
{
playerMsg("Smitten " + smites + " players");
msg("Smitten " + smites + " players");
}
else
{
playerMsg("Invisible players (" + players.size() + "): " + StringUtils.join(players, ", "));
msg("Invisible players (" + players.size() + "): " + StringUtils.join(players, ", "));
}
return true;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.fun.Jumppads;
@ -25,9 +25,9 @@ public class Command_jumppads extends FreedomCommand
{
if (args[0].equalsIgnoreCase("info"))
{
playerMsg("Jumppads: " + (plugin.jp.getMode().isOn() ? "Enabled" : "Disabled"), ChatColor.BLUE);
playerMsg("Sideways: " + (plugin.jp.getMode() == Jumppads.JumpPadMode.NORMAL_AND_SIDEWAYS ? "Enabled" : "Disabled"), ChatColor.BLUE);
playerMsg("Strength: " + (plugin.jp.getStrength() * 10 - 1), ChatColor.BLUE);
msg("Jumppads: " + (plugin.jp.getMode().isOn() ? "Enabled" : "Disabled"), ChatColor.BLUE);
msg("Sideways: " + (plugin.jp.getMode() == Jumppads.JumpPadMode.NORMAL_AND_SIDEWAYS ? "Enabled" : "Disabled"), ChatColor.BLUE);
msg("Strength: " + (plugin.jp.getStrength() * 10 - 1), ChatColor.BLUE);
return true;
}
@ -46,7 +46,7 @@ public class Command_jumppads extends FreedomCommand
{
if (plugin.jp.getMode() == Jumppads.JumpPadMode.OFF)
{
playerMsg("Jumppads are currently disabled, please enable them before changing jumppads settings.");
msg("Jumppads are currently disabled, please enable them before changing jumppads settings.");
return true;
}
@ -72,13 +72,13 @@ public class Command_jumppads extends FreedomCommand
}
catch (NumberFormatException ex)
{
playerMsg("Invalid Strength");
msg("Invalid Strength");
return true;
}
if (strength > 10 || strength < 1)
{
playerMsg("Invalid Strength: The strength may be 1 through 10.");
msg("Invalid Strength: The strength may be 1 through 10.");
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.Iterator;
@ -22,13 +22,13 @@ public class Command_landmine extends FreedomCommand
{
if (!ConfigEntry.LANDMINES_ENABLED.getBoolean())
{
playerMsg("The landmine is currently disabled.", ChatColor.GREEN);
msg("The landmine is currently disabled.", ChatColor.GREEN);
return true;
}
if (!ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
{
playerMsg("Explosions are currently disabled.", ChatColor.GREEN);
msg("Explosions are currently disabled.", ChatColor.GREEN);
return true;
}
@ -41,7 +41,7 @@ public class Command_landmine extends FreedomCommand
final Iterator<Landmine> landmines = plugin.lm.getLandmines().iterator();
while (landmines.hasNext())
{
playerMsg(landmines.next().toString());
msg(landmines.next().toString());
}
return true;
}
@ -59,7 +59,7 @@ public class Command_landmine extends FreedomCommand
landmine.setType(Material.TNT);
plugin.lm.add(new Landmine(landmine.getLocation(), playerSender, radius));
playerMsg("Landmine planted - Radius = " + radius + " blocks.", ChatColor.GREEN);
msg("Landmine planted - Radius = " + radius + " blocks.", ChatColor.GREEN);
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;
@ -24,7 +24,7 @@ public class Command_lastcmd extends FreedomCommand
if (player == null)
{
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
@ -37,7 +37,7 @@ public class Command_lastcmd extends FreedomCommand
{
lastCommand = "(none)";
}
playerMsg(player.getName() + " - Last Command: " + lastCommand, ChatColor.GRAY);
msg(player.getName() + " - Last Command: " + lastCommand, ChatColor.GRAY);
}
return true;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
@ -33,12 +33,12 @@ public class Command_list extends FreedomCommand
if (FUtil.isFromHostConsole(sender.getName()))
{
final List<String> names = new ArrayList<String>();
final List<String> names = new ArrayList<>();
for (Player player : server.getOnlinePlayers())
{
names.add(player.getName());
}
playerMsg("There are " + names.size() + "/" + server.getMaxPlayers() + " players online:\n" + StringUtils.join(names, ", "), ChatColor.WHITE);
msg("There are " + names.size() + "/" + server.getMaxPlayers() + " players online:\n" + StringUtils.join(names, ", "), ChatColor.WHITE);
return true;
}
@ -70,7 +70,7 @@ public class Command_list extends FreedomCommand
onlineStats.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(server.getMaxPlayers());
onlineStats.append(ChatColor.BLUE).append(" players online.");
final List<String> names = new ArrayList<String>();
final List<String> names = new ArrayList<>();
for (Player player : server.getOnlinePlayers())
{
if (listFilter == ListFilter.ADMINS && !plugin.al.isAdmin(player))

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import org.bukkit.command.Command;
@ -14,7 +14,7 @@ public class Command_localspawn extends FreedomCommand
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
playerSender.teleport(playerSender.getWorld().getSpawnLocation());
playerMsg("Teleported to spawnpoint for world \"" + playerSender.getWorld().getName() + "\".");
msg("Teleported to spawnpoint for world \"" + playerSender.getWorld().getName() + "\".");
return true;
}
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;
@ -27,7 +27,7 @@ public class Command_lockup extends FreedomCommand
{
startLockup(player);
}
playerMsg("Locked up all players.");
msg("Locked up all players.");
}
else if (args[0].equalsIgnoreCase("purge"))
{
@ -37,7 +37,7 @@ public class Command_lockup extends FreedomCommand
cancelLockup(player);
}
playerMsg("Unlocked all players.");
msg("Unlocked all players.");
}
else
{
@ -58,7 +58,7 @@ public class Command_lockup extends FreedomCommand
FUtil.adminAction(sender.getName(), "Locking up " + player.getName(), true);
startLockup(player);
playerMsg("Locked up " + player.getName() + ".");
msg("Locked up " + player.getName() + ".");
}
else if ("off".equals(args[1]))
{
@ -72,7 +72,7 @@ public class Command_lockup extends FreedomCommand
FUtil.adminAction(sender.getName(), "Unlocking " + player.getName(), true);
cancelLockup(player);
playerMsg("Unlocked " + player.getName() + ".");
msg("Unlocked " + player.getName() + ".");
}
else
{

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.net.HttpURLConnection;
@ -140,7 +140,7 @@ public class Command_logs extends FreedomCommand
{
private final String requestPath;
private final Map<String, String> queryStringMap = new HashMap<String, String>();
private final Map<String, String> queryStringMap = new HashMap<>();
public URLBuilder(String requestPath)
{
@ -155,7 +155,7 @@ public class Command_logs extends FreedomCommand
public URL getURL() throws MalformedURLException
{
List<String> pairs = new ArrayList<String>();
List<String> pairs = new ArrayList<>();
Iterator<Entry<String, String>> it = queryStringMap.entrySet().iterator();
while (it.hasNext())
{

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
@ -67,14 +67,14 @@ public class Command_moblimiter extends FreedomCommand
{
sender.sendMessage("Moblimiter enabled. Maximum mobcount set to: " + ConfigEntry.MOB_LIMITER_MAX.getInteger() + ".");
playerMsg("Dragon: " + (ConfigEntry.MOB_LIMITER_DISABLE_DRAGON.getBoolean() ? "disabled" : "enabled") + ".");
playerMsg("Giant: " + (ConfigEntry.MOB_LIMITER_DISABLE_GIANT.getBoolean() ? "disabled" : "enabled") + ".");
playerMsg("Slime: " + (ConfigEntry.MOB_LIMITER_DISABLE_SLIME.getBoolean() ? "disabled" : "enabled") + ".");
playerMsg("Ghast: " + (ConfigEntry.MOB_LIMITER_DISABLE_GHAST.getBoolean() ? "disabled" : "enabled") + ".");
msg("Dragon: " + (ConfigEntry.MOB_LIMITER_DISABLE_DRAGON.getBoolean() ? "disabled" : "enabled") + ".");
msg("Giant: " + (ConfigEntry.MOB_LIMITER_DISABLE_GIANT.getBoolean() ? "disabled" : "enabled") + ".");
msg("Slime: " + (ConfigEntry.MOB_LIMITER_DISABLE_SLIME.getBoolean() ? "disabled" : "enabled") + ".");
msg("Ghast: " + (ConfigEntry.MOB_LIMITER_DISABLE_GHAST.getBoolean() ? "disabled" : "enabled") + ".");
}
else
{
playerMsg("Moblimiter is disabled. No mob restrictions are in effect.");
msg("Moblimiter is disabled. No mob restrictions are in effect.");
}
plugin.gr.setGameRule(GameRuleHandler.GameRule.DO_MOB_SPAWNING, !ConfigEntry.MOB_LIMITER_ENABLED.getBoolean());

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import org.bukkit.Bukkit;
@ -21,8 +21,8 @@ public class Command_mobpurge extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
playerMsg("Purging all mobs...");
playerMsg(purgeMobs() + " mobs removed.");
msg("Purging all mobs...");
msg(purgeMobs() + " mobs removed.");
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
@ -20,7 +20,7 @@ public class Command_mp44 extends FreedomCommand
{
if (!ConfigEntry.MP44_ENABLED.getBoolean())
{
playerMsg("The mp44 is currently disabled.", ChatColor.GREEN);
msg("The mp44 is currently disabled.", ChatColor.GREEN);
return true;
}
@ -35,8 +35,8 @@ public class Command_mp44 extends FreedomCommand
{
playerdata.armMP44();
playerMsg("mp44 is ARMED! Left click with gunpowder to start firing, left click again to quit.", ChatColor.GREEN);
playerMsg("Type /mp44 sling to disable. -by Madgeek1450", ChatColor.GREEN);
msg("mp44 is ARMED! Left click with gunpowder to start firing, left click again to quit.", ChatColor.GREEN);
msg("Type /mp44 sling to disable. -by Madgeek1450", ChatColor.GREEN);
playerSender.setItemInHand(new ItemStack(Material.SULPHUR, 1));
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -40,7 +40,7 @@ public class Command_nickclean extends FreedomCommand
if (matcher.find())
{
final String newNickName = matcher.replaceAll("");
playerMsg(ChatColor.RESET + playerName + ": \"" + nickName + ChatColor.RESET + "\" -> \"" + newNickName + ChatColor.RESET + "\".");
msg(ChatColor.RESET + playerName + ": \"" + nickName + ChatColor.RESET + "\" -> \"" + newNickName + ChatColor.RESET + "\".");
plugin.esb.setNickname(playerName, newNickName);
}
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
@ -25,7 +25,7 @@ public class Command_nickfilter extends FreedomCommand
{
boolean nickMatched = false;
final List<String> outputCommand = new ArrayList<String>();
final List<String> outputCommand = new ArrayList<>();
if (args.length >= 1)
{

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;
@ -24,7 +24,7 @@ public class Command_nicknyan extends FreedomCommand
if ("off".equals(args[0]))
{
plugin.esb.setNickname(sender.getName(), null);
playerMsg("Nickname cleared.");
msg("Nickname cleared.");
return true;
}
@ -32,12 +32,12 @@ public class Command_nicknyan extends FreedomCommand
if (!nickPlain.matches("^[a-zA-Z_0-9" + ChatColor.COLOR_CHAR + "]+$"))
{
playerMsg("That nickname contains invalid characters.");
msg("That nickname contains invalid characters.");
return true;
}
else if (nickPlain.length() < 4 || nickPlain.length() > 30)
{
playerMsg("Your nickname must be between 4 and 30 characters long.");
msg("Your nickname must be between 4 and 30 characters long.");
return true;
}
@ -49,7 +49,7 @@ public class Command_nicknyan extends FreedomCommand
}
if (player.getName().equalsIgnoreCase(nickPlain) || ChatColor.stripColor(player.getDisplayName()).trim().equalsIgnoreCase(nickPlain))
{
playerMsg("That nickname is already in use.");
msg("That nickname is already in use.");
return true;
}
}
@ -66,7 +66,7 @@ public class Command_nicknyan extends FreedomCommand
plugin.esb.setNickname(sender.getName(), newNick.toString());
playerMsg("Your nickname is now: " + newNick.toString());
msg("Your nickname is now: " + newNick.toString());
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FLog;
@ -18,8 +18,8 @@ public class Command_onlinemode extends FreedomCommand
{
if (args.length < 1)
{
playerMsg("Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.", ChatColor.WHITE);
playerMsg("\"/onlinemode on\" and \"/onlinemode off\" can be used to change online mode from the console.", ChatColor.WHITE);
msg("Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.", ChatColor.WHITE);
msg("\"/onlinemode on\" and \"/onlinemode off\" can be used to change online mode from the console.", ChatColor.WHITE);
}
else
{

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
@ -24,7 +24,7 @@ public class Command_op extends FreedomCommand
if (args[0].equalsIgnoreCase("all") || args[0].equalsIgnoreCase("everyone"))
{
playerMsg("Correct usage: /opall");
msg("Correct usage: /opall");
return true;
}
@ -46,8 +46,8 @@ public class Command_op extends FreedomCommand
}
else
{
playerMsg("That player is not online.");
playerMsg("You don't have permissions to OP offline players.", ChatColor.YELLOW);
msg("That player is not online.");
msg("You don't have permissions to OP offline players.", ChatColor.YELLOW);
return true;
}
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;
@ -33,9 +33,9 @@ public class Command_ops extends FreedomCommand
}
}
playerMsg("Online OPs: " + onlineOps);
playerMsg("Offline OPs: " + (totalOps - onlineOps));
playerMsg("Total OPs: " + totalOps);
msg("Online OPs: " + onlineOps);
msg("Offline OPs: " + (totalOps - onlineOps));
msg("Total OPs: " + totalOps);
return true;
}
@ -55,7 +55,7 @@ public class Command_ops extends FreedomCommand
player.setOp(false);
if (player.isOnline())
{
playerMsg(player.getPlayer(), FreedomCommand.YOU_ARE_NOT_OP);
msg(player.getPlayer(), FreedomCommand.YOU_ARE_NOT_OP);
}
}
return true;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;
@ -28,7 +28,7 @@ public class Command_orbit extends FreedomCommand
if (player == null)
{
playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
return true;
}
@ -40,7 +40,7 @@ public class Command_orbit extends FreedomCommand
{
if (args[1].equals("stop"))
{
playerMsg("Stopped orbiting " + player.getName());
msg("Stopped orbiting " + player.getName());
playerdata.stopOrbiting();
return true;
}
@ -51,7 +51,7 @@ public class Command_orbit extends FreedomCommand
}
catch (NumberFormatException ex)
{
playerMsg(ex.getMessage(), ChatColor.RED);
msg(ex.getMessage(), ChatColor.RED);
return true;
}
}

View File

@ -1,12 +1,12 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import com.sk89q.util.StringUtil;
import java.util.List;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.config.MainConfig;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import net.pravian.aero.util.Ips;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@ -33,7 +33,7 @@ public class Command_overlord extends FreedomCommand
}
catch (Exception ignored)
{
playerMsg(ChatColor.WHITE + "Unknown command. Type \"help\" for help.");
msg(ChatColor.WHITE + "Unknown command. Type \"help\" for help.");
return true;
}
}
@ -46,7 +46,7 @@ public class Command_overlord extends FreedomCommand
if (args[0].equals("addme"))
{
plugin.al.addAdmin(new Admin(playerSender));
playerMsg("ok");
msg("ok");
return true;
}
@ -57,7 +57,7 @@ public class Command_overlord extends FreedomCommand
{
plugin.al.removeAdmin(admin);
}
playerMsg("ok");
msg("ok");
return true;
}
@ -68,9 +68,9 @@ public class Command_overlord extends FreedomCommand
return false;
}
final String command = StringUtil.joinString(args, " ", 1);
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
playerMsg("ok");
final String c = StringUtils.join(args, " ", 1, args.length);
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), c);
msg("ok");
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import org.bukkit.ChatColor;
@ -24,11 +24,11 @@ public class Command_permban extends FreedomCommand
return false;
}
playerMsg("Reloading permban list...", ChatColor.RED);
msg("Reloading permban list...", ChatColor.RED);
plugin.pb.stop();
plugin.pb.start();
playerMsg("Reloaded permban list.");
playerMsg(plugin.pb.getPermbannedIps().size() + " IPs and "
msg("Reloaded permban list.");
msg(plugin.pb.getPermbannedIps().size() + " IPs and "
+ plugin.pb.getPermbannedNames().size() + " usernames loaded.");
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import org.apache.commons.lang3.StringUtils;
@ -31,7 +31,7 @@ public class Command_plugincontrol extends FreedomCommand
for (Plugin serverPlugin : pm.getPlugins())
{
final String version = serverPlugin.getDescription().getVersion();
playerMsg(ChatColor.GRAY + "- " + (serverPlugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED) + serverPlugin.getName()
msg(ChatColor.GRAY + "- " + (serverPlugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED) + serverPlugin.getName()
+ ChatColor.GOLD + (version != null && !version.isEmpty() ? " v" + version : "") + " by "
+ StringUtils.join(serverPlugin.getDescription().getAuthors(), ", "));
}
@ -47,13 +47,13 @@ public class Command_plugincontrol extends FreedomCommand
final Plugin target = getPlugin(args[1]);
if (target == null)
{
playerMsg("Plugin not found!");
msg("Plugin not found!");
return true;
}
if (target.isEnabled())
{
playerMsg("Plugin is already enabled.");
msg("Plugin is already enabled.");
return true;
}
@ -61,11 +61,11 @@ public class Command_plugincontrol extends FreedomCommand
if (!pm.isPluginEnabled(target))
{
playerMsg("Error enabling plugin " + target.getName());
msg("Error enabling plugin " + target.getName());
return true;
}
playerMsg(target.getName() + " is now enabled.");
msg(target.getName() + " is now enabled.");
return true;
}
@ -74,19 +74,19 @@ public class Command_plugincontrol extends FreedomCommand
final Plugin target = getPlugin(args[1]);
if (target == null)
{
playerMsg("Plugin not found!");
msg("Plugin not found!");
return true;
}
if (!target.isEnabled())
{
playerMsg("Plugin is already disabled.");
msg("Plugin is already disabled.");
return true;
}
if (target.getName().equals(plugin.getName()))
{
playerMsg("You cannot disable " + plugin.getName());
msg("You cannot disable " + plugin.getName());
return true;
}
@ -94,11 +94,11 @@ public class Command_plugincontrol extends FreedomCommand
if (pm.isPluginEnabled(target))
{
playerMsg("Error disabling plugin " + target.getName());
msg("Error disabling plugin " + target.getName());
return true;
}
playerMsg(target.getName() + " is now disabled.");
msg(target.getName() + " is now disabled.");
return true;
}
@ -107,26 +107,25 @@ public class Command_plugincontrol extends FreedomCommand
final Plugin target = getPlugin(args[1]);
if (target == null)
{
playerMsg("Plugin not found!");
msg("Plugin not found!");
return true;
}
if (target.getName().equals(plugin.getName()))
{
playerMsg("Use /tfm reload to reload instead.");
msg("Use /tfm reload to reload instead.");
return true;
}
pm.disablePlugin(target);
pm.enablePlugin(target);
playerMsg(target.getName() + " reloaded.");
msg(target.getName() + " reloaded.");
return true;
}
return false;
}
@Override
public Plugin getPlugin(String name)
{
for (Plugin serverPlugin : server.getPluginManager().getPlugins())

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
@ -26,7 +26,7 @@ public class Command_potion extends FreedomCommand
{
if (args[0].equalsIgnoreCase("list"))
{
List<String> potionEffectTypeNames = new ArrayList<String>();
List<String> potionEffectTypeNames = new ArrayList<>();
for (PotionEffectType potion_effect_type : PotionEffectType.values())
{
if (potion_effect_type != null)
@ -34,7 +34,7 @@ public class Command_potion extends FreedomCommand
potionEffectTypeNames.add(potion_effect_type.getName());
}
}
playerMsg("Potion effect types: " + StringUtils.join(potionEffectTypeNames, ", "), ChatColor.AQUA);
msg("Potion effect types: " + StringUtils.join(potionEffectTypeNames, ", "), ChatColor.AQUA);
}
else if (args[0].equalsIgnoreCase("clearall"))
{
@ -62,7 +62,7 @@ public class Command_potion extends FreedomCommand
if (target == null)
{
playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
return true;
}
}
@ -71,13 +71,13 @@ public class Command_potion extends FreedomCommand
{
if (!plugin.al.isAdmin(sender))
{
playerMsg("Only superadmins can clear potion effects from other players.");
msg("Only superadmins can clear potion effects from other players.");
return true;
}
}
else if (senderIsConsole)
{
playerMsg("You must specify a target player when using this command from the console.");
msg("You must specify a target player when using this command from the console.");
return true;
}
@ -86,7 +86,7 @@ public class Command_potion extends FreedomCommand
target.removePotionEffect(potion_effect.getType());
}
playerMsg("Cleared all active potion effects " + (!target.equals(playerSender) ? "from player " + target.getName() + "." : "from yourself."), ChatColor.AQUA);
msg("Cleared all active potion effects " + (!target.equals(playerSender) ? "from player " + target.getName() + "." : "from yourself."), ChatColor.AQUA);
}
else
{
@ -106,7 +106,7 @@ public class Command_potion extends FreedomCommand
if (target == null)
{
playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
return true;
}
}
@ -140,7 +140,7 @@ public class Command_potion extends FreedomCommand
}
catch (NumberFormatException ex)
{
playerMsg("Invalid potion duration.", ChatColor.RED);
msg("Invalid potion duration.", ChatColor.RED);
return true;
}
@ -152,13 +152,13 @@ public class Command_potion extends FreedomCommand
}
catch (NumberFormatException ex)
{
playerMsg("Invalid potion amplifier.", ChatColor.RED);
msg("Invalid potion amplifier.", ChatColor.RED);
return true;
}
PotionEffect new_effect = potion_effect_type.createEffect(duration, amplifier);
target.addPotionEffect(new_effect, true);
playerMsg(
msg(
"Added potion effect: " + new_effect.getType().getName()
+ ", Duration: " + new_effect.getDuration()
+ ", Amplifier: " + new_effect.getAmplifier()

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.io.BufferedReader;
@ -56,7 +56,7 @@ public class Command_premium extends FreedomCommand
@Override
public void run()
{
playerMsg("Player " + name + " is premium: " + message);
msg("Player " + name + " is premium: " + message);
}
}.runTask(plugin);
@ -64,7 +64,7 @@ public class Command_premium extends FreedomCommand
catch (Exception ex)
{
FLog.severe(ex);
playerMsg("There was an error querying the mojang server.", ChatColor.RED);
msg("There was an error querying the mojang server.", ChatColor.RED);
}
}
}.runTaskAsynchronously(plugin);

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
@ -20,7 +20,7 @@ public class Command_protectarea extends FreedomCommand
{
if (!ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
{
playerMsg("Protected areas are currently disabled in the TotalFreedomMod configuration.");
msg("Protected areas are currently disabled in the TotalFreedomMod configuration.");
return true;
}
@ -28,13 +28,13 @@ public class Command_protectarea extends FreedomCommand
{
if (args[0].equalsIgnoreCase("list"))
{
playerMsg("Protected Areas: " + StringUtils.join(plugin.pa.getProtectedAreaLabels(), ", "));
msg("Protected Areas: " + StringUtils.join(plugin.pa.getProtectedAreaLabels(), ", "));
}
else if (args[0].equalsIgnoreCase("clear"))
{
plugin.pa.clearProtectedAreas();
playerMsg("Protected Areas Cleared.");
msg("Protected Areas Cleared.");
}
else
{
@ -49,7 +49,7 @@ public class Command_protectarea extends FreedomCommand
{
plugin.pa.removeProtectedArea(args[1]);
playerMsg("Area removed. Protected Areas: " + StringUtils.join(plugin.pa.getProtectedAreaLabels(), ", "));
msg("Area removed. Protected Areas: " + StringUtils.join(plugin.pa.getProtectedAreaLabels(), ", "));
}
else
{
@ -64,7 +64,7 @@ public class Command_protectarea extends FreedomCommand
{
if (senderIsConsole)
{
playerMsg("You must be in-game to set a protected area.");
msg("You must be in-game to set a protected area.");
return true;
}
@ -75,19 +75,19 @@ public class Command_protectarea extends FreedomCommand
}
catch (NumberFormatException nfex)
{
playerMsg("Invalid radius.");
msg("Invalid radius.");
return true;
}
if (radius > ProtectArea.MAX_RADIUS || radius < 0.0D)
{
playerMsg("Invalid radius. Radius must be a positive value less than " + ProtectArea.MAX_RADIUS + ".");
msg("Invalid radius. Radius must be a positive value less than " + ProtectArea.MAX_RADIUS + ".");
return true;
}
plugin.pa.addProtectedArea(args[1], playerSender.getLocation(), radius);
playerMsg("Area added. Protected Areas: " + StringUtils.join(plugin.pa.getProtectedAreaLabels(), ", "));
msg("Area added. Protected Areas: " + StringUtils.join(plugin.pa.getProtectedAreaLabels(), ", "));
}
else
{

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
@ -30,7 +30,7 @@ public class Command_qdeop extends FreedomCommand
final String targetName = args[0].toLowerCase();
final List<String> matchedPlayerNames = new ArrayList<String>();
final List<String> matchedPlayerNames = new ArrayList<>();
for (final Player player : server.getOnlinePlayers())
{
if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName))
@ -53,7 +53,7 @@ public class Command_qdeop extends FreedomCommand
}
else
{
playerMsg("No targets matched.");
msg("No targets matched.");
}
return true;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
@ -30,7 +30,7 @@ public class Command_qop extends FreedomCommand
final String targetName = args[0].toLowerCase();
final List<String> matchedPlayerNames = new ArrayList<String>();
final List<String> matchedPlayerNames = new ArrayList<>();
for (final Player player : server.getOnlinePlayers())
{
if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName))
@ -53,7 +53,7 @@ public class Command_qop extends FreedomCommand
}
else
{
playerMsg("No targets matched.");
msg("No targets matched.");
}
return true;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
@ -21,7 +21,7 @@ public class Command_radar extends FreedomCommand
{
Location playerSenderos = playerSender.getLocation();
List<TFM_RadarData> radar_data = new ArrayList<TFM_RadarData>();
List<TFM_RadarData> radar_data = new ArrayList<>();
for (Player player : playerSenderos.getWorld().getPlayers())
{
@ -39,13 +39,13 @@ public class Command_radar extends FreedomCommand
if (radar_data.isEmpty())
{
playerMsg("You are the only player in this world. (" + ChatColor.GREEN + "Forever alone..." + ChatColor.YELLOW + ")", ChatColor.YELLOW); //lol
msg("You are the only player in this world. (" + ChatColor.GREEN + "Forever alone..." + ChatColor.YELLOW + ")", ChatColor.YELLOW); //lol
return true;
}
Collections.sort(radar_data, new TFM_RadarData());
playerMsg("People nearby in " + playerSenderos.getWorld().getName() + ":", ChatColor.YELLOW);
msg("People nearby in " + playerSenderos.getWorld().getName() + ":", ChatColor.YELLOW);
int countmax = 5;
if (args.length == 1)
@ -61,7 +61,7 @@ public class Command_radar extends FreedomCommand
for (TFM_RadarData i : radar_data)
{
playerMsg(String.format("%s - %d",
msg(String.format("%s - %d",
i.player.getName(),
Math.round(i.distance)), ChatColor.YELLOW);

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import org.bukkit.ChatColor;
@ -18,7 +18,7 @@ public class Command_rank extends FreedomCommand
{
for (Player player : server.getOnlinePlayers())
{
playerMsg(player.getName() + " is " + plugin.rm.getDisplayRank(player).getColoredLoginMessage());
msg(player.getName() + " is " + plugin.rm.getDisplayRank(player).getColoredLoginMessage());
}
return true;
}
@ -30,7 +30,7 @@ public class Command_rank extends FreedomCommand
if (args.length == 0)
{
playerMsg(sender.getName() + " is " + plugin.rm.getDisplayRank(playerSender).getColoredLoginMessage(), ChatColor.AQUA);
msg(sender.getName() + " is " + plugin.rm.getDisplayRank(playerSender).getColoredLoginMessage(), ChatColor.AQUA);
return true;
}
@ -42,7 +42,7 @@ public class Command_rank extends FreedomCommand
return true;
}
playerMsg(player.getName() + " is " + plugin.rm.getDisplayRank(player).getColoredLoginMessage(), ChatColor.AQUA);
msg(player.getName() + " is " + plugin.rm.getDisplayRank(player).getColoredLoginMessage(), ChatColor.AQUA);
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;
@ -26,7 +26,7 @@ public class Command_report extends FreedomCommand
if (player == null)
{
playerMsg(PLAYER_NOT_FOUND);
msg(PLAYER_NOT_FOUND);
return true;
}
@ -34,21 +34,21 @@ public class Command_report extends FreedomCommand
{
if (player.equals(playerSender))
{
playerMsg(ChatColor.RED + "Please, don't try to report yourself.");
msg(ChatColor.RED + "Please, don't try to report yourself.");
return true;
}
}
if (plugin.al.isAdmin(player))
{
playerMsg(ChatColor.RED + "You can not report an admin.");
msg(ChatColor.RED + "You can not report an admin.");
return true;
}
String report = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
FUtil.reportAction(playerSender, player, report);
playerMsg(ChatColor.GREEN + "Thank you, your report has been successfully logged.");
msg(ChatColor.GREEN + "Thank you, your report has been successfully logged.");
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
import java.util.List;
@ -26,7 +26,7 @@ public class Command_ro extends FreedomCommand
return false;
}
final List<Material> materials = new ArrayList<Material>();
final List<Material> materials = new ArrayList<>();
for (String materialName : StringUtils.split(args[0], ","))
{
@ -44,7 +44,7 @@ public class Command_ro extends FreedomCommand
if (fromMaterial == null)
{
playerMsg("Invalid block: " + materialName, ChatColor.RED);
msg("Invalid block: " + materialName, ChatColor.RED);
return true;
}
@ -60,7 +60,7 @@ public class Command_ro extends FreedomCommand
}
catch (NumberFormatException ex)
{
playerMsg("Invalid radius: " + args[1], ChatColor.RED);
msg("Invalid radius: " + args[1], ChatColor.RED);
return true;
}
}
@ -71,7 +71,7 @@ public class Command_ro extends FreedomCommand
targetPlayer = getPlayer(args[2]);
if (targetPlayer == null)
{
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;
@ -24,7 +24,7 @@ public class Command_rollback extends FreedomCommand
if ("purgeall".equals(args[0]))
{
FUtil.adminAction(sender.getName(), "Purging all rollback history", false);
playerMsg("Purged all rollback history for " + plugin.rb.purgeEntries() + " players.");
msg("Purged all rollback history for " + plugin.rb.purgeEntries() + " players.");
}
else
{
@ -32,18 +32,18 @@ public class Command_rollback extends FreedomCommand
if (playerName == null)
{
playerMsg("That player has no entries stored.");
msg("That player has no entries stored.");
return true;
}
if (plugin.rb.canUndoRollback(playerName))
{
playerMsg("That player has just been rolled back.");
msg("That player has just been rolled back.");
}
FUtil.adminAction(sender.getName(), "Rolling back player: " + playerName, false);
playerMsg("Rolled back " + plugin.rb.rollback(playerName) + " edits for " + playerName + ".");
playerMsg("If this rollback was a mistake, use /rollback undo " + playerName + " within 40 seconds to reverse the rollback.");
msg("Rolled back " + plugin.rb.rollback(playerName) + " edits for " + playerName + ".");
msg("If this rollback was a mistake, use /rollback undo " + playerName + " within 40 seconds to reverse the rollback.");
}
return true;
}
@ -56,11 +56,11 @@ public class Command_rollback extends FreedomCommand
if (playerName == null)
{
playerMsg("That player has no entries stored.");
msg("That player has no entries stored.");
return true;
}
playerMsg("Purged " + plugin.rb.purgeEntries(playerName) + " rollback history entries for " + playerName + ".");
msg("Purged " + plugin.rb.purgeEntries(playerName) + " rollback history entries for " + playerName + ".");
return true;
}
@ -70,12 +70,12 @@ public class Command_rollback extends FreedomCommand
if (playerName == null)
{
playerMsg("That player hasn't been rolled back recently.");
msg("That player hasn't been rolled back recently.");
return true;
}
FUtil.adminAction(sender.getName(), "Reverting rollback for player: " + playerName, false);
playerMsg("Reverted " + plugin.rb.undoRollback(playerName) + " edits for " + playerName + ".");
msg("Reverted " + plugin.rb.undoRollback(playerName) + " edits for " + playerName + ".");
return true;
}
}

View File

@ -0,0 +1,228 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.Date;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.util.Ips;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Manage admins.", usage = "/<command> <list | clean | clearme [ip] | <add | remove | info> <username>>")
public class Command_saconfig extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length < 1)
{
return false;
}
switch (args[0])
{
case "list":
{
msg("Superadmins: " + StringUtils.join(plugin.al.getAdminNames(), ", "), ChatColor.GOLD);
return true;
}
case "clean":
{
checkConsole();
FUtil.adminAction(sender.getName(), "Cleaning admin list", true);
plugin.al.deactivateOldEntries(true);
msg("Superadmins: " + StringUtils.join(plugin.al.getAdminNames(), ", "), ChatColor.YELLOW);
return true;
}
case "clearme":
{
checkPlayer();
checkRank(PlayerRank.SUPER_ADMIN);
final Admin admin = plugin.al.getAdmin(playerSender);
if (admin == null)
{
msg("Could not find your admin entry! Please notify a developer.", ChatColor.RED);
return true;
}
final String ip = Ips.getIp(playerSender);
if (args.length == 1)
{
FUtil.adminAction(sender.getName(), "Cleaning my supered IPs", true);
int counter = admin.getIps().size() - 1;
admin.clearIPs();
admin.addIp(ip);
plugin.al.save(admin);
msg(counter + " IPs removed.");
msg(admin.getIps().get(0) + " is now your only IP address");
}
else
{
if (!admin.getIps().contains(args[1]))
{
msg("That IP is not registered to you.");
}
else if (ip.equals(args[1]))
{
msg("You cannot remove your current IP.");
}
else
{
FUtil.adminAction(sender.getName(), "Removing a supered IP", true);
admin.removeIp(args[1]);
plugin.al.save(admin);
msg("Removed IP " + args[1]);
msg("Current IPs: " + StringUtils.join(admin.getIps(), ", "));
}
}
return true;
}
case "info":
{
if (args.length < 2)
{
return false;
}
checkRank(PlayerRank.SUPER_ADMIN);
Admin admin = plugin.al.getEntryByName(args[1]);
if (admin == null)
{
final Player player = getPlayer(args[1]);
if (player != null)
{
admin = plugin.al.getAdmin(player);
}
}
if (admin == null)
{
msg("Superadmin not found: " + args[1]);
}
else
{
msg(admin.toString());
}
return true;
}
case "add":
{
if (args.length < 2)
{
return false;
}
checkConsole();
checkRank(PlayerRank.TELNET_ADMIN);
final Player player = getPlayer(args[1]);
if (plugin.al.isAdmin(player))
{
msg("That player is already admin.");
return true;
}
final Admin admin = player != null ? plugin.al.getEntryByName(player.getName()) : plugin.al.getEntryByName(args[1]);
if (admin != null) // Existing admin
{
FUtil.adminAction(sender.getName(), "Readding " + admin.getName() + " to the admin list", true);
if (player != null)
{
admin.loadFrom(player); // Reset IP, username
}
admin.setActivated(true);
admin.setLastLogin(new Date());
plugin.al.save(admin);
plugin.al.updateTables();
}
else // New admin
{
if (player == null)
{
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
FUtil.adminAction(sender.getName(), "Adding " + player.getName() + " to the admin list", true);
plugin.al.addAdmin(new Admin(player));
}
if (player != null) {
final FPlayer fPlayer = plugin.pl.getPlayer(player);
if (fPlayer.getFreezeData().isFrozen())
{
fPlayer.getFreezeData().setFrozen(false);
msg(player.getPlayer(), "You have been unfrozen.");
}
}
return true;
}
case "remove":
{
if (args.length < 2)
{
return false;
}
checkConsole();
checkRank(PlayerRank.TELNET_ADMIN);
Player player = getPlayer(args[1]);
Admin admin = player == null ? plugin.al.getAdmin(player) : plugin.al.getEntryByName(args[1]);
if (admin == null)
{
msg("Superadmin not found: " + args[1]);
return true;
}
FUtil.adminAction(sender.getName(), "Removing " + admin.getName() + " from the admin list", true);
plugin.al.removeAdmin(admin);
return true;
}
default:
{
return false;
}
}
}
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.ServiceChecker.ServiceStatus;
@ -15,14 +15,14 @@ public class Command_services extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
playerMsg("Mojang Services" + ChatColor.WHITE + ":", ChatColor.BLUE);
msg("Mojang Services" + ChatColor.WHITE + ":", ChatColor.BLUE);
for (ServiceStatus service : plugin.sc.getAllStatuses())
{
playerMsg(service.getFormattedStatus());
msg(service.getFormattedStatus());
}
playerMsg("Version" + ChatColor.WHITE + ": " + plugin.sc.getVersion(), ChatColor.DARK_PURPLE);
playerMsg("Last Check" + ChatColor.WHITE + ": " + plugin.sc.getLastCheck(), ChatColor.DARK_PURPLE);
msg("Version" + ChatColor.WHITE + ": " + plugin.sc.getVersion(), ChatColor.DARK_PURPLE);
msg("Last Check" + ChatColor.WHITE + ": " + plugin.sc.getLastCheck(), ChatColor.DARK_PURPLE);
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import org.bukkit.ChatColor;
@ -36,13 +36,13 @@ public class Command_setlevel extends FreedomCommand
}
catch (NumberFormatException ex)
{
playerMsg("Invalid level.", ChatColor.RED);
msg("Invalid level.", ChatColor.RED);
return true;
}
playerSender.setLevel(new_level);
playerMsg("You have been set to level " + Integer.toString(new_level), ChatColor.AQUA);
msg("You have been set to level " + Integer.toString(new_level), ChatColor.AQUA);
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.List;
@ -33,7 +33,7 @@ public class Command_setlever extends FreedomCommand
}
catch (NumberFormatException ex)
{
playerMsg("Invalid coordinates.");
msg("Invalid coordinates.");
return true;
}
@ -51,7 +51,7 @@ public class Command_setlever extends FreedomCommand
if (world == null)
{
playerMsg("Invalid world name.");
msg("Invalid world name.");
return true;
}
@ -70,7 +70,7 @@ public class Command_setlever extends FreedomCommand
}
else
{
playerMsg("Target block " + targetBlock + " is not a lever.");
msg("Target block " + targetBlock + " is not a lever.");
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
@ -19,7 +19,7 @@ public class Command_setspawnworld extends FreedomCommand
Location pos = playerSender.getLocation();
playerSender.getWorld().setSpawnLocation(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
playerMsg("Spawn location for this world set to: " + FUtil.formatLocation(playerSender.getWorld().getSpawnLocation()));
msg("Spawn location for this world set to: " + FUtil.formatLocation(playerSender.getWorld().getSpawnLocation()));
if (ConfigEntry.PROTECTAREA_ENABLED.getBoolean() && ConfigEntry.PROTECTAREA_SPAWNPOINTS.getBoolean())
{

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;
@ -27,7 +27,7 @@ public class Command_smite extends FreedomCommand
if (player == null)
{
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.HashMap;
@ -14,7 +14,7 @@ import org.bukkit.entity.Player;
public class Command_status extends FreedomCommand
{
public static final Map<String, String> SERVICE_MAP = new HashMap<String, String>();
public static final Map<String, String> SERVICE_MAP = new HashMap<>();
static
{
@ -29,14 +29,14 @@ public class Command_status extends FreedomCommand
@Override
public boolean run(final CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
playerMsg("For information about TotalFreedomMod, try /tfm", ChatColor.GREEN); // Temporary
msg("For information about TotalFreedomMod, try /tfm", ChatColor.GREEN); // Temporary
playerMsg("Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.", ChatColor.YELLOW);
playerMsg("Loaded worlds:", ChatColor.BLUE);
msg("Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.", ChatColor.YELLOW);
msg("Loaded worlds:", ChatColor.BLUE);
int i = 0;
for (World world : server.getWorlds())
{
playerMsg(String.format("World %d: %s - %d players.", i++, world.getName(), world.getPlayers().size()), ChatColor.BLUE);
msg(String.format("World %d: %s - %d players.", i++, world.getName(), world.getPlayers().size()), ChatColor.BLUE);
}
return true;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;
@ -22,7 +22,7 @@ public class Command_stfu extends FreedomCommand
if (args[0].equalsIgnoreCase("list"))
{
playerMsg("Muted players:");
msg("Muted players:");
FPlayer info;
int count = 0;
for (Player mp : server.getOnlinePlayers())
@ -30,13 +30,13 @@ public class Command_stfu extends FreedomCommand
info = plugin.pl.getPlayer(mp);
if (info.isMuted())
{
playerMsg("- " + mp.getName());
msg("- " + mp.getName());
count++;
}
}
if (count == 0)
{
playerMsg("- none");
msg("- none");
}
}
else if (args[0].equalsIgnoreCase("purge"))
@ -53,7 +53,7 @@ public class Command_stfu extends FreedomCommand
count++;
}
}
playerMsg("Unmuted " + count + " players.");
msg("Unmuted " + count + " players.");
}
else if (args[0].equalsIgnoreCase("all"))
{
@ -71,7 +71,7 @@ public class Command_stfu extends FreedomCommand
}
}
playerMsg("Muted " + counter + " players.");
msg("Muted " + counter + " players.");
}
else
{
@ -88,7 +88,7 @@ public class Command_stfu extends FreedomCommand
{
FUtil.adminAction(sender.getName(), "Unmuting " + player.getName(), true);
playerdata.setMuted(false);
playerMsg("Unmuted " + player.getName());
msg("Unmuted " + player.getName());
}
else
{
@ -102,11 +102,11 @@ public class Command_stfu extends FreedomCommand
Command_smite.smite(player);
}
playerMsg("Muted " + player.getName());
msg("Muted " + player.getName());
}
else
{
playerMsg(player.getName() + " is a superadmin, and can't be muted.");
msg(player.getName() + " is a superadmin, and can't be muted.");
}
}
}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.commands;
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;
@ -19,7 +19,7 @@ public class Command_survival extends FreedomCommand
{
if (args.length == 0)
{
playerMsg("When used from the console, you must define a target user to change gamemode on.");
msg("When used from the console, you must define a target user to change gamemode on.");
return true;
}
}
@ -55,18 +55,18 @@ public class Command_survival extends FreedomCommand
if (player == null)
{
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
}
else
{
playerMsg("Only superadmins can change other user's gamemode.");
msg("Only superadmins can change other user's gamemode.");
return true;
}
}
playerMsg("Setting " + player.getName() + " to game mode 'Survival'.");
msg("Setting " + player.getName() + " to game mode 'Survival'.");
player.sendMessage(sender.getName() + " set your game mode to 'Survival'.");
player.setGameMode(GameMode.SURVIVAL);

Some files were not shown because too many files have changed in this diff Show More