From 92d293a455aaa5e7a6df46b9179f9e10be45bbc0 Mon Sep 17 00:00:00 2001 From: Johannes Partin Date: Thu, 2 Sep 2021 12:28:08 +0200 Subject: [PATCH 1/2] Added Dockerfile which sets up a container running the CLI .NET Core project. Run with "docker run -i -p 25565:25565 " and connect to the server through ClassiCube. --- Dockerfile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..fd92b3302 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +# syntax=docker/dockerfile:1 +FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build-env +WORKDIR /app + +# Copy csproj and restore as distinct layers +COPY ./MCGalaxy/MCGalaxy_core.csproj /MCGalaxy/MCGalaxy_core.csproj +COPY ./CLI/MCGalaxyCLI_core.csproj MCGalaxyCLI_core.csproj + +RUN dotnet restore + +# Copy everything else and build +COPY ./MCGalaxy /MCGalaxy +COPY ./CLI/Program.cs /app + +RUN ls -la + +RUN dotnet build -c Release +RUN dotnet publish --no-build -c Release -o out + +# Build runtime image +FROM mcr.microsoft.com/dotnet/runtime:3.1 AS local-run-env +WORKDIR /app + +RUN apt-get -y update +RUN apt-get -y upgrade +RUN apt-get install -y sqlite3 libsqlite3-dev + +COPY --from=build-env /app/out /app + +ENTRYPOINT ["dotnet", "MCGalaxyCLI_core.dll"] + +EXPOSE 25565 \ No newline at end of file From 3ef8dcc9ed65970b92a9e33e22cfb28e88d32c53 Mon Sep 17 00:00:00 2001 From: Johannes Partin Date: Tue, 7 Sep 2021 10:22:16 +0200 Subject: [PATCH 2/2] Adding new command /botwhere which outputs the current position of a bot, as /where does for players. --- MCGalaxy/Commands/Bots/CmdBotWhere.cs | 47 +++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 MCGalaxy/Commands/Bots/CmdBotWhere.cs diff --git a/MCGalaxy/Commands/Bots/CmdBotWhere.cs b/MCGalaxy/Commands/Bots/CmdBotWhere.cs new file mode 100644 index 000000000..e4f36fd11 --- /dev/null +++ b/MCGalaxy/Commands/Bots/CmdBotWhere.cs @@ -0,0 +1,47 @@ +/* + Copyright 2015 MCGalaxy + + Dual-licensed under the Educational Community License, Version 2.0 and + the GNU General Public License, Version 3 (the "Licenses"); you may + not use this file except in compliance with the Licenses. You may + obtain a copy of the Licenses at + + http://www.opensource.org/licenses/ecl2.php + http://www.gnu.org/licenses/gpl-3.0.html + + Unless required by applicable law or agreed to in writing, + software distributed under the Licenses are distributed on an "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + or implied. See the Licenses for the specific language governing + permissions and limitations under the Licenses. + */ +using System; +using MCGalaxy.Games; + +namespace MCGalaxy.Commands.Bots { + public sealed class CmdBotWhere : Command2 { + public override string name { get { return "BotWhere"; } } + public override string type { get { return CommandTypes.Information; } } + + public override void Use(Player p, string message, CommandData data) { + if (message.Length == 0) return; + + PlayerBot target = Matcher.FindBots(p, message); + if (target == null) return; + + int x = target.Pos.X, y = target.Pos.Y - Entities.CharacterHeight, z = target.Pos.Z; + p.Message("{0} &Sis on {1}", p.FormatNick(target.DisplayName), target.level.ColoredName); + p.Message(" X: &b{0:F5} &SY: &b{1:F5} &SZ: &b{2:F5}", + x / 32.0, y / 32.0, z / 32.0); + + p.Message(" Yaw: &b{0} &Sdegrees, Pitch: &b{1} &Sdegrees", + Orientation.PackedToDegrees(p.Rot.RotY), + Orientation.PackedToDegrees(p.Rot.HeadX)); + } + + public override void Help(Player p) { + p.Message("&T/BotWhere [name]"); + p.Message("&HDisplays level, position, and orientation of that bot."); + } + } +}