public class MyMenu extends ConfiguredMenu {
private static final String CLOSE_BUTTON_KEY = "c";
public MyMenu(Player viewer) {
super(viewer);
}
@Override
public String getIdentifier() {
return "my-fancy-menu";
}
@Override
public void setup() {
registerButton(CLOSE_BUTTON_KEY, this::close);
}
}
#help-development
1 messages · Page 1264 of 1
Was expecting kotlin- damn
unfortunately not
I tried both HIGHEST and LOWEST because one thread I found suggested LOWEST was run first, but neither affected it unfortunately
my-fancy-menu.yml
title: "Whatever"
mask:
- "# # # # # # # # #"
- "# . . . . . . . #"
- "# # # # c # # # #"
items:
"#":
type: BLACK_STAINED_GLASS_PANE
name: " "
c:
type: NETHER_STAR
name: "<red>whatever"
I don't actively use kt unless I'm doing backend dev or I need it for a proj
I'm hoping to maintain some API compat when I'm done w this rework because it'd really suck to port a million menus
How does it represent all the item component options
ofc my example sucks ass bc I cba writing something fully
Prob I think u’d have to send it before the respawn no?
Or does it just not support those because 3 years old
it like
has a class for each "field"
where it passes whatever object you want and it applies em to the item
anyone tried converting adventure text components to SNBT? Mainly for setting sign text in 1.21.5
Do you have all the options documented somewhere :p
So you can just
public class FoodItemStackCodec implements ItemStackCodec<ConfigurationSection> {
@Override
public ItemStack load(ItemStack current, ConfigurationSection value) {
// do stuff w it
}
}
I know DFU does a fine job w it
what event do you use this for?
most ppl only care about lore / name / model-data
Let’s say I want to add, idk, no tooltip to an item, what would I add to the config
I have a huge list
I just need to use event.setRespawnLocation tho lol
dfu?
Looks good, I personally do it like this in Lotus
https://github.com/Mqzn/Lotus/blob/master/src/main/java/io/github/mqzen/menus/base/serialization/impl/SerializedMenuYaml.java
and ppl can ask for more
Fair
Oh u didnt set that💀
Problem w that is if you want custom fields for whatever menu you're kinda fucked
what is DFU?
it strictly "loads" the menu but doesn't reference it
not really, DataRegistry is expandable
Yes, Minecraft’s graph library that maps different data versions of data types
DataFixerUpper
Again, it's built for them to be kinda done in API and everything else is an afterthought
it automatically upgrades older data formats and transforms them
But yeah I also keep my essence when it comes to slot selections and whatever
yes but talking from an adventure text to snbt because I'm looking to update from pre 1.21.5 to 1.21.5 which requires snbt
(It just wraps a list of slots)
Or as I sometimes like to call it DataFuckerUpper
I don't think the DFU will update that when it's setting it in my code
And because it's ordered you can have selections that apply it in weird patterns
like as a snake or spiral
Neon, my suspicion, is that paper might have api that invokes the DFU
or if there is some sort of serializer maybe
idk
So for pagination it just follows whatever order the selection implies
A bit goofier
what I'm kinda working rn is a weird abstract-deabstract-abstract thing for menu + slot events
seems this may be the incorrect discord to ask
because I want to be able to tie events to either slots or the menu as a whole
@young knoll dou know if there is anything on the spigot side?
except I need to transform them down and then back up so everything's neat
Spigot doesn’t natively support adventure so… probably not
?service
Adventure might have something built in? No idea
Na its fine, but I did think u were after a paper exclusive solution so my bad
nah, that's what the paper discord is for?
ye
Haha yea I suppose
Still need to figure out what my SlotRestrictions class will do
I want to have some sort of SlotRestrictions.restrictAll()
SlotRestrictions.accepts(item -> true)
but what does that boil down to 🤔 a list of event handlers?
And then tie these to either a slot or the entire menu
I tend to always parse my components from a config in minimessage format so I don’t really have to worry about updating them
Oh yea
i need to figure out how to make yaml files readable
more manual encoding and less ConfigurationSerializable I assume
Like with comments
well setting sign text from a component requires SNBT format now
and more syntax error handling
didn't snbt change
yes, but the signs use to be able to use JSON format, then it switched to SNBT
So i have decided that im gonna do the next update on saturday @ivory sleet
Just wondering if you had any other interesting ideas to be considered ?
and I want to avoid Map<String, Object>
Yea, it might be the case bungee chat may support it, or if adventure bukkit platform has something
unsure
Idk, I’m not a good idea brainstormer 😅
Unfortunately the Bukkit platform is pretty limited
Ehh that's fine
you gotta go bonkers but goes a bit like
MetadataKey<T> (String name, Type<T>)
MetadataHolder<T> (Key<T>, T, Type<T>)
MetadataContainer (Map<MetadataKey<T>, MetadataHolder<T>>)
MetadataType<T>
MetadataCodec<T>
MetadataRenderer<T>
You need a bit of NMS to use components for items, signs, inventory names, etc
Btw it doesn’t allow me to make a post it says I need to do 20 posts first or sumn
Na but honestly we love a rich type system
it's a headache to run
but by having a holder class you can have nullability
separating codecs lets you reuse them across diff types
?whereami
but then you go crazy
Just contact some devs that are offering, there are tons of them
and it starts looking like mojang code
Genetics lmao
10% -> 0.1f
guy wanted it because we use floats for percent-based attributes
like 10% chance of blocking an attack
Isn’t that what the renderer is for
Renderer spits it out
Parser loads it from the config/command
guy cba doing 0.001 on a 1000 line config
and it's a lot neater to just /armory attribute block_chance set 10%
I also wrote a really neat trigger system that looks a lot like an event system
but it's kinda reactive?
yeah you can just "10%" on mine
go brr
ah shit I gotta make some stuff immutable
just to call it enterprisy
like this
Nah if you really want to call it enterprisy then the list needs a custom default size
like 4
but it needs to be a constant because it needs a name
class needs to be final, private constructor- package-private factory method
Mmm yes perfect
the list becomes immutable and we return a copy every time we add sumn to it
we switch from a list to an array because muh objects
and add this. everywhere
I just cba
because then I'd need to do it for the rest of the codebase
and rn we're at like 35k lines
which is pretty tiny in the grand scope of things
also full unit-test coverage and javadoc everywhere
oh so that fixed it?
cool
what are you even making dude
code
"code"
no seriously im curious
rpg
cool
I don't do this and I never will
add final to params
explicit immutability sucks
ImmutableList 🤮
kotlin List 👍
but optimization😍
how is explicit immutability optimization lmao
i heard that c++ compiles differently if something is final
This is in fact true
however, it should be treated as a design choice and not an optimization. When a virtual function is not declared as final, the compiler must generate code for dynamic dispatch such as virtual function table. But if instead it is declared final, the compiler knows it can't be overridden in any derived class thus the compiler can devirtualize and replace indirect functional call with a direct call. If the class is declared final, all the members are implicitly final. The final keyword on a class can allow the compiler to do more aggressive inlining and optimizations since the layout is pretty much known at that point.
i only use this. if im setting a field value
t b h
im only using this. in the constructor 😎
if something is not from this class, it will have a prefix anyways
it's from weaponmechanics
Anyone know of a quick and easy way to get the interaction point of a BlockPlaceEvent (like from the PlayerInteractEvent) or will I have to manually raycast it
you want to get the block from the interaction event?
No, I'm trying to get whether the click was on the top or bottom half when placing a block
PlayerInteract provides click position but block place doesnt
pretty sure the interact event fires after the block event
so couldn't you just use some field to detect you want the position from that event? probably could just make your own event for this
yeah seems sorta hacky though
ig its either that or raycast calcs. I'll figure it out thanks
public static Vector getBlockFaceLookedAt(Player player, double maxDistance){
CraftPlayer cp = (CraftPlayer) player;
ServerPlayer serverPlayer = cp.getHandle();
Location origin = player.getLocation();
Predicate<? super Entity> predicate = entity -> entity != player && player.canSee(entity) && !serverPlayer.isSpectator() && serverPlayer.isPickable();
RayTraceResult hitResult = serverPlayer.level().getWorld().rayTrace(origin, origin.getDirection(), maxDistance, FluidCollisionMode.NEVER, true, 0.1, predicate);
Block block = hitResult.getHitBlock();
if(block == null)
return null;
return hitResult.getHitPosition().subtract(block.getLocation().toVector());
}
Had to adapt this, thank god for moj mappings
feels like this should be part of api
could always make a pr
https://github.com/winnpixie/log4noshell/blob/adc5943fcb6155a7f170c77379cb73024aa6b9fa/src/main/java/io/github/winnpixie/log4noshell/JndiLookupTransformer.java#L22 yeah so this was fucking broken lol @mortal vortex
What plugin
u should probably look for versions of whatever plugins ur using that support bungee, and then use said plugin on Bungee server instead of per-spigot-server
Oh sorry
there is a link but I can;t remember
You can help me
You are in the wrong channel. #help-server
Oh sorry
Aternos only allows plugins from their specific plugin manager afaik
So if it isn’t on there you can’t add it
Jishuna is a staff member for Aternos. Direct all your questions to his DMs inbox
That thing I know
I want to add Mace for lowest version of Minecraft
Dude. This isn’t the right channel.
Kk
Guilds
The plugin is a plugin that I coded, so what should I do for a solution?
You writing a compiler or are you calling ASM from Java?
Ahh, you calling ASM. Why not use the native keyword and link a C file with inline asm or just pure compiled asm code
ASM (in this context) refers to a library for working with Java bytecode :P
what this? Could not find com.mojang:brigadier:1.3.10.
when i try load nms from core
full error - https://paste.md-5.net/lemericugu.rb
server jar i use from lib derictory
1.21.3
You need the mavenLocal() repo and run buildtools
hmm for 1.12 this was worked
lol this work after adding maven {
url = 'https://libraries.minecraft.net/'
}
but not will work in runtime right?
(i was just load paper server core:)
and added to lib
but anyway paper is fork spigot so this will work i gess?
wdym hard fork?
They're doing their own thing now, Spigot and Paper might split code wise so compat isn't guaranteed
i think they support spigot plugins like 99 %
i never see spigot plugins what crashed bc they in paper, purpur core
but yes this not garanteed 100 %
There are slight behaviour differences
Take the hide attributes item flag for example
That people in here keep having issues with
On Spigot just adding the flag will stop it from showing
but on Paper it won't unless you manually add an attribute
Small differences like this is why you really should ask Paper when using Paper
you've obviously had experience. Can you guess how many percent incompatible?
50%?
60?
what do you mean when say "manually adding" ? You should anyway adding flags manually
to meta
Hi im new to making servers, im atm using minefort host and atm I have it using purpur,
How can I add spigot plugins/mod to my server?
Just a note I'm mobile I don't really got a pc yet
- Purpur is not spigot, go somewhere else
- Wrong chat, this is a #help-server question
Anyways, either use their plugin manager or put plugins into the plugins folder.
Oh okey ty for letting me know
on my server every 5 minutes did you know that five minutes have passed? message is sent and when damage is taken,
ouch you took damage is sent to the damage taker
Do not crosspost, are you asking for development help ?
If not, stay in the other channel.
I have started to study the differences between gradle and Maven and found such a thing as “fileTree” analog of which in maven is not as I understand it
and as I realized I have to manually create repositories for Jar files with commands
how do you compare Timestamps?
Timestamp == Timestamp does not work for some reason
.equals ?
And the reason is because they are probably not the same object
.compareTo
Instant.java 🙏
ohhh I see
or yeah equals works i think
java moment
character(s)
lazy
String a = reportCharacters > 1 ? "Characters" : "Character"
lol
lol
yo if I’m tryna find a dev where do I go
?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/
hey guys, do any of you know any good method to have textured player heads that work from 1.8 to 1.21 ?
I tried with reflection but could only manage to support from 1.8 to 1.20. I really don't get how I could support 1.21
ai
I tried but no, because since 1.20.5 if I remember well it requires some new methods
that's really strange ...
I will send my method in a few
It's dirty now since I tried many things but still :
public static ItemStack getCustomHead(String url) {
ItemStack head = new ItemStack(Materials.PLAYER_HEAD.get(), 1, (short) 3);
SkullMeta meta = (SkullMeta) head.getItemMeta();
if (url == null || url.isEmpty() || meta == null) return head;
try {
Class<?> playerProfileClass = Class.forName("org.bukkit.profile.PlayerProfile");
Method createProfile = Bukkit.class.getMethod("createProfile", UUID.class, String.class);
Method setPlayerProfile = meta.getClass().getMethod("setPlayerProfile", playerProfileClass);
Method setProperty = playerProfileClass.getMethod("setProperty", Class.forName("org.bukkit.profile.PlayerProfile$Property"));
Object profile = createProfile.invoke(null, UUID.randomUUID(), "CustomHead");
Class<?> propertyClass = Class.forName("org.bukkit.profile.PlayerProfile$Property");
Constructor<?> propertyConstructor = propertyClass.getConstructor(String.class, String.class);
String textureValue = Base64.getEncoder().encodeToString(("{\"textures\":{\"SKIN\":{\"url\":\"" + url + "\"}}}").getBytes());
Object property = propertyConstructor.newInstance("textures", textureValue);
setProperty.invoke(profile, property);
setPlayerProfile.invoke(meta, profile);
}
Im pretty sure I forgot something
catch (ClassNotFoundException e) {
// Fallback for 1.13–1.20 using GameProfile
UUID uuid = UUID.nameUUIDFromBytes(url.getBytes());
GameProfile profile = new GameProfile(uuid, null);
profile.getProperties().put("textures", new Property("textures",
Base64.getEncoder().encodeToString(("{\"textures\":{\"SKIN\":{\"url\":\"" + url + "\"}}}").getBytes())));
try {
Method setProfile = meta.getClass().getDeclaredMethod("setProfile", GameProfile.class);
setProfile.setAccessible(true);
setProfile.invoke(meta, profile);
} catch (Exception ignore) {
try {
Field profileField = meta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(meta, profile);
} catch (Exception ignoredAgain) {}
}
} catch (Exception e) {
e.printStackTrace();
}
head.setItemMeta(meta);
return head;
}
Part2
Well the problem is that I am using 1.13 API to make my plugin compatible from 1.8 to 1.21
Using 1.21 API It worked but I can't use it
private ItemStack createCustomHead(String textureUrl) {
ItemStack head = new ItemStack(Material.PLAYER_HEAD);
SkullMeta meta = (SkullMeta) head.getItemMeta();
if (meta == null) return head;
PlayerProfile profile = Bukkit.createPlayerProfile(UUID.randomUUID());
PlayerTextures textures = profile.getTextures();
try {
URL url = new URL(textureUrl);
textures.setSkin(url);
} catch (MalformedURLException e) {
e.printStackTrace();
return head;
}
profile.setTextures(textures);
meta.setOwnerProfile(profile);
head.setItemMeta(meta);
return head;
}
I'm not really familiar with player textures sadly
Alright so it’s something in your reflection
Personally I would just use a module system
personally i'd drop 1.8 support
Alright thanks I will lookinto that
Yh I though about it cuz it's a real pain, but for minigames plugin it's helpfull to support 1.8 since many servers are still running their networks on that old version
Basically you just load code based on what version the server is
Usually gonna be faster than a lot of reflection as well
I get it, thank you so much !
coach em up
thanks for sharing this im going to try it
guys im trying to develop multi-versioned gui example
i followed ?gui instruction clearly
and its work for latest spigot versions
but i want to support 1.17-1.21.5
i have this structure but dunno which class i should load into core
people sure do love making more work for themselves
example project yml :
name: MenuPlugin
main: me.erano.com.Plugin
author: Erano
description: Menu Plugin
version: 1.0
api-version: 1.21
commands:
menu:
description: open menu
usage: /menu
core project yml that supports 1.17-1.21
when i remove api-version it wont work for 1.21.3-1.21.1
the project uses 1.21.5 spigot dependency
it was work in 1.21.3 when api-version: 1.21 setted in yml
better off just supporting 1.20.4 and above, not sure why you insist on supporting versions older then that
i want to support them
you want to support them for no reason? o.O
its ok 1.20.4-1.21.5
but again i also need multi-project structure
just want to know how to abstract these spigot classes
and which class should i load
into core
what is the best way i mean
if you looke at the versions, the amount of people using versions below 1.20.4 significantly drops
if even nobody uses 1.17 i will support them just want to learn things
ideally you would detect the version of the server running and use the class version accordingly
you can either use reflection, you can use static enum or something else
i will use reflection
ok, then its pretty straight forward then
i have samples to track
not sure what help you are wanting now 🙂
And you will learn outdated information (speaking of API)
Good job
i mean am i should load every class that i use for each version
it never hurts, I have a lot of outdated information remembered
how else you going to load the class you need?
arent there are common interfaces, classes
not sure what you are asking
you compile all the classes into the project, select the class you need based on the version of server running
I guess i have to load first of all these: ItemStack, InventoryEvents, Player
for each version
right
because i use them in my implementation
no, you don't need to load anything until you need it
however if you have objects that are required for all the other classes you could use a single class for those
so that you are not having to load them all the time
for example
what about muh drag event
I generally use an enum to load classes though
or to load the appropriate ones anyways
I find it a bit more cleaner then using reflection
do you have example on github may i observe
you could just google for examples of loading objects using enums
ok thank you will research
the more i do coding the more i realize coding to an interface is a bad practice
you should code to class unless you have to have two or more implementations of the same thing
am I wrong in saying that?
its easier to refactor than try to guess the future
unless you're making some kind of API for a library i dont see the need of interfaces for things which are implemented once
entirely depends on what goals you have
or well, requirements per say
The reason you interface in non libraries is usually tests. Otherwise you'll be spawning up your entire softwares dependency layout for every unit test semi quickly
If you don't write tests, it's w/e
you are discovering what i like to call the "taking any paradigm or principle no matter how sensible to its most absurd clown-car conclusion is a bad idea" principle
yes, interfaces are useful and flexible and it's generally a good idea to use them (mindfully)
but there's always a "too far"
I mean yeah, if you go out of the way to code in a not oo-way, interfaces like quite powerful, for one with lambdas and method references, but then also like if you wna statically define some union type w sealed
IInterfaceable, IInterfaced, IInterfacingInterface
🎶
You have to know how and when to balance inheritance vs composition
120%
Is that your balance?
we are not coding to interface for every scenario
it depends
did you read GoF design pattern book
you will realize there are many relationships between classes for different scenarios
oop is not only about blindly abstracting classes
not my fault your classes are dirty
take a shower 😷
"and bukkit does it" is not a valid reason to do something the same way 
some people thinks oop that way.
people who dont know how oop works is oop hater mostly.
they think rewrite things x500 and writing 3million line of code is not problem for them
this could be no problem for you but for enterprises it will be loss of billion dollars.
does anyone know what would be a really efficient way of copying/pasting/modifying blocks in really high rates without destroying a server?
right now I'm using workload distribution to spread out the tasks
but I'm using world edit's api
depending on worldedit and leaving it up to the server admin whether to use base worldedit or fawe
this is both the safest and the fastest solution, though which one it is depends on the admin
you can also try to do nms block placement nonsense yourself, but this will probably never be as fast or as stable as fawe, even if it isn't particularly stable to begin with
so many abbreviations
fawe as in fast async world edit
being a substitute for worldedit that is considerably faster and doesn't require you to do workload distribution yourself
but having a somewhat undeserved reputation of running into errors
personally over the course of many years i've only seen it mess things up only once, sometime in 1.8
exactly what I need. I place thousands of blocks and lava every other minute on some really loaded servers
okay. so moving my block placement methods and potentially change dependency to fast async world edit?
afaik you can just build against and use the regular worldedit api
and if the server admin chooses to use fawe on their server instead of worldedit, it will take over the api and do what you want it to do
so smaller servers can continue to use the slower but stabler worldedit, but larger servers have the option of switching to fawe if they need it
so shade in fawe you mean? and keep world edit provided
no, fawe takes over the api at runtime, you don't need to do any changes in your project i don't think
i never did this before so sorry if I seem lost
just put a note about it in your plugin description or something so admins are aware of the option
"if the plugin lags your server to shit, try installing fawe instead of worldedit"
I see
one last question..
what do you mean by build against?
you said you're using the worldedit api, yes
yes. I've been using the api so far
that means you're building against the worldedit api
ahhhh
as in, the worldedit api classes are what the compiler compiles your classes against
okay..
you are also presumably building against the bukkit api
Kyori adventure got merged with paper recently, still a funny gif tho
oh I just started using adventure for my first project
only for minimessages tho
so far
I still use spigot and just shade all of adventure for minimessage kek
I don't think so anymore
paper includes adventure now
so no you don't need to shade it or even include it as a dependency, as it is a transitive dependency of paper-api and will be included in both the compile classpath and server runtime regardless
If you are using paper that is
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.21.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
Hello, is there plugins like SWM or ASWM (just plugin I mean, not whole server forks like Advanced Slime Paper) that supports slime world generation format with ZSTD compression & loading from DB/File/any custom loader that is available right now? just a simple plugin, not a whole paper fork or anything bigger, just as simple as grinderwolf's SWM
yeah that's no paper, you'll still need to shade in adventure
wait so what's this???
<groupId>co.aikar</groupId>
<artifactId>acf-paper</artifactId>
<version>0.5.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
aikar's advanced command framework or something
not paper itself
prooobably shouldn't be using that on spigot since it maybe targets the paper runtime specifically
ahhh I was so confused for so long
bump
well.. I'll be removing it once I finish merging this version
i never liked acf anyway
cloud 
is 1.21.5 is R4 ?
i guess it is
wiki is not up to date
i thought 1.21.4 and 1.21.5 share same interface
minor versions now come with nms changes, so the craftbukkit package is relocated accordingly
.5 was a relatively major update despite being a "minor" version change
i created different projects for different interfaces anyway. i seperate R3 and R4 for 1.21
since which version
can you send multiple resource packs to the player
(in packets ofc)
Returning to plugin development from 5-6 years ago. Is paper the new standard? It seems so but not sure on the market share
Could just dev for both
I saw that paper hard forked, so I’ve been using their documentation and handling things the way they seem to (Brigadier commands, Components, etc.). I know spigot’s way works for now but from my understanding they are deprecated and moving away from that. Maybe I’m misunderstanding that
keep in mind, if you want to upload to spigot's platform it must work with base spigot
they are not standard they have good marketing pr
but some people calls it as propaganda
Also ngl, there's no guarantee they won't break something you're using lol
plugin of mine works flawlessly on spigot, but immediately breaks because of dumb shit the paper devs have done kek
yeah they also limited for some in-game features @sacred knot . Spigot is still goat
paper team secretly employs a large set of social media experts to sway the public opinion /s
you see there are these things called issue trackers
could like, report it
like 80% on modern versions
a number of high-profile plugins have dropped spigot support altogether
Not worth the effort
sigh
it's just so pointless to not submit issues and then complain about those issues not being fixed
its not like the issue is caused by obf or anything
see I'm not crazy
Well at least now it is fine xD
Previously I would have indeed argued that kind of incompatibility should have been reported but given hardfork has happend, yea, not much point in opening issues
^ Given I don't support such breaking, it's easier for me to just drop paper compat & just go about it as I have.
If it works, it works. If it doesn't, oh well
what happened to ur antimalware paper fork
I ain't touching that when there's a likely hood something will break next version kek
I do still have the code though
Not sure what version that's on 🤔
looks like somebody thinks that paper will just oh, I may just like, delete this API and this feature, like no
if I get helix modules loading properly (for the 900th time) will you implement AM as a module? 🥺 👉👈
they did
1.21.5
?
some biome stuff

