#development
1 messages Β· Page 109 of 1
yeah default is fine
i mean you need to give it the address, username and passwd
yes lol
hikari = new HikariDataSource();
hikari.setDataSourceClassName("com.mysql.cj.jdbc.MysqlDataSource");
hikari.addDataSourceProperty("serverName", host);
hikari.addDataSourceProperty("port", port);
hikari.addDataSourceProperty("databaseName", database);
hikari.addDataSourceProperty("user", username);
hikari.addDataSourceProperty("password", password);
com.mysql.cj.jdbc.MysqlDataSource
do I need to add new mysql dependency or is it in spigot ?
Not sure about spigot, but it's in Paper for 1.17 and above
oh that's neat ig
never used it like that lol
probably never will
yeah i thought it was pretty cute
I keep having this error ```java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30001ms.
do someone know about it ?
I tried to fix it the whole day
it's like it freezes the hikaricp connection
lol I would even pay to know the solution
how can i get the Anvil Rename field Text and then change the Output of the Item name to something different
Does it ever connect?
how to make timer in item lore? like how to change item lore while inventory is opened by player?
Change the item and Iβm pretty sure there is an update inventory method
ok
i have a method to save an entire array of itemstacks into a database 
somewhere
might be your itemstack then

what is your itemstack
id also remember that i dont catch exceptions there
try doing it without that

try doing my exact method and just using a single item list
or your issue is with your sql table
What can i use to create a custom HUD similar to the hunger bar
Unable to make field private java.lang.Object java.lang.ref.Reference.referent accessible: module java.base does not "opens java.lang.ref" to unnamed module
Anyone know how to fix this when doing Gson#toJson(Object, Type, Appendable)?
It works in another plugin on the same server that I also made with the same code π
tried shading & relocating gson but same result
https://i.imgur.com/H2C21Nj.png
never hmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
does anyone know how to sendTitle ;--;
void sendTitle(@Nullable String title, @Nullable String subtitle, int fadeIn, int stay, int fadeOut)```
Sends a title and a subtitle message to the player. If either of these values are null, they will not be sent and the display will remain unchanged. If they are empty strings, the display will be updated as such. If the strings contain a new line, only the first line will be sent. All timings values may take a value of -1 to indicate that they will use the last value sent (or the defaults if no title has been displayed).
title - Title text
subtitle - Subtitle text
fadeIn - time in ticks for titles to fade in. Defaults to 10.
stay - time in ticks for titles to stay. Defaults to 70.
fadeOut - time in ticks for titles to fade out. Defaults to 20.
title = main text
subtitle = smaller text below the title
fadein/stay/fadeout = time in ticks
ok
i was using this
player.sendTitle(ChatUtils.chat("&aSURVIVAL"), ChatUtils.chat(""));
and this
@SuppressWarnings("deprecation")
don't suppress deprecation - just put like 10, 70, and 20 as the parameters
ok
its giving error
what error?
'sendTitle(java.lang.String, java.lang.String)' in 'org.bukkit.entity.Player' cannot be applied to '(java.lang.String, java.lang.String, int, int, int)'
player.sendTitle("Hello!", "This is a test.", 1, 20, 1);
it literally says it right there
?
player.sendTitle("&aSurvival", "test", 10, 70, 20));
It only takes 2 parameters
You're sending it 5
How long in ms does it take to compair a string to another string if they are both the same size?
<1 ms
does anyone know how to hook papi into plugins
i want my plugin configuration also add papi hook
if i was to iterate over a string array with 400 different strings checking if each string was the same as my own string how long would that take?
does just adding it to maven and adding papi as soft depend make it hook into papi?
that's the start of it lmaoo
i dont currently have the values for this string array so im not sure how to start
is this where i can ask for help on plugins that i'm working on developing ?
Yes
awesome, so i was reading this article a while ago cause it's something i thought about and wanted to actually get to work i just need some help on getting it setup
not sure if it'll let me link it lets see
oh cool so yeah, the posting by "Nikl" is kinda what i'm trying to do
do someone know about my issue please ?
it keeps freezing hikaricp connections
looks like it's not connecting
no it is
Ok, so what do you need help doing currently?
it's after a few statement
not what that message says
so currently i just wanna make a log like that link is doing
it's a listener for all events sorda
this is kinda how i'm gonna get it eventually
here's AbsAbility class https://paste.helpch.at/yovaduwoqa.java
@formal locust what's the problem?
I want to have multiple COLOURS IN .withColor(Color.GREEN) and i want it to be configured from config
type: BALL_LARGE
power: 1
flicker: true
trail: true
colors:
- AQUA
- RED
- TEAL
- WHITE```
like ``` colors:
- AQUA
- RED
- TEAL
- WHITE
im not familiar with firework meta, is the withColor method for the trail of the firework or the explosion
its from builder()
no i know, i mean like if you run that code, does green appear as the trail or explosion
Trail
so you want a multi colored trail right
yea
have you looked into the FireworkEffect.builder()
wait i will look
@lyric gyro So the problem is that it's not printing the event name?
oh
ok
currently, it would spam my chat log with ChunkLoadEvent which is fine. but I'm trying to get it to print the PlayerJoinEvent whenever i log on but it doesn't
FireworkEffect.Builder
withColor(Color... colors)
Add several primary colors to the firework effect.
i got it
do you know how to use that
cause i know bukkit's Color's class doesn't have a Color.getByName
yes...
thats the hard part
:(
switch case π
switch (colorStr.toUpperCase()){
case "WHITE":
return Color.WHITE;
case "SILVER":
return Color.SILVER;
case "GRAY":
return Color.GRAY;
case "BLACK":
return Color.BLACK;
case "RED":
return Color.RED;
case "MAROON":
return Color.MAROON;
case "YELLOW":
return Color.YELLOW;
case "OLIVE":
return Color.OLIVE;
case "LIME":
return Color.LIME;
case "GREEN":
return Color.GREEN;
case "AQUA":
return Color.AQUA;
case "TEAL":
return Color.TEAL;
case "BLUE":
return Color.BLUE;
case "NAVY":
return Color.NAVY;
case "FUCHSIA":
return Color.FUCHSIA;
case "PURPLE":
return Color.PURPLE;
case "ORANGE":
return Color.ORANGE;
}
return null;
}
**```
god
like this π₯²
ur awsome
i have to use this as utils right
yes
ok
with something like this you'll be able to just use the getColorFromList method to get all the colors from your config and just use that in your builder
kinda like this
cache the map instead of creating a new one everytime
@lyric gyro thanks :)
yeah i would've just made it quickly instead of making a whole utils class for him
hmm..yeah... π
feel like i'm being doubted here...
loll..nah
for this code just use a constant Map why create a new one everytime
So I'm trying to help someone make an item that is glass but it cycles through the colors, I tried just using a runnable to set the type but that doesn't translate to the actual item. Do I really need access to any inventory that the item is in to modify it like that?
ie
public class HelmetThing extends ItemStack {
// ...
private void startColorCycle() {
BukkitRunnable runnable = new BukkitRunnable() {
private int currentIndex = 0;
@Override
public void run() {
Material material = colorList.get(currentIndex++);
setType(material);
if (currentIndex >= colorList.size()) currentIndex = 0;
}
};
runnable.runTaskTimer(RandomTest.getPlugin(RandomTest.class), DELAY, CHANGE_INTERVAL);
}
}```
I tried messing with the ItemMeta as well but same result
Keep having this error after a few time a execute this method : ```java
public List<OfflineEPlayer> getOfflinePlayers() {
Database database = Plugin.getInstance().getDatabaseManager().getDatabase();
ResultSet resultSet = database.getAllValue(SettingsManager.PLAYER_DATA_TABLE);
List<OfflineEPlayer> offlineEPlayers = new ArrayList<>();
try {
while (resultSet.next()) {
offlineEPlayers.add(OfflineEPlayer.getOfflinePlayer(resultSet.getString("username")));
}
resultSet.getStatement().close();
resultSet.close();
} catch (SQLException e) {
e.printStackTrace();
}
return offlineEPlayers;
}```
this is my get all value function :
public ResultSet getAllValue(String table) {
try {
PreparedStatement preparedStatement = getConnection().prepareStatement(
"SELECT * FROM `" + table + "`");
return preparedStatement.executeQuery();
} catch (SQLException sqlException) {
sqlException.printStackTrace();
return null;
}
}```
U sure the database is connected?
show me your setType method
It's not mine, it's inherited from ItemStack
ah, didn't realize you extended ItemStack
I dont think you are supposed to do that
please tell me what error is coming
.
Probably not haha, was just toying around to see if this would work. So now I'm looking into how to actually do it
- Wait
- Provide code
- Wait
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask((Plugin) this, new Runnable() {
o
Yeah, it seems like this way isn't possible because the ItemStack isn't tied to an actual nms item instance yet so any updates just fall on deaf ears
what to do
here?
use plugin, you are casting a listener class to Plugin
You need to pass in an instance of your plugin
yeah
Aight
so, is 4:45am, I'm about to go on a trip and I want to finish something before leaving: how the fuck do you use ByteBuffers? Like I have been looking for guides and so, but my brain cant understand them, I want to take possible ints and strings, buffer them, get a byte or bytes and use them, how would I do so?
context is for a networking packet project, it is so god damn addicting
I just manually do it. (Make own method to handle it)
Ensures itβs does it the way you want it π€·ββοΈ
ππ»
just use base64. ez
yeah. was looking for that
send the error in a paste bin maybe? https://paste.helpch.at
What's on line 32 of Rank.java?
probably one of these
plugin.getRankHandler().getRankSet().add(this);
this.load();```
ah
Give me exactly line 32
but exactly line 32.
is it the declaration?
yeah. makes sense. since the initialization is not done yet
at least that's what I'm thinking
I mean, just go down the list
if (plugin == null) {
return;
} else if (plugin.getRankHandler() == null) {
return;
} else if (plugin.getRankHandler().getRankSet() == null) {
return;
} else {
plugin.getRankHandler().getRankSet().add(this);
}```
I was going to ask how you were getting that lol
Hopefully not a static getter
wat the
well yeah. that's the problem. you should probably pass the plugin in the constructor.
not just probably, definitely
kek
yes exactly
anyone know any good library for GUI/Menu's for 1.18
yes. triumph gui
Looking for useful libraries/frameworks?
Here are some which have been deemed useful by the community and are used daily.
-> Menus: https://mf.mattstudios.me/mf-gui/gui
-> Commands: https://mf.mattstudios.me/mf/mf-1/getting-started
-> Messages: https://mf.mattstudios.me/message/mf-msg
-> Config: COMING SOONβ’οΈ
see first one ^^^
xD π ...i am always lazy to write those commandHandlers and those abstract classes for each and every plugin...
so, always try for some frameworks...Aikars ACF was a bit complicated for me
Hey i get a error on the entitydamagebyentity event when hitting a NPC
Anyone has that too?
I get this error and this is my code: https://www.toptal.com/developers/hastebin/zabipalonu.java
Don't mind my code it is a bit old.
something on line 42 is null. so either userdamager or userdamaged
i need some help with code.
i want like Message.<message_string> or the <message_string> it self
and it shall return plugin.getConfig.getString("<message_string>")
for p.sendMessage(<message_string>); or p.sendMessage(Message.<message_string>);
plz help me
because it is a npc
but it still scans it like a player
Anyone know a good HikariCp and SQLite tutorial?
the mc font isn't monospaced so you'd have to estimate and align them (there are many sheets out there with the pixel width of each character)
but the second someone uses a resource pack w/ a another font, it's invalid
no need to use hikari while using sqlite
just set different driver
any idea why this would be null?
getClass().getResource("patreon.yml")
patreon.yml is clearly there
try getClassLoader()
try adding /, like /patreon.ymla
getClass().getResource has never worked for me π
thanks π
Package 'jdk.xml.internal' is declared in module 'java.xml', which does not export it to the unnamed module
._.
π
getClass().getClassLoader()?
π₯²
oh lol
I think I broke maven, i try google on it but not find any help. Maven right now add hidden on every package even org,bukkit
Have not add any strange thing inside maven some should cause this, do this and no I not compile spigot/paper or something with the plugin.
please give response, few moments when I have connection
what even is the question
and when i offered you a little help you were a dick head
what dont you get
thats why I'm stupid, lmao now I regret
was on the first message
thats not a question really tho
I'll re explain tomorrow, I just arrived home and its late
also sorry for being a dick head, just I'm stupid
Hi! Having some issues creating a player head with players that have never joined the server. I've looked everywhere but I think I'm just dumb (or am missing an import). Using the SkullCreator(https://github.com/deanveloper/SkullCreator/blob/master/src/main/java/dev/dbassett/skullcreator/SkullCreator.java) I wanted to make heads for custom fish. The PropertyMap does not show any functions. The function private static GameProfile makeProfile(String b64)(line 260) when it attempts to call .put() on the PropertyMap it just gets highlighted red as if the function doesn't exist. I have looked for alternate solutions and couldn't find any. I have changed nothing from the class on github into my plugin.
Hey, I was trying to port a plugin to 1.18 only to realize nms was changed again so I started changing my 1.17 implementation to use reflection
I cannot get field a which returns an IScoreboardCriteria from the class
This is IScoreboardCriteria viewed on luyten:
https://gist.github.com/Oreoezi/9bce12088cc9bb93b118c6d4b44b24ff
These are the relevant parts of my class which error out
https://gist.github.com/Oreoezi/2031403198b0c051eea66073baffc347
What error
isnt relevant
I tried constructing a scoreboard objective and it gave
logging the criteria object gave null
Does if (event.getView().getTitle().equalsIgnoreCase(plugin.kgetConfig().GUI_name)){Not work with ChatColor.translateAlternateCodes?
is it possible to add an nbt tag to a gui ?
don't compare titles
just compare the inventories with .equals
okay, so that should work?
Yes
kek
which one of the two were you referring to by "that"?
That if i use ''equals'' and not equalsIgnoreCase the problem is voled?
But what would that make a difference?
Because the thing i am getting is a string
for equals, "String" and "STRING" aren't equal
yes i do know that
learn how to use InventoryHolder
instead of checking inventory titles
okay sorry, i will learn to use inventoryholder
Looking for useful libraries/frameworks?
Here are some which have been deemed useful by the community and are used daily.
-> Menus: https://mf.mattstudios.me/mf-gui/gui
-> Commands: https://mf.mattstudios.me/mf/mf-1/getting-started
-> Messages: https://mf.mattstudios.me/message/mf-msg
-> Config: COMING SOONβ’οΈ
which version
i dunno, but google it you will find people saying it will be deprecated
Quick example:
class SomeInvHolder implements InventoryHolder {}
class SomeListener implements Listener {
@EventHandler
void click(InventoryClickEvent event) {
final Inventory clickedInventory = event.getClickedEventory();
final InventoryHolder holder = clickedInventory.getHolder();
if (!(holder instanceof SomeInvHolder)) return;
// else just cast it and get extra data
}
}
hm thanks but that wasn't exactly what i was looking for
i just wanted a simple fix for my problem
explain problem
A soon-to-be deprecated
- Choco 2018
Soonβ’οΈ aka "Tomorrow" brought to you by "we'll definitely do it"
.
stripe colours. Title, after translating codes (basing in &) will return Some title instead &9&lSome title
but still, checking inventory using titles is bad practice
Renames an chest "Some Title" boom it is now a gui
Or compare inventories
oke, thankyou
@sharp cove you seem to not have understood my suggestion
I said to compare the inventory instances, not the titles (and using InventoryHolder is kinda iffy anyway)
how do i prevent people from taking items from a gui?
when i do shift click on some items they still go in my inventory
i do cancel it
but for some items it works but for other ones don't
Don't mind my bad code, gonna clean up after.
player.setHealth(0) fires entity damage event too right?
Good way to detect using damage event is player received damage or if /suicide command was used from plugins (which set health to 0)
i think so
If it doesnt, maybe you can use Entity#setLastDamageCause? There's DamageCause.CUSTOM
@wheat carbon does DocDex support nested classes?
yes
d;spigot EntityDamageEvent.DamageCause%CUSTOM
public static final Sound ENTITY_GOAT_SCREAMING_HURT```
public interface DragonFireball
extends Fireball```
DragonFireball has 1 extensions, and 10 super interfaces.
d;spigot EntityDamageEvent$DamageCause
public static enum EntityDamageEvent.DamageCause
extends DamageCause>```
EntityDamageEvent.DamageCause has 29 fields, 3 all implementations, 2 methods, and 1 extensions.
An enum to specify the cause of the damage
nice
oh
d;spigot EntityDamageEvent$DamageCause%CUSTOM
public static final EntityDamageEvent.DamageCause CUSTOM```
Custom damage.
Damage: variable
I didn't even know it was $
Was % your idea?
Thats how they are stored inside the jar, as a class that has the main class name and then a $
Probably that was your inspiration, or it just works xd
Ugly
Or just . tbh
^ better
public class PlayerMoveEvent
extends PlayerEvent
implements Cancellable```
PlayerMoveEvent has 1 sub classes, 1 all implementations, 9 methods, 1 implementations, and 1 extensions.
Holds information for player movement events
d;spigot Player#getName
@NotNull
String getName()```
Returns the name of this player
Player name
doots r for fqns
for?
it can't be the same
they need to be unique
otherwise you need a better search engine
hm
How would I send a message with deluxechat format?
Can you get the unix time using SimpleDateFormat?.
like is there any way to format the date to unix timestamp?
System.currentTimeMillis()?
no one that could help me?
not an option
why not
because I'm using the server expansion and I really don't want to edit it rn
there is a %server_time_<format>% placeholder which accepts simpledateformat
which I was hoping to use (also all this is not for me. )
I have a list of numbers: 4, 9, 15, 22, 30, 39, 49, 60, 72, 85 but I need it to go 75 numbers total
the pattern is adding 1 more from last add and 4 being the starting number
0 + 4 = 4, 4 + 5 = 9, 9 + 6 = 15, 15 + 7 = 22, etc
a for with += 1?
yea i can do that but was wondering if there was a cleaner way to do it or smth π€·
I think thats all you get
You can do it with streams
yeaa
Is that what you want
or a forloop that runs 75 times
(1..75).map {
var num = 0L
var i = 0
repeat(it) {
num += 4 + i
i++
}
num
}
this is what i have
but
it looks ugly
public List<Integer> pattern(int n) {
List<Integer> list = new ArrayList<>(List.of(n));
IntStream.rangeClosed(1, 75).forEach(i -> list.add(list.get(list.size() - 1)) + n + i);
return list;
}```
Not very pretty either lol
But should work
Replace 4 with n and yeah
But that's really not much prettier
Oh I see
You just removed the newlines and replaced them with semicolons from his code lol
yes
if its ugly in many lines, compress it to one line
ugly but with less real estate
I wonder if this could be simplified using the general formula for summing a range of numbers
I believe it's (n(n-1))/2
That or (n(n+1))/2
Yeah it's the latter
So you could just map each element to that minus the base amount
public int[] pattern(int n) {
int base = sum1to(n - 1);
return IntStream.rangeClosed(1, 75).map(i -> sum1to(i) - base);
}
public int sum1to(int n) {
return (n * (n + 1)) / 2;
}```
Something like that
Hello. Mysql question.
I have a column with text in it and the text that basically is a timestamp. How would I convert the entire row to type TIMESTAMP? Well I know that what I need is somehwo to convert the data from the column to be formated like this yyyy-MM-dd HH:mm:ss because when I try to run ALTER TABLE husktowns_towns MODIFY COLUMN founded TIMESTAMP; it just errors bcz it doesn't accept timestamps...
hey, so im making a plugin that uses the worldguard and worldedit apis, and i added them to the pom.xml but whenever i start teh server i get the error:
java.lang.NullPointerException: WorldGuard is not enabled, unable to access the platform.
i have followed the docs best i can but still no luck. also i added worldguard as a depend in plugin.yml
any help is greatly appriciated, as i have been stuck on this for hours. Thanks!
im using intellij ide btw
Does it need to be timestamp? Or can it be datetime? But IMO set them all to the correct format then run that
no no. my problem is how do I set it all to that format?
that's what I'm struggling to do rn
I somehow need to loop thru all rows and format that column for that row.
I found the STR_TO_DATE method
but idk how to loop
^^
ah sick
err how are you building your plugin exactly? to get the jar file
im just doing Build > Build Artifacts
err yeah no, you'll want to use maven for that, 'cause you're shading (bundling) wg within your jar and it's trying to use those classes instead of the actual wg ones
in IJ there's a "Maven" tab on the right
yeah, uh can you screenshot it? i don't remember the exact layout
?imgur
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/ to upload images/screenshots.
You can also use a screenshot service like gyazo or jinx and post those links here.
oh sorry , i just dmd it to you
okay so open the Lifecycles section
ok
@rugged bane I'm struggling to format them. thats the problem.
I have 0 mysql knowledge. but this is one of my attempts UPDATE husktowns_claims SET claim_time = STR_TO_DATE(claim_time, '%d-%m-%Y %H:%i:%s');
claim_time is column name, husktowns_claims is table name
Well my wifi just died which isn't very nice, anyway double click the "package" one, it'll build your project into a jar file in the target dir
How comes youβre doing it then? β.0
0.0
If this is live data and you have no experience
not live. and yes.
i have asked liek 5 people are you were the most helpful

If itβs not live canβt you just drop the table and redo it?
Oh
What did this do, change it?
β¦..?
[2021-12-24 00:37:33] [HY000][1411] Incorrect datetime value: '1638565370494' for function str_to_date
On mobile, but try: UPDATE husktowns_claims SET claim_time = STR_TO_DATE(FROM_UNIXTIME(claim_time), '%d-%m-%Y %H:%i:%s');
@broken elbow
[2021-12-24 00:39:10] [22001][1292] Data truncation: Truncated incorrect unixtime value: '1638565370494'
Oh fuck
The only other thing I could say to try, is removing STR TO DATE function
And just having FROM_UNIXTIME
Of course with the column
so this? ```
UPDATE husktowns_claims
SET
claim_time = FROM_UNIXTIME(claim_time);
If else and youβre stuck I can always try tomorrow if the data itself isnβt sensitive
And yeah
nah. same truncated error
Try change the column to a VARCHAR and set limit to something like 50, I donβt think you need even that, but just for now, and then try run the command again
Iβm not sure if TEXT column has a small size
ok. so it is what I expected. had to change it to seconds
basically have to drop lat 3 chars
do you know how I can do that not manually?
Divide it by /100 I believe
ok. no found SUBSTRING 1, CHAR_LENGTH
-3
it converted. now to convert to timestamp
thank you very much @rugged bane. now time to see if it will load it
Update the inventory how
What do you want to do, make sure the counts are still the same? Track changes?
Any idea how I can add something like this for a custom recipe?
Edit: By looking at the default recipes, group does this, but I will just use a RecipeChoice.MaterialChoice instead of registering 16 different recipes.
Woop Woop
rn to reset a map I loop through all the blocks in the region and if it isn't air, I set it to air
However, this lags the server... and doesn't even work 
is there a faster way? maybe using chunksnapshots and running it async (and the setting blocks part sync)
how do chunks work? like how can i get a chunk xyz from location xyz
/ 16
o
thats it? π
Well, floor(x / 16.0) but yes
Yes
I'm sure there's a World#getChunkAt(Location) thoβ¦
d;spigot World#getChunk
@NotNull
Chunk getChunkAt(@NotNull Location location)```
location - Location of the chunk
Chunk at the given location
yea but i don't want to loop through a chunk 16 times
also, do chunks have a Y limit?
no
Subchunks are a thing but they aren't part of API
Why would you?
because before i was looping through every block
so if i just replace that with chunk
theres probably like a hundred blocks per chunk
over a hundred
Yeah⦠and you can put the chunk in a variable in the exact same fashion you do with x,z
is World#getChunkAt(x, z) chunk x z or "real" location x z?
but the thing is that i had to make sure i was checking a chunk only once
Chunk x,z I assume
includeMaxblocky β - if true, snapshot includes per-coordinate maximum Y values
and what's this mean?
since doesn't it already contain all the blocks in the chunk?
Probably something to do with spawning or lighting idk
hm
use data pallets
Can someone make a plugin for /lobby
that tp's you to a certain multiverse
1.18.1
spigot?
// sync
for (x in (min.x..max.x).toSet().map { floor(it.toDouble() / 16.0).toInt() }) {
for (z in (min.z..max.z).toSet().map { floor(it.toDouble() / 16.0).toInt() }) {
snapshots.add(world.getChunkAt(x, z).getChunkSnapshot(false, false, false))
}
}
```any way to speed this up? this takes 3-4 seconds :/
and it runs on the main thread
// async
val blocks = mutableListOf<Location>()
snapshots.forEach { chunk ->
for (x in (chunk.x * 16) until (chunk.x * 17)) {
for (z in (chunk.z * 16) until (chunk.z * 17)) {
for (y in min.y..max.y) {
val block = chunk.getBlockType(x % 16, y % 16, z % 16)
if (block == Material.AIR) {
continue
}
blocks.add(Location(world, x.toDouble(), y.toDouble(), z.toDouble()))
}
}
}
}
```and this throws an `OutOfMemoryError` on the `blocks.add` line even tho theres only like 10 blocks
d;spigot Chunk#getBlockType
@NotNull
Block getBlock(int x, int y, int z)```
Gets a block from this chunk
x - 0-15
y - 0-255
z - 0-15
the Block
i mean for speeding maybe you could use paperlib and use parallel computing with chunks or smthing
π
that would mean running everything on the main thread
Was the paper async chunk stuff a thing in 1.8?
also note that I'm using Paper 1.17.1 api
print the contents of snapshots
That looks very suspicious
@dusky harness
I don't have all day
Get printing
If my suspicions are correct you're gonna have the same chunk 256 times
Also chunksnapshot might not have a properly defined equals
yea i wastalking about the xz loop, forgot that map is Iterable.map π€¦
oops
it doesn't define jackshit 
now imagine if kotlin had higher kinded types
We wouldn't be in this situation
unironically why scala is better
https://i.imgur.com/cvVaNkN.png (sync)
https://i.imgur.com/gjF9vE1.png (async)
34ms... is that a good amount or
objectively better
and not only because of that
Weak ass type system
if kotlin is SOOO GOOD and took SOOO MANY THINGS from scala
where are the higher kinded types
huh?
pathetic
what are higher kinded types
Hi
Hi
hello
Hi
google dot com
lol
with just /lobby
A<B<C>>
we just hit keys on a keyboard and pray it works
i thought kotlin supported that
No like they're all generics
No
Foo<T<B>>
can u give example
no thanks
fun <I : Iterable, T, R> I<T>.map(f : T -> R) : I<R>
Works for all Iterables and always returns the same Iterable
oh
If you give it a Set<T> you get a Set<R>
now make a monad trait with it
but List<T> -> List<R>
it's more complicated than that but that's the gist
Your generics can be generic (higher kinds)
ur a higher kind
thanks
they're actually really good
wow ur high
map :: a t -> (t -> r) -> a r π
mostly
Not polymorphic but oh well
fun <T, It : Iterable<T>, R, Ir : Iterable<R>> It.map(f : T -> R) : Ir moment
very depressing
really depressing
pathetic kotlin fail
and as you can see the map was not reset, but the walls were

