#help-development

1 messages · Page 1220 of 1

young knoll
#

You probably have to set the children first

#

But I have no idea

tight compass
#

😮‍💨

primal island
#

Anyone who can help me 🙂

wet breach
#

why would you use skript if you can use java?

primal island
#

For like scoreboard or something, just so i can easy get it. But do you think it's easier just to make a scoreboard in a plugin and take the placeholders in that?

young knoll
#

Just use an existing scoreboard plugin

primal island
#

True, but still know how to use it in script it just says it can't understand the expression...

earnest girder
#

If I have a custom item that launches a projectile (snowball) and it hits a player and I detect it and damage the player, how can I make it so that the shooter of the projectile is equal to PlayerDeathEvent#getEntity#getKiller if the player dies from the damage I give them?

#

In other words, how can I know the killer of a player if it is from a custom projectile and custom damage?

#

Is it possible to assign a killer in ProjectileHitEvent?

vital ridge
#

I'm having a problem with placeholders. I'm creating my custom placeholder with PlaceholderAPI (extending the PlaceholderExpansion class).

Heres my code:
https://paste.md-5.net/zanenakayu.java
Here is the code of me registering it in the main class:
https://paste.md-5.net/mawirituda.cpp

Ingame when i run /papi list, "glarkourparkour" shows up.

But whenever I try using the actual placeholder with commands like:

/say The best food is %glarkourparkour_featured_course_author%

It doesn't work. I even have a debug message under #onRequest(), but this does not print out aswell.

young knoll
earnest girder
#

I figured out that I can send in a damage source entity when damaging the player

primal island
vital ridge
primal island
#

Ooh, okay. Don't know if you can do it in that way tho

#

You can use /papi parse me %glarkourparkour_featured_course_author%

#

Then see what the output is

vital ridge
#

whats un1bande?

primal island
#

Ooh sry didn't remove it mb

vital ridge
#

/papi parse me %glarkourparkour_featured_course_author%
THis didnt work

#

just printed out unparsed placeholder

primal island
# vital ridge whats un1bande?

But it's a plugin i work on. It's like gangs, it's "bande" in danish. It's something that many danish prison servers has.

primal island
vital ridge
#

MAIN.getLogger().info("Requested placeholder: " + params);

Is what I'm using under onRequest() function

#

And this does not run.

#

So yeah something is fked up

#

Idk what doe

primal island
#

I have tried the last 3 hours i think to get my placeholders to work in skript. But don't know how 😦

golden turret
#

any ideas on how to fix this? I can get the file manually without problems, but gradle at github actions is giving this

vital ridge
primal island
#

Could it be the reason why my placeholders dosen't work in skript you think?

vital ridge
#

I'm too lazy to break my code again but probably onRequest() runs if a console tries to access the placeholder or sht like that.

primal island
#

Mine just give me error at @Override

@Override
    public String onPlaceholderRequest(OfflinePlayer player, @NotNull String identifier) {
        if (player == null || player.getUniqueId() == null) {
            return "N/A";
        }

I have more than that tho.

vital ridge
#

Like the full class

primal island
#

Okay 2 sec

package dk.un1log1n.un1bande.placeholders;

import dk.un1log1n.un1bande.Un1Bande;
import dk.un1log1n.un1bande.database.DatabaseManager;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

public class BandePlaceholders extends PlaceholderExpansion {

    private final Un1Bande plugin;
    private final DatabaseManager databaseManager;

    public BandePlaceholders(Un1Bande plugin, DatabaseManager databaseManager) {
        this.plugin = plugin;
        this.databaseManager = databaseManager;
    }

    @Override
    public @NotNull String getIdentifier() {
        return "un1bande";
    }

    @Override
    public @NotNull String getAuthor() {
        return "Un1Log1n";
    }

    @Override
    public @NotNull String getVersion() {
        return plugin.getDescription().getVersion();
    }

    @Override
    public boolean persist() {
        return true;
    }

    @Override
    public boolean canRegister() {
        return true;
    }

    @Override
    public String onPlaceholderRequest(OfflinePlayer player, @NotNull String identifier) {
        if (player == null || player.getUniqueId() == null) {
            return "N/A";
        }

        String playerUUID = player.getUniqueId().toString();
        int bandeId = databaseManager.getBandeId(playerUUID);  // Find bandeID

        // Hvis spiller ikke har en bande
        if (bandeId <= 0) {
            return "N/A";
        }

        // Placeholder: %un1bande_name%
        if (identifier.equalsIgnoreCase("name")) {
            String bandeName = databaseManager.getBandeName(playerUUID);
            return bandeName != null ? bandeName : "Udefineret";
        }

        // Placeholder: %un1bande_level%
        if (identifier.equalsIgnoreCase("level")) {
            int bandeLevel = databaseManager.getBandeLevel(bandeId);
           ```
#

return String.valueOf(bandeLevel);
        }

        // Placeholder: %un1bande_bank%
        if (identifier.equalsIgnoreCase("bank")) {
            double bandeBank = databaseManager.getBandeBank(bandeId);
            return String.format("%.2f", bandeBank);  // Formatér som decimalværdi
        }

        // Placeholder: %un1bande_id%
        if (identifier.equalsIgnoreCase("id")) {
            return String.valueOf(bandeId);
        }

        // Placeholder: %un1bande_owner%
        if (identifier.equalsIgnoreCase("owner")) {
            String ownerUUID = databaseManager.getBandeOwner(playerUUID);
            return ownerUUID != null ? ownerUUID : "Udefineret";
        }

        // Placeholder: %un1bande_members%
        if (identifier.equalsIgnoreCase("members")) {
            int memberCount = databaseManager.getBandeMembers(bandeId); // F.eks. antallet af medlemmer
            return String.valueOf(memberCount);
        }

        return null;  // Hvis placeholder ikke genkendes, returner null
    }
}

That's everything `

vital ridge
#

Ur having an error because you are overriding the method with wrong parameters

#

Change OfflinePlayer to Player

primal island
#

Ooh mb haha

#

I'm tired, it's 2am man

vital ridge
#

3AM for me

primal island
#

Damn

primal island
#

Okay, so dumb question, but how do i turn on UTF-8 if that's possible in Intellij Idea. Can't use the danish letters "Æ, Ø & Å"...

rough ibex
#

It should be default

#

whats wrong

primal island
#

Just my letters that's looks weird cause i use some of the danish letters.
It should say "Indsæt Penge" "Tryk for at tilføje penge til Bande Banken"

In English:
"Deposit Money" "Click to deposit money to the Gang Bank"

#

Mby it's because i use a config.yml to set it...

#

It could be the error i think

#

But i'm pretty tired so i think i will fix it later. Good bye

golden turret
primal island
#

I guess i could just make a encoder or something in the plugin, that goes in the config when it's used and then edit the letters. Could be a idea i think. Could try and see if it's possible.

Don't know if it's called encoder but my english is pretty bad..

primal island
#

It's already set to UTF-8, think it's because it's from the config.yml...

primal island
#

It's set to UTF-8 everywhere so i think it's because config.yml is stupid aha

#

But thanks tho

golden turret
#

could you show us your pom.xml or build.gradle please

primal island
#

The whole file?

golden turret
#

yes

primal island
#

It's here where UTF-8 is set

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>dk.un1log1n</groupId>
  <artifactId>Un1Bande</artifactId>
  <version>1.0</version>
  <packaging>jar</packaging>

  <name>Un1Bande</name>
    <description>Et Custom Bande Plugin lavet af Un1Log1n</description>
    <properties>
    <java.version>1.8</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
    <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>${java.version}</source>
          <target>${java.version}</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.2.4</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
  </build>

The rest is just repositories & dependencies

#

You still here?

#

I'm goin' to sleep can you mby just send a dm if you find the error/solution? @golden turret

dawn flower
#

how do i return a variable in a Supplier?

#

i don't want the value of the variable when the supplier was made, i want the current value

#
int value = 1;
Supplier<Integer> supplier = () -> value;
value = 2; // supplier will now return 2```
rough ibex
#

supplier.get()

worldly ice
#

honestly sounds like a bit of an

#

?xy

undone axleBOT
dawn flower
#

i got a loop section that basically just executes abunch of actions x amount of times, these actions could want to access some values like what iteration we're currently in and to do that i use suppliers which would always return 1 until i used AtomicInteger

it might seem like just more steps to make a for/while loop but it's just a simplified explanation

worldly ice
#

could you not have a local variable that stores the number of iterations (or whatever else you need) and just access that whenever needed?

dawn flower
#

it's an abstract class of loopsection that other sections extend like for loop and while loop, for loop would also want to register some loop values like the current object being iterated

worldly ice
#

not sure what loopsection is but i assume it's something along the lines of

public abstract class LoopSection {
  public abstract boolean tick();
}

? because in that case using an atomic int wont even be needed

#

like so a for loop implementation could have a constructor that takes in a consumer<T> and an iterator or something and pass in the current object being iterated into that consumer every tick

dawn flower
#
public abstract class LoopSection extends Section {
  public void executeSection() {
    // executes the section's body, in this case calling executeIteration unless shouldExit() returns true
  }

  public void exitSection() {
    // called after the section is executed to then continue execution of the parent section, in this case do executeIteration is shouldExit() is false
  }

  public Object getLoopValue(String name) {
    // returns loop value
  }

  public abstract void executeIteration();
  public abstract boolean shouldExit();

  protected void registerLoopValue(String name, Supplier<Object> supplier) {
      // register loop value
  }
}

is a minified version that explains how it works

worldly ice
#

ah so the supplier in #registerLoopValue is the supplier you need the atomic int for?

dawn flower
#

yep

#

it has a constructor that registers an "iteration" loop-value with supplier () -> iterations.get()

worldly ice
#

im wondering if you could just return the current loop value in #executeIteration and storing that where needed rather than having a separate method and supplier for it

#

im assuming the loop value is just the current "value" the loop is on

dawn flower
#

there's multiple loop values

worldly ice
#

oh right yeah i didnt see that

#

even then you could have like a record that contains data about the loop value

#

then executeIteration would return that record

#

you could add a generic too like

public abstract class LoopSection<T> extends Section {
  // ...
  public abstract T executeIteration();
  // ...
}
#

and a for loop implementation could have the T set as

public record ForLoopValues<T>(int iteration, T value)
#

forgor syntax of records i think that's right

dawn flower
#

the thing is the section's body has no idea what the executeIteration returns since technically executeIteration is the one that executes the body

#

it's possible but it'd just add complications

worldly ice
#

does the section need to know what executeIteration returns? you could make an interface depending on what the section expects from the return value of executeIteration. because currently, are you just inputting magic strings and checking null in section?

dawn flower
#

it's currently like this:
root section -> multiple actions and inner sections
inner section -> multiple action and more inner sections

action knows what section it's currently in so if it wants to know what iteration it is in it could first check if it's in a LoopSection then cast the section it's in to a LoopSection and then do LoopSection#getLoopValue("iteration")

worldly ice
#

if it's expected to always have an iteration property, you could just make an interface with like a #getIteration method

#

if not you could cast the return type ig

#

and do something different depending on what it returns

dawn flower
#

you mean make a getIteration method in LoopSection?

worldly ice
#

i mean having executeIteration return like a T extends LoopValue

#

where LoopValue is an interface that contains a getIteration method

#

so whenever you execute on that section you get its current loop value

#

and other properties depending on the implementation

dawn flower
#

i could try doing that

inland agate
worldly ice
#

use PDC instead since you're using 1.14+

worldly ice
undone axleBOT
inland agate
worldly ice
#

use PDC then it probably better suites your use-case

#

?pdc

pseudo hazel
#

custom model data strings is from like 1.21.3 or something

smoky oak
#

?paste

undone axleBOT
misty ingot
#

I am attempting to make it so packets for only certain chunks are sent to the client, giving the effect that only certain parts of the world have loaded (on client side)

i tried tinkering with protocollib but failed miserably, anyone got ideas?

smoky oak
upper hazel
#

i need someone in my team who know how work with byte code

#

i need use it for remove reflection 🙂

pseudo hazel
#

wtf does that even mean

#

that sounds cursed

upper hazel
#

sec i translate for more information

#

for those who don't know, I'm doing a project. Combining Spring with Bukkt api. In short Spring is a framework that provides convenient mechanisms for developing backend sites. DI, JPA, Controllers and all this is based on anotations for convenience. And to leverage all this Spring uses byteCode generation instead of reflection to optimize searches

#

i trying create DI too

#

so i want find someone who know how work with bytecode and help me with it

blazing ocean
#

and why do you need it to "remove reflection"

eternal oxide
#

byte code manipulation is more difficult than reflection

blazing ocean
#

spring just uses cglib

upper hazel
#

reflection is long

blazing ocean
#

And writing bytecode won't help with that

upper hazel
#

i will have many annotations

blazing ocean
#

you still cannot access private methods with bytecode

upper hazel
#

oh sorry i mean ASM

blazing ocean
#

Okay?

#

ASM is just a bytecode lib

upper hazel
#

yes and this help with remove reflection code where is possable

eternal oxide
#

I did a LOT of work with IDA and ASM modding NeverWinter Nights. Avoid it if at all possible

blazing ocean
#

Where do you think that will remove reflection?

upper hazel
#

reading class?

#

create proxy i gess

blazing ocean
#

Proxying is still some reflection iirc

#

Yeap

upper hazel
#

you sure?

upper hazel
#

i think this not mean you cant create proxy class with ASM

#

i was hear this better then reflection

blazing ocean
#

???

#

ASM is just a bytecode lib

#

You need reflection in some places and using ASM will not help you

#

Unless you really wanna transform the base JDK's classes at runtime

shadow night
#

Something tells me no

blazing ocean
#

Mixins can

shadow night
upper hazel
#

yes reflection need but the less the better.

#

Spring framework based in MANY annotation

#

just image what will be if you will use only reflection

blazing ocean
blazing ocean
shadow night
blazing ocean
#

not entirely

shadow night
#

Last time I asked in fabricmc they told me no

upper hazel
#

end i need it

blazing ocean
#

Using bytecode is not better than reflection

upper hazel
#

why spring use it then

blazing ocean
#

How would I know

#

Ask spring

upper hazel
#

and why is not better

blazing ocean
#

Because it does not allow you to do more than reflection

#

if you are not overwriting existing classes

#

And the only way to get annotations of something is reflection lmao

#

You could write bytecode to call the reflection but it's just pointless

#

sir this is help-dev

rough drift
#

rad I'm stupid

blazing ocean
#

I know

upper hazel
#

so you mean i not can create class ? And reading class with reflection is faster then byte code?

#

lets say ASM

#

ASM not faster reflection ?

blazing ocean
#

You can create classes but can only load them in another classloader iirc

#

But what the fuck do you even mean reading a class

upper hazel
#

readig class

eternal oxide
#

are you trying to actually create new classes on teh fly and not just instances of existing ones?

upper hazel
#

proxy classes

#

and connection

#

read all annotations, methods, constructor

blazing ocean
#

And reflection also isn't slow at all as long as you cache it

upper hazel
#

ASM allow you read class like file if i remember

blazing ocean
#

It makes zero sense to parse and read a class file that's already loaded at runtime

eternal oxide
#

yeah I don't see any point in what you are doing

upper hazel
#

so this mean you think reflection is faster

eternal oxide
#

why is speed an issue here?

blazing ocean
#

premature optimisation

upper hazel
blazing ocean
#

I was replying to elgar

eternal oxide
#

creating Proxies at runtime is not going to have a speed issue using ASM or reflection

#

pick whatever is simplest to do

blazing ocean
#

Reflection isn't slow as long as you cache it

upper hazel
#

hm

eternal oxide
#

I'm only guessing but I have an idea hes trying to inject new classes from file or even through db queries

#

basically tryign to script runtime actions

blazing ocean
#

me when I store a classfile in postgres

eternal oxide
#

yep 🙂

rough drift
wet breach
# upper hazel Spring framework based in MANY annotation

if you are making your own implementation of the server, you don't need reflection or annotations as you could just modify the code as you see fit. If you instead mean to say you are creating a plugin and need to make methods that are private or whatever accessible annotations is not going to fix this. Annotations is a processing mechanism that either happens at compile time or at runtime which neither of which will change how the server code runs because annotations doesn't bypass the JVM mechanisms which is what reflection does. If this plugin is not going to be released for the public and instead just your private server then once again you could just modify the server code directly that you are needing access to without all this complex unnecessary stuff. Proxying classes is a method that can be used but its not more optimal then reflection nor is it inferior as it depends on the scenario. With spigot most times reflection is going to be the best

misty ingot
#

when i remove BELL using EditSession#removeBlocks in a selection, only one of these bells gets removed
using FAWE

#

i would ask in the FAWE discord but their support is basically dead

#

es.replaceBlocks(select, new BlockMask(es.getExtent(), new BaseBlock(BlockTypes.parse(material.toString()).getDefaultState())), BlockTypes.AIR);
the material is BELL

misty ingot
#

i have asked

#

never got a reply

blazing ocean
#

it's because you're replacing the default state

#

which also contains the rotation

misty ingot
#

how would i replace every state then

blazing ocean
#

BlockType is a mask or whatever it was called

#

nvm, use a SingleBlockTypeMask

#
session.replaceBlocks(region, SingleBlockTypeMask(session, BlockTypes.BEDROCK), BlockTypes.AIR)
misty ingot
#

it works

#

wonderful thanks

smoky oak
#

how often do you need to access a array[index] before it's worthwhile to put it into a temporary variable?

rough drift
smoky oak
#

can you elaborate on the why for that?

#

and no i def aint below 4 lol

sly flint
#

hi

#

hello

blazing ocean
#

?nohello

undone axleBOT
sly flint
#

ok

#

i need help

#

for 1 minute

smoky oak
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

sly flint
#

give me that web can i paste my code

blazing ocean
#

?paste

undone axleBOT
sly flint
#

ther is a proplem

blazing ocean
#

and what is the problem

sly flint
#

Error occurred while enabling ExcellentServerManager v2.0 (Is it up to date?)java.lang.NullPointerException: Cannot invoke "me.clip.placeholderapi.PlaceholderAPIPlugin.getLocalExpansionManager()" because the return value of "me.clip.placeholderapi.expansion.PlaceholderExpansion.getPlaceholderAPI()" is nullat me.clip.placeholderapi.expansion.PlaceholderExpansion.register(PlaceholderExpansion.java:147) ~[ExcellentServerManager-2.0.jar:?]at org.abo876.excellentServerManager.ExcellentServerManager.onEnable(ExcellentServerManager.java:78) ~[ExcellentServerManager-2.0.jar:?]at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:281) ~[paper-api-1.19.4-R0.1-SNAPSHOT.jar:?]at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:189) ~[paper-1.19.4.jar:git-Paper-550]at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104) ~[paper-1.19.4.jar:git-Paper-550]at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507) ~[paper-api-1.19.4-R0.1-SNAPSHOT.jar:?]at org.bukkit.craftbukkit.v1_19_R3.CraftServer.enablePlugin(CraftServer.java:563) ~[paper-1.19.4.jar:git-Paper-550]at org.bukkit.craftbukkit.v1_19_R3.CraftServer.enablePlugins(CraftServer.java:474) ~[paper-1.19.4.jar:git-Paper-550]at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:638) ~[paper-1.19.4.jar:git-Paper-550]at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:437) ~[paper-1.19.4.jar:git-Paper-550]at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:308) ~[paper-1.19.4.jar:git-Paper-550]at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1104) ~[paper-1.19.4.jar:git-Paper-550]at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[paper-1.19.4.jar:git-Paper-550]at java.lang.Thread.run(Thread.java:1583) ~[?:?]

blazing ocean
#

is your plugin depending on papi

sly flint
#

<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.5</version>
</dependency>

blazing ocean
#

show your plugin.yml

sly flint
#

name: ExcellentServerManager
version: '2.0'
main: org.abo876.excellentServerManager.ExcellentServerManager
api-version: '1.19'
authors: [ my discord user name .5_05 ]
description: This is the best plugin in the world
website:
softdepend: [PlaceholderAPI]

#

?

#

if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
getLogger().severe("PlaceholderAPI is enabled!");
new PlaceHolderExpansion().register();
} else {
getLogger().severe("Could not find PlaceholderAPI! This plugin is required.");
}

blazing ocean
#

I mean, if it's required, don't softdepend

sly flint
#

but i dont want it required

sterile axle
#

your code makes it required.

#

so...???

#

don't code it like that then

sly flint
#

for this

#

?

sterile axle
#

💀

#

yes...?

sly flint
#

the video show it

#

no

#

no

#

its github

blazing ocean
#

I'm so confused

sly flint
#

?

rough drift
sly flint
#

@blazing ocean

chrome beacon
#

Why did you ping him

sterile axle
#

bc it's fun

#

@blazing ocean

slender elbow
blazing ocean
#

@sterile axle

sly flint
chrome beacon
#

Pings rad again 💀

sly flint
chrome beacon
#

And now you're on the blocklist

sterile axle
#

lmaooooo

chrome beacon
#

Congratulations 🎉

sterile axle
#

aight im out of here

sly flint
blazing ocean
sly flint
smoky oak
#
Caused by: java.util.regex.PatternSyntaxException: Dangling meta character '?' near index 0
?

can you not split by "?" or something?

chrome beacon
#

Escape it

blazing ocean
#

invalid regex

smoky oak
#

ah yes of course bleh

#

regex in a nutshell

#

the problem i have is that this is a string input

#

how do i tell regex 'hey split by this string'

chrome beacon
#

Escape the ?

slender elbow
#

Pattern.quote(String)

blazing ocean
#

String#replace(CharSequence, CharSequence) doesn't do regex does it

smoky oak
# chrome beacon Escape the ?

i have the split string as variable input. sure, i can escape the questionmark where i call it, but thats kinda not the point

#

hm, delmimter("", split) maybe?

#

no thats an int

slender elbow
smoky oak
#

ah

#

im blind

#

ty

#

hey new error!

slender elbow
#

Impressive

sly flint
hazy parrot
sly flint
#

?

sterile axle
#

pretty sure this dude barely knows java, or quite possibly barely knows his way around a computer

#

this is pretty pointless

slender elbow
#

are you sure? they have "JAVA" in their name tho

chrome beacon
#

In my experience in this chat the more people advertise their java skill in bio (and now name) the worse they are at Java

#

Having Java dev in bio is big red flag that they do not know Java

slender elbow
#

JAVA PROFESSIONAL (started this weekend)

sterile axle
#

meh it's usually just kids who watched some videos and wanna make stuff, which is fine. but it's like, meet me half way. the stuff like "not working", "theres an error", upload random text and ask for help bs gets tiring after well over a decade (for me) at this point of seeing it

sterile axle
#

like, ask a full question, show your entire code, what did you try, do you have any ideas about what the issue might be...what can you contribute to this discussion? i am not google. or better, in 2025, i am not chatgpt.

#

if you can't bother to meet me half way to the finish line, then i am not going to entertain you, gud nayt

slender elbow
#

so what you're saying is one is better off asking chatgpt than you

#

runs

chrome beacon
#

💀

sterile axle
#

yes

#

actually, unironically, ask chatgpt before you ask me plz

misty ingot
#

is that allowed here

#

i think theres a forum for that

chrome beacon
#

This smells like scam

smoky oak
#

its a request, not a requirement i guess? in the rules

misty ingot
smoky oak
#

hes asking for your country of residence and his answer to asking why he wants to know is 'i dont have time for this' lol

orchid furnace
#

How can I send all arguments because I did a silly and accidentally only made the command send back the first argument

#

using args[0]

smoky oak
#

can't you just concatenate them?

sly flint
smoky anchor
# sly flint help

You've already been helped.
Stop being annoying before the whole server blocks you.

sly flint
pseudo hazel
#

yes

#

you still havent explained what the actual issue is

nova notch
smoky anchor
#

You can reply without the tag.

nova notch
#

I'm sorry if this guy is just using a translator or something but "ther is a proplem" is so funny

pseudo hazel
#

no translator is that bad

pliant topaz
#

You are using the PlaceholderAPI

#

so it is required for you to run code from it

#

Your plugin only softdepends on it, which doesnt make sure PlaceHolderAPI is loaded before your plugin, so if your plugin loads first it cant find the code from the API making it error

#

If you don't want it as an dependency, don't use it

sly flint
#

and i run it on the server but it's the same

smoky oak
#

is this the x coordinate of the chunk corner, or the actual chunk coordinate? I can't tell

slender elbow
#

chunk coordinate

smoky oak
#

k

pseudo hazel
#

the actual position can be calulated easily

smoky oak
#

nah im asking coz i need mediumint

#

having actual coords would need to be shifted to fit

#

on a different topic, why does this error appear? the previous code cannot not return something

#

(its a switch on a enum with all branches filled, all returning something)

slender elbow
#

return the switch expression

smoky oak
#

im doing my returns in the switch

#

guess i do yield now

slender elbow
#
return switch(foo) {
  case Foo.FOO -> 123;
  case Foo.BAR -> 456;
  case Foo.BAZ -> {
    yield 789;
  }
};
smoky oak
slender elbow
#

i mean, i can't see your code

smoky oak
#

no like

#

?????

#

wym this aint a switch bruh

#

is it the lambda thing?

slender elbow
#

more code

#

i ain't a psychic

smoky oak
#

why would seeing the full switch statement help here? its complaining that it's 'outside a switch expressions' which i doub is affected by the other cases
genuinely curious lol

slender elbow
#

i need to see the code to know what intellij is seeing to see how you can fix it

river oracle
#

You're annoying just fork it over context almost always helps

slender elbow
#

otherwise i literally cannot help

smoky oak
#

ah thats fair enough

#

?paste

undone axleBOT
smoky oak
river oracle
#

It's because you're yielding instead of returning

slender elbow
#

well, it's not exactly a switch expression, that's the thing

#

yield can only be used in a switch expression

smoky oak
#

the lambda, then

#

wait

slender elbow
smoky oak
#

what the fuc
that error is misleading as hell

river oracle
#

Not really you just mixed yield and return and never return from the function

slender elbow
#

eh, it's not wrong

smoky oak
#

i read that as 'switch is not switch'

slender elbow
#

switch expression

smoky oak
#

yeeeeah

#

aware now

primal island
#

Hi! Is it possible to make a encoder or something like that, that checks the config.yml when in use and then change som letters so UTF-8 works on them? Cause i'm from Denmark so i use some danish letters that won't work in the config when i use them ingame from the config? Hope you understand my english aha

chrome beacon
#

Save the file in UTF8 with your text editor

primal island
#

The thing is that in the config the letters is right but ingame it's not...

chrome beacon
#

Did you save it with UTF8

primal island
#

Yep, it's all saved in UTF-8

chrome beacon
smoky oak
#

ok this is cursed
case STRING -> object instanceof String string ? string : null;

blazing ocean
#

JS ahh

primal island
chrome beacon
#

yes

primal island
#

Alr will try that

#

Like this?

@echo off
java -Xmx1G -Xms1G -jar server.jar nogui
-Dfile.encoding=UTF-8
pause
blazing ocean
#

No, java -Xmx1G -Xms1G -Dfile.encoding=UTF-8 ...

primal island
#

Oooh

#

Ahaha

#

Thx that worked

chrome beacon
#

Thankfully Java 18 and above always uses utf8 by default so that environment dependent issue doesn't happen

primal island
#

But why not java 8? I'm just trying to make a plugin for 1.8.8, but then UTF-8 isn't set for configs and that 😦

blazing ocean
#

Because ancient

eternal oxide
digital basin
#

Hello! I am very new to spigot and I've been searching through the discord but couldn't find any great examples. Could you in theory register a custom block natively in spigot and then have a client using a mod fill in the gaps?

Looking for an example for registering the block on spigot specifically!

eternal oxide
#

No

#

Your mod would do it, or you use a platform which supports both Spigot and mods

fathom island
#

Hey, since 1.21.2 you can no longer define the effects in a FoodComponent, how should you do it now? I can’t find anything similar to a ConsumeComponent

chrome beacon
eternal oxide
#

The platform injects custom blocks into Bukkits Materials

chrome beacon
#

Need to use nms

#

or make a PR 🙏

fathom island
#

ho

chrome beacon
#

?contribute

smoky oak
#

i am going to bring forth exactly one pr

eternal oxide
#

I did a pr once. It was rejected 😦

smoky oak
#

i want to swap the call order for two events in the player logout lol

digital basin
eternal oxide
#

It was to Bungee not Spigot though

eternal night
worldly ingot
eternal oxide
#

I only wanted to expose teh Map behind the Config

worldly ingot
#

Is just stuck in serialization hell

smoky oak
#

oh hi choco, have you seen my question the other day?
ive been told u know about spigot internals

chrome beacon
#

ouch

primal island
chrome beacon
#

(can't see PRs without account)

eternal oxide
worldly ingot
primal island
#

I'm using a file i called config.yml. But someone gave me a line to type in my start.bat, so it's fixed now..

misty ingot
#

is there a way to create a sort of invisible wall that projectiles can pass through but players cannot?

mortal hare
#

my new rule of wisdom: never abstract away method parameters using default value overloads

foo(bar a) {}
foo() { foo(defaultA); }

this might work for simple case like this, but after a while you will get combinatorial explosion of function parameters that need to be default

#

instead be more verbose and just have pass the default value through parameter itself

#

foo(Bar.DEFAULT)

#

or smth

worldly ingot
#

You do that only when the default behaviour is obvious and documented. There's a reason we have Javadocs

mortal hare
#

tbh those overloads are kinda evil because it might make your code cleaner but then you're gonna scratch your head of how to decouple the code

mortal hare
#

it just that such methods succeptible to deprecations in the future

worldly ingot
#

All methods are susceptible to deprecation

smoky oak
#

.equals aint

mortal hare
#

again kotlin moment

#

kotlin allows to pass default values however you want

#

by using parameter names lol 😄

eternal night
#

Still pretty ass

#

That doesn't fix ABI

mortal hare
#

fair enough,

misty ingot
#

man i want optional arguments to be a thing in java
i dont want to learn kotlin just for one thing

mortal hare
#

kotlin is just a hack on top of JVM

#

mostly everything you can write in Kotlin, you can do it java

#

albeit in such a nasty way

blazing ocean
#

Kotlin is also a multiplatform language

mortal hare
#

Gradle supports C++

#

but i've never seen anyone use C++ with gradle

blazing ocean
#

Gradle also supports x86 assembly

mortal hare
#

and ARM

blazing ocean
#

KMP is amazing for app dev

misty ingot
#

ion wanna have to learn another language just for optional arguments in methods
i think ill stick to java

blazing ocean
#

You know, Kotlin has lots of other features too!

misty ingot
#

none of which i will ever use!

blazing ocean
#

Doubt that

misty ingot
#

only times ive really learnt a new language is if it enables me to start doing something new

#

or if its far better than what i already use

blazing ocean
#

Does your java have kotlin's amazing null safety and chaining

misty ingot
#

no but we can type

blazing ocean
#

Right but a lot of people don't use optionals

#

i.e. spigot

#

Spigot doesn't use optionals so you're gonna just end up with a trillion not null checks and shit

misty ingot
#

for custom methods

blazing ocean
#

whereas with Kotlin you have actual nullable types

misty ingot
#

just write your code properly

blazing ocean
#

?

misty ingot
#

nvm im cooked

#

disregard that sentence it made no sense

#

ive been IntelliJ-ing too much

orchid kernel
#

does anyone know how I can make a mob drop xp if it wasn't killed by a player?

valid burrow
#

someone explain this to me

blazing ocean
#

are you sure you are using the latest jar

orchid kernel
valid burrow
#

i even changed the name of the class just to be sure

blazing ocean
#

look at recaf

valid burrow
#

its there most definetly

rough ibex
#

Correct package name?

valid burrow
#

yep

#

intellij doesnt complain either

blazing ocean
#

do you have it loaded twice

valid burrow
#

it only happens when i actually run it

#

😭

#

nope

orchid kernel
#

I'm wasting my time aren't I.

smoky oak
flint coyote
#

Is there a way to get the "best" possible drop of a block?
I want to remove a block by code but I still want whatever block that is to drop the "best" possible default drop. E.g. stone instead of cobblestone or ice instead of nothing.
Blocks that don't drop anything (e.g. reinforced_deepslate) should not drop anything as well.

bronze robin
#

can I get some help developing my Minecraft server it runs on purpur and I’m pretty sure that runs spigot stuff

flint coyote
#

Not sure if there are blocks where a silk touch pick won't be able to yield something, otherwise I can just use that by default

undone axleBOT
#

SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.

smoky oak
#

actually

#
  • silk touch pick
#

should do it

flint coyote
#

Alright lets hope it will stay like that and they won't decide that Grass blocks need silk touch shovels specifically, thanks

smoky oak
#

it doesnt

flint coyote
#

I wasn't sure if there's any material where it is like that. So for now I'll just pray they don't change it

smoky oak
#

reason i said pick is bc 90% of the time im holding it and when i randomly mine a grass block its still grass

#

i know silk touch on picks works on more or less anything affected by silk touch

torn shuttle
#

someone on the internet just accused me of being old because I played civ 3 on release

eternal oxide
#

Grandpa

torn shuttle
eternal oxide
#

Sorry uncle

torn shuttle
#

factual, I have a drawing from my niece on my fridge

#

#general

smoky oak
torn shuttle
smoky oak
#

im painfully aware

nova notch
eternal oxide
#

Good job he doesn;t know I don;t pay rent

#

I live in a cardboard box

molten hearth
#

bro lives under a palm tree

#

does anyone know if packetevents is able to detect unauthenticated packets like handshake? ive got java public class PacketEventsPacketListener implements PacketListener { @Override public void onPacketReceive(PacketReceiveEvent event) { // do stuff } } but it doesnt fire for handshake packets

blazing ocean
molten hearth
#

alright one sec let me leave smth

smoky oak
#

project blocks to the player AND move them back if they move into it

rough ibex
#

how do people end up being in 100 servers

#

you cannot possibly need to know 100 sources of information like that

wet breach
#

the other half is for informational purposes for variety of stuff

#

for example, I am in paper but I don't actively engage in that discord

#

mainly because they would probably ban me if I did 😛

misty ingot
smoky oak
#

🚫

misty ingot
#

players from either side shouldnt be able to move to the other

#

so push the player back is the plan then

#

with a barrier block wall

echo basalt
#

I think I'm in 50 servers max

#

and I can prolly leave half of them without even noticing

bronze laurel
#

How do you do teams but with packets?

#

And ProticolLib

blazing ocean
#

there is no reason to do scoreboard-related things without using the API

bronze laurel
#

I want prefixes that are automatically done

#

And tab sorting

#

with luckperms

#

so if I ever add ranks nothing happens

chrome beacon
#

So why can't you do that with the api

bronze laurel
#

I can't find much information on it.

bronze laurel
chrome beacon
#

yes

#

?jd-s

undone axleBOT
fast jasper
#

hello. I am making a minigame Spigot plugin. in my Spigot plugin I'm trying to show a player's name in chat. however, it does not display the way I would like. I've tried player."getName()", "getDisplayName()", and "getListName()". all of these are returning the same value for me. they are returning a plain white text only version of the player's name. however that is not what I would like. I would like the version of the player name that shows up on the tab list, and in chat, such as with death messages and such. in my minigame, there are multiple teams, each with their own color and prefixes. when a player is shown on the tab list, or the scoreboard sidebar, or the chat in a death message, their username has their color, and their team prefix automatically shown by Vanilla Minecraft. I would like to "get" this string, but I cannot seem to find a method that returns this version. does anyone know what method to use to get that built in vanilla formatting instead of the plain version?

young knoll
#

I don’t think there is a method for that

fast jasper
#

really? huh, I'm surprised there doesn't exist a way to obtain this vanilla data. I guess I'd have to make a system to recreate it from scratch

young knoll
#

You’d probably have to get the players scoreboard, figure out what team they are on, and get the prefix and colour from there

fast jasper
#

that's definitely what vanilla is doing already. wish we had access to that method

#

but alright I'll try that thanks

chrome beacon
#

You could probably make a PR if you want to

wet breach
#

add color in here and it will change their color of their name

#

this is only used in plugins and chat. There is another method to change their playerlist name as well

#

this is the method to obtain the version you are most likely seeking

#

it helps if you would just search the Javadocs as it does have a search bar other then just looking at the interfaces

young knoll
#

They did say they tried getListName

#

Considering getListName isn’t a thing I assume they meant getPlayerListName

wet breach
#

idk, but it will include color in it as it grabs the exact data that is set. The only way it wouldn't is if you are making use of packets to do all these things instead and thus the server is unaware of these things

#

so if they are using packets to show a custom player list to players for example and they modify how the names are shown using only the packets

#

then the server wouldn't have any information in regards to color since it was never set using the api

rough ibex
#

Why

fast jasper
#

but appreciate the resource

rough ibex
#

Luckily it will work

#

but 1.8 in 2025 omegalul

wet breach
#

and hasn't changed in functionality

fast jasper
#

oh sorry i didn't realize you sent me documentation

#

I thought you sent me an API or external plugin

#

okay, I tried all these methods already btw

#

they all return the same thing

wet breach
#

are you using spigot and do you have any plugins modifying packets?

fast jasper
#

yes I'm using Spigot

#

and everything else is 100% vanilla

wet breach
#

then not sure what you are doing wrong because I never had an issue in regards to chat where their color is not being set unless you have some other plugin interfering

#

it has always been a thing you use SetDisplayName to change their name/color in chat

#

or if you wanted to show their name in color in a message you would grab their display name

#

the only way the server wouldn't know about a players color is if you weren't actually using the api to set the color of their name to begin with

young knoll
#

They aren’t

#

They are using vanilla scoreboard teams

fast jasper
wet breach
#

I don't use paper

#

don't make assumptions about people

#

I am probably one of the biggest supporters of using only spigot

fast jasper
#

sorry. my mistake

#

I should've worded that differently

wet breach
#

I went from CB to spigot. I have tried paper, but I don't like the development of it and some of its staff

#

I was once a BukkitDev staff member just like md_5 was long time ago 😛

fast jasper
#

I see. well that's pretty neat

wet breach
#

indeed, but that aside the api methods should work. Even though you are making use of scoreboards maybe try using the api methods to set their names too?

fast jasper
#

sorry for making an assumption out of nowhere. anyways yeah I'm on regular Spigot, 1.8.8, my plugin, and world edit are the only things in the server

wet breach
#

not sure if using the api methods would conflict but I don't think it would as the scoreboard should temporarily override even if you are setting the same colors

fast jasper
#

I am using Spigot to create and set the scoreboards as well

wet breach
#

I meant, using the api methods to set their displayname even though scoreboard overrides it

fast jasper
#

as well as the teams, their color, and prefix

wet breach
#

so that later you can use the api methods to obtain their color

young knoll
#

Like I said, grab the players scoreboard, get their team, and then get the color and prefix of said team

wet breach
#

or do that

#

that sounds lot better

fast jasper
#

I'll probably just do that approach tbh

wet breach
#

either way, the api methods do work, just can't expect it to grab data it doesn't know about

#

with that, I am off to work now 🙂

wet breach
#

here is this link

#

unfortunately doesn't have the search function

fast jasper
#

that's fine I can control + F. thanks for that resource. I think I may have visited this before at some point

tranquil stump
#

Does anyone know how I can change the keybind to accept autocomplete answers using ctrl+y in IntelliJ?

river oracle
#

do some people really use ctrl+y 💀 mine is just tab

#

it'll be under hotkeys

tranquil stump
#

it's vim

river oracle
#

probably "Complete Command"

#

under keybinds

#

vim has the most wild hotkeys lo

#

though if you want vim hotkeys just use the vim hotkeys extension

tranquil stump
#

i'm trying to but the ctrl y doesn't work idk why

river oracle
#

i'd seek support from the intellij forums or support page

tranquil stump
#

alr i figured it out

#

it was called choose lookup item

wet breach
#

Is this your twin @blazing ocean

mortal hare
#

this is why inheritance sucks

#

it works fine until you get shit like this

river oracle
#

Yeah

#

Uhuh

torn shuttle
#

I think I broke deepseek

#

was curious to see if it would spot the logic problem in how I'm indexing my commands

#

it's been typing out text nonstop for about 5 minutes now while thinking

#

ok now it stopped

torn bough
#

How would I go about making a plugin that removes dolphins needing to go up for air?

#

I know how to "make a plugin" with commands and modded items but what I'm asking for is the logic that controls the dolphin mob

smoky oak
#

is it possible to return the ResultSet of a SQL query, if within the method you try-with-resources the prepared statement?

eternal oxide
#

Not really. pass a consumer into your method to process the ResultSet

smoky oak
#

bleh

#

return List<Object> it is

#

oh btw assuming a List<Integer> is stored in a List<Object> can you just cast it like you would primitives?

#

ie (ArrayList<Integer>) arrayList

eternal oxide
#

casting would be unsafe. Probably better to stream.map

smoky oak
#

well, i have a check that guarantees it's in that format

#

i just want to deduplicate the function

#

specifically, there's a final field that guarantees its, for example, ArrayList<String>

#

(aka: what about it is unsafe? the way my code is structured might be able to circumvent it)

eternal oxide
#

The returned Object may not be a parsable String to an Integer

smoky oak
#

ah

#

im not tryina cast string to int

#

i have a List<Object>, which i have a final field stating of what type 'Object' is

#

so i was wondering if i could just go if(field == STRING) -> (ArrayList<String>) cast

#

(workaround to not have to copy and paste the same function for every type it can be)

eternal oxide
#

If your original is a List<?> yes, but unsafe cast. If it is List<Object> no

smoky oak
#

uh
how does ? work again

eternal oxide
#

its anything

#

Object means it IS an Object

smoky oak
#

wait

#

primitives arent objects

#

riiiiight

#

can this be done with generic signatures somehow?
ideally I'd have one method spitting out List<T> but i cant figure out how to input the desired T atm

eternal oxide
#

I'd still recommend you downcast using stream

#

if you are passing a Type (Integer) you can .map(type::new)

#

however ARE you talkign about Integer or int?

smoky oak
#

resultset can spit out Object in place of int i guess?

#

basically im trying to do this

#

just.. yknow, working

#

bc the alternative is to duplicate this function for every possible SQL type instead of just having to put the values into the switch

#

or as before, return object which also isnt ideal

eternal oxide
#

Yeah you can;t easily cast T so your return is goign to be problematic

smoky oak
#

thats the crux. since my generic is Class<T> i wouldnt get primitives so i could have an intermediary in List<Object> but how tf do you cast to T lol

eternal oxide
#

if I were you I'd return the List<Object> and stream cast once returned

smoky oak
#

i mean i could but the idea is to have this data manipulation in here, so you dont have to deal with those casts upstream lol

eternal oxide
#

then there is no need to pass in T

wet breach
smoky oak
#

that could work. Assuming o is instanceof clazz, can this throw the exception?

#

because if not, ill throw a runtime exception stating to not use reflection bc with the checks in place it cant hit it otherwise

wet breach
#

example how the above would look when using it

final Class<int[]> intArrayType = int[].class;
final Object someObject = new int[]{1,2,3};
final int[] instance = convertInstanceOfObject(someObject, intArrayType);
smoky oak
#

does this work for collection datatypes too? i could return an array, but the situation is much more suited to arraylist

#

(im assuming yes but at this point i dont trust java as far as i can throw it lol)

wet breach
#

it should work

#

anything passed to that method I gave above will have the compile time type Object

#

if you are still unsure I can show you the byte code of it

smoky oak
#

nah thats not why im asking, its just that java is jank

wet breach
#
public static <T> T convertInstanceOfObject(Object o, Class<T> clazz) {
        try {
            return clazz.cast(o);
        } catch (ClassCastException e) {
            return null;
        }
    }
    public static void main(String[] args) {
        String k = convertInstanceOfObject(345435.34, String.class);
        System.out.println(k);
    }

byte code of this is as follows

public static <T> T convertInstanceOfObject(java.lang.Object, java.lang.Class<T>);
    Code:
       0: aload_1
       1: aload_0
       2: invokevirtual #2                  // Method java/lang/Class.cast:(Ljava/lang/Object;)Ljava/lang/Object;
       5: areturn
       6: astore_2
       7: aconst_null
       8: areturn
    Exception table:
       from    to  target type
           0     5     6   Class java/lang/ClassCastException

  public static void main(java.lang.String[]);
    Code:
       0: ldc2_w        #4                  // double 345435.34d
       3: invokestatic  #6                  // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
       6: ldc           #7                  // class java/lang/String
       8: invokestatic  #8                  // Method convertInstanceOfObject:(Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;
      11: checkcast     #7                  // class java/lang/String
      14: astore_1
      15: getstatic     #9                  // Field java/lang/System.out:Ljava/io/PrintStream;
      18: aload_1
      19: invokevirtual #10                 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
      22: return
smoky oak
#

i... think i understand it?

#

been a while since i looked at anything low level

#

btw, would it be better to cast the list directly or to stream it?

#

ie return results.stream().map(e -> genericCast(e, clazz)).toList();

wet breach
#

depends, but streaming it might make it easier to understand in case you forget about it lol

#

doubt there is any significant drawbacks to either method

smoky oak
#

i think it makes more sense to direct cast it th en

#

uh

#

how do i get the class of a list lol

wet breach
#
List<String> myList = new ArrayList<>();
Class<?> listClass = myList.getClass();
smoky oak
#

im clearly doing something wrong here

#

and it wasnt forgetting to make it an arraylist

wet breach
#

I don't have my IDE opened, so can't really check lol

#

but, it seems you have an array list already from your above code

#

you have ArrayList<T>

#

so just grab the class from there

smoky oak
#

thats a ArrayList<Object> unfortunately

wet breach
#

well I guess you would have same problem, replace ? with T

#

should work I think

smoky oak
wet breach
#

lol

#

and this is why I hate messing with generics

smoky oak
#

yeeea but i really dont want to have to write O(n) functions lol

#

map it is i guess

#

btw sanity check, its Integer.class coz getObject from set returns Object, right?

#

or do i need to make separate calls for integer entries

wet breach
#

Class<? extends Object> clazz = items.getClass();

#

the annoying part with generics is the type erasure which in this case T gets removed

#

and without using reflection, it isn't a very straight forward way to get what you want XD

wet breach
wet breach
blazing ocean
#

ah yea

wet breach
#

this will show you the bytecode for a given class

blazing ocean
#

I just got confused because you said you didn't have your IDE open

#

but yea I always forget about javap

wet breach
#

right, I just used notepad to make a simple class

#

since I wasn't making anything complex lmao

misty ingot
#

how could i go about making an API for my plugin that other plugins can plug into and interact with the plugin in some specific ways?

remote swallow
#

Add methods that plugins can interact with inside your plugin or create an api module that has the backing for this that they can get from your plugin

sinful iron
#

hello i got questions on prepareAnvilEvent where my result item stuck in the result slot when trying to get them out

smoky oak
#

s what i use at least

echo basalt
misty ingot
#

i dont think public static methods is the best way to do it....

smoky oak
#

illusion its been two days lol

misty ingot
#

an API module might be the way, but how would people use it? ive never exactly made any sort of package

echo basalt
#

You're still breaking my expectations every day

smoky oak
#

do you know if jeff by chance has a post about doing library modules?

misty ingot
#

com.siliqon.pluginName.api.aReallyFancyMethodWow

echo basalt
misty ingot
#

jeff might have something about APIs

misty ingot
#

any tutorials or guides?

smoky oak
#

(jeff doesnt seem to have anything, its multiple nms versions using modules is the closest on his website)

smoky oak
sterile axle
#

this is way super old, but, like, yeah. it still works this way

bitter crater
#

hello

smoky oak
#

?nohello

undone axleBOT
smoky oak
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

sterile axle
#

basically make your interface, register it in your plugin and provide impl class. then anyone who wants to use your service just depends on your plugin in plugin.yml, adds your api pom as a dependency to their project, and gets your impl from the bukkit service manager while declaring your interface as the type

wet breach
sterile axle
#

dis is da wae (TM)

echo basalt
wet breach
#

the link I provided has an api module

#

the api module for it to work your main plugin has to implement it

#

otherwise the api never gets values etc

echo basalt
#

Here comes frosty sharing that one repo he has

sterile axle
#

we're talking about the bukkit service manager

#

your repo does not show that, so it's not applicable here

wet breach
#

oh service manager

#

thought we were talking about providing an api module and how you do that

smoky oak
#

well more like how to do api properly in general lol

echo basalt
#

Interfaces n shi

sterile axle
#

alright well, if you wanna go outside of service manager, then sure look at frost's repo

#

anyway im going back to netflix bai

bitter crater
#

i have a question, i'm hosting a server in my community. i was wondering if how can i integrate the fog and ash effects in basalt biome in nether onto a world and not affect other worlds. i'm specifically doing this in my lobby, and exlude the smp world.

echo basalt
#

Practice dependency inversion and just throw the interfaces into a separate module

smoky oak
wet breach
echo basalt
#

Fog and ash are biome related

bitter crater
#

although i can use resourcepack, or /particles. resourcepack affects all world, and /particles is too complicated to setup with skript.

wet breach
#

also its open source that if you want to copy it you can as long as you give credit, think that is the minimum MIT requires

echo basalt
bitter crater
#

is it possible to change the biome on a world without changing the actual world

#

?

echo basalt
#

✨ packets ✨

warm mica
#

I don't think there is a packet to change the biome dynamically, whereby you would have to painfully modify the chunk packets

bitter crater
#

my vision was the lobby is a ship, and the fog and ash on the basalt biome really fits the theme. like a ghost ship

#

if it's not possible, is there anymore way to make a weather fog on minecraft? any server sided plugins?

#

in just a specific world?

wet breach
#

just fyi

#

so you could just set your lobby as the appropriate biome and leave everything outside of that untouched

warm mica
#

Yeah. Worldedit's //setbiome command could help you with that

bitter crater
#

i could try that

wet breach
#

you can use that, or make use of the spigot api to do it if you want to make a small plugin to do that lmao

#

first link is for setting blocks to a specific biome, and the second is if you want to set an entire chunk to a certain biome

bitter crater
#

thanks dude, my friend didn't know this is possible

#

now we can make it

wet breach
#

have fun and enjoy your creation now

bitter crater
#

and last question, are particles really controlled on command blocks only?

wet breach
#

if you don't want to use a plugin

bitter crater
#

is there a plugin for that?

wet breach
#

otherwise there is a variety of plugins and libraries available as well as various api methods if you want to make something yourself

young knoll
#

There’s even a vanilla command for setting the biome now

sinful iron
#

hello i got questions on prepareAnvilEvent where my result item stuck in the result slot when trying to get them out ?

wet breach
#

thats new for me

young knoll
#

Yeah

#

/fillbiome

wet breach
#

that naming however isn't quite fitting

#

but good to know lol

warm mica
sinful iron
#

oh yes, i also have that part in, but still cannot get it work... do we need to handle the exp cost ? cuz i saw all the cost functions are deprecated

#

i felt like im missing something

bitter crater
#

another hindrances in our build, we want to spice things out. if you know god of war, when going inside the smp world we want to integrate the particles to atleast make some visuals on the portal room.

wet breach
misty ingot
sinful iron
#

cuz im making a re-roll function on items where only apply when onInventory click, i can tell the inventoryclick event triggered, but the item still stuck ;-;

wet breach
#

if nothing else you can make it yourself

#

however unlike your biome request particles are bit more involved

young knoll
#

I believe you can’t take the item out if there is no cost set

#

So you have to set it to at least 1

bitter crater
#

trailing particles on the floor as if it is like a lightning, and after this lightning thingy touches the lectern it shoots out a shulker bullet in the portal. we added custom datapacks that added custom particles.

bitter crater
warm mica
sinful iron
bitter crater
wet breach
bitter crater
#

or im very blind

young knoll
#

Use the AnvilView instead

sinful iron
wet breach
young knoll
#

Event#getView

sinful iron
sinful iron
warm mica
misty ingot
#

how could i go about getting the current selection that the player has made in FAWE/WE?

wet breach
#

lmao

young knoll
#

Use their api

misty ingot
#

i cant figure out what to do in their api to get the player's selection

sinful iron
#

👍 👍 👍

young knoll
#

Conveniently getting a players selection is the second example

misty ingot
#

nice

#

and lets say i wanted to save this selection in a file so that it can be retrieved at any time and put into a new world?

wet breach
#

which in WorldEdit, its CurrentSession I think it was? Something with Session in its name.

misty ingot
#

i got the getting part above, but i also want to save it as a file so i can get the selected area any time i want and put it in a world wherever i want

young knoll
#

They have an api for schematics too

wet breach
misty ingot
#

oh i see the example

wet breach
#

and Jishuna beat me to it -.-

bitter crater
#

tried that //setbiome on worldedit and faced with an error "java.lang.NullPointerException: null"

#

nvm it worked, but idk how to do the fog

#

anybody know how to do a weathered fog?

misty ingot
#

there should be a packet for that

bitter crater
#

how can i know that?

bitter crater
#

huh?

misty ingot
#

this might help

bitter crater
#

is it still applicable on 1.21.1?

pseudo hazel
#

probably

bitter crater
#

why does java just not make an on and off switch

#

for fogs

misty ingot
#

i dont think thats how it works

bitter crater
#

possible to drag the cloud in the ground?

molten hearth
#
\xb4\x0c\x07\x18minecraft:worldgen/biomeA\x12minecraft:badlands\x00\x17minecraft:bamboo_jungle\x00\x17minecraft:basalt_deltas\x00\x0fminecraft:beach\x00\x16minecraft:birch_forest\x00\x16minecraft:cherry_grove\x00\x14minecraft:cold_o``` do you guys know what this 0x0C in the registry data packet is supposed to be? the packet ID is 0x07 and the byte before is the packet length im guessing but no clue what that 0x0C sneaking in there is
blazing ocean
#

?protocol

molten hearth
#

the protocol wiki doesnt cover this thats why im asking here

blazing ocean
#

Yea I'm just checking there

#

where are you seeing said 0x0C

molten hearth
#

0x07 is the actual packet ID for registry data (and im expecting a registry data packet)

#

for some reason there's 0x0c before the 0x07

#

(also just saying I disabled both encryption + compression server-side)

chrome beacon
#

Yeah I'd assume that's the length

molten hearth
#

wait a minute

#

the length can take up two bytes?

#

i didnt think of this ☠️

chrome beacon
#

It's a varint

#

so yes

blazing ocean
#

^

molten hearth
#

yeah ive been getting by with ```python
initial_response = await asyncio.wait_for(reader.read(3), timeout=0.5)

    if initial_response:
        response_length = initial_response[0]  
        remaining_data = await reader.read(response_length - (len(initial_response) - 1))
        full_response = initial_response + remaining_data
        packet_id = full_response[1]``` on every single packet
blazing ocean
#

python 💀

chrome beacon
#

🐍 💀

blazing ocean
worthy yarrow
#

That’s a cobra innit

blazing ocean
#

nerd

worthy yarrow
#

Kek

pliant topaz
#

Pythons nice...

#

but only for small stuff

misty ingot
#

uh... why does my FAWE dependency not have the BukkitAdapter class?

chrome beacon
#

Did you add the bukkit dependency or just core

bitter crater
#

still onto that fog

#

is it possible to make it using bossbar?

misty ingot
#

my apolocheese

molten hearth
#

im going to port it to another lang later when its ready

#

another lang being js

chrome beacon
#

So just Mineflayer with less features

misty ingot
#

my first time making an arena-pvp typa minigame, getting to learn so many new things

molten hearth
#

but mineflayer seemed to have far too much overhead for my use case

misty ingot
molten hearth
#

I need like 10 packets to be defined + the client to follow a login flow, even node minecraft protocol was using like ~80mb of ram for that I think

chrome beacon
misty ingot
#

a truly foreign concept to java developers

molten hearth
#

it doesnt really need to know of whats going on it just needs to follow the login sequence and then disconnect

chrome beacon
#

but why

molten hearth
#

oh this is for my mc scanner project

#

i already do netscans but I also want to test the validity of the results

#

and there's no efficient tool to do so at least that I saw

misty ingot
#

why cant i player#sendMessage while simultaneously having a conversation with the player

molten hearth
#

then i could add some small metadata info to the server info

chrome beacon
#

💀 we don't need more server scanners

molten hearth
#

like whitelisted / offline-mode / premium ath

quaint mantle
#

wow

blazing ocean
chrome beacon
#

🔫

blazing ocean
#

It was actually pretty fast but I didn't do the whole botting shit

#

Damn I made it in August 2023

misty ingot
#

how can i clear the current selection of a player in WorldEdit

#

i cant find it in the docs

blazing ocean
#

look at //clear

misty ingot
#

i meant in the developer api

chrome beacon
misty ingot
#

im legally blind

blazing ocean
#

Without the API?

chrome beacon
#

magic

misty ingot
#

magic, obviously

manic delta
#

what is the best way to do custom villager shops?

#

spawning a villager entity on server enable and save them?

#

or spawn a villager via packet

chrome beacon
#

spawn the entity

#

Not sure why you'd need to respawn them on onEnable though 🤷‍♂️

manic delta
#

can i get them even if the chunk is not loaded without lagging the server?

chrome beacon
#

You'd need to load that chunk

chrome beacon
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

valid burrow
#

what does that even mean

#

„having a conversation“

#

is that a feature you made?

chrome beacon
#

conversation api I assume

misty ingot
#

ok so

inside my StringPrompt, i have a condition so that if the player enters the thing i dont want em to enter i player#sendMessage them a message telling them whats wrong so that next time they enter it correctly
but the message never shows in my chat

valid burrow
#

have u made sure its actually ran

#

log a console message right before

#

to make sure it’s actually being called

#

if that doesnt help make sure its the right player

#

otherwise

#

show code

manic delta
#

like this?

chrome beacon
#

Why do you need to access villagers in unloaded chunks

manic delta
#

i want to make something like shoopkeepers

#

so i need to acces to the villager after server restart

#

or wait

#

i can save the entity id and detect the rightclick?

misty ingot
#
            @Override
            public @NotNull Prompt acceptInput(@NotNull ConversationContext conversationContext, @Nullable String s) {
                ...
                int teamSize;
                ...
                if (teamSize < 1 || teamSize > 8) {
                    sendMessage(player, plugin.LANG.getEnterValidTeamSize(), true);
                    return this;
                }

                ...
            }

yes it runs.
sendMessage is supposed to send them a message, that method itself works
but i get no message

manic delta
#

the entity id is permanent? i mean the entity

chrome beacon
#

Entity id is not permanent