#help-development

1 messages · Page 1986 of 1

quiet ice
#

Basically that is how arrays work right now

#

coming straight from openjdk

brave sparrow
#

Right

#

The array is still one block of memory

#

One block of pointers

quiet ice
#

Yeah, the array object itself is a memory block

brave sparrow
#

Just like in C/C++

lost matrix
#

Thats also how you would use an array in C++

brave sparrow
#

^

viral crag
#

each is, in multidimeniosnal they can be different

quiet ice
#

multidimensional is array of array though

#

Or array of pointers that point to arrays better said

#

Some languages may squish it down to a single array, but java for sure is not one of these langs

viral crag
#

anoymous arrays are also not conventional in other languages

twilit wharf
#

I am getting this weird error using 1.18.1 nms trying to make a custom villager entity, 'x()' in 'net.minecraft.world.entity.EntityInsentient' clashes with 'x()' in 'net.minecraft.world.entity.EntityLiving'; attempting to use incompatible return type

viral crag
twilit wharf
#

idk

quiet ice
#

You should be using mojmap

twilit wharf
#

I am doing public class CustomVillager extends EntityVillager {}

quiet ice
#

Basically the method names have changed

rough drift
#

if i set a perm to a player with a permission attachment, how do i make it so commands change with what is available to them?

twilit wharf
twilit wharf
cinder thistle
#

Jesus new Java scares me

#

All this talk of pointers and memory management

quiet ice
#

it does work, but your code is invalid

grim ice
#

give me aan idea of a library

rough drift
quiet ice
cinder thistle
quiet ice
cinder thistle
#

Newer versions are chock-full of crazy features

rough drift
rough drift
cinder thistle
#

I miss using Java regularly. I just have no reason to use it

cinder thistle
rough drift
#

vectors are just so good

#

i sped up one of my programs 8 fold

rough drift
quiet ice
#

the fact that java.util.Vector exists is confusing

grim ice
#

creating a developer?

#

nah man thts too scary

viral crag
#

that it was missing for so long is odd

rough drift
#

basically same speed as doing 2 * 2, but you can do it 8 times within the same clock cycle iirc

viral crag
#

frames without proper vectors is a mess in 3d space

rough drift
#

like

#

"returns a new instance of X"

grim ice
#

thats useless

rough drift
#

nah

#

auto java docs is cool

grim ice
#

that isnt even a documentation

viral crag
#

attempting to equal doxygen - where you document and extract your comments and accesses automatically while you code

grim ice
#

anyone has a library idea

viral crag
cinder thistle
rough drift
rough drift
lethal python
#

guys i am new to spigot, I'm running setCustomModelData on an item but it's not doing anything ingame, i think i saw someone say there's another step i need to do to make it work

rough drift
#

the cpu runs multiple calculations at once on the same cycle

#

not parallel

viral crag
rough drift
#

a permission management plugin

#

i need to figure out how to make players SEE the commands they can use

rough drift
#

because rn they show up in red

cinder thistle
#

How are you able to run multiple in the same cycle? I’ve heard of instructions taking multiple cycles to complete

viral crag
quiet ice
#

But vectors allow to do larger computations atomically

rough drift
cinder thistle
#

I’m also not terribly familiar with how processors functions

quiet ice
#

At least REAL vectors

lethal python
#

are you guys helping someone

cinder thistle
#

Nope

lethal python
#

this channel is help channel

cinder thistle
#

Meh

#

Is it more like alternating between multiple things real fast inside that cycle? Somewhat like uhhh

lethal python
#

can you move it to general or something

quiet ice
#

For example adding two int arrays together to get another int array can happen atomically in a single cycle

lethal python
#

i can't ask for help here

quiet ice
#

Why not

cinder thistle
#

Sure you can

lethal python
#

yeah i did and it got swamped with your convo

floral pewter
viral crag
#

@rough drift there is a big mess around displaying commands and how the client interprets them

cinder thistle
floral pewter
#

sadly that's the only way to get attention

lethal python
#

blixten i've got a thread open

#

if you'd like to help

cinder thistle
#

Sounds like context switching inside a cycle

floral pewter
#

My bad 😅

quiet ice
#

what is context switching?

#

Okay, I'd say no after reading the first line from wikipedia

#

In computing, a vector processor or array processor is a central processing unit (CPU) that implements an instruction set where its instructions are designed to operate efficiently and effectively on large one-dimensional arrays of data called vectors. This is in contrast to scalar processors, whose instructions operate on single data items only...

viral crag
#

vectors do not have a fixed point like coordinates do

quiet ice
#

wha

viral crag
#

its hard to explain if you dont know what frames are

quiet ice
#

Frames of relativity (or however you call it in english)?

viral crag
#

frames are the coordinate holders for teh vectors

quiet ice
#

vectors can be infinitely massive (though have a defined size) blocks of data

cinder thistle
quiet ice
#

arrays for example are more or less vectors

#

The spigot vector is a physical vector. Which basically contains direction and a value (force for example is a vector)

cinder thistle
#

Ah

quiet ice
#

However mathematical vectors are just arrays

cinder thistle
#

I see

#

Well thank you for all these insights

#

I’ve learned quite a bit

viral crag
quiet ice
#

In physics I have only heard about frames in relation to relativity

viral crag
#

so the frames reference each other for the vector orientation and you use the frames to reference in real space

cinder thistle
#

Right

#

So frames are like…

#

Nope nvm

viral crag
#

two frames will give you a orientation and possibly a height, 3 frames will give you movement back and forth, 4 and 5 will give you diagonals

cinder thistle
#

So… mutable relative coordinates? I think I understand a bit better but I don’t see the point

#

Oh I see

viral crag
#

so you manipulate the frames or virtual space

#

this is where vectors have a huge amount of power

#

you are not running huge amount of calculations to get coordinates over and over, that data is mostly useless

#

you only want the vector scalar in the frame

#

the frame only periodically changes

#

so you put that in minecraft, your players and entities suddenly drop from thousands of calculations to a few hundred - you know the player is moving forward, there is no need to check/poll unless it is interrupted

#

One simply moves the proper frame and deals with whatever else the player might be doing

mortal hare
#

ah yes.. Frustration at its finest level

#
        /// <summary>
        /// Thanks to some idiot at Mojang
        /// </summary>
        private static int DataSlotToNetworkSlot(int index)
        {
            if (index <= 8)
                index += 36;
            else if (index == 100)
                index = 8;
            else if (index == 101)
                index = 7;
            else if (index == 102)
                index = 6;
            else if (index == 103)
                index = 5;
            else if (index >= 80 && index <= 83)
                index -= 79;
            return index;
        }
lost matrix
mortal hare
#

that's a gist

#

not my snippet

worldly ingot
#

PES_Think is that a Java snippet using C# docs?

#

Oh, no it's C# lol

mortal hare
lethal python
#

guys on an inventoryclick event, if the type was drop then .getCurrentItem() returns the item stack the dropped item came from. i'm trying to modify the single dropped item if that's possible

#

is it possible? if yes how do

viral crag
#

modify how?

lethal python
#

set custom model data

#

i just wanna know how to get that one item that it drops

viral crag
#

based on the fruit conversation earlier you would need to modify it before dropping it

lethal python
#

ok

#

the problem i've got right now is pressing q on the item stack will change the custom model data of the dropped item, but it does it for the stack it was dropped from too

#

is this unavoidable

viral crag
#

you did drop the whole stack ...

lethal python
viral crag
#

oh wait i miss read

lethal python
#

this is good idea, if there isn't another solution i will do this

viral crag
#

you only threw one item from teh stack

lethal python
#

ye

#

and it's changing the model data of the whole stack

#

thank u zack

#

:V that has a getItemDrop() method

#

that might work :>

viral crag
#

modify before drop

sharp saffron
#

question if i want to make custom armor with custom textures how do I add the textures can I just drag the .png files into the IDE im using? (using intellij)

lethal python
#

guys i have finished my first plugin :))))))))

warm stirrup
#

Thats so cool, congrats here is a cookie for you 🍪

maiden thicket
#

@quaint mantle for plotsquared— if i modified it and added a class inside, does the license on plotsquared require the class we added to have the header?

#

i think ur a plotsquared dev

#

i think

lethal python
#

here it is

#

png moment

lost matrix
lethal python
#

hey

#

:I

lost matrix
#

I mean it is

lethal python
#

dont u see what it's doing

#

3d hat models

#

!!

#

:)

#

:))) my own server is now running my own plugin im so cool

lost matrix
#

Feels nice, right? 😄

crisp arch
#
@EventHandler
    public void villagerCareerChangeEvent(VillagerCareerChangeEvent e) {
        System.out.println("village career change event");
}
#

nothing in console?

#

i registered the event and im placing lecterns next to the villager

#

they change outfits

sleek pond
#

I'm not too familiar with scoreboards, but why does a scoreboard objective have more than one entry (score), I thought they have 1

crisp arch
#

the objectve is the top bar

#

the title

#

the score

#

is the text

#

you can set a scoreboard score to a number

sleek pond
#

what does the "top bar" mean

hasty prawn
hasty prawn
sleek pond
#

ohhhh

#

sick

#

thanks

crisp arch
#

i registered the events

#

also the LootGenerateEvent isn't working

#

it just doesn't work

#

every other event in the class works

#

except these two

#

i think it might be bugged

modest sail
#

If im trying to get a material from a item name in this example an arrow, I'm calling Material.getMaterial("arrow"); but it seems that didnt work so I tried the adding the minecraft: namespace and that also isnt what it wants. does anyone know what exactly im supposed to pass to it?

modest sail
#

Im reading from a config, so that wont work in this case

#

I'll give that a try and let you know if it works

shell hedge
shell hedge
#

Thanks anyway 🙂

modest sail
#

That worked for me zacken thanks!

viral crag
#

it is a funny name for it either way

#

true

round elbow
#

how can i check if the type of a config value is a specific type?
is it done using
if (getConfig().get("path") instanceof Boolean) {} for example if i want to check if the type is boolean?
basically adding an extra protection step so if any admin accidently changed the config value to an invalid value i can detect it

sterile token
#

Why the heck need to check if something is a boolean??

worldly quest
#

anyone know if i can check if a player is laying down in a bed

#

right now i have stuff on PlayerBedEnterEvent but it triggers if a player right clicks it and its day tiem

#

tysm

round elbow
#

thank u

sterile token
#

Howe woudl i use Function<Supplier<T>, T> with Suppliers.supplierFunction()? So then i can pass a Supplier<String>, execute a void and then return the string of that function executed

night hound
#

how could I create a shapedrecipe that requires multiple items to be in a single slot? For example, invisRecipe.setIngredient('F', Material.ITEM_FRAME); How could I make it so this required 8 item frames?

cursive crow
#

spent 4 hours trying to figure out why my enchantment book anvil filter didn't work and then i realized enchanted books store their enchantments differently

#

all that time wasted just to make "flaming boots" incompatible with frost walker lol

unkempt peak
#

lol rip

unkempt peak
lethal python
#

how common is it for plugins to iterate through a player's entire inventory?

#

i don't want to do that because i am worried it will cause lag but if it's quite common practice then hooray

mellow gulch
#

why are you thinking of doing it? there could be better alternatives

worldly quest
#

how would i get the item a persons holding on the block place event

#

im trying to cancel players placing certain items

lethal python
#

gizmo what i'm trying to do is find any items in a player's inventory with specific custom model data

#

how common is it though, to iterate through a whole inventory

mellow gulch
#

all of the Inventory methods called like "contains..." iterate internally

#

so ya, pretty common i'd say, but how often are you planning on doing it? i'd think the frequency of the iteration would have the most significant impact

lethal python
#

yeah i wanted it to be infrequent

mellow gulch
#

for example, probably not a good idea to do it in PlayerMoveEvent

lethal python
#

i'm going to do it every time an inventoryclick event triggers in a specific slot

#

which is fairly rare

mellow gulch
#

i wouldn't expect that to be too much of an issue

lethal python
#

oky :)

main dew
#

How I can check if player is on ground?

sharp flare
#

But instead use craft item event and scan the matrix onced u clicked the result item

young knoll
#

PrepareItemCraftEvent is for removing the output if there aren’t enough stacked items

round elbow
#
public class InventoryClose implements Listener {

    @EventHandler
    public void onInvClose(InventoryCloseEvent event) {
      event.getPlayer().sendMessage("test");
    }
}

I have a code that sends a player a message in that event and i have registered the event in the javaplugin class
but it doesnt seem to be firing
when i close inventory it just doesnt send the message

young knoll
#

What inventory

round elbow
#

player's
or a gui i made
or really any inventory

#

never fires for some reason

young knoll
#

I don’t think the player inventory fires it

#

Show us your main class

delicate lynx
#

isn't player inventory client sided

#

like opening and closing

round elbow
#
public class Core extends JavaPlugin  {

    @Override
    public void onEnable() {
        INSTANCE = this;
        getDataFolder().mkdirs();
        saveDefaultConfig();
        getServer().getPluginManager().registerEvents(new InventoryClose(), this);
    }
#

only concluded the main method to not fill the chat up

#

onenable method**

lethal python
#

wat eror

round elbow
#

nvm i got it to work
I had a previous code that checked for whether or not the inventory being closed is a holder of some class I made
i think i was checking the wrong way and stopping hte code before sending the test message lmao

cursive crow
#

how can i cause an explosion that doesn't harm terrain but harms people/monsters?

#

(in minecraft)

#

nevermind i found it

unreal turret
#

Sorry for using the translation.
I created a custom item using ItemStack.
Implements Geyser for cross-play with Bedrock.
I want to apply a texture to a custom item, but the resource pack method was only valid for Java users.
For Bedrock user, is there a way to import textures directly from the plugins folder into the item?

young knoll
#

Doubt it

fossil lily
#

Anyone know why when I launch myself upwards its so much more dramatic than when I go forward on an angle?

ornate patio
#

how do I make a custom ban message

#

do I have to not use Bukkit's ban list and instead just kick the player if they try to join

hasty prawn
hasty prawn
#

Or disallow(Result, message)

ornate patio
#

should I?

#

whats the difference

#

ok here lemme try to explain

#

I'm banning the player using this

Bukkit.getBanList(Type.NAME).addBan(player.getName(), horseman, null, "ApocalypseModeration");
player.kickPlayer(horseman);
#

where horseman is a string

#

However I want that same string to be used as the custom ban message

#

if they try to rejoin

hasty prawn
#

You can use AsyncPlayerPreLoginEvent, that might actually be better.

#

Just set the disallow message to whatever horseman was

ornate patio
#

what is that method

hasty prawn
#

It prevents them from joining

ornate patio
#

oh

#
@EventHandler
public void onAsyncPlayerPreLoginEvent(final AsyncPlayerPreLoginEvent event) {
    if (event.getLoginResult() == AsyncPlayerPreLoginEvent.Result.KICK_BANNED) {
        // event.getName() is the name of the player
        String banReason = "You have been banned, this is a test";
        
        event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED, banReason);
    }
}
#

ok look here's what I have

#

problem is

#

i want banReason to be whatever horseman was

hasty prawn
#

You'll have to store it externally

ornate patio
#

damn

#

speaking of

#

what's a good way to store data like this

#

should I be using a huge yml file

#

or some kind of database like sqlite

hasty prawn
#

A database is the best option yeah

#

Otherwise JSON, then YAML

ornate patio
#

hmm ok

#

A proper database like Postgres may be hard though

#

because it’ll require the user to install it

#

I’ll just use sqlite then

ornate patio
#

or do I have to store that as well

hasty prawn
ornate patio
#

ohh

#

Bukkit doesn’t save that stuff on disk?

#

bummer

hasty prawn
#

It can using PDC

#

But you can't access that in PreLogin so

ornate patio
#

oh

#

damn alright

#

thx

cursive crow
#

is there an event that handles natural/mobspawner mob spawning?

#

i want to make monsters stronger

#

there's EntitySpawnEvent but i don't know if it distinguishes between natural/mobspawner spawns and artificial spawns like spawn eggs, etc

#

nevermind, i found "CreatureSpawnEvent"

hasty prawn
#

Yep

cursive crow
#

i'm loving java

hasty prawn
#

Apparently SpawnerSpawnEvent is also a thing, if you only need spawner mobs.

quaint mantle
#

and im pretty sure you can modify their src but not publish it as your own

#

like an unpublished fork

hasty prawn
#

It's under GNU General Public, doesn't that mean they can modify and release it?

#

I'm not sure tbh but you can definitely modify it

mellow gulch
#

depending on which flavor of gpl they also need to open source it

mellow gulch
#

ya

#

and oops, i remember now, lgpl is the one that doesn't always require to also make source available

hasty prawn
#

Licensing is confusing hypixel_sad

mellow gulch
#

gpl means source must be public

#

im glad these summary things are a thing though, otherwise it would be hard to keep it straight

hexed hatch
#

It always throws me off when there’s another Gizmo in the mix

mellow gulch
#

lol

gentle oriole
#

how do I stop a scheduleSyncRepeatingTask?

hasty prawn
mellow gulch
#

ya do that, or alternatively the tasks can cancel themselves under some condition, or you can cancel them via the int id that scheduleSyncRepeatingTask returns.

hasty prawn
#

No point in using that int though if BukkitTask is a thing

gentle oriole
#

is there a way to cancel it if a condition is true?

#

cant seem to cancel it without being initialized

mellow gulch
wispy bridge
#

You can run the cancel() method from within the runnable

#

Just have your condition there

sly trout
#

how do i make that only a certain item has a custom texture I know custommodeldata exists but I tried it and it only works with 3d models and not like pixel items yk

hasty prawn
hasty prawn
gentle oriole
#

runnable.cancel(); seems promising, ill try to see if it works

sly trout
#

how would i create a json file with my pixelated texture?

#

for the texture pack

wispy bridge
#

A text editor

#

Reminder, the custom model data value redirects the model

cursive crow
#

and it doesn't work with entities/armor

wispy bridge
#

The model can just be a generated model for your 2d texture

cursive crow
#

i love having to use leather armor as a base so i can kinda communicate what the custom armor is to users who don't have OptiFine

sly trout
#

how would i generate it?

cursive crow
#

please mojang

wispy bridge
#
{
    "parent": "item/handheld",
    "textures": {
        "layer0": "item/whateverpath"
    }
}
hexed hatch
sly trout
#

okay thank you

wispy bridge
hexed hatch
#

for a regular item not wielded like a tool or weapon, item/generated

#

for a tool or weapon, item/handheld

gentle oriole
hexed hatch
wispy bridge
hexed hatch
#

how dare you

hasty prawn
#

What's the difference between generated and handheld

wispy bridge
#

¯_(ツ)_/¯

hexed hatch
#

generated makes it show up in your hand not at an angle

cursive crow
#

also i wish they'd fix attribute text completely getting rid of tool/armor/weapon text instead of appending it

hexed hatch
#

like if you're holding a feather or ink sac

wispy bridge
hexed hatch
#

handheld makes it held like a weapon

#

or a tool

hasty prawn
hexed hatch
#

look at yourself holding a weapon and then look at yourself holding a feather

wispy bridge
#

Y'know the thing, its the way you would hold a diamond

hexed hatch
#

yep

hasty prawn
#

Ohh yeah okay I see the angle change now

mellow gulch
#

custom model data for armor, shields, and properly on tridents would be amazing

cursive crow
#

yeah

#

that's the only thing stopping my custom plugin from feeling vanilla

wispy bridge
#

Its possible through optifine RPs

cursive crow
#

yes

mellow gulch
#

i saw someone do it for shields but it couldn't use the banner patterns

cursive crow
#

well, and the fact that items don't support custom durability so i have to use my own

sly trout
#

this doesnt work any1 knows what's the issue ?

cursive crow
#

so you end up with this weird shit

sly trout
wispy bridge
#

Your predicate value literally only defines the custom model data value

sly trout
#

when i do setCustomModelData()

#

it still doesnt work

wispy bridge
#

Yes I know, your RP is just saying to override the whatever item when it has the value of 999

#

But you never say to what model

cursive crow
#
  "parent": "minecraft:item/generated",
  "textures": {
    "layer0": "minecraft:item/iron_nugget"
  },
  "overrides":
  [
        { "predicate": {"custom_model_data": 3636008}, "model": "custitems/heart_locket"},
        { "predicate": {"custom_model_data": 3636009}, "model": "custitems/totem_of_vengeance"}
  ]
}```
#

it should look more like this

#

without the bottom part, if you're using only 1 item of course

sly trout
#

I see thank you very much

wispy bridge
#

You're replacing the base texture with that, not the custom model data one

cursive crow
#

the custom model data number doesn't matter though (has to be shorter than 8 digits i think), i just used 3636

#

it can't be 0

sly trout
#

alright

cursive crow
#

i mean it does matter so you can identify the custom models, but 3636 is just a random number i chose lol

sly trout
#

just tried this and it doesnt work

#
    "parent": "minecraft:item/generated",
    "textures": {
        "layer0": "minecraft:item/prismarine_shard"
    },
    "overrides": [
        {
            "predicate": {
                "custom_model_data": 999
            },
            "model": "tutorial:item/dragon_scale"
        }
    ]
}
cursive crow
#

do you have a model json for the dragon scale

#

example for the heart locket that overrides the iron nugget file:

sly trout
#

well it redirects to the texture

cursive crow
#
  "parent": "minecraft:item/generated",
  "textures": {
    "layer0": "minecraft:custitems/heart_locket"
  }
}```
wispy bridge
#

I made a generation tool in Java for this specific task a while ago, im not sure if that'd be useful to you

sly trout
wispy bridge
#

Thats what your model json should look like

wispy bridge
#

The original model for your item

#

The one you want to replace

wispy bridge
#

(Vanilla model) -> (Your custom model) -> (The texture)

sly trout
#

I'll try that

cursive crow
#

this is how my resource pack is structured:

#

i have a "custitems" folder in my models and textures folders

#

the custitems folder in the models folder has the custom model jsons, and the one in the textures folder has the custom textures

#

How do i get a chunk's local difficulty?

wispy bridge
cursive crow
#

doesn't local difficulty take the inhabited time of chunks into account?

#

at least according to the wiki

wispy bridge
delicate lynx
#

they do, the more time to you spend in a chunk, the harder the mobs get

wispy bridge
#

That is the first time im ever hearing of that

delicate lynx
#

you could getInhabitedTime(), that's really it

#

but there isn't anything about difficulty it seems

cursive crow
#

also local difficulty seems to be broken in multiplayer

#

only goes up to like 3 or 4 instead of 6.7

delicate lynx
#

it depends on the world difficulty

cursive crow
#

I know

#

One of the old worlds from past iterations of my survival server was at least 2000 in-game days old, and the local difficulty always stayed near 3

kind hatch
#

Regarding this question I asked yesterday. I wasn't thinking clearly when I initially asked. It turns out that whether I use the player's uuid, or the cooldown name as the key, I will have to iterate over a list regardless. Unless someone has a way to do this more efficiently, is a complexity of O(n) really that bad? The only data involved is a uuid, a string, a long, and an integer.

My other issue is that I'm now wondering what the key should be. Should I have the cooldown name be the key or the player's uuid?

torn badge
wispy bridge
#

Because what if multiple players have the same cooldown?

#

But personally, I'd just store whatever cooldown in the players persistent data container

#

Or, the metadata

#

Metadata would probably be better

kind hatch
kind hatch
torn badge
#

And T are your different cooldowns?

wispy bridge
#

Should really just store the cooldown inside the player

wispy bridge
kind hatch
#

Which in my case is the UUID.

kind hatch
torn badge
#

Then why not use UUID

wispy bridge
#

Yes, you can add more than one identifier via your plugin into the players persistent data

#

But if its temporary and you dont need it to save across server reloads or anything, you might be fine with using the metadata

kind hatch
#

Oooo, that's an interesting approach. I didn't even know that was part of the Player object.

kind hatch
#

Ah, so there is an issue with using player metadata. If another plugin uses/sets the same string/key, problems can arise. While highly unlikely, it's an edge case I just really don't want to worry about. The PDC could work, it's just that I don't really need the actual persistence. 😛 I did find a way to achieve what I was originally wanting, but it feels a little jank.

Current Solution: https://paste.md-5.net/jamagekexa.java

smoky oak
#

why not make the plugin name part of the metadata key?

kind hatch
#

Because there are plenty of plugins that are named similarly to mine. (Hugs)

#

Again, extremely unlikely, but an edge case I don't want to worry about.

#

The PDC has a JavaPlugin parameter, nullifying that problem.

#

So for the time being, at least to me, it looks like the better way to go.

misty ingot
#

is there a way to still have comments in yml files with snakeyaml

wide coyote
#

not with bukkit's yaml api

kind hatch
#

Comments are saved by default if you use 1.18.1+

misty ingot
#

1.18.1 plugin
comments dont save

sullen marlin
#

saveDefaultConfig copies the actual config

#

saveConfig is what you want

misty ingot
#

ok I will try that out

#

ok yeah It didn't work

#

this is kinda how I have it in the resources folder

#

this is what I get when the plugin runs on a 1.18.1 server

#

the plugin IS made for 1.18.1

#

no errors in sight in console

kind hatch
#

Are you running the latest spigot build?

#

What does /about say?

misty ingot
#

Do I need an update?

kind hatch
#

I'd recommend trying that first.

misty ingot
#

no difference

kind hatch
#

Have you tried with spigot specifically? I can't speak for paper as I don't use it.

misty ingot
#

ok

#

no difference

#

got the latest version of spigot this time

kind hatch
#

How are you saving your config? Can you share more of your code?

misty ingot
#

literally just this

kind hatch
#

You can just use #saveDefaultConfig(). It writes your file as is to disk. You don't need to copy defaults.

#

You will want to use #saveConfig() when you make changes to it with #getConfig().set()

#

The bug that existed for years was when you called #saveConfig() it wouldn't save comments. However that's been fixed with recent updates.
#saveDefaultConfig() has always preserved comments.

sullen dome
#

i'm confused

org.bukkit.plugin.IllegalPluginAccessException: Unable to find handler list for event org.bukkit.event.player.PlayerEvent. Static getHandlerList method required!```
misty ingot
#

did you put the @ EventHandler line

sullen dome
#

yea

misty ingot
#

did you register the listener

sullen dome
#

that line is literally the one that throws the error

misty ingot
#

show me

#

the line

sullen dome
#
Bukkit.getPluginManager().registerEvents(new Protection(), this);```
misty ingot
#

have you registered any other listeners in your plugin

sullen dome
#

some

misty ingot
#

do they throw errors?

sullen dome
#

not at all

misty ingot
#

show me the others

sullen dome
#

i tried it in the onEnable normally (thats the one i sent before), and same result

kind hatch
#

When are you registering the events?

sullen dome
#

in onEnable

#

i'm not a new dev bro.

misty ingot
#

are you running the function in the onEnable()?

#

to register the listeners

sullen dome
kind hatch
#

Any reason why the method is static and getting an instance of your main class instead of just running the function in the on enable?

sullen dome
#

no i'm not
thats why this registration throws an error KEKW

misty ingot
#

tis how I do it

#

works every time

sullen dome
#

i never saw that error in my entire life

#

in my 3 years of spigot dev

#

You can't register PlayerBucketEvent, you have to use one of its sub events.
nice, didn't knew that

ivory sleet
#

Yeah

#

Same applies to PlayerEvent, Event or any event derivative which does not expose a HandlerList instance in principle

sullen dome
#

java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.getItemMeta()" because the return value of "org.bukkit.event.player.PlayerInteractEvent.getItem()" is null
java moment

smoky oak
#

what do you expect converting air into an item

sullen dome
#

hehe

#

just forgot a null check, thats it

#

also, technically it's an item mango_baller

smoky oak
#

in what version did you make that screenshot

sullen dome
#

1.18.1

smoky oak
#

the heck?

#

did you use a command or a plugin?

sullen dome
#

i dont think paper/purpur adds that itself

#

thats all

ivory sleet
#

Ye that’s normal I believe

sullen dome
#

lemme try in singleplayer

smoky oak
#

try giving enchanted air to a player

#

maybe it makes your hand better

#

😄

sullen dome
#

yea...works fine

smoky oak
#

huh

sullen dome
#

your minecraft knowledge just sux mango_pog

#

that error should get removed

#

air IS an item

#

apparently tho, it just does nothing lol

sharp saffron
#

is there a way to make custom items ie armor with custom textures without use of a texture pack

buoyant viper
#

hey guys how do i retexture the game without retexturing the game

sharp saffron
#

hmm xD true

sullen dome
#

lol

#

i mean

sullen dome
#

you can edit those items in the server jar (theoretically) and in your client-mod

#

and then, technically those textures are not in a resourcepack lol

sharp saffron
#

yea cuz i think its on forge u dont need a custom texture pack if u wanna make custom items so I was wondering if there was something similar

buoyant viper
#

tru

sullen dome
#

which renders the shit

sharp saffron
#

ahhhh

sullen dome
#

the server doesn't have anything to do with any rendering

sharp saffron
#

ah ok

sullen dome
#

so no, without server resourcepacks, it's afaik not possible

sharp saffron
#

ok ty!

trail pilot
#

Why is so hard do sqlite database

#

I need a method for read and write

quaint mantle
#

Learn sql

trail pilot
#

Like that is easy

ivory sleet
#

@trail pilot I mean give it a week or sth, should be enough to obtain adequate knowledge

low temple
#

Another db thing u can use is h2, I havent personally used it before but it can be used as a local database, so you dont need to host one

lapis widget
smoky oak
#

what's the best way to check if a block is glass? Do a EnumSet from blank glass to a differnt glass and call EnumSet.contains(Material) ?

ivory sleet
#

Pretty much.

#

Sadly there isn’t any method such as Material::isGlass

grim ice
#

endsWith Glass?

ivory sleet
#

That’s gonna be somewhat sloppy

grim ice
#

and check for spyglass

#

and those

ivory sleet
#

And for instance glass pane does not end with GLASS

#

And so, if you wanna check that you might need to pull a String::contains

#

However that would generate other issues, as all materials that contain the label glass would yield true

quaint mantle
#

Maybe there's a tag for glass

grim ice
#

there arent that many items with glass in it

ivory sleet
#

Well at most it’s just so much easier to use an EnumSet and faster

grim ice
#

only spy glass, and a glass bottle

smoky oak
grim ice
#

well ig

tired prism
#

I have a question about threads and runnables, is having every runnable on a new thread okay?

ivory sleet
#

Ugh

tired prism
#

I'm not the best with threads

smoky oak
quaint mantle
#

Use a thread pool

ivory sleet
#

You probably wanna lean towards a fixed thread pool or cached thread pool

tired prism
#

Yeah, thats what I thought, thank you

ivory sleet
ivory sleet
main dew
#

How I can check if player is on ground?

tired prism
#

Do you need to cache when dealing with data and redis or does it not really affect performance?

ivory sleet
#

what type of data?

tired prism
#

Queues, player stats

ivory sleet
#

And for redis in principle no, redis is ridiculously fast, but it might be to your benefit if you did that such that you can make your data model loosely coupled from redis if you in the future would change implementation

smoky oak
#

how do i check if a block has an inventory or can open a GUI?

ivory sleet
#

Check if a BlockState is of BlockInventoryHolder

#

(Or just InventoryHolder)

smoky oak
#

and GUI?

ivory sleet
#

?

smoky oak
#

a crafting table aint holding a inventory

main dew
#

p#openInventory(inventory)

ivory sleet
#

I mean if it has a container, then its always open-able

#

No moterius

#

But that’s because the crafting inventory is a special case

#

As you’re firmly aware of that crafting does not need any persistency data

#

Thus its actually not a container that belongs to any specific block

#

And fyi HumanEntity::openWorkbench works everywhere almost

summer scroll
#

How can I achieve to remove all NETHER_PORTAL block material in an area and then restore them back on after several seconds, I want to do this because I want to prevent player from stuck in a nether portal.

smoky oak
#

making a work-around for that seems entirely too complicated... i want to only trigger my onPlayerInteract event if they normally wouldnt do something else

#

like

#

opening a crafting bench or chest, or flick a lever

ivory sleet
#

Opening a workbench inventory and opening a chest inventory is different as already said

smoky oak
#

workaround it is

ivory sleet
#

Alr good luck

ivory sleet
grim ice
#

can i serialize a chest

summer scroll
#

By simply set the material back to NETHER_PORTAL?

ivory sleet
#

You can pretty much 2hex

ivory sleet
#

Might have to save the data and state

#

In case you wanna restore that as well

summer scroll
#

Yeah probably, okay.

#

I'll try this

#

Thanks!

ivory sleet
#

Best of luck

grim ice
#

conclure do u think its worth to make a library for it

#

its simpler than with entities so probably not

ivory sleet
#

Depends, but perhaps

grim ice
#

btw if u know, can a 1 block structure hold a entity in it

ivory sleet
#

Like, creating libraries usually enhances your pov in regards to the consumer of the library thus your code infrastructure might become more robust (:

#

1 block structure?

grim ice
#

ye

#

1.17.1 Structures

ivory sleet
#

Unsure

#

But I’d assume so

grim ice
#

ill have to test it

#

since my library rn

ivory sleet
#

Indeed

grim ice
#

uses 3 blocks

ivory sleet
#

Ah

grim ice
#

but for stuff like ravengers or what they were called

#

i cant make a whole big ass chunk

#

ill just check if it works with 1 block

ivory sleet
#

Lol yeah

#

I’m not very familiar with features and structures sadly, never got to that point when working on my fabric mods

grim ice
#

and cool thing i dont use any nms

ivory sleet
#

Yeah

#

Api is awesome

grim ice
#

structures api

#

are doing all the nbt shit for me

ivory sleet
#

😌 abstraction

grim ice
#

but not many know about structures api

smoky oak
#

i know how to spawn one but that's about it

summer scroll
#

How can I get all of the location of the nether portal block?

smoky oak
#

grab the corners of the portal then iterate in two loops through them

#

do you mean me?

summer scroll
ivory sleet
#

Yes zacken but that’s merely for glass pane

smoky oak
summer scroll
grim ice
#

make like

#

actually nvm

summer scroll
#

Do I need to get like relative block on all sides?

grim ice
#

i wanted to say check block relatives

summer scroll
#

Yeah

smoky oak
#

EnumSet.range(Material.WHITE_STAINED_GLASS_PANE,Material.BLACK_STAINED_GLASS_PANE)
contains every glass pane except GLASS_PANE (the uncolored one)

#

same with normal glass

#

the check isnt that hard

grim ice
#

tahts cool

ivory sleet
#

Aglerr you probably wanna set an upper bound in terms of how big the parameter can be

#

And then get the relatives, and if a relative happens to be the initial block then you got yourself a portal

#

Might be some edge cases but that’s the gist of it essentially

smoky oak
#

wait a sec, how fast does PlayerInteractEvent trigger

#

1/tick when holding right click?

ivory sleet
#

Myes

smoky oak
#

uuuurgh

#

okay

ivory sleet
#

It has a 20 tick accuracy

smoky oak
#

im doing a once per tick on PlayerIntearact function setting the player's upward velocity to 0.1

ivory sleet
#

Tho iirc it can be invoked more than one time per tick

smoky oak
#

issue is they dont move up

ivory sleet
#

But the accuracy won’t be better than what the server ticker allows it to be

smoky oak
#

they hop up and down

grim ice
ivory sleet
#

Like code review?

grim ice
#

ye

ivory sleet
#

I mean I’d avoid all the static to begin with

#

But that’s not really an issue for a spigot dev who just makes plugins for fun

smoky oak
#

imma test if it really is once per tick

ivory sleet
#

Because it makes your code tightly coupled basically

grim ice
#

so he's supposed to make an object?

vocal cloud
#

When you set plugin does that set a static variable? I imagine that could cause issues

ivory sleet
#

Also the api doesn’t look very abstracted but yeah

smoky oak
#

it triggers twice per tick (prob due to some uncaught thing i didnt notice) but it does trigger per tick. Can setting upwards velocity to 0.2 twice per tick cause issues?

vocal cloud
#

What happens if multiple plugins reference use it?

ivory sleet
#

Nothing happens

#

Some memory leaks could be possible

grim ice
#

shit

ivory sleet
#

But that’s like, not your fault if it happens

grim ice
#

but like

ivory sleet
#

The static there is evil due to its vulgarity

grim ice
#

its not a library u add as a plugin, so i dont understand why its a problem if many plugins use it

ivory sleet
#

(In terms of design merely)

#

2Hex yes I assume people are going to shade and relocate it

rough drift
#

wops didn't see convo

#

my b

ivory sleet
#

Lol nw

grim ice
#

so

rough drift
#

To not interrupt main chat

grim ice
#

I should not make those setters and getters static?

ivory sleet
#

I’d just have non static variables

#

Then the user can create multiple instances of those if they want to

#

They’d also be able to use the class in their tests much easier

#

Nevertheless would the user also be able to control destruction and creation of the instances at will (easier than what’s done with the usage of static)

smoky oak
#

uh
not cancelling PlayerInteractEvent causes a 4-tick delay on the next one

grim ice
summer scroll
#

Can I check If a task is already running?

quaint mantle
summer scroll
#

Ah okay, there is BukkitScheduler#isCurrentlyRunning, thanks

raw ibex
#

Is there a way to check who placed a block, or do I have to store that when it is placed?

rough drift
#

i suggest storing a HashMap<Location, UUID>

raw ibex
#

Ok

#

Alright thanks

rough drift
#

np

raw ibex
#

how do you play sounds?

#

what function

rough drift
#

iirc Player#playSound

#

lemme check tho

#

yep

raw ibex
#

oki

#

how do i choose the sound

#

like ender_dragon growl

rough drift
#

its almost the same as the in game command

raw ibex
#

oki

#

how does the volume work

rough drift
#

its... volume

raw ibex
#

ok lol

lost matrix
# raw ibex how does the volume work

The volume increases the range at which a sound can be heared. It can appear more silent for distant player but will never surpass 100%
So for 122.5F the sound will sound the same for a player that 10 blocks away as well as for a player thats 100 blocks away.

#

Negative values will be heard across the world.

hollow arch
#

Heyo,
Are there any ways to send custom-font-ed messages as titles?
I know I can use components in chat for custom 1.16+ fonts but not too sure about titles.

lavish hemlock
#

Why is that not in the docs?

raw ibex
#

how would i go about making a bedwars villager shop gui like hypixel?

lavish hemlock
#

I recommend looking at the wiki

quaint mantle
#

plugin ideas for beginners?

lavish hemlock
raw ibex
#

oki thanks

quaint mantle
#

just some simple stuff so i can practice plugin development

lavish hemlock
#

Implement a multithreaded HTTP webserver ;) /s

quaint mantle
#

bonk

#

actually perhaps i should try adding enchantments and potion effects

lavish hemlock
#

Ooh yeah that could be a decent beginner project

#

Just make sure you use a version that supports PDC (PersistentDataContainer) or you'll have to do a lot of shit manually.

quaint mantle
#

and giving the player items of the same name with different ID's. Though I don't know if items still are like that in the game. For example in the past wool used to be like: wool, id 1; wool, id 2; wool, id 3; wool, id 4;

lavish hemlock
#

Ye item IDs no longer exist/are deprecated

#

They were removed in 1.13 w/ The Flattening

quaint mantle
#

oh

#

they used to be really nice

hybrid spoke
#

make your own essentials

#

good way to practice

lavish hemlock
#

Instead it's more like green_wool, red_wool, etc.

quaint mantle
#

but it was so nice

#

so geeky

#

and remember when stone had an ID of 1

rough drift
#

technically mc still contains numeric ids somewhere

#

i remember seeing a hashmap of string id -> numeric id

quaint mantle
#

we shall access that hashmap from now on

rough drift
#

don't remember where it is tho

quaint mantle
#

i was surprised that stone had an ID of 1 though

rough drift
#

well its not a numeric id, its more an index

#

no stuff like 13:2

quaint mantle
#

like when you think of Minecraft you think grass block

lavish hemlock
rough drift
quaint mantle
#

but stone had the ID of 1

lavish hemlock
#

oh

rough drift
#

dirt is 2 iirc

#

stone is 1

lavish hemlock
#

I mean it makes sense actually

rough drift
#

wool is 13

lavish hemlock
#

since stone was the first block to be added to the game

quaint mantle
#

oh

rough drift
#

air was tho

lavish hemlock
#

air isn't really a block imo

rough drift
#

it counts 0-6000 smt

#

the 6000 range was music discs

quaint mantle
#

back when minecraft was still newer

#

and there werent as many things in the game

#

like 1.2.5

hollow arch
#

I still type //set 98 if I want the stone brick

lavish hemlock
#

back then it kinda made sense

#

nowadays there is too many blocks

rough drift
#

i mean, it was easier to get all the blocks

lavish hemlock
#

so I like that they ended up making IDs much easier to use

rough drift
#

just use a for loop

quaint mantle
rough drift
#

good point

#

whenever you type an id it goes:

string -> string to index map -> blocks/items

#

which uh, is not the greatest idea

lavish hemlock
rough drift
#

now i wonder something

lavish hemlock
#

I was never able to remember the different wool IDs lol so

#

red_wool is much more straightforward to me

#

also this system has better extensibility

rough drift
#

spigot is sending commands as a single label with a greedy string, why not just... allow parameters?

lavish hemlock
#

also theoretically you wouldn't need stuff like NotEnoughIDs just to increase the limit

lavish hemlock
quaint mantle
#

why are enchantment names so weird?

lavish hemlock
#

And Spigot doesn't really touch a lot of the stuff Bukkit does

quaint mantle
#

im assuming DAMAGE_ALL is sharpness

rough drift
lavish hemlock
#

Uhh yeah probably

quaint mantle
#

but why DAMAGE_ALL

rough drift
#

and iirc DURABILITY is unbreaking

lavish hemlock
#

Since it's an enchantment that damages all groups

#

You'd also have stuff like

rough drift
#

duh

lavish hemlock
#

maybe DAMAGE_ZOMBIES

quaint mantle
#

but we say sharpness, not damage all

lavish hemlock
#

for Smite

rough drift
#

spagit

lavish hemlock
#

spaghetti code :)

rough drift
#

yas

lavish hemlock
#

I signed the CLA a while ago yet I have not contributed to Spigot in any way

rough drift
#

CLA?

quaint mantle
#

we will give em the bonk

lavish hemlock
#

?cla

undone axleBOT
smoky oak
#

im just going to presume the enum->block mapping is a bit more efficient than the command version

rough drift
#

its basically a lib to abstract away all the boilerplate/annoying stuff

#

like figuring out which sub command to run, what the arguments are, are there optionals? etc

quaint mantle
#

you know a thousand of solutions already exist

rough drift
#

ig

summer scroll
#

Why did I get a lot of messages from a task even tho I only run it once.

if(this.getRemainingTime() == ConfigValue.PORTAL_WARN_ON){
  Common.sendMessage(this.player, "&cThe portal will be removed in 5 seconds");
  return;
}
smoky oak
#

RunTaskTimer does call the task after x ticks every y ticks

#

you probably want to only run it once

visual tide
#

/plugins/pluginname iirc

#

but just do new File(plugin.getDatafolder(), urfilename) as opposed to new File(plugin.getDatafolder() + "/" + urfilename)

summer scroll
#

I have a check If the task is already running or not

trail pilot
visual tide
summer scroll
trail pilot
#

Use scheduler if you want delay

summer scroll
trail pilot
#

It's will send after X seconds (ticks)

summer scroll
trail pilot
trail pilot
#

scheduler its what's you need xd

lavish hemlock
summer scroll
#

I know and that is what I want and also what I use

lavish hemlock
#

I mean, that'll eventually become the case when they use method handles for reflection in later versions of Java

#

but still

trail pilot
summer scroll
#

Yes

#

Preventing player being stuck in nether portal

#

So I want to remove the nether portal when player stay in the nether portal longer than x seconds and then restore the nether portal back after another x seconds

lavish hemlock
#

I'm pretty sure nether portal traps don't work anymore in newer versions

trail pilot
#

Yup

summer scroll
#

It is a request from my client

lavish hemlock
#

Lemme guess, they use 1.8?

summer scroll
#

1.18.2

#

Latest

lavish hemlock
#

...

trail pilot
#

I don't understand

lavish hemlock
#

I mean I'm not telling you to not make the plugin

#

You should, since money is money :)

grim ice
#

eitherway

#

you wanna destroy a portal

#

if the player is stuck in it?

lavish hemlock
#

But that is an idiotic thing to request in a version that doesn't suffer from issues with portal traps lol

summer scroll
trail pilot
grim ice
#

what do you need then

trail pilot
abstract root
#

hello u guys know any plugin that do this? like players will bet a number between 1-100 and at the end of the day or whatevertime u set the plugin will pick a number from 1-100 and the winner will get rewards, like lottery
i tried searching but theres no lottery like this

summer scroll
grim ice
lavish hemlock
grim ice
#

he's freelancing

grim ice
#

show code

#

ur using runTaskTimer()

abstract root
summer scroll
trail pilot
#

You should use delay something

#

For message

lavish hemlock
summer scroll
grim ice
#

@abstract root I can do that too

#

:>

trail pilot
grim ice
trail pilot
#

Obviously is repeating the message because is in the same method

grim ice
#

runTaskTimer runs the code repeatedly

trail pilot
summer scroll
#

Okay, what should I do?

trail pilot
#

an scheduler for message

grim ice
#

runTaskLater

summer scroll
#

So like schedule a task inside the runTaskTimer to send the message?

grim ice
#

no

#

runtasktimer will keep running the code

trail pilot
#
BukkitScheduler scheduler = getServer().getScheduler();
                        scheduler.scheduleSyncDelayedTask( this, () -> { 
player.sendMessage("hello")
}, 20L);```
rough drift
trail pilot
#

Lol its hard to write thing on phone

rough drift
summer scroll
#
task.runTaskTimer(this.plugin, 0L, 1L);
Bukkit.getScheduler().runTaskLater(this.plugin, () -> {
  // send message
}, delay);
trail pilot
rough drift
#

lmao

trail pilot
summer scroll
#

nahh

trail pilot
#

Then do what you want.

summer scroll
#

it's the same thing wdym

smoky oak
smoky oak
summer scroll
#

scheduleSyncDelayedTask is the same as runTaskLater just different names

smoky oak
#

ah

summer scroll
#

Originally it was scheduleSyncDelayedTask but maybe there are some confusion so they changed it to runTaskLater, and same with other methods too

grim ice
#

hey

#

anyone can help me test something

#

yes you do

smoky oak
#

I'm gonna need some context

#

different topic, why the 4 tick delay for registering PlayerIntearactEvents?

grim ice
#

can u spawn an entity from an entity object

smoky oak
#

wdym?

lavish hemlock
#

Anyone got some suggestions for good Spigot workflow?

#

I hate having to stop and start the server every time I modify my plugin

#

But I've heard reloading is like a cardinal sin

rough drift
#

and reloading with plugman is a bullet in the knee

smoky oak
#

just reloading the plugin aint a problem

#

for me at least

lavish hemlock
#

It really slows down workflow tho :p

rough drift
#

just code more at once

#

and then test it all in bulk

#

always works

lavish hemlock
#

I'd prefer to just be able to build and then see changes be reflected like snaps fingers

lavish hemlock
rough drift
#

fair fair

lavish hemlock
#

So it becomes a cycle of "Nope that didn't do anything" (small change) "Nope that..." and so on

rough drift
#

just get alot of print statements and see where they stop

lavish hemlock
#

I mean that just lets me know when something has or hasn't worked

#

Yeah but I still hear it's not a good idea since it can cause issues

#

I don't want to be confused by a bug to find out it was caused by reloading

rough drift
#

normally reloading causes memory leaks and messes up statics

smoky oak
#

uuuuuuuuuuuuuuuuurgh
can someone explain why

    public void rightclick(PlayerInteractEvent e){```
has a 4 tick delay
quaint mantle
ivory sleet
#

(Hotswapping)

lavish hemlock
#

Oh yeah DCEVM, I remember that

ivory sleet
#

Normal debug mode w/o dcevm is quite limited but still doable

lavish hemlock
#

It didn't work for me when I originally used it

smoky oak
#

doubt it

ivory sleet
#

Ah rip

smoky oak
#

the difference is a few ms at worst

#

and thats not localhost

lavish hemlock
#

Why does a 4 tick delay matter, exactly?

misty ingot
#

hey so I am trying to make a ban player command, how can I make it work on both online and offline players?

ivory sleet
#

?scheduling Check the bottom btw (: