Skip to content

Commit

Permalink
Merge pull request #10 from takunology/develop
Browse files Browse the repository at this point in the history
Release 1.0.0
  • Loading branch information
たくのろじぃ / Takunology authored Aug 3, 2021
2 parents 0746954 + 8552174 commit 66a4056
Show file tree
Hide file tree
Showing 143 changed files with 8,549 additions and 26 deletions.
Binary file not shown.
Binary file modified MinecraftConnection/.vs/MinecraftConnection/v16/.suo
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
".NETCoreApp,Version=v3.1": {
"ExampleApp/1.0.0": {
"dependencies": {
"MinecraftConnection": "1.0.0-beta1"
"MinecraftConnection": "1.0.0-beta2"
},
"runtime": {
"ExampleApp.dll": {}
}
},
"MinecraftConnection/1.0.0-beta1": {
"MinecraftConnection/1.0.0-beta2": {
"runtime": {
"MinecraftConnection.dll": {}
}
Expand All @@ -27,7 +27,7 @@
"serviceable": false,
"sha512": ""
},
"MinecraftConnection/1.0.0-beta1": {
"MinecraftConnection/1.0.0-beta2": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
12 changes: 6 additions & 6 deletions MinecraftConnection/MinecraftConnection.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30717.126
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExampleApp", "ExampleApp\ExampleApp.csproj", "{BA932742-5278-4468-B331-5B18C0115299}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinecraftConnection", "MinecraftConnection\MinecraftConnection.csproj", "{B19912A9-A832-4941-BA28-3DA26A810EAD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestProject", "TestProject\TestProject.csproj", "{14BDEEC5-37FC-436B-92D3-13C874D07D0A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BA932742-5278-4468-B331-5B18C0115299}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA932742-5278-4468-B331-5B18C0115299}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA932742-5278-4468-B331-5B18C0115299}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BA932742-5278-4468-B331-5B18C0115299}.Release|Any CPU.Build.0 = Release|Any CPU
{B19912A9-A832-4941-BA28-3DA26A810EAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B19912A9-A832-4941-BA28-3DA26A810EAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B19912A9-A832-4941-BA28-3DA26A810EAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B19912A9-A832-4941-BA28-3DA26A810EAD}.Release|Any CPU.Build.0 = Release|Any CPU
{14BDEEC5-37FC-436B-92D3-13C874D07D0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{14BDEEC5-37FC-436B-92D3-13C874D07D0A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{14BDEEC5-37FC-436B-92D3-13C874D07D0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{14BDEEC5-37FC-436B-92D3-13C874D07D0A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
24 changes: 24 additions & 0 deletions MinecraftConnection/MinecraftConnection/MinecraftCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,21 @@ public partial class MinecraftCommands
{
public string SendCommand(string command)
{
if (command.Equals("stop"))
throw new System.Exception("stopコマンドは直接サーバコンソールから実行してください。");
return rcon.SendCommand(command);
}

public string TimeSet(int time)
{
return rcon.SendCommand($"time set {time}");
}

public string TimeSet(MinecraftTime.TimeSet Time)
{
return rcon.SendCommand($"time set {Time.GetHashCode()}");
}

public string DisplayTitle(object Text)
{
return rcon.SendCommand($"title @a title \"{Text}\"");
Expand Down Expand Up @@ -103,4 +115,16 @@ public string GivePotion(string PlayerName, Potion Potion, int Count)
return rcon.SendCommand($"give {PlayerName} potion{Potion.ToNBT()} {Count}");
}
}

//列挙体
public static class MinecraftTime
{
public enum TimeSet : int
{
DAY = 1000,
NOON = 6000,
NIGHT = 13000,
MIDNIGHT = 18000
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<Authors>Takumi Okawa (Takunology)</Authors>
<Company>Minecraft_with_Code_Project</Company>
<Version>1.0.0-beta2</Version>
<Version>1.0.0</Version>
<PackageId>MinecraftConnection</PackageId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
Expand All @@ -17,10 +17,10 @@
<Copyright>Copyright (c) 2021 Takumi Okawa (Takunology)</Copyright>
<PackageIconUrl />
<PackageTags>Minecraft</PackageTags>
<PackageReleaseNotes>- Implemented RCON connection.
- Spigot server support.
- Minecraft 1.17.1 support
- Support to DNS name server</PackageReleaseNotes>
<PackageReleaseNotes>- Add TimeSet Method
- Disable "stop" command

The stop command is disabled due to the risk of stopping the server by RCON remote control. Executing the stop command in SendCommand method will raise an exception.</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"targets": {
".NETStandard,Version=v2.0": {},
".NETStandard,Version=v2.0/": {
"MinecraftConnection/1.0.0-beta2": {
"MinecraftConnection/1.0.0": {
"dependencies": {
"NETStandard.Library": "2.0.3"
},
Expand All @@ -24,7 +24,7 @@
}
},
"libraries": {
"MinecraftConnection/1.0.0-beta2": {
"MinecraftConnection/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"projects": {
"D:\\GitHub\\MinecraftConnection\\MinecraftConnection\\MinecraftConnection\\MinecraftConnection.csproj": {
"version": "1.0.0-beta2",
"version": "1.0.0",
"restore": {
"projectUniqueName": "D:\\GitHub\\MinecraftConnection\\MinecraftConnection\\MinecraftConnection\\MinecraftConnection.csproj",
"projectName": "MinecraftConnection",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>MinecraftConnection</id>
<version>1.0.0</version>
<authors>Takumi Okawa (Takunology)</authors>
<license type="expression">MIT</license>
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
<icon>MCLogo.png</icon>
<projectUrl>https://www.mcwithcode.com/</projectUrl>
<description>MinecraftConnection is a library for sending commands via RCON using C# to help you learn and automate your programming. It can be run on a vanilla server as well as a Spigot server, including plugins. Before running the program, you need to start a Minecraft server that allows RCON connections.</description>
<releaseNotes>- Add TimeSet Method
- Disable "stop" command

The stop command is disabled due to the risk of stopping the server by RCON remote control. Executing the stop command in SendCommand method will raise an exception.</releaseNotes>
<copyright>Copyright (c) 2021 Takumi Okawa (Takunology)</copyright>
<tags>Minecraft</tags>
<repository type="git" url="https://github.com/takunology/MinecraftConnection" />
<dependencies>
<group targetFramework=".NETStandard2.0" />
</dependencies>
</metadata>
<files>
<file src="D:\GitHub\MinecraftConnection\MinecraftConnection\MinecraftConnection\bin\Release\netstandard2.0\MinecraftConnection.dll" target="lib\netstandard2.0\MinecraftConnection.dll" />
<file src="D:\GitHub\MinecraftConnection\MinecraftConnection\MinecraftConnection\MCLogo.png" target="MCLogo.png" />
</files>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2021 Takumi Okawa (Takunology)")]
[assembly: System.Reflection.AssemblyDescriptionAttribute(@"MinecraftConnection is a library for sending commands via RCON using C# to help you learn and automate your programming. It can be run on a vanilla server as well as a Spigot server, including plugins. Before running the program, you need to start a Minecraft server that allows RCON connections.")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0-beta2")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("MinecraftConnection")]
[assembly: System.Reflection.AssemblyTitleAttribute("MinecraftConnection")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7069fcd69ea9d188fce8e6196ceeaca374dd3ba9
9067c9c0071058e3eb7a6ddc8976bcddbd76e2e9
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
D:\GitHub\MinecraftConnection\MinecraftConnection\MinecraftConnection\bin\Release\netstandard2.0\MinecraftConnection.deps.json
D:\GitHub\MinecraftConnection\MinecraftConnection\MinecraftConnection\bin\Release\netstandard2.0\MinecraftConnection.dll
D:\GitHub\MinecraftConnection\MinecraftConnection\MinecraftConnection\bin\Release\netstandard2.0\MinecraftConnection.pdb
D:\GitHub\MinecraftConnection\MinecraftConnection\MinecraftConnection\obj\Release\netstandard2.0\MinecraftConnection.csproj.AssemblyReference.cache
D:\GitHub\MinecraftConnection\MinecraftConnection\MinecraftConnection\obj\Release\netstandard2.0\MinecraftConnection.AssemblyInfoInputs.cache
D:\GitHub\MinecraftConnection\MinecraftConnection\MinecraftConnection\obj\Release\netstandard2.0\MinecraftConnection.AssemblyInfo.cs
D:\GitHub\MinecraftConnection\MinecraftConnection\MinecraftConnection\obj\Release\netstandard2.0\MinecraftConnection.csproj.CoreCompileInputs.cache
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
"C:\\Program Files (x86)\\Microsoft\\Xamarin\\NuGet\\": {}
},
"project": {
"version": "1.0.0-beta2",
"version": "1.0.0",
"restore": {
"projectUniqueName": "D:\\GitHub\\MinecraftConnection\\MinecraftConnection\\MinecraftConnection\\MinecraftConnection.csproj",
"projectName": "MinecraftConnection",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": 2,
"dgSpecHash": "oa2wrK8IfaQwt+Q8ggq1qAZtKvzDT8D5LKoC/a7AUqSZIwHs6ktiWSc3VFKM1X3c9ve3an+cVIHNDneReF+2xA==",
"dgSpecHash": "fndIEulbalpsAa/hk6hxxc6xrgWAUTVW2eKAO50LT6LJaSacQcUrSGd4ln6CwVzD1f9jZtXv+LbZmXDvfO8evw==",
"success": true,
"projectFilePath": "D:\\GitHub\\MinecraftConnection\\MinecraftConnection\\MinecraftConnection\\MinecraftConnection.csproj",
"expectedPackageFiles": [
Expand Down
20 changes: 20 additions & 0 deletions MinecraftConnection/TestProject/TestProject.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.3" />
<PackageReference Include="coverlet.collector" Version="3.0.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MinecraftConnection\MinecraftConnection.csproj" />
</ItemGroup>

</Project>
63 changes: 63 additions & 0 deletions MinecraftConnection/TestProject/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MinecraftConnection;
using MinecraftConnection.Items;

namespace TestProject
{
[TestClass]
public class UnitTest1
{
static string address = "127.0.0.1";
static ushort port = 25575;
static string pass = "minecraft";
static MinecraftCommands commands = new MinecraftCommands(address, port, pass);

[TestMethod]
public void CommandTest()
{
commands.TimeSet(MinecraftTime.TimeSet.MIDNIGHT);
}

[TestMethod]
public void FireworksTest()
{
// Azure—p‚̍À•W
/*int x = -52 - 40;
int y = 68;
int z = 92;*/

// Local—p‚̍À•W
int x = -961 + 20;
int y = 70;
int z = -798;

/*while (true)
{
Kiku(x, y, z, 30);
commands.Wait(2000);
}*/
Kiku(x, y, z, 30);

}

public void Kiku(int x, int y, int z, int time)
{
Fireworks fireworksIn = new Fireworks(time, 2, FireworksShapes.SmallBall, false, true, FireworksColors.RED, FireworksColors.RED);
Fireworks fireworksOut = new Fireworks(time, 2, FireworksShapes.LargeBall, false, true, FireworksColors.ORANGE, FireworksColors.ORANGE);
commands.SetOffFireworks(x, y, z, fireworksOut);
commands.SetOffFireworks(x, y, z, fireworksIn);
commands.Wait(1000);

fireworksIn = new Fireworks(time, 2, FireworksShapes.SmallBall, false, true, FireworksColors.GREEN, FireworksColors.GREEN);
fireworksOut = new Fireworks(time, 2, FireworksShapes.LargeBall, false, true, FireworksColors.LIME, FireworksColors.LIME);
commands.SetOffFireworks(x, y, z + 14, fireworksOut);
commands.SetOffFireworks(x, y, z + 14, fireworksIn);
commands.Wait(1000);

fireworksIn = new Fireworks(time, 2, FireworksShapes.SmallBall, false, true, FireworksColors.BLUE, FireworksColors.BLUE);
fireworksOut = new Fireworks(time, 2, FireworksShapes.LargeBall, false, true, FireworksColors.LIGHTBLUE, FireworksColors.LIGHTBLUE);
commands.SetOffFireworks(x, y, z + 28, fireworksOut);
commands.SetOffFireworks(x, y, z + 28, fireworksIn);
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 66a4056

Please sign in to comment.