mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-12-22 22:04:57 +00:00
Add argument validation & feedback for resetplayer command (implements #45)
This commit is contained in:
parent
5df6d4cfed
commit
8296201f01
2 changed files with 11 additions and 1 deletions
|
@ -13,6 +13,10 @@ import org.bukkit.entity.Player;
|
|||
public class Command_offlinetp extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if(args.length < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
OfflinePlayer target = null;
|
||||
String searchString = args[0];
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
@ -14,6 +15,10 @@ import java.nio.file.Paths;
|
|||
public class Command_resetplayer extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if(args.length < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
OfflinePlayer target = null;
|
||||
String searchString = args[0];
|
||||
|
||||
|
@ -36,7 +41,8 @@ public class Command_resetplayer extends FreedomCommand {
|
|||
target.getPlayer().kickPlayer(ChatColor.RED + "YOU ARE BEING RESET.");
|
||||
}
|
||||
|
||||
playerMsg(sender, String.format("Resetting %s's user data (excluding TFM)...", target.getName()));
|
||||
Utilities.adminAction(sender.getName(), String.format("Resetting %s's player data", target.getName()), true);
|
||||
playerMsg(sender, String.format("Resetting %s's player data (excluding TFM)...", target.getName()));
|
||||
try {
|
||||
String uuid = target.getUniqueId().toString();
|
||||
Files.deleteIfExists(Paths.get(".", "world", "playerdata", uuid + ".dat"));
|
||||
|
|
Loading…
Reference in a new issue