#help-development

1 messages · Page 1101 of 1

silver eagle
#

Are there any other events that affect the calling of PlayerInteractEvent?
I am using the following event call.
・SignChangeEvent
・BlockBreakEvent
・BlockPlaceEvent
・PlayerSignOpenEvent
・InventoryMoveItemEvent
・CraftItemEvent
・InventoryPickupItemEvent
・EntityPickupItemEvent
・EntityChangeBlockEvent

My plugin gives a signboard the ability to store one type of item.

quaint mantle
#

If I have cached player, how can I check if they already left the server by using the old reference?

eternal oxide
#

Do NOT cache Players

quaint mantle
#

Why that?

#

They are being cached inside methods

eternal oxide
#

Don NOT cache Players

#

cache their UUID as it never changes

quaint mantle
#

I mean cache the player as the reference in a method

#

I am doing a runTask

eternal oxide
#

Bukkit.getPlayer(uuid) will return null if they are not online

quaint mantle
#

I want to check on next tick if they left

eternal oxide
#

Do I need to say it a third time?

quaint mantle
#

Man

#

They can rejoin

#

I want to check

#

By the old reference

eternal oxide
#

Do not cache players

quaint mantle
#

What is caching then?

eternal oxide
#

You will always get a Player quite event when a player leaves

quaint mantle
#

Because how can I use a player reference in a method then?

eternal oxide
#

Bukkit.getPlayer(uuid)

quaint mantle
#

And what does it returns?

eternal oxide
#

a Player or null

quaint mantle
#

Yeah

#

But if you name the variable, you are like "caching"

#

This is what I am doing

pseudo hazel
#

what do you mean

quaint mantle
#

I got the player passed from a method

pseudo hazel
#

save its uuid

eternal oxide
#

its only used in the method so it goes out of scope once the method ends

quaint mantle
#

I want to check on runTaskLater if such reference is still valid (like if player never left)

pseudo hazel
#

if you are expecting your players to leave while you are saving them, use the uuid

#

if you want to check if a player left in the mean time, keep track of it separately

eternal oxide
#

is the code in teh runTask still going to run if the player leaves and rejoins?

#

if so, it doesn;t matter if they left and rejoined

quaint mantle
eternal oxide
#

Do NOT store Player references

quaint mantle
#

I am not storing it in a Map

#

I am storing it in the method

eternal oxide
#

You can't store it IN a method which runs later, you are storing it in the Task

pseudo hazel
#

in the method?

eternal oxide
#

Pass teh UUID not the Player object

pseudo hazel
#

right

hybrid turret
#

Does someone have something on that? ^

quaint mantle
eternal oxide
#

A location is ok to store a reference as a World never changes during a session

#

at least not the three main worlds

quaint mantle
#

Yeah

#

But with the original reference

#

The one named "player"

#

No because player can leave and rejoin and have another reference

eternal oxide
#

pass a UUID not a Player.
If you want to check if they leave, you have to cancel the task in the PlayerQuitEvent.

#

You can do it using a Player reference but you are causing a memory leak

quaint mantle
#

I was asking like if Player implementation in CB did update #isOnline if player left

eternal oxide
#

if (player != Bukkit.getPlayer(uuid))

eternal oxide
#

the above will be true if your reference is stale

#

But write better code and do not hold Player references

quaint mantle
#

What?

#

I thought Player was a soft reference

eternal oxide
#

if a Player quits and rejoins, YOUR Player reference will be stale. Nothing you call in the Player method will do anything

quaint mantle
#

So once the scope ended (like checking if player was indeed the same reference), it freed it

eternal oxide
#

If you hold a reference to a Player it can;t be GCd

quaint mantle
#

Until it's no longer in use?

eternal oxide
#

until you release your reference

quaint mantle
eternal oxide
#

yes, if you don;t hold it anywhere else

quaint mantle
#

So, it's safe

quaint mantle
sterile breach
#

Its possible to load a chunk to load a very distant chunk or? (with packets)

#

or client will ignore it

chrome beacon
#

if it's outside render distance the client will ignore it

grim hound
#

Regarding that 600 chars long text

shadow night
#

that again?

grim hound
#

It's possible for me to compress it in the website (since I get the token externally)

#

But the website's code is controlled by me

#

But the token isn't

#

So as long as it can be compressed and decompressed it's all good

#

Just uh

#

Would need like 80% size decrease

shadow night
#

that sounds a bit hard

#

maybe if you assign an UUID to each token and then store them in some database, but that's weird

grim hound
#

That won't do

#

Bruh I guess the command block gui is all I have left

shadow night
#

I know a few compression algos but I doubt they will be that efficient

dusk tulip
#

Hello, do you know what is persistent data on 1.8 ? Cause it s in 1.16 but i need it

#

Maybe Hashmaps ?

#

It 's to make a role plugin

eternal oxide
#

does not exist

dusk tulip
#

You chose a role and have effect

#

Ho... ok

eternal oxide
#

it was added in 1.14

dusk tulip
#

And do you know what i can use to make a role ?

eternal oxide
#

well 1.13 but incomplete

dusk tulip
#

Just not team*

eternal oxide
#

if you want to make roles just use permissions

dusk tulip
#

Not role like admin, modo etc but role like in the WW, for exemple the little girl, the werwolf, etc that have effect ( WW= strengt, little girl = invisibile

eternal oxide
#

I have no clue what you are talking about

dusk tulip
eternal oxide
#

never heard of it

smoky anchor
#

If it's a minigame just store that in some map ig
Maybe hashmap<uuid, role>

dusk tulip
#

Oh ok maybe an french only game

smoky anchor
#

Also, I would use newer version 'cause

#

?1.8

undone axleBOT
dusk tulip
smoky anchor
dusk tulip
#

Better pvp in 1.8

dusk tulip
#

I did that for an inventory

#

But i hate that

smoky anchor
#

sure
stay on a decade old version with many, MANY limitations just because "pvp"

dusk tulip
#

Yeah i am a pvp player

eternal oxide
#

Many do, pvp is easier on 1.8

smoky anchor
eternal oxide
#

I don;t pvp but I do miss being able to panic press attack when I'm scared of mobs

dusk tulip
#

Yeah i can understand X) but 1.8 pvp is sooooo amazing when you play it on uhc

smoky anchor
dusk tulip
# eternal oxide never heard of it

For the WW game, it' a very fun game, you have a random roles that no one know, you are a villager, a Werwolf, or solo, you have to win with your team ( villager = kill WW and solo, solo = kill other solo and villager and ww etc) all of the WW know the other ww but villager don't know who are the other villager or ww or solo, so they have to investigate, their is role for that, ( little girl can watch the ww at the night but if the ww see her watching them she died, the simple villager that can do nothing else vote someone at the morning to kill him, the old man that don't die if an ww kill him for the 1st time, the witch that can kill/revive someone, the seer that can see a role every night, the ww that kill every night, the white ww that is an ww that have to kill other ww ( he is a solo ) the bad wolf dad that can transform an villager on 1 a ww and many others. It's card game so you don't move. It's one of the funniest game of all time, and it's a french game. The game Among us was inspired of it

dusk tulip
#

So you have you own kit

#

For exemple you have sword in 1st slot and gapp in two when you write /kit and your friend have the sword in 9 and gapp in 5 when he write /kit

mortal vortex
#

Whats the best way to keep the instance of an entity created by the Plugin? For example a command summons an entity, and later an event deletes that entity.

smoky anchor
smoky anchor
mortal vortex
smoky anchor
#

tag it with PDC then ?

mortal vortex
#

Sorry should've mentioned, PDC is 1.14. I am working with pre-1.14

smoky anchor
#

Then suffer :D
(idk in this case then, maybe find a different way to tag the entity)

eternal oxide
#

NBT-API for pre 1.14

dusk tulip
#

And one last question

#

I don't have many free time on my life, but i rly want to learn programmation, do you have some advices/ videos ? Cause i am not a good plugin maker / modders at all, and i am not very good at others languages ( my biggest peoject was the suika game on c#...)

foggy cave
#

is mc 1.2.5 the first craftbukkit version?

smoky anchor
foggy cave
#

cuz im trying to support every mc version

smoky anchor
#

no

eternal oxide
#

give up now, unless its a hello world plugin

smoky anchor
#

you
are crazy

foggy cave
#

no ive already done 1.6 to 1.21

smoky anchor
#

Do you really need to support the 4 ppl who play on 1.2.5

foggy cave
#

alright i think ill go from 1.0 to 1.21

#

nah i dont support beta

dusk tulip
#

RIP 💀

foggy cave
#

i cant find a 1.0 download link

pseudo hazel
#

cuz its dead af

foggy cave
#

no cuz im using duckduckgo lets try googl

pseudo hazel
#

its even more fossilized than 1.8

foggy cave
#

found it

smoky anchor
#

What can you even do with that version
spawn particles, set blocks and send chat messages ?

zenith anchor
#

Is there any method that can safely store itemStacks in 1.20.4 servers and read them in 1.20.6 servers without data loss?

smoky anchor
#

Yes, a chest

zenith anchor
#

If using a plugin?

smoky anchor
#

Don't think you can trigger DFU by yourself without hacks

zenith anchor
#

that's sad. thank you

chrome beacon
#

The configuration API?

smoky anchor
#

Don't lose hope yet, maybe someone more knowledgeable will come

chrome beacon
#

Save the itemstack to config and load it again

smoky anchor
zenith anchor
#

yes, I'm writing code to make a quick test

zenith anchor
chrome beacon
#

so you're not using PDC?

#

but custom NBT instead

zenith anchor
#

yes

chrome beacon
#

Guess you'll need to write your own converter then

zenith anchor
#

I do agree with it.

#

extra nbt parser should be done.

#

while simply copying .dat files to 1.20.6 servers doesn't cause any data loss, but limited to vanilla storage unluckily

humble tulip
#

If you wanna use nbtapi

#

There is a datafixer to convert itemstacks

zenith anchor
#

Also tested that PDC data is really persistent.

humble tulip
#

Being in the name and all

zenith anchor
#

lol

zenith anchor
zenith anchor
#

Cheers, I'll check it.

humble tulip
#

You can call the datafixer to upgrade itemstacks

#

1.20.4->1.20.6 specifically had some itemstack changes

#

Count is no longer a byte

rough drift
#

Completely off topic:

Do ya'll think it is acceptable to use static collections in places where you realistically can't pass the collection around?

humble tulip
smoky anchor
humble tulip
#

I had no idea

#

But it broke my plugin

#

With players upgrading from 1.20.4->1.20.6

rough drift
smoky anchor
#

Can you use a builder ?

rough drift
#

Nah it's asm babyyyyyyyyyyyyyyy

#

I could

#

make another object

#

but then you have to make one for every set of args

#

because it's different for every type of thing you have to visit

#

so yeah

#

It's a ton more work

slender elbow
#

builder pattern wooo Java's lack of default arguments really shows

rough drift
#

you can't use defaults here lmao

#

so either make a new record or just keep passing more and more things to the constructors

#

I could make an object to store things

#

yeah I'll do that ig

mortal vortex
#

is there something like "PlayerVehicleExitEvent"?

chrome beacon
#

VehicleExitEvent

mortal vortex
#

Is that more appplicable to Minecarts than EntityDismountEvent?

mortal vortex
#

Ah alright

mortal vortex
#

w-why?

shadow night
#

I think there isn't

sand spire
#

you can give negative jumpboost/levitation but sometimes it glitches

shadow night
#

uh why?

sand spire
#

you could also put them in spectator and make them spectate an armorstand, or put them as a passenger on an armorstand, or make them open an empty GUI

shadow night
#

Yeah

#

A gui that just says: "Loading... Please wait"

#

Maybe some kind of limbo even

young knoll
#

What version is this

sand spire
#

they might be able to shift idk, but doesn't the data load within milliseconds, you'd have to add artificial waiting time so it doesn't look weird cause it's instant

young knoll
#

If it’s 1.21 you can set walk speed to 0 and the jump power attribute to 0

sand spire
young knoll
#

Load the data in the async prelogin event

#

Assuming that existed 10 years ago

shadow night
sand spire
young knoll
#

?

#

Did you not just say you’d do it in the async prelogin event

shadow night
#

what

sand spire
#

player can't jump before they're online

young knoll
#

So do that in the join event

sand spire
#

you can cache the data in asyncpreloginevent, then get the data from a collection and edit the inventory

young knoll
#

Load the data on prelogin

chrome beacon
#

and why?

shadow night
#

There is either a major misunderstanding or a flawed system

sand spire
#

Are you using persistentdatacontainer?

chrome beacon
#

why can it only be loaded after join event

young knoll
#

Not if you block the login

#

It will force the connection to wait

#

Because it blocks the login thread

shadow night
#

why does it matter how, it will just work

young knoll
#

Yes

shadow night
#

There is a major misunderstanding here

young knoll
#

You just run the code in said event

chrome beacon
shadow night
#

You just run it mf

young knoll
#

It will automatically do that

shadow night
#

Run it syncronously so it blocks the thread

#

And it will block the god damn process

young knoll
#

Yes

#

You run it “synchronously” on that async thread

#

If you have a future just join() it

shadow night
#

Async means it runs on another thread, but that other thread cna still be blocked

sand spire
#

Spigot calls the playerjoinevent after the asyncpreloginevent is finished

chrome beacon
#

but yes

shadow night
#

I'm not gonna overexplain things to this person who is struggling to understand anyways

chrome beacon
#

true

sand spire
#

yes

shadow night
#

Unless you force it to run on the same thread

river oracle
#

Good job you know how threads work!!!

chrome beacon
#

you do though

river oracle
#

Yes you do 😢

chrome beacon
#

Spigot will wait for prelogin to finish

#

and we've told you what to do

river oracle
#

You know what's be crazy if what was async about the event wasn't the guarentee of a player join but a guarentee of the server not freezing

chrome beacon
#

no

river oracle
#

No the player with disconnect

#

Kekw

shadow night
#

in holy god

#

this is awful

river oracle
#

I can't tell if this is troll or just genuine

chrome beacon
#

It will wait for the prelogin to finish before calling the join event

#

It won't freeze the entire server while doing so

river oracle
#

Is your native language English. I know Spanish if you'd prefer?

sand spire
#

wdym wdym

young knoll
#

if the data takes too long the client will just disconnect

#

(About 30 seconds)

chrome beacon
young knoll
#

If you data takes 30 seconds to load you have bigger issues

#

Like hosting your server on mars

#

no it cannot

river oracle
#

Ah fancy Spanish

chrome beacon
#

No it cannot finish if you block the thread

sand spire
#

if it takes too long to load it will probably never load and it's better for the player to never get online to prevent data loss

river oracle
#

I don't know fancy soonish

chrome beacon
#

println("a");
println("b");

a will always print before b because the first statement is blocking until it's done

#

30s will cause the client to disconnect

#

You need to be faster than that

#

A couple of seconds is fine

#

but the players won't like that very much

shadow night
#

30s??

chrome beacon
#

keep the time to a minimum

shadow night
#

That's quite a ton of time isn't it

chrome beacon
#

waaay more than you should ever need for a db query or 2

young knoll
#

or like 50

chrome beacon
#

true

young knoll
#

db queries should be taking ms

river oracle
#

If you timeout in the event you have very big problems with your database

shadow night
#

I can probably fetch my whole database 10 times in 30s

river oracle
#

Usually mysql would propagate an error backwards

sand spire
#

So what, if an error occurs you want the player to stay offline so their data doesn't get corrupted

shadow night
#

If your db errors then you would want to kick the player anyways

#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
upper hazel
#

@Getter
private static final KPlug instance = KPlug.getPlugin(KPlug.class);

#

this is can be so?

shadow night
#

can't you just write a method

upper hazel
#

i have some problem

sand spire
#

You want to use event.getUniqueId(); not event.getName();

upper hazel
#

with it

shadow night
#

Some?

#

what problem

pseudo hazel
upper hazel
#

i create api and "api user plugin" getting api null instance class from static method

#

public void onEnable() {
saveDefaultConfig();
instance = this;
KPlugApp.start(this);

}
#

but

#

instance created here

shadow night
#

Can't you just write the method to do the same thing as your variable

#
public static KPlug getPlugin() {
    return KPlug.getPlugin(KPlug.class);
}
```?
upper hazel
#

oh right i getting this error " Cannot get plugin for class 'class' from a static initializer

pseudo hazel
#

uuid is best

pseudo hazel
#

i mean the static variable is probably gonna get set before the plugin instance exists

#

wdym all the code

upper hazel
pseudo hazel
#

maybe idk

#

well thats a design flaw

#

maybe

#

?tas

undone axleBOT
shadow night
dusk tulip
pseudo hazel
smoky anchor
dusk tulip
#

hummm i will try that

pseudo hazel
#

make sure to check if player is no null though xD

#

otherwise it will crash

smoky anchor
#

ok

dusk tulip
#

ok thanks

upper hazel
#

i mean i not can getting in global field?

#

like - private static final instance = getPlugin();

shadow night
#

why do you do that

upper hazel
#

ltemporary solution

shadow night
#

Just call getPlugin() from wherever and make sure to not load classes that statically reference it before the plugin is initialized

#

Putting it the result of getPlugin inti a static field in the main class is useless

upper hazel
#

for some reason when getting instance of api class user gets null although instance was created in onEnable

rough drift
#

are you using scope provided or not

upper hazel
#

i use local

#

depend

rough drift
#

yes but did you add

pseudo hazel
#

static final instance = getplugin does not work

rough drift
#

<scope>provided</scope>

upper hazel
#

i not add this like maven

#

i add this in settings - models - lib

shadow night
pseudo hazel
#

what ide are you using

upper hazel
#

inteliji\

#

ultimate

#

i mean "file-models-libs"

pseudo hazel
#

dont add dependencies using intellij, add them in the pom or gradle.build file only

#

then maven/gradle reload will pull the dependencies for you

upper hazel
#

ok but why inteliji the tool works so strangely

split gull
#

since 1.20 the patterntype enum was replaced with an OldEnum, i've already added support for registries but those only exist since 1.20 and i need to add compatibility for older versions, how can i do that?

pseudo hazel
#

usually your api version is the one supporting your oldest target version

chrome beacon
#

^ you'd have multiple modules

#

The main code is written using the oldest version you want to support

#

Then you load in code from other modules that are supported on the current server version

#

modules here being maven/gradle modules ^^

pseudo hazel
#

this is simply because its impossible to port new features to older versions directly so the api has no way to deal with it either

dusk tulip
#

I tried that

smoky anchor
#

?codeblock please

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
dusk tulip
#
Map<String, String> role= new HashMap<String, String>();

    @EventHandler
    public void onClick(InventoryClickEvent event){
        Player player = (Player) event.getWhoClicked();
        ItemStack itemStack = event.getCurrentItem();
        if(itemStack != null){
            if (itemStack.getItemMeta().getDisplayName().equalsIgnoreCase(" ")){
                event.setCancelled(true);
                if(role.get(player.getUniqueId().toString()) == "Loup"){
                    player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 10000, 3 , false, false));
                }


            }   else if(itemStack.getItemMeta().getDisplayName().equalsIgnoreCase("§6 Loup")){
                player.getActivePotionEffects().clear();

                role.put(player.getUniqueId().toString(), "Loup");




            }
        }
    }
shadow night
#

oh no, name checking

#

???

smoky anchor
sand spire
#

Is it better to encode inventories as a map (slot + itemstack, slot + itemstack) or an array with nullables?

sand spire
sullen wharf
#

Itemstack array

sand spire
#

alright thanks

smoky anchor
sullen wharf
#

You have a famous util for that

sand spire
#

I use mongodb

#

I already have methods, I just needed to know which format is better

#

ty anyways

pseudo hazel
#

frankly shouldnt matter where you save it to, base64 applies to everything

quaint mantle
#

Hey does someone know skript for plots that when i right click on sign it shows gui like invite friend rent plot and plot info it would be great

sullen wharf
#

why

smoky anchor
pseudo hazel
#

you just said people use item[] to base64 all the time

sullen wharf
#

What does that have to do with using base64 or not

#

You can associate the saved inventory to a player

#

And move on with your life

smoky anchor
quaint mantle
#

Hey does someone know skript for plots that when i right click on sign it shows gui like invite friend rent plot and plot info it would be great

dusk tulip
#

it dont work...

#
Map<String, String> role= new HashMap<String, String>();

    @EventHandler
    public void onClick(InventoryClickEvent event){
        Player player = (Player) event.getWhoClicked();
        ItemStack itemStack = event.getCurrentItem();
        if(itemStack != null){
            if (itemStack.getItemMeta().getDisplayName().equalsIgnoreCase(" ")){
                event.setCancelled(true);
                role.put(player.getUniqueId().toString(), "Loup");

                if(role.get(player.getUniqueId().toString()).equals("Loup")){
                    player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 10000, 3 , false, false));
                }


            }   else if(itemStack.getItemMeta().getDisplayName().equalsIgnoreCase("§6 Loup")){
                player.getActivePotionEffects().clear();

                player.chat("a");




            }
        }
    }```
pseudo hazel
#

backticks

#

not quotes

neat nexus
#

Hey does someone know skript for plots that when i right click on sign it shows gui like invite friend rent plot and plot info it would be great

undone axleBOT
echo basalt
#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
echo basalt
#

` and ' are a lil different

smoky anchor
# dusk tulip it dont work...

well you didn't even say what it is supposed to do and how it doesn't work.
You just sent code
I gave feedback and pointers for the future.

smoky anchor
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.

echo basalt
#

Base64 is just a way to encode blobs

pseudo hazel
#

my man is getting hit by all commands

smoky anchor
#

What can I say, it is fun to use them

echo basalt
#

Just yeet the blobs straight instead of encoding at like a 66% overhead or whatever it is

dusk tulip
#

Effect not applied on the player

echo basalt
#

I really doubt you're doing complex queries trying to sort by the first item on the kit or whatever

smoky anchor
echo basalt
#

null if there's no display name iirc

#

just use hasDisplayName

split gull
upper hazel
pseudo hazel
#

yes or split the plugin into multiple versions or whatever

split gull
#

mh

pseudo hazel
#

or stop supporting old versions

smoky anchor
dusk tulip
smoky anchor
#

Which string ? the role.
And the other string should be UUID instead of stringified UUID

echo basalt
#

2 longs be like

smoky anchor
young knoll
pseudo hazel
#

how about 16 bytes

smoky anchor
#

32 nibbles ?

echo basalt
#

how about 128 booleans that represent a bit each

#

we gotta think big

pseudo hazel
#

Booleans

dusk tulip
#

    Map<UUID, String> role= new HashMap<UUID, String>();






pseudo hazel
#

wdym doesnt exist

dusk tulip
#

it's in red

smoky anchor
#

Import UUID ?

dusk tulip
pseudo hazel
#

whats in red

dusk tulip
#

var

pseudo hazel
#

dude we cant read your mind nor see your screen

#

where is it in red

smoky anchor
#

Copy and paste the error from your ide

smoky anchor
#

oh

#

Player instead of var

#

old Java version

pseudo hazel
#

ancient java version

upper hazel
#

why from getPlugin(pluginA) i getting pluginB wth?

chrome beacon
#

The class pluginA appears to belong to pluginB

smoky anchor
chrome beacon
#

^^

dusk tulip
#


Map< String,UUID> role= new HashMap< String,UUID>();

    @EventHandler
    public void onClick(InventoryClickEvent event){
        Player player = (Player) event.getWhoClicked();
        ItemStack itemStack = event.getCurrentItem();


        if(itemStack != null){
            if (itemStack.getItemMeta().getDisplayName().equalsIgnoreCase(" ")){



            }   else if(itemStack.getItemMeta().getDisplayName().equalsIgnoreCase("§6 Loup")){
                event.setCancelled(true);
                role.put( "Loup",player.getUniqueId());
                Player player1 = Bukkit.getPlayer(role.get("Loup"));
                player1.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 10000, 3 , false, false));

                if(role.get("Loup").equals(player.getUniqueId())){
                    player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 10000, 3 , false, false));
                }



            }
        }

    }```
#

I tried that

dusk tulip
#

two option

chrome beacon
dusk tulip
#

but no one work

smoky anchor
upper hazel
#

yes i undestand but why method return instance FantasyLandsPlugin FROM KPlug

chrome beacon
#

It doesn't

upper hazel
#

this is like i get long from int

chrome beacon
#

You're trying to put a KPlug instance in to a FantasyLandsPlugin variable

upper hazel
#

I get a result that doesn't match the argument.

#

why getPlugin should return FantasyLandsPlugin if i add KPlug

#

how this generics work lol

smoky anchor
#

You don't even have generics in what you sent lol

upper hazel
#

what

chrome beacon
#

Yeah that code is incomplete

chrome beacon
smoky anchor
#

I just noticed too, that method is out of the class

chrome beacon
#

Doesn't quite match the error but it's the best guess with what we know

smoky anchor
#

And in any case, isn't the method wrong ?
You'd want to first get the plugin and then see if it is null to know if you have it or not

upper hazel
chrome beacon
#

Code does not match the error message

#

So it's not the full code

spare prism
#
        System.out.println("victimName = " + victimName);
        OfflinePlayer victim = Bukkit.getOfflinePlayer(victimName); // NPE
        System.out.println("victim = " + victim + ", victimName = " + victim.getName());
[14:11:38 WARN]: Could not pass event AsyncPlayerChatEvent to Sims v1.0
[14:11:38 WARN]: org.bukkit.event.EventException
[14:11:38 WARN]:        at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:70)
[14:11:38 WARN]:        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:74)
[14:11:38 WARN]:        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
[14:11:38 WARN]:        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:518)
[14:11:38 WARN]:        at net.minecraft.server.v1_12_R1.PlayerConnection.chat(PlayerConnection.java:1471)
[14:11:38 WARN]:        at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1374)
[14:11:38 WARN]:        at net.minecraft.server.v1_12_R1.PacketPlayInChat$1.run(PacketPlayInChat.java:39)
[14:11:38 WARN]:        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[14:11:38 WARN]:        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[14:11:38 WARN]:        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[14:11:38 WARN]:        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[14:11:38 WARN]:        at java.lang.Thread.run(Thread.java:748)
[14:11:38 WARN]: Caused by: java.lang.NullPointerException
[14:11:38 WARN]:        at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:770)
[14:11:38 WARN]:        at com.google.common.collect.MapMakerInternalMap.put(MapMakerInternalMap.java:2209)
[14:11:38 WARN]:        at org.bukkit.craftbukkit.v1_12_R1.CraftServer.getOfflinePlayer(CraftServer.java:1492)
[14:11:38 WARN]:        at org.bukkit.craftbukkit.v1_12_R1.CraftServer.getOfflinePlayer(CraftServer.java:1463)
[14:11:38 WARN]:        at org.bukkit.Bukkit.getOfflinePlayer(Bukkit.java:761)
[14:11:38 WARN]:        at gg.cristalix.listeners.CurseProcessListener.onChat(CurseProcessListener.java:39)
[14:11:38 WARN]:        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor148.execute(Unknown Source)
[14:11:38 WARN]:        at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:68)
[14:11:38 WARN]:        ... 11 more

why do I get this NPE?

chrome beacon
#

victimName is null

upper hazel
chrome beacon
upper hazel
#

what you need to know

#

this is all

slender elbow
#

something something shading

smoky anchor
#

Send KPlugApp

upper hazel
#

oh yes

chrome beacon
spare prism
slender elbow
#

fantasysomething plugin is shading kplug plugin

#

also mfw reload

spare prism
upper hazel
chrome beacon
#

KPlug line 41 still does not exist

#

As Emily said you probably shaded KPlug

upper hazel
#

exists but i can read this is in api source code. Not in view gui from api user

#

yes in shaded

#

i gess

#

<dependency>
<groupId>ru.kiscode</groupId>
<artifactId>KPlug</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${basedir}/libs/KPlug.jar</systemPath>
</dependency>

chrome beacon
#

Systempath 💀

upper hazel
#

it's a temporary relaxation

chrome beacon
#

remove systempath and use mvn install on your KPlug project instead

eternal oxide
#

Your KPlugApp is called from FantasyLandsPlugin but is trying to be cast to KPlug

#

what is DependProcess

smoky anchor
#

Just share the repo at this point :D /j

upper hazel
#

logic class

dusk tulip
#

So it work, it was my listner that doesn t work idk why

upper hazel
#

i getting error in start method

dusk tulip
#

Map< String,UUID> role= new HashMap< String,UUID>();

    @EventHandler
    public void onClick(InventoryClickEvent event){
        Player player = (Player) event.getWhoClicked();
        ItemStack itemStack = event.getCurrentItem();


        if(itemStack != null){
            if (itemStack.getItemMeta().equals("videMeta")){
                event.setCancelled(true);



            }   else if(itemStack.getItemMeta().equals("simpleLoupGarouMeta")){
                event.setCancelled(true);
                role.put( "Loup",player.getUniqueId());
                Player player1 = Bukkit.getPlayer(role.get("Loup"));
                player1.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 10000, 3 , false, false));

                if(role.get("Loup").equals(player.getUniqueId())){
                    player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 10000, 3 , false, false));
                }



            }
        }

    }

upper hazel
#

when try cast plugin with argument KPlug to Kplug but some reason getPlugin not return KPlug

dusk tulip
#

i tried with the meta

smoky anchor
#

what

dusk tulip
#

but work only whith the get name

smoky anchor
smoky anchor
eternal oxide
#

your DependProcess is expecting KPlug instance as the first argument so it fails to accept FantasyLandsPlugin

dusk tulip
#

if(itemStack == null) {return ;} else if

     (itemStack.getItemMeta().equals("videMeta")){
            event.setCancelled(true);
smoky anchor
#

no else

#

else defeats the purpuse

grim ice
#

how would you automatically plant a crop?

smoky anchor
dusk tulip
#

ok

#

 Map< UUID,String> role= new HashMap< UUID,String>();

    @EventHandler
    public void onClick(InventoryClickEvent event){
        Player player = (Player) event.getWhoClicked();
        ItemStack itemStack = event.getCurrentItem();


        if(itemStack == null) {return ;} if

         (itemStack.getItemMeta().equals("videMeta")){
                event.setCancelled(true);}  
        if(itemStack.getItemMeta() .........){
                event.setCancelled(true);
                role.put(player.getUniqueId(), "Loup");
                Player player1 = Bukkit.getPlayer(role.get("Loup"));
                player1.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 10000, 3 , false, false));

                if(role.get("Loup").equals(player.getUniqueId())){
                    player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 10000, 3 , false, false));
                }



            }

#

maybe that s better ?

#

my bad forgot the else if

smoky anchor
#

Delete the else

dusk tulip
#

yep my bad

smoky anchor
#

itemStack.getItemMeta().equals("videMeta")
This gives you a warning 100%
Read the warning
And fix the condition as well

dusk tulip
#

ok i am just not sure about that

#

will that work ?

#

now that i reverse the UUID and role

#

not that sorry *

#

Player player1 = Bukkit.getPlayer(role.get("Loup"));

#

that*

smoky anchor
dusk tulip
#

it's useless no ?

#

cause i know my player

#

Player player = (Player) event.getWhoClicked();

smoky anchor
#

Well ye, I didn't fully read your code

#

But if you want multiple villagers, then you gotta think of something a bit different, probably store an array of UUIDs

smoky anchor
fading beacon
#

wassup

dusk tulip
#

yeah i read it and i put a string but idk how to take the meta from the other void

dusk tulip
#


public class RoleCommand implements CommandExecutor, Listener {

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String msg, String[] args) {
        Player player = (Player) sender;
        if(msg.equalsIgnoreCase("role")){
            createInv( player);
        }


        return false;
    }

    public void createInv(Player player){
        ArrayList villageoisDesc = new ArrayList();
        villageoisDesc.add("Pas d'effect specifique");
        ArrayList SimpleLgDesc = new ArrayList();
        SimpleLgDesc.add("Force la nuit");


        Inventory RoleChoices= Bukkit.createInventory(null, 9*6, "§8Choix du role");

        ItemStack villageois = new ItemStack(Material.EMERALD);
        ItemMeta villageoisMeta = villageois.getItemMeta();
        villageoisMeta.setDisplayName("§6 Villageois");
        villageoisMeta.setLore(villageoisDesc);
        villageoisMeta.addEnchant(Enchantment.DURABILITY, 1, true);
        villageoisMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
        villageois.setItemMeta(villageoisMeta);

        ItemStack simpleLoupGarou = new ItemStack(Material.BONE);
        ItemMeta simpleLoupGarouMeta = simpleLoupGarou.getItemMeta();
        simpleLoupGarouMeta.setDisplayName("§6 Loup");
        simpleLoupGarouMeta.setLore(SimpleLgDesc);
        simpleLoupGarouMeta.addEnchant(Enchantment.DURABILITY, 1, true);
        simpleLoupGarouMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
        simpleLoupGarou.setItemMeta(simpleLoupGarouMeta);

        ItemStack vide = new ItemStack(Material.STAINED_GLASS_PANE,1);
        ItemMeta videMeta = vide.getItemMeta();
        videMeta.setDisplayName(" ");
        vide.setItemMeta(videMeta);



        RoleChoices.setItem(0, vide);
        RoleChoices.setItem(1, vide);





#


        RoleChoices.setItem(7, vide);
        RoleChoices.setItem(8, vide);
        RoleChoices.setItem(9, vide);

        RoleChoices.setItem(17, vide);
        RoleChoices.setItem(20, villageois);
        RoleChoices.setItem(21, simpleLoupGarou);

        RoleChoices.setItem(36, vide);

        RoleChoices.setItem(44, vide);
        RoleChoices.setItem(45, vide);
        RoleChoices.setItem(46, vide);

        RoleChoices.setItem(52, vide);
        RoleChoices.setItem(53, vide);

        player.openInventory(RoleChoices);

        player.playSound(player.getLocation(), Sound.LEVEL_UP, 2,3);
    }

#

Map< UUID,String> role= new HashMap< UUID,String>();

    @EventHandler
    public void onClick(InventoryClickEvent event){
        Player player = (Player) event.getWhoClicked();
        ItemStack itemStack = event.getCurrentItem();


        if(itemStack == null) {return ;}  if

         (itemStack.getItemMeta().equals("videMeta")){
                event.setCancelled(true);}
        if(itemStack.getItemMeta().equals(simpleLoupGarouMeta)){
                event.setCancelled(true);
                role.put(player.getUniqueId(), "Loup");
                if(role.get("Loup").equals(player.getUniqueId())){
                    player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 10000, 3 , false, false));
                }




        }

    }```
#

that's my class

#

idk how to take the meta of the void

#

the 1st one

#

createInv

smoky anchor
#

Mhmm I see
In that case the itemStack.getItemMeta().getDisplayName().equalsIgnoreCase(" ") was correct but
under your ItemStack itemStack = event.getCurrentItem(); put
ItemMeta meta = itemStack.getItemMeta();
And use that meta to check for stuff

tardy delta
#

how to take the meta of the void?

eternal oxide
#

You do not know how to use Maps

dusk tulip
eternal oxide
#

if (role.get(player.getUniqueId()).equals("Loup"))

grim ice
#

Block#getDrops doesn't provide an accurate list of drops for crops

#

any alternatives?

dusk tulip
grim ice
#

the list only contains 1 item of the drops, but if you actually break the block it would drop more than 1 item

#

meaning:
getWorld().dropItemNaturally(block.getLocation(), itemToDrop);
drops 1 potato, for example
but breaking the block yourself, drops 2 or 3

fading beacon
#

ddddddd

#

oh nvm

eternal oxide
#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
dusk tulip
#

``(again)lang

grim ice
eternal oxide
#

You get the actual drops in the BlockDropItemEvent

#

the List is modifiable for removal

dusk tulip
#

if (itemStack.getItemMeta().getDisplayName().equalsIgnoreCase("§6 Loup") && meta.toString().equalsIgnoreCase("simpleLoupGarouMeta")){

eternal oxide
#

use the color code not & if comparing names

shadow night
#

why compare item names tho

smoky anchor
smoky anchor
shadow night
#

eh

eternal oxide
fading beacon
#

im really sorry if i interrupt anything.
im trying to make a plugin that makes enderman unable to teleport when standing on water / raining, the only problem ive had is that the event justs cancells in every single scenario lol

import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Enderman;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityTeleportEvent;
import org.bukkit.World;

public class EndermanTeleport implements Listener {

    @EventHandler
    public void onEndermanTeleport(EntityTeleportEvent event) {

        if (event.getEntity() instanceof Enderman) {
            Enderman enderman = (Enderman) event.getEntity();
            World world = enderman.getWorld();
            Block toBlock = event.getTo().getBlock();

            boolean isRainingOrStorm = world.hasStorm();
            if (toBlock.getType() == Material.WATER)
                event.setCancelled(true);
            if (isRainingOrStorm) {
                event.setCancelled(true);

            } else if (toBlock.getType() == Material.LAVA)
                event.setCancelled(false);
            }
        }
    }
smoky anchor
grim ice
#

oh!

#

imagine using a decade old software

dusk tulip
#

Yeah but better pvp

grim ice
grim ice
dusk tulip
#

1.9 pvp is suck

grim ice
#

just use an autoclicker

smoky anchor
grim ice
#

and you're good

#

it's pretty easy to cheat in 1.8

dusk tulip
#

to train on UHC

smoky anchor
#

I would advice against arguing about version
It never leads anywhere if the argument is pvp

grim ice
#

i mean

#

minecraft pvp is gross anyways

shadow night
#

true

dusk tulip
#

I find that funny, and a lot of people to that s why most of big serv are on 1.8 (hypixel, uhc world, etc)

grim ice
#

no

#

hypixel is on 1.8 because it's old

dusk tulip
#

And for the pvp to

grim ice
#

and hypixel's biggest gamemode has plans of upgrading to 1.20

smoky anchor
#

Hypixel
Not for long, they be updating stuff

dusk tulip
#

most of players play Hyp pvps game ( 80/100 of their games) if they update the pvp they will lose too many players

grim ice
#

not really

#

all their games are dead

#

except bedwars

smoky anchor
#

Skyblock has over half of their playerbase

dusk tulip
#

that s pvp

grim ice
#

basically 90%

#

5% would be bedwars

smoky anchor
grim ice
#

and the rest is divided throughout the minigames

grim ice
smoky anchor
dusk tulip
#

yeah ok but All of the other color are pvp games

#

not just one pvp game

#

but a lot

grim ice
#

no one plays them

smoky anchor
#

The second biggest is AFK players

dusk tulip
#

If they lose 20/100 of players they are dead

#

so 50/100

#

No money for serv

#

no players in pvp game

#

so they not earn money from it

smoky anchor
#

well, steve off from work
GL on your minigame

dusk tulip
#

Thanks again for the help

tardy delta
dusk tulip
#

why

grim ice
#

because you dont forget how to use maps

dusk tulip
#

the Kit code

tardy delta
#

i just look at that code and i think no buddy

dusk tulip
#

as i said

#


public class KitCommand implements CommandExecutor, Listener, TabExecutor {
    public boolean kitEdit;
    Map<String, ItemStack[]> menus= new HashMap<String, ItemStack[]>();






    @Override
    public boolean onCommand( CommandSender sender, Command cmd,  String msg,  String[] args) {




        if (msg.equalsIgnoreCase("kit")){


            Player player = (Player) sender;
            Inventory SaveInv= Bukkit.createInventory(null, 9+9+9+9, player.getName() +" kit");

            if (args.length ==0){
                player.setFoodLevel(20);
                player.setHealth(20);
                player.sendMessage("§aVous avez ete nourri, Heal, et obtenez un stuff du mode de jeux : §4UHC/LG UHC ");



                if(menus.containsKey(player.getUniqueId().toString())) {
                    player.getInventory().setContents(menus.get(player.getUniqueId().toString()));}

#

the old code

#

that i made

echo basalt
#

?paste

undone axleBOT
echo basalt
#

ffs

tardy delta
#

still shitty

grim ice
dusk tulip
grim ice
dusk tulip
#

Non je suis juste tres mauvais

#

stv je peux meme te screen la date des vieux projets

blazing ocean
#

english only lol

grim ice
tardy delta
#

the french language pack keeps haunting me

blazing ocean
dusk tulip
#

Juste que je suis rouillé et que meme avant j'etais pas tres bon

blazing ocean
#

and am not monolingual kek

echo basalt
grim ice
#

it's a joke

#

😭

near furnace
#
    @EventHandler
    public void onPlayerRespawn(PlayerRespawnEvent e) {
        Plugin plugin = Main.getPlugin();
        Player p = e.getPlayer();

        //Location bedSpawnLocation = p.getBedSpawnLocation();
        if (e.isBedSpawn()) return; {
            double x = plugin.getConfig().getDouble("spawn.x");
            double y = plugin.getConfig().getDouble("spawn.y");
            double z = plugin.getConfig().getDouble("spawn.z");
            float pitch = (float) plugin.getConfig().getDouble("spawn.pitch");
            float yaw = (float) plugin.getConfig().getDouble("spawn.yaw");
            String worldName = plugin.getConfig().getString("spawn.world");

            if (worldName != null) {
                Location spawnLocation = new Location(Bukkit.getWorld(worldName), x, y, z, yaw, pitch);
                e.setRespawnLocation(spawnLocation);
                p.setBedSpawnLocation(spawnLocation, true);

                Bukkit.getScheduler().runTaskLater(plugin, () -> {
                    //cancelling the event here after one tick
                    p.setBedSpawnLocation(null);
                }, 1L);

                p.sendMessage(ChatColor.YELLOW + "Teleporting you to spawn... You do not have a home bed set");
            }
        }
    }```


