#development

1 messages · Page 72 of 1

proud pebble
#

something is null there

forest jay
#

I got the latest dev build and it works fine

proud pebble
#

ah yes, the fabled not using the dev build issue because plib decided that it wont update on spigot u till the bext version exist, so it doesnt update to 1.20.4 on the spigot page till 1.20.5 comes out such fun

forest jay
#

it isnt even updated for 1.20

proud pebble
#

ah it doesnt update till the next major version

queen plank
#

I merged 2 git branches recently and think I've broke something. I get this now, any idea why? I'm 100% sure I have the class in the project.

00:50:08] [Server thread/ERROR]: Could not load 'plugins\Helix-2.2.2.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `com.sniskus.helix.Helix'

#

My project is just compiling to 3KB now 💀. It's usually 1.5MB

dusky harness
queen plank
tiny merlin
#

Any Linux ( using CachyOS, a Arch fork) nerds here? Need some help with Graphics Drivers

queen plank
#

Yet another question lol. Why do these not get replaced?

public static final String USER = "%%__USER__%%";
public static final String RESOURCE = "%%__RESOURCE__%%";
public static final String NONCE = "%%__NONCE__%%";
#

They still appear as %%__USER__%% etc

dusky harness
queen plank
#

Indeed

dusky harness
#

hm

queen plank
#

I just get this in my console Licensed to %%__USER__%%. It is set with String#formatted if that would make a difference, which I doubt but still idk.

dusky harness
queen plank
#

You have to be a buyer for it to work. If you download your own plugin it will not get parsed. smh

#

Well that solves that

#

Thanks lol

gusty trout
#
Bukkit.broadcastMessage(players.toString()+"hi");
players.remove(victim);
Bukkit.broadcastMessage(String.valueOf(victim));
Bukkit.broadcastMessage(players.toString()+"serf");```
Why doesn't the victim get removed?
#

Everything other than the first line doesn't even run
but if I remove the 2nd line the other lines are fine

queen plank
gusty trout
#

No errors I could see but I forgot to check console

#

That’s the code

#

Since I can’t send files here

queen plank
#

And any errors? There should be. Code can’t just stop executing itself without reason

gusty trout
#

Not home rn when I get back I’ll check console

gusty trout
#

can I type here yet discord?

#

wooo its fixed

broken elbow
#

How does Spigot parse commands? To me, it seems that it splits at spaces and ignores any empty values. So something like command.split("\\s+"); and ignoring the first element if it is empty. Am I right here? I couldn't find the code for this.

river solstice
broken elbow
river solstice
#

on interact event listener -> check if its the specific block/npc/whatever -> send message

#

no thanks needed

broken elbow
river solstice
#

no

queen plank
forest jay
#

Anyone know why my IDE says EntityMountEvent is a thing but when loaded into paper it says it doesnt exist? My versions match.

sterile hinge
#

doesn't sound like versions actually match

forest jay
#

I googled it, ig its cause I am importing spigot yet running on a paper server

#

and paper has a different event

#

so yeah...

sterile hinge
#

paper doesn't have a different event there?

#

what are you doing exactly

forest jay
#

literally just ```java
@EventListener
public void onMount(EntityMountEvent event) {}

sterile hinge
#

what's the fully qualified name of the event?

#

and what's the exception?

#

and what's the build you're running?

forest jay
#

it doesnt matter

#

VehicleEnterEvent works

sterile hinge
#

bruh

light pendant
#

Hi everyone! I once again had an issue with gradle related to using paper-api while compiling for java 8. Setting the toolchain to java 8 results in this annoying message:

#

Now ofc I tried to set the toolchain to 17 but set source and target to java 8, which doesn't work, because the toolchain sets the -release flag.

river solstice
#

i dont think u can use j8 target/source since paper 1.17 or something

light pendant
#

HOWEVER, I noticed that I am lucky, as my project is written entirely in kotlin, and I was able to convince gradle to ignore its stupid limitations on using different source/target and actual JDK, as it seems. I have set my build.gradle up like this:

tasks.withType<JavaCompile> {
    javaCompiler.set(javaToolchains.compilerFor {
        languageVersion.set(JavaLanguageVersion.of(17))
    })
}

tasks.withType<KotlinCompile>().configureEach {
    this.jvmTargetValidationMode = JvmTargetValidationMode.IGNORE
}

the toolchain for kotlin is set to 8 though

#

and it seems to be working???

light pendant
dusky harness
#

why are you even setting it to java 8? 🥲

#

1.20.4 requires java 17 anyways

light pendant
dusky harness
#

why is it using 1.20 dependency then 🤨

light pendant
#

well I need 1.19.4 API when the server is running 1.19.4+

#

or whenever display entities were added

dusky harness
#

oh

light pendant
#

if it's running 1.16.5 I will never encounter display entities so it's no problem

#

(at least I don't have to deal with 1.8)

gusty trout
atomic trail
#

I want to update placeholders on the item, which isn't an issue but not sure how it should be done here

pulsar ferry
#

ItemBuilder.from(item).build() on the updateItem, you want to update just the itemstack

atomic trail
pulsar ferry
#

Or well, updateItem(slot, item)

#

Nope

atomic trail
#

Ah nice, thanks!

#

So that's the only difference between setItem and updateItem?

#

That it doesnt override the event?

pulsar ferry
#

setItem takes only a gui item and only updates when you call update to update the entire gui
While updateItem immediately updates an item or the item's itemstack

worn jasper
pulsar ferry
worn jasper
#

oh ok

atomic trail
royal hedge
#

and it calls Player::updateInventory for all viewers but idk what that does

haughty cipher
#

Hello everyone! Currently, I am looking for a developer who would be interested and available to write a plugin for us. In essence, it shouldn't be too difficult as it only involves the following: A chest (added through ItemsAdder) that can be randomly found every 4000 blocks in a specific world. These chests spawn randomly on the ground and visually stand out due to the pre-existing texture that we have and will be added thrue Itemsadder as well. When opened, an inventory should appear containing three types of rewards. In the second row of the 27 slots, a specific item (ItemsAdder) should be found at positions [3] (so 12), [5] (so 14), and [7] (so 16) Slot, always the same. The first contains an item from AdvancedEnchantments (only place the item inside, the rest is handled by other plugins). The second adds experience points to the player from Alonsolevels when clicked (via command solution), and the third is a command run from the plugin named "coins" (/coins drop @nearplayer 100). After everything has been clicked, the chest should automatically disappear immediately.
Would love to hear from a Dev! I will pay for it as well, if its working correctly! Thanks! ❤️ (I dont know where to ask, so if you know a place, please let me know!)

robust crow
haughty cipher
#

Thanks!

floral coral
#

hi. there is a library called SlimJar which loads external libraries in runtime. I would like to know how can I implement this into my program and make it work?
I've tried using it, but It's little bit confusing for me, so help would be appreciated!

    @SneakyThrows
    public static void main(String[] args) {

        val libsPath = new File(".", "libraries");
        if (!libsPath.exists()) if (!libsPath.mkdir()) {
            log.error("[ERROR] Failed to create libraries folder.");
            return;
        }

        val url = new URI(SimpleMirrorSelector.ALT_CENTRAL_URL).toURL();
        ApplicationBuilder.appending("MyApplication")
                .downloadDirectoryPath(libsPath.toPath())
                .mirrorSelector((a, b) -> a)
                .internalRepositories(Collections.singleton(new Repository(url)))
                .build();
        // ...
    }

Stacktrace: https://pastes.dev/XvlMoolHHY

deep ravine
#

hello, do you know how to make deluxe menu remove a non-vanilla item from a players inventory?

spiral prairie
#

Remove the try catch altogether

hoary scarab
spiral prairie
#

Can you send the error?

hoary scarab
#

When I get back on PC.

It's IllegalArgumentException: wrong amount of arguments

Stems from the invoke method from reflect. But I don't understand why the line that causes the error, when enclosed in a try catch, doesn't invoke the catch portion.

spiral prairie
#

Can you send the whole error

hoary scarab
#

When I get back on PC.

spiral prairie
#

Oh

#

I thought you edited the original msg to add it once you got back on pc

hoary scarab
#

Nah changed "causes the method" to "causes the error"

I'm trying to get the error to happen now. Like I said though its rare so I have to keep restarting the server until it occurs.

dusky harness
#

If you're on 1.17 or above tho I'd use spigot libraries

floral coral
pulsar ferry
#

If only the authors would revive the lib 😔

dense drift
floral coral
pulsar ferry
#

Just joking because it was a friend and I who made it

floral coral
#

really?

#

you made SlimJar?!

pulsar ferry
#

Yesm, but we haven't had time to update it

hoary scarab
#

🤦 Multi methods with the same name CraftChatMessage.fromStringOrNull(String) & CraftChatMessage.fromStringOrNull(String, boolean)

floral coral
#

so you definitely know how can I use it right?

dense drift
ocean crow
neat pierBOT
#
Possible Solution Found:

Your plugin / expansion shade PlaceholderAPI. Here's how to fix that:

  • For Maven, set <scope> to provided
  • For Gradle, use compileOnly instead of implementation
tepid ridge
queen plank
#

I'm trying to figure this spigot library loader out. This is my plugins.yml. Though despite that the console appears to be importing the correct dependencies it is not working correctly. My Reflections code has just stopped working? It can create an instance without problem but it does not find classes as it used to, I'm using Reflections#getSubTypesOf(Class).

#

Previously it found a bunch of classes, now 0

rugged bane
queen plank
rugged bane
queen plank
#

Yup. groupId:artifactId:version

rugged bane
#

Thank you, so cool to have this

queen plank
#

It's great. My plugin was like 7MB before lol. Just import everything with this now and it shrunk to like 700KB xd

rugged bane
#

Omg 😂 my jar is around 3mb at the moment, it would massively reduce mine.

sterile hinge
queen plank
sterile hinge
#

yeah when shaded it's loaded by the same classloader

dusky harness
#

spigot libraries have like a thing where plugins that depend on your plugin can use your libraries or smth

#

which might be why it has a diff classloader

#

but i know nothing about classloaders

sterile hinge
#

also 300+ subtypes of a class 💀

queen plank
sterile hinge
#

probably, but it's still an ugly hack

queen plank
sterile hinge
#

good

queen plank
queen plank
queen plank
sterile hinge
#

heard of many people thinking they have "good reasons"

sterile hinge
#

or generate code that registers them

#

so many options

queen plank
queen plank
sterile hinge
#

I mean if you already have an annotation on all of those types, that should be pretty simple

queen plank
#

I do. Just don't know a better way than doing reflections via sub types or annotation lol

sterile hinge
#

just use an annotation processor to generate a source file that registers all of the classes, and call that generated file from one point in your plugin

#

to generate code you can use something like spoon or javapoet

queen plank
#

That seems like a hassle compared to ```java
Reflections reflections = new Reflections(this);
reflections.getSubTypes("com.sniskus.helix", ComponentType.class).forEach(TypeRegistry::register);

#

Btw. Is my reason for 300 classes good enough lol?

sterile hinge
sterile hinge
queen plank
queen plank
hoary scarab
#

Is there a method to collect an entities equipment to be used in the PacketPlayOutEntityEquipment packet?
I see getItemBySlot() but its individual items.

The packet requires List<Pair<EnumItemSlot, ItemStack>> Just hoping I don't have to build the list myself.

minor summit
#

if you need all slots, loop over the enum's values

#

but, there is API for that, just sayin

#

Player.sendEquipmentChange I believe

robust crow
#

This channel is for development support not config help as per the channel topic

serene timber
#

ok ty

broken elbow
#

I have the following HTML template (with TailwindCSS):

<body class="min-h-screen min-w-full flex flex-col">
  <header></header>
  <main class="flex-1 grid grid-cols-3">
    <section class="col-span-1 max-h-screen min-h-[40rem] overflow-y-scroll overscroll-auto">Projects</section>
    <section class="col-span-2 max-h-screen min-h-[40rem]">Projects Overview</section>
  </main>
  <footer></footer>
</body>

What I want to achieve is make the sections have a height of 40rem but if the height of the screen is higher, make it take up the entire space remaining. The problem with max-h-screen is that I have a header and a footer that it doesn't account for so the page ends up taking more than the screen.

(don't mind the data 😄. it is generated using a faker library)

EDIT: After many retries with ChatGPT, I've found a solution that in my tests seems to work:

<body class="h-screen w-full flex flex-col">
  <header></header>
  <main class="flex-1 grid grid-cols-3">
    <section class="col-span-1 max-h-screen overflow-y-scroll overscroll-auto"><div class="h-[40rem] flex-grow">Projects</div></section>
    <section class="col-span-2 max-h-screen"><div class="h-[40rem] flex-grow">Projects Overview</div></section>
  </main>
  <footer></footer>
</body>

Do I understand all the changes and why they were made? Absolutely NOT! Do I have the patience to try and figure it out? Absolutely NOT! But at least it works :))

river solstice
#

so, the server code for the lore for attack-damage and speed is here

#

yet when I modify the base value of the attribute, the lore wont change

#

any ideas?

#

checked via /attribute command, it is applied correctly.

dense drift
#

You probably have to add a new attribute instead of modifying the exiting ones

river solstice
#

the attack speed, well, works

#

if base is modified

#

but not attack damage

#

mc spaghetti code strikes again

dense drift
river solstice
#

well, attack speed says that too

#

/attribute M0dii minecraft:generic.attack_speed base set 0

#

but it does modify the lore

dense drift
#

Interesting

atomic trail
sterile hinge
#

I mean that's most likely not what you want the serialization format to look like

#

gson doesn't know how to serialize it for you, it just tries its best

#

in that case, that means calling toString on the keys

dense drift
sterile hinge
#

you probably want to seralize a list of entries

dense drift
#

that's probably a better idea, yeah, it will probably look like this I think

[
  {
    "key": { SettingIdentifier object },
    "value": { PlotSetting object }
  }
]```
atomic trail
#

Ah yeah that's probably a better idea

#

Can I just call plot.getSettings().entrySet() u think?

dense drift
#

Try and see

atomic trail
#

It just serializes them as empty sadly

sterile hinge
#

just write a custom type adapter I guess

atomic trail
dense drift
#

what does the output look like?

atomic trail
dense drift
#

Interesting

atomic trail
#

Wait I'm actually kinda dumb tho lol

#

Or idk

#

PlotSetting has an instance of SettingIdentifier, which is also the key

#

So it's kinda stored twice

dense drift
#

yeah I was about to say xD

atomic trail
#

Should I make it a set instead? The issue is just it will be slower to make lookups

dense drift
#

I would make it smth like Map<MemberType, Set<SettingType>> and keep in the set only the settings they have access to

atomic trail
#

Yeah true, that's actually a good idea

#

My current structure is so bad lmao

dense drift
#

one problem at a time 😆

dense drift
#

Try to use adventure if you can, bungee chat api is shit

#

If you must use it ... try &xFFF000 or &x&F&F&F&0&0&0

solemn seal
#

what is adventure?

solemn seal
dense drift
#

basically the standard nowadays

river solstice
solemn seal
#

no way I'd have to go outside to do that

hoary scarab
# minor summit Player.sendEquipmentChange I believe

I'll keep it in mind. However since I'm doing packet based entities I would need api methods for all the needed packets (Spawn, Destroy, EntityData, Teleport, Armor, Move etc...). Otherwise its just easier to construct the packets myself.

queen plank
#

I want to create a function like this: foo -> foo.bar(baz.get());. However I don't want it to call baz.get() when I create it. Is this possible somehow? I only want to call it when the function itself is ran.

#

Bruh I'm dumb

sterile hinge
#

it won't get called when the function is created

queen plank
#

I realised 💀 I thought it did since I thought the only time the baz.get() would crash is if it is called when created. Turns out my code sucks and it crashes when the function is ran lmao

atomic trail
#

What's the easiest way to add a cooldown for a command? Or what would you guys recommend? Is there some kind of map or class made for it already? Or should I just add some Map<UUID, int> with the value as time remaining

dense drift
#

That will do the job

atomic trail
#

It will indeed, but would be nice if I didn't have to manually handle a runnable for it

torpid raft
#

and then if another attempt is made, just check then if it is allowed based on the previous timestamp

#

this way you can avoid constantly deleting old entries from the map

atomic trail
#

Very true, is comparing time stamp faster or slower than using a runnable u think?

torpid raft
#

i think the performance impact will probably be negligible either way

atomic trail
#

True but still

torpid raft
#

but if anything comparing the timestamp is probably better tbh

dense drift
#

well, when they execute the command you still need to check if they are on cooldown or not

atomic trail
#

Just trying to optimize performance wherever I can

dense drift
#

if you really insist to delete expired cooldowns, you can try to use a Cache from guava

torpid raft
atomic trail
#

I could actually have the Map<UUID, Timestamp> where the time will be for example 1 minute in the future, for faster checks

#

I think? lol

torpid raft
#

if you want you can do that sure

#

again i think at this rate it's really not going to make any difference

#

just do the thing that seems the least complicated / confusing to you

dense drift
#

Someone else made some calculations a while ago and like 1M doubles are a few mb or something

atomic trail
#

Yeah ik, but I hate using code that can be optimized even if the difference is negligible

torpid raft
#

you better start hand writing bytecode then

#

gotta get every last bit of performance amirite

dense drift
#

sparkle_green don't optimise prematurely sparkle_red

pulsar ferry
#

<UUID, Instant> and use Instant.now() or <UUID, Long> and use System.currentTimeMillis()

#

Instant is nice because of all the utility methods it has

torpid raft
#

i usually system.currentTimeMilis but idk the tradeoffs of it vs instant

dense drift
#

I usually store the expiration time and I just do if currentms < expiration then still on cooldown

pulsar ferry
atomic trail
#

I'll use this resetCooldowns.put(player.getUniqueId(), Instant.now().plus(1, ChronoUnit.MINUTES));

And then check isAfter() before running the command

torpid raft
#

looks good

pulsar ferry
#

Uh, shouldn't you be storing Instant.now() then checking later? With that you're storing the time they ran the command plus 1 minute

#

So one minute after they ran it

torpid raft
#

yeah he's doing what gaby is talkin about

dense drift
#

ig the command has an 1m cooldown

torpid raft
#

storing the expiry time

river solstice
#

works both ways

torpid raft
#

i do agree that storing the current time is a bit more convenient / understandable though, at least imo

river solstice
#

true that

torpid raft
#

especially if you want to juggle multiple abilities on the same global cooldown or something

river solstice
#

usually people store the time the X was used

dense drift
#

yeah

atomic trail
#

How would I check the amount of time between two Instants? There's compareTo but that won't really help I think?

#

But yeah storing the time when it was executed might make more sense

It will be slower though, because I have to add 1 minute every time the command is called to check, instead of just isAfter, but yeah kinda no difference

torpid raft
#

matt mentioned Duration.between

atomic trail
#

Ah yeah I see

#

Thanks :))

torpid raft
#

ofc

dark garnet
#

hi, im trying to adjust Statistic#TIME_SINCE_REST for players so that phantoms cant spawn
whats the best way/duration to check & update? unfortunately PlayerStatisticIncrementEvent doesnt fire for it as its too frequent

#

or, would just staying with my current method be better/more cost efficient:

@EventHandler
public void onCreatureSpawn(@NotNull CreatureSpawnEvent event) {
    final Entity entity = event.getEntity();
    // Check if Phantom
    if (entity.getType() == EntityType.PHANTOM
            // Check if natural spawn
            && event.getSpawnReason() == CreatureSpawnEvent.SpawnReason.NATURAL
            // Check if any nearby players have phantoms disabled TODO: Find a better way to do this
            && entity.getNearbyEntities(10, 35, 10).stream().anyMatch(nearby -> nearby instanceof Player && new EntityData(plugin, nearby).has(PersonalPhantoms.KEY))) event.setCancelled(true);
}
```*`new EntityData(plugin, nearby).has(PersonalPhantoms.KEY)` checks if player contains a specific PDS key, however in the future its going to be using SQL*
stuck canopy
#

What is wrong with paper-plugin.yml. I can't register command for some reason

dense drift
#

Btw srnyx there is a gamerule to disable phantoms at all if thats what you want to do

dark garnet
dense drift
#

Yeah, but at least you have a more direct approach for paper xD

dark garnet
#

true

#

do u know of a good example of a plugin that supports spigot but uses paper methods?

dense drift
#

if (server is running paper) register paper listener
else register spigot listener

dark garnet
#

TRUE

dense drift
#

There is PaperLib, made by the paper team, if you need stuff like async teleports. They have a method to check if the server is running paper, which just checks if the PaperConfig class exists shrug

dark garnet
#

👍 ty

dense drift
dark garnet
#

yeye ty

dense drift
#

Regarding your question, I would set TIME_SINCE_REST to 0 on join and when they activate the option (if that's possible) and then set it to 0 every x minutes or so shrug, that might not even be needed if you can do it the first two times

dark garnet
dense drift
#

Ahh, yeah, for some reason I was thinking about 3 irl days, not in game days

dark garnet
#

lmao

dense drift
#

By doing that you dont event need to use the paper event

dark garnet
dense drift
#

You know how often needs to be set to 0

#

Is just a method that loops over all online players and sets a statistic to 0

dark garnet
#

well itd have to check if player has phantoms disabled first

dense drift
#

Ye, just use a single runnable

#

Is not some heavy task

#

Im off to sleep, have fun sleep_zzz

dark garnet
dense drift
#

On the loop you can do all the checks you need

dark garnet
#

👍

#

would that take less resources than my current method?

dense drift
#

Most likely

river solstice
#

yeah you dont need a runnable for each player lol

#

at some point that would make it worse than having a single one

atomic trail
#

Wait what streams are slower than normal for each etc?

icy shadow
#

yes

#

they kinda have to be

atomic trail
#

How come?

icy shadow
#

even if they were literally just an object wrapper around a loop there's still the overhead of creating that object

icy shadow
icy shadow
#

they can be faster than loops for a lot of data

sterile hinge
#

typically the JIT will have a harder time optimizing streams than optimizing loops

icy shadow
#

and for small amounts of data it's usually not a big enough difference to matter

#

^^ this too

atomic trail
#

Alright so it's still good to use lol

#

I just think it looks nicer and is easier to use

icy shadow
#

yeah i mean

#

my philosophy is usually just use whatever is easiest/most readable and then optimise later if necessary

#

i say "my philosophy" as if that's super unique lol, that's how most software development works lol

atomic trail
#

I see, but in the case of minecraft plugins, isn't performance almost always the most important thing?

dense drift
#

If you loop over a list with 100 elements, you won't even see the difference shrug

dense drift
#

0.05s or 0.06s (made up numbers) is the same thing

icy shadow
#

because good design also makes optimising easier

merry knoll
icy shadow
#

true...

atomic trail
#

I think I focus a lot on optimizing too much lol

dense drift
#

do any streams get turned into for loops by the compiler? Like simple ones collection.stream().anyMatch(x -> x > y)

icy shadow
#

unlikely

#

well

#

definitely not AOT

#

javac does basically no optimisations

#

except extremely stuff like constant folding

icy shadow
sterile hinge
#

the problem is that the stream api is pretty heavy in terms of types and methods, so to really reduce it to a loop would require much inlining and type analysis first

dense drift
#

fair enough, I was just curious what sort of optimization is done for streams blobSalute

sterile hinge
#

and it also depends on the stream source

icy shadow
#

unless you were to hardcode some rewrite rules for the stream api in particular

dense drift
#

I see

atomic trail
#

Got a very simple question that I should probably know the answer to lol

        InteractableItem finalTemplate = enchantTemplate;
        if(!(enchant instanceof ProccEnchant)) {
            List<Component> newLore = new ArrayList<>(enchantTemplate.getLore());
            newLore.removeIf(c -> MiniMessage.miniMessage().serialize(c).contains("chance"));
            finalTemplate.setLore(newLore);
        }

        return finalTemplate;

Does this also change the lore in the enchantTemplate instance? Or is finalTemplate made as a copy of enchantTemplate? Because that's what I want to do

sterile hinge
#

both variables reference the same object

icy shadow
#

pass by value moment

#

objects are always references

atomic trail
#

So I need to make some InteractableItem.copyOf() method right?

sterile hinge
#

I guess

#

(insert immutability ad here)

atomic trail
#

It was immutable before, but ran into issues with the constructors lol

river solstice
#

i have only seen like 10 for loops at my work codebase of like 100k+ lines of code

#

though we mostly handle 1000s of data

atomic trail
#

Yeah this fixed it

    public static InteractableItem copyOf(InteractableItem other) {
        List<String> lore = other.getLore().stream().map(line -> MiniMessage.miniMessage().serialize(line)).toList();
        return new InteractableItem(other.getMaterial(), other.getName(), lore, other.getLocation());
    }
river solstice
#
return a.stream()
    .map()
    .blah()
    ...

is way cleaner than

var list = new ArrayList<>();

for (x : otherList) {
  ...
}

return list;
icy shadow
#

you are lying

torpid raft
#

i am lion

river solstice
graceful hedge
#

Crazy

true aspen
#

java.lang.NullPointerException: Cannot invoke "me.clip.placeholderapi.PlaceholderAPIPlugin.getLocalExpansionManager()" because the return value of "me.clip.placeholderapi.expansion.PlaceholderExpansion.getPlaceholderAPI()" is null

neat pierBOT
true aspen
#

lol havent noticed that

#

thought i changed it to compileonly

minor summit
fading basalt
#

hello, would someone please send me a basic menu? to the deluxe menu

minor summit
#

no

unborn ivy
#

Anyone know what the best way is to cancel fireball interaction? Tried EntityDamageByEntityEvent and it doesnt work

dusky harness
unborn ivy
dusky harness
#

oh you mean that kind of interaction

#

playerinteractevent also supports left click though

#

but

#

theres like playerinteractatentityevent or smth

unborn ivy
#

how am i going to detect if the player has interacted with a fireball with just the click actions

tight junco
#

ItemStack#getType == Fireball

unborn ivy
#

and not an itemstack

tight junco
#

oh then

#

its either PlayerInteractAtEntityEvent checking entitytype or potentially entitydamagebyentityevent

unborn ivy
#

dont think there are such methods

unborn ivy
#

entitydamagebyentityevent doesnt work either ive tried

tight junco
#

event.getRightClicked().getType()

unborn ivy
#

fireballs are not deflected with right click...

tight junco
#

welcome to spigot!

#

getAction may work

unborn ivy
#

that method is only in the PlayerInteractEvent

#

and no it wont work

#

getAction is just to get the action of what the players doing, like left click right click etc

#

but you cant get any entities from that

tight junco
#

well, spigot momento

#

EntityDamageByEntityEvent seems to work

minor summit
#

lol

unborn ivy
# tight junco

I dont know, i have the event cancelled but the fireball is still deflected

river solstice
#

@dusty frost @rugged bane any of yall have used nginx for laravel?
I'm trying to serve my page from a different route but it doesn't seem to work.

What I want to achieve is:
My project dir is, ex. /var/www/html/myproject and build dir is /var/www/html/myproject/public.

I have a subdomain mysub.domain.com.

I want to serve that project from:
mysub.domain.com/myproject
and all the other routes to be handled mysub.domain.com/myproject/home, etc.

Been fiddling around with apache, got tired, tried with nginx, no luck.
Mainly getting FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream - File not found, 500 or 403's lol

rugged bane
#

Laravel doesn’t like sub folder routing

dusty frost
#

Then that way it's invisible to Larvel that it's in a subfolder, besides the root url being prefixed or whatever

#

and + nginx isn't so directly tied into your app, it is just doing its job as a general reverse proxy

#
  # sub_directory
  location ^~ /sub_directory {  
      alias /var/www/choppies/sub_directory/public;  
      try_files $uri $uri/ @sub_directory;  

      location ~ \.php {  
          include snippets/fastcgi-php.conf;
          fastcgi_pass unix:/run/php/php7.0-fpm.sock; 
          fastcgi_param SCRIPT_FILENAME /var/www/choppies/sub_directory/public/index.php;
      }  
  }  

  location @sub_directory {
      rewrite /sub_directory/(.*)$ /sub_directory/index.php?/$1 last;  
  }
  # end sub_directory```
#

This looks like your best bet if you want to use fastcgi and nginx directly

#

obvs change the file locations and everything

river solstice
river solstice
#

this is pain

river solstice
dusty frost
#

fastcgi_param SCRIPT_FILENAME /var/www/choppies/sub_directory/public/index.php; this line is probably the most important to you

#

if you're getting "Primary script unknown" and everything

river solstice
#

I mean it seems to kinda work, but

river solstice
#

lovely

atomic trail
#

Completely new to kotlin, what happens if the null safe call is used ?. and the object is null?

#

Is the method just not called?

spiral prairie
#

yep

atomic trail
#

Like

if(object != null) {
  object.callMethod()
}
spiral prairie
#

if you do val thing = otherThing?.someProp?.someStuff

#

thing is null when otherThing, someProp or someStuff is null, without throwing any NPEs

atomic trail
#

Yeah makes sense, thanks!

spiral prairie
#

np

atomic trail
#

That's actually a nice feature

#

Wait so Kotlin doesn't have NPEs at all?

#

Looks like it can't compile instead of just giving a warning

spiral prairie
#

or some similar syntax

atomic trail
#

Ahhh I see

spiral prairie
#

you're doing that with methods or

atomic trail
#

Isn't this isOnline call a bit redundant? recipient is just an OfflinePlayer

        if(recipient.isOnline) {
            recipient.player?.sendMessage(

But if this is called on an offline player, isn't it just null? recipient.player

spiral prairie
#

should be

icy shadow
merry knoll
#

but if you manage it properly its compile time

atomic trail
#

Or idk, it kinda makes it more difficult to debug imo

atomic trail
merry knoll
#

for example

val obj: Object?

obj?.let {
it.foo()

}

atomic trail
broken elbow
#

the opposite. if obj is not null, it will do everything between {}

#

and you can get the non null obj as it

pulsar ferry
#

That example isn't very good because it'd be the same as obj?.foo()

#

let would be more useful for things like

obj?.let {
  println(it)
}

Basically print if not null

dusky harness
#

obj?.let(::println) 😌

pulsar ferry
icy shadow
fading stag
merry knoll
fading stag
#

Yes, with a message that is a lot easier to debug (for me)

merry knoll
merry knoll
#

anyone worked with folia schedulers? if yes can i get a dm? dont want to spam here

pulsar ferry
#

This channel's entire point is to talk about that sorta stuff

merry knoll
#

alright: im making a small wrapper for the folia schedulers so i can use suspend functions
looking through couple libs people made i saw "force waking" of schedulers on enable

#

are they not enabled by then? or is it just redundant

worn jasper
#

Doesn't PaperLib support this?

merry knoll
#

im assuming the region ticking is not started by then or something, but testing is a bit inconclusive

worn jasper
#

FoliaLib*

merry knoll
#
suspend fun foo() {
    runTask {
        // this is now global scheduler
        runTask(location) {
            // this is now region scheduler
        }
    }
}
#

im doing something like this currently to make it a bit easier for myself, didnt find anything similiar

cloud panther
#

hey can someone ping me with an answer, why would a skeletons helmet randomly break

is it sunlight ?

terse osprey
cloud panther
#

ok, in 1.8.8 i can't set the armour to unbreakable so i set it to 32000 but even that wouldn't stop the helmet from popping

terse osprey
merry knoll
#

get the meta, set unbreakable flag

#

its meta.spigot().setUnbreakable() afaik

#

on 1.8

cloud panther
fading stag
#

Is it possible to make player see like that (red lines at bottom and top) with or without server resource pack? https://imgur.com/a/fo4efzE

dusky harness
#

red?

pulsar ferry
#

With yes, without probably not

#

And yeah, red? :')

ocean raptor
#

dont give this guy drivers license

shell moon
#

What do you guys think? A punishment plugin should listen to chat event with LOWEST/LOW priority in order to cancel the message as soon as it's sent before other plugins can listen to it, right? Or it's correct that it uses HIGHEST? I mean, otherwise all plugins listening to NORMAL or even HIGH will ignore "muted" players, what do you think?

merry knoll
shell moon
#

What about chat games, if they listen to NORMAL priority to act, how would muted players be handled if you dont want them to participate?

merry knoll
#

you could listen to both lowest and highest then

#

lowest to cancel early for other plugins

#

and highest to make sure it stays cancelled

#

in case another plugin is breaking convention and ignores cancelled/uncancels

shell moon
#

what about plugins that "cancel" chat event to send json formatted chat

merry knoll
#

if already cancelled and they are not listening to cancelled events

#

lowest covers it already

shell moon
#

i mean, for plain chat plugins, they just setFormat and setMessage

merry knoll
shell moon
#

what about the plugins that cancel the event and send a json/minimessage message to add hover to chat

merry knoll
#

their events wont fire if you cancel on lowest

#

unless they are listening to cancelled events

#

in which case why

shell moon
#

i know, but even if they "cancel" the muted player message

#

the plugin that cancel the event and sends the message would still send the json message

merry knoll
#

you are the one cancelling

#

not them

#

lowest hits - event is cancelled - json plugin is listening on normal - skips json plugin

#

they would have to be ignoring cancelled

shell moon
#

idk if you dont get my question

#

or im dumb

merry knoll
#

lowest fires first, highest last

#

so if your plugin listens to lowest and cancels a message

#

anything after that is not "ignoreCancelled = true" will not see the event firing

shell moon
#

yes, you didnt get my question

merry knoll
#

which they should be

ocean raptor
#

that plugins listener shouldn't even trigger at that point

merry knoll
#

cancelling on lowest will cover your case

ocean raptor
#

since you came first and cancelled the event

merry knoll
#

if you wanna be uber safe, cancel the message packet

#

and no event will fire

#

but honestly its overkill

ocean raptor
#

doesn't worth the effort imo

#

lowest should cover almost every plugin

shell moon
#

libertybans and advancedbans cancel muted players messages with HIGHEST
but my chat plugin (listening to NORMAL), ofccourse cancel the event too, but to send the formatted messages to all recipents
since muted player message is "cancelled" in HIGHEST, and my plugin listen to NORMAL, my messages will alwasy be sent, even when player is muted
so the question is, what should be done?

  1. Change my priority to MONITOR so the ban plugin cancels it first and then i check if cancelled or not
  2. i have no clue
merry knoll
#

MONITOR = fires last

#

and should not be used to mutate the event

shell moon
#

man, i know the order

#

did you read my question

merry knoll
#

ah, now i get it you are making the chat plugin

#

and not the ban plugin

#
  1. Change my priority to MONITOR so the ban plugin cancels it first and then i check if cancelled or not
#

this is the only way in that case

#

but its quite bad practice

#

as your plugin will mess with anything that actually monitors the event

shell moon
#

thats what i meant

hoary scarab
#

Lowest would be seen first.

shell moon
merry knoll
#

i dont think there is an order to which plugin fires first

#

while they are the same prio

hoary scarab
#

If it's same priority, it's based by dependencies then ABC order.

shell moon
#

let's add as soft-depend all ban plugins

merry knoll
tight junco
#

starting my plugin name with AAAAAAAAAAAAAAA to ensure priority

shell moon
dusky harness
shell moon
#

damn

merry knoll
tight junco
#

had to make sure i didnt get got by barry

hoary scarab
#

Do you want it ran last or first? If you depend it will run after the dependencies.

dusky harness
#

chat moderation plugins using HIGHEST for some reason so chat plugin doesn't know if it's cancelled or not unless it uses MONITOR

merry knoll
#

soft-depending to edge cases probably the "good practice"

hoary scarab
#

I mean I think there is "loadafter" option but if other plugins use it too, it's the same issue.

merry knoll
#

or just go monitor and not care

shell moon
#

soft-depend: ["AdvancedBans","LibertyBans","LiteBans","UltraPunishments","Essentials","¿CMI?","SomeRandomMutePlugin"]

tight junco
#

essentials

shell moon
tight junco
#

my favourite ban plugin

dusky harness
shell moon
#

most likely, let's check it!

#

Essentials

#

🤯

tight junco
#

i hate essentials code

dusky harness
#

🥲

tight junco
#

well

dusky harness
#

oh

#

it prob also does the mute in highest

shell moon
#

isAborted xd

dusky harness
#

why is it always highest 🥲
i feel like mute plugins should use like LOWEST

merry knoll
dusky harness
#

or LOW or NORMAL or HIGH

shell moon
#

My question is

tight junco
#

as a fun silly thing, almost every popular spigot plugin is made not very well

shell moon
#

shouldn't they cancel muted players in LOWEST or LOW?

tight junco
#

to be honest i think it should run on HIGH

#

definitely not lowest

shell moon
#

maybe i'm wrong, but at least LOW, shouldnt it be the case?

tight junco
merry knoll
#

i feel low is good no?

tight junco
#

low makes sense to me

#

should not be first but definitely not last

shell moon
#

finally

#

i'm not alone

tight junco
#

to be honest spigot's event priority system is the stupidest thing ever

#

why is it reversed 🧍

merry knoll
#

its 4 am here

dusky harness
#

eh
i wouldn't say it's reversed
maybe ambiguously named

tight junco
#

its reversed

dusky harness
#

debatable

tight junco
#

if you task something as the highest priority task, that should come first, no ?

shell moon
#

hahaha

dusky harness
#

debatableeee

shell moon
#

someone should make pull requests

#

to change them to LOW

tight junco
#

you cant change it anymore

#

we're stuck

dusky harness
#

nono they mean the ban plugins

tight junco
#

oh!

#

nevermind

#

yes pullrequest all of them people dont know event priorities

dusky harness
#

except i thnk half of those are closed source

#

🥲

tight junco
#

dox the developers, send pizzas to their house telling them to switch the event priorities

merry knoll
shell moon
#

Essentials is a mess, so i wouldnt change it

tight junco
#

essentials has kind of meme commands

shell moon
#

LibertyBans and AdvancedBans are open source

merry knoll
# tight junco :-)

i feel doing highest as well as low/lowest kinda makes sense with how messy some plugins handle events

#

kinda like a sanity check

#

to see if any un-cancelled the message

tight junco
#

i think we should go back in time and spigot event system

shell moon
#

minigames plugins also modify chat

merry knoll
#

time to find more soft depends then

shell moon
dusky harness
#

spigot should just add SUPER_HIGHEST
ez

shell moon
#

hahaha

#

agree

merry knoll
shell moon
#

SUPER_SUPER_HIGHEST

tight junco
#

i think it should be switched to numbers

#

everyone pick a number and enjoy

merry knoll
#

first - last is best imho

#

altho how would you name middle tiers then 💀

shell moon
tight junco
#

it definitely would

shell moon
#

🔓 New fear unlocked.

tight junco
#

essentials code

#

thats the fear

shell moon
#

i guess i'll just make it configurable

tight junco
#

i dislike essentials but i dont like cmi any better

#

at least essentials rarely gets in the way

shell moon
#

default HIGHEST

#

and add soft depend all ban plugins

tight junco
#

soft depend every plugin

#

do the ZZZZZZZZZZZZZZZZZZZZZZZ strat

hoary scarab
minor summit
#

it doesn't delete anything

hoary scarab
#

Doing some more debugging one sec.

sterile hinge
#

Parse the upper and lower 16 chars using Long.parseLong with radix 16, use those longs to construct a UUID object PepeLa

#

The good thing is you can test that independently from minecraft pretty easy

hoary scarab
#

Yeap my bad wasn't deleting. Must have misread it every time lol.
8,13,18,23 is what I changed them to.

minor summit
dusty frost
sterile hinge
#

luckily that's not the current implementation anymore

dense drift
#

I wonder how often do people parse UUIDs from strings for this to become a big issue?

river solstice
#

lol

#

just use UUID.fromString and get on with your life

sterile hinge
terse osprey
fading stag
spiral prairie
#

Binary

#

Just store the bytes directly instead of storing the hex representation as a string

pulsar ferry
#

:)

river solstice
#

:)

spiral prairie
#

Yep

#

MariaDB afaik also has a UUID type

proud lodge
#

Is it okay to use Aikar flags on a bedwars setup? will they make any change to the rendering and such?

proud lodge
#

Invalid maximum heap size: -Xmx4G
The specified size exceeds the maximum representable size.

I have 16gb

PAUSE```
minor summit
#

stop using 32 bit java

terse osprey
#

Is it possible to override a worldguard flag with my own? I've made a custom TREE_FARM flag which should allow players to break certain blocks (wood and leaves). But since the parent region (global) has block-break: DENY it doesn't actually allow the block to break. Do I have to prevent the cancelling of the event somehow or something?

dense drift
#

Remove block-break and handle it on your own shrug

terse osprey
#

I found a workaround by disabling particle effects

sterile hinge
#

you can override worldguard flags

#

but it will show a warning in the console then

frosty lance
#

hey guys is there a way to install papi extensions from a plugin i am working on. i have added papi to maven and i also use it in my plugin already for chat placeholders and other stuff

proud pebble
turbid hornet
#

how fix it

neat pierBOT
#
📋 Your paste: mr_parham
https://paste.helpch.at/ozafegixop

A member of staff has requested I move your message to a paste,
Most likely because it contains a config/error/code snippet.

pulsar ferry
#

What is "it"?

minor summit
#

<version>VERSION</version>

#

VERSION is not a valid version, you need to enter a valid version in the version attribute

worn jasper
#

Quick question, what world does $newEditSessionBuilder().getWorld() return? Cause I am trying to paste a schematic using (FA)WE and yeah, there are several worlds and none is specified in the code below:

WorldEdit worldEdit = WorldEdit.getInstance();
try (EditSession editSession = worldEdit.newEditSession(worldEdit.newEditSessionBuilder().getWorld())) {
    Operation operation = new ClipboardHolder(clipboard)
        .createPaste(editSession)
        .to(BlockVector3.at(loc.x(), loc.y(), loc.z()))
        .ignoreAirBlocks(true)
        .build();
    Operations.complete(operation);
}
sterile hinge
#

null most likely

worn jasper
#

so how would I get the instance of the world I want to paste the schematic?

#

worldedit docs suck

#

lol

river solstice
#

yes

worn jasper
#

.-.

#

found it!

dense drift
#

Is just smth like BukkitUtil.wrap(World)

worn jasper
sterile hinge
#

you should use BukkitAdapter instead

worn jasper
#

oh ok

dense drift
#

Yeah, it was BukkitAdapter not Util

queen plank
#

Is it possible to make a sequence of placeholders with PAPI? I myself use %ph1(%ph2(%ph3(whatever)%)%)% etc. for my own plugins and want to know if something similar is possible in PAPI?

#

I know there are {bracket} placeholders but is it possible to go "deeper" than that?

river solstice
#

idk

#

its just the way u parse them

river solstice
#

just write a method that checks for such sequence and parses them down up, providing each result to upper one

dense drift
#

There's this "utils" expansion that allows infinite nested placeholders

queen plank
#

I'd have to %ph1_ph2_ph3_whatever% but that's kinda hard to read. Can't really think of another way though. With the other one you could do like %math_round(2 + %math_rand(0, 100)% * 100)% but now you can't really? Since you can't have additional % in the placeholder I need another char to match, like []. That'd make something like %math_solve_2+[math_rand(0, 100)]*100% but that's wonky imo.

queen plank
dense drift
#

for math I suggest to use a lib tbh, I use EvalEx in one of my projects and it works fine

queen plank
#

Well...before I knew about that I made my own 💀. I found one good but that costed money so I made my own. Also mine is more niched to my needs so I'll just stick to it lol.

#

They are not super different for number and boolean evaluations

dense drift
#

What costs money? lol

queen plank
#

But that requires a license so I made my own. For what I do I prefer mine though, it does what I need better 🤷‍♂️

cloud panther
#

hey guys, im spawning alot of entities and im setting their meta data, but for some WEIRD ODD REASON, after a while they lose their meta data

#

any clue why ?

#

chunks they spawn in are loaded

river solstice
dusky harness
#

he used to be in this server btw

#

(kinda replying to gaby with him mentioning libs)

queen plank
# dusky harness theres https://github.com/boxbeam/Crunch/

That's fricking blazing fast, like 50-100% faster than mine, which is like 3x faster than EvalEx. It's missing some niched stuff I need, which I could fix but meh I'll stick with mine in case I need to do some changes 🤷‍♂️ It's fricking fast tho

broken elbow
dense drift
#

It looks like it has most basic math functions (sin, cos, etc.), variables, rounding, what else do you need?

minor summit
#

I've heard of sin and cos but what is this "etc" function you're talking about?

torpid raft
#

lmao

dense drift
#

smh Emily pepe_kek

#

I saw it has a lot of functions but I wasn't sure about all of them pepe_kek pretty much everything that java Math has

hoary scarab
#

Any suggestions on backwards material support?
I originaly went the XMaterial route with my own spin and made a enum class of materials changed throughout the versions.
In another plugin I just wrote down materials and durability of the blocks I needed.

I would really prefer not to write down all legacy materials.

wet pier
#

whats this ?

torpid raft
#

error

pulsar ferry
#

Javascript expansion error to be specific

wet pier
#

this is from other device

#

but work perfectly on mine

dense drift
#

Show the full code, my guess is that you want to use args[1] and not args1

queen plank
#

Is it possible to somehow hide entities for specific players? I know about entity destroy packets but I want to show them again later. Can you do some entity render distance update or smth to refresh them?

#

I see

#

lol

minor summit
#

barry is racist

queen plank
#

I can tell

queen plank
#

lmao

#

Wow I suck! For some reason I thought that was player only smh

minor summit
#

also Entity.setVisibleByDefault could be helpful depending on your situation

queen plank
#

Yup, thank you! I can’t read it appears lmao

broken elbow
#

Hello. I am looking for a library or just a repository of html elements written with tailwindcss that I can just copy and paste. I don't want anything that libraries like rippleui or prelineui offer where they give you custom classes to use.

wet pier
# dense drift Show the full code, my guess is that you want to use args[1] and not args1

no, its args[1]

function handleGradient(type, args1, args2, args3) {

    if (type.toUpperCase() === "HEX" || type.toUpperCase() === "RGB" || type.toUpperCase() === "DECIMAL") {
        let hex1 = args1;
        let hex2 = args2;
        let lengthAndPosition = args3;
        let length = lengthAndPosition.split(":")[0];
        let position = lengthAndPosition.split(":")[1];

        let r1 = parseInt(hex1.slice(1, 3), 16);
        let g1 = parseInt(hex1.slice(3, 5), 16);
        let b1 = parseInt(hex1.slice(5, 7), 16);
        let r2 = parseInt(hex2.slice(1, 3), 16);
        let g2 = parseInt(hex2.slice(3, 5), 16);
        let b2 = parseInt(hex2.slice(5, 7), 16);
    
        let RGB, HEX, DECIMAL;
        if (position >= 2) position++;
        for (let i = 0; i < position; i++) {
            let ratio = i / length;
            let r = Math.round(r1 + ratio * (r2 - r1));
            let g = Math.round(g1 + ratio * (g2 - g1));
            let b = Math.round(b1 + ratio * (b2 - b1));
    
            RGB = r + ", " + g + ", " + b;
            HEX = "#" + ((1 << 24) | (r << 16) | (g << 8) | b).toString(16).slice(1);
            DECIMAL = (r * 65536) + (g * 256) + b;
        }
        switch (type.toUpperCase()) {
            case "HEX":
                return HEX.toUpperCase();
            case "RGB":
                return RGB;
            case "DECIMAL":
                return DECIMAL;
        }
    }
}

handleGradient(args[0], args[1], args[2], args[3]);
fervent wren
#

Hello folks,
I got my hands on an older plugin and was asked to maintain it or at least get it up to date.
My experience with plugins for MC is not the best out there.
The plugin initially used a ScheduledExecutorService() and now intellij is having issues with the imported java.util.concurrent.TimeUnit with java 21.0.2. It was not working with 17.x as well.

Is there another scheduled Thread that might be more common to use (and works) without the imported non-working TimeUnit?

Thx in advance

river solstice
#

Idk did you try looking what params does it sccept lol

fervent wren
#

It needs a value from the TimeUnit-enum

minor summit
#

that just sounds like your intellij setup is wrong

#

don't know how you managed to do that but you can try doing a cache invalidation

#

TimeUnit has been a thing for 20 years

dense drift
lilac portal
#

Can someone help me with this?

private static String getFormattedDate(long unixTime) {
    Date date = new Date(unixTime * 1000L);

    SimpleDateFormat sdf = new SimpleDateFormat("MMM dd. - HH:mm", new Locale("hu", "HU"));
    sdf.setTimeZone(TimeZone.getTimeZone("Europe/Budapest"));

    return sdf.format(date);
}

It doesn't return the correct timestamp

dense drift
#

Last time I had to work with time zones I've used ZonedDateTime

lilac portal
#

The issue is that

#

oh i can't send images

neat pierBOT
lilac portal
#

ty

#

So it looks alr and everything

#

but its not november..

dense drift
#

Send the timestamp

lilac portal
#

a sec

#

1707068553979
and 1707070718189

dense drift
#

Formatted Date in Hungary (Europe/Budapest): 2024-02-04 18:42:33 chatgpt code, works fine for me

#
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.TimeZone;
import java.util.Locale;

public class DateFormatting {
    public static void main(String[] args) {
        long milliseconds = 1707068553979L;

        // Creating a Date object using milliseconds
        Date date = new Date(milliseconds);

        // Setting the time zone to Europe/Budapest
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", new Locale("hu", "HU"));
        sdf.setTimeZone(TimeZone.getTimeZone("Europe/Budapest"));

        // Formatting the date
        String formattedDate = sdf.format(date);

        // Printing the formatted date
        System.out.println("Formatted Date in Hungary (Europe/Budapest): " + formattedDate);
    }
}
lilac portal
#

Yes. But it doesn't on minecraft tho :/

#

Yeah yk what?

#

I noticed something you didn't do

#

but i did

#

You didn't multiply it so lemme give that a try

broken elbow
#

you multiply by 1000?

lilac portal
#

Yes yes

broken elbow
#

yeah

lilac portal
#

wanted to convert it to seconds

#

don't know why tho

broken elbow
#

Well for that you need to divide

dense drift
#

You divide by 1000 for ms to s, but Date uses ms

lilac portal
#

Good to know

#

divide??

dense drift
#

1000 ms = 1 second

#

1000 / 1000 = 1

lilac portal
#

Man i was multiplying everywhere

broken elbow
#

Happens to the best of us

lilac portal
#

Shiit hold on

#

bro

#

ty

#

sm

dense drift
#

I wonder what the year is pepe_kek, it can not be off by only 3 months

lilac portal
#

It was

#

because of the multiply

#

now its working

dense drift
#

Year 56064 LOL

lilac portal
#

then another thing. How can i select something just by their month? so only those things appear which happened in this month.. Here is my code

private List<String> getPunishments(String punishmentType, String playerName) throws SQLException {
    List<String> punishments = new ArrayList<>();
    String table = "litebans_" + punishmentType + 's';
    PreparedStatement statement = connection.prepareStatement("SELECT * FROM " + table + " WHERE banned_by_name = ?");
    statement.setString(1, playerName);
    ResultSet resultSet = statement.executeQuery();

    while (resultSet.next()) {
        String uuid = resultSet.getString("uuid");
        String reason = resultSet.getString("reason");
        String formattedReason = (reason != null) ? reason : "Indoktalan";

        long unixTime = resultSet.getLong("time");
        String formattedDate = getFormattedDate(unixTime);
        String playerNameFromUUID = getPlayerName(uuid);

        String punishmentEntry = "§8• §b" + playerNameFromUUID + " §8← §fIndok: §3" + formattedReason + " §8- §7§o" + formattedDate;
        punishments.add(punishmentEntry);
    }

    resultSet.close();
    statement.close();

    return punishments;
}

the tables are litebans_kicks/bans/mutes and the time is stored in the same way. Unix timestamp in the time column

dense drift
lilac portal
#

I mean i only wan't to display those that happened in the same month as the commands has been ran in

broken elbow
#

well, apparently sql has MONTH function

#

so you could maybe try that

dense drift
#

SO people say you should use the range instead of calculating the month for 100s of records

broken elbow
#
SELECT *
FROM litebans_kick
WHERE MONTH(timestamp_column) = MONTH(CURRENT_TIMESTAMP)
broken elbow
lilac portal
#

Can you do that for me? I am kind of a beginner in this

dense drift
#

With a java Calendar and a date format of dd-MM-yy it is very easy.

  1. Get calendar and set date to start of the month
  2. Save the value in variable for lower bound
  3. Set the date to the last day of the month
  4. Save the value in variable for upper bound
#

Calendar.getInstance() has the current date and time, you only need to set the day to 1 and last day (iirc there is a method that sets the day, 31 for jan, 28/29 for feb, etc.)

broken elbow
#

I suggest you use var instead

#

don't remember what engine it uses nowadays

wet pier
lilac portal
#
connection.prepareStatement("SELECT * FROM " + table + " WHERE banned_by_name = ? AND MONTH(FROM_UNIXTIME(time)) = MONTH(CURRENT_TIMESTAMP)");

It ain't workin 😭

#

Can someone help me with this?

warm steppe
#

send error

lilac portal
#

None xd

#

It just doesn't appear

warm steppe
#

send code then

#

no error and no code = no help :)))

lilac portal
#

the table:

CREATE TABLE `litebans_kicks` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` varchar(36) CHARACTER SET ascii DEFAULT NULL,
  `ip` varchar(45) CHARACTER SET ascii DEFAULT NULL,
  `reason` varchar(2048) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `banned_by_uuid` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `banned_by_name` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `time` bigint(20) NOT NULL,
  `until` bigint(20) NOT NULL,
  `template` tinyint(3) UNSIGNED NOT NULL DEFAULT 255,
  `server_scope` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `server_origin` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `silent` bit(1) NOT NULL,
  `ipban` bit(1) NOT NULL,
  `ipban_wildcard` bit(1) NOT NULL DEFAULT b'0',
  `active` bit(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `litebans_kicks` (`id`, `uuid`, `ip`, `reason`, `banned_by_uuid`, `banned_by_name`, `time`, `until`, `template`, `server_scope`, `server_origin`, `silent`, `ipban`, `ipban_wildcard`, `active`) VALUES
(2, '42c031cc-9c0f-3785-837b-6c335176cf8f', '84.0.222.151', NULL, '42c031cc-9c0f-3785-837b-6c335176cf8f', 'barnixf', 1707068553979, 0, 255, '*', 'KitPvP', b'0', b'0', b'0', b'1'),
(4, '58fcd405-ac1e-3248-bcc5-a32f7efda198', '37.234.245.89', NULL, '42c031cc-9c0f-3785-837b-6c335176cf8f', 'barnixf', 1707070718189, 0, 255, '*', 'Lobby', b'0', b'0', b'0', b'1'),
(5, '59afb809-61f2-3663-be7e-6d6e81fd4752', '185.217.75.2', NULL, '9d6fd970-eaf2-3204-a748-55fe98b8b5f8', 'Barlangok', 1707078698154, 0, 255, '*', 'Lobby', b'0', b'0', b'0', b'1');
warm steppe
#

send code and then we can see what is error :))))

lilac portal
#

the code:

private List<String> getPunishments(String punishmentType, String playerName) throws SQLException {
            List<String> punishments = new ArrayList<>();
            String table = "litebans_" + punishmentType + 's';
            PreparedStatement statement = connection.prepareStatement("SELECT * FROM " + table + " WHERE banned_by_name = ? AND MONTH(FROM_UNIXTIME(time)) = MONTH(CURRENT_TIMESTAMP) AND YEAR(FROM_UNIXTIME(time)) = YEAR(CURRENT_TIMESTAMP)");
            statement.setString(1, playerName);
            ResultSet resultSet = statement.executeQuery();

            while (resultSet.next()) {
                String uuid = resultSet.getString("uuid");
                String reason = resultSet.getString("reason");
                String formattedReason = (reason != null) ? reason : "Indoktalan";

                long unixTime = resultSet.getLong("time");
                String formattedDate = getFormattedDate(unixTime);
                String playerNameFromUUID = getPlayerName(uuid);

                String punishmentEntry = "§8• §d" + playerNameFromUUID + " §8← §fIndok: §5" + formattedReason + " §8- §7§o" + formattedDate;
                punishments.add(punishmentEntry);
            }

            resultSet.close();
            statement.close();

            return punishments;
        }
warm steppe
#

It doesn't return anynthing?

lilac portal
#

That is correct

warm steppe
#

db empty

lilac portal
#

No error, no output no nothing

#

no its not

warm steppe
#

send the line where you are calling #getPunishments();

lilac portal
#

shit

warm steppe
#

?paste

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

lilac portal
warm steppe
#

?paste

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

warm steppe
#

read this

#

use this too

lilac portal
#

aight

#

this is the whole command part

warm steppe
#

what happens when you send the command

#

what you see in chat

#

or maybe error in console?

lilac portal
#

2m

lilac portal
warm steppe
#

i do no undersaaand the languange

#

pls translate to english

lilac portal
#

username has overall 2x kick type of punishments executed

warm steppe
#

maybe try System.out.print()

#

where it outputs the data

#

it is good to do that for debugging purposes

lilac portal
#

yeah

warm steppe
#

pls results

#

it helps for me, you and mby others that may have the same problem

#

you know, helps gain more knowledge

lilac portal
#

yeah i know 1 sec

#

btw is there a way to save the plugin into a direct sftp folder?

#

is this the correct way

#

because it outputs nothing aswell

queen plank
#

I get this, any idea why? Caused by: java.lang.RuntimeException: Error resolving libraries. This is the import it is complaining about com.github.Redempt:Crunch:2.0.3. Here are the relevant pom segments: ```
</repositories>
<repository>
<id>redempt.dev</id>
<url>https://redempt.dev</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>com.github.Redempt</groupId>
<artifactId>Crunch</artifactId>
<version>2.0.3</version>
</dependency>
</dependencies>

#

Ping if you respond pls :>

dusky harness
queen plank
#

All of these work tho

dusky harness
#

oh ok nvm them

queen plank
#

Yeah no diff

dusky harness
#

idk why i said remove https

queen plank
#

huh

dusky harness
#

my right hand was not in the right spot 🥲

queen plank
#

I see lol

dusky harness
#

i meant to say that it should've worked with jitpack as well
whats the full error?

queen plank
dusky harness
#

ohhhh

#

its spigot error

#

oh yeah spigot only gets it from maven central

queen plank
#

Frick

dusky harness
#

🥲

queen plank
#

Aight shading ig

dusky harness
#

yepp
i dont think its a big lib though (31kb 😌)
(also for future reference plz post full stacktrace, as Could not find artifact com.github.Redempt:Crunch:jar:2.0.3 in central (https://repo.maven.apache.org/maven2) shows it's looking in central)

queen plank
#

Yeah mb, thought it was some formatting or smth I did wrong idk? I'll post full next time :)

#

Btw my jar legit did not increase in size like at all lol

sacred holly
#

Hey I am trying to make a deluxemenu where the player has to hold a certain item to make it apply a modeldata.

This is what I created, but it currently only checks if the leather helmet is anywhere in the inventory. It has to be checking if its in the hand yes or no. Otherwise they can apply the modeldata to any other item, aslong as they have a leather helmet in their inventory.

    material: LEATHER_HELMET
    model_data: 10001
    slot: 13
    update: true
    hide_enchantments: true
    hide_attributes: true
    display_name: '&dValentine Helmet'
    lore:
      - '&8Armorskin selecor'
      - ''
      - '&7Equip this skin to your tool by'
      - '&7holding the tool in your hand.'
      - ''
      - '&fApplicable Armor:'
      - ' &8▪ &7Leather'
      - ''
      - '&e➥ Left-Click to equip'
    click_commands:
      - "[givepermission] toolskins.admin"
      - "[player] setmodeldata 10001"
      - "[takepermission] toolskins.admin"
    click_requirement:
      requirements:
        points:
          type: has permission
          permission: toolskins.valentine.helmet
          deny_commands:
            - "[message] &b&lToolSkins &8&l→ &cYou do not own this skin!"
        item:   
           type: has item
           material: "LEATHER_HELMET"
           deny_commands:
            - "[message] &b&lToolSkins &8&l→ &cwrong item!"````
queen plank
sacred holly
#

Hmm I tought it was development sorry

queen plank
#

No this is more like actual coding :>

#

Like plugin development

#

Not server development

minor summit
#

software development HACKERMAN

queen plank
#

jaja same thing

#

not server development

dark garnet
#
final Query<String> createColumn = plugin.dataManager.session
        .createNativeQuery("ALTER TABLE " + table + " ADD COLUMN IF NOT EXISTS :key TEXT")
        .setParameter("key", key);

ERROR: syntax error at or near "$1"
Position: 59

`createColumn.getQueryString().replace(":key", key)` outputs `ALTER TABLE annoyingapi_entities ADD COLUMN IF NOT EXISTS last_join TEXT` (position 59 is `last_join`)

where is it getting the `$1`? using hibernate
minor summit
#

probably how it does parameters

dark garnet
minor summit
#

it probably isn't something that is parameterizable?

#

like, if you're doing an insert or an update or a select then sure, you'd parameterize the values, but not the column names

dark garnet
#

doesnt parameterizing prevent sql injection?

minor summit
#

i mean, why on earth would your column names be configurable like that

#

parametization is used for values

#

a table or column name is not something that you can parameterize

dark garnet
dark garnet
minor summit
#

making an api around an api around an api sounds like you're doing something very wrong

#

just use hibernate directly, you will get the best experience out of it

#

especially if you use it properly

dark garnet
#

i just want to be able to say "heres a uuid, a key, and a value, now store it", and theres also all the server owner configuration i wanna have. so i think its better to basically have that all hidden/common behind my api/library/framework instead of having to remake such an integrated system for all ~15 of my plugins (pain to convert as well)
should i just ditch hibernate if im only using native SQL queries?

minor summit
#

hibernate is what you use as an orm for you to have sql well integrated in your java codebase

#

you are basically skipping the good and useful parts of it entirely

dark garnet
#

yeah thats what i assumed, ill try without hibernate 😩

dark garnet
#

it worked :D
at least with my one test with postgresql

spiral prairie
#

Are those 27KB or MB?

minor summit
#

27 thousand kB

dense drift
#

27K KB

pulsar ferry
#

A Mega amount of bytes

spiral prairie
#

Okay that's a tad big

stuck canopy
#

What is the 1.8.9 dependency for papermc?

worn jasper
#

ew

#

1.8.9

#

out

polar crystal
#

hey there

#

i need help

neat pierBOT
#

There is no time to wait! Ask your question @polar crystal!

polar crystal
#

actually someone raided m server

#

can u all plz help me revive it

pulsar ferry
graceful hedge
#

Only client

pulsar ferry
#

?not-discord

neat pierBOT
#
FAQ Answer:

Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.

polar crystal
graceful hedge
dusky harness
#

@stuck canopy maven dependency should still be online - look in paper 1.8 branch

#

On github

stuck canopy
#

Alright, thanks

atomic trail
#

Currently editing a kotlin plugin (I have kinda no kotlin experience), is it possible to access the crate instance another way?

class Crate() {
  val crate = this
  
  private val blah = whatever.blah {
    // This is in another class
    crate.doSomething
  }
}
dusky harness
#

i think

#

val crate = this is cursed 💀

#

or just regular doSomething

atomic trail
atomic trail
tall yacht
#

I am looking for someone in US (anywhere). I have a job for you. If you help me, I will pay you $1000.
It's very easy one. You just only spend 1-2 hours. Please feel free to contact me for the details

graceful hedge
light pendant
#

Hi all, anyone know why IJ complains that this suppression is redundant?

#

even though getItemInMainHand is @ NotNull, I've seen some weird forks (I think it was some spigot/forge hybrid or sth) that does return null anyway, so I definitely want to have my val item be an ItemStack? and not an ItemStack

dusky harness
#

3 options 😃

#

oh also

#
fun requireItemInHand(player: Player): ItemStack = player.inventory.itemInMainHand.takeIf { item ->
    item?.type?.isAir == false
} ?: throw CommandResult.MUST_HOLD_ITEM_IN_HAND.asException()
``` 😌
#

