-
-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect recursive use of calias. Closes #320
- Loading branch information
1 parent
1411003
commit 59199d0
Showing
5 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...in/java/net/earthcomputer/clientcommands/interfaces/IClientSuggestionsProvider_Alias.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package net.earthcomputer.clientcommands.interfaces; | ||
|
||
public interface IClientSuggestionsProvider_Alias { | ||
void clientcommands_addSeenAlias(String alias); | ||
|
||
boolean clientcommands_isAliasSeen(String alias); | ||
} |
25 changes: 25 additions & 0 deletions
25
.../net/earthcomputer/clientcommands/mixin/commands/alias/ClientSuggestionProviderMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package net.earthcomputer.clientcommands.mixin.commands.alias; | ||
|
||
import net.earthcomputer.clientcommands.interfaces.IClientSuggestionsProvider_Alias; | ||
import net.minecraft.client.multiplayer.ClientSuggestionProvider; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
@Mixin(ClientSuggestionProvider.class) | ||
public class ClientSuggestionProviderMixin implements IClientSuggestionsProvider_Alias { | ||
@Unique | ||
private final Set<String> seenAliases = new HashSet<>(); | ||
|
||
@Override | ||
public void clientcommands_addSeenAlias(String alias) { | ||
seenAliases.add(alias); | ||
} | ||
|
||
@Override | ||
public boolean clientcommands_isAliasSeen(String alias) { | ||
return seenAliases.contains(alias); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters