generated from LabyMod/addon-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #3 from RappyLabyAddons/develop
Send and receive friend requests in chat, design icons, send and receive chat messages in chat
- Loading branch information
Showing
12 changed files
with
309 additions
and
92 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
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
58 changes: 58 additions & 0 deletions
58
core/src/main/java/com/rappytv/labychatutils/command/subcommands/ReadSubCommand.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,58 @@ | ||
package com.rappytv.labychatutils.command.subcommands; | ||
|
||
import com.rappytv.labychatutils.LabyChatUtilsAddon; | ||
import com.rappytv.labychatutils.listeners.LabyChatListener; | ||
import net.labymod.api.Laby; | ||
import net.labymod.api.client.chat.command.SubCommand; | ||
import net.labymod.api.client.component.Component; | ||
import net.labymod.api.client.component.format.NamedTextColor; | ||
import net.labymod.api.labyconnect.protocol.model.chat.TextChatMessage; | ||
import java.util.UUID; | ||
|
||
public class ReadSubCommand extends SubCommand { | ||
|
||
public ReadSubCommand() { | ||
super("read"); | ||
} | ||
|
||
@Override | ||
public boolean execute(String prefix, String[] arguments) { | ||
if(Laby.references().labyConnect().getSession() == null) { | ||
displayMessage(LabyChatUtilsAddon.prefix.copy().append(Component.translatable( | ||
"labychatutils.messages.notConnected", | ||
NamedTextColor.RED | ||
))); | ||
return true; | ||
} | ||
if(arguments.length < 1) { | ||
displayMessage(LabyChatUtilsAddon.prefix.copy().append(Component.translatable( | ||
"labychatutils.messages.manual", | ||
NamedTextColor.RED | ||
))); | ||
return true; | ||
} | ||
UUID uuid; | ||
try { | ||
uuid = UUID.fromString(arguments[0]); | ||
} catch (IllegalArgumentException e) { | ||
displayMessage(LabyChatUtilsAddon.prefix.copy().append(Component.translatable( | ||
"labychatutils.messages.manual", | ||
NamedTextColor.RED | ||
))); | ||
return true; | ||
} | ||
|
||
TextChatMessage message = LabyChatListener.getMessage(uuid); | ||
|
||
if(message == null) { | ||
displayMessage(LabyChatUtilsAddon.prefix.copy().append(Component.translatable( | ||
"labychatutils.messages.manual", | ||
NamedTextColor.RED | ||
))); | ||
return true; | ||
} | ||
message.markAsRead(); | ||
displayMessage(LabyChatUtilsAddon.prefix.copy().append(Component.translatable("labychatutils.messages.markedRead"))); | ||
return true; | ||
} | ||
} |
Oops, something went wrong.