#help-development

1 messages · Page 764 of 1

shadow night
#

Unsupported doesn't have to mean too low or too high, right?

shadow night
dry hazel
#

in an asm context, it probably means too new

lost matrix
#

You can either spawn explosion particles and play a sound, or create an explosion using World#createExplosion() and then listen for the BlockExplodeEvent

slate tinsel
scenic onyx
#

?paste

undone axleBOT
scenic onyx
lost matrix
#

Tha fk is all of this AABB and Ray stuff. Why dont you just use spigots api?

scenic onyx
slate tinsel
river oracle
#
Bukkit.getScheduler().runTaskTimer(plugin, this::tick, 1L, 1L);
``` this would run something or atleast attempt to every tick right?
lost matrix
scenic onyx
lost matrix
scenic onyx
rotund ravine
#

What an answer

timid berry
#

what version should i try?

lost matrix
lost matrix
timid berry
#

oh okay

#

its for a 1.16.5 fork btw

scenic onyx
scenic onyx
scenic onyx
lost matrix
scenic onyx
river oracle
#

I'm designing a system which ticks basically a task with an ID every tick, would it be better to use UUID or long to ensure there are no overlaps

#

I know UUID can fail, but so extremely rarely

lost matrix
# scenic onyx if his crosshair is on the hitbox
  public Player getTargetPlayer(Player sourcePlayer, double maxDistance) {
    Location start = sourcePlayer.getEyeLocation();
    Vector direction = start.getDirection();
    World world = sourcePlayer.getWorld();
    Predicate<Entity> filter = hit -> !hit.equals(sourcePlayer);
    RayTraceResult result = world.rayTraceEntities(start, direction, maxDistance, filter);
    if (result == null) {
      return null;
    }
    Entity hitEntity = result.getHitEntity();
    if(!(hitEntity instanceof Player)) {
      return null;
    }
    return (Player) hitEntity;
  }
tall dragon
river oracle
#

alright 🤷‍♂️ good enough for me

lost matrix
river oracle
#

shit good thing my plugin won't be running for that long

#

otherwise I'd get an IllegalArgumentException

lost matrix
tall dragon
#

ah my knowledge might be from another version uuid then

lost matrix
#

Probably v1 or so

tall dragon
#

but you can probably rest assured ur not going to get a duplicate

lost matrix
#

Wait i forgot the bits which are reserved for the timestamp

quaint mantle
#

Why there is no spigot in intellij minecraft plugin?

lilac dagger
#

There was one for sure

hazy parrot
#

It's in bukkit I think

river oracle
#

no love for craftbukkit?

remote swallow
#

no

river oracle
#

epic you should clone my Inventory API with BuildTools GUI

remote swallow
#

i could

#

but i could be playing factorio

quaint mantle
topaz cape
#

        if (target.getAllowFlight()) {
            target.setAllowFlight(false);
            target.setFlying(false);
            player.sendMessage(Language.FLY_DISABLED.toString()
                    .replace("<player>", target.getDisplayName()));
        } else {
            target.setAllowFlight(true);
            target.setFlying(true);
            player.sendMessage(Language.FLY_ENABLED.toString()
                    .replace("<player>", target.getDisplayName()));
        }
    }```

how does this not trigger PlayerFlightToggleEvent
#

how

peak depot
#

https://paste.md-5.net/efeqefiyek.js Why doesnt the casting work and it throws 28.10 20:53:36.951] INFO: [Dev-Server-1] Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_20_R1.block.CraftBed cannot be cast to class org.bukkit.block.data.type.Bed (org.bukkit.craftbukkit.v1_20_R1.block.CraftBed and org.bukkit.block.data.type.Bed are in unnamed module of loader java.net.URLClassLoader @27ce8e37)

solid cargo
#

eg going in creative and flying/stopping to fly

topaz cape
#

to turn it off at least

solid cargo
#

hmm

glad prawn
solid cargo
#

not paper?

tall dragon
#

isnt it PlayerToggleFlightEvent

solid cargo
#

there we go

#

anyways

topaz cape
#

im on phone rn

solid cargo
#

?wheremai

#

?whereami

solid cargo
#

easy

topaz cape
#

its not paper

solid cargo
#

oops

topaz cape
#

smh

solid cargo
#

oh yeah

glad prawn
#

ah yes xd

solid cargo
#

you saw nothing

#

is there a way to trigger an event yourself?

#

eg something.triggerEvent

tall dragon
#

yes

#

there is

#

e.g Bukkit.getPluginManager().callEvent(event);

peak depot
#

https://paste.md-5.net/efeqefiyek.js Why doesnt the casting work and it throws: INFO: [Dev-Server-1] Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_20_R1.block.CraftBed cannot be cast to class org.bukkit.block.data.type.Bed (org.bukkit.craftbukkit.v1_20_R1.block.CraftBed and org.bukkit.block.data.type.Bed are in unnamed module of loader java.net.URLClassLoader @27ce8e37)

carmine mica
#

wrong Bed

#

there are 2 of them, and you are importing/using the wrong one

peak depot
#

which then?

#

the block ore the type

carmine mica
#

well the deprecated one is the correct one. but you probably are looking for getBlockData instead of getState

#

then the one you already had would work

topaz cape
#

why isn't it triggered by itself

carmine mica
#

triggered when, when you construct the event?

topaz cape
#

i know i can trigger it but i just find it disturbing tbh

tall dragon
#

can any1 recommend me a good place to register a domain with?

#

so many options

carmine mica
topaz cape
#

namecheap

tall dragon
#

namecheap good?

peak depot
#

yes

topaz cape
river oracle
topaz cape
tall dragon
#

il check it out thanks

carmine mica
solid cargo
#

great, direct that to @topaz cape

carmine mica
#

how else would an event be called? You said "why isn't it triggered by itself". what does that mean?

topaz cape
peak depot
topaz cape
solid cargo
#

you want an event to be triggered right?

carmine mica
# topaz cape .

the event description says exactly when it is called. When a player toggles their flying state.

topaz cape
#

thats whats annoying me

carmine mica
#

you can call it yourself if you want to, but event constructors are not API and can change at any time

topaz cape
carmine mica
#

well sure it can. The API changing something isn't the player doing that, its some plugin doing it

topaz cape
#

yes and usually the api calls these events

#

like teleport event

carmine mica
#

actually, most of the time the API doesn't

topaz cape
#

or worldswitch or damage or potion or anything

carmine mica
#

but there are places where it does, like the teleport event

topaz cape
#

all of those are called

topaz cape
#

in spigotmc it always does

carmine mica
#

unleashing an entity doesn't

#

Pufferfish#setPuffState

#

oh that one is just a Paper event. but the unleashing isn't.

#

its gonna take me some time, but I'm confident that most of the time, API method calls don't directly trigger events

#

but you are 100% correct that some of them do, like the ones you listed

#

EntityEnterLoveModeEvent isn't fired if you change the love state via the API either

#

I don't think VillagerCareerChangeEvent is fired when you change a villager's profession either

topaz cape
#

i have never heared of that event tbh

hazy parrot
#

villagers have profession what

