#help-development
1 messages · Page 1192 of 1
maybe relocate somehow
hehe-
fucking spring
I've had bigger
ItemMeta meta = customItem.getItemMeta();? this is the easy way?
that sounds like a challenge
okay, omg
Bukkit.createItemMeta exists I guess
i love our map manager's commit messages
?
radstevee authored and ? committed
is this the right path src/main/java/assets/minecraft/models/item ? , this is part of my gradle : ```
sourceSets {
main {
java {
srcDir 'myplugin/src/main/java'
}
}
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
shadowJar {
archiveClassifier.set('all') // Use 'all' classifier for the fat jar
}
no
resource packs are not in your plugins source code
(if you are making it manually)
oh, ahh, does it need to place on the main folder right ?
does it this directory file needs to be on the server folder?
the answer to all of your questions and more is my favorite word "depends"
haha, im looking a guide how to make the custom item as rad said to use the customItem.getItemMeta();, but cannot find any answers to where do i put the resourcepack.rar/zip or the directory folder
to be server side
you have to make the resource pack and then ship it with either a service like dropbox or make your own
there is no "server side" file structure for a resource pack
oh
but if I upload the resourcepack to a dropbox, then i need to use the @EventHandler public void onJoin(PlayerJoinEvent event){ event.getPlayer().setResourcePack( path ); } ?
alongside with the customItem.getItemMeta()
but this make me confuse
you shouldn't be starting up and dealing with ports every time a player joins
you should provide a constant service
I think you're in far above your head for your current knowledge
setResourcePack doesn't take a path https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html#setResourcePack(java.lang.String,byte[])
declaration: package: org.bukkit.entity, interface: Player
its a URL and a hash
oh, if i understood to manage the constant service does it need to be localhost with a port of the server , right?
from the contex tI'm seeing that random code you pasted isn't even a real thing
I don't really think you have any clue what you're doing and maybe you should slow down take a step back and try and understand how things work
yeah, im just want to try to "attempt" imitate the serverside backpack , to get to know how to do custom item
i didnt though it could be that complex
Is there any way of stopping the player rotation, without the "teleport back" effect, and still have the server be able to read movement inputs (so no spectator)?
Fun thing the client keeps sending movement while spectating
yeah ^
You'll just need a packet listener
the server just kinda ignores them
PlayerInputEvent vibes
thing is, this is great for my interaction shit
Yeah that's how the world GUIs are made
Wait, so I could spectate a mob and also know if the player is attempting to move?
yes
Could you perhaps hint me towards some resources that are helpful to learn more about that?
wait a minute
2 rads
@blazing ocean wtf?!
Don't really have any
Then, would you perhaps mind explaining the method?
You just listen to the packet that the client sends using ProtocolLib or PacketEvents
On that note, is the protocollib wiki down by any chance?
yeah
it's merged into the mc wiki
I cannot find the mc wiki version by googling, is it hidden?
probably not hit good seo yet
Thank you c:
PacketType.Play.Client.POSITION is what Im listening to. Test messages get printed when moving around, but not when spectating a mob. Did you mean another packet?
Are you refering to WASD detection, or when the mob that is being spectated moves?
Theres a packet for that?
WASD detection
yes PlayerInputPacket should detect WASD presses
I'm not familiar with protocol lib so i can't help you figure out what they call it
I found the packet on the wiki, but can't seem to find it in the api
:c
packetevents >>>
why is the player input packet called steervehicle
declaration: package: org.bukkit, interface: Input
they both have the same problem
they take the packet names out of their ass
spigot has no event
this is pretty much useless tbh
declaration: package: org.bukkit.event.player, class: PlayerInputEvent
wtf this must be new
It's pretty new yes
there's also Player#getCurrentInput
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/553558256cab26217919a0809cc26f7aad22995d eh, been there for a while now
Which version is this? I can't seem to find it.
I just saw the 1.21.4, mb
a vine boom just played in my head
This is exactly what I was looking for, incredible 💚
Hello everyone, please help me. I saw a script on Denizen, where using text displays, spectator mode, and mount the player could spin around, but at the same time his camera was blocked.
how do I do this?
Paging @blazing ocean
Some weird stuff with spectating an entity while riding an entity
I tried to do the same on version 1.21, and it doesn't work for me, although it should.
https://paste.md-5.net/gonudehiki.java - Main
https://paste.md-5.net/ezuhusotus.java - MenuManager
https://paste.md-5.net/tecuvazeve.java - Menu
https://paste.md-5.net/ijitehumiv.java - PlayerHandler
https://paste.md-5.net/ojohebokol.java - Command
🥴
god help
no debug messages? null checks with messages, exceptions, etc.*
code is like a woman, you have to fight for it and with it
What on earth are you on about
he's talking about his lack of experience in healthy relationships 🤓
Rad why did u change ur username
Also why is your profile zoomed
And why are you no longer verified
I have no errors, that's why it has no debug messages
I just need to understand how it works.
Is it possible to make inventory bigger than 27 slots?
oh, like this.
You can do 9, 18, 27, 36, 45, and 54
And also some niche ones like 5 and 9 but in a square
xd
Wait a minute
@blazing ocean
Yoooo
Bro who is you 😭 IMPOSTER
Everyone tryna be rad these days
he might look like rad but he isn't radical
Mf radioactive 😭
What a beast
got a 900 piece set
I might be able to call tmmrow :3
Oh big boy set
we're meeting on friday
Shits tough
Real working Lego combustion engine
Does anyone know if spectating without spectator mode is possible? Packets seem to also force you to be in spectator if you want to spectate an entity. Trying to get rid of the spectator hotbar, but it seems like there is no way around it 😔 .
nuke it with a resourcepack
.
That doesn't really work, since the "items" still are there, overwriting the actual hotbar items I would want.
hm
I could try
oh shit you actually make a crankshaft this is tough
watching a build video this entire set is built with those circular studs
and it's hella complex it'll take me like 5 hours fs
Lock in and it takes 1
Do you mean packet to make it seem like they are in e.g survival, while server side they are actually spectator (with the ability to spectate entities)?
Other way around I think
PacketContainer packet = protocolManager.createPacket(PacketType.Play.Server.GAME_STATE_CHANGE); packet.getGameStateIDs().write(0, 1); protocolManager.sendServerPacket(p, packet);
This is the only packet I found for gamemodes. There is also a:
packet.getGameModes().write(0, EnumWrappers.NativeGameMode.ADVENTURE);
But I cant find a packet for this, since this one gives me write errors. And since the previous one is not giving me a write error, I'm assuming the structure is not wrong? In both cases, I'm still seing the spectator hotbar, so I'm probably misinterpreting something?
After checking a bit more, I realized the Game State Change has nothing to do with gamemodes, not sure how I missed that part. Then Im wondering what the actual packet is.
It's game state change you're looking for. Specifically (in 1.21.4) it's packet id 0x22, key minecraft:game_event. I believe game state ids (id 3) is correct in combination with integers
Actually technically it's a float in the packet
I found online that game state change is apparently for some kind of "demo event" though?
It can be used for that
It does everything!
PacketContainer packet = protocolManager.createPacket(PacketType.Play.Server.GAME_STATE_CHANGE);
packet.getGameStateIDs().write(0, 3); // 3 = gamemode change
packet.getFloat().write(0, 3); // 3 = spectator mode
The magic packet
That would be a game mode change
Because a float could be used for something else
Isn’t that the point of the first id
private final PacketPlayOutGameStateChange.a event;
private final float param;
It's defined as a float though
To identify what the rest of the packet contains
Well yeah but all of them just send an event and a value
Wacky
public static final PacketPlayOutGameStateChange.a NO_RESPAWN_BLOCK_AVAILABLE = new PacketPlayOutGameStateChange.a(0);
public static final PacketPlayOutGameStateChange.a START_RAINING = new PacketPlayOutGameStateChange.a(1);
public static final PacketPlayOutGameStateChange.a STOP_RAINING = new PacketPlayOutGameStateChange.a(2);
public static final PacketPlayOutGameStateChange.a CHANGE_GAME_MODE = new PacketPlayOutGameStateChange.a(3);
public static final PacketPlayOutGameStateChange.a WIN_GAME = new PacketPlayOutGameStateChange.a(4);
public static final PacketPlayOutGameStateChange.a DEMO_EVENT = new PacketPlayOutGameStateChange.a(5);
public static final PacketPlayOutGameStateChange.a ARROW_HIT_PLAYER = new PacketPlayOutGameStateChange.a(6);
public static final PacketPlayOutGameStateChange.a RAIN_LEVEL_CHANGE = new PacketPlayOutGameStateChange.a(7);
public static final PacketPlayOutGameStateChange.a THUNDER_LEVEL_CHANGE = new PacketPlayOutGameStateChange.a(8);
public static final PacketPlayOutGameStateChange.a PUFFER_FISH_STING = new PacketPlayOutGameStateChange.a(9);
public static final PacketPlayOutGameStateChange.a GUARDIAN_ELDER_EFFECT = new PacketPlayOutGameStateChange.a(10);
public static final PacketPlayOutGameStateChange.a IMMEDIATE_RESPAWN = new PacketPlayOutGameStateChange.a(11);
public static final PacketPlayOutGameStateChange.a LIMITED_CRAFTING = new PacketPlayOutGameStateChange.a(12);
public static final PacketPlayOutGameStateChange.a LEVEL_CHUNKS_LOAD_START = new PacketPlayOutGameStateChange.a(13);
public static final int DEMO_PARAM_INTRO = 0;
public static final int DEMO_PARAM_HINT_1 = 101;
public static final int DEMO_PARAM_HINT_2 = 102;
public static final int DEMO_PARAM_HINT_3 = 103;
public static final int DEMO_PARAM_HINT_4 = 104;
private final PacketPlayOutGameStateChange.a event;
private final float param;
Listen man, I just work here
hold up
(but you'll see demo is in there too, it's just event id 5)
So this is Mojangs “uhh wtf do we use for this” packet
lol yeah basically
choco works there?!?
So it kind of works, I think? It looks like Im being put into the mode, but my hotbar completely disappears now. Is that a side effect perhaps?
Ig thats true
is it possible to run client side simulation on spigot nms 1.16+-1.20+? i.e. given entity E move it until XYZ location, with a single packet
- set velocity wouldnt work for me as (from what i tested) it requires gravity and i need a straight line
- multiple
SET_POSITIONorTELEPORT_ENTITYwouldnt work as i have a rather high expected volume of entities REL_ENTITY_MOVEapplies the movement distance in a single tick and i require longer distances (quote: "This packet allows at most 8 blocks movement in any direction, because short range is from -32768 to 32767. And 32768 / (128 * 32) = 8.")- custom nms entities (from what i understood) would be too expensive for my use case, since they would spawn server side? im not entierly sure
all entities are armor stands. any crazy ideas are welcome, thanks
yea i saw those, i might have to go with that if i cant find an optimal solution for this
i would reeeally like to support 1.16+ tho 😭
there is no way about it other than the set position packet given your requirements
how many entities are you moving? Is it really a no-go?
dropping 1.16 is an optimal solution
given an estimate in the worst possible scenario with 100 active players, its like 500k packets per second
I mean, that doesn't really matter
you can off-load the packet processing if ultimately necessary so that it doesn't affect normal gameplay, would just require some tinkering
my question was more towards as to why you need to do it, what are you doing with this?
how would i go about making a command to not allow oped people to teleport to me?
use events
playerteleportevent
then cancel it
so i looked at this event and i can see i can get the cause which would be command and the location its teleporting to but can i check who its teleporting to?
prolly not
Best way to do it is to probably check all players within a like 5 block radius and see if it contains the player
what are some of the most taxing functiosn in the API in terms of memory
and also big O i guess
i assume some big search ones like block related stuff
yikes
UUID kingdomUUID = resultSet.getString("kingdom") != null ?
UUID.fromString(resultSet.getString("kingdom")) : null;
For cases like these, what would be a better approach for an "invalid" UUID, ie something that remains constant to indicate
Kinda like how -1 is reserved a lot for special cases
or is setting it to null fine
public static final UUID INVALID_UUID = new UUID(0L, 0L);
maybe something like this?
id normally assume valid uuid inside a db, if a end user modifies it its on them to resolve the error
is it best practice to make specific util classes; i started doing that to keep things organized
like this
oh shoot it's 12 am what the
I do that sometimes, don't really see anything bad about it
private static ChunkCoordinate getPlayerCurrentChunk(Player player) {
Location playerLocation = player.getLocation();
int x = playerLocation.getBlockX() >> 4;
int z = playerLocation.getBlockZ() >> 4;
UUID worldID = playerLocation.getWorld().getUID();
return new ChunkCoordinate(x, z, worldID);
}
this is redundant but i did a little function to mathematically get the chunk from coords lol
why would you do it that way
and not just player.getLocation().getChunk()
which apparently does just that:
depends whats in it
if you just put everything in there, its definitely not best pratice, but at best static abuse
Utils
yeah sure, in my databaseutil i have all my database properties, all my database statements, connection utils, just.. a bit of database stuff
Hi what is the best way to seralize an inventory? Converting an Itemstack array with gson?
serialize it into bytes
Is there a steal item from item frame event i can cancel?
PlayerInteractEvent cancel doesnt work for it, only prevents destroying the frame
Should I seralize the array of Itemstack directly in array of bytes ? Can I deserialize it in another server ?
you'd first serialize the itemstack into bytes and only then the array
and yes
you could use something like this to serialize the items:
https://github.com/Jishuna/JishLib/blob/4.0/nms/v1_21_R3/src/main/java/me/jishuna/jishlib/nms/v1_21_R3/NMSAdapter.java#L140-L153
then something like this to serialize the inventory/contents as a whole
some smart individual to shine some light on this weird issue with entity metadata and nms?
https://github.com/dmulloy2/ProtocolLib/issues/3316
This issue is not solved in a development build Describe the bug When sending an entity metadata packet for an NPC, the server throws a ClassCastException caused by an incorrect type conversion bet...
thnaks
Is the following cache structure and design efficient for storing generator data?
I am implementing a system in my minigame plugin where generators have properties based on different difficulties, types, and levels.
The structure is stored in a .YAML file and cached for faster access. I want to store the generator data in a cache for quick retrieval,
ensuring the getter method returns the generator with its relevant properties based on difficulty, type, and level.
**here is the design **
difficulties:
easy:
types:
iron:
levels:
1:
spawnInterval: 3
maxItemsStack: 30
imagePath: "iron-map-1.png"
upgrade:
item: IRON_INGOT
cost: 48
here is my class ( Generator Object )
public class Generator {
private GenProp properties;
private Location genLoc;
private Location picLoc;
public class GenProp extends Generator {
private GenType type;
private int level;
private int maxLevel;
private double spawnInterval;
private int maxStack;
private boolean levelUp ()
{
if (level >= maxLevel) return false;
level++;
// TODO: implement the item-frame changes.
return true;
}
}
and here is my cache & getter method
private static final Cache<GameDif, Map<GenType, Map<Integer, Generator.GenProp>>> cache = Caffeine.newBuilder().build();
public static Generator get (GameDif difficulty , GenType type, int level) {
// No Null Checks
var types = cache.getIfPresent(difficulty);
var lvl = types.get(type);
var props = lvl.get(level);
var gen = new Generator();
gen.setProperties(props);
return gen;
}
Why do you need a caffeine cache?
feels like a normal HashMap would do the trick
It all looks fine tho, but maybe try to name ur type rather than a nested Map type ^^
and yea the yml seems fine, normal orming in principle
YAMLs are cached already
yes but accessing a field directly is a bit faster
and free compile time type safety
public class CustomWitherSkeleton extends WitherSkeleton {
public CustomWitherSkeleton(Level world) {
super(EntityType.WITHER_SKELETON, world);
this.collides = false;
this.expToDrop = 0;
this.setInvulnerable(true);
this.setCanPickUpLoot(false);
this.setAggressive(false);
this.setCustomNameVisible(true);
}
}
made a custom mob but it still attacks people, any help?
i thought setAggressive gets rid of that
You'd have to override the AI - Goals
after adding
this.goalSelector = new GoalSelector(world.getProfilerSupplier());
this.targetSelector = new GoalSelector(world.getProfilerSupplier());
beforehand, it works
now...
how can i make it attack say
cows or something
and can each custom mob have their own instance variables? Like a spawn X Y Z to teleport back to
this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Cow.class, true));
i tried using targetSelector but it just stood and did nothing ;-;
is it the setAggressive that is interfering, or is there more at hand?
welp, check how vanilla does it
yes
dang i thought it was the api or plugin dev
most people here don't know every little thing about nms lol
well you are not using the API
explain explain
you are using NMS
Target does nothing by itself ofc
it just finds a target given the goals u added
i got it workin
i added goals
it works on attacking cow mobs and nothing else, but upon serer restart it seems to reset the NPC AI
Hey, I'm currently working on an UHC Marvel plugin in 1.8 but there are some things I'm not good enough to work on it so I'm searching if some people are willing to help ^^'
yea, tho usually u wna have target selector filled with goas that don’t occupy the other goal flags
and then the goal selector with physical goals that make the entity do sth
Altho GoalSelector is kind of outdated nowadays but yea
what do you mean by that specifically?
how can i save in between instances of server; keep the custom mob persistent?
You can probably check how Endermen target Endermites, take inspiration from there.
Now, I don't know the "standart" way of doing custom mobs.
But my approach would be: give your custom mob some PDC value as identifier (also store all your custom variables per mob in that PDC)
Now check each entity in some entity load event, if it has that specific PDC identifier, copy the PDC, kill that mob and paste the PDC.
bcos i already have maps using caffeine for like Users / Profiles and some stuff, and why not
Well its goofy because u’re enforcing extra thread safety, and memory safety when its not needed
slow that is
Basically, you are using DataItem where you should use DataValue
https://mappings.dev/1.21.4/net/minecraft/network/syncher/SynchedEntityData$DataItem.html
https://mappings.dev/1.21.4/net/minecraft/network/syncher/SynchedEntityData$DataValue.html
The set metadata packet changed (around the 1.20 iirc). I don't use ProtocolLib but here are some examples that use raw nms:
Before:
https://github.com/Flowsqy/ShopChest/blob/master/nms/v1_19_R1/src/main/java/de/epiceric/shopchest/nms/v1_19_R1/FakeEntityImpl.java#L101
Now:
https://github.com/Flowsqy/ShopChest/blob/master/nms/v1_20_R1/src/main/java/de/epiceric/shopchest/nms/v1_20_R1/FakeEntityImpl.java#L97
ok so i got some code that checks if a message contains a string but how could i check if that message contains any string from a list<string>
A for loop would be the easiest solution
Not super efficient but that might or might not matter
damn i thought there might of been a cool way of doing instead of a for loop
There are better ways
but usually not worth the effort
I assume your list is quite small
yeah, most likely only 2 or 3 strings
i want to give you a big kiss thank you
Out of curiosity, is this even possible without spectator? I'd be interested in knowing if there is a way to work with the player yaw/pitch, while "resetting" and having it appear as locked. PlayerMoveEvent would be the closest thing, with the issue being that whenever you reset, it "teleports" back the camera instead of keeping it completely still like spectator.
Just use for loop and check with String#contains, you need to make it work, don't try to make it look pretty.
how do you save custom npc behavior across server restarts?
Did my answer not help ?
is it guaranteed that when a player joins and I save their Player object it will be the same one as the one I can get when they leave the server?
i tought ur answer was about Goals actually
basically, can the Player object assigned to a player change without them rejoining the server
no
iirc when players die they also get a new player object probably
thats why you use uuids
uh-huh
also on dimension switch afaik because they get respawnef
@glossy laurel no, don't store references to players
yeah thats what I got
im switching rn
you can get some memory leaks if you don't do your shit properly with that
dang
is it possible to make your plugins decompilable?
what even 💀
every java app is decompilable
is it possible to make it more challenging to do so??
im in a situation which i dont want people to decompile it
why
there is no good reason
your plugins code is not that advanced that you need to obfuscate it
if it was you wouldnt be asking this
exactly
im feeling they are gonna cut me off halfway and give it to another developer. i dont want the developer to write on my code. i dont want that to happen. simple as that.
what
yeah its not that advanced code
what do you even mean
you don't have much choice there
obfuscate it ig
if you have that feeling, then dont do anything
no one wants to work on decompiled code anyways
my whole system is built on player lists, am I cooked
I had to work with decompiled kotlin code for hours
and trust me, it was bad
make those uuid lists
yes
^
what
well
you can't cast a uuid to a player lol
well, time to suffer for my bad coding practices
now you gotta write decent code
😁 👍
tech debt coming in hot
if its only 2 hours you aint seen nothing yet
fun Audience.forEachPlayer(block: (Player) -> Unit) {
forEachAudience { audience ->
Bukkit.getPlayer(audience.uuid())?.let(block)
}
}
fun Audience.players() = buildList { forEachPlayer(::add) }
``` my entire system is built around audiences and their uuids where I'm never storing player references
you're gonna have to do a lotta Bukkit.getPlayer calls but it's much safer than storing player references
can't you implement an operator method
what for
for (player in audience)
in is just a contains operator function
and that only works for iterators
as far as I'm aware
audiences are not iterable
I don't see how the language could iterate over something just based off a contains function
But you're right, I could implement the contains operator function
I did make mapTeams, mapTeamsIndexed, forEachTeam, forEachEventPlayer, etc.
why do you guys always assume the worst case scenario
like i ask the most mundane thing and you guys think im gonna start a genocide with it or something😂
but yeah obfuscation was what i was looking for
average day of code nester
there is no reason to obfuscate plugins
ummmm i dont think its supposed to get like that
Guys I want make my home plugin proprietary
you say
like how?
how do you even manage it to get it like that 😂
im geniunely curious
I was waiting for htis
skill
I repeated the same checks like 3 times
cuz im sigma
the only way I've ever gotten to that level of indentation is recreating FIR trees and command builders
what are FIR trees
and command builders too
💀
the kotlin compiler's frontend's immediate representation of source code segments, which get parsed into its backend's immediate representation
whatever that means
hold on, the red fir isnt actually red
gaslighting
wild
The wood might be
It isn't
Well that's just misleading advertisement >:(
Wait until you learn that a pineapple isn’t pine or apple
maybe its communist?
@river oracle mentioned?
do i not count to pineapple anymore
no
Im copiling the begginer the simple plugin server possible but my the spigot server are not loading it idk why
what I should send here to provide engough information?
Should be an error in your console
minecraft console?
its compiling...
Cannot find main class `org.example.TutorialPlugin.TutorialPlugin'
I found the error
So you already did compile it
yes
Well there you go
how to fix? lol
plugin.yml
Properly specify a main class
I made a typo? I cant find it lol
package org.example;
import org.bukkit.plugin.java.JavaPlugin;
public class TutorialPlugin extends JavaPlugin{
@Override
public void onEnable(){
getLogger().info("onEnable is called!");
}
@Override
public void onDisable() {
getLogger().info("OnDisable is called!");
}
}
Wrong package
org.example.TutorialPlugin.TutorialPlugin should org.example.TutorialPlugin
in your plugin.yml
alternatively move the class in to the org.example.TutorialPlugin package
(though fix the name to fit conventions (lowercase))
my package are only org.example
Here
i doubt this no offense
Then change it to match in your plugin.yml
haha, sorry its mt first with java
ok done let me test
if ur first time in java you should do basic projects in plain java first
start with some basic
s
im a begginer on all of them, the biggest code I made was a simple 2d game
with sdl
and a step by step youtube tutorial
?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! 🎉
anyone that has a good tutorial of making a custom npc in 1.21?
Do yourself a favour and use Citizens
There's no need to reinvent the wheel for the 100th time
I would love to suffer
Then don't look for a tutorial
legit
How to create NPCs hasn't really changed in quite a bit
The guide that everyone keeps copy pasting should work if you tweak it to use proper mappings
should I use the mojang mapping version?
nah not that level of suffering xd
that's a very different kind of suffering
Might need a packet sink to void the packets the server tries to send
use yarn
You need a dummy connection impl, correct
Yeah I just don't remember if the tutorial shows how or not
but since it's a common issue I assume not
.
it's in add entity now
how to find memory leak :3
look at memory graphs
System.out.println("The memory is leaking");
fr
System.gc() // leak fixed
someone should write a plugin that does this 
task timer every 5 ticks
That's already been done sadly

do the spigot way, rewrite it but better and with hookers and blow
restarting server every 5 minutes also helps 👍
new Thread(() -> { while(true) { System.gc() } }).start() For big ram optimization
Call it ClearLaggg or something
3 g's so people know we're serious
The leading Plugin in reducing lag, join today for FREE
-# *We will be collecting every little part of data we find and can collect, but that's purely for optimizing our software
EventPriority.HIGHEST happens after EventPriority.LOWEST right
Yes
yerrrrrrrrrrrr
what about deluxe async join leave message
does anyone have plugins which make use of PDC extensively
like, creating custom data types and the like
I am in the process of making a library to automate PDT creation but I'd like to see more real world usage of it to have a clear picture on how to go about it
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
Bot is slow today
sorry if im butting in, but in a plugin i just rewrote a chunk of, i have a PlayerDeathEvent that fires.
I wanted to establish that Player p = event.getEntity() and Player k = p.getKiller() are the same.
so i tried to use p.getUniqueId().equals(k.getUniqueId()), and in all cases that condition would always be false.
if i use the player name string p.getName().equals(k.getName()) however, it works correctly. was there something i missed in the first attempt? or is getUniqueId not as persistent as it suggests?
the aussie internet isnt happy
doesn't make sense, did you make sure to isolate the if statement to see if that was actually the case?
that said, is there any reason you aren't just doing instance equality?
ill have a prod if you like as for the second question not really a specific reason lol
just wanted to get something working first
well, UUID equality should just work honestly, which leads me to believe the issue was somewhere else so who knows
if you can reproduce it consistently, then do mention it, maybe there's some bug in there
oh nope it mustve been my own silliness haha
wonder what i managed to do now in the first place
is there any technique whatsoever to prevent players from colliding with each other when they are both on boats, while keeping the players visible to teach other?
Do boats work with scoreboard team collision rules?
theres an VehicleEntityCollisionEvent
probably not as it's a seperate entity
Separate entity to what
Yeah
Ah, darn
theres a video here that showcases some sort of solution (at the timestamp) https://www.youtube.com/watch?v=Qt_9fghRqZk&t=853s
but somewhere in the readme it states this
Yeah I saw a bit of that
Boats are janky
Which is a shame because boat racing is cool
hey, i was wondering on how to add custom permissions to my plugin
is it like normal plugins where i would add them to the spigot.yml but inside a bungeecord plugin just in bungee.yml
or do i need to do it in another way
with commands it works great but how do i add like custom permissions to my plugin?
You can add them to your plugin.yml
tried that already for bungeecord and this didn't work
I assumed you were making a Spigot plugin
nope a bungeecord plugin but thanks for your try to help :)
Can't really find a place to register them
But you could just try using them without doing so
*Other than the command constructor
yea i know that
this would work i guess but then the giving the perms to players would be a big mess
boat racing is actually so much fun, i wish mojang made it less jank
I'm not sure if this is a help-dev or help-server but, I'm creating worlds for minigames and I keep getting this flooding the console:
https://paste.md-5.net/moxuzowuyu.cs
It's obv something with saving 'raid data' but I have no idea how to stop it.
nvm I got it 💀
createdWorld.setAutoSave(false);```
I might be mentally slow 🙏
even in singleplayer it lags behind like 3t from its actual position
Hello, When I try to reload my config the values don't change for a GUI
This is the code : https://paste.md-5.net/idoyejejet.cs
show the reload command
ConfigGUI is saving the old instance of config
I didn't reload the confirm config 💀
Yeah no way i spent like an hour trying shi
😭 it happens
anyone familiar with ACF?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
how do u make command arguments using ACF?
I read the github wiki a bit and cooked up this ```java
@CommandAlias("party|p")
public class PartyCommand extends BaseCommand {
@Subcommand("invite")
public void onInvite(Player player) {
System.out.println(player.getName());
}
}
player seems to be the sender..I thought it would make it an argument
just an example from one of my projects
@Subcommand("of")
@Syntax("<target>")
@CommandCompletion("@players")
@CommandPermission("crates.keys.other")
public void onKeys(Player sender, @Single @Flags("other") OfflinePlayer target) {
PlayerKeysData.showTo(sender, target);
}
the first argument is always the sender
oh
there
I didn't understand cloud really well...
nice
@Subcommand("invite")
@Syntax("<target>")
@CommandCompletion("@players")
public void onInvite(Player player, @Single Player target) {
System.out.println(player.getName());
}```
howw
ACF is golden
are you able to disable pluginname:command?
nope
D:
bukkit thing
Can't disable, but you can hide it, nah?
don't believe so
I remember disabling it but idk how
sorry but I like this: https://paste.md-5.net/regudexefo.bash
"ctx" eww this isnt a discord bot
fym
No 🧢 I hate builder format
I'm not typing out context nor am I using c
this just looks nice and neat
same way I use idx instead if index and i most of the time
erm why is the target..sender?
it's mostly the case of it being a tree-like structure
handler { ctx ->
val type = ctx.get<GameType<*>>("type")
val participants = ctx.get<MultiplePlayerSelector>("participants").values().audience()
is that from clouds'builder? is that even java
or kotlin
though I believe CommandAPI does a decent job at offering a builder-like approach
kt
kotlin and yes
annotations do look nice, but it ends up being annoying at times, mostly when it comes to completions
why does it set target to the sender?
what target
the 2nd arg
.
yeah, for simple commands that works
imo one of the strong points on ACF is its sub class design that allows to make a subclass as a subcommand of a base command
why am I still doing the selector thing manually I made a lil extension for that smh ```kt
fun CommandContext<CommandSender>.getPlayers(arg: String) = get<MultiplePlayerSelector>(arg).values().toList()
idk if you can do that with clouds builder
you can do that with cloud
i.e.
nowhere in that code the sender is referenced
just the argument
also self made help command, default and catch unkonwn are useful
cloud has help too
I believe both CommandAPI and cloud offer that kind of workflow
really
- with cloud you don't need to do argument parsing yourself
there isn't much difference in terms of features between these, rather just design choices that one might prefer over another
that's something I've always hated about ACF (or I was just not using it properly?)
I mean, ACF is a perfectly fine choice
what was the command to reverify here? i changed my username but i have the old one here
erm can someone explain me how command args work with ACF..
ping @vagrant stratus (idk if he has perms to change usernames here)
first arg is command sender
all the rest are arguments in the command
this casts second argument to an online player based on name
yes but I just put random word in it and it still for some reason prints my name
it probably just fills in with the sender if no argument is valid, there's probably an annotation to make it not do that
I assume it is using the getPlayer method that matches the closest thing
you need to add @Flags("other")
yup that's also one of the reasons I chose to move away from ACF
i think thats an ACF bug
I'd say that's rather unintuitive but not something I'd really mind honestly
just a gotcha
back when I cared to use command frameworks, I prefered CommandAPI or ACF because they were simpler
cloud is just too big and I can't make sense of it
I like cloud
I don't dislike cloud, I just can't understand it properly, and I couldn't be bothered to push my way through its intricacies when other perfectly fine choices exist as well
I made a few extension functions and systems around it and I find it really enjoyable to work with
erm
is unjoinable your name
@Subcommand("invite")
@Syntax("<target>")
@CommandCompletion("@players")
public void onInvite(Player sender, @Flags("other") @Single Player target) {
System.out.println(target.getName());
}```
i did add @Flags("other")
yes
do OfflinePlayer
offline player would mean anything would match
its not finding the name so its defaulting to the one that was found
that i dont understand about acf
i will have to go in ACF discord ig.
I like this one I made ```kt
inline fun <reified T : Any> MutableCommandBuilder<CommandSender>.registryArg(id: String, registry: Registry<T>) {
required(id, RegistryEntryParser.registryEntryParser(registry))
}
kt 😭
I LOVE KOTLIN
is it really that good
yeh no
yessssss
iv been using java for 3+ years and it feels like an affair to use kt
did you try marking it as nullable or something
what about just making it @Optional
its not optional tho
another way (uglier) is making target String and checking yourself for online players, keep the autocompletion
does it do that with anything you input to it? Even numbers?
ye it shows error
what error
isn't that what you want?
databaseTransaction {
is that a function or a custom keyword?
a function
yea but would OfflinePlayers add all the players who have played?
any function that has a closure parameter at the end can be used as well, a closure
a function with a trailing lambda, yes
and of course: ```kt
object EventTeamPlayers : Table("event_team_players") {
val uuid = uuid("uuid")
val teamId = varchar("team_id", EventTeamMetas.LONGEST_ID)
}
I've always got mixed feelings about trailing lambdas
they allow for nice DSLs if anything
this@EventT 😵💫
yeah this would be the Transaction because the databaseTransaction lambda puts the transaction in this scope
😯
where is the Table class from?
exposed
databaseTransaction({
// ...
})
feels weird
feels java-ish
corroutines in kotlin are useful in plugins?
they definitely are, provided you're using something like mccoroutine
I like them
I want to learn them
mcc even supports minestom that's crazy
they just a fancier new Thread().run(callback) ?
I just know the runBlocking, the launch and yield
not really
they have a lot more features
more like Thread.ofVirtual().start(callback)
hm
Recording brought to you by American Express. https://americanexpress.io/kotlin-jobs
OpenJDK Project Loom is in preview and will become stable any time soon. It offers seemingly similar benefits to Kotlin Coroutines, raising a lot of questions on Kotlin Coroutines and Project Loom coexistence and future. In this session, we'll examine and comp...
this talk does a good job at explaining the differences
KotlinConf talks are really nice
I prefer the devoxx talks, kotlinconf doesn't really explore much of the JVM itself
Fr
Is learning kotlin worth it? Been considering it.
read from here
The code that rad paste looks confusing as fuck lmao.
Hey, just started doing my own plugins.
Whats is the best way of finding out what methods do and how to use them?
Tried to search for Dokumentation but couldn't really find something
?jd-s
Thanks
Exposed hell yeah
Hello, I am creating a Fireball plugin, and I have a 30-second cooldown for each use. However, I want to add a countdown timer on the material in the inventory to show the remaining time like a screen or smth I'm not sure how to explain the idea
how to do that?
declaration: package: org.bukkit.entity, interface: HumanEntity
Or use the material version of that method if you want it for all of them
ty broski best eggwars friend ever
thanks

what does that even mean
me and @chrome beacon used to play eggwars like 7 years ago xd
^^
on cubecraft server
Time flies
Does anybody know if the "update" folder usually works for plugins on velocity?
Maybe I'm wrong here...
You should ask paper
Does the ."../plugins/update" even usually work on Spigot?
Oh okay, it also works for Paper servers, but I wondered if it also works for their proxy. Does it work on BungeeCord or are plugins not supported on there at all?
doubt 🔫
Thank you very much for your help @young knoll !
I checked the file names, I understand that they have to match.
Oh okay, I noticed that on paper I think I had to create an update folder manually.
egg wars was goated
Yea yes you are
yeah I mean you're softdepending on bungee
nah
it won't work if i'll use depend
Yeah because it isn't a plugin 💀
oh ok
Well, only the chat api is in spigot
Yeah what else would you want to be using on spigot
softdepending on bungeecord makes no sense
what kind of bungeecord api do you use?
what classes of the api do you use
server command?
ye
/server is not part of the api
also it is bungeecord api
it is made for use with bungeecord plugins
not spigot plugins
Yeah that just won’t work
You use plugin messaging to communicate with bungee
?pmc
what
which will not work
So you aren’t even using the bungee api
xd
How does one manage...
wdym
i use terminal command handler a lot when using custom commands ok?
- this thing works
if u want i can demonstrate in vc
wha-
why i keep getting problems with on player join event
time to use skript if im bad
tf
at this point I have no idea what the fuck you're saying
i dont get the context of terminal commands
im trying to make event that when player joins it tps him to position
like in all lobbies
but i keep getting log errors
why not?
fine if u say so
try to help me with this:
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
handleAdminPrivileges(player);
teleportPlayerToLobbySpawn(player);
player.sendMessage("§eLobby rules: Block breaking/placing disabled for non-admins.");
}
private void teleportPlayerToLobbySpawn(Player player) {
if (lobbySpawn != null) {
try {
player.teleport(lobbySpawn);
} catch (Exception e) {
getLogger().log(Level.SEVERE, "Failed to teleport player to lobby spawn", e);
player.sendMessage("§cTeleportation to lobby spawn failed.");
}
} else {
getLogger().warning("Lobby spawn not configured. Skipping teleportation.");
}
}
private void configureLobbySpawn() {
World world = Bukkit.getWorld("world");
if (world != null) {
lobbySpawn = new Location(
world,
1.0,
14.0,
88.0,
180f,
0f
);
} else {
getLogger().severe("Could not find a valid world for lobby spawn.");
lobbySpawn = null;
}
}
unnecessary layer of abstraction
problem?
thats just code
leme restart server coz i deleted logs
[16:01:59 ERROR]: [HawkStudios-lobby] Could not find a valid world for lobby spawn.
not really that complicated
World world = Bukkit.getWorld("world");
world is null
either loading too quickly or "world" doesnt actually exist in your server
i think Bukkit.getServer().getWorlds().get(0) returns the overworld
or Bukkit.getServer().getWorlds().getFirst()
nope
System.out.println("Bukkit.getServer().getWorlds().getFirst() = " + Bukkit.getServer().getWorlds().getFirst());
Bukkit.getServer().getWorlds().getFirst() = CraftWorld{name=world}
it does..
tbh my world name actually "lobby"
i changed and don't know why it doesn't work
error..?
same thing
show code
.
you did update this
World world = Bukkit.getWorld("world");
right?
changed world name with lobby
correct
"World world = Bukkit.getWorld("lobby");"
run this System.out.println("Bukkit.getServer().getWorlds() = " + Bukkit.getServer().getWorlds()); and show the output
At line:1 char:57
- System.out.println("Bukkit.getServer().getWorlds() = " + Bukkit.getSe ...
-
~
You must provide a value expression following the '+' operator.
At line:1 char:58
- ... rintln("Bukkit.getServer().getWorlds() = " + Bukkit.getServer().getWo ...
-
~~~~~~~~~~~~~~~~
Unexpected token 'Bukkit.getServer' in expression or statement.
At line:1 char:57
- System.out.println("Bukkit.getServer().getWorlds() = " + Bukkit.getSe ...
-
~
Missing closing ')' in expression.
At line:1 char:75
- ... intln("Bukkit.getServer().getWorlds() = " + Bukkit.getServer().getWor ...
-
~
An expression was expected after '('.
At line:1 char:88
- ... Bukkit.getServer().getWorlds() = " + Bukkit.getServer().getWorlds());
-
~
Unexpected token ')' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedValueExpression
:/
u mean in server terminal or plugin?
For loop over all Bukkit.getServer().getWorlds() and output their name
He means plugin
toString should show that
how?
in plugin
do you know how to make a for loop?
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! 🎉
i use intelij bro
.
yes, bitcoin?
ik java enough
clearly you dont
online classes moment
i mean i took online classes at summer
so i forgot how to do some things
no
i didn't code for so long so don't bully me
it was 1 yr ago since i took that lesson
rn im taking random mc plugin dev tutorials
thats fine but dont ask every tiny little question here
do this first
okay nope ima use "for beginners"
Netbeans is for boomers imo
That won't work in the terminal
i recommend intellij, its basically becoma a kind of standard with java
Hi, how can I hide the a boosbar and show only the text of it?
remove the background texture with a resource pack
btw now I don't see sendActionBar() method in Player class
spinning donut
animation ain't smooth
I'm left wondering
anyone knows what I might be doing wrong?
is there a way to convert a block into an container? I need the custom name from a container when a Player interacts with it, but the way I've tried it didn't work
block = event.getClickedBlock();
Container container = (Container) block;
I hope you're not identifying blocks by their name
Anyways Container is part of the block state
Okay thanks, but how exactly do I access the block state? Sorry if it sounds silly but I've started with minecraft plugins yesterday
Don't forget to do instanceof check for the container
If you're on newer version of Java, you can use pattern matching
allready did that thanks
@EventHandler
public void onPlayerChatEvent(AsyncPlayerChatEvent e) {
if (e.getMessage().contains(":skull:")) {
e.setMessage(e.getMessage().replace(":skull:", "☠"));
if (e.getMessage().contains(":heart:")) {
e.setMessage(e.getMessage().replace(":heart:", "❤"));
if (e.getMessage().contains(":star:")) {
e.setMessage(e.getMessage().replace(":star:", "⭐"));
}
}}}
why does the replace only work on the skull?
how to add minimessage to scoreboard?
Yes
yk that those contains checks are useless?
also ur if indentation is messed up
Oh you are right...
Yeah, i am used to Skript indentation... rlly gotta get that horrible language out of my head ASAP
lord save me
Anyways, how do I add components to scoreboard?
objectives have display names nowadays
tho that does not accept components on spigot :')
unless... @ choco
what is that
before asking "what is that" to everything I'd suggest thinking what it could mean :')
what could a component PR be doing
Is there a way to get rid of the message that says that the message is edited by the server on hover?
if you modify the messages, no
So the only way is to cancel the message and let the server send it?
yeah, that can cause problems on the client tho
pull request? 😭
Correct
Is there a better way?
hm, k. thx
component pull requests??? 😭
a pull request to get better component support into spigot
for things like the scoreboard objectives
Hey, this is my first time working with SQL and SQL in Java, i heard that JDBC is the tool that opens the connection to the mysql server, now im left wondering why my server spams these errors every time I try to make an connection
[Server thread/WARN]: java.sql.SQLException: No suitable driver found for IP-ADRESS
This is how i get my connection if that helps
Connection conn = getConnection("IP-ADRESS:PORT", "USERNAME", "PASSWORD");
I also heard below version 4 you need to import some class, but im importing version 8, so this shouldnt matter for me, right?
Thanks in advance
What JDBC driver are you trying to use
When trying to start mi plugin, appears this on console
https://imgur.com/a/sedLcGa
Version of server is 1.21.1 paper
https://paste.md-5.net/afejunoqok.css This is the plugin.yml
how to use hex colors in scoreboards?
java.lang.IllegalStateException: Cannot create additional worlds on STARTUP```
What's the earliest I can create a world?
or rather, load them
probably onEnable?
the server is running on an older version of java that the lifesteal plugin was compiled with
how do I force a player to leave a container
player#closeInventory
uhm, i dont really know, oracle? i heard about the drivers but i just imported the SQL JDBC library and thats all
What database are you connecting to
a mysql database
What's the proper way to get a player's ping using PacketEvents?
Just saying SQL JDBC library is not specific enough
There are many different SQL databases
i dont know, i really dont, its from java.sql.drivermanager
i dont even know if i use a driver, how to find that out?
You would know before hand what you want to use
mhh, but i dont, never worked with sql before until now
what do most people use for a mc plugin?
SQLite is a common one
We don't know what code you have
PreparedStatement getMaintenanceStatement = conn.prepareStatement("SELECT * FROM server_settings WHERE UUID = '00000000-0000-0000-0000-000000000000'");
ResultSet result = getMaintenanceStatement.executeQuery();```
Just an example

