#help-development
1 messages ยท Page 318 of 1
aight sick
i want to shade an api in a project with a different package namespace, how do i make it so who uses the api has the package namespace changes also?
Huh? Why?
i have an engine which has an api, and i have multiple projects that uses the engine separately
i want people to be able to use multiple projects or just one easily
so i shade the engine in a subpackage of said project
along with the api
but if i add the dependency of the project to expand upon it, the api remains like before the shading
and i get class not found whenever i try to run the jar
Are you relocating everything properly?
yeah, up to the project itself gets relocated correctly
but if i try to create a miniproject that has the project as a dependency it gives me class not found issues
It wants lower case, yes.
okay, thx
[a-z0-9/._-] just means the only valid characters are lower case letters, numbers, and those 4 symbols.
Yes, I understand, this is a regular
when it comes to API's you should not relocate them
how the API looks as a dependency is how it should look in the Jar that implements it
It still doesn't like something, although I have indicated it .toLowerCase(), maybe someone has a NamespacedKey list for enchantments?
remove requirenonnull
not sure what is with everyone using this method incorrectly
to remove the warning ๐
what warning?
that smth might be null
By the way, this topic with requirenonnull appeared kind of recently, is it worth using it at all?
and people think lets just add req nonnnull so the warning is gone
as ijntellij suggests
it throws an exception if you pass in smth that is null
Yes it has a use, just not the way you are and many others are using it because all you are doing is hiding the actual error/problem when it is null. That method doesn't stop it from being null.
what that method is for is after something has been null checked or ensured that it can't be null
if it is null something serious happened
its also more useful in regards to testing
this is dumb
Ah, that's it, got it
that intelliJ suggests it
hmm since when is @java.lang.annotation.Native a thing?
since java 8
hmm seems like 1.8, i didnt know it was in the public code
I don't understand.. Does anyone have an example of getting enchantment by name (via NamespacedKey)?
It's just that I get null if I use this:
EnchantmentWrapper.getByKey(NamespacedKey.minecraft(NAME.toLowerCase()))
okay, sec
i think you can do it with scoreboards
good way to make some ghosts
for (String s : instance.getConfig().getConfigurationSection("enchantments").getKeys(false)) {
if (EnchantmentWrapper.getByKey(NamespacedKey.minecraft(s.toLowerCase())).canEnchantItem(itemStack)) {
enchants.add(EnchantmentWrapper.getByKey(NamespacedKey.minecraft(s.toLowerCase())));
}
}
Config:
ig impl calls this then
if anyone is interested in that sort of thing
you need to make sure ConfigurationSection is not null
if(instance.getConfig().getConfigurationSection("enchantments") != null) {
}
okay
yeah cuz ur doing it wrong
ur not supposed to add player.getName to npcs
you're supposed to add the npc
only makes sense that team npc should have well npcs
really should stop using requirenonnull
I'd split it into assignment and nullability checks
you'd probably end up calling getSection twice
now, using the namespacedkey method
makes it so you need to pass lowercase, minecraft names
instead of the bukkit enum values
lets see if they remove requirenonnull
for example
which wraps into
The error part is on the config, not on the code itself
and requireNonNull is honestly worthless because it just does a null check into a NullPointerException
EnchantmentWrapper.getByKey(NamespacedKey.minecraft(s.toLowerCase()))
So I removed it, there is no this
passing sharpness works, passing DAMAGE_ALL returns null
not only that, it has the tendency to mess up the stacktrace preventing from seeing where the null is most likely happening too
pointless code shouldn't exist in the first place
if java's garbage collector actually worked properly this code wouldn't even exist
Enchantment.getByKey if you want it shorter

requirenonnull is mostly for testing and API usage because people dumb lol
how?
because most of the code is absolute garbage
LMFAOOOO
and checking for null or anything to do with null objects is because the Java developers implemented Null into the JVM which they regret
I use .toLowerCase
passing damage_all doesn't work either as it's the bukkit name
I'm glad everyone agrees on null being the worst possible thing
and not the minecraft namespaced name
In general, I can overwrite everything in lowercase in the configuration
Option OP!
Optionals are nice just 'cause they're monads.
Where can I find minecraft names?
It's literally just the default names
someone explain me what monads are
sharpness and all
are those there constantly or just on spawn?
Wrappers that have a map function.
At least, I'm pretty sure that's the simplified definition.
or be fourteenbrush and go in the stash for every single line of code you'd like to see
ah
because middle clicking is too much effort
dont have a spigot project open
stash is faster
that's caused by the npcs moving
thank you
not my fault you run your IDE on a raspberry pi
weird. how do u spawn them and what do you do after?
or a literal toaster
bro
just make everything optional ๐
just be an absolute unit and like
๐ถ
nah a smart fridge
inject into the network channel and cancel out those packets
throwback to when I made a particle culler on the network thread because we were accidentally ddos'ing players
wat
I still love how there's legit 3 representations of most types, from NMS to CraftBukkit to Bukkit.
what he's saying is location = location.add() can just be location.add();
or this.location = location.add();
do you do anything with this.npc after?
yep i have no idea why that happens
Is it fine to make a BukkitRunnable that runs every tick so I can update the TPS of the server in a scoreboard?
10 it is. Thanks
are you calculating tps yourself?
No
ok yeah 10 ticks to update the scoreboard
how do u know which is the right particle?
i just realised player.getInventory().getContents() doesn't give the item in the off hand
what can I do to get item in the off hand
and remov ethis item from inventory if necessary
wait no getContents gets the item
but i cant remove it
sup guys!
I'm creating Sumo MiniGame, but I need some Algorithm that creates Duos ( which fight each other )
Any ideas how it should look like?
place all the participating players in a list and choose two random ones?
what about if player size is 23?
should I let some random guy play twice?
arent they placed in a queue and teleported to the map when another oponent is found?
just let them wait if theres nobody
its different kind of "minigame"
I forgot to mention it
Its an Event.
So all those players that are present at the start will participate, those who join later won't
uhh hope someone plays twice?
ig so
is there some tool that i can look at both the mappings between mojang and md5?
i know my way around md5's mappings
screaming sandals has mappings overviews
if that is fine
not really a "diff" tho in the git sense
if that is what you are asking for
md5 has mappings? whebn did that happen
the class names
i'm used to md5's nms class names
i'm using ?nms now
but for me it's as good as obfuscated
i have to relearn my way
md5? spigot mappings?
Actually, screaming sandals kinda does have a diff viewer. Not exactly the same, but incredibly useful.
https://nms.screamingsandals.org/comparison/mojang-to-spigot.html
They honestly should redo that page though. It loads the entire list at once and it is slow to navigate through.
Whats wrong in this method? its not removing item from drop
private void removeSeed(Player player, CropType cropType, BlockBreakEvent event) {
Material seedMaterial = cropType.getSeedMaterial();
if (seedMaterial == null) return;
for (ItemStack drop : event.getBlock().getDrops()) {
if (drop.getType() == seedMaterial) {
drop.setAmount(drop.getAmount() - 1);
return;
}
}
}
dont you need to re set the drops?
you mean remove & create new drops?
event::setDrops
uhh idk
block drop item event
This is the event to losten to
PlayerChatTabCompleteEvent is deprecated, what can I use instead?
implements TabCompleter
you would probably have to use that then
๐ฆ
?paste
Why doesn't my event get cancelled?
https://paste.md-5.net/xicusogesi.cs
[19:42:36 INFO]: DATA: 0
[19:42:36 INFO]: cancel
did you register the listener?
yeah
erm yor event is getting called
I mean otherwise it wouldnt print "DATA: 0", right?
oh cancelled lmao
sorry I misread
yeah
if I do it after the async task, then will it wait for this task to finish?
no
is there a way to save async and to cancel the event?
cause I don't want to deal with chunks sync
no, not in the event listener
ok, thank u
what are you trying to do?
well
I'm basically trying to limit the given blocks in a given chunk. Like, for example, u can limit players to place only 3 diamond blocks per 1 chunk, etc.
I'm just checking if the placed block is in restricted list and then count all the blocks of this type in the given chunk
I'd use the chunk's PDC for this
And if the number of them exceeds the limit, then the event gets cancelled
everytime a player places e.g. a diamond block, you get the current amount of diamonds in this chunk from PDC, add one, and save it again
yeah, but if I have a world that had been created before the plugin was installed
then simply listen to ChunkLoadEvent and manally calculate it once for each chunk
oh, I've just realized that I'm writing this plugin for 1.12.2 and there's no PDC support
private final NamespacedKey ALREADY_SCANNED = new NamespacedKey(this, "already-scanned");
private final NamespacedKey NUMBER_OF_DIAMONDS = new NamespacedKey(this, "number-of-diamonds");
private static final int MAX_NUMBER_OF_DIAMONDS = 10;
@EventHandler
public void onChunkLoad(ChunkLoadEvent event) {
if(event.getChunk().getPersistentDataContainer().has(ALREADY_SCANNED, PersistentDataType.BYTE)) {
return;
}
event.getChunk().getPersistentDataContainer().set(ALREADY_SCANNED, PersistentDataType.BYTE, (byte) 1);
event.getChunk().getPersistentDataContainer().set(NUMBER_OF_DIAMONDS, PersistentDataType.INTEGER, getNumberOfDiamonds(event.getChunk()));
}
private int getNumberOfDiamonds(Chunk chunk) {
int numberOfDiamonds = 0;
for(int x = 0; x < 16; x++) {
for(int y = chunk.getWorld().getMinHeight(); y < chunk.getWorld().getMaxHeight(); y++) {
for(int z = 0; z < 16; z++) {
if(chunk.getBlock(x, y, z).getType() == Material.DIAMOND_BLOCK) {
numberOfDiamonds++;
}
}
}
}
return numberOfDiamonds;
}
@EventHandler
public void onDiamondPlace(BlockPlaceEvent event) {
if(event.getBlockPlaced().getType() != Material.DIAMOND_BLOCK) return;
int alreadyPlacedDiamonds = event.getBlock().getChunk().getPersistentDataContainer().getOrDefault(NUMBER_OF_DIAMONDS, PersistentDataType.INTEGER, 0) + 1;
if(alreadyPlacedDiamonds >= MAX_NUMBER_OF_DIAMONDS) {
event.setCancelled(true);
event.getPlayer().sendMessage("You cannot place any more diamond blocks in this chunk, you fucking imbecile piece of shit.");
return;
}
event.getBlock().getChunk().getPersistentDataContainer().set(NUMBER_OF_DIAMONDS, PersistentDataType.INTEGER, alreadyPlacedDiamonds);
}
@EventHandler
public void onDiamondRemove(BlockBreakEvent event) {
if(event.getBlock().getType() != Material.DIAMOND_BLOCK) return;
int alreadyPlacedDiamonds = event.getBlock().getChunk().getPersistentDataContainer().getOrDefault(NUMBER_OF_DIAMONDS, PersistentDataType.INTEGER, 0) - 1;
if(alreadyPlacedDiamonds >= 0) {
event.getBlock().getChunk().getPersistentDataContainer().set(NUMBER_OF_DIAMONDS, PersistentDataType.INTEGER, alreadyPlacedDiamonds);
}
}
}
here's how I'd do it
ugh
hm then I'd use an SQLite database where y usave the amount per chunk
you definitely should not recalculate it on every block place, but only parse it once and then keep track of it in memory or sth
yeah, probably, ty
ty for that, even though I can't use it
np
well you could just change the whole PDC stuff to a Map<Chunk,Integer> or something, and then either save it to a database, or in theory you could also just use YAML
then you load that map on startup and save it async every 10 minutes or so
will not that be too heavy operation to store the information in the RAM?
if you have many chunks
for example
how can i remove an item in the off hand
Player#getInventory#setItemInOffHand()
It would not work because there is no #remove() method on the ItemStack class.
not really, I mean you only need to store something to identify the chunk, and an integer
e.g. to identify chunks, I'd create a tiny data class with chunk coords
public class ChunkCoordinates {
public int x, int z;
}
sth like that
then you can have a Map<ChunkCoordinates, Integer>
I'll definitely try that one, thanks!
is the paperweight readme outdated?
PDC::setIfAbsent when
and remove that actually returns smth
what do I have to set it as
in oredr to remove it
null
i would be happy if it was possible to declare a Map<record(int, int), Integer>
that'd break existing plugins though :<
because when you change the return type, then existing bytecode won't work
?whereami ๐
sighs

i found you on yt
Whomstdve
I'm a chicken nugget
that can only be one person
that dude looks like a crack pipe
green hill tails
anyone here using jetbrains sync?
to have the same plugins, settings, themes etc on all computers
e.g. code style settings
bla bal
ye
whats the problem
I wonder what happens if I do this:
- Enable sync on windows
- Enable sync on mac
what now?
does it now throw away the settings I had on mac and use the windows ones?
uhh one of them had to push settings to the server
and i believe it overwrites settings ye
Depends on how the sync works.
yeah obviously, that's why I asked lol
What does it even sync?
well ig
Ah, it's setup so that you pull changes if you ever push them.
If you setup on Windows first, it'll save those settings.
Then you can pull them down onto your mac
you have to push them to the server first yes
whoa I didnt know you dont need a space between annotations
I am implementing PersistentDataContainer and paper has a few methods that I need to override because paper users expect to have them
e.g. readFromBytes(byte[]) or has(NamespacedKey)(
Is there a better way of comparing 2 images instead of just... getting colors and comparing the bytes individually?
Assuming they're always the same dimensions
right now I just...
anyone ever seen this weird message in test scope? D:
hm I guess that's your only option then
thing is, Image#equals(OtherImage) might be heavier
than just converting it all to a minecraft color array
and checking that array
as my method of getting colors is quite optimized
I mean it might be making a few too many colors
you could also extend bufferedimage and add some kind of hash that you generate when the image is created.
then just return false in equals(AnotherImage) when the hash is different
How can I spawn "Barrier" Particle?
Guys, what do you think is the best version for the mini-games server? (In terms of version features, mechanics, plugin development capabilities, gameplay, etc.)
this is what I mean
use BlockMarker particle and throw in the apppropriate MaterialData or BlockData
ty
I read on the forum, many write 1.8, 1.16.5, 1.19.3 (latest)
if you dont need 1.8 features, dont use it
e.g. like this
world.spawnParticle(Particle.BLOCK_MARKER, loc, 1, Material.BARREL.createBlockData());
just did it like so ๐
thx
1.19.3
the answer is basically always latsts
A difficult choice, however
Although plugins (public) are being updated quickly now..
Arrow a = (Arrow) e.getProjectile();
```I've got the arrow that's shot by a custom mob. Is it possible to change the arrow's speed? (preferably without using NMS)
change the velocity
e.g. to make it twice as fast:
arrow.setVelocity(arrow.getVelocity().multiply(2.0));
wouldn't that just make the arrows fly randomly around? I think I've tried it already, hold on I'll update you
no, that makes it twice as fast
yup, looks like you're right! Although my mob is so clumsy can't even hit me properly
so I thought it just changed directions
thanks once again mfnalxe
np
anyone got any idea why my unit tests don't run?
POM: https://paste.jeff-media.com/?56566e60e347b851#G8EnaFTSRXjqNjjz62kBuLJrSyfjf7BiQsqnqGJ74L6D
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ CustomBlockData ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.843 s
[INFO] Finished at: 2023-01-19T19:51:29+01:00
[INFO] ------------------------------------------------------------------------
Project layout & test:
in theory it's infinite
I mean, concurrently you'll hit the port limit lol
or I guess open file descriptors
dunno which you'll hit first
the JVM doesn't limit you tho
the OS does
either 65536 or your open file descriptor limit
but http/2 can do multiple requests in one connection
you should never do that tho
that is to the same target tho
oh
that is what they are doing
idk, you should never be hitting this tho ?
WHY DO MY FUCKING TESTS NOT RUN D:
yes, see screenshot above
java 11+ has a pretty nice http client
can just use that if you want to
you'll never hit the limit xD
tho pls cache shit
cache the response from the network if possible ?
if 100 people request https://enka.network/u/0/something_data.json
no need to get that 100 times
idk, depends a lot on your application
and expected usage
it would not be
maybe your proxy is clever enough to cache the result ?
I mean, that is also a public API
you'll have to think about rate limits
https://github.com/lowlighter/metrics wtf is this shit
they dont explain AT ALL on how to use this
Have you tried removing that poppy
I tried with the normal TreeType.TREE first
I keep getting this error in pom: [WARNING] Could not transfer metadata org.bukkit:bukkit:1.9.4-R0.1-SNAPSHOT/maven-metadata.xml from/to maven-default-http-blocker (http://0.0.0.0/): transfer failed for http://0.0.0.0/org/bukkit/bukkit/1.9.4-R0.1-SNAPSHOT/maven-metadata.xml [WARNING] org.bukkit:bukkit:1.9.4-R0.1-SNAPSHOT/maven-metadata.xmlfailed to transfer from http://0.0.0.0/ during a previous attempt. This failure was cached in the local repository and resolution will not be reattempted until the update interval of maven-default-http-blocker has elapsed or updates are forced. Original error: Could not transfer metadata org.bukkit:bukkit:1.9.4-R0.1-SNAPSHOT/maven-metadata.xml from/to maven-default-http-blocker (http://0.0.0.0/): transfer failed for http://0.0.0.0/org/bukkit/bukkit/1.9.4-R0.1-SNAPSHOT/maven-metadata.xml
?paste
Here is my pom: https://paste.md-5.net/ecacugomut.xml
^^
dont use http, ever
remove both the bukkit dependency and repository
nms?
?nms
nms
oh 1.8.8 lol
yes
people hosting minecraft source code online ๐
nms still comes in the spigot artifact though
yah
No need to depend on bukkit
Not for 1.8.9
or craft bukkit
the method works in other places, it is failing silently though...
I do love redistributing unlicensed code
same
yes it does
How do you access it because if i removed the dependency it wouldnt work
It should return a boolean
Run BuildTools
?bt
yes i did that
is that this?
im just doing that now
just returns false :(, lemme look at the impl to check why
i see
ur supposed to have bukkit not craftbukkit normally
In the maven you get from the spigot website it includes bukkit
You depend on Spigot when working with Spigot
Spigot already includes the bukkit api
Ok thanks that doesnt really make sense why they would combine them then
I see I wasnt aware of that relation
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
``` Did that and the packet classes aren't getting recognized Im assuming I need to change something with the repository?
Depend on spigot not spigot-api
spigot-api only includes the api and not nms
Make your own class loader
When i get home
or you know use the libraries feature that's included since 1.17.1

Reflection
That's not how you're supposed to do it
Don't try to force it to load like that
Use your own class loader
Like I said
Look at this
That won't work
It happens
Uses the sun Unsafe to make everything accessible again
why the heck does SLF4J's Logger inter not have any info method o0
only debug and warn
what logger?
Alternatively https://github.com/Starloader-project/Starloader/blob/master/src/main/java/net/minestom/server/extras/selfmodification/MinestomRootClassLoader.java is another Classloader implementation (which is a bit overkill for our purposes are unsuited for bukkit, but still a treasure trove for dabbling users)
Deencapsulation.deencapsulate(ClassloaderClass.class) (or Deencapsulation.deencapsulate(classloader.getClass())) and then do your .setAccessible() thing
Simple as that
It has a jitpack, but if dearly needed on another way I'd just include the Deencapsulation class file - it's just a small single file anyways
com.sun.org.slf4j.internal.Logger
Basically SLF4J's LoggerFactory.getLogger(MyClass.class)
com.sun ๐ค that probably is shaded slf4j
that's the only thing I got on my classpath though lol
Eclipse hides those packages anyways by default
oh lmao I'm stupid, I removed SLF4J dependency
It is, included in the JRE
Yep
Also fix your IDE settings, in 99% of circumstances you don't want to have sun internals (outside of the Sun unsafe)
damn I didnt know Lombok had an @Slf4j annotation
Nah that was regarding @tender shard
yeah I just used Lombok's @Slf4j now and use that
with lombok:```java
@Slf4j
public class LogExampleOther {
public static void main(String... args) {
log.error("Something else is wrong here");
}
}
Without Lombok:
```java
public class LogExampleOther {
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LogExampleOther.class);
public static void main(String... args) {
log.error("Something else is wrong here");
}
}
Myeah, not completely useful
I find it useful
If I wanna e.g. swithc to COmmonsLog, i can just replace the annotation
I just have an intellij live template
I just type .logger
and it creates exactly that xD
oh i saw like 2 more libraries that do this too
one was called Overlord i think
SLF4J is basically the standard here
commons log 
hm that doesnt work for me
or Log4j or Log4j2 or whatever
Well that lib was made by one of the recaf maintainers and used within recaf, so it is more standards
Yeah, everything supports SLF4J
idk I find @Slf4j easier than creating the logger manually
Exception is JUL, but SLF4J provides bridges for that too
i never understood why people hate lombok so much
only useful part is @Delegate
I think @ Data, Getter, Setter, RequiredArgsConstructor, AllARgsConstructor etc useful too
records
I find it to be more "correct" to have a single logger for the entire application rather than one logger for each class
sneaky throws is meh
SneakyThrows can also make sense
e.g. if you read a file and you already checked whether it exists, so it can not throw FileNotFoundEx
but tbh that's the only reason I can think of where it makes sense
or maybe for Class.forName if I know that this class exists
that's also useful
i dont think @util class is worth using on most projects
only like public libs like jefflib
that too
records
records are not mutable
yes
or are they?
why that? if I have a Person data class, I wanna be able to adjust the name, weight, age, ...
also records have a weird syntax and they are not available in java 8 and 11
all fields are final
but it's the same Person, only their name changed. It would feel weird to create a new person just to rename them
At that point you use kotlin
separate your data from the logic and you are fine
nah I dont like kotlin for many reasons
Then don't complain about outdated java versions
you can re-create the data if you need changes and mutate wherever you keep it
@Data
public class Person {
String name;
Address address;
final Date birthday;
}
I dont see anything wrong with this ^
until that class ends in API 
and now you don't have javadocs
and some other instance mutates your person type
yeah for API I'd ofc not use that
so now you have to clone the person before returning
but for a tiny data class I only use myself, why not
ยฏ_(ใ)_/ยฏ
do you guys have this error?
ignore it
it adds getters, setters and constructors
hi
and equals() and hashcode() and toString
my ocd doesn't like it tho
You can exclude those resources from gettings shaded
Gimme a minigame idea
do you know how? i try one already
with lombok:
@Data public class DataExample {
private final String name;
@Setter(AccessLevel.PACKAGE) private int age;
private double score;
private String[] tags;
@ToString(includeFieldNames=true)
@Data(staticConstructor="of")
public static class Exercise<T> {
private final String name;
private final T value;
}
}
without lombok:
public class DataExample {
private final String name;
private int age;
private double score;
private String[] tags;
public DataExample(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
void setAge(int age) {
this.age = age;
}
public int getAge() {
return this.age;
}
public void setScore(double score) {
this.score = score;
}
public double getScore() {
return this.score;
}
public String[] getTags() {
return this.tags;
}
public void setTags(String[] tags) {
this.tags = tags;
}
@Override public String toString() {
return "DataExample(" + this.getName() + ", " + this.getAge() + ", " + this.getScore() + ", " + Arrays.deepToString(this.getTags()) + ")";
}
protected boolean canEqual(Object other) {
return other instanceof DataExample;
}
@Override public boolean equals(Object o) {
if (o == this) return true;
if (!(o instanceof DataExample)) return false;
DataExample other = (DataExample) o;
if (!other.canEqual((Object)this)) return false;
if (this.getName() == null ? other.getName() != null : !this.getName().equals(other.getName())) return false;
if (this.getAge() != other.getAge()) return false;
if (Double.compare(this.getScore(), other.getScore()) != 0) return false;
if (!Arrays.deepEquals(this.getTags(), other.getTags())) return false;
return true;
}
@Override public int hashCode() {
final int PRIME = 59;
int result = 1;
final long temp1 = Double.doubleToLongBits(this.getScore());
result = (result*PRIME) + (this.getName() == null ? 43 : this.getName().hashCode());
result = (result*PRIME) + this.getAge();
result = (result*PRIME) + (int)(temp1 ^ (temp1 >>> 32));
result = (result*PRIME) + Arrays.deepHashCode(this.getTags());
return result;
}
public static class Exercise<T> {
private final String name;
private final T value;
private Exercise(String name, T value) {
this.name = name;
this.value = value;
}
public static <T> Exercise<T> of(String name, T value) {
return new Exercise<T>(name, value);
}
public String getName() {
return this.name;
}
public T getValue() {
return this.value;
}
@Override public String toString() {
return "Exercise(name=" + this.getName() + ", value=" + this.getValue() + ")";
}
protected boolean canEqual(Object other) {
return other instanceof Exercise;
}
@Override public boolean equals(Object o) {
if (o == this) return true;
if (!(o instanceof Exercise)) return false;
Exercise<?> other = (Exercise<?>) o;
if (!other.canEqual((Object)this)) return false;
if (this.getName() == null ? other.getValue() != null : !this.getName().equals(other.getName())) return false;
if (this.getValue() == null ? other.getValue() != null : !this.getValue().equals(other.getValue())) return false;
return true;
}
@Override public int hashCode() {
final int PRIME = 59;
int result = 1;
result = (result*PRIME) + (this.getName() == null ? 43 : this.getName().hashCode());
result = (result*PRIME) + (this.getValue() == null ? 43 : this.getValue().hashCode());
return result;
}
}
}```
Lmfao
Lemme find a project where I did that
AH
Not bedwars
thanks for that spam xD
hastebin is trash
alex can they disable the shade warnings
what about a record class
which warnings?
personally i prefer the non-lombok way
records are immutable, and not available in java 8 or 11
"this stuff from shade is present in however many jars"
what happened here
just exclude the stuff you dont wanna shade
@lilac dagger I.e. something like that https://github.com/Geolykt/Presence/blob/main/pom.xml#L142-L151
Auto generated code prob
how else would you do it
first two lines can be one already
none. the free ones are all shit
Objects.equals
i'll try @quiet ice thank you
instanceof T t
buf performance !!!!1111!!elf
proguard is quite useless, all it does is rename things
@quiet ice it worked!! thank you
only thing it's useful for is to lower your .jar file size if you're near the upload limit
yo, don't call proguard useless
it does the important part
without slowing down the project
running
thats exactly what my parser is about ๐ฅฒ
Proguard is neat at deobfuscation
it makes jars smaller
However as someone that is modding a game obfuscated with proguard (not minecraft), I can tell you that proguard is not that good of an obfuscator
It's just a small fence - keeps the script kiddos out but anyone more experienced will bring over the bulldozer
how would you mod a game obfuscated with a more advanced plugin then?
Having never done it I cannot tell for sure
https://github.com/FireMasterK/SkidSuite2-Latest also has an obfuscator that iirc was pretty well
skidsuite made by the same genericexception person i linked to earlier, but its a former version :v
As well as the mother of all stupidity: https://gist.github.com/Geolykt/9a13462a0d6029ed3fb629447fe6d834
thats a long file ๐
Nah lol, it just does stuff no other comercial deobfuscator can do.
my God
It's grown quite a bit longer since
BITMAP_STAR_GENERATOR_GET_RESOURCES_LIST_METHOD_CONTENTS heehee
Okay, just a bit less than a 1000 lines longer, but then I also haven't worked on it that much
what distro is that?
Fedora with Gnome
๐
Did you flush the output stream?
Dont obf, you will just lost time
LXDE (the only other variant I used) is even worse
Send your json
dont like KDE?
I'd rather take broken alt-tab over broken sound output
i like kde โค๏ธโ๐ฅ
true
Code block pls
Never used it
discord formats json?
LXDE is a fork of it iirc
when did they do that
think so
but sometimes the original is just better
like ubuntu vs debian ;^)
Then I wouldn't expect it to be much different
im now using xfce and the defaults just looks terrible
i forget if xfce ever modernized its look but ig its a bit dated 
nothin wronmg with that...
linux mint xfce
Are you sure that you can use ' for keys?
If nothing else, try set it (the GSON parser) to be lenient
oh its literally hte 3 they shipl ol
whats the dif between those lol
i woner which is more customizable
For some reason when I send a block chance to a player and the player aims a bow at that said block it doesnt show the block anymore
i might try mater dual boot
Online linter also shows that json as invalid
Please ppl is being helped move to #general
when i can figure out how to remove my old min from eufi boot menu
what do u main now
windows atm
It shows that error is there
bcdedit to remove pesky installs
thanks
nesting is fine, just ' need to be replaced with "
can i not run bcdedit in cmd
For some reason when I send a block chance to a player and the player aims a bow at that said block it doesnt show the block anymore
u would look for the linux mint one and then bcdedit /delete <identifier>
also yeah run bcdedit as admin in cmd
copy the whole identifier btw
like {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
im gonan guess its this one
yeah
its gone
learnt that from frost

and then a really convoluted way that i get it out of the boot partition is using uh
diskpart
already removed that
oh
i just deleted the partition it was on
can someone help me??
Have any framework/tool/library been made for plugin Integration tests?
mockbukkit
I mean integration tests, not the unit one
can you delete the windows efi partition of a running windows installation?
id imagine (hope) not?
or if u do itd be like deleting System32 on a live system
i better hope not
windows boot manager doesnt have a guid
ugh this isnt working as expected lol
null
Hey everyone, I remember there was a way upon EntityType to define whether they are like a Water mob or not. Does anyone remember? Can't find it atm
yeah i got tired of Fedora constantly showing up in my BIOS as a boot option
if i install mate i then have 3 linux versions
i did attempt to google it
but couldnt find anything
my googling skills arent the best
idr what i even looked up
and i dont even remember how i made the diskpart solution that i use
bc i know i didnt look that up

i think i was like messing around with it and was like oh damn
is it possible to set the display name of an item to a json string
so i can use text, translate etc with it
I found Bukkit.getUnsafe().modifyItemStack() but that seems to overwrite the whole itemmeta
or atleast the pdc I have on it as well
iirc you have to format the json yourself
and afaik I dont think you can use pdc to set the display name
Paper API or nms
are those the only ways?
anyone? I know there was something on Entity or something to know if they are of type Water or not
It shouldn't
you could probably use minimessage legacy serializer and format that back
But then the last time I have seen use of that method were years ago
you mean the json serializer
The Bukkit unsafe is very very arcane
well use the gson serializer to format it, then the legacy serialzer to actually add it to stuff
yeah I would rather not use a method from teh stone age lmao
oh yeah
do you have an example epic?
If(entity instanceof WaterMob) ?
oh did i tell you that i got all the chat colours added
one second
nice!
Legacy text can't have translateable components
https://docs.adventure.kyori.net/serializer/gson.html has the repo for gson
https://docs.adventure.kyori.net/serializer/legacy.html has the repo for legacy
https://docs.adventure.kyori.net/serializer/index.html has the gson/json stuff then use
https://github.com/The-Epic/EpicSpigotLib/blob/master/src/main/java/me/epic/spigotlib/formatting/Formatting.java example of how to use the legacy serializer
Legacy text is just a string which you could write without json in the first place
and how do I put taht stuff on an itemstack
well without using paper api or some jank there idk of any better way to format json to its string to add to items with spigotapi
like actually making the json string is not the issue for me
on the github link it should have a translate method which is something like SERIALIZER.serialize(component)
Just the regular setDisplayName with a string
Which is why I've been saying it won't work
yes but taht method just rerutns a string
okasy
sad
i was so close
I guess I can just use teh unsafe stuff first and then add my custom data to it so the item doesnt get wiped
oh olivo how does clx or blueslime core handle minimessage stuff and retain spigot support
No item names
you can convert adventure components to bungee ones
Just chat messages
ah
How can I verify which potion effect type was added in the EntityPotionEffectEvent in the ADDED action?
getNewEffect
It does not work
??
yay it works
why do you have mctest stuff on c
not work
switch statements be like
I'm not sure that it is possible to set event cancellation in the next tick
where else would I have it
I thought so, but it still doesn't send the message
on D: ?
I tried to use switch in potion effect type but it didn't work for me idk
I think event wasn't triggered in first place
i have my mc servers folder bookmarked on explorer with a startserver.bat
and i can just pick what server version
Yes, it is activated, what doesn't work for me is recognizing the type of potion effect
how do you have that much stuff
i dont know, every thing I install decides to put a useless shortcut there
tbh nobody uses the desktop to start anything
you press the windows key and enter whatever you wanna start
on mac, no app ever creates a shortcut
most things you can toggle
i just have this
i can click minecraft servers then my startserver bat
Any personal recommendations on GUI library?
IF, ObliviateInvs?
I have too many choices, mind saying any reason
Do you know if one is able to allow the user to add a item from their inventory/get what the item in X,Y slot is?
All in triumph docs?
Alright I thought so
Great, I'm gonna give that a go. Thanks
@last temple triumph or https://minuskube.gitbook.io/smartinvs/
Alright gonna go with triumph then
ive used that before, and it works kinda weird yea
2-0 triumph defo going for that
probably intellij being drunk again
or not
why doesnt it say "cant access method bc class it not public"
i just thought
yea. thats odd
we probably should have a command to show the colours that we have pre-set alex
yeah
Little noob question
How can I know what the latest version of a dependecy is on maven
If the plugin doesn't specify
if its on central https://mvnrepository.com/repos/central
ah ok
yeah then add a command to display them :3
that repo looks like its down
yeah you did
Not for intelliJ it seems @remote swallow
there should be a nice tab completer for the builtin colors
wdym? you always have to specify the version
because im lazy and i just make it replace colour with col_our
So I can specify that version
because it works
Just browse the repo?
what plugin is that
It's like file explorer
Tiumph
Ohhh
"3.1.4"
you can just use any version that you know exists, then do mvn versions:use-latest-releases
yeah just found up
looks like this
or just look at the github lol
Yeah but sometimes the github itself says
i founded a conclure
{Use latest here}
look at the buildfile
yeah when they say "use latest", open the pom.xml or build.gradle and check the latest version there
although in gradle it could also be in gradle.properties
conlure is swedish?
yea
okay so conclure is now called ikea
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<relocations>
<relocation>
<pattern>com.jeff_media.morepersistentdatatypes</pattern>
<shadedPattern>me.tomisanhues2.deepstorage.morepersistentdatatypes</shadedPattern>
</relocation>
</relocations>
</configuration>
First time shading 2 lib together, I assume I can have multiple <relocation> groups
yeah
sure
are you loading to json or from json?
you can have as many relocations as you like
so In case of arrays json should looks like that ```{
"myarray":[{"name":"bob"},{"name":"mark"}]
}```
{"name":"bob"},
{"name":"mark"}
]``` or like this
send me this as text pls
ye this is huge, do you need to conveter all content from this json to objects or only some parts?
with is enka and why are they a network
Are the best ways of checking if a user clicks a chest using PlayerInteractEvent and then to check clicks inside InventoryClickEvent?
"1001": {
"type": 1001,
"ival": "0"
},
"1002": {
"type": 1002,
"ival": "6",
"val": "6"
},
"1003": {
"type": 1003,
"ival": "0"
},
"1004": {
"type": 1004,
"ival": "0"
},
"4001": {
"type": 4001,
"ival": "90",
"val": "90"
},
"10010": {
"type": 10010,
"ival": "24000",
"val": "24000"
}
},.``` So basically this is not array but object with properties inside
or Hashmap<String,PropertValue>
for not wasting time to creating classes you can use tool like this https://codebeautify.org/json-to-java-converter I don't say it's the best, just google "Json to Java class online convetner"
So packet limits for players are proccing even when ive set the paper yml to "drop"
Why can't I use the net.minecraft thing? https://prnt.sc/3PRRYXnFa5c5
?nms
if I have some set of POJOs, and I want an efficient getBySomeProperty(property), I can store the POJOs in a map keyed by my property.
What do I do if I also want an efficient getBySomeOtherProperty(other_property) (i.e. not iterating over all entries until I find a matching one), is there some gigachad datastructure or do I just have two maps pointing to the same instance
I imported all libraries (I don't use maven) and it still does not work
do you use gradle
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
Yeah that worked
What's the way to send a packet then? CraftPLayer.getHandle().b.a(packet) does not work
hey guys im back lol, found this in one of my projects (LOL)
public void openTradeMenuForPlayer (UUID uuid, Player player, UUID uuid2, Player player2) {
if (player.getUniqueId() == uuid && player2.getUniqueId() == uuid2) {
}
}
please laugh at me ;0

How to check if an item type is consumable
isnt it a bool?
wtf 
or you can make a strnig of every consumable item and see if it's in it
What does any of that even have to do with opening a trade menu
idfk
Material#isEdible
thx
The solution to that problem is to delete Lombok
do you have any annotation on the class
dafuq
are they lombok getters
im gonna guess that its saying avatarInfo isnt that class or some bs thing
can someone do something for me while I finish my code, could you tell me what the slot number is of all these items
tysm
that is a dicc n bawls
You did add the getters after removing lombok right?
Might restart IntelliJ, maybe it's suggestions are just broken

Invalidate and Restart perhaps?
ehh
I absolutely hate working with slots when it comes to this
It's why I made something in my menu engine
What it do
I can either
only the 45 is wrong placed
tysm
layer.applySelection(new RectangularSelection(new Point(5, 1), new Point(5, 6)), new DecorationItem(itemStack));
im having trouble creating the menu (i've been gone frmo spigot for like 2 months)
im forgetting how to make it lol
Inventory tradeMenu = ;
ItemStack e = new ItemStack(Material.STAINED_GLASS_PANE)
tradeMenu.setItem(4, );
trying to make it gray stained glass pane
Black_stained_glass_pane
I assume the points are x y coordinates not slots
What version are you using
Gross no wonder
Material.ORANGE_STAINED_GLASS_PANE
or use a pattern mask, such as
PatternMask mask = new PatternMask(
"1...|...2",
"....|....",
"....|....",
"....|....",
"....|....",
"...L|R..."
);
layer.applySelection(mask.selection("|"), new DecorationItem(itemStack));
layer.applySelection(mask.selection("L"), new MultiSwitch<Boolean>(
Map.of(
true, item1,
false, item2
)
);
:)
imillusion thats what I was going to do
I'm guessing in 1.8 stained glass has the Material has STAINED_GLASS_PANE and you have to use the magic numbers to change the color
yeah sure
GRAY_STAINED_GLASS_PANE
STAINED_GLASS_PANE
and the magic value was like
9
or 11
or 13
one of those 3
you can just see it in-game with advanced tooltips
So what does it do with 1, 2, R? Or did you just not write that out
It's like a layout
where each character represents a lot in the inv
it doesnt show with ADVT
the character can be whatever you want
Then you can make selections of those slots
and apply elements to them
such as decoration items, buttons or multiswitches
or whatever you want
Ok so you just didn't do that for those 3 lol
yeah I couldn't bother



