#help-development

1 messages Β· Page 617 of 1

craggy estuary
#

Anyone knows a simple database api that uses getters and setters to store data into the database? (not spigot related I think)

craggy estuary
# hybrid spoke *what*

something like:

public void set(String key, Object value) {
  // inserts that key into the database
}
hybrid spoke
#

thats basically how any database works

dire bluff
#

is anyone here ever worked with quest plugins

chrome beacon
#

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

cinder abyss
#

Hello, how can I check if a Biome is any ocean ?

orchid trout
#

why does nametagedit have to use reflection 😭

echo granite
#

Hey, which algorithms can complete an online player's name given a wrong input?
I don't just want completion based on prefix(notc -> notch) but also for example the input of Ntc should return Notch if Notch is online

eternal oxide
#

too difficult to bother with

orchid trout
#

check if a string contains every letter from user's input

echo granite
eternal oxide
#

ie if I type ihrroen should it return yoru name as a match?

echo granite
#

they could be missing or mistyped

eternal oxide
#

I suggest you match for all characters and order by weight

orchid trout
#

y2k

echo granite
#

I just need the name of it

eternal oxide
#

probably but not too hard to write

#

it just seems excessive for a tab complete

orchid trout
#

if people misspell then its their problem

echo granite
#

ofc I can refuse, but I don't because there has to be an algorithm for this

eternal oxide
#

its called TypoMatching

river oracle
orchid trout
#

spigot water or tap water

river oracle
#

I usually just get water out of my fridge

restive tangle
#

Tap water is soyboy behaviour

river oracle
#

spigotchan drinks spigot water

daring lark
#
 if (newItemEditor.getEnchants().keySet().stream().anyMatch(enchantment -> enchantment.conflictsWith(currentEnchant))) {
                Logger.log("Nie moge");
                continue;
            }```

Why it is true when i try to combine item with prot 1 and another item with prot 1?
No errors.
paper cosmos
#

is there a simple way to add glowing effect to a block itemstack?

young knoll
#

Enchant it and then hide enchantments

paper cosmos
#

What enchantment?

#

it says the enchantment cant be applied to it

young knoll
#

Any

#

Just make sure you use the right method to apply invalid enchants

daring lark
young knoll
#

I mean I guess you can do that too

daring lark
#
Logger.log(Enchantment.PROTECTION_ENVIRONMENTAL.conflictsWith(Enchantment.PROTECTION_ENVIRONMENTAL));```
wtf why this is true?!
young knoll
#

Why not

daring lark
#

ok...

#

thanks...

pseudo hazel
#

i mean you cant have the same enchantment twice

daring lark
#

oh tihs answer is better

daring lark
pseudo hazel
#

yeah this is just a general function saying that the enchantments cannot exist on something at once

twilit roost
#

how could I limit maximal height when lauching player via Vector?
I don't want him to go to the heavens but still go to the point, that's higher than the start location

young knoll
#

Limit the y value

spiral light
#

Is there an Method to generate (vanilla[-api]) Structures during World-Creation without waiting for complete generation ?

hardy minnow
#

Hey guys, using NMS mojang mappings and getting this error at run-time, no error compile time. Anyone know what it might be?

#

Exception Msg
java.lang.NoClassDefFoundError: net/minecraft/world/entity/player/Player
at CharacterCard-1.0-SNAPSHOT.jar//charactercard.charactercard.CharacterCard.onEnable(CharacterCard.java:66)
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:279)
at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:192)
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104)
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507)
at org.bukkit.craftbukkit.v1_19_R2.CraftServer.enablePlugin(CraftServer.java:560)
at org.bukkit.craftbukkit.v1_19_R2.CraftServer.enablePlugins(CraftServer.java:471)
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:635)
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:434)
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:308)
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1101)
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassNotFoundException: net.minecraft.world.entity.player.Player
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:183)
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:150)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 13 more

prime epoch
#

how do i take the sql statements out of the main thread loop?

spiral light
spiral light
hardy minnow
#

There is a CharacterCard-1.0-SNAPSHOT.jar that I am using. There is also a original-CharacterCard-1.0-SNAPSHOT.jar

spiral light
#

is there no other ? like ###-remapped or ###-remapped-obf ?

hardy minnow
#

There is not. These are my dependencies in pom.xml. Is there something else I should be doing in the pom to get the extra jars?

#

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19.3-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>4.8.0</version>
</dependency>
</dependencies>

spiral light
#

did you added the "plugin"-part in the pom ?

hardy minnow
#

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>16</source>
<target>16</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>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

spiral light
#

something like this

hardy minnow
#

That seems to be the part I am missing

cinder abyss
#

Hello, how can I get the server simulation distance ?

spiral light
#

how about "Bukkit.getSimulationDistance()" ?

cinder abyss
chrome beacon
hardy minnow
ionic terrace
#

Does anyone know a way to change a file name if it's already in use by a process?

#

or is that impossible to do?

prime epoch
#
 @Override
    public boolean perform(Player player, String[] args) {
        AtomicBoolean return_value = new AtomicBoolean(false);

        try {
            Bukkit.getScheduler().runTaskAsynchronously(Hcfcore.getInstance(), () -> {
                try {
                    if (FactionManager.playerInFaction(player.getUniqueId())) {
                        if (FactionManager.isPlayerLeader(player.getUniqueId())) {
                            player.getInventory().addItem(ClaimWand.makeNewWand());
                            player.sendMessage("You have recieved a claim wand!");

                            return_value.set(true);
                            return;
                        }

                        player.sendMessage("You must be leader to be able to claim!");
                        return_value.set(true);;
                        return;
                    }
                } catch (SQLException e) {
                    e.printStackTrace();
                    player.sendMessage("SQL ERROR! CONTACT DEVELOPER ASAP.");
                }

                player.sendMessage("You are not in a faction. Create one with /f create [name]");
                }
            ).wait();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        return return_value.get();``` is this the right way to prevent it from clogging the main thread?
#

all the stuff from FactionManager run sql tasks

spiral light
#

why do you use .wait() ?

prime epoch
#

to wait for it right?

spiral light
#

but thats why your main thread is waiting O.o

prime epoch
#

im not used to java async

prime epoch
spiral light
#

remove it ^^

prime epoch
#

so everything should be fine if i take out the wait

spiral light
#

i guess so

prime epoch
#

alright thanks

spiral light
#

if its used you cant change the name

hazy parrot
spiral light
#

you can create a copy and then rename the copy and later remove the used file

hazy parrot
#

you cant really return something while doing async

#

without blocking

prime epoch
#

ah alright. I'll just have to change the way the class works then

prime epoch
hazy parrot
#

you most likely don't want to block main thread :p

rare rover
#

yo Goksi

#

how does this look?

    @Override
    public @Nullable CompletableFuture<PlayerData> getData(@NotNull Player key) {
        return CompletableFuture.supplyAsync(() -> {
            UUID uuid = key.getUniqueId();
            String SQL = "SELECT * FROM players WHERE uuid=?";

            try (Connection conn = connection.getConnection().join()) {
                PreparedStatement statement = conn.prepareStatement(SQL);
                statement.setString(1, uuid.toString());

                try (ResultSet result = statement.executeQuery()) {
                    if (result.next()) {
                        Player player = Bukkit.getPlayer(result.getString("uuid"));
                        return (PlayerData) new GenPlayer(player);
                    }
                }
                return null;
            } catch (SQLException e) {
                throw new RuntimeException(e);
            }
        }).exceptionally(e -> {
            e.printStackTrace();
            return null;
        });
    }```
small current
#

How can i set blocks without light updates

#

I do the world.setBlock(pos, state, integer)

#

And i can see light updates happening

upper hazel
#

hey how add new plugin in spigotMC

#

i not can see button

rough ibex
#

drop it in the plugins folder

hazy parrot
small current
upper hazel
rare rover
#

because its catching from the database

#

it doesn't exist

upper hazel
#

I mean, you don't get anything besides the player, do you?

rare rover
#

no

#

your point?

#

idk what your trying to say

upper hazel
#

you can just Player class

#

use

rare rover
#

no?"

#

what

#

πŸ€¦β€β™‚οΈ

#

that's not the point of that whole method

upper hazel
#

ah i see

#

))

#

i was think this container

#

someone say me how add plugin in spigotMc site i not see button

#

oh i see

#

who know how update my plugin

#

i want delete end add another update version

tender shard
eternal night
#

idk alex

#

where exactly do you want me to click

#

not really obvious from that screenshot

quiet ice
#

I think it means there is an Earthquake emanating from the "Post Resource Update" button

tender shard
eternal oxide
#

so we click this?

rare rover
#

I just need more practice with Futures

rare rover
#

Tf is that

#

Never heard of it

#

πŸ˜…

charred blaze
#
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

public class MinecraftClient {

    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("localhost", 25565);
        OutputStream output = socket.getOutputStream();

        // Send the handshake packet.
        byte[] handshake = new byte[25];
        handshake[0] = 0x00; // Protocol version
        handshake[1] = 0x00; // Server address length
        handshake[2] = 0x00; // Server address length
        System.arraycopy("localhost".getBytes(), 0, handshake, 3, "localhost".length());
        handshake[11] = 25565; // Server port
        handshake[12] = 0x00; // Next state
        handshake[13] = 0x01; // Encryption enabled
        output.write(handshake);

        // Send the join request packet.
        byte[] joinRequest = new byte[24];
        joinRequest[0] = 0x01; // Packet id
        joinRequest[1] = 0x00; // Length
        System.arraycopy("world".getBytes(), 0, joinRequest, 2, "world".length());
        output.write(joinRequest);
    }
}```
Does minecraft protocol work like that? ^
#

just asked bard to write it lol

storm granite
#

in spigot, how to play a sound AT a location but so ALL players can hear it, so its not directly sent to the player??

charred blaze
charred blaze
storm granite
#

says cannot resolve method playSound

#

ah

#

ill try

#

not work

chrome beacon
#

Use the method I sent

storm granite
#

i am trying its saying it cant resolve it

chrome beacon
#

It exists

remote swallow
#

Show ur cofe

chrome beacon
#

^^

remote swallow
#

Code

storm granite
#
        Location loc = dead.getLocation().clone().add(0,0.9,0);
        int roleInt = getIntVariable(killer,"roleInt");

        switch (roleInt) {
            case 1:
                playSound(killer.getLocation(), Sound.ENTITY_FIREWORK_ROCKET_TWINKLE, 1.0f, 0.0f);
                for (int i = 0; i < 10; i++) {
                    new Fragment(null, loc, new Vector(0, 1, 0), "firework1");
                }
                return;


            default:```
charred blaze
#

killer.getLocation().playSound

storm granite
#

dead*

remote swallow
#

World.getWorld("world").playSound

chrome beacon
charred blaze
#

then try world

#

as said above

eternal oxide
#

player#playsound or World#playSound

chrome beacon
#

They want world#playSound

storm granite
#

is it more efficient to save a world object to .getword beforehand?

#

to reuse

chrome beacon
#

Get the world from the players location

eternal oxide
#

Player has a getWorld() method

charred blaze
#

anyone who knows mc protocol here?

chrome beacon
#

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

spiral light
charred blaze
#

i already asked. lmao

chrome beacon
#

Then bump the question instead of asking pointless other questions

charred blaze
#

is that allowed?

#

thought it wasnt

#

ok

chrome beacon
#

or open a thread

chrome beacon
storm granite
#

i think it worked , thanks a lot!

charred blaze
#

lol

eternal oxide
#

@charred blaze there was someone doing what you are tyrying to do. he used to have a name like bettanation or something

charred blaze
#

ah

eternal oxide
#

I can;t remember what name he has now

#

From your code it looks like you are tryign to fake login a player

charred blaze
#

yeah first of all fake login

eternal oxide
#

his reason was to keep the server active for messaging channels

charred blaze
#

??

eternal oxide
#

you can;t send messages to a server that has no players logged in

#

PMC

#

for teh life of me I can;t remember his nick though

charred blaze
#

messages?

#

wdym

#

im just trying to join

turbid ridge
#

Why does calling block.getType() asynchronously cause a freeze?

spiral light
#

because the world will try to load sync or generate sync i guess

undone thunder
#

Does anyone know of someone who could develop a Minecraft task with NPCs and a built environment that I could use for a research project? I would pay

spiral light
undone thunder
#

Thanks!

rare rover
#

Wtf

#

Never knew java was the 5th fastest programming language

#

That's nice

#
  1. Zig
  2. Rust
  3. C
  4. C++
  5. Java
#

Sick

rough ibex
#

uh source please

cinder abyss
#

Hello, what are the coordinates (relative to the player) of his back ?

#

(I want to spawn a ItemDisplay on his back)

eternal oxide
#

player.getLocation().subtract(player.getLocation().getDirection().multiply(0.5)) then +1 to Y

vast ledge
#

I there anyway i can make JSON not look dog crap on the forums?

#

ik theres a highligh for java

#

and yaml

#

but no json

eternal oxide
#

json is a subset of yaml

vast ledge
#

thanks

#

πŸ˜„

#

My Epic page

cinder abyss
eternal oxide
#

why do that?

#

just mount it on the player as a passenger, then set an offset

young knoll
#

Cool

cinder abyss
cinder abyss
#

okay thanks

river oracle
#

they are close, but rust is undoubtedly slower

eternal night
#

why isn't python on number one ?!

river oracle
young knoll
#

Tf is zig

hazy parrot
#

Wanted to ask same

river oracle
young knoll
#

Does it also compile to assembly

river oracle
cinder abyss
# eternal oxide the vec3f is an offset

Looks like I can't do something myself...java itemDisplay.setTransformation(new Transformation(new Vector3f(-.5f, 1f, -.5f), new Quaternionf(), new Vector3f(), new Quaternionf()));The entity is far away from me, I can't see it LUL

eternal oxide
#

did you set it as a passenger?

cinder abyss
#
player.addPassenger(player.getWorld().spawn(player.getLocation(), ItemDisplay.class, (itemDisplay) -> {
  itemDisplay.setItemStack(previous);
  itemDisplay.setTransformation(new Transformation(new Vector3f(1f), new Quaternionf(), new Vector3f(), new Quaternionf()));
}));```
eternal oxide
#

also rather than creating all those new objects you may want to use getTransformation() and adjust the vec3f

cinder abyss
eternal oxide
#

probably

cinder abyss
#

perfect.

#

I'll come back later

ionic terrace
#

Seems fine...

small current
#

i need a code to place blocks without lite update and physics

young knoll
#

Pretty sure it’s just Block#setType(type, false)

eternal oxide
#

that does lighting updates, just no physics

cinder abyss
ionic terrace
#

It's a new feature πŸ‘

#

lmao

cinder abyss
tender shard
#

why do you ask this in help-development?

spice forge
#

Wehre should i ask this?

rough ibex
cinder abyss
tender shard
rough ibex
#

lmao

cinder abyss
spice forge
#

my bad

sick ermine
#

How can I compare a player head texture to another texture or not?

((SkullMeta) itemStack.getItemMeta()).getOwnerProfile().getTextures()

cinder abyss
# eternal oxide probably

well, how can I do it? I have this :java transformation.getTranslation().set(-.5f, 0, -.5f);and the result is:

eternal oxide
#

it shoudl be relative to the player so not both x and z

tender shard
cinder abyss
sick ermine
eternal oxide
#

not sure in teh case of a passenger

tender shard
eternal oxide
#

does it always ride in teh same position as you move?

cinder abyss
vestal pewter
#

Hi,

I am working on a plugin where the player has a score that can change multiple times a minute.
I want to store the score in a MySQL database but doing a request multiple time a minute for each player would be inefficient.

I think I should store it somewhere else and update the database when the player log off or when the server stop.

How should I store the data temporarily ?

eternal oxide
#

as you move the player the sword follows?

eternal oxide
#

seems its not riding

cinder abyss
#

(it's following me)

vestal pewter
#

@last temple Okay, thank you

cinder abyss
#

but not getting my direction

sick ermine
eternal oxide
#

not sure what you mean

cinder abyss
young knoll
#

It won’t rotate as your rotate

tender shard
cinder abyss
#

I'm bad at english LUL

young knoll
#

You’d have to manually handle that

cinder abyss
young knoll
#

Sure

eternal oxide
#

yep probably

cinder abyss
#

the problem is that idk where I need to set it

eternal oxide
#

PlayerMoveEvent

sick ermine
cinder abyss
sick ermine
#

If we compare it with the URL, unnecessary parts such as https come with me, right?

eternal oxide
#

just set its offset depending on player direction

cinder abyss
eternal oxide
#

its just getDirection, modify and apply to teh vec3f

young knoll
#

You can either rotate the passenger

#

Or change the offset

cinder abyss
#

I'll try to set the offset correctly when it spawns first, and after I'll do this with playerMoveEvent, getting the entities nearby the player and modifying the good itemdisplay

cinder abyss
#

This ?java transformation.getTranslation().set(player.getLocation().getDirection().toVector3f());

eternal oxide
#

half getDirection as a negative

rare rover
#

okay should i do?

    @Override
    public @Nullable Unregisterable register(@NotNull Registerable key) {
        List<UnregisteredGenerator> registerables = getUnregisteredGenerators();

        if (registerables.contains(key)) {
            RegisteredGenerator registeredGenerator = new RegisteredGenerator(key);
            getRegisteredGenerators().add(registeredGenerator);
            registerables.remove((UnregisteredGenerator) key);
            return registeredGenerator;
        }
        return null;
    }```
or
```java
    @Override
    public @Nullable Unregisterable register(@NotNull Registerable key) {
        if (unregisteredGenerators.contains(key)) {
            RegisteredGenerator registeredGenerator = new RegisteredGenerator(key);
            registeredGenerators.add(registeredGenerator);
            unregisteredGenerators.remove((UnregisteredGenerator) key);
            return registeredGenerator;
        }
        return null;
    }```
#

since im using unregisteredGenerators twice

cinder abyss
#

please

#

there is absolute

#

but not the inverse of absolute

#

oh it's negate

flint coyote
#

JavaPlugin already contains a "getConfig()" Method with a different return type. You are overriding it with another return type which is not allowed

hazy parrot
#

I think error is pretty self explanatory

flint coyote
#

Changing the name of the function is enough

tender shard
#

class plugin yikes

young knoll
#

Oh it’s lowercase too

#

😩

ivory sleet
#

Maybe its a new keyword, they know sth we don’t

tender shard
#

also why is there a main method in a plugin lol

#

class plugin reminds me of this

hazy parrot
#

Does Plugin() still counts as constructor of plugin class lol

buoyant viper
#

sometimes i put main(String[] args) in non-app jars just to tell them "This is not an application"

tender shard
#

yeah I have that too

craggy estuary
#

whats the best way to transfer (send) messages throughout servers? (im using redis but i couldn't figure it out)

vestal pewter
#

Hi,

I posted a question a bit earlier and the answer was to use a Hashmap to store data onto the player like that : Hashmap<UUID, Integer>

Is there any specific reason why I shouldn't use Hashmap<Player, Integer> ?

buoyant viper
#

probably something regarding memory leaks by holding a reference to the Player instead of just their UUID

#

since even if the player leaves ur still holding a reference to them that (i believe?) can not be garbage collected

tender shard
buoyant viper
#

and that

#

mostly that

tender shard
vestal pewter
#

Oh I see, thank you @buoyant viper and @tender shard you are both really kind to answer my questions

young knoll
#

You can also just slap the int in their pdc

buoyant viper
#

i oughta start thinkin of something to use PDCs for on my smp tbh

young knoll
#

I use them in nearly everything now

tender shard
#

same

#

since 1.14, everything is stored as PDC lol

buoyant viper
#

im just uncreative lolz

tender shard
#

do you have a Map<Material,List<double[]>> somewhere?

buoyant viper
#

no?

tender shard
#

pity

#

you could have saved that to PDC

young knoll
#

Custom item? PDC
Custom block? PDC
Custom entity? PDC

craggy estuary
# tender shard pubsub

alright,
Redis Output looks like this:

onPMessage pattern __key*__:* __keyevent@0__:set notify

And this is for the message

String[] split = message.split("set");
String first = split[0];
first = first.trim();
GuildChatMessageHandler.getInstance().handle(fetch the player, message);

Am i right?

buoyant viper
#

oh i know what i can use PDCs for

#

settings persistence for log stripping in my smp plugin

buoyant viper
#

just slap a boolean onto that bad boy

tender shard
young knoll
#

Log striping persistence?

buoyant viper
#

had to look at wtf i even store for players

buoyant viper
vestal pewter
#

That's a nice feature

young knoll
#

Ah

buoyant viper
#

dont mind the absolutely insane code for sitting on an armor stand btw

pseudo hazel
#

whats insane about that

buoyant viper
#

idk

pseudo hazel
#

then dont mention it

buoyant viper
#

what is insane though is how EntityDismountEvent is part of Spigot API and not Bukkit

#

since i am too stupid to find a bukkit event regarding dismounting from entities besides VehicleExitEvent

pseudo hazel
#

does it matter though

buoyant viper
#

yesn't

pseudo hazel
#

like no server just runs naked bukkit anyways

young knoll
#

Who still depends on the Bukkit api

quaint mantle
#

spigot

young knoll
#

Okay well other than that

quaint mantle
#

paper

buoyant viper
#

just weird that it isnt standard bukkit, maybe it existed before spigot acquired it

young knoll
#

A lot of stuff did get moved from spigot into Bukkit

tender shard
#

// Plugin startup logic

young knoll
#

Sadly a bit is still in spigot

buoyant viper
#

but wouldnt be the first time spigot moved to--

#

yeah

tender shard
#

// Plugin shutdown logic

young knoll
#

I think MD said something about licensing

#

But I’m not positive

buoyant viper
#

idk

#

?jd-s sec

undone axleBOT
buoyant viper
#

my first tracker used PlayerToggleSneakEvent

#

but for some reason it kept bugging on me so i rly needed a different event

#

ngl i think i straight up looked at the GSit plugin and had saw the event existed under spigots package LOL

river oracle
#

I hate enderpearls

tender shard
#

you failed to show the full error, so no clue.

my guess is, that library requires java 11 or 17 but you're still on java 8

eternal oxide
#

my bet is no repository

undone axleBOT
tender shard
#

my guess is, that library requires java 11 or 17 but you're still on java 8

#

however no clue if that's really the issue, you haven't sent the full maven log

eternal oxide
#

no repo

tender shard
#

its on central

eternal oxide
#

it is?

timid hedge
#

This works

        <dependency>
            <groupId>io.github.cdimascio</groupId>
            <artifactId>dotenv-java</artifactId>
            <version>2.3.2</version>
        </dependency>
eternal oxide
#

ah ok

timid hedge
#

Thanks

tender shard
#

np. next time you should just read the readme of the libraries you're using lol

undone axleBOT
river oracle
#

is PlayerQuitEvent still called on server shutdown or should I just do a loop through all players

tender shard
#

it does work, you're just using it wrong / did not include or create an .env file

timid hedge
#

But i have?

cinder abyss
#

Hello, how can I set a ItemDisplay in the back of the player ?

zenith gate
#

What event checks for when a Totem of Undying is used?

tender shard
#

PlayerREsurrectEvent

#

Entity*

tender shard
zenith gate
tender shard
#

note that this event is always called on death, but it'll be cancelled if they dont have any totem

young knoll
#

That’s

#

Odd

zenith gate
#

thats stupid

tender shard
#

Called when an entity dies and may have the opportunity to be resurrected. Will be called in a cancelled state if the entity does not have a totem equipped.

zenith gate
tender shard
#

well I think it makes sense, it's more like an "attempt to resurrect" event. and you can uncancel it to e.g. create additional items similar to totems

river oracle
young knoll
#

So if you uncancel it

#

Does the player not die

tender shard
zenith gate
#

theyll resurect?

tender shard
young knoll
#

Interesting

zenith gate
#

Okay, well now knowing this, it brings other ideas to the table lol.

tender shard
cinder abyss
#

Hello, how can I move exactly a ItemDisplay like this using translation ?
(Black dot is where I want the ItemDisplay to be)

young knoll
#

Neat

tender shard
cinder abyss
young knoll
#

It’s the male symbol

#

β™‚

cinder abyss
tender shard
young knoll
#

Men do poop

eternal oxide
#

its just getDirection().multiply(-0.5)

young knoll
#

I can confirm

cinder abyss
#

I was doing
itemDisplay.getTransformation().getTranslation().set(player.getLocation().getDirection().multiply(-1).toVector3f());

glass mauve
#

im currently trying to unit test my plugin.
now some parts of my code use this

Bukkit.getServicesManager().load(...);

and when trying to unit test this I get a NPE because the server is actually not started yet
also I cant mock it because its a static method

tender shard
#

that should work fine in mockbukkit

glass mauve
#

ok thanks

tender shard
#

also otherwise you can just do getServer().getServicesManager() if you got issues with static methods

#

everything that's in bukkit is basically just calling getServer()

cinder abyss
eternal oxide
#

looks like not far enough back

cinder abyss
#
player.addPassenger(player.getWorld().spawn(player.getLocation(), ItemDisplay.class, (itemDisplay) -> {
            itemDisplay.setItemStack(previous);

            itemDisplay.getTransformation().getTranslation().set(player.getLocation().getDirection().multiply(-0.5).toVector3f());
            itemDisplay.setRotation(player.getLocation().getYaw(), player.getLocation().getPitch());
}));```
eternal oxide
#

so multiply by -0.6

cinder abyss
#

with -1, it's the same

glass mauve
cinder abyss
#

so I think -0.6 will do nothing

#

@eternal oxide

eternal oxide
#

-1 its in teh middle of the player?

cinder abyss
#
player.addPassenger(player.getWorld().spawn(player.getLocation(), ItemDisplay.class, (itemDisplay) -> {
            itemDisplay.setItemStack(previous);
  itemDisplay.getTransformation().getTranslation().set(player.getLocation().getDirection().multiply(-0.6).toVector3f());
  itemDisplay.setRotation(player.getLocation().getYaw(), player.getLocation().getPitch());
}));```
eternal oxide
#

I wonder if yrou rotation is moving it around its origin

cinder abyss
tender shard
# glass mauve I need to include papermc repository for it in the pom.xml, but it still works f...

you also need paper-api on your test scope (but ofc you don't need it for anything else)

be sure to add this ABOVE your normal spigot-api declaration

        <!-- Test Dependencies Start -->
        <dependency>
            <groupId>io.papermc.paper</groupId>
            <artifactId>paper-api</artifactId>
            <version>1.19.2-R0.1-SNAPSHOT</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.github.seeseemelk</groupId>
            <artifactId>MockBukkit-v1.19</artifactId>
            <version>2.145.0</version>
            <scope>test</scope>
        </dependency>
        <!-- Test dependencies end -->
unkempt peak
#

General programming question here, what is the most effiecient way to store a large nested list of strings. Basically I'm working on a video player project and I made the code neccessary to convert each frame into a list of material names (ie COBBLESTONE, COAL_BLOCK etc). So i can convert each frame of a video to a list of blocks which I can display in minecraft and Ive already got it working in game with images. But how can i efficiently load an entire video of frames to memory and also should I just store this information in a yml file or something else? I can't get 20 fps without preloading the frames because the conversion process from an image to the list of blocks is about 200ms.

tender shard
#

1.19.2 was the highest supported version when I last checked (although 1.19.4 was already existing back then)

#

because of paper's shitty new paper-plugin.yml stuff, they are/were still on 1.19.2 in mockbukkit

cinder abyss
eternal oxide
#

what does it do if you don;t set the rotation?

eternal oxide
#

so no different

cinder abyss
#

We need to move the itemdisplay using the red line

eternal oxide
#

whats it look like from above?

cinder abyss
eternal oxide
#

does it look the same from above when you do -1?

young knoll
#

It’s possible the direction vector has a weird length

#

Try normalizing it before you multiply

cinder abyss
eternal oxide
#

yep it could be too small

#

then do as coll said, .normalize().multiply(-1)

cinder abyss
#

okay

#

building, multi-modules...

strange wolf
#

Does anyone know how I can add support for relative positions in a command? I got it working where I specify a number, but I'm not sure how to make it so I can do something like /setlocation ~ ~5 ~

cinder abyss
#

@eternal oxide @young knoll

eternal oxide
#

not moving at all

#

I wonder if the toVector3f is not converting properly

cinder abyss
#
@NotNull
    public Vector3f toVector3f() {
        return new Vector3f((float) x, (float) y, (float) z);
    }```
eternal oxide
#

thats the method in Spigot?

cinder abyss
#

yes

eternal oxide
#

you must be setting the translation somewhere else then as moving the offset worked before

cinder abyss
#

getLeftRotation ?

#

or getRightRotation ?

eternal oxide
#

oh you are not setting the transformation back

cinder abyss
#

(and setting after)

#
player.addPassenger(player.getWorld().spawn(player.getLocation(), ItemDisplay.class, (itemDisplay) -> {
            itemDisplay.setItemStack(previous);

            itemDisplay.getTransformation().getTranslation().set(player.getLocation().getDirection().normalize().multiply(-1).toVector3f());
        }));```
#

@eternal oxide

young knoll
#

Yeah you need to get the transformation, modify it, and then setTransformstion

eternal oxide
#

yes you need to store teh transformation, modify it and set it back

glass mauve
cinder abyss
#

-1 is a little too big

#

@eternal oxide

wide coyote
#

I assume ItemDisplay is a 1.20 thing?

young knoll
#

1.19.4

wide coyote
#

really?

#

looks sick tho

young knoll
#

ItemDisplay, BlockDisplay, and TextDisplay

cinder abyss
wide coyote
#

yeah I saw the text one but didnt know about the other ones

cinder abyss
#

with only this :```java
public class CustomBlock {
public CustomBlock(JavaPlugin plugin, ItemStack itemStack, Location location) {
Objects.requireNonNull(location.getWorld()).spawn(location, ItemDisplay.class, (itemDisplay -> {
itemDisplay.setItemStack(itemStack);
itemDisplay.setItemDisplayTransform(ItemDisplay.ItemDisplayTransform.HEAD);
itemDisplay.setTransformation(new Transformation(new Vector3f(0, 0, 0), new AxisAngle4f(0.0f, 0.0f, 0.0f, 1.0f), new Vector3f(1.0002f, 1.0002f, 1.0002f), new AxisAngle4f(0.0f, 0.0f, 0.0f, 1.0f)));
itemDisplay.setBrightness(new Display.Brightness(15, 15));
new BukkitRunnable() {
@Override
public void run() {
itemDisplay.setBrightness(new Display.Brightness(itemDisplay.getLocation().getBlock().getLightFromSky(), itemDisplay.getLocation().getBlock().getLightFromSky()));
}
}.runTaskTimer(plugin, 1L, 20L);
}));
}
}

tender shard
#

blockdisplays will be great for decoration and stuff

#

like furniture etc

cinder abyss
#

for using customModelData

tender shard
#

yeah

cinder abyss
#

@eternal oxide

young knoll
#

And text displays are just better holograms

cinder abyss
#

with -0.5

eternal oxide
#

better

cinder abyss
# young knoll And text displays are just better holograms
public class HoloEntity {
    public ALOT main;
    public Entity hologram;
    public @Nullable LivingEntity attached;

    public HoloEntity(ALOT main, Location location, String text) {
        this(main, location, text, null);
    }

    public HoloEntity(ALOT main, Location location, String text, @Nullable LivingEntity attached) {
        this.main = main;
        if (bukkitVersion.minor() > 19 || (bukkitVersion.revision() == 4 && bukkitVersion.major() == 19)) {
            this.hologram = Objects.requireNonNull(location.getWorld()).spawn(location, TextDisplay.class, (textDisplay) -> {
                textDisplay.setText(text);
                textDisplay.setBillboard(Display.Billboard.CENTER);
                textDisplay.getPersistentDataContainer().set(main.hologramKey, PersistentDataType.INTEGER, 1);
                if (attached != null)
                    textDisplay.getPersistentDataContainer().set(main.healthbarKey, PersistentDataType.STRING, attached.getUniqueId().toString());
            });
        } else {
            this.hologram = Objects.requireNonNull(location.getWorld()).spawn(location, ArmorStand.class, (stand) -> {
                stand.setInvisible(true);
                stand.setInvulnerable(true);
                stand.setGravity(false);
                stand.setMarker(true);
                stand.setCustomNameVisible(true);
                stand.setCustomName(text);
                stand.getPersistentDataContainer().set(main.hologramKey, PersistentDataType.INTEGER, 1);
                if (attached != null)
                    stand.getPersistentDataContainer().set(main.healthbarKey, PersistentDataType.STRING, attached.getUniqueId().toString());
            });
        }
        this.attached = attached;
    }

    public void deleteAfter(long ticks) {
        deleteAfter(ticks, null);
    }

    public void deleteAfter(long ticks, @Nullable BukkitTask task) {
        new BukkitRunnable() {
            @Override
            public void run() {
                hologram.remove();
                if (task != null) task.cancel();
            }
        }.runTaskLater(main, ticks);
    }
}```
cinder abyss
#

need a translation to the left-bottom

#

from red to green

#

@eternal oxide ?

#

well, hum

#

I'm going to sleep, that's all for this night

eternal oxide
#

reduce the +1 on Y

topaz cape
#

whats this new "portalCooldown"

eternal oxide
#

it looks liek you actually want to flip it so the handle is up

topaz cape
#

oh boy.

#

1.20 is going to fuck me up

sullen marlin
#

?xy

undone axleBOT
young knoll
#

Pretty sure there is a getter

topaz cape
tender shard
#

level()

topaz cape
#

oh

#

that works o:

topaz cape
tender shard
#

can also do serverLevel() to directly get a ServerLevel

tender shard
topaz cape
#

oh does it matter?

#

ill just put it as 0 ig

tender shard
#

why don't you set it to the existing cooldown

topaz cape
#

whats the existing cooldown

tender shard
#

portalCooldown?

topaz cape
#

i-

#

ty lol

tender shard
#

can also get it through bukkit

#

Entity#getPortalCooldown()

unkempt peak
tender shard
#

because if not, I wouldnt worry about it

unkempt peak
#

I haven't actually gotten to the point of loading a whole video, Do you think loading it as a nested list is the best way?

flint coyote
#

Wdym by "nested"?

tender shard
#

as I said, I wouldn't worry over what's the "best" way if the current way is working fine lol

unkempt peak
#

Like a list of lists of Strings, each frame is a list of strings and i need to load a list of frames

tender shard
#

how many pixels / blocks does one frame have?

#

I would probably create a class Frame that holds a Material[][] array, then the whole video is a List<Frame>

#

i mean there isn't really any benefit in using a list, your frames will all be of the same size

flint coyote
tender shard
#
public class Frame {
  Material[][] pixels = new Material[width][height];
flint coyote
#

Oh each material is a pixel

#

I didn't catch that

tender shard
#

that's what I assumed

unkempt peak
#

Yeah that's true, I'm just worried about how much memory It will need to have the whole video loaded

tender shard
#

idk

#

enum references are tiny

#

it's just a pointer basically

#

a memory address

#

you can't really make it any smaller than having a Material[][]

unkempt peak
#

Each frame is 380x120 pixels and a 3 minute video is about 4000 frames at 20 fps

young knoll
#

Pretty sure a reference is usually 32 bits

#

Unless you have a big heap in which case it’ll go to 64 bits

flint coyote
#

182.400.000 material references then

tender shard
unkempt peak
flint coyote
#

You could also make a buffer and preload a few frames before you start playing and then while playing you load the rest and remove the already rendered pixels

#

Like every video player basically

topaz cape
unkempt peak
tender shard
#

or did I calculate wrong?

one reference = 8 bytes

380*120 = 45600 references per frame
3 minutes * 20 fps = 3600 frames

3600* 45600 * 8 = 164160000 bytes
#

which is 1251.25mb

#

you could ofc make this smaller by using shorts or ints and mapping them to a material during the time you need it

#

e.g. instead of Material[][] you could have short[][]

flint coyote
trail coral
#

does hypixel have its own bukkit fork ?

unkempt peak
#

Do you think it's even worth making a buffer or should I just load the whole video?

young knoll
#

You can easily map the entire material enum with shorts

flint coyote
#

Is it a public plugin or for yourself?

trail coral
#

what the fuck is happening rn

young knoll
#

You can just use the ordinal value

unkempt peak
#

It may be a public plugin eventually

tender shard
flint coyote
tender shard
unkempt peak
#

I think they mean start with just loading it all to memory for now and make a buffer later

flint coyote
#

Well would need to adjust the buffer size depending on the video length

#

Or optimize the 200ms ofc

tender shard
#

as said, I'd just load it completely using a List<Frame> where Frame got a short[][] for the pixels, and a static Map<Short,Material> to translate it back to materials. 300mb for 3 minutes, that's not worse than any other uncompressed video codec

young knoll
#

You don’t even need the map

#

Just use the short to get material via the array

trail coral
#

DOES hypixel have its own bukkit fork?

flint coyote
#

300mb is fine. 1.2gb is pretty rough for a public plugin that might be run on one of those 2gb vservers

young knoll
trail coral
#

do we know the name or anything about it

young knoll
#

No

flint coyote
#

it's not public

trail coral
#

no shit

tender shard
young knoll
flint coyote
# trail coral no shit

Well why do you need a name then? They can call it "Carlos" and it won't help you at all to know that

unkempt peak
#

Ok thank you guys for all the input, I appreciate it

tender shard
trail coral
#

when i ask a question please answer it if you know the answer. dont make me ask 5 more questions and answer some of yours before i get to the answer

tender shard
flint coyote
#

Sometimes you gotta ask questions to fully understand what the other person actually wants to achieve

#

But sure, I'll just not answer you at all if unsure, don't worry

trail coral
tender shard
#

the name is indeed carlos

worldly ingot
#

Nobody knows the name of the fork aside from those that work at the company. Everything is under NDA

#

And like Fabsi said, even if you knew it, it wouldn't really help you in any way.

#

The fork isn't public. It's privately maintained

trail coral
#

it might be for research reasons... why do you need to know why i want the answer

worldly ingot
#

I don't need to know. I don't care at all why you want to know. I'm just informing you that you will not find out

young knoll
#

I bet they just call it like

#

HypixelSpigot

worldly ingot
#

Probably

young knoll
#

No reason to give it a fancy name

tender shard
#

well their bungee fork is called "Hypixel BungeeCord (1.3.22)" lol

worldly ingot
#

Then an educated guess would be just Hypixel Spigot, yeah

tender shard
#

i will still refer to it as carlos

worldly ingot
#

Carlos sounds better

trail coral
#

who even maintains it admins never talk about the forks at all and most devs only work on skyblock (admins are also developers)

flint coyote
#

agreed, carlos all the way

trail coral
worldly ingot
#

Administrators aren't developers. Though like I said, things are under NDA. They can't speak about it

tender shard
worldly ingot
#

The developers as a collective whole probably maintain it

#

Adding things as they need to, updating as necessary

flint coyote
worldly ingot
#

Must have been written in fine print

tender shard
#

rumors say it's also possible to join their team if your second name is carlos

remote swallow
#

in their nda it makes them refer to everything relating to hypixel as carlos

#

even themself

worldly ingot
#

That must be extraordinarily confusing

remote swallow
#

yo carlos we working on carlos and carlos later tocarlos

tender shard
#

you're HIV carlos

flint coyote
#

Now I feel like naming the next plugin I release "Carlos" for no reason at all

#

Carlos API

worldly ingot
#

Wasn't Carlos the name of the reward Creeper on Mineplex?

#

Oh it was Carl

#

I was close

#

His full name was probably Carlos

remote swallow
#

carl is short for calos

flint coyote
#

Maybe Carlos was his last name.
Carl Carlos

remote swallow
#

carl(os) carlos

tender shard
tender shard
#

carlos ftw

flint coyote
#

I'm planning to make a testserver for the Engine/API I'm currently working on. If you release that I'll place Carlos in the center of the Demo-Area

tender shard
#

/bal
You have 27.3 carlos coins

Carlos joined the game

/tpa carlos

Carlos was shot by Carlos using Carlos

#

CarlosMC

flint coyote
#

You got no Carlos to use Carlos

tender shard
#

hmmm Carlos is a portuguese restaurant in my city

young knoll
#

Okay new plugin time

tender shard
#

anyone living near mΓΌnster and wanna go to Carlos with me next weekend?

young knoll
#

Use packets to replace every username with Carlos

#

Everywhere

tender shard
#

no, not just the username. replace all the players with carlos

young knoll
#

Sure why not

tender shard
#

like, their skin too, and their behaviour

flint coyote
#

Tablist full of carlos

#

Also on creeper explosions they shouldn't destroy everything and instead just place a Carlos on the point of "impact"

#

Can't wait to have a bunch of Carlos' in my survival world

tender shard
flint coyote
#

I like it, except that you Classname starts lowercase

#

No Carlos would ever do that

young knoll
#

Dear god obfuscation is cursed

flint coyote
#

That's the only reasonable obfuscation for spigot plugins

tender shard
#

lol the AtomicReference

#

everything's like carloscarloscarloscarloscarlos x 1000

#

except that

#

the atomic is just called "carlos" lmao

flint coyote
#

why isn't "stringBuilder" obfuscated? Atleast rename it to carlosBuilder

tender shard
#

the decompiler made up that name

#

it has no name in bytecode

flint coyote
#

oh

#

Perfect support e-mail for carlosMc

tender shard
flint coyote
tender shard
#

Ah yes! Great

#

my bf is confused because i kept calling him carlos

flint coyote
#

Time to tell him about our new insider

#

Also we need ?carlos

tender shard
#

Yeah

#

@ivory sleet we need a ?carlos command

flint coyote
#

What will it do though?

tender shard
#

Hm

#

Typical carlos stuff i guess

flint coyote
#

"There isn't a perfect answer to your question. However you can't go wrong with Carlos"

#

Carlos the new spigot mascot

tender shard
#

give it 2 days and conclure will be talking about the "carlos anti pattern" or sth

flint coyote
#

carlos is the total opposite of an anti pattern

tender shard
#

one could consider that violating the carlos principle is an antipattern

#

"dude why is your class called 'freezecommand'? It should be called CarlosCommand"

flint coyote
#

Yeah typical beginner programming mistake - one should know about the carlos principle

tender shard
#

ikr?

#

what a boon

#

everyone learns that i nfirst semester of CS (carlos science)

nova notch
#

sorry to interupt your carlosing but whats the best/easiest method of having variables for players like kills or whatever thats easy to constantly change the value of?

#

and why am i still banana robot

young knoll
#

PDC

tender shard
#

do you need that data available for offline players?

#

if not, yeah PDC

flint coyote
nova notch
#

fr

tender shard
#

I'd definitely use the PersistentDataCarlos for stuff like that

young knoll
#

Oh yeah I need to work on that offline player api

flint coyote
#

Would it be reasonable to name the "EventEngine" I'm working on Carlos?
I mean it's in order to have fully ingame customizable Challenges/Settings/Events per Region which can be added via creating a plugin based on the API.
Might aswell name it Carlos.

nova notch
#

go for it

#

anyway PDC is really long and i dont like it so is there something i could do to make my own custom thing so like player.setVariable would run the PDC stuff

young knoll
#

You can make a wrapper for it

#

But java doesn’t have extension methods

flint coyote
nova notch
#

its long

#

cus you got the key and persistent data type and idk

tender shard
#
public final class PDC {
    public static interface Type<P,C> extends PersistentDataType {}
    
    public static <T> void set(Player player, String key, Type<?,T> type, T value) {
        player.getPersistentDataContainer().set(NamespacedKey.fromString(key, myPlugin), type, value);
    }

    public static <T> T get(Player player, String key, Type<?,T> type) {
        return player.getPersistentDataContainer().get(NamespacedKey.fromString(key, myPlugin), type);
    }
}
#

just write a utils method for getting/setting that auto creates the key, and extend PersistentDataType to use a shorter name

#

then use it like this

PDC.set(player, "age", PDC.Type.INTEGER, 27);
int age = PDC.get(player, "age", PDC.Type.INTEGER);
tender shard
nova notch
#

ok i was gonna have chatgpt make it but i guess that works

flint coyote
tender shard
#

lmao

#

Keyo

buoyant viper
#

publico statico voido

#

jesus christ

tender shard
#

me gusta

young knoll
#

Not bad considering chatgpt doesn’t really know what carlosify means

tender shard
#

I'll go back to university and study Carlosophy

nova notch
#

chatgpt actually goes crazy with basic stuff like i converted skript to java in 2 seconds

flint coyote
#

what about your CS (carlos science) degree?

flint coyote
tender shard
#

well then fix the method signature

#

change DataType<?,T> to PersistentDataType<?,T> in the set and get method's signature

#

works fine

nova notch
#

o

rare rover
#

is it wise to do this?

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent e) {
        Player player = e.getPlayer();
        if (manager.hasData(player).join()) {
            manager.loadData(player);
        } else {
            manager.createData(new GenPlayer(player));
        }
    }``` each `manager` execution is a `CompletableFuture` in this situation
#

so 2 threads per join

#

i dont imagine it's a huge deal

flint coyote
#

If manager is backed by a FileConfiguration that file is held in memory anyway. Therefore the hasData can be done without a completable future.

rare rover
#

its sql

flint coyote
#

But generally speaking, no it's not a huge deal.

rare rover
#
    @Override
    public CompletableFuture<PlayerData> loadData(@NotNull Player key) {
        return CompletableFuture.supplyAsync(() -> {
            String SQL = "SELECT * FROM players WHERE uuid=?";

            try (Connection conn = connection.getConnection().join()) {
                PreparedStatement statement = conn.prepareStatement(SQL);
                statement.setString(1, key.getUniqueId().toString());

                try (ResultSet result = statement.executeQuery()) {
                    if (result.next()) {
                        UUID uuid = UUID.fromString(result.getString("uuid"));
                        Player player = Bukkit.getPlayer(uuid);
                        PlayerData data = new GenPlayer(player);

                        SQLStorage.getDataMap().put(uuid, data);
                        return data;
                    }
                }
                return null;
            } catch (SQLException e) {
                e.printStackTrace();
                return null;
            }
        }).exceptionally(e -> {
            throw new RuntimeException("There was an error loading data", e);
        });
    }```
#

alr

worldly ingot
#

If you're working with CF, join() is pretty much a no-go

rare rover
#

okay

worldly ingot
#

You're going to thread block which completely negates the purpose of CFs

rare rover
#

so what should i use instead?

young knoll
#

There’s an async pre login event which is good for loading data

worldly ingot
#

^

#

Don't have to use CFs at all in that situation, or at least it's fine to .join()

buoyant viper
#

async code, but synchronously waiting for it to finish AbsoluteHalal

flint coyote
#

Why does the .join() Method even exist when it's blocking? Why would I even use a CompletableFuture then?

buoyant viper
#

you know what u get when u rearrange Corals?... Carlos

#

everything leads back to Carlos

flint coyote
#

That's actually true. Hey @neon nymph !

#

We were talking about your brother Carlos

neon nymph
#

Hello! Is there like a unique way to get the Directional BlockData of a block? I'm getting a cast exception when I try to cast the BlockData of a Sign block to Directional.

                event.getBlock().setType(Material.OAK_SIGN);
                Directional dir = (Directional) event.getBlock().getBlockData();
                dir.setFacing(event.getPlayer().getFacing().getOppositeFace());

And here's the cast exception:

java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_20_R1.block.impl.CraftFloorSign cannot be cast to class org.bukkit.block.data.Directional (org.bukkit.craftbukkit.v1_20_R1.block.impl.CraftFloorSign and org.bukkit.block.data.Directional are in unnamed module of loader java.net.URLClassLoader @2b05039f)
``` Surely the sign block's BlockData can be casted to Directional, right?
neon nymph
young knoll
#

Signs are not directional

#

They are rotatable

worldly ingot
quaint mantle
#

What is the three letter abbreviation for the Addressing mode of the instruction "coma" in assembly?

#

I thought it was IMM but it's not

flint coyote
worldly ingot
#

What if it's not your library?

neon nymph
#

Thanks lol

#

What a brain fart

flint coyote
#

Even if it was yours, it's probably reasonable to not create a seperate function just to call it with a completeable future

young knoll
#

Ye just make a single one and use get when you can afford to block

formal vector
#

I'm wanting to periodically run something specifically while a block is loaded (or alternatively identify the amount of time that given block has been loaded since a certain point in time) - is that any realistic or should I look for a different approach?

flint coyote
#

what do you mean by "while the block is loaded"? The block being in a loaded chunk?

formal vector
#

yes

young knoll
#

You can use the ChunkLoadEvent and unload event

formal vector
#

mmm alright

flint coyote
#

then you can keep track of the ChunkLoad And ChunkUnloadEvent and start/stop your scheduler. If you have multiple blocks you can keep the scheduler running and iterate a list with currently loaded blocks

formal vector
#

cool, thanks

#

I'll try it

quaint mantle
#

How can I make it so players can toggle whether they want blocks to stack or not with Rose Stacker?

vapid verge
#

How can you check if a player sets a banner inside a loom. When an InventoryInteractEvent triggers, would you just check the position the banner is supposed to be in the loom, and if its there?

hardy minnow
#

Anyone experienced with changing the display name above a player's head using packets? Looking to not use a scoreboard solution due to conflicting plugins

#

1.19.3 * . NameTagApi has not been updated to this version

zenith gate
#

Does every mob in minecraft have a UUID? and the LivingEntity does that consist of every assumed to be alive entity? E.g. Villagers, cats, wolfs, etc.

buoyant viper
#

probably

white root
#

From net.md_5.bungee.api.ChatColor (not org.bukkit.ChatColor), is it possible to get the char that is associated with any given ChatColor?

I know that bukkit's ChatColor.WHATEVER has the .getChar() method, but how can I get it from a bungee ChatColor?

edgy crystal
#

is there any chance i can connect my spigot servers & my bungeecord so i can get my bungeecord playerdata on my spigot server, like an API?

buoyant viper
#

ChatColor#getByChar?

white root
# buoyant viper ChatColor#getByChar?

I think I need the opposite of that

This returns a ChatColor given it's char (i.e. k)
I need a thing that given a (bungee) ChatColor, returns the char
(I.e. given ChatColor.MAGIC, returns k)

buoyant viper
#

ah

#

so it looks like .toString() /should/ return something close, the docs say formatting code char + color code char

#

so u would just need to .substring(1)

#

maybe itd be a neat idea to PR a method to the api such as .getChar() or .getCode(), hmm

white root
rare rover
#

can you edit an enum?

#

like ENUM("message")

#

can i edit the string?

#

and will it save

#

i've too lazy to try it myself

#

xD

drowsy helm
#

if the string isnt final and is public you can

#

or use reflection

rare rover
#

hmm alr

#

would it be wise to make enums store my config messages?

#

just makes the code look cleaner to me

drowsy helm
#

config messages?

rare rover
#

ye like it'll store a config message

#

in param 1

drowsy helm
#

oh

#

just read the config in the enum constructor

#

then you dont need to pass it in the params

rare rover
#

so i can do Messages.SOMETHING

rare rover
#

ty

drowsy helm
#

wait nvm wont work since itll initiate before the plugin does

rare rover
#

oh shoot

#

alr i'll just make a class for it then

drowsy helm
#

just use getter setter on the variable and change it

rare rover
#

like this?

    enum Messages {
        MESSAGE("message");

        String message;

        Messages(String message) {
            this.message = message;
        }

        public void setMessage(String message) {
            this.message = message;
        }
    }```
#

which would require a get method

#

but

#

if im understanding you correctly

drowsy helm
#
    enum Message {
        MESSAGE;

        String message;

        public void setMessage(String message) {
            this.message = message;
        }
    }

    public class YourPlugin{
      for(Message msg : Message.values()){
        String configValue = //load form config
        nsg.setMessage(configValue)
      } 
    }
#

no point having the value in the constructor if you're gonna load over it

#

unless you want a default

rare rover
#

ah alr

#

thanks

#

would enums be good for this?

#

idk

#

it seems better to look at

drowsy helm
#

yeah its clean

rare rover
#

alr

wet breach
#

The way to make an enum value change is make the enum hold an object. If its a string like you have above you cant change it unless you use reflection and you have to change it before the enum class loads. Enums are static final

vapid verge
#

How do you find the specific spot in an inventory? Looking to see if a banner is placed in a loom in the banner slot

orchid trout
#

get the PlayerInventory and im sure there is a #getSlot() method

vapid verge
#

its an array right? how do you know which position is which?

orchid trout
#

there is a pattern

#

you can print the slot to the console every time you click

#

debug

grizzled oasis
#

Hi, something to ask im making this code
https://paste.md-5.net/kaxefesixa.cs
Something im asking how can i check when the player removes the pickaxe from his inventory so that way i can remove the levels from exp bar.
Context: im making this pickaxe level system that uses the exp bar to show how many level you have, i need only to save in an hashmap and then removes but how can i check that

vapid verge
#

Oh fair. I think I'm just going to check that the players cursor is empty. With my other check, it'll only trigger when the player clicks inside a loom with a banner and when after the click the cursor is empty. I think theres only one slot in a loom that can happen lol

obsidian plinth
#

how does itemadders do their black screen when u load the texture pack

grizzled oasis
obsidian plinth
#

i mean on join i wanna make sum that shows 100% a black screenw iwth a custom img i set in the middle and ima kinda lost

grizzled oasis
obsidian plinth
#

no like when they login i want it to display the img until they click e

grizzled oasis
#

im confused because never heard other than cosmetic core having this feature

obsidian plinth
#

what i want to add is when a user joins my server it shows 100% a blackscreen with a img i set in the middle

#

im talking about making sum like it but dont know what docs to look into

grizzled oasis
obsidian plinth
#

NO U WOULDNT

#

READ

white root
grizzled oasis
#

I'm trying to understand but its hard, the only thing from itemsadder that are this way are only this

#

only cosmetic core has this feature of clicking in a "gui sort"

clear panther
#

hello im trying to make when a tnt is exploded the block that tnt blow will become fallingblock and get lauched

#
@EventHandler
    public void onExplode(EntityExplodeEvent event) {
        for (Block b : event.blockList()) {
            float y = (float) -2 + (float)  (Math.random() * (2 - - 2) +(1));
            FallingBlock fallingBlock = b.getWorld().spawnFallingBlock(
                    b.getLocation(), b.getType(), b.getData());
            fallingBlock.setDropItem(false);
            fallingBlock.setVelocity(new Vector(0, y, 0));
        }
    }

}
``` end
#

this is my currently code

#

but it didnt work

obsidian plinth
#

how is it hard to understand wanting to show a user a 100% black screen and a img in the middle on join until they hit e

grizzled oasis
vapid verge
#
        Player p = (Player) e.getWhoClicked();
        if (e.getClickedInventory().getType() == InventoryType.LOOM) {
            Inventory loomInventory = e.getClickedInventory() ;
            ItemStack bannerItem = e.getCursor();
            p.sendMessage("Clicked Inside Loom");


            if ((Tag.BANNERS.isTagged(bannerItem.getType())) && !(p.getItemOnCursor().equals(bannerItem))) {
                p.sendMessage("Banner Clicked Inside Loom?");
            }
        }

The second if is not triggering. I know the logic doesn't make sense reading it again. How can I check the initial click, and then check the next check? I guess with persistantDataHolder? Since the first click is a different event from when it places.

obsidian plinth
clear panther
#

HHHHHHHELP AAAA dies

grizzled oasis
#

or use custom characters to help you done that

grizzled oasis
obsidian plinth
#

1.20

#

if the img passes a certain limit it just shows as []

grizzled oasis
#

ok and there are no limits

obsidian plinth
#

i cant get it to cover the screen

grizzled oasis
#

you can't infact most textures puts something into the player with nms like a pumkin, if you have a minigame server its better, i imagine they do this because then there are no explanation on how

vapid verge
#

When a InventoryInteractEvent triggers, is it possible to see what was placed down? I see you can see what's on the cursor, but I want to know what was placed down.

orchid gazelle
#

Could it be that the cursor is the item that got placed down in the first place?

buoyant viper
#

?jd-s for me

undone axleBOT
buoyant viper
clear panther
#

buuut primed tnt is a entity right?

echo basalt
buoyant viper
#

a tile entity :P

vapid verge
#

Oh really?

buoyant viper
#

(i think)

echo basalt
#

So if you're putting an item in an empty inventory, the inventory will be empty and the cursor will be your item

#

If you're shift-clicking, your cursor is empty and your item is your event's currentItem

#

cursor = item that's held
currentItem = item in the clicked slot

vapid verge
#

What happens when the item doesn't land? Such as trying to put an item into an output spot?

buoyant viper
#

hm maybe it is Entity cos of what TNTPrimed extends.. idk

vapid verge
#

Because that still triggers this of course:
if ((Tag.BANNERS.isTagged(bannerItem.getType()))) {

echo basalt
#

But honestly that's like the one question I can't answer here immediately so let me check internals

vapid verge
#

Lol ok. I was thinking I could check the current hand on the player, and see if it wasn't the item that was fired with the event (implying it is no longer in the hand), but I couldn't get that working

jagged quail
#

Hghhhghhhghh

echo basalt
#

ugh it's buried somewhere

jagged quail
#

You

vapid verge
#

oh? So I would need to check the slot they try to place the item on

echo basalt
#

This is the nms slot

vapid verge
#

I'm not familiar with nms, I know it's like the internals, would I need to utilize that? I may not be experienced enough to make that work.

echo basalt
#

No, you wouldn't

vapid verge
#

ah ok cool

echo basalt
#

I'd suggest debugging the InventoryAction that's passed on the event

vapid verge
#

Ok thanks I'll check that

#

I get the type of placement regardless of success, not very useful unfortunately

#

so right click on pickup is pickup_half, left click normally is place_all

#

I could try doing some logic with the slot type maybe. Since result slot and crafting slot are different. I wonder if I need to iterate over the crafting slots of the loom and see if one has the banner

#

getting closer

            if ((Tag.BANNERS.isTagged(bannerItem.getType())) && e.getSlotType().equals(InventoryType.SlotType.CRAFTING)) {
                Bukkit.getLogger().info(e.getAction().toString());
            }

Won't trigger from the output box. Unfortunately it still triggers on the crafting slots that the banner can't go in.

upper hazel
#

i have this code - armorStand.getWorld().createExplosion(armorStand.getLocation(),explore_power); - how get player who take damage

orchid trout
#

listen for entitydamageevent

vapid verge
#
       if (e.getClickedInventory() != null) {
            if (e.getClickedInventory().getType() == InventoryType.LOOM) {
                Inventory loomInventory = e.getClickedInventory();
                ItemStack bannerItem = e.getCursor();

                if ((
                        Tag.BANNERS.isTagged(bannerItem.getType())) &&
                        e.getSlotType().equals(InventoryType.SlotType.CRAFTING) &&
                        loomInventory.getItem(e.getSlot()) == bannerItem) {

                    Bukkit.getLogger().info(e.getAction().toString());
                }
            }
        }

I'm 99% sure that loomInventory.getItem(e.getSlot()) == bannerItem shows as empty always, since this this is running before the item is processed from the cursor into the slot. Does anyone have an idea on how to accomplish what I'm trying to do? Is there an event that triggers when an item enters a crafting inventory slot? I'm guessing I need to catch whatever event happens next to get the data of if the banner is in the slot or not. This ultimately comes from the need to confirm the banner was placed in the slot.

grizzled oasis
#

im running a task async every 1 tick, and im trying to get the levels from the pickaxe "custom" and display them into the exp bar but for some reasons it gives me 0.0 EXP and the exp is same level and it doesn't get displayed
https://paste.md-5.net/ahasapofet.cs

ivory sleet
#

Why is that task async lol

grizzled oasis
#

idk async = better

ivory sleet
#

Haha no

grizzled oasis
#

i know sometimes async = bad but for the meme

upper hazel
ivory sleet
grizzled oasis
ivory sleet
#

EXP is a normal hashmap?

grizzled oasis
#

yes an hasmap with UUID and float

zenith gate
#

I hate dat files and 100% regret working them 😭

smoky anchor
#

isn't that just NBT ?

zenith gate
#

oh idk ive never touched that. not yet at least. im serializing data into dats

#

when it comes to debugging and checking if the data is actually in it. comes a challenge since you cant read it lol.

smoky anchor
#

if it actually is nbt, then just use NBT explorer

remote swallow
#

Nbt explorer

zenith gate
#

its not

remote swallow
#

Smh

grizzled oasis
#

i fixed the levels problem but now the exp gets saved the one from the pickaxe and not the one from the player
https://paste.md-5.net/zivigofica.cs
example
Pickaxe has 200EXP
Player has 20EXP
the player when removing the pickaxe gets the 200 and not the 20 he had originally

smoky anchor
#

On the first tick you set the EXP to the hashmap correctly - the current players xp
But the very next tick, you replace that value with player XP, which is now the pickaxe XP
Adding EXP.contains(uuid) before adding the to the map should fix that

grizzled oasis
#

if(!EXP.containsKey(player.getUniqueId())) EXP.put(player.getUniqueId(), Exprience.getExp(player));

#

only this line should fix everything

smoky anchor
#

Maybe

grizzled oasis
#

works just fine

umbral ridge
#

what is this bullshit

smoky anchor
#

lmao what

umbral ridge
#

i dont know

#

for every new class i try to make

#

it says this

#

nvm fixed it. jre got deselected in build path? XD had to reselect it

buoyant viper
#

loool

umbral ridge
ivory sleet
eternal night
#

eclipse moment

ivory sleet
#

πŸ₯²

grizzled oasis
#

something with math im trying to do,
same code as before for the experience but now i need
if a player sets the config every 1000 blocks are 1 level of exp, how can i calculate exp correctly to then every 1000 blocks give a level?
(this doesn't not depends from minecraft levels experience like every 200000 exp is equals to some level but its forced but should show correctly inside the bar if i have 200 blocks remain it should show like it)

void flame
#

i need anti loot blowup plugin plz help
meaning end_crystals do not blow up the loot when you kill somebody

void flame
vestal pewter
#

Hi,

How should I do to update the scoreboard of a player ?

Like it has a Money value that goes from :

Money : 3 To Money : 4

small current
#

is there anyway to get inventory of a chest without using BlockState?

#

NMS inventory also does it

vast ledge