¯_(ツ)_/¯

#

readability isn't always better when it's shorter, but i like shortening things lol

light pendant
#

huh well I thought I could just suppress it with @ Suppress somehow 🥲

#

nvm found an easy solution

    fun requireItemInHand(player: Player): ItemStack {
        val item = player.inventory.itemInMainHand
        @Suppress("UNNECESSARY_SAFE_CALL")
        if(item?.type?.isAir == true) {
            throw CommandResult.MUST_HOLD_ITEM_IN_HAND.asException()
        }
        return item
    }
#

oh no wait that doesn't work lol

dusky harness
#

i just realized

#

that's a pretty specific suppression

dusky harness
#

oh

#

quite long

queen plank
#

Is it possible to automatically create an event listener like this with the help of a super class. I don't want to have to manually create one per subclass as all of them call a single static method. I assume you can do it with byte buddy or smth?

public abstract class Foo<E extends Event> {
  
  @EventHandler
  public void onEvent(E event) {
    
  }
}

public class Bar extends Foo<PlayerJumpEvent> {
  
  // V - Has this by default inherited by Foo - V
  @EventHandler
  public void onEvent(PlayerJumpEvent event) {
    
  }
}
torpid raft
torpid raft
queen plank
#

Not really, the static method accepts any event but it is unnecessary to listen for them if unused. Also I didn't think you could listen for abstract events?

torpid raft
#

o youre right actually, i guess you cant just listen to Event 😔

queen plank
#

Otherwise I would've lol. It's unnecessary but there is like 0 performance diff.

#

I've tried doing it with bytebuddy but it just does not work. I've managed to create the method but I can't for the life of me redirect it

minor summit
#

wdym "automatically create an event listener with the help of a super class"

dense drift
#

Is listener registration the problem here? If you dont want to register a new listener for each class, you could have a single listener than then calls a certain method of this Foo class
E.g. Foo#onJump
Though if you want a single method in the foo class, instead of onJump, onBlockBreak, onClick etc. you could have an onEvent(Event) and subscribe to certain events using a system similar to Protocollib's PacketAddaper

worn jasper
#

Yo uhm, using ProtocolLib right now, and I can't figure out which Packet the System Chat Packet is, in the sense that I tried PacketType.Play.Server.CHAT and PacketType.Play.Client.CHAT and none of them are the ones I want... This is purely player chat.

#

To be specific, I wanna listen to the packet 0x69

mellow pond
#

try packetevents

worn jasper
#

I am asking about ProtocolLib, not Packetevents though lol, I would use it but several plugins rely on ProtocolLib, so why bother having 2 Protocol plugins lmao

queen plank
# minor summit wdym "automatically create an event listener with the help of a super class"

It was horribly written lol, I didn't know how to word it better xd. I've gotten help and solved it elsewhere, but if you want to know what I meant I'll try and explain better. I have a super class Foo with the generic <E extends Event>. For each subclass of Foo I want to create an event listener and since I have about 150 subclasses I didn't feel like doing it manually for each subclass. Instead I wanted to generate a method with bytebuddy or whatever to create the method for me and register them "automatically" (trash choice of word ik). Though I got told that I can use PluginManager#registerEvent(Class, Listener, EventPriority, EventExecutor, Plugin); for that.

worn jasper
# worn jasper Yo uhm, using ProtocolLib right now, and I can't figure out which Packet the Sys...

fixed this but now, this is a bit funny, mini sample of the error below, but basically it appears that the messages being sent have no content?! Which makes no sense since messages are being sent by the plugin and received by me.... tried getting both chat components and strings of the packet, both empty... so I am quite confused on tf is happening

[18:33:39 ERROR]: Parameters:
 net.minecraft.network.protocol.game.ClientboundSystemChatPacket@45ef365d[
   content=<null>
   b=false
 ]
proud pebble
#

might help

minor summit
#

system chat packet is only composed of a vanilla Component and a boolean (whether it should be shown in chat or action bar)

#

neither spigot nor paper modify the packet structure

#

assuming latest, of course :^)

worn jasper
#

xd

#

now I am struggling with getting the scoreboard lines lmao

robust briar
#

[DirectoryProviderSource]: Error loading plugin: Directory 'plugins/Treefell-1.0-SNAPSHOT.jar' failed to load!
anyone know why this is happening? Also is it okay to be using jdk 21 for 1.20.1 or does it have to be jdk 17

proud pebble
#

cus thats just not helpful

queen plank
#

So, I have a plugin were users can modify objects in a GUI. I want this plugin to hook to a SQL db though I've come across a problem. I don't know how to save them properly. Currently users have to press Save to save the objects, but if they exit out by mistake the changes wont save. Also if they don't click save and exit out without knowing that clicking save is mandatory they will lose all their work. I don't know how to combat this. I could just have the servers save everything automatically but then how would they know which version to pick? Another method I tried is flagging the objects, and every 15mins the server saves it, but if the users is still editing it at that time the flag will get removed and all work they do after the save won't apply? There is no good way of telling if they are in fact editing it or not.