#development

1 messages ยท Page 120 of 1

forest jay
#

sorry, I meant to say "doesnt"

#

my bad

lyric gyro
#

ah well, you might want to share some code then

lyric gyro
#

that shouldn't even compile? what version is that?

forest jay
#

1.8

forest jay
lyric gyro
#

๐Ÿ’€ yeah idk about 1.8

#

I'd say check how CraftWorld.spawnEntity does it but nowadays it's just creating it and adding it to the world

forest jay
#

right?

worn jasper
#

Any ideas why I might be getting this error? Maybe I am just stupid, kinda almost 2am so, sorry if I am just dumb.

Currently getting this warning: https://paste.helpch.at/iwecazuxid.md
It happens when the api.getTotalOf(category, UUID.fromString(player), null); which is from Statz returns null, but the confusing part is, I am already checking if it isn't null? Am I checking it the wrong way?

var listOfPlayers = db.getStringList("players");
for (String player : listOfPlayers) {
  var stat = api.getTotalOf(category, UUID.fromString(player), null);
  if (stat != null) {
    dataOfPlayers.put(UUID.fromString(player), (int) Math.round(stat));
  }
}```
shell moon
#

Caused by: java.lang.NullPointerException: Cannot invoke "me.staartvin.statz.datamanager.player.PlayerInfo.getDataOfPlayerStat(me.staartvin.statz.datamanager.player.PlayerStat)" because "info" is null

#

clearly something is null

#

in this case: info variable

worn jasper
#

I didn't declare thar variable, it's from Statz.

#

The thing I am confused with is that I am already checking if it's null or not?

#

legit so confused, will probably just go sleep lol

surreal lynx
#

Does anyone know what this is? How would I decode it into plain-text? (if possible)

dense drift
#

where do you get that from?

surreal lynx
#

ExcellentCrates stores items like that

dense drift
#

right, it is probably a base64 string

surreal lynx
#

That's what I thought too, but this doesn't look right to me

dense drift
#

I don't know of any other way to store items on a string

lyric gyro
#

that's fucking cursed

surreal lynx
dusky harness
#

Is there a way to see when spigot calls certain classes/events (in intellij)?

#

the find usages thing doesn't show it :((

dense drift
#

probably because it is an object and can't decode it to plain text

lyric gyro
#

it's the NBT you're looking at

surreal lynx
#

Oh

lyric gyro
dusky harness
#

im just doing spigot dependency

lyric gyro
#

paperweight-userdev relieved

dusky harness
#

is it complicated

lyric gyro
#

not in the slightest

dense drift
lyric gyro
dusky harness
#

๐Ÿ‘€

dense drift
#

Aka ugly git

dusky harness
#

uh

lyric gyro
dusky harness
#

does it support 1.17?

lyric gyro
#

it's 1.17+ yes

dusky harness
#

yayyy

#

ty

#

wait

#

does this use mojang mappings or the ones in the server jar

lyric gyro
#

mojang mappings

dusky harness
#

oh

lyric gyro
#

but it produces two jars when you build it with reobfJar

dusky harness
#

but then wouldn't it give errors if i use it in my code?

dusky harness
#

like gradlew shadowJar reobfJar?

lyric gyro
#

just reobfJar

dusky harness
#

oh

#

alr ๐Ÿ‘

#

ty ๐Ÿ˜„

#

๐Ÿ˜ƒ

lyric gyro
#

it produces a "dev" jar which is mojmapped and a "normal" jar which is sp*got mapped blobcatnauseated (re-obfuscated)

dusky harness
#

sp*got
๐Ÿฅฒ

lyric gyro
#

spoogot

dusky harness
#

btw in gradle kts, how do I assign a task to a variable?

#

i've seen it before but i forget :((

#

so for ex instead of finalizedBy(tasks.getByName("taskName")) it'd be finalizedBy(taskName)

pulsar ferry
lyric gyro
#
tasks {
  val mySuperCoolTask by registering(TaskType::class) {
    // stuff
  }
}
dusky harness
lyric gyro
#

edited

dusky harness
#

what about existing tasks?

lyric gyro
#

tasks.blah?

dusky harness
#

oh

#

alr ๐Ÿฅฒ

lyric gyro
#

or tasks.named<TaskType>("blah")

dusky harness
#

ty it all works :))

inland bear
#

What does no damage ticks time mean

#

I have a bug on my current spigot, and i don't bother fixing it AT ALL cuz i cba

#

is this correct

#
        if (((Player) e.getEntity()).getLastDamage() < 500) e.setCancelled(true);
#

or is it 20

#

fuck nvm

proud pebble
#

it will always be cancelled as damage is unlikely to ever go that high

worn jasper
night ice
worn jasper
proud pebble
#

i love how the javadoc link is dead

#

i would guess its a problem with statz, not you

#

ask for support on the statz discord.

#

probably your best bet.

#

are you checking if the player data is even loaded?

#

might be irrevant, probably actually idk

proud pebble
worn jasper
#

found out what the issue was

#

AKA, never reload lol

night ice
worn jasper
#

they haven't updated the plugin for over a year lol

worn jasper
#

I already fixed the issue bruv lol

#

only happens when I reload

#

that's the issue

proud pebble
#

you dont /reload

#

max you should do is plugmans reload but still then since your using an external api just restart when you make changes

dense drift
#

No plugman

proud pebble
#

im saying if your gunna do it use plugman to reload your plugin, but you should just restart

#

better off

#

tho ive found alot of database performance issues w8th sqlite when i reloaded and figure out why so its a aid and a curse at the same time

sudden sand
#

Hi, so I've made a spring boot application but I've a little problem, the application when runned on intellij works perfectly but when compiled (using gradle + shadowjar) it prints me some error and don't recognize the application.properties https://www.toptal.com/developers/hastebin/ejelagemaz.yaml

tiny tulip
#

Hey guys.
I have a problem with my placeholder

grim oasis
#

throw some debug lines in there

#

print out your values

tiny tulip
#

sec

#

oh

#

I found it

#

It dont request the placeholder again

#

But how do I request a placeholder if I use it in a itemlore

grim oasis
#

an item you're making in your plugin @tiny tulip ?

tiny tulip
#

yeah

grim oasis
#

You'll have to have something updating it every second/tick/whatever

tiny tulip
#

for debugging stuff I used this to update the boots

#

ItemStack itemStack = boots.getItem(); ItemMeta itemMeta = itemStack.getItemMeta(); List<String> loreList = itemMeta.getLore(); for (int i = 0; i < loreList.size(); i++) { loreList.set(i, PlaceholderAPI.setPlaceholders(player, loreList.get(i))); Bukkit.broadcastMessage("Replaced: " + loreList.get(i)); } itemMeta.setLore(loreList); itemStack.setItemMeta(itemMeta); NBTItem placeholderBoots = new NBTItem(itemStack); player.getInventory().setBoots(placeholderBoots.getItem());

grim oasis
#

?codeblocks

neat pierBOT
#
FAQ Answer:

Use codeblocks for formatting code or configuration files:
```<language name>
<your code here>
```

For example:
```yaml
test:

  • โ€œhiโ€
  • โ€œthereโ€
    ```

Produces:

test:
- โ€œhiโ€
- โ€œthereโ€```
tiny tulip
#
        ItemStack itemStack = boots.getItem();
        ItemMeta itemMeta = itemStack.getItemMeta();
        List<String> loreList = itemMeta.getLore();
        for (int i = 0; i < loreList.size(); i++) {
            loreList.set(i, PlaceholderAPI.setPlaceholders(player, loreList.get(i)));
            Bukkit.broadcastMessage("Replaced: " + loreList.get(i));
        }
        itemMeta.setLore(loreList);
        itemStack.setItemMeta(itemMeta);
        NBTItem placeholderBoots = new NBTItem(itemStack);
        player.getInventory().setBoots(placeholderBoots.getItem());
#

ty

grim oasis
#

is there a reason you're making an NBTItem then going right back to ItemStack?

grim oasis
tiny tulip
#

it seems like you cant update the item meta directly on an nbt item

grim oasis
#

so if the existing lore is %player_name% it'll make it cj89898
but next time the existing lore is cj89898

