diff --git a/devFolder/src/command/plugin/lore.ts b/devFolder/src/command/plugin/lore.ts index 3a98273..8a706bf 100644 --- a/devFolder/src/command/plugin/lore.ts +++ b/devFolder/src/command/plugin/lore.ts @@ -86,16 +86,17 @@ function removeSpecificLore(item: any, loreText: string, player: Player, targetS }, 1); } + registerCommand({ name: 'lore', description: 'loreCom', parent: false, maxArgs: -1, - minArgs: 2, + minArgs: 1, // Changed minArgs to 1 to allow for just 'lore -clear' require: (player: Player) => verifier(player, config().commands['lore']), executor: (player: Player, args: string[]) => { // 引数が提供されていない場合のチェックを追加 - if (!args || args.length < 2) { + if (!args || args.length < 1) { // Changed condition to check for at least 1 argument player.sendMessage(translate(player, "command.UsageLore", { prefix: `${prefix}` })); return; } @@ -123,10 +124,18 @@ registerCommand({ const subCommand = args[0].toLowerCase(); if (subCommand === '-set') { + if (args.length < 2) { // Check if there's enough arguments for -set + player.sendMessage(translate(player, "command.UsageLore", { prefix: `${prefix}` })); + return; + } const loreText = args.slice(1).join(' '); AddLore(heldItem, loreText, player, targetSlot); player.sendMessage(translate(player, "command.AddLore")); } else if (subCommand === '-remove') { + if (args.length < 2) { // Check if there's enough arguments for -remove + player.sendMessage(translate(player, "command.UsageLore", { prefix: `${prefix}` })); + return; + } const loreText = args.slice(1).join(' '); removeSpecificLore(heldItem, loreText, player, targetSlot); const currentLore = heldItem.getLore() || []; @@ -136,6 +145,10 @@ registerCommand({ player.sendMessage(translate(player, "command.RemoveLore")); } } else if (subCommand === '-rename') { + if (args.length < 2) { // Check if there's enough arguments for -rename + player.sendMessage(translate(player, "command.UsageLore", { prefix: `${prefix}` })); + return; + } const NewName = args.slice(1).join(' '); renameItem(heldItem, NewName, player, targetSlot); player.sendMessage(translate(player, "command.ChangeNames")); @@ -146,4 +159,4 @@ registerCommand({ player.sendMessage(translate(player, "command.UsageLore", { prefix: `${prefix}` })); } }, -}); +}); \ No newline at end of file diff --git a/devFolder/src/command/plugin/packet.ts b/devFolder/src/command/plugin/packet.ts index b722b79..2fff719 100644 --- a/devFolder/src/command/plugin/packet.ts +++ b/devFolder/src/command/plugin/packet.ts @@ -235,9 +235,7 @@ function executeRollback(player: Player): void { playerDataManager.reset(player); } -function hasAnyEffectExcept(player: Player, excludedEffects: string[]): boolean { - return player.getEffects().some((effect) => !excludedEffects.includes(effect.typeId)); -} + async function executeFreeze(player: Player): Promise { const data = playerDataManager.get(player); @@ -304,10 +302,8 @@ world.afterEvents.itemUse.subscribe((event) => { function hasEffect(player:Player, effectName:any) { try { - // getEffect() はエフェクトが存在しない場合に undefined を返す return player.getEffect(effectName) !== undefined; } catch (error) { - // getEffect() はエフェクトが存在しない場合にエラーをスローすることもある return false; } } @@ -322,9 +318,9 @@ function detectAirJump(player: Player): { cheatType: string } | null { !data || data.isTeleporting || player.isGliding || - data.recentlyUsedEnderPearl || - getGamemode(player.name) === 1 || - getGamemode(player.name) === 3 + player.isInWater || + player.isFlying || + data.recentlyUsedEnderPearl ) { return null; } @@ -595,37 +591,7 @@ world.beforeEvents.playerBreakBlock.subscribe((event) => { }); }); -function getExcludedEffects(): string[] { - return [ - 'minecraft:absorption', - 'minecraft:bad_omen', - 'minecraft:blindness', - 'minecraft:conduit_power', - 'minecraft:darkness', - 'minecraft:fatal_poison', - 'minecraft:fire_resistance', - 'minecraft:glowing', - 'minecraft:haste', - 'minecraft:health_boost', - 'minecraft:hunger', - 'minecraft:instant_damage', - 'minecraft:instant_health', - 'minecraft:invisibility', - 'minecraft:mining_fatigue', - 'minecraft:nausea', - 'minecraft:night_vision', - 'minecraft:poison', - 'minecraft:regeneration', - 'minecraft:resistance', - 'minecraft:saturation', - 'minecraft:slow_falling', - 'minecraft:slowness', - 'minecraft:strength', - 'minecraft:water_breathing', - 'minecraft:weakness', - 'minecraft:wither', - ]; -} + function monitorItemUseOn(player: Player, itemId: string): void { if (!monitoring) return; // アンチチートが無効の場合は何もしない @@ -770,26 +736,36 @@ function updateTimerData(player: Player, now: number) { } + +function isPlayerOnGround(player: Player): boolean { + const viewDirection = player.getViewDirection(); + viewDirection.y = -1; // y座標を-1にして 下向きにビーム + + const blockBelow = player.getBlockFromViewDirection({ + maxDistance: 1.5, //距離は1.5Block + includePassableBlocks: false, + }); + console.log(`IsPlayerOnground:${JSON.stringify(blockBelow,null,2)}`) + + return blockBelow !== undefined && blockBelow.block.isSolid; +} + function detectFlyHack(player: Player): { cheatType: string } | null { const data = playerDataManager.get(player); - // プレイヤーデータが取得できない場合、テレポート中、グライディング中、エンダーパール使用後、 - // クリエイティブモード、スペクテイターモードの場合は処理をスキップ + if ( !data || data.isTeleporting || player.isGliding || - data.recentlyUsedEnderPearl || - getGamemode(player.name) === 1 || - getGamemode(player.name) === 3 + player.isInWater || + player.isFalling || + player.isFlying || + data.recentlyUsedEnderPearl ) { return null; } - // 特定の効果を除いて、効果が付与されている場合は処理をスキップ - if (hasAnyEffectExcept(player, getExcludedEffects())) { - return null; - } const isOnGround = player.isOnGround; // 地面にいるかどうか const currentPosition = player.location; // 現在の位置 @@ -813,7 +789,7 @@ function detectFlyHack(player: Player): { cheatType: string } | null { const velocityChangeRate = (currentVelocityY - twoTicksAgoVelocityY) / (50 * 2); // FlyHack判定 (地面にいない状態で異常な垂直移動) - if (!isOnGround && currentVelocityY > 0.5) { + if (!isPlayerOnGround(player) && currentVelocityY > 0.5) { // 異常な上昇速度 if ( currentVelocityY > 1.2 || // 高速上昇 diff --git a/devFolder/src/command/utility/server.ts b/devFolder/src/command/utility/server.ts index e4eb59d..1493da0 100644 --- a/devFolder/src/command/utility/server.ts +++ b/devFolder/src/command/utility/server.ts @@ -196,7 +196,7 @@ registerCommand({ }).then(() => { }); } } else { - player.sendMessage('Invalid argument. Use "-pause", "-check", "-checkban", "-info ", or "-ping [-true|-false]".'); + player.sendMessage('Invalid argument. Use "-pause", "-check", "-checkban", "-info uptime", or "-ping [-true|-false]".'); } }, }); \ No newline at end of file diff --git a/devFolder/src/node_modules/.package-lock.json b/devFolder/src/node_modules/.package-lock.json index 024034b..ea60e12 100644 --- a/devFolder/src/node_modules/.package-lock.json +++ b/devFolder/src/node_modules/.package-lock.json @@ -9,9 +9,9 @@ "integrity": "sha512-JdmEq4P3Z/FtoBzhLijFgMSVFnFRrUoLwY8DHHrgtFo0mfLTOLTB1RErYjLMsA6b7BGVNxkX/pfFRiH7QZ0XwQ==" }, "node_modules/@minecraft/server": { - "version": "1.16.0-beta.1.21.40-preview.22", - "resolved": "https://registry.npmjs.org/@minecraft/server/-/server-1.16.0-beta.1.21.40-preview.22.tgz", - "integrity": "sha512-vpNUQV/REBIGq6lEoO9nhIF+igVv8oVHJGRwoDucHzctcSpwpMgyl/0H1l+NIN//dZAa3Uh1NKws7lg2vKHTTA==", + "version": "1.16.0-beta.1.21.41-stable", + "resolved": "https://registry.npmjs.org/@minecraft/server/-/server-1.16.0-beta.1.21.41-stable.tgz", + "integrity": "sha512-lyMbPzdulO5dXKPfu8RFu2QUBxrplwmamB81D51AqJ78aK5mytuM4N9Jsh5LPxFh8q5/R/Fpy5CreAdYk10zRQ==", "dependencies": { "@minecraft/common": "^1.1.0" } diff --git a/devFolder/src/node_modules/@minecraft/server/index.d.ts b/devFolder/src/node_modules/@minecraft/server/index.d.ts index b5c2c59..a32680a 100644 --- a/devFolder/src/node_modules/@minecraft/server/index.d.ts +++ b/devFolder/src/node_modules/@minecraft/server/index.d.ts @@ -90,7 +90,6 @@ export enum BlockPistonState { } /** - * @rc * Description of the resulting intersection test on two * BlockVolume objects */ @@ -447,7 +446,6 @@ export enum EntityComponentTypes { */ Ageable = 'minecraft:ageable', /** - * @rc * @remarks * Defines what blocks this entity can breathe in and gives * them the ability to suffocate. @@ -2686,7 +2684,6 @@ export class Block { */ getMapColor(): RGBA; /** - * @rc * @remarks * Returns the net redstone power of this block. * @@ -3290,7 +3287,6 @@ export class BlockInventoryComponent extends BlockComponent { } /** - * @rc * A BlockLocationIterator returns the next block location of * the block volume across which it is iterating. * The BlockLocationIterator is used to abstract the shape of @@ -3922,7 +3918,6 @@ export class BlockTypes { } /** - * @rc * A BlockVolume is a simple interface to an object which * represents a 3D rectangle of a given size (in blocks) at a * world block location. @@ -4021,7 +4016,6 @@ export class BlockVolume extends BlockVolumeBase { export class BlockVolumeBase { private constructor(); /** - * @rc * @remarks * Fetch a {@link BlockLocationIterator} that represents all of * the block world locations within the specified volume @@ -7483,7 +7477,6 @@ export class EntityBaseMovementComponent extends EntityComponent { } /** - * @rc * Defines what blocks this entity can breathe in and gives * them the ability to suffocate. */ @@ -13331,7 +13324,6 @@ export class PlayerInputPermissions { export class PlayerInteractWithBlockAfterEvent { private constructor(); /** - * @rc * @remarks * The ItemStack before the interaction succeeded, or undefined * if hand is empty. @@ -13358,7 +13350,6 @@ export class PlayerInteractWithBlockAfterEvent { */ readonly faceLocation: Vector3; /** - * @rc * @remarks * This value will be true if the event was triggered on * players initial interaction button press and false on events @@ -13445,7 +13436,6 @@ export class PlayerInteractWithBlockBeforeEvent { */ readonly faceLocation: Vector3; /** - * @rc * @remarks * This value will be true if the event was triggered on * players initial interaction button press and false on events @@ -13507,7 +13497,6 @@ export class PlayerInteractWithBlockBeforeEventSignal { export class PlayerInteractWithEntityAfterEvent { private constructor(); /** - * @rc * @remarks * The ItemStack before the interaction succeeded, or undefined * if hand is empty. @@ -15739,9 +15728,6 @@ export class World { * */ readonly gameRules: GameRules; - /** - * @rc - */ readonly isHardcore: boolean; /** * @remarks @@ -16447,14 +16433,12 @@ export class WorldAfterEvents { */ readonly playerInputPermissionCategoryChange: PlayerInputPermissionCategoryChangeAfterEventSignal; /** - * @rc * @remarks * An event for when a player interacts with a block. * */ readonly playerInteractWithBlock: PlayerInteractWithBlockAfterEventSignal; /** - * @rc * @remarks * This event fires when a player interacts with an entity. * @@ -16601,14 +16585,12 @@ export class WorldBeforeEvents { readonly playerBreakBlock: PlayerBreakBlockBeforeEventSignal; readonly playerGameModeChange: PlayerGameModeChangeBeforeEventSignal; /** - * @rc * @remarks * Fires before a player interacts with a block. * */ readonly playerInteractWithBlock: PlayerInteractWithBlockBeforeEventSignal; /** - * @rc * @remarks * Fires before a player interacts with an entity. * @@ -18672,9 +18654,6 @@ export class InvalidContainerSlotError extends Error { private constructor(); } -/** - * @rc - */ // @ts-ignore Class inheritance allowed for native defined classes export class InvalidIteratorError extends Error { private constructor(); diff --git a/devFolder/src/node_modules/@minecraft/server/package.json b/devFolder/src/node_modules/@minecraft/server/package.json index b46e164..7a978ec 100644 --- a/devFolder/src/node_modules/@minecraft/server/package.json +++ b/devFolder/src/node_modules/@minecraft/server/package.json @@ -1,6 +1,6 @@ { "name": "@minecraft/server", - "version": "1.16.0-beta.1.21.40-preview.22", + "version": "1.16.0-beta.1.21.41-stable", "description": "", "contributors": [ {