Send resource pack with skript-mirror

  • 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!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.
Ok so using the slash thing worked
Code:
function sendRP(p: player):
    set {_link} to "myurl.zip"
    set {_hash} to {_link} hashed with MD5
    {_p}.setResourcePack("%{_link}%/%{_hash}%")
The resource pack gets sent and I'm able to download it, but if I change add any textures to it the RP doesn't update automatically like it should when you specify a hash. So basically it's like I didn't specify any hash.


Ok I'm gonna try this. And yes I wrote "mylink.zip" cause I didn't want to show the real one lol i'm not that stupid
[doublepost=1590575145][/doublepost]
Code:
function sendRP(p: player):
    set {_link} to "myurl.zip"
    set {_hash} to "32ff533b4917787841e096532b0606aadf270c5d"
    set {_convertedHash::*} to DatatypeConverter.parseHexBinary({_hash})
    {_p}.setResourcePack({_link}, {_convertedHash::*})
Code:
[WARNING] [Skript] No matching method: CraftPlayer#setResourcePack called with (myurl.zip (String), [50, -1, 83, 59, 73, 23, 120, 120, 65, -32, -106, 83, 43, 6, 6, -86, -33, 39, 12, 93] (Object[]))
I converted the string to a SHA-1 hash, tried doing this and it gave me this error (I also hid the url on the error).

EDIT: I didn't notice when you said "you need to hash the file, not the string". I hashed the file, replaced the hash in the code with this one e0d2f0373c1befd029b67a56b976db86705e2b45 and it still gives me the last error.
Make the variable single (not a list variable)
 
Make the variable single (not a list variable)
Code:
function sendRP(p: player):
    set {_link} to "myurl.zip"
    set {_hash} to "5257841ed159c6ee435e593db4951af8c724037b"
    set {_convertedHash} to DatatypeConverter.parseHexBinary({_hash})
    {_p}.setResourcePack({_link}, {_convertedHash})
Same error
Code:
[WARNING] [Skript] No matching method: CraftPlayer#setResourcePack called with (myurl.zip (String), 82, 87, -124, 30, -47, 89, -58, -18, 67, 94, 89, 61, -76, -107, 26, -8, -57, 36, 3, 123 (Byte[]))
 
Code:
function sendRP(p: player):
    set {_link} to "myurl.zip"
    set {_hash} to "5257841ed159c6ee435e593db4951af8c724037b"
    set {_convertedHash} to DatatypeConverter.parseHexBinary({_hash})
    {_p}.setResourcePack({_link}, {_convertedHash})
Same error
Code:
[WARNING] [Skript] No matching method: CraftPlayer#setResourcePack called with (myurl.zip (String), 82, 87, -124, 30, -47, 89, -58, -18, 67, 94, 89, 61, -76, -107, 26, -8, -57, 36, 3, 123 (Byte[]))
What server version are you using?
 
If you have Paper, you can use `Player#setResourcePack(String url, String hash)`, so you don't need to convert it to a byte array. If you don't have Paper and don't want to use it, tell me your Skript + skript-mirror version.
 
If you have Paper, you can use `Player#setResourcePack(String url, String hash)`, so you don't need to convert it to a byte array. If you don't have Paper and don't want to use it, tell me your Skript + skript-mirror version.
I use Spigot and as I'm not sure if Paper would break anything, it'd be better if it stayed this way.
Ok so turns out I'm a fucking idiot. I had two different versions of skript-mirror installed at the same time. But guess what? IT STILL DOESN'T WORK!

Now no error shows up. The resource pack downloads, but if I update the file with a new texture, the next time a player logs, the old file will download instead of the new one. So the hash still isn't doing what it's supposed to do. I fucking hate Skript.

Skript version: 2.2dev36b
skript-mirror version: 2.0.0
 
I use Spigot and as I'm not sure if Paper would break anything, it'd be better if it stayed this way.
Ok so turns out I'm a fucking idiot. I had two different versions of skript-mirror installed at the same time. But guess what? IT STILL DOESN'T WORK!