tiny tulip
#

at least not with the api im using

grim oasis
#

so it returns cj89898

tiny tulip
#

ohh

grim oasis
#

just setBoots(itemStack)

tiny tulip
#

it stores some stuff on the item.
flyspeed and so on

grim oasis
#

must be stuff I can't see

#

because you literally make the item and add the itemstack

#

like, the lines are back to back

tiny tulip
#

yeah i mean it was for debugging and stuff xd

#

prob. going to change that in a code cleanup or smth

grim oasis
#

ok ๐Ÿ˜‚

#

the problem with updating placeholders on an item is that you need to store the original lore/name somewhere

tiny tulip
#

I might have an idea ๐Ÿ˜ฎ

surreal hare
warm steppe
#

badlion ๐Ÿคก

tiny tulip
surreal hare
#

I also own badlion.gay

warm steppe
#

buy is.gay and make badlion.is.gay

surreal hare
#

lol

#

I would if I could

#

Lunar on top :)

rustic swift
#

Hello, can someone help me to get if a world is unloaded.

spiral prairie
molten wagon
#

Is it typo in javadoc for spigot api 1.18?

when you want to use for example getBlockType or getBlockData it say for Y y โ€“ 0-255 but the world are bigger in 1.18.

pulsar ferry
#

Which class?

dense drift
#

ChunkSnapshot has these methods

proud pebble
pulsar ferry
molten wagon
pulsar ferry
pulsar ferry
#

Hmm

#

d;spigot ChunkSnapshot#getBlockType

uneven lanternBOT
#
@NotNull
Material getBlockType(int x, int y, int z)```
Description:

Get block type for block at corresponding coordinate in the chunk

Parameters:

x - 0-15
y - world minHeight (inclusive)
z - 0-15

Returns:

block material type

pulsar ferry
#

You're probably not looking at 1.18

molten wagon
#

I use

        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.18-rc3-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
pulsar ferry
#

Why not 1.18.1?

molten wagon
#

I have access to new BLOCK_MARKER also, so should not be older version.

Only if maven not use right javadocks

#

Is it any api diffrens?

pulsar ferry
#

Well that's a RC version, so very likely to be incomplete

#

Not sure, but it's likely since RC isn't final

dusty frost
#

yeah rc3 wtf

molten wagon
#

it what maven suggested lol

dusty frost
#

well see there's your problem

#

maven bad

pulsar ferry
#

Actually the suggestion comes from IJ

molten wagon
#

Same problem in 1.18-R0.1-SNAPSHOT, but in 1.18.1-R0.1-SNAPSHOT it are updated to the new javadoc.

dusty frost
#

well, i didn't even know IJ suggests artifacts to you

#

i just use the one the wiki recommends ๐Ÿ˜Œ

proud pebble
#

what the fuck

#

RC3?

#

thats old

molten wagon
#

ether way is fun they not update javadoc from 1.18.1

pulsar ferry
#

With how big Bukkit is i'm sure there are still places mentioning the wrong thing

molten wagon
#

yeah ๐Ÿ™‚ is really big

molten wagon
#

I mean I run api 1.16.5 when fix it for 1.18 before soo XD

proud pebble
#

because they you get the correct javadocs for your version that are natively supporting?

#

either support 1.18 or 1.18.1, supporting a release candidate sounds weird

molten wagon
#

true ๐Ÿ™‚ But could even be wrong in latest too ๐Ÿ™‚

proud pebble
#

you found a annotation that hadnt been converted from 1.17.

molten wagon
proud pebble
#

if your supporting 1.16 then build against 1.16?

molten wagon
#

do you not see +

proud pebble
#

arent you supposed to build against the earliest versions your supporting? /g

pulsar ferry
#

Not really

molten wagon
#

I not make a separated jar for every version XD

proud pebble
#

like ive never supported more then latest on my plugins so not really sure how it works as long as you dont build against a later java version that doesnt support it

molten wagon
proud pebble
#

such as building in java 17 when you support minecraft 1.16 since quite alot of people use java 11

molten wagon
proud pebble
#

let me guess, you compile using jdk 8?

molten wagon
#

yes but not run a 1.18 server on 8, but the plugin can be on 8.

proud pebble
#

obviously

dusty frost
#

you can't take my var and switch expressions away from me

molten wagon
#

I can say at least paper updated 1.16.5 so you can run java 16

proud pebble
#

switch expressions are a godsend

dusty frost
#

they really are

molten wagon
#

if you not use latest 1.16.5 it will not run on newer an 15

dusty frost
#

that's why I don't support legacy versions ๐Ÿ˜Œ

proud pebble
#

switch expressions are java 14 right?

dusty frost
#

yea

molten wagon
#

you mean like steam or is it lamba functionality you mean (iยดm not 100% up to speed with that)?

dusty frost
#

no, switch expressions

proud pebble
#

switch(case) {
case arg1,arg2,arg3 -> doSomething();
}

dusty frost
#
int dayOfWeek = switch (Date.today()) {
  case Date.SUNDAY -> 0;
  case Date.MONDAY -> 1;
  case Date.TUESDAY -> 2;
  default -> -1;
}```
#

something like that

molten wagon
#

yeah i know inside switch, but what i see it look like something like lamba or what is now called.

dusty frost
#

no, not a lambda

#

just a different syntax with no fallthrough

proud pebble
#

wait, you can use a switch case inside of a variable?

#

fuck me thats helpful

dusty frost
#

that's literally the point of switch expresions

#

what you listed was already possible, just with a worse syntax using fallthrough

proud pebble
#

exactly

trim forge
#

Would any of you happen to know Discord.js? I'm looking for one to hire...

proud pebble
#

i thought that was the point of switch expressions

proud pebble
#

im stupid lol

dusty frost
trim forge
#

I created a request, I was just seeing if I could speed up the process since no one has contacted me yet ๐Ÿ˜…

#

Thank you though!

molten wagon
dusty frost
#

yeah that's what switch expressions allow you to do

#

very concise and beautiful

#
        var worldName = switch(deathLocation.getWorld().getName()) {
            case "world" -> "The Overworld";
            case "world_nether" -> "The Nether";
            default -> deathLocation.getWorld().getName();
        };
#

๐Ÿ˜Œ

#

that's from one of my projects

molten wagon
#

pretty cool could be something I could use in next plugin some not need support for older minecraft versions ๐Ÿ™‚

dusty frost
#

well yeah and var is a pretty big one too

proud pebble
#

i didnt know that var was a thing either

#

thought it was some kotlin shit

dusty frost
#

it also is

#

they added var in Java 10 actually

#

so it's been around for a while

proud pebble
#

var is just a generic type right?

#

like how in python you dont have to define a variable type

dusty frost
#

it does local type inference

#

it is explicitly not like dynamic languages such as python

#

the compiler still knows exactly what type everything is at compile time

dusty frost
#

right!

dusky harness
#

Has anyone successfully sent a custom spigot plugin message to bungee? I can't get it to work :/

#

bungee -> spigot works perfectly though

#

