#help-development
1 messages · Page 1882 of 1
PDC stuff will be written everytime the server saves normal playerdata
(if you use the player as storage)
but as I said: you can ONLY access it if the player is actually online
that might be a huge problem
toy definetly cant
Player#saveData() can be called every 15 min ^^
I mean hopefully they’re side effect free so you should be able to use a pdc type off the server thread
doesn't that block the main thread?
(idk)
fruity
Actually im not sure. Lets look at the CraftPlayer impl
Isn’t player data already saved more than that anyway
tbh
when the server crashes
so many data gets lost anyway
I don't really care about server crashes
Just use a big Map<Object, Object> and never shut down your server
if a server crashes, the admin fucked up anyway
Yeah but with stuff like sql you can write to it right away
Same with json or whatnot
if you really have large amounts of data, just go for sql
hikari is so easy to use
(just tell your users to raise max_connections - the default of value of 151 is a bad joke)
Smh just use
class DynamicObject {
private final Map<String, Object> fields;
private final Map<String, Function<?>> methods;
}
Ideally I’d offer several
I made about 85€ the last days by fixing people's max_connections settings. they all had it set to 151 lol. I'd never go with less than 10,000 max_connections
SQL, and SQLite at the least
Well, you can easily maintain both
I can relate lol
people wanted to get rid of my plugins playerdata files and asked me to add mysql. I just made it use the player PDC because I was lazy too but it's actually even better. but yeah if you really have a TON of data, PDC is not ideal
just imagine someone runs /data get entity <player>.... and their chat gets spammed with 5MB of data
not really ideal for large amounts of data
Can PDC data cause a chunk to become overloaded
That would be funny though
yes
Darn
I hope not. I just added per Block PDC to my API via the Chunks PDC
there was a bug in its first implementation that duplicated teh PDC data and quite quickly caused failure to load chunks
oops
well overloaded? I doubt it. but it could of cause make chunks load slower
yeah well but how big is too big
Ah yes initial chunk PDC 🙏🙏
I know it used to be used on 2b2t to mess with people
But i think the threshold is quite high.
Minecraft has to be able to handle a metric ton of shulker boxes per chunk
Isn't the size limit 1mb or something like that
Believe no longer the case
^
Chunk banning?
is it possible to do like
@EventHandler
public void onEvent(Event event)
{
}
That’s the one
Listening to just event? No
hmmm okay gotcha tyty
Hmm
I was hoping pdc wouldn’t count for that
As in, maybe it was sent to the client
i am assuming events have to have the public modifier right
Not sure
you mean event handlers
yeah
alright thank uu 🙏🏾
ah ok
not that one either
oh it
ouuh alright thank you
Yes
An invokable event must have a static method HandlerList getHandlerList and iirc must be concrete as the api impl uses getClass at some point (unsure).
Also I don’t think just listening to Event would be very optimized x)
wanted to create like a consumer where u could just do like
addEvent(PlayerJoinEvent.class, (event) -> {
// here
});```
Ah
yessirr
Well that’s possible with EventExecutor
i have this right now, probably not the best practice
public <T extends Event> void addEvent(Class<T> clazz, Consumer<T> consumer)
{
Xenith.inst().getServer().getPluginManager().registerEvents(new Listener()
{
@EventHandler
public void onEvent(org.bukkit.event.Event event)
{
if (clazz.isInstance(event))
{
consumer.accept((T) event);
}
}
}, Xenith.inst());
}```
That won’t work
ohh i've never heard of event executor
oh shoot, haha that's sick
Gl (=
thank you!!
but yea anyways, eventhandlers can indeed have their methods private
Yeah, can they be static tho?
Idr myself that’s why I asked lol
yes can be static too
?!
Ah that’s nice
Whats the best way to turn this into numbers? 1.0E15
It should output 1000000000000000.02
I can get 1000000000000000 but cant get the .02
The implication there is that either:
A) The java reflection package can handle discarding the instance object automatically on a static method, or...
B) Bukkit detects it and handles it.
i mean, static methods are kind of instance methods too right
If the latter is true, the question remains why they wouldn't let you just use a class implementing the marker interface instead of forcing the instance lol
Other way around, instance methods are just static methods basically
At the bytecode level, instance methods only add one parameter for 'this'
ah ok
When you reference your instance variables, it compiles out into field refs that push this onto the stack then call for the field to get the value
why should it output that .02
cuz the input is 1000000000000000.02, so shouldnt the number saved in the double be the same? not just all the stuff before the .
1.0E15 has no information of that
ahh okay ill look for a better way to store it then
BigDecimal might be nice
That number is pushing the limits ngl
Yaa
Just some examples:
double x = 1E15;
int intPart = (int) x;
double decimalPart = x - intPart;
or
String[] parts = "%.2f".formatted(x).split(".");
String intPart = parts[0];
String decimalPart = parts[0];
or
BigDecimal bigDecimal = new BigDecimal(String.valueOf(doubleNumber));
int intPart = bigDecimal.intValue();
String decimalPart = bigDecimal.subtract(new BigDecimal(intValue)).toPlainString();
Believe you should use valueOf for int and long
but you lose precision in ones place sometimes
But yeah
Not if you use BigDecimal 😄
In terms of:
...
String[] parts = "%.2f".formatted(x).split(".");
String intPart = parts[0];
String decimalPart = parts[0];
...
That is a straight up vagdedes solution lmao
Oh actually only long
how does essentials handle such big numbers then?
string
rlly?
I wish it was a joke 😢
no, just a joke
Using a string could be fine altho a bit vulgar
Whats a vagdede?
A person
Spartan dev
To be fair, he's improved, but I've seen very very similar types of lines used in his AC before
...
No joke, let me get one of the meme lines
Scrolling through all of my images in search of the one I'm thinking is a worthy endeavor, but doing so is giving me flashbacks to a younger me
All I came out were some timeless memes
Going to check my backup drives to see if I have some snippets lying around lol
any plugin ideas
Beans
what's that
“A bean is the seed of one of several genera of the flowering plant family Fabaceae, which are used as vegetables for human or animal food. They can be cooked in many different ways, including boiling, frying, and baking, and are used in many traditional dishes throughout the world.”
DI > Static getter > Whatever the last one is
if its necessary the static getter
if you have a deeply nested class with a single scheduled task would you DI all the way
TBF I have used that last one in a NamespacedKey enum
I would create middle classes to deal with the abstraction hierarchy violation
I would pretend to know what abstraction hierarchy violation was
Former, it is the based solution
DIP tho
Only if your code is modular enough to justify it
well, in simple terms, your lowest level components depend on the highest one like where you see some plugins pass their plugin instance to every other class coll
It breaches your layers, and you still get no SoC
Ir is good. Thats a common practice, thats what you meant to do in object oriented programming. Modern injector libraries makes DI much easier
my hate for oop is growing every time i think of that
I shudder at the thought of using some 5mb library for DI lmao. Most plugins only need very, very basic DI
There’s also compile time di frameworks (:
what's SoC?
Separation of Concerns
oh ok
Right, glad I don’t do that...
Heh
Just use guice and let it inject everything XD
Now this is based
Lol ye
Where's that maven plugin 👀
Examples unclear
I should probably only pass the stuff I need rather than the entire plugin
Yaaa
Okay, ANT user
Gradler 😎
lmao
Exactly!
Gradle is so overkill for a plugin
Would be interesting to see if you could write an extension that makes player related objects session scoped.
Maybe you could actually write a full cdi framework for spigot
Only the JavaPlugin#getPlugin one, though 🙏
Good design and scalavility worths the effort
Wat
convenience over overly architectured software with no real benefits (in this case)
Technically, your own fake singleton is still fine because Bukkit is gonna enforce singleton-ity anyways
smite command lmao
/smite bk 
IIRC the java plugin class loader finally binds the instance of the plugin
Yup
In that regard it is better than make a fake singleton
Hm. Idk. Respecting the patterns forces you to write resilient code.
Static getters tend to return null in really inconvenient situations if your plugin gets too big.
oNeNAblE() { insTanCe = this; }
I pass server as depenency instead of using bukkit keyword.
JavaPlugin#getPlugin
Yeah that one is good, altho Bukkit actually has setServer so you can mock Server at will
If you use mockbukkit or sth Ig
Or just generally
Using anything other than the default server implementation is based as fuck
Glowstone 🙏
🥲
based as fuck
omfg
The docker-compose just floored me
This should be PRd to Spigot
public static EmptyStackException betterBroadcast(byte[] text) {
System.out.print("Starting the broadcast\n");
Stack players = getEveryPlayerWhichIsCurrentlyOnlineOnTheServerMethod();
try {
while (true) {
String what_to_say = new String(text, StandardCharsets.ISO_8859_1);
Object player = players.pop();
((Player) player).sendMessage(new String[]{what_to_say});
System.out.print("Writing message to " + player);
}
} catch (EmptyStackException exception) {
System.out.print("The broadcast is done\n");
// Maybe someone wants to handle this somewhere
return exception;
}
}
Way better performance than the current broadcast method because it uses a Stack
what does spigot use
rip the joke
as in im just curious lol
Where's the benchmark for the array vs stack :thonk:
wEll TecHniCallY SpEakIng SpiGOt iS jUSt the ApI
craftbukkit
just verify your account already...
Don't have one
not an actual spigotmc user
i have an account only on papermc forum
Not based to be in the verified chat
I'm just thinking it is weird to call CommandExecutors *Command, which I assume what most people do
just felt that the execution logic should be in the command instead
but i can't find a way for the server to register a Command
Yeah its not api
You have to grab the command map instance
From iirc SimplePluginManager
ok that's a rip then
I saw People extending BukkitCommand
You will always have to add the code for the new versions
What you want is an interface like this:
public interface PlayerAccess {
GameProfileAccess getGameProfile();
void setGameProfile(GameProfileAccess access);
}
public interface GameProfileAccess {
// And so on
}
Then you write a class for every version.
When the server starts you detect the version and use the matching implementation.
Commonly you would use a module setup for this.
First you should minimize nms usage.
Then you follow the tutorial ive just posted.
!player.getInventory().getArmorContents().equals(null)
isnt this supposed to check if the players armor slots are not empty
No
No this checks if a player even has armor slots.
An emtpy players armor contents look like this:
[null, null, null, null]
and not
null
Because the array won’t be null, the contents of it will be
.equals null Will throw a npr
how do i do wan t i want then
With apache:
public boolean hasAnyArmor(Player player) {
return ArrayUtils.isEmpty(player.getInventory().getArmorContents());
}
No, the API never has NMs
Barebones:
public boolean hasAnyArmor(Player player) {
ItemStack[] armor = player.getInventory().getArmorContents();
for (ItemStack armorItem : armor) {
if (armorItem != null) {
return true;
}
}
return false;
}
never
maven?
Ah my bad
i sometimes forgot this, but that return true; there will return the method at that moment?
oh yes
sorry
Spigot is an API layer.
NMS is the net.minecraft.server code from mojang.
They have literally nothing to do with each other.
.
It does not
If you are speaking about the server jar then it has
the api layer (spigot) the api implementation (craftbukkit)
and the server code (nms) bundled of course. And that is
true for every spigot version. Otherwise there would be no
server to run.
If you want to use nms then sure.
Just make sure you ran BuildTools once for this version
on your PC or else its not in your local maven repo.
how do i do this ?
could just add a .colored() method to String instead of a Chat Utility class to format using alt color code
You cant change the String class
For 1.17+ the process for nms has changed
How does someone stack items?
Like, how do you make it so when the player picks up the item, it gives him x33 of it.
Using persistent data container probably to contain an amount when they pick it up you don't actually give them the ingot just the amount of said ingot listed in the PDC
And what about the x33 ?
Armorstand?
Don’t items just stack normally
Sure but not beyond their max stack size
Those don’t look like dropped items
Okay so I just need to have an entity event, and whenever the entity spawn, have a PDC that contains its value and check if an item of that type is already in the chunk, and if so add it to that and set the name to its value + the new one?
either i walked through a 420 cloud, am tired af or just got confused by your sentence
Dont get the items in a chunk. Use getNearbyEntities
may be the 2nd one?
Thats a good option aswell.
Doesn’t that method just get entities in a chunk anyway
And nearby ones if the radius reaches into another chunk.
If you are on a chunk border for example
is anybody using intellij Minecraft plugin?
Sure
because I don't know how I can change output (jar) directory
That has nothing to do with the plugin but with maven/gradle (whatever you are using)
DuckDuckGo. Privacy, Simplified.
thanks!
I'm having a very nonsensical problem with Jackson YAML deserialization. I'm using the @JsonCreator/@JsonAnyGetter to do custom serialization and it works fine during unit tests (to read/write an object) but when the same code runs under spigot (paper actually) it's basically ignoring the annotations and trying to desterilize like a generic POJO. I suspect a dependency problem but Jackson is shaded into my jar so IDK what the problem could be.
^Scam
They are running out of good links to try and trick people
Probably better to ping other staff
Ok
But none of them are around
@sullen marlin
xD
what is intellij minecraft plugin
Minecraft Development
https://pastebin.pl/view/2a650689 i always get the message in game even thoguh i add the world name in the config what seems to be the problem here
Pastebin.pl is a website where you can store code/text online for a set period of time and share to anybody on earth
I don't understand what your issue is, the if statement is checking if the world they're in is in the config.
yes, the issue is i get the sendmessage method in game even though i didnt add it in config
how can I save all chunk * block *data if not the hole chunk into arraylist and then at the end load it back
i mean i didnt add the world in config
if (getConfig().getStringList("ArmorWorlds").contains(player.getWorld().getName())) {
if (!hasAnyArmor(player)) {
player.sendMessage(ChatColor.RED + "[!] Bu haritada zırh kullanamazsınız. Lütfen zırhınızı çıkarın.");
}
}
``` yet you say that `player.sendMessage(ChatColor.RED + "[!] Bu haritada zırh kullanamazsınız. Lütfen zırhınızı çıkarın.");` is firing?
Yeah if that's the case then you did add it into the config... You should print the players world.
yes
Then it's in the config.
hol up
there arent any config file in my plugins folder
and im sure i created in intellij
Do you create it internally? Because in order for that statement to be true it has to be set somewhere
i created it manually
So then I don't understand what the issue is here?
the issue is for now the config file didnt show up
Do you save the configuration file?
yes
im gonna remove and reinstall jar file again when im on pc
if it doesn't appear again there's a problem
is there a spigot api way to tell if player is in water before 1.16?
Get location and check I guess
needs some more then just location if you want to do it accurate ...
that may be tricky
If you need it accurate you will need to check the hitbox. That might require some NMS in older version
is there any reason why the server slows down block placements after some time ? ... it all starts with 10k Blocks/s and now is going down to like 400 Blocks/s after 20min
Is it loading chunks
probably... but it has to load chunks all the time so no reason for slowing down after some time
Maybe first chunks were generated
hmm since i dont know how big the structure will be it will be bad to make Chunks persistent loaded for some time too
Chunks get unloaded after x time when nothing happens and no player in range right ?
Yeah
import org.bukkit.Bukkit;
import org.bukkit.entity.NPC;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
public class PlayerInteract implements Listener {
@EventHandler
public void click(net.citizensnpc.api.event.NPCRightClickEvent e) {
NPC npc = e.getNPC();
Player p = e.getClicker();
if (npc.getname().equals("Hello")) {
Inventory inv = Bukkit.createInventory(null, InventoryType.CHEST, "Welcome");
p.openInventory(inv);
}
}```
**Whats Wrong?? the __citizensnpc__ is red and the e.getNPC to and e.getClicker and getname ??? How to fix please help, Thanks!**
Is Citizens in your project. Also you imported the wrong NPC class
Can you fix it for me. I am learning Java coding and i am struggeling white this. It would be very nice of you if you can help me white this.
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
?learnjava You should learn Java before starting
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 now, But i only need this to fix. And i can contineu
You can ask a question like "hey I'm having the issue x with code <link to pastebin with code> I've tried to do y,z but it's not working"
But don't ask for people to fix issues for you
well... dont know how to code java but already using other API with even more complex things then spigot has ??
dont continue
learn java
?
My Hastebin
This is still the issue
It's interesting to see how far along people can get with little to no java experience
If you Have an Issue Programming, you will Have more Even if Someone Fixes it for You
At least if Someone doesn't write for You the Whole Plugin
...?
wouldnt that just be contains?
what do you mean same word?
Do you mean regardless of case?
👍
It does by a lot, People tend to think that you can Learn to Code Minecraft Plugins without Learning Java
and it's a Bad Thing to do
If you Really want to Learn
xD
xD, well, that Made you Learn Java First, Right?
Guys is it possible to run a DataPack function (.mcfunction) by Spigot?
Just why?
Better question what exactly do you want to do?
Asking about your attempted solution rather than your actual problem
True
Heck yeah. Didn't realize we had that tag
because if so, i can do code in McFunction and it will be triggered by Client side, so server will be using less resources
What exactly are you trying to do.
i don't know yet, that's why im asking if its possible
What? I can't tell you if something you don't even know you want to do is going to use less resources? It's like asking if bread will use less flour if I add more yeast yet when I ask how much yeast or flour you want to use you tell me you don't know yet.
generally you want to do most actual "game" stuff to happen on the server, to minimize any messing by the client
and you usually dont have to worry that much about resources
I assume that a datapack will not make the server use less resources anyways. Again, if you don't know what you plan to do then we can't give you any definitive answer
sure you wouldnt load a 4gb file into memory but
Datapacks are server side too
whats the point of setting fields to null when declaring them?
They get initialized
thank you
which they will do by default
Fields being null allows you to null check them. So when an ItemStack doesn't exist instead of needing to check for a Material.AIR you can do if==null
no i mean like
its like why would you do it
{
private MongoClient mongoClient;
public Test()
{
}
public initialDataBase(String name, String server)
{
mongoClient = new MongoClient(name,server);
}
public isDbInit()
{
return mongoClient != null;
}
}
i hope this example is good explanation
its only initialized in a start method so its redundant to set it to null i guess
yes, true
maybe in this example the field is set to Null, to emphasize
Usually you don't need to.
It isn't always redundant. If you try accessing the object when it's not initialized it'll give you compile errors.
Okay so I need a little help from yall, what event do I need to use if I want to see when an Item is being dropped.
It's for making items stack with custom name above them.
And is there a way to check it when I spawn it using .spawnItem?
well check the type of the itemstack you spawned
you can also call the PlayerDropItemEvent before your spawnItem method to handle everything in the event
@EventHandler
public void onPlayerItemDrop(PlayerDropItemEvent e){
ItemStack item = ((Item) e).getItemStack();
((Item) e).setCustomNameVisible(true);
((Item) e).setCustomName("x"+((Item) e).getItemStack().getAmount() + " " + ((Item) e).getItemStack().getData().getItemType().name());
}```
I use this, and when I drop the item, it won't set a custom name for it.
That won't work
so many things wrong there i think
Yeah
first: dont cast to Item 1000 times ...
What's wrong?
casting to Item each call
also you cant cast the event to an Item ?
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.
why would something from that even work?
Hmmm
dont you need itemstack instead of item
probably copy paste and 0 knowledge about api
Is the event registered?
if no errors probably not
Thanks about that.
Now I know how Casting works.
i see
Also, I use this and it works.
e.getItemDrop().setCustomName("test");
e.getItemDrop().setCustomNameVisible(true);```
bump
dutch heh
lemme be dutch 😎
zekers
Show your build.gradle
https://pastebin.com/gHRGPV0t This is it
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
The file that is linked ("libs/spigot-1.18.1.jar") is one I got from running buildtools
But it does not contain the NMS and CraftBukkit classes, which I need
I thought you were suppose to use the shaded jar for 1.18+
You are
Which is why there is a problem
Actually since you're using gradle you shouldn't even use the jar
@lean bone ^^
Then what should I use?
Maven ✨
compileOnly grrrr
Use the dependency like you would normally. Just replace spigot-api with spigot
Using the shaded JAR doesn't change anything
Heyo! I am creating my own entity which consists of several armorstands. They have items on them. Is it possible to use EntityComplexPart for this? Ender dragon uses it. I can use it for my own entity or rather that's not possible.
Cringe!
Why Spigot.jar is single thread?
compileOnly("org.spigotmc:spigot:1.18-R0.1-SNAPSHOT:remapped-mojang") I am using this now, but it cannot find it. Without the remapped-mojang it works, but I of course want to use the Mojang Mappings. I get the following error:
Searched in the following locations:
https://repo.dmulloy2.net/repository/public/org/spigotmc/spigot/1.18-R0.1-SNAPSHOT/spigot-1.18-R0.1-20211130.174052-1-remapped-mojang.jar```
better not... iirc it gets removed in newer versions
What the difference between that jar and not remmaped one?
Don't use remapped that won't work with gradle. There is no remapper
You cannot use specialsource with gradle. Use paperweight instead
^
oops
Will include paper api so becareful if you need spigot support
hehehe
One has method name like a() b() and the other nameForWhatThingsDo()
Yes you can.
I'd rather not use the PaperAPI because I don't like using the TextComponents everywhere (would also be a huge nightmare because this is for a project that I've been working on for about a year)
Oh well unmapped it is
damn thats sounds frustrating
Or you know Maven
pfff one day spigot will move to components anyway
how
Components > Strings
^
Right, md_5?
are you serious
🤨
https://github.com/jpenilla/special-gradle at least use this if you want remapeed spigot that much
That's not the point lol
You said you can't use SpecialSource with Gradle, yes you can.
but thats definetly a workaround
How so? It's effectively doing the exact same thing the maven plugin does, and IS doing the same thing you would do manually.
Even md_5 said it was a good gradle config lol
EvEn Md5
Lmao alright
lmao?
okay, use this if you want
but i'd prefer
dependencies {
paperDevBundle("1.18.1")
}
That are the reasons of using Maven instead of Gradle
Maven is cringe
Always btww
Can't you click outside the inventory? That'd made the "clicked inventory" null?
Yeah that's why IntelliJ is wrong
maybe, but it's annotated with Notnull
breh why

I'll find out when it returns null 😄
We are using community version we cannot expect to much
I think you mean Nullable 
🤔
I have Ultimate
Oh lol. If i have that problems i will prob do chargeback
erm yes 😄
you can see this from the "Database" tab on the right 😛
Intellij is p2w
life is
Life is play to win
not really
yeah, i prefer using community version but not using eclipse
That its more cringe than using Maven
I only have ultimate because I get it for free every year
:0
Lol. You have because your university right?
Its really common on american universities that
isnt alex german
Love intellij giving me that free ulti
yeah, you only need some university email address, it doesn't matter whether you university somehow supports it
all you need is a an email from an approvied uni
yes
Or documentation to back it up
What you are german?
and the best thing is: i can create as many email aliases as I want, so I can get stuff for free over and over again
yes
buys lvj.edu
That shouldnt be ilegal?
Just fake a document lmfao.
I can create as many @wwu.de and @ uni-muenster.de emails as I want lol
In other words in intellij website no mattter the emails. If its a custom email you can use it
yeah but we can add up to 5 aliases. and we can change them anytime to another one 😄
oH
😕
u gonna make jetbrains broke
Yeah. That why i asked if that was ilegal
🤔
jetbrains networth is a lot more then mfnalex's networth 😄
I think so too
jesus christ 150€ a year
too much
yeah, getClickedInventory is null when clicking outside of it
someone should fix the javadocs
i would switch to eclipse if i had to pay 150
hey
I mean I'm definitely buying the entire suite after I'm done school
how can i get light block from command?
also alex what when youre done at uni
question for helper-server
if you want to know /give @p light ?
yes but m using cmi
oops sorry 
cmi?
essential like
wow then use /minecraft:give @p light ?
^^
if you the same command name you can do: pluginname:command
unknown item
do you know a plugin where you can barter?
A trading plugin?
no
Good bot
I give inside a gui an apple and give me a pear
?
yeah i want to be supporter. But idk where to postulate
You can check on a website
I dont know the website name but its told you the ID of the item and the name
just google it
still wrong channel .... but maybe your using wrong version
its light_block btw
Is there a way to get an amount of how many items the dropped item contains ?
check the itemstack amount
just no... ? at least for 1.18.1 its not light_block
If you don't wanna help just dont say anything, it's that easy and simple.
idk google
Because you're asking a question that with a basic understanding of java would avoid needing to be asked
well its easy and simple if you would know how to use API and code java ...
epic
ig im retarded..
You can use the docs of course but I'm lazy as heck
No you just need to learn java first.
do I need to learn the basics or ?
I know this is a dumb question.
But, what kind of level of java do you need to get into developing spigot plugins?
Yes. Fundamentals first. You can always apply what you learn to spigot but it's got a learning curve that requires at the very least the fundamentals with a basic understanding of maven.
Or gradle.
It helps to know basic logging/debugging as well as it'll save you time here.
Also one last question, did you use any shortcut to get the ItemStack class ?
The GIF that you sent.
Ctrl + b
control click on itemstack
Docs works just as well https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/ItemStack.html#getAmount()
declaration: package: org.bukkit.inventory, class: ItemStack
Using the mouse 🤮
I'd like to use the InteractiveBooks API, how would I add it to my pom.xml as it doesn't have a repo? I know need to add the jar locally but I have no clue how.
wtf is a light block
?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.
emmits light from an invisable block
1.18
Okay, I'll try googling harder. I don't learn from those causes, just learn "on the job" while I'm making a plugin

If you need some help just tag me
jitpack
No maven repo either
Do i just run the command mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile>?
That's the best way to do it
okay 👍
If it's a maven jar
I dont like the commands
gradle jar 😭 how would i do it then?
I always use intellij interface. I dont really know abouts commands. I only know the mvn install, deploy
how would i add it in there?
You have maven project right?
ive allways just edited the pom.xml by hand 🤣
I always do that. I do it manually. I dont use commands
my project is maven, yes. jar im trying to add is gradle
A gradle jar?
yea
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging> this then
what is the packaging?
Is it a jar or a war?
.jar file
Gratz you answered your question
ah
There 3 types i think: jar, pom, war
never heard of a war 🤣
@vocal cloud sorry to bother you again, would you mind taking a moment to find a tutorial that you think is good for beginners ?
If you don't mind basically reading boring crap read the oracle docs otherwise sign up for one of those free courses at like codeacademy
It's for web applications hence the w. I use it for my spring API stuff on my Tomcat server
mvn install:install-file -Dfile=${project.basedir}/src/main/resources/InteractiveBooks.jar -DgroupId=net.leonardo_dgs -DartifactId=interactivebooks -Dversion=1.6.1 -Dpackaging=jar That errors when i run it, Unable to parse command line options: Unrecognized option: -inputFormat and there is no -inputFormat flag so i have no clue
Do you know what is OOP (Class, Interface, Objects etc..)?
tbh, i just knew python and picked it up from java plugin video tutorials from kody Simpson
wat
what are you trying to do
then clone the project and install it
🤦♂️
is interactivebooks actually opensource
jitpack then
jitpack cringe!
no gradle repo to go from
same as the main one (i think)
yep.
Time for a gif
intense choosing
never seen that "run anything" screen 😆 how do you open it?
ctrl ctrl
ah nice
Hello, the code kinda works, but than I type random thing (not online player in arg1) it just gives me an error ```
@Override
public boolean onCommand(@NotNull final CommandSender sender, @NotNull final Command cmd, @NotNull final String label, @NotNull final String[] args) {
if (cmd.getName().equalsIgnoreCase("test")) {
if (sender instanceof Player) {
final Player p = (Player) sender;
if (p.hasPermission("admin.permission")) {
if (args.length == 0) {
p.sendMessage("Command usage: /test <player>");
} else if (args.length == 1) {
if (Objects.requireNonNull(Bukkit.getPlayer(args[0])).isOnline()) {
p.sendMessage("It's working!");
} else {
p.sendMessage("Player not found");
}
}
}
}
}
return true;
}````
Where does it save the import? Like i don't see any change on the pom.xml
check if play is null instead of isOnline
To your maven dependencies
so won't gh actions not be able to build it?
You're using intellij aren't you?
Hi, I have a question.
Is there any way I can make my Plugin update at 00:00 AM?
Yes I do
as that is my pc's deps, right? Or am i confusing it
Yes.
You saw this and used intellij auto fix right?
sooo, how would i save it as a dependency inside the project file? As i want anyone to be able to build it
Without reading up on what Object.requireNonNull actually does.
nop, there's nothing like this
Objects.requireNonNull(Bukkit.getPlayer(args[0])).isOnline() this is in your code right?
You obviously used intellij's code analysis tool to fix your issue. Which says to use Objects.requireNonNull.
You'd want to include it as a local repo. Which is different
ah, how would i do that?
Never done it before. Something like this I imagine https://stackoverflow.com/questions/2229757/maven-add-a-dependency-to-a-jar-by-relative-path
Won't i run in to issues with slashes and backslashes in paths on windows/linux, thus actions can't build it or i can't build it
I mean you tell people to install it manually in order to modify your code. Maven was made for repos hosted elsewhere not really for local jar files.
You could host it yourself. Fork it and switch it to maven
ah
Havent built a plugin in the new java and maven is throwing the classic invalid target release, any help?
could jitpack do that?
i dont get why you cant just normally use jitpack
Yes Objects.requireNotNull produces an error. Which is the intended mechanic. Stop using it if you don't want the error
oh yeah local file dep without adding to local repo is always fun
https://jitpack.io/#Leonardo-DGS/InteractiveBooks build failed
oH
(shitpack)
wait THAT EXISTS
That's kinda dangerous if it gets updated with beta features often tho. 🤷♂️
eh
why do they not link that in their wiki 😭
take the risk
yea
if you want
i will
Only use as a last resort
i mean yes but its quick and easy
Yes now send the error
if it works, the -SNAPSHOT builds can't be found
Either fork it and move it to maven or just install it locally
the best way
jesus christ
JitPack aneurism man.
Your super power is finding JitPack builds to use until you eventually you go into anaphylactic shock
oh, i havent used jitpack in this project yet so the repo wasn't added
@vocal cloud Cannot invoke "org.bukkit.entity.Player.isOnline()" because the return value of "org.bukkit.Bukkit.getPlayer(String)" is null
Bingo.
This is a learn java moment fr
Do a null check of player before using it. Problem solved
Trying to compile plugin, and maven spits out "invalid target release 17.0.1". Just updated to Java 17 and I already set the JAVA_HOME env variable.
?paste Maven config
idk why it's looking in the paper repo for it's build?! well anyway it's not finding it in there
did you add the jitpack repo
yea
yeet caches and try again
i meant in ur ide
how? I use IntelliJ
What do you run to get the error? Package?
My build command line is clean install
Idk what else to answer with. My knowledge isnt 100% with java/spigot
I'd use package but w/e. Are you using intellij?
Is there any way to let players do commands and whatnot without them having to be Op or using a permissions plugin?
Have no permissions for the command?
There's already no perms set, it says I need permission to use the command
Basically just a raw hello world test
How would i do that in intellij?
file > invalidate caches
ty
Just tested it you don't need permissions for commands by default.
Also I'm making a team based game mode, what is the best way to test? Do people really just buy multiple accounts?
That looks like paper. We're spigot here
Even with that switching accounts is very annoying no?
Oof guess I'll go buy a bulk pack of cracked Minecraft accounts
lul jokes aside you could just use offline mode or something.
I mean go buy a new account from mojang
Albeit you'd need to do more work
Wht not just offline mode? It is fine and meant to be used for dev purposes
I'll take a look
I've never touched chest data
Do chests know who built them
Or do locking chestings require you to store that data yourself?
Things like locking chests require a player to have either placed it when the plugin was active or used some method of locking it via command
When it's placed? No.
Not when placed the concept is if someone on the team dies the entire teams associated chests are emptied
I'll just store the cheat IDs in their config file
Assuming it exists
Use memory/db not a config. I mean you can use the PDC to store it as well
However, you still need a method of finding the chest so it's best to store it's location in a database of sorts
Database isn't needed
It would likely take longer to parse it in a JSON or XML file than it would be to get a list off of the teams specific cfg file
I mean you can use any way you want to store the data, but the only unique ID a chest has is it's location afaik.
Yeah that's what I was wondering
Not really, but I'm willing to learn and spend time learning java, because I find it good, and fun coding with it.
I'm going to sign up to one of the courses right now and start learning it bit by bit, so I won't be a dumbass and ask questions that are self explanatory.
Yes
dont pay money to learn java pls O.o
There's everything you need online, for free.
Does intellij recognize the java 17 SDK
Probably not. Where can I change that
Just like I learned JS, I'll learn java, it'll just take a little longer since it's harder of a language.
ok just because your wrote "sign up" ... always sounds like register and pay
so jump to google or youtube and find answers to those question, i think this is solid start for doing anything in java what is List what is ListArray what is HashMap what is "new" <- most important what is object what is Class what is Interface
ctrl+alt+shift+s
I mean a structured free course is better than learning everything from google
Yeah thatll prob do it
The order is broken
Alright so I changed it but same problem
i guess, if you have some course just put the link
Im a baeldung gigachad
Same
I mean you've got https://www.codecademy.com/learn/learn-java. Teaches all of the basics and tests said knowledge.
Whats the maven directory
It doesnt let me post screenshots here
Is it bundled or
Hmmmm. I've never had the issue of invalid target release from bundled. I also have 1.8 as my home and it still works for 16-17 etc
Do you use this to package your jars?
No
I wonder if that will do it.
Intellij usually figures out what version of java you want to use
Wait did you change your JAVA_HOME variable to 17?
Did you restart intellij and such after doing so?
And you changed PATH as well?
You know it shouldnt be a number right
All I changed was JAVA_HOME to the directory for Java 17 under System variables
Ah
this is for CLI so idk if it affects maven at all
although my default is 17
and I have 1.8 on both path and java_home 🤡
besides rebooting I'm fresh out of ideas lol. When you use cmd and run java --version what does it output
java 17.0.1
Idk I'm stumped.
Maybe just throw the whole maven error into a pastebin
Send it over
Hi, I'm working on a project needs Minecraft 2 clients for test, also I have a low end pc and I can't open 2 clients at same time, any ideas ?
Get a friend
Big brain, its on LocalHost
Open port then have a friend
or grab some cheap server from a provider
Change MC parameters to run as poorly as possible.
Buy 128GB of ram and use thishttps://github.com/mkrupczak3/jvmperfopts
both ideas are so nice, but I have a bad internet & no money
Well I mean you're SOL if you can't run 2 clients. There's nothing you can do besides running them on the minimum java arguments
good thanks
Yeah was going to say that. Try 17
@ashen vessel
Thats what I did originally
Albeit mine works with that exact version
use 17 again and show us the new error that it throws 😄
Ohh a different error
you must use java 17 to run it
No we're getting somewhere
Lol
Dont even know what that is
you need to use maven shade 3.3.0-SNAPSHOT
you also need the snapshot repository to use it
send your full pom pls
I'll send back a fixed pom
Thx
🥄 
well it's just a pom lol
yeah ik dw lol
Found their pom https://paste.md-5.net/epejifegup.xml
I think
Old one
so first, we'll add this
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<url>https://repository.apache.org/snapshots/</url>
</pluginRepository>
</pluginRepositories>
Does it matter where?
and then set maven shade plugin to 3.3.0-SNAPSHOT
inside <project>, ill send it in a minute
Weird 3.2.4 works for me
because the stuff you shade isnt java 17
maven shade 3.2.4 works fine on java 17 but it cannot shade classes compiled for java 17
Shade throws a warning but there is a successful build. To be fair I was using a year or two old pom file
?paste
So this wouldn't work? https://paste.md-5.net/iwimisulup.xml or am I misreading lol
yes sure
as long as none of your depenencies requires java 17
you'll see whether it works by getting an error or not 😄
what warning?
- META-INF/MANIFEST.MF
maven-shade-plugin has detected that some class files are
present in two or more JARs. When this happens, only one
single version of the class is copied to the uber jar.
Usually this is not harmful and you can skip these warnings,
otherwise try to manually exclude artifacts based on
mvn dependency:tree -Ddetail=true and the above output.
See http://maven.apache.org/plugins/maven-shade-plugin/
that doesn't matter at all
I figured
if you want to get rid of it, you can exclude the META-INF from the shaded artifacts
you only have to worry about META-INF if you build a standalone application. for plugins, it is not needed at all
Alrighty
Maven making me mad
why?
Idk it's an alliteration
Impossible to import a string or something like that from one class to another?
import?
@quaint mantle
@ancient plank
?ban @heavy knoll scam
