This repository has been archived by the owner on Aug 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added Anti-AFK Plugin * Added Auto-Mine Plugin * Added Task Manager Plugin * Updated examples and `aether-core` to use plugins * Added ViaVersion * Upgraded Version of `aether-core`
- Loading branch information
Showing
33 changed files
with
875 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
[workspace] | ||
members = [ | ||
"aether-core" | ||
, "examples/stone-miner"] | ||
"aether-core", | ||
"examples/anti-afk", | ||
"examples/stone-miner", | ||
"plugins/anti-afk", | ||
"plugins/auto-mine", | ||
"plugins/task-manager" | ||
] | ||
|
||
resolver = "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,44 @@ | ||
use std::time::Duration; | ||
use crate::msg; | ||
use crate::utils::stop_pathfinding_when_reachable; | ||
use crate::State; | ||
use azalea::pathfinder::goals::BlockPosGoal; | ||
use azalea::pathfinder::PathfinderClientExt; | ||
use azalea::{BlockPos, Client}; | ||
use azalea::Client; | ||
use log::info; | ||
use azalea_task_manager::client::TaskManagerExt; | ||
use azalea_task_manager::task_manager_queue::Task; | ||
|
||
pub async fn handle_load(username: String, client: Client, state: State) { | ||
info!("Received Pearl Loading Command from {}", username); | ||
|
||
{ | ||
let mut ongoing_task = state.client_information.ongoing_task.lock(); | ||
let mut is_afk = state.client_information.is_afk.lock(); | ||
if *ongoing_task && !*is_afk { | ||
let ongoing_task = client.len_tasks() > 0; | ||
if ongoing_task { | ||
msg!( | ||
client, | ||
username, | ||
"I am currently going somewhere, please resend the command after a while." | ||
); | ||
return; | ||
} | ||
*ongoing_task = true; | ||
*is_afk = false; | ||
} | ||
|
||
if let Some(trapdoor) = state.config.pearl_locations.get(&username) { | ||
msg!(client, username, "Teleporting..."); | ||
|
||
let trapdoor = *trapdoor; | ||
|
||
client.goto(BlockPosGoal(trapdoor)); | ||
|
||
stop_pathfinding_when_reachable( | ||
client.clone(), | ||
state.clone(), | ||
trapdoor.to_vec3_floored(), | ||
None, | ||
Some(flip_trapdoor), | ||
Some((client, state, username, trapdoor)) | ||
) | ||
let _ = client | ||
.new_task(Task::SetAntiAFK(false)) | ||
.new_task(Task::SendChatMessage(format!("/msg {} Teleporting...", username))) | ||
.new_task(Task::GotoTask(trapdoor, false, 4.0)) | ||
.new_task(Task::InteractWithBlock(trapdoor)) | ||
.new_task(Task::SendChatMessage(format!("/msg {} Pearl Loaded", username))) | ||
.new_task(Task::Delay(Duration::from_secs(1))) | ||
.new_task(Task::SendChatMessage(format!("/msg {} Make sure to put your pearl back!", username))) | ||
.new_task(Task::Delay(Duration::from_secs(2))) | ||
.new_task(Task::GotoTask(state.config.afk_location, false, 2.0)) | ||
.new_task(Task::SetAntiAFK(true)); | ||
} else { | ||
msg!( | ||
client, | ||
username, | ||
"Unable to find your trapdoor coordinates, use !pearl set x y z" | ||
); | ||
|
||
let mut ongoing_task = state.client_information.ongoing_task.lock(); | ||
*ongoing_task = false; | ||
} | ||
} | ||
|
||
async fn flip_trapdoor(args: Option<(Client, State, String, BlockPos)>) { | ||
if let Some((mut client, state, username, trapdoor)) = args { | ||
client.block_interact(trapdoor); | ||
msg!(client, username, "Pearl Loaded"); | ||
msg!(client, username, "Make sure to put your pearl back!"); | ||
|
||
tokio::time::sleep(Duration::from_secs(2)).await; | ||
{ | ||
client.goto(BlockPosGoal(state.config.afk_location)); | ||
stop_pathfinding_when_reachable( | ||
client, | ||
state.clone(), | ||
state.config.afk_location.to_vec3_floored(), | ||
Some(1.5), | ||
Some(set_afk), | ||
Some(state), | ||
); | ||
} | ||
} | ||
} | ||
|
||
async fn set_afk(args: Option<State>) { | ||
if let Some(mut state) = args { | ||
state.client_information.set_afk(true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.