code to listen: ```kt
@EventHandler
fun PluginMessageEvent.onPluginMessage() {
val bytes = data
// val jsonStr = DataInputStream(ByteArrayInputStream(bytes)).readUTF()
logInfo("tag: $tag, data: ${String(bytes)}")
val input = ByteStreams.newDataInput(bytes)
val channel = runCatching {
input.readUTF()
}.getOrNull() ?: run {
logInfo("Failed to read channel")
return
}
val jsonStr = runCatching {
input.readUTF()
}.getOrNull() ?: run {
logInfo("Failed to read json string")
return
}

Console:
tag: minecraft:register, data: spg:party/update[insert-unknown-symbol-here]spg:party/warp
Failed to read channel
and the code to send data: kt
val out = ByteStreams.newDataOutput()
out.writeUTF(channel.channel)
out.writeUTF(gson.toJson(data))
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray())

#

spg:party/update is one channel and spg:party/warp is another, sent in separate plugin messages

#

not sure why they're both in the same log separated by an "unknown character" symbol

pulsar ferry
#

Did you register it?

dusky harness
dense drift
#

is any player online?

lyric gyro
lyric gyro
#

minecraft:register tells the server "ayo my bro, register these channels for custom payload"

#

followed by the channels

lyric gyro
dusky harness
#

the listening one is on the proxy

#

then sending is on spigot

lyric gyro
#

you should check the channel you're expecting to read from before reading the actual data ๐Ÿ™ƒ

dusky harness
lyric gyro
#

it's this

neat pebble
#

well, are you using a custom channel?

dusky harness
#

tag always printed minecraft:register or minecraft:brand

lyric gyro
#

brand is sent from/to the client, register is the one responsible for telling the other end to, well, register a new channel

dusky harness
#

ill try replacing BungeeCord with my own channel and seeing if it appears in the tag

lyric gyro
#

make sure to register them as outgoing/incoming channels first KannaSip

dusky harness
#

oh

#

i only registered incoming

#

(on server)

#

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

lyric gyro
#

:stress:

dusky harness
#

๐Ÿ˜ญ

pulsar ferry
dusky harness
#

still no worky :((

pure crater
#

just get good

dusky harness
#

same logs, basically same code except that I removed val channel = ... and out.writeUTF(channel.channel)

#

and this time I registered outgoing

#

ill try using BungeeCord

#

nvm still won't work

#

๐Ÿ˜

#

๐Ÿ˜ญ

paper hollow
#

Anyone have a good working screenshare plugin for 1.16.5

dense drift
#

@paper hollow don't post in multiple channels, stick to one

past ibex
#

Use a debugger. Debug the player's client to see what it is actually sending.

hoary scarab
past ibex
#

how do you know they don't alter it?

hoary scarab
past ibex
#

so you debugged the reflection method call and it changes nothing

hoary scarab
#

Yeap

#

Even tried the method below it. Idk if you read it yet.

trail burrow
#

in plugin.yml if I have version: '${project.version}' it returns a version not in my pom.xml

hoary scarab
#

Any ideas? Been stuck with this for weeks and would like to get it done.

past ibex
#

Double check your debugging.

hoary scarab
#

I have

past ibex
#

debug by attaching to the process and stepping line by line

#

printing isn't correct debugging

#

so you are changing the armor stand item properly?

#

also, the spawn living packet has no fields to set the properties

#

that's the entity metadata packet

hoary scarab
past ibex
#

it doesn't send the entity metadata to the client

#

look at the packet, there's no field for metadata

#

I mean, I told you the issue if you are setting metadata correctly. The spawn entity packet does not send the client it's metadata.

#

You need PacketPlayOutEntityMetadata

#

oh right, 1.16 might include it

hoary scarab
#

1.16 PacketPlayOutSpawnEntityLiving

past ibex
#

I don't see the metadata field

#

yeah, checking the wiki there's no metadata field in 1.16 either

hoary scarab
#

Yeah noticed that. How does it work then???

past ibex
#

PacketPlayOutEntityMetadata is used instead

hoary scarab
past ibex
#

Idk

hoary scarab
#

Like the methods are exactly the same, classes too it makes no sense.

#

Apparently... DataWatcher is supposed to automatically send the metadata packet. DataWatcher is created in the constructor of the EntityLiving.

#

IT WORKED!!!! Fucking hell all these weeks for it to be fixed by a separate packet that DataWatcher is suppose to send. ๐Ÿคฆ
Thank you @past ibex

hoary scarab
#

Great now I have an issue with "varargs" in the constructor of the destroy packet.

past ibex
#

are you using VarInt?

hoary scarab
#

I got it to work.
playoutDestroy.getDeclaredConstructor(int[].class).newInstance(new int[] {(int) getId.invoke(stand)})

#

I was only using
playoutDestroy.getDeclaredConstructor(int[].class).newInstance(getId.invoke(stand))

neat pierBOT
tacit grail
#

I need some help with Plugin Messaging between Spigot (Paper) and Bungeecord. My messages never arrive on the proxy and I can't figure out why.
This is the sending side (spigot) and I confirmed that the player.sendPluginMessage(...) part is being called:

    private BukkitMessengerGateway(Plugin plugin, Server server, SchedulerAdapter scheduler, IncomingMessageConsumer consumer) {
        ...
        server.getMessenger().registerOutgoingPluginChannel(plugin, CHANNEL);
        server.getMessenger().registerIncomingPluginChannel(plugin, CHANNEL, this);
    }

    @Override
    public void sendOutgoingMessage(String encodedMessage) {
        new BukkitRunnable() {
            @Override
            public void run() {
                Collection<? extends Player> players = server.getOnlinePlayers();
                Player p = Iterables.getFirst(players, null);
                if (p == null) {
                    return;
                }

                dispatchMessage(p, encodedMessage);
                cancel();
            }
        }.runTaskTimer(plugin, 1L, 100L);
    }
    protected void dispatchMessage(Player player, String encodedMessage) {
        final ByteArrayDataOutput out = ByteStreams.newDataOutput();
        out.writeUTF(encodedMessage);
        player.sendPluginMessage(plugin, CHANNEL, out.toByteArray());
    }

This is the receiving side (bungeecord), but the Event is never fired:

    private BungeecordMessengerGateway(BungeecordBootstrap bootstrap) {
        ...
        this.proxy.registerChannel(CHANNEL);
        this.proxy.getPluginManager().registerListener(bootstrap.loader(), this);
    }

    @EventHandler
    public void onIncomingMessage(PluginMessageEvent event) {
        if (!event.getTag().equals(CHANNEL))
            return;
        event.setCancelled(true);
        if (event.getSender() instanceof ProxiedPlayer) // message from proxy -> server
            return;
        sendToAllServers(event.getData());
    }
robust flower
#

How can I convert a 32 bits encoded md5 hex string to a 128 bits encoded md5 hex string? Is that even possible?

pulsar ferry
#

I thought all md5 were 128 bits

robust flower
#

it is, but it becomes 32 bits once encoded in string by using hex

lyric gyro
torpid raft
#

are you talking about bits or characters

robust flower
#

I md5 a file, it gives me byte[], I convert that to Hex using some util function and pass that to another service, which has at some point to convert this MD5 hash encoded as Hex to its base64 representation

#

is that even possible?

torpid raft
#

at a glance it sounds like you're converting the byte to base16 correctly, but then instead of converting from base16 to base64 your service converts the base16 ascii characters to base64

robust flower
#

yes, correct

torpid raft
#

which means that the bytes in the base64 encoded value will not be equal to your original bytes

#

are you trying to revert to the original byte array?

#

in that case just reverse the steps: decode it from base64 into (your ascii value) byte array, then convert that into a string

#

then decode the resulting string from base16 to a byte array

robust flower
#

I see, ok then, thanks God it is possible to convert that thing to base64

proud pebble
#

i believe it would be better to revert the changes and then produce base 64

manic spindle
#

Can anyone help me with h2? I'm trying to create a table, and its saying theres a syntax error but its not saying what the error is. Ive been looking at it, and I cant see anything that would cause a syntax error. Any ideas?
https://pastebin.com/raw/FMDT0qNN
please ping me if you reply

SOLVED
turns out I should be surrounding the keys with `

trail burrow
#

if I use version: '${project.version}' in plugin.yml it returns 5.1.0 which is not what is in pom.xml

proud pebble
#

changing <version> in pom.xml will change that value

trail burrow
#

you would think, but not in my project

#

<version>5.1.0-Snapshot-4</version> is what is in pom

lyric gyro
trail burrow
#

how does one do that in intellij

lyric gyro
#

in the maven tab, first run the clean task, then run the package task

pulsar ferry
#

Can you show your entire pom?

#

And how are you building?

trail burrow
#

rebuild project

pulsar ferry
#

You need to run clean package to build with maven

trail burrow
#

I have not used or see where I can run a clean package

#

I did google search from what Emily said and I think I have done a clean install, in Maven tab I ran clean and it only had one issue with Jobs and me using Latest I couldn't figure out the right version number

pulsar ferry
trail burrow
#

after doing that, it says I have many errors

#

still returning 5.1.0 leaving off the Snapshot-4

#

I know IntelliJ ha s a bug about this I guess my IDE has that issue

manic spindle
#

