Skip to content

Commit

Permalink
fix: 💙Fix server crash when [Replicator] doesnt know owner player
Browse files Browse the repository at this point in the history
Replicator always know who placed it, even if it was block placer. But in rare circumstances "owner" field could be empty what causing crash.
  • Loading branch information
Krutoy242 committed Jun 11, 2024
1 parent 3e6a6d5 commit 1111884
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/lib/offline.zs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ zenClass Op {

// Get value of specified player assuming he is offline
function get(uuid as string, key as string, default as string = null, onFake as string = null) as string {
if (isNull(uuid)) return default; // no player provided
if (isNull(uuid) || uuid == '') return default; // no player provided
val owner = server.getPlayerByUUID(uuid);

if (!isNull(owner)) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/requious/replicator.zs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ function tick(m as MachineContainer) as void {

// 🧍 Check if player
val ownerUUID = m.getString('ownerUUID');
if (isNull(ownerUUID)) return pushErr(m, '§0Need\n§0 player ☻');
if (isNull(ownerUUID) || ownerUUID == '') return pushErr(m, '§0Need\n§0 player ☻');

// 🎯 Update penalty text each tick
val dfclty = scripts.lib.offline.op.get(ownerUUID, 'difficulty', 0, 1000) as double;
Expand Down

0 comments on commit 1111884

Please sign in to comment.