Well yeaaaah it still sends that ugly ahh no bed minecraft text, and if i remove the e.setSpawnLocation, it dosen't send you to spawn at all
echo basalt
#

ew single letter variable names

rough drift
#

Check if server is running on aternos

tardy delta
#

systems programming is full of single letter variables 😉

echo basalt
#

are you a systems programmer

tardy delta
#

yes but a sane one

#

🥵

echo basalt
#

so that's a no

grim ice
#

I mean, you can still perfectly understand what's going on

tardy delta
#

ye

#

mostly

slender elbow
#

c stdlib and posix library is 💀 when it comes to function names

#

the less vowels the better

near furnace
echo basalt
#

no it's just dogshit

#

no excuse for you either

slender elbow
#

yeah my code runs faster

#

at runtime

#

because of it

near furnace
#

not running faster

rough drift
#

^

near furnace
#

typing faster

rough drift
#

not even

slender elbow
#

well, MY code runs faster

#

because of it

near furnace
rough drift
echo basalt
#

you save 3 letters when writing and spend 3 years trying to figure out what's going on

#

what an excuse

rough drift
#

over the entire runtime

slender elbow
#

literally 10 minutes

near furnace
#

i have no idea why you guys are all on this single letter variable instead of looking at the problem here 💀

echo basalt
#

because you have all the information available and you still refuse to embrace good habits

tardy delta
#

to some extent 🗿

echo basalt
#

I bet 5 bucks that atlasbomba is ola aka gongas

blazing ocean
#

yup

#

aka freeakyZ_

slender elbow
# tardy delta pretty readable actually

the problem is that they're literally just acronyms lol and you have to know what each letter means, rather than, y'know, it having a real full name, but yes it was limited by the time because artificial restrictions on name lengths

tardy delta
#

whats with the indetation today

ivory sleet
#

?ban @trail moss ban evading

slender elbow
#

and the lack of function overloading is pretty funny
ah yes, gethostbyname, but that's deprecated so we have gethostbyname2, but that's also deprecated :kekw:

undone axleBOT
#

Done. That felt good.

slender elbow
blazing ocean
#

gongas

slender elbow
#

oh i see :kekw:

blazing ocean
#

aka ola

slender elbow
#

another ban in paper too :chatting:

grim ice
#

who's gongas

acoustic pendant
#

Hey, does someone know how to hook an image with a link when uploading a resource? I've tried doing it but didn't success

blazing ocean
#

i bet you were gonna have the same question in 15 minutes

echo basalt
#

I like using imgbb embed links

acoustic pendant
hybrid turret
#

i suppose when doing Bukkit#getPlayer in the AsyncPlayerPreLoginEvent, getPlayer will return null?

slender elbow
#

yes

#

it will return null up until PlayerJoinEvent

hybrid turret
#

thanks

slender elbow
#

the earliest you can get a player is in the PlayerLoginEvent, it is given to you in the event, but you have to be careful as the Player does not actually exist in a World yet

hybrid turret
#

oh okay interesting

#

is the GameProfile already accessible?

#

ins prelogin

slender elbow
#

from where?

#

spigot doesn't expose the PlayerProfile in the APPLE

blazing ocean
#

apple

eternal oxide
#

its hard to expose teh contents of APPLE

onyx fjord
#

what would you guys recommend for easier and safer db management instead of using raw JDBC and harcoded sql statements

#

could be a really really tiny ORM

molten hearth
#

send http requests to an express api running sequelize

blazing ocean
#

express 💀

molten hearth
#

express my beloved

#

async support will finally be here in 16 years

blazing ocean
molten hearth
#

it'll come around the time project panama releases

#

(Never)

slender elbow
#

part of panama is literally released lol

dawn flower
#

how do i break a block (with particles)

peak depot
#

breaknatuarly or somehting iirc

dawn flower
#

nope

#

it just poofs it

slender elbow
#

Player breakBlock(Block)

dawn flower
#

i want to break bedrock, would it break with that?

slender elbow
#

no clue

shadow night
#

?tas

undone axleBOT
near furnace
#
@EventHandler
    public void onPlayerRespawn(PlayerRespawnEvent event) {
        Plugin plugin = Main.getPlugin();
        Player player = event.getPlayer();

        //Location bedSpawnLocation = p.getBedSpawnLocation();
        if (event.isBedSpawn()) return; {
            double x = plugin.getConfig().getDouble("spawn.x");
            double y = plugin.getConfig().getDouble("spawn.y");
            double z = plugin.getConfig().getDouble("spawn.z");
            float pitch = (float) plugin.getConfig().getDouble("spawn.pitch");
            float yaw = (float) plugin.getConfig().getDouble("spawn.yaw");
            String worldName = plugin.getConfig().getString("spawn.world");

            if (worldName != null) {
                Location spawnLocation = new Location(Bukkit.getWorld(worldName), x, y, z, yaw, pitch);
                event.setRespawnLocation(spawnLocation);
                player.setBedSpawnLocation(spawnLocation, true);

                Bukkit.getScheduler().runTaskLater(plugin, () -> {
                    //cancelling the event here after one tick
                    player.setBedSpawnLocation(null);
                }, 1L);

                player.sendMessage(ChatColor.YELLOW + "Teleporting you to spawn... You do not have a home bed set");
            }
        }
    }```


Was supposed to basically cancel the "You have no home bed or respawn anchor, or it was obstructed" text but i didnt. Any solutions?
river oracle
#

What does that even mean

#

Bro people deleting their question is cringe just explain it

#

Or don't respond

slender elbow
#

i love when people delete their messages after asking

slender elbow
river oracle
#

Something like that

slender elbow
#

boring

river oracle
pine cipher
#

Hi im trying to add custom rank prefix to the server :rank: but it shows this in chat. Can someone help me out on this

near furnace
pine cipher
#

it is itemadder plugin

#

and i need help asap

eternal oxide
pine cipher
#

ok

scenic jewel
#

private final Executor executor = Executors.newCachedThreadPool(); Should I do something about the executor on ondisable?

scenic jewel
eternal oxide
scenic jewel
#

wdym

#

executor.shutdown();

try {
    // Wait for currently executing tasks to finish
    if (!executor.awaitTermination(60, TimeUnit.SECONDS)) {
        // Force shutdown if tasks are not finished in the given time
        executor.shutdownNow();
        // Wait for tasks to respond to being cancelled
        if (!executor.awaitTermination(60, TimeUnit.SECONDS)) {
            System.err.println("Executor did not terminate in the specified time.");
        }
    }
} catch (InterruptedException ie) {
    // (Re-)Cancel if current thread also interrupted
    executor.shutdownNow();
    // Preserve interrupt status
    Thread.currentThread().interrupt();
}
#

should i do this when the server disable right

eternal oxide
#

yes

#

I'd do 30 tops though. 60 is a long time to hang the server

#

even 10

#

you should not have to interupt the current thread

#

current thread is the server

winter zenith
#

anybody know what the behavior is when you shoot a projectile at a player in creative and it bounces off. is an event being cancelled?

scenic jewel
eternal oxide
#

you just print the exception

#

in the catch

scenic jewel
#

just remove Thread.currentThread().interrupt(); and lower it to 30 then

#

?

ivory sleet
#

I mean you probably don’t care about interruption policies, if its on disable, but always a good practice to follow it

scenic jewel
#

so what should i edit in the code

ivory sleet
#

@blazing ocean

near furnace
#

@worldly ice im going crazy i need your help, im fr going to lose all my hair

worldly ice
#

what do you need help with?

near furnace
#

hope you understand :((

near furnace
#

my nigh-

#

nightmares

barren ginkgo
#

Hello everyone, how can i do for send title to some players pls ?

near furnace
#
@EventHandler
    public void onPlayerRespawn(PlayerRespawnEvent event) {
        Plugin plugin = Main.getPlugin();
        Player player = event.getPlayer();

        if (event.isBedSpawn()) return; {
            double x = plugin.getConfig().getDouble("spawn.x");
            double y = plugin.getConfig().getDouble("spawn.y");
            double z = plugin.getConfig().getDouble("spawn.z");
            float pitch = (float) plugin.getConfig().getDouble("spawn.pitch");
            float yaw = (float) plugin.getConfig().getDouble("spawn.yaw");
            String worldName = plugin.getConfig().getString("spawn.world");

            if (worldName != null) {
                Location spawnLocation = new Location(Bukkit.getWorld(worldName), x, y, z, yaw, pitch);
                event.setRespawnLocation(spawnLocation);

                player.sendMessage(ChatColor.YELLOW + "Teleporting you to spawn... You do not have a home bed set");
            }
        }
    }

    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent event) {
        Plugin plugin = Main.getPlugin();
        Player player = event.getPlayer();

        if (player.getBedSpawnLocation() != null) return; {
            double x = plugin.getConfig().getDouble("spawn.x");
            double y = plugin.getConfig().getDouble("spawn.y");
            double z = plugin.getConfig().getDouble("spawn.z");
            float pitch = (float) plugin.getConfig().getDouble("spawn.pitch");
            float yaw = (float) plugin.getConfig().getDouble("spawn.yaw");
            String worldName = plugin.getConfig().getString("spawn.world");

            if (worldName != null) {
                Location spawnLocation = new Location(Bukkit.getWorld(worldName), x, y, z, yaw, pitch);
                player.setBedSpawnLocation(spawnLocation, true);

                System.out.println(player.getBedSpawnLocation());
            }
        }
    }```

Look, i tried everything and that ugly ahh message still pops up
#

that message is haunting mee

blazing ocean
barren ginkgo
#

Hello everyone, how can i do for send title to some players pls ?

near furnace
near furnace
worldly ice
#

i remember we talked about using only the respawn event and a runnable

near furnace
#

owh yea i tried that

#

didnt work

worldly ice
#

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

worldly ice
#

"does not working"

#

im the grammar police

near furnace
#

theres not really any error

#

lemme explain

#

so

#

i set the players bedrespawn location and removed it 1 tick later, all fine but

barren ginkgo
near furnace
#

it still shows that ugly ahh message

worldly ice
#

it sends the message when you set your spawnpoint then break your bed afterwards?

near furnace
near furnace
worldly ice
near furnace
#

and when i respawn its supposed to yk set my bed respawn point tricking minecraft

#

but minecraft dont get tricked

#

he knows, and he still shows that message

worldly ice
#

do you respawn at the right location?

near furnace
#

also if i dont put event.setRespawnLocation(spawnLocation), it wont even send you there at all

worldly ice
#

hmm

#

it looks like the respawn event gets called too early to change bed spawn

#

too late*

near furnace
#

im pretty sure minecraft ignores that setBedRespawnLocation

#

yes

#

because its respawn event\

worldly ice
#

another idea i have is to change their bed respawn on death, and then remove it on respawn

#

when they die without a bed respawn location, add them to some sort of list so you can handle disconnects

near furnace
#

and on respawn, it sends the player to spawn

#

everything works fine with this code, but the message still shows up 💀 omg minecraft is haunting me

near furnace
worldly ice
#

wait that displays the message too?

#

what about without the respawn event

#

so i think what you had before all of this

near furnace
#

oh yea i put a sout(getPlayerBedLocation) for debugging purposes

#

it prints out "null"

#

so it isnt really setting the bed spawn location, on the death listener

worldly ice
#

might be a paper thing?

near furnace
#

no idea

worldly ice
#

try souting the bed spawn location in the respawn event

near furnace
#

if you have a spigot server, you can try it if you want ofc

near furnace
#

its gonna print null obviously

worldly ice
#

it should persist through

#

you're never setting the bed respawn to null anywhere

near furnace
worldly ice
#

what's the 2nd arg to that method

#

the bool

near furnace
#

, true?

worldly ice
#

yeah

near furnace
#

oh it just forces to set that spawn location

#

wait lemme remove that

