#help-development

1 messages · Page 1822 of 1

smoky oak
#

im going to take a loook

quasi flint
#

dev releases the last time i checked

#

never mind

#

official 1.18 release is out

compact cape
#

What version should I use here? I used buildtools to install the 1.18

sullen marlin
#

1.18 is not 1.18.1

granite burrow
#

how can I check if a block is broken or not?

crimson terrace
granite burrow
#

yeah, I want to check if a player actually breaks a block so that they can have a change to get a reward

crimson terrace
#

listen to the BlockBreakEvent

granite burrow
#

I tried to do that and check if (the blocks location is air but it always returns as the same block

crimson terrace
#

the blockBreakEvent is called whenever a player breaks a block. there are methods to see which block was broken

#

if you want to check which block was broken you can just check wether the event.getBlock() is of a certain material

granite burrow
#

I think its another plugin conflicting with my plugin

crimson terrace
#

if what I wrote above doesnt work it just may be the case

granite burrow
granite burrow
#

so like if I try to check the location of the broken block and check if that location is air it would always return the original unbroken block, not air

crimson terrace
#

maybe the Block doesnt actually break until the event is over?

granite burrow
#

ah maybe

crimson terrace
#

could you show the code? I could help you find any errors that may be causing that

quasi kraken
#

Hi! I am new to plugin developement, or minecraft developement in general. Does anyone know how to build a project from pom.xml on Mac OS in intellij?

granite burrow
#

its basically this:

    @EventHandler
    public void onBlockBreak(BlockBreakEvent e) {
        // Check if block is actually broken
        if (!isBlockBroken(e)) { return; }
    }
    
    public boolean isBlockBroken(BlockBreakEvent e) {
        Location blockLoc = e.getBlock().getLocation();
        Block brokenBlockLoc = e.getBlock().getWorld().getBlockAt(blockLoc);
        return (brokenBlockLoc.getType() == Material.AIR && !e.isCancelled());
    }
#

wow im dumb, thats old code one sec

crimson terrace
#

well it doesnt look wrong.... maybe try to debug by sending messages to see where you end up, change the code up a bit to see where it goes wrong. the event could be getting cancelled by another plugin and be replaced by air

granite burrow
#

I edited it to what is currently is

hybrid spoke
#

the event is invoked BEFORE the block is broken

#

the block will be broken AFTER the event ran

hybrid spoke
#

yup

crimson terrace
#

could delay by a tick and then check?

hybrid spoke
#

most likely

granite burrow
#

oh dam okay ill try to do that

quaint mantle
#

how do i check if a player is the victim in EntityDamageByEntity event?

hybrid spoke
#

check if the entity is a player

quaint mantle
#

    @EventHandler
    public void onDamage(EntityDamageByEntityEvent event) {
        Entity damager = event.getDamager();
        Entity victim = event.getEntity();
        if (damager instanceof Player && victim instanceof Player) {

        }
    }

}```
#

is that correct?

hybrid spoke
#

if you want to continue if the damager AND the victim are players, yes.

quaint mantle
#

yes

#

ok ty

#

how do i check ifa command argument is a double?

#

i searched on google and the only thing i saw was command arguments as a string

lilac dagger
#

Double.parseDouble

#

or something

#

and catch the number format exception

#

if it throws then the string is not parseable and therefore 100% not a double

ionic hatch
#

Hey hey, wanted to ask if anyone has some good resources on making per-player-yml files for mass data storage and like a whole data manager class, which does all the lifting for the other features of the plugin. Have been trying out to get this to work for ages, but I couldn't get it to work. If anyone has any tips or resources, I'd love to hear them. Thank you

quaint mantle
#

Hello. im trying to make a hologram plugin with packets.
but the hologram despawns when i get far
so i made something to prevent it from despawning, if player distance with the hologram is 50, despawn it and if it was close, spawn the hologram but the hologram kinda wont despawn and a new hologram will spawn on top of it, making it bolder
Code : https://paste.md-5.net/meviyopihu.java

chrome beacon
ivory sleet
ionic hatch
# tall dragon what have you tried

making my own data manager class which has functions for creation, saving, editing of player specific yaml files. I'm stuck at the part where it creates, loads and deletes yaml files that are specific to UUIDs

tall dragon
#

if its a ton of data would you not be better off using json?

ivory sleet
#

Json is a subset of yaml

tall dragon
#

but its faster no?

ivory sleet
#

So valid json is valid yaml

ionic hatch
#

is json easier, is the question

ivory sleet
#

Idk I mean the difference won’t be that significant

#

No not really

tall dragon
#

not really easier no

ionic hatch
#

I can send you what i have so far, give me a second

ivory sleet
#

?paste (:

undone axleBOT
tall dragon
#

alright

tardy delta
#

You can serialize objects easier i think

ivory sleet
#

Still no

ionic hatch
#

ah, i cant attach files

#

pastebin it is

tardy delta
#

True yaml is just set and get

tall dragon
ionic hatch
#

ah

#

how do i use ?paste?

ivory sleet
#

Only reason to use json over yaml is that it’s more strict in terms of syntax

quaint mantle
ivory sleet
#

I’m in phone so helping you with packet related stuff will be hard w/o the protocol specs reference

tall dragon
#

@ionic hatch are you able to get in a call?, then i might be able to explain it to you

ionic hatch
#

uh, what exactly would you explain to me?

tall dragon
#

how you would create a system like this

#

that works

ionic hatch
#

that would be nice

#

I can join general

tall dragon
#

i cant share my screen on this server :D

ionic hatch
#

ah, well then private call me

quaint mantle
#

im using nms

#

1.8.8

golden turret
ivory sleet
#

You’d need a method
static char randomElement(char[] arr);

gleaming grove
#

Can you show implementation of this Variable?

eternal night
#

chars are not objects

lilac dagger
#

^

quaint mantle
#

Someday this will not be an issue 🙏

lilac dagger
#

you can always use Character instead of char

#

doubt

#

they can't do that unfortunately

eternal night
#

vahalla will be glorious

ivory sleet
#

Jep 218 right

eternal night
#

Yea, one of the biggest parts of valhalla

#

urgh these projects just look so good

#

where is project loom when I need it

quaint mantle
lilac dagger
#

he can replace that NUMERIC CHAR to be of Character[] type

#

that would fix his issue

ivory sleet
quaint mantle
#

What's loom

eternal night
#

like golang gorutines

#

if that makes sense

#

not a full thread, more like a lightweight one

#

they called it fiber I believe

#

e.g. scheduled on the JVM not the OS kernel

quaint mantle
#

Is it fine to use Bukkit scheduler to remove expired cache entites? Have to do a custom implementation, cant use caffeine =(

ivory sleet
#

Doesn’t guava have something decent

#

But yeah probably fine, altho might wanna go with a single threaded scheduler executor service + maybe a work stealing pool or just a cached one.

quaint mantle
#

Hello. im trying to make a hologram plugin with packets (NMS not Pooplib).
but the hologram despawns when i get far
so i made something to prevent it from despawning, if player distance with the hologram is 50, despawn it and if it was close, spawn the hologram but the hologram kinda wont despawn and a new hologram will spawn on top of it, making it bolder
Code : https://paste.md-5.net/meviyopihu.java

#

Like, i can use caffeine, but idk how to efficiently utilize it in my case. I Cache clans by l 2 keys, user's uuid and tag, soo i have 2 caches <String, Clan> and <UUID, Clan>. When clan is loaded, it should be in both caches, to avoid unecessary loading. At this point, AsyncLoadingCache is really limited

valid solstice
#

Can i ask non spigot api questions in here? (about general java)

eternal night
#

yea sure

#

if they are too basic you usually just get a !learnJava lol

quaint mantle
#

"how to aces varable from one class in another"

valid solstice
#

What is the best way to implement weighted selection?

quaint mantle
#

elaborate

valid solstice
#

weighted selection as in probability of x being chosen with a given weight 20%

#

something like that

quaint mantle
#

ah

valid solstice
#

something like {x : 20F, y : 30F, z : 40F}, where x y and z have a propability of being chosen by 20%, 30%, 40% respectively

proud basin
#

use math

valid solstice
#

that's pretty obvious

#

i need help in implementing it

young knoll
#

NavigableMap is good

quaint mantle
#

new Random().nextDouble() will return a double starting from 0.0 and ending 1.0
if(v < 0.2) // 20%
else if(v < 0.3) // %30

young knoll
proud basin
#

manya thats a 50 50 ish

#

with random you don’t have a 20% chance to get it

#

its a random number

#

but then I again

#

its out of 100%

#

just use a algorithm

valid solstice
quaint mantle
#

Does someone have a plugin where you can control ore spawning?

noble lantern
#

Does this method send a request to mojangs api?

#

Im only using it on players who have player on the server before

onyx wadi
#

Can someone please tell me why my modules are not loading in bungeecord? (commands like /send or /server isnt working)

noble lantern
#

well shite

#

spigot really gonna make me cache player heads

lilac dagger
#

you can check the main world for the uuid

#

instead of using that method

noble lantern
#

Im not getting the UUID

#

Im getting the OfflinePlayer so i can skin a player head to match a player

lilac dagger
#

if the player is online it is fine

noble lantern
#

my god codacy is so strict

noble lantern
#

"You have one unused import, therefore your code is shit and not up to standard"

visual tide
#

is it ok to set the main thread timeout to ~20 (default is 60)?
cuz when the server hasnt ticked for that long it's probably already too late

opal sluice
#

Doesn't Player extends LivingEntity ? cause in 1.18 it doens't seem to be the case

#

Need to cast Player to LivingEntity

#

Ok, just looked at the 1.18 doc and it does extends LivingEntity, but it doesn't seem to get the "setInvisible" method from a Player object

#

Very weird :/

ivory sleet
#

Only the deprecated one which takes a String might make a request

#

but never the uuid

#

If the player has never joined

#

Then the name will be null

golden turret
#

is it possible to convert a ChatColor to Color?

#

both from bukkit

twin venture
#

i need help ..

#

cannot access com.sk89q.worldguard.LocalPlayer

#

trying to update to 1.17.1

#

and i got this error while using worldguard

#

i already asked for help in discord server for worldguard but help is kinda slow there xd

noble lantern
#

no need to cache heads after all

quaint mantle
#

Is it possible in the API to use the motion nbt for fireworks?

opal sluice
#

@ivory sleet Do you know how if there are some api that have been removed from the actual spigot jar (the one with nms), like io.netty or event the authlib from mojang

ivory sleet
#

Yes

#

Apache

#

But that’s probably due to it being quite the obsolete lib

visual tide
#

conclure

opal sluice
#

Yeah, the apache one is state in the actual thread md_5 did

visual tide
#

do you know if setting the spigot watchdog main thread timeout to like 20 secs as opposed to 60s can cause issues?

opal sluice
#

But I can't find netty and the authlib so I can't get the GameProfile to get skins 😢

ivory sleet
#

lvj no clue actually

#

But what’s the purpose of the spigot watchdog thread? If it has some coupled logic to a certain behavior then it might be unsafe

visual tide
#

it has a loop that constantly checks if its being ticked

#

and if it hasnt been ticked for the timeout length

#

aka main thread is locked up

#

it kills the server

#

and tries to restart

#

on one hand if the server is lagging out really bad you might not want to restart after 20 secs
but if it actually hasnt ticked for that long its almost dead anyway

#

so

ivory sleet
#

hmm I see

twin venture
#

anyone help me ?

ivory sleet
#

in that case 60s should be fine

twin venture
#

cannot access com.sk89q.worldguard.LocalPlayer

ivory sleet
#

given that there's no implementation which is coupled to the former 20s

maiden briar
#
java.lang.ClassCastException: class me.tvhee.packetlistener.PacketListenerAPI cannot be cast to class me.tvhee.packetlistener.PacketListenerAPI (me.tvhee.packetlistener.PacketListenerAPI is in unnamed module of loader 'PacketListenerAPI-1.0.0.jar' @17a38e5a; me.tvhee.packetlistener.PacketListenerAPI is in unnamed module of loader 'AdvancedReplacer-1.0.0.jar' @82e38a9)

??????

#
PacketListenerAPI packetListenerAPI = (PacketListenerAPI) Bukkit.getPluginManager().getPlugin("PacketListenerAPI");
packetListenerAPI.addPacketHandler(new AdvancedReplacerPacketListener(this));
System.out.println(packetListenerAPI.getHandlers());
#

Oh didn't set <scope>provided</scope>

wary harness
#

how would I make mysql prevent insert if value and id are same as those in database

#

if some one could help with example statment

visual tide
ivory sleet
#

ah right

#

well you get what I meant regardless I hope

visual tide
#

oke ty!

ivory sleet
#

:p

maiden briar
#

https://paste.md-5.net/fovuvezibe.bash

@Override
        public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception
        {
            SimpleCancellable cancellable = new SimpleCancellable();
            Object packet = msg;

            if(classPacket.isAssignableFrom(msg.getClass()))
            {
                SentPacket sentPacket;

                if(this.owner instanceof Player)
                    sentPacket = new SentPacket(packet, cancellable, (Player) this.owner);
                else
                    sentPacket = new SentPacket(packet, cancellable, (ChannelWrapper<?>) this.owner);

                for(PacketHandler packetHandler : PacketListenerAPI.getHandlers())
                    packetHandler.onSend(sentPacket);

                packet = sentPacket.getPacket();
            }

            if(cancellable.isCancelled() || packet == null)
                return;

            super.write(ctx, packet, promise); //262
        }

What is wrong with this code?

#

@ivory sleet I can ping you?

red sedge
#

is there aything I can use like PDC but like more temp

mortal hare
#

is there any way to convert normalized slot to raw slot of Inventory easily?

wicked tiger
#
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
import net.minecraft.server.v1_8_R3.EntityArmorStand;
import net.minecraft.server.v1_8_R3.World;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
import org.bukkit.event.entity.CreatureSpawnEvent;
public class Ball extends EntityArmorStand{
    public Ball(World world){
        super(world);
        this.a(new AxisAlignedBB(0.0D,1.475D,0.0D,0.5D,1.975D,0.5D));
        this.setSize(0.5f,0.5f);
        this.setGravity(true);
    }
    public static Ball spawn(Location loc){
        World w=((CraftWorld)loc.getWorld()).getHandle();
        final Ball b=new Ball(w);
        b.setLocation(loc.getX(),loc.getY(),loc.getZ(),loc.getYaw(),loc.getPitch());
        ((CraftLivingEntity)b.getBukkitEntity()).setRemoveWhenFarAway(false);
        w.addEntity(b,CreatureSpawnEvent.SpawnReason.CUSTOM);
        return b;
    }
}

I made this in hope to create a custom entity that displays as an armor stand but has its server side hit box a 0.5^3 cube at its head. the hit box did become a small cube as arrows go thru it, and i did this.a(new AxisAlignedBB(0.0D,1.475D,0.0D,0.5D,1.975D,0.5D)); trying to raise the height of the hitbox but the hitbox is still at the armorstand's leg, what should i do?

#

nah i removed those bc of discord msg length limit

opal sluice
#

Hi, does someone knows where to find the "com.mojang" libs?

wicked tiger
#

I think they are in .Minecraft/assests

smoky oak
#

do you want to know how to import them or where to find the docs?

opal sluice
smoky oak
#

?

opal sluice
#

In 1.18 I can't find it

#

Before it was embedded in the spigot jar

smoky oak
#

you imported both spigot-api and spigot?

opal sluice
#

yes

smoky oak
#

did you already reload your ide?

opal sluice
#

now in "com.mojang" there is only brigadier and math

fossil mural
#

I been trying to make my code teleport to a set of cordninaest if its under y70. But i cant make it

smoky oak
#

can you tell us more about that? I am unsure what you mean

fossil mural
#

its a parkour and if you fall you should be teleported to your last chekpoint but i dont want the player to die

#

under y70 you should be teleported back to the checkpoint

smoky oak
#

either a sceduler or a player move event

#

then check height and if below 70 teleport back

fossil mural
#

thank you

smoky oak
#

I'd recommend a sceduler checkign every 100ms

#

it should be less computing intensive and can be async iirc

mortal hare
#

how can i get window ID of bukkit inventory view

#

Casting InventoryView to CraftInventoryView throws ClassCastException, and it makes sense

#

how can i get OBC version of CraftInventoryView then

wild reef
#

Hey I wanted to ask how I can check if a player slept - and due to passing night gets up from bed. I know I have to use the PlayerBedLeaveEvent - pls correct me if there is a better option for that.
So do I check if world.getTime() is like 6000 or something? - if yes does anyone know the exact time when someone wakes up?

hybrid spoke
#

otherwise you can go over the CraftPlayer and get the activeContainer and those windowID

mortal hare
#

the thing is

#

the object that im trying to downcast

#

is derived from anonymous method

#

inside CraftContainer class

#

that's why downcasting doesnt work

#

its because it includes custom implementation of inventory view

quaint mantle
smoky oak
#

does this give me the chunk origin?
((int) location.getX()>>4)<<4

ionic hatch
#

I'm trying to re-name items, but using the method

player.getInventory().getItemInMainHand().getItemMeta().setDisplayName("Test");

doesn't work. Anyone got an idea why?

tacit drift
#

to animate an armorstand's arm to go up and down, I guess i need to make some sort of complicated equation right?

ionic hatch
#

what do you mean by that?

quaint mantle
#

setItemMeta

ionic hatch
#

ohh, thanks!

royal vale
#

How would I check if a block instantly breaks or not?

#

The "block hardness"

ancient plank
#

material has a #getHardness() method

kind hatch
royal vale
mortal hare
#

you can make keyframes, which could be precalculated

ancient plank
#

idk anything about 1.8

mortal hare
#

its faster and more performant approach since its a static animation

#

but long story short yes, you need some basic math knownledge

royal vale
tacit drift
#

ok thx

fossil mural
#

how do i teleport a player to a location

royal vale
#

I know, but I'm recreating smth and 1.8 is needed

pastel arrow
#
        double final_damageamount = damageamount * 2;

        Player all_Players = (Player) Bukkit.getServer().getOnlinePlayers();
            all_Players.damage(final_damageamount);``` 

i want to deal damage to all online players and the damage should be doubled. this isn't working, can someone help me?
tacit drift
#

PDC is 1.14+?
If so, for backwards compat i should use NBT?

pastel arrow
ancient plank
#

do you know java

pastel arrow
#

kinda

#

why?

ancient plank
#
        Player all_Players = (Player) Bukkit.getServer().getOnlinePlayers();
            all_Players.damage(final_damageamount);

you're casting a list to a player

pastel arrow
#

oh, thanks

waxen plinth
#

If people want to use a version that's 7 years out of date, fuck em, it's not your problem

tacit drift
#

Yeah the client only needs it for 1.16+

#

so it's all good anyway

waxen plinth
#

👍

vale ember
#

how can i remove scoreboard from player?

quaint mantle
#

how would i make updating a filled map every 500 milliseconds not cpu intense...

fossil mural
#

How do i make the computer know im under y70?

tacit drift
quaint mantle
#

let me try packets

#

i am trying to make a minecraft map show a movie in minecraft

tacit drift
quaint mantle
#

ty

#

this is exactly what i am looking for

violet niche
#

/help team modify basic color gives you /team modify basic color <value>, and when you write it as a command, you get a list of colours as suggesstions

#

Is it possible to emulate this with a custom command?

#

It looks like the suggestions mechanism is client-side, and sadly all of the builtin argument switches are hardcoded

