개인 자료란 (JE)

  서버 커뮤니티

Profile sam_soon 대표칭호 없음
Profile

질문하기 스크립트

낚시 스크립트 만들고있는데 도움좀 주세요

2020.08.18 조회 수 2007 추천 수 0
이해도 1.16 
게임버전 (JE) 페이퍼 
게임버전 (BE) SKchoke, Skellet, skript-reflect, skutilities, skrayfall, skquerry, tuske 
스크립트 애드온 2.5-beta2 


options:

    name: &f[&6낚시&f]


import:


    java.lang.Math

    java.text.DecimalFormat

    java.lang.StringBuilder

    java.io.BufferedReader

    java.io.InputStreamReader

    java.net.URL

    java.util.UUID

    java.lang.Integer as JavaInteger

    java.util.Calendar

    java.util.regex.Pattern as RegexPattern

    java.util.regex.Matcher

    java.lang.management.ManagementFactory

    java.lang.management.RuntimeMXBean

    java.io.File


    org.bukkit.Bukkit

    org.bukkit.map.MinecraftFont    

    org.bukkit.block.data.Ageable as BlockDataAgeable

    org.bukkit.inventory.meta.EnchantmentStorageMeta

    org.bukkit.block.data.Levelled

    org.bukkit.Raid

    org.bukkit.Statistic

    org.bukkit.inventory.ItemFlag

    org.bukkit.Art

    org.bukkit.Rotation

    org.bukkit.entity.Horse$Color as HorseColor

    org.bukkit.entity.Horse$Style as HorseStyle

    org.bukkit.event.player.PlayerFishEvent$State as FishingState

    org.bukkit.event.player.PlayerLoginEvent$Result as LoginResult

    org.bukkit.Raid$RaidStatus

    org.bukkit.block.PistonMoveReaction as PistonReactions

    org.bukkit.inventory.ShapelessRecipe

    org.bukkit.inventory.ShapedRecipe

    org.bukkit.inventory.CookingRecipe

    org.bukkit.inventory.MerchantRecipe

    org.bukkit.inventory.StonecuttingRecipe

    org.bukkit.inventory.meta.Repairable


    com.destroystokyo.paper.entity.Pathfinder$PathResult


    ch.njol.skript.Skript

    ch.njol.skript.util.Timespan

    ch.njol.skript.lang.Effect

    ch.njol.skript.lang.TriggerItem

    ch.njol.skript.ScriptLoader

    ch.njol.skript.lang.Condition

    ch.njol.skript.classes.Changer$ChangeMode

    ch.njol.skript.classes.Changer$ChangerUtils

    ch.njol.skript.lang.Variable

    ch.njol.skript.util.Utils

    ch.njol.skript.log.ErrorQuality

    ch.njol.skript.util.SkriptColor

    ch.njol.skript.util.EnchantmentType

    ch.njol.skript.variables.Variables

    ch.njol.skript.ServerPlatform


    com.google.common.base.Splitter


    



    com.sk89q.worldedit.math.BlockVector3

    com.sk89q.worldedit.regions.CuboidRegion

    com.sk89q.worldedit.bukkit.BukkitAdapter

    com.sk89q.worldedit.function.pattern.BlockPattern

    com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats

    com.sk89q.worldedit.bukkit.BukkitWorld



expression [[fishing] state] (0¦fishing|1¦caught fish|2¦caught entity|3¦in ground|4¦failed attempt|5¦reel in|6¦bite):

    return type: object

    get:

        return FishingState.values()[parse mark]

expression [the] [event-]fish[ing] state:

    return type: object

    parse:

        continue if ScriptLoader.isCurrentEvent(class "org.bukkit.event.player.PlayerFishEvent") = true    

        Skript.error("Cannot use 'fishing state' outside of the fish event" and ErrorQuality.SEMANTIC_ERROR)

    get:

        return FishingState.values()[FishingState.ordinal(event.getState())]


expression [the] [event-]caught (1¦(item|loot)|2¦entity):

    return type: itemtype/entity

    parse:

        continue if ScriptLoader.isCurrentEvent(class "org.bukkit.event.player.PlayerFishEvent") = true    

        Skript.error("Cannot use 'caught item/entity' outside of the fish event" and ErrorQuality.SEMANTIC_ERROR)

    get:

        return (new ItemType(event.getCaught().getItemStack()) if parse mark != 2, else event.getCaught())

    set itemtype:

        try event.getCaught().setItemStack(random item of change value)

    delete:

        event.getCaught().remove()


expression [the] [event-][fish[ing]] hook:

    return type: entity

    parse:

        continue if ScriptLoader.isCurrentEvent(class "org.bukkit.event.player.PlayerFishEvent") = true    

        Skript.error("Cannot use 'fishing hook' outside of the fish event" and ErrorQuality.SEMANTIC_ERROR)

    get:

        return event.getHook()

    delete:

        event.getHook().remove()


