#help-development
1 messages ยท Page 170 of 1
It's also used for stuff like lighting engines in 3d games but that's something much more complex
You can rotate vectors by an axis, which just does trig
typical useless intellij information
So rotating around the Y axis means you're changing XZ values, as the Y axis is solid
"109+ matches in 51+ files"
so how many matches are those? and how many files?
110 matches? 29517 matches? and how many files? 52? or 2851?
it cannot hurt to remove them
typical useful information from intellij
There's not much more to vectors, they're just representations of offsets
intellij's telling you "nah man look for something more specific"
okay
this is my favorite explanation of adding vectors
yeh
i wanna do smth
Now let's talk about completablefutures
in germany, it's totally legal to possess a bottle of booze when you're 3 years old. and it's also totally allowed to give newborn babies a bottle of vodka
as some people here seem to have never used such a useful thing
maybe some people just like to live in the moment
what is a booze tho
"hard alcohol"
I was going to use them for a sign editor
Not async, but completable some time in the future
Just use a supplier?
hey choco remember when you personally promised me to add a pathfinding api so long ago we didn't have a discord yet?
I didn't forget
It was another alternative, but the CF handles exceptions better
you should shoot his dog to remind him
fwiw I did attempt a pathfinding API until I deemed it stupidly overcomplicated
I'm very familiar with shooting dogs. I already thought about writing a library
I made a PR at the time
not everyone has such loose morals that they would live in a country which legalizes the ownership of guns, I'll have to stab his dog instead
tell Imlllusion to unban me pls
i literally did nothing to him
blocked me for no reason
i really wanna see his guide on CompleteableFuture
I also once blocked you
for no reason
a few weeks ago iirc
and unblocked me later
was just a misunderstanding
yeah I remember
man I don't even know what I'm putting off at this point, my code works and should be good to go live
I need to get back to it
your still grieving' over your dog
tho he blocked me cuz i trolled one guy who needed help with git merge
still sent him help after, was just a joke
also is there a weird bug where you can get a configuration section right after you set a value on a fileconfiguration because that seems to be a consistent issue that I get
it's just never set
(unless I wait for 1 tick iirc)
discord blocks are so useless anyway, since you still see "2 blocked messages"
and ofc everyone is always curious what they say and click on it anyway
why learn it when you can just ask every question you ever get here
just get over it. even optic had me blocked for a good month or so once lol
what events should i listen to for knowing when an entity dies
well i already helped 4 guys at least
i know there's entitydeathevent
then use that?
but that doesn't cover everything like despawning or creepers exploding
is that russian google or something
EnitiyExplodeEvent
spelled correctly ofc
yeah
EntityExplodeEvent with entity instanceof Creeper
How do I programically disable chat reporting in java
????
Mod i guess
ILLUSION SEARCH INDEX - COMPLETABLE FUTURES
This guide uses lambdas. If you're new to them, read my lambda guide -> #help-development message
A CompletableFuture (javascript seems to call it promise, don't quote me on this) is an object that represents an action that will be executed, tied to a "CompletionStage"
-
The default thread pool is the ForkCommonPool, you can set your own executor with the provided parameters
-
A task may be completed exceptionally (a throwable has been thrown during the execution), you can handle this using the
exceptionallymethods (usually just pass a Function<Throwable, T> where T is the future type, which returns a value) -
CompletableFutures usually complete with a defined value (return type of the function), it can be the boxed
Void. -
You can handle completion using the following methods:
-
thenRun(Runnable)- Just runs code once the future has been complete -
thenAccept(Consumer<T>)- Provides a variable, you do whatever -
thenApply(Function<T, U>)- Provides a variable, you can return whatever you'd like -
thenCompose(Function<T, CompletionStage<U>>)- Used for chaining futures, where the main future now runs the sub-future's task -
Most then... methods (thenRun, thenAccept, thenCompose) have an async variant, the main difference is that it runs on a separate thread from the default (the one the future is using) one, but you can pass your own Executor (You can make a funky executor that runs code on the main class)
-
To initialize a CompletableFuture, you should use the
runAsyncorsupplyAsyncmethods, depending if you'd like a simple Runnable with no return type, or if you'd like to pass a Supplier to obtain a value: -
CompletableFutures like to "suck up" exceptions. When they do so, they trigger an "exceptional" state. You can then handle exceptions with either the
exceptionallymethod, or use combined methods likewhenComplete(? super T, ? super Throwable)
Example:
CompletableFuture<Data> future = CompletableFuture.supplyAsync(() -> {
Data data = database.fetchData(playerId); // blocking method
data.setSomeValue(true);
return data;
});
future.exceptionally(error -> {
error.printStackTrace();
return new ErrorData();
});
future.thenAccept((data) -> {
player.sendMessage("The value is " + data.getSomeValue());
});
// This code still executes first, as the database code is being ran on another thread and won't be available this soon
player.sendMessage("Fetching data..");
Real-life scenario:
public interface MyFancyDatabase {
CompletableFuture<PlayerData> fetchPlayerData(UUID playerId);
CompletableFuture<Void> savePlayerData(UUID playerId, PlayerData data);
CompletableFuture<Void> deletePlayerData(UUID playerId);
}
MyFancyDatabase database = ...;
database.fetchPlayerData(playerId).thenAccept(data -> {
// This block of code will run once the data has been fetched
}
thanks
they do call it a promise
damn that's one complicated explanation
"a completablefuture is something that is or was happening and will sometime be done, or already is"
that's how I'd describe it lol
It can be a chain of actions
alr
"and you can attach logic to it"
tbf I never used it but I've known about it for long enough that I recognized what the javascript promises were from the java completable futures
just don't really have a use for it
haha code go brr
ew
this man's out here making lines longer than mine and then complains about my beautiful code
I don't need the var name
From which Java version does it exist tho
but there's no method without the consumer
like 1.3 iirc
the "convention" is to use "__" or the type
omg he unblocked me
__ -> this::doSth
// or
String -> this::doSth
eh sure
he gets paid by the line so he likes to be reminded of that while programming
oh boy, if I'd get paid by the line...
this u?
while true; do echo \n >> myfile.java; done
that's me avoiding lines as hard as possible
unlike some people I don't get paid by the line
not my fault that I gotta do a whole classroom system that's multi-server synchronized to a database and supposed to update in real time
love the supposed to
the funny thing about "getting paid per minute/hour/whatever" is that you make more money the worse you are, at least the first time
someone has never written code that writes code
that's big bux baby
if it takes you a lot of time to make very little progress then people will pay you less
well for the first time, it's true. if you take 100โฌ per hour and you take 10 hours, you make 1000โฌ. while someone else might be done within 2 hours. so you made 800โฌ more. ofc, the people won'T ask you again after that, lol
If you write a ton of code in little time then your rates will be higher
hey guys, I needed to put like
Bukkit.getPluginManager().registerEvents(this, plugin)
But the IDE doesn't auto complete, so I need to import anything before using it?
what does it "not autocomplete"?
mans lackin copilot
doent's show the option
when I try to put it manually, it turns red
alright that's enough procrastinating, later losers
it doesnt just "turn red", it also tells you something
yeah fuck off
see you tomorrow
๐
yeah, this turns red, but now look at this:
it actually shows more information when you hover over it
does it still happen on getServer().getPluginManager()
"this" does not implement Listener, or "plugin" does not extend Plugin
How do I execute code when a player sends a message
i just realised that
yeah I havent even seen that
register events on onEnable
yeah, this I will chance, but the getPluginManager it's not working
yep
its not working cause you are trying to type it outside of a function
run it in onEnable()
"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.
sorry to bother you guys
"Does not working" r/engrish
I chose that wording because that's how most people describe their problem
thats actually true
"I made event but it's no workings, help pls"
the amount of people ive seen not realise how ?paste or ?img work is insane
or like this:
Dear Sirs and Madams, or whomever it may concern,
I happened to write an event listener today, that's supposed to listen to the death of all entities, but for some reason it does not trigger when I "kill" an ItemFrame. I know that ItemFrames are Entities, and I am listening to the EntityDeathEvent, yet, it only gets called for entities like Zombies, but not for ItemFrames. Is there any other event I should listen to?
listen to the AsyncPlayerChatEvent
what I also hate is people starting their forums post with
"so I want to do XY..."
alr thanks
so...
how to increase tickrate to 21
all I wanted to say is that I prefer people who at least try to formulate a proper english sentence lol
you can actually do that easily in spigot
so
why do i get Unsupported major class version (52.0) when play need for sync: mine crafted
isnt that like java 15
Basically guys switch from 8 to 17
and then asking question here
oh lol
on spigot, it does work totally fine
actually it works extremely fine
to - value
it just makes everything faster
Advice desperately needed! I am always looking to follow best practices and keep projects organized to help me sleep at night.
I guess this question is more about project structuring and I'm probably overthinking it, don't judge me.
I'm using NPCLib and it does what it needs to. I extend the functionality in another wrapper class(I think that's what its called...) to satisfy my needs :D.
Now the package structure of my project is as follows;
-components(this is where most of my project is and I try to keep things decoupled into "components" each being independent of eachother)
-npc
BLNPC.class
-listeners
-utilities
-listeners(this one is more temporary as id like listeners specific to a component to be located within that components package)```
The problem I'm having is in the BLNPC.class... it needs to know when players quit the server. Sure I can make BLNPC implement Listener and add the event inside of there but that can make it hard to find as the project grows and also dosen't seem like a best practice.
Another solution would be to create a listeners package under the components.npc package and add it there which seems like a better solution. Now when it comes to naming this... something like PlayerQuitListener seems okay but if another component also listens for PlayerQuitEvents then they would have a PlayerQuitListener.class as well, although they would be under different packages the class names are the same and could cause confusion later down the road.
How would a advanced developer structure this?
yeah but when you have a lot of plugins it might crash i guess
didnt you post the exact same message 5 minutes ago?
my brain doesnt like reading that
I posted it a couple times while typing as I was putting spacing in and forgot to press shift enter lol its been deleted untill i was finished
oh ok sorry, nvm then
I was already going to point you to this #help-development message lol
hello y2k
?paste
If noone has time to answer why hang out in a help channel.
tbh I'm already angry at the BLNPC class name
how come you use canary
what does BLNPC mean?
might as well ask here I'm hyper confuesd I need a based intelectual to help me with maven
https://paste.md-5.net/fadajiquga.sql
I'm so confused why it gives me a post error ONLY when i use the maven deploy plugin as soon as I remove the deploy plugin it works fine
my head stop existing after 15th word in the sentence
Its a extension of NPC for my project.
check your web server logs
it will tell you why it caused a BAD REQUEST
it just once exploded after i counted to 14
so yeah it's 15 i guess
may be more if i put some effort
but my lazy ass controls y head
How can I check if an OfflinePlayer is a real player, since it never returns null?
make small sort method xD
well you can set everything as helmet etc
or put them in right order from the beginning
why should spigot devs spend their time on it
maybe users want to put leggings as helmet
And also there might be nulls
or two leggings in one array
you would have to work around it too tho
just put items in right order
before you set contents
but why would your ItemStack[] ever be "off"?
you could try getOfflinePlayer(UUID).getName() != null
will clap for you
you cannot remove elements from arrays though
only set them to null
arrays have fixed sizes in java?
.hasPlayedBefore() should work too i guess
I never played on 99.99% of servers yet my UUID is still a valid account though
that's only for online players
OfflinePlayer#getPlayer will be null for valid players who are not online
that's what he is asking about
huh
OfflinePlayer#getPlayer() != null
Oh nvm then
I am like 80% sure that
OfflinePlayer(randomUUID).getName() will be null for "fake accounts" and return a String for actual accounts
You mean pirated?
then no, it returns a name
it's also null for valid players who never joined before
so ignore what I said
I wonder though...
why would anyone ever need to check if a UUID exists?
Just use online mode
I don't have minecraft license tho
well actually i do now
Since 2021
But from when 1.2.5 released i didn't have it
played on old cracked launchers
then switched to TLauncher
Most of russians don't own licenses too
And i guess most of the players
And now we can't even buy one
cuz ya know ukraine
and stuff
on my discord, it's usually chinese people who want to "verify their purchase" without having bought anything from me lol
๐
well i never played on online-mode true server
except my test localhost server when i got license
๐ค
tho does online-mode support bungeecord
i mean
can you make a bungeecord server structure
for license only
@tender shard
the odds of anything at all happening if there are several odds of different with different chances is multiplicative right?
or how did it go
no
hm?
no, there's still a Player object
would be pretty stupid otherwise
every PlayerEvent ALWAYS returns a valid player object
for bungeecord, all backend servers will have online-mode disabled, and bungee does the online mode verification stuff
so actually you can
and it will forward the proper UUID
tho, which plugins are gonna become redunant with online-mode true
like anti-bot-attacks plugins
Or smth
Some authorization plugins too i guess
Hi how I can disable render new chunks?
you cant feed a mob?
forgot that they were a thing
chickens also
yeah just realized it seconds ago
forgot completely
i may or may not be adding straws to the game which you can feed to the turtles to kill them
like feeding a parrot a cookie
yes
i suppose the PlayerClickEvent might help
use PlayerInteractAtEntityEvent
thats probably better
where entity instanceof Turtle
What is the difference between PlayerInteract__at__entity and without the at
location
which method with at returns with e.getLocation()
and method without at doesn't return
what is the point of thta
idk
don't ask me
bukkit devs only
hey guys
you ever played ESO or Skyrim
Wanna try adding Alchemy or Enchanting from these games
or chest locks and lockpicks
with custom maze
anyone has some ideas about that
guys, how do I register an instance of a certain class (as a listener) in my main class? I tried to put the Bukkit.getPluginManager().registerEvents(this, plugin); but it doens't work
ahhh i just realized why nothing was working
i was tried to use fabric methods to do stuff
i was trying to get the items in the players hand an no pop ups were showing up and i was getting mad
ok so how do you get an item type
?
public class MainClass extends JavaPlugin {
public void onEnable() {
getServer().getPluginManager().registerEvents(new ListenerClass(), this);
}
}```
```java
public class ListenerClass implements Listener {
@EventHandler
public void onChat(AsyncPlayerChatEvent e) {
// code
}
}```
like
i have a method in a class that has an event on it, and need to run this event, for that I need to register an instance of this class as a listener in my main class
.
the main one no, only in the other class
.
I think I got it, at least there is no more error
I will try to run here and hopefully it will work
?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.
tho
there is no need for override annotation lol
it's just annotation
code works fine without it
it would still override tho
I mean, it's not my plugin, I took the source code and I an editing
strange
override is like 99% unnecessary now
the only thing i use it for is to check that i override method correctly
cuz if there is no method like this it shows error
you are trying to override non-existing method
well you just said make sure to to me
because like, I am creating a server and wanted to delete the item in the hand if it has a certain item (a letter that the plugins create), I created the method to check when the player is entering the server and deleting it, but the event was not running
๐
How disable render new chunks?
"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.
yeah, i know
gonna take the code
because my pc it's a potato and doesn't run the minecraft with intelliJ
just one or another
Always you can copy code from notepad ๐
well, let's go
I am trying to edit a plugin so that delete his own letter (or someone else letter) when the player enter the server, so I have basically three classes, the Letter Checker, the CommandExec and the CourierNew (main one). The letter checker it's just to check if it's his own letter or someone, the CommandExec it's for executing the commands and check this conditions I said early, the main one checks for permission and this kinda stuff. The plugin it's working fine, but I tried to log off the server and came back (to see if deletes the letter) but it doesn't delete, how do I fix this?
LetterChecker code: https://paste.md-5.net/osoxuhisit.java
CommandExec code: https://paste.md-5.net/afihelawer.java
CourierNew code: https://paste.md-5.net/adabanobeg.java
trying to be as clear as possible
I am not used to speak English, I usually speak Portuguese
okay, done that
okay
that make sense, gonna try here
idk what this is, this plugin it's someone else and I took the source code to try, if it work thought I gonna try
DUDE
YOU ARE A LIVE SAVER
IT WORKED
thanks
yeah, I have this bad habit that I try to learn thing without knowing then, like when I learned unity
plugin although I am trying to edit like, 2/3 days I thinking
but I gonna try to see more the code and understand it
anyway, thanks dude
really helped me
public static void setupConfig() {
file = new File(Bukkit.getPluginManager().getPlugin("Kingdoms").getDataFolder(), getConfig().getString("Kingdom").equalsIgnoreCase(kingdomName) + ".yml");
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
System.out.println(ChatColor.RED + "Couldn't create Kingdoms Config as it already exists.");
}
}
customFile = YamlConfiguration.loadConfiguration(file);
}```
How would i make it so that i can get the kingdomName in this?
probably should learn more about java before just randomly taking other people's code and not having the ability to understand it
what do you mean by 2?
if i did
file = new File(Bukkit.getPluginManager().getPlugin("Kingdoms").getDataFolder(), args[1] + ".yml");
how would i get the args that created the kingdom?
I will probably do that. I do this basically for everything and it work, but how I started like 3 days ago I am struggling yet
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
yeah, 3 days ago with java
like, I know c#, it's not that different
is it?
oh
well, gonna learn java so
yeah, I know
I thought that it was not that difficult
I mean, they are pretty same
basically it is
except keywords and namespaces they are like same in most cases
Well the biggest difference is Java's JVM made on C
Which is highly tunable
And no tunable JVM of C#
xD
that is slightly different syntax lol
: = extends tho
in that case : = implements
tho same rule as java applies
extend one class
implement 9999 interfaces
Well C++ and Java are uncomparable
really
Java just don't have &
at all
In c++ you can change any variable using &
you mean pointers or binary operation ?
int change(int &a) {
a = 5;
}```
i mean pointers
i think i get the logic of what you are saying. i just cant for the life of me think how to properly execute it
memory pointers i should say
idk real name
just not the * pointer
but &
you can change the value of variable which is sent to the method
not inside the method itself, but for the entire program
well this feature is implemented to rust
which is like modern c++ i guess
that would probs be helpful
well i just took a look at it
it seems really beautiful
it basically doesn't have GC
but also no need for free() or delete()
and allocate
malloc(), realloc(), cringealloc() and so on
it just uses & everywhere
which is kinda funny
what ive tried hasnt worked and ive tried a few things. dk how many i could actually name just cause of how much ive tried
provides really fast access
Tho you can probably build a new language similar to java upon it, same as kotlin is upon java
Where you basically add full Collections Framework to rust
And you basically created new language called Just
Java+Rust
Also rust is most loved programming language through users
Probably gonna do something on it later
well it's on same level as java i guess
Rust or Just?
it has different Patterns
i was joking
alr
it just doesn't have GC and SOLID pattern
Has different DI model
i can try
i basically offer free java lessons tho
You can call me i will explain why you are bad
I offer
Calling you trash
Calling your code trash
You offer
Stop coding in Java
Crying all day
accept please
private static FileConfiguration customFile;```
these are why that class is static btw
Why are they static
Ya know that static is basically making your fields immune to erasing by GC through runtime
i was using a kody simpson tutorial. the way in which he used them may be unnecessary in the fashion i am using them, but idk
on how to do something along the lines of what i am doing
i just thought it's more beautiful than if (!statement) return;
relatively*
I used TheSourceCode tutorials years back
for entering spigot api
tho they are trash
The best way to enter spigot api is just have second monitor
On which JavaDocs are always on
yeah i watched some of his vids
don't remember which ones exactly tho
And if you have problems with spigot coding even with second monitor on which you have javadocs
then the only problem is you
?learnjava
only possible solution
i dont have the space for a second monitor ๐ข
Bing your question before asking it:
https://www.bing.com/
sometimes helps reading javadocs you know
then install buildtools
download sources
and manually look through them
then just don't close browser
always have it opened + have JavaDocs as main page when you start browser
not google
not bing
Spigot Api JavaDocs
there is a search line
Use it
How to make player do something
write player find answer
tho have a second page with Java JavaDocs
So you can type Map or Collection in search tab
If you are russian go to my java blog
screenshot javadocs with your eyes
Read from memory
Tho you would have OutOfMemoryError
really fast
i do this everyday tho
to prevent having NullPointerExceptions
When recalling some info about Player class
Bro write a java program in your brain
Run debug -> Catch NullPointerException
explode
Catch OutOfMemoryError -> get sick with amnesia
When caught StackOverflowException just faint
Restart in 1 hour
how do you compile your code
maven/gradle/by export
what is project setup
i told everybody
i have telepathy
and telekinesis
i basically fix all issues
When people ask
That's not the first time
here
run recursion with no exit clause in your brain
divide by 0
When i get NPE in my life i start calculating numbers in IEEE754
I surpassed god level already
Rust coders when forgot & ๐
@last temple
Tune your brain with Brain Virtual Machine flags before debugging your brain code
show code
with your log
and without
cringe
I'm sure u messed everything up like 10 steps before this
and it's causing problems
How can .getItemMeta() be null?
Hey! Potentially (hopefully) super simple question. Playing around with the default HG gametype. I want to allow multiple lives before they truly "die" - where in the config would I do that?
Doesnt every item have meta?
each default minecraft item
has null item meta
aw
which is not given to you by plugin
So how can I give it default meta?
thanks :)
new BukkitRunnable {
// here you can have some fields
int a = 1;
public void run() {
}
}```
yeah you can only use final external variables inside of inner classes, forEach body and anon functions(as far as i remember)
i cant figure this out
just get your wand and shout COMPILUS TOTALUS and it'll compile just fine
idk if theres a resource or sum but i cant figure it out
use code i sent above @gritty pebble
(only works on java 11+)
.
ItemMeta meta = event.getCurrentItem().getItemMeta();
if (meta == null) {
meta = factory.getItemMeta(event.getCurrentItem().getType());
}
List<String> lore = meta.getLore();
Still null :(
Bruh
well I know its not air because I'm doing a check
i sent you code that you need
send full code
ah wait I think I have a different problem
it seems that my click event is running twice
and the second time its AIR somehow
public void onClick(InventoryClickEvent event) {
if (event.getClickedInventory() == null) return;
if (event.getCursor() == null) return;
if (event.getCursor().getType() == Material.ENCHANTED_BOOK){
event.getWhoClicked().sendMessage(event.getCursor().getType().toString());
event.getWhoClicked().sendMessage(event.getCurrentItem().getType().toString());
ItemStack book = event.getCursor().clone();
ItemStack itemStack = Objects.requireNonNull(event.getCurrentItem()).clone();
if (book.getEnchantments().size() == 1 && !itemStack.getEnchantments().containsKey(book.getEnchantments().keySet().stream().findFirst().get())) {
if (itemStack.getType() == Material.AIR) return;
ItemFactory factory = event.getWhoClicked().getServer().getItemFactory();
ItemMeta meta = event.getCurrentItem().getItemMeta();
if (meta == null) {
meta = factory.getItemMeta(event.getCurrentItem().getType());
}
List<String> lore = meta.getLore();
if (lore == null) lore = new ArrayList<>();
lore.addAll(Objects.requireNonNull(book.getItemMeta().getLore()));
meta.setLore(lore);
itemStack.setItemMeta(meta);
itemStack.addUnsafeEnchantments(book.getEnchantments());
event.setCurrentItem(itemStack);
event.setCursor(new ItemStack(Material.AIR));
}
}
}
}
while using Object.requireNonNull i can't really refactor this piece of cringe
Im just lazy
Trying to use lwjgl within a plugin
[19:28:11 WARN]: Exception in thread "Render thread #1" java.lang.NoClassDefFoundError: org/lwjgl/opengl/ARBParallelShaderCompile
[19:28:11 WARN]: at discordlink-spigot-1.2-all.jar//org.lwjgl.opengl.GLCapabilities.<init>(GLCapabilities.java:6529)
[19:28:11 WARN]: at discordlink-spigot-1.2-all.jar//org.lwjgl.opengl.GL.createCapabilities(GL.java:466)
[19:28:11 WARN]: at discordlink-spigot-1.2-all.jar//org.lwjgl.opengl.GL.createCapabilities(GL.java:322)
[19:28:11 WARN]: at discordlink-spigot-1.2-all.jar//de.hdskins.skinrenderer.RenderContext.openWindow(RenderContext.java:125)
[19:28:11 WARN]: at discordlink-spigot-1.2-all.jar//de.hdskins.skinrenderer.RenderContext.run(RenderContext.java:96)
[19:28:11 WARN]: Caused by: java.lang.ClassNotFoundException: org.lwjgl.opengl.ARBParallelShaderCompile
[19:28:11 WARN]: at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:179)
[19:28:11 WARN]: at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:126)
[19:28:11 WARN]: at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
[19:28:11 WARN]: ... 5 more
Loads til this point, i think its related to system classloader since its within the actual plugin zip and not the system loader
Its an air check...
It is shaded fully, including native libraries
tho it would your plugin size go to 99999
Unzipping it shows the actual class is found
Yea I know il fix the null later, but every time I click on another item with an item the event runs twice and the second time currentItem is null
il fix it later
cancel the event after your manipulations
public void onClick(InventoryClickEvent event) {
var cursor = event.getCursor();
if (event.getClickedInventory() == null || cursor == null || event.getCurrentItem() == null) return;
if (cursor.getType() != Material.ENCHANTED_BOOK) return;
var item = event.getCurrentItem();
var itemEnch = item.getEnchantments(), cursorEnch = cursor.getEnchantments();
if (cursorEnch.size() != 1 || itemEnch.containsKey(cursorEnch.keySet().toArray()[0]) return;
var meta = event.getCurrentItem().getItemMeta();
if (meta == null) meta = Bukkit.getItemFactory().getItemMeta(item.getType());
if (book.getLore() != null) meta.setLore(book.getLore());
event.setCancelled(true);
itemStack.setItemMeta(meta);
itemStack.addUnsafeEnchantments(book.getEnchantments());
event.setCursor(null);
}```
is there any way for you to simplify the explanation?
ye. idk if ill figureit out anytime soon then
what's your problem ryry
the whole statement is boggling my brain
file = new File(Bukkit.getPluginManager().getPlugin("Kingdoms").getDataFolder(), args[1] + ".yml");
where args[1] is the inputted kingdom name for a command /k create <kingdom>
ik. i was just answering his question
?
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
System.out.println(ChatColor.RED + "Someone attempted to create a kingdom that already exists");
}
}
customFile = YamlConfiguration.loadConfiguration(file);
}```
that would cause that?
how would i fix it?
basically create file only when player runs command
ah
so you can pass this args[1]
?
if file alredy exists cancel the command
and send message
"kingdom with same name already exists"
idk didn't have full code
oh you mean there is one field for file
with no reason
hey ryry
ye?
also you can just JavaPlugin#getDataFolder
what
ryry you alive?
idk bro
id make it so i could have
Kingdom: kingdomName
Admins: kingdomAdmins
Members: kingdomMembers
for multiple kingdoms in one folder or sum, but idk how to do that
basically
one .yml rather
So each kingdom has own YML right?
as of current that was my goal. idk if its possible to do them all in one yml
that's possible but bad
why not just use database
public class KingdomCommand implements CommandExecutor {
private MainClass plugin;
public KingdomCommand(MainClass plugin) {
this.plugin = plugin;
plugin.getCommand("kingdom").setExecutor(this);
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (args.length != 1) return false;
if (!(sender instanceof Player player)) {
sender.sendMessage("only for players");
return true;
}
File f = new File(plugin.getDataFolder(), args[0] + ".yml");
if (f.exists()) {
player.sendMessage("Kingdom with same name already exists");
return true;
}
try {
f.createNewFile();
fillFile(f, player);
player.sendMessage("Kingdom created");
} catch (IOException ex) {
player.sendMessage("Failed to create kingdom file!");
ex.printStackTrace();
}
return true;
}
public void fillFile(File file, Player player) {
var conf = YamlConfiguration.loadConfiguration(file);
conf.set("key", value);
// other values
try {
conf.save(file);
} catch (IOException ex) {
player.sendMessage("Failed to save kingdom data to file!");
ex.printStackTrace();
}
}
}```
why keep data which requires storage and computing power when you can just randomize the data someone has and hope it's correct
new plugin idea RandomData minecraft but every time you log off your playerdata is completely randomized ๐
see
it's moments like these that I realize that I am just made different
you're out here with this PEASANT mentality of "haha let's randomize player data"
no
Now make it and sell it on spigot for 20 dollars
who needs to store chunks
this is what we call loser behavior
I will make a spigot fork that stores no data
it will not have a single file
Beautiful
you will have to hotload plugins in via debugger
Actually plugins shouldn't be allowed especially ones that Try to store data
@rigid loom
And God forbid use a database
ye. i see it
your poor mentality is rubbing off on me, I need to go bask in the light of my greatness
You can call your fork DimentiaSpigot
true but different options are cooler
SQLITE YAML JSON SQL
or you should have a file-manager class
which basically handles all of the file creation process
and saving
Would be util with all methods static tho
umm there are
this is the only fork that has to be launched by command line but not because it compiles anything, it's because it downloads a fresh copy of the server every time and it doesn't store it anywhere
come to dm i'll teach you in 2 minutes
how to run queries
how to setup connection
and so on
there are like billions of tutorials about SQL in plugins already
Only use Mongo sql is beta behavior
i mean sometimes you would not need this
not when breaking blocks of course
Some other cases
No you would almost under any situation not want that
Well i don't give a shit
I load player data into objects on join
and mostly not code big plugins
which would require more than 2 files
config.yml
and locale.yml
also you just get ResultSet after execute query
no need for running task
or doing any shit async
Basically resultset =
ah you mean that
then yeah
in fact mostly everything that can block thread should be done async
in fact we need processors which work instantly with no delay
and remove the thread word from dictionaries
also instant internet
would be nice
everything that can block the main thread should be done async ๐
Sadly speed of light breaks my life
Really dumb question but if I make stuff in mcreator using the minecraft forge setup will it work for basic stuff? I don't have internet so can't install the spigot setup. Thanks sorry for being annoying
you should be async
you are the reason why your plugins block main thread
huh?
forge != spigot so no?
Thank you
waiting for Just
JavaRust
Rust with full collections framework setup
and voids instead of fns
and proper method namings
not len() but length() or size()
idk
& was a nice idea
#list is something i don't get
which language does that
rly
Lua bad
Java good
gtg sleep
good night
How to make custom block for spigot server without using mcreator? Please link tutorial if possible thank you
custom blocks don't exist easily on spigot
spigot is not for mods
its for server side additions only
I highly doubt you can execute this with whatever block coding mcreator likely is
You can easily do "custom" blocks with a resource pack assuming you're using a new version and not 1.8
with mcreator?
Ah thank you
Without
also you can't have the same attributes as they allow in forge
They asked without mcreator
oh
All my Google are just tutorials for mcreator xD
resource packs but you won't get the same level of customizability you get with forge just a heads up
I don't have a tutorial saved anywhere but it's not super hard. The hard part comes giving it life so to speak as you're really just creating a vanilla block with a texture
That you have to give it the facade of it being something else
I will try my best thank you Mike the taco
Is there a way to use a variable in a different eventhandler?
its in the same class, want to make an entity variable and use it in diffrent event
?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.
learn java if you wanna use spigot your going to go no where fast with your current set of knowledge
What is a safe way to block my current code from continuing until something is done?
ie. Thread.sleep but safe
I was thinking RunTaskLater but figured I should ask before I try
Or completable future ^
I just sleep my main thread ๐คทโโ๏ธ its the most effective not like anything fun would be going on, on the server while my plugin is doing its task anyways
Yeah. Players can wait
What your plugin is doing is far more important than the players mining, or fighting mobs, or building a house. Weirdos
Is there a way to check what closed the inventory? I want to check if a player closed the inventory or if my plugin itself closed it.
Are u able to ban accounts?
On spigot website?
I would hope so
Can u ban this one I have?
The email I use isn't mine
I miss spelt it
And I can't make a second account since it said something about banned people with more than 1 account
I would forward an email to support@spigotmc.org to remove the account instead
Because you don't have access to that email, you're fine to create another. It's no big deal
Ok tyty
If you'd like, @ me with a link to your new account and I'll leave a note on your account in case we see it in the future
๐ ๐ซก
Hey Choco, what's the reasoning behind not being allowed to make multiple spigot accounts?
๐
I'm having issues with this bit of code, the code works fine if a player is a floodgate player, but when it's not the commands still are blocked without reaching the setCancel. Any reason why that is?
hover over it and see what ij says
"If the event is cancelled, processing of the command will halt." for the specific players i question the event never gets canceled. but it might be an issue caused by duplicate command. command in question is /shop which my plugin also uses, thats the reason i want to intercept the command for specific players. hmm
its probably ``private final List<String> commands;`
Yep renaming by command fixed the issue hmm. Not sure how to solve that one. Thanks for the idea!
https://paste.md-5.net/jadokimado.md <- console
https://paste.md-5.net/fikukequni.java <- main
https://paste.md-5.net/obunuharam.java <- the file that errors
I cant seem to find the error.
this.plugin.getCommand("bettercommands") is null causing Objects.requireNonNull to throw an npe
but the other ones dont throw a null
is bettercommands in your plugin.yml? pretty sure if it isn't getCommand returns null.
holly crap
dont call your main class main
?main
https://paste.md-5.net/keqivozogo.css
Will this work?
the case part ive got no idea, but thats not how reloading a plugin/config works
How would I do it?
I'm trying to reload it without restarting or reloading the server
Like essentials x (/essentials reload)
on your main class add a
public void reload() {
this.reloadConfig();
}
call on MainClassName.reload()
alr
Non-static method 'reload()' cannot be referenced from a static context
oh wait i had to do plugin.reload();
forgot that needed di
I put the information in the file
(Removed)
did you restart
that sometimes break stuff, try actually restarting
is there anything else that could be mis-firing it?
Wdym
another class, or plugin
check if it works without the switch
can I use colours when sending a message to the action bar?
Anyone know if it would be possible to stop zombie piglins from getting group agressive?
last time i checked you could
Try using ยง
is that actually an option for spigot#sendMessage
'
Ew legacy text
wonder if intellij would tell you the issue
pretty sure it doesnt
@remote swallow
Color needs to be a part of the text component. It's not an argument of send message
Does it not reload config or does it not send the message, or anything
it doesnt even update the reloading message
wdym
i got that part
oh wait i fixed it
the colour your sending has to be apart of the TextComponent.fromLegacyText()
how would i do that
can you make a player completely blind?
i tried amplifier of 999
I still see some stuff
No
https://github.com/EthanGarey/BetterCommands
Main.java, line 50 through 56.
I'm trying to reload the plugin but it's not, really doing anything.
Perhaps by giving player the new effect and sending fake light levels?
new effect?
Deep dark or whatever it's called
It's like stronger blind effect
oh, nice
will try that next, now trying night vision with blindness
heard it makes it darker
huh
@onyx fjord in low light levels combine blindness with darkness (not deep dark). You are pretty much blind
doesn't work on high light levels
you need to append them to the message with +, like ChatColor.RED + "This is red!"
figured it out before but thanks :)
why
configuration and it's a lot easier to type than adding chat colors
nah its a long function name and its not a constant so its slower
it also does not matter when the message is not from a configurtion
Hi, I made a custom inventory and I open it after using a command. How to check if player has opened my custom inventory in InventoryMoveItemEvent?
compare the inventories you can get from the event with the one you opened earlier
or you could get the inventory you opened earlier and check for the player in the Inventory#getViewers() method
how do you rotate a boat with a player on it?
I tried Boat#setRotation but that doesn't seem to work
how about teleport to a location with the rotation set on the location?
I want to rotate it constantly
I tried doing that but constantly remounting the player looks weird
I think that doesnt work since players can look into different directions while not rotating the boat
by teleporting it
can you teleport it while an entity is mounted?
I guess
back to this then?
I believe I already tried but I don't think it works
How can I check the inventory from the event?
google the event, it has 3 methods of accessing inventories iirc
ugh I also tried to teleport the boat and it's really weird
it does not teleport at all. and when removing the passenger and adding it again, it's totally fucked up
the boat does rotate but then you cannot enter it anymore
really, really weird
you might want to pull request this method before suggesting people to use this lol
not even NMS' setYRot works
setting velocity would work either, would it
is there a reliable method to detect all those shitty hybrid server software? like mohist and all the other garbage?
I am tired of getting "bug reports" by people who think that combining forge + bukkit is a good idea
i'd rather do
if(isNotAProperServerSoftware()) {
getPluginManager().disable(this);
}
if(!serversoftware.isSpigot && !serversoftware.isPaper) {
plugin.shutdown();
}
You should be able to detect method names since they are using Searge mappings (for Forge) and Fabric intermediary mappings
Methods
func_<number>_<obfuscatedName> For Forge
method_<number> for Fabric
Fields:
field_<number>_<obfuscatedName> For Forge
field_<number> for Fabric
or just check for a Forge/Fabric specific class
yikes
but on what class could I call this on?
MinecraftServer.getDeclaredMethods().stream().filter(method -> method.getName().startsWith("method_") or sth?
well but what's "smth" lol
never used forge nor fabric nor anything like that on a server
I DONT WANT TO D:
well guess I'll have to
why is it always chinese people that use such weird server software
catserver, mohist, ...
maybe I'll just grep through latest.log and search for "forge" or "fabric" lol
thx
Ideally you'd cache it
sure, sure
although I only need it once
ugh
is copilot right or is your class name right?
copilot suggested net.minecraftforge.server.ServerMain
oki thx
np
thanks
guess this should do it then
yeah lol
I use it quite frequently so I have it in a utils class
I am really so tired of people reporting "bugs" that only happen in mohist, catserver, lmaoserver etc
Lmaoserver xD
lmao
in order to make my plugin a dependency do I have to make an interface for everything I want to get from an instance of the plugin when I dont know the version of so I dont have to check?
elaborate
when i do Bukkit.getPluginManager().getPlugin() i dont want to implement something for each version of the dependency in order to make sure all versions are supported since the classes and methods might change, casts would probably not work for the concrete classes, they would probably for interfaces tho, right?
if I have a Controller for what should happen when a creature is hit, I would make an interface with the same method in order to support all dependency implementations of it, no matter what would change
sorry if im overcomplicating things XD
Well
Usually just depend on the latest version of the plugin?
The plugin, if done properly should provide an api good enough
causes problems with Worldedit
as <1.13 is 6.2.3 or some shit
and it's completely different
than 1.13+
generally I just recommend to say "fuck it, 1.18+ or die"
Yeah
Else probably wanna go with an adapter that facades polymorphic versioned plugins
I mean like this and on the plugins getEventController() I put this interface as a return type and return the actual implementation.
If I change the interface I would have to have a new major version then, right?
which means, one interface for each concrete class I want people to be able to access during runtime
how would you name it?
Use Facade or well Handler seems fine in this case
Yeah, its the enterprise name for any abstraction basically
having a hall of shame in each discord server is 100% needed
this specific person that doesn't even know the difference between javascript and java, thinks that their mod that is made with ct (skript for forge basically) is better than another mod which is been in work for ages
and that specific person keeps asking the original mod developer how they did something even though theyre making it in a totally different language, on how to do things
idk why im talking about this here but im having the worst day and im randomly spending my anger on channels that i usually talk in (clown behaviour but excuse me)
just seen this, did not unblock you. I just happened to "Show message"
??
math harder
System.out.println("health: " + this.getDynamicStats().getMaxHealth() + "Defense" + this.getDynamicStats().getMaxDefense());
return (this.getDynamicStats().getMaxHealth() * (1 + (this.getDynamicStats().getMaxDefense() / 100)));```
the output is 100 and 50
therefore it should be 150
but no
java says 100
maven goings nuts
(1 + 50)/100 = 0 tho
https://pastes.dev/Fxc8ZeUbRZ anyone know what's up with this
you need 100 * ((double) (1 + 50) / 100)
ah bruh
