use updated library
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 1m23s

This commit is contained in:
Lee 2024-04-15 09:03:06 +01:00
parent cfc7a6c9fa
commit cb91880caf
4 changed files with 26 additions and 25 deletions

@ -14,7 +14,7 @@
"class-variance-authority": "^0.7.0", "class-variance-authority": "^0.7.0",
"clsx": "^2.1.0", "clsx": "^2.1.0",
"lucide-react": "^0.368.0", "lucide-react": "^0.368.0",
"mcutils-library": "^1.0.2", "mcutils-library": "^1.1.0",
"next": "14.2.1", "next": "14.2.1",
"next-themes": "^0.3.0", "next-themes": "^0.3.0",
"react": "^18", "react": "^18",

8
pnpm-lock.yaml generated

@ -21,8 +21,8 @@ dependencies:
specifier: ^0.368.0 specifier: ^0.368.0
version: 0.368.0(react@18.2.0) version: 0.368.0(react@18.2.0)
mcutils-library: mcutils-library:
specifier: ^1.0.2 specifier: ^1.1.0
version: 1.0.2(@babel/core@7.24.4)(@types/node@20.12.7) version: 1.1.0(@babel/core@7.24.4)(@types/node@20.12.7)
next: next:
specifier: 14.2.1 specifier: 14.2.1
version: 14.2.1(@babel/core@7.24.4)(react-dom@18.2.0)(react@18.2.0) version: 14.2.1(@babel/core@7.24.4)(react-dom@18.2.0)(react@18.2.0)
@ -3516,8 +3516,8 @@ packages:
tmpl: 1.0.5 tmpl: 1.0.5
dev: false dev: false
/mcutils-library@1.0.2(@babel/core@7.24.4)(@types/node@20.12.7): /mcutils-library@1.1.0(@babel/core@7.24.4)(@types/node@20.12.7):
resolution: {integrity: sha512-Yl9w3H4FqDmhki32HGvR1jDLzhSJqaWuBiUqYom+5IZk6sLh5j6yfRVFvwHTOLfx/Ee43FWFBXeM+9TQoTUC4Q==} resolution: {integrity: sha512-G3qeRybVMUlfd36+ioqG5YsMgX+zDy3aeLk0qRqkjZ3zXvOgZ1OhjOFP7lEUcsMQ5nmcgwCCBqzk/UpAGiiDXg==}
dependencies: dependencies:
axios: 1.6.8 axios: 1.6.8
jest: 29.7.0(@types/node@20.12.7)(ts-node@10.9.2) jest: 29.7.0(@types/node@20.12.7)(ts-node@10.9.2)

@ -1,6 +1,6 @@
"use client"; "use client";
import mcUtils from "mcutils-library"; import { getPlayer } from "mcutils-library";
import Image from "next/image"; import Image from "next/image";
import Link from "next/link"; import Link from "next/link";
import { useState } from "react"; import { useState } from "react";
@ -12,19 +12,20 @@ export default function PlayerSearch() {
const [playerId, setPlayerId] = useState<string | null>(null); const [playerId, setPlayerId] = useState<string | null>(null);
const [player, setPlayer] = useState<any | null>(null); const [player, setPlayer] = useState<any | null>(null);
const handleLookup = () => { const handleLookup = async () => {
if (playerId === null || playerId.length <= 0) { if (playerId === null || playerId.length <= 0) {
toast.error("Please enter a player ID"); toast.error("Please enter a player ID");
return; return;
} }
mcUtils.player try {
.getPlayer(playerId) const cachedPlayer = await getPlayer(playerId);
.then((response) => { const { player } = cachedPlayer;
setPlayer(response.player);
}) setPlayer(player);
.catch(() => { } catch (error) {
toast.error("Player not found"); toast.error("Unknown player");
}); return;
}
}; };
const handleKeyDown = (e: any) => { const handleKeyDown = (e: any) => {

@ -1,7 +1,7 @@
"use client"; "use client";
import { cn } from "@/common/utils"; import { cn } from "@/common/utils";
import mcUtils from "mcutils-library"; import { getServer } from "mcutils-library";
import JavaMinecraftServer from "mcutils-library/dist/types/server/javaServer"; import JavaMinecraftServer from "mcutils-library/dist/types/server/javaServer";
import { ServerPlatform } from "mcutils-library/dist/types/server/platform"; import { ServerPlatform } from "mcutils-library/dist/types/server/platform";
import Image from "next/image"; import Image from "next/image";
@ -14,19 +14,19 @@ export default function ServerSearch() {
const [serverHostname, setServerHostname] = useState<string | null>(null); const [serverHostname, setServerHostname] = useState<string | null>(null);
const [server, setServer] = useState<JavaMinecraftServer | null>(null); const [server, setServer] = useState<JavaMinecraftServer | null>(null);
const handleLookup = () => { const handleLookup = async () => {
if (serverHostname === null || serverHostname.length <= 0) { if (serverHostname === null || serverHostname.length <= 0) {
toast.error("Please enter a server hostname"); toast.error("Please enter a server hostname");
return; return;
} }
mcUtils.server try {
.getServer(ServerPlatform.Java, serverHostname) const cachedServer = await getServer(ServerPlatform.Java, serverHostname);
.then((response) => { const { server } = cachedServer;
setServer(response.server as JavaMinecraftServer); setServer(server as JavaMinecraftServer);
}) } catch (error) {
.catch(() => { toast.error("Unknown server");
toast.error("Server not found"); return;
}); }
}; };
const handleKeyDown = (e: any) => { const handleKeyDown = (e: any) => {