variables:

    {number.%player%} = 0

    {item.%player%} = ""

    {length.%player%} = 0

    {e} = ""

on fish:

    #kill fishing hook

    set {number.%player%} to a random integer between 1 and 20

    set {_number2.%player%} to a random integer between 1 and 4

    set {length.%player%} to a random number between 1 and 200

    set {_date} to now

    #send "asdasd22"

    

    

    

    

    

    if {_number2.%player%} is 1:

        set {item.%player%} to cod named "{@name} &f대구"

        set 1st line of {item.%player%}'s lore to "{@name} &f대구"

    else if {_number2.%player%} is 2:

        set {item.%player%} to salmon named "{@name} &f연어"

        set 1st line of {item.%player%}'s lore to "{@name} &f연어"

    else if {_number2.%player%} is 3:

        set {item.%player%} to pufferfish named "{@name} &f복어"

        set 1st line of {item.%player%}'s lore to "{@name} &f복어"

    else if {_number2.%player%} is 4:

        set {item.%player%} to tropical fish named "{@name} &f열대어"

        set 1st line of {item.%player%}'s lore to "{@name} &f열대어"

    

        

    

    

    if {number.%player%} is 1 or 2 or 3 or 4:

        set name of {item.%player%} to "&7F등급"

        set 2st line of {item.%player%}'s lore to "&f%{length.%player%}%cm"

        set 3st line of {item.%player%}'s lore to "&f잡은 날짜: %{_date}%"

        set {e} to 1st line of {item.%player%}'s lore

    else if {number.%player%} is 5 or 6 or 7 or 8:

        set name of {item.%player%} to "&7E등급"

        set 2st line of {item.%player%}'s lore to "&f%{length.%player%}%cm"

        set 3st line of {item.%player%}'s lore to "&f잡은 날짜: %{_date}%"

        set {e} to {item.%player%}    

    else if {number.%player%} is 9 or 10 or 11:

        set name of {item.%player%} to "&7D등급"

        set 2st line of {item.%player%}'s lore to "&f%{length.%player%}%cm"

        set 3st line of {item.%player%}'s lore to "&f잡은 날짜: %{_date}%"

        set {e} to {item.%player%}    

    else if {number.%player%} is 12 or 13 or 14:

        set name of {item.%player%} to "&7C등급"

        set 2st line of {item.%player%}'s lore to "&f%{length.%player%}%cm"

        set 3st line of {item.%player%}'s lore to "&f잡은 날짜: %{_date}%"

        set {e} to {item.%player%}    

    else if {number.%player%} is 15 or 16 or 17:

        set name of {item.%player%} to "&6B등급"

        set 2st line of {item.%player%}'s lore to "&f%{length.%player%}%cm"

        set 3st line of {item.%player%}'s lore to "&f잡은 날짜: %{_date}%"

        set {e} to {item.%player%}    

    else if {number.%player%} is 18 or 19:

        set name of {item.%player%} to "&aA등급"

        set 2st line of {item.%player%}'s lore to "&f%{length.%player%}%cm"

        set 3st line of {item.%player%}'s lore to "&f잡은 날짜: %{_date}%"

        set {e} to {item.%player%}    

    else if {number.%player%} is 20:

        set name of {item.%player%} to "&c&lS등급"

        set 2st line of {item.%player%}'s lore to "&f길이: %{length.%player%}%cm"

        set 3st line of {item.%player%}'s lore to "&f잡은 날짜: %{_date}%"

        set {e} to {item.%player%}    

        #broadcast "&a%player%&f님이 &c&lS등급 &f%{item.%player%}%을 낚았습니다. &f길이: %{length.%player%}%"

    #give {e} to player

    set caught item to {item.%player%}

    #send "%{item.%player%}%, %{number.%player%}%, %{_number2.%player%}%, %{length.%player%}%cm"

    #event.getCaught().setItemStack({item.%player%})

    #event.getCaught().setItemStack({item.%player%})

    

