#help-development
1 messages Β· Page 1115 of 1
Indeed, but youll get a method clash
huh?
If the names for methods clash compiler forces you to explicitly call them by class
no issues so far
no?
if any default methods' signature clash the implementing class has to explicitly implement it but nothing about calling
Ye default methods
but like, if there are no default methods in the itfcs you also have to implement them
if you mean invoking the default methods via super on interfaces you always have to specify the interface name
regardless of clashes
how does Metadata work on Worlds?
MetaData is non persistent
okay, but what does it change?
change?
so does it not affect what the server sends?
You are talking about Bukkit Metadatable?
it was meant to be an api for plugins to communicate and interact with each other
but it was never finished
and it's ass and it's leaky
and itws leaky.; almost no one uses it now
sooo i did some more research and i found... nothing. i still have no idea how i would set a skin for a protocollib-npc ._.
If anyone can tell me how, please ping me :)
do not
use
protocollib
also, skins are set with PlayerInfoUpdate I think
bruh 50% say do 50% say don't and i want to be able to interact with an npc
and apparently without protocollib, it's ass to code
bc you have to do funky netty pipeline shit
i don't know a lot about packets yet and i'm trying to learn xd
tell me, how told you to use protocollib?
use PacketEvents
7 people?
potato potato
7smile7
I agree
don't these 2 do the same thing?
packet events does it like 20x better
it's not even a competition at this point
I believe you can also shade packetevents right?
literally beat pl in every possible way
yes
Way better lol
altough, retrooper doesn't really like that
(what does shading do btw?)
hmmm
send the date
i mean
πΏ
apr 3 2022
send when this was written
so not THAT old
It's ancient
it's incomparable to pre 2.0.0
uhmmm is there no tutorial on how to include it in the code?
on the resource
like "installing" i mean
Hasn't retrooper been working on a wiki for pe?
i think i found it :)
through the github and then it's on its own wiki
and i suppose i can replace NMS with PE as well?
or are there still certain things i would need nms for?
well, if they aren't packet related, then yeah
so e.g. changing the name in a gameprofile i suppose

how much
1 pound of cat food per day
fat cat
except protocollib has no wrappers
at least no usable ones
wrapper repo had last commit like 2 years ago
damn
Not specific enough.
What flavour? What brand?
probably only the best
one million beers?
PacketEvents is actually pretty cool. At least from the kody simpson tutorial i've watched
is there method to get players xp in for loop and calculate it?
Aaa
https://packetevents.gitbook.io/docs might be a useful guide for now
although still WIP, but should be a good introduction
very odd coincidence i saw the message
i don't quite understand how i would create a WrapperPlayServerSpawnPlayer packet
i feel stupid xd
Have you read the sending packets page on the guide?
yeah i've been trying nms first, then plib and now i'm on ur api
the sending itself is not the problem
it's about this specific packet
what minecraft version are you on
e.g. the EntityDataType
1.19.4
the metadata is optional
my ultimate goal is to spawn an NPC with a skin fetched from mojang
(that in the end can be interacted with)
oh i didnt know there was one
you can use it, but the moment someone makes a complete packetevents extension that fulfills the NPC feature, we might remove it
we have so many components in the API, we're not sure if it's ideal to also allocate time maintaining a tiny NPC library
while an extension could primarily focus on that
for spawnplayer you could add no metadata list
oh
but do you understand how metadata works in the protocol generally?
since i started like 30 minutes ago, not quite, no π
we have a community that can provide support, but wiki.vg has documentation for parts of the protocol
it would be a strenuous task if we also documented all concepts in the protocol
as its always changing
i see
EntityDataTypes class provides instances of EntityDataType
ohhh
does this mean there will just be another maven import at some point and everything else will stay more or less the same?
i suggest leaving an empty metadata list in SpawnPlayer packet, and sending a EntityMetadata packet later
possibly, we already have packetevents extensions that abstract Metadata
i see
are there docs for the npc class?
Oh right, i also kinda canβt find the doc to how to shade eventpackets :(
expects you to know how to shade a dependency generally
Why not advised?
Someone summarized it in this suggestion for a project: https://github.com/GrimAnticheat/Grim/issues/1528
so if i understand correctly an example would be this:
<relocation>
<pattern>com.github.retrooper.packetevents-spigot</pattern>
<shadedPattern>shaded.packet.path.packetevents</shadedPattern>
<minimize>true</minimize>
</relocation>
oh
I primarily use Gradle so i don't remember off by heart how it looks like in maven
probably correct
looks good to me at least
so shading results in performance issues?
No, performance loss and performance issues are two different things.
Just, if two plugins shade the library, packets are encoded & decoded twice.
Now, think of this, tons and tons of plugins shade the library.
Some users really have servers running 5 or more instances.
This is just an unnecessary performance drawback and you would be contributing to the problem.
This is why we raise awareness.
i see
okay then i'll not shade it
and if i understand this correctly users then will just have to add the api to their plugin folder?
As people see, the pros outweigh the cons, it's not just because it makes me feel some type of way or whatever
it benefits your users, although they might not see it
Correct
As you see, it wasn't successful in that issue haha
^
Not really since then people start asking for more functionality and more stuff, when this is not meant to be an NPC library. But it's simple, create an instance of it using our classes, (you'll need to generate a random UUID, you can generate a new entity id using SpigotReflectionUtil.generateEntityId())
then call NPC#spawn on a player channel, you can use getAPI().getPlayerManager().getChannel(player) to get a player's channel
and the npc is visible to them
@hybrid turret did you read the entire docs
i was just asking
u mean these i suppose?
i will
should i tag you when i read them and tell u what i think? bc i got to go for now
alright will do
how would i go about making my own chat formatting plugin?
i want it so that it sends a different version of the message to each player
First thing to think about is what versions to support
public static Integer FactionPlayersPower (FPlayer p){
int playerPower = ExperienceAPI.getPowerLevel((Player) p);
int i = 0;
for (fplayer : i = 0 ; i++) {
}
return i;
}
I'm not very in to for loops, but i really need one, can anyone pls explane? π
Since thereβs a huge amount of changes concerning Chat and chat formatting in a ton of versions
What exactly are you trying to do
I want to get an mcMMo power int from all faction players list
Well then youβre gonna need a list of players
hehe, good thing you have me
master microoptimizer
weird thing is that it returns Set not list
And then you can use a for loop like
for (Player player : playerList) { /* your code here */}
Imagine if packetevents, instead of making multiple instances of itself for all plugins, made one
A set is also iterable
FPlayers factionsPlayers = p.getFaction().getFPlayers();
And can be used the same way as a list in a for loop
how do you prevent shading tho?
ow but how do I + each players power from faction to one integer?
You don't; you just support it in a way that makes one "main" instance even for shaded plugins
You can make one sum variable outside the loop and add each players power onto it and then return it
then what about version differences?
I did that once using the bukkit service API, but you'd want to add some handling for breaking versions
also, what about encoder and decoder names?
You could change the package name every breaking version or something, sounds like a band-aid solution, but as long as it works
I guess just use the default, fair
Yee lol
yo, are you also banned at papermc?
thank u very much will try to do something
Yes
hehe, so am I
I had "mayo/naise" in my pronouns, that's why
they are paper boys
really? xD
Their brains consist of paper
Yeah lol
when did they ban you?
I thought people have been joking, but they haven't
After I left the server
so what time?
Idk
like date
fa/va are my pronouns now
Holy shit you still exist?
how can I search for some text in a github project?
impressive
yeah I can see that
it's just that it didn't give me any results
of a thing that's clearly in a plugin
funny
Skill issue?
are you logged in?
I mean, it might be a new thing and he just hasn't updated the github yet
cuz else I dunno
are you logged in?
yes
is there any way to detect if a player is holding rightclick on an item?
holding? or just pressing once
holding like i want the player to hold an item to get back to the lobby to the player cant accidently click it or smth
if i have a task that executes on each tick, will this task be called before or after the events?
1.8
i reckon i could figure it out for 1.8 i just dont know the starting point
No guarantees either way
It depends what events you're speaking of
But it'll be unlikely their is any guaranteed order nor should you bank on any guarneteed order
a basic event like block break
there has to be a certain order, no?
is that before or after AsyncPlayerChatEvent
neither
Why not at the end
Hmm, not sure why but sometimes when I end my minigame while the player is on the respawn screen still they get a "Chat disabled in client options." What could this usually entail?
hate the game, not the player
i'm just a messenger
so you do not know any reasons why that is so?
nor do i care
Who do I need to ping to find out
md5
Sir @sullen marlin
May I know why this (check the message I replied to) is so
2016, thats like since 1.9
Can I, in theory, make git believe I commited something before the project even existed?
sure, rebasing exists
you are a goog
also that code is terribly beautiful
or I guess more like beautifully terrible
It's my actual code from like 2-3 years ago
I guess you really do learn from experience
yeah
being able to look back on your code and seeing its cringe means you learnt something
Not saying I don't write code like that anymore
yeah. its unsatisfyingly satisfying'
I hope you atleast learnt to use pdc in this time lol
its like wrong in multiple ways, thats usually the best part about bad code
we all do have code like this
I didn't even know what AtomicIntegers were so I used arrays lmaoo
its never only bad in 1 way
you just grew out of it
readability -10
but its cool tho, i can even follow the thought process from my old projects, so i can see with the experience i had back then why i did this and that
IDE suggesting arrays instead of atomics: πΏ
why did you use arrays there πΏ
cuz I didn't know what atomics were
scope
move || {} my beloved
I love how garbage that code is bro
Yeah, you can't learn without making mistakes ykwim
and vice versa fr
all on red
π
maybe for primitives but
for anything else breh
why cant they create like AtomicObject<T>
Atomic<T>
AtomicBoolean, AtomicLong, AtomicObject to fit the naming scheme
but actually OptionalInt, then Optional.. idk maybe Atomic<T> is good lol
i suppose i cant set something like "1h 20min" as a score on a scoreboard? only integers?
correct
if you are talking about the red text yeah
but you can just hide it and show your own text
or atleast I think you can hide it

