Small Fixes
This commit is contained in:
parent
5019aae2df
commit
9811137d2d
@ -31,6 +31,9 @@ static std::string get_input(std::string message) {
|
|||||||
}
|
}
|
||||||
// Output String
|
// Output String
|
||||||
std::string api_get_output(std::string message, const bool replace_comma) {
|
std::string api_get_output(std::string message, const bool replace_comma) {
|
||||||
|
// Convert To Unicode
|
||||||
|
message = from_cp437(message);
|
||||||
|
// Escape Characters
|
||||||
if (api_compat_mode) {
|
if (api_compat_mode) {
|
||||||
// Output In Plaintext For RJ Compatibility
|
// Output In Plaintext For RJ Compatibility
|
||||||
std::ranges::replace(message, list_separator, '\\');
|
std::ranges::replace(message, list_separator, '\\');
|
||||||
@ -38,10 +41,11 @@ std::string api_get_output(std::string message, const bool replace_comma) {
|
|||||||
std::ranges::replace(message, arg_separator, '.');
|
std::ranges::replace(message, arg_separator, '.');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// Encode
|
||||||
message = misc_base64_encode(message);
|
message = misc_base64_encode(message);
|
||||||
}
|
}
|
||||||
// Convert To Unicode
|
// Return
|
||||||
return from_cp437(message);
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Join Strings Into Output
|
// Join Strings Into Output
|
||||||
@ -213,8 +217,7 @@ static const std::string player_namespace = "player.";
|
|||||||
#define ENTITY_NOT_FOUND API_WARN("Entity Not Found: %i", id)
|
#define ENTITY_NOT_FOUND API_WARN("Entity Not Found: %i", id)
|
||||||
#define next_string(out, required) \
|
#define next_string(out, required) \
|
||||||
std::string out; \
|
std::string out; \
|
||||||
const bool out##_present = !std::getline(args, out, arg_separator).fail(); \
|
if (!std::getline(args, out, arg_separator) && (required)) { \
|
||||||
if (!out##_present && (required)) { \
|
|
||||||
return CommandServer::Fail; \
|
return CommandServer::Fail; \
|
||||||
} \
|
} \
|
||||||
(void) 0
|
(void) 0
|
||||||
@ -307,11 +310,9 @@ std::string CommandServer_parse_injection(CommandServer_parse_t old, CommandServ
|
|||||||
int removed = 0;
|
int removed = 0;
|
||||||
for (Entity *entity : server->minecraft->level->entities) {
|
for (Entity *entity : server->minecraft->level->entities) {
|
||||||
int i = entity->getEntityTypeId();
|
int i = entity->getEntityTypeId();
|
||||||
if (i > 0) {
|
if (i > 0 && (type == no_entity_id || i == type)) {
|
||||||
if (type == no_entity_id || i == type) {
|
entity->remove();
|
||||||
entity->remove();
|
removed++;
|
||||||
removed++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return std::to_string(removed) + '\n';
|
return std::to_string(removed) + '\n';
|
||||||
@ -447,9 +448,7 @@ std::string CommandServer_parse_injection(CommandServer_parse_t old, CommandServ
|
|||||||
}
|
}
|
||||||
#define next_sign_line(i) \
|
#define next_sign_line(i) \
|
||||||
next_string(line_##i, false); \
|
next_string(line_##i, false); \
|
||||||
if (line_##i##_present) { \
|
sign->lines[i] = get_input(line_##i); \
|
||||||
sign->lines[i] = get_input(line_##i); \
|
|
||||||
} \
|
|
||||||
(void) 0
|
(void) 0
|
||||||
next_sign_line(0);
|
next_sign_line(0);
|
||||||
next_sign_line(1);
|
next_sign_line(1);
|
||||||
|
@ -242,7 +242,10 @@ void api_add_chat_event(const Player *sender, const std::string &message) {
|
|||||||
if (!enabled || (!sender && api_compat_mode)) {
|
if (!enabled || (!sender && api_compat_mode)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
push_event(&ExtraClientData::chat_events, {message, sender ? sender->id : no_entity_id});
|
push_event(&ExtraClientData::chat_events, {
|
||||||
|
message,
|
||||||
|
sender ? sender->id : no_entity_id
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Block Hit Events
|
// Block Hit Events
|
||||||
|
Loading…
x
Reference in New Issue
Block a user