#development

1 messages · Page 1 of 1 (latest)

urban temple
#
    private HashMap<UUID, Long> cooldown = new HashMap<>();
    @EventHandler
    public void onAsyncPlayerChatEvent(AsyncPlayerChatEvent e){
        Player p = e.getPlayer();

        if (!cooldown.containsKey(p.getUniqueId())) {
            cooldown.put(p.getUniqueId(), System.currentTimeMillis());
            return;
        }

        long timeElapsed = System.currentTimeMillis() - cooldown.get(p.getUniqueId());

        if (timeElapsed >= getConfig().getInt("chat-cooldown")) {
            cooldown.put(p.getUniqueId(), System.currentTimeMillis());
            return;
        }

        int remaining = getConfig().getInt("chat-cooldown");

        e.setCancelled(true);
        timeElapsed = remaining - timeElapsed;
        p.sendMessage(Utils.color(getConfig().getString("chat-cooldown-reached").replace("%seconds%", String.valueOf(Math.round(remaining/1000)))));
    }```



it doesnt work correctly and when i am on cooldown and i send a message it actually cancells the event but doesnt say anything except for this error in the console https://pastebin.com/wARyV11H
#

anyone know why?

sterile hinge
#

it exactly tells you what's null

urban temple
#

Yea but idk why it is

#

in the config everything is correct

#

this is the config

merry knoll
urban temple
#
        p.sendMessage(Utils.color(getConfig().getString("chat-cooldown-reached").replace("%seconds%", Integer.toString(Math.round(remaining/1000)))));```
merry knoll
#

^ thats where the null is

#

maybe your config in your server is not updates?

#

updated**

urban temple
#

it is, also i had it in the config for a long time but im just recoding the cooldown system

sterile hinge
#

the path is messages.chat-cooldown-reached

merry knoll
urban temple
#

Ohh, thanks!

nimble vale
#

hey i have 2 projects that each depends the other one

both projects have errors because project A use some code from the B but
also project B uses A i need to use publishToMavenLocal but i can't because projects have error again

i don't know what to do rn

#

maybe i can remove all imports from a project but it's the last option

#

also using gradle for both

#

i guess the problem can be easily solved by ignoring errors when i run publishToMavenLocal but how can i do that

high edge
#

Why do the projects depend on eachother?

nimble vale
#

actually 2 plugins

#

well it depends because

#

idk if the structure is wrong

#

but it seems that it makes sense

high edge
#

If they depend on each other, then it doesn't really make sense

nimble vale
#

one of them is a plugin for a minigame all stuff inside it
and the other is a weapon plugin

for example
i need to give weapon in minigame plugin and check teams for weapon plugin

high edge
#

the weapons plugin shouldn't rely on the minigame plugin at all

nimble vale
#

well i need to check shooters and the victims teams

#

maybe i can create a custom shooting event for that but yeah

high edge
#

Your weapons plugin should provide everything necessary, but not handle it

nimble vale
#

i can divide it into like 3 plugin and create a new one to handle common things

#

but thats not really practical rn

#

yeah i guess i need to make a common plugin and events for the weapon plugin

lyric gyro
#

weapons plugin should provide weapons functionality only

#

minigames plugin should take advantage of the fact the weapons plugin is present and make use of it, adding all the minigame-related features to it

#

rather, bringing weapons into the minigame uh ecosystem (?)

nimble vale
#

so i just need to add an event for the weapon plugin and check the teams in minigame plugin

lyric gyro
#

it's probably gonna be more than just "an event"

#

anything that makes one plugin interact with it to make things works smoothly

#

what that is and how you do that depends on how you've structured the weapons plugin, nothing I can really tell you

nimble vale
#

yeah i was just trying to ignore the errors for a while to add dependencies

#

but i need to change the structure first

queen plank
#

How do I support multiple different versions for a plugin? I for example have a way of filling an area with a material entered in the chat, the material is selected via Material.valueOf(). How would I do this with say 1.18 and 1.19 since they include different materials? I assume I list them both as dependencies in the pom and then use different classes for it. Would I then have a "place block" function that takes in a string, gets the spigot version and redirects to the correct class from there? And does that mean I have to rewrite the same chunk of code for each version?

#

Pls ping if you respond :>

lyric gyro
#

If the player types "STONE" then stone will be on every version, if the player types "COPPER_ORE" then it'll work if the server version contains copper ore, it won't work if the server version doesn't contain copper ore

#

At most put the valueOf inside a try-catch block, catching IllegalArgument in case the entered text is not an enum constant

trail burrow
#

I'm getting errors I can't figure out, I may of found the issue, this should not return null right? getLogger().warning(String.valueOf("mainclass = " + this.getServer().getPluginManager().getPlugin(Library.AURELIUM_SKILLS.getInternalPluginName()))); [21:11:54] [Server thread/WARN]: [Autorank] mainclass = null

forest jay
#

also, what are you trying to achieve?

trail burrow
#

internal name of plugin called Aurelium Skills

#

maybe I'm not getting that info right

forest jay
#

Why not just put a string literal?

Something like Aurelium Skills or, if this is getting your own plugins instance, I would suggest creating a static instance, and set it in your on enable, along with a static getter.

trail burrow
#

I need to see if the plugin is installed or not

forest jay
#

this is how I do that when registering my papi expansion: ```java
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
new PAPIExpansion().register();
}

trail burrow
#

thats what I have but don't work

forest jay
#

then the plugin name is wrong

#

are you sure that Library.AURELIUM_SKILLS.getInternalPluginName() returns the plugin's actual name, that is defined in the plugin.yml?

trail burrow
#

I know why it is null I need to install the plugin

forest jay
#

yeah, if it isnt there, it will return null, if it is there, it will give you a JavaPlugin instance

trail burrow
#

making to many mistakes, will be done soon

forest jay
#

all good, I still make mistakes like that lol

trail burrow
#

he has AureliumSkills vBeta 1.3.6 for internal name

leaden sinew
#

So I'm having issues with generics (again).

Shouldn't this work? Or is it not known at compile time?

final DatabaseColumn<String> column = DatabaseColumn.builder("first_column").
        // Required type: DatabaseType<java.lang.Object>
        // Provided: DatabaseVarChar
        type(DatabaseTypes.ofVarChar(32)).
        key(DatabaseKey.PRIMARY).
public static class Builder<T> {

    private Builder(String name) {
        this.name = name;
    }

    public Builder<T> type(DatabaseType<T> type) {
        this.type = type;
        return this;
    }
// class is 
// public class DatabaseVarChar extends DatabaseType<String>

// DatabaseType class is:
// class DatabaseType<T>

public static DatabaseVarChar ofVarChar(int length) {
    return new DatabaseVarChar(length);
}

Please ping me if you know the issue, thanks!

#

Nvm I'm dumb

#

Had to do DatabaseColumn.<String>builder("first_column") and I was going DatabaseColumn<String>.builder("first_column")

lyric gyro
#

\✨Java\✨

sterile hinge
queen plank
#

I want to prevent players from dropping items in creative. It works fine if the player has their inventory closed and clicks q (ctrl + q works too), however if the player has their inventory open and clicks q or ctrl + q on the item it just disappears. Any idea how to fix it? I currently just listen for a PlayerDropItemEvent and cancel it. However when I drop it from the inventory the event is not called for some reason, and I can't use a InventoryClickEvent as the click type will be CREATIVE and I don't want to block slot change.

dense drift
#

There's ClickType.DROP for InventoryClickEvent

queen plank
#

Yeah ik, but that is replaced with ClickType.CREATIVE if the player is in creative and has their own inv open

#

For some reason

dense drift
#

I see

proud pebble
#

creative inventories are irritating af

#

i wish they were serverside

#

or atleast sends more packets

sudden sand
#

Why my custom model data removes itself when I got creative mode ?

#

(it's an armor item)

#

nvm it was because of exploitfixer

trail burrow
dense drift
#

code?

obsidian sonnet
#

Hello, I am having an issue, with my serialization process, this is my first time working with it, so bear with me. Thank you in advance.
https://pastebin.com/tVfi0gji
https://pastebin.com/5iRQT9DU
https://pastebin.com/F5pQLZP4
https://pastebin.com/UZWMyssW

When I click a new phantom membrane and close the inventory with a singular piece of stone placed in it

[20:29:43 INFO]: [Backpack] [STDOUT] [-84, -19, 0, 5]
[20:29:43 INFO]: [Backpack] [STDOUT] End of close inventory
[20:29:43 INFO]: [Backpack] [STDOUT] []

When I try to click that same phantom membrane to reopen the inv, inv doesn't open either.

[20:30:34 INFO]: [Backpack] [STDOUT] else
[20:30:34 INFO]: [Backpack] [STDOUT] []
[20:30:34 INFO]: java.io.EOFException
[20:30:34 INFO]: [Backpack] [STDOUT] Deserialized

I am sorry for such long message

But i have gotten it down to that what i am saving to PDC is nothing- so most likely that is causing the Exception when it tried to deserialize it.

lyric gyro
#

I'm your close inventory listener stop using getItemMeta all the time, gIM returns a copy of the ItemMeta, so this line heldItem.setItemMeta(heldItem.getItemMeta()) is effectively doing nothing; put the meta in a variable, modify it all you want and then use it in setItemMeta

#

Also for deserialising you are using a BukkitObjectInputStream, don't, use a regular ObjectInputStream

#

@obsidian sonnet

#

Although in reality ObjectStreams should not be used either, and use a DataInput/OutputStream instead but it's not the end of the world because of that

obsidian sonnet
#

Alrighty, I will try what you have suggested. Thank you.

trail burrow
#

@dense drift that's the weird part the cause don't point to my plugin, unless I'm reading it wrong, when I updated to the latest Aurelium Skills to Autorank and everything works fine as long as server has Aurelium install

#
        return isPluginAvailable(Library.AURELIUM_SKILLS);
    }

    public boolean hook() {
        return isPluginAvailable(Library.AURELIUM_SKILLS);
    }``` for checking if plugin is installed
