#help-development
1 messages ยท Page 261 of 1
yes and no
in spigot, no
but I wrote a library for that
google "CustomBlockData"
Particles were in the effect enum in 1.8 https://helpch.at/docs/1.8.8/
Uh idk why it doesnโt link
No thnx i'm making my own system ๐ but i ask just to see if better way exist
buw how are you going to send it to a player in 1.8?
.playEffect
oh ok
checkmate
not that I'd ever need it, but good to know ๐
no u
The fact is that when i type it it says
void org.bukkit.entity.Player.playEffect(Location arg0, Effect arg1, int arg2)
The method playEffect(Location, Effect, int) in the type Player is not applicable for the arguments (Location, Effect, int, int, float, float, float, float, int, int)Java(67108979)```
obviously it takes one location, one effect, and one int argument
yeah ofc
But when i fill it like this
Deprecated
you are supposed to use the generic method
this one
which particle are you trying to send?
try to use null for the data, it should work for most particles
Oooooh
Wait
Ok
i'm trying to send this
playEffect(new Location(player.getWorld(), x+x_, y, z+z_), Effect.COLOURED_DUST, 0);
hm ok can you open the Effect.COLORED_DUST thing in the decompiler? then check which data type it requires
idk in intellij it's ctrl+b when your curser is on COLOURED_DUST
COLOURED_DUST(0,null), is this wxhat u asked for ?
wheres @river oracle when you need him
colored dust does not require any data type
you just do player.playEffect(someLocation, Effect.COLOURED_DUST, null)
he's in my basement
is your boyfriend in the basement
no I think he's at home
is home not your basement

and then he'll probably keep playing gta 5 the whole day
sounds like he loves ur computers more than you
that's reasonable, I got 5 computers
well a desktop, a mac mini, and 3 macbooks lmao
macbooks are shit
And if there are particles that requires data type, I'll just replace null by random integers until i get what i want ? x)
Like 0, 1
nooo
no, they are made by like steve bobs or something
and they run macos
you gotta replace it with the correct data type ๐ for example Material
where do you see this ?
Omg sorry i'm so annoying
Oh in the javadoc ?
you can check it using Effect#getData()
I only added the correct datatypes to the javadocs in 1.18 or so
so in all older versions, they are not in the docs
Ok thanks a lot
you should be able to open the Effect class from within VSCode
then you can just check what data class a given effect requires
but I have no clue how, I only use intellij
in intellij it works like this
oh this shitty windows screen recording thing doesn't show the right-click-menu
Alex do you linux linux
what a fucking jerk
wtf is linux linux
ok and you forgot to insert a verb
does it at least go to grub?
Yeah
and what happens then?
Its just on a black screen with the typing cursor flash thing
it doesn't even prompt for login credentials?
Nope
how long did you wait?
Its been like this for a minute or 2 by now
can you actually enter anything there?
Nope
then wait for another 5 minutes lol
Okay
Try opening the terminal if you can, (ctrl alt T I believe?)
if that still doesn't work, enable the debug output in grub
usually you get a prompt with Ctrl+X or F10
or you can go through all /dev/tty's with Ctrl+Alt+F1 etc
I should probably update my mint, I am still on 19 or 20
I still got a debian 7 VM running on proxmox ๐
I just realized I haven't updated my server in over a year, well should be fine. It's runing ubuntu server 20.04
Think so ๐
does it run openssh 3?
because if so, you should definitely update it RIGHT NOW
if you're still on openssh 2, then no problem
Eh should be fineee
do sshd -V
Who even has their ssh open 
people who want to connect to their servers?
Will look later
I got a 2.69โฌ vps as ssh jump host, and that's open to everyone ofc
well only with key file ofc
and all other servers are only open to the IP from the jump host
so I usually have to go through 3 logins to connect to a vm lol
ssh jump, ssh proxmox, ssh <someVm>
hello everyone, i'm altering a spigot plugin to include glow squids and i need help figuring out this error...
error is that it can't tell what are GlowSquid and GLOW_INK_SAC
even though glow squid is defined like this:
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/GlowSquid.html
and glow squid ink is defined like this:
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html#GLOW_INK_SAC
i don't have a spigot account so i can't attach an image but i can provide more detail if necessary
please tell me why this error๐
send your code
it's an edit of this plugin: https://www.spigotmc.org/resources/milk-squid.84557/
public final class MilkSquid extends JavaPlugin implements Listener {
@Override
public void onEnable() {
this.getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onInteract(PlayerInteractAtEntityEvent event) {
//if entity is neither a glow squid nor a squid, return
if (!(event.getRightClicked() instanceof GlowSquid)) {
if(!(event.getRightClicked() instanceof Squid)){
return;
}
}
if (event.getHand() != EquipmentSlot.HAND) {
return;
}
Player player = event.getPlayer();
ItemStack item = player.getInventory().getItemInMainHand();
if (item == null) {
return;
}
if (item.getType() == Material.BOWL) {
//if entity is a glow squid
if(event.getRightClicked() instanceof GlowSquid){
if(player.hasPermission("milksquid.glowinkbowl")){
player.getInventory().addItem(new ItemStack(Material.GLOW_INK_SAC));
player.playSound(player.getLocation(), Sound.ENTITY_COW_MILK, 1f, 1f);
}
//if entity is not a glow squid but is a squid
}else if(event.getRightClicked() instanceof Squid){
if(player.hasPermission("milksquid.squidinkbowl")){
player.getInventory().addItem(new ItemStack(Material.INK_SAC));
player.playSound(player.getLocation(), Sound.ENTITY_COW_MILK, 1f, 1f);
} else {
player.sendMessage("You do not have the glowinkbowl permission");
}
}
}
}
}
and the errors:
16.12 11:09:25 [Server] [ERROR] Could not pass event PlayerInteractAtEntityEvent to MilkSquid v1.0
16.12 11:09:25 [Server] [INFO] java.lang.Error: Unresolved compilation problems:
16.12 11:09:25 [Server] [INFO] GlowSquid cannot be resolved to a type
16.12 11:09:25 [Server] [INFO] GlowSquid cannot be resolved to a type
16.12 11:09:25 [Server] [INFO] GLOW_INK_SAC cannot be resolved or is not a field
I've done this before
It's a fucking pain :)
It's much easier to just send additional block packets
That smells like you are running the server on an old version that does not habe glow squids yet
server is paper 1.19.2
we have found glow squids in the overworld
mans didn't put api-version on the plugin.yml
That shouldn't fuck them up for the entity type tho
is there a way that what went wrong is in the original code of the plugin? i haven't altered the dependencies
You are importing it yea ?
like it says this...
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Is this one of those magical compiled eventhk it shouldn't
I'll be changing approx 3000 blocks
in a single chunk?~ยด
Yeah
my approach was like
wrapping chunks and rewriting the packet completely
but that took like 100ms
i imported it from github
anyone who knows a site which explains how to properly use jmh?
It's just not performant enough
For each chunk?
yeah
there are no syntax errors
the biggest performance hit was writing contents to the internal palette
Can you share the entire class ? From top to bottom including package and imports
?paste
The way the packet works is like
Ik how it works
get chunk -> loop through sections in bottom-top order, write the section's contents into the buffer
the section's contents are the palette's byte[]
Yep saw that looking at nms
Actually bruh
Now, the section writes like
@lament scroll you are coding against 1.16.3 ?
Glow squids were added in 1.17
calculating the air blocks is easy
but writing each block to the palette is often around 0.1ms
each section has 4096 blocks
Why does a write take that long?
Do you guys know any plugin which works like dynamic light on a geyser server for a bedrock client?
it's all synchronized ยฏ_(ใ)_/ยฏ
uses locks and all
pretty sure paper removes the locking part
but it's still slow
package & imports:
package me.redned.milksquid;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.entity.Squid;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
^^
So yea
class:
@Override
public void onEnable() {
this.getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onInteract(PlayerInteractAtEntityEvent event) {
//if entity is neither a glow squid nor a squid, return
if (!(event.getRightClicked() instanceof GlowSquid)) {
if(!(event.getRightClicked() instanceof Squid)){
return;
}
}
if (event.getHand() != EquipmentSlot.HAND) {
return;
}
Player player = event.getPlayer();
ItemStack item = player.getInventory().getItemInMainHand();
if (item == null) {
return;
}
if (item.getType() == Material.BOWL) {
//if entity is a glow squid
if(event.getRightClicked() instanceof GlowSquid){
if(player.hasPermission("milksquid.glowinkbowl")){
player.getInventory().addItem(new ItemStack(Material.GLOW_INK_SAC));
player.playSound(player.getLocation(), Sound.ENTITY_COW_MILK, 1f, 1f);
}
//if entity is not a glow squid but is a squid
}else if(event.getRightClicked() instanceof Squid){
if(player.hasPermission("milksquid.squidinkbowl")){
player.getInventory().addItem(new ItemStack(Material.INK_SAC));
player.playSound(player.getLocation(), Sound.ENTITY_COW_MILK, 1f, 1f);
} else {
player.sendMessage("You do not have the glowinkbowl permission");
}
}
}
}
}
visual studio

^^ can anyone help here
;:;
;-;
It's this method that's the performance issue
Well, if you don't import a class
more specifically, the calls at the top
It does not end up working
oh no, let's start by importing a class then
the lock field doesn't matter on paper btw, both methods do the same
Bump your dependency version
You are on 1.16.3
Spigot API wise
That API did not have glow squids yet
how do i change this?
It's still quicker to send 3k blocks with the MultiBlockChange packet
You change the version in your pom.xnl
i only need to change the text from 1.16.3 to 1.19.2?
I guess you can process the chunk packets async if you're really really concerned
Should be fine yea
like make a processing queue and all
โบ๏ธ ๐
just like
@eternal night i changed this ^
to this:
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
``` looks good?
CompletableFuture.supplyAsync(() -> {
// process stuff
return newPacket;
}).thenAccept(packet -> {
// send packet
});
// cancel original packet
type deal
No, stick to the same format from before
This one
so i need to keep R0.1-SNAPSHOT
ye
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
thank you so much, it all compiles now!
I see
ye just process async if you really want to
otherwise you're lagging the packet queue and that raises the player's ping
because packets will only be processed once the chunks go through
Has to be sent via that thread?
well
no
like
calling sendPacket adds the packet to a concurrent queue
Each player has its own dedicated thread
that just grab packets from the queue, sends them
Sorry I was in Alex's basement
np np
is there a way to keep track of something of a specific player? For example kills, deaths, etc.
like position 1 position the with wooden hoe
but idk what happes my for loop stops working when x is not x anymore
like pos1 is x 14 and pos2 is x 15 and just the for loop stops working
1 pos x y z
2 pos x y z
all I want to do is search the blocks in that pos1 and pos2
it is 3d
yes
entities, worlds, and itemmeta all have a PDC
world's PDC was added in 1.18.2 IIRC
world and chunk]
for chunks it was added in 1.16.3
yeah ofc it never runs
so if the current x == x then it stops at the spot you want
because loopxmin is always <= loopxmax
just pretend that you're drunk
in the loop so thats why it stops
yoasd sa di as yis ?
tf
why does it show two results in the first place lol
be free to show your progress
is it a good Idea to put that into an async
put what into an async?
testing two things
cuz like its like 10x10x5 blocks and it does nothing
you could!
the for loop
10x10x5 blocks is NOTHING
also you are not allowed to access the world async unless you made a ChunkSnapshot earlier
yea I know thats why I want to thread it
how then worldedit works
you dont even need many loops
it replaces like 20000000 blocks in 5 seconds
it runs off the main thread
you are talking about FAWE
how can I do that ?
FAWE simply splits up that stuff and runs it in a scheduler thingy
but you only have 500 blocks, that is NOTHING
explains why it fecking crashs shet
where I can get that ?
so what to do
what's the issue
nop
ahh -0 is still 0, thats the issue
classic non fawe worldedit
Classic WE used the main thread.
the normal worldedit works on the main thread, that's why it lags the whole server when you do big stuff
Thatโs why it crashes the server so much if you have large operations.
I mean thats enough for me
will not run 24/7
what's the issue you have
it does shit when larger area is selected
it's kinda hard to talk to you
"it does shit" is not a very helpful explanation
So
I am trying to convert blocks into code that I can paste and it generates the structure
check ut the link that morice sent
its very shitty explanation
Use Bukkit Structures
another thing that could help is using setBlock(..., false) to disable physics
like when you right click egg in inventory it creates a structure
nope I just saving the code into config so I can copy it and paste it
idk what better way
show one of those configs pls
yes but its for me only to copy it and delete it
not yet cuz like it takes so long to generate it does not generate
its just a temp plugin
if you don't share the config, noone here can help you
but I think I willl log it in console
I dont have a config
its empty bro
a minute ago, you said that you store "code" in a config
fuck how can I explain what I mean by that
so
the plugins generates code to copy and paste it
for another my plugin
its like temp code I just need the block locations
Why store every block location when you have the original starting and ending points?
the whole description of the problem is pretty vague, I'm out
nah I cant explain it
It sounds like it's a recreation of WorldEdit features.
On load? On command?
It generates code for other plugin to generate structure
if(x != selectx){
selectx++;
} else {
selectx = start point x
selecty =+1;
}
if(y != selecty){
selecty++;
} else {
selecty = start point y
selectz =+1;
}
if(z != selectz){
selectz++;
} else {
selectz = start point z
}
I dont want to type every block so thats why I made this
I want to do with pos1 and pos2 like worldedit but thx
just use != bruh
but this is continuation
tru
btw != is enough
Sorry, but this sounds really just sounds like WE clipboard functionality with some extra steps to me.
I get wanting to store a "selection", but I still don't understand what the issue is?
Is your selection fucking up? Is it not passing it to the other plugin properly? How is this structure supposed to be loaded? During worldgen or literally what WE does with it clipboard. (When you use a command)
So listen
I have pos1 location and pos2 location I am looping that
in a function
and returning a hashmap
sounds similer to faw
the world already contains the blocks
why you wanting to store the blocks?
I have a 3pos thats when I choose the block to build the structure from
Ok, still sounds like WE schematic files at this point.
from x I subtract 3posX and I then have a add value
Do u guys know if there's a method to get all the classes that extends a certain class ? i've managed to find the .getSuperClass() but not what i'm looking for
that add value can I add to any location I choose and the block generates like I want
but the problem is the loop is canceled
the loop just stop
stops
that sounds more like programmer issue to me
so the for loop looks like this:
public HashMap<Vector, Material> calc(World pW, int loopxmin, int loopxmax, int loopymin, int loopymax,
int loopzmin, int loopzmax, int blockX, int blockY, int blockZ) {
HashMap<Vector, Material> map = new HashMap<Vector, Material>();
for (int x = loopxmin; x <= loopxmax; x++) {
for (int y = loopymin; y <= loopymax; y++) {
for (int z = loopzmin; z <= loopzmax; z++) {
map.put(new Vector(x - blockX, y - blockY, z - blockZ), pW.getBlockAt(x - blockX, y - blockY, z - blockZ).getType());
}
}
}
return map;
}```
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
my isnt colored wtf
?paste even better
you gotta add "java" after the starting `` stuff
public HashMap<Vector, Material> calc(World pW, int loopxmin, int loopxmax, int loopymin, int loopymax,
int loopzmin, int loopzmax, int blockX, int blockY, int blockZ) {
HashMap<Vector, Material> map = new HashMap<Vector, Material>();
for (int x = loopxmin; x <= loopxmax; x++) {
for (int y = loopymin; y <= loopymax; y++) {
for (int z = loopzmin; z <= loopzmax; z++) {
map.put(new Vector(x - blockX, y - blockY, z - blockZ), pW.getBlockAt(x - blockX, y - blockY, z - blockZ).getType());
}
}
}
return map;
}
like this
finally
.
Why does that not just link to the discord markdown help page?
https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline-
It's extremely short though.
whenever someone does ?nms, people just ignore it
Unlike the actual markdown docs
so thats the for loop
?nms
when I want to get values I broadcast them
so it returns a value
I can .add(x, y, z) do any block and get the block generated
vectors?
the for loop just dont finish or how to say it
yes
ok fixed it
what ?
he's doing a math parser, it has nothing to do with your problem
so when I want to get that
i Do :
this is better
Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
for (Entry<Vector, Material> i : calc(e.getPlayer().getWorld(), pos1.getBlockX(), pos2.getBlockX(),
pos1.getBlockY(), pos2.getBlockY(), pos1.getBlockZ(), pos2.getBlockZ(),
mainBlock.getBlockX(), mainBlock.getBlockY(), mainBlock.getBlockZ()).entrySet()) {
e.getPlayer().sendMessage(i.getValue().toString() + i.getKey().toString());
}
});```
thats a bunch of parameters lol
you could use the doubles fx double x, double y, double z to get block at location
so can somebody help me ?
it would be way cleaner
thats the last part I want to work it
want to see work it
is that even allowed? I dont think it is
yes
weird
inside the 3d loop
do stuff
I don't like records anyway
id better make it a class cuz im exposing field actually now
I just use lombok for records
internal class but whatever
@Data
are those immutable?
@quaint mantle
you can control that by making the fields final
I am doing
fx storing or set block your choose
oh lol
???
@Data
public class MyPartlyImmutableClass {
final int valueX;
int valueY;
}
now valueX would be immutable but Y is mutable
lOmbOk
lombok is nice, stop hating it
note: storaging every block into a list sounds like a lot of memory use
its not permanent
whats point of doin that
lombok hooks into the compiler right?
none, it was just an example
yeah kinda
lombok can be very helpful
thx but I need to solve the problem
I would recommend saving the data straight way
I see, but you also have to keep in mind that you're not the only person in this channel
I cant I need to calculate it
lol this one if controls the whole number constructing thing
i hope my number parsing is faster than Double.parseDouble lol
so when people want to have a discussion about lombok, let them be
are you trying to figure out how many blocks there is as the same type?
no he wants to spawn some structures
its gens a code like: world.getBlockAt(e.getClickedBlock().getLocation().add(GENX, GENY, GENZ)).setType(Material.GENMATERIAL);
sounds like overcomplicating
why not just set blocks?
cuz I need the location of the blocks
no mate its not simple like that
need to get the location from clicked block
its fucking done but the loop just stops
that just event
still dont get it ?
hmm would Files.newBufferedReader be more efficient than new BufferedReader(new FileReader("src/test/tests.txt"));?
declaration: package: org.bukkit.event.player, class: PlayerInteractEvent
I am making a same thing like in worldedit you get pos1 pos2 and copy it and when you paste it it pastes below you
What the fuck are you doing where creating a buffered reader needs to be optimised
nothing, just wondering why it exists
thats the point of but Then I am converting that into a java code and using it my another plugin
It is the path variant
no
Most of the static Files methods are there for new path API
All the old constructor stuff is for file
hmm
how can I pause the main thread ?
to give more priorite to my loop ?
Bukkit.shutdow()
it actually does the same thing
but what in that there are milion sheduls
Unsafe#putInt better
what
Mbmb
if you really wanna shut down the server: Unsafe.getUnsafe().putAddress(0,0)
im not understanding what youre saying mate
you are supposed to read and understand it
and then you choose the method that you actually are looking for
BukkitScheduler#runTaskAsync
but the async still doesnt work for my loop
ctrl f javadocs and search for async lol
I still have no clue what your issue is
I have asked like 7 times what the issue is
that is just math
World edit but cursed ?
Already done
but the loop doesnt work
its just doesnt work
or the async doesnt workk
yeah, they somehow have plugin A that generates some code / command that they wanna paste into plugin B, and plugin B is now supposed to generate some structure
don't ask me how or why
you can't place blocks async
do output check
You can't use the majority of bukkit methods in an async method. They aren't thread safe.
whats isnt safe on for loop in asnyc
yeah I told them about this one hour ago
did you read my code I sent ?
that question makes no sense. whether you do for() or not has nothing to do with the thread it's running on
worldedit is then magic
no worldedit is not magic
it just math
the math is done
No, they put everything on the main thread which has it's own issues. Which is why FAWE came into existence.
Someone has an idea of why i get that error ?
https://hastebin.com/efuwajodet.properties
but the problem is the loop
FAWE runs async and jumps back to place a group of blocks sync
and computing
the problem is that you don't properly try to debug your stuff
ALL placing is sync
????
uh yes
ofc you can create an async task in an event listener
that is cursed
in blockbreakevent function ?
you can always create a new task from the bukkitscheduler, unless the server is already in "shutdown" mode
No one ?
you are adding sth to a list that doesn't allow to add items
but what, List always allow add items
no
Its my own list
?paste your BlockDataManager class
well the list allows it
no
but skyutils doenst want items in that list
it doesn't
thats my guess
AbstracList doesn't allow adding items
only certain classes that override this do allow adding stuff
e.g. ArrayList
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
All block with "custom meta data"
aren't you the person who asked about block PDC a few hours ago?
return this.datas = Arrays.asList(l);
RIP
but
Ya gotta reinvent the wheel somehow
you can just do:
so tgat tge problem
Ok thnx
should do
basically just wrap your immutable list into the arraylist constructor
and next time, just use CustomBlockData instead of trying to reinvent the wheel
CustomBlockData ?
somehow just loopedX - positionX doesnt work
But i need that data steel in block when server restart
no clue why its just simple int - int
Im not reinvinting the wheel im just making my own system
you do reinvent the wheel
thats literally the definition of reinventing the wheel
-_-
me having to write extra code to handle numbers like -0.3 lol
-0 doesnt seem to exist in java :(
takes note so i can use stupidty for lolz later
so listen
no
map.put(new Vector(x, y, z), pW.getBlockAt(x - blockX, y - blockY, z - blockZ).getType());
that works
but that doesnt:
map.put(new Vector(x - blockX, y - blockY, z - blockZ), pW.getBlockAt(x - blockX, y - blockY, z - blockZ).getType());
learn to manage and code better and cleaner
thats the part when it doesnt
not trying to be dough
both look like a mess tbh
yup
because it goes against the programming practice rules
if it wouldn't matter, then it'd be working
idiot
Idk how to call you
insulting me wont help you with your problem
break down your problem
yes instead of telling me to write cleaner you can focus on issiu
investigate the problem figure what the causes
that's the thing, I asked that like 5 times already but they don't
your issue is probably that your math is off and people told you this already 20 times
I wanted to write it now but that mfnalex just is talking about writing cleaner
so again
map.put(new Vector(x, y, z), pW.getBlockAt(x - blockX, y - blockY, z - blockZ).getType());
that works
but that doesnt:
map.put(new Vector(x - blockX, y - blockY, z - blockZ), pW.getBlockAt(x - blockX, y - blockY, z - blockZ).getType());
the new Vector()
is the issiu
no
I cant do X - blockx
the issue is that x -blockX (etc) returns something else than what you expect
blockX = vaule
it just crashes or tf is happening
getblockAt is working but new Vector nah
so blockX is the main block
it goes from
it calculates the distance from main block
wouldn't you usually then ADD x instead of decucting it
no ?
it is a cluster omg
why doesnt java have unsigned ints smh
because it's high level and not C++
lol c++ devs be like that
if main block is x 15 and if looped block is 13 thats 15- 13 and that means its 2 away from X
0 = nothing
but I need to switch values on this map.put(new Vector(x - blockX, y - blockY, z - blockZ), pW.getBlockAt(x - blockX, y - blockY, z - blockZ).getType()); brb
hehe mine faster
Hey guys :), Can someone please give me an idea about how to add a string below a mob name, like in below name for a player? Thanks in advance.
i seem to heavily rely on the jit compiler lol, first call is like this
you want to have 2 lines for the name?
yes sir
how is the jit compiler so much better tho lol
then you need another entity
wtf is happening my ram is 94%
if mobs could have scoreboard line below
it caches code that it often called
like a mob health plugin
thereby makes it faster to run
yeah you need to have two entities
e.g. you gotta add a passenger or sth to the original mob
please fix code cluster @quaint mantle
otherwise it won't work
an invisible mob?
as passenger so it adds this mob name?
smh my execution time is twice as big as a simple thing someone else wrote
yeah, for example an invisible armor stand, or an area_effect_cloud
ok thank you, gonna try that
idk but now it works
magic or smth
idk why it works
but now it perfectly works
great
when switched that again for the 4th time
as I said many times already, your math was probably just fucked
no it wasn't
ok dude didnt handle multiple parentheses
computers are very stupid
they do exactly what you tell them to
so if it didnt work but works now, then you changed sth
or just failed in compile (saves the changes)
yes I changed the map print to block place event to get values
time to see how long a constructor takes
if you dislike 20 parameter constructors, then never decompile NMS lol
ok constructor invocation only takes 5ยตs and even less when the jit optimizes it
so that cant be the overhead
this looks a little bleh
nope that doesnt work tried it before
are you comparing integer to integer ?
yeah but I told you the problem are the vector
maybe dont use that then lol
the first code works the second doesnt
see the new vectors
ij pretty good
Md uses netbeans :โ)
i see i see
md5?
Yes
is there a reason to call super.clone() if you can just call new X() cuz that class only has an int field
No
smh ij
hey, is that really the way to add a string under the mob name? I got this and doesn't seems to work, the entity name doesn't apper, only the passenger name
entity.getLocation().getWorld().spawn(entity.getLocation(), ArmorStand.class, armorStand -> {
armorStand.setCustomName("passenger");
armorStand.setCustomNameVisible(true);
armorStand.setVisible(false);
armorStand.setSmall(true);
entity.addPassenger(armorStand);
entity.setCustomNameVisible(true);
entity.setCustomName("entity");
});
I would like to use packets if needed
just came to the conclusion that '\u0000' isnt ' '
I thought you did that already
Is there no other way to get the title of an inventory than via InventoryView?
No
You could just make a wrapper object and use that granted it requires caching but that's not a huge deal
okay :/
but i were able to setTile
should probably use a long or throw an overflowexception
first parsing thing works cuz it doesnt seem to use ints
smh
long can also have overflow \๐ค
Its fairly easy to set title on the go you just send the player a new inventory view packet with the same ID, but generally I'd reccomend not dipping into nms. Since the guy just wants to get the title I'd just opt for a wrapper object
I got animated titles working fairly smoothly a week or so ago its super simple I just set up a queue
Though I stole the nms code form 7smile7
is nms better for title animation?
Yea I'd think so seems rather inefficient to have to read all your items to the new inventory just to change the title
Sending a packet which are pretty light weight has no overhead like that
examples?
๐ค 
That's definitely something you could write API for. Whether it be Player#updateInventoryTitle(String) or Inventory#sendTitleUpdate(HumanEntity, String)
(I honestly think the latter is smarter)
I wish more people would realize that API for that sort of stuff can totally get implemented if they just write a PR ๐
and a Inventory#sendTitleUpdate(HumanEntity, String from, String to, TransitionType)
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
there we go
bigInt
Why would you need a from or transition type? What is a transition type?
Would a title update not just... change the title?
also why would you need a from to string
that just doesnt seem like it would be needed
inventory title update API is 5head until the quirk it relies on breaks
Unless you want CraftBukkit to do some weird transition from one string to another, which you can and should be doing in your plugin, not CB lol
fancy transitions
animations
Yeah that's something for the plugin to handle
API should just let you be able to change it
no official api
I wish more people would realize that API for that sort of stuff can totally get implemented if they just write a PR

throw it in unsave values
on a scale of 1-10 how hard do you think adding #sendTitleUpdate would be
to implement
Pretty much 0
iirc we still have a PR for that on paper but like, its a weird thing because the only difference to just re-opening the inventory is the fact that your cursor does not move which is not specified in the protocol or anywhere as actual logic
might pr it later
unless I am mistaken
You'd essentially copy/paste the same code you would write in a plugin, but do it in CraftBukkit behind an API method
like vanilla does not use this behaviour so the API just, depends on a random quirk in the client in regards to menu id usage
Mhmm
i haven got a clue
I think doing Inventory#sendTitleUpdate(HumanEntity, String) is the best method signature for it
Maybe InventoryView
it doesnt either if you dont explicit close the inv before
oh ?
just overwrite the current with another openInventory call
It looks like you can just send the packet.
I mean, the issue right now is that you cannot change the title of the inventory post creation I presume
Not on the server I don't believe, no
if changing the title in an existing inventory instance does not allocate a new menuId and hence does not reset the cursor wouldn't it be smarter to allow changing the title of an inventory
instead of sending a title update
Could probably remove final from it and push an update packet, yeah
Client-sided inventory names might be useful too though
Usernames and whatnot
Hmm true, yea I guess. Tho then it would make more sense on the human entity wouldn't it, as part of the existing packet magic exposed in the API
sendBlockChange etc
Yeah but what if they have no inventory open. Having it in InventoryView means it will be open
(more likely than on a Player anyways)
? what inventory
We're talking client-sided lol
yea the paper PR ended up with it on inventory view too
Makes sense though.
yea it does. would just be careful with not promising the "no cursor reset" anywhere in the docs
I don't think you can get more implementation quirk heavy than that behaviour
How do I go at making a plug-in to display mcmmo levels in chat? I have no idea how to work with other apis along w spigot
Well if you're just re-sending the packet, then it shouldn't close the inventory, which shouldn't effect the cursor.
hook into their api
check there docs
the point is that it reuses the menu id/ container id
Yea, and according to the protocol docs, if you send an existing id, it won't close the window. So it is looking good for the cursor. ๐
that is defined in the protocol ?
concerning there is no actual definition I usually just go by: what does vanilla actually use
as far as I know, they don't reuse menu ids in any settings do they ?
I don't know for sure, but I would assume since they are keeping track of them, when you access the ID, it'll grab the associated info. E.G. If you renamed a chest, it would have a custom name when you open the menu.
I mean, yes they share the menu id for the actual inventory instance there but they don't resend an inventory open screen with the same menu id
e.g. what happens here
mostly because there is little to no reason to do so as they don't update the inventory like that
and items have their normal slot syncs
cant you just dig into it and look how its done
AFAIK, there are no menus that have updating titles. So it would really just come down to testing how it would function.
openInventory should respect that
I mean, down the line it does not matter if it reopens the inventory or not tbh
as long as the method contract does not promise this behaviour it can still exist and just "change the title on the client side"
how exactly that plays out just, should not be specified in the method contract imho. It is just too specific to implementation quirks on client and server
well yeah since the public api should only promises that its done, not how. interfaces shouldnt presuppose specific impls anyways
I mean one big reason why this also might exist is because it allows inventory title change without creating a new inventory with a new title but same items is the fact that it does not reset the cursor
like you could just change the title by creating a new inventory with the same items but the wanted title. But that resets the cursor as it is as new inventory.
So people will most likely use such a method for the "title change without cursor" ability and expect that method to provide that where as it may simply not in the future if the client changes.
Yea, that's the only potential problem with it. If any future update changes how the existing inventory system works, then it could cause issues.
thats how it currently is handled
but still, you dont have to specify that advantage. just that its done, thats all. no specific impl, no promises, no how, no disadvantages
thats also leaves the freedom of just changing the impl to what you like
well it would be one of the most "hacky" sendX methods in the API
in regards to the cursor reset
so yea, don't define it at all
well but they wouldnt know without looking at the code
or actively specify that the server cannot promise how the client handles such an update
in regards to cursor position or animation
and as an api user you should only code against the public api, not the impl
wouldnt go too much into detail. a server sends the client an title change should be enough
yea presumably
but people like to interpret things
and then get grumpy when things don't work as they expect it to work
if you design an API, protecting users from themselves is half the job ยฏ_(ใ)_/ยฏ
if they overthink it its their problem
Well anyway, another method to add a Component overload to ๐
not really, i mean, well it should be userfriendly of course. but also just as limiting as needed. and here is no limit needed imo
I mean, its barely a limit, more of a warning ยฏ_(ใ)_/ยฏ
but I digress
up to the contributor who ends up suggesting it
its packet magic in the API so its always fun
Can't legally sign the doc to create a pr
So no I can't

I'll be more than happy to pr when the time comes
You can with a parent or guardian!
x2
Only if my parents loved me Like that
moom I wanna code on funny minecraft code
Fr lol
guardian of the galaxy?
"we have a spigot at home"
Honey just use the spigot we have
๐
is there source code for minecraft's default world generation on spigot
"no"
oop its in nms nevermind
How?
?contribute
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
how can i get the coordinates of a dead player ?
Listen for the PlayerDeathEvent and grab their coords.
oh sry
thx
so guys
the loops I was developing
I just show you in second
what I made
how can I play a song to all player ?
Loop through all players and play the same sound
This isnt really a coding but rather a understanding question.
lets say I have 2 accounts. MisterName and MisterMame.
When I autocomplete will it serve MisterMame first since, m is before n in the alphabet?
yes
allplayer.playSound(allplayer.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1f, 1f); sry i don't understand ?
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
wtf is allplayer
they were told to loop through all players
so ig they too that as all players = allplayer
\๐ค
hey so im currently checking if a raytrace will hit entity im trying to ignore any petrified oak slabs so i did if the result is oak slab still do the action but if it hits oak slab it completely ignores if theres any other blocks in the way which i dont want to ignore. so is there a better way to ignore a block without ignoring all blocks
heres some of my code
if world.rayTraceBlocks(cameralocation, entityloc, 10) == null
do stuff
else if(world.rayTraceBlocks(cameralocation, entityloc, 10).getHitBlock().getType() == Material.PETRIFIED_OAK_SLAB
do same stuff as 1
but 2 always gets triggered if it hits oak slab first
the raytrace method has a paremter that let's you pass in a set<Material> to ignore those
lol ok
didnt the petrified oak slab get removed in recent versions
still in 1.19.2 never checked 1.19.3
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html#PETRIFIED_OAK_SLAB guess its still in
declaration: package: org.bukkit, enum: Material
wtf even is a pterified oak slab
fire proof oak slab
how does one get one?
item thats not in vanilla so im using for my custom block lol
creative
/give @p petrified_oak_slab
oh ok
it got removed from the gmc menu in 1.19.3
does it still exist
i think it does
just only accessible through/give
i was too lazy to make actual custom block ๐ฌ
heres ray trace params the only blocks i can ignore are passable ones from what i get
ill check if it still exists, give me a few min need to boot windows
oh yeah sorry, I confused it with getTargetBlock
getTargetBlockExact or sth like that allows you to pass a Set of "ignored materials"
Clearly missing something obvious: are worlds from the Multiverse plugin tracked by calls to server.getWorlds() ? I'm having the most confounding error. It's trying to load a preferred world from config, worked perfectly in my test server, worked fine on first loading into the dev server, but upon setting it to the proper world name (worldP) it's going haywire, returning null while trying to find a world by that name. I tried to see if it was a capitalization thing, so I had it output to the Bukkit logger everything from:
for(World w : plugin.getServer().getWorlds()) Bukkit.getLogger().info("World name is " + w.getName());
And all it put out is overworld, nether, and end...though there are 100000% a bunch of other worlds there.
And I've used these same calls in another plugin, linked to a multiverse world, that has 0 issues. I'm stumped.
yes
does your plugin at least soft-depend on multiverse?
if no, it probably gets enabled before mv so you dont see the other worlds
that would make sense
though it's baffling that another plugin running on the same server, doing the exact same thing, doesn't have this issue
the order of plugins being loaded is a bit random
that's probably the entire issue, I knew coming here would be the right choice
add soft-depend: Multiverse-core or sth like that to your plugin..yml
๐
just checked, it does still exist
๐ญ
i wish it returned a list of hit blocks
i beliave ill have to do 2 rays one above the camera and one below and see if it dont hit anything
actually 6 one for each side technicly 12 so it detects entity head too
tf
that is -1
whut
like how do you put -3 in 5