Simplify ArgumentMap
Dieser Commit ist enthalten in:
Ursprung
9eb6918594
Commit
3e0fb9fde1
@ -49,7 +49,6 @@ public class Argument<T> {
|
||||
public static final Argument<String> STRING = new Argument<>(s -> s, string -> true);
|
||||
|
||||
public static final Argument<Player> PLAYER = new Argument<>(Bukkit::getPlayer, Objects::nonNull, () -> Bukkit.getOnlinePlayers().stream().map(Player::getName).toArray(String[]::new));
|
||||
|
||||
public static final Argument<GameMode> GAMEMODE = new Argument<>(s -> {
|
||||
switch (s.toLowerCase()) {
|
||||
case "creative": case "c": case "1":
|
||||
@ -63,7 +62,6 @@ public class Argument<T> {
|
||||
}
|
||||
return null;
|
||||
}, Objects::nonNull, GameMode.class);
|
||||
|
||||
public static final Argument<Material> MATERIAL = new Argument<>(Material::valueOf, Objects::nonNull, Material.class);
|
||||
public static final Argument<Particle> PARTICLE = new Argument<>(Particle::valueOf, Objects::nonNull, Particle.class);
|
||||
public static final Argument<EntityType> ENTITY = new Argument<>(EntityType::valueOf, Objects::nonNull, EntityType.class);
|
||||
|
@ -43,18 +43,6 @@ public class ArgumentMap {
|
||||
return (T)objects[index];
|
||||
}
|
||||
|
||||
public <T> T get(int index, T t) {
|
||||
return get(index);
|
||||
}
|
||||
|
||||
public <T> T get(int index, Class<T> clazz) {
|
||||
return get(index);
|
||||
}
|
||||
|
||||
public Class<?>[] typeArray() {
|
||||
return Arrays.stream(objects).map(Object::getClass).toArray(Class<?>[]::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ArgumentMap{" + Arrays.stream(objects).map(o -> o.getClass().getSimpleName() + "=" + o.toString()).collect(Collectors.joining(",")) + "}";
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren