#help-development
1 messages ยท Page 1173 of 1
You don't want 1 with only 1 element in the list
can i join 1.20.4 servrs with 1.20.6?
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));
}
yeah, im just saying that i said from 0 to 0 meaning both sides included
No real point in using a list of UUIDs in this case
what's a good way to string'ify/bite'ify TrimMaterial and TrimPattern and reverse it
which means?
exactly what it means
I don't think biting them is recommended
registry use how
thats bad
heh
sick
check in console if u wanna know
show error
Im guessing NPE
Code
List<Player> candidates = Bukkit.getOnlinePlayers().stream()
.filter(candidate -> candidate != origin && candidate.getLocation().getY() <= 100)
.collect(Collectors.toList());
return candidates.isEmpty() ? null : candidates.get(ThreadLocalRandom.current().nextInt(candidates.size()));
}```
๐
streams are bad? ๐ญ
no
I thought they were really fancy and cool
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
I got it working
they are
don't listen to the haters!!!
real
Where can I access documentation on a player kills another player
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
var ๐คฎ
real
what's with the hate to new features lol
var is great with long ass types
I just use it everywhere I can to keep things consistent
fun getTarget(origin: Player): Player? =
Bukkit.getOnlinePlayers().filter { it != origin && it.location.y <= 100 }.randomOrNull()
Kotlin?
yes
yeah
will this code bug out if the player sucicides or without killer?
?tas
maybe
neurons kicking in
@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?
try and see too
I knew youd say that :(
if you knew it why didn't you just try it ๐
then you should've taken action
why are you saving registries in static vars anyway
accessibility most likely
well the alternative was getting them in a CompletableFuture
what do you mean
and im pretty sure youre not supposed to access Bukkit api outside of main thread
why are you accessing trim patterns async
rsns
it isn't that bukkit cannot be accessed across threads, it is that most things in bukkit are not thread safe
yeah thats what I thought tbh
the rule of thumb is anything that interacts with the world
shouldn't be accessing internals smh
whos moonrise
I run this on production ๐
how can i access hitlist on my other file?
like access and modify it
alr
make a getter or set it static
you need to learn Java
u right
?learnjava
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! ๐
public**
huh
public static .....
I recommend the jetbrains academy java course
in the class not the method
not in the Enable Method
but i need to set it at enable?
you are doing things you don't understand
just throwing things at the wall will only work for so long, you should actually learn the concepts before trying this out
<ClaasName>.hitlist
capitalCities.get("England");
this would return null if it dosen't exist right
england is not a city
yeah, that the point why it return null ๐
whar
o yeah
oh oh oh
you aren't comparing the string to anything
Yes. But as a general rule you should not keep loose Datastructures in your JavaPlugin class.
Create an actual class, put your Map in there, and dont let other classes access the Map directly.
Rather write new methods like
public String getCapitalCityOfCountry(String countryName) {
this.capitalMap.get(countryName);
}
Which is much more expressive.
if i do something like
capitalCities.put("Germany", "Berlin");
but germany already has a value, will it overwrite or error?
getCapitalCityOfCountry is... a name lol
getCapitalCity would've been enough, of what else you'd get a capital city of
no no this is java, you need an excessively verbose name for it
It will overwrite it. You can hover over the Map object and read the JavaDocs. They should state the contract of the Objects Methods.
the javadocs are your friend, if you don't understand what it says, you can just feed the description to chatgpt/claude/gemini/copilot and ask the specific question
why the explicit type
wait wdym you can hover over it
eh
it shows you what's in it just by hovering?
I like being explicit when things are nullable
Better than being confused by subpar compressed abbreviations and having to read the actual method implementation.
I would rather have a verbose name which tells me exactly what the method does ๐
I also forgot that states and provinces could have their own capitals
there should be a balance, if anything. But I generally agree
what if i have something like
zarif, mark
mark, zarif
which will it access?
capitalCities.get("zarif");
I never remember the damn command
Maps are a one way mapping. You have one key for one value.
Zahin consider yourself warned for the first time
warned for what
this guy keeps spamming try it and see
im not tryna compile n upload n restart the server
literally the first time I said it lol
Not an excuse to get vulgar
aight mb
you might as well get used to doing it now
You can rightclick and mute/ignore users you dont want to read messages of
so the .get gets value of the key only?
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
and not the key associated with a value
V value = map.get(key);
A Map gives you only the value, given a certain key.
getUniformResourceLocatorOrNull, are we cooking?
The method doesnt even have its access modifier in it.
Should be
public ResourceLocation getPublicUniformResourceLocatorOrNullIfTheActualResourceLocationWasntFoundSometimesThrowsAnException() {
๐ถ
strictfp
tf is that
:)
public static final synchronized strictfp ResourceLocation
You know this is what kotlin has backticks for
fun `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.`(): ResourceLocation {}
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.`()
sounds like one could make a skript to kotlin compiler
is that using the kotlin scripting system
Yes
so why not kts smh
?
the extension
test.bukkit.kts
theoretically
I was looking at the first one lol mb
probably using a library
which library?
this one seems to support latest version:
https://github.com/LOOHP/ImageFrame
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
any guides on project structure? not sure where i should put like generic types etc
my developer in christ we live on a giant rock circling a big hot ball in an infinite void
Go Wild.
its a Map<String, Object>
and type of map.get("c") is List<Map<String, String>>
is this right?
why configs are so confusing to me
U:
a: a
b: b
c:
d: d
e: e
f:
- f
whats the difference between section and map..
now value of "c" is Map<Object>
?
.
here i said that its list of maps
only Map<String, Object> without list
{"d":"d", "e":"e"}
{"d":"d", "e":"e", "f":"[f]"}
thats your yml
what
๐ญ
you need practice
yea
not theory
but i really dont get it idk why its so hard to me
but if i would understand it it would be better probably
no
go code
im trying
yes
Try to save player names, hp, damage etc.
A section is a map
its not
It is
not really
yessssss i got it right (that doesnt change anything ๐)
Not hard to test for yourself
so why there is not getMap() but there are sections
getValues()
i feel like im repeating questions but
You should be using the sections
sorry
Just listen to Olivo, they know their stuff ๐
Not the maps that are used in the internals
@NotNull Map<String, Object> getValues(boolean var1);
there is no 'List'
Probably you can get List<Map<String, Object>> but it is stupid
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
why does getMapList return a List<Map<?, ?>> instead of just a List<ConfigurationSection>
in what scenario would the key not be a string
now here, whats enchantments, a section? like "enchantments" (string) is a key and there is section as value? am i right?
yes
yeeesss
keys can be any scalar type
this is spelled wrong
True!
neat tho
Thanks
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?
use .equals not == for object comparison
== compares value and .equals hash, right?
but the hashmap uses hashes
im not comparing anything here
is there a map that compares value?
?xy
are you using the object as a key?
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?
yeah the key is an object
then don't
why would they change
generate your key based upon unique identities
as long as your hashCode is implemented properly, reconstructing the same object will deliver the same hash code
i dont implement it
well, implement it
but i cant expect other people to do so
its your object, you have full control
is this some kind of API
yes
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
yeah
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
which form do you guys prefer:
ultimately, you could force the user to use your key wrapper so that you can control the hash code impl @inner mulch
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
please use a paste service
You're running 1.21.1? 
Are you Wicklow? Is this your plugin?
yes
Okay, so your UseGun#updateLore() method method is trying to set an integer on a byte value in the PDC
yeah but im not, let me show you code one sec
Yeah only that method should be relevant I think
Or I guess anywhere else you get/set the relevant NBT field
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
id
int id = container.get(keyID, PersistentDataType.INTEGER);
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
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
yeah I have seen that in my logs
in the item's meta
how do i get a non null mapview? getmapview returns null even tho create the item beforehand
Nah it says it's trying to store an integer but there's a byte at that field
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
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
Yeah so it's set as a byte somewhere, especially because ammo is set correctly as an integer
ok
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
hi im new, im looking for help on how to join
how can i access playerinteractions in a seperate file?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Though passing an event like that is a bit odd
where is the documentation for player.getWorld().spawn?
i want to spawn a item frame
?jd-s
Yeah it's there
is that right that setTarget method doesn't work for breeze? It works for all mobs except breeze for me
which one
Last 2
hey you still strugling ?
It tells you what's wrong
i know
why is it a command
the thing i want the command to do needs it
but
what does it mean
nothing
that command needs event
Odd. Make sure Spigot is up to date and if it is send your code
event happens when players does something, command happens when players types command
what do i put instead of the tiem i want?
You really should take a course or two in Java
Before starting with Spigot
?learnjava
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! ๐
he dont want
when learning java will magically gain me full understand of the spigot api
The javadoc tells you
If you have a basic understanding of Java you will know exactly what's wrong
Read the description
wait whats clazz xd
clazz is the variable name
oh.. right
An item frame is an item frame
cool
so what do i put?
the location the entity class and the consumer
whar
i provided the x where i want it to spawn
but the itemframe.class part is buggin
...an x coordinate is not a location
No
It's not the .class that's wrong
Don't modify the ItemFrame outside the consumer
oh i remember
That works
But you really should learn some Java and come back to Spigot after
btw u can replace Player player = (Player) commandSender; with a pattern variable by doing if (commandSender instanceof Player player)
Inb4 1.8
intellij already told him
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
what is the way ot finding what block the player is looking at
You can run /version on the server to see if it's up to date
Also see if you can make a MRE (minimal reproducable example)
is it possible to put the item the player has on hand into the item frame?
probably
[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>
chat why wont the frames stay ?
Updating the version in pom.yml does not change what version the server is running
Build the latest jar with buildtools
?bt
I just realized it. I built it today, though I've chosen 1.21.3 option, not "latest". I guess this is the reason?
i'm trying latest now
no... The latest version gave me a version that is 29 versions behind...
latest is still 1.21.2
I've got jar 1.21.1
but it says its 29 versions behind
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
like tis
my breeze still isn't targeting
Can anyone refute the fact that setTarget method doesn't work on breeze?
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
can someone help me with the CoinsAPINB v1.9.4 software?
its disabling it after the start of my server instantly
you need to spawn the item frame one block in front of it for it to hang to the block
send the server logs in a paste
?paste
Don't crosspost
i did
i did
where
Send the link in #help-server
Unless this is related to one of your plugins
isn't it a plugin dev thing, it is an API
it is a plugin
Is it your plugin
Then this is the wrong channel
sorry
Move to #help-server
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.
what the heck is breeze
don't think that uses target selectors to go towards the player
it has this method. It's also a Mob
do u live under patrick's rock?
its not about going towards player, its about attacking any entity.
I don't play newer versions lol
thought it was some kind of projectile
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
is there a way to have completely memory based worlds?
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
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?
Should probably ask this in #help-server. And in paper's server :p but I use spartan and I think it does great ๐
thanks ^^
chat where is gold pressure plate?
It might be LIGHT_WEIGHTED_PRESSURE_PLATE, not sure tho lmao.
Why it's so weird xd
A light weighted pressure plate is a type of pressure plate that, like the heavy weighted pressure plate, outputs a variable redstone signal strength based on the number of entities present on the plate.
A light weighted pressure plate outputs one redstone signal strength for every entity present.
You need to register your events
it wont recognize the plate
loc = p.getPlayer().getLocation().clone().subtract(0, 1, 0);
hmm
maybe less then 1
yeah subtracting 1 would be getting that grass below it
so dont sebtract at all?
keep in mind player loc is at the feet
/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
Do the math, launch them with velocity of x and z not just direction
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
-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
solid chance "yes" and "no" are being parsed as booleans
Yes
That said, how do I add an Attribute to and item? Say give a dirt block knockback resistance when held
because AttributeModifier is marked for removal...? So... what do I do/use instead?
how do i add this library?
Are you using Maven or Gradle?
Use the not deprecated constructor
Which is that?
The one with a key I believe
I'm not familiar
declaration: package: org.bukkit.attribute, interface: Attribute
This one?
There an example somewhere I could look at?
AttributeModifier, not Attribute
declaration: package: org.bukkit.attribute, class: AttributeModifier
That's the deprecated one I thought?
Youโll notice that constructor is explicitly not marked as deprecated like the others
'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
Thatโs not the constructor that was linked
?
Use a namespacedkey instead of a string
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"
It'll just be minecraft:generic...
The key is an identifier for your modifier
So give it some kind of descriptive name
is qshfkgjagxkds a descriptive name
Ill qshfkgjagxkds you
Maven
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>
Does any1 know how do i change the player knockback and attack-interval of my spigot server
yes
i added it but the words r just red
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?
The answer will be 4 times No
ok but to be fair fuck maven
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.
just do it and your life will improve
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'
you get to use kotlin instead of this fake ass wannabe html
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
like uhh BlockBreakEvent...?
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
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
I don't know how to do the dependencies D:
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...
you have to add it as an annotationProcessor too @vernal oasis
annotationProcessor 'org.projectlombok:...'
your lombok version is too old for your java version
wannabe html lol aka xml
It really doesn't that much what you use, both work really well
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
Questions about BiomeProvider#getBiomes
any better docs for brigadier commands on papermc? using experimental
?whereami
I KNOW I KNOW just thought it'd be an ask but if its SPIGOT API only then i getchu (:
It's paper only API
๐ซก
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.
what's the best way to start making a custom procedural generated map / location generator? just try to mess around with perlin noise?
do you have any recommendations on perlin noise libs?
Haven't used any
Forge Hybrid ๐
with my database should I save to the database every time a value is changed or every 100 ticks or so
100% spigot
?nocode
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.
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
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);
- for loops exist, would recommend you take a look at those
- instead of getting the spawn location, try to use the vec you have ?
idk, never played with world creator
what will change if i use vector instead of getworldspawnlocation
where should I add this
#help-development message minibump
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
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
yeah itll throw an error if that player has never joined the server since its uptime
would offlinePlayer.getName ever be null or smt
web lookup from name is to fetch uuid
name can be empty though, if its not a valid lookup
but it threw null pointers earlier
impossible to NPE on getOfflinePlayer
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
?paste please
I spent 10 mins figuring out why my code didnt work and I missed a !
kek
definitely been there
caused an infinite loop and crashed the server after forgetting a ! in a do/while
that explains the hypixel outage
i never got to use do whiles ๐ฆ
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
I use them like every once and a million years
it wasn't on live! :(
you mean you're not testing on prod ๐
Sometimes!
smh my head
jesus choco
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..)
Does creating NPCs still involve sending Packets through NMS or is there any native thing for it by now?
Hey can you do something like this with Runnable like get a function inside the task?
you would need to create your own Task-Class which extends the BukkitRunnable
it still needs NMS/Packets or 3rd party apis
aight, thanks
not at all ... its just basic java
public static class BukkitRunnableWithTime extends BukkitRunnable {
@Override
public void run() {
}
public int getTime() {
return 10;
}
}
okayy i'm just dumb
then you create an object for this and run it with .runTaskTimerAsy...
thxx
how can i use this library
did you follow the tutorial on how to use ?
the tutorial is not clear
"git clone https://github.com/IPVP-MC/canvas.git
cd canvas/
mvn clean install"
i have it downloaded but
you added the maven dep
thats clear enough ^^
i dont think mvn commands will work on windows
you now need to reload maven
i have the files downloaded
you need to install maven or use the maven path that buildtools downloads
its on maven, you dont need to download it
its not on maven repo ^^ you need to install it to local maven repo
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
Yeah that library isn't hosted on a repo. It wants you to local install it
ah, ye do that
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
i dont think so
if you dont want to install it use the maven that buildtools downloads
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
nope
On a different computer maybe? Or a different version?
no this computer
intellij will have a bundled version
I guess you could open the project in IntelliJ and build it that way as well
just because intellij has a "private" or "local" installed version it can use
you can use where mvn to find any files called mvn
you need to compile it
how
by using the command it tells you to
compile it like a regular java ?
wouldnt the maven built into intellji not recognize the stuff the local repo by the maven you want me to install?
intellij bundles its own maven version, you can compile it with intellij using maven or you can just install maven
ur local repo is in the same place regardless of mvn install
how can i compile it with intelliji maven?
the same way you compile any other maven project in intellij
what shall i do with this
did you run the install goal
it is now in your maven local
Tech babble and other stuff

you need to .build();
remove the return thing on first line
remove the first line after function name
I recommend you learn java first
remove the .build() too
return menu; instead of last line
Something like this
public static Menu createMenu() {
Menu menu = ChestMenu.builder(1).title("Level").build();
// ...
return menu;
}
why is that deprecated?
everyone recommends them ๐ญ
getByKey()
lol
how do i do it with string
Registry.match
chat do i have to write all these lines for every single item i want to add?
yeah, if you dont make a better method for that
The data has to come from somewhere
sigh
.
I don't remember it using the default config values
without you telling it to do so
Enchantment ench1 = Registry.ENCHANTMENT.match(enchantment_name);
Enchantment ench2 = Registry.ENCHANTMENT.get(new NamespacedKey(plugin, enchantment_name));
like this? there is no match()
i dont get that solution, what plugin do i put there
why is this namespacedkey
NamespacedKey.minecraft
and enchantment_name will be just the same as the name of enum or different
Needs to match the internal name
because Enchantment.getByName() is deprecated because the names are bad
it's just the vanilla enchantment key
minecraft:sharpness, minecraft:unbreaking etc
/enchant @a <tab> for a list
do not enchant the salmon
thx
will cause lot of salmon grow packets
dw im making a joke
what do i do for the version?
also is it supposed to auto download?
nvm it magically works
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?
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
- Check Block Type: We check if the block is of type
IRON_BARS. If not, we exit the function early. - Get Block Data: We retrieve the block's
BlockDataand cast it toMultipleFacing, which allows us to set faces. - Set Connections: Using
setFace(), we set each specified side totrueorfalsebased on the given booleans. - 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.
EmilyGPT to the rescue
๐ช๐ช
this is a really great answer and explaination xD
What version? Using Java 21.
Ty
use the latest
Idk what that is lol
the latest version, the most recent one
Time for the thing called google
/chatgpt what's the latest lombok version
@EmilyGPT: How do I search for stuff on Google
EmilyGPT what's the latest lombok version?
It says 1.18.34? That's what I'm using?
1.18.34
I'm using 1.18.34
@dry hazel thoughts?
that was the problem in your maven setup, your gradle setup doesn't work because you don't have the dependency as an annotationProcessor
if you use maven just fine, why move to gradle?
Because people suggested it
probably for all the wrong reasons
bump
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
Ye but it seems easier?
in what way?
gradle is perfectly just as valid to use as maven
obviously its not if you are asking for tutorials and you already know maven
in what way is that easier?
It looks simpler and such
Know is a strong word
Indeed it is, just kind of countering the common troupes tossed around in regards to gradle
its not bad obviously if used right
and there is some things maven has that some people hail gradle for ironically too
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
how was it not correct?
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 -.-
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
and what error do you get when compiling?
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'
^
I'm using 1.18.34 tho?
you're using 1.18.28
clearly that line says otherwise
Oh what
I shall try this later when I'm back from classes. Thank you. I will update you
now do a clean cycle and then build
(slightly drunk)
someone is a light weight
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 ๐
Yuh
also your maven shade plugin is outdated and using scope system is generally not acceptable anymore
Is there any reason to make a shaded?
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
Just remove the <goal>?
o.O
remove the whole plugin section for maven shade
if you are not making use of shading
31-43
if you start at 21 you will remove the compiler plugin
and thus no compiling will happen ๐
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?
which is kind of the opposite of your goal currently
Oop yup
<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>
localhost would be localhost of the player
That ye
yep itry
Ty
but sometime it doesn't work
this is not correct
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
no, olivo was right there.
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
oh right, @chrome beacon sorry you are correct but the additional stuff I said still applies ๐
dat true 
Should work just fine
imma try on a local bungee and tell you after
edit: all work i'm just dumb
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
i know but i justwant to know more about the .transfer x)
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
i have a nonce of a user download
what shd i do ?
he leaked my plugin on a website
ban them from your resource and carry on paying no mind to it updating your plugin
how to ban tho
name the first varriable like inventoryEvent or e
call it something else
Which is why we've told you to learn java so many times now
my brain cell hit the wall
?paste
nevemrind, I can cancel the death event


