mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Merge into master
This commit is contained in:
commit
892999ac98
155 changed files with 10911 additions and 9860 deletions
151
.github/workflows/build-MCC-only.yml
vendored
151
.github/workflows/build-MCC-only.yml
vendored
|
|
@ -1,151 +0,0 @@
|
|||
name: Build MCC
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
PROJECT: "MinecraftClient"
|
||||
target-version: "net6.0"
|
||||
compile-flags: "--self-contained=true -c Release -p:UseAppHost=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=None"
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: 'true'
|
||||
|
||||
- name: Sync translations from crowdin
|
||||
uses: crowdin/github-action@1.5.0
|
||||
with:
|
||||
upload_translations: true
|
||||
download_translations: true
|
||||
|
||||
localization_branch_name: l10n_master
|
||||
create_pull_request: false
|
||||
|
||||
base_path: ${{ github.workspace }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
|
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_TOKEN }}
|
||||
|
||||
- name: Setup Project Path
|
||||
run: |
|
||||
echo project-path=${{ github.workspace }}/${{ env.PROJECT }} >> $GITHUB_ENV
|
||||
|
||||
- name: Setup Output Paths
|
||||
run: |
|
||||
echo win-x64-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/win-x64/publish/ >> $GITHUB_ENV
|
||||
echo win-x86-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/win-x86/publish/ >> $GITHUB_ENV
|
||||
echo linux-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/linux-x64/publish/ >> $GITHUB_ENV
|
||||
echo osx-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/osx-x64/publish/ >> $GITHUB_ENV
|
||||
echo linux-arm64-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/linux-arm64/publish/ >> $GITHUB_ENV
|
||||
|
||||
- name: Setup .NET SDK
|
||||
uses: actions/setup-dotnet@v2.1.0
|
||||
|
||||
- name: Get Version DateTime
|
||||
id: date-version
|
||||
uses: nanzm/get-time-action@v1.1
|
||||
with:
|
||||
timeZone: 0
|
||||
format: 'YYYY-MM-DD'
|
||||
|
||||
- name: VersionInfo
|
||||
run: |
|
||||
COMMIT=$(echo ${{ github.sha }} | cut -c 1-7)
|
||||
echo '' >> ${{ env.project-path }}/Properties/AssemblyInfo.cs
|
||||
echo "[assembly: AssemblyConfiguration(\"GitHub build ${{ github.run_number }}, built on ${{ steps.date-version.outputs.time }} from commit $COMMIT\")]" >> ${{ env.project-path }}/Properties/AssemblyInfo.cs
|
||||
|
||||
- name: Build for Windows x64
|
||||
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r win-x64 ${{ env.compile-flags }}
|
||||
|
||||
- name: Zip Windows x64 Build
|
||||
run: zip -qq -r windows-x64.zip *
|
||||
working-directory: ${{ env.win-x64-out-path }}
|
||||
|
||||
- name: Build for Windows x86
|
||||
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r win-x86 ${{ env.compile-flags }}
|
||||
|
||||
- name: Zip Windows x86 Build
|
||||
run: zip -qq -r windows-x86.zip *
|
||||
working-directory: ${{ env.win-x86-out-path }}
|
||||
|
||||
- name: Build for Linux
|
||||
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r linux-x64 ${{ env.compile-flags }}
|
||||
|
||||
- name: Zip Linux Build
|
||||
run: zip -qq -r linux.zip *
|
||||
working-directory: ${{ env.linux-out-path }}
|
||||
|
||||
- name: Build for ARM64 Linux
|
||||
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r linux-arm64 ${{ env.compile-flags }}
|
||||
|
||||
- name: Zip ARM64 Linux Build
|
||||
run: zip -qq -r linux-arm64.zip *
|
||||
working-directory: ${{ env.linux-arm64-out-path }}
|
||||
|
||||
- name: Build for OSX
|
||||
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r osx-x64 ${{ env.compile-flags }}
|
||||
|
||||
- name: Zip OSX Build
|
||||
run: zip -qq -r osx.zip *
|
||||
working-directory: ${{ env.osx-out-path }}
|
||||
|
||||
- name: Get Release DateTime
|
||||
id: date-release
|
||||
uses: nanzm/get-time-action@v1.1
|
||||
with:
|
||||
timeZone: 0
|
||||
format: 'YYYYMMDD'
|
||||
|
||||
- name: Windows x64 Release
|
||||
uses: tix-factory/release-manager@v1
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
mode: uploadReleaseAsset
|
||||
filePath: ${{ env.win-x64-out-path }}windows-x64.zip
|
||||
assetName: ${{ env.PROJECT }}-windows-x64.zip
|
||||
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||
|
||||
- name: Windows x86 Release
|
||||
uses: tix-factory/release-manager@v1
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
mode: uploadReleaseAsset
|
||||
filePath: ${{ env.win-x86-out-path }}windows-x86.zip
|
||||
assetName: ${{ env.PROJECT }}-windows-x86.zip
|
||||
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||
|
||||
- name: Linux Release
|
||||
uses: tix-factory/release-manager@v1
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
mode: uploadReleaseAsset
|
||||
filePath: ${{ env.linux-out-path }}linux.zip
|
||||
assetName: ${{ env.PROJECT }}-linux.zip
|
||||
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||
|
||||
- name: Linux ARM64 Release
|
||||
uses: tix-factory/release-manager@v1
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
mode: uploadReleaseAsset
|
||||
filePath: ${{ env.linux-arm64-out-path }}linux-arm64.zip
|
||||
assetName: ${{ env.PROJECT }}-linux-arm64.zip
|
||||
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||
|
||||
- name: OSX Release
|
||||
uses: tix-factory/release-manager@v1
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
mode: uploadReleaseAsset
|
||||
filePath: ${{ env.osx-out-path }}osx.zip
|
||||
assetName: ${{ env.PROJECT }}-osx.zip
|
||||
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||
4
.github/workflows/build-and-release.yml
vendored
4
.github/workflows/build-and-release.yml
vendored
|
|
@ -28,11 +28,13 @@ jobs:
|
|||
- name: Download translations from crowdin
|
||||
uses: crowdin/github-action@1.5.0
|
||||
with:
|
||||
upload_translations: true
|
||||
upload_sources: true
|
||||
upload_translations: false
|
||||
download_translations: true
|
||||
|
||||
localization_branch_name: l10n_master
|
||||
create_pull_request: false
|
||||
push_translations: false
|
||||
|
||||
base_path: ${{ github.workspace }}
|
||||
env:
|
||||
|
|
|
|||
6
.github/workflows/deploy-doc-only.yml
vendored
6
.github/workflows/deploy-doc-only.yml
vendored
|
|
@ -1,6 +1,8 @@
|
|||
name: Build Documents
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '45 0 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
|
@ -18,11 +20,13 @@ jobs:
|
|||
- name: Sync translations from crowdin
|
||||
uses: crowdin/github-action@1.5.0
|
||||
with:
|
||||
upload_translations: true
|
||||
upload_sources: true
|
||||
upload_translations: false
|
||||
download_translations: true
|
||||
|
||||
localization_branch_name: l10n_master
|
||||
create_pull_request: false
|
||||
push_translations: false
|
||||
|
||||
base_path: ${{ github.workspace }}
|
||||
env:
|
||||
|
|
|
|||
4
.github/workflows/sync-translations-only.yml
vendored
4
.github/workflows/sync-translations-only.yml
vendored
|
|
@ -18,11 +18,13 @@ jobs:
|
|||
- name: Sync translations from crowdin
|
||||
uses: crowdin/github-action@1.5.0
|
||||
with:
|
||||
upload_translations: true
|
||||
upload_sources: true
|
||||
upload_translations: false
|
||||
download_translations: true
|
||||
|
||||
localization_branch_name: l10n_master
|
||||
create_pull_request: false
|
||||
push_translations: false
|
||||
|
||||
base_path: ${{ github.workspace }}
|
||||
env:
|
||||
|
|
|
|||
|
|
@ -811,4 +811,4 @@ namespace Ionic.Crc
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1876,4 +1876,4 @@ namespace Ionic.Zlib
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// GZipStream.cs
|
||||
// GZipStream.cs
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2009 Dino Chiesa and Microsoft Corporation.
|
||||
|
|
|
|||
|
|
@ -433,4 +433,4 @@ namespace Ionic.Zlib
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1792,4 +1792,4 @@ namespace Ionic.Zlib
|
|||
return blocks.SyncPoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -420,4 +420,4 @@ namespace Ionic.Zlib
|
|||
return res >> 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -543,4 +543,4 @@ namespace Ionic.Zlib
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// ZlibBaseStream.cs
|
||||
// ZlibBaseStream.cs
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2009 Dino Chiesa and Microsoft Corporation.
|
||||
|
|
|
|||
|
|
@ -714,4 +714,4 @@ namespace Ionic.Zlib
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -722,4 +722,4 @@ namespace Ionic.Zlib
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@ This part of the repository contains tools that may be useful for debugging
|
|||
MinecraftClientProxy
|
||||
A proxy between a MCC/Vanilla client and an offline-mode server which can intercept packets
|
||||
Useful to dump packets sent by a Vanilla minecraft client and compare them with packets from MCC
|
||||
Example of use case: https://github.com/MCCTeam/Minecraft-Console-Client/issues/195
|
||||
Example of use case: https://github.com/MCCTeam/Minecraft-Console-Client/issues/195
|
||||
|
|
|
|||
|
|
@ -13,4 +13,4 @@ RUN apt-get update && \
|
|||
apt-get install -y unzip && \
|
||||
mkdir /opt/data
|
||||
|
||||
ENTRYPOINT ["/bin/sh", "-c", "/opt/start-latest.sh"]
|
||||
ENTRYPOINT ["/bin/sh", "-c", "/opt/start-latest.sh"]
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ Global
|
|||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
RESX_ShowErrorsInErrorList = False
|
||||
RESX_SortFileContentOnSave = True
|
||||
SolutionGuid = {6DED60F4-9CF4-4DB3-8966-582B2EBE8487}
|
||||
RESX_ShowErrorsInErrorList = False
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
|||
|
|
@ -20,28 +20,28 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Alerts.Beep_Enabled$")]
|
||||
[TomlInlineComment("$ChatBot.Alerts.Beep_Enabled$")]
|
||||
public bool Beep_Enabled = true;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Alerts.Trigger_By_Words$")]
|
||||
[TomlInlineComment("$ChatBot.Alerts.Trigger_By_Words$")]
|
||||
public bool Trigger_By_Words = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Alerts.Trigger_By_Rain$")]
|
||||
[TomlInlineComment("$ChatBot.Alerts.Trigger_By_Rain$")]
|
||||
public bool Trigger_By_Rain = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Alerts.Trigger_By_Thunderstorm$")]
|
||||
[TomlInlineComment("$ChatBot.Alerts.Trigger_By_Thunderstorm$")]
|
||||
public bool Trigger_By_Thunderstorm = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Alerts.Log_To_File$")]
|
||||
[TomlInlineComment("$ChatBot.Alerts.Log_To_File$")]
|
||||
public bool Log_To_File = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Alerts.Log_File$")]
|
||||
[TomlInlineComment("$ChatBot.Alerts.Log_File$")]
|
||||
public string Log_File = @"alerts-log.txt";
|
||||
|
||||
[TomlPrecedingComment("$config.ChatBot.Alerts.Matches$")]
|
||||
[TomlPrecedingComment("$ChatBot.Alerts.Matches$")]
|
||||
public string[] Matches = new string[] { "Yourname", " whispers ", "-> me", "admin", ".com" };
|
||||
|
||||
[TomlPrecedingComment("$config.ChatBot.Alerts.Excludes$")]
|
||||
[TomlPrecedingComment("$ChatBot.Alerts.Excludes$")]
|
||||
public string[] Excludes = new string[] { "myserver.com", "Yourname>:", "Player Yourname", "Yourname joined", "Yourname left", "[Lockette] (Admin)", " Yourname:", "Yourname is" };
|
||||
|
||||
public void OnSettingUpdate()
|
||||
|
|
@ -124,7 +124,7 @@ namespace MinecraftClient.ChatBots
|
|||
Console.Beep();
|
||||
Console.Beep();
|
||||
}
|
||||
LogToConsole(Translations.bot_alerts_start_rain);
|
||||
LogToConsole("§c" + Translations.bot_alerts_start_rain);
|
||||
}
|
||||
}
|
||||
else if (curRainLevel >= threshold && level < threshold)
|
||||
|
|
@ -135,7 +135,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
Console.Beep();
|
||||
}
|
||||
LogToConsole(Translations.bot_alerts_end_rain);
|
||||
LogToConsole("§c" + Translations.bot_alerts_end_rain);
|
||||
}
|
||||
}
|
||||
curRainLevel = level;
|
||||
|
|
@ -152,7 +152,7 @@ namespace MinecraftClient.ChatBots
|
|||
Console.Beep();
|
||||
Console.Beep();
|
||||
}
|
||||
LogToConsole(Translations.bot_alerts_start_thunderstorm);
|
||||
LogToConsole("§c" + Translations.bot_alerts_start_thunderstorm);
|
||||
}
|
||||
}
|
||||
else if (curThunderLevel >= threshold && level < threshold)
|
||||
|
|
@ -163,7 +163,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
Console.Beep();
|
||||
}
|
||||
LogToConsole(Translations.bot_alerts_end_thunderstorm);
|
||||
LogToConsole("§c" + Translations.bot_alerts_end_thunderstorm);
|
||||
}
|
||||
}
|
||||
curThunderLevel = level;
|
||||
|
|
|
|||
|
|
@ -23,22 +23,22 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AntiAfk.Delay$")]
|
||||
[TomlInlineComment("$ChatBot.AntiAfk.Delay$")]
|
||||
public Range Delay = new(60);
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AntiAfk.Command$")]
|
||||
[TomlInlineComment("$ChatBot.AntiAfk.Command$")]
|
||||
public string Command = "/ping";
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AntiAfk.Use_Sneak$")]
|
||||
[TomlInlineComment("$ChatBot.AntiAfk.Use_Sneak$")]
|
||||
public bool Use_Sneak = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AntiAfk.Use_Terrain_Handling$")]
|
||||
[TomlInlineComment("$ChatBot.AntiAfk.Use_Terrain_Handling$")]
|
||||
public bool Use_Terrain_Handling = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AntiAfk.Walk_Range$")]
|
||||
[TomlInlineComment("$ChatBot.AntiAfk.Walk_Range$")]
|
||||
public int Walk_Range = 5;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AntiAfk.Walk_Retries$")]
|
||||
[TomlInlineComment("$ChatBot.AntiAfk.Walk_Retries$")]
|
||||
public int Walk_Retries = 20;
|
||||
|
||||
public void OnSettingUpdate()
|
||||
|
|
@ -93,7 +93,7 @@ namespace MinecraftClient.ChatBots
|
|||
count = 0;
|
||||
}
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (Config.Use_Terrain_Handling)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,28 +23,28 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoAttack.Mode$")]
|
||||
[TomlInlineComment("$ChatBot.AutoAttack.Mode$")]
|
||||
public AttackMode Mode = AttackMode.single;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoAttack.Priority$")]
|
||||
[TomlInlineComment("$ChatBot.AutoAttack.Priority$")]
|
||||
public PriorityType Priority = PriorityType.distance;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoAttack.Cooldown_Time$")]
|
||||
[TomlInlineComment("$ChatBot.AutoAttack.Cooldown_Time$")]
|
||||
public CooldownConfig Cooldown_Time = new(false, 1.0);
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoAttack.Interaction$")]
|
||||
[TomlInlineComment("$ChatBot.AutoAttack.Interaction$")]
|
||||
public InteractType Interaction = InteractType.Attack;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoAttack.Attack_Hostile$")]
|
||||
[TomlInlineComment("$ChatBot.AutoAttack.Attack_Hostile$")]
|
||||
public bool Attack_Hostile = true;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoAttack.Attack_Passive$")]
|
||||
[TomlInlineComment("$ChatBot.AutoAttack.Attack_Passive$")]
|
||||
public bool Attack_Passive = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoAttack.List_Mode$")]
|
||||
[TomlInlineComment("$ChatBot.AutoAttack.List_Mode$")]
|
||||
public ListType List_Mode = ListType.whitelist;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoAttack.Entites_List$")]
|
||||
[TomlInlineComment("$ChatBot.AutoAttack.Entites_List$")]
|
||||
public List<EntityType> Entites_List = new() { EntityType.Zombie, EntityType.Cow };
|
||||
|
||||
public void OnSettingUpdate()
|
||||
|
|
@ -112,7 +112,7 @@ namespace MinecraftClient.ChatBots
|
|||
attackPassive = Config.Attack_Passive;
|
||||
}
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (!GetEntityHandlingEnabled())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoCraft.CraftingTable$")]
|
||||
[TomlInlineComment("$ChatBot.AutoCraft.CraftingTable$")]
|
||||
public LocationConfig CraftingTable = new(123, 65, 456);
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoCraft.OnFailure$")]
|
||||
[TomlInlineComment("$ChatBot.AutoCraft.OnFailure$")]
|
||||
public OnFailConfig OnFailure = OnFailConfig.abort;
|
||||
|
||||
[TomlPrecedingComment("$config.ChatBot.AutoCraft.Recipes$")]
|
||||
[TomlPrecedingComment("$ChatBot.AutoCraft.Recipes$")]
|
||||
public RecipeConfig[] Recipes = new RecipeConfig[]
|
||||
{
|
||||
new RecipeConfig(
|
||||
|
|
@ -286,7 +286,7 @@ namespace MinecraftClient.ChatBots
|
|||
}
|
||||
}
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (!GetInventoryEnabled())
|
||||
{
|
||||
|
|
@ -296,7 +296,7 @@ namespace MinecraftClient.ChatBots
|
|||
return;
|
||||
}
|
||||
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
.Then(l => l.Literal("list")
|
||||
|
|
@ -310,7 +310,7 @@ namespace MinecraftClient.ChatBots
|
|||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CommandName)
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("list")
|
||||
.Executes(r => OnCommandList(r.Source)))
|
||||
.Then(l => l.Literal("start")
|
||||
|
|
@ -319,14 +319,14 @@ namespace MinecraftClient.ChatBots
|
|||
.Then(l => l.Literal("stop")
|
||||
.Executes(r => OnCommandStop(r.Source)))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
}
|
||||
|
||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||
|
|
@ -339,7 +339,7 @@ namespace MinecraftClient.ChatBots
|
|||
"stop" => Translations.bot_autoCraft_help_stop,
|
||||
"help" => Translations.bot_autoCraft_help_help,
|
||||
_ => string.Format(Translations.bot_autoCraft_available_cmd, "load, list, reload, resetcfg, start, stop, help")
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,36 +26,36 @@ namespace MinecraftClient.ChatBots
|
|||
public bool Enabled = false;
|
||||
|
||||
[NonSerialized]
|
||||
[TomlInlineComment("$config.ChatBot.AutoDig.Auto_Tool_Switch$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDig.Auto_Tool_Switch$")]
|
||||
public bool Auto_Tool_Switch = false;
|
||||
|
||||
[NonSerialized]
|
||||
[TomlInlineComment("$config.ChatBot.AutoDig.Durability_Limit$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDig.Durability_Limit$")]
|
||||
public int Durability_Limit = 2;
|
||||
|
||||
[NonSerialized]
|
||||
[TomlInlineComment("$config.ChatBot.AutoDig.Drop_Low_Durability_Tools$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDig.Drop_Low_Durability_Tools$")]
|
||||
public bool Drop_Low_Durability_Tools = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoDig.Mode$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDig.Mode$")]
|
||||
public ModeType Mode = ModeType.lookat;
|
||||
|
||||
[TomlPrecedingComment("$config.ChatBot.AutoDig.Locations$")]
|
||||
[TomlPrecedingComment("$ChatBot.AutoDig.Locations$")]
|
||||
public Coordination[] Locations = new Coordination[] { new(123.5, 64, 234.5), new(124.5, 63, 235.5) };
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoDig.Location_Order$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDig.Location_Order$")]
|
||||
public OrderType Location_Order = OrderType.distance;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoDig.Auto_Start_Delay$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDig.Auto_Start_Delay$")]
|
||||
public double Auto_Start_Delay = 3.0;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoDig.Dig_Timeout$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDig.Dig_Timeout$")]
|
||||
public double Dig_Timeout = 60.0;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoDig.Log_Block_Dig$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDig.Log_Block_Dig$")]
|
||||
public bool Log_Block_Dig = true;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoDig.List_Type$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDig.List_Type$")]
|
||||
public ListType List_Type = ListType.whitelist;
|
||||
|
||||
public List<Material> Blocks = new() { Material.Cobblestone, Material.Stone };
|
||||
|
|
@ -110,7 +110,7 @@ namespace MinecraftClient.ChatBots
|
|||
Stopping,
|
||||
}
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (!GetTerrainEnabled())
|
||||
{
|
||||
|
|
@ -124,7 +124,7 @@ namespace MinecraftClient.ChatBots
|
|||
if (!inventoryEnabled && Config.Auto_Tool_Switch)
|
||||
LogToConsole(Translations.bot_autodig_no_inv_handle);
|
||||
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
.Then(l => l.Literal("start")
|
||||
|
|
@ -136,25 +136,25 @@ namespace MinecraftClient.ChatBots
|
|||
)
|
||||
);
|
||||
|
||||
var cmd = dispatcher.Register(l => l.Literal(CommandName)
|
||||
var cmd = Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("start")
|
||||
.Executes(r => OnCommandStart(r.Source)))
|
||||
.Then(l => l.Literal("stop")
|
||||
.Executes(r => OnCommandStop(r.Source)))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal("digbot")
|
||||
Handler.dispatcher.Register(l => l.Literal("digbot")
|
||||
.Redirect(cmd)
|
||||
);
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister("digbot");
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister("digbot");
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
}
|
||||
|
||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||
|
|
@ -166,7 +166,7 @@ namespace MinecraftClient.ChatBots
|
|||
"stop" => Translations.bot_autodig_help_stop,
|
||||
"help" => Translations.bot_autodig_help_help,
|
||||
_ => string.Format(Translations.bot_autodig_available_cmd, "start, stop, help")
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoDrop.Mode$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDrop.Mode$")]
|
||||
public DropMode Mode = DropMode.include;
|
||||
|
||||
public List<ItemType> Items = new() { ItemType.Cobblestone, ItemType.Dirt };
|
||||
|
|
@ -45,7 +45,7 @@ namespace MinecraftClient.ChatBots
|
|||
private readonly int updateDebounceValue = 2;
|
||||
private int inventoryUpdated = -1;
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (!GetInventoryEnabled())
|
||||
{
|
||||
|
|
@ -55,7 +55,7 @@ namespace MinecraftClient.ChatBots
|
|||
return;
|
||||
}
|
||||
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
.Then(l => l.Literal("add")
|
||||
|
|
@ -67,7 +67,7 @@ namespace MinecraftClient.ChatBots
|
|||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CommandName)
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("on")
|
||||
.Executes(r => OnCommandEnable(r.Source, true)))
|
||||
.Then(l => l.Literal("off")
|
||||
|
|
@ -88,14 +88,14 @@ namespace MinecraftClient.ChatBots
|
|||
.Then(l => l.Literal("everything")
|
||||
.Executes(r => OnCommandMode(r.Source, DropMode.everything))))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
}
|
||||
|
||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||
|
|
@ -107,7 +107,7 @@ namespace MinecraftClient.ChatBots
|
|||
"remove" => Translations.cmd_inventory_help_usage + ": remove <item name>",
|
||||
"mode" => Translations.bot_autoDrop_unknown_mode,
|
||||
_ => string.Format(Translations.general_available_cmd, "on, off, add, remove, list, mode")
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,43 +32,43 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Antidespawn$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Antidespawn$")]
|
||||
public bool Antidespawn = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Mainhand$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Mainhand$")]
|
||||
public bool Mainhand = true;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Auto_Start$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Auto_Start$")]
|
||||
public bool Auto_Start = true;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Cast_Delay$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Cast_Delay$")]
|
||||
public double Cast_Delay = 0.4;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Fishing_Delay$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Fishing_Delay$")]
|
||||
public double Fishing_Delay = 3.0;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Fishing_Timeout$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Fishing_Timeout$")]
|
||||
public double Fishing_Timeout = 300.0;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Durability_Limit$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Durability_Limit$")]
|
||||
public double Durability_Limit = 2;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Auto_Rod_Switch$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Auto_Rod_Switch$")]
|
||||
public bool Auto_Rod_Switch = true;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Stationary_Threshold$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Stationary_Threshold$")]
|
||||
public double Stationary_Threshold = 0.001;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Hook_Threshold$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Hook_Threshold$")]
|
||||
public double Hook_Threshold = 0.2;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Log_Fish_Bobber$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Log_Fish_Bobber$")]
|
||||
public bool Log_Fish_Bobber = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Enable_Move$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Enable_Move$")]
|
||||
public bool Enable_Move = false;
|
||||
|
||||
[TomlPrecedingComment("$config.ChatBot.AutoFishing.Movements$")]
|
||||
[TomlPrecedingComment("$ChatBot.AutoFishing.Movements$")]
|
||||
public LocationConfig[] Movements = new LocationConfig[]
|
||||
{
|
||||
new LocationConfig(12.34, -23.45),
|
||||
|
|
@ -176,7 +176,7 @@ namespace MinecraftClient.ChatBots
|
|||
Stopping,
|
||||
}
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (!GetEntityHandlingEnabled())
|
||||
{
|
||||
|
|
@ -188,7 +188,7 @@ namespace MinecraftClient.ChatBots
|
|||
if (!inventoryEnabled)
|
||||
LogToConsole(Translations.bot_autoFish_no_inv_handle);
|
||||
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
.Then(l => l.Literal("start")
|
||||
|
|
@ -202,7 +202,7 @@ namespace MinecraftClient.ChatBots
|
|||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CommandName)
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("start")
|
||||
.Executes(r => OnCommandStart(r.Source)))
|
||||
.Then(l => l.Literal("stop")
|
||||
|
|
@ -212,14 +212,14 @@ namespace MinecraftClient.ChatBots
|
|||
.Then(l => l.Literal("clear")
|
||||
.Executes(r => OnCommandStatusClear(r.Source))))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
}
|
||||
|
||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||
|
|
@ -232,7 +232,7 @@ namespace MinecraftClient.ChatBots
|
|||
"status" => Translations.bot_autoFish_help_status,
|
||||
"help" => Translations.bot_autoFish_help_help,
|
||||
_ => string.Format(Translations.bot_autoFish_available_cmd, "start, stop, status, help")
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,16 +21,16 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoRelog.Delay$")]
|
||||
[TomlInlineComment("$ChatBot.AutoRelog.Delay$")]
|
||||
public Range Delay = new(3);
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoRelog.Retries$")]
|
||||
[TomlInlineComment("$ChatBot.AutoRelog.Retries$")]
|
||||
public int Retries = 3;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoRelog.Ignore_Kick_Message$")]
|
||||
[TomlInlineComment("$ChatBot.AutoRelog.Ignore_Kick_Message$")]
|
||||
public bool Ignore_Kick_Message = false;
|
||||
|
||||
[TomlPrecedingComment("$config.ChatBot.AutoRelog.Kick_Messages$")]
|
||||
[TomlPrecedingComment("$ChatBot.AutoRelog.Kick_Messages$")]
|
||||
public string[] Kick_Messages = new string[] { "Connection has been lost", "Server is restarting", "Server is full", "Too Many people" };
|
||||
|
||||
[NonSerialized]
|
||||
|
|
@ -85,12 +85,12 @@ namespace MinecraftClient.ChatBots
|
|||
LogDebugToConsole(string.Format(Translations.bot_autoRelog_launch, Config.Retries));
|
||||
}
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
Initialize();
|
||||
_Initialize();
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
private void _Initialize()
|
||||
{
|
||||
McClient.ReconnectionAttemptsLeft = Config.Retries;
|
||||
if (Config.Ignore_Kick_Message)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public string Matches_File = @"matches.ini";
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoRespond.Match_Colors$")]
|
||||
[TomlInlineComment("$ChatBot.AutoRespond.Match_Colors$")]
|
||||
public bool Match_Colors = false;
|
||||
|
||||
public void OnSettingUpdate()
|
||||
|
|
@ -187,7 +187,7 @@ namespace MinecraftClient.ChatBots
|
|||
/// <summary>
|
||||
/// Initialize the AutoRespond bot from the matches file
|
||||
/// </summary>
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (File.Exists(Config.Matches_File))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,22 +44,22 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.DiscordBridge.Token$")]
|
||||
[TomlInlineComment("$ChatBot.DiscordBridge.Token$")]
|
||||
public string Token = "your bot token here";
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.DiscordBridge.GuildId$")]
|
||||
[TomlInlineComment("$ChatBot.DiscordBridge.GuildId$")]
|
||||
public ulong GuildId = 1018553894831403028L;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.DiscordBridge.ChannelId$")]
|
||||
[TomlInlineComment("$ChatBot.DiscordBridge.ChannelId$")]
|
||||
public ulong ChannelId = 1018565295654326364L;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.DiscordBridge.OwnersIds$")]
|
||||
[TomlInlineComment("$ChatBot.DiscordBridge.OwnersIds$")]
|
||||
public ulong[] OwnersIds = new[] { 978757810781323276UL };
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.DiscordBridge.MessageSendTimeout$")]
|
||||
[TomlInlineComment("$ChatBot.DiscordBridge.MessageSendTimeout$")]
|
||||
public int Message_Send_Timeout = 3;
|
||||
|
||||
[TomlPrecedingComment("$config.ChatBot.DiscordBridge.Formats$")]
|
||||
[TomlPrecedingComment("$ChatBot.DiscordBridge.Formats$")]
|
||||
public string PrivateMessageFormat = "**[Private Message]** {username}: {message}";
|
||||
public string PublicMessageFormat = "{username}: {message}";
|
||||
public string TeleportRequestMessageFormat = "A new Teleport Request from **{username}**!";
|
||||
|
|
@ -75,15 +75,15 @@ namespace MinecraftClient.ChatBots
|
|||
instance = this;
|
||||
}
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CommandName)
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("direction")
|
||||
.Then(l => l.Literal("both")
|
||||
.Executes(r => OnCommandDirection(r.Source, BridgeDirection.Both)))
|
||||
|
|
@ -93,16 +93,16 @@ namespace MinecraftClient.ChatBots
|
|||
.Executes(r => OnCommandDirection(r.Source, BridgeDirection.Discord)))
|
||||
)
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
|
||||
Task.Run(async () => await MainAsync());
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
#pragma warning disable format // @formatter:off
|
||||
_ => "dscbridge direction <both|mc|discord>"
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Farmer.Delay_Between_Tasks$")]
|
||||
[TomlInlineComment("$ChatBot.Farmer.Delay_Between_Tasks$")]
|
||||
public double Delay_Between_Tasks = 1.0;
|
||||
|
||||
public void OnSettingUpdate()
|
||||
|
|
@ -70,7 +70,7 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
private const string commandDescription = "farmer <start <crop type> [radius:<radius = 30>] [unsafe:<true/false>] [teleport:<true/false>] [debug:<true/false>]|stop>";
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (GetProtocolVersion() < Protocol18Handler.MC_1_13_Version)
|
||||
{
|
||||
|
|
@ -90,13 +90,13 @@ namespace MinecraftClient.ChatBots
|
|||
return;
|
||||
}
|
||||
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CommandName)
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("stop")
|
||||
.Executes(r => OnCommandStop(r.Source)))
|
||||
.Then(l => l.Literal("start")
|
||||
|
|
@ -105,14 +105,14 @@ namespace MinecraftClient.ChatBots
|
|||
.Then(l => l.Argument("OtherArgs", Arguments.GreedyString())
|
||||
.Executes(r => OnCommandStart(r.Source, MccArguments.GetFarmerCropType(r, "CropType"), Arguments.GetString(r, "OtherArgs"))))))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
}
|
||||
|
||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||
|
|
@ -121,7 +121,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
#pragma warning disable format // @formatter:off
|
||||
_ => Translations.bot_farmer_desc + ": " + commandDescription
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.FollowPlayer.Update_Limit$")]
|
||||
[TomlInlineComment("$ChatBot.FollowPlayer.Update_Limit$")]
|
||||
public double Update_Limit = 1.5;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.FollowPlayer.Stop_At_Distance$")]
|
||||
[TomlInlineComment("$ChatBot.FollowPlayer.Stop_At_Distance$")]
|
||||
public double Stop_At_Distance = 3.0;
|
||||
|
||||
public void OnSettingUpdate()
|
||||
|
|
@ -44,7 +44,7 @@ namespace MinecraftClient.ChatBots
|
|||
private int _updateCounter = 0;
|
||||
private bool _unsafeEnabled = false;
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (!GetEntityHandlingEnabled())
|
||||
{
|
||||
|
|
@ -62,13 +62,13 @@ namespace MinecraftClient.ChatBots
|
|||
return;
|
||||
}
|
||||
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CommandName)
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("start")
|
||||
.Then(l => l.Argument("PlayerName", MccArguments.PlayerName())
|
||||
.Executes(r => OnCommandStart(r.Source, Arguments.GetString(r, "PlayerName"), takeRisk: false))
|
||||
|
|
@ -77,14 +77,14 @@ namespace MinecraftClient.ChatBots
|
|||
.Then(l => l.Literal("stop")
|
||||
.Executes(r => OnCommandStop(r.Source)))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
}
|
||||
|
||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||
|
|
@ -93,7 +93,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
#pragma warning disable format // @formatter:off
|
||||
_ => Translations.cmd_follow_desc + ": " + Translations.cmd_follow_usage
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
|
|
@ -223,7 +223,7 @@ namespace MinecraftClient.ChatBots
|
|||
/// <summary>
|
||||
/// Initialization of the Mailer bot
|
||||
/// </summary>
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
LogDebugToConsole(Translations.bot_mailer_init);
|
||||
LogDebugToConsole(Translations.bot_mailer_init_db + Config.DatabaseFile);
|
||||
|
|
@ -258,53 +258,31 @@ namespace MinecraftClient.ChatBots
|
|||
mailDbFileMonitor = new FileMonitor(Path.GetDirectoryName(Config.DatabaseFile)!, Path.GetFileName(Config.DatabaseFile), FileMonitorCallback);
|
||||
ignoreListFileMonitor = new FileMonitor(Path.GetDirectoryName(Config.IgnoreListFile)!, Path.GetFileName(Config.IgnoreListFile), FileMonitorCallback);
|
||||
|
||||
dispatcher.Register(l =>
|
||||
l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(string.Empty))
|
||||
.Then(l => l.Argument("any", Arguments.GreedyString()).Executes(r => OnCommandHelp(string.Empty)))
|
||||
)
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(string.Empty)))
|
||||
);
|
||||
|
||||
dispatcher.Register(l =>
|
||||
l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(string.Empty))
|
||||
.Then(l => l.Literal("getmails")
|
||||
.Executes(r => OnCommandGetMails())
|
||||
.Then(l => l.Argument("any", Arguments.GreedyString()).Executes(r => OnCommandHelp("getmails")))
|
||||
)
|
||||
.Then(l => l.Literal("getignored")
|
||||
.Executes(r => OnCommandGetIgnored())
|
||||
.Then(l => l.Argument("any", Arguments.GreedyString()).Executes(r => OnCommandHelp("getignored")))
|
||||
)
|
||||
.Then(l => l.Literal("addignored")
|
||||
.Executes(r => OnCommandHelp("addignored"))
|
||||
.Then(l => l.Argument("username", Arguments.String())
|
||||
.Executes(r => OnCommandAddIgnored(Arguments.GetString(r, "username")))
|
||||
.Then(l => l.Argument("any", Arguments.GreedyString()).Executes(r => OnCommandHelp("addignored")))
|
||||
)
|
||||
.Then(l => l.Argument("any", Arguments.GreedyString()).Executes(r => OnCommandHelp("addignored")))
|
||||
)
|
||||
.Then(l => l.Literal("removeignored")
|
||||
.Executes(r => OnCommandHelp("removeignored"))
|
||||
.Then(l => l.Argument("username", Arguments.String())
|
||||
.Executes(r => OnCommandRemoveIgnored(Arguments.GetString(r, "username")))
|
||||
.Then(l => l.Argument("any", Arguments.GreedyString()).Executes(r => OnCommandHelp("removeignored")))
|
||||
)
|
||||
.Then(l => l.Argument("any", Arguments.GreedyString()).Executes(r => OnCommandHelp("removeignored")))
|
||||
)
|
||||
.Then(l => l.Literal("_help")
|
||||
.Executes(r => OnCommandHelp(string.Empty))
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName))
|
||||
)
|
||||
.Then(l => l.Argument("any", Arguments.GreedyString()).Executes(r => OnCommandHelp(string.Empty)))
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("getmails")
|
||||
.Executes(r => OnCommandGetMails()))
|
||||
.Then(l => l.Literal("getignored")
|
||||
.Executes(r => OnCommandGetIgnored()))
|
||||
.Then(l => l.Literal("addignored")
|
||||
.Then(l => l.Argument("username", Arguments.String())
|
||||
.Executes(r => OnCommandAddIgnored(Arguments.GetString(r, "username")))))
|
||||
.Then(l => l.Literal("removeignored")
|
||||
.Then(l => l.Argument("username", Arguments.String())
|
||||
.Executes(r => OnCommandRemoveIgnored(Arguments.GetString(r, "username")))))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
}
|
||||
|
||||
private int OnCommandHelp(string cmd)
|
||||
|
|
@ -313,7 +291,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
#pragma warning disable format // @formatter:off
|
||||
_ => Translations.bot_mailer_cmd_help + ": /mailer <getmails|addignored|getignored|removeignored>"
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -35,28 +35,28 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Map.Render_In_Console$")]
|
||||
[TomlInlineComment("$ChatBot.Map.Render_In_Console$")]
|
||||
public bool Render_In_Console = true;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Map.Save_To_File$")]
|
||||
[TomlInlineComment("$ChatBot.Map.Save_To_File$")]
|
||||
public bool Save_To_File = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Map.Auto_Render_On_Update$")]
|
||||
[TomlInlineComment("$ChatBot.Map.Auto_Render_On_Update$")]
|
||||
public bool Auto_Render_On_Update = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Map.Delete_All_On_Unload$")]
|
||||
[TomlInlineComment("$ChatBot.Map.Delete_All_On_Unload$")]
|
||||
public bool Delete_All_On_Unload = true;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Map.Notify_On_First_Update$")]
|
||||
[TomlInlineComment("$ChatBot.Map.Notify_On_First_Update$")]
|
||||
public bool Notify_On_First_Update = true;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Map.Rasize_Rendered_Image$")]
|
||||
[TomlInlineComment("$ChatBot.Map.Rasize_Rendered_Image$")]
|
||||
public bool Rasize_Rendered_Image = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Map.Resize_To$")]
|
||||
[TomlInlineComment("$ChatBot.Map.Resize_To$")]
|
||||
public int Resize_To = 512;
|
||||
|
||||
[TomlPrecedingComment("$config.ChatBot.Map.Send_Rendered_To_Bridges$")]
|
||||
[TomlPrecedingComment("$ChatBot.Map.Send_Rendered_To_Bridges$")]
|
||||
public bool Send_Rendered_To_Discord = false;
|
||||
public bool Send_Rendered_To_Telegram = false;
|
||||
|
||||
|
|
@ -73,20 +73,20 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
private readonly Queue<QueuedMap> discordQueue = new();
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (!Directory.Exists(baseDirectory))
|
||||
Directory.CreateDirectory(baseDirectory);
|
||||
|
||||
DeleteRenderedMaps();
|
||||
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CommandName)
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandList(r.Source))
|
||||
.Then(l => l.Literal("list")
|
||||
.Executes(r => OnCommandList(r.Source)))
|
||||
|
|
@ -94,14 +94,14 @@ namespace MinecraftClient.ChatBots
|
|||
.Then(l => l.Argument("MapID", MccArguments.MapBotMapId())
|
||||
.Executes(r => OnCommandRender(r.Source, Arguments.GetInteger(r, "MapID")))))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
DeleteRenderedMaps();
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
#pragma warning disable format // @formatter:off
|
||||
_ => Translations.error_usage + ": /maps <list/render <id>>"
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public string File = "playerlog.txt";
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.PlayerListLogger.Delay$")]
|
||||
[TomlInlineComment("$ChatBot.PlayerListLogger.Delay$")]
|
||||
public double Delay = 60;
|
||||
|
||||
public void OnSettingUpdate()
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.ReplayCapture.Backup_Interval$")]
|
||||
[TomlInlineComment("$ChatBot.ReplayCapture.Backup_Interval$")]
|
||||
public double Backup_Interval = 300.0;
|
||||
|
||||
public void OnSettingUpdate()
|
||||
|
|
@ -40,33 +40,33 @@ namespace MinecraftClient.ChatBots
|
|||
private ReplayHandler? replay;
|
||||
private int backupCounter = -1;
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
SetNetworkPacketEventEnabled(true);
|
||||
replay = new ReplayHandler(GetProtocolVersion());
|
||||
replay.MetaData.serverName = GetServerHost() + GetServerPort();
|
||||
backupCounter = Settings.DoubleToTick(Config.Backup_Interval);
|
||||
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CommandName)
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("save")
|
||||
.Executes(r => OnCommandSave(r.Source)))
|
||||
.Then(l => l.Literal("stop")
|
||||
.Executes(r => OnCommandStop(r.Source)))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
}
|
||||
|
||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||
|
|
@ -75,7 +75,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
#pragma warning disable format // @formatter:off
|
||||
_ => string.Format(Translations.general_available_cmd, "save, stop")
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ namespace MinecraftClient.ChatBots
|
|||
return false;
|
||||
}
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
//Load the given file from the startup parameters
|
||||
if (LookForScript(ref file!))
|
||||
|
|
|
|||
|
|
@ -47,19 +47,19 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.TelegramBridge.Token$")]
|
||||
[TomlInlineComment("$ChatBot.TelegramBridge.Token$")]
|
||||
public string Token = "your bot token here";
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.TelegramBridge.ChannelId$")]
|
||||
[TomlInlineComment("$ChatBot.TelegramBridge.ChannelId$")]
|
||||
public string ChannelId = "";
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.TelegramBridge.Authorized_Chat_Ids$")]
|
||||
[TomlInlineComment("$ChatBot.TelegramBridge.Authorized_Chat_Ids$")]
|
||||
public long[] Authorized_Chat_Ids = Array.Empty<long>();
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.TelegramBridge.MessageSendTimeout$")]
|
||||
[TomlInlineComment("$ChatBot.TelegramBridge.MessageSendTimeout$")]
|
||||
public int Message_Send_Timeout = 3;
|
||||
|
||||
[TomlPrecedingComment("$config.ChatBot.TelegramBridge.Formats$")]
|
||||
[TomlPrecedingComment("$ChatBot.TelegramBridge.Formats$")]
|
||||
public string PrivateMessageFormat = "*(Private Message)* {username}: {message}";
|
||||
public string PublicMessageFormat = "{username}: {message}";
|
||||
public string TeleportRequestMessageFormat = "A new Teleport Request from **{username}**!";
|
||||
|
|
@ -75,15 +75,15 @@ namespace MinecraftClient.ChatBots
|
|||
instance = this;
|
||||
}
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CommandName)
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("direction")
|
||||
.Then(l => l.Literal("both")
|
||||
.Executes(r => OnCommandDirection(r.Source, BridgeDirection.Both)))
|
||||
|
|
@ -92,16 +92,16 @@ namespace MinecraftClient.ChatBots
|
|||
.Then(l => l.Literal("telegram")
|
||||
.Executes(r => OnCommandDirection(r.Source, BridgeDirection.Telegram))))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
|
||||
Task.Run(async () => await MainAsync());
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
#pragma warning disable format // @formatter:off
|
||||
_ => Translations.error_usage + ": /tgbridge direction <both|mc|telegram>"
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace MinecraftClient
|
|||
StringBuilder sb = new();
|
||||
string s = (string.IsNullOrEmpty(CmdUsage) || string.IsNullOrEmpty(CmdDesc)) ? string.Empty : ": "; // If either one is empty, no colon :
|
||||
sb.Append("§e").Append(cmdChar).Append(CmdUsage).Append("§r").Append(s).AppendLine(CmdDesc);
|
||||
sb.Append(McClient.dispatcher.GetAllUsageString(CmdName, false));
|
||||
sb.Append(CmdResult.client!.dispatcher.GetAllUsageString(CmdName, false));
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Text;
|
||||
using Brigadier.NET;
|
||||
using Brigadier.NET.Builder;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Brigadier.NET;
|
||||
using Brigadier.NET;
|
||||
using Brigadier.NET.Builder;
|
||||
using MinecraftClient.CommandHandler;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using Brigadier.NET;
|
||||
using Brigadier.NET.Builder;
|
||||
using MinecraftClient.CommandHandler;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using Brigadier.NET;
|
||||
using Brigadier.NET.Builder;
|
||||
using MinecraftClient.CommandHandler;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Brigadier.NET;
|
||||
using Brigadier.NET;
|
||||
using Brigadier.NET.Builder;
|
||||
using MinecraftClient.CommandHandler;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Brigadier.NET;
|
||||
using Brigadier.NET.Builder;
|
||||
|
|
|
|||
75
MinecraftClient/Commands/Upgrade.cs
Normal file
75
MinecraftClient/Commands/Upgrade.cs
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
using System.Collections.Generic;
|
||||
using Brigadier.NET;
|
||||
using Brigadier.NET.Builder;
|
||||
using MinecraftClient.CommandHandler;
|
||||
|
||||
namespace MinecraftClient.Commands
|
||||
{
|
||||
class Upgrade : Command
|
||||
{
|
||||
public override string CmdName { get { return "upgrade"; } }
|
||||
public override string CmdUsage { get { return "upgrade [-f|check|cancel|download]"; } }
|
||||
public override string CmdDesc { get { return string.Empty; } }
|
||||
|
||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher) {
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CmdName)
|
||||
.Executes(r => GetUsage(r.Source, string.Empty))
|
||||
.Then(l => l.Literal("cancel")
|
||||
.Executes(r => GetUsage(r.Source, "cancel")))
|
||||
.Then(l => l.Literal("check")
|
||||
.Executes(r => GetUsage(r.Source, "check")))
|
||||
.Then(l => l.Literal("download")
|
||||
.Executes(r => GetUsage(r.Source, "download")))
|
||||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CmdName)
|
||||
.Executes(r => DownloadUpdate(r.Source, force: false))
|
||||
.Then(l => l.Literal("-f")
|
||||
.Executes(r => DownloadUpdate(r.Source, force: true)))
|
||||
.Then(l => l.Literal("download")
|
||||
.Executes(r => DownloadUpdate(r.Source, force: false))
|
||||
.Then(l => l.Literal("-f")
|
||||
.Executes(r => DownloadUpdate(r.Source, force: true))))
|
||||
.Then(l => l.Literal("check")
|
||||
.Executes(r => CheckUpdate(r.Source)))
|
||||
.Then(l => l.Literal("cancel")
|
||||
.Executes(r => CancelDownloadUpdate(r.Source)))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||
);
|
||||
}
|
||||
|
||||
private int GetUsage(CmdResult r, string? cmd) {
|
||||
return r.SetAndReturn(cmd switch {
|
||||
#pragma warning disable format // @formatter:off
|
||||
"cancel" => GetCmdDescTranslated(),
|
||||
"check" => GetCmdDescTranslated(),
|
||||
"download" => GetCmdDescTranslated(),
|
||||
_ => GetCmdDescTranslated(),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
||||
private static int DownloadUpdate(CmdResult r, bool force)
|
||||
{
|
||||
if (UpgradeHelper.DownloadLatestBuild(force))
|
||||
return r.SetAndReturn(CmdResult.Status.Done, Translations.mcc_update_start);
|
||||
else
|
||||
return r.SetAndReturn(CmdResult.Status.Fail, Translations.mcc_update_already_running);
|
||||
}
|
||||
|
||||
private static int CancelDownloadUpdate(CmdResult r)
|
||||
{
|
||||
UpgradeHelper.CancelDownloadUpdate();
|
||||
return r.SetAndReturn(CmdResult.Status.Done, Translations.mcc_update_cancel);
|
||||
}
|
||||
|
||||
private static int CheckUpdate(CmdResult r)
|
||||
{
|
||||
UpgradeHelper.CheckUpdate(forceUpdate: true);
|
||||
return r.SetAndReturn(CmdResult.Status.Done, Translations.mcc_update_start);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using Brigadier.NET;
|
||||
using Brigadier.NET;
|
||||
using Brigadier.NET.Builder;
|
||||
using MinecraftClient.CommandHandler;
|
||||
using MinecraftClient.Mapping;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Brigadier.NET;
|
||||
using FuzzySharp;
|
||||
using MinecraftClient.CommandHandler;
|
||||
using MinecraftClient.Scripting;
|
||||
|
|
@ -182,7 +183,6 @@ namespace MinecraftClient
|
|||
|
||||
#endregion
|
||||
|
||||
|
||||
internal static bool AutoCompleteDone = false;
|
||||
internal static string[] AutoCompleteResult = Array.Empty<string>();
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ namespace MinecraftClient
|
|||
string command = fullCommand[offset..];
|
||||
if (command.Length == 0)
|
||||
{
|
||||
var childs = McClient.dispatcher.GetRoot().Children;
|
||||
var childs = CmdResult.client!.dispatcher.GetRoot().Children;
|
||||
int index = 0;
|
||||
var sugList = new ConsoleInteractive.ConsoleSuggestion.Suggestion[childs.Count + Commands.Count + 1];
|
||||
|
||||
|
|
@ -243,9 +243,9 @@ namespace MinecraftClient
|
|||
}
|
||||
else
|
||||
{
|
||||
var parse = McClient.dispatcher.Parse(command, CmdResult.Empty);
|
||||
var parse = CmdResult.client!.dispatcher.Parse(command, CmdResult.Empty);
|
||||
|
||||
var suggestion = await McClient.dispatcher.GetCompletionSuggestions(parse, buffer.CursorPosition - offset);
|
||||
var suggestion = await CmdResult.client!.dispatcher.GetCompletionSuggestions(parse, buffer.CursorPosition - offset);
|
||||
|
||||
int sugLen = suggestion.List.Count;
|
||||
if (sugLen == 0)
|
||||
|
|
@ -324,7 +324,7 @@ namespace MinecraftClient
|
|||
MergeCommands();
|
||||
}
|
||||
|
||||
public static void InitAutocomplete()
|
||||
public static void InitCommandList(CommandDispatcher<CmdResult> dispatcher)
|
||||
{
|
||||
autocomplete_engine!.AutoComplete("/");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ namespace MinecraftClient
|
|||
if (Settings.Config.Logging.DebugMessages)
|
||||
{
|
||||
string callerClass = new System.Diagnostics.StackFrame(1).GetMethod()!.DeclaringType!.Name;
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.filemonitor_init, callerClass, Path.Combine(folder, filename)));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.filemonitor_init, callerClass, Path.Combine(folder, filename)));
|
||||
}
|
||||
|
||||
try
|
||||
|
|
@ -43,7 +43,7 @@ namespace MinecraftClient
|
|||
if (Settings.Config.Logging.DebugMessages)
|
||||
{
|
||||
string callerClass = new System.Diagnostics.StackFrame(1).GetMethod()!.DeclaringType!.Name;
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.filemonitor_fail, callerClass));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.filemonitor_fail, callerClass));
|
||||
}
|
||||
|
||||
monitor = null;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace MinecraftClient.Inventory
|
||||
namespace MinecraftClient.Inventory
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a Minecraft effects
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace MinecraftClient.Inventory
|
||||
namespace MinecraftClient.Inventory
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a Minecraft hand
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Inventory.ItemPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Inventory.ItemPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Inventory.ItemPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Inventory.ItemPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Inventory.ItemPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Inventory.ItemPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace MinecraftClient.Inventory
|
||||
namespace MinecraftClient.Inventory
|
||||
{
|
||||
/// <summary>
|
||||
/// Generated using the --generator flag on the client
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Mapping.BlockPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Mapping.BlockPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Mapping.BlockPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Mapping.BlockPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Mapping.BlockPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Mapping.BlockPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Mapping.BlockPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace MinecraftClient.Mapping
|
||||
namespace MinecraftClient.Mapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a unit movement in the world
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace MinecraftClient.Mapping
|
||||
namespace MinecraftClient.Mapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a unit movement in the world
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MinecraftClient.Inventory;
|
||||
using MinecraftClient.Protocol.Message;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Mapping.EntityPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Mapping.EntityPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Mapping.EntityPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Mapping.EntityPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Mapping.EntityPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Mapping.EntityPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Mapping.EntityPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace MinecraftClient.Mapping
|
||||
namespace MinecraftClient.Mapping
|
||||
{
|
||||
public enum EntityPose
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace MinecraftClient.Mapping
|
||||
namespace MinecraftClient.Mapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents Minecraft Entity Types
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
|
|
@ -30,7 +30,7 @@ namespace MinecraftClient
|
|||
{
|
||||
public static int ReconnectionAttemptsLeft = 0;
|
||||
|
||||
public static CommandDispatcher<CmdResult> dispatcher = new();
|
||||
public CommandDispatcher<CmdResult> dispatcher = new();
|
||||
private readonly Dictionary<Guid, PlayerInfo> onlinePlayers = new();
|
||||
|
||||
private static bool commandsLoaded = false;
|
||||
|
|
@ -810,7 +810,7 @@ namespace MinecraftClient
|
|||
b.SetHandler(this);
|
||||
bots.Add(b);
|
||||
if (init)
|
||||
DispatchBotEvent(bot => bot.Initialize(dispatcher), new ChatBot[] { b });
|
||||
DispatchBotEvent(bot => bot.Initialize(), new ChatBot[] { b });
|
||||
if (handler != null)
|
||||
DispatchBotEvent(bot => bot.AfterGameJoined(), new ChatBot[] { b });
|
||||
}
|
||||
|
|
@ -826,7 +826,7 @@ namespace MinecraftClient
|
|||
return;
|
||||
}
|
||||
|
||||
b.OnUnload(dispatcher);
|
||||
b.OnUnload();
|
||||
|
||||
bots.RemoveAll(item => ReferenceEquals(item, b));
|
||||
|
||||
|
|
@ -2398,7 +2398,7 @@ namespace MinecraftClient
|
|||
|
||||
DispatchBotEvent(bot => bot.AfterGameJoined());
|
||||
|
||||
ConsoleIO.InitAutocomplete();
|
||||
ConsoleIO.InitCommandList(dispatcher);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -2952,7 +2952,7 @@ namespace MinecraftClient
|
|||
/// Called on Entity Equipment
|
||||
/// </summary>
|
||||
/// <param name="entityid"> Entity ID</param>
|
||||
/// <param name="slot"> Equipment slot. 0: main hand, 1: off hand, 2–5: armor slot (2: boots, 3: leggings, 4: chestplate, 5: helmet)</param>
|
||||
/// <param name="slot"> Equipment slot. 0: main hand, 1: off hand, 2-5: armor slot (2: boots, 3: leggings, 4: chestplate, 5: helmet)</param>
|
||||
/// <param name="item"> Item)</param>
|
||||
public void OnEntityEquipment(int entityid, int slot, Item? item)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
<PackageReference Include="FuzzySharp" Version="2.0.2" />
|
||||
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="12.2.1" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.4.0" />
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.9" />
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.0" />
|
||||
<PackageReference Include="Samboy063.Tomlet" Version="5.0.1" />
|
||||
|
|
@ -79,6 +80,11 @@
|
|||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>AsciiArt.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Resources\ConfigComments\ConfigComments.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>ConfigComments.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Resources\Translations\Translations.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
|
|
@ -91,6 +97,11 @@
|
|||
<LastGenOutput>AsciiArt.Designer.cs</LastGenOutput>
|
||||
<CustomToolNamespace>MinecraftClient</CustomToolNamespace>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Resources\ConfigComments\ConfigComments.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>ConfigComments.Designer.cs</LastGenOutput>
|
||||
<CustomToolNamespace>MinecraftClient</CustomToolNamespace>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Resources\Translations\Translations.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Translations.Designer.cs</LastGenOutput>
|
||||
|
|
|
|||
|
|
@ -3,10 +3,8 @@ using System.Collections.Generic;
|
|||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MinecraftClient.Inventory.ItemPalettes;
|
||||
|
|
@ -140,7 +138,7 @@ namespace MinecraftClient
|
|||
Config.Main.Advanced.Language = Settings.GetDefaultGameLanguage();
|
||||
WriteBackSettings(false);
|
||||
if (newlyGenerated)
|
||||
ConsoleIO.WriteLineFormatted(Translations.mcc_settings_generated);
|
||||
ConsoleIO.WriteLineFormatted("§c" + Translations.mcc_settings_generated);
|
||||
ConsoleIO.WriteLine(Translations.mcc_run_with_default_settings);
|
||||
}
|
||||
else if (!loadSucceed)
|
||||
|
|
@ -201,6 +199,18 @@ namespace MinecraftClient
|
|||
return;
|
||||
}
|
||||
|
||||
if (args.Contains("--upgrade"))
|
||||
{
|
||||
UpgradeHelper.HandleBlockingUpdate(forceUpgrade: false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Contains("--force-upgrade"))
|
||||
{
|
||||
UpgradeHelper.HandleBlockingUpdate(forceUpgrade: true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Contains("--generate"))
|
||||
{
|
||||
string dataGenerator = "";
|
||||
|
|
@ -285,47 +295,7 @@ namespace MinecraftClient
|
|||
}
|
||||
|
||||
// Check for updates
|
||||
{
|
||||
bool needPromptUpdate = true;
|
||||
if (Settings.CheckUpdate(Config.Head.CurrentVersion, Config.Head.LatestVersion))
|
||||
{
|
||||
needPromptUpdate = false;
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_has_update, Settings.GithubReleaseUrl));
|
||||
}
|
||||
Task.Run(() =>
|
||||
{
|
||||
HttpClientHandler httpClientHandler = new() { AllowAutoRedirect = false };
|
||||
HttpClient httpClient = new(httpClientHandler);
|
||||
Task<HttpResponseMessage>? httpWebRequest = null;
|
||||
try
|
||||
{
|
||||
httpWebRequest = httpClient.GetAsync(Settings.GithubLatestReleaseUrl, HttpCompletionOption.ResponseHeadersRead);
|
||||
httpWebRequest.Wait();
|
||||
HttpResponseMessage res = httpWebRequest.Result;
|
||||
if (res.Headers.Location != null)
|
||||
{
|
||||
Match match = Regex.Match(res.Headers.Location.ToString(), Settings.GithubReleaseUrl + @"/tag/(\d{4})(\d{2})(\d{2})-(\d+)");
|
||||
if (match.Success && match.Groups.Count == 5)
|
||||
{
|
||||
string year = match.Groups[1].Value, month = match.Groups[2].Value, day = match.Groups[3].Value, run = match.Groups[4].Value;
|
||||
string latestVersion = string.Format("GitHub build {0}, built on {1}-{2}-{3}", run, year, month, day);
|
||||
if (needPromptUpdate)
|
||||
if (Settings.CheckUpdate(Config.Head.CurrentVersion, Config.Head.LatestVersion))
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_has_update, Settings.GithubReleaseUrl));
|
||||
if (latestVersion != Config.Head.LatestVersion)
|
||||
{
|
||||
Config.Head.LatestVersion = latestVersion;
|
||||
WriteBackSettings(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception) { }
|
||||
finally { httpWebRequest?.Dispose(); }
|
||||
httpClient.Dispose();
|
||||
httpClientHandler.Dispose();
|
||||
});
|
||||
}
|
||||
UpgradeHelper.CheckUpdate();
|
||||
|
||||
// Load command-line arguments
|
||||
if (args.Length >= 1)
|
||||
|
|
@ -382,7 +352,7 @@ namespace MinecraftClient
|
|||
{
|
||||
bool cacheLoaded = SessionCache.InitializeDiskCache();
|
||||
if (Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(cacheLoaded ? Translations.debug_session_cache_ok : Translations.debug_session_cache_fail, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + (cacheLoaded ? Translations.debug_session_cache_ok : Translations.debug_session_cache_fail), acceptnewlines: true);
|
||||
}
|
||||
|
||||
// Setup exit cleaning code
|
||||
|
|
@ -416,7 +386,7 @@ namespace MinecraftClient
|
|||
/// </summary>
|
||||
private static void RequestPassword()
|
||||
{
|
||||
ConsoleIO.WriteLine(ConsoleIO.BasicIO ? string.Format(Translations.mcc_password_basic_io, InternalConfig.Account.Login) + "\n" : Translations.mcc_password);
|
||||
ConsoleIO.WriteLine(ConsoleIO.BasicIO ? string.Format(Translations.mcc_password_basic_io, InternalConfig.Account.Login) + "\n" : Translations.mcc_password_hidden);
|
||||
string? password = ConsoleIO.BasicIO ? Console.ReadLine() : ConsoleIO.ReadPassword();
|
||||
if (string.IsNullOrWhiteSpace(password))
|
||||
InternalConfig.Account.Password = "-";
|
||||
|
|
@ -439,7 +409,7 @@ namespace MinecraftClient
|
|||
string loginLower = ToLowerIfNeed(InternalConfig.Account.Login);
|
||||
if (InternalConfig.Account.Password == "-")
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(Translations.mcc_offline, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.mcc_offline, acceptnewlines: true);
|
||||
result = ProtocolHandler.LoginResult.Success;
|
||||
session.PlayerID = "0";
|
||||
session.PlayerName = InternalConfig.Username;
|
||||
|
|
@ -453,7 +423,7 @@ namespace MinecraftClient
|
|||
result = ProtocolHandler.GetTokenValidation(session);
|
||||
if (result != ProtocolHandler.LoginResult.Success)
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(Translations.mcc_session_invalid, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.mcc_session_invalid, acceptnewlines: true);
|
||||
// Try to refresh access token
|
||||
if (!string.IsNullOrWhiteSpace(session.RefreshToken))
|
||||
{
|
||||
|
|
@ -473,7 +443,7 @@ namespace MinecraftClient
|
|||
&& !(Config.Main.General.AccountType == LoginType.microsoft && Config.Main.General.Method == LoginMethod.browser))
|
||||
RequestPassword();
|
||||
}
|
||||
else ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_session_valid, session.PlayerName));
|
||||
else ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.mcc_session_valid, session.PlayerName));
|
||||
}
|
||||
|
||||
if (result != ProtocolHandler.LoginResult.Success)
|
||||
|
|
@ -564,7 +534,7 @@ namespace MinecraftClient
|
|||
if (protocolversion != 0)
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_use_version, InternalConfig.MinecraftVersion, protocolversion));
|
||||
else
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_unknown_version, InternalConfig.MinecraftVersion));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.mcc_unknown_version, InternalConfig.MinecraftVersion));
|
||||
|
||||
if (useMcVersionOnce)
|
||||
{
|
||||
|
|
@ -598,16 +568,16 @@ namespace MinecraftClient
|
|||
{
|
||||
bool cacheKeyLoaded = KeysCache.InitializeDiskCache();
|
||||
if (Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(cacheKeyLoaded ? Translations.debug_keys_cache_ok : Translations.debug_keys_cache_fail, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + (cacheKeyLoaded ? Translations.debug_keys_cache_ok : Translations.debug_keys_cache_fail), acceptnewlines: true);
|
||||
}
|
||||
|
||||
if (Config.Main.Advanced.ProfileKeyCache != CacheType.none && KeysCache.Contains(loginLower))
|
||||
{
|
||||
playerKeyPair = KeysCache.Get(loginLower);
|
||||
if (playerKeyPair.NeedRefresh())
|
||||
ConsoleIO.WriteLineFormatted(Translations.mcc_profile_key_invalid, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.mcc_profile_key_invalid, acceptnewlines: true);
|
||||
else
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_profile_key_valid, session.PlayerName));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.mcc_profile_key_valid, session.PlayerName));
|
||||
}
|
||||
|
||||
if (playerKeyPair == null || playerKeyPair.NeedRefresh())
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace MinecraftClient.Protocol
|
||||
namespace MinecraftClient.Protocol
|
||||
{
|
||||
public enum EntityActionType
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||
{
|
||||
|
|
@ -173,4 +173,4 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
return typeOut;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||
{
|
||||
|
|
@ -174,4 +174,4 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
return typeOut;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||
{
|
||||
|
|
@ -177,4 +177,4 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
return typeOut;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
|
@ -42,19 +42,19 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
|
||||
if (Handler.GetTerrainEnabled())
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(Translations.extra_terrainandmovement_disabled, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§c" + Translations.extra_terrainandmovement_disabled, acceptnewlines: true);
|
||||
Handler.SetTerrainEnabled(false);
|
||||
}
|
||||
|
||||
if (handler.GetInventoryEnabled())
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(Translations.extra_inventory_disabled, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§c" + Translations.extra_inventory_disabled, acceptnewlines: true);
|
||||
handler.SetInventoryEnabled(false);
|
||||
}
|
||||
|
||||
if (handler.GetEntityHandlingEnabled())
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(Translations.extra_entity_disabled, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§c" + Translations.extra_entity_disabled, acceptnewlines: true);
|
||||
handler.SetEntityHandlingEnabled(false);
|
||||
}
|
||||
}
|
||||
|
|
@ -500,15 +500,15 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
byte[] token = ReadNextByteArray();
|
||||
|
||||
if (serverID == "-")
|
||||
ConsoleIO.WriteLineFormatted(Translations.mcc_server_offline, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.mcc_server_offline, acceptnewlines: true);
|
||||
else if (Settings.Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_handshake, serverID));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.mcc_handshake, serverID));
|
||||
|
||||
return StartEncryption(uuid, username, sessionID, token, serverID, PublicServerkey, session);
|
||||
}
|
||||
else
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(Translations.error_invalid_response, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.error_invalid_response, acceptnewlines: true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -519,7 +519,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
byte[] secretKey = CryptoHandler.ClientAESPrivateKey ?? CryptoHandler.GenerateAESPrivateKey();
|
||||
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(Translations.debug_crypto, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.debug_crypto, acceptnewlines: true);
|
||||
|
||||
if (serverIDhash != "-")
|
||||
{
|
||||
|
|
@ -584,7 +584,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
else
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(Translations.error_invalid_encrypt, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.error_invalid_encrypt, acceptnewlines: true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
|
@ -106,18 +106,18 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
|
||||
if (handler.GetTerrainEnabled() && protocolVersion > MC_1_19_2_Version)
|
||||
{
|
||||
log.Error(Translations.extra_terrainandmovement_disabled);
|
||||
log.Error("§c" + Translations.extra_terrainandmovement_disabled);
|
||||
handler.SetTerrainEnabled(false);
|
||||
}
|
||||
|
||||
if (handler.GetInventoryEnabled() && (protocolVersion < MC_1_10_Version || protocolVersion > MC_1_19_2_Version))
|
||||
{
|
||||
log.Error(Translations.extra_inventory_disabled);
|
||||
log.Error("§c" + Translations.extra_inventory_disabled);
|
||||
handler.SetInventoryEnabled(false);
|
||||
}
|
||||
if (handler.GetEntityHandlingEnabled() && (protocolVersion < MC_1_10_Version || protocolVersion > MC_1_19_2_Version))
|
||||
{
|
||||
log.Error(Translations.extra_entity_disabled);
|
||||
log.Error("§c" + Translations.extra_entity_disabled);
|
||||
handler.SetEntityHandlingEnabled(false);
|
||||
}
|
||||
|
||||
|
|
@ -1955,12 +1955,12 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
else if (packetID == 0x02) //Login successful
|
||||
{
|
||||
log.Info(Translations.mcc_server_offline);
|
||||
log.Info("§8" + Translations.mcc_server_offline);
|
||||
login_phase = false;
|
||||
|
||||
if (!pForge.CompleteForgeHandshake())
|
||||
{
|
||||
log.Error(Translations.error_forge);
|
||||
log.Error("§8" + Translations.error_forge);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1980,7 +1980,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
RSACryptoServiceProvider RSAService = CryptoHandler.DecodeRSAPublicKey(serverPublicKey)!;
|
||||
byte[] secretKey = CryptoHandler.ClientAESPrivateKey ?? CryptoHandler.GenerateAESPrivateKey();
|
||||
|
||||
log.Debug(Translations.debug_crypto);
|
||||
log.Debug("§8" + Translations.debug_crypto);
|
||||
|
||||
if (serverIDhash != "-")
|
||||
{
|
||||
|
|
@ -2049,7 +2049,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
(int packetID, Queue<byte> packetData) = ReadNextPacket();
|
||||
if (packetID < 0 || loopPrevention-- < 0) // Failed to read packet or too many iterations (issue #1150)
|
||||
{
|
||||
handler.OnConnectionLost(ChatBot.DisconnectReason.ConnectionLost, Translations.error_invalid_encrypt);
|
||||
handler.OnConnectionLost(ChatBot.DisconnectReason.ConnectionLost, "§8" + Translations.error_invalid_encrypt);
|
||||
return false;
|
||||
}
|
||||
else if (packetID == 0x00) //Login rejected
|
||||
|
|
@ -2085,7 +2085,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
|
||||
if (!pForge.CompleteForgeHandshake())
|
||||
{
|
||||
log.Error(Translations.error_forge_encrypt);
|
||||
log.Error("§8" + Translations.error_forge_encrypt);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2207,7 +2207,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
// Check for forge on the server.
|
||||
Protocol18Forge.ServerInfoCheckForge(jsonData, ref forgeInfo);
|
||||
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_server_protocol, version, protocolVersion + (forgeInfo != null ? Translations.mcc_with_forge : "")));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.mcc_server_protocol, version, protocolVersion + (forgeInfo != null ? Translations.mcc_with_forge : "")));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
byte fmlProtocolVersion = dataTypes.ReadNextByte(packetData);
|
||||
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_version, fmlProtocolVersion));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_version, fmlProtocolVersion));
|
||||
|
||||
if (fmlProtocolVersion >= 1)
|
||||
currentDimension = dataTypes.ReadNextInt(packetData);
|
||||
|
|
@ -143,7 +143,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
|
||||
// Then tell the server that we're running the same mods.
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(Translations.forge_send_mod, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.forge_send_mod, acceptnewlines: true);
|
||||
byte[][] mods = new byte[forgeInfo.Mods.Count][];
|
||||
for (int i = 0; i < forgeInfo.Mods.Count; i++)
|
||||
{
|
||||
|
|
@ -163,7 +163,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
Thread.Sleep(2000);
|
||||
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(Translations.forge_accept, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.forge_accept, acceptnewlines: true);
|
||||
// Tell the server that yes, we are OK with the mods it has
|
||||
// even though we don't actually care what mods it has.
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
int registrySize = dataTypes.ReadNextVarInt(packetData);
|
||||
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_registry, registrySize));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_registry, registrySize));
|
||||
|
||||
fmlHandshakeState = FMLHandshakeClientState.PENDINGCOMPLETE;
|
||||
}
|
||||
|
|
@ -197,7 +197,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
string registryName = dataTypes.ReadNextString(packetData);
|
||||
int registrySize = dataTypes.ReadNextVarInt(packetData);
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_registry_2, registryName, registrySize));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_registry_2, registryName, registrySize));
|
||||
if (!hasNextRegistry)
|
||||
fmlHandshakeState = FMLHandshakeClientState.PENDINGCOMPLETE;
|
||||
}
|
||||
|
|
@ -209,7 +209,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
if (discriminator != FMLHandshakeDiscriminator.HandshakeAck)
|
||||
return false;
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(Translations.forge_accept_registry, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.forge_accept_registry, acceptnewlines: true);
|
||||
SendForgeHandshakePacket(FMLHandshakeDiscriminator.HandshakeAck,
|
||||
new byte[] { (byte)FMLHandshakeClientState.PENDINGCOMPLETE });
|
||||
fmlHandshakeState = FMLHandshakeClientState.COMPLETE;
|
||||
|
|
@ -303,7 +303,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
// [1]: Version is usually set to "FML2" for FML stuff and "1" for mods
|
||||
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(Translations.forge_fml2_mod, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.forge_fml2_mod, acceptnewlines: true);
|
||||
|
||||
List<string> mods = new();
|
||||
int modCount = dataTypes.ReadNextVarInt(packetData);
|
||||
|
|
@ -335,7 +335,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
// In MCC, we just want to send a valid response so we'll reply back with data collected from the server.
|
||||
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(Translations.forge_fml2_mod_send, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.forge_fml2_mod_send, acceptnewlines: true);
|
||||
|
||||
// Packet ID 2: Client to Server Mod List
|
||||
fmlResponsePacket.AddRange(dataTypes.GetVarInt(2));
|
||||
|
|
@ -373,7 +373,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
if (Settings.Config.Logging.DebugMessages)
|
||||
{
|
||||
string registryName = dataTypes.ReadNextString(packetData);
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_fml2_registry, registryName));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_fml2_registry, registryName));
|
||||
}
|
||||
|
||||
fmlResponsePacket.AddRange(dataTypes.GetVarInt(99));
|
||||
|
|
@ -392,7 +392,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
if (Settings.Config.Logging.DebugMessages)
|
||||
{
|
||||
string configName = dataTypes.ReadNextString(packetData);
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_fml2_config, configName));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_fml2_config, configName));
|
||||
}
|
||||
|
||||
fmlResponsePacket.AddRange(dataTypes.GetVarInt(99));
|
||||
|
|
@ -401,7 +401,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
|
||||
default:
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_fml2_unknown, packetID));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_fml2_unknown, packetID));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -417,7 +417,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
else if (Settings.Config.Logging.DebugMessages)
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_fml2_unknown_channel, fmlChannel));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_fml2_unknown_channel, fmlChannel));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
@ -506,10 +506,10 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
forgeInfo = new ForgeInfo(modData, fmlVersion);
|
||||
if (forgeInfo.Mods.Any())
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_with_mod, forgeInfo.Mods.Count));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_with_mod, forgeInfo.Mods.Count));
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(Translations.forge_mod_list, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.forge_mod_list, acceptnewlines: true);
|
||||
foreach (ForgeInfo.ForgeMod mod in forgeInfo.Mods)
|
||||
ConsoleIO.WriteLineFormatted("§8 " + mod.ToString());
|
||||
}
|
||||
|
|
@ -517,7 +517,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
else
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(Translations.forge_no_mod, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.forge_no_mod, acceptnewlines: true);
|
||||
forgeInfo = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MinecraftClient.Inventory;
|
||||
using MinecraftClient.Mapping;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MinecraftClient.Inventory;
|
||||
using MinecraftClient.Logger;
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ namespace MinecraftClient.Protocol.Message
|
|||
//File not found? Try downloading language file from Mojang's servers?
|
||||
if (!File.Exists(Language_File))
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.chat_download, Config.Main.Advanced.Language));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.chat_download, Config.Main.Advanced.Language));
|
||||
HttpClient httpClient = new();
|
||||
try
|
||||
{
|
||||
|
|
@ -244,11 +244,11 @@ namespace MinecraftClient.Protocol.Message
|
|||
stringBuilder.Append(entry.Key).Append('=').Append(entry.Value.StringValue.Replace("\n", "\\n").Replace("\r", string.Empty)).Append(Environment.NewLine);
|
||||
File.WriteAllText(Language_File, stringBuilder.ToString());
|
||||
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.chat_done, Language_File));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.chat_done, Language_File));
|
||||
}
|
||||
catch
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(Translations.chat_fail, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.chat_fail, acceptnewlines: true);
|
||||
}
|
||||
httpClient.Dispose();
|
||||
}
|
||||
|
|
@ -281,7 +281,7 @@ namespace MinecraftClient.Protocol.Message
|
|||
}
|
||||
else //No external dictionnary found.
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.chat_not_found, Language_File));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.chat_not_found, Language_File));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ namespace MinecraftClient.Protocol.ProfileKey
|
|||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.cache_read_fail_plain_keys, e.Message));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.cache_read_fail_plain_keys, e.Message));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -176,7 +176,7 @@ namespace MinecraftClient.Protocol.ProfileKey
|
|||
private static void SaveToDisk()
|
||||
{
|
||||
if (Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(Translations.cache_saving_keys, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.cache_saving_keys, acceptnewlines: true);
|
||||
|
||||
List<string> KeysCacheLines = new()
|
||||
{
|
||||
|
|
@ -192,7 +192,7 @@ namespace MinecraftClient.Protocol.ProfileKey
|
|||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.cache_save_fail_keys, e.Message));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.cache_save_fail_keys, e.Message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace MinecraftClient.Protocol
|
|||
.ThenBy(record => Guid.NewGuid())
|
||||
.First();
|
||||
string target = result.Target.Value.Trim('.');
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_found, target, result.Port, domainVal));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.mcc_found, target, result.Port, domainVal));
|
||||
domainVal = target;
|
||||
portVal = result.Port;
|
||||
foundService = true;
|
||||
|
|
@ -64,7 +64,7 @@ namespace MinecraftClient.Protocol
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.mcc_not_found, domainVal, e.GetType().FullName, e.Message));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.mcc_not_found, domainVal, e.GetType().FullName, e.Message));
|
||||
}
|
||||
}, TimeSpan.FromSeconds(Config.Main.Advanced.ResolveSrvRecords == MainConfigHealper.MainConfig.AdvancedConfig.ResolveSrvRecordType.fast ? 10 : 30));
|
||||
}
|
||||
|
|
@ -96,7 +96,7 @@ namespace MinecraftClient.Protocol
|
|||
success = true;
|
||||
}
|
||||
else
|
||||
ConsoleIO.WriteLineFormatted(Translations.error_unexpect_response, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.error_unexpect_response, acceptnewlines: true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
@ -105,9 +105,9 @@ namespace MinecraftClient.Protocol
|
|||
}, TimeSpan.FromSeconds(Config.Main.Advanced.ResolveSrvRecords == MainConfigHealper.MainConfig.AdvancedConfig.ResolveSrvRecordType.fast ? 10 : 30)))
|
||||
{
|
||||
if (protocolversion != 0 && protocolversion != protocolversionTmp)
|
||||
ConsoleIO.WriteLineFormatted(Translations.error_version_different, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.error_version_different, acceptnewlines: true);
|
||||
if (protocolversion == 0 && protocolversionTmp <= 1)
|
||||
ConsoleIO.WriteLineFormatted(Translations.error_no_version_report, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.error_no_version_report, acceptnewlines: true);
|
||||
if (protocolversion == 0)
|
||||
protocolversion = protocolversionTmp;
|
||||
forgeInfo = forgeInfoTmp;
|
||||
|
|
@ -115,7 +115,7 @@ namespace MinecraftClient.Protocol
|
|||
}
|
||||
else
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(Translations.error_connection_timeout, acceptnewlines: true);
|
||||
ConsoleIO.WriteLineFormatted("§8" + Translations.error_connection_timeout, acceptnewlines: true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -491,7 +491,7 @@ namespace MinecraftClient.Protocol
|
|||
}
|
||||
else
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.error_http_code, code));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.error_http_code, code));
|
||||
return LoginResult.OtherError;
|
||||
}
|
||||
}
|
||||
|
|
@ -694,7 +694,7 @@ namespace MinecraftClient.Protocol
|
|||
}
|
||||
else
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.error_auth, code));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.error_auth, code));
|
||||
return LoginResult.OtherError;
|
||||
}
|
||||
}
|
||||
|
|
@ -895,7 +895,7 @@ namespace MinecraftClient.Protocol
|
|||
try
|
||||
{
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLineFormatted(string.Format(Translations.debug_request, host));
|
||||
ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.debug_request, host));
|
||||
|
||||
TcpClient client = ProxyHandler.NewTcpClient(host, 443, true);
|
||||
SslStream stream = new(client.GetStream());
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue