Dieser Commit ist enthalten in:
Ursprung
415a002cad
Commit
5f7f7673f0
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.command;
|
package de.steamwar.command;
|
||||||
|
|
||||||
|
import de.steamwar.sql.BauweltMember;
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -78,6 +79,32 @@ public class SWCommandUtils {
|
|||||||
return SchematicNode.getNodeTabcomplete(SteamwarUser.get(((Player) commandSender).getUniqueId()), s);
|
return SchematicNode.getNodeTabcomplete(SteamwarUser.get(((Player) commandSender).getUniqueId()), s);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
MAPPER_FUNCTIONS.put(BauweltMember.class.getTypeName(), new TypeMapper<BauweltMember>() {
|
||||||
|
@Override
|
||||||
|
public BauweltMember map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||||
|
if (!(commandSender instanceof Player)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Player player = (Player) commandSender;
|
||||||
|
return BauweltMember.getMembers(player.getUniqueId())
|
||||||
|
.stream()
|
||||||
|
.filter(member -> SteamwarUser.get(member.getMemberID()).getUserName().equalsIgnoreCase(s))
|
||||||
|
.findAny()
|
||||||
|
.orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> tabCompletes(CommandSender commandSender, String[] previousArguments, String s) {
|
||||||
|
if (!(commandSender instanceof Player)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
Player player = (Player) commandSender;
|
||||||
|
return BauweltMember.getMembers(player.getUniqueId())
|
||||||
|
.stream()
|
||||||
|
.map(m -> SteamwarUser.get(m.getMemberID()).getUserName())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addMapper(Class<?> clazz, Class<?> alternativeClazz, TypeMapper<?> mapper) {
|
private static void addMapper(Class<?> clazz, Class<?> alternativeClazz, TypeMapper<?> mapper) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren