#Everything broke in .60.

1 messages · Page 1 of 1 (latest)

scenic veldt
#
import { world, system } from '@minecraft/server'

//Sets the inCombat score to 30s:
world.events.entityHurt.subscribe((combatLog) => {
  const hit = combatLog.hurtEntity
  const attacker = combatLog.damageSource.damagingEntity
  if (hit.typeId !== "minecraft:player" || attacker?.typeId !== "minecraft:player") return;
  
  //Telling the player if they are inCombat:
    if (getScore(attacker, 'inCombat') == 0) {
  attacker.tell("§l§cYou are now in §o§4Combat!")
  }
    if (getScore(hit, 'inCombat') == 0) {
hit.tell("§l§cYou are now in §o§4Combat!")
}
console.warn('Hit detected')
  hit.runCommandAsync('scoreboard players set @s inCombat 600')
  attacker.runCommandAsync('scoreboard players set @s inCombat 600')

//Kill system:
  const health = hit.getComponent("minecraft:health").current
  if (hit.typeId !== "minecraft:player" || attacker?.typeId !== "minecraft:player") return;
  if (health <= 0) {
    attacker.runCommandAsync('scoreboard players add @s kills 1')
    attacker.runCommandAsync('effect @s instant_health 255 1 true')
  }
})

//Getting the player inCombat score:
function getScore(player, inCombat) {
  return world.scoreboard.getObjective(inCombat).getScore(player.scoreboard)
}

//Testing if the player has properly loaded in:
world.events.playerSpawn.subscribe((join) => {
        if (!join.initialSpawn) return;
  let player = join.player
  if (getScore(player, 'inCombat') !== 0) {
    world.say(`§l§4${player.name} §chas been killed for Combat Logging!`)
    player.runCommandAsync("scoreboard players set @s inCombat 0")
    player.runCommandAsync("kill @s")
  }
}) 

world.events.entityHurt.subscribe((ev) => {
  const hit = ev.hurtEntity
  const attacker = ev.damageSource.damagingEntity
console.warn('Test')
})
#

Hello! So, ever since the 1.19.60 update, all my scripts have completely stopped working. I have no idea why, as nothing is appearing in the content log, and the code looks correct. I've put it through multiple debuggers and they have said nothing is wrong with the code.

#

Heres all my files. I don't see anything wrong with any of these files, any help is appreciated as nothing is showing up in the logs

#

Even the bottom console warn isn't logging

#

When I hit my other account, nothing happens

#

And in the logs no errors are related to scripts

crimson birchBOT
#
Debug Result

There are errors in this [code](#1075246113294123048 message):

index.js:1:26 - error TS2307: Cannot find module './db/Database.js' or its corresponding type declarations.

1 import { Database } from './db/Database.js';
                           ~~~~~~~~~~~~~~~~~~

#
Debug Result

There are errors in this [code](#1075246113294123048 message):

killcount.js:12:12 - error TS2339: Property 'tell' does not exist on type 'Entity'.

12   attacker.tell("§l§cYou are now in §o§4Combat!")
              ~~~~
killcount.js:15:5 - error TS2339: Property 'tell' does not exist on type 'Entity'.

15 hit.tell("§l§cYou are now in §o§4Combat!")
       ~~~~

scenic veldt
#

I'm confused?

#

How does .tell now exist?

delicate radish
#

Its .sendMessage now

#

Check #1067535712372654091

scenic veldt
#

No way

scenic veldt
# delicate radish Its .sendMessage now
import { world, system } from '@minecraft/server'

//Sets the inCombat score to 30s:
world.events.entityHurt.subscribe((combatLog) => {
	console.warn('T')
  const hit = combatLog.hurtEntity
  const attacker = combatLog.damageSource.damagingEntity
  
  if (hit.typeId !== "minecraft:player" || attacker?.typeId !== "minecraft:player") return;
  
  //Telling the player if they are inCombat:
    if (getScore(attacker, 'inCombat') == 0) {
    attacker.sendMessage("§l§cYou are now in §o§4Combat!")
  }
    if (getScore(hit, 'inCombat') == 0) {
    hit.sendMessage("§l§cYou are now in §o§4Combat!")
}
console.warn('Hit detected')
  hit.runCommandAsync('scoreboard players set @s inCombat 600')
  attacker.runCommandAsync('scoreboard players set @s inCombat 600')

//Kill system:
  const health = hit.getComponent("minecraft:health").current
  if (hit.typeId !== "minecraft:player" || attacker?.typeId !== "minecraft:player") return;
  if (health <= 0) {
    attacker.runCommandAsync('scoreboard players add @s kills 1')
    attacker.runCommandAsync('effect @s instant_health 255 1 true')
  }
})

//Getting the player inCombat score:
function getScore(player, inCombat) {
  return world.scoreboard.getObjective(inCombat).getScore(player.scoreboard)
}

//Testing if the player has properly loaded in:
world.events.playerSpawn.subscribe((join) => {
	    if (!join.initialSpawn) return;
  let player = join.player
  if (getScore(player, 'inCombat') !== 0) {
    world.say(`§l§4${player.name} §chas been killed for Combat Logging!`)
    player.runCommandAsync("scoreboard players set @s inCombat 0")
    player.runCommandAsync("kill @s")
  }
}) 

world.events.entityHurt.subscribe((ev) => {
  const hit = ev.hurtEntity
  const attacker = ev.damageSource.damagingEntity
console.warn('Test')
})
#

Done, still not working

#

No errors again

#

@delicate radish

delicate radish
#

There’s probably a lot more to fix

scenic veldt
#

Do you know what errors?

#

I don't see any

crimson birchBOT
#
Debug Result

There are errors in this [code](#1075246113294123048 message):

<repl>.js:13:14 - error TS2339: Property 'sendMessage' does not exist on type 'Entity'.

13     attacker.sendMessage("§l§cYou are now in §o§4Combat!")
                ~~~~~~~~~~~
<repl>.js:16:9 - error TS2339: Property 'sendMessage' does not exist on type 'Entity'.

16     hit.sendMessage("§l§cYou are now in §o§4Combat!")
           ~~~~~~~~~~~

wraith spindle
#

@scenic veldt .sendMessage() isn't in 1.19.60. It is still .tell(). That's a change they made in the preview version for 1.19.70. You can see the other changes in that version here: #1074038906430955620 message

scenic veldt
#

Doing .tell still don't do shit

#

I've been gettin no errors in the content log despite havin it on

#

Ion what's happening :(

wraith spindle
scenic veldt
#

The ones above

#

None of them are working

#

Ever since 1.19.60

#

I've got no errors in the content log

#

So idk whats going on as nothing has changed

wraith spindle
#

I'll load them up and see if I notice anything. I'm not doing anything at this moment.

scenic veldt
#

Alright thank you

wraith spindle
# scenic veldt Alright thank you

With your script above that is named killcount.js it appears that there is no method for .tell() when using the entityHurt event. So you may need to change those methods to .runCommandAsync() and use tellraw to send the message to that designated player.

#

Ok, so it seems the method .tell() falls under the Player Class and does not exist under the Entity Class according to what I am seeing on VSC and their documentation which frankly I find to be very odd.

scenic veldt
#

Nope

#

Lmfao

#

I got my mate to try it and it works fine for him

#

So idk wtf is wrong with my goofy phone

wraith spindle
# scenic veldt I got my mate to try it and it works fine for him

entityHurt gets the entity object from the Entity Class. According to their documentation as well as what I saw in the code when loaded up in visual studio code it shouldn't work. Based solely upon what you shared above and assuming there is no extra that could potentially have a role or change of effect. So I'm uncertain about your situation at the moment.

scenic veldt
#

Hold up

#

I'll send a clip

#

Of it working for him

#

The script worked pre 1.19.60, and is now suddenly broken

#

I've tried literally everything

#

And it just won't work for me

scenic veldt
#

Turns out it had something to do with the fucking manifest lmfaoooo

#

Like a week

#

Of trying to find this stupid error and it was because of my manifest 🗿🗿🗿

wraith spindle
scenic veldt
#

Absolutely no clue

wraith spindle
#

.... Yea, sounds fake lmao.

scenic veldt
#

Wdym?

ornate steepleBOT
# scenic veldt
Program Output
/home/jail/prog.js:2
"format_version": 2,
                ^

SyntaxError: Unexpected token ':'
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1032:15)
    at Module._compile (node:internal/modules/cjs
scenic veldt
#

Old manifest

#

And

#

One sec

#

New manifest

#

You can literally try the script yourself it works lmfao

#

Tryna say I'm faking what? Fixing my issue? 🤡

wraith spindle
scenic veldt
#

You don't think the script works?

wraith spindle
#

I loaded the script you shared from above into vsc, converted it to TypeScript to get realtime feedback, and quickly identified that the method didn't exist because the event being utilized was targeting the entity object versus a player object and therefore didn't exist.

#

Just giving insight on how I approached my conclusion.

scenic veldt
#

I said earlier the script worked pre .60, so it makes sense on why I had to update my manifest. My mate sent me his pack that had the working script, and I used his manifest as he uses bridge which I'm assuming updates the manifest for you

#

Bro...

#

Typescript is going to give you an error if you use player in entity class

#

It'll still work regardless

wraith spindle
scenic veldt
#

Well... Have you tried testing the script?

wraith spindle
#

Didn't bother with it since I had multiple circumstances showing pretty reasonable evidence that the code was not complete.

#

If it's working for you then great. Not gonna say it isn't. I just know what I was looking at based on the script you shared above in this forum.