#help-development
1 messages · Page 1077 of 1
hmm weird
it seems that notchian server only sends Update Registry Data packet when player joins the server, so only Player join event is really needed
when you lets say disable a datapack it doesnt send another Registry Data packet to clear the previous data
lazy
How do I make an item not stackable with the same lore/name?
you can do this by adding invisible nbt tag
but there might be better way rn
with customizable stack sizes idk
at least that's how it was done in 1.7/1.8 days
^ still the only option
ItemStack newItemStack = new ItemBuilder(itemStack.clone()).setNBT(nbt -> nbt.setInt("maskId", UUID.randomUUID().hashCode())).build();
unique way? @mortal hare
idk if uuid.randomuuid.hashcode is safe way
Hash codes are not unique. Two differing UUIDs can have the same hash code
You should ideally use the UUID itself. Whether you want to store it as a string, as two longs, or as an array of four ints (like Mojang does), that's up to you
Iirc that stuff isn’t unloaded when a datapack is disabled at runtime
How about 8 shorts? Or maybe 16 bytes?
… 128 bits?
I need to store the uuid as int
You need to?
because I need to create a unique npc and it asks for an integer as id
i using servernpc plugin
and api requires a int as id
xd
i need relate the npc with a player
1.8 problems man
There is nothing to do because int is 32 bytes and uuid 128
Couldn’t you use the players entity id
Depends on whether or not it's temporary because the player's entity id will change when they relog
Or does this need to be persistent
Hello, do you think thatt would be possible adapting fabric api to run on spigot ?
Could just use Citizens
change on relog or restart?
Both
I mean, why does the NPC id need to be persistent
easier to do it the other way around
See cardboard
Couldn’t you just spawn a new NPC when the player logs in
If it's a relog, I can't use this method because it's basically a sleeper system. If the player leaves, I create an NPC (ZzZzZz..) and when he enters, the NPC disappears.
yeah i see
Doing it as a plugin won't work very well due to how late they load
I would just map the players uuid to the integer NPC id
You can then save that wherever as well
Yeah, I don't think you're approaching this in the correct way.
why they load so late 😔
Was going to suggest Coll's approach as well
The NPC's id doesn't really matter at all, it's just a unique identifier for the duration of the server. But it doesn't necessarily have to map to the player in some way
There's nothing stopping you from doing a Map<UUID, Integer> for instance
createnpc method not accept uuid as id
only int
… yea
Did you read the message you replied to
Map the uuid to an integer for the NPC
but coll
key is uuid player and value is what? entity id or hashcode from uuid
the method takes an int
I know nothing stops me from doing this but I wanted to avoid this map
Just some arbitrary entity id. You could make a static integer that just increments each time you make an NPC
You can just store a counter and increment it to get the next id
The NPC's id is pretty meaningless and not persistent
You can also save this wherever
It's just temporary for the server's lifetime
yes but entity.getid is already incrementing
It could be 5 in one instance but when the server restarts it might be 34
Okay, so 👀 You can either pull that from the server, or just make it some arbitrarily high number that won't get hit by the entity counter
There's a static method in (NMS) Entity I believe
getNextEntityId() or something
ok thx
I don't have a eidetic memory of the entire server's code! :(
Over like 14 versions no less!
Why not!
Pathetic
I can recite all the code, off by heart, really fast.....
...
Wanna see me do it again?
fuck that was impressive
<repositories>
<repository>
<id>md_5-public</id>
<url>https://repo.md-5.net/content/groups/public/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>papermc-repo</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.20.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>LibsDisguises</artifactId>
<version>10.0.21</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
``` this is my pom.xml for repo and dependancys why do i get this error
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.268 s
[INFO] Finished at: 2024-07-24T16:29:04-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project RogueLonk: Could not resolve dependencies for project org:RogueLonk:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: org.spigotmc:spigot:jar:1.16.1-R0.1-SNAPSHOT (absent): org.spigotmc:spigot:jar:1.16.1-R0.1-SNAPSHOT was not found in https://repo.md-5.net/content/groups/public/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of md_5-public has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException```
i dont see a spigot 1.16.1 anywhere
Man's poke pokemoning apis
Also funnily enough was just looking into libe earlier. I can quickly check the repo what version is itM
On phone so reading code outside paste bin hurts
that should still work right?
You can only use one
(which is not to say there's not scenarios where using both might make sense)
yeah...
i needed spigot for yaml cause i dont think paper has it
but then you're talking about platform dependent code
builtin yaml decoding
Pretty sure paper still has yaml
Aye in fact in mythic enchants we make use of some paper methods that make our job easier but also wanted it spigot compatible
Idk maybe @slender elbow ate it
ill look into it
I did something similar at one point where I used paper's pathfinding api for a feature
I've since cooked my own
it was mostly just an early testing thing
Crap like legit we had this convo earlier in tbe paper discord... I'm pretty sure it does.
the numbers keep going up
One I wanna play with soon is paper just dropped in the async scheduler from foila which is utterly tick independent. Sounds like silly shenanigans could be done with with it
I do not like working on commands
yeah I heard about that one too, people have been asking me if I'm going to make my stuff compatible with that
I must built a utility library and then yeeted it to the shadow realm.
Made life so much easier
that's basically what I am doing right now
not basically
that's exactly what I am doing right now
Half the big tech companies still use java 8, I cannot be judged, I don't make the rules 🤣
it's just this plugin was depending on cloudcommandframework
and I don't want that anymore
Ooft
Well if it makes you feel better the moronic idea I'm trying once ingot my new pc running is making an XML markup for inventory menu creation, with the ultimate goal of making a "scene builder" like app so you can essentially make inv menus in the same way you can make JavaFX UI's
You can't stop my inner moron sir 🤣
I'll have to save the Map<UUID, Integer> in the database after all
basically when creating an npc (when the player leaves) it adds player.getuniqueid and player.getentityid as keys and also puts the key and value in the database. let's imagine that someone clicks on the npc (the npc is deleted from the cache and db of the npc plugin and removed from map<uuid,int id> and the corresponding database). Then if the player enters I will get the NPC from Map<UUID, int id> if there is one and if there isn't one I will get it from the database. if there isn't one in both, I deduce that someone clicked on the sleeping npc.
why don't you use entity uuid instead of entity id
I need the database because if the server restarted with a created npc (i.e. it would have a uuid key on the map<uuid, int id>) and then if that player entered it would say that there was no key on that map, but the database would already say that there was. That's why I need the database
since entity uuids persist restarts
why do i need to convert this uuid to int (non-safe)
Hold on let me read what you sent and try to understand
PS: the createNPC method only accepts an Integer as id
Basically when players leave the server, you want to leave a sleeping npc behind until they rejoin?
And when someone clicks the sleeping npc it's removed?
yes, if you right click on the npc you will kill him and take the items from his inventory
ah okay
So what if the player enters and there is no sleeping NPC, it means they killed him and I have to clear the inventory
So the id that npc takes is irrelevant. Just give it the nextentityid from the nms method
You're gonna want a Map<UUID, UUID>
first uuid is player uuid second is npc
player.getentityid also works
you may use a bimap
npc#getid returns int, not uuid
Oh nah its not u minion haha
Lemme have a read right quick.
But to dumb all this stuff down, you wanna do rust yeah?
Noone ever calls me the mythic enchants guy 😭
Maybe if I hadn't been inactive for 6 months they would
Solution sounds ideal ngl.
how are you creating npcs?
createnpc znpcs method
znpcs?
guys can you create npcs without packets?
whatever happened to you
I miss you presence
by presence do you mean posting the inv holder thread to any inv things
;
personally, i wouldnt use a lib for this but if you are

I mean just general presence
-
2 lecturers are work quit so my workload increased
-
Got 2 months wasted on SW (never take work with em, the cash just ain't worth it)
-
Had a cheeky menty B in April ish
-
Been so broke I sold my 2k pc for 200 quid due to loans + the aformentioned SW waste of time.
Stoneworks
I mean uh it's just backed by a regular jdk thread pool executor, you could use that yourself in a plugin
the only difference is that paper's async scheduler checks that the plugin isn't disabled and it'll cancel submitted tasks automatically when shutting down the plugin
South Wamerica
It's... its been a rough year
damn
damn shitty year
On the bright side it’s only July
ok
… on the less bright side it’s only July
i shall not laugh
july doesnt really mean anything atm
Fuck that I'm laughing and it's 1am where I am rn
its been so wet it doesnt even feel anywhere near summer
thats wild, its 1am for me too
That's wild. It's also free healthcare o clock where i am
You’re British
It’s always wet
holy shit i get free healthcare o clock too
no we normally get like a month of minimal rain before we start defrosting mariah carey
Moist
But yeah back to the poor Rust guy...
Why doesn't he just save the UUID of the player with the location of the NPC into the DB, create the NPC onEnable, and then just a map<UUID, UUID> that's initialised onEnable via the database rows?
If the npc is killed, mark it as dead in the DB, when the player logs in wipe inventory, delete row in db, bobs your uncles monkey
That way the db is literally one table that's UUID, x,y,z world, boolean for if its dead or alive
No npc int id shenanigans
Required
Also screw you, at least paper added in a boolean to disable snapshoting 😂
Npc loc not is unique
.... its their log off location
Unless some nutter logs off on top of another player..m
It doesn’t need to be unique
^
Nothing prevents 2 people from logging out of the same place
Except there will be an npc on the location
i didnt mean it negatively, i just found it funy
And as coll says, it doesn't need to be.
So they log off same place? Cool... onEnable both npcs would spawn in that chunk
I have to take care of all cases. The way I said is better to save the player's ID but I will not use player#getentityid but instead increment it myself
They were roommates!
shrugs
Fair enough I guese
Are you talking about this so you don't have to use the NPC lib? I only just understood that now
Fair warning though I'm pretty sure this will cause some hefty ram usage based on chunks not deloading as the npcs would be referenced?
Only their id should be referenced
Wdym
True but even then depending on its source... chunks... chunks are weird (seen several plugins really struggling tk get worlds, let alone chunks) to de load due to GC reference shenanigans
?paste
Entities are tied to worldsz so if entities are still loaded in memory, or fields referenced from an entity, then chunks have a tendency not to unload, its... its weirdm
https://paste.md-5.net/foqocituma.java
anyone know why line 149/150 doesnt broadcast anything?
When you say don't broadcast anything..m are you within 10 blocks?
Wait... String Value of a list of players? Am I reading that right or is 1:30 am brain got me?
yes im on top of my textdisplay entities
other listeners can detect the textdisplay entites and armorstand
but only this one cannot
Have you confirmed the method works for display entities in another method?
i have experimented with using just a command and it will display the entities within 10 blocks but for some reason inside this class this method doesnt work
yes
i also tried a listener class (playertogglesneaklistener) and it was broadcasting the entities as well
it might be a packetevents listener problem but i dont see why that could be a problem
where are you going with this
which line are you talking about?
it shouldnt be a list of players, its just the packetevent listener's event.getplayer basically but using packetevent api way of doing it lmk if i have errors.
Might need to be double the size.
my bad forgot to provide error message
https://paste.md-5.net/foqocituma.java < code
https://paste.md-5.net/cinahoqace.php error
line 148 has the double
Also, not sure how it goes about detecting the entities, but display entities have no hitbox, so you might not be able to find them easily.
i tried it with line 150 and it doesnt broadcast too
java.lang.IllegalStateException: Asynchronous getNearbyEntities!
was able to find them using playersneaktoggle listener so it shouldn't be a problem
Don't do it async
The 1 in the raytrace should expand their hitbox first
Which allows them to be detected
Hi, I'm not sure if spigotmc is a correct place to ask this question but maybe someone had the same issue.
Currently I'm working on a plugin which uses a custom world (Environment Nether), on my localhost everything is fine but whenever I start the VPS server (with exactly same files) it changes the environment of the world to normal and holograms are disappearing (it's "FancyHolograms" plugin if it matters). The plugin is checking whether the world exists and if not, it should create it and apply nether env. The host is Hetzner
I'm having a lot of fun today
@wet breach you were right making a classloader ain't half bad
doing the merge class path stuff wasn't horrible either
just an easy boolean
now its time to make an algorithm to detect circular dependencies
lord save me
In the protocol, when a player joins do they default to not be sprinting and them immediately send a Player command packet to start sprinting or can they join and sprint immeditly without sending a packet
they shouldnt be able to sprint without sending a packet
why te hell does it think the middle "to" function is different to the block below o0
Just need a map to keep track of what you are checking.
Or two maps so you can show association or whatever.
As a precaution have like a timer that ends the checking if it takes longer then 5 minutes or something
In the event your checking is flawed somehow it will at least stop lol
is there a significant difference between IFriendshipManager and IFriendsPayloadListener?
except by methods ofc
Anyone who can help me replace blocks with worldedit api?
I got this atm:
BlockVector3 pos1 = BlockVector3.at(-75.5, -40, 75.5);
BlockVector3 pos2 = BlockVector3.at(75.5, -64, -75.5);
try (EditSession editSession = Fawe.instance().getWorldEdit().newEditSession((com.sk89q.worldedit.world.World) Bukkit.getWorld("world"))) {
Region region = new CuboidRegion(pos1, pos2);
BlockType from = BlockTypes.SANDSTONE;
BlockType to = BlockTypes.AIR;
}
}```
first of all, that is not how you create the edit session by casting a bukkit world to a worldedit world
do “new BukkitWorld(Bukkit.getWorld(“world”))”
for example
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
number go up
wowza
weak
number go up more
less modified more added smh
my gamemode branch at work has like triple the lines of code at main 
pr about to go wacky
rip
also all of the setup process
meanwhile I'm tryna figure out where I left my placeholderapi code on my minigame core
have you checked inside your butt
ah yes lemme look in there
S’gotcha
Me Profile on Spotify - https://open.spotify.com/artist/0hQBkU2vuMYXucmd89JUSw?si=JA77npD1QTWbSaUr89c0sQ&dl_branch=1
Itunes/Apple Music - https://music.apple.com/au/artist/tom-cardy/1528272037
Bandcamp - https://tomcardy.bandcamp.com/album/artificial-intelligence
ok bro
writing menus
tweaking control points for bezier curves for an hour
change a number, restart, look at particles, repeat 200x
I have my own chat formatter and for some reason whenever I type just like percentage % it gives me UnknownFormatConversionException, how can I solve this?
https://paste.md-5.net/ofawavowof.cs
The format that I'm trying to set is at the top of the message.
Can we see the code ?
Yes, there you go https://paste.md-5.net/qodeladive.cs
It seems you already formatted the message. Why not using event.setMessage?
Because it's a chat format that consist for example prefix, suffix, display name of the player etc and the message it's just the message.
So you have to separate setFormat and setMessage
Or cancel the event and manually send format to everyplayer
That is not an option I think, but how if I got the chat format configurable in the config like this? chat-format: "&e{name}: &f{message}"
I basically do what LPC is currently doing.
Ah, looking at the LPC source code, they replace % with %%
the first %s will be replaced by player name and the second with the message
If you want to put a "%" in the format without triggering a placeholder, you should replace % by %% yes
Ah got it, it's basically like String.format right?
That seems to have solve the issue, thanks for the help!
Hey I am trying to a get something from async in main thread
I have don that but it don't wait the result how I can wait the result?
Entity entity = null;
BukkitTask bukkitTask = Bukkit.getScheduler().runTask(plugin, new Runnable() {
@Override
public void run() {
for (Entity e : p1.getNearbyEntities(50, 50, 50)) {
if (e.getEntityId() == packet.getEntityId()) {
entity = e;
break;
}
}
}
});
just have a callback, or return a future of some sort
withTimeout my beloved
it seems to be impossible to kick a join in response to a cookie at the moment?
@org.bukkit.event.EventHandler
public void onPlayerLogin(PlayerLoginEvent event) {
var player = event.getPlayer();
player.retrieveCookie(new NamespacedKey("josie", "transfer")).thenAccept((cookie) -> {
// It seems the cookies are guaranteed to be received in the gap between PlayerLoginEvent
// and PlayerJoinEvent, but there is no publicly-exposed way to kick the player at this point
// doesn't work because the event has already been consumed
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, MiniMessage.miniMessage().deserialize("JWT signature invalid"));
// doesn't work (and fails silently!) because https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java?at=2c547495242ddc8019d8cbd4358bac90f6954659#480
player.kick();
// The fate is sealed at this point, the user will be let in the server
// It would be perfectly valid in the minecraft protocol to send a disconnect
// during this part of the configuration phase, but the API doesn't allow it
});
}
comments in the code have more info about the problem I'm running into
Edit: for anyone searching this discord for information -- yes, the cookie-based kicking issue is fixed now, using the same workaround I ended up patching into papermc manually (not ignoring kicks triggered during login phase) https://hub.spigotmc.org/jira/browse/SPIGOT-7876
anyone remember off the top of their heads what the max resource size is in spigot
4mb
What mistake I did? completable future is never called
CompletableFuture<UUID> completableFuture = new CompletableFuture().thenAccept((id) -> {
System.out.println("1");
Player p1 = Bukkit.getPlayer((UUID) id);
RayTraceResult rayTraceResult = p1.rayTraceBlocks(4);
Entity entity = rayTraceResult.getHitEntity();
System.out.println(entity.getName());
if (entity instanceof Player p2) {
p1.sendMessage("test2");
ModInventory.action(p1.getItemInUse(), new PlayerInteraction(p1, p2));
System.out.println("bb");
} else {
p1.sendMessage("test");
ModInventory.action(p1.getItemInUse(), new PlayerInteraction(p1, null));
System.out.println("cc");
}
});
Bukkit.getScheduler().runTask(plugin, new Runnable() {
@Override
public void run() {
completableFuture.complete(pid);
}
});
how close
8.86
don't think it will matter anyway
a big part of it are the translation files
and those probably can't be compressed
yeah it's cooked
it's fine, was just wondering if moving away from cloudcommandframework would do the trick, guess not
what other obvious libs
doesn't even really matter
I didn't even add it in the first place I smashed my keyboard so badly at one point it injected it into my project
reflections
bytebuddy my beloved
maybe minimize it?
I might switch out of javassist just because it has gotten such a bad rep
wait why do I have apache commons in two places
oh huh
seems like it's intentional, weird
haiiii! vault thingy seems to be not working,
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>```
can anyone help?
do you have the repository
show whole POM
I am trying to get entity player look but entity is null ( yes I am looking an entity) I did i mistake in the code?
RayTraceResult rayTraceResult = p1.rayTraceBlocks(10);
Entity entity = rayTraceResult.getHitEntity();
am i the only who thinks multiversion support like this is just dumb?
why make more clunky code trying to support all versions instead of supporting specific version properly and porting things back (making version specific jars instead)
imagine if minecraft introduced some breakchanging code that cannot be expressed with current abstractions for a specific version of the game, but for all other versions of the game
sure you can fix it, but then it makes your code bloated af
Is FireworkEffect.withColor stackable or nah?
Or if I want multiple colours do I have to make multiple FireworkEffect objects
native version: 1.8
tested: 1.20
:hollow:
yeah I dont like that at all
its fine if its other jars, but all versions in the same jar is just cursed to me xD
you mean like everything what has to do with NMS?
rather have everything in one jar and call it backwards compatible instead of having to maintain multiple jars
you typically have different modules for each version which you can just inject into your core and use the specific code for whatever you are doing
with your approach of having multiple jars for multiple versions you break that and in worst case have to maintain multiple projects
what if there's one version that changes NMS drastically
that happens with every release
you just have to hope to be lucky enough that they didnt change something at the code you are using
i mean in a way that your interfaces cant abstract the NMS away compatible with other versions anymore
lets say they revamp functionality how it works and there's new data being attached and old data is gone or not important anymore and you cant substitute it old interfaces anymore
you abstract the nms shit for your project, so you would have to do internal changes or extensions yourself to outplay your own abstraction
in that case ofc you would have to change something
but typically you wrap it
so your interface is untouched, the only thing you would have to adapt is the wrapper
and if the changes are too blatant you can turn your wrapper into a basewrapper and split it in 2
Anyone know if it's possible to change the mountheight of an armorstand or (Citizens) NPC? Trying to make vehicles, though I need to change the mount height. I have tried everything I can think of to no prevail
Right now I mount the player on top of an armorstand that's mounted on the npc. I thought it was possible to rotate/move the armorstand (And therefore the player as well) bcs someone told me that was possible. They didn't say how and I can't find any answer
what exactly are you trying to do and what have you tried so far?
isn't that included in my msg?
Trying to make vehicles, though I need to change the mount height.
so, the player gets mounted at different heights...?
i cant really find a good answer online tbh so imma ask here.
i have a table GUIOptions with the cols: action and option
where action is a key (command like ban or kick) and option is any string (pre-defined reasons for example for banning).
I want to cache this table in a ServerData object containing a Map<String, List<String>>.
How do I convert the table to the HashMap?
Example of the table content:
id,action,option
33,ban,This is a valid reason for a ban!
34,ban,This is a valid reason for a ban!_1
35,ban,This is a valid reason for a ban!_2
36,ban,This is a valid reason for a ban!_3
37,ban,This is a valid reason for a ban!_4
38,ban,This is a valid reason for a ban!_5
39,kick,This is a valid reason for a kick!
40,kick,This is a valid reason for a kick!_1
41,kick,This is a valid reason for a kick!_2
42,kick,This is a valid reason for a kick!_3
43,kick,This is a valid reason for a kick!_4
44,kick,This is a valid reason for a kick!_5
let me clarify
what exactly are you trying to do technologically to achieve that
what have you tried technologically to achieve that
what did not work with it
what do you wish for
- code
Is the table a file?
I'm using a different scripting language (a plugin based on java, called denizen), and it basically does everything java does. I was just wondering what things/concepts I could try, instead of asking for code. As of now I tried translating item/block displays, and mounting those. The player doesn't get translated the same way though, so that doesn't work.
Are you using an orm or you want to manually parse jt?
I thought of using different entities to mount, though that's not very accurate for mountheight, plus other entity NPCs don't automatically step over blocks which sucks. player npcs do work
by querying it and give it to the hashmap or what do you mean?
yea that's what i'm meaning to do
You can just group by action then iterate over each
i do have a method already but this one only gets the first entry lol
show us
?paste
for what version?
you could use slimes
Show ur code
you can set the size of those and therefore their height
whatever
(that's a genius idea ngl)
js
public Map<String, List<String>> getAllGUIOptions() throws SQLException {
String url = "jdbc:sqlite:path_to_your_database.db"; // replace with your database URL
String sql = "SELECT action, option FROM GUIOptions ORDER BY action DESC;";
Connection connection = DriverManager.getConnection(url);
Statement statement = connection.createStatement();
Map<String, List<String>> allGuiOptions = new HashMap<>();
ResultSet resultSet = statement.executeQuery(sql);
while (resultSet.next()) {
String action = resultSet.getString("action");
String option = resultSet.getString("option");
// Get the list of options for the current action or create a new one if it doesn't exist
List<String> options = allGuiOptions.getOrDefault(action, new ArrayList<>());
// Add the current option to the list
options.add(option);
// Put the updated list back into the map
allGuiOptions.put(action, options);
}
statement.close();
connection.close();
return allGuiOptions;
}
thats what chatgpt gave me
lol that worked. i should use chatgpt more ig
especially since i do have the paid model lmao
your friend and helper
chatgpt for advice, gemini for visions
did you feed it the code first or just tell it the variable names?
that's pretty smart. Their stepheight seems to work too. Thanks, I'll have a look
like "here's some code, make it work"
i just straight up copied everything you told us and fed it to gpt
the paid model is actually op
yeah my brother got it and lets me use it for free
what's the big difference between the unpaid and paid model?
early access
i mean duh
and you somehow can use plugins but idk where
yeah and image generation and shit
u mean https://chatgpt.com/gpts ?
NORMAL GPT4 CANT GEN IMAGES???
whaa
oh thats cool
didnt knew about that
i dont think so
they dont have DALL-E integrated
it can for me (when i chose GPT-4)
i mean
regardless of the gpt you use
i thought GPT-4 went free and GPT-4o came out as the paid version
i didn't know that (it shows i'm not the one paying lmao)
nah gpt4o is just more advanced with more data and can even recognize images and voices and stuff
and search the web iirc
ohhhhhhhh
yup, it just looked up my library when i told it to
Any clue why doesn't Bukkit#craftItem nor Bukkit#craftItemResult modify the passed itemstack array? Not even in ItemCraftResult#getResultingMatrix?
The returned result item or recipe is correct, but both arrays are same (items aren't taken away). Here's an example of a crafting grid before crafting a button and after:
maybe I'm missing smth in the docs
tbh hard to know what the further down methods do without more context
in the docs this is mentioned under getCraftingRecipe
can someone help me figure out how im able to add world guard support to my plugins so my plugins don't override any other plugins such as world guard?
how can i do that?
just look at stash then
thanks
@chrome beacon I can't seem to find the API version anywhere
Does anyone see what the issue is? I refreshed my build.gradle however the protocollib classes are still unknown
It's the same as the plugin version you're using
alright thanks
issue resolved
nice
any idea why i cant drag the plugin to my plugins folder sometimes while the server is running?
used to be able to do it before, but just randomly asks for admin perms sometimes
is the server online?
yes
yes it is
yeah while offline it works, but i was wondering if there was a way to do it while online? usually i just do /reload so it reloads the plugin
are you trying to replace a jar that's in use
and then it works fine, but suddenly it stopped letting me
Don't replace jars with the server running
new issue: the packet listener does not fire when the packet is fired (the consturctor is being fired)
its unsafe
Shouldnt be doing that anyway
fair enough, thanks
what is damage type of player.damage()?
Typically the error would be more along the lines of "This is being used by javaw.exe" or some shit
If you REALLY need to, you can write a batch script which will override it
yeah, i get that error if i try deleting the jar instead of replacing it
all good though, thanks for the answers
Turn the server offline then try deleting it, should work fine then
yup, thanks
Just use packet events
Protocol lib sucks ass
you are confusing using "offline"
Packet events?
:) I know.
how would I use packet events
@alpine urchin ^^
or do you mean normal events
By retrooper
It’s the go to now for cool people
PacketEvents is great when it works
I'm cool 😎
guide WIP but should be enough for basics
do I need to install the packetevents plugin on my server for plugins having packetevents to work
advised but not necessary
You can shade it aswell
I like to just download the source files and drag and drop it into my project /s
Does PlayerDeathEvent.getEntity() return Damager?
How does it behave when shaded
Have you thought about googling that?
The same
declaration: package: org.bukkit.event.entity, class: PlayerDeathEvent
Do some reading @quaint mantle
how does it work when shaded my brain ain't understand
how can I remove the slowness effect from honey and cobwebs
very vague question, but if your plugins all depend on one instance, then everything is encoded once
It's crazy how getEntity returns... an Entity...
(saving performance)
Attacker or Victim?
yes
The player that died
That makes no sense it'd be the player that died.
There doesn't have to be an attacker for a player to die
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/entity/EntityDeathEvent.html#getDamageSource() https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/damage/DamageSource.html#getCausingEntity()
declaration: package: org.bukkit.damage, interface: DamageSource
declaration: package: org.bukkit.event.entity, class: EntityDeathEvent
All your questions are answered by reading the Docs™️
ok whats the issue? com.github.retrooper is invalid (i refreshed)
I need a event which can call attacker and victim and can be called when player death
EntityDeathEvent
I just sent the links so that you can do exactly that
only victim
yes
I need attacker too
For handling player death events in SpigotMC, you can use the PlayerDeathEvent. This event is called when a player dies, and it allows you to get information about the death, including the player (victim), the cause, and the drops. You can also set the death message and control whether the player keeps their inventory or experience.
You can find the documentation for the PlayerDeathEvent in the SpigotMC API docs. Here’s the link to the documentation: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/entity/PlayerDeathEvent.html#getEntity(). This should provide you with all the information you need to handle player deaths in your plugin.
declaration: package: org.bukkit.event.entity, class: PlayerDeathEvent
To get the attacker in a PlayerDeathEvent, you can use the getKiller() method, which returns the Player object of the killer. This method will only return a Player if the death was caused by another player.
damager
EntityDamageByEntityEvent
Wrong
He only wants player
Remember to check if the getKiller() method returns null, as this indicates that the player did not die from another player, but from other causes like environmental damage or mobs123. For more detailed information, you can refer to the https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/entity/PlayerDeathEvent.html
declaration: package: org.bukkit.event.entity, class: PlayerDeathEvent
I feel like this counts as spoonfeeding and somebody needs a course on reading documentation
just check if not instanceof player
Should I do check Player and ((Player) e.getDamager()).getHealth() == 0 with EntityDamageByEntityEvent?
oh that allowed
thanks
💀
❤️
read the documentation PLEASE
Idk the technical term for that, but they should really just learn to read documentation instead of asking people in spigot about shit you can find on the first link in google
resolved
bro it's crazy how that exact scenario has like 100+ threads on how to do it on the old bukkit forums
Bring a proficient programmer is a big part of googling
I think that doesn't make sense
whatever I just said there
Lol
crazy
Wheres that website that types out a google search
letmegoogleitforyou?
Yeah lmao
This gives me an idea
Lmao
My pet peeve is when I tell someone to download something and they ask for a link
honestly I do that lol
Like bro im just gonna google the exact same thing you will
get your lazy ass up and type in the fucking query
No :)
Only valid if they on a phone
will modifying WrapperPlayServerSystemChatMessage modify the packet being sent too?
Typing anything more than 10 characters on a phone one handed is hard lol
Yes
ok nice
I always use my phone one handed so I've gotten pretty good at it with my left hand
Left…
Are you right handed by any chance
U nastyyyy
wdym
What ur other hand doing
using my mouse??
you're nasty
I wanted to type "based" but I somehow ended up typing "by sex",
Does anyone know how firework.setAttatchedTo(enitity) works?
Player p = e.getPlayer();
Firework fw = (Firework) p.getWorld().spawnEntity(p.getLocation(), EntityType.FIREWORK_ROCKET);
fw.setAttachedTo(e.getPlayer());
Because the code above doesn't boost the player, but it does spawn the firework.
thank you!
whats the best way to prevent null pointer expression?
Don't call methods on null values
Defensive programming
Assume parameter inputs are always bad and have guard clauses
i am calling a rayTraceResult.getHitEntity() but I am not sure that there is an entity
Use an if statement and see if the outcome is null
kotlin ?. my beloved ❤️
No
it's starting to become a lot more like kotlin
what kotlin have more?
what
Pretty sure it breaks their simplicity guidelines
what does and whose
I might be wrong but java is cery anal
I'hve never tried but I hv heard that kotlin is java in better
what does that mean here 😭
Anal just means up tight
Js and python do string templates so well
Better than what it is
Java also needs operator overloads
But they said they will never add that
At it makes code “too complex”
Like being able to define how classes interact with operators (+, -, *, etc)
But they say if you wanr to figure out how two classes interact with eachother it makes it too complex
Which is fair enough ig
that doesn't look good
Im glad
As of when?
what's the next LTS java version
like, many moons ago
If they’re not gonna do it well id rather not at all
Because once the shit syntax is implemented, they’re not gonna change it
they removed all of the code related to the feature and are redesigning most of the process from scratch
njhjjhnhhjbhjhjbhjb
specifically, they realised that you don't need to introduce new syntax for the STR."foo" at all
yeah sounds good
just.. a function call, e.g. String.format("foo bar %.2f\{someFloat}")
so there would me a String.format(String) and a String.format(StringTemplate)
can we get an annotation processor that would automatically change "foo bar ${var}" to "foo bar " + var
Yeah I dont see why lombok cant add it as a pre processor
APs can't really do that
did the css not load or is this how the site looks
that's just how it is
Whack
how tf does lombok do what it does but then this can't be possible
a compiler plugin might however, i'm not too familiar with the plugins api
when StringTemplate
it literally hijacks the compiler and injects itself as the compiler
I need it like yesterday
Lombok is a compiler plugin?
string templates are so much more powerful that basic string formatting
They're goated wym get gud nerd
sounds fine
kotlin string templates evaluate to String no?
Java also needs auto getter/setters like c#
I don't think they actually have what will be in Java just better replacement and insertions
i don't understand why people have so many issues with getters and setters, i very rarely find myself writing code that requires them at all lmao
peak encapsulation
Records made the amount of them I write go to almost 0
are you a kotlinator
I encapsulate almost everything
no
Yea so shitty xD
It's basically just java with syntax sugar
idk, java string templates (at least what was floated in the mailing list) would be op as fuck
It really doesn't require much learning
I think TypeScript hsa them too? the java-like string templates don't evaluate to string but to an intermediate format
Nope
Has string templates?
I've been saying that all this time and nobody listened
assembly is like python when you squint your eyes a lot
what?
for the most part, unless it has a NotNull/NonNull annotation
I almost never set those
my methods can always return null because yes
if(ThreadCurrentRandom.current().nextInt(100) == 99) return null; hahaha
this hurts my eyes
It assumes it's nullable unless it's specified
int hash = Math.abs(in.hashCode());
if (ThreadLocalRandom.current().nextInt(hash + 2) == hash) return null;
it does the exact opposite
It automatically does getters and setters for you
yes
i deliberately want to lose the floating precision
and intellij does this :/
lmao
I think you can Math.floorDiv then
Kotlin makes them automatically for public fields
You specify if you don't want them
Don't knock it till you try It
wdym don't want them
That makes sense?
very real, he just shits on it without having tried it
It’s already an int
did you really tho
Yes
If you go into something with a closed mind you get the result you wanted subconsciously
I was not biased back then
when was "back then"?
It was like 2 years or sth ago where I had to use it
kotlin 1.0?
And it was horrible
likelyhood is that you just used it terribly wrong
And I still think it's horrible language design
How do you use a language terribly wrong? The concept and language design stays the same
No I like dart
you can just use stuff terribly wrong in general
you can use java terribly wrong
int hash = Math.abs(in.hashCode());
if (ThreadLocalRandom.current().nextInt(hash + 2) == hash) return null;
when did i say anything about syntax
There is a difference between semantical garbage and syntactical garbage
For me, kotlin is straight up syntactical garbage
sounds like you're either ignorant or blind then
How's that? This is a matter of subjective preferences
For me it is
i'm surprised you didn't say that about odin then
I have never looked at odin
#general?
That was literally like 3 lines of code
I cannot rate a syntax with 3 lines of code
it does sound like you would
I need to read a simple program, or at least like 100 lines
Which I did with kotlin - and that gave me the opinion that I hate the language's syntax, so I shit on it
what did you do with it then
if it gives you that shitty syntax you're likely doing something wrong
And then I translated a library to Java to not have to use it anymore
💀
Well it was technically not a library
It was like a major feature with tons of Util classes
Hi, i was trynna make an alert system when i just noticed that it bugs depending on the first player to join the server, how can i fix this?
you're returning if one player doesn't have that permission rather than continueing
^^
guys how do i stop essentials /back from warping to a specific world?
Hey, please tell me how can I implement the corpse of a player after his death? this should be some kind of hitbox, when pressed, it opens the gui, armor stands are excluded
Can the server force a player to steer and stop crouching
this should be an easy fix but i cant find it anywhere
just do this.type.enchantability() >> 1 😌
The question I will ask now is quite unusual. What are the things a good Minecraft plugin dev needs to know? And what are the most advanced concepts of minecraft plugin programming?
how does java handle that on floating point numbers?
Are you sure it would do what you want
anyone knows if you can have a git submodule thats set to a local path for testing purposes?
- Clean code - You will need this if you get hired someplace, it will allow other developers to easily maintain and read your code
- Abstraction - Good knowledge on abstraction and where to do it is good, as it allows features to be created and implemented faster than before
- Databases - Knowing multiple database types such as: MongoDB, MySQL, PostgreSQL, etc will allow you to store data anywhere the client needs.
Getting advanced
- Cross-server communication - Using stuff such as Redis Pub/Sub, RabbitMQ, or any others. It will allow you to have multi-instanced servers with synced data across them, creating a better experience for the users.
- Packets - Knowing how to work with packets, knowing how the networking works, and send data to the client, is a good step in the career of plugin development. It allows more customization like per-player holograms, fake entities, entity movement, custom tabs, per player scoreboard handling, etc.
This is just a few
i did that, synced and updated, and it bricked the submodule to some state that isnt even close to how it looks rn
actually..
its quite interesting, i have a submodule that depends on itself
so now just trying url = .
That's pretty much what's really "needed" to know as some servers require knowledge in all them aspects. @brazen badge
Thank you very much, you were really very helpful!
The first three should be known by every programmer (language doesn't matter) imo 👀
Yea completely
The next 2 are just bonuses, which can advance your career, and allow you to strive to become a better developer, and get better work opportunities in the development space.
Even if you don't work with databases, the concept of knowing how they work and how to store data efficiently is super useful knowledge
I've only learned about those concepts after 5-6 years of doing Java back then 🙃
Tbf, I was only 12 when I started programming ... so yeah
It's quite funny as a thing, but I've read books, I've watched videos, I've asked people in the industry. But I still cannot find the use of abstract classes or interfaces useful.
bruh xD
What am I supposed to say
A Randomizer to send players to random hubs on their Minecraft Server - ignPurple/BungeeLoadBalancer
If you look in that, you will see the use of abstract classes
Inside "strategy"
Meh the whole clean code manifesto is stupid, I think it is indeed important to know how and when to properly abstract and use databases though
I mean you need to make your code maintainable if you're working in a server with other developers imo
yes
clean code is important
but noone seems to agree on what it actually looks like
I mean just following proper java design patterns is important
since its also part subjective and part different per context
I usually make fields and variables final wherever they need to be
I use this. when referencing class fields
some people overdo it
adding it to arguments and whatnot
makes it less readable then
adding what to arguments
final
like this:
public class Test {
private final String temp;
public Test(String temp) {
this.temp = temp;
}
public String getTemp() {
return this.temp;
}
}```
Yes but what even is clean code. What does it look like? There is no constant this is clean code. Maintainable code comes from experience of coding not some set of objective rules.
welcome to records
If you never code anything public and don't give a single thought about the future and you know you will probably always be the only person ever touching that code and you have a perfect memory and remember everything even years later and are perfectly fine with your and only your coding style - sure, you won't need any "clean code" guide lines 😛
For everyone else, they make sense to follow.
I've coded on teams before
private final is a joke imo, making it public doesnt change anything
oh wonderful i ended up with a recursive submodule
I mean clean code, would usually be following a codestyle defined by multiple developers to work around the code easier and to make it more maintainable between them. That's how I see it anyway.
At that point you're kinda putting the whole manifesto aside though. I 100% agree people should agree on some style, but that isn't the clean code manifesto
The "clean code" manifesto is basically just the result of many years of different things being tried and reduced to the most common things people do and are easy to follow.
If you feel more comfortable with deviating from them, heck, you are free to do that - they are just recommendations.
Finals greatly improve readability. Gives you a feel of what is processed next when you read code from top to bottom
I mean the way I see that as being "clean" code is that, all the developers can follow the code and maintain it, as they usually would be able to. With that specific codestyle that they defined.
I think there is no such catch all though.
People will always disagree on what is and isn't maintainable and clean
I also do recommend using "this." as it lets people understand what you're referencing to, a field in the class, rather than them searching where you defined it.
I agree 100% though
In the end - if your code runs and it does what it is supposed to do efficiently (enough), then you achieved a good program - for the sake of end result, it doesn't matter how you get there.
The problem lies in later modifications of said program.
there isn't such thing as "ultimately clean code", you can follow practices that will make your code easier to maintain in certain aspects but you are likely trading that off for something else; the way i see it, easily maintainable code is code that is easy to refactor, that has little refactoring "friction" so to speak, but this will wildly depend on what your application or library or framework does
Undocumented pieces of shit programs that only work in some weird conditions
"can't print on tuesdays" bug
When you're writing code you should lean into striving for good abstractions and writing somewhat efficient code rather than starting with the goal of clean code. It wastes time especially when heading towards a MVP
lmaooo
This is what needs to be avoided
Fun fact: clean code in one language might look absolutely messy in the syntax of another language 🙂
Kotlin
"entire fucking azure infra dying on a leap day" bug
So this fact alone tells you, there is no "one for all" guidebook
gotta love how microsoft copied java by creating C# but they decided.
OuR cOdE stYlE is MetHoDs shOuLd StaRt wiTh CapItaL LetTeRS
laughs in go
for anyone who doesn't know: visibility modifiers in go are the fucking function name case
Holy shit, separating brackets into a new line and always using brackets for if-return statements drives me mad every time I see C# code
oh god
I decided to get into game development when I was 12, I started doing it more recently and I'm NO longer motivated to do games development with C#
their code style is just...
Or you can choose not to do that ... because it's just a style recommendation
e.g. func (*MyStruct s) function() {} is private whilst func (*MyStruct s) Function() {} is public
That would work if you work on your own
public class Test : SuperClass
{
public void ThisIsAMethod(bool condition)
{
if (!condition)
{
return;
}
// Code here
}
}
I have a bit of issue, how would i check if the block a player is looking at is a sign? The Material.SIGN i used in earlier minecraft versions seems to not be working
I have done go before. Weird shit.
Either try those old Materials with LEGACY_ in front of them or use the proper different sign materials like OAK_ or SPRUCE_ in front of it.
signs are seperate items per type now
Imagine being forced into a code style cough Python cough
That's kind of why I love and hate Python at the same time
Python when you indent wrongly: 😡
The whole org.bukkit.material has a strikethrough and can't be used, have there been an update for the blocks? eg if i wanted to set a block to air or stone, how would that be done?
That is correct - MaterialData is deprecated.
update IJ
Material is still useable (update IJ) but you should switch to Registries
Haven't thought of that, my version haven't been updated for atleast a year
I did manage to get something alike with getTargetBlock then check the getState if its an instance of Sign
Tag.SIGN.isTagged(Block.getType())
who needs visibiloty modifiers
either way we have @(private) and @(private="file") for package and file visibility, can even leave the () away
Hi. I am trying to make beautiful information about the exception, but I met such a problem:
There is no support for multiple lines in a message. I use 1.21
Here is the code:
targetPlayer.kickPlayer("test\ntest2\ntest3\ntest4\ntest5");
I have some wierd issus. I have 1 hashmap and 1 list and i save the list and the hashmap when i stop the server in a yaml file and i load them when the server starts and the wierd problem is when i remove a key from the hashmap and from the list it gets removed but when i stop the server the hashmap entry appears again idk why
idk where this hashmap entry is from when is stop the server and it safes it because i removed it and the hashmap which gets saved dont has the entry
also remove it from the yml file
or save your config
hello, I'm new to this field, I'm looking to create my server with original gameplay. I started to develop a plugin but I discovered problems that I had difficulty solving. my plugin allows with a command to harvest a wheat field, then in a personalized gui, we can upgrade the harvest speed, the verification radius, etc. for this I use a pig then I will use display_blocks with an animation using a datapack in order to create a tractor. now I would like all the players to spawn on a personal world with each one their progress in the game, if someone can help me to make the improvements specific to each player, I am currently using multiverse core, but it has having trouble integrating the datapack.
yes
how?
client version? server version?
yoo bro's an OMG too!
if you're using viaversion try without it I guess idk
I used the code you sent
wtf
someone likes spans
How to use gradle variables here in plugin.yml?
guys where do you use records
${foo}, not {$foo}
but also, in processResources task, something like
tasks {
processResources {
inputs.properties(
"version" to version,
"name" to project.name
)
expand(mapOf("version" to version, ...))
}
}
i've starting using it everywhere where i meet immutability but kinda afraid when i would need to refactor it could be kinda messy
same for me but I did not have to refactor anything
I never use records 🤔
like the records are still working fine
records are kinda better for jvm
I have a minigame plugin and the settings for the game are stored in a record
I use records for anything I need to represent data
I have a builder that can make this object, which is used when the admin wants to change something
e.g. sql records, configs and such
should manager class be a record in your opinion?
no
no
why though if its immutable
a record might the thing it manages
records are for data
a manager/repository isn't data
DAOs and DTOs etc
do you happen to have an example
public record EnchantmentManager(Registry<String, EnchantmentType> typeRegistry)
public List<Item.EnchantmentProbability> calculateProbableEnchantments(Item item, EnchantmentType knownEnchantmentType, int tableLevel);
it basically only holds references
for retrieval
Like this?
also, a record inherently exposes the data it holds (that's the point, they are transparent data carriers)
in a repository or manager class, I don't want to expose the internal details and data it uses, but rather methods that present invariants on how to operate on the manager with the data
i use kotlin data classes
havent we convinced you to join the kotlin cult?
i've started learning it
but decided for this project to stick to java