im so confused. Im using h2 embedded. I get an error about invalid sql with this:
update `STATISTIC_DEATHS` set value=8.0, namecache=?, prefixcache=?, suffixcache=?, hourly_delta=?, daily_delta=?, weekly_delta=?, monthly_delta=? where id=?
yet it looks fine, and everything i've run it through says its fine.
It doesnt even give any info. it just says this: (then the statement and stacktrace after) org.h2.jdbc.JdbcSQLSyntaxErrorException: (Message 42001 not found); SQL statement:

Any ideas? Please ping me

dusty frost
manic spindle
#

ahh

#

that is most likely it, thank you

#

hmm, it still seems to not like it (although there is a different code this time)

[18:54:09 WARN]: update `STATISTIC_DEATHS` set "value"=8.0, namecache=?, prefixcache=?, suffixcache=?, hourly_delta=?, daily_delta=?, weekly_delta=?, monthly_delta=? WHERE id=? [42122-210]```
looking at the javadocs, it says that 42122 is COLUMN_NOT_FOUND
#

although im not sure why it wouldnt be found

#

is there a way to open the file and see what colums it says exist?

dusty frost
#

I think backticks are different than quotes

#

Try backticks for value

manic spindle
#

ok

lyric gyro
#

when something in sql doesn't work, just backtick everything cct

manic spindle
#

lol

#

yeah i thought i tried that already, but ill try again

dusty frost
#

literally lol

#

defensive backticking

manic spindle
#

nope, same thing :/

[19:02:23 WARN]: update "statistic_deaths" set `value`=8.0, namecache=?, prefixcache=?, suffixcache=?, hourly_delta=?, daily_delta=?, weekly_delta=?, monthly_delta=? WHERE id=? [42103-210]```
#

oh wait

dusty frost
#

you quoted the table name?

manic spindle
#

i thought i put that back to ticks

#

op

#

i think its fixed

dusty frost
#

backticks ๐Ÿ˜Œ

manic spindle
#

wait what

#

oh wait i did a dumb and it didnt compile -_-

dusty frost
#

this is why ORMs exist lmao

manic spindle
#

ORM?

dusty frost
#

object relational mapper, lets you abstract away most DDL and DML

manic spindle
#
[19:06:42 WARN]: update `STATISTIC_DEATHS` set `value`=8.0, namecache=?, prefixcache=?, suffixcache=?, hourly_delta=?, daily_delta=?, weekly_delta=?, monthly_delta=? WHERE id=? [42122-210]``` ๐Ÿ˜ฉ
lyric gyro
manic spindle
#

it'd be nice to know which column it thinks doesnt exist

manic spindle
#

oh shoot sorry for ping, forgot to turn it off

manic spindle
#

ok, looking at the datbase file, it seems like it made all of the column names caps for some reason

#

so ig thats why its not working?

#

is it possible to disable that?

dusty frost
#

dude I dunno, from what I've been reading, H2 seems like some crazy shit

dusty frost
manic spindle
#

apparently

#

thanks, ill look into that at some point

#

for now, any (preferably sql) flatfile databases that are usable?

#

ive been using sqlite, but it turns out that sometimes it just decides to hang a thread every hour (sometimes less) for some reason

dusty frost
#

oh weird, I haven't had any problems with SQLite

#

though to be fair, I also just run a MariaDB in Docker for all my testing stuff

manic spindle
#

yeah

void orchid
#

I've been using SQLite for my project for a few weeks and I haven't ran an issue where it'd hang like that

manic spindle
#

hmm, still getting the column not found

#

it looks like it is the correct case now, but its still missing one of the columns apparently

leaden sinew
manic spindle
#

Oh?

manic spindle
proud pebble
#

dont add the item to the menu, set specific slots.

atomic trail
#

The integer is only set if condition is true right? Without the usage of brackets

        if(cooldownTime == 0) prepare();
        int tempCount = cooldown-cooldownTime;
lyric gyro
#

this is why lack of brackets is horrific

#

especially in one-liners

#

if the condition is true, prepare will be called

atomic trail
#

Yeah I know, just wondering

dense drift
#

^

lyric gyro
#

but the int tempCount will happen regardless

atomic trail
#

Okay good, I always use brackets, just got a bit confused

lyric gyro
#

use brackets, use multi-line

rare loom
#

Hello, my Minecraft plugin saturates my server (I can't execute other commands as long as this plugin is running) Is it possible through a code to stop this plugin or avoid this?

dark garnet
dark garnet
#

i dont know that much about coding tbh
just thought it'd be pretty simple to add papi support

lyric gyro
#

it is easy, take this example

#

just one function call

fading stag
#

Can I check is a ecloud module downloaded? For example: check is "Vault" module of papi ecloud downloaded?

#

Maybe

int repeat = 3;
public void runnable(){
    new BukkitRunnable() {
        @Override
        public void run(){
            if(repeat != 0){
                // Do sth
                repeat--;
            }
        }
    }.runTaskLater(plugin, delayIntTicks, repeatDelayInTicks);
}
leaden sinew
hoary scarab
#

Use the code above remove the outside runnable and add cancel() if repeat == 0

dark garnet
dark garnet
leaden sinew
#

I'm not sure exactly what you mean, could you give an example of what you want to input and output?

dark garnet
#

its code for tab header and footer

#

it already has some built-in placeholders, but i wanna replace those with papi

leaden sinew
#

Do you mean like item = PlaceholderAPI.setPlaceholders(player, item)?

dark garnet
#

would that allow for any papi placeholder to be usable?

leaden sinew
#

Yes

dark garnet
#

oh, where do i put that?

#

preferably so that they will work anywhere in the plugin

#

but if that requires a lot more work than just allowing them in tab header/footer should be fine

leaden sinew
dark garnet
#

so this: java for (String item : items) { item = item.replaceAll("%tps%", ServerManager.getTPSString()); item = item.replaceAll("%online%", String.valueOf(Bukkit.getOnlinePlayers().size())); item = item.replaceAll("%max%", String.valueOf(Bukkit.getMaxPlayers())); header.append(item).append("\n"); } would become this?java for (String item : items) { item = PlaceholderAPI.setPlaceholders(player, item); header.append(item).append("\n"); }

dense drift
#

btw replace() is what you need

#

the name of replaceAll is misleading

dark garnet
dense drift
#

yeah

dark garnet
#

alr ty

forest jay
#

using nms or not, how can I make a sheep, who has a player as their passenger, rotate with the players head? (1.8 btw)

dark garnet
#

hm now i have the issue where tab is only being updated when a player joins/leaves

#

how do i make it update on a timer or something?

night ice
pulsar ferry
#

replaceAll uses regex, while replace doesn't

night ice
#

So there is cons for that?

pulsar ferry
#

It isn't really about cons, if you want to replace %hello% then you use replace, if you want to replace something like (\w+) you use replaceAll

night ice
#

Ooโ€ฆ.okayโ€ฆ

wheat carbon
#

if you use replaceAll it'll compile the expression as regex which will affect performance.

night ice
#

Weird names thhoo

wheat carbon
#

there's not really many use cases for replaceAll, generally you want to call that method on your compiled regex pattern

night ice
#

How does replace workโ€ฆmatch the chars in the string and replace?

wheat carbon
#

yes

night ice
#

Hmmโ€ฆthx

dark garnet
# dark garnet how do i make it update on a timer or something?
    public static long lastTabUpdate = 0;
    public static void tabUpdate() {
        long time = new Timestamp(System.currentTimeMillis()).getTime();
        if (Math.abs(lastTabUpdate - time) > 1000) { // 1,000 milliseconds (1 second)
            updateTabMetaForAll();
            lastTabUpdate = time;
        }
    }

    public static long lastFiveMinuteUpdate = 0;
    public static void fiveMinuteUpdate() {
        long time = new Timestamp(System.currentTimeMillis()).getTime();
        if (Math.abs(lastFiveMinuteUpdate - time) > 300000) { // 300,000 milliseconds (5 minutes)
            updateTeams();
            updateAllRoles();
            if (DiscordManager.smpChatChannel.asServerTextChannel().isPresent()) {
                DiscordManager.smpChatChannel.asServerTextChannel().get().updateTopic("**Online Players:** " + Bukkit.getOnlinePlayers().size() + "/" + Bukkit.getMaxPlayers());
                lastFiveMinuteUpdate = time;
            }
        }
    }```
