#help-development
1 messages · Page 984 of 1
LMAOOOOOOOOOO
i dont know HOW but i am going to use the term "uniboob" in a sentence one day
I think so
maybe specialsource doesnt support 21 yet?
doesnt sound right tho
i almost feel like this plugin can be de-NMS'd
intellij wtf do u mean 😭
how do u know the dependency but refuse to say its there
1.20.6 ?!?!!
oh it like bugged out or something bc i ran it for 1.20.5 but 1.20.6 is the actual vers i guess
suddenly realizing im too stupid for nms
the bare minimum should be running --remapped and then adding the spigot dependency right?!
how do i get rid of that annoying chat toast in the upper right everytime i load the client?
oh, my GUI code is just fucked and doesnt add the --remapped flag when i select it
forgot to add the code for ALL of these 💀
egads
so, this new component stuff is a bloody nightmare
for example, if you create an itemstack with various flags and lore and such, then give it to a player and then read the itemstack back and try to compare to the original it fails
it fails because default values are not in the actual item as far as I can tell
@real ridge is it required that the Gender enum needs the Component and SoundEvent code?
(ive been de-NMSing/rewriting the gender plugin for the last hour)
a PR is almost ready except for the Gender enum
does any1 know how you would go about getting the server's local time
just need to get the system time in java, right?
“Why gender is enum?!!??!?”
ikr there are only two
regarding this
🤫🧏🏻
Well, i'm stumped. If I create an ItemStack with various flags, and then give that ItemStack to a player, then read that ItemStack back and compare to the original, they will not match
Or at least that's what I think is going on
Are you using the API? If so, open a bug report with a clear reproduction of the issue
Just updating an economy plugin that has custom currency items that are created from information in a config file, then giving them to a user, then when they are read back for deposit, they don't match
This is what I'm seeing...
item ItemStack{DEAD_BUSH x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"text":"","extra":[{"text":"Gold Coin","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"yellow","bold":false}]}, lore=[{"text":"","extra":[{"text":"This is worth ","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"white","bold":false},{"text":"100x ","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"yellow","bold":false},{"text":"the base currency","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"white","bold":false}]}, {"text":"","extra":[{"text":"Earn more coins from jobs, quests or trading!","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"blue","bold":false}]}], custom-model-data=4, enchants={DURABILITY=10, KNOCKBACK=0}, ItemFlags=[HIDE_ENCHANTS, HIDE_ATTRIBUTES, HIDE_UNBREAKABLE, HIDE_DESTROYS, HIDE_PLACED_ON, HIDE_ADDITIONAL_TOOLTIP]}}: ItemStack{DEAD_BUSH x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"text":"","extra":[{"text":"Gold Coin","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"yellow","bold":false}]}, lore=[{"text":"","extra":[{"text":"This is worth ","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"white","bold":false},{"text":"100x ","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"yellow","bold":false},{"text":"the base currency","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"white","bold":false}]}, {"text":"","extra":[{"text":"Earn more coins from jobs, quests or trading!","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"blue","bold":false}]}], custom-model-data=4, enchants={DURABILITY=10, KNOCKBACK=0}, ItemFlags=[HIDE_ENCHANTS, HIDE_ATTRIBUTES, HIDE_UNBREAKABLE, HIDE_DESTROYS, HIDE_PLACED_ON, HIDE_ADDITIONAL_TOOLTIP]}}```
At the bottom, getting all the additional flags that are default I think
so they don't match
not even with isSimilar
Is my presumption correct that the changes are just the default flags?
maybe someone else can confirm.
Flags are different ig
my understanding is that defaults are different
SlicedLime said something about it in the video, I'll have to go watch it again
Just use persistent data container for ez fix
well, I could just make a custom serialized id and place it in the itemstack pdc and then check for that to determine if it is a matching currency to allow to deposit...
but itemstack matching not working worries me more
Yup
Defaults shouldn't appear in item meta. Create a reproducer and open a bug report please
I guess we can't assume anymore that an item's itemstack will not be changed from when it is created.
I will look into it, time permitting, got to sleep soon and work tomorrow
also getting some weird behavior with minecraft:lore and minecraft:custom_name showing up under components under block_entity_data. Not sure if that's my code just failing on this new release or what.
is there anything bad in having the same uuid when creating diffrent attribute modifiers?
i havent noticed anything bad but i just want to verify
when working directly with Netty, does it need to be shaded?
should be a no, right? since the it should be in the classpath when running the server?
abt to have a fairly big PR if this works
@real ridge
yeeee
made a PR @real ridge, https://github.com/dbrighthd/gendermodspigot/pull/1 :3c
there really is a mod for everything huh
Make player breedable
Dependency hasnt updated?
Could not resolve all files for configuration ':compileClasspath'.
Could not find org.spigotmc1.20.6-R0.1-SNAPSHOT.
how would i create a fake entity for a player and make the player ride that fake entity without being able to dismount
tits mod?!?!
make sure uve ran bt
ty
check your using java 21 for bt, 1.20.6 should be available for it
from my experience, that's a common issue in 1.20.5
however you should use PDC to detect custom items
instead of just checking equals(...)
Someone have or know how to do a plugin that recreate the maze of minecraft 1.21 and the wind chard??
If you know pls mention me 😄
does anyone know what the 2. parameter (boolean) does?
public PacketPlayOutWorldParticles(EnumParticle var1, boolean var2, float var3, float var4, float var5, float var6, float var7, float var8, float var9, int var10, int... var11)
version: 1.20.6, hash: 3ae9b09fea
thanks
Hey Guys
PacketContainer packet = manager.createPacket(PacketType.Play.Server.SPAWN_ENTITY);
packet.getModifier().write(0, entityId)
.write(1, UUID.randomUUID())
.write(2, bukkitEntityType.getTypeId())
.write(3, location.getX())
.write(4, location.getY())
.write(5, location.getZ())
.write(6, location.getPitch())
.write(7, location.getYaw())
.write(8, location.getYaw())
.write(9, null)
.write(10, 0)
.write(11, 0)
.write(12, 0);```
this aint no work
Umm..? Context?
Try sending the packet
i sent it
nothing happened
[11:22:52 ERROR]: #!#! Stack trace:
[11:22:52 ERROR]: #!#! java.lang.IllegalStateException: Unable to set value of field private final net.minecraft.world.entity.EntityTypes net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity.e
[11:22:52 ERROR]: #!#! at ProtocolLib.jar//com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor.set(DefaultFieldAccessor.java:44)
[11:22:52 ERROR]: #!#! at ProtocolLib.jar//com.comphenix.protocol.reflect.StructureModifier.writeInternal(StructureModifier.java:358)
[11:22:52 ERROR]: #!#! at ProtocolLib.jar//com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:321)```
So I was making a ban plugin, and I wanted to store every ban in a yml file, with banner and reason for the ban. It must work even if the player is offline (bans them anyway). I also added that if a player sends the command /banreason <player> it gets the reason out of that yml file. But I’m getting some problems with this yml file I can’t make it work nor generate it in a folder with the bans. Can anyone please look at my code? Thanks guys. https://paste.md-5.net/yajedumapi.java
btw dont kick the player on join, use join results
use UUID
and use uuid like buoobuoo said
and is that 2 plugins inside 1 plugin
lol didnt even see that
It’s technically 1
no its 2 lmfao
you're using 2 JavaPlugins, which is incorrect
BanPlugin class should just be standalone command handler
no point in it being a JavaPlugin
you should implement CommandExecutor for commands not javaplugin
why does javaplugin even have onCommand
Which one
make BanPlugin implement CommandExecutor not extend JavaPlugin
I get some errors
And register your PlayerJoin listener on the onEnable() method, not on his own constructor (or at least call it somewhere)
what errors?
Method does not override method from its superclass
remove onEnable and onDisable
wait im confused
did you make Permissions class the main class rather than the actual main class
No BanPlugon was the original main class
getCommand("banplayer").setExecutor(new BanPlugin(this));
getCommand("banreason").setExecutor(new BanPlugin(this));```
that looks like a command to me
BanPlugin is the main class for some reason, it cant be instantiated
you're only ever supposed to have 1 instance of JavaPlugin
Ive followed a tutorial online
From someone on yt
your PErmissions class should be your main class
But, guys, I now made Permissions the main class
private Permissions plugin;
public BanPlugin(Permissions plugin) {
this.plugin = plugin;
}```
this doesnt look like BanPlugin is the main class
wtf
What should I do now
also ur using bukkit's banning system
which is already tracked
you need to implement ur own banning system
How?
private Set<UUID> permBanned = new HashSet<>();
public void onLogin(PlayerLoginEvent e) {
if (permBanned.contains(e.getPlayer().getUniqueId())) {
e.setKickMessage("&cYou're perm banned!");
e.setResult(PlayerLoginEvent.Result.KICK_OTHER);
}
}```
something like this should work
for temporary bans u have to either make a task that countdowns every second (laggy and doesn't countdown when the server is offline) or either store the time the ban will be gone and subtract the current time with that and if the output is 0 or lower then that guy should be unbanned
Should I just delete all the code I wrote and replace it with this?
not all the code, some code can be used like the ones in the command but you should replace the ban system with that
and to ban someone you do permBanned.add(target.getUniqueId());
and to unban u just do the opposite by doing remove
What should I remove? I’m sorry if I’m asking too much but I really can’t resolve it
private Map<UUID, Long> tempBanned = new HashMap<>();
public void onLogin(PlayerLoginEvent e) {
if (tempBanned.containsKey(e.getPlayer().getUniqueId())) {
long difference = tempBanned.get(e.getPlayer().getUniqueId()) - System.currentTimeMillis()
if (difference > 0) {
e.setKickMessage("&cYou're temp banned for " + difference + " milliseconds!");
e.setResult(PlayerLoginEvent.Result.KICK_OTHER);
}
}
}```
this is how a tempban would work
im cleaning ur code, give me a sec
yeah i cant clean the code, its too messy
you're prob gonna have to rewrite it with a proper tutorial
look at plugins like advancedbans' source code to get an idea of how you're going to do it
also
how do i spawn a entity with a saddle through protocollib
private List<WrappedWatchableObject> saddledMetadata(org.bukkit.entity.EntityType entityType) {
WrappedDataWatcher metadata = new WrappedDataWatcher();
if (entityType == org.bukkit.entity.EntityType.HORSE) {
metadata.setObject(
new WrappedDataWatcher.WrappedDataWatcherObject(
17,
WrappedDataWatcher.Registry.get(Byte.class)),
(byte) 0x04
);
} else if (entityType == org.bukkit.entity.EntityType.PIG) {
metadata.setObject(
new WrappedDataWatcher.WrappedDataWatcherObject(
17,
WrappedDataWatcher.Registry.get(Boolean.class)),
true
);
} else if (entityType == org.bukkit.entity.EntityType.STRIDER) {
metadata.setObject(
new WrappedDataWatcher.WrappedDataWatcherObject(
19,
WrappedDataWatcher.Registry.get(Boolean.class)),
true
);
} else if (entityType == org.bukkit.entity.EntityType.LLAMA) {
metadata.setObject(
new WrappedDataWatcher.WrappedDataWatcherObject(
20,
WrappedDataWatcher.Registry.get(Integer.class)),
14
);
}
return metadata.getWatchableObjects();
}
packet = manager.createPacket(PacketType.Play.Server.ENTITY_METADATA);
packet.getWatchableCollectionModifier().write(0, saddledMetadata(bukkitEntityType));
for (Player player : players) {
manager.sendServerPacket(player, packet);
}```
this throws this exception: https://paste.md-5.net/otojucowor.bash
Hello! Anyone has any idea if there is a way to inject a custom DataFixer into the internal code?
i don't think it's possible without modifying spigot
spigot api does not provide api for that, but I reckon reflecting it may work sufficiently
Schema schema = DataFixers.getDataFixer().getSchema(DataFixUtils.makeKey(SharedConstants.getCurrentVersion().getDataVersion().getVersion()));
TaggedChoice.TaggedChoiceType<?> choice = schema.findChoiceType(References.ITEM_STACK);
This is my current code, no idea how to go further
?xy
what slot is the saddle for horse is?
can't you just .setSaddle ?
it's for a fake horse using protocollib
you can do per-player entities using Entity#setVisibleByDefault and Player#showEntity
no like, i want the entity to not exist server-side as well
so if the server suddenly crashes these entities dont just exist
add Entity#setPersistent(false) then
No
They are just not serialized on stop
doesnt that do the same thing..
@wise rock well I think for starters u prob wna reflect into DFU right? and add ur fixed to the globalList and fixerVersions
you may also want to "recompute" the rules map
(maybe there is a more sophisticated way to deal w it but yea)
not the same
either way the entity wont exist when the server restarts
Why serialize an entity that you will kill on start???
anyways is there a method to make the entity die when the player leave as well without listeners?
?
i want to link the entity with a player so when that player leaves the entity dies
declaration: package: org.bukkit.entity, interface: Entity
if it doesn;t persist its never saved, so anythign that causes the chunk to unload results in teh entity going poof.
Linked how?
idk
PlayerQuitEvent -> entity.remove()
Linked to all players or per player?
per player
Use a Map
last question, if the chunk isn't loaded and the player leaves then the entity doesn't poof away, is there a way to fix that?
also sorry if i'm annoying
Entity#setPersistent(false)
oh wait im dumb
viewing players not in range = entity goes poof
PlayerQuitEvent, get the entry of the player and remove the entity, then remove the entry on the map
If you want the entity to be removed when the chunk unloads, just setPersistent(false) (I think this is how persistent works)
aight
thank you! Will check when I have time! I didnt realize that you would make an entire PR lol
honestly, neither did i, i just ended up getting way too deep into an idea
I used to write a custom NBT tag "itemsadder" into the root of the ItemStacks.
I want to move the "itemsadder" tag into the "custom_data" since now the root NBT doesn't exists anymore in items.
To do so I had the idea to code a custom DataFixer to let the game handle that, because I doubt there is any other way to intercept items loading and fix that data.
Surely this is not available in the API
let me check, interesting, thanks
Why ae you not just using the PDC?
doesn't minecraft already translate foreign tags into the custom_data component? 🤔
that's like, the whole point of it
nvm, seems Minecraft is already doing that under the hood, I will have to test: ItemStackComponentizationFix
yep
i thought that it would strip them out
good news then, thanks a ton
Entity#setPersistent(false) doesn't kill the entity if the chunk is unloaded
if the chunk is unloaded, so is the entity
unless you mean when the chunk is unloaded
it isn't killed, no, just removed
see EntityRemoveEvent and its Cause
so there isnt a way to kill the entity when the chunk is unloaded?
What do you mean kill
poof the entity
it comes back for me
im not talking abt server restarts, the entity is gone when the server restarts but if i leave (the chunk unloads) and i try to do Entity#remove, it doesn't remove it and setPersistent(false) doest delete it
when are you doing setPersistent(false)?
how would i cancel VehicleMoveEvent without whatever the damn this is happening
That jerky is just the client predicting the movement and being reset by the server
probably disconnect the player from the horse and read steerage packets for it
ok
what if i just teleport the vehicle to the past location..
oh wait u cant cuz it dismounts u, rip
Does anyone know how to make text copy-able in chat by clikcing it? I noticed this functionality in the driveBackupV2 pluigin where I could click on the verification code and it would copy it to clipboard, and I want to replicate this functionality in the broadcast coordinates plugin, but I have no idea how it works, I could not find anything.
<gold><click:copy_to_clipboard:'<link-code>'><link-code></click></gold>
how I can get the speak from the player that joins the server?
ComponentBuilder my beloved
whats a good way to teleport an entity with its passengers?
im doing this pvp damage tracker plugin, but im having problems with registering potion damage. everything else seems to work but i cant seem to get the potion thrower's UUID. I need for my calculations. here are some methods I've tried https://paste.md-5.net/aluyegaxoh.java
it always goes to the else part that I left there just for my debugging reasons
can anyone help with this?
tp both of them back
u cant tp a passenger nor a vehicle
yea u can? 😭 its just an entity
You can't teleport entities with passengers iirc
aka a vehicle
the thing is im stopping players from dismounting, ur supposed to be stuck on it.. FOREVER
i can kill the entity then respawn antoher one
so? Theres million workarounds how you can make your code ignore the dismount for that fraction of time
like?
like u could give the player some data and on dismount check if they have that data and then ignore
good point
or you could cache the player in a list and ignore cached players
or make a set of uuids to ignore
or or or
yh thats caching
yeah ik
u can just use a try catch
genius
using uuids is way slower as you need to convert it
also
offline player object exists
👏
which u can cast to online player as soon as u need it
i wouldnt even need online player object?
.
u can do offlinePlayer.getPlayer
will return null if they are offline
iirc
or throw exception
i was hesitant with try catch too when i started with spigot but
after a year
i realized they are actually very useful
#bot-commands
how I can get the lang from the player that joins the server?
the what?
u cant
Wasn't there a way to get their locale
he means language i assume
yeah but thats not language
that is?
and the way to get their local is ip
someone can have a vpn or live in a country which’s language they dont speak
I think they do mean their in-game language
there is no way to retrieve what language someone set in their client
yh that’s impossible
well as i said that can be retrieved through IP
What about
That always return "en_US" 😦
Oof
„the value of the local string is not defined properly“
proxycheck.io is a premium Proxy detection API with a full featured free plan. Try us today!
en_us or en_ca are most certainly locales that represent languages
en being the language, us/ca being the localization of it
it's called locale because it's localized
unless you're telling me de_de isn't german
i'd be shocked
Should i make my own way of pasting schematics or just use world edit?
pasting schematics requires nms?
Parsing them does
oh
Well, you could use something like JNBT but you'd still need NMS to handle block entities
then world edit is probably the way i guess
i'm prolly overestimating the performance impact but like how negligable is smth like this
(pseudocode)
fn cacl_level(total_exp: int, levels: List<int>) -> int {
for (index, level_req) in levels {
if total_exp < level_rew {
return index;
}
}
}```
running for every player every 10ish ticks (not in the same tick)
levels is relatively small about 1000 max
It depends on the amount of players, what r u trying to do maybe there is a cleaner solution?
store the player's exp in terms of it's total
and then calculate the level on demand
that's the cleanest solution, the next step is to add caching
Just store it when it changes?
No need to store every 10 ticks
you can't; you can, however use a resourcepack with translation files and use translatable components in your plugin
Actually you can
The client does provide that info
declaration: package: org.bukkit.entity, interface: Player
.
🤷♂️
it works fine if you have the client properly configured in your client lol
it will also work as long as you aren't using a shitty client that doesn't send that info
something something badlion
it certainly works with the vanilla client if you change your locale
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>sk89q-repo</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.0</version> <!-- Replace with your WorldGuard version -->
<scope>provided</scope>
</dependency>
</dependencies>
</project>
You probably have to relog if you change it
Can anyone help me figure out how to get the worldguard API, I have tried to follow the docs for it but can't get it to work
no, the client sends it again
You should explain what "can't get it to work" means
unless you're using a shitty client that isn't vanilla :D but that isn't a Minecraft issue, that's a shitty client issue
Oh, sorry, Well I cant get it to find it at all, it just seems unable to find the dependency im not sure if im missed anything
I know the bukkit dependency doesn't work either, because I can't seem to find the correct version of it for 1.20.4 which is the mc version im on, but the worldguard only seems to show up when the bukkit dependency is there, even though it cant find the bukkit version correctly
If you use intellij, a small blue maven icon on the top right should appear in your pom.xml. Click on jt
You need to send your pom if you want help with deps
?paste
https://paste.md-5.net/ucigojemik.xml
I've removed it for now since it wasnt working, but I am trying to add worldguard
I have pressed the maven reload button it still wont show up as a valid dependency
I restarted my IDE, and now the actual thing for worldguard shows up but not the correct version even though ive double checked on the worldguard site and this is the version to use for 1.20.4
Ignoring the fact your java version is unsatisfactory for spigot 1.20.4 looks fine
Se3ms like intellij being weird
Try compiling from the command line with maven
If it works it's intellij invalidate your caches
I just tested, idk why I was convinced Player#getLocale return alwas "en_US" but it work perfectly
What do I need to change to resolve this then? Sorry I am like very new to doing plugin development
When sending a lot of packets should I use a runTaskLaterAsynchronously, to ensure that the client receives packets one at time?
Some people in forum told that they were getting kicked out of the server without a runTaskLaterAsync, so the packet would be send after some time
Hello, i am trying to get into plugin development with spigot and wanted to get the .jar-file by building it with the build tool (.exe) but ran into a missing dependency error with maven. Does anyone know how to fix this?
looks like it cached a failure to download a dependency
Normally you'd use the -U flag to force it to check again
but it might be a bit trickier with BuildTools
You can delete the cached org.apache.maven.plugins:maven-compiler-plugin from your local .m2 repo
sorry, I don't really know a lot about maven. Wher can I find this .m2 repo?
C:\Users%username%
shoul I just delete that and run again?
Sure
it seems to have worked this time. I passed the section that didn't work. Thank you very much!
Next error:
[INFO] Reactor Summary:
[INFO]
[INFO] Spigot-API 1.20.4-R0.1-SNAPSHOT .................... SUCCESS [ 21.406 s]
[INFO] Spigot-Parent dev-SNAPSHOT ......................... SUCCESS [ 0.011 s]
[INFO] Spigot 1.20.4-R0.1-SNAPSHOT ........................ FAILURE [ 47.095 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:08 min
[INFO] Finished at: 2024-04-30T18:27:19+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal net.md-5:specialsource-maven-plugin:2.0.2:remap (remap-members) on project spigot: Error creating remapped jar: The following artifacts could not be resolved: org.spigotmc:minecraft-server:csrg:maps-spigot-members:1.20.4-R0.1-SNAPSHOT (absent): Could not find artifact org.spigotmc:minecraft-server:csrg:maps-spigot-members:1.20.4-R0.1-SNAPSHOT in minecraft-libraries (https://libraries.minecraft.net/) -> [Help 1]```
Hey guys
Just a question, they told me to use getUniqueId to ban players instead of using target and players
How would I do that?
I want to ban online and offline players
Doesn’t matter
?
Maybe lemme rephrase it with more context
I’m making a ban plugin, and those banned players must be stored in a .txt file where if I want to check, I could just do /banreason and get the reason for the ban, or do /isplayerbanned and see if the player is effectively banned. So I started over writing the plugin I already made bc it was too messy
They told me to use getUniqueId instead of Player player = blah blah blah
How would I do it?
Wait, that's wrong
Why?
Give me a minute
does anyone here know how to use ByteBuddy?
?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!
I asked the question
Player playerlol = Bukkit.getPlayer(args[0]);
playerlol.getUniqueId();```
I'm guessing this could work
Pretty new to this myself
No need for a for statement right?
the error and code
Well here's the actual question
oh
I might be using the class loader
I think I see it now
Not really but I think it will throw an nullpointerexception if the player is offline
don't know how to solve it exactly tho, let's see
How do I prevent this?
Player playerlol = Bukkit.getPlayer(args[0]);
if (playerlol != null) {
UUID playerUUID = playerlol.getUniqueId();
} else {
// Player is offline
}```
Player playerlol = Bukkit.getPlayer(args[0]);
if(playerlol != null) {
playerlol.getUniqueId();
} else {
//
}```
This should work
I’ll write the code now, if I understood correctly
Sure
@quaint mantle do you know the cause of this error and how to fix it?
Give me a minute, I'll be with you
Did you try deleting the .m2 folder?
I did and it solved the first error I sent, but then this popped up
is the player PDC decent enough for data storage?
Or should I prefer to opt for custom db
depends on the data
Hm?
It depends on what data you want to store and when you need to access it.
well the data is stuff like custom player statistics and level etc
i'd onyl need ot access it when the player joins the serber
level and statistics already exist. You are creating more?
then so long as you don;t need it when they are offline, PDC is fine
you can't read pdc when the player is off?
no
I forgot to delete the other files that were generated with the wrong .m2 rep but after doing that and running it again, the whole thing worked.
You technically can
You could also turn MC into a space simulator, technically.
when getting something from config is the second argument the default?
Yes, generally
alright
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/configuration/MemorySection.html#getInt(java.lang.String,int) Example method from the docs
was just asking cuz the names arent exactly explenatory
get(String path, Object default)
Why can't I increase the render distance when I have the paper spigot engine installed? I tried to do it in server propeties, but it doesn't work, and when I change it in the spigot files, after restarting the server, the low render distance setting returns.
stop the server, modify settings then start
PaperSpigot hasn't been a thing for ages
but when I restart the server, all the settings I changed return to their initial state and I have a small render distance again
dont change the settings while its running
change them while its stopped
but also yh
it doesnt help
dont use paper spigot
but i want plugins
then use paper OR spigot
not paper spigot
PaperSpigot is outdated and was never good in the first place
paper spigot is paper mc
paper spigot got updated to papermc
no it literally is
yeah but people knew them from 2012 so still use the oldname
PaperSpigot is 1.8 paper, afterwards it's just papermc
thank you for saying the same thing a third time
Well it's still the correct name to referr to 1.8 paper if you need to
what the fuck
is up with bytebuddy
I've tested every single syntax
and this mfo still says "nah"
ByteBuddys strength is its Javaagent
None of [public static void shadow.systems.interception.AlixEventInterceptor$Interceptor.intercept(java.lang.Object[],java.lang.reflect.Method,java.lang.Object)] allows for delegation from public void net.minecraft.server.players.PlayerList.a(net.minecraft.network.NetworkManager,net.minecraft.server.level.EntityPlayer)
like the fuck you mean
Where does you plugin need to run on?
what I'm going after is to suggest the use of ignite or similar bytecode manipulation frameworks
do you know bytebuddy?
never used it
mmm'
intercept a method invocation
In that case, what I'd try is to generate a bog standard proxy class via ASM like (this one is for the bukkit unsafe, which is an interface, but the same would apply to all other classes) https://github.com/Geolykt/EnchantmentsPlus/blob/4xx/src/main/java/de/geolykt/enchantments_plus/compatibility/hackloader/Hackloader.java#L83-L180
The idea is that you delegate all public and protected methods to the real implementation and intercept the method you wish to intercept.
The only issue would be package-protected methods though
that method is public
and I don't understand anything
in the code you just showed me
so it's not much of a help
private methods don't need to be stubbed, nor do non-public/protected fields need to be copied over (they can simply be left empty and your proxy class would be created using Unsafe's allocateInstance).
like injecting code before/after a method call or straight up altering the implementation of a method?
The idea is to generate a class of following layout
class ProxyClass extends ProxiedClass {
public ProxiedClass x;
@Override
public void methodA() {
x.methodA();
}
public void interceptMethod() {
if(!InterceptHandler.handleIntercept()) {
x.interceptMethod();
}
}
}
before a call. Just intercept when it's invoked, stop the invocation, and invoke it later on when I need it
the most important bit is that you don't copy over the internal state of the object but rather forward to the object
I don't know how to do that
you can spout whatever
I still have no idea how to implement that with ASM, ByteBuddy, whatever
I don't have any experience using those
and the documentation doesn't help
I'll try to write some psuedocode then
I have a question guys
When making a field inside of a class, is it protected by default?
or is it public/private
it's package-protected, so neither
it's package-private
ohhh
Yes. package-protected means only accessible in package
okay, so if i were to make a new object that inherets it in a different package, it wouldn't be able to access it?
so package private is less visible
yes
👍
that's super helpful
note that nested/inner classes still have access even with private
okay, i figured so
can i have an example of a use-case for it?
where package-private would be better suited than protected
mostly only classes where inheritance isn't a thing anyways
okay, so i'd probably rarely ever have to think about it then
However when you talk about usecases then there are only usecases for public but none for other visibility modifiers, so be a bit careful with that train of thought
the idea is usually to go with the least access necessary
How can i see how many downloads a spigotmc resource has?
Thanks
Hello! I have made a plugin where player can spit like llama when he writes /spit. I have also made a GUI where player can choose any additional particle that will spawn with spit to create more effects. I have created SQLite Database which collects info about player's choice. But now when I choose anything in GUI it just gives error's or just choosing "hearts" particles even if I choose anything else. Can somebody help please with database. I had before all data saves in config, but when I moved to database I have this problems.
My code: https://paste.md-5.net/xocijiciyi.java
My errors: https://paste.md-5.net/akofehasem.sql
https://gist.github.com/Geolykt/9fece8145e7f7f37a4d4fcc5f6c8411c#file-gistfile1-txt-L237-L240 @grim hound is what I was thinking of. Just beware that this assumes that the proxied class has a no-args constructor but even if that is not the case you'd only need to adjust the constructor descriptor and add some dummy objects on the operand stack as needed and you should be good to go
uuuuuuuuuh
I've really never used ASM
I friggn love ASM. Best invention since sliced bread
like I said
I have no idea how to use it
https://paste.md-5.net/asasominos.java this is my code
Damn ASM became a concept 22 years ago...
and this is the method
(in some versions they don't have the third argument, it's weird)
how would you adjust it
I wouldn't know. Especiall https://paste.md-5.net/asasominos.java#L62 is a huge red flag for me.
My idea and your idea are completely different. What you are intending for is to copy the internal state of the object. While I would proper wrapping the object
what is the difference between JavaPlugin#saveResource, YamlConfiguration#save
I also wanted to do that
but because I don't know how I settled on this
The first one saves any file inside the jar, the second method saves the yaml configuration
Could the first be applied to a yaml config? (Not that you would just curious)
i have custom yml file inside of my src/main/resources folder and im trying to save it to the plugin folder but i guess i made a mistake
public File reloadFile() {
File file = new File(plugin.getDataFolder(), "custom-heads.yml"); // Initialize the file here
YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
try {
Reader defConfigStream = new InputStreamReader(plugin.getResource("custom-heads.yml"), "UTF8");
if (defConfigStream != null) {
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
config.setDefaults(defConfig);
saveFile(config, file);
return file;
}
plugin.getLogger().severe("Failed to reload file: "+"config reader is not defined");
return null;
} catch (UnsupportedEncodingException e) {
plugin.getLogger().severe("Failed to reload file: " + e.getMessage());
e.printStackTrace();
}
return null;
}
// tested
private void saveFile(FileConfiguration fileConfig, File file) {
if (fileConfig == null || file == null) {
plugin.getServer().broadcast(ChatColor.RED + "Failed to save file!", "OP");
return;
}
try {
fileConfig.save(file);
} catch (IOException e) {
plugin.getLogger().severe("Failed to save file: " + e.getMessage());
}
}
maybe im trying to getting resources is which is not defined in java code
[21:29:48] [Server thread/ERROR]: Error occurred while enabling MileniumCraft v1.0 (Is it up to date?)
java.lang.NullPointerException: null
at java.io.Reader.<init>(Reader.java:167) ~[?:?]
at org.bukkit.craftbukkit.libs.jline.internal.InputStreamReader.<init>(InputStreamReader.java:95) ~[spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at me.erano.com.skull.SkullService.reloadFile(SkullService.java:157) ~[?:?]
at me.erano.com.skull.SkullService.<init>(SkullService.java:38) ~[?:?]
at me.erano.com.Plugin.registerServices(Plugin.java:40) ~[?:?]
at me.erano.com.Plugin.onEnable(Plugin.java:27) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~
at
What is the best ide for Minecraft development? IntelliJ Idea or Eclipse?
IntelliJ, however, an ide is an ide and tbf you only need a notepad to code
Okay good because that's what I'm using now
If you use eclipse, you should just hope you know what you're doing 😄
intellij is better
Can eclipse gifs blind you kekw
it's SUBJECTIVE don't even start this discussion yall
nah closing ide for switching project is boring
They feel like they can
magic system
epic items
custom mobs
but no levels
I want to do something with a leveling system of sorts
don't
just do skills
and like item ranks
I've been thinking about it for a long time
do something with raids
make them fun and interesting and fun and
annnnnd stuff right?
Some sort of pseudo factions system with a couple twists would be cool
i've had the idea of making a raids plugin for a while but never got my hands on it
maybe you could do something incredible with this idea
i'm talking about village raids btw just in case
Hmm
Well towny already has siegewar but that's pvp, in terms of village raids... what about a fallout style raid where when started, there's an underground vault where you have to go through and clear out enemies, get loot, etc... so in a way it's like a dungeons system
You can do that certainly
in my mind I had something with custom mobs, pathfinding, rewards, etc
your idea also sounds cool
I just know dungeons are kinda hot right now
you can build on both of these
yesss
Hi
ahem

Guys could anyone help me? So I’m making a ban plugin, I already made one but I am now implementing/isplayerbanned and /banreason <player> with file txt where these info can be stored and retrieved, I had to delete all my code for this
So I’m starting over
Someone here suggested me to be able to ban offline and online players, it’s better to use getUniqueId
Instead of using Player player = blah blah blah
java.lang.NullPointerException: null
at org.bukkit.craftbukkit.libs.org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2146) ~[spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at org.bukkit.craftbukkit.libs.org.apache.commons.io.IOUtils.copy(IOUtils.java:2102) ~[spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at org.bukkit.craftbukkit.libs.org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2123) ~[spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at org.bukkit.craftbukkit.libs.org.apache.commons.io.IOUtils.copy(IOUtils.java:2078) ~[spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at me.erano.com.SkullService.loadDefaultFile(SkullService.java:164) ~[?:?]
at me.erano.com.SkullService.<init>(SkullService.java:40) ~[?:?]
public File loadDefaultFile() {
File file = new File(plugin.getDataFolder()+ File.separator + "custom-heads.yml");
YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
if(!file.exists()) {
saveFile(config, file);
}
try {
InputStream in = plugin.getResource("custom-heads.yml");
OutputStream out = new FileOutputStream(file);
IOUtils.copy(in,out);
out.close();
}catch (FileNotFoundException e) {
e.printStackTrace();
}catch (IOException e) {
e.printStackTrace();
}
return file;
}
// tested
private void saveFile(FileConfiguration fileConfig, File file) {
if (fileConfig == null || file == null) {
plugin.getServer().broadcast(ChatColor.RED + "Failed to save file!", "OP");
return;
}
try {
fileConfig.save(file);
} catch (IOException e) {
plugin.getLogger().severe("Failed to save file: " + e.getMessage());
}
}
when you use .getString() on a config file does it cache at all?
How do I actually do this?
That’s my question
OfflinePlayer#ban
read second to last pinned msg
And not getUniqueId? Bc I want also that the player must exist, and not a random name
So it must also check if it’s a real username
if you get an offline player by UUID and they do not exist it wil;l have an empty name
well I believe it will be null not empty
what you mean by cached.
thanks
getString() reads the config file
So if (OfflinePlayer.getUniqueId == null) { sender.sendMessage(“Player Doesnt Exist)
}
?
so
no
an offline player will always have a UUID
And what if that offline username doesn’t exist
get an offline player by a uuid who does not exist and they will have a null name
Embedded resource cannot be found error xD
So like this?
there is method named by saveResource on JavaPlugin but its cant read files which is located in src/main/resources
I don’t get it
can anyone help me with reflection?
im making a custom items plugin and all the items are in seperate classes in one big package. whenever theres a detected use of an item, i have to check if its a custom item. for that i have tk loop thru every file, get their namespacedkey variables and check if the used item matches. so idk how to loop thru the files and idek if thats the most efficient way of doing this
check your custom items using PDC
which version are you on?
Havign a class per item is not a good design
yeah to do that i have to loop thru the files and get the custom items pdc see if it matches with the used item
and if it does do the thing its supposed to do
you can load the list of keys into a List or Set or whatever in onEnable
theyre big items like with their own descriptions, functions etc i thought that was the best way of doing that?
put all yoru items in a Map using the NamespacedKey, then theres no looping
thats too much work thats the thing isnt using reflection just more efficient?
or: Why you should NEVER use NBT tags again! Spigot 1.14.1 added the biggest improvement that (in my opinion) ever made it into the Bukkit API: The Persistent Data Container (PDC). It can be used to store custom data on Entities, TileEntities, and ItemStacks. Using a bit of math, it can also be used to...
that's bulllshit
and loop thru all classes that extend that class
terrible design
yeah that won't work
im using it already god damn
bro
whats the best design
then why do you extend ItemStack?
theres much more flexible and useable design
CustomItem@is my own class
simply adding a PDC tag to your custom items
BRO
I GET THAT
but to know which item it is
i have to check which item PDC it matches with
a Map
you check which tag it has
so thats why i need to loop thru the items and get their pdcs
yes
hello, what is the difference between AttributeModifier.Operation.ADD_NUMBER and AttributeModifier.Operation.ADD_SCALAR ? (and it's possible to have an explanation of AttributeModifier.Operation.MUTIPLY_SCALAR_1 ?)
if you are checking the item they used you only have ONE item to check
bro i need to loop thru all the custom item tags and check which ones match. thats why i want to loop thru the classes to get each items' tag and then do whatever
not if they are in a Map
ADD_NUMBER = 1+2 = 3
ADD_SCALAR = 1*2 = 2
Multiply_Scalar_1 = idk
but thats way too much work tho
so whats the best design if i dont make seperate classes for each item
then its gets clustered up
cause i have like 20 itsms
PDC dude, I already told you 12 times
which its own everything
only 20?
dude
PDC
no
no, you are just not listenign to anyone
but apparently you're using it wrong
that have the items' itemstacks
throw them away
your classes are rubbish
okay so how do i sort them
cause thats the cleanest way i can think of
when i do it in 1 class the code gets flustered up
create an item builder
or clustered
i tried that but i have a skill issue
thats also kind of what CUSTOMITEM class is since all items have different functions i didnt know how to make a general builder
so i made an abstract class with functions like getItem() getFunction() etc
how would i make specific players not see someone else's armor
idk nms
In this video I explain why PS3 emulation is so fast, and I definitely don't spend half of the video gushing over x86 instructions.
I sort of made this video as a response to all the videos with a title along the lines of "why is the PS3 hard to emulate" without actually going into any technical details beyond "the PS3 is complex".
Additional ...
wtf
😂
how do i make an item builder @eternal oxide
a sample ItemBuilder https://gist.github.com/mio9/743c192e926db9e2d580140753157dc5
add in a PDC tag and you are done
an item builder is really not that useful if you don't have custom items
unless u want quick items like gui items but that's usually 2 lines and mostly constants like frame which is a black stained glass pane named " "
thanks 🙏
i have custom items haha
ah
Does this task run every 20 seconds?
new Task().runTaskTimer(this, 0L, 20L * 20L);
or is the max i can put 20L in the period parameter
no it runs every tick
i wasnt to execute smth every 20s
that does indeed run every 20 seconds
oh i didnt see the * 20
ok nice
is there a way to make scheduled events
ty
like i want something to happen every 6PM EST on sunday
how do i make that work for example
Why is Bukkit.getWorlds just retarning me "world" when other worlds are created?
Don;t use the Bukkit scheduler
yeah
tasks arent the way to do that
actually.. you can use a task for that
no because what if the server resets
a task that runs every second and checks if the current time is 6PM EST
isnt that unnecessary? i thought there were better ways
can't he get the time and calculate when to run the task and then use runLater() ?
thats wayy less efficient
but if the plugin resets then its fucked
i mean it gets calculated o nstart
You can do that when the server starts
so it is efficcient
don;t rely on ticks for acurate timing
true what if tps is like 9tps
but then if the server neevr restarts for 2 days then it only triggers once
oto much calculations
literally 2
what if u run it for 100 years
i think the stack overflow page elgar sent is cool but it needs some tweeks in thid case
why would yo uneed to run it for 100y XD
what if its a nasa server
that comuniminiucates with whatever the fuck theyre sending to space
that always gets lost
Use the ScheduledExecutorService
?
wait you can do that with spigot
that's sick
Player#sendEquipmentChange
but how would i send that abunch of times so that if u change ur armor it doesnt fuck it up and without looping all players every second
You can use the armor equip event library to detect armor changes
flippin genius
wouldnt cancelling PacketType.Play.Server.ENTITY_EQUIPMENT be easier tho since i wouldnt have to do all that loops and that many event listening
@eternal oxide I implemented the itembuilder, now how should i organize the seperate items? isnt it better to make classes dedicated to each item?
no
so how else
i dont mean listener classes btw
nust like if i have a poison sword a new class like poisonsword.class
and so on
but thats just the same as before i still need reflection that way
you add a PDC tag, or set of tags to indicate what type of custom weapon it is
you create a key for that item
yes I know. but i have to build the item somewhere right so should i build each item in its own seperate class or what
store teh item against the key
i alr use pdc
solution is :
public File loadDefaultFile() {
File file = new File(plugin.getDataFolder(), "custom-heads.yml");
YamlConfiguration config = YamlConfiguration
.loadConfiguration(new InputStreamReader(plugin.getResource("custom-heads.yml")));
saveFile(config, file);
return file;
}
// tested
private void saveFile(FileConfiguration fileConfig, File file) {
if (fileConfig == null || file == null) {
plugin.getServer().broadcast(ChatColor.RED + "Failed to save file!", "OP");
return;
}
try {
fileConfig.save(file);
} catch (IOException e) {
plugin.getLogger().severe("Failed to save file: " + e.getMessage());
}
}
i was understood FileConfiguration is wrong
https://bukkit.fandom.com/wiki/Configuration_API_Reference#The_Configuration_Object this helped me alot
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 ...
when someone uses an item, you pull the PDC data, fetch the item from your map and action whatever you need to action
so i make 1 class where i build each item and add it to a map according to its key
and then check that whenever i need to
yes
thank you
the key itself indicates what item it is, the data you store under that key tells you what functions the item has
I dont get it so should i store a function in the hashmap with the key or
the item
if it were me, I'd make a module system. Where each module performs a specific function. Be it poison, sweeping attacks etc
would that be easier over time?
||WHY IS THIS GOING AROUND STILL||
much easier
dude theres just one thing i dont understand
each item has its own function right
so whenever i get which item it is
i still have to perform whatever the action it is
so here do i store the code for that function
yes, the modules do that
you create a poison module
a sweep attack module
whatever functions you want these items to have
hm
can you help me with the logic for that?
like okay i get which modules that item has but then how do i perform the code for that?
then when you pull the value stored in the PDC for that item you find what it needs to do
different classes for each module and a doAction() or something in each class?
if you stored it as a simple string like "a,b" you read it and know it has to perform a and b functions
yes
yep
where ill store all the info including the actions it needs to do
and then what
i detect which modukes an item has with pdc
and then how do i get the actions
do i make a module builder for modules aswell?
when you read the PDC string from the item, you invoke the doAction(...) method of the modules it says to use
no
one module per action
i still have to use reflection if i seperate them in different classes tho
no?
no
or do i just add the classes and keys to a map
you add them to a Map
so ill keep the itembuilder
and add a module feature or whatever
so i can specify which modules it has
snd in detection
i dont check for an item
i check for modules
with pdc
and then get the method from the modules' class
and perform whatever
yep, you get the modules from the map based upon the PDC value
you create a class for each item type, for example "ArmorItems.class" registers all armor
i think that's the best way
nope, too static
why is static bad?
you don;t care much about the items themselves, only what they do
i still have to care about them lowkey because i need to give the items to players with commands or crafting recipes whatever it may be
if you have 100 different actions and you create 1000 items which implement different combinations of those actions. you would have 1000 classes
if you only care about the actions, you have 100 always
it also makes it simple to move your items into a config so you can create new ones without having to distribute a new jar
wouldn't this work?
public class ArmorItems implements ItemType {
private static void Map<String, ItemStack> armor = new HashMap<>();
@Override
public static void registerItem(String id, ItemStack item) {
armor.put(id, item.clone());
}
@Override
public static ItemStack getItem(String id) {
return armor.getOrDefault(id, new ItemStack(Material.AIR));
}
}```
(itemtype is a custom interface)
elgar do i store a modules hash map of
class<?> handler, String moduleName?
or make a big ass constructor that registers all armor
other way around. your key shoudl be easily stored in PDC so <String, Class<?>>
okay thanks and since ill be creating new classes for each module, and i have to register it to a hashmap
why is it static
Also you can't inherit static methods
to register it to a hashmap the code first has to get executed so how am i gonna execute that code
of each class
if you know what i mean
you can store an actual instance in the map
Well
If you're creating an object you have context of it
You can register it after fully initializing
Wherever you initialize
map.put("poison", new Poison())
a base class of Actions, so Poison extends Actions
ill try that and get back to you if i have some issues but its 1am and ill probably log off in like 40 mins lmao
do i create that?
and also
im storing the hashmap in a seperate class
thats correct right?
you cna store it anywhere thats appropriate
like a ModulesList class that has the map with all the getters setters etc
yep
yep
what would that module class have tho, like getAction# is one whats another
have a base class which all your Modules extend
you could even make it an interface for a cleaner look
but interface doesnt have like mandatory overrides right
you can choose to override something
wdym
public interface wow {
String omgwow(); // this is a required method
String woah() default { // this is not required
return "sus";
}
}```
oh thanks
how do i implement levels? like level 1 enchant level 2 enchant because I cant really store that in that hashmap
that would be item specific
so thats data you store in the PDC and pass to yrou Module as required
yep
but what do i add to the hashmap then because i cant add an enchant level that would mean adding a new module for each level
however you'd probably just pass the pdc data/item into the module and let teh module pull that info
how do i listen for when a player becomes visible or invisible
In your module you do the different power depending on level
okay so I created a Module interface, a ModulesList class and a poison class that implements module
now i add it to the modules list
and then do some listener stuff
i still didnt get how to do the levels but whatever lmao
i think its too late rn my brain is shut off
whaaaat you can implement methods in interfaces??
wait
oh nvm im thinking of abstract classes
wait
idk, i have enough trouble with interface vs abstract class
You can only extend one abstract class, but you can implement multiple interfaces
Also no instance variables in interfaces
i get that, but why not just use interfaces and never use abstract classes if its that simple?
Well then you can’t enforce a certain constructor for example
(not trying to sound argumentative, just curious)
Interfaces also don’t have those
ohh okay yeah i didnt think of that
NOOO
photoshopped
I have a somewhat particular requirement
I need a random number between two bounds, both inclusive, with a specific number of decimal points
And I can’t think of a clean way to do it
hello, where is situated the class concerning hit and block in spigot 1.8.8 please ? Thanks
what is clean to you
Hello, start off at the entity damage packet that gets sent near the NetworkServer class
maybe something with BigDecimal and RoundingMode?
Mmm, could work but creating a BigDecimal object doesn’t seem ideal
I have no event concerning the damages in nms
hello, is it possible to edit a offline player’s inventory?
offlinePlayer#getPlayer()#getInventory()
jsut make sure the player exists before accessing that
That won’t work if they aren’t online
You should still be able to access there playerdata tho
gen the int, gen the decimal as an int and divide by amount of decimals points (base 10 ofc)
You could read the playerdata file
If thats not too unclean
how can i make the inventory update once player gets online?
You should just be able to encode your changes and write them to the file, which should update it automatically
Yeah that should work
Just gotta make sure the decimal can be 0-1 instead of 0-.99999
Skill 💯
I think I can just do nextDouble(1 + double min value)
Ah wait you said gen the decimal as an int too and then divide
Yah that’s smort
stop
:c
i no no wanna
can anyone help me please ?
1.20.6-R0.1-SNAPSHOT.
