#help-development
1 messages · Page 563 of 1
look at jefflib
Think of modules as sub-projects with their own little dependencies
what would be a use case though ?
One is NMS
A module for each version
Another is like uhh
A project that's made of multiple parts
Oh I see
For example I have a project that's like
like a library
spigot <-> web server
mhm
So I have a spigot module, a protocol module and a web server module
Spigot and web server both shade the protocol
okay okay
An that way I only do stuff once
Another use-case is like a plugin that has both bungee code and spigot code
yup yup
yeah that makes sense thanks
I use modules on cosmos to have a sample plugin
baeldung's the goat
they truly are
a good example is api and implementation
it makes it easier to provide an api jar
and the full jar
Like Bukkit and CraftBukkit
craft bukkit being the implementation
correct
okay cool,
would it make sense to made a library project that like
had a bunch of utils as one
but if i sepersted it into diff modules
you could pick and choose ?
Sure, because maybe you want to also offer those things as separate jars if people only need those small things and not the whole thing
yeah yeah
also, the other advantage is lets say multiple modules share a common dependency
mhm
instead of all the projects having it listed in their pom
you can list it in 1 place and that is the parent
oh sweet
and all the sub modules would have it included automatically
also, sub modules can override what the parent has by just listing it themselves
can other modules talk to each other ?
so, anything in the parent is inherited until overriden 😉
mhm mhm
in a way yes
like if I had a utility class that all modules used
would i define that in the parent
and then all modules could use it
no because then the utility class would reference itself as a dependency
inventorydragevent literally does nothing
ohh i see so the utility would just be it’s own module that all the others could inherit
Also, when your modules depend on another
you need to ensure your module list is appropriate
it’s called when an item is dragged..?
as in?
so your example, you would need to have the utility class listed as the first module
so that it gets built first
uhhuh
i have debug messages
i see
declaration: package: org.bukkit.event.inventory, class: InventoryDragEvent
are you registering your listener?
also there’s a module hierarchy @wet breach ?
this gotta be the worst thing ive seen
@EventHandler
public void onClick(InventoryDragEvent event) {
event.setCancelled(true);
}
}```
actually scratch that, it only needs to be listed first if you want to use the jar as a dependency lol. An alternative you could do is instead in the other modules is just specify additional sources and its relevant directory to take the sources from, in this case your utility module
perfectly normal
oh okay lol
module hierarchy is defined as how you list the modules in the parent pom
oh that’s simple
show your onEnable()
got it sweet
this is how multi version NMS is done?
yeah you can do all kinds of things with maven, it just depends really how creative you are
you could go as far as just making your own maven plugin which is super easy to do, to do things you want it to do for your projects when you build
and cool part
maven plugins work just like your plugins, pluck them in a repo that people have access to and maven pulls your custom maven plugin to build 😄
i don’t even know what i’d make a maven plug-in for
liek auto pushing builds over ftp to a file server ?
hello, begginer question but
if i have a shulker placed on the ground in a minecraft world, could i perform actions on it
void onSomething(SomethingEvent event) {
new Location(loc.getWorld(), x, y, z).getBlock().setType(Material.SHULKER_BOX); // can i perform actions on this shulker box
}
void doBoxStuff(ShulkerBox box) {
// box.doSomething();
}
is this correct?
deployJar??
sure, maybe you don't like the ones most others use
you can absolutely make your own that you like
or does what you want
what are common ones? Javadoc?
Yeah maybe there is a software that you like for making javadocs
you could make a custom javadoc maven plugin that integrates with that
i see
are you looking for the shulker box or the shulker entity
in theory that should work
think of maven plugins, like bukkit plugins. Basically you can do whatever you want just as long as you follow the basic rules that are required
yeah i got you
time to make a mc test server maker plug-in
someone has done that
problox is ShulkerBox is an abstract class and cant be initiated, so i cant use doBoxStuff
its called MockBukkit
you have to spawn the entity
World#spawnEntity
and put shulker box as the entity type
but just because something exists, don't let that deter you from making one
obv
i’m still having a hard time wrapping my head around how to use this but i think i just need to start coding
ok here is an example of needing a custom maven plugin
maybe you have some bash scripts you need ran during the build phase for some stuff to be included in the final jar
a custom maven plugin would help with this because it would pause the compiling when your maven plugin is reached and wait for your plugin to say ok continue on
and your maven plugin could execute said scripts
yep yep
oh multi modules
this shows how I use a multi-module for this project, the only thing it doesn't show is how to fully utilize the parent pom for the modules
I think mfnalex might have some projects that show that
okay sweet
yeah I like modules
because you can also as a user just build a module you need specifically
but yeah you had a good example though for multi-modules
where you have a utility stuff but don't want all those in a single a jar or project
or maybe that the utilities are vastly different from each other it doesn't make sense to have them in the same project
package Oreos.Builder.Extruder.RightClick;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
public class GetBlocks {
public String getOthers(Block block, BlockFace face) {
Location[] blocksToCheck;
if (face == BlockFace.NORTH || face == BlockFace.SOUTH) {
// UP DOWN EAST WEST
blocksToCheck = new Location[]{
block.getLocation().subtract(0, 1, 0),
block.getLocation().subtract(1, 0, 0),
block.getLocation().add(0, 1, 0),
block.getLocation().add(1, 0, 0)};
} else if (face == BlockFace.EAST || face == BlockFace.WEST) {
// UP DOWN NORTH SOUTH
blocksToCheck = new Location[]{
block.getLocation().subtract(0, 1, 0),
block.getLocation().subtract(0, 0, 1),
block.getLocation().add(0, 1, 0),
block.getLocation().add(0, 0, 1)};
} else {
// NORTH EAST SOUTH WEST
blocksToCheck = new Location[]{
block.getLocation().subtract(0, 0, 1),
block.getLocation().subtract(1, 0, 0),
block.getLocation().add(0, 0, 1),
block.getLocation().add(1, 0, 0)};
}
return String.valueOf(blocksToCheck);
}
}
Any idea why it returns [Lorg.bukkit.location;@SomeRandomCharacters]
Don't use string value of
here are some examples:
[Lorg.bukkit.location;@1d06e7e8]
[Lorg.bukkit.location;@, c9ab0e]
[Lorg.bukkit.location;@1672b5]
How would I print it out then
to the player
Use toString on the location
You're trying to print an array.
How would I convert it to a string
without getting it converted to some wierd Lorg stuff
?
Arrays.toString() or iterate
how can this be null? (PlayerMoveEvent)
.toString doesn't work, would I have to do a for loop?
List.forEach(item -> Bukkit.getLogger().info(item));
I’m sure that can be shortened but I forget off top of my head
what version are you on?
1.12
idk if location can be easily printed like that
sWhy are you returning a string first of all
Needs to print out to the player
Yeah but that's not the original intent
java 8 added forEach
That's wierd
not great advice but eh
Nice Memory Addresses, I think you'r best off making a player readable format using String#format method
It's a hashcode not memo address
something like %s, %s, %s
I always thought the little thing at end were mem address
what are memory addresses 👀
foreach does not work on arrays though? or am I mistaken
(JOKING)
Location objects can be null
therefore, getTo() in some weird way could be null
player could go to nowhere land
Cannot resolve method 'forEach' in 'Location'
Anyways my stupiditiy asside you should prob do something like String.format("(%f.2, %f,.2 %f.2)", loc.getX(), loc.getY(), loc.getZ())
by that logic all objects can be null
for some reason it just doesn't show up at all
While yes, there are some things in the server that are guaranteed to not be null. Unfortunately location objects are not one of those
due to the way MC handles such things
ah
but PlayerMoveEvent#getFrom() isn't null
while getTo is nullable
its annotated because why tf not
because getFrom() is known and can't be unknown. That is, it is impossible to not know where the player currently is
that's fair enough
it’s safe to assume getTo won’t be null
it is impossible to guarantee that where the player wants to move to actually exists
but its possible to guarantee where they are currently at
does exist
and just iterate that over and over for each thing inside the array?
if that helps why getFrom() is not nullable 😛
I suppose
I'd make a map and have a config honestly
yes let me show you how
this is how I do permissions 🙂
how do i make my plugin safe from people who crack it
well how do i make it hard to crack
you don't
don’t bother
Java was never designed to stop or prevent reverse engineering
therefore, any attempts to try to make it impossible or hard is futile since it was never designed into Java to begin with
what if i use like api keys or something, how do i make it so people cant see them when they crack it
people can still just change a false to a true
?
just use env variables or config for api keys, dont hardcode it
just don't worry about cracking
as long as you are constantly providing updates and its of decent quality, people will use your stuff
You can just
provide so many updates
that all the cracks will be brokey
That's... a config section
are you wanting to know how to obtain stuff that is dynamic in a config?
ConfigurationSection testSection = config.getConfigurationSection("Test");
for(String key : testSection.getKeys(false)) {
ConfigurationSection subSection = testSection.getConfigurationSection(key);
...
}
Well
you could've just said that you wanted to get test.test2
I'd convert it all to cached data
Let's say you have something like
public class PlayerRank {
private final String name;
...
public PlayerRank(ConfigurationSection section) {
this.name = section.getString("name");
...
}
public String getName() {
return name;
}
...
}
public class PlayerRankRegistry {
private final Map<String, PlayerRank> rankMap = new HashMap<>();
public PlayerRankRegistry() {
// get the config and call load here
}
private void load(FileConfiguration config) {
ConfigurationSection rankSection = config.getConfigurationSection("Rank");
if(rankSection == null) { // config error?
return;
}
for(String key : rankSection.getKeys(false)) {
ConfigurationSection subSection = rankSection.getConfigurationSection(key);
PlayerRank rank = new PlayerRank(subSection);
rankMap.put(key, rank);
}
}
public PlayerRank getRank(String rankId) {
return rankMap.get(rankId);
}
public ImmutableCollection<PlayerRank> getAllRanks() {
return ImmutableList.copyOf(rankMap.values());
}
}
That's how I'd do it
maybe do the config loading logic elsewhere but you get the idea
It would allow you to do like
rankRegistry.getRank("Member").getName();
Everything you do with configs should be matched with java objects
anyone know why i cant use this
ClientboundPlayerInfoPacket
1.19.4
in NMS
did they change it to
ClientboundPlayerInfoUpdatePacket
that's not an NMS thing no its a Bukkit method
essentially InventoryView#getOriginalTitle is just getting the first title you put in for the inventory prior to 1.20 getTitle will always return the original title unless you mess with InventoryView
I am asking because I read that you used NMS for Inventory#setTitle
Post 1.20
this.originalTitle = CraftChatMessage.fromComponent(container.getTitle());
this.title = originalTitle;
Pre 1.20
No Field title exists
this code is extracted from CraftInventoryView https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java#18,25
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/diff/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java?until=a7cfc778fdb0f92dd0574939d6f81fbfa33742a0 here is the git dif probably better to just look at this
is there any zombie villager cure event in skript?
idk
?jd-s
doesn't look like it
i dont need spigot event
so no
EntityTransformEvent
i need skrip
is that skript event?
idk how skript works, all I know is that it's total shit
i know its shit. i just dont want to create new plugin for client :/
is there any way to disable curing zombie villagers with skript
mhm ok
import:
org.bukkit.event.entity.EntityTransformEvent
on EntityTransformEvent:
# your code
lol
sounds good.
will this code work guys?
ok ill use it
thx
skript>nothing
can anyone help me mb?
oh this one sounds better. checked now
what is reflect
bruh
i need thing that is called "reflect"?
On Entity Transform:
if event-entity is zombie villager:
if future event-entity is villager:
cancel event
i need some help ...
isnt it better to say directly what you want to help with
yeah ik
its still same xd
java.lang.NullPointerException: Cannot invoke "de.mentania.wartungssystem.MentaniaData.isStatus()" because the return value of "de.mentania.wartungssystem.MentaniaData.getWartungManager()" is null
any suggestions?
its mine
lol
Mentania.net is my network
no worries. ill get skript support
You mean send the whole main class?
dont know how to send code in this grey list so i send my java if its okay
and for the record i dont code with bungee for long now
in pastebin?
https://paste.md-5.net/esidibiroj.java
dont judge me bungee isnt mine
Caused by: java.lang.ClassNotFoundException: net.minecraft.world.entity.player.Player
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:147) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19.4-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
how come i get that error
dont know i looked up in the internet nerver worked with a config.yml before
so what do i need to edit
public static MentaniaData wartungManager;
this?
what do you mean with initization?
okay done
should work now?
if (MentaniaData.isStatus()) {
you mean this
english xd date object can you maybe explain to me?
Caused by: java.lang.ClassNotFoundException: net.minecraft.world.entity.player.Player
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:147) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19.4-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
how come i get that error
You forgot to remap
?nms
i ran build tools with java -jar BuildTools.jar --remapped
i get no errors in the ide
only when i run the server
Read it
eh that's not what they were saying
now i got this error morice
Non-static method 'isStatus()' cannot be referenced from a static context
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
its acctully not static
public boolean isStatus() {
return !this.status;
}
not static
public void setStatus(boolean status){
not static or do you mean something else?
public boolean status; not static
you mean my class or the error
public static boolean isStatus;
the error wants it to be static
the listener and command
says it
dont know
yes
instance how do i create one i dont work with bungee alot
true
wait
okay thanks
it wants a try and catch when i do new MentaniaData() in onEnable should i do this
what was the getter
i mean getter how do i do it
my brain is not working rn
yes thanks
WartungsSystem.plugin.
and now getMentaniaData or?
not working i dont see it if i try it
nop
is it
maybe i did it wrong
how do i make an npc show in the tab list
What's with the usage of Input/Output Streams when #getConfig() and #saveResource() exist?
Probably copy pasted from somewhere
They don't appear to know basic Java
yeah from spigot site
There's a thread that recommended doing that?!?!
Is it on the wiki or is it just a rando resource thread?
do you want me to send you the link?
That would help.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
i got it from there
That's the bungeecord configuration. Not the spigot configuration.
You want this one.
https://www.spigotmc.org/wiki/config-files/
why do i want this one?
Oh wait, are you making a bungeecord plugin?
yes
Why the class is not found?
I tried to use reflection to get class from NMS from purpur fork but no luck. This class does not exist in NMS I assume that paper added it to rewrite chunk system. Any idea why the server says that class is not found? The server: purpur 1.19.2 build 1858
Class.forName("net.minecraft.core.HolderGetter")
btw getData didnt work aswell
?whereami
oh sorry 😅
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
i mean Mentania.plugin.getData dont work
the getter dont work i think
can i rename getData to getMentaniaData
its public but i still cant do this
How do I make my npcs show in the tablist
yes i know
i mean Mentania.plugin.getMentaniaData is not working
i still cant do if (Mentania.plugin.getMentaniaData) in my Command class
so what then
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.
true
anyways knowing the difference between a function/method and a variable/property is like the actual most basic thing
this doesn't seem to work tho
There is only ever one Player reference, You can't instantiate a clone
i dont know what i need type to core plugin
Anyone know why my npc doesn’t show up in the tab list, do I need to do anything?
you didn;t send it to all players then
if (sender instanceof Player p) {
CraftPlayer craftPlayer = (CraftPlayer) p;
ServerPlayer sp = craftPlayer.getHandle();
MinecraftServer server = sp.getServer();
ServerLevel level = sp.getLevel();
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "Cole Gildea");
ServerPlayer npc = new ServerPlayer(server, level, gameProfile);
ServerGamePacketListenerImpl ps = sp.connection;
ps.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));
ps.send(new ClientboundAddPlayerPacket(npc));
}
but what if i wanna do something like this?
// .clone() isnt possible here
// Cloned player who is in survival mode
Player oldPlayer = p.clone();
p.setGameMode(GameMode.SPECTATOR);
// should return GameMode.SURVIVAL
GameMode oldGamemode = oldPlayer.getGameMode();```
there is no clone on Player
ik that, so how would i do that?
You don’t clone player
GameMode oldGm = p.getGameMode()
p.setGameMode
But you can save old data in variables
point is i need lot more data too besides gamemode,
location, inventory, potion effects
looks fine to me
currently im using maps to store it but was looking for a better way
yeah its strange idk why it doesnt work
Use a class
That way you have it structured compile time
class PlayerSnapshot {
…
}
but i would have to create local variables for all the stuff i'm trying to store then, right?
do records add any performance benefits?
im not a huge fan of them and not sure why i’d use it
less bloat code
still waiting for record classes so mutable classes become less bloat too
ill probably have to use other langs for that
using that i'd have to write my own methods?
for getting the inventory, location etc
actually nvm, i figured it out
i was using it wrong
record Whatever(int x, float y) implicity makes x() and y() getters
creating the playersnapshot updates with the current player too
so the old data is gone
so this is my custom item.
that record class doesn't work for me either
and I want it to change to kb thing only
You use it wrongly then lol
I hope you’re not passing the player to the record
Discord didnt give me the name change in time
oh 💀
Yikes bro
i thought thats wat u meant
so seperately pass each thing?
then in that case why dont i just use local vars for it
If you want to
Sure
how can I just change the knockback resistance and not other stuff?
attributes
UUID.randomUUID(),
"generic.knockback_resistance",
0.2,
AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlot.LEGS);
itemMeta.addAttributeModifier(Attribute.GENERIC_KNOCKBACK_RESISTANCE, knockbackResistanceModifier);```
this is my code
Storing a list of the player's pets in a yaml document
for some reason my JSON is just saving to a 0 byte file when I try to save the file? I'm so confused on what I'm doing wrong.
public static <T> void fileize(@NotNull final T object, Class<T> clazz, @NotNull final File file) {
Preconditions.checkNotNull(object);
Preconditions.checkNotNull(file);
try {
gson.toJson(object, clazz, new FileWriter(file));
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
public static <T> T objectize(@NotNull final Class<T> clazz, @NotNull final File file){
try {
return gson.fromJson(new FileReader(file), clazz);
} catch (FileNotFoundException e) {
throw new IllegalStateException(e);
}
}```
```java
GsonUtils.fileize(this, (Class<DomainInfo>) this.getClass(), jsonFile);
it should serialize the object as I have the proper TypeAdapters
close writer
public String getOthers(Block block, BlockFace face) {
Location[] blocksToCheck;
if (face == BlockFace.NORTH || face == BlockFace.SOUTH) {
blocksToCheck = new Location[]{
block.getLocation().subtract(0, 1, 0),
block.getLocation().subtract(1, 0, 0),
block.getLocation().add(0, 1, 0),
block.getLocation().add(1, 0, 0)};
} else if (face == BlockFace.EAST || face == BlockFace.WEST) {
blocksToCheck = new Location[]{
block.getLocation().subtract(0, 1, 0),
block.getLocation().subtract(0, 0, 1),
block.getLocation().add(0, 1, 0),
block.getLocation().add(0, 0, 1)};
} else {
blocksToCheck = new Location[]{
block.getLocation().subtract(0, 0, 1),
block.getLocation().subtract(1, 0, 0),
block.getLocation().add(0, 0, 1),
block.getLocation().add(1, 0, 0)};
}
String toReturn = "";
for (int i = 0; i < blocksToCheck.length; i++) {
if (blocksToCheck[i].getBlock().getType().equals(block.getType())) {
toReturn = toReturn + blocksToCheck[i] + "\n";
// Add block coordinates to array here
}
}
return toReturn;
}
I have a class which works, however I would like to add the blocks retrieved from around the original block back into the array... How would I do this?
ahhh I thought gson managed that
thanks Ig I'll just try with resources
probably also want a buffered writer
anyone?
mmmm is that really a big deal if I only load and close on startup
if i show the same inventory to multiple people
is that like a thing
and if i update that inventory will it be reflected to everyone
How can one remove the no usage warning from IntelliJ
its annoying asf considering I'm making API ofc its not used
Na not really
But File and FileWriter just stink in general
just slow?
I can't
File legacy api
hmmm is java.nio better in general
well you are probably supposed to use java.nio packages now adays
all of them are horrible xD
exactly my point
just make one thats not bad
and then we all use that
end of story
:( I hate this cuz it changes the colors to all gray, and it annoys me also When I go to warnings I wanna see the warnigns not useless shit
I dont want to go shopping I want to read some text from a string
There isn’t lmao
I mean you have nio and io
Thats it
I dont have that issue
okay, so what class do I use for file io
its a personal issue, but I can't stand it since I mostly make API not often I do plugins
well more like I dont any gray things until I click on the small warning triangle
toPath what
what do you mean
using new style btw
can i get all block in one tag ?
same
buffered reader/ writer requests a filechannel to the os, while the "legacy" readers/ writers work linearly
or smth in that sense
so what gray things are you talking about
it grays out the method name
but I fixed it
oh
by disabling a shit warning anyways
File#toPath
like duh no one is using my Event internally smh
can i get all block with one tag ?
no
what Tag?
that defeats the points of tags
all blocks tag i wanna disable block physics event is sourceblock is all blocks
why are we not using #isBlock????
what is this isBlock ?
No lmao
Material#isBlock
I'm not understanding yoru question
File#toPath() yields Path
what does a Path do
This Java tutorial describes exceptions, basic input/output, concurrency, regular expressions, and the platform environment
okay
I never heard of this anywhere so thanks for teaching it to me
this sounds like teh one way everyone should do it then
:3
Yea
Well a lot of old stuff still uses File
So thats why its still used
But usually you wanna question yourself if you touch io
yeah and so do like all tutorials I could find
You can always ask here what’s the correspondence in terms of nio
I've yet to see a benefit of using nio over io
its looks easier to use
Non blocking being the biggest of them lol
Also the broken behavior in File
Also it doesn’t receive any updates any longer
Doesn;t need updates if it does all it should
But it doesn’t do all it should or promise by contract of the methods provided
yeah this is what I mean
I've never had any issues with io
some other languages can just decide on a single api for file io
but java has all these different options
I’ve experienced DoS from it, and unexpected crashes due to poor exception api and circular symbolic links
remember again what happenend when you implement standards
Also the fact that it doesn’t provide any NIO behavior
what do you mean
yes
im not saying it can be fixed
its just fucked anyways
if the first one was good, there is no need for others
It provides an api for operating non blocklingly in a safe and rich manner
Yeah but it wasn’t
Much like a lot of other stuff from Java lmao
yeah
Ehm autocorrect being goofy
thats like the most annoying thing about java
SimpleDateFormat being one of them
Myea, well its not easy
Because back in the days memory was not something we had overly much of
Which resulted in certain paradigms and patterns becoming mainstream
But now that shifted, ergo shifting mainstream interests also
yeah I guess some things age worse than others
Java was for instance the reason netty was created
Jota
Among other libraries
Or well the issues of java caused the creation of those libs
i need do custom sapling u guys have a idea for this ?
i mean i need spawn schematic on sapling growth ?
math
^
spigot api
Yeah either that or if you use schematics
But then just save the offset the sapling will have, and spawn it based on that
schematics though are bloat
you could spawn differing trees in a few lines of code
can i do custom trees with spigotapi ? i mean like custom enchantment,commands,itemstacks
um
you can do random patterns but they are composed of blocks, so no extra data
Spigot doesnt do the math for u
Yep there is no tree api
alright i will use schematic spawn
but can i check if sapling relative is null?....
i mean if i spawn custom tree with my schematic
but if there is a block on it
can i make it not happen?
but my homework...
No a schematic is set area, it replaces all blocks
you suggested math
but i don't understand
how can i do
which event ?
growing one using math you can grow it only in open spaces
or override ?
No event really
You just calculate the locations of the leaves and branches basically
so i can't do trees like this ?
only like vanilla trees ?
That’s theoretically not impossible
Doesnt work in game
But the math could take some time since I assume you wanna cover edge cases
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
ok
looks like procedural generation
what u guys do mean for math ? i don't understand u guys have a example for this ?=
math is spigot feature or normal math funcs ?
.
Math funcs
Normal math
can i calculate block locations ? on tree growth ?
Wdym
Are I'm the only who's Discord font has changed?
Affirmative
font change? when?
Today
It doesnt even try loading
same for me, but like over a month ago
didnt notice then
declaration: package: org.bukkit.event.world, class: StructureGrowEvent
since you werent looking
🤨 hmm confusion
Most use spaces, I prefer tabs
i started to prefer tabs too
i found a neat feature with tabs on jetbrains products
when you switch to tabs you can select one tab
to see what if statement it belongs without scrolling to the top
someone seems to use my theme
i found a good font too
arent tabs like 8 spaces
i thought i was using tabs but my ide was lying to me
4 usually
the linux kernel code takes it to a whole new level 💀
8 spaces to be exactly
to decourage nesting
tabs are unique symbols
you usually make one tab from 4 spaces
but with tabs you decrease your filesize
dang
and you can make you indentation adjustable in pixels
cons that many developers despise using tabs for some reason
for example you cant code in python with tabs afaik
python kekw
Python disallows mixing tabs and spaces for indentation.
it apparently allows tabs
but you cant mix them with spaces
look at this amazing font 
nice lookin
bad decision to use vim keybinds, i want to use them in discord too now
is there a key bind to delete all content inside the () that i’m in
all at once
that deletes like words at a time
if i have multiple arguments then
it’s still a pain
does the PotionSplashEvent not for for the Uncraftable Potion?
?tas
i did
but im not sure if im just doing it wrong
then if it doesnt work then yeah
ok
is there a way to get it working with unfraftable potion 💀
public void onGrenadeUse(PotionSplashEvent event) {
ItemStack item1 = event.getPotion().getItem();
ProjectileSource source = event.getEntity().getShooter();
Player player = (Player) source;
assert player != null;
World world = player.getWorld();
Bukkit.getLogger().info("First");
if (Objects.requireNonNull(event.getPotion().getItem().getItemMeta()).getLore() == Objects.requireNonNull(ItemHandler.grenade.getItemMeta()).getLore()) {
Bukkit.getLogger().info("Seconds");
ItemMeta potion_meta = event.getPotion().getItem().getItemMeta();
event.setCancelled(true);
if (config.getBoolean("grenade")) {
world.createExplosion(event.getPotion().getLocation(), 5);
} else {
player.sendMessage(prefix + "§cThis item is disabled on this server, if you believe this is a mistake, tell the owner of the server to enable it.");
}
}
}
there's @EventHandler at top, forgot to include when copying
dont compare lore by ==
and no Objects.requireNonNull
intellij gave that to me
uncraftable potion might just have no itemmeta
how would I do it?
it does, its my own itemstack
then compare lore with equals
youre not checking anything
do I use .equals?
PDC?
@EventHandler
public void sapling(StructureGrowEvent e) {
if (e.getSpecies() == TreeType.DARK_OAK) {
e.getBlocks().forEach(blocks -> {
Block leave = blocks.getBlock();
if (leave.getType() == Material.DARK_OAK_LEAVES) {
leave.setType(Material.SPRUCE_LEAVES);
System.out.println("test");
}
});
}
}```i tried this code but not worked debug not working btw
?pdc
im new to spigot stuff lmao
oh god ::forEach
is wron g?
does your class implement listener and did you register the event?
creates a mess to read
yes
not to you bruh
Sorry I was talking to @quaint mantle
oh sorry lol
Did you register it in your onEnable?
Then add a message at the start of the listener and see if that goes through
every structure grow would send the message then tho
oke
idk but it would probably spam
well he could add the species to the message
so hard to tell if that's cuz of your action
also I just wanna see if that listener actually fires
after that we can take a deeper dive
the thing is, my code works for literally all potions but the one I want 💀
but any uncraftable potion*
it's just for (birch, normal, pine, red mushroom, brown mushroom)
Unless he has a huge forest there won't be spam
it gives me this when I
@flint coyote alright i did this and i got this in console
@EventHandler
public void sapling(StructureGrowEvent e) {
System.out.println("test1");
if (e.getSpecies() == TreeType.DARK_OAK) {
System.out.println("test2");
e.getBlocks().forEach(blocks -> {
System.out.println("loop");
Block leave = blocks.getBlock();
if (leave.getType() == Material.DARK_OAK_LEAVES) {
leave.setType(Material.SPRUCE_LEAVES);
System.out.println("test3");
}
});
}
}```
last "if" not working
can you print the block type before your if?
sysoutt the getType
it gives me this when I throw an uncraftable potion (besides the one that I want), no clue what any of this means though.
but im writing my thing in spigot, server is paper
Oh wait. Those aren't blocks - those are BlockStates
so I gotta join paper server now 💀 great
and then you do getBlock which is then again fine, nvm
lets see what the type will be
average spigot javadoc
i did not worked
and i got this on console
huh worldedit
ok
did you add the getType sysout
FAWE moment
What goin on here
oh no
fast async word exception
@EventHandler
public void sapling(StructureGrowEvent e) {
if (e.getSpecies() == TreeType.DARK_OAK) {
e.getBlocks().forEach(blocks -> {
System.out.println("loop");
Block leave = blocks.getBlock();
System.out.println(leave.getType());
if (leave.getType() == Material.DARK_OAK_LEAVES) {
leave.setType(Material.SPRUCE_LEAVES);
}
});
}
}
try this @quaint mantle
Wanna know what the type is
it's not even "blocks" but one block - and not even that but a BlockState 
well it's for trees and mushrooms only. Idk why they would name it structure - but that makes it look pretty old, yes
._.
so this sturcturegrow not checking leaves
how useless is that event if it gives you blocks BEFORE growth
wtf xD
Anyway, you can delay your loop by one tick and it should work
how much time u prefer ?
Remember that just changing the type of a state doesn't do anything
20 ticks ?
also why would there be grass blocks?
You need to call .update
1 tick
what are you supposed to pass in Bukkit#createBlockData?
oke
it doesn't even reach that part so far
A blockdata that has been turned into a string
via getAsString
or just a material, that method is overloaded
what if i wanted to use a string i made? am I supposed to pass something like minecraft:oak_slab[waterlogged=false,type=bottom]
worked ty
i was wondering what the correct format is, because i'm trying to pass a bunch of stuff and nothing seems to be working
Try printing out blockdata.getAsString
I still wonder why a StructureGrowEvent would return the Blocks before growth. That's like 90% Air
It's cancellable
Cancellable events pretty much always return the state before they run
so i'm passing minecraft:oak_slab[waterlogged=false,type=bottom] as the argument, and getAsString returns the same thing with waterlogged and type inverted
so im pretty confused
sus
choose custom and take something funny
Discords feature rollout is always scuffed
queue "ur mom is gay"
Discords feature rollout is always scuffed
huh where my strikethrough
wow
yes
nitro pricing is also scuffed - for some emojis I barely use lol
I only use discord because others do. I'd happily go back to IRC
just wait until they bring "stories"
Can't wait for discord shorts
yeah I have all shorts blocked
Or a discord AI bot chat like snapchat
i remember a tuit for a concep for stories in discord like meme...
Discord is gonna be the new Reddit?
if youtube shorts are a thing, does that mean youtube longs are a thing
Everyone hyping AI just like everyone was hyping among us and battle royal
I hate it
Sure AI will be more futureproof but not as a virtual friend, wtf
AI amogus battleroyale when?
Release date: 2036 heat death of universe
Maybe doing something extremely stupid like that would stop every company from including useless AI stuff
oh I forgot squid game
pls include squid game aswell
Alright so someone train a bunch of AIs on amogus and make them fight eachother in fortnite
To make money
Investors have zero clue about ai
Snapchat got a lot of hate for introducing that bot
They just believe
Investors have zero clue about ai
looks like i messed up again my math
#general 
christian dating servers 🙏
does a normal armor pieces have no attributes by default?
Get the defaults and then modify those
thats what I am doing no?
No
Create atributes first?
I'm trying to completely replace the nametag of what's above the player's head and put a new one
Bukkit API or ProtocolLib is there a good way? I haven't found a way that works yet, and Bukkit API won't remove the player's username.
Use Material#getDefaultAttributeModifiers
I remember when I had to use reflection to assign a damage attribute to a pig.
Was a funny moment when it walked to me to attacked me and the second it would have hit me - Exception
ProtocolLib and set nametag
not enough detail
what packet do I even send?
what can I write?
will this do?
I have and I even asked ai lmao
https://github.com/Alvin-LB/NameTagChanger There's this outdated lib but you might find something in it
That removeAll will throw an error
It's an immutable multimap, you need to make a copy of it
No, now you are just making another immutable copy
before or after removeAll?
Just copy it with ArrayListMultimap.create(otherMap)
Yeah that works
You don't need to declare a new variable tho
Multimap<blah, blah> multimap = ArrayListMultimap.create(material.getDefaultAttributeModifiers())
ok will try that thanks
what are the conditions for a goalSelector goal to run a stop() method?
does anybody have a resource for loot tables? All google is giving me is ways to make loot tables with a datapack, and I just want to know if it's possible with a plugin?
change drops for entities?
Yes, but it's not exactly what I'm looking for. I want dungeons, bastions, the stronghold, I want to change the loot tables for all of them, I have a bunch of crafting materials, and items I want to be given a chance to be found.
There isn't API to make/modifiy loottables
However there is an event for when a chest is populated from a loot table
So I'd have to check for when a chest is filled with items, clear the chest, and add my own?
Can the datapack access my plugin items?
Hey there, would somebody be able to help me with PersitentDataContainers?
Okay, well I am going to go learn how datapacks work and how to make them. 😂
?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!
Same way as on desktop
Nvm
```lang
code
```
Man discord mobile trash
do the comment to show
Sec hold on
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
here
Ty my phone was being dumb
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Block block = event.getBlock();
Player player = event.getPlayer();
ItemStack tool = player.getInventory().getItemInMainHand();
NamespacedKey key = new NamespacedKey(plugin, "type");
ItemMeta meta = tool.getItemMeta();
PersistentDataContainer itemtype = meta.getPersistentDataContainer();
// Check if the tool type is "mining"
if (itemtype.has(key, PersistentDataType.STRING) && itemtype.get(key, PersistentDataType.STRING).equals("mining")) {
So it’s just going to the else statement, is this the correct format for a PDC and running an if statement for checking for one?
here is the best exemple
Just do
"mining".equals(itemtype.get(key, PersistentDataType.STRING))
That's nullsafe too and will save you one operation.
and what the heck is a PDC? xD
yea true
PersistantDataContainer
How can I do a serialization and deserealization of an object that has a list of others? I have "Board" class that has List<Task>, i need to do serialize method for Board.
That is my Board serelization: ``` @Override
public @Nonnull Map<String, Object> serialize() {
Map<String, Object> map = new HashMap<>();
List<Map<String, Object>> serializedList = new ArrayList<>();
for (Task obj : tasks) {
Map<String, Object> serializedObj = obj.serialize();
serializedList.add(serializedObj);
}
map.put("location", loc);
map.put("tasks", serializedList);
return map;
}```
Task serealization:
public @NotNull Map<String, Object> serialize() {
Map<String, Object> map = new HashMap<>();
map.put("player", nickname);
map.put("money", money);
return map;
}```
I have problems with loading, so how can I load it?
static deserialize method
all expained on the javadocs
declaration: package: org.bukkit.configuration.serialization, interface: ConfigurationSerializable
Why I cant pick Items up from the smithing table?!?
https://paste.md-5.net/vadiwodojo.cs
I’ll try that ty
Not even home but yea
Where should I start if I want to modify world generation? Specifically I want to force only certain types of plants to generate in specific biomes & prevent others from generating. Can someone point out where I find find a tutorial on this or something? Thanks.
Where can i find the code that Spigot/Bukkit uses to get the colors of the world to put them on a CraftMapCanvas?
?stash
craftbukkit
anyone?
i meant in what class...
ive found this but i cant find there the colors array gets filled
so hard ☠️
i assume u were answering me right
im guessing the list will deserialize each entry
yeah
you know in what class?
i've been searching in MapItemSavedData, CraftMapView, CraftMapRenderer and CraftMapCanvas, but I can't find it, I'm searching since an hour
Maybe i'm blind
It'll be an nms class
WorldMap or something
Though did we add an API for block colour? Might've
this? MapItemSavedData?
ItemWorldMap#update
Ah nice, that's it, thank you
(sorry if this is abit out of topic) is there a better way to log stuff on a server than discord logs?
What stuff
I mean you can create a JSON file to store information with logs,
and have an ingame command to view it
things like rare drops on a server with them
Wdym?
lets just say mobs drops
Mhm.
You need to explain exactly what you want to log, why you want to log it and why even discord
i have a goofy ahh server and there areany things i need to log like rare drops
mostly rare drops
Why do you need to log it though
refund and proof reasons
Oh
Then just log to a file and add a command to check it
ok

if i log like that 50+ lines a second can it cause any lag more than expected?
um, you should not be logging 50 lines a second
should be fine as long as no IO is involved

