#development
1 messages Β· Page 33 of 1
How do i give a player a kit after they respawn?
when they respawn give them a kit π€―
imagine my surprise when I found out that Set#retainAll() modifies the set in place instead of returning a new set that's the intersection of both of them?!?!?
like come on
give me vavr style
automatically π€―
thats what im saying
Okay how?
listen to the PlayerPostRespawnEvent event then give them a kit π€―
Simpler terms
this channel is for coding, it looks like you want a plugin so use #general-plugins
oh okay
uhm so in MongoDB, am I able to put an arraylist into a DBObject?
Since DBObject accepts an object as value, I assume it works?
Try it and see
unable to test it rn, hence why I am asking
currently on laptop, on vacation
without access to the mongodb
thx lol
Shower thoughts
You must be having very full showers
HELLO, im trying to make plugin where 1 person dies everyone dies
however, ive came into problem where killing all the other players throws the death event again, causing the plugin to kill everyone again, creating a loop
what
and check if its true when the event comes in
and set it to false when it kills everyone else?
no the other way around but yeah
what?!
r u saying to stop if boolean is true?
im explaining the principle
you can decide on the value
when death -> bool = true
death event comes in because killed -> check if bool == true, if yes, skip
after loop -> bool = false
if(playersLeft == 1) return;
oh now i see how i couldve fixed the system i was just using (i was saving players that just died [by plugin] to a set and then if set contained them, it wouldnt run event, if i cleared the list after looped, it wouldve worked)
yup
if I were you I would have just set a boolean (like others said above) that turned true before killing everyone, and when it was true, the death event was just ignored. Then, after killing everyone, you make it false again.
yes im using a boolean now, i was just pointing out that if i cleared the list after the loop it wouldve worked
oh, yeah, my bad.
Would the best way to save a furnace's contents be just grabbing the inventory contents and saving it? I am not sure how the furnace and other non-chest inventories work.
They have slots with Items in them.
What do you mean
Anyone know if theres a way to spawn NPCs with CitizensAPI from a texture file?
My server keeps getting fucking Mojang API rate-limited and I don't know what I can do
too many npcs
I just use the SkinTrait and it works like a charm. I upload my skins to a place like https://mineskin.org and then just use that signature and texture data.
MineSkin.org allows you to generate skin texture data for Minecraft which is signed by Mojang.
unless that is what you are using
Oh thanks, I'll take a look
Only issue is that our skins periodically change based on different factors. So it looks like we'll need to use their API for that.
Do you know if they have a rate-limit that is higher than mojangs?
is it custom textures that are changing unpredictably, or preset?
I dont know.
Basically we constantly scrape the name of nitro boosters in our discord
To use them as skins ingame
I think I can use their API to load the textures into an SQL database and then have it query that for future uses
They change more than 600 times per 10 minutes?
100+ players looping logins can do that easily.
no, the api is only called when uploading skins
like in your launcher and you select Upload skin (or whatever its called)
the actual skin loading is done in the client (which I assume has a very very very lenient ratelimit if it has one at all to avoid botting since the client can load many many skins due to skulls, npcs, and other players)
ok im gonna go to sleep now so if I don't respond to your response (if you make one), that's why π
Player skulls and NPC's also request skins from mojang's API the client requesting these skins is a different situation.
does anyone know how i can set an iron golem's health to just half a heart, it looks like there is no method for this
(context: using SpawnerSpawnEvent to find out if iron golem is spawned from a spawner, if so, set health to half heart and set it on fire)
@EventHandler(ignoreCancelled = true)
public void IGSpawn(SpawnerSpawnEvent e) {
EntityType entity = e.getEntity().getType();
if (entity == EntityType.IRON_GOLEM) {
Entity ent = e.getEntity();
\\ ??????
ent.setHealth(1)?
You're using an EntityType, not an Entity
yes but look at the last line
i cast it to an entity
it still doenst work
i tried this with CreatureSpawnEvent aswell
same thing
@EventHandler
public void aaa(CreatureSpawnEvent e) {
EntityType ent = e.getEntity().getType();
if (ent == EntityType.IRON_GOLEM) {
if (e.getSpawnReason() == CreatureSpawnEvent.SpawnReason.SPAWNER) {
}
}
}
}
Try LivingEntity ent = e.getEntity()
ok i think it works now
Ill try the code ingame
thanks for now
No problem for now
how can i get the block coordinate player is looking at even from very far in java
Easiest way to make/port a mod to work for all fabric versions? (i mean, multiversion)
context: there is a fabric mod for 1.19 i want to make it 1.16.5+ (or older)
@slow junco noob
good, bad? xdd
public static ModifierKey fromString(String modifier) {
switch (modifier.toUpperCase()) {
case "LEFT_SHIFT":
case "LS":
case "L_SHIFT":
return ModifierKey.LEFT_SHIFT;
case "RIGHT_SHIFT":
case "RS":
case "R_SHIFT":
return ModifierKey.RIGHT_SHIFT;
case "LEFT_ALT":
case "LA":
case "L_ALT":
return ModifierKey.LEFT_ALT;
case "RIGHT_ALT":
case "RA":
case "R_ALT":
return ModifierKey.RIGHT_ALT;
case "LEFT_CTRL":
case "LEFT_CONTROL":
case "LC":
case "L_CTRL":
case "L_CONTROL":
return ModifierKey.LEFT_CTRL;
case "RIGHT_CTRL":
case "RIGHT_CONTROL":
case "RC":
case "R_CTRL":
case "R_CONTROL":
return ModifierKey.RIGHT_CTRL;
}
return ModifierKey.NONE;
}```

At what point do you just use regex/pattern checking
For what and why
Wanna do this, but with reflections
MythicBukkit.inst().getSkillManager().getSkill(id).ifPresent(skill -> {
AbstractPlayer trigger = BukkitAdapter.adapt(player);
GenericCaster genericCaster = new GenericCaster(trigger);
SkillMetadata skillMeta = new SkillMetadataImpl(SkillTriggers.API, genericCaster, trigger, BukkitAdapter.adapt(player.getLocation()),
new HashSet<>(), null, 1.0F);
if (skill.isUsable(skillMeta, SkillTriggers.API)) skill.execute(skillMeta);
});

what the fuck
Bro I'm going to do laundry π
yeah, its a soft depend of a plugin i'm editing but since that plugin is compiled in j16 or j17
i can't use it in my project j8 xd
so one thing leads to the other and thats it xd Β―_(γ)_/Β―
@lyric gyro do multi release jars work fine with spigot?
why??
I can't care to know about spigot 
fair
yeah try multi release jars
and non final constants π΅βπ«
um.
I'm trying to print some debug messages (via Bukkit.getLogger().info) in a BukkitScheduler.runTaskTimer and async one, but I'm not getting any in the console. Is this intended?
or am I dumb as usual
no it is not intended
it is incremented by one every 20 ticks
I have a placeholder for it, I can see the number increasing, all the logic somewhat 'working', it gets set back to 0
but I get 0 messages in the console, still
if its just debug then try sout
tried that too, nothing
They're in the async console
the owner put in a plugin to filter out some messages from the console I wasn't aware of π
why would u want that lol
Honestly in a Forge environment that could be nice.
So many pointless errors
you can just turn off that logger though
which ever logger is logging the pointless errors
They wouldn't be forge mods without pointless errors
Uhm quite random but am I able to set the amount of an itemstack to more than 64 on drop?
Aka I am doing a block that drops an item every X seconds, but to optimize it, I was thinking in looping all blocks around, checking if they are also "generators" and if so, simply adding 1 to the amount of that drop.
unless there is a simpler way?
why do you need a stack size over 64 to do that?
just loop to count and then drop in stacks of 64 instead of 1 by 1
if you really want to get crazy you can spawn a custom item and listen for a pick up event and then give the player the correct amount of items
i dont understand what he means by 'adding 1 to the drop', so if there are 2 generators near each other, one of them spawns 2 items instead of they each spawn 1?
or something different
Max you can set an itemstack in 1.19.3 is 127
thats how i understood it
i think ivans solution is best if your goal is to stack "infinite" items, capping the drop amount at 127 and giving it some meta which stores the actual amount
exactly that
okay thx
btw for the case of multiple generators - you dont need to check for nearby generator blocks, it's probably easier just to have each generator look for item stacks within a certain radius
using getNearbyEntities
that's the thing, I have a list of all the locations with generators of that player, if I clone it and if I loop it at the first, and remove the gens from that list, technically I spare some loops?
i mean how many generators are there, thousands? if no, i think its negligable
aka I loop the gens around that first gen, remove them from the list and so on
maybe, who knows
might have more
not in my control
i see, but i think this isn't the design servers would expect
if they place two near each other, they expect 2 stacks
and if you have a feature so they can control the rate of each generator, then they wouldnt need to have multiple nearby
by 'stack' i mean item entity, which can be 1 or 64 or whatever
Hi i need help
barry where are you now
ask in #general-plugins or #1007620980627230730
Thanks
I am looking into the source code of a plugin, and it uses the methods and references from WorldGuard and WorldEdit which are only available on 1.13+ versions, yet the plugin works all the way back to 1.8. I looked, and there is no version checking or reflection code in the plugin, how are they achieving the backwards compatibility?
I think what you're saying is your going to cache the generators around other generators right?
If so, you can add them to the cache when the generators are placed, instead of doing it on the loop
If you do it when you loop, if more generators are placed near it, then that will cause issues
nono, I already do that on place, I clone that list and loop all gens around the first generator in that list, add 1 to a temp var that tells how many generators are in that rafius and removes them from that clonef list, and then I start again at the start and do the same. Technically I will save a lot of loops since instead of looping for every single one, I only loop for the ones that werent in a radius before.
I think you said what I was saying
Idk what you mean by start again at the start though
hi, I'm developing some plugin and i need to store some data, i don't want to have some hard dependency as an sql db. Do you have a solution to stone data in file? (i already try json, yml) and the library that i used what horrible to make work.
Do you have a good tuto that u used to do that ?
public static void save(Object obj, String path) {
File f = new File(path);
if(!f.exists()) {
try {
f.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
try {
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(path));
oos.writeObject(obj);
oos.flush();
oos.close();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
public static Object load(String path) {
Object result = null;
try {
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(path));
result = ois.readObject();
ois.close();
}
catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
I use this when I need to store a list or something to persist through restarts
then you just cast the Object the load method returns to the Object type you passed to Save
try with resources and nio >
SQL is a perfect choice, you can support MySQL and SQLite
I also like mongodb though
Hewwo, there's a way to remove the Honey Block properties for mobs?
It's a custom Skyblock plugin
I can send source if you want
no need, I would def. recommend sql
if you want to go for local, SQLite exists
otherwise MySQL/MariaDB
technically can also be done with MongoDB
it doesnt, I checked
wdym? Are you talking to someone else?
Is the plugin open source?
god I just had a brainfart, sorry, was having another convo and thought it was with you, my brain froze lol
sorry.
Your good
No, unfortunately. I just have the decompiled version
I want to edit it
But can't get it to work on 1.8
you are using it on 1.8 and it errors or?
maybe the worldedit class is only instantiated on 1.13+
Well this is annoying...
well this is a normal behaviour*
What part?
Team#setPrefix not coloring the string? π
Idk where Logger#log is coming from but that shouldn't color it either unless it is a custom class
Logger is a custom class. and setPrefix is coloring the string hence the yellow lol. And I can configure the color but for some reason %vault_prefix% won't color (in scoreboard).
Oh my god minecraft doesn't automatically translate ampersands
what news
Logger is probably translating them
Really hard to know what's really going without any information
I feel like you both aren't looking at the images lol
what is prefix
and i feel like you are not reading?
mind sending the log method?
public static void log(LogLevel level, String message) {
if (message == null) return;
switch (level) {
case WARNING:
Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&8[&6WARNING&8] &f" + message));
break;
}
}
Again... look at the images
The scoreboard is colored. But the prefix is uncolored. Then in console its colored correctly
my guess:
config read -> translate codes -> then replace placeholders -> thus, &e is translated but the stuff added later isn't
nah bro dont facepalm me
how should I know
im not magician having access to your hard drive btw
I literally showed the images of whats wrong LMFAO
but also before replacing the papi placeholders?
And debugging isn't helping which is why I originally posted it.
String has placeholders added before sent to the method that colorizes and applys to scoreboard
alright, now we have that sorted
was already π
nope
if placeholders are replaced before coloring, I'm really interested how you managed to fuck it up that bad
π€· Hence what I am not understanding xD
Trying something else give me a min
well you didn't show any code doing your magic
π€¦
to me
what was it?
"coloredPrefix" π€¦
Whats wrong with that?
I had suffix right but fucked up prefix xD
is that a plugin class or
?
I should really recode this plugin from scratch. Issue would be it being a whole new plugin lol
Util classes are static though
yeah the fact that a class that isnt a util class has a static instance but the util class has xD
π€· Not my original code anyways
they arent util classes if they have an instance
True, idk why I said that part
Can someone tell me if for 1.8.8, to send action bar message it used "GAME_INFO" for getChatTypes or (byte)2 for getBytes
i swear i used to use GAME_INFO before and it worked fine, but now it seems that (byte)2 is the only working for 1.8.8
maybe a protocollib or viaversion thing?
To send action bar message you use adventure 

Protocollib wonβt touch any vanilla packets unless itβs told by a plugin, so the issue is probably from via version
(ViaVersion using protocollib)
weird, i used to create a packet using GAME_INFO before and it threw errors when 1.8.8
but now it seems it doesnt
anyways, changing topic, possible to run bungee commands as player from spigot plugin?
player.chat("/end")
doesnt seem to work (does it?)
How does one go about adding multiple different versions of a plugin (like WorldGuard or WorldEdit) to their gradle project without conflicting with the other versions?
abstract your logic and add plattform modules
I know how to do the coding part, its just that gradle wont let me add the same dependency but different versions
(not sure what the platform modules are)
https://github.com/LuckPerms/LuckPerms
Luckperms has a lot of them
How do I do it with different versions, not just different server types?
The same way
sorry if this super simple, but I just dont understand how (like, I dont even know how to do it with different server types. I looked in the gradle files, and there seems to be nothing relating to that. I know this is just me missing it)
this is what I use for worldguard v6 si v7 in the same project https://github.com/iGabyTM/arcane-vouchers/tree/master/plugin/compatibility/worldguard
both modules are implemented in the plugin module and then used in this class https://github.com/iGabyTM/arcane-vouchers/blob/master/plugin/src/main/kotlin/me/gabytm/minecraft/arcanevouchers/compatibility/CompatibilityHandler.kt
Hi, does anyone know how I could change the per second bar update into a smooth scrolling bar. I already use ticks to get milliseconds but I can't seem to figure out how I can make this in a smooth bossbar
Code: https://paste.helpch.at/jayoyotidi.kotlin
Video: https://streamable.com/qmyh3m
I am not sure how to use Maven (I am using clean compile package to compile), this is a project made by someone else, I just want to compile it. I am getting an error relating to Lombok:
class lombok.javac.apt.LombokProcessor (in unnamed module @0x2b547149) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x2b547149
Here is the dependency code:
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
<scope>provided</scope>
</dependency>
Is there anything visibly wrong? Is this a code issue?
Update lombok maybe, and also you don't need compile in there, clean package is more than enough
plugin message system is safe to use o hacked clients can "fake" it?
(i know nothing about it so i'm asking, thanks in advance)
?
You're messaging between servers, what would client have anything to do with that? (proven wrong ;p)
i mean, if my bungeecord server listens to a plugin message
as mods can also send plugin message, i was wondering about how they are related xd
sorry im dumb xd
they are related in that they are literally the same thing
i mean that's not strictly true π€
mishandling of bungee plugin message events can lead to a client mod being able to read them if you're lucky enough to be chosen as the connection to be bridged over
additionally clients can also send messages to servers, so theoretically a hacked client could send a "fake" message if it was able to somehow reverse engineer your system
(speaking from experience having made little packet interceptor tool just for that)
i think the fix is to cancel the events after having processed them, not really sure on the details because it's been a while
which may or may not have consequences
so, the channel "BungeeCord" is secure or not?
protecting against sent messages is easy if you check the sender to be a server
what about custom "my:plugin"
it's secure if you handle it securely
define "secure"
mmm
secure like to be used in a plugin xd
i mean, if i want to an order from spigot to bungee using plugin message
lets say to execute a console command in bungee
would players be able to "fake" it
i see
#1456
so that works? xd

LuckPerms is a mod/plugin with many millions of downloads, over 2 million downloads last year alone
I would argue that it's doing it right
looks at griefprevention
well
let me add to that that it is created, designed and maintained by an actual software engineer :D

and if a hacked client sends a plugin message
what is it? if not an instanceof ProxiedPlayer
just curious
trying to make a forge mod on intellij using the "Minecraft Development" plugin
but there's no available versions for forge, mcp, or minecraft
^ nvm solved, i just reinstalled the addon
ok
what are your guy's opinion on minigame apis
they exist
Uggg my message has 4 char to spare yet it won't let me post it. Damn it discord
So I'm currently trying to send/receive packets with TCP and I'm trying to handle the Server List Ping packet from the minecraft client but I have been unable to get it to work correctly.
https://pastebin.com/fLybLVWd
I am fairly certain I have everything right but if something is wrong I would assume its the favicon or my writing to the "OutputStreams"
[INFORMATION] Initializing ConnectionBase... (Port: 25569)
[INFORMATION] Initialized ServerSocket
[DEBUGGING] PingRequest [Recieved] >> 127.0.0.1
[DEBUGGING] Handling packet [0]...
[DEBUGGING] Handling ping...
[DEBUGGING] Response: {"version":{"name":"1.19.3_Beta-0.0.1","protocol":761},"players":{"max":100,"online":1,"sample":{"name":"yapperyapps","id":"8e73185f-845c-4336-86f6-b9c5d475e6fd"}},"description":{"text":"1.19.3 Beta"},"favicon":"data:image/png;base64,base64,RTpcQ3JhcHBpZXN0WVQgU3R1ZmZcTmV3IE1DU2VydmVyIGljb24ucG5n","previewsChat":true,"enforcesSecureChat":true}
[DEBUGGING] PingRequest [Recieved] >> 127.0.0.1
[DEBUGGING] Handling packet [122]...
[DEBUGGING] Handling pong...
[DEBUGGING] Payload: 792718197936651264
java.net.SocketException: An established connection was aborted by the software in your host machine
at java.base/sun.nio.ch.NioSocketImpl.implWrite(NioSocketImpl.java:420)
at j.b/s.n.c.NSI.write(NioSocketImpl.java:440)
at java.base/sun.nio.ch.NioSocketImpl$2.write(NioSocketImpl.java:826)
at java.base/java.net.Socket$SocketOutputStream.write(Socket.java:1035)
at java.base/java.io.DataOutputStream.writeLong(DataOutputStream.java:230)
at <package>.UninitializedConnection.handlePong(UninitializedConnection.java:109)
at <package>.UninitializedConnection.handlePacket(UninitializedConnection.java:83)
at <package>.UninitializedConnection.run(UninitializedConnection.java:38)
at java.base/java.lang.Thread.run(Thread.java:833)
at <package>.ConnectionBase.run(ConnectionBase.java:67)
at java.base/java.lang.Thread.run(Thread.java:833)
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
is there an error in the client logs?
that would be more helpful than the generic error
sounds like the json isn't being written properly then
Wait, sorry current error is [11:50:37] [Render thread/ERROR]: Can't ping localhost:25569: Internal Exception: io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: Index 123 out of bounds for length 2
I want to get the instance of each ItemFrame that is loaded on the server. But for some reason the ones already placed isn't caught by the EntitySpawnEvent when the server is rebooted. Is there another way to do it?
Thats it. Ocurrs every time I click refresh on the server list.
EntitiesLoadEvent
how helpful
Right lol
uh
im not sure how you would debug / log the client events
but how are you writing the string?
there's a medium-high chance that you're not encoding varints properly, that caught me out a lot
public void writeString(DataOutputStream out, String string, Charset charset) throws IOException {
byte[] bytes = string.getBytes(charset);
writeVarInt(out, bytes.length);
out.write(bytes);
}
and writeVarInt is?
Those methods are taken from wiki.vg/Protocol
there was a mod that's very useful for that
pakkit I think it's called?
discord
@hoary scarab why case 122:? why 122? the ping request is 0x1
similarly the pong response id is 0x1 not 0x00
Cause thats what was outputting in my earlier debugs.
Actually the debug is still there lol
Look at the output I posted and look at Handling Packet lines
okay but why are you writing 0x00 when the pong id is 0x01?
similarly i have a hypothesis for the 122, you're not consuming the bytes from the Handshake packet so they're still in the stream, messing up when you try and read the next packet id
Because I've tried both as well as 0xFF and 0xFE
I know
Read the output of the debug
if you're writing the wrong id then the client is gonna interpret the data in a completely different way
the debug of what the server is receiving has nothing to do with the data the server is sending
I got that. But the output says something different lol. Haven't been able to get it to match
where does it say that?
the incoming packetid is 0 client -> server based on all the code given
which... is correct. i'm talking about a completely different stage lmao
One sec
Handshake = 0
Status Request = 0
Status Response = 0
all fine
Ping Request = 1, should definitely not be 122 but i've already mentioned that
Pong Response = 1, you're writing 0
even if you're not handling it you need to consume all the packet's bytes
π€¦ java int packetSize = varMethods.readVarInt(in); int packetId = varMethods.readVarInt(in); I changed packetSize to in.readByte() and now packetId is 0 or 1
ah
Pong Response = 1, you're writing 0
I updated the code
show the new code
Its on the pastebin
private void handlePong(DataInputStream in, DataOutputStream out, int packetSize, int packetId) {
Output.debug("Handling pong...");
try {
long payload = in.readLong();
Output.debug("Payload: "+payload);
out.writeByte(0x01);
out.writeLong(payload);
} catch (IOException e) {
e.printStackTrace();
}
}
ok
one other thing that raises eyebrows is that you don't seem to actually be following the packet format: https://wiki.vg/Protocol#Packet_format
unless im missing something you're not writing the packet length at all
Not currently no. Been debugging for days xD
One sec
and you didn't think in these days that writing packets incorrectly could be causing the issue?
Thats just the current code lol. I have been writing the packets all different forms and ways to try and get it to work
Or atleast to get it to output something legible
right...
well generally the correct way of writing it is the best
removing the arguably most important part of the packet is certainly unlikely to fix the issue
incidentally
I was trying everything
ok
the string length is not the same as the entire packet length
the easiest way is to write the packet data into a buffer, then write the buffer length, then all the buffer data
Saw that on a few things. Not using any external API's at the moment. Will try to write something up give me a bit.
private void handlePing(DataInputStream in, DataOutputStream out, int packetSize, int packetId) {
Output.debug("Handling ping...");
try {
Output.debug("Response: "+response);
byte[] serverListMessage = varMethods.readString(out, response, StandardCharsets.UTF_8);
ByteBuffer buffer = ByteBuffer.allocate(9999);
buffer.putInt(0x01);
buffer.put(serverListMessage);
buffer.flip();
Output.debug("Buffer: "+buffer.limit()+" SLM Size: "+serverListMessage.length);
out.write(buffer.limit());
byte[] outBytes = new byte[buffer.limit()];
buffer.get(outBytes);
out.write(outBytes);
} catch (IOException e) {
e.printStackTrace();
}
}
Internal Exception: io.netty.handler.codec.DecoderException: com.google.gson.JsonParseException: JSON data was null or empty in client log
[DEBUGGING] Buffer: 720 SLM Size: 716 in server log
have you read the exception?
Output.debug("Handling ping...");
try {
int payloadSize = in.readInt();
byte[] payload = new byte[payloadSize];
in.readFully(payload);
String response = new String(payload, StandardCharsets.UTF_8);
Output.debug("Response: "+response);
byte[] serverListMessage = varMethods.readString(out, response, StandardCharsets.UTF_8);
ByteBuffer buffer = ByteBuffer.allocate(9999);
buffer.putInt(0x01);
buffer.put(serverListMessage);
buffer.flip();
Output.debug("Buffer: "+buffer.limit()+" SLM Size: "+serverListMessage.length);
out.writeInt(buffer.limit());
byte[] outBytes = new byte[buffer.limit()];
buffer.get(outBytes);
out.write(outBytes);
out.flush();
} catch (IOException e) {
e.printStackTrace();
}
}```
So output the input then output the server message?
Response is suppose to be the json string. But your message sets response as the input.
May I ask what you are trying to achieve 
Hi,
How can I increase corp growth by like 100% in 1 chunk only
Code is above.
Trying to get packets to work.
I am getting a ClassNoDefFoundError for a plugin that I have not shaded into the jar, but have it as a provided dependency. It is in the depend section of my plugin.yml, and the plugin is on the server, I checked. Is there something I am doing wrong?
can you send the plugin name and your plugin.yml?
yeah, just so you know, it is a physical jar on my machine that I am adding, here is the dependency code: ```xml
<dependency>
<groupId>pets</groupId>
<artifactId>pets</artifactId>
<version>LATEST</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/PrisonPets.jar</systemPath>
</dependency>
PrisonPets, here is my plugin.yml:```yml
name: PrisonCore
version: ${project.version}
main: me.drawethree.ultraprisoncore.UltraPrisonCore
depend: [Vault, WorldGuard, WorldEdit]
softdepend:
- PlaceholderAPI
- JetsPrisonMines
- Multiverse-Core
- PrisonPets
authors: [kyematzen]
api-version: 1.13
load: POSTWORLD
is the actual error ClassNoDefFoundError or something like ClassNotFoundException (as the "root" error)?
Caused by: java.lang.NoClassDefFoundError: me/reb4ck/prisonpets/api/PrisonPetsAPI
at me.drawethree.ultraprisoncore.autosell.UltraPrisonAutoSell.lambda$registerListeners$5(UltraPrisonAutoSell.java:199) ~[?:?]
at me.lucko.helper.utils.Delegates$ConsumerToBiConsumerSecond.accept(Delegates.java:150) ~[?:?]
at me.lucko.helper.event.functional.single.HelperEventListener.execute(HelperEventListener.java:136) ~[?:?]
anything below that?
just this ... 17 more
and you are sure "PrisonPets" is what it says in the plugin.yml of "PrisonPets"
yes
PrisonPets is custom I suppose?
yes please
name: PrisonPets
version: 1.0.0
description: A Prison Pets Plugin
main: me.reb4ck.prisonpets.PrisonPets
api-version: '1.13'
author: Reb4ck
load: STARTUP
softdepend: [WorldEdit, WorldGuard, PlaceholderAPI, MVdWPlaceholderAPI, Vault, Multiverse-Core]
commands:
pets:
description: Main plugin command
interessting, does PrisonPets start up at all?
yes
mind sharing your latest.log
it does look fine, both plugins start up and in the correct order.
yep
when does the error occur?
when I try to access any of the PrisonPetsAPI methods
like, the second I touch PrisonPets it runs into errors
can you open PrisonPets with winrar/7zip and check if the PrisonPetsAPI class is present?
so the verify first error that appears is ClassNotFoundException
so for some reason it can't find your API Class
its actually NoClassDefFoundError
Caused by: java.lang.ClassNotFoundException: me.reb4ck.prisonpets.api.PrisonPetsAPI
nope
The NoClassDefFoundError appears afterwards
nope
the verify first exception thrown by your Plugin is ClassNotFoundException, all attempts to access PrisonPetsApi will fail with NoClassDefFoundError because, well its not there
Are you sure this isn't shading it?
honestly, I dont know Maven, I have no clue
doesn't scope system just use it for compiling?
I don't remember, I use gradle
should I change it to provided and see what happens
Yea its provided
But might as well open the jar and check
nope, won't work
gradle is way better
Is this what you mean?
Output.debug("Handling ping...");
try {
int payloadSize = in.readInt();
byte[] payload = new byte[payloadSize];
in.readFully(payload);
String response = new String(payload, StandardCharsets.UTF_8);
Output.debug("Response: "+response);
byte[] serverListMessage = varMethods.readString(out, response, StandardCharsets.UTF_8);
ByteBuffer buffer = ByteBuffer.allocate(9999);
buffer.putInt(0x01);
buffer.put(serverListMessage);
buffer.flip();
Output.debug("Buffer: "+buffer.limit()+" SLM Size: "+serverListMessage.length);
out.writeInt(buffer.limit());
byte[] outBytes = new byte[buffer.limit()];
buffer.get(outBytes);
out.write(outBytes);
out.flush();
} catch (IOException e) {
e.printStackTrace();
}
}```
yea system is like provided and provided is like gradle's compileOnly
Riches can you show those lines:
at me.drawethree.ultraprisoncore.enchants.managers.EnchantsManager.handleBlockBreak(EnchantsManager.java:264) ~[?:?]
at me.drawethree.ultraprisoncore.enchants.UltraPrisonEnchants.lambda$registerEvents$19(UltraPrisonEnchants.java:345) ~[?:?]```
if (plugin.getCore().isPluginPresent("PrisonPets")) {
multiplier = PrisonPetsAPI.getMoneyMultiplier(e.getPlayer());
}
isPluginPresent just checks if the plugin on the server plugin manager doesnt equal null
Uhm
I am not really sure that is correct, not sure if you can access the Class without somehow loading it
I remember there was something like : (MyCoolPlugin) Bukkit.getPluginManager().getPlugin("CoolPlugin");
but someone else needs to answer that
I am pretty sure the API does that
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
new PAPIExpansion().register();
}
This is the recommended PlaceholderAPI style
so i'm sure that would work for your scenario
that is pretty much what I do, just a little more complicated
I just made a method on the main class to check for that
the issue is that the plugin there, and the my plugin knows that, its just when it goes to interact with it, it gets a ClassNotFoundException
this should be ```xml
<scope>provided</scope>
in what way lol
all this goes away when the scope is system, it appears when the scope is provided
did you read the second line of that
its a system reference, so "system" is fine
the dependency doesn't come from mavenLocal
it is a local file
oh bizarre
it comes from his libs\some.jar
a physical .jar in a libs folder
are you sure the class you're referencing is in the jar on the server?
yes
like, you've unzipped the jar that is literally on your server and clicked on the class file?
yeah I mean i'm not sure, the system scope is deprecated in maven, so probably not the best idea
i guess you could use a debugger connected to the server and check the classpaths loaded or something?
that'd give classnotfoundexception tho
right?
if the class was missing
ok i gtg
that's literally what it's giving lol
should I just install it to my maven local?
no its giving classdefnotfound iirc
.
ah i did not see that part
it gives both
only saw this
Will try it out when I get the chance.
that didnt work
same as before
well i mean that wouldn't fix it, just good practice lol
yeah like you're gonna have to inspect the actual loaded classpath or something man
well no, because then it wouldn't work
the whole point of maven/gradle is to be able to get api definitions for type safety and then when you run it in spigot it will load them to the classpath and you can link to the actual implementations
so then how do I inspect the actual classpath?
Why does this return a ArrayIndexOutOfBoundsException?
int[][] imageData={{100,90,255,80,70,255,60,5},
{255,10,5,255,10,5,255,255},
{255,255,255,0,255,255,255,75},
{255,60,30,0,30,60,255,255}};
int[] newImage = new int[4][6];
for (int i = 0; i < imageData.length; i++) {
for (int j = 0; j < imageData[i].length; j++) {
if (j <= 5) {
newImage[i][j] = imageData[i][j];
}
}
}
Purpose: taking the data from 2D Array imageData and assigning it to newImage while explicitly excluding the last 2 columns
no - your i and j start from 0, not 1
Ah yeah, I see that error now. But still, why does this cause an out of bounds exception
the terminating condition prevents the loop from traversing beyond the length of the array
Ah, hold on, I see the error now x2.
imagedata has 8 in length
I should've broke the loop within the if statement
I was conditioning it to assign the next imagedata element to newImage if j was <= 5 instead of conditioning it to break if that was the case
Realistically I realize now I should've just had the terminating condition be against the column length of newImage, not imageData and I wouldn't even need the if statement, but I was being a dumbass.
Hi, I'm making a plugin that gets all the displayed scoreboard scores and display them somewhere, but when I get all the entries I have an ArrayOutOfBoundsException.
Error: https://hastebin.com/isijowudec.md
codes (error line 4):https://hastebin.com/moputatelu.properties
@steady torrent
private void handlePing(DataInputStream in, DataOutputStream out, int packetSize, int packetId) {
Output.debug("Handling ping...");
try {
byte[] payload = new byte[packetSize];
in.readFully(payload);
String pingResponse = new String(payload, StandardCharsets.UTF_8);
out.write(0x09);
out.write(0x01);
out.write(pingResponse.getBytes());
Output.debug("Response: "+response);
byte[] serverListMessage = varMethods.readString(out, response, StandardCharsets.UTF_8);
ByteBuffer buffer = ByteBuffer.allocate(9999);
buffer.putInt(0x01);
buffer.put(serverListMessage);
buffer.flip();
Output.debug("Buffer: "+buffer.limit()+" SLM Size: "+serverListMessage.length);
out.write(buffer.limit());
byte[] outBytes = new byte[buffer.limit()];
buffer.get(outBytes);
out.write(outBytes);
} catch (IOException e) {
e.printStackTrace();
}
}
private void handlePong(DataInputStream in, DataOutputStream out, int packetSize, int packetId) {
Output.debug("Handling pong...");
try {
long payload = varMethods.readVarLong(in);
Output.debug("Payload: "+payload);
out.writeByte(0x01);
varMethods.writeVarLong(out, payload);
} catch (IOException e) {
e.printStackTrace();
}
}
```So getting close. (I hope) The MOTD still doesn't show but the client log is returning `Can't ping localhost:25569: Finished` So better then an error I guess lol
Huh... Shows a ping now though
π€·
public void run() {
try {
DataInputStream packetIn = new DataInputStream(socket.getInputStream());
DataOutputStream packetOut = new DataOutputStream(socket.getOutputStream());
handlePacket(packetIn, packetOut);
} catch (IOException e) {
e.printStackTrace();
}
}
private void handlePacket(DataInputStream in, DataOutputStream out) {
try {
int packetSize = in.readByte();
//int packetSize = in.readInt();
//int packetSize = varMethods.readVarInt(in);
int packetId = varMethods.readVarInt(in);
Output.debug("Handling packet [id:"+packetId+", size:"+packetSize+"]...");
switch(packetId) {
case 0:
handlePing(in, out, packetSize, packetId);
break;
case 1:
handlePong(in, out, packetSize, packetId);
break;
}
} catch (IOException e) {
e.printStackTrace();
}
}
```How is this outputting `[DEBUGGING] Handling packet [id:1, size:-2]...`
I believe packet size is a varint, not a byte?
The other options would messup the packetId
Yeah was confused about it yesterday as well.
To play a custom sound for a player is it necessary to specify the Sound category in
Player#playSound(Location,String,SoundCategory,volume,pitch) or
Player#playSound(Location,String,volume,pitch) can be used (even if category is specified in the custom sound file)?
I mean it's not necessary but like if you're playing mob sounds from an NPC perhaps put it in the animal or mob category
int packetSize = <>;
Output.debug("Handling packet [id:"+packetId+", size:"+packetSize+"]...");
int packetSize = in.readByte(); -> Handling packet [id:0, size:16]...
int packetSize = in.readInt(); -> Handling packet [id:9, size:268499205]...
int packetSize = varMethods.readVarInt(in); -> Handling packet [id:0, size:16]...
When it proceeds to the "pong" packet using varInt or readInt it makes the packetId something other then 0 or 1
what does it do when read as varint
iirc the category is AMBIENT by default? or at least it was
i mean because im just adding a method so it can play custom sounds (in my plugin)
int packetSize = varMethods.readVarInt(in);->Handling packet [id:0, size:16]...
and i cannot set a category since that depends on the custom sound file in the resource pack
Alonso, have you heard of adventure?

I mean, what does it do to the packet id when you read both the size and id as varint
i dont want to update my plugin when a new version appears
thats why i dont use it (well, one of the reasons)
how do you plan to support custom sounds then?
isn't player#playSound(Location,String,volume,pitch) a thing?
IDK if you read yesterdays convo but with varInt, the packetId comes out as 122 during the "Pong" packet for some reason
you don't have to update your plugin on every library update lol
d;player#playsound
void playSound(@NotNull Location location, @NotNull String sound, float volume, float pitch)```
Play a sound for a player at the location.
This function will fail silently if Location or Sound are null. No sound will be heard by the player if their client does not have the respective sound for the value passed.
location - the location to play the sound
sound - the internal sound name to play
volume - the volume of the sound
pitch - the pitch of the sound
when a new (server) version appears, i mean
ah I think you can get it by name ig
You just need to pass the string of the sound
yes, question was if it was necessary to specify
the sound category if the custom sound files
has a category specified or not
sadly i know nothing about custom resource packs
that might be an option
https://mcmodels.net/how-to-tutorials/resource-pack-tutorials/how-to-add-custom-sounds-to-resource-pack/ there's an example that has a custom category
Here you'll learn how to add and configure custom sounds or replace default sounds in a Minecraft resource pack.
I read a post with an example
the question was like, if a custom sound has a category specified (like in this case "hostile")
the code used must specify the category too?
or simply the name is enough
void playSound(@NotNull Location location, @NotNull String sound, float volume, float pitch)
@minor summit https://pastebin.com/fLybLVWd Here is the updated class. (With all comments from debugging removed lol)
Server Output;```
[INFORMATION] Initializing ConnectionBase... (Port: 25569)
[INFORMATION] Initialized ServerSocket
[DEBUGGING] PingRequest [Recieved] >> 127.0.0.1
[DEBUGGING] Handling packet [id:0, size:16]...
[DEBUGGING] Handling ping...
[DEBUGGING] Buffer: 9999 SLM Size: 716
[DEBUGGING] PingRequest [Recieved] >> 127.0.0.1
[DEBUGGING] Handling packet [id:122, size:254]...
Minecraft (Client log);```
[08:00:08] [Render thread/ERROR]: Can't ping localhost:25569: Finished
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
yes I understand your question, theoretically it should use the custom category, but is spigot we are talking about, so it is better to double check it
mmm, the example uses the command
/playsound yoursound:example.sound.name_1 hostile YourUsername
but the file doesnt have a category
{
"example.sound.name_1": {
"sounds": [
"whatever/path/example_1"
]
},

i guess i'll have to find someone to test it
yeah but the example with category has id 3
scroll down alonso
sound.name_3 has a category set
yeah, i know but no the _1 or _2
and thats after they use the command
so wonder how the hell it works
i just wanna know if i need to specify it or not xd
well, time to find someone to test it
Hello, I am using Guilds, but I type /guilds memeber only can display 54 players
/guilds memeber 2 is not work
Ok thanks
And if you look at my message from earlier I was able to get it to display a ping but the ping is a crazy number.
I am a bit confused, packet sizes don't really correspond to the IDs for the ping/status ones, where are you handling the handshake packet?
Not on my PC right now but basically it starts a server socket, uses a for loop in a thread and passes the incoming socket to that class.
Before either the ping or status packets, the handshake packet is to be handled
The client tells the server through handshake what the next "handling state" is (status state or login state)
That might be the issue then. I thought the handshake wasn't passed if the server list ping was being passed.
I'll do some more testing when I get home.
First packet that's apart of a server list ping is the handshake.
https://wiki.vg/Server_List_Ping
So "Handshake" says no client bound packet... So what would be the response?
there is no response, it's an immediate state switch to either status or login states
it's more like "hi, i am a client, I want to login/retrieve status", and so the server prepares itself accordingly to respond to the following packets
Ok so I was correct in sending the json message?
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
Output.debug(reader.toString());
StringBuilder sb = new StringBuilder();
String current;
while((current = reader.readLine()) != null) {
sb.append(current);
Output.debug(current);
}
Output.debug("Protocol: "+protocolVersion+" | "+sb.toString());
reader.close();
```Why is the `current` not outputting and the while is never exited?
i could be reading this wrong but
- doesnt assign current to literally anything
- why isnt current outputting
wait
i am reading it wrong
uh skill issue i believe
maybe reader.readLine() is empty 
uh
is in the input stream from the socket?
'cause i don't think that would work? the protocol isn't exactly composed of newline-separated chunks
Even if its not, its not continuing.
Ill check for empty as well as null then
Even with !.isEmpty it won't get passed the while loop
Exception in thread "Request Reciever Thread (25569)" java.lang.NullPointerException: Cannot invoke "String.isEmpty()" because the return value of "java.io.BufferedReader.readLine()" is null lol so it is null
ima assume you did != null && !isEmpty
yeap
and just .isEmpty()
So I'm trying to read the handshake packet but if I have to read all bytes to get the address/port how can I read the final byte (status or login) using the varInt method? Because I only see readFully().
how can i make my own custom placeholder and add into server?
I dont know if this is the right channel but I need help with skript could someone help me make a gui for papermc 1.19.3 all the ones I tried dont work
don't crosspost and wrong channel
best channel is probably #general-plugins or #1007620980627230730
or doesn't skript have a discord server?
yes but not rlly helpful
Hello! I am working on my Dialogue system, and I have a NPC who tells you your resources. I want each resource and its corresponding value to be inline, and an equal space from the next one. Currently, I am getting this. In production there will be spaces, but for debugging I put a , for when it adds a space to counteract the number of characters, and then . for when it adds 2 spaces at the end of a resource (in case a resource is the max amount of allowed characters).
Currently, the first line of silk is offset by two spaces, and I am not sure why. The last line is also weird, and I am not sure why as well. It might be the fact that it is periods and commas instead of spaces. This is the code I am using to achieve this, is there something noticeably wrong that I am doing? ```java
String toAdd = ChatColor.GRAY + key + ": " + ChatColor.GOLD + ChatUtils.convertLongToFormattedLong((long) value); // TODO ADD SUPPORT FOR DOUBLES AND LONGS
System.out.println(ChatColor.stripColor(toAdd) + ": " + ChatColor.stripColor(toAdd).length() + ", " + (19 - ChatColor.stripColor(toAdd).length()));
toAdd += ",".repeat(19 - ChatColor.stripColor(toAdd).length());
// treasury is a list strings of what to send the player, with each line being a value in the list.
treasury.set(page.get(), treasury.get(page.get()) + toAdd + "..");
The println prints what is expected, but it still is offset for some reason.
mc font is not monospaced
I didnt know that would have such a significant effect. I am planning on using unicode to make my own characters. It might be becuase silk has 3 characters that are vertical lines (or similar).
so am I lol
no I mean I'm confused on the issue
also note that your custom font would have to be monospaced or else you could run issues like this:
a |
A |
a |
It's impossible to line the | up with the A and a (first line has 11 spaces, second & third lines have 10 spaces)
I understand that and I am ok with a little misalignment, just not 2 whole spaces.
wdym?
i don't understand what you mean by offset
i think it's a monospacing issue
although thats pretty big
Β―_(γ)_/Β―
like, currently, it shoes this:
silk: 0 fur: 0
glass: 0 lumber: 0
spice: 0 ruby: 0
I want it to show this```
silk: 0 fur: 0
glass: 0 lumber: 0
spice: 0 ruby: 0
the different is in the spacing between silk and fur
because silk has i and l which are very very thin
but my code should account for everything except the monospacing since silk is 1 character less than the others, it should have 1 more space.
Oh wait, yours is spaced like that
you have that accounted for.
yes
monospacing affects it by a lot
@dusky harness look at this, it is more than monospaced
looks normal to me
the . have to be monospaced too
along with the 0 (well it doesn't really matter here bc they're all 0)
the 2nd one on the right should be aligned with the ones below it. there is something wrong witht he code
ik, just working on the letters for now
then it's normal
oh what
2nd one?
it is aligned, no?
the first one is missing a box so that's expected to not be aligned but the rest are aligned
but the code should correct for that
that is the point of the code
.
its what this line does
toAdd += ".".repeat(19 - ChatColor.stripColor(toAdd).length());
wait so, one . is different than another .?
the first two lines are identical (text wise) besides the number of characters
no, the . is different from the box
replace . with the box
oh yeah
lol
my brain is not working today
I understand what you mean
when I add/remove a period, it isnt big enough to counteract the lost/gained character
yep
if you're doing this stuff then everything has gotta be monospaced
or else it's gonna be misaligned
yeah
Hi, I wonder how others do to access the main class in a api?
See some use refection to set the instance to main class in a static field (other ways Is use same path as the main class has). Is it a better way to do it?
dependency injection
adding the main class as a parameter of the constructor
your not supposed to do the static instance of the main class as thats a bad practise
but sometimes its less messy
or can be
Depends what the api does I guess? For example, for spigot id use the service system thing, instead of static access
Is for get access to most of the classes in a plugin (like cache interfaces and more from the getters methods in the main class).
Why with the placeholderAPI plugin my ./hub no longer works
Is it (I mean I should not make new instance of the main class ether way (that can create fun issues))? or do you mean you should move the logic from main class to one or several "helper"(to split it up a bit so in not fill up the main class, what i mean with helper) classes?
Singleton moment
That sound like interesting approach (will look on that, if I use that way I hope not they try use the constructor also π (they could not also make new instance of the class)). I think on setter approach also (but I scratch that idea, because someone can be stupid and try use that).
yeah main class are almost as a Singleton class , but at the same time not (according to several google result). So can't confirm what that really fit π
I i'm 99% sure your are in wrong chat now? or do I misunderstand your question?
no you misunderstood the question
when I do the command ./hub in the minecraft chat it doesn't work with the plugin
So is it a development question or plugin support question?
plugin support
Should you not ask in #placeholder-api then?
Also you should provide more info about were this hub command is from. I not think that command exist in placeholder-api, if i'm not remember wrong.
definitely not reflection, the service manager or DI are your best options
also if I use dependency injection to instantiate the api class I still has to use static (because they should not make new instance of that class (they will then not have access to right instances the main class create)).
just use service manager or a static getter tbh
although im still not entirely sure what you're actually talking about lmao
private final Map<UUID, Map<LevelType, Integer>> cachedLevels = new HashMap<>();
public boolean addExperience(Player p, long amount, LevelType... types) {
Map<LevelType, Long> currentExperiences = this.experiences.getOrDefault(p.getUniqueId(), Collections.emptyMap());
List.of(types).forEach(type -> {
int currentLevel = getLevel(p.getUniqueId());
long newXP = currentExperiences.getOrDefault(type, 0L) + amount;
currentExperiences.put(type, newXP);
this.experiences.put(p.getUniqueId(), currentExperiences);
});
return true; // TODO
}
}
odd question.
If I I update the map (currentExperiences.put ...), do I have to update the original map where I pulled it out from?
or in this use case since it's getOrDefault I have to put it in the original map regardless?
Use compute If Absent if u want to put
Not getOrDefault
first time I hear about computeIfAbsent lol
I can do simple example then.
The main class
https://paste.helpch.at/ubotahamit.java
This has different package an the main class has below (so it it more or less "own project the api").
Interface inside the api
https://paste.helpch.at/aneroqumov.kotlin
The "main class" from the api look like something like this.
https://paste.helpch.at/sobikusile.csharp
so if it's empty, then it will set it to the value I provide? that's how computeIfAbsent works?
okay, well, i read the docs, I think I understood
I could add constructor to the api class, but others can then try make instance of it (both consciously or unconsciously (they could do it with the example class i show)). Is not easy to make a good way without also create ways you should not use the api.
yeah but first it need right instance to get data on the interface getters from the real mainclass.
I only see one or two examples others use the api in there plugin (one use reflection to set the field).
I not think is the most stable way do it with reflection.
Hey
hay π
Can someone help me with a plugin fork made by me not compiling?
was it compiling before you made changes to it?
Yeah
ERROR: incompatible types: java.lang.String cannot be converted to org.bukkit.entity.Player
sounds like you're trying to coerce a String into a Player object
post the line the error points to
dont post all of it just the part the error references
Which i got it from
But works fine
.add("{target_ping}", BukkitReflection.getPing(target.getName()))
That's the faulty line
got it from this:
.replace("{player-ping}", String.valueOf(BukkitReflection.getPing(player)))
looks like getPing accepts a player object as a parameter
not a string object
so remove your .getName() call
sounds good
Now this appears:
/home/runner/work/Practice/Practice/src/main/java/rip/crystal/practice/match/duel/DuelProcedure.java:[58,80] cannot find symbol
Error: symbol: method target()
Error: location: class rip.crystal.practice.match.duel.DuelProcedure
post the code you just changed as it is now
.add("{target_ping}", BukkitReflection.getPing(target()))
wait
I changed it to .add("{target_ping}", BukkitReflection.getPing(target))
now
i have to go
ok
Kinda need help with gradle stuff lol... getting this error, is it because it isn't getting the java?
I am quite confused
trying to build a normal java app with gradle
I run mvn complie and it don't create the jar, what am I doing wrong?
run mvn package
or mvn clean package
still nothing, I have not worked with this plugin for a few years
does it give an error
the command is supposed to work so we need more info
there's no jar in Main\target?
can anyone refresh my memory of what this line does? LocalDateTime.ofInstant(Instant.ofEpochMilli(firstPlayed), ZoneId.systemDefault());
Gets the localdatetime of an instant and uses the timezone of the system I think
ok, thats what I thought, I'm looking for a line that gets first login date for a player
Is there anyway to cut bStats from PlaceholderAPI specifically for me????
lmao why would you ever want bstats cut
I can't stand it, I downloaded the oldest version of the Placeholder API, and there it is also present, how do I get rid of it????
like you dont want your server versions and player statistics leaked out?
its anonymous tho
this will do the trick