dense drift
#

what does that method do?

trail burrow
#

checks skill levels, stats and mana

dense drift
#

I'm talking about isPluginAvailable

#

You might access a class from AureliumSkills before checking if it is enabled

trail burrow
#

I thought it was a bukkit think guess I will find that method

#
        Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin(library.getInternalPluginName());
        if (plugin == null) {
            return false;
        } else {
            return !library.hasMainClass() || plugin.getDescription().getMain().equalsIgnoreCase(library.getMainClass());
        }
    }```
obsidian sonnet
queen plank
#

How do I get the direction a living entity is looking as a Vector?

lyric gyro
#

entity.location.direction

lyric gyro
queen plank
#

🧠

#

Thnx

lyric gyro
#

Well, Location as a Vector itself is that, but Location also has yaw and pitch, that's what its direction is :d

queen plank
#

I just realised that that makes so much more sense. I thought that was stored in the entity for some reason

#

lol

lyric gyro
#

Well you see, in the vanilla code, it is

#

But Bukkit is stupid

obsidian sonnet
worn jasper
#

Uhm, If I use the holograhpic display's api, when you create a hologram, you name it, does that also show in /hd list? Cause like, I want to create A LOT of holograms, and I don't wanna spam the list and hide actual holograms that may need to be changed

dense drift
#

most likely not

merry knoll
#

but honestly, if its not per person (aka placeholders etc) just use armor stands with ticking disabled

worn jasper
#

Uhm, any ideas why this might be not working?

Consumer<Chunk> consumer = chunk -> {
  ArmorStand as = (ArmorStand) chunk.getWorld().getEntity(uuid);
  if (as != null) as.remove();
};
loc.getWorld().getChunkAtAsync(loc, consumer);
#

Like, I am 100% sure the armorstand with that uuid exists.

#

And well, it only gets executed when the chunk is loaded right?

#

so, what could be causing issues

#

quite confused

lyric gyro
#

println(armorStand)

sterile hinge
#

What part isn’t working as expected?

lyric gyro
#

yes

worn jasper
worn jasper
#

not always

#

tried replicating it and didn't work soo

#

unsure if adding that will help much

sterile hinge
#

Also, does it only happen if the chunk isn’t loaded?

dusky harness
#

println(armorStand)

lyric gyro
#

Also, entities are loaded separately from the chunk

#

There's a EntitiesLoadEvent now

#

Maybe that's why? No idea

#

But please print stuff, it's called debugging, it helps everyone help you

worn jasper
sterile hinge
sterile hinge
worn jasper
sterile hinge
#

the getEntity call

#

I assume it works when the chunk is already loaded

worn jasper
#

Yes

#

But everything is sync, shouldn’t it wait for getEntity to return? Lol

#

Quite confused on how a delay could do it

sterile hinge
#

meh the methods to get the chunk directly only if it's loaded aren't exposed as it seems :/

sterile hinge
worn jasper
sterile hinge
#

I'm not the one sitting in front of it, so you'll know better what's going on

worn jasper
#

Nono, even after that

#

I already tested it

sterile hinge
#

I can only tell you what I remember from 2 1/2 years ago

worn jasper
#

Sometimes it works as intended

#

And it loads the chunk

#

And gets the entity

sterile hinge
#

how do you know the chunk wasn't loaded?

worn jasper
sterile hinge
#

so you assume the chunk wasn't loaded?

worn jasper
obsidian sonnet
#

updated
https://pastebin.com/mjdzLF3X
https://pastebin.com/brrwnq8z
https://pastebin.com/xRjbxrfT
https://pastebin.com/22AvEwTy

When I attempt to click on an item that has had the byte array set it shows this in console.

[15:57:23 INFO]: [Backpack] [STDOUT] else
[15:57:23 INFO]: [Backpack] [STDOUT] [-84, -19, 0, 5]
[15:57:23 INFO]: [Backpack] [STDOUT] [-84, -19, 0, 5]
[15:57:23 INFO]: java.io.EOFException
[15:57:23 INFO]: [Backpack] [STDOUT] Deserialized

How do i fix said java.io.EOFException

lyric gyro
#

hmm

#

can you change this

try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos)) {
  writeInventory(inventory, oos);
  return bos.toByteArray();
} catch (IOException e) {
  System.out.println(e);
  return null;
}

to this

try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
  try (ObjectOutputStream oos = new ObjectOutputStream(bos)) {
    writeInventory(inventory, oos);
  }
  return bos.toByteArray();
} catch (IOException e) {
  System.out.println(e);
  return null;
}
#

@obsidian sonnet

obsidian sonnet
#

Yeah sure one sec.

#

It works, can you explain what exactly you changed that caused it to work? So I know for future reference.

lyric gyro
#

Some output streams buffer/store data you put into them before "sending" it to the other stream (in this case, the object stream buffers/stores some of the data before sending it to the byte array stream)
Output streams can be flushed, meaning it will send immediately any data they might have buffered; what using a try-with-resources does is, when your code exits the scope of the twr it will be flushed (and also closed)

  try (ObjectOutputStream oos = new ObjectOutputStream(bos)) {
    writeInventory(inventory, oos);
    // inside the scope of this try-with-resources
  }
  // outside of this scope of that twr, oos is flushed and all its buffered data is written to the bos

So moving it that way you basically ensure the data you need from the "outer stream" is actually written into it once you're done with the "inner stream"

obsidian sonnet
#

Ahh alright, thank you for the help!

lyric gyro
#

I didn't know OOS buffered stuff lol

formal crane
#

I am trying to Iterate through a hashmap, but all things that i found online don't work for me (when i hover over it it says its abstracted and cant be used)

#

example of what i tried:

        if (x < 0 || map.size() < x) {
            throw new IndexOutOfBoundsException();
        }

        Iterator<Map.Entry<String, Location>> it = new ListIterator();

        for (; x > 0; --x) {
            it.next(); // ignore the first x values
        }
        return it;
    }```
#

(btw i am trying to get the next item in the hashamp from a specific index)

dense drift
#

HashMap doesnt preserve order btw

formal crane
#

so if i do this

map.put(k1, v1);
map.put(k2, v2);
map.put(k3, v3);

it will not stay like that?

broken elbow
#

it will, if its a hash map

formal crane
#

i meant the order

#

i am gonna use a linkedhashmap because the order is important

broken elbow
#

oh yeah. yeah. my bad

#

linked hash map not hash map

sterile hinge
#

if order is important, you might need to reconsider your usage of a map

queen plank
#

Can someone tell me why this takes three seconds for my PC to do? I'm not doing anything else on my pc when I run it. https://paste.helpch.at/zupahiruru.cs. The time is printed using System.currentTimeMillis()

icy shadow
#

🤨 🤨 🤨

#

all you're doing is calling a constructor?

queen plank
#

Yeah, I had more code there b4

#

To validate some variables n stuff

icy shadow
#

double check you're not using old code

queen plank
#

But how can it take 3s

#

wdym

icy shadow
#

there is absolutely no way that a single constructor call takes 3 seconds

#

even if you're using a potato

#

Conditions.assertNotNull could also be doing something funky but i doubt it

lyric gyro
#

that function seems to be as fast as it gets, look at the times lol

icy shadow
#

yeah so something else is severely wrong

lyric gyro
#

inb4 allocated 64GB to the JVM and it's time for a GC cycle

queen plank
#

That is it lol

#

Idk what it all is abt

#

This 3s time

icy shadow
#

nothing else makes sense

queen plank
#

What Emily said

#

What does it mean :V

icy shadow
#

you dont have any free memory and so the jvm needs to free some up

#

this is extremely unlikely

queen plank
#

Very

#

I allow it to use 32 GB, and all 8 files I load that way all take 3.5s exactly there

icy shadow
#

hang on hang on

#

"load"

#

are you actually reading the files at all

queen plank
#

I am

#

But I did not include the code in the paste

#

I read it further down

#

After the 3s delay

icy shadow
#

are you sure

queen plank
#

Yeah

icy shadow
#

then i have no idea

#

run a debugger / profiler maybe

trail burrow
#

is jstat Kotlin?

icy shadow
#

no...?

#

it's literally made by oracle and part of the jdk lmao

#

and has "J" at the start not "K"

trail burrow
#

for some reason it is not in my JDK then

icy shadow
#

old version?

trail burrow
#

jdk 16

#

it just started to work, go figure

#

watching a video on nested classes and wanted their code to play with till I understood it

trail burrow
proud pebble
#

there is no reason to nest classes

#

judt use them as methods

trail burrow
#

either way I want to try to see if this will fix my issue

lyric gyro
#

those aren't nested/inner classes

#

they are local to the method

#

they only exist within the method they are declared in

#

if you want to access them from the outside, either make them inner classes

class Outer {
  class Inner {
  }
}

or just a whole separate class altogether

sterile hinge
#

(did you know you can have local interfaces, local enums and local records too since Java 16?)

queen plank
#

I want to allow for the use of alias commands. As default I have a command that is /cage, say the owner wants it to be /walls, how do I make it register? I can't include it in the plugin.yml as I don't know the commands when I compile the plugin.

merry knoll
#

not sure if the internal bukkit command map is public

flint kernel
#

the commandmap is public on paper but not on bukkit or spigot

wheat carbon
#

have a feeling the command needs to be entirely dynamically registered if going that route

#

iirc you can't modify entries already in the command map?

#

idk matt knows more about it

merry knoll
#

and hook them up inside the plugin

trail burrow
#

@lyric gyroI re-watched the video and realize I was to tired the first time I watched it

obsidian sonnet
#

https://pastebin.com/xfS94B8S

So my if statement will activate for things such as if you name a dispenser in an anvil called backpack and open and close it. which then throws an error bc of null item meta etc. Is there a way to get around this from happening?

trail burrow
trail burrow
#

an enum

#

AURELIUM_SKILLS("AureliumSkills", AureliumSkillsHook.class, "Archyx"),

merry knoll
#

you cant use a class from a package you dont have

#

AureliumSkillsHook.class this wont work if you are lacking the dependency

#

wait, is that from the dependency even

trail burrow
#

I have 21 other hooks setup this way and they work fine

merry knoll
#

just realized its your class name

trail burrow
#

this one worked before they changed their API

#

if I remove all code that checks the data required in the plugin it works fine, with or without the plugin. it hooks or dont hook

merry knoll
#

you are trying to access com/archyx/aureliumskills/skills/Skill

#

somewhere

trail burrow
#

nowhere in my code I have that, it's com/archyx/aureliumskills/skills/Skills

merry knoll
#

me.armar.plugins.utils.pluginlibrary.Library.getHook(Library.java:88) its here

trail burrow
#

that is only ``` public Optional<LibraryHook> getHook() {
if (this.hook == null) {
try {
this.hook = this.libraryClass.getDeclaredConstructor().newInstance();
} catch (NoClassDefFoundError | Exception var2) {
Bukkit.getLogger().info("Could not grab hook of " + this.getHumanPluginName());
var2.printStackTrace();
return Optional.empty();
}
}

    return Optional.of(this.hook);
}```
#

no imports in that class for Aurelium

merry knoll
#

well there wont be since you are using this.libraryClass

#

this.hook = this.libraryClass.getDeclaredConstructor().newInstance(); cant do this on an dependency you dont have

trail burrow
#

that code above is in Library.class

merry knoll
#

this is fine though no?

#

your code returns an empty version i assume if it doesnt exist

#

and the "error" is just the stacktrace

#

var2.printStackTrace(); from here

trail burrow
#

I didn't write this part of the code, I am trying my best to understand it

merry knoll
#

if you dont want it printed (and you handle that dependency not existing) then stack trace is not needed

#

try {
// get a new instance of the class provided
catch // class doesnt exist {
// do stuff if class doesnt exist
}

#

thats what it is doing

#

and it returns return Optional.empty();

#

whatever this is

#

if you dont want the stack trace on the console

#

remove this line

#

var2.printStackTrace();

#

but make sure you that you dont use the hook (aka the dependency) anywhere else if it returned an Optional.empty()

#

otherwise, you will get the exact same error again

trail burrow
#

I went on the assumption I didn't something stupid with imports and I delete the class and remade it

#

nope still give error

merry knoll
#

you need to use the class to get that issue

#

as in the code needs to run

trail burrow
#

when I remove the imports and any errors that come from doing so the error goes away, my guess the issues is with Aurelium Skills not my code

merry knoll
#

yes, since then you dont actually "hook" to their code

trail burrow
#

I put a check in the stacktrace to ignore aurelium skills

#

no it still hooks, just don't get the data required for the checks

merry knoll
#

data?

#

if you could share the code it would be way easier to diagnose

trail burrow
#

yes like xp for a skill

merry knoll
#

obviously

#

you cant pull the xp if the plugin doesnt exist

trail burrow
#

I'm done, testing for timing issues now, so far none

merry knoll
#

alrighty

trail burrow
#

I was thinking of adding a new feature in AR if a server owner was to change Lang file to be blank how do I get it not to send to chat? I assume it has to do with a if then or maybe something even eaiser

broken elbow
#

just an if I guess? have a custom send message method, and just check if message is not empty, and if it isn't send

trail burrow
#

guess I should make a custom send message so there would be less trouble shooting in future

broken elbow
#

it will save you from bad memory, and also from a lot of duplicated code

worn jasper
#

any ideas why? or am I just stupid?

lyric gyro
#

yes you are

#

look closely at the itemList type

worn jasper
#

GOD

#

YUP

#

just

lyric gyro
#

lol

worn jasper
#

noticed it

#

yup

#

I will take that

proud pebble
#

took me a bit to see that too lol

pure crater
#

Idk the goal, but maybe a Table would work better here

obsidian abyss
#

I'm trying to send email from java and for some reason I get this execption
javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

#

Please ping if you fine think you know what caused this exception and how to fix it.

dusky harness
#

☹️ I'm having that issue too

#

|| I just overrided the implementation so that it doesn't check that 🥲 ||

obsidian abyss
#

but this is not secured and puts your machine at risk

dusky harness
#

ik but its for a private project and I spent way too many hours on getting this to work with cloudflare

obsidian abyss
#

is there another way?

#

to get that certification?

dusky harness
#

probably, but I couldn't find any

I think it means that the certification is invalid

#

or something

#

¯_(ツ)_/¯

obsidian abyss
#

ik but how can I get one..? anyone?

slim estuary
#

Hello, I'm looking for some advice.

I've developed a plugin which collects stats about the player as they play (what blocks are broken / placed, etc.). I'm storing all of this information of my mySQL database. Now, if I wrote to the database every single time a player interacted with the world, the server wouldn't like it too much. So instead, I've decided to store all of the SQL statements to a temporary list (stored as a string), and every so often, a task would iterate through the list and execute each of these SQL statements. This seems to work fine; however, as a result of this the data can sometimes take a little bit to update. Also, if the server were to shutdown or crash for any reason, some of these statements wouldn't get executed,

Is this solution good? Or is there a better way to manage many inserts and updates to the database at any given time.

I'm using HikariCP if that helps any.

merry knoll
#

you could count the changes and update every x changes made

#

but the interval solution is what people use usually

#

(or if the data is not that important, load on player join and save on player leave and plugin disable)

merry knoll
#

its usually not an issue, but using prepared statements is highly recommended

#

which you cant do with just sql statement as string

mental cypress
#

Couldn't you just store that data on the PDC of the player and then on an async interval task update the DB with those numbers?

#

Assuming you're using a more recent version of the game.

merry knoll
slim estuary
#

I don't have many players, so updating every x amount of changes or on a join / leave event would be noticeable, since in addition to storing these stats, I have a tasks system that shows the users which blocks to interact with to complete it (for example).

I am making use of PreparedStatements, and I just build it with the string I store in the list.

Here's how my table is setup.

+--------------------------------------+----------+-----------------------+--------+
| user_uuid                            | type     | material              | amount |
+--------------------------------------+----------+-----------------------+--------+

Could I even store all of these things in a persistent data collection?

mental cypress
merry knoll
mental cypress
#

Correct

#

It's just up to the person

merry knoll
#

but, i would hold the data instead of the sql statements

mental cypress
#

I have a server that removed the need for chests because we implemented our own chests that don't tick so it helps server strain and fps to the players.

#

Utilizes PDC

slim estuary
#

Does this work?

 Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () ->
            Bukkit.getScheduler().runTaskAsynchronously(this, SQLDatabase::executeQueries), 20, 200
        );
merry knoll
#

10 seconds is a bit too fast honestly

#

most wont cry over 5 - 10 minutes of data lost

#

but if you absolutely want to use fast updates

#

then keep using hikari or any other pooling solution

#

since opening connections can be quite heavy

slim estuary
#

Inside of the executeQueries() I just open 1 connection and use connection.prepareStatement(string) inside of the loop.

#

Closing each statement

merry knoll
#

close returns the connection to the pool and open just gets one from the pool

#

they stay open

slim estuary
#

Even closing the PreparedStatement?

merry knoll
#

thats closing the statement

#

not the connection

#

once you close the statement and call .close() on your connection

#

that connection is returned to the pool

slim estuary
#

Okay yeah

merry knoll
#

you also want this

#

.scheduleAsyncRepeatingTask

#

no need to create another scheduler

slim estuary
#

It says its deprecated

merry knoll
#

runTaskTimerAsynchronously is the new one i think?

slim estuary
#

Yeah that one works

slim estuary
merry knoll
#

you can either store the data in a PDC

#

on each player

#

or just create a class to hold it

#

and store it against uuid in a hashmap

obsidian sonnet
#

https://pastebin.com/xfS94B8S

So my if statement will activate for things such as if you name a dispenser in an anvil called backpack and open and close it. which then throws an error bc of null item meta etc. Is there a way to get around this from happening?

rigid mountain
#

Hey guys question, so im saving an array of itemstacks to mongo, but when i load the object i get this error: java.lang.RuntimeException: Unable to invoke no-args constructor for interface org.bukkit.inventory.meta.ItemMeta. Register an InstanceCreator with Gson for this type may fix this problem. anyone know how to fix?

dusky harness
#

probably

rigid mountain
#

Hmmm, so i shouldnt just save the array?

dusky harness
#

then serialize that

#

might be a paper method though

obsidian abyss
#

how can I send an html email with css?

#

not embedded css

#

a file or either a link

dense drift
#

The css has to be in the same document, or hosted somewhere I believe

obsidian abyss
#

ok

#

it is working with a static html page or a website but when sending a mail as that html the styling disappear

dense drift
#

Maybe is just the client that doesnt render it

#

Also, make sure you set the content type to text/html or whatever is for html

lyric gyro
#

Hey, got some gradle questions

I have two modules:
clans-plugin and clans-plugin-legacy
clans-plugin-legacy depends on clans-plugin.

clans-plugin has a lots of dependencies, which has to be relocated. The problem is, when i build clans-plugin-legacy dependencies from clans-plugin are not being relocated. how can i have common relocations between two modules?

#

I think implementation(project(":clans-plugin", "shadow")) should do it

#

it's uh mentioned somewhere in the gradle docs

#

err, shadow* docs

#

you are my life saver

hoary scarab
#

Is there a way to do switch of instanceof? Cause I don't want to have like 8+ if(object instanceof Class)

dense drift
#

No

hoary scarab
#

Thought so. Worth a shot though.

sterile hinge
#

--enable-preview :p

warm steppe
sterile hinge
#

works in Java 17 too, but it's preview in both

lyric gyro
#

record patterns in 19record patterns in 19

sterile hinge
#

YES

lyric gyro
#

relieved

dusky harness
#

kotlin 😌

#
fun Shape.perimeter() = when (this) {
    is Rectangle -> 2 * length + 2 * width
    is Circle -> 2 * radius * PI
    else -> throw IllegalArgumentException("Unrecognized shape")
}
lyric gyro
#

nice rectangle perimeter calculation

dusky harness
#

oh oops I missed the 2 *

#

🥲

lyric gyro
#
def perimeter(shape: Shape) = shape match {
  case Rectangle(length, width) => 2 * length + 2 * width
  case Circle(radius) => 2 * PI * radius
}
#

nice edits

#

nerd

dusky harness
lyric gyro
#

throw

#

s

dusky harness
#

what language is that

lyric gyro
#

scala relieved

#

🤨

dusky harness
#

:)

icy shadow
#
perimeter :: Shape -> Double
perimeter (Rectangle length width) = 2 * length + 2 * width
perimeter (Circle radius) = 2 * pi * radius
lyric gyro
#

relieved

icy shadow
#

relieved

sterile hinge
#

relieved

icy shadow
#