#

thats what i have rn

#

but it isnt working

past ibex
#

why do you need math.abs? Time only moves forwards

dark garnet
#

i just copied the code from another piece of the plugin

#

which someone else made a bit ago

past ibex
#

doesn't matter, I guess people could change their clock while running the server and this would handle it

lyric gyro
dark garnet
#

this is what the updatetabmeta stuff does:

    public static void updateTabMeta(Player player) {
        if (Main.config.contains("tab-meta.header")) {
            List<String> items = Main.config.getStringList("tab-meta.header");
            StringBuilder header = new StringBuilder();
            for (String item : items) {
                item = PlaceholderAPI.setPlaceholders(player, item);
                header.append(item).append("\n");
            }
            player.setPlayerListHeader(ChatColor.translateAlternateColorCodes('&', header.toString().replaceAll("\n$", "")));
        }
        if (Main.config.contains("tab-meta.footer")) {
            List<String> items = Main.config.getStringList("tab-meta.footer");
            StringBuilder footer = new StringBuilder();
            for (String item : items) {
                item = PlaceholderAPI.setPlaceholders(player, item);
                footer.append(item).append("\n");
            }
            player.setPlayerListFooter(ChatColor.translateAlternateColorCodes('&', footer.toString().replaceAll("\n$", "")));
        }
    }

    public static void updateTabMetaForAll() {
        for (Player online : Bukkit.getOnlinePlayers()) {
            updateTabMeta(online);
        }
    }```
dark garnet
#

ping me if u reply

dark garnet
void orchid
#

Use the bukkit's scheduler

dense drift
#

So, I need to get the content of a message and its attachments with JDA. There's a method for attachments that returns an InputStream but as a CompletableFuture. How can I make my CompletableFuture#supplyAsync wait for for the completables of the attachments?

#
public CompletableFuture<String> getContent(Message message) {
  return CompletableFuture.supplyAsync(() -> {
    for (var attachment : message.getAttachments()) {
      attachment.retrieveInputStream(); // CompletableFuture<InputStream>
    }
  })
}```
#

d;jda message$attachment#retrieveinputstream

uneven lanternBOT
#
@Nonnull
public CompletableFuture<InputStream> retrieveInputStream()```
Description:

Enqueues a request to retrieve the contents of this Attachment.
The receiver is expected to close the retrieved InputStream.

Example

public void printContents(Message.Attachment attachment)
{
attachment.retrieveInputStream().thenAccept(in -> {
StringBuilder builder = new StringBuilder();
byte[] buf = byte[1024];
int count = 0;
while ((count = in.read(buf)) > 0)
{
builder.append(new String(buf, 0, count));
}
in.close();
System.out.println(builder);
}).exceptionally(t -> { // handle failure
t.printStackTrace();
return null;
});
}
Returns:

CompletableFuture - Type: InputStream

high edge
#

I mean you have an example reee

dense drift
#

Yes but by supplyAsync completable gets completed before I get access to the content of the attachment

brittle thunder
#

Could you tell me what you wanted to do exactly?

#

Wait for all the message attachment futures?

#

or like uh

dense drift
#

yea

brittle thunder
#

Where do you return the string in there?

dense drift
#

wait for them to complete and then get the data of the InputStream and join them all into a string

brittle thunder
#

of each?

dense drift
#

yes

#

I think I got it

brittle thunder
#

ah alrighty

#

What solution did you end up with?

dense drift
#
        return CompletableFuture.supplyAsync(() -> {
            final var builder = new StringBuilder();

            for (var attachment : message.getAttachments()) {
                final var in = attachment.retrieveInputStream().join();
                        
                try {
                    builder.append("### ").append(attachment.getFileName()).append(" ###\n")
                            .append(new String(in.readAllBytes()))
                            .append("\n");
                    in.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

            return builder;
        });```
I'm like 90% sure this is not right xd
brittle thunder
#

xD

#

Hmm

edgy lintel
#
INSERT INTO SwagLord
(uuid,lastknownid,level,points,upgraded,playervariables) values (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE SwagLord SET lastknownid = ?, level = ?, points = ?,upgraded = ? ,playervariables = ' ? ' WHERE uuid = ' ? ' 

im getting an index out of range exception for my sql program
java.sql.SQLException: Parameter index out of range (11 > number of parameters, which is 10).
this is so annoying pls help

#

ping me immediately if you have got an answer cuz this is pretty urgent
many thanks and take my knees in advance

sterile hinge
edgy lintel
#

im rekarded

edgy lintel
#

so how do i set json string into the parameters?

sterile hinge
#

show the error

edgy lintel
#
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 

'SET lastknownid = 'Notch', level = 0, points = 0,upgraded = 0 ,playerva' at line 1
#

and the rest are just the stack trace

#

many thanks,life saver

#

pretty sure i didnt set the quotation marks near notch btw

sterile hinge
#

yeah they are added by the sql driver, that's correct this way

#

I think the update part does not need the table name and the SET in that case

dusty frost
#

^^

edgy lintel
hoary scarab
warm steppe
#

This is not a 1.18 problem, it has happened to me on older versions too. Also, #minecraft

hoary scarab
atomic trail
#

(worldedit)

sterile hinge
#

it's more about the power of the server

#

that said, WE has a fair overhead

atomic trail
grim oasis
#

You'll have an identifier for all placeholders (ex: in %player_name% identifier is player)

#

and then the params (in the example) is your actual placeholder you want them to use

thorn cape
#

I'm having an issue where something along the lines of

Clazz instance = this will evaluate to null when I use Clazz.getInstance()

Does anyone know how I would use intellij to get more information on what's going on? Or how I should go about debugging this?

*Clazz being some class in my plugin.
*While "instance" is an object belonging to the super class of type "the super class"

dense drift
#

static access?

thorn cape
brittle thunder
#

Dont use the singleton pattern for this

thorn cape
brittle thunder
thorn cape
brittle thunder
#

Is this API for external developers?

#

or just for yourself?

thorn cape
#

External. I was trying to make something easy to use. Pretty much like how TAB does their API implementation

brittle thunder
#

Again, avoid static access for this case

thorn cape
#

I mean I'm more so trying to find the problem because up until my 4th project (this current one) it was working just fine. This might be outside the realm of Minecraft dev and more of a general java question.

sterile hinge
#

you're most likely having an issue with the order of initialization and usage

thorn cape
sterile hinge
#

well you can just attach a debugger and see what's wrong

somber light
#

@dense drift thanks for the pull request
te pup varule

dense drift
#

You mean Issue, no problem xD

winter nimbus
#

Hey is it possible to create a world that only has a specific size? For example generate a world that is 5000x5000

viral charm
# grim oasis <@!600097486484406272> check out the full example here: <https://github.com/Plac...

Thank you! Had also looked through that but I'm not quite grasping it. In if(params.equalsIgnoreCase("placeholder1")){ would I swap "placeholder1" for e.g. "%balance%" and then is it within return plugin.getConfig().getString("placeholders.placeholder1", "default1"); that I somehow connect it to my plugin, e.g. registering that %balance% is the number of (for example) coins that a player has

thorn cape
#

System.out.println("-------> IS API NULL? " + (Bukkit.getServicesManager().getRegistration(JAGAPI.class) == null));
This is null pepeW however it is declared and set/registered.

lyric gyro
#

does it show up when you iterate through getRegistrations?

#

just like , iterate and print

#

don't try to match anything

lyric gyro
#

yeah i'm 100% sure you're shading the api in KingDefense

#

so the Class ref is the one in its own jar, rather than the one in the api

thorn cape
lyric gyro
#

if you're using gradle, the user guide for the shadow plugin; if you're using maven the usage guide for the maven-shade-plugin
perhaps some other guide about the topic out there but none that I know of

thorn cape
lyric gyro
#

for maven basically: the dependencies you want to shade have to have <scope>compile</scope>, what you don't want to shade <scope>provided</scope> (or if it's a transitive dep somewhere, check out the page on exclusions)

leaden sinew
#

Does anyone know a good ArmorEquipEvent lib?