my only two gripes with paper are that they push for adventure over legacy strings way too hard, and that everything in the new api is marked experimental and my entire codebase has turned yellow from the warnings
biome isnt an enum anymore
have you considered that mojang made biomes data driven
at least keep the class and accessor from keys
oh yeah let me give you an enum value that doesnt exist anymore hold on
or do what spigot did once and translate old usage
¯_(ツ)_/¯
but no, Biome can return custom biomes
tested it
Also, given I'm rewriting the scanner itself to be remote it's better to wait until that's finished so I can just copy-pasta the send, receive, and handler classes & code 😎
Yeah, fair I read it wrong, still #getByKey doesn't exist on paper anymore
weeeelll you can asm a data driven enum together, provided all the driving happens before other classes access it
which is... why?
getByKey also doesn't exist on spigot either
but it doesn't really make any sense building against such an enum
it does
✨ registry ✨
I'm using it
I am looking at the src
what getByKey are you talking about
Biome.getBiome exists
sounds like ike is 


Biome.valueOf exists

Yea
that is a spigot method added post hardfork
we didn't remove it
we never had it
in fact i would quite like for biome to have become such a "dynamic enum" so we could continue to get the performance benefits of EnumSet/Map at runtime, but it wouldn't really support reloading datapacks or registries
Well it is part of spigots weird "maybe in registry" stuff
you're not thinking with portals
RegistryAware yea
well yeah the idea is to build the enum with asm from the datapacks etc. at startup
however to get that to work with reloads, you'd have to reload all plugin classes as well
The fork doesn't seem too outdated lol
It's only on 1.20.2 @remote swallow
which i don't think vanilla /reload is expected to do
The idea is to instead do something funny 
don't need dynamically created enums
you just need the network int id
which the server has
chat
alternatively i'd be quite content with a RegistrySet that uses a similar ordinal indexing scheme as enums but supports being rebuilt at runtime
/reload starts a proxy which keeps players connected and restarts the server
which is what you're describing yes
Issue naturally being, how do handle things being gone
mem leak duh
we went full circle ids -> names -> ids
shouldn't be an issue as long as you don't build against things that are gone
Actually. I do have the client-code basically done. I can quickly fork & add that 👀
optic?
😔
Probably not. I don't want to spend time working on something for a project which might not even get used lol
Paper? Drag & Drop classes + server jar and not many lines of code
Helix? Learning an entirely different API on top of everything else
Also, I personally wouldn't use helix so there's no reason for me to even bother with it to begin with kek
I mean, there is the helix-spigot-module
it translates spigot <-> helix
(note: not a reimpl)
(mileage varies)
I trust those as much as I trust paper's.
I don't.
fair enough(?)
not worth the effort kek
plus I'd have to apply the same forking treatment to helix as I'm doing w/ paper to get something that's not poorly impl'd so that's even more digging around code I'm never gonna really use outside of that one program
do yall know of a plugin that disables mob spawning in a certain amounts of chunks of a play that has the command toggled
that's the one thing you won't need to do! at worst it's one module to look through (the plugin module), though plugin loading is treated like loading a config so you can just listen for the relevant data lol
Nope, I'd need to fork it so I can modify the module loading kekw
module loading is done by the module loader module
which is the only hardcoded module that gets loaded
how does it load modules if the module loading is a module
though it can still be swapped out
yes. so I'd still have to fork & learn APIs for something I won't use lol
it specifies in it's metadata it is part of the helix core group, and it has a flag named "first-start" :P
the module loader is separate from the module itself
it just requires the right metadata
so for all of the version / duplicate / compat checks it's not handled by the core loader
bit funky
but this means you get full control over what's happening
hey
the idea is that nothing is locked in, so I'm making sure of that
except for yk, the required stuff like load order for the first module
which makes it even more of a bitch to work with, since there's no guarantee code even will exist
Depending on how helix works, I might have to be concerned with internals lmfao
you'd only be concerned with internals if you need to debug internals
otherwise it's designed to just allow relying on the API, specifically the data processing API which handles most of the work
ehhhh. you can figure the mess out once I release a client project LMFAO
fair point
Given how it works... I'm not liking it from a impl something properly standpoint
.
Don't want to touch a project where it's quite easy for a certain thing to not exist, because it got swapped out by something else or whatever
Except for if I do have to rely on internals kek
imagine when ike finds out people arent meant to rely on mc internals but still do
in my case, I straight up do have to rely on internals lmfao
Example, to intercept plugin loading:
A message is created and broadcasted to the core channel
<any filters, processors, etc>
A handler (typically, yk, the module / plugin manager) will read the final message and work accordingly
all channels support middleware
Yea, I wouldn't do it that way since it means a different module could potentially fuck with shit
I'd add the changes before a single module gets loaded 😎
yes, that is entirely the point
Which is fucking stupid from a security stand-point so I'd have to fuck with the loading code itself
guys i need open source plugin that supports many versions via multi-module(maven or gradle) structure
as an example, want to observe how people implements things
I'm not gonna use your message send/receive/modify system because of how easy it'd be for a different module to outright screw with the AV
same reason I don't make a spigot or paper plugin, but modify the server code itself
I'd have to dig through allll the code to see when, where, and how modules are loaded and then impl the necessary code changes to be before even a single module gets loaded so it's properly secured
fair point
You're entire project is an absolute security nightmare
Just add a step to the launcher then lol
Nope. Not gonna trust it
It's no different than installing random plugins what
If a third-party can manipulate the AV in any way, the method's fucking stupid
e.g. a spigot plugin, or using a messaging system
oh I mean yeah I didn't think about that
which is why I said fair
I completely forgot that an AV needs to be "isolated" technically
so, again, this.
or this, you can just add the av task to the launcher so it runs even before the server
¯_(ツ)_/¯
or no since it means a different task can likely fuck with that one just by loading before mine
which is the entire issue with spigot plugins to begin with
tasks are not modular
they are only defined by
A) Me
B) A fork of the launcher
they are like:
Get mc
Get libraries
Get helix
Do remapping
Start
ehhh
But not from a support perspective, as it means it can't support other launchers
so, therefore, have to fork helix
I mean, fair enough ig, you'd have to edit helix itself then
.
I mean there is not much code
The only non-shit implementation helix can have is a fork of the helix internals lmfao
I'd still have to supply an official launcher anyways, but for maximum compat it'd have to be a helix fork
Just straight up not worth it
fym
what'd I do 😭
motions to the entirety of helix
It's a complete mess to support
it's no different than plugins running on spigot & paper (pre hard-fork), the internals weren't really 1:1 and yet stuff still worked
helix reminds me of
Yes, and I have to outright ignore implementing a plugin and instead modifying the plugin loader itself lol
same way I'd have to ignore the "proper" way to implement things in helix
I mean yes fair enough
what where when why who
surprise. tool.
i wonder how would bukkit api would look like if its event system would be switched to rxjava's observables
or java's Flow API
kinda what I'm doing
completely event driven bukkit api would be kinda neat
but in a much more general sense
well, it's not the bukkit API per se but yes
abstract class Event -> subject, observable, publisher, event
Listener interface -> observer, listener, subscriber
pretty much everything is done like:
Plugin data -> API impl -> Message -> Channel -> <Middleware> -> Destination (any)
and optionally backwards
its already implemented with observer design pattern
Hello im new to this skripting and i created a few skript with plugin Skript and i dont know hot to make them start automaticly beacause im new to this stuff
ask skript themselves
yes but libs like javarx allow for Stream API like data manipulation and for bukkit api you need to implement that data manipulation by yourself
in java there are 4-5 different implementation for observer design pattern @mortal hare
gof way, deprecated observer/observable way, bean way, flow api
etc
it was my study topic
when i implement all of gof patterns
it wouldn't be all that different, bukkit events are just observables in the end
yeah there are 2 context
RxJava would allow for composing event handlers or something of the like so it'd be cool API wise but that's just about it
My shop GUI is compromised... players can just take stuff from it by holding down a hotbar slot key and closing the inventory. How the hell can I fix this? The InventoryClickEvent is supposed to be cancelled... what do I do?
https://youtu.be/-D0wK4shoxc
do you cancel all the other inventory events?
that is, inventory drag mainly but there's also others like inventory move item
well those usually get cancelled by inventory click
@mortal hare
observer ≈ listener ≈subscriber
subject ≈ observable ≈ publisher ≈ event
they are not
not "=" its "≈"
let's see code
how come it usually cancels it then?
I do understand that, but reactive extensions are very convenient in terms of how much functions they supply for data manipulation
Inventory click may cancel actions which happen before a drag event is called, but that isn't necessarily always the case, hence why they're sibling events and not just parent-child
if(event.getClickedInventory() instanceof PlayerInventory) {
return;
}
this is your issue right here; inventory interactions can modify not just the inventory the player clicks, but the other one as well
hmmm
e.g. shift clicking an item in the player inventory will also modify the top inventory by inserting the item in it, but event.getClickedInventory() is the player inventory
but I cancel the event first
this'd cancel all events for all inventories then, no? is the listener even registered
how are you calling this? if this is only called for events that click the gui inventory specifically, the issue will be the same
I have other classes
here
InventoryHandler handler = this.activeInventories.get(event.getInventory());
try event.getView().getTopInventory() instead
ok
beyond that, make sure that your code actually gets called
put in a sysout at the very start of your listener and then right before where you cancel the event, and see if one gets printed without the other
then backtrack from there and see where it falls through
im confused, all the code is definitely running
everything is working correctly except for this bug
how are you so sure
because the shop wouldnt work if the code didnt run?
put a sysout and see
that the shop code runs sometimes doesn't mean it runs always
this is what we call a sanity check
ok
in the video I linked you can see I have to try it 20 times to get the bug to work
its something to do with closing the inventory at the same time I hotbar-slot-click the item
are you in creative?
yes
ah
creative is kinda annoying when it comes to inventory events
cursor is completely client-sided, among other side-effects
time to throw sysouts at it
the item dissappeared when i clicked it
yeah that's cancellation inventory desync
that's fine then, just a client desync
ok
the survival client respects the update it receives from the server later, destroying the item
what if I logged out after
the creative client goes "trust me bro" and tells the server to respawn the item
before it synced up
the item doesn't exist on the server
it's specifically because the creative client can arbitrarily tell the server to spawn shit in that it reappears on the server in creative
ok -- I tested bugging it and then logging out before it synced up, and the item is gone. I guess its all working fine, thanks for the help
you could try to guess whether an item was duplicated in the creative inventory by checking whether the cursor in the creative inventory event is the same as the last hotbar switch click type or something, but that's only if you care about creative anyway
yeah no one will be in creative so no worries
if someones in creative I have bigger problems on my hands lol
Wouldnt it be cool if you can listen to events like this
Set<UUID> joinedPlayers = new HashSet<UUID>();
playerJoinEvent.map(event => event.getPlayer().GetUUID()).subscribe(uuid => joinedPlayers.add(uuid));
playerQuitEvent.map(event => event.getPlayer().GetUUID()).subscribe(uuid => joinedPlayers.remove(uuid));
with rxjava you can, i can see how much bukkit plugins would shrink just because how much verbosity people need to listen to particular events
I mean, there's nothing stopping you from doing something like that with bukkit's current event system really
yes ik
just slap a spliterator implementation to a custom EventExecutor and make them a stream of events
but it would be kinda cool to have native support for it
eh, it's fancy but not without a cost
there'd be quite the overhead for high-throughput events like player move
you could probably pass static method references
but yeah it could be a problem
but i dont think that's problematic much
eh, it'd probably increase GC pauses on a larger scale, given how many plugins would have listeners for it so I wouldn't be able to say
it could be made fast, but it'd be annoying to implement
not to say the bukkit event system is perfect, the handler list collection impl is a mess, but even with that it works fairly well for what's worth
well servers on that scale probably just need to not use that feature
if this was Haskell or like maybe Clojure Id agree w u
sadly even w rxjava, u cant reap the full benefits of functional programming
is there a way to get an offline player's head to put in an inventory with spigot 1.18.2?
yes?
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>3.11.50</version>
<scope>provided</scope>
</dependency>```
you can create or get skulls with that dependency
and why not just use SkullMeta#setOwnerProfile
i mean, it isn't difficult to make a reactive-adapting EventExecutor
but the fact that the event system is not prepared for all the asynchonous nature of reactive programming means you lose all benefits the second you need to mutate the event based on something coming from some other stream
how do you know that
all you gotta do is .join() :Clueless:
can I then call my plugin ✨ async ✨ on spigot
only valid use of CFs
what is CFs
completable futures
that's basically what my API is but slightly more granular :P
CloudFlare
capitalising the f should be criminal
CloudflAre
cLouDfLARe
Rad you wanna test packed for me
not really I'm in bed rn
Dang I knew it
they probably have a sky window and are looking at clouds
the window is behind me so it's hard to look outside whilst laying down
Nah no clouds exist in Germany
true, spy drones
Let's not embrace the worst aspect of rxjava
how would i make it so that an EventException catch block won't throw an error if it's not implemented?
I don't know java @SuppressWarnings() options very well
it's for an InventoryClickEvent so i don't receive a console error any time someone clicks on an empty slot or outside of the inventory
uh, maybe fix your code so it doesn't error to begin with?
in any case, it isn't your code the one throwing an EventException, it's the server throwing/logging one when your code throws some other unchecked exception, like a NPE or IOOBE
so regardless the solution is "fix your code"
it's saying "Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.getType()" because "item" is null"
it uses a switch case. would you suggest not using switch then to do it?
the ItemStack itself is null
not the type
you are trying to call getType () on a null ItemStack
it occurs when i click an inventory slot or outside the inventory
yes, because no item was clicked
thus, the clicked item is null
so you cannot call getType
if (clicked item == null) {
empty slot or outside inventory
}
Real
Try catch around everything you write
me with my fuckin http server project
Hello, I am currently learning about Spigot NMS. I am trying to understand when and which one I should use:
- net.minecraft.server.level.ServerPlayer // NMS
- org.bukkit.craftbukkit.v1_21_R4.entity.CraftPlayer // CraftBukkit
- org.bukkit.entity.Player // Bukkit
im using bad practices sometimes just because this
Use org.bukkit.entity.Player an much as possible
When that's not enough net.minecraft.server.level.ServerPlayer can be used as a last resort
CraftPlayer is mainly used to get the handle to the server player
can you give sample for 3 of these
use cases
no code required
i just want to know
ServerPlayer can be used to access the connection so you can send/capture packets
CraftPlayer to getHandle to the ServerPlayer
And Player to do everything else really
for what, why i have to handle player
getHandle is a method in CraftPlayer that returns the ServerPlayer instance
You will generally find it in every craftbukkit entity wrapper
oh now i understand this, thank you
Yeah getHandle in that context returns the nms server
which contains the recentTps field that vanilla uses
Is there a way to send a link to a player so it opens the "Are you sure you want to open the following website?" screen?
I'm geussing it's a hardcoded security measure preventing it?
If you meant doesnt open, then no
Like, send this screen instead of having to click the link in chat:
That screen is most likely client side
Can I make it work off a gui click?
It's most definitely client side. It only opens when you click a link in chat.
What would be the point of a security measure if you could bypass it
Every security measure is bypassable...?
You are asking for a zero day?
That is just false
it is
wat
I guessed so, dang. lol
i repied to wrrong message
No...?
it is*
Yeah, I realized what you meant lol
?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!
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
lol
You ever tried writing more than a sentence in one message...
if i had a nickel for everytime someones asked about bypassing Minecraft security within the past 2 days, id have 2 nickels, which isnt a lot, but Weird that its happened twice...
literally
why not use the built in library loader?
isn't it only for 1.17+ and only for maven central?
I assume it didn't download the dependencies of packetevents and their dependencies
yes, it seems to only have downloaded literally only that very module
it didn't even download its api
last versions of 1.16.5 it looks like, and then 1.17 yeah
probably related
?whereami 😔
well spigot is G but slower
and paper devs are obnoxious
gotta balance by supporting both
real
brother
no
not how that works, checked the code
just sayin, since they hardforked and do have different plugin stuff now
its fuckin
file download
it literally does not download the entire jar
how the fuck would they change that
Search and download Java libraries/JAR files inclusive their dependencies. ➤ No Maven installation ➤ Everything online ➤ Free download
maybe it has an api
what downloaded vs what should've
?
it downloads the jar + all of its dependencies
does this plugin need to support <1.17
basically
it needs to download off maven-central reps
this particular project - no, but I also wanted to use it for my other 1.12+ plugins
this is the size it is on CodeMC
Sonatype Nexus Repository
i think it tells gradle the dependency is required for code compilation
could be wrong
ik it superceded compile (and i think compileOnly?) tho
not sure what compile does, but compileOnly lets you use the classes without bundling it into the output shadowJar
maybe Libby isnt downloading Transitive Dependencies
looks like it probably doesnt
bruh
F
why is this false by default and not mentioned in the tutorial
whyyy
now I look stupid
welp thnx for the help
np
?jd-s
?stash
is player reporting client sided
or can it be disabled in the server by plugins
i find it stupid.. why is player reporting button even necessary

it can be disabled but not the GUI part, only the message signatures, effectively disabling it
ty!
in chat, can this be disabled too?
I like the first part of the message but not: error at position 1: /<--[HERE] what the heck is that
do I have to use brigadier for this? .. is that message client sided too?
Yes the unknown command is client side
hmm
even with protocolLib i couldn't do anything?
it's a tooltip
You can do colorized parameters with brigadier and suggested commands tooltips.. but there's so little info available about it
Use a resource pack if you want to change it
command.context.parse_error
or if you just want to change/get rid of <--[HERE] it's command.context.here
ok ty
Hi everyone!
I'm currently designing a system where players can plant and grow custom crops with multiple growth stages. I’m exploring different ways to implement this and was thinking about using ItemFrames with custom items to represent the crops visually at different stages. However, I'm curious: How would you recommend implementing a system like this efficiently on a server? I'm open to any ideas, including other approaches that might be better than using ItemFrames.
Would love to hear your thoughts and suggestions!
Depends what version but generally item frames or item displays are you best option
Just a matter of managing them on chunk load so they dont persist