or ```hs
perimeter :: Shape -> Double
perimiter = \case
Rectangle length width -> 2 * length + 2 * width
Circle radius -> 2 * pi * radius

high edge
#

relieved

hoary scarab
lyric gyro
#

What even is this place? Never touch it and will never ever be again.

hoary scarab
lyric gyro
#

NOT configuration help

hoary scarab
bitter basin
#

yoski broski, i wanna have a radius of hidden players, rn i think i will do location.getnearbyentities and throw it in a 1 tick runnable and save current players and do what i need, is there any other obvious way of doing this better

#

i was thinking move event too but that might be a bit more buggier and heavier on the server

pure crater
#

"yoski broski"

worn jasper
#

Hi, if I have this switch:

var material = string.split("-");
switch (material[0]) {
    // Code here     
}

If material doesn't contain any "-", it won't split, will it cause any errors or will the switch statement run default (If I add it).
Asking this here cause I can't really test it rn. I don't have minecraft installed rn.

lyric gyro
worn jasper
#

Hmm, so it just returns 1 string okay... so I would have to check if material[1] exists for example, to know if it was split or not.

#

Thanks.

honest bronze
#

if this is user input check the length of the split too, a string containing only - will return an empty array

rigid mountain
dusky harness
#

class Claim in package vaultclaims.Objects (also note that packages should be lowercase)

rigid mountain
floral beacon
#

is it possible to detect exactly what ip address was used to connect to server

#

like if it's used blabla.example.com

#

or 124.73.55.56?

#

like address of the server

crisp shoal
#

Hi, I'm trying to send an EntityMetadata packet indicating a player sneaking (npc) but it doesn't work, instead of sneaking, the NPC's name just turns white.

This is my code

        WrapperPlayServerEntityMetadata playOutEntityMetadata = new WrapperPlayServerEntityMetadata();

        WrappedDataWatcher watcher = new WrappedDataWatcher();
        WrappedDataWatcher.Serializer serializer = WrappedDataWatcher.Registry.get(Byte.class);

        byte bitMask = 0x00;
        if (this.sneaking) bitMask = 0x02;

        System.out.println(bitMask); // works

        watcher.setObject(0, serializer, bitMask);

        playOutEntityMetadata.setEntityID(this.entityID);
        playOutEntityMetadata.setMetadata(watcher.getWatchableObjects());
        playOutEntityMetadata.sendPacket(player);

Also I'm using ProtocolLib and dmulloy2's packet wrapper

high edge
#

You using the right data for your server version?

crisp shoal
#

Yup, it's 1.18.2 and the protocol wiki states 0x02 for crouching

obsidian abyss
#

I'm developing a java web server and for some reason every time the page refreshed or redirect is sent or the browser is closed the cookies get deleted

#

and I did set the max age of the cookies

#

ok nevermind

#

I fixed it

crisp shoal
# crisp shoal Hi, I'm trying to send an EntityMetadata packet indicating a player sneaking (np...

Got it working.
Turns out since 1.13+ a pose field is required.
This is my code now if it helps anyone

private void sendMetadataUpdatePacket(Player player) {

        WrapperPlayServerEntityMetadata playOutEntityMetadata = new WrapperPlayServerEntityMetadata();

        WrappedDataWatcher watcher = new WrappedDataWatcher();
        WrappedDataWatcher.Serializer byteSerializer = WrappedDataWatcher.Registry.get(Byte.class);
        WrappedDataWatcher.Serializer enumSerializer = WrappedDataWatcher.Registry.get(EnumWrappers.getEntityPoseClass());

        byte bitMask = 0;
        if (this.onFire) bitMask |= 0x01;
        if (this.sneaking) bitMask |= 0x02;
        if (this.sprinting) bitMask |= 0x08;
        if (this.swimming) bitMask |= 0x10;
        if (this.invisible) bitMask |= 0x20;
        if (this.glowing) bitMask |= 0x40;
        if (this.elytraFlying) bitMask |= 0x80;

        System.out.println(bitMask);

        WrappedDataWatcher.WrappedDataWatcherObject byteStatus = new WrappedDataWatcher.WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class));
        watcher.setObject(byteStatus, bitMask);

        WrappedDataWatcher.WrappedDataWatcherObject pose = new WrappedDataWatcher.WrappedDataWatcherObject(6, WrappedDataWatcher.Registry.get(EnumWrappers.getEntityPoseClass()));

        if (this.sneaking) watcher.setObject(pose, EnumWrappers.EntityPose.CROUCHING.toNms());
        else watcher.setObject(pose, EnumWrappers.EntityPose.STANDING.toNms());

        playOutEntityMetadata.setEntityID(this.entityID);
        playOutEntityMetadata.setMetadata(watcher.getWatchableObjects());
        playOutEntityMetadata.sendPacket(player);

    }
dapper inlet
#

Can anyone help me?

#

how can i fix this?

broken elbow
#

give yourself permission?

dusky harness
#

https://luckperms.net/
quality permissions manager

lyric gyro
broken elbow
lyric gyro
#

(assuming code)

dusky harness
#

not sure if this is code

lyric gyro
#

yeah lol

broken elbow
#

I was just trying to be funny 😦

dapper inlet
#

i solved it by mistake xd

crisp shoal
#

can't tell if this is a troll or not

dapper inlet
#

no troll

#

seriously

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

dapper inlet
merry knoll
#

what are those tabs

high edge
#

Can you retrieve a selection of pasted blocks using WE?

lyric gyro
#

idk if the whole selector and actor stuff is in your interest, like get the min and max and you're gucci

high edge
#

I just need the changes so I can revert after

#

So that'll probably do

lyric gyro
#

Well that's another thing

#

I guess you could do it manually but there are provided ways of undoing some operation (so long as you keep the EditSession that performed that operation)

high edge
#

Oh, yea I can store that no problem

lyric gyro
#

Thankfully it's dead easy

high edge
#

bruh, read that like 5 times, never noticed it :kek:

errant kraken
#

Is there a way to check if a block was placed with worldedit? Any WE command, like set, replace, sphere, cyl and so on

lyric gyro
#

hook up to their edit session event

#

Then use your own extent like it mentions there, override whichever methods you want and you can track block placements and all that jazz

tawny gust
#

When I put "/papi ecloud download server" everything bugs and the other expansions stop working

lyric gyro
dusky harness
#

smh Emily

lyric gyro
#

literally the same channel

worn jasper
#

stupid question: getClassLoader() can only be used in the main class right? So how would I do this in an external class? confusion at all time peak

worn jasper
#

thanks for saving me from my stupidity

worn jasper
#

Uhm is there any Map that sorts the data by well, when it was added? unsure how to explain, just like a list where .get(0) would get the first item that was ever added to it.

#

I was using HashMaps but then remembered they aren't sorted in the order I added them

#

which welp, isn't what I wished for

icy shadow
#

LinkedHashMap

worn jasper
#

ok ty

stuck canopy
#

hey

#

Is there a way to change player's uuid?

sterile hinge
#

the reason for UUIDs was to be able to change names while keeping a unique identifier

stuck canopy
#

so what else can I use to re-create Hypixel's Skyblock Profiles system

sterile hinge
#

I mean you can tell the server whatever you want, but you'll most likely want to do that on a proxy so the servers only get the data provided by you

lyric gyro
#

but yeah it is possible, just really really hacky haha

#

You'd have to access the uuid field in the player object using reflection, then modify it to whatever, save the original uuid somewhere and restore it on player quit

#

Then restore whatever their last fake uuid was on join.

stuck canopy
#

ohh thanks for the info

tired olive
#

why would u need to change a player's uuid for profiles?

stuck canopy
merry knoll
#

keep the uuid as primary key

#

and add as many profiles as you want under it

stuck canopy
merry knoll
stuck canopy
#

yea

#

they depends on uuid

merry knoll
#

but you would need to do it on prelogin most likely

#

most plugins load on player join

rare charm
#

ItemStack item = new ItemStack(Material.INK_SACK, DyeColor.LIME);

How do i fix that?

lyric gyro
#

maybe I'll make a dummy plugin to see

lyric gyro
#

Also its INK_SAC without the k

#

Ink sacs don't have any 'DyeColor' data on them, they're just regular items

rare charm
#

then it wont work

rare charm
#

im making a gui and wanna have lime dye innit

#

but lime dye isnt in 1.8.8

lyric gyro
#

oh, 1.8.8

#

Yeah, can't help with that sorry lol

#

but if an item doesn't exist in the version then you can't add it?

rare charm
#

no

#

it exists

#

but not with MATERIAL.blah

lyric gyro
#

yeah well you figure that out. Hard to get any support for a 7 year old version

rare charm
#

sagde

#

xd

merry knoll
#

for colors of items

merry knoll
#

thats gonna be a bit more messy

rare charm
#

xd

merry knoll
proud pebble
#

and you shouldnt try

#

because overall changing the player's uuid is a bad idea

merry knoll
#

they want to create fake users for players to use

#

and that can be used by any external plugin

merry knoll
dusky harness
#

they just said that they want to recreate hypixel skyblock plugin
but if it's not their plugin, and it's not open source

merry knoll
#

hypixel can do it since they just use their own plugins

dense drift
#

I don't think anybody bothers to change player's UUID

merry knoll
#

dont see how they would create fake profiles in other plugins without changing name + uuid though

proud pebble
#

arent they better off just patching the other plugins, if its not public then just using something else that is or something like that?

#

or just scrap multiple profiles

merry knoll
#

if its public

#

doubt its possible

#

cant go around changing all plugins

proud pebble
#

well really its the only way

hoary scarab
proud pebble
#

its probably easier to just scrap the profiles idea since its probably unlikely people will actually try to use them or use them enough to be worth dealing with

keen root
#

hi, i need a help for my first plugin... i want to integree Vault plugin but it alwase gave me the same problem (the econ variable is null), this is my main class and event class https://paste.md-5.net/onuvaqulaj.java

dense drift
#

Line 52

keen root
#

? @dense drift

proud pebble
keen root
#

without Economy?

proud pebble
#

well you already defined its type so yes

keen root
#

i try

keen root
proud pebble
keen root
proud pebble
novel cloud
#

to be honest I joined this server just to ask 1 question sooo....
does anyone know how to fix colors aren't displaying in console?
if you don't understand what I'm talking about but wanna help me, I can send a screenshot to you in DM

novel cloud
#

Logger.getLogger(plugin name).info(msg)

dense drift
#

Because they are not supposed to be parsed

#

You can send the message to ConsoleCommandSender

novel cloud
#

:((

keen root
#

my string il longer but it work if u want: getServer().getConsoleSender().sendRawMessage("string")

novel cloud
#

anyways thx

novel cloud
sterile hinge
#

No it stopped working because it was never supposed to work

somber gale
#

Any ProtocolLib expert here?
How could I get the IP/Domain of the server the player pinged? Like when they pinged example.com or an IP, I would like to get that.

somber gale
#

I talk about spigot and not PaperMC

#

or in this case Waterfall

dense drift
#

that is a bungee class

somber gale
#

And? Still not Spigot... Otherwise would I not mention ProtocolLib here

dusky harness
#

do you think this would fit?

#

if so, it's handshaking serverbound (PacketType.Handshaking.Client.SetProtocol) and ```java
packetContainer.getStrings().read(0)

dusky harness
#

you can also experiment with that, I doubt it's only accessible via packet

somber gale
#

Downside of these are the fact that they are only on join, while I need during ping.
The structure you mentioned doesn't seem to fit... It's probably getServerPings, but I'm not to sure about that.

dense drift
#

Ah you said ping

#

I mean, there's ServerListPingEvent

somber gale
#

Only has getAddress which is the player's address

dusky harness
proud pebble
#

so when the player pings the server, you want to get the ms of the ping?

somber gale
#

I found a solution.

proud pebble
#

solution being?

somber gale
somber gale
#

So maybe bad caching/indexing or smth

dusky harness
#

ah alr, intellij being weird 🥲

hoary scarab
#

So I asked before but here is the code that I wanted to put in a switch instead of multiple if's
illegal argument wouldn't help because I'm checking multiple different object instances not instances implementing the same object. I could be wrong though.

public Tag getTagFromObject(Object obj) {
    if(obj instanceof String)
        return StringTag.valueOf((String) obj);
        
    if(obj instanceof Integer)
        return IntTag.valueOf((int) obj);
    if(obj instanceof int[])
        return new IntArrayTag((int[]) obj);
        
    if(obj instanceof Double)
        return DoubleTag.valueOf((double) obj);
        
    if(obj instanceof Float)
        return FloatTag.valueOf((float) obj);
        
    if(obj instanceof Short)
        return ShortTag.valueOf((short) obj);
        
    if(obj instanceof Long)
        return LongTag.valueOf((long) obj);
    if(obj instanceof long[])
        return new LongArrayTag((long[]) obj);
        
    if(obj instanceof Byte)
        return ByteTag.valueOf((byte) obj);
    if(obj instanceof byte[])
        return new ByteArrayTag((byte[]) obj);

    return null;
}
dense drift
#

and the question is? 🥁

hoary scarab
#

How can I make use of switch or clean it up because I don't like the amount of if statements

dusky harness
hoary scarab
dusky harness
#

although not sure if that'll work because of unboxing and stuff

#

since idk if a byte is a java.lang.Byte

sterile hinge
#

you can't use Class in switches

dusky harness
#

you can't?

merry knoll
dusky harness
#

🥲

#

wait but seriously

#

can you not compare Classes?

hoary scarab
#

So close... Cannot switch on a value of type Class<capture#1-of ? extends Object>. Only convertible int values, strings or enum variables are permitted

merry knoll
#

is the java version of it in production yet*

merry knoll
dusky harness
#

You can't compare using #equals on any object?????????

dusky harness
#

what switch is this?!?!!?!

sterile hinge
#

lol

#

switch never had anything to do with equals

hoary scarab
edgy lintel
#

dear lord please save all the ignorant souls here they all have been forced to use java
please save all the cute people here, for your eternal kingdom will be glorified

dusky harness
#

case String.class I'd guess

BUT ITS NOT A THING IN JAVA

#

So

merry knoll
#

i think its a thing

merry knoll
#

just not in production yet

dusky harness
#

Oh

sterile hinge
#

Java switches are mostly what came from C/C++

dusky harness
graceful hedge
#

Dont you have switch with pattern matching or whatever its called

hoary scarab
sterile hinge
#

they are way more efficient than weird equals checks, but limited

merry knoll
#

yeah its been drafted in java 17

edgy lintel
#

The expression used in a switch statement must have an integral or enumerated type, or be of a class type in which the class has a single conversion function to an integral or enumerated type.

merry knoll
#

but its not in yet

hoary scarab
#

Well I could switch on class names but IDK felt like that wouldn't be as efficient.

sterile hinge
#

just use a map with functions as values

hoary scarab
merry knoll
#

with classes in it

#

and switch over the enum

edgy lintel
dusky harness
#
fun Any.getTag(): Tag? = when (this) {
    is String -> StringTag.valueOf(this)
    is Int -> IntTag.valueOf(this)
    is IntArray -> IntArrayTag(this)
    is Double -> DoubleTag.valueOf(this)
    is Float -> FloatTag.valueOf(this)
    is Long -> LongTag.valueOf(this)
    is LongArray -> LongArrayTag(this)
    is Byte -> ByteTag.valueOf(this)
    is ByteArray -> ByteArrayTag(this)
    else -> null
}
```cmon, java 😭
graceful hedge
# hoary scarab ?

Map<Class<?>,SomeFunctionThingy> (might wanna have an Identity hm)

hoary scarab
merry knoll
edgy lintel
merry knoll
#

Map<Class,Handler>

sterile hinge
# hoary scarab ?
Map<Class<?>, Function<Object, Tag>> map = ...;
return map.get(obj.getClass()).apply(obj);
edgy lintel
#

imagine java

merry knoll
sterile hinge
edgy lintel
#

false

dusky harness
#

but i mean the any object part

#

they should add

#

and the is

#

although in java's case it'd be instanceof

merry knoll
dusky harness
#

👍

#

thats nice

merry knoll
#

soon tm that is

dusky harness
#

lol

edgy lintel
#

not good

dusky harness
#

™️

merry knoll
#

i mean i prefer java honestly

sterile hinge
merry knoll
#

but coroutines kinda spoiled me on kotlin

edgy lintel
#

dude im beginning to hate on java with all those tedious typings

#

i have like 130 wpm but its still too slow for completing work

dense drift
#

java is known for its verbosity

dusky harness
#

🤢

dense drift
#

but that doesn't mean is bad winkers

edgy lintel
dusky harness
#

Kotlin can also be verbose if you want

merry knoll
#

i mean github copilot handles most

dusky harness
#

but java forces it

dense drift
#

var is perfect

dusky harness
#

val 😌

edgy lintel
#

auto

dusky harness
sterile hinge
edgy lintel
merry knoll
#

why would you use eclipse over intellij even

edgy lintel
#

man i will just code on paper

#

intellij too heavyweight for my potato pc

sterile hinge
#

sounds like a you problem

edgy lintel
#

its a me problem indeed

merry knoll
#

its only heavy on first run i feel like

high edge
#

Man seriously hating a language cause he decided to use a shitty ide kek

merry knoll
#

once its done indexing, it barely uses much

high edge
#

Mate I was running IJ perfectly fine on my old 32bit pc with 4gb of ram

edgy lintel
#

oh is that, i will give it a try lol

high edge
#

You have no excuse

edgy lintel
dusky harness
edgy lintel
#

on my laptop

merry knoll
#

its using 700 mbs of ram on a big project being open currently

high edge
#

I had an i3 2nd gen I believe

edgy lintel
#

wtf

dusky harness
high edge
#

So you probably already have something better

edgy lintel
#

isnt ultimate like paid?

high edge
#

If you're a student no

merry knoll
#

if you are a student

#

you can get all their products for free

dense drift
dusky harness
high edge
#

If you're not, just use community, it's got most of what you need

merry knoll
#

CLion etc included

edgy lintel
#

oh nice

merry knoll
wheat carbon
#

my ij uses 2.1gb with docdex opened

#

what is this 700mb magic

#

wait no ij says 395MB

edgy lintel
#

bro has worked since last life in parallel universe

dusky harness
#

my ij memory meter thing is always diff from task manager

#

¯_(ツ)_/¯

high edge
#

Mine normally uses like 1gb

dense drift
#

Smh pig

spiral prairie
#

Mine normally uses like 4

dusky harness
#

ah great, just opened it and the first thing I see in task manager is IJ using 2.6gb of memory

well I'll let it index first

lost flower
#

when is deluxetags getting 1.19 updated

wheat carbon
#

does it need an update

spiral prairie
broken elbow
lost flower
dusky harness
merry knoll
dusky harness
merry knoll
#

indexing is quite heavy usually

dusky harness
#

not even moving by 0.1

#

¯_(ツ)_/¯

merry knoll
broken elbow
dusky harness
#

oh mb

#

can't read

pulsar ferry
#

My average day

#

IJ takes around 6GB

merry knoll
#

i got 16 total so Sadge

dusky harness
#

I've only got 16gb

#

☹️

graceful hedge
#

Hehe

broken elbow
#

omg

#

its conclure

pulsar ferry
#

If I only had 16 i'd die

dusky harness
graceful hedge
graceful hedge
broken elbow
#

hi conclure

pulsar ferry
#

Normally I need to be running 1 to 2 servers on IJ and have 3 mc opened at the same time

graceful hedge
dusky harness
wheat carbon
#

windows user

broken elbow
merry knoll
pulsar ferry
#

I love running it on IJ, makes debugging so much easier

merry knoll
#

yeah agreed, it would be pain for me if stuff started to freeze

#

and i got the server laying around so shrug

broken elbow
#

my problem with running it in IJ, is that I have to set up the build configuration thingy for every project

wheat carbon
#

matt do you use hotswapping?

#

write something to do it for you then blitz

broken elbow
broken elbow
pulsar ferry
#

Unfortunately hotswap wouldn't work, too many things in the server like microservices running on docker containers though the minigames don't last that long to be needed

high edge
queen plank
#

When is the BlockExplodeEvent called? I get no output despite exploding blocks with both creepers and TNT. The event is registered properly so that is not the problem

#

The docs just says Called when a block explodes but it isn't called?

dusky harness
#

EntityExplodeEvent are for entities such as creepers and tnt

#

oh, 30 minutes late

#

¯_(ツ)_/¯

queen plank
#

It is fine lol. But I explode blocks WITH the TNT/Creeper, which is why I am confused

dusky harness
#

it's only from the explosion source

queen plank
#

I know the TNT/Creeper won't trigger it, I just assumed that the dirt blocks or whatever would trigger it

dusky harness
#

so if the source is a block, then it will call that event

queen plank
#

Ohhh

#

That makes sense, thank you

sterile hinge
#

the dirt block doesn't explode itself, it's just affected by the explosion

queen plank
#

Can anyone explain this?

System.out.println("Changed mat to " + material);
c.setType(material);
System.out.println(c.getType());
[21:00:58] [Server thread/INFO]: Changed mat to GRASS_BLOCK
[21:00:58] [Server thread/INFO]: VOID_AIR

There is no one in the world atm is that why? Am I maybe cancelling some event?

sterile hinge
#

what is c? was it VOID_AIR before?

queen plank
#

c is a block, sry

#

And yes it was

sterile hinge
#

is the block outside of the world height?

#

because VOID_AIR shouldn't appear otherwise normally

queen plank
#

ofmg...

#

I'm so dumb

#

It is

#

Thank you lol

sterile hinge
#

happy to help :p

worn jasper
#

Uhm If I have a class and I make it serializable, and lets say I create an object, serialize it into base64 and store it in a file

#

and lets assume that class, has a constructor with 3 params.

#

But now I want to add a 4th, how could I do that without causing issues?

#

how can I migrate it.

#

Cause data was serialized and stored when the class had 3 params and now it has 4

#

any ideas?

#

or well, to spice things up, it has a new param and one of the other params changed type.

lyric gyro
#

it entirely depends on what you're using for the (de)serialisation process

tacit belfry
#

Is it cursed to use java 18 to code a 1.8.9 spigot plugin?

lyric gyro
#

does 1.8 even work with java 18?

tacit belfry
#

I found forum threads saying that it did, and apparently hypixel just updated their server to use Java 17 whilst using 1.8

lyric gyro
#

hypixel is no point of comparison

#

they have an extremely modified and custom environment

tacit belfry
#

I mean i understand that, but I was wondering because I already have java 18 and its a pain to mess with two different java versions at once

worn jasper
#

if ya wanna go specific

lyric gyro
#

oh yikes, regular java serialisation

worn jasper
#

ye

lyric gyro
#

is this running in a controlled environment / somewhere you have control of? Or is this in some public plugin many servers use?

worn jasper
#

so yes, controlled env.

lyric gyro
#

Okay yeah uh because java serialisation isn't exactly meant for storage lol, I strongly, really strongly suggest you migrate this to a proper storage system, either SQL or flat-file (json etc)
But to answer your question, changes in the constructor won't affect that because ObjectOutputStream does not call the constructor; the concern here is added/removed/renamed fields

worn jasper
#

what could I do?

lyric gyro
#

cry

worn jasper
#

😭

#

fair enough

#

so, if I add fields it will also cause issues right?

lyric gyro
#

you could migrate to a proper storage system that allows you to perform versioned migration or smth before changing the stuff you want to change

#

but that is a lot of effort with much caution

tacit belfry
#

I have an isOnCooldown() method and it returns a double, which is the current cooldown. I was wondering if it would be better to split it up into two methods, boolean isOnCooldown() and int getCooldown()

merry knoll
#

i would say yes

lyric gyro
#

isOnCooldown doesn't sound like something that would return a number, lol

icy shadow
#

unless you're using C

worn jasper
lyric gyro
#

wish you luck, lol

mystic gull
#

hello how could i get custom hex color in 1.18.2

#

i tried Chatcolor.of() but is it working for 1.18.2 too ?

lyric gyro
#

should be

fading stag
edgy lintel
#

hey guys what is usually an invalid bukkit task id

#

i assume it is something like -1

#

nvm ignore figured it out

hoary scarab
#

Anyone else having issues with spigot 1.19.1 and maven?

#
<dependency> <!-- Error here -->
    <groupId>org.spigotmc</groupId>
    <artifactId>spigot</artifactId>
    <version>1.19.1-R0.1-SNAPSHOT</version>
    <classifier>remapped-mojang</classifier>
    <scope>provided</scope>
 </dependency>
``` `Missing Artifact org.spigotmc:spigot:jar:remapped-mojang:1.19.1-R0.1-SNAPSHOT`
sterile hinge
#