lyric gyro
#

yeah paper-api

leaden sinew
#

I don't get why Spigot hasn't added it

lyric gyro
#

spigot

#

that's why

leaden sinew
lyric gyro
#

just shade it smh

leaden sinew
#

Shade all of paper?

broken elbow
#

that would be cool

leaden sinew
#

lol

past ibex
#

Replace their jar with paper

spiral prairie
dull kayak
#

I want to move a players helmet across a bungeecord server, what would be the best way to approach this problem? Do I have to use a SQL database?

spiral prairie
#

Would be probably the best

dull kayak
#

oof, so no easier way then to set up the entire database? ๐Ÿ˜›

spiral prairie
#

You could use a map on a bungee/velo server

#

And just store the data there

#

And use pmc

dull kayak
spiral prairie
#

Plugin Messaging

#

Basically the plugin sends the helmet data to the bungee when leaving

#

Bungee stores it

#

And sends it to the server the event points to

#

(Ig there is a server switch event or smh)

forest jay
#

anyone know how to rotate a sheep through spigot or NMS?

#

I have the yaw/pitch I need

#

and I tried teleporting it with a location with the set yaw/pitch

#

and that didnt work

leaden sinew
forest jay
#

I tried that

spiral prairie
#

That works

#

Afaik

atomic trail
#

How is PaperMC NMS used in 1.18.1?
Like what is the dependency

dense drift
#

Paperweight plugin for gradle

blissful magnet
atomic trail
#

Someone got any idea how this is done in kts?

processResources {
    eachFile { expand version: version }
}
#

From groovy btw

mental cypress
#
    processResources {
        expand("version" to rootProject.version)
    }

That's how I do it in one of my projects.

lyric gyro
#

you shouldn't identify item stacks by their name/lore/etc to begin with

#

what are you trying to achieve?

#

and what does that do..?

atomic trail
#

Is name not a valid parameter in kts?

pulsar ferry
lyric gyro
#

right okay, what you want is a Map<String, ItemStack> that maps the identifying key ("sword") to the corresponding item stack

#

are you familiar with maps?

winged pebble
#

The map isn't necessary

#

Just find the item with that name

lyric gyro
#

fuck no

winged pebble
#

Otherwise you'll double up

pulsar ferry
#

NBT

lyric gyro
#

generally speaking you want to construct the lore and display name from the data, never the other way around

winged pebble
#

Yeah, I'm just saying if you're going to use the name as a key, just filter/find the list

atomic trail
pulsar ferry
#

Why?

winged pebble
#

Not saying it's the best idea, just saying if they're stuck to it

atomic trail
#

And if I have to remove one I want to remove the correct one

#

Sometimes a bit difficult with just the links

pulsar ferry
#

I guess?

dusky harness
#
// papermc repo
maven("https://etc")
#

ยฏ_(ใƒ„)_/ยฏ

atomic trail
#

Ye ig

#

Anyone got an idea what this means? lol

#

I'm completely new to kts

#

Error:

e: C:\Users\45512\Desktop\JAVA\Infection\build.gradle.kts:54:5: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
public val TaskContainer.shadowJar: TaskProvider<ShadowJar> defined in org.gradle.kotlin.dsl
pulsar ferry
#

You need to import ShadowJar reference

atomic trail
#

Uhhh

#

How would I do something like that?

pulsar ferry
#

Similar to how you do with Java, once you type ShadowJar it'll show the imports you can use

atomic trail
#

Nothing shows

#

Might be because of the thing in the top

#

@pulsar ferry Sorry for the mention if it's annoying, just not sure why I'm not getting the code insights

pulsar ferry
atomic trail
#

Got it paperDevBundle("1.18.1-R0.1-SNAPSHOT")

pulsar ferry
#

Yeah

atomic trail
#

Any way to speed up this

#

It's going for ages

pulsar ferry
#

Nope, it has to decompile and recompile the server so it takes some time for the first time

atomic trail
#

I guess the paper bundle does contain a lot

lyric gyro
#

yeah well, it's the entire server, decompiled, remapped, with generated sources, patched, re-compiled

#

it is a pretty bit

atomic trail
#

Makes sense, and it's just my laptop which isn't the best so yeah lol

#

Takes a bit

#

Wait PaperMC uses forge?

atomic trail
#

Fixed mostly

unborn fulcrum
#

Is there a reason why PlayerPortalEvent doesn't get called when the player enters the exit end portal inside the end, and is there a workaround to be able to cancel it?

lyric gyro
lyric gyro
winged pebble
prisma briar
dense drift
#

What are you trying to do?

#

I'm not sure what the maven compiler plugin does, but I never needed anything else than plain gradle and shadowJar

lyric gyro
prisma briar
edgy lintel
dense drift
#
    val colors = mutableMapOf<String, Color>()

    Color::class.java.declaredFields
        .filter { it.type == Color::class.java }
        .filter { Modifier.isStatic(it.modifiers) }
        .forEach { colors[it.name] = it.get(null) as Color }```
What would be a better way to create a map directly from the second code, instead of using that `forEach`? My goal is to get all `Color` static fields on a `Map<String, Color>`
#

Oooohhh .associate { it.name to (it.get(null) as Color) }

atomic trail
#

What has best performance, an array or HashMap with integer as key?

pulsar ferry
#

It doesn't really matter, the difference would be extremely minimal
A map is normally more organized

lyric gyro
#

It has other advantages as well, an array is of fixed size

warm steppe
#

a*

lyric gyro
#

But if course a map has overhead.
Unless you're running thousands of not tens of thousands of read/write ops a second, a map is fine

lyric gyro
past ibex
#

No datatype is faster than an array, if you are using it like an array

astral rivet
#

does anyone know how I can hotswap my plugins?

true peak
#

Hi

#

I'm having an issue with PlaceholderAPI API

#

I created my placeholder as following in the doc

#

I'm receiving my [17:54:10] [Server thread/INFO]: [PlaceholderAPI] Successfully registered expansion: anarchynetwork_skyblock [1.0.0]

#

In logs

#

But my placeholder seems to be dead

astral mauve
true peak
#
if(Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
            new AnarchySkyblockPlaceholder(this).register();
        }```
astral rivet
#

wdym it's dead

vestal forge
#

in intellij

#

and run configuration

astral rivet
#

ah

#

wait

true peak
#

I mean its dead cuz i cant use it

#

papi list display my placeholder รฉlรฉment

#

But papi parse player %anarchynetwork_skyblock_balance% display the placeholder

#

Not 0 or value

night ice
#

try papi parse me

true peak
#

Its same

broken elbow
true peak
#

I can try to remove it

#

it was that ^^

atomic trail
#

Ummm what?

java.lang.AssertionError: AssertionError (GSON 2.8.8): java.lang.IllegalAccessException: Can not set final java.util.UUID field net.valdemarf.infection.players.PlayerData.uuid to java.util.UUID

It should be able to set it?

astral rivet
#

isn't it because it's final?

dense drift
#

Yeah, fields cant be final if you plan to deserialize the class

atomic trail
hoary scarab
atomic trail
#

It is because of the final

#

It should just work though

hoary scarab
#

net.valdemarf.infection.players.PlayerData.uuid This part is what makes me think otherwise. Try debugging it

hoary scarab
atomic trail
atomic trail
hoary scarab
atomic trail
#

Should be

hoary scarab
# atomic trail

Again debug it. Maybe the wrong UUID object is being passed.

hoary scarab
pulsar ferry
#

setAccessible only makes it public, it doesn't change it from being final

hoary scarab
lyric gyro
#

final has nothing to do with it

atomic trail
#

This is where it's from PlayerData dbPlayerData = GSON.fromJson(playerDataDocument.toJson(), PlayerData.class);
The error

#

java.lang.IllegalAccessException?

lyric gyro
#

It's the fact that it's a record, you cannot reflectively modify record components so you'd have to provide your own TypeAdapter

hoary scarab
lyric gyro
#

Since java 9, final is effectively useless outside of compilation, if you have reflective access, you can change it anyway.

atomic trail
hoary scarab
atomic trail
#

