#help-development

1 messages · Page 498 of 1

tender shard
#

Maven is obviously better than gradle

young knoll
#

I don’t think my build files have ever broken

tender shard
#

Gradle is a funny experiment

tender shard
#

Gradle even complains about „deprecated features“ about a build file it itself created one minute ago

#

Gradle is a fucking joke lol

#

Nobody was ever supposed to use it

#

everyone can test it out yourself, just do this:

#

gradle init (in any folder, complete the steps)

#

then gradle build

#

it's gonna complain about itself

#

gradle be like "er hmmmm I just created this file 20 seconds ago. but erm... not sure.... might be broken tomorrow. not sure yet (shrug)"

kind hatch
#

Select the middle square.

#

What's the image dimensions?

#

Probably at least the size of your monitor. It covers the whole IDE with the image.

#

Ehhh, I don't really do DMs

rough ibex
#

Owch, denied

#

haha

tender shard
#

I just cloned a repo that's using gradle. brb, I'll only have a smoke, take a shit, and go to rehab again, I'll be here again 2 weeks. Maybe gradle's done then

kind hatch
#

Alex, you need anger management at this point

tender shard
kind hatch
#

You could try using this one. It's a little over 2K in resolution.

oak notch
#

can I implement InventoryHolder or is that still deprecated?

tender shard
#

wdym

young knoll
#

It’s not supported

#

But you can do it

tender shard
#

while you can, in theory, do it, you shouldn't. what's the purpose, anyway?

young knoll
#

People use it to identify their custom inventories

tender shard
#

yeah ik, I even do that myself in old plugins

#

but one day, choco told me "DON'T TO IT" lol

kind hatch
#

Smh, people out here not realizing they can just do instance comparisons on their inventories.

tender shard
#

tbh, how are people supposed to know that?

kind hatch
#

Yea, I guess that's fair.

#

Perhaps the wiki should be updated.

quaint mantle
#

anyone got an idea why my server suddenly doesnt recognize my plugin? ive done it a hundret times made the plugin yml main class everything but it doesnt work

#

what are other possible reason

#

s

tender shard
#

yes

#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

vocal cloud
#

Send logs

quaint mantle
#

as i said. my server doesnt recognize it. there is no logs nothing.

#

it just completly ignores it

vocal cloud
#

Is this a local server?

undone axleBOT
river oracle
#

Is there any nice nosql databases like sqlite I pretty much don't want to have to go through the pain of mapping nosql patterns to sql

vocal cloud
#

Mongo?

river oracle
quaint mantle
#

or wait actually i did find something but its on the top before all other plugins begin to load

young knoll
#

Isn’t like

#

Json basically mongo but serverless

river oracle
#

Kind of but also quering json would just be wild

quaint mantle
river oracle
#

I thought slapping together some random json query thing would be hacky as fuck

quaint mantle
#

wait does it not ignore case for the main class?

#

if so im just stuipid

river oracle
#

No it's case sensitive

quaint mantle
#

ok then i know whats wrong

vocal cloud
quaint mantle
#

?paste

undone axleBOT
quaint mantle
#

how can this possibly fail

#

its 2 lines

kind hatch
#

Either one of those objects could be null.

quaint mantle
#

?paste

undone axleBOT
tender shard
#

also use proper class names pls

quaint mantle
#

this is the base it is refeering to

tender shard
#

I repeat my question

#

which one is line 22?

quaint mantle
tender shard
#

either "p" is null, or "gui" is null, or "gui.getventory()" is null

quaint mantle
#

nvm i found it

#

i forgor to remove sometihn g

tender shard
#

what was the problem?

quaint mantle
#

this thing at the very end

tender shard
#

ah yes lol

quaint mantle
#

x)

flint carbon
#

can you use the constructor of the main class?

#
    private val configManager: ConfigManager,
    private val tableManager: TableManager,
    private val hikariCP: HikariCP
) : JavaPlugin() {```
#

and should i be using stuff like HIkariCP(this) or give it a variable? (for dependency injection)

quaint mantle
#

what is that?

young knoll
#

Kotlin moment

quaint mantle
#

why do you use that?

hazy parrot
#

Just handle everything in onEnable lol

flint carbon
#

i have come to my senses

oak notch
#

is there a website that lists changes between paper api and spigot api?

#

or maybe even a list like "this was now added to spigot api"?

flint carbon
tender shard
#

for paper however, no clue

#

I am banned there

#

lmao

oak notch
#

how did you get banned on paper lol

tender shard
oak notch
tender shard
# oak notch yes sure, but what exactly?

I was in a phase of drinking. I had some discussions with staff, IIRC. I didn't say anything bad. But then I sent the following song, and somehow staff considered this "fat shaming": https://soundcloud.com/le-crochet/fucking-a-fat-girl-burning-testicles?utm_source=clipboard&utm_medium=text&utm_campaign=social_sharing

they ignored the fact that every eminem song is like "yo you didnt pay enough for the drugs you bought from me, I will now shoot you!!!!!" yeah idk people are weird sometimes. The song isn't even about fat shaming, btw.

Hängst du schon am Haken? Knusprig Paniert und JEFF & Jefferson ergeben zusammen: Le Crochet!

▶ Play video
#

but discussing my paper ban is not sth we should do here

flint carbon
#

wait nevermind i read it wrong

tender shard
#

what does that mean

flint carbon
#

it just shows where the clicks come from

tender shard
#

oh, idk. that's not my fault

#

it 's from sundcloud

tender shard
oak notch
tender shard
#

¯_(ツ)_/¯

oak notch
#

every rap song has much "worse" lyrics

tender shard
#

I kow. I did appeal my ban once, but nobody ever answered

oak notch
#

lmao

#

is it normal that EVERY spigotmc method is deprecated in paper?

vocal cloud
#

Yes

young knoll
#

This is why we stick with spigot api for spigot plugins

wise mesa
#

how can i get a quat from an euler angle in joml

sullen marlin
#

new Quat().something(eulerangle) iirc

#

rotateXYZ

sinful elm
#

Hi! Having trouble while trying to put NMS on my spigot plugin. I removed the - api in the pom.xml file but nothing changed (I didn't even get an error...). I'm on intellij idea and I used an idea plugin to create the project. Any idea about how to fix it? (sorry if my English sucks)

young knoll
#

Have you run buildtools

sinful elm
#

The plugin just build everything and I don't get any dependency errors (at least for the spigot api) so I think it did

remote swallow
#

if you havent directly ran it you most likely havent

undone axleBOT
sinful elm
#

Then should I recreate a plugin manually?

remote swallow
#

no you can still use that you just need to run buildtools once

sinful elm
#

OK thx will try it tomorrow

sharp bough
#

how could i check if an item is stackable, like ender pearls, arrows, end crystals, etc? this is for a set amount gui, but the item to change amount is unknow, i check if item.material is block or item.material is edible but i want to allow other stackable items

young knoll
#

Material#getMaxStackSize

quaint mantle
#

I'm trying to register an event that triggers whenever somebody eats a specific food item with a name

#

whenever I eat the item in-game is doesn't do anything

sullen marlin
#

did you register it

#

did you debug it

quaint mantle
sullen marlin
#

print the display name and compare it to Enchanted.format result

quaint mantle
#

oh

#

i'm stupid

sullen marlin
#

System.out

quaint mantle
#

k

#

it was a typo

#

works now

#

ty for the help

quaint mantle
#

why does this return unknown server

eternal oxide
#

lol don;t show too much code

river oracle
#

I do believe that the server is unkown

#

maybe the poor server forgot

eternal oxide
#

I believe you may have got the answer there chap

young knoll
#

Just substring from index 2

river oracle
young knoll
#

Then you’ll have a known server

quaint mantle
river oracle
#

he was joking :P

quaint mantle
#

no clue what that means

#

lol

#

so

river oracle
#

all that does it cut off UN of UNKOWN SERVER

#

so it would then be KNOWN SERVER

quaint mantle
#

oh

opal saffron
#

probably

quaint mantle
#

you were right thx

#

xd

river oracle
young knoll
#

Huh

#

I didn’t even know that was a setting

kind hatch
#

I completely forgot about it.

eternal oxide
#

The substring went straight over my head. 3 in the morning.

regal scaffold
#

I know that scoreboard teams are the ones that manage the colors for glowing effects

#

But I'm having issues with other plugins affecting my plugins glow colors because of it

#

What's a possible workaround/

late pumice
#

Hey, is there a way to use the Player Command packet through ProtocolLib, or will I have to use NMS for that?

vocal cloud
#

Why would you want to use the packet?

late pumice
#

I want to run something when a player sends the Leave Bed packet, which is contained in Player Command. I want the packet instead of the method because I need it to be when they specifically click the leave bed button

vocal cloud
#

Use the bed leave event?

#

Then send a command when it happens?

late pumice
#

I'm not sure I follow, what do you mean?

vocal cloud
#

Why packets over the API?

#

Why would you use the packet for leaving a bed over the spigot event?

late pumice
#

Its because I want specifically when and only when the use the Leave Bed button, instead of being forced out by the server. The event method does not let me do that.

vocal cloud
#

Does the time change before or after they exit?

late pumice
#

Before I believe

#

Even though it seems like after on the client

#

I could be wrong though

#

I'll go a bit more in depth with what my goal is. I'm trying to make it so that players can sleep during the day, so I need to edit how the bed leave event works, basically setting it to always be cancelled unless they use the Bed Leave button to leave it.

vocal cloud
#

By "sleep during the day" I assume you mean sleep through the day?

late pumice
#

no

#

just sleep during the day

vocal cloud
#

Do you want it so that sleeping during the night still passes the night?

late pumice
#

Yes

#

I do have the Harbor plugin installed, which changes how sleeping through the night works, but I do not believe this changes that much with my goal.

warm mica
#

There you go, there's your solution vis packets

wise mesa
#

what does that do?

#

sorry idk what to say that dosen't sounds aggressive

#

not trying to

warm mica
#

aggressive?

#

LOL

warm mica
wise mesa
#

anyways how does that solve their problem?

#

they want to detect when someone clicks the leave bed button

#

not make the player leave the bed

warm mica
#

I guess that he simply wants to simulate a day and night schedule using schedulers

late pumice
#

Essentially, I'm trying to cancel the BedLeave event unless it is caused by the player clicking the bed leave button, which is why I need the packet.

vocal cloud
#

Looks like the API needs an update imo

#

To include a boolean for Leave Bed being pressed

late pumice
#

yeah maybe

warm mica
late pumice
#

interesting, did not know that was a thing

#

ah its paper only it seems

warm mica
late pumice
#

that is true

brave sparrow
#

It does if they don’t want to use paper like a lot of people lol

warm mica
late pumice
#

i do use paper as of now, but my main concern is if i switch to something else later on

brave sparrow
warm mica
late pumice
#

lol true

vocal cloud
#

I see, the issue lies in the lack of check/care on the server side for if it was the server or client waking up the player

late pumice
#

yeah that does seem to be the root issue of this

vocal cloud
late pumice
#

those variable names hurt to look at

wise mesa
#

obfuscated

late pumice
#

yeah, but my statement still stands

wise mesa
#

specifically searge mappings i believe

#

of course

late pumice
#

hmm

#

oh i dont believe the deep sleep check will help me, since when it is day the player is immediately kicked out of the bed

#

I'll still give it a try tho

brave sparrow
#

Just check if they send a stop sleep packet

#

If they do, let them leave

#

Otherwise, keep them in the bed

vocal cloud
#

Yeah, for now that's the only solution

wise mesa
#

and now we're back to the original question

brave sparrow
#

I’ll check and see if I can find it for you

late pumice
#

Much appreciated

brave sparrow
#

I think it may be CLIENT_COMMAND @late pumice

late pumice
#

client command is a separate thing from player command according to the protocol page

#

and when experimenting on my own i did try client command, it didnt work

#

it just seems as if the ProtocolLib devs just didnt import player command

brave sparrow
#

Well that’s annoying

#

Damn it Dan

vocal cloud
#

Time to open a spigot issue on it

brave sparrow
#

Not really a spigot problem

#

It’s a plugin problem

vocal cloud
#

Well the lack of ability to discern between a player cancelling or the server cancelling something would be something of somewhat importance

late pumice
harsh totem
#

I am trying to make players receive many hits from lava so that it would almost instantly kill them but somehow they just get hit like normally instead of being hit like 20 times a second. What am I doing wrong here?

    public void inLava(EntityDamageEvent event)
    {
        if (event.getEntity() instanceof Player && event.getCause().equals(EntityDamageEvent.DamageCause.LAVA))
        {
            Player player = (Player) event.getEntity();
            player.setNoDamageTicks(0);
        }
    }```
eternal oxide
#

Event hasn't finished yet so no damage is not yet set

harsh totem
#

wdym?

eternal oxide
#

you are calling player.setNoDamageTicks(0); in teh event, but the event has not finished so it's already at 0 and will be overwritten when the event ends

#

runTask and set it in there

harsh totem
#

thank you

silk mirage
#

I got a question

#

I'm currently building a item like this

 public ItemStack build(String customId) {
        itemStack.setItemMeta(itemMeta);
        NbtWrapper<?> nbt = NbtFactory.fromItemTag(itemStack);
        NbtFactory.setItemTag(itemStack, NbtFactory.asCompound(nbt).put("ct-identifier", customId));
        return itemStack;
    }
#

Using protcolib

#

It results in a Caused by: java.lang.IllegalArgumentException: Stack must be a CraftItemStack.

#

Do I have really need to use reflection to create a new constructor of CraftItemStack?

eternal oxide
#

where is your itemStack variable?

silk mirage
#

private ItemStack itemStack;

eternal oxide
#

you are importing?

#

Minecraft ItemStack?

silk mirage
#
public static ItemStack getCustomItem(String string) {
        CItems a = instance.lookupItem(string);
        if(a == null) return null;
        return ItemStackBuilder.of(a.getMaterial())
                .setDisplayName(a.getDisplayName())
                .setLore(a.getLore())
                .setUnbreakable(a.isUnbreakable())
                .addEnchantment(a.getEnchantments())
                .addItemFlags(a.getItemFlags())
                .build(a.getCustomID());

    }
silk mirage
#

e

eternal oxide
#

so yes minecraft ItemStack

silk mirage
eternal oxide
#

no

#

you need a CraftItemStack from the error

silk mirage
eternal oxide
#

which line is throwing the error?

silk mirage
#
        NbtFactory.setItemTag(itemStack, NbtFactory.asCompound(nbt).put("ct-identifier", customId));

#

This one

#

This one too
NbtWrapper<?> nbt = NbtFactory.fromItemTag(itemStack);

pseudo hazel
#

why do you need nbt exactly?

#

what version are you using

silk mirage
#

1.19

#

but it's cross version

pseudo hazel
#

any reason you cant use pdc?

silk mirage
eternal oxide
#

CraftItemStack.asCraftCopy(ItemStack)

#

or asCraftMirror

silk mirage
#

or whatever it was

#

shh gotta write reflection ig

eternal oxide
#

you could use a real simple util

#

sec

#

as you are not really going down to NMS just CB

silk mirage
#

yes

eternal oxide
#

?paste

undone axleBOT
eternal oxide
silk mirage
#

Alrigt

regal scaffold
#

I need some help understanding this

#

Using ProtocolLib:

ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, PacketType.Play.Server.SCOREBOARD_TEAM) {}

To listen to the packet

#
                    final PacketContainer packet = event.getPacket();

This contains the packet data. What layer does it actually contain from the wiki link

#

Like, the wiki link has field names and types. How does this actually work

topaz atlas
#

ItemStack leggings = new ItemStack(Material.LEATHER_BOOTS)

#

"ItemStack cannot be resolved to a type"

#

There is no import option

#

that comes up in the error prompt

#

for the class

vocal cloud
#

you've got spigot as a dependency?

topaz atlas
vocal cloud
#

Have you tried restarting the IDE? I find that works sometimes

topaz atlas
#

Oh

topaz atlas
#

?paste

undone axleBOT
topaz atlas
vocal cloud
#

I don't know enough eclipse to help

remote swallow
#

im guessing that isnt in a method

regal scaffold
eternal oxide
topaz atlas
eternal oxide
#

probably importing the wrong thing

remote swallow
#

?paste the class

undone axleBOT
topaz atlas
remote swallow
#

its in a method but you dont have an import for it

topaz atlas
eternal oxide
#

press CTRL+SHIFT+O

topaz atlas
#

whats the importing directory

topaz atlas
regal scaffold
#

Anyone know about packets help my messages above please 😦

topaz atlas
#

Its fixed

silk mirage
#

Is playerinteractevent not intercepted?

topaz atlas
#

I dont really know how to read the wiki

eternal oxide
#

player.getInventory().setHelmet(...

vocal cloud
#

It's searchable

pseudo hazel
#

it needs to say void since its a setter...

topaz atlas
#

How do you add multiple iteoms?

#

it says it only has one argument

topaz atlas
#

like 4 arrows

#

Actually ima check the forums

orchid trout
#

new ItemStack(Material material, int amount)

topaz atlas
#

How do you store a players inventory then re-add all the contents

small timber
#

how can I modify existing vanilla commands? for example take the vanilla fill command and modify so the max area you can set is 20

warm mica
warm mica
quaint mantle
#

how to summon objects like lightning?

#

??

#

?????

#

@everyone

#

@here

vocal cloud
#

yes do that. @ all the users. man some people are so entitled

limber acorn
#

Hey,
what is the best option to create a "custom block"? So the block i want to create should be a barrel or a chest and when u open it, it should trigger something, like "Hello world" in the consol.

green prism
topaz atlas
#

Bukkit.broadcastMessage(e.getEntity().getKiller().getName() + " won the fight against " + e.getEntity().getName());

#

^ this should broadcast right

karmic phoenix
#

Hello, I'm trying to cancel splash potion damage to potion thrower, so basically if you throw a harming potion you don't get damaged, only other players do, and I can't get thing working, any ideas on what methods to use, also It has to be a specific potion, for example if you throw healing potion u get healed, but if you throw harming you dont get harmed only other players do.

#
    @EventHandler
    public void onDmg(EntityDamageByEntityEvent e) {
        if (e.getEntityType() != EntityType.PLAYER) return;
        if (e.getDamager().getType() != EntityType.SPLASH_POTION) return;
        Map<UUID, ThrownPotion> thrownpotion = FFASystem.getMain().getPotions();
        Player p = (Player) e.getEntity();
        if (thrownpotion.containsKey(p.getUniqueId())) {
            if (thrownpotion.get(p.getUniqueId()) == (ThrownPotion) e.getEntity()) {
                e.setCancelled(true);
            }
        }
    }
}
#

any ideas what im doing wrong

topaz atlas
#
      {
         Bukkit.broadcastMessage(e.getEntity().getKiller().getName() + " won the fight against " + e.getEntity().getName());
         if (e.getEntity().getUniqueId().equals(Bukkit.getPlayer(firstPlayer).getUniqueId())) { 
             e.getEntity().getInventory().setContents(playerinv2);
             e.getEntity().getKiller().getInventory().setContents(playerinv);
        } else if (e.getEntity().getUniqueId().equals(Bukkit.getPlayer(SecondPlayer).getUniqueId())){
             e.getEntity().getInventory().setContents(playerinv);
             e.getEntity().getKiller().getInventory().setContents(playerinv2);
        }
     }```
#

The message isnt being broadcast in chat

tardy delta
#

variables bruh

topaz atlas
# tardy delta variables bruh
    private UUID SecondPlayer = null;
    
    private ItemStack[] playerinv = null;
    //private HashMap<Player, ItemStack[]> itemhash = null;
    
    private ItemStack[] playerinv2 = null;```
#

secondPlayer and firstPlayer is defined later onwards

#

it isnt null for long

#

I dotn think

analog thicket
#

ItemStack[] cant be null

tardy delta
#

💀

topaz atlas
analog thicket
#

It has to be a new Arraylist i think

#

Why even have them null at first then

topaz atlas
#

two people clicking on a sign

analog thicket
#

Fair

#

What about the ItemStack list then

topaz atlas
#

Oh wait

topaz atlas
#

that means all the event fcuntions are registered right?

topaz atlas
#

it isnt event outputting a error, i think it aint even running

#

idk

analog thicket
#

Have you registered the event?

topaz atlas
#

Bukkit.getPluginManager().registerEvents(signEvent, this);
SIgn events is the name of the class

#

ima send you my code

#

I got to go to dinner, ill be back

#

I will tidy up my code later

analog thicket
#

dont you need "new signEvent?"

#

getServer().getPluginManager().registerEvents(new BlockPlace(), plugin);

#

Thats how i do it

hazy parrot
#

He already created instance earlier

viscid ginkgo
#

Hate to do this and yes i sorta looked on google, is there a way to write a line inside a .yml?

#

from something being activated

hazy parrot
#

YamlConfiguration#set

viscid ginkgo
remote swallow
#

if rthe key doesnt exist it will

#

if it does it changes the value

viscid ginkgo
#

not 100% what ur saying but sorta am lmao

#

new to java ¯_(ツ)_/¯

#

moved from skript 💀

remote swallow
#

good

viscid ginkgo
#

mm yeah skript was just to easy and also getting out of hand

#

making auctionhouses in skript isnt fun 😭

remote swallow
#

i despise skript

viscid ginkgo
#

lmao

hazy parrot
quaint mantle
tardy delta
#

if its only that

topaz atlas
#

idk whats the issue. no errors

viscid ginkgo
#

im trynna do a bounty plugin.... ¯_(ツ)_/¯

#

learning on the way sorta thing

quaint mantle
viscid ginkgo
#

lmao im not that dumb

#

im more of learning files

#

ik guis, lists, all that

#

i made a public plugin alr

#

which ppl love lmao

remote swallow
#

how do i convice a skript lover to stop loving it and learn java

viscid ginkgo
#

lmfao just say

quaint mantle
#

And do not use yaml as player data

viscid ginkgo
#

skript doesnt work

viscid ginkgo
quaint mantle
viscid ginkgo
#

hgruiaeh

#

im not trynna learn hashmaps 💀

#

atleast not now

quaint mantle
viscid ginkgo
#

igs

remote swallow
viscid ginkgo
#

wanna know something funny

#

i probably know that kid to 💀

remote swallow
#

does his name start with a j and end with a r

viscid ginkgo
#

idfk

remote swallow
#

kekw

viscid ginkgo
#

ik way to many ppl

remote swallow
#

he is the most unoriginal person ive ever met

viscid ginkgo
#

man if u saw my dms ud wanna die

remote swallow
#

literally every server he has ever made is a really shit copy of anotherone

viscid ginkgo
#

own 3 big servers + develop on like 10 big servers lmfao

remote swallow
#

every single servers

topaz atlas
remote swallow
#

theres been like 10

viscid ginkgo
remote swallow
#

server i work for, justbox, lightskies

#

and more

viscid ginkgo
#

justbox lol

quaint mantle
viscid ginkgo
#

i can 100% promise i dont have lightskies files 💀

remote swallow
#

lmfao

viscid ginkgo
#

lmfao

#

i almost hit 400 players on my server a couple days ago

#

anyways off topic

viscid ginkgo
#

so if i wanted to do that

quaint mantle
#

Mh holding most of your traffic thats not good.

viscid ginkgo
#

itd be setting tho

viscid ginkgo
remote swallow
#

minehut is so dog shit now

viscid ginkgo
#

it is

remote swallow
#

literally no one clicks on a random server

viscid ginkgo
#

im creating servers off minehut now

remote swallow
#

like a year ago everyone was

viscid ginkgo
remote swallow
#

yeah

viscid ginkgo
#

just slot ads currently

#

are like #1

#

and patrons

quaint mantle
viscid ginkgo
#

like so

#

if i wanna create a bounty for each player

#

like /bounty player amount

remote swallow
#

the only servers that im on that actually get constant players are ones hosted with an actual host

viscid ginkgo
#

the config is empty

#

what am i setting lmao

quaint mantle
#

Like player has own bounty?

viscid ginkgo
#

300 plan

#

yeah

remote swallow
#

bloom is best

viscid ginkgo
#

frrr

#

i have 2 bloom dedis

#

pay for it ina days earning

#

:sku:

quaint mantle
viscid ginkgo
#

450 or smth

#

yes

viscid ginkgo
#

i was gonna do seperate files for each player

#

but im not that advanced yet

#

like for my spawner plugin i used pdc instead

quaint mantle
viscid ginkgo
#

like make a list?

remote swallow
viscid ginkgo
#

but recently

#

its been dead

#

☠️

remote swallow
#

might be a bit laggy if its 1 file per

viscid ginkgo
remote swallow
#

you could use a yaml file or json for it, yaml is easier to start with

quaint mantle
#

Or json

viscid ginkgo
#

back

viscid ginkgo
#

isnt that hard?

#

only thing thats good about skript is theres more docs 👎

quaint mantle
viscid ginkgo
#

ahhh kill me now

#

im missing skript variables 🥲

tardy delta
#

if you dont even know sql structure why would you use a mapping framework

viscid ginkgo
#

yes

#

ofc

#

any tiome!

#

me to

quaint mantle
mortal hare
#

I remember .csv files back in 2019 when I was into Skript

viscid ginkgo
viscid ginkgo
quaint mantle
#

Oh I thought it stores vars in yaml

viscid ginkgo
#

variables.csv

mortal hare
#

you can store data in yaml files

#

but its mainly blocking the main thread

#

while writing

#

so some addons are needed

#

to fix this afaik

tardy delta
#

talking about MemorySection#set?

#

that doesn't do any saving to disk

topaz atlas
mortal hare
#

that's dumb

#

and some addons were developed to mitigate this issue

#

maybe its fixed rn, idk i havent developed anything for skript in years

#

last thing i developed on skript were snippets for skunity of how to retrieve client's version via ViaVersions API using skript-mirror addon

quaint mantle
mortal hare
topaz atlas
karmic phoenix
#

Hello, I'm trying to cancel splash potion damage to potion thrower, so basically if you throw a harming potion you don't get damaged, only other players do, and I can't get thing working, any ideas on what methods to use, also It has to be a specific potion, for example if you throw healing potion u get healed, but if you throw harming you dont get harmed only other players do.

    @EventHandler
    public void onDmg(EntityDamageByEntityEvent e) {
        if (e.getEntityType() != EntityType.PLAYER) return;
        if (e.getDamager().getType() != EntityType.SPLASH_POTION) return;
        Map<UUID, ThrownPotion> thrownpotion = FFASystem.getMain().getPotions();
        Player p = (Player) e.getEntity();
        if (thrownpotion.containsKey(p.getUniqueId())) {
            if (thrownpotion.get(p.getUniqueId()) == (ThrownPotion) e.getEntity()) {
                e.setCancelled(true);
            }
        }
    }
}

Sorry that I had to reupload this 3 times, it's just really important and I can't seem to figure this out, I really need to fix this ASAP.

tender shard
#

btw you shuold not use == to compare entities

#

but equals()

karmic phoenix
#

It doesn't cancel the event to the potion owner/thrower

tender shard
#

try to use .equals() instead of == for the comparison

brave sparrow
karmic phoenix
#

aight

brave sparrow
#

May be more useful for what you’re trying to do

tender shard
#

you also don't have to save the thrower in a map, you can just use getThrower() or getShooter() or sth like that

karmic phoenix
#

but yet nothing worked

tender shard
#

you haven't made sure it's perfect

#

you use a useless map, you do the comparison wrong, you use bad variable names, ...

karmic phoenix
#

I did not make this one

tender shard
tender shard
#

how?

brave sparrow
#

If they set the intensity for that player to 0 it removes them

tender shard
#

oh yes, you are right

#

I didnt see that one

brave sparrow
#

Yeah I wasn’t positive on how to do it so I checked the source lol

#

I knew there must be a way

karmic phoenix
brave sparrow
#

Check if the potion is harmful, if it is, set the intensity to 0 for the potion’s thrower

karmic phoenix
#

aight thanks mate lemme try this out

brave sparrow
#

And btw you can get the thrower by ThrownPotion#getShooter

#

No need for the map

karmic phoenix
#

Ik thanks

brave sparrow
#

👍

topaz atlas
#

How do you check if a player has a item with a specific name

drowsy helm
#

check item meta

karmic phoenix
# brave sparrow 👍

Hey Alex, I tried doing this and it still didn't work, any ideas?

    @EventHandler
    public void onPot(PotionSplashEvent e) {

        if (e.getPotion().getShooter() == null) return;
        if (e.getPotion().getShooter() instanceof Player) {
            e.getPotion().getEffects().forEach(potionEffect -> {
                if (potionEffect.getType() == PotionEffectType.HARM || potionEffect.getType() == PotionEffectType.POISON) {
                    e.setIntensity((Player) e.getPotion().getShooter(), 0);
                }
            });

        }
    }

}
karmic phoenix
#

wait lemme try

green prism
#

I am serializing ItemStacks within a json file.
Do you recommend that I transform ItemStacks to JSON or use Base64?

chrome beacon
#

I'd go with json

chrome beacon
#

That would just make it a pain to edit

karmic phoenix
green prism
#

No need to edit (?)

chrome beacon
#

Why not use a database then?

#

SQLite for local storage

brave sparrow
karmic phoenix
#
((Player) e.getPotion().getShooter()).sendMessage("0");
green prism
karmic phoenix
#
    @EventHandler
    public void onPot(PotionSplashEvent e) {

        if (e.getPotion().getShooter() == null) return;
        if (e.getPotion().getShooter() instanceof Player) {
            e.getPotion().getEffects().forEach(potionEffect -> {
                if (potionEffect.getType() == PotionEffectType.HARM || potionEffect.getType() == PotionEffectType.POISON) {
                    e.setIntensity((Player) e.getPotion().getShooter(), 0);
                    ((Player) e.getPotion().getShooter()).sendMessage("0");
                }
            });

        }
    }
green prism
chrome beacon
chrome beacon
#

Yeah databases would be better since that's exactly what they were made for

brave sparrow
#

And you have registered this listener right?

chrome beacon
#

And you can have multiple servers

karmic phoenix
#

aight

chrome beacon
#

And sell items between them

chrome beacon
karmic phoenix
green prism
# chrome beacon If they said json they probably want you to store the item as json

Of course, if SQLite were more optimized, it's my duty to ask what they think.
However, I think it can get messy to manage the deadlines of items for sale. After 24h they should expire. With JSON I'm getting comfortable parsing each item, getting TimeStamp and then checking if 24h have passed and introducing them into a Cache Caffeine since the items can be requested multiple times.

The performance of SQLite I assume is worse than working with a Cache<long, JSONObject> of Caffeine

(https://github.com/ben-manes/caffeine)

GitHub

A high performance caching library for Java. Contribute to ben-manes/caffeine development by creating an account on GitHub.

karmic phoenix
#
    @EventHandler
    public void onPot(PotionSplashEvent e) {

        if (e.getPotion().getShooter() == null) return;
        ((Player) e.getPotion().getShooter()).sendMessage("line 26");
        if (e.getPotion().getShooter() instanceof Player) {
            ((Player) e.getPotion().getShooter()).sendMessage("line 28");
            e.getPotion().getEffects().forEach(potionEffect -> {
                ((Player) e.getPotion().getShooter()).sendMessage("line 30");
                if (potionEffect.getType() == PotionEffectType.HARM || potionEffect.getType() == PotionEffectType.POISON) {
                    ((Player) e.getPotion().getShooter()).sendMessage("line 32");
                    e.setIntensity((Player) e.getPotion().getShooter(), 0);
                }
            });

        }
    }

}

it's failing at:

if (potionEffect.getType() == PotionEffectType.HARM || potionEffect.getType() == PotionEffectType.POISON) {
chrome beacon
brave sparrow
#

OH

#

Never mind I remember now

#

You have to compare potion effect types with equals

chrome beacon
#

The problem with JSON is that you have to load the entire thing

brave sparrow
#

It’s not an enum

karmic phoenix
#
if (potionEffect.getType().equals(PotionEffectType.HARM) || potionEffect.getType().equals(PotionEffectType.POISON)) {
#

like this?

#

It worked

green prism
karmic phoenix
#

lemme test if it damages other players

topaz atlas
#

How do you check if a player is dead? Other than events, I have a on death event set a timer, that will respawn the player when the timer runs out, I dotn want to respawn the player if they respawned

karmic phoenix
#

Thank you alex, it works like a charm

topaz atlas
chrome beacon
topaz atlas
#

is it player#isDead

brave sparrow
topaz atlas
#

java.lang.ClassCastException: class org.bukkit.potion.PotionEffectTypeWrapper cannot be cast to class java.util.Map (org.bukkit.potion.PotionEffectTypeWrapper is in unnamed module of loader java.net.URLClassLoader @421faab1; java.util.Map is in module java.base of loader 'bootstrap')

brave sparrow
#

What are you trying to do

topaz atlas
#

One sec

chrome beacon
#

Why are you casting that

brave sparrow
#

I suspect they aren’t intentionally doing it, it’s some library they’re using

chrome beacon
#

Or them using eclipse

#

Which likes to recommend random and non-functioning casts as quick fix

topaz atlas
topaz atlas
#

java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getUniqueId()" because the return value of "org.bukkit.Bukkit.getPlayer(java.util.UUID)" is null

      {
        Player killer = e.getEntity().getKiller();
        Bukkit.getScheduler().runTaskLater(this.instance, () -> {
        if (e.getEntity().isDead()) {
        e.getEntity().spigot().respawn();
        }
        Bukkit.getServer().broadcastMessage(e.getEntity().getKiller().getName() + " won the fight against " + e.getEntity().getName() + " the loser will get their items instantly or in a min");
         if (e.getEntity().getUniqueId().equals(Bukkit.getPlayer(firstPlayer).getUniqueId())) { 
             e.getEntity().getInventory().setContents(playerinv2);
             killer.getInventory().setContents(playerinv);
        } else if (e.getEntity().getUniqueId().equals(Bukkit.getPlayer(SecondPlayer).getUniqueId())){
             e.getEntity().getInventory().setContents(playerinv);
             killer.getInventory().setContents(playerinv2);
        }
        }, 1200);
     }```
A: the broadcast is not working
B: I get that error
fluid river
#

player is null

topaz atlas
#

Oh the broadcast is workking,just to the console

#

Whats the broadcast method to the server?

sullen canyon
#

show the whole error message

eager jacinth
#

Hello, I am currently developing a simple plugin to change names. So, the problem is that when I call the PLAYER_INFO packet (via the method below), the name doesn't change in the sender player list (but it works after a re-login), but it changes in others. How do I fix this? Do I have to send a "trigger" packet myself? If so, what type of packet?

This is my PacketListener:

protocolManager.addPacketListener(new PacketAdapter(this, PacketType.Play.Server.PLAYER_INFO) {
  @Override
  public void onPacketSending(PacketEvent event) {
    PacketContainer packet = event.getPacket();
    if (MinecraftVersion.FEATURE_PREVIEW_UPDATE.atOrAbove() ?
      !packet.getPlayerInfoActions().read(0).contains(EnumWrappers.PlayerInfoAction.ADD_PLAYER) :
       packet.getPlayerInfoAction().read(0) != EnumWrappers.PlayerInfoAction.ADD_PLAYER) return;

       getLogger().info("Packet received! The packet: " + packet);

       int index = MinecraftVersion.FEATURE_PREVIEW_UPDATE.atOrAbove() ? 1 : 0;

       List<PlayerInfoData> playerInfoDataList = packet.getPlayerInfoDataLists().read(index);
       List<PlayerInfoData> newPlayerInfoDataList = new ArrayList<>();

       for (PlayerInfoData playerInfoData : playerInfoDataList) {
         Player player = event.getPlayer().getServer().getPlayer(playerInfoData.getProfile().getUUID());
          if (playerInfoData.getProfile() == null || player == null) {
            newPlayerInfoDataList.add(playerInfoData);
            continue;
          }

          // get name

          // update profile

          // add new profile in newPlayerInfoDataList
       }

       packet.getPlayerInfoDataLists().write(index, newPlayerInfoDataList);
    }
});

And this is the method by which I trigger PLAYER_INFO

for (Player onlinePlayer : Bukkit.getOnlinePlayers) {
  onlinePlayer.hidePlayer(this, player);
  onlinePlayer.showPlayer(this, player);
}
topaz atlas
chrome beacon
topaz atlas
#
        at com.onutillities.SignEvents.lambda$onDeath$2(SignEvents.java:135) ~[onutillities-1.0.jar:?]
        at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.4.jar:git-Paper-519]
        at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[paper-1.19.4.jar:git-Paper-519]
        at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1483) ~[paper-1.19.4.jar:git-Paper-519]
        at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:447) ~[paper-1.19.4.jar:git-Paper-519]
        at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1397) ~[paper-1.19.4.jar:git-Paper-519]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1174) ~[paper-1.19.4.jar:git-Paper-519]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[paper-1.19.4.jar:git-Paper-519]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]```
sullen canyon
#

yea

#

you need to check if the entity killer is not null from first

topaz atlas
#
      {
        Player killer = e.getEntity().getKiller();
        Bukkit.getScheduler().runTaskLater(this.instance, () -> {
        if (e.getEntity().isDead()) {
        e.getEntity().spigot().respawn();
        }
        Bukkit.getServer().broadcastMessage(e.getEntity().getKiller().getName() + " won the fight against " + e.getEntity().getName() + " the loser will get their items instantly or in a min");
         if (e.getEntity().getUniqueId().equals(Bukkit.getPlayer(firstPlayer).getUniqueId())) { 
             e.getEntity().getInventory().setContents(playerinv2);
             killer.getInventory().setContents(playerinv);
        } else if (e.getEntity().getUniqueId().equals(Bukkit.getPlayer(SecondPlayer).getUniqueId())){
             e.getEntity().getInventory().setContents(playerinv);
             killer.getInventory().setContents(playerinv2);
        }
        }, 1200);
     }```
chrome beacon
#

?paste

undone axleBOT
sullen canyon
#

if(entity.getKiller() == null) {
return;
}

chrome beacon
topaz atlas
#

One sec

#

i need to test smthin

slim wigeon
#

Need help with my timber plugin. How can I get this to break logs from the ground to the leaves? I tried to set the do while to !value which froze my server and setting it to value breaks only 2 logs public void timber(Block block) { do { block = block.getRelative(0,1,0); block.breakNaturally(); } while ( logs.contains(block.getType()) ); /* for(int y = 0; y < 10; ++y) { if( logs.contains(block.getRelative(0, y, 0).getType()) ) { block.getRelative(0,y,0).breakNaturally(); } } */ }

chrome beacon
#

That looks like an infinite loop

#

So yes it will crash the server

slim wigeon
#

I know, that is what I got from that. You see the for loop, I did had that at first but I remembered trees can be different sizes

topaz atlas
#

but the killer thing aint logging

#

the event

#

something aint working

#

the evnt is running

#

but killer is coming as null

frail pilot
#

Probably because when you call .getKiller() (during the event), the server does not consider the event achieved so the player is not currently dead

#

It will be

#

So the killer is not set

#

It will be set after the event

remote swallow
#

is it player death event

#

if its player death event getKiller is set in the event

topaz atlas
remote swallow
#

getKiller is always a player

topaz atlas
#

Ima add the instanceof statement

frail pilot
remote swallow
#

yes

topaz atlas
topaz atlas
#

or just a tick after

remote swallow
#

get killer is either gonna be a player or null in the event

eager jacinth
# chrome beacon Remove the player info and add it again

Oh, I get it! So I can do this without the PacketListener? Just check if 'onlinePlayer' is the sender, if so, send removePacket, otherwise just use Player#hidePlayer. And the same with addPacket and Player#showPlayer, right?

frail pilot
#

Otherwise, if you want to listen to "A player kill another player" you can use EntityDamageByEntityEvent

topaz atlas
#

Ima paste that

#

So a minuite afterwards the error occured

chrome beacon
topaz atlas
#

emphasis of deaths

#

not damage

frail pilot
#

You can check if the damage will be > to the entity that receive the damage

topaz atlas
frail pilot
#

Then, the entity will die and the event will have both not null Target and Killer

#

Yep, but you can check if the entity is a player

topaz atlas
frail pilot
#

Yep, you can always get the health of an entity

#

An entity is considered dead is its health is < 0

#

Or <= 0*

eager jacinth
# chrome beacon I meant the remove and add PlayerInfoActions

I get it. But you see, if I just use PLAYER_INFO_REMOVE and then ADD_PLAYER, the name above the sender's head will not be updated. So I use Player#hidePlayer and Player#showPlayer to update the player. I was wondering if there might be some other way to do this (update the player).

topaz atlas
#

in a damage event

#

Also how do I convert a entity object to player

#

can I cast ti?

hazy parrot
#

first check if its actually player

#

and after that cast

#

or just instanceof pattern matching

wet breach
#

since all entities have a UUID, you could do Bukkit.getPlayer(UUID)

topaz atlas
#

Respawn is not a method for the e

#

on the damage event

hazy parrot
wet breach
#

it is generally more appropriate to use methods without casting, but its acceptable to cast as well as long as you do your checks properly

wet breach
hazy parrot
#

why would you iterate over list of online players again just to find player with specific uuid, when you infact already have that object

#

assuming instance is checked

wet breach
hazy parrot
#

Bukkit.getPlayer(UUID) iterates over online players

wet breach
#

pretty sure it has an internal map

tardy delta
#

^^

slim wigeon
#

How do I get the size of each tree?

hazy parrot
#

yap, my bad, Bukkit.getPlayer(name) iterates

#

still seems weird to do Bukkit.getPlayer(entity.getUUID) over (Player) entity

tardy delta
wet breach
proper notch
#

Yah just

if (!(entity instanceof Player player)) {
  return;
}

player.doStuff()
wet breach
#

but all I said was it was just more acceptable to do the non-casting route if its available because in general this should ensure that everything works at least that is what conventions say

#

but no one is opposed to the casting XD

hazy parrot
#

anyway, is there way to see nms source code on spigot stash other then those weird patches

topaz atlas
#
      {
        Player killer = Bukkit.getPlayer(e.getDamager().getUniqueId());
        Player dier = Bukkit.getPlayer(e.getEntity().getUniqueId());
        if(e.getEntity().isDead()) {
            
        Bukkit.getScheduler().runTaskLater(this.instance, () -> {
        if (dier.isDead()) {
        dier.spigot().respawn();
        }
        Bukkit.getServer().broadcastMessage(killer.getName() + " won the fight against " + dier.getName() + " the loser will get their items instantly or in a min");
         if (dier.getUniqueId().equals(Bukkit.getPlayer(firstPlayer).getUniqueId())) { 
             dier.getInventory().setContents(playerinv2);
             killer.getInventory().setContents(playerinv);
        } else if (dier.getUniqueId().equals(Bukkit.getPlayer(SecondPlayer).getUniqueId())){
             dier.getInventory().setContents(playerinv);
             killer.getInventory().setContents(playerinv2);
        }
        }, 1200);
     }```
#

Ima try this

#

Btw

wet breach
#

builtools gives you the repos in their full source form without the patches view

hazy parrot
#

cool, thanks

wet breach
#

in regards to stash, only have patches view unfortunately for the server

topaz atlas
#

Bukkit.getServer().broadcastMessage(killer.getName() + " won the fight against " + dier.getName() + " the loser will get their items instantly or in a min");
Only logs to the console

#

is there a method that logs to all pllayers in the server

wet breach
#

well the server for the most part logs a lot of stuff

#

however in regards to plugins

#

it is up to the plugin to log to console any information they want to be shown in the logs

topaz atlas
#

I just want it to log to chat

wet breach
#

broadcast messages show up in log because they are part of the chat

topaz atlas
#

will i have to loop over all players

topaz atlas
wet breach
#

it should

#

its a broadcast

#

if the broadcast isn't showing up, then make sure that your client doesn't have some setting turned off I guess

#

otherwise you have some kind of error in your broadcast in which case your server log should have some kind of error in there

remote swallow
#

why do you call #getServer on bukkit, try Bukkit.broadcastMessage()

topaz atlas
#

I tried that. hmm. ima try again

frail pilot
#

?paste

undone axleBOT
frail pilot
harsh totem
#

What's returned when I use GetDurability on an item that has no durability?

tardy delta
#

sometimes im wondering what im doing

frail pilot
harsh totem
#

yes

frail pilot
blissful wagon
#

Is there any way to see the RAM usage of an individual plugin?

harsh totem
#

:(

#

I want to check if an item is a breakable tool, how would I do that?

frail pilot
#

Look at the Damageable interface

#

Get the ItemMeta from the ItemStack and then check if it's damageable with (meta instanceof Damageable)

hazy parrot
#

just make sure to import correct Damageable interface, its common mistake to import one from entity package

harsh totem
#

thank you

harsh totem
hazy parrot
#

yes

harsh totem
#

lol

#

who made it

frail pilot
#

Yep, but not in the same package

#

One for entity, one for item meta

tardy delta
#

someone has to explain me how it finds a ; at index 2: @define c ed ; 2

wet breach
#

it could be the way your code is designed

#

index doesn't necessarily refer to its place in a string

tardy delta
#

its c++ anyways but ye

sinful elm
#

hi ! Just achieved to add NMS to my project, the problem is... it is still obfuscated

eternal oxide
#

?nms

sinful elm
#

seems like buildtools doesn't find the maven repository, is there a way to specify it using args ?

eternal oxide
#

nms is not in any maven repo

opal juniper
#

not true

eternal oxide
#

read the link I sent to properly access nms with mappiings

#

ok nms is not in any legal repo

opal juniper
sinful elm
#

"Maven does not exist, downloading. Please wait."

opal juniper
#

still alive somehow

tardy delta
#

splitting it into two lines worrks

#

looks like if (size_t commentIdx = it->find(';', 1); commentIdx != std::string::npos) {} is the syntax

topaz atlas
#
        at com.onutillities.SignEvents.lambda$onEntityDamageByEntity$2(SignEvents.java:141) ~[onutillities-1.0.jar:?]
        at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.4.jar:git-Paper-519]
        at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[paper-1.19.4.jar:git-Paper-519]
        at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1483) ~[paper-1.19.4.jar:git-Paper-519]
        at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:447) ~[paper-1.19.4.jar:git-Paper-519]
        at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1397) ~[paper-1.19.4.jar:git-Paper-519]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1174) ~[paper-1.19.4.jar:git-Paper-519]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[paper-1.19.4.jar:git-Paper-519]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]```
tardy delta
#

because the return value of "org.bukkit.Bukkit.getPlayer(java.util.UUID)" is null

topaz atlas
#

One sec

tardy delta
#

what would that mean huh

eternal oxide
#

that player is not online

topaz atlas
#

Ima paste

#

?paste

undone axleBOT
tardy delta
#

me being sarcastic

topaz atlas
topaz atlas
#

It should work

eternal oxide
#

use getOfflinePlayer if they are not online

tardy delta
#

wha Bukkit.getPlayer(e.getDamager().getUniqueId());

topaz atlas
topaz atlas
#

their uuid

#

then fetched them from the server

#

because the entity object you get from the event lacks a bunch of class;s

tardy delta
#

cast entity to Player after checking

eternal oxide
topaz atlas
tardy delta
#

wha

#

you need a player, then cast it

#

if (e.getDamager() instanceof Player player) { player.stuff() }

topaz atlas
#

Ok ima try again tommorow

tardy delta
#

thats the spirit 💀

topaz atlas
#

I need to test one more thing

topaz atlas
tardy delta
#

sleep is for the weak

#

how late is it

slim wigeon
#

...

topaz atlas
#

1:15 am

tardy delta
#

weak

#

5 hours sleep feels good enough

shadow night
#

Wow, timezones are weird

echo basalt
#

5 minutes sleep feels good enough

tardy delta
#

i somehow needed less sleep today cuz i normally have to go to college

#

ig im used to it

#

then sleeping in the weekend till 10 am 💀

shadow night
tardy delta
#

idk its some kind of free day

#

they should've done it tmrw, 3 hours networking practice smh

#

im probably insulting elgarl now

eternal oxide
#

no clue how

tardy delta
#

arent you the networking guy

eternal oxide
#

I was for a few years. Not much I've not done 🙂

sinful elm
eternal oxide
#

then you did it wrong

#

that tutorial is quite simple

#

don;t manually import spigot

#

use maven to handle dependencies

#

run buildtools

#

with --remapped

#

then it's pretty much copy/pase into your pom

sinful elm
#

the problem is buildtools doesn't put the dependencies in the maven repository like it should do (and like said in your link)

wet breach
tardy delta
#

damn plugins

wet breach
sinful elm
wet breach
#

yeah lets not specify if you mean api or server

sinful elm
#

server

wet breach
#

its in the buildtools directory where it says spigot

#

you can manually install it if you want

#

not that hard to do

sinful elm
wet breach
#

then you are obviously doing something wrong

sinful elm
#

but I think I did it wrong will search on google

wet breach
#

and didn't read something

kind hatch
#

List out your steps.

wet breach
#

not sure what google is going to do

kind hatch
#

Walk us through what you did exactly

wet breach
#

unless you simply are unable to read

sinful elm
#

yes the post should work

#

but :

wet breach
#

but, you don't need the server jar to necessarily be in the repo

#

as long as maven can find it and it is appropriately defined, then do everything the post says

#

to include following links

kind hatch
#

To be fair, build tools is wonky sometimes.

sinful elm
#

maybe I am dumb (i suck at maven), but why do I get multiple root tags error when I follow the link's instructions ?

#

in pom.xml

chrome beacon
#

Show us what you did

kind hatch
#

?paste your Pom as well

undone axleBOT
sinful elm
#

did it

wet breach
#

when it really is just a section you should add

#

not sure where in the post it says this is the pom and nothing else or you should copy this over your entire pom

sinful elm
#

oh fuck im really dumb

small current
#

Hello

sinful elm
#

so I just need to replace the build and the dependencies

small current
#

What is the event for obsidian forming

#

(i need the location of the water and lava that formed it)

wet breach
kind hatch
slim wigeon
#

Timber plugin lag, wow. Huge chunk of trees clearedTPS from last 1m, 5m, 15m: 19.73, 19.91, 19.97Need help locking it to one tree, instead of over 15 trees

kind hatch
#

Unless you have code

slim wigeon
#

I made the plugin so yes, I have the code

kind hatch
#

Mb, share away.

slim wigeon
#
        block.breakNaturally();

        // Leaves
        if( leaves.contains(block.getRelative(-1,0,0).getType()) ) { this.timber(block.getRelative(-1,0,0)); }
        if( leaves.contains(block.getRelative(1,0,0).getType()) ) { this.timber(block.getRelative(1,0,0)); }
        if( leaves.contains(block.getRelative(0,-1,0).getType()) ) { this.timber(block.getRelative(0,-1,0)); }
        if( leaves.contains(block.getRelative(0,1,0).getType()) ) { this.timber(block.getRelative(0,1,0)); }
        if( leaves.contains(block.getRelative(0,0,-1).getType()) ) { this.timber(block.getRelative(0,0,-1)); }
        if( leaves.contains(block.getRelative(0,0,1).getType()) ) { this.timber(block.getRelative(0,0,1)); }
        
        // Logs
        if( logs.contains(block.getRelative(0,-1,0).getType()) ) { this.timber(block.getRelative(0,-1,0)); }
        if( logs.contains(block.getRelative(0,1,0).getType()) ) { this.timber(block.getRelative(0,1,0)); }
        if( logs.contains(block.getRelative(1,0,0).getType()) ) { this.timber(block.getRelative(1,0,0)); }
        if( logs.contains(block.getRelative(-1,0,0).getType()) ) { this.timber(block.getRelative(-1,0,0)); }
        if( logs.contains(block.getRelative(0,0,1).getType()) ) { this.timber(block.getRelative(0,0,1)); }
        if( logs.contains(block.getRelative(0,0,-1).getType()) ) { this.timber(block.getRelative(0,0,-1)); }
    }```
kind hatch
#

Where are you calling that method?

slim wigeon
#
    public void onBlockBreak(BlockBreakEvent event) {
        Player player = event.getPlayer(); Block block = event.getBlock(); Inventory inv = player.getInventory();
        ItemStack item = player.getInventory().getItemInMainHand(); ItemMeta meta = item.getItemMeta();
        ItemStack powerItem = new ItemStack(Material.COAL);
        
        if( !(axe.isItemValid(item) && logs.contains(block.getType())) ) { return; }
        DataContainer container = new DataContainer(meta); Power power = new Power(meta);
        
        if( power.has(100) ) {
            axe.timber(block); power.remove(100);
            
            int powerPercentage = container.integerGet("Power.Current") * 100 / container.integerGet("Power.Max");
            if( container.booleanGet("Feature.AutoFuel") && powerPercentage < 5 && inv.containsAtLeast(powerItem, 2) ) {
                power.add(200); inv.removeItem(powerItem);
            }
            
            axe.updateItem(item,meta); item.setItemMeta(meta);
        } else {
            event.setCancelled(true);
        }
        
        player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(
            ChatColor.AQUA+"[Timber Axe] "+ChatColor.GRAY+"Power: "+
            ChatColor.WHITE+(container.integerGet("Power.Current") * 100 / container.integerGet("Power.Max"))+"%"
        ));
    }```
#

Command Output on kill dropsKilled 650 entities

kind hatch
#

I’m assuming that you broke one block and any trees that were connected got broke along with the first one?

slim wigeon
#

Yes, that is my issue. I need it to break only one tree

kind hatch
#

Then you’ll probably have to change your checks. I think that #breakNaturally() calls the BlockBreakEvent so you have yourself an interesting loop.

You could try just setting the block to air and then spawning the items it would normally drop.

small current
#

i cant get the water and lava made in BlockFormEvent

kind hatch
rotund ravine
#

To*

#

Or smth like that

small current
rotund ravine
#

?jd-s

undone axleBOT
rotund ravine
#

Take a look st it

small current
#

if to is lava?

rotund ravine
#

Try to make the logic urself

small current
#

already cancelled

kind hatch
#

It’s be more like if from is lava, but ya know

slim wigeon
rotund ravine
#

Look sugly as hell

#

ugly*

#

looks*

kind hatch
#

Well, can’t really blame you too much. There is no real easy way to determine a tree. However that method looks like it would only ever work on small oak and small birch trees.

#

Provided it’s used correctly

slim wigeon
#

Or trees that don't connect to each other. Like in the Plains biome. Dark Forest biome generated 640+ entities. Trying to copy EpicTimber is a task

kind hatch
#

You could redo your approach entirely and just recursively trace the tree up to a certain point.

slim wigeon
#

You got the timber function

kind hatch
#

I’m not at my computer so I can’t really give and quick examples.

prisma steeple
#

hi all. really basic problem regarding java, not bukkit, i have a command declared in another class but i need to pass through a variable. how do I do this?

wet breach
#

then, go back and detect all the logs that are in the air

#

and then get the ones that are connected to the ground

undone axleBOT
prisma steeple
slim wigeon
hazy parrot
wet breach
#

once you are certain you identified a tree, in an area around it, remove all the leaves in the air, then the logs not connected to anything

#

and then the base

prisma steeple
hazy parrot
#

Your ide should handle imports

#

You can't pass variable trough imports

prisma steeple
#

i can if they are public

hazy parrot
#

You can't lol

slim wigeon
#

I tried searching on how to detect a tree but there is no results I can find. The leaves removal is what connects all the logs

prisma steeple
hazy parrot
#

xd

kind hatch
#

I sense static abuse

hazy parrot
#

Well, I didn't consider that

prisma steeple
hazy parrot
#

?learnjava I would say

undone axleBOT
kind hatch
#

Tf are you on about?

prisma steeple
#

im more cpp

prisma steeple
kind hatch
#

Show code

wet breach
#

if there is leaves it is most likely a tree

#

then, you just remove the leaves, I am aware the leaves connect the logs but you are removing anyways

kind hatch
#

You could probably get real convoluted by checking block type and creating methods for each wood type.

wet breach
#

this helps in identifying the floating logs so you don't accidentally continue and kill all your trees that are next to each other

prisma steeple
slim wigeon
#

Let me see

wet breach
#

alternatively

#

if you have leaf decay enabled

#

just remove all logs floating in the air

#

server will automatically remove extra leaves for you

kind hatch
#

I think that’s what MCMMO did in its early days.

slim wigeon
# wet breach alternatively

Is this how I can travel up the tree? public void timber(Block block) { do { block = block.getRelative(0,1,0); block.breakNaturally(); } while ( logs.contains(block.getRelative(0,1,0).getType()) ); }

wet breach
#

well you are going to need to specify some constraints that you believe are acceptable when satisfied is a tree

#

so you could say, if there is 3 blocks of wood in a single line, and then some leaves

#

around it

#

at the top

#

if those conditions are met you can start removing the logs around it and the trunk

#

once logs are gone, if leaf decay is enabled on the server the leaves will disappear over time on their own

#

if leaf decay is disabled, you will have to remove the leaves in a pre-determined area

pseudo hazel
#

is that not like a state of the leaves or logs or whatever?

#

whether they are natural

wet breach
#

but you need the constraints so it doesn't just like start killing all your trees XD

slim wigeon
#

I want to remove the leaves as well, I love EpicTimber but it does multiple items that you normally don't get. That is why I started the plugin. Also, I had a function set up before but it removed leaves from other trees as well

prisma steeple
#

what is the player damage event?

slim wigeon
#

There is

prisma steeple
#

excuse my bad phrasing

kind hatch
tardy delta
#

took me 2 days for a simple preprocessor 💀

prisma steeple