#help-development
1 messages · Page 822 of 1
😨
watching tutorials doesnt make you good at programming
if you want to use this without an instance, make it static
mate the error is not in there
thx
its just the stacktrace
time to not learn java
no concurrent modification show your code
tbf the kotlin example is using val :^)
Also, yeah, var. wtf
my fault
so is val :P
The person that made that graphic went out of their way to make Java look way worse than it actually is
I was making a joke mans
man i dont understand reflection
its obvious its scewed lol
Guy is getting back on kotlin hahers
Close enuf
hahers
hahers
emily
How tf did my plugin go from 30 to 312 kb from 300 lines of code
dependencies
code moment
jars arent small either
so i need to cast it like the ide suggests?
Concurrent mod usually hapens when you edit something simlutaneously OR if you edit a collectionl while looping over it. I see neither of those things here? what specific line is erroring
Going to assume you're listening to a PlayerDeathEvent and removing players from your EventCore.Alive field. Player#setHealth() kills them in the loop, calls the death event, removes from the list, throws CME
yes
bc if i do that its like 'unchecked cast'
oncommand method
it's unchecked cause you're casting a parameterized type
can i ignore that given it passes <capture of ? extends Effect>
or change the other end to Class<? extends Effect>
im just trying to prevent having to do the same batch of logic for EVERY kind of event
trying to find annotations on methods
just use Class<?>
? extends Effect, even
Actually yeah in this case you don't even need the specification lol
i... couldve sworn it complained about that
weird
hm this is curious
its saying it needs Retention.RUNTIME but wouldnt Retention.CLASS be enough?
class retention doesn't make it accessible via reflection iirc
noted
it's described in the javadoc of retentionpolicy
hm it must not show in the abbreviated jd in the editor then cuz i didnt see it
maybe im blind
ctrl+click
qq if im understanding this correct: the line EffectHandler annotation = clazz.getAnnotation(EffectHandler.class); checks if the annotation is anywhere in the class, or if the class itself is annotated?
the class itself
how can I teleport a boat with a player inside of it?
if I just teleport the boat/boat and player/player the player is still sitting in the boat but the boat is far away from the player
yea if the player gets far away from the boat it's supposed to pop the player out. Check the methods dealing with entity passengers
okay i have a listener preventing the player to get out
this is what im using atm:
private fun teleportPlayerWithBoat(player: EventTeamPlayer, location: Location) {
val boat: Vehicle = player.iceBoat ?: return
boat.teleport(location, PlayerTeleportEvent.TeleportCause.PLUGIN)
player.player!!.teleport(location, PlayerTeleportEvent.TeleportCause.PLUGIN)
}```
theres practically no diff
ngl my mental capacity is spent on reflection rn lol
how do i do instanceof on Class<?> it aint just doing instanceof, and isInstance doesnt work on Class<?> cuz it isnt the right kind of object
no
im doing basically the same thing as the event api rn
checking method signatures
need it for the way im registering stuff
That's fine, but the answer you're looking for is Class#isAssignableFrom() :p
do u know how to solve this one lol
im using the extends event here to constrain it properly but idk how to actually convert it
Event.class.asSubclass(args[0])
defuq
ah that makes sense lol
side note, how fast is runtime reflection?
i might need to redo it cuz i probably have to run it on some really high frequency events
(read: PlayerMove)
I mean it's not fast, but yeah. Cache things if you can. Get methods and fields only once, stuff like that
MethodHandles tend to be much quicker but it's also a little more involved
does anyone know what net.minecraft.advancements.critereon.DeserializationContext (1.20.2 remapped) changed to in 1.20.3?
yea right now my idea is HashMap<Class<? extends Event>, HashSet<Effect>> callMap;
Each 'Effect' is supposed to only get instantiated once
U think this'd work? Map<<? extends Event>, HashSet<Method>>
the problem is that wouldnt bind the method to the Effect anymore
alright context might be helpful
the idea is to pass through events only to the classes that need them, hence me scanning for that annotation and building the set of Effects that want them
the problem im facing right now is... there's a lot of events
it's pretty simple to call the methods via reflection, but also pretty slow, but the only alternative im aware of is to make an empty method for every single event then ANOTHER method for every event that's like 'this event -> grab from the map the set of Effects, call that method passing through the evenet'
wouldnt be big an issue to do over reflection, were it not for the fact that some things tend to happen rather often
blockPhysics, entityDamage, playerMovement etc
reflection is nowhere near as slow as it once was
it can actually be as fast as normal calls now under certain conditions.
this the methodhandles thing choco mentioned?
what are you trying to achieve here
i more or less require event passthrough because I'm making a lot of different classes/effects that need said events. I figured in the long run it would be saving me time doing it like this
the goal is to have, for each event, a loop that's like 'this is the list/set of class instances that want those events'
I don't understand.
are you like reading this stuff from a package within the jar file and appendig the classes into a hashmap for registration?
no, its supposed to tell the handler library 'this is the list of instances, the events it needs are annotated', and the lib caches them
the problem i have is that both ways i tried to do this are kind of problematic - registering one handler class per effect per player get... large, rather fast, but caching player data in the handler instead is NOT easy either
my current way of doing this is a massive abstract class acting as an interface with empty methods for a bunch of events, and there's a bunch of classes implementing that class and overwriting the methods they need, and one instance of those classes is created per-player per-effect to handle it
so if an event happens it just iterates through literally every instance of that interface class calling the empty / maybe implemented method bodies
the problem with that is that i need to add each event manually, and I feel like it's kinda the wrong idea to be like 'one instance per effect and player' so im trying to use reflection to not have to do that part at least (the manual event addition) each time, and to not waste like 90% of method calls on empty methods
doesn't exist
they aren't using gson for advancement serialization/deserialization anymore
its via codecs from dfu now
sad, thx
more and more things are being codec-ified over time
easy fix lel
I mean their really is no "nice" way to just magically create events out of thin air unless you have a pre-processor. It may seem "annoying" but you're stuck making the events manually not much you can do about that.
I'd just have a
PlayerWalkListener.java
Then delegate all effect methods to run in that listener.
e.g.
public void onMove(PlayerMoveEvent event) {
if (// some inverse resitriction logic) {
return;
}
Effects.MY_COOL_EFFECT.event(event);
Effects.MY_OTHER_COOL_EFFECT.event(event);
}
You could also just make an array and loop over that array
.
Anyone? 🥲
wow no more loading advancements 🥲
well one effect might require more than one event
so id either get stuck with instanceof or the same issue as before, empty method bodies in the superclass
man this is impossible to design lol
think you need a redesign then
generics
what do u think ive been doing the last 4 days lol
crying
ye close enough
also howd generics help here
are you saying to do something along the line of Effect <Set<T>> or smth?
I still don't understand what you're doing
im guessing you extend a class so you just have a registerEvent(Class<T extends Event>, Consumer<T>)
anyone know if i can remove cmds in the command map containing ":"
again one effect may require more than one event unfortunately
so allow for that method to happen multiple times
i guess the best way to put this in simple terms is that im trying to make a library that simplifies creating status effects
im not explaining this well
anyone got an idea how to create advancements in 1.20.3 then without the server creating a file for it? e.g. a "temporary" advancement
yes
how?
is it that simple?
event.getCommands().removeiF
?
why the toString call on a string
Hi,
I have a plugin with a structure that looks like this, I would like to obfuscate it with proguard but I have an error when proguard obfuscates my libraries which are generated by maven, my code is contained in the "ch" package how can I ensure that other library packages are not taken into account and correctly obfuscate my plugin?
That would help me a lot!
https://cdn.discordapp.com/attachments/581136754430705695/1183109562459488328/image.png
I can't exclude packages like "com.*"
and I have these kinds of errors during obfuscation
Note: the configuration keeps the entry point 'org.yaml.snakeyaml.constructor.Constructor$ConstructScalar { java.lang.Object construct(org.yaml.snakeyaml.nodes.Node); }', but not the descriptor class 'org.yaml.snakeyaml.nodes.Node'
Note: the configuration keeps the entry point 'org.yaml.snakeyaml.constructor.Constructor$ConstructScalar { java.lang.Object constructStandardJavaInstance(java.lang.Class,org.yaml.snakeyaml.nodes.ScalarNode); }', but not the descriptor class 'org.yaml.snakeyaml.nodes.ScalarNode'
Warning: there were 132251 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedclass)
Warning: there were 756 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile the code.
(https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedprogramclassmember)
Unexpected error
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:526) ~[proguard.jar:7.4.1]
at proguard.pass.PassRunner.run(PassRunner.java:24) ~[proguard.jar:7.4.1]
at proguard.ProGuard.initialize(ProGuard.java:353) ~[proguard.jar:7.4.1]
at proguard.ProGuard.execute(ProGuard.java:142) ~[proguard.jar:7.4.1]
at proguard.ProGuard.main(ProGuard.java:648) ~[proguard.jar:7.4.1]
does this work on 1.8 or no
do you think i have every spigot api call memorized in my head
oh
hold on
How do I get a specific players head here? The getOwner() is in the docs but not defined here?
ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD,1); ItemMeta headMeta = playerHead.getItemMeta(); headMeta.getOwner(): //????
ItemMeta needs to be casted to SkullMeta
SkullMeta meta = (SkullMeta) playerHead.getItemMeta();
Ohhh thankyou got it 🤦♂️
anyone know why this wont work?
what is the type of the eventExecutor parameter
wdym
declaration: package: org.bukkit.plugin, interface: EventExecutor
you need one of these
im on 1.8.8
in all reality though you really should just be using registerEvents 🥲
yeah so that doesn't change anything
ok
set the EventPriority on the annotaiton
@EventHandler(priority = EventPriority.LOW)
you can call events using PluginManager#callEvent
?????
You need to create a new instance of the event class
new PlayerCommandSendEvent() to call it
what do you want to do?
he's probably calliing Class#newInstance()
just do new PlayerCommandSendEvent()
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
to create an object
not really possible in 1.8
im tyring to register the event
if you asre on 1.8 the event does not exist
there is no player in an on enable lmao
wth? why are you creating a new PlayerCommandSendEvent
What the hell do you want to achieve?
that will not send the command map to the player
wtf you want to call a player event in on enable?
you don't need
You already did, just get rid of that line
💀
Bukkit.getPluginManager().registerEvents(this, this); registers your event handler to bukkit
the method registerEvent it's not used for registering custom event
with this method you can create a callback with an event
yeah
GOOD?
Oh, PlayerCommandSendEvent is not a bukkit thing
it's a custom event
you don't use registerEvent to register a custom event you do what Spigot does and call PluginMangaer#callEvent
yeah bc 1.8
no
wtf
lol legacy moment
check the event package...
You can NOT remove commands with : in 1.8 without a LOT of work and it will be buggy
he's on 1.8, his event will do nothing. Stop telling him to call the event
he is trying to remove commands with : in therm
its NOT a custom event. It just does not exist in 1.8
its a Bukkit event but only in later APIs
I don't understand he created the object on his project
the only way he can do what he wants in 1.8 is to reflect the command map, remove all instances of commands with :, then teleport every player to another world and back again.
????????????????
yes, auto code completion by the IDE
of course it does not exist but nothing prevents him from recode it
oh my
creating the event will not implement the feature
it will just be a cuistom event which does nothing
yeah i know but his issue was simply to call his event that he created
and yeah sure he could call it but he's trying to prevent won't be prevented
and where is the event going to be called
no thats not his issue
so I explained to him that he didn't need to register it
then he implements the event it as he wants
his issue is he wants to remove commands with a :. creating a custom event will do nothing
ok well he didn't explain it to me
You came late to the table 😉
How would the event even be implemented if there is no underlying bukkit API?
^^
you'd have to fork the server
which imho pretty much every 1.8 user should be doing
if you're using something so old you need to just be using/making a fork
his only way to do it on 1.8 is a nightmare and requires teleporting players to another world and back again to force a command map update on the client
Given it is in the onEnable that isn't needed though
unless he reloads
ah yes
Make the void static or use create an instance and use getter (lombok) to obtain class information to be able to use it in different classes
getter my favorite lombok exclusive feature
Has anyone already used ProGuard here?
I'm having an issue with maven on win 11. Anyone else has the same issue?
I don't think most here really love the idea of obfucsating plugins
for premium resource ,_,
Some have tried it but it has no real place in a plugin enviroment.
I personally think all plugins should be open-source
The only person I know active who uses an obfuscator is Alex, but he doesn't use it to prevent "stealing his code" just to stop lazy people from looking at how he does 1 thing
in a premium plugin all you can do is obfuscate method names and that really does nothign to protect anything
sometimes some work deserves pay
you gave 0 information
"issue" what issue
Open Source doesn't indicate 0 pay there are plenty of popular premium plugins that are Open Source
my maven works perfectly on win 11
what it does indicate is 1. Complying with GPLv3 and 2. that you realize trying to stop people from decompiliing your plugin is a 0 sum game
You just need to build the project and get the plugin for free. I don't understand why people would pay for it
Morals
most people don't download for free.. they pay for the product
Since I updated I'm having issue with some dependencies. Specifically, geysermc cumulus and item-nbt-api. Even tho I don't have them imported at all
Citizens gets paid a decent amount
It's like the repo is bugged out
- easy access to the final jar 2. to support the dev
it started to happen once I updated to win 11
Product for free, pay for support
Most developers also only offer support to people who have purchased their plugin yet aonther insentive to buy it
and that also
most importantly, actually
I don't know if so many people want to support small developers
so you're having an issue with dependencies that you have not imported
all of us on spigot are "small developers"
what is the issue
a lot of people will be happy to
Stop being paranoid. Here is what obfuscation gets you.
Leaked plugins filled with malware
People requesting help with those leaked plugins (and you may be unknowingly giving it to them without a proper support authorizaiton system)
And 0 more sales than if you just made it open source
fr
So i will try 👀
if someone isn't going to buy it they won't give a shit if its obfuscated or not
fr
yeah, you are right
and the only thing obfuscation gives you is wasted time on obfuscating your jar
also leakers are very skilled. they have tooling to deob prey much everything if theirs demand
I'm loving it here
or if you want to minimize it obfuscation can sometimes decrease jar size, but I feel like thats a rarer use case
You have convinced me
rare use case, I see it more in js than java lol
There is a feature for premium plugins (I saw) where it can inject an ID upon download
supposed to allow you to match a user to an ID.
wtf
I never looked into it as I don;t make anything premium
yeah thats how most plugins handle the alllowed licensing
these closed-source people do be trying to protect shit hard
wait cant u just be like 'premium here but u can download it here for free'?
but you can easily modify the plugin to remove the check in a leaked version ? right?
yes
You can kinda
Provide the source code and let them compile it
If they can
ye
(dont give instructions xD)
And then do not give support to those who self-compile
Being open-source makes you more trustworthy
even having the whole code base on GitHub you will still be accused of having back doors 😦
i think that at least 50 percent of spigot users may not know how to compile a plugin
which means they would buy it for the precompiled jar
higher
or get malware and take a leak
It has to be a decent plugin for anyone to bother stealing it though
we are talking about premium resources that are open source
ah ok
Ehhhhhhh
anyone can compile it and have it for free
Open-source software (OSS) is computer software that is released under a license in which the copyright holder grants users the rights to use, study, change, and distribute the software and its source code to anyone and for any purpose.
i meant this along the line of 'premium resourcce on spigot but if youre broke you can get it for free'
Unless you enforce a license it kinda does
"the rights to use, study, change, and distribute the software and its source code to anyone and for any purpose."
depends on the license
that is literally the definition
so what are you saying
not all OS licences are the same
im trying to stack invisible armor stands on top of each other by setting them as passengers (1.20.2). But for some reason they offset in one direction, any1 know why?
right so someone makes an open-source project but the license doesn't allow anyone to do anything with the code or
I do not see anything
lol
a passenger always offsets
this didnt happen in 1.20.1 tho
i could stack them high without the offset backwards
it didn't? I thought it was always over the shoulder
k so chatgpt gave me this code but I assume it did something wrong since it shows up as red
...
💀
:Skull:
is it a joke?
No chatgpt gave me this
💀
ChatGPT lot a few circuits
how can i use better nms mappings
?nms
this function in red simply doesn't exist 💀
Rip
thanks elgarl
you have to code it
Which function should I use from getting a location from int x y z and worldName string
the... constructor.....
new Location(...
new Location(...) moment
Ok thx
it's not like python with native fonction
?jd moment
Can I get a bit of help plz?
java.util.concurrent.CompletionException: java.lang.NoClassDefFoundError: org/mariadb/jdbc/type/LineString
Trying to asynchronously save data to the database onDisable and this is what's happening. full stacktrace if relevant
This is the culprit line:
public void updateAsync(final String query, final Object... params) {
CompletableFuture.runAsync(() -> {
try {
update(query, params); // this line
} catch (final SQLException ex) {
ex.printStackTrace();
}
});
}
public void update(final String query, final Object... params) throws SQLException {
connect();
final PreparedStatement statement = connection.prepareStatement(query);
for (int i = 0; i < params.length; i++) statement.setObject(i + 1, params[i]); // traces to this line
statement.executeUpdate();
}
The class is in the jar, I've checked
call Class.forName("linestring path") probably
use mysql driver 🤓
I'm commissioned to work with mariadb
the mysql driver works with maria
Hmm
yeah
just i have a question
what's the difference between com.mysql.cj.jdbc.Driver" and com.mysql.jdbc.Driver"
¯_(ツ)_/¯
old and new
same thing most likely just one is after a relocation
cj is new
ok thank
v4.0 I thin it changed to cj
it's been a long time 💀
3 or 4, I don;t remember which
They still haven't deleted the other one?
This did help, ty
But why does mariadb have a separate driver then?
If I can just use mysql's
specifric mariah functions
Hmm
Also very odd that it worked for a while and then it just stopped
I don't think I've changed anything
Welp, will go with the mysql driver than
Ty 🙂
Whats the method for obtaining an inventory name? Can't find it on the docs
k nvm im reading the discord logs rn and everyone is saying "don't detect inventories by name"
look at InventoryView
noone? :(
Hello!
I need help making a custom plugin that uses integration of luckperms api
server error link -> https://pastes.dev/sfOLWDnRIZ
EventTeams is not extending JavaPlugin btw, I'm just instantiating the LP API in its constructor and then calling that constructor in onEnable of EventTeamsPlugin class
event class and stuff :-
private final EventTeamsPlugin instance;
private LuckPerms luckPerms;
public EventTeams(EventTeamsPlugin instance) {
this.instance = instance;
this.initLP();
}
private void initLP() {
// RegisteredServiceProvider<LuckPerms> provider = this.instance.getServer().getServicesManager().getRegistration(LuckPerms.class);
// if (provider != null) {
// this.luckPerms = provider.getProvider();
this.luckPerms = this.instance.getServer().getServicesManager().load(LuckPerms.class);
// }
}
public LuckPerms getLuckPerms() {
return this.luckPerms;
}
}
public final class EventTeamsPlugin extends JavaPlugin {
@Override
public void onEnable() {
new EventTeams(this);
}
}```
kindly ping me when replying
add it as a depend in your plugin.yml
Is there a way to reduce animal spawns, make them very rare and to reduce group sizes without spigot or bukkit yml configs?
Server and LP version:
ver [05:47:11 INFO]: Checking version, please wait... [05:47:11 INFO]: Current: git-Purpur-1985 (MC: 1.19.4)* You are running the latest version lp version [05:47:13 INFO]: [LP] Running LuckPerms v5.4.111.
see
add it as a depend in your plugin.yml
it is
?paste your plugin.yml
I have added it in my paper-plugin.yml,
dependencies:
server:
LuckPerms:
load: BEFORE
required: true
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
purpur
add it as a depend in your plugin.yml not your paper-plugin.yml
and delete your paper yml
as paper/purpur will still use the spigot plugin.yml
maybe this is a bug with their fork best if he just report it where applicable if it truly is an error tbh
I'm going to bet it's a case of purpur not reading the paper yml
shoudl be using plugin.yml
EventTeams is not extending JavaPlugin btw, I'm just instantiating the LP API in its constructor and then calling that constructor in onEnable of EventTeamsPlugin class
oh
if you're having issues please consult the fork owner/issues
this is still not paper
if you are running purpur, any issue is a purpur issue pretty much
no one but purpur pretty much knows all the ins and out as to what they change
santaynxplay
lol
I want to migrate my plugin from 1.8.8 to 1.20.4. What are major API changes and how to do it? (already updated the libraries)
should be mostly fine ? Material has some changes
given items were flattened in 1.13
what else?
not much
lots added
a few methods removed
if you use Inventory#getTitle irresponsibly that is now gone
an infinite list of things
best bet is to go thrugh every update release since 1.8.8 and look at API changes
and that doesn't even cover everything
that'd be too easy
I don't want to know every single changes though. I'm just remaking my plugin and I would like to know the major changes
just try it
what's the best way to format the turret logic? Will I have to create a scheduler for the turret? Or are there better ways?
alright, thank you I guess.
Too old! (Click the link to get the exact time)
https://hub.spigotmc.org/changelog/ 8 years worth of changes is a lot
View the Bukkit, CraftBukkit and Spigot changelog.

Yeah, I gave up on 1.8 API. I couldn't mess more with NMS and its limited API.
I really like 1.8 though but it was getting so annoying when I see people use a simple method in Bukkit which is not available on 1.8, and you'd have to use a lot of NMS code to create it.
does somebody know which mob creates the perfect height in between 2 armorstands to create a hologram?
i've tried many but they dont seem to work
by the way, do I have to use Java 21?
that's a lot
is there a summery or something for change log?
what do you recommend?
I mean, if you write a plugin for other people and want to publish it
probably 17
if you only code it for yourself, get that 21
we deserve java 17 just for the pattern matching
for a changelog, the only other thing I can think of is https://www.spigotmc.org/forums/news-and-announcements.2/
we deserve string templates
gimme java 22 or whenever that is out of preview
Java 21 is a fire
Yea recent java versions are fucking great
im trying to set the durability for an item but setDurability is deprecated and afaik your suppose to use ItemMeta#setDamage but that doesnt exist
you have to cast the item meta to damagable
var itemstack = ...;
ItemMeta meta = itemstack.getItemMeta();
if (meta instanceOf Damageable d) d.setDamage(damage);
itemstack.setItemMeta(meta);
It will come out on September 2024
I don't even know, man.
loving the 6 month release schedules
Same 
only hate them because funking minecraft won't update
so we are stuck without pattern matching and our beautiful string templates
dw dw, we will force that 😉
What are you talking about?
listen if I wanted to work with a piece of paper I would, but right now I am working with a spigot
honestly tho, they might bump on 1.21
I hope they do pattern matching is great
oh and like virtual threads and stuff but like who tf cares about that shit
Yeaaa, who cares about virtual threads 
its finally ready lynx my next great PR
Sync chat
no more weird async chat 👎 All synced now
I also moved the netty threads onto the main thread I figured we didn't need those anyways
Lag the server 👍
Async server chat 👎
Why Player is still sync?
?
define "async"
can I offer you a position on the paper team, we are very interested in your performance patch
Like be in different CPU cores.
when most people refer to "async" they actually mean parallel computing
is that what you mean?
they are different
When most programmers refer to async they just mean "not now"
Which I really don't like.
also parallel computing is a big thing on its own, not to mention trying to make sure all the tasks sync up at the end
Because people, especially newer devs will think "async" means "concurrent", which can be true but does not always mean that
despite that bedrock is written in C++, player object is async and you can have 300 players in 4GB ram server without any lag or TPS drop.
bedrock is a complete redesign
it breaks enough shit to make it a near different game
Minestom could do it too
yes you can. (I am not evil I will not destroy paper just trust me)
That is why you use minestom-ce to have it be even fancier
Although I think minestom-ce got killed; not sure what the current hottest minestom fork is right now
The state in which Minecraft exists today makes it extremely difficult to parallelize the main server thread without a complete re-architecture of the game's code, which would be agonizingly painful from a mod's perspective. I'm not considering this in Lithium and quite frankly if I was to ever attempt it, I'd just make my own game rather than try to re-build another company's product.
no it's the only thing being worked on then
Is it even stable?
yeah
Put the server files to read only
No idea never tried it but it's essentially what you do when you don't want things over written like config files
If you have it set to read only nothing should save
alright
i have a
slight dilemma
why does the server like blow up if i getState().update(true, false) on a lectern
is there some lectern lore im unaware of
Can you be more specific
yeah well i get hit with the ```
09.12 16:06:37 [Server] [ERROR] Too many chained neighbor updates. Skipping the rest. First skipped position: 8159, 66, 7796
09.12 16:06:42 [Server] [ERROR] Too many chained neighbor updates. Skipping the rest. First skipped position: 8159, 66, 7796
and the server crashes
1 sec
@EventHandler
public void onBlockPhysics(BlockPhysicsEvent event) {
// Whenever this is ran on a lectern, kaboom
block.getState().update(true, false);
}```
where would I run this command to add it as a dependency?
mvn install:install-file -Dfile=worldguard-bukkit-7.0.9-dist.jar -DgroupId=com.github.enginehub -DartifactId=worldguard -Dversion=7.0.9 -Dpackaging=jar
keeps giving me mvn : The term 'mvn' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
Sounds like it doesn't know where maven is installed
If you're on windows add it to your environmental variables
Also WorldGuard should have a proper maven repo
Not sure why you want to install the jar directly
still haven't got any solution any mod who can help here?
couldnt find any releases
Recreate on spigot
thanks dawg
Failed to register events for class dev.tapwatero.renderer.Renderer because net/minecraft/server/level/ServerLevel does not exist.
We've already told you to go where your issue is at. Spigot does not support paper-plugin.yml and paper will reject your support as well since you're running on purpur please seek support from the correct server, which in your case is purpur
no
minestom ce is still operating...
upstream isn't being maintained (as far as I know)
I think matt is the main maintainer atm
anyone knows a link or a video that teach how to make a region manager (cuboid)?
how i detect if oak log is facing up?
BlockData -> Orientable -> axis
if (command.getName().equalsIgnoreCase("setchatcolour")) {
if (sender.hasPermission("heeseutils.setchatcolour")) {
if (sender instanceof Player) {
if(args.length == 1) {
Player player = (Player) sender;
NamespacedKey key = new NamespacedKey(pluginInstance, "player-getter");
PersistentDataContainer dataContainer = player.getPersistentDataContainer();
dataContainer.set(key, PersistentDataType.STRING, args[0]);
sender.sendMessage(ChatColor.YELLOW+"Chat colour updated.");
}else{
sender.sendMessage(ChatColor.RED+"Too few or too many arguments (must be 1).");
}
}
}
}
return true;
}```
Any way to make it so it will only accept colour codes for example /setchatcolour &c and people won't be able to do /setchatcolour bum
ChatColor probably has methods for lookups
you can use those; ensure it could be looked up, fail if it couldn't
What has changed with HoverEvent on ChatComponent? This one stopped working since 1.20.2, and now even kicks players using 1.20.4:
cb.event(new HoverEvent(HoverEvent.Action.SHOW_ITEM, new Item(item.getType().getKey().toString(), 1, ItemTag.ofNbt(item.getItemMeta().getAsString()))));
use adventure
or report an issue if their is one so we can fix it instead :P
would appear to be a bug, but ask @worldly ingot . Are you using bungee as a proxy?
literally not helpful
not sure how we are supposed to fix bugs if they're never reported ^
I mean in theory nothing changed. All the unit tests still pass. I don't think I touched hover events either
probably what json/nbt the client accepts changed
That's likely the situation, yeah
Also worth noting that it looks like you're using legacy text in your component builder
Which is always a bad sign
I'm not using bungee. I also noted in 1.20.3 notes that:
color
clickEvent
hoverEvent
hoverEvent[action=show_entity].contents.name
hoverEvent[action=show_item].contents.tag```
so that should be the reason for kicking in 1.20.4
Bungee Chat is just the name of the component library that spigot uses. If you have a ComponentBuilder, you're using bungee chat :p
I was asking specifically about the proxy
oic
It seems to give totally valid json, but hover is still not happening
here's full method (i've changed legacy text):
ItemStack item = p.getInventory().getItemInMainHand();
ComponentBuilder cb = new ComponentBuilder(Util.colors(prefix + p.getName() + "&7: ") + messageColor);
for (String arg : message) {
if(arg.toLowerCase().contains("[item]")) {
String qty = "";
if(item.getAmount() > 1) qty = " §7x" + item.getAmount();
ItemMeta itemMeta = item.getItemMeta();
cb.append(Util.colors("&7"), ComponentBuilder.FormatRetention.FORMATTING);
Bukkit.broadcastMessage(item.getType().getKey().toString());
Bukkit.broadcastMessage(item.getItemMeta().getAsString());
ItemTag tag = ItemTag.ofNbt(itemMeta.getAsString());
cb.event(new HoverEvent(HoverEvent.Action.SHOW_ITEM, new Item(item.getType().getKey().toString(), 1, tag)));
if (itemMeta != null && itemMeta.hasDisplayName()) {
cb.append("§8[§7" + itemMeta.getDisplayName() + qty + "§8]" + messageColor, ComponentBuilder.FormatRetention.FORMATTING);
} else {
cb.append("§8[§7", ComponentBuilder.FormatRetention.FORMATTING);
cb.append(new TranslatableComponent(item.getTranslationKey()));
cb.append(qty + "§8]" + messageColor, ComponentBuilder.FormatRetention.FORMATTING);
}
cb.append(Util.colors(" ") + messageColor, ComponentBuilder.FormatRetention.FORMATTING);
}
else {
cb.append(Util.colors(arg) + " ", ComponentBuilder.FormatRetention.FORMATTING);
}
}
for (Player onlinePlayer : p.getServer().getOnlinePlayers()) {
onlinePlayer.spigot().sendMessage(cb.create());
}```
dangerous game to mix legacy and components
you are calling create on cb multiple times
suspect you should try a minimal example first, eg new ComponentBuilder("test").event(...).create()
yeah, that makes sense. but it just weird for me that it has stopped working on 1.20.2 and worked w/o any problems until update
they started enforcing some things so that's probably it
Ok now i'm feeling dumb af because minimal variant works. I should have tried that long time ago....
Thanks everyone, gonna reconstruct all that mess now
aight, well now you gotta figure out where the issue is. I'd start by removing the '§'s
Any good library to use spigot nms deps without Obfuscation? 🤔
?nms
If you find yourself needing to use server internals, consider perhaps if there's a way to make API for it and contribute it to Bukkit. We always appreciate more API
well, sometimes things are too hacky to get into the API
like brigadier
I didn't want to get complicated and just added obfuscated dependencies which was easy 🥲 but i have time now and i want to add it i think it will be much more maintainable in the future 😀
Hello! I have specific question. Anybody knows which part of the code is in charge of managing the order in the inventory? I'd like to know about the enchanments order trick (no alphabetical). Thanks in advance!!!
im using this to download a player's skin from the url, but it's showing an error? anyone know why? PlayerProfile profile = player.getSingle(e).getPlayerProfile(); URL url = profile.getTextures().getSkin(); File path = new File(Skonic.getInstance().getDataFolder(), "skins/" + player.getSingle(e).getName() + "/"); if (!path.exists()){ path.mkdir(); } File file = new File(path.getPath() + "skin_" + player.getSingle(e).getName() + fromDate(getDate()) + ".png"); if (!file.exists()) { file.getParentFile().mkdirs(); try { file.createNewFile(); } catch (IOException ex) { // no-op } } try { BufferedImage img = ImageIO.read(url); ImageIO.write(img, "png", file); } catch (IOException ex) { throw new RuntimeException(ex); } }
You should probably ask in the Skript discord
I'm using the team API to configure the overhead and tablist name of my players, is it possible to use hex or bleed over from the prefix text?
afaik, team.setColor() only takes ChatColor
Pretty sure there are only 16 team colors
damn, so I'd have to use packets to achieve what I want to do
No, vanilla doesn't support anything beyond the standard 16 colours
They just don't exist :p
Thanks you all for your help, you are the best ❤️
Don't think so
if i want to make something like the map thing (the plugin which makes a webapp with the map of the server, and u can chat and stuff from the browser)
what shall I do?
i plan to create a panel like thing but for
- chatting
- player actions (bans and stuff)
- and other server management stuff
should i use swift? or javalin? i am afraid i will have to configure the server to let me access its adress or stuff?
If i declare the owner of an Inventory instead of giving a null value, anyone but the owner can edit that inv, right?
Uh that doesn't sound right
do you mean the inventoryholder?
InventoryHolder shouldn't really be used
Fun fact: Tile Entities return a new copy of themselves every time you call getHolder
URL url = profile.getTextures().getSkin();
File path = new File(Skonic.getInstance().getDataFolder(), "skins");
if (!path.exists()){
path.mkdir();
}
File file = new File(path.getPath(), "skin_" + player.getSingle(e).getName() + fromDate(getDate()) + ".jpg");
if (!file.exists()) {
file.getParentFile().mkdirs();
try {
file.createNewFile();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
try {
BufferedImage img = ImageIO.read(url);
ImageIO.write(img, "jpg", file);
} catch (IOException ex) {
throw new RuntimeException(ex);
}``` this doesn't have any errors but isn't creating the image file
@echo basalt i got a question for you because you seems to got some experiences?
any tip to make good structures or patterns in coding?
It really depends on what you expect
A few things I have in mind when I'm coding are like
- Is this a point of failure?
- If I were to expand this system (add a new feature), how hard would it be?
- How easy is it to explain in simple terms what each part does?
- What is this file responsible for?
i think its an error with the file creation
So for example I'd never store a Map inside a listener class unless it's some sort of cache
Any data would have its own data class
So a good example how not to write code is to think of Notch's code 😂
And that data class would have its own manager
If I want to make a config parser or something, I make an interface rather than using a Function<String, Whatever>
So I can expand it later type deal
Here's an easy challenge
whats a parser?
Let's say you have different kinds of data, where each kind has a "type" string id, yet they all follow the same parent
An easy example would be minigame map files, every map object extends MinigameMap, yet each map will add onto the base class with its own logic, like a SkywarsMap class requiring a list of locations defined in the config
Here are 4 classes to work with, you can edit any of them:
public class MyMapRegistry {
public MinigameMap createMap(String type, FileConfiguration config) {
// TODO
}
}
public abstract class MinigameMap {
protected final Location spawnLocation;
protected MinigameMap(Location spawnLocation) {
this.spawnLocation = spawnLocation;
}
public Location getSpawnLocation() {
return this.spawnLocation;
}
}
public class BedwarsMap extends MinigameMap {
private final Map<BedwarsColor, Location> bedLocations = new ConcurrentHashMap<>();
// TODO
}
public class SkywarsMap extends MinigameMap {
private final Collection<Location> chests = new ArrayList<>();
// TODO
}
And let's assume your config looks something like
games/skywars/map-one.yml
spawn-location: "world 0 128 0"
chests:
- "world 10 128 0"
- "world 20 128 0
games/bedwars/map-one.yml
spawn-location: "world2 0 128 0"
bed-locations:
red: "world2 10 128 0"
blue "world2 -10 128 0"
How would you do it?
Assume type is the name of the folder after games
how I would do it?... make some garbage realize it was trash and leave it to do better thats where i'm currently at
but you so right breaking it down and be clear what about what i'm trying to achieve would help alot 💚
- Edit the
MinigameMapconstructor so you can pass aFileConfigurationand add yourparseLocationmethods on that class - Make a constructor on each map class that takes a
FileConfiguration, passes it to its super class and fetches the data it needs from there - Make a
MinigameMapProviderinterface with aMinigameMap provide(FileConfiguration config)method - On your
MyMapRegistry, make aMap<String, MinigameMapProvider> providersmap, and register your providers such asregister("skywars", SkywarsMap::new)
It'd look something like this
public interface MinigameMapProvider {
MinigameMap provide(FileConfiguration config);
}
public class MyMapRegistry {
private final Map<String, MinigameMapProvider> providers = new ConcurrentHashMap<>();
public MyMapRegistry() {
registerDefaults();
}
public void registerProvider(String type, MinigameMapProvider provider) {
this.providers.put(type, provider);
}
public MinigameMap createMap(String type, FileConfiguration config) {
MinigameMapProvider provider = this.providers.get(type);
if(provider == null) {
return null;
}
return provider.provide(config);
}
private void registerDefaults() {
registerProvider("skywars", SkywarsMap::new);
registerProvider("bedwars", BedwarsMap::new);
}
}
dam nice minigame core
And your map classes would look like
public abstract class MinigameMap {
protected final Location spawnLocation;
protected final FileConfiguration config;
protected MinigameMap(FileConfiguration config) {
this.config = config;
this.spawnLocation = parseLocation("spawn-location");
}
public Location getSpawnLocation() {
return this.spawnLocation;
}
protected Location parseLocation(String name) {
return ...
}
}
public class BedwarsMap extends MinigameMap {
private final Map<BedwarsColor, Location> bedLocations = new ConcurrentHashMap<>();
public BedwarsMap(FileConfiguration config) {
super(config);
// get the section n do stuff
}
}
public class SkywarsMap extends MinigameMap {
private final Collection<Location> chests = new ArrayList<>();
public SkywarsMap(FileConfiguration config) {
super(config);
// get the location list n do stuff
}
}
So yeah this Map<String, Interface> pattern is something I use quite a lot
lucky table?
if diamond certain lower chance for sharpness and even lower for higher
if iron.. etc
Like groups or somn?
i thought as a fun little rpg thing
where it generate qaulity loot
so diamonds would have lower chance to have higher enchants
and iron more then diamond
Ehh that's more math
You basically just generate a "rarity score"
And make an enchant score out of it
So if your rarity score is really high, it can be inversely proportional
Bruh
given a class A, an instance of class A that may be a subclass called obj, and a subclass of A called B, how can i check that obj and B are the same class? (ie obj a direct instance of B) Instanceof only works one way
Anyone know what this error means / how to solve it?
Is it that I am using an outdated version of NMS ex, the one I have now is 1.19.4 but the server is on 1.20.2
Compare getClass()
Class.isInstance(object)
Why is library loading still considered a preview feature? It's been there for so long
No one bothered to update the docs I guess
nice hat
Ɓruh what
Oh, gotcha
how do you make the config.yml have like explanations rather than just thing: value like # This does that to thing
Intelliji just crashed after telling me to update the towny dependancy to a version that does not exist
But how do I work with code that is not obfuscated with specialsource?
how do I rotate an entity towards another entity?
?nms
nope, I mean just a method that is not local
well, like teleport (mathematics)
I need to rotate the item Display towards the entity
I'm not sure but try subtracting the target entity's direction vector from the entity's that you're trying to rotate
I saw code from php:
$xdiff = $player->x - $e->x;
$zdiff = $player->z - $e->z;
$angle = atan2($zdiff, $xdiff);
$yaw = (($angle * 180) / M_PI) - 90;
$ydiff = $player->y - $e->y;
$v = new Vector2($e->x, $e->z);
$dist = $v->distance($player->x, $player->z);
$angle = atan2($dist, $ydiff);
$pitch = (($angle * 180) / M_PI) - 90;
0_0
Ig you need the yaw and pitch to rotate or something
I understand that I need them, but here’s how to calculate them
It's unreadable for me))
Ask chatgpt to break down the code and explain line to line.
// pseudocode
float xdiff = player.x - entity.x;
float zdiff = player.z - entity.z;
float angle = atan2(zdiff, xdiff);
float yaw = ((angle * 180) / PI) - 90;
float ydiff = player.y - entity.y;
Vector vector = new Vector2(entity.x, entity.z);
float dist = vector.distance(player.x, player.z);
float angle = atan2(dist, ydiff);
float pitch = ((angle * 180) / PI) - 90;
Somethinglike this
pretty cool thing
You could use a library, like mine: https://github.com/aparx/bufig-library which makes configs generally more easy. You should also be able to set comments natively with spigot in newer versions
Is there any way to store a primed tnt entity along with its primer?
TNTPrimeEvent does not provide the getPrimedEntity() so I cannot map its UUID to the primer UUID. EntityExplodeEvent does not provide any way to get the entity who primed the explosion either
the entity will be the next spawned
private HikariDataSource hikari;
public MySQLManager(String host, String database, String username, String password, int port) {
this.hikari = new HikariDataSource();
hikari.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
hikari.addDataSourceProperty("serverName", host);
hikari.addDataSourceProperty("port", port);
hikari.addDataSourceProperty("databaseName", database);
hikari.addDataSourceProperty("user", username);
hikari.addDataSourceProperty("password", password);
}
why get error?
.
as the event is cancellable it's not spawned yet
you have not shaded hikari
How you do it?
artifact
because is multi module
you DEFINATELY can;t build with artifacts when using maven and multi module
is it configured to run maven?
it's the first time I've used module, I don't know
open your final jar and you will find there is no com/zaxxer folder
@eternal oxide
add the maven shade plugin
Sorry but I don't know how to do it
this is an tutorial?
in your pom```xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</plugin>```
version is probably old, but
Should I put it in the main pom?
I don;t know your setup so experiment
i try all
@eternal oxide https://stackoverflow.com/questions/21021485/how-to-configure-maven-shade-plugin-in-a-multi-module-project i try this
put it in teh pom that has the resource
How can I disable boat collision?
hey im tring to learn java rn and guy in yt tutorial say i have to press alt+einfg but i dont get an menu in inteli where i can paste event listeners
can some1 help me pls
i have minecrfat developemnt instaled
the plugin
No
:((
ig im watching an tutorial
anyone know how to get a non terminal iterator on a stream
just write
Idk who
what
just rewrite this
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< dev.scienziato1pazzo.it:Core >--------------------
[INFO] Building Core 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for dev.scienziato1pazzo.it:Lobby:jar:1.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for dev.scienziato1pazzo.it:BedWars:jar:1.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for dev.scienziato1pazzo.it:Utils:jar:1.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.124 s
[INFO] Finished at: 2023-12-10T11:46:57+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project Core: Could not resolve dependencies for project dev.scienziato1pazzo.it:Core:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: dev.scienziato1pazzo.it:Lobby:jar:1.0-SNAPSHOT, dev.scienziato1pazzo.it:BedWars:jar:1.0-SNAPSHOT, dev.scienziato1pazzo.it:Utils:jar:1.0-SNAPSHOT: dev.scienziato1pazzo.it:Lobby:jar:1.0-SNAPSHOT was not found in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of spigotmc-repo has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
Process finished with exit code 1
Don’t work it don’t becomes orange
what is this?
If an import is gray it means it isn't used rn
How can I make that it be used
..use it
in your code
If you import EventHandler and do not use it anywhere in your code it's gray
@clear elm send your code
If I rewrite whole code should it work
I haven’t a code
?learnjava moment i think
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
I wanna get this but guy in tutorial pasted it from somewhere
I try write whole code
okay
dont do ignoreCancelled = true
what?
It's useless
okay
@clear elm I recommend you learn OOP before making any plugins.
object-oriented programming OOP
okay
the base of java
are there tutorials for OOP?
it can help you for the basic
umm buying ?
never pay to learn java
and do not buy teh MC plugin. Learn hwo to do it by hand first, then buy it if you want to be lazy later
I know, but... it's not easy to get started without a guide.
learn first, then pay for shortcuts if you want
🤮
it dont works for me so im doing it per hand xD
good
the MC plugin pay is copied
how much time you think i need to code till i can make for example home plugin with gui without tutorial
depends how much time you do it each day and how fast you learn
7g
max
7g?
7 day
If you understand the basics of Java then everything becomes very easy, the only thing I can teach you is NMS
net.minecraft.server
Having been programming for 5 years, I still haven't fully figured it out.
Me too
you 14 yo?
15,
Nms is esay
no
first i learned configuration than skript and now im tring learn Java
Java is not much harder than Skript
skript = 🤮
ik
For most stuff it is untill you get to registries and jank internals
it was an alternative if i wanted smth custom cause java was to hard
@clear elm remember: "When you encounter a bug, it's not an error, but merely an unexpected feature trying to get noticed. Grab your cup of coffee, solve the mystery, and keep coding with determination!"
,,By scienziato1pazzo,,
sure for example how it should make custom rtp
with java OR Skript and skript is easy
I am creating bw plugin and other than the error I showed before, it's simple.
DO NOT
okay
BUY THAT
I learnt from Kody Simpson. I knew 0 Java. Now, about 2 years later, I'm getting commissions
0$ spent
I just coded stuff and learnt from it
The very basics I got from Kody
first thing i will buy is an server i have lokal host its shit xD
A server will help yeah
who is cody?
Just look up Kody Simpson Spigot on youtube
https://discord.gg/RjWMcuXz enter in this new discord, write in help, if you want support
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
At least the VERY basics
the basic yes
whats this ?
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Tutorials are good, knowing how to do stuff yourselves is even betetr
it's a server of mine created yesterday for people who can't find the solution for something
If you know the basics of Java, you already kinda can work with any API, including Spigot
i joined
So start with that
yea i wanna watch the tutorail till the end than i will start do smth by my own
Yeah
Do both at the same time
If you can find any exercises for yourself to practice Java that you just learned, that's even better
okay ty have a good day !
You too
is a class signature with a variable number of generics possible?
Asking about your attempted solution rather than your actual problem
you can have a variable number of the same generic
ye, im thinking about what you suggested yesterday
the <T extends Event, Consumer<T> U> pair
bleh i do not know how to write that signature
ive seen those before, they work in generics?
Is it a good idea when creating a large project to move all the repeating code into a separate class like "repetitionUtill"?
maybe 800 lines of code will come out
I wanted to do it temporarily until I understand the entire structure of the project
yes, no point in repeating code. Just tidy up later
but it’s true that when creating a website, the entire basis of backand logic is processing the request?
i want try create site
every logic that should not be accessible to user goes to backend
ie role managment, database calls, external api calls etc
button processing lol
what
I just heard recently that backend is easy and all they do is handle requests when a user clicks on a button
its not
I made my first plugin yesterday, basically it should increase the dropped items realistically on animal death but the issue now is, i need to find the way to make animals harder to find. I did try the spigot and bukkit .yml configs but it didn't help much, is it possible to somehow achieve this in the code?
idk but I'm told that frotend is more difficult because of the obligation to adapt the site to different platforms
im doing this trying to understand generics rn but.....
isnt T restricted to be Event here?
what criteria are included in "search complexity"
did you reduce the amount of animal spawning?
the number of animal spawns per chunk ?
etc
Less animals in group, less chances to find domestic animals that are used for food, but wolves, rabbits, foxes and wild animals like that don't really need to be altered because without them wilderness would feel too dead
i think cMap shold have T generic
Yeah i did, but i didn't really feel much of a difference
I found on some forum post that i should increase the number of animals per tick, apparently increasing the default number of 400 i think, will lead in less animals
hey @eternal oxide u got a second?
Doesnt the latest version run on 21?
I think you can use templates if you run your server with 21
i mean if you run your server on JDK 21 preview it should work
21 is fully released
yes but string templates are a preview thing
No need for preview in 21iirc
wtf intellij lying to me than
Oh i thought those got added in 21
I think you want something like this:
public class SomeEventHandler {
private final Map<Class<? extends Event>, List<Consumer<? extends Event>>> listeners = new HashMap<>();
public <T extends Event> void registerListener(Class<T> eventClass, Consumer<T> listener) {
listeners.computeIfAbsent(eventClass, k -> new ArrayList<>()).add(listener);
}
@SuppressWarnings("unchecked")
public <T extends Event> void handleEvent(T event) {
List<Consumer<? extends Event>> eventListeners = listeners.get(event.getClass());
if (eventListeners != null) {
eventListeners.forEach(listener -> ((Consumer<T>) listener).accept(event));
}
}
}
Hello everyone, I'm trying to send multiple resource packs to a player using player.setResourcePack. It seems not working for me, the first sent is replaced by the second.
Someone already succeed to send multiple resource packs to the client using Spigot?
when can I send the map packet after join for it to be visible?
are there any specific packets I could wait for?
You need to merge the resourcepacks

Right?
Why ? The client can accept multiple resource packs no ?

