Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Prevent no change ticket notification spam #22

Open
wants to merge 1 commit into
base: master
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
7 changes: 7 additions & 0 deletions src/com/massivecraft/massivetickets/cmd/CmdTicketsCreate.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.massivecraft.massivecore.command.type.primitive.TypeString;
import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.mson.Mson;
import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.Txt;
import com.massivecraft.massivetickets.MassiveTickets;
import com.massivecraft.massivetickets.Perm;
Expand Down Expand Up @@ -61,6 +62,12 @@ public void perform() throws MassiveException
boolean update = msender.hasMessage();
String verb = update ? "updated" : "created";

// But only if the ticket has been changed
if (update && MUtil.equals(msender.getMessage(), message))
{
msg("<b>Please do not spam our ticket system. Someone will be with you shortly.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really the best way to do it? It could be seen as a bit passive-agressive, and it would also make people realise that the message hasn't been forwarded which makes it easier to trick the system by changing it ever so slightly.
Perhaps just act normally towards the player and not send a message to the moderators?

return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a question of preference, but you could also throw a MassiveException with the message.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had originally thrown a massive exception, but then I realized that we don't seem to do that very often in the commands here, so I went with the message to conform.

}
msender.setMessage(message);
if (!update) msender.setMillis(System.currentTimeMillis());

Expand Down