generated from LabyMod/addon-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from Global-Tags/feat/emailConnection
feat: Implement email connection
- Loading branch information
Showing
9 changed files
with
193 additions
and
44 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
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
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
24 changes: 0 additions & 24 deletions
24
core/src/main/java/com/rappytv/globaltags/command/subcommands/UnlinkDiscordSubcommand.java
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
core/src/main/java/com/rappytv/globaltags/command/subcommands/UnlinkSubcommand.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,45 @@ | ||
package com.rappytv.globaltags.command.subcommands; | ||
|
||
import com.rappytv.globaltags.api.GlobalTagAPI; | ||
import com.rappytv.globaltags.GlobalTagAddon; | ||
import com.rappytv.globaltags.api.Util; | ||
import net.labymod.api.client.chat.command.SubCommand; | ||
import net.labymod.api.client.component.Component; | ||
import net.labymod.api.client.component.format.NamedTextColor; | ||
|
||
public class UnlinkSubcommand extends SubCommand { | ||
|
||
private final GlobalTagAPI api; | ||
|
||
public UnlinkSubcommand(GlobalTagAPI api) { | ||
super("unlink"); | ||
this.api = api; | ||
} | ||
|
||
@Override | ||
public boolean execute(String prefix, String[] arguments) { | ||
switch (arguments.length > 0 ? arguments[0].toLowerCase() : "none") { | ||
case "discord": | ||
api.getApiHandler().unlinkDiscord((response) -> displayMessage( | ||
GlobalTagAddon.prefix.copy().append(Util.getResponseComponent(response))) | ||
); | ||
break; | ||
case "email": | ||
api.getApiHandler().unlinkEmail((response) -> displayMessage( | ||
GlobalTagAddon.prefix.copy().append(Util.getResponseComponent(response))) | ||
); | ||
break; | ||
default: | ||
displayMessage( | ||
Component.empty() | ||
.append(GlobalTagAddon.prefix) | ||
.append(Component.translatable( | ||
"globaltags.commands.usage", | ||
NamedTextColor.RED, | ||
Component.text("/gt unlink <discord/email>") | ||
)) | ||
); | ||
} | ||
return true; | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
core/src/main/java/com/rappytv/globaltags/command/subcommands/VerifyCommand.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,53 @@ | ||
package com.rappytv.globaltags.command.subcommands; | ||
|
||
import com.rappytv.globaltags.GlobalTagAddon; | ||
import com.rappytv.globaltags.api.GlobalTagAPI; | ||
import com.rappytv.globaltags.api.Util; | ||
import net.labymod.api.client.chat.command.SubCommand; | ||
import net.labymod.api.client.component.Component; | ||
import net.labymod.api.client.component.format.NamedTextColor; | ||
|
||
public class VerifyCommand extends SubCommand { | ||
|
||
private final GlobalTagAPI api; | ||
|
||
public VerifyCommand(GlobalTagAPI api) { | ||
super("verify"); | ||
this.api = api; | ||
} | ||
|
||
@Override | ||
public boolean execute(String prefix, String[] arguments) { | ||
switch (arguments.length > 0 ? arguments[0].toLowerCase() : "none") { | ||
case "email": | ||
if(arguments.length < 2) { | ||
displayMessage( | ||
Component.empty() | ||
.append(GlobalTagAddon.prefix) | ||
.append(Component.translatable( | ||
"globaltags.commands.usage", | ||
NamedTextColor.RED, | ||
Component.text("/gt verify email <code>") | ||
)) | ||
); | ||
return true; | ||
} | ||
|
||
api.getApiHandler().verifyEmail(arguments[1], (response) -> displayMessage( | ||
GlobalTagAddon.prefix.copy().append(Util.getResponseComponent(response)) | ||
)); | ||
break; | ||
default: | ||
displayMessage( | ||
Component.empty() | ||
.append(GlobalTagAddon.prefix) | ||
.append(Component.translatable( | ||
"globaltags.commands.usage", | ||
NamedTextColor.RED, | ||
Component.text("/gt verify email <code>") | ||
)) | ||
); | ||
} | ||
return true; | ||
} | ||
} |
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