#help-development

1 messages ยท Page 328 of 1

regal scaffold
#

I somehow managed to cancel all droped items. like dropping any item either natural or not is disabled

tall dragon
#

not completely sure tho

wet breach
#

before going on a witch hunt, do know that most who host servers don't know what they are doing to begin with and typically use more then just 1 plugin lol.

regal scaffold
#

I'm trying to figure out why that would happen

pseudo hazel
#

yeah I know but I figured I might aswell check like check broadly

regal scaffold
#

But I only have

#

EntityDeathEvent

pseudo hazel
#

like if its really as bad as people say it is then it should be easy to find some cause

#

ill try out spark

regal scaffold
#

Does dropping an entity count as death?

wet breach
tender shard
#

you cancel the EntitySpawnEvent to prevent entities that do not come from spawners

regal scaffold
#

Like just throwing the item

tender shard
regal scaffold
#

See alex

#

This why

#

you're the goat

#

And I use you resources

pseudo hazel
#

yeah it could also just be the fact that java just likes to reserve ram

regal scaffold
#

Thank you

tender shard
#

you said you wanted to prevent entities from being spawned lol

#

check if the spawned entity is instanceof Item, if so do not cancel it

#

or check if the spawned entity is instanceof Creature

wet breach
tender shard
#

and only then cancel it

regal scaffold
#

dONE

#

Thanks โค๏ธ

tender shard
#

np

quaint mantle
#

if i make a plugin for the latest mc version will it work on older versions like 1.8?

wet breach
#

no

tender shard
#

only if you only use api that was already there in 1.8

quaint mantle
#

there is plugins that work from 1.8 to newer versions

#

what do they do tho

tender shard
#

because they only use the 1.8 api or have different modules per version

tall dragon
#

when their code is version dependend

tender shard
#

1.8 is dead anyway

tall dragon
#

pretty much

quaint mantle
#

well yes but its pvp is still gold

tender shard
#

no, its pvp is ajoke where all you gotta do is click very fast

#

in 1.9 you actually have to time your attacks

#

but sure, that's too complicated for most 12 year olds

tall dragon
#

both require skill

tender shard
#

so they say "1.8 pvp is so gooood"

tall dragon
#

just differently

wet breach
#

jumping and clicking is hardly something I would call skill

quaint mantle
#

i don't remember saying my age so thank you for being respectful here
this behavior doesn't seem to be from an aged person tho

wet breach
#

jump click eat a god apple or two

tall dragon
#

well pvp right now they dont fight at all

quaint mantle
#

yes

tall dragon
#

they just place obby with a crystal on top

#

boring

quaint mantle
#

exactly

#

and the old pvp is interesting

tender shard
#

i didnt say you're 12, all I said is that most 12 year olds prefer 1.8 because the 1.9+ pvp is too complicated for them

quaint mantle
#

the new pvp which have a delay between trades actually breaks everything

#

that's a personal preference tho

#

but i prefer the old one

tall dragon
#

i do think the new pvp has been better for the game tho

#

it just fits the game better

quaint mantle
tall dragon
wet breach
#

also keep in mind, MC isn't designed for hardcore pvp either

tender shard
#

just use 1.8 api if you don't use NMS

#

then it should also work on all higher versions

wet breach
tall dragon
wet breach
#

each module has their own dependency

quaint mantle
#

sorry but what's NMS?

#

i know java for a long time but never really coded using it

tall dragon
#

net.minecraft.server

#

e.g. non spigot api code

wet breach
#

non modified source

#

is another way to put it

quaint mantle
#

alright

tall dragon
#

which means essentially. ur on ur own in those areas haha

#

since theres not many people here that would help out with 1.8 nms anymore

wet breach
#

?1.8

undone axleBOT
tall dragon
#

which is understandable

quaint mantle
#

so in my case, i code using idea which asks you to choose a jdk version when creating the project. What version someone would choose to make his plugin compatible with most versions?

tender shard
#

jdk 8, spigot api version 1.8.8-R0.1-SNAPSHOT

quaint mantle
#

so just like the api i choose 1.8 as well

tender shard
#

yeah but that's a coincidence

regal scaffold
#

?jd

tender shard
#

minecraft <1.16 uses java 8, 1.17 uses java 16, after that it uses java 17

quaint mantle
#

i've choosen 1.8 for my project so i'm good

regal scaffold
#

Ummmm

civic prairie
#

Hello. How can i put this elements in a item? {HideFlags: 4, Damage: 0, display: {Name: '{"extra":[{"text":"hola"}],"text":""}'}, AttributeModifiers: [{Name: "generic.movementSpeed", Operation: 0, UUID: [I; 1461744232, -864534134, -1964839385, 1725294635], Amount: 2.0d, AttributeName: "minecraft:generic.movement_speed"}]} if i have this list in the config.yml

tender shard
#

Bukkit.getUnsafe().modifyItemStack

civic prairie
#

yea, but it does not work

tender shard
#

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

quiet ice
#

in what way?

regal scaffold
#

Which event works when a hopper does stuff with items

tender shard
#

InventoryMoveItemEvent

regal scaffold
#

Tyyyy

tall dragon
#

some have a lot of hoppers

regal scaffold
#

Just gonna make a custom one

quiet ice
#

Some outright disable that event

regal scaffold
#

Like a custom hopper I mean

tall dragon
#

yh

quiet ice
#

paper does it by default iirc

rigid loom
#

is there a reason this doesnt create the specified kingdom?

                if (args[0].equalsIgnoreCase("create") && !plugin.getMember().containsKey(player.getUniqueId().toString()) && !plugin.getKingdoms().containsKey(player.getUniqueId().toString()) && !plugin.getKingdoms().containsValue(kingdom)) {
                //player is not in a kingdom and kingdom doesn't exist
                plugin.getKingdoms().put(player.getUniqueId().toString(), kingdom);
                plugin.getOwner().put(player.getUniqueId().toString(), kingdom);
                plugin.getAdmin().put(player.getUniqueId().toString(), kingdom);
                player.sendMessage(ChatColor.WHITE.toString() + ChatColor.BOLD + kingdom + ChatColor.GREEN + ChatColor.BOLD + " created");
                return true;
            }```
quiet ice
#

As in the message is not sent or something else?

civic prairie
# tender shard ?notworking
com.mojang.brigadier.exceptions.CommandSyntaxException: Expected '}' at position 45: ...{Name: '{'<--[HERE]
#
                                        item = Bukkit.getUnsafe().modifyItemStack(item, "{HideFlags: 4, Damage: 0, display: {Name: '{'extra':[{'text':'hola'}],'text':''}'}, AttributeModifiers: [{Name: 'generic.movementSpeed', Operation: 0, UUID: [I; 1461744232, -864534134, -1964839385, 1725294635], Amount: 2.0d, AttributeName: 'minecraft:generic.movement_speed'}]}");
rigid loom
quiet ice
rigid loom
#

no

quiet ice
#

that will be an issue down the road

#

Your actual issue most likely lies somewhere else though

tall dragon
undone axleBOT
tall dragon
#

only slows down the check & complicates things

tardy delta
#

computeIfAbsent pls

rigid loom
#

good to know

regal scaffold
#

@tall dragon so you said to be careful with hoppers cause there's a lot right. I'm trying to think of a way of insantaly returning nothign if the event is something I don't need. What are some good ways to check if a hopper is at a specific location meaning the item below is a customchest

tardy delta
#

no need to check contains before removing

regal scaffold
#

I assume getting the location of the event and checking block under is already resource intensive

quiet ice
#

i.e. without setting the name. You can do that through the bukkit api manually either way

tall dragon
regal scaffold
#

Really hmmm

#

Actually below

tall dragon
#

fair

regal scaffold
#

It's output not input

#

But is that the best?

tall dragon
#

but that check shoulnt be too intensive

#

its not modifying anything

#

just reading

regal scaffold
#

Gotcha

#

So shouldn't be that bad

tall dragon
#

but u can benchmark it obv

#

to be sure.

civic prairie
regal scaffold
#

Get the event, check if the block below is the one I want, if not return

#

Alright

tall dragon
#

first check the type tho

regal scaffold
#

True

#

From hopper

tall dragon
#

then continue with any check to make sure its ur custom stuff

regal scaffold
#

Gotcha

#

Thanks a lot :3

rigid loom
tall dragon
#

yes you can

#

iirc ๐Ÿ˜ฎ

#

as far as i know. in those cases that will be done automatically. without a toString call

#

but having a UUID as key in a hashmap vs the string version just doesnt make sense

#

u mean their order?

#

or actual different locations

tender shard
# rigid loom can you save UUIDs to a file without .toString()?

no, you have to store them as list of strings.

        // Save
        myConfig.set("listOfUUIDs", listOfUUIDs.stream().map(UUID::toString).collect(Collectors.toList()));
        
        // Load
        listOfUUIDs = myConfig.getStringList("listOfUUIDs").stream().map(UUID::fromString).collect(Collectors.toList());
tall dragon
#

thats odd indeed.

#

try to do some debuggin in there

#

see whats its actually doing

rough drift
#

Can you change the player name above their head? (Using hex colors)

tall dragon
#

last time i did that, i did it using score board teams

#

but that was for 1.8 :s, api might have a better way now

pseudo hazel
#

thats the way I know too

#

you just need to figure out how to use hex colors on a scoreboard but other than that its doable

regal scaffold
#

Hey so before I disabled natural mob spawning and only spawners but

#

I'm using a custom spawner plugin and I don't think it behaves the same way as normal spawners

#

So those got disabled too

#

How can I check that the entity spawned from that as well

sterile token
tender shard
#

it is coding related

regal scaffold
#

It is code related wym

#

Alex I just realized entityspawnevent is a shitton of stuff

tender shard
#

ofc it is

regal scaffold
#

Gonna need 20 lines of checks but still have the different spawner issue

#

I tried looking at the code

sterile token
#

oh ok

#

As far i saw a link i thought you were asking how to spawn entites

regal scaffold
#

You're fine. I'm trying to cancel normal mob spawns unless they come from spanwer

#

But using that spawner doesn't work with instanceof spawner

tender shard
#

shouldnt this be enough?

regal scaffold
#

That's what I had

#

But the spawner doesn't actually count as a spanwer

#

So it doesnt spawn

tender shard
#
    @EventHandler
    public void prohibitMobsExceptFromSpawners(CreatureSpawnEvent event) {
        Location loc = event.getLocation();
        Bukkit.broadcastMessage("CreatureSpawnEvent near you at " + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ() + ": " + event.getEntityType());

        if(event.getSpawnReason() != CreatureSpawnEvent.SpawnReason.SPAWNER) {
            Bukkit.broadcastMessage(" --> Cancelled not-spawner spawn");
            event.setCancelled(true);
        }
    }

this definitely works

regal scaffold
#

Alright I'll try it

#

ty alex

undone axleBOT
#

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

regal scaffold
#

no context andy

compact haven
#

That spoonfeed is fine

regal scaffold
#

Ignore him he has no idea what was going on

compact haven
#

he clearly has already debugged and attempted, pushing him to know spawn reason will work when the event isnโ€™t a SpawnerSpawnEvent is fine

undone axleBOT
final monolith
#

Hey guys, im getting a java.lang.ClassNotFoundException: io.netty.util.internal.ThreadExecutorMap at the tests folder, but ive already defined the dependency...

        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
            <version>5.0.0.Alpha2</version>
            <scope>test</scope>
        </dependency>

(maven compiler sucks)

rotund ravine
#

are you sahding it?

final monolith
#

its not a spigot plugin

#

but its about a spigot plugin

#

its the tests folder <

final monolith
#

And shade the dependency
how i can shade for the tests folder? (i mean that foldeer)

civic prairie
#

hello. is possible to save custom items with a menu?

final monolith
#

The normal shading will affect the tests too?

undone spindle
#

hey ive got a question when using an sql database can it be hosted on the minecraft server?

#

and how would i connect to that

final monolith
upbeat hornet
#

Using OpenNBT, how could I make a dictionnary that uses other classes than int/string for storing data?
Like If I need to store a location object, how could I do it? Since OpenNBT only allows you to store primitive data types

final monolith
civic prairie
final monolith
#

?paste

undone axleBOT
undone spindle
#

okey so i don't need to host it apart somewhere?

final monolith
undone spindle
#

good thx

final monolith
#

i didnt relocated

#

i need?

#

bro maven compiler: ๐Ÿ’ฉ

river oracle
#

Tbf it's your mistake not mavens

final monolith
final monolith
#

look at the last dependency

quiet ice
#

Unless you are insane

final monolith
#

๐Ÿค” that makes sense, i will try others

quiet ice
#

Use 4.X.X, which is actually maintained

final monolith
regal scaffold
#

Hey so I'm running FurnaceSmeltEvent but when I get to
event.getBlock().getType() != Material.FURNACE || event.getBlock().getType() != Material.BLAST_FURNACE

#

it fails

#

It thinks it's false

remote swallow
#

?paste full method

undone axleBOT
final monolith
#

do a debug

regal scaffold
#
    @EventHandler(priority = EventPriority.HIGHEST)
    public void onFurnaceSmelt(FurnaceSmeltEvent event) {
        plugin.logger.info("Furnace smelt event called");
        if (event.getBlock().getType() != Material.FURNACE || event.getBlock().getType() != Material.BLAST_FURNACE) return;
        plugin.logger.info("Furnace smelt event passed");
#

I checked to make sure and event.getBlock().getType() actually returns the right thing

remote swallow
#

what messages do you get

regal scaffold
#

FURNACE and BLAST_FURNACE

#

Just the first

#

I know it's that time

#

It happened out of nowhere, was working before

final monolith
#

do a debug

remote swallow
#

are you blind

final monolith
#

plugin.logger.info(event.getBlock().getType())

regal scaffold
#

lol

#

He's joking right?

remote swallow
remote swallow
regal scaffold
#

lmao

remote swallow
#

can any other blocks actualyl call furnace smelt event

regal scaffold
#

np still can't seem to understand wtf

#

You know I was thinking about that epic

#

but

#

Why would it fail anyways

#

It was working before

regal scaffold
#

What other events interact with furnaces

#

Maybe I'm screwing something up elsewhere

#

InventoryMoveEvent

remote swallow
#

might be one of the prepare events

final monolith
remote swallow
#

it should

regal scaffold
#

yeah

remote swallow
#

it should return if it isnt a furnace or blast furnace

regal scaffold
#

wait no

final monolith
#

but it shows the second message even if the block is a FURNACE or BLAST_FURNACE?

regal scaffold
#

It should

#

No no

#

Somehow the check

#

Things it failed

#

Like event.getBlock().getType() is not actually a Material.FURNACE

remote swallow
#

change the return to a sysout/logger.info and see what you get

regal scaffold
#

When it should be

regal scaffold
#

Could be conflicting too no/

final monolith
regal scaffold
#

Thought inventoryMoveEvent also applies to furnaces

regal scaffold
#

Yes doiung rn

final monolith
regal scaffold
#

Oh my

#

I see what the issue is

tender shard
#

create a yoghurt and inject it into netty

regal scaffold
#

What the fuck

remote swallow
#

by chance

#

do you have an api version in plugin.yml

tender shard
#

is the YoghurtFactory in spigot-api or only in spigot?

regal scaffold
#

So it actually

final monolith
regal scaffold
#

Thinks the block is not a furnace

final monolith
#

bro just wanted to test a code ๐Ÿ’€

regal scaffold
#

Why would that be

remote swallow
#

do you have an api version in plugin.yml

regal scaffold
#
      ```
#

Ummm

quiet ice
regal scaffold
#

yes

#

1.19

remote swallow
#

dafuq

regal scaffold
#

lomao

#

I'm not joking when I say

tardy delta
#

if !block.getState() instanceof Furnace

quiet ice
#

Chances are that you are not using the same version as minecraft and that stuff goes bangzai if you use mismatching versions

regal scaffold
#

Was working perfectly before

#

like 100%

regal scaffold
#

event.getBlock().getType() is actually returning the right thing

#

event.getBlock().getType() != Material.FURNACE thinks this is true

#

I mean ig I can just remove the check but I'm so confused on why that would fail

remote swallow
#

magic

regal scaffold
#

Now i'm straight up confused

final monolith
# quiet ice Yeah then relocate

like this?

<relocations>
    <relocation>
        <pattern>io.netty</pattern>
        <shadedPattern>codes.laivy.tests.libraries</shadedPattern>
    </relocation>
</relocations>
quiet ice
#

if everything goes right, yea

final monolith
#

it not ๐Ÿ’€

quiet ice
#

Issue are netty natives, they could be PITA

final monolith
#

i will try a old version then

regal scaffold
#

I guess just pray that it doesn't call something that isn't a furnace

final monolith
#

๐Ÿ’€

regal scaffold
#

So weird

quiet ice
#

so where exactly do you get that issue`

final monolith
quiet ice
#

While executing tests? If so, how do you execute them? Do other classes cause the issue too?

quiet ice
#

And mvn test?

final monolith
#

already, it just creates me a .jar

quiet ice
#

oh no...

final monolith
#

what ๐Ÿ’€

quiet ice
#

You are likely not running it with the debug configuration

#

Well not debug, but unit test config

final monolith
#

bro why maven is so complicated

#

i just wanna to test 5 lines of code

#

๐Ÿ’€

quiet ice
#

You have to use an actual unit test framework with maven

#

Such as JUnit

#

Isn't too hard

final monolith
#

ok, i will just delete the code

#

thanks

#

xD

vivid cave
#

lowest priority event = final say?

#

or is it highest?

tender shard
#

highest has finel say

#

that's why it's called highest

vivid cave
#

hmm weird naming

#

lol

tender shard
#

yeah it's a bit confusing

vivid cave
#

for me the person who has priority means that he'll go first

#

but yeah okay i can understand why its called otherwise too

#

thanks!

#

And MONITOR is even higher than HIGHEST right?

river oracle
#

Yea

vivid cave
#

so why is highest called highest if its not the highest ๐Ÿ‘€

tender shard
#

ok this is weird

remote swallow
#

but monitor shouldnt modify the event

river oracle
remote swallow
#

monitor is for stuff like discord relay etc etc

tardy delta
#

event modifications can overwrite eachother so to have the highest priority you must apply your changes at the end

vivid cave
#

what if I do modify?

tardy delta
#

nothing

remote swallow
#

you get bonked

tender shard
river oracle
#

Your just an asshole nothing more nothing less

fossil lily
#

What's the knockback formula? I need to simulate it without a player being damaged.

remote swallow
#

you use rainbow vars

vivid cave
#

i don't care about other plugin devs they can piss off with their "code of conduct" and take their good practises up their aaarrse

#

sorry xd

#

i needed that out

#

i'm so irritated by the dev community

remote swallow
river oracle
#

Most spigot devs suck

civic prairie
#
```what is this?
vivid cave
#

anyway thx for the support

remote swallow
#

the drops plugin uses nbtapi but doesnt depend on it

civic prairie
#

and what can i do?

#

it depends on it

remote swallow
#

add nbtapi to depend section in plugin.yml

civic prairie
#

ok, thanks

regal scaffold
#

@tender shard

#

So remember how you told me to use CreatureSpawnEvent instgead

#

Cause the dumb spawners from wildstacker

tender shard
#

I know there's Bukkit.craftItem(...) but is there a similar thing for cooking recipes, e.g. furnaces, blast furnaces, etc?

tardy delta
#

hmm yes Enter an expression or type exit() to exit: 35356666666666666666666666666666 ExpressionParser result: -8.9478486E7 (28.0 ยตs) (new algorithm) ExpressionParser result: -8.9478486E7 (19.2 ยตs) (old algorithm)

tender shard
regal scaffold
#

I mean

tender shard
#

WildStacker is the worst

regal scaffold
#

They are cool but maybe code wise yes

vivid cave
#

ALSO I love the fact that i made my plugin in one file
People get mad when they see this hahaha

tender shard
#

idk I only them from them always causing troubles with other plugins

regal scaffold
#

Well

#

See that next and block above

remote swallow
civic prairie
#

another thing. I have this:

                                        ItemStack item = new ItemStack(Material.DIAMOND_SWORD);
                                        NBTItem itemNBTI = new NBTItem(item);
                                        double movementSpeed = getConfig().getDouble("espada.AttributeModifiers.movementSpeed");

                                        ItemStack espada = new ItemStack(Material.DIAMOND_SWORD);

                                        NBTItem nbtEspada = new NBTItem(espada);

                                        nbtEspada.setInteger("HideFlags", getConfig().getInt("espada.HideFlags"));

                                        nbtEspada.setString("display.Name", getConfig().getString("espada.display.Name"));

                                        nbtEspada.setString("display.Lore", getConfig().getString("espada.display.Lore"));


                                        List<String> enchants = getConfig().getStringList("enchants");
                                        for (String enchant : enchants) {
                                            String[] parts = enchant.split(":");
                                            String enchantName = parts[0];
                                            int level = Integer.parseInt(parts[1]);
                                            item.addUnsafeEnchantment(Enchantment.getByName(enchantName), level);
                                        }

                                        item = nbtEspada.getItem();
```with this config:
```yml
espada:
  HideFlags: 1,
  display:
    Name: "HolaTest"
    Lore: "Este es el lore"
  enchants:
    - "SHARPNESS:3"
    - "FIRE_ASPECT:2"
``` and the item was not created with the custom values
regal scaffold
#

Someone the dumb plugin uses a sort of creature

#

To spawn that

tardy delta
#

discord formatting on its best

regal scaffold
#

So if I use CreatureSpawnEvent

#

It disabled that holo too

#

Gonna put it in 1 message:

I'm using ```java
public void preventNaturalMobSpawn(CreatureSpawnEvent event) {
if(event.getSpawnReason() == CreatureSpawnEvent.SpawnReason.SPAWNER) return;
event.setCancelled(true);
}


But when I do that my item stacking can't display the entity above it for some dumb reason. What kind of checks could I add to make sure only natural creatures are canceled
feral swallow
#

Hello when I send a block change to a player and that same player aims a bow at the block the block disappears. How would I fix this?

pulsar parcel
#

Hi, I am trying to use maven dependency. I added repository and dependency, but groupId, artefactId and version is red. And I am getting error:
Could not find artifact me.zombie_striker:QualityArmory:pom:VERSION in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
There is my maven:
https://pastebin.com/gEcjHxwA

remote swallow
#

did you reload maven?

pulsar parcel
#

yes

regal scaffold
#

epic any clue on my issue ๐Ÿ˜ฆ

quiet ice
#

try building that plugin yourself

#

And using mvn install

#

it's cursed, but the best one can do sometimes

pulsar parcel
#

ok, i will try something

remote swallow
regal scaffold
tender shard
regal scaffold
#

You need to replace VERSION with the actual version @pulsar parcel

pulsar parcel
remote swallow
regal scaffold
#

Alex back to CreatureEntitySpawn

#
  1. What an idiot for adding a hostile mob to display a holo...
remote swallow
#

wtf

tender shard
#

AreaEffectClouds should be used for holograms

remote swallow
#

that hologram is a mob?

regal scaffold
#

It's getting deleted using CreatureSpawnEvent

remote swallow
#

armor stands or aoe clouds for holos

regal scaffold
#

What if he's using armor stands

#

O.o

tender shard
#

Thats also ok

remote swallow
#

go into spec and check

regal scaffold
#

Then I can check

#

If instance

tender shard
#

But they cause client lat when you have many of them

regal scaffold
#

if (event.getEntity() instanceof ArmorStand) return;

#

๐Ÿ‘€

tender shard
#

I once checked with my rtx 2080 super and 10k armorstands in one chunk killed FPS, but 10k effect clouds worked fine

remote swallow
#

ig its not actually rendering anything

#

because 0 particles

#

0 invis stuff

tender shard
#

Yeah idk

#

All i know is that it was working well lol

regal scaffold
#

I think

#

It's working

#

nvm

#

If there is an entity there

#

How can I get it

#

If I make a /see command

remote swallow
#

go into spec

#

if its an invis thing you should be able to see it

regal scaffold
#

There it is

#

LMAO

#

We found the little bugger

#

if (event.getEntity() instanceof ArmorStand) return is wrong then

tender shard
#

Cant you just ignore named entities

regal scaffold
#

Don't all creatures have names?

#

I mean maybe isCustomNameVisible could work

#

But I feel like if if (event.getEntity() instanceof ArmorStand) return; didn't work it's the same bs as the spawners

#

That they are not actually spawners

tender shard
regal scaffold
#

Yeah there you go

#

Perfect

#

Works for now lol

#

Until the next wildstacker bs breaks it again

feral swallow
#

How do I prevent fake blocks from disappearing when I interact with them?

tender shard
#

do you guys also have like 20 "Test" plugins lol

tender shard
regal scaffold
#

Cli

#

ew

remote swallow
#

ive got like 2

feral swallow
remote swallow
#

bukkit test plugin, config test plugin

feral swallow
#

Dont know how to watch for someone aiming a bow at a block

wet breach
#

I don't end up with many of them because I just re-use it when I need to do a quick test

regal scaffold
feral swallow
#

on what event?

regal scaffold
#

Just need a player

#

If you're shooting arrows I believe is projectileLaunchEvent

#

Could be wrong tho

feral swallow
#

Yeah except you dont have to actually shoot the arrow

#

If you start aiming it removes the block

regal scaffold
#

Then

#

Cancel the event

#

Start aiming

feral swallow
#

What?

regal scaffold
#

Or release?

#

So you're practically saying just right click a bow

remote swallow
#

interact event

regal scaffold
#

^

#

If you want the player to have to do the windup and then hold it without releasing interact event otherwise if you want them to release and the block looking at gets broken do launch event

feral swallow
feral swallow
#

If I can't actually check if there is a block there

regal scaffold
#

play with the transparent

feral swallow
# regal scaffold

Yes that is for server sided blocks/regular blocks, the server doesnt know there is a block there

#

what

regal scaffold
#

Oh that's what you mean

#

...

#

Hmmmm

feral swallow
#

Im going to try vectors to see if the player is aiming at the location of the block

regal scaffold
#

Won't work

#

Server side

feral swallow
#

What?

regal scaffold
#

Have you done basic debugging to see if PlayerInteractEvent is called when a fake block is broken client side?

feral swallow
#

What is server sided?

chrome beacon
#

Calculating the vector works fine

feral swallow
#

Yeah

chrome beacon
#

I would do two checks one; rayTrace and a vector calculation

feral swallow
#

Why 2?

chrome beacon
#

So you don't have anything in the way obstructing the view of the block

#

If that doesn't matter you can just skip the rayTrace

feral swallow
#

well it would matter but players wont be a able to place blocks there so it shouldnt be a problem

wet breach
#

only problem is you won't really be able to know if they are aiming the bow

#

client doesn't give that information. Only information in regards to aiming the bow that client sends is when the arrow is fired and that is to inform how much power or how far back the bow draw was

#

so you are going to have some challenges with that unless you just want them to have the bow in hand which you could detect that

feral swallow
#

Fake blocks disappear when interacted with

#

So I dont need to check if its a bow

#

Also am I doing this wrong? Sometimes it works sometimes it doesnt and I cant really find a reason to why it doesnt work

Vector direction = p.getEyeLocation().getDirection();
        for(Location loc : fakeBlocks.get(p.getUniqueId())) {
            if (loc.toVector().distanceSquared(p.getEyeLocation().toVector().add(direction)) < 1) {
                loc.getBlock().setType(Material.BARRIER);
            }else {
                p.sendMessage("NOT LOOKING");
            }
        }```
regal scaffold
#

How can I convert this to an enum or something better for the purpose

    public static final Map<Integer, Double> MAX_ALLOWED_ITEMSTACKS_UPGRADES = new HashMap<>() {{
        put(1000, 10.0);
        put(5000, 50.0);
        put(10000, 100.0);
        put(50000, 500.0);
    }};

The Integer would actually be how much the upgrade would modify and the Double is the price.

So it's like a table of

amount->cost

not a key -> cost

feral swallow
#

api

tardy delta
regal scaffold
#

Yes

#

Or I mean no

#

It's an example

#

I want to be able to hardcode a custom amount of those

#

With any values

tardy delta
#

put it in a file and load it

#

whatever

regal scaffold
#

But since they are prices they will never change

#

But where to store it is the question

#

I need it accessible from many files

tardy delta
#

resources folder?

#

uh

regal scaffold
#

nono what object

#

I don't think what I'm doing right now is the best

#

I was thinking an enum for example

#

Like accessing the data in that list is odd

tardy delta
#

put it in an utils class or smth

regal scaffold
#

The problem is I don't what what the correct datatype is

#

Not that I can make it static final

tardy delta
#

wdym correct type

tender shard
# regal scaffold How can I convert this to an enum or something better for the purpose ```java ...

sth like this?

public enum UpgradeTier {
    TIER1(1_000, 10d),
    TIER2(5_000, 50d),
    TIER3(10_000, 100d),
    TIER4(50_000, 500d);
    
    private static final UpgradeTier[] TIERS = values();
    
    private final int modifyAmount;
    private final double price;

    UpgradeTier(int modifyAmount, double price) {
        this.modifyAmount = modifyAmount;
        this.price = price;
    }
    
    @Nullable
    public UpgradeTier getNextTier() {
        int nextIndex = ordinal() + 1;
        if(nextIndex >= TIERS.length) return null;
        return TIERS[nextIndex];
    }
}

tardy delta
#

into infinity lets goo

regal scaffold
#

Thank god

#

I'm cleaning up my project

#

It's the first one I did and since then I've improved a lot and this 800 line file with terrible GUI management ain't gonna cut it

tender shard
#

also why the heck is it called Tier

#

Tier means animal

regal scaffold
#

In what language lmao

tender shard
#

german

remote swallow
#

tier is like a level

regal scaffold
#

Well I can tell you the word tier doesn't come from german lol

tender shard
#

no, tier is an animal ๐Ÿ˜›

remote swallow
#

no

#

bad

tardy delta
#

dier is an animal

remote swallow
#

deer is an animal

tender shard
#

sponge is an animal

regal scaffold
#

So alex

#

If I want to have multiple enums for different types of upgrades do you recommend putting them all in 1 enum file

tender shard
#

i wouldnt use enums in the first place but make it configurable

regal scaffold
#

NO

#

No config allowed here

tender shard
#

then use 1 enum per "type"

regal scaffold
#

Ok gotcha

remote swallow
#
public class TotallyCoolEnumsBeLike {
    public enum Enum1 {
    }
    public enum Enum2 {
    }
}``` calling itwould look like this
regal scaffold
#

Do you have a picture of your GUI structure?

#

you too ebic

remote swallow
#

i dont do guis much

regal scaffold
remote swallow
#

and if i do i just use built in gui stuff

#

even though i have my own

regal scaffold
#

hmmm

tender shard
remote swallow
#

yaml anchors are bae

regal scaffold
#

wtf

#

why does your gui files have 100 lines combined

#

how terrible am I at doing this

remote swallow
#

because he has a lib

tender shard
#

not for gui stuff

regal scaffold
#

Oh wait not the question then

#

Example:

tender shard
#

angelchest's gui code is more sophiscated lol

remote swallow
#

show him yaml anchors

regal scaffold
#

I want to have a gui:

I want to have half of that GUI to not actually change elements but it can update, so like refresh.
I want to have submenus for the gui that will only change the bottom portion of it

upbeat hornet
#

is anyone familiar with opennbt willing to help me?

regal scaffold
#

So like panels in html lol

#

I need to be able to always access the top half ( one that never changes ) from the child gui ( bottom ones )

tender shard
regal scaffold
#

I'm talking file structure specifically

upbeat hornet
# tender shard i doubt that anyone can help you if you don't ask any specific question

I've tried creating my own custom tag to store objects inside NBT, because this is what I need.
But when I try to create my new tag and add it, it doesn't work.
First of, it gives no value to the tag (can't access the object I stored)
second, I can't read the nbt file after I've written it using my custom tag (Gives me an error: "Could not find tag with ID '255'")
Would like to resolve both of theese issues

tardy delta
#

pdc?

upbeat hornet
#

You can't add pdc to blocks

tender shard
#

?blockpdc

undone axleBOT
tardy delta
#

you can to chunks

tender shard
#

blocks also cannot store custom NBT tags

upbeat hornet
quartz goblet
#

Trying to get a custom slime and im gettin 'y()' in 'net.minecraft.world.entity.EntityInsentient' clashes with 'y()' in 'net.minecraft.world.entity.EntityLiving'; attempting to use incompatible return type And cant find much info. Im extending EntitySlime. Anyone know what to about it?

regal scaffold
#

I want to have a gui:

I want to have half of that GUI to not actually change elements but it can update, so like refresh.
I want to have submenus for the gui that will only change the bottom portion of it

I need to be able to always access the top half ( one that never changes ) from the child gui ( bottom ones )

upbeat hornet
tender shard
#

it gives you one PDC per block per plugin, and you don't need any NMS like NBT requires

upbeat hornet
#

what's NMS?

tender shard
#

NMS is the version dependant, internal minecraft code

quartz goblet
#

net minecraft server

upbeat hornet
#

uh okay let's keep it there ๐Ÿ˜‚

tender shard
#

basically, if you see "NMS", you should try to avoid it if possible

quartz goblet
#

profound take

fervent gale
#

Ok so I pretty sure I asked this a couple days back or something but is there a way to remove items in inventory if it has specific PersistentDataContainer the key is flash_coins

remote swallow
#

loop over the items in the inventory and check if they contain your pdc key

regal scaffold
#

omg

#

What is the name of when you have a picture that has like everything going on inside a class

#

Like it shows the methods, fields, access, etc

#

it's like a map

tardy delta
#

diagram

regal scaffold
#

THANK YOU

tardy delta
#

or do you mean the stuff on alex' screen?

regal scaffold
#

no

#

You were right

#

UML*

remote swallow
#

you've heard of yml, now we have uml

tender shard
#

if you mean this, it's Ctrl+Alt+Shift+U in IJ

remote swallow
#

only on ultimate

regal scaffold
#

Sort of but

#

I want to draw my own

#

So I can send it here

#

See if what i'm about to do is good or not

remote swallow
#

i need to get a support discord made

tardy delta
remote swallow
#

ive got so much to do PepeCryHands

fervent gale
#

Is placeablekeys a way to check if the item has keys like PDC

tardy delta
#

what are placeablekeys?

fervent gale
#

sender.inventory.contents.itemMeta.hasPlaceableKeys()

tardy delta
#

im not finding any ItemMeta#hasPlaceableKeys

atomic swift
#

with an ItemStack in config can i use Color Codes

fervent gale
#
            for(contents in sender.inventory.contents) {
                if(!contents!!.hasItemMeta() || !contents.itemMeta.hasPlaceableKeys()) return else {
                    if(!contents.itemMeta.persistentDataContainer.equals("flash_coins")) return else {
                        contents.removeAmount(Int.MAX_VALUE)
                    }
                }
            }
tardy delta
#

hows that a question

#

ugh kotlin

fervent gale
#

bite me

rotund ravine
#

!contents!!.hasItemMeta() yeah gl with npes

#

inventories can have nullable entries.

tardy delta
#

how is itemmeta even on the contents

fervent gale
#

Really its a quick write up

rotund ravine
#

So it's a single itemstack.

tardy delta
#

wait bruh

rotund ravine
#

He's saying it's not null though, even though it might be.

#

!contents.itemMeta.persistentDataContainer.equals("flash_coins") Will always be false.

#

Also you can just use == in kotlin.

fervent gale
#

yeah I could do !=

#

but either way

rotund ravine
#

It will always be false. (true with the ! in front)

#

Is this some sort of extension function? contents.removeAmount(Int.MAX_VALUE)

fervent gale
#
fun ItemStack.removeAmount(amountToRemove: Int): Boolean {
    this.amount -= amountToRemove
    return this.amount > 0
}
rotund ravine
#

Could do max(0, this.amount-amountToRemove)

#

Do note that

fervent gale
#

Noted

rotund ravine
#

setting the amount to 0 does not remove the item.

#

Are you using 1.7 or smth?

fervent gale
#

Should I ask in Paper discord?

rotund ravine
#

for?

#

Don't count on it, setting the amount to 0 doesn't remove the item.

rotund ravine
fervent gale
#

I'll ask there I just don't like to lol

#

Good Bye Sweet people of SpigotMC

rotund ravine
#

@fervent gale ItemMeta will always have pdcs.

#

Well it won't work on some versions. I know it didn't work a while back.

ancient plank
rotund ravine
#

nice.

sterile token
#

How i can cancel tnt explosions inside a specific region im already cancelling the event but i cannot figure why explosions breaks blocks

tardy delta
sterile token
tender shard
#

prined tnt are entities

#

EntityExplodeEvent

tardy delta
#

and pls put that region code on gh

sterile token
#

The problem is that tnt event doesnt have a getter for breaked blockes that is causing

tender shard
#

blockList()

sterile token
#

Oh LMAO

#

WHy didnt they call it like a getter, that is not following conventions

tender shard
#

yeah I also once searched it for 5 minutes before I found it

#

very weird name

#

sounds like paper api

tardy delta
#

sounds like minestom naming conventions

tender shard
#

"fluent" bullshit

tardy delta
#

sounds like orbyfieds getters

undone kernel
#

rate code 1-10

                if (!player.hasPermission("server.summon")) {
                    player.sendMessage("You do not have permission to use this command.");
                    return true;
                }
                if (args.length < 2) {
                    player.sendMessage("Usage: /summon <entityType> <amount>");
                    return true;
                }
                int amount;
                try {
                    amount = Integer.parseInt(args[1]);
                } catch (NumberFormatException e) {
                    player.sendMessage("Invalid amount. Please enter a valid number.");
                    return true;
                }
                EntityType entityType = EntityType.valueOf(args[0].toUpperCase());
                Location location = player.getLocation();
                for (int i = 0; i < amount; i++) {
                    Objects.requireNonNull(location.getWorld()).spawnEntity(location, entityType);
                }
                player.sendMessage(colorize("&aSpawned &e" + amount + " &a" + entityType + (amount > 1 ? "s" : "") + "."));
rotund ravine
#

1

undone kernel
tardy delta
#

not using a framework

undone kernel
#

why would I need one

tardy delta
#

wrap valueOf with a try catch too

#

dont require nonnnull

undone kernel
#

i just put that there

#

because intellij wants to be a bitch

tender shard
#

checking the permission is not needed if you properly registered the command.
using Objects.requireNonNull is also not needed since you just got the location from the player.
And you could achieve the same thing using ACF with only 4 lines

remote swallow
#

ignoring errors is so easy

tender shard
#

other than that, it's fine to me

undone kernel
#

no it isnt

sterile token
#

So how would i block the event without cancelling it on every loop? Because that wont cancel the event

undone kernel
#

no

#

what about it

#

herobrine isn't a thing

sterile token
tender shard
#

it would throw a NoSuchElementException when someone enters /command asdasd

sterile token
undone kernel
tender shard
undone kernel
#

run it yourself

tender shard
undone kernel
tender shard
#
[00:13:55 INFO]: mfnalex issued server command: /test asd 5
[00:13:55 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'test' in plugin Test-Spigot v1.0-SNAPSHOT
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_19_R2.CraftServer.dispatchCommand(CraftServer.java:929) ~[paper-1.19.3.jar:git-Paper-373]
        at org.bukkit.craftbukkit.v1_19_R2.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[paper-1.19.3.jar:git-Paper-373]
        at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[paper-1.19.3.jar:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:313) ~[?:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:297) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2288) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$20(ServerGamePacketListenerImpl.java:2248) ~[?:?]
        at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.19.3.jar:git-Paper-373]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1341) ~[paper-1.19.3.jar:git-Paper-373]
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197) ~[paper-1.19.3.jar:git-Paper-373]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1318) ~[paper-1.19.3.jar:git-Paper-373]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1311) ~[paper-1.19.3.jar:git-Paper-373]
        at net.minecraft.util.thread.BlockableEventLoop.runAllTasks(BlockableEventLoop.java:114) ~[?:?]
        at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1445) ~[paper-1.19.3.jar:git-Paper-373]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1173) ~[paper-1.19.3.jar:git-Paper-373]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.19.3.jar:git-Paper-373]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.IllegalArgumentException: No enum constant org.bukkit.entity.EntityType.ASD
        at java.lang.Enum.valueOf(Enum.java:273) ~[?:?]
        at org.bukkit.entity.EntityType.valueOf(EntityType.java:23) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at com.jeff_media.testspigot.TestSpigot.onCommand(TestSpigot.java:38) ~[test-spigot-1.0-SNAPSHOT.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        ... 23 more
undone kernel
#

and I forgot that second args are a thing

#

hold on a second

tender shard
#

i'd do it like this

        EntityType entityType = Enums.getIfPresent(EntityType.class, args[0].toUpperCase()).orNull();
        if(entityType == null) {
            player.sendMessage("Invalid entity type. Please enter a valid entity type.");
            return true;
        }
#

oooor use acf

#

and you can just do it like this:

#
    @Default
    public void onCommand(Player player, EntityType entityType, int amount) {
        Location location = player.getLocation();
        for (int i = 0; i < amount; i++) {
            Objects.requireNonNull(location.getWorld()).spawnEntity(location, entityType);
        }
        player.sendMessage(ChatColor.translateAlternateColorCodes('&',"&aSpawned &e" + amount + " &a" + entityType + (amount > 1 ? "s" : "") + "."));

    }
undone kernel
#

or

#

i can overly complicated it for no reason

tender shard
#

sure

undone kernel
#

ah Y e s

#
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (sender instanceof Player) {
            Player p = (Player) sender;
            if (sender.hasPermission("eagle.multisummon")) {
                if (args.length >= 2) {
                    try {
                        EntityType entity = EntityType.valueOf(args[0]);
                        int amount = Integer.parseInt(args[1]);
                        for (int i = 0; i < amount; i++) {
                            p.getWorld().spawnEntity(p.getLocation(), entity);
                        }
                        p.sendMessage(colorize("&aYou've spawned &e" + args[1] + " " + args[0] + "s"));
                    } catch (IllegalArgumentException e) {
                        p.sendMessage(colorize("&4This is not an entity."));
                    }
                } else {
                    p.sendMessage(colorize("&e/multisummon [mob] [amount]."));
                }
            } else {
                p.sendMessage(colorize("&4You don't have permission to do this."));
            }
        } else {
            sender.sendMessage(colorize("&4You cannot do this. "));
        }
        return true;
    }```
regal scaffold
#

I want to make a gui:

I wanna know what a good file structure for this is

I want to have half of that GUI to not actually change elements but it can update, so like refresh.
I want to have submenus for the gui that will only change the bottom portion of it

I need to be able to always access the top half ( one that never changes ) from the child gui ( bottom ones )

river oracle
#

How do you split up tests into multiple classes? I have one testing class using MockBukkit and its already 180 lines long

river oracle
#

that is awful lol

undone kernel
#

it's html so it isn't a proglem

#

bruh

#

problem

river oracle
#

WebDev ๐Ÿ’€

#

I hate web development

undone kernel
river oracle
river oracle
# undone kernel y

its so boring and you spend 99% of your time trying to shift elements with css

undone kernel
#

if you learn css

#

it's easy

river oracle
#

JavaScript is a mid ass language and there are 10 billion frameworks you have to learn

#

to have an effective setup

undone kernel
#

I only have 67 lines in my css file

#

but also my website is ugly as hell ๐Ÿ’€

river oracle
#

exactly I'm also no designer

#

I can't do CSS not because its hard, but because My sense of design doesn't exist

undone kernel
undone kernel
river oracle
#

I mean I code code a website I've just never posted my portfolio websites because its designed to poorly

regal scaffold
#

Hey can anyone provide a project with well defined abstract classes, Interfaces and enums connected.

#

Trying to wrap my head around what the best way of doing what I want is and would be great to see some examples

river oracle
#

?stash

undone axleBOT
regal scaffold
#

I said well defined

remote swallow
#

yeah

#

bukkit and craftbukkiy are

regal scaffold
#

There's too much going on in there

remote swallow
#

not really

river oracle
#

Bukkit is pretty well defined

modest zephyr
#

"Internal Excecption: java.net.SocetException: Connection reset"

regal scaffold
#

Trying to understand how basics work and that has way too much stuff

modest zephyr
#

bro what

undone axleBOT
modest zephyr
remote swallow
#

read it

undone kernel
#

i wonder

#

how can I change my language type in intellij

tender shard
#

wdym with language type?

undone kernel
modest zephyr
#

It just changes color.

tender shard
#

language level

#

File -> Project Structure

#

you also will have to change it in your pom.xml

undone kernel
#

alr

#

where in my project structure

tender shard
undone kernel
#

thx

tender shard
#

the SDK has to be >= the language level

undone kernel
#

welp new java time

river oracle
undone kernel
#

Hold up lemme bring in the light mode

#

๐Ÿ’€ @river oracle

sterile token
#

Why its not recommend to cancel the events while looping? I having some issues related to that

tender shard
#

wdym?

undone kernel
undone kernel
#

chatgpt it gonna answer this

undone kernel
# sterile token Why its not recommend to cancel the events while looping? I having some issues r...
It is not recommended to cancel an event while looping through its handlers because it can lead to unexpected behavior.

When an event is cancelled, it will stop all remaining event handlers from executing. However, if an event handler that is currently being executed is also responsible for cancelling the event, it will stop all remaining event handlers, including itself. This can lead to an infinite loop, where the event is cancelled, but the event handler that is cancelling it is not finished executing yet, so the event is immediately uncancelled, and the loop starts again.

Additionally, cancelling an event while looping through its handlers can also cause the event handlers that have already been executed to be skipped, which may lead to unexpected behavior.

It is generally better to cancel the event before it is passed to the event handlers to avoid these issues.

Also, if you need to cancel an event inside a loop, you should use an Iterator to remove the handler from the list of handlers, instead of cancelling the event.```
tender shard
#

and again, chatgpt produced utter bullshit

undone kernel
#

yes

tender shard
#

completely untrue lol

undone kernel
#

yes

undone kernel
tender shard
#

ACF automatically does that

#

if you want to provide your own message, then do not make the method take an EntityType, but make it take a string

sterile token
undone kernel
#

what's wrong

sterile token
remote swallow
#

and do you even have acf imported

undone kernel
#

no

#

i didn't know it was a seperate thing

#

what's the implmentation for it

tender shard
#

btw acf can also send the text in the translated language, e.g. german for people who set minecraft to german

remote swallow
tender shard
undone kernel
#

bruh

#

never have i ever

#

use a library

tender shard
sterile token
#

oh you sent so many lines that my issue got losted haha

gaunt relic
# sterile token }

so you're getting the regions at a block location, then you're checking again if the region cuboid contains that block

sterile token
#

getRegion() internally performs a loop of the List<Region> via Cuboid object

gaunt relic
#

so you don't need to check for it again on the setCancelled method

#

right?

sterile token
gaunt relic
#

because there is a null check before

undone kernel
tender shard
undone kernel
#

nvm I didn't read

gaunt relic
#

you could just use setCancelled(true)

sterile token
#

Let me test it

gaunt relic
#

and add a break; so the loop stops

sterile token
tender shard
#

Here's an example with working tab complete that only accepts proper entity types, but sends your own message:

Command class:

@CommandAlias("multisummon")
public class SummonCommand extends BaseCommand {

    @Default
    @CommandCompletion("@entitytypes @range:0-999")
    public boolean onCommand(Player player, String typeName, int amount) {
        EntityType type = Enums.getIfPresent(EntityType.class, typeName.toUpperCase()).orNull();
        if(type == null) {
            player.sendMessage(ChatColor.RED + "Invalid entity type");
            return true;
        }
        Location location = player.getLocation();
        for (int i = 0; i < amount; i++) {
            Objects.requireNonNull(location.getWorld()).spawnEntity(location, type);
        }
        player.sendMessage(ChatColor.translateAlternateColorCodes('&',"&aSpawned &e" + amount + " &a" + type.name() + (amount > 1 ? "s" : "") + "."));
        return true;
    }

}

Main class:

    @Override
    public void onEnable() {
        PaperCommandManager acf = new PaperCommandManager(this);
        acf.registerCommand(new SummonCommand());
        acf.getCommandCompletions().registerStaticCompletion("entitytypes", Arrays.stream(EntityType.values()).map(Enum::name).toArray(String[]::new));
    }
undone kernel
tender shard
#

what?

undone kernel
#

is not entity type anymore

#

it's type

tender shard
#

fixed

#

I typed it into discord without an IDE

undone kernel
#

same

#

wait no i didn't

undone kernel
tender shard
#

so that you see this

undone kernel
#

can that not be replicated with a normal tab completor

tender shard
#

sure but the ACF way is much easier

undone kernel
#

ik I can do smth about it being upercase

#

I gotta add #toLowerCase somewhere in that stream

#

damn bruh acf if replacing my normal register command stuff

#

now I can just use .acf

#

acf.registercommand

undone kernel
#

can you tell me where tf I'm supposed to place it

tender shard
#
        acf.getCommandCompletions().registerStaticCompletion("entitytypes", Arrays
                .stream(EntityType.values())
                .map(type -> type.name().toLowerCase())
                .toArray(String[]::new)
        );
remote swallow
#

Enum::name

tender shard
#

Enum::name is the same as myEnum -> myEnum.name()

undone kernel
#

ah

#

welp time to get rid of this

sterile token
undone kernel
#

my file size went from 12kb to 342kb

sterile token
#

Acf is not lightweight

tender shard
#

yes because it includes all the translations for the messages

remote swallow
#

atleast its not megabytes

undone kernel
#

true

tender shard
#

you can make it smaller by setting <minimizeJar> to true in the maven-shade-plugin

#

then only includes the classes you need

undone kernel
#

i mean who really cares how big it is

tender shard
#

it only includes the classes you need

sterile token
#

it cannot trucate classes

tender shard
#

the nit's obviously a class that you need

undone kernel
#

since you need it

#

don't trust me tho idk what i'm talking about

sterile token
undone kernel
#

also my tab completor isn't working ;- ;

tender shard
#

then you didnt add the CommandCompletion annotation

undone kernel
tender shard
#

how else would ACF know that you want it to complete entitytypes there?

#

it cannot magically know that

#

it would magically know it if you used the enum instead of a string as parameter

undone kernel
#

yes

remote swallow
#

?learnjava

undone axleBOT
regal scaffold
#

It happens to some, they are all the same

#

It can't be an event getting canceled cause some ar still spawning

undone kernel
tender shard
#

ignore that

undone kernel
#

alr

undone kernel
remote swallow
#

ask chatgpt

undone kernel
#

or well it doesn't know the correct shit

remote swallow
tender shard
undone kernel
remote swallow
#

i doubt you should be making plugins then

undone kernel
remote swallow
#

same

undone kernel
#

exactly we're on the same page

tender shard
hazy parrot
#

Are there any possible downsides of minimazing jar?

tender shard
#

not if you do it right

atomic swift
#
java.lang.NullPointerException: Cannot invoke "org.bukkit.configuration.ConfigurationSection.getKeys(boolean)" because "section" is null
        at info.sokobot.locksmith.items.Keys.init(Keys.java:44) ~[locksmith-0.0.1-SNAPSHOT.jar:?]
    public static void init() {
        File dataFolder = new File(Main.getInstance().getDataFolder().getPath() + "/keys");
        File[] files = dataFolder.listFiles();
        for (File file : files) {
            if (!file.getPath().endsWith(".yml")) continue;
            YamlConfiguration config = parseYaml(file.toPath().getFileName());
            ConfigurationSection section = config.getConfigurationSection("keys");
            Bukkit.getLogger().info(file.getPath());
            for (String item : section.getKeys(false)) {
                
                keys.put(item, file.toPath().getFileName());
                registierRecipe(item);
            }
        }
    }
tender shard
#

imagine you have classes like

my.package.v1_19_R2.MyNMSHandler
#

and you access them like this:

#
Class.forName("my.package.v" + nmsVersion + ".MyNMSHandler");
#

then the shade plugin won't know you use that class and get rid of it

#

that's why you have to add filters in such cases

#

e.g. like this

hazy parrot
#

But if you don't use any reflection or hacky things like that?

tender shard
#

then you can freely use <minimizeJar>

sterile token
#

Hi im back i still cannot understand why the blocks are still being open on tnt exploision, while i already checked many times my code

hazy parrot
#

Cool, thanks ๐Ÿ‘

tender shard
#

np

sterile token
#

LMAO im exausted i still cannot cancell the fkg tnt ๐Ÿ˜‚

gaunt relic
#

System.out.println(region)

tender shard
sterile token
tender shard
#

and you still use BlockExplodeEvent although you said you were doing TNT stuff

#

and I told you that TNT is an entity when primed

sterile token
tender shard
#

like a falling block

rotund ravine
#

EntityExplodeEvent

sterile token
#

Im checking both of the event and none of them are being cancelled

#

Also the region system it isnt the problem

tender shard
#

show your getRegion(Location) method

#

your region stuff must be the problem

#

if you'd actually cancel the event, nothing would explode

#

if you only want blocks inside your region to stay intact, do not cancel the event but remove the blocks that are inside your region from the blocklist

atomic swift
#
    private static YamlConfiguration parseYaml(Path path) {
        return YamlConfiguration.loadConfiguration(new File(Main.getInstance().getDataFolder(),path.getFileName().toString()));
    }
sterile token
tender shard
#

check if it actually returns sth

sterile token
#

Because the blocks are actually in the region

remote swallow
#

getDataFolder would return the folder of your plugin in plugins

tender shard
sterile token
#

He?

#

Im mixxed with what you mean

#

I just need to make blocks not breaken when any explosion is done

gaunt relic
sterile token
#

๐Ÿ’€

gaunt relic
#

there must be something wrong with Region.getCuboid().contains(Location)

tender shard
# sterile token Im mixxed with what you mean
    @EventHandler
    public void onExplode(EntityExplodeEvent event) {
        event.blockList().removeIf(block -> {
            System.out.println("Checking whether to protect " + block + " from explosion...");
            boolean isInMyRegion = isInOneOfMyRegions(block.getLocation());
            if(isInMyRegion) {
                System.out.println("  -> Yes, it's in my region");
                return true;
            } else {
                System.out.println("  -> No, it's not in my region");
                return false;
            }
        });
    }
tender shard
atomic swift
#

fixed that now ConfigurationSection config = parseYaml(keys.get(name)).getConfigurationSection("keys."+name); is null

sterile token
#

No, because i use the same method for block break/place events and works perfectly. If the method wouldnt be working then my others events werent working

tender shard
#

it obviously does not work perfectly

sterile token
#

oik

gaunt relic
# sterile token oik

one more thing, you should use Priority Lowest instead of highest, since you will be changing the outcome of the event

sterile token
tender shard
#

highest is totally fine?

atomic swift
#

all of the stuff in that class depend on this

    private static YamlConfiguration parseYaml(Path path) {
        return YamlConfiguration.loadConfiguration(new File(Main.getInstance().getDataFolder(),"keys/"+path.getFileName().toString()));
    }

i have this being sent

ConfigurationSection config = parseYaml(keys.get(name)).getConfigurationSection("keys."+name);

the error happens in registerRecipe() because config is null

tender shard
#

what's wrong with using highest?

gaunt relic
# tender shard what's wrong with using highest?

if another plugin uses the event and wants to get the list of blocks exploded, the blocks will still be there. By using lowest you remove the blocks from the list before the event of this other plugin is called.

tender shard
#

if a plugin wants to know the final outcome, they should use MONITOR

gaunt relic
#

yes, but sometimes it's better to leave a headroom, specially if you're doing a region plugin

tender shard
#

I think that especially when they want to protect their regions, they should highest