#help-development

1 messages ยท Page 1173 of 1

torn badge
#

Which is always 0

pure dagger
#

hm?

#

yeah

#

but

#

1 excluded

#

0 <= x <= 0

torn badge
#

You don't want 1 with only 1 element in the list

timid berry
#

can i join 1.20.4 servrs with 1.20.6?

echo basalt
#
public static Player getTarget(Player origin) {
  List<Player> candidates = new ArrayList<>(); // ehh, uuids would be better

  for (Player candidate : Bukkit.getOnlinePlayers()) {
    if (candidate == origin) {
      continue;
    }

    Location location = candidate.getLocation();
    
    if (location.getY() <= 100) {
      candidates.add(candidate);
    }
  }

  if (candidates.isEmpty()) {
    return null;
  }

  int size = candidates.getSize();

  if (size == 1) {
    return candidates.getFirst(); // return candidates.get(0) if your java version doesn't support getFirst()
  }

  return candidates.get(ThreadLocalRandom.current().nextInt(size));
}
pure dagger
torn badge
echo basalt
#

Exactly

#

Just to enforce good collection habits

glossy laurel
#

what's a good way to string'ify/bite'ify TrimMaterial and TrimPattern and reverse it

echo basalt
#

their namespace keys

#
  • getting from the registry
glossy laurel
echo basalt
#

exactly what it means

torn badge
#

I don't think biting them is recommended

glossy laurel
echo basalt
#

Registry.TRIM_PATTERN.get(key)

#

something like that

timid berry
#

Hmm

#

The code works sometimes

pure dagger
#

thats bad

timid berry
pure dagger
#

heh

glossy laurel
pure dagger
#

check in console if u wanna know

glossy laurel
#

show error

glossy laurel
timid berry
#

Code

delicate atlas
echo basalt
#

ew streams

#

also .toList

#

get screwed

delicate atlas
#

๐Ÿ‘

glossy laurel
delicate atlas
#

no

glossy laurel
#

I thought they were really fancy and cool

echo basalt
#

not a fan of them and half their use cases look better with a traditional for loop

#

I do use the kotlin equivalent at work

pure dagger
#

i dont like them

#

either

timid berry
#

I got it working

nova notch
#

don't listen to the haters!!!

delicate atlas
#

real

timid berry
#

Where can I access documentation on a player kills another player

sly topaz
# delicate atlas ```public static Player getTarget(Player origin) { List<Player> candidates =...
public static Player getTarget(Player origin) {
    var candidates = Bukkit.getOnlinePlayers().stream()
            .filter(candidate -> candidate != origin && candidate.getLocation().getY() <= 100)
            .toList();

    return candidates.isEmpty() ? null : candidates.get(ThreadLocalRandom.current().nextInt(candidates.size()));
}

public static Player getTarget(Player origin) {
    var candidates = new ArrayList<>();
    for (var player : Bukkit.getOnlinePlayers()) {
      if (player != origin && player.getLocation().getY() <= 100)
        candidates.add(player);
    }

    return candidates.isEmpty() ? null : candidates.get(ThreadLocalRandom.current().nextInt(candidates.size()));
}
#

imo the stream one looks better

echo basalt
#

var ๐Ÿคฎ

pure dagger
sly topaz
#

what's with the hate to new features lol

shadow night
#

var is great with long ass types

sly topaz
#

I just use it everywhere I can to keep things consistent

echo basalt
#
fun getTarget(origin: Player): Player? = 
  Bukkit.getOnlinePlayers().filter { it != origin && it.location.y <= 100 }.randomOrNull()
delicate atlas
#

Kotlin?

echo basalt
#

yes

sly topaz
#

yeah

timid berry
#

will this code bug out if the player sucicides or without killer?

echo basalt
#

?tas

undone axleBOT
delicate atlas
#

maybe

timid berry
#

oh probably

#

if not null time!

echo basalt
#

neurons kicking in

glossy laurel
#

@echo basalt public static final Registry<TrimPattern> patternRegistry = Bukkit.getRegistry(TrimPattern.class); public static final Registry<TrimMaterial> materialRegistry = Bukkit.getRegistry(TrimMaterial.class); is this the way?

echo basalt
#

try and see too

glossy laurel
#

I knew youd say that :(

sly topaz
#

if you knew it why didn't you just try it ๐Ÿ˜›

echo basalt
#

then you should've taken action

sly topaz
#

why are you saving registries in static vars anyway

echo basalt
#

accessibility most likely

glossy laurel
sly topaz
#

what do you mean

glossy laurel
#

and im pretty sure youre not supposed to access Bukkit api outside of main thread

echo basalt
#

why are you accessing trim patterns async

glossy laurel
#

rsns

sly topaz
#

it isn't that bukkit cannot be accessed across threads, it is that most things in bukkit are not thread safe

glossy laurel
echo basalt
#

"most things" more like the essential things

#

moonrise$getEntityLookup my beloved

sly topaz
#

the rule of thumb is anything that interacts with the world

sly topaz
glossy laurel
#

whos moonrise

echo basalt
#

I run this on production ๐Ÿ˜›

timid berry
#

how can i access hitlist on my other file?

sly topaz
timid berry
#

like access and modify it

delicate atlas
sly topaz
#

why the ``

echo basalt
#

because the $ in the name makes it slightly illegal

#

it's either that or reflection

timid berry
sly topaz
timid berry
#

u right

sly topaz
#

?learnjava

undone axleBOT
#

For Beginners:

Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/

For Intermediate to Advanced Learners:

Oracle Java Tutorials: The official guides by Oracle for Java programmingโ€”great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/

Practice and Hands-on Learning:

Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/

Free Resources and Documentation:

Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/

Community and Support:

Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/

Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! ๐ŸŽ‰

delicate atlas
#

public**

timid berry
#

huh

delicate atlas
#

public static .....

sly topaz
#

I recommend the jetbrains academy java course

timid berry
nova notch
#

in the class not the method

delicate atlas
#

not in the Enable Method

timid berry
#

but i need to set it at enable?

delicate atlas
#

no

#

set it on top of it

sly topaz
#

you are doing things you don't understand

timid berry
#

okay

#

how can i access it in another file?

sly topaz
#

just throwing things at the wall will only work for so long, you should actually learn the concepts before trying this out

timid berry
#

oh i got it

#

Again.hitlist

delicate atlas
#

<ClaasName>.hitlist

sly topaz
#

welp, I tried ยฏ_(ใƒ„)_/ยฏ

#

good luck with your project

timid berry
#

capitalCities.get("England");
this would return null if it dosen't exist right

nova notch
#

england is not a city

delicate atlas
timid berry
nova notch
#

o yeah

delicate atlas
#

oh oh oh

nova notch
#

you aren't comparing the string to anything

timid berry
#

oh right

#

i forgor

lost matrix
timid berry
#

if i do something like
capitalCities.put("Germany", "Berlin");
but germany already has a value, will it overwrite or error?

sly topaz
#

getCapitalCity would've been enough, of what else you'd get a capital city of

nova notch
#

no no this is java, you need an excessively verbose name for it

lost matrix
sly topaz
nova notch
#

wait wdym you can hover over it

echo basalt
nova notch
#

it shows you what's in it just by hovering?

echo basalt
#

I like being explicit when things are nullable

lost matrix
nova notch
#

I also forgot that states and provinces could have their own capitals

sly topaz
#

there should be a balance, if anything. But I generally agree

timid berry
#

what if i have something like

#

zarif, mark
mark, zarif

#

which will it access?

#

capitalCities.get("zarif");

sly topaz
#

I never remember the damn command

lost matrix
#

Zahin consider yourself warned for the first time

timid berry
#

warned for what

#

this guy keeps spamming try it and see

#

im not tryna compile n upload n restart the server

sly topaz
#

literally the first time I said it lol

lost matrix
#

Not an excuse to get vulgar

timid berry
#

aight mb

nova notch
lost matrix
#

You can rightclick and mute/ignore users you dont want to read messages of

timid berry
sly topaz
#

ideally you'd setup your build system to do it automatically for you, you're going to be doing a lot of compiling and restarting when it comes to plugin development anyway

timid berry
#

and not the key associated with a value

lost matrix
ivory sleet
lost matrix
ivory sleet
#

๐Ÿ˜ถ

nova notch
#

wait make it static synchronized final

#

and what else can it be, that's it right?

rough ibex
#

strictfp

nova notch
#

tf is that

rough ibex
#

:)

sly topaz
#

public static final synchronized strictfp ResourceLocation

blazing ocean
sly topaz
#

how would you call it

#
`potentially get the public uniform, if it happens to exist, it will return something, if not it could sometimes throw an exception if it couldn't be found. have fun.`()
blazing ocean
#

Yes

#

exactly that

sly topaz
#

sounds like one could make a skript to kotlin compiler

blazing ocean
#

I'm working on something "similar"

sly topaz
#

is that using the kotlin scripting system

blazing ocean
#

Yes

sly topaz
#

so why not kts smh

blazing ocean
#

?

sly topaz
#

the extension

blazing ocean
#

test.bukkit.kts

timid berry
#

theoretically

sly topaz
#

I was looking at the first one lol mb

timid berry
#

what would be the easiest method of putting an image ona map ?

#

via command

sly topaz
#

probably using a library

timid berry
#

which library?

sly topaz
timid berry
#

now how would i uh

#

find the docs for this

sly topaz
#

you'd read the code it seems, doesn't look like it has any docs lol

#

I'd like a better documented library but I don't know of any that support latest version

stable gorge
#

any guides on project structure? not sure where i should put like generic types etc

buoyant viper
#

my developer in christ we live on a giant rock circling a big hot ball in an infinite void

#

Go Wild.

wet breach
pure dagger
#

its a Map<String, Object>
and type of map.get("c") is List<Map<String, String>>

is this right?

brittle geyser
#

no

#

without '-'

pure dagger
#

why configs are so confusing to me

brittle geyser
#
U:
   a: a
   b: b
   c:
      d: d
      e: e
      f:
      - f
pure dagger
#

whats the difference between section and map..

pure dagger
brittle geyser
#

section is more flexible

#

Map<String, Object> *

pure dagger
#

ye

#

i said that mine was List<Map<String object>>

brittle geyser
#

?

pure dagger
#

here i said that its list of maps

brittle geyser
#

only Map<String, Object> without list

#

{"d":"d", "e":"e"}

#

{"d":"d", "e":"e", "f":"[f]"}

pure dagger
#

thats your yml

brittle geyser
#

what

pure dagger
#

your is map

#

but mine was list of maps

#

no?

brittle geyser
#

no

#

lol

pure dagger
#

๐Ÿ˜ญ

brittle geyser
#

you cant get list

#

what do you want to do

pure dagger
#

understand these thing

#

this*

brittle geyser
#

you need practice

pure dagger
#

yea

brittle geyser
#

not theory

pure dagger
#

but i really dont get it idk why its so hard to me

brittle geyser
#

dont think about it

#

just do

pure dagger
#

but if i would understand it it would be better probably

brittle geyser
#

you can undestand something only with practices

#

bro

pure dagger
#

no

brittle geyser
#

go code

pure dagger
#

im trying

brittle geyser
#

Try to save player names, hp, damage etc.

chrome beacon
brittle geyser
chrome beacon
#

It is

brittle geyser
pure dagger
#

yessssss i got it right (that doesnt change anything ๐Ÿ˜”)

pure dagger
#

now idk who is right

brittle geyser
#

i dont care

#

just go practice to properly understand it

chrome beacon
pure dagger
#

so why there is not getMap() but there are sections

brittle geyser
#

getValues()

pure dagger
#

i feel like im repeating questions but

chrome beacon
#

You should be using the sections

pure dagger
#

sorry

wet breach
#

Just listen to Olivo, they know their stuff ๐Ÿ˜‰

chrome beacon
#

Not the maps that are used in the internals

brittle geyser
#
@NotNull Map<String, Object> getValues(boolean var1);
#

there is no 'List'

#

Probably you can get List<Map<String, Object>> but it is stupid

chrome beacon
#

getMapList does exist if you want to get that

#

Anyways you can think of a config section as a wrapper for the map to make it easier to properly access the values

#

Internally it is backed by a map

#

A LinkedHashMap I believe

echo basalt
#

why does getMapList return a List<Map<?, ?>> instead of just a List<ConfigurationSection>

#

in what scenario would the key not be a string

pure dagger
#

now here, whats enchantments, a section? like "enchantments" (string) is a key and there is section as value? am i right?

pure dagger
#

yeeesss

sly topaz
nova notch
#

this is spelled wrong

timid berry
#

True!

nova notch
#

neat tho

timid berry
#

Thanks

inner mulch
#

when i for example send a map to another server (serialized to bytes), then it gets sent back, how do i ensure that the keys are the same, as far a i know the hashes change, when i deserialize something, because it creates a new object with a new memory adress?

eternal oxide
#

use .equals not == for object comparison

inner mulch
#

== compares value and .equals hash, right?

eternal oxide
#

no

#

== is instance equality. .equals compares value

inner mulch
#

but the hashmap uses hashes

#

im not comparing anything here

#

is there a map that compares value?

undone axleBOT
eternal oxide
#

are you using the object as a key?

inner mulch
#

i have a map with objects, im sending them, receiving them back, when i want to lookup something that wont work as the hashes change?

eternal oxide
#

a map is a KV pair

#

value does not matter, only the key

inner mulch
#

yeah the key is an object

eternal oxide
#

then don't

sly topaz
#

why would they change

eternal oxide
#

generate your key based upon unique identities

sly topaz
#

as long as your hashCode is implemented properly, reconstructing the same object will deliver the same hash code

sly topaz
#

well, implement it

echo basalt
#

@EqualsAndHashCode

#

type shit

inner mulch
eternal oxide
#

its your object, you have full control

sly topaz
inner mulch
#

yes

sly topaz
#

well, ultimately you do expect anyone who is using a hashmap to obey the rule of thumb

#

the default hash-code being dependent on the memory address makes it all the more annoying, unsure how you could avoid people using it that way

#

you cannot possibly expect the default hash code to be the same after being reconstructed

inner mulch
#

yeah

sly topaz
#

just document it in your method

#

that your map expects a valid equals & hash code impl

#

nowadays that isn't hard with records being a thing

lilac dagger
#

which form do you guys prefer:

sly topaz
#

ultimately, you could force the user to use your key wrapper so that you can control the hash code impl @inner mulch

earnest girder
#

I am getting this error

org.bukkit.event.EventException: null
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot-api-1.21.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[spigot-api-1.21.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:601) ~[spigot-api-1.21.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:588) ~[spigot-api-1.21.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_21_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:580) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4344-Spigot-a759b62-19bf846]
        at org.bukkit.craftbukkit.v1_21_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:542) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4344-Spigot-a759b62-19bf846]
        at org.bukkit.craftbukkit.v1_21_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:538) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4344-Spigot-a759b62-19bf846]
        at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2210) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4344-Spigot-a759b62-19bf846]
        at net.minecraft.network.protocol.game.PacketPlayInArmAnimation.a(SourceFile:33) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4344-Spigot-a759b62-19bf846]
        at net.minecraft.network.protocol.game.PacketPlayInArmAnimation.a(SourceFile:9) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4344-Spigot-a759b62-19bf846]
#
Caused by: java.lang.IllegalArgumentException: The found tag instance (NBTTagByte) cannot store Integer
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:445) ~[guava-32.1.2-jre.jar:?]
        at org.bukkit.craftbukkit.v1_21_R1.persistence.CraftPersistentDataTypeRegistry.extract(CraftPersistentDataTypeRegistry.java:348) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4344-Spigot-a759b62-19bf846]
        at org.bukkit.craftbukkit.v1_21_R1.persistence.CraftPersistentDataContainer.get(CraftPersistentDataContainer.java:73) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4344-Spigot-a759b62-19bf846]
        at gg.wicklow.events.guns.UseGun.updateLore(UseGun.java:283) ~[?:?]
        at gg.wicklow.events.guns.UseGun.reload(UseGun.java:128) ~[?:?]
        at gg.wicklow.events.guns.UseGun.onInteract(UseGun.java:76) ~[?:?]
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?]
        at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.21.1-R0.1-SNAPSHOT.jar:?]
        ... 24 more
sly topaz
#

please use a paste service

worldly ingot
#

You're running 1.21.1? PES_Think

sly topaz
worldly ingot
#

Are you Wicklow? Is this your plugin?

earnest girder
#

yes

worldly ingot
#

Okay, so your UseGun#updateLore() method method is trying to set an integer on a byte value in the PDC

earnest girder
#

yeah but im not, let me show you code one sec

worldly ingot
#

Yeah only that method should be relevant I think

#

Or I guess anywhere else you get/set the relevant NBT field

earnest girder
worldly ingot
#

Which #get call is line 283? id, ammo, or mode?

#

And is this on a freshly generated item? Because if this is happening on an item you just created now, the only way that would happen is if you set one of those integer fields as a byte somewhere

earnest girder
#
int id = container.get(keyID, PersistentDataType.INTEGER);
worldly ingot
#

Yeah, then I guess just look for instances of set() for the id key and see if any are set to bytes. Not really sure why else it would be yelling at you. The NBT clearly has it set as a byte value

#

If you look at the custom data component it likely will have it set as 0b (or whatever the value is, suffixed with a b)

#

Or maybe you had it set to a byte before and you're still using an item from when it was a byte

earnest girder
#

well it says that its looking for a byte and cant store integer, right?

#

it should be looking for an integer, I dont use bytes anywhere

earnest girder
#

in the item's meta

inner mulch
#

how do i get a non null mapview? getmapview returns null even tho create the item beforehand

worldly ingot
#

The message is a bit misleading because it's a get() call. The error should probably just be "Expected Integer but found tag instance NBTTagByte"

#

And while yes, in theory, you should be able to upcast a byte into an integer, NBT is a bit strict on its typing system

earnest girder
worldly ingot
#

Mode being a byte makes sense because it's a boolean and NBT represents booleans as 0 or 1 as a byte, so that's fine

earnest girder
#

yeah but "wicklow" in the img is id

#

and id should be an int

worldly ingot
#

Yeah so it's set as a byte somewhere, especially because ammo is set correctly as an integer

earnest girder
#

ok

worldly ingot
#

So you know at least CraftBukkit isn't at fault here because it's serializing ammo as expected, even when the value is 1

#

Must have accidentally copy/pasted a PersistentDataType.BOOLEAN or PersistentDataType.BYTE in one of your set() calls

#

A copy/pasted boolean type seems plausible though :p

keen hinge
#

hi im new, im looking for help on how to join

timid berry
#

how can i access playerinteractions in a seperate file?

chrome beacon
#

?di

undone axleBOT
chrome beacon
#

Though passing an event like that is a bit odd

timid berry
#

where is the documentation for player.getWorld().spawn?

#

i want to spawn a item frame

chrome beacon
#

?jd-s

undone axleBOT
timid berry
#

I cant seem to find it for player

chrome beacon
#

You're looking for the spawn method

#

So search for spawn

#

Not getWorld

timid berry
chrome beacon
#

Yeah it's there

paper cosmos
#

is that right that setTarget method doesn't work for breeze? It works for all mobs except breeze for me

timid berry
#

which one

chrome beacon
#

Last 2

pure dagger
#

hey you still strugling ?

timid berry
#

hmm

chrome beacon
#

It tells you what's wrong

timid berry
#

i know

pure dagger
timid berry
#

the thing i want the command to do needs it

pure dagger
#

but

timid berry
#

no it dosent

#

ignroe

#

ignore

pure dagger
#

what does it mean

timid berry
#

nothing

pure dagger
#

that command needs event

chrome beacon
pure dagger
#

event happens when players does something, command happens when players types command

timid berry
chrome beacon
#

You really should take a course or two in Java

#

Before starting with Spigot

#

?learnjava

undone axleBOT
#

For Beginners:

Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/

For Intermediate to Advanced Learners:

Oracle Java Tutorials: The official guides by Oracle for Java programmingโ€”great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/

Practice and Hands-on Learning:

Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/

Free Resources and Documentation:

Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/

Community and Support:

Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/

Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! ๐ŸŽ‰

timid berry
#

it needs a location

#

but what location do i give it?

#

a y?

pure dagger
timid berry
#

when learning java will magically gain me full understand of the spigot api

chrome beacon
timid berry
#

i dont know man

chrome beacon
timid berry
#

class clazz

#

i dont know what that means

chrome beacon
pure dagger
#

wait whats clazz xd

timid berry
#

clazz - the class of the Entity that is to be spawned.

#

what entity is item frame?

chrome beacon
pure dagger
#

oh.. right

chrome beacon
#

An item frame is an item frame

pure dagger
#

cool

timid berry
#

so what do i put?

chrome beacon
#

the location the entity class and the consumer

timid berry
#

whar

#

i provided the x where i want it to spawn

#

but the itemframe.class part is buggin

pure dagger
#

L

#

earn java

nova notch
chrome beacon
#

It's not the .class that's wrong

timid berry
#

is this it chat

chrome beacon
#

Don't modify the ItemFrame outside the consumer

timid berry
#

what

#

this should be fine so far

timid berry
chrome beacon
#

That works

timid berry
#

its cuz i wanted to get the cordinate

#

of the block player was looking

chrome beacon
#

But you really should learn some Java and come back to Spigot after

nova notch
# timid berry

btw u can replace Player player = (Player) commandSender; with a pattern variable by doing if (commandSender instanceof Player player)

chrome beacon
#

Inb4 1.8

paper cosmos
# chrome beacon Odd. Make sure Spigot is up to date and if it is send your code

Is this where I check if its up to date? I dont have any newer versions shown in hints.

            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.21-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>

Here is my function

public void scanAreaForTargets(Mob mob) {
        if (getEntityTeam(mob) == null) return;

        double radius = 16;
        List<Entity> nearbyEntities = mob.getNearbyEntities(radius, radius, radius);
        LivingEntity closestTarget = null;
        double closestDistance = Double.MAX_VALUE;

        for (Entity nearby : nearbyEntities) {
            if (nearby.isInvulnerable()) continue;
            if (!(nearby instanceof LivingEntity livingNearby)) continue;
            
            Bukkit.broadcastMessage(inSameTeam(mob, livingNearby) + "");
            if (inSameTeam(mob, livingNearby)) continue;

            double distance = mob.getLocation().distance(livingNearby.getLocation());

            if (distance < closestDistance) {
                closestDistance = distance;
                closestTarget = livingNearby;
            }
        }

        if (closestTarget != null) {
            mob.setTarget(closestTarget);
        }
    }

That one broadcast message returns false which means it passes all the checks. As I said, it works fine for all mobs except for breeze

timid berry
#

what is the way ot finding what block the player is looking at

chrome beacon
#

Also see if you can make a MRE (minimal reproducable example)

timid berry
#

is it possible to put the item the player has on hand into the item frame?

pure dagger
#

probably

paper cosmos
# chrome beacon You can run /version on the server to see if it's up to date
[00:02:27 INFO]: This server is running CraftBukkit version 4378-Spigot-e65d67a-8ef9079 (MC: 1.21.3) (Implementing API version 1.21.3-R0.1-SNAPSHOT)
[00:02:27 INFO]: You are 2 version(s) behind

I don't understand. I just updated the version in pom.xml and reloaded the server.

<dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.21.3-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
timid berry
young knoll
#

Build the latest jar with buildtools

#

?bt

undone axleBOT
paper cosmos
#

i'm trying latest now

#

no... The latest version gave me a version that is 29 versions behind...

young knoll
#

latest is still 1.21.2

paper cosmos
#

I've got jar 1.21.1

young knoll
#

latest is still 1.21.1

#

close enough

paper cosmos
#

but it says its 29 versions behind

young knoll
#

Because it's still 1.21.1

#

Latest is latest stable

timid berry
#

i think placing an item frame directly on a block breaks it right?

#

I have the loction of where the player is looking

#

but

#

placing an item frame there

#

causes the frame to break

timid berry
paper cosmos
#

my breeze still isn't targeting

#

Can anyone refute the fact that setTarget method doesn't work on breeze?

timid berry
#

minecraft command to suppon /summon minecraft:item_frame 72.97 64.50 115.50 {Motion: [0.0d, 0.0d, 0.0d], Facing: 4b, Bukkit.updateLevel: 2, Paper.SpawnReason: "DEFAULT", Invulnerable: 0b, OnGround: 0b, Air: 300s, PortalCooldown: 0, Rotation: [90.0f, 0.0f], FallDistance: 0.0f, WorldUU

woven marten
#

can someone help me with the CoinsAPINB v1.9.4 software?
its disabling it after the start of my server instantly

sly topaz
sly topaz
#

?paste

undone axleBOT
chrome beacon
#

Don't crosspost

woven marten
#

i did

woven marten
sly topaz
#

where

chrome beacon
woven marten
#

ok

chrome beacon
#

Unless this is related to one of your plugins

sly topaz
chrome beacon
#

Unclear

#

They posted in both channels

woven marten
#

it is a plugin

chrome beacon
#

Is it your plugin

woven marten
#

that i found on the plugin list on my server

#

no

#

not my plugin

chrome beacon
#

Then this is the wrong channel

woven marten
#

sorry

chrome beacon
paper cosmos
# chrome beacon Also see if you can make a MRE (minimal reproducable example)

did you mean this?

 @EventHandler
    public void onBreezeSpawn(CreatureSpawnEvent e) {
        if (e.getEntity() instanceof Breeze breeze) {

            Bukkit.getScheduler().runTaskTimer(this, () -> {
                int radius = 10;
                List<Entity> nearbyEntities = breeze.getNearbyEntities(radius, radius, radius);
                if (nearbyEntities.isEmpty()) return;
                Entity entity = nearbyEntities.getFirst();
                if (!(entity instanceof LivingEntity livingEntity)) return;

                Bukkit.broadcastMessage(entity.getType() + "");

                breeze.setTarget(livingEntity);
            }, 0, 20);
        }
    }
#

I see entities types in chat, but nothing happens.

sly topaz
#

what the heck is breeze

#

don't think that uses target selectors to go towards the player

paper cosmos
#

it has this method. It's also a Mob

nova notch
paper cosmos
#

its not about going towards player, its about attacking any entity.

sly topaz
#

thought it was some kind of projectile

nova notch
#

bruh

#

how are you not even aware of it tho its like a year old at this point

#

its the mob they added with trial chambers

#

basically a windy blaze

fading drift
#

is there a way to have completely memory based worlds?

timid berry
#

how would i add

#

the map im holding

#

to the item frame

#

with code?

#

I got the code for placing the item frame done

#

but im not sure how to place the image onto the frame

#

if im holding it

atomic torrent
#

hello, my servers and bungee are paper 1.21.1, this anticheat is for 1.20, is there any better anticheat in 1.21, or other? i can use this of 1.20?

merry cove
atomic torrent
#

thanks ^^

timid berry
#

chat where is gold pressure plate?

summer scroll
#

Why it's so weird xd

timid berry
#

i see

#

my code buggin

remote swallow
#

You need to register your events

timid berry
#

it wont recognize the plate

#

loc = p.getPlayer().getLocation().clone().subtract(0, 1, 0);

#

hmm

#

maybe less then 1

nova notch
#

yeah subtracting 1 would be getting that grass below it

timid berry
#

so dont sebtract at all?

nova notch
#

keep in mind player loc is at the feet

nova notch
#

just try shit until it works

timid berry
#

/setblock -19 64 282 minecraft:light_weighted_pressure_plate[power=1]

#

i think so yah

#

no subract at all

#

p.setVelocity(p.getLocation().getDirection().multiply(4 /the higher the number the bigger the velocity/))

#

I wonder if i can make it go parabolic instead of straight

#

cuz currently it goes like

#

current vs want

remote swallow
#

Do the math, launch them with velocity of x and z not just direction

atomic torrent
#

hello can someone help me

#

when i use authmereloaded

#

i cant move when i do autologin in bungee

#

hsombini commented on Dec 13, 2015
I can relate!

Also it happens on bungeecord using AuthMeBungeeBridge, players who changes the server cannot move!

from a github thing

timid berry
#

-0.1636074613002293,-2.4846005965446176,-3.1304939664942695

#

what do the values here mean?

#

xyz

#

its what its setting my velocity to

#

0.2789542730952579,-2.2222897894206044,-3.3141533768609475

#

new ones once i did something?

#

ih

#

no

#

i forgot a semi colon so it didnt compile

#

chat how do i make it fling me up even if im not looking up

#

oh i can hardcode it

timid berry
#

what is this erroa bout?

echo basalt
#

solid chance "yes" and "no" are being parsed as booleans

timid berry
#

dammit

#

that was it

vernal oasis
#

What jdk version do I use for 1.21?

#

I'm assuming jdk 21.

blazing ocean
#

Yes

vernal oasis
#

That said, how do I add an Attribute to and item? Say give a dirt block knockback resistance when held

vernal oasis
#

because AttributeModifier is marked for removal...? So... what do I do/use instead?

timid berry
#

how do i add this library?

vernal oasis
#

Are you using Maven or Gradle?

young knoll
vernal oasis
#

Which is that?

blazing ocean
#

The one with a key I believe

vernal oasis
#

I'm not familiar

#

This one?

#

There an example somewhere I could look at?

vernal oasis
#

That's the deprecated one I thought?

young knoll
#

Youโ€™ll notice that constructor is explicitly not marked as deprecated like the others

vernal oasis
#
'AttributeModifier(java. lang.@org. jetbrains. annotations. NotNull String, double, org. bukkit. attribute. AttributeModifier.@org. jetbrains. annotations. NotNull Operation)' is deprecated since version 1.21 and marked for removal
young knoll
#

Thatโ€™s not the constructor that was linked

vernal oasis
#

?

blazing ocean
vernal oasis
#

I don't know how to do that lol

#
NamespacedKey key = new NamespacedKey(CUU.getInstance(), "generic.safeFallDistance");

        AttributeModifier modifier = new AttributeModifier(key, 10.0, AttributeModifier.Operation.ADD_NUMBER);
#

Something like that?

#

I posted a screenshot of code and instantly went "I hate myself for doing that"

blazing ocean
#

It'll just be minecraft:generic...

young knoll
#

The key is an identifier for your modifier

blazing ocean
#

or wait no

#

yea

young knoll
#

So give it some kind of descriptive name

blazing ocean
young knoll
vernal oasis
#

Anyways, thanks for the help lads/lasses/ uhhh ssses?

timid berry
vernal oasis
#

Does the repo have a thing in the readme that says something like

<dependency>
  <groupId>org.spigotmc</groupId>
  <artifactId>spigot-api</artifactId>
  <version>1.21-R0.1-SNAPSHOT</version>
  <scope>provided</scope>
</dependency>

or

<repository>
  <id>sonatype</id>
  <url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
quaint mantle
#

Does any1 know how do i change the player knockback and attack-interval of my spigot server

timid berry
#

i added it but the words r just red

vernal oasis
#

Did you add it to the correct location?

#

Have you ever coded a plugin before?

#

Do you have an Java experience?

#

Do you have any coding experience?

spiral light
#

The answer will be 4 times No

nova notch
#

ok but to be fair fuck maven

vernal oasis
#

I want to switch off Maven but I don't care enough to transfer it to Gradle or something, mostly because I've never done it and have no idea what I'd be doing.

nova notch
#

just do it and your life will improve

vernal oasis
#

Ironically, speak of which. How do I resolve this error?

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project CUU: Fatal error compiling: java.lang.NoSuchFieldError: Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid'
nova notch
#

you get to use kotlin instead of this fake ass wannabe html

vernal oasis
#

What uhh what

#

ignore

#

What's the equivalent to maven package?

quaint mantle
#

is there an event called every time when a block is destroyed, moved, or removed?

#

i believe it's BlockPhysicsEvent but i'm not sure

vernal oasis
#

like uhh BlockBreakEvent...?

quaint mantle
#

Called when a block is broken by a player.

#

not exactly what i want

vernal oasis
#

?

quaint mantle
#

thats not an event, its an abstract class

#

you cant really listen to that

#

what i want is an event that's called every time the type of material in a block position changes

#

thats should cover everything

vernal oasis
#

I don't know if there is one, if you haven't found it looking at the docs you might just have to go the annoying way of coding edge cases

vernal oasis
#

someone ping me with a tutorial or something on have to Gradle, since I'm coming from Maven. I have no idea what I am doing thank

I sleep

#

Like, how do I add lombok as a dependency for 1.21?

dependencies {
  compileOnly 'org.projectlombok:lombok:1.18.34'
}

Doesn't work, idk if I have the wrong version, or what...

dry hazel
#

you have to add it as an annotationProcessor too @vernal oasis

#

annotationProcessor 'org.projectlombok:...'

dry hazel
warm mica
#

It really doesn't that much what you use, both work really well

grave kayak
#

hello Im trying to use this class to format hex (&#rrggbb) minimessage and normal & codes. It's mostly working but it will not apply the bold, italic, strikethrough etc. formatting. I got the class online and tweaked it a little as I havent worked with minimessage before
https://pastebin.com/Uhd2nHxS

rough drift
#

Questions about BiomeProvider#getBiomes

stable gorge
#

any better docs for brigadier commands on papermc? using experimental

blazing ocean
#

?whereami

stable gorge
#

I KNOW I KNOW just thought it'd be an ask but if its SPIGOT API only then i getchu (:

blazing ocean
#

It's paper only API

stable gorge
#

๐Ÿซก

tall gyro
#

Hi everyone, I ran into a problem when I created my empty world. My plugin make a platform right under the getWorldSpawn coordinates, but when I enter this world, I see that the platform is in the wrong place and I fall into the void.

agile berry
#

what's the best way to start making a custom procedural generated map / location generator? just try to mess around with perlin noise?

chrome beacon
#

yeah

#

play around with noise

agile berry
#

do you have any recommendations on perlin noise libs?

chrome beacon
#

Haven't used any

tall gyro
smoky anchor
#

What the frick is

#

sir, this is Spigot

chrome beacon
#

Forge Hybrid ๐Ÿ’€

fading drift
#

with my database should I save to the database every time a value is changed or every 100 ticks or so

tall gyro
undone axleBOT
#

Itโ€™s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

tall gyro
#

Location{world=CraftWorld{name=121},x=0.0,y=64.0,z=64.0,pitch=0.0,yaw=0.0}
Location{world=CraftWorld{name=121},x=0.0,y=63.0,z=64.0,pitch=0.0,yaw=0.0}

#

spawn and first block coordinates

smoky anchor
#

That's no code

#

Also, what is that image supposed to show exactly

tall gyro
#

the world spawn and a platform

#
WorldCreator worldCreator = new WorldCreator(name);

        worldCreator.environment(World.Environment.NORMAL);
        EmptyWorldChunkGenerator chunkGenerator = new EmptyWorldChunkGenerator();
        worldCreator.generator(chunkGenerator);

World world = worldCreator.createWorld();

world.setSpawnLocation(vec.toLocation(world));

world.getBlockAt(world.getSpawnLocation().add(0,-1,0)).setType(Material.BEDROCK);
            world.getBlockAt(world.getSpawnLocation().add(1,-1,0)).setType(Material.BEDROCK);
            world.getBlockAt(world.getSpawnLocation().add(0,-1,1)).setType(Material.BEDROCK);
            world.getBlockAt(world.getSpawnLocation().add(1,-1,1)).setType(Material.BEDROCK);
            world.getBlockAt(world.getSpawnLocation().add(-1,-1,0)).setType(Material.BEDROCK);
            world.getBlockAt(world.getSpawnLocation().add(0,-1,-1)).setType(Material.BEDROCK);
            world.getBlockAt(world.getSpawnLocation().add(-1,-1,-1)).setType(Material.BEDROCK);
            world.getBlockAt(world.getSpawnLocation().add(1,-1,-1)).setType(Material.BEDROCK);
            world.getBlockAt(world.getSpawnLocation().add(-1,-1,1)).setType(Material.BEDROCK);
smoky anchor
#
  1. for loops exist, would recommend you take a look at those
  2. instead of getting the spawn location, try to use the vec you have ?
    idk, never played with world creator
tall gyro
#

what will change if i use vector instead of getworldspawnlocation

chrome beacon
#

gamerule to 0

tall gyro
#

where should I add this

smoky anchor
#

world has gamerule methods

#

so prob after you create the world

tall gyro
#

okay

#

will try now

#

hm

rough drift
tall gyro
#

this is weird. It turns out there was an error in my code. I used getY for the Z coordinate. But the player was still teleported to 0 64 0 coordinates

#

to teleport the player I also used getWorldSpawnLocation

#

I randomly changed the teleport method arguments and it worked, thanks

fading drift
#

in my friends system I am storing friends as uuids

#

when listing all friends to the player I want to show names however

#

however if the friend hasnt joined the server since startup it cant find the player. should I store a name with the uuid to the database or should I lookup the name every time

blazing ocean
#

Bukkit.getOfflinePlayer moment

#

not sure if that caches

fading drift
#

yeah itll throw an error if that player has never joined the server since its uptime

blazing ocean
#

no it won't

#

that method doesn't throw kek

fading drift
#

I'm getting one I swear

#

wait I'll show

chrome beacon
#

getOfflinePlayer(uuid) will not throw

#

It always returns an OfflinePlayer instance

fading drift
#

would offlinePlayer.getName ever be null or smt

blazing ocean
#

No

#

And if you get by UUID it also doesn't do a lookup afaik

fading drift
#

am i stupid

#

my code works now

chrome beacon
#

web lookup from name is to fetch uuid

eternal oxide
#

name can be empty though, if its not a valid lookup

fading drift
#

but it threw null pointers earlier

eternal oxide
#

impossible to NPE on getOfflinePlayer

fading drift
#

why is it saying 15 more without shwoing me

#

im stupid

#

I see the error

#

thanks for the help I'm so sleep deprived at this point

blazing ocean
undone axleBOT
fading drift
#

I spent 10 mins figuring out why my code didnt work and I missed a !

blazing ocean
#

kek

worldly ingot
#

definitely been there

#

caused an infinite loop and crashed the server after forgetting a ! in a do/while

slender elbow
#

that explains the hypixel outage

lilac dagger
#

i never got to use do whiles ๐Ÿ˜ฆ

sly topaz
#

well, it isn't that useful of a construct, you might find use in them when it comes to text processing but that's about it

river oracle
#

I use them like every once and a million years

worldly ingot
chrome beacon
worldly ingot
#

Sometimes!

blazing ocean
#

smh my head

floral drum
pure dagger
#

if i use "saveDefaultConfig()", it loads the config file into the folder, but also, when there is no key that im looking for, in the file, it looks for it in the default config, how do i make it so when you run the plugin for the first time (and there is no configuration file in the folder), it loads the config, but if player removes the values from it then there are just no values, should i just use "saveConfig()" i actually dont understand well these all methods

#

(as you can see..)

deft summit
#

Does creating NPCs still involve sending Packets through NMS or is there any native thing for it by now?

tidal kettle
#

Hey can you do something like this with Runnable like get a function inside the task?

spiral light
tidal kettle
#

Uuu

#

sound hard

spiral light
deft summit
#

aight, thanks

spiral light
# tidal kettle sound hard

not at all ... its just basic java

public static class BukkitRunnableWithTime extends BukkitRunnable {

        @Override
        public void run() {
            
        }
        
        public int getTime() {
            return 10;
        }
    }
spiral light
#

then you create an object for this and run it with .runTaskTimerAsy...

tidal kettle
#

thxx

timid berry
#

how can i use this library

spiral light
#

did you follow the tutorial on how to use ?

timid berry
#

the tutorial is not clear

#

i have it downloaded but

remote swallow
#

you added the maven dep

spiral light
#

thats clear enough ^^

timid berry
#

i dont think mvn commands will work on windows

remote swallow
#

you now need to reload maven

timid berry
#

i have the files downloaded

spiral light
#

you need to install maven or use the maven path that buildtools downloads

remote swallow
#

its on maven, you dont need to download it

timid berry
#

oh okay

#

how do i reload maven?

spiral light
#

its not on maven repo ^^ you need to install it to local maven repo

remote swallow
#

you add the maven dep then reload maven, open the maven tab on the right of ur screen, on the top of the bar there is buttons one looks like a circle press it

worldly ingot
#

Yeah that library isn't hosted on a repo. It wants you to local install it

remote swallow
#

ah, ye do that

worldly ingot
#

You can run Maven commands on Windows just fine, you just need to have Maven actually installed :p

#

mvn --version would tell you what version you have installed, if any. Otherwise you need to download and install it

timid berry
#

i dont think so

spiral light
#

if you dont want to install it use the maven that buildtools downloads

worldly ingot
#

Then yeah you don't have it installed

timid berry
worldly ingot
#

Yes because you didn't use Maven to locally install it yet lol

#

You need to install Maven first (see the link I sent), then run mvn clean install in the root directory of that library, then refresh your Maven project

timid berry
#

ive used the package thing before tho?

#

so i must have it installed

#

right

#

?

spiral light
#

nope

worldly ingot
#

On a different computer maybe? Or a different version?

timid berry
#

no this computer

remote swallow
#

intellij will have a bundled version

worldly ingot
#

I guess you could open the project in IntelliJ and build it that way as well

spiral light
#

just because intellij has a "private" or "local" installed version it can use

remote swallow
#

you can use where mvn to find any files called mvn

timid berry
remote swallow
#

you need to compile it

timid berry
#

how

remote swallow
#

by using the command it tells you to

timid berry
#

compile it like a regular java ?

remote swallow
#

1st step, install maven

#

2nd step, run those commands one by one

timid berry
#

wouldnt the maven built into intellji not recognize the stuff the local repo by the maven you want me to install?

remote swallow
#

intellij bundles its own maven version, you can compile it with intellij using maven or you can just install maven

remote swallow
timid berry
#

how can i compile it with intelliji maven?

remote swallow
#

the same way you compile any other maven project in intellij

timid berry
#

what shall i do with this

remote swallow
#

did you run the install goal

timid berry
#

it magically un errored

remote swallow
#

it is now in your maven local

chrome beacon
remote swallow
timid berry
#

what does this error mean?

lilac dagger
#

you need to .build();

halcyon hemlock
timid berry
halcyon hemlock
#

remove the first line after function name

timid berry
halcyon hemlock
#

I recommend you learn java first

halcyon hemlock
lilac dagger
#

return menu; instead of last line

pure dagger
#

what is that explanation of deprecation

#

getByKey: also deprecaated

halcyon hemlock
# timid berry

Something like this

public static Menu createMenu() {
    Menu menu = ChestMenu.builder(1).title("Level").build();
    // ...
    return menu;
}
halcyon hemlock
pure dagger
#

getByKey()

#

lol

halcyon hemlock
#

then use Registry#get instead

#

pretty sure new shit runs on registry

pure dagger
#

how do i do it with string

young knoll
#

Registry.match

halcyon hemlock
#

create a NamespacedKey

#

or that

timid berry
#

chat do i have to write all these lines for every single item i want to add?

pure dagger
#

yeah, if you dont make a better method for that

chrome beacon
#

The data has to come from somewhere

timid berry
#

sigh

chrome beacon
#

without you telling it to do so

pure dagger
#

how am i telling it to do so

#

how to do that

pure dagger
# young knoll Registry.match
Enchantment ench1 = Registry.ENCHANTMENT.match(enchantment_name);
                    Enchantment ench2 = Registry.ENCHANTMENT.get(new NamespacedKey(plugin, enchantment_name));

like this? there is no match()

pure dagger
#

maybe older version

#

1.19.2?

pure dagger
#

why is this namespacedkey

young knoll
#

NamespacedKey.minecraft

pure dagger
#

and enchantment_name will be just the same as the name of enum or different

young knoll
#

Needs to match the internal name

pure dagger
#

because Enchantment.getByName() is deprecated because the names are bad

pure dagger
#

where do i find these

slender elbow
#

it's just the vanilla enchantment key

#

minecraft:sharpness, minecraft:unbreaking etc

young knoll
#

/enchant @a <tab> for a list

remote swallow
#

do not enchant the salmon

pure dagger
#

thx

remote swallow
#

will cause lot of salmon grow packets

pure dagger
#

what

#

?

remote swallow
#

dw im making a joke

pure dagger
#

๐Ÿ˜ญ XD

#

i dont get it but kay

timid berry
#

what do i do for the version?

#

also is it supposed to auto download?

#

nvm it magically works

silent slate
#

How to make a function that gets a block and 4 booleans to which sides it should connect. The function is only applicable to iron bars and should connect them to the specified sides?

slender elbow
#

Here's a function that takes a block and four booleans (one for each side) and connects the block accordingly if it's an iron bar. This uses the Spigot API and requires checking and updating the block data properly.

In Minecraft, iron bars use the BlockData interface and specifically the MultipleFacing interface, which allows setting connections to specific sides.

Here's how you can implement the function:

import org.bukkit.block.Block;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.MultipleFacing;

public void setIronBarConnections(Block block, boolean north, boolean east, boolean south, boolean west) {
    // Check if the block is an iron bar
    if (block.getType() != Material.IRON_BARS) {
        return; // Only apply to iron bars
    }

    // Get the BlockData and cast it to MultipleFacing for connecting sides
    BlockData data = block.getBlockData();
    if (data instanceof MultipleFacing) {
        MultipleFacing ironBarData = (MultipleFacing) data;

        // Set connections to the specified sides
        ironBarData.setFace(BlockFace.NORTH, north);
        ironBarData.setFace(BlockFace.EAST, east);
        ironBarData.setFace(BlockFace.SOUTH, south);
        ironBarData.setFace(BlockFace.WEST, west);

        // Update the block's data
        block.setBlockData(ironBarData);
    }
}

Explanation

  1. Check Block Type: We check if the block is of type IRON_BARS. If not, we exit the function early.
  2. Get Block Data: We retrieve the block's BlockData and cast it to MultipleFacing, which allows us to set faces.
  3. Set Connections: Using setFace(), we set each specified side to true or false based on the given booleans.
  4. Update Block Data: Finally, we update the block with the modified BlockData.

Usage

To use this function, simply pass the block and four booleans specifying which sides to connect:

setIronBarConnections(block, true, false, true, false);

This example would connect the iron bar to the north and south sides only.

chrome beacon
#

EmilyGPT to the rescue

slender elbow
#

๐Ÿ’ช๐Ÿ’ช

silent slate
#

this is a really great answer and explaination xD

vernal oasis
dry hazel
#

use the latest

vernal oasis
#

Idk what that is lol

dry hazel
#

the latest version, the most recent one

chrome beacon
#

Time for the thing called google

slender elbow
#

/chatgpt what's the latest lombok version

chrome beacon
#

@EmilyGPT: How do I search for stuff on Google

vernal oasis
#

EmilyGPT what's the latest lombok version?

slender elbow
#

I forgot

#

use google

timid berry
vernal oasis
#

It says 1.18.34? That's what I'm using?

wet breach
slender elbow
#

@dry hazel thoughts?

dry hazel
#

that was the problem in your maven setup, your gradle setup doesn't work because you don't have the dependency as an annotationProcessor

wet breach
vernal oasis
#

Because people suggested it

wet breach
#

probably for all the wrong reasons

timid berry
wet breach
#

99% of projects in regards to plugins will never be large enough to see any speed improvements. Don't require some unique build setup. Or have some other special requirement that would make gradle a necessesity

vernal oasis
#

Ye but it seems easier?

wet breach
#

in what way?

slender elbow
#

gradle is perfectly just as valid to use as maven

wet breach
#

obviously its not if you are asking for tutorials and you already know maven

#

in what way is that easier?

vernal oasis
#

It looks simpler and such

wet breach
#

its not bad obviously if used right

#

and there is some things maven has that some people hail gradle for ironically too

vernal oasis
#

I'm in a beer tasting class rn so I'm getting wasted for college credit ๐Ÿ˜Ž

#

I know for a fact my maven setup was not correct

wet breach
#

how was it not correct?

vernal oasis
#

I don't know, it didn't compile

#

?paste

undone axleBOT
wet breach
#

so you have no clue how to compile but want to make plugins o.O

#

devs are weird these days, don't even know the tools they use -.-

vernal oasis
#

Nah I've made plugins and such before, I just updated from a previous version so things are janky

#

Stuff changed in 1.21 that I've not kept up with really so stuff kinda broke

wet breach
vernal oasis
#
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project CUU: Fatal error compiling: java.lang.NoSuchFieldError: Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid'
wet breach
vernal oasis
dry hazel
#

you're using 1.18.28

wet breach
#

clearly that line says otherwise

vernal oasis
#

Oh what

#

I shall try this later when I'm back from classes. Thank you. I will update you

wet breach
#

now do a clean cycle and then build

vernal oasis
#

(slightly drunk)

wet breach
#

someone is a light weight

vernal oasis
#

On anti-depressants

#

Things are 5-10% and it's a total of 8oz

wet breach
#

anyways, doing a clean first helps ensure the cache gets cleared and doesn't interfere with your build you are trying to get to complete

#

once compiling works perfectly don't use the clean cycle ๐Ÿ˜‰

vernal oasis
#

Yuh

wet breach
#

also your maven shade plugin is outdated and using scope system is generally not acceptable anymore

vernal oasis
#

Is there any reason to make a shaded?

wet breach
#

shaded means to take the classes from another project or jar and to put it into your project jar

#

if you are not using maven shade for that, then I guess you can remove it since its not being used lol

vernal oasis
#

Just remove the <goal>?

wet breach
#

o.O

#

remove the whole plugin section for maven shade

#

if you are not making use of shading

vernal oasis
wet breach
#

if you start at 21 you will remove the compiler plugin

#

and thus no compiling will happen ๐Ÿ™‚

tidal kettle
#

hey i discorer that can someone explain me further cause i try with some thing like localhost and all work, but i try on a bungee server and it don't work any idea why?

wet breach
#

which is kind of the opposite of your goal currently

vernal oasis
#
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.5.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
chrome beacon
vernal oasis
#

That ye

chrome beacon
#

not of your server

#

You need to give it the correct ip

tidal kettle
tidal kettle
#

but sometime it doesn't work

wet breach
#

localhost would refer to the host the application is currently running on

#

however typically it refers to 127.0.0.1

#

which wouldn't work for transfer

#

since its not a public ip

#

but it depends on the OS as some OS's default localhost to the local ip assigned via router

#

while the majority assign it the loopback address

eternal night
#

no, olivo was right there.

eternal night
#

that string is not evaluated until it reaches the client

#

.transfer on spigot does absolutely nothing but send a single packet

#

no name resolution etc

#

all that is left to the client

wet breach
eternal night
#

dat true KEKW

tidal kettle
#

okay i think .transfer just don't work on bungee server

#

idk why

chrome beacon
#

Should work just fine

tidal kettle
#

imma try on a local bungee and tell you after
edit: all work i'm just dumb

chrome beacon
#

but why are you using it instead of the Bungeecord

#

If you're on a Bungeecord you should tell the Bungeecord to change server

#

instead of the client

#

You most likely want the pmc instead

#

?pmc

tidal kettle
#

i know but i justwant to know more about the .transfer x)

quaint mantle
#

is there any way how I can make revive plugin? I mean I can get it to work, but I dont know how to prevent the player dying when being killed by other player.

#

and then how to set the respawn menu for the player after the time runs out

tranquil ferry
#

i have a nonce of a user download

#

what shd i do ?

#

he leaked my plugin on a website

wet breach
#

ban them from your resource and carry on paying no mind to it updating your plugin

timid berry
#

it says event is already defined

#

which is true

#

but idk what to do

quaint mantle
remote swallow
#

call it something else

chrome beacon
remote swallow
#

my brain cell hit the wall

upper hazel
#

?paste

undone axleBOT
quaint mantle
timid berry
#

chat where do i set where the thing goes

#

the position