#help-development

1 messages · Page 1688 of 1

prime reef
#

that's what I figured. just making sure that threads don't do some weird step-through shit and cancel immediately

#

Unity's coroutines do function like that to a certain extent, hence the ask

trail remnant
#

doesnt show up as a thing (not sure how to say this but like it doesnt show up jsut shows as red)

#
                Entity bl = loc.getWorld().spawnFallingBlock(loc, Material.DIRT.createBlockData());
                bl.setGravity(false);```
paper viper
#

or smthing

trail remnant
#

im using 1.16

paper viper
#

weird hm one sec

waxen plinth
paper viper
#

o nvm

#

its for livingentity

trail remnant
waxen plinth
#

I mean

#

Isn't that the goal when you call setGravity(false)?

trail remnant
#

it falls eventually even if you set it to false

#

just tested it with vanilla commands, if you dont set a time it just disapears imediatley

waxen plinth
#

🤔

#

How long does it take before it falls?

trail remnant
#

blinks for like 1 tick

#

you can see it for not even a second

young knoll
#

Falling blocks are like meseeks

#

They don’t like to exist for very long

trail remnant
#

so is there anyway to do this?

eternal oxide
#

AN FB shoudl stay for around 5 seconds before it despawns, or touches another block

trail remnant
#

yeah but i need it to stay where it is forever

eternal oxide
#

you will need to set a runnable to constantly update its location or it will fall

#

but even then, it will despawn eventually

trail remnant
#

so theres no other way?

eternal oxide
#

I've not played with making one permanent

#

perhaps setPersistant ?

young knoll
#

Isn’t that LivingEntity

trail remnant
#

ill try it

opaque bane
#

any way to enable normal mode for world.spawnParticle in 1.12 instead of the default force without constructing the packet manually?

young knoll
#

?

opaque bane
#

right now using that method will by default force particles, displaying them up to 256 blocks instead of just locally afaik

#

in 1.13+ you can configure that behaviour via boolean

trail remnant
waxen plinth
silk mirage
#

What is the best way to access Cauldron's BlockData?

#

I don't see a subclass implementing BlockData made for cauldron

uneven dock
#

^I'm with him. To expand on this a bit, in Spigot-API-1.17.1 all uses of the "org.bukkit.material.Cauldron" class has been deprecated. As I'm sure you're aware.

The JDocs say to use "blockData" to get the data but it isn't implemented as a subclass so I can't import it. What should we do going forward to get the cauldron block data?

jade perch
uneven dock
jade perch
#

yeah just get the blockdata of the block

#

and cast it to levelled

uneven dock
jade perch
#

can't rn

#

but i'

#

m sure you ide will yell at you

#

if it's bad

uneven dock
#

Well, I've been developing this plugin for a long time. But in terms of what's possible with the Spigot API I might as well be a noob still. lmao

#

Basically, when you have a fire under a cauldron filled with water and right click with an empty bottle it's supposed to give you "Purified Water"

In 1.17.1 the entire water purification system breaks. Normally, if you pick up water from anything but a "boiling cauldron" you get "Dirty Water" and if you cook dirty water in a campfire you get "Clean Water"

As it stands, you get a normal MC Water Bottle no matter where you collect the water from. It's because a lot of things that worked in 1.16.5 don't work in 1.17.1

If I remember correctly, I use the material.Cauldron class to get the data on if the cauldron is above a fire source or not.

prime reef
#

So...this isn't spawning anything.

current.getWorld().spawnParticle(Particle.BLOCK_DUST, current, 15,
                        hammerRadius, hammerRadius, hammerRadius, material.isSolid() ? material.createBlockData() :
                        current.subtract(Vectors.up()).getBlock().getType().createBlockData());```
#

aaand now it is. nevermind.

shut field
#

so, I did "invalidate caches" on Intellij and the plugin is no longer running?

#

other than that I did not change anything and it was working perfectly before that

#

the server just never runs it

#

nothing comes up in console

#

the plugin should send a message in the "on enable" method, and it was doing that, but not it does not

#

yeah

#

I mean... ok

#

k I'll try that after this

#

what should be in it

#

no...

#

All I see is plugin.yml and LibsDisguises

#

for some reason it no longer has that

#

I just checked an older working version of it and that had the files

#

I already tried invalidating and that did not fix it

#

for some reason the jar file just does not get outputed with the com file

#

@sinful egret I just noticed something

#

at the bottom you see the "target" thing, typically that contains all of the files in the src thing

#

for mine it does not contain that

echo basalt
#

why can't they list call
getMaximumLevel() - level internally

#

font's weird on the javadoc page

prime reef
#

alright so

#

spawning a FallingBlock with the same material as an existing block in the same location...erases the existing block sometimes.

echo basalt
#

uh

#

worst case scenario you do P a c k e t s

prime reef
#

to be clear, I am cancelling the EntityBlockChangeEvent that occurs when the falling block hits something solid

#

yeah i'm thinking about using entity spawn packets instead, which sucks

echo basalt
#

They aren't hard

prime reef
#

uses NMS though, doesn't it?

#

not saying it's hard, I just don't want to have to update my shit every time the game updates.

#

i'm very lazy

echo basalt
#

ProtocolLib then

torn shuttle
#

is there any forum staff online, something really weird just happened moderation-wise to my account I think

prime reef
#

...Update, the blocks aren't gone, they're invisible

#

Wild

echo basalt
prime reef
#

yep.

echo basalt
#

player.sendBlockChange(block.getBlockData())

#

in that case

#

should update it

prime reef
#

would have to do that for everyone in range

echo basalt
#

uh

#

try calling block.setType(block.getType());

#

might update

hasty prawn
#

What are you trying to do

echo basalt
#

although it's a bit laggier

torn shuttle
#

huh it says choco is online

echo basalt
#

he's having some weird block update issue

torn shuttle
#

choco bby pls hear my plea

echo basalt
#

The most optimized way would be like

hasty prawn
prime reef
echo basalt
#

yeah

#

You can optimize the Player#sendBlockChange method slightly

#

by making 1 packet instead of <player count> packets

#

Here's how it works internally

prime reef
#

That worked.

echo basalt
#

yeah

prime reef
#

added another check just to make sure it doesn't call unless the falling block and the target block have the same data, since it was only happening in that scenario

#

thanks for the help!

worldly ingot
torn shuttle
#

oh

#

hey

#

was about to send the email

#

this is better

#

mr choco bring me moderation

worldly ingot
#

What did you break

torn shuttle
#

not my fault this time

#

can you help me figure this one out

#

I don't remember responding to spam but I seem to recall answering two questions on the forums yesterday

#

could you tell me what I replied to that got deleted?

worldly ingot
#

Yeah, in your resource thread for EliteMobs, some guy was spamming the same message on like 30 different resources to get enough messages

#

Your response was just removed because you responded to him is all. You weren't in trouble or anything ;p

torn shuttle
#

ok so this was retroactively retracting all of his posts?

worldly ingot
#

Yeah just removing his messages because he post farmed

#

And your message just quoted his

torn shuttle
#

yeah that makes sense, it's what I was thinking too

#

I also feel like I banned that guy from discord

worldly ingot
torn shuttle
#

hard to remember off the top of my head but I seem to remember he was trouble

uneven dock
#

Hey guys, I'm having an odd error while building. Can someone help me?

/main/java/veth/vetheon/survival/commands/PayerDataCmd.java:[23,8] class PlayerDataCmd is public, should be declared in a file named PlayerDataCmd.java
quaint mantle
#

it tells you

#

there cannot be two public classes in a single file;

lavish hemlock
#

Your file has a typo in the name.

#

It's PayerDataCmd when it should be PlayerDataCmd.

young knoll
#

I feel like the ide should point that out

lavish hemlock
#

Bold of you to assume they're using an IDE.

hasty prawn
#

It did point it out didn't it? That's a build error KEKW

young knoll
#

Shouldn’t have to build it for it to complain though

hasty prawn
#

Maybe they are red-squiggly-line blind

quaint mantle
#

how do i register an event class to a listener method

hasty prawn
#

Wdym, like a registering a custom event?

quaint mantle
#

no

#

i got a Class<? extends Event> and a listener object

#

what can i do to register it

lavish hemlock
#

uhhhh

quaint mantle
#

doesnt help

lavish hemlock
#

show me the listener

#

like the code for that class

quaint mantle
#

i mean its just

@EventHandler
public void onEvent(Event event) {
    try {
        eventLogger.write(event.getEventName(), event.toString());
    }
    catch (IOException exception) {
        Bukkit.getLogger().severe("Could not log event:");
        exception.printStackTrace();
    }
}
young knoll
#

I know there is a registerEvent method, without the s

#

Don’t remember what it does though

quaint mantle
#

whats eventexecutor?

#

i got no idea how to use that

lavish hemlock
#

seems like a functional interface

outer sorrel
#

How can I get if the player is in an inventory? their own or furnace, crafting table etc

#

InventoryOpenEvent doesnt work for the players inventory

quaint mantle
#

yeah it does

young knoll
#

Nah that’s client side

quaint mantle
#

But why

young knoll
#

You can use getOpenInventory though

#

Ask Mojang

outer sorrel
#

ah okay, thanks

quaint mantle
#

thats just horrible?

outer sorrel
#

would getOPenInventory be null? if theres none open

quaint mantle
#

i dont know why they'd do that

young knoll
#

Not sure if it returns null, you’ll have to check

outer sorrel
#

thanks

young knoll
#

I mean the server doesn’t really need to know when the client opens their inv

#

As much as it would be nice

lavish hemlock
#

There appears to be minuscule documentation on whatever EventExecutor is meant for.

#

The only code example I could find that used it was from a vanish plugin that had their listener class as also an event executor, but that likely won't work in your situation.

#

Also found some old Bukkit tutorial on registering events but that was no good since it used registerEvents and not registerEvent.

young knoll
#

I did use it a bit before

#

No idea if I can still find that code

lavish hemlock
hasty prawn
#

Same thing as if you're lagging you can't open chests, that would happen with your inventory.

#

Which would be awful

young knoll
#

The client could still send a notification packet

hasty prawn
#

True it could

young knoll
#

But that would purely be for server devs

hasty prawn
#

Tbf Mojang does seem to somewhat care about the dev scene.

#

If someone made a ticket for it they might add it

worldly ingot
#

Mojang has no reason to add anything they don't intend on using

#

Nor are they obliged to add whatever we ask

hasty prawn
#

I never said they were.

#

But they certainly aren't going to do it if no one asks.

worldly ingot
#

They won't do it if someone asks either ;p They've got no reason to have the client tell the server that a client-exclusive inventory has been opened

#

If, however, they add a feature that requires it, then they will add it

hasty prawn
#

Someone go request a feature that requires it then 5Head

worldly ingot
#

300 iq

lavish hemlock
#

Ok so, as far as I know, EventExecutor is literally just used to execute code each time the corresponding event class is found.

#

I think you can get away with just creating an empty one lmao

#

But it seems like they're mainly used if your plugin needs a callback when the event is called.

sullen dome
#

is this actually the general exp for them, or specific for the current level?

#

like... is the exp reset to 0 when it lvl's up?

nova grove
#

How can I kill all of the items? I know that you can do /kill @e[type="item"] to do it in Minecraft.

young knoll
#

Loop all entities in a world, check if they are an item, .remove()

onyx shale
#

Get world.. get entities in that world... check type... destroy..

waxen plinth
#

Bukkit.getWorlds().stream().flatMap(w -> w.getEntities().stream()).filter(Item.class::isInstance).forEach(Entity::remove);

#

One-liner to remove all items in all worlds 😌

young knoll
#

Fuckin

#

Streams

waxen plinth
#

Love em

young knoll
#

They still feel so cursed

waxen plinth
#

Why

spiral bramble
#

Not sure if I'll be able to get any help here (I'm probably going to ask in an eclipse community aswell)
I'm using github as a source control for a plugin I'm working on, but I'm working from both Windows and Mac devices, and everytime I go from one OS to another I always have to reconfigure the build path, is there anyway around this to package the spigot.jar internally?

EDIT : I'm not sure if IntelliJ will be able to achieve this, but I've never used it and have no clue on setup

eternal oxide
spiral bramble
spiral bramble
eternal oxide
#

I use eclipse as I like it and I'm used to it. Use whatever you prefer.

spiral bramble
#

Alrighty I'll look into how to setup eclipse and maven

eternal oxide
#

maven is included with Eclipse

#

you just create or convert your project to maven and it does it all for you.

spiral bramble
#

I'll figure it out and ask if I need assistance

echo basalt
#

ew eclipse

#

Most IDEs include maven

#

and gradle

#

There shouldn't be a big problem

waxen plinth
compact cape
#

Is there a simple way to make an NPC and check if it is attacked?

rotund skiff
#

I DONT NO COMMAND

#

PLE HELP ME

#

ZNPCS command

solid cargo
#

wait how can i fix blank lines

eternal oxide
#

a sharpie

solid cargo
#

in intelij...

#

i cant get sharpie ink off of my monitor :(

#

havent tried using whiteboard sharpie tho

hasty jackal
#

you can adjust the blank lines in the code style settings for java (settings -> editor -> code style -> java -> tab blank lines) and reformat the code (alt+ctrl+L) if that's what you mean with fixing blank lines

quaint mantle
#

any ides why runes.yml is not like runes-data and the yml syntax is not correct

#

when i make it yaml

#

it is fixed

#

what is wrong with yml ?

#

in intellij

sullen dome
#

weird

#

for me it works normally always, never had smt like that

#

maybe an intellij bug :3

#

tried restarting ij?

quaint mantle
#

yep

sullen dome
#

really weird

quaint mantle
#

ok fixed somehow

#

oh

#

wait

#

when i name it runes

#

it will get wierd

#

bruh ok

#

no problem with it i will rename it

sullen dome
#

uhh...

#

for me it works with that name

quaint mantle
#

i renamed it something else

hasty jackal
#

you can also manually assign a file type when the file is open with ctrl+shift+A -> override file type -> YAML

sullen dome
#

don' think that fixes it

hasty jackal
#

well it seems to not figure out it's yaml by it's own, telling it to use yaml directly should certainly remedy it

sullen dome
#

definitely sounds like intellij lol

#

buggedy bug bug

tacit drift
sullen dome
#

got an issue..
when rightclicking with a workstation, i want to give a villager the corresponding profession.
problem is..
when i set his experience to 0, he instantly loses his profession again
if i set it to 1, it is filled a bit already...

is there a workaround for this? i mean.. when they change their profs by default, they don't have any experience either

uneven dock
eternal oxide
eternal night
#

a cauldron is not levelled tho :>

#

idk what the goal is here, but Material.CAULDRON is pretty useless as only the filled variances (water, lava, powdered snow) are levelled

uneven dock
#

I posted the entire code in a hastebin if you scroll down from the questions

eternal night
#
if (block.getType() != Material.WATER_CAULDRON) return; // Not a water cauldron
if (block.getRelative(BlockFace.DOWN).getType() != Material.FIRE) return; // no fire under cauldron

final Levelled waterCauldronBlockState = (Levelled) block.getBlockData();
final int currentWaterLevel = waterCauldronBlockState.getLevel();
#

so something along this line ?

#

I know kind of spoon fed

#

but /shrug fight me

uneven dock
# eternal night ```java if (block.getType() != Material.WATER_CAULDRON) return; // Not a water c...
@EventHandler(priority = EventPriority.HIGHEST)
    private void onItemClick(PlayerInteractEvent event) {
        if (event.isCancelled()) return;
        if (event.hasItem()) {
            Player player = event.getPlayer();
            if (player.getGameMode() == GameMode.SURVIVAL || player.getGameMode() == GameMode.ADVENTURE) {
                ItemStack mainItem = player.getInventory().getItemInMainHand();
                if (mainItem.getType() == Material.GLASS_BOTTLE) {
                    if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
                        if (event.getClickedBlock().getType() == Material.CAULDRON) {
                            Levelled cauldron = (Levelled) (event.getClickedBlock().getBlockData());
                            if (cauldron.getLevel() > 0) {
                                Block fire = event.getClickedBlock().getRelative(BlockFace.DOWN);
                                event.setCancelled(true);

                                event.getClickedBlock().getState().setData(new Cauldron());
                                cauldron.setLevel(cauldron.getLevel() - 1);
                                event.getClickedBlock().setBlockData(cauldron);

                                ItemStack waterBottle = ItemManager.get(Item.DIRTY_WATER);

                                if (fire.getType() == Material.FIRE) {
                                    waterBottle = ItemManager.get(Item.PURIFIED_WATER);
                                }
                                player.playSound(event.getClickedBlock().getLocation(), Sound.ITEM_BOTTLE_FILL, 1, 1);
#

this is what it is now

eternal night
#

oh god, use early returns

#

the point in time when your code is intended for the 5th time you know you are doing something wrong imo xD

uneven dock
#

You underestimate my level of noobiness lmao

#

It's taken me over a year to build it to this point. Then 1.17.1 comes out and they deprecate the class I was using

#

Jeez... can you tell it's 3:45 AM?

#

I don't particularly mind the spaghetti code, I just need it to work and I'm completely out of my depth and google isn't helping

dull whale
#
    private static TextComponent makeName(String string, int r, int g, int b) {
        String content = "";
        for (int i = 0; i < string.length(); i++) {
            content = content + TextColor.color(r, g, b + i) + string.charAt(i);
        }
        return Component.text(content);
    }
``` I made this function to have quick rainbox strings but the result is http://prntscr.com/1rxg4vf why they stay white
eternal night
sour sand
#

Changing Skin

dull whale
eternal night
#

by chaining multiple components together with difference colours?

solid cargo
#

whats the Spigot version of System.out.println

eternal night
#

the plugin logger

dull whale
#
        TextComponent content = Component.text("");
        for (int i = 0; i < string.length(); i++) {
            content = content + Component.text(content.toString() + string.charAt(i), TextColor.color(r, g, b + i));
        }
        return content;
``` Im sure its obvious but whats the mistake here
eternal night
#

you cannot chain components together using the + operator

dull whale
#

how can i do it?

solid cargo
#

yo does anyone know that hypixel skyblock magic find sound?

dull whale
#

getting the string of the previous one

#

?

quaint mantle
#

is there any way to check if a hit is critical in EntityDamageByEntityEvent ?

solid cargo
#

what instrument d othey use?

tardy flame
quaint mantle
dull whale
dull whale
#

yeah it kicks me xD

#

but this works content = content.append(Component.text(string.charAt(i), TextColor.color(r, g, b + i * 4)));

#

i dont know about addextra

#

i used append

tardy flame
#

You can use instead content.addExtra(Object)

#

And you don't have to use content = here

dull whale
boreal frost
#

Is it possible to open the advancement menu with player.openadvancement or something similar?

quaint mantle
#

i can interact and damage an armorstand that is invulnurable

#

i have done as.setInvulnerable(true);

#

maybe i done something wrong wait

#

nope everything is ok

#

why is it not working then

desert sedge
#

Is there any way to copy a config section into another place?

solid cargo
#

can someone tell me the formula for making a simple sound effect?

#

i cant seem to get the tones correctly

slim kernel
#

Why does it crash every time I click into the sky instead of sending me the "Block is to far away" message?

Block targetBlock;
            if (PlayerInteractListener.getTargetBlock() != null) {
                targetBlock = PlayerInteractListener.getTargetBlock();
                targetBlock.setType(Material.AIR);

            } else {
                int distance = 0;
                for (int t = 0; t<31; t++) {
                    Block block = player.getTargetBlock(null, distance);
                    if (distance == 30) {
                        player.sendMessage("§cThe Block is to far away!");
                        return;
                    } else if (block.getType() != Material.AIR) {
                        targetBlock = block;
                        targetBlock.setType(Material.AIR);
                        return;
                    }
                    distance++;
                    player.sendMessage(String.valueOf(distance));
                }
            }
            return;
frosty tinsel
sour sand
#

i am trying to change a players skin. when i activate the code it will change the skin in the tab list but not atually on the player. here is the code i am using ```java
public static void changeSkin(Player player, String skinValue, String skinSignature) {
GameProfile profile = ((CraftPlayer)player).getHandle().getProfile();
PlayerConnection connection = ((CraftPlayer)player).getHandle().b;

    connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.e, 
    ((CraftPlayer)player).getHandle()));
    
    profile.getProperties().removeAll("textures");
    profile.getProperties().put("textures", new Property("textures", skinValue, skinSignature));

    connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a,     
    ((CraftPlayer)player).getHandle()));

}```
Does anyone know what i am doing wrong. thanks

quaint mantle
#

the armorstand is Invulnerable but its still taking damage
why

#

i still can attack it

frosty tinsel
#

You are in creative

frosty tinsel
quaint mantle
#

what to do if i am in creative

#

it cancels attack

#

?

#

should i cancel anything in the evnet ?

frosty tinsel
#

What do you want it to do?

quaint mantle
#

shows health as hologram

#

and disapear after 1 second

#

its ok

#

but the problem is the creative

frosty tinsel
#

Then if you set the armorstand to invisible and invulnerable it should be unattackable

quaint mantle
#

in creative

#

and i want it to be ignored. i mean if a player attacks it, it can attack through it if it doesnt do it already is it a way ?

#

and for a moment the armor stand apears and then disapears is there anyway to spawn the armor stand invisible ?

eternal oxide
#

use teh spawnEntity that takes a consumer

quaint mantle
#

how to do that ?

#
ArmorStand as = (ArmorStand) event.getEntity().getWorld().spawnEntity(eloc.add(0, 0.3, 0), EntityType.ARMOR_STAND);

this is my code

#

i done as.setVisible(false)

#

but it apears for a single moment

quaint mantle
#

can you give an example ?

eternal oxide
#

its a consumer so just use a lambda

quaint mantle
#

bruh

#

i dont get it

frosty tinsel
#

Oh

#

I see

quaint mantle
#

how to use these consumers i dont get it

frosty tinsel
eternal oxide
#

getWorld().spawn(loc, ArmorStand.class, e -> { //code here to set invisible });

quaint mantle
#

oh ok thanks

solid cargo
#

I cant seem to get the exact note block tones i want

#

any formula on how to get the exact tone?

boreal frost
eternal oxide
#

No its not possible

boreal frost
#

Oh. Thank you!

eternal oxide
#

You could probably do it using packets

boreal frost
#

serious? I'll do my best.

quaint mantle
eternal oxide
#

I know you can change tab with a packet, but not sure about opening it

quaint mantle
#

guys

#

how can i make an armor stand

#

not interactable

chrome beacon
#

Or use the vanilla way with locking slots or removing hitbox with marker tag

quaint mantle
eternal oxide
#

the server has little control over creative

quaint mantle
#

but not taking damage

tardy delta
#

poor spider

solid cargo
#

still asking for a way to EFFICENTLY make custom sound effects

eternal oxide
#

I see nothing. fails to display for me

solid cargo
#

and no resource packs cause resource packs = cringe

sullen dome
#

is it possible to change the EXP that it needs in the Anvil? don't see anything in PrepareAnvilEvent

#

ah nvm it's in AnvilInventory

dull whale
#

does opening an inventory for a player yields the thread until the jobs done

eternal oxide
#

opening an inventory for a player is a fire and forget

dull whale
#

ok ty

sour sand
#

i am trying to change a players skin. when i activate the code it will change the skin in the tab list but not atually on the player. here is the code i am using ```java
public static void changeSkin(Player player, String skinValue, String skinSignature) {
GameProfile profile = ((CraftPlayer)player).getHandle().getProfile();
PlayerConnection connection = ((CraftPlayer)player).getHandle().b;

    connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.e, 
    ((CraftPlayer)player).getHandle()));
    
    profile.getProperties().removeAll("textures");
    profile.getProperties().put("textures", new Property("textures", skinValue, skinSignature));

    connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a,     
    ((CraftPlayer)player).getHandle()));

}```
Does anyone know what i am doing wrong. thanks

tacit drift
#

RepairCost

sullen dome
tacit drift
#

That also

sullen dome
#

just cranked it up to Max integer lol

#

and works

tacit drift
#

Thought you were talking about the amount of xp for the item

#

to have it low everytime or something

manic furnace
#

When i make plugins on intelij with the minecraft development plugin how can i use other libraries in my plugin?

quaint mantle
#

i ran the build tools 1.17.1

#
dependencies {
    compileOnly 'org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT'
    compileOnly 'org.spigotmc:spigot:1.17-R0.1-SNAPSHOT'
}
#
repositories {
    mavenCentral()
    mavenLocal()
    maven {
        name = 'spigotmc-repo'
        url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
    }
    maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
    maven { url = 'https://oss.sonatype.org/content/repositories/central' }
}
#

oh wait

#

i have 1.17.1

#

bruh

sour sand
#

i am trying to change a players skin. when i activate the code it will change the skin in the tab list but not atually on the player. here is the code i am using ```java
public static void changeSkin(Player player, String skinValue, String skinSignature) {
GameProfile profile = ((CraftPlayer)player).getHandle().getProfile();
PlayerConnection connection = ((CraftPlayer)player).getHandle().b;

    connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.e, 
    ((CraftPlayer)player).getHandle()));
    
    profile.getProperties().removeAll("textures");
    profile.getProperties().put("textures", new Property("textures", skinValue, skinSignature));

    connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a,     
    ((CraftPlayer)player).getHandle()));

}```
Does anyone know what i am doing wrong. thanks

cerulean jasper
#

Got a bungee related problem if its ok to ask:

I have bungee plugin that takes up /f command on my server, yet this is conflicting on the factions server obviously. Whats best way to fix this? I realized I can't simply disable /f easily on factions ONLY, since command is registered regardless of the server you are currently in, and I am not sure how redirecting commands would even work also

paper viper
#

so they can see the change

#

or is this something different

sour sand
#

o yes that is a good point i will do that now but i dont think that will change the fact that it doesnt work cus it already dosnt work for the player that the packets were sent to

paper viper
#

oh

#

i literally just said that above

#

lmfao

sour sand
#

lol

stone sinew
sour sand
#

i am trying to activate it in a command and it doesnt work there but if i do it when the player joins it works. do u know what i have to do to make it work in a command

quaint mantle
#

how to set nbt tag for an entity in 1.17.1
like marker:1

solid cargo
#

if (e.getDamager().isOnGround() && e.getEntity().hasMetadata("SkeletonKing")) { Bukkit.getScheduler().runTaskTimerAsynchronously(SMPCore.getInstance(), () -> e.getEntity().teleport(e.getDamager().getLocation()), 0, 30);
why doesnt this work

tardy delta
#

something is false?

solid cargo
#

yeah but i want for the skeleton to teleport to the player every 10 seconds to avoid climbing on a tree and exploiting

tardy delta
#

exactly to the location?

#

so the skeleton king spawn in the player

solid cargo
#

yes. to the damagers location

tardy delta
#

hmmm

restive tangle
#

ItemStack potion = new ItemStack(Material.POTION,1 , (byte) 16421);
this gives me a drinkable instant health II potion but i want a splash potion , what am i doing wrong here

solid cargo
quaint mantle
#

how to set nbttag for an entity

#

like marker:1

hasty jackal
ivory sleet
ivory sleet
#

?pdc

quaint mantle
#

and

#

what is this saying

#

trying to use nms

#

in 1.17.1

lost matrix
lost matrix
# manic furnace ?

Just like you would normally do with maven. Add the dependencies to your pom.

quaint mantle
lost matrix
quaint mantle
#

gradle

lost matrix
#

Did you specify java 16 as your target and source version?

quaint mantle
#

in where

#

this should be 1.16 ?

lost matrix
#

After 1.8 the versioning changed to 9, 10, 11 etc

quaint mantle
#

the same thing

lost matrix
#
compileJava {
  sourceCompatibility = '16'
  targetCompatibility = '16'
}
quaint mantle
#

oh wait

#

let me change to 16

#

wait there is another problem

#

let me fix it

#

nms suddenly stops working

lost matrix
quaint mantle
#

great

lost matrix
#
    Location location = ...;
    World world = location.getWorld();
    ArmorStand marker = world.spawn(location, ArmorStand.class, as -> as.setMarker(true));
wild reef
#

Hey guys quick question. I want to deny mobs from destorying things like ArmorStands, but players should still be allowed to do so.
I found the EntityDeathEvent to check when an ArmorStand is destroyed. But how can I check if the cause was for example a Creeper or a Player? Or are there any other ways for this?

lost matrix
#

EntityDamageByEntityEvent

quaint mantle
#

ok but wtf

#
repositories {
    mavenCentral()
    mavenLocal()
    maven {
        name = 'spigotmc-repo'
        url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
    }
    maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
    maven { url = 'https://oss.sonatype.org/content/repositories/central' }
}

dependencies {
    compileOnly 'org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT'
}

lost matrix
lost matrix
wild reef
lost matrix
# quaint mantle that got fixed
  1. Navigate to: File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle
  2. Gradle JVM: change to version 16
  3. Re-run the gradle task
lost matrix
wild reef
#

Tried that but they still get destroyed.

private List<EntityType> noneDestroyableEntities = Arrays.asList(ARMOR_STAND, PAINTING, ITEM_FRAME);
...

final Entity defender = event.getEntity();
final Entity attacker = event.getDamager();

if (this.noneDestroyableEntities.contains(defender.getType())) {
    if (!(attacker instanceof Player)) {
        event.setCancelled(true);
    }
}
lost matrix
#
  private final Set<EntityType> playerOnlyKillableTypes = EnumSet.of(
      EntityType.PAINTING,
      EntityType.ARMOR_STAND,
      EntityType.ITEM_FRAME,
      EntityType.GLOW_ITEM_FRAME
  );

  @EventHandler
  public void onDamage(final EntityDamageByEntityEvent event) {
    final Entity defender = event.getEntity();
    final Entity attacker = event.getDamager();

    final EntityType defenderType = defender.getType();

    if (this.playerOnlyKillableTypes.contains(defenderType) && !(attacker instanceof Player)) {
      event.setCancelled(true);
    }
  }

Lists are slow when it comes to contains()

#

But you are close

tacit drift
#

wdym slow

lost matrix
tacit drift
#

would a for loop be faster?

lost matrix
tacit drift
#

oh

quaint mantle
#

bruh

lost matrix
# quaint mantle

@ivory sleet Gradle is your field. Fix this guys spaghetti setup.

tacit drift
#

Really usefull guide, thanks

lost matrix
# quaint mantle

Move the buildscript section up to the top of the build.gradle file and see if that helps

quaint mantle
#

what is the buildscript section

lost matrix
quaint mantle
#

it is using 5.6.1

#

and i have the latest

#

in my C:\Gradle\gradle-7.2

ivory sleet
#

go to gradle/gradle-wrapper.properties iirc

quaint mantle
#

its empty

ivory sleet
#

is it?

quaint mantle
#

oh

#

the wrapper

#

wait

#

or you can manually set it to the path, theres an option in settings for gradle

#

ok

#

now ?

ivory sleet
#

and then in that props file change the version and reload gradle project

quaint mantle
#

change it ?

ivory sleet
#

yeah

quaint mantle
#

k wait

paper viper
#

thats so outdated lol

ivory sleet
#

mhm lol

quaint mantle
# ivory sleet yeah

like this ?

distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
#

yes

ivory sleet
#

yeah

#

then reload ur gradle project 😛

quaint mantle
#

it is not

#

searching in local

#

did you run build tools

#

yes

#

it was working before

#

let me reopen intellij

#

or

#

wait

ivory sleet
#

what langauge level is it set to?

#

and what jdk version r u using for gradle?

quaint mantle
#

16

#

wait let me see the language level

#

im waiting for intellij to open

#

@ivory sleet

ivory sleet
#

ok

#

then go to File > Build, Execution, Deployment > Build Tools > Gradle
and if the gradle jvm is like on version 8 or something, set it to a more recent one

#

preferably the same as the project sdk

#

also u can set project language level to 16

ivory sleet
#

oh thats weird

quaint mantle
#

and there is no 16 level

#

its 1 - 14

#

i set it to 8

ivory sleet
#

whats ur intellij version btw

#

update if possible

#

ye also I assume you have tried restarting and invalidating caches already

quaint mantle
#

yes

#

they exists

wild reef
# lost matrix ```java private final Set<EntityType> playerOnlyKillableTypes = EnumSet.of( ...

Just to let you know: it seems like that this event does not work for hanging entites. First of all: EntityType.ITEM_FRAME and EntityType.PAINTING did not work since the entity.getType() was DROPPED_ITEM. But adding that to the list didn't work either. After some research I found the HangingBreakByEntityEvent event which solved my problem.

@EventHandler
public void onEntityB(HangingBreakByEntityEvent event) {
    event.setCancelled(!(event.getRemover() instanceof Player));
}
ivory sleet
wild reef
#

But thanks for the support :)

quaint mantle
#

they exists

#
import org.apache.tools.ant.filters.ReplaceTokens

plugins {
    id 'java'
}

group = 'com.trexmine'
version = '1.0-SNAPSHOT'

compileJava {
    sourceCompatibility = '16'
    targetCompatibility = '16'
}

repositories {
    mavenLocal()
    mavenCentral()
    maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
    maven { url = 'https://oss.sonatype.org/content/repositories/central' }
}

dependencies {
    compileOnly 'org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT'
}

processResources {
    from(sourceSets.main.resources.srcDirs) {
        filter ReplaceTokens, tokens: [version: version]
    }
}
ivory sleet
#

ye this is weird

#

the issues I have listed is the only things I can come to think of which might mess it up

#

gradle jvm version, project lang level, project sdk level, gradlew version (& restart & inval caches)

quaint mantle
#

so

#

what should i do bruh

ivory sleet
#

Well update IntelliJ to latest if not done ofc

quaint mantle
#

i cannot

#

my laptop cannot handle it

#

i guess

ivory sleet
#

That’s too bad

quaint mantle
#

ok i download community 2021.4

ivory sleet
#

Idk but you should be on latest

hasty jackal
#

I'd just check what gradle itself has to say, and then move on to intellij

#

and just run ./gradlew build and see what error it has

#

if that still errors with not found, then there's something messed up in the repo

ivory sleet
#

yeah well the grade ij ui should execute using gradlew

quaint mantle
#

the file is there

ivory sleet
#

Can u run java -version in the cmd

eternal night
#

where is the spigot repo o.O

ivory sleet
#

Seems to be missing thonk

eternal night
#

I am jealous of your emoji superiority

paper viper
#

🩴

ivory sleet
#

LynxPlay nitro booster 🙂

eternal night
#

I am keeping a server alive with my two boosts 😭

ivory sleet
#

😌

#

Lynx, do you have any clue why this fella can’t get gradle to work?

eternal night
#

well a repository might be useful first step

#

this error specifically fails to find spigot api

ivory sleet
#

From what I understand he declared the artifact spigot not the api variant, and then also declared both the spigot repo and the local maven one

quaint mantle
#

adoptopenjdk hotspot latest

ivory sleet
#

Alright, this is just weird

#

Though not surprising that gradle could do something like this

quaint mantle
#

epic intellij update

#

installed

ivory sleet
#

Good

#

Try see if it works now then (:1

eternal night
#

an interesting jar name tho. How did you install the server jar into your local maven repo ?

quaint mantle
hasty jackal
#

so I didn't remember it wrong huh, it should have that spigot- prefix too

quaint mantle
ivory sleet
#

Oh wtf

eternal night
#

yea I recall a spigot prefix as well

quaint mantle
#

welp

#

start looking on amazon for an external hard drive

#

no i will clear some space

hasty jackal
#

when you updated, did you remove the old configurations? you can otherwise delete those which should give you some space back

#

the installer doesn't select that automatically for the new versions for some reason, which I'm always surprised by

ivory sleet
#

pretty sure toolbox does that, no?

hasty jackal
#

no idea about toolbox

tacit drift
#

0 BYTES

quaint mantle
#

oh damn

#

i forgot that

#

i had

#

the whole assassins creed unity on C

#
  • csgo and dota
#

@ivory sleet smells

#

👃

#

guys anyone knows how to change directory of a steam game ?

#

and it doesnt bug out

#

its not related to this channel

#

but ah

ivory sleet
#

idk actually

#

never tried myself

quaint mantle
#

theres some setting when you right click a game i think

#

dont remember tbh

#

i will change dota and cs:go

ivory sleet
#

oof

quaint mantle
#

i just delete dota 2 anyways

ivory sleet
#

xD

quaint mantle
#

epic 2021 soluton

ivory sleet
#

but yeah anyways you might want to redeploy spigot 1.17.1 to ur maven local repo

#

so like run bts again

quaint mantle
#

ok fixed

ivory sleet
#

works?

quaint mantle
#

wait

#

its indexing

#

epic index

ivory sleet
#

u do need to load the gradle build script

#

yeye

quaint mantle
#

ok it is updating indexes

#

let me wait

ivory sleet
#

ok

#

go to ur local .m2 folder

quaint mantle
#

same error

ivory sleet
#

yes

#

I see

#

hwoever

quaint mantle
ivory sleet
#

reomve the 1.17.1 folder

#

no mercy

quaint mantle
#

done

ivory sleet
#

then run build tools again

quaint mantle
#

ah come on ok

ivory sleet
#

yeah ik its annoying lol

quaint mantle
#

epic 600M

ivory sleet
#

oof

quaint mantle
#

im waiting for it to delete

#

i will run it again

ivory sleet
#

yessir

quaint mantle
#

these cannot get deleted epic

#

bruh

#

it got deleted

ivory sleet
#

ok lol

tardy delta
#

does calling + on a string creates a new stringbuilder every time?

#

i heard it somewhere

ivory sleet
#

no

#

it really depends

eternal night
#

it allocates a new string

ivory sleet
#

like if you use something like

"lol" + enumconstant + "abc" I am pretty sure it gets interned

#

maybe not

eternal night
#

I mean those are micro and pretty w/e

ivory sleet
#

ye indeed

eternal night
#

bigger issue is people building whole text docs (e.g. html) using += on a string

#

as it has to copy the entire string over

ivory sleet
#

MutableString 😌

tardy delta
#

oh

ivory sleet
#

anyways fourteenbrush

#

assume you have something like
"hi " + args[0]

#

then it should compile to new StringBuilder("hi").append(args[0]).toString() iirc

#

so in that case it wont use a billion string builders

restive tangle
#
            String name = e.getCurrentItem().getItemMeta().getDisplayName();
            Player target = Bukkit.getPlayer(name);
            if(!(target != null)) return;
            if(!(Actions.inDuels.containsKey(target.getUniqueId()))) return;
            p.setGameMode(GameMode.SPECTATOR);
            p.teleport(target.getLocation());
            Actions.inSpec.add(p.getUniqueId());
            p.sendMessage(Utilities.color("&3&l(!) &7/leave to leave spectator"));

it does everything except for changing the gamemode

ivory sleet
#

but yeah also that being said, you dont have to care about that, afaik it uses the array copy function provided by System which is quite fast

#

it means that one of ur predicates you test above the setGameMode code isn't passing

#

might wanna debug it with print statements or smtng

restive tangle
#

everything below gamemode works

#

so i'd assume setgamemode is passing

ivory sleet
#

what event is it btw

restive tangle
#

Player Interact event

ivory sleet
#

ye well thats weird should work

quaint mantle
quaint mantle
ivory sleet
#

send ur build.gradle

quaint mantle
#
import org.apache.tools.ant.filters.ReplaceTokens

plugins {
    id 'java'
}

group = 'com.trexmine'
version = '1.0-SNAPSHOT'

compileJava {
    sourceCompatibility = '16'
    targetCompatibility = '16'
}

repositories {
    mavenLocal()
    mavenCentral()
    maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
    maven { url = 'https://oss.sonatype.org/content/repositories/central' }
}

dependencies {
    compileOnly 'org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT'
}

processResources {
    from(sourceSets.main.resources.srcDirs) {
        filter ReplaceTokens, tokens: [version: version]
    }
}
eternal night
#

but why not just use inbuild resource processing / expanding

ivory sleet
#

^

eternal night
#
tasks.processResources { expand(project.properties) }
#

tho that is kotlin

quaint mantle
#

im using groovy

eternal night
#

should not be too hard to convert xD

quaint mantle
#

bruh why should i convert

eternal night
#

no

#

convert my snippet to groovy

#

not your entire layout to kotlin (tho it is superior :>)

ivory sleet
#

processResources.expand "blah": blah, "blo": blo

#

or smtng

quaint mantle
#

it was the default

#

in minecraft development

#

and

#

the plugin.yml problem

#

how can i fix that

ivory sleet
#

send the plugin.yml

quaint mantle
#

i mean this

ivory sleet
#

yeah idk what it really means but feels like that has to do with replace tokens

quaint mantle
#

i used the kotlin thing

#

and it builded

ivory sleet
#

pog

quaint mantle
#

let me test it

eternal night
#

check if it actually processed stuff xD

quaint mantle
#

put this in your processResources: duplicatesStrategy = DuplicatesStrategy.INCLUDE

#

wait if you already fixed it nvm

ivory sleet
#

never had to use that UwU

solid cargo
#

how can i cancel END_CRYSTAL placing.
just e.setCancelled doesnt work

quaint mantle
#

like this ?

ivory sleet
#

what event r u using pillow man

quaint mantle
#

above the sourceSets.main

solid cargo
quaint mantle
#
    duplicatesStrategy = DuplicatesStrategy.INCLUDE
    from(sourceSets.main.resources.srcDirs) {
        filter ReplaceTokens, tokens: [version: version]
    }
}```
ivory sleet
#

use the EntitySpawnEvent

solid cargo
#

ok

ivory sleet
#

end crystals are entities right

solid cargo
#

yeah..

ivory sleet
quaint mantle
#

pog build complete

#

now to test

ivory sleet
#

unit tests?

quaint mantle
#

no

#

run the plugin

ivory sleet
#

oh

#

wait u dont unit test stuff? O.o

#

or well its spigot so I guess not

woeful crescent
#

Is placing a flower BlockPlaceEvent?

solid cargo
solid cargo
#

how can i get the checker

#

ok nvm i got that one working

#

now i need to send the placer a message to not place it

#

but i cant find that

#

btw @ivory sleet EntitySpawnEvent also doesnt work

cedar rampart
#

anyone got any tips on becoming better at coding?

#

im very lost

solid cargo
#

start by learning java

#

??learnjava

cedar rampart
#

im

solid cargo
#

idk the command

cedar rampart
#

im very lost at it

quaint mantle
#

?learnjava

undone axleBOT
cedar rampart
#

ok thnx ig'

solid cargo
#

how can i use player.Teleport

quaint mantle
#

by passing in a location to teleport them to?

solid cargo
#

yeah but how can i get the worldSpawn

waxen plinth
#

By calling World#getSpawnLocation

solid cargo
#

ah thx

waxen plinth
#

Have you considered reading documentation?

hasty prawn
#

?jd

solid cargo
#

i cant seem to get the world spawn tho

#

nvm

tardy delta
#

is there a way to teleport a player and the entity he s riding?

#

like a horse

stone sinew
solid cargo
stone sinew
waxen plinth
#

Do you expect us to just give you a fully-functioning plugin or something

#

You have to ask specific questions

tardy delta
#

whats the best way of storing an uuid with a horse so that only the owner (who spawned it) can ride it? btw i dont want any files

#

pdc or something?

stone sinew
#

ArmorStand.getRightArmPosition()

tardy delta
#

but i dont want to save it in a file

tardy flame
stone sinew
quaint mantle
#

you can probably store the owner in the PDC, yeah

hasty prawn
#

^

stone sinew
#

PDC can only hold so much data so make sure to remove the data as its removed from the server.

waxen plinth
#

Would it not be automatically removed if the entity dies

stone sinew
hasty prawn
#

You'd attach it to the horse not the player

stone sinew
#

Do horses have pdc?

tardy delta
#

ugh is there an interaction type for right clicking on a entity?

hasty prawn
#

All entities do don't they?

tardy delta
#

worldguard seems to block something

stone sinew
hasty prawn
#

Yeah Entity implements PersistentDataHolder

stone sinew
stone sinew
tardy delta
#

well i want to get the entity interacted with

#

not very much methods here

eternal night
#

entities, chunks, itemmeta and tile entities all have their own PDC

#

notably every one of those is cleared if they are removed (tho that becomes kind of hard for chunks)

stone sinew
tardy delta
#

doesnt have much either

#

ah wait

stone sinew
#

getRightClicked()

tardy delta
#

got it

#

hope it works

solid cargo
#

how could i send a player a random join message

tardy delta
#

create a list with messages i guess and take a new random

solid cargo
#

arrayList random = <messages> ?

#

or no

#

wait nvm

#

just creating an array list eh?

tardy delta
#

List<String> messages = new ArrayList<>();
Random r = new Random()
on join: event.setJoinMesage(messages.get(r.nextInt(messages.size())))

solid cargo
#

where go the messages?

#

in the <> or ()?

quaint mantle
#

ok

#

this is time

#

?learnjava

undone axleBOT
quaint mantle
#

for that

solid cargo
#

wow ty

quaint mantle
#

ofc

tardy delta
#

is this something with the iterator thingie

golden turret
#

wtf

tardy delta
#

idk

#

cant deserialize a uuid list

hasty jackal
#

you're running a forEach on an interator and then also use .next() inside that forEach? that can only break

tardy delta
#

ah

hasty jackal
#

also you're setting a singular value in the config so overwriting it over and over

#

if it can't serialize the UUID just map over the list, call toString on it and save the resulting list

tardy delta
#

ah like this
.set("vanished_players", vanishedPlayers.toString()

hasty jackal
#

no, that'd create the text representation of the list as a whole, you want instead a list of the text of the uuids

tardy delta
#

uhh i guess

#

just want to save an uuid list and load it back

solid cargo
#

this doesnt work, and dont tell me to learn java, cause im already learnigng

tardy delta
#

:/

solid cargo
#

uh oh, here it comes

tardy delta
#

i want to see the listener part

solid cargo
#

you mean teh

#

playerJoinEvent thing?

#

pretty much the whole thing?

tardy delta
#

yes

#

the onjoin

solid cargo
tardy delta
#

you are setting the join message twice :/

solid cargo
#

oh ok lmfao

worldly ingot
#

Also, how are you setting those messages?

Bukkit.getPluginManager().registerEvents(new KaboomJoin(), this);
new KaboomJoin().setMessages(messages);
```?
tardy delta
#

kaboom :kekw:

solid cargo
#

btw if i set the random things on a join message

#

it just turns into default

tardy delta
#

are you adding something to the messages?

solid cargo
#

all it tells me is line 35 which is the other join msg

#

no, just those

quaint mantle
#

is it a byte
or int

tardy delta
#

so you never call setMessages()?

solid cargo
#

it is gray

#

so yes

#

ig

#

lol

worldly ingot
tardy delta
#

you have to

quaint mantle
#

and this whole time i was trying to do it with tags

#

my day wasted

worldly ingot
#

Yeah. PDC is for non-vanilla tags

tardy delta
#

an arraylist has an initial capacity with 10 and values null right?

worldly ingot
#

Anything vanilla NBT is going to be covered by either ItemMeta, Entity, or anything else wrapping some object

dim chasm
#

o/ general question, are craftbukkit (not spigot) servers guaranteed to include net.md_5.bungee apis?

quaint mantle
worldly ingot
#

Yes

quaint mantle
#

nice

worldly ingot
#

Assuming "mobType" is your special tag

#

You can set whatever you want

#

Just can't manipulate vanilla ones

quaint mantle
#

wow

tardy delta
#

@solid cargo does it work?

worldly ingot
solid cargo
#

ok im already dying inside

worldly ingot
solid cargo
#

been on pc all day

tardy delta
#

ah

quaint mantle
#

and it get saved in world data right ? (like when a server stops the tag is still there)

solid cargo
#

i dont really want to get spoonfed

#

but i have to

#

BUT NO

tardy delta
#

so its just unitialized or something

worldly ingot
solid cargo
#

I WILL NOT GET SPOONFEEDED

tardy delta
#

:/

solid cargo
#

spoonfeed = bad

worldly ingot
#

PillowMan your code looks fine as far as I'm concerned. What's your ultimate goal here?

#

Right now your code is setting their join message to a random message

solid cargo
#

to send a player a custom join message

#

player.sendMassega

#

but i can change that quickly

worldly ingot
#

Right, so that will at least fix that.

solid cargo
#

ik its joinMessage rn

tardy delta
#

is there an error or spmething?

worldly ingot
solid cargo
#

yes

#

e.setJoinMessage(messages.get(r.nextInt(messages.size()))); server doesnt like that

tardy delta
#

fix it then

solid cargo
#

java.lang.IllegalArgumentException: bound must be positive

worldly ingot
#

Yeah, just confirms what I asked then

#

This is where Java experience and knowledge and understanding of instancing helps

tardy delta
#

?learnjava was a good one 🙂

undone axleBOT
solid cargo
#

i do this shiz for fun anyways

worldly ingot
#

That List is a member field meaning a new instance of it is going to be created when you use the new keyword

tardy delta
#

wew

worldly ingot
#
KaboomJoin listener = new KaboomJoin();
listener.setMessages(Arrays.asList("whatever", "another message", "hello"));
Bukkit.getPluginManager().registerListeners(listener, this);```
#

Notice how I'm using the same instance, I only use new once?

solid cargo
#

ohhh

worldly ingot
#

If you do new KaboomJoin(), that messages list is also going to be different

#
Bukkit.getPluginManager().registerListeners(new KaboomJoin(), this);
new KaboomJoin().setMessages(messages); // You're setting the messages of an unrelated instance that wasn't registered```
#

Alternative would be to scrap setMessages() and just pass a List<String> through the constructor of Kaboom join as well to avoid the call and just do this

Bukkit.getPluginManager().registerListeners(new KaboomJoin(Arrays.asList("whatever", "another message", "hello")), this);```
solid cargo
quiet ice
#

well, it replaces the above code

worldly ingot
#

Yeah, it would go wherever you're registering your listener

#

Preferably in the plugin class, yes

solid cargo
#

did you mean registerEvents?

worldly ingot
#

Yes, sorry

solid cargo
#

ok

worldly ingot
#

Bad habit lol

solid cargo
#

look at my bad habit

#

TW is given tho

#

ready?

quiet ice
#

registerListeners would be a better name anyways

solid cargo
worldly ingot
solid cargo
#

bro i just wanted a decent surprise for my private smp players

#

but java says: 'KaboomJoin()' cannot be applied to '(java.util.List<T>)'

#

bro i should really learn java

#

?learnjava

undone axleBOT
worldly ingot
#

Yes you should ;p I suggested the use of a constructor instead of the setMessages()

solid cargo
#

at least my typing speed improved :)

#

yo at least as i said my wpm increased from like 50 to 70

quiet ice
#

what you are typing should make sense though. Even 200 won't matter if noone is left to understand the words

solid cargo
#

in typereacer i mean

quiet ice
#

point still stands

solid cargo
#

true.

lost matrix
#

Ive had days where i literally wrote maybe 10 lines of code in total. Programming is not all about words per minute.

#

Rest was compiling, searching the internet and yelling at Jenkins for not recognising my cool web hooks

worldly ingot
#

Programming is not all about words per minute
Yeah. It's about hating yourself and how much of it you're willing to tolerate before giving up

lost matrix
#

I know several ex devs that just said fk it and went into gardening or something else non technical.

waxen plinth
#

Programming is about words per minute when you're writing getters and setters

quaint mantle
#
            Location eloc = event.getEntity().getLocation();



            EntityArmorStand as = new EntityArmorStand(((CraftWorld)eloc.getWorld()).getHandle(), eloc.getX(), eloc.getY(), eloc.getZ());
            as.setInvisible(true);
            as.setNoGravity(true);
            as.setInvulnerable(true);
            as.setMarker(true);
            PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(as);


            ((CraftPlayer) player).getHandle().b.sendPacket(packet);

why the invisible, nogravity and stuff arent working its just an armor stand ?
1.17.1

waxen plinth
#

Why are you using packets for that

quaint mantle
#

cause i dont want others to see it

waxen plinth
#

The spawn packet probably doesn't send that metadata

lost matrix
quaint mantle
#

how to do that

#

?

#

im new to nms

lost matrix
#
    net.minecraft.world.entity.Entity entity = ...;
    final boolean forceAll = true;
    final PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(entity.getId(), entity.getDataWatcher(), forceAll);
sacred ice
#

why everyone is suddenly using invisible armor stands it was added 6 years ago x)

quaint mantle
#

and the name is not showing

#
as.setCustomName(IChatBaseComponent.a(text));
as.setCustomNameVisible(true);
lost matrix
quaint mantle
#

no

#

as.setInvisible(true);
as.setNoGravity(true);
as.setInvulnerable(true);
as.setMarker(true);

#

i want the armor stand to spawn

#

with these metadata

#

at the same time

hasty prawn
#

Yeah you spawn it and then send the metadata

quaint mantle
#

ok for a moment

#

the armor stand will apear

hasty prawn
#

There's nothing you can do about that

lost matrix
quaint mantle
#

how to do that ?

hasty prawn
lost matrix
#

Sure. This could happen but is highly unlikely

hasty prawn
quaint mantle
#

ok so what should i do

#

the name is not apearing

#

and the packets arent sent at the same tick

lost matrix
#

Show your code

#

Try sending a named entitiy packet maybe.

#

PacketPlayOutNamedEntitySpawn

quaint mantle
lost matrix
quaint mantle
#
// Default IntelliJ toString
@Override
public String toString() {
    return "MyObject{"
        + "values" + '}';
}
quaint mantle
lost matrix
quaint mantle
#

ok now what

waxen plinth
quaint mantle
#

Strengthen your fingers

lost matrix
#

I use lombok for that... I really feel like verbose getters and setters are sometimes overcrowding a class.

quaint mantle
lost matrix
quaint mantle
#

i cannot figure out a and b