#help-development

1 messages · Page 2047 of 1

tender shard
#

what the heck is this? PacketPlayOutPlayerInfo.PlayerInfoData

#

it's not called PacketPlayOut... in 1.17+

#

or are you not using mojang mappings?

summer scroll
#

I'm not using mojang mappings too

tender shard
#

uugh

summer scroll
#

I find it more confusing when using mojang mappings, idk why xd

tender shard
#

in the beginning, it's confusing. after that, it makes everything sooo much easier

summer scroll
#

I tried to use that but idk how to reobfuscate it on Gradle before.

tender shard
#

this works totally fine in mojang mappings:

ClientboundPlayerInfoPacket packet = new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER,
                ((CraftPlayer)player).getHandle());
summer scroll
#

Yeah same thing.

tender shard
misty ingot
#

so I did this @tender shard


    private final VillagerPark plugin;

    public transferEco(VillagerPark plugin) {
        super("transfereco");
        this.plugin = plugin;
        mysqlSetterGetter mysql = new mysqlSetterGetter(this.plugin);
    }

and now I cannot use mysql.FunctionsIHaveInIt
I could when it was outside the constructor

summer scroll
#

Making player gamemode to spectator but send a packet tells that player is in creative mode.

tender shard
#

?learnjava

undone axleBOT
tender shard
#

obviously you have now made mysql a local variable

#

you want it to be a field that only gets initialized in the constructor

#
    private final VillagerPark plugin;
    private final mysqlSetterGetter mysql;

    public transferEco(VillagerPark plugin) {
        super("transfereco");
        this.plugin = plugin;
        mysql = new mysqlSetterGetter(this.plugin);
    }

this ^

#

also please use proper names! You use lower case for classes and UpperCase for methods, that just hurts my eyes and everyone else's too

summer scroll
tender shard
manic furnace
#

How can I completely smooth teleport a player? Because in the moment, i teleport the player +0.2D each tick and it isn't smooth. My Problem is, that I have to make it faster, but than it would be more less-smooth.

grim ice
#
  1. naming conventions
#
  1. make a Database interface
tender shard
grim ice
#

that extends the Storage interface

#

so your users have many ways

#

not just mysql

summer scroll
eternal oxide
grim ice
#

and later you could expand your project with mongodb, flat file dbs

tender shard
rotund pond
#

Hello !
I'm trying to get a configurable period for a bukkit task in config files.
What's the thing for a long in a yml file ?
Simply this ?

period: 100

or maybe

period: 100L

?

(I'm using the FileConfiguration#getLong method)

tender shard
rotund pond
#

Okay ty 🙂

tender shard
#

FileConfig#getLong can easily also read integers

#

with using 100L you'll just confuse server admins 😄

rotund pond
#

Okay I see xD

tender shard
#

you can basically ALWAYS use integers when a long is required

#

but other way around, you need to cast it

grim ice
#

dont make it ticks

#

some idiots wont understand

#

make it seconds or milliseconds

tender shard
#

yeah I normally let them enter seconds, then I parse it as double and simply do *20

grim ice
#

and convert it in ur code

summer scroll
rotund pond
tender shard
misty ingot
#
26.03 09:45:30 [Server] INFO java.lang.IllegalArgumentException: Plugin already initialized!
26.03 09:45:30 [Server] INFO at net.md_5.bungee.api.plugin.PluginClassloader.init(PluginClassloader.java:176)
26.03 09:45:30 [Server] INFO at net.md_5.bungee.api.plugin.Plugin.<init>(Plugin.java:36)
26.03 09:45:30 [Server] INFO at com.wonkypigs.villagerpark.mysqlSetterGetter.<init>(mysqlSetterGetter.java:14)
26.03 09:45:30 [Server] INFO at com.wonkypigs.villagerpark.commands.giveEco.<init>(giveEco.java:17)
26.03 09:45:30 [Server] INFO at com.wonkypigs.villagerpark.VillagerPark.registerCommands(VillagerPark.java:84)
26.03 09:45:30 [Server] INFO at com.wonkypigs.villagerpark.VillagerPark.onEnable(VillagerPark.java:24)
26.03 09:45:30 [Server] INFO at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:265)
26.03 09:45:30 [Server] INFO at net.md_5.bungee.BungeeCord.start(BungeeCord.java:285)
26.03 09:45:30 [Server] INFO at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:67)
26.03 09:45:31 [Server] INFO at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)

wtf is even wrong anymore

tender shard
#

and this is my last answer for you unless you fix your class names

short raptor
#

How to check if item stack is null?

quaint mantle
tender shard
#

if(itemStack == null) // it's null

short raptor
tender shard
summer scroll
tender shard
tender shard
#

is that wolf of wall street or great gatsby?

quaint mantle
#

Wolf of Wall Street 🙂

tender shard
#

ah yeah I think it's the scene where he's talking to his father about how all girls are shaved nowadays lmao

quaint mantle
#

Probably lol

summer scroll
tender shard
#

yeah that still seems to be either the player's name or the textures

#

did you actually change the ServerPlayer's textures?

#

I really have no idea, I'd ask in the forums instead

summer scroll
#

Okay, I'll ask the forum.

#

What is the title? I actually don't know how to describe this issue.

short raptor
#

How can I delete the item from an EntityPickupItemEvent? I found this method but it didn't work

summer scroll
tardy delta
#

event.getItem().remove()

#

and event.setCancelled(true) before that

short raptor
#

Okay thanks

tardy delta
#

took me a while to find it in the docs lol

quaint mantle
#

if (items =! null) items = null;

grim ice
#

=!

#

items = null; in front of an if statement

#

compiler screaming rn:

misty ingot
#

so I have this running when a player joins the bungeecord network

                PreparedStatement insert = plugin.getConnection()
                        .prepareStatement("INSERT INTO villagerPark_players (UUID, NAME, ECO, STREAK) VALUES (?, ?, ?, ?)");
                insert.setString(1, uuid.toString());
                insert.setString(2, name);
                insert.setInt(3, 0);
                insert.setInt(4, 0);
                insert.executeUpdate();

but the mysql table is still empty

#

I am using PostLoginEvent

smoky oak
#

have you tried to just change it to onPlayerJoint event

tardy delta
#

the hell is post login event

tender shard
tardy delta
#

o

#

bungee or what?

tender shard
#

yes

#

b000ngey

tardy delta
#

o

grim ice
#

lib idea pls

#

Enchantment library?

#

oh nvm

#

there is one

tardy delta
#

npc library

grim ice
#

milked

#

so no

tardy delta
#

which makes it very easy to write a plugin

#

:

#

(

grim ice
#

I REMEMBERED

#

WHAT I WANNA DO

#

IS

#

Offline players management

#

so u can modify stuff about offline players

#

basically treat them as they were online

#

i need a name for it tho

#

OfflinePlayersManager ig

#

ill have a way that u can like

#

put events on some offline player

tender shard
#

Offline'nt Players

#

OffnlinePlayers

grim ice
#

offlinePlayer.whenJoins((p) -> {
/*
*/
} and
offlinePlayer.whenJoins(Predicate, (p) -> {});

tender shard
#

OnfflinePlayers

grim ice
#

smh

tender shard
#

definitely you'll want it to be a consumer instead of a runnable 😄

grim ice
#

mhm

#

and

tender shard
#

otherwise it's pretty worthless

offlinePlayer.whenJoin(() -> { Bukkit.broadcastMessage("someone joined but no idea who lol"); });
grim ice
#

offlinePlayer.addItem

grim ice
#

you have that dont you

#

but its better for me to make it a consumer

#

so the user can get the player object

#

the online one

tender shard
#

yeah well that's right

#

but

#

no

#

bullshit

#

you must use a consumer

grim ice
#

i will

#

btw

#

if i make the inventory thing

#

do i just change the player.dat

#

file

tender shard
#

imagine you have a class

public class JoinConsumer implements Consumer<Player> {
  //
}
#

you want to allow using this

#

and there you don't have the player object

#

so definitely consumer and not runnable

tender shard
#

I don't know how they do it

grim ice
#

what version should i make my lib tho

#

ill make it 1.17 rn

tender shard
#

running at 60 tps? or running every 60 ticks?

minor garnet
#

60 tps

grim ice
#

bro what

minor garnet
#

minecraft thread is running 20 tps

#

50 ms, or 20 ticks

tender shard
#

don't different packets during a tick get queued and then sent all at once?

ivory sleet
#

yes

tender shard
misty ingot
tender shard
#

this does look like a queue to me

minor garnet
#

hm

tender shard
minor garnet
#

but why when I start a thread and update an array it doesn't crash??

tender shard
minor garnet
#

let me show a example

#

wait

tender shard
#

probably because your packet queue is getting bigger and bigger, carshing the client? or sth?

#

I dont' know, check out the client's logs maybe

minor garnet
#

let me make a video

smoky oak
#

how do i make a particle linger for a specific amount of time?

summer scroll
smoky oak
#

that just spawns it again

#

i want to know if i can increase particle lifespan

summer scroll
#

Each particle has it own fixed lifespan.

fierce glacier
#

How toi create a variable of second type

#

?

smoky oak
#

usually its variableType variableName

fierce glacier
#

Yeah but what si the type ?

smoky oak
#

variableType

#

thats why you write that before the name

fierce glacier
#

I need the name of the type

#

I know how to declare a variable

smoky oak
#

context please

#

?paste

undone axleBOT
fierce glacier
#

on line 35, i need to use seconds

#

not a integer

#

but i don't know what is the type of second

#

for exemple

#

the type of a simple number is " int " or " integer "

smoky oak
#

lemme check

desert marten
#

You mean float/double?

smoky oak
#

thats weird my java doc says this

desert marten
#

Tick = 1/20s, just a reminder

fierce glacier
desert marten
#

What

fierce glacier
desert marten
#

Of course, game runs at 20 ticks usually

#

20 ticks per second

fierce glacier
#

PotionEffect potionEffect = new PotionEffect((PotionEffectType) PotionEffectType.ABSORPTION, 30, 0);

this give the effect for 0 second

#

why ? xD

smoky oak
#

actually

#

it gives you 'no effect'

#

cuz the amplifier is 0

#

anything times 0 is 0

#

as such

#

no effect

#

change it to 1

fierce glacier
#

false because 0 is for level 1 of effect

desert marten
#

Yeah most likely

fierce glacier
#

i have tested this

summer scroll
#

Amplifier starts at 0, no?

fierce glacier
desert marten
#

Maybe the code isn't being executed

#

Or

#

You're not giving it to the player

#

/ entity

fierce glacier
#

the code is executed

desert marten
#

Whatever

fierce glacier
#

i have the effect for exactly 0 second

#

but i can view it for this time

desert marten
#

Try 10 seconds

summer scroll
#

The duration is only 30 ticks

desert marten
#

Not 1.5s

summer scroll
#

Which is 1.5 seconds.

fierce glacier
#

it's logic i think

summer scroll
#

20 tick is 1 second, and you put 30 ticks on the PotionEffect duration

fierce glacier
#

yup thank

#

i go test

fierce glacier
sacred mountain
#

hey this is m,ore of a general question, but intellij cannot seem to access javafx imports?

#

so ive just added it

#

import is fine

#
  bad class file: C:\Users\Gaming\.m2\repository\org\openjfx\javafx-controls\19-ea+3\javafx-controls-19-ea+3-win.jar(javafx/scene/control/Alert.class)
    class file has wrong version 55.0, should be 52.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.```
how do i fix this? or change the version
tender shard
#

compile with a more recent version of java

sacred mountain
#

it worked on my mac tho

#

now its not working on my windows machine

vocal cloud
#

Kinda weird to use java 11

tender shard
tender shard
#

52 is java 8

#

so you're using java 8 on windows but javafx requires java 11+

vocal cloud
#

17s got a lot of stuff as well. Might as well

tender shard
#

yeah but after all they aren't using java 11

#

they are using java 8

vocal cloud
#

I'm reading the error wrong. I need my morning coffee

vocal cloud
#

I need to start a blog lol

vocal cloud
#

Because you're concurrently modifying a collection

minor garnet
#

so, how i can fix that problem?

vocal cloud
tender shard
vocal cloud
tender shard
vocal cloud
#

I'm learning react native so maybe I'll use that to build a nice website for myself kekw

arctic moth
#

it used to work now it doesnt

#

¯_(ツ)_/¯

vocal cloud
#

When you build or on the server?

#

mvn clean

arctic moth
#

in build

#

i cant import it

#

is it just intellij being shit?

vocal cloud
#

trying running clean see if that fixes it

arctic moth
#

it just froze lol

#

thats a great sign

vocal cloud
#

if it's intellij invalidate caches. But clean usually fixes things

arctic moth
#

its still frozen

#

bruh

#

intellij is a great ide

vocal cloud
#

I think intellij crashes once a year for me

#

Intellij saves more time than it costs. Hence why it's so popular lmfao

arctic moth
#

ikr

smoky oak
#

if i have a class b extend interface a and a HashSet<a> containing band call a method in a that's overwritten by b by doing for(a item : set){item.method()}, does it execute the method in b?

arctic moth
#

its nice for syntax and shit, but its always breaking

#

lol now it works after taskkilling it ¯_(ツ)_/¯

#

decided to actually download the packages

#

dependencies

#

whatever they call it for java

keen basin
vocal cloud
keen basin
vocal cloud
#

If it's code you can use pastebin

#

?paste

undone axleBOT
vocal cloud
#

java.lang.NullPointerException: Cannot invoke "me.ag4.cloudsmc.Main.getConnection()" because "me.ag4.cloudsmc.Test.plugin" is null answer is right there

keen basin
vocal cloud
#

Of course you can

night copper
#

How do I make so that NPCs spawn in a jungle, like villagers spawn in a village, the same concept

keen basin
keen basin
smoky oak
#

does org.bukkit.configuration.configurationSection::getIntegerList() return a ordered list?

tardy delta
#

arraylist iirc

vocal cloud
#

ordered as in a list where position matters? yes. Sorted? You'll probably have to sort it yourself

tender shard
#

Even if it returns an arraylist today, it could be sth different in the next update

night copper
smoky oak
grim ice
#

How do I serialize a uh

#

HashMap<OfflinePlayer, Set<ConditionalConsumer<OfflinePlayer>>>

#

the ConditionalConsumer is a predicate with a consumer

keen basin
vocal cloud
#

You really should use dependency injection instead of a static instance

grim ice
#

thats not it

ivory sleet
#

That’s hard

grim ice
#

he never initialized the connection varaible

ivory sleet
#

Best way is to make a registry of said consumers or sth

vocal cloud
ivory sleet
#

Then each consumer would be associated with a key, and then you merely use the key as an identifier

grim ice
#

conclure rn what im doing is

#

im making a library

#

for manipulating offline players

#

the ConditionalConsumer is for a method for OfflineUser class

#

(whenJoins)

#

so u can do smth like this

#

OfflineUser.from(offlinePlayer).whenJoins(player -> true, player -> /* */)

#

but i thought

#

what if the server closes

#

and the player hasnt joined yet

worldly ingot
remote light
#

how to ad multiple alians?

worldly ingot
#

but you're never going to be able to serialize a predicate unless you hard-code in some predicates and associate them with ids

#

because you can't serialize Java code ;p

worldly ingot
remote light
#

thanks you ❤️

sterile token
#

Sorry

#

Any api for dealing with blocks on 1.18.2 smth like World edit. I want to use it for a protection plugin

onyx fjord
#

whom pinged me

unreal quartz
#

@onyx fjord

onyx fjord
sacred mountain
sterile token
sacred mountain
onyx fjord
sterile token
#

But the plugin name of intellij?

sacred mountain
#

Dracula

onyx fjord
#

dracula theme

sacred mountain
#

theme

#

trash panda theme is also nice

onyx fjord
#

na bro only dracula

sacred mountain
#

but i dont like how some highlights are red, which throws me off lol

#

so i use dracula

sterile token
#

But my Intellik doesnt have Dracula

#

Idk why

onyx fjord
#

dracula has even its own history

sterile token
#

I have the 2022 beta versión

onyx fjord
#

creator of dracula had a surgery

#

but someone stole his laptop in hospital

#

he had to redo all configs

#

and decided to make his own theme

sterile token
#

Hmn si what making ref

#

I didnt understand

#

Sorry

onyx fjord
sterile token
#

Ah thst why

#

I cannot find the theme

onyx fjord
#

uh

#

its also for intellij

#

and like 190 apps

#

lol

sterile token
#

But intellij 202w beta doesnt contains it

#

I cannot find it there

onyx fjord
#

probs because its beta

sterile token
#

Kaper do you also have experience with nodejs templates?

#

Templates applied to website

desert musk
#

public void onJoin(PlayerJoinEvent e) { e.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(2); }

what'd i do wrong lol

tender shard
#

get the Bukkit recipeIterator

#

then check out every recipe's result

#

erm I mean ingredients

desert musk
#

🧑‍🍳

tender shard
desert musk
#

when they join the server

tender shard
#

should work. did you try without any other plugins?

desert musk
#

yeap

vocal cloud
#

maybe set the players health as well. I've had many issues with messing with the max health attribute

desert musk
#

mm

sterile token
#

MikeShadow do you have experience with vectors?

tender shard
desert musk
#

yes

#

omegadance

tender shard
#

there you go

sterile token
#

Because i need to calculate a radious of blocks (doesnt matter how much) based on a center custom block

vocal cloud
#

I've used vectors but not with spigot

desert musk
#

thank you

tender shard
#

np lol

sterile token
tender shard
sterile token
tender shard
#

get the block's distance from the origin block, done

#
if(block.getLocation().distance(otherBlock.getLocation()) > 10) { ...
#

but you should rather use distanceSquared instead

sterile token
#

Let say I put a block on coord x=0 and z=0, them based on thst block I cannot break in radio of some blocks

#

Would that apply the same?

tender shard
#

yes?

sterile token
#

Hmn im so confused

tender shard
#

about what

vocal cloud
#

life, the universe and everything

sterile token
#

On place event if my custom block I save the location. And them on break event im getting the block and the location

#

But i dont know how to it using radio

tender shard
#

as I said

#

Location.distance(otherLocation)

sterile token
#

So the protection protect a round of 20 blocks botton, top, right and left

grim ice
#

distanceSquared

#

i think

#

cuz distance is intensive

#

im not sure tho

sterile token
#

So i just need to save each protection block location

#

Allr thanks

viral crag
#

2(pi)r - if you actually want to calculate it from the circumference

sterile token
#

get the block's distance from the origin block, done

#

That so?

#

I dont understand math

#

So if you can do a example

tender shard
#
    private static final int PROTECTION_DISTANCE = 20; // 20 blocks
    private List<Location> protectedBlocks = new ArrayList<>();
    
    @EventHandler
    public void onPlace(BlockPlaceEvent event) {
        for(Location protectedLocation : protectedBlocks) {
            if(protectedLocation.distance(event.getBlock().getLocation()) >= PROTECTION_DISTANCE) {
                event.setCancelled(true);
            }
        }
    }
#

no math needed

viral crag
#

2 pies in a circle

tender shard
#

but yeah you should use distanceSquared instead, and not 20 but 20*20

sterile token
tender shard
paper geode
#

what is the difference between distance and distancesquared

tender shard
#

distance = 20
distanceSquared = 400

sterile token
#

I thought you were ssving every block location from the protection

paper geode
#

right

#

ive heard that distancesquared is lighter

#

is that right?

tender shard
#

yes, distance has to calculate the square root while distanceSquared doesn't have to

#

and since sqrt(400) is harder to calculate than 20*20, better use distanceSquared

viral crag
#

Distance squared is area for a rectangle

tender shard
paper geode
#

aight, thanks

tender shard
#

distanceSquared is just distance * distance

paper geode
#

will be replacing distance now 😳

tender shard
#

didn't you all have maths in school? 😄

#

pythagoras

viral crag
tender shard
#

a^2 + b^2 = c^2

#

so to get c, you have to sqrt(a^2 + b^2)

#

but you don't need it to just compare it to a given distance since you could easily square the given distance

viral crag
#

is wondering why we went from circles to right angle triangles.... maybe breakfast will help

vocal cloud
#

Because

tender shard
#

example, let a be 1 and b be 2
1*1 + 2*2 >= 3*3?
easy.

but
sqrt(1*1 + 2*2) >= 3 involves getting the square root, which is just not needed if you simply also square c (3 in this case)

sterile token
#

Now im 4th of bachiller doing computer science

viral crag
#

Cos^2 p + sin^2 t = 1 is where we have all the fun

worldly ingot
viral crag
tender shard
#

everyone talking about squares and waves here. I think it's time for me to mess with some synths again

viral crag
#

Zither time?

tender shard
viral crag
#

wonders if the eggs will taste like tuna ...

vocal cloud
worldly ingot
tender shard
#

I don't know the english word for "Napf" lmao

vocal cloud
#

Water bowl

worldly ingot
#

We'd just call that a water bowl

#

Yeah

tender shard
#

oh yeah

#

makes sense

worldly ingot
#

but water station sounds so much cooler

#

lmao

vocal cloud
#

Yeah

tender shard
#

but my accent isn't that bad

#

my english is quite good I think >.<

vocal cloud
#

It's beautiful stfu

worldly ingot
#

Yeah your English is fine lol

tender shard
#

anyway I found the cable lol

worldly ingot
#

Miraculously

viral crag
#

The mouse pad jumped to escape the cables?

tender shard
#

Its one of those angry looking usb cables

tender shard
sterile token
tender shard
#

you know, where you put cables inside that you use once per decade

sterile token
#

Oh you get your mouE on water

#

I wsth it without audio

#

And dont understand

#

So now I u. Derstand

tender shard
#

yeah all you people were talking about sinus and squares and waves so I wanted to get my synth running again

#

so I needed a cable

#

and that's what caused the mousepad to fall into the dog's "water station"

sterile token
#

Alex do you know Where I can buy arduino modules?

tender shard
#

ebay

sterile token
#

Here they are too expensive

tender shard
#

amazon is much too expensive

#

get them from ebay

viral crag
sterile token
#

Because my country tax me if products are $+200 and them I have to pay the Product price and extra for "derecho de importaxion"

desert musk
#

main:

` public RespawnBonus other;

@Override
public void onEnable() {
    // Plugin startup logic
    System.out.println("Grabbing registerEvents");
    getServer().getPluginManager().registerEvents(new RespawnBonus(), this);
    getServer().getPluginManager().registerEvents(new BedNerf(), this);
    getServer().getPluginManager().registerEvents(new LimitMaxHealth(), this);

    other = new RespawnBonus(this);
}`

respawnbonus:

` private Softcoresmp mainClass;

public RespawnBonus(Softcoresmp main) {
    this.mainClass = main;
}
public RespawnBonus() { }

@EventHandler
public void onRespawn(PlayerRespawnEvent e)
{
    Bukkit.getScheduler().runTaskLater(this.mainClass, task -> {
        e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING,600, 2));
    }, 5L);
}`
tender shard
desert musk
#

maybe i should send these as text files

tender shard
#

or ?paste

undone axleBOT
tender shard
#
    public RespawnBonus other;

    @Override
    public void onEnable() {
        // Plugin startup logic
        System.out.println("Grabbing registerEvents");
        getServer().getPluginManager().registerEvents(new RespawnBonus(), this);
        getServer().getPluginManager().registerEvents(new BedNerf(), this);
        getServer().getPluginManager().registerEvents(new LimitMaxHealth(), this);

        other = new RespawnBonus(this);
    }

respawnbonus:

    private Softcoresmp mainClass;

    public RespawnBonus(Softcoresmp main) {
        this.mainClass = main;
    }
    public RespawnBonus() { }

    @EventHandler
    public void onRespawn(PlayerRespawnEvent e)
    {
        Bukkit.getScheduler().runTaskLater(this.mainClass, task -> {
            e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING,600, 2));
        }, 5L);
    }
#

just use proper formatting

desert musk
#

oop

#

idk how but i'll learn

#

my first time doing scheduling

tender shard
desert musk
#

using shitty guides

desert musk
desert musk
tender shard
#

any errors?

desert musk
#

nope

tender shard
#

or just the potion not getting applied, without error messages?

desert musk
#

yeah

#

that's all

#

it's known that potion effects take like a tick to be registered after respawn

#

so i tried to do just that

viral crag
#

Verano123 hit the link above, most ebay shops buy from them or ali anyway

vocal cloud
#

Awe man don't do listeners in your main class sad

desert musk
#

i didn't

#

just formatted weirdly

#

lul

vocal cloud
desert musk
#

or maybe i did?

#

idk i'm just following the guides 😭

vocal cloud
#

It's not

desert musk
#

the listener's content is in a different file

#

oh ok

vocal cloud
#

So the effect is not applied?

desert musk
#

nope

#

no sir

#

i'm trying again but registering the event passing in the main class

#

OH SHIT

#

that worked

#

ok good good

#

yeah i just forgot that

#

thanks all for enduring my wall of text lul

vocal cloud
#

That's why I wrote my library. Autoregister stuff so I can't forget anymore kekw

desert musk
#

yeah i should do that lmao

#

i just made the instance with the default constructor instead of using the new one i just made like a 3head

smoky oak
#

set their velocity to x

#

also

grim ice
#

anyone has a lib idea

vocal cloud
#

A library to complain when someone uses NMS when they shouldn't

smoky oak
#

someone explain why the FUCK doing (float) section.getDouble("size") where the config says size: 1.0F is NOT equal to hard coding 1.0F

grim ice
grim ice
#

ur getting a double

#

and getting a double out of 1.0F is weird since theres a letter there

#

isnt there getFloat

smoky oak
#

afaik no

#

im fairly sure even bc typing float only spits out that

tender shard
#

casting a double 1.0d to float, it will be equal to 1.0F

#

otherwise you're doing sth wrong

smoky oak
#

well 2Hex was right

#

even though typing 1.0F in code is a float

#

1.0F in a config isnt

viral crag
#

Ah one of the weird java conventions 😆

smoky oak
#

as such removing the f solved that problem

vocal cloud
#

wait are you typing 1.0F in the config?

smoky oak
#

:/

vocal cloud
#

Why

smoky oak
#

i forgot configs dont take numbers as java does

#

at least it works now

grim ice
vocal cloud
#

Well now you know

grim ice
#

yaml isnt java u dont expect it to be the same conventions

viral crag
# grim ice not really

Yes really: float is not always a double in java, it is just commonly cast that way. It's not an assured type

#

That was a hard lesson to learn - float is a fixed type in most other languages

grim ice
#

An integer literal is of type long if it ends with the letter L or l; otherwise it is of type int.
A floating-point literal is of type float if it ends with the letter F or f; otherwise its type is double.

night copper
#

how do I add gifs to my resource

#

description

#

the gif size is 1mb

quaint mantle
#

I wanna have a clean Main class, is this a good way of loading commands for example?
If not, can you guys suggest me one ?

@Override
public void onEnable() {
    instance = this;
    new CommandLoader();
}

// CommandLoader Class
public class CommandLoader {
    AxleCrates instance = AxleCrates.getInstance();
    public CommandLoader(){
        instance.getCommand("crates").setExecutor(new Crates());
    }
}
smoky oak
#

normalize a vector pointing in the direction you want the player to go, multiply it with the int

grim ice
onyx fjord
#

ąśąśąśąąąąąąąąąśąśęęł

#

yoo

#

it works

#

oops sorry guys for the spam

vocal cloud
#
public final class ExamplePlugin extends JavaPlugin {

    @Override
    public void onEnable() {
        // Creating an auto-register for the base package the plugin is contained in
        AutoRegister autoRegister = new AutoRegister(this,"com.miketheshadow.exampleplugin");
        
        /* 
        Running default setup registers all classes annotated with 
        the command annotations or any listeners
        */
        autoRegister.defaultSetup();
    }
    
}

The cleanest setup uwu

grim ice
#

o

#

so this scans through the package

#

and registers it

vocal cloud
#

Registers everything

quaint mantle
grim ice
#

is that ur library?

vocal cloud
#

It's still a WiP

viral crag
#

Waffles!

quaint mantle
tender shard
#

there's nothing wrong to have a bunch of "getCommand("asd").setExecutor(...)"

vocal cloud
# viral crag Waffles!

I pick random images of cartoon food and apply it to my profile pictures. Although I should probably make it more professional

tender shard
#

you need an annotation like "RequiresPlugin("WorldGuard")"

quaint mantle
vocal cloud
tender shard
#

you cannot instantiate that class without worldguard

#

that's why people would do stuff like this:

#
if(PluginManager.getPlugin("WorldGuard") != null) { registerListener(); }
#

because without worldguard, you'd get NoClassDefFoundError and plugin won't enable

vocal cloud
#

Hmmm I can solve that.

sage dragon
#

https://paste.md-5.net/jaqinapito.java

Does anyone see anything wrong here?

I'm trying to have a direct connection between Spigot and BungeeCord.

(PluginMessage is not "flexible" enough for my taste)

tender shard
#

imho "auto registering" is always a very bad idea

#

I don't think that doing it manually is bad in any way

#

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

tender shard
#

"is marked red"

#

have you tried reading the message your IDE gives you?

viral crag
#

He could use plugin annotations to specify

tender shard
#

exactly, in the class that can'T be accessed

vocal cloud
#

Or you'd add an exception to the builder.

viral crag
#

They arnt actually in a class

tender shard
#

auto registering listeners and commands might work in tiny plugins without dependencies. but I don't think it's worth the trouble at all

tender shard
#

just register your listeners and commands properly and you're done

grim ice
#

simple and useful

tender shard
#

(that's just my opinion, the idea is nice though)

vocal cloud
#

Kinda my test cases

viral crag
#

@SoftDependency(plugin = "Worldedit")

vocal cloud
#

That wouldn't work it'd need to be more like

quaint mantle
vocal cloud
#

autoRegister.requireDepend('class','plugin_name')

viral crag
#

You have to load and setup the annotations preprocessor

tender shard
vocal cloud
#

But if those classes don't load it's not that big of a deal. Considering they wouldn't work anyways.

tender shard
last sleet
#

Hey, is there a way to display all PDC Keys and their corresponding values instead of testing of it's there, then displaying it? Can't seem to get the PersistentDataType from the PDC itself.

tender shard
#

I think auto registering stuff is a good idea but to get it working in complex scenarios, dirty hacks will be required. I'd for example just explicitely say "register listener/command X if Y is true, or don't"

#

but sure, some people might find it useful

last sleet
tender shard
#

but, there are only like 10 builtin datatypes

#

so yeah you can't get around checking them all

last sleet
#

ah ok

tender shard
#

I bet that getting them as byte array will always work

vocal cloud
tender shard
tender shard
#

because the proper, nonhacky way is to simply tell bukkit directly what you want to get registered

#

don't get me wrong, I love hacks like this, I just think that they will cause trouble in SOME cases

#

in 99% of cases it'll probably work fine

vocal cloud
#

Yeah my goal is to reduce the some cases to almost 0.

#

It's a fun challenge

tender shard
#

I just think that if bukkit wanted something like this to exist, it would have been built in since 1.4.6 or sth

vocal cloud
#

The reason it doesn't is it requires an awful lot of assumption. You'd need some sort of manager and that's what I'm writing

vocal cloud
#

Plugins getting a new scoreboard every tick

tender shard
#

yeah or plugins doing synced HTTP requests

#

or plugins on spigotMC that only have a 100% german / spanish / russian description

tardy delta
#

smh

#

english is something

vocal cloud
#

Sprechen sie Deutsche

tardy delta
#

ja

tender shard
#

if I'd be allowed to have another alt account, I'd vote them all 1 star

#

but my only approved alt account is not allowed to do any reviews

#

and if I'd rate them with my main account, I'd get 1 star reviews in return lmao

vocal cloud
#

Just pay some guy to downvote things for you

tender shard
#

yeah because I'm sooo rich

#

I can barely afford my servers lol

hybrid spoke
#

get some work

vocal cloud
#

Pay them in exposure

tender shard
tardy delta
#

rob some banks

tender shard
#

oh btw maybe I'll be a certified flight instructor in 2 years

desert tinsel
#

how can i make a plugin compatible with more minecraft versions?

vocal cloud
#

Damn Towny is thicc.

desert tinsel
tender shard
desert tinsel
#

how?

spring minnow
#

i have a issue where Action.RIGHT_CLICK_AIR Doesn't get fired

tardy delta
#

you could write different classes for each version but if the api hasnt changed use the same stuff

tender shard
#

multiply the vector with -1 then

tender shard
spring minnow
#

i tried debugging and every other action gets fired except for RIght_click_Air

quaint mantle
#

How to get player from UUID? 1.12.2 paper

spring minnow
tender shard
desert musk
#
String name = e.getPlayer().getName();
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "execute as " + name + " run function namespace:respawn");
tender shard
spring minnow
#

it doesn't get fired at all

quaint mantle
spring minnow
#

with any item

tender shard
# spring minnow wdym

I mean, the event is not called when you are right clicking air with certain items

desert musk
spring minnow
#

i used hand, swords, blocks

desert musk
spring minnow
#

everything

quaint mantle
tardy delta
#

player from uuid not uuid from player

quaint mantle
#

ooooh

tardy delta
#

unchecked casting you noob

#

😈

hybrid spoke
tardy delta
#

scared now

tender shard
quaint mantle
#

This maybe ?

spring minnow
#

no no

#

this is how to get villager from an enum

#

that's completely wrong

#

u noob

quaint mantle
#

Ohhh, hmmmm..

tender shard
spring minnow
#

sorry

desert musk
#
String name = e.getPlayer().getName();
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "execute as " + name + " run function namespace:respawn");

this doesn't work, anyone know why?

spring minnow
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.

tender shard
desert musk
#

it throws an error in the console, saying that the command is invalid. i don't know why

#

it's a valid command

spring minnow
#

yeah but the point is that i tried with every type of item

tender shard
hybrid spoke
#

?paste the entire stacktrace.

spring minnow
#

i tried with food, swords, armor, blocks, and various items

desert musk
hybrid spoke
tender shard
#

so why didn't you send any error msg?

desert musk
#

i mean the minecraft console

#

it successfully sends it as a command

#

but even though it's valid it says it's invalid

#

🤷‍♂️

tender shard
#

can't help you then

desert musk
#

[16:09:11 INFO]: ...s skissue function wildernesskit<--[HERE]

#

: |

#

that's all i mean

#

[16:09:11 INFO]: Incorrect argument for command

viral crag
#

Looks incorrect too

desert musk
#

it runs perfectly normal when i run it manually

#

[16:21:34 INFO]: Executed 1 commands from function 'namespace:respawn'

#

trying another function

sharp bough
#

does anyone know why this happens?

#

im trying to use NBT tags for 1.18.2

chrome beacon
#

Show entire pom

vocal cloud
#

Probably missing the repo?

chrome beacon
#

?paste

undone axleBOT
chrome beacon
sharp bough
chrome beacon
#

Also you could just use pdc

#

?pdc

sharp bough
#

wdym repo

sharp bough
chrome beacon
#

Yes

tender shard
undone axleBOT
sterile token
#

Which api class do i need to use to parse a Block to ItemStack?

sharp bough
#

i already did

tender shard
#

add the proper repo

sharp bough
tender shard
#

I mean, add the repository to your pom that provides the API you're using

sterile token
tender shard
#

in this case, this:

<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
<layout>default</layout>
</repository>
chrome beacon
sharp bough
#

ah}

tender shard
sterile token
dark arrow
#

i created a plugin and a server for 1.18.2 but it still says that "are u on the right version" what to do?

tender shard
dark arrow
tender shard
dark arrow
#

let me send the whole msg

sterile token
tender shard
tardy delta
#

while player.isOnline().

dark arrow
#

?[aste

#

?paste

undone axleBOT
tardy delta
#

not sure if that will block the thread

#

probably

#

?Scheduling

tardy delta
#

?scheduling

undone axleBOT
tender shard
chrome beacon
tender shard
dark arrow
sterile token
tender shard
#

your recipe must not contain 9 lines

#

crafting tables have at most 3 lines

#

lines = rows

viral crag
dark arrow
tender shard
#

no

#

you have 9 lines

#

show your recipe code

chrome beacon
dark arrow
#

Yah just a sec

tardy delta
#

run it on another thread

chrome beacon
#

Well yeah. Which is why you should use the scheduler like they linked

tardy delta
#

Bukkit.getScheduler().runTaskAsynchronysly

grim ice
#

i need lib idea uwu

tardy delta
#

wait runTaskTImerAsync better

vast sapphire
#

How would I do something for each individual player? ```java
public boolean checkArea(Player p, Connection conn) throws SQLException {
String query = "SELECT area FROM Gungenns WHERE uuid = ""+p.getUniqueId()+""";
ResultSet selection = Main.instance.getConnection().createStatement().executeQuery(query);
while (selection.next()) {
if (p.hasPermission("essentials.warps.a2")) {
conn.createStatement().executeUpdate("UPDATE Gungenns SET area = 2 WHERE uuid="" + p.getUniqueId()+""");
return true;
} else if (p.hasPermission("essentials.warps.a3")) {
conn.createStatement().executeUpdate("UPDATE Gungenns SET area = 3 WHERE uuid="" + p.getUniqueId()+""");
return true;
}
}
return false;
}
public boolean update(Player p, Connection conn, Chat message, Economy econ) throws SQLException {
String query = "SELECT balance,rank FROM Gungenns WHERE uuid = ""+p.getUniqueId()+""";

        String rank = message.getPlayerPrefix(p);
        String replaced = rank.replaceAll("&", "§");
        String stripped = ChatColor.stripColor(replaced);

        ResultSet selection = Main.instance.getConnection().createStatement().executeQuery(query);
        if (selection.next()) {
            conn.createStatement().executeUpdate("UPDATE Gungenns SET balance=" + econ.getBalance(p) + ",rank=\"" + stripped + "\" ");
            return true;
    }
    return false;
}``` i'm trying to update table values for each player but it updates for one and sets the whole row
tardy delta
#

and specify the ticks to wait until re running

sterile token
chrome beacon
tardy delta
#

all scheduler methods are running on a threadpool/ different thread right?

chrome beacon
#

The async ones yeah

grim ice
#

i assume so but the sync ones get joined

tender shard
#

synced things run on the main thread

#

or wait

tardy delta
#

and runTaskTimer does that runs on the main thread?

tender shard
#

tbh I am not sure if my previous statement is true

chrome beacon
#

Yes

tardy delta
#

but it will not interrupt the server?

grim ice
#

a guess is its another thread but it gets joined

#

idk tbf

desert musk
tender shard
vocal cloud
#

Synced will probably block main thread.

chrome beacon
#

^^

tardy delta
#

ah wait lol i was confused a bit

tender shard
tardy delta
#

i forgot that it blocks too

tender shard
#

and, what a surprise, it returns the player's name

desert musk
tardy delta
#

do minecraft:give

vocal cloud
#

What you can do is run something async. So

asynctask -> {
doheavyasync
synctask -> {
sync processed stuff
}
}
although this means delays

tender shard
#

obviously that player wasn't found then, noone knows what "give" command you're using

tardy delta
#

it uses the essentials one

desert musk
#

ohh interesting

#

i'm not so proficient with minecraft commands

tardy delta
#

essentials has a different implementation which doesnt like some things

tender shard
tardy delta
#

iirc @s @a etc doesnt work

desert musk
#

hm

desert musk
#

lol

tender shard
#

it would be helpful if you send the actual code instead of random examples

tardy delta
#

and some item names are different too

desert musk
#

` @EventHandler
public void onRespawn(PlayerRespawnEvent e)
{
if (e.getPlayer().getBedSpawnLocation() == null) {
e.getPlayer().sendMessage(ChatColor.DARK_GREEN + "You spawn in the wilderness.");
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "execute as " + e.getPlayer().getName() + " run function namespace:respawn");
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "minecraft:give " + e.getPlayer().getName() + " torch");
Bukkit.getScheduler().runTaskLater(this.mainClass, task -> {
e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING,600, 1));
e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,600, 1));
e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,60, 1));
}, 1L);
}

}`
#

or whatever java formatting

tender shard
grim ice
#

btw

desert musk
#

CORRECT

#

🙂

grim ice
#

what happens if i use stuff from thread a in thread b, but i join thread b with a

tender shard
#

I don't get it, first you said the code was "just an example", now it's not "just an example" anymore?

tardy delta
#
void main() {}
tender shard
#

why do you dispatch commands instead of directly giving them a torch

grim ice
#
int main() { 
return 0;
}
desert musk
#

dispatch command is what i found when i looked up online

tardy delta
desert musk
#

oh you mean like

desert musk
#

well because that's an example

sterile token
desert musk
#

that i wrote to explain to you why the command above it doesn't work

dark arrow
# tender shard show your recipe code

Sorry For The Delay

public class CraftingRecipe {

    public static ItemStack MonsterOfTheSea ;
    public static ItemStack TurtleChestplate;
    public static ItemStack TurtleBoots;
    public static ItemStack TurtleLeggins;

    public static void init(){
        createTotem();
        createGodApple();
        createTrident();
    }

    private static void createTotem(){
        ItemStack item = new ItemStack(Material.TOTEM_OF_UNDYING,1);

        ShapedRecipe sr = new ShapedRecipe(NamespacedKey.minecraft("totem"),item);
        sr.shape("BGB"+
                "GEG"+
                "BGB");

        sr.setIngredient('B',Material.BLAZE_ROD);
        sr.setIngredient('G',Material.GOLD_BLOCK);
        sr.setIngredient('E',Material.EMERALD_BLOCK);
        Bukkit.getServer().addRecipe(sr);
    }
    private static void createGodApple(){
        ItemStack item1 = new ItemStack(Material.ENCHANTED_GOLDEN_APPLE,1);
        ShapedRecipe sr1 = new ShapedRecipe(NamespacedKey.minecraft("apple"),item1);
        sr1.shape("TGT"+
                "DAE"+
                "GGG");

        sr1.setIngredient('A',Material.GOLDEN_APPLE);
        sr1.setIngredient('D',Material.DIAMOND_BLOCK);
        sr1.setIngredient('T',Material.TOTEM_OF_UNDYING);
        sr1.setIngredient('G',Material.GOLD_BLOCK);
        Bukkit.getServer().addRecipe(sr1);



    }private static void createTrident(){
        ItemStack item2 = new ItemStack(Material.TRIDENT,1);

        ShapedRecipe sr2 = new ShapedRecipe(NamespacedKey.minecraft("trident"),item2);
        sr2.shape("CCC"
                +"SDS"
                +"SDS");
        sr2.setIngredient('C',Material.PRISMARINE_CRYSTALS);
        sr2.setIngredient('S',Material.PRISMARINE_SHARD);
        sr2.setIngredient('D',Material.DIAMOND_SWORD);
        Bukkit.getServer().addRecipe(sr2);
    }





}

undone axleBOT
desert musk
#

which is simply trying to link a namespace function into my plugin so that it can be used with more ease

tender shard
#

"DDD", "DAD", "DDD" for example

dark arrow
#

ohh

tender shard
#

for this:
Diamond Diamond Diamond
Diamond Andesite Diamond
Diamond Diamond DIamond

dark arrow
#

Tysm

sterile token
tender shard
#

the API is pretty straightforward

tardy delta
#

dad?

tender shard
#

Diamond Andesite Diamond

desert musk
tender shard
#

String Obsidian Netherrack

desert musk
#

lol

tender shard
#

but yeah I'd never hardcode any recipes anyway, they should always be configurable 😛

#

do you have any idea about what enums are?

#

so you use Enum#valueOf

dark arrow
#

omg it worked

tender shard
#

of course it worked lol

tender shard
tardy delta
#

oop at its best

grim ice
#

even though i usually dont listen to my own advice

#

1 word variables = bad

#

in most cases imo

#

e.g: final ShapelessRecipe recipe = new ShapelessRecipe(key, result);

#

what is re cipe

tender shard
#

the recipe that people want to get

#

there is no other recipe

#

so what else would it be

grim ice
#

yeah how am i supposed to know

tender shard
#

because the class returns a Recipe

grim ice
#

well base = choices.get(0);

tender shard
#

do you also do "Player playerInvolvedInThisEvent = playerDeathEvent.getPlayer()" ?

grim ice
#

what is that

tender shard
#

base is the base item

#

addition is the item that gets added to it

#

e.g. diamond pickaxe + netherite ingot

#

diamond pickaxe is the base

#

netherite ingot is the addition

tender shard
#

why would someone not use "recipe" as name if it's the only recipe involved?

tardy delta
#

Player p 😼

tender shard
#

Player p is not good. Player player is fine

tardy delta
#

a little bit dangerous when you have another variable name starting with a p

tender shard
#

unless there are two players involved

tardy delta
#

Event e goes brr too

#

but i see many people using it

tender shard
#

I also used stuff like event e, player p etc

#

yes, it's bad

tardy delta
#

and then once in a sudden they write Entity entity

#

🤔

grim ice
tender shard
#

but FurnaceRecipe recipe = .... is totally fine

grim ice
#

base can be anything

tardy delta
#

mye

tender shard
grim ice
#

yes

#

well

tender shard
#

it only has two slots

grim ice
#

mhm

tender shard
#

a base item and the additional item

grim ice
#

baseItem

#

would make more sense

tender shard
#

If someone gets cnofused about this, they truly have Alzheimer's

grim ice
#

well

#

thats my opinion

#

you do you

tender shard
#

will do

grim ice
#

i wouldnt name a variable its type

tender shard
#

the type would be RecipeChoice though

#

and not "base" or "addition"

tender shard
grim ice
#

u get it

grim ice
#

sometimes its fine sometimes not imo

#

i would try to be as descriptive as i can without making the variable long

tender shard
#

so you would rather name "base" "baseItem" although it's not an item but a RecipeChoice?

grim ice
#

idk the context, i just thought its an item because you said "base item"

tender shard
#

it might be a MaterialChoice or an ExactChoice

#

that depends on the config of course

#

I too like descriptive names but this method is merely 10 lines long

#

and baseItem would just be incorrect

#

it could be called "baseRecipeChoice"

grim ice
#

mhm

tender shard
#

but that's useless, there's no other variable with any similar name involved so yeah

grim ice
#

thats 100x better

tender shard
#

I don't think that naming it "base" could cause any problems

#

but yeah I myself said that the class is messy, that's true

#

but I don't think that naming this 10 line variable "base" is the problem 😄

grim ice
#

it isnt

#

merely a way for improvement

#

imo, maybe not in yours

ivory sleet
#

yeah merely base looks good here

tender shard
#

I usually use this philosophy: if a variable only exists for 10 lines, no need for a long descriptive name

#

if it's part of a 300 lines method, yeah maybe baseRecipeChoice would be better

ivory sleet
#

a variable's name should be proportional to the size of the scope its contained within