#help-development
1 messages · Page 481 of 1
us of a
by running javac
or the eclipse compiler
or by telling maven to do that for you
or gradle's java plugin
or intellij's build system
I am trying to get user data from the config.yml file, and I am loading it in a config class by passing the constructor a plugin object to the config class then calling getConfig(), but when I try to get the config from a commandexecutor class I get an error where the plugin has already been instantiated.
i just used that thing to create a project and i created the project twice and it still does that.
for 1.19.4.
database.fetchStats(uuid).thenAccept(stats -> {
UserManager.addUser(uuid, stats);
}).thenCompose(data -> database.storeUser(uuid, thisherehastobestatshelp).thenAccept(data -> {
}));``` any way to use stats in the other lambda expression?
Try recreating on spigot
You are not allowed to create instances of JavaPlugin
report it to paper
is it my code or paper?
idk, I haven't seen your code, nor do I know what shitty things paper has again invented with their new plugin loading stuff
how can I let them edit the plugin with the config yml file then?
?paste the full stacktrace
you use di not new MainClassName()
the latest one for download.
this is spigotmc
I created have tried creating the config in the main class then passing it to the other classes but when I call the main class it still has that same 2 plugin instance issue
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
yeah this is why i never downloaded spigot and just used paper instead.
how do i use buildtools lol, ik it is kind of late to be asking this.
use saveDefaultConfig on onEnable in ur main class, pass the main class instance and you can use getConfig
download the jar, create a new folder, drag the jar in, open cmd/powershell there run java -jar BuildTools.jar --rev 1.19.4
hasnt been updated yet
latest rev isnt updated in buildtools either
prob will be next buildtools update
If paper version X exists, spigot version X exists since days
ok.
meta.setMapView(view); works on older versions? like 1.12.2 or how can i make it work with it?
Do i need to getConfig in the onEnable? also just pass the main class and call methods on it after?
or am I running getConfig in the other classes?
hm, it appears to be taking some time.
you pass the main instance to your other classes, as explained in "method #2" here: https://blog.jeff-media.com/getting-your-main-classes-instance-in-another-class/
wait is it downloading the entire source code lol?
yes
?id
it downloads mojang's jar, then decompiles it, then applies the spigot changes
then compiles it again
basically that
java depency injection (this is for other class) tip
it needs the instance of the plugin class
ak main
pain.
Yep, it was.
di not id
i know typo
and now I need to wait for them to fix it lol
So I can just pass my main class that extends JavaPlugin to another class? I thought I was trying that last night and anytime I was using that object it had the 2 instance error
what are you doing?
you pass your main class' "instance"
not the class itself
is the new Class(); syntax when trying to get the instance what is messing me up? I see right here I should be using the getInstance method is it different
yes
yeah, you create a new instance
new Class() creates a new INSTANCE of the class
you wanna use your existing instance
which is called "this" in your main class
di or static Main instance
as I already said, here it's explained: https://blog.jeff-media.com/getting-your-main-classes-instance-in-another-class/
both DI and static getter
yeah I saw it in that
choose whatever you prefer
just create a static variable and store your instance on the onEnable(); method being called and use a static getter to get the instance.
if it's a public variable, it should be final, hence be set in the constructor already. But then it cannot be static, so pointless lol
di if you can is prefered, if not then the static getter
public static PluginClassNameHere instance;
@Override
public void onEnable(){
instance = this;
}
this is 1 way of doing it
and even if it's not public (has a getter), I wouldn't wait until onEnable() to store the instance, but rather directly in the init block
why is the first letter of the variable name uppercase?
yeah that is confusing
smh vollx
Instance looks like it's a class
but i agree with you guys
it should be called "instance", not "Instance"
i already said that.
java beans are one of the most weird constructs I ever heard and never found any proper definition for what it's supposed to be. from what I know, it can be basically anything
?? As far I can see Java Bean classes are being used to with reflection to retrieve fields and methods by using the same naming conventions
for example you have a String field named employee
you create getter getEmployee() to retrieve that field
they literally look like structs in c/c++
yeah but that's usually a "convention" for basically everything
Bean should basically be object that encapsulates other objects
but yeah here's the docs about what it's supposed to be https://www.oracle.com/java/technologies/javase/javabeans-spec.html
speaking of c/c++, java is kind of annoying.
I disagree and find the opposite is true
And also must be seriazable or however is that spelled
you have to declare and define your methods in the same file in the case of java, while for c/c++, you can just declare the method name for a class member and define it in another file, much easier to manage code structure.
I cant believe that they've made an 100 page spec about a class convention
i find it really annoying to have my file sizes just be all over the place.
oh.
but you still have to define it all in the same file though, dont you?
there is no real declaration of method in java as in cpp. Unless it's interface you always inline implementation
I wouldn#t see any reason why one would want to split the code. Like, MyClass1.java, MyClass2.java and both contain half the code of that class? huh
or an abstract method
its much easier to manage.
or a native method
Yeah that too
i find that kind of annoying.
But you inline impl in most cases
I mean JavaBean class looks like the struct in Java or Record
but with the same naming conventions
to support reflection
to all sorts of data
headers do not split code
in headers you define like in interfaces
in cpp files you declare the implementation
wdym you cant define a header method
well yes
you cant include the same function declaration twice
What is even header method lol
if that's what you meant by it
yeah but having a separate header file wouldnt even make their implementation file smaller as it ofc would also have to tell again "for which method" every impl is for lol
but for that we have ifn define guards
so I still don't understand how splitting it up into different files would have ANY benefit
Method definition
you can swap implementations
that's what interfaces are for
headers are equivalent but not identical to interfaces practically in c/cpp
the main reason to use headers is that you can provide the client the header file, and nothing more, and he can use shared library (like .dll or .so) to switch the implementations without recompiling the code
so basically the compiler just compiles the header file with client code and links the implementation, but at runtime, client can swap the implementations by switching files
you could easily just share your interfaces in a .jar, and the implementation in another. e.g. bukkit vs craftbukkit
yea but you need to recompile your bytecode
while with headers you dont need to recompile the client at all
if you only change the implementation you only need to recompile the .dll or .so file
or in this case, only recompile the craftbukkit .jar
well you can do it in java aswell with reflections i guess, because bukkit api uses classloaders to load plugins
thus you can access bukkit implementation by only accessing interfaces from maven repo api
[SQLITE_ERROR] SQL error or missing database (near "DUPLICATE": syntax error)
going to sleep
guten morgen
i always called it "specialsauce-maven-plugin" for a year until I realized it's called "special source" and not "special sauce"
very disappointing to find out the actual name is so boring
can java lambda sort by smaller or bigger number?
i mean ye
wdym? you mean whether you can write a Comparator<MyCustomObject> using a lambda? If so, sure
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
i honestly got no clue
i havn't used it before
public class MyCustomClass {
private int value;
public int getValue() {
return value;
}
}
now you can use a lambda:
public static void main(String[] args) {
List<MyCustomClass> myList = new ArrayList<>();
myList.sort((o1, o2) -> Integer.compare(o1.getValue(), o2.getValue()));
}
or even a method reference:
myList.sort(Comparator.comparing(MyCustomClass::getValue));
this.entity = (new EntityNoAI(v)).setSilentProperty(true).setMaxHealth(5.0, true).setKnockbackResistance(Double.MAX_VALUE).setHologramYOffset(1.75).setPassiveHealingPerLoop(1.0).enablePassiveHealing(100L).disableAIFully().setInvincible(true);
java.lang.NoClassDefFoundError: net/minecraft/world/entity/animal/Pig
idk how remapping works in gradle, but you're definitely not doing it properly, otherwise the class "nms...Pig" wouldnt aven appear in your source code
it would be EntityPig instead
how did you run gradle? shadowJar?
or build?
rn you set the remap plugin to run on shadowJar, so you gotta use shadowJar to compile
Repo username and pass 😳
how can I save and load a HashMap<Integer, ServerPlayer> from a config file?
wtf
you can't
nms players are not serializable
well at least not in the usual way
I doubt that reading the player data from their .dat file is what you want to do
so how can i do it
@regal scaffold you still haven't changed your github package repo password
?xy
Asking about your attempted solution rather than your actual problem
Should I also create instances of other classes for these plugins? Or can I call other classes than main with a new instance of that class
My maven profile for changing the out dir isnt working it just wont build there
?paste your pom
Can someone dm a backslot plugin please
no
looks good. did you even enable the profile?
i got it now
Is there any way to save a HashMap of Integer and ServerPlayer to config.yml?
Not Sure what you're talking about exactly
?xy
Asking about your attempted solution rather than your actual problem
do you want to access the other classes from other plugins?
sir i read that already
and then you asked the same question again
instead of explaining what you're actually trying to do
i think ill program a backpack plugin in which u can store filled backpacks in backpacks🤔
Im trying to save a hashmap of Integer and ServerPlayer to config file
and why
Considering there is literally secret keys in gh
so they dont disappear
@tawny remnant question what you want?
cus you could just use UUID in a list
Map<Integer,ServerPlayer> myMap = new HashMap<>();
getConfig().set("myUselessMap", myMap);
ez
@tender shard It's not even my credentials how do I change them
totally useless though
Watch people ban themselves
idk lol
never used github packages
exactly, natural selection
either that or the server dies
Just enabled it and still not workin
This will save the whole map correct?
sure
?paste the ENTIRE maven output
(Also yes i did reload maven)
isnt a map serializable?
sure meaning sarcasm or "yes"?
it means yes
okay thank you
it won't be of any use though
cus im not loading it am i
how did you even compile it then?
I pressed the build button
which one?
that's not maven
you have to use maven to compile
Upper right, maven tab -> Lifecycle -> package (double click)
ctrl + ctrl -> mvn package
btw is it possible to have different jetbrains ides linked to different git accounts? i use intellij for private projects but i need to use clion for a university project xD
and in order to not get kicked out i need to commit using my university mail
but it seems they use the same global settings
Just built and tried running and it errored out
https://pastebin.com/3cFfC8A0
Not code related from looks of it
go complain at paper
Caused by: java.lang.IllegalArgumentException: File 'plugins\SynMC-1.0-SNAPSHOT.jar' is not a valid plugin file, cannot load a plugin from it!
Gotta read your errors lol
that's a paper bug
I dont get how its not a valid plugin file
it's a paper bug
Ah
Ask on le paper
someone earlier had the same issue
then paper confirmed their shitty new plugin loader is shitty
🥲
at least that's what they reported back
There possibly an issue with my directories?
It goes src > main > java > com.kunosyn.synmc > SynMC.java
recursive answers require altered conditions to have a definitive end
no, otherwise it would complain about missing main class or missing plugin.yml
it's a paper bug
?paperbug
I just wanna know how to fix it tbh lmao
It was working perfectly fine before i switched to maven as a dep manager
yes, because spigot is known to throw custom plugin loading logic into classes called io-papermc.paper" lol
no that the bot is ded
wait until paper fixed their plugin loader
or stop using paper
yeah just run spigot
i found 2 functions i wanted to use that paper has that spigot doesnt
and i worked around them
other than that idk what the advantage is supposed to be
the "advanced" api has like 10 functions more xD
Idk how to run a server using just spigot and not paper
?
paper is a spigot fork wym u dont know how to run a spigot server
I mean as in idk how to stop using paper
Like how I would setup a test server with spigot
Does your plugin’s .jar even contain a plugin.yml file?
are u asking how to use the buildtools?
doesnt the plugin.yml need to be in the resources directory?
DM me your .jar file, then I can check whether its correct. However if it werent, papers error message should look different
Yes
It should unless it was excluded by the dep managers build
If its missing from the jar, paper should say „missing plugin.yml“
Instead of the error you got
At least thats how spigot does it and how paper used to do it
i actually had problems with the plugin.yml so i manually added it to the jar to figure what went wrong. then i figured it wasnt included in the first place cause i didnt put it into the resources dir
🤣
Ill send it to u
damn that is crazy too, but how do you set no ai on entities in 1.8 ?
Slughorn, ofc
Damn that's crazy but where do I find spigot for beta 1.2

but yea, the error is no plugin.yml
the message is a bit bleh, but since paper has paper-plugin.yml as well
its a bit more complex than "Missing plugin.yml"
I'll bring it up for fixing tho 👍
if(both missing) error
It could say „missing plugin.yml or paper-plugin.yml“
yea both are missing, the error just needs to be more descriptive
i get ptsd from those bot comments
Sent the jar to u
just need to write a simple webapp that checks for it
yeah you don't have any plugin.yml
it belongs into src/main/resources/
xD
Someone earlier had the same error message and claimed the paper guys said its a paper buf
Bug
So apparently the bug just is the bad error msg
Idk loo
Lol*
Yea
Probably
Paper did say theres an issue tho
They said their error should be more descriptivie
Which is true, the current message is useless
descriptive however u spell that
They said its an extremely common issue
i have a problem with multiverse core it load the flat map but not the buildings which i have built on the map whats happening ?
throw new NullPointerException("u have error");
Thats exactly why
just put the plugin.yml there
I downloaded 1.19.4 from the spigot site directly and set my own dependency using a module
I did
Its all g now
You cannot download spigot from the spigot website
Then how did i do it lol
You can only download it ilegally from illegal websites
Oh 🤷 i just followed a yt tutorial

Wouldnt surprise me if „illegal bukkit download website“ would add shady stuff to the jars
lol the bot deleted my msg
Well i could easily write a jar that doesnt get detected by any website but still sends me all your home folder sooo uh
But that is just the API
not the actual server software
Yeah but you needed NMS
Mhm
So you needed the actual jar
Oh yeah naw just the api file
Then when to like modules and added it as a dependency
even worse, since its a server u need to let it trough ur firewall
so
u wouldnt even notice it
cause i mean its a server xD
Is there any way i can configure my inellij so when i press run it just runs the bat file that starts the server for me?
So i dont gotta like go to file explorer n all that
why
you'd probably be configuring gradle / maven instead
Ah
yes, ew
🤔
you can add another maven profile with the maven-exec-plugin
here, I wrote you an unfinished blog post. "running the server" is the same thing as earlier, just enable the profile https://blog.jeff-media.com/start-a-test-server-using-maven/
oh wait
that's missing the maven-exec part
Damn
now I remember why I didnt publish it yet
Lol
gime a minute
👍
<profiles>
<profile>
<id>run-test-server</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>run-test-server</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>/Users/mfnalex/mctest/start.sh</executable>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
sth like this
Ight thanks
havent tested, I got the actual working thing on my laptop but that's in the bedroom
what's better in gradle projects
target and source compatibility fields
or gradle java toolchains
depends
do you wanna use the same JDK as the one you set your target/source to? if so, toolchains
Plugin 'org.codehaus.mojo:exec-maven-plugin:3.0.0' not found
reload maven
it's supposed to be a plugin declared in a profile
wdym by "do you wanna use the same JDK as the one you set your target/source to?" are you saying i should combine them
what's the purpose of combining compatibility fields
with toolchains
can't really be, it's on maven central:
i cant see any benefits when toolchains literally download builds of jdk to compile
unless you want to deploy it on older versions of jre
well I for example use jdk 17 to compile, but with a source/target set to java 8
Some JDKs don't support the release flags
that way I can access dependencies that use java 17, but still make my stuff work on java 8
Or have other whacky behaviour
gradle toolchains do not allow this
how tf does that work
you have java 17 class bytecode
do you mean when you shade them?
no, I mean when accessing other plugins
Hello
e.g. imagine I have worldedit as optional dependency. imagine worldedit requires java 17. That's why I need java 17 to compile, otherwise it would complain "cannot access class com.worldedit.whatever"
I still want my stuff to work on java 8. So I set target/source to java 8
that works just fine
i kinda get it but kinda not
if depedency is a jar file
lets say
its compiled to bytecode .class files
with jdk 17
Maven ftw
then change your start.sh file to use the proper server.jar name
and you're compiling your plugin with the same ver of jdk
what happens when you access jar plugin files
which is compiled with older jdk
jdk 17 can access java 17 .jars but still compile your own code for java 8
then everything works fine because java is backwards compatible
lets say i compile with java 8
Okay hi guys so I want to know in which 45deg direction the player is looking and turn that by 90 or -90 degrees to get left/right of it, how would I do that?
Take the direction, ignore y, somehow clamp to 45deg?
Asking again since other people are on right now:
What is the best way of adding your own dependencies that are generated at compile-time? Preferably without using maven - but sources MUST be attached to the dependency (using a file collection with the sources and the "real" jar does not work as-is)
Implementing SelfResolvingDependencyInternal on my custom AbstractDependency instance doesn't seem to do the trick when running ./gradlew dependencies
can't you justt add/remove 90 from the location's yaw?
The thing is it only does that when running in intellij
Well I wanna know in which direction I gotta move my coordinate
When hitting left/right in my ui, it should move the coordinate on the actual left/right relative to the player
ah ok. Add this to your exec-amven-plugin's <configuration> (where you also got the <executable> part)
<workingDirectory>/Users/mfnalex/mctest</workingDirectory>
like this
is there any way to make optional toolchains?
Alr
like if there's targetcompatibility version
of jdk
then jump to the toolchain declaration as a fallback
I mean then I do know the angle, but not in which direction I gotta move
So basicly I need translation between coordinates and rotation
hm maybe you need some sinus/cosinus/etc math shit for this
Works ty
Im fine with that
I love maths
But well.. I don't know how that would be useful here
Ty imma take a look at it tomorrow for sure, but it does not clamp to 45degs
How could I get a recipe's matrix? Basically Im trynna make a listener so people cant use my plugins custom ingot "Enderite" to like craft something like anything that you would craft with normal iron since its just an iron ingot with metadata
declaration: package: org.bukkit.inventory, class: ShapedRecipe
that returns the string as it's defined, e.g. {{"#"},{"#"}} or
#
#
for sticks, where # is wood planks
however are there actually any vanilla recipes that do NOT use material choices?
because materialchoices also work with metadata
or am I confusing sth
You're way better off comparing the recipe's key
wdym with comparing the key?
ShapedRecipe#getKey()
how would that help?
I could just use the recipe ingredient map
I thought the opposite was true, I thought they wanted to allow it lol
i misread
There any better way of doing that? Other than using an event to set result to air under circumstances?
Yeah I was going to suggest the ingredient map as well. The shape won't matter
just cancel every craft prepare event whenever one of your custom items is inside the matrix
Nah, recipe prepare event is your only bet there
But you're able to craft things with the custom ingredient
I just dont want them persay using enderite bars to craft an iron pickaxe
then just check whether the matrix contains your custom item, and if yes, if the recipe that's being completed is NOT your custom recipe, then cancel it
hmm i didnt knew you can embed cpp code inside jvm
JNI allows you to write c/cpp code
and execute it through jvm
imagine the potential for large scale networks
for this
i wonder if hypixel utilizes this to balance network load
It really doesn't
that's e.g. how getClass() works
Its primary use is to get access to some functionality at a lower level than Java
i mean there's not much potential since most of the minecraft code is in java
e.g. some OS-exclusive API
but still
Trust me. It's not as useful as you might think to Minecraft servers lol
Before you get excited: JNI may not be with us for long
The JVM devs plan to eventually lock down JNI
it does more then just this
however it has a downside though
the downside is that it is only handy for some heavy weight code stuff that can be done better in CPP or long running code because context switching kills the performance gains/benefits
there is more then JNI. JNI is just one part of a suite of utilities
JNA and JNR exist
it isn't the JVM that executes the native code fyi, but it should make sense why you are able to use such things with Java given the JVM is built from c/cpp 😉
Is there any way to add multiple recipes at once?
Instead of individual addRecipe?
No, you’ll have to call addRecipe for each
Damn
If you want to add a bunch quickly, throw them in a collection of some kind and loop over it
but JNA will exist though right?
I know this sounds stupid but surely if ur doing it every 45 degrees.
Get ur current angle.
Divide by 45 and get the remainder.
If the remainder is less than 22.5, it's the 45 degrees closest to the left, if it's more, it's it's 45 degrees to the right.
Snap to the appropriate 45 degrees and then rotate 90 degrees in the way you need
- other way around
https://paste.md-5.net/nitiwokugi.java
https://paste.md-5.net/obuguzudoy.rb
Bungeecoord,
I'm trying to send a player to another server using the bungeecoordapi. The error messages above are precicely what i'm having trouble with.
So I wanna make custom pickaxes so as a basis for the custom stuff I make it wooden then modify its meta, i was wondering if theres a way to make a wooden pickaxe as efficient as a netherite pickaxe or like just generally change efficiency of pickaxes?
Like through use of nbt tags or so on
you can probably modify packets and increase the mining rate taht way
as I know that is how hypixel skyblock does it
I havent been able to find anything on modifying packets but seen it mentioned on the spigot website
tbh im surprised is how easy to make JNI compatible shared libraries
compared to how pain in the ass is to setup php extensions
you can send mining fatigue packets and do some funky stuff for arm swings
and then emulate the block crack packets
to basically make custom block breaking
oh hi illusion youre good with apis could you help me with my bungeecoord problom?
How do I include craftbukkit as a maven dep
I wanna be able to run ItemStack.asNMSCopy but I think its a craft bukkit thing
?buildtools
?nms
use this if you want to access NMS or craft bukkit classes
Can we store custom data in an item in 1.12.2? I don't see PersistentDataContainer there.
Not with the api
So, how?
Ohh I see, the keyword is NBT, thank you!
I tried to set the item in hoppers when hoppers move items by doing either removeItem or setItem, but neither of them affected the hopper despite being executed and no errors showed, what could be the issue?
Code of the listenner that has this issue:
@SuppressWarnings("depracation")
@EventHandler
public static void HopperEvent(InventoryMoveItemEvent e){
if(e.getSource().getType() == InventoryType.HOPPER || e.getDestination().getType() == InventoryType.HOPPER){
e.setCancelled(true);
int empty = 0;
int limit = 10;
int loop = e.getSource().getSize();
while(empty < loop && limit > 0){
ItemStack item;
int amount;
if(e.getSource().getItem(empty) != null){
item = e.getSource().getItem(empty).clone();
if(item.getAmount() > limit){
amount = item.getAmount();
item.setAmount(limit);
e.getDestination().addItem(item);
item.setAmount((amount-limit));
limit = 0;
} else{
limit = limit - item.getAmount();
e.getDestination().addItem(item);
item = new ItemStack(Material.AIR, 1);
}
e.getSource().setItem(empty, item);
} else{
empty++;
}
}
}
Well I want all 45deg rotations to be possible, not only check for slight-left/slight-right
Can I remove all Mojang provided commands?
How does this work?
PluginManager#registerEvent(Class<? extends Event> event, Listener listener, EventPriority priority, EventExecutor executor, Plugin plugin);
What about Listener and EventExecutor?
Not sure why you have to check for player
This assumes that something that isnt a player could drag items in an inventory
Maybe gettype is only set if you hold shift?
Is it possible in any way for a user to be in survival mode but have access to the creative inventory
No
But you could simulate it
The look of the inventory is controlled by the client when it knows its in creative. And both client and server behave differently in regards to creative. So it isnt possible to use some kind of hack to have a player in survival mode but have access to the creative mode inventory. So as you said you would have to create some kind of gui to simulate it.
Interesting. But isnt your matrix like 2 slots away?
If so i dont see that being a particular issue
Yeah I thought so. just wanted to make sure it wasn't possible before i commited to the gui
its registerEvents for a class, thats registering a new e vent
What means this Error? Pls Help!
gotta show the entire error message. Usually the type of error is displayed at the top of the error message, not where it says the location of the error.
show the code
That is not the entire error message. But I'd assume from what you've sent so far that you are trying to do something async that you maybe shouldn't. Can't really say as we don't have any idea on what your code looks like or where in the code you are experiencing the problem.
ok but thx you!
so yk how we have persistent data containers for players and items
do we have anything like that for mobs?
if you can see it on this list it does
Entity is always PD holder
same as ItemMeta and Chunk
i zee
Do you think it's better to customize the plugin language based on the specific player's locale or to create a universal language that is the same for everyone?
So in your opinion, should I avoid using per-player locale?
i'd say it depends on how much your plugn interacts with the player
Depends on what you ^
tysm
well for russian servers you only need ru_RU
but for europe and USA just english would be fine
make sure to always include lolcat
you can just create locale folder with en_EN.yml, ru_RU.yml and so on, and when sending a message just use Player#getLocale to determine which file should be used
if there is no file for the locale use default servers language stated in config.yml for example
like default-language: en_EN
^^
i went to smoke for a bit
now i want to make own library for random shit
like the one i already made for namespaced keys
public static final NamespacedKey key(String s) {
return new NamespacedKey(instance, s);
}
Impressive lib lol
import static me.carefall.lib.Key.key;
...
void method(Object... args) {
// code
key("myKey");
// code
}```
why not
relatively new feature
There's nothing wrong with it. Saves you some extra characters on usage
Also Key.key("myKey"); would look weird
yup
NamespacedKey.fromString("coolKey:KEY") be like
it doesnt
you either use that orNamespacedKey.fromString("coolKey:KEY", instance)
Not according to documentation
declaration: package: org.bukkit, class: NamespacedKey
That's not the fromString method tho
oh
still
looks kinda weird
why arent they tagged as deprecated
cuz they might be for internal use too
I dunno
This is for internal use
I got way too much to do to complete my current project. Both ain't cool
..
the ony which constructs you an instance to your exact purpose
like one instance for working with Items and one for Entities
Is that a Factory?
yeah ig
Yes a factory creates an instance of an interface
Obviously that interface should have implementations but in a factory you just put parameters and get any implementation
public class PDCBuilderFactory {
public static PDCBuilder newInstance(Object holder) {
if (holder instanceof ItemStack) return new ItemStackPDCBuilder();
if (holder instanceof PersistentDataHolder) return new HolderPDCBuilder();
return null;
}
}
public abstract class PDCBuilder {
}
public class ItemStackPDCBuilder extends PDCBuilder {
}
public class HolderPDCBuilder extends PDCBuilder {
}
like this
where both itemstack and holder builders are extending PDCBuilder
The factory itself could be instantiated. Although it doesn't have to be if there's only one
But besides that, yes
You want a factory for a builder?
That would only make sense if you cache those builders because a builder is usually not created to be used a single time
If you create an instance of a builder to create a single object using the builder then your factory might aswell create that single object for you instead
I sometimes reuse those, too
but still
Well the reason for a string builder is that constructing a string from multiple strings is more expensive than using a single object builder
For other objects that's not the case
and for example if you have an ItemStack builder
which would need PDC, name, lore and other stuff
cant u just inst a builder from material
and then use .method().method().toItemStack() to make it as you want it
and then forget about the builder
that's just turning this long process into like one-liner
and instead of working with meta yourself you just let the builder do everyting under the hood for you
I usually create a single function that takes those parameters (or null) for that but if you like the builder pattern that much you can obviously take that route, too
Or you swap to kotlin and never need a builder for such things ever again 😛
i mean that's just the thing i once saw in somebody's code
they had an ItemStackBuilder
There's nothing wrong with it. But why would you want to create a Factory for all those Builders instead of just instantiating them on demand?
which basically had the methods like .withName(String).withLore(StringList).withPDC(key, Type, Value).toItemStack();
if you have a pdc support, then you need one builder for Entity and Chunk and one builder for ItemStack
cuz sadly ItemStack is not PD holder
only the ItemMeta is
i mean you can just have one builder where you pass Entity, Chunk and ItemMeta
but then you need to get the meta and set it back after your builder finished working
But if you create those Builders as seperate classes anyway then instead of Factory.newInstance(ITEMSTACK);. You could just go with new ItemStackPDCBuilder(); aswell
.
like this
you can pass like anything
but if you passed an item you get itemstack builder
and if entity or chunk you get just pdc holder builder
and for everything else you get null hehe
this looks super cringe i know
It would make sense but only if you don't know what you are working with - because otherwise you can still just call new WhateverBuilder() anyway.
lol the "Builder Factory" pattern is actually a real thing
If you do know what you are working with it's just getting the same builder with extra steps
I mean you can do it and I wouldn't consider it bad practice. I just don't think it's reasonable^^
yeah probably
i want to find like any case when Builder Factory might be useful in bukkit
Hello
For nms custom entities
hi
oh bukkit, then no xD
what about multi-version support
when you just return the correct instance of something depending on the mc version target plugin has
The version of the plugin won't help you unless the factory ain't part of the plugin. But it would make sense for the server version when things significantly changed
i guess you fuck up patterns and just send the version of your plugin as a string to the library
and setup a static util class with one inst() method lol
Yeah that sounds reasonable. Just keep in mind that for completely new features you'd still run into an issue.
yup
Like a version where itemmetas don't have a pdc, your builder would still have a pdc method that would result in an error
you just set up the corners of your library
like the lowest supported and highest supported versions
and you loop through all javadocs of all versions
finding what can be wrong if you run X on version Y
what a mess
Sounds like a lot of effort but yeah, that way you could even fix the builder implementation
smoking is healthy
cool
i'll join
It would have a usecase atleast.
But your builders would still have to check whether the current version supports whatever thing you wanna add (like a pdc). And the in the function just skip the "add pdc" part
how is he doing tho, you said he had a medical operation
i guess that's not for help-dev tho
oh he just got the gallbladder removed
nothing special
lol
he had like 12 gallbladder stones lol
brower
apropos bowser, the super mario movie sucks
Does it? customer reviews seems to love it
are you old enough to have played the original games?
I hear it's a lot of fan service so if you haven't played the games you are not going to have the member-berries
idk i am 28
1985
tbh it's not really very good rated
yeah idk just watch it yourself, I found it extremely boring and childish and counted down the minutes until it would hopefully end again
and I even had a few beers before, it was still boring
yeah I can imagine that happening if you've not played the games
lol
why? pay to hate on a movie like that?
I doubt it deserved such a high audience score.
well its not bad, & not too good
it's not the worst movie ever but I would not want to watch it again
If it doesn't fit the current wokewood politics (not somethign we should discuss here).
help-dev is just another general
lmao
where does it say that?
Not sure if it is written down but it's been stated by all mods and md5
I'd not know where to even find the rules 😛
?rules
Please read the rules: http://j.md-5.net/1ikUQuU
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
weird, I've seen MANY political discussions here, and nobody ever cared
thats the IRC rules and it doesnt mention politics at all
the discord rules also dont mention it
which are in the channel description in #general
and the general spigotmc rules also don't mention it
No clue, I've definitely seen md5 ban politics and giving legal advise
and I've also seen many discussions about politics where staff members discussed, too lol
it does happen but I think it's just a general ban so they can shut down any that go bad.
hm all I've seen is mods saying to drop "this specific" discussion, but never said it's generally not allowed
md avoids the legal advice giving at all occurances
he has to as it's a can of liability worms
Gahg - Klingon worms
how those worms called again that live in mudflats? i remember we went to the sea in netherlands with our school once and people at those worms
alive
live? heck no. We used them as fishing bait was all. Lug worms
Lug worms and rag worms
wattwurm. So kenn ichs von der Nordsee
No idea whats it called in english
Thats a Lug worm
You are a lug worm
🐈
lug worm sounds like slughorn, the new fancy term for "nms"
Did we already agree on that?
need to send my daily task manager image with "mmm"
I though we where going to call it 'm'
mmm
I think oliver has a trademark on the repetitive usage of "m"
mmm(™)
4k series was lit. It was barely worth upgrading my 4770k to a 10700k a few years ago
I still run a 3770k on a GTX 1070. Does everything I need
I don't really want to upgrade as new CPUs come with media drm
seems to be crazy
wdym
this?
yeah, not in Ivy bridge
mine is haswell
They do all sorts of things with it. Like prevent you recording any drm media. In some instances even prevents you outputting to things line a Elgatto
I think elgatto is fixed now though
is haswell affected
no recording Netflix though
it came in close to that though, so you'll have to check
it goes black when i pressed screenshot
yep drm'd
I think the 3700 series was the last before they added drm
Just need the right tools i guess
Might not be 1080p or greater, 720p often is less drm
we have 1080p plan
my beloved
I own everything I watch on DVD. Ripped to my NAS
i stream
other than Amazon prime and Crunchyroll subs
fmovies better
?notworking
"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.
Does spigot have an API for that in 1.12?
I know in 1.8 its absent
Shouldnt be too bad then
?paste it pls
what is the difference between your "works fine" and doesn't work"?
?paste your stacktrace
We can do nothing without seeing the FULL error
im guessing your trying to use a newer api version than the server
just post the error
yep method does not exist, use one of the others
you are using 1.12
1.12 will not have the same methods as other vesions
When I broadcast playerPlacedBlocks in the onBlockPlace function it sends the right list but if I broadcast it on the Mapclear function it sends an empty list. I think it is a problem with the scoop I will really appreciate any help.
private List<Location> playerPlacedBlocks = new ArrayList<>();
public MapClear(Plugin PluginMain) {
plugin = PluginMain;
}
public void onDisable_MapClear() {
playerPlacedBlocks.clear();
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("mapclear")) {
if (!(sender instanceof Player) || sender.hasPermission("server.mapclear")) {
Mapclear();
Bukkit.broadcastMessage("§3Map clear!");
Bukkit.getOnlinePlayers().forEach(player -> {
player.sendTitle(ChatColor.BLUE + "MapClear!!!", " ", 5, 40, 5);
});
return true;
} else {
sender.sendMessage("§cYou don't have permission to use this command.");
return true;
}
}
return false;
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
Player player = event.getPlayer();
if (player.getGameMode().name().equalsIgnoreCase("SURVIVAL")) {
playerPlacedBlocks.add(event.getBlock().getLocation());
Bukkit.broadcastMessage("Place block "+ playerPlacedBlocks);
}
}
private void Mapclear() {
for (Location loc : playerPlacedBlocks) {
if (loc.getBlock().getType() != Material.AIR) {
loc.getBlock().setType(Material.AIR);
}
}
playerPlacedBlocks.clear();
}
}```
there is no equipment slot in 1.12
are you reusing the same instance
that's because you create two instances of this class
one for the command, and one for the event stuff
why do you mix command handling and event handling in the first place?
I am pretty new to programming should I create different classes?
different
Hello there, somebody know how to make it so that arrows can pass through certain blocks that the player cannot pass through?
Difficult. Especially because there is a lot of client interpolation happening with arrows.
I don;t see any method in 1.12 for applying attributes to ItemMeta. It was probasbly not implemented in 1.12
Yep looks like attribute in 1.12 is only for entities not Items
probably not in 1.12
why does IJ suck so hard? VCS -> Share on GitHub does commit all files, BUT ONLY EMPTY VERSIONS!!! like, wtf?
Hey is there a way to remove the half gray seethrough background of a TextDisplayEntity? Previously this was done with setBackgroundColor(), but that seemed to be a bug that has been fixed now.
?paste
Okay, so is there any way to make certain mobs visible only to certain players?
Maybe there's some guide
Player#hideEntity
declaration: package: org.bukkit.entity, interface: Player
Thanks
Is there a similar way for blocks?
Player#sendBlockChange
as coll said there's only sendBlockChange, but then you manually have to send that periodically, in case they unload the chunk, then come back, etc
It can also cause issues if the blocks hitbox doesn't match what's actually there
yo spigot finally stopped using @ Deprecated for draft API
draft api?
Api that may not be finished
e.g. Player#hideEntity(Plugin, Entity)
We changed to ApiStatus.Experimental right?
yeah
yowza
Thanks, you really help me
I created a class in Spigot-api that extends BlockPopulator. Then I added the class I created with getDefaultPopulators in CustomChunkGenerator.
I created this code to get an idea of how it works. I had assumed that all chunks would generate a diamond block.
But only some chunks were generated.
Can someone please help me?
public class OriginalPopulator extends BlockPopulator {
World w;
OriginalPopulator(World world){
w=world;
}
@Override
public void populate(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ, @NotNull LimitedRegion limitedRegion) {
Location loc = new Location(w, chunkX * 16, 150, chunkX * 16);
if(limitedRegion.isInRegion(loc)) {// limitedRegion.generateTree(loc, random, TreeType.MANGROVE);
Bukkit.broadcastMessage(chunkX+","+chunkZ+","+limitedRegion.isInRegion(loc));
limitedRegion.setBlockData(loc, Material.DIAMOND_BLOCK.createBlockData());
}
}
}
does "isInRegion" ever return false?
Yo alex any idea? Do I just look to what the number is nearest, a nth of 45deg?
tbh I haven't fully understand what exactly you're trying to do. can you make a quick&dirty drawing or sth maybe?
On my smartphone rn
to me, making an ugly drawing always gives me ideas on what the possible solution would be, if it's about geometry and stuff
Imma send you once im on my pc and ping you ok?
I didn't notice!
Thank you
Keep in mind that my drawings are REALLY ugly
so im gonna have a player data class and a user data, 1st for mc, 2nd for discord but they both need to end up in 1 list, would it better to make an empty interface that both impl with some generic getter in it or do i do 2 lists or just 1 class for both data
sure
is every discord user always linked to one MC user?
not always
then I'd keep it as two separate lists I guess. hard to say without more detail
im just thinking and i somehow have to have them link together so if something changes on the discord side its reflected for the player, but idk how i can have stand alone discord, standalone mc and mc + linked discord
hm maybe you could turn the current yaw into a cardinal direction ( https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/data/CardinalDirection.java ), and then decide with a simple switch/case whether to +x, -x, +z or -z ?
that's at least the easiest thing I can think of rn
well thats 22,5deg, but yeah thanks ill look at it
yeah just adjust it for 45 and remove the inbetween things like NORTH_NORTH_EAST
but you need the inbetween things to make it accurate IIRC
I'D just do sth like this
switch(direction)
case NORTH, NORTH_NORTH_WEST, NORTH_NORTH_EAST: // it's north, so do -x (or whatever)
case SOUTH, SOUTH_SOUTH_WEST, SOUTH_SOUTH_EAST: // it's south, so do +x (or wahtever)
etc
im thinking i do 2 data classes + a wrapper. What could i call a class for user/player data that isnt just UserData or PlayerData
that sounds easier yeah
I'd just do UserData, then it has getSpigotUserData() and getDiscordUserData() or sth
idk
what could i use for discord data class
currently ive got the PlayerData class for mc
DiscorderData
hey , did minecraft development plugin stopped working ?does it work for anyone?
Discorder is a word, trust me
wdym with "not working"?
i used to use a plugin called minecraft development which automatically installs all the files and classes (around 7-8 year ago) , now when i try it gives error and i cant create a project until i have disabled the plugin , i can't even open my old projects
wdym
Is working perfectly fine
check intellij is updated and the plugin is updated
Also it works better with IJ-ultimate from what I heard. I never used the plugin so I cannot confirm or deny that
to me it causes IJ to crash like every other week
it also is pretty useless, it doesn't really add anything when doing spigot plugins
but gradle
i get this error on creating a new project
all wierd things happen to me 😦
looks like the plugin is outdated, or IJ is outdated
im pretty sure thats outdated
you are using some 2022 version, I got 2023.1
i downloaded the plugin along with intelligi in my new pc
odk
oh

