diff --git a/MCTournamentSystem-Bungeecord/src/main/java/net/novauniverse/mctournamentsystem/bungeecord/api/handlers/api/v1/snapshot/ImportSnapshotHandler.java b/MCTournamentSystem-Bungeecord/src/main/java/net/novauniverse/mctournamentsystem/bungeecord/api/handlers/api/v1/snapshot/ImportSnapshotHandler.java index 0ba785c..dc0acfd 100644 --- a/MCTournamentSystem-Bungeecord/src/main/java/net/novauniverse/mctournamentsystem/bungeecord/api/handlers/api/v1/snapshot/ImportSnapshotHandler.java +++ b/MCTournamentSystem-Bungeecord/src/main/java/net/novauniverse/mctournamentsystem/bungeecord/api/handlers/api/v1/snapshot/ImportSnapshotHandler.java @@ -106,7 +106,7 @@ public AbstractHTTPResponse handleRequest(Request request, Authentication authen playerIds.stream().filter(p -> p.getUuid().toString().equalsIgnoreCase(uuidString)).findFirst().ifPresent(pid -> { try { - String server = player.getString("server"); + String server = player.optString("server", ""); String reason = player.getString("reason"); int amount = player.getInt("amount"); String gainedAt = player.getString("gained_at"); @@ -136,7 +136,7 @@ public AbstractHTTPResponse handleRequest(Request request, Authentication authen teamIds.stream().filter(t -> t.getTeamNumber() == teamNumber).findFirst().ifPresent(tid -> { try { - String server = team.getString("server"); + String server = team.optString("server", ""); String reason = team.getString("reason"); int amount = team.getInt("amount"); String gainedAt = team.getString("gained_at"); diff --git a/ReactUI/src/App.tsx b/ReactUI/src/App.tsx index 962a85b..54bc7c8 100644 --- a/ReactUI/src/App.tsx +++ b/ReactUI/src/App.tsx @@ -22,6 +22,7 @@ import EditorProvider from './components/EditorProvider'; /// @ts-ignore import catCry from "./assets/img/cat_cry.png"; +import ScoreSnapshot from './pages/ScoreSnapshot'; export default function App() { const tournamentSystem = useTournamentSystemContext(); @@ -63,6 +64,7 @@ export default function App() { } /> } /> } /> + } /> {/* Unauthenticated zones */} } /> diff --git a/ReactUI/src/components/modals/ServerSelector.tsx b/ReactUI/src/components/modals/ServerSelector.tsx index 1fa5581..7b3ca40 100644 --- a/ReactUI/src/components/modals/ServerSelector.tsx +++ b/ReactUI/src/components/modals/ServerSelector.tsx @@ -32,7 +32,7 @@ export default function ServerSelector({ visible, text, title = "Select server", }, []); useEffect(() => { - console.debug("Resetting server picker modal"); + //console.debug("Resetting server picker modal"); if (servers.length > 0) { setServer(servers[0].name); } diff --git a/ReactUI/src/components/modals/TextPromptModal.tsx b/ReactUI/src/components/modals/TextPromptModal.tsx index bc69bb4..e778b3f 100644 --- a/ReactUI/src/components/modals/TextPromptModal.tsx +++ b/ReactUI/src/components/modals/TextPromptModal.tsx @@ -15,17 +15,18 @@ interface Props { extraButtonText?: string; extraButtonType?: string; allowEnterToSubmit?: boolean; + initialValue?: string; onExtraButtonClick?: () => void; onClose: () => void; onSubmit: (text: string) => void; } -export default function TextPromptModal({ maxLength, placeholder, children, visible, title, onClose, onSubmit, allowEnterToSubmit = true, cancelText = "Cancel", confirmText = "Confirm", extraButtonVisible = false, extraButtonText = "Extra button", extraButtonType = "secondary", onExtraButtonClick = () => { }, cancelType = "secondary", confirmType = "primary" }: Props) { +export default function TextPromptModal({ initialValue = "", maxLength, placeholder, children, visible, title, onClose, onSubmit, allowEnterToSubmit = true, cancelText = "Cancel", confirmText = "Confirm", extraButtonVisible = false, extraButtonText = "Extra button", extraButtonType = "secondary", onExtraButtonClick = () => { }, cancelType = "secondary", confirmType = "primary" }: Props) { const [text, setText] = useState(""); useEffect(() => { - console.debug("Resetting text prompt modal"); - setText(""); + //console.debug("Resetting text prompt modal"); + setText(initialValue); }, [visible]); diff --git a/ReactUI/src/components/modals/console/ServerConsoleModal.tsx b/ReactUI/src/components/modals/console/ServerConsoleModal.tsx index 9b13014..a196e1a 100644 --- a/ReactUI/src/components/modals/console/ServerConsoleModal.tsx +++ b/ReactUI/src/components/modals/console/ServerConsoleModal.tsx @@ -13,6 +13,7 @@ import "./ServerConsoleModal.scss"; import StartServerButton from '../../buttons/server/StartServerButton'; import KillServerButton from '../../buttons/server/KillServerButton'; import toast from 'react-hot-toast'; +import { Permission } from '../../../scripts/enum/Permission'; interface Props { visible: boolean; @@ -178,7 +179,7 @@ export default function ServerConsoleModal({ server, visible, onClose }: Props) } async function executeCommand() { - if(command.trim().length == 0) { + if (command.trim().length == 0) { return; } @@ -216,8 +217,8 @@ export default function ServerConsoleModal({ server, visible, onClose }: Props) - - + + {server.is_running ? : diff --git a/ReactUI/src/components/nav/PageSelection.tsx b/ReactUI/src/components/nav/PageSelection.tsx index 86a1c27..5ac1992 100644 --- a/ReactUI/src/components/nav/PageSelection.tsx +++ b/ReactUI/src/components/nav/PageSelection.tsx @@ -7,6 +7,7 @@ export default function PageSelection() {