1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

adding a value to a variable crashes my server

Discussion in 'Skript' started by bigwillyman69, Oct 12, 2019.

  1. b

    bigwillyman69 Member

    Joined:
    Aug 27, 2019
    Messages:
    17
    Likes Received:
    0
    gg
    Code (Text):
    1. on right click with heart of the sea:
    2.     if name of player's tool contains "Energy Orb":
    3.         if line 6 of lore of player's held item contains "energy-orb":
    4.             remove player's tool from player
    5.             add 25 to {energyLimit.%player's uuid%}
    6.             set {energy.%player's uuid%} to {energyLimit.%player's uuid%}
    7.  
    8. every second:
    9.     loop all players:
    10.         if {energy.%loop-player's uuid%} is greater than {energyLimit.%loop-player's uuid%} - 1:
    11.             set {energy.%loop-player's uuid%} to {energyLimit.%loop-player's uuid%}
    12.             send action bar "&c♥ Health: %loop-player's health * 2%&c/&c%loop-player's max health * 2%    &e⚡ Energy: %{energy.%loop-player's uuid%}%" to loop-player
    13.         else:
    14.             add 5 to {energy.%loop-player's uuid%}
    15.             send action bar "&c♥ Health: %loop-player's health * 2%&c/&c%loop-player's max health * 2%    &e⚡ Energy: %{energy.%loop-player's uuid%}%" to loop-player
    if you right click with the energy orb in your hand it crashes the server.
     
  2. novastosha

    novastosha Well-Known Member

    Joined:
    Jan 11, 2019
    Messages:
    153
    Likes Received:
    7
    It is because you're using "every second" Wich is a really bad Feature in Skript and it still not optimized
     
  3. b

    bigwillyman69 Member

    Joined:
    Aug 27, 2019
    Messages:
    17
    Likes Received:
    0
    So how can I increase the energy limit?
     
  4. novastosha

    novastosha Well-Known Member

    Joined:
    Jan 11, 2019
    Messages:
    153
    Likes Received:
    7
    Tell me what are you trying to make and i'll try to make an other system
     
  5. b

    bigwillyman69 Member

    Joined:
    Aug 27, 2019
    Messages:
    17
    Likes Received:
    0
    so basically it displays your energy in the action bar
    when you use an item's ability it removes 50 energy
    you gain 5 energy per second, up to 200
    if you right click an energy orb you increase your energy limit by 25, and it gets set to maximum
     
  6. novastosha

    novastosha Well-Known Member

    Joined:
    Jan 11, 2019
    Messages:
    153
    Likes Received:
    7
    Uhhoh, Here i'll optimize "every second" for you

    2. How many is Your Server RAM

    3. Any Console error? If so (Send me it)
    --- Double Post Merged, Oct 12, 2019, Original Post Date: Oct 12, 2019 ---
    I mean, While using every second
     
  7. b

    bigwillyman69 Member

    Joined:
    Aug 27, 2019
    Messages:
    17
    Likes Received:
    0
    4GB
    [19:30:53] [Server thread/ERROR]: Encountered an unexpected exception
    java.lang.AssertionError: TRAP
    at net.minecraft.server.v1_14_R1.ItemStack.checkEmpty(ItemStack.java:82) ~[spigot-1.14.4.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.ItemStack.setCount(ItemStack.java:851) ~[spigot-1.14.4.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.PlayerInteractManager.a(PlayerInteractManager.java:394) ~[spigot-1.14.4.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.PlayerConnection.a(PlayerConnection.java:1293) ~[spigot-1.14.4.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:28) ~[spigot-1.14.4.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:1) ~[spigot-1.14.4.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:19) ~[spigot-1.14.4.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.TickTask.run(SourceFile:18) ~[spigot-1.14.4.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.executeTask(SourceFile:144) ~[spigot-1.14.4.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[spigot-1.14.4.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.executeNext(SourceFile:118) ~[spigot-1.14.4.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.MinecraftServer.aX(MinecraftServer.java:910) ~[spigot-1.14.4.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.MinecraftServer.executeNext(MinecraftServer.java:903) ~[spigot-1.14.4.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.awaitTasks(SourceFile:127) ~[spigot-1.14.4.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.MinecraftServer.sleepForTick(MinecraftServer.java:887) ~[spigot-1.14.4.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:820) [spigot-1.14.4.jar:git-Spigot-9de398a-9c887d4]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_211]
     
  8. novastosha

    novastosha Well-Known Member

    Joined:
    Jan 11, 2019
    Messages:
    153
    Likes Received:
    7
    So, After i read the console error, It seems that i was wrong,The problem right click While using "ItemStack"

    Ahh, I'm Stupid :emoji_stuck_out_tongue:
    --- Double Post Merged, Oct 12, 2019, Original Post Date: Oct 12, 2019 ---
    Code (Skript):
    1. on right click:
    2.     if player's held item is heart of the sea contains "Energy Orb":
    3.         if line 6 of lore of player's held item contains "energy-orb":
    4.             set clicked slot of player to air
    5.             add 25 to {energyLimit.%player's uuid%}
    6.             set {energy.%player's uuid%} to {energyLimit.%player's uuid%}
    --- Double Post Merged, Oct 12, 2019 ---
    Not tested, Send me any errors
     
Loading...