# On Pick Up: 

    # if name of event-item contain "&f[&6낚시&f]":

        # exit

    # else:

        # if name of event-item contain "&c&lS등급":

            # set {e} to "%{e}%"

            # if {e} contain "salmon":

                # replace all "salmon named" and "&c&lS등급" with "&f[&6낚시&f] &c&lS등급 &f연어" in {e}

            # else if {e} contain "cod":

                # replace all "cod named" and "&c&lS등급" with "&f[&6낚시&f] &c&lS등급 &f대구" in {e}

            # else if {e} contain "pufferfish":

                # replace all "pufferfish named" and "&c&lS등급" with "&f[&6낚시&f] &c&lS등급 &f복어" in {e}

            # else if {e} contain "tropical fish":

                # replace all "tropical fish named" and "&c&lS등급" with "&f[&6낚시&f] &c&lS등급 &f열대어" in {e}

            # broadcast "&f%{e}%&f를 &c%player%&f님이 낚았습니다. &f길이: %{length.%player%}%cm"

            # set {number.%player%} to 0

        # else if name of event-item contain "&aA등급":

            # set {e} to "%{e}%"

            # if {e} contain "salmon":

                # replace all "salmon named" and "&aA등급" with "&f[&6낚시&f] &aA등급 &f연어" in {e}

            # else if {e} contain "cod":

                # replace all "cod named" and "&aA등급" with "&f[&6낚시&f] &aA등급 &f대구" in {e}

            # else if {e} contain "pufferfish":

                # replace all "pufferfish named" and "&aA등급" with "&f[&6낚시&f] &aA등급 &f복어" in {e}

            # else if {e} contain "tropical fish":

                # replace all "tropical fish named" and "&aA등급" with "&f[&6낚시&f] &aA등급 &f열대어" in {e}

            # broadcast "&f%{e}%&f를 &c%player%&f님이 낚았습니다. &f길이: %{length.%player%}%cm"

            # set {number.%player%} to 0

        # else if name of event-item contain "&6B등급":

            # set {e} to "%{e}%"

            # if {e} contain "salmon":

                # replace all "salmon named" and "&6B등급" with "&f[&6낚시&f] &6B등급 &f연어" in {e}

            # else if {e} contain "cod":

                # replace all "cod named" and "&6B등급" with "&f[&6낚시&f] &6B등급 &f대구" in {e}

            # else if {e} contain "pufferfish":

                # replace all "pufferfish named" and "&6B등급" with "&f[&6낚시&f] &6B등급 &f복어" in {e}

            # else if {e} contain "tropical fish":

                # replace all "tropical fish named" and "&6B등급" with "&f[&6낚시&f] &6B등급 &f열대어" in {e}

            # broadcast "&f%{e}%&f를 &c%player%&f님이 낚았습니다. &f길이: %{length.%player%}%cm"

            # set {number.%player%} to 0

        

    


# on fishing:

    # event.getState() is State.CAUGHT_FISH!

    # set {e} to event.getCaught()

    # set {_i} to random element out of {fishingdrops::*}

    # set item of {e} to {_i}

   

    

    


------------------------------------------------------------

스크립트 툴박스 받아서 해보고있는데 명확한 답이 안떠오르네요

물고기를 잡았을때 S~B 등급이면  전체 메세지로 뜨게 하고싶어요

fishh.sk skToolBox.sk

    



3개의 댓글

sam_soon
2020.08.18

물고기 이름이랑 로어 입력은 잘 되는데, 물고기 찌를 던졌을때랑 물고기가 물었을때, 물고기를 낚을때 스크립트가 모두 일어나서 전체 메세지로 보내면 세번 보내져서 답이 없어요 ㅜㅜ

스크립터브혼
2020.08.19
@sam_soon

구현하고자 하는 기능은 skript-reflect애드온 없이 가능합니다.

skellett 애드온의 [fishing state]를 참고하시길바랍니다.


Skript를 어느정도 다룰 수 있으시다면 Skellett, SkQuery, SkBee 이 세가지 애드온을 먼저 마스터 하시길 바랍니다.

이 세가지로 웬만한 기능들은 모두 구현 할 수 있습니다.


skript-mirror, skript-reflect는 Java에 대한 이해, Skript 내부코드에 대한 이해가 동반되어야 재대로 활용할 수 있습니다.

Java와 Skript 내부코드를 이해할 수준의 지식이 생기면 굳이 Skript를 쓰지 않을 겁니다.


hellow_mong
2021.02.02
@sam_soon

전체 말고 그럼 낚은건 나두고 찌를 던졌을때 막 필요없을때는 message 로 하는게 좋은거같네요

뉴스 및 창작물
/files/thumbnails/150/925/003/262x150.crop.jpg?20241123005717

건축

응답하라 1988 ?

팀뉴일리시

2024-11-23

3

/files/thumbnails/761/908/003/262x150.crop.jpg?20241025153749

건축

서울 숭례문(崇禮門) 5

KHC

2024-10-25

2

/files/thumbnails/578/899/003/262x150.crop.jpg?20241010142350

건축

경주 월정교 1

KHC

2024-10-10

2

/files/thumbnails/219/899/003/262x150.crop.jpg?20241009200950

건축

송전탑+도시 2

dbasd12

2024-10-09

2

/files/thumbnails/246/898/003/262x150.crop.jpg?20241008102328

레드스톤

단다단 - 오토노케(オトノケ) | 마인크래프트 노트블럭 커버

노트블럭전문가

2024-10-08

1