Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent accidentally resetting all quests by default #272

Open
wants to merge 1 commit into
base: 1.10
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/main/java/betterquesting/commands/admin/QuestCommandReset.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.SyntaxErrorException
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.TextComponentTranslation;
import betterquesting.api.questing.IQuest;
Expand All @@ -19,7 +20,7 @@ public class QuestCommandReset extends QuestCommandBase
@Override
public String getUsageSuffix()
{
return "[all|<quest_id>] [username|uuid]";
return "[all|<quest_id>] [all|<username>|<uuid>]";
}

@Override
Expand Down Expand Up @@ -81,7 +82,7 @@ public void runCommand(MinecraftServer server, CommandBase command, ICommandSend
if(uuid != null)
{
quest.resetUser(uuid, true); // Clear progress and state
} else
} else if(args[2].equalsIgnoreCase("all"))
{
quest.resetAll(true);
}
Expand All @@ -90,9 +91,12 @@ public void runCommand(MinecraftServer server, CommandBase command, ICommandSend
if(uuid != null)
{
sender.addChatMessage(new TextComponentTranslation("betterquesting.cmd.reset.player_all", pName));
} else
} else if(args[2].equalsIgnoreCase("all"))
{
sender.addChatMessage(new TextComponentTranslation("betterquesting.cmd.reset.all_all"));
} else
{
throw new SyntaxErrorException();
}
} else
{
Expand All @@ -105,10 +109,13 @@ public void runCommand(MinecraftServer server, CommandBase command, ICommandSend
{
quest.resetUser(uuid, true); // Clear progress and state
sender.addChatMessage(new TextComponentTranslation("betterquesting.cmd.reset.player_single", new TextComponentTranslation(quest.getUnlocalisedName()), pName));
} else
} else if(args[2].equalsIgnoreCase("all"))
{
quest.resetAll(true);
sender.addChatMessage(new TextComponentTranslation("betterquesting.cmd.reset.all_single", new TextComponentTranslation(quest.getUnlocalisedName())));
} else
{
throw new SyntaxErrorException();
}
} catch(Exception e)
{
Expand Down