topaz cape
#

always did

hazy parrot
#

tf

#

example pls

topaz cape
#

have you never installed citizens on your server

#

there is a blacksmith, a librarian and alot more

hazy parrot
#

seems like that didn't exist when i played game

topaz cape
#

thats since 1.7

#

or before

carmine mica
# topaz cape i have never heared of that event tbh

point is, it is no where near consistent within itself so its hard to say what is "more correct" really. Making it consistent now is... not really possible without changing a TON of events to either be called more or less often.

smoky oak
#

uh interesting thing to complain about

#

aint that getting turned in a value at compile time anyway?

quaint mantle
#

where is my plugin .jar file after building with build.gradle?

ivory sleet
#

readability

#

moterius

quiet ice
#

Yeah, it's convention to have the D, F and L suffixes be uppercase, even though it does not matter

river oracle
#

what kind of name is 1l

quiet ice
#

it's a constant - not a name

river oracle
#

ohhh you're casting to a long

quiet ice
#

it's not really a cast but more of a definition as long

quaint mantle
quiet ice
#

uh, what is your build.gradle file?

echo basalt
#

then you stated the build directly somewhere else

quaint mantle
#
    id 'java'
}

group = 'kitsudo'
version = '1.0-SNAPSHOT'

repositories {
    mavenCentral()
    maven {
        name = "spigotmc-repo"
        url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
    }
    maven {
        name = "sonatype"
        url = "https://oss.sonatype.org/content/groups/public/"
    }
}

dependencies {
    compileOnly "org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT"
}

def targetJavaVersion = 17
java {
    def javaVersion = JavaVersion.toVersion(targetJavaVersion)
    sourceCompatibility = javaVersion
    targetCompatibility = javaVersion
    if (JavaVersion.current() < javaVersion) {
        toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
    }
}

tasks.withType(JavaCompile).configureEach {
    if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
        options.release = targetJavaVersion
    }
}

processResources {
    def props = [version: version]
    inputs.properties props
    filteringCharset 'UTF-8'
    filesMatching('plugin.yml') {
        expand props
    }
}
echo basalt
#

and how are you building it

quaint mantle
#

I opened build.gradle and pressed green "play button" in up right corner

quiet ice
#

I personally recommend executing the gradle wrapper script instead via the command line, but your IDE should provide the necessary tooling too

quaint mantle
#

okay I managed that

#

I executed "this file" before instead of project

hushed spindle
#

maybe im missing something blatantly obvious but how can File#createNewFile() throw an IOException saying the system couldn't find the file

#

you know, the file that i want to create that doesnt exist yet

tall dragon
#

the directory might not exist?

#

where u want to make it

hushed spindle
#

shouldn't it also create subdirectories if they dont exist

tall dragon
#

it does not no

hushed spindle
#

ah

#

ill check that then

tall dragon
#

u can do File#mkdirs()

#

should do the trick

smoky oak
#

how can i make this only recognize comments that start with that word, instead of inside the comment?

#

its spitting out javadocs

eternal night
#

@river oracle you around ?

river oracle
#

yeah @eternal night

#

I'm always around

#

😭 I have nothing to do with my life

eternal night
#

wanna look at your inventory PR 😏

#

we are in paper discord if ya wanna join

river oracle
#

ugh I have to join paper discord

#

this is a real chore

#

I will sit in their muted while I eat my yummy food

#

@eternal night be kind and move me

grand flint
#

Which method says in the chat that the message is a server message, and which method says in the chat that the message may have been edited by the server

smoky oak
#

every message sent without player input is a server message, if a player message is processed somehow, the 'may have been edited' warning shows

grand flint
#

Okay but some servers display player messages as a server message

smoky oak
#

yea by not sending the player message and re-sending it in the same format it normally would show player messages

grand flint
#

So what method is that?

smoky oak
#

Bukkit.broadcastMessage

orchid gazelle
#

this dribbles chat reporting too I think

grand flint
#

Which method edits the player message? Like essentialsx does

quaint mantle
#

anyway to use bstats with gradle without manually copying the metrics class?

remote swallow
#

convert the maven info

#

implementation('org.bstats:bstats-bukkit:3.0.2')

quaint mantle
#

i did that

#

but it says to shade it

rotund ravine
#

Yes

#

That’s how we usually do things

#

I guess you can use the spigot library loader

worldly ingot
#

No because bStats wants you to relocate it

#

Gradle’s equivalent to shade is shadow

slender elbow
#

shad* plugin

dry hazel
#

shadn

quaint mantle
#

how would i do that

rotund ravine
#

?shade

#

?shading

#

Huh

quaint mantle
#

nvm i fgured it out

rotund ravine
#

I guess that would be a nice command to have

quaint mantle
#

How to chicken?

young knoll
#

Yes

#

What does that mean

quaint mantle
#

I mean

#

Whenever you do

#

🐔

torn oyster
#

i feel like there is a better way to do this but i am not sure what it is

        Material bootsMaterial = switch (tier) {
            case 1 -> Material.CHAINMAIL_BOOTS;
            case 2 -> Material.IRON_BOOTS;
            case 3 -> Material.DIAMOND_BOOTS;
            default -> Material.LEATHER_BOOTS;
        };
        Material leggingsMaterial = switch (tier) {
            case 1 -> Material.CHAINMAIL_LEGGINGS;
            case 2 -> Material.IRON_LEGGINGS;
            case 3 -> Material.DIAMOND_LEGGINGS;
            default -> Material.LEATHER_LEGGINGS;
        };```
quaint mantle
#

If it’s any boots or legs?

young knoll
#

Could use a map

#

Or since it’s number based

#

Just an array

quaint mantle
#

Why would u use memory fir something like this

#

Oh wait

young knoll
#

It’s like

#

64 bytes

quaint mantle
#

That’s a whole lot of chicken

#

Bites🤤🍗

sterile token
#

when talking about minecraft 1.13 up avoid any single memory leak md_5

#

Because then you will regret about it

quiet ice
#

And what with 1.12 and below?

pseudo hazel
#

at that point minecraft code is fucked anyways

young knoll
#

Where did memory leak come from

#

No one mentioned memory leak

quaint mantle
#

It was me🐈‍⬛

remote swallow
#

im the memory l eak

thin iris
#

it’s me

#

hi

#

i’m the problem it’s me

#

PYJTON OR JAVA

slender elbow
#

both

#

jython

remote swallow
sterile token
#

You cant make it without NMS, because most of the time you need more precise data which have to be getted from packets

#

Not sure how to explain this, but i find this useful gists which was sent here before

sterile token
drowsy helm
#

yeah a switch isnt bad anyway wouldnt say any approach is wrong

sterile token
#

yeah, agree. But the enum is the best option i totally agree

thin iris
#

print.out(“something”)

drowsy helm
#

is jython the jorts of programming

edgy oak
#

for some reason i cant seem to get the BlockExplodeEvent to work at all,
here is the code for it, the BlockBreakEvent works perfectly fine


import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockExplodeEvent;


public class RemoveBlockLootSpawnListener implements Listener {

    @EventHandler(priority = EventPriority.HIGHEST)
    public void onBlockExplode(BlockExplodeEvent e) {
        Bukkit.broadcastMessage("Test 4");
    }

    @EventHandler(priority = EventPriority.HIGHEST)
    public void onBlockBreak(BlockBreakEvent e) {
        Block block = e.getBlock();

        int minX = -100;
        int maxX = 100;
        int minY = 0;
        int maxY = 80;
        int minZ = -100;
        int maxZ = 100;

        Location blockLocation = block.getLocation();
        int blockX = blockLocation.getBlockX();
        int blockY = blockLocation.getBlockY();
        int blockZ = blockLocation.getBlockZ();

        Bukkit.broadcastMessage("Test 1");

        if (block.getType() == Material.STONE && blockX >= minX && blockX <= maxX && blockY >= minY && blockY <= maxY && blockZ >= minZ && blockZ <= maxZ) {
            Bukkit.broadcastMessage("Test 2");
            e.setDropItems(false);
        }
    }


}```

any help is much appreciated
worldly ingot
#

What are you doing to try and trigger it?

edgy oak
#

ive tried tnt and end crystals

#

neither work

worldly ingot
#

Those are entities

#

EntityExplodeEvent

edgy oak
#

oh yeah they are, silly me lmao

#

cheers

worldly ingot
#

BlockExplodeEvent is more for things like beds in the nether

#

Or a respawn anchor in the overworld

edgy oak
#

i assume anchors aswell?

#

yeah

worldly ingot
#

Ye

edgy oak
#

alright cheers mate

quaint mantle
#

whys it doing htat

worldly ingot
#

That type doesn't exist afaik

#

Oh, Paper

sterile token
#

Paper has its own support discord

spark lynx
#

how can i get the server brand name like spigot / paper in plugin

halcyon hemlock
#

Nms prolly

spark lynx
wet breach
#

well easiest way is to just access version

#

it will either say git-paper or git-spigot

#

followed by eaches git commit id

#

the other way, is to take a look at the meta-inf

#

neither of those require nms

kind hatch
wet breach
#

then they would need to look in the Meta-inf for that

#

under implementation

#

that is where version and brand pull the info from

#

you just need to make use of zip file methods, and read the file

#

you could also use reflection too to pull that info as well

#

most likely could just use the java system package I think to get to that info as well

#

so many ways lol

shut sphinx
#

1.12.2 has no material.*granite*

#

how can i make a crafting recipe that contains it?

#
recipe.setIngredient('G', Material.STONE_GRANITE);
#

will not work

sullen marlin
#

Probably material data / byte value on stone

shut sphinx
#

thats what im currently looking into

#

why doesnt 1.12.2 just have granite and so on? btw

rotund ravine
#

Cause that’s not how it used to work

shut sphinx
#

incase anyone was wondering

#
MaterialData md = new MaterialData(Material.STONE, (byte)1);
ShapedRecipe recipe = new ShapedRecipe(key, item);
recipe.shape("GGG", " S ", " S ");
recipe.setIngredient('G', md);
recipe.setIngredient('S', Material.STICK);
rotund ravine
#

I’m old enough to remember the days haha

wet breach
rotund ravine
#

Good old

#

I remember smth that looked exactly like this one

wet breach
#

yeah there was another one

#

it covered both blocks and items

#

would even help you format the in game command too and with spawning entities

rotund ravine
#

I recall

shut sphinx
#

strange how far its come

#

thanks for the info guys :)

rotund ravine
scenic onyx
#
 public Player getTargetPlayer(Player sourcePlayer, double maxDistance) {
        Location start = sourcePlayer.getEyeLocation();
        Vector direction = start.getDirection();
        World world = sourcePlayer.getWorld();
        Predicate<Entity> filter = hit -> !hit.equals(sourcePlayer);
        RayTraceResult result = world.rayTraceEntities(start, direction, maxDistance, filter);
        if (result == null) {
            return null;
        }
        Entity hitEntity = result.getHitEntity();
        if(!(hitEntity instanceof Player)) {
            return null;
        }
        return (Player) hitEntity;
    }

why if i look head return null?

topaz cape
#

this stopped in 1.13

torn oyster
#

how would i change the pickup range of items

wet breach
#

and then you just run a task to check further out if there is a valid player

#

and then either set the items velocity to gravitate to them or instant pickup the item for them

#

the gravitating might be more difficult to implement then the other way

#

cause you know accidentally sending items flying away 😛

torn shuttle
#

is there a way to move an entity in mc in a way that does add interpolation but only until the next tick?

#

teleports do add interpolation but it seems to be about 100ms-ish which is well above 1 tick

#

the closest I can get it to is by guessing that it takes 2 ticks (usually) to run it but this is not a great way of doing things

#

I'm guessing getting this to be reliable is basically impossible unless there's some really useful hidden feature somewhere that does exactly this

smoky oak
torn shuttle
#

I need to run it continuously and I can't guarantee that it won't break mc speed limitations

#

so I can't teleport it to adjust because it would teleport every tick which would probably cause it to revert to the delay issue

lone portal
#

ProtocoILib Plugin Works In 1.20.2???

torn shuttle
#

also this needs to move through solid blocks with armor stands which I don't think they will do that with velocities

smoky oak
#

cant u tell armor stands 'u dont have a collision box'?

full holly
#

Does anyone knows how to get the max health the mob can normally have only by knowing the EntityType

full holly
#

ty

smoky oak
#

how do i check if two instances of ItemStack are of the same itemStack? I don't see a getUniqueID method

topaz cape
#

why not use #equals

#

or do you want to ignore amount

shadow night
#

if it's the same instance of one itemstack then you can just ==

smoky oak
#

isnt equals something that only works on primitives?

#

ah

#

good point

shadow night
#

like, if it's actually the same instance

#

.equals just compares the values

topaz cape
#

oh i got it wrong

#

lol

smoky oak
#

its not the same instance, but i need to know if it's the same item

topaz cape
#

use Material

smoky oak
#

EXACT SAME item stack

shadow night
#

compares the values

topaz cape
hazy parrot
#

For itemstack use isSimilar, that will not count amount of items in itemstack

shadow night
#

makes a lot of sense

topaz cape
shadow night
#

I should stop being in this channel, the more I'm here the more I want to go develop something new

hazy parrot
torn oyster
#

Aborting charge player as no target was set

hazy parrot
#

Afaik

torn oyster
#
            for (ClayWarsPlayer cwp : getNonEliminatedPlayerList()) {
                EnderDragon dragon = getActiveWorld().spawn(new Location(getActiveWorld(), 0, 100, 0), EnderDragon.class);

                dragon.setTarget(cwp.getOnlinePlayer());
                dragon.setPhase(EnderDragon.Phase.CHARGE_PLAYER);

                cwp.getOnlinePlayer().sendTitle(StringUtil.colourize("&c&lSUDDEN DEATH"), "");
                cwp.getOnlinePlayer().playSound(cwp.getOnlinePlayer(), Sound.ENTITY_ENDER_DRAGON_GROWL, 2.0f, 0.8f);
            }```
#

surely this would work no?

#

its setting the target

lilac dagger
#

one way to find out

#

tho i'm not sure you can make the ender dragon not target 0 0 whenever it switches from charge

#

nvm

#

iyou are doing it at 0 0

orchid trout
#

id prefer getPlayerList() and getEliminatedPlayerList() instead of what you have there

smoky oak
#

why do breakpoints not work on in-line runnables

tough mica
#

hello i coded a gun system. now is my question is it possible if the player shoot the weapon do a animation? i want to move the item under when shoots like a little shoot animation. its like the player drops a item that wheres the DropEvet canceled?

halcyon hemlock
halcyon hemlock
eternal night
#

Wasn't there a build tools flag or something something to build/run a PR ?

tough mica
lone jacinth
eternal night
#

Merci

tough mica
lost matrix
tough mica
#

you see the gun, i want if the player right clicks that the weapon move under

#

and then up

#

maybe in a scheduler

#

in the first person

lost matrix
#

Under and then up... I guess you can set the attack cooldown

tough mica
#

but how?

lost matrix
#

code

tough mica
#

i know

#

but how

lost matrix
#

Search for cooldown or weapon or something similar

#

Hm i dont see a method to set this cooldown without triggering an attack

#

Well.. looks like you need to be creative 🙂
Play an animation, let the player swing or attack the air. Let is know how you solved it.

torn oyster
#

kinda desperate

#
            for (ClayWarsPlayer cwp : getNonEliminatedPlayerList()) {
                EnderDragon dragon = getActiveWorld().spawn(new Location(getActiveWorld(), 0, 100, 0), EnderDragon.class);

                ((CraftEnderDragon) dragon).getHandle().setTarget(((CraftPlayer)cwp.getOnlinePlayer()).getHandle(), EntityTargetEvent.TargetReason.CUSTOM, false);
                dragon.setPhase(EnderDragon.Phase.CHARGE_PLAYER);

                cwp.getOnlinePlayer().sendTitle(StringUtil.colourize("&c&lSUDDEN DEATH"), "");
                cwp.getOnlinePlayer().playSound(cwp.getOnlinePlayer(), Sound.ENTITY_ENDER_DRAGON_GROWL, 2.0f, 0.8f);
            }```
#

i've tried with regular .setTarget() too

brazen badge
#

My plugin doesn't create the config files folder. Can anyone help me?

chrome beacon
#

Make sure your config is in your jar

brazen badge
chrome beacon
#

Where are you calling saveDefaultConfig

brazen badge
#

in onEnable function

chrome beacon
#

Are you using the right plugin jar

brazen badge
#

i'm using 1.1

chrome beacon
#

Did you put that jar in to the server

brazen badge
chrome beacon
#

Fix that error

smoky oak
#

is there no load factor for array list init? I know the exact amoutn of entries it'll have

halcyon hemlock
#

?

halcyon hemlock
smoky oak
#

for maps and stuff you can declare the load factor

#

if you know your exact capacity you declare size, 1f

halcyon hemlock
#

What is a 'load factor'?

torn oyster
smoky oak
#

the occupacancy percentage at which it doubles its capacity

sullen canyon
torn oyster
chrome beacon
halcyon hemlock
#

I didn't know there was .setTarget 💀

halcyon hemlock
#

every list does

#

if you add to it

smoky oak
#

wait why tf cant i open the arraylist internals

chrome beacon
#

Not sure about linked list

brazen badge
halcyon hemlock
#

every List does that innit

torn oyster
halcyon hemlock
dry hazel
pseudo hazel
#

yes but not every list expands after each new element

#

arraylist expands by 50 of its capacity

#

when its full

#

50%

halcyon hemlock
#

I don't know

#

I forgor java

#

Never really looked into that details

torn oyster
#

ideally would want the vanilla way to work

smoky oak
#

using an array wouldnt work well here, and i iterate the list once for init and once for readout. should i just tell it 'your capacity is size * 2' ?

timid hedge
#

What is the event called to cancel on water and lava flow?

timid hedge
glad prawn
#

just cancel if block.isLiquid()

young knoll
#

There is also a material for it

glad prawn
#

yeah

timid hedge
#

This might be a dumb question but how do i check for the placer? so if the player is op it isnt canceling

halcyon hemlock
#

bad code??

timid hedge
halcyon hemlock
#

I can tell you how to detect placement and if the placer is OP or not

#

I've never really done water logic stuff

#

simply in blockplaceevent or interact event check if the clicked block != null and then check if the placer is op event.getPlayer().isOp() or something similar, and cancel event if not

timid hedge
#

Oh yeah, i could also do it on that way. Thanks

dry hazel
#

put the getter anno on the class

#

or just generate the getters with ij and ditch lombok

torn oyster
#

is there a way to disable dragons' collisions

#

if they collide with each other they get launched up for some reason

#

my game needs multiple dragons for a certain portion

pseudo hazel
#

lol, yeah I guess every entity just gets flung up when hit by a dragon

grim hound
#

Bruh

spiral birch
#

Would anyone be able to create a plugin which disables elytra with chestplate swapping

#

?

torn shuttle
#

wait what

#

does livingentity not extend entity?

#

no it does right

#

through damageable

young knoll
#

yes

torn shuttle
#

methinks I may be a bit tired

#

I keep forgetting the names of my own plugins

#

well

#

poop

#

big turds

#

I am starting to suspect that there is no 0 interpolation entity movement in mc, that the teleport speed is the fastest speed possible

glad prawn
fringe yew
#

anyone know how to make an item unstackable?

young knoll
#

add something to pdc

#

Like a uuid

eternal night
#

random uuid smacked in there yea

#

works great

fringe yew
#

aight

quaint mantle
opal carbon
#

tryna mess around with redis but never tried it before

#

to make a party system

#

i was thinking to just store a list of uuids to some sorta key to be some sorta party id

#

but not sure if thats a decent structure and how to effectively store/fetch that party id

#

would storing the player uuid and party id for each player in the party be a decentish way of doing that or am i strucuring this badly

tiny sleet
#

anyone got a good guide/tutorial to help me with making plugins

modern ridge
#

hi, how can i remove respawn death screen and removal of dirt screen in Spigot/Paper 1.8.8 ?

#

can anyone give me some example from this ?

glad prawn
modern ridge
#

like i have to modified PlayerDeathEvent and EntityDamageEvent ?

glad prawn
modern ridge
#

yes

#

and i make in 1.8.8

#

minecraft 1.14.x and the doImmidiateRespawn doesn't existed

#

so i ask how can i remove death screen with dirt screen

#

normally when you died and click on respawn button it show dirt screen on it

opaque hawk
#

Hi i have 2 plugins orebfuscator and anty x ray how can i turn on anty x ray??

dry hazel
#

can you not post it into all channels?

opaque hawk
#

Im sorry but it maches to all

dry hazel
#

that depends on the antixray plugin

opaque hawk
remote swallow
dry hazel
#

no, it doesn't, that's a server administration question

opaque hawk
#

Okay sorry i deleted

modern ridge
#

here is development for code

#

not help plugin

opaque hawk
#

help server is okay??

modern ridge
#

idk

eternal oxide
#

yes

modern ridge
modern ridge
#

hello

slender elbow
#

hi

dry hazel
#

runs

glad prawn
#

sleep

hushed spindle
#

i want to use maven to minimize my jar to keep the final jar size small, but when i do so the plugin's main class isn't added and so the plugin doesnt know how to plugin

#

ive been trying to add a filter to exclude my core module, but it says its unable to find the artifact

#

so how the fuck do i use a filter lmao

#

if my core module's artifactid is core and my plugin is just called "plugin" it should be done like this right?

lost matrix
sacred mountain
#

anyone know if the orientation of a block such as an end rod will be retained if i use .setType() for another orientable block

#

like a chain

slender elbow
#

it won't

sacred mountain
#

yeah figured that now

#

also whats the difference between the material glow berries and the cave_vines_plant material

#

is the berries the item

pseudo hazel
#

yes probably

pine forge
#

Whats the recommended way to check if a player clicked in a specific custom inventory?

sacred mountain
#

interactevent probably

#

nvm

#

InventoryClickEvent?

hushed spindle
sacred mountain
#

is there an easy way to replace lava with water, but retain the exact state that the lava was in

#

like flowing / level / direction

#

can i just save the blockstate and replace the block and apply the block data

#

to the new liquid

hushed spindle
#

no

lost matrix
sacred mountain
#

would i run into any interacting problems if i decided to do it X blocks per tick

sacred mountain
#

like cobblestone/stone/obsidian stuff

hushed spindle
#

would need to know more context for that

lost matrix
# pine forge okay thats cool

You should probably use a Map<Inventory, CustomHandler> so you can give each bukkit inventory a custom handler for your interactions

sacred mountain
#

replacing a large area of lava, lets say 100x100 blocks

#

which is quite a lot to do

#

in 1 tick

hushed spindle
#

and you wanted to do that every tick?

sacred mountain
#

no

#

it would be a 1 time thing

#

a command

hushed spindle
#

considered using worldedit api?

sacred mountain
#

hmm i'll take a look

grim hound
#

What the hell is web.xml

#

or rather

#

can it be used with minecraft plugins?

lost matrix
halcyon hemlock
sacred mountain
#

would that work

#

without WE api

grim hound
#

do you

#

set the already existing data

sacred mountain
#

it was lava beforehand

grim hound
#

to the very same data

grim hound
#

okay

hushed spindle
sacred mountain
#

yeah was a bit of a large example tbf

#

but i'll see how it goes

shadow night
#

I wonder if that's multithreadable

sacred mountain
#

i'll use worldedit api if it's getting annoying

sterile token
#

A good menu api is triump-gui has everything done

lost matrix
#

Verano just out of nowhere with his out of context wisdom...

sterile token
#

Just dont lost time coding one.

#

triump-gui has everything for menus, pagination, normal menus, storage menus. Diferent menu types, items actions

halcyon hemlock
upper hazel
#

I have a task that I'm confused about. How to use wolrldguard api to make it so that the owner of the barrel with items can put only in a certain region (for example shop) and then to break this barrel can only the owner of the barrel or the owner of the region shop

#

there are plenty of barrels like this in the region.

#

and you can't put someone else's barrel where the barrel is.

#

region in region i think

#

region has region were only the owner of the shop region or the owner of a sub-region can lambast the barrel

#

and p2 can't break the barrel at p1.

#

but "shop" owner can

sterile token
#

Yeah seems to be okay

#

I can't understand exactly what issue you are having

whole surge
#

Hello.
Is there an event in spigot api for camera movement?

lost matrix
shadow night
#

PlayerMoveEvent I think fires when the head moves

sterile token
lost matrix
whole surge
sterile token
shadow night
#

Eee

lost matrix
sterile token
#

Yeah you can just know if he moved his head or not

sterile token
#

Just use PlayerMoveEvent

#

If im not wrong is getHead() or something like that, from player object

#

Let me check it

shadow night
#

getYaw and Pitch or something

pine forge
alpine urchin
lost matrix
# pine forge I cant really get it to work, do i have to compare it with getClickedInventory, ...

getInventory() returns the primary inventory in this event. (Which is always the top one if something is open)
So if you have a custom Inventory somewhere, then calling .equals() on this custom inventory and the inventory returned
from .getInventory() then it should return true.

Depending on your java experience, you could create quite a few problems in this implementation that results in .equals() not being true.

lost matrix
pine forge
#

Wait i believe its because i implemented a custosm inventory holder

river oracle
#

custom InventoryHolders are a no no

#

you've been a bad boy

#
pine forge
#

i know but they work

#

but im trying to get away from them, thatsss why i assssked

#

i justs do this.inventory = Bukkit.createInventory(null, 9, "Select Your Class")

#

and then i do this.inventory.equals(event.getInventory())

lost matrix
pine forge
#

well that wont be the case

lost matrix
#

*Or as long as this GUI has no state

pine forge
#

i create a new instance though for every player

lost matrix
#

I hope that you dont register a listener for every player

pine forge
#

its only registered for the instance that i specify in .registerEvents in my onEnable

lost matrix
#

Then how do you create a new instance for every player? ...

pine forge
#

i do new MyCustomInventory().openInventory(player)

pine forge
#

my .equal always returns false though

scenic onyx
#

@lost matrix Yesterday you gave me the code to see if an entity was having the crosshair in the hitbox, it works but sometimes if I look at the player head it returns null

lost matrix
lost matrix
pine forge
# lost matrix More code

i mean i have this handler class:

public class DominionInventory {

    protected final Inventory inventory;

    public DominionInventory(Inventory inventory) {
        this.inventory = inventory;
    }

    public void openInventory(HumanEntity entity) {
        entity.openInventory(this.inventory);
    }
}
#

and then in my click event:

    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        System.out.println("Inventory click grimoire" + this.inventory.equals(event.getClickedInventory()));
        if(!this.inventory.equals(event.getClickedInventory()) || event.getCurrentItem() == null) return;

        event.setCancelled(true);

        if(event.getCurrentItem().getType() != Material.BARRIER) return;
        Bukkit.getScheduler().runTask(DominionSMP.getPlugin(), () -> event.getWhoClicked().closeInventory());
    }
scenic onyx
lost matrix
pine forge
#

no my inventory handlers extend DominionInventory

pine forge
lost matrix
#

Show me the code that opens an inventory for a player

lost matrix
#

I mean the usage of this method

pine forge
#

and MyCustomInventory extends DominionInventory

#

and in itss constructor i call

super(Bukkit.createInventory(null, 9, "Select Your Class"));
lost matrix
#

Ah ok. So every time you call new MyCustomInventory(), your constructor creates a completely new instance of
org.bukkit.inventory, making the inventory different from the one in your registered listener.
You now effectively have two inventories. One that is inside the registered listener and one that is used for a player to open.

pine forge
#

ohh

#

okay

#

yea

#

How would you solve that problem?

#

make a map?

lost matrix
#

Yeah, the common approach for most systems is: Write a manager class and put a Map in it that gets managed.

pine forge
#

ill just put a static map in DominionInventory

lost matrix
#

Sure. You can just use the dirty, hacky, shortcut that gets you in a ton of trouble in the future as well 🙂
Its a choice

pine forge
#

bruh how iss sthat hacky, dirty and will get me in trouble

#
public class DominionInventory {

    protected final Map<HumanEntity, Inventory> inventories = new HashMap<>();

    protected final Inventory inventory;

    public DominionInventory(Inventory inventory) {
        this.inventory = inventory;
    }

    public void openInventory(HumanEntity entity) {
        this.inventories.put(entity, this.inventory);

        entity.openInventory(this.inventory);
    }
}
remote swallow
#

theres the issue, you should have 1 class with a map, not every class gets a map

lost matrix
#

This wont work

worldly ingot
#

Make it static runlol

pine forge
#

DominionInventory is an absstsract class that is only extended

#

made it static

remote swallow
#

that shouldnt have a map in

pine forge
#
public abstract class DominionInventory {

    protected static final Map<HumanEntity, Inventory> inventories = new HashMap<>();

    protected final Inventory inventory;

    public DominionInventory(Inventory inventory) {
        this.inventory = inventory;
    }

    public void openInventory(HumanEntity entity) {
        this.inventories.put(entity, this.inventory);

        entity.openInventory(this.inventory);
    }
}```
#

better

worldly ingot
#

I was mostly kidding lol

remote swallow
#

choco was joking with the static

worldly ingot
#

It would work, but I was kidding

pine forge
#

i already made it static before he ssaid it

remote swallow
pine forge
#

why was he joking

worldly ingot
#

There are just better ways to approach it is all

lost matrix
pine forge
#

alright why make a reference to the Inventory then?

#

isnt that a game object?

#

Why cant i make mutable things stsatic?

#

im not implementing a getter, im just referencing it by variable, its protected anyways

lost matrix
#

One of the most important properties of your code is stability. There is one principle which, in my opinion,
helps out this stability the most: Encapsulation
Making mutable objects static, breaks their encapsulation as it is now shared between multiple instances.
This is also true if your object is private.

pine forge
#

Okay so wheres the recommended place to put my inventories map

lost matrix
# pine forge alright why make a reference to the Inventory then?

Inventories dont have an identifier (at least not an exposed one), and cant be referenced indirectly.
Managing inventories is the responsibility of the plugin, not the server. The one who creates a resource has the
responsibility to clean this resource again.

lost matrix
river oracle
#

It's okay though they need to learn

pine forge
#

DI?

lost matrix
#

Wait, you can have singletons and not create a static getter for them right?

river oracle
#

But that's be more ambiguous imho

#

regardless of singleton pattern and my pointless interjection, the point is you should really only ever use one instance of your manager

remote swallow
#

who says

lost matrix
#

Which was synonymous for singleton to me. Let me double check.

pine forge
#

thats the definition of singelton

#

whats DI though

river oracle
#

Dependency Injection

lost matrix
#

?di

undone axleBOT
river oracle
#

its fancy for use the constructor

lost matrix
#

Pretty much

river oracle
#

personally I think DI is kinda terrible sometimes but lets keep that on the down low

remote swallow
#

you sound like a static lover

lost matrix
river oracle
lost matrix
#

Wait i got an idea XD

remote swallow
#

my mental state?

pine forge
#

okay if i have multiple inventories, do i have multiple maps in the manager or do i mark the inventoriess another way?

remote swallow
#

if it is my mental state yeah somethings up

lost matrix
# river oracle no but if you're passing a manager class into every single class you're doing s...
public class ManagerRegistry {

  private final Map<Class<?>, Object> registeredManagers;

  public ManagerRegistry() {
    this.registeredManagers = new HashMap<>();
  }

  @SuppressWarnings("unchecked")
  public <T> T getManager(Class<T> managerType) {
    return (T) registeredManagers.get(managerType);
  }

  public <T> void registerManager(T manager) {
    if (this.registeredManagers.containsKey(manager.getClass())) {
      throw new IllegalStateException("Cant register the same manager type twice.")
    }
    this.registeredManagers.put(manager.getClass(), manager);
  }

}

Just pass this everywhere XD

pine forge
#

unrelated, but is this the correct way to double an entity's health?
java vindicator.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(vindicator.getHealth() * 2); vindicator.setHealth(vindicator.getHealth() * 2);

#

the entity just kinda vanishess after a tick

#

no error in console though

lost matrix
pine forge
#

like that?

        AttributeInstance attribute = vindicator.getAttribute(Attribute.GENERIC_MAX_HEALTH);
        attribute.setBaseValue(attribute.getBaseValue() * 2);
lost matrix
#

Yes

pine forge
#

okay ill try that

hushed spindle
#

no i dont recommend that

#

just add a max health attribute to the entity equal to their base health attribute

#

you can use the ADD_SCALAR operation of 1 to just add +100% max health

#

or is that just items i forgor

lost matrix
#

You mean adding a modifier to the health. But if he wants to change the entities acutal base health then
you dont want a modifier.

pine forge
#

no that workss

#

addModifier

pine forge
lost matrix
#

That wouldnt change the health.

hushed spindle
#

it wouldnt change the base health value which i think is less messy, it would double their hp though

pine forge
#

but it would change the max health, and then i can set the health to the max health cant it?

#

wait

lost matrix
#

You want MULTIPLY_SCALAR_1 i think

hushed spindle
#

if you do multiply scalar 1 you need to put 2 and not 1

#

add scalar is literally +x%

#

so +100%

lost matrix
#

1, AttributeModifier.Operation.MULTIPLY_SCALAR_1
would result in result = base * (1 + 1)

hushed spindle
#

multiply scalar 1 would be just x% so 200%

sacred mountain
#

https://www.spigotmc.org/threads/laser-guardian-and-crystal-beams-1-9-1-20.348901/

[09:50:10] [Server thread/WARN]:     at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:57)
[09:50:10] [Server thread/WARN]:     at java.base/jdk.internal.reflect.UnsafeQualifiedObjectFieldAccessorImpl.get(UnsafeQualifiedObjectFieldAccessorImpl.java:38)
[09:50:10] [Server thread/WARN]:     at java.base/java.lang.reflect.Field.get(Field.java:425)
[09:50:10] [Server thread/WARN]:     at fr.skytasul.guardianbeam.Laser$Packets.getField(Laser.java:1008)
[09:50:10] [Server thread/WARN]:     at fr.skytasul.guardianbeam.Laser$Packets.<clinit>(Laser.java:746)
[09:50:10] [Server thread/WARN]:     at fr.skytasul.guardianbeam.Laser.<init>(Laser.java:61)
[09:50:10] [Server thread/WARN]:     at fr.skytasul.guardianbeam.Laser$GuardianLaser.<init>(Laser.java:312)```

getting this from the guardian laser resource, i've used it before, but is this the result of the name of the fields changing in 1.20.2?
#

or can it not easily be fixed

pine forge
#

okay ill just try multiply but it probably doesnst matter

lost matrix
hushed spindle
#

yeah it literally doesnt matter

#

+100% and 200% are the same thing

lost matrix
#

Yeah

pine forge
pine forge
#

okay ill take a loko

#

loo

#

look

#

.

upper hazel
#

Who has encountered duping while canceling the inventoryClick event. When while clicking on an item it remained in place but was also picked up by the mouse cursor

lost matrix
# pine forge doess anyone have an answer to this questsion?

Depends on how you want to scale this system.
Usually you just map an inventory to a special handler for this inventory:
Map<Inventory, CustomHandler>
CustomHandler can be abstract and have onClick() onClose() etc.
No if you have an InventoryClickEvent, you ask the Manager which CustomHandler is mapped to this Inventory

kind hatch
pine forge
#

and then i ask the custom handler which player is mapped to it

#

?

#

seems to overcomplicate it

remote swallow
#

the player doesnt get mapped, it uses the view

pine forge
#

okay

remote swallow
pine forge
#

doess instanceof work on null?

remote swallow
#

you shouldnt need to instance check anything

pine forge
#

the custsominventory handler

remote swallow
#

i have that inside the custom inventory class

#

any custom invs extend it

lost matrix
pine forge
#

okay

#

in the click event im getting the custom inventory handler from the view and then im checking if its an instance of a sspecific handler to know which inventory they clicked

remote swallow
#

you know what inv it is from the map

exotic umbra
#

I'm trying to use Jedis but I'm getting java.lang.NoClassDefFoundError: redis/clients/jedis/JedisPool

I'm using Maven and I have shaded Jedis like this:

...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.2.4</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <relocations>
                    <relocation>
                        <pattern>redis.clients.jedis</pattern>
                        <shadedPattern>online.djsao.event.halloweenplugin.internal.jedis
                        </shadedPattern>
                    </relocation>
                </relocations>
            </configuration>
        </execution>
    </executions>
</plugin>
...

I'm using Kotlin with the JetBrains kotlin-maven-plugin. I don't exactly know what's wrong with this?

remote swallow
pine forge
pine forge
remote swallow
#

no you dont

pine forge
#

my s button is broken btw so dont mind

pine forge
remote swallow
#

its an isntance of custom inventory

pine forge
#

yes and?

#

it could be any insstance

exotic umbra
#

Jedis issue

remote swallow
#

yeah, correct

#

it has methods to handle clicks

pine forge
#

wait i think were not having the same structure

#

my cusstosminventories extend one CustomInventory class

remote swallow
#

do i have to make an example project

eternal oxide
#

um why are you creating a cutom inventory?

pine forge
#

cool, it workss!

pine forge
quaint mantle
#
public class consoleMessageEvent extends Event {
    private static final consoleMessageListener cml = new consoleMessageListener();
    private static final HandlerList HANDLERS = new HandlerList();
    private final LogEvent logEvent;

    public consoleMessageEvent(LogEvent event){
        this.logEvent = event;
    }

    public Message getMessage(){
        return logEvent.getMessage();
    }

    public Level getLevel(){
        return logEvent.getLevel();
    }

    public String getLoggerName(){
        return logEvent.getLoggerName();
    }

    public Instant getInstant(){
        return logEvent.getInstant();
    }


    public static HandlerList getHandlerList() {
        return HANDLERS;
    }

    @NotNull
    @Override
    public HandlerList getHandlers() {
        return HANDLERS;
    }
}

@Plugin(name = "Log4JAppender", category = "Core", elementType = "appender", printObject = true)
class consoleMessageListener extends AbstractAppender {

    public consoleMessageListener() {
        super("Log4JAppender", null,
                PatternLayout.newBuilder()
                        .withPattern("[%d{HH:mm:ss} %level]: %msg")
                        .build(), false);
    }

    @Override
    public boolean isStarted() {
        return true;
    }

    @Override
    public void append(LogEvent event) {
        /*String message = event.getMessage().getFormattedMessage();
        Level level = event.getLevel();

        JSONObject logData = new JSONObject();
        logData.put("message", message);
        logData.put("level", level.toString());*/

        consoleMessageEvent cme = new consoleMessageEvent(event);
        msg.log("calling the event");
        Bukkit.getPluginManager().callEvent(cme);

    }
}```

Does anybody know why this event isnt being sent ? I have a similar class on another side project (it only listens for the conosle though) and it works alright
umbral ridge
#

hey

quaint mantle
#

hey

#

;)

#

Pl;ease

#

for the love of god

umbral ridge
#

if you use getPluginLoader().disablePlugin(..) on onEnable, do you have to put return after it so that it doesn't execute the code afterwards OR does it jump to onDisable right after?

quaint mantle
#

consoleMessageEvent -> ConsoleMessageEvent

#

🙏

#

consoleMessageListener -> ConsoleMessageListener

umbral ridge
quaint mantle
quaint mantle
pine forge
#

ohno

remote swallow
#

naming conventions say class names are upper camel case

#

?conventions

fringe yew
#

am I just being stupid or why is this.saveDefaultConfig() erroring in my onEnable()?

error: The embedded resource 'config.yml' cannot be found

quaint mantle
pine forge
#
Vindicator vindicator = (Vindicator) event.getPlayer().getWorld().spawnEntity(event.getPlayer().getLocation(), EntityType.VINDICATOR);
AttributeInstance attribute = vindicator.getAttribute(Attribute.GENERIC_MAX_HEALTH);
attribute.addModifier(new AttributeModifier(UUID.randomUUID(), "Viking Horn", 2, AttributeModifier.Operation.MULTIPLY_SCALAR_1));
vindicator.getPersistentDataContainer().set(DominionSMP.DOMINION_ENTITY_KEY, PersistentDataType.STRING, "VIKING_" + event.getPlayer().getUniqueId());

For some reason this vindicator does not appear in the world

fringe yew
remote swallow
#

run mvn clean then run mvn package

eternal oxide
#

You are likely building using artifacts not Maven

pine forge
#

also i get this error and i have no idea whats the problem with it

quaint mantle
umbral ridge
#

xD

quaint mantle
#

i do

fringe yew
umbral ridge
#

or do you

quaint mantle
#

i do have a kitty yes

umbral ridge
#

send pic xD

quaint mantle
#

dm so we dont go off topic

grim hound
#

is there like an anvil item rename event?

#

and also an event for when each character is inputted?

remote swallow
#

anvil item prepare event or something like that

grim hound
remote swallow
#

it gets called for renaming

#

any anvil stuff it gets called

grim hound
#

what

rotund ravine
#

It won’t know to stop unless you return

grim hound
#

it won't stop, as that's not how java works

#

an error would have to be thrown or a thread interrupt in order for the code to stop

remote swallow
grim hound
#

I'll try it, thanks

onyx fjord
#

what List (or different collection) implementation should i use if i want to loop over values and remove them after iteration?

lost matrix
#

After (bulk like removeAll()) or while iterating (iterator.next() -> check something -> iterator.remove())?

lost matrix
#

LinkedList

warm mica
#

There is removeIf

onyx fjord
#

random access will be slow right?

onyx fjord
lost matrix
#

Yes random access is O(n), but removal while iterating is O(1)

onyx fjord
#

its just

iterate
do something
not needed anymore -> trash

rotund ravine
#

Borh correcting me ahaha

lost matrix
onyx fjord
#

yea wanted to say that now LOL

#

nevermind, epic

lost matrix
onyx fjord
#

👍 linkedlist is fine

rotund ravine
#

You can also be special and use some other dequeue or smth

lost matrix
#

LinkedTransferQueue KAPPA

#

Which is a lesser known but actually really cool collection for multithreading

onyx fjord
#

gotta sit down one day and learn em all

lost matrix
#

I sat down and did a bunch of benchmarks/research for the most used collections

onyx fjord
#

eyo what

java.util.ConcurrentModificationException: null
    at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:970) ~[?:?]
    at java.util.LinkedList$ListItr.next(LinkedList.java:892) ~[?:?]
...
lost matrix
onyx fjord
#

i see

#

i forgot for a moment that Iterator behavior isnt the same as for-i

lost matrix
#

Or in short

    linkedList.removeIf(element -> {
      element.doSomethingCool();
      return element.isDone();
    });
onyx fjord
#

theres not rly any condition in my code

sacred mountain
#

anyone got a guardian beam api for 1.20.2

worldly ingot
#

ty for fixing

lost matrix
twin venture
#

Hello there , iam using :
private ScheduledExecutorService executorService;

but when i want to stop it :

it send me the message :
but the code keep running

#

also using :
scheduleWithFixedDelay

#

so it must run every 1 minute and a delay bettwen them is 5 minute

lost matrix
#

I think shutdown only stops new tasks from being scheduled. Let me check if this changes for a scheduled executor

twin venture
#

will be waiting for you ^_^

#

using spigot 1.20

lost matrix
#

Yeah looks like you need to interrupt the scheduled tasks if you want to promptly stop a scheduled executor.
You can do that with shutdownNow();
What prevents you from using the bukkit scheduler and an async task?

river oracle
#

executor service is nice cuz you can use CompleteableFuture

lost matrix
river oracle
#

@twin venture unless your using CompletableFuture api you should really just be wrapping the Bukkit scheduler

#

you can make it a singleton and intiailize it on startup

#

then you don't have to worry about passing around your plugin instance

twin venture
#

alr thanks for the advice

storm crystal
#

anyone got particle usage tutorial?

umbral ridge
#

hey, in public boolean onCommand(..) when are you supposed to return true and when false and what is the difference?

#

is it supposed to be true when something is done successfully?

lost matrix
umbral ridge
#

Ok awesome thanks!

river oracle
#

I never return false

#

usage message cringe

umbral ridge
#

Yeah exactly.. I handle usage messages myself

#

Just wanted to know the difference now i do

river oracle
#

you can actually get the plugin command using getCommand() and set all the settings using that

umbral ridge
#

I make all messages customizable in config.yml

river oracle
#

idk how liberating the actual object is but you usually can just use #setUsage #setDescription etc

umbral ridge
#

including usage messages

lost matrix
smoky oak
#

can someone explain to me why this breakpoint triggers when spamming right click?

lost matrix
#

Accidental slip on the left mouse button 🙂

smoky oak
#

autoclicker time

lost matrix
smoky oak
#

yea i tried with an autoclicker, didn't happen

#

but its been reported to me this happened to a bunch of people

#

so idk

lost matrix
#

Might be some other code

smoky oak
#

arent bukkit events only callable server-side?

lost matrix
#

idk how to answer this

echo basalt
#

I use the breakpoint to highlight exception lines woeisme

smoky oak
#

also pretty sure that plugin is the only one running. considering it didnt happen with the autoclicker ur probs right with hitting m1 accidentally, but that doenst explain why so many people reported it happening

lost matrix
# smoky oak arent bukkit events only callable server-side?
  • Client sends packet to server
  • Server runs some code
  • Server detects something happening
  • Spigot fires event
  • All plugins get event
  • Server gets event
  • Server does more calculations
  • Server sends packet to update all other players on the new state
smoky oak
#

ah, so u can fire it with either protocollib or nms i assume?

#

oh on that topic

#

do you know if you can separate ArmAnimationEvent into left click and right click?

#

i'm having a problem where PlayerInteractEvent nor EntityDamageByEntityEvent happens when a player looks at a entity at a distance of around 4-5 blocks and presses left/right click

lost matrix
#

I mean... the PlayerInteractEvent is fired for sure

smoky oak
#

no it aint

#

im pretty sure i have numbers somewhere

smoky oak
#

0.719827 0.952823 are the x/z offsets where if you use water to position an entity in a corner away from you it triggers neither of those events

#

idk the exact distance unfortunately

#

but i know for a fact it doesnt trigger

#

i used a zombie piglin

storm crystal
#

where should I put this code in my plugin?

orchid trout
storm crystal
#

if I want to make it scan for entities when I right click do I just put it in listener?

lost matrix
umbral ridge
#

Any way to make this better? In 1 function?

#

I had an idea.. But I guess not xD

eternal oxide
#

no

tall dragon
#

if there were it would be implemented in fileconfiguration directly

umbral ridge
#

In c++ there are templates for that but what does java have?

eternal oxide
#

If you try to do it all in one method you'll end up with a confusing mess due to type erasure

umbral ridge
#

Ok thanks

lost matrix
umbral ridge
lost matrix
umbral ridge
#

Eh I'll redesign the class I think I'm overcomplicating stuff

lost matrix
#
  @SuppressWarnings("unchecked")
  public <T> T getValue(String path) {
    return (T) this.fileConfiguration.get(path);
  }

Or with type inference

  public <T> T getValue(String path, Class<T> type) {
    Object value = this.fileConfiguration.get(path);
    if(value == null) {
      return null;
    }
    if(!type.isAssignableFrom(value.getClass())) {
      return null;
    }
    return type.cast(value);
  }
umbral ridge
#

That's more like it I'll try this

#

thanks :D

echo basalt
#

doesn't FileConfiguration have a getter for that

lost matrix
umbral ridge
#

It does but that's fancier

lost matrix
#

Oh yeah

umbral ridge
#

A custom written one

storm crystal
#

whats wrong in it?

#

says that Player player is not a statement

umbral ridge
#

public

echo basalt
#

bro pasted a method inside another method

umbral ridge
#

XD

echo basalt
#

public

lost matrix
storm crystal
#

?xd

#

I literally copied what you gave me

lost matrix
#

Yeah, i can see that.

umbral ridge
lost matrix
#

Copy it into your class and call the method

glad prawn
#

method inside method

echo basalt
rotund ravine
umbral ridge
storm crystal
#

great if you want you can trash talk me further in dms

rotund ravine
#

?learnjava

undone axleBOT
echo basalt
#

let bro cook

#

smile has been watching south park I see

prisma sedge
#

Hey I'm really struggling to compare two different colors, does anybody else by chance know how to do this?

lost matrix
rotund ravine
#

Not really the wrost thing i have seen

echo basalt
grim hound
#

I didn't even know you could do that

rotund ravine
#

You can’t

glad prawn
#

u can

rotund ravine
#

Not really