smoky oak
#

i need to replace a lot of blocks but both bukkit and worldedit takes roughly the same time

#

which is 300-400 ms and far too long for what i need

gilded pilot
#

Can somebody please help me add custom structures to 1.18?

#

Through datapack, plugin or any other way

tacit drift
#

see how this does it if you want to do a plugin with that, else just use it

bitter ridge
#

is it possible to make the speed potion effect not add any speed? just so the player has it but it doesn't make him any faster

gilded pilot
#

❤️

bitter ridge
#

I will add the speed boost back but in a custom way. So that's why I want to know

zealous osprey
#

For the zoom in ?
Nvm

quaint mantle
#

well idk maybe you could send a packet

#

But it may be client side

vale ember
#

anyone worked with mineskin client?

tardy delta
#

im dying rn

vale ember
quaint mantle
#

see the docs

vale ember
#

where?

#

i didn't find anything

smoky oak
#
public static void setBlockInNativeChunk(World world, int x, int y, int z, Material material) {
net.minecraft.world.level.World nmsWorld = ((CraftWorld) world).getHandle();
BlockPosition bp = new BlockPosition(x, y, z);
net.minecraft.world.level.chunk.Chunk nmsChunk = nmsWorld.l(bp);
IBlockData ibd = (CraftMagicNumbers.getBlock(material)).n();
nmsChunk.a(bp,ibd,false);}

