#help-development
1 messages · Page 800 of 1
Nah lol
Want word without json though ig the sentence in general doesn't make sense
probably could if you changed the type
Was talking about same name for generic parameter
yeah won't work since it is an argument list
doesn't really make much sense to include it twice in the same list
My professor for java used multiple letters for generics
MethodInvocation:
MethodName ( [ArgumentList] )
TypeName . [TypeArguments] Identifier ( [ArgumentList] )
ExpressionName . [TypeArguments] Identifier ( [ArgumentList] )
Primary . [TypeArguments] Identifier ( [ArgumentList] )
super . [TypeArguments] Identifier ( [ArgumentList] )
TypeName . super . [TypeArguments] Identifier ( [ArgumentList] )
TypeArguments:
< TypeArgumentList >
TypeArgumentList:
TypeArgument {, TypeArgument}
Like she'd type out words as the parameters
A, B, C
That is actually war crime
It made me commit self die
damn
like
Generic<Key, Value>?
Ye
probably because this is the easiest way to differentiate generics in terms of displaying
Is it like Foo<Type> or Foo<TYPE>
are there single letter classes?
or they cant be created so people can be happy with generics?
ill try
Pretty sure u can make them
i do can
but that isnt a the class
oh nvm
just understood
how does UTF-8 works?
how can I get the direction a dispenser is facing from a Block object
i'm trying to modify a BlockDispenseEvent by spawning an entity at the location, but right now its spawning it inside the dispenser itself. I wanna offset it by 1 block depending on the dispenser direction
// event listening
Block block = event.getBlock();
if (block instanceof Dispenser){
Dispenser dispenser = (Dispenser) block;
}
also is BlockDispenseEvent only for dispensers or do any other components fire this as well?
and well
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/data/type/Dispenser.html
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/data/Directional.html
declaration: package: org.bukkit.block.data.type, interface: Dispenser
declaration: package: org.bukkit.block.data, interface: Directional
declaration: package: org.bukkit.block, interface: Block
This
so do I cast block.getBlockData() to Directional
isnt it the same?
well, pitch is in degrees
and ig it is 0, 90, 180, 270 and 360
east, north, west and south
idk
thought it was
Ye
alright thanks
do you happen to know if this is true
maybe droppers?
Anything that dispenses so atleast dispenser and droppers
oh damn
ok i gotta check that then thanks
// Remove the egg from the dispenser
ItemStack item = event.getItem();
item.setAmount(item.getAmount() - 1);
event.setItem(item);
this is inside my BlockDispenseEvent handler
any ideas why its just not decrementing the amount
i dont got any interfering return statements
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onBlockDispense(BlockDispenseEvent event) {
if (!CustomEggsManager.isCustomEgg(event.getItem()) || event.getBlock().getType() != Material.DISPENSER) {
return;
}
event.setCancelled(true);
CustomEgg customEgg = CustomEggsManager.getCustomEgg(event.getItem());
// Add the direction of the dispenser to the spawn location
Directional blockData = (Directional) event.getBlock().getBlockData();
Location spawnLocation = event.getBlock().getRelative(blockData.getFacing()).getLocation().add(0.5, 0, 0.5);
customEgg.spawnEntity(spawnLocation);
// Remove the egg from the dispenser
ItemStack item = event.getItem();
item.setAmount(item.getAmount() - 1);
event.setItem(item);
}
here is the whole thing
even if I searched the dispenser inventory, how would I even know which itemstack was dispensed?
Just use removeItem with the dispensed item
yeah but how would i determine what the dispensed item is
dispensers shoot a random item in its inventory so how would i know which one it shot
With event.getItem?
so I would do event.getItem() == item?
would they be the same object in memory
because i thought it was a copy
What is item
== won't work most of the time especially with item stacks isSimilar is the way
Item stacks get copied around so much you never know
Some item from the inventory I haven’t figured out the method to get it yet
removeItem only removes the amount of the item and the isSimilar
Ye
removeItem from the dispenser inventory right
But if I use isSimilar then if there are multiple stacks of the same item in the dispenser, it’ll just always remove the first one
rather than the random one the dispenser shoots
Yeah but that doesn’t really matter does it
For me it kinda does
Rip
Can probably add the slot to the event
But until then you’re kinda out of luck
damn 😔
I guess I’ll implement my own randomizer or for now
For all similar ItemStacks
A double chest is the max supported yes
k thanks
You cannn make it bigger by cheating, but not sure how the client behaves nowadays in that regard
the client doesn't behave xD
it'll just throw an error
because MenuType is registry backed if the client recieves anything else it'll just break
you can see a list of all possible MenuType's the client can recieve successfully here
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/inventory/MenuType.java?at=a7e0f1dab84f3d10b8634edc7985566590da5494
not included is the Horse which is sent via another packet
I miss the old >6 row inventories
They were fun
A simpler time.
someone know a good login plugin for 1.8 that have the autlogin for premium users and multi lobby support with database
Wrong channel
is there a way to check if a configurationsection exists in a config file, ignoring default values?
ConfigurationSection eggConfig = plugin.getConfig().getConfigurationSection("egg-recipes.custom." + customEgg.getConfigId());
if (eggConfig == null) {
Bukkit.getLogger().warning("Could not find recipe for " + customEgg.getConfigId());
return;
}
Even if the yaml section does not exist on the server it keeps returning the default value from the plugin's config.yml
i want to specifically handle the case where it doesn't exist on the server
what do you mean default value?
what other value should the config.yml return o.O
I mean I wouldn't really call it a default if its in the config.yml XD
I think you are just using ConfigurationSection incorrectly
i mean like in this example
eggConfig is never null
the if statement never runs
because you are misclassifying what you believe to be a section
i think i understand wdym
exactly
but a single recipe depending how you put it in the config is most likely not
my point is that i want users to delete an entire section and have that take effect
to delete a section you would have to set it null
so if you set egg-recipes to null it should remove it
honestly thats just more confusing then
do you think its better practice to have smthn like enabled: true/false in each section
getConfig.set("egg-recipes", null); getConfig.save();
and then if you were to do getConfigurationSection("egg-recipes") it should return back as null as it shouldn't exist
i don't want to delete the config section for them. my plan was that if a user could delete a section from the config themselves, then that recipe would be removed
like i don't want to be changing the config myself. just want to check if the section exists or not
well you also have to keep in mind the server loads config.yml into memory
so any modifications or reading you are doing, comes from the memory
therefore if someone edits config.yml the changes are not reflected if your plugin doesn't use load()
yeah i understand that
all i need is just a method to check if the section exists in the config or not
well I gave you a link that shows you an example
think what you are missing is the getKeys(false)
hmm
i dont think we're on the same page lmao
its fine i just thought of a better solution to this anyways
well I don't really understand how you are having an issue either
yeah sorry its a little tough to explain
the only thing I can think of in regards to defaults is if you are using copyDefaults() or whatever it is
or maybe saveDefaults()
this would overwrite your config.yml using the embedded config.yml in the jar
well it pulls the values from the embedded one anyways
ok yk how most of the config functions will check the default config file if the provided key doesn't exist
i want it to not do that
it only does this if you tell it to
that isn't like default behavior o.O
for the getConfigurationSection that doesnt seem to be the case
check pull request
i know its like that for all the other ones like getString or getBoolean
did you really pr something to this?
just for the readme
ah, well going to have to wait I have to find my old phone to reset my pass 😛
the <name> placeholders were not shown because github strips "html" tags
well my defunct plugin checks for what you are saying and it will NPE if it attempted to iterate over the section if it didn't exist
so it works just like all the others
it also does not provide a default either
unless I want it to
and yes the defunct plugin does ship with config.yml embedded too
🤔
so I don't understand what you are doing wrong other then you have something coded wrong
but you also haven't provided code either
just dont worry about it lol i already ended up using an enabled: true flag instead
somewhere in your code you have a cache
and I have a feeling you are having an issue between cache values and real values
XD
perhaps its this?
@Override
public void onEnable() {
saveDefaultConfig();
...
}
i thought that only copies over the embedded config if it doesnt exist on the server
oh that isn't the one
correct
do you use addDefault() anywhere?
@Nullable
ConfigurationSection getConfigurationSection(@NotNull
String path)
Gets the requested ConfigurationSection by path.
If the ConfigurationSection does not exist but a default value has been specified, this will return the default value. If the ConfigurationSection does not exist and no default value was specified, this will return null.
the only way this method could return a default like you are having issues with is if you were setting a default
then load the config manually instead of using getConfig()
nope
I wonder if you assigning the section like you are to ConfigurationSection object counts as a default
maybe try it like the way my plugin has it?
Inventory anvil = Bukkit.createInventory(null, InventoryType.ANVIL,"Renommer");
player.openInventory(anvil);```
not working, why?
Inventories created using createInventory aren't "real" inventories. so things like the anvil logic won't work. idk if Spigot has Paper's HumanEntity#openAnvil nowadays, but if it does use that
You gotta trick the player sometimes depending on verison etc.
ok i know where is the issue
basacly i did open 2 inventory at the same time and the anvil one was behind
and thx for advices i'll try it
How might one find all present sub-processes in the Java instance, similar to spark?
by using a java agent
I mis-read, I think I know what you are wanting
are you asking how do you get all the children id's that are related to the parent process?
Yeah, all the children ids under the spigot server, similar to spark profiler
In order to hopefully list the processes by memory usage
good news, it is easier then you are probably thinking 🙂
import java.util.stream.Stream;
import java.util.Optional;
public class ChilderenProcessTest {
public static void main(String args[]) throws InterruptedException {
System.out.println("---------------------------");
System.out.println("Children Processes:");
Optional<ProcessHandle> processHandle = ProcessHandle.allProcesses().findFirst();
processHandle.ifPresent(proc -> proc.children().forEach(child -> System.out.println("PID: [ " + child.pid() + " ], Cmd: [ " + child.info().command() + " ]")));
}
}
Damn
have fun 🙂
Thank you lol
is ProcessHandle not supported in java 8?
i see
can you send tablist information and set the player list name of a player asynchronously?
This document contains reference information for the tools that are installed with Java Development Kit (JDK).
Manage OS processes and get cpu and memory stats cross-platform in Java. - jezhumble/javasysmon
before java 9 it was quite the pain really
well, depends I suppose how you wanted it done
typically it was easier to go with ProcessBuilder and invoke some script or command line stuff
yeah it does look easier in java 9
That is because Java 9 introduced the Process interface
which allowed getting information from outside of the VM lol
all the more reason to use updated JDK versions
but people insist on using outdated stuff I suppose
only reason i use java 8 is for compatability
if i could choose to remake my plugin i would probably have done 17
but its too late now
never too late
just set a version of the plugin destined to be upgraded permanently 🙂
around 8% of my users are under 17 do
some things are not worth the trouble to be compatible for XD
you don't have to move to Java 17 unless you have a specific reason for it
however, you should at minimum probably target Java 11 or 12
Java 17 though, has unix sockets and some other things of course
but native unix sockets are great

yeah i can't see myself using that
do you use DB's?
no
I forgot which I'm building with maybe 17 I need to get the latest java paper jar and upgrade to latest. Just cause I'm learning for college and future career
oh, well mysql using unix socket doesn't have the over head of the TCP stack and its faster. Also there isn't a such thing as losing the connection unless the mysql server dies.
I do at some point want to make a PR to bungee for unix sockets
and spigot
but, idk if I will get to it though lol
in that example, unix sockets are also more secure 🙂
but if you don't see yourself using it, may want to look at other features of java 17 and if there is nothing there I suppose just target a lower version XD
but you know now that the API you need to make what you are wanting easy is only available in Java 9+
I'd like to convert my filing system to a database I'm using all my mythologies for creating the config in one java file so hopefully that makes me able to streamline it better. I'm currently saving every block a person breaks in a file with just me testing it's fine but long run probably bad way to handle so much data
This week's computer class is advanced storage systems which refers to things like databases along with parallel arrays ... So best time to learn it
I'm wondering how itemsAdder was able to adjust blocks durability and explosion resistance if this is not possible for the block
you are going to want a binary file
I helped someone about 4-5 years ago develop something similar to what you are doing
the question is how much ram can you dedicate to it
anyways, with the binary file, you are going to want to come up with a delimiter or two so you know when one data ends and another starts
you then want to use memory mapping
memory mapping essentially loads the file into memory but this type of loading is separate from the jvm itself
there are two ways to memory map, you can either memory map the entire file. The caveat here is that however large the file is, is how much ram it will consume
so if you don't have the ram for it, it won't load
the other way is to create a buffer of predetermined size and you would scan the file. It will load however much into that buffer at a time. It can still be quick but slightly slower since you can't know if the data you are searching for at any given time is after the buffer or as you move along before the buffer
why can't I have a thread for each chunk 🗿
tick sync
nuh uh
anyways, back then the test done was loading and saving 20 million blocks
it managed to do so in 6 seconds for loading, and 3 seconds for saving
the other advantage of memory mapped files, well two actually
is one if the JVM crashes the memory mapped file will eventually get saved by the OS automatically
second, you can actually transfer info between two separate applications using a memory mapped file and is actually the basis for unix sockets
Thanks I'll look into it when I have the time to spare. I don't think the term gets that in depth but learning new things is good. Next term is project management which I need. I don't think of every variable when creating my hiarachy charts, flowcharts, and pseudocode. I understand how you have to teach the program like it knows nothing at all. I don't know much outside of c# and a little bit of java either I know other programming languages are easier to write and look a lot more like human speech without brackets (Python comes to mind) for now though I like the brackets. Ultimately I'm doing data science and I'll only be in Python and databases though
most programming languages can do memory mapping
this is because memory mapping of files is actually something the OS provides/does
memory mapped files are handled by the OS, so you actually invoke OS api's to create them. This is why when the application goes away without closing the memory mapped file, the OS will close it out for you
just takes time. In windows, I believe the time limit is 5 minutes or so
When i see frostalfs name + "memory mapping" on my screen i get flashbacks 
I think this is his favourite technology
Decided to try to squeeze in modularizing my plugin, rewriting file saving just the get config method the rest is already modular, and switching to a binary file, database or both this week. Which may end up being a few months instead
I've been writing this for almost a year now, I've kept good comments and tried to not have spaghetti code but when I added assassin's creed like sneaking that java file is a mess there's so many things you have to keep track of just to stop creatures from attacking you based on shifting, distance, if you get hit or if you do damage... Then the abilities, the exp system... I'm not amazing at math having a percentage that then increments another value and that percentage gets bigger after every level up was complicated for my brain
i got a little thingy where im using gson to load in a list of recipes, and i'd like to be able to include newer items by default, though that also means it'll throw an exception if said items are attempted to be loaded on older versions. is it possible to tell gson to simply skip elements of the list if they throw an exception during deserialization?
Match the material valueOf
matchMaterial
but im not looping through the recipes myself im letting gson do that
its not like im using yml
You still have to parse each gson object dont you?
Well how then
Seems like an implementation failure on your part then
There will have to be some sort of iteration somewhere
why? is this wrong to do then
I don’t like ur theme haha
i dont like your face
Why does it have to be generic?
thats rude i do like your face
If I read this a year ago I'd be lost I understand this today
because i have a bunch of implementations for recipes
making it generic prevents me having to make one of these methods for each type
You can implement your own gson reader or whatever it is called
Adapter
ill see if returning null is allowed lol
it just tells the method the type of object i want gson to grab
T in this case extends my custom recipe
so im wanting a list of my custom recipes
Yeah I feel an adapter would make skipping recipes much easier
wondering if gson wont freak out if it returns null then
Just throw an exception
Catch it in the iteration
Pretty sure an adapter can return null anyway
turns out i wanted threads, not sub proccesses
idk
they sound different
ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
ThreadInfo[] threads = threadBean.dumpAllThreads(false, false);
for(ThreadInfo threadInfo : threads) {
MessageUtil.send(commandSender, threadInfo.getThreadName());
}```
so far its only prints the following
[22:21:58 INFO]: Finalizer
[22:21:58 INFO]: Signal Dispatcher
[22:21:58 INFO]: Notification Thread
[22:21:58 INFO]: Common-Cleaner
[22:21:58 INFO]: DestroyJavaVM
[22:21:58 INFO]: Log4j2-AsyncAppenderEventDispatcher-1-Async
[22:21:58 INFO]: JNA Cleaner
[22:21:58 INFO]: Timer hack thread
[22:21:58 INFO]: Yggdrasil Key Fetcher
[22:21:58 INFO]: Worker-Main-1
[22:21:58 INFO]: Worker-Main-2
[22:21:58 INFO]: Server thread
[22:21:58 INFO]: RegionFile I/O Thread #0
[22:21:58 INFO]: Tuinity Chunk System Worker #0
[22:21:58 INFO]: Tuinity Chunk System Worker #1
[22:21:58 INFO]: Paper Watchdog Thread
.....```
can't actually see the other plugins
Get a thread stacktrace or whatever
how much?
?
a thousand euros
To me? Thank you very mich
I’ll use them for like smth
Sad
m sorry
the contract is signed
pay up
if you dont have the money go out there and rob an elderly person like the rest of us
oh so yore indian
is JavaPlugin#saveResource async or what
Why would it be async
afaik its not
because my configs arent properly loaded in on first startup even if i have done saveresource prior to it
users would have to restart their server twice which seems pretty annoying
are you loading before saving?
nop
setup is literally like this and it's not loading in all of the contents
seems to be random as hell too
like its working fine for 9/14 skills but for 5 it decides some properties just arent there
i could try to simply delay the getConfig part a couple ticks but that just feels wrong
1st startup it doesnt work, on consecutive it does
hence why people would have to restart twice to get the plugin to fully work
i know im doing something wrong but i dont even know where to begin looking because for most cases it works fine
and its consistently these 5 that it fails on
but theres functionally no difference in usage with those
Hey guys; I'm having an issue with the saving of a default config.
the .set() method works fine, I'm getting the three bottom test values in the yml.
However, the addDefault() doesn't work for me. Not in the loop; nor the test value below.
Yes, I've already googled and chatgpt'd 😉
Anyone any idea?
addDefault does not add real values
They are magical hidden values that are used when no value has been set
spooookyyyy m,agiccccc
/**
* @return returns Coll1234567
* @deprecated spigot dumb magic value
*/
@Deprecated(forRemoval=true) // Paper
public Coll1234567 getColl1234567() {
return this.coll1234567;
}
is Coll1234567 instanceof Normal
valid deprecation 
😈
whos gonna make you remove ur own events now
if you deprecate Inventory PR I will create a new fork of Paper called Y2K_Paper and steal every ounce of market share
y2kpapermc.io has a nice ring to it
is that going to be the dom com bubble of paper forks
yes
tacoY2Kpurpurfish
im going to have so much fun removing the power supply from my current pc
I actually have a hush hush super secret NMS project for testing and fucking around with internals called Dripple, dont' tell anyone though 
should i just buy another power supply
not unless you have plans for the server
i dont
then I wouldn't
if everything should be here by wednesday except the cpu do you think its a good enough time to start removing my stuff from my current pc or do i wait untill the cpus arrived
wait for the CPU
or you'll have no PC
i mean i dont really care if i dont have a pc
its a thursday
nothing to actually do
programm?
i mean i could
but i could wait
i have all thursday to build it but it if i dont im waiting till saturday pretty much
For those wondering
Adding configuration.options().copyDefaults(true);
fixed my issue.
Hi guys... Is there any way to cancel AsynChatEvent in 1.20? I just realized that it is not getting cancelled. Probably becauise the signing?
there is
and it should work the same
And what is the way? 😄
Using some of those "Disable signing" plugins?
or some bungee/bukkit setting?
and how? I literally created just AsyncChatEvent event handler and did event.setCancelled(true); and messages are still showing in chat
EventHandler annotation? Registered? Add a debug message
I tested 3 times... it is calling the event handler, and isCancelled is true
its 1.20.2 papermc server behind bungee btw
well something is wrong with your code the event itself works fine
and has not changed
We can't help further without code
Add another handler with monitor priority and check if its still cancelled
ohhh... yep... CMI is doing it... ffs 😄
Do anyone here use CMI and know how to override it? 😄 even priority HIGHEST is not overriding it
I mean i know what i would do to solve this 
uninstall cmi... 😄
yep
Then find out what CMI does and if you can configure it so that it doesnt bother you
they seems to be using @EventHandler(priority = EventPriority.NORMAL)...
actually is there a resource how event handler annotations get converted into, yknow, event hooks? I'm curious
it uses reflection to find the annotations then just adds the methods to the handler list of each event
best is to probably just look at source
?stash
last time i tried that i almost made alex lose his mind
are you offering yourself this time?
no
im really confused, i ran ./gradlew build and it successfully compiled oraxen, i just cant find where the jar file is 👀
root@germanythpire:~/oraxen/oraxen# ./gradlew build
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :compileJava
BUILD SUCCESSFUL in 1m 51s
6 actionable tasks: 5 executed, 1 up-to-date
build/libs
thanks
heres where it starts https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/plugin/SimplePluginManager.java#609 pretty much just track where it goes and you should find most of the code
some might be in craftbukkit
oh thanks
Do you think it’s a good idea to make explosion resistance using entityExploreEvent and the recorded durability in the block?
The only thing I don't know is what the default value is for tnt creeper, crystal, bed, and whizzer's head.
@lost matrix I think I figured out what is causing the issue
actually I am pretty sure that I have
but I'm having a hard time fixing it
What was it?
is
so what I suspect is happening is that I have a mismatch between a global coordinate system and a local coordinate system
tried compiling latest version from github, error:
Starting a Gradle Daemon (subsequent builds will be faster)
> Configure project :
w: file:///root/oraxen/oraxen/oraxen/build.gradle.kts:40:13: 'paperDevBundle(String? = ..., String = ..., String = ..., String? = ..., String? = ..., String? = ..., String = ..., ExternalModuleDependency.() -> Unit = ...): ExternalModuleDependency' is deprecated. Replaced by extension methods
> Configure project :core
Branch: master
FAILURE: Build failed with an exception.
* Where:
Build file '/root/oraxen/oraxen/oraxen/core/build.gradle.kts' line: 56
* What went wrong:
null cannot be cast to non-null type kotlin.String
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 2m 11s
root@germanythpire:~/oraxen/oraxe
such that the rotation is "correct" insofar as that is it rotating on the "right" axis, but when it gets inherited down the chain the position of that axis remains the same on the local coordinate but not the global coord
Yeah makes sense
I can actually replicate this 1:1 on the model editor by using local rotations
it's a toggle it has
so I am decently certain that's the issue
now how I'm supposed to fix that is uh...
have not figure that one out yet
I feel like I should be rotating the rotation, but maybe that's the wrong approach?
It calls the BlockExplodeEvent
any clue 7smile7?
🤷 Just make sure that order of operations isnt influenced by this
sure but how
i m trying to create a spigot plugin project in intelligi using mc devlopment project but it does not seem to work , it gives a lot of error , i think its unable to sync and build option does not work either
well you'd better show us error
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
i tried to resynch using build option and it shows that
Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:3.8.1 from/to central (https://repo.maven.apache.org/maven2): Connection reset
and its more than 10 mins and still its loading
is that your first time using mc development project in idea?
i changed my pc . in the newer one i am getting this problem , usually what i do is use the plugin to create a minecraf plugin project and everthing goes fine
but now its showing error everywhere as if it cant use the bukkit files
.
in pom.xml i get error here:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
https://pastebin.com/DqnefGQA
this is the full pom
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
why are u using java 8 for building for 1.19 minecraft tho
its java 17
i selected 1.17 that version during project creation
no it's not
well change it to 17 in properties
and try Maven -> Update project
idk how to do that in idea but in eclipse its like this ^
wow it fixed everything
how da hell does isPreferredTool work
im getting true on wood.isPreferredTool(pickaxe) lol
This is why you use the tags
bro
isPrefferedTool is more like canBreakBlock iirc
man MINEABLE_SWORD doesnt even exist
😭
😭
maybe itll actually work with isPreferredTool
oh mah god it does
this also occurs with tags-
hmm?
nuh uh
im tripping
im not sure how to handle swords actually
i guess i just hardcode that
nuh uh
Tag.SWORD_EFFICIENT it is
no okay i think its trolling me again hold up
💀
Material blockType = Material.COBWEB;
ItemStack itemStack = Material.IRON_SWORD;
return (Tag.SWORD_EFFICIENT.isTagged(blockType) && itemStack.getType().toString().endsWith("_SWORD"); // false```
solid
I AM A SHINY GOLDEN GOD
BOW DOWN TO MY SUPERIOR MATHEMATICAL PROWESS
it finally works
jfc
ga-ga-ga-ga-ga-gaming
its so ugly wtf
i fucking will
it wont have fingers
looks like a hytale figure in the middle of minecraft
😂
so you're saying I can sell my plugin to Riot
probably not
bidding starts at 1.5bil usd
1.7
better patent fingers
I'll wait for your paypal transfer of 1.7 bil usd to come through before calling the auction off
do you like the green boy more
man this was so easy to fix too
if only I hadn't spent a week trying to reinvent how bones worked and I had just gone and checked how blender does it in the first place
forgot to give him fingers
how comes u didnt use blockbench btw
personal preference or acc reason
oh
tbf you said you checked how blender did bones
i assumed blockbench also did bones
oh
blender has good support forums and blockbench is basically done by one dude I think
so blender happened to have someone who nerded out over matrices
very easy explanation really, absolutely minuscule amount of math
fair enough ty
I'm shocked I actually got it right straight away too, took me like 10 minutes to implement it
after two weeks of sweating over this system
when the code works first try
basically yeah
now I have to go back and tear out my old code structure though
friendship ended with EulerAngle class, my best friend is now Quaternion
almost
apart from whatever the hell
the thing on his side is
also it looks like
his hands is inverted
it has to be on the other side
since if he is gripping it
yall are making some wild assumptions about goblin anatomy
who's to say their hands aren't backwards
bc they arent
source?
i have a short friend we can use as the src
LMFAO
didnt even mean to ping him 💀
i thought you were gonna say yourself ngl
bro gonna ban me 😭
clearly photoshopped
you are clearly photoshopped
i hate u icl
i get not found error when i try changing maven spigot-api to spigot for nms , i have installed the buildtools
if u dont have any errors what do u want
oh nvm
just use gradle
the error is "not found"
yes, use gradle
?nms
ly2
i did not tried to change the build part yet , i am doing that now
hmm maven might automatically use your local actually, my bad
hello i'm making a small chess project, was wondering if there was a better way to wait for the stockfish engine, whilst not freezing the rest of the program along with it.
The code above works, but causes the whole thread to sleep (it's not my code, its a wrapper on github)
was thinking about multithreading but not sure with java swing
Use a completable future or something
not too familiar with it but i'll have a go
heres guide
Just start a new thread. Otherwise your program will have to wait for the result.
CompletableFuture is one way.
btw, got it fully working
looks like it should work
i think
i'll do some testing now
seems to not crash at least
nevermind i forgot something i think
Very nice 😄
oh i just realised
i am a total idiot
i was appending "text" instead of the variable text that i made
is dat resourcepack + plugin stuff?
Yes
yep
i once worked on a server called Pulsar, they tried to implement per-planet mobs like this
i was coding interplanetary spaceship bungeecord travel system for them
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData cannot be cast to class org.bukkit.block.data.type.Snow (org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData and org.bukkit.block.data.type.Snow are in unnamed module of loader java.net.URLClassLoader @67424e82)```
in line: Snow snow = (Snow) blockData;
how i get block data:
```java
org.bukkit.block.data.BlockData blockData = block.getBlockData();```
cant understand why is it typing that im trying to cast org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData
i even not import that
thats the implementation class for BlockData
so how can i resolve?
the block isnt snow im guessing so thats what the issue, if it is snow no clue what the issue is @young knoll might
help?
before that i write block.setType(Material.SNOW);
... social security just sent me a newsletter
what
why does social security need a newsletter?
this is so dumb I'm opening this pdf in my VM just in case it's a scam
nope it's legit
great I guess the tax man now has a newsletter
Our country is unique, in many ways 😉
?paste
Ok why is it whenever I run my command it says /launch? in white text and not the specified code:
Launch.java
https://paste.md-5.net/locinatapu.java
Main class:
https://paste.md-5.net/tumovapehi.java
you need to register the command
ok, how could I do that?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
ok thanks
Ok now im getting a massive stacktrace this.getCommand("launch").setExecutor(new HeeseTroll()); https://paste.md-5.net/fosefowudu.cs
new Launch() not heesetroll
Ok
whats the reason for Bukkit PRs getting declined but then their contents are still merged into master
Thanks
You're initializing your main class over and over again 🤔
it keeps the commit history clean
merges 10 commits as 1 for example
Yeah md likes to rebase
I mean squash merges exist
Unless Bitbucket doesnt support them
Which wouldn't suprise me honestly
They're often slightly edited
Declined just means closed in bitbucket
Can't usually squash merge either since commits must be gpg signed
md ur here early
it might be choco too
How would I go about registering multiple commands though? this.getCommand("launch").setExecutor(new Launch()); this.getCommand("alert").setExecutor(new Launch()); appears to not work
new Launch, new Alert.
have 1 instance of the class and pass that
Launch launch = new Launch()
this.getCommand("launch").setExecutor(launch);
this.getCommand("alert").setExecutor(launch);```
Or just have 1 class per command
hello, i wrote a ffastats command, but now is the problem ihave to execute the command two times , that the stats will be updated:
https://pastebin.com/1cQduhuH
thats what im doing
Alert.java and Launch.java
Oh and yeah I fixed it by replacing Launch with Alert in the 2nd one
i already debuged and show the KILLS AND DEATHS
https://cdn.discordapp.com/attachments/1159548021365801050/1176254659745296526/image.png?ex=656e3384&is=655bbe84&hm=8cacf26f13e2784e838a9604acd6204266e2e5ef8ae7fe5e31cce7a6222620f1&
PacketType type = PacketType.Play.Server.ENTITY_DESTROY;
PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(type);
packet.getIntegerArrays().write(0, entityIDs);
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
manager.sendServerPacket(reciever, packet);
}```
this doesnt destroy entities when provided a entityid, any ideas why?
Are those entities you are trying to destroy real or virtual?
virtual
What do you people generally use for HTTP(-S) webservers written in Java? It doesn't need to be anything fancy, it just needs to listen to webhooks emitted by github
what does writesafely does?
It basically writes if the field exists
and doesn't if it doesn't exist
instead of throwing an error
A bit loaded for his case i think
I guess jetty is fine
Yeah, though spring would ordinarily be fine but I have next to no experience with it
What version are you on?
1.20.1
Just look at a random tutorial. Its really just adding an annotation above methods and starting your server through a class.
Then the packet doesnt contain an int[] anymore
I mean, java also has a web server built in nowadays, might be worth a shot if you just want super basic stuff
Oh it has? Let's see how usable it is
do you know what it contains nowadays?
An IntList iirc
apparently pretty shit, it's in a sun package; I thought they added a completely new API recently, but it was actually just a CLI (https://openjdk.org/jeps/408)
Do the spawn limits in the World Class only apply to natural spawns or also to Entities spawned with the spawn() method
Ah yeah, explains why I discarded that earlier. But hasn't that been here for a while?
Natural
Spawn methods bypass everything
javalin is a library I have not heard of so far
I suppose it has nothing to do with kotlin, right?
well it has kotlin compatibility
it's just a wrapper around jetty under the hood I think
Actually javalin looks fancy, I guess I'll use that one instead
Another option would be sparkjava
Spark Framework - Create web applications in Java rapidly. Spark is a micro web framework that lets you focus on writing your code, not boilerplate code.
Looks equally great. Thanks for all the suggestions. I didn't expect that there were so many options out there
it is actually largely kotlin xd
but it's meant for java use as well
I mean you could use spring, but thats not lightweight :D
Yeah I was just wondering about the name
I think that is common knowledge
And I rather avoid it given that I know it is a bit different with it's use of annotations. Probably not a problem for today's me but I'd rather avoid learning something I may not understand
Well Spring can be quite useful to know when wanting to go into Java Developement professionally, since it's the most commonly used enterprise Framework
Thankfully I don't actually intend on doing any sort of programming professionally. I'd much rather keep it as a hobby
Perhaps if I get desperate I might need to, but at the moment I have plenty of other doors wide open
What exactly are you referencing? Like drops while they die or while they are still alive?
both
do I even need to make method of updating cache Map if I can just use this database's DAO and update it with getter and setter?
*playerdeathevent
(my bad, I thought it was for me, sorry TwT)
Do the Spawn Limits in World also apply to CreatureSpawners?
hello, i want to set an entity as a player's passenger once a player loads into vision of another player. Sadly, once the PlayerTrackEntityEvent gets called, the player hasnt fully loaded in and the entity that should be a passenger end up on the ground.
Any ideas on how i can fix it?
Is there a reason for CraftWorld checking if the spawncategory is null in the first precondition, only to have it as one of the checks in CraftSpawnCategory.isValidForLimits()
PacketBuilder.create(PacketType.Play.Server.PLAYER_INFO)
.edit(packetContainer -> {
packetContainer.getPlayerInfoAction().write(0, EnumWrappers.PlayerInfoAction.REMOVE_PLAYER); // action: remove
packetContainer.getIntegers().write(0, 1); // number of players to remove
packetContainer.getUUIDLists().write(0, Lists.of(player.getUniqueId())); // uuids to remove: player
})
.broadcast();
``` anyone know why `getIntegers().write(0, 1)` throws an error while the wiki.vg page for my current protocol (client 1.8.9, server 1\_8\_R3) says there is an integer field for the number of players
I mean && short circuits anyway, so I don't see that huge of a performance gain except another method call, which should be negligible
alright all cleaned up now, my code for bone rotation logic is a 150 line class
noice
there's a lot of optimization work that can be done here but right now I just want something that works
actually it's bone rotations and the other entity manipulations like setting the name to visible so that's real good
Check the nms packet
is that for me?
Yes
I sort of wish I got the updateTickPositionBasedOnParentRotation working with quaternions instead but 🤷
anyone know how to fix 3rd person nametags
im pretty sure itll show fine for other players
but i cant figure out how to show it for myself
ill try respawning myself with entity destroy and spawn but i dont think the client will like that idk
you mean you want to change your name?
i want it to show the formatted name which is shown in the tablist
above my head
and im pretty sure itll do that for other players
isn't your own nametag client side? I don't think vanilla client does that
btw never send your own client a destroy packet
nametagedit makes it work somehow
your client will no longer be able to move the player
Isn’t it just smth riding the player
its a lunar mod
Ah
if youre talking about displaying the nametag
?paste for me
This was for 1.19.3 to change name https://paste.md-5.net/awotewihah.cpp
Sending the client a destroy packet for themselves sounds great
my current code
im using the display name
field
which is a text component
ill try this
ig
i know
not display names tho
wtf
it accepted the name
im pretty sure &6* &4&lOrbyfied is over 16 chars
wait nah
its exactly 16
and lunar still hasnt updated it
You can make good fake name tags with display/interaction entities
But yeah not in 1.8
What server bound packet with mojang remappings lets the server know a block is left-clicked (beginning to be mined) ?
I have been searching endlessly, with no result
What's the best way to learn Java?
Everyone learns differently. To get started on some basics while learning for free, I'd start with some youtube tutorials. Once you know how to run and compile, you can learn from https://www.programiz.com/
Learn to code in Python, C/C++, Java, and other popular programming languages with our easy to follow tutorials, examples, online compiler and references.
I know how to run and compile, I understand java I just can't type it
Wdym by you can't type it, if you don't mind me asking?
I just can't make it
I can read it
But not make it
I can read src
Your IDE doesn't let you type?
Nono
I just can't make it
I can't explain it geez
I can't figure out how to code it
But I understand what other people make
Oh alr
I can't replicate it that's it
Yeah that skill comes with experience. Try and not start with something too complex. Work your way up as your skills develop
What are you trying to code?
Well
Just a simple core plugin
For my server
That I can add simple commads
Like a alternative to essentials
When I started, i really liked the tutorials by technoVision on YT
It teaches you the basics of spigot dev
I watched like 2 or 3 hours of brocode's tutorial
I'm sadly not going to use spigot's api
Anyways
I'll try
Thanks
What API are you using?
Paper
The tutorial works fine with paper too. Paper is an extension of spigot
It is
Everybody should use whatever they want
I'm not going to use paper tho
As a server jar
Xd
When designing plugins, I usually start with "sudo code" Just write the overall functionality, and break it down into steps.
Whats that
This weekend I'm 100: starting to try making it but for now I'm just going to watch tutorials
dont you dare to say it in a spigot server
Haven't been in this discord for 2 years reason not disclosed
for me it was writing plugins
Well obviously
I learn new thing -> I immediately implement it into a plugin to see why its important
Nice
no not nice
dont do it
?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.
https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
lots of good resources above ^^^^^^^^^
I never used any of those
that's because you were in denial
no they just suck
maybe not oracle one cuz its official and they know what they are talking about
Just text in a notebook or whatever, and write what you want a command to do for example. Once you know what the command does, try to break it down into parts. How is the command initialized for example.
This command makes a circle of particles around the player.
Steps:
The command is registered.
Get the player location.
Make a var stating degrees.
Run a task that does the following every tick:
get degrees.
Calc new point from axis at player pos
Spawn particle at new point.
Degrees = degrees + 1
Then interpret that into Java code.
I'm not paying..
For that academy
nobody forces you to buy premium account on any of those sites
They are all free
Insane
never pay to learn java, only use free resources
^
there is no such thing as for free
the only thing you need to pay is attention
you are paying with something one way or another
Yeah when it's free, your paying with your attention by seeing ads, and getting data collected on you...
i don't think that's how paying attention works
most of those free resources either have premium accounts or force you into making an account
yeah... It'd suck to lose your progress if your cookies were cleared
if your memory is that of a goldfish then its on you
Hello, can someone help me with this? I got 2 classes, CooldownManager and CooldownLoader:
CooldownManager: https://paste.md-5.net/dameribiju.cpp
CooldownLoader: https://paste.md-5.net/idetuzimak.cs
Manager is the Cooldown object, lets say and Loader just manages a map of <Kit, CooldownManager>
The problem is, when i call CooldownLoader#setCooldown, nothing happens
lemme upload a video
can you show your Kit class
if you want to use your own class as a hashmap key, you have to override hashcode and equals
implements Key?
intellij can do that automatically for u
how?
alt + enter -> override equals and hashcode
how do I go about testing when I have to deal with files
make test files in your test resources directory
thanks bro
would this also work if like I need to make files
if you need to make files you can probably utilize tmp directories
java supports creating Tempory files very easily with the old java io and java nio API
Yay delete on exit
is it okay now ?
can u explain "noting happens" ?
Cooldown isnt applied
this is the code block
Kit is given, message is sent but, manager.setCooldown(kit, player.getUniqueID) isnt applied
and well, if he have cooldown manager.hasCooldown(); is true
okay
seems that manager isnt executing at all
But nothing is printed on COnsole
The ItemStack is showed when player claims the kit
interesting, I've managed to break intellij for the first itme in a good long while
it did not like me reverting to a previous git commit
are potion effects like haste/mining fatigue client sided?
nvm i dont think they are
They are both
oh thanks
why does it say static before my variable
you typed static?
no it just appeared
The IDE suggested it and you selected it
nuh uh it said static
the IDE by default tells you to make it static if you try to access it in a static manner
don't take the IDE's advice
whats static
only one instance of the field across all class instances
Huh i thougt fase was better than this
jan about to link to his own post where he stole my index
Ahaha, too lazy to find that. And tbf bing did something with it
bro indexed a bing post
💪🏻
the disrespect
ah yes
im making a T
but i do require a T
🙂
update: fixed it, i was making another generic type T inside inner class when outer class already declares it
Whats up with naming invention __likethat__ ? Is it any useful in spigot shit?
ayo animation states are now implemented
what a great day today was
just need to do some cleaning up tomorrow and add hitboxes
very cool, very pog
no
its just a hacky way to hide variable from autocompletion
and mark it for not public usage
Whats autocompletion
when you type in IDE
you get suggestions
the suggestions are autocompletion
for you
How should I change the block mine sound of a block for a specific player, using reflection?
doesnt Spigot API already provide it?
literally
Player.playSound()
you cant change sounds imo
you can only emit it
block breaking is clientside
but verification of those blocks is serverside
if the server lags you still get block breaking sounds, its not as if server halts and you cant hear any sounds when interacting with world around you (except for entities, that's for some reason is serverside)
I need the previous original sound to be stopped as well. While could do stopSound, let’s say another player breaks a wooden block with the same sound as the other at the same time. It will stop all of the wooden block break sounds. I am adding custom blocks using noteblocks, and I need the break sound to be dependent on each block’s blockstate
why is {} not a json obj
you cant stop the sounds, you can only play them
its clientside
it is json object, but not valid one, javascript would accept that, not sure about java deserializers tho
its easily provable
just hop on to laggy server
and when the server lags
try to break blocks
youll still hear the block breaking sounds
no matter if server handles your block breaking requests or not
that's only achievable with clientside mod
tbh this seems legal, i dont a see reason why its incorrect in some parsers?
I know it’s client side. You can stop clientside sounds though using world#stopSound(sound) though. Anyways, to my knowledge, a packet is sent to the client that states some data on the block, such as its mining sound. The client does not rely on material to determine the sound type I thought
It does
even typescript doesn't recognize {} as JSON object. I would assume its because json by definition must be key-value
{"smth": {}} is valid tho
It relies on the material?
Yes
ok
Brilliant. I have the memory of a goldfish
maybe im wrong, or it was changed in modern versions of minecraft
i dont remember block breaking sounds being serverside
They aren’t
if they aren't how can you control them via the server then lol
apperently i was wrong, ts accepts {}
it depends what do we call a serverside
its just a transpiler of js, why it wouldnt
I could be completely wrong here, but I thought I remember the server sending a packet to stop a sound regardless of if the server thinks it’s playing.
because its not typesafe ? xd
but it acts as null ig
ok you got me
Not sure if you can control them server side
I mean you could remove the sounds via resource pack and then play your own ig
what about this?