Skip to content

Commit

Permalink
v1.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
BlaizerBrumo committed Apr 23, 2024
1 parent f23262c commit 3adfe50
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Safeguard anti-cheat B/functions/credit.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ tellraw @s {"rawtext":[{"text":"\n"}]}
tellraw @s {"rawtext":[{"text":"§l§e Help"}]}
tellraw @s {"rawtext":[{"text":"§l§6----------------------------------------------------------§r"}]}
tellraw @s {"rawtext":[{"text":"Blazer#9677 - Join the disord for any help nGu5gehXs3"}]}
tellraw @s {"rawtext":[{"text":"Version 1.9"}]}
tellraw @s {"rawtext":[{"text":"Version 1.9.1"}]}
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,8 @@ execute as @a[tag=warning_reset] run scoreboard players reset @s safeguard:cps_c
execute as @a[tag=warning_reset] run scoreboard players reset @s safeguard:fly_check
execute as @a[tag=warning_reset] run scoreboard players reset @s safeguard:nuker_check
execute as @a[tag=warning_reset] run scoreboard players reset @s safeguard:killaura_check
execute as @a[tag=warning_reset] run scoreboard players reset @s safeguard:velocity_check
execute as @a[tag=warning_reset] run scoreboard players reset @s safeguard:scaffold_check
execute as @a[tag=warning_reset] run scoreboard players reset @s safeguard:anti_combatlog
execute as @a[tag=warning_reset] run tellraw @s {"rawtext": [{"text": "§6[§eSafeGuard§6]§r§l§c "},{"text": "§aWarnings reset by admin!§r"}]}
tag @a[tag=warning_reset] remove warning_reset
#other warnings
execute as @a[scores={safeguard:cps_check=5,auto_mod_on=0}] run tag @s add softban_five
execute as @a[scores={safeguard:cps_check=5,auto_mod_on=0}] run scoreboard players add @s safeguard:cps_check 1

execute as @a[scores={safeguard:fly_check=5,auto_mod_on=0}] run tag @s add softban_five
execute as @a[scores={safeguard:fly_check=5,auto_mod_on=0}] run scoreboard players add @s safeguard:fly_check 1

execute as @a[scores={safeguard:nuker_check=5,auto_mod_on=0}] run tag @s add softban_five
execute as @a[scores={safeguard:nuker_check=5,auto_mod_on=0}] run scoreboard players add @s safeguard:nuker_check 1

execute as @a[scores={safeguard:killaura_check=5,auto_mod_on=0}] run tag @s add softban_five
execute as @a[scores={safeguard:killaura_check=5,auto_mod_on=0}] run scoreboard players add @s safeguard:killaura_check 1
14 changes: 0 additions & 14 deletions Safeguard anti-cheat B/functions/settings/anti_fly.mcfunction

This file was deleted.

6 changes: 3 additions & 3 deletions Safeguard anti-cheat B/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"format_version": 2,
"header": {
"name": "§l§eSafe§6Guard §fAntiCheat§r",
"description": "§l§fMade by §eBlazer#9677 §fV1.9\nBeta API §cREQUIRED",
"description": "§l§fMade by §eBlazer#9677 §fV1.9.1\nBeta API §cREQUIRED",
"uuid": "81b13565-181a-42ee-abd9-a7bd3cb2dba4",
"min_engine_version": [
1,
Expand All @@ -12,7 +12,7 @@
"version": [
1,
9,
0
1
]
},
"modules": [
Expand Down Expand Up @@ -42,7 +42,7 @@
"dependencies": [
{
"module_name": "@minecraft/server",
"version": "1.10.0-beta"
"version": "1.11.0-beta"
},
{
"module_name": "@minecraft/server-gametest",
Expand Down
25 changes: 21 additions & 4 deletions Safeguard anti-cheat B/scripts/command/src/report.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { canFindPlayer, getPlayerByName, sendMessageToAllAdmins } from '../../assets/util';
import {newCommand} from '../handle';
import * as config from "../../config";
import { world } from '@minecraft/server';

newCommand({
name: "report",
Expand Down Expand Up @@ -41,12 +43,27 @@ newCommand({
}

function reportPlayer(reportedPlayer,reason){
if(!reportedPlayer.reports) reportedPlayer.reports = [];
let reportedPlayerReportsProperty = reportedPlayer.getDynamicProperty("safeguard:reports");
if(reportedPlayerReportsProperty === undefined){
reportedPlayer.setDynamicProperty("safeguard:reports","");
reportedPlayerReportsProperty = reportedPlayer.getDynamicProperty("safeguard:reports");
}

if(reportedPlayer.reports.includes(player.id)) return player.sendMessage(`§6[§eSafeGuard§6]§f You have already reported this player!`);
if(reportedPlayer.name == player.name) return player.sendMessage(`§6[§eSafeGuard§6]§f You cannot report yourself!`);
const tempProperty = reportedPlayerReportsProperty.split(",");



if(player.hasTag("admin")){
console.warn(tempProperty)
player.sendMessage(`§6[§eSafeGuard§6]§f This player has been reported §e${tempProperty.length - 1}§r times.`);
return;
}

if(tempProperty.includes(player.id)) return player.sendMessage(`§6[§eSafeGuard§6]§f You have already reported this player!`);
if(reportedPlayer.name === player.name) return player.sendMessage(`§6[§eSafeGuard§6]§f You cannot report yourself!`);
if(reportedPlayer.hasTag("admin")) return player.sendMessage(`§6[§eSafeGuard§6]§f You cannot report admins.`);
reportedPlayer.reports.push(player.id);
tempProperty.push(player.id);
reportedPlayer.setDynamicProperty("safeguard:reports",tempProperty.toString());

player.sendMessage(`§6[§eSafeGuard§6]§f Sent your report to all online admins!`);

Expand Down
4 changes: 4 additions & 0 deletions Safeguard anti-cheat B/scripts/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ export default {
//chat command prefix
"prefix": "!",
"spammer":{
//maximum amount characters the message can have before it's considered spam
"maxMessageCharLimit": 512,
//maximum amount of words the message can have before it's considered spam
"maxMessageWordLimit": 512,
//minimum time between messages in milliseconds
"minTime": 1500,
//if a message starts with this word/symbol/letter or whatever you enter it won't be flagged for spam
Expand Down
31 changes: 23 additions & 8 deletions Safeguard anti-cheat B/scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,39 @@ world.beforeEvents.chatSend.subscribe((data) => {
const prefix = config.default.chat.prefix;
const whitelistedPrefixes = config.default.chat.spammer.whitelistedPrefixes;
let checkSpam = false;
const isAdmin = player.hasTag("admin");

const antiSpam = (world.scoreboard.getObjective('safeguard:spammer_protection') === undefined) ? false : true;

//message spam protection
if(message == player.lastMessage && !player.hasTag("admin") && antiSpam){
if(message == player.lastMessage && !isAdmin && antiSpam){
data.cancel = true;
player.sendMessage(`§6[§eSafeGuard§6]§r§c Please don't send repeating messages!`);
return;
}
else if(Date.now() - player.lastMessageDate <= config.default.chat.spammer.minTime && !player.hasTag("admin") && antiSpam){
else if(Date.now() - player.lastMessageDate <= config.default.chat.spammer.minTime && !isAdmin && antiSpam){
data.cancel = true;
player.sendMessage(`§6[§eSafeGuard§6]§r§c You're sending messages too quickly!`);
return;
}

else if(message.length > config.default.chat.spammer.maxMessageCharLimit && !isAdmin && antiSpam){
data.cancel = true;
player.sendMessage(`§6[§eSafeGuard§6]§r§c Sorry! Your message has too many characters!`);
return;
}
else if(message.split(" ").length > config.default.chat.spammer.maxMessageWordLimit && !isAdmin && antiSpam){
data.cancel = true;
player.sendMessage(`§6[§eSafeGuard§6]§r§c Please keep your message below ${config.default.chat.spammer.maxMessageWordLimit} words!`);
return;
}

whitelistedPrefixes.forEach(wPrefix => {
if(message.startsWith(wPrefix)){
checkSpam = true;
}
})

if(!checkSpam){
player.lastMessage = message;
player.lastMessageDate = Date.now();
Expand Down Expand Up @@ -166,11 +180,12 @@ Minecraft.system.runInterval(() => {
const plrName = player.name;
const inv = player.getComponent("inventory").container;
const velocity = player.getVelocity();
const isAdmin = player.hasTag("admin");

player.blocksBroken = 0;
player.hitEntities = [];

betaFeatures(player);
betaFeatures(player,velocity);

//check if player received too many warnings
if(player.hasTag("safeguard:reachingWarningsTooFast")){
Expand Down Expand Up @@ -208,7 +223,7 @@ Minecraft.system.runInterval(() => {
}
else if(item.typeId !== "minecraft:trident") player.removeTag("safeguard:hasRiptide");

if (player.hasTag('admin')) return;
if (isAdmin) return;
else{
//illegal name check
if (itemName.length > config.default.item.anti_items.maxItemNameLength && antiItemsOn) {
Expand Down Expand Up @@ -248,7 +263,7 @@ Minecraft.system.runInterval(() => {

const finalcps = world.scoreboard.getObjective("safeguard:finalcps").getScore(player.scoreboardIdentity);

if(finalcps > config.default.combat.autoclicker.maxCps && !player.hasTag("admin") && antiAutoClicker){
if(finalcps > config.default.combat.autoclicker.maxCps && isAdmin && antiAutoClicker){
world.sendMessage(`§6[§eSafeGuard§6]§r §c§l${player.name}§r§4 was detected using autoclicker with a cps of §l§c${finalcps}`);
player.runCommandAsync(`scoreboard players add @s "safeguard:cps_check" 1`)
player.addEffect("weakness", 40, { amplifier: 255, showParticles: false })
Expand Down Expand Up @@ -276,7 +291,7 @@ Minecraft.system.runInterval(() => {
let { x, y, z } = player.location;
const border = world.worldBorder;
if(x > border || y > border || z > border || x < -border || y < -border || z < -border ) {
if(player.hasTag("admin") && config.default.world.worldborder.adminsBypassBorder) return;
if(isAdmin && config.default.world.worldborder.adminsBypassBorder) return;

player.sendMessage(`§6[§eSafeGuard§6]§r You reached the border of §e${border}§f blocks!`);
const currentLocation = player.location;
Expand Down Expand Up @@ -309,10 +324,10 @@ Minecraft.system.runInterval(() => {
});


function betaFeatures(player){
function betaFeatures(player,velocity){

if(player.hasTag("admin")) return;
const playerVelocity = player.getVelocity();
const playerVelocity = velocity;
const playerHealth = player.getComponent("minecraft:health");
const playerMode = player.getGameMode();
//anti fly idk
Expand Down

0 comments on commit 3adfe50

Please sign in to comment.