Well not sure how to debug this

    public void deserializePlayerDataSet() {
        Set<PlayerData> playerDataSet = playerManager.getPlayerDataSet();

        // Deserializing - getting an object from json in the database
        for (Document playerDataDocument : getPlayerDataCollection().find()) {
            PlayerData dbPlayerData = GSON.fromJson(playerDataDocument.toJson(), PlayerData.class);
            playerDataSet.add(dbPlayerData);
        }
    }
hoary scarab
atomic trail
#

There's really not much in the class

hoary scarab
#

See if thats imported anywhere

atomic trail
#

It aint

#

Hmm

pulsar ferry
#

Hmm, why does your record have getters? thonk

atomic trail
atomic trail
pulsar ferry
#

Records already provide getters

lyric gyro
pulsar ferry
#

It's used exactly to reduce bloat

atomic trail
#

This has previously worked

atomic trail
pulsar ferry
#
final PlayerTime playerTime = new PlayerTime(...);
playerTime.duration();
playerTime.uuid();
atomic trail
atomic trail
atomic trail
#

Alright so the record should work even though it's final, GSON already sets it as accessible using reflection, so final shouldn't be an issue, not sure what else could be the problem though?

dark garnet
#

how can i make it so that placeholders arent parsed against a player (instead just like the server)?
trying to make placeholders work in discord channel topic

dark garnet
#

this is what i have rn:

                if (DiscordManager.smpChatChannel.asServerTextChannel().isPresent() && Main.config.contains("discord.smp-chat-topic")) {
                    List<String> items = Main.config.getStringList("discord.smp-chat-topic");
                    StringBuilder topic = new StringBuilder();
                    for (String item : items) {
//                        item = PlaceholderAPI.setPlaceholders(player, item);
                        topic.append(item).append("\n");
                    }
                    DiscordManager.smpChatChannel.asServerTextChannel().get().updateTopic(topic.toString().replaceAll("\n$", ""));
                }```
atomic trail
#

Most efficient way of choosing 3 random players from a set of players?

shell moon
#

repeating allowed?

shell moon
dark garnet
dark garnet
#

alright it works!

#

but now i need to find a way to get rid of the color code symbols, i tried adding on .replaceAll("ยง[a-fklmnor0-9]", "") (after .replaceAll("\n$", "")), but that didnt work

#

i assume its because its not replacing it from the placeholders, only the raw text

lyric gyro
#

There's a ChatColor.stripColors method

dark garnet
# lyric gyro There's a ChatColor.stripColors method

not sure if im applying it right (it doesnt work like this):

List<String> items = Main.config.getStringList("discord.smp-chat-topic");
StringBuilder topic = new StringBuilder();
for (String item : items) {
    item = PlaceholderAPI.setPlaceholders(null, item);
    ChatColor.stripColor(item);
    topic.append(item).append("\n");
}
DiscordManager.smpChatChannel.asServerTextChannel().get().updateTopic(topic.toString().replaceAll("\n$", "")
);```
lyric gyro
#

strings are unmodifiable

#

you need to reassign it again

dark garnet
lyric gyro
#

item = ChatColor...

dark garnet
#

so this is when it was first assigned?
item = PlaceholderAPI.setPlaceholders(null, item);

#

ohhhh

#

i see what u mean

lyric gyro
#

it's first provided by the for loop you're iterating
then reassigned with the value setPlaceholders return
then you'd need to reassign it with the value stripColor returns (just like it's doing with setPlaceholders)

dark garnet
#

so does this all seem right?

for (String item : items) {
    item = PlaceholderAPI.setPlaceholders(null, item);
    item = ChatColor.stripColor(item);
    item = item.replaceAll("[*_~]", "");
    topic.append(item).append("\n");```
#

and just so i understand, what exactly are the "items"?

lyric gyro
#

List<String> items = Main.config.getStringList("discord.smp-chat-topic");
whatever is set in that section in the config

dark garnet
lyric gyro
#

so all the item = things will affect the text i put into the config?
they won't, no

#

you're only changing the local "copy" of it

dark garnet
# lyric gyro you're only changing the local "copy" of it

ye ye thats what i mean
like whatever i put in the config setting will be affected by every item =
instead of just the placeholders being affected by them
ex: i put in *server*, it would become server instead of server, and if i put in %tps% it will become 20.0, 20.0, 20.0 instead of &a*20.0, &a*20.0, &a*20.0

lyric gyro
#

what

#

the config will remain unchanged

#

it's only being read from, not written to

dense drift
#

Yeah, once a config is loaded in memory, you have to use FileConfiguration#set to modify its content, modifications done on objects get from config won't do anything to the file itself

dark garnet
#

yea yea ik
i mean the "copy"

bold ridge
#

Hey, anyone have SQL knoledge?

#

Im trying to run

 SELECT * FROM stats WHERE 'uuid' = '5c06626c66bf48a984cbf2683e6aca87'
#

On this db

#

And the ResultSet keeps returning empty

#

This is the code I'm running

query.executeQueryAsync((resultSet, e) -> {
            if(e != null) {
                e.printStackTrace();
                save();
            } else {
                try {
                    Bukkit.broadcastMessage("Getting data!");
                    if (resultSet.next()) {
                        wins = resultSet.getInt("ms_wins");
                        System.out.println(wins + "");
                        kills = resultSet.getInt("ms_kills");
                        System.out.println(kills + "");
                    } else {
                        System.out.println("Returned Null!");
                    }

                } catch(SQLException throwables) {
                    throwables.printStackTrace();
                }
            }
        });```
#

Keeps returning "Retuned Null!"

rugged sierra
#

well i guess that's because you are checking if the e != null instead of e == null

#

not sure tho

#

& if it's equal to null anyway(that's what appears to be the case) then that's another whole problem

high edge
rugged sierra
dense drift
#

@bold ridge what happens if you execute the query manually?

neat pierBOT
dusty frost
#

uhhh

#

that's not really how you're supposed to make Guis

#

you're just supposed to use the builders, like on the wiki

#

I mean yeah, defining GUI stuff is basically a markup language

#

Just with a little code thrown in

#

And you can still open it with a command?

#

Then go use that one?

#

oof

#

why 1.16? 2 versions behind latest?

#

Compared to 1.16, 1.17 and 1.18 are both improvements lmao

#

1.18 especially

#

no like, they don't

#

i literally run 1.17 and 1.18 servers

#

that's not a lot lmao

#

margin of error

#

i run 100+ player servers on 1.17 and 1.18

#

nope, Paper

#

'bout 16GB of ram

#

Aikar's Flags, a few optimizations

#

you need like 4GB of ram for a 10 player server

#

and even that's kinda overkill

#

Thank god

#

Java 16 can run Java 8

#

Why on earth would you want to stay in 2014?

#

Because it's old, outdated, doesn't have any of the new language features or optimizations, among many other reasons?

#

Minecraft moving to the latest java version was the best thing they ever did

#

Every Java release is stable

#

That's why they take so damn long'

#

I mean there is

#

You're outdated and unsupported

#

Java 8 LTS support is ending this year iirc

#

Ah, next month

#

Can't believe it's not sooner

#

Java 8 is literally decrepit at this point

#

Extended support

#

That means nothing unless you're paying Oracle lmao

#

Get with the decade man, using the latest is where it's at

#

Look at the freaking bstats graphs

#

There are more people using 1.8 than people using 1.16

rugged sierra
#

ye but using 1.8.8 is for PvP purposes bro

#

& 1.7.10 aswell

#

& those who use 1.8.8 includes the biggest mc server, hypixel

dusty frost
#

I mean yeah, while I don't agree that that's a good idea, at least they have a reason lmao

dusty frost
#

Just go check if your plugins support latest version

#

Chances are they do

#

Considering 1.17 has been out for like a year, yes

#

Unless you're doing some spicy reflection stuff, any plugin will work backwards

#

oh my god lmao

#

Yes, it is

#

Uh, not true at all

#

Because Optifine hadn't been released yet or something?

#

There are very few changes in the client between 1.17 and 1.18

#

And, since you love stability so much, 1.18 runs Java 17, which is an LTS release

#

I have a feeling your tests are not representative of much

#

I mean, do whatever you want

#

Server-side software doesn't affect clientside FPS

#