Now no error shows up. The resource pack downloads, but if I update the file with a new texture, the next time a player logs, the old file will download instead of the new one. So the hash still isn't doing what it's supposed to do. I fucking hate Skript.

Skript version: 2.2dev36b
skript-mirror version: 2.0.0
If the old file downloads when you send the resource pack again, you simply provided either the wrong link or hash.
 
If the old file downloads when you send the resource pack again, you simply provided either the wrong link or hash.
The dropbox link is always the same because the name of the file is the same. For the hash, I put the same as the old file. I don't need to create a new hash every time I update the pack, do I? Cause that ruins the whole point of having a hash. I wanted the process of developing textures and models to be quick and easy, and that's why I'm trying to use the hash, so that whenever I add anything new to the RP, all I gotta do is upload the file to Dropbox and next time players log in, the server detects through the hash if the file's been modified. If it has, then it'll download the new version of the file. Isn't that what's supposed to happen?
 
The dropbox link is always the same because the name of the file is the same. For the hash, I put the same as the old file. I don't need to create a new hash every time I update the pack, do I? Cause that ruins the whole point of having a hash. I wanted the process of developing textures and models to be quick and easy, and that's why I'm trying to use the hash, so that whenever I add anything new to the RP, all I gotta do is upload the file to Dropbox and next time players log in, the server detects through the hash if the file's been modified. If it has, then it'll download the new version of the file. Isn't that what's supposed to happen?
The exact purpose of the hash is to do the opposite. It's supposed to serve as a cache for the client, so that it doesn't download the resource pack again when the hash of that resource pack is the same, to prevent unnecessary downloads on the client. If you want the client to download the resource pack when you update it, you either provide the hash from the resource pack, or don't provide one at all. The first one has the benefit of not having to redownload the pack everytime you join.
 
you either provide the hash from the resource pack, or don't provide one at all
I had no idea it worked that way. What do you mean "provide the hash from the resource pack"?

EDIT: Oh, like creating a new hash for the new file?
 
Last edited:
Ok so forget about the hash then. If I don't specify a hash, the same thing happens. I upload the new pack, but the old one gets downloaded.
[doublepost=1590607388,1590597769][/doublepost]What I'm looking for is for the RP automatically update when it notices the new file isn't equal to the old one, although if they are equal, the cached one would load.
 
can you help me
want to do this

Code:
on damage:
    attacker is a player:
        victim is a player:
            if %gangsplus_in_gang% is "&aYes":
                cancel event

i using gang+ gangplus
%gangsplus_in_gang% showing if player in a gang showing "&aYes"
i want to use a script like this at up
[doublepost=1590608749,1590608522][/doublepost]
can you help me
want to do this

Code:
on damage:
    attacker is a player:
        victim is a player:
            if %gangsplus_in_gang% is "&aYes":
                cancel event


i using gang+ gangplus
%gangsplus_in_gang% showing if player in a gang showing "&aYes"
i want to use a script like this at up
Please create your own thread.
 
Thats not how it works, threads gets active by the knowledge of the community, your thread was not active beacuse no one understand
[doublepost=1590615358,1590615307][/doublepost]
check if ur file is modifed generate a new hash and send it
That's a great idea, didn't know it was possible. How would I do that? In this case, how would I save a file into a variable?
 
set {var} to new FIle("ur file") use "." to access ur server main folder where the worlds and configs are located

and make sure to import "java.io.FIle"

and also to check if a file is modified {var}.lastModified()
 
set {var} to new FIle("ur file") use "." to access ur server main folder where the worlds and configs are located

and make sure to import "java.io.FIle"

and also to check if a file is modified {var}.lastModified()
I just realized using a new hash won't change anything. Even if I don't specify a hash, the server should always download the file no matter how many times a player joins, but the problem is it doesn't care if the file has changed or not, it will always download the old version of the file. If I specify a hash the same will happen. At this point I don't even know anymore if this thread is being annoying or a challenge for you guys, but it sure is driving me insane. If you're tired of this thread, I won't force you to respond :emoji_slight_smile: I guess I'll just try to live with this
 
Status
Not open for further replies.