500ns/block

#

thats an improvement over bukkit methods doing like 1ms / block

#

drawback is that it requires relog

ivory sleet
#

yes but thats because bukkits method is safe to use

lavish hemlock
#

who cares about safety?

smoky oak
#

bukkits 'safe to use' methods are so slow that even replacing 6k blocks per second crashes the server

#

so no

#

im not gonna use those

modern sluice
#

yo im having a hard time understanding what an api is and why its used

ivory sleet
#

you can distribute the workload rather than placing all those blocks in a single tick

smoky oak
#

which one

modern sluice
#

and what its needed for

ivory sleet
tardy delta
lavish hemlock
modern sluice
#

🐱

errant drift
#

🐶

ivory sleet
# modern sluice and what its needed for

hmm I mean, application programming interface, an interface is something which only provides what you can do, it doesnt tell you how its done, application programming means its an interface for programmers and implemented by an application or smtng

lavish hemlock
tardy delta
#

i'm dying rn, i'm programming and i have exam dutch tomorrow 😢

#

i'm so fucked

modern sluice
#

sorry im dumb

hasty prawn
modern sluice
#

man didnt do good in school

ivory sleet
lavish hemlock
quaint mantle
#

How do I set the yaw of a spawned parrot in API? [1.12]

lavish hemlock
#

hm

smoky oak
#

@lavish hemlock even if it does
IDC it'll work well enough

ivory sleet
tardy delta
fringe latch
hasty prawn
modern sluice
#

so i need an api for every interface

#

?

tardy delta
#

wut

smoky oak
#

an api is what allows you to tell software you did not write to do

#

for example

modern sluice
#

dude i told u im dumb

errant drift
#

You aren't dumb you just haven't tried to learn

smoky oak
#

without bukkit api you cant send messages on a bukkit server

quaint mantle
modern sluice
#

colin u dont know my situation man

ivory sleet
#

and an interface is something which tells you what you can do with it, not how its done, for instance a keyboard. you dont know how the keyboard and the computer talks to each other, but you do know what pressing the button 'Enter' will do

modern sluice
#

"everyone works different"

tardy delta
modern sluice
#

ok dude if I dont do good in ela or spanish how am i gonna do good in coding

#

I struggle with comprehending

errant drift
#

those are not connected

tardy delta
#

spanisch..

errant drift
#

I'm absolutely shit at Spanish but I'm decent at coding

tardy delta
#

i'm lucky i dont have spanish

lavish hemlock
#

I'm bad at math, I'm the best programmer in this room :)

golden turret
fringe latch
modern sluice
#

ik how things work its just I dont have the time im distractable human being and most are

golden turret
#

trying to know why

modern sluice
#

but its gonna be a struggle to even learn the basics

lavish hemlock
#

hat

modern sluice
#

I want a hat!

tardy delta
lavish hemlock
#

you don't get a hat

modern sluice
#

public static void give me a hat!

#

😄

lavish hemlock
tall dragon
#

Only the best programmer gets a hat

#

👍

modern sluice
#

yes

#

me

#

!

tardy delta
exotic willow
#

How can you be good at programming when you’re bad at maths

smoky oak
#

well im a typical programmer
I only copy and paste with some minor edits

modern sluice
#

well see im good in math and everything else just not comprehending

smoky oak
#

also programming doesnt necessarily reequires maths

errant drift
lavish hemlock
tall dragon
#

Not everything is math in programming

tardy delta
#

simple: dont do maths

exotic willow
modern sluice
#

programing requires copy and pasting and reading

exotic willow
#

But you need some math for programming

smoky oak
#

also java has a Math library

exotic willow
#

And logic as well

tardy delta
#

i cant do particles because i'm bad at math

smoky oak
#

mostly logic

errant drift
#

Calc is fairly easy though so it's really not that bad

modern sluice
#

Calc is useless

errant drift
#

I can't do algebra for shit though

#

calc is so useful

lavish hemlock
#

I've been programming for 2 years and most of my libraries have little math but are still impressive

modern sluice
#

for what

tardy delta
#

what's calc?

tall dragon
#

@tardy delta i just kidnapped a math god for particles

tardy delta
#

oeh kinky

lavish hemlock
modern sluice
#

I never took calc

#

😄

tardy delta
#

what's a calculus?

#

🤡

lavish hemlock
#

oh

ivory sleet
#

lambda calculus 😌

tardy delta
#

i was thinking of a calculator

golden turret
modern sluice
#

npm install node.js gg!

tardy delta
#

oh no

#

another one

smoky oak
#

the only correct way to check if something is even or odd is this:

(((int) a)>>1)<<1 == ((int) a)
quaint mantle
#

functions are stolen from math smh

tardy delta
#

aaaah bitwise stuff

#

things that i dont understand

ivory sleet
lavish hemlock
lavish hemlock
#

I wish compilers optimized most operators down to bitwise ops

smoky oak
#

bitwise is basically rapid division or multiplication by/through 2, and since it's cast to int the 0.5, if odd, is dropped. That way odd number -> shift 1 right -> int -> shift 1 left becomes even

lavish hemlock
#

would speed up a lot of non-JIT'd code

quaint mantle
#

oh that was a joke

lavish hemlock
smoky oak
#

now it works

golden turret
#

bruh

lavish hemlock
#

btw that code is terrifying

#

bits scare me

unreal quartz
lavish hemlock
golden turret
#
boolean isOdd(int number) {
  boolean even = false;
  switch (number) {
    case 0:
      even = true;
      break;
    case 1:
      even = false;
      break;
    case 2:
      even = true;
      break;
    case 3:
      even = false;
      break;
    case 4:
      even = true;
      break;
    case 5:
      even = false;
      break;
    case 6:
      even = true;
      break;
    case 7:
      even = false;
      break;
  }
  return !even;
}```
#

btw it just accepts numbers between 0 and 7

tardy delta
#

lets go to 10000

golden turret
#

yes

#

clone the project and contribute

vale ember
#

rewrite it with if-else, it would be far more readable

smoky oak
#

You learned coding from YandereDev

hybrid spoke
#

can 69 be random?

smoky oak
#

is 2 even or odd? It's only divisible by 1 and itself

tardy delta
tardy delta
#

a do while which decrements the number by 1 and checks if the final result is 0 or 1

#

🤡

smoky oak
#

do two threads both subtracting 1 until it's either 1 or 0

#

then if its 1 its odd and if its 0 is even

lavish hemlock
#

do they

#

oh

#

I know what you're saying now

hybrid spoke
#

just check if its odd and if so add 1 so its not odd anymore

golden turret
#

no, it may be not thread safe

smoky oak
#

thats the whole point

vale ember
#
boolean isOdd(int number) {
  if (number == 0) return false;

  return !isOdd(number - 1);
}
tardy delta
#

we dont care about safety

smoky oak
#

since when are computers 100% accurate

smoky oak
#

with twothreads its twice as fast

lavish hemlock
#

it can be thread safe if atomic ints are used

golden turret
#

yes

#

you may save a file with odd numbers and other file with even numbers

#

store them in a server

#

download them, and check if your number is in one of the lists

#

then use one of the codes above just to ensure that the number is odd or even

tardy delta
#

123GB

#

😳

vale ember
quaint mantle
#

see pom.xml

vale ember
#

I checked, but idk

golden turret
#

you may compile the project yourself

#

git clone https://github.com/InventivetalentDev/MineskinClient.git
mvn install

left lodge
#

does anyone know the maven dependency for nms 1.18.1?

golden turret
vale ember
#

Should I use it compileOnly or implementation?

quaint mantle
#

implementation

golden turret
#

compileOnly

left lodge
golden turret
#

did you ran buildtools?

#

?buildtools

left lodge
#

why would i need to do that

golden turret
#

spigot repo dont provide the nms artifact

#

you need to run buildtools

left lodge
#

i thought it was in the maven central repository

#

i never had to run buildtools to access nms for any other version

golden turret
#

then maybe you used a repository that had nms

#

and it got cached

#

to your maven local

#

if you ignore the maven local you will see that the dependency you used will be invalid

left lodge
#

so i just run buildtools the same way i would if i just wanted a spigot jar, and it will also install nms to my maven local?

golden turret
#

yes

smoky oak
#
Does not send updated blocks to player (requires a relog)
Does not work if specified coordinate is in a not loaded chunk```
But even after a reload it's still not changed?
golden turret
#

elaborate the question

smoky oak
#

relog

#

and im referring to the quick block set method i posted earlier

#

thing is

#

i get the chat message that it worked?

#

?paste

undone axleBOT
smoky oak
#

im running nms_1_set(world, chunk.getX(), chunk.getZ())

#

that number gets shown in chat

#

but even after relogging it is still not there

golden turret
#

maybe

#

using spigot

#

and a good host

smoky oak
#

tried and failed since i dont know how to conpartimentalize loads

golden turret
#

99% of the problems got solved

tacit drift
smoky oak
#

also on a unrelated note i just trolled myself

#

i did the same thing mojang did and decided to replace bedrock with deepslate

#

and i forgot

#

and now thought that i had to manually replace bedrock lol

vague swallow
#

How can I prevent a crossbow from shooting?

golden turret
vague swallow
#

The PlayerInteractEvent?

tacit drift
vague swallow
#

Alr ty

#

Can I ask a data pack question here?

rough drift
#

Heyo, quick question: does AsyncPlayerPreLoginEvent#disallow fire a PlayerQuitEvent?

tacit drift
ancient plank
#

probably not since technically the player hasn't joined in pre-login event? but ^^ https://tryitands.ee

sullen marlin
#

it wouldnt

proven river
#

I'm trying to make a player with the OP permission exempt but I cant find the actual permission name does anyone know what it is?

rough drift
#

player.isOp

#

its a method

proven river
#

oh ok

#

thanks

rough drift
#

np

wild reef
#

Hey, does anyone know since which version player.sendTitle works?

#

I thought it came out in 1.8 but by it doesn't seem to be there in the spigot docs

tacit drift
#

it is

#

but the method is different

#

if you want to work in more versions, use packets (pretty easy to use)

wild reef
#

for checking the client version?

tacit drift
#
    public static void sendActionBar(Player player, WrappedChatComponent text){
        ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
        PacketContainer chatPacket = protocolManager.createPacket(PacketType.Play.Server.SET_ACTION_BAR_TEXT);
        chatPacket.getChatComponents().write(0, text);
        try {
            protocolManager.sendServerPacket(player, chatPacket);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        }
    }
tacit drift
sullen marlin
#

sendTitle exists in 1.8.8

#

idk about 1.8.0 but if youre using that youre in idiot

#

and if youre using packets you're also an idiot

tacit drift
#

why

#

isn't the method different on newer versions?

wild reef
#

nah I'm on 1.8.8, thanks @sullen marlin it just doesn't have the same parameters, that's why it wasn't working

sullen marlin
#

doesnt really matter, it just does == anyway

#

really not as bad as people make it seem

quaint mantle
#

Hey,

I made ender eyes fly to the nearest end frame if one is near.

It works without any problems, except that the portal doesn't light when all ender eyes flew into their place.

Anyone knows how to update the portal?

opal sluice
#

Can someone help me with this ?

#

I don't understand where should I get it... I already tried adding datafixerupper in my dependencies

#

But it seems that it doesn't find it :/

sullen marlin
#

?xy

undone axleBOT
opal sluice
sullen marlin
#

?xy

undone axleBOT
vast shale
#

Anyone know a way of enabling and disabling event listeners on a whim? Trying to write a bunch of minigames but don't wanna a ton of listeners that'll check and return

sullen marlin
#

HandlerList#unregister

opal sluice
# sullen marlin ?xy

