Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
odorajbotoj committed Oct 12, 2024
2 parents 389cd4f + 2758469 commit f3e5e50
Show file tree
Hide file tree
Showing 26 changed files with 138 additions and 4,611 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.0] - 2024-10-12

### Added

+ Added nopickup (tewakers)
+ Added container info in cfhud

### Changed

+ Config version changed to `3`

### Removed

+ Removed SimPlayer System (now is [CFSP](https://github.com/CoralFans-Dev/CFSP))

## [1.0.2] - 2024-10-11

### Fixed
Expand Down Expand Up @@ -62,6 +77,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
+ Added dropper-no-cost (has bugs)
+ Added safe-explode

[2.0.0]: https://github.com/CoralFans-Dev/CoralFans/compare/v1.0.2...v2.0.0
[1.0.2]: https://github.com/CoralFans-Dev/CoralFans/compare/v1.0.1...v1.0.2
[1.0.1]: https://github.com/CoralFans-Dev/CoralFans/compare/v1.0.0...v1.0.1
[1.0.0]: https://github.com/CoralFans-Dev/CoralFans/compare/v0.0.1...v1.0.0
Expand Down
22 changes: 2 additions & 20 deletions src/coral_fans/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "mc/server/commands/CommandPermissionLevel.h"
#include <string>
#include <unordered_set>
#include <vector>

namespace coral_fans::config {
Expand All @@ -24,7 +23,6 @@ struct CommandStruct {
CommandConfigStruct rotate = {true, CommandPermissionLevel::Any};
CommandConfigStruct data = {true, CommandPermissionLevel::Any};
CommandConfigStruct cfhud = {true, CommandPermissionLevel::Any};
CommandConfigStruct sp = {true, CommandPermissionLevel::Any};
CommandConfigStruct log = {true, CommandPermissionLevel::Any};
};

Expand All @@ -40,30 +38,14 @@ struct Shortcut {
std::vector<std::string> actions;
};

enum class ListType : int { disabled, blacklist, whitelist };

struct SimPlayerStruct {
std::string namePrefix = "SIM-";
std::string namePostfix = "";
unsigned long long maxOnline = 16;
unsigned long long maxOwn = 4;
unsigned long long maxGroup = 8;
unsigned long long maxSpawnCount = 128;
CommandPermissionLevel adminPermission = CommandPermissionLevel::GameDirectors;
ListType listType = ListType::disabled;
std::unordered_set<std::string> list;
std::string luaPreload = "";
};

struct Config {
int version = 2;
int version = 3;
std::string locateName = "zh_CN";

int cfhudRefreshTime = 20;

SimPlayerStruct simPlayer;
CommandStruct command;

CommandStruct command;
std::vector<Shortcut> shortcuts = {
/* hoppercounter */
{.enable = true, .type = "useon", .item = "cactus", .block = "white_concrete", .actions = {"counter print"}},
Expand Down
13 changes: 0 additions & 13 deletions src/coral_fans/CoralFans.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "bsci/GeometryGroup.h"

#include "ll/api/memory/Memory.h"
#include "ll/api/mod/RegisterHelper.h"

#include "ll/api/Config.h"
Expand Down Expand Up @@ -64,14 +63,6 @@ bool CoralFans::enable() {
logger.debug("Enabling...");
auto& mod = coral_fans::mod();

// get DefaultDataLoadHelper
mod.getDefaultDataLoadHelper() =
static_cast<DefaultDataLoadHelper*>(ll::memory::resolveSymbol("??_7DefaultDataLoadHelper@@6B@"));
if (!mod.getDefaultDataLoadHelper()) {
logger.error("Cannot get DefaultDataLoadHelper from symbol.");
return false;
}

// register hooks
functions::hookAll(true);

Expand All @@ -91,7 +82,6 @@ bool CoralFans::enable() {
commands::registerRotateCommand(mod.getConfig().command.rotate.permission);
if (mod.getConfig().command.data.enabled) commands::registerDataCommand(mod.getConfig().command.data.permission);
if (mod.getConfig().command.cfhud.enabled) commands::registerCfhudCommand(mod.getConfig().command.cfhud.permission);
if (mod.getConfig().command.sp.enabled) commands::registerSpCommand(mod.getConfig().command.sp.permission);
if (mod.getConfig().command.log.enabled) commands::registerLogCommand(mod.getConfig().command.log.permission);

// register shortcuts
Expand All @@ -101,9 +91,6 @@ bool CoralFans::enable() {
// register containerreader
functions::registerContainerReader();

// load simplayer data
mod.getSimPlayerManager().load();

// register autoitem
coral_fans::functions::registerAutoItemListener();

Expand Down
194 changes: 0 additions & 194 deletions src/coral_fans/base/Macros.h

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/coral_fans/base/Mod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ namespace coral_fans {

void CoralFansMod::tick() {
this->getScheduler().tick();
this->getSimPlayerManager().tick();
this->getHopperCounterManager().tick(); // light 1
this->getHsaManager().tick(); // heavy 80
this->getSlimeManager().tick(); // heavy 80
Expand Down
11 changes: 1 addition & 10 deletions src/coral_fans/base/Mod.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
#pragma once

#include "TimeWheel.h"
#include "bsci/GeometryGroup.h"
#include "coral_fans/Config.h"
#include "coral_fans/CoralFans.h"
#include "coral_fans/base/TimeWheel.h"
#include "coral_fans/functions/HopperCounter.h"
#include "coral_fans/functions/Hsa.h"
#include "coral_fans/functions/Hud.h"
#include "coral_fans/functions/Prof.h"
#include "coral_fans/functions/SimPlayer.h"
#include "coral_fans/functions/Slime.h"
#include "coral_fans/functions/Village.h"
#include "ll/api/Logger.h"
#include "ll/api/data/KeyValueDB.h"
#include "ll/api/event/EventBus.h"
#include "ll/api/event/ListenerBase.h"
#include "mc/dataloadhelper/DefaultDataLoadHelper.h"
#include <memory>
#include <set>

Expand All @@ -34,8 +32,6 @@ class CoralFansMod {
functions::CFVillageManager mVillageManager;
timewheel::TimeWheel mScheduler;
functions::HudHelper mHudHelper;
functions::SimPlayerManager mSimPlayerManager;
DefaultDataLoadHelper* mDefaultDataLoadHelper;

public:
CoralFansMod() : mScheduler(1200) {}
Expand All @@ -53,14 +49,9 @@ class CoralFansMod {
inline functions::SlimeManager& getSlimeManager() { return this->mSlimeManager; }
inline functions::CFVillageManager& getVillageManager() { return this->mVillageManager; }
inline timewheel::TimeWheel& getScheduler() { return this->mScheduler; }
inline functions::SimPlayerManager& getSimPlayerManager() { return this->mSimPlayerManager; }
inline DefaultDataLoadHelper*& getDefaultDataLoadHelper() { return this->mDefaultDataLoadHelper; }

public:
void tick();

public:
const std::string VERSION = "1.0.2";
};

CoralFansMod& mod();
Expand Down
85 changes: 0 additions & 85 deletions src/coral_fans/base/TimeWheel.h

This file was deleted.

1 change: 0 additions & 1 deletion src/coral_fans/commands/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ void registerVillageCommand(CommandPermissionLevel);
void registerRotateCommand(CommandPermissionLevel);
void registerDataCommand(CommandPermissionLevel);
void registerCfhudCommand(CommandPermissionLevel);
void registerSpCommand(CommandPermissionLevel);
void registerLogCommand(CommandPermissionLevel);
} // namespace coral_fans::commands
5 changes: 3 additions & 2 deletions src/coral_fans/commands/Coralfans.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "coral_fans/base/Mod.h"
#include "ll/api/command/CommandHandle.h"
#include "ll/api/command/CommandRegistrar.h"
#include "mc/server/commands/CommandOrigin.h"
Expand All @@ -16,7 +15,9 @@ void registerCoralfansCommand() {

// version
command.overload().text("version").execute([](CommandOrigin const&, CommandOutput& output) {
output.success(coral_fans::mod().VERSION);
#ifdef VERSION
output.success(VERSION);
#endif
#ifdef COMMITID
output.success("Commit ID: {}", COMMITID);
#endif
Expand Down
11 changes: 11 additions & 0 deletions src/coral_fans/commands/Func.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,16 @@ void registerFuncCommand(CommandPermissionLevel permission) {
output.success("command.func.fastdrop.success"_tr(isopen ? "true" : "false"));
else output.error("command.func.fastdrop.error"_tr());
});

// nopickup
funcCommand.runtimeOverload()
.text("nopickup")
.required("isopen", ll::command::ParamKind::Bool)
.execute([](CommandOrigin const&, CommandOutput& output, ll::command::RuntimeCommand const& self) {
bool isopen = self["isopen"].get<ll::command::ParamKind::Bool>();
if (coral_fans::mod().getConfigDb()->set("functions.global.nopickup", isopen ? "true" : "false"))
output.success("command.func.nopickup.success"_tr(isopen ? "true" : "false"));
else output.error("command.func.nopickup.error"_tr());
});
}
} // namespace coral_fans::commands
16 changes: 16 additions & 0 deletions src/coral_fans/commands/Self.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,21 @@ void registerSelfCommand(CommandPermissionLevel permission) {
output.success("command.self.fastdrop.success"_tr((isopen & global) ? "true" : "false"));
else output.error("command.self.fastdrop.error"_tr());
});

// self nopickup <bool>
selfCommand.runtimeOverload()
.text("nopickup")
.required("isopen", ll::command::ParamKind::Bool)
.execute([](CommandOrigin const& origin, CommandOutput& output, ll::command::RuntimeCommand const& self) {
COMMAND_CHECK_PLAYER
bool isopen = self["isopen"].get<ll::command::ParamKind::Bool>();
const auto global = coral_fans::mod().getConfigDb()->get("functions.global.nopickup") == "true";
if (coral_fans::mod().getConfigDb()->set(
std::format("functions.players.{}.nopickup", player->getUuid().asString()),
(isopen & global) ? "true" : "false"
))
output.success("command.self.nopickup.success"_tr((isopen & global) ? "true" : "false"));
else output.error("command.self.nopickup.error"_tr());
});
}
} // namespace coral_fans::commands
Loading

0 comments on commit f3e5e50

Please sign in to comment.