.
This commit is contained in:
parent
812a1b1b21
commit
855050c2d1
17 changed files with 158 additions and 29 deletions
|
|
@ -0,0 +1,24 @@
|
|||
package de.kentoj.scrowlib.command.type;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.leakyabstractions.result.api.Result;
|
||||
import com.leakyabstractions.result.core.Results;
|
||||
import site.lab0x13.scrow.commands.model.CommandContext;
|
||||
import site.lab0x13.scrow.commands.model.SuggestionProvider;
|
||||
import site.lab0x13.scrow.commands.model.argument.ArgumentType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class JsonArgumentType<C extends CommandContext<C>> implements ArgumentType<C, JsonElement> {
|
||||
@Override
|
||||
public Result<JsonElement, String> parseInput(String input) {
|
||||
return Results.ofCallable(() -> JsonParser.parseString(input))
|
||||
.mapFailure(Throwable::getMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuggestionProvider<C> defaultSuggestionProvider() {
|
||||
return (_, _) -> List.of("{}");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package de.kentoj.scrowlib.convention;
|
||||
|
||||
import de.kentoj.scrowlib.utils.ComponentUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
|
|
@ -20,8 +21,8 @@ public record ScrowMessageStyle(
|
|||
|
||||
@Override
|
||||
public Component ok(Component msg) {
|
||||
return prefix.append(Component.text(" ☆ ").color(NamedTextColor.GRAY))
|
||||
.append(msg.colorIfAbsent(NamedTextColor.GRAY));
|
||||
return ComponentUtils.resolveURLS(prefix.append(Component.text(" ☆ ").color(NamedTextColor.GRAY))
|
||||
.append(msg.colorIfAbsent(NamedTextColor.GRAY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Deprecated
|
||||
public class InMemoryEconomyService implements EconomyService {
|
||||
|
||||
private final Map<UUID, Integer> coins = new HashMap<>();
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Deprecated
|
||||
public class InMemoryFriendshipService implements FriendshipService {
|
||||
|
||||
private final Map<OrderedUUIDPair, Friendship> friendships = new HashMap<>();
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@Deprecated
|
||||
public class InMemoryFriendRequestService implements FriendRequestService {
|
||||
|
||||
private final Set<FriendRequest> requests = new HashSet<>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue