#help-development

1 messages · Page 951 of 1

hybrid turret
#

PaperEventManager, this is a paper plugin?

worthy star
#

no

#

thats not even in my code

hybrid turret
#

wait oh

#

nvm

worthy star
#

how do i make a dependency and the library

lilac dagger
#

Make sure you only call this funcrion from the main thread

worthy star
#

i do

#

its a custom event

#

and i call it using bukkit in the method

lilac dagger
#

Well, there's a toggle

#

boolean async in the constructor

#

Make sure your event matches wheter is main thread called or not

worthy star
#

i have 2 custom events, one that isn't called in discord listener adapter and doesn't work
another using bukkit listener and works

lilac dagger
#

As i said, it depends on how you call it

#

Do you use asyncplayerchatevent?

worthy star
#
    public void linkPlayer(Player player, User user) {
        LinkEvent event = new LinkEvent(player, user);

        Bukkit.getPluginManager().callEvent(event);

        if(!event.isCancelled()) {
            String path = "linking." + String.valueOf(player.getUniqueId());
            String dc = String.valueOf(user.getIdLong());
            String code = Common.getMapKey(linking, player).toString();

            linking.remove(code);

            config.set(path, dc);
            save();

            player.sendMessage(Common.colorize("&7Your &aMinecraft &7account has been linked to discord"));
            player.sendMessage(Common.colorize("&7Account: &3" + user.getEffectiveName()));
        }
    }```
lilac dagger
#

That's async

worthy star
#

i use message receive event with jda

lilac dagger
#

Open link event

#

See if it's async or not

worthy star
hybrid turret
#

light theme????

#

oh god

blazing ocean
#

is there any way to create a callback on an Interaction entity for when it gets clicked?

worthy star
blazing ocean
#

why

worthy star
#

anyway, i don't see its async

worthy star
blazing ocean
#

any idea why World#getEntities returns an empty list in my world? i can clearly see entities

lilac dagger
#

Uh, that event doesn't match callevent from bukkit

worthy star
#

how can i fix that

lilac dagger
#

Well, show LinkEvent instead

worthy star
lilac dagger
#

Put in constructor
super(true) ;

#

First line

worthy star
#

alright

#

just that, right?

lilac dagger
#

If it works come back

#

If it's really async then it's best to make your code handle it properly

upper hazel
#

Is it possible to get a recipe or a key to it during crafting if you create a Craftitem?

lilac dagger
#

Otherwise you'll get weird bugs

worthy star
worthy star
lilac dagger
#

Okay, see why your method is called async

#

See if you can transform it before it reaches this method

#

A good way to fix is to use bukkit get scheduler runtask plugin, () - > {your task here}

#

If you fix it this way remove super

worthy star
#

is the task the linkPlayer method calling or event using

lilac dagger
#

Whatever is calling linkPlayer

worthy star
#

ok

hybrid turret
#

wasn't there something that bukkit/spigot is not made for being extended?

#

i vividly remember something there

lilac dagger
#

The inventory holder?

#

I think people were abusing that by implementing it themselves

chrome beacon
#

in general don't extend anything unless it's explicitly stated that it's fine to do so

lilac dagger
#

There's not much you can extend anyway

#

The api is mostly made of interfaces

hybrid turret
#

ahhhh icic

chrome beacon
#

yeah don't go implementing the interfaces neither

hybrid turret
#

yeah i just mentioned that bc i saw Event being extended

hybrid turret
chrome beacon
#

(unless it's stated that it's fine)

hybrid turret
#

alright

worthy star
blazing ocean
#

how can I remove a vanilla NBT data tag from an entity? (/data remove entity .... foo)

smoky anchor
worthy star
blazing ocean
#

xy here is I'm using interaction entities and checkcing in a loop (💀) and trying to remove the old interaction player, which is how i did it with command blocks

chrome beacon
#

uh why exactly do you need to do that

blazing ocean
#

because otherwise the interaction will stay the same

#

i only want my code to trigger on click

unborn breach
#

Question, why is my grave command not working? I mean i see i have the grave command in stalled and i have the items in game, just the graves arent coming up when players die

blazing ocean
#

and not every tick after a player clicked

smoky anchor
blazing ocean
#

i forgor entityinteractionevent is a thing

#

why is there no entity field 💀

chrome beacon
#

xy'd the xy

#

anyways if you want player click use the PlayerInteractAtEntityEvent

blazing ocean
#

ah ty

lilac dagger
lilac dagger
lilac dagger
#

if you make your own this won't disrupt any other events so you're free to do so

worthy star
#

and idk whats the difference in what you said

lilac dagger
#

protocollib is a library

#

you use it's api but you need to add it with the plugins

worthy star
#

i mean like that

lilac dagger
#

something you shade will end up being in the jar itself

worthy star
#

add the plugin, and use its classes

lilac dagger
#

your jar

#

okay, click install in maven on the library

#

then look at the description you gave to that plugin

#

and then use those in a <dependency> tag

hybrid turret
lilac dagger
#

there's bukkit get server call event

#

if this wasn't intentional it wouldn't had been exposed

worthy star
lilac dagger
#

yes

#

along with version

worthy star
#

so like this without the packaging

lilac dagger
#

youp

#

use scope provided

#

just in case

#

and there's no packaging

#

that's specific for this pom

worthy star
#

so now i can use that depenedency in other plugins codes?

lilac dagger
#

awesome, now you can use this in your plugin

lilac dagger
worthy star
#

yea

lilac dagger
#

alright

worthy star
#

and in the one ihave :)

#

the one for it

worthy yarrow
#

When trying to consistently track an itemstack in a player's inventory, would inventoryClickEvent be the correct event to use?

lilac dagger
#

yes

#

as well as dragevent

worthy yarrow
#

Sounds good

worthy star
#

not instance and stuff

lilac dagger
#

you can use YourPlugin plugin = getserver getpluginmanager get plugin (YourPlugin.class)

#

but it's not the best way to access an api

worthy star
lilac dagger
#

the later

#

not your library

worthy star
#

ok

worthy yarrow
#
private static final Map<UUID, Integer> petExperience = new HashMap<>();
    private static final int BASE_XP = 100;
    private static final int XP_INCREMENT = 50;

    public static void addExperience(UUID petId, int experience) {
        int currentXP = petExperience.getOrDefault(petId, 0);
        currentXP += experience;
        petExperience.put(petId, currentXP);
    }

    public static int getLevel(UUID petId) {
        int xp = petExperience.getOrDefault(petId, 0);
        int level = 0;
        int xpForNextLevel = BASE_XP;

        while (xp >= xpForNextLevel) {
            xp -= xpForNextLevel;
            level++;
            xpForNextLevel += XP_INCREMENT;
        }

        return level;
    }

    public static int getXPForNextLevel(int currentLevel) {
        return BASE_XP + XP_INCREMENT * currentLevel;
    }```

Could I get your opinion on this leveling system fr33?
worthy star
#

is YourPlugin the later or the library

lilac dagger
#

the library

worthy star
#

ight

#

it requires to cast it as RelaxDc tho

lilac dagger
#

or petExperience.put(petId, currentXP + experience);

worthy yarrow
#

oh yeah lol

lilac dagger
#

the get level looks alrightish

worthy yarrow
#

idk illusion mentioned it, I love to hardcode everything

lilac dagger
#

maybe you want to move it somewhere else

#

because it does more than get level

#

usually you want to keep it as simple as you can

#

so you have control over it

worthy yarrow
#

You think I should implement getlevel through every pet class?

lilac dagger
#

no

#

you can have an int for level

#

and calculate this at add

#

so your get is just that

worthy yarrow
#

Ok so perhaps implement a setter method for level in the interface, I could just write addExperience out to make the checks for level ups as it were and I think that'll make it simpler

lilac dagger
#

you will also need an object that stores both level and experience in your hashmap instead

worthy yarrow
#

right

worthy yarrow
#

er

#

wait

#

I'm cooked

tender shard
#

wait until conclube is online, he'd probably suggest an ImmutableConcurrentReverseSquaredTreeSet or sth

worthy yarrow
#

well

#

tbf would a concurrent map be good here

tender shard
#

does it have to be thread safe?

lilac dagger
#

and you def don't wanna end up using something conclube suggested

worthy yarrow
#

I mean

worthy yarrow
#

It's just gonna be tracking xp increments as it's in the players inventory

#

so I could do that off main thread right?

lilac dagger
#

i used to have an array where i stored game data, but after a year i forgot which id was which, basically magic ^

#

so be careful when you want to cut corners

worthy yarrow
#

I'd rather do it the correct way (rather the not dumb way)

#

God damn

#

English is not englishing tonight

tender shard
worthy yarrow
#

Alright so then no haha

lilac dagger
#

does 2 work?

#

i haven't tested it

worthy yarrow
#

Not for a list

lilac dagger
#

no i mean for those from .concurrent

tender shard
#

whut

lilac dagger
#

i think they're only for handling multi threads

tender shard
#

oh you mean whether you can do sth like this?

for(Something sth : myConcurrentThing.entrySet()) {
  if(/* ... */) {
    myCOncurrentThing.remove(sth);
  }
}
#

yes, that works

lilac dagger
#

i didn't know this

#

that's interesting

sullen marlin
#

pretty sure it's undefined behaviour

tender shard
#

huh? it's definitely allowed for Concurrent collections, isnt it?

sullen marlin
#

maybe, I suppose it has to work for multithread support

tender shard
#

javadocs say this, but it doesnt mention that it's not allowed (or undefined behaviour) if the SAME thread is removing/inserting into a concurrent collection

lilac dagger
#

would be cool if java implemented the remove; keyword for loops

#

since for each loops are just fancy iterators under the hood

eternal oxide
#

there is removeIf, but I agree

hybrid turret
#

Another question to the modern inventory guis...
Let's say, I want to create an admin-tools gui so i create a button for let's say "ban".
I would need another inventory with a list of players (e.g. with player heads or sum).
How would I tell my plugin then to open another GUI and make it remember the action from before?

lilac dagger
#

it's out of the contract

eternal oxide
lilac dagger
#

but it's supposed to be a boolean condition

#

not a whole block of logic

eternal oxide
#

yes, return true;

hybrid turret
lilac dagger
#

you can return true, but the name sounds like it's designed for removing, not iterating

eternal oxide
#

removeIf iterates all entries

eternal oxide
#

any element you return true on will be removed

lilac dagger
hybrid turret
#

okay very cool. thanks. always nice to get confirmation on a thought process i have :DD

lilac dagger
#

what if a new update finds a way to process the collection without calling every entry?

eternal oxide
#

what?

lilac dagger
#

for each vs removeif contract

#

you don't know if removeif will get an optimization later on and not be called after each element

hazy parrot
#

How can we check if entry satisfy criteria if we dont iterate over it

tall dragon
#

crystal ball?

lilac dagger
#

it's a predicate

hazy parrot
lilac dagger
#

you can put your boolean logic

#

if we talking about removeif

hazy parrot
#

Docs say if element satisfy criteria. That means they assume our boolean logic is based on each element of collection

lilac dagger
#

well, you can do it if you want, i just don't feel it's a good idea

#

point 44 actually

hybrid turret
#

ngl love 7 for that guide

torn shuttle
#

oh my f-king god, I just realized there is actually a matrix operation dedicated to fix the problem I've been having for days

#

called change of basis

junior cradle
#

Why is the cooldown not installed and the standard one used? this works only with the chorus

  @EventHandler(priority = EventPriority.LOWEST)
    public void onPlayerItemConsume(@NotNull PlayerItemConsumeEvent event) {

        if (event.getItem().getType() == Material.CHORUS_FRUIT) {
            event.getPlayer().setCooldown(Material.CHORUS_FRUIT, 10000);
        }

}
torn shuttle
sullen marlin
#

The cause of and solution to all 3d problems

torn shuttle
#

I hate this, really

torn shuttle
#

pre-1.20 display entities face north by default

#

post-1.20 they face south

#

also armor stands face south

#

why is this a problem? Because it flips the coordinates from blockbench

#

the transforms are all correct, the rotations are all wrong

#

and I can't just flip it 180 because each individual display entity is wrong

native gale
#

How to run some code right after world is loaded?

#

load: POSTWORLD would not work, because I also need some code to run at startup

native gale
#

Is it guaranteed to run just once?

native gale
#

Or it will fire every time, let's say, multiworld loads a new world, for example

tall dragon
#

so yea also when another plugin loads a world

white thicket
#

Hey, I wanted to know how I can get the teams from the default Minecraft /team. I want to get all teams.

hybrid turret
#

When can an ItemMeta, aquired by using ItemStack#getItemMeta, be null? I've never had that happen.

shadow night
#

When the item stack is air afaik

tall dragon
#

^ yea

#

thats the only case iirc

warm pine
#

'org.bukkit.ChatColor' is deprecated

#

lol paper

lilac phoenix
#

Can anyone teach me how to configure simplevoicechat?

hybrid turret
hybrid turret
#

I want to get the first 54 online players to begin creating a paginated GUI. My current (beginning) approach is this:

@Override
  public void decorate(Player player) {
    Collection<? extends Player> onlinePlayers = Bukkit.getOnlinePlayers();

    int elementsPerPage = 9 * 6;

    for (int i = 0; i < onlinePlayers.size(); i++) {
      if (i >= elementsPerPage) break;
      createPlayerButton(player, ((Player[]) onlinePlayers.toArray())[i]);
    }

    super.decorate(player);
  }

The problem is: I can't just cast Object[] to Player[] apparently. because it will "produce 'ClassCastException' for any non-null value". How could I fix that?

#

(For now I basically just want to limit the players for the first page and then I'll continue by myself

orchid trout
#

probably

hybrid turret
orchid trout
#

why arent you using an enchanced loop

hybrid turret
#

because of the max amount

#

i want to limit it to the first 54

#

i usually didn't have that problem because i used an enhanced loop but now I do

#

lol

eternal oxide
#

just break from the loop when you have processed 54

hybrid turret
#

tha- uhm

eternal oxide
#

works in enhanced loops too

hybrid turret
#

that's a thing? ._.

#

how?

eternal oxide
#

break simply exits the current level of loop

hybrid turret
#

how do i check for the 54 tho?

eternal oxide
#

a counter

hybrid turret
#

oh-

#

omg

eternal oxide
#

it has to be final is all. you can still add

hybrid turret
eternal oxide
#

what? No you can still add to a final variable

hybrid turret
#
int counter = 0;

for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
  this.addButton(counter, createPlayerButton(player, onlinePlayer));
  counter++;
  if (counter >= elementsPerPage) break;
}
``` u mean like this?
#

nnnnno?

shadow night
#

final int
tries to modify the int

eternal oxide
#

not primitive

hybrid turret
#

._.

grave laurel
#

How could I set the texturepack of a player using spigot? If I use serResourcePack("url") the player can just reject the download and continue playing and nothing happens

hybrid turret
eternal oxide
#

however, in your case you don;t need it final

hybrid turret
#

you mean final Integer?

#

no

eternal oxide
#

I was assuming you would be using a lambda

hybrid turret
#

what-

eternal oxide
#

you are not so it doesn;t matter

hybrid turret
#

you mean Bukkit.getOnlinePlayers().forEach(...)?

eternal oxide
#

yes

red trout
#

?nms

hybrid turret
#

ahhhhhhhhh i think i know what you mean

tall dragon
#

in lambda's external variables need to be final

hybrid turret
#

yeahhhhh

#

i have this in several places in my code

#

IJ warns you if you don't so yeah anyway

tall dragon
#

what doesnt IJ warn you about these days

#

it even nags me to use a more robust logging framework instead of printing the exception like a chad

hybrid turret
hybrid turret
#

then i redid my logging

#

lol

#

Can I somehow get a playerhead with an arrow that points left and one that points right?

tall dragon
#

plenty of heads online to find

hybrid turret
#

lovely

#

thanks

#

If I open an inventory using Player#openInventory while having another open, does the first one close automatically (with the InventoryCloseEvent firing)?

drowsy helm
#

Yes

young knoll
#

yes

hybrid turret
#

that's perfect, thanks

stuck lake
#

Hello

#

How do I register my plugin here?

drowsy helm
#

Just make an account and upload it

chrome beacon
#

They've been answered in #general

pliant topaz
#

For InventoryClickEvent would getCursor() return the ItemStack the player is currently holding in their cursor or the item the players cursor hovers above?

chrome beacon
#

in their cursor

pliant topaz
#

k, ty

stuck lake
pliant topaz
hybrid turret
#

I am currently in the class PlayerListGUI.
Is there a difference between doing:

PlayerListGUI playerListGUI = new PlayerListGUI(this.action, this.guiManager, this.pagination++);
guiManager.openGUI(playerListGUI, player);
```and doing
```java
guiManager.openGUI(this(this.action, this.guiManager, this.pagination++), player);
```?
#