It just baffles me why anyone would lag behind versions like this

#

What exactly changed between 1.17 and 1.18 that affects FPS so much?

#

New worldgen lowering FPS? that's funny

#

There totally was

#

And also that's huge lmao

#

Those test results aren't even valid then lmao

#

Well, luckily for us, it's not then, is it?

#

And don't get me started on using Lunar Client in newer versions

#

Cause there are a lot of better alternatives

#

Fabric, for one

shell moon
#

Official Launcher

dusty frost
#

Their whole monetization scheme is pretty rough, don't really want microtransactions in my block game lol

#

And they don't provide anything better than Forge besides I guess you don't get to choose the mods?

#

Sure, but you still see everyone else's purchaes

#

Then why use Lunar at that point?

#

Just use Forge, or, even better, Fabric

kind granite
#

...

dusty frost
#

Oh if only Forge and Fabric had all of those!

#

Oh wait, they do

#

And Lunar just repackages them

kind granite
#

if only forge and fabric were modding platforms

dusty frost
#

Oh wow, people can't handle dragging jars in every once in a while

#

Oh my god!

#

I'm not really sure what you mean by that lmao

#

As in, after a new Minecraft release?

#

Cause Lunar also has to do that

#

Hence why they didn't have Optifine when you did your test

#

Or CurseForge?

#

Lunar doesn't provide nearly any value unless you can't handle a one-time setup of about 10 minutes every 6 months

#

So I guess that says something about your playerbase lmao

#

Wow, you can do that with the mod platforms they use too!

#

Just download some mods and run

#

Just as good, especially on Fabric

#

See but I don't get to pick what mods Lunar gives me

#

And they usually don't have the best

#

For instance, Optifine is not very good

#

The Fabric suite of performance mods is far superior

#

That's a me issue? Optifine being closed source, poorly written, and maintained by one person?

#

That's funny

#

Well yeah, that'll happen when you have an incumbent

#

Same story when we had Risugami's Modloader and Forge came along

icy shadow
#

Optimid

#

Fabric good

#

Optifuckoff

#

Optishit

#

Optiratio

shell moon
dusty frost
#

see now that's what I'm talking about!

#

hey BM, did you know that mc and most performance mods don't do entity culling *based on occlusion?

icy shadow
#

that's a shame

#

is there one that does?

dusty frost
#

yeah I got it a bit ago, it's a standalone mod that does it

#

Saves hundreds of FPS when you're above a base with a million chests or something

#

let me find it

#

2.6 million downloads, don't know how I never saw it before

icy shadow
#

relieved

dusty frost
#

ayyyo

#

oh damn, he swapped from the MIT license to a weird custom one?

#
compensation.```
#

This is the only difference lmao

sterile hinge
dusty frost
#

damn so true

formal crane
#

How do i create this:

            @Override
            public void run() {
       }
}, 0, 300*20);``` in normal java?
shell moon
#

normal java

formal crane
#

no bukkit

shell moon
#

you mean timer?

formal crane
#

i think so

shell moon
#
@Test
public void givenUsingTimer_whenSchedulingTaskOnce_thenCorrect() {
    TimerTask task = new TimerTask() {
        public void run() {
            System.out.println("Task performed on: " + new Date() + "n" +
              "Thread's name: " + Thread.currentThread().getName());
        }
    };
    Timer timer = new Timer("Timer"); 
    long delay = 1000L;
    timer.schedule(task, delay);
}
#

probably that

#

you can also search "create timer task java" in google maybe

rigid mountain
#

Question, im trying to use dynmap, but im getting an error. this is my code

MarkerSet markerset = api.getMarkerAPI().createMarkerSet("id", "label", api.getMarkerAPI().getMarkerIcons(), false);
        int cornerAX = chunkX * 16, cornerAZ = chunkZ & 16, cornerBX = cornerAX + 15, cornerBZ = cornerAZ + 15;
        double[] x = new double[] {cornerAX, cornerBX};
        double[] z = new double[] {cornerAZ, cornerBZ};
        AreaMarker marker = markerset.createAreaMarker("id", "label", true,
                world.getName(),x,z, false);
        marker.setFillStyle(1, 0x42f4f1);```
shell moon
#

remember i said maybe, but google it, probably there is another solution

sterile hinge
rigid mountain
shell moon
worthy linden
#

what is the function that runs forever?

#

i mean updates forever

#

on spigot

#

maven

lyric gyro
edgy lintel
#

hey is it sensible to increment unicode character inside a string by 100 in a loop?
will it mess with the index or whatsoever?

sterile hinge
#

what

icy shadow
rigid mountain
#
MarkerSet markerset = api.getMarkerAPI().createMarkerSet("setId", "Display Name", null, false);
        int cornerAX = chunkX * 16, cornerAZ = chunkZ & 16, cornerBX = cornerAX + 15, cornerBZ = cornerAZ + 15;
        double[] x = new double[] {cornerAX, cornerBX};
        double[] z = new double[] {cornerAZ, cornerBZ};
        System.out.println(markerset);
        AreaMarker marker = markerset.createAreaMarker("id", "label", true,
                world.getName(),x,z, false);
        marker.setFillStyle(1, 0x42f4f1);```

Im using dynmap api and im getting this error
https://paste.helpch.at/gakadoxotu.cs when i sout markerset it isnt null

line 86 is the areamarker
dense drift
#

what packet is sent when items are displayed to a player? I need to change their lore / name

past ibex
#

Yeah, and also set slot

#

those are the only two ways to set items

warm steppe
astral rivet
#

wait so if I debug the minecraft server in intellij while I'm in my plugin's project, I can hotswap?

#

it sounds too easy

atomic trail
#

Best way to (de)serialize items? Can base64 be avoided?

#

Need it to JSON format

#

Using GSON API btw

#

I just need Material, Displayname, Lore and Amount

dense drift
#

then register a type adapter for it

past ibex
#

Paper has a useful API for item serialization

dusty frost
#

pretty sure JSON serialization is like, the easiest of the serialization

#

i think it's part of the base64ification

#

the real cool stuff is binary serialization ๐Ÿ˜Œ

#

straight into the db

atomic trail
#

Didnt know that

dusty frost
#

maybe this one doesn't use Gson lol

#

but what's so wrong with Base64?

#

this one looks good

dusky harness
#

i dont think that supports some stuff tho

but for Material, Displayname, Lore, and Amount it'll work

leaden sinew
#

Has anyone worked with player skins and packets, and gotten a client error about the packet length being too long?

        final GameProfile playerProfile = ((CraftPlayer) player).getProfile();
        final GameProfile profile = new GameProfile(
                uuid,
                player.getDisplayName()
        );

        profile.getProperties().removeAll("textures");
        Property textureProperty = playerProfile.getProperties().get("textures").iterator().next();
        String texture = textureProperty.getValue();
        String signature = textureProperty.getSignature();
        profile.getProperties().put("textures", new Property("textures", texture, signature));

        return profile;
#

It only happens for some people

spiral prairie
#

Are these peps using 1.8?

leaden sinew
#

1.18

past ibex
#

what packet?

leaden sinew
#

One sec

leaden sinew
# past ibex what packet?

PlayerInfo

        final GameProfile profile = this.getCopyProfile(player, uuid);
        final PacketContainer playerInfoPacket = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
        final StructureModifier<EnumWrappers.PlayerInfoAction> action = playerInfoPacket.getPlayerInfoAction();
        final StructureModifier<List<PlayerInfoData>> infoData = playerInfoPacket.getPlayerInfoDataLists();

        final List<PlayerInfoData> playerInfoData = new ArrayList<>();

        playerInfoData.add(
                new PlayerInfoData(WrappedGameProfile
                .fromHandle(profile),
                0,
                EnumWrappers.NativeGameMode.fromBukkit(GameMode.CREATIVE),
                WrappedChatComponent.fromText(profile.getName()))
        );

        action.write(0, EnumWrappers.PlayerInfoAction.ADD_PLAYER);
        infoData.write(0, playerInfoData);

        return playerInfoPacket;
bold ridge
atomic trail
past ibex
#

You can go up to infinite movement speed practically with attributes

atomic trail
#

Ah yeah attributes, forgot about them