#
[23:37:50 INFO]: [myplugin] [STDOUT] Death Event:null
[23:37:50 WARN]: Nag author(s): '[]' of 'myplugin v1.0.0' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).
[23:37:50 INFO]: lolnypop was killed
[23:37:50 INFO]: [@: Killed lolnypop]
[23:37:51 INFO]: [myplugin] [STDOUT] Respawn Event: null```
#

both listeners says that the player's bed respawn location is null

shadow night
near furnace
shadow night
#

don't do that

barren ginkgo
# near furnace why not? send code
public class Brayan implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String s, String[] args) {

        player.sendTitle("Hello!", "This is a test.", 1, 20, 1);

        return false;
    }
}

near furnace
#

i use the main class to only enable stuff thats why i named it Main

#

i dont really put any other code in it

shadow night
near furnace
#

i thinkk

worldly ice
near furnace
sterile breach
#

render distance 32 mean that we can see all chunks in a 32 chunks radius ? or 32 chunks in total?

worldly ice
#

you're trying to reference player which does not exist

shadow night
worldly ice
shadow night
#

but mostly just conventions

near furnace
#

do if(sender instance of Player player) {
player.sendTitle(-- > your args here);
}

barren ginkgo
barren ginkgo
#

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

import static sun.audio.AudioPlayer.player;


public class Brayan implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String s, String[] args) {

        player.sendTitle("Hello!", "This is a test.", 1, 20, 1);

        return false;
    }
}

tardy delta
#

what

worldly ice
#

import static :pepehands:

#

what even is that

near furnace
#

like check if the command sender is a player first, then do player.sendTitle

#

accident

lucid fog
#

hey im making a command rn and i wanna see how mojang made their commands, is there a way to look at the minecraft commands code?

near furnace
#
package fr.cuphiz.apprendre;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import static sun.audio.AudioPlayer.player;


public class Brayan implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String s, String[] args) {

        if(sender instanceof Player player) {

        player.sendTitle("Hello!", "This is a test.", 1, 20, 1);

        }

        return false;
    }
}```
barren ginkgo
# lucid fog hey im making a command rn and i wanna see how mojang made their commands, is th...
package fr.cuphiz.apprendre;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;



public class Brayan implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String s, String[] args) {

        Player player = (Player)sender;

        player.sendTitle("Hello!", "This is a test.", 1, 20, 1);

        return false;
    }
}

Error : method sendTitle in interface org.bukkit.entity.Player cannot be applied to given types;

worldly ice
near furnace
near furnace
worldly ice
#

those should be correct

barren ginkgo
worldly ice
#

what version

lucid fog
barren ginkgo
lucid fog
#

idk how to word what im talking abt

shadow night
worldly ice
barren ginkgo
#

1.8.8

worldly ice
#

?1.8

undone axleBOT
worldly ice
#

if you're using 1.8 i dont think that method exists

near furnace
barren ginkgo
near furnace
#

thennnn i dont know how to help you haha

worldly ice
near furnace
#

1.8.8 is kinda different

barren ginkgo
#

methods

near furnace
#

you gotta find another way than using player.sendTitle

worldly ice
#

its just that the way that brigadier is made it causes the decompiler to have a stroke and put in 3 casts in one line

#

and then the formatting gets all weird

worldly ice
shadow night
worldly ice
#

yeah you can look at brigadier but they specifically said mc commands

near furnace
#

like im doing :)

worldly ice
#

general rule of thumb is to just never get 1.8

#

or if you use 1.8 you should know what you're doing

#

dont expect support when using a version thats almost a decade old

near furnace
#

but for learning spigot on 1.8 is a really bad idea

#

most events, methods dont exist there haha

worldly ice
#

yeah

cedar dawn
#

Does anyone know how to spawn block particles in Spigot 1.20.6?
I've tried doing it like this but it doesn't work:

b.getWorld().spawnParticle(Particle.BLOCK, b.getLocation().add(0.5, 0.5, 0.5), 50, 0.3, 0.3, 0.3, b.getBlockDate());
worldly ice
#

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

near furnace
#

zD theres a forum for everything ngl

#

?notworking ?whereami ?main ;-;

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.

near furnace
#

so many of em

sterile breach
#

geting 16^2 (256 chunks) in the main thread so. its a bad idea ?

near furnace
#

also datasian, i give up

#

the only way to stop this minecraft message

#

is to intercept the packets

#

other than that, its literally impossible

#

you can't change it at all

worldly ice
#

welp

near furnace
#

not possible

worldly ice
#

time to learn packetevents

near furnace
#

ive tried and i wanna move on from this nightmare

near furnace
#

dude

#

why did minecraft have to make it bullet proof

#

like you cant trick it

#

he knows 🔪

worldly ice
#

minecraft knows all

near furnace
#

no matter WHAT you do, i tried setting the bedspawnlocation to trick it? no it knows.

daring lark
#
package pl.creazy.creazytest.command;

import static pl.creazy.creazylib.util.message.Message.sendChat;

import org.bukkit.NamespacedKey;
import org.bukkit.block.TileState;
import org.bukkit.entity.Player;

import pl.creazy.creazylib.command.constraints.Args;
import pl.creazy.creazylib.command.constraints.Command;
import pl.creazy.creazylib.data.persistence.nbt.NbtEditor;
import pl.creazy.creazylib.part.constraints.Part;
import pl.creazy.creazylib.util.key.Keys;
import pl.creazy.creazytest.CreazyTest;

@Command("test")
@Part
public class TestCommand {
  private static final NamespacedKey KEY = Keys.create("test_key", CreazyTest.class);

  @Args("test")
  void test(Player player) {
    sendChat(player, "test");
  }

  @Args("nbt")
  void testNbt(Player player) {
    var block = player.getTargetBlock(null, 5);
    var state = (TileState) block.getState();

    NbtEditor.of(state)
        .set(KEY, "Dupa")
        .save();
    
    var message = NbtEditor.of(state).get(KEY, String.class);

    sendChat(player, message);
  }
}
#
Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_20_R4.block.CraftBlockState cannot be cast to class org.bukkit.block.TileState (org.bukkit.craftbukkit.v1_20_R4.block.CraftBlockState and org.bukkit.block.TileState are in unnamed module of loader java.net.URLClassLoader @79fc0f2f)
    at pl.creazy.creazytest.command.TestCommand.testNbt(TestCommand.java:28) ~[?:?]
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?]
    at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
    at pl.creazy.creazylib.command.PlayerCommandWrapper.onCommand(PlayerCommandWrapper.java:51) ~[?:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.20.6-R0.1-SNAPSHOT.jar:?]

why am i getting this error?
Like what the hell iw wrong with my cast?

near furnace
#

hopefully i will learn spigot fully and come back to help full time!

worldly ice
daring lark
worldly ice
#

sout the block

#

also nbt editor?

#

use

#

?pdc

near furnace
#

ok goodnight @worldly ice

worldly ice
#

gn? man i just woke up

near furnace
#

haha

grim ice
#

is it possible to set multiple click events

#

for a component

worldly ingot
#

No, each component can only have one of each click and hover

#

Your options are either two separate components with separate click events, or have the click event run some arbitrary command that performs two actions

young knoll
#

I wonder how click events work with negative space

#

If you overlap them does only one fire

worldly ingot
#

My guess would be just the top level one would fire. But I also don't think the client would even attempt to create an area in the negative x direction

young knoll
#

¯_(ツ)_/¯

worldly ingot
#

You can try it, but if it works, it's definitely undefined behaviour lol

hybrid turret
#

currently trying to get my InventoryGUI using 7smile7's guide to work again.

I have the abstract InventoryGUI, abstract PaginatedGUI and normal OptionsGUI which is called by PlayerListGUI.
What it does is it takes a command (action) and passes it to the next GUI-instance until the whole command is built and then dispatches the command as the executing player from OptionsGUI (or PlayerListGUI if the command does not have extra options).

Both OptionsGUI and PlayerListGUI extend PaginatedGUI.

Now I get the following NPE when clicking on the ban action, and then any player head (so that the OptionGUI opens (or at least it should)).
https://paste.md-5.net/ipodegoxap.cs
I have no idea why my plugin variable (also if I use this.getPlugin() from my super class).

Yes this works together with my data handling stuff but this should be fine since it is working on other ends and apparently the plugin variable is null and not any further stuff (at least yet).

Code:

#

ignore the commented out stuff and whatever, just playing around

#

@me please :))

tardy delta
#

wtf

shadow night
#

Oh wait