(I want to switch the pages of my PlayerListGUI, in case it wasn't obvious)

#

oh nvm the second thing doesnt even work lmao

#

oopsies

#

ignore that

vital ridge
#
System.out.println(supremeSpawnerBlock.getHologramLocation());

            CreatureSpawner creatureSpawner = (CreatureSpawner) e.getBlockPlaced().getState();
            creatureSpawner.setSpawnedType(supremeSpawnerBlock.getSpawnedEntity());
            creatureSpawner.getPersistentDataContainer().set(SupremeSpawnerBlock.SPAWNER_BLOCK_DATA, new SupremeSpawnerBlockDataType(), supremeSpawnerBlock);
            System.out.println(
                    creatureSpawner.getPersistentDataContainer().get(SupremeSpawnerBlock.SPAWNER_BLOCK_DATA, new SupremeSpawnerBlockDataType()).getHologramLocation()
            );
            creatureSpawner.update();

For some reason, even though supremeSpawnerBlock is clearly not null since printing out the hologram location returns a value, getting the spawner object from the persistent data container and then the hologramlocation again returns null. It tells me it fails to deserialize the SupremeSpawnerBlock class. Heres the full class of the BlockPlaceEvent: https://paste.md-5.net/yuxoruseso.java

red trout
#
@EventHandler
    fun onInteraction(event: PlayerInteractAtEntityEvent) {

        if (event.rightClicked.type == EntityType.INTERACTION) {
            val block = event.rightClicked
            val world = event.player.world as CraftWorld

            val nmsWorld = world.handle
            val nmsBlock = nmsWorld.getBlockEntity(BlockPos(block.location.blockX, block.location.blockY, block.location.blockZ))

            val nbtTagCompound = net.minecraft.nbt.CompoundTag()
            nmsBlock?.load(nbtTagCompound)

            event.player.sendMessage(nbtTagCompound.toString())
        }
        // ..
}
vital ridge
red trout
#

Hello Chat! I want to load the nbt tag of the right-clicked block. However, it keeps returning only empty objects. How should I solve this..?

hybrid turret
#

sorry but "Hello Chat!" lol, idk why but that made me laugh just now

hybrid turret
#

odo?

#

oh

#

lmao

red trout
#

lmao

outer tendon
#

XD

red trout
#

so.. how to fix that..

outer tendon
#

That was indeed funny

hybrid turret
#

oh

lost matrix
hybrid turret
#

wait is that kotlin?

red trout
#

but that return empty object

hybrid turret
#

other person

eternal oxide
lost matrix
outer tendon
#

Yo, @lost matrix, would you mind answering this message when you have time?

red trout
lost matrix
#

Ill take a look

outer tendon
#

Thank you

#

When you have time tho. I dont want to interrupt

eternal oxide
#

CraftWorld#getTileEntityAt(...

vital ridge
red trout
#

redline..

vital ridge
#

I've made some changes and debugging in the code, before all that the error told me that "hologramLoc" is null, but in fact when retrieving the object from PDC, the whole object was null

lost matrix
#

Wait there are more problems even

eternal oxide
vital ridge
#

it used to work before, but I made a brand new class for spawnerblocks since I wanted a specific class for Spawner Blocks and Spawner Items

eternal oxide
#

CraftWorld#getHandle().getTileEntity(new BlockPosition(..

red trout
#

yea i already use nms

#

minecraft version is 1.20.1

eternal oxide
#

Your world is not an nms world, its a CraftWorld

red trout
#

oh..?

eternal oxide
#

?stash for me

undone axleBOT
hybrid turret
#

Tutorial: https://www.spigotmc.org/threads/tutorial-skulls.135083/#post-1432132
Head: https://minecraft-heads.com/custom-heads/head/83899-plush-arrow-right-double-sided

I'm currently following a tutorial on how to get a custom head.
On the page where I got the head from (linked above), I found this "Minecraft URL" (21534c9bea4a10745128f0d7d5bd8fb1848ac82c793323be5c0612a91dd58bbd)

Is this what I have to encode and put into a game profile? Because the tutorial is talking about important stuff as in "not forgetting the http://" and so on, and this code does NOT look like a URL lol

#

oh

#

[HYPERLINK BLOCKED]

#

Lol

young knoll
#

Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. I’ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...

hybrid turret
#

That's better

#

ohhhh

#

thanks coll

#

oh shit with this tutorial i don't even need reflection anymore, that's sick

#

One question about it tho: why keep using the same UUID for all the profiles with the different textures?

lilac dagger
#

sounds like a caching issue too ^

tall dragon
young knoll
#

It does

lost matrix
#

By polling for displaying i mean, every time a user is shown the cooldown, you look at the timestamp and calculate the difference to the current time. Then format it and show it to the user. This also includes data being displayed in an interval to the player via a timer. The polling frequency needs to be twice as high as your target resolution frequency. So if you want to have a precision of 1s, then you need to poll every 0.5s. (Nyquist–Shannon sampling theorem)

young knoll
#

Differnt UUIDs won't stack

lilac dagger
#

i think the tutorial implies you to have a random uuid

hybrid turret
#

that makes sense

young knoll
#

I usually just use a uuid based on the texture

tall dragon
hybrid turret
#

even tho i don't need them to stack in this case, i'll still use the "random" uuid instead of an actual random uuid.

hybrid turret
lilac dagger
#

i really don't know what happens internally, it might not matter

#

for heads at least

clear elm
#

how can i fixx this;
chatgpt said i should open the inventory in an bukkitrunnable but dont works either

lilac dagger
eternal oxide
#

The reason to use teh same UUID (was) to prevent teh server cache exploding as creating a new Profile also added it to the UserCache. No idea if it still does

young knoll
#
        PlayerProfile profile = Bukkit.createPlayerProfile(UUID.nameUUIDFromBytes(url.getBytes()), "Custom");
        PlayerTextures textures = profile.getTextures();
        try {
            textures.setSkin(new URL(TEXTURE_URL + url));
        } catch (MalformedURLException e) {
            return null;
        }

        profile.setTextures(textures);
        return profile;
    }```
#

Tis what I use

hybrid turret
#

aaaaaaaaah

clear elm
# lilac dagger you can't run sync code in a async context

import com.tomlegendxd.zgiveaways.ZGiveaways;
import com.tomlegendxd.zgiveaways.commands.Gcreate;
import com.tomlegendxd.zgiveaways.util.PublicVariablen;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.scheduler.BukkitRunnable;

public class Messages implements Listener {
    public static String loretitle;

    public static String getLoretitle(){
        return loretitle;
    }

    @EventHandler
    public void onmessage(AsyncPlayerChatEvent e){
        if (PublicVariablen.getTitle() == true){
            e.getPlayer().sendMessage("test");
            loretitle = e.getMessage();
            PublicVariablen.title = false;
            e.getPlayer().openInventory(Gcreate.getInventory());
            new BukkitRunnable(){
                @Override
                public void run() {
                    e.getPlayer().openInventory(Gcreate.getInventory());
                }
            }.runTask(ZGiveaways.getPlugin());
            e.setCancelled(true);
        }
    }
}

this is the code in need to open the inventory

lilac dagger
#

delete this e.getPlayer().openInventory(Gcreate.getInventory());

#

above

outer tendon
# lost matrix By polling for displaying i mean, every time a user is shown the cooldown, you l...

Awesome. This is so helpful, so thank you very much. As for polling for displaying, I assume I should peek instead so I dont remove it from the priority queue, right? Or should the actions that require displaying be kept elsewhere? My initial thought is to peek at each action and determine if they should be displayed. Is that a good idea? It seems like that may be inefficient given how many actions there may be that don't require displaying.

lilac dagger
#

you can shorten your bukkit scheduler by

clear elm
lilac dagger
#

Bukkit.getScheduler().runTask(plugin, () -> //your code here);

#

yes

#

use this ^^

red trout
#

how to getTileEntity in 1.20.1..?

#

Holy Help memmm

remote swallow
#

World#getBlockState(Location) and cast to tile entity

red trout
#

tile entity?

remote swallow
#

might be tile state

red trout
lost matrix
red trout
#

I want to get the nbt tag attached to the interaction block and use it in a conditional statement.

eternal oxide
#

uh, why use nbt when TileStates have PDC?

red trout
#

PDC?

#

What is PDC?

eternal oxide
#

?pdc

red trout
#

Oh

lost matrix
#

Spigot has an API for nbt data

red trout
#

wt..

eternal oxide
#

just flag your blocks when you place them in their PDC

red trout
#

Will the nbt tag specified using summon be also loaded?

eternal oxide
#

not raw nbt

#

its a container

red trout
#

oh..

eternal oxide
#

although you shoudl be able to format it to add

#

with the summon command

#

Its stored as a BukkitValues tag

young knoll
#

yeah you can

#

although can tile entities even store arbitrary NBT?

stoic cosmos
#

?gui

hybrid turret
#

tf are tile entities?

tall dragon
#

Stuff like enderchest

#

a block with data essentially

#

a chest

hybrid turret
#

ah cool

#

good to know

tall dragon
#

brewstand e.t.c

young knoll
#

Technically called block entities

#

:p

tall dragon
#

thats why those dont work with pistons cuz mojang wasnt talented enough to make all that move

young knoll
#

I mean

#

It's quite easy to do these days, probably wasn't 10 years ago

tall dragon
#

i mean

#

why havent they updated it then

hybrid turret
#

i mine

#

diamonds

young knoll
#

Idk, maybe they just don't want to

#

ask Mojang

tall dragon
#

so many cool things would be possible if they could be moved 😦

red trout
#
Caused by: java.lang.ClassCastException: class net.minecraft.world.level.block.state.BlockState cannot be cast to class org.bukkit.block.TileState (net.minecraft.world.level.block.state.BlockState is in module minecraft@1.20.1 of loader 'TRANSFORMER' @4d09cade; org.bukkit.block.TileState is in module arclight@1.20.1-1.0.5-1a8925b of loader 'TRANSFORMER' @4d09cade)
        at org.server.sleepskinplugin.event.MainEvent.onInteraction(MainEvent.kt:114) ~[?:?]
        ... 24 more
hybrid turret
#

ahhh yes casting

#

casting and i have our differences since i tried working with doors (idk why it was so hard)

tall dragon
#

not sure whats hard about it as long as u cast safely

lost matrix
#

And vice versa

worldly ingot
#

and confusingly enough, an NMS BlockState is not the same as a Bukkit BlockState

#

NMS' BlockState is wrapped by Bukkit's BlockData

red trout
#
if (event.rightClicked.type == EntityType.INTERACTION) {
            val block = event.rightClicked
            val world = event.player.world as CraftWorld

            val nmsWorld = world.handle
            val nmsBlock = nmsWorld.getBlockState(BlockPos(block.location.blockX, block.location.blockY, block.location.blockZ)) as TileState

//            val nbtTagCompound = CompoundTag()
            event.player.sendMessage(nmsBlock.persistentDataContainer.toString())
        }
#

here is the code

remote swallow
#

use bukkit world

#

and bukkit location

worldly ingot
#

Yeah there's really no reason to be using NMS for that snippet

#

Or I suppose it's best to ask what your goal is to begin with

vital void
#

am i better off constantly pulling from sql ? or making constructor storing all the info i need for the player. and backing up every x to sql

young knoll
#

cache

red trout
#

I ultimately want to import the nbt tag attached to the interaction block.

young knoll
#

Always cache

worldly ingot
#

You can cache the pull, but always push changes asynchronously

red trout
#

I don't mind using NMS or anything else, so please tell me how.

young knoll
#

Wait wait

#

Are you working with a block or entity

hybrid turret
red trout
#

entity

young knoll
#

Because Interaction is an entity

red trout
#

Interaction

young knoll
#

Why are you trying to access block PDC then?

worldly ingot
#

Yeah you're checking for an EntityInteractEvent on an INTERACTION entity type

#

There are no blocks involved

#

Unless there's a block at the same position as your interaction entity I suppose

young knoll
#

You can just put the data on the entity tho

red trout
#

Things are starting to get more and more confusing...

hybrid turret
remote swallow
#

tile entitys do have pdc

hybrid turret
#

oh

#

right

remote swallow
#

normal blocks do not

hybrid turret
#

special blocks

red trout
#

interaction block is tile entity?

worldly ingot
#

Square one. Are you wanting to listen for when a player right clicks a block?

remote swallow
#

no

young knoll
#

Interaction is an entity

red trout
#

yes

hybrid turret
#

yeahhh i remember, i needed CBD for my IronDoor key thing lol

worldly ingot
#

Okay, so you want PlayerInteractEvent, but you want to be getting getClickedBlock()

hybrid turret
#

General question: it would make sense to load ALL data, that is stored in files/sqlite-db onEnable, no? for performance reasons?

tall dragon
#

depends on what kind of data

red trout
tall dragon
#

if its playerdata. i would say the best lifecycle is just while the player is online

inner mulch
worldly ingot
#
@EventHandler
private void onInteract(PlayerInteractEvent event) {
    Player player = event.getPlayer();
    Block clickedBlock = event.getClickedBlock();
    if (clickedBlock == null) {
        player.sendMessage("You did not click on a block");
        return;
    }

    player.sendMessage("You clicked on a " + clickedBlock.getType().getKey());
}
#

This is your basic listener for clicking on a block

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

inner mulch
hybrid turret
#

yes

inner mulch
#

so when the player tries to join load his bans

#

look if hes banned

#

if so

worldly ingot
#

I'm going to square one because everyone is throwing all sorts of nonsense towards this person and they're getting confused when we don't even know their goal

inner mulch
#

kick him

hybrid turret
#

yeah

tall dragon
#

i mean how often are you going to check a banlist i would probably not cache that.

hybrid turret
#

i'm doing that rn but i thought about it being... slow? at least on a large scale

worldly ingot
#

You don't need to cache that. If it's a ban list, use the AsyncPlayerLoginEvent

inner mulch
young knoll
#

Just lookup bans directly in the asyncprelogin event

hybrid turret
#

since i'm calling the file everytime a player joins

worldly ingot
#

You can do tasks synchronously there. The event itself is async

#

You won't stall the server

hybrid turret
#

didn't think that far tbh

young knoll
#

Does the vanilla server load the entire banlist?

remote swallow
#

totally

#

all 9 million bots get loaded

#

takes 9 hours to boot

young knoll
#

What

#

Did you ban 9 million bots on your server

remote swallow
#

hypixel did

young knoll
#

Okay but hypixel isn't the vanilla server

#

Quite far from it

remote swallow
#

deffo is

red trout
hybrid turret
#

riiiiight... why tf was i not using the Async event for this before? Lol

tall dragon
#

the beauty about the async event is that it stalls the login untill u have ur logic completed

remote swallow
#

what is your goal

tall dragon
#

while not stopping the server

young knoll
#

Just don't stall it too long :p

inner mulch
remote swallow
hybrid turret
#

i suppose AsyncPlayerPreLoginEvent#getUniqueId and #getName returns the player's name and the players uuid?

red trout
#

why..?

remote swallow
#

you want to get a pdc tag off a block?

hybrid turret
#

well that makes no sense then

inner mulch
young knoll
#

Up to 30 seconds

tall dragon
#

meaning you have 30 seconds to do your checks

hybrid turret
#

ahhhhhhhhhh

young knoll
#

After that the client will give up

remote swallow
#

you do not need nms for this

red trout
#

Can't I even get the NBT tag?

remote swallow
#

you can

#

with api

hybrid turret
#

would that mean if maaaaaaany players join at the same time, it could give up?

remote swallow
#

PDC is api

hybrid turret
#

or is it per player?

inner mulch
#

for each player

hybrid turret
#

oh

red trout
hybrid turret
#

yeah then i can easily use it

#

i hope

red trout
#

ok i find how to use pdc

tall dragon
#

you can

red trout
#

thx chat

remote swallow
#

?pdc

lost matrix
#

I would simply not rely on data which was added through the summon command

remote swallow
#

you check the if the clicked block is null, then if the state is tile state then check the data it has

young knoll
#

You can't summon a block

#

???

lost matrix
#

Wherent we on interaction entities?

young knoll
#

We are on blocks now apparently

lost matrix
#

Alright then...

tall dragon
#

i think we should go back to square one

tall dragon
#

uh yes fair enough

golden tulip
#
@EventHandler
    fun onAdvancementDone(event: PlayerAdvancementDoneEvent){
        if (event.advancement.criteria.isNotEmpty()) {
            try {
                event.advancement.criteria.clear()
            }catch (e: Exception){
                println("Error by remove the Advancements: $e")
            }
        }
    }

Can you help me I am trying to stop the advancements from loading on a player, sometimes (most of the time) this works but I get sometimes the error: java.lang.UnsupportedOperationException

tall dragon
#

well it might be usefull if we can see the entire error tracktrace

worldly ingot
#

Jokes on you, Hypixel runs vanilla

#

We actually just mod the straight up vanilla server, no events, nothing

#

Pure vanilla codebase

lilac dagger
#

can you rate hypixel code from 1 to 10?

worldly ingot
#

(for legal reasons, I'm absolutely kidding lol)

golden tulip
lilac dagger
#

assuming that's allowed

worldly ingot
lilac dagger
#

uh, a lot better, i guess i get the idea

hazy parrot
worldly ingot
#

My code? An 11. Easy. Best programmer to ever exist. Someone from 2012 who hardly knew what they were doing? meh

#

/s :p

lilac dagger
#

i remember they had to rework the tnt games server

#

i assume the code must've been a mess

worldly ingot
#

Well there was just recently a TNT games update

#

Like within the last few weeks

lilac dagger
#

that's cool

tall dragon
young knoll
#

I mean

#

I could see hypixel doing everything as a server fork

#

But that would be annoying to maintain

lilac dagger
#

the anti cheat hypixel has is mostly manual isn't it?

tall dragon
#

well it worked automatically very well back then

worldly ingot
lilac dagger
#

oh yeah, did they switch? ^

#

wait, they can't

#

1.8.8

worldly ingot
#

I'm just saying that pre-1.16 there were no Mojmaps :p

remote swallow
#

it was 1.14 choco

worldly ingot
#

Maintaining a vanilla server would be hell

remote swallow
#

get ur facts straight

worldly ingot
#

Was it 1.14?

#

That sounds wrong

remote swallow
#

1.14.4

worldly ingot
#

Fooey

young knoll
#

Hypixel could make their own maps :p

remote swallow
#

choco_named_this_HisSuperCoolName

young knoll
#

And yeah Mojmap startted in 1.14, but the original license was cringe

golden tulip
# tall dragon well it might be usefull if we can see the entire error tracktrace
java.lang.UnsupportedOperationException
     at java.base/java.util.Collections$UnmodifiableCollection.clear(Collections.java:1086)
     at nvm.icrafter_mc.nvmhub.listener.general.player.Advancement.onAdvancementDone(Advancement.kt:12)
     at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
     at java.base/java.lang.reflect.Method.invoke(Method.java:578)
     at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306)
     at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70)
     at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:589)
     at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:576)
     at net.minecraft.server.AdvancementDataPlayer.a(AdvancementDataPlayer.java:232)
     at net.minecraft.advancements.CriterionTrigger$a.a(SourceFile:21)
     at net.minecraft.advancements.critereon.CriterionTriggerAbstract.a(SourceFile:71)
     at net.minecraft.advancements.critereon.PlayerTrigger.a(SourceFile:23)
     at net.minecraft.server.level.EntityPlayer.l(EntityPlayer.java:657)
     at net.minecraft.server.level.WorldServer.a(WorldServer.java:882)
     at net.minecraft.world.level.World.a(World.java:687)
     at net.minecraft.server.level.WorldServer.lambda$8(WorldServer.java:452)
     at net.minecraft.world.level.entity.EntityTickList.a(SourceFile:54)
     at net.minecraft.server.level.WorldServer.a(WorldServer.java:432)
     at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1384)
     at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:387)
     at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1242)
     at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1054)
     at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304)
     at java.base/java.lang.Thread.run(Thread.java:1623)
tall dragon
#

i still dont understand why they still obfuscate it if they are going to release maps anyway..

red trout
worldly ingot
#

Two reasons. File size and to dissuade the average joe from distributing source

rapid vigil
#

Hello, I am trying to make a simple kits system but I am facing a problem. Basically I cant receive kits even though they're created and i can normally also create, delete and list them, there is also no errors here's the code:

Here is the KitsManager code: https://paste.md-5.net/arabepacop.cs
Here is the Kits command code in which I can manage the kits and receive them: https://paste.md-5.net/qixojurebe.java

tall dragon
worldly ingot
#

You can't clear advancement criteria

golden tulip
worldly ingot
#

You would have to use AdvancementProgress#revokeCriteria() for all criteria

#
progress.getAwardedCriteria().forEach(progress::revokeCriteria);
tall dragon
#

which is why i said. some probably have a different collection impl

#

potentially

#

but yea. what choco said ^

worldly ingot
#

Yeah probably. Best to assume it's always immutable

tall dragon
#

its out there anyway.

grave laurel
#

How can I set the texturepack of a player using spigot? If I use setResourcePack("url") the player can just reject the download and continue playing and nothing happens

rapid vigil
grave laurel
#

alright thanks

tall dragon
golden tulip
rapid vigil
#

ima try again tho

grave laurel
young knoll
#

You can make it null

#

Or get the hash of the pack

grave laurel
#

Thanks

worldly ingot
rapid vigil
#

welp it didnt work shuriken

worldly ingot
#

At least I believe you have to delay it

tall dragon
#

if ur using intellij use debugger to walk through the method and see if the variables are right.

rapid vigil
#

the last line works

tall dragon
#

that doesnt mean everything goes right

rapid vigil
#

yeah but i changed the ItemStack[] value to a String and it sent me that String when i was trying earlier

young knoll
#

You shouldn't have to call updateInventory

rapid vigil
tall dragon
#

ur sure kit.contents() & kit.armorContents() are not empty?

#

cuz this code looks fine to me

rapid vigil
#

i wouldnt even need the ArmorContents because getContents includes that but i tried just because it might work some how

tall dragon
#

does getContents return a copy?

rapid vigil
#

this problem is so weird bruh

tall dragon
rapid vigil
tall dragon
#

idk if ur depending on the api or spigot itself

#

might not be able to see if ur depending on api

rapid vigil
#

why does it matter if its a copy or not tho

tall dragon
#

cuz u clear ur inve before giving

#

potentially clearing that array

#

(i guess)

#

but i assume its a copy

rapid vigil
#

i will get rid of the clear inventory

#

yeah same issue

#

ive tried with and without clear inventory before too

tall dragon
#

thatss odd.

rapid vigil
#

bro yeah

#

its actually driving me crazy

#

it took me hours and i failed to fix it so i came here

tall dragon
#

well i dont have more time right now. i can try to look at it again when im home if ur still on this by then

rapid vigil
#

when are you home

tall dragon
#

eh in a while

#

in like 1hr 15 min probably

rapid vigil
#

yeah im available then

#

do i ping you?

tall dragon
#

sure

#

maybe someone else smart will come along in the meantime eh 😄

rapid vigil
#

haha maybe

#

tysm :>

grave laurel
young knoll
#

pack.mcmeta

grave laurel
# young knoll pack.mcmeta

Well the pack.mcmeta is:
{
"pack": {
"pack_format": 15,
"description": "Minigame Network made by Silvan!"
}
}
However the Title in MC is:
"World Specific Resources"

young knoll
#

Ah wait I think that's just hardcoded for server packs

grave laurel
#

oh, so I can't change it?

green prism
#

Hello, I have a quick question for you guys.
How can I hide those RUN_COMMAND commands from console?

grave laurel
#

is this in the console?

#

If so, I don't think that you can hide it

scarlet gate
#

I am currently working on an update checker to check for plugin updates on multiple platforms (eg. spigot, modrinth, github releases). I currently have a small api and server owners can add plugin information into the config themselves.

As the information is relatively generic I was wondering if getting developers to put their spigot-id or modrinth-slug in their plugin.yml would be frowned upon?
If not, what's the best way to go about getting the plugin.yml file (plugin#getResource("plugin.yml")?)

young knoll
#

Why do you need the spigot-id

scarlet gate
#

To get their resource from the api

regal sedge
#

Where can I get Spigot API?

hybrid turret
#

how am i changing a player's name fully with GameProfiles? anything i've tried lead to errors not being able to send messages anymore

#
[17:37:50] [Async Chat Thread - #3/ERROR]: Chain link failed, continuing to next one
java.lang.IllegalStateException: Missing key in ResourceKey[minecraft:root / minecraft:chat_type]: ResourceKey[minecraft:chat_type / minecraft:raw]
        at net.minecraft.core.IRegistry.e(SourceFile:88) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
        at net.minecraft.network.chat.ChatMessageType.a(ChatMessageType.java:59) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
        at net.minecraft.network.chat.ChatMessageType.a(ChatMessageType.java:49) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
        at net.minecraft.server.network.PlayerConnection.chat(PlayerConnection.java:2121) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
        at net.minecraft.server.network.PlayerConnection.b(PlayerConnection.java:2189) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
        at net.minecraft.server.network.PlayerConnection.lambda$17(PlayerConnection.java:1895) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
        at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718) ~[?:?]
        at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:842) ~[?:?]

is said error

junior cradle
#

You can stack up to 8 potions in your inventory, such as to take a potion, click on another and stack it ???

hybrid turret
#

not as far as i know? lol

#

potions are not stackable

#

(or at least not by vanilla means)

young knoll
scarlet gate
#

Yeahh that's the id I was referring to

#

Maybe me calling it spigot-resource-id would make more sense?

young knoll
#

yes

#

You can just hard code that, it won't change

junior cradle
hybrid turret
#

oh i misunderstood your sentence

#

If I change a player skin using PlayerProfile shouldn't I see the changed skin as well?

scarlet gate
# young knoll You can just hard code that, it won't change

Yep, so the question was more regarding me suggesting others putting it in their plugin.yml for compatibility.
My thought was that it makes sense to be something that goes in the plugin.yml which my plugin will then just quickly scan over to see if it's present

umbral ridge
young knoll
#

I mean, I guess you could do that

#

Or just make an api they can use

river oracle
#

Api is stupid just yolo

hybrid turret
scarlet gate
# young knoll Or just make an api they can use

Yeahh I've got a simple api setup which is pretty much the same thing but with more optional settings. I just thought that saying "just add one line to your plugin.yml" was more convincing lol

minor junco
# umbral ridge yesss

Theoretically you don't need

PRIMARY KEY NOT NULL

As primary keys are non null by default

umbral ridge
#

I like to type NOT NULL everywhere regardless if they can be null or not

#

but for fields where values can be null I dont type it

minor junco
#

okay that's a valid approach, just saying

hybrid turret
#

even for primary keys? that's something lol

#

interesting approach tho

minor junco
#

I mean it's the same as with annotating @Nullable on fields that already can be null, it's just a hint that an experienced dev can immediately see

umbral ridge
#

yes

compact wave
#

hey, can somone help me compile a decompiled plugin
i've been trying for hours
i managed to decompile it but i cant recompile it

umbral ridge
#

XD

#

do you have a project for the plugin?

compact wave
#

i have the jar it has a class thats just giving the person who made the plugin op and stuff and im trying to remove it

#

and idk how to'

umbral ridge
#

contact the developer

compact wave
#

he wont respond

#

is it just not possible without the project file?

tall dragon
#

@rapid vigil did u get ur issue fixed yet?

rapid vigil
tall dragon
#

what mc version ru running btw

rapid vigil
#

1.20.4

tall dragon
#

is ur project on github?

rapid vigil
#

secc sorry for taking time to respond

fickle pawn
hybrid turret
#

1st that is at least for me an empty image, second of all: you have balls to just ping md_5 lmao damn

remote swallow
minor junco
#

Just ditch the plugin if it's that scammy?

compact wave
#

i really need it and i dont have time to hire a new dev to make it for me

minor junco
#

Alright, so you only have the Jar?

#

No source nothing?

compact wave
#

yea

lilac dagger
minor junco
#

Fernflower often has issues with certain bytecode instructions, assuming you're using a decompiler that utilizes fernflower

#

What's the issue with recompiling?

sleek estuary
#

how i fix this?

crystal goblet
#

Hello, does anyone know how to create achievement categories?

chrome beacon
#

create a new instance

sleek estuary
slate surge
#

What event should i use to make the draggon egg not teleport uppon right click or left click?

icy beacon
#

Maybe PlayerInteractEvent

slate surge
#

PlayerInteractEvent?

#

hmm

#

lemme try

icy beacon
#

For LEFT_CLICK_BLOCK & RIGHT_CLICK_BLOCK

#

And don't forget that PIE gets called once for every hand

slate surge
#

ok

#

PIE?

icy beacon
#

PlayerInteractEvent

slate surge
#

ohok

#

np

icy beacon
#

I don't have the stamina to type shit in full rn lol

slate surge
#

i just need to set it to air

#

lol

icy beacon
#

If you want it to break instead of teleporting then yeah you probably cancel, set to air and #dropNaturally

glass breach
#

hey uhhh fellas?... Soo..........
I'm getting this error and it is making me feel dumb java.lang.IllegalArgumentException: Plugin already initialized!

I only have one plugin in the same folder and in Main there is only one onEnable()........

are there.... any other reasons why this might be happening?

slate surge
#

i have this shit atm

@EventHandler
    public void onPlayerInteract(PlayerInteractEvent event)
    {
        Player player = event.getPlayer();
        if (event.getAction().toString().contains("RIGHT_CLICK") && event.getItem() != null)
        {
            if (isFireball(event.getItem()))
            {
                Vector direction = player.getLocation().getDirection();
                player.launchProjectile(Fireball.class, direction);
                if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
                {
                    return;
                }
                event.setCancelled(true);
                ItemStack fireballItem = event.getItem();
                int amount = fireballItem.getAmount();
                if (amount > 1)
                {
                    fireballItem.setAmount(amount - 1);
                } else
                {
                    player.getInventory().remove(fireballItem);
                }
            }
        }
    }```
inserting the check for dragonegg after the if shouldn't be a bad idea right?
undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

icy beacon
slate surge
icy beacon
#

I would personally make a different listener for convenience (code cleanness)

glass breach
hybrid quartz
#

Hello! How can i change Y location of launch projectile? I need to launch projectile from player's legs instead of head.

icy beacon
icy beacon
#

?paste for large code blocks

undone axleBOT
glass breach
# icy beacon ?nocode

Might this be enough?

package me.manoszombies;

import me.manoszombies.db.Database;
import org.bukkit.imports;
import java.util.imports;

public final class Main extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        long start = System.currentTimeMillis();
        System.out.println("Starting");

        this.database = new Database();
        try {
            this.database.initializeDatabase();
        } catch (SQLException e) {
            e.printStackTrace();
            System.out.println("Database couldn't be loaded...");
        }


        System.out.println("Plugin took " + (System.currentTimeMillis() - start) + "ms");
}

    @Override
    public void onDisable() {}

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        return true;
    }

    @EventHandler
    public void onPlayerInteractEvent(PlayerInteractEvent event) {}

    @EventHandler
    public void onPlayerJoinEvent(PlayerJoinEvent event) {}
}
#

Ill sendthe database class and the entire code if it isnt

#

not that anyone will steal the code since its so bad 💀

slate surge
#

i write the shitiest code

glass breach
#

youve seen nothing
even if ive seen much less than you

youve seen nothing

slate surge
#

is it possible to store data in a permission node

lilac dagger
#

why would you?

#

it's just a permission node

slate surge
#

like a player having plugin.perms.perms = some value instead of boolean?

lilac dagger
#

i haven't worked with Permissible

#

but i think there's a reason that it works the way it does

slate surge
#

hm

#

ok

glass breach
#

Is it possible to initialize listeners in one class?

#

I feel like getServer().getPluginManager().registerEvents(new Main(), this); is going to cause the error i was having previously

lilac dagger
#

i saw people do it, but why?

#

they used a method that registers multiple listeners from var args

hazy parrot
glass breach
#

well, as you can probably tell, I'm really new to Java and something I'm having difficulty with is passing variables from Class to Class in a sane way

undone axleBOT
lilac dagger
#

oh yeah sorry, don't new Main() your java plugin

wet breach
#

if your main class is also your listener, you would do
getServer().getPluginManager().registerEvents(this, this);

lilac dagger
#

i thought he wanted to register multiple listeners in one line

slate surge
#

How to prevent "your home bed was missing or obstructed"

lilac dagger
#

modify the playerrespawn event

glass breach
#

thanks, tho from fr33styler's reaction I probably should be doing it in another way.....

As I said, I'm having difficulty with having variables hop from class to class, as in giving listeners.PlayerInteractionListener a private variable from Main... I don't even know where to look...?

#

Its probably something super basic, but yeah

slate surge
hazy parrot
slate surge
glass breach
glass breach
slate surge
#

is there any event for a packet being sent to the client ?

tall dragon
#

no

#

but there is a library that adds something like that

#

this

rough ibex
#

@umbral ridge please do not post anything of, from, or referencing, him

umbral ridge
#

ok

rough ibex
#

thanks

shadow night
#

him?

hot dune
#

Hello! I need help as I have no idea what should I do next. Well, I'm trying to make all vanilla mobs to be spawned with my custom entity NMS class, but I have no idea how to do it. The reason for it is just I want to add custom fields with some information that is not available in vanilla mob so all mobs will have these fields. Can someone give me an idea on how to do it or maybe any useful link (I tried to search but haven't found anything working for me).

P.S. I'm using 1.20.4 and working with NMS

lost matrix
hot dune
#

for example I want to create custom field of entity health (not to use vanilla bar as it's 1024 max afaik) and want to add custom defense field (again, in vanilla there's 20 afaik)

#

as for pathfinding and AI, I want to create my custom bosses with their AI and ofc parameters that extend the max ones

lost matrix
#

What prevents you from just creating your own class and wrapping it around the spigot entity?
This will eliminate your problems with nms as you simply store your custom data in the PDC of the entity
and load it when the entity loads back.

hot dune
lost matrix
#

What do you mean by "parameters that extend the max ones"

hot dune
young knoll
#

You don't need to replace entities to mess with their AI

lost matrix
hot dune
#

didn't know

gleaming grove
#

Is it possible to send custom packets as Minecraft server, so I will not have to run Http or Websocket server inside plugin?

hot dune
#

or ChuckLoad is not really needed?

young knoll
#

Do you want to add it to enemies that spawn during worldgen?

hot dune
#

I want to add it to ALL mobs that spawn in the already generated world and not generated yet

young knoll
#

You would want the spawn event and EntitiesLoadEvent

hot dune
#

Okay, thanks

wraith imp
#

How can i add comments to my config file? I'm using the default config api.

lost matrix
peak depot
#

how can I set someone gliding as if they were on the side of a honeyblock

copper meteor
#

Hi there, i'm looking for a plugin for minecraft java edition which create dialog box that which can be personnalised with a texture pack

#

like that :

drowsy helm
#

Most texture pack related things will he custom made

#

Too niche of a usecase to be a public plugin

copper meteor
#

i'm searching the screenshot lol

drowsy helm
#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

copper meteor
#

Like this one

drowsy helm
#

Yeah I doubt theres a public plugin for that specifically

#

Fully customised experiences like that and public plugins dont go well together

copper meteor
#

because usually, you have a plugin which create the effect and on thop the server add a visual pack

#

and the other plugin that i'm looking for is an arrow. I mean when you are connected as a player, you have a big 3D arrow in front of you telling you where to go for the next step

drowsy helm
#

Another one that seems a bit too niche

#

If you’re after things tailored like that id recommend hire a dev

#

A lot more issues arise like how will you program the dialogue and where the arrow is pointing

rocky cave
#

Hi all, I'm working on a plugin for my server and I have a blank project I would like to try and get up and running, however I'm not entirely sure how to add the plugin to the server; considering I'm using the sort of "DIY" version of a server.jar that the minecraft.net page provides. Any help would be greatly appreciated. (also I wasn't sure weather to post this here or in the "help-server" channel, but it is development related, so I figured here would work)

lost matrix
#

So its not a spigot server but a modified vanilla server, right?

rocky cave
#

yes

lost matrix
#

In that case you would modify the vanilla server in a way that lets you load "plugins".
Whatever that means in your context.

#

That sounds like you gonna have to do an incredible amount of work before you can do anything with it.

inner mulch
rocky cave
#

this is fair, I'm fairly new to this kind of development, so if someone could help me to do a quick start for a spigot server (or send a helpful vid/forum page) that would be great. If not I can figure smth out, appreciate the help either way.

inner mulch
#

install spigot.jar

#

create folder

#

double click

#

accept eula

storm crystal
#

Would json be okay to store static data such as drop rates from enemies?

#

Is there any example of its utilization that I could see to grasp the idea of utilizing it properly?

#

I havent touched databases or persistence for a long long time and need a refresh

young knoll
#

Yeah json is fine for that

umbral ridge
#

Yeah json is fine

young knoll
#

Or yaml

#

It sounds like it’s just configurable values

remote swallow
#

ill yaml you

umbral ridge
#

or you can use your own config.<yourExtension>

#

:)

#

your own serializer...

#

I might start doing that in my plugins

#

won't even save config.yml, will never generate it

young knoll
#

Why

lilac dagger
#

i can't think of another structure that won't look like one of these

young knoll
#

Make your own

#

Because everyone wants that

rapid vigil
#

I like to save my data in a .txt file

umbral ridge
ivory sleet
#

also

#

:p

lilac dagger
#

it looks more like a scripting file

#

but i can't seem to find a file to look at properly

#

oh nvm, i see

#

well, it does look like json

young knoll
#

Everything is a scripting format if ur brave enough

river oracle
lilac dagger
#

conclube already told me about it

#

it's like json and yml had a child

river oracle
#

Awhjh duxk you conclube

#

Conclure your old name was easier to type why did you do this to me

lilac dagger
#

and from what i see it's also some form of scripting file

river oracle
#

Gradle the config language kek

#

item = ItemStack(){

}

storm crystal
#

does anyone have a video / written tutorial on making persistent or player specific guis?

#

I plan to make a gui for each player for accessories that would be persistent through the game

young knoll
#

Just keep an inventory reference around

storm crystal
#

or do I not get it?

sullen canyon
#

why does it make me suffer

silent slate
#

there is no asmap function

#

sadly

#

Does anyone know how i could get a navigator going like a lobby navigator item usign a compass? How do i detect right clicks in the air with a compass? PlayerInteractevent doesnt seem to cover that

eternal oxide
#

This event will fire as cancelled if the vanilla behavior is to do nothing (e.g interacting with air). For the purpose of avoiding doubt, this means that the event will only be in the cancelled state if it is fired as a result of some prediction made by the server where no subsequent code will run, rather than when the subsequent interaction activity (e.g. placing a block in an illegal position (BlockCanBuildEvent) will fail.

silent slate
#

So compass playerinteract event will fire as cancelled by default when the compass interacts with air

halcyon gate
#

Is there a plugin that I can add where it bans specific users from using certain words? I can only find ones that ban all players from specific words.

eternal oxide
#

Multiverse

silent slate
#

or code it urself

#

its literally a 10 minute thing

halcyon gate
#

?

silent slate
#

who do u wanna ban from which world

#

then do a playerChangesWorld Event and check with a simple if clause for the world and for the players and if they match, cancel the even and send the player a message

flint coyote
#

certain "words" not "worlds"

inner mulch
#

does Bukkit.getEntity(random player uuid) return a player instance as entity?

#

in short can it return players too?

flint coyote
#

I suppose so. Easy to test within 5 minutes though

young knoll
#

And save/load the relevant data for it

storm crystal
#

I'd have to read about it, I assume spigot API?

#

is it possible to store map String : Inventory in a database?

young knoll
#

You don’t need to store the entire inventory

#

Just the relevant stuff

#

For example, just store the accessories the player has equipped

inner mulch
#

silverfish.setVisibleByDefault(false);
why does this result in
silverfish.addPassenger(player);
to not work? (it does not set it as passenger)

#

can i not set an entity as a passenger to an entity it doesnt see?

young knoll
#

Probably not for players

#

You’re essentially sending a message to the client to start riding an entity it doesn’t know about

inner mulch
#

hmm ok

inner mulch
young knoll
#

Use a marker armor stand

inner mulch
#

it has to be a silverfish tho, it has the perfect size for what im doing

#

its the only entity with this size

storm crystal
#

sorry I am pretty confused on this one

young knoll
#

Depends on how you want it to work

#

Could just store a list of accessory ids