#help-development

1 messages · Page 1210 of 1

flint bane
#

tried like 15 times in 20 mins to fix that shit

#

even had to recode the whole class 10 times

grim hound
#

so uh

#

um

#

what if I don't have one?

flint bane
#

any help?

young knoll
#

?paste

undone axleBOT
chrome beacon
grim hound
grim hound
#

thanks

#

;]

sinful iron
#

hello, i have a question on using custom item for a custom recipe ONLY. how can i make it only works on custom recipes those r using this custom item and not other vanilla recipes? it looks like only checking the Materials / tags but not PersistentDataContainer? i tried ExactChoice and it doesnt work as expected.

sullen marlin
#

most vanilla recipes are based on materials so youd have to use a craft event

sinful iron
#

The PrepareItemCraftEvent ?

sullen marlin
#

yeah

sinful iron
#

then i do checking there ?

sullen marlin
#

yes

sinful iron
#

ah, alright thank you

#

ehm, but then is it 1 PrepareItemCraftEvent per recipe ? and how do i get which recipe is it preparing, as i remembered when i tried to System print the name of the recipe it got, it doesnt have a name or at least that looks random to me

viral halo
#

i have a problem
i get a json in String type and i want to get the values. How can i get those value from a key
i used org.json and the JSONObject is require Map now. All the tutorial i found online can just put string into the JSONObject

#

What i found online

#

And this what i got

echo basalt
#

how do I know when I'm too many packages deep 🤔

#

I'm like 10 packages deep rn

blazing ocean
#

if you're asking that question you probably know the answer

echo basalt
#

yeah but I don't see a cleaner way to organize this

summer scroll
echo basalt
#

I've reached the point where I'm repeating so much math with generics that I need to resort to this

#

can prolly de-duplicate half of it tbf

nova notch
#

why does this exist

echo basalt
#

currently making a funky attribute system and I cba making different "stacking policies" for different generics of numbers

#

So I can do something like

StackingPolicy<Integer> policy = StackingPolicies.sum();

int result = policy.apply(5, 10);
#

It's a bit like mojank's attribute system but it works for generics and you can make custom "stacking policies"

#

Like overriding the previous value

wooden frost
#

Using "InventoryClickEvent" how does one check what item was placed into a slot

wooden frost
mortal vortex
#

getCurrentItem()

wooden frost
#

oh. i tried it but it returned air i think or smh, lemme check

mortal vortex
wooden frost
#

damnn

mortal vortex
#

There is getCursor, which gets whatever the mouse is on.

echo basalt
#

The wait 1 tick thing is ugly

wooden frost
echo basalt
#

Basically you need to predict and do a million checks

echo basalt
#

For example, in a regular click the item goes from the cursor to a slot

#

but then the item in that slot gets replaced with the cursor

echo basalt
#

Basically the event fires before the item is put in

#

If you're shift-clicking you need to find the first item that matches your thing in the opposite inventory

mortal vortex
echo basalt
#

I should make an API abstraction for slots

echo basalt
mortal vortex
#

yeah ik lol

wooden frost
#

i dont understand a single thing you said

mortal vortex
#

ohh I think i've sene someone do:

 @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {

        switch (event.getAction()) {
            case PLACE_ALL:
            case PLACE_SOME:
            case ... // basically the place ones, not the uh "take"?? 

                Inventory clickedInventory = event.getClickedInventory();
                if (clickedInventory != null) {

                    ItemStack itemPlaced = event.getCursor(); // Item on the cursor is here
echo basalt
#

I remember making a plugin for putting custom items in beacons and it was a pain

#

This wasn't 100% accurate, pretty sure I still had to handle shift clicking and offhand switching

smoky oak
#

hey illusion do you by chance know wheres a anti-dupe plugin for the current dupe is? i havent gotten around to start on my own yet

echo basalt
#

what current dupe

wooden frost
smoky oak
#

drop/place at once when your connections shit to duplicate blocks, aka, shulkers

echo basalt
#

dunno, not my expertise

#

rn I'm making an rpg item system :3

smoky oak
#

well what is your area of expertise? i just know i see you here a lot lol

echo basalt
#

I don't really run servers so I don't know much about general server setup / what the best plugins are

#

I do code a lot so you can ask me about network infrastructure, nms hella stuff

#

made procedural dungeons the other day

#

finally ported my ECS to java :3

smoky oak
#

do you know why the particle rendering nonsense caps itself

echo basalt
#

client has a particle limit

#

it's either 16k or 64k and iirc it depends on the client version

smoky oak
#

🤦
of course

wooden frost
smoky oak
#

urgh my issue is that i dont want to use rps

wooden frost
#

i dont think you should use 16k particles😭

echo basalt
#

make a packet-level particle culler

#

most particles can be culled

smoky oak
#

no, im using them to make geometric shapes

echo basalt
#

also keep in mind that bandwidth is a thing outside localhost environments

smoky oak
#

lemme dig up an old screenshot

echo basalt
#

yeah those can be culled

smoky oak
#

wouldn't that make them spotty

#

i want it continuous

echo basalt
#

barely

#

basically your particle density is way too big

smoky oak
#

hm, ill look into it. do you know by chance which color supporting particle is best for making shapes?

#

this is dust

echo basalt
#

Haven't really messed with particles enough to give you a concrete answer

#

dust is the standard

smoky oak
#

alr ty

#

also im totally not rewriting this thing from scratch atm lol

#

oh, did you ever do work on structures?

echo basalt
#

as in?

#

structure blocks or just multi block stuff?

smoky oak
#

2nd

#

i need to detect if a block is part of a structure in which it serves as the anchor point. best solutino i found so far is shade RedLib and use that

#

but well, thats still depending on one extra library

echo basalt
#

found it

smoky oak
#

ah ill put a pin in that

echo basalt
#

I have some code for both scenarios

#

when you know the anchor point and when you don't

#

(when you don't it just brute forces the fuck out of it)

#

useful for portals and detecting when ppl build dicks out of dirt and stone

#

brute forcing is a lot slower

smoky oak
#

no, this is for specific structs. see the gem/amethyst build below? i KNOW the anchor is in the center, top layer, just not of which structure

echo basalt
#

then you just loop over every registered structure and see if it matches

#

you can multi-thread it

#

it's how I do my "any-portal in any-rotation" logic

smoky oak
#

bleh i need to look into how to merge threads back into main, but thats not a topic for right now kek

echo basalt
#

CompletableFuture.allOf(futures).join

#

I wouldn't join, but instead make an executor that fires to main

#

bleh

smoky oak
#

yea thats probably a better solution than a 1-tick scheduler that checks if all threads have stopped lol

#

so hows your scan work?

smoky oak
echo basalt
#

Depends ™️

smoky oak
#

like, how i do the jump back to main you mean?

echo basalt
#

the futures run on another thread

#

running allOf waits for every future to run and completes on whatever thread

#

you jump back with the bukkit scheduler

wooden frost
#

is there a way to hide this in INTELIJI into a group perhaps?

#

cursed , i know

smoky oak
#

if its code inside a method you can wrap it in {} and click on the arrow that makes

wooden frost
#

OHH

#

RIGHT

#

THANKS

#

I FORGOT I CAN DO THAT

smoky oak
echo basalt
#

it does

#

but you're multithreading who cares

#

the point isn't about latency it's about not blocking the main thread

smoky oak
#

is there a way to check how much processing time is 'left'?

#

like

#

the time in ms that main is on wait()

echo basalt
#

No, you'll have to make your own logic for that

#

and main is not on wait

#

you schedule the futures on another thread and when they're done they'll schedule a task to run something else on main

#

main is completely unblocked while the futures run unless you join them

#

In which case the main thread is blocked until every future is done running

#

You can't really predict things, we're not fortunetellers

smoky oak
#

ah, thats not exactly what i meant
if a ticks processed it goes liek 'process world -> process plugin events -> wait until next tick'

#

i thought that as long as theres no TPS lag, theres no reason to multithread the scan

#

hence me wondering if i can check how long last tick's wait was

echo basalt
#

there's tick start and tick end events

#

on paper*

smoky oak
#

🤦‍♂️

#

i dont suppose i can interface with nms to grab that info

#

illusion, if you find that scan code, can you PM it to me? i need to buy groceries

viral halo
#

how can i spawn a npc using this packet

echo basalt
#

will send after work it's a bit sus rn

smoky oak
#

thats fine, im busy with... sooooo much other code atm lol

echo basalt
#

yeah same

#

making the equivalent to "runes" / "reforging" rn

echo basalt
#

I don't think I've made a non-generic class for the past maybe 3 hours

chrome beacon
#

but all you really need to do is provide all those params of your npc entity

viral halo
#

what kind of params

chrome beacon
#

The ones in the screenshot

viral halo
#

the thing is i cannot spawn a player since there isnt a place to let me put the gameprofile

chrome beacon
#

You don't need a player profile there

#

You simply pass the entity id

viral halo
#

i tried to use nms but all of the tutorial are outdated

#

so im trying on protocollib

viral halo
chrome beacon
#

hm? wdym

viral halo
#

the player name skin are stored in an entity right?

#

so i have to create an entity first so i can spawn it

chrome beacon
#

That's another packet

viral halo
#

PlayerInfoUpdate?

chrome beacon
#

One packet to tell the player about a new player (npc)
One to spawn it
One to set metadata

chrome beacon
viral halo
#

well which would u recommended to make it on protocollib or nms

chrome beacon
#

both will work if you send the right data

viral halo
#

i cant find any tutorial on how to do that right on nms

#

protocollib too

#

all i do is print the packet.getModifier().toString() and see what can i put into it

smoky oak
echo basalt
#

I literally have tutorials on both

echo basalt
smoky oak
#

oh true

viral halo
chrome beacon
#

Not really

viral halo
#

the params are different on every update

echo basalt
#

not if you run mappings

chrome beacon
#

^ I really do hope you're not using unmapped nms 💀

viral halo
#

just the params are different

#

thats the problem i got

#

idk what to put inside

chrome beacon
#

You can just use Citizens

blazing ocean
#

or packetevents

viral halo
#

well can someone explain whats the correct params for player info update

viral halo
#
        PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.PLAYER_INFO);
List<Object> list = new ArrayList<>();
        list.add(uuid);
        list.add(getProperties(player.getUniqueId()));
        packet.getModifier().write(0, EnumSet.of(EnumWrappers.PlayerInfoAction.ADD_PLAYER));
        packet.getModifier().write(1, list);
        ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);

This is the code
and the error

chrome beacon
#

Yeah that's not right

viral halo
#

ikr

#

which part tho

chrome beacon
#

Don't use a list of objects

echo basalt
chrome beacon
#

One entry in that list is supposed to be one player

viral halo
#

i followed this

chrome beacon
#

Yeah

#

and what you did does not match that

#

Anyways ProtocolLib has a wrapper class to help you out

viral halo
#

i tried somethin else before

#

and i found out its list

#

so i use list

chrome beacon
#

It is a list yes

chrome beacon
echo basalt
#

Protocollib matches nms' signature, not wiki.vg's

#

nms encodes to wiki.vg's signature but the fields might not match

chrome beacon
#

That too

#

They do match pretty fine here

viral halo
chrome beacon
#

PlayerInfoData

viral halo
#

Pray on god

#

Cannot cast com.comphenix.protocol.wrappers.PlayerInfoData to java.util.List well

blazing ocean
#

plib moment

viral halo
#

how can i solve it

potent atlas
#

Hi, display entity issue!
They're spawning on the corner of the block
Won't center on the player it is supposed to teleport to
Tried adding 0.5 to x and z and it teleported to the block next to the player...
Trying to center it on the player as the player moves
Any advice?

potent atlas
#

getX

viral halo
#
        PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.PLAYER_INFO);

        WrappedChatComponent component = WrappedChatComponent.fromText(wrappedGameProfile.getName());
        PlayerInfoData data = new PlayerInfoData(wrappedGameProfile, 1, EnumWrappers.NativeGameMode.CREATIVE, component);

        packet.getModifier().write(0, EnumSet.of(EnumWrappers.PlayerInfoAction.ADD_PLAYER));
        packet.getModifier().write(1, data);
        ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);

I tried to make List.of()... doesnt work 😦

viral halo
potent atlas
#

yeah

viral halo
#

u using nms?

potent atlas
#

no

viral halo
#

u can try install nms

#

and try this

public void teleport(Entity entity, int x, int y, int z) {
  CraftEntity craftEntity = (CraftEntity) entity;
  craftEntity.getHandle().setPos(newX, newY, newZ);
}
orchid gazelle
#

hello mee6

viral halo
#

HI

viral halo
potent atlas
viral halo
viral halo
#

if command work

potent atlas
#

Umm

#

I'll keep trying in the morning. Thanks for your help it's 3 AM woops lol

viral halo
#

and i tried to solve a problem since 7 hour ago

#

and still fail

silver robin
#

can you show the code that spawns the display entity?

#

When you enable hitboxes F3+B , I believe the blue line will always begin from (x, z) of the entity's location, and y will be entity's location Y plus their eye height

silver robin
viral halo
#

im so happy ;-;

quaint mantle
#

can I make the frozen health bar just as an display without the player freezing?

viral halo
#

probably using nms

chrome beacon
#

Alternatively just send the packet

blazing ocean
silver robin
#

What's a reliable way to determine if a block (or Material) is passable through by players? what I mean is solid blocks such as stone, dirt, wood you cannot go through them, but grass, flowers, cobweb, vines etc you can

#

without the need for a giant switch statement of course :)

silver robin
#

It works nicely for the blocks I tested it for thank you very much!

summer scroll
#

Anytime!

hollow vessel
#

Hi, I have problem with updating gui title view InventoryView#setTitle() when I perform that method gui start to be really glitchy

#
    public void updateTitle(AssortmentChest assortmentChest) {
        for (HumanEntity viewer : this.inventory.getViewers()) {
            if (!(viewer instanceof Player player)) {
                continue;
            }

            String title = "Skrzynia " + assortmentChest.getUsedWeight() + "/" + assortmentChest.getWeightCapacity() + "kg";
            player.getOpenInventory().setTitle(title);
        }
    }
eternal night
#

@ y2k

blazing ocean
#

was about to

#

smh lynx

hollow vessel
blazing ocean
#

but yea, don't use that method

hollow vessel
#

so how can I update it? on 1.19.3 I tried with packets and it works the same I updated to 1.19.4 to use inbuild method and still works really bad

blazing ocean
#

updating a title requires opening a new inventory

hollow vessel
#

yea but then the position of cursor is reseting

blazing ocean
#

correct

hollow vessel
#

can I avoid it?

blazing ocean
#

no

#

not that i know of

chrome beacon
hollow vessel
#

yea

chrome beacon
#

Try delaying it until next tick

#

See what happens

hollow vessel
#

okay

#

it works!

#

thank you!

zealous osprey
ancient canopy
#

Is it possible in 1.8 to reduce the amount of hunger players lose?

ripe idol
#

yo guys do i have to master java for spigot plugin development? or basics will work?

eternal night
#

not master, but you should have a solid fundamental

ripe idol
eternal night
#

Probably yes

ripe idol
#

okay!

chrome beacon
#

Make sure to follow along with the examples and test things on your own

grim hound
#

if I have a common module, and would like each platform-specific module to include the common in it, isn't this how I could build the classes of both?

#

(This is in the platform-specific module)

#

and uh, it doesn't build the common module

blazing ocean
#

are you just trying to shade it or what

grim hound
#

I mean, basically, ye

blazing ocean
#

and no, you don't needd to do that

#

just implementation(project(":common"))

grim hound
#

...it doesn't build

blazing ocean
#

that will build the dependent projects

grim hound
#

doesn't really do it

blazing ocean
#

Don't have the build task depend on :common:build

#

It will

grim hound
#

yep, still

blazing ocean
#

what is the output of :Spigot:build

grim hound
#

only these classes

blazing ocean
#

and what do you mean it does not do it

#

is it not getting included in your jar or..?

grim hound
#

the common module

blazing ocean
#

that is not a valid response to that question

grim hound
#

none of this

grim hound
#

and so does common:build for it's own classes

blazing ocean
#

and are you sure you are actually running shadow

grim hound
#

nice

#

-1 social status for me

#

okay, shadow works perfectly

#

sorry xd

somber walrus
#

So I have a .json file with my custom loot table, but how do I add to my mc server?

haughty storm
#

I'm trying to create an itemdisplay of a mineraft iron sword, that is facing in the direction of a psecific vexctor, but I can't get the transformation correct, could someone help me to understand how I can achieve that?

eternal oxide
#

Its an Entity so you don;t need to use Transformation at all

#

just set the direction

haughty storm
#

I'll try it out, one second. Thank you

#

It doesnt really work, probably because the txture of the iron sword isnt a vertical line but has an angle

eternal oxide
#

an angle?

haughty storm
#

yeah, the sword texture goes from the bottomn right to the top left so if i create an itemdisplay using the texture it will have that same texture. I want to rotate it so the tip faces the given direction

eternal oxide
#

ah

#

then yes you are going to have to mess with Translations

#

two rotations

#
Transformation transformation = entity.getTransformation();
// rotate here around Z or X to raise the tip...
transformation.getRightRotation().rotate...
transformation.getRightRotation().rotateY(rotation);
entity.setTransformation(transformation);```
haughty storm
#

Thanks a lot. And how exactly would I translate the direction vector, should I just mess around with it and try it out?

eternal oxide
#

Math.atan2

#

using x,z

#

of the Vector

haughty storm
#

Ok, thank you so much I'll try it out later

somber walrus
#

so when I try to generate my custom loot table with this command: give @s chest[container_loot={loot_table:"jef:chests/small_dungeon_chest"}] It generates an empty container

next stratus
#

Hey, is worldedit the fastest way to set blocks or there a possibility to use nms? I know you can do it via nms but trying to work out the best method is a bit tricky.

smoky anchor
blazing ocean
earnest girder
chrome beacon
#

custom model data did change a bit

smoky anchor
#

Look at the changelog for the version (also, 1.24 does not exist yet)
There were major changes

smoky anchor
slender elbow
#

old custom model data has been effectively replaced with item_model yeah

earnest girder
smoky anchor
rotund sparrow
#

Hello does anybody have experience in obfuscating Spigot/PaperMC Plugins using ProGuard?

I am trying it for two days now and it seems like I can't get it to work, would rlly appreciate a helping hand.

smoky anchor
#

@earnest girder If you need any help with it, the Minecraft Commands discord is probably the best equipped for this.
Just create a thread and I'm sure ppl will be happy to help there.

earnest girder
#

thanks

potent atlas
eternal oxide
#

a BlockDisplay spawns with its corner at the location. A player is centred on the location

#

if you want the BlockDisplay to spawn AT the player then subtract 0.5 from X and Z

potent atlas
#

ok

#

trying that now

somber walrus
smoky anchor
somber walrus
smoky anchor
#

wait- "saves"
Are you not even on a server ?
What are you doing on this discord lmao

smoky anchor
#

the first one you sent looked like it should work, provided there are no mistakes in the datapack

somber walrus
#

im on 1.21.1

smoky anchor
#

try to use the one you sent before

somber walrus
#

the folder is called loot°tables though, should it be loot_table?

smoky anchor
#

what folder

somber walrus
#

datapacks > jef_datapack > jef > loot_tables > chests > small_bronze_chest.json

smoky anchor
#

I don't know in which version they renamed the folders, but at least on latest it is indeed "loot_table"

#

so I say give it a try

#

And I'd recommend going to the Minecraft Commands discord server for this kind of issues in the future.
I can see you are in there as well.
I don't know why you're here, this place is for spigot plugin development mainly.

somber walrus
#

But Im first testing it in a singleplayer world

smoky anchor
#

But you are making a datapack.
And if you're testing it in singleplayer then that is more of a reason to go to MCC discord.
They will be able to help even more/better.

rigid vault
#

I'm trying to make a custom world generator, but it uses the vanilla one instead, how do I fix that?
this is my plugin.yml btw: yml name: Void_SkyBlock version: '${project.version}' main: Lazy.VoidSkyBlock api-version: '1.21' worlds: world: generator: Void_SkyBlock

#

this is the custom ChunkGenerator class: ```java
public class VSBChunkGenerator extends ChunkGenerator {

@Override
public void generateNoise(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ, @NotNull ChunkData chunkData) {
    if (chunkX == 0 && chunkZ == 0) {
        for (int X = 0; X < 3; X++)
            for (int Z = 0; Z < 3; Z++) {
                chunkData.setBlock(X, 0, Z, Material.BEDROCK);
            }
    }
}

}```

#

and this is the main class: ```java
public final class VoidSkyBlock extends JavaPlugin {

public static VoidSkyBlock vsbPlugin;
public static Material[] baseItems = new Material[] {Material.OAK_PLANKS, Material.STICK, Material.DIRT, Material.IRON_NUGGET};

@Override
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
    return new VSBChunkGenerator();
}

@Override
public void onEnable() {
    // Plugin startup logic
    vsbPlugin = this;
    getServer().getPluginManager().registerEvents(new VSBPlayerJoin(), vsbPlugin);
}

@Override
public void onDisable() {
    // Plugin shutdown logic
}

}```

#

pls help

chrome beacon
#

Depends on what you want to do

#

Are you going for maven central? or do you want your own repo

grim hound
#

just upload my an api of my plugin to maven central

grim hound
chrome beacon
#

You can self host your own repo using something like Reposilite

mortal hare
#

guys.. i've comitted a war crime in java

#

i've... i've used a var...

chrome beacon
mortal hare
#

but seriously using var and static imports kinda makes your code more readable if its not too long

chrome beacon
#

Reposilite is free yes

#

but you'd need something to run it on

grim hound
#

wdym?

chrome beacon
#

Like somewhere to host it

grim hound
#

ah

#

well maven central it is

glad prawn
mortal hare
chrome beacon
#

no 🔫

mortal hare
#

Imho its better to make your code less verbose in syntax way so that you expose only the the logic that needs to maintained so i see such things as a win in terms of maintainability overall

chrome beacon
#

What will happen is that bpeople alias the same import to different things

blazing ocean
chrome beacon
#

no 🔫

blazing ocean
#
import com.sk89q.worldedit.world.block.BlockState as WEBlockState

// OR

typealias WEBlockState = com.sk89q.worldedit.world.block.BlockState
remote swallow
chrome beacon
#

Yeah I know

noble lantern
#

import com.sk89q.worldedit.world.block.BlockState as WEBlockState

Thats a thing? Wtf? Javascript confirmed?

#

get that as out of my java im offended now

#

how dare my java have proper grammar

#

thank god i got scared for a moment

remote swallow
#

It's kotlin

noble lantern
#

NOOO

earnest girder
#

what is the current up to date way of adding an attribute modifier to an item?

#

AttributeModifier constructor is deprecated

blazing ocean
smoky anchor
nova notch
rigid vault
#

already fixed it tho...

wet breach
cedar turtle
#

What is the best way to prevent creeper damage to players?

mortal hare
#

im so obsessed with context driven naming and syntax right now tbh

#

i dont really get it why people dont use var or static import more often

#

isnt your code supposed to be so readable that you can read it straight from git repos without knowing much implementation details

eternal oxide
#

In Java most don't know what a static import does and most experienced Java devs prefer readability over the use of var

eternal night
#

var is pretty meh if you overuse it ngl

mortal hare
#

i dont see how type names improve readability, in very niche cases it does, for example primitives or something.

sure you do know a type, but you will still need to know how to apply it, and usually type names are kinda long, so it induces cognitive load for no reason

#

if you're reviewing PR you're reviewing a logic of the code, not the types

#

that's the job of the compiler to review your types

eternal night
#

Like, I look at code I haven#t read in a year. I see a var and something calls .iterator on it

#

the method is call fetchResults

#

is that a list? can i index by int

#

a set? should I worry about duplicates or not?

mortal hare
#

if you use var you should name it accordingly

#

playerList

eternal night
#

somethingList is terrible

nova notch
#

why use var when you can press 2 keys and autocomplete it

eternal night
#

like, you just made it worse

#

now the type is just encoded in the variable name

#

but you also have var

wet breach
carmine mica
#

for long type names, I really just want type aliases. especially for long generics

eternal night
#

I fuck with var for some super complex generics

#

Yea. type aliases would be nice

mortal hare
#

but at the same time if you're method is long, isnt that a problem overall

carmine mica
#

a super easy way to give a name to a generic type with specific params would be very handy

mortal hare
#

if your method and class is short and concise you will see what var is being declared to

eternal oxide
#

or you could not use var and see instantly what it is

eternal night
#

Not the biggest fan of splitting methods just for the sake of keeping it so short I can use var

wet breach
#

only time I don't mind the usage of var is if its in some small method

mortal hare
eternal night
#

I don't think so

#

I can have complex logic that is a single logical step/operation

mortal hare
#

if its complex enough, its unreadable either way

#

if you add a type or not

eternal night
#

Well, but var like does make it even worse KEKW

#

I am with frost on that end, if it is a dumb small method doing a single assignment or whatever

#

sure

#

but overusing it in code becomes annoying quickly for anything that isn't the developer in the current moment

#

but like, if that isn't the case for you, go for it lol. I can 100% see how it has its upsides

mortal hare
#

my general rule is that if you method doesnt fit in like 32 lines of code (or when its too big to understand properly), its too long

nova notch
#

bro what

wet breach
#

o.O

#

I just don't like looking in a class that has var all over the place and having to constantly scroll to figure out what is what lmao

eternal night
#

that sounds like you just read that "Clean Code" book or whatever and are now part of the cult

mortal hare
nova notch
#

this guy is coding with minecraft max stack sizes

eternal night
#

"contextual syntax"

mortal hare
#

where assignments and declarations themselves present you what the code does

eternal night
#

not a statement

#

assignment and declarations are 66% of everything code can do

#

add comparison and you are done

eternal night
#

Sure 👍

grim hound
dry hazel
#

no

grim hound
#

okay

chrome beacon
#

The sonatype OSS repo is commonly used

#

but that's if your project is open source

grim hound
#

it is

chrome beacon
#

Then go for it

#

Contains steps for how to signup and create a ticket to get your project added

grim hound
#

jira no longer seems to exist

blazing ocean
#

what

#

?jira

undone axleBOT
grim hound
#

all of these link to 5 different ways of publishing and I am no longer sure whether they were supposed to be connected or alternatives

chrome beacon
#

Personally I'd just host my own Reposilite repo

blazing ocean
#

Yep

grim hound
grim hound
chrome beacon
#

It does lead to some useful info

grim hound
#

anyway

#

is this how I'm supposed to initially release it?

#

and then link the credentials to some publish system?

chrome beacon
#

Yeah I can't help you with that part

#

Haven't done it before

blazing ocean
#

publishing to maven central is kind of unnecessary tbh, I've only published to my own and Brawls' repo and it works

chrome beacon
#

Has step by steps for everything

chrome beacon
#

hm? That's just project metadata

grim hound
#

am I supposed to give them a jar?

#

this api uses classes from my much larger plugin, how can I upload them as well?

chrome beacon
#

I don't know what menu you're in

#

but you're normally not supposed to upload the jar directly like that

#

You should let maven/gradle handle it

grim hound
chrome beacon
#

Do you even need to

grim hound
chrome beacon
#

(if it's a gradle project)

blazing ocean
#

should just apply to maven central too I think

chrome beacon
#

The sonatype guide shows how to make a custom task

#

I assume so you don't accidentally run it

#

Also signing and such is more strict on central

grim hound
# chrome beacon Like this

I assume the bottom two are the ones I was supposed to insert into settings.xml during token gen, but what about the upper 3?

chrome beacon
#

So you're using maven?

grim hound
#

nope

#

gradle

chrome beacon
#

Wait which settings.xml then

grim hound
#

manually made those, like I was instructed

#

by the page

#

um

remote swallow
#

I have a feeling you don't use buildsystems much

#

settings.xml is the maven settings file, you need gradle.properties

sleek island
#

how do apis like citizens provide ai to their npcs?

wet breach
sleek island
#

how can i do that?

#

as far as i can see serverplayers dont have goalselectors

wet breach
#

in that case you do pathfinding without the goal

#

you can look into A* pathfinding and similar

#

but you would utilize tasks though

#

and you just need to determine how it is you want them to move around

sleek island
#

ty

young knoll
#

You could also just use another mob type and then tell clients it’s a player

marsh sluice
#

can someone help

#

my server keeps saying in console

#

A fatal error has been detected by the Java Runtime Environment:

SIGSEGV (0xb) at pc=0x00007acd73497726, pid=1, tid=72

JRE version: OpenJDK Runtime Environment Temurin-21.0.5+11 (21.0.5+11) (build 21.0.5+11-LTS)
Java VM: OpenJDK 64-Bit Server VM Temurin-21.0.5+11 (21.0.5+11-LTS, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
Problematic frame:
V [libjvm.so+0xc97726] MethodData::clean_method_data(bool)+0x56

Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /home/container/core.1)

An error report file with more information is saved as:
/home/container/hs_err_pid1.log

If you would like to submit a bug report, please visit:
https://github.com/adoptium/adoptium-support/issues

[error occurred during error reporting (), id 0xb, SIGSEGV (0xb) at pc=0x00007acd73da99a2]
container@pterodactyl~ Server marked as offline...
[prism Daemon]: ---------- Detected server process in a crashed state! ----------

#

then it crashes and rolls back the server a bit

rough ibex
#

what plugins

marsh sluice
#

a lot

#

BasicVanish-1.0.1.jar
10.16 KiB 1 day ago

Broadcast-1.0-SNAPSHOT.jar
5.15 KiB 1 day ago

CauthonMaintenance-1.0.0.jar
5.77 KiB 1 day ago

Chunky-Bukkit-1.4.28.jar
286.28 KiB 1 day ago

ClickVillagers-0.5.1.jar
57.89 KiB about 9 hours ago

CoreProtect-22.4.jar
812.52 KiB 1 day ago

CoreProtectTimeLapse-v1.0.4-all.jar
696.64 KiB 1 day ago

CoreProtectTNT-2.3.1.jar
13.11 KiB 1 day ago

HealCommand-1.0.0.jar
2.98 KiB 1 day ago

instantrestock_2.4.3 (1).jar
1.31 MiB about 7 hours ago

InvSee++.jar
1.36 MiB 1 day ago

killpoints-1.0-SNAPSHOT.jar
30.23 KiB 1 day ago

KillsTracker-1.0-SNAPSHOT.jar
11.89 KiB 1 day ago

KnockbackSync-1.3.2.jar
6.29 MiB 1 day ago

LuckPerms-Velocity-5.4.145.jar
1.41 MiB 1 day ago

luckprefix-modern-2.0.0-BETA+7.jar
23.44 MiB 1 day ago

ModMode-1.0-SNAPSHOT.jar
8.9 KiB 1 day ago

simplefeed-3.1.jar
4.99 KiB 1 day ago

SimplePlayerFreeze-2.2.0.jar
47.69 KiB 1 day ago

SingleMace 1.0-SNAPSHOT.jar
5.46 KiB 1 day ago

Sudo-1.0-SNAPSHOT.jar
5.96 KiB 1 day ago

voicechat-bukkit-2.5.27.jar
1.5 MiB 1 day ago

Pterodactyl® © 2015 - 2025

marsh sluice
ivory sleet
#

tho thats prob hard to make use of

marsh sluice
#

idk what that ia

marsh sluice
#

it happens randomly every few hours

ivory sleet
#

one of ur plugins is trolling you hardcore im afraid

#

but its rly guesswork if u dont know what every single plugin does on a detailed level

marsh sluice
#

all the custom plugins where created by me, could i have accidently done that?

ivory sleet
#

yea sure enough

marsh sluice
#

what piece of code could it have been

#

like what should i look for

ivory sleet
#

likely sth that delegates to unsafe

#

if that makes sense

marsh sluice
#

what can i like search for in the code

#

cause idk what that means

#

im not very experienced

ivory sleet
#

dou know if any of ur code invokes functions that manually manage memory?

marsh sluice
#

i wouldnt say so, i mostly used youtube videos and spigot documentation for the code

#

but

#

all of it worked fine on the test server

#

so idk why its happening on the main server now

#

i did install some new plugins so it could be those

ivory sleet
#

i mean for all i know it could very well be a server software bug when it interacts with a certain plugin

#

idk, these problems are always hard, even if u have a full stacktrace sitting in ur logs

marsh sluice
#

what should i do

ivory sleet
#

update to latest server software, check if ur plugins r causing it, then start checking other plugins

marsh sluice
#

is there a way i can check which plugin is causing it

ivory sleet
#

i mean maybe if u have any errors in ur stacktrace

#

like if the log shows which function throws it

marsh sluice
#

if it crashes again ill copy the entire error code and stuff and ill send it here

ivory sleet
#

sounds good

#

i may be offline but some1 else will help u then ^^

marsh sluice
#

aight

#

thank you

#

@ivory sleet ia it possible someone could be messing with the server

#

like using a hack to crash it

ivory sleet
#

eh, na

#

i mean maybe, but a very slim chance

wet breach
#

more specifically you would need to have a network capture at the same time you have a profile capture

sleek island
#

what do i listen for?

rancid mauve
#

Is there a way to get all the persistent data on an ItemStack?

sullen marlin
#

?jd-s

undone axleBOT
sullen marlin
rancid mauve
#

Gotcha, so no

sullen marlin
#

Wdym no

#

I just gave you the answer

rancid mauve
#

Well the only way to access it is with the key and type, and the only method for getting all the data is just the keys

#

🤔

#

Unless I missed something, which is possible it is 2:30 am

rancid mauve
# summer scroll Loop the type too maybe?

I've thought about that but it seems kind of hacky, if I had to go that route, for efficiency, I would just start implementing the major plugins that use custom data. Just thought there would be a method to get the keys and type...

summer scroll
#

I don’t think there is a method to get the type yeah

placid hare
#

lowkey ik im new but does anyone know how how I might go about developing a plugin for beta 1.7.3, I know how to program in java I just don't know wtf I need for that lol

#

any help is appreciated ty

rancid mauve
#

wasn't beta 1.7.3 still hMod days?

placid hare
#

i have no idea lmao

#

i think there is a version of bukkit, but idk how to get the dev tools etc

rancid mauve
#

I would just find the jar for it and import that

placid hare
#

ah ok thank you

#

thats actually super helpful because I do actually have that

quaint mantle
#

Is there any reason that a conversation would be receiving null as an input immediaitly after starting the cnvo?

worthy yarrow
undone axleBOT
rancid mauve
grim hound
quaint mantle
viral halo
#

how to get an entity by entity id. the int entity id not uuid

chrome beacon
#

probably an nms method for that

viral halo
#

is it craft or server

chrome beacon
#

server

viral halo
#

ServerEntity?

sullen marlin
#

seems like an xy

chrome beacon
#

Assuming it's NPCs again

viral halo
#

im trying to get the entity click event

blazing ocean
#

just do your own tracking

viral halo
#

well i cant get a Entity object when getting the packet

#

all i got is a entity id

upper hazel
#

I was hoping that if I read the code of a 10 year old project I could replicate it, but I've never been so deeply wrong.

#

this so hard

lean pumice
lean pumice
viral halo
#

im using protocollib

chrome beacon
#

You know what id your npc had when you spawned it

#

Store it somewhere

viral halo
#

i have the id i just need to turn it back to entity object

chrome beacon
#

Does it have one?

viral halo
#

it have but

#

now im trying to get the packet when a player use entity

#

[4113662, net.minecraft.network.protocol.game.ServerboundInteractPacket$1@77c430a7, false]
this is the packet i got

#

the first number is the entity id

chrome beacon
#

You can just track what npc id belongs to your npc entity

viral halo
#

now i want to get the Entity object so i can do something

#

this is the data i stored

chrome beacon
#

If the entity is spawned in a way that the server knows about it then you can use the servers lookup

#

if not keep your own

lean pumice
# viral halo this is the data i stored
public Entity getEntityById(int entityID) {
    return Bukkit.getWorlds().stream()
            .flatMap(world -> world.getEntities().stream())
            .filter(entity -> entity.getEntityId() == entityID)
            .findFirst()
            .orElse(null);
}

I have do it now, but this can work if you want get Entity by entityID

chrome beacon
#

💀 That's going to be quite slow

#

Just track it

lean pumice
chrome beacon
#

You do not need to filter every entity in the world multiple times per tick

viral halo
#

Asynchronous Chunk getEntities call!

lean pumice
#

...

viral halo
#

should i do it in a runnable

chrome beacon
#

No you shouldn't be using that

lean pumice
#

you have store in a map the entity when you spawn it

#

and when the server stop you delete the entity

#

and when the server start you spawn it and restore the new entityid

#

@viral halo

viral halo
#

nice idea

#

but do i have to make a new entityid everytime?

lean pumice
viral halo
#

why not

lean pumice
#

just do a random

blazing ocean
#

just track this yourself

chrome beacon
#

entity ids are not persistent

#

only their uuids are

#

Also ideally you'd claim an id for your entity so something else doesn't use it

#

but you could just put a very large value and hope that many entities aren't spawned between restarts

viral halo
#

i have another question, im making npc and use spawn entity packet to spawn it. isnt the npc is just a fake player only appear in client and does not show in server?

blazing ocean
chrome beacon
#

not sure if it allows that

#

but you can give it a try

lean pumice
blazing ocean
#

But then again you could also just use citizens and be happy

chrome beacon
#

^

viral halo
echo basalt
#

you can reuse entity ids yeah

viral halo
#

i made the id random on 7digit

echo basalt
#

client doesn't track ids because it'd be a huge memo leak

blazing ocean
#

yeah, they can just be negatives

lean pumice
blazing ocean
#

wait is the eid a varint or u32 or sth

chrome beacon
echo basalt
#

dunno why we communicate the entity UUID to the client either

sullen marlin
#

They start again every time the server restarts

echo basalt
#

I usually just pick a number starting from like 100k

blazing ocean
#

if you wanna be extra sure, -100k

viral halo
#

i read my code again and found out the entityId doesnt store in a Entity object

lean pumice
#

?paste

undone axleBOT
viral halo
#

if im making a map to track it is that mean i have to track the entityId also?

lean pumice
#

send here the code ^

viral halo
#

which part

lean pumice
viral halo
#

oh wait

#

the entity is not exist on the server

#

so i cant get the entity object

lean pumice
lean pumice
echo basalt
#

npc ecs :)

viral halo
#

since the npc is not exist on server theres no point to get the entity object anymore

#

but i encounter another problem

lean pumice
viral halo
#

when im listening the use entity packet, left click will receive 1 packet but right click will receive 4 packet

#

and it will run the code for 4 time if player right click

lean pumice
#

ehm...., idk

#

you have 4x click in the mause?? xd

viral halo
#

im pretty sure i click it one time

lean pumice
eternal oxide
#

?paste show code

undone axleBOT
lean pumice
viral halo
#

in the NPCClickListener class

buoyant viper
#

could be a polling issue

#

i feel like right clicking is /faster/ in mc for some reason

viral halo
#

but it always 4 packet

#
[18:24:52 INFO]: [4113662, net.minecraft.network.protocol.game.ServerboundInteractPacket$InteractionAtLocationAction@4d6531d3, false]
[18:24:52 INFO]: [4113662, net.minecraft.network.protocol.game.ServerboundInteractPacket$InteractionAction@772b1f36, false]
[18:24:52 INFO]: [4113662, net.minecraft.network.protocol.game.ServerboundInteractPacket$InteractionAtLocationAction@32789215, false]
[18:24:52 INFO]: [4113662, net.minecraft.network.protocol.game.ServerboundInteractPacket$InteractionAction@55280ed9, false]
#

those 4 packet

eternal oxide
#

seems fine to me

viral halo
#

instead of prevent it

eternal oxide
#

although I generally use a standard listener

viral halo
#

how can i make it detect

#

1=left 4=right

eternal oxide
#

I've not listened to packets for NPCs so can;t tell you which packets do come in, but from those packet ids it looks to be two actions

blazing ocean
#

Does the BlockBreakEvent get called for removing blocks using (FA)WE?

quasi gulch
#

Is there a way to increase speed of Phantoms. I tried Attribute movement speed and fly speed but both dont change their speed.

blazing ocean
#

why would you wanna do that to your players

quasi gulch
#

torture

buoyant viper
#

Real

smoky oak
#

when running a server in debug mode from your IDE, is it possible to tell it to run a function, or does it need to be wrapped into commands?

blazing ocean
#

you would need to set a breakpoint

#

then you can evaluate

smoky oak
#

commands it is

blazing ocean
#

what

#

I just told you how to

smoky oak
#

well the thing is that i dont want evaluation, i want to run functions on the server

#

evaluation can only read

blazing ocean
quasi gulch
eternal oxide
#

Do you not want players on your server?

smoky oak
#

working on a library for that atm but nothing concrete, sry

#

my approach is to chain vectors and cache the locations that vector hits, then spawn particles at those locations

brazen obsidian
#

hi whats the difference between creating a new java thread vs calling Bukkit.getScheduler().runTaskAsynchronously()?

smoky oak
#

according to the forum scheduler uses a threadpool and therefore is easier to create for the server

brazen obsidian
#

alright

warm mica
brazen obsidian
#

its a permanent task

smoky oak
#

side note, according to a different forum thread, Schedulers are dealt with by the server on shutdown, but im not too sure how relevant thats for you

brazen obsidian
#

basically, what i am doing is i am running a binary program (with java Process) when there are no players on the server and that programs runs until shutdown

rough drift
#

just don't call waitFor on the process builder and just ask the process to shutdown once onDisabled is called

brazen obsidian
#

wait does processBuilder.start(); create a thread automatically?

brazen obsidian
rough drift
#

it just creates a different process

#

and won't block the current thread unless you call .waitFor()

brazen obsidian
#

okay i see

autumn olive
#

does anyone know if I can use protocollib 5.0.0 to change the skin of a player who entered from a non-premium launcher?

rough drift
#

Check how SkinsRestorer does it

sage hare
#

if i want to make a 1.8.9 plugin i need buildtools, but when i set buildtools up should i download thbe latest version of buildtools? will the latest version work wih 1.8.9

chrome beacon
#

yes

#

also buildtools isn't required to make plugins. You can use the maven/gradle api dependency

#

(or just grab the api jar)

sage hare
#

okay thanks

#

!ss

#

?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

sage hare
chrome beacon
#

1.8.8

sage hare
#

thanks

#

so exacly does buildtools work with the plugin? it created a folder with a new BuildTools.jar file but how do i use buildtools in a plugin?

chrome beacon
#

You add the maven or gradle dependency

#

?maven

undone axleBOT
chrome beacon
#

?gradle

#

oh well maven command only

sage hare
#

okay thanks
So right now this is what my pom.xml looks like
` <dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.21.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>``

so what should it be insted?

and when im trying to create a plugin i can choose below 1.18 or something so should i edit the pom.xml to make a 1.8.8 plugin or should i do something else insted?

chrome beacon
#

replace 1.21.4 with 1.8.8

#

and remove api-version for your plugin.yml if it is set

remote swallow
#

(or set it to 1.13)

sage hare
#

okay thanks alot, only issue right now is that 1.8.8-R0.1-SNAPSHOT is red, is there anything else in the dependency i should remove

remote swallow
#

reload maven

sage hare
#

thanks

#

uhmm... do you know why it has problems with extends JavaPlugin?
import org.bukkit.plugin.java.JavaPlugin;

public final class Main extends JavaPlugin {

sage hare
eternal oxide
#

you don't need to remove the api-version, it will be ignored in versions before 1.13

#

So if you are writing against 1.8 just set teh version to 1.13 and it will work on every version... so long as there are no breaking API changes

chrome beacon
#

While you don't need to I recommended doing so otherwise the plugin will only work on versions < 1.13 or 1.21.4

#

(assuming that's the version set)

eternal oxide
#

if he sets it to 1.13 it will run on all versions, and no nag warning on newer versions

chrome beacon
#

also true but you will have the compat features for old versions disabled

eternal oxide
#

yep

sage hare
#

so what would be the best to do?

#

somehow it cant find bukkit, (org.bukkit) so it cant load javaplugin

eternal oxide
#

?paste your pom

undone axleBOT
eternal oxide
#

java 21 but targeting MC 1.8.8?

#

what is the lowest MC version you want to run on?

sage hare
#

im nly going to run on 1.8.9

eternal oxide
#

then set java 8

sage hare
#

but i have downloaded java 8 like an hour ago

eternal oxide
#

your pom says it wants java 21

sage hare
#

alr thanks

#

do i need to change all these things every time i make a new plugin?

#

?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

eternal oxide
#

depends what you want it to run on

sage hare
eternal oxide
#

What IDE are you using?

sage hare
#

intellij

#

newest version

eternal oxide
#

did you click the refresh icon in teh Maven tab?

sage hare
#

Yup, i already did that and it has refreshed

#

right after he refreshed it didnt give and error but 10 seconds after it was done refreshing i got red againb

eternal oxide
#

clear caches and restart

#

in teh "file" menu I think

sage hare
#

alr

#

it works now

#

thanks

smoky oak
#

wish we had a file.toString
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));

loud goblet
slender elbow
#

but like yeah if you go and show the most contrived example things are gonna look obtuse

sage hare
#

how do i make a file where i can write the permission and use it in the plugin so when you update the permission it also updates ingame with the new permission

smoky oak
slender elbow
#

file toPath()

smoky oak
#

ok wtf

slender elbow
#

lol

slender elbow
#

I guess it doesn't like the missing braces?

smoky oak
#

it does not

slender elbow
#

I mean the compiler won't either so lmao

smoky oak
#

its now saying that i should log better

chrome beacon
#

?configs

undone axleBOT
sage hare
smoky oak
#

unrelated, but can i pause as i would with a breakpoint without having a breapoint set? theres some things i need to test but i dont want to make a command specifically for that

#

aka unit test

chrome beacon
#

hm?

#

You have to get the code running to pause it

smoky oak
#

i have a parser method and want to check it withouthaving to add other possibly erronious code

#

well my idea was run the server pause it and run it from console

#

coz its public static

chrome beacon
#

ig that would work

smoky oak
#

well crap

chrome beacon
#

Just breakpoint something

smoky oak
#

yeah i guess

#

siiiiiiigh

sage hare
# chrome beacon You mean just a config value?

There is one thing i dont understand.
How is it being saved, im a bit confused abut what it says, should i save it every time or after i add something to it or something?

And if i want to add a value to the config to the file can i do that with a line or do i need to do that manual?
And when i have done something with the config should i save it every time after?

grim hound
#

what the hell

shadow night
#

what

smoky oak
grim hound
#

and intellij well

grim hound
#

also the shadowJars do not include my very own source code

#

tbh I'm not sure which shadowJar is even the correct one

sage hare
smoky oak
#

onDisable is good

sage hare
# smoky oak onDisable is good

yeah but like, is it the only place where i should save? im just curious since they dont wrinte it in the config toturial

crimson quiver
#

where can i download the 1.21 spigot?

smoky oak
#

well, my recommendation is to immediately save. ondisable can interfere with administrators trying to edit it

smoky oak
sleek island
#

how do i listen for packets from specific entities?

crimson quiver
smoky oak
#

exe runs jar internally

#

if windows use exe

#

the ui helps a lot

crimson quiver
#

so if i want it to install it in my server i need .jar?

smoky oak
#

install?

#

spigot is an api and the server

#

you dont install it onto one

crimson quiver
#

how do i make a regular vanilla server a spigot server then/

smoky oak
#

buildtools creates a server jar

short drift
sleek island
#

how do i listen for packets from specific entities?

smoky oak
#

protocollib might have what you need

worthy garden
#

I have to create a code that doesn't make me hungry and doesn't make me take damage, how do I do it?

sleek island
short drift
worthy garden
#

how?

smoky oak
#

i was saying that lib coz i remember it being written to not have to use nms, i dont actually know how to interface with it properly

sleek island
#

oh

worthy garden
sleek island
#

yes

smoky oak
strange relic
worthy garden
#

thx

short drift
crimson quiver
#

i got this error

worthy garden
#

like this?

sleek island
#

@EventHandler
public void onHurt(EntityDamageEvent e) {

worthy garden
#

`package me.machetifumi.czhub.listeners;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;

public class PlayerEventListener implements Listener {

@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
    if (event.getEntity() instanceof Player) {
        Player player = (Player) event.getEntity();
        
        event.setCancelled(true);
        
        if (event.getCause() == DamageCause.STARVATION) {
            event.setCancelled(true);
        }
    }
}

}`

strange relic
sleek island
#

yeah like that

short drift
worthy garden
#

tanks bro

short drift
#

I guess I need to update my project.

#

Thank you @strange relicI'll try that out.

strange relic
#

Target java 21 then...

crimson quiver
sleek island
#

update java bro

#

to at least j21

crimson quiver
#

didn't fixed it

#

something with override or something

sage hare
#

?paste

undone axleBOT
crimson quiver
#

fixed

sage hare
sleek island
chrome beacon
#

It got shutdown

#

Pages have been merged in to minecraft wiki though

short drift
crimson quiver
#

now i get this error

sage hare
chrome beacon
crimson quiver
#

this is the only thing i get in my screen

chrome beacon
#

?paste

undone axleBOT
crimson quiver
#

it says something the wrong java but i have java 21

chrome beacon
crimson quiver
#

it says jre 8 but i have 21

#

now reinstalling java 21

remote swallow
#

On the options tab at the bottom right override the java it's using

sage hare
crimson quiver
#

keep getting the error

#

this is in my option tab

sleek island
chrome beacon
#

also is that a 32bit Java 8 install 💀

sage hare
chrome beacon
#

Config needs to be saved after you've modified it with code

sage hare
#

but where do i do that?

#

is it onDisable?

#

or anytime i use something from it or what?

chrome beacon
#

You save it when you want it to be saved

#

In the code you've sent you don't need to save anything

#

because you haven't made any changes

sage hare
#

and what exactly is a change? is it when i use a value from the file should i save after that?

#

or is it only when i add something to it?

#

and should the file be saved in onDisable?

chrome beacon
#

When you add or set a value

sage hare
#

oh okay thanks

#

but what about ondisable?

chrome beacon
#

Save it when you're done adding to it

sage hare
#

okay thanks

sage hare
# chrome beacon Save it when you're done adding to it

do you know why i cant add anything to the config from the main class? when im trying to use getPermissionConfig i just cant then im getting this:

public File getPermissionsConfigFile() { return permissionsConfigFile; }

and if i dont tab it its just red

crimson quiver
#

it keeps giving me the same error

sleek island
crimson quiver
#

i installed java 21 and it only detect 8

undone axleBOT
chrome beacon
#

Also I suggest you start a bit with Java before using Spigot

chrome beacon
smoky oak
#

hey guys i asked chatgpt a java question and it took over three minutes to answer
java's shit to code in even for AI apparantly lol

sage hare
#

Why cant i run my plugin? the green play button is grey

#

?img