Skip to content

Commit

Permalink
New event for making dog uncomfortable to hook into cheeves
Browse files Browse the repository at this point in the history
  • Loading branch information
DeveloperDeborah committed Dec 12, 2023
1 parent f14df68 commit dadacd2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/no/runsafe/dog/cortex/language/queries/Compliment.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package no.runsafe.dog.cortex.language.queries;

import no.runsafe.dog.cortex.language.ChatResponderRule;
import no.runsafe.dog.events.DogUncomfortableEvent;
import no.runsafe.framework.api.IConfiguration;
import no.runsafe.framework.api.IServer;
import no.runsafe.framework.api.event.plugin.IConfigurationChanged;
import no.runsafe.framework.api.player.IPlayer;

import java.util.*;
import java.util.regex.Matcher;
Expand All @@ -13,6 +15,7 @@ public class Compliment extends ChatResponderRule implements IConfigurationChang
public Compliment(IServer server)
{
super("(?i).*(pretty|beautiful|awesome)\\s+dog", null, null, null, null, server);
this.server = server;
}

@Override
Expand All @@ -28,6 +31,10 @@ public String getResponse(String player, Matcher message)

if (hits == 4)
{
IPlayer weirdo = server.getPlayerExact(player);
if (weirdo != null)
new DogUncomfortableEvent(weirdo).Fire();

playerHits.put(player, 0);
return String.format("%s, you are a really nice friend but we need to see other people.", player);
}
Expand Down Expand Up @@ -62,4 +69,5 @@ private String createCompliment()
private final List<List<String>> complimentTiers = new ArrayList<>();
private final Random random = new Random();
private final HashMap<String, Integer> playerHits = new HashMap<>();
private final IServer server;
}
18 changes: 18 additions & 0 deletions src/no/runsafe/dog/events/DogUncomfortableEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package no.runsafe.dog.events;

import no.runsafe.framework.api.player.IPlayer;
import no.runsafe.framework.minecraft.event.player.RunsafeCustomEvent;

public class DogUncomfortableEvent extends RunsafeCustomEvent
{
public DogUncomfortableEvent(IPlayer player)
{
super(player, "runsafe.dog.uncomfortable");
}

@Override
public Object getData()
{
return null;
}
}

0 comments on commit dadacd2

Please sign in to comment.