Where do you get the remapped jar from?

hoary scarab
sterile hinge
#

Well

hoary scarab
#

Works lol

#

And.... it wasn't needed because the package names haven't changed 🤦

hoary scarab
#

I thought setting an armorstand as a marker was suppose to stop it from turning the name dark when inside blocks?

pulsar ferry
#

Set it on fire to fix it

hoary scarab
dense drift
#

2.7b seconds are 85 years

hoary scarab
dense drift
#

yea.. yes

hoary scarab
#

Was hoping if it was at max it wouldn't tick.

pulsar ferry
dense drift
#

ah, ticks

hoary scarab
#

Didn't fix it.

pulsar ferry
#

You sure? How are you doing it?

hoary scarab
#

nmsStand.setRemainingFireTicks(Integer.MAX_VALUE);

pulsar ferry
#

Try setFireTick

hoary scarab
#

Its an NMS entity not bukkit.

pulsar ferry
#

Ah, no clue then

hoary scarab
#

nmsStand.displayFireAnimation(); didn't work either.

dense drift
hoary scarab
#

Also if I move the armorstand into water it causes the splash particles... Whats the point of setMarker(boolean) again?

dense drift
#

smaller hitbox and probably other stuff

hoary scarab
hoary scarab
#

I did that. Doesn't work

#
nmsStand.setRemainingFireTicks(Integer.MAX_VALUE);
nmsStand.displayFireAnimation();
nmsStand.hasVisualFire = true;
nmsStand.wasOnFire = true;
dense drift
#

try with only that specific method shrug_animated

hoary scarab
#

I have

#

With all of those lol

#

Could it be a 1.19.1 issue?

quasi wigeon
#

The protocollib PacketType.Play.Server.CHAT seems to not be called on 1.19, has something be changed?

lyric gyro
#

lots of things have

quasi wigeon
lyric gyro
#

It depends

#

idk the plib names, idek if it's updated yes but now there's ClientboundSystemChatPacket and ClientboundPlayerChatPacket, the first one are system messages, like command feedback and those from plugins, the latter are messages sent by players

worn jasper
#

wait a minute

#

nothing to see here

dusky harness
#

Uhhh

#

okay I see nothing

worn jasper
broken elbow
#

haha already did

queen plank
#

What is the pattern for <RandomStringUsingAnyChars>? It has to start and end with <>

#

I tried smth like <(.)> but it doesn't match what I want it to

dense drift
#

<[^>]+> this should work, [^>] means "anything except this"

icy shadow
#

<(.+)> works too

#

i dont think you need the ^>

dense drift
#

it stops at the last >, not first

icy shadow
#

ah yeah

#

so depends what you want really

#

likely gabys one

queen plank
#

This Matcher m = Pattern.compile("<[^>]+>").matcher("<Hello> Hi"); gives me No match available

dense drift
#

yeah, if it is only alphanumeric characters, you can just use \w+

#

do you use m#find() ?

queen plank
#

It isn't I use @ n stuff in the strings

#

Ohh

#

No I did not

#

I just thought that was a method to check if there was a match or not

#

Didn't read the docs properly

#

Sry lol. Thanks 🙂

dense drift
#

nah, Pattern#matcher create a Matcher, you have to use #find() to see if it matches and to go trough the entire string while (m.find())

queen plank
#

Yeah, got it! Thank you!

#

I realised another thing lol. Is it possible to get a pattern once the <> is fully closes. Idk how to explain it, but I need to get B:<C> from a string like A:<B:<C>>. Is this possible using patterns or no?

edgy lintel
icy shadow
#

I think if you have nested <> then that's pushing the limits of context-free grammars

#

Or the limits of regexes at least, they can't be recursively defined

queen plank
#

K lol, I guess I'll make a function for it

icy shadow
#

Sorry not context-free

dusky harness
#

I think the only way to use regex with this is to just have a long regex

#

for each one inside

#

(each one inside possible)

icy shadow
#

For arbitrarily deep nesting it's impossible dkim

queen plank
dusky harness
icy shadow
#

the inside doesn't matter

#

Maybe I'm misunderstanding what you're describing

dusky harness
#

I mean anyways you can't have an infinite amount or as you said recursively defined so I'd just make my own method

queen plank
#

Yup, guess I'll have to. Thanks tho :>

icy shadow
# dusky harness wdym

Let's say you have a list syntax [1, 2, 3] and you want to parse lists of lists [[1], 2, [[3], [4]]]
This is impossible to parse reliably with a regex because it would involve a recursive definition

dusky harness
#

although not infinitely

icy shadow
#

not infinitely yeah

#

And it would be very difficult to do even with 2 levels of nesting

dusky harness
#

well for example

#
\w(:<\w(:<\w(:<\w(:<\w(:<\w(:<\w(:<\w(:<\w>|)>|)>|)>|)>|)>|)>|)>|)
```this works (just using letters)
#

for 9 letters

#

(I'd still make my own method but I'm just showing an example)

queen plank
#

It literally could not have been easier :>```java
private static String getBonus(String string) {
int index = string.indexOf('<');
if (index == -1)
return null;
int open = 1;
string = string.substring(index + 1);
for (int i = 0; i < string.length(); i++) {
if (string.charAt(i) == '<')
open++;
else if (string.charAt(i) == '>')
open--;
if (open == 0)
return string.substring(index, i);
}
return null;
}

sterile hinge
#

yeah regular expressions cannot validate bracketing

#

also regex is ugly

broken elbow
queen plank
#

That is what I want 🙂

#

Otherwise the string is faulty and it should throw an error (return null)

broken elbow
#

alright. just making sure

#

I didn't read the whole conversation

queen plank
#

I didn't mention it before. But thanks for mentioning it :>

worn jasper
#

Is there any way to retrieve the texture of a head with a texture? (aka, get the head in my hand and return it's texture)

dense drift
#
        val owner = NBTItem(this).getCompound("SkullOwner") ?: return ""
        return owner.getCompound("Properties").getCompoundList("textures")[0].getString("Value")```
#

basically the texture base64 string is located at SkullOwner.Properties.textures[0].Value

lyric gyro
#

or use the profile API :D

queen plank
#

Ppls with premium spigot resource development, when uploading the plugin. It says to use the Email for payments, that is the mail you used to sign up for paypal, right? I know this is a stupid question, but I really don't wanna get it wrong :V

dense drift
#

if you are talking about something from paper, I can't

lyric gyro
#

a) maybe afonso is
b) spigot added (a bare-bones) profile api recently

dense drift
#

a) fair

worn jasper
#

who th uses spigot api?

#

🤢

lyric gyro
#

Gaby aPES_Laugh

worn jasper
#

paper api » ALL

lyric gyro
#

true

worn jasper
lyric gyro
worn jasper
#

also

#

I added Skulls as a soft-dependency, but apparently it requires something else?

dense drift
dense drift
#

is a public plugin smh