In my case, I need her not to appear at all
Yeah if you toggle it off it won't send anything
I run the server remotely from a USB drive with a read speed of less than 1 megabyte, and every file that appears is important to me
ahh...what?
how can I remove the appearance of the PluginMetrics folder due to PlaceholderAPI????
If it's critical you could compile your own version of PlaceholderAPI that doesn't include bstats as it's open source
But that can be quite advanced for beginners.
It sounds very strange, but it works, and every file, whether it's a folder, it really aggravates the situation, so I try to use everything I need for me.
are you trying to delete bstats because of the folder it generates in the plugins directory?
Yup that sounds like it
silly π
the bstats folder canβt be deleted
Yes, this is exactly what I wanted to do, I redid the plugin for myself, now there are no folders there.
It's really nice to the eye
i see
well if you did it then more power to ya
but frankly that folder will have exactly 0 impact on performance regardless of what storage media you use or what the transfer rate is
But the eye is happy)))
russian?
yes
me too π
ΠΡΠ»ΠΈΡΠ½ΠΎ! π°
I'm a web3 full stack developer with 7+ years of experience in full stack development and 3 years of web3 experience. Currently looking for job.
Hello. So I got this regex problem. I need to group player name and message in two separate groups, but i have many possible ways that player chat string could look like.
Currently I have:
^\[\#\d?\] *.*\s.* (.*) \Β» (.*)$
That does: https://i.imgur.com/Fgis3Hi.png
Test strings:
[#] γ Uzkuri [BOOMER] Β» asd
[#] γ Uzkuri Β» asd
[#] Uzkuri [BOOMER] Β» asd
[#] Uzkuri Β» asd
[#1] γ Uzkuri [BOOMER] Β» asd
[#1] γ Uzkuri Β» asd
[#1] Uzkuri [BOOMER] Β» asd
[#1] Uzkuri Β» asd
Uzkuri is name of the player and asd is their message
I dont really understand on how to make regex ignore the [BOOMER] tag...
Ideally i'd have only 2 groups
([\w_]{3,16}) .+ <arrow thing> (.*) maybe smth like this?
how it captures everythong it didn't before
@warm steppe wb (\w{3,16})(?: (?:.+)|) Β» (.*)
its just gaby's regex but an | to match either the [stuff] or nothing (whereas gaby's required the [stuff])
group 1 = username
group 2 = message
If itβs just about looks, and you have future problems similar, you can just make files hidden haha
Hello in a Inventory menu, should i put tags on items to listen or only their name and check if the click from this inv ? Bcz when i use f3 + H in servers they don't seem to add tags
How can I paste a schematic (WorldEdit) on top of existing blocks not get things like lanterns to drop their items?
if I were you I would use something like the RedLibs InventoryGUI system, which allows you to create a listener embedded into the item. Learn more here: https://github.com/Redempt/RedLib/wiki/InventoryGUI
TriumphGUI π
i personally just check the slot the item is in and do stuff based on that
need help
how do i add a permission
like
make it so u need a certain permission to be able to click on a button in my gui
e.g. if i make a gui using deluxemenus and i want to click on an item for it to claim a kit, however if you haven't got a certain permission, you can not claim the kit
HELLO, i need help with some worldedit stuff yeah yeah
i have 2 CuboidRegions (region1 and region2). i want to copy all the blocks with a certain material from region1 into region2 in the same positions (assuming the regions are the same size)
how can i do this? could i get the centers of both of them and find the difference between them, then loop thru blocks of region1, applying the difference to each block?
Yeah, I would get the center of both regions and just have a xOffSet, yOffSet and zOffSet for each block from the center. And then apply difference later using the offsets
problem with this: sometimes the center will be a double (when lengths r even), which wont work since block locations are ints (maybe i could cast? but idk what rounding issues that might cause)
why would you use the center instead of one corner
one corner can be the same for both regions but the regions can still be completely different
if one corner is the same, and they are the same size, then the regions are both exactly the same
no...
these both have the same corner (in the middle), but the "blocks" inside them r different https://go-to.srnyx.xyz/chrome_oH6oSiqw1L.png
yeah, but you're not picking an arbitrary corner, pick like "north east" corner of both regions
i c
then make your offsets relative to that specific corner
you won't need to worry about rounding if the size is uneven
So I'm pretty sure this has been my issue with packets...
Why does the ping packet come in like this?
And not the normal
Size,ID,Data?
I have a class, and then a bunch that extend it and provide modifications. How can I check if it is the plain class and not one of the modified extended classes?
Looks like the 1.6 protocol before they started using Netty. Client -> Server
Its 1.19.3 though...
Oh, if the client doesn't receive a properly formatted response then it will try a legacy ping (1.6 protocol)
i eat code for dinner
Do you like print it out and eat it as paper, or?
You can check obj.getClass().equals(whatever.class)
although if you need to do that, thereβs probably a design flaw in your oop
you should instead call overridden methods that differ per subclass
Is this json invalid for use in the status packet?
{"version":{"name":"1.19.3_Beta-0.0.1","protocol":761},"players":{"max":100,"online":1,"sample":[{"name":"yapperyapps","id":"8e73185f-845c-4336-86f6-b9c5d475e6fd"}]},"description":{"text":"1.19.3 Beta"},"favicon":"data:image/png;base64,","previewsChat":true,"enforcesSecureChat":true}
Maybe the favicon entry? Looks like it's missing info
I don't think it's a path, I think it's the image encoded at base64 isn't it?
Yeap, you're right
Even with an image converted to base64 it doesn't work. Same issues occurs. (Attempts 1.6 ping)
Hm, I dunno then. The output looks right compared to the one on Wiki.vg (outside of the favicon thing that I presume you fixed)
Yeah can't find the default one though was trying to test with that as well.
Will try again when I get on my pc
I wonder if the name should just be 1.19.3 instead of 1.19.3_Beta.xxx
Maybe. Will try that to later.
name doesn't matter
the client doesn't care about that
the data itself looks fine, make sure you're sending it properly
i.e. prefixed with length and with all the right packet metadata
If the client doesn't care why is it even there π¦
well, I am looping through a collection of classes, and they vary in modifications. I want to only get the ones that are plain, and not the ones that arent. The ones that are plain are essentially "empty" and just hold data. The other ones have actual uses and methods attached to them.
if they are empty, perhaps it should be abstract class or an interface
this will force instantiation
it was an abstract, but I wanted to access the data, and didnt feel like making a class that has nothing in it that is just a "empty class" since it has nothing different than the blank class it extends.
you can access the data with getters, no?
I could, but if it was abstract it wouldnt be able to stand on its own
I already tried that and IntelliJ yelled at me
thats the goal, is there a need to have a non-specific implementation of the class?
otherwise you should force objects to be initialized as subclasses
They are plots, and the plain plot class just holds the location information and such, and then each extending class is for things like a lumber mill, or a mine. I am using the plain plots as a location holder to symbolize an empty plot in the grid. I need them to be there holding information to check when things go in and out of them.
I am not sure if there needs to be a non-specific
ok so you should have a base class called "Plot" or something, and implement the methods for getLocation() and all the shared information
then define abstract methods for anything specific to MinePlot or LumberPlot
but I am going to have 150+ plots
I dont have abstract methods on the Plot class for all of those
150+ plots, or 150+ plot types?
plot types
currently the mine plots and lumber plots handle everything on their own, and I just check if they are an instance before I interact with them.
abstract methods are ones that should be different for each subclass
what do you mean by this
well, I share the information through the Plot class constructor
I mis understood you, disregard that statement
Do you want code examples?
yeah
do you really need 150+ implementations of Plot?
i can't imagine that so many behaviors will differ
my brain is not working that well today lol. I will probably have like 50 implementations. I also have various implementations of Plot that are abstract as well, like some have stuff for the plots that generate resources, and others have stuff for the plots that have dynamic buildings and stuff
here is my plot class
here is the mine plot class: https://paste.helpch.at/kazufetoya.java
ok, so will there be objects of the base type Plot at all? or will they always be subtypes like MinePlot
ok, you should make it abstract class then
or an interface, i havent bothered much to learn the best use-cases for them but im sure everything is possible using either
Yeah, I just didn't feel like making a whole subclass just for an empty plot, since it would contain nothing more than what it extends but I guess that is what needs to happen for the structure to make sense
Basically the only downside of abstract classes are that it cannot have multiple extending a class
So use interfaces wherever possible unless it requires a feature of abstract classes
ah ok, what is an example of a feature from abstract classes, that interfaces wont have?
Interfaces do not have any implementations
conceptually, interfaces are more of a "contract" than anything else, "here is what this type is capable of doing, here is how you operate with it", but how it does what it does is not (or should not) be relevant (so called implementation detail), so long as the impl complies with the interface contract and you are aware of it
Yea
abstract classes are more like unfinished classes, they might do some operations, have methods with working implementations, but they can have abstract methods (unimplemented methods) for subclasses to "fill in the blanks" and complete some functionality
ok, but if you want to use polymorphism than arent abstract classes the better option?
not necessarily
the only option?*
.
interfaces are "more" polymorphic than ac's
polymorphism can, ironically, take many forms, not just through inheritance
umm that's not ironic it's apropos π€ π€
from wikipedia:
Interfaces are used to encode similarities which the classes of various types share, but do not necessarily constitute a class relationship. For instance, a human and a parrot can both whistle; however, it would not make sense to represent Humans and Parrots as subclasses of a Whistler class. Rather they most likely be subclasses of an Animal class (likely with intermediate classes), but both would implement the Whistler interface.
having a Whistler interface gives you far more flexibility of polymorphism than a pure parent-child relationship would
so then interfaces can be like characteristics of a class
Picture this scenario:
I make a plugin that stores some kind of player data, and I want the user to have the ability to choose what kind of storage my plugin uses (mysql, mongodb, sqlite, ...)
Then my plugin would have some Storage interface that defines the contract of what methods it has and what they do (savePlayerData, loadPlayerData, deletePlayer... etc)
Then from that interface I create many implementations, one for each storage method (MySQLStorage, SQLiteStorage, MongoDBStorage etc), those are concrete classes
Overall, the plugin works with the single Storage interface, it is abstract, but the underlying implementation is one specific kind of storage (since there are many implementations, it can take many forms)
mongodatabase
mongodatabase
Mongodatabase
yes generally
i mean
there is still a hierarchy
honestly tldr is use interfaces unless you specifically need it to be an abstract class (having certain fields / constructors / methods implemented)
!
can you quote that again?
Sorry
Discord removed the quote button
π€
hmm. what do i do if i require features of an abstract class
was joke, i wanted him to do this again
Remember when discord added in this sorry excuse for a quote
I see that as a positive, the actual downside is that they force you to couple the subclass with the super class
Mixin-based inheritance would encourage the same coupling even more
Also single inheritance increases performance by allowing invokevirtual calls instead of invokeinterface
any performance increase is literally unmeasurable
unless the entirety of the jvm runs in interpreter mode by disabling compilers
which is a very dumbass move
jvm trait system when?!?!

