あお🦀
あお🦀
PDCPlayerRealms developerS Community
Created by あお🦀 on 8/20/2024 in #help-forum
skripthubの使い方のパターンの名前が知りたい
No description
15 replies
ユーザーごとに送信する時間packetを変えるskript
import:
ch.njol.skript.Skript
org.bukkit.plugin.Plugin

com.comphenix.protocol.events.ListenerPriority
com.comphenix.protocol.events.PacketAdapter
com.comphenix.protocol.events.PacketEvent
com.comphenix.protocol.ProtocolLibrary
com.comphenix.protocol.PacketType

java.lang.Override

preimport:
jp.nlaocs.TimePacket

public class TimePacket extends PacketAdapter:

public TimePacket():
super[Plugin, ListenerPriority, PacketType[]](Skript.getInstance(), ListenerPriority.NORMAL, [PacketType.Play.Server.UPDATE_TIME as PacketType])

@Override
public void onPacketSending(PacketEvent event):
if {time::%{_event}.getPlayer().getUniqueId()%} is set:
set {_timeOfDay} to {time::%{_event}.getPlayer().getUniqueId()%}
{_event}.getPacket().getLongs().write(1, {_TimeOfDay})

on load:
set {-timepacketlistener} to new TimePacket()
ProtocolLibrary.getProtocolManager().addPacketListener({-timePacketListener})

on unload:
ProtocolLibrary.getProtocolManager().removePacketListener({-timePacketListener})
delete {-timepacketlistener}