The paperman is here
anyways I think for my plugin all the scores are just 0
so it doesnt really matter anyways
Wouldn't that mess up the order or something
order is also based on team name I think
like it needs some way to order the scores
my code sets all scores to 0
but the line indexes are just the team names
like LINE_1
because only 64 bits support for atomic values
doesnt have hardware instructions otherwise
i mean theres AtomicReference<T> but that exists because a reference is pointer sized
i mean, the jdk doesn't care about available hardware instructions or pointer sizes
to the point where writing to a long or a double is allowed to not be atomic, but two 32-bit writes
Is a 32 bit write just an integer
ints are 32 bits, yes
next you'll tell me booleans are 8bits
Why are things still called 32 bit and 64 bit instead of 4 bytes and 8 bytes
its cooler
surely they aren't widened to 32 bits}}
:Clueless:
they'd never 
Boost when
booleans are 192 bits
π€ π
makes sense 
never
I prefer them 512
Why
I prefer them spread in a vec
if computers have memory, we should use it frfr
32 gigabytes vs a single byte. you can fit billions!
I use chars
why cant they allow u to to use ints in conditionals like c++
or f64's
like 0 is false everything else true
Because why
because it makes sense
if(0) { return false } else { return true }
We have booleans for that
yes and c++ has booleans too lmao but many people use the int conditional
its much easier for doing stuff like array accesses, etc
if you have a huge integer array and want to check if the value is set or not, all you do is that
Because C++ is an extension of C and C is an ancient language that prefers integers
breh have u used c++ before?
#define false 0
#define true 1
lmao
#define bool int or something
what
the syntax follows most C syntax languages like java
oh
Nobody does lol
thats why i fart everytime i code java
Java is huge
i dont even know what the hell does assert do
and abstract
or protected
asserts something?
assert is a keyword only used for testing purposes
it only works if u run it with a cmd line parameter iirc
assert can be used to tell ur IDE to chill
otherwise its completely ignored
usually your ide is telling you something important
for ex a null check
'metadata can be null' not it can't
whats metadata
That's how I call my item meta variables
i just saw assert when something was turning null and intellij was like "are u a fricking dum dum bro this is actually null u dumahh boy"
well it can be null
No it can't
itemmeta can def be null
ye
theres a reason the hasItemMeta method exists
the method is annotated with @Nullable
thats on purpose for IDE's to warn users
That's not what it exists for
@rough drift dude i hate forge teach me ur wayz in fabric plz
then what is it for
i couldnt get anywhere with forge
getItemMeta either returns the current meta or creates a new one for this item (can be null with air)
lets hope that i can do it on fabric
hasItemMeta returns whether it has been created yet
and the itemmeta factory (for some reason) could return null too
i guess for air stacks?
idk
whats the item meta factory
It will not tell you whether getItemMeta will return null or not
@paper viper@shadow night just wanna ask fabric vs forge in modding
Bukkit ItemFactory#createItemMeta
so it can be null
fabric is a bit harder because no API, forge is a bit harder because barely any documentation
So, just use neoforge
oh right
would be the same as creating an itemstack and getting the meta from it
- hasItemMeta will not tell you that
iirc
but thats why the ide is warning you
theres reason for it
and it doesnt hurt to just add a single null check
Technically, it does
the ide is warning you because the signature of getItemmeta is probably wrongly defined as nullable
A single useless if doesn't hurt performance a lot, but imagine 200 if's
it can be null if it's an air stack
thats why its @Nullable
okay so then why would the check be useless
wdym
Which will occur in 0.001% of all scenarios
ty bro
literally no difference in performance
if you know its not gonna be air, you don't have to check it
There is?
bro these guys are fighting over of a method
why tf would u have 200 null checks lol
An if check is an operation, an operation consumes some time
is it even neccesary ?
Fabric community is nicer than Forge
Because you (or other plugins) access an item meta 200 times on total?
and theres literally no performance issue
No issue, but there is an impact
theres literally not omg π
forge vs fabric in modding bro this mf called raydan answered neoforge like wth didnt even know thas a thing
neo is better
then in that case use final for everything cause its "marginally" faster lol
They eventually do. Also, useless if checks bloat your code
Are stream methods slower than iterator methods? ie: stream.findFirst as opposed to iterator.next
There is a difference between removing something and adding something for micro-optimizations
In this scenario, it increases readability, LOC and works as a micro-optimization
Choosing neo over forge is more of a morality/ethics thing imo
Not supporting lex :p
Nah, neo has some good features and I believe they are also decently documented (in difference to old forge, documenting nothing)
i'm not arguing about this. computers are capable of billions of operations and a null check is literally a O(1) operation
probably even no overhead at all
And yet it's bloat!
Just remove it
You'll never get an AIR stack in 98% of scenarios
yea then the 2% chance u do... π
Those are scenarios where you can add that null check
Most of the time checking whether the stack is null is enough
Just gonna assume you guys don't know :p
One might suggest that forks could implement logic that yields AIR stacks where spigot would yield null π€βοΈ
I believe streams are slower in some scenarios but Idk so don't take this as an answer
like, only making a stream just to call findFirst?
Not my problem then lol
no
let me show you hold on
If your application is very performance-dependent then you probably want to benchmark it yourself, for your specific use-case
Eh was just wondering cuz fourteen said use iterator not streams
eh
(at least in this specific case)
I'm trying to find the bit he was referring to hold on
Using streams is not gonna kill your performance
yeah use streams when they are convienant
i mean, unless it's stupidly hot code, it really doesn't matter
SequencedCollection#getFirst() π
public class InviteService {
private final Map<UUID, Set<InviteImpl>> invites;
public InviteService() {
this.invites = new ConcurrentHashMap<>();
}
public void createInvite(UUID inviter, UUID invitee, Duration duration) {
Instant expiryTime = Instant.now().plus(duration);
InviteImpl inviteImpl = new InviteImpl(inviter, invitee, expiryTime);
this.invites.computeIfAbsent(invitee, uuid ->
ConcurrentHashMap.newKeySet()).add(inviteImpl);
}
public boolean acceptInvite(UUID invitee) {
Set<InviteImpl> inviteSet = this.invites.get(invitee);
if (inviteSet == null) {
return false;
}
Optional<InviteImpl> inviteOpt = inviteSet.stream().findFirst();
if (inviteOpt.isEmpty() || inviteOpt.get().isExpired()) {
return false;
}
inviteSet.remove(inviteOpt.get());
if (inviteSet.isEmpty()) {
this.invites.remove(invitee);
}
return true;
}
public boolean rejectInvite(UUID invitee) {
return this.invites.remove(invitee) != null;
}
public boolean hasInvite(UUID invitee) {
Set<InviteImpl> inviteSet = this.invites.get(invitee);
return inviteSet != null && inviteSet.stream().anyMatch(invite -> !invite.isExpired());
}
public void removeExpiredInvites() {
for (Set<InviteImpl> inviteSet : this.invites.values()) {
inviteSet.removeIf(InviteImpl::isExpired);
}
}
public void clearInvitesMap(){
this.invites.clear();
}
}```
Idk you tell me if it's stupidly hot π€·
kek
by stupidly hot i mean code that has to run fast because it's in a code path that gets called really frequently and you need to get it out of there asap
Naaaah youre fine
Yeah
And still you are coding in Java..
what
which can be just as fast as native code..?
null checks are absordly cheap, like, single clock cycle cheap
it's better to not have a useless line of code than to have one
"you're still coding in java" like what's your point
python can be just as fast as low level languages like C
Doesn't java achieve near native speeds these days through JNI and whatever
replace JNI with JIT please
i mean the runtime quite literally compiles your code to native instructions
via JIT, not JNI but yeah
and it very well does compete with languages that compile directly to machine code
theres a tiny overhead for jni but its fine if in the end its better
talking about java performance this is rlly cool challenge https://github.com/gunnarmorling/1brc
someone managed 1.5seconds
And then people claim java is slow
to parse 1billion line file
lots of hacky stuff yea haha
congrats they call into native code π
its all simd
the thing is that can't be like a random thing, it has to be for their companies weird fucking use case
somebody doesn't just say "hey let's make a challenge to parse one billion rows"
and then do it in java
but it does showcase whats possible
Is there some easier way to create commands without needing to register them in 3 different places?
by default.. no iirc
but u can add them directly to the commandmap like most people here
public abstract class Command extends BukkitCommand {
public Command(String command, String[] aliases, String description, String permission) {
super(command);
this.setAliases(Arrays.asList(aliases));
this.setDescription(description);
this.setPermission(permission);
try {
Field field = Bukkit.getServer().getClass().getDeclaredField("commandMap");
field.setAccessible(true);
CommandMap map = (CommandMap) field.get(Bukkit.getServer());
map.register(command, this);
} catch (NoSuchFieldException | IllegalAccessException e){
e.printStackTrace();
}
}
@Override
public boolean execute(CommandSender commandSender, String s, String[] strings) {
execute(commandSender, strings);
return false;
}
public abstract void execute(CommandSender sender, String[] args);
@Override
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
return onTabComplete(sender, args);
}
public abstract List<String> onTabComplete(CommandSender sender, String[] args);
}
This is what I do
so like
...or you could just use a command framework
instead of letting the first (command, argument, whatever) be handled by bukkit, just handle it urself?
which does exactly the same under the hood
how
no. all ur changing is how ur registering
ur registering directly into commandmap like nuclear is doing
but ur best off making a framework around that
or using one
for example aikar's command framework allows commands made like so
Is there a difference between reading my plugin's config during onLoad or onEnable?
onLoad is on server startup after depends ofc, and onEnable is after world has been loaded right?
Util.sendMsg is crazy
i would've understood if it was minimessage or something
straight from their wiki π Β―_(γ)_/Β―
wot?
what does this even do
it adds a command
I see, thanks! So if I don't need to interact with anything during the config parsing, it's save to put it in onLoad.
well given that this is true, it depends on what needs to read your config either onLoad or onEnable @late abyss
if u wanna know how it works u should read their docs
Holy im so confused lmao
well if u wanna keep it simple. what nuclear sent here allows u to register commands into the commandmap
so u dont have to register anywhere else
I tested the code here and I think I didn't explain the system I wanted clearly. The system here works like this.
It calculates the damage dealt to the player, and when doing this calculation, the power of the sword, the armor the player is wearing, and everything else are taken into account.
But this was not the system I wanted. Let me explain it very briefly and concisely.
First of all, let me state this, the power of the player's sword or the armor he is wearing should not matter.
A player also has 10 hearts,
Now what we need to find out is this: Sometimes a player can be attacked by more than one player at the same time.What is important to us is the killer, (How many hearts did the killer use to kill this person?)
For example, 2 people hit that player at the same time and the murderer killed that player by taking 4 hearts. In this case, it should be reported as follows.
You killed the player named (....) with (4 hearts).
That's just it. I tried to do it, but I couldn't calculate how many hearts, i.e. how many HP, the killer actually took from the killed person when more than one player attacked at a time.
Okay that almost makes sense
Nice
I can send you an example of how it's used if you need tha spoonfeed kek
public class IslandCommand extends Command {
private final Skyblock plugin;
public IslandCommand(Skyblock plugin) {
super("island",
new String[]{"is", "islands", "nsb"},
"NormalSkyblock: Island command, Usage: </island, /is, /islands, /nsb",
"nsb.command.island.use");
this.plugin = plugin;
}
@Override
public void execute(CommandSender sender, String[] args) {
if (!(sender instanceof Player player)) {
return;
}
GUIRegistry guiRegistry = plugin.getRegistryManager().getGuiRegistry();
player.openInventory(guiRegistry.getOrThrow("role_settings_" + Role.VISITOR.name()));
}
@Override
public List<String> onTabComplete(CommandSender sender, String[] args) {
return null;
}
}
...
// In your main or wherever you register commands
@Override
public void onEnable() {
registerCommands();
}
private void registerCommands(){
new IslandCommand(this);
}
I more or less got it
Its fine
Right
whats the plugin for
is there any good library or something for making inventory GUIs?
Is command a custom class or what
This is command, right
Mb
?gui
WHAAAA
personally https://github.com/noxcrew/interfaces-kotlin is my favourite and you also use kotlin so
githuh.com is a thing????!???!!!
apparently it's a 301 to github.com
barely a few do
if by "call into native code" you mean using Unsafe
unless reading the file is also calling into native code
then it's unavoidable π€―
the claim that java is slow is so absurd
cool, gonna try it out later
tick
forge,neoforge,fabric
throughout coidng and modding who do yall think alone is the honoured one
ima go with neo
i really like fabric
but i need that info
ima code a mod for keybinding, tried with forge, gone wrong,dont try at home
write me a keyboard driver
i hate forge
i dislike it because the community has not had a good history
racists? pedos?
they aint even that active bro
No just straight up toxic
HAH
and jerks
fno i hate it more
then it's okay I thought something interesting was happening there
well lets put it this way
all of forge's original developers except for Lex joined neoforge
forgecord π
is neo actuall goated
"I want to be clear, Lex has been a problem in the modding community for many, many years. Almost every veteran minecraft modder has had a negative interaction with him over the past 12 years. I have, when able to, tried to steer people to not abandon Forge just because of Lex - defending him in many a private conversation with a frustrated modder whoβd just been called a βC*ntβ for 1,000th time by Lex, or banned from our online spaces for a trivial transgression like discussing Fabric or coremods."
crazy
why the fuck keeping shit like that around??
Hes always been that way
just ban mf
But forge was "his" project (I believe)
so none of this rlly, but still doesn't mean you shouldnt move away
yeah
oh fuck him if he's gonna be uneducated shitass he can leave it up his ass and keep it there
thats what u meant by "having not a good hsitory ?"
Yea
i thought u were blaming out of nothing lol
I was goign to start modding many years ago (7 to 8) but decided not to once I was banned by Lex.
no there were lots of controversies and stuff
reason
meteor client ahh dev
bro muted me cuz of nothing
I posted in IRC that I imagined Lex had a huge pulsating vein on his forehead
it was pretty much the only time I did speak in his IRC
pretty much all the stuff you'd do for forge would work on neoforge
neoforge isnt hard fork right now
im fckd up
what does hard fork mean
dude i wanna give up on my modding project and go follow up a different way
not relying on the upstream anymore for any updated commits, etc
basically being completely independent of the parent project you forked from
right now forge stuff works on neoforge because neoforge isnt a hard fork and maintains some compatability
its not like neoforge hard forked and revamped the system so forge mods wont work on it anymore
When making a skyblock server, should I make it so the island has the data like owner etc, so when a player wants to go to a island with a offline owner I just load the data?
hey quick question, how to regenerate a player ?
for example 2 hearts
or max health
hello you can send me the depencies for the Factions plugin ?
Yes here you go
dependencies : Faction
for maven pls
oh sorry
no problem bro
<dependency>
<groupId>Factions</groupId>
<artifactId>Factions</artifactId>
<version>Factions</version>
<scope>Factions</scope>
</dependency>
artifactId shoudl be lower case π
looks good to me
photographic memory doing me well
set their health, or add
Past 2 days been redoing maven structure for multiple modules kek
Anyways sorry for the bit, uh you should go to whatever factions plugin you're trying to get ahold of's git repo and see if they have their dependency information listed somewhere
love it when i get to patch a function again that already broke five times
@worthy yarrow do you know?
umm
but how do i add the health? how do i get player health for example
oh i can get tht
actually, how do i get his max health?
maybe if you actually start using the docs
attribute modifier
How to use base64 to make a custom player head?
i dont know
you dont know how to use the docs?
i dont think it would be easier to find how to set player's health to their max but imma try
anyone have any resources on rotational matrices? I want to spawn a particle on the right and left of where the player is looking at
buddy
Well I've managed to read the request just fine, but for some reason the client always ends up with java.net.SocketException: Unexpected end of file from server
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
ByteBuf in = (ByteBuf) msg;
final int magic1 = in.getUnsignedByte(in.readerIndex());
final int magic2 = in.getUnsignedByte(in.readerIndex() + 1);
if (isHttp(magic1, magic2)) {
while (in.isReadable()) {
System.out.print((char) in.readUnsignedByte());
}
HttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.NOT_FOUND);
ctx.write(response).syncUninterruptibly();
return;
}
super.channelRead(ctx, msg);
}
thanks boss
Read the docs man it really helps
deprecated
This is why we read documentation, I promise it helps
didnt see that
?jd-s
oki thanks
any way to modify a little of both x and z?
nvm i figured it out
i'll play around with angles
read
yes yes i red
read
so i should do it like that right?
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
?tas
i think its better to ask because there might be some mistakes
please like subscribe comment and forget to click.. π€‘
never actually clicked that video
actually I had not either
this would set their health to max
factual
yeah i know, thanks
it's saberfaction
What does that have to do with me?
does that affect your discord experience?
Or speech center?
does Player#hidePlayer hide the player from tab as well
yes
i dont get what you're saying π
how i can get my other files for configuration ? because know i do main#getconfig
from how many packet movements sent by the client in one tick it becomes too much (considered as spam)?
The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...
Yeah idk it seems the connection just always gets interrupted
sees syncinterruptably
Uninterruptedly aktually
Anyway if I remove that I still get the same issue
It either gets interrupted or it hangs forever
cant type that word
ah uninteruptably
guess i was blinded by all the other java bloat
π
anyone know how i would detect a players armor change?
like if they put armor on or took it off
@young knoll how develop papermc plugin /s
(intellij) is it better to create the project using the Generator: Minecraft or create a new project and implement the dependency of like for example spigot? or is there no difference except it's little more time consuming to do it manually?
exactly
yes last part
ok ty
if (event.getDamager() instanceof Player);
if (event.getEntity() instanceof Player){
Player a = (Player) event.getDamager();
Player p = (Player) event.getEntity();
ItemStack boots = a.getInventory().getBoots();
ItemStack helmet = a.getInventory().getHelmet();
ItemStack chest = a.getInventory().getChestplate();
ItemStack leggings = a.getInventory().getLeggings();
if (boots != null && helmet != null && chest != null && leggings != null) {
NBTItem nbtItem = new NBTItem(boots);
NBTItem nbtItem2 = new NBTItem(leggings);
NBTItem nbtItem3 = new NBTItem(chest);
NBTItem nbtItem4 = new NBTItem(helmet);
if (nbtItem.hasKey("armorsets-testset")) ;
System.out.println("boots have key");
if (nbtItem2.hasKey("armorsets-testset")) ;
System.out.println("legs has key");
if (nbtItem3.hasKey("armorsets-testset")) ;
System.out.println("chest has key");
if (nbtItem4.hasKey("armorsets-testset")) ;
System.out.println("helmet has key");
System.out.println(event.getDamage() + "old damage");
double tenPercent = event.getDamage() / 10;
double newDamage = event.getDamage();
++tenPercent;
event.setDamage(newDamage);
System.out.println(tenPercent + "tenpercent");
System.out.println(newDamage + "newDamage");
} else {
System.out.println("not full set");
}
}
}```
please dont grill me i know its bad i was just testing
is there any easier way to do this because it just crashed my server
Hey, I have this sign and I have a map scanner that spawns NPCs at the sign's location. One issue I keep running into is that the NPCs won't face the direction of the sign. Here's the code:
if (lines[2].equalsIgnoreCase("warrior")) {
if (sign.getBlock().getBlockData() instanceof Rotatable rotatable) sign.getLocation().setDirection(rotatable.getRotation().getDirection());
final WarriorKitNPC npc = new WarriorKitNPC(sign.getLocation());
} else if (lines[2].equalsIgnoreCase("archer")) {
if (sign.getBlock().getBlockData() instanceof Rotatable rotatable) sign.getLocation().setDirection(rotatable.getRotation().getDirection());
final ArcherKitNPC npc = new ArcherKitNPC(sign.getLocation());
}
this.serverPlayer.setPos(new Vec3(location.getX(), location.getY(), location.getZ()).add(0.5, 0, 0.5));
this.serverPlayer.setRot(location.getYaw() - 90, location.getPitch());
this.serverPlayer.setYHeadRot(location.getYaw());```
```java
NMSUtil.sendPacket(player, new ClientboundRotateHeadPacket(this.serverPlayer, (byte) (this.serverPlayer.getYRot() * 256.0F / 360.0F)));
NMSUtil.sendPacket(player, new ClientboundMoveEntityPacket.Rot(this.serverPlayer.getId(), (byte) (this.serverPlayer.getYRot() * 256.0F / 360.0F), (byte) (this.serverPlayer.getXRot() * 256.0F / 360.0F), true));
NMSUtil.sendPacket(player, new ClientboundSetEntityDataPacket(this.serverPlayer.getId(), List.of(new SynchedEntityData.DataValue<>(17, EntityDataSerializers.BYTE, (byte) 127))));
this.serverPlayer being the nms entity
Doh, turns out netty was swallowing exceptions again
Hi! Just a question. Will the "Recipe" provided by this event always be a ShapedRecipe, or could it be another type of recipe?
Thanks π±
can i get full mapping method names and not just these a,b,c? was it with the spigot or mojang mappings?
Mojang
how are client-server systems usually designed? (all the packet stuff)
They just
Send packets between eachother
If the packet is very important you could add verification that it made it successfully
(Or just let TCP do that for you)
what are packets? just a data class, and how does the client or the server know what to do with them?
At their core they are just bytes
Youβll probably use the first byte(s) as some sort of ID so the receiver knows what to do with it
is this compatible with bedrock realms?
do you think it is smart, to have normal classes in a commonly shared module?
instead of just bytes?
Well they have to be serialized to bytes either way
okay
How do proxies transfer players between servers?
And how do they reinitiate the packet login process each time?
If you just cache exactly what the player sent when joining the proxy, then what about the player's responses to custom backend packets?
And how do you know exactly when to resend each packet for each version?
When a player transfers servers on a proxy
The client thinks itβs a world transfer
Or at least it used to
And then the proxy changes which backend server it redirects packets to/from
since when can you do something like that with generics in methods?
at least since java 8
Holy mother of god
Thanks π±
did you also not know this?
Yeeee, do they now fully support restating the entire protocol, now that there's the Transfer handshaking intention
Also, how the hell does the client know when to send it
And when is it even sent?
Also, does the client resend any packets during a world change?
Cuz the server sure does
Very much
there's one place in spigot where that's also used, but I don't remember where. choco probably knows
it was some weird util class or sth
Now look at nms
Prepare to cry
why :(
found it
I think you can put the client back into the config state and itβll figure things out
Maybe?
to many generics
What did i wrong here? ServerPlayer entityPlayer = ((CraftPlayer) player).getHandle(); the error says Caused by: java.lang.NoSuchMethodError: 'net.minecraft.server.level.ServerPlayer org.bukkit.craftbukkit.v1_21_R1.entity.CraftPlayer.getHandle()'
Seems like you didnβt reobfuscate
hm?
?nms
When the player is dying why do i get this error?: Caused by: java.lang.IllegalArgumentException: Cannot get property BlockStateDirection{name=facing, clazz=class net.minecraft.core.EnumDirection, values=[north, south, west, east]} as it does not exist in Block{minecraft:air} at net.minecraft.world.level.block.state.IBlockDataHolder.c(SourceFile:97) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4226-Spigot-146439e-2889b3a] at net.minecraft.server.level.EntityPlayer.startSleepInBed(EntityPlayer.java:1354) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4226-Spigot-146439e-2889b3a] at net.minecraft.world.entity.player.EntityHuman.a(EntityHuman.java:1522) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4226-Spigot-146439e-2889b3a] at eu.sabermc.entities.CorpseEntity.execute(CorpseEntity.java:37) ~[?:?] at eu.sabermc.listener.PlayerDeathListener.onPlayerDeath(PlayerDeathListener.java:14) ~[?:?] at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?] at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?] at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.21-R0.1-SNAPSHOT.jar:?] ... 32 more Along this code: corpse.startSleepInBed(new BlockPos((int) bed.getX(), (int) bed.getY(), (int) bed.getZ()));
Why is this throwing null? ServerPlayerConnection connection = ((CraftPlayer) players).getHandle().connection;
Why is it giving me a null
1 sec
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "pl.monkee.Main.getCommand(String)" is null
i cant send photos
but
@Override
public void onEnable() {
main = this;
this.saveDefaultConfig();
GiveMiecz giveMiecz = new GiveMiecz();
new MieczListener(this, giveMiecz);
getCommand("giveMiecz").setExecutor(giveMiecz);
this.ladowaniePluginu();
}```
name: Miecz_Kresu_PROTOCODE
version: 1.0
main: pl.monkee.Main
commands:
giveMiecz:
description: dupa
thats the config
and
everything should be good
i think
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
can anyone help
if (a.getInventory().getHelmet().getItemMeta().getLore().getLast().contains(ChatColor.stripColor("full set bonus".toLowerCase())) && a.getInventory().getChestplate().getItemMeta().getLore().getLast().contains(ChatColor.stripColor("full set bonus".toLowerCase())) && a.getInventory().getLeggings().getItemMeta().getLore().getLast().contains(ChatColor.stripColor("full set bonus".toLowerCase())) && a.getInventory().getBoots().getItemMeta().getLore().getLast().contains(ChatColor.stripColor("full set bonus".toLowerCase())))
I know its long but it just doesnt work
im trying to check if the player has the full set on
if i use nbtitems it times out the server
anyway
the problem is
apparently the helmet doesnt exist
but it dies
does
I smell 1.8
getLast
don't think so
Then what is this nbtitems
Clearly pandaspigot
good sense of smell
if i remove getLast it says "no armor equipped" if i add getFirst it gives the error again
im gonna tweak
Why are you running stripColor on an uncoloured string
Or toLowerCase for that matter
if i remove both of those it still doesnt work
nbt makes my server time out
Then ur doing something wrong
How can I add a LibsDisguises dependency in my project?
There's this plugin called weapon mechanics https://www.spigotmc.org/resources/weaponmechanics-guns-in-minecraft-1-12-2-1-21.99913/
This plugin updates pdc of an item setting it without making the item pop back up on the item being updated
I tried doig the same by just reading a meta and modifying a pdc entry
However it causes the item to pop up
I'm frustrated cuz i have no idea why it works there
Simply prevent the item update to be sent to the client by intercepting packets
No need for the client to know all the pdc tags on an ItemStack
What dependency management are you using? Maven or Gradle?
guys, I'm sorry to say, I cheated on spigot
I made a java plugin for a program other than spigot
but I swear it's for a good cause
it bypasses youtube's api so livestreamers can merge their chatrooms from different platforms into one chat on screen
When making skyblock, should I make it so islands have their own database, and a player has a key that helps when teleporting home, or depositing to bank? While island has the owner, members, bank, sign commands, etc
Properties for the island are stored in the island data, properties for a player are stored in the players data.
Are you planing on using a relational database or a document database?
which one is the one where I manually write down the server state on a piece of paper?

sounds like it would be a document
does an event fire when a player regenerates hp?
Javadocs have a handy search box, you could trying typing things like health https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityRegainHealthEvent.html
Oh
I just saw it
i'm sorry ._.
sometimes my fingies are faster than my brain :(
Its ok, people take a while to get used to the documentation
wrote that shit like forever ago
search is a real BIG friend
i've been coding for like 7 years π
i feel so bad lmao
I have a bit more than 4 now. Time flies π₯²
only four? you doing this full time or why are you so good? lol
i'm doing it as a side hobby that sometimes gets more or less attention
Same, just as a hobby. Im still studying electrical engineering with a machine learning focus. So i write some C and Python there, nothing crazy.
I just went wild the first 2 years and i really like it. It replaced gaming for me π
So happy that i got accepted at the TUM for my CS master in a few weeks
How do I save a big list of blocks in the folder of the plugin? Preferably binary or something so it doesnt take too much space
tbh i'd just run them through dfu and save to nbt
now in english π
dfu is what minecraft uses for serialising stuff
DataFixerUpper?
yeah
but i think bukkit unsafe has some stuff for block serialisation?
lemme check
Right, uhm, wanna spoonfeed me a lil?
?jd-s
bukkit unsafe? π
yeah no it doesn't have that
i'm sure there are better ways than through dfu tho, i'm not sure if blocks are codecified yet
what the actual hell are you saying
π
man, skript was easier lmfao
Right i got this
now tell me
what is "save to nbt"
bro nah, Named Binary Tag?
nah what's this bruh
@blazing ocean wanna send me some code? βΊοΈ
i've never really worked with serialising blocks, but do you mean a list of block states or materials
One message removed from a suspended account.
All data about a block without it's cords, so that's block state right?
?changename
Name changes on the forums are granted to those who have donated to the project. Donations are processed manually and generally take up to 24 hours. The donation widget can be found on the home page of SpigotMC at: https://www.spigotmc.org/.
yes
One message removed from a suspended account.
blockstates then
One message removed from a suspended account.
MongoDB I believe, not sure yet
So non relational
What does the boolean in Block.getState() do? Either i'm stupid af or it's not in the docs
Where is boolean in block.getstate?
is it possible to define colors in the plugin.yml?
wdym
for example for the prefix
can i make the prefix displayed in the console colored?
no
also please don't try to
it fucks up a lot of consoles and logs
- screenreaders too, probably
sadge
why is that?
since you'd have to use ansi escape codes
and not all terminals and consoles support that
(and please don't even try to use chat colours)
ah i see
shhhhhhhhhhhh
only tried that with the logger
and that doesnt support colors
so generally, should all messages going to the console be un-colored?
(bc rn all of them are)
yeah keeping them like that is probably the best option
*colored
i mean
oops
ConsoleCommandSender sender = Bukkit.getServer().getConsoleSender();
sender.sendMessage(
PREFIX + formatColors("&aEnabling &6" + getDescription().getName() + " &7with &6v" + getDescription().getVersion() + "&7.&r")
);
``` something like that
mfw bedrock has components but no rgb support
bedrock π
or is this a nono?
when i tried that i had the &s in my log
and that is not something that should br happening
yeah but in your servers latest.log
...yeah
[10:20:35] [Server thread/INFO]: [0;30;1m[[0;36;22mAdmin[0;30;1m] [0;37;22m[0;32;1mEnabling [0;33;22mVanillaUtility [0;37;22mwith [0;33;22mv1.2.0[0;37;22m.[m[m
oh no
you see now?
can i strip colors for the console sender?
those are the ansi escape codes
oof
so that users get colored stuff but the server doesn't
just send users coloured messages, they support components
while the server logger doesn't fully
(i am aware paper has a component logger)
i mean what if a user has a colored name
