#help-development
1 messages · Page 971 of 1
bruh
delete line 21
private LuckPerms luckPerms;
private MiniMessage miniMessage;```
It causes errors
use plugin.getLuckPerms() where it errors
because thats supposed to be accessed via a setter
none are initialized
The error is User user = luckperms.getUserManager().getUser(player.getUniqueId());
yea we know
luckperms is null
u set it in ur main class but not in the chat class..
plugin.getLuckPerms().getUserManager()...
So I should remove everything after the = and rip lace it with what Elg said?
User user = plugin.getLuckPerms().getUserManager().getUser(player.getUniqueId());```
🥄 
Ok done
Spoonfeeding yummy
Should it work now?
I’ll test it
Anything else?
ElgarL, anything else should be added?
no
Ok boss
bro cannot distinguish between declaration and initialization
hope this isnt too ugly to read xD ```java
public Boolean setKeySeperator(Character keySeperator)
{
if (keySeperator == null) return false;
if (keySeperator.equals(this.settings.valueSeperator)) return false;
if (keySeperator.equals(this.settings.commentDeclarator)) return false;
this.settings.keySeperator = Character.valueOf(keySeperator);
return true;
}
why Boolean 
bro read my mind
returning if it was set or not
but boolean exists
why not primitive
no reason to not use primitive as far as i can see
i just wanted to keep it consistent since im also working with strings and primitive strings as char* do not exist
charAt(0) 💀
what
that doesnt make much sense
You don;t set any
At least I don’t get any errors in my console
you only change colour based on permissions
ah you do set PlayerListName
annoying that java doesnt have a built in ini parser, always json and xml..
Is that wrong?
which name are you trying to modify?
i mean. it does have .properties support
which is bassically the same thing
to display where?
ill check it
then add the prefix to the display name
To every else if statement?
this never sounds good to my ears
Yea I never use switch
and why is that
I want the ability to hear text too
and taste colors?
I prefer else if
the more branches you have the more overhead you get unlike with a switch
if you have a definitive amount of possibilities almost always use switch xD
or recursion
Execution failed for task ':compileKotlin'.
> Could not resolve all files for configuration ':compileClasspath'.
> Could not find org.spigotmc:spigot:1.20.2-R0.1-SNAPSHOT.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/maven-metadata.xml
- https://repo.maven.apache.org/maven2/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/spigot-1.20.2-R0.1-SNAPSHOT.pom
- file:/C:/Users/~/.m2/repository/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/maven-metadata.xml
- file:/C:/Users/~/.m2/repository/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/spigot-1.20.2-R0.1-SNAPSHOT.pom
Required by:
project :
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
import java.nio.charset.Charset
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.8.21'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
mavenLocal()
}
println Charset.defaultCharset()
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib"
compileOnly("org.spigotmc:spigot:1.20.2-R0.1-SNAPSHOT")
}
compileKotlin {
kotlinOptions {
//jvmTarget = "1.8"
//freeCompilerArgs += ["-Xno-param-assertions"]
}
}
jar {
destinationDirectory.set(new File("C:/Users/~~"))
from('resources')
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
I don't know what the problem is...
I've tried switching to 1.20, re-reading the manual and fixing it... I still get the same error.
Where did i go wrong?
run buildtools for 1.20.2
Yea I don’t always have so many else if statements
i stopped hardcoding most stuff anyways and write generic functions reading from config files
To every else if statements? In the brackets before ChatColor?
and theyre either plaintext like xml, ini or serialized
Oh nice
use a StringBuilder to save you repeating code
what was the recoomended api again?
the one someone released under MIT license which is an AST parser for mathematical expressions
forgot its name
Nah it’s not a problem to repeat, but im making sure the position of the prefix
Crunch?
that one
Before ChatColor?
there aint no way im writing my own ast parser xD
why not. its fun
well thats generally where the computer comes into play
and im not writing my own compiler either
but how do i explain the operations if i dont even know how the math behind it works because i dont understand the derivation
i mean surely you understand the basic math rules?
for the most part xD
it really is a fun challange to make a basic expression parser
though if u need something full fledged i would definately go with crunch
its very nice
and fast
i want to define constant strings with variable names and replace them at runtime with values
then feed them to the parser
yea ill prob go with that one
yea u can do that with an EvaluationEnvironment in crunch
more importantly i have default arithemetic operations that are always the same thus constant, and user input to add to that term
soo a custom function?
use evalex
thanks
hm
not entirely sure what u mean by this then
@eternal oxide Btw, Nop still doesn’t work
When I set PersistentData, is it only for that specific item, or for all items which are excactly like that item? (so same metadata etc)
okay, thought so, then something in my code just isn't working haha
thx for the help
if minecraft is able to identify new items why dont they make a way to identify duped items without giving up stacking items
looking for experienced dev need something good made
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
wrong channel
because difficult
dont have the effort to login their website
then how does minecraft identify each item for pdc
across restarts as well, there must be an identifier or smth
pdc is a little isolated container inside the nbt data of the item
ah
when an itemstack is duped, it's no different than calling new ItemStack and then adding on the same nbt data, ofc you could use that to identify duped items, but it'll be wacky with stackable items
would be cool if we had setStackable, ik this would break stuff but maybe we could also have getStack which returns the array of items in that itemstack
that's the thing though minecraft can't just identify new items
setMaxStackSize should work
crap i meant forceStackable
if u have 2 items with different pdc data but both r force stackable they would stack
that would not work out well tbh
there are so many logical what ifs I can't even start
that would require a complete rewrite on how the item system is handled
not just that too it would require a rewrite of how we identify items in hands too. It'd make detecting if a player is holding an item a literal nightmare
not really, they would only need to modify 'force stackable' items
no need to mess with the current item system
currently an itemstack is stored with an amount
that woulnt be possible
since nbt is potentially different
I don't think you're really thinking about how this would have to be implemented in NMS
Hello, I have a problem concerning plugin messages ( again... )
I tried getting the player count of a server, but it doesn't work well, it says there is 68k players online, + papi has errors in the console because of this ( i have the bungeecord expansion )
LISTENER
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] bytes) {
if(!channel.equalsIgnoreCase("BungeeCord"))
return;
ByteArrayInputStream in = new ByteArrayInputStream(bytes);
DataInputStream stream = new DataInputStream(in);
try {
switch (stream.readUTF()) {
case "PlayerCount":
PlayerCount = stream.readInt();
break;
}
}catch (Exception e){
e.printStackTrace();
}
}
SENDING
public int getCount(String server){
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try {
out.writeUTF("PlayerCount");
out.writeUTF(server);
} catch (IOException e) {
throw new RuntimeException(e);
}
getServer().sendPluginMessage(this, "BungeeCord", b.toByteArray());
return listener.PlayerCount;
}
u never wrote int here?
example of the bungeecord expansion:
switch (in.readUTF()) {
case "PlayerCount":
if (stream.available() == 0)
return;
server = in.readUTF();
if (stream.available() == 0) {
getPlaceholderAPI().getLogger().log(Level.SEVERE, String.format("[%s] Could not get the player count from server %s.", new Object[] { getName(), server }));
this.counts.put(server.toLowerCase(), Integer.valueOf(0));
break;
}
this.counts.put(server.toLowerCase(), Integer.valueOf(in.readInt()));
break;
in PlayerSwapHandItemsEvent, how do I get which hotbar slot I swapped with
I assume thats what the event does
just do enums at this point
for some reason when i try to strike lightning it just strikes it for a tick
entity.getWorld().strikeLightningEffect(new Location(entity.getWorld(), coords[0], coords[1], coords[2]));
Hi, I set the value of a NBT tag here:
container.set(Data.SUMMONING_MOB_UUIDS.key, PersistentDataType.STRING, "abc");
but when I try set the value again
ItemMeta meta = stack.getItemMeta();
PersistentDataContainer container = meta.getPersistentDataContainer();
String uuids = container.get(Data.SUMMONING_MOB_UUIDS.key, PersistentDataType.STRING);
if(uuids == "abc") uuids = String.valueOf(entity.getUniqueId());
else uuids += "," + entity.getUniqueId();
container.set(Data.SUMMONING_MOB_UUIDS.key, PersistentDataType.STRING, uuids);
stack.setItemMeta(meta);
I get a error
Caused by: java.lang.IllegalArgumentException: The found tag instance (NBTTagByte) cannot store String
?
solved
???
Use EntityDamageByEntityEvent and check if both are a player, if so then teleport the one who got damaged to the spawn location
when the y is <=80?
if you want to
hmm
?????
is there a way how to get the killer?
Entity#getKiller
That event would be too early for that
Use EntityDeathEvent then?
well, you just said this
You can't teleport in the death event
Respawn the player the next tick and then teleport them
Just get the damger in EntityDamageByEntityEvent?
or that ^^
and i do not want the player to be dead, i want to get the damager and if the damager equals "killer" and the player y <= 80 then telepor the player
depends on how much compatability you want
And check if the targets current health - event.getFinalDamage <= 0
aka it kills them
fourth ??
Hello, anyone knows how to send an action bar message to a player?
Player#sendActionBar
we're not paper tho
Player#spigot
Player#spigot#sendMessage with ChatMessageType.ACTION_BAR
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, component here);
and NMS in older versions :)
Make sure you're testing on Spigot
i am
what does /version say
1.20.4
what exactly does it say
That's not an output of /version
u want a pic?
yes
aight
hmm, i have tried it like this, but not wokring
there is nothint like player.getDamager
?
its event.getDamager
^^
You already have the killer
also that will cause an error when damaged by an entity that isn't a player
yes, but how to chesk it in the if ?
what is component here? shouldn't i put the message?
text component isnt a string
why does Entity#getKiller return a player, does that mean you can never get a zombie killer?
why killer.. i am not talking about killing
What are you talking about then?
Not from that method
They aren't tracked the same way players are, no
i do not need the killer... i just want to teleport the player if his y <= 80 and get lasthitted by damager
I read that as lastshitted
ooh alr
ty
I actually dont understand what you are trying to make
Why do you have the second part in your if statement
/ver isnt working
/version
hm.. its true, i do not need it i guess
but i need to know the last damager before the player teleport
The last damager is the damager in the event
true
Guys
So I got this problem, I still can’t see the LuckPerms prefixes I set, when I load my plugin
are you sure your world spawn is even set?
don't you need to run /setworldspawn
No
its set
Where do you think players spawn when you don’t run that?
they don't spawn at all
now what
Ah yes of course
its been 45 minutes
me?
but the problem is still with the teleportation
Yes
no
why void damage.. i do not need void damage
both strikeLightningEffect and strikeLightning die after a tick
They don’t even take damage in that video
How are you expecting the damage event to fire
Hello, I am making a minigame and I want to send different messages to players, my current system looks like
Classes:
SkywarsPlayer
- GameSendingMessageService
- ...other services related to players/games
(Some of the messages include calculating top 3 killers, or displaying new statistics to the player in chat and some of the messages are just 2-3 lines simple messages)
I am pretty sure it's a poor designing way and it could have been improved. In my GameSendingMessageService class I have 10-15 methods to send different messages (I attached the picture). What could I change to make the system more flexible and well designed? How do you usually do this?
i think he doesn't read what he's writing
well
RTX 4060 TI OMG
whats with that xd?
i have only 3060
you can see on the video, igor get hitted by entity and still doesnt teleported him
im on rx570 4gb 😭
👀
did you register the event?
Bro running a GPU from 20 years ago
yes
EntityDamageByEntityEvent only fires when a mob attacks another mob. you're checking if their location is <=80, which will only run while they are down in the void below and get hit by another player
You guys got graphic cards?
Mine is called intel integrated graphics
normal settings 32x texture pack
no 80 is not below void, he was also at Y 20 in the vid
You’d need to check the last damage cause if you want to handle the void damage
sorry for the ping. Do you know how to change the duration of the message?
u dont
sorry, saw void, still
u can spam send tho to make it longer
that event is not what you want to achieve this
since it will only listen for when the player first gets hit, not when they fall
Normal damage event -> check if lastDamageCause instanceOf entityDamageByEntityEvent -> check if the damage in said event is player
PlayerFallEvent and then if y is less than 80 :>
Or you can use the move event instead of waiting for them to take void damage
If you prefer
isn't there another vway
only for titles iirc
53 minutes have passed
how do teams work with scoreboards?
Not sure why the methods would be broken
teams != scoreboard
wdym?
yep, working, thx
now i need to check, if there was damager or not xd
Create a bug report with a minimum reproducible example if you can verify it’s a spigot issue
are you telling it to lightning strike for more than one time
thx guys
have you tried modifying the returned LightningStrike Object?
i tried to make it 15
the life ticks is only how long it will cause damage for
flashes is how long it displays
probably 1
docs says 1 to 3
holla i tried to set the value of a NBT tag then change it later
to originally set it i use this
container.set(Data.SUMMONING_MOB_UUIDS.key, PersistentDataType.STRING, "abc");
to change it i use this
ItemMeta meta = stack.getItemMeta();
PersistentDataContainer container = meta.getPersistentDataContainer();
String uuids = container.get(Data.SUMMONING_MOB_UUIDS.key, PersistentDataType.STRING);
if(uuids == "abc") uuids = String.valueOf(entity.getUniqueId());
else uuids += "," + entity.getUniqueId();
container.set(Data.SUMMONING_MOB_UUIDS.key, PersistentDataType.STRING, uuids);
stack.setItemMeta(meta);
thenn i get this error
Caused by: java.lang.IllegalArgumentException: The found tag instance (NBTTagByte) cannot store String
anyione know how i can fix this
that can;t be all the code
wym
SUMMONING_MOB_UUIDS(NamespacedKey.fromString("overcharged:summoning_cooldown_ultimate")),
this is the value
3 is max, so if you want it to strike longer you have to spawn is more than once
sorry 🙂
tfdym, adding 1 more wont make it from 1 tick lifespan to like a second
nah im being dumb sorry
If you want it to flash lightning for a second you have to fire it more than once
wouldnt that just create abunch of lightning bolts
ugh
thats how a lot of things in MC work, like sounds
well for whatever the damn reason skript's lightning works perfectly AND THEIR CODE IS THE SAME AS MINE
I think there’s a setLastDamageCause
it's deprecated lmao
my code: entity.getWorld().strikeLightningEffect(entity.getLocation());
their code: lastSpawned = l.getWorld().strikeLightningEffect(l);
and their code works
so its def not spawn abunch of lightning
thats impossible, i want to give the damager some items, so i need to reset it, bcs when player next falls on their own, there would still be the last damager right?
Yes
so i did some debugging
Also wdym that’s impossible
like i do not want it
Binary search time
what about using ResourceBundles
How do i turn on a redstone lamp?
getBlockData -> cast to lightable -> setLit -> setBlockData
do i seriously have to disable each plugin one by one to check
That’s what the binary search is for
i hate my life
wdym binary search
scratch this its the container#get t hat for some reason errors
im so confused
Disable half
If it goes away:
- switch to the other half and check again
- repeat process
if it does not go away: - repeat process
i always do that
congrats you invented binary search
anyways i found it first try
i should go try my luck with a lottery ticket before my luck is gone
Literally what I am describing
tried to be funny
Just play the sound
what is the sound
What is the equivalence between ticks and seconds?
1 second = ? ticks
20
1 second = 20 ticks
(By default)
basic knowlage
:v
knowledge*
I’m guess ENTITY_LIGHTNING_BOLT_IMPACT
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:67) ~[?:?]
at java.lang.Integer.parseInt(Integer.java:661) ~[?:?]
at java.lang.Integer.parseInt(Integer.java:777) ~[?:?]
at missing.plugins.turboenchants.enchants.Enchant.evaluateCondition(Enchant.java:666) ~[TurboEnchants-1.0.jar:?]
at missing.plugins.turboenchants.enchants.Enchant.evaluateAction(Enchant.java:146) ~[TurboEnchants-1.0.jar:?]
at missing.plugins.turboenchants.enchants.Enchant.call(Enchant.java:118) ~[TurboEnchants-1.0.jar:?```
what in the world in spigot drinking
"2" is a number
"2.0" is not an integer
oh shit im parsing int
who split numbers to be double and int 😭
just make it one number class that support both
Computers
computers only understand binary, binary can be converted to decimal directly
not integer and decimal
What
java can just compile '3' as 3.00 and '3.69' as 3.69
whats that supposed to mean
performance?
floating point precision goes brrrr
your questions dont make sense at this point
it does
I can’t think of any language that doesn’t separate floating point and non floating point
python
JAVASCRIPT
there was a time we didn;t have FP processors
Those are both weakly typed
and java isn't?
holla i tried to set the value of a NBT tag then change it later
to originally set it i use this
container.set(Data.SUMMONING_MOB_UUIDS.key, PersistentDataType.STRING, "abc");
to get the current value
ItemMeta meta = stack.getItemMeta();
PersistentDataContainer container = meta.getPersistentDataContainer();
String uuids = container.get(Data.SUMMONING_MOB_UUIDS.key, PersistentDataType.STRING);
thenn i get this error
Caused by: java.lang.IllegalArgumentException: The found tag instance (NBTTagByte) cannot store String
anyione know how i can fix this
good ol time with bcd
No lol?
at least u dont need to call THREE methods / fields for a simple print
?
thats type erasure mate
System.out.println
^ ^ ^
Oh no
lol
println in kotlin
system is a class, out is a variable
doesnt count
could static import System.out and now you have two
we have kotlin for that
doesnt count
its not a huge deal until u have a 100 line method and u need optional args
have fun dealing with that
just write your own lang
?
wouldn't be an issue in kotlin
Its not really a huge issue in java
this is a java argument not a kotlin argument
as in the reflective approach?
wouldn't be an issue with kotlinx.serialization
lucky you that you arent using c
u cant make an object without calling the constructor
which makes it pain to serialize
so what
unsafe doesnt mean its unsafe
wouldn't be an issue with datafixerupper
it means that it isnt made fool proof for idiots
Java is used quite a lot
in?
Intellij ? XD
Backend systems
Believe it or not code is used for more than just games
^^
🤯
no way
lies
Java isn't exactly used for frontend stuff
dead srs?
Binance's entire backend is made in java p sure
but yeah it is also used for (kinda legacy) android dev
There's vaadin for frontend
since kotlin is mainly used for mobile dev now
which is good
since multiplatform is really enjoyable to work with
https://www.spigotmc.org/threads/raycast-returning-incorrect-multiple-blocks.644537/
^ need help and it’s a lot so I’m just sending link, here’s a quick rundown…
“For the people who don't watch the video, when looking straight up in the air and tracing a ray from the players eyes, it will return that result.getHitBlock().equals(block) stating that the block that was being broken is the same one the ray was looking at.”
oh wait this is supposed to be a helping channel
yes...
cough
cough
cough
generate the bytecode
if (block.getType() == Material.AIR) return;
I don't think it would have anything to do with this but that's the only thing I can think of since the player is looking in the air
Reel
there are differnt types of air
??
Material::isAir
Huh 😭
What
null
There are different materials
There’s 3 airs
cave, void and normal iirc
wtf is cave
And is void all of the air under the void or is it the air section that you take damage from? Probably the second one
If you don’t understand it just watch the video
Wait the video didn’t process bruh
Here’s the video showing the issue^
Well here v
Soon
😭
Brooo
Hello, I've got an error with my BlockPopulator code:
public class RocksPopulator extends BlockPopulator {
@Override
public void populate(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ, @NotNull LimitedRegion limitedRegion) {
if(worldInfo.getEnvironment() != World.Environment.NORMAL) return;
int randomX = (int) (random.nextDouble()*16*chunkX);
int randomZ = (int) (random.nextDouble()*16*chunkZ);
int perfectY = limitedRegion.getHighestBlockYAt(randomX, randomZ);
System.out.println("chunkX " + chunkX);
System.out.println(randomX);
System.out.println("chunkX " + chunkZ);
System.out.println(randomZ);
System.out.println("perfectY " + perfectY);
Switch button = (Switch) Material.STONE_BUTTON.createBlockData();
button.setFacing(BlockFace.UP);
limitedRegion.setBlockData(randomX, randomZ, perfectY, button);
}
}```
Do someone know how to fix that?
clazzhas been used in Java in place of the reserved word "class" since JDK 1.0. "class" is what you want, but abbreviating or inserting junk ("a", "the", "_", etc) reduces clarity. clazz just says class. "International" English speakers (those reading both British and American English) are used to transposing 's' and 'z'.
Oh kk
“For the people who don't watch the video, when looking straight up in the air and tracing a ray from the players eyes, it will return that result.getHitBlock().equals(block) stating that the block that was being broken is the same one the ray was looking at.”
Here we go the video loaded
interfaces or interfaces-kotlin for kotlin
Dont apply illegal values on your BlockData. Just as the error suggests in plain english.
I don’t think they know where or what the illegal value is
exactly
setting in a LimitedRegion you shoudl use relative coords
what's the formula for relative coords?
I'm so sorry 😭
Bro omg wrong dang video
lmfaoo
what is illegal value?
It's just a switch blockData?
Anyone know this issue?
“For the people who don't watch the video, when looking straight up in the air and tracing a ray from the players eyes, it will return that result.getHitBlock().equals(block) stating that the block that was being broken is the same one the ray was looking at.
if (block.getType() == Material.AIR) return;
I don't think it would have anything to do with this but that's the only thing I can think of since the player is looking in the air”
a LimitedRegion is 0-15 +/- getBuffer()
of the LimitedRegion
yeah
Use setAttachedFace not setFacing
“
if (block.getType() == Material.AIR) return;
I don't think it would have anything to do with this but that's the only thing I can think of since the player is looking in the air” 😭
that too, for your other error (coll's post)
okay thanks
Any exceptions in console?
Nope
how can I do a plus minus?
For the rest of the code it’s here: https://www.spigotmc.org/threads/raycast-returning-incorrect-multiple-blocks.644537/
It should. If you ray trace and hit nothing, then your result is null
um, math!?
a Chunk is 0-15 size, then a LImited region has a buffer around it of x size
yeah but, I've learned sinus, cosinus and tangent this year, sooo for more advanced math...
Ok. In my code, I have if (result != null && result.getHitBlock() != null && !result.getHitBlock().equals(block)) { // ! Right here is the issue !
Btw I’m guessing that’s the issue
Most likely is
ok, get a random between -getBuffer() and 15+getBuffer
Omfg
oh okay thanks
I mean, the buffer is there for big things
I’m so stupid lmao
You should only get a random from 0-15
true
The other chunks will have their own calls of the populator
Thank you! It was because I was making sure it wasn’t null
Bro someone add a Minecraft heart emoji 😭
Hey where can I find the docs?
you are only placing a single block so no need to cross chunks
?jd-s
Ty
I thought it was ?docs or slt
Ima spend half my life reading it so I can quit when I get into plugin dev
based
I’d like to recommend ChatPaginator
Already getting the urge to quit
No real need to learn the javadocs. The search box top right is your best friend
holla i tried to set the value of a NBT tag then change it later
to originally set it i use this
container.set(Data.SUMMONING_MOB_UUIDS.key, PersistentDataType.STRING, "abc");
to get the current value
ItemMeta meta = stack.getItemMeta();
PersistentDataContainer container = meta.getPersistentDataContainer();
String uuids = container.get(Data.SUMMONING_MOB_UUIDS.key, PersistentDataType.STRING);
thenn i get this error
Caused by: java.lang.IllegalArgumentException: The found tag instance (NBTTagByte) cannot store String
anyione know how i can fix this
(sorry for ping, I recheck my code)
@eternal oxide, I get Coordinates 24, 22 are not in the region for java int randomX = randomBtw(random, -limitedRegion.getBuffer(), 15+limitedRegion.getBuffer()); int randomZ = randomBtw(random, -limitedRegion.getBuffer(), 15+limitedRegion.getBuffer());
And same for chunkX + rdm, chunkZ + rdm...
is there a way to set specific permissions to a player? like i set the permissions in the plugin.yml like this:
https://pastebin.com/8qJPg6rT
i want that one player can have the permission command.settings how can i set the player permission for that.
here is the code how i try to set the permissions:
https://pastebin.com/MZeLK4kp
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Code seems fine?
But i can‘t use the command when im not op
You might have to refresh commands?
Hello, I get Coordinates 24, 22 are not in the region for java int randomX = randomBtw(random, -limitedRegion.getBuffer(), 15+limitedRegion.getBuffer()); int randomZ = randomBtw(random, -limitedRegion.getBuffer(), 15+limitedRegion.getBuffer());
Please, Is there a way to fix that?
Read the docs
okay thanks
so without buffer?
I'll not send you what they'll send to you
Idk about regex sorry
just parse manually 💀
How do I make a scoreboard that can update its values? Like player health for example
There’s a performance impact on my eyes
multiverse incident 2021
🤣
public List<String> parseWords(String input) {
List<String> list = new ArrayList<>();
int startIndex = 0;
for(int index = 0; index < input.length(); index++) {
char character = input.charAt(index);
if(character == ';') {
list.add(input.substring(startIndex, index - 1);
startIndex = index;
continue;
}
}
if(startIndex < input.length()) {
list.add(input.substring(startIndex));
}
return list;
}
close enough
blinks/sec
Same error, Coordinates 27, 42 are not in the region
int randomX = randomBtw(random, 0, 15)*chunkX;
int randomZ = randomBtw(random, 0, 15)*chunkZ;```
How can I fix that please?
I think this isn't the good formula, but I can't find the good one
full code : https://paste.md-5.net/apehijotat.java
If anyone knows 🙏
because only 0-15 is not working (logical), I think I need something I forgot
See you tomorrow for help 🫡 good night everyone
holla i tried to set the value of a NBT tag then change it later
to originally set it i use this
container.set(Data.SUMMONING_MOB_UUIDS.key, PersistentDataType.STRING, "abc");
to get the current value
ItemMeta meta = stack.getItemMeta();
PersistentDataContainer container = meta.getPersistentDataContainer();
String uuids = container.get(Data.SUMMONING_MOB_UUIDS.key, PersistentDataType.STRING);
thenn i get this error
Caused by: java.lang.IllegalArgumentException: The found tag instance (NBTTagByte) cannot store String
anyione know how i can fix this
not sure, code looks fine
are you sure you arent setting it somewhere else also
if that really is all the code, create a test plugin and open a bug report
I know with the server version of minecraft the minimum java version is 21 but does this apply to plugins as well?
Cool thanks!
how do i make a hover and click in the middle of a message using bungee components
so like
nvm idk how to do an example for this lol
3 components
Is there a good way to hide the text on the scoreboard that comes from registering a new team on a line?
Team line = scoreboard.registerNewTeam("" + i);
Because right now I have the index numbers from my foor loop next to my text. I do not want any text related to the for loops at all on the scoreboard, but I need to have the index there to see what line it is.
👍
how do i get above?
y + 1
Block doorBottom = YourSource;
Location doorTopL = doorBottom.getLocation().clone().add(0, 1, 0);
Block doorTop = doorTopL.getBlock();
Is there a good way to hide the text on the scoreboard that comes from registering a new team on a line?
Team line = scoreboard.registerNewTeam("" + i);
Because right now I have the index numbers from my foor loop next to my text. I do not want any text related to the for loops at all on the scoreboard, but I need to have the index there to see what line it is.
is anyone familiar with luckperms?
Yes
Why can I not get the default commands like /me, /tell, etc to work on my default rank?
well, for starters I just added: minecraft.command, minecraft.command.help, minecraft.command.tell, and minecraft.command.me to see if they'd work and which they don't when applied.
It just pops up saying "Do not have access to that command".
I have the prefix and everything set
try to look at the web editor and double check everything
also I think this is supposed to be in #help-server
I figured development, since i'm developing my server atm. but idk, all this channel topic stuff is confusing. It's spigot related technically lol
ye ik lol
sometimes can be hard to understand
basically #help-development is for making plugins and #help-server is for plugin help
accept my friend req
cause u have essentials
anyone know why this is happening?
nvm im just gonna use adventure
Only reason it's doing that is because you're toString()ing the component instead of sending it as a component
Is there a good way to hide the text on the scoreboard that comes from registering a new team on a line?
Team line = scoreboard.registerNewTeam("" + i);
Because right now I have the index numbers from my foor loop next to my text. I do not want any text related to the for loops at all on the scoreboard, but I need to have the index there to see what line it is.
new BukkitRunnable() {
int CurrentLength = 0;
@Override
public void run() {
for (Entity victim : world.getNearbyEntities(ParticleLoc, 5, 5,5)){
if (victim instanceof LivingEntity){
if (victim == player) {
continue;
}
Vector particleMinVector = new Vector(
ParticleLoc.getX() - 0.25,
ParticleLoc.getY() - 0.25,
ParticleLoc.getZ() - 0.25);
Vector particleMaxVector = new Vector(
ParticleLoc.getX() + 0.25,
ParticleLoc.getY() + 0.25,
ParticleLoc.getZ() + 0.25);
if(victim.getBoundingBox().overlaps(particleMinVector,particleMaxVector)){
((Damageable) victim).damage(10, player);
this.cancel();
return;
}
}
}
CurrentLength ++;
if (CurrentLength >= finalTotalRange) {
this.cancel();
return;
}
ParticleLoc.add(dirOffset);
world.spawnParticle(Particle.FIREWORKS_SPARK, ParticleLoc,0);
}
}.runTaskTimer(RandomRoomGen.getPlugin(),0, 0);```
how do i make that run instantly
im sorry if thats a stupid question but i geniuinly dont know
runTask ?
Is the location object the same mutable as the player object?
this will be bad if i will save location in some object class?
I don't understand
player extends Object like every class java has
does anyone need a plugin made im bored asl 😭
chatgpt yourself some ideas
can i somehow force player to press f3+d?
Nope
:(
Debug is 100% client bound
Just send 30 empty messages
about that
for (Player player : Bukkit.getOnlinePlayers()) {
System.out.println(player.getName());
player.sendMessage(color(message));
}
when im doing this
its spamming console too
and broadcast method doesnt work for legacy color codes
Maybe it's the color
System.out.println(player.getName());?
What's with the sout?
that will print to conosle
just trying to debug
i know
and just use Bukkit.broadcastMessage
When you send a message to a player it can't send it to the consoke too
if you're gonna send to all
Client doesnt accept null/empty strings
ah
Add a space
??
It works
where
In the message
in the color() method?
Add &f to empty message
Player send message (" " )
ok ill try
well its still spamming in console
Bukkit.broadcastMessage(" ");
this one
for (int i = 0; i < 600; i++) {
Bukkit.broadcastMessage(" ");
}
nvm fixed
Thoughts on passing a plugin to a constructor vs calling an internal method whenever the object is registered?
wat
does 2nd one inject plugin using reflections?
or if using a resource pack, you can create a custom character with an empty bitmap which is huge and "clears" the chat
Hello, I'm making a plugin in 1.20 and I was wondering if it was possible to make custom enchantments or if I really had to use PersistentDataContainer?
You cant exactly "Make enchantments"
You have to add the lore, yourself
usualy, you can read the lore, to confirm what enchants the item has
ok and to store the enchant I need to use PDC
How I can remove the italic text effect on the lore ?
how can i pin a line in inteliJ ultimate?
how can i jump to them?
Use '§r' then '§e' I think
§r = Reset
§e = Yellow
searching for files can be time consuming
heh? crtl-n?
Why can't this code teleport?
where are you calling that
uh not sure
Is the location printed as intended? Maybe a plugin is blocking the teleportation
I miss the bird
public String toString() {
return "x = " + x + "; y = " + y + "; z = " + z + "; yaw = " + yaw + "; pitch = " + pitch + "; world = " + world + "; server = " + server;
}```
``` public Location getLocation(){
return new Location(getWorld(), x, y, z, yaw, pitch);
}
i checked player, and it's not null
You would have a NPE in that case
My bets are that some plugin is blocking PlayerTeleportEvent if the console is clear
wth, I tried it via tp and it works.
player.performCommand("execute in minecraft:overworld run tp @s " + sL.getX() + " " + sL.getY() + " " + sL.getZ() + " " + sL.getYaw() + " " + sL.getPitch()); like
but this option doesn’t suit me, how can I do it through Player#teleport?
Seems like world is the issue then?
Listen to PlayerTeleportEvent with MONITOR priority and check whether it is cancelled
Guys, In PlayerDeathEvent#getPlayer() returns player that died, and PlayerDeathEvent#getEntity()returns entity that killed player?
No, they're both the player that died
it doesn't output anything.
Ye. I've also discovered that. I've read that Player#getKiller() will work?
Are you in a vehicle (horse, minecart ...)?
no
yeah that will get the player's killer
Okey, thanks
yw
That is weird then. #teleport only returns false if:
- You are dead / don't exist anymore
- You have no connection (NPC)
- You are inside a vehicle
- The PlayerTeleportEvent got cancelled
ignoreCancelled ?
Update your java & buildtools
ya
I'll probably need to create a command for something like this, do it via performCommand, and give permission at the time of use
still same problem after updating. The gui one gives the same error on startup
Are you talking about this? I'd have taken the time to check which of the conditions I have listed actually causes it. But if you still want to go that route, you may also try to use Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "..."))
Although I am not very sure how well that works with vanilla commands
Download and install java 21 or 17
those don't work for 1.15.2
1.15.2 is a very odd version to use, why specifically that one? If you still want to use it, copy and google the second line of the error message
Although they should work with java 17 just fine, I believe?
nope
i double checked i dont change that nbt tag or get it anywhere else apart from one function which has the same code so where do you make bug reports
Hello, I want to place buttons on the ground, how can I rotate them in different direction, while still being on the ground?
They are actually like that:
lol, even if I use command - it still not teleport
And I want them to be in both direction, like that
(I'm using Switch for BlockData)
Fun thing
display entities can be rotated with yaw and pitch
on top of their rotation matrixes
this is such an awesome api feature
because the rotation is a pain to figure out without axiom
you say that for me?
what would i use reflection for?
accessing net minecraft server classes
why would i need that tho
editing minecraft at the root basically
adding mob, editing AI, adding biomes...
oh alr thanks
Could someone help please
.
You aren't limited to just NMS with reflection. You can call methods by just their name and the class' name, or you can get/set variable values just by their name, even when they're private, etc. Reflection is a compile-time unsafe coding tool
I personally use it to parse my locale files. I go through every message key and match it to a variable name in my Messages class
please help 😦
thank you
why are you even making that command tho
so it doesn’t matter whether through or without them - the same thing.
Are you using spigot/paper or some other fork? Maybe it has some built in feature
paper
am i allowed to ping?
What are you trying to do?
upon receiving a message from velocity, teleport the player to the point that was received. I get the correct location and the player is normal. But for some reason Player#teleport does not work
checked via Player.performCommand("execute in minecraft:overworld run tp @s x y z yaw pitch") - works there.
So performing the command works but teleporting the player via code doesnt?
It only works through vanilla /tp, but not through mine. The problem is in Player.teleport()
That sounds weird. Do you get an exception when you call teleport? What happens?
i have no errors
Show your code and debug it
?paste
Do you have a sneak peek into how you do this?
https://paste.md-5.net/ebucakufit.java - MessageListener
https://paste.md-5.net/jesosijaxo.java - VelocityMain
https://paste.md-5.net/kixejayosa.java - VelocitySpawnCommand
ServerLocation is not null, and has valid data. Player is not null, because I don't get NullPointerException
and the player is definitely not dead, and not on the entity
Print out sL.getLocation()
Hm. Try teleportAsync() instead
sounds like a paper method
The only thing that comes to mind if this doesnt work is someone cancelling the teleport event
still doesn't work
how can I check this?
Just asking, where is the ServerLocation class from?
Listen to the teleport event with MONITOR priority and check if the event is cancelled
So you are telling me that you call Player#teleport(Location), and there is no exception, nothing is happening on the server and the event isnt fired?
When are you sending the message from velocity to the server?
Yes, a debug message appears in the logs, but Player.teleport() will return false if checked
after the player has fully logged in. ServerPostConnectEvent
?jira
Probably a custom one

So... the player isnt even properly spawned on the server yet.
sigh
the only event after which at least a message is sent
I tried it through ServerConnectedEvent, and it still doesn't work
ty
I tried to make a delay, launched teleport a second after the message arrived
I should have asked what your initial intent was...
Ok here is what you do:
Before the player connects, you send a PM to the server he is connecting to.
The server then stores this in a Map<UUID, ServerLocation>.
Then you listen for the PlayerSpawnLocationEvent, get the location from your Map, and set the Location in your event.
I was told that I cannot send a message if there are no players on the server, so I first throw the player there, and then send teleport messages.
Is this for a public project?
only for my server
Why do you need the proxy to tell the mc servers where to spawn a player?
I have two separate servers and need to create a way to move between them. For example /home, /tp, /warp, ...
For example, spawn is in Locations, and survival is in Kingdoms. and I need /spawn
if there was Player.teleport in velocity it would be easy, but otherwise I have to worry about messages
Ok, i personally would just use Redis for this because communication through the proxy sucks big time.
But you need to send the message from your proxy to the server before the player spawns but after he is connected.
Then listen for the PlayerSpawnLocationEvent and set the location there. Dont call player.teleport() for this.
Does anyone know how to create an NPC when you right click the NPC it will open a gui, with a bunch of multiple quests, like "deliver 30 stone blocks" "deliver 8 diamonds" etc when you're done with all of them you can rankup
with bossshop plugin maybe? if its possible
Seems like #help-server question
I was told about using Redis, RabbitMQ, but I have no idea how to work with it. Not only are there 0 guides about Velocity, but even more so about using them with velocity.
Doesnt matter what you use Redis with. Its the same for any java application.
Create one Redis client for your application when it starts:
RedissonClient redisson = Redisson.create(config);
Subscribe to a certain topic on one application:
// Get the topic
RTopic topic = redisson.getTopic("teleports");
// Register a listener on that topic
topic.addListener(String.class, new MessageListener<SomeObject>() {
@Override
public void onMessage(String channel, String message) {
//...
}
});
Send messages to the topic from another application. Everyone listening on this topic will receive the message:
// Get the topic
RTopic topic = redisson.getTopic("teleports");
// Send a message to the topic
topic.publish("Hey there. Everyone gets this.");
Its literally like this for any java application. Doesnt matter if its a web server, Velocity or Minecraft.
Hello, how can I do a BlockPopulator before tree generation?
What do you need this for? I think you might need to change the order of populators since trees are also generated using a BlockPopulator.
I need this to generate some stone buttons at the ground, but when there is a lot of trees, the highest block is often a leaf, so I want to avoid that by populating with stone buttons before trees instead of checking the root of the tree and place a button next to him or something like that
It'll be much faster
I would def argue that scanning an entire tree to find their root is way, way slower than just going from the highest block downwards to check where the ground starts.
- Get the highest block
- Check if its leaves
- Iterate down until you hit the ground (Maybe stop early at 60)
- Place a button
yeah I though of that too
well, let's do that
I might ask for more help later with optimization btw
PS you can also just use a normal Database that isnt Redis for this.
Just write to the DB, wait until its done, connect the Player to the other server, read the value in the AsyncPlayerPreloginEvent into a Map
and use this value in the PlayerSpawnLocationEvent
Velocity doesn't seem to have a regular driver for MySQL
Velocity doesnt need to interact with your DB for that
like, create command in bukkit plugin, and everything else through velocity, and then back?
wait, teleport didn’t work there for me, even if I was already on this server.
This is all really convoluted. You might also just shade a sql driver in your velocity plugin.
And to use Redis, do I also need to host it, just like hosting a database?
Guys, I need help. Is there any way to retrieve Potion's duration from ItemStack? All I got so far is getting PotionMeta but this doesn't give any way to retrieve duration. I've tried potionMeta.getCustomEffects() but this is just empty
That means it has no custom effects use get the potion type
You'll need to manually do getPotionEffects on that and grab the duration
PotionMeta ->
getBasePotionType() -> PotionType
getPotionEffects() -> List<PotionEffect>
Then check duration and amplifier from those effects
PotionMeta.getBasePotionType().getPotionEffects().forEach(effect -> {
int ticksDuration = effect.getDuration();
});
Oh, I've must missed that. Thanks guys ❤️
i have a feature that places a 3x3 area of farmland and crops on top whenever a player places a farmland block.
It works fine but i have different unlockable crops and a few of them are corals: Whenever a player places farmland the corals on top will spawn but the center one will break instantly. Does anyone know how i can fix that? I can send a video via dm if you want
yo does Server#addRecipe() conflicts with other plugins?
because for some reason my plugin's custom crafting recipe wont work if there's another plugin that also uses Server#addRecipe()
As long as your recipe has a unique key it should be fine
It does tho. but why is the crafting output not showing
whenever there's another plugin that is using that method
so, I sent in #1100941063058894868 this 👍 thanks for your help (and time!)
Sounds like the other plugin might just remove the recipes
Hello, is block PDC (by mfnalex) available on world population (with BlockPopulator)?
no as it uses the chunk not a LimitedRegion
okay thanks
you can;t use teh Chunk before it's populated
then I'll revert what I want to do
What are you trying to do?
Why do you need a persistent medium while generating anyways?
check if a stone button is a rock (so a block placed on world gen) and if it is, then I don't drop it on break
so I'll invert that, and make the button without PDC and the buttons placed by players have a PDC
but, for compatiblity...
so, any idea?
Invert it or store the block in memory and only use the PDC when a chunk is (un)loaded
let's invert it then
thanks
does this give support for skript addon development or spigot only
goddamn it
This is what you get when asking for skript support
not skript support, skript addon development support
the same
get the hell out of ere
How i can add the enchant glowing effect on a item without necessarily enchanting ? (1.20)
I'm kinda confused at the java.lang.reflect.Proxy class
cuz I thought I'd be able to intercept method invocations on an instance
but it ain't that simple
it just creates an instance on a set of interfaces and it delegates to you the method calls, that's all
Only possible by adding an enchantment to the ItemStack and then hiding it with the enchantment hide flag
or by waiting until 1.20.5 comes out
or adding a null enchant
(i think it gets removed on server restarts)
or by setting the enchants list in nbt to an empty list
same thing
I don't get the list of classes thingy
PS: Laplace transforms > Euler-Lagrange for second order differential equations imho
where do i get the upcoming stuff like knowing that in 1.20.5 there'll be an option to force glint
and how i hide the enchant ?
by reading mojangs changelogs?
they publish one with every snapshot/pre/rc/release
im reading em rn
or in the Minecraft wiki for 1.20.5,
there isnt anything abt glints
There is an ItemFlag you can add to your ItemMeta. Something ItemFlag.HIDE_ENCHANTS
like will it delegate the call to my interceptor to all instances created of the classes I give?
yes there is, with the whole item components changes
I've just been thinking, I'm just stupid I'd forgotten x), thx
no, all it does is it creates a class that implements the interfaces you give it, and your invocationhandler will be given all the method calls
1.20.5
what the fuck is a vault
just disable it? it's in your client lol
iirc
by that logic everything can be disabled in ur client, why code a minecraft plugin
what if I just wanted to intercept the calls to a singular object instance and delegate it to the original source if it isn't the method I want
u can hide unbreakable yet there's still an itemflag
?
internet says ByteBuddy
but it'd enlarge my plugin quiet a bit
of some random existing object in some random variable somewhere? no
this week
variable
oh no
Proxy is only useful for interfaces, you'd have to replace a field somewhere
I can do that