command /mytime <integer>:
trigger:
set {_time} to negate(mod(arg-1, 24000))
set {time::%player's uuid%} to {_time}
send "&a時間を%arg%に設定しました" to player

command /mytimeclear:
trigger:
clear {time::%player's uuid%}
send "&a時間をクリアしました" to player

function negate(value: number) :: number:
return "-%{_value}%" parsed as number
import:
ch.njol.skript.Skript
org.bukkit.plugin.Plugin

com.comphenix.protocol.events.ListenerPriority
com.comphenix.protocol.events.PacketAdapter
com.comphenix.protocol.events.PacketEvent
com.comphenix.protocol.ProtocolLibrary
com.comphenix.protocol.PacketType

java.lang.Override

preimport:
jp.nlaocs.TimePacket

public class TimePacket extends PacketAdapter:

public TimePacket():
super[Plugin, ListenerPriority, PacketType[]](Skript.getInstance(), ListenerPriority.NORMAL, [PacketType.Play.Server.UPDATE_TIME as PacketType])

@Override
public void onPacketSending(PacketEvent event):
if {time::%{_event}.getPlayer().getUniqueId()%} is set:
set {_timeOfDay} to {time::%{_event}.getPlayer().getUniqueId()%}
{_event}.getPacket().getLongs().write(1, {_TimeOfDay})

on load:
set {-timepacketlistener} to new TimePacket()
ProtocolLibrary.getProtocolManager().addPacketListener({-timePacketListener})

on unload:
ProtocolLibrary.getProtocolManager().removePacketListener({-timePacketListener})
delete {-timepacketlistener}

command /mytime <integer>:
trigger:
set {_time} to negate(mod(arg-1, 24000))
set {time::%player's uuid%} to {_time}
send "&a時間を%arg%に設定しました" to player

command /mytimeclear:
trigger:
clear {time::%player's uuid%}
send "&a時間をクリアしました" to player

function negate(value: number) :: number:
return "-%{_value}%" parsed as number
前提: skript-reflect, hippo 朝にゾンビが湧いたり夜にゾンビが燃えたりする世界が作れます
1 replies
worldeditのposをlocationとしてgetするfunction
import:
com.sk89q.worldedit.bukkit.BukkitAdapter
com.sk89q.worldedit.WorldEdit

function getPos(p: player, sel: integer) :: location:
set {_actor} to BukkitAdapter.adapt({_p})
set {_manager} to WorldEdit.getInstance().getSessionManager()
set {_localSession} to {_manager}.get({_actor})
set {_selectionWorld} to {_localSession}.getSelectionWorld()
if {_selectionWorld} is set:
set {_region} to {_localSession}.getSelection({_selectionWorld})
if {_sel} is 1:
set {_pos} to {_region}.getPos1()
else if {_sel} is 2:
set {_pos} to {_region}.getPos2()

set {_x} to {_pos}.getX()
set {_y} to {_pos}.getY()
set {_z} to {_pos}.getZ()
set {_world} to {_selectionWorld}.getWorld()

return location({_x}, {_y}, {_z}, {_world})
import:
com.sk89q.worldedit.bukkit.BukkitAdapter
com.sk89q.worldedit.WorldEdit

function getPos(p: player, sel: integer) :: location:
set {_actor} to BukkitAdapter.adapt({_p})
set {_manager} to WorldEdit.getInstance().getSessionManager()
set {_localSession} to {_manager}.get({_actor})
set {_selectionWorld} to {_localSession}.getSelectionWorld()
if {_selectionWorld} is set:
set {_region} to {_localSession}.getSelection({_selectionWorld})
if {_sel} is 1:
set {_pos} to {_region}.getPos1()
else if {_sel} is 2:
set {_pos} to {_region}.getPos2()

set {_x} to {_pos}.getX()
set {_y} to {_pos}.getY()
set {_z} to {_pos}.getZ()
set {_world} to {_selectionWorld}.getWorld()

return location({_x}, {_y}, {_z}, {_world})
前提: skript, skript-reflect, worldedit 両方選択していない状態や片方しか選択していない状態だとnoneが返されます
2 replies
PDCPlayerRealms developerS Community
Created by あお🦀 on 6/25/2024 in #help-forum
MAP_CHUNKのpacketを改変して、Y-61にある草ブロックを石にしたい
No description
61 replies
PDCPlayerRealms developerS Community
Created by あお🦀 on 6/25/2024 in #help-forum
変数名の最初にハイフンをつけるのにはなにか意味があるのですか?
No description
18 replies
PDCPlayerRealms developerS Community
Created by あお🦀 on 6/21/2024 in #help-forum
範囲コメントアウトしたい
/* aaa bbb */ みたいなやつです
8 replies
食料を即座に食べられるようにする
難読化地獄なのでコメントで何してるか書いてます 1.19.4で動作確認しています それ以外は自分でバージョン部分(v1_19_R3)書き換えてください https://www.spigotmc.org/wiki/spigot-nms-and-minecraft-versions-1-16/
import:
org.bukkit.craftbukkit.v1_19_R3.inventory.CraftItemStack

on rightclick with food:
# プレイヤーの満腹度を取得
set {_playernutrition} to player.getFoodLevel()
if {_playernutrition} is not 20:
cancel event

# bukkitのCraftItemStackをminecraftのItemStackに
set {_item} to CraftItemStack.asNMSCopy(event-item)

# ItemStackをgetItem()でItemに
set {_item} to {_item}.c()

# ItemをgetFoodProperties()でFoodProperties(FoodInfo)に
set {_item} to {_item}.v()

# FoodInfoでgetNutrition()をして満腹度回復量を得る
set {_nutrition} to {_item}.a()

# FoodInfoでgetSaturationModifier()をして隠し満腹度回復量を得る
set {_saturation} to {_item}.b()

# プレイヤーの隠し満腹度を取得
set {_playersaturation} to player.getSaturation()

set {_n} to {_nutrition} + {_playernutrition}
set {_s} to {_saturation} + {_playersaturation}

set {_n} to 20 if {_n} > 20
set {_s} to 20 if {_s} > 20

remove 1 of event-item from player
play sound "entity.generic.eat" at location of player to all players

# プレイヤーの満腹度を設定
player.setFoodLevel({_n})
player.setSaturation({_s})
import:
org.bukkit.craftbukkit.v1_19_R3.inventory.CraftItemStack

on rightclick with food:
# プレイヤーの満腹度を取得
set {_playernutrition} to player.getFoodLevel()
if {_playernutrition} is not 20:
cancel event

# bukkitのCraftItemStackをminecraftのItemStackに
set {_item} to CraftItemStack.asNMSCopy(event-item)

# ItemStackをgetItem()でItemに
set {_item} to {_item}.c()

# ItemをgetFoodProperties()でFoodProperties(FoodInfo)に
set {_item} to {_item}.v()

# FoodInfoでgetNutrition()をして満腹度回復量を得る
set {_nutrition} to {_item}.a()

# FoodInfoでgetSaturationModifier()をして隠し満腹度回復量を得る
set {_saturation} to {_item}.b()

# プレイヤーの隠し満腹度を取得
set {_playersaturation} to player.getSaturation()

set {_n} to {_nutrition} + {_playernutrition}
set {_s} to {_saturation} + {_playersaturation}

set {_n} to 20 if {_n} > 20
set {_s} to 20 if {_s} > 20

remove 1 of event-item from player
play sound "entity.generic.eat" at location of player to all players

# プレイヤーの満腹度を設定
player.setFoodLevel({_n})
player.setSaturation({_s})
skriptとskript-reflectで動きます
2 replies
PDCPlayerRealms developerS Community
Created by あお🦀 on 6/13/2024 in #help-forum
送信されるはずのpacketを改変して送信する方法
No description
21 replies
PDCPlayerRealms developerS Community
Created by あお🦀 on 6/8/2024 in #help-forum
空中でのジャンプ(スペースキー)を検知したい
だいぶ前にみらげさんがPR内でやっていたような気がします
5 replies
offline playerのサジェストに、本当のoffline playerを表示する
on tab complete for "/test":
set tab completions for position 1 to offline players

command /test [<offline player>]:
trigger:
send arg
on tab complete for "/test":
set tab completions for position 1 to offline players

command /test [<offline player>]:
trigger:
send arg
skbee必須です
4 replies
PDCPlayerRealms developerS Community
Created by あお🦀 on 6/5/2024 in #help-forum
loopの対象を動的に変更したい
loop all blocktypes:
broadcast "&a%loop-value%"
loop all blocktypes:
broadcast "&a%loop-value%"
こうすればblockのタイプが取得できますが、
command /gettype <types>:
trigger:
loop all arg-types:
broadcast "&a%loop-value%"
command /gettype <types>:
trigger:
loop all arg-types:
broadcast "&a%loop-value%"
このようにloopの対象をargの値にしたいです
24 replies
PDCPlayerRealms developerS Community
Created by あお🦀 on 6/4/2024 in #help-forum
MC、SK共に最新バージョンで、mundoskのような非同期を扱うことは可能ですか?
タイトルが全てです
17 replies
PDCPlayerRealms developerS Community
Created by あお🦀 on 6/1/2024 in #help-forum
関数名ってcamelcaseがいいとかsnakecaseがいいとかありますか?
人によってバラバラなので少し気になりました
9 replies
PDCPlayerRealms developerS Community
Created by あお🦀 on 12/29/2023 in #help-forum
コマンドの実行履歴を矢印キーで操作するときのイベント
矢印キーで実行したコマンドをさかのぼる機能を使っているのをskriptで取得するのは可能ですか?(tab completeみたいに)
6 replies
PDCPlayerRealms developerS Community
Created by あお🦀 on 11/30/2023 in #help-forum
skriptでminecraftのitemIDを取得したい
skriptで取得されるItemIDをマイクラで使われるIDに変換したいです Parsed as Item Id的なのありませんか? 1.20.1、2.6.4環境です
6 replies
PDCPlayerRealms developerS Community
Created by あお🦀 on 11/3/2023 in #help-forum
カスタムレシピについて
No description
5 replies
PDCPlayerRealms developerS Community
Created by あお🦀 on 10/31/2023 in #help-forum
変数に変化があったら:的なイベントってありますか?
タイトルのままです
8 replies
PDCPlayerRealms developerS Community
Created by あお🦀 on 10/20/2023 in #help-forum
SkQueryの演算子について
if check [player is online]->[player has permission "test"]:
if check [player is online]->[player has permission "test"]:
このような構文をskunityで見つけたのですが、これ関連の事を調べても全然出てきません 詳しく知っている方がいれば教えてほしいです できれば使い方なども教えていただければ幸いです ソース
15 replies
PDCPlayerRealms developerS Community
Created by あお🦀 on 10/11/2023 in #help-forum
function内でのsneak検知ができない
No description
11 replies
PDCPlayerRealms developerS Community
Created by あお🦀 on 7/24/2023 in #help-forum
プレイヤーのネームプレートを変えたい
No description
7 replies