#help-development
1 messages ยท Page 1070 of 1
sweet
time to do player data handling
hopefully gson is fast enough between transfer connection times
ok, I've been trying very hard and I don't really know how to do that
show us what you've done so far
private GUIHandler guiHandler;
@Override
public void onEnable() {
guiHandler = new GUIHandler();
Bukkit.getPluginManager().registerEvents(guiHandler, this);
public class GUIHandler implements Listener {
private final Inventory inv;
public GUIHandler() {
inv = Bukkit.createInventory(null, 54, "");
initializeItems();
}
Other class:
plugin.getGuiHandler().openInventory(player);
```the other things I tried gave me errors
I guess that's the relevant code
but this is the single gui, not per player
so you are going to create a new GUIHandler per player right?
yeah
but it needs to be on Bukkit.getPluginManager().registerEvents
so have a inventory manager class which keeps track of all the GUIHandlers and the manager will bne the only one with the Listener
then in the listener, loop through all the guihandlers and send the event data
ok, but when closing the inventory, it should be deleted, right?
and how could I handle that?
When dealing with an API do you guys generally prefer Optional or Nullable as return types
I'm kinda conflicted what to use as my standard for non collection types
nullable
๐ coll just throws exceptions
Jokes aside Iโm fairly used to nullable because spigot
I'm making my plugin manager rn
@ApiStatus.AvailableSince("1.21")
@Nullable
PluginData getPluginData(@NotNull final String name);
@ApiStatus.AvailableSince("1.21")
@Nullable
PluginData getPluginData(@NotNull final Class<? extends Plugin> pluginClass);
/**
* Obtains {@link PluginData} of the plugin with the given name.
*
* @param name the name of the plugin to get data for
* @return the plugin data given a plugin with the provided name exists, otherwise null
* @since 1.21
*/
@ApiStatus.AvailableSince("1.21")
@Nullable
PluginData getPluginData(@NotNull final String name);
could get messy really fast
Whatโs plugin data
it definitely will, but its nice
public record PluginData(@NotNull Class<? extends Plugin> pluginClass, @NotNull String name, @NotNull String version){}```
Ah so itโs like PluginDescriptionFile
yep rn its fairly small I don't wanna expand too fast
I just want basic plugin loading I'll figure out a proper bootstrap API later
finding out at what stage to load plugins will be the difficult part
I'm going to do that, but I mean enabling
the actual loading will occur before
net.minecraft.server.Main.main(args);
but enabling will be difficult for me. I have to actually create a Server interface before I worry about that though
Iโd just do it after the server is created and before worlds load
Or provide an option for before/after world load
I am still thinking of like how to set that up though.
- Multiple Interfaces
- Plugin / option to enable before or after the world
- BootstrapPlugin / enables before registries freeze, disables after registries freeze
- Single Interface
Plugin
- onEnable -> Loads before or after world
- onConfiguration -> Loads before registeries freeze
considering I'm using interfaces and not AbstractClass I'm not too worried about improper access to the server or anything. I plan to provide it as a parameter to onEnable and onDisable
I mean this is also very valid
Then of course you need onUnregistry, onServerStop and onWorldUnloaf
kekw
I don't need one for the registry or world unload
server stop is enough
kekw
now I wonder if I should have the startup methods return booleans to see if the setup is successful instead of delegation to some random static method to shutoff the plugin
@ApiStatus.AvailableSince("1.21")
default void onInitialize() {
}
@ApiStatus.AvailableSince("1.21")
default void onServerLoad() {
}
@ApiStatus.AvailableSince("1.21")
default void onWorldLoad() {
}
deleting all the javadocs is so much work lol
import java.util.HashMap;
import java.util.Map;
public class GuiManager implements Listener {
private Map<Player, GUI> guis = new HashMap<Player, GUI>();
public void openInventory(Player P) {
GUI i = guis.get(P);
if (i == null) {
guis.put(P, new GUI());
i = guis.get(P);
}
P.openInventory( i.getInv() );
}
public void loopGuis() {
for (int i = 0; i < guis.size(); i++) {
guis.get(i).???;
}
}
```got to this @drowsy helm, but feels wrong
this is very wrong
private final Map<UUID, GUI> guis = new HashMap<Player, GUI>(); // there is no reason for this to not be final field. Use UUID in hashmaps Player instances expire when players leave
public void openInventory(Player player) { // use descriptive variable names and ensure you follow javas naming conventions
final GUI inventory = guis.computeIfAbsent(player.getUniqueId(), (uuid) -> new GUI()); // collapse into one map operation it looks better
player.openInventory(inventory,getInv());
}
I do wish there were a computeIfAbsent overload that took a Supplier<R> instead of a Function<T, R>
ik
I like being able to do Type::new instead of ignore -> new Type() ๐ฆ
It'd be so nice in that case to just do GUI::new
back to mangling together a plugin loader
I mean it's not uncommon for the value to also reference its key, e.g. you're using it as some cache loading function
public class GUI{
public void onInteract(InventoryInteractEvent event){
}
}
public class Manager implements Listener{
private Map<UUID, GUI> map = new Hashmap<>();
@EventHandler
public void onInteract(InventoryInteractEvent event){
for(GUI gui : map.values()){
gui.onInteract(event);
}
}
}```
basically like that
and watch your naming of variables
and don't use Player in a map
anyone every tried running hibernate on a plugin?
i keep getting this shit despite having jaxb bindings, api and impl
I remember learning that in enterprisy code return types are always optional
But for params it's always nullable
meanwhile kotlin computeIfAbsent(key) { MyValue() }
pretty sure there was also a putIfNull
idk if that's the right way to go for a minecraft API thoguh ๐ค
like part of me wants to but also part of me thinks that'll make the API annoying to use
plugin loader is gonna make me cry ๐ญ
public class GuiManager implements Listener {
private final Map<UUID, GUI> map = new HashMap<UUID, GUI>();
public void openInventory(Player player) {...}
@EventHandler
public void onInteract(InventoryInteractEvent event){
for(GUI gui : map.values()){
gui.onInteract((InventoryClickEvent) event);
gui.onInteract((InventoryDragEvent) event);
}
}
}
public class GUI {
private final Inventory inv;
public void onInteract(final InventoryDragEvent event) {
// logic
}
public void onInteract(final InventoryClickEvent event){
// logic
}
// Rest of code
```would something like this work?
public final class Main extends JavaPlugin {
private GuiManager guiManager;
public GuiManager getGuiManager() {return guiManager;}
private static Main instance;
public static Main getInstance() {
return instance;
}
@Override
public void onEnable() {
instance = this;
guiManager = new GuiManager();
Bukkit.getPluginManager().registerEvents(guiManager, this);
```and should it be done like this on main?
yep except you cant cast the event to InventoryDragEvent
you need a new method for each event
guess I got it then
so:
@EventHandler
public void onInventoryDrag(InventoryDragEvent event){
for(GUI gui : map.values()){
gui.onInventoryDrag(event);
}
}
@EventHandler
public void onInventoryClick(InventoryClickEvent event){
for(GUI gui : map.values()){
gui.onInventoryClick(event);
}
}
yep
ClassLoader classLoader = SRPlayerDataManager.class.getClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
this.sessionFactory = new Configuration()
.configure(new File(this.getDataFolder().getAbsolutePath() + "/" + HIBERNATE_CONFIG_FILE_NAME))
.addAnnotatedClass(PlayerData.class)
.addProperties(getHibernateProperties())
.buildSessionFactory();
this is fucking stupid
if I wanted to make a plugin where a player clicks a consumable item and they receive access to a command, what would be the most efficient & organized way to go about it?
I'm just thinking of a system where clicking the item straightup gives them the permission, but i'm not sure if there's another method that would be easier to manage/that people would normally use for this type of thing
People usually do this with ExecutableItems / DeluxeVouchers already
In short your item has a "voucher id" embedded in it. A voucher consists of an id, item and a list of commands
Maybe a cooldown, who knows
If you want to be really fancy you can have a list of "actions" that may or may not be a command
Maybe it just runs a block of code, who knows
Have you bothered reading what @stark sierra actually said, or even what this Channel is about
If he wanted plugin suggestions, or wanted for a way to do this without code, he would've asked in #help-server.
I.. still provided the steps to do it through code?
Berating me for saying the common method that everyone uses brings the same vibe as berating me for saying "competing against luckperms is gonna be tough" to some kid that wants to make his mainstream permissions plugin
No. Your first three sentences were about other plugins. infact, the other ones werent answers. They were vague.
We're not here to spoonfeed and if that's your expectation maybe you're in the wrong place
From the 4 sentences after this one, you can deduce the following data structure
public class VoucherData {
private final String identifier;
private final Duration cooldownTime;
private final ItemStack displayItem;
private final List<VoucherAction> actions;
}
where VoucherAction basically acts like a Consumer<Player>
You also have the context of "voucher id embedded in the item", which lets you get the voucher data for said item
You literally provided him no help what so ever. The first THREE sentences were about other plugins, NOT developing. You also said:
If you want to be really fancy you can have a list of "actions" that may or may not be a command
Maybe it just runs a block of code, who knows
Which actually has no relevancy to what he said at all.
He's asking, whats the best way to assign a qualifier to a player.
You're looking for Y, he's looking for Y but the solution to his problem is pretty much X (a voucher system)
The vague "action" solution allows him the flexibility to test both an API method for assigning his reward, as well as running a command that does the same
player.addAttachment(CommandAccessPlugin.getPlugin(class), "PERMISSION", true); is sufficient enough
It's also a poor solution
He's not asking for info on creating the item. He's asking for info on managing permissions rewarded as a result of some condition.
He isn't even sure if he wants to add a permission node or follow some other approach
And I'm not even sure if I want to keep going on this stupid unhinged discussion over nothing
k.
has the behavior of a Double changed?
If I go from 0.0, then add with intervals of 0.1, why does it go 0.1, 0.2, then 0.3000000000000000004
Ah I see--
floating point inaccuracies go BRRRRRR
Yeah forgot about that one ๐ one of Minecraft's own issues
IEEE fault. It's an implementation quirk
Not really specific to minecraft
It did cause some goofy ass issues
can anyone explain the diff ?
p.getMetadata("x").clear();
p.removeMetadata("x", myPlugin());
The former retrieves the list of metadata values associated with the key "x" from the player object p and then clears this list. Essentially, it removes all values from the metadata list for that key, but it does not remove the key itself.
The latter, removes the metadata entry associated with the key "x" for the player object p, but only if the metadata was set by the plugin instance provided (myPlugin() in this case).
https://paste.md-5.net/rakizewuxe.cs
Any suggestions for this function?
Ig the context does say that
Also using gui titles for inventory checks?
Not the point of the function though
Just testing a theory and it's working so
wanted to know if it could be improved
Here's some cursed item comparison checks I've recently done
Might be too basic / easy to dupe but that's not the point
pretty sure you can just == on inventories
I aint got it cached (yet)
i don't get why java doesn't have a builtin operator for .equals
is === .equals?
meanwhile I nuked code width by like 60% by using infix at work
yea in kt
gotta love the uh
but talkign about java here
infix my beloved
assignItem(1000) to "crown" item registry at work
haven't found a proper use for it yet
automatically registers items in bedrock
that's a built-in infix tho lol
name it diff
don't wanna register stuff when you're just tryna make a map
The point of this gui was rather admin / testing purposes, just trying to streamline the click operation by avoiding switches on the clicked slots
THen I have an extension method on uh
the backend module
so I can do like
MY_CUSTOM_ITEM.asBukkitItem()
why not delegate on ItemStack
because these items are registered on the uh
common module
because geyser runs on the proxy
and
MY_CUSTOM_ITEM.registerUsage { context ->
...
}
class CustomItem(stack: ItemStack) : ItemStack() by stack my beloved
:)
geyser moment
yeah geyser's ass :(
gotta register every item on proxy startup
otherwise it shits the bed
does EntityType still exist?
I tried to create a Npc at the players location with a command
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (player.hasPermission("createNPC")) {
Location loc = player.getLocation();
Villager npc = (Villager) loc.getWorld().spawnEntity(loc, EntityType.Villager);
npc.setCustomName("Click me for a menu!");
npc.setCustomNameVisible(true);
npc.setAI(false);
npc.setInvulnerable(true);
but Somehow Intellij says "EntityType" does not exist, while "spawnentity" needs a location and an EntityType.
Does somebody know what the problem is?
are you trying to get the nms or the bukkit version
org.bukkit.EntityType
EntityType.VILLAGER
Guys I have no idea why Im getting errors that say "Cannot resolve symbol 'NetheriteScrapHandler'". Its preventing me from continuing my event listener code and im pretty sure everything is fine. This is my main activity file:
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import test.gpstracker.Handlers.NetheriteScrapHandler;
public final class GPSTracker extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
new NetheriteScrapHandler(this);
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}
where is NetheriteScrapHandler from
just restart IDE
should be fine
and Handler isnt a valid package name
its inside my handler folder in the "NetheriteScrapHandler.java" file
i tried a few times, the error still persists
You mean this ?import test.gpstracker.Handlers.NetheriteScrapHandler;
try invalidating caches maybe
i also tried that haha
i see, so maybe the folder should be renamed
oh
perhaps its something in the handler file?
yeah your ide shouldnt let you make a package with that name
it might think Handlers is a class
i renamed it but not much of a change
can you show your project structure
Perhaps something in here? Ignore the last few lines with th eventhandler tag. Thats fine
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import test.gpstracker.GPSTracker;
public class NetheriteScrapHandler implements Listener {
public NetheriteScrapHandler(GPSTracker plugin){
Bukkit.getPluginManager().registerEvents(this, plugin);
}
}
@EventHandler
public void onNetheriteScrapRightClick() {
}```
like the overview
how would I do that? Sorry im new to IJ
ahhhh. thats totally on me haha. I assumed that it would be something outside of that so I ignored it for now. but i guess it was causing everything to mess up
i got it now
Thank you so much! I appreciate the help
How can I set the glow color of GLOWING potion effect, is that even possible at all?
iirc it corresponds to the target entity scoreboard team color, but maybe there is another way to set it
Using teams
how can i reset item lore to not be italic by default
Color.RESET/&r?
turn off italic
no idea how to do that with legacy, not sure if ยงr works
&r does work
It did last time I used it
1.19.4, but I believe legacy color codes are still supported by the client
Yes (for now), but there were changes to how reset works I think
Is that the only way? To create a team and set the color?
yes
Alright then, thank you!
can you make semi-persistent entities? that is persistent across chunk unloads and loads but not persistent across server restarts
Might need to do that manually, so set the entity to persistent also track the entity, on server stop, remove the entity.
why would you even need that xD
wtf happened to the int note in NoteBlock interface i dont get how the Note system works now lmao
need to study music theory for cusotm blocks
like what octave and tone is instrument=chime,note=0
and is it flat or natural or sharp
wtf
do you not know music
I know music, it goes dun-dun-dun-tss-tss-dun-tss
no, i do not
this is the extent of my knowledge
wait im fucking dumb
its constructor takes an int
oh my god I hate hosting repos though sonatype
is there something less annoying to deal with
reposilite selfhosted
that sounds even more high maintenance
Anyone know how i can get block material from the int id in Block update packet?
wiki mentions some registry that i cant find
NMS should have some protocol id <-> block id map thing
๐
If we modify a player's GameProfile instead of modifying their PlayerTextures and do Player#hidePlayer(); and Player#showPlayer();, does the new skin applies?
Or do we have to do it through PlayerTextures?
Afaik PlayerTextures is the only official api
Well, I made version 1.20.5-1.21 of nms requires java 21, but then on the global compilation (that I want to target java 17) I get this error :java C:\Users\paule\Desktop\Spigot\BiomesAPI\src\main\java\me\outspending\biomesapi\nms\NMSHandler.java:68: error: cannot access NMS_v1_20_R4 case "1.20.5", "1.20.6" -> NMS_VERSION = new NMS_v1_20_R4(); ^ bad class file: C:\Users\paule\Desktop\Spigot\BiomesAPI\NMS\1.20_R4\build\libs\1.20_R4-0.0.2-all.jar(/me/outspending/biomesapi/nms/NMS_v1_20_R4.class) class file has wrong version 65.0, should be 61.0 Please remove or make sure it appears in the correct subdirectory of the classpath.
I assume you use this?
yea
I have it all set up but I'm having trouble with my first deploy
it gives me a could not find artifact
do I need to initialize it in the remote before deploying to it or something
how did you publish the artifact
trying to use maven deploy and got the pom setup
show your pom setup
?paste
did you use the right credentials etc
is it?
u
what
oh shit that was it
thanks
how do I tell it to do snapshot instead of releases on maven
i don't use maven ยฏ_(ใ)_/ยฏ
Shouldn't your IDE autocomplete that if you have the XML Schema set correctly? Eclipse does for sure.
<distributionManagement>
<snapshotRepository>
<id>repoid</id>
<name>repoName</name>
<url>repourl</url>
</snapshotRepository>
</distributionManagement>
In conjunction with using the -SNAPSHOT prefix
But I personally don't use snapshot releases, instead preferring rolling nightly releases
what happens if the value is set to null
declaration: package: org.bukkit.metadata, class: FixedMetadataValue
ayo it works http://magmaguy.com:50001/#/releases/com/magmaguy
noice
that was actually easier than I thought tbh
I haven't really used much of docker before, to keep the docker instance alive do I need to stuff it into a screen?
create a compose for it ideally so you can destroy and revive at any time
Nope docker just stays alive
even if you restart
how do I re-access it later?
console
that's on the website
hm true
Docker attach
but docker container attach (name) iirc
aight thanks
its docker exec
cool, time for lunch
well no
because you need to attach to the running process
you have to specify the container name and the shell
magma just wants access to the reposilite console
ye
not what he wants here
also how come this was easier than setting up sonatype
anyone know how to take out liberies from artifacts? my plugin is 50mb and it shouldnt be like that
that's wild
don't shade random shit
What are you shading in
you don't need to shade sqlite if you did that
I mean, if you just want logs, docker logs -f <containerId>
If you remove libraries it wont work
how do i make it stop shading random shit
attach does a lot more, if you don#t need to actually attach, don#t attach
Scope provided
show your pom.xml/build.gradle
no it was the cli for the hosting thing
ah
well you need it for accessing the process
Magma I really recommend portainer
too late
I'm already happy with how it is now
?paste
?whereami too
Why no rad
you need it if you want stdin
thats my pom.xml
it sucks
it works and that's all I need
No it dont ๐ฆ
?paste it here
and unlike sonatype it will hopefully not break every other month or ask me to either move or create new tokens
this just hijacks my prompt
and does nothing
๐คจ
do i need to add provided scope for my mongodb?
[12:49:16 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'bounty' in plugin SpaceCore v1.0
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[purpur-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:168) ~[purpur-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R1.CraftServer.dispatchCommand(CraftServer.java:1001) ~[purpur-1.20.1.jar:git-Purpur-2062]
at org.bukkit.craftbukkit.v1_20_R1.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[purpur-1.20.1.jar:git-Purpur-2062]
at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:265) ~[purpur-1.20.1.jar:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:332) ~[?:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:316) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2447) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$22(ServerGamePacketListenerImpl.java:2407) ~[?:?]
at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[purpur-1.20.1.jar:git-Purpur-2062]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1365) ~[purpur-1.20.1.jar:git-Purpur-2062]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197) ~[purpur-1.20.1.jar:git-Purpur-2062]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1342) ~[purpur-1.20.1.jar:git-Purpur-2062]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1335) ~[purpur-1.20.1.jar:git-Purpur-2062]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1313) ~[purpur-1.20.1.jar:git-Purpur-2062]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1201) ~[purpur-1.20.1.jar:git-Purpur-2062]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:322) ~[purpur-1.20.1.jar:git-Purpur-2062]
at java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "net.milkbowl.vault.economy.Economy.getBalance(org.bukkit.OfflinePlayer)" because "this.economy" is null
at org.spacecore.bounty.BountyCommand.getPlayerBalance(BountyCommand.java:123) ~[SpaceCore-1.0-SNAPSHOT.jar:?]
at org.spacecore.bounty.BountyCommand.onCommand(BountyCommand.java:66) ~[SpaceCore-1.0-SNAPSHOT.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[purpur-api-1.20.1-R0.1-SNAPSHOT.jar:?]
... 23 more
Does any1 know why i get this Error
what is library loader, im on paper
What version
1.20.6
Npe
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Ready the libraries bit
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.getType()" because the return value of "org.bukkit.event.inventory.InventoryClickEvent.getCurrentItem()" is null
if (event.getCurrentItem().getType() == null) return;
Full code
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (!event.getInventory().equals(inventory)) return;
Player player = (Player) event.getWhoClicked();
if (event.getCurrentItem().getType() == null) return;
if (event.getCurrentItem().getType() == Material.GRASS_BLOCK) {
Location location = new Location(player.getWorld(), -59, 115, 55);
player.teleport(location);
}
}
Are armors client-sided?
For example, can a player's inventory show a diamond chestplate but the player itself, show gold chestplate? Even for the player itself
No
read the error carefully, getCurrentItem is null
air
So i can't do it?
You can show it to other players but not to the user itself
i now but how can i make that this error dont show? Its only showing when i clicking the empty slot
if (event.getCurrentItem().getType() == Material.AIR) return;
This will work?
if (event.getCurrentItem().getType() == null) return; ---> if (event.getCurrentItem() == null) return;
Return ifbits null
oh
type wont be null
Then i should change the inventory armor with packets i guess
Im trying to achieve armor skins
its either air or the item itself is null
I mean you can change it with packets and itll show as the changed item in the inventory but the damage calcs will be whats really equipped serverside
Thats what i want to do
Ok thanks
Hello, in my multi-module gradle.kts project, I made version 1.20.5-1.21 of nms requires java 21, but then on the global compilation (that I want to target java 17 because I've got 1.19-1.20.4 too) I get this error :java C:\Users\paule\Desktop\Spigot\BiomesAPI\src\main\java\me\outspending\biomesapi\nms\NMSHandler.java:68: error: cannot access NMS_v1_20_R4 case "1.20.5", "1.20.6" -> NMS_VERSION = new NMS_v1_20_R4(); ^ bad class file: C:\Users\paule\Desktop\Spigot\BiomesAPI\NMS\1.20_R4\build\libs\1.20_R4-0.0.2-all.jar(/me/outspending/biomesapi/nms/NMS_v1_20_R4.class) class file has wrong version 65.0, should be 61.0 Please remove or make sure it appears in the correct subdirectory of the classpath.
How can I fix that ?
Here's my source code :
https://github.com/Paulem79/BiomesAPI
you just need to use java 21, you don't need to target it
you don't need packets for that, there's api
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html#sendEquipmentChange(org.bukkit.entity.LivingEntity,java.util.Map)
cc @small current
that's what I want to do
Oh cool
What about for the player itself
I want to support java 17 for 1.19-1.20.4 servers
Target java 17 (target and source version to 17) but use jdk 21 for compiling
okay, let's try that
yeah my 1.19 version is still made with java 21
you can use that on the same player, but it will show both inventory and model armour changed
I usually have 3 jdks (one for 8, one for 17 and one for 21) I wonder if they are useless (besides 21) when I can always just set the source and target version
Thanks
java 21 doesnt support java 8 as a target
yes it does
looks like it's working..
via the preferred release flag
why would it do that
quick question... do you guys do regular build or do build artifact?
sorry misread, it doesn't support java 7. Looks like java 8 still survives
Isn't java 8 still supported because of lts
Maven or gradle
maven
dont you just build in both cases?
Package
it's working thanks ๐
cus build artifact is giving me the 50mb version
ohhh i see
yeah i tried regular build and now my plugin is reduced to 50 kb
is it shading whole spigot?...
my ass is using gradle for 2 months and already forgot its called package on maven ๐
yessir lol
Lmao
Yeah but mongo isnt shaded now
Your plugin wont work
Unless youโre using library loading
Shade using the maven shade plugin
i have it in plugin.yml library
Ah nice
Started using gradle this week
And omg itโs so much better than maven lol
not local
@shadow night is an idiot
the fact its not xml makes already 3x better
how can I make local database like standalone
You want to host a db server on the plugin?
yeah
I assume a Player during the AsyncPlayerPreLoginEvent would be null?
mc version?
Doesnt essentials just use yml files
oh-
yes
is this how i would unshade some dependencies in gradle? via ShadowJar
dependencies {
exclude(dependency('org.mongodb:mongodb-driver-sync:5.1.2'))
exclude(dependency('org.mongodb:mongodb-driver-core:5.1.2'))
exclude(dependency('org.mongodb:mongodb-driver-legacy:5.1.2'))
exclude(dependency('com.sk89q.worldedit:worldedit-core:7.2.0'))
exclude(dependency('com.sk89q.worldedit:worldedit-bukkit:7.2.0'))
}
}```
i don't get what you mean reeachy, sorry
Use compileOnly
isn't CraftBukkit NMS which was just accessible in 1.8?
In dependencies
oh i was thinking way too complicated lol
compileOnly - won't be shaded
implementation - will be shaded
CraftBukkit is not NMS, it's an implementation of Bukkit
oh wait right
i'm a dumdum
i was thinking of CraftPlayer which is part of NMS, no?
CraftPlayer is craftbukkit
ummm okay maybe i'm stupid
riiiiiiight CraftPlayer#getHandle returns an NMS player. oops
NMS - Minecraft Code (net.minecraft.server package)
Bukkit - An API which is mostly made up of interfaces, which is made available to the user
CraftBukkit - An implementation of Bukkit that uses NMS
yea i was a lil confused lmao
how do i send a respawnpacket to apply a changed skin?
or better asked: how to i apply a changed skin that's shown to everyone on the server?
how can i perform a console command
My favourite thing is the hierarchy
Bukkit
|
CraftBukkit
|
Spigot
|
Paper
|
Tunity
|
Purpur
Iirc
you go to the console and type the command (?)
Or wasn't tunity seperate?
tuinity doesn't exist anymore lol
it was merged into paper, like, 3 or 4 years ago
i mean in code
tf is tunity and purpur. did i miss some chapters?
Where does pandaspigot play into this
ohh you want to send a command via plugin?
Forkforkforks
yes
Is that 1.8?
Bukkit#dispatchCommand i believe
So: Bukkit.dispatchCommand(executor, "command with arguments");
Idk that dude on help server was using it ๐
You should likely never need to dispatch a command
Fuck 1.8
ty
np :))
Pretty sure Purpur has a lot of nice api stuff for custom functionality like blocks and entities n shit
But never looked into it
i mean tbf if there's some sort of event or a command that uses another command you could do it that way, no?
They are basically an utility mod of the server world
what
use maven instead of gradle kekw
You need to run bt with craftbukkit flag
i mean it would be a very specific scenario tbh, but with some time i could think of one lmao
Usually you should never need to dispatch a command
Just use the spigot artifact?
It has bukkit, spigot, craftbukkit and nms
what about an AdminGUI
Like an inventory for just dispatching commands
i use that actually lol
The api has the methods for executing things
That's not true
It does
Wtf wrong reply
Wdym its perfectly okay to dispatch commands
My phones auto correct is super over zealous
from its to italian is crazy
But I'm so bad at typing on my phone I can't turn it off
Then the source is weird but cb has always been reloxated
damn. i turned it off from the beginning and just learned to type
(and since the keyboard still does "suggestions", that's fine)
Does order matter in gradle?
Cause it should be searching mavenLocal() first right?
order does matter
Yeah searches same as maven
โฌ๏ธ
?paste
how do i check if a chunk is inside location x and y
you fork it
so it becomes a fork of pandaspigot of a fork of paper of a fork of spigot of a fork of bukkit
git moment
you can just import it from git into intellij
directly
i never tried modifying a server software but i think u need to do something called patches first
more like pandaspigot a fork of paperspigot a fork of spigot a fork of craftbukkit an implementation of bukkit using nms
as long as the updated class isn't a class u modified
u can just take the modified code
^
git does that
i think
so uh
u basically go on intellij idea
then click get from VSC
alr
when u open lmk
no
^
click on github then login
it cant be on an already existing project
click Close Project
now go on github
oh
it's doing the same for me
jsut click on repo url
now paste it
1 sec lemme get u the link
add that then clone
clone
yeah
you will find a folder called Patches, that's the code right there to avoid the stupid rule by mojang
i have no fucking idea how to do the patches
intellij tells u i think
and y'll have a button or something
but y'll need to repatch, which i think takes like 50 minutes
blame mojang
good stuff
wait how did u bypass patching
eh doesn't take that long
More like 5 min
someone said it took 50 mins to patch paper
just not true
They gotta be running a 20 year old cpu or smth
17 should be enough
21 is where 1.20.5+ lives
then 22
What packet is used to create the per player placeholder?
placeholder?

how can i get a Offline player?
POV: using an rtx 4090 on a 50$ monitor
OfflinePlayer mob =
skullMeta.setOwningPlayer(mob);
Bukkit.getOfflinePlayer()
no i need a specific player
so i can get their skull
Bukkit.getOfflinePlayer("Bob")
is that not deprecated?
everything in bukkit is deprecated, just ignore it
broadcast is literally deprecated
stop lying
In paper
It's just a warning to tell you that it might do a web lookup
in paper
Paper is allergic to strings
not that much deprecated in spigot tbh
for a good reason
please refrain from mentioning the s word ever again
that's because minecraft uses components since 2013
Stringphobic
there r only few reasons to use components
nope
There are many
hover, click events and hex and some other wacky stuff
fonts
too bad i dont use these
Wonder what you will do when your legacy strings get actually removed
yes
bro ๐
since when
since like 1.13
when they added fonts
fonts as in unicodes
yes
just get it from the internet or somethhing
yes resource pack fonts
lazy people
huge skull emoji
i saw alot
get WHAT from the internet
???
unicodes are just characters
lmao
unicode itself isn't a font
แด แดแดแดษด ๊ฐแดษดแด สษชแดแด แดสษช๊ฑ?
yeah let me download \u1234 real quick
Download the rams from the computer
that's... unicodes i guess?
but not the point
bro u jsut said its unicodes ๐ญ
^
https://downloadmoreram.com/ my beloved
fonts can do a lot more than just unicodes
in order for a character to be displayed on a system using a particular font type, it must exist as a character in that style. Otherwise if it doesn't you get them nice fancy squares
you are useleses
what you're seeing there is a font installed on your system used to display that specific unicode character
all a character is in terms of displaying is a picture of said character
with components
no one told me fonts exist
knowing this, you can technically replace characters with whatever your wanted. IE Wingdings is an example
technically you can just do that
Why would you even suggest wingdings
MC has inbuilt enchanting font, that's fun too
give that one to me
i dont have one
how else are we suppose to learn how to speak wingdings
Lmao
we need to spread it more, we are almost at that point where its normal to use pictures
someone give me a font key
I only saw him say "strings are doing pretty well" not that components are useless
n o w
illageralt
fr
noone PRd one
โI hate components and they are dumbโ - MissingReports
fake
He just deleted the message so I cant @ it
I never saw it so I'll have to agree with MissingReport ๐
I mean, most of the time colors and basic strings are enough
so what were we talking abt
But yes fonts and clickable/translatable components can be quite useful
i was doing great without knowing fonts
Im gonna submit a pr to java to delete the string class
and the object class
they both seem useless
If only we could use them in Lore and stuff without having to use NMS to edit the Lore component directly
cough where component PR Choco cough
adventure component?
yes
Component.text("whatever")
im lazy to read
good help right there
WHAT? .text takes a String. Depreciate that shite
Nah itโs @worldly ingot
adventure cancelled
for using strings
Made a pr to make it take component instead
Heโs too busy moving and breaking hypixel in prod
Aah my bad, ty
hate to break it to u string haters, but at the end components become strings
Oh choco got a place?
where
the packets use components
Just take in byte array
no shit
and json text is string
Whos jason
my friend
well actually ๐ค they're nbt
๐ค
where is the font key that someone sent
illageralt I think
The font is the typeface that Minecraft uses. It was first added in Java Edition Classic 0.0.2a and has seen many revisions and additions since.
Its design has been present in all ports of the game.
In Java Edition, the fontโs name is Minecraft Seven. It contains 2,426 characters. Multiple fonts can be defined and referenced with resource packs.
how do u send a component
does anyone know how i can get the a offline players skull?
```case CHICKEN:
OfflinePlayer mob = Bukkit.getOfflinePlayer("MHF_Chicken");
skullMeta.setOwningPlayer(mob);
skullMeta.setDisplayName("Skull of " + entityType.name());
break;```
this is why i hate components
where do u get audience
Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. Iโll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...
Fuck
thanks
Beat me ๐ฆ
its asking for audiences to make an audience
haha
use md5 components then its just Bukkit.spigot().broadcast
bro adventure api is so confusing
Bukkit.spigot() is a thing?
hell naw md5 components are a pain in the ass
kek
Not really
Bukkit.spigot().paper() when
The building isn't super different from adventure
Use my util class that I edited from somewhere.
https://github.com/steve6472/StevesFunnyLibrary/blob/master/src/main/java/steve6472/funnylib/util/JSONMessage.java
there's no array anymore
Noone else look there tho, it is not the prettiest thing
::::0
what the fuck
Eeey, what did I tell you
how do u make a md5 component
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
it says it needs an array
where do i get the skull texture???
then you didn't use them properly
excuses
no way bro reacted with โฌ๏ธ ๐
fonts are just bad, u dont want to admit
to all font lovers, i'm jk
ima dip now
wait
i didnt even do what i came here to do
how do i check if a chunk is inside location x and y
don;t you mean the other way around?
oh two locations
min/max of location chunk coords
Hello, I use io.github.patrick.remapper (latest 1.+ version), it remaps classes, etc., but looks like it doesn't remap fields :log [14:58:15 ERROR]: Error occurred while enabling MoreBiomes v1.0 (Is it up to date?) java.lang.NoSuchFieldError: BIOME at me.outspending.biomesapi.nms.NMS_v1_19_R3.unlockRegistry(NMS_v1_19_R3.java:100) ~[MoreBiomes-gradle-1.0.jar:?]
When using (mojmaps) Registries.BIOME but on spigot runtime, it's Registries.an
How can I fix that ?
Here's my 1.19.4 module gradle.kts :```kts
plugins {
id("io.github.patrick.remapper") version "1.+"
}
dependencies {
compileOnly("org.spigotmc:spigot:1.19.4-R0.1-SNAPSHOT:remapped-mojang")
compileOnly(project(":NMS:Wrapper"))
}
tasks.remap {
version.set("1.19.4")
}
tasks.build {
dependsOn(tasks.remap)
}
java {
toolchain {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}```
use gooler's remapper or whatever it was called
or wait wasn't that shadow
nvm
too many gradle plugins on my mind
I already use gooler's shadow
but well, sounds like a skill issue to me
bruh
Here's my main build.gradle.kts :
@shadow night
okay wtf
this api is made with the ass, clearly
the core is using nms, so my project depending of this api need to use nms too
(to access classes like ResourceLocation)
but then it remaps the api to the version specified by the project using it, so I can only run at version 1.19.4 because of this fucking core
wtf this creator has done
nah that's wild
I just, can't work with that
i swear to god, i will forget how this works in couple days:
for input_file_path in $input_file_paths; do
output_file_path="$(echo "$input_file_path" | sed "s/$(escape_forward_slash $input_path)/$(escape_forward_slash $output_path)/")"
verbose_execute echo "Attempting to interpolate given variables in input file path: $input_file_path"
verbose_execute echo "Copying input file path ($input_file_path) contents into temporary file path: $temp_file_path"
cp "$input_file_path" "$temp_file_path"
input_file_interpolation_variables=$(echo $interpolation_variables $(sed -n "s/.*\${\(.*\)\:=\(.*\)\?}.*/\1=\2/gp" "$temp_file_path"))
input_file_interpolated=false
for interpolation_variable in $input_file_interpolation_variables; do
key=$(escape_forward_slash "${interpolation_variable%%=*}")
value=$(escape_forward_slash "$(echo "$interpolation_variable" | sed -n 's/[^=]\+=\?//p')")
echo "$key=$value"
latter_interpolation="$(verbose_execute sed -n "s/.*\(\${$key\(:=.*\)\?}\).*/\1/p" "$temp_file_path")"
if [ -n "$latter_interpolation" ]; then
echo "Interpolating $latter_interpolation variable in input file path: $input_file_path"
input_file_interpolated=true
fi
sed -i "s/\${$key\(:=.*\)\?}/$value/g" "$temp_file_path"
done
if $output_interpolated_only && ! $input_file_interpolated; then continue; fi
verbose_execute echo "Copying processed input file contents into output file path: $output_file_path"
mkdir -p "$(dirname "$output_file_path")"
if $force_override_output; then
cp "$temp_file_path" "$output_file_path"
else
cp -i "$temp_file_path" "$output_file_path" < /dev/tty
fi
done
what the fuck
Ask ChatGPT to create documentation for you, someone would tell
i have seen
how i get color map by Block instance? I need to change the colors according to the height too to identify mountains
@Deprecated(forRemoval = true)
private PluginData readPluginData(@NotNull final InputStream stream) throws IOException {
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
final List<String> data = reader.lines().toList();
final Class<? extends Plugin> pluginClass = (Class<? extends Plugin>) Class.forName(data.getFirst());
final String name = data.get(1);
final String version = data.get(2);
final PluginApiVersion apiVersion = PluginApiVersion.fromString(data.get(3));
return new PluginData(pluginClass, name, version, apiVersion);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}```
Wow the best plugin data file implementation???
wtf.
I don't want to add a config library yet, but I need some mock data to load plugins from
this will do until I add a config library
why is everything final ๐
because its not reassigned
there is no reason for it not to be final
ahgahioskajiusja
bro is mad my compile time is 20 nanoseconds faster than his
final should be the default but java is full of terrible defaults
ok rust
No because that's how we end up with keywords like non-sealed :(
rust ๐
Why is only "listener" being printed in the console? https://pastebin.com/WLibRtab
i love non-sealed (it caused me severe pain in my lexer)
Hell, unsealed would have been better. Who tf puts hyphens in a keyword
Even C++ doesn't do that
is that a legitimate java keyword?
Yes
public sealed interface A permits B {}
public non-sealed interface B extends A {}
a type extending a sealed type must be either sealed, final, or non-sealed
I only use Java 8 language features, for good reasons as it seems like
sealed types are actually goated af
You're very useful


Sealed types generally aren't the way I'd design my API around
They can be useful in cases like spigot, but in the case of spigot you can't do that because the implementation is in another artifact
It would be useful for recipes
instead of union JsonElement = JsonObject | JsonArray | JsonPrimitive | JsonNull you have sealed JsonElement permits JsonObject, JsonArray, ...
Though fwiw, yes, Bukkit would have a difficult time making use of sealed types
Read-only types are a great use case though
i don't really see it about disallowing people from extending a type, but rather, you have a hierarchy of data types that just go together
Yeah. Like an enum where there can only be so many exhaustive options
kotlin val:
lombok val
real
get it?
lombok is bad yes i get it
uh how do I update the gradle version that IJ is running
ah found it
might be time for me to remove the cobwebs from my build.gradle as well
@Override
public void render(MapView mapView, MapCanvas mapCanvas, Player player) {
WorldMap worldMap = new WorldMap("map_" + mapView.getId());
if (!a) {
for (int x = 0; x < 128; ++x) {
for (int y = 0; y < 128; ++y) {
mapCanvas.setPixel(x, y, worldMap.colors[y * 128 + x]);
System.out.println("x: " + x + "; z: " + y + "; " + mapCanvas.getPixel(x, y));
}
}
a = true;
}
}
why the color returned is 0?
./gradlew wrapper --gradle-version latest and configure intellij (settings, build tools, gradle) to use the wrapper :3
yeah sure would be nice if the intellij console worked
skill issue
hi! how to access to nms? I mean, adding Spigot Server (not only API) to dependencies in order to use nms
?nms
^ if you're using maven
thanks
Someone know why I can't compile in inteleji? (I can't click I see "the file in the editor is not runable")
youre about to run a file then
what file meaned?
wtf is non sealed anyways
just the same as default but silly
?
on my old projects I can but on the new ones impossible
required as sealed is inherited I'd believe
yeah but whyyy
^
making non-sealed the default when extending a sealed type sounds like a terrible disastrous default
Security/Integrity by default
what if you just forgot to make it sealed or final lmao
ig
just dont make anything sealed and call it their fault when someone breaks it
Sealed seal
Seals
Seagulls
It doesn't have much to do with it, but I have a question, remember how to load the dependencies to be able to use different versions if necessary, the logic is created, but I can't recover them, I'm using gradle
These are, from 1.7 to 1.13, everything works 100% but it doesn't solve this, I don't remember if I had to configure a gradle for each one, but I remembered it differently, but it doesn't work, if anyone here is good with that, please give me a hand
It's recommended to use multiple modules for different versions
That way you can keep the dependencies separated
Yes, I can't solve them because you already use 1.13, native, would you have to configure a gradle for each version below them?
Does anyone know how to create a ScoreboardTeam using packets for 1.20.6, I have this code for 1.20.2 but it doesn't seem to work for 1.20.6. https://pastebin.com/ZmUkPSLk
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
1.7 what the actual fuck
Yes, I want to run an old modality, with support for it
But it's not even the important thing, I don't know why I can't recover them by importing the jars, that's why my doubt โ๏ธ
also just a little fun fact only the largest patches were fixed for log4j back to 1.8
it does
1.6.4 seems to be missing log4j though
idk up to what version mojang backported the nolookup addition
so did they just skip 1.7?
i know they did for 1.12
Any hcf devs dm me
Hello, I was wondering if it is allowed to trim one of my premium plugins or disable some features and offer it as its free version?
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
It says I gotta make 20 post I need a dev urgently
what even is hcf
Hard core factions
Contact someone offering services
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':compileJava'.error: invalid source release: 21
thoughts
I'm thinking this caused it
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
are you sure you are using jdk 21
yeah
Make sure gradle is up to date
and that jdk 21 is set in intellij project settings
I just did, hang on I think one of my shaded systems is on a later version and that's why
seems like it right
wait tf
oh no intellij is really losing it
hey. I uploaded my very own plugin in spigot website but i made little mistake while uploading and now i cant find edit option anywhere to fix those mistakes
enable 2fa
oh my god
ohh yes
why does intellij need 15 different places to define the version I am compiling with
me dumb
so you didn't set it to 21 in project settings?
I did
java toolchains :3
where did you change it then?
gradle's wrapper was set to 17 in a place I didn't even know existed
it is insofar that imo there should be a centralized place to set the version you want to compile with
there is
toolchains
it's called java toolchain and release flag
idk why people keep using source/target
i did enable 2fa but it still did not open to edit post
or
Hey folks
When I send a REMOVE_PLAYER packet, go away from the removed player and come back to that player again, the player becomes invisible
https://www.spigotmc.org/threads/issue-hide-player-in-playerlist-only.452865/#post-3885144 I saw this post and I tried to use that solution, but since NAMED_ENTITY_SPAWN is deprecated I tried to do it with ClientboundAddEntityPacket packet
But when I did a sysout to all packets sent and received from a client's side, I never saw ClientboundAddEntityPacket in logs
So what packet should I use?
On the forums
I love when people delete their messages
java.lang.IllegalArgumentException: Unsupported class file major version 65
give me a break
xd
this time it's internal to the same project
imagine using outdated shadow
you need to use goolers shadow fork
brah
The old shadow isn't maintained anymore
:3
ah yeah cool I always did think we needed more sonic