forked from public-mirrors/Uniform
feat: fixup paper custom argument types
parent
00b3beea32
commit
27ec5a3176
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Uniform, licensed under the GNU General Public License v3.0.
|
||||||
|
*
|
||||||
|
* Copyright (c) Tofaa2
|
||||||
|
* Copyright (c) William278 <will27528@gmail.com>
|
||||||
|
* Copyright (c) contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.william278.uniform.paper.element;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.StringReader;
|
||||||
|
import com.mojang.brigadier.arguments.ArgumentType;
|
||||||
|
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||||
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
import io.papermc.paper.command.brigadier.argument.CustomArgumentType;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuppressWarnings("UnstableApiUsage")
|
||||||
|
public class PaperArgumentElement<T> implements CustomArgumentType<T, String> {
|
||||||
|
|
||||||
|
private final ArgumentType<T> wrapped;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@NotNull
|
||||||
|
public T parse(@NotNull StringReader reader) throws CommandSyntaxException {
|
||||||
|
return wrapped.parse(reader);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@NotNull
|
||||||
|
public ArgumentType<String> getNativeType() {
|
||||||
|
return StringArgumentType.string();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue