#help-development

1 messages Β· Page 1921 of 1

tardy delta
#

ah didnt know that but sounds obvious

quiet ice
#

Indirectly via the load factor

wet breach
#
void addEntry(int hash, K key, V value, int bucketIndex) {
    Entry<K,V> e = table[bucketIndex];
    table[bucketIndex] = new Entry<>(hash, key, value, e);
    if (size++ >= threshold)
        resize(2 * table.length);
}

the code that hashmap uses for resizing

smoky oak
#

so it just doubles

#

thats fine too

worldly ingot
#

Yeah, though you can give it an initial size and a load factor if you want

smoky oak
#

load factor?

#

you mean the two in that code?

hardy swan
#

you may want to search up on how hash tables works

worldly ingot
#

No no, value from 0.0 - 1.0

#

Determines when it doubles

#

Default is 0.75 iirc

#

(75% full)

smoky oak
#

sounds like an async process

worldly ingot
#

Depends on the map lol

tardy delta
#

sounds like sync

smoky oak
#

if its sync then what's the use in doing it at .75 instead of 1.0

worldly ingot
#

No relation to synchronousy here

smoky oak
#

ah oops

worldly ingot
#

0.75 is just the most optimal value for resizing and rehashing

smoky oak
#

i confused sync and thread

worldly ingot
#

There's lots of info on this in HashMap docs iirc

#

Generally 0.75 is fine though

grim ice
#

how do i clear my clipboard

#

is there a way to remove an entry in ram

quiet ice
#

Hashtable is synced though

worldly ingot
#

Uhhh, I think you can get your clipboard history in Windows. Sec. Lemme find the keybind

quiet ice
#

(or well, all methods are synchronized)

wet breach
smoky oak
#

c moment

worldly ingot
#

Windows Key + V

#

Can delete it there

smoky oak
#

just tried it

#

you need to activate it first

worldly ingot
#

Really? lol

#

Hm. TIL

smoky oak
#

wait a sec

#

how many bits is int in java?

hardy swan
#

32

#

i hope im not Cing

quiet ice
#

this time not

#

C would be 16 or more bits

smoky oak
#

i just remembered minecraft has negative coords now urgh

hardy swan
#

short*

smoky oak
#

thats gonna be fun to implement

quiet ice
#

(what a stupid spec)

#

what do you want to achive?

smoky oak
#

temporary block

#

with no drop

#

and since blocks dont have pdcc

#

i cant just tell it 'here's a flag, you dont drop anything'

quiet ice
#

If you want to push two signed ints into a long you can use

    public static long hashPositions(int x, int y) {
        // We make use of (y & 0xFFFFFFFFL) as otherwise y values such as -1 would completely override the x value.
        // This is because `long | int` automatically casts the int to a long, where as the cast is by decimal value
        return (((long) x) << 32) | (y & 0xFFFFFFFFL);
    }
smoky oak
#

whats the reverse code for that?

grim ice
#

and crashed my pc

#

lol

quiet ice
#
x = (int) (hashed >> 32);
y = (int) (hashed & 0xFFFFFFFFL);

something along this

grim ice
#

is it something different for win 8.1

quiet ice
#

not sure how the signs work when doing this. I always use my hashing as a one-way operation

smoky oak
#

is a long big enough to hold all possible coords of a block ?

#

wait

quiet ice
#

I think so

smoky oak
#

is there a check if a block got naturally spawned?

grim ice
#

didnt work

quaint mantle
smoky oak
#

cobweb

quaint mantle
#

what?

#

how can it naturally spawn?

smoky oak
#

ever seen a mineshaft

quiet ice
#

... kids these days

quaint mantle
#

that is not naturally

quiet ice
#

Never even seen a mineshaft

quaint mantle
#

that is from the world generation bruh

smoky oak
#

uh yes it is?

quiet ice
#

Pretty naturally to me

smoky oak
#

^

quiet ice
#

So the dirt block wouldn't be natural either because it is from world gen?

smoky oak
#

well to be fair

#

that dirt was originally stone

hardy swan
#

more like, if cobwebs don't generate naturally, where do they come from?

quaint mantle
smoky oak
#

well how?

quaint mantle
#

i miss the part where that's my problem

smoky oak
#

no what i mean is that i cant recall or find any kind of method that gives me information about who placed a block

#

i dont think it gets saved

quaint mantle
#

i think the api did have a method for it?

smoky oak
#

cant find any on the api

quiet ice
#

there is no such api

#

All plugins do this themselves

vocal cloud
#

Gotta write a PDC to every block placed OMEGALUL

smoky oak
#

well thing is mike

#

blocks DO NOT HAVE THAT

undone axleBOT
quiet ice
#

Huge hashmaps and that thing. But they often prune it every two weeks or so

quiet ice
#

Temporary blocks

quaint mantle
#

so you need info about who placed blocks, not trying to check if that block is naturally spawned (from worldgen anyway)?

hardy swan
#

you can save a snapshot of the chunk

tardy delta
#

thats not an answer

quiet ice
tardy delta
#

i mean for what do you need them, i still dont understand

quiet ice
#

Well these temporary blocks should likely not get any drops or something like that

smoky oak
#

spawn cobwebs on a player
but thing is
they're not supposed to drop stuff

#

and since i cant flag a block to not drop stuff

#

im at a bit of a loss

#

blocks do have metadata but not pdc

#

which means i need some way to either delete or track them over restarts

quiet ice
#

Are these cobwebs still present when the player goes away from them?

grim ice
#

Lmao so i have an image, i opened it as a text field, made it utf 8 then went to a utf 8 to binary converter, made it binary code, then went to a binary to image converter

smoky oak
#

not supposed to

grim ice
#

made it an image and installed it

#

without previewing it

#

then i opened it

#

my pc crashed

#

LMAO

#

it didnt crash but the memory usage went to 99%

tardy delta
#

kekw

smoky oak
#

putting them on a timer and using metadata would probably help

grim ice
#

(a few minutes ago i thought it was cuz of pressing win+v)

#

why did it happen btw

#

is it cuz it tried to read binary code that doesnt show as an image

#

as an image

tardy delta
#

what was it even doing when it couldnt read it πŸ€”

quaint mantle
grim ice
#

idk the ram usage went to 99%

smoky oak
#

im on 1.18

quiet ice
#

Blocks do not have pdc

grim ice
#

then i had to take my battery off

smoky oak
#

BLOCKS have no PDC, Chunks have no metadata

#

if either would have both it'd be fine

#

but this way it's just plain dumb

quaint mantle
grim ice
#

I just removed my battery

#

it might damage my laptop cuz it was still on

#

but idk

#

i didnt care about data loss

tardy delta
#

😳

opal juniper
#

org.bukkit.plugin.IllegalPluginAccessException: Unable to find handler list for event FinishedEvent. Static getHandlerList method required!

#

wait what

#

bruh

opal juniper
#

typo

#

nvm

quaint mantle
#

you should read this

#

?xy

undone axleBOT
quaint mantle
#

before asking a question

quiet ice
#

I think you should actually read the info

vocal cloud
smoky oak
#

my ORIGINAL question was about a problem i encountered while designing my ORIGINAL solution

quiet ice
#

There is no indication of an XY problem here

smoky oak
#

then it got worse from there

quaint mantle
#

i feel like it is 😦

quiet ice
#

it is not, not at all

#

The plugin places a temp block and there should be a certain action if the block is interacted with. Not a XY problem at all

tardy delta
#

i just dont understand what you are trying :)

quaint mantle
quiet ice
#

Because that would be a workaround

quiet ice
#

But is not the actual question

quaint mantle
#

xy problem from there

hexed hatch
quiet ice
#

It is a fork of this plugin

hexed hatch
#

Ah

#

I used to love that plugin

quiet ice
#

I made it almost two years ago

smoky oak
#

I am trying to prevent getting material from nothing

#

issue is if i use metadata a restart would reset the block to normal

#

and if i store it otherwise there's... different problems

#

like if i use PDC i would need to jump through a lot of hoops to record the blocks in the chunk pdc

quiet ice
#

I personally have a HashMap<Location, Long>, whereas the Location is the location of the block and Long the time it was placed. I then remove the block at the given location if X time passed or if the server shuts down

#

I do not know how well it works with chunk unloads however

smoky oak
#

you can edit blocks from unloaded chunks iirc

quiet ice
#

But I think the server will just reload the chunk and then alter them, and the server shutdown does not need to be that quick so shrug

hexed hatch
#

Does that work? Changing a huge set of blocks onDisable?

smoky oak
#

yes

hexed hatch
#

Neat

smoky oak
#

and you usually dont need to compute physics so its pretty fast

smoky oak
#

are you using the sceduler?

quiet ice
#

Yep

smoky oak
#

well i guess that works too

#

does metadata get wiped if a chunk's reloaded?

quiet ice
#

No idea

woeful crescent
#

anyone know how to spawn an entity only visible in a certain range?

chrome beacon
#

You probably would have to handle that manually. So a runnable checking position and sending packets for spawning and despawning

woeful crescent
#

But how do I spawn a fake entity

#

like I just want to spawn an armor stand that's not actually registered with the server and then remove it later

quaint mantle
#

thats unsupported

woeful crescent
#

...yes.

#

how do i do it w/ packets?

quaint mantle
#

why packets

woeful crescent
#

it's just an armor stand with no ai that doesn't even need to be persistent

#

just a damage indicator haha

quaint mantle
#

you can do that with api

woeful crescent
#

only visible in a range

quaint mantle
#

setPersistent to false, setMarker to true, setAI to false

hexed hatch
#

Was there not a entity added in 1.18 called Marker?

#

Who's sole purpose was to be a hologram?

quaint mantle
woeful crescent
#

no but like

hexed hatch
woeful crescent
#

that's not the problem

#

im trying to make a hologram that's only sent to certain players

quaint mantle
woeful crescent
#

nah that's too slow

ivory sleet
#

have you benchmarked?

quaint mantle
#

lol

woeful crescent
#

ok sorry

#

I'm not explaining this very well

quaint mantle
#

non ticking armorstands are like, nothing for the server

#

packets are not necessary any more

woeful crescent
#

Every time an entity gets damaged, an armor stand will pop up.

quaint mantle
#

ok?

woeful crescent
#

but across the ENTIRE MAP

#

for EVERYONE

quaint mantle
#

ok

woeful crescent
#

every time something gets damaged

#

is a little much

#

plus a little distracting

#

why don't I just send a spawn entity packet once and then a remove entity later to the players that I actually want to show these armor stands to?

tardy delta
#

and that armorstand will say hello?

#

🌝

woeful crescent
#

no it'll say a damage number

#

but I really just need to know how to provide the necessary packet arguments without actually making an entity

trim creek
#

How can I set a POTION Material (Material.POTION) into a potion of strengh?

woeful crescent
#

get the meta, cast it to PotionMeta

#

modify the meta then set the items meta back to that

trim creek
#

'k I give this #### up

woeful crescent
#

?????

tardy delta
#

PotionMeta

woeful crescent
#

dude, just get the item meta

tender shard
#

ugh wtf is this lol```
[INFO] --- specialsource-maven-plugin:1.2.2:remap (remap-spigot) @ Emoji ---
[WARNING] The metadata C:\Users\mfnal.m2\repository\org\spigotmc\minecraft-server\1.18-R0.1-SNAPSHOT\maven-metadata-jeff-media-gbr.xml is invalid: entity reference names can not start with character '&' (position: START_TAG seen ...tion(e,a,t){var n,r,o,i=a.createElement("canvas"),p=i.getContext&&... @16:72)
[WARNING] The metadata C:\Users\mfnal.m2\repository\org\spigotmc\spigot\1.18-R0.1-SNAPSHOT\maven-metadata-jeff-media-gbr.xml is invalid: entity reference names can not start with character '&' (position: START_TAG seen ...tion(e,a,t){var n,r,o,i=a.createElement("canvas"),p=i.getContext&&... @16:72)
Adding inheritance C:\Users\mfnal.m2\repository\org\spigotmc\spigot\1.18-R0.1-SNAPSHOT\spigot-1.18-R0.1-SNAPSHOT-remapped-obf.jar
java.util.zip.ZipException: zip END header not found
at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1469)
at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1477)
at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1315)
at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1277)
at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:709)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:243)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:172)
at java.base/java.util.jar.JarFile.<init>(JarFile.java:347)
at java.base/java.util.jar.JarFile.<init>(JarFile.java:318)
at java.base/java.util.jar.JarFile.<init>(JarFile.java:298)
at net.md_5.specialsource.Jar.init(Jar.java:242)
at net.md_5.specialsource.Jar.init(Jar.java:222)
at net.md_5.specialsource.mavenplugin.RemapMojo.execute(RemapMojo.java:193)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)

tardy delta
#

(PotionMeta) itemMeta

quiet ice
#

maven moment

tardy delta
#

whoa lol

karmic grove
#

is there a way to make so you dont have to run buildtools to build a plugin

quiet ice
#

to be fair, maven is not at fault here but rather a plugin which could do the same thing in a gradle env if it was to support it

trim creek
tender shard
trim creek
#

I hit my keyboard for no reason because of that

#

And I won't continiue that

tender shard
#

PotionMeta meta = (PotionMeta) item.getItemMeta();

trim creek
#

Don't care.

tender shard
trim creek
#

I realised I don't need it either.

#

I am just happy that the alpha is finally playable.

#

Even if there is only one kit.

quaint mantle
#

1k armorstands in a single place

tardy delta
#

sometimes im just thinking...

quaint mantle
#

20 tps

maiden thicket
#

why

spiral light
#

512 MB RAM O.o

chrome beacon
tardy delta
#

really..

#

ow right you're correct

quaint mantle
tardy delta
#

forgot about maven

quaint mantle
#

You will not recieve any benefit from using packets. Just breaking on every version. We're in 2022

tender shard
#

anyone knows what event I can use to add fake players to tabcomplete and tablist?

#

I can't just create "normal" fake players because the players must have special chars in their name

chrome beacon
#

You will have to send packets then

#

The player info packet should work

tender shard
wary harness
#

is it possible to check if player is in third person?

quaint mantle
#

nah

tender shard
#

that's client sided

wary harness
#

hm

chrome beacon
karmic grove
tender shard
#

there's a maven repo for spigot-api

chrome beacon
karmic grove
#

its gradle btw

chrome beacon
#

Gradle still uses maven repos

quaint mantle
#

thats really nice about gradle tbh

tender shard
karmic grove
#

yes but the build dont work unless the person runs build tools thats all i know bro

chrome beacon
#

show your build.gradle

#

Also make sure not to be using NMS

karmic grove
#

ok

#

?paste

undone axleBOT
karmic grove
tender shard
#

you never mentioned that you're using spigot as artifact

karmic grove
#

oh

#

do i not need to do that

chrome beacon
tender shard
#

in 99% of cases you only need spigot-api

#

however why don't you just run buildtools once? πŸ˜„

karmic grove
#

im fine with that but since its open source the owner dont want that to be nessacarry

opal juniper
tender shard
karmic grove
#

uhh ok ill try

steady rapids
#

Hello does anyone know an alternative to block users from clicking a menu? for some reasons this is not working....

    public void onPlayerInvClick(InventoryClickEvent e) {
        Player player = RecipeSigns.plugin.getServer().getPlayer(e.getWhoClicked().getName());
        if (RecipeSigns.plugin.viewingSign.containsKey(player)) {
            Chat.printChatMessage(player.getName());
            Chat.printChatMessage("cancelled1");
            e.setCancelled(true);
        
    }```
https://sapu.freevirus.click/vJVMWYFb
#

sorry for the link, it's a video i though it had a preview here

chrome beacon
chrome beacon
tardy delta
#

why getting the player based on the player who clicked

spiral light
#

well that link...

#

dk

tardy delta
#

nice link tho

lofty fern
#

!services

#

!service

tardy delta
#

?services

undone axleBOT
lofty fern
#

Thanks

tardy delta
#

i mess up that prefix too

grim ice
#

how does Base64 work

#

BRO

#

H is SA==

#

HH is SEg=

#

tf

#

i want to learn it but its so hard

chrome beacon
#

It's binary (base 2) converted to base 64

grim ice
#

ohhhh

#

it converts binary not the actual letters

#

ig

quaint mantle
#

it takes bytes actually

steady rapids
chrome beacon
ancient jackal
#

making a plugin for easier shearing

Gets a list of all entities within 3 blocks of the sheared animal, iterates through the list, and fires another shear event on every animal of the same instance

    private boolean onEventAlready = false;
    @EventHandler
    public void OnEntityShear(PlayerShearEntityEvent event) {

        if(onEventAlready) return;

        System.out.println("Shear event fired");
        onEventAlready = true;

        Entity animalType = event.getEntity();
        Location animalLocation = animalType.getLocation();

        Player player = event.getPlayer();
        ItemStack usedShears = event.getItem();
        EquipmentSlot usedHand = event.getHand();

        List<Entity> nearbyEntities = (List<Entity>) Objects.requireNonNull(animalLocation.getWorld()).getNearbyEntities(animalLocation, 3, 3, 3);
        System.out.println("Collected list of nearby entities");


        System.out.println("Looping through entities");
        for(Entity animal : nearbyEntities) {
            if(animal instanceof Sheep) {
                System.out.println("Entity is a sheep, firing shear event");
                Bukkit.getPluginManager().callEvent(new PlayerShearEntityEvent(player, animal, usedShears, usedHand));
            }
        }
        onEventAlready = false;

    }```
problem is that the console correctly prints ``Entity is a sheep, firing shear event`` but no sheep is sheared nearby
young knoll
#

Firing the event does not shear the sheep

ancient jackal
#

ah shoot, cant believe I overlooked that

young knoll
#

You still have to do that

ancient jackal
#

that's what happens when a sheep is sheared, mb

#

thank you

tardy delta
#

just cancelling the event

#

did you register your listener?

young knoll
#

You know you don’t need that weird getPlayer stuff

#

You can just cast HumanEntity to player

steady rapids
#

but I really have no idea what other plugin could mess it up

tardy delta
#

does your viewingSign collection contains the player?

steady rapids
#

yeah

tardy delta
#

are you sure?

steady rapids
#

it prints the name, then it print cancelled

#

and then it should cancell it

#

can u come and see in general1? :D

tardy delta
#

set the priority to highest

#

no i cant

steady rapids
#

k

steady rapids
tardy delta
#

@EventHandler(priority = EventPriority.HIGHEST)

#

and change that player to (Player) event.getWhoClicked()

steady rapids
tardy delta
#

anyways whats the difference between 1.17 and 1.17.1?

steady rapids
#

does this regulate the priority in my plugin only? or between other plugins too?

tardy delta
#

uhm what does regulate mean

#

some plugin is un-cancelling your event i guess

steady rapids
#

yeah

#

thx

opal juniper
#
java.lang.ArrayIndexOutOfBoundsException: Index 16 out of bounds for length 16
at org.bukkit.craftbukkit.v1_18_R1.CraftChunkSnapshot.getBlockType(CraftChunkSnapshot.java:83)
#

anyone know why this is happening

tender shard
opal juniper
#

The confusing bit is that i seem to be getting the coords:X: 12 Y: 256 Z: 1

tardy delta
#

are you working with chunk coords?

tender shard
#

you can't access the 17th object when there are only 16, obviously^^

opal juniper
#

oh it it seems the issue is that i was checking 256

#

yeah

#

i didnt think about the y

eternal oxide
#

Arrays index at zero, so entry one is [0]

opal juniper
#

yeah ik that

#

i just didnt think that 256 would be the 16th element tbh

#

17th*

tardy delta
#

but what's the difference between the 1.17 and 1.17.1?

tender shard
#

check the changelog

tardy delta
#

so there is a 1.17 version without the .1 after it?

tender shard
#

erm yes?

tardy delta
#

ah i thought it started at 1

tepid crater
tardy delta
#

aah java 16 pain

quaint mantle
#

Java 16 = god bruh

tardy delta
#

i mean i used mc 1.16 always before

#

where can i download it tho

#

m on oracle site

young knoll
#

?java16

undone axleBOT
tardy delta
#

and whats the difference with the oracle ones

pine forge
#

Are build tools only installed in the folder with the jar or somewhere else as well?
Is there a way to remove them completely (for testing purposes)

tardy delta
#

is it even this one?

young knoll
#

And the final jar is put in your local maven repo

pine forge
#

Ahh where is that repo

#

located

unkempt peak
#

C:\users\user\ .m2

tardy delta
#

i saw eclipse and thought what

pine forge
#

C:\users\user\ .m2 \repository\org\spigotmc

#

thanks

young knoll
#

Yes Adopt Open JDK is now called adoptium and hosted by eclipse

fervent gate
#

Does constantly changing the pdc of a player lag the server?

eternal oxide
#

no

#

but it will depend how much you are changing

fervent gate
#

Well, trying to make a skill plugin

tardy delta
#

something says me that it is a bad practice

fervent gate
#

And I would put it in a pdc

young knoll
#

Store it in memory

eternal oxide
#

pdc is memory resident, until the Player object is saved

young knoll
#

Save when needed

eternal oxide
#

or chunk

tardy delta
#

or tilestate ._.

young knoll
#

I mean I guess PDC is already in memory, just feels weird to be interacting with it constantly

fervent gate
#

Where would you save it instead?

eternal oxide
#

pdc is perfect for a skill system

fervent gate
#

But not in the player?

eternal oxide
#

just keep teh data you put in it to a minimum

#

yes on the Player

fervent gate
#

mk

young knoll
#

I still like using external stuff because you can save it when you want to

#

Less data loss

eternal oxide
#

Like, don;t store a book on the player

young knoll
#

But that’s not really a huge concern

eternal oxide
#

you can call Player.save

unkempt peak
#

Yeah if it's alot of data i would atleast backup everything to a yml or mysql db when the server shuts down / restarts

fervent gate
#

I would save it to a db for all players every 5 minutes ish, is that a good idea?

young knoll
tardy delta
eternal oxide
#

just store in Players PDC and let the server handle the saving

tardy delta
#

but skulls is that a few strings that you need?

#

to reconstruct them

fervent gate
#

few skills and numbers

#

strings*

eternal oxide
#

He said Skill system, not Skull

tardy delta
#

ah skill bruh

unkempt peak
fervent gate
#

mk

#

thx

sterile token
#

T <T> cast(T object, T clazz) throws IOException { object.cast(clazz)}

unkempt peak
sterile token
#

I explain

#

I have an Interface that extends Serializable

#

Im trying to cast the received packet to class Object

#

Do I have explained?

unkempt peak
#

I might be wrong but I don't think you can cast an interface to an object

sterile token
#

Cuz for receiving im using ObjectInputStream reading from ByteArrayInputStream

#

Let me explakn avΓ­an

#

Again,

#

I received an object from Stream#read(). An im trying to cast that object to packet object

tardy delta
#

hmm nice

sterile token
#

Wha tthst?

tardy delta
#

server memory usage

ivory sleet
#

What jvm args are you using? :0

tardy delta
#

one to two gigs lol

ivory sleet
#

Oh nothing else?

#

Alr

tardy delta
#

nah

ivory sleet
#

Okie uwu

tardy delta
#

._.

modern plank
#

is there a randomtickevent of some sort

young knoll
#

No

modern plank
#

😭

tardy delta
#

plugins logger doesnt like color codes

#

thats why i never use it

young knoll
#

You don’t need colors in logging

tardy delta
#

i want

young knoll
#

Logging should be plain and straightforward

neon minnow
#

How do you add names to itemstacks?

inventory.addItem(ItemStack(Material.DIRT))

tardy delta
#

so its notable

tardy delta
#

nice constructor too

young knoll
#

Get the meta from the stack, set the name, and set the meta back to the stack

neon minnow
#

@tardy delta Why you reacting to my message

neon minnow
#

Im using kotlin

tardy delta
#

i dont think ItemStack(Material.DIRT) is a constructor

young knoll
#

Kotlin probably lets you skip the new

tardy delta
#

ah kotlin..

#

im confused all the time

left swift
#

How can i set damage for certain entity?

tardy delta
#

entity.damage(amount)

young knoll
#

Attack damage?

#

getAttribute(Attribute.whatever it is) and work from there

tardy delta
#

hehe time for a nap

left swift
left swift
young knoll
#

Iirc must be a living entity

tardy delta
#

isnt it (Damageable) or is that something else

#

living entity prob

young knoll
#

Maybe

#

Not really sure what entity is damagable but not living

pine forge
#

Is there a way to compile a minecraft plugin without running build tools first?

left swift
#

It's PathfinderMob ~ EntityCreature

tender shard
tardy delta
#

πŸ˜‚

ancient jackal
#

is there a quicker way to do this or a method that already exists to do this for me? I'm just getting the correct wool color to drop

                Material woolType;
                switch (((Sheep) animal).getColor()) {
                    case RED:
                        woolType = Material.RED_WOOL;
                    case BLUE:
                        woolType = Material.BLUE_WOOL;
                }```
still verge
#

ive been trying all day

young knoll
#

Did ya run buildtools

quaint mantle
buoyant viper
#

unless u want to use NMS, then u need buildtools

still verge
ancient jackal
young knoll
#

You need to run buildtools

still verge
#

is there a way to make it so i dont need build tools?

spare prism
young knoll
still verge
young knoll
#

Change your dependency to spigot-api

still verge
#
    compileOnly("org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT")
    compileOnly("org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT")```so i should remove the top one?
young knoll
#

Yes

still verge
#

alr

young knoll
#

Why do you even have a dependency on two different versions anyway

still verge
#

o i didnt even realize that

#

now im getting a ton of errors that look like this when trying to build:

C:\Users\REDACTED\Downloads\geeksmp-master\src\main\java\com\commandgeek\GeekSMP\commands\CommandAfk.java:12: error: pattern matching in instanceof is not supported in -source 8
        if (!(sender instanceof Player player)) {
```
young knoll
#

Your source is set to java 8

still verge
#
    compileJava {
        sourceCompatibility = JavaVersion.VERSION_1_8.toString()
        targetCompatibility = JavaVersion.VERSION_1_8.toString()
    }

    compileTestJava {
        sourceCompatibility = JavaVersion.VERSION_16.toString()
        targetCompatibility = JavaVersion.VERSION_16.toString()
    }```
#

VERSION_1_8 -> VERSION_16?

young knoll
#

Yes

tardy delta
#

can anyone show an example on how to use hex colors in 1.16+?
i saw "(&?#[0-9a-fA-F]{6})" and "#[a-fA-f0-9]{6}" being used as a hex color pattern so is it used with a & before it?

still verge
#

now this:

import net.minecraft.network.protocol.Packet;
                                     ^```
young knoll
#

The internal format spigot uses is

#

&x&r&r&g&g&b&b

young knoll
#

Therefor you must run buildtools

tardy delta
#

i thought it was to support normal &f color codes too

still verge
young knoll
#

Sure

still verge
#

sry that im asking stupid questions, i didnt make the plugin, just trying to fix the gradle

young knoll
#

Remove anything that imports net.minecraft

still verge
#

thank you!

pine forge
# buoyant viper yeah u can just use gradle or maven and add spigotmc repo + spigot-api dependenc...

I tried that but i receive this error

> Could not resolve all files for configuration ':compileClasspath'.
> Could not find org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT.
     Searched in the following locations:
       - https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/maven-metadata.xml
       - https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/spigot-1.17.1-R0.1-SNAPSHOT.pom
       - https://oss.sonatype.org/content/groups/public/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/maven-metadata.xml
       - https://oss.sonatype.org/content/groups/public/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/spigot-1.17.1-R0.1-SNAPSHOT.pom
       - https://libraries.minecraft.net/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/maven-metadata.xml
       - https://libraries.minecraft.net/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/spigot-1.17.1-R0.1-SNAPSHOT.pom
       - file:/C:/Users/emili/.m2/repository/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/maven-metadata.xml
       - file:/C:/Users/emili/.m2/repository/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/spigot-1.17.1-R0.1-SNAPSHOT.pom
       - https://repo.maven.apache.org/maven2/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/maven-metadata.xml
       - https://repo.maven.apache.org/maven2/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/spigot-1.17.1-R0.1-SNAPSHOT.pom
     Required by:
         project :

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html```
#

wait

#

you dont need build tools for the api, but you do need it if you wanna import spigot right?

young knoll
#

Yes

pine forge
#

So this doesnt work
'org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT'
But this works
'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'

#

Without buildtools

ancient jackal
#

how do I use the Damageable interface with an ItemStack item? usedShears.setDamage(usedShears.getDamage()-1);

pine forge
#

i see

young knoll
#

Get the meta and cast

tardy delta
#

im not sure if this is a valid jdbc url
jdbc:h2:file:./plugins\MagmaBuildNetworkReloaded\database shouldnt be all slashes be backslashes

chrome ferry
#

Does anyone know why it adds that {"extra":[{ thing there and how i can prevent it from adding that if there is no colours there

tardy delta
#

is it true that Path.resolve creates a file?

#

it doesnt seem to

spare prism
#

Why do I receive Steve's player head?

        ItemStack skullItem = new ItemStack(Material.PLAYER_HEAD, 1);
        skullItem.setDurability((short) 3);
        SkullMeta skullMeta = (SkullMeta) skullItem.getItemMeta();
        skullMeta.setOwningPlayer(Bukkit.getOfflinePlayer(UUID.fromString(Main.getInstance().getConfigManager().getConfig().getString("SoulHeadOwner"))));
        skullItem.setItemMeta(skullMeta);
tardy delta
#

and it says that this isnt a valid jdbc h2 driver
jdbc:h2:file:./plugins/MagmaBuildNetworkReloaded/database

chrome ferry
#

because its not

tardy delta
#

the file isnt created yet idk if thats the issue

chrome ferry
#

1, you need to create the file

#

2, you need to add the extension to it

#

jdbc:h2:file:./plugins/MagmaBuildNetworkReloaded/database.h2 for example

#

anyway, not sure why you're using the ./plugins/etc... when u can just use plugin#getDataFolder

tardy delta
#
Path path = plugin.getDataFolder().toPath().resolve("database");
            jdbcUrl = MessageFormat.format("jdbc:h2:file:./{0}", path).replaceAll("\\\\", "/");```
#

im having this

chrome ferry
#

but... why?

tardy delta
#

because manya told me to use this ._.

grim ice
#

but u will need nbt

#

so u will need nms

#

or u prob alr have nms

sterile token
#

Lol

chrome ferry
#
File file = new File(plugin.getDataFolder(), "database.h2");
if (!file.exists()) {
  file.getParentFile().mkdirs();
  file.createNewFile();
}
connection = DriverManager.getConnection("jdbc:h2:" + file.getAbsolutePath())
tardy delta
#

@quaint mantle xd

chrome ferry
#

i mean if the parent hasn't been created

#

then yes

tardy delta
#

im working with hikaricp too

sterile token
#

Oh

chrome ferry
#

i dont think u need to put urls then

sterile token
#

Why using Hikari?

chrome ferry
tardy delta
chrome ferry
#

its annoying because i wanna use ItemStack#isSimilar, but its not comparing it properly because of the vanilla names and spigot names

quaint mantle
grim ice
#

then make your own method for that

#

that returns an itemstack without that extra thingy

tardy delta
grim ice
#

I dont see how thats a problem

young knoll
#

Does Hikari not handle creating the file with h2?

tardy delta
#

it seems it isnt

young knoll
#

Does with SQLite

tardy delta
#

or i am doing it wrong

ancient jackal
#

Trying to damage the pair of shears used when mass shearing sheep. setDamage doesn't set damage because the console will repeatedly print out Shears damaged. Current Damage: " + usedShearsMeta.getDamage() despite usedShearsMeta.setDamage(currentDamage+1);

                // Makes sure the shears are alive. If they are broken, will stop shearing the sheep
                Damageable usedShearsMeta = (Damageable) usedShears.getItemMeta();
                if(usedShearsMeta == null || usedShearsMeta.getDamage() <= 0) {
                    System.out.println("Shears broken, breaking loop because we can't gather wool anymore");
                    break;
                }
                int currentDamage = usedShearsMeta.getDamage();
                usedShearsMeta.setDamage(currentDamage+1);
                System.out.println("Shears damaged. Current Damage: " + usedShearsMeta.getDamage());```
chrome ferry
#

isnt the url optional with that library ?

sterile token
#

Who uses HikariCP lmao

chrome ferry
#

idk lmao

sterile token
#

I never used Mysql, Sqlite or H2 with hikarΒ‘cp

spiral light
chrome ferry
sterile token
#

Its like using a ferrari with cheap petrol

#

πŸ€”

chrome ferry
#

lmfao

young knoll
#

Hikari is fine

#

No idea what you’re on about

chrome ferry
#

why not use the built in driver connector in java?

ancient jackal
sterile token
#

It works really week

young knoll
#

Because that’s not a connection pool

sterile token
#

Hhahaa

chrome ferry
#

well

spiral light
chrome ferry
grim ice
#

usedShears.setItemMeta(usedShearsMeta);

#

yes

mortal hare
#

i love it how mojang named PacketDataSerializer a FriendlyByteBuf πŸ™‚

#

it is really friendly

young knoll
#

Yeah you can invite him over for a nice spot of tea

sterile token
mortal hare
#

That's from NMS

sterile token
#

Ah

mortal hare
#

with mojang's mappings on

sterile token
#

Idk what its mappings on

mortal hare
#

its an utility class for NMS to parse packet data into buffer

sterile token
mortal hare
#

technically yes

#

its an extended class

sterile token
#

dovidas

mortal hare
#

of ByteBuf

sterile token
#

Do you agree with this?

mortal hare
#

with what?

tardy delta
sterile token
#

Im working on plugin for bungee and spigot side. For sending and receiving cross network data. Without using plugin message, sockets or message brokers (Redis, RabbitMQ)

sending = stream -> buffer -> bytes -> stream -> deserializer -> data
receiving = data -> serializer -> stream -> bytes -> buffer -> stream

#

That its how some recommend me have an idea

#

I will be working over the Netty instance from Spigot and Bungee side

#

Haha

mortal hare
#

but why

sterile token
#

That they are clowns

#

And they dont want to do their cross server core, using Redis or RabbitMq

#

Because they said that they dont truth on the authors, they extra infrastructure, they are really clowns

quaint mantle
quaint mantle
#

what's your url

tardy delta
#

i had this jdbc:h2:file:./plugins/MagmaBuildNetworkReloaded/database

#

but i'll try again

quaint mantle
#

why wouldnt just use mine? πŸ™‚

ancient jackal
#

shears damage

young knoll
#

String url = "jdbc:sqlite:" + dataDir.getAbsolutePath() + "/" + fileName + ".db";

sterile token
quaint mantle
sterile token
tardy delta
#

so it doesnt work with relative path?

sterile token
#

Idk

young knoll
#

Yes I’m not using a string builder on something that will be ran once at startup

#

Terrible

tardy delta
#

ill try with absolute path

sterile token
#

Yeah try with that

ornate hollow
#

Is there a good guide on how to update my plugin from 1.17 to 1.18

tardy delta
#

not sure if using \ instead of / messes things up

young knoll
#

Shrug

#

Maybe I should be using File.separator

ornate hollow
tender shard
#
@FunctionalInterface
public interface ThrowingFunction<T,R,E extends Exception> {
    R apply(T t) throws E;
}

It's beautiful

ornate hollow
#

Always do File.separator

young knoll
#

Meh

sterile token
tender shard
young knoll
#

Don’t have to when using the File constructors

#

Java will deal with it

tender shard
sterile token
ancient jackal
#

?paste

undone axleBOT
tardy delta
#

ill try with this
"jdbc:h2:file:" + file.getAbsolutePath();

sterile token
tardy delta
#

eeeeehm

sterile token
#

and if not file.createNewfile()

sterile token
chrome ferry
ornate hollow
#

jdbc:mysql://localhost:3306/db_name this is how i do mysql, here you need the :// since that is a uri

tardy delta
#

File#toString returns the File#getPath

#

thats mysql, not a local file

chrome ferry
#

nvm my brain

tardy delta
#

uhm

"jdbc:h2:file:" + File.separator + file.getAbsolutePath();```

Failed to get driver instance for jdbcUrl=jdbc:h2:file:\C:\Users\27747\OneDrive - Collegewaregem.be\Hosted\Vulcano Lands\plugins\MagmaBuildNetworkReloaded\database.h2```

#

without the separator ill try

#

is it the correct one?

#

it creates my file as a folder :/

#
File file = new File(plugin.getDataFolder(), "database.h2");
            if (!file.exists()) {
                try {
                    file.mkdirs();
                    file.createNewFile();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }```
visual tide
#

getParent.mkdirs

quaint mantle
#

h2 should be capable of creating file by itself

#

if it doesnt, there's probably something wrong

ivory sleet
tardy delta
#

heh

ivory sleet
#

?justask

undone axleBOT
tardy delta
kind hatch
#

I'm running into a weird issue. I made an update to something completely unrelated to inventories and my system for toggling between itemstates has just seem to break around one specific player head. My initial thoughts are that something is wrong with the way I create player heads, but I have other GUIs that use the same exact method.
This is the error: https://paste.md-5.net/gisacomara.cs
I doubt there is something wrong with how I create the heads: https://paste.md-5.net/idinecowab.cpp

I'm wondering why it also looks like an ArrayOutOfBoundsException. The list has multiple items and it rolls over if it reaches the end. It also works just fine for other items.

sterile token
#

I will recommend reading the javadocs or spigot site about creating commands

tardy delta
quaint mantle
tardy delta
#

no

sterile token
#

Thats why

tardy delta
#

how do i do that?

sterile token
#

I dont know i never used HikariCP

tardy delta
#

ah there's a method on the datasource but to what should i set it?

sterile token
#

That why

#

If you are just beginer your best alternative its to understand how the APi works

tardy delta
#

i think you need a h2 depdency too

ornate hollow
#

What is the latest sprgot api version, i need it for my pom.xml

sterile token
#

Wait

tardy delta
#

thats not the method

sterile token
#

Why using a command with a Listener?

#

πŸ€”

tardy delta
#

String[] at the back

sterile token
#

And have you seen that name?

tardy delta
#

also hovering over the error is something

sterile token
#

I think is really new

#

He just started with the API without knowing the basics from the IDE and Java

#

πŸ˜‚

#

?

#

Are you native Speaker?

tardy delta
#

you?

sterile token
#

Cuz i dont understand your language

quaint mantle
sterile token
#

Do you the basics about an IDE and Java API?

tardy delta
#

@quaint mantle do i need to add the h2 driver dependency in my pom to be able to use the driver?

sterile token
#

Literally you have spin poof him

#

I will ignore the problem, cuz i wanna throw my computer outside my windows

tardy delta
#

this one?
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>

sterile token
#

Does SpigotAPI contains Netty library or only the Spigot?

spiral light
#

?learnjava

undone axleBOT
sterile token
pine forge
#

Hey, im trying to build my plugin with gradle but apparently it cant find the spigot-api dependency. Heres the error:

Searched in the following locations:
    https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.17.1-R0.1-SNAPSHOT/spigot-api-1.17.1-R0.1-20210903.091420-65.jar

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

and my build.gradle

repositories {
    maven {
        name = 'spigotmc-repo'
        url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
    }
    maven {
        name = 'sonatype'
        url = 'https://oss.sonatype.org/content/groups/public/'
    }
    maven {
        name = 'protocollib'
        url = "https://repo.dmulloy2.net/repository/public/"
    }

    mavenLocal()
    mavenCentral()
}

dependencies {
    compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
    compileOnly group: "com.comphenix.protocol", name: "ProtocolLib", version: "4.7.0";
    implementation 'org.javacord:javacord:3.4.0'
}```
ivory sleet
#

I have seen that before

#

Idr if it was some issue with the snapshotting honestly

pine forge
#

Where does this version come from
20210903.091420-65

#

thats what its trying to find

ivory sleet
#

Snapshot version or sth

#

Like thing is

pine forge
#

hmm it doesnt exist

ivory sleet
#

Normal builds don’t let you republish

ivory sleet
#

However snapshots let you re-release a new build without changing version

#

And there seems to be an issue there

#

Some version mismatch

pine forge
#

what can i do to prevent that

tardy delta
#
java.lang.RuntimeException: Failed to load driver class org.h2.Driver in either of HikariConfig class loader or Thread context classloader```
#
Failed to load driver class org.h2.Driver from HikariConfig class classloader org.bukkit.plugin.java.PluginClassLoader@299ad93c```
ivory sleet
#

But I’d suggest, maybe use spigot and not spigot-api

tardy delta
#

lets try setting a dependency

pine forge
ivory sleet
#

there's no big difference in reality

pine forge
#

I have my reasons

#

complicated

ivory sleet
#

lets see if I get that issue btw

pine forge
#

Im basically trying to build the plugin without having to run buildtools

#

Which means i can only use spigot-api

sterile token
#

STOP spamming

#

Here you are not paying for asking inmediatly help

ivory sleet
#

yikes

#

it works fine for me @pine forge

tardy delta
#

i dont care if you pay me 20 bucks tho 🀑

#

finally h2 works

#

and now i have syntax exception

ivory sleet
#
plugins {
    `java-library`
}

group = "me.conclure"
version = "1.0-SNAPSHOT"

repositories {
    maven(url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
    mavenCentral()
}

dependencies {
    compileOnly("org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT")

    testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
    testImplementation("org.mockito:mockito-core:4.3.1")
    testImplementation("net.jodah:concurrentunit:0.4.6")
    testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
}

tasks.getByName<Test>("test") {
    useJUnitPlatform()
}

java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))

tasks.getByName<JavaCompile>("compileJava") {
    options.apply {
        release.set(17)
        encoding = "UTF-8"
    }
}
``` @pine forge
#

used this

#

also

#

make sure to invalidate your caches x)

#

(yes its kotlin dsl, tho im certain you can translate it into groovy dsl equivalence)

pine forge
#

gradle clean build?

ivory sleet
#

well

#

invalidating caches is sth more like

#

^

tardy delta
ivory sleet
#

lol

pine forge
#

okay

opal juniper
#

conclure tool box 🀩

ivory sleet
#

yup

#

x)

pine forge
#

Which should i check

#

Ive never done this before

ivory sleet
#

I usually check every single one of them

pine forge
#

everything*

kind hatch
pine forge
#

same issue

ivory sleet
neon minnow
#

how can i use scoreboards and scoreboards for tablist prefixes at the same time? when i try scoreboard conflicts (no errors) but then nothing comes up on tablist just empty, but scoreboard works. Cant have both? how to solve this issue

tardy delta
#

lets check database normalisation on my own database ready to find poor design

shell breach
#

Sorry for the dumb question, but where's the file that I should be passing to SpecialSource in the --srg-in parameter? I tried passing in 1.18.1.json, which is in the same dir as the jar I'm deobfuscating, but it just gave me an error:

java.lang.IllegalArgumentException: Unable to parse srg file, unrecognized mapping type in line={"arguments": {"game": ["--username",...
kind hatch
tardy delta
#

would it make sense to migrate the database to another type if the user changes the storage method in the config

#

or just keep getting it from the method where it is stored in

kind hatch
#

It would, but it might be easier to make an export command and have the user reimport the data.

tardy delta
#

so not config based type?

#

sounds better

kind hatch
#

To clarify, it would also act as a way to verify that the user actually wants to move the data to the new database.

#

So if someone changes the setting in the config, the plugin will use a blank database. Once the user imports the data, it'll be like nothing ever changed.

tardy delta
#

but if the user doesnt import, the plugin wont be able to find the data

kind hatch
#

It also lets users try things out with a new database setup and possibly start over with something new.

sullen marlin
kind hatch
tardy delta
#

depending on how big the db has become, that may take alot of time

#

but i think its better than letting the users import everything

kind hatch
#

That's why I like having the user manually export and import.

tardy delta
#

users are problems lol

kind hatch
#

It may be an extra step, but it can prevent some headaches.

tardy delta
#

not fool proof

#

:D

ancient jackal
#
            // Makes sure the shears are alive. If they are broken, will stop shearing the sheep
            Damageable usedShearsMeta = (Damageable) usedShears.getItemMeta();
            if (usedShearsMeta == null || usedShearsMeta.getDamage() <= 0) {
                System.out.println("Shears broken, breaking loop because we can't gather wool anymore");
                break;
            }
            usedShearsMeta.setDamage(usedShearsMeta.getDamage() + 1);
            System.out.println("Shears damaged. Current Damage: " + usedShearsMeta.getDamage());
            usedShears.setItemMeta(usedShearsMeta);``` this segment of code is not working properly. in the server console, it will display the damage being added up as it should but the damage is never applied when it ends
shell breach
grim ice
#

makes sense

#

I dont know how did it end up there from the first time tho

grim ice
#

copied off @MrMaurice211

#

in forums

ancient jackal
grim ice
#

saw

#

this

#

on forums

#

public void applyDamage(ItemStack is, int damage) {
ItemMeta im = is.getItemMeta();

if(im instanceof Damageable) {
    Damageable itemdmg = (Damageable) im;
    itemdmg.setDamage(itemdmg.getDamage() - damage);
    is.setItemMeta((ItemMeta) itemdmg);
 
    if (itemdmg.getDamage() <= 0) {
        is.setType(Material.AIR);
    }
}

}

#

not sure if it will work

#

it should

#

ive found that there is an issue that the item isnt getting deleted

#

so maybe make it this

#

?paste

undone axleBOT
quaint mantle
#

pretty sure it breaks on its own

#

why wouldnt it

grim ice
#

then set the item to the method

grim ice
ancient jackal
grim ice
#

these guys made my brain die

ancient jackal
#

same

ancient jackal
#

maybe it's because I'm not casting damageable back into ItemMeta like that code you pasted though

hollow sand
#

Hello

grim ice
#

just try it

hollow sand
#

How would I be able to check if a player performed a command?

grim ice
#

implement CommandExecutor

hollow sand
#

I tried googling and going thru the forums but didnt find anything

hollow sand
grim ice
#

then implement the methods

hollow sand
#

I want to do it from an event

#

like a

grim ice
#

yeah thats an event

#

well it isnt but yeah

hollow sand
#

PlayerCommmandPreProcessEvent

grim ice
#

ohh

#

chat message then

hollow sand
#

How would I do it with that event

#

wdym chat message

grim ice
#

event.getMessage()

hollow sand
#

really?

grim ice
#

yes

hollow sand
#

then I would be able to do it like event.getPlayer.getMessage("message");

grim ice
#

um

#

no

dusk flicker
#

not how that works

#

... like... at all

grim ice
#

why r u writing "message"

#

getMessage() will be the message

#

why write "message"

#

r u trying to set it

hollow sand
#

no

#

wait

#
if(event.getPlayer().getMessage().equals("message") {
//code
}```
#

smth like that?

grim ice
#

yeah

#

lol

hollow sand
#

od xd

dusk flicker
#

prob use equalsIgnoreCase

grim ice
#

wait

#

no

hollow sand
#

/fp me

grim ice
#

no getPlayer()

#

u dont need that

hollow sand
#

a

#

ok

dusk flicker
#

for future questions ->

#

?learnjava

grim ice
#

btw @dusk flicker ive been thinking of making my own website

undone axleBOT
grim ice
#

do i need to learn literally 3 new languages

#

just for a simple website

dusk flicker
#

I aint no full web dev but depends on how good quality you want it

grim ice
#

cant u make one with java

hollow sand
#

java is needed for web dev?

dusk flicker
#

html = basic af website
css = better basic website

grim ice
#

and js

dusk flicker
#

ye

grim ice
#

this is pain

hollow sand
#

html, css, js is the starter kit for basic websites

grim ice
#

cant i make it with java

#

lol

dusk flicker
#

I wouldent use Java for a website

#

lmao

hollow sand
#

then theres php 😩

grim ice
#

why thoo

naive bolt
#

Could not find artifact org.spigotmc:spigot-api:pom:1.13.2-R0.1-SNAPSHOT in vault-repo (https://nexus.hc.to/content/repositories/pub_releases)
anyone know how to fix?

grim ice
#

why 1.13.2 tf

hollow sand
#

specific server version Β―_(ツ)_/Β―

naive bolt
#

i forked a github and i havent changed anything

#

it wont build

hollow sand
# grim ice yeah
@EventHandler(priority = EventPriority.HIGHEST)
    public void onCommand(PlayerCommandPreprocessEvent event) {
        Player player = event.getPlayer();

        if(event.getMessage().equals("/projectile heart")) {
            if(list_of_players.contains(player)) {
                
            }
        }
    }``` so this should work?
hollow sand
#

of the server

naive bolt
#

what server

hollow sand
#

the error from server console or somewhere else?

naive bolt
kind hatch
#

I have a system for changing what I refer to as Item States in GUIs. It's used to toggle all types of settings. I'm currently running into an issue with a custom player head. The issue only happens when trying to switch it to it's disabled state.

This is the error: https://paste.md-5.net/ejonuwoyaf.cs

Considering the nature of the error, this leads me to believe that something is wrong with my method for creating the head. However, that same method is used in other GUIs and works perfectly fine. This is really confusing me because this method worked fine before. I'm not sure why it started breaking.

hollow sand
#

well

#

go to your pom.xml

#

and check the spigotmc version

#

idk

ancient jackal
#

well @grim ice it didn't work

#

here's 2 listener events

[15:03:36] [Server thread/INFO]: Collected list of nearby entities
[15:03:36] [Server thread/INFO]: Found 3
[15:03:36] [Server thread/INFO]: Looping through entities
[15:03:36] [Server thread/INFO]:
[15:03:36] [Server thread/INFO]: shearing sheep
[15:03:36] [Server thread/INFO]: New damage amount: 59
[15:03:36] [Server thread/INFO]:
[15:03:36] [Server thread/INFO]: shearing sheep
[15:03:36] [Server thread/INFO]: New damage amount: 58
[15:03:36] [Server thread/INFO]:
[15:03:36] [Server thread/INFO]: Original sheep, continuing
[15:03:36] [Server thread/INFO]:
[15:03:36] [Server thread/INFO]: PLAYER is not a sheep, continuing
[15:03:36] [Server thread/INFO]: Listener ended.
[15:03:36] [Server thread/INFO]: Shears have 58
[15:03:37] [Server thread/INFO]: Shear event fired
[15:03:37] [Server thread/INFO]: Collected list of nearby entities
[15:03:37] [Server thread/INFO]: Found 5
[15:03:37] [Server thread/INFO]: Looping through entities
[15:03:37] [Server thread/INFO]:
[15:03:37] [Server thread/INFO]: Original sheep, continuing
[15:03:37] [Server thread/INFO]:
[15:03:37] [Server thread/INFO]: shearing sheep
[15:03:37] [Server thread/INFO]: New damage amount: 60
[15:03:37] [Server thread/INFO]:
[15:03:37] [Server thread/INFO]: shearing sheep
[15:03:37] [Server thread/INFO]: New damage amount: 59
[15:03:37] [Server thread/INFO]:
[15:03:37] [Server thread/INFO]: shearing sheep
[15:03:37] [Server thread/INFO]: New damage amount: 58
[15:03:37] [Server thread/INFO]:
[15:03:37] [Server thread/INFO]: PLAYER is not a sheep, continuing
[15:03:37] [Server thread/INFO]:
[15:03:37] [Server thread/INFO]: shearing sheep
[15:03:37] [Server thread/INFO]: New damage amount: 57
[15:03:37] [Server thread/INFO]: Listener ended.
[15:03:37] [Server thread/INFO]: Shears have 57```
#

same issue, doesn't matter if damage is being added or subtracted

#

damage resets at the end

hollow sand
#

How would I make a repeating runnable which spawns a particle of my choice to a projectile of my choice every tick?

gleaming zenith
#

How can i get the player online time since the last leave of the player?

onyx fjord
#

You can do it async @hollow sand ig

hollow sand
onyx fjord
#

Not rly, on mobile

kind hatch
grim ice
#

and do it async

dusk flicker
#

?scheduling

undone axleBOT
hollow sand
grim ice
#

Bukkit.getScheduler().runTaskAsynschronously(Main.getInstance(), () -> {
CODE
});

dusk flicker
#

dont name your main Main

#

?main

grim ice
#

if im not wrong

#

whatever lol

#

am i supposed to know his main class name

#

or what

hollow sand
#

I don't work with async and sync a lot so dk

kind hatch
#

Otherwise it will only run once with #runTaskAsynchronously

tepid crater
hollow sand
#
Bukkit.getServer().getScheduler().runTaskAsynchronously(this, new Runnable() {
 code
},0, 20L);``` ?
grim ice
#

no

onyx fjord
#

I think you can remove that Bukkit. Part

grim ice
#

no

onyx fjord
#

Huh

dusk flicker
#

depends on what class its in

grim ice
#

he cant iirc

#

its not in main

onyx fjord
#

Ah

hollow sand
#

the class is in my main class :p

grim ice
#

what??

hollow sand
#

I'm doing it like since its a quick plugin

#

for a customer

grim ice
#

okay

onyx fjord
#

For a customer?

hollow sand
grim ice
#

that doesnt justify it

kind hatch
hollow sand
quaint mantle
#

You guys are not passing server in the constructor??

dusk flicker
#

why would you

grim ice
#

you're giving a customer

quaint mantle
#

DI

grim ice
#

bad practice

dusk flicker
#

just pass your main class instance

#

you can get it from that

hollow sand
grim ice
#

either way what platform do u use for freelancing btw

onyx fjord
#

Probably green f

quaint mantle
#

Ah true

dusk flicker
#

and you can just use the Bukkit object, no reason to use DI for useless stuff like this