you should change every Lombok in here to Kotlin
true...
?plsnokotlin when
Why is Kotlin bad?
- It's a compiler hack - the Java compiler isn't designed to modify code, so it can cause difficult to debug errors, or worse
- It requires an IDE plugin, so unless you've properly configured Maven, Gradle and your IDE, you'll get hundreds of compilation errors. This process takes time too, it's not easy
- Kotlin'd code won't show in Javadocs
- The code generation is often unpredictable and difficult to debug, and often you'll have to do it "the hard way" anyway
- Java is supposed to be explicit, Kotlin hides a lot of key functionality into a subtle annotation which can be easy to miss
- While IDEs support it with a plugin, it's usually more difficult to find specific things, like usages of a getter because they don't exist in the source code
- Finally, Kotlin'd bytecode doesn't match the source code, so it causes a pretty annoying warning in IntelliJ
Omg so true!!
hmmm why does it reset like this π€

@PiggyPiglet isn't insert anything kotlin really poorly implemented though?
so true again!!
'cause you told it to
for (x in (chunk.x * 16) until (chunk.x * 17)) {
for (z in (chunk.z * 16) until (chunk.z * 17)) {
for (y in min.y..(max.y.coerceAtMost(chunk.getHighestBlockYAt(x % 16, z % 16)))) {
if (!map.isInRegion(LocationWrapper(world, x, y, z))) {
continue
}
val block = chunk.getBlockType(x % 16, y, z % 16)
if (block == Material.AIR) {
continue
}
blocks.add(Location(world, x.toDouble(), y.toDouble(), z.toDouble()))
}
}
}
```i need ur guys' help again π₯Ί
for (x in (min.x..max.x).map { floor(it.toDouble() / 16.0).toInt() }.toSet()) {
for (z in (min.z..max.z).map { floor(it.toDouble() / 16.0).toInt() }.toSet()) {
println("SNAPSHOTS added x: $x, z: $z")
snapshots.add(world.getChunkAt(x, z).getChunkSnapshot(true, false, false))
}
}
No they're not
yes because kotlin sucks at maths
;-;
ur right
lol
so this code is good
but something in here is off π€
oh - if chunk.x is 7 for example, it'll only loop 112 -> 119
but ive got no idea how to fix it π
oh wait i think i know
pog it works now
:D
I need help of the plug-in deluxe menu
Sir this is #development
There is no time to wait! Ask your question @wild nexus!
I get the following error message when I'm starting the 1.18.1 spigot:
Error: LinkageError occurred while loading main class net.minecraft.bundler.Main
java.lang.UnsupportedClassVersionError: net/minecraft/bundler/Main has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 60.0
I am running the latest version of java have checked.
You are on Java 16, it's requiring Java 17.
Ah tysmm, but now I have another error:
[10:12:10] [ServerMain/FATAL]: Failed to start the minecraft server joptsimple.UnrecognizedOptionException: o is not a recognized option at joptsimple.OptionException.unrecognizedOption(OptionException.java:108) ~[jopt-simple-5.0.4.jar:?] at joptsimple.OptionParser.validateOptionCharacters(OptionParser.java:633) ~[jopt-simple-5.0.4.jar:?] at joptsimple.OptionParser.handleShortOptionCluster(OptionParser.java:528) ~[jopt-simple-5.0.4.jar:?] at joptsimple.OptionParser.handleShortOptionToken(OptionParser.java:523) ~[jopt-simple-5.0.4.jar:?] at joptsimple.OptionParserState$2.handleArgument(OptionParserState.java:59) ~[jopt-simple-5.0.4.jar:?] at joptsimple.OptionParser.parse(OptionParser.java:396) ~[jopt-simple-5.0.4.jar:?] at net.minecraft.server.Main.main(SourceFile:87) ~[server-1.18.1.jar:?] at net.minecraft.bundler.Main.lambda$run$0(Main.java:54) ~[?:?] at java.lang.Thread.run(Thread.java:833) [?:?]
I got it to work now!
Any idea how to get a net.minecraft.advancements.Advancement on 1.18.1 nms (paper)?
Or any way to get an Advancement, I need to add a children, any bukkit ones are view-only
Getting access to the DedicatedServer should allow you to be able to get the advancements
Alternatively, if you cast a bukkit advancement to CraftAdvancement you can get the handle which is the nms Advancement
nice, ty
@dusky harness use cuboid
then just adapt the code a bit to give you chunks instead of individual blocks
Hello, how I can make a listener in other class and import this on main class?
public void onEnable() {
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
Bukkit.getPluginManager().registerEvents(Join, this);
} else {
getLogger().info("Could not find PlaceholderAPI! This plugin is required.");
Bukkit.getPluginManager().disablePlugin(this);
}
}
And I have a listener class
public class Join implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onJoin(PlayerJoinEvent event) {
String joinText = "%player_name% &ajoined the server! They are rank &f%vault_rank%";
/*
* We parse the placeholders using "setPlaceholders"
* This would turn %vault_rank% into the name of the Group, that the
* joining player has.
*/
joinText = PlaceholderAPI.setPlaceholders(event.getPlayer(), joinText);
event.setJoinMessage(joinText);
}
}```
And I have error in main class called "cannot find symbol" because plugin doesn't see listener or I bad implementing this.
Anyone can help?
change Bukkit.getPluginManager().registerEvents(Join, this); to Bukkit.getPluginManager().registerEvents(new Join(), this);
@pallid terrace
How do i loop every block between 2 locations?
Use cuboid (Cuboid#blockList): https://www.spigotmc.org/threads/region-cuboid.329859/
thanks, plugin now see listener but message is not showing when I join to the server
is the plugin enabled?
also, remove that priority thing
Now %player_name% joined the server! They are rank %vault_rank%
Wait, maybe i need eclouds placehoders
that but without maybe
Of course, that's works now
I forgot that I deleted the papi folder with placehoders
I'm a novice programmer so thanks for the help, now I know a little more, if I have any problems I'll get back to you
huuuf finaly now i can login
OK
OK
does anyone know how to swich case
This beginner Java tutorial describes fundamentals of programming in the Java programming language
public static Message msg(String message){
switch (message){
case "MESSAGE_1":
return plugin.getConfig().getString("MESSAGE_1");
like this?
lmao im new to coding ;--;
now
see the edit
:))
Nice
in PDC how do you use TAG_CONTAINER Data type cause i cant find anything on it?
or would it be better to just use nms's nbt stuff
PublicBukkitValues: {
customenchantments:enchantments {
customenchantments:telekinesis:1
customenchantments:protection:5
}
}
cause this looks really ugly tbh
tho it would be better if io could figure out how to make a new tag_container instead of using new PersistentDataContainer() cause it produces a bit of boilerplate that makes no sense to me, the .set, .has and .get
PDC is basically bukkit's nbt implementation
I rarely use it, I instead go with just nbt
Plus, it is available from 1.14.4 or something
why cant bukkit just have methods for changing nbt without all this messing around
ill just use nms then
https://paste.helpch.at/tamugirixo.java
how to send message on making config? like ``config.yml not found.. creating`
and if exists send message Config.yml loaded
why no enum
it's christmas, my man, look it up on the internet. Happy Holidays. β¨
when using minecraft development plugin on intellij
it generates a shading section in the pom.xml
is that needed?
maven π
If you're using external libs then yes
alright thanks
I'm trying to figure out how the intellij hotswap works
I need to build artifact rather than build project it seems?
Piggy has a guide on it
oh shoot, where can I find that?
https://piggypiglet.me he has docs somewhere, on mobile rn
found it, thanks
turns out #hasTag doesnt seem to exist anymore atleast not obfuscated so anyone know what its called now?
also how would i go about decompiling spigot to figure out how all the nms stuff works?
nms, what monkey wrote this
paperweight userdev π
Fast wrote this. Any ideas for something cleaner?
if(Arrays.asList(inv.getContents()).stream().filter(i -> (i != null && i.getType() != Material.AIR)).collect(Collectors.toList()).isEmpty()) return;
Checks whether or not an inventory is empty.
π₯΄
Arrays.stream, redundant parens in your filter lambda
and !findAny().isPresent() is probably better than list -> isEmpty
π and what do you mean in your other message?
Arrays.stream instead of asList->stream
and you don't need the parentheses in your filter lambda
Ah missread my bad
you could also just... inv.firstEmpty() != -1
lmaooo
Thats for full invs
not empty ones
if(!Arrays.stream(inv.getContents()).findAny().isPresent()) return; Thx.
you're literally checking if there is any item in the inventory is that not what you're doing?
yeah
yeah ^^^
No that checks if inventory is full and their is no empty slots
like you can use firstEMpty for both if the inventory is full or if it has empty slots
Really? since when?
yeah. so use != -1
no you can't, because it wouldn't be -1 if there was 1 item - which is not empty
-1 only works when the inventory is full
^^^^^
dude
what?
This might work yeah
kek
yeah. but first he said != -1
Ah yeap misread lol
let's say theres an item in the inventory java System.out.println("Is empty: " + (inv.firstEmpty() != -1)); this would print out true even though the inventory is not empty
I'll just test both π€·
Inventory#isEmpty
yea
lol
d;spigot Inventory#isEmpty
boolean isEmpty()```
Check whether or not this inventory is empty. An inventory is considered to be empty if there are no ItemStacks in any slot of this inventory.
true if empty, false otherwise
π₯²
What version was that added? Thats probs why I don't have it xD
like
also who is Fast?
always
are you on 1.8 or something?
d;1.8.8 Inventory#isEmpty
void setItem(intΒ index, ItemStackΒ item)```
Stores the ItemStack at the given index of the inventory.
index - The index where to put the ItemStack
item - The ItemStack to set
Yeah my plugin is based in 1.8 and supports up to 1.18.1 so for my other plugin I'll just use Inventory.isEmpty.
I still can't believe people make plugins for 1.8
I made this plugin in 1.8 xD
Ah well you should upgrade it then!
I've been supporting newer versions ever since
Cast away the chains of 1.8
then just use Inventory#getContents#isEMpty
Nah
yapperyapps
getContents returns the amount of slots
It will have null objects for every slot
Hence the stream/filter
yeah. makes sense.
Well I'll test both the first empty and findFirst mthods. Thx guys
Is there something other than an array Object[] and map Map<Key, Value> that you can put in 1 entry? I know I could use both of those but just wondering if there is more.
I am still confused
on?
What does "put in 1 entry" mean
For like map you can have multiple entries. The array I have is 1 entry but I use Object because its different objects in the array I want. So something like Map but only allows 1 entry rather then multiple.
Like, a pair?
That was such a weird way to describe that lol
Multimap / Table
Made sense in my head. Hence why I don't explain things to people.
Don't want multi
Why not
When you want something like
Map<K,Collection<V>> even java proposes a Multimap ish by using computeIfAbsent and computeIfPresent, which is basically what something like ArrayListMultimap would do for you, how nice! Free abstraction!
see but I don't trust Java with zero-cost abstractions
there are no zero-cost abstractions
Everything in this world is an object, and it'll probably sneakily box it fo ryou
Oh Emily, have you heard of Rust?
no abstraction is zero-cost
Quite a few in Rust are, actually

Such as like the Option enum in Rust
what about it?
It's zero-cost. The size is just whatever the actual data is
i have no idea what that even is
i suppose
It's either Some(T) or None
Yeah but I doubt guava would do something dumb
Should be pretty reliable
Well see I don't think it's Guava's fault
okay.. how is that zero-cost?
It has no overhead over just returning the normal thing
also how is that an enum lol
no thank you
Aren't you a C++ addict?
right but the overhead is present at compile time then
it's not zero-cost
not really, wait until you find yourself hitting a compilation timeout lol
Try Rust
It's a tradeoff I am extremely willing to make lmao
I know, but you're making claims that aren't
And I'm not going to sit here and argue with you about a language you have never even tried
no abstraction is zero-cost
and it's wrong
I mean it's not
At runtime, there is zero-cost to the abstraction
As with many others
.
Rust compiles extremely quickly
just because it isn't present at runtime doesn't mean it doesn't exist
When the point of a language is to write fast code, the cost is speed at runtime
You're just arguing pedantry now
the ability to move certain behaviors to compile time execution
so they're acknowledging it exists by moving it to compilation stage
that's misleading
Oh my god
i'm stating things how they are, there are no zero-cost abstraction, every one has a cost, whether that's at runtime or at build time is something else, but it is there
i think it may be time for :norust:
Lol
Zero-runtime-cost doesn't quite slide off the tongue as well
this ratio is zero-cost

Ratio.
π
lol
Thought that said depression at first
mood
π€£
someone please. help. lol. I have to work with maven, this is the pom of the project https://paste.helpch.at/jorivizuxa.xml and ... yeah ...

yes I know
wait wtf. a few refreshes fixed most of all except for the spigot one
gonna do a few more lol
Thats from vault
You gotta exclude it
<exclusions>
<exclusion>
<group>org.spigotmc</group>
</exclusion>
</exclusions>```
Add this to vault block
yeah idk. it just built
like that
so I am not going to worry about that anymore
just had to remove 4 messages lol
Okay
anyone know how to decompile and recompile after editing class files? I need to change some of a plugins features from 1.9-1.8 IDs
Hi, how bad idea is to load config into memory on enable and get values from that π€
Config is loaded in memory anyways
well but accessing it is pain
Yeah. Feel free to load the data in memory in any way.
ooh nice :-) one more question
when config for menu looks like this:
KITS:
NAMEOFKIT1:
ICON: MATERIAL1
SLOT: 0
DESCRIPTION:
- "&cHi!"
- "&dLol :-)"
NAMEOFKIT2:
ICON: MATERIAL2
SLOT: 3
DESCRIPTION:
- "&cHi!"
- "&dLol :-)"
NAMEOFKIT3:
ICON: MATERIAL3
SLOT: 5
DESCRIPTION:
- "&cHi!"
- "&dLol :-)"
Is it better to transform data on enable to something like this
0:
ICON: MATERIAL1
DESCRIPTION:
- "&cHi!"
- "&dLol :-)"
3:
ICON: MATERIAL2
DESCRIPTION:
- "&cHi!"
- "&dLol :-)"
then just do inventory.setItem(i, ...) instead of messing with configuration section on the menu load, right? If yes, what is the best way to save that and access it then?
does Spigot have some lib that make storing and accessing data in memory easier or should I use some vanilla way
wdym?
oh r u talking about config ymls
aa
aa?
you heard me
π³
π
Thereβs nbt. You can also use literally any holder
I'm trying to make xp bottles increase my own xp in my plugin, not mc xp
How could I do this?
I've tried using PlayerExpChangeEvent but since xp orbs merge together, if I throw the bottles fast, it only calls the event once :/
d;spigot PlayerExpChangeEvent
public class PlayerExpChangeEvent
extends PlayerEvent```
PlayerExpChangeEvent has 5 methods, and 1 extensions.
Called when a players experience changes naturally
well
I can't use multiplication/divison on ExperienceOrb#getExperience because it's random: https://i.imgur.com/v7LZPjh.png and I want to make it give a fixed amount
getAmount will give you how many
so
assume that 1 is 1 point and then multiply or smth
idk
but it's randomized whenever u throw an xp bottle
Or deal with the randomizing
what if i just disable xp orb merging?
π
via spigot.yml
ooh i have idea
ExpBottleEvent#setExperience
setting that to 1
π€¨
because the xp bottles are what makes it random - so if i make it always 1, then it's not random anymore

seems to work
but if it merges
it combines
it doesn't randomize anything when merging
it just combines the xp values
but if 2 merge the xp will still be 1
oh
i see what u mean
when the bottle throws
yea that should work
xDDDDDDDDDDDD
:DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
π
Lol xd ttyl brb gtg tmi fyi rolfmao
guys, anyone used Prisma in typescript? I can't figure out where to look for docs on things more complicated than examples, and the create method doesn't work correctly