#help-development

1 messages · Page 2013 of 1

vocal cloud
#
    <distributionManagement>
        <repository>
            <id>miketheshadow.repo</id>
            <name>Local Server</name>
            <url>dav:http://192.168.0.35:8081</url>
        </repository>
    </distributionManagement>
#

this is setup properly?

sterile token
#

Express doesnt matter, just i want to know, what request type does maven when deploying PUT or POST?

shy finch
#

But what do I do

#

after settings.xml

vocal cloud
#

you deploy

shy finch
#

I've done the research

#

I am confused on the step after settings.xml

#

Like, what do I do in my project

vocal cloud
#

You haven't done the research if you don't know what to do in your project

shy finch
#

bruh

vocal cloud
#

you can bruh me all you want

shy finch
#

I've been there, I've been on every open source bukkit plugin I can think of (WorldEdit, EssentialsX, PlaceHolderAPI, ProtocolLib, etc), I've been on github docs, I've been on stack overflow, I've been googling since noon.

vocal cloud
#

Wait you're trying to deploy a maven project right?

shy finch
#

Becides, that page you sent me isn't applicable because my project is in gradle, which is partially why I am having trouble.

quaint mantle
#

Yknow, I love it when shockbyte scams me.

#

They suspended my server after a day for late payments.

#

I bought the server YESTERDAY for 50% off, and its A MONTHY SERVER

#

How???

shy finch
#

Sounds like something you should take up with their support

quaint mantle
#

I already have, this is bullshit.

#

If they are going to scam me I want a refund lmfao

#

Considering thousands use their service

vocal cloud
#

Then I don't exactly understand your issue

shy finch
#

Take this for example.

plugins {
    `maven-publish` apply false
}

// Some subprojects shouldn't be published, how does this work? How does it select modules?
subprojects {
    apply(plugin = "maven-publish")
    configure<PublishingExtension> {
        repositories {
            maven {
                name = "GitHubPackages"
                url = uri("https://maven.pkg.github.com/OWNER/REPOSITORY")
                credentials {
                    username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME")
                    password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN") // It wants me to replace this with my token, but I need to publish this to github, so people will see it
                }
            }
        }
        publications {
            register<MavenPublication>("gpr") {
                from(components["java"])
            }
        }
    }
}

I also can't just copy and paste this into my build.gradle.kts file, else I get this weird lock error that people used to have 4 years ago.

java.lang.IllegalArgumentException: org.gradle.api.internal.initialization.DefaultClassLoaderScope@5f1e212a must be locked before it can be used to compute a classpath!
#

I am confused because on maven it looks to be pretty straightforward

<distributionManagement>
   <repository>
     <id>github</id>
     <name>GitHub OWNER Apache Maven Packages</name>
     <url>https://maven.pkg.github.com/OWNER/REPOSITORY</url>
   </repository>
</distributionManagement>
regal carbon
#

still need help with this, thanks

sterile token
regal carbon
#

yes

sterile token
#

Allright

#

Send full code

#

Where doesn future.get come?

#

You have a variable?

regal carbon
quaint mantle
#

Caused by: java.lang.IndexOutOfBoundsException: Index 2 out of bounds for length 2

if (crate.getItemList().get(pos) != null) {
#

Any reason why this errors?

#

getItemList returns a list btw

#

It errors at pos 2 cause there is no 2 in the list

young knoll
#

Well you have your answer

quaint mantle
#

is what i meant

#

ive tried checking if .size <= pos

#

and such like that

#

doesnt seem to work

young knoll
#

It should

quaint mantle
#

it doesnt for some reason

young knoll
#

If pos is 2 and size is 2, you will get an error

quaint mantle
#

oh i see a fix then

sick herald
#

ik it says dont report but its a minecraft thread... any idea what causes this?

young knoll
#

You aren’t using spigot

#

Ask purpur

sick herald
#

a lot of people here use paper so thats why i asked but ight

young knoll
#

Paper won’t help you either

#

You need to seek support from the fork you are using

quaint mantle
#

@young knoll Now the error is index 3 out of bounds for length 2

#
if (crate.getItemList().size() < pos) {
            if(crate.getItemList().get(pos) != null){
#

first line

tardy flame
young knoll
#

You need <=

quaint mantle
young knoll
#

You cannot get element 2 in a list with size 2

quaint mantle
young knoll
#

Then you need <= size - 1

quaint mantle
#

didnt work

tardy flame
#

Also you need to set pos - 1 since size/ length starts from 1 while getters from 0

#

And that should fix it

quaint mantle
#

automatically

#

.size starts at 1

tardy flame
#

Just do pos - 1 in the second line

#

It will fix it

#

Oh wait-

#

I just read the first line

#

The first line doesn't have sense at all

quaint mantle
#

how?

tardy flame
#

Since it will only return problems if you have number above the size of the list

quaint mantle
#
public ArrayList getItemList(){
        return this.itemList;
    }
tardy flame
#

Wait, let me get on computers

young knoll
#

Oh that isn’t an early return

#

You want to use >

#

The list must be longer than the index you are trying to access

quaint mantle
#

im trying to get an object from pos

#

how would crate.getItemList().size() > pos help

#

thats basically saying only if its above the size

young knoll
#

Because

#

No

#

It’s saying if the size is above pos

quaint mantle
#

thats what i mean

#

.> (bigger then)

#

.< (less then)

young knoll
#

Correct

#

You want the list

#

To be larger than the pos you are trying to access

quaint mantle
#

ill try it

tardy flame
#
if (crate.getItemList().size() < pos) {
  return;
}
Object object = crate.getItemList().get(pos);
if(object == null) {
  return;
}
#

You can use this ^^

quaint mantle
#

thats the same thing

young knoll
#

Yes early return is usually better

tardy flame
#

which works with your current way

quaint mantle
#

but returning

young knoll
#

Less messy

tardy flame
#

👀

quaint mantle
#

ill try that after

#

@young knoll I REFUSE TO BELIEVE YOUR METHOD WORKED

#

WHY???

tardy flame
#

what

quaint mantle
#

that makes 0 sense why it needed to be >

tardy flame
#

eh

#

okay i will tell you

young knoll
#

Simple logic

#

Index must be less than the size of the list

#

Otherwise

#

It is outside the list

#

And throws said error

quaint mantle
#

oh

#

i was thinking < meant that

#

for some reason

tardy flame
#
// crate.getItemList().size() is a size of a provided before by a getter array list, while pos is a integer number
// if you want to access the item from the arraylist it has to be in the bounds of it
// but since you are trying to access a list that is < (smaller) than the position
// it will always throw an exception
if (crate.getItemList().size() < pos) {
            if(crate.getItemList().get(pos) != null){
#

example: size of the arraylist is 5 and the pos is 6, logically it won't work but in your code you will allow it to go through because 5 < 6 and later on within the code you will try to get a element from a list which object doesn't exists

quaint mantle
#

ohhh

#

well, at least i converted my stuff

#

so now, it runs on OOP instead of config.yml

#
CrateInfo basicCrate = CrateInfo.newCrate("basicCrate", ChatColor.GREEN + "Basic Crate");

CrateItems tntBasic = CrateItems.newCrateItem("tntBasic", new ItemStack(Material.TNT, 16), 15);
basicCrate.addItemToList("tntBasic");

CrateItems diamondBasic = CrateItems.newCrateItem("diamondBasic", new ItemStack(Material.DIAMOND, 2), 2);
basicCrate.addItemToList("diamondBasic");
#

more efficent and less lines

#

pog

young knoll
#

So now it’s not configurable

#

Rip

quaint mantle
#

only i really need to configure it

#

so ill just edit the script whenever

#

i want to add changes

#

and /reload plugins

tardy flame
#

don't do that here

#

:crime:

#

reloading plugins is illegal bruh

young knoll
#

Lol

#

Don’t reload on a live server

tardy flame
quaint mantle
#

shockbyte reenabled my server

young knoll
#

Go to console, op <username>

quaint mantle
#

they made an oopsie

dawn hazel
#

wrong channel dude

tardy flame
#

you need to provide your username

#

without the <>

dawn hazel
#

op arachnotfound

quaint mantle
#

@quaint mantle Just a question: Are you attempting to make a plugin?

#

nvm

young knoll
#

I really can’t tell if troll or not

#

Oh well

quaint mantle
#

^^^

dawn hazel
#

that or some kid who doesnt know what they are doing

tardy flame
dawn hazel
#

im not in the mood to argue with kids

young knoll
#

You’ve literally asked “why plugin not work”

#

And now you don’t know what a plugin is

#

🤦

dawn hazel
#

burned lmfao

#

/j

young knoll
#

Damn

tardy flame
#

Eyyy!

young knoll
#

Tragic

tardy flame
#

Don't use that words here

#

@ancient plank

dawn hazel
#

what

tardy flame
#

I'm sad now 😥

#

🐔

river oracle
#

Trol ls

quaint mantle
#

100% a troll

#

@young knoll should i make it so my gui gets bigger as there is more available items to obtain from a crate

#

ex: if it exceeds 14 it becomes 1 more bigger

#

and so on and so forth

#

this is what it looks like rn

#

for viewing the items a crate gives

#

chance based, by weight

young knoll
#

I do like resizing GUIs

#

But you could also just go the simple route and always use the biggest one

quaint mantle
#

i like overcomplicating things

#

so xd

river oracle
#

Making guis is pretty simple they are scaled super easily

#

What I love about em

#

I love working with minecraft guis

young knoll
#

Yeah it’s just simple math

quaint mantle
elfin steppe
#

If I have a GUI class (containing an inventory), how do I get access to that inventory in another class?

tardy flame
elfin steppe
#

Yeah

quaint mantle
#

does the "InventoryOpenEvent" count towards pressing E

#

or opening a chest

elfin steppe
#

I have to call openInv in another class

quaint mantle
#

et

#

*ect

#

if so, how do I make it so it only detects customInventories (like custom uis)

tardy flame
#

Player#openInventory(new Your inventory());

quaint mantle
#

or opening a chest

#

triggers it

tardy flame
#

Opening since you can change your keybinds

quaint mantle
#

Well then, how do I make it only detect custom inventories/guis?

#

Like, ones made by a plugin

tardy flame
#

InvnetoryHolder

#

InventoryHolder*

quaint mantle
tardy flame
#

Let me give you-

young knoll
#

Opening the player inventory does not trigger it

#

Chests do

elfin steppe
#
public class SpawnGUI implements Listener {
    private final Inventory inv;

    public SpawnGUI() {
        inv = Bukkit.createInventory(null, 9, "Spawns");

        initializeItems();
    }

So if this is the inventory class (i j cut out the long part)
And this is my listener in the other class:

@EventHandler
    public void onRightClick(PlayerInteractAtEntityEvent e) {
        Player p = e.getPlayer();
        if (e.getRightClicked().getType() == EntityType.ARMOR_STAND) {
            p.openInventory(new );
        }
    }

Then i'm j supposed to do p.openinventory(new SpawnGUI()) or?
@tardy flame

tardy flame
#

And the holder itself is just an empty

young knoll
#

Please do not abuse inventory holder this way

tardy flame
tardy flame
quaint mantle
#

Ehhh, for now ig its fine idrc

young knoll
#

No it’s not

tardy flame
#

Joking

young knoll
#

Use the view returned from openInventory

tardy flame
#

Using the view is even more stupid

young knoll
#

No it’s not

#

That’s the recommended way to identify custom inventories

#

Or just use the inventory instance itself

tardy flame
#

Wait can you Access the view from the inventory events?

young knoll
#

Yes

tardy flame
#

Oh-

young knoll
#

InventoryEvent.getView

tardy flame
#

Alr, didn't know about that one

elfin steppe
#

My events are not working, i cancelled InventoryDragEvent and tp'ed a player on a certain item click, but none of it is working. Here is my code:

@EventHandler
    public void onInventoryClick(final InventoryClickEvent e) {
        if (!e.getInventory().equals(inv)) return;

        e.setCancelled(true);

        final ItemStack clickedItem = e.getCurrentItem();

        if (clickedItem == null || clickedItem.getType().isAir()) return;

        final Player p = (Player) e.getWhoClicked();

        if (clickedItem.getType() == Material.BEACON) {
            Location loc = new Location(Bukkit.getWorld("world"), 139.5, 8.0, 75.5, 180, 0);
            p.teleport(loc);
            new Beast().giveKit(p);
        }
    }

    @EventHandler
    public void onInventoryDrag(InventoryDragEvent e){
        if (e.getInventory().equals(inv)) {
            e.setCancelled(true);
        }
    }
#

(And yes i registered the class lol)

tardy flame
#

What is the inv variable you are using?

elfin steppe
#

It's the inventory that i got from my inv class

#

From the class i showed u earlier

#
Inventory inv = new SpawnGUI().getInv();
tardy flame
#

Compare the inventory views as @young knoll said

elfin steppe
#

Never worked with inv views before, I don't really know anything about it

#

I j don't get why the events r not getting triggered

#

Like even if i remove the if statement and just cancel the event its not getting cancelled

#

I can still drag everything

young knoll
#

You got the annotation and the events registered

elfin steppe
#

Yup

quaint mantle
#
package me.emerald.emeraldsplugin.data;

import org.bukkit.inventory.ItemStack;
import java.util.HashMap;

public class Items {
    static HashMap<String, ItemStack> itemList = new HashMap<>();

    public Items(String locName, ItemStack item){
        itemList.put(locName, item);
    }

    public static HashMap<String, ItemStack> getAllItems(){
        return itemList;
    }

    public static ItemStack getItem(String locName){
        return itemList.get(locName);
    }

    public static Items newItem(String locName, ItemStack item){
        return new Items(locName,item);
    }
}
#

OOP my beloved

grim ice
#

Lmfao

#

Whats the point of these methods if the hashmap ia public

quaint mantle
#

how do I make it so that InventoryOpenEvent only runs if its a custom ui

#

not a chest or anything

#

but a java generated one

elfin steppe
#
 
 Inventory inv = new SpawnGUI().getInv();

    @EventHandler
    public void onInventoryClick(final InventoryClickEvent e) {
        if (e.getInventory().equals(inv)) {
            if (e.getCurrentItem().getType() == Material.BEACON) {
                Location main = new Location(Bukkit.getWorld("world"), 139.5, 8.0, 75.5, 180, 0);
                Player p = (Player) e.getWhoClicked();
                p.teleport(main);
                new Beast().giveKit(p);
                return;
            }
            e.setCancelled(true);
        }
    }

As soon as I add ```java
if (e.getInventory().equals(inv)) {}

#

I'm trying to cancel the event in a certain inventory called inv (from the SpawnGUI class) but It doesn't seem like it's actually getting the inv

fickle frost
young knoll
elfin steppe
#

nope i can still drag everything

#

And as soon as I remove that line everything works perfectly fine

#

It's like it's not actually getting the inventory or smth

young knoll
#

Hmm well the clicked inventory should be equal

#

I think the general inventory includes the top and bottom, which will not equal your custom inventory

elfin steppe
#

Yeah

granite owl
#

if ive got it right pdc does exactly that, store custom data into objects utilizing nms, but not modfying actual stat values?

#

so just classic wrapper api round vanillas nms?

young knoll
#

It’s an NBT wrapper

#

But cannot interface with vanilla NBT

granite owl
young knoll
quaint mantle
#

@young knoll figured it out btw, converted all my inventory scripts to handle InventoryHolder, and turned them into OOP's and made each of them owned by said OOPS

#

then, compaired the holder to the instance of said OOP

#

to check if its the correct ui

#

without using its name

#

therefor, if somebody were to rename a chest the exact same name, to attempt to do stuff ur not suppost to

#

it would not work

#

protection

last ledge
#
            ---
        }```
I want to autorun command behalf of player, if he hasnt joined before. how do i do it?
#

I want players to auto run /st play firstjoin

#
            player.performCommand("st play firstjoin");
        }```
#

this will work?

young knoll
#

Yes

#

Also

#

If (!player.hasPlayedBefore())

young knoll
#

Also what the heck is “an OOP”

quaint mantle
fickle frost
#

turned them into OOP's and made each of them owned by said OOPS
then, compaired the holder to the instance of said OOP

#

This makes no sense.

young knoll
#

You can’t have “an object oriented programming”

young knoll
#

Object oriented programming is a concept

#

Not a noun

quaint mantle
#

ah

fickle frost
#

Do you mean "I turned them into objects"?

last ledge
quaint mantle
#

I turned each of them into its own holder, in which afterwards, made the ui itself owned by said holder.
Then, in the InvClickEvent, compaired the guis holder to an intanceof said holder (Kinda confusing ill show code if I have to)

#

Example:

if(holder instanceof Challenges) {
#
public class Challenges implements InventoryHolder {
    private static Inventory gui;

    public Challenges() {
        gui = Bukkit.createInventory(this, 9*5, ChatColor.DARK_RED + "Challenges");
young knoll
#

Yeah like I said it’s abuse of the API

#

But hey, I guess it works

quaint mantle
young knoll
#

I told you several times

#

The view

quaint mantle
#

I did try it, kinda bypassable

young knoll
#

It’s not

#

If you do it right

quaint mantle
#

oh then I did it wrong lol

drowsy helm
#

having a static invetory instance itself its a pretty bad idea

quaint mantle
#

cause when I did it chests where not allowing items to be taken out of them

young knoll
#

Take view from openInventory

#

Add view to hashset

#

Check if the view from an inventory event is in said hashset

rough drift
young knoll
#

And remove it from the hashset on inventory close

last ledge
quaint mantle
#

it doesnt revolve around that now

drowsy helm
fickle frost
#

Instead of doing this:

if (player.hasPlayedBefore() == false) {
Do this:
if (!player.hasPlayedBefore()) {

quaint mantle
fickle frost
#

He was joking.

quaint mantle
#

ik lol

quaint mantle
#

wait you can spam "!"?

rough drift
#

yes

#

each ! reverses

drowsy helm
#

yeah it just inverts the boolean

rough drift
#

so !!true is true

quaint mantle
#

i finally can use a million exclamation points in my code

fickle frost
#

Don't teach him bad things.

rough drift
#

because not not true

quaint mantle
#

pog

rough drift
#

is not false, which is true

quaint mantle
#

@fickle frost wanna see something that will kill you

#

but im too lazy to redo

fickle frost
#

I'm scared to say yes.

#

Have mercy.

quaint mantle
drowsy helm
#

iirc ! in boolean algebra is just |1-x|

quaint mantle
#

its a mess

fickle frost
#

You know, the thing that pisses me off more than anything else you have written there is the inconsistent use of spaces before and after your curly braces and parenthesis.

quaint mantle
#

thats starting to piss me off as well

#

well NOW i kinda wanna redo this entire thing now

#

damnit

drowsy helm
#

honestly could be worse

fickle frost
#

if(block.getType() == Material.CHEST){TileState state = (TileState) block.getState();
Oh god, you typed a statement after a curly brace on the same line. I'm dead.

young knoll
#

And this is why we have auto format

#

I can press 3 buttons and all my problems go away

fickle frost
#

Or just have it auto-format whenever you save the file.

quaint mantle
#

does it with a ton of my code

#

have 0 idea how to disable that

#

id NEVER do that normally

#

cause it looks ugly in my opinion

#

and can be confusing

sharp saffron
#

hey so im trying to make a custom crafting recipe using custom items in the recipe but so far I only managed to have 1 custom item, so does anyone know how i can add this item multiple times lets say filling the top row?

#

`package me.igloo4life.test123.more;

import me.igloo4life.test123.Test123;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.ItemStack;

import java.util.HashMap;

public class ItemManager implements Listener {

@EventHandler
public void onPlayerJoin(PlayerJoinEvent e) {
    e.getPlayer().getInventory().addItem(Test123.customItem);
}

@EventHandler
public void onPlayerCraftItem(PrepareItemCraftEvent e) {
    if (e.getInventory().getMatrix().length < 9) {
        return;
    }
    checkCraft(new ItemStack(Material.NETHERITE_SWORD),e.getInventory(), new HashMap<Integer, ItemStack>(){{
        put(1, Test123.customItem);

    }});
}

public void checkCraft(ItemStack result, CraftingInventory inv, HashMap<Integer, ItemStack> ingredients) {
    ItemStack[] matrix = inv.getMatrix();
    for(int i = 0; i < 9; i++) {
    if (ingredients.containsKey(i)) {
        if (matrix[i] == null || !matrix[i].equals(ingredients.get(i))) {
            return;
            }
        } else {
            if(matrix[i] != null){
                return;
            }
        }
    }
    inv.setResult(result);
}

}`

drowsy helm
#

just use the Recipe api

young knoll
#

You do know RecipeChoice.ExactChoice exists

drowsy helm
#

ExactChoice

quaint mantle
#

speaking of recipes, ive never worked with that

young knoll
#
  • does not work on shapeless recipes
quaint mantle
#

also speaking of that

#

is customMobDrops possible?

#

with plugins?

young knoll
#

Sure

drowsy helm
#

yeah definitely

quaint mantle
#

cool

young knoll
#

Hell you can do that with a datapack

quaint mantle
#

arent datapacks just plugins for singleplayer

#

:troll:

fickle frost
#

No, they're packs of data obviously.

quaint mantle
#

that was a joke

fickle frost
#

As was mine.

quaint mantle
#

yknow how many times ive heard ppl say that

quaint mantle
#

i got bamboozeled

young knoll
#

I mean they are quite powerful these days

#

But they fall behind plugins in performance

visual tide
#

yes but you're probably not gonna use them on a proper public server

quaint mantle
#

the order in my opinion:

Mods > Plugins > Datapacks > Addons (bedrock)

#

ive made addons before

#

so many limitations

#

its not even funny

fickle frost
#

Mods should not be #1

young knoll
#

Small ones that just mess with loot tables are great

quaint mantle
young knoll
#

Or recipes or whatnot

quaint mantle
#

Im just basing it off those 2 lol

young knoll
#

Mods are the most powerful

quaint mantle
#

If we are talking like, favorites here

#

Plugins < Mods < I hate datapacks and addons

young knoll
#

Data packs are fine

quaint mantle
#

i just dislike the concept thats all

young knoll
#

Don’t know why you would hate them

quaint mantle
#

they are cool n all

#

but the whole thing around them is kinda bad

#

like i said: its just a singleplayer world plugin

young knoll
#

Meh

fickle frost
#

Plugins are far more performant, and the main reason mods more powerful is because you can modify the client, but in doing so, you prevent your server from being connected to by anyone with a vanilla client, so it is as much a limitation as it is a freedom.

visual tide
#

patching nms > plugins 😄

#

performance-wise

young knoll
#

A datapack to change recipes or loot tables is exactly as performant as a plugin

quaint mantle
#

well if we are going to test preformace

#

why not do a lag test?

#

see which one crashes/gets too laggy first or whatever

#

and last

#

to see which is more powerful and preformant

young knoll
#

In my scenario, neither

fickle frost
#

Compare a forge server with no mods to a paper server with no plugins. The difference is observable even without any players on.

quaint mantle
#

Cause ive done both before

#

i used to use aternos ok

#

dont judge

young knoll
#

Mods and plugins are equally performant

quaint mantle
#

and come back

#

:troll:

young knoll
#

Try using an equal plugin

#

Oh wait you can’t

quaint mantle
#

oof

young knoll
#

Both mods and plugins are interfacing directly with java, there is nothing to make one run better than the other

#

Except yknow, code quality

fickle frost
#

If I were to try and join an IRLCraft modded server, I'd have to launch a modded client first, which, on my computer, takes maybe 10 minutes, no joke. That's on top of the time it takes for the server to start up.
With plugins, the client can connect to the server immediately.

#

I'm taking this into consideration.

quaint mantle
#

But justin, this is assuming the client is being edited by the mod.

#

IF the mod does NOT use any client editing whatsoever

#

it will connect to the server nearly instantly

fickle frost
#

Moreover, there is a significant difference in the servers themselves.
Hosting a server with 100+ players on paper is easily achievable, even with tons of plugins.
Not so for a forge server, even without any mods.

#

Plugins/mods are limited by the server they're interfacing with, so even if the plugins/mods themselves are very similar in performance, if the API they're interfacing with isn't, then they can't be either.

young knoll
#

Yes but that isn’t to do with a different in performance between mods and plugins

fickle frost
#

Unless you're talking about modding by directly patching NMS, rather than using something like forge.

young knoll
#

It’s to do with a difference between paper and forge

quaint mantle
#

Its 2am where I am, I think ive coded enough today.

#

Im tired, gn everyone.

#

Have fun with your convo lol

young knoll
#

Technically mods should perform slightly faster in some cases, as they don’t have the overhead of the Bukkit API

fickle frost
#

The reality is that 99%+ of people making a plugin will be interfacing with bukkit/spigpt/paper, and if they're making a mod, they'll be interfacing with forge.

young knoll
#

But it’s a very small overhead

fickle frost
#

Then again, I've never actually made a mod before. So what do I know.

#

Just what I've heard second hand.

rough drift
#

and fabric is even faster

#

since it just goes

#

take code from method
put it in method you are injecting into

#

there's also the FAPI but thats that

vale ember
#

why is saving world in 1.18.1 server takes so long?

#

(after /stop)

drowsy helm
#

way more data to save now

quiet ice
#

It's just spigot being spigot

#

I had similar issues back in early 1.17 when it took 5 minutes or so to save

fickle frost
#

Anyone know why Spigot stopped loading/unloading chunks async?

young knoll
#

Spigot never did that

last ledge
#

?paste

undone axleBOT
last ledge
#

someone help

drowsy helm
#

you are casting an event to player

#

event.getPlayer()

last ledge
#

ah thanks

#

also how do I clear player's data from server

fickle frost
#

@young knoll Chunks generate on the main thread since 1.13 iirc.

young knoll
#

Chunk generation is multithreaded in modern minecraft

fickle frost
#

Ah, apparently that was added in 1.15

young knoll
#

Mhm

fickle frost
#

I can never keep up with these things.

last ledge
young knoll
#

Delete your player.dat file in world/playerdata

last ledge
#

didnt work, thats why

young knoll
#

It does work

#

That’s where your player data is

#

Don’t do it while the server is running

last ledge
#

nah I restarted it

#

if it was working then, my code would work

#

to autoperform command when player joins for the first time

young knoll
#

Then just remove the entire world

last ledge
#

tried

young knoll
#

Then your code is faulty

last ledge
#
    public void playerJoin(PlayerJoinEvent event){
        Player player = (Player) event.getPlayer();
        if(!(player.hasPlayedBefore())){
            player.sendMessage("working");
            player.performCommand("st play firstjoin");
        }
    }```
#

I added message

#

lets see if it sends it

#

oh wait it worked now nvm

rough drift
#

to a player

#

you know event.getPlayer() returns a player right?

last ledge
rough drift
#

also you don't need to wrap player.hasPlayedBefore() in ()

#

you can just do

#

!player.hasPlayedBefore()

#

also to run the command i suggest doing Bukkit.dispatchCommand(player, command);

#

or it was Bukkit.getServer().dispatchCommand

young knoll
#

Shouldn’t really make a difference

rough drift
#

i mean they can try

silver shuttle
#

Does InventoryMoveItemEvent fire when shift clicking into an inventory?

rough drift
#

nope

silver shuttle
#

what then?

rough drift
#

that's only for hoppers

silver shuttle
#

it says for entities

rough drift
#

uh iirc its InventoryClickEvent

rough drift
#

and minecart chests

silver shuttle
#

ah

#

Well say I have an inventory opened for a player and want to prevent them from shift clicking an item into that inventory, but still be able to interact with their own items, do I check for the InventoryAction MOVE_TO_OTHER_INVENTORY and SWAP_ITEM_WITH_CURSOR?

kindred valley
#
    BukkitTask runnable = new BukkitRunnable() {
        @Override
        public void run() {
            for (Player v : Bukkit.getOnlinePlayers()) {
                Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "money give" + v.getName() + " 1500");
            }
        }
    }.runTaskTimer(Main.getInstance(), 20, 3600);
}``` how can i provide this to throw the command for per 1 second
kindred valley
silver shuttle
#

^^

tender shard
silver shuttle
#

executing it i reckon

kindred valley
tender shard
#

did you actually ever create any PayMoney instance?

silver shuttle
#

you put it into a class, not a method

#

put it in a method and run it

kindred valley
kindred valley
tender shard
#

anywhere

kindred valley
tender shard
#

show your full PayMoney class and the code where you are creating an instance

kindred valley
#
    public static Plugin plugin;
    @Override
    public void onEnable() {
        plugin = this;
        getServer().getPluginManager().registerEvents(new Die(), this);
        getCommand("healme").setExecutor(new HealMe());
        getCommand("doktorcagir").setExecutor(new DoktorCagir());
        PayMoney payMoney = new PayMoney();
    }
    public static Plugin getInstance() {
        return plugin;
    }
}``` main
tender shard
#

you never call your payTheMoney method

#

so obviously it never schedules the task

kindred valley
#

ah i just texted PayMoney instead of payTheMoney sorry

#

thank you 🙂

#

it worked

kindred valley
#

and call it by PayMoney.run()

tender shard
#

no

#

but you can of course make your payTheMoney() method static

silver shuttle
#

how to get the actual text component of the asyncchatevent?

young knoll
#

AsyncChatEvent is a paper event

tender shard
tender shard
silver shuttle
#

that is literally the .message() output form AsyncChatEvent ._.

young knoll
#

Talk to paper

silver shuttle
#

And I want that content="t" out of it

young knoll
silver shuttle
#

,...

young knoll
#

What

tender shard
#

?jd-bc

young knoll
#

It’s not a bungee component

#

It’s adventure

tender shard
#

?jd-bcchat

#

oh

#

yeah then ask paper

young knoll
#

AsyncPlayerChatEvent is the spigot event

#

And operates with just strings

silver shuttle
#

ty

kindred valley
#

how can i control if player quitted after doing an event

chrome beacon
#

?

kindred valley
# chrome beacon ?
    public void onDie(PlayerDeathEvent e) {
        p = e.getEntity();
        if(p.isDead()) {
            p.setWalkSpeed(0);
            p.setHealth(0.5F);
            p.sendTitle("Oldun", "/healme komudunu kullan veya doktor bekle");
        }
    }``` i have this
tender shard
young knoll
#

I like that isDead check

#

In the death event

kindred valley
tender shard
#

you cannot control whether a player quit

kindred valley
tender shard
#

it's not like you can prevent them from quitting or sth lol

hybrid spoke
young knoll
#

Use the quit event to detect them leaving

sonic phoenix
#

Hello there, i'm making a plugin with a lot of functionality but one of them made me doubting about one things : I want to make a npc who can upgrade items by trading money, what plugin can i use for manage the money ?

young knoll
#

Vault

#

It’ll interface with pretty much any economy plugin

sonic phoenix
#

'kay thanks !

kindred valley
# hybrid spoke PlayerQuitEvent

hmm @EventHandler public void onQuit(PlayerQuitEvent e) { p = e.getPlayer(); if(p instanceof Player) { p.setHealth(0.5F); p.sendTitle("Oldun", "/healme komudunu kullan veya doktor bekle"); p.setWalkSpeed(0); } } made it like this

#

p is a Player class i made, im using that p in 3 event(PlayerMoveEvent, PlayerDeathEvent, and noew PlayerQuitEvent)

#

before i added quitevent when player quits and rejoins he can be able to jump and run

#

after adding this it blocked running but not jumping

young knoll
#

Yeah that’s

#

Not how java works

hybrid spoke
#

everything about that doesnt make sense

kindred valley
hybrid spoke
#

first of all, why are you checking if the player is a Player? second, what even is your goal? why are you setting the health, walkspeed and sending a title on quit? the player won't even notice the changes

#

and if i understood that right, you wanna set those values to factory once the player rejoined?

hybrid spoke
#

so just dont fuck with the values and they will stay the same 🤔

kindred valley
hybrid spoke
kindred valley
#

they are not

hybrid spoke
#

does the player take damage while being offline?

dapper ether
#
    public static void sendPartlyClickableCmd(Player player, String message, String clickableMessage, String command, String hoverText) {
        TextComponent component = new TextComponent(TextComponent.fromLegacyText(clickableMessage));

        component.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/" + command));
        component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(hoverText).create()));

        player.spigot().sendMessage(ChatMessageType.valueOf(message + component));
    }

Bug is in line 7 but no idea how to fix it

earnest forum
#

which line is line 7

dapper ether
tender shard
#

probably the 7th one lol. player.spigot()

dapper ether
#

evidently

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.

earnest forum
#

cbf counting the lines

dapper ether
#

cant paste it

tender shard
#

?paste

undone axleBOT
earnest forum
#

might as well just send which line is 7 lmao

grim ice
#

this wont work

#

setHealth

dapper ether
grim ice
#

ur setting a 0 hp player to 0.5?

#

that wont revive them

#

as they alr died

#

theyre on the death screen atm

kindred valley
young knoll
#

Use the damage event to stop death

earnest forum
#

is your class balancecommand?

kindred valley
tender shard
#

you basically do ChatMessageType.valueOf(SomeTextComponent)

#

that makes no sense at all

young knoll
dapper ether
#

so?

tender shard
#

so you get an error

young knoll
#

Yeah valueOf needs an exact match

dapper ether
#

thats the reason why im here right?

kindred valley
grim ice
#

yeah

earnest forum
#

just do spigot().sendMessage(message + component)

grim ice
#

heres the solution:

young knoll
#

So material.valueOf(“DIAMOND”) is valid

grim ice
#

?learnjava

undone axleBOT
dapper ether
#

doesnt work

earnest forum
#

error?

dapper ether
#

you cant Stringadd and String with an component

young knoll
#

You can’t combine components with +

grim ice
#

^

dapper ether
#

yes

young shell
#

What event gets called when you use a shield

young knoll
#

ComponentBuilder allows you to append them

young knoll
dapper ether
#

enums are constantss

tender shard
#

then why are you using Enum#valueOf(TextComponent.toString)

earnest forum
#

so when you create the component, add the message there?

young shell
dapper ether
#

because it was the quick fix and i have no idea how to fix it in fact there is not solution in the web

tender shard
#

there is no ChatMessageType with the name "Das ist nicht clickablleTextComponent{text=, BaseComponent(color=ºf, font=null, bold=null, italic=null, underlined=null, strikethrough=null, obfuscated=null, insertion=null, extra=[TextComponent{text=ABER DAS, BaseComponent(color=º6, font=null, bold=true, italic=null, underlined=null, strikethrough=null, obfuscated=null, insertion=null, extra=null, clickEvent=null, hoverEvent=null)}], clickEvent=ClickEvent(action=RUN_COMMAND, value=/jesus), hoverEvent=HoverEvent(action=SHOW_TEXT, contents=[Text(value=[Lnet.md_5.bungee.api.chat.BaseComponent;@5e223e19)], legacy=true))"

grim ice
#

what do u wanna do @dapper ether

dapper ether
#

partly clickable text message

earnest forum
#

ah

tender shard
#

player.spigot().sendMessage(TextComponent) ?

young knoll
#

Make 2 components

#

One with a click action, one without

dapper ether
young knoll
#

And append them

dapper ether
#

i want a part cliackable

#

clickable*

tender shard
#

use the ComponentBuilder

grim ice
#

ye

dapper ether
#

didnt find any example for it

grim ice
#

2 components, one clickable one not, then use component builder to append

tender shard
sonic phoenix
tender shard
# dapper ether didnt find any example for it
GitHub

UpdateChecker for your Spigot plugins with only one line of code needed in your plugin! - Spigot-UpdateChecker/UpdateCheckerMessages.java at 54d42485e12d9491c0b640010cd671a6b6a9fa77 · JEFF-Media-Gb...

dapper ether
#

thanks

#

already got it

young knoll
#

Did you move your update checker away from legacy yet :p

tender shard
#

so no but it supports spiget and other API sources too

young knoll
#

I sent you the GitHub link for it

tender shard
#

where?

young knoll
tender shard
#

ah thx, I'll add it sometime

young knoll
#

Readme looks pretty helpful

#

I need to update mine too

tender shard
#

I wonder how did you find that lol

young knoll
#

I don’t remember

#

I remember trying very hard to google “spigot new update API” and stuff

#

But your update checker just kept popping up

young shell
#

Do Shields also have a persistent data container? I have an Issue where it just doesn't get carried over? Just making sure I'm not overlooking something

young knoll
#

Yep

#

They’re an item

young shell
#

Okay just making sure I'm sane

next stratus
#

How do i close my ticket?

silver shuttle
#

ok this is some serious bullshit right here
I am listening for InventoryClickEvent
If the inventory is in a specific list and the action performed is MOVE_TO_OTHER_INVENTORY then it prints 3 in chat and cancels the event
Some other code much further down the line closes the inventory

If it now prints 3 in chat, why the hell does it not cancel the event and the item i shift clicked lands in my inventory?!?

earnest forum
#

send code?

silver shuttle
#
    public static void inventoryClick(InventoryClickEvent e) {
        Inventory inv = e.getClickedInventory();
        Inventory top = e.getWhoClicked().getOpenInventory().getTopInventory();
        Bukkit.getServer().broadcastMessage("1");
        if (e.getAction().equals(InventoryAction.MOVE_TO_OTHER_INVENTORY) || e.getAction().equals(InventoryAction.SWAP_WITH_CURSOR)) {
            Bukkit.getServer().broadcastMessage("2");
            if (shops.containsKey(top) || owners.containsKey(top) || admins.containsKey(top) || ownersItems.containsKey(top)) {
                Bukkit.getServer().broadcastMessage("3");
                e.setCancelled(true);
            }
        }

Further down:

e.setCancelled(true);
owners.remove(inv);
e.getWhoClicked().closeInventory();
earnest forum
#

its printing 3?

lilac dagger
#

why is this happening?

silver shuttle
lilac dagger
#

i hate dependencies

silver shuttle
earnest forum
#

add another broadcast after the cancel

#

see if its actually running

silver shuttle
#

sec

#

yup

#

printed 4

#

also it is not a ghost item, I reconnected and it persisted

earnest forum
#

im not too sure why thats happening

#

also why is the event static? lol

silver shuttle
#

does it make a difference?

earnest forum
#

it should

#

dunno

#

anyways

#

ask somebody else for help

silver shuttle
#

alright, thanks anyways

earnest forum
#

cant help u sorry mate

young knoll
#

Don't make your events static

earnest forum
#

u got any idea why thats happening?

silver shuttle
#

yeah changed that

#

mightve misremembered

#

but i dont get why it doesnt cancel properly

earnest forum
#

have u got @eventhandler

#

before the event?

silver shuttle
#

yes, everything works fine except that specific cancelling

#

the gui is perfectly interactable and it cancels when I normally click or shift click, but not if it also closes the GUI in the same code execution

#

and yes, it does cancel before it closes the gui

earnest forum
#

are you in creative

#

?

#

@silver shuttle

silver shuttle
#

y

#

let me test in survival

earnest forum
#

some forum post says creative mode has a bug with the event'

silver shuttle
#

well in survival it only produces ghost items now

#

but works

#

wtffff

#

thats so stupid

earnest forum
#

yeah

silver shuttle
#

but thank you

#

cost me 2h

earnest forum
#

i just googled "spigot inventory click event not cancelling" ahaha

silver shuttle
#

;-;

#

why you do me like that

#

i thought there would be common sense in spigot ;-;

#

xD

earnest forum
#

that has to just be a bug

#

i dont see any reason why it shouldnt do what u want

grim ice
#

lib ideas

molten hearth
#

right so I'm having this issue with placeholderapi where after /papi reload is ran my placeholders dont work but stay registered and im not sure how to fix that

rough drift
#

quick thing, what's minecraft specific world generation algorithm

fickle frost
#

That's not really a quick thing.

rough drift
#

i hoped it was xD

silver shuttle
#

is this the proper way of reloading a config?

rough drift
#

otherwise yes

silver shuttle
#

well it dont work

#

the value is not updating if i read it from the config after editing and saving it externally and executing that code then reading

fickle frost
#

Minecraft uses various seeds and algorithms for generating various layers of their world generation, such as the world height, caves, resources, topography, structures, etc.

silver shuttle
rough drift
#

oh yeah

silver shuttle
#

but doesnt that make sense too?

rough drift
#

you're storing it...

silver shuttle
#

yea

rough drift
#

why exactly?

silver shuttle
#

because i dont want to constantly read it?

rough drift
#

it reads it on reloadConfig

#

otherwise its just an instance

silver shuttle
#

should still have a mild performance difference shouldnt it?

rough drift
#

no

fickle frost
#

Definitely not

silver shuttle
#

alr but i am too lazy now soooo

rough drift
#

you might loose 1ns of speed

fickle frost
#

I doubt even that much

#

There's nothing wrong with using a getter.
You don't have to create an additional field for storing every object you use.

#

You'll just create unnecessary clutter.

granite owl
#

dumb basic java question incoming: if i pass a class as function parameter, do i pass an object or a reference pointer?

ivory sleet
#

given the abstraction a getter provides over a mere field, the negligible difference is even more negligible if anything

granite owl
#

like on the technical level

ivory sleet
#

well in Java objects are considered values, and variables are references, Java doesn't have much about pointers in and out, you will always be passing values to function paarameters

granite owl
#

so the whole class

#

with all its content is copied

#

?

ivory sleet
#

no

#

a class is not an object

#

but for instance

#
Object o = new Object();

void a(Object a) {

}

a(o)
#

here you pass the variable as an actual parameter to the function

grim ice
#

Player p = ...;
p.setHealth(0.00);
// now can i use p? or do i have to update the variable, or is it automatically update?

ivory sleet
#

but only the object from o will get passed down

ivory sleet
#

as opposed to some languages which allows you to pass a reference as a whole, java does not have that

granite owl
#

hm+

rough drift
#

so whilst a player is online, you can use p

granite owl
ivory sleet
#

but sure, objects in a deeper context are just references, but in Java we rarely treat objects as references, instead just values

#

local instance?

#

yes

kindred valley
#

?paste

undone axleBOT
granite owl
#
void foo(Object obj)
{
  obj.doSomething();
}

int main()
{
  Object o = new Object();
  foo(o);
}
#

then the function foo works with the same instance as in the main scope?

ivory sleet
#

yep

granite owl
#

kk

past vapor
#

When is BlockExplodeEvent fired

#

Because it's not returning the actual list of blocks that were broken

#

Is it possible that (in paper.yml), optimize-explosions effects the block list

next stratus
#

Hey, how can I get the name in a way like minecraft:sponge from a bukkit Material?

ivory sleet
next stratus
#

ty ;p

#

worldedit was only accepting those

ivory sleet
next stratus
#

i love the new key system though

#

no more remembering magic numbers or whatever it's called

ivory sleet
#

mye

#

magic numbers are terrible

past vapor
#

Ok It does not effect it

next stratus
# ivory sleet Material::getKey

in the end

BlockType cornerType = BlockType.REGISTRY.get(cornerMaterial.getKey().getKey());

did it but you saying about the key did help

molten hearth
# molten hearth right so I'm having this issue with placeholderapi where after `/papi reload` is...

hit em with da java getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() { public void run() { String tmpText = "%marriage_isRegistered%"; tmpText = PlaceholderAPI.setPlaceholders(null, tmpText); if(!tmpText.equals("true")) { // random placeholder that always returns "true" getLogger().info("Re-registering..."); new myExpansion(plugin, core).register(); } } }, 0L, 20L); as a fix

ivory sleet
#

oof lol

kindred valley
#

hey i made a thing like if a player dies, he cant run or jump. But when player quits and rejoins he can jump and run again how can i prevent this.

earnest forum
#

send code

silver shuttle
#

store their uuid in a list and check it?

quaint mantle
#

They are an entirely new player object so you must use ur uuid

kindred valley
#

?paste

undone axleBOT
quaint mantle
#

Then check on join if they are that player using the uuid

quaint mantle
#

And do whatever you want to stop them

earnest forum
#

because when a player leaves and rejoins the Player object is changed

kindred valley
hybrid spoke
#
    PlayerList plist = new PlayerList();
    Player p = plist.p;
```?
kindred valley
#

specified player

kindred valley
hybrid spoke
#

but you do know that all your code is executed for every player?

earnest forum
#

but when they leave

#

the player object is null

#

And when they join back

#

it's an entirely new object

#

so what you could do is store a hashmap of <UUID, boolean>

#

And when they die, set the player's UUID to true

#

so when the player joins back

#

check if they are in the hashmap and if it is true set their walk speed and jump power

kindred valley
#

ah

#

accidentally

kindred valley
earnest forum
#

player#getUniqueId

kindred valley
# earnest forum player#getUniqueId
public class PlayerList {
    HashMap<UUID, Boolean> diedPlayers = new HashMap<>();
    Player p;
    public void playerDie() {
        diedPlayers.put(p.getUniqueId(), true);
    }
    public HashMap<UUID, Boolean> getDiedPlayer() {
        return diedPlayers;
    }
    public void setDiedPlayers(HashMap<UUID, Boolean> diedPlayer) {
        this.diedPlayers = diedPlayer;
    }
}```
kindred valley
tall dragon
#

why do you have a player object

#

the way this currently looks, it only works for a single player per PlayerList instance?

earnest forum
#

On player join event, check if the hashmap contains a key that is player uuid

#

If yes, check if that is true

#

And if it is set the player walk speed

kindred valley
#

hmm

#

how can i set jump

#

i made it on PlayerMoveEvent

earnest forum
#

instead of setting p at start

#

set p in every event

#

And then when the player joins

void wraith
#

Hi! I make a BungeeCord plugin, and I get the version protocol number. Under 1.8, I got 738, but my version is 1.7.

earnest forum
#

set the p object in PlayerList to the new one

hasty tartan
#

do 1.18 plugins still require jdk 8, not 17?

ivory glacier
#

hey can someone help me fix this
WorldBorderCenterChangeEvent may only be triggered synchronously.

#

that is error from my plugin

#

Cannot pass event

grim ice
#

u can make a Set

ivory glacier
#

i fixed nvm I am just an idiot lol

kindred valley
grim ice
#

@earnest forum what u telling the guy bro

kindred valley
grim ice
#

Good

#

wait

#

show code

kindred valley
grim ice
#

u prob r using hashmap

quaint mantle
#

Is this how to use schedulers properly or i have to type that code inside scheduler class?


import me.karlo292.testplugin.TestPlugin;
import me.karlo292.testplugin.schedulers.PlayerMoveScheduler;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.scheduler.BukkitScheduler;


public class PlayerMoveListener implements Listener {

    PlayerMoveScheduler scheduler = new PlayerMoveScheduler();
    TestPlugin plugin;

    @EventHandler
    public void onMovement(PlayerMoveEvent e) {



        Player player = e.getPlayer();
        World world = player.getWorld();
        Block block = player.getLocation().subtract(0, 1, 0).getBlock();
        Material type = block.getType();
        if(type != Material.GLOWSTONE && type != Material.AIR) {
            block.setType(Material.GLOWSTONE);
            scheduler.runTaskTimerAsynchronously(plugin, 4, 0);
            block.setType(type);

            }

        }

}```
undone axleBOT
kindred valley
#

accidentally type set

grim ice
#

dont do that

kindred valley
#

wdym

#

set is better?

grim ice
#

for this usage, WAY better

#

no need for a hashmap just for a boolean value

#

Set<UUID> deadPlayers = new HashSet<>();

#

in your main class

#

making a class to store one variable is pointless

kindred valley
#
public class PlayerList {
    HashSet<UUID> diedPlayers = new HashSet<>();
    Player p;
    public void playerDie() {
        diedPlayers.add(p.getUniqueId());
    }
    public HashSet<UUID> getDiedPlayers() {
        return diedPlayers;
    }

    public void setDiedPlayers(HashSet<UUID> diedPlayers) {
        this.diedPlayers = diedPlayers;
    }

    public Player getP() {
        return p;
    }

    public void setP(Player p) {
        this.p = p;
    }
}```
grim ice
#

No

#

whats the point of p

earnest forum
#

I'm actually dumb

#

why use hashmap

#

I guess I'm tired

grim ice
#

tbf yeah u r

earnest forum
#

Yes use hashset

grim ice
#

xD

#

jk everyone makes mistakes

earnest forum
#

it's 2am brudda

#

I'm on my phone

grim ice
#

ic

kindred valley
grim ice
#

also do not obfuscate your code, each variable should describe what it does

#

PlayerList doesnt give any meaning to what that is

#

and p doesnt either

#

diedPlayers do though

#

however its deadPlayers not died lol

earnest forum
#

not a native speaker I'm pretty sure

grim ice
#

if ur not comfortable with english then use google translator, or dont use english

#

although you will 100% need english for coding

earnest forum
#

especially spigot

grim ice
#

everything

kindred valley
#
    HashSet<UUID> deadPlayers = new HashSet<>();
    public HashSet<UUID> getDiedPlayers() {
        return deadPlayers;
    }
    public void setDeadPlayers(HashSet<UUID> diedPlayers) {
        this.deadPlayers = diedPlayers;
    }
}```
grim ice
#

delete that class

#

have
HashSet<UUID> deadPlayers = new HashSet<>();
in your main class

#

a class for one variable is nonsense imo

arctic moth
#

ik this is probably rlly simple and im just dumb, but what do all these colors mean

#

they just suddenly appeared ¯_(ツ)_/¯

kindred valley
earnest forum
#

yea

grim ice
#

yes

#

but dont

kindred valley
#

i cant

arctic moth
grim ice
#

why cant u

kindred valley
#

i dont know

#

nvm i did getDeadPlayers

arctic moth
eternal oxide
#

no, never new Main()

kindred valley
# grim ice why cant u
public class Die implements Listener {
    Main main = new Main();
    @EventHandler
    public void onJoin(PlayerJoinEvent e) {
        Player p = e.getPlayer();
        if(main.getDeadPlayers().contains(p)) {
                p.setHealth(0.5F);
                p.setWalkSpeed(0);
            }
    }``` is this right
eternal oxide
#

no

kindred valley
eternal oxide
#

never try to create a new instance of Main

silver shuttle
#

Does spigot have a separate scheduler method for scheduling for a specific date and time or do I use ScheduledExecutorService ?

eternal oxide
#

there is one instance and thats created by spigot

arctic moth
#

also slime blocks make invisible falling blocks of the blocks connected

kindred valley
#

i tried Main.deadPlayers

eternal oxide
#

when you call new Die() you add a constructor so you can do new Die(plugin)

ivory sleet
#

but I mean

silver shuttle
#

a restart kills it, i know

ivory sleet
#

its possible with BukkitScheduler

#

just gonna be, not great at all

silver shuttle
#

any better ways?

ivory sleet
#

yes

#

SES

silver shuttle
#

isnt that ScheduledExecutorService ?

ivory sleet
#

yep

silver shuttle
#

ok ty

ivory sleet
#

and if you wanna run on server thread, just callback it using BukkitScheduler

kindred valley
#
public class Die implements Listener {
    HashSet<UUID> deadPlayers = new HashSet<>();
    public HashSet<UUID> getDeadPlayers() {
        return deadPlayers;
    }
    public void setDeadPlayers(HashSet<UUID> deadPlayers) {
        this.deadPlayers = deadPlayers;
    }
    @EventHandler
    public void onJoin(PlayerJoinEvent e) {
        Player p = e.getPlayer();
        if(deadPlayers.contains(p)) {
                p.setHealth(0.5F);
                p.setWalkSpeed(0);
            }
    }```
lean gull
#

how do i check which part of an inventory is clicked in a InventoryClickEvent in a gui?

silver shuttle
# ivory sleet SES

Or perhaps if it needs to run every day at midnight, whats the best thing there?

lean gull
#

as in the opened gui and the player's inventory

silver shuttle
#

real life days, of course

ivory sleet
#

Challenger pretty much ScheduledExecutorService still

#

tho ofc you have to calculate the delay and stuff

silver shuttle
#

hmmm ok

ivory sleet
#

since it has a really sophisticated low level implementation for how it deals with tasks that are gonna run in the future as opposed to BukkitScheduler which just ticks in principle

#

and is not comparable to SES whatsoever regarding this implementation

#

ofc SES is an abstraction, but I assume you use the implementations Executors.java provides

arctic moth
#

not cursed at all

lapis lark
#

ProtocolLib, 1.18.x So i have destroyed player with

PacketContainer container = new PacketContainer(PacketType.Play.Server.ENTITY_DESTROY);
container.getIntLists().write(0, Collections.singletonList(target.getEntityId()));
ProtocolLibrary.getProtocolManager().sendServerPacket(observer, container);

How I can show it back?

ProtocolLibrary.getProtocolManager().updateEntity(target, Collections.singletonList(observer));
``` This code is not working
sacred basin
#

Hello everyone

I have a question

How to make plugin create a config file I made in my project in advanced?

Example

  • A project has a.yml with content
  • If plugin loaded, there will be a.yml file in plugins/A with content
eternal oxide
lean gull
#

why is this always false? (InventoryClickEvent)

        if (event.getClickedInventory().equals(null)) {
            return;
        }```
eternal oxide
#

It will be null if you click outside the inventory window

hybrid spoke
#

but will throw a NPE

lean gull
#

that's why i did it, but intelllij is saying that it will always be false* and when i click outside the gui, it sends an error

eternal oxide
#

you shoudl also compare null with ==

hybrid spoke
#

therefor we use == to compare null

lean gull
#

thanks, it works now

lapis lark
#

You can check for slot, if you clicks outside of inventory it would be -999

lean gull
eternal oxide
#

read further down

#

It covers both

lean gull
#

ah ok, thanks

quiet ice
#

Java spec demands that object.equals(null) always returns null iirc. Of course some implementations will throw an NPE instead

#
     * <li>For any non-null reference value {@code x},
     *     {@code x.equals(null)} should return {@code false}.
arctic moth
#

whats the difference between material.snow and material.snow_block

lean gull
#

snow is snow layer