Just trying to update a lib from 1.17 to 1.18 that requires that class. And I don't find it anywhere, before it was directly in the spigot jar, now it does not anymore. That's why I'm trying to find the right nms repos to add to my dependencies (not sure it was that kind of explanation you needed)

sullen marlin
#
  1. I wont help unless you specifically say why
opal sluice
#

part 1 already done

#

Going to make something clear for the part 2, it's a bit draft in my head so you wouldn't understand

tender shard
#

good evening everyone

proven river
#

Whats a way to send a message to the whole server i've looked at Bukkit.Broadcast but that seems deprecated for the most part,
I'm trying to get it so that it gets the players username and a message after then sends the message to the whole server

vast shale
#

How would I use HandlerList.unregister to disable a class implementing Listener?

sullen marlin
#

store listener in variable, pass to unregister

tender shard
proven river
vast shale
#

I'm writing Minigame's each with their own Listener class that I wanna be able to enable and disable on start and end respectively

tender shard
tender shard
vast shale
#

But how would I register them when I need then unregister?

chrome beacon
tender shard
# chrome beacon Paper

well just because paper says something is deprecated, it's not true. Use Spigot and Spigot's docs, or use Paper and check Paper's docs

#

Check out paper's discord if you have questions about their API

proven river
#

wait that dosent make sense since i am using spigot?

chrome beacon
#

You're using the Paper api

tender shard
#

you use paper -> ask on paper discord

proven river
#

ok nvm i'm getting confused with smthn else thanks for the help :D

tender shard
#

np^^

tender shard
sonic phoenix
#

I know there is a warning that most methods of the api are not thread safe, but, is world creation thread safe? I would really like to do it on the background

sullen marlin
#

no

sullen marlin
#

if you load it without spawn should be pretty quick?

vast shale
#

To avoid having to do a ton of ex " if !player.isInGame() return"

tender shard
#

md_5 can I DM you quickly? just a tiny question about a spigotmc rule

vast shale
#
Listener test = this.gameListener;
        HandlerList handlerList = new HandlerList();
        handlerList.unregister(test);
``` Does this look like the correct use to unregister
sullen marlin
#

HandlerList.unregister, its static

sonic phoenix
#

:/, are there any workarounds? a void world is taking 9 seconds on my local machine (the file copy takes nothing really, but bukkit world loading does)

vast shale
#

It gave me an error saying I couldn't make a static reference to a non static method

tender shard
sullen marlin
#

oh its not static

sonic phoenix
#

sure

sullen marlin
#

so guess you gotta do it for each event

#

XYZEvent.getHandlerList()

#

no wait

#

there's unregisterAll which is static

vast shale
#

Ahh

#

so this

sonic phoenix
#

I am creating a map loader utility to spin up worlds for minigame instances. Maybe 9 seconds is not bad? But I'm wondering if it will scale

vast shale
#
Listener test = this.gameListener;
HandlerList.unregisterAll(test);
#

Or even just HandlerList.unregisterAll(this.gameListener);

loud oracle
chrome beacon
#

Have patience

tender shard
chrome beacon
#

It's not

tender shard
#

yeah then please don't ask for it here^^ 😄

loud oracle
#

i was asking for someone to take a look at #help-server, didnt need them specifically to answer here

chrome beacon
#

Still don't ask here

tender shard
#

you will get an answer there. don't spam here pls

loud oracle
#

im not spamming?

opal sluice
#

does someone knows the initMenu, from the EntityPlayer, new name ?

tender shard
#

this channel is for development

tender shard
tender shard
loud oracle
#

i asked a single time

#

calm down

tender shard
loud oracle
#

thanks

opal sluice
tender shard
# loud oracle thanks

sorry didn't meant to be rude. Just wanted to say, this is the wrong channel for that

chrome beacon
#

Why do you need it

#

NMS sounds like a bad solution

tender shard
chrome beacon
#

Or no mappings

opal sluice
#

mojang actually, I can swap to spigot's one, but I already did it all by mojang's ones ^^'

tender shard
tender shard
opal sluice
#

So, I have "a", "b", etc...

tender shard
#

can you show us some code that worked in 1.17 but doesn't in 1.18?

tender shard
opal sluice
#

Isn't the original mojang map ?

young knoll
#

The original is obfuscated

tender shard
#

yeah maybe I explained it not good enough

#

well

grave mason
tender shard
#

"original" is actually what the mojang mappings give you

#

but mojang obfuscates it before shipping the .jar

grave mason
#

but that is not working..

opal sluice
chrome beacon
grave mason
#

1.16.5

tender shard
#

@opal sluice You should really switch to using the mojang remapped jar instead, it will save you much headache in the future

opal sluice
tender shard
#

you won't have to worry about fields being called "a" or "b" or "c" anymore

#

yeah I know 😦 but once you've done it, you will be happy in the future 😄

grave mason
young knoll
#

Are you sure you are depending on the 1.16.5 api

tender shard
chrome beacon
opal sluice
grave mason
chrome beacon
grave mason
#

o found it.

young knoll
#

It's setVisible

tender shard
#

but anyway: I can only recommend to switch to mojang mappings. it's a pain in the ass the first time, but you'll profit from it in the long run 🙂

sullen marlin
#

I can only recommend to switch to the API

chrome beacon
opal sluice
tender shard
chrome beacon
#

Then you PR

sullen marlin
#

the amount of people using NMS for scoreboards is ridiculous

tender shard
tender shard
young knoll
#

Then make a feature request

opal sluice
low temple
#

Hey does anyone know how to get a List object of all of the available items in-game?

tender shard
#

I'd love to see a packet API

paper viper
#

or something

paper viper
tender shard
#

If so: yes, Material.values

young knoll
low temple
#

Ahh i was trying .getValues()

tender shard
low temple
#

ty

paper viper
#

What coll said above

#

And also tons of great alternatives exist like protocollib

#

and also who is going to spend the time

#

you can do it :p

#

i dont got that time

tender shard
#

so you say "improving the API is not a good idea because there's already a plugin for that"? 😛

paper viper
#

??

young knoll
#

Ask MD about a packet API

#

He has an answer for you

tender shard
#

I know it won't happen

paper viper
#

if u know its not going to happen, then there isnt really a point asking tbh. and whats wrong with protocollib even?

tender shard
#

I was just answering to the person who asked for adding it...

#

TL;DR: we were talking about mojang/spigot mappings. I said "use mojang mappings, it will help you in the long run". then someone said "just use the API", to which we replied "but not everything is available in the API". to which someone replied "then create a PR". And I answered "won't happen for certain things"

tender shard
#

also protocollib sucks imho

paper viper
#

I'd love to see a packet API

tender shard
#

What do you think is easier?

new WhatEverPacket(player, entity);
#

or

quaint mantle
#

i wonder how much version to version maintenance would be required for a packet api

paper viper
#

a lot

#

just think about 1.16 to 1.17 alone

tender shard
#
new WhatEverPacketWrapper().setUUID(0,player.getUniqueId()).setString(0,someOtherstuff);```
quaint mantle
#

and it'd (i assume) require backwards compatibility in most cases

chrome beacon
#

We don't need more apis for packets ;/

tender shard
paper viper
#

cause new features and shit

#

so you have to handle that too

#

thats why its not ideal

tender shard
quaint mantle
#

I have a project where I want to make an API around a version of a different game from 2005 to like 2010 🙂 i dunno a good way to do it for the last 4~ years

chrome beacon
quaint mantle
#

packet structure changes is annoying 😦

paper viper
#

Exactly

#

that too

tender shard
#

It's just something that had to happen

paper viper
#

Makes it completely not ideal

tender shard
#

It happened way too late

#

people are just too lazy to update their legacy code

#

switching to mojang mappings should have happened the minute they became available imho

chrome beacon
#

Licensing was a bit off so people hesitated in the begining

woeful crescent
#

Can you set a vanilla attribute on an armor piece that raises its defense?

young knoll
#

GENERIC_ARMOR?

woeful crescent
#

?

waxen plinth
#

lol

#

ItemMeta#addAttributeModifier

#

Use Attribute.GENERIC_ARMOR

atomic violet
#

so i have a respawn event, and i’m trying to make it so when a player respawns, it gives them some kind of identifier so i can recall them in a block break event, is there any way to give tags or something like that

waxen plinth
#

Yeah

#

addScoreboardTag

#

And then you can check with getScoreboardTags().contains

atomic violet
#

and then i can do if… blah blah to recall that

#

okay

#

thanks

waxen plinth
#

Those are persistent though

#

If you don't want/need persistence you should use a map

atomic violet
#

what’s that mean

waxen plinth
#

It will stick around if the server restarts

atomic violet
#

ohhh yes that’s fine

#

i can remove the tag right

waxen plinth
#

Yes

atomic violet
#

same thing just remove instead of add?

waxen plinth
#

Probably

mighty sparrow
woeful crescent
waxen plinth
#

pings me
to ask about 1.8

#

🌚

woeful crescent
#

:)

waxen plinth
#

You can't do it in 1.8 with the spigot api

woeful crescent
#

ok

#

What about NBT?

#

what tags do I need to set?

waxen plinth
#

¯_(ツ)_/¯

#

You wanna use an unsupported version, prepare to not have support

proven river
#

How do I display the ban message on the players screen since the banlist reason is only for in files ?

#

I tried searching around but couldnt find anything useful on it

waxen plinth
#

I believe you can do it in PlayerJoinEvent#setKickMessage or something

#

Oh wait

#

You'd just need to call kickPlayer(String) on the player

peak granite
#

any difference between
this.getServer().getScheduler().scheduleSyncRepeatingTask((Plugin)this, (Runnable)new Runnable() {
and
getServer().getScheduler().runTaskTimer(this, () -> {

wicked lake
#

Is it possible to make custom entities/mobs in 1.18.1 with the Spigot API? Or do I need to grab another library

paper viper
#

The difference here is that

#

the first option means that the person doing it doesn't know what Java OOP is

ember estuary
#

why? :o

wicked lake
ember estuary
#

i always use scheduleSyncRepeatingTask, what wrong with it @paper viper

young knoll
#

At least you have mojang mappings

livid tundra
#

what event triggers when a player leaves the server? I can't find it

young knoll
#

PlayerQuitEvent

paper viper
#

look at the arguments...

ember estuary
#

yeah

#

he means the methods tho

#

ignore the wrong arguments

#

Whats the diff between scheduleSyncRepeatingTask and runTaskTimer

paper viper
#

Repeating

eternal night
#

Well the other is a timer

ember estuary
#

so is tasktimer

livid tundra
#

thanks!

ember estuary
#

(Plugin plugin, Runnable task, long delay, long period)

#

period -> repeating

#

is it not

eternal night
#

and there is no different

young knoll
#

Whats the diff between scheduleSyncRepeatingTask and runTaskTimer
Both are repeating

ember estuary
#

then why is there two?

eternal night
#
@Override
public int scheduleSyncRepeatingTask(final Plugin plugin, final Runnable runnable, long delay, long period) {
    return this.runTaskTimer(plugin, runnable, delay, period).getTaskId();
}
#

is the impl

ember estuary
#

what the

#

why

#

just why

young knoll
#

One returns an int and one returns a task

ember estuary
#

ahhhh

#

thats the diff i guess

young knoll
#

And a bunch of the scheduleXXX methods are deprecated

#

Mostly the async ones

paper viper
#

I dont usually use the scheduler unless i have to work with ticks

#

like i even use the scheduledexecutor thing instead but thats what i do at least

ivory sleet
#

But yeah now those methods are basically useless scheduleBlahTask

#

as runTaskBlah provides a much better context object

young knoll
#

IIRC scheduleAsyncXXX was deprecated because people got confused between Async task and A Sync task

ivory sleet
#

Oh yeah that too

#

Hopefully it gets removed

#

Soon

#

(:

sullen marlin
#

Someone thought people got confused

young knoll
#

™️

eternal night
#

SoonTM

sullen marlin
#

Idk if people actually got confused

young knoll
#

So there is confusion about the confusion

ivory sleet
#

Regardless, the newer methods
runTask etc are much more succinctly named

#

So yeah much nicer to work with

ember estuary
ember estuary
eternal oxide
#

You'd be surprised how many got confused with the naming

worldly ingot
#

👀 Depending on your font, s and S could look quite similar I'm sure

atomic violet
#

so i know there’s hidePlayer(), but how do i make it so they aren’t hidden anymore

worldly ingot
#

showPlayer() or unhidePlayer(), something like that

#

I think it's show

atomic violet
#

okay i’ll try both

modern sluice
#

aye

#

does spigot have thread affinity

eternal night
#

thread affinity is OS dependent, spigot is a java application. Unless it were to use JNI for native bindings this is not possible in java

sullen marlin
#

java has thread priorities if thats what you mean

#

but its all pretty useless

junior briar
#

will listeners be unregistered automatically after plugin disabled?

sullen marlin
#

yes

junior briar
#

👍

#

can i unregister them manually?

sullen marlin
#

this was discussed above

#

yes, HandlerList

junior briar
#

ty!

ember estuary
#

when i have a class extending listener and create a scheduler in its constructor, does it stop when unregistering the listener?

sullen marlin
#

no

modern sluice
#

yo

#

can u guys add async chunk unloading

eternal night
#

?contribute

eternal night
#

it is an open project, feel free to contribute

modern sluice
#

chunk loading ran async would be nice

#

u know

atomic violet
#
        public void onRespawn(PlayerRespawnEvent e) {

            Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
                @Override
                public void run() {
                    Player player = e.getPlayer();

                    for (Player p : Bukkit.getOnlinePlayers()) {
                        player.addScoreboardTag("1");
                        player.setGameMode(GameMode.SURVIVAL);
                        player.setAllowFlight(true);
                        player.hidePlayer(p);
                        ItemStack item = new ItemStack(Material.COMPASS);
                        ItemMeta compass = (ItemMeta) item.getItemMeta();
                        compass.setDisplayName(Color.RED + "Teleportation Menu");
                        item.setItemMeta(compass);
                        player.getInventory().addItem(item);
                        ItemStack item2 = new ItemStack(Material.FEATHER);
                        ItemMeta feather = (ItemMeta) item.getItemMeta();
                        compass.setDisplayName(Color.YELLOW + "Change Flight Speed");
                        item.setItemMeta(feather);
                        player.getInventory().addItem(item2);
                        player.updateInventory();
                        player.setGameMode(GameMode.SURVIVAL);
                        player.setFlying(true);
                }
            }, 20L);```
eternal night
#

Yea then go for it

#

I am sure you can just open a PR

atomic violet
#

"}, 20L);" is wrong and idk why

modern sluice
#

do ik how

#

nope

#

im unexperienced

atomic violet
#

it says unexpected token

modern sluice
#

?learn java

eternal night
#

?learnJava

modern sluice
#

?learnjava

undone axleBOT
modern sluice
#

kk

#

which would u recommend

eternal night
#

I personally would go with jetbrains academy 😅

#

which isn't even on that list

#

rip

#

also async chunk loading already exists in a fork of spigot called paper

modern sluice
#

codecademy is difficult

woeful crescent
#

Can I explicitly check if an EntityDamageByEntityEvent was caused by a player's weapon?

eternal night
#

Huh ?

woeful crescent
#

like, if it was caused by an arrow or

eternal night
#

Oh, well check if the entity is a projectile

#

and then grab the projectile source

woeful crescent
#

if it was caused by .damage(x, y)

#

can I check for that?

modern sluice
#

why would u want that lol

eternal night
#

the .damage method does not call events afaik

atomic violet
#
    @Override
    public void run() {
        Bukkit.broadcastMessage("This message is shown after one second");
    }
}, 20L);``` shorter version of what i sent but yeah the end part with ```}, 20L);``` says unexpected token
modern sluice
#

😄

woeful crescent
#

It doesn't?!?!

#

Well, I've got bigger problems now

#

lmao

eternal night
#

nearly no methods call their respective events

woeful crescent
#

wait, really?

#

what about 1.8?

eternal night
#

if so, it is documented in the method docs

woeful crescent
#

ok

modern sluice
#

dude my 2gb of ram server handled a lag machine

#

at 16 tps

eternal night
#

I lied tho

modern sluice
#

with just good configs

eternal night
#

the damage method is one of those that calls its event

modern sluice
#

chunk pregenerating is so useful

woeful crescent
#

What is this method for?

modern sluice
#

...

eternal night
#

damaging an entity ?

#

[02:16] LynxPlay: the damage method is one of those that calls its event

woeful crescent
#

Ok, didn't read your message above.

eternal night
#

yea

#

but generally, this is not a general API contract

#

e.g. setting a block or stuff won't call methods

#

modifying inventory

#

etc

woeful crescent
#

yep

#

thx

#

But still

#

How do I check if that was the reason?

eternal night
#

I mean, you don't really

#

it simulates a plain attack/damage

atomic violet
#

okay, starting from scratch, how do i make a respawn event work? my friend said its cause i had to delay the event, but it didn't work, so how do i do this

#

(i tried my code with the respawn event and it didnt do a thing)

woeful crescent
#

is there a way to get the damage modifier of a specific piece of armor?

wicked lake
magic dome
#

Anyone know what event triggers when a fireball projectile is moving? using EntityMoveEvent and checking if the e.getEntity() instanceof Fireball does not work... I also tried getting the entity type and still no luck

wicked lake
#

Just gonna use the API like a good potato

eternal night
#

🙏

peak granite
#

how do i get the attacker in this

#

(event.getEntity().getLastDamageCause().getCause() == EntityDamageEvent.DamageCause.ENTITY_ATTACK)

wicked lake
young knoll
wicked lake
#

both with --compile craftbukkit and without

young knoll
#

What about --remapped

wicked lake
#

...

wicked lake
#

I shall try it

young knoll
peak granite
#

cast as entity?

young knoll
#

no?

#

Cast to the thing I told you to instanceof check?

peak granite
#

Entity entiy = event.getEntity().getLastDamageCause();?

young knoll
#

Check if getLastDamageCause is an instanceof EntityDamageByEntityEvent and then cast

peak granite
#

cast what

#

lol

young knoll
#

getLastDamageCause

peak granite
#

cast to what

young knoll
#

EntityDamageByEntityEvent

peak granite
#

Event event = (Event) event.getEntity().getLastDamageCause();??

#

i dont understand what u mean

young knoll
#

Check if getLastDamageCause is an instanceof EntityDamageByEntityEvent, if it is cast it to such

#

and then use EntityDamageByEntityEvent#getDamager

peak granite
#
                if(event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
                   if(event.getEntity().getLastDamageCause().getDamager() == )
                }```
#

?

#

idk

young knoll
#

Close

#

But you aren't actually casting

peak granite
#

how do i cast

young knoll
#

Actually that only shows primitives, but it's the same idea

peak granite
#
                if(event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
                    Event xd = (Event) event.getEntity().getLastDamageCause();
                   if(xd.getDamager() == IronGolem) {
                       
                   }
                }```
#

?

young knoll
#

Almost

#

But you don't want to cast to just event, you want to cast to EntityDamageByEntityEvent

peak granite
#

what

young knoll
#

what

tall dragon
#

What

rough basin
#

What?

#

Shouldn't a new file be created normally?

#

Should i just make yml file?

quaint mantle
#

we need to implements it to use the events

#

but i dont see any codes in it

#

it just empty lol

eternal night
#

It's a marker interface

#

Purely there to "mark" an object as a class that holds listeners