#help-development
1 messages ยท Page 642 of 1
for hub server i mean bungeecord server
i will save this
- globalmoney (special money for all server in bungeecord)
- rank (rank for all server in bungeecord
- last join
- bantime
- mutetime
- isafk
for games in bungeecord
- money
- level
which one am i need cache with hashmap ?
am i need control some data query for hub server ?
you can safely store all this on bungee
nothing is that time specific you could not query bungee as you need
i don't need cache datas in hub server ?
and i need cache money ?
bcs money
all time changing
constantly changing?
This database also makes continuous queries.
money players can change moneys everytime on buy sell pay
for those values I'd not cache anything on the spigot server
The database will always work.
just send/request values/changes to bungee
if they sell something you send the amount of money they gain to bungee
money isnot for bungee
is for server in bungeecord
but globalmoney is for all server i mean all server in bungeecord
if they want to buy something you must already have some UI or something open so you should already know how much money they have.
yes
but they don;t have different money in each server
it will be different on each server
i mean money
but not globalmoney
wait
choco said this
i will find
if its only relevant for a specific server then it shoudl be stored on/by the server
if its global then store on bungee
yes
i save this datas in mysql
instead of constantly changing the money in the database
I should have added hashmap to money
after player on left server i need add money in hashmap to database
the only issue you are going to have with caching values on a server is when switching servers
Hello, how can I make a packet-based entity with ProtocolLib ?
when using bungee and switching servers teh player will join the other server before you have finished processing the disconnect event
I got a gist on that
Error occurred while enabling Skyblock v0.2AlphaBuild (Is it up to date?)
java.lang.NullPointerException: null
hey there, I've been working on my network with many custom written plugins for a while, and I've recently started questioning whether mysql databases are good for scalability and performance. I'm mostly storing generic player data like locales and per-gamemode stuff, and I only work with loaded caches, so performance is not largely problematic for me, but I'm worried that if the network ever takes off, I might need to learn more about scalability. are there any good resources and comparisons for databases MySQL vs NoSQL and where generally can I learn more detailed and technical information about databases? please provide your trusted resources and links, I'll be happy to get into it tomorrow morning ๐
oh that is i wasnt think this
full error ?
how do I check for null thing?
rest is error at line 133
thanks 
so what u prefer ? wait i will not add my money plugin to bungeecord btw
copy paste the full error
all the stacktrace
?paste
for me I'd only cache server specific money. global (bungee) money don't cache, read direct from bungee
MySQL will most likely suit your needs unless you're talking about an incredibly large playerbase
I don't think I'll grow to the sizes even comparable to say hypixel of course, but even so, I'd like to be prepared for the worst case scenario all the time. if you've got any place from where I can learn deeply about databases, I'd be happy to hear that
Actually a lot of people shit so much on mysql (even tho I don't understand hate), calling it awful performance, unreliability etc
haha, I've seen the hate yeah, but I don't want to be influenced by it
well, if i create cache hashmap in bungeecord server and if i get globalmoney from hashmap
is it will be a problem ?
that was a last question
no, caching on bungee is great
alright ty
There is even tag in jda ahahag
Fundamentals of Database Systems by R. Elmasri and S. B. Navathe is a solid read
my favorite java book is called "java also is an island", but i think its only available in german
"Java ist auch eine Insel" or something like that? Dunno I'm bad at translating
exactly
Maybe I'll buy it
Fuck 
java is such an incel
I keep forgetting lmao 
who needs Java 17 when ~75% of Maven central is still <= Java 8
?paste
Hello, I found this code:```java
private void spawnEntity(Location location, Vector vector, EntityType type) {
int entityId = 10000;
PacketContainer packet = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY);
// Crucial data, do not remove
packet.getIntegers().write(0, entityId);
packet.getUUIDs().write(0, UUID.randomUUID());
packet.getEntityTypeModifier().write(0, type);
packet.getDoubles()
.write(0, location.getX())
.write(1, location.getY())
.write(2, location.getZ());
// -- section end --
// Velocity, remove this code section if you want to default to 0
packet.getIntegers()
.write(1, convertVelocity(vector.getX()))
.write(2, convertVelocity(vector.getY()))
.write(3, convertVelocity(vector.getZ()));
// -- section end --
// Pitch and yaw, remove this code section if you want to default to 0
packet.getIntegers()
.write(4, (int) (location.getPitch() * 256.0F / 360.0F))
.write(5, (int) (location.getYaw() * 256.0F / 360.0F));
// -- section end --
// Send the packet to all players
try {
for(Player player : Bukkit.getOnlinePlayers()) {
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
}
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}```For creating a packet-based entity, but idk what to put into int entityId
Any idea
(I think if I use two times this code with the same entityId, there will be an error
what's SItem line 483?
meta.setDisplayName(statistics.getRarity().getColor() + specMaterial.getDisplayName(variant));```
meta is null or statistics is null or statistics.getRarity() is null or specMaterial is null
add some debugging output to figure out which of those is null
probably it's the meta since ItemStack#getItemMeta() is nullable
use System.out.println before this line (best manner)
something tells me I wrote this code
could be statistics
{
if (material.hasClass())
material.getStatistics().load();
return;
}```
if you'd be using a recent java version, the stacktrace would contain the name of the variable that's null
what is this platforms ?
waterfall is the paper version of bungeecord
assert statistics !=null;
meta.setDisplayName(statistics.getRarity().getColor() + specMaterial.getDisplayName(variant));```
what this do?
nothing
nooooo 
assertions are disabled by default
hmmm
then, do I need to leave it default ?
The entity ID is a number that represents the entity's lifecycle
Like
If you say "Entity abc is 123" in the spawn packet and refer to it as 123 from there on, the client understands what entity you're talking about
And that's pretty much how entities work in the protocol
You just send a spawn packet with a numerical id and then reuse that id in later packets
I like to just start from 50000 and just increment for each new entity
bungeecord projects only for bungee events ?
i mean if i add plugin non bungeecord to bungeecord plugins will work fine ?
okay thanks ๐
oh god you have no clue what you're doing
bungeecord API has nothing to do with spigot API
spigot plugins won't run on bungee at all and vice versa
?jd-bc
these are the bungeecord javadocs ^
I had same issue today. To resolve it you should use ItemDisplay instead of BlockDisplay to display blocks. I know that sounds weird, but BlockDisplay has rotation origin at the bottom left block corner (0,0,0) while ItemDisplay origin is at the center point of block/item (0.5,0.5,0.5)
but some plugins works on bungeeand spigot
like luckperms
they using two lib
in project ?
That's because they wrote multi-platform code :p
ItemDisplays show the item, not the block though. one could have just fixed it with a proper translation
they does
They just write "generic" code and a bunch of interfaces and at the end make a "platform" for each server type
good to know
i wanna make api plugin for my other plugins
but my api is for bungeecord
and other plugins non bungeecord this will work fine ?
does Chunk#getChunkSnapshot forcibly load a chunk given its not loaded already
doesn't look like it probably. Checked CraftBukkit code
Anyone know how imagine fun handles so many entities, (more information past what Matt wrote on his blog)
How who/what handles so many entities?
Imaginefun, you can google it
Hello, does someone know if there is a way to show a player's 2d face in their screen using a Texture pack and a plugin? I know about negative spacing and such, but idk how to retrieve that player's face to show them in the screen.
Okay so I have a little bit of a predicament I kinda am Having a hard trouble wrapping my brain around atm.
Essentially I need a bunch of ChunkSnapshots because I need to scan chunks for specific blocks. Doing this on the main thread would be rather expensive which is why I'm using Chunk Snapshots to search for all instances of these blocks. However you have to take ChunkSnapshots synchronously to my knowledge. So i setup some work distrobution from 7smile7's thread so I can run as many Chunk#getChunkSnapshot calls as possible without lagging the server. On each one of these calls I need to operate on the ChunkSnapshot asynchronously. To do this I added a method to my Worker interface which is called void completed(Object object) essentially its a consumer that executes after the Worker finishes getting the ChunkSnapshot. This approach is pretty flawed and I can shoot holes through it all day. I'm just not sure a better way atm my brain is busted and I haven't really taken any breaks on this
you could push your finished data to a queue and process it in a single thread
honestly I was thinking of something along the lines, you think after the data is finished I add it to another queue that sends data in for Asynchronous processing
if you are going to be making any changes to a chunk based upon that data you will have to be sync
I'm only reading data
from the ChunkSnapshot
so everything I do with it can be processed asynchronously once I grab it
what do you do with the end data?
I push it into my own Databases
then just do as you are. multiple threads running async is not an issue
your system likely has a few thousand running at all times
my main struggle with this design is thinking of how to funnel all the data back into one BigInteger which eventually happens at the end. like how do I sync all of those asynchronous tasks into one number ๐ค. I mean pushing the finished data into the Queue makes sense to me, but how am I supposed to know when every single ChunkSnapshot has finished processing in the queue
yk sometimes you overlook the simple things lol
you shoudl have an equal number of resultsd
yeah that's a completely valid point I have the beginning number of chunks I need processed just keep holding the task until they all finish
thanks ๐ to think my issue had such a simple solution well its clear as day now
I tend to overthink these things huh
I've written some terrible code in the past, many many lines.
only to replace it with a handful the next day
am i need connection.close and statement.close methods in hikaricp ?
wrap in a try with resources and you won't
are you blind
its another number just like in Java
i can't saw in docs
Double is equivalent to float, just double precision or double wide
yes, it is floating point number. You can do 3.141f
double is 2 floats. Basically its the long variant of floats
int and long are whole numbers. No decimal point
float and double are floating point numbers
Is there no Configuration#getValues in bungee? I might need to do something recursive
discord float โ ๏ธ
Idk open a feature request
can't bother lmao it's much easier to write those 15 extra lines
Wtf is getName anyway
This is why the api never improves
it returns the name of the section
๐
Or empty if it's a fileconfiguration
there is ConfigurationSection#getName
That's bukkit
joe:
mama: "Hah! GOTEM!"
ConfigurationSection section = config.getConfigurationSection("joe");
assert section.getName().equals("joe");
I use getName for my multi-platform config section thing
seems a bit redundant to have a getName?
It's useful
couldn't you just extract that from the path
In context, yeah
So what I'm doing in my bridge class is just add a name param
Mhm there's no saveResource method on bungee
funkjy
I have it too, it's great. I really enjoyed the bait of them with the hair on one of the first pages
someone check my codes to tell my mistakes
hikaricp class
https://paste.md-5.net/zuzijiqupe.java
and this dbmanager sry i can't paste this to md5
package me.vasir.manacore.database;
import org.bukkit.ChatColor;
import java.sql.SQLException;
import java.sql.Statement;
import static org.bukkit.Bukkit.getLogger;
public class DatabaseManager {
public static void initializeDatabase(){
try (Statement statement = HikariCP.getConnection().createStatement()){
String sql = "CREATE TABLE IF NOT EXISTS global(uuid varchar(36) primary key, username varchar(16), discord int, crystals int, boost boolean, bantime int, mutetime int)";
getLogger().info(ChatColor.GREEN + "Connected database");
statement.execute(sql);
}
catch (SQLException ex){
getLogger().info(ChatColor.RED + "There was an error in database -> ");
ex.printStackTrace();
}
}
}
my sql code is right ?
for discordid do i int ? or bigint ?
Discord ID go far more then 4000000000
bigint
for unixtime ?
anything LONG in java -> BIGINT
bruh is there seriously no way to disable a bungee plugin
unixtime is also long (ignoring other time data types) so bigint too
ty
yes i can't use
where can i see hikariconfig default properties ?
i mean maxidletime
Also this looks a bit like static abuse, search for imillusion search index static in this channel, it's pretty well explained
.
but statics is cooll ๐
i only write class name after dot method or object
๐
wdym ?
am i n eed ?
hikari don't close auto ?
how can I stop particles from going crazy I used flame particle btw
add a speed
Hikari uses a special connection object where the close method returns it to the pool
Rather than actually closing it
speed?
Yeah it sure is, but read whole post
ok
Hello, how can I translate this :java itemDisplay.setItemStack(itemStack); itemDisplay.setItemDisplayTransform(ItemDisplay.ItemDisplayTransform.HEAD); itemDisplay.setTransformation(new Transformation(itemDisplay.getTransformation().getTranslation(), new AxisAngle4f(0.0f, 0.0f, 0.0f, 1.0f), new Vector3f(1.0002f, 1.0002f, 1.0002f), new AxisAngle4f(0.0f, 0.0f, 0.0f, 1.0f))); itemDisplay.setBrightness(new Display.Brightness(15, 15));Into this```java
private void spawnEntity(Location location, EntityType type, @Nullable Vector velocity) {
PacketContainer packet = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY);
ALOT.lastEntityId += 1;
// Crucial data, do not remove
packet.getIntegers().write(0, ALOT.lastEntityId);
packet.getUUIDs().write(0, UUID.randomUUID());
packet.getEntityTypeModifier().write(0, type);
packet.getDoubles()
.write(0, location.getX())
.write(1, location.getY())
.write(2, location.getZ());
// -- section end --
// Velocity, remove this code section if you want to default to 0
if(velocity != null) packet.getIntegers()
.write(1, convertVelocity(velocity.getX()))
.write(2, convertVelocity(velocity.getY()))
.write(3, convertVelocity(velocity.getZ()));
// -- section end --
// Pitch and yaw, remove this code section if you want to default to 0
if(location.getPitch() != 361F) packet.getIntegers()
.write(4, (int) (location.getPitch() * 256.0F / 360.0F))
.write(5, (int) (location.getYaw() * 256.0F / 360.0F));
// -- section end --
// Send the packet to all players
try {
for(Player player : Bukkit.getOnlinePlayers()) {
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
}
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}```
That's probably part of the metadata
is there anything that can help me to do this ?
where ?
That's the fun part
yes 
I'll just say I've talked about it a few times across spigot, git and here
And I can't bother explaining entity metadata for like the 9th time
can I have links please ๐
yo does anyone know bungeecord and how to make it so whenever u get kicked from a sub server it sends u to like the lobby or smth idk how to do it
No
i've tried movemnow, didnt work will try hubkick tho.
but someone was write
Your connection is already closed by the try-with-resources
Actually you should make the connection a variable inside try with resources
Statement statement = connection...;) { /* code */```
I do one thing and something else pops up.
hubkick doesn't work... do you know how to set it up? do i put the plugin in my bungeecord server or sub servers?
never call close yourself, the try with resources does it all for you
no thats fine
How many times are we goign to type, you do not close the connection
Could not find artifact com.comphenix.protocol:ProtocolLib:jar:5.0.0-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
Getting this when I reload my pom.xml file after adding ProtocolLib as a dependency and as a repository
NEVER call .close()
the try with resources does it for you
putting it in try (...) makes it auto close if it can when finished
coll consufed me
???
two variables it will try to close on both
anyone know why im getting
java.lang.RuntimeException: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '435957781011496960' for key 'PRIMARY'
public void createSeasonRow(String id, int x, int y, int z, String team) {
try {
PreparedStatement statement = TFI.getDatabase().getConnection()
.prepareStatement("INSERT INTO season(id, x, y, z, team) VALUES (?, ?, ?, ?, ?)");
statement.setString(1, id);
statement.setInt(2, x);
statement.setInt(3, y);
statement.setInt(4, z);
statement.setString(5, team);
statement.executeUpdate();
statement.close();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}```
the id is NOT in the table already, the table is brand new and ive deleted it and remade it
duplicate entry you need to update if the entry already exists
the id is NOT in the table already, the table is brand new and ive deleted it and remade it
the error says otherwise there wouldn't be a duplicate entry error if the key wasn't in the table
my guess is you could be accidently running the code for the ID twice or you just aren't actually deleting the database
that is 100% not in the database, ive tried deleteing the entire database and remaking it, same error
and its not being run twice so idk
duplicate entries only happen if theirs a duplicate entry so you have falty logic somewhere
couldn't say more without more code. This section itself seems fine as their are no loops
my guess, you are calling the method twice
You are calling it twice or it's already in teh database, those are your only options
I recommend every intermediate dev to check this
Abstract factories and adapters are useful for writing multi-platform code
Composites are nice for GUI utilities
looks useful
Didn't u say this was out during the facades are singletons debate?
*outdated
no
I wasn't part of that debate
I said your books were outdated iirc
Nothing about facades
decorators are quite an interesting pattern
The book by the authors of the design patterns is outdated?
ยฏ_(ใ)_/ยฏ
Lol
It's been a few days so I can drop this here now for gigs
*oops
Am gonna try some singleton managers soon tbh. Honestly see no big reason for them not to be other than spigots deathly fear of static ever since the bad bad times of early bukkit
Which programm is the best programm for mysql databases?
to read stuff? to read/write from ur code?
everything, using it for a server as well as read the data of my code
i use hikaricp to read/write from code and mysql workbench if i need to check content
does anyone know if it's possible to embed my plugin's download count (or even the whole information panel) from spigotMC onto my website? ๐ค
mysql workbench for servers?
if its cli i just open the db and run the commands to show data
Is there anyway to get an EntityType of a spawner asynchronously or am I about to put myself through nested asynchronous synchronous multithreaded hell
if you have the blockstate you can do whatever async
but you cant get a blockstate async
๐ฅฒ ChunkSnapshots only get you so far
your internet is broke and cant reach mojangs servers
what version you tryna get
if you want the api, its all on nexus
?maven
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
What's the difference between BlockData and BlockState I feel like CreatureSpawner should be in BlockData but its in BlockState
ahhh ic
nothing but the good old docs yk I was hoping this wouldn't be painful
State contains the NBT data of block entities
Data contains the states
Because confusion
no doesn't State Contain the Data and Data doesn't contain anything
you can only create empty block states with BlockData
I wonder do you think it'd be easier to read the raw NBT asynchronously with NMS or would that break to
/shrug
epic /shrug fail
I donโt know if you can read the BlockEntity from the world async
Which contains the NBT data
so I'd be forced to sync either way huh
well pain
time to start over again at square one
Why not pass all the states along with the snapshot to your async stuffs
that would be an unbelievably expensive operation
How so
how can I realistcally pass the states of thousands of blocks without causing lag
I need to do work dist on the block states as I'm doing with ChunkSnapshots atm
you get them from teh snapshot. lag shoudl not be an issue
you can only get BlockData from a snapshot
you don;t use teh snapshot to read chunk data
not BlockState
You can easily get all the tile entities with Chunk#getTileEntities
true didn't think about that
can you safely read chunk data async otherwise?
I thought that was kinda the whole point
I frozen in time capture of the data in the chunk that ensures ThreadSafety
Why do you want to read from teh chunk and not the snapshot?
I would prefer to only read from the snapshot but the snapshot isn't able to get BlockStates
correct, it gets BlockData
unfortauntely blockdata is useless for my current issue which is getting spawner type
which is stored in the BlockState
since spawners are a TileEntity iirc
ah yes, you can only get a default BlockState
so if a Block is a spawner I'll need to queue a task on the main thread and retrieve the block state for the continual operation
Yeah just grab all the spawners before hand and pass them along with the chunk snapshot
there will not be many TileEntities, you could get them and pass at teh same time you do the snapshot
do you think that won't be an issue. I mean I feel like it'd be more graceful to go with my solution. Let's say I have to scan 1,000 chunks (idk how big towns can get in towny), but wouldn't passinng through all those tile entities be a waste if I won't use 90% of them most of the time I guess I could make some data class and have my mainthread task scan for spawners as well ๐ค , but idk how future proof that is if I start considering other tile entities as well. I'm open for feedback I'm kinda new to these levels of asynchronous logic lol
your main class
put the path to it
you are scanning claimed chunks to do?
just get a count of specific block types
is there a reason?
kinda like /is value in a lot of Skyblock plugins if yk what I'm talking about
no clue
You could also make your own snapshot that contains spawner data
it counts up all of the "value blocks" you have on your island and adds them to a total score and you're placed on a leaderboard based on that
I wonder if I could actually use NBT here instead ๐ค though I'd have to scan initially anyways
Well I'd suggest just grabbing all the tile entities you need and passing with the chunk. It's really simple ```java
public List<Chest> getAllChests(Chunk chunk) {
return Arrays.stream(chunk.getTileEntities()).filter(Chest.class::isInstance).map(Chest.class::cast).collect(Collectors.toList()); //newer Java .toList();
}```
yeah fuckit I'll do it like that ๐ฎโ๐จ its ashame I have to go back to square one here with a lot of my logic though I completely overlooked that ChunkSnapshots can only get BlockData
thanks for all your help
your main would be main: com.mcorsen.main.MainClass
ur missing a java and a main class
do you use maven
k, this is what the setups should look like
you should have one
are you not using an ide
@young knoll this is ur issue now
maven or gradle usually helps
can't you just track whenever they place a block and add that to the island data ?
store like a Map<Material, Int> // int representing the amount of that type
Yeah I was about to think about that but it gets flawed asf quickly
To what degree does Mojang's anti-distribution licensing apply? If I were to maintain a non-public repository containing decompiled code, would that be against their policies?
Obviously publicly distributing a compiled jar is bad, but if one can privately "distribute" a compiled jar (from one of their servers to the next), should the same apply for code?
I made it now like this, but I do have the shadow there, is there a way to remove the shadow somehow?
Probably with a core shader
uhhhmmm XD
like this?
https://github.com/McTsts/mc-core-shaders/blob/main/remove text shadow/rendertype_text.fsh
Yes, now you just need to set the opacity of your text that should not have any shadows to 254 instead of the normal 255
you mean the white dots?
What exception is thrown if reloadConfig(); fails?
Depends on what went wrong
So this should be fine?
try {
SnowReports.getInstance().reloadConfig();
sender.sendMessage("ยงaConfig reloaded!");
} catch (Exception e){
sender.sendMessage("ยงcConfig reload failed! Check console for errors.");
Bukkit.getLogger().warning(e.toString());
}
But there are not too many cases where it throws an exception.
One could be InvalidConfigurationException if the user just wipes the yml file with empty text.
Meh, not really. I would not catch an exception here.
Just let it throw.
Unless you need to handle exceptions in a special way here
This line will create potentially very confusing log messages
Bukkit.getLogger().warning(e.toString());
do the shaders need optifine?
No they are core shaders
What packet tells the client health of the mount being ridden?
I would assume that the client gets this information from the metadata packet. No reason to
send additional packets if the client already knows the health of the mob.
And actually to elaborate, this repository would technically be accessed by multiple people.
I can not manage it to work because the colors are sometimes lighter sometimes darker I think, but that far, thank you
But it seems like I am not the only one:
https://user-images.githubusercontent.com/32773961/202585468-50f7663d-9df2-4ff1-b8ee-7beab1140783.png
If I set the health to 0, can the entity still appear alive to the client? I want to remove the health info.
Add credentials to the access. With multiple people its kind of a gray area.
Okay so to reiterate, I can store decompiled Mojang server code in a private repository but it's a gray area so I should try and protect it?
Sorry for being repetitive, it's just an important topic, of course.
im fairly certain this is a yesn't
as long as ur not distributing it u should be in the clear
Alright.
?paste
drunk free java lessons
me.superischroma.spectaculation.item.weapon.GyrokineticWand.a(GyrokineticWand.java:286)
what is this
custom item
that seems to cause da issue?
Im guessing there is a while loop or something similarly stupid in there
yea
Show us some code pls
if it's your plugin ofc
public void gyroWandActive(Player player, Location loc, int arg1, int arg2) {
System.out.println("a1");
Location sloc = loc.clone().add(loc.getDirection().multiply(10));
if (sloc.getBlock().getType() == Material.AIR) {
System.out.println("a1.1");
Location cacheLocation = sloc.getBlock().getLocation();
for (int y = cacheLocation.getBlockY(); y > 0; ) {
if (cacheLocation.subtract(0.0D, 1.0D, 0.0D).getBlock().getType() == Material.AIR) {
y--;
continue;
}
gyroWand(player, cacheLocation.add(0.0D, 0.0D, 0.0D), arg1, arg2);
cylinderReset(cacheLocation.add(0.0D, 0.0D, 0.0D), 10);
}```
oh wait 286
you dont call y++
This means you changed your code after this stack trace occurred.
Reproduce the error with your current code and send it again pls.
This loop is dangerous in general
Because it doesnt have a hard limit
I was told to remove the y--
this decrement is coupled to a condition. Thats not a hard limit
Why the fk is this method called "a"?
With b and c variables...
code pls
Is it unchanged?
?paste
na some changes
me.superischroma.spectaculation.item.weapon.GyrokineticWand.a(GyrokineticWand.java:283)
[04:56:17 ERROR]: me.superischroma.spectaculation.item.weapon.GyrokineticWand.startGyrowandAbility(GyrokineticWand.java:152)
[04:56:17 ERROR]: me.superischroma.spectaculation.item.weapon.GyrokineticWand.onAbilityUse(GyrokineticWand.java:66)
[04:56:17 ERROR]: me.superischroma.spectaculation.user.PlayerUtils.useAbility(PlayerUtils.java:426)
[04:56:17 ERROR]: me.superischroma.spectaculation.item.ItemListener.onPlayerInteract(ItemListener.java:67)```
283
Alright, only need the code now
judging the fact you run these 2 methods every tick forever, it doesnt surprise me why its crashing
Ok but why do you clone the location and then add 0 to it?
hmm
You should not create a Runnable for every yaw. Create one Runnable that handles the whole circle.
He has a cancel safeguard for the runnable
oh i didnt see the cancel
Im seeing quite a few things that can crash the server or seriously tank the performance here.
The whole loops logic makes little sense to me
System.out.println("d1.2");
Location cacheLocation = sloc.getBlock().getLocation();
for (int y = cacheLocation.getBlockY(); y > 0; ) {
if (cacheLocation.add(0.0D, 1.0D, 0.0D).getBlock().getType() != Material.AIR) {
y++;
continue;
}
for (int i = 0; i < 40; i++)
a(cacheLocation.clone().add(0.0D, 0.0D, 0.0D), (i * 12));
pullingMobsTo(cacheLocation.clone().add(0.0D, 0.0D, 0.0D));
}
I mean I added the d1.1 thing to debug
so only d1.1 is executed and the server then shits itself
Let me show you how i would tackle this
Ok you need to explain to me what you are trying to achieve in this loop. The more i look at it the more scuffed it gets.
the cachelocation right?
Explain to me in plain text what "startGyrowandAbility" should achieve.
oh right
it should do something like this
the animation and pulling the mobs into the thing
Ok. So the first thing you need is the block the player is currently looking at.
This is done through a ray trace because the distance to the block will fluctuate greatly.
You can not just assume 10 as a gixed distance.
You are using 1.8 so ray tracing is not supported by spigot (The version is a decade old soon, why tf you use it at all)
You are taking a step back and breaking down this ability into smaller pieces.
The first problem you need to solve:
- How do i get the Block, a player is currently looking at.
After that we can continue with how to implement the effect
Do you have BlockIterators in 1.8 already?
Fk i hate this old garbage version. Why do people insist in using it?
Tell me when you solved the first problem. Afterwards ill explain to you how to properly create the effect
without any lag or crashes.
I know api support isnt that great
but man just have a bit mercy on my pc
?paste
Minecraft 1.8.8 is 8 years, and 1 day old today.
(2924 days)
hi md
Omg birthday party!!!
Your task is to implement this now:
public class PlayerUtils {
public static Block getTargetBlock(Player player, double maxDistance) {
}
}
Send me your code when you are done.
Pls... im giving you a proper approach to this with reusable code.
You really want to implement this method and reuse it for other abilities.
Yo I got a question for you, do you have a public project that uses koin? I can't wrap my head around parts of it in spigot plugins and I saw you talking about kotlin around a year ago
@EventHandler(priority = EventPriority.HIGHEST)
public void onNametag(PlayerInteractEntityEvent e) {
Entity entity = e.getRightClicked();
Player p = e.getPlayer();
if (p.getItemInHand().getType() == Material.NAME_TAG) {
if (getConfig().getInt("CharacterLimit") > 0) {
if (entity.getCustomName() != null && entity.getCustomName().length() >= getConfig().getInt("CharacterLimit")) {
entity.setCustomName(colorize(getConfig().getString("LimitReplacementText")));
}
}
}
}
Hi this isn't applying the first time i use name tag
Nope, i wrote a ton of kotlin but it was for closed source project.
Ah alright
I got nothing sry smile
You mean for the getTargetBlock method?
He is on 1.8
1.8 didnt have that?
1.8 didnt have a ton of stuff. Cant even send an actionbar without nms
Ban Items Plugin
Huh?
yeah
be patient you won't get help going around to every channel
what about it?
o
I would help you but i dont have a 1.8 project setup.
You need to find threads from half a decade ago. This problem
was solved by someone in the past probably.
asking the dev of the plugin would have helped but the dudes long gone
i mean i got these API methods @quaint mantle @lost matrix idk
had a 1.8 plugin in intellj to try n help a guy with scoreboard stuff lol
whats up
?paste
u were looking for uh
getTargetBlock in 1.8?
some form of them seem to exist in 1.8**.8** at least
na its something else
I know how to create recipes, but how to create recipes that works only in some cases, like you can craft a custom sword only if you are in a fight?
Register the recipe then listen to the https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/inventory/PrepareItemCraftEvent.html event and set the result in the crafting table to air (null) if it doesn't match your condition
declaration: package: org.bukkit.event.inventory, class: PrepareItemCraftEvent
thanks
Hi, on spawner break i need to check if it is registered on the db.
What i do?
Load all data at start?
Just load spawner at chunkload?
Request the db at spawner break?
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
What is PDC?
Yes but i need to store it il db for other interaction when my bloc hot breaked
then I'd just use a Set<Location> on startup
but how do I get who crafts the item? Does that work: java Player p = (Player) e.getViewers().get(0);
however I don't see any reason why you couldn't use the PDC
you could also listen to chunkloadevent, then get a set of all blocks with custom PDC and add the spawners to your set then
if my laptop keeps telling me that keeping my screen on hight brightness increases carbon emissions I'm going to have a conniption
I want to get the item from a player hand, but when the player holds a Netherite item, I will get AIR as a type
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player player) {
PlayerInventory playerInventory = player.getInventory();
player.sendMessage(playerInventory.getItemInMainHand().getType().toString());
}
return false;
}```
you didnt set an api-version in plugin.yml and hence have legacy material support enabled
set an api-version in plugin.yml
in quotes
you didnt set an api-version in plugin.yml and hence have legacy material support enabled
ouhhhh
it throws me an error.
Unsupported API version 1.2
I wrote api-version: 1.20
your spigot version is outdated
old 1.20 versions have a bug that require you to put "1.20" into quotes
api-version: "1.20"
np
Hello, how does I enter my ItemStack for this ItemDisplay packet ?
you has bukkit?
spigot with mojang mapping
I think I found: net.minecraft.world.inventory.Slot
Hi, on spawner break i need to check if it is registered on the db.
What i do?
Load all data at start?
Just load spawner at chunkload?
Request the db at spawner break?
I already answered this exact question
yes but as I am still learning spigot, I preferred to avoid going through your system.
PersistentDataContainer
What are you tring to make
Yea
Persistentdatacontainer
would be the best approach
CustomBlockData or to just load a Set<Location> from their DB on startup
i a green with mfnalex here
agree**
Another suggestion would be creating an Array wouldnt it?
my plugin is simple. When a palyer palce a spawner. The spawner got protected (if the spawner got break, the player can get it in a gui)
so, on spawner break i need to check
yes at the beginning I loaded the whole db in an array at the start
@tender shard Would there bea anything wrong with writing an array with the blocks to the Database, and on startup reading the Locations?
ah i can stock the owner name i the nbt?
well the problem is that if there are 1500, I can't load everything when I start and unload when I stop
What you could do, is create a custom Object, that stores block Locations, The player that placed it
I mean, in the data of the block like the nbt
PersistentDataContainer basically is NBT but you said you didnt wanna use it
You could check if a player places the block then check if the DB contians the coords
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
I misunderstood what it was I was looking at.
Yea, that would be the smartest
It is basically a "containter" that saves data to a certain block, even when the server restarts
I had an article about working with data.
Data is transfered from the in rest state (DB, File, etc)
to its in use state, when the session of the data starts.
It is written back to its in rest state when its session ends.
Some examples for sessions are:
Player session
- Starts when player connects to server
- Stops when player quits
Chunk session
- Starts when chunk us loaded into memory
- Stops when chunk is being unloaded
World session
- Starts when a world is loaded
- Stops when a world us unloaded
So in your case i would load the data when the Block (and subsequently its chunk) is loaded.
And saved back when its unloaded.
oups
you want say
when the chunk's block is loaded?
If you want to use the PDC of your TileEntity, the PDC of the Chunk or a Database
is secondary in my opinion.
A chunk loads with all its blocks and tilestates. Thats what i mean.
Which method you use also depends on the size of your data and how many instance you expect in one chunk.
Last thing you want is extra data significantly slowing down your chunk loading. This could occur with the PDC of
chunks or Blocks.
the problem is that with dozens of players connected, it will sometimes load several dozen chunks per second.
Or in the onChunk load, I loop all the chunk's blocks in async and if there's a spawner, I request? because if I request the db for each new chunk, it's too much.
i just need to store the owner and the location but with pdc i don't need location because the block is placed
You should never loop through all blocks.
Get your X and Y of the chunk and incorporate that for your DB accesses.
Why do you need a DB if you store half of your data in the PDC anyways?
Or vice versa.
yes, but in this case I have to query the db every time a new chunk is loaded? As I was saying, with 10 players, that would mean several dozen queries per second.
Why bother with the PDC if you store everything in a DB.
because then I need access to its data so that players know where their spawners are placed.
I dont see an issue here. Those queries will take micros (if the DB is on the same machine).
And i sure hope you do them from a different thread.
yes in async
so let's say I have 10 chunks loaded per second, that's 60 requests per minute, isn't that a problem?
Then create a table with chunkX and chunkY as two primary indicies
an other table ?
And a proper database can handle thousands of requeuests per second
ah okay I just learned it.
cache where possible
I thought about it
so you don't do db request for some frequent stuff
You can always batch request the chunks over the last N seconds. This way you dont have to
send too many requests.
me.mcorsen.main.main
how do I go about it?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
hey, i'm implementing a verification system for linking discord to minecraft. it's fine to not use a database if i do not care about losing the codes on restart, right? they only last 15 minutes and i just want to use an ExpiringMap and not bother working with yet another table
so it's better to use onchunkload rather than pdc?
You simply wait N seconds and then create a batch request of all chunks loaded in those N seconds.
ah yes
Never said that. I asked you why you want this data in a database in the first place.
just store the code in a hashmap and with an expires instant and u'll probably be fine
ah okay
yeah i want to do that too
just make sure you setup the linking mc creates the code and discord recieves it
i wanna use the https://github.com/jhalterman/expiringmap though
it's very handy
used it a couple times
looks useful
yup ๐
this is cool too
yeah i used it in my previous project and it was really convenient i wanna do it again
is it thread safe?
Caffeine?
this
actually have not looked into that, but there's probably info about that in the docs
yes
otherwise is not that fancy
Use caffeine instead
A high performance, low-overhead, zero dependency, thread-safe ConcurrentMap implementation that expires entries. Features include:
what's that?
caching library
and which paroche would you finally recommend? (you know better than I do). But storing the owner in the pdc would make it possible to retrieve it when the sapwner is broken and send it to the db (or cache) and thus avoid massive chunk loading. This seems more optimized to me.
LoadingCache<String, DataObject> cache = Caffeine.newBuilder()
.maximumSize(100)
.expireAfterWrite(1, TimeUnit.MINUTES)
.build(k -> DataObject.get("Data for " + k));
Example
A cache that requests data if its not in the local map
wait builder? is it immutable?
it's a kind of hashmap but you can program automatic evactuation
You can always evict entries but never live modify its content.
it seems like you can make it mutable
alrighty, i'll just try to start, if i'll be having problems i'll consult you ๐
for caching it's pretty good
and which paroche would you finally recommend? (you know better than I do). But storing the owner in the pdc would make it possible to retrieve it when the sapwner is broken and send it to the db (or cache) and thus avoid massive chunk loading. This seems more optimized to me.
if the spawner is being broken, the chunk has to be loaded doesnt it?
You should decide now.
Store the data completely in the PDC
Store the data completely in a Database
No splitting.
And you should have a good reason for a Database because this will make
the system significantly more complex to implement.
you can hold a reference in the db and store the data in pdc
the player must be able to access the list of his spawners placed with their coordinates etc... when a command is needed to open a gui.
My idea was to store everything in the db. Just use the pdc on the placed sapwners so you don't have to check with the db if this sapwner has an owner. But otherwise I can just make an async request to the db when a sapwner is broken.
Pdc is fine
I mean if u wanna make a fkn data analysis or sth, good luck pdc trolled you, else its viable
iโve got a bounty command that checks if the player has enough money in their account and if they do itโll remove a given amount via withdrawPlayer(). if the player spams this command, it just stops taking the money out, meaning that players can glitch money into existence. what can i do to fix this? iโm using the vault API with essentials economy - both latest versions.
you could add a cooldown to the command
theres no reason for players to spam this command
yeah thatโs fair
is it just vault stopping it from repeatedly executing the same action then?
honestly woulnt be able to tell without directly looking at the code
could be a number of things

- you have not registered your command
- next time please send code walls with a pastebin like ?paste
np
?codeblock
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() {
}
}```
yeah but it's for shorter codes
if it's a text wall there's no need to block the entire channel with it
just use a pastebin
yep
I was going to combine the 2
if i palce a block, on break i can get the pdc?
When the player crafts something, can I somehow leave a certain item in the crafting slot? Like crafting with buckets 
You have set the executor of the command to be the plugin (this) 
You need to set it to be the class of the command which has to implement CommandExecutor iirc 

It's spigot lol 
They only deprecate, they never delete or rename 
With what 
You need to have the command in your plugin.yml, but you also need to have a command class and register it 
All I know is how you would do it usually 
Surprised there isn't a method for this, although I'm not sure if it only applies to complex recipes. Open a feature request, could be pretty easy
What the heck is a feature request 
?jira
a request for a feature to be added
Hi, if i understand, PDC is for items. And TitleState for placed blocks?
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
PDC is just a general container that's present in
- Entities
- Chunks
- Items
But projects have been made for blocks as well
then update them 
what is the differences betwwen this libs and jusste TitleState?
TileState is specific to tile entities and doesn't apply to all blocks
It is also only specific for managing that block's data instead of serving as a container for plugins only
A tile state, for example, is a furnace, where it manages burn time and its inventory slots
While with PDC it's basically just a fancy map that's saved in file
Is there any way to force run all pending tasks for a given plugin
what a headache
ยฏ_(ใ)_/ยฏ
I've been writing multi-platform code lately and now I understand why worldedit has their own class for everything
it's a headache
Suppose I do some db stuff in an async task, and the server shuts/disables my plugin before the task ran, then it will just get cancelled
ah
Easy fix then
For DB stuff just use completablefutures
And put each future in a map/list/whatever
When they complete or give an exception, remove them from the collection
is there a way to register permissions in code (so that it will show up on permission managers like LP)
And make a flush method that returns an allOf of the futures, and join it onDisable
if you define them in plugin.yml they will show up too afaik
Bukkit.getPluginManager().addPermission
LP does something funky with permissions
it'll show there
I want to import it from a config file
i tried
ty ill try it out
It has a weird injector thing that every time you call hasPermission it adds it to the possible permissions list
Bukkit.getPluginManager().addPermission(Permission("ab.cd", PermissionDefault.FALSE)) off the top of my head
hmm alr
when i registered perms like this, they showed in tab-complete for lp
Just don't create a new permission object every time you try and use it
Since creating one should register it
I would use my own executor service for stuff like this.
This way you can just call shutdown on it and await execution.
oh ffs then I have to rewrite so much stuff
average concurrency moment
Why? This sounds like a design problem. Switching from my own scheduler to
the bukkit one would take me maybe 10mins reimplementing 3 methods with 5 lines or so each...
smile still hasn't realized he's a 10x developer
because currently by data abstraction by design has blocking methods, which I purposely call using async tasks in commands n stuff
lmao yeah you're screwed
oof
time for non blocking callback hell ig
I should just write yet another guide about how IO should just use futures and not blocking methods
so you can properly join stuff
Dark side
I don't think you need to
You can just send a runnable into the executorservice
Exactly same as runAsync
JฬดฬอOฬดอฬIฬดอฬNฬทอฬ ฬทฬฟฬUฬดฬฬ Sฬตอ
If he uses Runnables and not an anonymous or concrete implementation of BukkitRunnable
with some internal cancel() logic then true. He can just pass the runnable to an executor instead
of the BukkitScheduler
So might not be so bad after all
le big CTRL + Shift + R
with some regex
and the need to adjust every single number from ticks to ms
yea it's just runnables atm, but I'm contemplating life choices rn
take a break for like an hour, get refactoring when your head is more fresh
coding well is cool but having stable mental health is cooler
i have neither
coding is my escape, i dont want to go back to reality ๐
Yo smile I have a minor question
So I made this crappy matchmaking thing for my skyblock core
But I'm not a fan of how I have to do a big query to get all the server data I need for the matchmaking to be accurate
And I feel like it can fill up the ram and be a point of failure
Any better way to do this without relying on a microservice?
I don't think it's going to be that bad
But I'm still not a fan
the big query
does anyone know if there's an api for the website? or some way to get the plugin information (specifically the downloads) from the site? ๐ค
spiget? https://spiget.org/
spaget
thank you ๐คฉ
np
lol
I have an other idea on spawner break i just made a request to the db if the spawner is registerded directly ?
i got this error why ?
https://paste.md-5.net/waxiyahejo.sql
why do you wanna use a db in the first place
cross server maybe?
?nocode but seems like you're inserting a duplicate value where it's not allowed
Itโs hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
because you can't have duplicate primary keys
show query
You could just get the PDC of the block and check if it has the boolean protected?
Im not 100% sure i understand why you need matchmaking for skyblock.
But you probably dont need this map to be a concurrent map.
For your problem: This is a common problem because you have no master server.
Describe to me what the matchmaking is for.
i check
This skyblock plugin works as a sort of network, the "matchmaking" part would be for load balancing, to decide what server should be responsible for loading the player's island.
There's no singular server responsible for everyone, just a bunch of instances that load and unload island on demand
Load balancing is done on the proxy
Correct
I'm just afraid that fetching all the loaded island ids from redis is a bottleneck in scalability
ohhhh wow ๐คค
I can do sooooooooo much more than i initially though i could with this api for my portfolio website ๐
Then your approach sounds fine to me.
Just let all server subscribe to a redis topic and
post their data if the proxy requests it.
But there is a simpler solution: The proxy knows every
connect and disconnect. He can simply keep track of
that locally and apply its load balancing strategy accordingly.
Yeah but what if there are multiple proxies
haha, good for you ๐
You're telling me that instead of doing a request to get all the island ids, I should have it at all time?
That'd just constantly take up RAM
Maybe 2 MB for a thousand players
Well
So would my approach
But I don't see any skyblock network with a million players so this isn't a concern yet
- the overhead of requesting everything
Wait... you mean... all ids of all player, ever?
No
Not the currently loaded ids?
Just the ids of the loaded islands
Keep that sht in memory
Your approach is fine
Or memcached
Thats in memory
couchdb? idk
Just some other cache database
It's just implementing an interface
But yay I can sleep at night
knowing the network won't explode due to this
Doesnt matter if its on the proxy or in redis.
Just a map in redis that knows where every island is loaded.
No need to request it every time a player wants to join.
This only runs if the player's island isn't loaded
If it's loaded it just picks that server
I also do some checks on player join to prevent duplicate loads
It's a bit icky because I have a profile system
But it works
(I think)
Ok but what prevents you from having a centralized Map<UUID, ServerName> in redis
where you simply let servers write in loaded islands and remove them if they unloaded the island.
Combined with a Map<ServerName, Integer> for the amount of islands which can be used for the load balancing.
Right now it's basically just a huge Map<UUID, ServerName> yeah
Hi! I started learning a while ago, can y'all give me simple tasks to do to test my knowledge?
Have fun
Thank you
Yeah you should be fine. This system is probably overkill anyways.
the entire project is ยฏ_(ใ)_/ยฏ
I want to add minestom <-> spigot interoperability for shits n giggles
How did you solve the unbearable lag when loading worlds?
as well as velocity <-> bungee
World pool
Entirely configurable
Woah everything here seems doable for me
Go for it
Mfw smile gives my suggestion a few days later.
Vindication ๐
Does that include the anti cheat bonus challenge :p
looks blurry grr
Uhm thats too much xd it's beyond my capabilities
I've been doing spigot for 10 years
Damn
Still haven't touched anti-cheat
Been coding for 12, spigot for 6 years
Don't really intend to either
Anti cheats are butchered beyond believe
I don't have the trig skills required for an anticheat
When did spigot get forked off bukkit?
Damnn so its that complicated to create an anti cheat
Spigot took over in 1.8
Been reliably failing math class for like 4 years now
Ive been coding for 4.5 now i believe. Or even 5 at that point? 
I don't actually know when spigot initially forked
How do u fail over and over again
yeah but you got like 19 degrees
I stopped caring
I mean u must learn from ur mistakes
Damn
I've been coding for 2.
And because it works like golf, I win ๐
Also learning to code as an adult is a bit easier
Idk about that
I started coding at 12
Dont make me feel old...
I was like 6 and had about 2 braincells working together
I feel like it's easier to learn when brain is still deveoping
lol
Idk I'm not a science
I tried c++ when i was 11
Im 15 I started coding 9 months ago in roblox
LUA moment
Go to the church and ask God to forgive you
Its ass
Now I'm 18 and I look up to my elders :p
When the array starts at 1
Damn straight you do kid ๐
not you
Did you just insult LUA
theres nothign wrong with it
its a lovely language
except that
Did that once with a friend. We actually made money with absolute garbage.
Felt bad, took it down and didnt touch it since. You can straight up implement
gambling for children in there with lights and colors. Kinda sad.
how many roblix did you get
Fr fr
bobux
Hello there, so im currently having a slight issue
So i've been struggling with getting a specific schematic file from my plugins resources to be saved in the plugins datafolder
https://paste.learnspigot.com/lisodemuye.csharp
This is the error im getting when trying to install the plugin
saveResource("schematics/standardplot.schem", false);```
The method im using to try and copy from resource to datafolder
https://i.gyazo.com/a5890287c8fd5cfea9ee80a451483c16.png
The Image shows the structure of the resource folder
https://i.gyazo.com/44277a324e628278ca57e7b17323e73a.png
And the second image is the structure in the target folder
LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.
Ah hell yeah lights and colors
ur proabably resource filtering it
How so?
Anybody know how i can create documentation like this?
let me check
It's called
comments
But it was around 2k i believe
I wrote it all by hand
My comments are racist tho
different audiences ig
