Skip to content

Commit

Permalink
Weather buttons, etc. just basic changes:
Browse files Browse the repository at this point in the history
- Small changes like button and text changes nothing fancy the only new things are additional buttons.
  • Loading branch information
liebki committed Aug 25, 2024
1 parent d288604 commit c1aca7a
Show file tree
Hide file tree
Showing 16 changed files with 156 additions and 124 deletions.
6 changes: 3 additions & 3 deletions MinecraftBlazorSuite/BlazorMinecraftServerSettings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"DatabaseHashSalt": "The1Salt",
"MaxConsoleMessages": 60,
"ServerJarPath": "Path:\\To\\ServerJarFile\\spigot-1.17.X.jar",
"DatabaseHashSalt": "Salt4Database",
"MaxConsoleMessages": 100,
"ServerJarPath": "Path:\\To\\ServerJarFile\\server.jar",
"JavaArguments": "-Xms2G -Xmx2G -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions",
"MinecraftServerType": "Spigot",
"MinecraftServerVersion": "X"
Expand Down
50 changes: 22 additions & 28 deletions MinecraftBlazorSuite/MinecraftBlazorSuite.csproj
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Copyright>liebki</Copyright>
<PackageProjectUrl>https://github.com/liebki/MinecraftBlazorSuite</PackageProjectUrl>
<RepositoryUrl>https://github.com/liebki/MinecraftBlazorSuite</RepositoryUrl>
</PropertyGroup>

<ItemGroup>
<Content Include="License.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>


<Content Include="..\README.md">
</Content>
</ItemGroup>

<ItemGroup>
<PackageReference Include="MinecraftRconNet" Version="1.0.4"/>
<PackageReference Include="MudBlazor" Version="6.10.0"/>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
<PackageReference Include="Microsoft.Data.Sqlite" Version="7.0.11"/>
</ItemGroup>

</Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Copyright>liebki</Copyright>
<PackageProjectUrl>https://github.com/liebki/MinecraftBlazorSuite</PackageProjectUrl>
<RepositoryUrl>https://github.com/liebki/MinecraftBlazorSuite</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
<Content Include="License.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\README.md">
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="MinecraftRconNet" Version="1.0.4" />
<PackageReference Include="MudBlazor" Version="7.6.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.8" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions MinecraftBlazorSuite/Models/Data/MinecraftCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ public static class MinecraftCommands
public const string BanCommand = "ban {0} {1}";
public const string MsgCommand = "msg {0} {1}";
public const string GamemodeCommand = "gamemode {0} {1}";
public const string HealCommand = "effect give {0} minecraft:instant_health 1 99";
}
5 changes: 5 additions & 0 deletions MinecraftBlazorSuite/Models/ServerWrapperConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
public class ServerWrapperConfig
{
public string DatabaseHashSalt { get; set; }

public int MaxConsoleMessages { get; set; }

public string ServerJarPath { get; set; }

public string JavaArguments { get; set; }

public string MinecraftServerType { get; set; }

public string MinecraftServerVersion { get; set; }
}
27 changes: 18 additions & 9 deletions MinecraftBlazorSuite/Pages/Console.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<div class="console mt-5">
<div>
<MudList Dense Clickable="true">
<MudList T="MudListItem<string>" Dense>
@foreach ((string consoleLineContent, LogEntryType lineType) in consoleContent)
{
@if (lineType == LogEntryType.JoinUUID)
Expand All @@ -31,18 +31,27 @@
</div>

<div class="mt-3">
<MudTextField Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Computer" @bind-Value="commandInput"/>
<MudTextField Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Code" HelperText="Type in any command you want, then press 'EXECUTE' below" @bind-Value="commandInput"/>

<MudButtonGroup Class="mt-5" OverrideStyles="false">
<MudButton Color="Color.Success" Variant="Variant.Filled" OnClick="() => SendCommand()">Execute</MudButton>
<MudButton Color="Color.Error" Variant="Variant.Filled" OnClick=@(() => SendCommand("stop"))>Stop</MudButton>
<MudButton Color="Color.Info" Variant="Variant.Filled" OnClick=@(() => SendCommand("reload"))>Reload</MudButton>
<MudButton Color="Color.Success" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Code" OnClick="() => SendCommand()">Execute</MudButton>
<MudButton Color="Color.Error" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Stop" OnClick=@(() => SendCommand("stop"))>Stop</MudButton>
<MudButton Color="Color.Warning" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.RestartAlt" OnClick=@(() => SendCommand("reload"))>Reload</MudButton>
</MudButtonGroup>


<MudMenu AnchorOrigin="Origin.TopCenter" Color="Color.Warning" Variant="Variant.Filled" Label="Change daytime">
<MudMenuItem IconColor="Color.Warning" Icon="@Icons.Material.Filled.WbSunny" OnClick=@(() => SendCommand("time set day"))>Day</MudMenuItem>
<MudMenuItem IconColor="Color.Info" Icon="@Icons.Material.Filled.ViewDay" OnClick=@(() => SendCommand("time set noon"))>Noon</MudMenuItem>
<MudMenuItem IconColor="Color.Primary" Icon="@Icons.Material.Filled.ModeNight" OnClick=@(() => SendCommand("time set night"))>Night</MudMenuItem>
<MudButtonGroup Class="mt-5" OverrideStyles="false">
<MudMenu AnchorOrigin="Origin.TopCenter" Color="Color.Tertiary" StartIcon="@Icons.Material.Filled.Timer" Variant="Variant.Filled" Label="Change daytime">
<MudMenuItem IconColor="Color.Warning" Icon="@Icons.Material.Filled.Lightbulb" OnClick=@(() => SendCommand("time set day"))>Day</MudMenuItem>
<MudMenuItem IconColor="Color.Info" Icon="@Icons.Material.Filled.Light" OnClick=@(() => SendCommand("time set noon"))>Noon</MudMenuItem>
<MudMenuItem IconColor="Color.Primary" Icon="@Icons.Material.Filled.Nightlight" OnClick=@(() => SendCommand("time set night"))>Night</MudMenuItem>
<MudMenuItem IconColor="Color.Dark" Icon="@Icons.Material.Filled.Bed" OnClick=@(() => SendCommand("time set midnight"))>Midnight</MudMenuItem>
</MudMenu>

<MudMenu AnchorOrigin="Origin.TopCenter" Color="Color.Info" StartIcon="@Icons.Material.Filled.Article" Variant="Variant.Filled" Label="Change weather">
<MudMenuItem IconColor="Color.Warning" Icon="@Icons.Material.Filled.WbSunny" OnClick=@(() => SendCommand("weather clear"))>Clear</MudMenuItem>
<MudMenuItem IconColor="Color.Info" Icon="@Icons.Material.Filled.WaterDrop" OnClick=@(() => SendCommand("weather rain"))>Rain</MudMenuItem>
<MudMenuItem IconColor="Color.Primary" Icon="@Icons.Material.Filled.Thunderstorm" OnClick=@(() => SendCommand("weather thunder"))>Thunder</MudMenuItem>
</MudMenu>
</MudButtonGroup>
</div>
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
@page "/about"
@page "/help"

<MudContainer Class="mt-1">
<MudText Typo="Typo.h4">About MinecraftBlazorSuite</MudText>
<MudText Typo="Typo.body1">
Welcome to MinecraftBlazorSuite!
We provide a relatively robust solution for managing your Minecraft server with ease and a bit security (WIP).
We provide a growing solution for managing your Minecraft server with ease and a bit security (WIP).
</MudText>

<div class="mt-3">
<MudText Typo="Typo.h5">Features</MudText>
<MudList Clickable Dense>
<MudListItem>
<MudList T="MudText" Dense>
<MudListItem T="MudText">
<MudText Typo="Typo.body1">
<MudLink Href="/players">
<strong>Player Management:</strong>
Expand All @@ -20,7 +20,7 @@
</MudText>
</MudListItem>

<MudListItem>
<MudListItem T="MudText">
<MudText Typo="Typo.body1">
<MudLink Href="/accounts">
<strong>(WIP) Login/Accounts:</strong>
Expand All @@ -30,7 +30,7 @@
</MudText>
</MudListItem>

<MudListItem>
<MudListItem T="MudText">
<MudText Typo="Typo.body1">
<MudLink Href="/">
<strong>Console Access:</strong>
Expand All @@ -41,7 +41,7 @@
</MudText>
</MudListItem>

<MudListItem>
<MudListItem T="MudText">
<MudText Typo="Typo.body1">
<MudLink Href="/settings">
<strong>Settings:</strong>
Expand All @@ -56,8 +56,8 @@

<div class="mt-3">
<MudText Typo="Typo.h5">Technical stuff</MudText>
<MudList Clickable Dense>
<MudListItem>
<MudList T="MudText" Clickable Dense>
<MudListItem T="MudText">
<MudText Typo="Typo.body1">
<strong>Programming Stack:</strong>

Expand All @@ -66,7 +66,7 @@
</MudText>
</MudListItem>

<MudListItem>
<MudListItem T="MudText">
<MudText Typo="Typo.body1">
<strong>Real-time Information:</strong>

Expand All @@ -75,15 +75,15 @@
</MudText>
</MudListItem>

<MudListItem>
<MudListItem T="MudText">
<MudText Typo="Typo.body1">
<strong>Memory usage:</strong>

The wrapper itself may use a large amount of memory, this is sadly a thing that is hard to solve so if you want to use this wrapper, please have at least 300mb memory available, the more the better (I'm working on an alternative like WASM (WebAssembly))
</MudText>
</MudListItem>

<MudListItem>
<MudListItem T="MudText">
<MudText Typo="Typo.body1">
<strong>Minecraft versions:</strong>

Expand All @@ -106,26 +106,26 @@
To enhance security, we recommend taking the following measures:
</MudText>

<MudList Clickable Dense>
<MudListItem>
<MudList T="MudText" Dense>
<MudListItem T="MudText">
<MudText Typo="Typo.body1">
Always use strong, unique passwords for your accounts associated with the server.
</MudText>
</MudListItem>

<MudListItem>
<MudListItem T="MudText">
<MudText Typo="Typo.body1">
Avoid storing sensitive data within the server wrapper or related systems.
</MudText>
</MudListItem>

<MudListItem>
<MudListItem T="MudText">
<MudText Typo="Typo.body1">
Regularly monitor and review access to the web interface (the wrapper). We maintain an access log that is written to an immutable .sqlite database, providing an audit trail of user interactions (the web interface gives you no direct access to the database, it only writes the accesses).
</MudText>
</MudListItem>

<MudListItem>
<MudListItem T="MudText">
<MudText Typo="Typo.body1">
Another <b>planned</b> feature is the possibility to deactivate individual components in a config file, so you could deactivate the console etc. completely.
</MudText>
Expand All @@ -146,7 +146,7 @@

<div class="mt-3">
<MudText Typo="Typo.h5">Contact me</MudText>
<MudText Typo="Typo.body1">We value your feedback and are here to assist you with any inquiries or issues you may have. Feel free to reach out to me at <MudLink Target="_blank" Href="https://spigotmc.org/workinprogress">spigotmc.org</MudLink> or <MudLink Target="_blank" Href="https://github.com/liebki">github.com</MudLink></MudText>
<MudText Typo="Typo.body1">We value your feedback and are here to assist you with any inquiries or issues you may have. Feel free to reach out to me at <MudLink Target="_blank" Href="https://www.spigotmc.org/resources/authors/isamusoftware.283989/">spigotmc.org</MudLink> or <MudLink Target="_blank" Href="https://github.com/liebki">github.com</MudLink></MudText>
</div>

</MudContainer>
13 changes: 13 additions & 0 deletions MinecraftBlazorSuite/Pages/Management.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@page "/management"

<MudText Typo="Typo.h5">Management</MudText>

<div class="mt-3">
<MudText Typo="Typo.h6" Class="mt-3">Available actions for <MudLink Typo="Typo.h6" Href="/players">/Players</MudLink> (use only when there is something wrong).</MudText>

<MudText Typo="Typo.body1" Class="mt-3">To reset all players for the view:</MudText>
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.AssignmentReturn" Color="Color.Error" OnClick="ForcePlayerlistReset">Reset players</MudButton>

<MudText Typo="Typo.body1" Class="mt-3">To recrawl all online players for the view:</MudText>
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.CollectionsBookmark" Color="Color.Warning" OnClick="ForcePlayerlistRecrawl">Recrawl players</MudButton>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace MinecraftBlazorSuite.Pages;

partial class Settings
partial class Management
{
[Inject] private ServerManagementService minecraftServerService { get; set; }

Expand Down
34 changes: 19 additions & 15 deletions MinecraftBlazorSuite/Pages/PlayersView.razor
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,45 @@
<MudExpansionPanels Elevation="3">
@foreach (LoginLogEntry spline in minecraftServerService.Spielerliste)
{
<MudExpansionPanel Style="background-color: #3498DB;">
<MudExpansionPanel Style="background-color: #757575;">
<TitleContent>
<div style="display: flex; align-items: center;">
<img src=@Tools.GetUserSkin(spline.UUID, SkinSelectionType.Avatar, 30) style="margin-right: 10px;"/>
<MudText Style="color: #ECF0F1;" Typo="Typo.h6">@spline.PlayerName</MudText>
<img src=@Tools.GetUserSkin(spline.UUID, SkinSelectionType.Avatar, 40) style="margin-right: 10px;"/>
<MudText Style="color: #ECF0F1;" Typo="Typo.h5">@spline.PlayerName</MudText>
</div>
</TitleContent>

<ChildContent>

<div>
<MudText Style="color: #ECF0F1;" Typo="Typo.subtitle1">
<b>Player informations</b>
<b>About @spline.PlayerName</b>
</MudText>
<MudText Style="color: #ECF0F1;" Class="mt-2" Typo="Typo.body2">@($"UUID: {spline.UUID}")</MudText>
<MudText Style="color: #ECF0F1;" Typo="Typo.body2">@($"Address: {spline.IPAddress}")</MudText>
<MudText Style="color: #ECF0F1;" Typo="Typo.body2">@($"Time on join: {spline.Time}")</MudText>
<MudText Style="color: #ECF0F1;" Typo="Typo.body2">@($"Address/Port: {spline.IPAddress}")</MudText>
<MudText Style="color: #ECF0F1;" Typo="Typo.body2">@($"Time of join: {spline.Time}")</MudText>
</div>

<MudButtonGroup Class="mt-3" OverrideStyles="false">
<MudButton Style="color: #212121;" Variant="Variant.Filled" Color="Color.Secondary" OnClick="@(() => SendMessage(spline.PlayerName))">Message</MudButton>
<MudButton Style="color: #ECF0F1;" Variant="Variant.Filled" Color="Color.Dark" OnClick="@(() => ChangeGamemode(spline.PlayerName))">Gamemode</MudButton>
<MudButton Style="color: #212121;" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Message" Color="Color.Tertiary" OnClick="@(() => SendMessage(spline.PlayerName))">Send Message</MudButton>
<MudButton Style="color: #ECF0F1;" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Mode" Color="Color.Info" OnClick="@(() => ChangeGamemode(spline.PlayerName))">Change Gamemode</MudButton>
</MudButtonGroup>

<MudButtonGroup Class="mt-3" OverrideStyles="false">
<MudButton Style="color: #212121;" Variant="Variant.Filled" Color="Color.Error" OnClick="@(() => KillPlayer(spline.PlayerName))">Kill</MudButton>
<MudButton Style="color: #212121;" Variant="Variant.Filled" Color="Color.Warning" OnClick="@(() => KickWithMessage(spline.PlayerName))">Kick</MudButton>
<MudButton Style="color: #212121;" Variant="Variant.Filled" Color="Color.Error" OnClick="@(() => BanWithMessage(spline.PlayerName))">Ban</MudButton>
<MudButton Style="color: #212121;" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Delete" Color="Color.Error" OnClick="@(() => KillPlayer(spline.PlayerName))">Kill</MudButton>
<MudButton Style="color: #212121;" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.MonitorHeart" Color="Color.Success" OnClick="@(() => HealPlayer(spline.PlayerName))">Heal</MudButton>
</MudButtonGroup>

<MudButtonGroup OverrideStyles="false">
<MudButton Style="color: #212121;" Variant="Variant.Filled" Color="Color.Warning" OnClick="@(() => ChangeOperatorStatus(spline.PlayerName, true))">Give OP</MudButton>
<MudButton Style="color: #212121;" Variant="Variant.Filled" Color="Color.Success" OnClick="@(() => ChangeOperatorStatus(spline.PlayerName, false))">Remove OP</MudButton>
<MudButtonGroup Class="mt-3" OverrideStyles="false">
<MudButton Style="color: #212121;" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Message" Color="Color.Warning" OnClick="@(() => KickWithMessage(spline.PlayerName))">Kick</MudButton>
<MudButton Style="color: #212121;" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Message" Color="Color.Warning" OnClick="@(() => BanWithMessage(spline.PlayerName))">Ban</MudButton>
</MudButtonGroup>

<MudButtonGroup Class="mt-3" OverrideStyles="false">
<MudButton Style="color: #212121;" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Message" Color="Color.Success" OnClick="@(() => ChangeOperatorStatus(spline.PlayerName, true))">Give OP</MudButton>
<MudButton Style="color: #212121;" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Message" Color="Color.Warning" OnClick="@(() => ChangeOperatorStatus(spline.PlayerName, false))">Remove OP</MudButton>
</MudButtonGroup>

</ChildContent>
</MudExpansionPanel>
}
Expand Down
6 changes: 6 additions & 0 deletions MinecraftBlazorSuite/Pages/PlayersView.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ private async Task SendMessage(string playername)
if (!result.Canceled) SendCommand(string.Format(MinecraftCommands.MsgCommand, playername, result.Data));
}

private async Task HealPlayer(string playername)
{
SendCommand(string.Format(MinecraftCommands.HealCommand, playername));
}


private async Task ChangeGamemode(string playername)
{
IDialogReference dialog =
Expand Down
13 changes: 0 additions & 13 deletions MinecraftBlazorSuite/Pages/Settings.razor

This file was deleted.

Loading

0 comments on commit c1aca7a

Please sign in to comment.