mirror of
https://github.com/eaglerforge/EaglerForgeInjector
synced 2025-07-24 22:51:18 -09:00
quick fix
This commit is contained in:
parent
e45f3397b2
commit
1cdb65c647
@ -21,7 +21,7 @@ ModAPI.addEventListener("lib:libcustomitems:loaded", () => {
|
|||||||
onRightClickGround: `/*/user, world, itemstack, blockpos/*/
|
onRightClickGround: `/*/user, world, itemstack, blockpos/*/
|
||||||
const prefix = "§7[§4worldedit§7] ";
|
const prefix = "§7[§4worldedit§7] ";
|
||||||
const pos = blockpos;
|
const pos = blockpos;
|
||||||
const positions = globalThis.playerPositions[player.getName()] ||= {};
|
const positions = globalThis.playerPositions[user.getName()] ||= {};
|
||||||
|
|
||||||
// Save position #2
|
// Save position #2
|
||||||
positions.pos2 = pos;
|
positions.pos2 = pos;
|
||||||
@ -34,9 +34,8 @@ ModAPI.addEventListener("lib:libcustomitems:loaded", () => {
|
|||||||
`,
|
`,
|
||||||
onLeftClickGround: `/*/user, world, itemstack, blockpos/*/
|
onLeftClickGround: `/*/user, world, itemstack, blockpos/*/
|
||||||
const prefix = "§7[§4worldedit§7] ";
|
const prefix = "§7[§4worldedit§7] ";
|
||||||
const player = user;
|
|
||||||
const pos = blockpos;
|
const pos = blockpos;
|
||||||
const positions = globalThis.playerPositions[player.getName()] ||= {};
|
const positions = globalThis.playerPositions[user.getName()] ||= {};
|
||||||
|
|
||||||
// Save position #1
|
// Save position #1
|
||||||
positions.pos1 = pos;
|
positions.pos1 = pos;
|
||||||
@ -88,6 +87,7 @@ ModAPI.addEventListener("lib:libcustomitems:loaded", () => {
|
|||||||
event.preventDefault = true;
|
event.preventDefault = true;
|
||||||
}
|
}
|
||||||
if (event.command.toLowerCase().startsWith("//set")) {
|
if (event.command.toLowerCase().startsWith("//set")) {
|
||||||
|
const player = event.sender;
|
||||||
// Parse command parameters
|
// Parse command parameters
|
||||||
const params = event.command.substring("//set ".length);
|
const params = event.command.substring("//set ".length);
|
||||||
if (!params) {
|
if (!params) {
|
||||||
@ -97,16 +97,15 @@ ModAPI.addEventListener("lib:libcustomitems:loaded", () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const blockType = params;
|
const blockType = params;
|
||||||
const player = event.sender;
|
|
||||||
const positions = globalThis.playerPositions[player.getName()];
|
const positions = globalThis.playerPositions[player.getName()];
|
||||||
|
|
||||||
// Validate block type and positions
|
// Validate block type and positions
|
||||||
const block = ModAPI.blocks[blockType];
|
if (typeof ModAPI.blocks[blockType] !== 'undefined') {
|
||||||
if (!block) {
|
|
||||||
player.addChatMessage(ChatComponentTextClass.constructors[0](ModAPI.util.str(prefix + "§cInvalid block type.")));
|
player.addChatMessage(ChatComponentTextClass.constructors[0](ModAPI.util.str(prefix + "§cInvalid block type.")));
|
||||||
event.preventDefault = true;
|
event.preventDefault = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const block = ModAPI.blocks[blockType];
|
||||||
|
|
||||||
if (!positions || !positions.pos1 || !positions.pos2) {
|
if (!positions || !positions.pos1 || !positions.pos2) {
|
||||||
player.addChatMessage(ChatComponentTextClass.constructors[0](ModAPI.util.str(prefix + "§cPositions not set. Use left and right click to set positions.")));
|
player.addChatMessage(ChatComponentTextClass.constructors[0](ModAPI.util.str(prefix + "§cPositions not set. Use left and right click to set positions.")));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user